diff --git a/src/libcalamaresui/viewpages/QmlViewStep.cpp b/src/libcalamaresui/viewpages/QmlViewStep.cpp index 468ede962..7140cd10f 100644 --- a/src/libcalamaresui/viewpages/QmlViewStep.cpp +++ b/src/libcalamaresui/viewpages/QmlViewStep.cpp @@ -232,7 +232,7 @@ QmlViewStep::setConfigurationMap( const QVariantMap& configurationMap ) QObject* config = this->getConfig(); if ( config ) { - m_qmlWidget->engine()->rootContext()->setContextProperty( "config", config ); + setContextProperty( "config", config ); } cDebug() << "QmlViewStep" << moduleInstanceKey() << "loading" << m_qmlFileName; @@ -267,4 +267,10 @@ QmlViewStep::getConfig() return nullptr; } +void +QmlViewStep::setContextProperty( const char* name, QObject* property ) +{ + m_qmlWidget->engine()->rootContext()->setContextProperty( name, property ); +} + } // namespace Calamares diff --git a/src/libcalamaresui/viewpages/QmlViewStep.h b/src/libcalamaresui/viewpages/QmlViewStep.h index 55380d94b..cad6bb395 100644 --- a/src/libcalamaresui/viewpages/QmlViewStep.h +++ b/src/libcalamaresui/viewpages/QmlViewStep.h @@ -85,6 +85,12 @@ protected: */ virtual QObject* getConfig(); + /** @brief Adds a context property for this QML file + * + * Does not take ownership. + */ + void setContextProperty( const char* name, QObject* property ); + private Q_SLOTS: void loadComplete();