How to get QTextEdit Text minimum Height ? I Want use ScrollBar..
-
Hello. I use windows 8.1 64bit and linux 64bit,
I am using Qt Version 5.4.The text is written in QTextEdit and you can resize this TextEdit widget.
When you resize the TextEdit widget while text is being written, a scrollbar is automatically created when the size is reduced.
I want to know the minimum size of the text in the TextEdit Widget without scrollbars, and I can't make the widget smaller than its size.
How can I find the minimum size without scrollbars?
Example 1)
ab
cWhen written as above, the screen
ab
cThis is the minimum size at which no scrollbars appear.
Example 2)
abc
When I wrote as above, on a screen
abc
This is the minimum size at which no scrollbars appear.
Thank you.
-
Hi,
QFontMetrics::boundingRect seems to be what you are looking for.
-
What exactly does not work ?
Note that Qt 5.4 is more than outdated, you should consider updating to a recent version.