intense
intense

Reputation: 197

QML can't open file dialog

I'm trying to create a simple File dialog using the QML:

import QtQuick 2.2
import QtQuick.Dialogs 1.0

FileDialog {
    id: fileDialog
    title: "Please choose a file"
    onAccepted: {
        console.log("You chose: " + fileDialog.fileUrls)
        Qt.quit()
    }
    onRejected: {
        console.log("Canceled")
        Qt.quit()
    }
    Component.onCompleted: visible = true
}

However, when I try to preview it I receive following errors/warnings:

QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No such file or directory
Invalid URL:  QUrl( "" ) 
Invalid URL:  QUrl( "" ) 
Invalid URL:  QUrl( "" ) 
Invalid URL:  QUrl( "" ) 
kf5.kio.core: KLocalSocket(0x1a51cf0) Jumbo packet of 35946 bytes

As far as I understand, settings the QUrl is not needed to display the dialog. If so, is it possible to set it to the user's home folder in a cross-platform way? I also tried to start the ibus daemon as I found on google that it's causing that first error line but it's still not working.

I'm using Arch (fully updated) with KF5 and QT5.4 installed.

Thanks for help!

Upvotes: 4

Views: 1708

Answers (1)

Noughmad
Noughmad

Reputation: 11

There is a bug with KF5, or rather with the interaction between QML FileDialog and KDE's platform dialog, see https://bugs.kde.org/show_bug.cgi?id=334963. It doesn't look like it's resolved yet.

You can work around this (and get the dialog to show) by adding "modality: Qt.NonModal" to the FileDialog.

Upvotes: 1

Related Questions