Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ListView is (very) slow to move to current item
Forum Updated to NodeBB v4.3 + New Features

ListView is (very) slow to move to current item

Scheduled Pinned Locked Moved QML and Qt Quick
20 Posts 6 Posters 17.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.
  • A Offline
    A Offline
    alexander
    wrote on last edited by
    #2

    It's impossible.
    "http://developer.qt.nokia.com/forums/viewthread/1368":http://developer.qt.nokia.com/forums/viewthread/1368

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alexander
      wrote on last edited by
      #3

      Write own ListView

      1 Reply Last reply
      0
      • A Offline
        A Offline
        arno5m
        wrote on last edited by
        #4

        Write my own listview it's possibility, but a total waste of time.
        enhance behior/ability of existing listview may be more useful for more people. (I guess)

        In my point of view, if listview visits all element in order to get their height,
        it must exist a property of listview saying 'all elements have same height'.
        With that property listview may discover once the height and remember it in order to accelerate the scroll.

        (thanks for pointing me thread 1368, it's the same issue).

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alexander
          wrote on last edited by
          #5

          arno5m, I agree with you. Sometimes it's necessary feature.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            MartinJ
            wrote on last edited by
            #6

            ListView will move the highlight from its current position to the new current item, scrolling the view as it moves. If your model is slow to provide data or you have a complex delegate then it will struggle to scroll smoothly. The best solution is to move the view directly to the target index and then set the currentIndex, e.g.

            @
            idLV.positionViewAtIndex(nci, ListView.Visible)
            idLV.currentIndex = nci
            @

            1 Reply Last reply
            0
            • A Offline
              A Offline
              alexander
              wrote on last edited by
              #7

              MartinJ, positionViewAtIndex also will evaluate height for all elements from current to nci.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                arno5m
                wrote on last edited by
                #8

                I'm agree with Alexander, the height of intermediary item is evaluated in this situation also. I think the solution it's a particular API (at least one method) to set the height of item in a listview.

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

                  I find it a bit weird that we run into this issue again. It in the widgets world, the need for this feature for optimization purposes was already known. QListView has it, for instance. QML should not be about reinventing the wheel, should it?

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    alexander
                    wrote on last edited by
                    #10

                    Andre, where is it in QListView? QListView also evaluates height for all elements.

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

                      [quote author="Alexander Kuchumov" date="1292868441"]Andre, where is it in QListView? QListView also evaluates height for all elements.[/quote]
                      It is right "here":http://doc.qt.nokia.com/4.6/qlistview.html#uniformItemSizes-prop. You can tell QListView that the items are all the same size, and then it only evaluates the hight of the first item.

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        alexander
                        wrote on last edited by
                        #12

                        Andre, I've missed this function:)

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

                          Don't :-) It can make a huge difference in QListViews performance.

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            MartinJ
                            wrote on last edited by
                            #14

                            positionViewAtIndex() does not calculate the height of intermediary items. That is the point of that function.

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              alexander
                              wrote on last edited by
                              #15

                              MartinJ is right, positionViewAtIndex uses averageSize .

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

                                How is averageSize calculated? It is not a property of the ListView element, so where does it come from?

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

                                  Andre, averageSize is calculated for last visible elements.

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

                                    OK, that makes sense I guess.

                                    1 Reply Last reply
                                    0
                                    • J Offline
                                      J Offline
                                      jech
                                      wrote on last edited by
                                      #19

                                      Hi, I have a problem similar to yours. I have a ListView with possibly thousands of elements. I keep a property in my PySide backend which is the currentIndex for my ListView. Whenever I change the index, the ListView should scroll to the current item.

                                      It works, but the scrolling is very slow. I think it is the same problem you are describing. Do you have any idea how should I solve my case?

                                      1 Reply Last reply
                                      0
                                      • B Offline
                                        B Offline
                                        bkamps
                                        wrote on last edited by
                                        #20

                                        Anybody has a suggestion? I have the same problem on my arm 300 mhz device... I also want to drop the scroll animation and just jump immediately to the next item.

                                        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