aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2021-08-11 16:45:26 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-10-06 15:03:10 +0000
commit553eb2562d6a26fc7bd822f45ca13c90bec80106 (patch)
treed9467213e0deec7724f5c5752f61f43654bb1fc0 /src
parent6e1fe5d477d290ba7988a6bb16ccd2e8193ec00a (diff)
macOS: ensure that you can set a custom button background
As it stood, the implicit size of a button would be empty if assigning it a custom background with an implicit size. This differs from the other styles. This patch will follow the same logic as in e.g the Fusion style, and use the maximum size of the background and the content item as the buttons implicit size. Task-number: QTBUG-95544 Change-Id: Ifaac9bea5814b2c7819906460019a85e951a063e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 20054ba885804e928726a5c515ab29306aff036b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/quicknativestyle/controls/DefaultButton.qml9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/quicknativestyle/controls/DefaultButton.qml b/src/quicknativestyle/controls/DefaultButton.qml
index 9ab4437bcb..b6d8e42789 100644
--- a/src/quicknativestyle/controls/DefaultButton.qml
+++ b/src/quicknativestyle/controls/DefaultButton.qml
@@ -45,11 +45,10 @@ T.Button {
readonly property bool __nativeBackground: background instanceof NativeStyle.StyleItem
- // Since QQuickControl will subtract the insets from the control size to
- // figure out the background size, we need to reverse that here, otherwise
- // the control ends up too big.
- implicitWidth: implicitBackgroundWidth + leftInset + rightInset
- implicitHeight: implicitBackgroundHeight + topInset + bottomInset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
leftPadding: __nativeBackground ? background.contentPadding.left : 5
rightPadding: __nativeBackground ? background.contentPadding.right : 5