Qt 4.8
Classes | Functions
qabstractitemmodel.cpp File Reference
#include "qabstractitemmodel.h"
#include <private/qabstractitemmodel_p.h>
#include <qdatastream.h>
#include <qstringlist.h>
#include <qsize.h>
#include <qmimedata.h>
#include <qdebug.h>
#include <qvector.h>
#include <qstack.h>
#include <qbitarray.h>
#include <limits.h>

Go to the source code of this file.

Classes

class  QEmptyItemModel
 

Functions

QDebug operator<< (QDebug dbg, const QModelIndex &idx)
 
QDebug operator<< (QDebug dbg, const QPersistentModelIndex &idx)
 
static uint typeOfVariant (const QVariant &value)
 

Function Documentation

◆ operator<<() [1/2]

QDebug operator<< ( QDebug  dbg,
const QModelIndex idx 
)

Definition at line 465 of file qabstractitemmodel.cpp.

Referenced by qHash().

466 {
467 #ifndef Q_BROKEN_DEBUG_STREAM
468  dbg.nospace() << "QModelIndex(" << idx.row() << ',' << idx.column()
469  << ',' << idx.internalPointer() << ',' << idx.model() << ')';
470  return dbg.space();
471 #else
472  qWarning("This compiler doesn't support streaming QModelIndex to QDebug");
473  return dbg;
474  Q_UNUSED(idx);
475 #endif
476 }
void * internalPointer() const
Returns a void * pointer used by the model to associate the index with the internal data structure...
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
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.
Q_CORE_EXPORT void qWarning(const char *,...)
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
int column() const
Returns the column this model index refers to.

◆ operator<<() [2/2]

QDebug operator<< ( QDebug  dbg,
const QPersistentModelIndex idx 
)

Definition at line 478 of file qabstractitemmodel.cpp.

479 {
480  if (idx.d)
481  dbg << idx.d->index;
482  else
483  dbg << QModelIndex();
484  return dbg;
485 }
QPersistentModelIndexData * d
The QModelIndex class is used to locate data in a data model.

◆ typeOfVariant()

static uint typeOfVariant ( const QVariant value)
static

Definition at line 529 of file qabstractitemmodel.cpp.

Referenced by QAbstractItemModelPrivate::variantLessThan().

530 {
531  //return 0 for integer, 1 for floating point and 2 for other
532  switch (value.userType()) {
533  case QVariant::Bool:
534  case QVariant::Int:
535  case QVariant::UInt:
536  case QVariant::LongLong:
537  case QVariant::ULongLong:
538  case QVariant::Char:
539  case QMetaType::Short:
540  case QMetaType::UShort:
541  case QMetaType::UChar:
542  case QMetaType::ULong:
543  case QMetaType::Long:
544  return 0;
545  case QVariant::Double:
546  case QMetaType::Float:
547  return 1;
548  default:
549  return 2;
550  }
551 }
int userType() const
Returns the storage type of the value stored in the variant.
Definition: qvariant.cpp:1913