[libcalamaresui] Remove under-used function

- there was one consumer of this function, and it was over-engineered
  for what was needed (removing a list of widgets). Just drop it.
This commit is contained in:
Adriaan de Groot 2022-04-27 14:37:24 +02:00
parent 928b46f18e
commit 704e250664
3 changed files with 5 additions and 30 deletions

View File

@ -256,24 +256,4 @@ defaultIconSize()
return QSize( w, w ); return QSize( w, w );
} }
void
clearLayout( QLayout* layout )
{
while ( QLayoutItem* item = layout->takeAt( 0 ) )
{
if ( QWidget* widget = item->widget() )
{
widget->deleteLater();
}
if ( QLayout* childLayout = item->layout() )
{
clearLayout( childLayout );
}
delete item;
}
}
} // namespace CalamaresUtils } // namespace CalamaresUtils

View File

@ -95,14 +95,6 @@ UIDLLEXPORT QPixmap createRoundedImage( const QPixmap& avatar, const QSize& size
*/ */
UIDLLEXPORT void unmarginLayout( QLayout* layout ); UIDLLEXPORT void unmarginLayout( QLayout* layout );
// TODO:3.3:This has only one consumer, move to LicensePage, make static
/**
* @brief clearLayout recursively walks the QLayout tree and deletes all the child
* widgets and layouts.
* @param layout the layout to clear.
*/
UIDLLEXPORT void clearLayout( QLayout* layout );
UIDLLEXPORT void setDefaultFontSize( int points ); UIDLLEXPORT void setDefaultFontSize( int points );
UIDLLEXPORT int defaultFontSize(); // in points UIDLLEXPORT int defaultFontSize(); // in points
UIDLLEXPORT int defaultFontHeight(); // in pixels, DPI-specific UIDLLEXPORT int defaultFontHeight(); // in pixels, DPI-specific

View File

@ -115,7 +115,11 @@ LicensePage::LicensePage( QWidget* parent )
void void
LicensePage::setEntries( const QList< LicenseEntry >& entriesList ) LicensePage::setEntries( const QList< LicenseEntry >& entriesList )
{ {
CalamaresUtils::clearLayout( ui->licenseEntriesLayout ); for ( QWidget* w : m_entries )
{
ui->licenseEntriesLayout->removeWidget( w );
w->deleteLater();
}
m_allLicensesOptional = true; m_allLicensesOptional = true;
@ -128,7 +132,6 @@ LicensePage::setEntries( const QList< LicenseEntry >& entriesList )
m_entries.append( w ); m_entries.append( w );
m_allLicensesOptional &= !entry.isRequired(); m_allLicensesOptional &= !entry.isRequired();
} }
ui->licenseEntriesLayout->addSpacerItem( new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
ui->acceptCheckBox->setChecked( false ); ui->acceptCheckBox->setChecked( false );
checkAcceptance( false ); checkAcceptance( false );