forked from qt-creator/qt-creator
Lua: Add fixedSize to builder property
Change-Id: I5779b91985659899cd17164d91217bce7a5800b9 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -709,6 +709,11 @@ void Widget::setSize(int w, int h)
|
|||||||
access(this)->resize(w, h);
|
access(this)->resize(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Widget::setFixedSize(int w, int h)
|
||||||
|
{
|
||||||
|
access(this)->setFixedSize(w, h);
|
||||||
|
}
|
||||||
|
|
||||||
void Widget::setAutoFillBackground(bool on)
|
void Widget::setAutoFillBackground(bool on)
|
||||||
{
|
{
|
||||||
access(this)->setAutoFillBackground(on);
|
access(this)->setAutoFillBackground(on);
|
||||||
|
@@ -248,6 +248,7 @@ public:
|
|||||||
void setAutoFillBackground(bool);
|
void setAutoFillBackground(bool);
|
||||||
void setLayout(const Layout &layout);
|
void setLayout(const Layout &layout);
|
||||||
void setSize(int, int);
|
void setSize(int, int);
|
||||||
|
void setFixedSize(int, int);
|
||||||
void setWindowTitle(const QString &);
|
void setWindowTitle(const QString &);
|
||||||
void setWindowFlags(Qt::WindowFlags);
|
void setWindowFlags(Qt::WindowFlags);
|
||||||
void setWidgetAttribute(Qt::WidgetAttribute, bool on);
|
void setWidgetAttribute(Qt::WidgetAttribute, bool on);
|
||||||
@@ -523,6 +524,7 @@ QTC_DEFINE_BUILDER_SETTER(autoFillBackground, setAutoFillBackground);
|
|||||||
QTC_DEFINE_BUILDER_SETTER(readOnly, setReadOnly);
|
QTC_DEFINE_BUILDER_SETTER(readOnly, setReadOnly);
|
||||||
QTC_DEFINE_BUILDER_SETTER(markdown, setMarkdown);
|
QTC_DEFINE_BUILDER_SETTER(markdown, setMarkdown);
|
||||||
QTC_DEFINE_BUILDER_SETTER(basePath, setBasePath);
|
QTC_DEFINE_BUILDER_SETTER(basePath, setBasePath);
|
||||||
|
QTC_DEFINE_BUILDER_SETTER(fixedSize, setFixedSize);
|
||||||
|
|
||||||
// Nesting dispatchers
|
// Nesting dispatchers
|
||||||
|
|
||||||
|
@@ -116,6 +116,7 @@ HAS_MEM_FUNC(setMinimumHeight, hasSetMinimumHeight);
|
|||||||
HAS_MEM_FUNC(onReturnPressed, hasOnReturnPressed);
|
HAS_MEM_FUNC(onReturnPressed, hasOnReturnPressed);
|
||||||
HAS_MEM_FUNC(onRightSideIconClicked, hasOnRightSideIconClicked);
|
HAS_MEM_FUNC(onRightSideIconClicked, hasOnRightSideIconClicked);
|
||||||
HAS_MEM_FUNC(setTextInteractionFlags, hasSetTextInteractionFlags);
|
HAS_MEM_FUNC(setTextInteractionFlags, hasSetTextInteractionFlags);
|
||||||
|
HAS_MEM_FUNC(setFixedSize, hasSetFixedSize);
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void setProperties(std::unique_ptr<T> &item, const sol::table &children, QObject *guard) {
|
void setProperties(std::unique_ptr<T> &item, const sol::table &children, QObject *guard) {
|
||||||
@@ -126,6 +127,12 @@ void setProperties(std::unique_ptr<T> &item, const sol::table &children, QObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if constexpr (hasSetFixedSize<T, void (T::*)(int, int)>::value) {
|
||||||
|
sol::optional<QSize> size = children.get<sol::optional<QSize>>("fixedSize");
|
||||||
|
if (size)
|
||||||
|
item->setFixedSize(size->width(), size->height());
|
||||||
|
}
|
||||||
|
|
||||||
if constexpr (hasSetWordWrap<T, void (T::*)(bool)>::value) {
|
if constexpr (hasSetWordWrap<T, void (T::*)(bool)>::value) {
|
||||||
const auto wrap = children.get<sol::optional<bool>>("wordWrap");
|
const auto wrap = children.get<sol::optional<bool>>("wordWrap");
|
||||||
if (wrap)
|
if (wrap)
|
||||||
|
@@ -37,6 +37,7 @@ gui.baseWidgetOptions = {}
|
|||||||
---@field value? integer The value of the widget, if applicable.
|
---@field value? integer The value of the widget, if applicable.
|
||||||
---@field flat? boolean A boolean, representing whether the widget should be flat, if applicable.
|
---@field flat? boolean A boolean, representing whether the widget should be flat, if applicable.
|
||||||
---@field [1]? Layout The layout of the widget, if applicable.
|
---@field [1]? Layout The layout of the widget, if applicable.
|
||||||
|
---@field fixedSize? integer[] Two integers representing the width and height
|
||||||
gui.widgetOptions = {}
|
gui.widgetOptions = {}
|
||||||
|
|
||||||
---@param options WidgetOptions
|
---@param options WidgetOptions
|
||||||
|
Reference in New Issue
Block a user