diff --git a/src/plugins/lua/bindings/gui.cpp b/src/plugins/lua/bindings/gui.cpp index 9ed2afa322f..fd437655f6f 100644 --- a/src/plugins/lua/bindings/gui.cpp +++ b/src/plugins/lua/bindings/gui.cpp @@ -115,9 +115,17 @@ HAS_MEM_FUNC(setCompleter, hasSetCompleter); HAS_MEM_FUNC(setMinimumHeight, hasSetMinimumHeight); HAS_MEM_FUNC(onReturnPressed, hasOnReturnPressed); HAS_MEM_FUNC(onRightSideIconClicked, hasOnRightSideIconClicked); +HAS_MEM_FUNC(setTextInteractionFlags, hasSetTextInteractionFlags); template void setProperties(std::unique_ptr &item, const sol::table &children, QObject *guard) { + if constexpr (hasSetTextInteractionFlags::value) { + const auto interactionFlags = children.get>("interactionFlags"); + if (interactionFlags) { + item->setTextInteractionFlags(tableToFlags(*interactionFlags)); + } + } + if constexpr (hasSetWordWrap::value) { const auto wrap = children.get>("wordWrap"); if (wrap) @@ -509,6 +517,7 @@ void setupGuiModule() mirrorEnum(gui, QMetaEnum::fromType()); mirrorEnum(gui, QMetaEnum::fromType()); mirrorEnum(gui, QMetaEnum::fromType()); + mirrorEnum(gui, QMetaEnum::fromType()); gui.new_usertype( "Stack", diff --git a/src/plugins/lua/meta/gui.lua b/src/plugins/lua/meta/gui.lua index 344f8a137ff..1956b42d852 100644 --- a/src/plugins/lua/meta/gui.lua +++ b/src/plugins/lua/meta/gui.lua @@ -161,12 +161,17 @@ local pushButton = {} function gui.PushButton(options) end ---@class Label : Widget ----@field textFormat? TextFormat The text format enum ----@field wordWrap? bool ---@field text string Returns the content of the Label as string local label = {} ----@param options WidgetOptions +---@class (exact) LabelOptions : BaseWidgetOptions +---@param interactionFlags? TextInteractionFlag[] +---@param textFormat? TextFormat The text format enum +---@param wordWrap? bool + +gui.labelOptions = {} + +---@param options LabelOptions ---@return Label function gui.Label(options) end @@ -239,6 +244,20 @@ function gui.normalMargin() end ---Sets the alignment of a Grid layout according to the Form layout rules. function gui.withFormAlignment() end +--- Enum representing Text interaction flags +---@enum TextInteractionFlag +gui.TextInteractionFlag { + NoTextInteraction = 0, + TextSelectableByMouse = 0, + TextSelectableByKeyboard = 0, + LinksAccessibleByMouse = 0, + LinksAccessibleByKeyboard = 0, + TextEditable = 0, + + TextEditorInteraction = TextSelectableByMouse | TextSelectableByKeyboard | TextEditable, + TextBrowserInteraction = TextSelectableByMouse | LinksAccessibleByMouse | LinksAccessibleByKeyboard +} + --- Enum representing text format types ---@enum TextFormat gui.TextFormat = {