瀏覽代碼

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.
PatTheMav 3 年之前
父節點
當前提交
43dc65beec
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      UI/source-tree.cpp

+ 5 - 1
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<SourceTreeItem *>(widget);
-	if (itemWidget->IsEditing())
+	if (itemWidget->IsEditing()) {
+#ifdef __APPLE__
+		itemWidget->ExitEditMode(true);
+#endif
 		return false;
+	}
 
 	itemWidget->EnterEditMode();
 	edit(index);