Results 1 to 5 of 5

Thread: QTransform doubts .

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    56
    Thanked 1 Time in 1 Post

    Default QTransform doubts .

    I have my QTranform defined and applied to the Painter of a QWidget.
    It works fine, I draw my objetcs .
    I have two questions unresolved
    1.- 'Map' works bad. ( I have very strange results)
    I dont understand how I can draw right and however the map function return bad coords
    2.- Setwindow and setviewport gives me the same results of Qtransform??
    Thanks

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: QTransform doubts .

    Quote Originally Posted by tonnot View Post
    I have two questions unresolved
    1.- 'Map' works bad. ( I have very strange results)
    I dont understand how I can draw right and however the map function return bad coords
    What is the question? You don't tell us what exactly you are doing or expecting so we don't know exactly what to tell you.
    2.- Setwindow and setviewport gives me the same results of Qtransform??
    Maybe, they are possibly related: Window-Viewport Conversion

  3. #3
    Join Date
    Sep 2010
    Posts
    654
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    56
    Thanked 1 Time in 1 Post

    Default Re: QTransform doubts .

    For the question 1, I can draw my objects ok (in the custom world I have defined using Qtransform).
    But Qtransform.Map (mouse_x, mouse_y, realX, realY) does not give me correct values for realX and realY.
    Thanks.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QTransform doubts .

    Care to give an example?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Sep 2010
    Posts
    654
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    56
    Thanked 1 Time in 1 Post

    Default Re: QTransform doubts .

    Qt Code:
    1. AFT.reset(); // AFT is a Qtranform
    2. AFT.translate(scrollh, scrollv); // pixles
    3. AFT.scale(escalex, -escaley); // escale = widget pixels siz e / world
    4. AFT.translate(-xc, -yc); // center of my world
    To copy to clipboard, switch view to plain text mode 

    I have two private vars double real_x, real_y;
    And at mousemove event
    Qt Code:
    1. mouse_x = event->pos().x(); mouse_y = event->pos().y();
    2. AFT.map(mouse_x,mouse_y, &real_x, &real_y);
    To copy to clipboard, switch view to plain text mode 
    My world is : -70,70,30,30 (xmin,xmax, ymin,ymax) , a widget size of 600x300 and center of my world 0,800.
    I draw a line from -70,790 to 70,810 without any problem
    I have real coords in range : 300 3000 (x) 3200 - 4000 ?????

    My code was exactly as one I have developed on Java. Java has AFT.inversetransform (and it worked fine )
    Thanks.

Similar Threads

  1. How to construct a QTransform?
    By lni in forum Qt Programming
    Replies: 3
    Last Post: 24th June 2011, 15:20
  2. QTransform()
    By mkind in forum Newbie
    Replies: 0
    Last Post: 19th February 2010, 21:45
  3. GraphicsItemChange and QTransform
    By ct-xuyaojun in forum Qt Programming
    Replies: 0
    Last Post: 28th September 2009, 09:16
  4. QTransform + drawLine ?
    By verburg in forum Qt Programming
    Replies: 0
    Last Post: 23rd January 2009, 00:32
  5. QTransform vs QMatrix
    By maverick_pol in forum Qt Programming
    Replies: 7
    Last Post: 4th October 2007, 10:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.