2023-07-17 10:49:06 +02:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Controls.Material
|
2022-03-30 21:08:48 +02:00
|
|
|
|
2022-07-26 16:20:17 +02:00
|
|
|
import "controls"
|
|
|
|
|
|
|
|
|
|
ElDialog {
|
2022-03-30 21:08:48 +02:00
|
|
|
id: dialog
|
2023-04-18 10:32:07 +02:00
|
|
|
title: yesno ? qsTr("Question") : 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
|
|
|
|
|
|
2023-04-20 12:07:05 +02:00
|
|
|
width: rootLayout.width
|
|
|
|
|
|
2022-03-30 21:08:48 +02:00
|
|
|
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 {
|
2023-04-18 14:07:41 +02:00
|
|
|
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'
|
|
|
|
|
}
|
2022-03-30 21:08:48 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
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
|
2023-04-13 10:49:41 +02:00
|
|
|
text: qsTr('No')
|
|
|
|
|
icon.source: Qt.resolvedUrl('../../icons/closebutton.png')
|
2022-03-30 21:08:48 +02:00
|
|
|
visible: yesno
|
2023-04-13 10:49:41 +02:00
|
|
|
onClicked: doReject()
|
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
|
2023-04-13 10:49:41 +02:00
|
|
|
text: qsTr('Yes')
|
|
|
|
|
icon.source: Qt.resolvedUrl('../../icons/confirmed.png')
|
2022-03-30 21:08:48 +02:00
|
|
|
visible: yesno
|
2023-04-13 10:49:41 +02:00
|
|
|
onClicked: doAccept()
|
2022-03-30 21:08:48 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|