Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    How to select all items in the scene

    General and Desktop
    3
    10
    9800
    Loading More Posts
    • 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
      potla11 last edited by

      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 Reply Quote 0
      • E
        Eddy last edited by

        Have a look at QGraphicsScene::items()

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply Reply Quote 0
        • P
          potla11 last edited by

          i saw that one ..how to set them hide

          1 Reply Last reply Reply Quote 0
          • E
            Eddy last edited by

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

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply Reply Quote 0
            • P
              potla11 last edited by

              @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 Reply Quote 0
              • E
                Eddy last edited by

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

                Qt Certified Specialist
                www.edalsolutions.be

                1 Reply Last reply Reply Quote 0
                • Alicemirror
                  Alicemirror last edited by

                  @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 Reply Quote 0
                  • P
                    potla11 last edited by

                    thank you my problem got solved

                    1 Reply Last reply Reply Quote 0
                    • Alicemirror
                      Alicemirror last edited by

                      @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 Reply Quote 0
                      • P
                        potla11 last edited by

                        @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 Reply Quote 0
                        • First post
                          Last post