summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-08-25 00:16:32 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-08-25 00:16:32 (GMT)
commitf9ef0e9ec1cd253beb1c0f06d2dae130e1bfa5cb (patch)
treeff501c3cd91cfb8a26605a1356ed291f6d44a564 /src/declarative
parent243862b66bdfd9a6cdcaf7d588670e6cc93da447 (diff)
parent13fd16e67500e77b8cda34de448cb89ca38a5dab (diff)
downloadQt-f9ef0e9ec1cd253beb1c0f06d2dae130e1bfa5cb.zip
Qt-f9ef0e9ec1cd253beb1c0f06d2dae130e1bfa5cb.tar.gz
Qt-f9ef0e9ec1cd253beb1c0f06d2dae130e1bfa5cb.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/fx/qfxitem.cpp19
-rw-r--r--src/declarative/fx/qfxitem.h1
-rw-r--r--src/declarative/fx/qfxlistview.cpp7
-rw-r--r--src/declarative/qml/qmldom.cpp135
-rw-r--r--src/declarative/qml/qmldom.h13
5 files changed, 22 insertions, 153 deletions
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index ee8228a..772449e 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -799,7 +799,6 @@ private:
};
static const SigMap sigMap[];
- static QHash<QObject*, QFxKeysAttached*> attachedProperties;
friend class QFxItem;
};
@@ -833,8 +832,6 @@ const QFxKeysAttached::SigMap QFxKeysAttached::sigMap[] = {
{ 0, 0 }
};
-QHash<QObject*, QFxKeysAttached*> QFxKeysAttached::attachedProperties;
-
bool QFxKeysAttachedPrivate::isConnected(const char *signalName)
{
return isSignalConnected(signalIndex(signalName));
@@ -891,10 +888,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<QFxItem*>(obj);
+ if (item) {
+ rv = item->keyHandler();
+ if (!rv)
+ rv = new QFxKeysAttached(obj);
}
return rv;
}
@@ -1518,6 +1517,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;
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;
}
diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp
index bc35f93..2aaf492 100644
--- a/src/declarative/qml/qmldom.cpp
+++ b/src/declarative/qml/qmldom.cpp
@@ -76,15 +76,11 @@ 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 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.
@@ -136,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<QmlDomImport> QmlDomDocument::imports() const
@@ -157,7 +144,7 @@ QList<QmlDomImport> 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)
{
@@ -224,17 +211,6 @@ QList<QmlError> 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.
@@ -417,15 +393,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 +656,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 +770,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 +829,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<QmlDomDynamicProperty> QmlDomObject::dynamicProperties() const
{
QList<QmlDomDynamicProperty> properties;
@@ -950,18 +880,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 +1034,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 +1095,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 +1174,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 +1551,6 @@ QList<QmlDomValue> QmlDomList::values() const
}
/*!
- Set the list of QmlDomValue's to \a values.
-*/
-void QmlDomList::setValues(const QList<QmlDomValue> &values)
-{
- Q_UNUSED(values);
- qWarning("QmlDomList::setValues(const QList<QmlDomValue> &): Not implemented");
-}
-
-/*!
Returns the position in the input data where the list started, or -1 if
the property is invalid.
*/
@@ -1793,16 +1676,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..f344bb2 100644
--- a/src/declarative/qml/qmldom.h
+++ b/src/declarative/qml/qmldom.h
@@ -72,12 +72,10 @@ public:
~QmlDomDocument();
QmlDomDocument &operator=(const QmlDomDocument &);
- int version() const;
QList<QmlDomImport> imports() const;
QList<QmlError> errors() const;
bool load(QmlEngine *, const QByteArray &, const QUrl & = QUrl());
- QByteArray save() const;
QmlDomObject rootObject() const;
@@ -100,7 +98,6 @@ public:
bool isDefaultProperty() const;
QmlDomValue value() const;
- void setValue(const QmlDomValue &);
int position() const;
int length() const;
@@ -156,20 +153,15 @@ public:
int objectTypeMinorVersion() const;
QString objectId() const;
- void setObjectId(const QByteArray &);
QList<QmlDomProperty> properties() const;
QmlDomProperty property(const QByteArray &) const;
- void removeProperty(const QByteArray &);
- void addProperty(const QByteArray &, const QmlDomValue &);
-
QList<QmlDomDynamicProperty> 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 +189,6 @@ public:
QmlDomValueLiteral &operator=(const QmlDomValueLiteral &);
QString literal() const;
- void setLiteral(const QString &);
private:
friend class QmlDomValue;
@@ -213,7 +204,6 @@ public:
QmlDomValueBinding &operator=(const QmlDomValueBinding &);
QString binding() const;
- void setBinding(const QString &);
private:
friend class QmlDomValue;
@@ -229,7 +219,6 @@ public:
QmlDomValueValueSource &operator=(const QmlDomValueValueSource &);
QmlDomObject object() const;
- void setObject(const QmlDomObject &);
private:
friend class QmlDomValue;
@@ -245,7 +234,6 @@ public:
QmlDomComponent &operator=(const QmlDomComponent &);
QmlDomObject componentRoot() const;
- void setComponentRoot(const QmlDomObject &);
};
class Q_DECLARATIVE_EXPORT QmlDomValue
@@ -298,7 +286,6 @@ public:
QmlDomList &operator=(const QmlDomList &);
QList<QmlDomValue> values() const;
- void setValues(const QList<QmlDomValue> &);
int position() const;
int length() const;