aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-10-09 09:42:25 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-10-19 11:42:40 +0200
commit917f7ceb9fda6f5e54658d2588358635d5dfbb85 (patch)
treea0f5109b647ecd4325ccaf0f2f57608425c4b540 /src
parent5506dc44afbef14f27cb180afe9c388728be7e82 (diff)
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 <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/controls/macos/GroupBox.qml19
1 files changed, 19 insertions, 0 deletions
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
+ }
+ }
}