1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtWidgets module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #ifndef QHEADERVIEW_H |
41 | #define |
42 | |
43 | #include <QtWidgets/qtwidgetsglobal.h> |
44 | #include <QtWidgets/qabstractitemview.h> |
45 | |
46 | QT_REQUIRE_CONFIG(itemviews); |
47 | |
48 | QT_BEGIN_NAMESPACE |
49 | |
50 | class ; |
51 | class ; |
52 | |
53 | class Q_WIDGETS_EXPORT : public QAbstractItemView |
54 | { |
55 | Q_OBJECT |
56 | Q_PROPERTY(bool firstSectionMovable READ isFirstSectionMovable WRITE setFirstSectionMovable) |
57 | Q_PROPERTY(bool showSortIndicator READ isSortIndicatorShown WRITE setSortIndicatorShown) |
58 | Q_PROPERTY(bool highlightSections READ highlightSections WRITE setHighlightSections) |
59 | Q_PROPERTY(bool stretchLastSection READ stretchLastSection WRITE setStretchLastSection) |
60 | Q_PROPERTY(bool cascadingSectionResizes READ cascadingSectionResizes WRITE setCascadingSectionResizes) |
61 | Q_PROPERTY(int defaultSectionSize READ defaultSectionSize WRITE setDefaultSectionSize RESET resetDefaultSectionSize) |
62 | Q_PROPERTY(int minimumSectionSize READ minimumSectionSize WRITE setMinimumSectionSize) |
63 | Q_PROPERTY(int maximumSectionSize READ maximumSectionSize WRITE setMaximumSectionSize) |
64 | Q_PROPERTY(Qt::Alignment defaultAlignment READ defaultAlignment WRITE setDefaultAlignment) |
65 | |
66 | public: |
67 | |
68 | enum |
69 | { |
70 | , |
71 | , |
72 | , |
73 | , |
74 | = Fixed |
75 | }; |
76 | Q_ENUM(ResizeMode) |
77 | |
78 | explicit (Qt::Orientation orientation, QWidget *parent = nullptr); |
79 | virtual (); |
80 | |
81 | void (QAbstractItemModel *model) override; |
82 | |
83 | Qt::Orientation () const; |
84 | int () const; |
85 | int () const; |
86 | QSize () const override; |
87 | void (bool v) override; |
88 | int (int logicalIndex) const; |
89 | |
90 | int (int position) const; |
91 | int (int position) const; |
92 | |
93 | inline int logicalIndexAt(int x, int y) const; |
94 | inline int logicalIndexAt(const QPoint &pos) const; |
95 | |
96 | int (int logicalIndex) const; |
97 | int (int logicalIndex) const; |
98 | int (int logicalIndex) const; |
99 | |
100 | void (int from, int to); |
101 | void (int first, int second); |
102 | void (int logicalIndex, int size); |
103 | void (QHeaderView::ResizeMode mode); |
104 | |
105 | bool (int logicalIndex) const; |
106 | void (int logicalIndex, bool hide); |
107 | int () const; |
108 | |
109 | inline void hideSection(int logicalIndex); |
110 | inline void showSection(int logicalIndex); |
111 | |
112 | int () const; |
113 | int (int logicalIndex) const; |
114 | int (int visualIndex) const; |
115 | |
116 | void (bool movable); |
117 | bool () const; |
118 | #if QT_DEPRECATED_SINCE(5, 0) |
119 | inline QT_DEPRECATED void setMovable(bool movable) { setSectionsMovable(movable); } |
120 | inline QT_DEPRECATED bool isMovable() const { return sectionsMovable(); } |
121 | #endif |
122 | void (bool movable); |
123 | bool () const; |
124 | |
125 | void (bool clickable); |
126 | bool () const; |
127 | #if QT_DEPRECATED_SINCE(5, 0) |
128 | inline QT_DEPRECATED void setClickable(bool clickable) { setSectionsClickable(clickable); } |
129 | inline QT_DEPRECATED bool isClickable() const { return sectionsClickable(); } |
130 | #endif |
131 | |
132 | void (bool highlight); |
133 | bool () const; |
134 | |
135 | ResizeMode (int logicalIndex) const; |
136 | void (ResizeMode mode); |
137 | void (int logicalIndex, ResizeMode mode); |
138 | |
139 | void (int precision); |
140 | int () const; |
141 | |
142 | #if QT_DEPRECATED_SINCE(5, 0) |
143 | inline QT_DEPRECATED void setResizeMode(ResizeMode mode) |
144 | { setSectionResizeMode(mode); } |
145 | inline QT_DEPRECATED void setResizeMode(int logicalindex, ResizeMode mode) |
146 | { setSectionResizeMode(logicalindex, mode); } |
147 | inline QT_DEPRECATED ResizeMode resizeMode(int logicalindex) const |
148 | { return sectionResizeMode(logicalindex); } |
149 | #endif |
150 | |
151 | int () const; |
152 | |
153 | void (bool show); |
154 | bool () const; |
155 | |
156 | void (int logicalIndex, Qt::SortOrder order); |
157 | int () const; |
158 | Qt::SortOrder () const; |
159 | |
160 | bool () const; |
161 | void (bool stretch); |
162 | |
163 | bool () const; |
164 | void (bool enable); |
165 | |
166 | int () const; |
167 | void (int size); |
168 | void (); |
169 | |
170 | int () const; |
171 | void (int size); |
172 | int () const; |
173 | void (int size); |
174 | |
175 | Qt::Alignment () const; |
176 | void (Qt::Alignment alignment); |
177 | |
178 | void () override; |
179 | bool () const; |
180 | bool () const; |
181 | |
182 | #ifndef QT_NO_DATASTREAM |
183 | QByteArray () const; |
184 | bool (const QByteArray &state); |
185 | #endif |
186 | |
187 | void () override; |
188 | |
189 | public Q_SLOTS: |
190 | void (int offset); |
191 | void (int visualIndex); |
192 | void (); |
193 | void (Qt::Orientation orientation, int logicalFirst, int logicalLast); |
194 | |
195 | Q_SIGNALS: |
196 | void (int logicalIndex, int oldVisualIndex, int newVisualIndex); |
197 | void (int logicalIndex, int oldSize, int newSize); |
198 | void (int logicalIndex); |
199 | void (int logicalIndex); |
200 | void (int logicalIndex); |
201 | void (int logicalIndex); |
202 | void (int oldCount, int newCount); |
203 | void sectionHandleDoubleClicked(int logicalIndex); |
204 | void (); |
205 | void (int logicalIndex, Qt::SortOrder order); |
206 | |
207 | protected Q_SLOTS: |
208 | void (int logicalIndex); |
209 | void (); |
210 | void (const QModelIndex &parent, int logicalFirst, int logicalLast); |
211 | void (const QModelIndex &parent, int logicalFirst, int logicalLast); |
212 | |
213 | protected: |
214 | (QHeaderViewPrivate &dd, Qt::Orientation orientation, QWidget *parent = nullptr); |
215 | void (); |
216 | |
217 | void (); |
218 | void (int start, int end); |
219 | void (const QModelIndex ¤t, const QModelIndex &old) override; |
220 | |
221 | bool (QEvent *e) override; |
222 | void (QPaintEvent *e) override; |
223 | void (QMouseEvent *e) override; |
224 | void (QMouseEvent *e) override; |
225 | void (QMouseEvent *e) override; |
226 | void (QMouseEvent *e) override; |
227 | bool (QEvent *e) override; |
228 | |
229 | virtual void (QPainter *painter, const QRect &rect, int logicalIndex) const; |
230 | virtual QSize (int logicalIndex) const; |
231 | |
232 | int () const override; |
233 | int () const override; |
234 | void () override; |
235 | void (int dx, int dy) override; |
236 | |
237 | void (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) override; |
238 | void (const QModelIndex &parent, int start, int end) override; |
239 | |
240 | QRect (const QModelIndex &index) const override; |
241 | void (const QModelIndex &index, ScrollHint hint) override; |
242 | |
243 | QModelIndex (const QPoint &p) const override; |
244 | bool (const QModelIndex &index) const override; |
245 | |
246 | QModelIndex (CursorAction, Qt::KeyboardModifiers) override; |
247 | void (const QRect& rect, QItemSelectionModel::SelectionFlags flags) override; |
248 | QRegion (const QItemSelection &selection) const override; |
249 | void (QStyleOptionHeader *option) const; |
250 | |
251 | friend class QTableView; |
252 | friend class QTreeView; |
253 | |
254 | private: |
255 | // ### Qt6: make them protected slots in QHeaderViewPrivate |
256 | Q_PRIVATE_SLOT(d_func(), void _q_sectionsRemoved(const QModelIndex &parent, int logicalFirst, int logicalLast)) |
257 | Q_PRIVATE_SLOT(d_func(), void _q_sectionsAboutToBeMoved(const QModelIndex &sourceParent, int logicalStart, int logicalEnd, const QModelIndex &destinationParent, int logicalDestination)) |
258 | Q_PRIVATE_SLOT(d_func(), void _q_sectionsMoved(const QModelIndex &sourceParent, int logicalStart, int logicalEnd, const QModelIndex &destinationParent, int logicalDestination)) |
259 | Q_PRIVATE_SLOT(d_func(), void _q_sectionsAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), |
260 | QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint)) |
261 | Q_PRIVATE_SLOT(d_func(), void _q_sectionsChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), |
262 | QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint)) |
263 | Q_DECLARE_PRIVATE(QHeaderView) |
264 | Q_DISABLE_COPY() |
265 | }; |
266 | |
267 | inline int QHeaderView::(int ax, int ay) const |
268 | { return orientation() == Qt::Horizontal ? logicalIndexAt(position: ax) : logicalIndexAt(position: ay); } |
269 | inline int QHeaderView::(const QPoint &apos) const |
270 | { return logicalIndexAt(ax: apos.x(), ay: apos.y()); } |
271 | inline void QHeaderView::(int alogicalIndex) |
272 | { setSectionHidden(logicalIndex: alogicalIndex, hide: true); } |
273 | inline void QHeaderView::(int alogicalIndex) |
274 | { setSectionHidden(logicalIndex: alogicalIndex, hide: false); } |
275 | |
276 | QT_END_NAMESPACE |
277 | |
278 | #endif // QHEADERVIEW_H |
279 | |