Hi,
Is it possible to style QPushButtons separately from a qss stylesheet whether if it has an icon applied or not? Something like:
Code:
background-color: green; } background-color: red; }
Thank you
Printable View
Hi,
Is it possible to style QPushButtons separately from a qss stylesheet whether if it has an icon applied or not? Something like:
Code:
background-color: green; } background-color: red; }
Thank you
If you set a dynamic property "hasIcon" when you set/unset the icon on a button then this should work. While the button already has an icon property I do not think it is usable in this context.
Thank you ChrisW67, I'm not C++ coder, just a CSS/QT designer... do you know how can I create this dynamic property if I have detected this code?:
Source code taken from here.Code:
self.pointButton = self._pushbutton("addButton", bl, icon="Draft_AddPoint", width=100)
Thank you
At a guess...
In the_pushbutton() function at line 297 would do it.Code:
if icon: button.setProperty('hasIcon', 'yes')