[libcalamaresui] Report on QML errors

- If the slideshow fails to load entirely, say so
This commit is contained in:
Adriaan de Groot 2020-05-19 17:08:49 +02:00
parent ae861f7ec0
commit 0947da3d41

View File

@ -23,7 +23,9 @@
#include "Branding.h" #include "Branding.h"
#include "utils/Dirs.h" #include "utils/Dirs.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#ifdef WITH_QML
#include "utils/Qml.h" #include "utils/Qml.h"
#endif
#include "utils/Retranslator.h" #include "utils/Retranslator.h"
#include <QLabel> #include <QLabel>
@ -50,6 +52,8 @@ SlideshowQML::SlideshowQML( QWidget* parent )
, m_qmlComponent( nullptr ) , m_qmlComponent( nullptr )
, m_qmlObject( nullptr ) , m_qmlObject( nullptr )
{ {
CalamaresUtils::registerCalamaresModels();
m_qmlShow->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); m_qmlShow->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_qmlShow->setResizeMode( QQuickWidget::SizeRootObjectToView ); m_qmlShow->setResizeMode( QQuickWidget::SizeRootObjectToView );
m_qmlShow->engine()->addImportPath( CalamaresUtils::qmlModulesDir().absolutePath() ); m_qmlShow->engine()->addImportPath( CalamaresUtils::qmlModulesDir().absolutePath() );
@ -126,6 +130,21 @@ SlideshowQML::loadQmlV2Complete()
} }
} }
} }
else
{
if ( m_qmlObject )
{
cWarning() << "QML object already created";
}
else if ( !m_qmlComponent )
{
cWarning() << "QML component does not exist";
}
else if ( m_qmlComponent && !m_qmlComponent->isReady() )
{
cWarning() << "QML component not ready:" << m_qmlComponent->errors();
}
}
} }
/* /*