Results 1 to 14 of 14

Thread: QFIleDilaog Slow

  1. #1
    Join Date
    Aug 2011
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Default QFIleDilaog Slow

    Why QFileDialog is to slow?

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QFIleDilaog Slow

    QFileDialog is ok. Maybe you need more ram and faster cpu.

  3. #3
    Join Date
    Aug 2011
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFIleDilaog Slow

    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.

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QFIleDilaog Slow

    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 ?
    Last edited by stampede; 24th August 2011 at 21:06.

  5. #5
    Join Date
    Aug 2011
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFIleDilaog Slow

    This is my code:

    Qt Code:
    1. QList<QUrl> urls;
    2. urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation))
    3. << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation))
    4. << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
    5.  
    6. QFileDialog dialog;
    7. dialog.setSidebarUrls(urls);
    8. dialog.getOpenFileName( this, tr("Adicionar Imagem"), QDir::currentPath(), tr("PNG files (*.png)"), 0, QFileDialog::DontUseNativeDialog );
    To copy to clipboard, switch view to plain text mode 


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

  6. #6
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QFIleDilaog Slow

    Ok, so maybe test the release version if you want to measure speed, debug version is usually slower.

  7. #7
    Join Date
    Jul 2011
    Location
    Brasil
    Posts
    39
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFIleDilaog Slow

    Man,

    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...

    Hth.

  8. #8
    Join Date
    Jun 2011
    Location
    Chennai, India
    Posts
    30
    Thanks
    13
    Thanked 6 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFIleDilaog Slow

    Why do you want to use
    Qt Code:
    1. QFileDialog::DontUseNativeDialog
    To copy to clipboard, switch view to plain text mode 
    ?

  9. #9
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFIleDilaog Slow

    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.

  10. The following user says thank you to Lesiok for this useful post:

    gkarthick5 (26th August 2011)

  11. #10
    Join Date
    Aug 2009
    Location
    Brisbane, Australia
    Posts
    75
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFIleDilaog Slow

    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.
    Last edited by grantbj74; 7th March 2012 at 04:55.

  12. #11
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,327
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QFIleDilaog Slow

    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* 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.

  13. #12
    Join Date
    Aug 2009
    Location
    Brisbane, Australia
    Posts
    75
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFIleDilaog Slow

    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.

  14. #13
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,327
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QFIleDilaog Slow

    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.

  15. #14
    Join Date
    Aug 2009
    Location
    Brisbane, Australia
    Posts
    75
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFIleDilaog Slow

    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

Similar Threads

  1. Qt goes slow?
    By Cucus in forum Qt Programming
    Replies: 2
    Last Post: 20th July 2011, 04:43
  2. Qt4 slow like molasses
    By Tommytrojan in forum Qt Programming
    Replies: 11
    Last Post: 18th June 2010, 01:55
  3. Qt4, slow on windows ?
    By eto.ethome.sk in forum Qt Programming
    Replies: 3
    Last Post: 28th May 2009, 00:34
  4. my setupUi is very slow !
    By simnav in forum Qt Programming
    Replies: 1
    Last Post: 5th February 2009, 04:17
  5. Qt4 designer SLOW - how to fix?
    By hvengel in forum Qt Tools
    Replies: 3
    Last Post: 10th January 2008, 12:07

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.