Hey trolltechers,
Is it possible to subclass QPalette and create customs QPalette colors?
Thanks.
Printable View
Hey trolltechers,
Is it possible to subclass QPalette and create customs QPalette colors?
Thanks.
You don't have to subclass anything. Just use QPalette::setColor() (or similar) to set colours for different uses. Subclassing QPalette wouldn't make much sense - it doesn't contain any virtual methods.
I cannot create new "QPalette::ColorRole" then.
You don't create colour roles, you assign colours to them.
Creating new colour roles wouldn't make much sense as Qt widgets wouldn't use them anyway. If you want custom roles for your widgets only, you can subclass QPalette or use a separate object for storing them, only remember you'll have to take care of properly initializing and handling the "palette" at every step.