author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 11:15:19 +0300 | |
branch | RCL_3 |
changeset 11 | 25a739ee40f4 |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QLISTVIEW_P_H |
|
43 |
#define QLISTVIEW_P_H |
|
44 |
||
45 |
// |
|
46 |
// W A R N I N G |
|
47 |
// ------------- |
|
48 |
// |
|
49 |
// This file is not part of the Qt API. It exists for the convenience |
|
50 |
// of other Qt classes. This header file may change from version to |
|
51 |
// version without notice, or even be removed. |
|
52 |
// |
|
53 |
// We mean it. |
|
54 |
// |
|
55 |
||
56 |
#include "private/qabstractitemview_p.h" |
|
57 |
#include "qrubberband.h" |
|
58 |
#include "qbitarray.h" |
|
59 |
#include "qbsptree_p.h" |
|
60 |
#include <limits.h> |
|
61 |
#include <qscrollbar.h> |
|
62 |
||
63 |
#ifndef QT_NO_LISTVIEW |
|
64 |
||
65 |
QT_BEGIN_NAMESPACE |
|
66 |
||
67 |
class QListViewItem |
|
68 |
{ |
|
69 |
friend class QListViewPrivate; |
|
70 |
friend class QListModeViewBase; |
|
71 |
friend class QIconModeViewBase; |
|
72 |
public: |
|
73 |
inline QListViewItem() |
|
74 |
: x(-1), y(-1), w(0), h(0), indexHint(-1), visited(0xffff) {} |
|
75 |
inline QListViewItem(const QListViewItem &other) |
|
76 |
: x(other.x), y(other.y), w(other.w), h(other.h), |
|
77 |
indexHint(other.indexHint), visited(other.visited) {} |
|
78 |
inline QListViewItem(QRect r, int i) |
|
79 |
: x(r.x()), y(r.y()), w(qMin(r.width(), SHRT_MAX)), h(qMin(r.height(), SHRT_MAX)), |
|
80 |
indexHint(i), visited(0xffff) {} |
|
81 |
inline bool operator==(const QListViewItem &other) const { |
|
82 |
return (x == other.x && y == other.y && w == other.w && h == other.h && |
|
83 |
indexHint == other.indexHint); } |
|
84 |
inline bool operator!=(const QListViewItem &other) const |
|
85 |
{ return !(*this == other); } |
|
86 |
inline bool isValid() const |
|
87 |
{ return rect().isValid() && (indexHint > -1); } |
|
88 |
inline void invalidate() |
|
89 |
{ x = -1; y = -1; w = 0; h = 0; } |
|
90 |
inline void resize(const QSize &size) |
|
91 |
{ w = qMin(size.width(), SHRT_MAX); h = qMin(size.height(), SHRT_MAX); } |
|
92 |
inline void move(const QPoint &position) |
|
93 |
{ x = position.x(); y = position.y(); } |
|
94 |
inline int width() const { return w; } |
|
95 |
inline int height() const { return h; } |
|
96 |
private: |
|
97 |
inline QRect rect() const |
|
98 |
{ return QRect(x, y, w, h); } |
|
99 |
int x, y; |
|
100 |
short w, h; |
|
101 |
mutable int indexHint; |
|
102 |
uint visited; |
|
103 |
}; |
|
104 |
||
105 |
struct QListViewLayoutInfo |
|
106 |
{ |
|
107 |
QRect bounds; |
|
108 |
QSize grid; |
|
109 |
int spacing; |
|
110 |
int first; |
|
111 |
int last; |
|
112 |
bool wrap; |
|
113 |
QListView::Flow flow; |
|
114 |
int max; |
|
115 |
}; |
|
116 |
||
117 |
class QListView; |
|
118 |
class QListViewPrivate; |
|
119 |
||
120 |
class QCommonListViewBase |
|
121 |
{ |
|
122 |
public: |
|
123 |
inline QCommonListViewBase(QListView *q, QListViewPrivate *d) : dd(d), qq(q), batchStartRow(0), batchSavedDeltaSeg(0) {} |
|
124 |
virtual ~QCommonListViewBase() {} |
|
125 |
||
126 |
//common interface |
|
127 |
virtual int itemIndex(const QListViewItem &item) const = 0; |
|
128 |
virtual QListViewItem indexToListViewItem(const QModelIndex &index) const = 0; |
|
129 |
virtual bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max) = 0; |
|
130 |
virtual void clear() = 0; |
|
131 |
virtual void setRowCount(int) = 0; |
|
132 |
virtual QVector<QModelIndex> intersectingSet(const QRect &area) const = 0; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
133 |
virtual void dataChanged(const QModelIndex &, const QModelIndex &) = 0; |
0 | 134 |
|
135 |
virtual int horizontalScrollToValue(int index, QListView::ScrollHint hint, |
|
136 |
bool leftOf, bool rightOf, const QRect &area, const QRect &rect) const; |
|
137 |
virtual int verticalScrollToValue(int index, QListView::ScrollHint hint, |
|
138 |
bool above, bool below, const QRect &area, const QRect &rect) const; |
|
139 |
virtual void scrollContentsBy(int dx, int dy, bool scrollElasticBand); |
|
140 |
virtual QRect mapToViewport(const QRect &rect) const {return rect;} |
|
141 |
virtual int horizontalOffset() const; |
|
142 |
virtual int verticalOffset() const { return verticalScrollBar()->value(); } |
|
143 |
virtual void updateHorizontalScrollBar(const QSize &step); |
|
144 |
virtual void updateVerticalScrollBar(const QSize &step); |
|
145 |
virtual void appendHiddenRow(int row); |
|
146 |
virtual void removeHiddenRow(int row); |
|
147 |
virtual void setPositionForIndex(const QPoint &, const QModelIndex &) { } |
|
148 |
||
149 |
#ifndef QT_NO_DRAGANDDROP |
|
150 |
virtual void paintDragDrop(QPainter *painter) = 0; |
|
151 |
virtual bool filterDragMoveEvent(QDragMoveEvent *) { return false; } |
|
152 |
virtual bool filterDragLeaveEvent(QDragLeaveEvent *) { return false; } |
|
153 |
virtual bool filterDropEvent(QDropEvent *) { return false; } |
|
154 |
virtual bool filterStartDrag(Qt::DropActions) { return false; } |
|
155 |
#endif |
|
156 |
||
157 |
||
158 |
//other inline members |
|
159 |
inline int spacing() const; |
|
160 |
inline bool isWrapping() const; |
|
161 |
inline QSize gridSize() const; |
|
162 |
inline QListView::Flow flow() const; |
|
163 |
inline QListView::Movement movement() const; |
|
164 |
||
165 |
inline QPoint offset() const; |
|
166 |
inline QPoint pressedPosition() const; |
|
167 |
inline bool uniformItemSizes() const; |
|
168 |
inline int column() const; |
|
169 |
||
170 |
inline QScrollBar *verticalScrollBar() const; |
|
171 |
inline QScrollBar *horizontalScrollBar() const; |
|
172 |
inline QListView::ScrollMode verticalScrollMode() const; |
|
173 |
inline QListView::ScrollMode horizontalScrollMode() const; |
|
174 |
||
175 |
inline QModelIndex modelIndex(int row) const; |
|
176 |
inline int rowCount() const; |
|
177 |
||
178 |
inline QStyleOptionViewItemV4 viewOptions() const; |
|
179 |
inline QWidget *viewport() const; |
|
180 |
inline QRect clipRect() const; |
|
181 |
||
182 |
inline QSize cachedItemSize() const; |
|
183 |
inline QRect viewItemRect(const QListViewItem &item) const; |
|
184 |
inline QSize itemSize(const QStyleOptionViewItemV2 &opt, const QModelIndex &idx) const; |
|
185 |
inline QAbstractItemDelegate *delegate(const QModelIndex &idx) const; |
|
186 |
||
187 |
inline bool isHidden(int row) const; |
|
188 |
inline int hiddenCount() const; |
|
189 |
||
190 |
inline bool isRightToLeft() const; |
|
191 |
||
192 |
QListViewPrivate *dd; |
|
193 |
QListView *qq; |
|
194 |
QSize contentsSize; |
|
195 |
int batchStartRow; |
|
196 |
int batchSavedDeltaSeg; |
|
197 |
}; |
|
198 |
||
199 |
class QListModeViewBase : public QCommonListViewBase |
|
200 |
{ |
|
201 |
public: |
|
202 |
QListModeViewBase(QListView *q, QListViewPrivate *d) : QCommonListViewBase(q, d) {} |
|
203 |
||
204 |
QVector<int> flowPositions; |
|
205 |
QVector<int> segmentPositions; |
|
206 |
QVector<int> segmentStartRows; |
|
207 |
QVector<int> segmentExtents; |
|
208 |
QVector<int> scrollValueMap; |
|
209 |
||
210 |
// used when laying out in batches |
|
211 |
int batchSavedPosition; |
|
212 |
||
213 |
//reimplementations |
|
214 |
int itemIndex(const QListViewItem &item) const { return item.indexHint; } |
|
215 |
QListViewItem indexToListViewItem(const QModelIndex &index) const; |
|
216 |
bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max); |
|
217 |
void clear(); |
|
218 |
void setRowCount(int rowCount) { flowPositions.resize(rowCount); } |
|
219 |
QVector<QModelIndex> intersectingSet(const QRect &area) const; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
220 |
void dataChanged(const QModelIndex &, const QModelIndex &); |
0 | 221 |
|
222 |
int horizontalScrollToValue(int index, QListView::ScrollHint hint, |
|
223 |
bool leftOf, bool rightOf,const QRect &area, const QRect &rect) const; |
|
224 |
int verticalScrollToValue(int index, QListView::ScrollHint hint, |
|
225 |
bool above, bool below, const QRect &area, const QRect &rect) const; |
|
226 |
void scrollContentsBy(int dx, int dy, bool scrollElasticBand); |
|
227 |
QRect mapToViewport(const QRect &rect) const; |
|
228 |
int horizontalOffset() const; |
|
229 |
int verticalOffset() const; |
|
230 |
void updateHorizontalScrollBar(const QSize &step); |
|
231 |
void updateVerticalScrollBar(const QSize &step); |
|
232 |
||
233 |
#ifndef QT_NO_DRAGANDDROP |
|
234 |
void paintDragDrop(QPainter *painter); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
235 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
236 |
// The next two methods are to be used on LefToRight flow only. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
237 |
// WARNING: Plenty of duplicated code from QAbstractItemView{,Private}. |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
238 |
QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
239 |
void dragMoveEvent(QDragMoveEvent *e); |
0 | 240 |
#endif |
241 |
||
242 |
private: |
|
243 |
QPoint initStaticLayout(const QListViewLayoutInfo &info); |
|
244 |
void doStaticLayout(const QListViewLayoutInfo &info); |
|
245 |
int perItemScrollToValue(int index, int value, int height, |
|
246 |
QAbstractItemView::ScrollHint hint, |
|
247 |
Qt::Orientation orientation, bool wrap, int extent) const; |
|
248 |
int perItemScrollingPageSteps(int length, int bounds, bool wrap) const; |
|
249 |
}; |
|
250 |
||
251 |
class QIconModeViewBase : public QCommonListViewBase |
|
252 |
{ |
|
253 |
public: |
|
254 |
QIconModeViewBase(QListView *q, QListViewPrivate *d) : QCommonListViewBase(q, d), interSectingVector(0) {} |
|
255 |
||
256 |
QBspTree tree; |
|
257 |
QVector<QListViewItem> items; |
|
258 |
QBitArray moved; |
|
259 |
||
260 |
QVector<QModelIndex> draggedItems; // indices to the tree.itemVector |
|
261 |
mutable QPoint draggedItemsPos; |
|
262 |
||
263 |
// used when laying out in batches |
|
264 |
QVector<QModelIndex> *interSectingVector; //used from within intersectingSet |
|
265 |
||
266 |
//reimplementations |
|
267 |
int itemIndex(const QListViewItem &item) const; |
|
268 |
QListViewItem indexToListViewItem(const QModelIndex &index) const; |
|
269 |
bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max); |
|
270 |
void clear(); |
|
271 |
void setRowCount(int rowCount); |
|
272 |
QVector<QModelIndex> intersectingSet(const QRect &area) const; |
|
273 |
||
274 |
void scrollContentsBy(int dx, int dy, bool scrollElasticBand); |
|
275 |
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); |
|
276 |
void appendHiddenRow(int row); |
|
277 |
void removeHiddenRow(int row); |
|
278 |
void setPositionForIndex(const QPoint &position, const QModelIndex &index); |
|
279 |
||
280 |
#ifndef QT_NO_DRAGANDDROP |
|
281 |
void paintDragDrop(QPainter *painter); |
|
282 |
bool filterDragMoveEvent(QDragMoveEvent *); |
|
283 |
bool filterDragLeaveEvent(QDragLeaveEvent *); |
|
284 |
bool filterDropEvent(QDropEvent *e); |
|
285 |
bool filterStartDrag(Qt::DropActions); |
|
286 |
#endif |
|
287 |
||
288 |
private: |
|
289 |
void initBspTree(const QSize &contents); |
|
290 |
QPoint initDynamicLayout(const QListViewLayoutInfo &info); |
|
291 |
void doDynamicLayout(const QListViewLayoutInfo &info); |
|
292 |
static void addLeaf(QVector<int> &leaf, const QRect &area, |
|
293 |
uint visited, QBspTree::Data data); |
|
294 |
QRect itemsRect(const QVector<QModelIndex> &indexes) const; |
|
295 |
QRect draggedItemsRect() const; |
|
296 |
QPoint snapToGrid(const QPoint &pos) const; |
|
297 |
void updateContentsSize(); |
|
298 |
QPoint draggedItemsDelta() const; |
|
299 |
void drawItems(QPainter *painter, const QVector<QModelIndex> &indexes) const; |
|
300 |
void moveItem(int index, const QPoint &dest); |
|
301 |
||
302 |
}; |
|
303 |
||
304 |
class QListViewPrivate: public QAbstractItemViewPrivate |
|
305 |
{ |
|
306 |
Q_DECLARE_PUBLIC(QListView) |
|
307 |
public: |
|
308 |
QListViewPrivate(); |
|
309 |
~QListViewPrivate(); |
|
310 |
||
311 |
void clear(); |
|
312 |
void prepareItemsLayout(); |
|
313 |
||
314 |
bool doItemsLayout(int num); |
|
315 |
||
316 |
inline QVector<QModelIndex> intersectingSet(const QRect &area, bool doLayout = true) const { |
|
317 |
if (doLayout) executePostedLayout(); |
|
318 |
QRect a = (q_func()->isRightToLeft() ? flipX(area.normalized()) : area.normalized()); |
|
319 |
return commonListView->intersectingSet(a); |
|
320 |
} |
|
321 |
||
322 |
inline void resetBatchStartRow() { commonListView->batchStartRow = 0; } |
|
323 |
inline int batchStartRow() const { return commonListView->batchStartRow; } |
|
324 |
inline QSize contentsSize() const { return commonListView->contentsSize; } |
|
325 |
inline void setContentsSize(int w, int h) { commonListView->contentsSize = QSize(w, h); } |
|
326 |
||
327 |
inline int flipX(int x) const |
|
328 |
{ return qMax(viewport->width(), contentsSize().width()) - x; } |
|
329 |
inline QPoint flipX(const QPoint &p) const |
|
330 |
{ return QPoint(flipX(p.x()), p.y()); } |
|
331 |
inline QRect flipX(const QRect &r) const |
|
332 |
{ return QRect(flipX(r.x()) - r.width(), r.y(), r.width(), r.height()); } |
|
333 |
inline QRect viewItemRect(const QListViewItem &item) const |
|
334 |
{ if (q_func()->isRightToLeft()) return flipX(item.rect()); return item.rect(); } |
|
335 |
||
336 |
QListViewItem indexToListViewItem(const QModelIndex &index) const; |
|
337 |
inline QModelIndex listViewItemToIndex(const QListViewItem &item) const |
|
338 |
{ return model->index(commonListView->itemIndex(item), column, root); } |
|
339 |
||
340 |
QRect rectForIndex(const QModelIndex &index) const |
|
341 |
{ |
|
342 |
if (!isIndexValid(index) || index.parent() != root || index.column() != column || isHidden(index.row())) |
|
343 |
return QRect(); |
|
344 |
executePostedLayout(); |
|
345 |
return viewItemRect(indexToListViewItem(index)); |
|
346 |
} |
|
347 |
||
348 |
void viewUpdateGeometries() { q_func()->updateGeometries(); } |
|
349 |
||
350 |
||
351 |
QRect mapToViewport(const QRect &rect, bool extend = true) const; |
|
352 |
||
353 |
QModelIndex closestIndex(const QRect &target, const QVector<QModelIndex> &candidates) const; |
|
354 |
QSize itemSize(const QStyleOptionViewItem &option, const QModelIndex &index) const; |
|
355 |
||
356 |
bool selectionAllowed(const QModelIndex &index) const |
|
357 |
{ if (viewMode == QListView::ListMode && !showElasticBand) return index.isValid(); return true; } |
|
358 |
||
359 |
int horizontalScrollToValue(const QModelIndex &index, const QRect &rect, QListView::ScrollHint hint) const; |
|
360 |
int verticalScrollToValue(const QModelIndex &index, const QRect &rect, QListView::ScrollHint hint) const; |
|
361 |
||
362 |
QItemSelection selection(const QRect &rect) const; |
|
363 |
void selectAll(QItemSelectionModel::SelectionFlags command); |
|
364 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
365 |
#ifndef QT_NO_DRAGANDDROP |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
366 |
virtual QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
367 |
#endif |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
368 |
|
0 | 369 |
inline void setGridSize(const QSize &size) { grid = size; } |
370 |
inline QSize gridSize() const { return grid; } |
|
371 |
inline void setWrapping(bool b) { wrap = b; } |
|
372 |
inline bool isWrapping() const { return wrap; } |
|
373 |
inline void setSpacing(int s) { space = s; } |
|
374 |
inline int spacing() const { return space; } |
|
375 |
inline void setSelectionRectVisible(bool visible) { showElasticBand = visible; } |
|
376 |
inline bool isSelectionRectVisible() const { return showElasticBand; } |
|
377 |
||
378 |
inline QModelIndex modelIndex(int row) const { return model->index(row, column, root); } |
|
379 |
inline bool isHidden(int row) const { return hiddenRows.contains(model->index(row, 0, root)); } |
|
380 |
inline bool isHiddenOrDisabled(int row) const { return isHidden(row) || !isIndexEnabled(modelIndex(row)); } |
|
381 |
||
382 |
inline void removeCurrentAndDisabled(QVector<QModelIndex> *indexes, const QModelIndex ¤t) const { |
|
383 |
QVector<QModelIndex>::iterator it = indexes->begin(); |
|
384 |
while (it != indexes->end()) { |
|
385 |
if (!isIndexEnabled(*it) || (*it) == current) |
|
386 |
indexes->erase(it); |
|
387 |
else |
|
388 |
++it; |
|
389 |
} |
|
390 |
} |
|
391 |
||
392 |
void scrollElasticBandBy(int dx, int dy); |
|
393 |
||
394 |
QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; |
|
395 |
||
396 |
void emitIndexesMoved(const QModelIndexList &indexes) { emit q_func()->indexesMoved(indexes); } |
|
397 |
||
398 |
||
399 |
QCommonListViewBase *commonListView; |
|
400 |
||
401 |
// ### FIXME: see if we can move the members into the dynamic/static classes |
|
402 |
||
403 |
bool wrap; |
|
404 |
int space; |
|
405 |
QSize grid; |
|
406 |
||
407 |
QListView::Flow flow; |
|
408 |
QListView::Movement movement; |
|
409 |
QListView::ResizeMode resizeMode; |
|
410 |
QListView::LayoutMode layoutMode; |
|
411 |
QListView::ViewMode viewMode; |
|
412 |
||
413 |
// the properties controlling the |
|
414 |
// icon- or list-view modes |
|
415 |
enum ModeProperties { |
|
416 |
Wrap = 1, |
|
417 |
Spacing = 2, |
|
418 |
GridSize = 4, |
|
419 |
Flow = 8, |
|
420 |
Movement = 16, |
|
421 |
ResizeMode = 32, |
|
422 |
SelectionRectVisible = 64 |
|
423 |
}; |
|
424 |
||
425 |
uint modeProperties : 8; |
|
426 |
||
427 |
QRect layoutBounds; |
|
428 |
||
429 |
// timers |
|
430 |
QBasicTimer batchLayoutTimer; |
|
431 |
||
432 |
// used for hidden items |
|
433 |
QVector<QPersistentModelIndex> hiddenRows; |
|
434 |
||
435 |
int column; |
|
436 |
bool uniformItemSizes; |
|
437 |
mutable QSize cachedItemSize; |
|
438 |
int batchSize; |
|
439 |
||
440 |
QRect elasticBand; |
|
441 |
bool showElasticBand; |
|
442 |
}; |
|
443 |
||
444 |
// inline implementations |
|
445 |
||
446 |
inline int QCommonListViewBase::spacing() const { return dd->spacing(); } |
|
447 |
inline bool QCommonListViewBase::isWrapping() const { return dd->isWrapping(); } |
|
448 |
inline QSize QCommonListViewBase::gridSize() const { return dd->gridSize(); } |
|
449 |
inline QListView::Flow QCommonListViewBase::flow() const { return dd->flow; } |
|
450 |
inline QListView::Movement QCommonListViewBase::movement() const { return dd->movement; } |
|
451 |
||
452 |
inline QPoint QCommonListViewBase::offset() const { return dd->offset(); } |
|
453 |
inline QPoint QCommonListViewBase::pressedPosition() const { return dd->pressedPosition; } |
|
454 |
inline bool QCommonListViewBase::uniformItemSizes() const { return dd->uniformItemSizes; } |
|
455 |
inline int QCommonListViewBase::column() const { return dd->column; } |
|
456 |
||
457 |
inline QScrollBar *QCommonListViewBase::verticalScrollBar() const { return qq->verticalScrollBar(); } |
|
458 |
inline QScrollBar *QCommonListViewBase::horizontalScrollBar() const { return qq->horizontalScrollBar(); } |
|
459 |
inline QListView::ScrollMode QCommonListViewBase::verticalScrollMode() const { return qq->verticalScrollMode(); } |
|
460 |
inline QListView::ScrollMode QCommonListViewBase::horizontalScrollMode() const { return qq->horizontalScrollMode(); } |
|
461 |
||
462 |
inline QModelIndex QCommonListViewBase::modelIndex(int row) const |
|
463 |
{ return dd->model->index(row, dd->column, dd->root); } |
|
464 |
inline int QCommonListViewBase::rowCount() const { return dd->model->rowCount(dd->root); } |
|
465 |
||
466 |
inline QStyleOptionViewItemV4 QCommonListViewBase::viewOptions() const { return dd->viewOptionsV4(); } |
|
467 |
inline QWidget *QCommonListViewBase::viewport() const { return dd->viewport; } |
|
468 |
inline QRect QCommonListViewBase::clipRect() const { return dd->clipRect(); } |
|
469 |
||
470 |
inline QSize QCommonListViewBase::cachedItemSize() const { return dd->cachedItemSize; } |
|
471 |
inline QRect QCommonListViewBase::viewItemRect(const QListViewItem &item) const { return dd->viewItemRect(item); } |
|
472 |
inline QSize QCommonListViewBase::itemSize(const QStyleOptionViewItemV2 &opt, const QModelIndex &idx) const |
|
473 |
{ return dd->itemSize(opt, idx); } |
|
474 |
||
475 |
inline QAbstractItemDelegate *QCommonListViewBase::delegate(const QModelIndex &idx) const |
|
476 |
{ return dd->delegateForIndex(idx); } |
|
477 |
||
478 |
inline bool QCommonListViewBase::isHidden(int row) const { return dd->isHidden(row); } |
|
479 |
inline int QCommonListViewBase::hiddenCount() const { return dd->hiddenRows.count(); } |
|
480 |
||
481 |
inline bool QCommonListViewBase::isRightToLeft() const { return qq->isRightToLeft(); } |
|
482 |
||
483 |
QT_END_NAMESPACE |
|
484 |
||
485 |
#endif // QT_NO_LISTVIEW |
|
486 |
||
487 |
#endif // QLISTVIEW_P_H |