[libcalamaresui] Log which ViewStep is broken

- a ViewStep with no widget will crash the application;
   print out its name before doing so.
This commit is contained in:
Adriaan de Groot 2020-01-10 12:56:46 +01:00
parent 1cc40bda83
commit 60c1d40b20

View File

@ -158,13 +158,6 @@ void
ViewManager::insertViewStep( int before, ViewStep* step )
{
m_steps.insert( before, step );
QLayout* layout = step->widget()->layout();
if ( layout )
{
layout->setContentsMargins( 0, 0, 0, 0 );
}
m_stack->insertWidget( before, step->widget() );
connect( step, &ViewStep::enlarge, this, &ViewManager::enlarge );
connect( step, &ViewStep::nextStatusChanged, this, [this]( bool status ) {
ViewStep* vs = qobject_cast< ViewStep* >( sender() );
@ -177,6 +170,17 @@ ViewManager::insertViewStep( int before, ViewStep* step )
}
} );
if ( !step->widget() )
{
cError() << "ViewStep" << step->moduleInstanceKey() << "has no widget.";
}
QLayout* layout = step->widget()->layout();
if ( layout )
{
layout->setContentsMargins( 0, 0, 0, 0 );
}
m_stack->insertWidget( before, step->widget() );
m_stack->setCurrentIndex( 0 );
step->widget()->setFocus();
}