[Qt-interest] Easiest way to clone a QPlainTextEdit

Andre Somers andre at familiesomers.nl
Mon Dec 14 14:38:51 CET 2009


mathias wrote:
> Hi,
>
> I want to clone the content of a QPlainTextEdit to another
> QPlainTextEdit in realtime. So both edits should look the same(content
> and styling of content) when the user types to the first textedit. Is
> there an easier way then reacting on textchanged signal of the first
> one and then inserting the data to the second textedit?
Just use the same document on both?

This one-liner is all it takes in my test application that I just made:

ui->textEdit_2->setDocument(ui->textEdit_1->document());

André




More information about the Qt-interest-old mailing list