Fixes #491, font size in notebooktab too big

This commit is contained in:
fourtf 2018-06-24 17:33:55 +02:00
parent 68ddd1e7c9
commit 22167f33f2
2 changed files with 7 additions and 6 deletions

View file

@ -33,9 +33,10 @@ void installCustomPalette();
int main(int argc, char *argv[])
{
// QApplication::setAttribute(Qt::AA_Use96Dpi, false);
QApplication::setAttribute(Qt::AA_Use96Dpi, true);
#ifdef Q_OS_WIN32
// QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
#endif
// QApplication::setAttribute(Qt::AA_UseSoftwareOpenGL, true);
QApplication a(argc, argv);

View file

@ -415,12 +415,12 @@ bool BaseWindow::nativeEvent(const QByteArray &eventType, void *message, long *r
case WM_DPICHANGED: {
int dpi = HIWORD(msg->wParam);
float oldScale = this->scale;
float _scale = dpi / 96.f;
float resizeScale = _scale / oldScale;
this->resize(static_cast<int>(this->width() * resizeScale),
static_cast<int>(this->height() * resizeScale));
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);
this->nativeScale_ = _scale;
this->updateScale();