Results 1 to 4 of 4

Thread: Merging and splitting of QGraphicsRectItem

  1. #1
    Join Date
    Jun 2010
    Posts
    97
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Merging and splitting of QGraphicsRectItem

    Hi,

    I want to develop a functionality where there is push button which will add QGraphicsRectItem on QGraphicsScene. Once there are multiple QGraphicsRectItem on scene, user will select more than one and there will be another button which will merge these selected QGraphicsRectItems into single QGraphicsRectItem having childrenBoundingRect() as merged entities bounding rect. And when I will select merged item on scene it will show me as single item since this merged item will become parent for other children.

    Can anybody help me in merging idea?


    Manish

  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: Merging and splitting of QGraphicsRectItem

    If the merge is an unreversible operation then the easiest solution is to replace several rect items with a single new rect item with a bounding rect and position based on those of its source items.

    If the merge is to be reversible though, it might be easiest to use QGraphicsItemGroup or implement a similar custom solution.
    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
    Jun 2010
    Posts
    97
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Merging and splitting of QGraphicsRectItem

    Thanks for quick reply.
    Replacing was also my though but in that case I need to remove selected, get posting of top-left removed item and the create new item there. right?

  4. #4
    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: Merging and splitting of QGraphicsRectItem

    Something like that, yes.
    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. Splitting a single QwtPlotCurve
    By Axtroz in forum Qwt
    Replies: 3
    Last Post: 5th August 2011, 19:32
  2. Splitting QString
    By Peeri in forum Newbie
    Replies: 1
    Last Post: 13th April 2011, 13:41
  3. Splitting data so it fits into datagrams
    By toratora in forum Qt Programming
    Replies: 4
    Last Post: 27th April 2007, 18:01
  4. Splitting Translation Files
    By Jimmy2775 in forum Qt Programming
    Replies: 9
    Last Post: 3rd February 2006, 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.