diff --git a/qt6/src/qml/ControlGroup.qml b/qt6/src/qml/ControlGroup.qml index 6f7ddc9c9..b462f9336 100644 --- a/qt6/src/qml/ControlGroup.qml +++ b/qt6/src/qml/ControlGroup.qml @@ -27,7 +27,7 @@ ColumnLayout { rightInset: inset topInset: inset bottomInset: inset - state: "normal" + state: D.DTK.hasAnimation ? "normal" : "hovered" states: [ State { name: "normal" @@ -108,6 +108,7 @@ ColumnLayout { sourceSize: Qt.size(36, 36) Behavior on rotation { + enabled : D.DTK.hasAnimation NumberAnimation { duration: root.interval easing.type: Easing.Linear @@ -120,10 +121,10 @@ ColumnLayout { anchors.fill: parent hoverEnabled: true onClicked: root.isExpanded = !root.isExpanded - onPressed: title.state = "pressed" + onPressed: title.state = D.DTK.hasAnimation ? "pressed" : "hovered" onReleased: title.state = "hovered" onEntered: title.state = "hovered" - onExited: title.state = "normal" + onExited: title.state = D.DTK.hasAnimation ? "normal" : "hovered" } background: Item { Loader { diff --git a/qt6/src/qml/ControlGroupItem.qml b/qt6/src/qml/ControlGroupItem.qml index 2a98212ad..65ef0419c 100644 --- a/qt6/src/qml/ControlGroupItem.qml +++ b/qt6/src/qml/ControlGroupItem.qml @@ -5,7 +5,7 @@ import QtQuick 2.0 import QtQuick.Layouts 1.11 import QtQml.Models 2.11 -import org.deepin.dtk 1.0 +import org.deepin.dtk 1.0 as D RowLayout { id: root @@ -21,12 +21,14 @@ RowLayout { Layout.fillHeight: true Behavior on y { + enabled : D.DTK.hasAnimation NumberAnimation { duration: parent.parent.interval easing.type: Easing.Linear } } Behavior on opacity { + enabled : D.DTK.hasAnimation NumberAnimation { duration: parent.parent.interval easing.type: Easing.Linear diff --git a/qt6/src/qml/FloatingMessage.qml b/qt6/src/qml/FloatingMessage.qml index 304f1fe16..7652ad5f7 100644 --- a/qt6/src/qml/FloatingMessage.qml +++ b/qt6/src/qml/FloatingMessage.qml @@ -10,6 +10,15 @@ import org.deepin.dtk.style 1.0 as DS D.FloatingMessageContainer { id: control + function closeMessage() { + if (D.DTK.hasAnimation) { + floatingPanel.state = "small" + } else { + floatingPanel.animationFinished = true + floatingPanel.state = "normal" + } + } + property Component contentItem: Label { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignLeft @@ -23,10 +32,10 @@ D.FloatingMessageContainer { width: DS.Style.floatingMessage.closeButtonSize height: DS.Style.floatingMessage.closeButtonSize } - onClicked: floatingPanel.state = "small" + onClicked: closeMessage() } - onDelayClose: floatingPanel.state = "small" + onDelayClose: closeMessage() duration: 4000 panel: FloatingPanel { id: floatingPanel @@ -37,7 +46,7 @@ D.FloatingMessageContainer { topPadding: 0 bottomPadding: 0 opacity: 0.0 - state: "small" + state: D.DTK.hasAnimation ? "small" : "normal" onAnimationFinishedChanged: (finished) => { if (floatingPanel.animationFinished === true) { D.DTK.closeMessage(control) @@ -95,12 +104,12 @@ D.FloatingMessageContainer { } ParallelAnimation { - running: closeButton.item ? closeButton.item.hovered : false + running: D.DTK.hasAnimation ? (closeButton.item ? closeButton.item.hovered : false) : false NumberAnimation { target: closeButton; property: "scale"; to: 1.25; duration: 300; easing.type: Easing.InOutQuart } NumberAnimation { target: closeButton; property: "rotation"; to: 90; duration: 300; easing.type: Easing.InOutQuart } } ParallelAnimation { - running: closeButton.item ? !closeButton.item.hovered : false + running: D.DTK.hasAnimation ? (closeButton.item ? !closeButton.item.hovered : false) : false NumberAnimation { target: closeButton; property: "scale"; to: 1; duration: 300; easing.type: Easing.InOutQuart } NumberAnimation { target: closeButton; property: "rotation"; to: 0; duration: 300; easing.type: Easing.InOutQuart } } diff --git a/qt6/src/qml/Menu.qml b/qt6/src/qml/Menu.qml index 5b57d614d..ad3946e4b 100644 --- a/qt6/src/qml/Menu.qml +++ b/qt6/src/qml/Menu.qml @@ -89,7 +89,7 @@ T.Menu { anchors.right: parent ? parent.right : undefined anchors.leftMargin: 6 anchors.rightMargin: 6 - scale: 0.9 + scale: D.DTK.hasAnimation ? 0.9 : 1.0 property D.Palette backgroundColor: DS.Style.highlightPanel.background property D.Palette submenuOpenedItemHighlightColor: DS.Style.menu.submenuOpenedItemHighlight property D.Palette itemHighlightShadowColor: DS.Style.menu.itemHighlightShadow