Search code examples
c++qtqt4

How to end line with QTextEdit


I'm trying to create QTextEdit with some text, and in this text I have end of line characters (\n), but it is not accepted in QTextEdit object (whole text is displayed without any breaks). Any reason why?


Solution

  • If you're using Qt 4.3 or later, then you can use setPlainText(const QString &text)

    You can turn off rich text editing with setAcceptRichText(bool accept) (Qt 4.1 or later)