22 #include "private/DockRegistry_p.h"
23 #include "private/Utils_p.h"
24 #include "private/DragController_p.h"
28 #include <QOperatingSystemVersion>
30 #ifdef KDDOCKWIDGETS_QTQUICK
31 #include "private/quick/Helpers_p.h"
33 #include <QQmlContext>
48 delete m_frameworkWidgetFactory;
53 QQmlEngine *m_qmlEngine =
nullptr;
61 qreal m_draggedWindowOpacity = Q_QNAN;
62 int m_mdiPopupThreshold = 250;
63 bool m_dropIndicatorsInhibited =
false;
64 #ifdef KDDOCKWIDGETS_QTQUICK
65 QtQuickHelpers m_qquickHelpers;
100 auto dr = DockRegistry::self();
101 if (!dr->isEmpty(
true)) {
102 qWarning() << Q_FUNC_INFO <<
"Only use this function at startup before creating any DockWidget or MainWindow"
103 <<
"; These are already created: " << dr->mainWindowsNames()
104 << dr->dockWidgetNames() << dr->floatingWindows();
118 d->m_dockWidgetFactoryFunc = func;
123 return d->m_dockWidgetFactoryFunc;
128 d->m_mainWindowFactoryFunc = func;
133 return d->m_mainWindowFactoryFunc;
139 delete d->m_frameworkWidgetFactory;
140 d->m_frameworkWidgetFactory = wf;
145 return d->m_frameworkWidgetFactory;
155 if (!DockRegistry::self()->isEmpty(
true)) {
156 qWarning() << Q_FUNC_INFO <<
"Only use this function at startup before creating any DockWidget or MainWindow";
165 d->m_draggedWindowOpacity = opacity;
170 return d->m_draggedWindowOpacity;
175 d->m_tabbingAllowedFunc = func;
180 return d->m_tabbingAllowedFunc;
185 if (!DockRegistry::self()->isEmpty(
false)) {
186 qWarning() << Q_FUNC_INFO <<
"Only use this function at startup before creating any DockWidget or MainWindow";
190 Layouting::Item::hardcodedMinimumSize = size;
195 return Layouting::Item::hardcodedMinimumSize;
200 if (!DockRegistry::self()->isEmpty(
false)) {
201 qWarning() << Q_FUNC_INFO <<
"Only use this function at startup before creating any DockWidget or MainWindow";
205 Layouting::Item::hardcodedMaximumSize = size;
210 return Layouting::Item::hardcodedMaximumSize;
215 return d->m_internalFlags;
220 d->m_internalFlags =
flags;
223 #ifdef KDDOCKWIDGETS_QTQUICK
224 void Config::setQmlEngine(QQmlEngine *qmlEngine)
226 if (d->m_qmlEngine) {
227 qWarning() << Q_FUNC_INFO <<
"Already has QML engine";
232 qWarning() << Q_FUNC_INFO <<
"Null QML engine";
236 auto dr = DockRegistry::self();
237 QQmlContext *context = qmlEngine->rootContext();
238 context->setContextProperty(QStringLiteral(
"_kddwHelpers"), &d->m_qquickHelpers);
239 context->setContextProperty(QStringLiteral(
"_kddwDockRegistry"), dr);
240 context->setContextProperty(QStringLiteral(
"_kddwDragController"), DragController::instance());
241 context->setContextProperty(QStringLiteral(
"_kddw_widgetFactory"), d->m_frameworkWidgetFactory);
243 d->m_qmlEngine = qmlEngine;
246 QQmlEngine *Config::qmlEngine()
const
249 qWarning() <<
"Please call KDDockWidgets::Config::self()->setQmlEngine(engine)";
251 return d->m_qmlEngine;
255 void Config::Private::fixFlags()
257 #if defined(Q_OS_WIN)
260 m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
263 m_flags |= Flag_AeroSnapWithClientDecos;
267 if ((m_flags & Flag_AeroSnapWithClientDecos) && (m_flags & Flag_NativeTitleBar)) {
269 m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
271 #elif defined(Q_OS_MACOS)
273 m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
275 if (KDDockWidgets::isWayland()) {
278 m_flags |= Flag_NativeTitleBar;
284 m_flags = m_flags & ~Flag_NativeTitleBar;
285 m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
289 #if (!defined(Q_OS_WIN) && !defined(Q_OS_MACOS))
291 m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
295 #if defined(DOCKS_DEVELOPER_MODE)
297 if (m_internalFlags & InternalFlag_NoAeroSnap) {
299 m_flags = m_flags & ~Flag_AeroSnapWithClientDecos;
303 if (m_flags & Flag_DontUseUtilityFloatingWindows) {
304 m_internalFlags |= InternalFlag_DontUseParentForFloatingWindows;
305 m_internalFlags |= InternalFlag_DontUseQtToolWindowsForFloatingWindows;
308 if (m_flags & Flag_ShowButtonsOnTabBarIfTitleBarHidden) {
310 m_flags |= Flag_HideTitleBarWhenTabsVisible;
316 d->m_disabledPaintEvents = widgets;
321 return d->m_disabledPaintEvents;
326 d->m_mdiPopupThreshold = threshold;
331 return d->m_mdiPopupThreshold;
336 if (d->m_dropIndicatorsInhibited != inhibit) {
337 d->m_dropIndicatorsInhibited = inhibit;
338 Q_EMIT DockRegistry::self()->dropIndicatorsInhibitedChanged(inhibit);
344 return d->m_dropIndicatorsInhibited;