[Qt-interest] QFileDialog: native + sheet (Window modal) not possible?
Andre Somers
andre at familiesomers.nl
Thu Jan 27 17:39:22 CET 2011
Op 27-1-2011 17:32, Oliver.Knoll at comit.ch schreef:
> Hi,
>
> can anyone confirm my assumption here, that with the current Qt 4.7.1 it is apparently not possible to have both
>
> * native dialogs and
> * Window modal dialogs (aka Sheets on Mac) (http://labs.qt.nokia.com/2010/02/23/unpredictable-exec/)
>
> Apparently (http://stackoverflow.com/questions/2609119/qt-qfiledialog-native-dialogs-only-with-static-functions) the only way to get native file dialogs - at least on Windows - seems to be to use the static flavours (getOpenFileName() etc.), even though the documentation of QFileDialog::DontUseNativeDialog ("By default, the native file dialog is used unless you use a subclass of QFileDialog that contains the Q_OBJECT macro.") suggests otherwise.
>
> But as also figured out in some past discussion (http://comments.gmane.org/gmane.comp.lib.qt.general/32975) instantiating a new QFileDialog *always* creates the "Qt File Dialog", not the native one.
>
> Assuming that this is also the behaviour on Mac (I haven't tried it yet) this would mean that it is not possible to use a QFileDialog as sheet ("window modal"), because "The static functions will always be an application modal dialog. If you want to use sheets, use QFileDialog::open() instead." (http://doc.qt.nokia.com/4.7/qfiledialog.html#Option-enum).
>
> But using open() requires me to instantiate a QFileDialog instance, which gives me the "Qt file dialog" again.
>
> So is the statement correct: "With Qt 4.7.1, *native* "window modal" aka "sheet" file dialogs are not possible." - or am I missing something here?
You are assuming that the behaviour on Windows, where using the
non-static method will always result in a Qt dialog box instead of the
native one, is automatically the same as how Qt would behave on Mac. I
don't think you can draw that conclusion, but I don't have access to a
Mac to try it out. I think your conclusion that sheet-style file dialogs
on Mac are not possible would already be an indication that you're
probably wrong on this one. At least, I would be very surprised if it
would be impossible to make a native looking modal file dialog on Mac.
André
More information about the Qt-interest-old
mailing list