Files
pallectrum/electrum/gui/qml/components/MessageDialog.qml

81 lines
2.1 KiB
QML
Raw Normal View History

import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material
import "controls"
ElDialog {
id: dialog
title: yesno ? qsTr("Question") : qsTr("Message")
iconSource: yesno
? Qt.resolvedUrl('../../icons/question.png')
: Qt.resolvedUrl('../../icons/info.png')
property bool yesno: false
property alias text: message.text
property bool richText: false
2022-12-28 14:59:39 +01:00
z: 1 // raise z so it also covers dialogs using overlay as parent
anchors.centerIn: parent
2023-02-03 17:27:12 +01:00
padding: 0
2023-04-20 12:07:05 +02:00
width: rootLayout.width
ColumnLayout {
2023-04-20 12:07:05 +02:00
id: rootLayout
width: dialog.parent.width * 2/3
2023-02-03 17:27:12 +01:00
ColumnLayout {
visible: text
2023-02-03 17:27:12 +01:00
Layout.margins: constants.paddingMedium
2023-04-20 12:07:05 +02:00
Layout.fillWidth: true
2023-02-03 17:27:12 +01:00
TextArea {
id: message
2023-04-20 12:07:05 +02:00
Layout.fillWidth: true
2023-02-03 17:27:12 +01:00
readOnly: true
wrapMode: TextInput.WordWrap
textFormat: richText ? TextEdit.RichText : TextEdit.PlainText
background: Rectangle {
color: 'transparent'
}
}
}
2023-02-03 17:27:12 +01:00
ButtonContainer {
2023-04-20 12:07:05 +02:00
Layout.fillWidth: true
2023-02-03 17:27:12 +01:00
FlatButton {
Layout.fillWidth: true
textUnderIcon: false
text: qsTr('Ok')
2023-02-03 17:27:12 +01:00
icon.source: Qt.resolvedUrl('../../icons/confirmed.png')
visible: !yesno
onClicked: doAccept()
}
2023-02-03 17:27:12 +01:00
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
textUnderIcon: false
text: qsTr('No')
icon.source: Qt.resolvedUrl('../../icons/closebutton.png')
visible: yesno
onClicked: doReject()
}
2023-02-03 17:27:12 +01:00
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
textUnderIcon: false
text: qsTr('Yes')
icon.source: Qt.resolvedUrl('../../icons/confirmed.png')
visible: yesno
onClicked: doAccept()
}
}
}
}