diff options
Diffstat (limited to 'src/widgets/widgets/qdockarealayout_p.h')
-rw-r--r-- | src/widgets/widgets/qdockarealayout_p.h | 71 |
1 files changed, 21 insertions, 50 deletions
diff --git a/src/widgets/widgets/qdockarealayout_p.h b/src/widgets/widgets/qdockarealayout_p.h index 81384bd1b7..aa39bf9913 100644 --- a/src/widgets/widgets/qdockarealayout_p.h +++ b/src/widgets/widgets/qdockarealayout_p.h @@ -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 #ifndef QDOCKAREALAYOUT_P_H #define QDOCKAREALAYOUT_P_H @@ -52,11 +16,9 @@ // #include <QtWidgets/private/qtwidgetsglobal_p.h> -#include "QtCore/qrect.h" -#include "QtCore/qpair.h" -#include "QtCore/qlist.h" -#include "QtCore/qvector.h" #include "QtWidgets/qlayout.h" +#include "QtCore/qlist.h" +#include "QtCore/qrect.h" QT_REQUIRE_CONFIG(dockwidget); @@ -85,7 +47,7 @@ class QTabBar; // A path indetifies uniquely one object in this tree, the first number being the side and all the following // indexes into the QDockAreaLayoutInfo::item_list. -struct QDockAreaLayoutItem +struct Q_AUTOTEST_EXPORT QDockAreaLayoutItem { enum ItemFlags { NoFlags = 0, GapItem = 1, KeepSize = 2 }; @@ -110,6 +72,10 @@ struct QDockAreaLayoutItem int pos; int size; uint flags; +#ifndef QT_NO_DEBUG_STREAM + friend Q_AUTOTEST_EXPORT QDebug operator<<(QDebug dbg, const QDockAreaLayoutItem &item); + friend Q_AUTOTEST_EXPORT QDebug operator<<(QDebug dbg, const QDockAreaLayoutItem *item); +#endif }; class Q_AUTOTEST_EXPORT QPlaceHolderItem @@ -142,6 +108,7 @@ public: QList<int> gapIndex(const QPoint &pos, bool nestingEnabled, TabMode tabMode) const; void remove(const QList<int> &path); + void remove(QWidget *widget); void unnest(int index); void split(int index, Qt::Orientation orientation, QLayoutItem *dockWidgetItem); #if QT_CONFIG(tabbar) @@ -169,6 +136,7 @@ public: void clear(); bool isEmpty() const; + bool hasGapItem(const QList<int> &path) const; bool onlyHasPlaceholders() const; bool hasFixedSize() const; QList<int> findSeparator(const QPoint &pos) const; @@ -188,12 +156,13 @@ public: QLayoutItem *itemAt(int *x, int index) const; QLayoutItem *takeAt(int *x, int index); + void add(QWidget *widget); void deleteAllLayoutItems(); QMainWindowLayout *mainWindowLayout() const; const int *sep; - mutable QVector<QWidget*> separatorWidgets; + mutable QList<QWidget *> separatorWidgets; QInternal::DockPosition dockPos; Qt::Orientation o; QRect rect; @@ -236,9 +205,9 @@ public: QRect centralWidgetRect; QDockAreaLayout(QMainWindow *win); QDockAreaLayoutInfo docks[4]; - int sep; // separator extent + int sep; // margin between a dock widget and its frame bool fallbackToSizeHints; //determines if we should use the sizehint for the dock areas (true until the layout is restored or the separator is moved by user) - mutable QVector<QWidget*> separatorWidgets; + mutable QList<QWidget *> separatorWidgets; bool isValid() const; @@ -272,6 +241,9 @@ public: QSize sizeHint() const; QSize minimumSize() const; + QSize minimumStableSize() const; + template<typename SizePMF, typename CenterPMF> + QSize size_helper(SizePMF sizeFn, CenterPMF centerFn) const; void addDockWidget(QInternal::DockPosition pos, QDockWidget *dockWidget, Qt::Orientation orientation); bool restoreDockWidget(QDockWidget *dockWidget); @@ -296,12 +268,11 @@ public: QLayoutItem *takeAt(int *x, int index); void deleteAllLayoutItems(); - void getGrid(QVector<QLayoutStruct> *ver_struct_list, - QVector<QLayoutStruct> *hor_struct_list); - void setGrid(QVector<QLayoutStruct> *ver_struct_list, - QVector<QLayoutStruct> *hor_struct_list); + void getGrid(QList<QLayoutStruct> *ver_struct_list, QList<QLayoutStruct> *hor_struct_list); + void setGrid(QList<QLayoutStruct> *ver_struct_list, QList<QLayoutStruct> *hor_struct_list); QRect gapRect(const QList<int> &path) const; + QRect gapRect(QInternal::DockPosition dockPos) const; void keepSize(QDockWidget *w); #if QT_CONFIG(tabbar) |