mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-15 17:59:03 +08:00
73 lines
2.6 KiB
Diff
73 lines
2.6 KiB
Diff
diff --git a/src/plasmaquick/appletquickitem.h b/src/plasmaquick/appletquickitem.h
|
|
index 1e0174a..4f25f5d 100644
|
|
--- a/src/plasmaquick/appletquickitem.h
|
|
+++ b/src/plasmaquick/appletquickitem.h
|
|
@@ -146,6 +146,7 @@ protected:
|
|
KDeclarative::QmlObject *qmlObject();
|
|
|
|
//Reimplementation
|
|
+ void childEvent(QChildEvent *event) Q_DECL_OVERRIDE;
|
|
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
|
|
void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
|
|
|
|
diff --git a/src/plasmaquick/appletquickitem.cpp b/src/plasmaquick/appletquickitem.cpp
|
|
index 28f1eb5..7fba310 100644
|
|
--- a/src/plasmaquick/appletquickitem.cpp
|
|
+++ b/src/plasmaquick/appletquickitem.cpp
|
|
@@ -50,7 +50,11 @@ AppletQuickItemPrivate::AppletQuickItemPrivate(Plasma::Applet *a, AppletQuickIte
|
|
applet(a),
|
|
expanded(false)
|
|
{
|
|
- if (!a->pluginInfo().isValid()) {
|
|
+}
|
|
+
|
|
+void AppletQuickItemPrivate::init()
|
|
+{
|
|
+ if (!applet->pluginInfo().isValid()) {
|
|
// This `qmlObject` is used in other parts of the code
|
|
qmlObject = new KDeclarative::QmlObject(q);
|
|
return;
|
|
@@ -383,6 +387,7 @@ AppletQuickItem::AppletQuickItem(Plasma::Applet *applet, QQuickItem *parent)
|
|
: QQuickItem(parent),
|
|
d(new AppletQuickItemPrivate(applet, this))
|
|
{
|
|
+ d->init();
|
|
if (d->applet) {
|
|
d->appletPackage = d->applet->package();
|
|
}
|
|
@@ -726,6 +731,21 @@ QObject *AppletQuickItem::rootItem()
|
|
return d->qmlObject->rootObject();
|
|
}
|
|
|
|
+void AppletQuickItem::childEvent(QChildEvent *event)
|
|
+{
|
|
+ // Added child may be QQuickLayoutAttached
|
|
+ if (event->added() && !d->ownLayout && d->currentRepresentationItem) {
|
|
+ // Child has not yet finished initialization at this point
|
|
+ QTimer::singleShot(0, this, [this]() {
|
|
+ if (!d->ownLayout) {
|
|
+ d->connectLayoutAttached(d->currentRepresentationItem);
|
|
+ }
|
|
+ });
|
|
+ }
|
|
+
|
|
+ QQuickItem::childEvent(event);
|
|
+}
|
|
+
|
|
void AppletQuickItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
|
|
{
|
|
Q_UNUSED(oldGeometry)
|
|
diff --git a/src/plasmaquick/private/appletquickitem_p.h b/src/plasmaquick/private/appletquickitem_p.h
|
|
index 1f99d2f..9c24734 100644
|
|
--- a/src/plasmaquick/private/appletquickitem_p.h
|
|
+++ b/src/plasmaquick/private/appletquickitem_p.h
|
|
@@ -55,6 +55,8 @@ class AppletQuickItemPrivate
|
|
public:
|
|
AppletQuickItemPrivate(Plasma::Applet *a, AppletQuickItem *item);
|
|
|
|
+ void init();
|
|
+
|
|
QQuickItem *createCompactRepresentationItem();
|
|
QQuickItem *createFullRepresentationItem();
|
|
QQuickItem *createCompactRepresentationExpanderItem();
|