[Qt-interest] QFileDialog on Windows

Duane Hebert spoo at flarn.com
Wed Jun 30 21:04:52 CEST 2010


<Oliver.Knoll at comit.ch> wrote in message news:C10F29AB06447B4881FC0DE1E302E2F206CAA85AC2 at sg000036.corproot.net...

Hi Oliver,

> Here is a small example which confirms that instantiating a QFileDialog you get the Qt flavour (non-native). The 2nd part which 
> calls the static method then shows the proper native dialog. At least this is with Qt 4.6.1 on Win XP SP 3.
<snip>

This is the behavior that I see as well.  It's just that the help was misleading.  I don't understand why, exactly, I can't choose 
the native dialog in either case but certainly when using the QFileDialog directly.  At any rate, I'm subclassing the file dialog to 
comply with some other requirements so I can't use the original or the static one.

As a patch I found that I can do:
QList<QUrl> urls;
     urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation))
     << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation))
     << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::ApplicationsLocation))
     << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::TempLocation))
     << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation))

     setSidebarUrls(urls);

And this gives me pretty much what I'm looking for.  I imagine that the static version is doing more or less the same thing though 
I'm not positive about that as I haven't looked at the source.

FWIW file dialogs are probably one of the main utilities that a user would expect to be consistent across applications on their 
system.

 




More information about the Qt-interest-old mailing list