QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
A model containing tables from a database connection. More...
#include <qgsdatabasetablemodel.h>
Public Types | |
enum | Role { RoleTableName = Qt::UserRole, RoleSchema, RoleTableFlags, RoleComment, RoleCustomInfo, RoleWkbType, RoleCrs, RoleEmpty } |
Model roles. More... | |
Public Slots | |
void | refresh () |
Refreshes the table list by querying the underlying connection. More... | |
Public Member Functions | |
QgsDatabaseTableModel (const QString &provider, const QString &connection, const QString &schema=QString(), QObject *parent=nullptr) | |
Constructor for QgsDatabaseTableModel, for the specified provider and connection name. More... | |
QgsDatabaseTableModel (QgsAbstractDatabaseProviderConnection *connection, const QString &schema=QString(), QObject *parent=nullptr) | |
Constructor for QgsDatabaseTableModel, for the specified connection. More... | |
bool | allowEmptyTable () const |
Returns true if the model allows the empty table ("not set") choice. More... | |
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
QModelIndex | index (int row, int column, const QModelIndex &parent) const override |
QModelIndex | parent (const QModelIndex &child) const override |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
void | setAllowEmptyTable (bool allowEmpty) |
Sets whether an optional empty table ("not set") option is present in the model. More... | |
A model containing tables from a database connection.
This class does not automatically subscribe to database updates. Tables are queried from the database initially upon model construction. In order to update the listed tbales, QgsDatabaseTableModel::refresh() must be manually called.
Definition at line 39 of file qgsdatabasetablemodel.h.
Model roles.
Definition at line 46 of file qgsdatabasetablemodel.h.
|
explicit |
Constructor for QgsDatabaseTableModel, for the specified provider and connection name.
The optional schema argument can be used to restrict the tables to those from a specific schema.
Definition at line 21 of file qgsdatabasetablemodel.cpp.
|
explicit |
Constructor for QgsDatabaseTableModel, for the specified connection.
The optional schema argument can be used to restrict the tables to those from a specific schema.
Ownership of connection is transferred to the model.
Definition at line 33 of file qgsdatabasetablemodel.cpp.
|
inline |
Returns true
if the model allows the empty table ("not set") choice.
Definition at line 94 of file qgsdatabasetablemodel.h.
|
override |
Definition at line 63 of file qgsdatabasetablemodel.cpp.
|
override |
Definition at line 70 of file qgsdatabasetablemodel.cpp.
|
override |
Definition at line 164 of file qgsdatabasetablemodel.cpp.
|
override |
Definition at line 48 of file qgsdatabasetablemodel.cpp.
|
slot |
Refreshes the table list by querying the underlying connection.
Definition at line 193 of file qgsdatabasetablemodel.cpp.
|
override |
Definition at line 55 of file qgsdatabasetablemodel.cpp.
void QgsDatabaseTableModel::setAllowEmptyTable | ( | bool | allowEmpty | ) |
Sets whether an optional empty table ("not set") option is present in the model.
Definition at line 174 of file qgsdatabasetablemodel.cpp.