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 const KDDockWidgets::InitialOption &initialOption = {});
93
107 void
108 addDockWidgetToContainingWindow(KDDockWidgets::Core::DockWidget *other,
110 KDDockWidgets::Core::DockWidget *relativeTo = nullptr,
111 const 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
379 void removeFromSideBar();
380
385 bool isOverlayed() const;
386
391 SideBarLocation sideBarLocation() const;
392
395 bool isInSideBar() const;
396
401 bool hasPreviousDockedLocation() const;
402
405 Size lastOverlayedSize() const;
406
411 Size sizeInLayout() const;
412
431 void resizeInLayout(int left, int top, int right, int bottom);
432
436 static DockWidget *byName(const QString &uniqueName);
437
439 bool skipsRestore() const;
440
442 CloseReason lastCloseReason() const;
443
451 void setFloatingGeometry(Rect geo);
452
457 void setUserType(int userType);
458 int userType() const;
459
462 void setMDIPosition(Point pos);
464 void setMDISize(Size size);
467 void setMDIZ(int z);
468
473 int mdiZ() const;
474
477 bool isPersistentCentralDockWidget() const;
478
479 void onResize(Size newSize);
480
487 void setFloatingWindowFlags(FloatingWindowFlags);
488 KDDockWidgets::FloatingWindowFlags floatingWindowFlags() const;
489
493 bool startDragging(bool singleTab = false);
494
497 bool wasRestored() const;
498
504 void setUniqueName(const QString &);
505
506protected:
507 void setParentView_impl(View *parent) override;
508
509public:
512 class Private;
513 Private *dptr() const;
514 Private *const d;
515
520 static DockWidget *deserialize(const std::shared_ptr<LayoutSaver::DockWidget> &);
521
522private:
524};
525
526}
527
528}
529
530#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.
@ Action
User clicked titlebar close button.
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