Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickheaderview_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKHEADERVIEW_P_P_H
6#define QQUICKHEADERVIEW_P_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/QAbstractItemModel>
20#include <QtCore/QPointer>
21#include <QtQuick/private/qquicktableview_p_p.h>
22#include <private/qquickheaderview_p.h>
23
25
26class Q_QUICKTEMPLATES2_EXPORT QHeaderDataProxyModel : public QAbstractItemModel
27{
28 Q_OBJECT
29 Q_DISABLE_COPY(QHeaderDataProxyModel)
30 Q_PROPERTY(QAbstractItemModel *sourceModel READ sourceModel)
31public:
32 explicit QHeaderDataProxyModel(QObject *parent = nullptr);
33 ~QHeaderDataProxyModel();
34
35 void setSourceModel(QAbstractItemModel *newSourceModel);
36 QPointer<QAbstractItemModel> sourceModel() const;
37 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
38 QModelIndex parent(const QModelIndex &child) const override;
39 QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
40 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
41 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
42 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
43 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
44 bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
45 QHash<int, QByteArray> roleNames() const override;
46
47 inline QVariant variantValue() const;
48 inline Qt::Orientation orientation() const;
49 inline void setOrientation(Qt::Orientation o);
50
51 QQuickHeaderViewBase *m_headerView = nullptr;
52
53private:
54 inline void connectToModel();
55 inline void disconnectFromModel();
56 QPointer<QAbstractItemModel> m_model = nullptr;
57 Qt::Orientation m_orientation = Qt::Horizontal;
58};
59
61{
62 Q_DECLARE_PUBLIC(QQuickHeaderViewBase)
63public:
66
67 static inline QQuickHeaderViewBasePrivate *get(QQuickHeaderViewBase *q) { return q->d_func(); }
68
69 void init();
70 Qt::Orientation orientation() const;
71 void setOrientation(Qt::Orientation orientation);
72 const QPointer<QQuickItem> delegateItemAt(int row, int col) const;
73 QVariant modelImpl() const override;
74 void setModelImpl(const QVariant &newModel) override;
75 void syncModel() override;
78
79 // QQuickTableViewPrivate interface
80 virtual void initItemCallback(int modelIndex, QObject *item) override;
81
82protected:
92
93 int logicalRowIndex(const int visualIndex) const final;
94 int logicalColumnIndex(const int visualIndex) const final;
95 int visualRowIndex(const int logicalIndex) const final;
96 int visualColumnIndex(const int logicalIndex) const final;
97};
98
100{
101 Q_DECLARE_PUBLIC(QQuickHorizontalHeaderView)
102public:
105
106 bool m_movableColumns = false;
107};
108
110{
111 Q_DECLARE_PUBLIC(QQuickVerticalHeaderView)
112public:
115
116 bool m_movableRows = false;
117};
118
119QT_END_NAMESPACE
120
121#endif // QQUICKHEADERVIEW_P_P_H
QHeaderDataProxyModel is a proxy AbstractItemModel type that maps source model's headerData() to corr...
QVariant modelImpl() const override
int logicalRowIndex(const int visualIndex) const final
int visualColumnIndex(const int logicalIndex) const final
void setModelImpl(const QVariant &newModel) override
Qt::Orientation orientation() const
const QPointer< QQuickItem > delegateItemAt(int row, int col) const
QHeaderDataProxyModel m_headerDataProxyModel
void setOrientation(Qt::Orientation orientation)
int logicalColumnIndex(const int visualIndex) const final
QAbstractItemModel * selectionSourceModel() override
QStack< SectionSize > m_hiddenSectionSizes
virtual void initItemCallback(int modelIndex, QObject *item) override
static QQuickHeaderViewBasePrivate * get(QQuickHeaderViewBase *q)
int visualRowIndex(const int logicalIndex) const final