Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.2.6, 6.5.4
-
None
-
2a8b27bf6 (dev), 9316d0b64 (dev), 1753af384 (6.7), 481d4fcc8 (6.6)
Description
I was testing the new Qt Quick TreeView; the manual test from https://codereview.qt-project.org/c/qt/qtdeclarative/+/384949 uses QFileSystemModel and TreeView to make a trivial file tree explorer. I noticed that if I try to open /tmp it takes quite some time (half a minute or so); this is on a very fast system with SSD RAID storage, but /tmp is tmpfs of course (RAM-based) so there's no excuse for it not to be instantaneous. ls is instantaneous. But strace reveals that QFileSystemModel is searching all the icon directories like mad for an icon for each file in my /tmp dir. And actually Qt is the reason there are so many files too: stuff like qquicktextedit-cd241c.ii qfilesystemmodel_p-73d971.ii and a couple thousand more, all zero-size files. But it doesn't matter; there are a lot of directories I could look at that have thousands of files in them.
Not every use of QFileSystemModel needs icons. We have an option DontUseCustomDirectoryIcons, but how about DontUseIcons, so that the icon role is simply not populated at all?
I tried setIconProvider(nullptr); that makes it crash, which could be considered a bug. So I tried adding null pointer checks to make it stop crashing; then I can explore only the top-level directories, but nothing inside them. Maybe it's because iconProvider->type() is the function that figures out whether each entry is a file or a directory, so if there's no icon provider, you can't even fully walk the tree. If so, that's not a great design, since QFileInfo already knows that much.
Attachments
Issue Links
- relates to
-
QTBUG-45950 QFileDialog: unable to completely ignore default QIconProvider
-
- Reported
-
-
QTBUG-30441 QFileSystemModel requests icons for filtered files
-
- Reported
-
-
QTBUG-33039 get{Open|Save}FileName hangs for about 10 seconds in a loaded folder
-
- Closed
-
-
QTBUG-63872 QFileDialog: no way to set icon provider before creating widget
-
- Closed
-