@ericg22
You can simply set properties of widgets via QSS. Most basic types are parsed. Even enums can be used by name when registered to the meta system.
class MyWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY( QColor CustomColor READ ... WRITE ... DESIGNABLE true )
Q_RPOPERTY( QFont CustomFont READ ... WRITE ... DESIGNABLE true )
Q_PROPERTY( QString CustomString READ ... WRITE ... DESIGNABLE true )
Q_PROPERTY( int CustomInteger READ ... WRITE ... DESIGNABLE true )
Q_PROPERTY( QIcon CustomIcon READ ... WRITE ... DESIGNABLE true )
Q_PROPERTY( MyEnum CustomEnum READ ... WRITE ... DESIGNABLE true )
Q_ENUMS( MyEnum )
...
enum MyEnum {
MyEnumValue1,
MyEnumValue2
}
}
example qss to set properties:
MyWidget {
qpropert-CustomColor: rgba(...); //also rgb(), hsv(), rgba(), named-colors, #XXXXXX, etc. are possible9
qproperty-CustomFont: "serif,-1,14,5,0,0,0,0,0,0"; // see QFont::fromString(): Font-Family, pointSizeF, pixelSize, QFont::StyleHint, QFont::Weight, QFont::STyle, underline, strikeout, fixedPitch, rawMode
qproperty-CustomFont: "Times New Roman,12"; //should also be possible
qproperty-CustomString: "Any string...";
qproperty-CustomInt: 8253;
qproperty-CustomIcon: url(:/path/to/qrc/resource/icon.png);
qproperty-CustomEnum: MyEnumValue2;
}