Qyoto  4.0.7
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties
QtSql.QSqlTableModel Class Reference

The QSqlTableModel class provides an editable data model for a single database table. More...

Inheritance diagram for QtSql.QSqlTableModel:
Collaboration diagram for QtSql.QSqlTableModel:

Public Types

enum  EditStrategy { OnFieldChange = 0, OnManualSubmit = 2, OnRowChange = 1 }
  More...
 

Public Member Functions

 QSqlTableModel (QObject parent=null)
  More...
 
 QSqlTableModel (QObject parent, QSqlDatabase db)
  More...
 
override void CreateProxy ()
 
override void Clear ()
  More...
 
override object Data (QModelIndex idx, int role=(int) Qt.ItemDataRole.DisplayRole)
  More...
 
new int FieldIndex (string fieldName)
  More...
 
override Qt.ItemFlag Flags (QModelIndex index)
  More...
 
override object HeaderData (int section, Qt.Orientation orientation, int role=(int) Qt.ItemDataRole.DisplayRole)
  More...
 
new bool InsertRecord (int row, QSqlRecord record)
  More...
 
new bool InsertRows (int row, int count)
  More...
 
override bool InsertRows (int row, int count, QModelIndex parent)
  More...
 
new bool IsDirty (QModelIndex index)
  More...
 
new bool RemoveColumns (int column, int count)
  More...
 
override bool RemoveColumns (int column, int count, QModelIndex parent)
  More...
 
new bool RemoveRows (int row, int count)
  More...
 
override bool RemoveRows (int row, int count, QModelIndex parent)
  More...
 
override void Revert ()
  More...
 
new void RevertAll ()
  More...
 
virtual void RevertRow (int row)
  More...
 
new int RowCount ()
  More...
 
override int RowCount (QModelIndex parent)
  More...
 
virtual bool Select ()
  More...
 
override bool SetData (QModelIndex index, object value, int role=(int) Qt.ItemDataRole.EditRole)
  More...
 
new bool SetRecord (int row, QSqlRecord record)
  More...
 
virtual void SetSort (int column, Qt.SortOrder order)
  More...
 
virtual void SetTable (string tableName)
  More...
 
override void Sort (int column, Qt.SortOrder order)
  More...
 
override bool Submit ()
  More...
 
new bool SubmitAll ()
  More...
 
new void Dispose ()
 
- Public Member Functions inherited from QtSql.QSqlQueryModel
 QSqlQueryModel (QObject parent=null)
  More...
 
new bool CanFetchMore ()
  More...
 
override bool CanFetchMore (QModelIndex parent)
  More...
 
new int ColumnCount ()
  More...
 
override int ColumnCount (QModelIndex parent)
  More...
 
new void FetchMore ()
  More...
 
override void FetchMore (QModelIndex parent)
  More...
 
new bool InsertColumns (int column, int count)
  More...
 
override bool InsertColumns (int column, int count, QModelIndex parent)
  More...
 
new QSqlRecord Record ()
  More...
 
new QSqlRecord Record (int row)
  More...
 
new bool RemoveColumns (int column, int count)
  More...
 
new int RowCount ()
  More...
 
override bool SetHeaderData (int section, Qt.Orientation orientation, object value, int role=(int) Qt.ItemDataRole.EditRole)
  More...
 
new void SetQuery (string query)
  More...
 
new void SetQuery (string query, QSqlDatabase db)
  More...
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QAbstractTableModel
 QAbstractTableModel (QObject parent=null)
  More...
 
override bool DropMimeData (QMimeData data, Qt.DropAction action, int row, int column, QModelIndex parent)
  More...
 
new QModelIndex Index (int row, int column)
  More...
 
override QModelIndex Index (int row, int column, QModelIndex parent)
  More...
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QAbstractItemModel
 QAbstractItemModel (QObject parent=null)
  More...
 
virtual QModelIndex Buddy (QModelIndex index)
  More...
 
new bool HasChildren ()
  More...
 
virtual bool HasChildren (QModelIndex parent)
  More...
 
new bool HasIndex (int row, int column)
  More...
 
new bool HasIndex (int row, int column, QModelIndex parent)
  More...
 
new QModelIndex Index (int row, int column)
  More...
 
new bool InsertColumn (int column)
  More...
 
new bool InsertColumn (int column, QModelIndex parent)
  More...
 
new bool InsertColumns (int column, int count)
  More...
 
new bool InsertRow (int row)
  More...
 
new bool InsertRow (int row, QModelIndex parent)
  More...
 
new bool InsertRows (int row, int count)
  More...
 
virtual
System.Collections.Generic.Dictionary
< System.Int32, System.Object > 
ItemData (QModelIndex index)
  More...
 
virtual
System.Collections.Generic.List
< QModelIndex
Match (QModelIndex start, int role, object value, int hits=1, Qt.MatchFlag flags=Qt.MatchFlag.MatchStartsWith|Qt.MatchFlag.MatchWrap)
  More...
 
virtual QMimeData MimeData (System.Collections.Generic.List< QModelIndex > indexes)
  More...
 
new QObject Parent ()
 
abstract QModelIndex Parent (QModelIndex child)
  More...
 
new bool RemoveColumn (int column)
  More...
 
new bool RemoveColumn (int column, QModelIndex parent)
  More...
 
new bool RemoveColumns (int column, int count)
  More...
 
new bool RemoveRow (int row)
  More...
 
new bool RemoveRow (int row, QModelIndex parent)
  More...
 
new bool RemoveRows (int row, int count)
  More...
 
new int RowCount ()
  More...
 
virtual bool SetItemData (QModelIndex index, System.Collections.Generic.Dictionary< System.Int32, System.Object > roles)
  More...
 
new QModelIndex Sibling (int row, int column, QModelIndex idx)
  More...
 
virtual QSize Span (QModelIndex index)
  More...
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QObject
 QObject (QObject parent=null)
  More...
 
new bool BlockSignals (bool b)
  More...
 
new bool Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
  More...
 
new void DeleteLater ()
  More...
 
new bool Disconnect (QObject receiver, string member=null)
  More...
 
new bool Disconnect (string signal=null, QObject receiver=null, string member=null)
  More...
 
new void DumpObjectInfo ()
  More...
 
new void DumpObjectTree ()
  More...
 
virtual bool OnEvent (QEvent e)
  More...
 
virtual bool EventFilter (QObject watched, QEvent @event)
  More...
 
new bool Inherits (string classname)
  More...
 
new void InstallEventFilter (QObject filterObj)
  More...
 
new void KillTimer (int id)
  More...
 
new object Property (string name)
  More...
 
new void RemoveEventFilter (QObject obj)
  More...
 
new bool SetProperty (string name, object value)
  More...
 
new void SetUserData (uint id, QObjectUserData data)
 
new int StartTimer (int interval)
  More...
 
new QObjectUserData UserData (uint id)
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.Qt
delegate QTextStream FuncQTextStreamQTextStream (QTextStream qTextStream)
 
delegate void ActionQtMsgTypeString (QtMsgType qtMsgType, string @string)
 
delegate QObject FuncQObject ()
 
delegate string FuncStringQByteArray (QByteArray qByteArray)
 
delegate QByteArray FuncQByteArrayString (string @string)
 

Static Public Member Functions

static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtSql.QSqlQueryModel
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QAbstractTableModel
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QAbstractItemModel
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QObject
static bool Connect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod method, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
  More...
 
static bool Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
  More...
 
static bool Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member)
  More...
 
static bool Disconnect (QObject sender, string signal, QObject receiver, string member)
  More...
 
static string Tr (string s, string c=null)
  More...
 
static string Tr (string s, string c, int n)
  More...
 
static string TrUtf8 (string s, string c=null)
  More...
 
static string TrUtf8 (string s, string c, int n)
  More...
 
- Static Public Member Functions inherited from QtCore.Qt
static QDataStream Write (QDataStream s, object p)
 
static QDataStream Write (QDataStream stream, QSizeF size)
  More...
 
static QDataStream Write (QDataStream stream, QPoint point)
  More...
 
static QTextStream Write (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Write (QDataStream stream, QLineF line)
  More...
 
static QDataStream Write (QDataStream stream, QPointF point)
  More...
 
static QDataStream Write (QDataStream @out, QChar chr)
  More...
 
static QDataStream Write (QDataStream @out, QByteArray ba)
  More...
 
static QDataStream Write (QDataStream stream, QEasingCurve easing)
  More...
 
static QDataStream Write (QDataStream stream, QRectF rectangle)
  More...
 
static QDataStream Write (QDataStream @out, QDateTime dateTime)
  More...
 
static QDataStream Write (QDataStream @out, QUrl url)
  More...
 
static QDataStream Write (QDataStream @out, QTime time)
  More...
 
static QDataStream Write (QDataStream arg1, QLocale arg2)
 
static QDataStream Write (QDataStream @out, QBitArray ba)
  More...
 
static QDataStream Write (QDataStream s, QUuid id)
  More...
 
static QDataStream Write (QDataStream stream, QLine line)
  More...
 
static QDataStream Write (QDataStream @out, QDate date)
  More...
 
static QDataStream Write (QDataStream @out, QRegExp regExp)
  More...
 
static QDataStream Write (QDataStream stream, QRect rectangle)
  More...
 
static QDataStream Write (QDataStream stream, QSize size)
  More...
 
static QDataStream Write (QDataStream s, QVariant.Type p)
 
static QDataStream Write (QDataStream arg1, string arg2)
 
static QDataStream Write (QDataStream @out, System.Collections.Generic.List< string > list)
  More...
 
static QDataStream Read (QDataStream @in, QChar chr)
  More...
 
static QDataStream Read (QDataStream arg1, QLocale arg2)
 
static QDataStream Read (QDataStream stream, QRect rectangle)
  More...
 
static QDataStream Read (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Read (QDataStream @in, QDate date)
  More...
 
static QDataStream Read (QDataStream @in, QUrl url)
  More...
 
static QDataStream Read (QDataStream s, QUuid id)
  More...
 
static QTextStream Read (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Read (QDataStream stream, QLineF line)
  More...
 
static QDataStream Read (QDataStream stream, QRectF rectangle)
  More...
 
static QDataStream Read (QDataStream stream, QPointF point)
  More...
 
static QDataStream Read (QDataStream stream, QLine line)
  More...
 
static QDataStream Read (QDataStream @in, QBitArray ba)
  More...
 
static QDataStream Read (QDataStream stream, QSize size)
  More...
 
static QDataStream Read (QDataStream @in, QDateTime dateTime)
  More...
 
static QDataStream Read (QDataStream @in, QTime time)
  More...
 
static QDataStream Read (QDataStream stream, QPoint point)
  More...
 
static QDataStream Read (QDataStream @in, QRegExp regExp)
  More...
 
static QDataStream Read (QDataStream s, object p)
 
static QDataStream Read (QDataStream @in, QByteArray ba)
  More...
 
static QDataStream Read (QDataStream stream, QSizeF size)
  More...
 
static QDataStream Read (QDataStream arg1, string arg2)
 
static QDataStream Read (QDataStream s, QVariant.Type p)
 
static QDataStream Read (QDataStream @in, System.Collections.Generic.List< string > list)
  More...
 
static double QAcos (double v)
  More...
 
static void QAddPostRoutine (System.Action ptr)
  More...
 
static double QAsin (double v)
  More...
 
static double QAtan (double v)
  More...
 
static double QAtan2 (double x, double y)
  More...
 
static void QBadAlloc ()
 
static int QCeil (double v)
  More...
 
static ushort QChecksum (string s, uint len)
  More...
 
static QByteArray QCompress (QByteArray data, int compressionLevel=-1)
  More...
 
static QByteArray QCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1)
  More...
 
static double QCos (double v)
  More...
 
static double QExp (double v)
  More...
 
static double QFabs (double v)
 
static double QFastCos (double x)
 
static double QFastSin (double x)
 
static string QFlagLocation (string method)
 
static int QFloor (double v)
  More...
 
static bool QFuzzyCompare (double p1, double p2)
  More...
 
static bool QFuzzyCompare (float p1, float p2)
  More...
 
static bool QFuzzyIsNull (double d)
 
static bool QFuzzyIsNull (float f)
 
static uint QHash (QBitArray key)
  More...
 
static uint QHash (QChar key)
  More...
 
static uint QHash (QStringRef key)
 
static uint QHash (QUrl url)
  More...
 
static uint QHash (QPersistentModelIndex index)
 
static uint QHash (QByteArray key)
  More...
 
static uint QHash (QModelIndex index)
 
static uint QHash (uint key)
  More...
 
static uint QHash (char key)
  More...
 
static uint QHash (byte key)
  More...
 
static uint QHash (short key)
  More...
 
static uint QHash (NativeLong key)
  More...
 
static uint QHash (ushort key)
  More...
 
static uint QHash (long key)
  More...
 
static uint QHash (ulong key)
  More...
 
static uint QHash (int key)
  More...
 
static uint QHash (string key)
  More...
 
static uint QHash (NativeULong key)
  More...
 
static Qt.ActionQtMsgTypeString QInstallMsgHandler (Qt.ActionQtMsgTypeString handler)
  More...
 
static int QIntCast (float f)
 
static int QIntCast (double f)
 
static bool QIsFinite (double d)
 
static bool QIsFinite (float f)
 
static bool QIsInf (float f)
 
static bool QIsInf (double d)
 
static bool QIsNaN (float f)
 
static bool QIsNaN (double d)
 
static bool QIsNull (float f)
 
static bool QIsNull (double d)
 
static double QLn (double v)
  More...
 
static double QPow (double x, double y)
  More...
 
static void QRegisterStaticPluginInstanceFunction (Qt.FuncQObject function)
  More...
 
static void QRemovePostRoutine (System.Action arg1)
 
static int QRound (double d)
  More...
 
static long QRound64 (double d)
  More...
 
static double QSin (double v)
  More...
 
static double QSqrt (double v)
  More...
 
static bool QStringComparisonHelper (QStringRef s1, string s2)
 
static double QTan (double v)
  More...
 
static QByteArray QUncompress (QByteArray data)
  More...
 
static QByteArray QUncompress (Pointer< byte > data, int nbytes)
  More...
 
static void Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size)
 
static QByteArray Qgetenv (string varName)
  More...
 
static bool Qputenv (string varName, QByteArray value)
  More...
 
static void Qsrand (uint seed)
  More...
 
static int Qstrcmp (QByteArray str1, QByteArray str2)
 
static int Qstrcmp (QByteArray str1, string str2)
 
static int Qstrcmp (string str1, QByteArray str2)
 
static int Qstrcmp (string str1, string str2)
  More...
 
static Pointer< sbyte > Qstrcpy (Pointer< sbyte > dst, string src)
  More...
 
static Pointer< sbyte > Qstrdup (string src)
  More...
 
static int Qstricmp (string str1, string str2)
  More...
 
static uint Qstrlen (string str)
  More...
 
static int Qstrncmp (string str1, string str2, uint len)
  More...
 
static Pointer< sbyte > Qstrncpy (Pointer< sbyte > dst, string src, uint len)
  More...
 
static int Qstrnicmp (string str1, string str2, uint len)
  More...
 
static uint Qstrnlen (string str, uint maxlen)
  More...
 

Protected Member Functions

 QSqlTableModel (System.Type dummy)
 
new void OnBeforeDelete (int row)
  More...
 
new void OnBeforeInsert (QSqlRecord record)
  More...
 
new void OnBeforeUpdate (int row, QSqlRecord record)
  More...
 
virtual bool DeleteRowFromTable (int row)
  More...
 
new QModelIndex IndexInQuery (QModelIndex item)
  More...
 
virtual bool InsertRowIntoTable (QSqlRecord values)
  More...
 
virtual string OrderByClause ()
  More...
 
new void OnPrimeInsert (int row, QSqlRecord record)
  More...
 
virtual string SelectStatement ()
  More...
 
new void SetQuery (QSqlQuery query)
  More...
 
virtual bool UpdateRowInTable (int row, QSqlRecord values)
  More...
 
- Protected Member Functions inherited from QtSql.QSqlQueryModel
 QSqlQueryModel (System.Type dummy)
 
new QModelIndex IndexInQuery (QModelIndex item)
  More...
 
virtual void QueryChange ()
  More...
 
- Protected Member Functions inherited from QtCore.QAbstractTableModel
 QAbstractTableModel (System.Type dummy)
 
- Protected Member Functions inherited from QtCore.QAbstractItemModel
 QAbstractItemModel (System.Type dummy)
 
new void BeginInsertColumns (QModelIndex parent, int first, int last)
  More...
 
new void BeginInsertRows (QModelIndex parent, int first, int last)
  More...
 
new bool BeginMoveColumns (QModelIndex sourceParent, int sourceFirst, int sourceLast, QModelIndex destinationParent, int destinationColumn)
  More...
 
new bool BeginMoveRows (QModelIndex sourceParent, int sourceFirst, int sourceLast, QModelIndex destinationParent, int destinationRow)
  More...
 
new void BeginRemoveColumns (QModelIndex parent, int first, int last)
  More...
 
new void BeginRemoveRows (QModelIndex parent, int first, int last)
  More...
 
new void BeginResetModel ()
  More...
 
new void ChangePersistentIndex (QModelIndex from, QModelIndex to)
  More...
 
new void ChangePersistentIndexList (System.Collections.Generic.List< QModelIndex > from, System.Collections.Generic.List< QModelIndex > to)
  More...
 
new QModelIndex CreateIndex (int row, int column)
  More...
 
new QModelIndex CreateIndex (int row, int column, int id)
  More...
 
new QModelIndex CreateIndex (int row, int column, uint id)
  More...
 
new void OnDataChanged (QModelIndex topLeft, QModelIndex bottomRight)
  More...
 
new bool DecodeData (int row, int column, QModelIndex parent, QDataStream stream)
 
new void EncodeData (System.Collections.Generic.List< QModelIndex > indexes, QDataStream stream)
 
new void EndInsertColumns ()
  More...
 
new void EndInsertRows ()
  More...
 
new void EndMoveColumns ()
  More...
 
new void EndMoveRows ()
  More...
 
new void EndRemoveColumns ()
  More...
 
new void EndRemoveRows ()
  More...
 
new void EndResetModel ()
  More...
 
new void OnHeaderDataChanged (Qt.Orientation orientation, int first, int last)
  More...
 
new void OnLayoutAboutToBeChanged ()
  More...
 
new void OnLayoutChanged ()
  More...
 
new void Reset ()
  More...
 
new void ResetInternalData ()
  More...
 
- Protected Member Functions inherited from QtCore.QObject
 QObject (System.Type dummy)
 
virtual void OnChildEvent (QChildEvent @event)
  More...
 
virtual void ConnectNotify (string signal)
  More...
 
virtual void OnCustomEvent (QEvent @event)
  More...
 
new void OnDestroyed (QObject obj=null)
  More...
 
virtual void DisconnectNotify (string signal)
  More...
 
new int Receivers (string signal)
  More...
 
virtual void OnTimerEvent (QTimerEvent @event)
  More...
 

Properties

Slot< System.Int32, QSqlRecordPrimeInsert
  More...
 
Slot< QSqlRecordBeforeInsert
  More...
 
Slot< System.Int32, QSqlRecordBeforeUpdate
  More...
 
Slot< System.Int32 > BeforeDelete
  More...
 
virtual QSqlTableModel.EditStrategy editStrategy [get, set]
  More...
 
virtual string Filter [get, set]
  More...
 
QSqlIndex PrimaryKey [get, set]
  More...
 
QSqlDatabase Database [get]
  More...
 
string TableName [get]
  More...
 
static new QMetaObject StaticMetaObject [get]
 
new IQSqlTableModelSignals Emit [get]
 
- Properties inherited from QtSql.QSqlQueryModel
QSqlError LastError [get, set]
  More...
 
QSqlQuery Query [get, set]
  More...
 
static new QMetaObject StaticMetaObject [get]
 
new IQSqlQueryModelSignals Emit [get]
 
- Properties inherited from QtCore.QAbstractTableModel
static new QMetaObject StaticMetaObject [get]
 
new IQAbstractTableModelSignals Emit [get]
 
- Properties inherited from QtCore.QAbstractItemModel
Slot< QModelIndex, QModelIndexDataChanged
  More...
 
Slot< Qt.Orientation,
System.Int32, System.Int32 > 
HeaderDataChanged
  More...
 
Slot LayoutChanged
  More...
 
Slot LayoutAboutToBeChanged
  More...
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
RowsAboutToBeInserted
  More...
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
RowsInserted
  More...
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
RowsAboutToBeRemoved
  More...
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
RowsRemoved
  More...
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
ColumnsAboutToBeInserted
  More...
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
ColumnsInserted
  More...
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
ColumnsAboutToBeRemoved
  More...
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
ColumnsRemoved
  More...
 
Slot ModelAboutToBeReset
  More...
 
Slot ModelReset
  More...
 
Slot< QModelIndex,
System.Int32, System.Int32,
QModelIndex, System.Int32 > 
RowsAboutToBeMoved
  More...
 
Slot< QModelIndex,
System.Int32, System.Int32,
QModelIndex, System.Int32 > 
RowsMoved
  More...
 
Slot< QModelIndex,
System.Int32, System.Int32,
QModelIndex, System.Int32 > 
ColumnsAboutToBeMoved
  More...
 
Slot< QModelIndex,
System.Int32, System.Int32,
QModelIndex, System.Int32 > 
ColumnsMoved
  More...
 
System.Collections.Generic.Dictionary
< System.Int32, QByteArray
RoleNames [get, set]
  More...
 
Qt.DropAction SupportedDragActions [get, set]
  More...
 
virtual
System.Collections.Generic.List
< string > 
MimeTypes [get]
  More...
 
System.Collections.Generic.List
< QModelIndex
PersistentIndexList [get]
  More...
 
virtual Qt.DropAction SupportedDropActions [get]
  More...
 
static new QMetaObject StaticMetaObject [get]
 
new IQAbstractItemModelSignals Emit [get]
 
- Properties inherited from QtCore.QObject
virtual EventHandler
< QEventArgs< QChildEvent > > 
ChildEvent
  More...
 
virtual EventHandler
< QEventArgs< QEvent > > 
CustomEvent
  More...
 
virtual EventHandler
< QEventArgs< QEvent > > 
Event
  More...
 
virtual EventHandler
< QEventArgs< QTimerEvent > > 
TimerEvent
  More...
 
Slot< QObjectDestroyedObj
  More...
 
Slot Destroyed
  More...
 
QObject Parent [get, set]
  More...
 
System.Collections.Generic.List
< QObject
Children [get]
  More...
 
System.Collections.Generic.List
< QByteArray
DynamicPropertyNames [get]
  More...
 
bool IsWidgetType [get]
  More...
 
static uint RegisterUserData [get]
 
QObject Sender [get]
  More...
 
int SenderSignalIndex [get]
  More...
 
bool SignalsBlocked [get]
  More...
 
virtual System.IntPtr SmokeObject [get, set]
 
new string ObjectName [get, set]
  More...
 
static new QMetaObject StaticMetaObject [get]
  More...
 
static new QMetaObject StaticQtMetaObject [get]
 
new IQObjectSignals Emit [get]
 
- Properties inherited from QtCore.Qt
static string QAppName [get]
 
static double QInf [get]
 
static double QQNaN [get]
 
static double QSNaN [get]
 
static bool QSharedBuild [get]
 
static string QVersion [get]
  More...
 
static int Qrand [get]
  More...
 

Additional Inherited Members

- Static Public Attributes inherited from QtCore.Qt
</para > *< para > Creating QM
files suitable for use with
this[SmokeMethod("qtTrId(const
char*, int)")] static strin 
QtTrId )(string id, int n=-1)
 
- Protected Attributes inherited from QtCore.QObject
object Q_EMIT = null
 
SmokeInvocation interceptor
 
readonly List< QEventHandler > eventFilters = new List<QEventHandler>()
 

Detailed Description

The QSqlTableModel class provides an editable data model for a single database table.

QSqlTableModel is a high-level interface for reading and writing database records from a single table. It is build on top of the lower-level QSqlQuery and can be used to provide data to view classes such as QTableView. For example:

QSqlTableModel *model = new QSqlTableModel(parentObject, database);

model->setTable("employee");

model->setEditStrategy(QSqlTableModel::OnManualSubmit);

model->select();

model->setHeaderData(0, Qt::Horizontal, tr("Name"));

model->setHeaderData(1, Qt::Horizontal, tr("Salary"));

QTableView *view = new QTableView;

view->setModel(model);

view->hideColumn(0); // don't show the ID

view->show();

We set the SQL table's name and the edit strategy, then we set up the labels displayed in the view header. The edit strategy dictates when the changes done by the user in the view are actually applied to the database. The possible values are OnFieldChange, OnRowChange, and OnManualSubmit.

QSqlTableModel can also be used to access a database programmatically, without binding it to a view:

QSqlQueryModel model;

model.setQuery("SELECT * FROM employee");

int salary = model.record(4).value("salary").toInt();

The code snippet above extracts the salary field from record 4 in the result set of the query SELECT * from employee.

It is possible to set filters using setFilter(), or modify the sort order using setSort(). At the end, you must call select() to populate the model with data.

The sql/tablemodel example illustrates how to use QSqlTableModel as the data source for a QTableView.

QSqlTableModel provides no direct support for foreign keys. Use the QSqlRelationalTableModel and QSqlRelationalDelegate if you want to resolve foreign keys.

See also QSqlRelationalTableModel, QSqlQuery, Model/View Programming, Table Model Example, and Cached Table Example.

Member Enumeration Documentation

This enum type describes which strategy to choose when editing values in the database.

Note: To prevent inserting only partly initialized rows into the database, OnFieldChange will behave like OnRowChange for newly inserted rows.

See also setEditStrategy().

Enumerator
OnFieldChange 

All changes to the model will be applied immediately to the database.

OnManualSubmit 

All changes will be cached in the model until either submitAll() or revertAll() is called.

OnRowChange 

Changes to a row will be applied when the user selects a different row.

Constructor & Destructor Documentation

QtSql.QSqlTableModel.QSqlTableModel ( System.Type  dummy)
protected
QtSql.QSqlTableModel.QSqlTableModel ( QObject  parent = null)

Creates an empty QSqlTableModel and sets the parent to parent and the database connection to db. If db is not valid, the default database connection will be used.

The default edit strategy is OnRowChange.

Here is the call graph for this function:

QtSql.QSqlTableModel.QSqlTableModel ( QObject  parent,
QSqlDatabase  db 
)

Creates an empty QSqlTableModel and sets the parent to parent and the database connection to db. If db is not valid, the default database connection will be used.

The default edit strategy is OnRowChange.

Here is the call graph for this function:

Member Function Documentation

override void QtSql.QSqlTableModel.Clear ( )
virtual

Reimplemented from QSqlQueryModel::clear().

Reimplemented from QtSql.QSqlQueryModel.

override void QtSql.QSqlTableModel.CreateProxy ( )
virtual

Reimplemented from QtSql.QSqlQueryModel.

Here is the caller graph for this function:

override object QtSql.QSqlTableModel.Data ( QModelIndex  idx,
int  role = (int) Qt.ItemDataRole.DisplayRole 
)
virtual

Reimplemented from QAbstractItemModel::data().

See also setData().

Reimplemented from QtSql.QSqlQueryModel.

virtual bool QtSql.QSqlTableModel.DeleteRowFromTable ( int  row)
protectedvirtual

Deletes the given row from the currently active database table.

This is a low-level method that operates directly on the database and should not be called directly. Use removeRow() or removeRows() to delete values. The model will decide depending on its edit strategy when to modify the database.

Returns true if the row was deleted; otherwise returns false.

See also removeRow() and removeRows().

new void QtSql.QSqlTableModel.Dispose ( )
new int QtSql.QSqlTableModel.FieldIndex ( string  fieldName)

Returns the index of the field fieldName, or -1 if no corresponding field exists in the model.

override Qt.ItemFlag QtSql.QSqlTableModel.Flags ( QModelIndex  index)
virtual

Reimplemented from QAbstractItemModel::flags().

Reimplemented from QtCore.QAbstractItemModel.

override object QtSql.QSqlTableModel.HeaderData ( int  section,
Qt.Orientation  orientation,
int  role = (int) Qt.ItemDataRole.DisplayRole 
)
virtual

Reimplemented from QAbstractItemModel::headerData().

Reimplemented from QtSql.QSqlQueryModel.

new QModelIndex QtSql.QSqlTableModel.IndexInQuery ( QModelIndex  item)
protected

Returns the index of the value in the database result set for the given item in the model.

The return value is identical to item if no columns or rows have been inserted, removed, or moved around.

Returns an invalid model index if item is out of bounds or if item does not point to a value in the result set.

See also QSqlQueryModel::indexInQuery().

new bool QtSql.QSqlTableModel.InsertRecord ( int  row,
QSqlRecord  record 
)

Inserts the record after row. If row is negative, the record will be appended to the end. Calls insertRows() and setRecord() internally.

Returns true if the row could be inserted, otherwise false.

See also insertRows() and removeRows().

virtual bool QtSql.QSqlTableModel.InsertRowIntoTable ( QSqlRecord  values)
protectedvirtual

Inserts the values values into the currently active database table.

This is a low-level method that operates directly on the database and should not be called directly. Use insertRow() and setData() to insert values. The model will decide depending on its edit strategy when to modify the database.

Returns true if the values could be inserted, otherwise false. Error information can be retrieved with lastError().

See also lastError(), insertRow(), and insertRows().

Reimplemented in QtSql.QSqlRelationalTableModel.

new bool QtSql.QSqlTableModel.InsertRows ( int  row,
int  count 
)

Reimplemented from QAbstractItemModel::insertRows().

Inserts count empty rows at position row. Note that parent must be invalid, since this model does not support parent-child relations.

Only one row at a time can be inserted when using the OnFieldChange or OnRowChange update strategies.

The primeInsert() signal will be emitted for each new row. Connect to it if you want to initialize the new row with default values.

Returns false if the parameters are out of bounds; otherwise returns true.

See also primeInsert() and insertRecord().

override bool QtSql.QSqlTableModel.InsertRows ( int  row,
int  count,
QModelIndex  parent 
)
virtual

Reimplemented from QAbstractItemModel::insertRows().

Inserts count empty rows at position row. Note that parent must be invalid, since this model does not support parent-child relations.

Only one row at a time can be inserted when using the OnFieldChange or OnRowChange update strategies.

The primeInsert() signal will be emitted for each new row. Connect to it if you want to initialize the new row with default values.

Returns false if the parameters are out of bounds; otherwise returns true.

See also primeInsert() and insertRecord().

Reimplemented from QtCore.QAbstractItemModel.

new bool QtSql.QSqlTableModel.IsDirty ( QModelIndex  index)

Returns true if the value at the index index is dirty, otherwise false. Dirty values are values that were modified in the model but not yet written into the database.

If index is invalid or points to a non-existing row, false is returned.

new void QtSql.QSqlTableModel.OnBeforeDelete ( int  row)
protected

This signal is emitted by deleteRowFromTable() before the row is deleted from the currently active database table.

new void QtSql.QSqlTableModel.OnBeforeInsert ( QSqlRecord  record)
protected

This signal is emitted by insertRowIntoTable() before a new row is inserted into the currently active database table. The values that are about to be inserted are stored in record and can be modified before they will be inserted.

new void QtSql.QSqlTableModel.OnBeforeUpdate ( int  row,
QSqlRecord  record 
)
protected

This signal is emitted by updateRowInTable() before the row is updated in the currently active database table with the values from record.

Note that only values that are marked as generated will be updated. The generated flag can be set with QSqlRecord::setGenerated() and checked with QSqlRecord::isGenerated().

See also QSqlRecord::isGenerated().

new void QtSql.QSqlTableModel.OnPrimeInsert ( int  row,
QSqlRecord  record 
)
protected

This signal is emitted by insertRows(), when an insertion is initiated in the given row of the currently active database table. The record parameter can be written to (since it is a reference), for example to populate some fields with default values.

virtual string QtSql.QSqlTableModel.OrderByClause ( )
protectedvirtual

Returns an SQL ORDER BY clause based on the currently set sort order.

See also setSort() and selectStatement().

Reimplemented in QtSql.QSqlRelationalTableModel.

new bool QtSql.QSqlTableModel.RemoveColumns ( int  column,
int  count 
)

Reimplemented from QAbstractItemModel::removeColumns().

Removes count columns from the parent model, starting at index column.

Returns if the columns were successfully removed; otherwise returns false.

See also removeRows().

override bool QtSql.QSqlTableModel.RemoveColumns ( int  column,
int  count,
QModelIndex  parent 
)
virtual

Reimplemented from QAbstractItemModel::removeColumns().

Removes count columns from the parent model, starting at index column.

Returns if the columns were successfully removed; otherwise returns false.

See also removeRows().

Reimplemented from QtSql.QSqlQueryModel.

new bool QtSql.QSqlTableModel.RemoveRows ( int  row,
int  count 
)

Reimplemented from QAbstractItemModel::removeRows().

Removes count rows starting at row. Since this model does not support hierarchical structures, parent must be an invalid model index.

Emits the beforeDelete() signal before a row is deleted. When the edit strategy is OnManualSubmit signal emission is delayed until submitAll() is called.

Returns true if all rows could be removed; otherwise returns false. Detailed error information can be retrieved using lastError().

See also removeColumns() and insertRows().

override bool QtSql.QSqlTableModel.RemoveRows ( int  row,
int  count,
QModelIndex  parent 
)
virtual

Reimplemented from QAbstractItemModel::removeRows().

Removes count rows starting at row. Since this model does not support hierarchical structures, parent must be an invalid model index.

Emits the beforeDelete() signal before a row is deleted. When the edit strategy is OnManualSubmit signal emission is delayed until submitAll() is called.

Returns true if all rows could be removed; otherwise returns false. Detailed error information can be retrieved using lastError().

See also removeColumns() and insertRows().

Reimplemented from QtCore.QAbstractItemModel.

override void QtSql.QSqlTableModel.Revert ( )
virtual

Reimplemented from QAbstractItemModel::revert().

This reimplemented slot is called by the item delegates when the user canceled editing the current row.

Reverts the changes if the model's strategy is set to OnRowChange. Does nothing for the other edit strategies.

Use revertAll() to revert all pending changes for the OnManualSubmit strategy or revertRow() to revert a specific row.

See also submit(), submitAll(), revertRow(), and revertAll().

Reimplemented from QtCore.QAbstractItemModel.

new void QtSql.QSqlTableModel.RevertAll ( )

Reverts all pending changes.

See also revert(), revertRow(), and submitAll().

virtual void QtSql.QSqlTableModel.RevertRow ( int  row)
virtual

Reverts all changes for the specified row.

See also revert(), revertAll(), submit(), and submitAll().

Reimplemented in QtSql.QSqlRelationalTableModel.

new int QtSql.QSqlTableModel.RowCount ( )

Reimplemented from QAbstractItemModel::rowCount().

override int QtSql.QSqlTableModel.RowCount ( QModelIndex  parent)
virtual

Reimplemented from QAbstractItemModel::rowCount().

Reimplemented from QtSql.QSqlQueryModel.

virtual bool QtSql.QSqlTableModel.Select ( )
virtual

Populates the model with data from the table that was set via setTable(), using the specified filter and sort condition, and returns true if successful; otherwise returns false.

Note: Calling select() will revert any unsubmitted changes and remove any inserted columns.

See also setTable(), setFilter(), and selectStatement().

Reimplemented in QtSql.QSqlRelationalTableModel.

virtual string QtSql.QSqlTableModel.SelectStatement ( )
protectedvirtual

Returns the SQL SELECT statement used internally to populate the model. The statement includes the filter and the ORDER BY clause.

See also filter() and orderByClause().

Reimplemented in QtSql.QSqlRelationalTableModel.

override bool QtSql.QSqlTableModel.SetData ( QModelIndex  index,
object  value,
int  role = (int) Qt.ItemDataRole.EditRole 
)
virtual

Reimplemented from QAbstractItemModel::setData().

Sets the data for the item index for the role role to value. Depending on the edit strategy, the value might be applied to the database at once or cached in the model.

Returns true if the value could be set or false on error, for example if index is out of bounds.

See also editStrategy(), data(), submit(), submitAll(), and revertRow().

Reimplemented from QtCore.QAbstractItemModel.

new void QtSql.QSqlTableModel.SetQuery ( QSqlQuery  query)
protected

This function simply calls QSqlQueryModel::setQuery(query). You should normally not call it on a QSqlTableModel. Instead, use setTable(), setSort(), setFilter(), etc., to set up the query.

See also selectStatement().

new bool QtSql.QSqlTableModel.SetRecord ( int  row,
QSqlRecord  record 
)

Sets the values at the specified row to the values of record. Returns true if all the values could be set; otherwise returns false.

See also record().

virtual void QtSql.QSqlTableModel.SetSort ( int  column,
Qt.SortOrder  order 
)
virtual

Sets the sort order for column to order. This does not affect the current data, to refresh the data using the new sort order, call select().

See also sort(), select(), and orderByClause().

virtual void QtSql.QSqlTableModel.SetTable ( string  tableName)
virtual

Sets the database table on which the model operates to tableName. Does not select data from the table, but fetches its field information.

To populate the model with the table's data, call select().

Error information can be retrieved with lastError().

See also select(), setFilter(), and lastError().

Reimplemented in QtSql.QSqlRelationalTableModel.

override void QtSql.QSqlTableModel.Sort ( int  column,
Qt.SortOrder  order 
)
virtual

Reimplemented from QAbstractItemModel::sort().

Sorts the data by column with the sort order order. This will immediately select data, use setSort() to set a sort order without populating the model with data.

See also setSort(), select(), and orderByClause().

Reimplemented from QtCore.QAbstractItemModel.

override bool QtSql.QSqlTableModel.Submit ( )
virtual

Reimplemented from QAbstractItemModel::submit().

This reimplemented slot is called by the item delegates when the user stopped editing the current row.

Submits the currently edited row if the model's strategy is set to OnRowChange or OnFieldChange. Does nothing for the OnManualSubmit strategy.

Use submitAll() to submit all pending changes for the OnManualSubmit strategy.

Returns true on success; otherwise returns false. Use lastError() to query detailed error information.

On success the model will be repopulated. Any views presenting it will lose their selections.

See also revert(), revertRow(), submitAll(), revertAll(), and lastError().

Reimplemented from QtCore.QAbstractItemModel.

new bool QtSql.QSqlTableModel.SubmitAll ( )

Submits all pending changes and returns true on success. Returns false on error, detailed error information can be obtained with lastError().

On success the model will be repopulated. Any views presenting it will lose their selections.

Note: In OnManualSubmit mode, already submitted changes won't be cleared from the cache when submitAll() fails. This allows transactions to be rolled back and resubmitted again without losing data.

See also revertAll() and lastError().

static string QtSql.QSqlTableModel.Tr ( string  s,
string  c = null 
)
static
static string QtSql.QSqlTableModel.Tr ( string  s,
string  c,
int  n 
)
static
static string QtSql.QSqlTableModel.TrUtf8 ( string  s,
string  c = null 
)
static
static string QtSql.QSqlTableModel.TrUtf8 ( string  s,
string  c,
int  n 
)
static
virtual bool QtSql.QSqlTableModel.UpdateRowInTable ( int  row,
QSqlRecord  values 
)
protectedvirtual

Updates the given row in the currently active database table with the specified values. Returns true if successful; otherwise returns false.

This is a low-level method that operates directly on the database and should not be called directly. Use setData() to update values. The model will decide depending on its edit strategy when to modify the database.

Note that only values that have the generated-flag set are updated. The generated-flag can be set with QSqlRecord::setGenerated() and tested with QSqlRecord::isGenerated().

See also QSqlRecord::isGenerated() and setData().

Reimplemented in QtSql.QSqlRelationalTableModel.

Property Documentation

Slot<System.Int32> QtSql.QSqlTableModel.BeforeDelete
addremove

This signal is emitted by deleteRowFromTable() before the row is deleted from the currently active database table.

Slot<QSqlRecord> QtSql.QSqlTableModel.BeforeInsert
addremove

This signal is emitted by insertRowIntoTable() before a new row is inserted into the currently active database table. The values that are about to be inserted are stored in record and can be modified before they will be inserted.

Slot<System.Int32,QSqlRecord> QtSql.QSqlTableModel.BeforeUpdate
addremove

This signal is emitted by updateRowInTable() before the row is updated in the currently active database table with the values from record.

Note that only values that are marked as generated will be updated. The generated flag can be set with QSqlRecord::setGenerated() and checked with QSqlRecord::isGenerated().

See also QSqlRecord::isGenerated().

QSqlDatabase QtSql.QSqlTableModel.Database
get

Returns a pointer to the used QSqlDatabase or 0 if no database was set.

virtual QSqlTableModel.EditStrategy QtSql.QSqlTableModel.editStrategy
getset

Returns the current edit strategy.

Sets the strategy for editing values in the database to strategy.

This will revert any pending changes.

new IQSqlTableModelSignals QtSql.QSqlTableModel.Emit
getprotected
virtual string QtSql.QSqlTableModel.Filter
getset

Returns the currently set filter.

Sets the current filter to filter.

The filter is a SQL WHERE clause without the keyword WHERE (for example, name='Josephine').

If the model is already populated with data from a database, the model re-selects it with the new filter. Otherwise, the filter will be applied the next time select() is called.

QSqlIndex QtSql.QSqlTableModel.PrimaryKey
getset

Returns the primary key for the current table, or an empty QSqlIndex if the table is not set or has no primary key.

Protected method that allows subclasses to set the primary key to key.

Normally, the primary index is set automatically whenever you call setTable().

Slot<System.Int32,QSqlRecord> QtSql.QSqlTableModel.PrimeInsert
addremove

This signal is emitted by insertRows(), when an insertion is initiated in the given row of the currently active database table. The record parameter can be written to (since it is a reference), for example to populate some fields with default values.

new QMetaObject QtSql.QSqlTableModel.StaticMetaObject
staticget
string QtSql.QSqlTableModel.TableName
get

Returns the name of the currently selected table.