Lua: Expose property keySequences for ScriptCommand

Change-Id: If29893fdcdbe4e1a07ccad6353d42c3e33dcb198
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Krzysztof Chrusciel
2025-04-22 12:36:37 +02:00
parent 495c361ea0
commit c36120d0a7
2 changed files with 5 additions and 0 deletions

View File

@@ -42,6 +42,10 @@ void setupActionModule()
sol::property( sol::property(
[](ScriptCommand *cmd) { return cmd->m_contextAction->isEnabled(); }, [](ScriptCommand *cmd) { return cmd->m_contextAction->isEnabled(); },
[](ScriptCommand *cmd, bool enabled) { cmd->m_contextAction->setEnabled(enabled); }), [](ScriptCommand *cmd, bool enabled) { cmd->m_contextAction->setEnabled(enabled); }),
"keySequences",
sol::property([](ScriptCommand* cmd) -> QList<QKeySequence> {
return cmd->m_cmd->keySequences();
}),
"toolTip", "toolTip",
sol::property( sol::property(
[](ScriptCommand *cmd) { return cmd->m_contextAction->toolTip(); }, [](ScriptCommand *cmd) { return cmd->m_contextAction->toolTip(); },

View File

@@ -42,6 +42,7 @@ function action.trigger(id) end
---@class Command ---@class Command
---@field enabled boolean Whether the command is enabled or not. ---@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 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. ---@field toolTip string The toolTip of the command. Make sure to specify `commandAttributes = CommandAttribute.CA_UpdateText` in the options.
Command = {} Command = {}