Can I run a Qt application with a specific theme? I would like the application to use an OS theme that is different than the current OS theme.
Yes. In main()
before you create your instance of QApplication, you can call QApplication::setStyle("plastique")
for example. Some of the other style strings would be: "windows", "motif", "cde", "plastique" and "cleanlooks" and depending on the platform, "windowsxp", "windowsvista" and "macintosh".
Calling the other overloaded version of this function would work too such as QApplication::setStyle(new QWindowsXPStyle)
.
It could also be specified on the command line when launching the application using the -style switch:
./myapplication -style motif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With