OpenCoverage

qquickdesignersupportproperties.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/designer/qquickdesignersupportproperties.cpp
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 QtQuick 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#include "qquickdesignersupportproperties_p.h"-
41-
42#include "qqmldesignermetaobject_p.h"-
43#include "qquickdesignercustomobjectdata_p.h"-
44-
45QT_BEGIN_NAMESPACE-
46-
47static void addToPropertyNameListIfNotBlackListed(QQuickDesignerSupport::PropertyNameList *propertyNameList,-
48 const QQuickDesignerSupport::PropertyName &propertyName)-
49{-
50 if (!QQuickDesignerSupportProperties::isPropertyBlackListed(propertyName))
!QQuickDesigne...(propertyName)Description
TRUEevaluated 240 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
8-240
51 propertyNameList->append(propertyName);
executed 240 times by 1 test: propertyNameList->append(propertyName);
Executed by:
  • tst_qquickdesignersupport
240
52}
executed 248 times by 1 test: end of block
Executed by:
  • tst_qquickdesignersupport
248
53-
54void QQuickDesignerSupportProperties::createNewDynamicProperty(QObject *object, QQmlEngine *engine, const QString &name)-
55{-
56 QQmlDesignerMetaObject::getNodeInstanceMetaObject(object, engine)->createNewDynamicProperty(name);-
57}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickdesignersupport
2
58-
59void QQuickDesignerSupportProperties::registerNodeInstanceMetaObject(QObject *object, QQmlEngine *engine)-
60{-
61 // we just create one and the ownership goes automatically to the object in nodeinstance see init method-
62 QQmlDesignerMetaObject::getNodeInstanceMetaObject(object, engine);-
63}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickdesignersupport
4
64-
65bool QQuickDesignerSupportProperties::hasFullImplementedListInterface(const QQmlListReference &list)-
66{-
67 return list.isValid() && list.canCount() && list.canAt() && list.canAppend() && list.canClear();
never executed: return list.isValid() && list.canCount() && list.canAt() && list.canAppend() && list.canClear();
0
68}-
69-
70void QQuickDesignerSupportProperties::registerCustomData(QObject *object)-
71{-
72 QQuickDesignerCustomObjectData::registerData(object);-
73}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickdesignersupport
4
74-
75QVariant QQuickDesignerSupportProperties::getResetValue(QObject *object, const QQuickDesignerSupport::PropertyName &propertyName)-
76{-
77 return QQuickDesignerCustomObjectData::getResetValue(object, propertyName);
executed 8 times by 1 test: return QQuickDesignerCustomObjectData::getResetValue(object, propertyName);
Executed by:
  • tst_qquickdesignersupport
8
78}-
79-
80void QQuickDesignerSupportProperties::doResetProperty(QObject *object, QQmlContext *context, const QQuickDesignerSupport::PropertyName &propertyName)-
81{-
82 QQuickDesignerCustomObjectData::doResetProperty(object, context, propertyName);-
83}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickdesignersupport
8
84-
85bool QQuickDesignerSupportProperties::hasValidResetBinding(QObject *object, const QQuickDesignerSupport::PropertyName &propertyName)-
86{-
87 return QQuickDesignerCustomObjectData::hasValidResetBinding(object, propertyName);
executed 2 times by 1 test: return QQuickDesignerCustomObjectData::hasValidResetBinding(object, propertyName);
Executed by:
  • tst_qquickdesignersupport
2
88}-
89-
90bool QQuickDesignerSupportProperties::hasBindingForProperty(QObject *object,-
91 QQmlContext *context,-
92 const QQuickDesignerSupport::PropertyName &propertyName,-
93 bool *hasChanged)-
94{-
95 return QQuickDesignerCustomObjectData::hasBindingForProperty(object, context, propertyName, hasChanged);
executed 12 times by 1 test: return QQuickDesignerCustomObjectData::hasBindingForProperty(object, context, propertyName, hasChanged);
Executed by:
  • tst_qquickdesignersupport
12
96}-
97-
98void QQuickDesignerSupportProperties::setPropertyBinding(QObject *object,-
99 QQmlContext *context,-
100 const QQuickDesignerSupport::PropertyName &propertyName,-
101 const QString &expression)-
102{-
103 QQuickDesignerCustomObjectData::setPropertyBinding(object, context, propertyName, expression);-
104}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickdesignersupport
4
105-
106void QQuickDesignerSupportProperties::keepBindingFromGettingDeleted(QObject *object,-
107 QQmlContext *context,-
108 const QQuickDesignerSupport::PropertyName &propertyName)-
109{-
110 QQuickDesignerCustomObjectData::keepBindingFromGettingDeleted(object, context, propertyName);-
111}
never executed: end of block
0
112-
113bool QQuickDesignerSupportProperties::isPropertyQObject(const QMetaProperty &metaProperty)-
114{-
115 return QQmlMetaType::isQObject(metaProperty.userType());
executed 4 times by 1 test: return QQmlMetaType::isQObject(metaProperty.userType());
Executed by:
  • tst_qquickdesignersupport
4
116}-
117-
118-
119QObject *QQuickDesignerSupportProperties::readQObjectProperty(const QMetaProperty &metaProperty, QObject *object)-
120{-
121 return QQmlMetaType::toQObject(metaProperty.read(object));
executed 2 times by 1 test: return QQmlMetaType::toQObject(metaProperty.read(object));
Executed by:
  • tst_qquickdesignersupport
2
122}-
123-
124void QQuickDesignerSupportProperties::getPropertyCache(QObject *object, QQmlEngine *engine)-
125{-
126 QQmlEnginePrivate::get(engine)->cache(object->metaObject());-
127}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickdesignersupport
2
128-
129QQuickDesignerSupport::PropertyNameList QQuickDesignerSupportProperties::propertyNameListForWritableProperties(QObject *object,-
130 const QQuickDesignerSupport::PropertyName &baseName,-
131 QObjectList *inspectedObjects)-
132{-
133 QQuickDesignerSupport::PropertyNameList propertyNameList;-
134-
135 QObjectList localObjectList;-
136-
137 if (inspectedObjects == nullptr)
inspectedObjects == nullptrDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
4-24
138 inspectedObjects = &localObjectList;
executed 4 times by 1 test: inspectedObjects = &localObjectList;
Executed by:
  • tst_qquickdesignersupport
4
139-
140-
141 if (inspectedObjects->contains(object))
inspectedObjec...ntains(object)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
4-24
142 return propertyNameList;
executed 4 times by 1 test: return propertyNameList;
Executed by:
  • tst_qquickdesignersupport
4
143-
144 inspectedObjects->append(object);-
145-
146 const QMetaObject *metaObject = object->metaObject();-
147 for (int index = 0; index < metaObject->propertyCount(); ++index) {
index < metaOb...ropertyCount()Description
TRUEevaluated 340 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
24-340
148 QMetaProperty metaProperty = metaObject->property(index);-
149 QQmlProperty declarativeProperty(object, QString::fromUtf8(metaProperty.name()));-
150 if (declarativeProperty.isValid() && !declarativeProperty.isWritable() && declarativeProperty.propertyTypeCategory() == QQmlProperty::Object) {
declarativeProperty.isValid()Description
TRUEevaluated 340 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
FALSEnever evaluated
!declarativePr...y.isWritable()Description
TRUEevaluated 64 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
FALSEevaluated 276 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
declarativePro...operty::ObjectDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
FALSEevaluated 56 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
0-340
151 if (declarativeProperty.name() != QLatin1String("parent")) {
declarativePro...ring("parent")Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
FALSEnever evaluated
0-8
152 QObject *childObject = QQmlMetaType::toQObject(declarativeProperty.read());-
153 if (childObject)
childObjectDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
FALSEnever evaluated
0-8
154 propertyNameList.append(propertyNameListForWritableProperties(childObject,
executed 8 times by 1 test: propertyNameList.append(propertyNameListForWritableProperties(childObject, baseName + QQuickDesignerSupport::PropertyName(metaProperty.name()) + '.', inspectedObjects));
Executed by:
  • tst_qquickdesignersupport
8
155 baseName + QQuickDesignerSupport::PropertyName(metaProperty.name())
executed 8 times by 1 test: propertyNameList.append(propertyNameListForWritableProperties(childObject, baseName + QQuickDesignerSupport::PropertyName(metaProperty.name()) + '.', inspectedObjects));
Executed by:
  • tst_qquickdesignersupport
8
156 + '.', inspectedObjects));
executed 8 times by 1 test: propertyNameList.append(propertyNameListForWritableProperties(childObject, baseName + QQuickDesignerSupport::PropertyName(metaProperty.name()) + '.', inspectedObjects));
Executed by:
  • tst_qquickdesignersupport
8
157 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickdesignersupport
8
158 } else if (QQmlValueTypeFactory::valueType(metaProperty.userType())) {
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickdesignersupport
QQmlValueTypeF...ty.userType())Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
FALSEevaluated 316 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
8-316
159 QQmlValueType *valueType = QQmlValueTypeFactory::valueType(metaProperty.userType());-
160 valueType->setValue(metaProperty.read(object));-
161 propertyNameList.append(propertyNameListForWritableProperties(valueType,-
162 baseName + QQuickDesignerSupport::PropertyName(metaProperty.name())-
163 + '.', inspectedObjects));-
164 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickdesignersupport
16
165-
166 if (metaProperty.isReadable() && metaProperty.isWritable()) {
metaProperty.isReadable()Description
TRUEevaluated 340 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
FALSEnever evaluated
metaProperty.isWritable()Description
TRUEevaluated 248 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
FALSEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
0-340
167 addToPropertyNameListIfNotBlackListed(&propertyNameList,-
168 baseName + QQuickDesignerSupport::PropertyName(metaProperty.name()));-
169 }
executed 248 times by 1 test: end of block
Executed by:
  • tst_qquickdesignersupport
248
170 }
executed 340 times by 1 test: end of block
Executed by:
  • tst_qquickdesignersupport
340
171-
172 return propertyNameList;
executed 24 times by 1 test: return propertyNameList;
Executed by:
  • tst_qquickdesignersupport
24
173}-
174-
175bool QQuickDesignerSupportProperties::isPropertyBlackListed(const QQuickDesignerSupport::PropertyName &propertyName)-
176{-
177 if (propertyName.contains(".") && propertyName.contains("__"))
propertyName.contains(".")Description
TRUEevaluated 156 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
FALSEevaluated 104 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
propertyName.contains("__")Description
TRUEnever evaluated
FALSEevaluated 156 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
0-156
178 return true;
never executed: return true;
0
179-
180 if (propertyName.count(".") > 1)
propertyName.count(".") > 1Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
FALSEevaluated 252 times by 1 test
Evaluated by:
  • tst_qquickdesignersupport
8-252
181 return true;
executed 8 times by 1 test: return true;
Executed by:
  • tst_qquickdesignersupport
8
182-
183 return false;
executed 252 times by 1 test: return false;
Executed by:
  • tst_qquickdesignersupport
252
184}-
185-
186QQuickDesignerSupport::PropertyNameList QQuickDesignerSupportProperties::allPropertyNames(QObject *object,-
187 const QQuickDesignerSupport::PropertyName &baseName,-
188 QObjectList *inspectedObjects)-
189{-
190 QQuickDesignerSupport::PropertyNameList propertyNameList;-
191-
192 QObjectList localObjectList;-
193-
194 if (inspectedObjects == nullptr)
inspectedObjects == nullptrDescription
TRUEnever evaluated
FALSEnever evaluated
0
195 inspectedObjects = &localObjectList;
never executed: inspectedObjects = &localObjectList;
0
196-
197-
198 if (inspectedObjects->contains(object))
inspectedObjec...ntains(object)Description
TRUEnever evaluated
FALSEnever evaluated
0
199 return propertyNameList;
never executed: return propertyNameList;
0
200-
201 inspectedObjects->append(object);-
202-
203-
204 const QMetaObject *metaObject = object->metaObject();-
205-
206 QStringList deferredPropertyNames;-
207 const int namesIndex = metaObject->indexOfClassInfo("DeferredPropertyNames");-
208 if (namesIndex != -1) {
namesIndex != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
209 QMetaClassInfo classInfo = metaObject->classInfo(namesIndex);-
210 deferredPropertyNames = QString::fromUtf8(classInfo.value()).split(QLatin1Char(','));-
211 }
never executed: end of block
0
212-
213 for (int index = 0; index < metaObject->propertyCount(); ++index) {
index < metaOb...ropertyCount()Description
TRUEnever evaluated
FALSEnever evaluated
0
214 QMetaProperty metaProperty = metaObject->property(index);-
215 QQmlProperty declarativeProperty(object, QString::fromUtf8(metaProperty.name()));-
216 if (declarativeProperty.isValid() && declarativeProperty.propertyTypeCategory() == QQmlProperty::Object) {
declarativeProperty.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
declarativePro...operty::ObjectDescription
TRUEnever evaluated
FALSEnever evaluated
0
217 if (declarativeProperty.name() != QLatin1String("parent")
declarativePro...ring("parent")Description
TRUEnever evaluated
FALSEnever evaluated
0
218 && !deferredPropertyNames.contains(declarativeProperty.name())) {
!deferredPrope...operty.name())Description
TRUEnever evaluated
FALSEnever evaluated
0
219 QObject *childObject = QQmlMetaType::toQObject(declarativeProperty.read());-
220 if (childObject)
childObjectDescription
TRUEnever evaluated
FALSEnever evaluated
0
221 propertyNameList.append(allPropertyNames(childObject,
never executed: propertyNameList.append(allPropertyNames(childObject, baseName + QQuickDesignerSupport::PropertyName(metaProperty.name()) + '.', inspectedObjects));
0
222 baseName
never executed: propertyNameList.append(allPropertyNames(childObject, baseName + QQuickDesignerSupport::PropertyName(metaProperty.name()) + '.', inspectedObjects));
0
223 + QQuickDesignerSupport::PropertyName(metaProperty.name())
never executed: propertyNameList.append(allPropertyNames(childObject, baseName + QQuickDesignerSupport::PropertyName(metaProperty.name()) + '.', inspectedObjects));
0
224 + '.', inspectedObjects));
never executed: propertyNameList.append(allPropertyNames(childObject, baseName + QQuickDesignerSupport::PropertyName(metaProperty.name()) + '.', inspectedObjects));
0
225 }
never executed: end of block
0
226 } else if (QQmlValueTypeFactory::valueType(metaProperty.userType())) {
never executed: end of block
QQmlValueTypeF...ty.userType())Description
TRUEnever evaluated
FALSEnever evaluated
0
227 QQmlValueType *valueType = QQmlValueTypeFactory::valueType(metaProperty.userType());-
228 valueType->setValue(metaProperty.read(object));-
229 propertyNameList.append(baseName + QQuickDesignerSupport::PropertyName(metaProperty.name()));-
230 propertyNameList.append(allPropertyNames(valueType,-
231 baseName-
232 + QQuickDesignerSupport::PropertyName(metaProperty.name())-
233 + '.', inspectedObjects));-
234 } else {
never executed: end of block
0
235 addToPropertyNameListIfNotBlackListed(&propertyNameList,-
236 baseName + QQuickDesignerSupport::PropertyName(metaProperty.name()));-
237 }
never executed: end of block
0
238 }-
239-
240 return propertyNameList;
never executed: return propertyNameList;
0
241}-
242-
243-
244QT_END_NAMESPACE-
245-
246-
247-
248-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0