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. Item Selection in graphicsScene !

Item Selection in graphicsScene !

Scheduled Pinned Locked Moved General and Desktop
11 Posts 2 Posters 3.3k 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.
  • I Offline
    I Offline
    issam
    wrote on last edited by
    #1

    Hi all,
    What is the method to select a group of graphicsItems in order to move them together in a graphicsScene ?
    Thanks in advance. :)

    http://www.iissam.com/

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cincirin
      wrote on last edited by
      #2

      "QGraphicsItemGroup":http://qt-project.org/doc/qt-4.8/qgraphicsitemgroup.html

      bq. group several smaller items into one big item in order to simplify moving and copying of items.

      1 Reply Last reply
      0
      • I Offline
        I Offline
        issam
        wrote on last edited by
        #3

        Hello,
        If I have understand your idea, I have to add every item that belong to the selection rectangle area to a QGraphicsItemGroup object ?

        http://www.iissam.com/

        1 Reply Last reply
        0
        • C Offline
          C Offline
          cincirin
          wrote on last edited by
          #4

          Yes :-)

          1 Reply Last reply
          0
          • C Offline
            C Offline
            cincirin
            wrote on last edited by
            #5

            I think you know about "QGraphicsScene::selectedItems":http://qt-project.org/doc/qt-4.8/qgraphicsscene.html#selectedItems method.

            1 Reply Last reply
            0
            • I Offline
              I Offline
              issam
              wrote on last edited by
              #6

              Yes, I know QGraphicsScene::selectedItems ? Why ? :)

              In my case it's better to use setSelectionArea(), to set the path to my Selection rectangle ! Are you agree cincirin or there is another more simple method ?

              thanks !

              http://www.iissam.com/

              1 Reply Last reply
              0
              • C Offline
                C Offline
                cincirin
                wrote on last edited by
                #7

                Note that setSelectionArea is obsolete.

                [quote author="issam" date="1362398519"]Yes, I know QGraphicsScene::selectedItems ? Why ? :)
                [/quote]

                Because you can simply add all selected items in QGraphicsItemGroup.

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  cincirin
                  wrote on last edited by
                  #8

                  Call "QGraphicsScene::createItemGroup":http://qt-project.org/doc/qt-4.8/qgraphicsscene.html#createItemGroup with the result from selectedItems()

                  1 Reply Last reply
                  0
                  • I Offline
                    I Offline
                    issam
                    wrote on last edited by
                    #9

                    bq. Note that setSelectionArea is obsolete.

                    So, what is the best method to select many items at once ?

                    http://www.iissam.com/

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      cincirin
                      wrote on last edited by
                      #10

                      Sorry for confusion, so "setSelectionArea with QTransform":http://qt-project.org/doc/qt-4.8/qgraphicsscene.html#setSelectionArea are safely to use, but "these setSelectionArea methods":http://qt-project.org/doc/qt-4.8/qgraphicsscene-obsolete.html#setSelectionArea-2 are obsolete

                      1 Reply Last reply
                      0
                      • I Offline
                        I Offline
                        issam
                        wrote on last edited by
                        #11

                        Hi, I understand now.
                        I still use use Qt 4.8.1. This old version uses the obsolete function setSelection(), that you mean !

                        http://www.iissam.com/

                        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