import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 Dialog { id: control width: 320 padding: 30 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 } contentItem: ColumnLayout { id: layout IconButton { Layout.leftMargin: 30 Layout.rightMargin: 6 Layout.alignment: Qt.AlignRight source: "../resources/popup_close.svg" onClicked: control.close() } RowLayout { Layout.leftMargin: 30 Image { id: image Layout.rightMargin: 6 width: 18 height: 18 source: "qrc:/qt/qml/AntiClipSettings/resources/successfull.svg" } Text { id: titleLabel font.family: control.font.family font.pixelSize: 16 color: "#0A1F44" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } } Label { id: textLabel Layout.leftMargin: 30 + image.width+image.Layout.rightMargin+layout.spacing Layout.maximumWidth: control.width-Layout.leftMargin-control.rightPadding-control.rightInset-50 font.family: control.font.family font.pixelSize: 14 color: "#53627C" horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter wrapMode: Text.WordWrap } Button { id: cancelButton Layout.alignment: Qt.AlignRight Layout.rightMargin: 6 Layout.preferredWidth: 72 Layout.preferredHeight: 40 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" } } }