Hey trolls,
I have a QPlainTextEdit.
I've load the content of a file.
Now in another editor I modify the content of that file.
Is it possible to get my QPlainTextEdit refreshed without getting my cursor / scrollbars screwed up ?
Thanks.
Hey trolls,
I have a QPlainTextEdit.
I've load the content of a file.
Now in another editor I modify the content of that file.
Is it possible to get my QPlainTextEdit refreshed without getting my cursor / scrollbars screwed up ?
Thanks.
check this thread in this forum
http://www.qtcentre.org/forum/f-qt-p...ht=QTextCursor
bunjee (25th April 2009)
Solved.
Qt Code:
// Backup settings int position = d->plainTextEdit->textCursor().position(); int vScrollPosition = d->plainTextEdit->verticalScrollBar()->value(); int hScrollPosition = d->plainTextEdit->horizontalScrollBar()->value(); // Getting content d->plainTextEdit->setPlainText(scriptFile.readAll()); scriptFile.close(); // Restore settings cursor.setPosition(position); d->plainTextEdit->setTextCursor(cursor); d->plainTextEdit->verticalScrollBar()->setValue(vScrollPosition); d->plainTextEdit->horizontalScrollBar()->setValue(hScrollPosition);To copy to clipboard, switch view to plain text mode
Note: this resets the undo stack.
johnmauer (2nd February 2010)
Bookmarks