Snake/SnakeClient/SnakeApp/front-end/NotificationForm.qml

85 lines
1.9 KiB
QML
Raw Normal View History

2018-11-25 18:10:08 +03:00
import QtQuick 2.11
import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
2018-12-06 22:49:35 +03:00
BasePopUp {
2018-11-25 18:10:08 +03:00
id : popup
2019-08-17 23:42:22 +03:00
property string text: qsTr("Message")
property string img: ""
property string titleText: qsTr("Message")
property int type: 0
function _getBackGraundColor(type) {
2019-08-22 09:53:48 +03:00
switch(type) {
case 1: return "#FFC107"
case 2: return "#FF5722"
2019-08-22 09:53:48 +03:00
}
return Material.background
}
2019-08-17 23:42:22 +03:00
2019-08-09 21:20:33 +03:00
autoClose: true;
closeInterval: 5000
2018-11-25 18:10:08 +03:00
2019-08-20 17:04:03 +03:00
margins: 0
margin: 0
2019-08-20 17:04:03 +03:00
spacing: 0
backgroundColor: _getBackGraundColor(type);
2018-11-25 18:10:08 +03:00
Page {
id: page
anchors.fill: parent
spacing: 0
background: Rectangle {
color: "#00000000"
}
2018-11-25 18:10:08 +03:00
2019-08-20 17:04:03 +03:00
header: Label {
text: titleText
horizontalAlignment: Text.AlignHCenter
}
2019-08-17 23:42:22 +03:00
contentItem:
2018-11-25 18:10:08 +03:00
RowLayout {
id: rowLayout
spacing: 5
clip: true
Rectangle {
color: "#00000000"
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.preferredWidth: rowLayout.height;
Layout.preferredHeight: rowLayout.height;
Image {
id: image
fillMode: Image.PreserveAspectCrop
clip: true
anchors.fill: parent;
2019-08-20 17:04:03 +03:00
source: img
2018-11-25 18:10:08 +03:00
}
}
Label {
id: message
2019-08-20 17:04:03 +03:00
text: popup.text
2018-11-25 18:10:08 +03:00
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
Layout.fillHeight: true;
Layout.fillWidth: true;
clip: true
wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}
}
}