From 43dc65beecf430628b6c34a7fc1e32e37804ebe0 Mon Sep 17 00:00:00 2001 From: PatTheMav Date: Mon, 12 Sep 2022 22:14:37 +0200 Subject: [PATCH] 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. --- UI/source-tree.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/UI/source-tree.cpp b/UI/source-tree.cpp index 8bb9bfa50..9ab28320a 100644 --- a/UI/source-tree.cpp +++ b/UI/source-tree.cpp @@ -1555,8 +1555,12 @@ bool SourceTree::Edit(int row) QModelIndex index = stm->createIndex(row, 0); QWidget *widget = indexWidget(index); SourceTreeItem *itemWidget = reinterpret_cast(widget); - if (itemWidget->IsEditing()) + if (itemWidget->IsEditing()) { +#ifdef __APPLE__ + itemWidget->ExitEditMode(true); +#endif return false; + } itemWidget->EnterEditMode(); edit(index);