KDDockWidgets API Documentation 2.1
Loading...
Searching...
No Matches
core/DropArea.h
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2019 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_DROP_AREA_P_H
20#define KD_DROP_AREA_P_H
21#pragma once
22
23#include "kddockwidgets/docks_export.h"
24#include "kddockwidgets/KDDockWidgets.h"
25#include "kddockwidgets/core/Layout.h"
26
27class TestQtWidgets;
28class TestDocks;
29
30namespace KDDockWidgets {
31
32namespace Core {
33
34class Group;
35class Draggable;
36class DockWidget;
37class Separator;
38class DropIndicatorOverlay;
39class LayoutingSeparator;
40struct WindowBeingDragged;
41
54class DOCKS_EXPORT DropArea : public Layout
55{
56 Q_OBJECT
57public:
58 explicit DropArea(View *parent, MainWindowOptions options, bool isMDIWrapper = false);
59 ~DropArea();
60
61 void removeHover();
62 DropLocation hover(WindowBeingDragged *draggedWindow, Point globalPos);
64 bool drop(WindowBeingDragged *droppedWindow, Point globalPos);
65 Vector<Core::Group *> groups() const;
66
67 Core::Item *centralFrame() const;
68 DropIndicatorOverlay *dropIndicatorOverlay() const;
69 void addDockWidget(DockWidget *dw, KDDockWidgets::Location location, DockWidget *relativeTo,
70 const InitialOption &initialOption = {});
71 void _addDockWidget(DockWidget *dw, KDDockWidgets::Location location, Item *relativeTo,
72 const InitialOption &initialOption);
73
74 bool containsDockWidget(DockWidget *) const;
75
78 bool hasSingleFloatingGroup() const;
79
82 bool hasSingleGroup() const;
83
84 Vector<QString> affinities() const;
85 void layoutParentContainerEqually(DockWidget *);
86
90 bool isMDIWrapper() const;
91
93 Core::DockWidget *mdiDockWidgetWrapper() const;
94
95 static Core::Group *createCentralGroup(MainWindowOptions options);
96
100 void addWidget(View *widget, KDDockWidgets::Location location,
101 Core::Item *relativeToItem = nullptr,
102 const InitialOption &option = DefaultSizeMode::Fair);
103
110 void addMultiSplitter(Core::DropArea *splitter, KDDockWidgets::Location location,
111 Core::Group *relativeToGroup = nullptr,
112 const InitialOption &option = DefaultSizeMode::Fair);
113
120 Rect rectForDrop(const WindowBeingDragged *wbd, KDDockWidgets::Location location,
121 const Core::Item *relativeTo) const;
122
123 bool deserialize(const LayoutSaver::MultiSplitter &) override;
124
126 Vector<Core::LayoutingSeparator *> separators() const;
127
129 void layoutEqually();
130
132 void layoutEqually(Core::ItemBoxContainer *);
133
136 int numSideBySide_recursive(Qt::Orientation) const;
137
138 Core::ItemBoxContainer *rootItem() const;
139
142 DropLocation currentDropLocation() const;
143#if defined(DOCKS_DEVELOPER_MODE) || defined(KDDW_FRONTEND_FLUTTER)
144public:
145#else
146private:
147#endif
149 friend class Core::MainWindow;
150 friend class Core::Group;
151 friend class Core::FloatingWindow;
153 friend class AnimatedIndicators;
154
155 // For debug/hardening
156 bool validateInputs(View *widget, KDDockWidgets::Location location,
157 const Core::Item *relativeToItem, const InitialOption &option) const;
158
159
160 void setRootItem(Core::ItemBoxContainer *);
161
167 int availableLengthForOrientation(Qt::Orientation orientation) const;
168
173 Size availableSize() const;
174
175 template<typename T>
176 bool validateAffinity(T *, Core::Group *acceptingGroup = nullptr) const;
177 bool drop(WindowBeingDragged *draggedWindow, Core::Group *acceptingGroup, DropLocation);
178 bool drop(View *droppedwindow, KDDockWidgets::Location location,
179 Core::Group *relativeTo);
180 Core::Group *groupContainingPos(Point globalPos) const;
181 Core::Group *centralGroup() const;
182 void updateFloatingActions();
183
184 class Private;
185 Private *const d;
186};
187}
188}
189
190#endif
#define KDDW_DELETE_COPY_CTOR(NAME)
The DockWidget base-class. DockWidget and Core::DockWidget are only split in two so we can share some...
The widget (QWidget or QQuickItem) which holds a layout of dock widgets.
Definition Layout.h:57
The MainWindow base-class. MainWindow and MainWindowBase are only split in two so we can share some c...
Class to abstract QAction, so code still works with QtQuick and Flutter.
DropLocation
Enum describing the different drop indicator types.
Orientation
Struct describing the preferred dock widget size and visibility when adding it to a layout.

© 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 by doxygen 1.9.8