“text-overflow” for a QLabel’s text rendering in QT
问题 I have got a QLabel element in a widget which can be resized. The text can overflow boundaries, so I need, for the application to look more elegant, some way to make the text generate an ellipsis (...) after the last totally visible word in the text. Making layouts in HTML/CSS I used to use text-overflow: ellipsis; for this, but for QT classes I have not found any information on this. 回答1: It looks like on your label resize event you can create elided text using the new width of the widget