Commit 25ef53d3 authored by Marco Martin's avatar Marco Martin
Browse files

delete the face config ui when face gets switched

don't let face config uis linger there when the user switches the face.
also, not all face have a config ui. Don't load anything at all if
not provided by the face.

BUG:423071
parent dd36af36
......@@ -428,6 +428,10 @@ void SensorFaceController::setFaceId(const QString &face)
d->compactRepresentation->deleteLater();
d->fullRepresentation.clear();
}
if (d->faceConfigUi) {
d->faceConfigUi->deleteLater();
d->faceConfigUi.clear();
}
d->faceId = face;
......@@ -511,10 +515,20 @@ QQuickItem *SensorFaceController::faceConfigUi()
return d->faceConfigUi;
}
const QString filePath = d->facePackage.filePath("ui", QStringLiteral("Config.qml"));
if (filePath.isEmpty()) {
return nullptr;
}
d->faceConfigUi = d->createConfigUi(QStringLiteral(":/FaceDetailsConfig.qml"),
{{QStringLiteral("controller"), QVariant::fromValue(this)},
{QStringLiteral("source"), d->facePackage.filePath("ui", QStringLiteral("Config.qml"))}});
{QStringLiteral("source"), filePath}});
if (d->faceConfigUi && !d->faceConfigUi->property("item").value<QQuickItem *>()) {
d->faceConfigUi->deleteLater();
d->faceConfigUi.clear();
}
return d->faceConfigUi;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment