From b2102b848f1f6075c10b60d8de1ee531f0eddd30 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 24 Aug 2009 11:44:48 +0200 Subject: Remove setter from QmlDom classes All methods modifying the object dom were removed. Change was discussed with Aaron. --- src/declarative/qml/qmldom.cpp | 110 +---------------------------------------- src/declarative/qml/qmldom.h | 11 ----- 2 files changed, 2 insertions(+), 119 deletions(-) diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index bc35f93..dca6bb9 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -80,11 +80,8 @@ QmlDomDocumentPrivate::~QmlDomDocumentPrivate() QmlDomDocument::version(), and a root object, accessible through QmlDomDocument::rootObject(). - The QmlDomDocument class allows the programmer to load a QML document, by - calling QmlDomDocument::load(), manipulate it and save it to textual form - by calling QmlDomDocument::save(). By using the QML DOM API, editors can - non-destructively modify a QML document even if they only understand a - subset of the total QML functionality. + The QmlDomDocument class allows the programmer to inspect a QML document by + calling QmlDomDocument::load(). The following example loads a QML file from disk, and prints out its root object type and the properties assigned in the root object. @@ -417,15 +414,6 @@ QmlDomValue QmlDomProperty::value() const } /*! - Sets the QmlDomValue that is assigned to this property to \a value. -*/ -void QmlDomProperty::setValue(const QmlDomValue &value) -{ - Q_UNUSED(value); - qWarning("QmlDomProperty::setValue(const QmlDomValue &): Not Implemented"); -} - -/*! Returns the position in the input data where the property ID startd, or -1 if the property is invalid. */ @@ -689,11 +677,6 @@ QGraphicsWidget { "opacity" and "size". Obviously QGraphicsWidget has many more properties than just these two, but the QML DOM representation only contains those assigned values (or bindings) in the QML file. - - The DOM tree can be modified to include new property assignments by calling - QmlDomObject::addProperty(). Existing property assignments can be modified - through the QmlDomProperty::setValue() method, or removed entirely by - calling QmlDomObject::removeProperty(). */ /*! @@ -808,17 +791,6 @@ QString QmlDomObject::objectId() const } /*! - Set the object \a id. If any other object within the DOM tree has the same - id, the other object's id will be cleared. -*/ -void QmlDomObject::setObjectId(const QByteArray &id) -{ - Q_UNUSED(id); - qWarning("QmlDomObject::setObjectId(const QByteArray &): Not implemented"); -} - - -/*! Returns the list of assigned properties on this object. In the following example, "text" and "x" properties would be returned. @@ -878,27 +850,6 @@ QmlDomProperty QmlDomObject::property(const QByteArray &name) const return QmlDomProperty(); } -/*! - Remove the property \a name from this object, if it exists. Otherwise does - nothing. -*/ -void QmlDomObject::removeProperty(const QByteArray &name) -{ - Q_UNUSED(name); - qWarning("QmlDomObject::removeProperty(const QByteArray &): Not implemented"); -} - -/*! - Adds the property \a name with the specified \a value to this object. If - a property by \a name already exists, it will be removed. -*/ -void QmlDomObject::addProperty(const QByteArray &name, const QmlDomValue &value) -{ - Q_UNUSED(name); - Q_UNUSED(value); - qWarning("QmlDomObject::addProperty(const QByteArray &, const QmlDomValue &): Not implemented"); -} - QList QmlDomObject::dynamicProperties() const { QList properties; @@ -950,18 +901,6 @@ bool QmlDomObject::isCustomType() const } /*! - Sets the custom type \a data. If this type is not a custom type, this - method does nothing. - - \sa QmlDomObject::isCustomType() QmlDomObject::customTypeData() -*/ -void QmlDomObject::setCustomTypeData(const QByteArray &data) -{ - Q_UNUSED(data); - qWarning("QmlDomObject::setCustomTypeData(const QByteArray &): Not implemented"); -} - -/*! If this object represents a custom type, returns the data associated with the custom type, otherwise returns an empty QByteArray(). QmlDomObject::isCustomType() can be used to check if this object represents @@ -1116,15 +1055,6 @@ QString QmlDomValueLiteral::literal() const } /*! - Sets the literal \a value. -*/ -void QmlDomValueLiteral::setLiteral(const QString &value) -{ - Q_UNUSED(value); - qWarning("QmlDomValueLiteral::setLiteral(const QString &): Not implemented"); -} - -/*! \class QmlDomValueBinding \internal \brief The QmlDomValueBinding class represents a property binding. @@ -1186,15 +1116,6 @@ QString QmlDomValueBinding::binding() const } /*! - Sets the binding \a expression. -*/ -void QmlDomValueBinding::setBinding(const QString &expression) -{ - Q_UNUSED(expression); - qWarning("QmlDomValueBinding::setBinding(const QString &): Not implemented"); -} - -/*! \class QmlDomValueValueSource \internal \brief The QmlDomValueValueSource class represents a value source assignment value. @@ -1274,14 +1195,6 @@ QmlDomObject QmlDomValueValueSource::object() const return rv; } -/*! - Sets the value source \a object. -*/ -void QmlDomValueValueSource::setObject(const QmlDomObject &object) -{ - Q_UNUSED(object); - qWarning("QmlDomValueValueSource::setObject(const QmlDomObject &): Not implemented"); -} QmlDomValuePrivate::QmlDomValuePrivate() : property(0), value(0) @@ -1659,15 +1572,6 @@ QList QmlDomList::values() const } /*! - Set the list of QmlDomValue's to \a values. -*/ -void QmlDomList::setValues(const QList &values) -{ - Q_UNUSED(values); - qWarning("QmlDomList::setValues(const QList &): Not implemented"); -} - -/*! Returns the position in the input data where the list started, or -1 if the property is invalid. */ @@ -1793,16 +1697,6 @@ QmlDomObject QmlDomComponent::componentRoot() const return rv; } -/*! - Set the component's \a root object. -*/ -void QmlDomComponent::setComponentRoot(const QmlDomObject &root) -{ - Q_UNUSED(root); - qWarning("QmlDomComponent::setComponentRoot(const QmlDomObject &): Not implemented"); -} - - QmlDomImportPrivate::QmlDomImportPrivate() : type(File) { diff --git a/src/declarative/qml/qmldom.h b/src/declarative/qml/qmldom.h index 60e7b38..0366d37 100644 --- a/src/declarative/qml/qmldom.h +++ b/src/declarative/qml/qmldom.h @@ -100,7 +100,6 @@ public: bool isDefaultProperty() const; QmlDomValue value() const; - void setValue(const QmlDomValue &); int position() const; int length() const; @@ -156,20 +155,15 @@ public: int objectTypeMinorVersion() const; QString objectId() const; - void setObjectId(const QByteArray &); QList properties() const; QmlDomProperty property(const QByteArray &) const; - void removeProperty(const QByteArray &); - void addProperty(const QByteArray &, const QmlDomValue &); - QList dynamicProperties() const; QmlDomDynamicProperty dynamicProperty(const QByteArray &) const; bool isCustomType() const; QByteArray customTypeData() const; - void setCustomTypeData(const QByteArray &); bool isComponent() const; QmlDomComponent toComponent() const; @@ -197,7 +191,6 @@ public: QmlDomValueLiteral &operator=(const QmlDomValueLiteral &); QString literal() const; - void setLiteral(const QString &); private: friend class QmlDomValue; @@ -213,7 +206,6 @@ public: QmlDomValueBinding &operator=(const QmlDomValueBinding &); QString binding() const; - void setBinding(const QString &); private: friend class QmlDomValue; @@ -229,7 +221,6 @@ public: QmlDomValueValueSource &operator=(const QmlDomValueValueSource &); QmlDomObject object() const; - void setObject(const QmlDomObject &); private: friend class QmlDomValue; @@ -245,7 +236,6 @@ public: QmlDomComponent &operator=(const QmlDomComponent &); QmlDomObject componentRoot() const; - void setComponentRoot(const QmlDomObject &); }; class Q_DECLARATIVE_EXPORT QmlDomValue @@ -298,7 +288,6 @@ public: QmlDomList &operator=(const QmlDomList &); QList values() const; - void setValues(const QList &); int position() const; int length() const; -- cgit v0.12 From 8c6b5eec52f84ccd76136f0bb4037036943d2a9a Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 24 Aug 2009 11:53:56 +0200 Subject: Remove QmlDomDocument::version Has been superseeded by the versioning/library infrastructure. --- src/declarative/qml/qmldom.cpp | 12 +----------- src/declarative/qml/qmldom.h | 1 - 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index dca6bb9..78cd906 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -76,8 +76,7 @@ QmlDomDocumentPrivate::~QmlDomDocumentPrivate() \brief The QmlDomDocument class represents the root of a QML document A QML document is a self-contained snippet of QML, usually contained in a - single file. Each document has a version number, accessible through - QmlDomDocument::version(), and a root object, accessible through + single file. Each document has a root object, accessible through QmlDomDocument::rootObject(). The QmlDomDocument class allows the programmer to inspect a QML document by @@ -133,15 +132,6 @@ QmlDomDocument &QmlDomDocument::operator=(const QmlDomDocument &other) } /*! - Return the version number of the Qml document. Currently only version - 1 exists. -*/ -int QmlDomDocument::version() const -{ - return 1; -} - -/*! Returns all import statements in qml. */ QList QmlDomDocument::imports() const diff --git a/src/declarative/qml/qmldom.h b/src/declarative/qml/qmldom.h index 0366d37..5c76004 100644 --- a/src/declarative/qml/qmldom.h +++ b/src/declarative/qml/qmldom.h @@ -72,7 +72,6 @@ public: ~QmlDomDocument(); QmlDomDocument &operator=(const QmlDomDocument &); - int version() const; QList imports() const; QList errors() const; -- cgit v0.12 From 9e2114fa326be128b03268865b39ddb2731e0173 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 24 Aug 2009 11:55:35 +0200 Subject: Remove QmlDomDocument::save --- src/declarative/qml/qmldom.cpp | 13 +------------ src/declarative/qml/qmldom.h | 1 - 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index 78cd906..2aaf492 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -144,7 +144,7 @@ QList QmlDomDocument::imports() const data. On success, true is returned. If the \a data is malformed, false is returned and QmlDomDocument::loadError() contains an error description. - \sa QmlDomDocument::save() QmlDomDocument::loadError() + \sa QmlDomDocument::loadError() */ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data, const QUrl &url) { @@ -211,17 +211,6 @@ QList QmlDomDocument::errors() const } /*! - Return a saved copy of the QmlDomDocument. The returned data will be valid - QML XML data. - - \sa load() -*/ -QByteArray QmlDomDocument::save() const -{ - return QByteArray(); -} - -/*! Returns the document's root object, or an invalid QmlDomObject if the document has no root. diff --git a/src/declarative/qml/qmldom.h b/src/declarative/qml/qmldom.h index 5c76004..f344bb2 100644 --- a/src/declarative/qml/qmldom.h +++ b/src/declarative/qml/qmldom.h @@ -76,7 +76,6 @@ public: QList errors() const; bool load(QmlEngine *, const QByteArray &, const QUrl & = QUrl()); - QByteArray save() const; QmlDomObject rootObject() const; -- cgit v0.12 From a33e3d8a7fefc3d2ad254dcb76a127b068b7c63d Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 25 Aug 2009 09:08:47 +1000 Subject: Fix list startPosition calculation. --- src/declarative/fx/qfxlistview.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 8dfe171..59ece18 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -212,8 +212,11 @@ public: qreal startPosition() const { qreal pos = 0; - if (!visibleItems.isEmpty()) - pos = visibleItems.first()->position() - visibleIndex * (averageSize + spacing); + if (!visibleItems.isEmpty()) { + pos = visibleItems.first()->position(); + if (visibleIndex > 0) + pos -= visibleIndex * (averageSize + spacing) - spacing; + } return pos; } -- cgit v0.12 From 13fd16e67500e77b8cda34de448cb89ca38a5dab Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 25 Aug 2009 10:06:37 +1000 Subject: Remove unnecessary KeysAttached static map --- src/declarative/fx/qfxitem.cpp | 19 ++++++++++++------- src/declarative/fx/qfxitem.h | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index feb4e8c..ed2386b 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -704,7 +704,6 @@ private: }; static const SigMap sigMap[]; - static QHash attachedProperties; friend class QFxItem; }; @@ -738,8 +737,6 @@ const QFxKeysAttached::SigMap QFxKeysAttached::sigMap[] = { { 0, 0 } }; -QHash QFxKeysAttached::attachedProperties; - bool QFxKeysAttachedPrivate::isConnected(const char *signalName) { return isSignalConnected(signalIndex(signalName)); @@ -796,10 +793,12 @@ void QFxKeysAttached::keyReleased(QKeyEvent *event) QFxKeysAttached *QFxKeysAttached::qmlAttachedProperties(QObject *obj) { - QFxKeysAttached *rv = attachedProperties.value(obj); - if (!rv) { - rv = new QFxKeysAttached(obj); - attachedProperties.insert(obj, rv); + QFxKeysAttached *rv = 0; + QFxItem *item = qobject_cast(obj); + if (item) { + rv = item->keyHandler(); + if (!rv) + rv = new QFxKeysAttached(obj); } return rv; } @@ -1423,6 +1422,12 @@ void QFxItem::geometryChanged(const QRectF &newGeometry, } } +QFxKeysAttached *QFxItem::keyHandler() +{ + Q_D(QFxItem); + return d->keyHandler; +} + void QFxItem::setKeyHandler(QFxKeysAttached *handler) { Q_D(QFxItem); diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index 89c2cf1..222677c 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -197,6 +197,7 @@ private: QFxAnchorLine verticalCenter() const; QFxAnchorLine baseline() const; + QFxKeysAttached *keyHandler(); void setKeyHandler(QFxKeysAttached *); friend class QmlStatePrivate; -- cgit v0.12