diff options
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsanchors.cpp | 12 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsanchors_p.h | 4 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h | 4 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsitem_p.h | 3 | ||||
-rw-r--r-- | src/declarative/qml/qmlbasicscript.cpp | 17 | ||||
-rw-r--r-- | src/declarative/qml/qmlbasicscript_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlbindingoptimizations.cpp | 71 | ||||
-rw-r--r-- | src/declarative/qml/qmlbindingoptimizations_p.h | 26 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 21 | ||||
-rw-r--r-- | src/declarative/qml/qmlinstruction.cpp | 3 | ||||
-rw-r--r-- | src/declarative/qml/qmlinstruction_p.h | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmlvme.cpp | 19 |
12 files changed, 9 insertions, 174 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp index c2e1fa2..ddf2a3b 100644 --- a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,Anchors,QmlGraphicsAnchors) +QML_DEFINE_NOCREATE_TYPE(QmlGraphicsAnchors) //TODO: should we cache relationships, so we don't have to check each time (parent-child or sibling)? //TODO: support non-parent, non-sibling (need to find lowest common ancestor) @@ -131,8 +131,8 @@ static qreal adjustedPosition(QmlGraphicsItem *item, QmlGraphicsAnchorLine::Anch \warning Currently, only anchoring to siblings or parent is supported. */ -QmlGraphicsAnchors::QmlGraphicsAnchors(QObject *parent) - : QObject(*new QmlGraphicsAnchorsPrivate(), parent) +QmlGraphicsAnchors::QmlGraphicsAnchors(QmlGraphicsItem *item, QObject *parent) + : QObject(*new QmlGraphicsAnchorsPrivate(item), parent) { } @@ -980,12 +980,6 @@ QmlGraphicsAnchors::UsedAnchors QmlGraphicsAnchors::usedAnchors() const return d->usedAnchors; } -void QmlGraphicsAnchors::setItem(QmlGraphicsItem *item) -{ - Q_D(QmlGraphicsAnchors); - d->item = item; -} - bool QmlGraphicsAnchorsPrivate::checkHValid() const { if (usedAnchors & QmlGraphicsAnchors::HasLeftAnchor && diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors_p.h b/src/declarative/graphicsitems/qmlgraphicsanchors_p.h index a67a9f8..dc6a7a8 100644 --- a/src/declarative/graphicsitems/qmlgraphicsanchors_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsanchors_p.h @@ -79,7 +79,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsAnchors : public QObject Q_PROPERTY(QmlGraphicsItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged) public: - QmlGraphicsAnchors(QObject *parent=0); + QmlGraphicsAnchors(QmlGraphicsItem *item, QObject *parent=0); virtual ~QmlGraphicsAnchors(); enum UsedAnchor { @@ -157,8 +157,6 @@ public: UsedAnchors usedAnchors() const; - void setItem(QmlGraphicsItem *item); - void classBegin(); void componentComplete(); diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h b/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h index 45c983f..5b02158 100644 --- a/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h @@ -95,9 +95,9 @@ class QmlGraphicsAnchorsPrivate : public QObjectPrivate, public QmlGraphicsItemC { Q_DECLARE_PUBLIC(QmlGraphicsAnchors) public: - QmlGraphicsAnchorsPrivate() + QmlGraphicsAnchorsPrivate(QmlGraphicsItem *i) : updatingMe(false), updatingHorizontalAnchor(0), - updatingVerticalAnchor(0), updatingFill(0), updatingCenterIn(0), item(0), usedAnchors(0), fill(0), + updatingVerticalAnchor(0), updatingFill(0), updatingCenterIn(0), item(i), usedAnchors(0), fill(0), centerIn(0), leftMargin(0), rightMargin(0), topMargin(0), bottomMargin(0), margins(0), vCenterOffset(0), hCenterOffset(0), baselineOffset(0), componentComplete(true) diff --git a/src/declarative/graphicsitems/qmlgraphicsitem_p.h b/src/declarative/graphicsitems/qmlgraphicsitem_p.h index d5dbe1d..ca850f3 100644 --- a/src/declarative/graphicsitems/qmlgraphicsitem_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsitem_p.h @@ -173,8 +173,7 @@ public: QmlGraphicsAnchors *anchors() { if (!_anchors) { Q_Q(QmlGraphicsItem); - _anchors = new QmlGraphicsAnchors; - _anchors->setItem(q); + _anchors = new QmlGraphicsAnchors(q); if (!_componentComplete) _anchors->classBegin(); } diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp index b596437..ebdd348 100644 --- a/src/declarative/qml/qmlbasicscript.cpp +++ b/src/declarative/qml/qmlbasicscript.cpp @@ -737,23 +737,6 @@ int QmlBasicScript::singleIdFetchIndex() const return d->instructions()[0].fetch.idx; } -bool QmlBasicScript::isSingleContextProperty() const -{ - if (!isValid()) - return false; - - return d->instructionCount == 1 && - d->instructions()[0].type == ScriptInstruction::FetchContextConstant; -} - -int QmlBasicScript::singleContextPropertyIndex() const -{ - if (!isSingleContextProperty()) - return -1; - - return d->instructions()[0].constant.idx; -} - /*! Return a pointer to the script's compile data, or null if there is no data. */ diff --git a/src/declarative/qml/qmlbasicscript_p.h b/src/declarative/qml/qmlbasicscript_p.h index 3af09c2..c4b436d 100644 --- a/src/declarative/qml/qmlbasicscript_p.h +++ b/src/declarative/qml/qmlbasicscript_p.h @@ -104,8 +104,6 @@ public: bool isSingleIdFetch() const; int singleIdFetchIndex() const; - bool isSingleContextProperty() const; - int singleContextPropertyIndex() const; private: int flags; QmlBasicScriptPrivate *d; diff --git a/src/declarative/qml/qmlbindingoptimizations.cpp b/src/declarative/qml/qmlbindingoptimizations.cpp index d8a2de0..d7105b2 100644 --- a/src/declarative/qml/qmlbindingoptimizations.cpp +++ b/src/declarative/qml/qmlbindingoptimizations.cpp @@ -255,75 +255,4 @@ void QmlBinding_Id::reset() m_propertyIdx, a); } -/* - The QmlBinding_ObjectProperty optimization handles expressions of the type: - - property: objectProperty - - where both property and objectProperty are object properties on the target - object. Coercian between the two must be checked outside the - QmlBinding_ObjectProperty - it assumes that they coerce successfully. - - Due to dot properties, property does not have to be on the same object as - objectProperty. For example: - - anchors.fill: parent -*/ -QmlBinding_ObjProperty::QmlBinding_ObjProperty(QObject *object, int propertyIdx, - QObject *context, int contextIdx, - int notifyIdx) -: m_enabled(false), m_object(object), m_propertyIdx(propertyIdx), - m_context(context), m_contextIdx(contextIdx), m_notifyIdx(notifyIdx) -{ -} - -void QmlBinding_ObjProperty::setEnabled(bool e, QmlMetaProperty::WriteFlags flags) -{ - m_enabled = e; - if (e) { - addToObject(m_object); - update(flags); - } else { - removeFromObject(); - } - - QmlAbstractBinding::setEnabled(e, flags); -} - -int QmlBinding_ObjProperty::propertyIndex() -{ - return m_propertyIdx; -} - -void QmlBinding_ObjProperty::update(QmlMetaProperty::WriteFlags flags) -{ - if (!m_enabled) - return; - - QObject *value = 0; - int status = -1; - void *ra[] = { &value, 0, &status }; - - // Read - QMetaObject::metacall(m_context, QMetaObject::ReadProperty, - m_contextIdx, ra); - - void *wa[] = { &value, 0, &status, &flags }; - - // Write - QMetaObject::metacall(m_object, QMetaObject::WriteProperty, - m_propertyIdx, wa); - - // Connect notify if needed. Only need to connect once, so we set - // m_notifyIdx back to -1 afterwards - static int slotIdx = -1; - if (m_notifyIdx != -1) { - if (slotIdx == -1) - slotIdx = QmlBinding_ObjProperty::staticMetaObject.indexOfMethod("update()"); - - QMetaObject::connect(m_context, m_notifyIdx, this, slotIdx); - m_notifyIdx = -1; - } -} - QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlbindingoptimizations_p.h b/src/declarative/qml/qmlbindingoptimizations_p.h index 6289cc0..feb753e 100644 --- a/src/declarative/qml/qmlbindingoptimizations_p.h +++ b/src/declarative/qml/qmlbindingoptimizations_p.h @@ -128,32 +128,6 @@ private: int m_id; }; -class QmlBinding_ObjProperty : public QObject, - public QmlAbstractExpression, - public QmlAbstractBinding -{ - Q_OBJECT -public: - QmlBinding_ObjProperty(QObject *object, int propertyIdx, - QObject *context, int contextIdx, int notifyIdx); - - // Inherited from QmlAbstractBinding - virtual void setEnabled(bool, QmlMetaProperty::WriteFlags flags); - virtual int propertyIndex(); - virtual void update(QmlMetaProperty::WriteFlags flags); - -private Q_SLOTS: - void update() { update(QmlMetaProperty::DontRemoveBinding); } - -private: - bool m_enabled; - QObject *m_object; - int m_propertyIdx; - QObject *m_context; - int m_contextIdx; - int m_notifyIdx; -}; - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 3ebefea..7f11a23 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -2545,24 +2545,7 @@ void QmlCompiler::genBindingAssignment(QmlParser::Value *binding, output->bytecode << store; return; } - } else if (bs.isSingleContextProperty()) { - int propIndex = bs.singleContextPropertyIndex(); - - QMetaProperty p = - ref.bindingContext.object->metaObject()->property(propIndex); - if ((p.notifySignalIndex() != -1 || p.isConstant()) && - canCoerce(prop->type, p.userType())) { - - store.type = QmlInstruction::StoreObjPropBinding; - store.assignObjPropBinding.property = prop->index; - store.assignObjPropBinding.contextIdx = propIndex; - store.assignObjPropBinding.context = ref.bindingContext.stack; - store.assignObjPropBinding.notifyIdx = p.notifySignalIndex(); - - output->bytecode << store; - return; - } - } + } store.type = QmlInstruction::StoreBinding; store.assignBinding.value = output->indexForByteArray(ref.compiledData); @@ -2634,7 +2617,7 @@ bool QmlCompiler::completeComponentBuild() bs.compile(expr); - if (qmlExperimental() && (!bs.isValid() || (!bs.isSingleIdFetch() && !bs.isSingleContextProperty()))) { + if (qmlExperimental() && (!bs.isValid() || !bs.isSingleIdFetch())) { int index = bindingCompiler.compile(expr, QmlEnginePrivate::get(engine)); if (index != -1) { qWarning() << "Accepted for optimization:" << qPrintable(expr.expression.asScript()); diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp index c873803..2ddad49 100644 --- a/src/declarative/qml/qmlinstruction.cpp +++ b/src/declarative/qml/qmlinstruction.cpp @@ -164,9 +164,6 @@ void QmlCompiledData::dump(QmlInstruction *instr, int idx) case QmlInstruction::StoreIdOptBinding: qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_ID_OPT_BINDING\t" << instr->assignIdOptBinding.property << "\t" << instr->assignIdOptBinding.id; break; - case QmlInstruction::StoreObjPropBinding: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJ_PROP_BINDING\t" << instr->assignObjPropBinding.property << "\t" << instr->assignObjPropBinding.contextIdx << "\t" << instr->assignObjPropBinding.context << "\t" << instr->assignObjPropBinding.notifyIdx; - break; case QmlInstruction::StoreValueSource: qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VALUE_SOURCE\t" << instr->assignValueSource.property << "\t" << instr->assignValueSource.castValue; break; diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h index 6e2b452..44fa196 100644 --- a/src/declarative/qml/qmlinstruction_p.h +++ b/src/declarative/qml/qmlinstruction_p.h @@ -130,7 +130,6 @@ public: StoreBinding, /* assignBinding */ StoreCompiledBinding, /* assignBinding */ StoreIdOptBinding, /* assignIdOptBinding */ - StoreObjPropBinding, /* assignObjPropBinding */ StoreValueSource, /* assignValueSource */ StoreValueInterceptor, /* assignValueInterceptor */ diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index f1abd7d..06795a8 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -644,25 +644,6 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt, } break; - case QmlInstruction::StoreObjPropBinding: - { - int coreIndex = instr.assignObjPropBinding.property; - if (stack.count() == 1 && bindingSkipList.testBit(coreIndex)) - break; - - QObject *target = stack.top(); - QObject *context = - stack.at(stack.count() - 1 - instr.assignObjPropBinding.context); - - QmlBinding_ObjProperty *bind = - new QmlBinding_ObjProperty(target, instr.assignObjPropBinding.property, context, instr.assignObjPropBinding.contextIdx, instr.assignObjPropBinding.notifyIdx); - - bindValues.append(bind); - bind->m_mePtr = &bindValues.values[bindValues.count - 1]; - bind->addToObject(target); - } - break; - case QmlInstruction::StoreValueSource: { QObject *obj = stack.pop(); |