From ddce56a988e99c855a1b45186a4c1ee5e14732dd Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 15 Jul 2017 17:50:55 +0200 Subject: [PATCH] Qt5 port: make Sandbox module compile with Qt5 --- src/Mod/Sandbox/Gui/Command.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Mod/Sandbox/Gui/Command.cpp b/src/Mod/Sandbox/Gui/Command.cpp index 0148ac2238..c461de6674 100644 --- a/src/Mod/Sandbox/Gui/Command.cpp +++ b/src/Mod/Sandbox/Gui/Command.cpp @@ -1031,13 +1031,22 @@ public: QPaintEngine *paintEngine() const { return 0; } protected: void paintEvent(QPaintEvent *event) { +#if QT_VERSION < 0x050000 HDC hdc = getDC(); +#else + HWND hWnd = (HWND)this->winId(); + HDC hdc = GetDC(hWnd); +#endif SelectObject(hdc, GetSysColorBrush(COLOR_WINDOW)); Rectangle(hdc, 0, 0, width(), height()); RECT rect = {0, 0, width(), height() }; DrawText(hdc, "Hello World!", 12, &rect, DT_SINGLELINE | DT_VCENTER | DT_CENTER); +#if QT_VERSION < 0x050000 releaseDC(hdc); +#else + ReleaseDC(hWnd, hdc); +#endif } }; #endif