crew4ok
crew4ok

Reputation: 195

Handling a QTextEdit from another form

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

Upvotes: 0

Views: 213

Answers (2)

Jason E
Jason E

Reputation: 683

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.

Upvotes: 1

Lukáš Lalinský
Lukáš Lalinský

Reputation: 41306

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

Upvotes: 0

Related Questions