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);
}
+1
View File
@@ -123,6 +123,7 @@ TextEffect::TextEffect(Clip* c, const EffectMeta* em) :
size_val->SetDefault(48);
text_val->SetValueAt(0, tr("Sample Text"));
set_color_button->SetValueAt(0, QColor(Qt::white));
halign_field->SetValueAt(0, Qt::AlignHCenter);
valign_field->SetValueAt(0, Qt::AlignVCenter);
word_wrap_field->SetValueAt(0, true);