PDA

View Full Version : QTableView default selection



nammidd
17th June 2018, 20:59
By default, how to select the first row in QTableView with QFileSystemModel? When i use table->selectRow(0) it selects nothing, when i use QObject::connect(model, &My_model::directoryLoaded, [&]{table->selectRow(0);}); it selects fourth row. But if i use table->selectRow(0) in events (void keyPressEvent(QKeyEvent *event) for example), it works ok, what is the problem?

ChrisW67
18th June 2018, 13:14
Is the view sorting, perhaps through a QSortFilterProxyModel dynamic sort/filer? This can upset selection.