Results 1 to 2 of 2

Thread: pos() and scenePos() problem

  1. #1
    Join Date
    Jun 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default pos() and scenePos() problem

    Hi all,

    In a QGraphicsScene, I created a QGraphicsPixmapItem object with no parent and set its transformation origin point to the geometrical centre, then a series of transformations were performed by calling setPos() and setRotation().

    The weird problem was that, when I translated the object with
    Qt Code:
    1. setPos(this->scenePos() + delta)
    To copy to clipboard, switch view to plain text mode 
    , the transformation messed up, but
    Qt Code:
    1. setPos(this->pos() + delta)
    To copy to clipboard, switch view to plain text mode 
    worked fine.

    According to the documentation, pos() is the equivalent to calling mapToParent(0, 0), and scenePos() is the equivalent to mapToScene(0, 0). But the result was not: mapToParent(0, 0), mapToScene(0, 0) and scenePos() returned the same coordinates, while pos() returned a different one.

    Totally no idea, what is the coordinate returned by pos() then? Could it be a bug with Qt?

    Thanks.

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

    Default Re: pos() and scenePos() problem

    Please provide a minimal compilable example reproducing the problem.
    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.


Similar Threads

  1. ItemAt and ScenePos
    By jano_alex_es in forum Newbie
    Replies: 3
    Last Post: 26th October 2009, 14:48
  2. ScenePos changes when rotating an item
    By jano_alex_es in forum Newbie
    Replies: 2
    Last Post: 23rd October 2009, 08:52
  3. Why does QGraphicsItem::scenePos() return (0,0)
    By extrakun in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2009, 07:35
  4. QGraphicsItem meaning of pos(), scenePos()
    By nicolas1 in forum Qt Programming
    Replies: 11
    Last Post: 9th October 2008, 08:59
  5. QGraphicsItem::scenePos() or pos()
    By Gopala Krishna in forum Newbie
    Replies: 3
    Last Post: 11th February 2007, 19:23

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.