diff options
Diffstat (limited to 'src/widgets/kernel/qlayout.cpp')
-rw-r--r-- | src/widgets/kernel/qlayout.cpp | 72 |
1 files changed, 18 insertions, 54 deletions
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index 2867bd9fb1..0251ecd7fd 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qlayout.h" @@ -93,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} */ @@ -745,24 +708,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); } } @@ -809,7 +772,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) @@ -865,9 +828,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) { @@ -894,7 +858,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); @@ -1294,7 +1258,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 |