diff options
author | Doris Verria <doris.verria@qt.io> | 2023-12-12 11:41:08 +0100 |
---|---|---|
committer | Doris Verria <doris.verria@qt.io> | 2023-12-12 23:44:45 +0000 |
commit | 3f6111588e0ab549607ae2eddb9880a87f34f022 (patch) | |
tree | 3ab5f03f0687f9f7636156479de02769fefad631 /src/quickcontrols | |
parent | 3fd823f85c8906ca4377c2167838f231ab567c50 (diff) |
Fusion style: Set topInset instead of y and height for the background
If the tab button is checked, we want the background to appear raised,
and if not, we want it to appear recessed, with an offset of 2. To do
that, we set y and height in the background delegate of the TabButton,
and binded them to the checked property.
We can do this by setting the topInset instead as it does exactly the
same thing, and reevaluates the height for us, without the extra code.
This is done to not only make the code cleaner, but also as a
workaround to a bug in the evaluation of bindings when setting the
y property in this case.
Fixes: QTBUG-108807
Pick-to: 6.5 6.6 6.7
Change-Id: I7b3639deb1162c6bada81e377a36e090dc398654
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/quickcontrols')
-rw-r--r-- | src/quickcontrols/fusion/TabButton.qml | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/quickcontrols/fusion/TabButton.qml b/src/quickcontrols/fusion/TabButton.qml index add96a8fa3..088a6e4529 100644 --- a/src/quickcontrols/fusion/TabButton.qml +++ b/src/quickcontrols/fusion/TabButton.qml @@ -24,6 +24,8 @@ T.TabButton { z: checked + topInset: control.checked || control.TabBar.position !== T.TabBar.Header ? 0 : 2 + contentItem: IconLabel { spacing: control.spacing mirrored: control.mirrored @@ -35,10 +37,15 @@ T.TabButton { color: control.palette.buttonText } + background: Rectangle { - y: control.checked || control.TabBar.position !== T.TabBar.Header ? 0 : 2 - implicitHeight: 21 - height: control.height - (control.checked ? 0 : 2) + implicitHeight: 19 + + // TODO: Find out why the following binding fails to update the first tab button + // See QTBUG-108807 + // y: control.checked || control.TabBar.position !== T.TabBar.Header ? 0 : 2 + // implicitHeight: 21 + // height: control.height - (control.checked ? 0 : 2) border.color: Qt.lighter(Fusion.outline(control.palette), 1.1) |