forked from qt-creator/qt-creator
Lua: Add Widget autoFillBackground
Change-Id: I132f6ba374318dc7eec33fc141aa60a4fc64116c Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: <lie@spyro-soft.com>
This commit is contained in:
@@ -701,6 +701,11 @@ void Widget::setSize(int w, int h)
|
||||
access(this)->resize(w, h);
|
||||
}
|
||||
|
||||
void Widget::setAutoFillBackground(bool on)
|
||||
{
|
||||
access(this)->setAutoFillBackground(on);
|
||||
}
|
||||
|
||||
void Widget::setLayout(const Layout &layout)
|
||||
{
|
||||
access(this)->setLayout(access(&layout));
|
||||
|
@@ -221,6 +221,7 @@ public:
|
||||
QWidget *emerge() const;
|
||||
void show();
|
||||
|
||||
void setAutoFillBackground(bool);
|
||||
void setLayout(const Layout &layout);
|
||||
void setSize(int, int);
|
||||
void setWindowTitle(const QString &);
|
||||
@@ -427,6 +428,7 @@ QTC_DEFINE_BUILDER_SETTER(windowTitle, setWindowTitle)
|
||||
QTC_DEFINE_BUILDER_SETTER(wordWrap, setWordWrap);
|
||||
QTC_DEFINE_BUILDER_SETTER(windowFlags, setWindowFlags);
|
||||
QTC_DEFINE_BUILDER_SETTER(widgetAttribute, setWidgetAttribute);
|
||||
QTC_DEFINE_BUILDER_SETTER(autoFillBackground, setAutoFillBackground);
|
||||
|
||||
// Nesting dispatchers
|
||||
|
||||
|
@@ -98,6 +98,7 @@ HAS_MEM_FUNC(setValue, hasSetValue);
|
||||
HAS_MEM_FUNC(setSize, hasSetSize);
|
||||
HAS_MEM_FUNC(setWindowFlags, hasSetWindowFlags);
|
||||
HAS_MEM_FUNC(setWidgetAttribute, hasSetWidgetAttribute);
|
||||
HAS_MEM_FUNC(setAutoFillBackground, hasSetAutoFillBackground);
|
||||
|
||||
template<class T>
|
||||
void setProperties(std::unique_ptr<T> &item, const sol::table &children, QObject *guard)
|
||||
@@ -129,6 +130,13 @@ void setProperties(std::unique_ptr<T> &item, const sol::table &children, QObject
|
||||
}
|
||||
}
|
||||
|
||||
if constexpr (hasSetAutoFillBackground<T, void (T::*)(bool)>::value) {
|
||||
sol::optional<bool> autoFillBackground = children.get<sol::optional<bool>>(
|
||||
"autoFillBackground");
|
||||
if (autoFillBackground)
|
||||
item->setAutoFillBackground(*autoFillBackground);
|
||||
}
|
||||
|
||||
if constexpr (hasOnTextChanged<T, void (T::*)(const QString &)>::value) {
|
||||
sol::optional<sol::protected_function> onTextChanged
|
||||
= children.get<sol::optional<sol::protected_function>>("onTextChanged");
|
||||
|
@@ -23,6 +23,7 @@ gui.widget = {}
|
||||
---@field size? integer[] Two integers, representing the width and height of the widget.
|
||||
---@field windowFlags? WindowType[] The window flags of the widget.
|
||||
---@field widgetAttributes? WidgetAttributeMapT<boolean> The widget attributes of the widget.
|
||||
---@field autoFillBackground? boolean A boolean, representing whether the widget should automatically fill its background.
|
||||
gui.baseWidgetOptions = {}
|
||||
|
||||
---@class (exact) WidgetOptions : BaseWidgetOptions
|
||||
|
Reference in New Issue
Block a user