Mac Style: Don't crash when rendering PE_IndicatorBranch without widget

Change-Id: I45784af3738807ab6753b67a5b103a65d4e28084
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
This commit is contained in:
Gabriel de Dietrich 2014-05-28 09:09:57 +02:00 committed by The Qt Project
parent d24536bbd5
commit 4a6df5ec95

View File

@ -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];