Qyoto
4.0.5
Qyoto is a C# language binding for Qt
|
The QSqlQueryModel class provides a read-only data model for SQL result sets. More...
Public Member Functions | |
QSqlQueryModel (QObject parent=null) | |
| |
override void | CreateProxy () |
new bool | CanFetchMore () |
| |
override bool | CanFetchMore (QModelIndex parent) |
| |
virtual void | Clear () |
| |
new int | ColumnCount () |
| |
override int | ColumnCount (QModelIndex parent) |
| |
override object | Data (QModelIndex item, int role=(int) Qt.ItemDataRole.DisplayRole) |
| |
new void | FetchMore () |
| |
override void | FetchMore (QModelIndex parent) |
| |
override object | HeaderData (int section, Qt.Orientation orientation, int role=(int) Qt.ItemDataRole.DisplayRole) |
| |
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) |
| |
override bool | RemoveColumns (int column, int count, QModelIndex parent) |
| |
new int | RowCount () |
| |
override int | RowCount (QModelIndex parent) |
| |
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) |
| |
virtual Qt.ItemFlag | Flags (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 bool | InsertRows (int row, int count, QModelIndex parent) |
| |
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) |
| |
virtual bool | RemoveRows (int row, int count, QModelIndex parent) |
| |
virtual void | Revert () |
| |
new System.Collections.Generic.Dictionary < System.Int32, QByteArray > | RoleNames () |
| |
new int | RowCount () |
| |
virtual bool | SetData (QModelIndex index, object value, int role=(int) Qt.ItemDataRole.EditRole) |
| |
virtual bool | SetItemData (QModelIndex index, System.Collections.Generic.Dictionary< System.Int32, System.Object > roles) |
| |
new QModelIndex | Sibling (int row, int column, QModelIndex idx) |
| |
virtual void | Sort (int column, Qt.SortOrder order=Qt.SortOrder.AscendingOrder) |
| |
virtual QSize | Span (QModelIndex index) |
| |
virtual bool | Submit () |
| |
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 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 | |
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 | |
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, QModelIndex > | DataChanged |
| |
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< QObject > | DestroyedQObject |
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] |
The QSqlQueryModel class provides a read-only data model for SQL result sets.
QSqlQueryModel is a high-level interface for executing SQL statements and traversing the result set. It is built on top of the lower-level QSqlQuery and can be used to provide data to view classes such as QTableView. For example:
QSqlQueryModel *model = new QSqlQueryModel;
model->setQuery("SELECT name, salary FROM employee");
model->setHeaderData(0, Qt::Horizontal, tr("Name"));
model->setHeaderData(1, Qt::Horizontal, tr("Salary"));
QTableView *view = new QTableView;
view->setModel(model);
view->show();
We set the model's query, then we set up the labels displayed in the view header.
QSqlQueryModel 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. Assuming that salary is column 2, we can rewrite the last line as follows:
int salary = model.data(model.index(4, 2)).toInt();
The model is read-only by default. To make it read-write, you must subclass it and reimplement setData() and flags(). Another option is to use QSqlTableModel, which provides a read-write model based on a single database table.
The sql/querymodel example illustrates how to use QSqlQueryModel to display the result of a query. It also shows how to subclass QSqlQueryModel to customize the contents of the data before showing it to the user, and how to create a read-write model based on QSqlQueryModel.
If the database doesn't return the number of selected rows in a query, the model will fetch rows incrementally. See fetchMore() for more information.
See also QSqlTableModel, QSqlRelationalTableModel, QSqlQuery, Model/View Programming, and Query Model Example.
|
protected |
QtSql.QSqlQueryModel.QSqlQueryModel | ( | QObject | parent = null | ) |
Creates an empty QSqlQueryModel with the given parent.
new bool QtSql.QSqlQueryModel.CanFetchMore | ( | ) |
Reimplemented from QAbstractItemModel::canFetchMore().
Returns true if it is possible to read more rows from the database. This only affects databases that don't report back the size of a query (see QSqlDriver::hasFeature()).
parent should always be an invalid QModelIndex.
This function was introduced in Qt 4.1.
See also fetchMore().
|
virtual |
Reimplemented from QAbstractItemModel::canFetchMore().
Returns true if it is possible to read more rows from the database. This only affects databases that don't report back the size of a query (see QSqlDriver::hasFeature()).
parent should always be an invalid QModelIndex.
This function was introduced in Qt 4.1.
See also fetchMore().
Reimplemented from QtCore.QAbstractItemModel.
|
virtual |
Clears the model and releases any acquired resource.
Reimplemented in QtSql.QSqlTableModel, and QtSql.QSqlRelationalTableModel.
new int QtSql.QSqlQueryModel.ColumnCount | ( | ) |
Reimplemented from QAbstractItemModel::columnCount().
override int QtSql.QSqlQueryModel.ColumnCount | ( | QModelIndex | parent | ) |
Reimplemented from QAbstractItemModel::columnCount().
|
virtual |
Reimplemented from QtCore.QAbstractTableModel.
Reimplemented in QtSql.QSqlTableModel, and QtSql.QSqlRelationalTableModel.
|
virtual |
Reimplemented from QAbstractItemModel::data().
Returns the value for the specified item and role.
If item is out of bounds or if an error occurred, an invalid QVariant is returned.
See also lastError().
Implements QtCore.QAbstractItemModel.
Reimplemented in QtSql.QSqlTableModel, and QtSql.QSqlRelationalTableModel.
new void QtSql.QSqlQueryModel.Dispose | ( | ) |
new void QtSql.QSqlQueryModel.FetchMore | ( | ) |
Reimplemented from QAbstractItemModel::fetchMore().
Fetches more rows from a database. This only affects databases that don't report back the size of a query (see QSqlDriver::hasFeature()).
To force fetching of the entire result set, you can use the following:
while (myModel->canFetchMore())
myModel->fetchMore();
parent should always be an invalid QModelIndex.
This function was introduced in Qt 4.1.
See also canFetchMore().
|
virtual |
Reimplemented from QAbstractItemModel::fetchMore().
Fetches more rows from a database. This only affects databases that don't report back the size of a query (see QSqlDriver::hasFeature()).
To force fetching of the entire result set, you can use the following:
while (myModel->canFetchMore())
myModel->fetchMore();
parent should always be an invalid QModelIndex.
This function was introduced in Qt 4.1.
See also canFetchMore().
Reimplemented from QtCore.QAbstractItemModel.
|
virtual |
Reimplemented from QAbstractItemModel::headerData().
Returns the header data for the given role in the section of the header with the specified orientation.
See also setHeaderData().
Reimplemented from QtCore.QAbstractItemModel.
Reimplemented in QtSql.QSqlTableModel.
|
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 QSqlTableModel::indexInQuery(), insertColumns(), and removeColumns().
new bool QtSql.QSqlQueryModel.InsertColumns | ( | int | column, |
int | count | ||
) |
Reimplemented from QAbstractItemModel::insertColumns().
Inserts count columns into the model at position column. The parent parameter must always be an invalid QModelIndex, since the model does not support parent-child relationships.
Returns true if column is within bounds; otherwise returns false.
By default, inserted columns are empty. To fill them with data, reimplement data() and handle any inserted column separately:
QVariant MyModel::data(const QModelIndex &item, int role) const
{
if (item.column() == m_specialColumnNo) {
// handle column separately
}
return QSqlQueryModel::data(item, role);
}
See also removeColumns().
|
virtual |
Reimplemented from QAbstractItemModel::insertColumns().
Inserts count columns into the model at position column. The parent parameter must always be an invalid QModelIndex, since the model does not support parent-child relationships.
Returns true if column is within bounds; otherwise returns false.
By default, inserted columns are empty. To fill them with data, reimplement data() and handle any inserted column separately:
QVariant MyModel::data(const QModelIndex &item, int role) const
{
if (item.column() == m_specialColumnNo) {
// handle column separately
}
return QSqlQueryModel::data(item, role);
}
See also removeColumns().
Reimplemented from QtCore.QAbstractItemModel.
new QSqlError QtSql.QSqlQueryModel.LastError | ( | ) |
Returns information about the last error that occurred on the database.
See also setLastError() and query().
|
protectedvirtual |
This virtual function is called whenever the query changes. The default implementation does nothing.
query() returns the new query.
See also query() and setQuery().
new QSqlRecord QtSql.QSqlQueryModel.Record | ( | ) |
This is an overloaded function.
Returns an empty record containing information about the fields of the current query.
If the model is not initialized, an empty record will be returned.
See also QSqlRecord::isEmpty().
new QSqlRecord QtSql.QSqlQueryModel.Record | ( | int | row | ) |
Returns the record containing information about the fields of the current query. If row is the index of a valid row, the record will be populated with values from that row.
If the model is not initialized, an empty record will be returned.
See also QSqlRecord::isEmpty().
new bool QtSql.QSqlQueryModel.RemoveColumns | ( | int | column, |
int | count | ||
) |
Reimplemented from QAbstractItemModel::removeColumns().
Removes count columns from the model starting from position column. The parent parameter must always be an invalid QModelIndex, since the model does not support parent-child relationships.
Removing columns effectively hides them. It does not affect the underlying QSqlQuery.
Returns true if the columns were removed; otherwise returns false.
|
virtual |
Reimplemented from QAbstractItemModel::removeColumns().
Removes count columns from the model starting from position column. The parent parameter must always be an invalid QModelIndex, since the model does not support parent-child relationships.
Removing columns effectively hides them. It does not affect the underlying QSqlQuery.
Returns true if the columns were removed; otherwise returns false.
Reimplemented from QtCore.QAbstractItemModel.
Reimplemented in QtSql.QSqlTableModel, and QtSql.QSqlRelationalTableModel.
new int QtSql.QSqlQueryModel.RowCount | ( | ) |
Reimplemented from QAbstractItemModel::rowCount().
If the database supports returning the size of a query (see QSqlDriver::hasFeature()), the number of rows of the current query is returned. Otherwise, returns the number of rows currently cached on the client.
parent should always be an invalid QModelIndex.
This function was introduced in Qt 4.1.
See also canFetchMore() and QSqlDriver::hasFeature().
|
virtual |
Reimplemented from QAbstractItemModel::rowCount().
If the database supports returning the size of a query (see QSqlDriver::hasFeature()), the number of rows of the current query is returned. Otherwise, returns the number of rows currently cached on the client.
parent should always be an invalid QModelIndex.
This function was introduced in Qt 4.1.
See also canFetchMore() and QSqlDriver::hasFeature().
Implements QtCore.QAbstractItemModel.
Reimplemented in QtSql.QSqlTableModel.
|
virtual |
Reimplemented from QAbstractItemModel::setHeaderData().
Sets the caption for a horizontal header for the specified role to value. This is useful if the model is used to display data in a view (e.g., QTableView).
Returns true if orientation is Qt::Horizontal and the section refers to a valid section; otherwise returns false.
Note that this function cannot be used to modify values in the database since the model is read-only.
See also headerData() and data().
Reimplemented from QtCore.QAbstractItemModel.
|
protected |
Protected function which allows derived classes to set the value of the last error that occurred on the database to error.
See also lastError().
new void QtSql.QSqlQueryModel.SetQuery | ( | string | query | ) |
Resets the model and sets the data provider to be the given query. Note that the query must be active and must not be isForwardOnly().
lastError() can be used to retrieve verbose information if there was an error setting the query.
Note: Calling setQuery() will remove any inserted columns.
See also query(), QSqlQuery::isActive(), QSqlQuery::setForwardOnly(), and lastError().
new void QtSql.QSqlQueryModel.SetQuery | ( | string | query, |
QSqlDatabase | db | ||
) |
Resets the model and sets the data provider to be the given query. Note that the query must be active and must not be isForwardOnly().
lastError() can be used to retrieve verbose information if there was an error setting the query.
Note: Calling setQuery() will remove any inserted columns.
See also query(), QSqlQuery::isActive(), QSqlQuery::setForwardOnly(), and lastError().
|
static |
|
static |
|
static |
|
static |
|
getprotected |
|
getset |
Returns the QSqlQuery associated with this model.
Resets the model and sets the data provider to be the given query. Note that the query must be active and must not be isForwardOnly().
lastError() can be used to retrieve verbose information if there was an error setting the query.
Note: Calling setQuery() will remove any inserted columns.
|
staticget |