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 contentHeight keeps changing
Forum Updated to NodeBB v4.3 + New Features

ListView contentHeight keeps changing

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 282 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.
  • A Offline
    A Offline
    Augustas
    wrote on last edited by Augustas
    #1

    Hello,
    I've noticed if I have multiple different height elements in a list view, it's contentHeight keeps changing when scrolling.
    I've noticed there's a bug reported related to this, but it says that it's the intended functionality.
    That is very weird, because if you have a ScrollBar in the ListView, the ScrollBar height keeps changing when scrolling.
    I just wanted to make sure if this really is the intended funcionality, not a bug.

    Tested on Qt 5.14.2, 5.15.2 & 6.2.1
    Minimal code required to reproduce the issue:

    import QtQuick 2.14
    import QtQuick.Window 2.14
    import QtQuick.Controls 2.5
    
    Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
    
        ListView {
            width: parent.width
            height: parent.height
    
            model: [ 50, 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 100  ]
    
            ScrollBar.vertical: ScrollBar {
                id: scrollbar
                width: 16
            }
    
            onContentHeightChanged: console.log("content.height: " + contentHeight + " contentItem.height: " + contentItem.height)
    
            delegate: Rectangle {
                width: parent.width
                height: modelData
    
                border.width: 1
                border.color: "black"
            }
        }
    }
    
    
    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