瀏覽代碼

[LYN-4393] As a dev I want to Enable Gems in O3DE.exe with Keyboard (#1760)

Enabling and disabling the selected gem is now possible by pressing the space bar.

Signed-off-by: Benjamin Jillich <[email protected]>
Benjamin Jillich 4 年之前
父節點
當前提交
2a42e7a012
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp

+ 11 - 0
Code/Tools/ProjectManager/Source/GemCatalog/GemItemDelegate.cpp

@@ -131,6 +131,17 @@ namespace O3DE::ProjectManager
             return false;
         }
 
+        if (event->type() == QEvent::KeyPress)
+        {
+            auto keyEvent = static_cast<const QKeyEvent*>(event);
+            if (keyEvent->key() == Qt::Key_Space)
+            {
+                const bool isAdded = GemModel::IsAdded(modelIndex);
+                GemModel::SetIsAdded(*model, modelIndex, !isAdded);
+                return true;
+            }
+        }
+
         if (event->type() == QEvent::MouseButtonPress)
         {
             QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);