فهرست منبع

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);