How to make QLabel expand width geometry to accommodate text

≯℡__Kan透↙ 提交于 2019-12-12 06:47:36

问题


I currently have a QLabel that has some text in it. However when I put some text in it that exceeds its geometrical width then that extra text is not displayed. I do not want to enable wordwrap since I want the QLabel to expand horizontally. Is there anyway that Qlabel could increase its geometrical width based on its content.


回答1:


Call QWidget::adjustSize() everytime you change the content of your label. I can't elaborate on other possible answers due to lack of information, but that will probably do the trick.



来源:https://stackoverflow.com/questions/20462126/how-to-make-qlabel-expand-width-geometry-to-accommodate-text

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!