Razer
Razer

Reputation: 8211

Qt QPushbutton Icon underneath Text

When I create a QPushButton with an Icon it by default displays the text to the right of the icon. Is there a way to have the text display above the icon?

Upvotes: 0

Views: 1447

Answers (1)

Castilho
Castilho

Reputation: 3187

The easiest way is to use a QToolButton instead. This class has a method named setToolButtonStyle, which allows you to do exactly what you want.

In C++ (I have never messed with PyQt):

QToolButton *button = new QToolButton(this);
button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);

Link to the C++ docs: QToolButton and Qt::ToolButtonStyle

Upvotes: 2

Related Questions