Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Group multiple QGraphicsItems into single entity to move/select
Forum Updated to NodeBB v4.3 + New Features

Group multiple QGraphicsItems into single entity to move/select

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.9k 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.
  • S Offline
    S Offline
    sairajesh
    wrote on last edited by
    #1

    I have an circuit drawn with few QGraphicsLineItems and QGraphicsImageItems. Now I wish to select all these items together such that I should be able to move all items together to a new position with items remain intact together. Now that each lineitem and imageitem can be moved separately, I wish to do it as one single entity. can you please guide me how to proceed about it? Should I store all the coordinates of all items and start re-drawing from the new position? or do we have an elegant way to make the whole circuit select/move ?

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

      Were you looking for [[doc:QGraphicsItemGroup]] perhaps?

      1 Reply Last reply
      1
      • S Offline
        S Offline
        sairajesh
        wrote on last edited by
        #3

        Thanks Andre, but selection of one item in the group will automatically select the group as well right? My scenario is I have electric circuit, now user does selection of all wires and elements (lineitems and imageitems) and click either delete/rotate/copy/cut/paste and this should perform action on whole selected set. On other hand, user can choose only one item(lineitem or imageitem) and perform the above actions as well. So, how can I achieve both?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Well, you could build up a group dynamically. If you add an element to your selection, add it to the group. Then perform the operations on the whole group. At least that is how I would try to do it.

          1 Reply Last reply
          0

          • Login

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