Move PrepareCheckWidget text out of ctor.

This commit is contained in:
Teo Mrnjavac 2014-11-13 16:40:39 +01:00
parent 9b2dfdf1ec
commit 280baf7326
3 changed files with 14 additions and 6 deletions

View File

@ -23,8 +23,7 @@
#include <QBoxLayout> #include <QBoxLayout>
PrepareCheckWidget::PrepareCheckWidget( const QString &text, PrepareCheckWidget::PrepareCheckWidget( bool checked,
bool checked,
QWidget* parent ) QWidget* parent )
: QWidget( parent ) : QWidget( parent )
{ {
@ -34,7 +33,7 @@ PrepareCheckWidget::PrepareCheckWidget( const QString &text,
m_iconLabel = new QLabel( this ); m_iconLabel = new QLabel( this );
mainLayout->addWidget( m_iconLabel ); mainLayout->addWidget( m_iconLabel );
m_iconLabel->setFixedSize( CalamaresUtils::defaultIconSize() ); m_iconLabel->setFixedSize( CalamaresUtils::defaultIconSize() );
m_textLabel = new QLabel( text, this ); m_textLabel = new QLabel( this );
mainLayout->addWidget( m_textLabel ); mainLayout->addWidget( m_textLabel );
m_textLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); m_textLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
@ -49,3 +48,10 @@ PrepareCheckWidget::PrepareCheckWidget( const QString &text,
QSize( m_iconLabel->height(), QSize( m_iconLabel->height(),
m_iconLabel->height() ) ) ); m_iconLabel->height() ) ) );
} }
void
PrepareCheckWidget::setText( const QString& text )
{
m_textLabel->setText( text );
}

View File

@ -25,9 +25,10 @@ class PrepareCheckWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit PrepareCheckWidget( const QString &text, explicit PrepareCheckWidget( bool checked,
bool checked,
QWidget* parent = nullptr ); QWidget* parent = nullptr );
void setText( const QString& text );
private: private:
QLabel* m_textLabel; QLabel* m_textLabel;
QLabel* m_iconLabel; QLabel* m_iconLabel;

View File

@ -59,7 +59,8 @@ PreparePage::init( const QList< PrepareEntry >& checkEntries )
for ( const PrepareEntry& entry : checkEntries ) for ( const PrepareEntry& entry : checkEntries )
{ {
PrepareCheckWidget* pcw = new PrepareCheckWidget( entry.text, entry.checked ); PrepareCheckWidget* pcw = new PrepareCheckWidget( entry.checked );
pcw->setText( entry.text );
m_entriesLayout->addWidget( pcw ); m_entriesLayout->addWidget( pcw );
pcw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); pcw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );