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

VerticalHeaderView/TableView required properties go all over the place when using syncView

    XMLWordPrintable

Details

    • 82d0d8321 (dev), 17f5777e6 (6.6), 5f0f2da91 (6.5)

    Description

      I have recently switched from Qt 5.15 to Qt 6.5 and doing so, I had to use the Quick.Controls 2 TableView.

       

      When trying to do this kind of thing:

       

       

      TableView {
          id: tableView
          anchors.fill: parent
          leftMargin: checkColumn.width
          clip: true
          model: TableModel {
              TableModelColumn { display: "name" }
              rows: [{ "name": "Harry" }, { "name": "Hedwig" }]
          }
          selectionModel: ItemSelectionModel {
              model: tableView.model
          }
          delegate: Rectangle {
              implicitWidth: 100
              implicitHeight: 30
              color: selected ? "blue" : "lightgray"
              required property bool selected
              Text { text: display }
          }
      }
      VerticalHeaderView {
          id: checkColumn
          parent: tableView
          syncView: tableView
          selectionModel: tableView.selectionModel
          boundsBehavior: tableView.boundsBehavior
          delegate: CheckBox {
              required property int row
              required property bool selected
              onRowChanged: console.log("onRowChanged", row, selected)
              onSelectedChanged: console.log("onSelectedChanged", row, selected)
              checked: selected
              onToggled: tableView.selectionModel.select(tableView.model.index(row, 0), ItemSelectionModel.Toggle | ItemSelectionModel.Rows)
          }
      }
      

       

       

      I realised that the "required property int row" in the checkbox is reupdated on every item loaded in the header as soon as 1 item is flicked outside the view, and required property bool selected changes to false without even emiting any signals (I can see it through the checkbox that is unselected) though there is selected indexes in the ItemSelectionModel. But this does not appens int the main TableView. 

      Attachments

        1. TableView.webm
          5.91 MB
          Romain Donzé
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            richard Richard Moe Gustavsen
            romain.donze Romain Donzé
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: