Skip to content

Commit

Permalink
GUI: LineEdit: Fix cursor jumping to the end when editing
Browse files Browse the repository at this point in the history
The issue was that editing the text triggers the change of the option,
which in turn triggers updateUiState which sets the content of the
LineEdit to the changed option causing the cursor to jump to the end.

As a workaround only set the LineEdit contet when it's not focused.
  • Loading branch information
mpiatka committed Nov 6, 2023
1 parent 1f8644f commit 99888c6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gui/QT/option/lineedit_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ void LineEditUi::connectSignals(){
}

void LineEditUi::updateUiState(const std::string &text){
line->setText(QString::fromStdString(text));
if(!line->hasFocus())
line->setText(QString::fromStdString(text));
}

void LineEditUi::updateUiState(){
Expand Down

0 comments on commit 99888c6

Please sign in to comment.