I have created a TableView in QML, connected to a SoftFilterProxyModel. The data displays fine, and when I click on a row my "selectRow" function runs, and receives the correct row number. However, nothing shows as selected. I based my design on this SO question
The relevant code is:
ItemSelectionModel {
id: companyTableISM
model: companySFPM
}
function selectRow(row) {
console.log("In selectRow row "+row);
companyTableISM.select(companySFPM.index(row, 0), ItemSelectionModel.select | ItemSelectionModel.current );
console.log(companyTableISM.selectedIndexes);
console.log(companyTableISM.hasSelection);
}
So when I click a row it outputs:
qml: In selectRow row 3
qml: []
qml: false
Since my selectRow function is receiving the correct row number, the model (companySFPM) matches the one used by the TableView, why do my 2 log statements showing nothing selected and false (hasSelection)?
I believe you have two typos in the line:
ItemSelectionModel.select | ItemSelectionModel.current
Notice the capitalization of the enumerated types? It should be:
ItemSelectionModel.Select | ItemSelectionModel.Current