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

#include <qstandarditemmodel_p.h>

Inheritance diagram for QStandardItemModelPrivate:
QAbstractItemModelPrivate QObjectPrivate QObjectData

Public Functions

void _q_emitItemChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 
void columnsAboutToBeInserted (QStandardItem *parent, int start, int end)
 
void columnsAboutToBeRemoved (QStandardItem *parent, int start, int end)
 
void columnsInserted (QStandardItem *parent, int column, int count)
 
void columnsRemoved (QStandardItem *parent, int column, int count)
 
QStandardItemcreateItem () const
 
void decodeDataRecursive (QDataStream &stream, QStandardItem *item)
 
void init ()
 
void itemChanged (QStandardItem *item)
 
QStandardItemitemFromIndex (const QModelIndex &index) const
 
 QStandardItemModelPrivate ()
 
void rowsAboutToBeInserted (QStandardItem *parent, int start, int end)
 
void rowsAboutToBeRemoved (QStandardItem *parent, int start, int end)
 
void rowsInserted (QStandardItem *parent, int row, int count)
 
void rowsRemoved (QStandardItem *parent, int row, int count)
 
void sort (QStandardItem *parent, int column, Qt::SortOrder order)
 
virtual ~QStandardItemModelPrivate ()
 
- 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

QVector< QStandardItem * > columnHeaderItems
 
const QStandardItemitemPrototype
 
QScopedPointer< QStandardItemroot
 
QVector< QStandardItem * > rowHeaderItems
 
int sortRole
 
- 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 139 of file qstandarditemmodel_p.h.

Constructors and Destructors

◆ QStandardItemModelPrivate()

QStandardItemModelPrivate::QStandardItemModelPrivate ( )
Warning
This function is not part of the public interface.

Definition at line 319 of file qstandarditemmodel.cpp.

320  : root(new QStandardItem),
321  itemPrototype(0),
323 {
325 }
QScopedPointer< QStandardItem > root
const QStandardItem * itemPrototype
void setFlags(Qt::ItemFlags flags)
Sets the item flags for the item to flags.
The QStandardItem class provides an item for use with the QStandardItemModel class.

◆ ~QStandardItemModelPrivate()

QStandardItemModelPrivate::~QStandardItemModelPrivate ( )
virtual
Warning
This function is not part of the public interface.

Definition at line 330 of file qstandarditemmodel.cpp.

331 {
332  delete itemPrototype;
335 }
const QStandardItem * itemPrototype
QVector< QStandardItem * > columnHeaderItems
QVector< QStandardItem * > rowHeaderItems
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
Definition: qalgorithms.h:319

Functions

◆ _q_emitItemChanged()

void QStandardItemModelPrivate::_q_emitItemChanged ( const QModelIndex topLeft,
const QModelIndex bottomRight 
)
Warning
This function is not part of the public interface.

Definition at line 350 of file qstandarditemmodel.cpp.

Referenced by init().

352 {
354  QModelIndex parent = topLeft.parent();
355  for (int row = topLeft.row(); row <= bottomRight.row(); ++row) {
356  for (int column = topLeft.column(); column <= bottomRight.column(); ++column) {
357  QModelIndex index = q->index(row, column, parent);
358  if (QStandardItem *item = itemFromIndex(index))
359  emit q->itemChanged(item);
360  }
361  }
362 }
The QStandardItemModel class provides a generic model for storing custom data.
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
#define Q_Q(Class)
Definition: qglobal.h:2483
int row() const
Returns the row this model index refers to.
#define emit
Definition: qobjectdefs.h:76
The QModelIndex class is used to locate data in a data model.
quint16 index
QObject * parent
Definition: qobject.h:92
The QStandardItem class provides an item for use with the QStandardItemModel class.
QStandardItem * itemFromIndex(const QModelIndex &index) const
int column() const
Returns the column this model index refers to.

◆ columnsAboutToBeInserted()

void QStandardItemModelPrivate::columnsAboutToBeInserted ( QStandardItem parent,
int  start,
int  end 
)
Warning
This function is not part of the public interface.

Definition at line 519 of file qstandarditemmodel.cpp.

521 {
523  QModelIndex index = q->indexFromItem(parent);
524  q->beginInsertColumns(index, start, end);
525 }
The QStandardItemModel class provides a generic model for storing custom data.
#define Q_Q(Class)
Definition: qglobal.h:2483
The QModelIndex class is used to locate data in a data model.
quint16 index
static const KeyPair *const end

◆ columnsAboutToBeRemoved()

void QStandardItemModelPrivate::columnsAboutToBeRemoved ( QStandardItem parent,
int  start,
int  end 
)
Warning
This function is not part of the public interface.

Definition at line 541 of file qstandarditemmodel.cpp.

543 {
545  QModelIndex index = q->indexFromItem(parent);
546  q->beginRemoveColumns(index, start, end);
547 }
The QStandardItemModel class provides a generic model for storing custom data.
#define Q_Q(Class)
Definition: qglobal.h:2483
The QModelIndex class is used to locate data in a data model.
quint16 index
static const KeyPair *const end

◆ columnsInserted()

void QStandardItemModelPrivate::columnsInserted ( QStandardItem parent,
int  column,
int  count 
)
Warning
This function is not part of the public interface.

Definition at line 564 of file qstandarditemmodel.cpp.

566 {
568  if (parent == root.data())
569  columnHeaderItems.insert(column, count, 0);
570  q->endInsertColumns();
571 }
QScopedPointer< QStandardItem > root
T * data() const
Returns the value of the pointer referenced by this object.
The QStandardItemModel class provides a generic model for storing custom data.
#define Q_Q(Class)
Definition: qglobal.h:2483
QVector< QStandardItem * > columnHeaderItems
void insert(int i, const T &t)
Inserts value at index position i in the vector.
Definition: qvector.h:362

◆ columnsRemoved()

void QStandardItemModelPrivate::columnsRemoved ( QStandardItem parent,
int  column,
int  count 
)
Warning
This function is not part of the public interface.

Definition at line 595 of file qstandarditemmodel.cpp.

597 {
599  if (parent == root.data()) {
600  for (int i = column; i < column + count; ++i) {
601  QStandardItem *oldItem = columnHeaderItems.at(i);
602  if (oldItem)
603  oldItem->d_func()->setModel(0);
604  delete oldItem;
605  }
606  columnHeaderItems.remove(column, count);
607  }
608  q->endRemoveColumns();
609 }
QScopedPointer< QStandardItem > root
void remove(int i)
Removes the element at index position i.
Definition: qvector.h:374
T * data() const
Returns the value of the pointer referenced by this object.
The QStandardItemModel class provides a generic model for storing custom data.
#define Q_Q(Class)
Definition: qglobal.h:2483
QVector< QStandardItem * > columnHeaderItems
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
The QStandardItem class provides an item for use with the QStandardItemModel class.

◆ createItem()

QStandardItem* QStandardItemModelPrivate::createItem ( ) const
inline

Definition at line 149 of file qstandarditemmodel_p.h.

149  {
151  }
const QStandardItem * itemPrototype
virtual QStandardItem * clone() const
Returns a copy of this item.
The QStandardItem class provides an item for use with the QStandardItemModel class.

◆ decodeDataRecursive()

void QStandardItemModelPrivate::decodeDataRecursive ( QDataStream stream,
QStandardItem item 
)

Definition at line 3178 of file qstandarditemmodel.cpp.

3179 {
3180  int colCount, childCount;
3181  stream >> *item;
3182  stream >> colCount >> childCount;
3183  item->setColumnCount(colCount);
3184 
3185  int childPos = childCount;
3186 
3187  while(childPos > 0) {
3188  childPos--;
3189  QStandardItem *child = createItem();
3190  decodeDataRecursive(stream, child);
3191  item->setChild( childPos / colCount, childPos % colCount, child);
3192  }
3193 }
QStandardItem * createItem() const
The QStandardItem class provides an item for use with the QStandardItemModel class.
void decodeDataRecursive(QDataStream &stream, QStandardItem *item)

◆ init()

void QStandardItemModelPrivate::init ( )
Warning
This function is not part of the public interface.

Definition at line 340 of file qstandarditemmodel.cpp.

341 {
345 }
#define SLOT(a)
Definition: qobjectdefs.h:226
The QStandardItemModel class provides a generic model for storing custom data.
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
void _q_emitItemChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
The QModelIndex class is used to locate data in a data model.

◆ itemChanged()

void QStandardItemModelPrivate::itemChanged ( QStandardItem item)
Warning
This function is not part of the public interface.

Definition at line 485 of file qstandarditemmodel.cpp.

486 {
488  if (item->d_func()->parent == 0) {
489  // Header item
490  int idx = columnHeaderItems.indexOf(item);
491  if (idx != -1) {
492  emit q->headerDataChanged(Qt::Horizontal, idx, idx);
493  } else {
494  idx = rowHeaderItems.indexOf(item);
495  if (idx != -1)
496  emit q->headerDataChanged(Qt::Vertical, idx, idx);
497  }
498  } else {
499  // Normal item
500  QModelIndex index = q->indexFromItem(item);
501  emit q->dataChanged(index, index);
502  }
503 }
The QStandardItemModel class provides a generic model for storing custom data.
#define Q_Q(Class)
Definition: qglobal.h:2483
QVector< QStandardItem * > columnHeaderItems
#define emit
Definition: qobjectdefs.h:76
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the vector, searching forward from ind...
Definition: qvector.h:698
QVector< QStandardItem * > rowHeaderItems
The QModelIndex class is used to locate data in a data model.
quint16 index
QStandardItem * parent() const
Returns the item&#39;s parent item, or 0 if the item has no parent.

◆ itemFromIndex()

QStandardItem* QStandardItemModelPrivate::itemFromIndex ( const QModelIndex index) const
inline

Definition at line 153 of file qstandarditemmodel_p.h.

Referenced by _q_emitItemChanged().

153  {
154  Q_Q(const QStandardItemModel);
155  if (!index.isValid())
156  return root.data();
157  if (index.model() != q)
158  return 0;
159  QStandardItem *parent = static_cast<QStandardItem*>(index.internalPointer());
160  if (parent == 0)
161  return 0;
162  return parent->child(index.row(), index.column());
163  }
void * internalPointer() const
Returns a void * pointer used by the model to associate the index with the internal data structure...
QScopedPointer< QStandardItem > root
T * data() const
Returns the value of the pointer referenced by this object.
The QStandardItemModel class provides a generic model for storing custom data.
#define Q_Q(Class)
Definition: qglobal.h:2483
int row() const
Returns the row this model index refers to.
const QAbstractItemModel * model() const
Returns a pointer to the model containing the item that this index refers to.
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
QObject * parent
Definition: qobject.h:92
The QStandardItem class provides an item for use with the QStandardItemModel class.
int column() const
Returns the column this model index refers to.
QStandardItem * child(int row, int column=0) const
Returns the child item at (row, column) if one has been set; otherwise returns 0. ...

◆ rowsAboutToBeInserted()

void QStandardItemModelPrivate::rowsAboutToBeInserted ( QStandardItem parent,
int  start,
int  end 
)
Warning
This function is not part of the public interface.

Definition at line 508 of file qstandarditemmodel.cpp.

510 {
512  QModelIndex index = q->indexFromItem(parent);
513  q->beginInsertRows(index, start, end);
514 }
The QStandardItemModel class provides a generic model for storing custom data.
#define Q_Q(Class)
Definition: qglobal.h:2483
The QModelIndex class is used to locate data in a data model.
quint16 index
static const KeyPair *const end

◆ rowsAboutToBeRemoved()

void QStandardItemModelPrivate::rowsAboutToBeRemoved ( QStandardItem parent,
int  start,
int  end 
)
Warning
This function is not part of the public interface.

Definition at line 530 of file qstandarditemmodel.cpp.

532 {
534  QModelIndex index = q->indexFromItem(parent);
535  q->beginRemoveRows(index, start, end);
536 }
The QStandardItemModel class provides a generic model for storing custom data.
#define Q_Q(Class)
Definition: qglobal.h:2483
The QModelIndex class is used to locate data in a data model.
quint16 index
static const KeyPair *const end

◆ rowsInserted()

void QStandardItemModelPrivate::rowsInserted ( QStandardItem parent,
int  row,
int  count 
)
Warning
This function is not part of the public interface.

Definition at line 552 of file qstandarditemmodel.cpp.

554 {
556  if (parent == root.data())
557  rowHeaderItems.insert(row, count, 0);
558  q->endInsertRows();
559 }
QScopedPointer< QStandardItem > root
T * data() const
Returns the value of the pointer referenced by this object.
The QStandardItemModel class provides a generic model for storing custom data.
#define Q_Q(Class)
Definition: qglobal.h:2483
void insert(int i, const T &t)
Inserts value at index position i in the vector.
Definition: qvector.h:362
QVector< QStandardItem * > rowHeaderItems

◆ rowsRemoved()

void QStandardItemModelPrivate::rowsRemoved ( QStandardItem parent,
int  row,
int  count 
)
Warning
This function is not part of the public interface.

Definition at line 576 of file qstandarditemmodel.cpp.

578 {
580  if (parent == root.data()) {
581  for (int i = row; i < row + count; ++i) {
582  QStandardItem *oldItem = rowHeaderItems.at(i);
583  if (oldItem)
584  oldItem->d_func()->setModel(0);
585  delete oldItem;
586  }
587  rowHeaderItems.remove(row, count);
588  }
589  q->endRemoveRows();
590 }
QScopedPointer< QStandardItem > root
void remove(int i)
Removes the element at index position i.
Definition: qvector.h:374
T * data() const
Returns the value of the pointer referenced by this object.
The QStandardItemModel class provides a generic model for storing custom data.
#define Q_Q(Class)
Definition: qglobal.h:2483
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
QVector< QStandardItem * > rowHeaderItems
The QStandardItem class provides an item for use with the QStandardItemModel class.

◆ sort()

void QStandardItemModelPrivate::sort ( QStandardItem parent,
int  column,
Qt::SortOrder  order 
)

Properties

◆ columnHeaderItems

QVector<QStandardItem*> QStandardItemModelPrivate::columnHeaderItems

◆ itemPrototype

const QStandardItem* QStandardItemModelPrivate::itemPrototype

Definition at line 184 of file qstandarditemmodel_p.h.

Referenced by ~QStandardItemModelPrivate().

◆ root

QScopedPointer<QStandardItem> QStandardItemModelPrivate::root

◆ rowHeaderItems

QVector<QStandardItem*> QStandardItemModelPrivate::rowHeaderItems

◆ sortRole

int QStandardItemModelPrivate::sortRole

Definition at line 185 of file qstandarditemmodel_p.h.


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