Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I run a Qt application with a specific theme?

Tags:

qt

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.

like image 227
yan bellavance Avatar asked Jul 18 '11 22:07

yan bellavance


1 Answers

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
like image 157
Arnold Spence Avatar answered Sep 19 '22 09:09

Arnold Spence