PDA

View Full Version : Making qstyleplugins work with QT application



padma
22nd February 2017, 23:37
Hi,

I want to use the 'Plastique' style in my QT5 application. I have downloaded the QStylePlugins zip and ran qmake on it.
How do I load this into my application and do :
app.setStyle(QStyleFactory::create("Plastique")); ?

Thanks,
Padma

anda_skoa
23rd February 2017, 08:39
You can also

* call the setStyle() overload that takes a string, i.e. the style's name.
* build the style as part of the qapplication (if the license combinaton allows that) and directly instantiate the style class

Cheers,
_

padma
23rd February 2017, 17:56
I included the qt_plugin_qplastiquestyle.pri in my app's .pro file.
Now I called "plastique" in a.setStyle.
I dont see the changes appearing in the application. Will I need to include the headers and .cpp as well in the .pro file for it to work?

anda_skoa
24th February 2017, 10:00
Depends on how you want to use it.

If you load it by name (first option) you need to ensure that the plugin can be found, it you compile it as a class you can instantiate it (second option).

Cheers,
_