Add availableScreenRect(int id) to ContainmentInterface

Now plasmoids can simply get the available screen rect
This commit is contained in:
Martin Klapetek 2014-03-11 15:30:25 +01:00
parent 699057ad33
commit 62d35541ed
2 changed files with 20 additions and 1 deletions

View File

@ -81,6 +81,8 @@ 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()) {
@ -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

View File

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