0

QToolButton 和文本对齐有问题。

我想左对齐文本,但不起作用。

我试过了,正如其他论坛报道的那样:

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

或者

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

但始终居中对齐。

谁能帮我?

谢谢!

4

1 回答 1

0

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.

于 2015-06-17T09:38:22.847 回答