wowlet/src/vr/qml/common/MyDialogOkPopup.qml

99 lines
2.7 KiB
QML
Raw Normal View History

2021-04-05 11:37:41 +00:00
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
2021-04-08 01:40:44 +00:00
import "."
2021-04-05 11:37:41 +00:00
Popup {
id: myDialogPopup
2021-04-08 01:40:44 +00:00
property bool dismissible: true
2021-04-05 11:37:41 +00:00
implicitHeight: parent.height
implicitWidth: parent.width
property string dialogTitle: ""
property string dialogText: ""
2021-04-08 01:40:44 +00:00
property int dialogWidth: 900
2021-04-05 11:37:41 +00:00
property int dialogHeight: 300
property Item dialogContentItem: MyText {
fontSize: 36
2021-04-05 11:37:41 +00:00
text: dialogText
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Layout.fillWidth: true
2021-04-08 01:40:44 +00:00
wrap: true
2021-04-05 11:37:41 +00:00
}
property bool okClicked: false
2021-04-08 01:40:44 +00:00
closePolicy: myDialogPopup.dismissible ? Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent : Popup.NoAutoClose
2021-04-05 11:37:41 +00:00
background: Rectangle {
color: "black"
opacity: 0.8
}
contentItem: Item {
Rectangle {
implicitWidth: dialogWidth
implicitHeight: dialogHeight
anchors.centerIn: parent
radius: 24
2021-04-08 01:40:44 +00:00
color: Style.backgroundColor
border.color: Style.fontColorDimmed
2021-04-05 11:37:41 +00:00
border.width: 2
ColumnLayout {
anchors.fill: parent
anchors.margins: 12
MyText {
Layout.leftMargin: 16
Layout.rightMargin: 16
text: dialogTitle
}
Rectangle {
2021-04-08 01:40:44 +00:00
color: Style.fontColorDimmed
2021-04-05 11:37:41 +00:00
height: 1
Layout.fillWidth: true
}
Item {
Layout.fillHeight: true
Layout.fillWidth: true
}
ColumnLayout {
id: dialogContent
}
Item {
Layout.fillHeight: true
Layout.fillWidth: true
}
RowLayout {
2021-04-08 01:40:44 +00:00
visible: myDialogPopup.dismissible
2021-04-05 11:37:41 +00:00
Layout.fillWidth: true
Layout.leftMargin: 24
Layout.rightMargin: 24
Layout.bottomMargin: 12
Item {
Layout.fillWidth: true
}
MyPushButton {
implicitWidth: 200
text: "Ok"
onClicked: {
okClicked = true
myDialogPopup.close()
}
}
Item {
Layout.fillWidth: true
}
}
}
}
}
Component.onCompleted: {
dialogContentItem.parent = dialogContent
}
}