Windows style: use correct value for title bar height
The title bar height = caption bar height + resize border thickness. This calculation is used by many open source repositories for quite a long time, including Microsoft's own famous products such as Windows Terminal. And if you use AdjustWindowRectEx() to get the title bar height, the result is also exactly the same, so this should be the correct calculation. Normally, when DPI is 96, it should be 23 + (4 + 4) = 31px. Change-Id: I0a2de3b55d5b62327eacc7e2ff5dc23771b8efdb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 47ee4eae6ad361e9d3a1df4415562ff092de6644) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
b5d66b52df
commit
06d434ef28
@ -265,11 +265,8 @@ int QWindowsVistaStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, c
|
||||
: QWindowsThemeData::themeSize(widget, nullptr, QWindowsVistaStylePrivate::ProgressTheme, PP_CHUNKVERT).height();
|
||||
case QStyle::PM_SliderThickness:
|
||||
return QWindowsThemeData::themeSize(widget, nullptr, QWindowsVistaStylePrivate::TrackBarTheme, TKP_THUMB).height();
|
||||
case QStyle::PM_TitleBarHeight: {
|
||||
return widget && (widget->windowType() == Qt::Tool)
|
||||
? GetSystemMetrics(SM_CYSMCAPTION) + GetSystemMetrics(SM_CXSIZEFRAME)
|
||||
: GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CXSIZEFRAME);
|
||||
}
|
||||
case QStyle::PM_TitleBarHeight:
|
||||
return QWindowsStylePrivate::pixelMetricFromSystemDp(QStyle::PM_TitleBarHeight, option, widget);
|
||||
case QStyle::PM_MdiSubWindowFrameWidth:
|
||||
return QWindowsThemeData::themeSize(widget, nullptr, QWindowsVistaStylePrivate::WindowTheme, WP_FRAMELEFT, FS_ACTIVE).width();
|
||||
case QStyle::PM_DockWidgetFrameWidth:
|
||||
|
@ -265,12 +265,13 @@ int QWindowsStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, const
|
||||
case QStyle::PM_DockWidgetFrameWidth:
|
||||
return GetSystemMetrics(SM_CXFRAME);
|
||||
|
||||
case QStyle::PM_TitleBarHeight:
|
||||
if (widget && (widget->windowType() == Qt::Tool)) {
|
||||
// MS always use one less than they say
|
||||
return GetSystemMetrics(SM_CYSMCAPTION) - 1;
|
||||
}
|
||||
return GetSystemMetrics(SM_CYCAPTION) - 1;
|
||||
case QStyle::PM_TitleBarHeight: {
|
||||
const int resizeBorderThickness =
|
||||
GetSystemMetrics(SM_CXSIZEFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER);
|
||||
if (widget && (widget->windowType() == Qt::Tool))
|
||||
return GetSystemMetrics(SM_CYSMCAPTION) + resizeBorderThickness;
|
||||
return GetSystemMetrics(SM_CYCAPTION) + resizeBorderThickness;
|
||||
}
|
||||
|
||||
case QStyle::PM_ScrollBarExtent:
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user