Skip to content
Permalink
Browse files
Fix for ticket #678: Attribute table add field, fieldtype select box …
…is empty

git-svn-id: http://svn.osgeo.org/qgis/trunk@6831 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Mar 24, 2007
1 parent fa34897 commit 39f11cf0b16cb3e31a70e07a5134cdc1883d9612
Showing with 27 additions and 20 deletions.
  1. +11 −12 src/app/qgsaddattrdialog.cpp
  2. +10 −0 src/core/qgsvectordataprovider.h
  3. +6 −8 src/providers/postgres/qgspostgresprovider.cpp
@@ -26,20 +26,19 @@ QgsAddAttrDialog::QgsAddAttrDialog(QgsVectorDataProvider* provider, QWidget *par
connect(mCancelButton, SIGNAL(clicked()), this, SLOT(reject()));

//fill data types into the combo box
/*

// TODO: [MD]
const std::list<QString>& numlist=mDataProvider->numericalTypes();
const std::list<QString>& anumlist=mDataProvider->nonNumericalTypes();
const QSet<QString>& numlist=mDataProvider->numericalTypes();
const QSet<QString>& anumlist=mDataProvider->nonNumericalTypes();

for(std::list<QString>::const_iterator iter=numlist.begin();iter!=numlist.end();++iter)
{
mTypeBox->insertItem(*iter);
}
for(std::list<QString>::const_iterator iter=anumlist.begin();iter!=anumlist.end();++iter)
{
mTypeBox->insertItem(*iter);
}
*/
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)
{
mTypeBox->insertItem(*it);
}
}

QgsAddAttrDialog::QgsAddAttrDialog(const std::list<QString>& typelist, QWidget *parent, Qt::WFlags fl)
@@ -267,6 +267,12 @@ 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;}


/**
* Set whether provider should return also features that don't have
@@ -282,6 +288,10 @@ 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;
};

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

//fill type names into lists
/* TODO [MD]
mNumericalTypes.push_back("double precision");
mNumericalTypes.push_back("int4");
mNumericalTypes.push_back("int8");
mNonNumericalTypes.push_back("text");
mNonNumericalTypes.push_back("varchar(30)");
*/
//fill type names into the sets
mNumericalTypes.insert("double precision");
mNumericalTypes.insert("int4");
mNumericalTypes.insert("int8");
mNonNumericalTypes.insert("text");
mNonNumericalTypes.insert("varchar(30)");

if (primaryKey.isEmpty())
{

0 comments on commit 39f11cf

Please sign in to comment.