KDDockWidgets API Documentation 2.0
Loading...
Searching...
No Matches
core/DockWidget.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
22#ifndef KD_CONTROLLERS_DOCKWIDGET_H
23#define KD_CONTROLLERS_DOCKWIDGET_H
24#pragma once
25
26#include "kddockwidgets/docks_export.h"
27#include "kddockwidgets/KDDockWidgets.h"
28#include "kddockwidgets/LayoutSaver.h"
29#include "kddockwidgets/core/Controller.h"
30#include "kddockwidgets/core/Action.h"
31
32#include <memory>
33
34// clazy:excludeall=ctor-missing-parent-argument
35
36class TestDocks;
37
38namespace KDDockWidgets {
39
40class DockRegistry;
41class LayoutSaver;
42
43namespace Core {
44
45class DragController;
46class MainWindow;
47class FloatingWindow;
48class Group;
49class Layout;
50class TitleBar;
51
59class DOCKS_EXPORT DockWidget : public Controller
60{
61 Q_OBJECT
62public:
64
75 explicit DockWidget(View *view, const QString &uniqueName, DockWidgetOptions options = {},
76 LayoutSaverOptions layoutSaverOptions = {});
77
79 ~DockWidget() override;
80
81 void init();
82
91 void addDockWidgetAsTab(KDDockWidgets::Core::DockWidget *other,
92 KDDockWidgets::InitialOption initialOption = {});
93
107 void
108 addDockWidgetToContainingWindow(KDDockWidgets::Core::DockWidget *other,
110 KDDockWidgets::Core::DockWidget *relativeTo = nullptr,
111 KDDockWidgets::InitialOption initialOption = {});
112
122 void setGuestView(std::shared_ptr<View> guest);
123
125 std::shared_ptr<View> guestView() const;
126
134 bool isFloating() const;
135
142 bool setFloating(bool floats);
143
145 FloatingWindow *floatingWindow() const;
146
151 Action *toggleAction() const;
152
157 Action *floatAction() const;
158
163 QString uniqueName() const;
164
170 QString title() const;
171
177 void setTitle(const QString &title);
178
189 Rect groupGeometry() const;
190
195 DockWidgetOptions options() const;
196
199 KDDockWidgets::LayoutSaverOptions layoutSaverOptions() const;
200
208 void setOptions(DockWidgetOptions);
209
218 bool isTabbed() const;
219
226 bool isCurrentTab() const;
227
231 void setAsCurrentTab();
232
238 int tabIndex() const;
239
243 int currentTabIndex() const;
244
253 void setIcon(const Icon &icon, IconPlaces places = IconPlace::All);
254
263 Icon icon(IconPlace place = IconPlace::TitleBar) const;
264
269 void forceClose();
270
277 Core::TitleBar *titleBar() const;
278
283 bool isOpen() const;
284
303 void setAffinities(const Vector<QString> &);
304
307 void setAffinityName(const QString &name);
308
312 Vector<QString> affinities() const;
313
318 void open();
319
324 void show();
325
334 void raise();
335
346 bool isMainWindow() const;
347
355 bool isInMainWindow() const;
356
359 MainWindow *mainWindow() const;
360
365 bool isFocused() const;
366
376 void moveToSideBar();
377
382 bool isOverlayed() const;
383
388 SideBarLocation sideBarLocation() const;
389
392 bool isInSideBar() const;
393
398 bool hasPreviousDockedLocation() const;
399
402 Size lastOverlayedSize() const;
403
408 Size sizeInLayout() const;
409
428 void resizeInLayout(int left, int top, int right, int bottom);
429
433 static DockWidget *byName(const QString &uniqueName);
434
436 bool skipsRestore() const;
437
445 void setFloatingGeometry(Rect geo);
446
451 void setUserType(int userType);
452 int userType() const;
453
456 void setMDIPosition(Point pos);
458 void setMDISize(Size size);
461 void setMDIZ(int z);
462
465 bool isPersistentCentralDockWidget() const;
466
467 void onResize(Size newSize);
468
475 void setFloatingWindowFlags(FloatingWindowFlags);
476 KDDockWidgets::FloatingWindowFlags floatingWindowFlags() const;
477
481 bool startDragging(bool singleTab = false);
482
485 bool wasRestored() const;
486
487protected:
488 void setParentView_impl(View *parent) override;
489
490public:
493 class Private;
494 Private *dptr() const;
495 Private *const d;
496
501 static DockWidget *deserialize(const std::shared_ptr<LayoutSaver::DockWidget> &);
502
503private:
505};
506
507}
508
509}
510
511#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...
Vector< DockWidget * > List
Class to abstract QAction, so code still works with QtQuick and Flutter.
SideBarLocation
Each main window supports 4 sidebars.
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