Results 1 to 3 of 3

Thread: Mouse mapping on QTransform problem

  1. #1
    Join Date
    Sep 2008
    Posts
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Mouse mapping on QTransform problem

    Hi to all,

    If i set a QTransform on a widged class
    trans = QTransform(1.2,0.,0.,1.2,0.,0.); scale 1.2 zoom
    and i paint on a p->setWorldTransform(trans,false);
    Why on mouse event QTransform can not mapping correct point?

    QPointF translatet_point = trans.map(event->pos());
    if i debug trans.m11() it return correct 1.2 and point x,y is map 1:1

    Danny

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Mouse mapping on QTransform problem

    Your QTransform transforms painter coordinates to widget coordinates. event()->pos() returns a point in widget coordinates, so you have to apply the reverse transform to get painter coordinates.

  3. #3
    Join Date
    Sep 2008
    Posts
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Mouse mapping on QTransform problem

    Quote Originally Posted by jacek View Post
    Your QTransform transforms painter coordinates to widget coordinates. event()->pos() returns a point in widget coordinates, so you have to apply the reverse transform to get painter coordinates.


    Only get
    QTransform QTransform::inverted ( bool * invertible = 0 ) const
    and thats it? i try..

Similar Threads

  1. Problem in Mouse Press Events & Vectors
    By dheeraj in forum Qt Programming
    Replies: 2
    Last Post: 5th July 2008, 18:08
  2. problem about mouse button events
    By vql in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2008, 10:14
  3. Replies: 3
    Last Post: 4th December 2007, 10:04
  4. Replies: 3
    Last Post: 7th August 2006, 17:24
  5. Sorry another problem. Mouse Buttons.
    By Zephro in forum Qt Programming
    Replies: 14
    Last Post: 24th February 2006, 16:08

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.