fixed scaling for 1.5+ scale on windows

This commit is contained in:
fourtf
2018-06-24 23:58:29 +02:00
parent 4075ac9279
commit ba5c3555b8
2 changed files with 16 additions and 11 deletions
+15 -9
View File
@@ -144,12 +144,12 @@ void BaseWindow::init()
layout->addWidget(this->ui_.layoutBase);
}
// DPI
auto dpi = util::getWindowDpi(this->winId());
// DPI
// auto dpi = util::getWindowDpi(this->winId());
if (dpi) {
this->scale = dpi.value() / 96.f;
}
// if (dpi) {
// this->scale = dpi.value() / 96.f;
// }
#endif
#ifdef USEWINSDK
@@ -418,10 +418,16 @@ bool BaseWindow::nativeEvent(const QByteArray &eventType, void *message, long *r
float _scale = dpi / 96.f;
auto *prcNewWindow = reinterpret_cast<RECT *>(msg->lParam);
SetWindowPos(msg->hwnd, nullptr, prcNewWindow->left, prcNewWindow->top,
prcNewWindow->right - prcNewWindow->left,
prcNewWindow->bottom - prcNewWindow->top, SWP_NOZORDER | SWP_NOACTIVATE);
static bool firstResize = true;
if (!firstResize) {
auto *prcNewWindow = reinterpret_cast<RECT *>(msg->lParam);
SetWindowPos(msg->hwnd, nullptr, prcNewWindow->left, prcNewWindow->top,
prcNewWindow->right - prcNewWindow->left,
prcNewWindow->bottom - prcNewWindow->top,
SWP_NOZORDER | SWP_NOACTIVATE);
}
firstResize = false;
this->nativeScale_ = _scale;
this->updateScale();