You really do not need to subclass change the formatting of your button, but use style sheets, for example.
QPushButton { font-size: 18pt; font-weight: bold; color: #ff0000; }
Applying this to the button you want to change, make the button text 18pt bold and red. You can apply via widget->setStyleSheet()
Applying this to the widget in the hierarchy above, all the buttons below will stylize, the QT stylesheet mechanism is very flexible and quite well documented.
You can also set style sheets in the designer, this will lead to a change in the widget that you are currently editing.
Harald scheirich
source share