diff --git a/qt6/src/qml/FloatingMessage.qml b/qt6/src/qml/FloatingMessage.qml index 5b1d9cb97..65c90a9f6 100644 --- a/qt6/src/qml/FloatingMessage.qml +++ b/qt6/src/qml/FloatingMessage.qml @@ -23,9 +23,18 @@ D.FloatingMessageContainer { width: DS.Style.floatingMessage.closeButtonSize height: DS.Style.floatingMessage.closeButtonSize } - onClicked: D.DTK.closeMessage(control) + onClicked: { + floatingPanel.state = "small" + destroyTimer.running = true + } + Timer { + id: destroyTimer + interval: 1200; running: false; repeat: true + onTriggered: D.DTK.closeMessage(control) + } } + duration: 4000 panel: FloatingPanel { id: floatingPanel @@ -34,12 +43,24 @@ D.FloatingMessageContainer { rightPadding: 10 topPadding: 0 bottomPadding: 0 - + opacity: 0.0 + state: "small" + Timer { + id: timer + interval: 100; running: false; repeat: false + onTriggered: { + floatingPanel.y = floatingPanel.parent.height + floatingPanel.state = "normal" + console.log("onCompleted", floatingPanel.y, floatingPanel.parent.width, floatingPanel.parent.height) + } + } + Component.onCompleted: { + timer.running = true + } contentItem: RowLayout { height: DS.Style.floatingMessage.minimumHeight width: Math.min(DS.Style.floatingMessage.maximumWidth, children.width + floatingPanel.leftPadding - floatingPanel.rightPadding) spacing: 10 - Loader { id: iconLoader Layout.alignment: Qt.AlignVCenter @@ -77,6 +98,46 @@ D.FloatingMessageContainer { visible: active sourceComponent: button } + + ParallelAnimation { + running: closeButton.item.hovered + NumberAnimation { target: closeButton; property: "scale"; to: 1.25; duration: 500 } + NumberAnimation { target: closeButton; property: "rotation"; to: 90; duration: 500 } + } + ParallelAnimation { + running: !closeButton.item.hovered + NumberAnimation { target: closeButton; property: "scale"; to: 1; duration: 500 } + NumberAnimation { target: closeButton; property: "rotation"; to: 0; duration: 500 } + } } + + states: [ + State { + name: "normal" + PropertyChanges { + target: floatingPanel + y: 0 + opacity: 1.0 + scale: 1.0 + } + }, + State { + name: "small" + PropertyChanges { + target: floatingPanel + y: floatingPanel.parent.height + opacity: 0.0 + scale: 0.2 + } + } + ] + + transitions: Transition { + NumberAnimation { + properties: "y, opacity, scale" + easing.type: Easing.Linear + duration: 1000 + } + } } } diff --git a/src/private/dmessagemanager.cpp b/src/private/dmessagemanager.cpp index 4d1bd33d0..0941a4162 100644 --- a/src/private/dmessagemanager.cpp +++ b/src/private/dmessagemanager.cpp @@ -188,11 +188,15 @@ void MessageManager::ensureLayout() QQmlComponent columnCom(qmlEngine(parent())); columnCom.setData("import QtQuick 2.11\n" "Column {\n" + " spacing: 0\n" " anchors {\n" " bottom: parent.bottom\n" - " bottomMargin: 10;\n" + " bottomMargin: 20;\n" " horizontalCenter: parent.horizontalCenter\n" " }\n" + " Component.onCompleted: {\n" + " console.log(\"parent onCompleted\", children.length);\n" + " }" "}\n", QUrl()); auto layout = columnCom.beginCreate(qmlContext(parent())); setLayout(qobject_cast(layout));