2021-07-05 20:55:34 +02:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
2021-06-06 18:34:27 +02:00
|
|
|
import QtQuick.Controls.Material 2.3
|
|
|
|
|
|
|
|
Dialog {
|
|
|
|
id: control
|
|
|
|
|
|
|
|
property var dataObj
|
|
|
|
property string subTitle: ""
|
|
|
|
|
|
|
|
signal selectionFinished(int index, var data)
|
2021-06-29 17:44:35 +02:00
|
|
|
signal linkActivated(string link)
|
2021-06-06 18:34:27 +02:00
|
|
|
|
|
|
|
parent: Overlay.overlay
|
|
|
|
|
|
|
|
x: 0
|
|
|
|
y: parent.height - implicitHeight
|
|
|
|
|
|
|
|
opacity: 1
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
implicitWidth: width
|
|
|
|
contentHeight: Math.min(parent.height * 0.7, implicitContentHeight)
|
|
|
|
implicitHeight: contentHeight + topPadding + bottomPadding + header.height
|
|
|
|
padding: 30
|
|
|
|
|
|
|
|
modal: true
|
|
|
|
focus: true
|
|
|
|
|
|
|
|
title: ""
|
|
|
|
|
|
|
|
header: Column {
|
|
|
|
id: selectorPuHeaderCol
|
|
|
|
|
|
|
|
width: control.width
|
2021-07-05 20:55:34 +02:00
|
|
|
height: headerLa.height + headerTopSpacerItm.height + (control.subTitle ? headerSubLa.height:0)
|
2021-06-06 18:34:27 +02:00
|
|
|
|
2021-07-05 20:55:34 +02:00
|
|
|
Item {
|
|
|
|
id: headerTopSpacerItm
|
|
|
|
height: control.padding
|
|
|
|
width: parent.width
|
|
|
|
}
|
2021-06-06 18:34:27 +02:00
|
|
|
|
2021-07-05 20:55:34 +02:00
|
|
|
MovingLabel {
|
|
|
|
id: headerLa
|
2021-06-06 18:34:27 +02:00
|
|
|
|
2021-07-05 20:55:34 +02:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
width: selectorPuHeaderCol.width - control.padding * 2
|
2021-06-06 18:34:27 +02:00
|
|
|
|
|
|
|
font.bold: true
|
|
|
|
font.pixelSize: 16
|
|
|
|
|
|
|
|
text: control.title
|
|
|
|
|
2021-07-05 20:55:34 +02:00
|
|
|
onLinkActivated: control.linkActivated(link)
|
2021-06-06 18:34:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: headerSubLa
|
|
|
|
|
2021-07-05 20:55:34 +02:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
width: selectorPuHeaderCol.width - control.padding * 2
|
2021-06-06 18:34:27 +02:00
|
|
|
|
2021-07-05 20:55:34 +02:00
|
|
|
wrapMode: Text.Wrap
|
2021-06-06 18:34:27 +02:00
|
|
|
topPadding: 5
|
|
|
|
bottomPadding: 0
|
|
|
|
font.bold: true
|
|
|
|
font.pixelSize: 16
|
|
|
|
|
|
|
|
text: control.subTitle
|
|
|
|
|
|
|
|
onLinkActivated: {
|
2021-06-29 17:44:35 +02:00
|
|
|
control.linkActivated(link)
|
2021-06-06 18:34:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
background: Item {
|
|
|
|
Rectangle {
|
|
|
|
id: backgroundRect
|
2021-06-08 19:23:55 +02:00
|
|
|
|
2021-06-06 18:34:27 +02:00
|
|
|
anchors {
|
|
|
|
fill: parent
|
|
|
|
bottomMargin: -radius
|
|
|
|
}
|
|
|
|
|
|
|
|
radius: control.leftPadding
|
|
|
|
|
|
|
|
color: control.Material.dialogColor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function appear(dataObj, title, subTitle) {
|
|
|
|
|
|
|
|
if(dataObj.length > 0){
|
|
|
|
control.dataObj = dataObj
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
control.dataObj = undefined
|
|
|
|
}
|
|
|
|
|
|
|
|
control.title = title
|
|
|
|
control.subTitle = subTitle === undefined ? "":subTitle
|
|
|
|
control.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
enter: Transition {
|
|
|
|
NumberAnimation {
|
|
|
|
property: "opacity";
|
|
|
|
from: 0
|
|
|
|
to: 1.0
|
|
|
|
easing.type: Easing.Linear
|
|
|
|
}
|
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
property: "y"
|
|
|
|
from: control.parent.height - control.implicitHeight * 0.7
|
|
|
|
to: control.parent.height - control.implicitHeight
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exit: Transition {
|
|
|
|
NumberAnimation {
|
|
|
|
property: "opacity";
|
|
|
|
from: 1
|
|
|
|
to: 0
|
|
|
|
}
|
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
property: "y"
|
|
|
|
from: control.parent.height - control.implicitHeight
|
|
|
|
to: control.parent.height - control.implicitHeight * 0.7
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|