forked from qt-creator/qt-creator
Lua: Add minimumWidth property to WidgetOptions
Change-Id: I7c7ed3fc8b5ac907f9e6fc7ea161d1b263c9a5de Reviewed-by: <lie@spyro-soft.com> Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -792,6 +792,11 @@ void Widget::setCursor(Qt::CursorShape shape)
|
||||
access(this)->setCursor(shape);
|
||||
}
|
||||
|
||||
void Widget::setMinimumWidth(int minw)
|
||||
{
|
||||
access(this)->setMinimumWidth(minw);
|
||||
}
|
||||
|
||||
void Widget::setSizePolicy(const QSizePolicy &policy)
|
||||
{
|
||||
access(this)->setSizePolicy(policy);
|
||||
|
@@ -261,6 +261,7 @@ public:
|
||||
void setNormalMargins(int = 0);
|
||||
void setContentsMargins(int left, int top, int right, int bottom);
|
||||
void setCursor(Qt::CursorShape shape);
|
||||
void setMinimumWidth(int);
|
||||
|
||||
void activateWindow();
|
||||
void close();
|
||||
|
@@ -114,6 +114,7 @@ CREATE_HAS_FUNC(setVisible, bool())
|
||||
CREATE_HAS_FUNC(setIcon, Utils::Icon());
|
||||
CREATE_HAS_FUNC(setContentsMargins, int(), int(), int(), int());
|
||||
CREATE_HAS_FUNC(setCursor, Qt::CursorShape())
|
||||
CREATE_HAS_FUNC(setMinimumWidth, int());
|
||||
|
||||
template<class T>
|
||||
void setProperties(std::unique_ptr<T> &item, const sol::table &children, QObject *guard)
|
||||
@@ -130,6 +131,12 @@ void setProperties(std::unique_ptr<T> &item, const sol::table &children, QObject
|
||||
item->setCursor(*cursor);
|
||||
}
|
||||
|
||||
if constexpr (has_setMinimumWidth<T>) {
|
||||
const auto minw = children.get<sol::optional<int>>("minimumWidth");
|
||||
if (minw)
|
||||
item->setMinimumWidth(*minw);
|
||||
}
|
||||
|
||||
if constexpr (has_setVisible<T>) {
|
||||
const auto visible = children.get<sol::optional<bool>>("visible");
|
||||
if (visible)
|
||||
|
@@ -41,6 +41,7 @@ gui.baseWidgetOptions = {}
|
||||
---@field fixedSize? integer[] Two integers representing the width and height
|
||||
---@field contentMargins? integer[] Four integers represending left, top, right and bottom margins.
|
||||
---@field cursor? CursorShape The cursor shape for the widget.
|
||||
---@field minimumWidth? integer The minimum width in pixels.
|
||||
gui.widgetOptions = {}
|
||||
|
||||
---@param options WidgetOptions
|
||||
|
Reference in New Issue
Block a user