summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-10-13 05:57:53 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-10-13 05:57:53 (GMT)
commit1db61e89cb96022a6f5bffdc698f1f4dd4400b68 (patch)
treeebf3bc47c76a507b1718ccc27db9ec6c7572c6bf /src/declarative
parente10635d099ff09ae5a0ceff10b56d4f3c19f59f4 (diff)
parent81142c25f01738dea784144fb2f186cb563cc2bd (diff)
downloadQt-1db61e89cb96022a6f5bffdc698f1f4dd4400b68.zip
Qt-1db61e89cb96022a6f5bffdc698f1f4dd4400b68.tar.gz
Qt-1db61e89cb96022a6f5bffdc698f1f4dd4400b68.tar.bz2
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts: src/declarative/qml/qmlinfo.cpp
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/QmlChanges.txt28
-rw-r--r--src/declarative/debugger/qmldebug.cpp2
-rw-r--r--src/declarative/debugger/qmldebugservice.cpp2
-rw-r--r--src/declarative/extra/qbindablemap.cpp8
-rw-r--r--src/declarative/extra/qfxparticles.cpp1
-rw-r--r--src/declarative/extra/qmlbehavior.cpp161
-rw-r--r--src/declarative/extra/qmlbehavior.h22
-rw-r--r--src/declarative/extra/qmlxmllistmodel.cpp4
-rw-r--r--src/declarative/fx/fx.pri1
-rw-r--r--src/declarative/fx/qfxanchors.cpp30
-rw-r--r--src/declarative/fx/qfxeffects.cpp238
-rw-r--r--src/declarative/fx/qfxflipable.cpp4
-rw-r--r--src/declarative/fx/qfxitem.cpp24
-rw-r--r--src/declarative/fx/qfxpathview.cpp2
-rw-r--r--src/declarative/fx/qfxtextinput.cpp6
-rw-r--r--src/declarative/fx/qfxvisualitemmodel.cpp18
-rw-r--r--src/declarative/fx/qfxwebview.cpp7
-rw-r--r--src/declarative/qml/parser/qmljs.g11
-rw-r--r--src/declarative/qml/parser/qmljsengine_p.cpp2
-rw-r--r--src/declarative/qml/parser/qmljsgrammar.cpp32
-rw-r--r--src/declarative/qml/parser/qmljsgrammar_p.h32
-rw-r--r--src/declarative/qml/parser/qmljslexer.cpp31
-rw-r--r--src/declarative/qml/parser/qmljsparser.cpp11
-rw-r--r--src/declarative/qml/qml.pri2
-rw-r--r--src/declarative/qml/qmlbasicscript.cpp8
-rw-r--r--src/declarative/qml/qmlbinding.cpp23
-rw-r--r--src/declarative/qml/qmlbinding.h12
-rw-r--r--src/declarative/qml/qmlbindingoptimizations.cpp32
-rw-r--r--src/declarative/qml/qmlbindingoptimizations_p.h9
-rw-r--r--src/declarative/qml/qmlcompileddata.cpp4
-rw-r--r--src/declarative/qml/qmlcompiler.cpp272
-rw-r--r--src/declarative/qml/qmlcompiler_p.h8
-rw-r--r--src/declarative/qml/qmlcomponent.cpp2
-rw-r--r--src/declarative/qml/qmlcompositetypemanager.cpp8
-rw-r--r--src/declarative/qml/qmlengine.cpp16
-rw-r--r--src/declarative/qml/qmlenginedebug.cpp4
-rw-r--r--src/declarative/qml/qmlexpression.cpp2
-rw-r--r--src/declarative/qml/qmlinfo.cpp57
-rw-r--r--src/declarative/qml/qmlinfo.h12
-rw-r--r--src/declarative/qml/qmlinstruction.cpp3
-rw-r--r--src/declarative/qml/qmlinstruction_p.h6
-rw-r--r--src/declarative/qml/qmlintegercache.cpp2
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp114
-rw-r--r--src/declarative/qml/qmlmetaproperty.h9
-rw-r--r--src/declarative/qml/qmlmetaproperty_p.h11
-rw-r--r--src/declarative/qml/qmlmetatype.cpp29
-rw-r--r--src/declarative/qml/qmlmetatype.h14
-rw-r--r--src/declarative/qml/qmlobjectscriptclass.cpp2
-rw-r--r--src/declarative/qml/qmlparser.cpp3
-rw-r--r--src/declarative/qml/qmlparser_p.h2
-rw-r--r--src/declarative/qml/qmlpropertycache.cpp10
-rw-r--r--src/declarative/qml/qmlpropertyvalueinterceptor.cpp77
-rw-r--r--src/declarative/qml/qmlpropertyvalueinterceptor.h68
-rw-r--r--src/declarative/qml/qmlscriptparser.cpp19
-rw-r--r--src/declarative/qml/qmltypenamescriptclass.cpp4
-rw-r--r--src/declarative/qml/qmlvaluetype.cpp40
-rw-r--r--src/declarative/qml/qmlvaluetype_p.h19
-rw-r--r--src/declarative/qml/qmlvaluetypescriptclass.cpp2
-rw-r--r--src/declarative/qml/qmlvme.cpp117
-rw-r--r--src/declarative/qml/qmlvmemetaobject.cpp53
-rw-r--r--src/declarative/qml/qmlvmemetaobject_p.h4
-rw-r--r--src/declarative/qml/qmlxmlhttprequest.cpp6
-rw-r--r--src/declarative/util/qmlanimation.cpp48
-rw-r--r--src/declarative/util/qmlconnection.cpp4
-rw-r--r--src/declarative/util/qmllistmodel.cpp8
-rw-r--r--src/declarative/util/qmlpropertychanges.cpp25
-rw-r--r--src/declarative/util/qmlstate.cpp4
-rw-r--r--src/declarative/util/qmltimer.cpp2
-rw-r--r--src/declarative/util/qmltransitionmanager.cpp11
69 files changed, 1168 insertions, 696 deletions
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt
index ee5acd4..6a6c394 100644
--- a/src/declarative/QmlChanges.txt
+++ b/src/declarative/QmlChanges.txt
@@ -1,10 +1,9 @@
QML API Review
==============
-The QML API is being reviewed from 17 to 4 September 2009. This
-file documents the changes. Note that the changes are incremental,
-so a rename A->B for example may be follow by another subseqent
-rename B->C, if later reviews override earlier reviews.
+The QML API is being reviewed. This file documents the changes.
+Note that the changes are incremental, so a rename A->B for example may be followed
+by another subsequent rename B->C, if later reviews override earlier reviews.
API Changes
===========
@@ -95,21 +94,14 @@ ListView: removed currentItemMode. Replaced by highligh range.
ListView: removed snapPos.
Other Changes:
+ids must be lowercase: Text { id: foo }, not Text { id: Foo }
Drag: axis becomes an enum with values "XAxis", "YAxis", "XandYAxis"
Image: scaleGrid property removed. New item called BorderImage instead.
KeyActions: changed to a Keys attached property on any item.
KeyProxy: changed to a Keys.forwardTo property on any item.
-
-Pending Changes
-===============
-
-Renamed elements:
-
-Renamed properties:
-
-Removed Properties:
-PropertyAction::property
-PropertyAction::target (if possible)
-
-Additions:
-Connection: add "slot" property
+Script: now an intrinsic type in the language
+ - cannot be assigned to properties
+ - good: Item { Script { ... } }
+ - bad: Item { resources: Script { ... } }
+Script: delay-loaded of the QML file until their source has been loaded (this only effects QML files loaded across the network.)
+Scope: declared properties shadow a property of the same name (was previously the reverse)
diff --git a/src/declarative/debugger/qmldebug.cpp b/src/declarative/debugger/qmldebug.cpp
index a515c1d..1ef7503 100644
--- a/src/declarative/debugger/qmldebug.cpp
+++ b/src/declarative/debugger/qmldebug.cpp
@@ -276,7 +276,7 @@ QmlDebugPropertyWatch *QmlEngineDebug::addWatch(const QmlDebugPropertyReference
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("WATCH_PROPERTY") << queryId << property.objectDebugId() << property.name().toLatin1();
+ ds << QByteArray("WATCH_PROPERTY") << queryId << property.objectDebugId() << property.name().toUtf8();
d->client->sendMessage(message);
} else {
watch->m_state = QmlDebugWatch::Dead;
diff --git a/src/declarative/debugger/qmldebugservice.cpp b/src/declarative/debugger/qmldebugservice.cpp
index b83a4b1..6913def 100644
--- a/src/declarative/debugger/qmldebugservice.cpp
+++ b/src/declarative/debugger/qmldebugservice.cpp
@@ -353,7 +353,7 @@ QString QmlDebugService::objectToString(QObject *obj)
if(objectName.isEmpty())
objectName = QLatin1String("<unnamed>");
- QString rv = QLatin1String(obj->metaObject()->className()) +
+ QString rv = QString::fromUtf8(obj->metaObject()->className()) +
QLatin1String(": ") + objectName;
return rv;
diff --git a/src/declarative/extra/qbindablemap.cpp b/src/declarative/extra/qbindablemap.cpp
index c8c8ced..5254e2a 100644
--- a/src/declarative/extra/qbindablemap.cpp
+++ b/src/declarative/extra/qbindablemap.cpp
@@ -58,7 +58,7 @@ public:
protected:
virtual void propertyWrite(int index)
{
- map->emitChanged(QLatin1String(name(index)));
+ map->emitChanged(QString::fromUtf8(name(index)));
}
private:
@@ -130,7 +130,7 @@ QBindableMap::~QBindableMap()
void QBindableMap::clearValue(const QString &key)
{
//m_keys.remove(); //###
- m_mo->setValue(key.toLatin1(), QVariant());
+ m_mo->setValue(key.toUtf8(), QVariant());
//emit changed(key);
}
@@ -142,7 +142,7 @@ void QBindableMap::clearValue(const QString &key)
*/
QVariant QBindableMap::value(const QString &key) const
{
- return m_mo->value(key.toLatin1());
+ return m_mo->value(key.toUtf8());
}
/*!
@@ -154,7 +154,7 @@ void QBindableMap::setValue(const QString &key, QVariant value)
{
if (!m_keys.contains(key))
m_keys.append(key);
- m_mo->setValue(key.toLatin1(), value);
+ m_mo->setValue(key.toUtf8(), value);
//emit changed(key);
}
diff --git a/src/declarative/extra/qfxparticles.cpp b/src/declarative/extra/qfxparticles.cpp
index b4a04a9..36fdd79 100644
--- a/src/declarative/extra/qfxparticles.cpp
+++ b/src/declarative/extra/qfxparticles.cpp
@@ -111,6 +111,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ParticleMotion,QFxParticleMotion
\class QFxParticleMotion
\ingroup group_effects
\brief The QFxParticleMotion class is the base class for particle motion.
+ \internal
This class causes the particles to remain static.
*/
diff --git a/src/declarative/extra/qmlbehavior.cpp b/src/declarative/extra/qmlbehavior.cpp
index 7784ef5..654cb4e 100644
--- a/src/declarative/extra/qmlbehavior.cpp
+++ b/src/declarative/extra/qmlbehavior.cpp
@@ -44,61 +44,22 @@
#include "qmltransition.h"
#include "qmlbehavior.h"
#include <QtDeclarative/qmlcontext.h>
+#include <QtDeclarative/qmlinfo.h>
#include <QtCore/qparallelanimationgroup.h>
QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Behavior,QmlBehavior)
-class QmlBehaviorData : public QObject
-{
-Q_OBJECT
-public:
- QmlBehaviorData(QObject *parent)
- : QObject(parent) {}
-
- Q_PROPERTY(QVariant endValue READ endValue NOTIFY valuesChanged)
- Q_PROPERTY(QVariant startValue READ startValue NOTIFY valuesChanged)
- QVariant endValue() const { return e; }
- QVariant startValue() const { return s; }
-
- QVariant e;
- QVariant s;
-
-Q_SIGNALS:
- void valuesChanged();
-
-private:
- friend class QmlBehavior;
-};
-
class QmlBehaviorPrivate : public QObjectPrivate
{
+ Q_DECLARE_PUBLIC(QmlBehavior)
public:
- QmlBehaviorPrivate() : operations(this) {}
+ QmlBehaviorPrivate() : animation(0) {}
+
QmlMetaProperty property;
QVariant currentValue;
-
- QVariant fromValue;
- QVariant toValue;
- class AnimationList : public QmlConcreteList<QmlAbstractAnimation *>
- {
- public:
- AnimationList(QmlBehaviorPrivate *parent) : _parent(parent) {}
- virtual void append(QmlAbstractAnimation *a)
- {
- QmlConcreteList<QmlAbstractAnimation *>::append(a);
- _parent->group->addAnimation(a->qtAnimation());
- if (_parent->property.isValid()) {
- a->setTarget(_parent->property);
- }
- }
- virtual void clear() { QmlConcreteList<QmlAbstractAnimation *>::clear(); } //###
- private:
- QmlBehaviorPrivate *_parent;
- };
- AnimationList operations;
- QParallelAnimationGroup *group;
+ QmlAbstractAnimation *animation;
};
/*!
@@ -121,103 +82,67 @@ public:
\endcode
*/
-QmlBehavior::QmlBehavior(QObject *parent)
-: QObject(*(new QmlBehaviorPrivate), parent)
-{
- Q_D(QmlBehavior);
- d->group = new QParallelAnimationGroup;
- QFx_setParent_noEvent(d->group, this);
-}
-
-/*!
- \qmlproperty QVariant Behavior::from
- This property holds a selector specifying a starting value for the behavior.
-
- If you only want the behavior to apply when the change starts at a
- specific value you can specify fromValue. This selector is used in conjunction
- with the to selector.
-*/
-QVariant QmlBehavior::fromValue() const
+QmlBehavior::QmlBehavior(QObject *parent)
+ : QObject(*(new QmlBehaviorPrivate), parent)
{
- Q_D(const QmlBehavior);
- return d->fromValue;
}
-void QmlBehavior::setFromValue(const QVariant &v)
+QmlBehavior::~QmlBehavior()
{
- Q_D(QmlBehavior);
- d->fromValue = v;
}
/*!
- \qmlproperty QVariant Behavior::to
- This property holds a selector specifying a ending value for the behavior.
+ \qmlproperty Animation Behavior::animation
+ \default
- If you only want the behavior to apply when the change ends at a
- specific value you can specify toValue. This selector is used in conjunction
- with the from selector.
+ The animation to use when the behavior is triggered.
*/
-QVariant QmlBehavior::toValue() const
-{
- Q_D(const QmlBehavior);
- return d->toValue;
-}
-
-void QmlBehavior::setToValue(const QVariant &v)
+QmlAbstractAnimation *QmlBehavior::animation()
{
Q_D(QmlBehavior);
- d->toValue = v;
+ return d->animation;
}
-QmlList<QmlAbstractAnimation *>* QmlBehavior::operations()
+void QmlBehavior::setAnimation(QmlAbstractAnimation *animation)
{
Q_D(QmlBehavior);
- return &d->operations;
-}
+ if (d->animation) {
+ qmlInfo(tr("Can't change the animation assigned to a Behavior."),this);
+ return;
+ }
-QmlBehavior::~QmlBehavior()
-{
- //### do we need any other cleanup here?
+ d->animation = animation;
+ if (d->animation)
+ d->animation->setTarget(d->property);
}
-bool QmlBehavior::_ignore = false;
-void QmlBehavior::propertyValueChanged()
+void QmlBehavior::write(const QVariant &value)
{
Q_D(QmlBehavior);
- if (_ignore)
+ if (!d->animation) {
+ d->property.write(value, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
return;
+ }
- QVariant newValue = d->property.read();
-
- if ((!fromValue().isValid() || fromValue() == d->currentValue) &&
- (!toValue().isValid() || toValue() == newValue)) {
-
- //### does this clean up everything needed?
- d->group->stop();
+ d->currentValue = d->property.read();
- QmlStateOperation::ActionList actions;
- Action action;
- action.property = d->property;
- action.fromValue = d->currentValue;
- action.toValue = newValue;
- actions << action;
+ d->animation->qtAnimation()->stop();
- _ignore = true;
- d->property.write(d->currentValue);
+ QmlStateOperation::ActionList actions;
+ Action action;
+ action.property = d->property;
+ action.fromValue = d->currentValue;
+ action.toValue = value;
+ actions << action;
- QList<QmlMetaProperty> after;
- for (int ii = 0; ii < d->operations.count(); ++ii) {
- d->operations.at(ii)->transition(actions, after, QmlAbstractAnimation::Forward);
- }
- d->group->start();
- if (!after.contains(d->property))
- d->property.write(newValue);
- _ignore = false;
- }
-
- d->currentValue = newValue;
+ QList<QmlMetaProperty> after;
+ if (d->animation)
+ d->animation->transition(actions, after, QmlAbstractAnimation::Forward);
+ d->animation->qtAnimation()->start();
+ if (!after.contains(d->property))
+ d->property.write(value, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
}
void QmlBehavior::setTarget(const QmlMetaProperty &property)
@@ -225,12 +150,8 @@ void QmlBehavior::setTarget(const QmlMetaProperty &property)
Q_D(QmlBehavior);
d->property = property;
d->currentValue = property.read();
- d->property.connectNotifier(this, SLOT(propertyValueChanged()));
- for (int ii = 0; ii < d->operations.count(); ++ii) {
- d->operations.at(ii)->setTarget(property);
- }
+ if (d->animation)
+ d->animation->setTarget(property);
}
QT_END_NAMESPACE
-
-#include "qmlbehavior.moc"
diff --git a/src/declarative/extra/qmlbehavior.h b/src/declarative/extra/qmlbehavior.h
index a4a0679..994d85c 100644
--- a/src/declarative/extra/qmlbehavior.h
+++ b/src/declarative/extra/qmlbehavior.h
@@ -43,6 +43,7 @@
#define QMLBEHAVIOR_H
#include <QtDeclarative/qmlpropertyvaluesource.h>
+#include <QtDeclarative/qmlpropertyvalueinterceptor.h>
#include <QtDeclarative/qml.h>
#include <QtDeclarative/qmlstate.h>
@@ -54,32 +55,23 @@ QT_MODULE(Declarative)
class QmlAbstractAnimation;
class QmlBehaviorPrivate;
-class Q_DECLARATIVE_EXPORT QmlBehavior : public QObject, public QmlPropertyValueSource
+class Q_DECLARATIVE_EXPORT QmlBehavior : public QObject, public QmlPropertyValueInterceptor
{
Q_OBJECT
Q_DECLARE_PRIVATE(QmlBehavior)
- Q_PROPERTY(QVariant from READ fromValue WRITE setFromValue)
- Q_PROPERTY(QVariant to READ toValue WRITE setToValue)
- Q_CLASSINFO("DefaultProperty", "operations")
- Q_PROPERTY(QmlList<QmlAbstractAnimation *>* operations READ operations)
+ Q_CLASSINFO("DefaultProperty", "animation")
+ Q_PROPERTY(QmlAbstractAnimation *animation READ animation WRITE setAnimation)
public:
QmlBehavior(QObject *parent=0);
~QmlBehavior();
- QVariant fromValue() const;
- void setFromValue(const QVariant &);
- QVariant toValue() const;
- void setToValue(const QVariant &);
virtual void setTarget(const QmlMetaProperty &);
+ virtual void write(const QVariant &value);
- QmlList<QmlAbstractAnimation *>* operations();
-
- static bool _ignore;
-
-private Q_SLOTS:
- void propertyValueChanged();
+ QmlAbstractAnimation *animation();
+ void setAnimation(QmlAbstractAnimation *);
};
QT_END_NAMESPACE
diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp
index 01efa0e..fb26915 100644
--- a/src/declarative/extra/qmlxmllistmodel.cpp
+++ b/src/declarative/extra/qmlxmllistmodel.cpp
@@ -109,7 +109,7 @@ public:
void setQuery(const QString &query)
{
if (query.startsWith(QLatin1Char('/'))) {
- qmlInfo(this) << "An XmlRole query must not start with '/'";
+ qmlInfo(tr("An XmlRole query must not start with '/'"),this);
return;
}
m_query = query;
@@ -545,7 +545,7 @@ void QmlXmlListModel::setQuery(const QString &query)
{
Q_D(QmlXmlListModel);
if (!query.startsWith(QLatin1Char('/'))) {
- qmlInfo(this) << "An XmlListModel query must start with '/' or \"//\"";
+ qmlInfo(tr("An XmlListModel query must start with '/' or \"//\""),this);
return;
}
diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri
index cfe78e1..fc4e640 100644
--- a/src/declarative/fx/fx.pri
+++ b/src/declarative/fx/fx.pri
@@ -44,6 +44,7 @@ HEADERS += \
fx/qfxlistview.h \
fx/qfxgraphicsobjectcontainer.h \
fx/qfxlayoutitem.h \
+ fx/qfxeffects.cpp
SOURCES += \
fx/qfxanchors.cpp \
diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp
index 64eaaaf..09776e5 100644
--- a/src/declarative/fx/qfxanchors.cpp
+++ b/src/declarative/fx/qfxanchors.cpp
@@ -334,7 +334,7 @@ void QFxAnchors::setFill(QFxItem *f)
return;
}
if (f != d->item->parentItem() && f->parentItem() != d->item->parentItem()){
- qmlInfo(d->item) << "Can't anchor to an item that isn't a parent or sibling.";
+ qmlInfo(tr("Can't anchor to an item that isn't a parent or sibling."), d->item);
return;
}
d->remDepend(d->fill);
@@ -359,7 +359,7 @@ void QFxAnchors::setCenterIn(QFxItem* c)
return;
}
if (c != d->item->parentItem() && c->parentItem() != d->item->parentItem()){
- qmlInfo(d->item) << "Can't anchor to an item that isn't a parent or sibling.";
+ qmlInfo(tr("Can't anchor to an item that isn't a parent or sibling."), d->item);
return;
}
@@ -460,7 +460,7 @@ void QFxAnchorsPrivate::updateVerticalAnchors()
--updatingVerticalAnchor;
} else {
// ### Make this certain :)
- qmlInfo(item) << "Possible anchor loop detected on vertical anchor.";
+ qmlInfo(QFxAnchors::tr("Possible anchor loop detected on vertical anchor."), item);
}
}
@@ -519,7 +519,7 @@ void QFxAnchorsPrivate::updateHorizontalAnchors()
--updatingHorizontalAnchor;
} else {
// ### Make this certain :)
- qmlInfo(item) << "Possible anchor loop detected on horizontal anchor.";
+ qmlInfo(QFxAnchors::tr("Possible anchor loop detected on horizontal anchor."), item);
}
}
@@ -891,7 +891,7 @@ bool QFxAnchorsPrivate::checkHValid() const
if (usedAnchors & QFxAnchors::HasLeftAnchor &&
usedAnchors & QFxAnchors::HasRightAnchor &&
usedAnchors & QFxAnchors::HasHCenterAnchor) {
- qmlInfo(item) << "Can't specify left, right, and hcenter anchors.";
+ qmlInfo(QFxAnchors::tr("Can't specify left, right, and hcenter anchors."), item);
return false;
}
@@ -901,16 +901,16 @@ bool QFxAnchorsPrivate::checkHValid() const
bool QFxAnchorsPrivate::checkHAnchorValid(QFxAnchorLine anchor) const
{
if (!anchor.item) {
- qmlInfo(item) << "Can't anchor to a null item.";
+ qmlInfo(QFxAnchors::tr("Can't anchor to a null item."), item);
return false;
} else if (anchor.anchorLine & QFxAnchorLine::Vertical_Mask) {
- qmlInfo(item) << "Can't anchor a horizontal edge to a vertical edge.";
+ qmlInfo(QFxAnchors::tr("Can't anchor a horizontal edge to a vertical edge."), item);
return false;
} else if (anchor.item != item->parentItem() && anchor.item->parentItem() != item->parentItem()){
- qmlInfo(item) << "Can't anchor to an item that isn't a parent or sibling.";
+ qmlInfo(QFxAnchors::tr("Can't anchor to an item that isn't a parent or sibling."), item);
return false;
} else if (anchor.item == item) {
- qmlInfo(item) << "Can't anchor item to self.";
+ qmlInfo(QFxAnchors::tr("Can't anchor item to self."), item);
return false;
}
@@ -922,13 +922,13 @@ bool QFxAnchorsPrivate::checkVValid() const
if (usedAnchors & QFxAnchors::HasTopAnchor &&
usedAnchors & QFxAnchors::HasBottomAnchor &&
usedAnchors & QFxAnchors::HasVCenterAnchor) {
- qmlInfo(item) << "Can't specify top, bottom, and vcenter anchors.";
+ qmlInfo(QFxAnchors::tr("Can't specify top, bottom, and vcenter anchors."), item);
return false;
} else if (usedAnchors & QFxAnchors::HasBaselineAnchor &&
(usedAnchors & QFxAnchors::HasTopAnchor ||
usedAnchors & QFxAnchors::HasBottomAnchor ||
usedAnchors & QFxAnchors::HasVCenterAnchor)) {
- qmlInfo(item) << "Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors.";
+ qmlInfo(QFxAnchors::tr("Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors."), item);
return false;
}
@@ -938,16 +938,16 @@ bool QFxAnchorsPrivate::checkVValid() const
bool QFxAnchorsPrivate::checkVAnchorValid(QFxAnchorLine anchor) const
{
if (!anchor.item) {
- qmlInfo(item) << "Can't anchor to a null item.";
+ qmlInfo(QFxAnchors::tr("Can't anchor to a null item."), item);
return false;
} else if (anchor.anchorLine & QFxAnchorLine::Horizontal_Mask) {
- qmlInfo(item) << "Can't anchor a vertical edge to a horizontal edge.";
+ qmlInfo(QFxAnchors::tr("Can't anchor a vertical edge to a horizontal edge."), item);
return false;
} else if (anchor.item != item->parentItem() && anchor.item->parentItem() != item->parentItem()){
- qmlInfo(item) << "Can't anchor to an item that isn't a parent or sibling.";
+ qmlInfo(QFxAnchors::tr("Can't anchor to an item that isn't a parent or sibling."), item);
return false;
} else if (anchor.item == item){
- qmlInfo(item) << "Can't anchor item to self.";
+ qmlInfo(QFxAnchors::tr("Can't anchor item to self."), item);
return false;
}
diff --git a/src/declarative/fx/qfxeffects.cpp b/src/declarative/fx/qfxeffects.cpp
new file mode 100644
index 0000000..ebdd880
--- /dev/null
+++ b/src/declarative/fx/qfxeffects.cpp
@@ -0,0 +1,238 @@
+#include <qml.h>
+#include <qfxglobal.h>
+#include <QtGui/qgraphicseffect.h>
+
+QML_DECLARE_TYPE(QGraphicsEffect)
+QML_DEFINE_NOCREATE_TYPE(QGraphicsEffect)
+
+QML_DECLARE_TYPE(QGraphicsBlurEffect)
+QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Blur,QGraphicsBlurEffect)
+
+/*!
+ \qmlclass Blur
+ \brief The Blur object provides a blur effect.
+
+ A blur effect blurs the source item. This effect is useful for reducing details,
+ such as when the source loses focus and you want to draw attention to other
+ elements. The level of detail can be modified using the blurRadius property.
+ Use blurHint to choose the quality or performance blur hints.
+
+ By default, the blur radius is 5 pixels.
+
+ \img graphicseffect-blur.png
+*/
+
+/*!
+ \qmlproperty real Blur::blurRadius
+
+ blurRadius controls how blurry an item will appear.
+ Using a smaller radius results in a sharper appearance, whereas a bigger
+ radius results in a more blurred appearance.
+
+ By default, the blur radius is 5 pixels.
+*/
+/*!
+ \qmlproperty enumeration Blur::blurHint
+
+ Use the Qt.PerformanceHint hint to say that you want a faster blur,
+ and the Qt.QualityHint hint to say that you prefer a higher quality blur.
+
+ When animating the blur radius it's recommended to use Qt.PerformanceHint.
+
+ By default, the blur hint is Qt.PerformanceHint.
+*/
+
+QML_DECLARE_TYPE(QGraphicsGrayscaleEffect)
+QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Grayscale,QGraphicsGrayscaleEffect)
+
+/*!
+ \qmlclass Grayscale
+ \brief The Grayscale object provides a grayscale effect.
+
+ A grayscale effect renders the source item in shades of gray.
+
+ \img graphicseffect-grayscale.png
+*/
+
+/*!
+ \qmlproperty real Grayscale::strength
+
+ To what extent the source item is "grayed". A strength of 0.0 is equal to no effect,
+ while 1.0 means full grayscale. By default, the strength is 1.0.
+*/
+
+QML_DECLARE_TYPE(QGraphicsColorizeEffect)
+QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Colorize,QGraphicsColorizeEffect)
+
+/*!
+ \qmlclass Colorize
+ \brief The Colorize object provides a colorize effect.
+
+ A colorize effect renders the source item with a tint of its color.
+
+ By default, the color is light blue.
+
+ \img graphicseffect-colorize.png
+*/
+
+/*!
+ \qmlproperty color Colorize::color
+ The color of the effect.
+
+ By default, the color is light blue.
+*/
+
+/*!
+ \qmlproperty real Colorize::strength
+
+ To what extent the source item is "colored". A strength of 0.0 is equal to no effect,
+ while 1.0 means full colorization. By default, the strength is 1.0.
+*/
+
+QML_DECLARE_TYPE(QGraphicsPixelizeEffect)
+QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Pixelize,QGraphicsPixelizeEffect)
+
+/*!
+ \qmlclass Pixelize
+ \brief The Pixelize object provides a pixelize effect.
+
+ A pixelize effect renders the source item in lower resolution. The resolution
+ can be modified using the pixelSize property.
+
+ By default, the pixel size is 3.
+
+ \img graphicseffect-pixelize.png
+*/
+
+/*!
+ \qmlproperty int Pixelize::pixelSize
+ The size of a pixel in the effect.
+
+ Setting the pixel size to 2 means two pixels in the source item will be used to
+ represent one pixel in the output. Using a bigger size results in lower resolution.
+
+ By default, the pixel size is 3.
+*/
+
+
+QML_DECLARE_TYPE(QGraphicsDropShadowEffect)
+QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,DropShadow,QGraphicsDropShadowEffect)
+
+/*!
+ \qmlclass DropShadow
+ \brief The DropShadow object provides a drop shadow effect.
+
+ A drop shadow effect renders the source item with a drop shadow. The color of
+ the drop shadow can be modified using the color property. The drop
+ shadow offset can be modified using the xOffset and yOffset properties and the blur
+ radius of the drop shadow can be changed with the blurRadius property.
+
+ By default, the drop shadow is a semi-transparent dark gray shadow,
+ blurred with a radius of 1 at an offset of 8 pixels towards the lower right.
+
+ \img graphicseffect-drop-shadow.png
+*/
+
+/*!
+ \qmlproperty real DropShadow::xOffset
+ \qmlproperty real DropShadow::yOffset
+ The shadow offset in pixels.
+
+ By default, xOffset and yOffset are 8 pixels.
+*/
+
+/*!
+ \qmlproperty real DropShadow::blurRadius
+ The blur radius in pixels of the drop shadow.
+
+ Using a smaller radius results in a sharper shadow, whereas using a bigger
+ radius results in a more blurred shadow.
+
+ By default, the blur radius is 1 pixel.
+*/
+
+/*!
+ \qmlproperty color DropShadow::color
+ The color of the drop shadow.
+
+ By default, the drop color is a semi-transparent dark gray.
+*/
+
+QML_DECLARE_TYPE(QGraphicsOpacityEffect)
+QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Opacity,QGraphicsOpacityEffect)
+
+/*!
+ \qmlclass Opacity
+ \brief The Opacity object provides an opacity effect.
+
+ An opacity effect renders the source with an opacity. This effect is useful
+ for making the source semi-transparent, similar to a fade-in/fade-out
+ sequence. The opacity can be modified using the opacity property.
+
+ By default, the opacity is 0.7.
+
+ \img graphicseffect-opacity.png
+*/
+
+/*!
+ \qmlproperty real Opacity::opacity
+ This property specifies how opaque an item should appear.
+
+ The value should be in the range of 0.0 to 1.0, where 0.0 is
+ fully transparent and 1.0 is fully opaque.
+
+ By default, the opacity is 0.7.
+*/
+
+QML_DECLARE_TYPE(QGraphicsBloomEffect)
+QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Bloom,QGraphicsBloomEffect)
+
+/*!
+ \qmlclass Bloom
+ \brief The Bloom object provides a bloom/glow effect.
+
+ A bloom/glow effect adds fringes of light around bright areas in the source item.
+
+ \img graphicseffect-bloom.png
+*/
+
+/*!
+ \qmlproperty real Bloom::blurRadius
+ The blur radius in pixels of the effect.
+
+ Using a smaller radius results in a sharper appearance, whereas a bigger
+ radius results in a more blurred appearance.
+
+ By default, the blur radius is 5 pixels.
+*/
+
+/*!
+ \qmlproperty enumeration Bloom::blurHint
+
+ Use the Qt.PerformanceHint hint to say that you want a faster blur,
+ and the Qt.QualityHint hint to say that you prefer a higher quality blur.
+
+ When animating the blur radius it's recommended to use Qt.PerformanceHint.
+
+ By default, the blur hint is Qt.PerformanceHint.
+*/
+
+/*!
+ \qmlproperty int Bloom::brightness
+ This property specifies how bright the glow should appear.
+
+ The value should be in the range of 0 to 255, where 0 is dark
+ and 255 is bright.
+
+ By default, the brightness is 70.
+*/
+
+/*!
+ \qmlproperty real Bloom::strength
+ The strength of the glow.
+
+ A strength of 0.0 is equal to no effect, while 1.0 means maximum glow.
+
+ By default, the strength is 0.7.
+*/
+
diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp
index dc5101c..d381cfe 100644
--- a/src/declarative/fx/qfxflipable.cpp
+++ b/src/declarative/fx/qfxflipable.cpp
@@ -142,7 +142,7 @@ void QFxFlipable::setFront(QFxItem *front)
{
Q_D(QFxFlipable);
if (d->front) {
- qmlInfo(this) << "front is a write-once property";
+ qmlInfo(tr("front is a write-once property"),this);
return;
}
d->front = front;
@@ -161,7 +161,7 @@ void QFxFlipable::setBack(QFxItem *back)
{
Q_D(QFxFlipable);
if (d->back) {
- qmlInfo(this) << "back is a write-once property";
+ qmlInfo(tr("back is a write-once property"),this);
return;
}
d->back = back;
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index a155d5a..6324724 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -76,29 +76,7 @@ QML_DEFINE_NOCREATE_TYPE(QGraphicsTransform);
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Scale,QGraphicsScale)
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation)
-QML_DECLARE_TYPE(QGraphicsEffect)
-QML_DEFINE_NOCREATE_TYPE(QGraphicsEffect)
-
-QML_DECLARE_TYPE(QGraphicsBlurEffect)
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Blur,QGraphicsBlurEffect)
-
-QML_DECLARE_TYPE(QGraphicsGrayscaleEffect)
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Grayscale,QGraphicsGrayscaleEffect)
-
-QML_DECLARE_TYPE(QGraphicsColorizeEffect)
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Colorize,QGraphicsColorizeEffect)
-
-QML_DECLARE_TYPE(QGraphicsPixelizeEffect)
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Pixelize,QGraphicsPixelizeEffect)
-
-QML_DECLARE_TYPE(QGraphicsDropShadowEffect)
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,DropShadow,QGraphicsDropShadowEffect)
-
-QML_DECLARE_TYPE(QGraphicsOpacityEffect)
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Opacity,QGraphicsOpacityEffect)
-
-QML_DECLARE_TYPE(QGraphicsBloomEffect)
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Bloom,QGraphicsBloomEffect)
+#include "qfxeffects.cpp"
/*!
\qmlclass Transform
diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp
index b127f39..c580e98 100644
--- a/src/declarative/fx/qfxpathview.cpp
+++ b/src/declarative/fx/qfxpathview.cpp
@@ -607,7 +607,7 @@ void QFxPathViewPrivate::updateItem(QFxItem *item, qreal percent)
{
if (QObject *obj = QFxPathView::qmlAttachedProperties(item)) {
foreach(const QString &attr, path->attributes())
- static_cast<QFxPathViewAttached *>(obj)->setValue(attr.toLatin1(), path->attributeAt(attr, percent));
+ static_cast<QFxPathViewAttached *>(obj)->setValue(attr.toUtf8(), path->attributeAt(attr, percent));
}
QPointF pf = path->pointAt(percent);
item->setX(pf.x() - item->width()*item->scale()/2);
diff --git a/src/declarative/fx/qfxtextinput.cpp b/src/declarative/fx/qfxtextinput.cpp
index 05d2260..f5bf911 100644
--- a/src/declarative/fx/qfxtextinput.cpp
+++ b/src/declarative/fx/qfxtextinput.cpp
@@ -508,7 +508,7 @@ void QFxTextInputPrivate::startCreatingCursor()
q->connect(cursorComponent, SIGNAL(statusChanged(int)),
q, SLOT(createCursor()));
}else{//isError
- qmlInfo(q) << "Could not load cursor delegate";
+ qmlInfo(QFxTextInput::tr("Could not load cursor delegate"), q);
qWarning() << cursorComponent->errors();
}
}
@@ -517,7 +517,7 @@ void QFxTextInput::createCursor()
{
Q_D(QFxTextInput);
if(d->cursorComponent->isError()){
- qmlInfo(this) << "Could not load cursor delegate";
+ qmlInfo(tr("Could not load cursor delegate"),this);
qWarning() << d->cursorComponent->errors();
return;
}
@@ -529,7 +529,7 @@ void QFxTextInput::createCursor()
delete d->cursorItem;
d->cursorItem = qobject_cast<QFxItem*>(d->cursorComponent->create());
if(!d->cursorItem){
- qmlInfo(this) << "Could not instantiate cursor delegate";
+ qmlInfo(tr("Could not instantiate cursor delegate"),this);
//The failed instantiation should print its own error messages
return;
}
diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp
index 943f909..a078da6 100644
--- a/src/declarative/fx/qfxvisualitemmodel.cpp
+++ b/src/declarative/fx/qfxvisualitemmodel.cpp
@@ -264,7 +264,7 @@ public:
for (QHash<int,QByteArray>::const_iterator it = m_abstractItemModel->roleNames().begin();
it != m_abstractItemModel->roleNames().end(); ++it) {
m_roles.append(it.key());
- m_roleNames.insert(QLatin1String(*it), it.key());
+ m_roleNames.insert(QString::fromUtf8(*it), it.key());
}
if (m_roles.count() == 1)
m_roleNames.insert(QLatin1String("modelData"), m_roles.at(0));
@@ -275,7 +275,7 @@ public:
int count = object->metaObject()->propertyCount();
for (int ii = 1; ii < count; ++ii) {
const QMetaProperty &prop = object->metaObject()->property(ii);
- m_roleNames.insert(prop.name(), 0);
+ m_roleNames.insert(QString::fromUtf8(prop.name()), 0);
}
}
}
@@ -416,11 +416,11 @@ int QFxVisualDataModelDataMetaObject::createProperty(const char *name, const cha
if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) {
model->ensureRoles();
- if (model->m_roleNames.contains(QLatin1String(name)))
+ if (model->m_roleNames.contains(QString::fromUtf8(name)))
return QmlOpenMetaObject::createProperty(name, type);
} else {
model->ensureRoles();
- const QLatin1String sname(name);
+ QString sname = QString::fromUtf8(name);
if (model->m_roleNames.contains(sname))
return QmlOpenMetaObject::createProperty(name, type);
}
@@ -438,7 +438,7 @@ QFxVisualDataModelDataMetaObject::propertyCreated(int, QMetaPropertyBuilder &pro
Q_ASSERT(data->m_model);
QFxVisualDataModelPrivate *model = QFxVisualDataModelPrivate::get(data->m_model);
- QString name = QLatin1String(prop.name());
+ QString name = QString::fromUtf8(prop.name());
if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) {
if (name == QLatin1String("modelData")) {
if (model->m_listAccessor->type() == QmlListAccessor::Instance) {
@@ -532,7 +532,7 @@ QFxVisualDataModelPartsMetaObject::propertyCreated(int, QMetaPropertyBuilder &pr
QFxVisualDataModel *m = new QFxVisualDataModel;
m->setParent(object());
- m->setPart(QLatin1String(prop.name()));
+ m->setPart(QString::fromUtf8(prop.name()));
m->setModel(QVariant::fromValue(static_cast<QFxVisualDataModelParts *>(object())->model));
QVariant var = QVariant::fromValue((QObject *)m);
@@ -706,7 +706,7 @@ QFxItem *QFxVisualDataModel::item(int index, bool complete)
{
Q_D(QFxVisualDataModel);
if (d->m_visualItemModel)
- return d->m_visualItemModel->item(index, d->m_part.toLatin1(), complete);
+ return d->m_visualItemModel->item(index, d->m_part.toUtf8(), complete);
return item(index, QByteArray(), complete);
}
@@ -790,7 +790,7 @@ QFxItem *QFxVisualDataModel::item(int index, const QByteArray &viewId, bool comp
if (!item) {
QmlPackage *package = qobject_cast<QmlPackage *>(nobj);
if (package) {
- QObject *o = package->part(QLatin1String(viewId));
+ QObject *o = package->part(QString::fromUtf8(viewId));
item = qobject_cast<QFxItem *>(o);
if (item)
d->m_packaged.insertMulti(item, package);
@@ -798,7 +798,7 @@ QFxItem *QFxVisualDataModel::item(int index, const QByteArray &viewId, bool comp
}
if (!item) {
d->m_cache.releaseItem(nobj);
- qmlInfo(d->m_delegate) << "Delegate component must be Item type.";
+ qmlInfo(QFxVisualDataModel::tr("Delegate component must be Item type."), d->m_delegate);
}
return item;
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index a06e294..f7030ca 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -1325,9 +1325,8 @@ public Q_SLOTS:
void qmlLoaded()
{
if (component->isError()) {
- // XXX Could instead give these errors to the WebView to handle.
- foreach (QmlError err, component->errors())
- qWarning(err.toString().toLatin1());
+ // ### Could instead give these errors to the WebView to handle.
+ qWarning() << component->errors();
return;
}
item = qobject_cast<QFxItem*>(component->create(qmlContext(webview)));
@@ -1335,7 +1334,7 @@ public Q_SLOTS:
QString jsObjName;
for (int i=0; i<propertyNames.count(); ++i) {
if (propertyNames[i] != QLatin1String("type") && propertyNames[i] != QLatin1String("data")) {
- item->setProperty(propertyNames[i].toLatin1(),propertyValues[i]);
+ item->setProperty(propertyNames[i].toUtf8(),propertyValues[i]);
if (propertyNames[i] == QLatin1String("objectname"))
jsObjName = propertyValues[i];
}
diff --git a/src/declarative/qml/parser/qmljs.g b/src/declarative/qml/parser/qmljs.g
index 211887b..eb9a8ab 100644
--- a/src/declarative/qml/parser/qmljs.g
+++ b/src/declarative/qml/parser/qmljs.g
@@ -142,6 +142,7 @@
****************************************************************************/
#include <QtCore/QtDebug>
+#include <QtGui/QApplication>
#include <string.h>
@@ -2959,7 +2960,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
yylloc.startColumn += yylloc.length;
yylloc.length = 0;
- //const QString msg = QString::fromUtf8("Missing `;'");
+ //const QString msg = qApp->translate("QmlParser", "Missing `;'");
//diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg));
first_token = &token_buffer[0];
@@ -2984,7 +2985,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
token_buffer[1].loc = yylloc = location(lexer);
if (t_action(errorState, yytoken)) {
- const QString msg = QString::fromUtf8("Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
+ const QString msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
action = errorState;
@@ -3012,7 +3013,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
int a = t_action(errorState, *tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[*tk]));
+ const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = *tk;
@@ -3035,7 +3036,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
int a = t_action(errorState, tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[tk]));
+ const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = tk;
@@ -3048,7 +3049,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
}
}
- const QString msg = QString::fromUtf8("Syntax error");
+ const QString msg = qApp->translate("QmlParser", "Syntax error");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
}
diff --git a/src/declarative/qml/parser/qmljsengine_p.cpp b/src/declarative/qml/parser/qmljsengine_p.cpp
index 7d4d6d7..32068c0 100644
--- a/src/declarative/qml/parser/qmljsengine_p.cpp
+++ b/src/declarative/qml/parser/qmljsengine_p.cpp
@@ -164,7 +164,7 @@ double integerFromString(const char *buf, int size, int radix)
double integerFromString(const QString &str, int radix)
{
- QByteArray ba = str.trimmed().toUtf8();
+ QByteArray ba = str.trimmed().toLatin1();
return integerFromString(ba.constData(), ba.size(), radix);
}
diff --git a/src/declarative/qml/parser/qmljsgrammar.cpp b/src/declarative/qml/parser/qmljsgrammar.cpp
index 67f1403..da3ce2a 100644
--- a/src/declarative/qml/parser/qmljsgrammar.cpp
+++ b/src/declarative/qml/parser/qmljsgrammar.cpp
@@ -2,8 +2,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -11,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -22,20 +21,21 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/declarative/qml/parser/qmljsgrammar_p.h b/src/declarative/qml/parser/qmljsgrammar_p.h
index 7de77c0..b297f81 100644
--- a/src/declarative/qml/parser/qmljsgrammar_p.h
+++ b/src/declarative/qml/parser/qmljsgrammar_p.h
@@ -2,8 +2,7 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -11,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -22,20 +21,21 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/declarative/qml/parser/qmljslexer.cpp b/src/declarative/qml/parser/qmljslexer.cpp
index f71b92f..2c03c21 100644
--- a/src/declarative/qml/parser/qmljslexer.cpp
+++ b/src/declarative/qml/parser/qmljslexer.cpp
@@ -48,6 +48,8 @@
#include "qmljslexer_p.h"
#include "qmljsgrammar_p.h"
+#include <QtGui/qapplication.h>
+
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
@@ -548,7 +550,7 @@ int Lexer::lex()
else {
setDone(Bad);
err = IllegalCharacter;
- errmsg = QLatin1String("Illegal character");
+ errmsg = qApp->translate("QmlParser", "Illegal character");
}
}
break;
@@ -562,7 +564,7 @@ int Lexer::lex()
} else if (current == 0 || isLineTerminator()) {
setDone(Bad);
err = UnclosedStringLiteral;
- errmsg = QLatin1String("Unclosed string at end of line");
+ errmsg = qApp->translate("QmlParser", "Unclosed string at end of line");
} else if (current == '\\') {
state = InEscapeSequence;
} else {
@@ -588,7 +590,7 @@ int Lexer::lex()
} else {
setDone(Bad);
err = IllegalEscapeSequence;
- errmsg = QLatin1String("Illegal escape squence");
+ errmsg = qApp->translate("QmlParser", "Illegal escape squence");
}
} else if (current == 'x')
state = InHexEscape;
@@ -634,7 +636,7 @@ int Lexer::lex()
} else {
setDone(Bad);
err = IllegalUnicodeEscapeSequence;
- errmsg = QLatin1String("Illegal unicode escape sequence");
+ errmsg = qApp->translate("QmlParser", "Illegal unicode escape sequence");
}
break;
case InSingleLineComment:
@@ -660,7 +662,7 @@ int Lexer::lex()
if (current == 0) {
setDone(Bad);
err = UnclosedComment;
- errmsg = QLatin1String("Unclosed comment at end of file");
+ errmsg = qApp->translate("QmlParser", "Unclosed comment at end of file");
driver->addComment(startpos, tokenLength(), startlineno, startcolumn);
} else if (isLineTerminator()) {
shiftWindowsLineBreak();
@@ -747,7 +749,7 @@ int Lexer::lex()
} else {
setDone(Bad);
err = IllegalExponentIndicator;
- errmsg = QLatin1String("Illegal syntax for exponential number");
+ errmsg = qApp->translate("QmlParser", "Illegal syntax for exponential number");
}
break;
case InExponent:
@@ -773,7 +775,7 @@ int Lexer::lex()
&& isIdentLetter(current)) {
state = Bad;
err = IllegalIdentifier;
- errmsg = QLatin1String("Identifier cannot start with numeric literal");
+ errmsg = qApp->translate("QmlParser", "Identifier cannot start with numeric literal");
}
// terminate string
@@ -867,11 +869,16 @@ bool Lexer::isLineTerminator() const
bool Lexer::isIdentLetter(ushort c)
{
- /* TODO: allow other legitimate unicode chars */
- return ((c >= 'a' && c <= 'z')
+ // ASCII-biased, since all reserved words are ASCII, aand hence the
+ // bulk of content to be parsed.
+ if ((c >= 'a' && c <= 'z')
|| (c >= 'A' && c <= 'Z')
|| c == '$'
- || c == '_');
+ || c == '_')
+ return true;
+ if (c < 128)
+ return false;
+ return QChar(c).isLetterOrNumber();
}
bool Lexer::isDecimalDigit(ushort c)
@@ -1099,7 +1106,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
while (1) {
if (isLineTerminator() || current == 0) {
- errmsg = QLatin1String("Unterminated regular expression literal");
+ errmsg = qApp->translate("QmlParser", "Unterminated regular expression literal");
return false;
}
else if (current != '/' || lastWasEscape == true)
@@ -1123,7 +1130,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
while (isIdentLetter(current)) {
int flag = Ecma::RegExp::flagFromChar(current);
if (flag == 0) {
- errmsg = QString::fromLatin1("Invalid regular expression flag '%0'")
+ errmsg = qApp->translate("QmlParser", "Invalid regular expression flag '%0'")
.arg(QChar(current));
return false;
}
diff --git a/src/declarative/qml/parser/qmljsparser.cpp b/src/declarative/qml/parser/qmljsparser.cpp
index e805ce5..402aaeb 100644
--- a/src/declarative/qml/parser/qmljsparser.cpp
+++ b/src/declarative/qml/parser/qmljsparser.cpp
@@ -42,6 +42,7 @@
****************************************************************************/
#include <QtCore/QtDebug>
+#include <QtGui/QApplication>
#include <string.h>
@@ -1723,7 +1724,7 @@ case 337: {
yylloc.startColumn += yylloc.length;
yylloc.length = 0;
- //const QString msg = QString::fromUtf8("Missing `;'");
+ //const QString msg = qApp->translate("QmlParser", "Missing `;'");
//diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg));
first_token = &token_buffer[0];
@@ -1748,7 +1749,7 @@ case 337: {
token_buffer[1].loc = yylloc = location(lexer);
if (t_action(errorState, yytoken)) {
- const QString msg = QString::fromUtf8("Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
+ const QString msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
action = errorState;
@@ -1776,7 +1777,7 @@ case 337: {
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
int a = t_action(errorState, *tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[*tk]));
+ const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = *tk;
@@ -1799,7 +1800,7 @@ case 337: {
int a = t_action(errorState, tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = QString::fromUtf8("Expected token `%1'").arg(QLatin1String(spell[tk]));
+ const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = tk;
@@ -1812,7 +1813,7 @@ case 337: {
}
}
- const QString msg = QString::fromUtf8("Syntax error");
+ const QString msg = qApp->translate("QmlParser", "Syntax error");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
}
diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri
index a2e2050..2e62a3b 100644
--- a/src/declarative/qml/qml.pri
+++ b/src/declarative/qml/qml.pri
@@ -10,6 +10,7 @@ SOURCES += qml/qmlparser.cpp \
qml/qmlcontext.cpp \
qml/qmlcustomparser.cpp \
qml/qmlpropertyvaluesource.cpp \
+ qml/qmlpropertyvalueinterceptor.cpp \
qml/qmlproxymetaobject.cpp \
qml/qmlvme.cpp \
qml/qmlcompiler.cpp \
@@ -59,6 +60,7 @@ HEADERS += qml/qmlparser_p.h \
qml/qmlcustomparser_p.h \
qml/qmlcustomparser_p_p.h \
qml/qmlpropertyvaluesource.h \
+ qml/qmlpropertyvalueinterceptor.h \
qml/qmlboundsignal_p.h \
qml/qmlparserstatus.h \
qml/qmlproxymetaobject_p.h \
diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp
index f3f9289..a0d749f 100644
--- a/src/declarative/qml/qmlbasicscript.cpp
+++ b/src/declarative/qml/qmlbasicscript.cpp
@@ -52,6 +52,8 @@
QT_BEGIN_NAMESPACE
+DEFINE_BOOL_CONFIG_OPTION(qmlBasicScriptDump, QML_BASICSCRIPT_DUMP);
+
using namespace QmlJS;
struct ScriptInstruction {
@@ -367,7 +369,7 @@ bool QmlBasicScript::compile(const Expression &expression)
{
if (!expression.expression.asAST()) return false;
- QByteArray expr = expression.expression.asScript().toLatin1();
+ QByteArray expr = expression.expression.asScript().toUtf8();
const char *src = expr.constData();
QmlBasicScriptCompiler bsc;
@@ -400,6 +402,8 @@ bool QmlBasicScript::compile(const Expression &expression)
::memcpy((char *)d->data(), bsc.data.constData(), bsc.data.count());
}
+ if (d && qmlBasicScriptDump())
+ dump();
return d != 0;
}
@@ -649,7 +653,7 @@ QVariant QmlBasicScript::run(QmlContext *context, QObject *me)
case ScriptInstruction::FetchRootConstant:
{
- QObject *obj = contextPrivate->defaultObjects.at(0);
+ QObject *obj = contextPrivate->defaultObjects.last();
stack.push(fetch_value(obj, instr.constant.idx, instr.constant.type));
if (obj && instr.constant.notify != 0)
diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp
index 58ce02c..6a70c1e 100644
--- a/src/declarative/qml/qmlbinding.cpp
+++ b/src/declarative/qml/qmlbinding.cpp
@@ -97,7 +97,7 @@ QmlMetaProperty QmlBinding::property() const
return d->bindingData()->property;
}
-void QmlBinding::update()
+void QmlBinding::update(QmlMetaProperty::WriteFlags flags)
{
Q_D(QmlBinding);
@@ -119,23 +119,22 @@ void QmlBinding::update()
int idx = data->property.coreIndex();
Q_ASSERT(idx != -1);
- void *a[1];
+
QmlBinding *t = this;
- a[0] = (void *)&t;
- QMetaObject::metacall(data->property.object(),
+ int status = -1;
+ void *a[] = { &t, 0, &status, &flags };
+ QMetaObject::metacall(data->property.object(),
QMetaObject::WriteProperty,
idx, a);
} else {
-
QVariant value = this->value();
- data->property.write(value, QmlMetaProperty::Binding);
+ data->property.write(value, flags);
}
data->updating = false;
} else {
- qmlInfo(data->property.object()) << "Binding loop detected for property"
- << data->property.name();
+ qmlInfo(tr("Binding loop detected for property \"%1\"").arg(data->property.name()), data->property.object());
}
data->release();
@@ -146,17 +145,17 @@ void QmlBinding::valueChanged()
update();
}
-void QmlBinding::setEnabled(bool e)
+void QmlBinding::setEnabled(bool e, QmlMetaProperty::WriteFlags flags)
{
Q_D(QmlBinding);
d->bindingData()->enabled = e;
setTrackChange(e);
- QmlAbstractBinding::setEnabled(e);
+ QmlAbstractBinding::setEnabled(e, flags);
if (e) {
addToObject(d->bindingData()->property.object());
- update();
+ update(flags);
} else {
removeFromObject();
}
@@ -231,7 +230,7 @@ QString QmlAbstractBinding::expression() const
return QLatin1String("<Unknown>");
}
-void QmlAbstractBinding::setEnabled(bool e)
+void QmlAbstractBinding::setEnabled(bool e, QmlMetaProperty::WriteFlags)
{
if (e) m_mePtr = 0;
}
diff --git a/src/declarative/qml/qmlbinding.h b/src/declarative/qml/qmlbinding.h
index 1c0ccf1..6a3e92a 100644
--- a/src/declarative/qml/qmlbinding.h
+++ b/src/declarative/qml/qmlbinding.h
@@ -47,6 +47,7 @@
#include <QtDeclarative/qml.h>
#include <QtDeclarative/qmlpropertyvaluesource.h>
#include <QtDeclarative/qmlexpression.h>
+#include <QtCore/QMetaProperty>
QT_BEGIN_HEADER
@@ -62,10 +63,12 @@ public:
virtual QString expression() const;
- virtual void setEnabled(bool) = 0;
+ void setEnabled(bool e) { setEnabled(e, QmlMetaProperty::DontRemoveBinding); }
+ virtual void setEnabled(bool, QmlMetaProperty::WriteFlags) = 0;
virtual int propertyIndex() = 0;
- virtual void update() = 0;
+ void update() { update(QmlMetaProperty::DontRemoveBinding); }
+ virtual void update(QmlMetaProperty::WriteFlags) = 0;
void addToObject(QObject *);
void removeFromObject();
@@ -100,12 +103,13 @@ public:
bool enabled() const;
// Inherited from QmlAbstractBinding
- virtual void setEnabled(bool);
+ virtual void setEnabled(bool, QmlMetaProperty::WriteFlags flags);
virtual int propertyIndex();
+ virtual void update(QmlMetaProperty::WriteFlags flags);
virtual QString expression() const;
public Q_SLOTS:
- void update();
+ void update() { update(QmlMetaProperty::DontRemoveBinding); }
protected:
virtual void valueChanged();
diff --git a/src/declarative/qml/qmlbindingoptimizations.cpp b/src/declarative/qml/qmlbindingoptimizations.cpp
index e4ca358..6dc221e 100644
--- a/src/declarative/qml/qmlbindingoptimizations.cpp
+++ b/src/declarative/qml/qmlbindingoptimizations.cpp
@@ -69,16 +69,16 @@ QmlBinding_Id::~QmlBinding_Id()
removeFromContext();
}
-void QmlBinding_Id::setEnabled(bool e)
+void QmlBinding_Id::setEnabled(bool e, QmlMetaProperty::WriteFlags flags)
{
if (e) {
addToObject(m_object);
- update();
+ update(flags);
} else {
removeFromObject();
}
- QmlAbstractBinding::setEnabled(e);
+ QmlAbstractBinding::setEnabled(e, flags);
}
int QmlBinding_Id::propertyIndex()
@@ -86,7 +86,7 @@ int QmlBinding_Id::propertyIndex()
return m_propertyIdx;
}
-void QmlBinding_Id::update()
+void QmlBinding_Id::update(QmlMetaProperty::WriteFlags flags)
{
QmlContextPrivate *ctxtPriv =
static_cast<QmlContextPrivate *>(QObjectPrivate::get(context()));
@@ -102,7 +102,8 @@ void QmlBinding_Id::update()
}
QObject *o = ctxtPriv->idValues[m_id].data();
- void *a[] = { &o, 0 };
+ int status = -1;
+ void *a[] = { &o, 0, &status, &flags };
QMetaObject::metacall(m_object, QMetaObject::WriteProperty,
m_propertyIdx, a);
}
@@ -123,7 +124,9 @@ void QmlBinding_Id::reset()
removeFromContext();
QObject *o = 0;
- void *a[] = { &o, 0 };
+ int status = -1;
+ QmlMetaProperty::WriteFlags flags = QmlMetaProperty::DontRemoveBinding;
+ void *a[] = { &o, 0, &status, &flags };
QMetaObject::metacall(m_object, QMetaObject::WriteProperty,
m_propertyIdx, a);
}
@@ -150,17 +153,17 @@ QmlBinding_ObjProperty::QmlBinding_ObjProperty(QObject *object, int propertyIdx,
{
}
-void QmlBinding_ObjProperty::setEnabled(bool e)
+void QmlBinding_ObjProperty::setEnabled(bool e, QmlMetaProperty::WriteFlags flags)
{
m_enabled = e;
if (e) {
addToObject(m_object);
- update();
+ update(flags);
} else {
removeFromObject();
}
- QmlAbstractBinding::setEnabled(e);
+ QmlAbstractBinding::setEnabled(e, flags);
}
int QmlBinding_ObjProperty::propertyIndex()
@@ -168,21 +171,24 @@ int QmlBinding_ObjProperty::propertyIndex()
return m_propertyIdx;
}
-void QmlBinding_ObjProperty::update()
+void QmlBinding_ObjProperty::update(QmlMetaProperty::WriteFlags flags)
{
if (!m_enabled)
return;
QObject *value = 0;
- void *a[] = { &value, 0 };
+ int status = -1;
+ void *ra[] = { &value, 0, &status };
// Read
QMetaObject::metacall(m_context, QMetaObject::ReadProperty,
- m_contextIdx, a);
+ m_contextIdx, ra);
+
+ void *wa[] = { &value, 0, &status, &flags };
// Write
QMetaObject::metacall(m_object, QMetaObject::WriteProperty,
- m_propertyIdx, a);
+ m_propertyIdx, wa);
// Connect notify if needed. Only need to connect once, so we set
// m_notifyIdx back to -1 afterwards
diff --git a/src/declarative/qml/qmlbindingoptimizations_p.h b/src/declarative/qml/qmlbindingoptimizations_p.h
index 4862007..d0a4df4 100644
--- a/src/declarative/qml/qmlbindingoptimizations_p.h
+++ b/src/declarative/qml/qmlbindingoptimizations_p.h
@@ -69,9 +69,9 @@ public:
virtual ~QmlBinding_Id();
// Inherited from QmlAbstractBinding
- virtual void setEnabled(bool);
+ virtual void setEnabled(bool, QmlMetaProperty::WriteFlags flags);
virtual int propertyIndex();
- virtual void update();
+ virtual void update(QmlMetaProperty::WriteFlags flags);
void reset();
@@ -96,11 +96,12 @@ public:
QObject *context, int contextIdx, int notifyIdx);
// Inherited from QmlAbstractBinding
- virtual void setEnabled(bool);
+ virtual void setEnabled(bool, QmlMetaProperty::WriteFlags flags);
virtual int propertyIndex();
+ virtual void update(QmlMetaProperty::WriteFlags flags);
private Q_SLOTS:
- virtual void update();
+ void update() { update(QmlMetaProperty::DontRemoveBinding); }
private:
bool m_enabled;
diff --git a/src/declarative/qml/qmlcompileddata.cpp b/src/declarative/qml/qmlcompileddata.cpp
index 8c3c355..7032a3b 100644
--- a/src/declarative/qml/qmlcompileddata.cpp
+++ b/src/declarative/qml/qmlcompileddata.cpp
@@ -150,7 +150,7 @@ int QmlCompiledData::indexForLocation(const QmlParser::LocationSpan &l)
}
QmlCompiledData::QmlCompiledData()
-: importCache(0)
+: importCache(0), root(0)
{
}
@@ -189,7 +189,7 @@ const QMetaObject *QmlCompiledData::TypeReference::metaObject() const
return type->metaObject();
} else {
Q_ASSERT(component);
- return &static_cast<QmlComponentPrivate *>(QObjectPrivate::get(component))->cc->root;
+ return static_cast<QmlComponentPrivate *>(QObjectPrivate::get(component))->cc->root;
}
}
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index 8856892..c744509 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -60,6 +60,7 @@
#include <qmlcontext.h>
#include <qmlmetatype.h>
#include <QtCore/qdebug.h>
+#include <QtGui/qapplication.h>
#include "private/qmlcustomparser_p_p.h"
#include <private/qmlcontext_p.h>
#include <private/qmlcomponent_p.h>
@@ -157,7 +158,7 @@ bool QmlCompiler::isSignalPropertyName(const QByteArray &name)
For example:
\code
- COMPILE_EXCEPTION(property, "Error for property" << property->name);
+ COMPILE_EXCEPTION(property, qApp->translate("QmlCompiler","Error for property \"%1\"").arg(QString::fromUtf8(property->name)));
\endcode
*/
#define COMPILE_EXCEPTION(token, desc) \
@@ -167,9 +168,7 @@ bool QmlCompiler::isSignalPropertyName(const QByteArray &name)
error.setUrl(output->url); \
error.setLine((token)->location.start.line); \
error.setColumn((token)->location.start.column); \
- QDebug d(&exceptionDescription); \
- d << desc; \
- error.setDescription(exceptionDescription.trimmed()); \
+ error.setDescription(desc.trimmed()); \
exceptions << error; \
return false; \
}
@@ -195,16 +194,16 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
QString string = v->value.asScript();
if (!prop.isWritable())
- COMPILE_EXCEPTION(v, "Invalid property assignment:" << QLatin1String(prop.name()) << "is a read-only property");
+ COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name())));
if (prop.isEnumType()) {
int value;
if (prop.isFlagType()) {
- value = prop.enumerator().keysToValue(string.toLatin1().constData());
+ value = prop.enumerator().keysToValue(string.toUtf8().constData());
} else
- value = prop.enumerator().keyToValue(string.toLatin1().constData());
+ value = prop.enumerator().keyToValue(string.toUtf8().constData());
if (value == -1)
- COMPILE_EXCEPTION(v, "Invalid property assignment: unknown enumeration");
+ COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: unknown enumeration"));
return true;
}
int type = prop.userType();
@@ -212,61 +211,61 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
case -1:
break;
case QVariant::String:
- if (!v->value.isString()) COMPILE_EXCEPTION(v, "Invalid property assignment: string expected");
+ if (!v->value.isString()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: string expected"));
break;
case QVariant::Url:
- if (!v->value.isString()) COMPILE_EXCEPTION(v, "Invalid property assignment: url expected");
+ if (!v->value.isString()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: url expected"));
break;
case QVariant::UInt:
{
bool ok;
string.toUInt(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, "Invalid property assignment: unsigned int expected");
+ if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: unsigned int expected"));
}
break;
case QVariant::Int:
{
bool ok;
string.toInt(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, "Invalid property assignment: int expected");
+ if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: int expected"));
}
break;
case QMetaType::Float:
{
bool ok;
string.toFloat(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, "Invalid property assignment: float expected");
+ if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: float expected"));
}
break;
case QVariant::Double:
{
bool ok;
string.toDouble(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, "Invalid property assignment: double expected");
+ if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: double expected"));
}
break;
case QVariant::Color:
{
QColor c = QmlStringConverters::colorFromString(string);
- if (!c.isValid()) COMPILE_EXCEPTION(v, "Invalid property assignment: color expected");
+ if (!c.isValid()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: color expected"));
}
break;
case QVariant::Date:
{
QDate d = QDate::fromString(string, Qt::ISODate);
- if (!d.isValid()) COMPILE_EXCEPTION(v, "Invalid property assignment: date expected");
+ if (!d.isValid()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: date expected"));
}
break;
case QVariant::Time:
{
QTime time = QTime::fromString(string, Qt::ISODate);
- if (!time.isValid()) COMPILE_EXCEPTION(v, "Invalid property assignment: time expected");
+ if (!time.isValid()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: time expected"));
}
break;
case QVariant::DateTime:
{
QDateTime dateTime = QDateTime::fromString(string, Qt::ISODate);
- if (!dateTime.isValid()) COMPILE_EXCEPTION(v, "Invalid property assignment: datetime expected");
+ if (!dateTime.isValid()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: datetime expected"));
}
break;
case QVariant::Point:
@@ -274,7 +273,7 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
{
bool ok;
QPointF point = QmlStringConverters::pointFFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, "Invalid property assignment: point expected");
+ if (!ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: point expected"));
}
break;
case QVariant::Size:
@@ -282,7 +281,7 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
{
bool ok;
QSizeF size = QmlStringConverters::sizeFFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, "Invalid property assignment: size expected");
+ if (!ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: size expected"));
}
break;
case QVariant::Rect:
@@ -290,19 +289,19 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
{
bool ok;
QRectF rect = QmlStringConverters::rectFFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, "Invalid property assignment: rect expected");
+ if (!ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: rect expected"));
}
break;
case QVariant::Bool:
{
- if (!v->value.isBoolean()) COMPILE_EXCEPTION(v, "Invalid property assignment: boolean expected");
+ if (!v->value.isBoolean()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: boolean expected"));
}
break;
case QVariant::Vector3D:
{
bool ok;
QVector3D point = QmlStringConverters::vector3DFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, "Invalid property assignment: 3D vector expected");
+ if (!ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: 3D vector expected"));
}
break;
default:
@@ -313,7 +312,7 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
QmlMetaType::StringConverter converter =
QmlMetaType::customStringConverter(t);
if (!converter)
- COMPILE_EXCEPTION(v, "Invalid property assignment: unknown type" << prop.type());
+ COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: unsupported type \"%1\"").arg(QString::fromLatin1(QVariant::typeToName(prop.type()))));
}
break;
}
@@ -336,9 +335,9 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
if (prop.isEnumType()) {
int value;
if (prop.isFlagType()) {
- value = prop.enumerator().keysToValue(string.toLatin1().constData());
+ value = prop.enumerator().keysToValue(string.toUtf8().constData());
} else
- value = prop.enumerator().keyToValue(string.toLatin1().constData());
+ value = prop.enumerator().keyToValue(string.toUtf8().constData());
instr.type = QmlInstruction::StoreInteger;
instr.storeInteger.propertyIndex = prop.propertyIndex();
@@ -595,7 +594,7 @@ bool QmlCompiler::compile(QmlEngine *engine,
ref.ref = tref.unit;
ref.ref->addref();
}
- ref.className = parserRef->name.toLatin1();
+ ref.className = parserRef->name.toUtf8();
out->types << ref;
}
@@ -647,7 +646,13 @@ void QmlCompiler::compileTree(Object *tree)
output->importCache = output->imports.cache(engine);
Q_ASSERT(tree->metatype);
- static_cast<QMetaObject &>(output->root) = *tree->metaObject();
+
+ if (tree->metadata.isEmpty()) {
+ output->root = tree->metatype;
+ } else {
+ static_cast<QMetaObject &>(output->rootData) = *tree->metaObject();
+ output->root = &output->rootData;
+ }
if (!tree->metadata.isEmpty())
QmlEnginePrivate::get(engine)->registerCompositeType(output);
}
@@ -666,7 +671,7 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
obj->className = tr.className;
// This object is a "Component" element
- if (obj->metatype == &QmlComponent::staticMetaObject) {
+ if (tr.type && obj->metatype == &QmlComponent::staticMetaObject) {
COMPILE_CHECK(buildComponent(obj, ctxt));
return true;
}
@@ -735,7 +740,7 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
}
if (canDefer && !deferredList.isEmpty() &&
- deferredList.contains(prop->name))
+ deferredList.contains(QString::fromUtf8(prop->name)))
prop->isDeferred = true;
}
@@ -760,7 +765,7 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
}
if (canDefer && !deferredList.isEmpty() &&
- deferredList.contains(prop->name))
+ deferredList.contains(QString::fromUtf8(prop->name)))
prop->isDeferred = true;
}
@@ -780,7 +785,9 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
void QmlCompiler::genObject(QmlParser::Object *obj)
{
- if (obj->metatype == &QmlComponent::staticMetaObject) {
+ const QmlCompiledData::TypeReference &tr =
+ output->types.at(obj->type);
+ if (tr.type && obj->metatype == &QmlComponent::staticMetaObject) {
genComponent(obj);
return;
}
@@ -809,7 +816,7 @@ void QmlCompiler::genObject(QmlParser::Object *obj)
if (!obj->metadata.isEmpty()) {
QmlInstruction meta;
meta.type = QmlInstruction::StoreMetaObject;
- meta.line = -1;
+ meta.line = 0;
meta.storeMeta.data = output->indexForByteArray(obj->metadata);
meta.storeMeta.aliasData = output->indexForByteArray(obj->synthdata);
meta.storeMeta.propertyCache = output->propertyCaches.count();
@@ -822,7 +829,7 @@ void QmlCompiler::genObject(QmlParser::Object *obj)
if (!obj->id.isEmpty()) {
QmlInstruction id;
id.type = QmlInstruction::SetId;
- id.line = -1;
+ id.line = 0;
id.setId.value = output->indexForString(obj->id);
id.setId.index = obj->idIndex;
output->bytecode << id;
@@ -832,7 +839,7 @@ void QmlCompiler::genObject(QmlParser::Object *obj)
for (int ii = 0; ii < obj->scriptBlocks.count(); ++ii) {
QmlInstruction script;
script.type = QmlInstruction::StoreScript;
- script.line = -1; // ###
+ script.line = 0; // ###
script.storeScript.fileName = output->indexForString(obj->scriptBlocksFile.at(ii));
script.storeScript.lineNumber = obj->scriptBlocksLineNumber.at(ii);
script.storeScript.value = output->indexForString(obj->scriptBlocks.at(ii));
@@ -999,7 +1006,7 @@ void QmlCompiler::genComponent(QmlParser::Object *obj)
if (!obj->id.isEmpty()) {
QmlInstruction id;
id.type = QmlInstruction::SetId;
- id.line = -1;
+ id.line = 0;
id.setId.value = output->indexForString(obj->id);
id.setId.index = obj->idIndex;
output->bytecode << id;
@@ -1017,18 +1024,18 @@ bool QmlCompiler::buildComponent(QmlParser::Object *obj,
if (obj->properties.count() > 1 ||
(obj->properties.count() == 1 && obj->properties.begin().key() != "id") ||
!obj->scriptBlockObjects.isEmpty())
- COMPILE_EXCEPTION(obj, "Invalid component specification");
+ COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Invalid component specification"));
if (obj->properties.count())
idProp = *obj->properties.begin();
if (idProp && (idProp->value || idProp->values.count() > 1 || !isValidId(idProp->values.first()->primitive())))
- COMPILE_EXCEPTION(obj, "Invalid component id specification");
+ COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Invalid component id specification"));
if (idProp) {
QString idVal = idProp->values.first()->primitive();
if (compileState.ids.contains(idVal))
- COMPILE_EXCEPTION(obj, "id is not unique");
+ COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","id is not unique"));
obj->id = idVal;
addId(idVal, obj);
@@ -1038,14 +1045,14 @@ bool QmlCompiler::buildComponent(QmlParser::Object *obj,
if (obj->defaultProperty &&
(obj->defaultProperty->value || obj->defaultProperty->values.count() > 1 ||
(obj->defaultProperty->values.count() == 1 && !obj->defaultProperty->values.first()->object)))
- COMPILE_EXCEPTION(obj, "Invalid component body specification");
+ COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Invalid component body specification"));
Object *root = 0;
if (obj->defaultProperty && obj->defaultProperty->values.count())
root = obj->defaultProperty->values.first()->object;
if (!root)
- COMPILE_EXCEPTION(obj, "Cannot create empty component specification");
+ COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Cannot create empty component specification"));
// Build the component tree
COMPILE_CHECK(buildComponentFromRoot(root, ctxt));
@@ -1064,11 +1071,11 @@ bool QmlCompiler::buildScript(QmlParser::Object *obj, QmlParser::Object *script)
Property *source = *script->properties.begin();
if (script->defaultProperty)
- COMPILE_EXCEPTION(source, "Invalid Script block. Specify either the source property or inline script.");
+ COMPILE_EXCEPTION(source, qApp->translate("QmlCompiler","Invalid Script block. Specify either the source property or inline script."));
if (source->value || source->values.count() != 1 ||
source->values.at(0)->object || !source->values.at(0)->value.isString())
- COMPILE_EXCEPTION(source, "Invalid Script source value");
+ COMPILE_EXCEPTION(source, qApp->translate("QmlCompiler","Invalid Script source value"));
sourceUrl = output->url.resolved(QUrl(source->values.at(0)->value.asString())).toString();
@@ -1080,7 +1087,7 @@ bool QmlCompiler::buildScript(QmlParser::Object *obj, QmlParser::Object *script)
}
} else if (!script->properties.isEmpty()) {
- COMPILE_EXCEPTION(*script->properties.begin(), "Properties cannot be set on Script block");
+ COMPILE_EXCEPTION(*script->properties.begin(), qApp->translate("QmlCompiler","Properties cannot be set on Script block"));
} else if (script->defaultProperty) {
sourceUrl = output->url.toString();
@@ -1091,7 +1098,7 @@ bool QmlCompiler::buildScript(QmlParser::Object *obj, QmlParser::Object *script)
if (lineNumber == 1)
lineNumber = v->location.start.line;
if (v->object || !v->value.isString())
- COMPILE_EXCEPTION(v, "Invalid Script block");
+ COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid Script block"));
if (ii == 0) {
currentLocation = v->location.start;
@@ -1197,7 +1204,7 @@ bool QmlCompiler::buildSignal(QmlParser::Property *prop, QmlParser::Object *obj,
Q_ASSERT(obj->metaObject());
if (prop->isEmpty())
- COMPILE_EXCEPTION(prop, "Empty property assignment");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Empty property assignment"));
QByteArray name = prop->name;
Q_ASSERT(name.startsWith("on"));
@@ -1216,7 +1223,7 @@ bool QmlCompiler::buildSignal(QmlParser::Property *prop, QmlParser::Object *obj,
} else {
if (prop->value || prop->values.count() > 1)
- COMPILE_EXCEPTION(prop, "Incorrectly specified signal");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Incorrectly specified signal"));
prop->index = sigIdx;
obj->addSignalProperty(prop);
@@ -1261,7 +1268,7 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
const BindingContext &ctxt)
{
if (prop->isEmpty())
- COMPILE_EXCEPTION(prop, "Empty property assignment");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Empty property assignment"));
const QMetaObject *metaObject = obj->metaObject();
Q_ASSERT(metaObject);
@@ -1273,7 +1280,7 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
// Attached properties cannot be used on sub-objects. Sub-objects
// always exist in a binding sub-context, which is what we test
// for here.
- COMPILE_EXCEPTION(prop, "Attached properties cannot be used here");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Attached properties cannot be used here"));
}
QmlType *type = 0;
@@ -1288,11 +1295,11 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
ctxt));
return true;
} else if (!type || !type->attachedPropertiesType()) {
- COMPILE_EXCEPTION(prop, "Non-existant attached object");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Non-existant attached object"));
}
if (!prop->value)
- COMPILE_EXCEPTION(prop, "Invalid attached object assignment");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid attached object assignment"));
Q_ASSERT(type->attachedPropertiesFunction());
prop->index = type->index();
@@ -1350,9 +1357,9 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
} else if (prop->index == -1) {
if (prop->isDefault) {
- COMPILE_EXCEPTION(prop->values.first(), "Cannot assign to non-existant default property");
+ COMPILE_EXCEPTION(prop->values.first(), qApp->translate("QmlCompiler","Cannot assign to non-existant default property"));
} else {
- COMPILE_EXCEPTION(prop, "Cannot assign to non-existant property" << prop->name);
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name)));
}
} else if (prop->value) {
@@ -1380,12 +1387,12 @@ QmlCompiler::buildPropertyInNamespace(QmlEnginePrivate::ImportedNamespace *ns,
const BindingContext &ctxt)
{
if (!nsProp->value)
- COMPILE_EXCEPTION(nsProp, "Invalid use of namespace");
+ COMPILE_EXCEPTION(nsProp, qApp->translate("QmlCompiler","Invalid use of namespace"));
foreach (Property *prop, nsProp->value->properties) {
if (!isAttachedPropertyName(prop->name))
- COMPILE_EXCEPTION(prop, "Not an attached property name");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Not an attached property name"));
// Setup attached property data
@@ -1394,10 +1401,10 @@ QmlCompiler::buildPropertyInNamespace(QmlEnginePrivate::ImportedNamespace *ns,
&type, 0, 0, 0);
if (!type || !type->attachedPropertiesType())
- COMPILE_EXCEPTION(prop, "Non-existant attached object");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Non-existant attached object"));
if (!prop->value)
- COMPILE_EXCEPTION(prop, "Invalid attached object assignment");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid attached object assignment"));
Q_ASSERT(type->attachedPropertiesFunction());
prop->index = type->index();
@@ -1531,6 +1538,24 @@ void QmlCompiler::genPropertyAssignment(QmlParser::Property *prop,
store.assignValueSource.castValue = valueType->propertyValueSourceCast();
output->bytecode << store;
+ } else if (v->type == Value::ValueInterceptor) {
+ genObject(v->object);
+
+ QmlInstruction store;
+ store.type = QmlInstruction::StoreValueInterceptor;
+ store.line = v->object->location.start.line;
+ if (valueTypeProperty) {
+ store.assignValueInterceptor.property = QmlMetaPropertyPrivate::saveValueType(valueTypeProperty->index, prop->index);
+ store.assignValueInterceptor.owner = 1;
+ } else {
+ store.assignValueInterceptor.property =
+ QmlMetaPropertyPrivate::saveProperty(prop->index);
+ store.assignValueInterceptor.owner = 0;
+ }
+ QmlType *valueType = QmlMetaType::qmlType(v->object->metatype);
+ store.assignValueInterceptor.castValue = valueType->propertyValueInterceptorCast();
+ output->bytecode << store;
+
} else if (v->type == Value::PropertyBinding) {
genBindingAssignment(v, prop, obj, valueTypeProperty);
@@ -1551,13 +1576,13 @@ bool QmlCompiler::buildIdProperty(QmlParser::Property *prop,
if (prop->value ||
prop->values.count() > 1 ||
prop->values.at(0)->object)
- COMPILE_EXCEPTION(prop, "Invalid use of id property");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid use of id property"));
QmlParser::Value *idValue = prop->values.at(0);
QString val = idValue->primitive();
if (!isValidId(val))
- COMPILE_EXCEPTION(prop, val << "is not a valid object id");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","\"%1\" is not a valid object id").arg(val));
// We disallow id's that conflict with import prefixes and types
QmlEnginePrivate::ImportedNamespace *ns = 0;
@@ -1565,12 +1590,12 @@ bool QmlCompiler::buildIdProperty(QmlParser::Property *prop,
QmlEnginePrivate::get(engine)->resolveType(unit->imports, val.toUtf8(),
&type, 0, 0, 0, &ns);
if (type)
- COMPILE_EXCEPTION(idValue, "id conflicts with type name");
+ COMPILE_EXCEPTION(idValue, qApp->translate("QmlCompiler","id conflicts with type name"));
if (ns)
- COMPILE_EXCEPTION(idValue, "id conflicts with namespace prefix");
+ COMPILE_EXCEPTION(idValue, qApp->translate("QmlCompiler","id conflicts with namespace prefix"));
if (compileState.ids.contains(val))
- COMPILE_EXCEPTION(prop, "id is not unique");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","id is not unique"));
prop->values.at(0)->type = Value::Id;
@@ -1635,7 +1660,7 @@ bool QmlCompiler::buildAttachedProperty(QmlParser::Property *prop,
// font.pointSize: 12
// font.family: "Helvetica"
// }
-// font is a nested property. size and family are not.
+// font is a nested property. pointSize and family are not.
bool QmlCompiler::buildGroupedProperty(QmlParser::Property *prop,
QmlParser::Object *obj,
const BindingContext &ctxt)
@@ -1648,10 +1673,10 @@ bool QmlCompiler::buildGroupedProperty(QmlParser::Property *prop,
static_cast<QmlEnginePrivate *>(QObjectPrivate::get(engine));
if (ep->valueTypes[prop->type]) {
COMPILE_CHECK(buildValueTypeProperty(ep->valueTypes[prop->type],
- prop->value, ctxt.incr()));
+ prop->value, obj, ctxt.incr()));
obj->addValueTypeProperty(prop);
} else {
- COMPILE_EXCEPTION(prop, "Invalid property access");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid property access"));
}
} else {
@@ -1659,8 +1684,7 @@ bool QmlCompiler::buildGroupedProperty(QmlParser::Property *prop,
prop->value->metatype =
QmlEnginePrivate::get(engine)->metaObjectForType(prop->type);
if (!prop->value->metatype)
- COMPILE_EXCEPTION(prop, "Cannot nest non-QObject property" <<
- prop->name);
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Cannot nest non-QObject property \"%1\"").arg(QString::fromUtf8(prop->name)));
obj->addGroupedProperty(prop);
@@ -1672,34 +1696,38 @@ bool QmlCompiler::buildGroupedProperty(QmlParser::Property *prop,
bool QmlCompiler::buildValueTypeProperty(QObject *type,
QmlParser::Object *obj,
+ QmlParser::Object *baseObj,
const BindingContext &ctxt)
{
if (obj->defaultProperty)
- COMPILE_EXCEPTION(obj, "Invalid property use");
+ COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Invalid property use"));
obj->metatype = type->metaObject();
foreach (Property *prop, obj->properties) {
int idx = type->metaObject()->indexOfProperty(prop->name.constData());
if (idx == -1)
- COMPILE_EXCEPTION(prop, "Cannot assign to non-existant property" << prop->name);
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name)));
QMetaProperty p = type->metaObject()->property(idx);
prop->index = idx;
prop->type = p.userType();
if (prop->value || prop->values.count() != 1)
- COMPILE_EXCEPTION(prop, "Invalid property use");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid property use"));
Value *value = prop->values.at(0);
if (value->object) {
bool isPropertyValue = output->types.at(value->object->type).type->propertyValueSourceCast() != -1;
- if (!isPropertyValue) {
- COMPILE_EXCEPTION(prop, "Invalid property use");
+ bool isPropertyInterceptor = output->types.at(value->object->type).type->propertyValueInterceptorCast() != -1;
+ if (!isPropertyValue && !isPropertyInterceptor) {
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid property use"));
} else {
COMPILE_CHECK(buildObject(value->object, ctxt));
- value->type = Value::ValueSource;
- }
+ if (isPropertyInterceptor && prop->parent->synthdata.isEmpty())
+ buildDynamicMeta(baseObj, ForceCreation);
+ value->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor;
+ }
} else if (value->value.isScript()) {
// ### Check for writability
BindingReference reference;
@@ -1750,12 +1778,12 @@ bool QmlCompiler::buildListProperty(QmlParser::Property *prop,
// at runtime.
if (!listTypeIsInterface) {
if (!canCoerce(listType, v->object)) {
- COMPILE_EXCEPTION(v, "Cannot assign object to list");
+ COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Cannot assign object to list"));
}
}
} else {
- COMPILE_EXCEPTION(v, "Cannot assign primitives to lists");
+ COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Cannot assign primitives to lists"));
}
}
@@ -1774,19 +1802,19 @@ bool QmlCompiler::buildListProperty(QmlParser::Property *prop,
// at runtime.
if (!listTypeIsInterface) {
if (!canCoerce(listType, v->object)) {
- COMPILE_EXCEPTION(v, "Cannot assign object to list");
+ COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Cannot assign object to list"));
}
}
} else if (v->value.isScript()) {
if (assignedBinding)
- COMPILE_EXCEPTION(v, "Can only assign one binding to lists");
+ COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Can only assign one binding to lists"));
assignedBinding = true;
COMPILE_CHECK(buildBinding(v, prop, ctxt));
v->type = Value::PropertyBinding;
} else {
- COMPILE_EXCEPTION(v, "Cannot assign primitives to lists");
+ COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Cannot assign primitives to lists"));
}
}
@@ -1864,8 +1892,12 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop,
// Will be true if the assigned type inherits QmlPropertyValueSource
bool isPropertyValue = false;
- if (QmlType *valueType = QmlMetaType::qmlType(v->object->metatype))
+ // Will be true if the assigned type inherits QmlPropertyValueInterceptor
+ bool isPropertyInterceptor = false;
+ if (QmlType *valueType = QmlMetaType::qmlType(v->object->metatype)) {
isPropertyValue = valueType->propertyValueSourceCast() != -1;
+ isPropertyInterceptor = valueType->propertyValueInterceptorCast() != -1;
+ }
// We want to raw metaObject here as the raw metaobject is the
// actual property type before we applied any extensions that might
@@ -1879,7 +1911,7 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop,
if (propertyMetaObject) {
const QMetaObject *c = v->object->metatype;
while(c) {
- isAssignable |= (c == propertyMetaObject);
+ isAssignable |= (QmlMetaPropertyPrivate::equal(c, propertyMetaObject));
c = c->superClass();
}
}
@@ -1902,13 +1934,15 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop,
component->getDefaultProperty()->addValue(componentValue);
v->object = component;
COMPILE_CHECK(buildPropertyObjectAssignment(prop, obj, v, ctxt));
- } else if (isPropertyValue) {
+ } else if (isPropertyValue || isPropertyInterceptor) {
// Assign as a property value source
COMPILE_CHECK(buildObject(v->object, ctxt));
- v->type = Value::ValueSource;
+ if (isPropertyInterceptor && prop->parent->synthdata.isEmpty())
+ buildDynamicMeta(prop->parent, ForceCreation);
+ v->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor;
} else {
- COMPILE_EXCEPTION(v->object, "Cannot assign object to property");
+ COMPILE_EXCEPTION(v->object, qApp->translate("QmlCompiler","Cannot assign object to property"));
}
}
@@ -1953,12 +1987,12 @@ bool QmlCompiler::checkDynamicMeta(QmlParser::Object *obj)
if (prop.isDefaultProperty) {
if (seenDefaultProperty)
- COMPILE_EXCEPTION(obj, "Duplicate default property");
+ COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Duplicate default property"));
seenDefaultProperty = true;
}
if (propNames.contains(prop.name))
- COMPILE_EXCEPTION(obj, "Duplicate property name");
+ COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Duplicate property name"));
propNames.insert(prop.name);
}
@@ -1966,13 +2000,13 @@ bool QmlCompiler::checkDynamicMeta(QmlParser::Object *obj)
for (int ii = 0; ii < obj->dynamicSignals.count(); ++ii) {
QByteArray name = obj->dynamicSignals.at(ii).name;
if (methodNames.contains(name))
- COMPILE_EXCEPTION(obj, "Duplicate signal name");
+ COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Duplicate signal name"));
methodNames.insert(name);
}
for (int ii = 0; ii < obj->dynamicSlots.count(); ++ii) {
QByteArray name = obj->dynamicSlots.at(ii).name;
if (methodNames.contains(name))
- COMPILE_EXCEPTION(obj, "Duplicate method name");
+ COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Duplicate method name"));
methodNames.insert(name);
}
@@ -1994,7 +2028,7 @@ bool QmlCompiler::mergeDynamicMetaProperties(QmlParser::Object *obj)
property = obj->getProperty(p.name);
if (property->value)
- COMPILE_EXCEPTION(property, "Invalid property nesting");
+ COMPILE_EXCEPTION(property, qApp->translate("QmlCompiler","Invalid property nesting"));
for (int ii = 0; ii < p.defaultValue->values.count(); ++ii) {
Value *v = p.defaultValue->values.at(ii);
@@ -2012,7 +2046,8 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
Q_ASSERT(obj);
Q_ASSERT(obj->metatype);
- if (obj->dynamicProperties.isEmpty() &&
+ if (mode != ForceCreation &&
+ obj->dynamicProperties.isEmpty() &&
obj->dynamicSignals.isEmpty() &&
obj->dynamicSlots.isEmpty())
return true;
@@ -2039,7 +2074,7 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
if (-1 != propIdx) {
QMetaProperty prop = obj->metaObject()->property(propIdx);
if (prop.isFinal())
- COMPILE_EXCEPTION(&p, "Cannot override FINAL property");
+ COMPILE_EXCEPTION(&p, qApp->translate("QmlCompiler","Cannot override FINAL property"));
}
if (p.isDefaultProperty &&
@@ -2064,7 +2099,7 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
QmlEnginePrivate *priv = QmlEnginePrivate::get(engine);
if (!priv->resolveType(unit->imports, p.customType, &qmltype,
&url, 0, 0, 0))
- COMPILE_EXCEPTION(&p, "Invalid property type");
+ COMPILE_EXCEPTION(&p, qApp->translate("QmlCompiler","Invalid property type"));
if (!qmltype) {
QmlCompositeTypeData *tdata = priv->typeManager.get(url);
@@ -2072,7 +2107,7 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
Q_ASSERT(tdata->status == QmlCompositeTypeData::Complete);
QmlCompiledData *data = tdata->toCompiledComponent(engine);
- customTypeName = data->root.className();
+ customTypeName = data->root->className();
} else {
customTypeName = qmltype->typeName();
}
@@ -2223,44 +2258,57 @@ bool QmlCompiler::compileAlias(QMetaObjectBuilder &builder,
const Object::DynamicProperty &prop)
{
if (!prop.defaultValue)
- COMPILE_EXCEPTION(obj, "No property alias location");
+ COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","No property alias location"));
if (prop.defaultValue->values.count() != 1 ||
prop.defaultValue->values.at(0)->object ||
!prop.defaultValue->values.at(0)->value.isScript())
- COMPILE_EXCEPTION(prop.defaultValue, "Invalid alias location");
+ COMPILE_EXCEPTION(prop.defaultValue, qApp->translate("QmlCompiler","Invalid alias location"));
QmlJS::AST::Node *node = prop.defaultValue->values.at(0)->value.asAST();
if (!node)
- COMPILE_EXCEPTION(obj, "No property alias location"); // ### Can this happen?
+ COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","No property alias location")); // ### Can this happen?
QStringList alias = astNodeToStringList(node);
- if (alias.count() != 2)
- COMPILE_EXCEPTION(prop.defaultValue, "Invalid alias location");
+ if (alias.count() != 1 && alias.count() != 2)
+ COMPILE_EXCEPTION(prop.defaultValue, qApp->translate("QmlCompiler","Invalid alias location"));
if (!compileState.ids.contains(alias.at(0)))
- COMPILE_EXCEPTION(prop.defaultValue, "Invalid alias location");
+ COMPILE_EXCEPTION(prop.defaultValue, qApp->translate("QmlCompiler","Invalid alias location"));
Object *idObject = compileState.ids[alias.at(0)];
- int propIdx = idObject->metaObject()->indexOfProperty(alias.at(1).toUtf8().constData());
- if (-1 == propIdx)
- COMPILE_EXCEPTION(prop.defaultValue, "Invalid alias location");
+ QByteArray typeName;
+
+ int propIdx = -1;
+ bool writable = false;
+ if (alias.count() == 2) {
+ propIdx = idObject->metaObject()->indexOfProperty(alias.at(1).toUtf8().constData());
- QMetaProperty aliasProperty = idObject->metaObject()->property(propIdx);
+ if (-1 == propIdx)
+ COMPILE_EXCEPTION(prop.defaultValue, qApp->translate("QmlCompiler","Invalid alias location"));
+
+ QMetaProperty aliasProperty = idObject->metaObject()->property(propIdx);
+ writable = aliasProperty.isWritable();
+
+ if (aliasProperty.isEnumType())
+ typeName = "int"; // Avoid introducing a dependency on the aliased metaobject
+ else
+ typeName = aliasProperty.typeName();
+ } else {
+ typeName = idObject->metaObject()->className();
+ typeName += "*";
+ }
data.append((const char *)&idObject->idIndex, sizeof(idObject->idIndex));
data.append((const char *)&propIdx, sizeof(propIdx));
- const char *typeName = aliasProperty.typeName();
- if (aliasProperty.isEnumType())
- typeName = "int"; // Avoid introducing a dependency on the aliased metaobject
-
builder.addSignal(prop.name + "Changed()");
QMetaPropertyBuilder propBuilder =
- builder.addProperty(prop.name, typeName, builder.methodCount() - 1);
+ builder.addProperty(prop.name, typeName.constData(), builder.methodCount() - 1);
propBuilder.setScriptable(true);
+ propBuilder.setWritable(writable);
return true;
}
@@ -2274,7 +2322,7 @@ bool QmlCompiler::buildBinding(QmlParser::Value *value,
QMetaProperty mp = prop->parent->metaObject()->property(prop->index);
if (!mp.isWritable() && !QmlMetaType::isList(prop->type))
- COMPILE_EXCEPTION(prop, "Invalid property assignment:" << QString::fromLatin1(prop->name) << "is a read-only property");
+ COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name)));
BindingReference reference;
reference.expression = value->value;
@@ -2431,7 +2479,7 @@ bool QmlCompiler::canCoerce(int to, QmlParser::Object *from)
const QMetaObject *fromMo = from->metaObject();
while (fromMo) {
- if (fromMo == toMo)
+ if (QmlMetaPropertyPrivate::equal(fromMo, toMo))
return true;
fromMo = fromMo->superClass();
}
@@ -2450,7 +2498,7 @@ bool QmlCompiler::canCoerce(int to, int from)
QmlEnginePrivate::get(engine)->rawMetaObjectForType(from);
while (fromMo) {
- if (fromMo == toMo)
+ if (QmlMetaPropertyPrivate::equal(fromMo, toMo))
return true;
fromMo = fromMo->superClass();
}
@@ -2478,7 +2526,7 @@ QStringList QmlCompiler::deferredProperties(QmlParser::Object *obj)
return QStringList();
QMetaClassInfo classInfo = mo->classInfo(idx);
- QStringList rv = QString(QLatin1String(classInfo.value())).split(QLatin1Char(','));
+ QStringList rv = QString::fromUtf8(classInfo.value()).split(QLatin1Char(','));
return rv;
}
diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h
index 1d27342..cff4937 100644
--- a/src/declarative/qml/qmlcompiler_p.h
+++ b/src/declarative/qml/qmlcompiler_p.h
@@ -104,7 +104,8 @@ public:
int type;
};
- QAbstractDynamicMetaObject root;
+ const QMetaObject *root;
+ QAbstractDynamicMetaObject rootData;
QList<QString> primitives;
QList<float> floatData;
QList<int> intData;
@@ -134,7 +135,7 @@ private:
};
class QMetaObjectBuilder;
-class Q_DECLARATIVE_EXPORT QmlCompiler
+class Q_DECLARATIVE_EXPORT QmlCompiler
{
public:
QmlCompiler();
@@ -191,6 +192,7 @@ private:
const BindingContext &ctxt);
bool buildValueTypeProperty(QObject *type,
QmlParser::Object *obj,
+ QmlParser::Object *baseObj,
const BindingContext &ctxt);
bool buildListProperty(QmlParser::Property *prop,
QmlParser::Object *obj,
@@ -209,7 +211,7 @@ private:
bool doesPropertyExist(QmlParser::Property *prop, QmlParser::Object *obj);
bool testLiteralAssignment(const QMetaProperty &prop,
QmlParser::Value *value);
- enum DynamicMetaMode { IgnoreAliases, ResolveAliases };
+ enum DynamicMetaMode { IgnoreAliases, ResolveAliases, ForceCreation };
bool mergeDynamicMetaProperties(QmlParser::Object *obj);
bool buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode);
bool checkDynamicMeta(QmlParser::Object *obj);
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp
index 5b1cbeb..9a761b2 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qmlcomponent.cpp
@@ -573,7 +573,7 @@ void QmlComponentPrivate::completeCreate()
bindValues.at(ii);
for (int jj = 0; jj < bv.count; ++jj) {
if(bv.at(jj))
- bv.at(jj)->setEnabled(true);
+ bv.at(jj)->setEnabled(true, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
}
QmlEnginePrivate::clear(bv);
}
diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp
index 71b4ef0..13bd02c 100644
--- a/src/declarative/qml/qmlcompositetypemanager.cpp
+++ b/src/declarative/qml/qmlcompositetypemanager.cpp
@@ -119,7 +119,7 @@ QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine)
compiledComponent = new QmlCompiledData;
compiledComponent->url = imports.baseUrl();
- compiledComponent->name = compiledComponent->url.toString().toLatin1(); // ###
+ compiledComponent->name = compiledComponent->url.toString().toUtf8();
QmlCompiler compiler;
if (!compiler.compile(engine, this, compiledComponent)) {
@@ -443,7 +443,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
int waiting = 0;
for (int ii = 0; ii < types.count(); ++ii) {
QmlScriptParser::TypeReference *parserRef = types.at(ii);
- QByteArray typeName = parserRef->name.toLatin1();
+ QByteArray typeName = parserRef->name.toUtf8();
QmlCompositeTypeData::TypeReference ref;
@@ -458,7 +458,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
if (typeNamespace) {
QmlError error;
error.setUrl(unit->imports.baseUrl());
- error.setDescription(tr("Namespace %1 cannot be used as a type").arg(QLatin1String(typeName)));
+ error.setDescription(tr("Namespace %1 cannot be used as a type").arg(QString::fromUtf8(typeName)));
if (!parserRef->refObjects.isEmpty()) {
QmlParser::Object *obj = parserRef->refObjects.first();
error.setLine(obj->location.start.line);
@@ -500,7 +500,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
{
QmlError error;
error.setUrl(unit->imports.baseUrl());
- error.setDescription(tr("Type %1 unavailable").arg(QLatin1String(typeName)));
+ error.setDescription(tr("Type %1 unavailable").arg(QString::fromUtf8(typeName)));
if (!parserRef->refObjects.isEmpty()) {
QmlParser::Object *obj = parserRef->refObjects.first();
error.setLine(obj->location.start.line);
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index ccdf6cf..ef0f975 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -970,7 +970,7 @@ struct QmlEnginePrivate::ImportedNamespace {
int vmin = minversions.at(i);
if (isBuiltin.at(i)) {
- QByteArray qt = urls.at(i).toLatin1();
+ QByteArray qt = urls.at(i).toUtf8();
qt += "/";
qt += type;
QmlType *t = QmlMetaType::qmlType(qt,vmaj,vmin);
@@ -982,7 +982,7 @@ struct QmlEnginePrivate::ImportedNamespace {
return true;
}
} else {
- QUrl url = QUrl(urls.at(i) + QLatin1String("/" + type + ".qml"));
+ QUrl url = QUrl(urls.at(i) + QLatin1String("/") + QString::fromUtf8(type) + QLatin1String(".qml"));
if (vmaj || vmin) {
// Check version file - XXX cache these in QmlEngine!
QFile qmldir(QUrl(urls.at(i)+QLatin1String("/qmldir")).toLocalFile());
@@ -1101,12 +1101,12 @@ public:
if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return))
return true;
if (s->urls.count() == 1 && !s->isBuiltin[0] && !s->isLibrary[0] && url_return) {
- *url_return = QUrl(s->urls[0]+QLatin1String("/")).resolved(QUrl(QLatin1String(unqualifiedtype + ".qml")));
+ *url_return = QUrl(s->urls[0]+QLatin1String("/")).resolved(QUrl(QString::fromUtf8(unqualifiedtype) + QLatin1String(".qml")));
return true;
}
}
if (url_return) {
- *url_return = base.resolved(QUrl(QLatin1String(type + ".qml")));
+ *url_return = base.resolved(QUrl(QString::fromUtf8(type + ".qml")));
return true;
} else {
return false;
@@ -1323,7 +1323,7 @@ bool QmlEnginePrivate::addToImport(Imports* imports, const QString& uri, const Q
*/
bool QmlEnginePrivate::resolveType(const Imports& imports, const QByteArray& type, QmlType** type_return, QUrl* url_return, int *vmaj, int *vmin, ImportedNamespace** ns_return) const
{
- ImportedNamespace* ns = imports.d->findNamespace(QLatin1String(type));
+ ImportedNamespace* ns = imports.d->findNamespace(QString::fromUtf8(type));
if (ns) {
if (qmlImportTrace())
qDebug() << "QmlEngine::resolveType" << type << "is namespace for" << ns->urls;
@@ -1379,7 +1379,7 @@ static void *voidptr_constructor(const void *v)
void QmlEnginePrivate::registerCompositeType(QmlCompiledData *data)
{
- QByteArray name = data->root.className();
+ QByteArray name = data->root->className();
QByteArray ptr = name + "*";
QByteArray lst = "QmlList<" + ptr + ">*";
@@ -1417,7 +1417,7 @@ const QMetaObject *QmlEnginePrivate::rawMetaObjectForType(int t) const
{
QHash<int, QmlCompiledData*>::ConstIterator iter = m_compositeTypes.find(t);
if (iter != m_compositeTypes.end()) {
- return &(*iter)->root;
+ return (*iter)->root;
} else {
return QmlMetaType::rawMetaObjectForType(t);
}
@@ -1427,7 +1427,7 @@ const QMetaObject *QmlEnginePrivate::metaObjectForType(int t) const
{
QHash<int, QmlCompiledData*>::ConstIterator iter = m_compositeTypes.find(t);
if (iter != m_compositeTypes.end()) {
- return &(*iter)->root;
+ return (*iter)->root;
} else {
return QmlMetaType::metaObjectForType(t);
}
diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp
index 16129ee..e20616a 100644
--- a/src/declarative/qml/qmlenginedebug.cpp
+++ b/src/declarative/qml/qmlenginedebug.cpp
@@ -325,8 +325,8 @@ void QmlEngineDebugServer::propertyChanged(int id, int objectId, const QByteArra
QString objectName = o->objectName();
if (objectName.isEmpty())
objectName = QLatin1String("<unnamed>");
- v = QLatin1String(o->metaObject()->className()) +
- QLatin1String(": ") + objectName;
+ v = QString::fromUtf8(o->metaObject()->className()) +
+ QLatin1String(": ") + objectName;
}
if (v.isNull())
v = value.toString();
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp
index 0de64d9..76ca2c1 100644
--- a/src/declarative/qml/qmlexpression.cpp
+++ b/src/declarative/qml/qmlexpression.cpp
@@ -212,7 +212,7 @@ QString QmlExpression::expression() const
{
Q_D(const QmlExpression);
if (d->data->sse.isValid())
- return QLatin1String(d->data->sse.expression());
+ return QString::fromUtf8(d->data->sse.expression());
else
return d->data->expression;
}
diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp
index 7d7f3b8..862d6ba 100644
--- a/src/declarative/qml/qmlinfo.cpp
+++ b/src/declarative/qml/qmlinfo.cpp
@@ -42,18 +42,19 @@
#include "qmlinfo.h"
#include <private/qmldeclarativedata_p.h>
#include <QtDeclarative/qmlcontext.h>
+#include <QtGui/qapplication.h>
QT_BEGIN_NAMESPACE
/*!
- \class QmlInfo
- \brief The QmlInfo class prints warnings messages that include the file and line number for QML types.
+ \fn void qmlInfo(const QString& message, QObject *object)
+
+ \brief Prints warnings messages that include the file and line number for QML types.
When QML types display warning messages, it improves tracibility
if they include the QML file and line number on which the
particular instance was instantiated.
- QmlInfo statements work just like regular Qt qDebug() statements.
To include the file and line number, an object must be passed. If
the file and line number is not available for that instance
(either it was not instantiated by the QML engine or location
@@ -62,7 +63,7 @@ QT_BEGIN_NAMESPACE
For example,
\code
- qmlInfo(this) << "component property is a write-once property";
+ qmlInfo(object, tr("component property is a write-once property"));
\endcode
prints
@@ -72,46 +73,30 @@ QT_BEGIN_NAMESPACE
\endcode
*/
-/*!
- Construct a QmlInfo, using \a object for file and line number
- information.
-*/
-QmlInfo::QmlInfo(QObject *object)
-: QDebug(QtWarningMsg)
+void qmlInfo(const QString& msg, QObject* object)
{
- *this << "QML";
- if (object)
- *this << object->metaObject()->className();
+ QString pos = QLatin1String("QML");
+ if (object) {
+ pos += " ";
+ pos += QLatin1String(object->metaObject()->className());
+ }
QmlDeclarativeData *ddata = QmlDeclarativeData::get(object);
+ pos += QLatin1String(" (");
if (ddata) {
- QString location = QLatin1String("(");
if (ddata->outerContext) {
- location += ddata->outerContext->baseUrl().toString();
+ pos += ddata->outerContext->baseUrl().toString();
} else {
- location += QLatin1String("unknown");
+ pos += qApp->translate("QmlInfo","unknown");
}
- location += QLatin1String(":");
- location += QString::number(ddata->lineNumber);
- location += QLatin1String(":");
- location += QString::number(ddata->columnNumber);
- location += QLatin1String(")");
- *this << location.toLatin1().constData();
+ pos += QLatin1String(":");
+ pos += QString::number(ddata->lineNumber);
+ pos += QLatin1String(":");
+ pos += QString::number(ddata->columnNumber);
} else {
- *this << "(unknown location):";
+ pos += qApp->translate("QmlInfo","unknown location");
}
+ pos += QLatin1String(") ");
+ qWarning((pos + msg).toLocal8Bit()); // XXX allow other processing?
}
-/*!
- The destructor does nothing special.
-*/
-QmlInfo::~QmlInfo()
-{
-}
-
-/*!
- \relates QmlInfo
- \fn QmlInfo qmlInfo(QObject *me)
- Constructs an instance of QmlInfo from \a me and returns it.
-*/
-
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlinfo.h b/src/declarative/qml/qmlinfo.h
index da8144c..f2d17fe 100644
--- a/src/declarative/qml/qmlinfo.h
+++ b/src/declarative/qml/qmlinfo.h
@@ -50,17 +50,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class Q_DECLARATIVE_EXPORT QmlInfo : public QDebug
-{
-public:
- QmlInfo(QObject *);
- ~QmlInfo();
-};
-
-Q_DECLARATIVE_EXPORT inline QmlInfo qmlInfo(QObject *me)
-{
- return QmlInfo(me);
-}
+Q_DECLARATIVE_EXPORT void qmlInfo(const QString& msg, QObject *me=0);
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp
index 18439f4..a465445 100644
--- a/src/declarative/qml/qmlinstruction.cpp
+++ b/src/declarative/qml/qmlinstruction.cpp
@@ -149,6 +149,9 @@ void QmlCompiledData::dump(QmlInstruction *instr, int idx)
case QmlInstruction::StoreValueSource:
qWarning() << idx << "\t" << line << "\t" << "STORE_VALUE_SOURCE\t" << instr->assignValueSource.property << "\t" << instr->assignValueSource.castValue;
break;
+ case QmlInstruction::StoreValueInterceptor:
+ qWarning() << idx << "\t" << line << "\t" << "STORE_VALUE_INTERCEPTOR\t" << instr->assignValueInterceptor.property << "\t" << instr->assignValueInterceptor.castValue;
+ break;
case QmlInstruction::BeginObject:
qWarning() << idx << "\t" << line << "\t" << "BEGIN\t\t\t" << instr->begin.castValue;
break;
diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h
index 0da40c3..5265d42 100644
--- a/src/declarative/qml/qmlinstruction_p.h
+++ b/src/declarative/qml/qmlinstruction_p.h
@@ -130,6 +130,7 @@ public:
StoreIdOptBinding, /* assignIdOptBinding */
StoreObjPropBinding, /* assignObjPropBinding */
StoreValueSource, /* assignValueSource */
+ StoreValueInterceptor, /* assignValueInterceptor */
BeginObject, /* begin */
@@ -190,6 +191,11 @@ public:
} assignValueSource;
struct {
int property;
+ int owner;
+ int castValue;
+ } assignValueInterceptor; //### merge with above
+ struct {
+ int property;
int value;
short context;
short owner;
diff --git a/src/declarative/qml/qmlintegercache.cpp b/src/declarative/qml/qmlintegercache.cpp
index 564faaa..89a18a1 100644
--- a/src/declarative/qml/qmlintegercache.cpp
+++ b/src/declarative/qml/qmlintegercache.cpp
@@ -87,7 +87,7 @@ QmlIntegerCache *QmlIntegerCache::createForEnums(QmlType *type, QmlEngine *engin
QMetaEnum enumerator = mo->enumerator(ii);
for (int jj = 0; jj < enumerator.keyCount(); ++jj) {
- QString name = QLatin1String(enumerator.key(jj));
+ QString name = QString::fromUtf8(enumerator.key(jj));
int value = enumerator.value(jj);
if (!name.at(0).isUpper())
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index a43f6c3..86116c7 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -174,7 +174,7 @@ void QmlMetaPropertyPrivate::initProperty(QObject *obj, const QString &name)
if (typeData) {
QmlType *t = 0;
- enginePrivate->resolveType(typeData->imports, name.toLatin1(), &t, 0, 0, 0, 0);
+ enginePrivate->resolveType(typeData->imports, name.toUtf8(), &t, 0, 0, 0, 0);
if (t && t->attachedPropertiesFunction()) {
attachedFunc = t->index();
}
@@ -467,7 +467,7 @@ QStringList QmlMetaProperty::properties(QObject *obj)
const QMetaObject *mo = obj->metaObject();
for (int ii = 0; ii < mo->propertyCount(); ++ii) {
QMetaProperty prop = mo->property(ii);
- rv << QLatin1String(prop.name());
+ rv << QString::fromUtf8(prop.name());
}
return rv;
@@ -487,7 +487,7 @@ QString QmlMetaProperty::name() const
else valueType = QmlValueTypeFactory::valueType(d->core.propType);
Q_ASSERT(valueType);
- rv += QLatin1String(valueType->metaObject()->property(d->valueTypeCoreIdx).name());
+ rv += QString::fromUtf8(valueType->metaObject()->property(d->valueTypeCoreIdx).name());
if (!ep) delete valueType;
@@ -559,17 +559,17 @@ QmlAbstractBinding *QmlMetaProperty::binding() const
is assumed by the caller.
*/
QmlAbstractBinding *
-QmlMetaProperty::setBinding(QmlAbstractBinding *newBinding) const
+QmlMetaProperty::setBinding(QmlAbstractBinding *newBinding, QmlMetaProperty::WriteFlags flags) const
{
if (!isProperty() || (type() & Attached) || !d->object)
return 0;
- return d->setBinding(d->object, d->core, newBinding);
+ return d->setBinding(d->object, d->core, newBinding, flags);
}
QmlAbstractBinding *
QmlMetaPropertyPrivate::setBinding(QObject *object, const QmlPropertyCache::Data &core,
- QmlAbstractBinding *newBinding)
+ QmlAbstractBinding *newBinding, QmlMetaProperty::WriteFlags flags)
{
QmlDeclarativeData *data = QmlDeclarativeData::get(object, 0 != newBinding);
@@ -581,7 +581,7 @@ QmlMetaPropertyPrivate::setBinding(QObject *object, const QmlPropertyCache::Data
binding->setEnabled(false);
if (newBinding)
- newBinding->setEnabled(true);
+ newBinding->setEnabled(true, flags);
return binding; // ### QmlAbstractBinding;
}
@@ -591,7 +591,7 @@ QmlMetaPropertyPrivate::setBinding(QObject *object, const QmlPropertyCache::Data
}
if (newBinding)
- newBinding->setEnabled(true);
+ newBinding->setEnabled(true, flags);
return 0;
}
@@ -654,7 +654,7 @@ QMetaMethod QmlMetaPropertyPrivate::findSignal(QObject *obj, const QString &name
int methods = mo->methodCount();
for (int ii = methods - 1; ii >= 0; --ii) {
QMetaMethod method = mo->method(ii);
- QString methodName = QLatin1String(method.signature());
+ QString methodName = QString::fromUtf8(method.signature());
int idx = methodName.indexOf(QLatin1Char('('));
methodName = methodName.left(idx);
@@ -728,11 +728,51 @@ QVariant QmlMetaPropertyPrivate::readValueProperty()
}
}
+//###
+//writeEnumProperty MIRRORS the relelvant bit of QMetaProperty::write AND MUST BE KEPT IN SYNC!
+//###
+bool QmlMetaPropertyPrivate::writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object, const QVariant &value, int flags)
+{
+ if (!object || !prop.isWritable())
+ return false;
+
+ QVariant v = value;
+ if (prop.isEnumType()) {
+ QMetaEnum menum = prop.enumerator();
+ if (v.type() == QVariant::String
+#ifdef QT3_SUPPORT
+ || v.type() == QVariant::CString
+#endif
+ ) {
+ if (prop.isFlagType())
+ v = QVariant(menum.keysToValue(value.toByteArray()));
+ else
+ v = QVariant(menum.keyToValue(value.toByteArray()));
+ } else if (v.type() != QVariant::Int && v.type() != QVariant::UInt) {
+ int enumMetaTypeId = QMetaType::type(QByteArray(menum.scope()) + "::" + menum.name());
+ if ((enumMetaTypeId == 0) || (v.userType() != enumMetaTypeId) || !v.constData())
+ return false;
+ v = QVariant(*reinterpret_cast<const int *>(v.constData()));
+ }
+ v.convert(QVariant::Int);
+ }
+
+ // the status variable is changed by qt_metacall to indicate what it did
+ // this feature is currently only used by QtDBus and should not be depended
+ // upon. Don't change it without looking into QDBusAbstractInterface first
+ // -1 (unchanged): normal qt_metacall, result stored in argv[0]
+ // changed: result stored directly in value, return the value of status
+ int status = -1;
+ void *argv[] = { v.data(), &v, &status, &flags };
+ QMetaObject::metacall(object, QMetaObject::WriteProperty, idx, argv);
+ return status;
+}
+
void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value,
- QmlMetaProperty::WriteSource source)
+ QmlMetaProperty::WriteFlags flags)
{
// Remove any existing bindings on this property
- if (source != QmlMetaProperty::Binding)
+ if (!(flags & QmlMetaProperty::DontRemoveBinding))
delete q->setBinding(0);
uint type = q->type();
@@ -752,22 +792,23 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value,
QmlPropertyCache::Data data = core;
data.coreIndex = valueTypeCoreIdx;
data.propType = valueTypePropType;
- write(writeBack, data, value, context);
+ write(writeBack, data, value, context, flags);
- writeBack->write(object, core.coreIndex);
+ writeBack->write(object, core.coreIndex, flags);
if (!ep) delete writeBack;
} else {
- write(object, core, value, context);
+ write(object, core, value, context, flags);
}
}
void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data &property,
- const QVariant &value, QmlContext *context)
+ const QVariant &value, QmlContext *context, QmlMetaProperty::WriteFlags flags)
{
int coreIdx = property.coreIndex;
+ int status = -1; //for dbus
if (property.flags & QmlPropertyCache::Data::IsEnumType) {
QMetaProperty prop = object->metaObject()->property(property.coreIndex);
@@ -779,7 +820,7 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data
if (qFuzzyCompare(fractional, (double)0.0))
v.convert(QVariant::Int);
}
- prop.write(object, v);
+ writeEnumProperty(prop, coreIdx, object, v, flags);
return;
}
@@ -795,7 +836,7 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data
u = value.toUrl();
found = true;
} else if (vt == QVariant::ByteArray) {
- u = QUrl(QLatin1String(value.toByteArray()));
+ u = QUrl(QString::fromUtf8(value.toByteArray()));
found = true;
} else if (vt == QVariant::String) {
u = QUrl(value.toString());
@@ -805,21 +846,19 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data
if (found) {
if (context && u.isRelative() && !u.isEmpty())
u = context->baseUrl().resolved(u);
- void *a[1];
- a[0] = &u;
- QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
+ int status = -1;
+ void *argv[] = { &u, 0, &status, &flags };
+ QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, argv);
}
} else if (vt == t) {
- void *a[1];
- a[0] = (void *)value.constData();
+ void *a[] = { (void *)value.constData(), 0, &status, &flags };
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
} else if (qMetaTypeId<QVariant>() == t) {
- void *a[1];
- a[0] = (void *)&value;
+ void *a[] = { (void *)&value, 0, &status, &flags };
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
} else if (property.flags & QmlPropertyCache::Data::IsQObjectDerived) {
@@ -834,7 +873,7 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data
const QMetaObject *propMo = QmlMetaType::rawMetaObjectForType(t);
while (valMo) {
- if (valMo == propMo)
+ if (equal(valMo, propMo))
break;
valMo = valMo->superClass();
}
@@ -843,7 +882,7 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data
if (valMo || !o) {
- void *args[] = { &o, 0 };
+ void *args[] = { &o, 0, &status, &flags };
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx,
args);
@@ -888,7 +927,7 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data
const QMetaObject *objMo = obj->metaObject();
bool found = false;
while(!found && objMo) {
- if (objMo == mo)
+ if (equal(objMo, mo))
found = true;
else
objMo = objMo->superClass();
@@ -909,16 +948,14 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data
QVariant v = value;
if (v.convert((QVariant::Type)t)) {
- void *a[1];
- a[0] = (void *)v.constData();
+ void *a[] = { (void *)v.constData(), 0, &status, &flags};
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
} else if ((uint)t >= QVariant::UserType && vt == QVariant::String) {
QmlMetaType::StringConverter con = QmlMetaType::customStringConverter(t);
if (con) {
QVariant v = con(value.toString());
if (v.userType() == t) {
- void *a[1];
- a[0] = (void *)v.constData();
+ void *a[] = { (void *)v.constData(), 0, &status, &flags};
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
}
}
@@ -931,17 +968,17 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data
*/
void QmlMetaProperty::write(const QVariant &value) const
{
- write(value, Other);
+ write(value, 0);
}
-void QmlMetaProperty::write(const QVariant &value, WriteSource source) const
+void QmlMetaProperty::write(const QVariant &value, QmlMetaProperty::WriteFlags flags) const
{
if (!d->object)
return;
if (type() & Property && d->core.isValid()) {
- d->writeValueProperty(value, source);
+ d->writeValueProperty(value, flags);
}
}
@@ -1173,4 +1210,13 @@ QmlMetaProperty QmlMetaProperty::createProperty(QObject *obj,
return prop;
}
+/*!
+ Returns true if lhs and rhs refer to the same metaobject data
+*/
+bool QmlMetaPropertyPrivate::equal(const QMetaObject *lhs, const QMetaObject *rhs)
+{
+ return lhs == rhs || (1 && lhs && rhs && lhs->d.stringdata == rhs->d.stringdata);
+}
+
+
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlmetaproperty.h b/src/declarative/qml/qmlmetaproperty.h
index 8c34ece..b0ae28c 100644
--- a/src/declarative/qml/qmlmetaproperty.h
+++ b/src/declarative/qml/qmlmetaproperty.h
@@ -88,8 +88,9 @@ public:
QVariant read() const;
void write(const QVariant &) const;
- enum WriteSource { Animation, Binding, Other };
- void write(const QVariant &, WriteSource) const;
+ enum WriteFlag { BypassInterceptor = 0x01, DontRemoveBinding = 0x02 };
+ Q_DECLARE_FLAGS(WriteFlags, WriteFlag)
+ void write(const QVariant &, QmlMetaProperty::WriteFlags) const;
bool hasChangedNotifier() const;
bool needsChangedNotifier() const;
@@ -126,7 +127,8 @@ public:
QMetaProperty property() const;
QmlAbstractBinding *binding() const;
- QmlAbstractBinding *setBinding(QmlAbstractBinding *) const;
+ QmlAbstractBinding *setBinding(QmlAbstractBinding *,
+ QmlMetaProperty::WriteFlags flags = QmlMetaProperty::DontRemoveBinding) const;
QmlExpression *signalExpression() const;
QmlExpression *setSignalExpression(QmlExpression *) const;
@@ -139,6 +141,7 @@ private:
QmlMetaPropertyPrivate *d;
};
typedef QList<QmlMetaProperty> QmlMetaProperties;
+ Q_DECLARE_OPERATORS_FOR_FLAGS(QmlMetaProperty::WriteFlags)
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlmetaproperty_p.h b/src/declarative/qml/qmlmetaproperty_p.h
index 4576b71..7288266 100644
--- a/src/declarative/qml/qmlmetaproperty_p.h
+++ b/src/declarative/qml/qmlmetaproperty_p.h
@@ -97,12 +97,17 @@ public:
QmlMetaProperty::PropertyCategory propertyCategory() const;
QVariant readValueProperty();
- void writeValueProperty(const QVariant &, QmlMetaProperty::WriteSource);
- static void write(QObject *, const QmlPropertyCache::Data &, const QVariant &, QmlContext *);
- static QmlAbstractBinding *setBinding(QObject *, const QmlPropertyCache::Data &, QmlAbstractBinding *);
+ void writeValueProperty(const QVariant &, QmlMetaProperty::WriteFlags);
+ static bool writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object, const QVariant &value, int flags);
+ static void write(QObject *, const QmlPropertyCache::Data &, const QVariant &, QmlContext *,
+ QmlMetaProperty::WriteFlags flags = 0);
+ static QmlAbstractBinding *setBinding(QObject *, const QmlPropertyCache::Data &, QmlAbstractBinding *,
+ QmlMetaProperty::WriteFlags flags = QmlMetaProperty::DontRemoveBinding);
static quint32 saveValueType(int, int);
static quint32 saveProperty(int);
+
+ static bool equal(const QMetaObject *, const QMetaObject *);
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp
index c40232f..5198f9f 100644
--- a/src/declarative/qml/qmlmetatype.cpp
+++ b/src/declarative/qml/qmlmetatype.cpp
@@ -128,6 +128,7 @@ public:
const QMetaObject *m_attachedPropertiesType;
int m_parserStatusCast;
int m_propertyValueSourceCast;
+ int m_propertyValueInterceptorCast;
QmlPrivate::CreateFunc m_extFunc;
const QMetaObject *m_extMetaObject;
int m_index;
@@ -140,8 +141,8 @@ public:
QmlTypePrivate::QmlTypePrivate()
: m_isInterface(false), m_iid(0), m_typeId(0), m_listId(0), m_qmlListId(0),
m_opFunc(0), m_baseMetaObject(0), m_attachedPropertiesFunc(0), m_attachedPropertiesType(0),
- m_parserStatusCast(-1), m_propertyValueSourceCast(-1), m_extFunc(0), m_extMetaObject(0),
- m_index(-1), m_customParser(0), m_isSetup(false)
+ m_parserStatusCast(-1), m_propertyValueSourceCast(-1), m_propertyValueInterceptorCast(-1),
+ m_extFunc(0), m_extMetaObject(0), m_index(-1), m_customParser(0), m_isSetup(false)
{
}
@@ -169,7 +170,8 @@ QmlType::QmlType(int type, int listType, int qmlListType,
const QMetaObject *metaObject,
QmlAttachedPropertiesFunc attachedPropertiesFunc,
const QMetaObject *attachedType,
- int parserStatusCast, int propertyValueSourceCast, QmlPrivate::CreateFunc extFunc,
+ int parserStatusCast, int propertyValueSourceCast, int propertyValueInterceptorCast,
+ QmlPrivate::CreateFunc extFunc,
const QMetaObject *extMetaObject, int index,
QmlCustomParser *customParser)
: d(new QmlTypePrivate)
@@ -187,6 +189,7 @@ QmlType::QmlType(int type, int listType, int qmlListType,
d->m_attachedPropertiesType = attachedType;
d->m_parserStatusCast = parserStatusCast;
d->m_propertyValueSourceCast = propertyValueSourceCast;
+ d->m_propertyValueInterceptorCast = propertyValueInterceptorCast;
d->m_extFunc = extFunc;
d->m_index = index;
d->m_customParser = customParser;
@@ -412,6 +415,11 @@ int QmlType::propertyValueSourceCast() const
return d->m_propertyValueSourceCast;
}
+int QmlType::propertyValueInterceptorCast() const
+{
+ return d->m_propertyValueInterceptorCast;
+}
+
QVariant QmlType::fromObject(QObject *obj) const
{
QVariant rv;
@@ -467,7 +475,7 @@ int QmlMetaType::registerInterface(const QmlPrivate::MetaTypeIds &id,
int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Func func,
const char *uri, int version_maj, int version_min_from, int version_min_to, const char *cname,
const QMetaObject *mo, QmlAttachedPropertiesFunc attach, const QMetaObject *attachMo,
- int pStatus, int object, int valueSource, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *parser)
+ int pStatus, int object, int valueSource, int valueInterceptor, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *parser)
{
Q_UNUSED(object);
@@ -492,7 +500,7 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Fun
QmlType *type = new QmlType(id.typeId, id.listId, id.qmlListId,
func, name, version_maj, version_min_from, version_min_to, mo, attach, attachMo, pStatus,
- valueSource, extFunc, extmo, index, parser);
+ valueSource, valueInterceptor, extFunc, extmo, index, parser);
data->types.append(type);
data->idToType.insert(type->typeId(), type);
@@ -539,6 +547,17 @@ int QmlMetaType::qmlPropertyValueSourceCast(int userType)
return -1;
}
+int QmlMetaType::qmlPropertyValueInterceptorCast(int userType)
+{
+ QReadLocker lock(metaTypeDataLock());
+ QmlMetaTypeData *data = metaTypeData();
+ QmlType *type = data->idToType.value(userType);
+ if (type && type->typeId() == userType)
+ return type->propertyValueInterceptorCast();
+ else
+ return -1;
+}
+
QObject *QmlMetaType::toQObject(const QVariant &v)
{
if (!isObject(v.userType()))
diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h
index 02c817d..42c278c 100644
--- a/src/declarative/qml/qmlmetatype.h
+++ b/src/declarative/qml/qmlmetatype.h
@@ -48,6 +48,7 @@
#include <QtDeclarative/qmlprivate.h>
#include <QtDeclarative/qmlparserstatus.h>
#include <QtDeclarative/qmlpropertyvaluesource.h>
+#include <QtDeclarative/qmlpropertyvalueinterceptor.h>
QT_BEGIN_HEADER
@@ -60,7 +61,7 @@ class QmlCustomParser;
class Q_DECLARATIVE_EXPORT QmlMetaType
{
public:
- static int registerType(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *, int vmaj, int vmin_from, int vmin_to, const char *qmlName, const QMetaObject *, QmlAttachedPropertiesFunc, const QMetaObject *, int pStatus, int object, int valueSource, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *);
+ static int registerType(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *, int vmaj, int vmin_from, int vmin_to, const char *qmlName, const QMetaObject *, QmlAttachedPropertiesFunc, const QMetaObject *, int pStatus, int object, int valueSource, int valueInterceptor, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *);
static int registerInterface(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *);
static bool copy(int type, void *data, const void *copy = 0);
@@ -80,6 +81,7 @@ public:
static QObject *toQObject(const QVariant &);
static int qmlParserStatusCast(int);
static int qmlPropertyValueSourceCast(int);
+ static int qmlPropertyValueInterceptorCast(int);
static int listType(int);
static bool clear(const QVariant &);
static bool append(const QVariant &, const QVariant &);
@@ -146,6 +148,7 @@ public:
QVariant fromObject(QObject *) const;
const char *interfaceIId() const;
int propertyValueSourceCast() const;
+ int propertyValueInterceptorCast() const;
int index() const;
private:
@@ -153,7 +156,7 @@ private:
friend class QmlTypePrivate;
friend class QmlMetaTypeData;
QmlType(int, int, int, QmlPrivate::Func, const char *, int);
- QmlType(int, int, int, QmlPrivate::Func, const char *, int, int, int, const QMetaObject *, QmlAttachedPropertiesFunc, const QMetaObject *, int, int, QmlPrivate::CreateFunc, const QMetaObject *, int, QmlCustomParser *);
+ QmlType(int, int, int, QmlPrivate::Func, const char *, int, int, int, const QMetaObject *, QmlAttachedPropertiesFunc, const QMetaObject *, int, int, int, QmlPrivate::CreateFunc, const QMetaObject *, int, QmlCustomParser *);
~QmlType();
QmlTypePrivate *d;
@@ -176,6 +179,7 @@ int qmlRegisterType(const char *typeName)
QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
QmlPrivate::StaticCastSelector<T,QObject>::cast(),
QmlPrivate::StaticCastSelector<T,QmlPropertyValueSource>::cast(),
+ QmlPrivate::StaticCastSelector<T,QmlPropertyValueInterceptor>::cast(),
0, 0, 0);
}
@@ -196,7 +200,8 @@ int qmlRegisterType(const char *uri, int version_maj, int version_min_from, int
QmlPrivate::attachedPropertiesMetaObject<T>(),
QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
QmlPrivate::StaticCastSelector<T,QObject>::cast(),
- QmlPrivate::StaticCastSelector<T,QmlPropertyValueSource>::cast(),
+ QmlPrivate::StaticCastSelector<T,QmlPropertyValueSource>::cast(),
+ QmlPrivate::StaticCastSelector<T,QmlPropertyValueInterceptor>::cast(),
0, 0, 0);
}
@@ -224,6 +229,7 @@ int qmlRegisterExtendedType(const char *typeName)
QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
QmlPrivate::StaticCastSelector<T,QObject>::cast(),
QmlPrivate::StaticCastSelector<T,QmlPropertyValueSource>::cast(),
+ QmlPrivate::StaticCastSelector<T,QmlPropertyValueInterceptor>::cast(),
&QmlPrivate::CreateParent<E>::create, &E::staticMetaObject, 0);
}
@@ -253,6 +259,7 @@ int qmlRegisterExtendedType(const char *uri, int version_maj, int version_min_fr
QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
QmlPrivate::StaticCastSelector<T,QObject>::cast(),
QmlPrivate::StaticCastSelector<T,QmlPropertyValueSource>::cast(),
+ QmlPrivate::StaticCastSelector<T,QmlPropertyValueInterceptor>::cast(),
&QmlPrivate::CreateParent<E>::create,
&E::staticMetaObject, 0);
}
@@ -290,6 +297,7 @@ int qmlRegisterCustomType(const char *uri, int version_maj, int version_min_from
QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
QmlPrivate::StaticCastSelector<T,QObject>::cast(),
QmlPrivate::StaticCastSelector<T,QmlPropertyValueSource>::cast(),
+ QmlPrivate::StaticCastSelector<T,QmlPropertyValueInterceptor>::cast(),
0, 0, parser);
}
diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp
index 41573a2..80f2786 100644
--- a/src/declarative/qml/qmlobjectscriptclass.cpp
+++ b/src/declarative/qml/qmlobjectscriptclass.cpp
@@ -267,7 +267,7 @@ QScriptValue QmlObjectScriptClass::tostring(QScriptContext *context, QScriptEngi
if(obj){
QString objectName = obj->objectName();
- ret += QLatin1String(obj->metaObject()->className());
+ ret += QString::fromUtf8(obj->metaObject()->className());
ret += QLatin1String("(0x");
ret += QString::number((quintptr)obj,16);
diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp
index 8c46939..bae263a 100644
--- a/src/declarative/qml/qmlparser.cpp
+++ b/src/declarative/qml/qmlparser.cpp
@@ -282,6 +282,9 @@ void QmlParser::Value::dump(int indent) const
case Value::ValueSource:
type = "ValueSource";
break;
+ case Value::ValueInterceptor:
+ type = "ValueInterceptor";
+ break;
case Value::CreatedObject:
type = "CreatedObject";
break;
diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h
index d05cc73..88d7d77 100644
--- a/src/declarative/qml/qmlparser_p.h
+++ b/src/declarative/qml/qmlparser_p.h
@@ -275,6 +275,8 @@ namespace QmlParser
PropertyBinding,
// This is used as a QmlPropertyValueSource assignment
ValueSource,
+ // This is used as a QmlPropertyValueInterceptor assignment
+ ValueInterceptor,
// This is used as a property QObject assignment
CreatedObject,
// This is used as a signal object assignment
diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp
index 63ce00c..e00126f 100644
--- a/src/declarative/qml/qmlpropertycache.cpp
+++ b/src/declarative/qml/qmlpropertycache.cpp
@@ -52,7 +52,7 @@ void QmlPropertyCache::Data::load(const QMetaProperty &p)
propType = qMetaTypeId<QVariant>();
coreIndex = p.propertyIndex();
notifyIndex = p.notifySignalIndex();
- name = QLatin1String(p.name());
+ name = QString::fromUtf8(p.name());
if (p.isConstant())
flags |= Data::IsConstant;
@@ -76,7 +76,7 @@ void QmlPropertyCache::Data::load(const QMetaProperty &p)
void QmlPropertyCache::Data::load(const QMetaMethod &m)
{
- name = QLatin1String(m.signature());
+ name = QString::fromUtf8(m.signature());
int parenIdx = name.indexOf(QLatin1Char('('));
Q_ASSERT(parenIdx != -1);
name = name.left(parenIdx);
@@ -120,7 +120,7 @@ QmlPropertyCache::Data QmlPropertyCache::create(const QMetaObject *metaObject,
int methodCount = metaObject->methodCount();
for (int ii = methodCount - 1; ii >= 0; --ii) {
QMetaMethod m = metaObject->method(ii);
- QString methodName = QLatin1String(m.signature());
+ QString methodName = QString::fromUtf8(m.signature());
int parenIdx = methodName.indexOf(QLatin1Char('('));
Q_ASSERT(parenIdx != -1);
@@ -151,7 +151,7 @@ QmlPropertyCache *QmlPropertyCache::create(QmlEngine *engine, const QMetaObject
cache->indexCache.resize(propCount);
for (int ii = propCount - 1; ii >= 0; --ii) {
QMetaProperty p = metaObject->property(ii);
- QString propName = QLatin1String(p.name());
+ QString propName = QString::fromUtf8(p.name());
RData *data = new RData;
data->identifier = enginePriv->objectClass->createPersistentIdentifier(propName);
@@ -172,7 +172,7 @@ QmlPropertyCache *QmlPropertyCache::create(QmlEngine *engine, const QMetaObject
int methodCount = metaObject->methodCount();
for (int ii = methodCount - 1; ii >= 0; --ii) {
QMetaMethod m = metaObject->method(ii);
- QString methodName = QLatin1String(m.signature());
+ QString methodName = QString::fromUtf8(m.signature());
int parenIdx = methodName.indexOf(QLatin1Char('('));
Q_ASSERT(parenIdx != -1);
diff --git a/src/declarative/qml/qmlpropertyvalueinterceptor.cpp b/src/declarative/qml/qmlpropertyvalueinterceptor.cpp
new file mode 100644
index 0000000..86905e6
--- /dev/null
+++ b/src/declarative/qml/qmlpropertyvalueinterceptor.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmlpropertyvalueinterceptor.h"
+#include "qml.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QmlPropertyValueInterceptor
+ \brief The QmlPropertyValueInterceptor class is inherited by property interceptors such as Behavior.
+
+ This class intercepts property writes, allowing for custom handling. For example, Behavior uses this
+ interception to provide a default animation for all changes to a property's value.
+ */
+
+/*!
+ Constructs a QmlPropertyValueInterceptor.
+*/
+QmlPropertyValueInterceptor::QmlPropertyValueInterceptor()
+{
+}
+
+QmlPropertyValueInterceptor::~QmlPropertyValueInterceptor()
+{
+}
+
+/*!
+ \fn void QmlPropertyValueInterceptor::setTarget(const QmlMetaProperty &property)
+ Set the target \a property for the value interceptor. This method will
+ be called by the QML engine when assigning a value interceptor.
+*/
+
+/*!
+ \fn void QmlPropertyValueInterceptor::write(const QVariant &value)
+ This method will be called when a new \a value is assigned to the property being intercepted.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlpropertyvalueinterceptor.h b/src/declarative/qml/qmlpropertyvalueinterceptor.h
new file mode 100644
index 0000000..678c12c
--- /dev/null
+++ b/src/declarative/qml/qmlpropertyvalueinterceptor.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMLPROPERTYVALUEINTERCEPTOR_H
+#define QMLPROPERTYVALUEINTERCEPTOR_H
+
+#include <QtCore/qobject.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class QmlMetaProperty;
+class Q_DECLARATIVE_EXPORT QmlPropertyValueInterceptor
+{
+public:
+ QmlPropertyValueInterceptor();
+ virtual ~QmlPropertyValueInterceptor();
+ virtual void setTarget(const QmlMetaProperty &property) = 0;
+ virtual void write(const QVariant &value) = 0;
+};
+Q_DECLARE_INTERFACE(QmlPropertyValueInterceptor, "com.trolltech.qml.QmlPropertyValueInterceptor")
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QMLPROPERTYVALUEINTERCEPTOR_H
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp
index 1c7bf83..9cc12b3 100644
--- a/src/declarative/qml/qmlscriptparser.cpp
+++ b/src/declarative/qml/qmlscriptparser.cpp
@@ -87,12 +87,12 @@ class ProcessAST: protected AST::Visitor
const State &state = top();
if (state.property) {
State s(state.property->getValue(),
- state.property->getValue()->getProperty(name.toLatin1()));
+ state.property->getValue()->getProperty(name.toUtf8()));
s.property->location = location;
push(s);
} else {
State s(state.object,
- state.object->getProperty(name.toLatin1()));
+ state.object->getProperty(name.toUtf8()));
s.property->location = location;
push(s);
@@ -294,10 +294,11 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName,
if (isScript) {
if (_stateStack.isEmpty() || _stateStack.top().property) {
QmlError error;
- error.setDescription(QLatin1String("Invalid use of Script block"));
+ error.setDescription(QCoreApplication::translate("QmlParser","Invalid use of Script block"));
error.setLine(typeLocation.startLine);
error.setColumn(typeLocation.startColumn);
_parser->_errors << error;
+ return 0;
}
}
@@ -312,7 +313,7 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName,
// XXX this doesn't do anything (_scope never builds up)
_scope.append(resolvableObjectType);
- obj->typeName = qualifiedNameId().toLatin1();
+ obj->typeName = qualifiedNameId().toUtf8();
_scope.removeLast();
obj->location = location;
@@ -474,7 +475,7 @@ bool ProcessAST::visit(AST::UiImport *node)
import.qualifier = node->importId->asString();
if (!import.qualifier.at(0).isUpper()) {
QmlError error;
- error.setDescription(QLatin1String("Invalid import qualifier ID"));
+ error.setDescription(QCoreApplication::translate("QmlParser","Invalid import qualifier ID"));
error.setLine(node->importIdToken.startLine);
error.setColumn(node->importIdToken.startColumn);
_parser->_errors << error;
@@ -483,6 +484,14 @@ bool ProcessAST::visit(AST::UiImport *node)
}
if (node->versionToken.isValid())
import.version = textAt(node->versionToken);
+ else if (import.type == QmlScriptParser::Import::Library) {
+ QmlError error;
+ error.setDescription(QCoreApplication::translate("QmlParser","Library import requires a version"));
+ error.setLine(node->importIdToken.startLine);
+ error.setColumn(node->importIdToken.startColumn);
+ _parser->_errors << error;
+ return false;
+ }
import.location = location(startLoc, endLoc);
import.uri = uri;
diff --git a/src/declarative/qml/qmltypenamescriptclass.cpp b/src/declarative/qml/qmltypenamescriptclass.cpp
index c0613d1..7a14432 100644
--- a/src/declarative/qml/qmltypenamescriptclass.cpp
+++ b/src/declarative/qml/qmltypenamescriptclass.cpp
@@ -115,11 +115,11 @@ QmlTypeNameScriptClass::queryProperty(Object *obj, const Identifier &name,
// Must be an enum
if (data->mode == IncludeEnums) {
// ### Optimize
- const char *enumName = strName.toUtf8().constData();
+ QByteArray enumName = strName.toUtf8();
const QMetaObject *metaObject = data->type->baseMetaObject();
for (int ii = metaObject->enumeratorCount() - 1; ii >= 0; --ii) {
QMetaEnum e = metaObject->enumerator(ii);
- int value = e.keyToValue(enumName);
+ int value = e.keyToValue(enumName.constData());
if (value != -1) {
enumValue = value;
return QScriptClass::HandlesReadAccess;
diff --git a/src/declarative/qml/qmlvaluetype.cpp b/src/declarative/qml/qmlvaluetype.cpp
index 4ae2070..84c9ecb 100644
--- a/src/declarative/qml/qmlvaluetype.cpp
+++ b/src/declarative/qml/qmlvaluetype.cpp
@@ -97,9 +97,10 @@ void QmlPointFValueType::read(QObject *obj, int idx)
QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
}
-void QmlPointFValueType::write(QObject *obj, int idx)
+void QmlPointFValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
{
- void *a[] = { &point, 0 };
+ int status = -1;
+ void *a[] = { &point, 0, &status, &flags };
QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
}
@@ -144,9 +145,10 @@ void QmlPointValueType::read(QObject *obj, int idx)
QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
}
-void QmlPointValueType::write(QObject *obj, int idx)
+void QmlPointValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
{
- void *a[] = { &point, 0 };
+ int status = -1;
+ void *a[] = { &point, 0, &status, &flags };
QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
}
@@ -191,9 +193,10 @@ void QmlSizeFValueType::read(QObject *obj, int idx)
QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
}
-void QmlSizeFValueType::write(QObject *obj, int idx)
+void QmlSizeFValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
{
- void *a[] = { &size, 0 };
+ int status = -1;
+ void *a[] = { &size, 0, &status, &flags };
QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
}
@@ -238,9 +241,10 @@ void QmlSizeValueType::read(QObject *obj, int idx)
QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
}
-void QmlSizeValueType::write(QObject *obj, int idx)
+void QmlSizeValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
{
- void *a[] = { &size, 0 };
+ int status = -1;
+ void *a[] = { &size, 0, &status, &flags };
QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
}
@@ -285,9 +289,10 @@ void QmlRectFValueType::read(QObject *obj, int idx)
QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
}
-void QmlRectFValueType::write(QObject *obj, int idx)
+void QmlRectFValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
{
- void *a[] = { &rect, 0 };
+ int status = -1;
+ void *a[] = { &rect, 0, &status, &flags };
QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
}
@@ -352,9 +357,10 @@ void QmlRectValueType::read(QObject *obj, int idx)
QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
}
-void QmlRectValueType::write(QObject *obj, int idx)
+void QmlRectValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
{
- void *a[] = { &rect, 0 };
+ int status = -1;
+ void *a[] = { &rect, 0, &status, &flags };
QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
}
@@ -419,9 +425,10 @@ void QmlVector3DValueType::read(QObject *obj, int idx)
QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
}
-void QmlVector3DValueType::write(QObject *obj, int idx)
+void QmlVector3DValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
{
- void *a[] = { &vector, 0 };
+ int status = -1;
+ void *a[] = { &vector, 0, &status, &flags };
QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
}
@@ -476,9 +483,10 @@ void QmlFontValueType::read(QObject *obj, int idx)
QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
}
-void QmlFontValueType::write(QObject *obj, int idx)
+void QmlFontValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
{
- void *a[] = { &font, 0 };
+ int status = -1;
+ void *a[] = { &font, 0, &status, &flags };
QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
}
diff --git a/src/declarative/qml/qmlvaluetype_p.h b/src/declarative/qml/qmlvaluetype_p.h
index da5e972..d3adf1e 100644
--- a/src/declarative/qml/qmlvaluetype_p.h
+++ b/src/declarative/qml/qmlvaluetype_p.h
@@ -58,6 +58,7 @@
#include <QtCore/qvariant.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qfont.h>
+#include <QmlMetaProperty>
QT_BEGIN_NAMESPACE
@@ -67,7 +68,7 @@ class QmlValueType : public QObject
public:
QmlValueType(QObject *parent = 0);
virtual void read(QObject *, int) = 0;
- virtual void write(QObject *, int) = 0;
+ virtual void write(QObject *, int, QmlMetaProperty::WriteFlags flags) = 0;
virtual QVariant value() = 0;
virtual void setValue(QVariant) = 0;
};
@@ -92,7 +93,7 @@ public:
QmlPointFValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int);
+ virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -114,7 +115,7 @@ public:
QmlPointValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int);
+ virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -136,7 +137,7 @@ public:
QmlSizeFValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int);
+ virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -158,7 +159,7 @@ public:
QmlSizeValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int);
+ virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -182,7 +183,7 @@ public:
QmlRectFValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int);
+ virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -211,7 +212,7 @@ public:
QmlRectValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int);
+ virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -239,7 +240,7 @@ public:
QmlVector3DValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int);
+ virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -267,7 +268,7 @@ public:
QmlFontValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int);
+ virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
diff --git a/src/declarative/qml/qmlvaluetypescriptclass.cpp b/src/declarative/qml/qmlvaluetypescriptclass.cpp
index 6fd674a..6a7bdeb 100644
--- a/src/declarative/qml/qmlvaluetypescriptclass.cpp
+++ b/src/declarative/qml/qmlvaluetypescriptclass.cpp
@@ -132,7 +132,7 @@ void QmlValueTypeScriptClass::setProperty(QScriptValue &object,
ref.type->read(ref.object, ref.property);
QMetaProperty p = ref.type->metaObject()->property(id);
p.write(ref.type, v);
- ref.type->write(ref.object, ref.property);
+ ref.type->write(ref.object, ref.property, 0);
}
QVariant QmlValueTypeScriptClass::toVariant(const QScriptValue &val)
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index a057f11..1f3903d 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -63,6 +63,7 @@
#include "private/qmlvmemetaobject_p.h"
#include <QtCore/qdebug.h>
#include <QtCore/qvarlengtharray.h>
+#include <QtGui/qapplication.h>
#include <private/qmlbinding_p.h>
#include <private/qmlcontext_p.h>
#include <private/qmlbindingoptimizations_p.h>
@@ -75,12 +76,8 @@ QmlVME::QmlVME()
#define VME_EXCEPTION(desc) \
{ \
- QString str; \
- QDebug d(&str); \
- d << desc; \
- str = str.trimmed(); \
QmlError error; \
- error.setDescription(str); \
+ error.setDescription(desc.trimmed()); \
error.setLine(instr.line); \
error.setUrl(comp->url); \
vmeErrors << error; \
@@ -155,6 +152,9 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
QmlEnginePrivate *ep = QmlEnginePrivate::get(ctxt->engine());
QmlContextPrivate *cp = (QmlContextPrivate *)QObjectPrivate::get(ctxt);
+ int status = -1; //for dbus
+ QmlMetaProperty::WriteFlags flags = QmlMetaProperty::BypassInterceptor;
+
for (int ii = start; !isError() && ii < (start + count); ++ii) {
QmlInstruction &instr = comp->bytecode[ii];
@@ -188,7 +188,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
if(types.at(instr.create.type).component)
vmeErrors << types.at(instr.create.type).component->errors();
- VME_EXCEPTION("Unable to create object of type" << types.at(instr.create.type).className);
+ VME_EXCEPTION(qApp->translate("QmlVME","Unable to create object of type %1").arg(QString::fromLatin1(types.at(instr.create.type).className)));
}
QmlDeclarativeData *ddata = QmlDeclarativeData::get(o);
@@ -275,10 +275,9 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreVariant:
{
QObject *target = stack.top();
- void *a[1];
// XXX - can be more efficient
QVariant v = QmlStringConverters::variantFromString(primitives.at(instr.storeString.value));
- a[0] = (void *)&v;
+ void *a[] = { &v, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeString.propertyIndex, a);
}
@@ -287,8 +286,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreString:
{
QObject *target = stack.top();
- void *a[1];
- a[0] = (void *)&primitives.at(instr.storeString.value);
+ void *a[] = { (void *)&primitives.at(instr.storeString.value), 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeString.propertyIndex, a);
}
@@ -297,9 +295,8 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreUrl:
{
QObject *target = stack.top();
- void *a[1];
QUrl u(primitives.at(instr.storeUrl.value));
- a[0] = (void *)&u;
+ void *a[] = { &u, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeUrl.propertyIndex, a);
}
@@ -309,8 +306,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
{
QObject *target = stack.top();
float f = instr.storeFloat.value;
- void *a[1];
- a[0] = &f;
+ void *a[] = { &f, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeFloat.propertyIndex, a);
}
@@ -320,8 +316,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
{
QObject *target = stack.top();
double d = instr.storeDouble.value;
- void *a[1];
- a[0] = &d;
+ void *a[] = { &d, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeDouble.propertyIndex, a);
}
@@ -330,8 +325,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreBool:
{
QObject *target = stack.top();
- void *a[1];
- a[0] = (void *)&instr.storeBool.value;
+ void *a[] = { (void *)&instr.storeBool.value, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeBool.propertyIndex, a);
}
@@ -340,8 +334,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreInteger:
{
QObject *target = stack.top();
- void *a[1];
- a[0] = (void *)&instr.storeInteger.value;
+ void *a[] = { (void *)&instr.storeInteger.value, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeInteger.propertyIndex, a);
}
@@ -350,9 +343,8 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreColor:
{
QObject *target = stack.top();
- void *a[1];
QColor c = QColor::fromRgba(instr.storeColor.value);
- a[0] = (void *)&c;
+ void *a[] = { &c, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeColor.propertyIndex, a);
}
@@ -361,9 +353,8 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreDate:
{
QObject *target = stack.top();
- void *a[1];
QDate d = QDate::fromJulianDay(instr.storeDate.value);
- a[0] = (void *)&d;
+ void *a[] = { &d, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeDate.propertyIndex, a);
}
@@ -372,13 +363,12 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreTime:
{
QObject *target = stack.top();
- void *a[1];
QTime t;
t.setHMS(intData.at(instr.storeTime.valueIndex),
intData.at(instr.storeTime.valueIndex+1),
intData.at(instr.storeTime.valueIndex+2),
intData.at(instr.storeTime.valueIndex+3));
- a[0] = (void *)&t;
+ void *a[] = { &t, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeTime.propertyIndex, a);
}
@@ -387,14 +377,13 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreDateTime:
{
QObject *target = stack.top();
- void *a[1];
QTime t;
t.setHMS(intData.at(instr.storeDateTime.valueIndex+1),
intData.at(instr.storeDateTime.valueIndex+2),
intData.at(instr.storeDateTime.valueIndex+3),
intData.at(instr.storeDateTime.valueIndex+4));
QDateTime dt(QDate::fromJulianDay(intData.at(instr.storeDateTime.valueIndex)), t);
- a[0] = (void *)&dt;
+ void *a[] = { &dt, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeDateTime.propertyIndex, a);
}
@@ -403,10 +392,9 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StorePoint:
{
QObject *target = stack.top();
- void *a[1];
QPoint p = QPointF(floatData.at(instr.storeRealPair.valueIndex),
floatData.at(instr.storeRealPair.valueIndex+1)).toPoint();
- a[0] = (void *)&p;
+ void *a[] = { &p, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeRealPair.propertyIndex, a);
}
@@ -415,10 +403,9 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StorePointF:
{
QObject *target = stack.top();
- void *a[1];
QPointF p(floatData.at(instr.storeRealPair.valueIndex),
floatData.at(instr.storeRealPair.valueIndex+1));
- a[0] = (void *)&p;
+ void *a[] = { &p, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeRealPair.propertyIndex, a);
}
@@ -427,10 +414,9 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreSize:
{
QObject *target = stack.top();
- void *a[1];
QSize p = QSizeF(floatData.at(instr.storeRealPair.valueIndex),
floatData.at(instr.storeRealPair.valueIndex+1)).toSize();
- a[0] = (void *)&p;
+ void *a[] = { &p, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeRealPair.propertyIndex, a);
}
@@ -439,10 +425,9 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreSizeF:
{
QObject *target = stack.top();
- void *a[1];
QSizeF s(floatData.at(instr.storeRealPair.valueIndex),
floatData.at(instr.storeRealPair.valueIndex+1));
- a[0] = (void *)&s;
+ void *a[] = { &s, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeRealPair.propertyIndex, a);
}
@@ -451,12 +436,11 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreRect:
{
QObject *target = stack.top();
- void *a[1];
QRect r = QRectF(floatData.at(instr.storeRect.valueIndex),
floatData.at(instr.storeRect.valueIndex+1),
floatData.at(instr.storeRect.valueIndex+2),
floatData.at(instr.storeRect.valueIndex+3)).toRect();
- a[0] = (void *)&r;
+ void *a[] = { &r, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeRect.propertyIndex, a);
}
@@ -465,12 +449,11 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreRectF:
{
QObject *target = stack.top();
- void *a[1];
QRectF r(floatData.at(instr.storeRect.valueIndex),
floatData.at(instr.storeRect.valueIndex+1),
floatData.at(instr.storeRect.valueIndex+2),
floatData.at(instr.storeRect.valueIndex+3));
- a[0] = (void *)&r;
+ void *a[] = { &r, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeRect.propertyIndex, a);
}
@@ -479,11 +462,10 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::StoreVector3D:
{
QObject *target = stack.top();
- void *a[1];
QVector3D p(floatData.at(instr.storeVector3D.valueIndex),
floatData.at(instr.storeVector3D.valueIndex+1),
floatData.at(instr.storeVector3D.valueIndex+2));
- a[0] = (void *)&p;
+ void *a[] = { &p, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeVector3D.propertyIndex, a);
}
@@ -494,9 +476,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
QObject *assignObj = stack.pop();
QObject *target = stack.top();
- void *a[1];
- a[0] = (void *)&assignObj;
-
+ void *a[] = { (void *)&assignObj, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeObject.propertyIndex, a);
}
@@ -506,7 +486,6 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
case QmlInstruction::AssignCustomType:
{
QObject *target = stack.top();
- void *a[1];
QmlCompiledData::CustomTypeData data = customTypeData.at(instr.assignCustomType.valueIndex);
const QString &primitive = primitives.at(data.index);
QmlMetaType::StringConverter converter =
@@ -516,9 +495,9 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
QMetaProperty prop =
target->metaObject()->property(instr.assignCustomType.propertyIndex);
if (v.isNull() || ((int)prop.type() != data.type && prop.userType() != data.type))
- VME_EXCEPTION("Cannot assign value" << primitive << "to property" << prop.name());
+ VME_EXCEPTION(qApp->translate("QmlVME","Cannot assign value %1 to property %2").arg(primitive).arg(QString::fromUtf8(prop.name())));
- a[0] = (void *)v.data();
+ void *a[] = { (void *)v.data(), 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.assignCustomType.propertyIndex, a);
}
@@ -533,20 +512,20 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
int sigIdx = instr.assignSignalObject.signal;
const QByteArray &pr = datas.at(sigIdx);
- QmlMetaProperty prop(target, QLatin1String(pr));
+ QmlMetaProperty prop(target, QString::fromUtf8(pr));
if (prop.type() & QmlMetaProperty::SignalProperty) {
QMetaMethod method = QmlMetaType::defaultMethod(assign);
if (method.signature() == 0)
- VME_EXCEPTION("Cannot assign object type" << assign->metaObject()->className() << "with no default method");
+ VME_EXCEPTION(qApp->translate("QmlVME","Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className())));
if (!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature()))
- VME_EXCEPTION("Cannot connect mismatched signal/slot" << method.signature() << prop.method().signature());
+ VME_EXCEPTION(qApp->translate("QmlVME","Cannot connect mismatched signal/slot %1 %vs. %2").arg(QString::fromLatin1(method.signature())).arg(QString::fromLatin1(prop.method().signature())));
QMetaObject::connect(target, prop.coreIndex(), assign, method.methodIndex());
} else {
- VME_EXCEPTION("Cannot assign an object to signal property" << pr);
+ VME_EXCEPTION(qApp->translate("QmlVME","Cannot assign an object to signal property %1").arg(QString::fromUtf8(pr)));
}
@@ -655,6 +634,20 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
}
break;
+ case QmlInstruction::StoreValueInterceptor:
+ {
+ QObject *obj = stack.pop();
+ QmlPropertyValueInterceptor *vi = reinterpret_cast<QmlPropertyValueInterceptor *>(reinterpret_cast<char *>(obj) + instr.assignValueInterceptor.castValue);
+ QObject *target = stack.at(stack.count() - 1 - instr.assignValueInterceptor.owner);
+ QmlMetaProperty prop;
+ prop.restore(instr.assignValueInterceptor.property, target, ctxt);
+ obj->setParent(target);
+ vi->setTarget(prop);
+ QmlVMEMetaObject *mo = static_cast<QmlVMEMetaObject *>((QMetaObject*)target->metaObject());
+ mo->registerInterceptor(prop.coreIndex(), vi);
+ }
+ break;
+
case QmlInstruction::StoreObjectQmlList:
{
QObject *assign = stack.pop();
@@ -688,7 +681,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
if (iid)
ptr = assign->qt_metacast(iid);
if (!ptr)
- VME_EXCEPTION("Cannot assign object to list");
+ VME_EXCEPTION(qApp->translate("QmlVME","Cannot assign object to list"));
if (list.qmlListInterface) {
@@ -706,8 +699,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
QObject *target = stack.top();
QVariant v = QVariant::fromValue(assign);
- void *a[1];
- a[0] = (void *)&v;
+ void *a[] = { &v, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeObject.propertyIndex, a);
}
@@ -726,8 +718,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
if (iid) {
void *ptr = assign->qt_metacast(iid);
if (ptr) {
- void *a[1];
- a[0] = &ptr;
+ void *a[] = { &ptr, 0, &status, &flags };
QMetaObject::metacall(target,
QMetaObject::WriteProperty,
coreIdx, a);
@@ -736,7 +727,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
}
if (!ok)
- VME_EXCEPTION("Cannot assign object to interface property");
+ VME_EXCEPTION(qApp->translate("QmlVME","Cannot assign object to interface property"));
}
break;
@@ -747,7 +738,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
QObject *qmlObject = qmlAttachedPropertiesObjectById(instr.fetchAttached.id, target);
if (!qmlObject)
- VME_EXCEPTION("Unable to create attached object");
+ VME_EXCEPTION(qApp->translate("QmlVME","Unable to create attached object"));
stack.push(qmlObject);
}
@@ -765,7 +756,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
QMetaObject::metacall(target, QMetaObject::ReadProperty,
instr.fetchQmlList.property, a);
if (!list)
- VME_EXCEPTION("Cannot assign to null list");
+ VME_EXCEPTION(qApp->translate("QmlVME","Cannot assign to null list"));
qliststack.push(ListInstance(list, instr.fetchQmlList.type));
}
@@ -783,7 +774,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
QMetaObject::metacall(target, QMetaObject::ReadProperty,
instr.fetchQmlList.property, a);
if (!list)
- VME_EXCEPTION("Cannot assign to null list");
+ VME_EXCEPTION(qApp->translate("QmlVME","Cannot assign to null list"));
qliststack.push(ListInstance(list, instr.fetchQmlList.type));
}
@@ -802,7 +793,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
instr.fetch.property, a);
if (!obj)
- VME_EXCEPTION("Cannot set properties on" << target->metaObject()->property(instr.fetch.property).name() << "as it is null");
+ VME_EXCEPTION(qApp->translate("QmlVME","Cannot set properties on %1 as it is null").arg(QString::fromUtf8(target->metaObject()->property(instr.fetch.property).name())));
stack.push(obj);
}
@@ -849,7 +840,7 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt,
QmlValueType *valueHandler =
static_cast<QmlValueType *>(stack.pop());
QObject *target = stack.top();
- valueHandler->write(target, instr.fetchValue.property);
+ valueHandler->write(target, instr.fetchValue.property, QmlMetaProperty::BypassInterceptor);
}
break;
diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qmlvmemetaobject.cpp
index f473743..e5acc51 100644
--- a/src/declarative/qml/qmlvmemetaobject.cpp
+++ b/src/declarative/qml/qmlvmemetaobject.cpp
@@ -100,6 +100,24 @@ QmlVMEMetaObject::~QmlVMEMetaObject()
int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
{
int id = _id;
+ if(c == QMetaObject::WriteProperty) {
+ int flags = *reinterpret_cast<int*>(a[3]);
+ if (!(flags & QmlMetaProperty::BypassInterceptor)
+ && !aInterceptors.isEmpty()
+ && aInterceptors.testBit(id)) {
+ QmlPropertyValueInterceptor *vi = interceptors.value(id);
+ if (id >= propOffset) {
+ id -= propOffset;
+ if (id < metaData->propertyCount) {
+ vi->write(QVariant(data[id].type(), a[0]));
+ return -1;
+ }
+ } else {
+ vi->write(QVariant(property(id).type(), a[0]));
+ return -1;
+ }
+ }
+ }
if(c == QMetaObject::ReadProperty || c == QMetaObject::WriteProperty) {
if (id >= propOffset) {
id -= propOffset;
@@ -181,20 +199,32 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
(QmlContextPrivate *)QObjectPrivate::get(ctxt);
QObject *target = ctxtPriv->idValues[d->contextIdx].data();
- if (!target) return -1;
+ if (!target) {
+ if (d->propertyIdx == -1)
+ *reinterpret_cast<QObject **>(a[0]) = target;
+ return -1;
+ }
if (c == QMetaObject::ReadProperty && !aConnected.testBit(id)) {
int sigIdx = methodOffset + id + metaData->propertyCount;
QMetaObject::connect(ctxt, d->contextIdx + ctxtPriv->notifyIndex, object, sigIdx);
- QMetaProperty prop =
- target->metaObject()->property(d->propertyIdx);
- if (prop.hasNotifySignal())
- QMetaObject::connect(target, prop.notifySignalIndex(),
- object, sigIdx);
+ if (d->propertyIdx != -1) {
+ QMetaProperty prop =
+ target->metaObject()->property(d->propertyIdx);
+ if (prop.hasNotifySignal())
+ QMetaObject::connect(target, prop.notifySignalIndex(),
+ object, sigIdx);
+ }
aConnected.setBit(id);
}
- return QMetaObject::metacall(target, c, d->propertyIdx, a);
+
+ if (d->propertyIdx == -1) {
+ *reinterpret_cast<QObject **>(a[0]) = target;
+ return -1;
+ } else {
+ return QMetaObject::metacall(target, c, d->propertyIdx, a);
+ }
}
return -1;
@@ -253,4 +283,13 @@ void QmlVMEMetaObject::listChanged(int id)
activate(object, methodOffset + id, 0);
}
+void QmlVMEMetaObject::registerInterceptor(int index, QmlPropertyValueInterceptor *interceptor)
+{
+ if (aInterceptors.isEmpty())
+ aInterceptors.resize(propertyCount() + metaData->propertyCount);
+ aInterceptors.setBit(index);
+ interceptors.insert(index, interceptor);
+}
+
+
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlvmemetaobject_p.h b/src/declarative/qml/qmlvmemetaobject_p.h
index 1c26241..d376f4c 100644
--- a/src/declarative/qml/qmlvmemetaobject_p.h
+++ b/src/declarative/qml/qmlvmemetaobject_p.h
@@ -104,6 +104,8 @@ public:
QmlRefCount * = 0);
~QmlVMEMetaObject();
+ void registerInterceptor(int index, QmlPropertyValueInterceptor *interceptor);
+
protected:
virtual int metaCall(QMetaObject::Call _c, int _id, void **_a);
@@ -117,6 +119,8 @@ private:
QVariant *data;
QBitArray aConnected;
+ QBitArray aInterceptors;
+ QHash<int, QmlPropertyValueInterceptor*> interceptors;
QAbstractDynamicMetaObject *parent;
diff --git a/src/declarative/qml/qmlxmlhttprequest.cpp b/src/declarative/qml/qmlxmlhttprequest.cpp
index 0bc927c..5117a00 100644
--- a/src/declarative/qml/qmlxmlhttprequest.cpp
+++ b/src/declarative/qml/qmlxmlhttprequest.cpp
@@ -1105,7 +1105,7 @@ void QmlXMLHttpRequest::downloadProgress(qint64 bytes)
m_status =
m_network->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
m_statusText =
- QLatin1String(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray());
+ QString::fromUtf8(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray());
// ### We assume if this is called the headers are now available
if (m_state < HeadersReceived) {
@@ -1127,7 +1127,7 @@ void QmlXMLHttpRequest::error(QNetworkReply::NetworkError error)
m_status =
m_network->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
m_statusText =
- QLatin1String(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray());
+ QString::fromUtf8(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray());
m_responseEntityBody = QByteArray();
m_errorFlag = true;
@@ -1146,7 +1146,7 @@ void QmlXMLHttpRequest::finished()
m_status =
m_network->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
m_statusText =
- QLatin1String(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray());
+ QString::fromUtf8(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray());
if (m_state < HeadersReceived) {
m_state = HeadersReceived;
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index 3edbc5f..f42aa4e 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -73,7 +73,7 @@ QEasingCurve stringToCurve(const QString &curve)
QString easeName = curve.trimmed();
if (!easeName.endsWith(QLatin1Char(')'))) {
qWarning("QEasingCurve: Unmatched perenthesis in easing function '%s'",
- curve.toLatin1().constData());
+ qPrintable(curve));
return easingCurve;
}
@@ -83,7 +83,7 @@ QEasingCurve stringToCurve(const QString &curve)
normalizedCurve = easeName.left(idx);
if (!normalizedCurve.startsWith(QLatin1String("ease"))) {
qWarning("QEasingCurve: Easing function '%s' must start with 'ease'",
- curve.toLatin1().constData());
+ qPrintable(curve));
}
props = prop_str.split(QLatin1Char(','));
@@ -95,10 +95,10 @@ QEasingCurve stringToCurve(const QString &curve)
static int index = QEasingCurve::staticMetaObject.indexOfEnumerator("Type");
static QMetaEnum me = QEasingCurve::staticMetaObject.enumerator(index);
- int value = me.keyToValue(normalizedCurve.toLatin1().constData());
+ int value = me.keyToValue(normalizedCurve.toUtf8().constData());
if (value < 0) {
qWarning("QEasingCurve: Unknown easing curve '%s'",
- curve.toLatin1().constData());
+ qPrintable(curve));
value = 0;
}
easingCurve.setType((QEasingCurve::Type)value);
@@ -109,7 +109,7 @@ QEasingCurve stringToCurve(const QString &curve)
if (sep == -1) {
qWarning("QEasingCurve: Improperly specified property in easing function '%s'",
- curve.toLatin1().constData());
+ qPrintable(curve));
return easingCurve;
}
@@ -119,7 +119,7 @@ QEasingCurve stringToCurve(const QString &curve)
if (propName.isEmpty() || !isOk) {
qWarning("QEasingCurve: Improperly specified property in easing function '%s'",
- curve.toLatin1().constData());
+ qPrintable(curve));
return easingCurve;
}
@@ -224,10 +224,10 @@ QmlMetaProperty QmlAbstractAnimationPrivate::createProperty(QObject *obj, const
Q_Q(QmlAbstractAnimation);
QmlMetaProperty prop = QmlMetaProperty::createProperty(obj, str);
if (!prop.isValid()) {
- qmlInfo(q) << "Cannot animate non-existant property" << str;
+ qmlInfo(QmlAbstractAnimation::tr("Cannot animate non-existant property \"%1\"").arg(str), q);
return QmlMetaProperty();
} else if (!prop.isWritable()) {
- qmlInfo(q) << "Cannot animate read-only property" << str;
+ qmlInfo(QmlAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str), q);
return QmlMetaProperty();
}
return prop;
@@ -972,7 +972,7 @@ void QmlPropertyAction::setValue(const QVariant &v)
void QmlPropertyActionPrivate::doAction()
{
- property.write(value);
+ property.write(value, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
}
QAbstractAnimation *QmlPropertyAction::qtAnimation()
@@ -1007,9 +1007,7 @@ void QmlPropertyAction::transition(QmlStateActions &actions,
{
for (int ii = 0; ii < actions.count(); ++ii) {
const Action &action = actions.at(ii);
- QmlBehavior::_ignore = true;
- action.property.write(action.toValue);
- QmlBehavior::_ignore = false;
+ action.property.write(action.toValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
}
}
};
@@ -1020,9 +1018,11 @@ void QmlPropertyAction::transition(QmlStateActions &actions,
if (!d->propertyName.isEmpty() && !props.contains(d->propertyName))
props.append(d->propertyName);
+ bool targetNeedsReset = false;
if (d->userProperty.isValid() && props.isEmpty() && !target()) {
props.append(d->userProperty.value.name());
d->target = d->userProperty.value.object();
+ targetNeedsReset = true;
}
QmlSetPropertyAnimationAction *data = new QmlSetPropertyAnimationAction;
@@ -1070,6 +1070,8 @@ void QmlPropertyAction::transition(QmlStateActions &actions,
} else {
delete data;
}
+ if (targetNeedsReset)
+ d->target = 0;
}
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PropertyAction,QmlPropertyAction)
@@ -1714,10 +1716,10 @@ void QmlPropertyAnimationPrivate::valueChanged(qreal r)
}
if (r == 1.) {
- property.write(to);
+ property.write(to, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
} else {
if (interpolator)
- property.write(interpolator(from.constData(), to.constData(), r));
+ property.write(interpolator(from.constData(), to.constData(), r), QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
}
}
@@ -1765,17 +1767,21 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
int prevInterpolatorType; //for generic
QVariantAnimation::Interpolator interpolator;
bool reverse;
+ bool *wasDeleted;
+ PropertyUpdater() : wasDeleted(0) {}
+ ~PropertyUpdater() { if (wasDeleted) *wasDeleted = true; }
void setValue(qreal v)
{
+ bool deleted = false;
+ wasDeleted = &deleted;
if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1
v = 1 - v;
QmlTimeLineValue::setValue(v);
for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
- QmlBehavior::_ignore = true;
if (v == 1.)
- action.property.write(action.toValue);
+ action.property.write(action.toValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
else {
if (action.fromValue.isNull()) {
action.fromValue = action.property.read();
@@ -1790,10 +1796,12 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
}
}
if (interpolator)
- action.property.write(interpolator(action.fromValue.constData(), action.toValue.constData(), v));
+ action.property.write(interpolator(action.fromValue.constData(), action.toValue.constData(), v), QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
}
- QmlBehavior::_ignore = false;
+ if (deleted)
+ return;
}
+ wasDeleted = 0;
}
};
@@ -1805,9 +1813,11 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
bool useType = (props.isEmpty() && d->defaultToInterpolatorType) ? true : false;
+ bool targetNeedsReset = false;
if (d->userProperty.isValid() && props.isEmpty() && !target()) {
props.append(d->userProperty.value.name());
d->target = d->userProperty.value.object();
+ targetNeedsReset = true;
}
PropertyUpdater *data = new PropertyUpdater;
@@ -1874,6 +1884,8 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
} else {
delete data;
}
+ if (targetNeedsReset)
+ d->target = 0;
}
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PropertyAnimation,QmlPropertyAnimation)
diff --git a/src/declarative/util/qmlconnection.cpp b/src/declarative/util/qmlconnection.cpp
index c77d0f6..2a7cf6c 100644
--- a/src/declarative/util/qmlconnection.cpp
+++ b/src/declarative/util/qmlconnection.cpp
@@ -163,7 +163,7 @@ void QmlConnection::connectIfValid()
if (lparen >= 0 && d->signal.length() > lparen+2) {
QStringList l = d->signal.mid(lparen+1,d->signal.length()-lparen-2).split(QLatin1Char(','));
foreach (const QString &s, l) {
- sigparams.append(s.toLatin1());
+ sigparams.append(s.toUtf8());
}
}
QString signalname = d->signal.left(lparen);
@@ -172,7 +172,7 @@ void QmlConnection::connectIfValid()
int methods = mo->methodCount();
for (int ii = 0; ii < methods; ++ii) {
QMetaMethod method = mo->method(ii);
- QString methodName = QLatin1String(method.signature());
+ QString methodName = QString::fromUtf8(method.signature());
int idx = methodName.indexOf(QLatin1Char('('));
methodName = methodName.left(idx);
if (methodName == signalname && (lparen<0 || method.parameterNames() == sigparams)) {
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index 062ab48..4dc9bc5 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -233,7 +233,7 @@ struct ModelNode
QHash<QString, ModelNode *>::iterator it;
for (it = properties.begin(); it != properties.end(); ++it) {
if (!(*it)->values.isEmpty())
- objectCache->setValue(it.key().toLatin1(), (*it)->values.first());
+ objectCache->setValue(it.key().toUtf8(), (*it)->values.first());
}
}
return objectCache;
@@ -252,7 +252,7 @@ struct ModelNode
properties.insert(prop,n);
}
if (objectCache)
- objectCache->setValue(prop.toLatin1(), val);
+ objectCache->setValue(prop.toUtf8(), val);
}
QmlListModel *modelCache;
@@ -709,7 +709,7 @@ bool QmlListModelParser::compileProperty(const QmlCustomParserProperty &prop, QL
qvariant_cast<QmlParser::Variant>(value);
int ref = data.count();
- QByteArray d = variant.asScript().toLatin1();
+ QByteArray d = variant.asScript().toUtf8();
d.append('\0');
data.append(d);
@@ -799,7 +799,7 @@ void QmlListModelParser::setCustomData(QObject *obj, const QByteArray &d)
{
ModelNode *n = nodes.top();
ModelNode *n2 = new ModelNode;
- n->properties.insert(QLatin1String(data + instr.dataIdx), n2);
+ n->properties.insert(QString::fromUtf8(data + instr.dataIdx), n2);
nodes.push(n2);
}
break;
diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp
index a5a08bc..a112245 100644
--- a/src/declarative/util/qmlpropertychanges.cpp
+++ b/src/declarative/util/qmlpropertychanges.cpp
@@ -230,17 +230,18 @@ void QmlPropertyChangesPrivate::decode()
ds >> isScript;
ds >> data;
- if (isScript) {
- QmlMetaProperty prop = property(name); //### can we avoid or reuse?
+ QmlMetaProperty prop = property(name); //### better way to check for signal property?
+ if (prop.type() == QmlMetaProperty::SignalProperty) {
QmlExpression *expression = new QmlExpression(qmlContext(q), data.toString(), object);
expression->setTrackChange(false);
- if (prop.type() == QmlMetaProperty::SignalProperty) {
- QmlReplaceSignalHandler *handler = new QmlReplaceSignalHandler;
- handler->property = prop;
- handler->expression = expression;
- signalReplacements << handler;
- } else
- expressions << qMakePair(name, expression);
+ QmlReplaceSignalHandler *handler = new QmlReplaceSignalHandler;
+ handler->property = prop;
+ handler->expression = expression;
+ signalReplacements << handler;
+ } else if (isScript) {
+ QmlExpression *expression = new QmlExpression(qmlContext(q), data.toString(), object);
+ expression->setTrackChange(false);
+ expressions << qMakePair(name, expression);
} else {
properties << qMakePair(name, data);
}
@@ -302,12 +303,12 @@ QmlMetaProperty
QmlPropertyChangesPrivate::property(const QByteArray &property)
{
Q_Q(QmlPropertyChanges);
- QmlMetaProperty prop = QmlMetaProperty::createProperty(object, QString::fromLatin1(property));
+ QmlMetaProperty prop = QmlMetaProperty::createProperty(object, QString::fromUtf8(property));
if (!prop.isValid()) {
- qmlInfo(q) << "Cannot assign to non-existant property" << property;
+ qmlInfo(QmlPropertyChanges::tr("Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(property)), q);
return QmlMetaProperty();
} else if (!prop.isWritable()) {
- qmlInfo(q) << "Cannot assign to read-only property" << property;
+ qmlInfo(QmlPropertyChanges::tr("Cannot assign to read-only property \"%1\"").arg(QString::fromUtf8(property)), q);
return QmlMetaProperty();
}
return prop;
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index 3c85db7..98facd9 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -350,6 +350,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
if (action.event) {
if (!action.event->isReversable())
continue;
+ action.event->saveOriginals();
for (jj = 0; jj < d->revertList.count(); ++jj) {
ActionEvent *event = d->revertList.at(jj).event;
if (event && event->typeName() == action.event->typeName()) {
@@ -359,9 +360,6 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
}
}
}
- if (!found)
- action.event->saveOriginals();
- //### do we ever need to do saveOriginals when found == true?
} else {
action.fromBinding = action.property.binding();
diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qmltimer.cpp
index fdc57ff..3fbe15c 100644
--- a/src/declarative/util/qmltimer.cpp
+++ b/src/declarative/util/qmltimer.cpp
@@ -207,7 +207,6 @@ void QmlTimer::setTriggeredOnStart(bool triggeredOnStart)
*/
void QmlTimer::start()
{
- Q_D(QmlTimer);
setRunning(true);
}
@@ -220,7 +219,6 @@ void QmlTimer::start()
*/
void QmlTimer::stop()
{
- Q_D(QmlTimer);
setRunning(false);
}
diff --git a/src/declarative/util/qmltransitionmanager.cpp b/src/declarative/util/qmltransitionmanager.cpp
index 3e2e05f..7eaccac 100644
--- a/src/declarative/util/qmltransitionmanager.cpp
+++ b/src/declarative/util/qmltransitionmanager.cpp
@@ -144,9 +144,9 @@ void QmlTransitionManager::transition(const QList<Action> &list,
for (int ii = 0; ii < applyList.size(); ++ii) {
const Action &action = applyList.at(ii);
if (action.toBinding) {
- action.property.setBinding(action.toBinding);
+ action.property.setBinding(action.toBinding, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
} else if (!action.event) {
- action.property.write(action.toValue);
+ action.property.write(action.toValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
} else if (action.event->isReversable()) {
if (action.reverseEvent)
action.event->reverse();
@@ -187,7 +187,7 @@ void QmlTransitionManager::transition(const QList<Action> &list,
if (action.toBinding)
action.property.setBinding(0); // Make sure this is disabled during the transition
- action.property.write(action.fromValue);
+ action.property.write(action.fromValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
}
}
@@ -223,7 +223,7 @@ void QmlTransitionManager::transition(const QList<Action> &list,
}
// Any actions remaining have not been handled by the transition and should
- // be applied immediately. We skip applying transitions, as they are all
+ // be applied immediately. We skip applying bindings, as they are all
// applied at the end in applyBindings() to avoid any nastiness mid
// transition
foreach(const Action &action, applyList) {
@@ -232,13 +232,12 @@ void QmlTransitionManager::transition(const QList<Action> &list,
action.event->reverse();
else
action.event->execute();
- } else if (!action.event) {
+ } else if (!action.event && !action.toBinding) {
action.property.write(action.toValue);
}
}
if (!transition)
d->applyBindings();
-
}
void QmlTransitionManager::cancel()