From 41d6398c457dd3e1e8574cc831c4a4f028a24fdc Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Fri, 12 Oct 2018 20:28:45 +0200 Subject: [PATCH] Small improvement to scale_widget() function. --- src/GUI.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GUI.cpp b/src/GUI.cpp index c12c210..c7af9da 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -185,16 +185,16 @@ double MUtils::GUI::dpi_scale(void) { if (const QApplication *const app = dynamic_cast(QCoreApplication::instance())) { - const double dpiX = static_cast(app->desktop()->logicalDpiX()); - const double dpiY = static_cast(app->desktop()->logicalDpiY()); - return qBound(1.0, ((dpiX + dpiY) / 192.0), 2.0); + const double dpi_x = static_cast(app->desktop()->logicalDpiX()); + const double dpi_y = static_cast(app->desktop()->logicalDpiY()); + return qBound(1.0, ((dpi_x + dpi_y) / 192.0), 2.0); } return -1.0; } bool MUtils::GUI::scale_widget(QWidget *const widget, const bool recenter) { - if (widget && (!widget->parentWidget())) + if (widget && (widget->windowFlags().testFlag(Qt::WindowType::Window))) { const double dpiScale = dpi_scale(); if ((dpiScale > 0.0) && (!qFuzzyCompare(dpiScale, 1.0)))