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. How to select all items in the scene
Forum Updated to NodeBB v4.3 + New Features

How to select all items in the scene

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 11.1k 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.
  • P Offline
    P Offline
    potla11
    wrote on last edited by
    #1

    i have 1000's of rectitems i want to access all items in the scene to set hide property ...can some one please tell me how to do this

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      Have a look at QGraphicsScene::items()

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • P Offline
        P Offline
        potla11
        wrote on last edited by
        #3

        i saw that one ..how to set them hide

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          iterate over the QList with the items and set the item hidden each time.

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • P Offline
            P Offline
            potla11
            wrote on last edited by
            #5

            @QList<QGraphicsItem *> items = scene->selectedItems();
            foreach( QGraphicsItem *item, items ) {
            item->hide();
            }

            @

            i wrote like this but don't want selected items i want total items how to do that..

            1 Reply Last reply
            0
            • EddyE Offline
              EddyE Offline
              Eddy
              wrote on last edited by
              #6

              So don't use selectedItems() but items().

              Qt Certified Specialist
              www.edalsolutions.be

              1 Reply Last reply
              0
              • AlicemirrorA Offline
                AlicemirrorA Offline
                Alicemirror
                wrote on last edited by
                #7

                @Eddy: integrating the two ideas maybe faster. Before all items can be selected in a way that exclude a loop? I think it is difficult, because this is the usual way also adopted by graphic programs like Inkscape. BTW if it is possible only one shot to hide the selected items at all.

                Enrico Miglino (aka Alicemirror)
                Balearic Dynamics
                Islas Baleares, Ibiza (Spain)
                www.balearicdynamics.com

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  potla11
                  wrote on last edited by
                  #8

                  thank you my problem got solved

                  1 Reply Last reply
                  0
                  • AlicemirrorA Offline
                    AlicemirrorA Offline
                    Alicemirror
                    wrote on last edited by
                    #9

                    @phani448: Happy that your problem was solved. Now, if you liked that other developers spent their time to help you, I will be a good idea that you spend a bit of your time to tell us how your problem was solved and edit the first post of this thread putting "[Solved]" in front of the title.

                    Thank you

                    Enrico Miglino (aka Alicemirror)
                    Balearic Dynamics
                    Islas Baleares, Ibiza (Spain)
                    www.balearicdynamics.com

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      potla11
                      wrote on last edited by
                      #10

                      @QList<QGraphicsItem *> items = scene->items();

                      foreach( QGraphicsItem *item, items )

                      {

                      item->hide();

                      } @

                      i changed the code it's working for me

                      [Edit : added @ code tags, Eddy]

                      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