Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qdockarealayout_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QDOCKAREALAYOUT_P_H
5#define QDOCKAREALAYOUT_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
19#include "QtWidgets/qlayout.h"
20#include "QtCore/qlist.h"
21#include "QtCore/qrect.h"
22
24
26
27class QLayoutItem;
28class QWidget;
29class QLayoutItem;
32class QDockWidget;
33class QMainWindow;
34class QWidgetAnimator;
36struct QLayoutStruct;
37class QTabBar;
38
39// The classes in this file represent the tree structure that represents all the docks
40// Also see the wiki internal documentation
41// At the root of the tree is: QDockAreaLayout, which handles all 4 sides, so there is only one.
42// For each side it has one QDockAreaLayoutInfo child. (See QDockAreaLayout::docks.)
43// The QDockAreaLayoutInfo have QDockAreaLayoutItems as children (See QDockAreaLayoutInfo::item_list),
44// which then has one QDockAreaLayoutInfo as a child. (QDockAreaLayoutItem::subInfo) or
45// a widgetItem if this is a node of the tree (QDockAreaLayoutItem::widgetItem)
46//
47// A path indetifies uniquely one object in this tree, the first number being the side and all the following
48// indexes into the QDockAreaLayoutInfo::item_list.
49
51{
52 enum ItemFlags { NoFlags = 0, GapItem = 1, KeepSize = 2 };
53
54 explicit QDockAreaLayoutItem(QLayoutItem *_widgetItem = nullptr);
55 explicit QDockAreaLayoutItem(QDockAreaLayoutInfo *_subinfo);
56 explicit QDockAreaLayoutItem(QPlaceHolderItem *_placeHolderItem);
59
61
62 bool skip() const;
63 QSize minimumSize() const;
64 QSize maximumSize() const;
65 QSize sizeHint() const;
66 bool expansive(Qt::Orientation o) const;
67 bool hasFixedSize(Qt::Orientation o) const;
68
72 int pos;
73 int size;
75#ifndef QT_NO_DEBUG_STREAM
78#endif
79};
80
91
93{
94public:
97 int tbhape, QMainWindow *window);
98
99 QSize minimumSize() const;
100 QSize maximumSize() const;
101 QSize sizeHint() const;
102 QSize size() const;
103
104 bool insertGap(const QList<int> &path, QLayoutItem *dockWidgetItem);
105 QLayoutItem *plug(const QList<int> &path);
106 QLayoutItem *unplug(const QList<int> &path);
107 enum TabMode { NoTabs, AllowTabs, ForceTabs };
108 QList<int> gapIndex(const QPoint &pos, bool nestingEnabled,
109 TabMode tabMode) const;
110 void remove(const QList<int> &path);
111 void remove(QWidget *widget);
112 void unnest(int index);
113 void split(int index, Qt::Orientation orientation, QLayoutItem *dockWidgetItem);
114#if QT_CONFIG(tabbar)
115 void tab(int index, QLayoutItem *dockWidgetItem);
116#endif
117 QDockAreaLayoutItem &item(const QList<int> &path);
118 QDockAreaLayoutInfo *info(const QList<int> &path);
120
121 enum { // sentinel values used to validate state data
122 SequenceMarker = 0xfc,
123 TabMarker = 0xfa,
124 WidgetMarker = 0xfb
125 };
126 void saveState(QDataStream &stream) const;
127 bool restoreState(QDataStream &stream, QList<QDockWidget*> &widgets, bool testing);
128
129 void fitItems();
130 bool expansive(Qt::Orientation o) const;
131 int changeSize(int index, int size, bool below);
132 QRect itemRect(int index, bool isGap = false) const;
133 QRect itemRect(const QList<int> &path) const;
134 QRect separatorRect(int index) const;
135 QRect separatorRect(const QList<int> &path) const;
136
137 void clear();
138 bool isEmpty() const;
139 bool hasGapItem(const QList<int> &path) const;
140 bool onlyHasPlaceholders() const;
141 bool hasFixedSize() const;
142 QList<int> findSeparator(const QPoint &pos) const;
143 int next(int idx) const;
144 int prev(int idx) const;
145
146 QList<int> indexOf(QWidget *widget) const;
147 QList<int> indexOfPlaceHolder(const QString &objectName) const;
148
149 QDockWidget *apply(bool animate);
150
151 void paintSeparators(QPainter *p, QWidget *widget, const QRegion &clip,
152 const QPoint &mouse) const;
153 QRegion separatorRegion() const;
154 int separatorMove(int index, int delta);
155 int separatorMove(const QList<int> &separator, const QPoint &origin, const QPoint &dest);
156
157 QLayoutItem *itemAt(int *x, int index) const;
158 QLayoutItem *takeAt(int *x, int index);
159 void add(QWidget *widget);
160 void deleteAllLayoutItems();
161
162 QMainWindowLayout *mainWindowLayout() const;
163
164 const int *sep;
165 mutable QList<QWidget *> separatorWidgets;
170 QList<QDockAreaLayoutItem> item_list;
171#if QT_CONFIG(tabbar)
172 void updateSeparatorWidgets() const;
173 QSet<QWidget*> usedSeparatorWidgets() const;
174
175 quintptr currentTabId() const;
176 void setCurrentTab(QWidget *widget);
177 void setCurrentTabId(quintptr id);
178 QRect tabContentRect() const;
179 bool tabbed;
180 QTabBar *tabBar;
181 int tabBarShape;
182
183 void reparentWidgets(QWidget *p);
184 bool updateTabBar() const;
185 void setTabBarShape(int shape);
186 QSize tabBarMinimumSize() const;
187 QSize tabBarSizeHint() const;
188
189 QSet<QTabBar*> usedTabBars() const;
190
191 int tabIndexToListIndex(int) const;
192 void moveTab(int from, int to);
193#endif // QT_CONFIG(tabbar)
194};
195
197{
198public:
199 enum { EmptyDropAreaSize = 80 }; // when a dock area is empty, how "wide" is it?
200
201 Qt::DockWidgetArea corners[4]; // use a Qt::Corner for indexing
208 int sep; // margin between a dock widget and its frame
209 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)
210 mutable QList<QWidget *> separatorWidgets;
211
212 bool isValid() const;
213
214 enum { DockWidgetStateMarker = 0xfd, FloatingDockWidgetTabMarker = 0xf9 };
215 static QRect constrainedRect(QRect rect, QWidget *widget);
216 void saveState(QDataStream &stream) const;
217 bool restoreState(QDataStream &stream, const QList<QDockWidget*> &widgets, bool testing = false);
218
219 QList<int> indexOfPlaceHolder(const QString &objectName) const;
220 QList<int> indexOf(QWidget *dockWidget) const;
221 QList<int> gapIndex(const QPoint &pos, bool disallowTabs) const;
222 QList<int> findSeparator(const QPoint &pos) const;
223
224 QDockAreaLayoutItem &item(const QList<int> &path);
225 QDockAreaLayoutInfo *info(const QList<int> &path);
226 const QDockAreaLayoutInfo *info(const QList<int> &path) const;
228 QRect itemRect(const QList<int> &path) const;
229 QRect separatorRect(int index) const;
230 QRect separatorRect(const QList<int> &path) const;
231
232 bool insertGap(const QList<int> &path, QLayoutItem *dockWidgetItem);
233 QLayoutItem *plug(const QList<int> &path);
234 QLayoutItem *unplug(const QList<int> &path);
235 void remove(const QList<int> &path);
236 void removePlaceHolder(const QString &name);
237
238 void fitLayout();
239
240 void clear();
241
242 QSize sizeHint() const;
243 QSize minimumSize() const;
244 QSize minimumStableSize() const;
245 template<typename SizePMF, typename CenterPMF>
246 QSize size_helper(SizePMF sizeFn, CenterPMF centerFn) const;
247
248 void addDockWidget(QInternal::DockPosition pos, QDockWidget *dockWidget, Qt::Orientation orientation);
249 bool restoreDockWidget(QDockWidget *dockWidget);
250 void splitDockWidget(QDockWidget *after, QDockWidget *dockWidget,
251 Qt::Orientation orientation);
252#if QT_CONFIG(tabbar)
253 void tabifyDockWidget(QDockWidget *first, QDockWidget *second);
254#endif
255 void resizeDocks(const QList<QDockWidget *> &docks, const QList<int> &sizes, Qt::Orientation o);
256
257 void apply(bool animate);
258
259 void paintSeparators(QPainter *p, QWidget *widget, const QRegion &clip,
260 const QPoint &mouse) const;
261 QRegion separatorRegion() const;
262 int separatorMove(const QList<int> &separator, const QPoint &origin, const QPoint &dest);
263#if QT_CONFIG(tabbar)
264 void updateSeparatorWidgets() const;
265#endif // QT_CONFIG(tabbar)
266
267 QLayoutItem *itemAt(int *x, int index) const;
268 QLayoutItem *takeAt(int *x, int index);
269 void deleteAllLayoutItems();
270
271 void getGrid(QList<QLayoutStruct> *ver_struct_list, QList<QLayoutStruct> *hor_struct_list);
272 void setGrid(QList<QLayoutStruct> *ver_struct_list, QList<QLayoutStruct> *hor_struct_list);
273
274 QRect gapRect(const QList<int> &path) const;
275 QRect gapRect(QInternal::DockPosition dockPos) const;
276
277 void keepSize(QDockWidget *w);
278#if QT_CONFIG(tabbar)
279 QSet<QTabBar*> usedTabBars() const;
280 QSet<QWidget*> usedSeparatorWidgets() const;
281#endif // QT_CONFIG(tabbar)
282 void styleChangedEvent();
283};
284
286
287#endif // QDOCKAREALAYOUT_P_H
\inmodule QtCore\reentrant
Definition qdatastream.h:46
\inmodule QtCore
QInternal::DockPosition dockPos
QList< QDockAreaLayoutItem > item_list
int changeSize(int index, int size, bool below)
QList< QWidget * > separatorWidgets
QLayoutItem * centralWidgetItem
QMainWindow * mainWindow
QList< QWidget * > separatorWidgets
The QDockWidget class provides a widget that can be docked inside a QMainWindow or floated as a top-l...
Definition qdockwidget.h:20
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition qlayoutitem.h:25
The QMainWindow class provides a main application window.
Definition qmainwindow.h:25
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:30
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QTabBar class provides a tab bar, e.g.
Definition qtabbar.h:19
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QOpenGLWidget * widget
[1]
b clear()
rect
[4]
short next
Definition keywords.cpp:445
Combined button and popup list for selecting options.
DockWidgetArea
Orientation
Definition qnamespace.h:98
EGLStreamKHR stream
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint index
[2]
GLuint name
GLint first
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
GLsizei const GLchar *const * path
GLfloat GLfloat p
[1]
static void add(QPainterPath &path, const QWingedEdge &list, int edge, QPathEdge::Traversal traversal)
static void split(QT_FT_Vector *b)
#define Q_AUTOTEST_EXPORT
#define QT_REQUIRE_CONFIG(feature)
size_t quintptr
Definition qtypes.h:167
unsigned int uint
Definition qtypes.h:34
QWidget * win
Definition settings.cpp:6
settings remove("monkey")
QDataStream & operator<<(QDataStream &out, const MyClass &myObj)
[4]
QList< QWidget * > widgets
[11]
list indexOf("B")
QSharedPointer< T > other(t)
[5]
QGraphicsItem * item
aWidget window() -> setWindowTitle("New Window Title")
[2]
QDockWidget * dockWidget
[0]
QHostInfo info
[0]
QPlaceHolderItem * placeHolderItem
QDockAreaLayoutInfo * subinfo