KDDockWidgets API Documentation 2.1
Loading...
Searching...
No Matches
MainWindowViewInterface.cpp
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2020 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
14#include "core/Logging_p.h"
15#include "kddockwidgets/core/MainWindow.h"
16#include "kddockwidgets/core/DockRegistry.h"
17
18namespace KDDockWidgets::Core {
19
21 : m_mainWindow(controller)
22{
23}
24
26
31
36
41
46
47MainWindowOptions MainWindowViewInterface::options() const
48{
49 return m_mainWindow->options();
50}
51
53{
54 return m_mainWindow->isMDI();
55}
56
61
66
68{
70}
71
76
78{
79 auto dw = dockView ? dockView->dockWidget() : nullptr;
81}
82
85 DockWidgetViewInterface *relativeToDockView,
86 const KDDockWidgets::InitialOption &initialOption)
87{
88 auto dw = dockView ? dockView->dockWidget() : nullptr;
89 auto relativeTo = relativeToDockView ? relativeToDockView->dockWidget() : nullptr;
90 m_mainWindow->addDockWidget(dw, location, relativeTo, initialOption);
91}
92
97
99{
100 auto dw = dockView ? dockView->dockWidget() : nullptr;
102}
103
106{
107 auto dw = dockView ? dockView->dockWidget() : nullptr;
108 m_mainWindow->moveToSideBar(dw, loc);
109}
110
112{
113 auto dw = dockView ? dockView->dockWidget() : nullptr;
115}
116
118{
119 auto dw = dockView ? dockView->dockWidget() : nullptr;
121}
122
124{
125 auto dw = dockView ? dockView->dockWidget() : nullptr;
127}
128
130{
131 auto dw = dockView ? dockView->dockWidget() : nullptr;
133}
134
135
137{
138 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
140 } else {
141 KDDW_ERROR("Could not find dock widget {}", dockId);
142 }
143}
144
147{
148 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
149 m_mainWindow->moveToSideBar(dw, loc);
150 } else {
151 KDDW_ERROR("Could not find dock widget {}", dockId);
152 }
153}
154
156{
157 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
159 } else {
160 KDDW_ERROR("Could not find dock widget {}", dockId);
161 }
162}
163
165{
166 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
168 } else {
169 KDDW_ERROR("Could not find dock widget {}", dockId);
170 }
171}
172
174{
175 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
177 } else {
178 KDDW_ERROR("Could not find dock widget {}", dockId);
179 }
180}
181
183{
184 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
186 } else {
187 KDDW_ERROR("Could not find dock widget {}", dockId);
188 }
189}
190
192{
193 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
195 } else {
196 KDDW_ERROR("Could not find dock widget {}", dockId);
197 }
198}
199
201 const QString &relativeToDockId,
202 const KDDockWidgets::InitialOption &initialOption)
203{
204 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
205 auto relativeTo = relativeToDockId.isEmpty()
206 ? nullptr
207 : DockRegistry::self()->dockByName(relativeToDockId);
208 m_mainWindow->addDockWidget(dw, location, relativeTo, initialOption);
209 } else {
210 KDDW_ERROR("Could not find dock widget {}", dockId);
211 }
212}
213
214void MainWindowViewInterface::setPersistentCentralView(std::shared_ptr<Core::View> view)
215{
216 assert(m_mainWindow);
218}
219
220}
The interface that DockWidget views should implement.
The DockWidget base-class. DockWidget and Core::DockWidget are only split in two so we can share some...
MainWindow * mainWindow() const
Returns the main window controller.
void addDockWidgetAsTab(DockWidgetViewInterface *dockwidget)
void addDockWidget(DockWidgetViewInterface *dockWidget, KDDockWidgets::Location location, DockWidgetViewInterface *relativeTo=nullptr, const KDDockWidgets::InitialOption &initialOption={})
void setPersistentCentralView(std::shared_ptr< Core::View >)
void setAffinities(const Vector< QString > &names)
void layoutParentContainerEqually(DockWidgetViewInterface *)
bool sideBarIsVisible(KDDockWidgets::SideBarLocation) const
The MainWindow base-class. MainWindow and MainWindowBase are only split in two so we can share some c...
bool sideBarIsVisible(KDDockWidgets::SideBarLocation location) const
Returns whether the specified sidebar is visible.
void setAffinities(const Vector< QString > &names)
Sets the affinities names. Dock widgets can only dock into main windows of the same affinity.
QString uniqueName() const
Returns the unique name that was passed via constructor. Used internally by the save/restore mechanis...
void addDockWidgetAsTab(KDDockWidgets::Core::DockWidget *dockwidget)
Docks a DockWidget into the central group, tabbed.
void overlayOnSideBar(KDDockWidgets::Core::DockWidget *dw)
Shows the dock widget overlayed on top of the main window, placed next to the sidebar.
void toggleOverlayOnSideBar(KDDockWidgets::Core::DockWidget *dw)
Shows or hides an overlay. It's assumed the dock widget is already in a side-bar.
void layoutParentContainerEqually(KDDockWidgets::Core::DockWidget *dockWidget)
like layoutEqually() but starts with the container that has dockWidget. While layoutEqually() starts ...
bool anySideBarIsVisible() const
Returns whether any side bar is visible.
void setPersistentCentralView(std::shared_ptr< View > widget)
Sets a persistent central widget. It can't be detached.
void layoutEqually()
layouts all the widgets so they have an equal size within their parent container
void clearSideBarOverlay(bool deleteGroup=true)
closes any overlayed dock widget. The sidebar still displays them as button.
MainWindowOptions options() const
Returns the main window options that were passed via constructor.
void moveToSideBar(KDDockWidgets::Core::DockWidget *dw)
Moves the dock widget into one of the MainWindow's sidebar. Means the dock widget is removed from the...
bool closeDockWidgets(bool force=false)
Closes all dock widgets which are docked into this main window This is convenience to calling DockWid...
bool isMDI() const
Returns whether this main window is using an MDI layout. In other words, returns true if MainWindowOp...
Vector< QString > affinities() const
Returns the list of affinity names. Empty by default.
void restoreFromSideBar(KDDockWidgets::Core::DockWidget *dw)
Removes the dock widget from the sidebar and docks it into the main window again.
void addDockWidget(KDDockWidgets::Core::DockWidget *dockWidget, KDDockWidgets::Location location, KDDockWidgets::Core::DockWidget *relativeTo=nullptr, const KDDockWidgets::InitialOption &initialOption={})
Docks a DockWidget into this main window.
Q_INVOKABLE KDDockWidgets::Core::DockWidget * dockByName(const QString &, KDDockWidgets::DockRegistry::DockByNameFlags={}) const
static DockRegistry * self()
SideBarLocation
Each main window supports 4 sidebars.
bool isEmpty() const const
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