Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QfileDialog not using native dialogs on KDE Plasma 5.18



  • I opened this issue on the bug tracker, but as it is really blocking a lot of my users (that will soon be in a class context), I would like to know if anyone is reproducing it or if anyone has a workaround.

    Just launch Qt examples related to file dialogs in a fresh Kubuntu 20.04

    Thank you !

    https://bugreports.qt.io/browse/QTBUG-86105


  • Lifetime Qt Champion

    Hi,

    Even if it looks trivial, can you provide a minimal compilable example on your bug report ?
    This will ensure that everybody uses the same code to reproduce and debug your issue.



  • Done. I'm not sure of the category I should have mentioned. I feel like "Widgets: Widgets and dialogs" is not looked at

    #include <QApplication>
    #include <QFileDialog>
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
        
        QFileDialog::getOpenFileName();
    
        return app.exec();
    }
    


  • @kamui
    You may (well) know better than I, but why do you expect this to use native dialog? https://doc.qt.io/qt-5/qfiledialog.html#getOpenFileNames

    On Windows, and macOS, this static function will use the native file dialog and not a QFileDialog.

    That implies to me that under Linux it (this static function) will use the Qt-non-native dialog? Unless you know better. In which case you would need to use one of the instance methods and set QFileDialog::DontUseNativeDialog? Or did this used to work for you previously?



  • @JonB I supposed the default behavior should be the same on every linux-based OS, and I have the same code opening native dialogs on Ubuntu 20.04 with Gnome.

    I tried the following code, no changes :

    #include <QApplication>
    #include <QFileDialog>
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        QFileDialog dialog;
        dialog.setOption(QFileDialog::DontUseNativeDialog, false);
        dialog.exec();
    
        return app.exec();
    }
    
    

    when false :

    eeea7823-5f12-44b6-ba49-9e535cbdc844-image.png

    when true :
    12241095-0a32-4f06-a7ed-54738f4e603e-image.png



  • @kamui said in QfileDialog not using native dialogs on KDE Plasma 5.18:

    be the same on every linux-based OS

    When Qt docs state "On Windows, and macOS", they mean/imply not Linux! But you have tested what I suggested now.... And I agree it works on Ubuntu + GNOME.


Log in to reply