[libcalamaresui] Provide convenience method for context properties
This commit is contained in:
parent
3f87cc214a
commit
c4324fd3ea
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user