applets property as a list of plasmoid objects
This commit is contained in:
parent
4049c092be
commit
065078b9c3
@ -55,15 +55,9 @@ ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent)
|
||||
loadWallpaper();
|
||||
}
|
||||
|
||||
QVariantList ContainmentInterface::applets()
|
||||
QList <QObject *> ContainmentInterface::applets()
|
||||
{
|
||||
QVariantList list;
|
||||
int i = 0;
|
||||
foreach (Plasma::Applet *applet, containment()->applets()) {
|
||||
list << QVariant::fromValue(applet);
|
||||
++i;
|
||||
}
|
||||
return list;
|
||||
return m_appletInterfaces;
|
||||
}
|
||||
|
||||
void ContainmentInterface::setDrawWallpaper(bool drawWallpaper)
|
||||
@ -146,13 +140,17 @@ void ContainmentInterface::appletAddedForward(Plasma::Applet *applet, const QPoi
|
||||
}
|
||||
}
|
||||
|
||||
m_appletInterfaces << appletGraphicObject;
|
||||
emit appletAdded(appletGraphicObject, pos);
|
||||
emit appletsChanged();
|
||||
}
|
||||
|
||||
void ContainmentInterface::appletRemovedForward(Plasma::Applet *applet)
|
||||
{
|
||||
QObject *appletGraphicObject = applet->property("graphicObject").value<QObject *>();
|
||||
m_appletInterfaces.removeAll(appletGraphicObject);
|
||||
emit appletRemoved(appletGraphicObject);
|
||||
emit appletsChanged();
|
||||
}
|
||||
|
||||
void ContainmentInterface::loadWallpaper()
|
||||
|
@ -30,7 +30,7 @@ class QmlObject;
|
||||
class ContainmentInterface : public AppletInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QVariantList applets READ applets)
|
||||
Q_PROPERTY(QList <QObject *> applets READ applets NOTIFY appletsChanged)
|
||||
Q_PROPERTY(bool drawWallpaper READ drawWallpaper WRITE setDrawWallpaper)
|
||||
Q_PROPERTY(Type containmentType READ containmentType WRITE setContainmentType)
|
||||
Q_PROPERTY(int screen READ screen NOTIFY screenChanged)
|
||||
@ -50,7 +50,7 @@ public:
|
||||
|
||||
inline Plasma::Containment *containment() const { return static_cast<Plasma::Containment *>(m_appletScriptEngine->applet()); }
|
||||
|
||||
QVariantList applets();
|
||||
QList<QObject *> applets();
|
||||
|
||||
void setDrawWallpaper(bool drawWallpaper);
|
||||
bool drawWallpaper();
|
||||
@ -73,6 +73,7 @@ Q_SIGNALS:
|
||||
void screenChanged();
|
||||
void activityIdChanged();
|
||||
void availableScreenRegionChanged();
|
||||
void appletsChanged();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void appletAddedForward(Plasma::Applet *applet, const QPointF &pos);
|
||||
@ -81,6 +82,7 @@ protected Q_SLOTS:
|
||||
|
||||
private:
|
||||
QmlObject *m_wallpaperQmlObject;
|
||||
QList<QObject *> m_appletInterfaces;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user