-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.5.1
-
None
-
82d0d8321 (dev), 17f5777e6 (6.6), 5f0f2da91 (6.5)
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.
| For Gerrit Dashboard: QTBUG-115227 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 504079,3 | QQuickHeaderView: implement modelIndex() and cellAtIndex() | dev | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |
| 505179,3 | QQuickTableView: let the subclass decide which model to use for selections | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
| 505587,2 | QQuickTableView: let the subclass decide which model to use for selections | 6.6 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
| 505734,3 | QQuickTableView: let the subclass decide which model to use for selections | 6.5 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
| 506119,1 | QQuickTableView: let the subclass decide which model to use for selections | tqtc/lts-6.2 | qt/tqtc-qtdeclarative | Status: ABANDONED | 0 | 0 |