Can I use Qt stylesheets with a derived widget? I'd like to be able to define some custom properties on the widget (like various colors) and be able to define their value in a stylesheet.
Is this possible?
Can I use Qt stylesheets with a derived widget? I'd like to be able to define some custom properties on the widget (like various colors) and be able to define their value in a stylesheet.
Is this possible?
Sure, just declare your properties with Q_PROPERTY.
class MyClass : public QObject
{
Q_OBJECT
Q_PROPERTY( int fun READ getFun WRITE setFun )
public:
MyClass( QObject * parent=0, const char * name=0 );
~MyClass();
void setFun( int x );
int getFun() const;
};