Mac: remove unified toolbar workarounds.

QMainWindow::unifiedTitleAndToolBarOnMac() will
again return true, but the new implementation is
much more similar to the cross platform one so these
workarounds are not needed.

Task-number: QTBUG-34411
Change-Id: Ic95f491af94354776385dc984f1a00c64429a3f0
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Morten Johan Sørvig 2013-12-16 23:06:35 +01:00 committed by The Qt Project
parent b3d642e71e
commit 4a7f27ea53

View File

@ -2437,11 +2437,6 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
break;
case PM_ToolBarFrameWidth:
ret = 1;
if (widget) {
if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(widget->parent()))
if (mainWindow->unifiedTitleAndToolBarOnMac())
ret = 0;
}
break;
case PM_ScrollView_ScrollBarOverlap:
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
@ -3445,14 +3440,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (tb->toolButtonStyle != Qt::ToolButtonIconOnly) {
needText = true;
if (tb->toolButtonStyle == Qt::ToolButtonTextUnderIcon) {
QMainWindow *mw = w ? qobject_cast<QMainWindow *>(w->window()) : 0;
if (mw && mw->unifiedTitleAndToolBarOnMac()) {
pr.setHeight(pixmap.size().height() / pixmap.devicePixelRatio());
cr.adjust(0, pr.bottom() + 1, 0, 1);
} else {
pr.setHeight(pixmap.size().height() / pixmap.devicePixelRatio() + 6);
cr.adjust(0, pr.bottom(), 0, -3);
}
pr.setHeight(pixmap.size().height() / pixmap.devicePixelRatio() + 6);
cr.adjust(0, pr.bottom(), 0, -3);
alignment |= Qt::AlignCenter;
} else {
pr.setWidth(pixmap.width() / pixmap.devicePixelRatio() + 8);
@ -6271,18 +6260,6 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
}
break;
case CT_ToolButton:
if (widget && qobject_cast<const QToolBar *>(widget->parentWidget())) {
if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(widget->parent())) {
if (mainWindow->unifiedTitleAndToolBarOnMac()) {
sz.rwidth() += 4;
if (sz.height() <= 32) {
// Workaround strange HIToolBar bug when getting constraints.
sz.rheight() += 1;
}
return sz;
}
}
}
sz.rwidth() += 10;
sz.rheight() += 10;
return sz;