Hi all, I use a QTextEdit to let the user insert a text. Additionaly, I let the user change the font style of this text with a button connected to a slot where I call QFontDialog::getFont. When the user changes the font, I reflect it in the text edit by reinserting all the text in the text edit:
The problem is that the textCursor of the text edit doesn't maintains the old position and it appears at the begining of the text. Is it an easy way to restore the "old" position of the text cursor?Qt Code:
textEdit -> setCurrentFont(font); textEdit -> setPlainText(textEdit -> toPlainText());To copy to clipboard, switch view to plain text mode
PD: I've tried it by getting the text cursor before calling to setPlainText and setting it again after but it doesn't works![]()
Bookmarks