[Qt-interest] QFileDialog signals
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Thu Sep 2 18:25:46 CEST 2010
On 2010-09-02 Andreas Andreas Pakulat wrote:
>> ...
>> - Clarify that on some platforms it IS possible that one might get a
>> native dialog, also via c'tor
>> - Clarify that if one relies on the signals being emitted one should
>> always explicitly set the DontUseNativeDialog
>
> Apparently windows is the only of the 3 major platforms where you _do_ get a Qt
> filedialog. On MacOSX you also get the native one (at least in Qt 4.5)
I just re-checked with the 2010.04 SDK (with Qt 4.6.3) on Windows XP: with the c'tor instantiation one indeed gets the non-native Qt file dialog, whereas the static getOpenFileName() for instance instantiates the native file dialog.
As I said, the current 4.6 Qt docs don't really tell whether the "c'tor method" can invoke the native file dialog, and they don't tell the opposite either. Yes, the 'DontUseNativeDialog' flag hints at the *possibility* that also the c'tor-method could create a native dialog, but then again only the static methods explicitly mention the native dialogs.
Also the explanation of that flag (which exists since 4.0) "Don't use the native file dialog. By default on Mac OS X and Windows, the native file dialog is used." - is mis-leading, since clearly on Windows the default is certainly NOT the native dialog, when doing:
QFileDialog fd;
QString initialDirectory = "c:/temp/";
fd.setDirectory(initialDirectory);
if (fd.exec()) {
QString filePath = fd.selectedFiles().at(0);
...
}
(or I am doing something wrong in the above example).
So one is made believe that this flag must only have an effect on the static methods, which again also expliclity talk about native dialogs being invoked.
Or it is simply a bug in the Qt Windows port that the c'tor does not invoke the native dialog, who knows...
In any case, the Qt docs should be clearer on the fact that also the c'tor will try to invoke the native dialog (unless the above flag is set) and that in this case no(t all) signals will be emitted.
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list