42 #ifndef QSQLTABLEMODEL_H 43 #define QSQLTABLEMODEL_H 45 #include <QtSql/qsqldatabase.h> 46 #include <QtSql/qsqlquerymodel.h> 72 virtual void setTable(
const QString &tableName);
90 int fieldIndex(
const QString &fieldName)
const;
96 virtual void setFilter(
const QString &filter);
104 bool insertRecord(
int row,
const QSqlRecord &record);
105 bool setRecord(
int row,
const QSqlRecord &record);
107 virtual void revertRow(
int row);
117 void primeInsert(
int row,
QSqlRecord &record);
120 void beforeUpdate(
int row,
QSqlRecord &record);
121 void beforeDelete(
int row);
127 virtual bool insertRowIntoTable(
const QSqlRecord &values);
128 virtual bool deleteRowFromTable(
int row);
129 virtual QString orderByClause()
const;
130 virtual QString selectStatement()
const;
141 #endif // QSQLTABLEMODEL_H The QVariant class acts like a union for the most common Qt data types.
The QSqlIndex class provides functions to manipulate and describe database indexes.
QModelIndex indexInQuery(const QModelIndex &item) const
Returns the index of the value in the database result set for the given item in the model...
EditStrategy
This enum type describes which strategy to choose when editing values in the database.
#define QT_END_NAMESPACE
This macro expands to.
int rowCount(const QModelIndex &parent=QModelIndex()) const
If the database supports returning the size of a query (see QSqlDriver::hasFeature()), the number of rows of the current query is returned.
The QSqlQuery class provides a means of executing and manipulating SQL statements.
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *)
The QSqlDatabase class represents a connection to a database.
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Sets the role data for the item at index to value.
The QSqlRecord class encapsulates a database record.
The QString class provides a Unicode character string.
QVariant data(const QModelIndex &item, int role=Qt::DisplayRole) const
Returns the value for the specified item and role.
The QObject class is the base class of all Qt objects.
virtual bool submit()
Lets the model know that it should submit cached information to permanent storage.
virtual void sort(int column, Qt::SortOrder order=Qt::AscendingOrder)
Sorts the model by column in the given order.
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
The QSqlQueryModel class provides a read-only data model for SQL result sets.
#define QT_BEGIN_NAMESPACE
This macro expands to.
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
On models that support this, removes count rows starting with the given row under parent parent from ...
virtual bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
On models that support this, inserts count rows into the model before the given row.
void setQuery(const QSqlQuery &query)
Resets the model and sets the data provider to be the given query.
virtual void clear()
Clears the model and releases any acquired resource.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Returns the header data for the given role in the section of the header with the specified orientatio...
The QModelIndex class is used to locate data in a data model.
QFuture< void > filter(Sequence &sequence, FilterFunction filterFunction)
The QSqlTableModel class provides an editable data model for a single database table.
#define Q_DECLARE_PRIVATE(Class)
The QSqlField class manipulates the fields in SQL database tables and views.
virtual void revert()
Lets the model know that it should discard cached information.
bool removeColumns(int column, int count, const QModelIndex &parent=QModelIndex())
Removes count columns from the model starting from position column.