KDDockWidgets API Documentation 2.0
Loading...
Searching...
No Matches
core/DropArea.cpp
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
12#include "DropArea.h"
13#include "Layout_p.h"
14#include "Config.h"
15#include "core/ViewFactory.h"
16#include "DockRegistry.h"
17#include "Platform.h"
18#include "core/Draggable_p.h"
19#include "core/Logging_p.h"
20#include "core/Utils_p.h"
21#include "core/layouting/Item_p.h"
22#include "core/layouting/LayoutingGuest_p.h"
23#include "core/layouting/LayoutingSeparator_p.h"
24#include "core/WindowBeingDragged_p.h"
25#include "core/DelayedCall_p.h"
26#include "core/Group.h"
27#include "core/FloatingWindow.h"
28#include "core/DockWidget_p.h"
29#include "core/MainWindow.h"
34
35#include "Window_p.h"
36#include "kdbindings/signal.h"
37
38#include <algorithm>
39
40using namespace KDDockWidgets;
41using namespace KDDockWidgets::Core;
42
43namespace KDDockWidgets {
58
59namespace Core {
60class DropArea::Private
61{
62public:
63 explicit Private(DropArea *q, MainWindowOptions options, bool isMDIWrapper)
64 : m_isMDIWrapper(isMDIWrapper)
65 , m_dropIndicatorOverlay(createDropIndicatorOverlay(q))
66 , m_centralFrame(createCentralFrame(options))
67 {
68 }
69
70 bool m_inDestructor = false;
71 const bool m_isMDIWrapper;
72 QString m_affinityName;
73 ObjectGuard<DropIndicatorOverlay> m_dropIndicatorOverlay;
74 Core::Group *const m_centralFrame = nullptr;
75 Core::ItemBoxContainer *m_rootItem = nullptr;
76 KDBindings::ScopedConnection m_visibleWidgetCountConnection;
77};
78}
79
80}
81
82DropArea::DropArea(View *parent, MainWindowOptions options, bool isMDIWrapper)
83 : Layout(ViewType::DropArea, Config::self().viewFactory()->createDropArea(this, parent))
84 , d(new Private(this, options, isMDIWrapper))
85{
86 setRootItem(new Core::ItemBoxContainer(asLayoutingHost()));
88
89 if (parent)
90 setLayoutSize(parent->size());
91
92 // Initialize min size
94
95 KDDW_TRACE("DropArea CTOR");
96
97 if (d->m_isMDIWrapper) {
98 d->m_visibleWidgetCountConnection = Layout::d_ptr()->visibleWidgetCountChanged.connect([this] {
99 auto dw = mdiDockWidgetWrapper();
100 if (!dw) {
101 KDDW_ERROR("Unexpected null wrapper dock widget");
102 return;
103 }
104
105 if (visibleCount() > 0) {
106 // The title of our MDI group will need to change to the app name if we have more
107 // than 1 dock widget nested
108 dw->d->titleChanged.emit(dw->title());
109 } else {
110 // Our wrapeper isn't needed anymore
111 dw->destroyLater();
112 }
113 });
114 }
115
116 if (d->m_centralFrame)
117 addWidget(d->m_centralFrame->view(), KDDockWidgets::Location_OnTop, {});
118}
119
121{
122 d->m_inDestructor = true;
123 delete d->m_dropIndicatorOverlay;
124 delete d;
125 KDDW_TRACE("~DropArea");
126}
127
129{
130 const Core::Item::List children = d->m_rootItem->items_recursive();
132
133 for (const Core::Item *child : children) {
134 if (auto guest = child->guest()) {
135 if (!guest->freed()) {
136 if (auto group = Group::fromItem(child)) {
137 groups.push_back(group);
138 }
139 }
140 }
141 }
142
143 return groups;
144}
145
146Core::Group *DropArea::groupContainingPos(Point globalPos) const
147{
148 const Core::Item::List &items = this->items();
149 for (Core::Item *item : items) {
150 auto group = Group::fromItem(item);
151 if (!group || !group->isVisible()) {
152 continue;
153 }
154
155 if (group->containsMouse(globalPos))
156 return group;
157 }
158 return nullptr;
159}
160
161void DropArea::updateFloatingActions()
162{
163 const Core::Group::List groups = this->groups();
164 for (Core::Group *group : groups)
165 group->updateFloatingActions();
166}
167
168Core::Item *DropArea::centralFrame() const
169{
170 const auto items = this->items();
171 for (Core::Item *item : items) {
172 if (auto group = Group::fromItem(item)) {
173 if (group->isCentralFrame())
174 return item;
175 }
176 }
177 return nullptr;
178}
179
181{
182 return d->m_dropIndicatorOverlay;
183}
184
186 Core::DockWidget *relativeTo, InitialOption option)
187{
188 if (!dw || dw == relativeTo || location == Location_None) {
189 KDDW_ERROR("Invalid parameters {}, {} {}", ( void * )dw, ( void * )relativeTo, location);
190 return;
191 }
192
193 if ((option.visibility == InitialVisibilityOption::StartHidden) && dw->d->group() != nullptr) {
194 // StartHidden is just to be used at startup, not to moving stuff around
195 KDDW_ERROR("Dock widget already exists in the layout");
196 return;
197 }
198
199 if (!validateAffinity(dw))
200 return;
201
202 Core::DockWidget::Private::UpdateActions actionsUpdater(dw);
203
204 Core::Group *group = nullptr;
205 Core::Group *relativeToFrame = relativeTo ? relativeTo->d->group() : nullptr;
206
207 dw->d->saveLastFloatingGeometry();
208
209 const bool hadSingleFloatingFrame = hasSingleFloatingFrame();
210
211 // Check if the dock widget already exists in the layout
212 if (containsDockWidget(dw)) {
213 Core::Group *oldFrame = dw->d->group();
214 if (oldFrame->hasSingleDockWidget()) {
215 assert(oldFrame->containsDockWidget(dw));
216 // The group only has this dock widget, and the group is already in the layout. So move
217 // the group instead
218 group = oldFrame;
219 } else {
220 group = new Core::Group();
221 group->addTab(dw);
222 }
223 } else {
224 group = new Core::Group();
225 group->addTab(dw);
226 }
227
228 if (option.startsHidden()) {
229 addWidget(dw->view(), location, relativeToFrame, option);
230 } else {
231 addWidget(group->view(), location, relativeToFrame, option);
232 }
233
234 if (hadSingleFloatingFrame && !hasSingleFloatingFrame()) {
235 // The dock widgets that already existed in our layout need to have their floatAction()
236 // updated otherwise it's still checked. Only the dropped dock widget got updated
237 updateFloatingActions();
238 }
239}
240
242{
243 return dw->d->group() && Layout::containsFrame(dw->d->group());
244}
245
247{
248 const Core::Group::List groups = this->groups();
249 return groups.size() == 1 && groups.first()->isFloating();
250}
251
253{
254 return visibleCount() == 1;
255}
256
258{
259 if (auto mw = mainWindow()) {
260 return mw->affinities();
261 } else if (auto fw = floatingWindow()) {
262 return fw->affinities();
263 }
264
265 return {};
266}
267
269{
270 Core::Item *item = itemForFrame(dw->d->group());
271 if (!item) {
272 KDDW_ERROR("Item not found for dw={}, group={}", ( void * )dw, ( void * )dw->d->group());
273 return;
274 }
275
276 layoutEqually(item->parentBoxContainer());
277}
278
279DropLocation DropArea::hover(WindowBeingDragged *draggedWindow, Point globalPos)
280{
281 if (Config::self().dropIndicatorsInhibited() || !validateAffinity(draggedWindow))
282 return DropLocation_None;
283
284 if (!d->m_dropIndicatorOverlay) {
285 KDDW_ERROR("The frontend is missing a drop indicator overlay");
286 return DropLocation_None;
287 }
288
289 Core::Group *group = groupContainingPos(
290 globalPos); // Group is nullptr if MainWindowOption_HasCentralFrame isn't set
291 d->m_dropIndicatorOverlay->setWindowBeingDragged(true);
292 d->m_dropIndicatorOverlay->setHoveredGroup(group);
293 draggedWindow->updateTransparency(true);
294
295 return d->m_dropIndicatorOverlay->hover(globalPos);
296}
297
298static bool isOutterLocation(DropLocation location)
299{
300 switch (location) {
305 return true;
306 default:
307 return false;
308 }
309}
310
311bool DropArea::drop(WindowBeingDragged *droppedWindow, Point globalPos)
312{
313 // fv might be null, if on wayland
314 Core::View *fv = droppedWindow->floatingWindowView();
315
316 if (fv && fv->equals(window())) {
317 KDDW_ERROR("Refusing to drop onto itself"); // Doesn't happen
318 return false;
319 }
320
321 if (d->m_dropIndicatorOverlay->currentDropLocation() == DropLocation_None) {
322 KDDW_DEBUG("DropArea::drop: bailing out, drop location = none");
323 return false;
324 }
325
326 KDDW_DEBUG("DropArea::drop: {}", ( void * )droppedWindow);
327
328 hover(droppedWindow, globalPos);
329 auto droploc = d->m_dropIndicatorOverlay->currentDropLocation();
330 Core::Group *acceptingGroup = d->m_dropIndicatorOverlay->hoveredGroup();
331 if (!(acceptingGroup || isOutterLocation(droploc))) {
332 KDDW_ERROR("DropArea::drop: asserted with group={}, location={}", ( void * )acceptingGroup, droploc);
333 return false;
334 }
335
336 return drop(droppedWindow, acceptingGroup, droploc);
337}
338
339bool DropArea::drop(WindowBeingDragged *draggedWindow, Core::Group *acceptingGroup,
340 DropLocation droploc)
341{
342 Core::FloatingWindow *droppedWindow =
343 draggedWindow ? draggedWindow->floatingWindow() : nullptr;
344
345 if (isWayland() && !droppedWindow) {
346 // This is the Wayland special case.
347 // With other platforms, when detaching a tab or dock widget we create the FloatingWindow
348 // immediately. With Wayland we delay the floating window until we drop it. Ofc, we could
349 // just dock the dockwidget without the temporary FloatingWindow, but this way we reuse 99%
350 // of the rest of the code, without adding more wayland special cases
351 droppedWindow =
352 draggedWindow ? draggedWindow->draggable()->makeWindow()->floatingWindow() : nullptr;
353 if (!droppedWindow) {
354 // Doesn't happen
355 KDDW_ERROR("Wayland: Expected window {}", ( void * )draggedWindow);
356 return false;
357 }
358 }
359
360 bool result = true;
361 const bool needToFocusNewlyDroppedWidgets =
363 const Core::DockWidget::List droppedDockWidgets = needToFocusNewlyDroppedWidgets
364 ? droppedWindow->layout()->dockWidgets()
365 : Core::DockWidget::List(); // just so save some memory allocations for the case
366 // where this
367 // variable isn't used
368
369 switch (droploc) {
371 case DropLocation_Top:
374 result = drop(droppedWindow->view(),
375 DropIndicatorOverlay::multisplitterLocationFor(droploc), acceptingGroup);
376 break;
381 result = drop(droppedWindow->view(),
383 break;
385 KDDW_DEBUG("Tabbing window={} into group={}", ( void * )droppedWindow, ( void * )acceptingGroup);
386
387 if (!validateAffinity(droppedWindow, acceptingGroup))
388 return false;
389 acceptingGroup->addTab(droppedWindow);
390 break;
391
392 default:
393 KDDW_ERROR("DropArea::drop: Unexpected drop location = {}", d->m_dropIndicatorOverlay->currentDropLocation());
394 result = false;
395 break;
396 }
397
398 if (result) {
399 // Window receiving the drop gets raised
400 // Window receiving the drop gets raised.
401 // Exception: Under EGLFS we don't raise the fullscreen main window, as then all floating
402 // windows would go behind. It's also unneeded to raise, as it's fullscreen.
403
404 const bool isEGLFSRootWindow =
405 isEGLFS() && (view()->window()->isFullScreen() || window()->isMaximized());
406 if (!isEGLFSRootWindow)
408
409 if (needToFocusNewlyDroppedWidgets) {
410 // Let's also focus the newly dropped dock widget
411 if (!droppedDockWidgets.isEmpty()) {
412 // If more than 1 was dropped, we only focus the first one
413 Core::Group *group = droppedDockWidgets.first()->d->group();
414 group->FocusScope::focus(Qt::MouseFocusReason);
415 } else {
416 // Doesn't happen.
417 KDDW_ERROR("Nothing was dropped?");
418 }
419 }
420 }
421
422 return result;
423}
424
425bool DropArea::drop(View *droppedWindow, KDDockWidgets::Location location,
426 Core::Group *relativeTo)
427{
428 KDDW_DEBUG("DropArea::addFrame");
429
430 if (auto dock = droppedWindow->asDockWidgetController()) {
431 if (!validateAffinity(dock))
432 return false;
433
434 auto group = new Core::Group();
435 group->addTab(dock);
436 addWidget(group->view(), location, relativeTo, DefaultSizeMode::FairButFloor);
437 } else if (auto floatingWindow = droppedWindow->asFloatingWindowController()) {
438 if (!validateAffinity(floatingWindow))
439 return false;
440
441 addMultiSplitter(floatingWindow->dropArea(), location, relativeTo,
443
445 return true;
446 } else {
447 KDDW_ERROR("Unknown dropped widget {}", ( void * )droppedWindow);
448 return false;
449 }
450
451 return true;
452}
453
455{
456 d->m_dropIndicatorOverlay->removeHover();
457}
458
459template<typename T>
460bool DropArea::validateAffinity(T *window, Core::Group *acceptingGroup) const
461{
462 if (!DockRegistry::self()->affinitiesMatch(window->affinities(), affinities())) {
463 return false;
464 }
465
466 if (acceptingGroup) {
467 // We're dropping into another group (as tabbed), so also check the affinity of the group
468 // not only of the main window, which might be more forgiving
469 if (!DockRegistry::self()->affinitiesMatch(window->affinities(),
470 acceptingGroup->affinities())) {
471 return false;
472 }
473 }
474
475 return true;
476}
477
479{
480 return d->m_isMDIWrapper;
481}
482
484{
485 if (d->m_isMDIWrapper) {
486 return view()->parentView()->asDockWidgetController();
487 }
488
489 return nullptr;
490}
491
492Core::Group *DropArea::createCentralFrame(MainWindowOptions options)
493{
494 Core::Group *group = nullptr;
495
496 if (options & MainWindowOption_HasCentralFrame) {
497 FrameOptions groupOptions = FrameOption_IsCentralFrame;
498 const bool hasPersistentCentralWidget =
500 if (hasPersistentCentralWidget) {
501 groupOptions |= FrameOption_NonDockable;
502 } else {
503 // With a persistent central widget we don't allow detaching it
504 groupOptions |= FrameOption_AlwaysShowsTabs;
505 }
506
507 group = new Core::Group(nullptr, groupOptions);
508 group->setObjectName(QStringLiteral("central group"));
509 }
510
511 return group;
512}
513
514
515bool DropArea::validateInputs(View *widget, Location location,
516 const Core::Group *relativeToFrame, InitialOption option) const
517{
518 if (!widget) {
519 KDDW_ERROR("Widget is null");
520 return false;
521 }
522
523 const bool isDockWidget = widget->is(ViewType::DockWidget);
524 const bool isStartHidden = option.startsHidden();
525
526 const bool isLayout = widget->is(ViewType::DropArea) || widget->is(ViewType::MDILayout);
527 if (!widget->is(ViewType::Frame) && !isLayout && !isDockWidget) {
528 KDDW_ERROR("Unknown widget type {}", ( void * )widget);
529 return false;
530 }
531
532 if (isDockWidget != isStartHidden) {
533 KDDW_ERROR("Wrong parameters isDockWidget={}, isStartHidden={}", isDockWidget, isStartHidden);
534 return false;
535 }
536
537 if (relativeToFrame && relativeToFrame->view()->equals(widget)) {
538 KDDW_ERROR("widget can't be relative to itself");
539 return false;
540 }
541
542 Core::Item *item = itemForFrame(widget->asGroupController());
543
544 if (containsItem(item)) {
545 KDDW_ERROR("DropArea::addWidget: Already contains w={}", ( void * )widget);
546 return false;
547 }
548
549 if (location == Location_None) {
550 KDDW_ERROR("DropArea::addWidget: not adding to location None");
551 return false;
552 }
553
554 const bool relativeToThis = relativeToFrame == nullptr;
555
556 Core::Item *relativeToItem = itemForFrame(relativeToFrame);
557 if (!relativeToThis && !containsItem(relativeToItem)) {
558 KDDW_ERROR("DropArea::addWidget: Doesn't contain relativeTo: relativeToGroup={}, relativeToItem{}, options={}", ( void * )relativeToFrame, "; relativeToItem=", ( void * )relativeToItem, option);
559 return false;
560 }
561
562 return true;
563}
564
565void DropArea::addWidget(View *w, Location location, Core::Group *relativeToWidget,
566 InitialOption option)
567{
568
569 auto group = w->asGroupController();
570 if (itemForFrame(group) != nullptr) {
571 // Item already exists, remove it.
572 // Changing the group parent will make the item clean itself up. It turns into a placeholder
573 // and is removed by unrefOldPlaceholders
574 group->setParentView(nullptr); // so ~Item doesn't delete it
575 group->setLayoutItem(nullptr); // so Item is destroyed, as there's no refs to it
576 }
577
578 // Make some sanity checks:
579 if (!validateInputs(w, location, relativeToWidget, option))
580 return;
581
582 Core::Item *relativeTo = itemForFrame(relativeToWidget);
583 if (!relativeTo)
584 relativeTo = d->m_rootItem;
585
586 Core::Item *newItem = nullptr;
587
590 auto dw = w->asDockWidgetController();
591
592 if (group) {
593 newItem = new Core::Item(asLayoutingHost());
594 newItem->setGuest(group->asLayoutingGuest());
595 } else if (dw) {
596 newItem = new Core::Item(asLayoutingHost());
597 group = new Core::Group();
598 newItem->setGuest(group->asLayoutingGuest());
599 group->addTab(dw, option);
600 } else if (auto ms = w->asDropAreaController()) {
601 newItem = ms->d->m_rootItem;
602 newItem->setHost(asLayoutingHost());
603
604 if (auto fw = ms->floatingWindow()) {
605 newItem->setSize_recursive(fw->size());
606 }
607
608 delete ms;
609 } else {
610 // This doesn't happen but let's make coverity happy.
611 // Tests will fail if this is ever printed.
612 KDDW_ERROR("Unknown widget added", ( void * )w);
613 return;
614 }
615
616 assert(!newItem->geometry().isEmpty());
617 Core::ItemBoxContainer::insertItemRelativeTo(newItem, relativeTo, location, option);
618
619 if (dw && option.startsHidden())
620 delete group;
621}
622
623void DropArea::addMultiSplitter(Core::DropArea *sourceMultiSplitter, Location location,
624 Core::Group *relativeTo, InitialOption option)
625{
626 KDDW_DEBUG("DropArea::addMultiSplitter: {} {} {}", ( void * )sourceMultiSplitter, ( int )location, ( void * )relativeTo);
627 addWidget(sourceMultiSplitter->view(), location, relativeTo, option);
628
629 // Some widgets changed to/from floating
630 updateFloatingActions();
631}
632
634{
635 return d->m_rootItem->separators_recursive();
636}
637
638int DropArea::availableLengthForOrientation(Qt::Orientation orientation) const
639{
640 if (orientation == Qt::Vertical)
641 return availableSize().height();
642 else
643 return availableSize().width();
644}
645
646Size DropArea::availableSize() const
647{
648 return d->m_rootItem->availableSize();
649}
650
652{
653 if (!checkSanity())
654 return;
655
656 dumpLayout();
657
658 layoutEqually(d->m_rootItem);
659}
660
661void DropArea::layoutEqually(Core::ItemBoxContainer *container)
662{
663 if (container) {
664 container->layoutEqually_recursive();
665 } else {
666 KDDW_ERROR("null container");
667 }
668}
669
670void DropArea::setRootItem(Core::ItemBoxContainer *root)
671{
673 d->m_rootItem = root;
674}
675
676Core::ItemBoxContainer *DropArea::rootItem() const
677{
678 return d->m_rootItem;
679}
680
681Rect DropArea::rectForDrop(const WindowBeingDragged *wbd, Location location,
682 const Core::Item *relativeTo) const
683{
684 Core::Item item(nullptr);
685 if (!wbd)
686 return {};
687
688 item.setSize(wbd->size().boundedTo(wbd->maxSize()));
689 item.setMinSize(wbd->minSize());
690 item.setMaxSizeHint(wbd->maxSize());
691
692 Core::ItemBoxContainer *container =
693 relativeTo ? relativeTo->parentBoxContainer() : d->m_rootItem;
694
695 return container->suggestedDropRect(&item, relativeTo, location);
696}
697
698bool DropArea::deserialize(const LayoutSaver::MultiSplitter &l)
699{
700 setRootItem(new Core::ItemBoxContainer(asLayoutingHost()));
701 return Layout::deserialize(l);
702}
703
705{
706 return d->m_rootItem->numSideBySide_recursive(o);
707}
708
710{
711 return d->m_dropIndicatorOverlay ? d->m_dropIndicatorOverlay->currentDropLocation() : DropLocation_None;
712}
713
714Core::Group *DropArea::centralGroup() const
715{
716 return d->m_centralFrame;
717}
Application-wide config to tune certain behaviours of the framework.
A ScopedConnection is a RAII-style way to make sure a Connection is disconnected.
Definition signal.h:533
Singleton to allow to choose certain behaviours of the framework.
Definition Config.h:64
static Config & self()
returns the singleton Config instance
Definition Config.cpp:87
Flags flags() const
returns the chosen flags
Definition Config.cpp:98
void setParentView(View *parent)
View * view() const
Returns the view associated with this controller, if any.
std::shared_ptr< View > window() const
The DockWidget base-class. DockWidget and Core::DockWidget are only split in two so we can share some...
Vector< DockWidget * > List
void layoutParentContainerEqually(DockWidget *)
void addDockWidget(DockWidget *dw, KDDockWidgets::Location location, DockWidget *relativeTo, InitialOption initialOption={})
DropArea(View *parent, MainWindowOptions options, bool isMDIWrapper=false)
void addWidget(View *widget, KDDockWidgets::Location location, Core::Group *relativeTo=nullptr, InitialOption option=DefaultSizeMode::Fair)
Adds a widget to this MultiSplitter.
Vector< Core::Group * > groups() const
bool deserialize(const LayoutSaver::MultiSplitter &) override
DropIndicatorOverlay * dropIndicatorOverlay() const
Vector< Core::LayoutingSeparator * > separators() const
returns the list of separators
bool containsDockWidget(DockWidget *) const
Vector< QString > affinities() const
Core::Item * centralFrame() const
void addMultiSplitter(Core::DropArea *splitter, KDDockWidgets::Location location, Core::Group *relativeTo=nullptr, InitialOption option=DefaultSizeMode::Fair)
int numSideBySide_recursive(Qt::Orientation) const
Returns the number of items layed-out horizontally or vertically But honours nesting.
DropLocation currentDropLocation() const
Core::ItemBoxContainer * rootItem() const
bool drop(WindowBeingDragged *droppedWindow, Point globalPos)
Called when a user drops a widget via DND.
Core::DockWidget * mdiDockWidgetWrapper() const
Returns the helper dock widget for implementing DockWidget::Option_MDINestable.
static Core::Group * createCentralFrame(MainWindowOptions options)
Rect rectForDrop(const WindowBeingDragged *wbd, KDDockWidgets::Location location, const Core::Item *relativeTo) const
void layoutEqually()
See docs for MainWindowBase::layoutEqually()
DropLocation hover(WindowBeingDragged *draggedWindow, Point globalPos)
static KDDockWidgets::Location multisplitterLocationFor(DropLocation)
std::unique_ptr< WindowBeingDragged > makeWindow() override
Layout * layout() const
Returns the Layout.
void scheduleDeleteLater()
Equivalent to deleteLater() but sets beingDeleted() to true.
bool hasSingleDockWidget() const
returns whether there's only 1 dock widget.
Definition core/Group.h:196
void addTab(DockWidget *, InitialOption={})
Adds a widget into the Group's Stack.
static Core::Group * fromItem(const Core::Item *)
Returns the group that's in the specified item.
Vector< QString > affinities() const
bool containsDockWidget(DockWidget *w) const
returns whether the dockwidget w is inside this group
The widget (QWidget or QQuickItem) which holds a layout of dock widgets.
Definition Layout.h:57
bool containsItem(const Core::Item *) const
Returns true if this layout contains the specified item.
Definition Layout.cpp:202
Layout::Private * d_ptr()
Definition Layout.cpp:375
void unrefOldPlaceholders(const Vector< Core::Group * > &groupsBeingAdded) const
Removes unneeded placeholder items when adding new groups.
Definition Layout.cpp:178
int visibleCount() const
Returns the number of visible Items in this layout. Which is count minus placeholderCount.
Definition Layout.cpp:217
void setRootItem(Core::ItemContainer *root)
Definition Layout.cpp:104
void setLayoutSize(Size)
setter for the contents size The "contents size" is just the size() of this layout....
Definition Layout.cpp:188
virtual bool deserialize(const LayoutSaver::MultiSplitter &)
Definition Layout.cpp:288
LayoutingHost * asLayoutingHost() const
Definition Layout.cpp:370
bool checkSanity() const
Runs some sanity checks. Returns true if everything is OK.
Definition Layout.cpp:144
Core::Item * itemForFrame(const Core::Group *group) const
returns the Item that holds group in this layout
Definition Layout.cpp:227
void dumpLayout() const
dumps the layout to stderr
Definition Layout.cpp:149
Vector< Core::Group * > groupsFrom(View *groupOrMultiSplitter) const
returns the groups contained in groupOrMultiSplitter- If groupOrMultiSplitter- is a Group,...
Definition Layout.cpp:245
Vector< Core::Item * > items() const
The list of items in this layout.
Definition Layout.cpp:197
void updateSizeConstraints()
Updates the min size of this layout.
Definition Layout.cpp:282
bool containsFrame(const Core::Group *) const
Returns true if this layout contains the specified group.
Definition Layout.cpp:207
Core::MainWindow * mainWindow(bool honourNesting=false) const
Definition Layout.cpp:73
Vector< Core::DockWidget * > dockWidgets() const
Returns the list of dock widgets contained in this layout.
Definition Layout.cpp:235
Core::FloatingWindow * floatingWindow() const
Definition Layout.cpp:98
A dummy DropIndicatorOverlay implementation which doesn't do anything.
static DropIndicatorType s_dropIndicatorType
@ The drop indicator type
bool equals(const View *other) const
Returns whether this view represents the same GUI element as the other.
virtual void raiseAndActivate()=0
virtual std::shared_ptr< View > parentView() const =0
Returns the gui element's parent. Like QWidget::parentWidget()
Core::FloatingWindow * asFloatingWindowController() const
asFooController() are deprecated. Use asController<T>() instead
virtual bool is(ViewType) const
Returns whether the view is of the specified type Virtual so it can be overridden by ViewWrapper....
Core::Group * asGroupController() const
virtual std::shared_ptr< Core::Window > window() const =0
Returns the window this view is inside For the Qt frontend, this wraps a QWindow. Like QWidget::windo...
Core::DropArea * asDropAreaController() const
Core::DockWidget * asDockWidgetController() const
static DockRegistry * self()
void registerLayout(Core::Layout *)
static bool isOutterLocation(DropLocation location)
The MainWindow base-class that's shared between QtWidgets and QtQuick stack.
ViewType
Each View type also has a specific Controller associated with, except for ViewType::None.
Definition Controller.h:26
Class to abstract QAction, so code still works with QtQuick and Flutter.
@ MainWindowOption_HasCentralWidget
@ MainWindowOption_HasCentralFrame
‍No option set
@ Location_OnTop
‍Left docking location
@ None
Don't show any drop indicators while dragging.
@ Segmented
Segmented indicators.
DropLocation
Enum describing the different drop indicator types.
static Core::DropIndicatorOverlay * createDropIndicatorOverlay(Core::DropArea *dropArea)
@ StartHidden
Don't show the dock widget when adding it.
MouseFocusReason
Orientation
A MultiSplitter with support for drop indicators when hovering over.
Struct describing the preferred dock widget size and visibility when adding it to a layout.
InitialVisibilityOption visibility
Allows a dock widget to be docked as hidden.

© 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