KDDockWidgets API Documentation 1.7
Loading...
Searching...
No Matches
KDDockWidgets.h
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 Author: Sérgio Martins <sergio.martins@kdab.com>
6
7 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
8
9 Contact KDAB at <info@kdab.com> for commercial licensing options.
10*/
11
19#ifndef KD_KDDOCKWIDGETS_H
20#define KD_KDDOCKWIDGETS_H
21
22#include "docks_export.h"
23#include "Qt5Qt6Compat_p.h"
24
25#include <QObject>
26#include <QDebug>
27
28#ifdef Q_OS_WIN
29// Only on Windows, where this is popular. On linux the Qt::Tool windows need reparenting. Untested on macOS.
30#define KDDOCKWIDGETS_SUPPORTS_NESTED_MAINWINDOWS
31#endif
32
33namespace Layouting {
34class Item;
35class ItemBoxContainer;
36}
37
38namespace KDDockWidgets {
39DOCKS_EXPORT
40Q_NAMESPACE
41class MultiSplitter;
42class DropArea;
43
51Q_ENUM_NS(Location)
52
60Q_DECLARE_FLAGS(MainWindowOptions, MainWindowOption)
61Q_ENUM_NS(MainWindowOptions)
62
63
73Q_ENUM_NS(DefaultSizeMode)
74
75
81Q_ENUM_NS(AddingOption)
82
89
90
101{
102 // Implicit ctors for convenience:
103
104 InitialOption() = default;
105
107 : visibility(v)
108 {
109 }
110
112 : preferredSize(size)
113 {
114 }
115
117 : visibility(v)
118 , preferredSize(size)
119 {
120 }
121
122 QT_DEPRECATED_X("AddingOption is deprecated and will be removed in v1.5. Use InitialVisibilityOption instead.")
128
129 bool startsHidden() const
130 {
131 return visibility == InitialVisibilityOption::StartHidden;
132 }
133
135 {
137 }
138
140 {
141 return o == Qt::Horizontal ? preferredSize.width()
142 : preferredSize.height();
143 }
144
146 {
147 return preferredLength(o) > 0;
148 }
149
157
168
169private:
170 friend class Layouting::Item;
171 friend class Layouting::ItemBoxContainer;
172 friend class KDDockWidgets::MultiSplitter;
173 friend class KDDockWidgets::DropArea;
174
176 : sizeMode(mode)
177 {
178 }
179
181};
182
189Q_DECLARE_FLAGS(RestoreOptions, RestoreOption)
190Q_ENUM_NS(RestoreOptions)
191
193 Classic,
194 Segmented,
195 None
196};
197Q_ENUM_NS(DropIndicatorType)
198
199
205Q_DECLARE_FLAGS(SuggestedGeometryHints, SuggestedGeometryHint)
206Q_ENUM_NS(SuggestedGeometryHint)
207
208
209enum class SideBarLocation {
210 None,
211 North,
212 East,
213 West,
214 South
215};
216
219 Close,
220 Float,
221 Minimize,
222 Maximize,
223 Normal, // Restore from maximized state
224 AutoHide,
226};
227Q_ENUM_NS(TitleBarButtonType)
228
229
246Q_ENUM_NS(DropLocation)
247
248
249inline Qt5Qt6Compat::qhashtype qHash(SideBarLocation loc, Qt5Qt6Compat::qhashtype seed)
250{
251 return ::qHash(static_cast<uint>(loc), seed);
252}
253
269Q_DECLARE_FLAGS(CursorPositions, CursorPosition)
270Q_ENUM_NS(CursorPosition)
271
272
273
281Q_DECLARE_FLAGS(FrameOptions, FrameOption)
282Q_ENUM_NS(FrameOptions)
283
284
289Q_DECLARE_FLAGS(TabWidgetOptions, TabWidgetOption)
290Q_ENUM_NS(TabWidgetOptions)
291
292
294 None = 0,
295 FromGlobalConfig = 1, // KDDockWidgets::Config is used instead
299 NativeTitleBar = 16,
303 UseQtWindow = 256,
304 UseQtTool = 512,
305};
306Q_DECLARE_FLAGS(FloatingWindowFlags, FloatingWindowFlag)
307
308
310{
311 switch (loc) {
313 return QStringLiteral("none");
315 return QStringLiteral("left");
317 return QStringLiteral("top");
319 return QStringLiteral("right");
321 return QStringLiteral("bottom");
322 }
323
324 return QString();
325}
326}
327
328QT_BEGIN_NAMESPACE
331{
332 d << o.startsHidden();
333 return d;
334}
335QT_END_NAMESPACE
336
337Q_DECLARE_OPERATORS_FOR_FLAGS(KDDockWidgets::FrameOptions)
339
340#endif
QT_BEGIN_NAMESPACE QDebug operator<<(QDebug d, KDDockWidgets::InitialOption o)
@ MainWindowOption_MDI
‍Makes the MainWindow always have a central frame, for tabbing documents
@ MainWindowOption_HasCentralWidget
‍The layout will be MDI. DockWidgets can have arbitrary positions, not restricted by any layout
@ MainWindowOption_HasCentralFrame
‍No option set
@ Location_OnTop
‍Left docking location
@ Location_OnRight
‍Top docking location
@ Location_OnBottom
‍Right docking location
@ RestoreOption_RelativeToMainWindow
@ RestoreOption_AbsoluteFloatingDockWindows
Skips scaling of floating dock windows relative to the main window.
@ SuggestedGeometryHint_PreserveCenter
@ SuggestedGeometryHint_GeometryIsFromDocked
SideBarLocation
Each main window supports 4 sidebars.
AddingOption
Only here for source-compat with v1.2. Do not use. Use InitialVisibilityOption instead.
TitleBarButtonType
describes a type of button you can have in the title bar
@ None
Don't show any drop indicators while dragging.
@ Segmented
Segmented indicators.
Qt5Qt6Compat::qhashtype qHash(SideBarLocation loc, Qt5Qt6Compat::qhashtype seed)
DropLocation
Enum describing the different drop indicator types.
QString locationStr(Location loc)
@ StartHidden
Don't show the dock widget when adding it.
@ PreserveCurrentTab
When adding as tabbed, don't change the current index.
@ StartVisible
The dock widget is made visible when docked.
@ ItemSize
Simply uses the Item::size() of the item being added. Actual used size might be smaller if our window...
@ FairButFloor
Equal to fair, but if the item we're adding is smaller than the fair suggestion, then that small size...
@ NoDefaultSizeMode
Don't do any sizing.
@ Fair
Gives an equal relative size as the items that are already in the layout.
Orientation
Struct describing the preferred dock widget size and visibility when adding it to a layout.
int preferredLength(Qt::Orientation o) const
bool hasPreferredLength(Qt::Orientation o) const
InitialOption(InitialVisibilityOption v)
QSize preferredSize
Allows to control the size a dock widget should get when docked.
InitialOption(InitialVisibilityOption v, QSize size)

© 2019-2023 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/
Generated on Wed Nov 1 2023 00:02:31 for KDDockWidgets API Documentation by doxygen 1.9.8