Use Qt6 on Windows by default
There are no real reasons to stick with Qt5 (which EOL is May 2024) on Windows.
Notes:
- By default, Qt6 applications on Windows use the
windowsvista
style which ignores dark mode settings. If I launch Qt application with-style fusion
, application is dark:
We need to change our icons color during runtime to support different color schemes properly. Also Qt 6.7 added a support for a new windows11
style, which is used by default on Windows 11 and supports dark mode out of box. But the simplest way for now is to always use the fusion
style on Windows:
QApplication app(argc, argv);
app.setStyle(QStyleFactory::create("Fusion"));
It will work even with Qt5, just without dark mode support. With Qt 6.7 we can use a QOperatingSystemVersion::current()
check to detect if we run under Windows 11 and use the windows11
style instead.
- When launching the editor, I got such warning during startup:
qt.qpa.window: SetProcessDpiAwarenessContext() failed: The operation completed successfully.
Qt's default DPI awareness context is DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2.
If you know what you are doing, you can overwrite this default using qt.conf (https://doc.qt.io/qt-6/highdpi.html#configuring-windows).
If I understood correctly, it is because Qt6 is DPI-aware by default and something in our code tries to enable DPI awareness again and fails for some reason. A current solution is to enable DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 via manifest file.