[SOLVED]textBrowser->setText or textEdit->setText Using String Array
-
This Forum seems to be pretty vivid,
so I hope you can help me with this little problem.I do have an array:
@QString key_storage[20]@
filled with some values.
I want them all to be displayed in a textBrowser or textEdit field.
@ while (j <=i)
{
ui.textBrowser->setText( key_storage[j] );j++;}@
if I do like this, it works but the next array is replaced with the before one.
so I can always just show one line.
But I want them all.How can i do this?
I am looking for something like a textBrowser->addText command
-
Use QTextEdit::append or build a QString from all strings and then call setText once.
And once again: Don't use C-Arrays here. You're shooting yourself in the foot. Use QStringList. It could be that easy:
@
QStringList strings;
strings << "line one" << "line two";
yourTextEdit->setText(strings.join("\n"));
@ -