forked from zhengtianzuo/QtQuickExamples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.qml
75 lines (70 loc) · 1.78 KB
/
main.qml
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*!
*@file main.qml
*@brief 主文件
*@version 1.0
*@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation
*@author zhengtianzuo
*/
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import Qt.labs.platform 1.0
ApplicationWindow {
visible: true
width: 400
height: 300
title: qsTr("Qml文件对话框")
Column{
anchors.centerIn: parent
Button{
text: qsTr("打开文件")
height: 48
width: 120
MouseArea{
anchors.fill: parent
onClicked: {
fileDialog1.open()
}
}
}
Button{
text: qsTr("打开多个文件")
height: 48
width: 120
MouseArea{
anchors.fill: parent
onClicked: {
fileDialog2.open()
}
}
}
Button{
text: qsTr("保存文件")
height: 48
width: 120
MouseArea{
anchors.fill: parent
onClicked: {
fileDialog3.open()
}
}
}
}
FileDialog {
id: fileDialog1
fileMode: FileDialog.OpenFile
nameFilters: ["图像文件 (*.png *.jpg *.gif *.bmp)", "全部文件 (*.*)"]
options :FileDialog.ReadOnly
}
FileDialog {
id: fileDialog2
fileMode: FileDialog.OpenFiles
nameFilters: ["图像文件 (*.png *.jpg *.gif *.bmp)", "全部文件 (*.*)"]
options :FileDialog.ReadOnly
}
FileDialog {
id: fileDialog3
nameFilters: ["图像文件 (*.png *.jpg *.gif *.bmp)", "全部文件 (*.*)"]
fileMode: FileDialog.SaveFile
}
}