void QQmlQtQuick2DebugStatesDelegate::updateBinding(QQmlContext *context, const QQmlProperty &property, const QVariant &expression, bool isLiteralValue, const QString &fileName, int line, int column, bool *inBaseState) { typedef QPointer<QQuickState> QuickStatePointer; QObject *object = property.object(); QString propertyName = property.name(); foreach (const QuickStatePointer& statePointer, m_allStates) { if (QQuickState *state = statePointer.data()) { // here we assume that the revert list on itself defines the base state if (state->isStateActive() && state->containsPropertyInRevertList(object, propertyName)) { *inBaseState = false; QQmlBinding *newBinding = 0; if (!isLiteralValue) { newBinding = new QQmlBinding(expression.toString(), object, QQmlContextData::get(context), fileName, line, column); newBinding->setTarget(property); newBinding->setNotifyOnValueChanged(true); } state->changeBindingInRevertList(object, propertyName, newBinding); if (isLiteralValue) state->changeValueInRevertList(object, propertyName, expression); } } } }
/*! \internal */ void ApplicationSettings::handleProperty(const QQmlProperty& qmlProperty, bool overwrite) { // Validate property for this application settings if(!qmlProperty.isValid() || qmlProperty.propertyType() == QVariant::Invalid) return; // Skip applicationName and fileName if(qmlProperty.name() == "applicationName" || qmlProperty.name() == "fileName") return; //Don't persist class properties (only user defined ones) if(m_existingProperties->contains(qmlProperty.name())) return; QVariant v = value(qmlProperty.name()); // Add notification handler QmlPropertyWrapper* wrapper = new QmlPropertyWrapper(qmlProperty); m_userProperties->append(wrapper); if(!m_initialized) { connect(wrapper, SIGNAL(notifySignal(QmlPropertyWrapper*)), this, SLOT(qmlPropertyLookup(QmlPropertyWrapper*))); }
static void removeObjectFromList(const QQmlProperty &property, QObject *objectToBeRemoved, QQmlEngine * engine) { QQmlListReference listReference(property.object(), property.name().toUtf8(), engine); if (!QmlPrivateGate::hasFullImplementedListInterface(listReference)) { qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!"; return; } int count = listReference.count(); QObjectList objectList; for (int i = 0; i < count; i ++) { QObject *listItem = listReference.at(i); if (listItem && listItem != objectToBeRemoved) objectList.append(listItem); } listReference.clear(); foreach (QObject *object, objectList) listReference.append(object); }
void ObjectNodeInstance::deleteObjectsInList(const QQmlProperty &property) { QObjectList objectList; QQmlListReference list = qvariant_cast<QQmlListReference>(property.read()); if (!QmlPrivateGate::hasFullImplementedListInterface(list)) { qWarning() << "Property list interface not fully implemented for Class " << property.property().typeName() << " in property " << property.name() << "!"; return; } for (int i = 0; i < list.count(); i++) { objectList += list.at(i); } list.clear(); }