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
4#ifndef QQUICKHEADERVIEW_P_P_H
5#define QQUICKHEADERVIEW_P_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/QAbstractItemModel>
19#include <QtCore/QPointer>
20#include <QtQuick/private/qquicktableview_p_p.h>
21#include <private/qquickheaderview_p.h>
22
24
25class Q_QUICKTEMPLATES2_EXPORT QHeaderDataProxyModel : public QAbstractItemModel
26{
27 Q_OBJECT
28 Q_DISABLE_COPY(QHeaderDataProxyModel)
29 Q_PROPERTY(QAbstractItemModel *sourceModel READ sourceModel)
30public:
31 explicit QHeaderDataProxyModel(QObject *parent = nullptr);
32 ~QHeaderDataProxyModel();
33
34 void setSourceModel(QAbstractItemModel *newSourceModel);
35 QPointer<QAbstractItemModel> sourceModel() const;
36 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
37 QModelIndex parent(const QModelIndex &child) const override;
38 QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
39 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
40 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
41 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
42 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
43 bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
44 QHash<int, QByteArray> roleNames() const override;
45
46 inline QVariant variantValue() const;
47 inline Qt::Orientation orientation() const;
48 inline void setOrientation(Qt::Orientation o);
49
50 QQuickHeaderViewBase *m_headerView = nullptr;
51
52private:
53 inline void connectToModel();
54 inline void disconnectFromModel();
55 QPointer<QAbstractItemModel> m_model = nullptr;
56 Qt::Orientation m_orientation = Qt::Horizontal;
57};
58
60{
61 Q_DECLARE_PUBLIC(QQuickHeaderViewBase)
62public:
65
66 void init();
67 Qt::Orientation orientation() const;
68 void setOrientation(Qt::Orientation orientation);
69 const QPointer<QQuickItem> delegateItemAt(int row, int col) const;
70 QVariant modelImpl() const override;
71 void setModelImpl(const QVariant &newModel) override;
72 void syncModel() override;
75
76protected:
86
87 int logicalRowIndex(const int visualIndex) const final;
88 int logicalColumnIndex(const int visualIndex) const final;
89 int visualRowIndex(const int logicalIndex) const final;
90 int visualColumnIndex(const int logicalIndex) const final;
91};
92
94{
95 Q_DECLARE_PUBLIC(QQuickHorizontalHeaderView)
96public:
99
100 bool m_movableColumns = false;
101};
102
104{
105 Q_DECLARE_PUBLIC(QQuickVerticalHeaderView)
106public:
109
110 bool m_movableRows = false;
111};
112
113QT_END_NAMESPACE
114
115#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
int visualRowIndex(const int logicalIndex) const final