Skip to content
Permalink
Browse files
Only one list of typenames for data providers
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6843 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Mar 29, 2007
1 parent 5b4484d commit e34d6a499d75b319adb1216376c233801f7ff57e
Showing with 12 additions and 25 deletions.
  1. +3 −10 src/app/qgsaddattrdialog.cpp
  2. +3 −9 src/core/qgsvectordataprovider.h
  3. +6 −6 src/providers/postgres/qgspostgresprovider.cpp
@@ -25,17 +25,10 @@ QgsAddAttrDialog::QgsAddAttrDialog(QgsVectorDataProvider* provider, QWidget *par
connect(mOkButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(mCancelButton, SIGNAL(clicked()), this, SLOT(reject()));

//fill data types into the combo box

// TODO: [MD]
const QSet<QString>& numlist=mDataProvider->numericalTypes();
const QSet<QString>& anumlist=mDataProvider->nonNumericalTypes();
//fill data types into the combo box
const QSet<QString>& typelist=mDataProvider->supportedNativeTypes();

for(QSet<QString>::const_iterator it = numlist.constBegin(); it != numlist.constEnd(); ++it)
{
mTypeBox->insertItem(*it);
}
for(QSet<QString>::const_iterator it = anumlist.constBegin(); it != anumlist.constEnd(); ++it)
for(QSet<QString>::const_iterator it = typelist.constBegin(); it != typelist.constEnd(); ++it)
{
mTypeBox->insertItem(*it);
}
@@ -268,11 +268,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
QgsAttributeList allAttributesList();

/**Returns the names of the numerical types*/
const QSet<QString> numericalTypes() const {return mNumericalTypes;}

/**Returns the names of the non numerical types*/
const QSet<QString> nonNumericalTypes() const {return mNonNumericalTypes;}

const QSet<QString>& supportedNativeTypes() const {return mSupportedNativeTypes;}

/**
* Set whether provider should return also features that don't have
@@ -288,10 +284,8 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
/** should provider fetch also features that don't have geometry? */
bool mFetchFeaturesWithoutGeom;

/**The names of the numerical types*/
QSet<QString> mNumericalTypes;
/**The names of the non-numerical types*/
QSet<QString> mNonNumericalTypes;
/**The names of the providers native types*/
QSet<QString> mSupportedNativeTypes;
};

#endif
@@ -291,12 +291,12 @@ QgsPostgresProvider::QgsPostgresProvider(QString const & uri)
//--std::cout << "Connection to database failed\n";
}

//fill type names into the sets
mNumericalTypes.insert("double precision");
mNumericalTypes.insert("int4");
mNumericalTypes.insert("int8");
mNonNumericalTypes.insert("text");
mNonNumericalTypes.insert("varchar(30)");
//fill type names into sets
mSupportedNativeTypes.insert("double precision");
mSupportedNativeTypes.insert("int4");
mSupportedNativeTypes.insert("int8");
mSupportedNativeTypes.insert("text");
mSupportedNativeTypes.insert("varchar(30)");

if (primaryKey.isEmpty())
{

0 comments on commit e34d6a4

Please sign in to comment.