Results 1 to 3 of 3

Thread: Graphics item movement and scene bounds

  1. #1

    Default Graphics item movement and scene bounds

    Hello everybody,
    I'm quite new in QT programming, and I'm focusing on drawing and moving elements on a scene (i.e., instance of the QGraphicsScene class).
    I used the method "setSceneRect(0, 0, 5000, 5000)" to set the size of the scene.
    Every element in the scene (i.e. instance of a class that inherits from QGraphicsRectItem) is movable and selectable. The multiple selection is enabled. I would like to know how can I "limit" the movement of the objects in the scene, and so I would like to stop that movement if the object reach one of the bounds of the scene.
    I hope I explained the problem well enough.
    Thank you for any help

    Gianluca Magnani

  2. #2
    Join Date
    Nov 2009
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Graphics item movement and scene bounds

    Just want to understand whether you are trying to call setSceneRect of Scene or QGraphicsView.

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

    Default Re: Graphics item movement and scene bounds

    See the example in QGraphicsItem::itemChange() documentation.
    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. QGraphicsView: restrict bbox of Item to bbox of scene?
    By piquadrat in forum Qt Programming
    Replies: 0
    Last Post: 2nd April 2009, 13:38

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.