Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt 5.14.0 QApplication::setStyle(..) broken?
today I installed the new Qt 5.14.0 final release on Windows 10 64 bit desktop.
But QApplication::setStyle() doesn't respond to "windowsxp" and "windowsvista" styles anymore. Only "windows" (old Windows98 style) and "fusion" styles do work.
No matter which version of setStyle() is used:
QApplication a(argc, argv); a.setStyle(QStyleFactory::create("windowsvista"));
QApplication a(argc, argv); a.setStyle("windowsvista");
setStyle() works fine in Qt 5.13.2 and before. Is that a bug in Qt 5.14.0? Or did Qt 5.14.0 changed the way setStyle() has to be used?
They both were removed afaik.
Where can I find the removal of the Windows styles "windowsxp" and "windowsvista" in the Qt 5.14 documentation?
Qt 5.14 Online documentation and Qt 5.14 Assistant says:
"The string must be one of the QStyleFactory::keys(), typically one of "windows", "windowsvista", "fusion", or "macintosh". Style names are case insensitive."
Ah, it was the xp style which is the same as the Vista style. Take a look into your plugins/style Folder to see if there is a Vista style available.
I do program Windows desktop applications since Qt v5.3 and never payed attention to the Qt plugins/styles directory. My applications showed up in modern Windows Vista style without coping Vista style DLLs to my applications folder.
But I tried that also now and copied the Vista style DLL into my build directory like the Qt 5.14 documentation says but with no luck:
Is there another way to enable the modern Windows 10 style with Qt 5.14?
It seams to be a bug:
If I copy the DLL right next to my application exe file
This is wrong for sure and can't work. If you want to deploy our Application, use windeployqt.
After further testing I found the cause for this issue:
If you place Qt 5.14 dlls (like Qt5Core.dll, Qt5Gui.dll etc.) inside the application build directory (like build/Debug or build/Release) then the application shows up in old Windows 95 style and not in the modern Windows 10 (Vista) style. In this case you even not able to force the application to run in Vista style if you use QApplication::setStyle("windowsvista") in its main.cpp file.
In all Qt 5.13.2 and prior Qt versions this did not happen: An applications shows up in modern Vista style even if Qt Dlls are placed inside its build directory.
I suppose this can't be called a bug so this report might be closed. But it's not ideal for application testing during application developement how Qt 5.14 changed its behaviour in this case.
Placing some Qt dlls in the debug/release folder is not needed at all when you set up your Qt paths correctly. When you do this then Qt expects that there are also all plugin folders available in this directy which is not in your case.
mireiner last edited by
Thank you Christian Ehrlicher for clearing my confusion and helping me to understand this case.