qt-interest@trolltech.com
[Top] [All Lists]

Re: QT4.3 coordinate oddness

Subject: Re: QT4.3 coordinate oddness
From: John McClurkin
Date: Thu, 01 Mar 2007 08:10:39 -0500
Jeff Lacki wrote:
Thanks Denis, I tried using scale() for each item and it indeed seems to
flip what I need, but I didnt do everything as I ran into another issue below.


I had similar issues. Even though the coordinate system is documented in the view/scene as having the origin in the upper left, we all grew up learning to think of the origin in the lower left. I solved the problem by using a call to scale to flip the view/scene around
X axis:

    originalDataScene_ = new QGraphicsScene(this);
    ui.originalDataView->setScene(originalDataScene_);
    ui.originalDataView->scale(1.0,-1.0);

-Dennis

Yes, I do know that the coordinate system Im getting it from is lower left,
sorry I didnt mention that in my first email.  I wonder why QT did it the
other way? After you posted this, I checked out google and found many other people with same issues of programs that do it lower left vs upper right and having issues. Since this is my first experience with coordinate issues, I had no idea different vendors used different coordinate systems, kinda strange and problematic
for some of us.

I found the scale() call for each QGraphicsItem so I tried that, however,
I save my numbers in a base object as well, so scaling them would (Im assuming)
require me to read back out the numbers from each QGraphicsItem after I
scale() it. Id rather just convert the incoming number as I read it and then
create everything if possible, but Im wondering if the former may be more
straight forward, even if less efficient.

Anyone have other suggestions on the best and/or fastest way to do this?

Thanks again,
Jeff
The upper left origin is standard in QNX, Windows, and Linux, probably in Mac OSX as well. OpenGL is the only API that I know of that uses a lower left origin. What I do to plot data "right side up" is
        windowY = windowHeight * (dataY - dataMax) / -dataRange;




--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/

--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>