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