Skip to content

Commit 3a2f5a3

Browse files
committedJul 9, 2020
use enabled/disabled widget state instead of visibility to check when
precision should be applied
1 parent 1531cdb commit 3a2f5a3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/gui/qgsaddattrdialog.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ void QgsAddAttrDialog::setPrecisionMinMax()
9090
int minPrecType = mTypeBox->itemData( idx, Qt::UserRole + 4 ).toInt();
9191
int maxPrecType = mTypeBox->itemData( idx, Qt::UserRole + 5 ).toInt();
9292
bool precisionIsEnabled = minPrecType < maxPrecType;
93+
mPrec->setEnabled( precisionIsEnabled );
9394
mPrec->setVisible( precisionIsEnabled );
9495
mPrecLabel->setVisible( precisionIsEnabled );
9596

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

0 commit comments

Comments
 (0)
Please sign in to comment.