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