📄 qlistview_p.h
字号:
/******************************************************************************** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.**** This file is part of the QtGui module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file. Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://trolltech.com/products/qt/licenses/licensing/opensource/**** If you are unsure which license is appropriate for your use, please** review the following information:** http://trolltech.com/products/qt/licenses/licensing/licensingoverview** or contact the sales department at sales@trolltech.com.**** In addition, as a special exception, Trolltech gives you certain** additional rights. These rights are described in the Trolltech GPL** Exception version 1.0, which can be found at** http://www.trolltech.com/products/qt/gplexception/ and in the file** GPL_EXCEPTION.txt in this package.**** In addition, as a special exception, Trolltech, as the sole copyright** holder for Qt Designer, grants users of the Qt/Eclipse Integration** plug-in the right for the Qt/Eclipse Integration to link to** functionality provided by Qt Designer and its related libraries.**** Trolltech reserves all rights not expressly granted herein.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#ifndef QLISTVIEW_P_H#define QLISTVIEW_P_H//// W A R N I N G// -------------//// This file is not part of the Qt API. It exists for the convenience// of other Qt classes. This header file may change from version to// version without notice, or even be removed.//// We mean it.//#include "private/qabstractitemview_p.h"#include "qrubberband.h"#include "qbitarray.h"#include "qbsptree_p.h"#include <limits.h>#include <qscrollbar.h>#ifndef QT_NO_LISTVIEWclass QListViewItem{ friend class QListViewPrivate; friend class QStaticListViewBase; friend class QDynamicListViewBase;public: inline QListViewItem() : x(-1), y(-1), w(0), h(0), indexHint(-1), visited(0xffff) {} inline QListViewItem(const QListViewItem &other) : x(other.x), y(other.y), w(other.w), h(other.h), indexHint(other.indexHint), visited(other.visited) {} inline QListViewItem(QRect r, int i) : x(r.x()), y(r.y()), w(qMin(r.width(), SHRT_MAX)), h(qMin(r.height(), SHRT_MAX)), indexHint(i), visited(0xffff) {} inline bool operator==(const QListViewItem &other) const { return (x == other.x && y == other.y && w == other.w && h == other.h && indexHint == other.indexHint); } inline bool operator!=(const QListViewItem &other) const { return !(*this == other); } inline bool isValid() const { return (x > -1) && (y > -1) && (w > 0) && (h > 0) && (indexHint > -1); } inline void invalidate() { x = -1; y = -1; w = 0; h = 0; } inline void resize(const QSize &size) { w = qMin(size.width(), SHRT_MAX); h = qMin(size.height(), SHRT_MAX); } inline void move(const QPoint &position) { x = position.x(); y = position.y(); } inline int width() const { return w; } inline int height() const { return h; }private: inline QRect rect() const { return QRect(x, y, w, h); } int x, y; short w, h; mutable int indexHint; uint visited;};struct QListViewLayoutInfo{ QRect bounds; QSize grid; int spacing; int first; int last; bool wrap; QListView::Flow flow; int max;};class QListView;class QListViewPrivate;class QCommonListViewBase{public: inline QCommonListViewBase(QListView *q, QListViewPrivate *d) : dd(d), qq(q) {} inline int spacing() const; inline bool isWrapping() const; inline QSize gridSize() const; inline QListView::Flow flow() const; inline QListView::Movement movement() const; inline QPoint offset() const; inline QPoint pressedPosition() const; inline bool uniformItemSizes() const; inline int column() const; inline int verticalScrollBarValue() const; inline int horizontalScrollBarValue() const; inline QListView::ScrollMode verticalScrollMode() const; inline QListView::ScrollMode horizontalScrollMode() const; inline QModelIndex modelIndex(int row) const; inline int rowCount() const; inline QStyleOptionViewItemV3 viewOptions() const; inline QWidget *viewport() const; inline QRect clipRect() const; inline QSize cachedItemSize() const; inline QRect viewItemRect(const QListViewItem &item) const; inline QSize itemSize(const QStyleOptionViewItemV2 &opt, const QModelIndex &idx) const; inline QAbstractItemDelegate *delegate(const QModelIndex &idx) const; inline bool isHidden(int row) const; inline int hiddenCount() const; inline void clearIntersections() const; inline void appendToIntersections(const QModelIndex &idx) const; inline bool isRightToLeft() const; QListViewPrivate *dd; QListView *qq;};// ### rename to QListModeViewBaseclass QStaticListViewBase : public QCommonListViewBase{ friend class QListViewPrivate;public: QStaticListViewBase(QListView *q, QListViewPrivate *d) : QCommonListViewBase(q, d), batchStartRow(0), batchSavedDeltaSeg(0), batchSavedPosition(0) {} QVector<int> flowPositions; QVector<int> segmentPositions; QVector<int> segmentStartRows; QVector<int> segmentExtents; QSize contentsSize; // used when laying out in batches int batchStartRow; int batchSavedDeltaSeg; int batchSavedPosition; bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max); QPoint initStaticLayout(const QListViewLayoutInfo &info); void doStaticLayout(const QListViewLayoutInfo &info); void intersectingStaticSet(const QRect &area) const; int itemIndex(const QListViewItem &item) const; int perItemScrollingPageSteps(int length, int bounds, bool wrap, int itemExtent) const; int perItemScrollToValue(int index, int value, int height, QAbstractItemView::ScrollHint hint, Qt::Orientation orientation, bool wrap, int extent) const; QRect mapToViewport(const QRect &rect) const; QListViewItem indexToListViewItem(const QModelIndex &index) const; void scrollContentsBy(int &dx, int &dy); int verticalPerItemValue(int itemIndex, int verticalValue, int areaHeight, bool above, bool below, bool wrap, QListView::ScrollHint hint, int itemHeight) const; int horizontalPerItemValue(int itemIndex, int horizontalValue, int areaWidth, bool leftOf, bool rightOf, bool wrap, QListView::ScrollHint hint, int itemWidth) const; void clear();};// ### rename to QIconModeViewBaseclass QDynamicListViewBase : public QCommonListViewBase{ friend class QListViewPrivate;public: QDynamicListViewBase(QListView *q, QListViewPrivate *d) : QCommonListViewBase(q, d), batchStartRow(0), batchSavedDeltaSeg(0) {}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -