mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
[welcome] Name widgets for styling
Widgets are easier to style if they have a name, and easier to spot in the widget tree as well. Give the requirements-checker parts meaningful names. SEE #1685
This commit is contained in:
parent
da2fff1256
commit
5d577371e7
3 changed files with 14 additions and 3 deletions
|
@ -64,6 +64,7 @@ CheckerContainer::requirementsComplete( bool ok )
|
|||
m_waitingWidget = nullptr; // Don't delete in destructor
|
||||
|
||||
m_checkerWidget = new ResultsListWidget( m_model, this );
|
||||
m_checkerWidget->setObjectName( "requirementsChecker" );
|
||||
layout()->addWidget( m_checkerWidget );
|
||||
|
||||
m_verdict = ok;
|
||||
|
|
|
@ -29,11 +29,14 @@ ResultWidget::ResultWidget( bool satisfied, bool required, QWidget* parent )
|
|||
setLayout( mainLayout );
|
||||
|
||||
m_iconLabel = new QLabel( this );
|
||||
mainLayout->addWidget( m_iconLabel );
|
||||
m_iconLabel->setFixedSize( CalamaresUtils::defaultIconSize() );
|
||||
m_iconLabel->setObjectName( "resultIcon" );
|
||||
mainLayout->addWidget( m_iconLabel );
|
||||
|
||||
m_textLabel = new QLabel( this );
|
||||
mainLayout->addWidget( m_textLabel );
|
||||
m_textLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||
m_textLabel->setObjectName( "resultText" );
|
||||
mainLayout->addWidget( m_textLabel );
|
||||
|
||||
if ( satisfied )
|
||||
{
|
||||
|
|
|
@ -52,9 +52,12 @@ createResultWidgets( QLayout* layout,
|
|||
continue;
|
||||
}
|
||||
|
||||
const QString checkName = model.data( index, Calamares::RequirementsModel::Name ).toString();
|
||||
const bool is_satisfied = model.data( index, Calamares::RequirementsModel::Satisfied ).toBool();
|
||||
const bool is_mandatory = model.data( index, Calamares::RequirementsModel::Mandatory ).toBool();
|
||||
ResultWidget* ciw = new ResultWidget( is_satisfied, is_mandatory );
|
||||
ciw->setObjectName( checkName );
|
||||
|
||||
layout->addWidget( ciw );
|
||||
ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||
|
||||
|
@ -105,6 +108,7 @@ ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model,
|
|||
auto* entriesLayout = new QVBoxLayout;
|
||||
|
||||
m_title = new QLabel( this );
|
||||
m_title->setObjectName( "resultDialogTitle" );
|
||||
|
||||
createResultWidgets(
|
||||
entriesLayout, m_resultWidgets, model, []( const Calamares::RequirementsModel& m, QModelIndex i ) {
|
||||
|
@ -112,6 +116,7 @@ ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model,
|
|||
} );
|
||||
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this );
|
||||
buttonBox->setObjectName( "resultDialogButtons" );
|
||||
|
||||
mainLayout->addWidget( m_title );
|
||||
mainLayout->addLayout( entriesLayout );
|
||||
|
@ -168,6 +173,7 @@ ResultsListWidget::ResultsListWidget( const Calamares::RequirementsModel& model,
|
|||
m_explanation->setWordWrap( true );
|
||||
m_explanation->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||
m_explanation->setOpenExternalLinks( false );
|
||||
m_explanation->setObjectName( "resultsExplanation" );
|
||||
connect( m_explanation, &QLabel::linkActivated, this, &ResultsListWidget::linkClicked );
|
||||
entriesLayout->addWidget( m_explanation );
|
||||
|
||||
|
@ -208,9 +214,10 @@ ResultsListWidget::ResultsListWidget( const Calamares::RequirementsModel& model,
|
|||
}
|
||||
|
||||
imageLabel->setContentsMargins( 4, CalamaresUtils::defaultFontHeight() * 3 / 4, 4, 4 );
|
||||
mainLayout->addWidget( imageLabel );
|
||||
imageLabel->setAlignment( Qt::AlignCenter );
|
||||
imageLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||
imageLabel->setObjectName( "welcomeLogo" );
|
||||
mainLayout->addWidget( imageLabel );
|
||||
}
|
||||
}
|
||||
m_explanation->setAlignment( Qt::AlignCenter );
|
||||
|
|
Loading…
Add table
Reference in a new issue