31 #include <QAbstractItemModel> 50 ++GetIncrementable ();
57 ++GetIncrementable ();
63 --GetIncrementable ();
70 --GetIncrementable ();
76 GetIncrementable () += diff;
82 GetIncrementable () -= diff;
88 return GetIncrementable () - other.GetIncrementable ();
93 return left.Row_ == right.Row_ &&
94 left.Col_ == right.Col_ &&
95 left.Model_ == right.Model_ &&
96 left.Parent_ == right.Parent_;
101 return !(left == right);
106 return Model_->index (Row_, Col_, Parent_);
119 int& ModelIterator::GetIncrementable ()
129 qWarning () << Q_FUNC_INFO
130 <<
"unknown direction";
134 int ModelIterator::GetIncrementable ()
const 144 qWarning () << Q_FUNC_INFO
145 <<
"unknown direction";
bool operator!=(const ModelIterator &left, const ModelIterator &right)
The model should be traversed by rows.
ModelIterator & operator++()
Increments the traversable index and returns the modified iterator.
ModelIterator & operator+=(int count)
Adds 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.
The model should be traversed by columns.
ModelIterator & operator--()
Decrements the traversable index and returns the modified iterator.
bool operator==(const ModelIterator &left, const ModelIterator &right)
int operator-(const ModelIterator &other) const
Computes the distance between this and another iterator.
int GetRow() const
Returns the current row.
Direction
The direction of traversal.
Provides an iterator-based API to a Qt model.
ModelIterator & operator-=(int count)
Subtracts the given count to the traversable index.
QModelIndex operator*() const
Returns the index currently pointed by the iterator.
int GetCol() const
Returns the current column.