QgsDbTableModel Class Reference

#include <qgsdbtablemodel.h>

List of all members.


Detailed Description

A model that holds the tables of a database in a hierarchy where the schemas are the root elements that contain the individual tables as children.

The tables have the following columns: Type, Schema, Tablename, Geometry Column, Sql

Definition at line 25 of file qgsdbtablemodel.h.

Public Member Functions

 QgsDbTableModel ()
 ~QgsDbTableModel ()
void addTableEntry (QString type, QString schemaName, QString tableName, QString geometryColName, QString Sql)
 Adds entry for one database table to the model.
void setSql (const QModelIndex &index, const QString &sql)
 Sets an sql statement that belongs to a cell specified by a model index.
void setGeometryTypesForTable (const QString &schema, const QString &table, const QString &attribute, const QString &type)
 Sets one or more geometry types to a row.
int tableCount () const
 Returns the number of tables in the model.

Private Member Functions

QIcon iconForType (QGis::WkbType type) const
QString displayStringForType (QGis::WkbType type) const
QGis::WkbType qgisTypeFromDbType (const QString &dbType) const
 Returns qgis wkbtype from database typename.

Private Attributes

int mTableCount
 Number of tables in the model.


Constructor & Destructor Documentation

QgsDbTableModel::QgsDbTableModel (  ) 

Definition at line 22 of file qgsdbtablemodel.cpp.

QgsDbTableModel::~QgsDbTableModel (  ) 

Definition at line 33 of file qgsdbtablemodel.cpp.


Member Function Documentation

void QgsDbTableModel::addTableEntry ( QString  type,
QString  schemaName,
QString  tableName,
QString  geometryColName,
QString  Sql 
)

Adds entry for one database table to the model.

Definition at line 38 of file qgsdbtablemodel.cpp.

References iconForType(), mTableCount, and qgisTypeFromDbType().

Referenced by QgsDbSourceSelect::getTableInfo(), and setGeometryTypesForTable().

void QgsDbTableModel::setSql ( const QModelIndex &  index,
const QString &  sql 
)

Sets an sql statement that belongs to a cell specified by a model index.

Definition at line 85 of file qgsdbtablemodel.cpp.

Referenced by QgsDbSourceSelect::setSql().

void QgsDbTableModel::setGeometryTypesForTable ( const QString &  schema,
const QString &  table,
const QString &  attribute,
const QString &  type 
)

Sets one or more geometry types to a row.

In case of several types, additional rows are inserted. This is for tables where the type is dectected later by thread

Definition at line 151 of file qgsdbtablemodel.cpp.

References addTableEntry(), iconForType(), and qgisTypeFromDbType().

Referenced by QgsDbSourceSelect::setLayerType().

int QgsDbTableModel::tableCount (  )  const [inline]

Returns the number of tables in the model.

Definition at line 39 of file qgsdbtablemodel.h.

References mTableCount.

Referenced by QgsDbSourceSelect::on_btnConnect_clicked().

QIcon QgsDbTableModel::iconForType ( QGis::WkbType  type  )  const [private]

Definition at line 216 of file qgsdbtablemodel.cpp.

References QgisApp::getThemeIcon(), QGis::WKBLineString, QGis::WKBLineString25D, QGis::WKBMultiLineString, QGis::WKBMultiLineString25D, QGis::WKBMultiPoint, QGis::WKBMultiPoint25D, QGis::WKBMultiPolygon, QGis::WKBMultiPolygon25D, QGis::WKBPoint, QGis::WKBPoint25D, QGis::WKBPolygon, and QGis::WKBPolygon25D.

Referenced by addTableEntry(), and setGeometryTypesForTable().

QString QgsDbTableModel::displayStringForType ( QGis::WkbType  type  )  const [private]

Definition at line 233 of file qgsdbtablemodel.cpp.

References QGis::WKBLineString, QGis::WKBLineString25D, QGis::WKBMultiLineString, QGis::WKBMultiLineString25D, QGis::WKBMultiPoint, QGis::WKBMultiPoint25D, QGis::WKBMultiPolygon, QGis::WKBMultiPolygon25D, QGis::WKBPoint, QGis::WKBPoint25D, QGis::WKBPolygon, and QGis::WKBPolygon25D.

QGis::WkbType QgsDbTableModel::qgisTypeFromDbType ( const QString &  dbType  )  const [private]

Returns qgis wkbtype from database typename.

Definition at line 262 of file qgsdbtablemodel.cpp.

References QGis::WKBLineString, QGis::WKBMultiLineString, QGis::WKBMultiPoint, QGis::WKBMultiPolygon, QGis::WKBPoint, QGis::WKBPolygon, and QGis::WKBUnknown.

Referenced by addTableEntry(), and setGeometryTypesForTable().


Member Data Documentation

int QgsDbTableModel::mTableCount [private]

Number of tables in the model.

Definition at line 43 of file qgsdbtablemodel.h.

Referenced by addTableEntry(), and tableCount().


The documentation for this class was generated from the following files:
Generated on Tue Oct 28 16:51:56 2008 for Quantum GIS API Documentation by  doxygen 1.5.1