Unsolved How to get acess to timestamp of a file in QListView
-
I have a QListView widget which shows the contents of a folder. Now I wanted to select a file in QListView and then try to get the timestamp of the selected tile. Then I wanted to show it in the QTime widget. How can I implement such a thing?
-
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.
-
@SGaist I am new to Qt and I am not really familiar with whole thing. If you give me some example code, I can understand how should I go.
-
Qt is full of examples, did you take a look at them ?
-
@SGaist I am new to Qt and I am not a professional c++ programmer because of that I need some real help to implement this program. I already implemented everything well but this feature has not completed yet. :(