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.
-
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.
-
@jsulm , I've just inserted:
strText.replace("\n", "\r\n");
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.
-
Use Append Function for It
QTextEdit::append("Your String");