From c36120d0a70afb6e1a8a424470876ea4791a08ad Mon Sep 17 00:00:00 2001 From: Krzysztof Chrusciel Date: Tue, 22 Apr 2025 12:36:37 +0200 Subject: [PATCH] Lua: Expose property keySequences for ScriptCommand Change-Id: If29893fdcdbe4e1a07ccad6353d42c3e33dcb198 Reviewed-by: Marcus Tillmanns --- src/plugins/lua/bindings/action.cpp | 4 ++++ src/plugins/lua/meta/action.lua | 1 + 2 files changed, 5 insertions(+) diff --git a/src/plugins/lua/bindings/action.cpp b/src/plugins/lua/bindings/action.cpp index 73dc7fb2ad7..b3ecd004043 100644 --- a/src/plugins/lua/bindings/action.cpp +++ b/src/plugins/lua/bindings/action.cpp @@ -42,6 +42,10 @@ void setupActionModule() sol::property( [](ScriptCommand *cmd) { return cmd->m_contextAction->isEnabled(); }, [](ScriptCommand *cmd, bool enabled) { cmd->m_contextAction->setEnabled(enabled); }), + "keySequences", + sol::property([](ScriptCommand* cmd) -> QList { + return cmd->m_cmd->keySequences(); + }), "toolTip", sol::property( [](ScriptCommand *cmd) { return cmd->m_contextAction->toolTip(); }, diff --git a/src/plugins/lua/meta/action.lua b/src/plugins/lua/meta/action.lua index e6454bd4320..a10a9f40748 100644 --- a/src/plugins/lua/meta/action.lua +++ b/src/plugins/lua/meta/action.lua @@ -42,6 +42,7 @@ function action.trigger(id) end ---@class Command ---@field enabled boolean Whether the command is enabled or not. +---@field keySequences QKeySequence[] Current key sequences for the command. ---@field text string The text of the command. Make sure to specify `commandAttributes = CommandAttribute.CA_UpdateText` in the options. ---@field toolTip string The toolTip of the command. Make sure to specify `commandAttributes = CommandAttribute.CA_UpdateText` in the options. Command = {}