Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-139192

Controls cannot function properly inside TableView

XMLWordPrintable

      The attached project adds a new row to a QStringListModel subclass every second. The same model is attached to both a ListView and TableView.

      • In the ListView, users are able to activate the DelayButton (Expected)
      • In the TableView, users can never activate the DelayButton. All attempts get cancelled whenever a new row is added, and the cancellation is usually accompanied with a visual glitch (Not Expected)

       

      Code

      import QtQuick
      import QtQuick.Controls.Basic
      import TableViewControlsStudy
      
      ApplicationWindow {
          width: 640
          height: 480
          visible: true
      
          MyStringListModel { id: stringModel }
      
          Component {
              id: dlg_comp
              DelayButton {
                  required property var modelData
                  text: modelData.display
                  delay: 1250
              }
          }
      
          header: Row {
              Label {
                  width: parent.width/2
                  text: "ListView"
              }
              Label {
                  width: parent.width/2
                  text: "TableView"
              }
          }
      
          ListView {
              anchors.fill: parent
              anchors.rightMargin: parent.width/2
              model: stringModel
              delegate: dlg_comp
          }
      
          TableView {
              anchors.fill: parent
              anchors.leftMargin: parent.width/2
              model: stringModel
              delegate: dlg_comp
          }
      
          Timer {
              interval: 1000
              running: true
              repeat: true
              onTriggered: stringModel.appendOne()
          }
      }
      

       

      Analysis
      The root cause is QTBUG-116723/QTBUG-116650. Aside from simply being computationally wasteful, this bug breaks GUIs.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            skoh-qt Sze Howe Koh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes