diff options
author | Kaj Grönholm <[email protected]> | 2025-10-07 12:15:32 +0300 |
---|---|---|
committer | Kaj Grönholm <[email protected]> | 2025-10-09 23:31:45 +0300 |
commit | 385e95794a14533eb580f1892d372a7bdd07ba89 (patch) | |
tree | 28831d3067c8ab420b4f8b994008f88e0da98975 | |
parent | a92b696b7017b00ac94e8d94597efd9e979aeacb (diff) |
FluentWinUI3: Fix ComboBox size when the model changes
The problem was that enter Transition dynamically adjusts from and to
values and these values are not up-to-date. Also, transition animates
height property while from and to also depend on it.
Solve this by animating instead __heightScale with non changing from &
to values, so synchronizing property changes are not needed.
Do the same change for Menu that uses a similar approach.
Pick-to: 6.10 6.8
Task-number: QTBUG-138744
Change-Id: Ibede68a2d20ef437e0bc1637b5177f10c62935dd
Reviewed-by: Doris Verria <[email protected]>
-rw-r--r-- | src/quickcontrols/fluentwinui3/ComboBox.qml | 6 | ||||
-rw-r--r-- | src/quickcontrols/fluentwinui3/Menu.qml | 10 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/quickcontrols/fluentwinui3/ComboBox.qml b/src/quickcontrols/fluentwinui3/ComboBox.qml index e25f511e4c..3eb19e61f6 100644 --- a/src/quickcontrols/fluentwinui3/ComboBox.qml +++ b/src/quickcontrols/fluentwinui3/ComboBox.qml @@ -140,14 +140,16 @@ T.ComboBox { y: control.editable ? control.height : -0.25 * Math.max(implicitBackgroundHeight + topInset + bottomInset, contentHeight + topPadding + bottomPadding) - height: Math.min(contentItem.implicitHeight + topPadding + bottomPadding, control.Window.height - topMargin - bottomMargin) + readonly property real __targetHeight: Math.min(contentItem.implicitHeight + topPadding + bottomPadding, control.Window.height - topMargin - bottomMargin) + property real __heightScale: 1 + height: __heightScale * __targetHeight width: control.width topMargin: 8 bottomMargin: 8 palette: control.palette enter: Transition { - NumberAnimation { property: "height"; from: control.popup.height / 3; to: control.popup.height; easing.type: Easing.OutCubic; duration: 250 } + NumberAnimation { property: "__heightScale"; from: 0.33; to: 1; easing.type: Easing.OutCubic; duration: 250 } } background: ItemGroup { diff --git a/src/quickcontrols/fluentwinui3/Menu.qml b/src/quickcontrols/fluentwinui3/Menu.qml index 5accf817b4..38088dd741 100644 --- a/src/quickcontrols/fluentwinui3/Menu.qml +++ b/src/quickcontrols/fluentwinui3/Menu.qml @@ -46,14 +46,10 @@ T.Menu { ScrollIndicator.vertical: ScrollIndicator {} } + property real __heightScale: 1 + height: __heightScale * implicitHeight enter: Transition { - NumberAnimation { - property: "height" - from: control.implicitHeight * 0.33 - to: control.implicitHeight - easing.type: Easing.OutCubic - duration: 250 - } + NumberAnimation { property: "__heightScale"; from: 0.33; to: 1; easing.type: Easing.OutCubic; duration: 250 } } background: Impl.StyleImage { |