Qt World Summit: Register Today!

[Solved] Are QWindowsStyles gone in Qt 5?

  • QWindowsStyle, QWindowsXPStyle and QWindowsVistaStyle are gone in the help for Qt Creator 2.61 and Qt 5, but I still see them at http://qt-project.org/doc/qt-5.0/qtwidgets/gallery.html. The include files have been moved to a private subdirectory, which isn't a good sign, and I get many unresolved links if I try to use these classes. I also see this posting http://www.mail-archive.com/development@qt-project.org/msg07983.html which says these classes "pollute the public API." I'm using windowsmodernstyle.cpp from http://www.mimec.org/articles/qt/wmstyle which needs these classes. Any easy way to get them back?

  • The styles are still there but the headers have moved to private API. But fear not, any code that access them directly just need to be slightly modified in Qt5. Instead of inheriting directly from QWindowsVistaStyle, you need to inherit from QProxyStyle instead. (and if required use QStyleFactory to explicitly create an instance of "vista" style.

  • I think Qt5 is more best and easy that Qt4. You can create a qss file with a similar style to Windows vista or other style personalized by you and use it for all platforms if you use new "fusion" style. I think it's much more best than Qt4 styles. You have a Example in qt5 directory in examples/widgets/widgets/stylesheet.

  • Thanks. I was able to rework things to use QProxyStyle with either Qt4 or Qt5.

Log in to reply