diff --git a/src/scriptengines/qml/plasmoid/appletinterface.cpp b/src/scriptengines/qml/plasmoid/appletinterface.cpp index fc075fe9e..af0ebc38e 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.cpp +++ b/src/scriptengines/qml/plasmoid/appletinterface.cpp @@ -460,6 +460,11 @@ int AppletInterface::screen() const return -1; } +QRect AppletInterface::screenGeometry() const +{ + return applet()->containment()->corona()->screenGeometry(applet()->containment()->screen()); +} + void AppletInterface::setHideOnWindowDeactivate(bool hide) { if (m_hideOnDeactivate != hide) { diff --git a/src/scriptengines/qml/plasmoid/appletinterface.h b/src/scriptengines/qml/plasmoid/appletinterface.h index 1092f0bce..fe508256a 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.h +++ b/src/scriptengines/qml/plasmoid/appletinterface.h @@ -150,6 +150,12 @@ class AppletInterface : public PlasmaQuick::AppletQuickItem // would be preferrable if found. Q_PROPERTY(int screen READ screen NOTIFY screenChanged) + /** + * Provides access to the geometry of the applet is in. + * Can be useful to figure out what's the absolute position of the applet. + */ + Q_PROPERTY(QRect screenGeometry READ screenGeometry NOTIFY screenChanged) + /** * Whether the dialog should be hidden when the dialog loses focus. * @@ -273,6 +279,7 @@ public: Plasma::Types::ItemStatus status() const; int screen() const; + QRect screenGeometry() const; bool immutable() const; bool userConfiguring() const;