From e4835d58381cd33fe067b05bfd6301d2246e3e67 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 2 Feb 2010 11:46:54 +0100 Subject: Fix missing non-unified toolbar margins on Mac The tool bar appearance have regressed in 4.6 for applications that do not utilize the unified tool bar appearance. This fix restores the margin and spacing to their 4.5 appearance. Task-number: QTBUG-7831 Reviewed-by: morten --- src/gui/styles/qmacstyle_mac.mm | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 7a680f2..c2e5871 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -2411,7 +2411,10 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW ret = 0; break; case PM_ToolBarFrameWidth: - ret = 0; + ret = 1; + if (QMainWindow * mainWindow = qobject_cast(widget->parent())) + if (mainWindow->unifiedTitleAndToolBarOnMac()) + ret = 0; break; default: ret = QWindowsStyle::pixelMetric(metric, opt, widget); @@ -5715,12 +5718,16 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, break; case CT_ToolButton: if (widget && qobject_cast(widget->parentWidget())) { - sz.rwidth() += 4; - if (sz.height() <= 32) { - // Workaround strange HIToolBar bug when getting constraints. - sz.rheight() += 1; + if (QMainWindow * mainWindow = qobject_cast(widget->parent())) { + if (mainWindow->unifiedTitleAndToolBarOnMac()) { + sz.rwidth() += 4; + if (sz.height() <= 32) { + // Workaround strange HIToolBar bug when getting constraints. + sz.rheight() += 1; + } + return sz; + } } - return sz; } sz.rwidth() += 10; sz.rheight() += 10; -- cgit v0.12