reparent applet graphicobject to containment graphicobject
This commit is contained in:
parent
b5a65921d0
commit
2734ceaebb
@ -469,7 +469,12 @@ QVariantList ContainmentInterface::availableScreenRegion(int id) const
|
||||
|
||||
void ContainmentInterface::appletAddedForward(Plasma::Applet *applet, const QPointF &pos)
|
||||
{
|
||||
emit appletAdded(applet, pos);
|
||||
qDebug()<<"Applet added:"<<applet<<applet->name()<<applet->graphicObject();
|
||||
if (applet && containment()->graphicObject() && applet->graphicObject()) {
|
||||
applet->graphicObject()->setProperty("visible", false);
|
||||
applet->graphicObject()->setProperty("parent", QVariant::fromValue(containment()->graphicObject()));
|
||||
}
|
||||
emit appletAdded(applet->graphicObject(), pos);
|
||||
}
|
||||
|
||||
void ContainmentInterface::appletRemovedForward(Plasma::Applet *applet)
|
||||
|
@ -120,7 +120,7 @@ bool DeclarativeAppletScript::init()
|
||||
setupObjects();
|
||||
m_qmlObject->completeInitialization();
|
||||
a->setGraphicObject(m_qmlObject->rootObject());
|
||||
|
||||
qDebug()<<"Graphic object created:"<<a<<a->graphicObject();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -51,3 +51,4 @@ install(TARGETS testplasma2 ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
|
||||
add_subdirectory(qmlpackages)
|
||||
installPackage(testcontainment org.kde.testcontainment)
|
||||
installPackage(testapplet org.kde.testapplet)
|
||||
|
@ -53,7 +53,7 @@ void DesktopCorona::loadDefaultLayout()
|
||||
Plasma::Containment *cont = addContainment("org.kde.testcontainment");
|
||||
cont->setScreen(0);
|
||||
qDebug() << containmentForScreen(0);
|
||||
Plasma::Applet *appl = cont->addApplet("foo");
|
||||
Plasma::Applet *appl = cont->addApplet("org.kde.testapplet");
|
||||
qDebug() << "Containment:" << cont << cont->name();
|
||||
qDebug() << "Applet:" << appl->name() << appl;
|
||||
}
|
||||
|
@ -26,7 +26,14 @@ Rectangle {
|
||||
width: 640
|
||||
height: 480
|
||||
|
||||
property Item containment
|
||||
Connections {
|
||||
target: plasmoid
|
||||
onAppletAdded: {
|
||||
print("Applet added: " + applet)
|
||||
applet.parent = root
|
||||
applet.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaCore.Svg {
|
||||
id: actionssvg
|
||||
|
@ -36,7 +36,7 @@ View::View(QWindow *parent)
|
||||
|
||||
setResizeMode(View::SizeRootObjectToView);
|
||||
setSource(QUrl::fromLocalFile(m_package.filePath("mainscript")));
|
||||
show();rootContext()->setContextProperty("plasmoid", this);
|
||||
show();
|
||||
}
|
||||
|
||||
View::~View()
|
||||
|
Loading…
Reference in New Issue
Block a user