Skip to content

Commit

Permalink
Disable ok button when no there's no field
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere authored and nyalldawson committed Oct 22, 2018
1 parent c94eefb commit 41f5abc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gui/qgsnewauxiliarylayerdialog.cpp
Expand Up @@ -20,6 +20,7 @@
#include "qgsauxiliarystorage.h"

#include <QMessageBox>
#include <QPushButton>

QgsNewAuxiliaryLayerDialog::QgsNewAuxiliaryLayerDialog( QgsVectorLayer *layer, QWidget *parent )
: QDialog( parent )
Expand All @@ -30,6 +31,11 @@ QgsNewAuxiliaryLayerDialog::QgsNewAuxiliaryLayerDialog( QgsVectorLayer *layer, Q
const QgsFields fields = mLayer->fields();
for ( const QgsField &field : fields )
comboBox->addItem( field.name() );

if ( fields.isEmpty() )
{
buttonBox->button( QDialogButtonBox::Ok )->setDisabled( true );
}
}

void QgsNewAuxiliaryLayerDialog::accept()
Expand Down

0 comments on commit 41f5abc

Please sign in to comment.