[configview] Simplify code / workaround Qt5.15 crash
Summary: QQmlComponent::beginCreate and completeCreate are useful if you need to set properties on the object explicitly. We're not doing that here, we can just call create. Test Plan: On Qt5.15 Right click a panel choose edit Reviewers: #plasma, apol Reviewed By: apol Subscribers: apol, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D28599
This commit is contained in:
parent
6e39c1de5b
commit
0417bf61d5
@ -134,9 +134,13 @@ void ConfigViewPrivate::init()
|
||||
|
||||
q->setResizeMode(QQuickView::SizeViewToRootObject);
|
||||
|
||||
auto plasmoid = applet.data()->property("_plasma_graphicObject").value<QObject *>();
|
||||
q->engine()->rootContext()->setContextProperties({QQmlContext::PropertyPair{QStringLiteral("plasmoid"), QVariant::fromValue(plasmoid)},
|
||||
QQmlContext::PropertyPair{QStringLiteral("configDialog"), QVariant::fromValue(q)}});
|
||||
|
||||
//config model local of the applet
|
||||
QQmlComponent *component = new QQmlComponent(q->engine(), applet.data()->kPackage().fileUrl("configmodel"), q);
|
||||
QObject *object = component->beginCreate(q->engine()->rootContext());
|
||||
QObject *object = component->create(q->engine()->rootContext());
|
||||
configModel = qobject_cast<ConfigModel *>(object);
|
||||
|
||||
if (configModel) {
|
||||
@ -172,9 +176,6 @@ void ConfigViewPrivate::init()
|
||||
}
|
||||
}
|
||||
|
||||
q->engine()->rootContext()->setContextProperty(QStringLiteral("plasmoid"), applet.data()->property("_plasma_graphicObject").value<QObject *>());
|
||||
q->engine()->rootContext()->setContextProperty(QStringLiteral("configDialog"), q);
|
||||
component->completeCreate();
|
||||
delete component;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user