diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2014-05-28 09:09:57 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-06-05 08:50:59 +0200 |
commit | 4a6df5ec953018513b5b2c6724ba79b928d9260d (patch) | |
tree | bcaaeb01a28400e9937537257dc9ccbb8836ab3f /src/widgets/styles/qmacstyle_mac.mm | |
parent | d24536bbd55eca001a4933d88450edb193b0e272 (diff) |
Mac Style: Don't crash when rendering PE_IndicatorBranch without widget
Change-Id: I45784af3738807ab6753b67a5b103a65d4e28084
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Diffstat (limited to 'src/widgets/styles/qmacstyle_mac.mm')
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 36c7fbd0a0..da6422ffec 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -3148,7 +3148,8 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai [triangleCell setButtonType:NSOnOffButton]; [triangleCell setState:(opt->state & State_Open) ? NSOnState : NSOffState]; [triangleCell setBezelStyle:NSDisclosureBezelStyle]; - [triangleCell setBackgroundStyle:((opt->state & State_Selected) && w->hasFocus()) ? NSBackgroundStyleDark : NSBackgroundStyleLight]; + bool viewHasFocus = (w && w->hasFocus()) || (opt->state & State_HasFocus); + [triangleCell setBackgroundStyle:((opt->state & State_Selected) && viewHasFocus) ? NSBackgroundStyleDark : NSBackgroundStyleLight]; CGContextSaveGState(cg); [NSGraphicsContext saveGraphicsState]; |