21 #include <QProgressDialog>
22 #include <QDialogButtonBox>
23 #include <QPushButton>
30 : QAbstractItemModel( parent )
39 return createIndex( row, column );
51 return mResults.count();
62 if (
index.row() >= mResults.count() ||
index.row() < 0 )
75 case Qt::DecorationRole:
106 mResultsModel->deleteLater();
109 mResultsListView->setModel( mResultsModel );
111 connect( mResultsListView->selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsValidityCheckResultsWidget::selectionChanged );
113 if ( mResultsModel->
rowCount() > 0 )
116 const QModelIndex firstResult( mResultsModel->
index( 0, 0, QModelIndex() ) );
117 mResultsListView->selectionModel()->select( firstResult, QItemSelectionModel::ClearAndSelect );
118 selectionChanged( firstResult, QModelIndex() );
121 mDescriptionLabel->hide();
126 mDescriptionLabel->setText( description );
127 mDescriptionLabel->setVisible( !description.isEmpty() );
132 std::unique_ptr< QgsFeedback > feedback = qgis::make_unique< QgsFeedback >();
133 std::unique_ptr< QProgressDialog > progressDialog = qgis::make_unique< QProgressDialog >( tr(
"Running Checks…" ), tr(
"Abort" ), 0, 100, parent );
134 progressDialog->setWindowTitle( title );
140 progressDialog->setValue( static_cast< int >( progress ) );
141 progressDialog->setLabelText( feedback->property(
"progress" ).toString() ) ;
143 proxyTask->setProxyProgress( progress );
149 while ( ++nIters < 100 )
152 QCoreApplication::processEvents();
156 connect( progressDialog.get(), &QProgressDialog::canceled, progressDialog.get(), [ & ]
165 proxyTask->finalize(
true );
167 if ( feedback->isCanceled() )
170 if ( results.empty() )
177 bool hasCritical =
false;
187 QVBoxLayout *l =
new QVBoxLayout();
190 QDialog dlg( parent );
191 dlg.setWindowTitle( title );
193 QDialogButtonBox *buttons =
new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, &dlg );
194 connect( buttons, &QDialogButtonBox::accepted, &dlg, &QDialog::accept );
195 connect( buttons, &QDialogButtonBox::rejected, &dlg, &QDialog::reject );
198 buttons->button( QDialogButtonBox::Ok )->setEnabled(
false );
199 buttons->button( QDialogButtonBox::Ok )->setToolTip( tr(
"Critical errors prevent this task from proceeding. Please address these issues and then retry." ) );
202 l->addWidget( buttons );
209 void QgsValidityCheckResultsWidget::selectionChanged(
const QModelIndex ¤t,
const QModelIndex & )
212 mDetailedDescriptionTextBrowser->setHtml( desc );