Solved FileDialog file does not show
-
Hello, I made a program with a lot of visual element. When I clicked on my menu item "OpenImage", I add this qml using QQmlApplicationEngine load function. Depending on how much UI element I have on my view, the files of FileDialog does not show.
import QtQuick 2.2 import QtQuick.Dialogs 1.0 Item { FileDialog { id: fileDialog title: "Please choose a file" folder: shortcuts.home nameFilters: [ "Image files (*.jpg *.png)", "All files (*)" ] modality: Qt.ApplicationModal onAccepted: { console.log("You chose: " + fileDialog.fileUrls) Qt.quit() } onRejected: { console.log("Canceled") Qt.quit() } Component.onCompleted: visible = true } }
-
Hi @PixyWitchy Did you call filedialog using fileDialog.open(). Why did you add Qt.quit() parts and modality?
-
@Yunus The modality is to block everything in background (c++) during the time I choose the file. Qt.quit() it's just during the testing time of my file dialog. I didn't open it with fileDialog.open() because it is visible when the component is complete and like I said I added this qml at runtime when I click on OpenImage via the load function of QQmlApplicationEngine