Qt 6.11 is out! See what's new in the release
blog
Custom colors from style sheet
General and Desktop
2
Posts
2
Posters
937
Views
1
Watching
-
just define styleable properties in your QWidget class and use the properties for painting:
@
class MyGraphWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY( QColor CurveColor READ ... WRITE ... DESIGNABLE true );public:
MyGraphWIdget();//getter and setter for properties@
and in the stylesheet you can simply do this then:
@
MyGraphWidget
{
qproperty-CurveColor: #00FF00;
/* or */
qproperty-CurveColor: red;
}
@