Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-99546

QT_SCREEN_SCALE_FACTORS doesn't follow rounding policy

    XMLWordPrintable

Details

    • 1c0a56a2f3 (qt/qtbase/dev) 1c0a56a2f3 (qt/tqtc-qtbase/dev) be3f589d17 (qt/qtbase/6.4) be3f589d17 (qt/tqtc-qtbase/6.4), 9a39b3c79 (dev)

    Description

      QT_SCREEN_SCALE_FACTORS doesn't seem to follow rounding policy, is this on a reason? This variable is used by KDE to set per-screen scale factor, so if an app can't handle fractional scale factors, it will look really ugly in such environment.

      The fix is as simple as

      diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
      index 996eed40cb..1b9a7929bf 100644
      --- a/src/gui/kernel/qhighdpiscaling.cpp
      +++ b/src/gui/kernel/qhighdpiscaling.cpp
      @@ -632,13 +632,13 @@ qreal QHighDpiScaling::screenSubfactor(const QPlatformScreen *screen)
               if (auto qScreen = screen->screen()) {
                   auto screenFactor = qScreen->property(scaleFactorProperty).toReal(&screenPropertyUsed);
                   if (screenPropertyUsed)
      -                factor = screenFactor;
      +                factor = roundScaleFactor(screenFactor);
               }
       
               if (!screenPropertyUsed) {
                   auto byNameIt = QHighDpiScaling::m_namedScreenScaleFactors.constFind(screen->name());
                   if ((screenPropertyUsed = byNameIt != QHighDpiScaling::m_namedScreenScaleFactors.cend()))
      -                factor = *byNameIt;
      +                factor = roundScaleFactor(*byNameIt);
               }
           }
       
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              sorvig Morten Sørvig
              ilya-fedin Ilya Fedin
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes