forked from qt-creator/qt-creator
Lua: Expose setTextInteractionFlags in Label
Change-Id: Ide3598d4be59ba2f7c41ee7153a81952c5ed9775 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -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<class T>
|
||||
void setProperties(std::unique_ptr<T> &item, const sol::table &children, QObject *guard) {
|
||||
if constexpr (hasSetTextInteractionFlags<T, void (T::*)(Qt::TextInteractionFlags)>::value) {
|
||||
const auto interactionFlags = children.get<sol::optional<sol::table>>("interactionFlags");
|
||||
if (interactionFlags) {
|
||||
item->setTextInteractionFlags(tableToFlags<Qt::TextInteractionFlag>(*interactionFlags));
|
||||
}
|
||||
}
|
||||
|
||||
if constexpr (hasSetWordWrap<T, void (T::*)(bool)>::value) {
|
||||
const auto wrap = children.get<sol::optional<bool>>("wordWrap");
|
||||
if (wrap)
|
||||
@@ -509,6 +517,7 @@ void setupGuiModule()
|
||||
mirrorEnum(gui, QMetaEnum::fromType<Qt::WidgetAttribute>());
|
||||
mirrorEnum(gui, QMetaEnum::fromType<Qt::WindowType>());
|
||||
mirrorEnum(gui, QMetaEnum::fromType<Qt::TextFormat>());
|
||||
mirrorEnum(gui, QMetaEnum::fromType<Qt::TextInteractionFlag>());
|
||||
|
||||
gui.new_usertype<Stack>(
|
||||
"Stack",
|
||||
|
@@ -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 = {
|
||||
|
Reference in New Issue
Block a user