[summary] Factor out widget creation
This commit is contained in:
parent
d951a9d317
commit
3bc90e6c06
@ -79,6 +79,32 @@ createBodyLabel( const QString& text, const QPalette& bodyPalette )
|
|||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QWidget*
|
||||||
|
createStepWidget( const QString& description, QWidget* innerWidget, const QPalette& palette )
|
||||||
|
{
|
||||||
|
QWidget* w = new QWidget();
|
||||||
|
QHBoxLayout* itemBodyLayout = new QHBoxLayout;
|
||||||
|
w->setLayout( itemBodyLayout );
|
||||||
|
|
||||||
|
// Indent the inner box by a bit
|
||||||
|
itemBodyLayout->addSpacing( CalamaresUtils::defaultFontHeight() * 2 );
|
||||||
|
QVBoxLayout* itemBodyCoreLayout = new QVBoxLayout;
|
||||||
|
itemBodyLayout->addLayout( itemBodyCoreLayout );
|
||||||
|
CalamaresUtils::unmarginLayout( itemBodyLayout );
|
||||||
|
|
||||||
|
itemBodyCoreLayout->addSpacing( CalamaresUtils::defaultFontHeight() / 2 );
|
||||||
|
if ( !description.isEmpty() )
|
||||||
|
{
|
||||||
|
itemBodyCoreLayout->addWidget( createBodyLabel( description, palette ) );
|
||||||
|
}
|
||||||
|
if ( innerWidget )
|
||||||
|
{
|
||||||
|
itemBodyCoreLayout->addWidget( innerWidget );
|
||||||
|
}
|
||||||
|
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ensureSize( QWidget* parent, QScrollArea* container, Calamares::ViewStep* viewstep )
|
ensureSize( QWidget* parent, QScrollArea* container, Calamares::ViewStep* viewstep )
|
||||||
{
|
{
|
||||||
@ -134,22 +160,7 @@ SummaryPage::buildWidgets( Config* config, SummaryViewStep* viewstep )
|
|||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
m_layout->addWidget( createTitleLabel( step->prettyName(), titleFont ) );
|
m_layout->addWidget( createTitleLabel( step->prettyName(), titleFont ) );
|
||||||
QHBoxLayout* itemBodyLayout = new QHBoxLayout;
|
m_layout->addWidget( createStepWidget( text, widget, bodyPalette ) );
|
||||||
m_layout->addSpacing( CalamaresUtils::defaultFontHeight() / 2 );
|
|
||||||
m_layout->addLayout( itemBodyLayout );
|
|
||||||
itemBodyLayout->addSpacing( CalamaresUtils::defaultFontHeight() * 2 );
|
|
||||||
QVBoxLayout* itemBodyCoreLayout = new QVBoxLayout;
|
|
||||||
itemBodyLayout->addLayout( itemBodyCoreLayout );
|
|
||||||
CalamaresUtils::unmarginLayout( itemBodyLayout );
|
|
||||||
if ( !text.isEmpty() )
|
|
||||||
{
|
|
||||||
itemBodyCoreLayout->addWidget( createBodyLabel( text, bodyPalette ) );
|
|
||||||
}
|
|
||||||
if ( widget )
|
|
||||||
{
|
|
||||||
itemBodyCoreLayout->addWidget( widget );
|
|
||||||
}
|
|
||||||
itemBodyLayout->addSpacing( CalamaresUtils::defaultFontHeight() * 2 );
|
|
||||||
}
|
}
|
||||||
m_layout->addStretch();
|
m_layout->addStretch();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user