Bug in TableView: keyboard (down arrow) after selection.select() is wrong
-
In my simple test code (below), everything starts out fine, the table appears and shows Fred, George, and Harold, and Fred is selected. However, if I press the down key, the "onSelectionChanged" is triggered, but Fred (row 0) is still selected. The second time I press the down key, and forever after that, the down key works as expected. Why doesn't the 'down' key work that first time?
Thanks,
Chris@ListModel
{
id: patientNames
ListElement{ name: "Fred" }
ListElement{ name: "George" }
ListElement{ name: "Harold" }
}TableView
{
id: patientNameTableanchors.top: parent.top anchors.bottom: parent.bottom anchors.left: parent.left width: parent.width * .25 -5 Component.onCompleted: { console.log("patientNameTable.onCompleted()"); selection.select(0); } model: patientNames Connections { target: patientNameTable.selection onSelectionChanged: { console.log("patientNameTable.selection.onSelectionChanged()"); patientNameTable.selection.forEach(function(rowIndex) { console.log(" Row", rowIndex, "is selected")} ) } } TableViewColumn { role: "name" title: "Name" width: 300; }
}
@@
qml: patientNameTable.onCompleted()
qml: patientNameTable.selection.onSelectionChanged()
qml: Row 0 is selected
qml: patientNameTable.selection.onSelectionChanged()
qml: Row 0 is selected
qml: patientNameTable.selection.onSelectionChanged()
qml: Row 1 is selected
@