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>
This commit is contained in:
parent
fa8dbbff88
commit
9f6ea9613e
@ -2481,32 +2481,9 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
break;
|
break;
|
||||||
case PM_TitleBarHeight:
|
case PM_TitleBarHeight:
|
||||||
if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
|
// Always use NSTitledWindowMask since we never need any other type of window here
|
||||||
HIThemeWindowDrawInfo wdi;
|
ret = int([NSWindow frameRectForContentRect:NSZeroRect
|
||||||
wdi.version = qt_mac_hitheme_version;
|
styleMask:NSTitledWindowMask].size.height);
|
||||||
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);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case PM_TabBarTabVSpace:
|
case PM_TabBarTabVSpace:
|
||||||
ret = 4;
|
ret = 4;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user