Skip to content
Permalink
Browse files

Merge pull request #37697 from alexbruy/fix-field-precision

when adding new field apply precision only when field type supports it
  • Loading branch information
alexbruy committed Jul 9, 2020
2 parents 12ddfed + 3a2f5a3 commit ba5a85710b36cfc2e7b6106fd6afa912d2cc2764
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 ba5a857

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