Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Merging of QGraphicsRectItem
Qt 6.12 LTS is out! See what's new in the release blog

Merging of QGraphicsRectItem

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 735 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Manish Bhavsar
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Asperamanca
      wrote on last edited by
      #2

      Two approaches come to mind:

      1. Keep the single QGraphicsRectItems, but put them together in a QGraphicsItemGroup. This works similar to many drawing programs where you can "group" items together. This is probably a good approach if the user should be able to manipulate the single items in some way, or if you want to be able to split the rectangles again
      2. Create a new item that paints all the merged rectangle. You can use a QGraphicsPathItem for this.
      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt
      • Unsolved