Expose the screenGeometry on the applet interface

It's useful to be able to figure out information about the current screen
without having to ask the corona.
This commit is contained in:
Aleix Pol 2014-06-05 02:12:07 +02:00
parent 549fb7ce51
commit 8ab91f219d
2 changed files with 12 additions and 0 deletions

View File

@ -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) {

View File

@ -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;