QListView not displaying all directory files
Im settings the QListView's index:
Code:
QString directory
= "C:\\Users\\Username\\Desktop";
ui->list->setRootIndex(model.index(directory));
But it displays only 101 items as opposed to 143 showing on explorer.exe(I know, Im messy ....) Any idea as to why?
Update: I found out that the files not displayed are Windows shortcut files. Including Recycle Bin, My Computer & others.
Re: QListView not displaying all directory files
Try to set the model filter with QDirModel::setFilter()
Re: QListView not displaying all directory files
It would be good to know how the model is setup and what is the actual model class.
Re: QListView not displaying all directory files
Thats how I put it in my class.
Re: QListView not displaying all directory files
Did you try setting resolve symlinks to true ? QDirModel::setResolveSymlinks()?
Re: QListView not displaying all directory files
Tried both :
Code:
model.
setFilter(QDir::AllEntries);
model.setResolveSymlinks(true);
Still the same. Some shorcuts appear but others dont, missing 30 or more files...
Re: QListView not displaying all directory files
Quote:
Originally Posted by
been_1990
Im settings the QListView's index:
Code:
QString directory
= "C:\\Users\\Username\\Desktop";
ui->list->setRootIndex(model.index(directory));
But it displays only 101 items as opposed to 143 showing on explorer.exe(I know, Im messy ....) Any idea as to why?
Update: I found out that the files not displayed are Windows shortcut files. Including Recycle Bin, My Computer & others.
iirc from my windows days (been quite a few years) items such as Recycle Bin, My computer, etc are not items in the file system. I think the terminology is Windows Shell NameSpace, but googling should give you some code to work with.
You'll need to create a model to traverse the NameSpace using the Windows api.
Re: QListView not displaying all directory files
Re: QListView not displaying all directory files
Current code:
Code:
QFileSystemModel model;
QString directory
= "C:\\Users\\Username\\temp files\\";
ui->list->setRootIndex(model.setRootPath(directory));
In this directory I have 69 Windows shortcuts. But my QListView shows only 68 . And if I doube the amount I am missing 2 shortcuts.
Im using Vista, could be the cause? Probably not...
Re: QListView not displaying all directory files
Re: QListView not displaying all directory files
I checked each file and the ones not shown where Recycle Bin, PGP Shredder and shortcut, "Vista Shortcut Manager" shortcut and SUPER © Uninstall shortcut. Apparently it doesn't show some shortcuts, I checked their properties and apparently they had no difference.
When pointed to my Pictures folder it doesnt show "Sample Pictures" shortcut. So it probably is a Windows-managed-shorcut problem.
Re: QListView not displaying all directory files
Quote:
Originally Posted by
been_1990
I checked each file and the ones not shown where Recycle Bin, PGP Shredder and shortcut, "Vista Shortcut Manager" shortcut and SUPER © Uninstall shortcut. Apparently it doesn't show some shortcuts, I checked their properties and apparently they had no difference.
When pointed to my Pictures folder it doesnt show "Sample Pictures" shortcut. So it probably is a Windows-managed-shorcut problem.
You still need to use the Shell Namespace API if you want these "folders" on windows;
http://msdn.microsoft.com/en-us/libr...90(VS.85).aspx
A quick search came up this which gives a C++ example.
Re: QListView not displaying all directory files
So.. thats really the only way? I didnt quite understand how to pass that to QT. I get quite confused reading MSDN documentation.It would be better if there were a QT way..
Re: QListView not displaying all directory files
The thing is that this is out of scope of the model. Those icons are not in the filesystem, they are fake icons created on the fly by Windows Explorer (or actually the Windows desktop probably). The model, on the other hand, contains contents of the file system.
Re: QListView not displaying all directory files
Okay. Thats understood. So the Recycle Bin and PGP Shredder appear at startup. They are "fake" icons. But what about the "Vista Shortcut Manager" shortcut and SUPER © Uninstall shortcut not appearing? They are not made on the fly and are a true "file".