QFileDialog and KDE file dialogs

David Faure faure at kde.org
Sat Mar 4 19:59:27 UTC 2017


On samedi 4 mars 2017 12:03:08 CET Frank Schäfer wrote:
> Hi,
> 
> I'm trying to track down a bug which occurs when using
> QFileDialog::getSaveFileName in a Qt5-application.
> With option QFileDialog::DontUseNativeDialog a different dialog
> displayed, so a native file dialog seems to be used.
> I've checked the source code of QFileDialog::getSaveFileName and it
> calls the file dialog which is hooked into
> _qt_filedialog_save_filename_hook.
> For KDE4, this seems to be KDialog::getSaveFileName(), but I wasn't able
> to find out if and where this hook is used in KDE5.

The hook is gone in Qt5 (or at least unused).

> Does KDE5 provide a native file dialog at all ?

Yes.

> If yes, can anybody point me to the right direction ?

plasma-integration.git provides a "platform theme" plugin which brings in the 
KDE file dialog, cf src/platformtheme/kdeplatformfiledialoghelper.cpp

> Which dialog is used if KDE4 and KDE5 libraries are installed ?

There is no KDE5 ;)
If you have KF5 and plasma-integration installed, then you'll get the Qt5/KF5 
based file dialog.
Otherwise you'll get the builtin Qt dialog.
No way will you ever get a kdelibs4/qt4-based dialog in a Qt5 application, 
that would require loading both versions of Qt at the same time, which is 
impossible ;)

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list