42 #ifndef QITEMSELECTIONMODEL_H
43 #define QITEMSELECTIONMODEL_H
56 #ifndef QT_NO_ITEMVIEWS
64 : tl(other.tl), br(other.br) {}
67 { tl =
index; br = tl; }
69 inline int top()
const {
return tl.row(); }
70 inline int left()
const {
return tl.column(); }
71 inline int bottom()
const {
return br.row(); }
72 inline int right()
const {
return br.column(); }
73 inline int width()
const {
return br.column() - tl.column() + 1; }
74 inline int height()
const {
return br.row() - tl.row() + 1; }
83 return (parent() == index.
parent()
84 && tl.
row() <= index.
row() && tl.column() <= index.
column()
85 && br.row() >= index.
row() && br.column() >= index.
column());
90 return (parent() == parentIndex
91 && tl.
row() <= row && tl.column() <= column
92 && br.row() >= row && br.column() >=
column);
98 {
return intersect(other); }
101 {
return (tl == other.tl && br == other.br); }
108 if (other.tl.
model() == tl.model()) {
112 if (topLeftParent == otherTopLeftParent) {
113 if (other.tl.
row() == tl.row()) {
114 if (other.tl.
column() == tl.column()) {
115 if (other.br.
row() == br.row()) {
118 return br.row() < other.br.
row();
120 return tl.column() < other.tl.
column();
122 return tl.row() < other.tl.
row();
124 return topLeftParent < otherTopLeftParent;
131 return (tl.isValid() && br.isValid() && tl.parent() == br.parent()
132 && top() <= bottom() &&
left() <=
right());
135 bool isEmpty()
const;
146 { tl = atopLeft; br = abottomRight; }
149 class QItemSelectionModelPrivate;
168 SelectCurrent = Select | Current,
169 ToggleCurrent = Toggle | Current,
170 ClearAndSelect = Clear | Select
173 Q_DECLARE_FLAGS(SelectionFlags, SelectionFlag)
185 bool rowIntersectsSelection(
int row, const
QModelIndex &parent) const;
186 bool columnIntersectsSelection(
int column, const
QModelIndex &parent) const;
188 bool hasSelection() const;
198 void setCurrentIndex(const
QModelIndex &
index, QItemSelectionModel::SelectionFlags command);
199 virtual
void select(const
QModelIndex &index, QItemSelectionModel::SelectionFlags command);
200 virtual
void select(const
QItemSelection &selection, QItemSelectionModel::SelectionFlags command);
201 virtual
void clear();
202 virtual
void reset();
204 void clearSelection();
217 Q_DISABLE_COPY(QItemSelectionModel)
219 Q_PRIVATE_SLOT(d_func(),
void _q_rowsAboutToBeRemoved(const QModelIndex&,
int,
int))
220 Q_PRIVATE_SLOT(d_func(),
void _q_columnsAboutToBeInserted(const QModelIndex&,
int,
int))
221 Q_PRIVATE_SLOT(d_func(),
void _q_rowsAboutToBeInserted(const QModelIndex&,
int,
int))
226 Q_DECLARE_OPERATORS_FOR_FLAGS(QItemSelectionModel::SelectionFlags)
239 void merge(
const QItemSelection &other, QItemSelectionModel::SelectionFlags command);
245 #ifndef QT_NO_DEBUG_STREAM
249 #endif // QT_NO_ITEMVIEWS
255 #endif // QITEMSELECTIONMODEL_H
bool contains(const QModelIndex &index) const
QList< T > & operator<<(const T &t)
QModelIndex topLeft() const
bool operator==(const QItemSelectionRange &other) const
QItemSelectionRange(const QItemSelectionRange &other)
bool operator<(const QItemSelectionRange &other) const
#define Q_PRIVATE_SLOT(d, signature)
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
bool operator==(const Attribute &cA, const AttributeInstance< type > &cB)
This operator compares the two attributes and NOT their values.
QItemSelectionRange(const QModelIndex &index)
GLenum GLenum GLvoid * row
#define QT_BEGIN_NAMESPACE
QItemSelectionRange intersected(const QItemSelectionRange &other) const
QModelIndex parent() const
QBool contains(const T &t) const
Q_DECLARE_TYPEINFO(QItemSelectionRange, Q_MOVABLE_TYPE)
QModelIndex bottomRight() const
const QAbstractItemModel * model() const
const QAbstractItemModel * model() const
GLenum GLenum GLvoid GLvoid * column
QModelIndex parent() const
const QAbstractItemModel * model() const
QModelIndex parent() const
bool contains(int row, int column, const QModelIndex &parentIndex) const
bool operator!=(const QItemSelectionRange &other) const
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
uint qHash(const QItemSelectionRange &)