How to get acess to timestamp of a file in QListView
-
-
Hi,
How are you populating your list view ?
-
I used this code to populate the list directory.
void MainWindow::ListDirectory(QString arg_smb_path) { o_directorySystemModel = new QFileSystemModel(this); o_directorySystemModel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs); o_directorySystemModel->setRootPath(arg_smb_path); ui->treeView->setModel(o_directorySystemModel); ui->treeView->hideColumn(1); ui->treeView->hideColumn(2); ui->treeView->hideColumn(3); o_fileSystemModel = new QFileSystemModel(this); o_fileSystemModel->setFilter(QDir::NoDotAndDotDot | QDir::Files); o_fileSystemModel->setRootPath(arg_smb_path); ui->listView->setModel(o_fileSystemModel); ui->listView->setContextMenuPolicy(Qt::CustomContextMenu); }
-
-
@Christian-Ehrlicher Chris, Can you give me simple example?
-
You can use the activated signal and in the slot, you'll have the index of interest and you can use the fileInfo method pointed by @Christian-Ehrlicher to retrieve the informations you want.
-
You can use the activated signal and in the slot, you'll have the index of interest and you can use the fileInfo method pointed by @Christian-Ehrlicher to retrieve the informations you want.
-
Qt is full of examples, did you take a look at them ?