[welcome] Remove compensating-for-model-reset code
The model was emptied-and-refilled when re-checked, which meant we needed to have some special handling when messages changed to avoid re-creating widgets. Since we use a model view now, we don't need the extra machinery.
This commit is contained in:
parent
8b917ace4d
commit
0b2af86ec9
@ -128,15 +128,7 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent )
|
||||
mainLayout->addWidget( listview );
|
||||
mainLayout->addStretch();
|
||||
|
||||
connect( config,
|
||||
&Config::warningMessageChanged,
|
||||
[ = ]( QString s )
|
||||
{
|
||||
if ( isModelFilled() )
|
||||
{
|
||||
m_explanation->setText( s );
|
||||
}
|
||||
} );
|
||||
connect( config, &Config::warningMessageChanged, m_explanation, &QLabel::setText );
|
||||
connect( m_explanation, &QLabel::linkActivated, this, &ResultsListWidget::linkClicked );
|
||||
}
|
||||
|
||||
@ -155,11 +147,6 @@ ResultsListWidget::linkClicked( const QString& link )
|
||||
void
|
||||
ResultsListWidget::requirementsChanged()
|
||||
{
|
||||
if ( !isModelFilled() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check that all are satisfied (gives warnings if not) and
|
||||
// all *mandatory* entries are satisfied (gives errors if not).
|
||||
|
||||
@ -204,18 +191,6 @@ ResultsListWidget::requirementsChanged()
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ResultsListWidget::isModelFilled()
|
||||
{
|
||||
if ( m_config->requirementsModel()->count() < m_requirementsSeen )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_requirementsSeen = m_config->requirementsModel()->count();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#include "utils/moc-warnings.h"
|
||||
|
||||
#include "ResultsListWidget.moc"
|
||||
|
@ -32,19 +32,6 @@ private:
|
||||
/// @brief The model of requirements changed
|
||||
void requirementsChanged();
|
||||
|
||||
/** @brief The model can be reset and re-filled, is it full yet?
|
||||
*
|
||||
* We count how many requirements we have seen; since the model
|
||||
* does not shrink, we can avoid reacting to model-is-cleared
|
||||
* events because the size of the model is then (briefly) smaller
|
||||
* than what we expect.
|
||||
*
|
||||
* Returns true if the model contains at least m_requirementsSeen
|
||||
* elements, and updates m_requirementsSeen. (Which is why the
|
||||
* method is not const)
|
||||
*/
|
||||
bool isModelFilled();
|
||||
|
||||
Config* m_config = nullptr;
|
||||
|
||||
// UI parts, which need updating when the model changes
|
||||
@ -56,8 +43,6 @@ private:
|
||||
// it is placed in the central layout.
|
||||
QWidget* m_centralWidget = nullptr;
|
||||
QBoxLayout* m_centralLayout = nullptr;
|
||||
|
||||
int m_requirementsSeen = 0;
|
||||
};
|
||||
|
||||
#endif // CHECKER_RESULTSLISTWIDGET_H
|
||||
|
Loading…
Reference in New Issue
Block a user