[libcalamaresui] Manual QML loading trickery
- The slideshow item needs a parent to be visible, - QML gets size 0,0 unless explicitly sized to the surrounding widget.
This commit is contained in:
parent
103decab68
commit
f52d62034b
@ -38,6 +38,7 @@
|
||||
#include <QProgressBar>
|
||||
#include <QQmlComponent>
|
||||
#include <QQmlEngine>
|
||||
#include <QQuickItem>
|
||||
#include <QQuickWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
@ -150,9 +151,18 @@ ExecutionViewStep::onActivate()
|
||||
loadQml();
|
||||
if ( m_qmlComponent )
|
||||
{
|
||||
m_qmlObject = m_qmlComponent->create();
|
||||
cDebug() << "Created QML object" << (void *)m_qmlObject << m_qmlObject->objectName();
|
||||
cDebug() << "Show root" << m_qmlShow->rootObject() << "context" << m_qmlShow->rootContext();
|
||||
auto* rootItem = m_qmlShow->quickWindow()->contentItem();
|
||||
rootItem->setSize( m_qmlShow->size() );
|
||||
|
||||
QObject* o = m_qmlComponent->create();
|
||||
m_qmlObject = qobject_cast< QQuickItem* >( o );
|
||||
if ( !m_qmlObject )
|
||||
delete o;
|
||||
else
|
||||
{
|
||||
m_qmlObject->setParentItem( rootItem );
|
||||
m_qmlObject->setSize( m_qmlShow->size() );
|
||||
}
|
||||
}
|
||||
|
||||
JobQueue* queue = JobQueue::instance();
|
||||
|
@ -27,8 +27,9 @@
|
||||
class QLabel;
|
||||
class QObject;
|
||||
class QProgressBar;
|
||||
class QQuickWidget;
|
||||
class QQmlComponent;
|
||||
class QQuickItem;
|
||||
class QQuickWidget;
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
@ -65,7 +66,7 @@ private:
|
||||
QLabel* m_label;
|
||||
QQuickWidget* m_qmlShow;
|
||||
QQmlComponent* m_qmlComponent;
|
||||
QObject* m_qmlObject; //< The actual show
|
||||
QQuickItem* m_qmlObject; //< The actual show
|
||||
|
||||
QStringList m_jobInstanceKeys;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user