UI: Fix source name edit textbox not accepting input on enter

The Enter key is connected to the `Edit` function and is handled by
Qt with the highest priority in its key event handler. Alas the boolean
return value is not propagated to the shortcut handling system, so
the key event will always be consumed and as such the user will be stuck
in editing state.

To fix this, `Edit` needs to behave like a toggle, saving the current
state of the input at a repeat press of Enter while in editing state.
This commit is contained in:
PatTheMav 2022-09-12 22:14:37 +02:00 committed by Jim
parent 21c711d46b
commit 43dc65beec

View File

@ -1555,8 +1555,12 @@ bool SourceTree::Edit(int row)
QModelIndex index = stm->createIndex(row, 0);
QWidget *widget = indexWidget(index);
SourceTreeItem *itemWidget = reinterpret_cast<SourceTreeItem *>(widget);
if (itemWidget->IsEditing())
if (itemWidget->IsEditing()) {
#ifdef __APPLE__
itemWidget->ExitEditMode(true);
#endif
return false;
}
itemWidget->EnterEditMode();
edit(index);