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 insert many items into QListView without making the app freeze?
Forum Updated to NodeBB v4.3 + New Features

How to insert many items into QListView without making the app freeze?

Scheduled Pinned Locked Moved General and Desktop
22 Posts 4 Posters 10.6k 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.
  • U Offline
    U Offline
    umen242
    wrote on last edited by
    #12

    Thanks you both for the help . to understand it more .
    @Volker what do you mean by :
    "need is not achievable with the QStandardItemModel with reasonable effort."
    what is wrong with the QStandardItemModel im using ?
    what is not achievable with QStandardItemModel that i will need to implement with QAbstractListModel? the adding the items into memory ?
    Thanks again .

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #13

      With a subclass of the QAbstractXXXModels you can connect the webservice to the model directly. In that processing method you tell the model that you are going to change its contents, then you do the actual changes, then you tell the model that you're ready. This cannot be done from outside the model, as you would have to do with the QStandardXXXModels.

      But I read back and noticed, that you use setIndexWidget(). This isn't handled by the models at all, but only by the view. So you cannot speed up things by using another model class here.

      http://www.catb.org/~esr/faqs/smart-questions.html

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

        Ah, I missed the use of that method as well. Sorry.
        All bets are off. It is a wart on the face of the model view framework, and it makes sure the whole thing is basically useless. Putting more and more widgets on your view is never, ever going to be fast. Sorry.

        1 Reply Last reply
        0
        • U Offline
          U Offline
          umen242
          wrote on last edited by
          #15

          what if i set up like 100 widget items in the Init , when i start the app
          and set them to be hidden , and when i get the info to fill them i just show the right widget items? ( i need only like 100 or 150 to be present in view)

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #16

            In your case, I would consider using a [[Doc:QScrollArea]] with a [[Doc:QVBoxLayout]], as that is more or less visibly the same as a list view consisting only of widgets.

            http://www.catb.org/~esr/faqs/smart-questions.html

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

              Do you really, really need to have actual widgets?

              1 Reply Last reply
              0
              • U Offline
                U Offline
                umen242
                wrote on last edited by
                #18

                what is wrong with me inserting the widgets into the Treeview?
                using QScrollArea will be faster?

                1 Reply Last reply
                0
                • U Offline
                  U Offline
                  umen242
                  wrote on last edited by
                  #19

                  Andre , i asked this and other forums before but i could find solutions to
                  things like making label with mouse select text for copy when i tried to use
                  itemdelegate

                  "developer.qt.nokia.com/forums/viewthread/13515/":developer.qt.nokia.com/forums/viewthread/13515/

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on last edited by
                    #20

                    I would go with a scroll area here, instead of a list view.

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0
                    • U Offline
                      U Offline
                      umen242
                      wrote on last edited by
                      #21

                      thanks , but why?

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        goetz
                        wrote on last edited by
                        #22

                        Because the item views are a bit imperformant when using many item widgets. That's not the main usage they were designed for.

                        http://www.catb.org/~esr/faqs/smart-questions.html

                        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