[ConfigModel] Set QML context on ConfigModule

This will have the ConfigModule use the same engine as we do, ensuring we use the correct QtQuick Controls style.

BUG: 388766

Differential Revision: https://phabricator.kde.org/D9785
This commit is contained in:
Kai Uwe Broulik 2018-01-15 10:32:40 +01:00
parent 639e8684e3
commit 94b91f723a

View File

@ -269,6 +269,12 @@ QVariant ConfigModel::data(const QModelIndex &index, int role) const
if (!cm) {
qWarning() << "Error creating KCM object from plugin" << loader.fileName();
}
if (QQmlContext *ctx = QQmlEngine::contextForObject(this)) {
// assign the ConfigModule the same QML context as we have so it can use the same QML engine as we do
QQmlEngine::setContextForObject(cm, ctx);
}
d->kcms[pluginName] = cm;
return QVariant::fromValue(cm);
}