syncthingtray icon indicating copy to clipboard operation
syncthingtray copied to clipboard

Set High Dpi Scale Factor Rounding Policy correctly

Open sledgehammer999 opened this issue 3 years ago • 5 comments

Relevant components

  • [ ] Standalone tray application (based on Qt Widgets)

Environment and versions

  • Versions of syncthingtray 1.1.7
  • Qt version: 5.15.2
  • Operating system (name and version): windows 7 sp1 64bit

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.

sledgehammer999 avatar Jun 27 '21 22:06 sledgehammer999

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.)

Martchus avatar Jun 28 '21 09:06 Martchus

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

tomasz1986 avatar Apr 10 '22 21:04 tomasz1986

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.

Martchus avatar Apr 10 '22 21:04 Martchus

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%).

tomasz1986 avatar Apr 10 '22 22:04 tomasz1986

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 avatar Apr 11 '22 09:04 Martchus

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.

Martchus avatar Aug 13 '22 16:08 Martchus