Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Custom colors from style sheet
Tabula last edited by
I was wondering how or if I could get colors for custom items from a style sheet.
For example I have a graph widget with 5 curves and I want the color of each curve to be customizable via the style sheet of the application.
just define styleable properties in your QWidget class and use the properties for painting:
class MyGraphWidget : public QWidget
Q_PROPERTY( QColor CurveColor READ ... WRITE ... DESIGNABLE true );
//getter and setter for properties
and in the stylesheet you can simply do this then:
/* or */