forked from qt-creator/qt-creator
Utils: Fix StringAspect ui connection
QLineEdit::textEdited is only called when the user types. It is not triggered if the text changes due to undo/redo. QLineEdit::textChanged is triggered for all changes. We also have to make sure that we don't call QLineEdit::setTextKeepingActiveCursor unnecessarily as that would clear the undo/redo stack of the QLineEdit. Change-Id: I19562d0804e6a34b11f19e86abd256a807e147d6 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1165,7 +1165,7 @@ void StringAspect::addToLayout(LayoutItem &parent)
|
||||
handleGuiChanged();
|
||||
});
|
||||
} else {
|
||||
connect(lineEditDisplay, &QLineEdit::textEdited, this, [this, lineEditDisplay]() {
|
||||
connect(lineEditDisplay, &QLineEdit::textChanged, this, [this, lineEditDisplay]() {
|
||||
d->undoable.set(undoStack(), lineEditDisplay->text());
|
||||
handleGuiChanged();
|
||||
});
|
||||
@@ -1188,7 +1188,9 @@ void StringAspect::addToLayout(LayoutItem &parent)
|
||||
&UndoSignaller::changed,
|
||||
lineEditDisplay,
|
||||
[this, lineEditDisplay] {
|
||||
if (lineEditDisplay->text() != d->undoable.get())
|
||||
lineEditDisplay->setTextKeepingActiveCursor(d->undoable.get());
|
||||
|
||||
lineEditDisplay->validate();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user