| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QHEADERVIEW_H |
| 5 | #define |
| 6 | |
| 7 | #include <QtWidgets/qtwidgetsglobal.h> |
| 8 | #include <QtWidgets/qabstractitemview.h> |
| 9 | #include <QtCore/qlist.h> |
| 10 | |
| 11 | QT_REQUIRE_CONFIG(itemviews); |
| 12 | |
| 13 | class ; |
| 14 | |
| 15 | QT_BEGIN_NAMESPACE |
| 16 | |
| 17 | class ; |
| 18 | class ; |
| 19 | |
| 20 | class Q_WIDGETS_EXPORT : public QAbstractItemView |
| 21 | { |
| 22 | Q_OBJECT |
| 23 | Q_PROPERTY(bool firstSectionMovable READ isFirstSectionMovable WRITE setFirstSectionMovable) |
| 24 | Q_PROPERTY(bool showSortIndicator READ isSortIndicatorShown WRITE setSortIndicatorShown) |
| 25 | Q_PROPERTY(bool sectionsMovable READ sectionsMovable WRITE setSectionsMovable) |
| 26 | Q_PROPERTY(bool sectionsClickable READ sectionsClickable WRITE setSectionsClickable) |
| 27 | Q_PROPERTY(bool highlightSections READ highlightSections WRITE setHighlightSections) |
| 28 | Q_PROPERTY(bool stretchLastSection READ stretchLastSection WRITE setStretchLastSection) |
| 29 | Q_PROPERTY(bool cascadingSectionResizes READ cascadingSectionResizes |
| 30 | WRITE setCascadingSectionResizes) |
| 31 | Q_PROPERTY(int defaultSectionSize READ defaultSectionSize WRITE setDefaultSectionSize |
| 32 | RESET resetDefaultSectionSize) |
| 33 | Q_PROPERTY(int minimumSectionSize READ minimumSectionSize WRITE setMinimumSectionSize) |
| 34 | Q_PROPERTY(int maximumSectionSize READ maximumSectionSize WRITE setMaximumSectionSize) |
| 35 | Q_PROPERTY(Qt::Alignment defaultAlignment READ defaultAlignment WRITE setDefaultAlignment) |
| 36 | Q_PROPERTY(bool sortIndicatorClearable READ isSortIndicatorClearable |
| 37 | WRITE setSortIndicatorClearable NOTIFY sortIndicatorClearableChanged) |
| 38 | |
| 39 | public: |
| 40 | |
| 41 | enum |
| 42 | { |
| 43 | , |
| 44 | , |
| 45 | , |
| 46 | , |
| 47 | = Fixed |
| 48 | }; |
| 49 | Q_ENUM(ResizeMode) |
| 50 | |
| 51 | explicit (Qt::Orientation orientation, QWidget *parent = nullptr); |
| 52 | virtual (); |
| 53 | |
| 54 | void (QAbstractItemModel *model) override; |
| 55 | |
| 56 | Qt::Orientation () const; |
| 57 | int () const; |
| 58 | int () const; |
| 59 | QSize () const override; |
| 60 | void (bool v) override; |
| 61 | int (int logicalIndex) const; |
| 62 | |
| 63 | int (int position) const; |
| 64 | int (int position) const; |
| 65 | |
| 66 | inline int logicalIndexAt(int x, int y) const; |
| 67 | inline int logicalIndexAt(const QPoint &pos) const; |
| 68 | |
| 69 | int (int logicalIndex) const; |
| 70 | int (int logicalIndex) const; |
| 71 | int (int logicalIndex) const; |
| 72 | |
| 73 | void (int from, int to); |
| 74 | void (int first, int second); |
| 75 | void (int logicalIndex, int size); |
| 76 | void (QHeaderView::ResizeMode mode); |
| 77 | |
| 78 | bool (int logicalIndex) const; |
| 79 | void (int logicalIndex, bool hide); |
| 80 | int () const; |
| 81 | |
| 82 | inline void hideSection(int logicalIndex); |
| 83 | inline void showSection(int logicalIndex); |
| 84 | |
| 85 | int () const; |
| 86 | int (int logicalIndex) const; |
| 87 | int (int visualIndex) const; |
| 88 | |
| 89 | void (bool movable); |
| 90 | bool () const; |
| 91 | void (bool movable); |
| 92 | bool () const; |
| 93 | |
| 94 | void (bool clickable); |
| 95 | bool () const; |
| 96 | |
| 97 | void (bool highlight); |
| 98 | bool () const; |
| 99 | |
| 100 | ResizeMode (int logicalIndex) const; |
| 101 | void (ResizeMode mode); |
| 102 | void (int logicalIndex, ResizeMode mode); |
| 103 | |
| 104 | void (int precision); |
| 105 | int () const; |
| 106 | |
| 107 | int () const; |
| 108 | |
| 109 | void (bool show); |
| 110 | bool () const; |
| 111 | |
| 112 | void (int logicalIndex, Qt::SortOrder order); |
| 113 | int () const; |
| 114 | Qt::SortOrder () const; |
| 115 | |
| 116 | void (bool clearable); |
| 117 | bool () const; |
| 118 | |
| 119 | bool () const; |
| 120 | void (bool stretch); |
| 121 | |
| 122 | bool () const; |
| 123 | void (bool enable); |
| 124 | |
| 125 | int () const; |
| 126 | void (int size); |
| 127 | void (); |
| 128 | |
| 129 | int () const; |
| 130 | void (int size); |
| 131 | int () const; |
| 132 | void (int size); |
| 133 | |
| 134 | Qt::Alignment () const; |
| 135 | void (Qt::Alignment alignment); |
| 136 | |
| 137 | void () override; |
| 138 | bool () const; |
| 139 | bool () const; |
| 140 | |
| 141 | #ifndef QT_NO_DATASTREAM |
| 142 | QByteArray () const; |
| 143 | bool (const QByteArray &state); |
| 144 | #endif |
| 145 | |
| 146 | void () override; |
| 147 | |
| 148 | public Q_SLOTS: |
| 149 | void (int offset); |
| 150 | void (int visualIndex); |
| 151 | void (); |
| 152 | void (Qt::Orientation orientation, int logicalFirst, int logicalLast); |
| 153 | |
| 154 | Q_SIGNALS: |
| 155 | void (int logicalIndex, int oldVisualIndex, int newVisualIndex); |
| 156 | void (int logicalIndex, int oldSize, int newSize); |
| 157 | void (int logicalIndex); |
| 158 | void (int logicalIndex); |
| 159 | void (int logicalIndex); |
| 160 | void (int logicalIndex); |
| 161 | void (int oldCount, int newCount); |
| 162 | void sectionHandleDoubleClicked(int logicalIndex); |
| 163 | void (); |
| 164 | void (int logicalIndex, Qt::SortOrder order); |
| 165 | void (bool clearable); |
| 166 | |
| 167 | protected Q_SLOTS: |
| 168 | void (int logicalIndex); |
| 169 | void (); |
| 170 | void (const QModelIndex &parent, int logicalFirst, int logicalLast); |
| 171 | void (const QModelIndex &parent, int logicalFirst, int logicalLast); |
| 172 | |
| 173 | protected: |
| 174 | (QHeaderViewPrivate &dd, Qt::Orientation orientation, QWidget *parent = nullptr); |
| 175 | void (); |
| 176 | |
| 177 | void (); |
| 178 | void (int start, int end); |
| 179 | void (const QModelIndex ¤t, const QModelIndex &old) override; |
| 180 | |
| 181 | bool (QEvent *e) override; |
| 182 | void (QPaintEvent *e) override; |
| 183 | void (QMouseEvent *e) override; |
| 184 | void (QMouseEvent *e) override; |
| 185 | void (QMouseEvent *e) override; |
| 186 | void (QMouseEvent *e) override; |
| 187 | bool (QEvent *e) override; |
| 188 | |
| 189 | virtual void (QPainter *painter, const QRect &rect, int logicalIndex) const; |
| 190 | virtual QSize (int logicalIndex) const; |
| 191 | |
| 192 | int () const override; |
| 193 | int () const override; |
| 194 | void () override; |
| 195 | void (int dx, int dy) override; |
| 196 | |
| 197 | void (const QModelIndex &topLeft, const QModelIndex &bottomRight, |
| 198 | const QList<int> &roles = QList<int>()) override; |
| 199 | void (const QModelIndex &parent, int start, int end) override; |
| 200 | |
| 201 | QRect (const QModelIndex &index) const override; |
| 202 | void (const QModelIndex &index, ScrollHint hint) override; |
| 203 | |
| 204 | QModelIndex (const QPoint &p) const override; |
| 205 | bool (const QModelIndex &index) const override; |
| 206 | |
| 207 | QModelIndex (CursorAction, Qt::KeyboardModifiers) override; |
| 208 | void (const QRect& rect, QItemSelectionModel::SelectionFlags flags) override; |
| 209 | QRegion (const QItemSelection &selection) const override; |
| 210 | virtual void (QStyleOptionHeader *option, int logicalIndex) const; |
| 211 | virtual void (QStyleOptionHeader *option) const; |
| 212 | |
| 213 | friend class QTableView; |
| 214 | friend class QTreeView; |
| 215 | friend class ::tst_QHeaderView; |
| 216 | |
| 217 | private: |
| 218 | void (QStyleOptionFrame *option) const override; |
| 219 | |
| 220 | Q_DECLARE_PRIVATE(QHeaderView) |
| 221 | Q_DISABLE_COPY() |
| 222 | }; |
| 223 | |
| 224 | inline int QHeaderView::(int ax, int ay) const |
| 225 | { return orientation() == Qt::Horizontal ? logicalIndexAt(position: ax) : logicalIndexAt(position: ay); } |
| 226 | inline int QHeaderView::(const QPoint &apos) const |
| 227 | { return logicalIndexAt(ax: apos.x(), ay: apos.y()); } |
| 228 | inline void QHeaderView::(int alogicalIndex) |
| 229 | { setSectionHidden(logicalIndex: alogicalIndex, hide: true); } |
| 230 | inline void QHeaderView::(int alogicalIndex) |
| 231 | { setSectionHidden(logicalIndex: alogicalIndex, hide: false); } |
| 232 | |
| 233 | QT_END_NAMESPACE |
| 234 | |
| 235 | #endif // QHEADERVIEW_H |
| 236 | |