QItemSelectionRange Class Reference

QItemSelectionRange Class Reference

#include <qitemselectionmodel.h>

Class Description

Definition at line 58 of file qitemselectionmodel.h.

Public Member Functions

 QItemSelectionRange ()
 
 QItemSelectionRange (const QItemSelectionRange &other)
 
 QItemSelectionRange (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 
 QItemSelectionRange (const QModelIndex &index)
 
int top () const
 
int left () const
 
int bottom () const
 
int right () const
 
int width () const
 
int height () const
 
QModelIndex topLeft () const
 
QModelIndex bottomRight () const
 
QModelIndex parent () const
 
const QAbstractItemModelmodel () const
 
bool contains (const QModelIndex &index) const
 
bool contains (int row, int column, const QModelIndex &parentIndex) const
 
bool intersects (const QItemSelectionRange &other) const
 
QItemSelectionRange intersect (const QItemSelectionRange &other) const
 
QItemSelectionRange intersected (const QItemSelectionRange &other) const
 
bool operator== (const QItemSelectionRange &other) const
 
bool operator!= (const QItemSelectionRange &other) const
 
bool operator< (const QItemSelectionRange &other) const
 
bool isValid () const
 
bool isEmpty () const
 
QModelIndexList indexes () const
 

Constructor & Destructor Documentation

QItemSelectionRange ( )
inline

Definition at line 62 of file qitemselectionmodel.h.

62 {}
QItemSelectionRange ( const QItemSelectionRange other)
inline

Definition at line 63 of file qitemselectionmodel.h.

64  : tl(other.tl), br(other.br) {}
QItemSelectionRange ( const QModelIndex topLeft,
const QModelIndex bottomRight 
)
inline

Definition at line 144 of file qitemselectionmodel.h.

146 { tl = atopLeft; br = abottomRight; }
QItemSelectionRange ( const QModelIndex index)
inlineexplicit

Definition at line 66 of file qitemselectionmodel.h.

67  { tl = index; br = tl; }
GLuint index
Definition: GLee.h:1704

Member Function Documentation

int top ( ) const
inline

Definition at line 69 of file qitemselectionmodel.h.

69 { return tl.row(); }
int left ( ) const
inline

Definition at line 70 of file qitemselectionmodel.h.

70 { return tl.column(); }
int bottom ( ) const
inline

Definition at line 71 of file qitemselectionmodel.h.

71 { return br.row(); }
int right ( ) const
inline

Definition at line 72 of file qitemselectionmodel.h.

72 { return br.column(); }
int width ( ) const
inline

Definition at line 73 of file qitemselectionmodel.h.

73 { return br.column() - tl.column() + 1; }
int height ( ) const
inline

Definition at line 74 of file qitemselectionmodel.h.

74 { return br.row() - tl.row() + 1; }
QModelIndex topLeft ( ) const
inline

Definition at line 76 of file qitemselectionmodel.h.

76 { return QModelIndex(tl); }
QModelIndex bottomRight ( ) const
inline

Definition at line 77 of file qitemselectionmodel.h.

77 { return QModelIndex(br); }
QModelIndex parent ( ) const
inline

Definition at line 78 of file qitemselectionmodel.h.

78 { return tl.parent(); }
QModelIndex parent() const
const QAbstractItemModel* model ( ) const
inline

Definition at line 79 of file qitemselectionmodel.h.

79 { return tl.model(); }
const QAbstractItemModel * model() const
bool contains ( const QModelIndex index) const
inline

Definition at line 81 of file qitemselectionmodel.h.

82  {
83  return (parent() == index.parent()
84  && tl.row() <= index.row() && tl.column() <= index.column()
85  && br.row() >= index.row() && br.column() >= index.column());
86  }
QModelIndex parent() const
int row() const
QModelIndex parent() const
int column() const
bool contains ( int  row,
int  column,
const QModelIndex parentIndex 
) const
inline

Definition at line 88 of file qitemselectionmodel.h.

89  {
90  return (parent() == parentIndex
91  && tl.row() <= row && tl.column() <= column
92  && br.row() >= row && br.column() >= column);
93  }
GLenum GLenum GLvoid * row
Definition: GLee.h:893
QModelIndex parent() const
GLenum GLenum GLvoid GLvoid * column
Definition: GLee.h:893
bool intersects ( const QItemSelectionRange other) const
QItemSelectionRange intersect ( const QItemSelectionRange other) const
QItemSelectionRange intersected ( const QItemSelectionRange other) const
inline

Definition at line 97 of file qitemselectionmodel.h.

98  { return intersect(other); }
QItemSelectionRange intersect(const QItemSelectionRange &other) const
bool operator== ( const QItemSelectionRange other) const
inline

Definition at line 100 of file qitemselectionmodel.h.

101  { return (tl == other.tl && br == other.br); }
bool operator!= ( const QItemSelectionRange other) const
inline

Definition at line 102 of file qitemselectionmodel.h.

103  { return !operator==(other); }
bool operator==(const QItemSelectionRange &other) const
bool operator< ( const QItemSelectionRange other) const
inline

Definition at line 104 of file qitemselectionmodel.h.

105  {
106  // Comparing parents will compare the models, but if two equivalent ranges
107  // in two different models have invalid parents, they would appear the same
108  if (other.tl.model() == tl.model()) {
109  // parent has to be calculated, so we only do so once.
110  const QModelIndex topLeftParent = tl.parent();
111  const QModelIndex otherTopLeftParent = other.tl.parent();
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()) {
116  return br.column() < other.br.column();
117  }
118  return br.row() < other.br.row();
119  }
120  return tl.column() < other.tl.column();
121  }
122  return tl.row() < other.tl.row();
123  }
124  return topLeftParent < otherTopLeftParent;
125  }
126  return tl.model() < other.tl.model();
127  }
QModelIndex parent() const
const QAbstractItemModel * model() const
bool isValid ( ) const
inline

Definition at line 129 of file qitemselectionmodel.h.

130  {
131  return (tl.isValid() && br.isValid() && tl.parent() == br.parent()
132  && top() <= bottom() && left() <= right());
133  }
bool isValid() const
QModelIndex parent() const
bool isEmpty ( ) const
QModelIndexList indexes ( ) const

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