magpie/qml/Components/Modal.qml

62 lines
1.4 KiB
QML
Raw Normal View History

import QtQuick
import QtQuick.Controls
Popup {
property bool inProgress: false
property string status: ""
id: modal
anchors.centerIn: parent
modal: true
focus: true
width: column.width + 60
height: column.height + 60
closePolicy: Popup.CloseOnEscape
onClosed: inProgress = false
Column {
id: column
anchors.centerIn: parent
spacing: 10
Label {
text: status
width: 300
wrapMode: Label.WordWrap
horizontalAlignment: Label.AlignHCenter
}
BusyIndicator {
anchors.horizontalCenter: parent.horizontalCenter
visible: inProgress
running: inProgress
}
Button {
text: qsTr("Close")
anchors.horizontalCenter: parent.horizontalCenter
visible: !inProgress
onClicked: modal.close()
focus: true
Keys.onReturnPressed: {
if (!inProgress)
modal.close()
}
}
}
enter: Transition {
NumberAnimation {
property: "opacity"
from: 0.0
to: 1.0
duration: 200
}
}
exit: Transition {
NumberAnimation {
property: "opacity"
from: 1.0
to: 0.0
duration: 200
}
}
}