get rid of the ugly async syncgraphicObject()
This commit is contained in:
parent
5562c65127
commit
b5a65921d0
@ -91,6 +91,7 @@ bool DeclarativeAppletScript::init()
|
||||
engine->setNetworkAccessManagerFactory(new PackageAccessManagerFactory(&package(), &m_auth));
|
||||
|
||||
m_qmlObject->setQmlPath(mainScript());
|
||||
|
||||
|
||||
if (!m_qmlObject->engine() || !m_qmlObject->engine()->rootContext() || !m_qmlObject->engine()->rootContext()->isValid() || m_qmlObject->mainComponent()->isError()) {
|
||||
QString reason;
|
||||
@ -102,7 +103,9 @@ bool DeclarativeAppletScript::init()
|
||||
}
|
||||
|
||||
Plasma::Applet *a = applet();
|
||||
|
||||
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(a);
|
||||
|
||||
|
||||
if (cont) {
|
||||
m_interface = new ContainmentInterface(this);
|
||||
@ -115,6 +118,8 @@ bool DeclarativeAppletScript::init()
|
||||
this, SLOT(activate()));
|
||||
|
||||
setupObjects();
|
||||
m_qmlObject->completeInitialization();
|
||||
a->setGraphicObject(m_qmlObject->rootObject());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -123,7 +128,6 @@ void DeclarativeAppletScript::qmlCreationFinished()
|
||||
{
|
||||
//If it's a popupapplet and the root object has a "compactRepresentation" component, use that instead of the icon
|
||||
Plasma::Applet *a = applet();
|
||||
a->setGraphicObject(m_qmlObject->rootObject());
|
||||
|
||||
//TODO: access rootItem from m_interface
|
||||
//m_self->setProperty("rootItem", QVariant::fromValue(m_qmlObject->rootObject()));
|
||||
|
@ -58,10 +58,16 @@ void View::setContainment(Plasma::Containment *cont)
|
||||
return;
|
||||
}
|
||||
|
||||
connect(cont, SIGNAL(graphicObjectChanged()), this, SLOT(syncGraphicObject()));
|
||||
|
||||
if (m_containment.data()->graphicObject()) {
|
||||
syncGraphicObject();
|
||||
qDebug() << "using as graphic containment" << m_containment.data()->graphicObject()<<m_containment.data();
|
||||
if (!m_containment || !m_containment.data()->graphicObject()) {
|
||||
qWarning() << "Containment not valid (yet?)";
|
||||
return;
|
||||
}
|
||||
|
||||
m_containment.data()->graphicObject()->setProperty("visible", false);
|
||||
m_containment.data()->graphicObject()->setProperty("parent", QVariant::fromValue(rootObject()));
|
||||
rootObject()->setProperty("containment", QVariant::fromValue(m_containment.data()->graphicObject()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,17 +76,4 @@ Plasma::Containment *View::containment() const
|
||||
return m_containment.data();
|
||||
}
|
||||
|
||||
void View::syncGraphicObject()
|
||||
{
|
||||
qDebug() << "using as graphic containment" << m_containment.data()->graphicObject()<<m_containment.data();
|
||||
if (!m_containment || !m_containment.data()->graphicObject()) {
|
||||
qWarning() << "Containment not valid (yet?)";
|
||||
return;
|
||||
}
|
||||
|
||||
m_containment.data()->graphicObject()->setProperty("visible", false);
|
||||
m_containment.data()->graphicObject()->setProperty("parent", QVariant::fromValue(rootObject()));
|
||||
rootObject()->setProperty("containment", QVariant::fromValue(m_containment.data()->graphicObject()));
|
||||
}
|
||||
|
||||
#include "moc_view.cpp"
|
||||
|
@ -37,9 +37,6 @@ public:
|
||||
void setContainment(Plasma::Containment *cont);
|
||||
Plasma::Containment *containment() const;
|
||||
|
||||
protected Q_SLOTS:
|
||||
void syncGraphicObject();
|
||||
|
||||
private:
|
||||
Plasma::Package m_package;
|
||||
QWeakPointer<Plasma::Containment> m_containment;
|
||||
|
Loading…
Reference in New Issue
Block a user