diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.cpp b/src/scriptengines/qml/plasmoid/containmentinterface.cpp index f4e75e69b..78e467e95 100644 --- a/src/scriptengines/qml/plasmoid/containmentinterface.cpp +++ b/src/scriptengines/qml/plasmoid/containmentinterface.cpp @@ -81,7 +81,9 @@ ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent) if (containment()->corona()) { connect(containment()->corona(), &Plasma::Corona::availableScreenRegionChanged, this, &ContainmentInterface::availableScreenRegionChanged); - } + connect(containment()->corona(), &Plasma::Corona::availableScreenRectChanged, + this, &ContainmentInterface::availableScreenRectChanged); + } if (!m_appletInterfaces.isEmpty()) { emit appletsChanged(); @@ -193,6 +195,16 @@ QVariantList ContainmentInterface::availableScreenRegion(int id) const return regVal; } +QRect ContainmentInterface::availableScreenRect(int id) const +{ + QRect rect; + if (containment()->corona()) { + rect = containment()->corona()->availableScreenRect(id); + } + + return rect; +} + Plasma::Applet *ContainmentInterface::addApplet(const QString &plugin, const QVariantList &args, const QPoint &pos) { //HACK diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.h b/src/scriptengines/qml/plasmoid/containmentinterface.h index 138fe7259..4339af793 100644 --- a/src/scriptengines/qml/plasmoid/containmentinterface.h +++ b/src/scriptengines/qml/plasmoid/containmentinterface.h @@ -100,6 +100,12 @@ public: */ Q_INVOKABLE QVariantList availableScreenRegion(int id) const; + /** + * The available rect of this screen, panels excluded. A simple rect area + * For more precise available geometry use availableScreenRegion() + */ + Q_INVOKABLE QRect availableScreenRect(int id) const; + /** * Process the mime data arrived to a particular coordinate, either with a drag and drop or paste with middle mouse button */ @@ -139,6 +145,7 @@ Q_SIGNALS: void activityChanged(); void activityNameChanged(); void availableScreenRegionChanged(); + void availableScreenRectChanged(); void appletsChanged(); void drawWallpaperChanged(); void containmentTypeChanged();