Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
SelectionModelSynchronizer Class Reference

#include </tmp/quassel/src/client/selectionmodelsynchronizer.h>

Public Member Functions

 SelectionModelSynchronizer (QAbstractItemModel *parent=0)
void synchronizeSelectionModel (QItemSelectionModel *selectionModel)
void removeSelectionModel (QItemSelectionModel *selectionModel)
QAbstractItemModel * model ()
QItemSelectionModel * selectionModel () const
QModelIndex currentIndex () const
QItemSelection currentSelection () const

Private Slots

void syncedCurrentChanged (const QModelIndex &current, const QModelIndex &previous)
void syncedSelectionChanged (const QItemSelection &selected, const QItemSelection &previous)
void setCurrentIndex (const QModelIndex &index)
void setCurrentSelection (const QItemSelection &selection)
void currentChanged (const QModelIndex &current, const QModelIndex &previous)
void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected)
void selectionModelDestroyed (QObject *object)

Private Member Functions

bool checkBaseModel (QItemSelectionModel *model)
QModelIndex mapFromSource (const QModelIndex &sourceIndex, const QItemSelectionModel *selectionModel)
QItemSelection mapSelectionFromSource (const QItemSelection &sourceSelection, const QItemSelectionModel *selectionModel)
QModelIndex mapToSource (const QModelIndex &index, QItemSelectionModel *selectionModel)
QItemSelection mapSelectionToSource (const QItemSelection &selection, QItemSelectionModel *selectionModel)

Private Attributes

QAbstractItemModel * _model
QItemSelectionModel _selectionModel
bool _changeCurrentEnabled
bool _changeSelectionEnabled
QSet< QItemSelectionModel * > _selectionModels

Detailed Description

Definition at line 29 of file selectionmodelsynchronizer.h.

Constructor & Destructor Documentation

SelectionModelSynchronizer ( QAbstractItemModel *  parent = 0)

Member Function Documentation

void removeSelectionModel ( QItemSelectionModel *  selectionModel)

Definition at line 82 of file selectionmodelsynchronizer.cpp.

References selectionModelDestroyed().

QAbstractItemModel* model ( )
inline
QModelIndex currentIndex ( ) const
inline

Definition at line 41 of file selectionmodelsynchronizer.h.

References _selectionModel.

Referenced by syncedCurrentChanged(), and synchronizeSelectionModel().

QItemSelection currentSelection ( ) const
inline
void syncedCurrentChanged ( const QModelIndex &  current,
const QModelIndex &  previous 
)
privateslot
void syncedSelectionChanged ( const QItemSelection &  selected,
const QItemSelection &  previous 
)
privateslot
void setCurrentIndex ( const QModelIndex &  index)
privateslot

Definition at line 235 of file selectionmodelsynchronizer.cpp.

References _selectionModel.

Referenced by syncedCurrentChanged().

void setCurrentSelection ( const QItemSelection &  selection)
privateslot

Definition at line 241 of file selectionmodelsynchronizer.cpp.

References _selectionModel.

Referenced by syncedSelectionChanged().

void currentChanged ( const QModelIndex &  current,
const QModelIndex &  previous 
)
privateslot
void selectionChanged ( const QItemSelection &  selected,
const QItemSelection &  deselected 
)
privateslot
void selectionModelDestroyed ( QObject *  object)
privateslot

Definition at line 90 of file selectionmodelsynchronizer.cpp.

References _selectionModels, and model().

Referenced by removeSelectionModel(), and synchronizeSelectionModel().

bool checkBaseModel ( QItemSelectionModel *  model)
private

Definition at line 42 of file selectionmodelsynchronizer.cpp.

References model().

Referenced by synchronizeSelectionModel().

QModelIndex mapFromSource ( const QModelIndex &  sourceIndex,
const QItemSelectionModel *  selectionModel 
)
private

Definition at line 150 of file selectionmodelsynchronizer.cpp.

References model().

Referenced by currentChanged(), and synchronizeSelectionModel().

QItemSelection mapSelectionFromSource ( const QItemSelection &  sourceSelection,
const QItemSelectionModel *  selectionModel 
)
private
QModelIndex mapToSource ( const QModelIndex &  index,
QItemSelectionModel *  selectionModel 
)
private

Definition at line 201 of file selectionmodelsynchronizer.cpp.

References model().

Referenced by syncedCurrentChanged().

QItemSelection mapSelectionToSource ( const QItemSelection &  selection,
QItemSelectionModel *  selectionModel 
)
private

Definition at line 218 of file selectionmodelsynchronizer.cpp.

References model().

Referenced by syncedSelectionChanged().

Member Data Documentation

QAbstractItemModel* _model
private

Definition at line 57 of file selectionmodelsynchronizer.h.

Referenced by model().

QItemSelectionModel _selectionModel
private
bool _changeCurrentEnabled
private

Definition at line 59 of file selectionmodelsynchronizer.h.

Referenced by currentChanged(), and syncedCurrentChanged().

bool _changeSelectionEnabled
private

Definition at line 60 of file selectionmodelsynchronizer.h.

Referenced by selectionChanged(), and syncedSelectionChanged().

QSet<QItemSelectionModel *> _selectionModels
private

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