Results 1 to 2 of 2

Thread: QGraphicsItem Movable

  1. #1
    Join Date
    Jul 2008
    Posts
    139
    Thanks
    9
    Thanked 18 Times in 15 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default QGraphicsItem Movable

    Hi,
    I have a QGraphicsItem that is movable. Do I need to update the bounding rectangle of that item when it is moved to a new position? (i.e location). If so, what is the best method in doing this?
    Sometimes the item stays at the position, but other times when I click on it again it jumps back to it's old location.

    Thanks in advance.

  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: QGraphicsItem Movable

    No, the bounding rect is always constant - it denotes the range of local coordinates an item can take and it has nothing to do with position of the item on the scene. For instance if you have an item that displays a pixmap that is 400x300px large, you will set the bounding rect of the item to (0,0,400,300) regardless of the final position of the item on the scene - be it lower right corner, centre or upper left corner of the scene. The latter is determined by the position of the item and that is what is changed when you mark an item movable and request GraphicsView to handle its movements for you.
    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. QGraphicsItem doesn't inherit QObject?
    By xyzt in forum Qt Programming
    Replies: 6
    Last Post: 26th September 2011, 14:59
  2. destruction of QGraphicsItem
    By killkolor in forum Qt Programming
    Replies: 2
    Last Post: 5th December 2009, 10:31
  3. Replies: 1
    Last Post: 25th February 2009, 00:34
  4. QGraphicsItem does not update
    By zgulser in forum Qt Programming
    Replies: 1
    Last Post: 5th February 2009, 14:44
  5. Snap-to grid on QGraphicsItem
    By hardgeus in forum Qt Programming
    Replies: 9
    Last Post: 28th April 2008, 16:22

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.