QML Tableview select row where data in column matches
-
Hello,
we are using a QML tableview and want to select a certain row from c++. The Tableview is using an AbstractTableModel and a SortFilterProxyModel. I've created a QML function in the root object to do so. The function takes a value and should make the tableview select a row where the value matches the data in a predetermined column.
So i need something like in this (pseudo-)code snippet
function setCurrentRow(value_in_col_0) { var SourceIndex = tableModel.??? var SortModelIndex = proxyModel.mapFromSource(SourceIndex) MyTable.selection.clear() MyTable.selection.select(SortModelIndex.row) MyTable.currentRow = SortModelIndex.row console.log("in setCurrentRow with index: ", SortModelIndex.row) }
My question is what is the best way to select the ModelIndex in the original, unsorted AbstractTableModel? Is it viable to do so in QML or should I rather do that in c++?