From 917f7ceb9fda6f5e54658d2588358635d5dfbb85 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 9 Oct 2020 09:42:25 +0200 Subject: Native style, macOS: don't draw a background behind the GroupBox label On macOS, the controls are semi-transparent. This means that if you use a different color for e.g the window background, all the controls will get a different color too. For this reason, we should avoid drawing a background color for the GroupBox label. And to achieve that, we need to override the default background set from DefaultGroupBox, to use an Item instead of a Rectangle. Change-Id: I60c496c19744763adb2ec683670c4a9c64cc32fa Reviewed-by: Mitch Curtis --- src/imports/controls/macos/GroupBox.qml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/imports/controls/macos/GroupBox.qml b/src/imports/controls/macos/GroupBox.qml index 4ffbaae6..142ddd15 100644 --- a/src/imports/controls/macos/GroupBox.qml +++ b/src/imports/controls/macos/GroupBox.qml @@ -38,4 +38,23 @@ import QtQuick import QtQuick.NativeStyle as NativeStyle NativeStyle.DefaultGroupBox { + id: control + label: Item { + readonly property point labelPos : control.__nativeBackground + ? background.labelPos + : Qt.point(0,0) + x: labelPos.x + background.x + y: labelPos.y + background.y - groupBoxPadding.top + width: children[0].implicitWidth + height: children[0].implicitHeight + Text { + width: parent.width + height: parent.height + text: control.title + font: control.font + color: control.palette.windowText + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + } + } } -- cgit v1.2.3