[QGIS Commit] r12577 - in trunk/qgis/src: app providers/ogr
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Tue Dec 22 08:45:01 EST 2009
Author: jef
Date: 2009-12-22 08:44:59 -0500 (Tue, 22 Dec 2009)
New Revision: 12577
Modified:
trunk/qgis/src/app/qgsnewvectorlayerdialog.cpp
trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
Log:
fix #2299
Modified: trunk/qgis/src/app/qgsnewvectorlayerdialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsnewvectorlayerdialog.cpp 2009-12-22 11:40:55 UTC (rev 12576)
+++ trunk/qgis/src/app/qgsnewvectorlayerdialog.cpp 2009-12-22 13:44:59 UTC (rev 12577)
@@ -36,7 +36,7 @@
mTypeBox->addItem( tr( "Decimal number" ), "Real" );
mWidth->setValidator( new QIntValidator( 1, 255, this ) );
- mPrecision->setValidator( new QIntValidator( 0, 20, this ) );
+ mPrecision->setValidator( new QIntValidator( 0, 5, this ) );
mPointRadioButton->setChecked( true );
mFileFormatComboBox->addItem( tr( "ESRI Shapefile" ), "ESRI Shapefile" );
@@ -65,7 +65,33 @@
void QgsNewVectorLayerDialog::on_mTypeBox_currentIndexChanged( int index )
{
- mPrecision->setEnabled( index == 2 ); // Real
+ // FIXME: sync with providers/ogr/qgsogrprovider.cpp
+ switch ( index )
+ {
+ case 0: // Text data
+ mWidth->setValidator( new QIntValidator( 1, 255, this ) );
+ mPrecision->setEnabled( false );
+ break;
+
+ case 1: // Whole number
+ if ( mWidth->text().toInt() > 10 )
+ mWidth->setText( "10" );
+ mPrecision->setEnabled( false );
+ mWidth->setValidator( new QIntValidator( 1, 10, this ) );
+ break;
+
+ case 2: // Decimal number
+ if ( mWidth->text().toInt() > 20 )
+ mWidth->setText( "20" );
+ mPrecision->setEnabled( false );
+ mWidth->setValidator( new QIntValidator( 1, 20, this ) );
+ mPrecision->setEnabled( true );
+ break;
+
+ default:
+ QgsDebugMsg( "unexpected index" );
+ break;
+ }
}
QGis::WkbType QgsNewVectorLayerDialog::selectedType() const
Modified: trunk/qgis/src/providers/ogr/qgsogrprovider.cpp
===================================================================
--- trunk/qgis/src/providers/ogr/qgsogrprovider.cpp 2009-12-22 11:40:55 UTC (rev 12576)
+++ trunk/qgis/src/providers/ogr/qgsogrprovider.cpp 2009-12-22 13:44:59 UTC (rev 12577)
@@ -168,10 +168,11 @@
valid = false;
}
+ // FIXME: sync with app/qgsnewvectorlayerdialog.cpp
mNativeTypes
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer)" ), "integer", QVariant::Int, 1, 10 )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), "double", QVariant::Double, 1, 20, 0, 5 )
- << QgsVectorDataProvider::NativeType( tr( "Text (string)" ), "string", QVariant::String, 1, 255, 0, 0 )
+ << QgsVectorDataProvider::NativeType( tr( "Text (string)" ), "string", QVariant::String, 1, 255 )
;
}
@@ -1534,7 +1535,7 @@
break;
default:
{
- QgsDebugMsg( QString("Unknown vector type of: %1").arg( ( int )( vectortype ) ) );
+ QgsDebugMsg( QString( "Unknown vector type of: %1" ).arg(( int )( vectortype ) ) );
return false;
break;
}
More information about the QGIS-commit
mailing list