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
QtWS25 Last Chance

How to select all items in the scene

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 10.9k Views
  • 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 24 Sept 2011, 09:41 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
    • E Offline
      E Offline
      Eddy
      wrote on 24 Sept 2011, 11:03 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 24 Sept 2011, 11:58 last edited by
        #3

        i saw that one ..how to set them hide

        1 Reply Last reply
        0
        • E Offline
          E Offline
          Eddy
          wrote on 24 Sept 2011, 13:12 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 24 Sept 2011, 13:57 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
            • E Offline
              E Offline
              Eddy
              wrote on 24 Sept 2011, 15:32 last edited by
              #6

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

              Qt Certified Specialist
              www.edalsolutions.be

              1 Reply Last reply
              0
              • A Offline
                A Offline
                Alicemirror
                wrote on 25 Sept 2011, 15:14 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 26 Sept 2011, 07:29 last edited by
                  #8

                  thank you my problem got solved

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    Alicemirror
                    wrote on 26 Sept 2011, 07:40 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 26 Sept 2011, 07:53 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

                      5/10

                      24 Sept 2011, 13:57

                      • Login

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