Lua: Fix "toolTip" case

Change-Id: I63922e030e4b6d8caa9ad5c0153bae333f9928e1
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-09-25 10:50:55 +02:00
parent 9d26b88d75
commit 9796e218a8
5 changed files with 14 additions and 14 deletions

View File

@@ -42,11 +42,11 @@ 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); }),
"tooltip", "toolTip",
sol::property( sol::property(
[](ScriptCommand *cmd) { return cmd->m_contextAction->toolTip(); }, [](ScriptCommand *cmd) { return cmd->m_contextAction->toolTip(); },
[](ScriptCommand *cmd, const QString &tooltip) { [](ScriptCommand *cmd, const QString &toolTip) {
cmd->m_contextAction->setToolTip(tooltip); cmd->m_contextAction->setToolTip(toolTip);
}), }),
"text", "text",
sol::property( sol::property(

View File

@@ -333,11 +333,11 @@ void setupSettingsModule()
if (data) { if (data) {
aspect->addOption( aspect->addOption(
{option["name"], {option["name"],
option["tooltip"].get_or(QString()), option["toolTip"].get_or(QString()),
QVariant::fromValue(*data)}); QVariant::fromValue(*data)});
} else { } else {
aspect->addOption( aspect->addOption(
option["name"], option["tooltip"].get_or(QString())); option["name"], option["toolTip"].get_or(QString()));
} }
} else if ( } else if (
sol::optional<QString> name sol::optional<QString> name
@@ -362,14 +362,14 @@ void setupSettingsModule()
"addOption", "addOption",
sol::overload( sol::overload(
[](SelectionAspect &self, const QString &name) { self.addOption(name); }, [](SelectionAspect &self, const QString &name) { self.addOption(name); },
[](SelectionAspect &self, const QString &name, const QString &tooltip) { [](SelectionAspect &self, const QString &name, const QString &toolTip) {
self.addOption(name, tooltip); self.addOption(name, toolTip);
}, },
[](SelectionAspect &self, [](SelectionAspect &self,
const QString &name, const QString &name,
const QString &tooltip, const QString &toolTip,
const sol::object &data) { const sol::object &data) {
self.addOption({name, tooltip, QVariant::fromValue(data)}); self.addOption({name, toolTip, QVariant::fromValue(data)});
}), }),
sol::base_classes, sol::base_classes,
sol::bases<TypedAspect<int>, BaseAspect>()); sol::bases<TypedAspect<int>, BaseAspect>());

View File

@@ -19,7 +19,7 @@ action.CommandAttribute = {
---@field text? string The text to display for the action. ---@field text? string The text to display for the action.
---@field icon? FilePath|string The icon to display for the action. ---@field icon? FilePath|string The icon to display for the action.
---@field iconText? string The icon text to display for the action. ---@field iconText? string The icon text to display for the action.
---@field toolTip? string The tooltip to display for the action. ---@field toolTip? string The toolTip to display for the action.
---@field onTrigger? function The callback to call when the action is triggered. ---@field onTrigger? function The callback to call when the action is triggered.
---@field commandAttributes? CommandAttributes The attributes of the action. ---@field commandAttributes? CommandAttributes The attributes of the action.
---@field commandDescription? string The description of the command. ---@field commandDescription? string The description of the command.
@@ -37,7 +37,7 @@ function action.create(id, options) 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 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 = {}
---return the module ---return the module

View File

@@ -88,7 +88,7 @@ settings.SelectionDisplayStyle = {
---@class SelectionOption ---@class SelectionOption
---@field name string The name of the option. ---@field name string The name of the option.
---@field tooltip? string The tooltip of the option. ---@field toolTip? string The toolTip of the option.
---@field data? any The data of the option. ---@field data? any The data of the option.
SelectionOption = {} SelectionOption = {}
@@ -104,7 +104,7 @@ function settings.SelectionAspect.create(options) end
function settings.SelectionAspect:addOption(option) end function settings.SelectionAspect:addOption(option) end
function settings.SelectionAspect:addOption(option, tooltip) end function settings.SelectionAspect:addOption(option, toolTip) end
settings.MultiSelectionAspect = {} settings.MultiSelectionAspect = {}
function settings.MultiSelectionAspect.create(options) end function settings.MultiSelectionAspect.create(options) end

View File

@@ -77,7 +77,7 @@ function TextDocument:blockAndColumn(position) end
---@return integer blockCount The number of blocks in the document. ---@return integer blockCount The number of blocks in the document.
function TextDocument:blockCount() end function TextDocument:blockCount() end
---Sets the suggestions for the document and enables tooltip on the mouse cursor hover. ---Sets the suggestions for the document and enables toolTip on the mouse cursor hover.
---@param suggestions Suggestion[] A list of possible suggestions to display. ---@param suggestions Suggestion[] A list of possible suggestions to display.
function TextDocument:setSuggestions(suggestions) end function TextDocument:setSuggestions(suggestions) end