- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions

# QSqlTableModel Class Reference

Search for all occurrences

## Detailed Description

Definition at line 59 of file qsqltablemodel.h.

`#include <qsqltablemodel.h>`

Inheritance diagram for QSqlTableModel:
[legend]

List of all members.

## Public Types
enum | EditStrategy { OnFieldChange, OnRowChange, OnManualSubmit }
## Public Slots
bool | submit ()
void | revert ()
bool | submitAll ()
void | revertAll ()
## Signals
void | primeInsert (int row, QSqlRecord &record)
void | beforeInsert (QSqlRecord &record)
void | beforeUpdate (int row, QSqlRecord &record)
void | beforeDelete (int row)
## Public Member Functions
| QSqlTableModel (QObject *parent=0, QSqlDatabase db=QSqlDatabase())
virtual | ~QSqlTableModel ()
virtual bool | select ()
virtual void | setTable (const QString &tableName)
QString | tableName () const
Qt::ItemFlags | flags (const QModelIndex &index) const
QVariant | data (const QModelIndex &idx, int role=Qt::DisplayRole) const
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
bool | isDirty (const QModelIndex &index) const
void | clear ()
virtual void | setEditStrategy (EditStrategy strategy)
EditStrategy | editStrategy () const
QSqlIndex | primaryKey () const
QSqlDatabase | database () const
int | fieldIndex (const QString &fieldName) const
void | sort (int column, Qt::SortOrder order)
virtual void | setSort (int column, Qt::SortOrder order)
QString | filter () const
virtual void | setFilter (const QString &filter)
int | rowCount (const QModelIndex &parent=QModelIndex()) const
bool | removeColumns (int column, int count, const QModelIndex &parent=QModelIndex())
bool | removeRows (int row, int count, const QModelIndex &parent=QModelIndex())
bool | insertRows (int row, int count, const QModelIndex &parent=QModelIndex())
bool | insertRecord (int row, const QSqlRecord &record)
bool | setRecord (int row, const QSqlRecord &record)
virtual void | revertRow (int row)
## Protected Member Functions
| QSqlTableModel (QSqlTableModelPrivate &dd, QObject *parent=0, QSqlDatabase db=QSqlDatabase())
virtual bool | updateRowInTable (int row, const QSqlRecord &values)
virtual bool | insertRowIntoTable (const QSqlRecord &values)
virtual bool | deleteRowFromTable (int row)
virtual QString | orderByClause () const
virtual QString | selectStatement () const
void | setPrimaryKey (const QSqlIndex &key)
void | setQuery (const QSqlQuery &query)
QModelIndex | indexInQuery (const QModelIndex &item) const

## Member Enumeration Documentation

enum EditStrategy

Search for all occurrences

Enumerator:

  OnFieldChange | Search for all occurrences
  OnRowChange | Search for all occurrences
  OnManualSubmit | Search for all occurrences

Definition at line 65 of file qsqltablemodel.h.

    {OnFieldChange, OnRowChange, OnManualSubmit};

## Constructor & Destructor Documentation

QSqlTableModel | ( | QObject * | parent = `0`,
|  | QSqlDatabase | db = `QSqlDatabase()`
| ) |  | `[explicit]`

virtual ~QSqlTableModel | ( |  | ) | `[virtual]`

QSqlTableModel | ( | QSqlTableModelPrivate & | dd,
|  | QObject * | parent = `0`,
|  | QSqlDatabase | db = `QSqlDatabase()`
| ) |  | `[protected]`

## Member Function Documentation

virtual bool select | ( |  | ) | `[virtual]`

Search for all occurrences

Reimplemented in QSqlRelationalTableModel.

virtual void setTable | ( | const QString & | tableName | ) | `[virtual]`

Search for all occurrences

Reimplemented in QSqlRelationalTableModel.

QString tableName | ( |  | ) | const

Search for all occurrences

Qt::ItemFlags flags | ( | const QModelIndex & | index | ) | const `[virtual]`

Search for all occurrences

Reimplemented from QAbstractItemModel.

QVariant data | ( | const QModelIndex & | idx,
|  | int | role = `Qt::DisplayRole`
| ) |  | const `[virtual]`

Search for all occurrences

Reimplemented from QSqlQueryModel.

Reimplemented in QSqlRelationalTableModel.

bool setData | ( | const QModelIndex & | index,
|  | const QVariant & | value,
|  | int | role = `Qt::EditRole`
| ) |  | `[virtual]`

Search for all occurrences

Reimplemented from QAbstractItemModel.

Reimplemented in QSqlRelationalTableModel.

QVariant headerData | ( | int | section,
|  | Qt::Orientation | orientation,
|  | int | role = `Qt::DisplayRole`
| ) |  | const `[virtual]`

Search for all occurrences

Reimplemented from QSqlQueryModel.

bool isDirty | ( | const QModelIndex & | index | ) | const

Search for all occurrences

void clear | ( |  | ) | `[virtual]`

Search for all occurrences

Reimplemented from QSqlQueryModel.

Reimplemented in QSqlRelationalTableModel.

virtual void setEditStrategy | ( | EditStrategy | strategy | ) | `[virtual]`

Search for all occurrences

EditStrategy editStrategy | ( |  | ) | const

Search for all occurrences

QSqlIndex primaryKey | ( |  | ) | const

Search for all occurrences

QSqlDatabase database | ( |  | ) | const

Search for all occurrences

int fieldIndex | ( | const QString & | fieldName | ) | const

Search for all occurrences

void sort | ( | int | column,
|  | Qt::SortOrder | order
| ) |  | `[virtual]`

Search for all occurrences

Reimplemented from QAbstractItemModel.

virtual void setSort | ( | int | column,
|  | Qt::SortOrder | order
| ) |  | `[virtual]`

Search for all occurrences

QString filter | ( |  | ) | const

Search for all occurrences

virtual void setFilter | ( | const QString & | filter | ) | `[virtual]`

Search for all occurrences

int rowCount | ( | const QModelIndex & | parent = `QModelIndex()` | ) | const `[virtual]`

Search for all occurrences

Reimplemented from QSqlQueryModel.

bool removeColumns | ( | int | column,
|  | int | count,
|  | const QModelIndex & | parent = `QModelIndex()`
| ) |  | `[virtual]`

Search for all occurrences

Reimplemented from QSqlQueryModel.

Reimplemented in QSqlRelationalTableModel.

bool removeRows | ( | int | row,
|  | int | count,
|  | const QModelIndex & | parent = `QModelIndex()`
| ) |  | `[virtual]`

Search for all occurrences

Reimplemented from QAbstractItemModel.

bool insertRows | ( | int | row,
|  | int | count,
|  | const QModelIndex & | parent = `QModelIndex()`
| ) |  | `[virtual]`

Search for all occurrences

Reimplemented from QAbstractItemModel.

bool insertRecord | ( | int | row,
|  | const QSqlRecord & | record
| ) |  |

Search for all occurrences

bool setRecord | ( | int | row,
|  | const QSqlRecord & | record
| ) |  |

Search for all occurrences

virtual void revertRow | ( | int | row | ) | `[virtual]`

Search for all occurrences

Reimplemented in QSqlRelationalTableModel.

bool submit | ( |  | ) | `[virtual, slot]`

Search for all occurrences

Reimplemented from QAbstractItemModel.

void revert | ( |  | ) | `[virtual, slot]`

Search for all occurrences

Reimplemented from QAbstractItemModel.

bool submitAll | ( |  | ) | `[slot]`

Search for all occurrences

void revertAll | ( |  | ) | `[slot]`

Search for all occurrences

void primeInsert | ( | int | row,
|  | QSqlRecord & | record
| ) |  | `[signal]`

Search for all occurrences

void beforeInsert | ( | QSqlRecord & | record | ) | `[signal]`

Search for all occurrences

void beforeUpdate | ( | int | row,
|  | QSqlRecord & | record
| ) |  | `[signal]`

Search for all occurrences

void beforeDelete | ( | int | row | ) | `[signal]`

Search for all occurrences

virtual bool updateRowInTable | ( | int | row,
|  | const QSqlRecord & | values
| ) |  | `[protected, virtual]`

Search for all occurrences

Reimplemented in QSqlRelationalTableModel.

virtual bool insertRowIntoTable | ( | const QSqlRecord & | values | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented in QSqlRelationalTableModel.

virtual bool deleteRowFromTable | ( | int | row | ) | `[protected, virtual]`

Search for all occurrences

virtual QString orderByClause | ( |  | ) | const `[protected, virtual]`

Search for all occurrences

Reimplemented in QSqlRelationalTableModel.

virtual QString selectStatement | ( |  | ) | const `[protected, virtual]`

Search for all occurrences

Reimplemented in QSqlRelationalTableModel.

void setPrimaryKey | ( | const QSqlIndex & | key | ) | `[protected]`

Search for all occurrences

void setQuery | ( | const QSqlQuery & | query | ) | `[protected]`

Search for all occurrences

Reimplemented from QSqlQueryModel.

QModelIndex indexInQuery | ( | const QModelIndex & | item | ) | const `[protected]`

Search for all occurrences

Reimplemented from QSqlQueryModel.

The documentation for this class was generated from the following file:

- QtSql/qsqltablemodel.h

QSqlTableModel QSqlTableModel QSqlTableModel QSqlTableModel QSqlTableModel QSqlTableModel QSqlTableModel QSqlTableModel QSqlTableModel QSqlTableModel
QSqlTableModel QSqlTableModel QSqlTableModel QSqlTableModel QSqlTableModel QSqlTableModel QSqlTableModel QSqlTableModel QSqlTableModel QSqlTableModel