diff options
author | Jake Petroules <jake.petroules@theqtcompany.com> | 2015-09-07 00:21:45 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@theqtcompany.com> | 2015-10-09 13:42:25 +0000 |
commit | 9f6ea9613e3379a31f706ae96943e65d1b79839e (patch) | |
tree | 701850a4f896a01d516b1dc8a80221e1ca7df404 /src/widgets/styles | |
parent | fa8dbbff8895e7e1fdf1e6b0a9f3d821cd2caf2f (diff) |
QMacStyle: Simplify PM_TitleBarHeight calculation.
Since at least OS X 10.5, this returns 22.
Change-Id: Id7d9476528a66c540badce218839383285f58acd
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 3bf7d63f89..711a30e1fc 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -2481,32 +2481,9 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW ret = 0; break; case PM_TitleBarHeight: - if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) { - HIThemeWindowDrawInfo wdi; - wdi.version = qt_mac_hitheme_version; - wdi.state = kThemeStateActive; - wdi.windowType = QtWinType; - if (tb->titleBarState) - wdi.attributes = kThemeWindowHasFullZoom | kThemeWindowHasCloseBox - | kThemeWindowHasCollapseBox; - else if (tb->titleBarFlags & Qt::WindowSystemMenuHint) - wdi.attributes = kThemeWindowHasCloseBox; - else - wdi.attributes = 0; - wdi.titleHeight = tb->rect.height(); - wdi.titleWidth = tb->rect.width(); - QCFType<HIShapeRef> region; - HIRect hirect = qt_hirectForQRect(tb->rect); - if (hirect.size.width <= 0) - hirect.size.width = 100; - if (hirect.size.height <= 0) - hirect.size.height = 30; - - HIThemeGetWindowShape(&hirect, &wdi, kWindowTitleBarRgn, ®ion); - HIRect rect; - ptrHIShapeGetBounds(region, &rect); - ret = int(rect.size.height); - } + // Always use NSTitledWindowMask since we never need any other type of window here + ret = int([NSWindow frameRectForContentRect:NSZeroRect + styleMask:NSTitledWindowMask].size.height); break; case PM_TabBarTabVSpace: ret = 4; |