diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2010-02-02 10:46:54 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2010-02-02 10:54:06 (GMT) |
commit | e4835d58381cd33fe067b05bfd6301d2246e3e67 (patch) | |
tree | 2246e958561e4611d3bf8ba571d06f3c4a5d69df /src/gui/styles | |
parent | 087d79578bf3e0c8cc6e53b5babb2e935a4b9c91 (diff) | |
download | Qt-e4835d58381cd33fe067b05bfd6301d2246e3e67.zip Qt-e4835d58381cd33fe067b05bfd6301d2246e3e67.tar.gz Qt-e4835d58381cd33fe067b05bfd6301d2246e3e67.tar.bz2 |
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
Diffstat (limited to 'src/gui/styles')
-rw-r--r-- | src/gui/styles/qmacstyle_mac.mm | 19 |
1 files 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<QMainWindow *>(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<const QToolBar *>(widget->parentWidget())) { - sz.rwidth() += 4; - if (sz.height() <= 32) { - // Workaround strange HIToolBar bug when getting constraints. - sz.rheight() += 1; + 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; + } } - return sz; } sz.rwidth() += 10; sz.rheight() += 10; |