Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use enabled/disabled widget state instead of visibility to check when
precision should be applied
  • Loading branch information
alexbruy committed Jul 9, 2020
1 parent 1531cdb commit 3a2f5a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/gui/qgsaddattrdialog.cpp
Expand Up @@ -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 );

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

0 comments on commit 3a2f5a3

Please sign in to comment.