From 12ae86119cf389dab368bbc8a9d49b29b0b155cd Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 29 May 2013 17:42:30 +0200 Subject: Mac style: Remove yet another reference to widgets Change-Id: I545cfe22c6307864cdb18093a37e09a8ad042347 Reviewed-by: J-P Nurmi Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qmacstyle_mac.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index b7f39d45dd..a8fba4fb68 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -3366,7 +3366,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter if (const QStyleOptionToolButton *tb = qstyleoption_cast(opt)) { QStyleOptionToolButton myTb = *tb; myTb.state &= ~State_AutoRaise; - if (w && qobject_cast(w->parentWidget())) { + if (QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) { QRect cr = tb->rect; int shiftX = 0; int shiftY = 0; @@ -3405,7 +3405,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter if (tb->toolButtonStyle != Qt::ToolButtonIconOnly) { needText = true; if (tb->toolButtonStyle == Qt::ToolButtonTextUnderIcon) { - QMainWindow *mw = qobject_cast(w->window()); + QMainWindow *mw = w ? qobject_cast(w->window()) : 0; if (mw && mw->unifiedTitleAndToolBarOnMac()) { pr.setHeight(pixmap.size().height() / pixmap.devicePixelRatio()); cr.adjust(0, pr.bottom() + 1, 0, 1); -- cgit v1.2.3