qtextedit - 调整大小以适应 [英] qtextedit - resize to fit

查看:973
本文介绍了qtextedit - 调整大小以适应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 QTextEdit 作为displayer(可编辑为false) 。它显示的文本是文字的。现在我想要设置这个文本框的高度,以使文本完全匹配(同时也尊重最大高度)。



基本上widget )



>解决方案

除非你需要一个 QTextEdit 的功能,一个 QLabel 打开换行符将完全按照你想要的方式。


I have a QTextEdit which act as "displayer" (editable to false). The text it displays is wordwrapped. Now I do wish to set the height of this textbox so that the text fits exactly (while also respecting a maximum height).

Basically the widget (in the same vertical layout) below the layout should get as much space as possible.

How can this be achieved most easily?

解决方案

Unless there is something particular to the capabilities of a QTextEdit that you need, a QLabel with word wrap turned on will do exactly what you want.

这篇关于qtextedit - 调整大小以适应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆