42 #ifndef QTABLEVIEW_P_H 43 #define QTABLEVIEW_P_H 56 #include <QtCore/QList> 57 #include <QtCore/QLinkedList> 58 #include <QtCore/QMap> 59 #include <QtCore/QSet> 60 #include <QtCore/QDebug> 61 #include "private/qabstractitemview_p.h" 63 #ifndef QT_NO_TABLEVIEW 88 : m_top(-1), m_left(-1), m_bottom(-1), m_right(-1), will_be_deleted(false) { }
89 Span(
int row,
int column,
int rowCount,
int columnCount)
90 : m_top(row), m_left(column), m_bottom(row+rowCount-1), m_right(column+columnCount-1), will_be_deleted(false) { }
91 inline int top()
const {
return m_top; }
92 inline int left()
const {
return m_left; }
93 inline int bottom()
const {
return m_bottom; }
94 inline int right()
const {
return m_right; }
95 inline int height()
const {
return m_bottom - m_top + 1; }
96 inline int width()
const {
return m_right - m_left + 1; }
104 void addSpan(
Span *span);
105 void updateSpan(
Span *span,
int old_height);
106 Span *spanAt(
int x,
int y)
const;
110 void updateInsertedRows(
int start,
int end);
111 void updateInsertedColumns(
int start,
int end);
112 void updateRemovedRows(
int start,
int end);
113 void updateRemovedColumns(
int start,
int end);
115 #ifdef QT_BUILD_INTERNAL 116 bool checkConsistency()
const;
127 bool cleanSpanSubIndex(SubIndex &subindex,
int end,
bool update =
false);
139 rowSectionAnchor(-1), columnSectionAnchor(-1),
140 columnResizeTimerID(0), rowResizeTimerID(0),
141 horizontalHeader(0), verticalHeader(0),
142 sortingEnabled(false), geometryRecursionBlock(false),
146 #ifndef QT_NO_DRAGANDDROP 154 return verticalHeader->isSectionHidden(row)
155 || horizontalHeader->isSectionHidden(col);
158 return verticalHeader->visualIndex(logicalRow);
161 return horizontalHeader->visualIndex(logicalCol);
164 return verticalHeader->logicalIndex(visualRow);
167 return horizontalHeader->logicalIndex(visualCol);
171 return (index.
row() + (horizontalHeader ? 1 : 0)) * (index.
model()->
columnCount() + (verticalHeader ? 1 : 0))
172 + index.
column() + (verticalHeader ? 1 : 0) + 1;
175 int sectionSpanEndLogical(
const QHeaderView *header,
int logical,
int span)
const;
176 int sectionSpanSize(
const QHeaderView *header,
int logical,
int span)
const;
177 bool spanContainsSection(
const QHeaderView *header,
int logical,
int spanLogical,
int span)
const;
180 int firstVisualRow,
int lastVisualRow,
int firstVisualColumn,
int lastVisualColumn);
200 void setSpan(
int row,
int column,
int rowSpan,
int columnSpan);
202 inline int rowSpan(
int row,
int column)
const {
203 return span(row, column).height();
206 return span(row, column).width();
212 return sectionSpanSize(verticalHeader, row, span);
215 return sectionSpanSize(horizontalHeader, column, span);
218 return sectionSpanEndLogical(verticalHeader, row, span);
221 return sectionSpanEndLogical(horizontalHeader, column, span);
231 return isIndexEnabled(model->index(row, column, root));
234 int r = logicalRow(row);
235 int c = logicalColumn(column);
236 return isRowHidden(r) || !isCellEnabled(r, c);
239 int r = logicalRow(row);
240 int c = logicalColumn(column);
241 return isColumnHidden(c) || !isCellEnabled(r, c);
246 void _q_selectRow(
int row);
247 void _q_selectColumn(
int column);
249 void selectRow(
int row,
bool anchor);
250 void selectColumn(
int column,
bool anchor);
252 void _q_updateSpanInsertedRows(
const QModelIndex &parent,
int start,
int end);
253 void _q_updateSpanInsertedColumns(
const QModelIndex &parent,
int start,
int end);
254 void _q_updateSpanRemovedRows(
const QModelIndex &parent,
int start,
int end);
255 void _q_updateSpanRemovedColumns(
const QModelIndex &parent,
int start,
int end);
260 #endif // QT_NO_TABLEVIEW 262 #endif // QTABLEVIEW_P_H The QPainter class performs low-level painting on widgets and other paint devices.
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
bool isCellEnabled(int row, int column) const
#define QT_END_NAMESPACE
This macro expands to.
bool isColumnHidden(int column) const
int visualColumn(int logicalCol) const
Span(int row, int column, int rowCount, int columnCount)
QList< int > rowsToUpdate
The QStyleOptionViewItemV4 class is used to describe the parameters necessary for drawing a frame in ...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
static void clear(QVariant::Private *d)
The QItemSelectionRange class manages information about a range of selected items in a model...
int rowSpan(int row, int column) const
QList< int > columnsToUpdate
QHeaderView * horizontalHeader
QMap< int, SubIndex > Index
int columnSpanWidth(int column, int span) const
#define QT_BEGIN_NAMESPACE
This macro expands to.
int rowSpanEndLogical(int row, int span) const
QHeaderView * verticalHeader
int row() const
Returns the row this model index refers to.
const QAbstractItemModel * model() const
Returns a pointer to the model containing the item that this index refers to.
int logicalRow(int visualRow) const
int columnSpanEndLogical(int column, int span) const
Q_DECLARE_TYPEINFO(QSpanCollection::Span, Q_MOVABLE_TYPE)
The QRegion class specifies a clip region for a painter.
bool isVisualColumnHiddenOrDisabled(int row, int column) const
The QTableView class provides a default model/view implementation of a table view.
bool isVisualRowHiddenOrDisabled(int row, int column) const
bool isRowHidden(int row) const
int visualRow(int logicalRow) const
The QBitArray class provides an array of bits.
bool geometryRecursionBlock
#define Q_DECLARE_PUBLIC(Class)
QLinkedList< Span * > SpanList
int logicalColumn(int visualCol) const
The QPoint class defines a point in the plane using integer precision.
The QModelIndex class is used to locate data in a data model.
The QRect class defines a rectangle in the plane using integer precision.
#define Q_AUTOTEST_EXPORT
int accessibleTable2Index(const QModelIndex &index) const
QMap< int, Span * > SubIndex
bool isHidden(int row, int col) const
int rowSpanHeight(int row, int span) const
static const KeyPair *const end
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
int columnSpan(int row, int column) const
The QMap class is a template class that provides a skip-list-based dictionary.
int column() const
Returns the column this model index refers to.
The QList class is a template class that provides lists.
static int area(const QSize &s)