Accessing dataengine from different plasmoid
Simone Gaiarin
simgunz at gmail.com
Tue Feb 21 16:16:35 UTC 2012
I need some explanation on how dataengines work. I can't understand if
the dataengine is shared among plasmoids or if every plasmoid creates
his own dataengine that retrive info.
My purpose is: I create a plasmoid, this plasmoid require a source to
a dataengine, this source is a pointer to a kprocess. After that I
create more plasmoids and they should access the same source to get
the pointer to the KProcess.
What I obtain when I call the dataEngine() method from a plasmoid is
that a new instance of a dataengine is created, so I cannot see source
requested by other plasmoid because the dataengines are distinct.
Example code:
Plasmoid:
init()
{
float num = rand();
QString source;
source.setNum(num);
dataEngine("engine")->connectSource(source,this);
qDebug() << dataEngine("engine")->sources();
}
Dataengine:
sourceRequestEvent(const QString &name)
{
setData(name,"Active",1);
return true;
}
I expect that when I create the second plasmoid, the output of
sources() contains two sources, the one associated to the current
plasmoid and the one associated to the previously created plasmoid.
Instead the output is only one source.
More information about the Plasma-devel
mailing list