Display an error when an auxiliary layer cannot be created

This commit is contained in:
Blottiere Paul 2021-06-03 22:25:02 +02:00
parent d290df292f
commit eb7d465c42

View File

@ -46,13 +46,18 @@ void QgsNewAuxiliaryLayerDialog::accept()
if ( idx >= 0 )
{
QString errorMsg;
const QgsField field = mLayer->fields().field( idx );
QgsAuxiliaryLayer *alayer = QgsProject::instance()->auxiliaryStorage()->createAuxiliaryLayer( field, mLayer );
QgsAuxiliaryLayer *alayer = QgsProject::instance()->auxiliaryStorage()->createAuxiliaryLayer( field, mLayer, &errorMsg );
if ( alayer )
{
mLayer->setAuxiliaryLayer( alayer );
}
else
{
QMessageBox::critical( this, tr( "New Auxiliary Layer" ), errorMsg );
}
}
QDialog::accept();