[summary] Tighten up scope of declarations, simplify

This commit is contained in:
Adriaan de Groot 2021-10-04 11:27:10 +02:00
parent 329f21093b
commit 8f4ba8c21f

View File

@ -27,8 +27,6 @@
#include <QLabel> #include <QLabel>
#include <QScrollArea> #include <QScrollArea>
static const int SECTION_SPACING = 12;
SummaryPage::SummaryPage( Config* config, const SummaryViewStep* thisViewStep, QWidget* parent ) SummaryPage::SummaryPage( Config* config, const SummaryViewStep* thisViewStep, QWidget* parent )
: QWidget() : QWidget()
, m_thisViewStep( thisViewStep ) , m_thisViewStep( thisViewStep )
@ -89,6 +87,8 @@ createBodyLabel( const QString& text, const QPalette& bodyPalette )
void void
SummaryPage::onActivate() SummaryPage::onActivate()
{ {
const int SECTION_SPACING = 12;
delete m_contentWidget; // It might have been created previously delete m_contentWidget; // It might have been created previously
m_contentWidget = new QWidget; m_contentWidget = new QWidget;
m_layout = new QVBoxLayout( m_contentWidget ); m_layout = new QVBoxLayout( m_contentWidget );
@ -114,14 +114,11 @@ SummaryPage::onActivate()
continue; continue;
} }
if ( first ) if ( !first )
{
first = false;
}
else
{ {
m_layout->addSpacing( SECTION_SPACING ); m_layout->addSpacing( SECTION_SPACING );
} }
first = false;
m_layout->addWidget( createTitleLabel( step->prettyName(), titleFont ) ); m_layout->addWidget( createTitleLabel( step->prettyName(), titleFont ) );
QHBoxLayout* itemBodyLayout = new QHBoxLayout; QHBoxLayout* itemBodyLayout = new QHBoxLayout;