KDDockWidgets API Documentation 2.0
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
16#include "kddockwidgets/core/MainWindow.h"
17#include "kddockwidgets/core/DockRegistry.h"
18
19namespace KDDockWidgets::Core {
20
22 : m_mainWindow(controller)
23{
24}
25
27
32
37
42
47
48MainWindowOptions MainWindowViewInterface::options() const
49{
50 return m_mainWindow->options();
51}
52
54{
55 return m_mainWindow->isMDI();
56}
57
62
67
69{
71}
72
77
79{
80 auto dw = dockView ? dockView->dockWidget() : nullptr;
82}
83
86 DockWidgetViewInterface *relativeToDockView,
87 KDDockWidgets::InitialOption initialOption)
88{
89 auto dw = dockView ? dockView->dockWidget() : nullptr;
90 auto relativeTo = relativeToDockView ? relativeToDockView->dockWidget() : nullptr;
91 m_mainWindow->addDockWidget(dw, location, relativeTo, initialOption);
92}
93
98
100{
101 auto dw = dockView ? dockView->dockWidget() : nullptr;
103}
104
107{
108 auto dw = dockView ? dockView->dockWidget() : nullptr;
109 m_mainWindow->moveToSideBar(dw, loc);
110}
111
113{
114 auto dw = dockView ? dockView->dockWidget() : nullptr;
116}
117
119{
120 auto dw = dockView ? dockView->dockWidget() : nullptr;
122}
123
125{
126 auto dw = dockView ? dockView->dockWidget() : nullptr;
128}
129
131{
132 auto dw = dockView ? dockView->dockWidget() : nullptr;
134}
135
136
138{
139 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
141 } else {
142 KDDW_ERROR("Could not find dock widget {}", dockId);
143 }
144}
145
148{
149 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
150 m_mainWindow->moveToSideBar(dw, loc);
151 } else {
152 KDDW_ERROR("Could not find dock widget {}", dockId);
153 }
154}
155
157{
158 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
160 } else {
161 KDDW_ERROR("Could not find dock widget {}", dockId);
162 }
163}
164
166{
167 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
169 } else {
170 KDDW_ERROR("Could not find dock widget {}", dockId);
171 }
172}
173
175{
176 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
178 } else {
179 KDDW_ERROR("Could not find dock widget {}", dockId);
180 }
181}
182
184{
185 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
187 } else {
188 KDDW_ERROR("Could not find dock widget {}", dockId);
189 }
190}
191
193{
194 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
196 } else {
197 KDDW_ERROR("Could not find dock widget {}", dockId);
198 }
199}
200
202 const QString &relativeToDockId,
203 KDDockWidgets::InitialOption initialOption)
204{
205 if (Core::DockWidget *dw = DockRegistry::self()->dockByName(dockId)) {
206 auto relativeTo = relativeToDockId.isEmpty()
207 ? nullptr
208 : DockRegistry::self()->dockByName(relativeToDockId);
209 m_mainWindow->addDockWidget(dw, location, relativeTo, initialOption);
210 } else {
211 KDDW_ERROR("Could not find dock widget {}", dockId);
212 }
213}
214
215}
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 setAffinities(const Vector< QString > &names)
void addDockWidget(DockWidgetViewInterface *dockWidget, KDDockWidgets::Location location, DockWidgetViewInterface *relativeTo=nullptr, KDDockWidgets::InitialOption initialOption={})
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.
void clearSideBarOverlay(bool deleteFrame=true)
closes any overlayed dock widget. The sidebar still displays them as button.
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 addDockWidget(KDDockWidgets::Core::DockWidget *dockWidget, KDDockWidgets::Location location, KDDockWidgets::Core::DockWidget *relativeTo=nullptr, KDDockWidgets::InitialOption initialOption={})
Docks a DockWidget into this main window.
void layoutEqually()
layouts all the widgets so they have an equal size within their parent container
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.
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