mirror of
https://github.com/parchlinux/calamares.git
synced 2025-07-03 20:35:36 -04:00
[libcalamaresui] Provide convenience method for context properties
This commit is contained in:
parent
3f87cc214a
commit
c4324fd3ea
2 changed files with 13 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue