10#include <QAbstractItemModel>
27 ++GetIncrementable ();
34 ++GetIncrementable ();
40 --GetIncrementable ();
47 --GetIncrementable ();
53 GetIncrementable () +=
diff;
59 GetIncrementable () -=
diff;
65 return GetIncrementable () -
other.GetIncrementable ();
83 return Model_->index (Row_, Col_, Parent_);
96 int& ModelIterator::GetIncrementable ()
107 <<
"unknown direction";
111 int ModelIterator::GetIncrementable ()
const
122 <<
"unknown direction";
Provides an iterator-based API to a Qt model.
ModelIterator & operator-=(int count)
Subtracts the given count to the traversable index.
ModelIterator(QAbstractItemModel *model, int row, int col=0, Direction dir=Direction::Rows, const QModelIndex &parent={})
Constructs an iterator.
int operator-(const ModelIterator &other) const
Computes the distance between this and another iterator.
Direction
The direction of traversal.
@ Rows
The model should be traversed by rows.
@ Cols
The model should be traversed by columns.
int GetRow() const
Returns the current row.
ModelIterator & operator++()
Increments the traversable index and returns the modified iterator.
int GetCol() const
Returns the current column.
ModelIterator & operator+=(int count)
Adds the given count to the traversable index.
QModelIndex operator*() const
Returns the index currently pointed by the iterator.
ModelIterator & operator--()
Decrements the traversable index and returns the modified iterator.
Container< T > Filter(const Container< T > &c, F f)
bool operator!=(const ModelIterator &left, const ModelIterator &right)
bool operator==(const ModelIterator &left, const ModelIterator &right)