Qt 4.8
Public Functions | Public Variables | List of all members
QSqlQueryModelPrivate Class Reference

#include <qsqlquerymodel_p.h>

Inheritance diagram for QSqlQueryModelPrivate:
QAbstractItemModelPrivate QObjectPrivate QObjectData QSqlTableModelPrivate QSqlRelationalTableModelPrivate

Public Functions

void initColOffsets (int size)
 
void prefetch (int)
 
 QSqlQueryModelPrivate ()
 
 ~QSqlQueryModelPrivate ()
 
- Public Functions inherited from QAbstractItemModelPrivate
bool allowMove (const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation)
 Returns whether a move operation is valid. More...
 
void columnsAboutToBeInserted (const QModelIndex &parent, int first, int last)
 
void columnsAboutToBeRemoved (const QModelIndex &parent, int first, int last)
 
void columnsInserted (const QModelIndex &parent, int first, int last)
 
void columnsRemoved (const QModelIndex &parent, int first, int last)
 
QModelIndex createIndex (int row, int column, void *data=0) const
 
QModelIndex createIndex (int row, int column, int id) const
 
bool indexValid (const QModelIndex &index) const
 
void invalidatePersistentIndex (const QModelIndex &index)
 
void invalidatePersistentIndexes ()
 
void itemsAboutToBeMoved (const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation)
 
void itemsMoved (const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation)
 
void movePersistentIndexes (QVector< QPersistentModelIndexData *> indexes, int change, const QModelIndex &parent, Qt::Orientation orientation)
 Moves persistent indexes indexes by amount change. More...
 
 QAbstractItemModelPrivate ()
 
void removePersistentIndexData (QPersistentModelIndexData *data)
 
void rowsAboutToBeInserted (const QModelIndex &parent, int first, int last)
 
void rowsAboutToBeRemoved (const QModelIndex &parent, int first, int last)
 
void rowsInserted (const QModelIndex &parent, int first, int last)
 
void rowsRemoved (const QModelIndex &parent, int first, int last)
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Public Variables

uint atEnd: 1
 
QModelIndex bottom
 
QVarLengthArray< int, 56 > colOffsets
 
QSqlError error
 
QVector< QHash< int, QVariant > > headers
 
QSqlQuery query
 
QSqlRecord rec
 
- Public Variables inherited from QAbstractItemModelPrivate
QStack< Changechanges
 
struct QAbstractItemModelPrivate::Persistent persistent
 
QHash< int, QByteArrayroleNames
 
Qt::DropActions supportedDragActions
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Additional Inherited Members

- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
- Static Public Functions inherited from QAbstractItemModelPrivate
static const QHash< int, QByteArray > & defaultRoleNames ()
 
static QAbstractItemModelstaticEmptyModel ()
 
static bool variantLessThan (const QVariant &v1, const QVariant &v2)
 This function is used by our Q{Tree,Widget,Table}WidgetModel classes to sort. More...
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 

Detailed Description

Definition at line 66 of file qsqlquerymodel_p.h.

Constructors and Destructors

◆ QSqlQueryModelPrivate()

QSqlQueryModelPrivate::QSqlQueryModelPrivate ( )
inline

Definition at line 70 of file qsqlquerymodel_p.h.

70 : atEnd(false) {}

◆ ~QSqlQueryModelPrivate()

QSqlQueryModelPrivate::~QSqlQueryModelPrivate ( )

Definition at line 89 of file qsqlquerymodel.cpp.

Referenced by QSqlQueryModelPrivate().

90 {
91 }

Functions

◆ initColOffsets()

void QSqlQueryModelPrivate::initColOffsets ( int  size)

Definition at line 93 of file qsqlquerymodel.cpp.

Referenced by QSqlQueryModelPrivate().

94 {
95  colOffsets.resize(size);
96  memset(colOffsets.data(), 0, colOffsets.size() * sizeof(int));
97 }
void resize(int size)
QVarLengthArray< int, 56 > colOffsets
int size() const

◆ prefetch()

void QSqlQueryModelPrivate::prefetch ( int  limit)

Definition at line 54 of file qsqlquerymodel.cpp.

Referenced by QSqlQueryModelPrivate().

55 {
57 
58  if (atEnd || limit <= bottom.row() || bottom.column() == -1)
59  return;
60 
61  QModelIndex newBottom;
62  const int oldBottomRow = qMax(bottom.row(), 0);
63 
64  // try to seek directly
65  if (query.seek(limit)) {
66  newBottom = q->createIndex(limit, bottom.column());
67  } else {
68  // have to seek back to our old position for MS Access
69  int i = oldBottomRow;
70  if (query.seek(i)) {
71  while (query.next())
72  ++i;
73  newBottom = q->createIndex(i, bottom.column());
74  } else {
75  // empty or invalid query
76  newBottom = q->createIndex(-1, bottom.column());
77  }
78  atEnd = true; // this is the end.
79  }
80  if (newBottom.row() >= 0 && newBottom.row() > bottom.row()) {
81  q->beginInsertRows(QModelIndex(), bottom.row() + 1, newBottom.row());
82  bottom = newBottom;
83  q->endInsertRows();
84  } else {
85  bottom = newBottom;
86  }
87 }
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
#define Q_Q(Class)
Definition: qglobal.h:2483
The QSqlQueryModel class provides a read-only data model for SQL result sets.
int row() const
Returns the row this model index refers to.
The QModelIndex class is used to locate data in a data model.
bool seek(int i, bool relative=false)
Retrieves the record at position index, if available, and positions the query on the retrieved record...
Definition: qsqlquery.cpp:502
bool next()
Retrieves the next record in the result, if available, and positions the query on the retrieved recor...
Definition: qsqlquery.cpp:594
int column() const
Returns the column this model index refers to.

Properties

◆ atEnd

uint QSqlQueryModelPrivate::atEnd

Definition at line 80 of file qsqlquerymodel_p.h.

Referenced by prefetch().

◆ bottom

QModelIndex QSqlQueryModelPrivate::bottom

Definition at line 78 of file qsqlquerymodel_p.h.

Referenced by prefetch().

◆ colOffsets

QVarLengthArray<int, 56> QSqlQueryModelPrivate::colOffsets

Definition at line 82 of file qsqlquerymodel_p.h.

Referenced by initColOffsets().

◆ error

QSqlError QSqlQueryModelPrivate::error
mutable

◆ headers

QVector<QHash<int, QVariant> > QSqlQueryModelPrivate::headers

Definition at line 81 of file qsqlquerymodel_p.h.

◆ query

QSqlQuery QSqlQueryModelPrivate::query
mutable

◆ rec

QSqlRecord QSqlQueryModelPrivate::rec

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