summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-01-16 17:22:40 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-17 22:04:38 +0100
commitcf179ef3e38516555ce60517aa8e085b33e75744 (patch)
tree2d8250413a220831992bd927f5c662e3417e1a22 /src/gui/dialogs
parent31015df188e0a88317205b212f317302a235cb9b (diff)
QWizard: Fix frame when using Vista style/MSVC2012
Work around GetSystemMetrics() returning the wrong value using MSVC2012 and later. The special handling of Windows 8 and later is then no longer required. [ChangeLog][QtWidgets][QWizard] Fixed frame when using Vista style/MSVC2012. Task-number: QTBUG-36192 Change-Id: I39c2ab70a266f12cd65fa740b10b86edffa60417 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> (cherry picked from qtbase/852308114ff901b86cca99268f498fc1d56b622e)
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r--src/gui/dialogs/qwizard_win.cpp36
-rw-r--r--src/gui/dialogs/qwizard_win_p.h4
2 files changed, 32 insertions, 8 deletions
diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp
index 9cd62927bb..a87982449e 100644
--- a/src/gui/dialogs/qwizard_win.cpp
+++ b/src/gui/dialogs/qwizard_win.cpp
@@ -409,12 +409,12 @@ bool QVistaHelper::winEvent(MSG* msg, long* result)
break;
}
case WM_NCCALCSIZE:
- if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8 && vistaState() == VistaAero) {
+ if (vistaState() == VistaAero) {
NCCALCSIZE_PARAMS* lpncsp = (NCCALCSIZE_PARAMS*)msg->lParam;
*result = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
lpncsp->rgrc[0].top -= titleBarSize();
} else {
- return false; // Negative margins no longer work on Windows 8.
+ return false;
}
break;
default:
@@ -737,6 +737,33 @@ bool QVistaHelper::drawBlackRect(const QRect &rect, HDC hdc)
return value;
}
+#if !defined(_MSC_VER) || _MSC_VER < 1700
+static inline int getWindowBottomMargin()
+{
+ return GetSystemMetrics(SM_CYSIZEFRAME);
+}
+#else // !_MSC_VER || _MSC_VER < 1700
+// QTBUG-36192, GetSystemMetrics(SM_CYSIZEFRAME) returns bogus values
+// for MSVC2012 which leads to the custom margin having no effect since
+// that only works when removing the entire margin.
+static inline int getWindowBottomMargin()
+{
+ RECT rect = {0, 0, 0, 0};
+ AdjustWindowRectEx(&rect, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_THICKFRAME | WS_DLGFRAME, FALSE, 0);
+ return qAbs(rect.bottom);
+}
+#endif // _MSC_VER >= 1700
+
+int QVistaHelper::frameSize()
+{
+ return getWindowBottomMargin();
+}
+
+int QVistaHelper::captionSize()
+{
+ return GetSystemMetrics(SM_CYCAPTION);
+}
+
bool QVistaHelper::resolveSymbols()
{
static bool tried = false;
@@ -795,10 +822,7 @@ int QVistaHelper::topOffset()
static const int aeroOffset =
QSysInfo::WindowsVersion == QSysInfo::WV_WINDOWS7 ?
QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13);
- int result = aeroOffset;
- if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8)
- result += titleBarSize();
- return result;
+ return aeroOffset + titleBarSize();
}
QT_END_NAMESPACE
diff --git a/src/gui/dialogs/qwizard_win_p.h b/src/gui/dialogs/qwizard_win_p.h
index ceb3bf4f8d..8d8ddb057d 100644
--- a/src/gui/dialogs/qwizard_win_p.h
+++ b/src/gui/dialogs/qwizard_win_p.h
@@ -112,8 +112,8 @@ private:
bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);
static bool drawBlackRect(const QRect &rect, HDC hdc);
- static int frameSize() { return GetSystemMetrics(SM_CYSIZEFRAME); }
- static int captionSize() { return GetSystemMetrics(SM_CYCAPTION); }
+ static int frameSize();
+ static int captionSize();
static int backButtonSize() { return int(QStyleHelper::dpiScaled(30)); }
static int iconSize() { return 16; } // Standard Aero