Remove QMacStyle titlebar height + 4 adjustment and consequences
This was a tweak to fix a bug in 2005 which has probably outlived its usefulness, plus an accumulation of workarounds on top. (started as 48b5266e8ff9b472a16290dd923fe24dd0b6989b in the historical repo) Task-number: QTBUG-34760 Change-Id: I2c01269e43636385ee5c89305c6b90f4a7f2c537 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
parent
52ba7b1ffc
commit
b4bb709733
@ -90,11 +90,6 @@ qreal QGraphicsWidgetPrivate::titleBarHeight(const QStyleOptionTitleBar &options
|
||||
{
|
||||
Q_Q(const QGraphicsWidget);
|
||||
int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options);
|
||||
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
|
||||
if (qobject_cast<QMacStyle*>(q->style())) {
|
||||
height -=4;
|
||||
}
|
||||
#endif
|
||||
return (qreal)height;
|
||||
}
|
||||
|
||||
|
@ -2191,7 +2191,6 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
|
||||
HIRect rect;
|
||||
ptrHIShapeGetBounds(region, &rect);
|
||||
ret = int(rect.size.height);
|
||||
ret += 4;
|
||||
}
|
||||
break;
|
||||
case PM_TabBarTabVSpace:
|
||||
|
@ -455,14 +455,6 @@ int QDockWidgetLayout::titleHeight() const
|
||||
perp(verticalTitleBar, floatSize));
|
||||
|
||||
QFontMetrics titleFontMetrics = q->fontMetrics();
|
||||
#ifdef Q_WS_MAC
|
||||
if (qobject_cast<QMacStyle *>(q->style())) {
|
||||
//### this breaks on proxy styles. (But is this code still called?)
|
||||
QFont font = qt_app_fonts_hash()->value("QToolButton", q->font());
|
||||
titleFontMetrics = QFontMetrics(font);
|
||||
}
|
||||
#endif
|
||||
|
||||
int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q);
|
||||
|
||||
return qMax(buttonHeight + 2, titleFontMetrics.height() + 2*mw);
|
||||
|
@ -354,11 +354,6 @@ void SimpleCascader::rearrange(QList<QWidget *> &widgets, const QRect &domain) c
|
||||
QStyleOptionTitleBar options;
|
||||
options.initFrom(widgets.at(0));
|
||||
int titleBarHeight = widgets.at(0)->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, widgets.at(0));
|
||||
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
|
||||
// ### Remove this after the mac style has been fixed
|
||||
if (qobject_cast<QMacStyle *>(widgets.at(0)->style()))
|
||||
titleBarHeight -= 4;
|
||||
#endif
|
||||
const QFontMetrics fontMetrics = QFontMetrics(QApplication::font("QMdiSubWindowTitleBar"));
|
||||
const int dy = qMax(titleBarHeight - (titleBarHeight - fontMetrics.height()) / 2, 1);
|
||||
|
||||
|
@ -1710,11 +1710,6 @@ int QMdiSubWindowPrivate::titleBarHeight(const QStyleOptionTitleBar &options) co
|
||||
}
|
||||
|
||||
int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, q);
|
||||
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
|
||||
// ### Fix mac style, the +4 pixels hack is not necessary anymore
|
||||
if (qobject_cast<QMacStyle *>(q->style()))
|
||||
height -= 4;
|
||||
#endif
|
||||
if (hasBorder(options))
|
||||
height += q->isMinimized() ? 8 : 4;
|
||||
return height;
|
||||
|
@ -954,9 +954,6 @@ void tst_QMdiSubWindow::mouseDoubleClick()
|
||||
QStyleOptionTitleBar options;
|
||||
options.initFrom(window);
|
||||
int height = window->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options);
|
||||
// ### Remove this after mac style has been fixed
|
||||
if (window->style()->inherits("QMacStyle"))
|
||||
height -= 4;
|
||||
// has border
|
||||
if (!window->style()->styleHint(QStyle::SH_TitleBar_NoBorder, &options, window))
|
||||
height += window->isMinimized() ? 8 : 4;
|
||||
@ -1692,11 +1689,6 @@ void tst_QMdiSubWindow::fixedMinMaxSize()
|
||||
QStyleOptionTitleBar options;
|
||||
options.initFrom(subWindow);
|
||||
int minimizedHeight = subWindow->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options);
|
||||
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
|
||||
// ### Remove this after mac style has been fixed
|
||||
if (subWindow->style()->inherits("QMacStyle"))
|
||||
minimizedHeight -= 4;
|
||||
#endif
|
||||
if (!subWindow->style()->styleHint(QStyle::SH_TitleBar_NoBorder, &options, subWindow))
|
||||
minimizedHeight += 8;
|
||||
int minimizedWidth = subWindow->style()->pixelMetric(QStyle::PM_MDIMinimizedWidth, &options);
|
||||
|
Loading…
Reference in New Issue
Block a user