| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/designer/qquickdesignercustomobjectdata.cpp | 
| Source code | Switch to Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 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 "qquickdesignersupportmetainfo_p.h" | - | ||||||||||||||||||
| 41 | #include "qquickdesignersupportproperties_p.h" | - | ||||||||||||||||||
| 42 | - | |||||||||||||||||||
| 43 | #include "qquickdesignercustomobjectdata_p.h" | - | ||||||||||||||||||
| 44 | - | |||||||||||||||||||
| 45 | #include <QGlobalStatic> | - | ||||||||||||||||||
| 46 | #include <QQmlContext> | - | ||||||||||||||||||
| 47 | #include <QQmlEngine> | - | ||||||||||||||||||
| 48 | - | |||||||||||||||||||
| 49 | #include <private/qqmlbinding_p.h> | - | ||||||||||||||||||
| 50 | - | |||||||||||||||||||
| 51 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
| 52 | - | |||||||||||||||||||
| 53 | typedef QHash<QObject*, QQuickDesignerCustomObjectData*> CustomObjectDataHash; | - | ||||||||||||||||||
| 54 | Q_GLOBAL_STATIC(CustomObjectDataHash, s_designerObjectToDataHash) executed 2 times by 1 test:  end of blockExecuted by: 
 executed 2 times by 1 test:  guard.store(QtGlobalStatic::Destroyed);Executed by: 
 executed 42 times by 1 test:  return &holder.value;Executed by: 
 
 | 0-42 | ||||||||||||||||||
| 55 | - | |||||||||||||||||||
| 56 | struct HandleDestroyedFunctor { | - | ||||||||||||||||||
| 57 | QQuickDesignerCustomObjectData *data; | - | ||||||||||||||||||
| 58 | void operator()() { data->handleDestroyed(); } executed 4 times by 1 test:  end of blockExecuted by: 
 | 4 | ||||||||||||||||||
| 59 | }; | - | ||||||||||||||||||
| 60 | - | |||||||||||||||||||
| 61 | QQuickDesignerCustomObjectData::QQuickDesignerCustomObjectData(QObject *object) | - | ||||||||||||||||||
| 62 | : m_object(object) | - | ||||||||||||||||||
| 63 | { | - | ||||||||||||||||||
| 64 | if (object) { 
 | 0-4 | ||||||||||||||||||
| 65 | populateResetHashes(); | - | ||||||||||||||||||
| 66 | s_designerObjectToDataHash()->insert(object, this); | - | ||||||||||||||||||
| 67 | - | |||||||||||||||||||
| 68 | HandleDestroyedFunctor functor; | - | ||||||||||||||||||
| 69 | functor.data = this; | - | ||||||||||||||||||
| 70 | QObject::connect(object, &QObject::destroyed, functor); | - | ||||||||||||||||||
| 71 | } executed 4 times by 1 test:  end of blockExecuted by: 
 | 4 | ||||||||||||||||||
| 72 | } executed 4 times by 1 test:  end of blockExecuted by: 
 | 4 | ||||||||||||||||||
| 73 | - | |||||||||||||||||||
| 74 | void QQuickDesignerCustomObjectData::registerData(QObject *object) | - | ||||||||||||||||||
| 75 | { | - | ||||||||||||||||||
| 76 | new QQuickDesignerCustomObjectData(object); | - | ||||||||||||||||||
| 77 | } executed 4 times by 1 test:  end of blockExecuted by: 
 | 4 | ||||||||||||||||||
| 78 | - | |||||||||||||||||||
| 79 | QQuickDesignerCustomObjectData *QQuickDesignerCustomObjectData::get(QObject *object) | - | ||||||||||||||||||
| 80 | { | - | ||||||||||||||||||
| 81 | return s_designerObjectToDataHash()->value(object); executed 34 times by 1 test:  return s_designerObjectToDataHash()->value(object);Executed by: 
 | 34 | ||||||||||||||||||
| 82 | } | - | ||||||||||||||||||
| 83 | - | |||||||||||||||||||
| 84 | QVariant QQuickDesignerCustomObjectData::getResetValue(QObject *object, const QQuickDesignerSupport::PropertyName &propertyName) | - | ||||||||||||||||||
| 85 | { | - | ||||||||||||||||||
| 86 | QQuickDesignerCustomObjectData* data = get(object); | - | ||||||||||||||||||
| 87 | - | |||||||||||||||||||
| 88 | if (data) 
 | 4 | ||||||||||||||||||
| 89 | return data->getResetValue(propertyName); executed 4 times by 1 test:  return data->getResetValue(propertyName);Executed by: 
 | 4 | ||||||||||||||||||
| 90 | - | |||||||||||||||||||
| 91 | return QVariant(); executed 4 times by 1 test:  return QVariant();Executed by: 
 | 4 | ||||||||||||||||||
| 92 | } | - | ||||||||||||||||||
| 93 | - | |||||||||||||||||||
| 94 | void QQuickDesignerCustomObjectData::doResetProperty(QObject *object, QQmlContext *context, const QQuickDesignerSupport::PropertyName &propertyName) | - | ||||||||||||||||||
| 95 | { | - | ||||||||||||||||||
| 96 | QQuickDesignerCustomObjectData* data = get(object); | - | ||||||||||||||||||
| 97 | - | |||||||||||||||||||
| 98 | if (data) 
 | 0-8 | ||||||||||||||||||
| 99 | data->doResetProperty(context, propertyName); executed 8 times by 1 test:  data->doResetProperty(context, propertyName);Executed by: 
 | 8 | ||||||||||||||||||
| 100 | } executed 8 times by 1 test:  end of blockExecuted by: 
 | 8 | ||||||||||||||||||
| 101 | - | |||||||||||||||||||
| 102 | bool QQuickDesignerCustomObjectData::hasValidResetBinding(QObject *object, const QQuickDesignerSupport::PropertyName &propertyName) | - | ||||||||||||||||||
| 103 | { | - | ||||||||||||||||||
| 104 | QQuickDesignerCustomObjectData* data = get(object); | - | ||||||||||||||||||
| 105 | - | |||||||||||||||||||
| 106 | if (data) 
 | 0-2 | ||||||||||||||||||
| 107 | return data->hasValidResetBinding(propertyName); executed 2 times by 1 test:  return data->hasValidResetBinding(propertyName);Executed by: 
 | 2 | ||||||||||||||||||
| 108 | - | |||||||||||||||||||
| 109 | return false; never executed:  return false; | 0 | ||||||||||||||||||
| 110 | } | - | ||||||||||||||||||
| 111 | - | |||||||||||||||||||
| 112 | bool QQuickDesignerCustomObjectData::hasBindingForProperty(QObject *object, | - | ||||||||||||||||||
| 113 | QQmlContext *context, | - | ||||||||||||||||||
| 114 | const QQuickDesignerSupport::PropertyName &propertyName, | - | ||||||||||||||||||
| 115 | bool *hasChanged) | - | ||||||||||||||||||
| 116 | { | - | ||||||||||||||||||
| 117 | QQuickDesignerCustomObjectData* data = get(object); | - | ||||||||||||||||||
| 118 | - | |||||||||||||||||||
| 119 | if (data) 
 | 0-12 | ||||||||||||||||||
| 120 | return data->hasBindingForProperty(context, propertyName, hasChanged); executed 12 times by 1 test:  return data->hasBindingForProperty(context, propertyName, hasChanged);Executed by: 
 | 12 | ||||||||||||||||||
| 121 | - | |||||||||||||||||||
| 122 | return false; never executed:  return false; | 0 | ||||||||||||||||||
| 123 | } | - | ||||||||||||||||||
| 124 | - | |||||||||||||||||||
| 125 | void QQuickDesignerCustomObjectData::setPropertyBinding(QObject *object, | - | ||||||||||||||||||
| 126 | QQmlContext *context, | - | ||||||||||||||||||
| 127 | const QQuickDesignerSupport::PropertyName &propertyName, | - | ||||||||||||||||||
| 128 | const QString &expression) | - | ||||||||||||||||||
| 129 | { | - | ||||||||||||||||||
| 130 | QQuickDesignerCustomObjectData* data = get(object); | - | ||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | if (data) 
 | 0-4 | ||||||||||||||||||
| 133 | data->setPropertyBinding(context, propertyName, expression); executed 4 times by 1 test:  data->setPropertyBinding(context, propertyName, expression);Executed by: 
 | 4 | ||||||||||||||||||
| 134 | } executed 4 times by 1 test:  end of blockExecuted by: 
 | 4 | ||||||||||||||||||
| 135 | - | |||||||||||||||||||
| 136 | void QQuickDesignerCustomObjectData::keepBindingFromGettingDeleted(QObject *object, | - | ||||||||||||||||||
| 137 | QQmlContext *context, | - | ||||||||||||||||||
| 138 | const QQuickDesignerSupport::PropertyName &propertyName) | - | ||||||||||||||||||
| 139 | { | - | ||||||||||||||||||
| 140 | QQuickDesignerCustomObjectData* data = get(object); | - | ||||||||||||||||||
| 141 | - | |||||||||||||||||||
| 142 | if (data) 
 | 0 | ||||||||||||||||||
| 143 | data->keepBindingFromGettingDeleted(context, propertyName); never executed:  data->keepBindingFromGettingDeleted(context, propertyName); | 0 | ||||||||||||||||||
| 144 | } never executed:  end of block | 0 | ||||||||||||||||||
| 145 | - | |||||||||||||||||||
| 146 | void QQuickDesignerCustomObjectData::populateResetHashes() | - | ||||||||||||||||||
| 147 | { | - | ||||||||||||||||||
| 148 | const QQuickDesignerSupport::PropertyNameList propertyNameList = | - | ||||||||||||||||||
| 149 | QQuickDesignerSupportProperties::propertyNameListForWritableProperties(object()); | - | ||||||||||||||||||
| 150 | - | |||||||||||||||||||
| 151 | const QMetaObject *mo = object()->metaObject(); | - | ||||||||||||||||||
| 152 | QByteArrayList deferredPropertyNames; | - | ||||||||||||||||||
| 153 | const int namesIndex = mo->indexOfClassInfo("DeferredPropertyNames"); | - | ||||||||||||||||||
| 154 | if (namesIndex != -1) { 
 | 0-4 | ||||||||||||||||||
| 155 | QMetaClassInfo classInfo = mo->classInfo(namesIndex); | - | ||||||||||||||||||
| 156 | deferredPropertyNames = QByteArray(classInfo.value()).split(','); | - | ||||||||||||||||||
| 157 | } never executed:  end of block | 0 | ||||||||||||||||||
| 158 | - | |||||||||||||||||||
| 159 | for (const QQuickDesignerSupport::PropertyName &propertyName : propertyNameList) { | - | ||||||||||||||||||
| 160 | - | |||||||||||||||||||
| 161 | if (deferredPropertyNames.contains(propertyName)) 
 | 0-240 | ||||||||||||||||||
| 162 | continue; never executed:  continue; | 0 | ||||||||||||||||||
| 163 | - | |||||||||||||||||||
| 164 | QQmlProperty property(object(), QString::fromUtf8(propertyName), QQmlEngine::contextForObject(object())); | - | ||||||||||||||||||
| 165 | - | |||||||||||||||||||
| 166 | QQmlAbstractBinding::Ptr binding = QQmlAbstractBinding::Ptr(QQmlPropertyPrivate::binding(property)); | - | ||||||||||||||||||
| 167 | - | |||||||||||||||||||
| 168 | if (binding) { 
 | 2-238 | ||||||||||||||||||
| 169 | m_resetBindingHash.insert(propertyName, binding); | - | ||||||||||||||||||
| 170 | } else if (property.isWritable()) { executed 2 times by 1 test:  end of blockExecuted by: 
 
 | 2-214 | ||||||||||||||||||
| 171 | m_resetValueHash.insert(propertyName, property.read()); | - | ||||||||||||||||||
| 172 | } executed 214 times by 1 test:  end of blockExecuted by: 
 | 214 | ||||||||||||||||||
| 173 | } executed 240 times by 1 test:  end of blockExecuted by: 
 | 240 | ||||||||||||||||||
| 174 | } executed 4 times by 1 test:  end of blockExecuted by: 
 | 4 | ||||||||||||||||||
| 175 | - | |||||||||||||||||||
| 176 | QObject *QQuickDesignerCustomObjectData::object() const | - | ||||||||||||||||||
| 177 | { | - | ||||||||||||||||||
| 178 | return m_object; executed 516 times by 1 test:  return m_object;Executed by: 
 | 516 | ||||||||||||||||||
| 179 | } | - | ||||||||||||||||||
| 180 | - | |||||||||||||||||||
| 181 | QVariant QQuickDesignerCustomObjectData::getResetValue(const QQuickDesignerSupport::PropertyName &propertyName) const | - | ||||||||||||||||||
| 182 | { | - | ||||||||||||||||||
| 183 | return m_resetValueHash.value(propertyName); executed 4 times by 1 test:  return m_resetValueHash.value(propertyName);Executed by: 
 | 4 | ||||||||||||||||||
| 184 | } | - | ||||||||||||||||||
| 185 | - | |||||||||||||||||||
| 186 | void QQuickDesignerCustomObjectData::doResetProperty(QQmlContext *context, const QQuickDesignerSupport::PropertyName &propertyName) | - | ||||||||||||||||||
| 187 | { | - | ||||||||||||||||||
| 188 | QQmlProperty property(object(), QString::fromUtf8(propertyName), context); | - | ||||||||||||||||||
| 189 | - | |||||||||||||||||||
| 190 | if (!property.isValid()) 
 | 0-8 | ||||||||||||||||||
| 191 | return; never executed:  return; | 0 | ||||||||||||||||||
| 192 | - | |||||||||||||||||||
| 193 | QQmlAbstractBinding *binding = QQmlPropertyPrivate::binding(property); | - | ||||||||||||||||||
| 194 | if (binding && !(hasValidResetBinding(propertyName) && getResetBinding(propertyName) == binding)) { 
 
 
 | 0-4 | ||||||||||||||||||
| 195 | binding->setEnabled(false, nullptr); | - | ||||||||||||||||||
| 196 | } executed 4 times by 1 test:  end of blockExecuted by: 
 | 4 | ||||||||||||||||||
| 197 | - | |||||||||||||||||||
| 198 | - | |||||||||||||||||||
| 199 | if (hasValidResetBinding(propertyName)) { 
 | 4 | ||||||||||||||||||
| 200 | QQmlAbstractBinding *binding = getResetBinding(propertyName); | - | ||||||||||||||||||
| 201 | - | |||||||||||||||||||
| 202 | #if defined(QT_NO_DYNAMIC_CAST) | - | ||||||||||||||||||
| 203 | QQmlBinding *qmlBinding = static_cast<QQmlBinding*>(binding); | - | ||||||||||||||||||
| 204 | #else | - | ||||||||||||||||||
| 205 | QQmlBinding *qmlBinding = dynamic_cast<QQmlBinding*>(binding); | - | ||||||||||||||||||
| 206 | #endif | - | ||||||||||||||||||
| 207 | if (qmlBinding) 
 | 0-4 | ||||||||||||||||||
| 208 | qmlBinding->setTarget(property); executed 4 times by 1 test:  qmlBinding->setTarget(property);Executed by: 
 | 4 | ||||||||||||||||||
| 209 | QQmlPropertyPrivate::setBinding(binding, QQmlPropertyPrivate::None, QQmlPropertyData::DontRemoveBinding); | - | ||||||||||||||||||
| 210 | if (qmlBinding) 
 | 0-4 | ||||||||||||||||||
| 211 | qmlBinding->update(); executed 4 times by 1 test:  qmlBinding->update();Executed by: 
 | 4 | ||||||||||||||||||
| 212 | - | |||||||||||||||||||
| 213 | } else if (property.isResettable()) { executed 4 times by 1 test:  end of blockExecuted by: 
 
 | 0-4 | ||||||||||||||||||
| 214 | property.reset(); | - | ||||||||||||||||||
| 215 | } else if (property.propertyTypeCategory() == QQmlProperty::List) { executed 4 times by 1 test:  end of blockExecuted by: 
 
 | 0-4 | ||||||||||||||||||
| 216 | QQmlListReference list = qvariant_cast<QQmlListReference>(property.read()); | - | ||||||||||||||||||
| 217 | - | |||||||||||||||||||
| 218 | if (!QQuickDesignerSupportProperties::hasFullImplementedListInterface(list)) { 
 | 0 | ||||||||||||||||||
| 219 | qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!"; | - | ||||||||||||||||||
| 220 | return; never executed:  return; | 0 | ||||||||||||||||||
| 221 | } | - | ||||||||||||||||||
| 222 | - | |||||||||||||||||||
| 223 | list.clear(); | - | ||||||||||||||||||
| 224 | } else if (property.isWritable()) { never executed:  end of block
 | 0 | ||||||||||||||||||
| 225 | if (property.read() == getResetValue(propertyName)) 
 | 0 | ||||||||||||||||||
| 226 | return; never executed:  return; | 0 | ||||||||||||||||||
| 227 | - | |||||||||||||||||||
| 228 | property.write(getResetValue(propertyName)); | - | ||||||||||||||||||
| 229 | } never executed:  end of block | 0 | ||||||||||||||||||
| 230 | } executed 8 times by 1 test:  end of blockExecuted by: 
 | 8 | ||||||||||||||||||
| 231 | - | |||||||||||||||||||
| 232 | bool QQuickDesignerCustomObjectData::hasValidResetBinding(const QQuickDesignerSupport::PropertyName &propertyName) const | - | ||||||||||||||||||
| 233 | { | - | ||||||||||||||||||
| 234 | return m_resetBindingHash.contains(propertyName) &&  m_resetBindingHash.value(propertyName).data(); executed 14 times by 1 test:  return m_resetBindingHash.contains(propertyName) && m_resetBindingHash.value(propertyName).data();Executed by: 
 | 14 | ||||||||||||||||||
| 235 | } | - | ||||||||||||||||||
| 236 | - | |||||||||||||||||||
| 237 | QQmlAbstractBinding *QQuickDesignerCustomObjectData::getResetBinding(const QQuickDesignerSupport::PropertyName &propertyName) const | - | ||||||||||||||||||
| 238 | { | - | ||||||||||||||||||
| 239 | return m_resetBindingHash.value(propertyName).data(); executed 6 times by 1 test:  return m_resetBindingHash.value(propertyName).data();Executed by: 
 | 6 | ||||||||||||||||||
| 240 | } | - | ||||||||||||||||||
| 241 | - | |||||||||||||||||||
| 242 | bool QQuickDesignerCustomObjectData::hasBindingForProperty(QQmlContext *context, | - | ||||||||||||||||||
| 243 | const QQuickDesignerSupport::PropertyName &propertyName, | - | ||||||||||||||||||
| 244 | bool *hasChanged) const | - | ||||||||||||||||||
| 245 | { | - | ||||||||||||||||||
| 246 | if (QQuickDesignerSupportProperties::isPropertyBlackListed(propertyName)) 
 | 0-12 | ||||||||||||||||||
| 247 | return false; never executed:  return false; | 0 | ||||||||||||||||||
| 248 | - | |||||||||||||||||||
| 249 | QQmlProperty property(object(), QString::fromUtf8(propertyName), context); | - | ||||||||||||||||||
| 250 | - | |||||||||||||||||||
| 251 | bool hasBinding = QQmlPropertyPrivate::binding(property); | - | ||||||||||||||||||
| 252 | - | |||||||||||||||||||
| 253 | if (hasChanged) { 
 | 0-12 | ||||||||||||||||||
| 254 | *hasChanged = hasBinding != m_hasBindingHash.value(propertyName, false); | - | ||||||||||||||||||
| 255 | if (*hasChanged) 
 | 0 | ||||||||||||||||||
| 256 | m_hasBindingHash.insert(propertyName, hasBinding); never executed:  m_hasBindingHash.insert(propertyName, hasBinding); | 0 | ||||||||||||||||||
| 257 | } never executed:  end of block | 0 | ||||||||||||||||||
| 258 | - | |||||||||||||||||||
| 259 | return QQmlPropertyPrivate::binding(property); executed 12 times by 1 test:  return QQmlPropertyPrivate::binding(property);Executed by: 
 | 12 | ||||||||||||||||||
| 260 | } | - | ||||||||||||||||||
| 261 | - | |||||||||||||||||||
| 262 | void QQuickDesignerCustomObjectData::setPropertyBinding(QQmlContext *context, | - | ||||||||||||||||||
| 263 | const QQuickDesignerSupport::PropertyName &propertyName, | - | ||||||||||||||||||
| 264 | const QString &expression) | - | ||||||||||||||||||
| 265 | { | - | ||||||||||||||||||
| 266 | QQmlProperty property(object(), QString::fromUtf8(propertyName), context); | - | ||||||||||||||||||
| 267 | - | |||||||||||||||||||
| 268 | if (!property.isValid()) 
 | 0-4 | ||||||||||||||||||
| 269 | return; never executed:  return; | 0 | ||||||||||||||||||
| 270 | - | |||||||||||||||||||
| 271 | if (property.isProperty()) { 
 | 0-4 | ||||||||||||||||||
| 272 | QQmlBinding *binding = QQmlBinding::create(&QQmlPropertyPrivate::get(property)->core, | - | ||||||||||||||||||
| 273 | expression, object(), QQmlContextData::get(context)); | - | ||||||||||||||||||
| 274 | binding->setTarget(property); | - | ||||||||||||||||||
| 275 | binding->setNotifyOnValueChanged(true); | - | ||||||||||||||||||
| 276 | - | |||||||||||||||||||
| 277 | QQmlPropertyPrivate::setBinding(binding, QQmlPropertyPrivate::None, QQmlPropertyData::DontRemoveBinding); | - | ||||||||||||||||||
| 278 | //Refcounting is taking take care of deletion | - | ||||||||||||||||||
| 279 | binding->update(); | - | ||||||||||||||||||
| 280 | if (binding->hasError()) { 
 | 0-4 | ||||||||||||||||||
| 281 | if (property.property().userType() == QVariant::String) 
 | 0 | ||||||||||||||||||
| 282 | property.write(QVariant(QLatin1Char('#') + expression + QLatin1Char('#'))); never executed:  property.write(QVariant(QLatin1Char('#') + expression + QLatin1Char('#'))); | 0 | ||||||||||||||||||
| 283 | } never executed:  end of block | 0 | ||||||||||||||||||
| 284 | - | |||||||||||||||||||
| 285 | } else { executed 4 times by 1 test:  end of blockExecuted by: 
 | 4 | ||||||||||||||||||
| 286 | qWarning() << Q_FUNC_INFO << ": Cannot set binding for property" << propertyName << ": property is unknown for type"; | - | ||||||||||||||||||
| 287 | } never executed:  end of block | 0 | ||||||||||||||||||
| 288 | } | - | ||||||||||||||||||
| 289 | - | |||||||||||||||||||
| 290 | void QQuickDesignerCustomObjectData::keepBindingFromGettingDeleted(QQmlContext *context, | - | ||||||||||||||||||
| 291 | const QQuickDesignerSupport::PropertyName &propertyName) | - | ||||||||||||||||||
| 292 | { | - | ||||||||||||||||||
| 293 | //Refcounting is taking care | - | ||||||||||||||||||
| 294 | Q_UNUSED(context) | - | ||||||||||||||||||
| 295 | Q_UNUSED(propertyName) | - | ||||||||||||||||||
| 296 | } never executed:  end of block | 0 | ||||||||||||||||||
| 297 | - | |||||||||||||||||||
| 298 | void QQuickDesignerCustomObjectData::handleDestroyed() | - | ||||||||||||||||||
| 299 | { | - | ||||||||||||||||||
| 300 | s_designerObjectToDataHash()->remove(m_object); | - | ||||||||||||||||||
| 301 | delete this; | - | ||||||||||||||||||
| 302 | } executed 4 times by 1 test:  end of blockExecuted by: 
 | 4 | ||||||||||||||||||
| 303 | - | |||||||||||||||||||
| 304 | QT_END_NAMESPACE | - | ||||||||||||||||||
| 305 | - | |||||||||||||||||||
| Source code | Switch to Preprocessed file |