Skip to content

Instantly share code, notes, and snippets.

@slarosa
Created August 21, 2013 09:27
Show Gist options
  • Save slarosa/6292293 to your computer and use it in GitHub Desktop.
Save slarosa/6292293 to your computer and use it in GitHub Desktop.
Fix for #8480 and #8481
diff --git a/src/app/qgsaddattrdialog.cpp b/src/app/qgsaddattrdialog.cpp
index c21e204..b32cb00 100644
--- a/src/app/qgsaddattrdialog.cpp
+++ b/src/app/qgsaddattrdialog.cpp
@@ -61,7 +61,7 @@ void QgsAddAttrDialog::on_mTypeBox_currentIndexChanged( int idx )
mLength->setMinimum( mTypeBox->itemData( idx, Qt::UserRole + 2 ).toInt() );
mLength->setMaximum( mTypeBox->itemData( idx, Qt::UserRole + 3 ).toInt() );
- mLength->setVisible( mLength->minimum() < mLength->maximum() );
+ mLength->setEnabled( mLength->minimum() < mLength->maximum() );
if ( mLength->value() < mLength->minimum() )
mLength->setValue( mLength->minimum() );
if ( mLength->value() > mLength->maximum() )
@@ -79,7 +79,7 @@ void QgsAddAttrDialog::setPrecisionMinMax()
int idx = mTypeBox->currentIndex();
int minPrecType = mTypeBox->itemData( idx, Qt::UserRole + 4 ).toInt();
int maxPrecType = mTypeBox->itemData( idx, Qt::UserRole + 5 ).toInt();
- mPrec->setVisible( minPrecType < maxPrecType );
+ mPrec->setEnabled( minPrecType < maxPrecType );
if ( mPrec->isVisible() )
{
mPrec->setMinimum( minPrecType );
diff --git a/src/core/qgsvectorlayereditbuffer.cpp b/src/core/qgsvectorlayereditbuffer.cpp
index 8d3a1af..6783f0f 100644
--- a/src/core/qgsvectorlayereditbuffer.cpp
+++ b/src/core/qgsvectorlayereditbuffer.cpp
@@ -325,7 +325,7 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
{
const QgsField& oldField = oldFields[i];
const QgsField& newField = newFields[i];
- if ( attributeChangesOk && oldField != newField )
+ if ( attributeChangesOk && ( oldField.type() != newField.type() && oldField.typeName() != newField.typeName() ) )
{
commitErrors << tr( "ERROR: field with index %1 is not the same!" ).arg( i );
attributeChangesOk = false; // don't try attribute updates - they'll fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment