Alex Rivera | Logout

How to set number of lines for an QTextEdit?

Asked 2011-03-10T10:56:19.943
20

I use a QTextEdit for some inputs. But I want to adjust the height of the box. Can I set the height based on the number of lines I want to have visible at a time?

Edit
Report

1 Answer

2

Use QFont to determine the height of a single line of text in the QTextEdit (QTextEdit should have a font property). After that multiply the QFont's height value with the number of lines you want to show and set the widget's (minimum-)height to that value.

answered 2011-03-10T11:13:07.307

Your Answer