How to change the QPushButton icon using style sheets in a Qt application

Can I set and change the icon on a QPushButton using style sheets?

I need this for a Windows application with a white Qt4.5 label, which clients style using style sheets.

Thank.

+5
source share
3 answers

Yes.

border-image: url(/url/to/image);
+1
source

A bit late for an answer, but in case someone else pops up on this via google;

You can add an icon by changing the QAbstractButton property. Just use:

QAbstractButton {
     qproperty-icon: theme_url("/button_action/add");
}

(QAbstractButton) . QProcessButton QAbstractButton, . (, QPushButton ).

, , .

, QT-Documentation .

PS. ,

qproperty-icon: url(":/Icons/before_click.png") off,
                url(":/Icons/after_click.png") on ;
+1

All Articles