View Full Version : QFIleDilaog Slow

24th August 2011, 20:13
Why QFileDialog is to slow?

24th August 2011, 20:34
QFileDialog is ok. Maybe you need more ram and faster cpu.

24th August 2011, 21:26
is ok? i have 2 computer, one with xp other with win 7.
The PC with windows 7 have 4 gigabytes, and only qtcreator is open.

And OpenFileDialog of another programs like firefox, word, chrome...is moreee faster.

24th August 2011, 22:02
Yeah, its quite ok for me. For example, right now I'm using windows 7, Qt Creator is taking 180 mb of my 2 Gb ram. I'm using Opera, winamp, Qt Assistant, Qt Designer and gdb opened with debug version of my app (which is taking ~400 mb). I still have ~600 mb ram available. CPU is not very fast (Pentium Dual-Core 2.1 GHz). QFileDialog::getOpenFileName or other methods runs very smooth.
Are you using static methods, or manually creating the dialog ?
And testing release or debug version ?

24th August 2011, 22:47
This is my code:

QList<QUrl> urls;
urls << QUrl::fromLocalFile(QDesktopServices::storageLocat ion(QDesktopServices::DesktopLocation))
<< QUrl::fromLocalFile(QDesktopServices::storageLocat ion(QDesktopServices::HomeLocation))
<< QUrl::fromLocalFile(QDesktopServices::storageLocat ion(QDesktopServices::DocumentsLocation));

QFileDialog dialog;
dialog.getOpenFileName( this, tr("Adicionar Imagem"), QDir::currentPath(), tr("PNG files (*.png)"), 0, QFileDialog::DontUseNativeDialog );

I think is debug version. Because all my thing is in DEBUG FOLDER.

24th August 2011, 23:25
Ok, so maybe test the release version if you want to measure speed, debug version is usually slower.

25th August 2011, 00:37

I think your code is not much efficient....
QFileDialog::getOpenFileName is a static member, so I'm in doubt if this will work properly...
Try to find out another non-static member to pop the dialog and get the file name...


26th August 2011, 07:48
Why do you want to use

26th August 2011, 08:19
Problem is with QFileDialog::DontUseNativeDialog. QFileDialog must read ALL files attributes and this is time consuming. Using native dialog is faster because OS caches this info.

7th March 2012, 05:44
I also find QFileDialog very slow.

If I select DontUseNativeDialog the dialog take ages to appear.

If I use the native dialog, it appears quickly, but when you click on it, it takes ages to react.

My PC is Windows XP with 4GB Ram.

My first thoughts was its Windows problem.

Windows Explorer can be a bit slow at times on this PC too.

7th March 2012, 05:55
I also have this problem, and I think in my case it is probably unrelated to Qt or QFileDialog, but the problem is especially noticeable with QFileDialog.

I have a fast PC, but I also have about 6 external USB drives. What I think causes the slowness is that before the dialog can be populated, it has to spin up and sync all of the external drives that have powered down due to their power-saving energy efficiency features. I still use File Manager (I *hate* :mad: Explorer), and when I switch windows to one of the USB drives, it can take 30 seconds or more before the folder expands.

So, if you have a similar configuration with big external USB or eSATA drives, this might be the real cause of the slowness.

7th March 2012, 06:13
I don't usually have USB devices going.

But I do have a heap of network drives, maybe they slow it down.

Might have to make my own file dialog box that isn't so smart.

I just used an old QT application that has QFileDialog in it. It doesn't seem slow at all. So maybe mine is a code issue.

7th March 2012, 06:26
I just used an old QT application that has QFileDialog in it. It doesn't seem slow at all. So maybe mine is a code issue.

If the old Qt app is using older Qt DLLs, it might also be a behavior difference. There was a pretty major change in the way Qt handles access to the file system in Qt 4.4 where the QFileSystemModel was introduced to replace QDirModel, and in 4.2, where QFileSystemWatcher was introduced. My guess is that QFileDialog was also reimplemented to use the new QFileSystemModel. So the difference you see might be a pre-4.4 vs. post-4.4 QFileDialog implementation.

7th March 2012, 07:51
I just recompiled the old application. It is slow now too.

I don't think it's a QT issue though. As i'm fairly sure we have never upgraded QT. Think im using QT 4.6.3.

I think I may have the solution. My old debug application is slow and 45mb in size. Where as the same version old released is fast and 15mb in size.

So maybe try compiling a released version.

Unfortunately I can't do a released version of my new app until someone adds QWT to the autobuilder machine. I'll let you know if this ever happens ;)