support availableScreenregion()
FEATURE: bridge to Corona::availableScreenRegion(), as an array of rects
This commit is contained in:
parent
f07062fae5
commit
fcd51b4c67
|
@ -497,6 +497,26 @@ QScriptValue ContainmentInterface::screenGeometry(int id) const
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QScriptValue ContainmentInterface::availableScreenRegion(int id) const
|
||||||
|
{
|
||||||
|
QRegion reg;
|
||||||
|
if (containment()->corona()) {
|
||||||
|
reg = containment()->corona()->availableScreenRegion(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
QScriptValue regVal = m_appletScriptEngine->engine()->newArray(reg.rects().size());
|
||||||
|
int i = 0;
|
||||||
|
foreach (QRect rect, reg.rects()) {
|
||||||
|
QScriptValue val = m_appletScriptEngine->engine()->newObject();
|
||||||
|
val.setProperty("x", rect.x());
|
||||||
|
val.setProperty("y", rect.y());
|
||||||
|
val.setProperty("width", rect.width());
|
||||||
|
val.setProperty("height", rect.height());
|
||||||
|
regVal.setProperty(i++, val);
|
||||||
|
}
|
||||||
|
return regVal;
|
||||||
|
}
|
||||||
|
|
||||||
void ContainmentInterface::appletAddedForward(Plasma::Applet *applet, const QPointF &pos)
|
void ContainmentInterface::appletAddedForward(Plasma::Applet *applet, const QPointF &pos)
|
||||||
{
|
{
|
||||||
applet->setFlag(QGraphicsItem::ItemIsMovable, m_movableApplets);
|
applet->setFlag(QGraphicsItem::ItemIsMovable, m_movableApplets);
|
||||||
|
|
|
@ -390,6 +390,7 @@ public:
|
||||||
bool hasMovableApplets() const;
|
bool hasMovableApplets() const;
|
||||||
|
|
||||||
Q_INVOKABLE QScriptValue screenGeometry(int id) const;
|
Q_INVOKABLE QScriptValue screenGeometry(int id) const;
|
||||||
|
Q_INVOKABLE QScriptValue availableScreenRegion(int id) const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void appletAdded(QGraphicsWidget *applet, const QPointF &pos);
|
void appletAdded(QGraphicsWidget *applet, const QPointF &pos);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user