aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicklayouts/qquickgridlayoutengine.cpp
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2022-08-22 14:11:50 +0200
committerJan Arve Sæther <jan-arve.saether@qt.io>2022-12-08 01:01:11 +0100
commit373b6e54dd3b6434ec427d4f5b01335cfaa90dea (patch)
treeeac6a3457da5991d6670020e9c919ac1cdc6036c /src/quicklayouts/qquickgridlayoutengine.cpp
parent73a3b69f9ae6d49cc04ce9834ab6f3b88d11e35b (diff)
Add {horizontal,vertical}StretchFactor
This utilizes the standard implementation of stretch factors that is already in the QGridLayoutEngine [ChangeLog][QtQuick][Layouts] Added support for stretch factors Fixes: QTBUG-32923 Change-Id: I4afa7636dda465af2230c2919daa5c40831c44ae Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/quicklayouts/qquickgridlayoutengine.cpp')
-rw-r--r--src/quicklayouts/qquickgridlayoutengine.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/quicklayouts/qquickgridlayoutengine.cpp b/src/quicklayouts/qquickgridlayoutengine.cpp
index daec5151dc..82d229befb 100644
--- a/src/quicklayouts/qquickgridlayoutengine.cpp
+++ b/src/quicklayouts/qquickgridlayoutengine.cpp
@@ -15,4 +15,14 @@ void QQuickGridLayoutEngine::setAlignment(QQuickItem *quickItem, Qt::Alignment a
}
}
+void QQuickGridLayoutEngine::setStretchFactor(QQuickItem *quickItem, int stretch,
+ Qt::Orientation orientation)
+{
+ Q_ASSERT(stretch >= -1); // -1 is reset
+ if (QGridLayoutItem *item = findLayoutItem(quickItem)) {
+ item->setStretchFactor(stretch, orientation);
+ invalidate();
+ }
+}
+
QT_END_NAMESPACE