how to create custom style class on PyQt4 / PyQt5
-
Hi guys,
I'm wondering if there is a way to subclass QPlastiqueStyle on PyQt4 and QFusionStyle on PyQt5?
QProxyStyle is the best choice and is working (but is only available on PyQt5) - so how to subclass and create custom style class on PyQt4?Hope someone can help me here?...
Currently I add Plastique for Qt 4 and Fusion for Qt 5 and apply some custom palette and stylesheets on top.
But would be nicer to add style sheets and palette directly on overloaded polish method of custom style class. -
Hi,
Check the QStyle documentation for the basics of creating a custom style and using it. It's the same for Qt 4.
The linked example also shows a nice example using QProxyStyle which might be a better choice depending on what you want to achieve.
Hope it helps
-
The folks from PyQt also provides the tool to generate python bindings from C++ code. You can write you C++ class and create the bindings for it and use it in your Qt application.