1// Copyright (C) 2016 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 QABSTRACTPROXYMODEL_P_H
5#define QABSTRACTPROXYMODEL_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 for the convenience
12// of QAbstractItemModel*. This header file may change from version
13// to version without notice, or even be removed.
14//
15// We mean it.
16//
17//
18
19#include "private/qabstractitemmodel_p.h"
20#include "private/qproperty_p.h"
21
22QT_REQUIRE_CONFIG(proxymodel);
23
24QT_BEGIN_NAMESPACE
25
26class Q_CORE_EXPORT QAbstractProxyModelPrivate : public QAbstractItemModelPrivate
27{
28 Q_DECLARE_PUBLIC(QAbstractProxyModel)
29public:
30 QAbstractProxyModelPrivate()
31 : QAbstractItemModelPrivate(),
32 sourceHadZeroRows(false),
33 sourceHadZeroColumns(false)
34 {}
35 void setModelForwarder(QAbstractItemModel *sourceModel)
36 {
37 q_func()->setSourceModel(sourceModel);
38 }
39 void modelChangedForwarder()
40 {
41 Q_EMIT q_func()->sourceModelChanged(QAbstractProxyModel::QPrivateSignal());
42 }
43 QAbstractItemModel *getModelForwarder() const { return q_func()->sourceModel(); }
44
45 Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QAbstractProxyModelPrivate, QAbstractItemModel *, model,
46 &QAbstractProxyModelPrivate::setModelForwarder,
47 &QAbstractProxyModelPrivate::modelChangedForwarder,
48 &QAbstractProxyModelPrivate::getModelForwarder, nullptr)
49 virtual void _q_sourceModelDestroyed();
50 void _q_sourceModelRowsAboutToBeInserted(const QModelIndex &parent, int first, int last);
51 void _q_sourceModelRowsInserted(const QModelIndex &parent, int first, int last);
52 void _q_sourceModelRowsRemoved(const QModelIndex &parent, int first, int last);
53 void _q_sourceModelColumnsAboutToBeInserted(const QModelIndex &parent, int first, int last);
54 void _q_sourceModelColumnsInserted(const QModelIndex &parent, int first, int last);
55 void _q_sourceModelColumnsRemoved(const QModelIndex &parent, int first, int last);
56
57 void mapDropCoordinatesToSource(int row, int column, const QModelIndex &parent,
58 int *source_row, int *source_column, QModelIndex *source_parent) const;
59
60 unsigned int sourceHadZeroRows : 1;
61 unsigned int sourceHadZeroColumns : 1;
62};
63
64QT_END_NAMESPACE
65
66#endif // QABSTRACTPROXYMODEL_P_H
67

source code of qtbase/src/corelib/itemmodels/qabstractproxymodel_p.h