Select folder and files with specified format / выбор папки и файлы с указанным форматом

in the program you can select (photo, video, contacts), but how to create a folder and file selection with a description of the format?

в программе можно выбрать ( фото, видео, контакты ), но как создать выбор папки и фала с описанием формата?

Unfortunately this is not possible. Opens a standard system folder with the ability to select any of the supported formats.

import QtQuick 2.2
import QtQuick.Dialogs 1.0

Item {
    FileDialog {
    id: fileDialog
    selectFolder: true
    folder: shortcuts.home
    onAccepted: {
         document.childByName("Text 4").content.text = ("Вы выбрали папку: " + fileDialog.fileUrls)
    }
    onRejected: {
    
    }
    Component.onCompleted: visible = true
   }
}

the code works, but I can’t figure out how to attach it to the button, I need the dialog to open when the button is clicked.

код работает, но я не могу понять как мне привязать его к кнопке, нужно что бы диалог открывался при клике на кнопку.

Any action can be converted into code:

image

Then the complete code will be as follows:

import QtQuick 2.2
import QtQuick.Dialogs 1.0

Item {
    Connections {
        target: document.childByName("Button 1").scriptAdaptor
        onEventItemClicked: {
            fileDialog.visible = true
        }
    }
    FileDialog {
        id: fileDialog
        selectFolder: true
        folder: shortcuts.home
        onAccepted: {
             document.childByName("Text 4").content.text = ("Selected folder: " + fileDialog.fileUrls)
        }
        onRejected: {
        
        }
   }
}

Project file custom_file_dialog.pma (5.8 KB)

1 Like

Thank you
I forgot about this method :grinning: :grinning:


Back to Flipabit >
Copyright © 2018. Flipabit Team. All rights reserved.