Skip to content

Commit

Permalink
Fix for ticket #678: Attribute table add field, fieldtype select box …
Browse files Browse the repository at this point in the history
…is empty

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6831 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Mar 24, 2007
1 parent 5fb2b17 commit c98095c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 20 deletions.
23 changes: 11 additions & 12 deletions src/app/qgsaddattrdialog.cpp
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions src/core/qgsvectordataprovider.h
Expand Up @@ -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
Expand All @@ -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
14 changes: 6 additions & 8 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -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())
{
Expand Down

0 comments on commit c98095c

Please sign in to comment.