Results 1 to 6 of 6

Thread: QGraphicsItem goes out of scene

  1. #1
    Join Date
    Mar 2012
    Location
    India
    Posts
    22
    Thanks
    3
    Qt products
    Qt4

    Default QGraphicsItem goes out of scene

    Hi,

    I have a 2 custom QGraphicsItem say MainGraphicsItem and AttachedGraphicsItem.
    MainGraphicsItem has many children of type AttachedGraphicsItem (MainGraphicsItem is the parent AttachedGraphicsItem)
    All these items are in a scene (the scene expands automatically).

    Consider MainGraphicsItem as a rectangle and AttachedGraphicsItem as a small circle. They are arranged as shown in the attached image.
    1.PNG

    Now when I move MainGraphicsItem to the right edge of the scene the AttachedGraphicsItem go out of the scene and are not visible. (Please see pic 2)
    2.PNG
    The scene doesn't expand in this case.

    Can you please resolve the issue.

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

    Default Re: QGraphicsItem goes out of scene

    Why do you say the scene doesn't expand? Since scroll bars appear it seems that it does.
    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.


  3. #3
    Join Date
    Mar 2012
    Location
    India
    Posts
    22
    Thanks
    3
    Qt products
    Qt4

    Default Re: QGraphicsItem goes out of scene

    Sorry for creating the misunderstanding. What I meant was, the scene expands when the MainGraphicsItem goes out of the scene, but it doesn't when AttachedGraphicsItem go out of the scene. As seen in the second image some AttachedGraphicsItem are cut (out of scene). The scroll bars have been completely scrolled to right.

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

    Default Re: QGraphicsItem goes out of scene

    Are those small items children of the bigger item?
    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
    Mar 2012
    Location
    India
    Posts
    22
    Thanks
    3
    Qt products
    Qt4

    Default Re: QGraphicsItem goes out of scene

    Yes ..
    Small Items (AttachedGraphicsItem) are children of Big Item (MainGraphicsItem).
    MainGraphicsItem can have multiple children of type AttachedGraphicsItem.

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

    Default Re: QGraphicsItem goes out of scene

    I think the scene has no direct way of tracking items that are not directly its own children. You might have to react to position change of the main item and make the scene grow yourself.
    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.


  7. The following user says thank you to wysota for this useful post:

    pratham_shah (4th July 2013)

Similar Threads

  1. Can QGraphicsItem's parent item be from another scene?
    By cresta in forum Qt Programming
    Replies: 3
    Last Post: 25th September 2012, 20:51
  2. Problem with positioning a QGraphicsItem in the scene
    By qlands in forum Qt Programming
    Replies: 0
    Last Post: 1st October 2010, 11:05
  3. Overload QGraphicsItem Move in Scene
    By D Cell in forum Newbie
    Replies: 2
    Last Post: 16th March 2010, 05:14
  4. Can I copy a QGraphicsItem on my scene?
    By JesperWe in forum Qt Programming
    Replies: 3
    Last Post: 12th February 2010, 21:21
  5. Update scene after moving QGraphicsItem
    By rogerholmes in forum Newbie
    Replies: 1
    Last Post: 19th January 2010, 05:08

Tags for this Thread

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.