Skip to content
Permalink
Browse files

when adding new field apply precision only when field type supports it

  • Loading branch information
github-actions authored and nyalldawson committed Jul 9, 2020
1 parent 807309a commit 4eca4852a32a689333a124efd665c9a2c92a31a7
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/gui/qgsaddattrdialog.cpp
@@ -90,6 +90,7 @@ void QgsAddAttrDialog::setPrecisionMinMax()
int minPrecType = mTypeBox->itemData( idx, Qt::UserRole + 4 ).toInt();
int maxPrecType = mTypeBox->itemData( idx, Qt::UserRole + 5 ).toInt();
bool precisionIsEnabled = minPrecType < maxPrecType;
mPrec->setEnabled( precisionIsEnabled );
mPrec->setVisible( precisionIsEnabled );
mPrecLabel->setVisible( precisionIsEnabled );

@@ -138,7 +139,7 @@ QgsField QgsAddAttrDialog::field() const
( QVariant::Type ) mTypeBox->currentData( Qt::UserRole ).toInt(),
mTypeBox->currentData( Qt::UserRole + 1 ).toString(),
mLength->value(),
mPrec->value(),
mPrec->isEnabled() ? mPrec->value() : 0,
mCommentEdit->text(),
static_cast<QVariant::Type>( mTypeBox->currentData( Qt::UserRole ).toInt() ) == QVariant::Map ? QVariant::String : QVariant::Invalid
);

0 comments on commit 4eca485

Please sign in to comment.
You can’t perform that action at this time.