17#include "AvailableDesktopArea.h"
19#include <QGuiApplication>
20#include <QQuickWindow>
21#include <qpa/qplatformnativeinterface.h>
23AvailableDesktopArea::AvailableDesktopArea(QQuickItem *parent)
26 connect(
this, &QQuickItem::xChanged,
this, &AvailableDesktopArea::updatePlatformWindowProperty);
27 connect(
this, &QQuickItem::yChanged,
this, &AvailableDesktopArea::updatePlatformWindowProperty);
28 connect(
this, &QQuickItem::widthChanged,
this, &AvailableDesktopArea::updatePlatformWindowProperty);
29 connect(
this, &QQuickItem::heightChanged,
this, &AvailableDesktopArea::updatePlatformWindowProperty);
32void AvailableDesktopArea::updatePlatformWindowProperty()
38 QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
40 QRect rect(x(), y(), width(), height());
42 nativeInterface->setWindowProperty(window()->handle(),
"availableDesktopArea", QVariant(rect));
45void AvailableDesktopArea::itemChange(ItemChange change,
const ItemChangeData &)
47 if (change == ItemSceneChange) {
48 updatePlatformWindowProperty();