Please nominate your Qt Champions for 2021!

How to resize QTextEdit when append long text?

  • My QTextEdit now expand follow to mainwindow.
    I want to resize QTextEdit to fit long text.
    How to do that?

  • Below the QTextEdit place a vertical spacer. Place both in a horizontal layout. This will make the QTextEdit increase/decrease with added/removed text and makes the size of the QTextEdit dependant of the substance. Also when MainWindow resizes, it will follow. Don't forget to set a minimumsize hint for the QTextEdit to indicate a minium size to shrink to.

Log in to reply