Martchus / syncthingtray

Tray application and Dolphin/Plasma integration for Syncthing
https://martchus.github.io/syncthingtray/
Other
1.68k stars 44 forks source link

Set High Dpi Scale Factor Rounding Policy correctly #97

Closed sledgehammer999 closed 2 years ago

sledgehammer999 commented 3 years ago

Relevant components

Environment and versions

Bug description On Windows tha scaling factor is non integer usually (eg 150%). The default rounding policy of Qt5 is to round which results in bigger UI elements than the rest of the system. I don't know if qt6 has similar API. But the qt6 version seems to display better in my machine. Relevant qt5 documentation:

  1. https://doc.qt.io/qt-5/qguiapplication.html#setHighDpiScaleFactorRoundingPolicy
  2. https://doc.qt.io/qt-5/qt.html#HighDpiScaleFactorRoundingPolicy-enum

Unfortunately I am not familiar with your codebase so I didn't make a PR. This will benefit other OSes too.

Martchus commented 3 years ago

This is likely related to your findings about different icons which you've mentioned in #95 so also read my comment there.

So Qt 6 and Qt 5 have a different rounding policy by default. So far I haven't tried to steamline this because people mentioned that the default behavior of Qt 5 works better for them: https://forum.syncthing.net/t/yet-another-syncthing-tray/8502/79

Because different people have different preferences I don't want to enforce a particular setting from the application-side. Setting QT_SCALE_FACTOR_ROUNDING_POLICY should always be possible (like with any other Qt application). It might be useful to change the default, though. (The place to do it within my codebase would be setupCommonQtApplicationAttributes() in https://github.com/Martchus/qtutilities/blob/master/resources/resources.cpp#L314.)

tomasz1986 commented 2 years ago

I'd just like to add that I've got the exact same problem under Windows 10. The monitor is set to 150% DPI, but the SyncthingTray's GUI seems to be rendered at 200% or similar. You can compare the difference on the screenshot below, especially if you look at the clock font size and the gigantic fonts used by SyncthingTray.

image

Martchus commented 2 years ago

What version (Qt 5 or Qt 6) are you talking about? If it is just the Qt 5 version I'm inclined to say that one should simply use the Qt 6 version then.

tomasz1986 commented 2 years ago

Yeah, it's just the Qt 5 version. I've had a bad experience with the Qt 6 version before (ref https://forum.syncthing.net/t/yet-another-syncthing-tray/8502/141), so I've stuck with the Qt 5 version instead, which has been working with no issues so far. It's just that I bought a new monitor a few days ago, which I now set to 150% DPI (while the previous monitor was set to ~125%).

Martchus commented 2 years ago

When using Windows 10 or later I recommend to switch to the Qt 6 version. Qt 5 is only useful for older Windows versions (where you can still tweak settings manually according to the documentation @sledgehammer999 linked in the issue description).

Martchus commented 2 years ago

I suppose it is ok to close this issue at this point. Syncthing Tray behaves like other Qt applications and can be configured like any other Qt applications. The default of Qt 6 is supposedly already a good one in most situations and that's the recommended Qt version for the Windows build anyways. So I'd refrain from further messing around here.