#include <QtSql/QSqlTableModel>

More information will be added here shortly. For now, you'll find more extensive information about this class in the Qt reference for QSqlTableModel


Public Types Index

Public Functions Index

QSqlTableModel (QObject *parent=0, QSqlDatabase db=QSqlDatabase())
virtual ~QSqlTableModel ()
virtual voidclear ()
virtual QVariantdata (const QModelIndex &idx, int role=Qt::DisplayRole) const
QSqlDatabasedatabase () const
EditStrategyeditStrategy () const
intfieldIndex (const QString &fieldName) const
QStringfilter () const
virtual Qt::ItemFlagsflags (const QModelIndex &index) const
virtual QVariantheaderData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
boolinsertRecord (int row, const QSqlRecord &record)
virtual boolinsertRows (int row, int count, const QModelIndex &parent=QModelIndex())
boolisDirty (const QModelIndex &index) const
QSqlIndexprimaryKey () const
virtual boolremoveColumns (int column, int count, const QModelIndex &parent=QModelIndex())
virtual boolremoveRows (int row, int count, const QModelIndex &parent=QModelIndex())
virtual voidrevertRow (int row)
virtual introwCount (const QModelIndex &parent=QModelIndex()) const
virtual boolselect ()
virtual boolsetData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
virtual voidsetEditStrategy (EditStrategy strategy)
virtual voidsetFilter (const QString &filter)
boolsetRecord (int row, const QSqlRecord &record)
virtual voidsetSort (int column, Qt::SortOrder order)
virtual voidsetTable (const QString &tableName)
virtual voidsort (int column, Qt::SortOrder order)
QStringtableName () const
virtual QModelIndexbuddy (const QModelIndex &index) const Inherited
virtual boolcanFetchMore (const QModelIndex &parent=QModelIndex()) const Inherited
virtual intcolumnCount (const QModelIndex &parent=QModelIndex()) const Inherited
virtual booldropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)Inherited
virtual voidfetchMore (const QModelIndex &parent=QModelIndex())Inherited
boolhasIndex (int row, int column, const QModelIndex &parent=QModelIndex()) const Inherited
virtual QModelIndexindex (int row, int column, const QModelIndex &parent=QModelIndex()) const Inherited
boolinsertColumn (int column, const QModelIndex &parent=QModelIndex())Inherited
virtual boolinsertColumns (int column, int count, const QModelIndex &parent=QModelIndex())Inherited
boolinsertRow (int row, const QModelIndex &parent=QModelIndex())Inherited
virtual QMap< int, QVariant >itemData (const QModelIndex &index) const Inherited
QSqlErrorlastError () const Inherited
virtual QModelIndexListmatch (const QModelIndex &start, int role, const QVariant &value, int hits=1, Qt::MatchFlags flags=Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const Inherited
virtual QMimeData *mimeData (const QModelIndexList &indexes) const Inherited
virtual QStringListmimeTypes () const Inherited
QAbstractItemModel (QObject *parent=0)Inherited
QAbstractTableModel (QObject *parent=0)Inherited
QSqlQueryModel (QObject *parent=0)Inherited
QSqlQueryquery () const Inherited
QSqlRecordrecord (int row) const Inherited
QSqlRecordrecord () const Inherited
boolremoveColumn (int column, const QModelIndex &parent=QModelIndex())Inherited
boolremoveRow (int row, const QModelIndex &parent=QModelIndex())Inherited
const QHash< int, QByteArray > &roleNames () const Inherited
virtual boolsetHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::EditRole)Inherited
virtual boolsetItemData (const QModelIndex &index, const QMap< int, QVariant > &roles)Inherited
voidsetQuery (const QString &query, const QSqlDatabase &db=QSqlDatabase())Inherited
voidsetSupportedDragActions (Qt::DropActions)Inherited
QModelIndexsibling (int row, int column, const QModelIndex &idx) const Inherited
virtual QSizespan (const QModelIndex &index) const Inherited
Qt::DropActionssupportedDragActions () const Inherited
virtual Qt::DropActionssupportedDropActions () const Inherited

Protected Functions Index

QSqlTableModel (QSqlTableModelPrivate &dd, QObject *parent=0, QSqlDatabase db=QSqlDatabase())
virtual booldeleteRowFromTable (int row)
QModelIndexindexInQuery (const QModelIndex &item) const
virtual boolinsertRowIntoTable (const QSqlRecord &values)
virtual QStringorderByClause () const
virtual QStringselectStatement () const
voidsetPrimaryKey (const QSqlIndex &key)
voidsetQuery (const QSqlQuery &query)
virtual boolupdateRowInTable (int row, const QSqlRecord &values)
voidbeginInsertColumns (const QModelIndex &parent, int first, int last)Inherited
voidbeginInsertRows (const QModelIndex &parent, int first, int last)Inherited
boolbeginMoveColumns (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationColumn)Inherited
boolbeginMoveRows (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationRow)Inherited
voidbeginRemoveColumns (const QModelIndex &parent, int first, int last)Inherited
voidbeginRemoveRows (const QModelIndex &parent, int first, int last)Inherited
voidbeginResetModel ()Inherited
voidchangePersistentIndex (const QModelIndex &from, const QModelIndex &to)Inherited
voidchangePersistentIndexList (const QModelIndexList &from, const QModelIndexList &to)Inherited
QModelIndexcreateIndex (int row, int column, void *data=0) const Inherited
QModelIndexcreateIndex (int row, int column, int id) const Inherited
QModelIndexcreateIndex (int row, int column, quint32 id) const Inherited
booldecodeData (int row, int column, const QModelIndex &parent, QDataStream &stream)Inherited
voidencodeData (const QModelIndexList &indexes, QDataStream &stream) const Inherited
voidendInsertColumns ()Inherited
voidendInsertRows ()Inherited
voidendMoveColumns ()Inherited
voidendMoveRows ()Inherited
voidendRemoveColumns ()Inherited
voidendRemoveRows ()Inherited
voidendResetModel ()Inherited
QModelIndexListpersistentIndexList () const Inherited
QAbstractItemModel (QAbstractItemModelPrivate &dd, QObject *parent=0)Inherited
QAbstractTableModel (QAbstractItemModelPrivate &dd, QObject *parent)Inherited
QSqlQueryModel (QSqlQueryModelPrivate &dd, QObject *parent=0)Inherited
virtual voidqueryChange ()Inherited
voidreset ()Inherited
voidsetLastError (const QSqlError &error)Inherited
voidsetRoleNames (const QHash< int, QByteArray > &roleNames)Inherited

Public Slots Index

virtual voidrevert ()
voidrevertAll ()
virtual boolsubmit ()
boolsubmitAll ()

Signals Index

voidbeforeDelete (int row)
voidbeforeInsert (QSqlRecord &record)
voidbeforeUpdate (int row, QSqlRecord &record)
voidprimeInsert (int row, QSqlRecord &record)
voiddataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)Inherited
voidheaderDataChanged (Qt::Orientation orientation, int first, int last)Inherited
voidlayoutAboutToBeChanged ()Inherited
voidlayoutChanged ()Inherited

Public Types



Public Functions

QSqlTableModel (

virtual~QSqlTableModel ()


virtual void clear ()

virtualQVariant data (

QSqlDatabase database ()

EditStrategy editStrategy ()

int fieldIndex (

QString filter ()

virtual Qt::ItemFlags flags (

virtualQVariant headerData (
  • intsection,
  • Qt::Orientationorientation,
  • introle )

bool insertRecord (

virtual bool insertRows (

bool isDirty (

QSqlIndex primaryKey ()

virtual bool removeColumns (

virtual bool removeRows (

virtual void revertRow (
  • introw)

virtual int rowCount (

virtual bool select ()

virtual bool setData (

virtual void setEditStrategy (
  • EditStrategystrategy)

virtual void setFilter (

bool setRecord (

virtual void setSort (
  • intcolumn,
  • Qt::SortOrderorder )

virtual void setTable (

virtual void sort (
  • intcolumn,
  • Qt::SortOrderorder )

QString tableName ()

virtualQModelIndex buddy (Inherited

virtual bool canFetchMore (Inherited

virtual int columnCount (Inherited

virtual bool dropMimeData (Inherited

virtual void fetchMore (Inherited

bool hasIndex (Inherited

virtualQModelIndex index (Inherited

bool insertColumn (Inherited

virtual bool insertColumns (Inherited

bool insertRow (Inherited

virtualQMap< int, QVariant > itemData (Inherited

QSqlError lastError ()Inherited

virtualQModelIndexList match (Inherited

virtualQMimeData * mimeData (Inherited

virtualQStringList mimeTypes ()Inherited

QAbstractItemModel (Inherited

QAbstractTableModel (Inherited

QSqlQueryModel (Inherited

QSqlQuery query ()Inherited

QSqlRecord record (
  • introw)

QSqlRecord record ()Inherited

bool removeColumn (Inherited

bool removeRow (Inherited

const QHash< int, QByteArray > & roleNames ()Inherited

virtual bool setHeaderData (
  • intsection,
  • Qt::Orientationorientation,
  • const QVariant &value,
  • introle )

virtual bool setItemData (Inherited

void setQuery (Inherited

void setSupportedDragActions (
  • Qt::DropActions)

QModelIndex sibling (Inherited

virtualQSize span (Inherited

Qt::DropActions supportedDragActions ()Inherited

virtual Qt::DropActions supportedDropActions ()Inherited

Protected Functions

QSqlTableModel (

virtual bool deleteRowFromTable (
  • introw)

QModelIndex indexInQuery (

virtual bool insertRowIntoTable (

virtualQString orderByClause ()

virtualQString selectStatement ()

void setPrimaryKey (

void setQuery (

virtual bool updateRowInTable (

void beginInsertColumns (Inherited

void beginInsertRows (Inherited

bool beginMoveColumns (
  • const QModelIndex &sourceParent,
  • intsourceFirst,
  • intsourceLast,
  • const QModelIndex &destinationParent,
  • intdestinationColumn )

bool beginMoveRows (
  • const QModelIndex &sourceParent,
  • intsourceFirst,
  • intsourceLast,
  • const QModelIndex &destinationParent,
  • intdestinationRow )

void beginRemoveColumns (Inherited

void beginRemoveRows (Inherited

void beginResetModel ()Inherited

void changePersistentIndex (Inherited

void changePersistentIndexList (Inherited

QModelIndex createIndex (
  • introw,
  • intcolumn,
  • void *data )

QModelIndex createIndex (
  • introw,
  • intcolumn,
  • intid )

QModelIndex createIndex (
  • introw,
  • intcolumn,
  • quint32id )

bool decodeData (Inherited

void encodeData (Inherited

void endInsertColumns ()Inherited

void endInsertRows ()Inherited

void endMoveColumns ()Inherited

void endMoveRows ()Inherited

void endRemoveColumns ()Inherited

void endRemoveRows ()Inherited

void endResetModel ()Inherited

QModelIndexList persistentIndexList ()Inherited

QAbstractItemModel (
  • QAbstractItemModelPrivate &dd,
  • QObject *parent )

QAbstractTableModel (
  • QAbstractItemModelPrivate &dd,
  • QObject *parent )

QSqlQueryModel (
  • QSqlQueryModelPrivate &dd,
  • QObject *parent )

virtual void queryChange ()Inherited

void reset ()Inherited

void setLastError (Inherited

void setRoleNames (Inherited

Public Slots

virtual void revert ()

void revertAll ()

virtual bool submit ()

bool submitAll ()


void beforeDelete (
  • introw)

void beforeInsert (

void beforeUpdate (

void primeInsert (

void dataChanged (Inherited

void headerDataChanged (
  • Qt::Orientationorientation,
  • intfirst,
  • intlast )

void layoutAboutToBeChanged ()Inherited

void layoutChanged ()Inherited

Last modified: 2015-07-24

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus