[libcalamaresui] Set config object earlier
- The config context object should be set earlier, otherwise QML code will try binding to a non-existent config already - Document that QMLViewStep::setConfigurationMap() parent implementation should be called **last**, at the end of the subclass implementation.
This commit is contained in:
parent
7e0cc7af41
commit
f094cb543b
@ -210,11 +210,6 @@ QmlViewStep::loadComplete()
|
||||
// It is marked \internal in the Qt sources, but does exactly
|
||||
// what is needed: sets up visual parent by replacing the root
|
||||
// item, and handling resizes.
|
||||
QObject* config = this->getConfig();
|
||||
if ( config )
|
||||
{
|
||||
m_qmlWidget->engine()->rootContext()->setContextProperty( "config", config );
|
||||
}
|
||||
m_qmlWidget->setContent( QUrl( m_qmlFileName ), m_qmlComponent, m_qmlObject );
|
||||
showQml();
|
||||
}
|
||||
@ -320,6 +315,12 @@ QmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
m_qmlFileName = searchQmlFile( m_searchMethod, qmlFile, m_name );
|
||||
|
||||
QObject* config = this->getConfig();
|
||||
if ( config )
|
||||
{
|
||||
m_qmlWidget->engine()->rootContext()->setContextProperty( "config", config );
|
||||
}
|
||||
|
||||
cDebug() << "QmlViewStep" << moduleInstanceKey() << "loading" << m_qmlFileName;
|
||||
m_qmlComponent = new QQmlComponent(
|
||||
m_qmlWidget->engine(), QUrl( m_qmlFileName ), QQmlComponent::CompilationMode::Asynchronous );
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
/// @brief QML widgets don't produce jobs by default
|
||||
virtual JobList jobs() const override;
|
||||
|
||||
/// @brief Configure search paths; subclasses should call this as well
|
||||
/// @brief Configure search paths; subclasses should call this at the **end** of their own implementation
|
||||
virtual void setConfigurationMap( const QVariantMap& configurationMap ) override;
|
||||
|
||||
protected:
|
||||
|
@ -36,9 +36,7 @@ NotesQmlViewStep::prettyName() const
|
||||
|
||||
void
|
||||
NotesQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation
|
||||
|
||||
{
|
||||
bool qmlLabel_ok = false;
|
||||
auto qmlLabel = CalamaresUtils::getSubMap( configurationMap, "qmlLabel", qmlLabel_ok );
|
||||
|
||||
@ -46,7 +44,8 @@ NotesQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
m_notesName = new CalamaresUtils::Locale::TranslatedString( qmlLabel, "notes" );
|
||||
}
|
||||
|
||||
|
||||
Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last
|
||||
}
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( NotesQmlViewStepFactory, registerPlugin< NotesQmlViewStep >(); )
|
||||
|
@ -90,7 +90,6 @@ jobOrBrandingSetting( Calamares::Branding::StringEntry e, const QVariantMap& map
|
||||
void
|
||||
WelcomeQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
QmlViewStep::setConfigurationMap( configurationMap );
|
||||
using Calamares::Branding;
|
||||
|
||||
m_config.setHelpUrl( jobOrBrandingSetting( Branding::SupportUrl, configurationMap, "showSupportUrl" ) );
|
||||
@ -146,6 +145,8 @@ WelcomeQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
// TODO: figure out where to set this: Config?
|
||||
}
|
||||
}
|
||||
|
||||
QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last
|
||||
}
|
||||
|
||||
Calamares::RequirementsList
|
||||
|
Loading…
Reference in New Issue
Block a user