OpenCoverage

qqmladaptormodel_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/util/qqmladaptormodel_p.h
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQml module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#ifndef QQMLADAPTORMODEL_P_H-
41#define QQMLADAPTORMODEL_P_H-
42-
43//-
44// W A R N I N G-
45// --------------
46//-
47// This file is not part of the Qt API. It exists purely as an-
48// implementation detail. This header file may change from version to-
49// version without notice, or even be removed.-
50//-
51// We mean it.-
52//-
53-
54#include <QtCore/qabstractitemmodel.h>-
55-
56#include "private/qqmllistaccessor_p.h"-
57-
58#include <private/qqmlguard_p.h>-
59#include <private/qqmlnullablevalue_p.h>-
60-
61QT_REQUIRE_CONFIG(qml_delegate_model);-
62-
63QT_BEGIN_NAMESPACE-
64-
65class QQmlEngine;-
66-
67class QQmlDelegateModel;-
68class QQmlDelegateModelItem;-
69class QQmlDelegateModelItemMetaType;-
70-
71class QQmlAdaptorModel : public QQmlStrongJSQObjectReference<QObject>-
72{-
73public:-
74 class Accessors-
75 {-
76 public:-
77 inline Accessors() {}-
78 virtual ~Accessors();-
79 virtual int rowCount(const QQmlAdaptorModel &) const { return 0; }
executed 1444 times by 12 tests: return 0;
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmlinstantiator
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickshortcut
  • tst_qquicktableview
  • tst_qquickvisualdatamodel
  • tst_qtqmlmodules
1444
80 virtual int columnCount(const QQmlAdaptorModel &) const { return 0; }
executed 102 times by 1 test: return 0;
Executed by:
  • tst_qquicktableview
102
81 virtual void cleanup(QQmlAdaptorModel &, QQmlDelegateModel * = nullptr) const {}-
82-
83 virtual QVariant value(const QQmlAdaptorModel &, int, const QString &) const {-
84 return QVariant(); }
never executed: return QVariant();
0
85-
86 virtual QQmlDelegateModelItem *createItem(-
87 QQmlAdaptorModel &,-
88 QQmlDelegateModelItemMetaType *,-
89 int) const { return nullptr; }
never executed: return nullptr;
0
90-
91 virtual bool notify(-
92 const QQmlAdaptorModel &,-
93 const QList<QQmlDelegateModelItem *> &,-
94 int,-
95 int,-
96 const QVector<int> &) const { return false; }
never executed: return false;
0
97 virtual void replaceWatchedRoles(-
98 QQmlAdaptorModel &,-
99 const QList<QByteArray> &,-
100 const QList<QByteArray> &) const {}-
101 virtual QVariant parentModelIndex(const QQmlAdaptorModel &) const {-
102 return QVariant(); }
never executed: return QVariant();
0
103 virtual QVariant modelIndex(const QQmlAdaptorModel &, int) const {-
104 return QVariant(); }
never executed: return QVariant();
0
105 virtual bool canFetchMore(const QQmlAdaptorModel &) const { return false; }
executed 3446 times by 24 tests: return false;
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qqmlecmascript
  • tst_qqmlinstantiator
  • tst_qqmlqt
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquickitemparticle
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickshortcut
  • tst_qquicktableview
  • tst_qquickvisualdatamodel
  • tst_qtqmlmodules
  • tst_scenegraph
3446
106 virtual void fetchMore(QQmlAdaptorModel &) const {}-
107 };-
108-
109 const Accessors *accessors;-
110 QPersistentModelIndex rootIndex;-
111 QQmlListAccessor list;-
112-
113 QQmlAdaptorModel();-
114 ~QQmlAdaptorModel();-
115-
116 inline QVariant model() const { return list.list(); }
executed 8 times by 1 test: return list.list();
Executed by:
  • tst_qquicklistview
8
117 void setModel(const QVariant &variant, QQmlDelegateModel *vdm, QQmlEngine *engine);-
118 void invalidateModel(QQmlDelegateModel *vdm);-
119-
120 bool isValid() const;-
121 int count() const;-
122 int rowCount() const;-
123 int columnCount() const;-
124 int rowAt(int index) const;-
125 int columnAt(int index) const;-
126 int indexAt(int row, int column) const;-
127-
128 inline QAbstractItemModel *aim() { return static_cast<QAbstractItemModel *>(object()); }
executed 243663 times by 12 tests: return static_cast<QAbstractItemModel *>(object());
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
243663
129 inline const QAbstractItemModel *aim() const { return static_cast<const QAbstractItemModel *>(object()); }
executed 278257 times by 12 tests: return static_cast<const QAbstractItemModel *>(object());
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
278257
130-
131 inline QVariant value(int index, const QString &role) const {-
132 return accessors->value(*this, index, role); }
executed 7412 times by 4 tests: return accessors->value(*this, index, role);
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickvisualdatamodel
7412
133 inline QQmlDelegateModelItem *createItem(QQmlDelegateModelItemMetaType *metaType, int index) {-
134 return accessors->createItem(*this, metaType, index); }
executed 88455 times by 25 tests: return accessors->createItem(*this, metaType, index);
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qqmlecmascript
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qqmlqt
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquickitem2
  • tst_qquickitemparticle
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickshortcut
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
  • tst_scenegraph
88455
135 inline bool hasProxyObject() const {-
136 return list.type() == QQmlListAccessor::Instance || list.type() == QQmlListAccessor::ListProperty; }
executed 88407 times by 25 tests: return list.type() == QQmlListAccessor::Instance || list.type() == QQmlListAccessor::ListProperty;
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qqmlecmascript
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qqmlqt
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquickitem2
  • tst_qquickitemparticle
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickshortcut
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
  • tst_scenegraph
88407
137-
138 inline bool notify(-
139 const QList<QQmlDelegateModelItem *> &items,-
140 int index,-
141 int count,-
142 const QVector<int> &roles) const {-
143 return accessors->notify(*this, items, index, count, roles); }
executed 494 times by 5 tests: return accessors->notify(*this, items, index, count, roles);
Executed by:
  • tst_qqmllistmodel
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
494
144 inline void replaceWatchedRoles(-
145 const QList<QByteArray> &oldRoles, const QList<QByteArray> &newRoles) {-
146 accessors->replaceWatchedRoles(*this, oldRoles, newRoles); }
executed 7078 times by 25 tests: end of block
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qqmlecmascript
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qqmlqt
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquickitem2
  • tst_qquickitemparticle
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickshortcut
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
  • tst_scenegraph
7078
147-
148 inline QVariant modelIndex(int index) const { return accessors->modelIndex(*this, index); }
executed 6 times by 2 tests: return accessors->modelIndex(*this, index);
Executed by:
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
6
149 inline QVariant parentModelIndex() const { return accessors->parentModelIndex(*this); }
executed 2 times by 1 test: return accessors->parentModelIndex(*this);
Executed by:
  • tst_qquickvisualdatamodel
2
150 inline bool canFetchMore() const { return accessors->canFetchMore(*this); }
executed 14959 times by 27 tests: return accessors->canFetchMore(*this);
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qqmlecmascript
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qqmlqt
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquickitem2
  • tst_qquickitemparticle
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickshortcut
  • tst_qquickspringanimation
  • tst_qquicktableview
  • tst_qquickvisualdatamodel
  • ...
14959
151 inline void fetchMore() { return accessors->fetchMore(*this); }
executed 18 times by 1 test: return accessors->fetchMore(*this);
Executed by:
  • tst_qquicklistview
18
152-
153protected:-
154 void objectDestroyed(QObject *) override;-
155};-
156-
157class QQmlAdaptorModelProxyInterface-
158{-
159public:-
160 virtual ~QQmlAdaptorModelProxyInterface() {}-
161-
162 virtual QObject *proxiedObject() = 0;-
163};-
164-
165#define QQmlAdaptorModelProxyInterface_iid "org.qt-project.Qt.QQmlAdaptorModelProxyInterface"-
166-
167Q_DECLARE_INTERFACE(QQmlAdaptorModelProxyInterface, QQmlAdaptorModelProxyInterface_iid)-
168-
169QT_END_NAMESPACE-
170-
171#endif-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0