Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to select row in QListView of QFileSystemModel ?
-
When I create a new file, the listview will update, but how can I use code to select the new file at row 0 ?
directory = QStandardPaths::standardLocations(QStandardPaths::MusicLocation).first() + "/HTYAR"; model = new QFileSystemModel; model->setRootPath(directory); model->setNameFilterDisables(false); model->sort(3,Qt::DescendingOrder); ui->listView->setModel(model); ui->listView->setRootIndex(model->index(directory));
-
@sonichy does https://stackoverflow.com/questions/6925951/how-to-select-a-row-in-a-qlistview help you?