Warning, file /include/QtWidgets/qtableview.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QTABLEVIEW_H
0005 #define QTABLEVIEW_H
0006
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtWidgets/qabstractitemview.h>
0009
0010 QT_REQUIRE_CONFIG(tableview);
0011
0012 QT_BEGIN_NAMESPACE
0013
0014 class QHeaderView;
0015 class QTableViewPrivate;
0016
0017 class Q_WIDGETS_EXPORT QTableView : public QAbstractItemView
0018 {
0019 Q_OBJECT
0020 Q_PROPERTY(bool showGrid READ showGrid WRITE setShowGrid)
0021 Q_PROPERTY(Qt::PenStyle gridStyle READ gridStyle WRITE setGridStyle)
0022 Q_PROPERTY(bool sortingEnabled READ isSortingEnabled WRITE setSortingEnabled)
0023 Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap)
0024 #if QT_CONFIG(abstractbutton)
0025 Q_PROPERTY(bool cornerButtonEnabled READ isCornerButtonEnabled WRITE setCornerButtonEnabled)
0026 #endif
0027
0028 public:
0029 explicit QTableView(QWidget *parent = nullptr);
0030 ~QTableView();
0031
0032 void setModel(QAbstractItemModel *model) override;
0033 void setRootIndex(const QModelIndex &index) override;
0034 void setSelectionModel(QItemSelectionModel *selectionModel) override;
0035 void doItemsLayout() override;
0036
0037 QHeaderView *horizontalHeader() const;
0038 QHeaderView *verticalHeader() const;
0039 void setHorizontalHeader(QHeaderView *header);
0040 void setVerticalHeader(QHeaderView *header);
0041
0042 int rowViewportPosition(int row) const;
0043 int rowAt(int y) const;
0044
0045 void setRowHeight(int row, int height);
0046 int rowHeight(int row) const;
0047
0048 int columnViewportPosition(int column) const;
0049 int columnAt(int x) const;
0050
0051 void setColumnWidth(int column, int width);
0052 int columnWidth(int column) const;
0053
0054 bool isRowHidden(int row) const;
0055 void setRowHidden(int row, bool hide);
0056
0057 bool isColumnHidden(int column) const;
0058 void setColumnHidden(int column, bool hide);
0059
0060 void setSortingEnabled(bool enable);
0061 bool isSortingEnabled() const;
0062
0063 bool showGrid() const;
0064
0065 Qt::PenStyle gridStyle() const;
0066 void setGridStyle(Qt::PenStyle style);
0067
0068 void setWordWrap(bool on);
0069 bool wordWrap() const;
0070
0071 #if QT_CONFIG(abstractbutton)
0072 void setCornerButtonEnabled(bool enable);
0073 bool isCornerButtonEnabled() const;
0074 #endif
0075
0076 QRect visualRect(const QModelIndex &index) const override;
0077 void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override;
0078 QModelIndex indexAt(const QPoint &p) const override;
0079
0080 void setSpan(int row, int column, int rowSpan, int columnSpan);
0081 int rowSpan(int row, int column) const;
0082 int columnSpan(int row, int column) const;
0083 void clearSpans();
0084
0085
0086 public Q_SLOTS:
0087 void selectRow(int row);
0088 void selectColumn(int column);
0089 void hideRow(int row);
0090 void hideColumn(int column);
0091 void showRow(int row);
0092 void showColumn(int column);
0093 void resizeRowToContents(int row);
0094 void resizeRowsToContents();
0095 void resizeColumnToContents(int column);
0096 void resizeColumnsToContents();
0097 void sortByColumn(int column, Qt::SortOrder order);
0098 void setShowGrid(bool show);
0099
0100 protected Q_SLOTS:
0101 void rowMoved(int row, int oldIndex, int newIndex);
0102 void columnMoved(int column, int oldIndex, int newIndex);
0103 void rowResized(int row, int oldHeight, int newHeight);
0104 void columnResized(int column, int oldWidth, int newWidth);
0105 void rowCountChanged(int oldCount, int newCount);
0106 void columnCountChanged(int oldCount, int newCount);
0107
0108 protected:
0109 QTableView(QTableViewPrivate &, QWidget *parent);
0110 void scrollContentsBy(int dx, int dy) override;
0111
0112 void initViewItemOption(QStyleOptionViewItem *option) const override;
0113 void paintEvent(QPaintEvent *e) override;
0114
0115 void timerEvent(QTimerEvent *event) override;
0116
0117 int horizontalOffset() const override;
0118 int verticalOffset() const override;
0119 QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
0120
0121 void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) override;
0122 QRegion visualRegionForSelection(const QItemSelection &selection) const override;
0123 QModelIndexList selectedIndexes() const override;
0124
0125 void updateGeometries() override;
0126
0127 QSize viewportSizeHint() const override;
0128
0129 int sizeHintForRow(int row) const override;
0130 int sizeHintForColumn(int column) const override;
0131
0132 void verticalScrollbarAction(int action) override;
0133 void horizontalScrollbarAction(int action) override;
0134
0135 bool isIndexHidden(const QModelIndex &index) const override;
0136
0137 void selectionChanged(const QItemSelection &selected,
0138 const QItemSelection &deselected) override;
0139 void currentChanged(const QModelIndex ¤t,
0140 const QModelIndex &previous) override;
0141
0142 private:
0143 friend class QAccessibleItemView;
0144 int visualIndex(const QModelIndex &index) const;
0145
0146 Q_DECLARE_PRIVATE(QTableView)
0147 Q_DISABLE_COPY(QTableView)
0148 };
0149
0150 QT_END_NAMESPACE
0151
0152 #endif