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. assert m_control error if ListView is scrolled
Forum Update on Monday, May 27th 2025

assert m_control error if ListView is scrolled

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 277 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.
  • G Offline
    G Offline
    Guido Marko Print
    wrote on last edited by Guido Marko Print
    #1

    Hi,

    I'm pretty new to QML and maybe I'm just doing something stupid. I already searched the web about this problem, but without any success. If I create a clipping listView with scrollbar, I get an Popup error like this:

    error2.PNG

    This is a snippet of my QML code

    import QtQuick 2.15
    import QtQuick.Window 2.15
    import QtQuick.Controls 2.12
    import QtQuick.Layouts 1.12
    
    
    Window {
        width: 500
        height: 300
        visible: true
        title: qsTr("Hello World")
    
        ListModel {
            id: testmodel
    
            ListElement {
                caption: "name is"
                value: "Kermit the frog"
                ftype: "Muppet"
            }
            ListElement {
                caption: "name is"
                value: "Kermit the frog"
                ftype: "Muppet"
            }
            ListElement {
                caption: "name is"
                value: "Kermit the frog"
                ftype: "Muppet"
            }
            ListElement {
                caption: "name is"
                value: "Kermit the frog"
                ftype: "Muppet"
            }
            ListElement {
                caption: "name is"
                value: "Kermit the frog"
                ftype: "Muppet"
            }
            ListElement {
                caption: "name is"
                value: "Kermit the frog"
                ftype: "Muppet"
            }
            ListElement {
                caption: "name is"
                value: "Kermit the frog"
                ftype: "Muppet"
            }
            ListElement {
                caption: "name is"
                value: "Kermit the frog"
                ftype: "Muppet"
            }
            ListElement {
                caption: "name is"
                value: "Kermit the frog"
                ftype: "Muppet"
            }
            ListElement {
                caption: "name is"
                value: "Kermit the frog"
                ftype: "Muppet"
            }
            ListElement {
                caption: "name is"
                value: "Kermit the frog"
                ftype: "Muppet"
            }
            ListElement {
                caption: "name is"
                value: "Kermit the frog"
                ftype: "Muppet"
            }
            ListElement {
                caption: "name is"
                value: "Kermit the frog"
                ftype: "Muppet"
            }
            ListElement {
                caption: "name is"
                value: "Kermit the frog"
                ftype: "Muppet"
            }
        }
    
        GroupBox {
            anchors.fill: parent
            ListView {
                id: listView
                anchors.fill: parent
                clip: true
    
                ScrollBar.vertical: ScrollBar {}
                model: testmodel
                delegate: GroupBox {
                    height: 40
                    width: 500
    
                    RowLayout{
                        anchors.fill: parent
                        Text {
                            Layout.fillWidth: true
                            text: caption
                        }
                        Text {
                            Layout.fillWidth: true
                            text: value
                        }
                        Text {
                            Layout.fillWidth: true
                            text: ftype
                        }
                    }
                }
            }
        }
    
    }
    
    

    I'm using the QT 6.1.2 MSVC2019 64 bit Desktop Kit.

    The error occures as soon, as the height of the delegates is higher as the view port of the list view. When I delete some of the entries, the error is not at startup but if I start to scroll.

    EDIT: meanwhile I was able to strip down the problem using a dummy project. This is a single qml file, that invokes the error message immeadiately after startup. I replace my original snippet with this code now.

    G 1 Reply Last reply
    0
    • G Guido Marko Print

      Hi,

      I'm pretty new to QML and maybe I'm just doing something stupid. I already searched the web about this problem, but without any success. If I create a clipping listView with scrollbar, I get an Popup error like this:

      error2.PNG

      This is a snippet of my QML code

      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.12
      import QtQuick.Layouts 1.12
      
      
      Window {
          width: 500
          height: 300
          visible: true
          title: qsTr("Hello World")
      
          ListModel {
              id: testmodel
      
              ListElement {
                  caption: "name is"
                  value: "Kermit the frog"
                  ftype: "Muppet"
              }
              ListElement {
                  caption: "name is"
                  value: "Kermit the frog"
                  ftype: "Muppet"
              }
              ListElement {
                  caption: "name is"
                  value: "Kermit the frog"
                  ftype: "Muppet"
              }
              ListElement {
                  caption: "name is"
                  value: "Kermit the frog"
                  ftype: "Muppet"
              }
              ListElement {
                  caption: "name is"
                  value: "Kermit the frog"
                  ftype: "Muppet"
              }
              ListElement {
                  caption: "name is"
                  value: "Kermit the frog"
                  ftype: "Muppet"
              }
              ListElement {
                  caption: "name is"
                  value: "Kermit the frog"
                  ftype: "Muppet"
              }
              ListElement {
                  caption: "name is"
                  value: "Kermit the frog"
                  ftype: "Muppet"
              }
              ListElement {
                  caption: "name is"
                  value: "Kermit the frog"
                  ftype: "Muppet"
              }
              ListElement {
                  caption: "name is"
                  value: "Kermit the frog"
                  ftype: "Muppet"
              }
              ListElement {
                  caption: "name is"
                  value: "Kermit the frog"
                  ftype: "Muppet"
              }
              ListElement {
                  caption: "name is"
                  value: "Kermit the frog"
                  ftype: "Muppet"
              }
              ListElement {
                  caption: "name is"
                  value: "Kermit the frog"
                  ftype: "Muppet"
              }
              ListElement {
                  caption: "name is"
                  value: "Kermit the frog"
                  ftype: "Muppet"
              }
          }
      
          GroupBox {
              anchors.fill: parent
              ListView {
                  id: listView
                  anchors.fill: parent
                  clip: true
      
                  ScrollBar.vertical: ScrollBar {}
                  model: testmodel
                  delegate: GroupBox {
                      height: 40
                      width: 500
      
                      RowLayout{
                          anchors.fill: parent
                          Text {
                              Layout.fillWidth: true
                              text: caption
                          }
                          Text {
                              Layout.fillWidth: true
                              text: value
                          }
                          Text {
                              Layout.fillWidth: true
                              text: ftype
                          }
                      }
                  }
              }
          }
      
      }
      
      

      I'm using the QT 6.1.2 MSVC2019 64 bit Desktop Kit.

      The error occures as soon, as the height of the delegates is higher as the view port of the list view. When I delete some of the entries, the error is not at startup but if I start to scroll.

      EDIT: meanwhile I was able to strip down the problem using a dummy project. This is a single qml file, that invokes the error message immeadiately after startup. I replace my original snippet with this code now.

      G Offline
      G Offline
      Guido Marko Print
      wrote on last edited by
      #2

      @Guido-Marko-Print
      Is it okay to answer my own posts? I hope so. I found out, that the I can circumvent the problem by choosing another style. The problem arises only when the native style is used. I came to this by reading the error message several times. So, this seems to be a bug in the nativestyle. Has somebody experienced something similar?

      Should I file a bug and how to do so?

      jsulmJ 1 Reply Last reply
      0
      • G Guido Marko Print

        @Guido-Marko-Print
        Is it okay to answer my own posts? I hope so. I found out, that the I can circumvent the problem by choosing another style. The problem arises only when the native style is used. I came to this by reading the error message several times. So, this seems to be a bug in the nativestyle. Has somebody experienced something similar?

        Should I file a bug and how to do so?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @Guido-Marko-Print said in assert m_control error if ListView is scrolled:

        Is it okay to answer my own posts?

        Of course it is :-)
        You also can file a bug in Qt bug tracker.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        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