109 lines
3.2 KiB
QML
109 lines
3.2 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
|
|
Dialog {
|
|
id: control
|
|
width: 320
|
|
parent: Overlay.overlay
|
|
anchors.centerIn: Overlay.overlay
|
|
modal: true
|
|
property alias titleText: titleLabel.text
|
|
property alias text: textLabel.text
|
|
property alias textFontSize: textLabel.font.pixelSize
|
|
property int type: MessageDialog.Type.Successful
|
|
closePolicy: Popup.CloseOnEscap | Popup.NoAutoClose
|
|
background: Rectangle {
|
|
radius: 8
|
|
}
|
|
enum Type {
|
|
Ok,
|
|
Successful,
|
|
Warning,
|
|
Failed
|
|
}
|
|
IconButton {
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: 7
|
|
anchors.top: parent.top
|
|
anchors.topMargin: 10
|
|
source: "../resources/popup_close.svg"
|
|
onClicked: control.close()
|
|
}
|
|
Image {
|
|
id: image
|
|
width: 18
|
|
height: 18
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: 30
|
|
anchors.top: parent.top
|
|
anchors.topMargin: 40
|
|
source: "qrc:/qt/qml/AntiClipSettings/resources/successfull.svg"
|
|
}
|
|
|
|
Text {
|
|
id: titleLabel
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: 60
|
|
anchors.top: parent.top
|
|
anchors.topMargin: 40
|
|
font.family: control.font.family
|
|
font.pixelSize: 16
|
|
color: "#0A1F44"
|
|
horizontalAlignment: Text.AlignHCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
}
|
|
|
|
Text {
|
|
id: textLabel
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: 60
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: 40
|
|
anchors.top: parent.top
|
|
anchors.topMargin: 76
|
|
font.family: control.font.family
|
|
font.pixelSize: 14
|
|
color: "#53627C"
|
|
horizontalAlignment: Text.AlignLeft
|
|
verticalAlignment: Text.AlignVCenter
|
|
wrapMode: Text.WordWrap
|
|
}
|
|
|
|
Button {
|
|
id: cancelButton
|
|
width: 72
|
|
height: 40
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: 15
|
|
anchors.bottom: parent.bottom
|
|
anchors.bottomMargin: 15
|
|
font.family: control.font.family
|
|
text: "关闭"
|
|
font.pixelSize: 14
|
|
contentItem: Text {
|
|
text: parent.text
|
|
font: parent.font
|
|
color: parent.down ? "#FFFFFF" : "#53627C"
|
|
horizontalAlignment: Text.AlignHCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
}
|
|
|
|
background: Rectangle {
|
|
border.color: "#E1E4E8"
|
|
border.width: 1
|
|
color: parent.down ? "#F25959" : "#FFFFFF"
|
|
radius: 2
|
|
}
|
|
onClicked: control.reject()
|
|
}
|
|
onTypeChanged: {
|
|
if (type === MessageDialog.Type.Successful || type === MessageDialog.Type.Ok) {
|
|
image.source = "qrc:/qt/qml/AntiClipSettings/resources/successfull.svg"
|
|
} else if (type === MessageDialog.Type.Warning) {
|
|
image.source = "qrc:/qt/qml/AntiClipSettings/resources/warning.svg"
|
|
} else if(type === MessageDialog.Type.Failed){
|
|
image.source = "qrc:/qt/qml/AntiClipSettings/resources/prompt_delete.svg"
|
|
}
|
|
}
|
|
}
|