13#include "DockWidget_p.h"
16#include "core/Logging_p.h"
20#include <unordered_map>
31 auto it = connections.find(dw);
32 if (it == connections.end()) {
33 KDDW_ERROR(
"Could not find DockWidget to remove in side bar connections");
35 connections.erase(it);
38 std::unordered_map<DockWidget *, KDBindings::ScopedConnection> connections;
44 , m_mainWindow(parent)
45 , m_location(location)
64 if (m_dockWidgets.contains(dw)) {
65 KDDW_ERROR(
"Already contains dock widget with title={}", dw->
title());
70 d->connections[dw] = std::move(conn);
72 m_dockWidgets.push_back(dw);
79 if (!m_dockWidgets.contains(dw)) {
80 KDDW_ERROR(
"Doesn't contain dock widget with title={}", dw->
title());
84 d->removeConnection(dw);
85 m_dockWidgets.removeOne(dw);
87 dw->
d->removedFromSideBar.emit();
93 return m_dockWidgets.contains(dw);
101void SideBar::updateSize()
103 const int thickness =
isEmpty() ? 0 : 30;
113 return m_orientation;
118 return m_dockWidgets.isEmpty();
139 ids.
reserve(m_dockWidgets.size());
148 for (
DockWidget *dw : std::as_const(m_dockWidgets))
154 return m_dockWidgets;
Application-wide config to tune certain behaviours of the framework.
A ScopedConnection is a RAII-style way to make sure a Connection is disconnected.
The MainWindow base-class. MainWindow and MainWindowBase are only split in two so we can share some c...
void toggleOverlayOnSideBar(KDDockWidgets::Core::DockWidget *dw)
Shows or hides an overlay. It's assumed the dock widget is already in a side-bar.
QMainWindow sub-class to enable KDDockWidgets support.