1
0
Files
electrum/electrum/gui/qml/components/MessageDialog.qml
Sander van Grieken 677e1259df qml: ElDialog now defaults to parent on Overlay.overlay
This was replicated in basically all ElDialog derived dialogs
2023-03-20 16:53:40 +01:00

82 lines
2.2 KiB
QML

import QtQuick 2.6
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.0
import "controls"
ElDialog {
id: dialog
title: 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
signal yesClicked
z: 1 // raise z so it also covers dialogs using overlay as parent
anchors.centerIn: parent
padding: 0
ColumnLayout {
ColumnLayout {
Layout.margins: constants.paddingMedium
Layout.alignment: Qt.AlignHCenter
TextArea {
id: message
Layout.preferredWidth: dialog.parent.width * 2/3
readOnly: true
wrapMode: TextInput.WordWrap
textFormat: richText ? TextEdit.RichText : TextEdit.PlainText
background: Rectangle {
color: 'transparent'
}
}
}
ButtonContainer {
Layout.fillWidth: true
FlatButton {
Layout.fillWidth: true
textUnderIcon: false
text: qsTr('Ok')
icon.source: Qt.resolvedUrl('../../icons/confirmed.png')
visible: !yesno
onClicked: dialog.close()
}
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
textUnderIcon: false
text: qsTr('Yes')
icon.source: Qt.resolvedUrl('../../icons/confirmed.png')
visible: yesno
onClicked: {
yesClicked()
dialog.close()
}
}
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
textUnderIcon: false
text: qsTr('No')
icon.source: Qt.resolvedUrl('../../icons/closebutton.png')
visible: yesno
onClicked: {
reject()
dialog.close()
}
}
}
}
}