13#include "core/Utils_p.h"
14#include "kddockwidgets/KDDockWidgets.h"
15#include "kddockwidgets/qtcommon/View.h"
21#include "views/View.h"
22#include "qtquick/Window_p.h"
24#include "core/Platform_p.h"
26#include "views/ViewWrapper_p.h"
28#include "views/DockWidget.h"
33#include <QQuickWindow>
37#include <QGuiApplication>
40#if defined(KDDOCKWIDGETS_STATICLIB) || defined(QT_STATIC)
41static void initResources()
43 Q_INIT_RESOURCE(kddockwidgets_resources);
44 Q_INIT_RESOURCE(kddockwidgets_qtquick);
53 QRectF rect = item->boundingRect();
63 for (
auto it = children.
rbegin(), end = children.
rend(); it != end; ++it) {
75 : m_qquickHelpers(new QtQuickHelpers())
82#if defined(KDDOCKWIDGETS_STATICLIB) || defined(QT_STATIC)
87 QQuickWindow::setDefaultAlphaBuffer(
true);
90 d->focusedViewChanged.emit(ViewWrapper::create(obj));
96 delete m_qquickHelpers;
106 if (obj && isWayland()) {
115 return ViewWrapper::create(obj);
120 return std::shared_ptr<Core::Window>(
new Window(qwindow));
130 if (
auto qwindow = qGuiApp->QGuiApplication::topLevelAt(globalPos)) {
131 auto window =
new Window(qwindow);
132 return Core::Window::Ptr(window);
141 if (
QWindow *qtwindow = item->window())
151 if (
QWindow *qtwindow = item->window())
152 if (
QScreen *screen = qtwindow->screen())
153 return screen->size();
162 qWarning() <<
"Please call KDDockWidgets::QtQuick::Platform::self()->setQmlEngine(engine)";
170 qWarning() << Q_FUNC_INFO <<
"Already has QML engine";
175 qWarning() << Q_FUNC_INFO <<
"Null QML engine";
182 QQmlContext *context =
qmlEngine->rootContext();
183 context->setContextProperty(QStringLiteral(
"_kddwHelpers"), m_qquickHelpers);
184 context->setContextProperty(QStringLiteral(
"_kddwDockRegistry"), dr);
185 context->setContextProperty(QStringLiteral(
"_kddw_widgetFactory"),
218 auto window = qobject_cast<QQuickWindow *>(qGuiApp->topLevelAt(globalPos));
225 return item->objectName() !=
QLatin1String(
"draggableMouseArea");
230 const QWindowList
windows = qGuiApp->topLevelWindows();
232 if (
auto quickWindow = qobject_cast<QQuickWindow *>(window)) {
233 if (QQuickItem *grabber = quickWindow->mouseGrabberItem())
234 grabber->ungrabMouse();
244 if (
auto dwView = qobject_cast<QtQuick::DockWidget *>(item))
245 return dwView->dockWidget();
247 if (
auto dwi = qobject_cast<DockWidgetInstantiator *>(item))
248 if (
auto view = dwi->dockWidget())
249 return view->dockWidget();
Application-wide config to tune certain behaviours of the framework.
Namespace-level methods related to registering QML types.
void focusObjectChanged(QObject *focusObject)
QList::reverse_iterator rbegin()
QList::reverse_iterator rend()
QVariant property(const char *name) const const
bool contains(const QRectF &rectangle) const const
void moveTopLeft(const QPointF &position)