13#include "kddockwidgets/core/DockRegistry.h"
14#include "core/DockWidget_p.h"
24class DockWidgetInstantiator::Private
27 std::optional<bool> m_isFloating;
60 return d->m_uniqueName;
65 d->m_uniqueName = name;
71 return d->m_sourceFilename;
76 d->m_sourceFilename =
source;
82 if (d->m_dockWidget) {
91 return d->m_dockWidget;
97 return dockView->actualTitleBarView();
105 return d->m_dockWidget ? d->m_dockWidget->title() :
QString();
111 d->m_dockWidget->setTitle(
title);
117 return d->m_dockWidget && d->m_dockWidget->isFocused();
122 return d->m_dockWidget && d->m_dockWidget->isFloating();
127 return d->m_dockWidget && d->m_dockWidget->isOpen();
133 d->m_dockWidget->setFloating(is);
134 d->m_isFloating = is;
139 if (!other || !d->m_dockWidget)
143 d->m_dockWidget->addDockWidgetAsTab(otherDockWidget, option);
147 QQuickItem *relativeTo,
151 if (!other || !d->m_dockWidget)
157 d->m_dockWidget->addDockWidgetToContainingWindow(otherDockWidget, location, relativeToDockWidget,
164 d->m_dockWidget->setAsCurrentTab();
170 d->m_dockWidget->forceClose();
176 return d->m_dockWidget->close();
184 d->m_dockWidget->open();
196 d->m_dockWidget->raise();
202 d->m_dockWidget->moveToSideBar();
207 delete d->m_dockWidget;
218 return d->m_dockWidget ? d->m_dockWidget->affinities() :
QVector<QString>();
231 if (d->m_uniqueName.isEmpty()) {
232 qWarning() << Q_FUNC_INFO
233 <<
"Each DockWidget need an unique name. Set the uniqueName property.";
242 if (d->m_dockWidget) {
243 qWarning() << Q_FUNC_INFO <<
"Unexpected bug.";
246 const auto childItems = this->childItems();
247 if (d->m_sourceFilename.isEmpty() && childItems.size() != 1) {
248 qWarning() << Q_FUNC_INFO <<
"Either 'source' property must be set or add exactly one child"
249 <<
"; source=" << d->m_sourceFilename <<
"; num children=" << childItems.size();
258 d->closedConnection = d->m_dockWidget->d->closed.connect([
this] { Q_EMIT
closed(); });
259 d->iconConnection = d->m_dockWidget->d->iconChanged.connect([
this] { Q_EMIT
iconChanged(); });
260 d->actualTitleBarConnection = d->m_dockWidget->d->actualTitleBarChanged.connect([
this] { Q_EMIT
actualTitleBarChanged(); });
261 d->optionsConnection = d->m_dockWidget->d->optionsChanged.connect([
this](KDDockWidgets::DockWidgetOptions opts) { Q_EMIT
optionsChanged(opts); });
263 d->windowActiveAboutToChangeConnection = d->m_dockWidget->d->windowActiveAboutToChange.connect([
this](
bool is) { Q_EMIT
windowActiveAboutToChange(is); });
264 d->isFocusedConnection = d->m_dockWidget->d->isFocusedChanged.connect([
this](
bool is) { Q_EMIT
isFocusedChanged(is); });
266 d->isOverlayedConnection = d->m_dockWidget->d->isOverlayedChanged.connect([
this](
bool is) { Q_EMIT
isOverlayedChanged(is); });
267 d->isFloatingConnection = d->m_dockWidget->d->isFloatingChanged.connect([
this](
bool is) { Q_EMIT
isFloatingChanged(is); });
268 d->isOpenConnection = d->m_dockWidget->d->isOpenChanged.connect([
this](
bool is) { Q_EMIT
isOpenChanged(is); });
271 d->removedFromSideBarConnection = d->m_dockWidget->d->removedFromSideBar.connect([
this] { Q_EMIT
removedFromSideBar(); });
274 if (d->m_sourceFilename.isEmpty()) {
275 view->setGuestItem(childItems.constFirst());
277 view->setGuestItem(d->m_sourceFilename);
280 if (!d->m_title.isEmpty())
281 d->m_dockWidget->setTitle(d->m_title);
283 if (d->m_isFloating.has_value())
284 d->m_dockWidget->setFloating(d->m_isFloating.value());
286 d->m_dockWidget->setAffinities(d->m_affinities);
Application-wide config to tune certain behaviours of the framework.
A ScopedConnection is a RAII-style way to make sure a Connection is disconnected.