22 #include "private/multisplitter/Item_p.h"
23 #include "private/DockRegistry_p.h"
24 #include "private/Utils_p.h"
25 #include "private/DragController_p.h"
29 #include <QOperatingSystemVersion>
31 #ifdef KDDOCKWIDGETS_QTQUICK
32 #include "private/quick/Helpers_p.h"
34 #include <QQmlContext>
49 delete m_frameworkWidgetFactory;
54 QQmlEngine *m_qmlEngine =
nullptr;
63 qreal m_draggedWindowOpacity = Q_QNAN;
64 int m_mdiPopupThreshold = 250;
65 bool m_dropIndicatorsInhibited =
false;
66 #ifdef KDDOCKWIDGETS_QTQUICK
67 QtQuickHelpers m_qquickHelpers;
102 auto dr = DockRegistry::self();
103 if (!dr->isEmpty(
true)) {
104 qWarning() << Q_FUNC_INFO <<
"Only use this function at startup before creating any DockWidget or MainWindow"
105 <<
"; These are already created: " << dr->mainWindowsNames()
106 << dr->dockWidgetNames() << dr->floatingWindows();
120 d->m_dockWidgetFactoryFunc = func;
125 return d->m_dockWidgetFactoryFunc;
130 d->m_mainWindowFactoryFunc = func;
135 return d->m_mainWindowFactoryFunc;
141 delete d->m_frameworkWidgetFactory;
142 d->m_frameworkWidgetFactory = wf;
147 return d->m_frameworkWidgetFactory;
157 if (!DockRegistry::self()->isEmpty(
true)) {
158 qWarning() << Q_FUNC_INFO <<
"Only use this function at startup before creating any DockWidget or MainWindow";
167 d->m_draggedWindowOpacity = opacity;
172 return d->m_draggedWindowOpacity;
177 d->m_tabbingAllowedFunc = func;
182 return d->m_tabbingAllowedFunc;
187 d->m_dropIndicatorAllowedFunc = func;
192 return d->m_dropIndicatorAllowedFunc;
197 if (!DockRegistry::self()->isEmpty(
false)) {
198 qWarning() << Q_FUNC_INFO <<
"Only use this function at startup before creating any DockWidget or MainWindow";
202 Layouting::Item::hardcodedMinimumSize = size;
207 return Layouting::Item::hardcodedMinimumSize;
212 if (!DockRegistry::self()->isEmpty(
false)) {
213 qWarning() << Q_FUNC_INFO <<
"Only use this function at startup before creating any DockWidget or MainWindow";
217 Layouting::Item::hardcodedMaximumSize = size;
222 return Layouting::Item::hardcodedMaximumSize;
227 return d->m_internalFlags;
232 d->m_internalFlags =
flags;
235 #ifdef KDDOCKWIDGETS_QTQUICK
236 void Config::setQmlEngine(QQmlEngine *qmlEngine)
238 if (d->m_qmlEngine) {
239 qWarning() << Q_FUNC_INFO <<
"Already has QML engine";
244 qWarning() << Q_FUNC_INFO <<
"Null QML engine";
248 auto dr = DockRegistry::self();
249 QQmlContext *context = qmlEngine->rootContext();
250 context->setContextProperty(QStringLiteral(
"_kddwHelpers"), &d->m_qquickHelpers);
251 context->setContextProperty(QStringLiteral(
"_kddwDockRegistry"), dr);
252 context->setContextProperty(QStringLiteral(
"_kddwDragController"), DragController::instance());
253 context->setContextProperty(QStringLiteral(
"_kddw_widgetFactory"), d->m_frameworkWidgetFactory);
255 d->m_qmlEngine = qmlEngine;
258 QQmlEngine *Config::qmlEngine()
const
261 qWarning() <<
"Please call KDDockWidgets::Config::self()->setQmlEngine(engine)";
263 return d->m_qmlEngine;
267 void Config::Private::fixFlags()
269 #if defined(Q_OS_WIN)
272 m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
275 m_flags |= Flag_AeroSnapWithClientDecos;
279 if ((m_flags & Flag_AeroSnapWithClientDecos) && (m_flags & Flag_NativeTitleBar)) {
281 m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
283 #elif defined(Q_OS_MACOS)
285 m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
287 if (KDDockWidgets::isWayland()) {
290 m_flags |= Flag_NativeTitleBar;
296 m_flags = m_flags & ~Flag_NativeTitleBar;
297 m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
301 #if (!defined(Q_OS_WIN) && !defined(Q_OS_MACOS))
303 m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
307 #if defined(DOCKS_DEVELOPER_MODE)
309 if (m_internalFlags & InternalFlag_NoAeroSnap) {
311 m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
315 if (m_flags & Flag_DontUseUtilityFloatingWindows) {
316 m_internalFlags |= InternalFlag_DontUseParentForFloatingWindows;
317 m_internalFlags |= InternalFlag_DontUseQtToolWindowsForFloatingWindows;
320 if (m_flags & Flag_ShowButtonsOnTabBarIfTitleBarHidden) {
322 m_flags |= Flag_HideTitleBarWhenTabsVisible;
328 d->m_disabledPaintEvents = widgets;
333 return d->m_disabledPaintEvents;
338 d->m_mdiPopupThreshold = threshold;
343 return d->m_mdiPopupThreshold;
348 if (d->m_dropIndicatorsInhibited != inhibit) {
349 d->m_dropIndicatorsInhibited = inhibit;
350 Q_EMIT DockRegistry::self()->dropIndicatorsInhibitedChanged(inhibit);
356 return d->m_dropIndicatorsInhibited;