Fix a regression.

If the user set a custom title bar height, just return
the original value, don't plus the border height afterwards,
this is not what the user would want.

But if we are querying the standard value, it should be
border height + caption height.

Border width and border height don't have this issue.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2020-11-16 17:15:06 +08:00
parent 9cb3392ce4
commit 8ca84fd435
1 changed files with 3 additions and 1 deletions

View File

@ -2219,7 +2219,9 @@ int WinNativeEventFilter::getSystemMetric(void *handle,
case SystemMetric::TitleBarHeight: {
const int tbh = userData->titleBarHeight;
if (tbh > 0) {
ret = qRound(tbh * dpr);
// Special case: this is the user defined value,
// don't change it and just return it untouched.
return qRound(tbh * dpr);
} else {
const int result_nondpi = GetSystemMetricsForWindow(hwnd, SM_CYCAPTION);
const int result_dpi = GetSystemMetricsForWindow(hwnd, SM_CYCAPTION, true);