#include "desktopview.h" #include #include #include #include #include #include DesktopView::DesktopView(QQuickView *parent) : QQuickView(parent) { m_screenRect = qApp->primaryScreen()->geometry(); m_screenAvailableRect = qApp->primaryScreen()->availableGeometry(); // setFlags(Qt::Window | Qt::FramelessWindowHint); setTitle(tr("Desktop")); KWindowSystem::setType(winId(), NET::Desktop); KWindowSystem::setState(winId(), NET::KeepBelow); engine()->rootContext()->setContextProperty("desktopView", this); setScreen(qApp->primaryScreen()); setResizeMode(QQuickView::SizeRootObjectToView); setSource(QStringLiteral("qrc:/qml/Desktop/Desktop.qml")); onGeometryChanged(); connect(qApp->primaryScreen(), &QScreen::virtualGeometryChanged, this, &DesktopView::onGeometryChanged); connect(qApp->primaryScreen(), &QScreen::geometryChanged, this, &DesktopView::onGeometryChanged); connect(qApp->primaryScreen(), &QScreen::availableGeometryChanged, this, &DesktopView::onAvailableGeometryChanged); } QRect DesktopView::screenRect() { return m_screenRect; } QRect DesktopView::screenAvailableRect() { return m_screenAvailableRect; } void DesktopView::onGeometryChanged() { m_screenRect = qApp->primaryScreen()->geometry(); setGeometry(qApp->primaryScreen()->geometry()); emit screenRectChanged(); } void DesktopView::onAvailableGeometryChanged(const QRect &geometry) { m_screenAvailableRect = geometry; emit screenAvailableGeometryChanged(); }