Important: Please read the Qt Code of Conduct -

System QML FileDialog is broken and not fully native

  • Hi. I'm analyzing demo "Qt Quick System Dialog Examples" and trying implement same file dialog in my Qt Quick Controls 2 app. Problem is that my dialog looks totally different and kind of broken. Here is correct dialog from demo:
    And here is from my app. Side bar doesn't have icons, also selection in this side bar is not visible (but works), icons looks weird, translation is in English and in console output I see "Model size of -8 is less than 0" when navigating
    I'm looking over demo sources and can't find what is responsible for that. Demo is using Fussion style but event if my app use it too, then result is the same. This my code:

    import QtQuick.Dialogs 1.1
        FileDialog {
            id: fileDialog
            modality: Qt.WindowModal
            title: "Select music file"
            selectMultiple: true
            selectFolder: false
            selectExisting: true
            nameFilters: [ "Music files (*.mp3 *.ogg *.flac *.mp4)", "All files (*)" ]
            selectedNameFilter: "Music files (*.mp3 *.ogg *.flac *.mp4)"
            onAccepted: {
                console.log("Accepted: " + fileUrls)
            onRejected: { console.log("Rejected") }

    KDE Neon 5.16
    Qt 5.13

  • Found out what is a reason. I have to use:

    QApplication app(argc, argv);

    ... instead of:

    QGuiApplication app(argc, argv);

    But this require QT += widgets so dependency for my app. Since I'm writting pure QML UI app, I would preffer to stay with DefaultFileDialog which is QML based but still two issues left:

    1. Why sidebar selection doesn't work
    2. Why I'm getting "Model size of -27 is less than 0" in console output

Log in to reply