Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QItemSelectionModel Class Reference

Inheritance diagram for QItemSelectionModel:


List of all members.

Detailed Description

The QItemSelectionModel class keeps track of a view's selected items.

The QItemSelectionModel class is one of the {Model/View Classes} and is part of Qt's {Model/View Programming}{model/view framework}.

The selected items are stored using ranges. Whenever you want to modify the selected items use select() and provide either a QItemSelection, or a QModelIndex and a QItemSelectionModel::SelectionFlag.

The QItemSelectionModel takes a two layer approach to selection management, dealing with both selected items that have been committed and items that are part of the current selection. The current selected items are part of the current interactive selection (for example with rubber-band selection or keyboard-shift selections).

To update the currently selected items, use the bitwise OR of QItemSelectionModel::Current and any of the other SelectionFlags. If you omit the QItemSelectionModel::Current command, a new current selection will be created, and the previous one added to the whole selection. All functions operate on both layers; for example, selectedItems() will return items from both layers.

See also:
{Model/View Programming}, QAbstractItemModel, {Chart Example}

Definition at line 127 of file qitemselectionmodel.h.

Public Types

enum  SelectionFlag {
  NoUpdate = 0x0000, Clear = 0x0001, Select = 0x0002, Deselect = 0x0004,
  Toggle = 0x0008, Current = 0x0010, Rows = 0x0020, Columns = 0x0040,
  SelectCurrent = Select | Current, ToggleCurrent = Toggle | Current, ClearAndSelect = Clear | Select

Public Slots

virtual void clear ()
void clearSelection ()
void deleteLater ()
virtual void reset ()
virtual void select (const QItemSelection &selection, QItemSelectionModel::SelectionFlags command)
virtual void select (const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
void setCurrentIndex (const QModelIndex &index, QItemSelectionModel::SelectionFlags command)


void currentChanged (const QModelIndex &current, const QModelIndex &previous)
void currentColumnChanged (const QModelIndex &current, const QModelIndex &previous)
void currentRowChanged (const QModelIndex &current, const QModelIndex &previous)
void destroyed (QObject *=0)
void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected)

Public Member Functions

bool blockSignals (bool b)
const QObjectListchildren () const
bool columnIntersectsSelection (int column, const QModelIndex &parent) const
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
QModelIndex currentIndex () const
bool disconnect (const QObject *receiver, const char *member=0)
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
void dumpObjectInfo ()
void dumpObjectTree ()
QList< QByteArraydynamicPropertyNames () const
virtual bool event (QEvent *)
virtual bool eventFilter (QObject *, QEvent *)
template<typename T>
findChild (const QString &aName=QString()) const
template<typename T>
QList< T > findChildren (const QRegExp &re) const
template<typename T>
QList< T > findChildren (const QString &aName=QString()) const
bool hasSelection () const
bool inherits (const char *classname) const
void installEventFilter (QObject *)
bool isColumnSelected (int column, const QModelIndex &parent) const
bool isRowSelected (int row, const QModelIndex &parent) const
bool isSelected (const QModelIndex &index) const
bool isWidgetType () const
void killTimer (int id)
const QAbstractItemModelmodel () const
void moveToThread (QThread *thread)
QString objectName () const
QObjectparent () const
QVariant property (const char *name) const
 QItemSelectionModel (QAbstractItemModel *model, QObject *parent)
 QItemSelectionModel (QAbstractItemModel *model)
void removeEventFilter (QObject *)
bool rowIntersectsSelection (int row, const QModelIndex &parent) const
QModelIndexList selectedColumns (int row=0) const
QModelIndexList selectedIndexes () const
QModelIndexList selectedRows (int column=0) const
const QItemSelection selection () const
void setObjectName (const QString &name)
void setParent (QObject *)
bool setProperty (const char *name, const QVariant &value)
void setUserData (uint id, QObjectUserData *data)
bool signalsBlocked () const
int startTimer (int interval)
QThreadthread () const
QObjectUserData * userData (uint id) const
virtual ~QItemSelectionModel ()

Static Public Member Functions

static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
static uint registerUserData ()

Protected Member Functions

virtual void childEvent (QChildEvent *)
virtual void connectNotify (const char *signal)
virtual void customEvent (QEvent *)
virtual void disconnectNotify (const char *signal)
void emitSelectionChanged (const QItemSelection &newSelection, const QItemSelection &oldSelection)
 QItemSelectionModel (QItemSelectionModelPrivate &dd, QAbstractItemModel *model)
int receivers (const char *signal) const
QObjectsender () const
virtual void timerEvent (QTimerEvent *)

Protected Attributes

QObjectData * d_ptr

Static Protected Attributes

static const QMetaObject staticQtMetaObject


QString objectName
 the name of this object

Private Member Functions

void void _q_columnsAboutToBeInserted (const QModelIndex &, int, int)) Q_PRIVATE_SLOT(d_func()
void void void void _q_layoutAboutToBeChanged ()) Q_PRIVATE_SLOT(d_func()
void void void _q_rowsAboutToBeInserted (const QModelIndex &, int, int)) Q_PRIVATE_SLOT(d_func()
void _q_rowsAboutToBeRemoved (const QModelIndex &, int, int)) Q_PRIVATE_SLOT(d_func()
 Q_PRIVATE_SLOT (d_func(), void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int)) Q_PRIVATE_SLOT(d_func()


class QApplication
class QApplicationPrivate
class QCoreApplication
class QCoreApplicationPrivate
struct QMetaObject
class QThreadData
class QWidget

Related Functions

(Note that these are not member functions.)

qFindChild (const QObject *obj, const QString &name=QString(), T dummy=0)
qFindChild (const QObject *obj, const QString &name)
QList< T > qFindChildren (const QObject *obj, const QString &name=QString(), T dummy=0)
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
QList< T > qFindChildren (const QObject *obj, const QString &name)
T * qobject_cast (QObject *object)
void * qt_find_obj_child (QObject *parent, const char *type, const QString &name)

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

Generated by  Doxygen 1.6.0   Back to index