Important: Please read the Qt Code of Conduct -

Open specific Folder in FileDialog

  • Hello,

    I am a beginner in QML/QT. I have the following problem:

    I want to open a specific folder in FileDialog on Android

    import QtQuick 2.9
    import QtQuick.Controls 2.5
    import QtQuick.Dialogs 1.3
    ApplicationWindow {
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
        menuBar: MenuBar{
            id: menuBar
            visible: GlobalDefinitions.isEditMode
                title: qsTr("&File")
                    text: qsTr("&Open File")
                    onTriggered: {
                        id: layoutLoadDialog
                        title: qsTr("Open Layout File")
                        selectExisting: true
                        sidebarVisible: false
                        onAccepted: {

    The problem is that setting the folder on has no effect at all.
    The first time i am opening the FileDialog it opens "Recently Used" and after that
    it always remembers the folder from which the data was picked the last time.

    Remembering the last folder would not be a problem for my usecase. But it is
    important that the pictures folder is picked when I am using the FileDialog the
    first time.

    And this does not happen.

    Any ideas how to fix this?

  • The default implementation for FileDialog is way too simple, and it doesn't count many of component's settings for some reason. Anyway, if you want to pick an image, you should use Intent.ACTION_GET_CONTENT Android API. This can be easily achieved from C++ using QtAndroid namespace and QAndroidJniObject (for 5.12 + versions).

  • @IntruderExcluder Thanks for your reply. Actually I am just using the pictures folder to open a Json file which I stored there before. I used the pictures folder because it's one of the standart paths which are writable. So my goal is selecting a specific folder. But I did not know that I can start Activities or Intents from c++. So if I manage to achieve it with native Android, can I just include the Activity in the code?

    Edit: Related to this stackoverflow answer there is no Intent which opens a particular folder in android.

Log in to reply