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 | void (bool movable); |
119 | bool () const; |
120 | |
121 | void (bool clickable); |
122 | bool () const; |
123 | |
124 | void (bool highlight); |
125 | bool () const; |
126 | |
127 | ResizeMode (int logicalIndex) const; |
128 | void (ResizeMode mode); |
129 | void (int logicalIndex, ResizeMode mode); |
130 | |
131 | void (int precision); |
132 | int () const; |
133 | |
134 | int () const; |
135 | |
136 | void (bool show); |
137 | bool () const; |
138 | |
139 | void (int logicalIndex, Qt::SortOrder order); |
140 | int () const; |
141 | Qt::SortOrder () const; |
142 | |
143 | bool () const; |
144 | void (bool stretch); |
145 | |
146 | bool () const; |
147 | void (bool enable); |
148 | |
149 | int () const; |
150 | void (int size); |
151 | void (); |
152 | |
153 | int () const; |
154 | void (int size); |
155 | int () const; |
156 | void (int size); |
157 | |
158 | Qt::Alignment () const; |
159 | void (Qt::Alignment alignment); |
160 | |
161 | void () override; |
162 | bool () const; |
163 | bool () const; |
164 | |
165 | #ifndef QT_NO_DATASTREAM |
166 | QByteArray () const; |
167 | bool (const QByteArray &state); |
168 | #endif |
169 | |
170 | void () override; |
171 | |
172 | public Q_SLOTS: |
173 | void (int offset); |
174 | void (int visualIndex); |
175 | void (); |
176 | void (Qt::Orientation orientation, int logicalFirst, int logicalLast); |
177 | |
178 | Q_SIGNALS: |
179 | void (int logicalIndex, int oldVisualIndex, int newVisualIndex); |
180 | void (int logicalIndex, int oldSize, int newSize); |
181 | void (int logicalIndex); |
182 | void (int logicalIndex); |
183 | void (int logicalIndex); |
184 | void (int logicalIndex); |
185 | void (int oldCount, int newCount); |
186 | void sectionHandleDoubleClicked(int logicalIndex); |
187 | void (); |
188 | void (int logicalIndex, Qt::SortOrder order); |
189 | |
190 | protected Q_SLOTS: |
191 | void (int logicalIndex); |
192 | void (); |
193 | void (const QModelIndex &parent, int logicalFirst, int logicalLast); |
194 | void (const QModelIndex &parent, int logicalFirst, int logicalLast); |
195 | |
196 | protected: |
197 | (QHeaderViewPrivate &dd, Qt::Orientation orientation, QWidget *parent = nullptr); |
198 | void (); |
199 | |
200 | void (); |
201 | void (int start, int end); |
202 | void (const QModelIndex ¤t, const QModelIndex &old) override; |
203 | |
204 | bool (QEvent *e) override; |
205 | void (QPaintEvent *e) override; |
206 | void (QMouseEvent *e) override; |
207 | void (QMouseEvent *e) override; |
208 | void (QMouseEvent *e) override; |
209 | void (QMouseEvent *e) override; |
210 | bool (QEvent *e) override; |
211 | |
212 | virtual void (QPainter *painter, const QRect &rect, int logicalIndex) const; |
213 | virtual QSize (int logicalIndex) const; |
214 | |
215 | int () const override; |
216 | int () const override; |
217 | void () override; |
218 | void (int dx, int dy) override; |
219 | |
220 | void (const QModelIndex &topLeft, const QModelIndex &bottomRight, |
221 | const QList<int> &roles = QList<int>()) override; |
222 | void (const QModelIndex &parent, int start, int end) override; |
223 | |
224 | QRect (const QModelIndex &index) const override; |
225 | void (const QModelIndex &index, ScrollHint hint) override; |
226 | |
227 | QModelIndex (const QPoint &p) const override; |
228 | bool (const QModelIndex &index) const override; |
229 | |
230 | QModelIndex (CursorAction, Qt::KeyboardModifiers) override; |
231 | void (const QRect& rect, QItemSelectionModel::SelectionFlags flags) override; |
232 | QRegion (const QItemSelection &selection) const override; |
233 | virtual void (QStyleOptionHeader *option, int logicalIndex) const; |
234 | virtual void (QStyleOptionHeader *option) const; |
235 | |
236 | friend class QTableView; |
237 | friend class QTreeView; |
238 | |
239 | private: |
240 | void (QStyleOptionFrame *option) const override; |
241 | |
242 | // ### Qt6: make them protected slots in QHeaderViewPrivate |
243 | Q_PRIVATE_SLOT(d_func(), void _q_sectionsRemoved(const QModelIndex &parent, int logicalFirst, int logicalLast)) |
244 | Q_PRIVATE_SLOT(d_func(), void _q_sectionsAboutToBeMoved(const QModelIndex &sourceParent, int logicalStart, int logicalEnd, const QModelIndex &destinationParent, int logicalDestination)) |
245 | Q_PRIVATE_SLOT(d_func(), void _q_sectionsMoved(const QModelIndex &sourceParent, int logicalStart, int logicalEnd, const QModelIndex &destinationParent, int logicalDestination)) |
246 | Q_PRIVATE_SLOT(d_func(), void _q_sectionsAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), |
247 | QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint)) |
248 | Q_PRIVATE_SLOT(d_func(), void _q_sectionsChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), |
249 | QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint)) |
250 | Q_DECLARE_PRIVATE(QHeaderView) |
251 | Q_DISABLE_COPY() |
252 | }; |
253 | |
254 | inline int QHeaderView::(int ax, int ay) const |
255 | { return orientation() == Qt::Horizontal ? logicalIndexAt(ax) : logicalIndexAt(ay); } |
256 | inline int QHeaderView::(const QPoint &apos) const |
257 | { return logicalIndexAt(apos.x(), apos.y()); } |
258 | inline void QHeaderView::(int alogicalIndex) |
259 | { setSectionHidden(alogicalIndex, true); } |
260 | inline void QHeaderView::(int alogicalIndex) |
261 | { setSectionHidden(alogicalIndex, false); } |
262 | |
263 | QT_END_NAMESPACE |
264 | |
265 | #endif // QHEADERVIEW_H |
266 | |