Is there a way to enable word wrapping of text on some simple widgets like QPushButton?

前端 未结 5 1992
没有蜡笔的小新
没有蜡笔的小新 2020-12-10 05:52

I\'d like to make QPushButton word wrap and expand it\'s height instead of expanding width. How can I do that?

5条回答
  •  旧时难觅i
    2020-12-10 06:24

    You might be doing something wrong. Buttons aren't supposed to hold much text, rather a couple of words describing action to be taken. If you wish to make it multi-line, you'd better consider providing a QLabel with corresponding description.

    Anyways, I don't know any [Qt-supported] way to make this. Same problem exists for, say, QHeaderView captions, where it could be even more applicable. Manually, you could always do this by adding "\n" chars to your caption strings (which you may automate for sure).

提交回复
热议问题