From 2b5cf9e613828b3cd71b0c236deec6e287607b72 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 3 Jun 2019 10:38:29 +0200 Subject: [PATCH] [libcalamaresui] There is code in Qt for setting up QML widgets - The not-publicly documented setContent() method does all the parenting and resizing needed; some of this isn't available from outside of the widget either. The QML slideshow now sizes and re-sizes correctly. --- src/libcalamaresui/ExecutionViewStep.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libcalamaresui/ExecutionViewStep.cpp b/src/libcalamaresui/ExecutionViewStep.cpp index fd675313c..2fb18ff84 100644 --- a/src/libcalamaresui/ExecutionViewStep.cpp +++ b/src/libcalamaresui/ExecutionViewStep.cpp @@ -151,17 +151,17 @@ ExecutionViewStep::onActivate() loadQml(); if ( m_qmlComponent ) { - 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() ); + // setContent() is public API, but not documented publicly. + // 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. + m_qmlShow->setContent( QUrl::fromLocalFile( Calamares::Branding::instance()->slideshowPath() ), m_qmlComponent, m_qmlObject ); } }