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

The QSqlRelationalTableModel class provides an editable data model for a single database table, with foreign key support. More...

Inheritance diagram for QtSql.QSqlRelationalTableModel:
Collaboration diagram for QtSql.QSqlRelationalTableModel:

Public Types

enum  JoinMode { InnerJoin = 0, LeftJoin = 1 }
  More...
 
- Public Types inherited from QtSql.QSqlTableModel
enum  EditStrategy { OnFieldChange = 0, OnManualSubmit = 2, OnRowChange = 1 }
  More...
 

Public Member Functions

 QSqlRelationalTableModel (QObject parent=null)
 
 
 QSqlRelationalTableModel (QObject parent, QSqlDatabase db)
 
 
override void CreateProxy ()
 
override void Clear ()
 
 
override object Data (QModelIndex item, int role=(int) Qt.ItemDataRole.DisplayRole)
 
 
new QSqlRelation Relation (int column)
 
 
virtual QSqlTableModel RelationModel (int column)
 
 
new bool RemoveColumns (int column, int count)
 
 
override bool RemoveColumns (int column, int count, QModelIndex parent)
 
 
override void RevertRow (int row)
 
 
override bool Select ()
 
 
override bool SetData (QModelIndex item, object value, int role=(int) Qt.ItemDataRole.EditRole)
 
 
new void SetJoinMode (QSqlRelationalTableModel.JoinMode joinMode)
 
 
virtual void SetRelation (int column, QSqlRelation relation)
 
 
override void SetTable (string tableName)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtSql.QSqlTableModel
 QSqlTableModel (QObject parent=null)
 
 
 QSqlTableModel (QObject parent, QSqlDatabase db)
 
 
override void CreateProxy ()
 
override void Clear ()
 
 
override object Data (QModelIndex idx, int role=(int) Qt.ItemDataRole.DisplayRole)
 
 
new QSqlDatabase Database ()
 
 
new int FieldIndex (string fieldName)
 
 
override Qt.ItemFlag Flags (QModelIndex index)
 
 
override object HeaderData (int section, Qt.Orientation orientation, int role=(int) Qt.ItemDataRole.DisplayRole)
 
 
new bool InsertRecord (int row, QSqlRecord record)
 
 
new bool InsertRows (int row, int count)
 
 
override bool InsertRows (int row, int count, QModelIndex parent)
 
 
new bool IsDirty (QModelIndex index)
 
 
new QSqlIndex PrimaryKey ()
 
 
new bool RemoveColumns (int column, int count)
 
 
override bool RemoveColumns (int column, int count, QModelIndex parent)
 
 
new bool RemoveRows (int row, int count)
 
 
override bool RemoveRows (int row, int count, QModelIndex parent)
 
 
override void Revert ()
 
 
new void RevertAll ()
 
 
new int RowCount ()
 
 
override int RowCount (QModelIndex parent)
 
 
override bool SetData (QModelIndex index, object value, int role=(int) Qt.ItemDataRole.EditRole)
 
 
new bool SetRecord (int row, QSqlRecord record)
 
 
virtual void SetSort (int column, Qt.SortOrder order)
 
 
override void Sort (int column, Qt.SortOrder order)
 
 
override bool Submit ()
 
 
new bool SubmitAll ()
 
 
new string TableName ()
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtSql.QSqlQueryModel
 QSqlQueryModel (QObject parent=null)
 
 
new bool CanFetchMore ()
 
 
override bool CanFetchMore (QModelIndex parent)
 
 
new int ColumnCount ()
 
 
override int ColumnCount (QModelIndex parent)
 
 
new void FetchMore ()
 
 
override void FetchMore (QModelIndex parent)
 
 
new bool InsertColumns (int column, int count)
 
 
override bool InsertColumns (int column, int count, QModelIndex parent)
 
 
new QSqlError LastError ()
 
 
new QSqlRecord Record ()
 
 
new QSqlRecord Record (int row)
 
 
new bool RemoveColumns (int column, int count)
 
 
new int RowCount ()
 
 
override bool SetHeaderData (int section, Qt.Orientation orientation, object value, int role=(int) Qt.ItemDataRole.EditRole)
 
 
new void SetQuery (string query)
 
 
new void SetQuery (string query, QSqlDatabase db)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QAbstractTableModel
 QAbstractTableModel (QObject parent=null)
 
 
override bool DropMimeData (QMimeData data, Qt.DropAction action, int row, int column, QModelIndex parent)
 
 
new QModelIndex Index (int row, int column)
 
 
override QModelIndex Index (int row, int column, QModelIndex parent)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QAbstractItemModel
 QAbstractItemModel (QObject parent=null)
 
 
virtual QModelIndex Buddy (QModelIndex index)
 
 
new bool HasChildren ()
 
 
virtual bool HasChildren (QModelIndex parent)
 
 
new bool HasIndex (int row, int column)
 
 
new bool HasIndex (int row, int column, QModelIndex parent)
 
 
new QModelIndex Index (int row, int column)
 
 
new bool InsertColumn (int column)
 
 
new bool InsertColumn (int column, QModelIndex parent)
 
 
new bool InsertColumns (int column, int count)
 
 
new bool InsertRow (int row)
 
 
new bool InsertRow (int row, QModelIndex parent)
 
 
new bool InsertRows (int row, int count)
 
 
virtual
System.Collections.Generic.Dictionary
< System.Int32, System.Object > 
ItemData (QModelIndex index)
 
 
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)
 
 
virtual QMimeData MimeData (System.Collections.Generic.List< QModelIndex > indexes)
 
 
virtual
System.Collections.Generic.List
< string > 
MimeTypes ()
 
 
new QObject Parent ()
 
 
abstract QModelIndex Parent (QModelIndex child)
 
 
new bool RemoveColumn (int column)
 
 
new bool RemoveColumn (int column, QModelIndex parent)
 
 
new bool RemoveColumns (int column, int count)
 
 
new bool RemoveRow (int row)
 
 
new bool RemoveRow (int row, QModelIndex parent)
 
 
new bool RemoveRows (int row, int count)
 
 
new
System.Collections.Generic.Dictionary
< System.Int32, QByteArray
RoleNames ()
 
 
new int RowCount ()
 
 
virtual bool SetItemData (QModelIndex index, System.Collections.Generic.Dictionary< System.Int32, System.Object > roles)
 
 
new QModelIndex Sibling (int row, int column, QModelIndex idx)
 
 
virtual QSize Span (QModelIndex index)
 
 
virtual Qt.DropAction SupportedDropActions ()
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QObject
 QObject (QObject parent=null)
 
 
new bool BlockSignals (bool b)
 
 
new
System.Collections.Generic.List
< QObject
Children ()
 
 
new bool Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
new void DeleteLater ()
 
 
new bool Disconnect (QObject receiver, string member=null)
 
 
new bool Disconnect (string signal=null, QObject receiver=null, string member=null)
 
 
new void DumpObjectInfo ()
 
 
new void DumpObjectTree ()
 
 
new
System.Collections.Generic.List
< QByteArray
DynamicPropertyNames ()
 
 
virtual bool OnEvent (QEvent arg1)
 
 
virtual bool EventFilter (QObject arg1, QEvent arg2)
 
 
new bool Inherits (string classname)
 
 
new void InstallEventFilter (QObject arg1)
 
 
new bool IsWidgetType ()
 
 
new void KillTimer (int id)
 
 
new object Property (string name)
 
 
new void RemoveEventFilter (QObject arg1)
 
 
new bool SetProperty (string name, object value)
 
 
new void SetUserData (uint id, QObjectUserData data)
 
new bool SignalsBlocked ()
 
 
new int StartTimer (int interval)
 
 
new QObjectUserData UserData (uint id)
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.Qt
delegate QTextStream FuncQTextStreamQTextStream (QTextStream qTextStream)
 
delegate string FuncStringQByteArray (QByteArray qByteArray)
 
delegate QByteArray FuncQByteArrayString (string @string)
 
delegate void ActionQtMsgTypeString (QtMsgType qtMsgType, string @string)
 
delegate QObject FuncQObject ()
 

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.QSqlTableModel
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)
 
 
static bool Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType arg5=Qt.ConnectionType.AutoConnection)
 
 
static bool Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member)
 
 
static bool Disconnect (QObject sender, string signal, QObject receiver, string member)
 
 
static uint RegisterUserData ()
 
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.Qt
static QDataStream Write (QDataStream s, object p)
 
static QDataStream Write (QDataStream arg1, QSizeF arg2)
 
static QTextStream Write (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Write (QDataStream arg1, QPoint arg2)
 
static QDataStream Write (QDataStream arg1, QLineF arg2)
 
static QDataStream Write (QDataStream arg1, QPointF arg2)
 
static QDataStream Write (QDataStream arg1, QChar arg2)
 
static QDataStream Write (QDataStream arg1, QByteArray arg2)
 
static QDataStream Write (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Write (QDataStream arg1, QRectF arg2)
 
static QDataStream Write (QDataStream arg1, QDateTime arg2)
 
static QDataStream Write (QDataStream arg1, QUrl arg2)
 
static QDataStream Write (QDataStream arg1, QTime arg2)
 
static QDataStream Write (QDataStream arg1, QLocale arg2)
 
static QDataStream Write (QDataStream arg1, QBitArray arg2)
 
static QDataStream Write (QDataStream arg1, QUuid arg2)
 
static QDataStream Write (QDataStream arg1, QLine arg2)
 
static QDataStream Write (QDataStream arg1, QDate arg2)
 
static QDataStream Write (QDataStream @out, QRegExp regExp)
 
static QDataStream Write (QDataStream arg1, QRect arg2)
 
static QDataStream Write (QDataStream arg1, QSize arg2)
 
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)
 
static QDataStream Read (QDataStream arg1, QChar arg2)
 
static QDataStream Read (QDataStream arg1, QLocale arg2)
 
static QDataStream Read (QDataStream arg1, QRect arg2)
 
static QDataStream Read (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Read (QDataStream arg1, QDate arg2)
 
static QDataStream Read (QDataStream arg1, QUrl arg2)
 
static QDataStream Read (QDataStream arg1, QUuid arg2)
 
static QTextStream Read (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Read (QDataStream arg1, QLineF arg2)
 
static QDataStream Read (QDataStream arg1, QRectF arg2)
 
static QDataStream Read (QDataStream arg1, QPointF arg2)
 
static QDataStream Read (QDataStream arg1, QLine arg2)
 
static QDataStream Read (QDataStream arg1, QBitArray arg2)
 
static QDataStream Read (QDataStream arg1, QSize arg2)
 
static QDataStream Read (QDataStream arg1, QDateTime arg2)
 
static QDataStream Read (QDataStream arg1, QTime arg2)
 
static QDataStream Read (QDataStream arg1, QPoint arg2)
 
static QDataStream Read (QDataStream @in, QRegExp regExp)
 
static QDataStream Read (QDataStream s, object p)
 
static QDataStream Read (QDataStream arg1, QByteArray arg2)
 
static QDataStream Read (QDataStream arg1, QSizeF arg2)
 
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)
 
static double qAcos (double v)
 
static void qAddPostRoutine (System.Action arg1)
 
static string qAppName ()
 
static double qAsin (double v)
 
static double qAtan (double v)
 
static double qAtan2 (double x, double y)
 
static void qBadAlloc ()
 
static int qCeil (double v)
 
static ushort qChecksum (string s, uint len)
 
static QByteArray qCompress (QByteArray data)
 
static QByteArray qCompress (QByteArray data, int compressionLevel=-1)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1)
 
static double qCos (double v)
 
static double qExp (double v)
 
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)
 
static bool qFuzzyCompare (double p1, double p2)
 
static bool qFuzzyCompare (float p1, float p2)
 
static bool qFuzzyIsNull (double d)
 
static bool qFuzzyIsNull (float f)
 
static uint qHash (QBitArray key)
 
static uint qHash (QChar key)
 
static uint qHash (QStringRef key)
 
static uint qHash (QUrl url)
 
static uint qHash (QPersistentModelIndex index)
 
static uint qHash (QByteArray key)
 
static uint qHash (QModelIndex index)
 
static uint qHash (uint key)
 
static uint qHash (sbyte key)
 
static uint qHash (byte key)
 
static uint qHash (short key)
 
static uint qHash (NativeLong key)
 
static uint qHash (ushort key)
 
static uint qHash (long key)
 
static uint qHash (ulong key)
 
static uint qHash (int key)
 
static uint qHash (string key)
 
static uint qHash (NativeULong key)
 
static double qInf ()
 
static Qt.ActionQtMsgTypeString qInstallMsgHandler (Qt.ActionQtMsgTypeString arg1)
 
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)
 
static double qPow (double x, double y)
 
static double qQNaN ()
 
static void qRegisterStaticPluginInstanceFunction (Qt.FuncQObject function)
 
static void qRemovePostRoutine (System.Action arg1)
 
static int qRound (double d)
 
static long qRound64 (double d)
 
static double qSNaN ()
 
static bool qSharedBuild ()
 
static double qSin (double v)
 
static double qSqrt (double v)
 
static bool qStringComparisonHelper (QStringRef s1, string s2)
 
static double qTan (double v)
 
static QByteArray qUncompress (QByteArray data)
 
static QByteArray qUncompress (Pointer< byte > data, int nbytes)
 
static string qVersion ()
 
static void Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size)
 
static QByteArray Qgetenv (string varName)
 
static bool Qputenv (string varName, QByteArray value)
 
static int Qrand ()
 
static void Qsrand (uint seed)
 
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)
 
static Pointer< sbyte > Qstrcpy (Pointer< sbyte > dst, string src)
 
static Pointer< sbyte > Qstrdup (string arg1)
 
static int Qstricmp (string arg1, string arg2)
 
static uint Qstrlen (string str)
 
static int Qstrncmp (string str1, string str2, uint len)
 
static Pointer< sbyte > Qstrncpy (Pointer< sbyte > dst, string src, uint len)
 
static int Qstrnicmp (string arg1, string arg2, uint len)
 
static uint Qstrnlen (string str, uint maxlen)
 
static string QtTrId (string id, int n=-1)
 

Protected Member Functions

 QSqlRelationalTableModel (System.Type dummy)
 
override bool InsertRowIntoTable (QSqlRecord values)
 
 
override string OrderByClause ()
 
 
override string SelectStatement ()
 
 
override bool UpdateRowInTable (int row, QSqlRecord values)
 
 
- Protected Member Functions inherited from QtSql.QSqlTableModel
 QSqlTableModel (System.Type dummy)
 
new void OnBeforeDelete (int row)
 
 
new void OnBeforeInsert (QSqlRecord record)
 
 
new void OnBeforeUpdate (int row, QSqlRecord record)
 
 
virtual bool DeleteRowFromTable (int row)
 
 
new QModelIndex IndexInQuery (QModelIndex item)
 
 
new void OnPrimeInsert (int row, QSqlRecord record)
 
 
new void SetPrimaryKey (QSqlIndex key)
 
 
new void SetQuery (QSqlQuery query)
 
 
- Protected Member Functions inherited from QtSql.QSqlQueryModel
 QSqlQueryModel (System.Type dummy)
 
new QModelIndex IndexInQuery (QModelIndex item)
 
 
virtual void QueryChange ()
 
 
new void SetLastError (QSqlError error)
 
 
- 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)
 
 
new void BeginInsertRows (QModelIndex parent, int first, int last)
 
 
new bool BeginMoveColumns (QModelIndex sourceParent, int sourceFirst, int sourceLast, QModelIndex destinationParent, int destinationColumn)
 
 
new bool BeginMoveRows (QModelIndex sourceParent, int sourceFirst, int sourceLast, QModelIndex destinationParent, int destinationRow)
 
 
new void BeginRemoveColumns (QModelIndex parent, int first, int last)
 
 
new void BeginRemoveRows (QModelIndex parent, int first, int last)
 
 
new void BeginResetModel ()
 
 
new void ChangePersistentIndex (QModelIndex from, QModelIndex to)
 
 
new void ChangePersistentIndexList (System.Collections.Generic.List< QModelIndex > from, System.Collections.Generic.List< QModelIndex > to)
 
 
new QModelIndex CreateIndex (int row, int column)
 
 
new QModelIndex CreateIndex (int row, int column, int id)
 
 
new QModelIndex CreateIndex (int row, int column, uint id)
 
 
new void OnDataChanged (QModelIndex topLeft, QModelIndex bottomRight)
 
 
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 ()
 
 
new void EndInsertRows ()
 
 
new void EndMoveColumns ()
 
 
new void EndMoveRows ()
 
 
new void EndRemoveColumns ()
 
 
new void EndRemoveRows ()
 
 
new void EndResetModel ()
 
 
new void OnHeaderDataChanged (Qt.Orientation orientation, int first, int last)
 
 
new void OnLayoutAboutToBeChanged ()
 
 
new void OnLayoutChanged ()
 
 
new
System.Collections.Generic.List
< QModelIndex
PersistentIndexList ()
 
 
new void Reset ()
 
 
new void ResetInternalData ()
 
 
new void SetRoleNames (System.Collections.Generic.Dictionary< System.Int32, QByteArray > roleNames)
 
 
- Protected Member Functions inherited from QtCore.QObject
 QObject (System.Type dummy)
 
virtual void OnChildEvent (QChildEvent arg1)
 
 
virtual void ConnectNotify (string signal)
 
 
virtual void OnCustomEvent (QEvent arg1)
 
 
new void OnDestroyed (QObject arg1=null)
 
 
virtual void DisconnectNotify (string signal)
 
 
new int Receivers (string signal)
 
 
new QObject Sender ()
 
 
new int SenderSignalIndex ()
 
 
virtual void OnTimerEvent (QTimerEvent arg1)
 
 

Properties

static new QMetaObject StaticMetaObject [get]
 
new
IQSqlRelationalTableModelSignals 
Emit [get]
 
- Properties inherited from QtSql.QSqlTableModel
Slot< System.Int32, QSqlRecordPrimeInsert
 
 
Slot< QSqlRecordBeforeInsert
 
 
Slot< System.Int32, QSqlRecordBeforeUpdate
 
 
Slot< System.Int32 > BeforeDelete
 
 
virtual QSqlTableModel.EditStrategy editStrategy [get, set]
 
 
virtual string Filter [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
new IQSqlTableModelSignals Emit [get]
 
- Properties inherited from QtSql.QSqlQueryModel
new QSqlQuery Query [get, set]
 
 
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
 
 
Slot< Qt.Orientation,
System.Int32, System.Int32 > 
HeaderDataChanged
 
 
Slot LayoutChanged
 
 
Slot LayoutAboutToBeChanged
 
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
RowsAboutToBeInserted
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
RowsInserted
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
RowsAboutToBeRemoved
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
RowsRemoved
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
ColumnsAboutToBeInserted
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
ColumnsInserted
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
ColumnsAboutToBeRemoved
 
Slot< QModelIndex,
System.Int32, System.Int32 > 
ColumnsRemoved
 
Slot ModelAboutToBeReset
 
Slot ModelReset
 
Slot< QModelIndex,
System.Int32, System.Int32,
QModelIndex, System.Int32 > 
RowsAboutToBeMoved
 
Slot< QModelIndex,
System.Int32, System.Int32,
QModelIndex, System.Int32 > 
RowsMoved
 
Slot< QModelIndex,
System.Int32, System.Int32,
QModelIndex, System.Int32 > 
ColumnsAboutToBeMoved
 
Slot< QModelIndex,
System.Int32, System.Int32,
QModelIndex, System.Int32 > 
ColumnsMoved
 
new Qt.DropAction SupportedDragActions [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
new IQAbstractItemModelSignals Emit [get]
 
- Properties inherited from QtCore.QObject
virtual EventHandler
< QEventArgs< QChildEvent > > 
ChildEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
CustomEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
Event
 
 
virtual EventHandler
< QEventArgs< QTimerEvent > > 
TimerEvent
 
 
Slot< QObjectDestroyedQObject
 
Slot Destroyed
 
 
new QObject Parent [get, set]
 
 
virtual System.IntPtr SmokeObject [get, set]
 
new string ObjectName [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
 
static new QMetaObject StaticQtMetaObject [get]
 
new IQObjectSignals Emit [get]
 

Additional Inherited Members

- Protected Attributes inherited from QtCore.QObject
object Q_EMIT = null
 
SmokeInvocation interceptor
 
readonly List< QEventHandler > eventFilters = new List<QEventHandler>()
 

Detailed Description

The QSqlRelationalTableModel class provides an editable data model for a single database table, with foreign key support.

QSqlRelationalTableModel acts like QSqlTableModel, but allows columns to be set as foreign keys into other database tables.

The screenshot on the left shows a plain QSqlTableModel in a QTableView. Foreign keys (city and country) aren't resolved to human-readable values. The screenshot on the right shows a QSqlRelationalTableModel, with foreign keys resolved into human-readable text strings.

The following code snippet shows how the QSqlRelationalTableModel was set up:

model->setTable("employee");

model->setRelation(2, QSqlRelation("city", "id", "name"));

model->setRelation(3, QSqlRelation("country", "id", "name"));

The setRelation() function calls establish a relationship between two tables. The first call specifies that column 2 in table employee is a foreign key that maps with field id of table city, and that the view should present the city's name field to the user. The second call does something similar with column 3.

If you use a read-write QSqlRelationalTableModel, you probably want to use QSqlRelationalDelegate on the view. Unlike the default delegate, QSqlRelationalDelegate provides a combobox for fields that are foreign keys into other tables. To use the class, simply call QAbstractItemView::setItemDelegate() on the view with an instance of QSqlRelationalDelegate:

QTableView *view = new QTableView;

view->setModel(model);

view->setItemDelegate(new QSqlRelationalDelegate(view));

The sql/relationaltablemodel example illustrates how to use QSqlRelationalTableModel in conjunction with QSqlRelationalDelegate to provide tables with foreign key support.

Notes:

The table must have a primary key declared.

The table's primary key may not contain a relation to another table.

If a relational table contains keys that refer to non-existent rows in the referenced table, the rows containing the invalid keys will not be exposed through the model. The user or the database is responsible for keeping referential integrity.

If a relation's display column name is also used as a column name in the main table, or if it is used as display column name in more than one relation it will be aliased. The alias is is the relation's table name and display column name joined by an underscore (e.g. tablename_columnname). All occurrences of the duplicate display column name are aliased when duplication is detected, but no aliasing is done to the column names in the main table. The aliasing doesn't affect QSqlRelation, so QSqlRelation::displayColumn() will return the original display column name, but QSqlRecord::fieldName() will return aliases.

When using setData() the role should always be Qt::EditRole, and when using data() the role should always be Qt::DisplayRole.

See also QSqlRelation, QSqlRelationalDelegate, and Relational Table Model Example.

Member Enumeration Documentation

This enum specifies the type of mode to use when joining two tables.

This enum was introduced or modified in Qt 4.8.

See also QSqlRelationalTableModel::setJoinMode().

Enumerator:
InnerJoin 

Inner join mode, return rows when there is at least one match in both tables.

LeftJoin 

Left join mode, returns all rows from the left table (table_name1), even if there are no matches in the right table (table_name2).

Constructor & Destructor Documentation

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

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

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

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

Member Function Documentation

override void QtSql.QSqlRelationalTableModel.Clear ( )
virtual

Reimplemented from QSqlQueryModel::clear().

Reimplemented from QtSql.QSqlQueryModel.

override void QtSql.QSqlRelationalTableModel.CreateProxy ( )
virtual

Reimplemented from QtSql.QSqlQueryModel.

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

Reimplemented from QAbstractItemModel::data().

See also setData().

Reimplemented from QtSql.QSqlQueryModel.

new void QtSql.QSqlRelationalTableModel.Dispose ( )
override bool QtSql.QSqlRelationalTableModel.InsertRowIntoTable ( QSqlRecord  values)
protectedvirtual

Reimplemented from QSqlTableModel::insertRowIntoTable().

Reimplemented from QtSql.QSqlTableModel.

override string QtSql.QSqlRelationalTableModel.OrderByClause ( )
protectedvirtual

Reimplemented from QSqlTableModel::orderByClause().

Reimplemented from QtSql.QSqlTableModel.

new QSqlRelation QtSql.QSqlRelationalTableModel.Relation ( int  column)

Returns the relation for the column column, or an invalid relation if no relation is set.

See also setRelation() and QSqlRelation::isValid().

virtual QSqlTableModel QtSql.QSqlRelationalTableModel.RelationModel ( int  column)
virtual

Returns a QSqlTableModel object for accessing the table for which column is a foreign key, or 0 if there is no relation for the given column.

The returned object is owned by the QSqlRelationalTableModel.

See also setRelation() and relation().

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

Reimplemented from QAbstractItemModel::removeColumns().

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

Reimplemented from QAbstractItemModel::removeColumns().

Reimplemented from QtSql.QSqlQueryModel.

override void QtSql.QSqlRelationalTableModel.RevertRow ( int  row)
virtual

Reimplemented from QSqlTableModel::revertRow().

Reimplemented from QtSql.QSqlTableModel.

override bool QtSql.QSqlRelationalTableModel.Select ( )
virtual

Reimplemented from QSqlTableModel::select().

Reimplemented from QtSql.QSqlTableModel.

override string QtSql.QSqlRelationalTableModel.SelectStatement ( )
protectedvirtual

Reimplemented from QSqlTableModel::selectStatement().

Reimplemented from QtSql.QSqlTableModel.

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

Reimplemented from QAbstractItemModel::setData().

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

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

For relational columns, value must be the index, not the display value. The index must also exist in the referenced table, otherwise the function returns false.

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

Reimplemented from QtCore.QAbstractItemModel.

new void QtSql.QSqlRelationalTableModel.SetJoinMode ( QSqlRelationalTableModel.JoinMode  joinMode)

Sets the SQL join mode to the value given by joinMode to show or hide rows with NULL foreign keys.

In InnerJoin mode (the default) these rows will not be shown; use the LeftJoin mode if you want to show them.

This function was introduced in Qt 4.8.

See also QSqlRelationalTableModel::JoinMode.

virtual void QtSql.QSqlRelationalTableModel.SetRelation ( int  column,
QSqlRelation  relation 
)
virtual

Lets the specified column be a foreign index specified by relation.

Example:

model->setTable("employee");

model->setRelation(2, QSqlRelation("city", "id", "name"));

The setRelation() call specifies that column 2 in table employee is a foreign key that maps with field id of table city, and that the view should present the city's name field to the user.

Note: The table's primary key may not contain a relation to another table.

See also relation().

override void QtSql.QSqlRelationalTableModel.SetTable ( string  tableName)
virtual

Reimplemented from QSqlTableModel::setTable().

Reimplemented from QtSql.QSqlTableModel.

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

Reimplemented from QSqlTableModel::updateRowInTable().

Reimplemented from QtSql.QSqlTableModel.

Property Documentation

new IQSqlRelationalTableModelSignals QtSql.QSqlRelationalTableModel.Emit
getprotected
new QMetaObject QtSql.QSqlRelationalTableModel.StaticMetaObject
staticget