Qt 4.8.5 embedded: QToolButton text align

2.1k Views Asked by At

I have a problem with QToolButton and text alignement.

I want to align left the text, but not works.

I tryed, as reported in other forum :

    <i>QToolButton *button = new QToolButton;
    QString style = QString("QToolButton{text-align:left;}");
    button->setStyleSheet(style);</i>

or

    <i>QToolButton *button = new QToolButton;
    QString style = QString("text-align:left;");
    button->setStyleSheet(style);</i>

but always center aligned.

Can anyone help me?

Thanks!

1

There are 1 best solutions below

0
On

http://doc.qt.io/qt-4.8/stylesheet-reference.html#text-align-prop

This property is currently supported only by QPushButton and QProgressBar.

Basicly You can't align text on QToolButton because it inherets QAbstractButton and not QPushButton.