aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2025-12-18 11:27:53 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2025-12-22 12:05:24 +0000
commit1e236dc08f8a6b3d731a15fb2e10e27c4033d430 (patch)
treeff8c093aca853769cae9cefd9cdfb799f39e2243
parent83c84aa822028efbaee74d3f09c33c7e71d10680 (diff)
macOS: draw ComboBox correctly on macOS 266.10
On macOS 26, the down indicator in editable ComboBoxes was drawn with scaling applied, causing it to appear distorted. In addition, the focus frame was misaligned for both editable and non-editable ComboBoxes. This patch ensures that ComboBoxes are drawn with 9-patch scaling disabled. Previously, enabling 9-patch scaling caused the down indicator to be scaled together with the background, resulting in incorrect rendering. The patch also adjusts margins to properly center the label and align the focus frame with the control’s frame. Pick-to: 6.8 6.5 Change-Id: I0aafd77dd7ec098589c92fbc161a530a777b1d91 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 49033046e64ce238073dd4b0cf00c8010999e434) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit b387baca22f92731738bf99319a4c55ddac3699e)
-rw-r--r--src/quickcontrols/macos/ComboBox.qml9
-rw-r--r--src/quicknativestyle/qstyle/mac/qquickmacstyle_mac.mm40
2 files changed, 38 insertions, 11 deletions
diff --git a/src/quickcontrols/macos/ComboBox.qml b/src/quickcontrols/macos/ComboBox.qml
index cb4c205776..a7f997a33d 100644
--- a/src/quickcontrols/macos/ComboBox.qml
+++ b/src/quickcontrols/macos/ComboBox.qml
@@ -10,6 +10,15 @@ NativeStyle.DefaultComboBox {
id: control
readonly property Item __focusFrameTarget: control
+ background: NativeStyle.ComboBox {
+ control: control
+ contentWidth: contentItem.implicitWidth
+ contentHeight: contentItem.implicitHeight
+ useNinePatchImage: false
+
+ readonly property bool __ignoreNotCustomizable: true
+ }
+
contentItem: T.TextField {
implicitWidth: contentWidth
implicitHeight: contentHeight
diff --git a/src/quicknativestyle/qstyle/mac/qquickmacstyle_mac.mm b/src/quicknativestyle/qstyle/mac/qquickmacstyle_mac.mm
index ff52325f3e..88884b4b4e 100644
--- a/src/quicknativestyle/qstyle/mac/qquickmacstyle_mac.mm
+++ b/src/quicknativestyle/qstyle/mac/qquickmacstyle_mac.mm
@@ -4173,16 +4173,31 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt) const
// // all the hassle.
// } else
//#endif
- if (combo->editable)
- rect = LargeSmallMini(opt,
- opt->rect.adjusted(5, 6, -6, -7),
- opt->rect.adjusted(4, 4, -5, -7),
- opt->rect.adjusted(5, 4, -4, -6));
- else
- rect = LargeSmallMini(opt,
- opt->rect.adjusted(6, 4, -7, -7),
- opt->rect.adjusted(6, 7, -6, -5),
- opt->rect.adjusted(9, 5, -5, -7));
+ if (combo->editable) {
+ if (qt_apple_runningWithLiquidGlass()) {
+ rect = LargeSmallMini(opt,
+ opt->rect.adjusted(4, 4, -4, -4),
+ opt->rect.adjusted(4, 4, -5, -7),
+ opt->rect.adjusted(5, 4, -4, -6));
+ } else {
+ rect = LargeSmallMini(opt,
+ opt->rect.adjusted(5, 6, -6, -7),
+ opt->rect.adjusted(4, 4, -5, -7),
+ opt->rect.adjusted(5, 4, -4, -6));
+ }
+ } else {
+ if (qt_apple_runningWithLiquidGlass()) {
+ rect = LargeSmallMini(opt,
+ opt->rect.adjusted(4, 4, -4, -4),
+ opt->rect.adjusted(6, 7, -6, -5),
+ opt->rect.adjusted(9, 5, -5, -7));
+ } else {
+ rect = LargeSmallMini(opt,
+ opt->rect.adjusted(6, 4, -7, -7),
+ opt->rect.adjusted(6, 7, -6, -5),
+ opt->rect.adjusted(9, 5, -5, -7));
+ }
+ }
}
break;
case SE_LabelLayoutItem:
@@ -5252,7 +5267,10 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
QRectF editRect;
switch (cs) {
case QStyleHelper::SizeLarge:
- editRect = combo->rect.adjusted(15, 7, -25, -9);
+ if (qt_apple_runningWithLiquidGlass())
+ editRect = combo->rect.adjusted(15, 7, -25, -7);
+ else
+ editRect = combo->rect.adjusted(15, 7, -25, -9);
break;
case QStyleHelper::SizeSmall:
if (combo->editable)