Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QTextEdit, how to insert multiple lines?
I have a QTextEdit in a form, how do I display text on separate lines? From am SQL database I have an entry that is an house address, each line of the address is delimited with a carriage return (13).
To add this to the control I use the text function, but the lines are just displayed as a single with no carriage return.
Is there a standard way to achieve this? I've tried googling QTextEdit and Multiline entry but didn't find anything specific to my issue.
@SPlatten Are you on Windows? If so try to replace "\n" with "\r\n".
@jsulm, my development system is an iMAC.
@SPlatten Is there a difference if you use setPlainText?
@jsulm , I've just inserted:
Before setting the text, that didn't make any difference, replaced setText call with setPlainText. No difference either that was also with the replace statement still in.
@SPlatten I can't test on Mac, but on Windows setting text with \n using setText() works correctly.
SPlatten last edited by SPlatten
@jsulm ,Sorry, it does work, I'm having a bad day....I looked at the debugger again and I was mistaken.
ollarch last edited by
Keep calm and take some time to look at debugger. Again, spending more time writing here than inspecting the debugger.
Ketan__Patel__0011 last edited by
Use Append Function for It