浏览代码

LibGUI: Add a new constructor to Action

This constructor allows you to omit the modifier keys.

Instead of doing "{ 0, Key_F5 }" you can now just do "Key_F5"
Aatos Majava 4 年之前
父节点
当前提交
b05078b610
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      Userland/Libraries/LibGUI/Shortcut.h

+ 5 - 0
Userland/Libraries/LibGUI/Shortcut.h

@@ -19,6 +19,11 @@ public:
         , m_key(key)
     {
     }
+    Shortcut(KeyCode key)
+        : m_modifiers(0)
+        , m_key(key)
+    {
+    }
 
     bool is_valid() const { return m_key != KeyCode::Key_Invalid; }
     u8 modifiers() const { return m_modifiers; }