17class Q_WIDGETS_EXPORT
QTableView :
public QAbstractItemView
20 Q_PROPERTY(
bool showGrid READ showGrid WRITE setShowGrid)
21 Q_PROPERTY(Qt::PenStyle gridStyle READ gridStyle WRITE setGridStyle)
22 Q_PROPERTY(
bool sortingEnabled READ isSortingEnabled WRITE setSortingEnabled)
23 Q_PROPERTY(
bool wordWrap READ wordWrap WRITE setWordWrap)
24#if QT_CONFIG(abstractbutton)
25 Q_PROPERTY(
bool cornerButtonEnabled READ isCornerButtonEnabled WRITE setCornerButtonEnabled)
29 explicit QTableView(QWidget *parent =
nullptr);
32 void setModel(QAbstractItemModel *model) override;
33 void setRootIndex(
const QModelIndex &index) override;
34 void setSelectionModel(QItemSelectionModel *selectionModel) override;
35 void doItemsLayout() override;
37 QHeaderView *horizontalHeader()
const;
38 QHeaderView *verticalHeader()
const;
39 void setHorizontalHeader(QHeaderView *header);
40 void setVerticalHeader(QHeaderView *header);
42 int rowViewportPosition(
int row)
const;
43 int rowAt(
int y)
const;
45 void setRowHeight(
int row,
int height);
46 int rowHeight(
int row)
const;
48 int columnViewportPosition(
int column)
const;
49 int columnAt(
int x)
const;
51 void setColumnWidth(
int column,
int width);
52 int columnWidth(
int column)
const;
54 bool isRowHidden(
int row)
const;
55 void setRowHidden(
int row,
bool hide);
57 bool isColumnHidden(
int column)
const;
58 void setColumnHidden(
int column,
bool hide);
60 void setSortingEnabled(
bool enable);
61 bool isSortingEnabled()
const;
63 bool showGrid()
const;
65 Qt::PenStyle gridStyle()
const;
66 void setGridStyle(Qt::PenStyle style);
68 void setWordWrap(
bool on);
69 bool wordWrap()
const;
71#if QT_CONFIG(abstractbutton)
72 void setCornerButtonEnabled(
bool enable);
73 bool isCornerButtonEnabled()
const;
76 QRect visualRect(
const QModelIndex &index)
const override;
77 void scrollTo(
const QModelIndex &index, ScrollHint hint = EnsureVisible) override;
78 QModelIndex indexAt(
const QPoint &p)
const override;
80 void setSpan(
int row,
int column,
int rowSpan,
int columnSpan);
81 int rowSpan(
int row,
int column)
const;
82 int columnSpan(
int row,
int column)
const;
87 void selectRow(
int row);
88 void selectColumn(
int column);
89 void hideRow(
int row);
90 void hideColumn(
int column);
91 void showRow(
int row);
92 void showColumn(
int column);
93 void resizeRowToContents(
int row);
94 void resizeRowsToContents();
95 void resizeColumnToContents(
int column);
96 void resizeColumnsToContents();
97 void sortByColumn(
int column, Qt::SortOrder order);
98 void setShowGrid(
bool show);
101 void rowMoved(
int row,
int oldIndex,
int newIndex);
102 void columnMoved(
int column,
int oldIndex,
int newIndex);
103 void rowResized(
int row,
int oldHeight,
int newHeight);
104 void columnResized(
int column,
int oldWidth,
int newWidth);
105 void rowCountChanged(
int oldCount,
int newCount);
106 void columnCountChanged(
int oldCount,
int newCount);
109 QTableView(QTableViewPrivate &, QWidget *parent);
110 void scrollContentsBy(
int dx,
int dy) override;
112 void initViewItemOption(QStyleOptionViewItem *option)
const override;
113 void paintEvent(QPaintEvent *e) override;
115 void timerEvent(QTimerEvent *event) override;
117#if QT_CONFIG(draganddrop)
118 void dropEvent(QDropEvent *event) override;
121 int horizontalOffset()
const override;
122 int verticalOffset()
const override;
123 QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
125 void setSelection(
const QRect &rect, QItemSelectionModel::SelectionFlags command) override;
126 QRegion visualRegionForSelection(
const QItemSelection &selection)
const override;
127 QModelIndexList selectedIndexes()
const override;
129 void updateGeometries() override;
131 QSize viewportSizeHint()
const override;
133 int sizeHintForRow(
int row)
const override;
134 int sizeHintForColumn(
int column)
const override;
136 void verticalScrollbarAction(
int action) override;
137 void horizontalScrollbarAction(
int action) override;
139 bool isIndexHidden(
const QModelIndex &index)
const override;
141 void selectionChanged(
const QItemSelection &selected,
142 const QItemSelection &deselected) override;
143 void currentChanged(
const QModelIndex ¤t,
144 const QModelIndex &previous) override;
147 friend class QAccessibleItemView;
148 int visualIndex(
const QModelIndex &index)
const;
150 Q_DECLARE_PRIVATE(QTableView)
151 Q_DISABLE_COPY(QTableView)