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. [SOLVED] ListView's flickable problems
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] ListView's flickable problems

Scheduled Pinned Locked Moved QML and Qt Quick
30 Posts 10 Posters 26.4k 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.
  • AlicemirrorA Offline
    AlicemirrorA Offline
    Alicemirror
    wrote on last edited by
    #20

    Thank yo Alex, just a ping :) I'll answer to this shortly

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

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Milnadar
      wrote on last edited by
      #21

      still actual

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mbrasser
        wrote on last edited by
        #22

        [quote author="Milnadar" date="1316020663"]I noticed that when (vertical) listView's items has different height, contentHeight value doesn't equal to height of all items. When changing ListView's height, contentHeight may be larger or smaller than it should be. Why is it so? How does ListView count it's contentHeight?[/quote]

        When items in a vertical ListView don't have a fixed height, contentHeight is estimated. This is to avoid the cost of instantiating every item in order to query their actual height.

        Regards,
        Michael

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mixa84
          wrote on last edited by
          #23

          Im sorry to bring this topic from the dead, but I still dont see what is the solution to this problem and I need to solve this.

          Here is the example of the code on which I`m trying to resolve the problem with contentHeight change and also with a problem when you go to positionViewAtEnd() contentY get some strange values:

          @
          import QtQuick 1.1

          Rectangle
          {
          width: 360
          height: 360

          ListView
          {
              id: lv
              anchors.fill: parent
              anchors.bottomMargin: 50
              spacing: 5
              model: msgmodel
              delegate:
                  Rectangle
                  {
                      id: rect;
                      width: lv.width;
                      height: txt.height;
                      Text
                      {
                          id: txt;
          
                          width: 50;
                          anchors.topMargin: 5;
          
                          wrapMode: Text.WordWrap;
                          text: " contentY: " + lv.contentY + "|" + lv.contentHeight + " y: " + y + " " + msgtext;
                      }
                  }
          }
          
          Text
          {
              id: btn;
              objectName: "btn";
          
              signal add();
          
              text: "Click to move at end"
              anchors.bottom: parent.bottom
              MouseArea
              {
                  anchors.fill: parent
                  onReleased:  lv.positionViewAtEnd();
              }
          }
          

          }
          @

          Every time I go to view end contentY at the top of the view goes more in negative value.

          EDIT: I have also tried this in QtQuick 2.0 and it is working better but it still has problem when going to view end. But this time instead of going into negative value, contentY increase its value.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Mixa84
            wrote on last edited by
            #24

            Is there any solution to this when you have ListView items with variable height?

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Milnadar
              wrote on last edited by
              #25

              Hi Mixa84.

              Yes, there is a solution, but it is about to implement your own listVew .

              I mark this topic as solved.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mdrost
                wrote on last edited by
                #26

                In my opinion ListView should be doing what it says in the docs, even if it is slow.

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  Kieren
                  wrote on last edited by
                  #27

                  Thank you for the good discussion.
                  Helped me a lot to understand my problem.

                  Even so it is kind of disappointing, that we can't even use the sizeHintRole for ListViews.
                  Or have an option to supply the ListView with the correct contentHeight, so it doesn't try calculate it on its own...

                  I've the idea of wrapping the actual list view into another flick able object to kind of wrap the broken scrolling with an item i can control the scrolling better. If it works I'll paste it here.

                  1 Reply Last reply
                  0
                  • M Milnadar

                    Hi everyone.

                    I noticed that when (vertical) listView's items has different height, contentHeight value doesn't equal to height of all items. When changing ListView's height, contentHeight may be larger or smaller than it should be. Why is it so? How does ListView count it's contentHeight?
                    The same issue when items have different height, and i am swapping two items and trying to flick listView on item's height by changing contentY value;

                    [edit : typo in title fixed, Eddy]

                    P Offline
                    P Offline
                    Pradip
                    wrote on last edited by
                    #28

                    @Milnadar
                    Hi, Milnadar,

                    I am stuck in same problem. You have discussed here everything except solution.
                    Can you please tell me the way to proceed with Listview and Scrollbar problem with different height's delegates.

                    1 Reply Last reply
                    1
                    • B Offline
                      B Offline
                      Berzeck
                      wrote on last edited by
                      #29

                      Well I found another solution. I post here so maybe it helps sombedody.

                      1. You need to declare a global property which stores the height. For example : reViewHeight

                      2. Put the ListView inside a transparent Rectangle: rcView, and put the rectangle inside the ScrollView

                      3. Add: Component.onCompleted: { reViewHeight = reViewHeight + height} in your delegate definition

                      4. In the ListView add: onCountChanged: { rcView.height = reViewHeight }

                      Done !

                      C 1 Reply Last reply
                      0
                      • B Berzeck

                        Well I found another solution. I post here so maybe it helps sombedody.

                        1. You need to declare a global property which stores the height. For example : reViewHeight

                        2. Put the ListView inside a transparent Rectangle: rcView, and put the rectangle inside the ScrollView

                        3. Add: Component.onCompleted: { reViewHeight = reViewHeight + height} in your delegate definition

                        4. In the ListView add: onCountChanged: { rcView.height = reViewHeight }

                        Done !

                        C Offline
                        C Offline
                        crazymax
                        wrote on last edited by
                        #30

                        up
                        @Berzeck it didn't help me
                        Any another solution for this problem?

                        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