Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Change icon color in style sheet?
Dan203 last edited by
Is there any way to change an SVG icons color via the qss style sheet? I know I can change the icon itself in the style sheet, but I'd like to just have a single black icon for each button and then apply a solid color to it for each style. If that's not possible I guess I'll have to create a custom icon for each style and state.
css can not modify an attribute of an image
SVG being XML you can create a copy and change its color so you generate the other versions "on the fly"
You can also make a custom Button widget that uses
to live draw the same icon with different colors for each state.
To use your new button widget, you can use QtCreators promote feature to make it easy
to use the new button all over the forms where you currently have the standard button.