keep text cursor position on stringfield

This commit is contained in:
itsmattkc
2019-03-14 19:57:47 +11:00
parent 36c6415a9a
commit 8f923d9d92
2 changed files with 7 additions and 2 deletions
+6 -2
View File
@@ -41,9 +41,13 @@ void StringField::UpdateWidgetValue(QWidget *widget, double timecode)
text->blockSignals(true);
QTextCursor cursor = text->textCursor();
int pos = text->textCursor().position();
text->setHtml(GetValueAt(timecode).toString());
text->setTextCursor(cursor);
QTextCursor new_cursor(text->document());
new_cursor.setPosition(pos);
text->setTextCursor(new_cursor);
text->blockSignals(false);
}