diff options
Diffstat (limited to 'src/widgets/kernel/qlayout.cpp')
-rw-r--r-- | src/widgets/kernel/qlayout.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index 9ce1c1c2d4..eac5674161 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -109,10 +109,11 @@ static int menuBarHeightForWidth(QWidget *menubar, int w) /*! Constructs a new top-level QLayout, with parent \a parent. - \a parent may not be 0. + \a parent may not be a \c nullptr. - There can be only one top-level layout for a widget. It is - returned by QWidget::layout(). + The layout is set directly as the top-level layout for + \a parent. There can be only one top-level layout for a + widget. It is returned by QWidget::layout(). */ QLayout::QLayout(QWidget *parent) : QObject(*new QLayoutPrivate, parent) @@ -1246,6 +1247,26 @@ int QLayout::indexOf(QWidget *widget) const } /*! + \since 5.12 + Searches for layout item \a layoutItem in this layout (not including child + layouts). + + Returns the index of \a layoutItem, or -1 if \a layoutItem is not found. +*/ +int QLayout::indexOf(QLayoutItem *layoutItem) const +{ + int i = 0; + QLayoutItem *item = itemAt(i); + while (item) { + if (item == layoutItem) + return i; + ++i; + item = itemAt(i); + } + return -1; +} + +/*! \enum QLayout::SizeConstraint The possible values are: |