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)
71 if (m_dockWidgets.contains(dw)) {
72 KDDW_ERROR(
"Already contains dock widget with title={}", dw->
title());
77 d->connections[dw] = std::move(conn);
79 m_dockWidgets.push_back(dw);
86 if (!m_dockWidgets.contains(dw)) {
87 KDDW_ERROR(
"Doesn't contain dock widget with title={}", dw->
title());
91 d->removeConnection(dw);
92 m_dockWidgets.removeOne(dw);
94 dw->
d->removedFromSideBar.emit();
100 return m_dockWidgets.contains(dw);
108void SideBar::updateVisibility()
115 return m_orientation;
120 return m_dockWidgets.isEmpty();
141 ids.
reserve(m_dockWidgets.size());
150 for (
DockWidget *dw : std::as_const(m_dockWidgets))
156 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.