tags:

views:

93

answers:

2

So the question is how to set a value of textEdit from another form?

P.S. Sorry for my English.

A: 

myTextEdit->setPlainText(text), myTextEdit->setHtml(text) or by directly modifying the editor's QTextDocument instance.

Lukáš Lalinský
I have two forms.In a slot of the MainWindow i call QDialog constructor(for example) on which i have QTextEdit, and i want to set its value from the slot of the first form...
crew4ok
Really i want to set textEdit's value from QSqlRecord, that i have in slot.
crew4ok
+1  A: 

You have two options, either you can simply call one of the setText functions from a function within another form like this:

otherForm->setPlainText(text);

Or you could connect the two forms with signals like this:

connect(form1, SIGNAL(updateText(const QString&)),
        form2->myTextEdit, SLOT(setText(const QString&)))

Either of these are valid ways to do it.

Jason E