From d6325b4f5baeafddcf5c570ccd772ff8faf1d1fa Mon Sep 17 00:00:00 2001 From: zhuzichu Date: Mon, 22 Jan 2024 15:32:45 +0800 Subject: [PATCH] fix bug #408 --- src/FluFramelessHelper.cpp | 1 - .../imports/FluentUI/Controls/FluExpander.qml | 21 ++++++++++--------- .../imports/FluentUI/Controls/FluExpander.qml | 19 +++++++++-------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/FluFramelessHelper.cpp b/src/FluFramelessHelper.cpp index 58b52f73..57a0d940 100644 --- a/src/FluFramelessHelper.cpp +++ b/src/FluFramelessHelper.cpp @@ -194,7 +194,6 @@ bool FluFramelessHelper::eventFilter(QObject *obj, QEvent *ev){ break; case QEvent::MouseButtonRelease: _edges = 0; - _updateCursor(_edges); break; case QEvent::MouseMove: { if(_maximized() || _fullScreen()){ diff --git a/src/Qt5/imports/FluentUI/Controls/FluExpander.qml b/src/Qt5/imports/FluentUI/Controls/FluExpander.qml index 9aa00cde..b4a4d568 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluExpander.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluExpander.qml @@ -4,12 +4,12 @@ import QtQuick.Window 2.15 import FluentUI 1.0 Item { - property string headerText: "Titlte" + property string headerText: "" property bool expand: false property int contentHeight : 300 default property alias content: container.data id:control - implicitHeight: Math.max((layout_header.height + container.height),layout_header.height) + implicitHeight: Math.max((layout_header.height + layout_container.height),layout_header.height) implicitWidth: 400 Rectangle{ id:layout_header @@ -64,31 +64,32 @@ Item { } } Item{ + id:layout_container anchors{ top: layout_header.bottom topMargin: -1 left: layout_header.left } width: parent.width + clip: true visible: contentHeight+container.y !== 0 height: contentHeight+container.y - clip: true Rectangle{ id:container - width: parent.width - height: parent.height + anchors.fill: parent radius: 4 clip: true color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) - y: -contentHeight + anchors.topMargin: -contentHeight + // y: -contentHeight states: [ State{ name:"expand" when: control.expand PropertyChanges { target: container - y:0 + anchors.topMargin:0 } }, State{ @@ -96,7 +97,7 @@ Item { when: !control.expand PropertyChanges { target: container - y:-contentHeight + anchors.topMargin:-contentHeight } } ] @@ -104,7 +105,7 @@ Item { Transition { to:"expand" NumberAnimation { - properties: "y" + properties: "anchors.topMargin" duration: FluTheme.enableAnimation ? 167 : 0 easing.type: Easing.OutCubic } @@ -112,7 +113,7 @@ Item { Transition { to:"collapsed" NumberAnimation { - properties: "y" + properties: "anchors.topMargin" duration: FluTheme.enableAnimation ? 167 : 0 easing.type: Easing.OutCubic } diff --git a/src/Qt6/imports/FluentUI/Controls/FluExpander.qml b/src/Qt6/imports/FluentUI/Controls/FluExpander.qml index bc8d4738..8b4fb16f 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluExpander.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluExpander.qml @@ -4,12 +4,12 @@ import QtQuick.Window import FluentUI Item { - property string headerText: "Titlte" + property string headerText: "" property bool expand: false property int contentHeight : 300 default property alias content: container.data id:control - implicitHeight: Math.max((layout_header.height + container.height),layout_header.height) + implicitHeight: Math.max((layout_header.height + layout_container.height),layout_header.height) implicitWidth: 400 Rectangle{ id:layout_header @@ -64,6 +64,7 @@ Item { } } Item{ + id:layout_container anchors{ top: layout_header.bottom topMargin: -1 @@ -75,20 +76,20 @@ Item { height: contentHeight+container.y Rectangle{ id:container - width: parent.width - height: parent.height + anchors.fill: parent radius: 4 clip: true color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) - y: -contentHeight + anchors.topMargin: -contentHeight + // y: -contentHeight states: [ State{ name:"expand" when: control.expand PropertyChanges { target: container - y:0 + anchors.topMargin:0 } }, State{ @@ -96,7 +97,7 @@ Item { when: !control.expand PropertyChanges { target: container - y:-contentHeight + anchors.topMargin:-contentHeight } } ] @@ -104,7 +105,7 @@ Item { Transition { to:"expand" NumberAnimation { - properties: "y" + properties: "anchors.topMargin" duration: FluTheme.enableAnimation ? 167 : 0 easing.type: Easing.OutCubic } @@ -112,7 +113,7 @@ Item { Transition { to:"collapsed" NumberAnimation { - properties: "y" + properties: "anchors.topMargin" duration: FluTheme.enableAnimation ? 167 : 0 easing.type: Easing.OutCubic }