Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ScrollBar QML crash
Qt 6.12 LTS is out! See what's new in the release blog

ScrollBar QML crash

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

    Does anyone know why the following code crashes when the ListView anchors.margins is uncommented and the list's contentHeight grows larger than it's height?

    ApplicationWindow {
        width: 200
        height: 480
        visible: true
        title: qsTr("Hello World")
        color: "black"
    
        ListView {
            id: listView
            z: -1
            anchors.fill: parent
    //        anchors.margins: 10
            spacing: 10
            model: 1
    
            ScrollBar.vertical: ScrollBar {
                id: scrollBar
                visible: parent.contentHeight > parent.height
                padding: 20
            }
    
            delegate: Rectangle {
                width: parent.width - (scrollBar.visible ? scrollBar.width : 0)
                height: width
    
                MouseArea {
                    anchors { fill: parent }
    
                    onClicked: listView.model++
                }
            }
        }
    }
    

    Commenting out the anchors.margins causes it not to crash. Changing scrollBar.padding to 10 causes it not to crash.

    I can't figure out what's going on with ScrollBar here.

    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
    • Unsolved