-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLoadButton.qml
More file actions
42 lines (39 loc) · 1.27 KB
/
LoadButton.qml
File metadata and controls
42 lines (39 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import QtQuick 2.13
import QtQuick.Controls 2.12
import QtQuick.Dialogs 1.3
Rectangle {
id: root
property string text: "Загрузить"
property alias filter: fileDialog.nameFilters
property string fileName: (selectFolder ? fileDialog.folder.toString(
).substring(
8) : fileDialog.fileUrl.toString(
).substring(8))
property alias fileNames: fileDialog.fileUrls
property alias multipleSelect: fileDialog.selectMultiple
property alias selectFolder: fileDialog.selectFolder
//signal accepted
signal accepted(var filePath)
width: 200
height: 50
Button {
id: loadBtn
anchors.fill: root
text: root.text
onClicked: fileDialog.visible = true
anchors.centerIn: root
Hoverd {}
}
FileDialog {
id: fileDialog
title: "Выберите файл, пожалуйста"
//folder: shortcuts.home
selectMultiple: false
selectExisting: true
onAccepted: root.accepted(fileDialog.fileUrl)
onRejected: {
console.log("Canceled")
}
Component.onCompleted: visible = false
}
}