Umesha MS
Umesha MS

Reputation: 2921

Button with text below icon

I am very new to QT UI development.

I need to create a button with text below the icon. There is no option to set this property to the QPushButton.

When I tried to search in the net, they told me to use QToolButton. When I used the QToolButton I could set the Qt::ToolButtonTextUnderIcon. But I couldn’t find a way to change the dimension i.e. Width, height, x and y position.

How can I display an icon with text below the icon in Qt? Any suggestions?.

Upvotes: 3

Views: 2303

Answers (1)

mosg
mosg

Reputation: 12381

For QToolButton: all that you need (i.e. width, height, x, y) QToolButton has! Take a look here and here some methods:

setFixedHeight ( int )
setFixedSize ( const QSize & )
setFixedSize ( int, int )
setFixedWidth ( int )

What about QPushButton, probably it does not support changing placement of icon and text. But maybe some how it's possible, for example reimplementing paintEvent() methods or doing update() with setStyleSheet() methods. (But this is not the noob way, sorry)

By the way here is some interesting "changed" Qt widgets...

Good luck.

Upvotes: 0

Related Questions