diff options
Diffstat (limited to 'src/widgets/kernel/qlayout.cpp')
-rw-r--r-- | src/widgets/kernel/qlayout.cpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index 3e3c26ade3..a826ea75bc 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -57,14 +57,13 @@ static int menuBarHeightForWidth(QWidget *menubar, int w) resized to zero size if there is too little space. To support children whose heights depend on their widths, implement hasHeightForWidth() and heightForWidth(). See the - \l{layouts/borderlayout}{Border Layout} and - \l{layouts/flowlayout}{Flow Layout} examples for + \l{layouts/flowlayout}{Flow Layout} example for more information about implementing custom layout managers. Geometry management stops when the layout manager is deleted. \sa QLayoutItem, {Layout Management}, {Basic Layouts Example}, - {Border Layout Example}, {Flow Layout Example} + {Flow Layout Example} */ @@ -521,10 +520,11 @@ void QLayoutPrivate::doResize() void QLayout::widgetEvent(QEvent *e) { Q_D(QLayout); - if (!d->enabled) + const QEvent::Type type = e->type(); + if (!d->enabled && type != QEvent::ChildRemoved) return; - switch (e->type()) { + switch (type) { case QEvent::Resize: if (d->activated) d->doResize(); @@ -709,24 +709,24 @@ QLayout::~QLayout() /*! This function is called from \c addLayout() or \c insertLayout() functions in - subclasses to add layout \a l as a sub-layout. + subclasses to add layout \a childLayout as a sub-layout. The only scenario in which you need to call it directly is if you implement a custom layout that supports nested layouts. \sa QBoxLayout::addLayout(), QBoxLayout::insertLayout(), QGridLayout::addLayout() */ -void QLayout::addChildLayout(QLayout *l) +void QLayout::addChildLayout(QLayout *childLayout) { - if (Q_UNLIKELY(l->parent())) { - qWarning("QLayout::addChildLayout: layout \"%ls\" already has a parent", - qUtf16Printable(l->objectName())); + if (Q_UNLIKELY(childLayout->parent())) { + qWarning("QLayout::addChildLayout: layout %s \"%ls\" already has a parent", + childLayout->metaObject()->className(), qUtf16Printable(childLayout->objectName())); return; } - l->setParent(this); + childLayout->setParent(this); if (QWidget *mw = parentWidget()) { - l->d_func()->reparentChildWidgets(mw); + childLayout->d_func()->reparentChildWidgets(mw); } } @@ -773,7 +773,7 @@ void QLayoutPrivate::reparentChildWidgets(QWidget *mw) w->metaObject()->className(), qUtf16Printable(w->objectName())); } #endif - bool needShow = mwVisible && !(w->isHidden() && w->testAttribute(Qt::WA_WState_ExplicitShowHide)); + bool needShow = mwVisible && !QWidgetPrivate::get(w)->isExplicitlyHidden(); if (pw != mw) w->setParent(mw); if (needShow) @@ -829,9 +829,10 @@ bool QLayoutPrivate::checkLayout(QLayout *otherLayout) const This function is called from \c addWidget() functions in subclasses to add \a w as a managed widget of a layout. - If \a w is already managed by a layout, this function will give a warning - and remove \a w from that layout. This function must therefore be - called before adding \a w to the layout's data structure. + If \a w is already managed by a layout, this function will produce + a warning, and remove \a w from that layout. This function must + therefore be called before adding \a w to the layout's data + structure. */ void QLayout::addChildWidget(QWidget *w) { @@ -858,7 +859,7 @@ void QLayout::addChildWidget(QWidget *w) #endif pw = nullptr; } - bool needShow = mw && mw->isVisible() && !(w->isHidden() && w->testAttribute(Qt::WA_WState_ExplicitShowHide)); + bool needShow = mw && mw->isVisible() && !QWidgetPrivate::get(w)->isExplicitlyHidden(); if (!pw && mw) w->setParent(mw); w->setAttribute(Qt::WA_LaidOut); @@ -1258,7 +1259,7 @@ QLayout::SizeConstraint QLayout::sizeConstraint() const this layout is set to \a r, provided that this layout supports setAlignment(). - The result is derived from sizeHint() and expanding(). It is never + The result is derived from sizeHint() and expandingDirections(). It is never larger than \a r. */ QRect QLayout::alignmentRect(const QRect &r) const |