Skip to content
Permalink
Browse files

fix #2299

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12577 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Dec 22, 2009
1 parent 1af6409 commit d7dc77ab13ba533b2d44bbc75c39493eb8ebe1b5
Showing with 31 additions and 4 deletions.
  1. +28 −2 src/app/qgsnewvectorlayerdialog.cpp
  2. +3 −2 src/providers/ogr/qgsogrprovider.cpp
@@ -36,7 +36,7 @@ QgsNewVectorLayerDialog::QgsNewVectorLayerDialog( QWidget *parent, Qt::WFlags fl
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 @@ QgsNewVectorLayerDialog::~QgsNewVectorLayerDialog()

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
@@ -168,10 +168,11 @@ QgsOgrProvider::QgsOgrProvider( QString const & uri )
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 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
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;
}

0 comments on commit d7dc77a

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