【Qt Quick】————打开文件对话框
程序员文章站
2024-01-05 18:41:40
...
//任务栏显示矩形框
Rectangle{
id:view_Rec
anchors.fill: parent
border.color: "black"
border.width: 1
Column{
id:view_Row
width: parent.width-10
height: parent.height-10
anchors.centerIn: parent
spacing: 5
//显示端口设置窗口
Rectangle{
id:open_Rec
width: parent.width
height: 30
color: "#00000000"
Text {
id: open_Text
text: qsTr("打开")
font.pointSize: fontSize
font.bold: true
color: fontColor
anchors.left: parent.left
anchors.leftMargin: 15
anchors.verticalCenter: parent.verticalCenter
}
MouseArea{
id:open_MA
anchors.fill: parent
hoverEnabled: true
onEntered: {open_Rec.color = "#99cef0"}
onExited: {open_Rec.color = "#00000000"}
onClicked: {
fileDialog.open()
}
}
}
}
}
FileDialog{
id:fileDialog
title: "!!!!"
nameFilters: ["*.json"]
}