diff options
| author | Igor Khanin <igor@khanin.biz> | 2025-09-24 22:08:37 +0300 |
|---|---|---|
| committer | Igor Khanin <igor@khanin.biz> | 2025-09-26 04:40:01 +0300 |
| commit | 4caaa435ca1ee94e7042b8ae6f7023035b977c5c (patch) | |
| tree | 5f56218349222ced6e96581f7412d7cc173ff114 | |
| parent | 64db5aeb6aa105c9000e04c1e0bbf90cc351e44a (diff) | |
QMacStyle: Draw disclosure triangles according to correct direction
When using a QTreeView and overriding its' (or any ancestor widget's)
layout direction from the default, on the Mac style the indicator
branches would be rendered pointing the wrong way - as those are drawn
as native disclosure triangle buttons whose NSCell did not get the
proper layout direction passed on to. This fixes it.
Pick-to: 6.10 6.9 6.8
Change-Id: Ic708e82dd2534af674822fa2432ce4a4af22c522
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| -rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac.mm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 46f195fcd6c..de8ebbeebf5 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -769,6 +769,18 @@ static bool qt_macWindowMainWindow(const QWidget *window) return false; } +static NSUserInterfaceLayoutDirection qt_macLayoutDirectionFromQt(Qt::LayoutDirection direction) +{ + switch (direction) { + case Qt::LeftToRight: + return NSUserInterfaceLayoutDirectionLeftToRight; + case Qt::RightToLeft: + return NSUserInterfaceLayoutDirectionRightToLeft; + case Qt::LayoutDirectionAuto: + return [NSApp userInterfaceLayoutDirection]; + } +} + /***************************************************************************** QMacCGStyle globals *****************************************************************************/ @@ -3510,6 +3522,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai [triangleCell setState:(opt->state & State_Open) ? NSControlStateValueOn : NSControlStateValueOff]; bool viewHasFocus = (w && w->hasFocus()) || (opt->state & State_HasFocus); [triangleCell setBackgroundStyle:((opt->state & State_Selected) && viewHasFocus) ? NSBackgroundStyleEmphasized : NSBackgroundStyleNormal]; + [triangleCell setUserInterfaceLayoutDirection:qt_macLayoutDirectionFromQt(opt->direction)]; d->setupNSGraphicsContext(cg, NO); |
