Qt 4.8
Public Functions | Public Variables | List of all members
QSqlRelationalTableModelPrivate Class Reference
Inheritance diagram for QSqlRelationalTableModelPrivate:
QSqlTableModelPrivate QSqlQueryModelPrivate QAbstractItemModelPrivate QObjectPrivate QObjectData

Public Functions

void clearCache ()
 Reimplemented Function More...
 
void clearChanges ()
 
void clearEditBuffer ()
 
int nameToIndex (const QString &name) const
 
 QSqlRelationalTableModelPrivate ()
 
QString relationField (const QString &tableName, const QString &fieldName) const
 
void revertCachedRow (int row)
 
void translateFieldNames (int row, QSqlRecord &values) const
 
- Public Functions inherited from QSqlTableModelPrivate
void clear ()
 
bool exec (const QString &stmt, bool prepStatement, const QSqlRecord &rec, const QSqlRecord &whereValues)
 
void initRecordAndPrimaryIndex ()
 
QSqlRecord primaryValues (int index)
 
 QSqlTableModelPrivate ()
 
QSqlRecord record (const QVector< QVariant > &values) const
 Populates our record with values. More...
 
void revertInsertedRow ()
 
bool setRecord (int row, const QSqlRecord &record)
 Set a record for OnFieldChange and OnRowChange. More...
 
- Public Functions inherited from QSqlQueryModelPrivate
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

QSqlRecord baseRec
 
QSqlRelationalTableModel::JoinMode joinMode
 
QVector< QRelationrelations
 
- Public Variables inherited from QSqlTableModelPrivate
CacheMap cache
 
QSqlDatabase db
 
QSqlRecord editBuffer
 
int editIndex
 
QSqlQuery editQuery
 
QString filter
 
int insertIndex
 
QSqlIndex primaryIndex
 
int sortColumn
 
Qt::SortOrder sortOrder
 
QSqlTableModel::EditStrategy strategy
 
QString tableName
 
- Public Variables inherited from QSqlQueryModelPrivate
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 QSqlTableModelPrivate
typedef QMap< int, ModifiedRowCacheMap
 
enum  Op { None, Insert, Update, Delete }
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
- Static Public Functions inherited from QSqlTableModelPrivate
static void clearGenerated (QSqlRecord &rec)
 
static void setGeneratedValue (QSqlRecord &rec, int c, QVariant v)
 
- 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 275 of file qsqlrelationaltablemodel.cpp.

Constructors and Destructors

◆ QSqlRelationalTableModelPrivate()

QSqlRelationalTableModelPrivate::QSqlRelationalTableModelPrivate ( )
inline

Functions

◆ clearCache()

void QSqlRelationalTableModelPrivate::clearCache ( )
virtual

Reimplemented Function

Reimplemented from QSqlTableModelPrivate.

Definition at line 339 of file qsqlrelationaltablemodel.cpp.

340 {
341  for (int i = 0; i < relations.count(); ++i)
342  relations[i].clearDictionary();
343 
345 }
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742
virtual void clearCache()

◆ clearChanges()

void QSqlRelationalTableModelPrivate::clearChanges ( )

Definition at line 309 of file qsqlrelationaltablemodel.cpp.

310 {
311  for (int i = 0; i < relations.count(); ++i) {
312  QRelation &rel = relations[i];
313  rel.clear();
314  }
315 }
int count(const T &t) const
Returns the number of occurrences of value in the vector.
Definition: qvector.h:742

◆ clearEditBuffer()

void QSqlRelationalTableModelPrivate::clearEditBuffer ( )
virtual

Reimplemented from QSqlTableModelPrivate.

Definition at line 330 of file qsqlrelationaltablemodel.cpp.

331 {
334 }
static void clearGenerated(QSqlRecord &rec)

◆ nameToIndex()

int QSqlRelationalTableModelPrivate::nameToIndex ( const QString name) const
virtual

Reimplemented from QSqlTableModelPrivate.

Definition at line 322 of file qsqlrelationaltablemodel.cpp.

323 {
324  QString fieldname = name;
326  fieldname = db.driver()->stripDelimiters(fieldname, QSqlDriver::FieldName);
327  return baseRec.indexOf(fieldname);
328 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
QSqlDriver * driver() const
Returns the database driver used to access the database connection.
bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const
Returns whether identifier is escaped according to the database rules.
Definition: qsqldriver.cpp:429
const char * name
QString stripDelimiters(const QString &identifier, IdentifierType type) const
Returns the identifier with the leading and trailing delimiters removed, identifier can either be a t...
Definition: qsqldriver.cpp:455
int indexOf(const QString &name) const
Returns the position of the field called name within the record, or -1 if it cannot be found...
Definition: qsqlrecord.cpp:246

◆ relationField()

QString QSqlRelationalTableModelPrivate::relationField ( const QString tableName,
const QString fieldName 
) const

Definition at line 558 of file qsqlrelationaltablemodel.cpp.

560 {
561  QString ret;
562  ret.reserve(tableName.size() + fieldName.size() + 1);
563  ret.append(tableName).append(QLatin1Char('.')).append(fieldName);
564 
565  return ret;
566 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
void reserve(int size)
Attempts to allocate memory for at least size characters.
Definition: qstring.h:881
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
QString & append(QChar c)
Definition: qstring.cpp:1777
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ revertCachedRow()

void QSqlRelationalTableModelPrivate::revertCachedRow ( int  row)
virtual

Reimplemented from QSqlTableModelPrivate.

Definition at line 317 of file qsqlrelationaltablemodel.cpp.

318 {
320 }
virtual void revertCachedRow(int row)

◆ translateFieldNames()

void QSqlRelationalTableModelPrivate::translateFieldNames ( int  row,
QSqlRecord values 
) const
Warning
This function is not part of the public interface.

Definition at line 796 of file qsqlrelationaltablemodel.cpp.

797 {
799 
800  for (int i = 0; i < values.count(); ++i) {
801  int realCol = q->indexInQuery(q->createIndex(row, i)).column();
802  if (realCol != -1 && relations.value(realCol).isValid()) {
803  QVariant v = values.value(i);
804  bool gen = values.isGenerated(i);
805  values.replace(i, baseRec.field(realCol));
806  values.setValue(i, v);
807  values.setGenerated(i, gen);
808  }
809  }
810 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QSqlRelationalTableModel class provides an editable data model for a single database table...
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isGenerated(int i) const
Returns true if the record has a field at position index and this field is to be generated (the defau...
Definition: qsqlrecord.cpp:519
T value(int i) const
Returns the value at index position i in the vector.
Definition: qvector.h:559
QSqlField field(int i) const
Returns the field at position index.
Definition: qsqlrecord.cpp:289
int count() const
Returns the number of fields in the record.
Definition: qsqlrecord.cpp:573
void replace(int pos, const QSqlField &field)
Replaces the field at position pos with the given field.
Definition: qsqlrecord.cpp:336
void setValue(int i, const QVariant &val)
Sets the value of the field at position index to val.
Definition: qsqlrecord.cpp:585
QVariant value(int i) const
Returns the value of the field located at position index in the record.
Definition: qsqlrecord.cpp:203
void setGenerated(const QString &name, bool generated)
Sets the generated flag for the field called name to generated.
Definition: qsqlrecord.cpp:420

Properties

◆ baseRec

QSqlRecord QSqlRelationalTableModelPrivate::baseRec

Definition at line 287 of file qsqlrelationaltablemodel.cpp.

◆ joinMode

QSqlRelationalTableModel::JoinMode QSqlRelationalTableModelPrivate::joinMode

Definition at line 294 of file qsqlrelationaltablemodel.cpp.

◆ relations

QVector<QRelation> QSqlRelationalTableModelPrivate::relations
mutable

Definition at line 286 of file qsqlrelationaltablemodel.cpp.


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