summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-04-29 23:39:44 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-04-29 23:39:44 (GMT)
commite5f5f009bb1ee7ba039c712013700ac0363fa323 (patch)
tree24bd62f9042a76c5f0c1327ee2fb4cbc46271de6 /src/declarative
parentce20af2d343e2d707f93ac4cb724feb2562680c6 (diff)
parent204cf6be3d63b16981843b0ae6a544e30da35134 (diff)
downloadQt-e5f5f009bb1ee7ba039c712013700ac0363fa323.zip
Qt-e5f5f009bb1ee7ba039c712013700ac0363fa323.tar.gz
Qt-e5f5f009bb1ee7ba039c712013700ac0363fa323.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp26
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp128
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.h44
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem_p.h23
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners.cpp8
-rw-r--r--src/declarative/qml/qdeclarativebinding.cpp13
-rw-r--r--src/declarative/qml/qdeclarativedata_p.h10
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp12
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp3
-rw-r--r--src/declarative/qml/qdeclarativevmemetaobject.cpp3
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp89
11 files changed, 166 insertions, 193 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index e00a9fd..3937778 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -316,6 +316,32 @@ qreal QDeclarativeImage::paintedHeight() const
If the source is a non-scalable image (eg. JPEG), the loaded image will
be no greater than this property specifies. For some formats (currently only JPEG),
the whole image will never actually be loaded into memory.
+
+ The example below will ensure that the size of the image in memory is
+ no larger than 1024x1024 pixels, regardless of the size of the Image element.
+
+ \code
+ Image {
+ anchors.fill: parent
+ source: "images/reallyBigImage.jpg"
+ sourceSize.width: 1024
+ sourceSize.height: 1024
+ }
+ \endcode
+
+ The example below will ensure that the memory used by the image is
+ no more than necessary to display the image at the size of the Image element.
+ Of course if the Image element is resized a costly reload will be required, so
+ use this technique \e only when the Image size is fixed.
+
+ \code
+ Image {
+ anchors.fill: parent
+ source: "images/reallyBigImage.jpg"
+ sourceSize.width: width
+ sourceSize.height: height
+ }
+ \endcode
*/
void QDeclarativeImage::updatePaintedGeometry()
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 723ed34..65b996d 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -1263,11 +1263,6 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec
*/
/*!
- \property QDeclarativeItem::baseline
- \internal
-*/
-
-/*!
\property QDeclarativeItem::focus
\internal
*/
@@ -1472,11 +1467,6 @@ QDeclarativeItem *QDeclarativeItem::parentItem() const
*/
/*!
- \property QDeclarativeItem::resources
- \internal
-*/
-
-/*!
Returns true if construction of the QML component is complete; otherwise
returns false.
@@ -1491,18 +1481,6 @@ bool QDeclarativeItem::isComponentComplete() const
return d->_componentComplete;
}
-/*!
- \property QDeclarativeItem::anchors
- \internal
-*/
-
-/*! \internal */
-QDeclarativeAnchors *QDeclarativeItem::anchors()
-{
- Q_D(QDeclarativeItem);
- return d->anchors();
-}
-
void QDeclarativeItemPrivate::data_append(QDeclarativeListProperty<QObject> *prop, QObject *o)
{
if (!o)
@@ -1625,14 +1603,13 @@ void QDeclarativeItemPrivate::parentProperty(QObject *o, void *rv, QDeclarativeN
*/
/*!
- \property QDeclarativeItem::data
\internal
*/
/*! \internal */
-QDeclarativeListProperty<QObject> QDeclarativeItem::data()
+QDeclarativeListProperty<QObject> QDeclarativeItemPrivate::data()
{
- return QDeclarativeListProperty<QObject>(this, 0, QDeclarativeItemPrivate::data_append);
+ return QDeclarativeListProperty<QObject>(q_func(), 0, QDeclarativeItemPrivate::data_append);
}
/*!
@@ -1860,98 +1837,61 @@ QVariant QDeclarativeItem::inputMethodQuery(Qt::InputMethodQuery query) const
/*!
\internal
*/
-QDeclarativeAnchorLine QDeclarativeItem::left() const
+QDeclarativeAnchorLine QDeclarativeItemPrivate::left() const
{
- Q_D(const QDeclarativeItem);
- return d->anchorLines()->left;
+ return anchorLines()->left;
}
/*!
\internal
*/
-QDeclarativeAnchorLine QDeclarativeItem::right() const
+QDeclarativeAnchorLine QDeclarativeItemPrivate::right() const
{
- Q_D(const QDeclarativeItem);
- return d->anchorLines()->right;
+ return anchorLines()->right;
}
/*!
\internal
*/
-QDeclarativeAnchorLine QDeclarativeItem::horizontalCenter() const
+QDeclarativeAnchorLine QDeclarativeItemPrivate::horizontalCenter() const
{
- Q_D(const QDeclarativeItem);
- return d->anchorLines()->hCenter;
+ return anchorLines()->hCenter;
}
/*!
\internal
*/
-QDeclarativeAnchorLine QDeclarativeItem::top() const
+QDeclarativeAnchorLine QDeclarativeItemPrivate::top() const
{
- Q_D(const QDeclarativeItem);
- return d->anchorLines()->top;
+ return anchorLines()->top;
}
/*!
\internal
*/
-QDeclarativeAnchorLine QDeclarativeItem::bottom() const
+QDeclarativeAnchorLine QDeclarativeItemPrivate::bottom() const
{
- Q_D(const QDeclarativeItem);
- return d->anchorLines()->bottom;
+ return anchorLines()->bottom;
}
/*!
\internal
*/
-QDeclarativeAnchorLine QDeclarativeItem::verticalCenter() const
+QDeclarativeAnchorLine QDeclarativeItemPrivate::verticalCenter() const
{
- Q_D(const QDeclarativeItem);
- return d->anchorLines()->vCenter;
+ return anchorLines()->vCenter;
}
/*!
\internal
*/
-QDeclarativeAnchorLine QDeclarativeItem::baseline() const
+QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const
{
- Q_D(const QDeclarativeItem);
- return d->anchorLines()->baseline;
+ return anchorLines()->baseline;
}
/*!
- \property QDeclarativeItem::top
- \internal
-*/
-
-/*!
- \property QDeclarativeItem::bottom
- \internal
-*/
-
-/*!
- \property QDeclarativeItem::left
- \internal
-*/
-
-/*!
- \property QDeclarativeItem::right
- \internal
-*/
-
-/*!
- \property QDeclarativeItem::horizontalCenter
- \internal
-*/
-
-/*!
- \property QDeclarativeItem::verticalCenter
- \internal
-*/
-
-/*!
\qmlproperty AnchorLine Item::top
\qmlproperty AnchorLine Item::bottom
\qmlproperty AnchorLine Item::left
@@ -2291,9 +2231,9 @@ void QDeclarativeItemPrivate::focusChanged(bool flag)
}
/*! \internal */
-QDeclarativeListProperty<QObject> QDeclarativeItem::resources()
+QDeclarativeListProperty<QObject> QDeclarativeItemPrivate::resources()
{
- return QDeclarativeListProperty<QObject>(this, 0, QDeclarativeItemPrivate::resources_append,
+ return QDeclarativeListProperty<QObject>(q_func(), 0, QDeclarativeItemPrivate::resources_append,
QDeclarativeItemPrivate::resources_count,
QDeclarativeItemPrivate::resources_at);
}
@@ -2315,15 +2255,10 @@ QDeclarativeListProperty<QObject> QDeclarativeItem::resources()
\sa {qmlstate}{States}
*/
-/*!
- \property QDeclarativeItem::states
- \internal
-*/
/*! \internal */
-QDeclarativeListProperty<QDeclarativeState> QDeclarativeItem::states()
+QDeclarativeListProperty<QDeclarativeState> QDeclarativeItemPrivate::states()
{
- Q_D(QDeclarativeItem);
- return d->states()->statesProperty();
+ return _states()->statesProperty();
}
/*!
@@ -2343,16 +2278,11 @@ QDeclarativeListProperty<QDeclarativeState> QDeclarativeItem::states()
\sa {state-transitions}{Transitions}
*/
-/*!
- \property QDeclarativeItem::transitions
- \internal
-*/
/*! \internal */
-QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItem::transitions()
+QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItemPrivate::transitions()
{
- Q_D(QDeclarativeItem);
- return d->states()->transitionsProperty();
+ return _states()->transitionsProperty();
}
/*
@@ -2426,20 +2356,18 @@ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItem::transitions()
*/
/*! \internal */
-QString QDeclarativeItem::state() const
+QString QDeclarativeItemPrivate::state() const
{
- Q_D(const QDeclarativeItem);
- if (!d->_stateGroup)
+ if (!_stateGroup)
return QString();
else
- return d->_stateGroup->state();
+ return _stateGroup->state();
}
/*! \internal */
-void QDeclarativeItem::setState(const QString &state)
+void QDeclarativeItemPrivate::setState(const QString &state)
{
- Q_D(QDeclarativeItem);
- d->states()->setState(state);
+ _states()->setState(state);
}
/*!
@@ -2502,7 +2430,7 @@ void QDeclarativeItem::componentComplete()
d->keyHandler->componentComplete();
}
-QDeclarativeStateGroup *QDeclarativeItemPrivate::states()
+QDeclarativeStateGroup *QDeclarativeItemPrivate::_states()
{
Q_Q(QDeclarativeItem);
if (!_stateGroup) {
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.h b/src/declarative/graphicsitems/qdeclarativeitem.h
index da5a36e..3b05b09 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem.h
@@ -70,20 +70,20 @@ class Q_DECLARATIVE_EXPORT QDeclarativeItem : public QGraphicsObject, public QDe
Q_INTERFACES(QDeclarativeParserStatus)
Q_PROPERTY(QDeclarativeItem * parent READ parentItem WRITE setParentItem NOTIFY parentChanged DESIGNABLE false FINAL)
- Q_PROPERTY(QDeclarativeListProperty<QObject> data READ data DESIGNABLE false)
- Q_PROPERTY(QDeclarativeListProperty<QObject> resources READ resources DESIGNABLE false)
- Q_PROPERTY(QDeclarativeListProperty<QDeclarativeState> states READ states DESIGNABLE false)
- Q_PROPERTY(QDeclarativeListProperty<QDeclarativeTransition> transitions READ transitions DESIGNABLE false)
- Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeListProperty<QObject> data READ data DESIGNABLE false)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeListProperty<QObject> resources READ resources DESIGNABLE false)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeListProperty<QDeclarativeState> states READ states DESIGNABLE false)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeListProperty<QDeclarativeTransition> transitions READ transitions DESIGNABLE false)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QString state READ state WRITE setState NOTIFY stateChanged)
Q_PROPERTY(QRectF childrenRect READ childrenRect NOTIFY childrenRectChanged DESIGNABLE false FINAL)
- Q_PROPERTY(QDeclarativeAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL)
- Q_PROPERTY(QDeclarativeAnchorLine left READ left CONSTANT FINAL)
- Q_PROPERTY(QDeclarativeAnchorLine right READ right CONSTANT FINAL)
- Q_PROPERTY(QDeclarativeAnchorLine horizontalCenter READ horizontalCenter CONSTANT FINAL)
- Q_PROPERTY(QDeclarativeAnchorLine top READ top CONSTANT FINAL)
- Q_PROPERTY(QDeclarativeAnchorLine bottom READ bottom CONSTANT FINAL)
- Q_PROPERTY(QDeclarativeAnchorLine verticalCenter READ verticalCenter CONSTANT FINAL)
- Q_PROPERTY(QDeclarativeAnchorLine baseline READ baseline CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchorLine left READ left CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchorLine right READ right CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchorLine horizontalCenter READ horizontalCenter CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchorLine top READ top CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchorLine bottom READ bottom CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchorLine verticalCenter READ verticalCenter CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchorLine baseline READ baseline CONSTANT FINAL)
Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged)
Q_PROPERTY(bool clip READ clip WRITE setClip NOTIFY clipChanged) // ### move to QGI/QGO, NOTIFY
Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged FINAL)
@@ -107,21 +107,11 @@ public:
QDeclarativeItem *parentItem() const;
void setParentItem(QDeclarativeItem *parent);
- QDeclarativeListProperty<QObject> data();
- QDeclarativeListProperty<QObject> resources();
-
- QDeclarativeAnchors *anchors();
QRectF childrenRect();
bool clip() const;
void setClip(bool);
- QDeclarativeListProperty<QDeclarativeState> states();
- QDeclarativeListProperty<QDeclarativeTransition> transitions();
-
- QString state() const;
- void setState(const QString &);
-
qreal baselineOffset() const;
void setBaselineOffset(qreal);
@@ -159,14 +149,6 @@ public:
Q_INVOKABLE QScriptValue mapToItem(const QScriptValue &item, qreal x, qreal y) const;
Q_INVOKABLE void forceFocus();
- QDeclarativeAnchorLine left() const;
- QDeclarativeAnchorLine right() const;
- QDeclarativeAnchorLine horizontalCenter() const;
- QDeclarativeAnchorLine top() const;
- QDeclarativeAnchorLine bottom() const;
- QDeclarativeAnchorLine verticalCenter() const;
- QDeclarativeAnchorLine baseline() const;
-
Q_SIGNALS:
void childrenChanged();
void childrenRectChanged(const QRectF &);
diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h
index 3f5bf1a..b4dd60a 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h
@@ -150,6 +150,22 @@ public:
void setHeight(qreal);
void resetHeight();
+ QDeclarativeListProperty<QObject> data();
+ QDeclarativeListProperty<QObject> resources();
+
+ QDeclarativeListProperty<QDeclarativeState> states();
+ QDeclarativeListProperty<QDeclarativeTransition> transitions();
+
+ QString state() const;
+ void setState(const QString &);
+
+ QDeclarativeAnchorLine left() const;
+ QDeclarativeAnchorLine right() const;
+ QDeclarativeAnchorLine horizontalCenter() const;
+ QDeclarativeAnchorLine top() const;
+ QDeclarativeAnchorLine bottom() const;
+ QDeclarativeAnchorLine verticalCenter() const;
+ QDeclarativeAnchorLine baseline() const;
// data property
static void data_append(QDeclarativeListProperty<QObject> *, QObject *);
@@ -165,6 +181,11 @@ public:
static QGraphicsTransform *transform_at(QDeclarativeListProperty<QGraphicsTransform> *list, int);
static void transform_clear(QDeclarativeListProperty<QGraphicsTransform> *list);
+ static QDeclarativeItemPrivate* get(QDeclarativeItem *item)
+ {
+ return item->d_func();
+ }
+
// Accelerated property accessors
QDeclarativeNotifier parentNotifier;
static void parentProperty(QObject *o, void *rv, QDeclarativeNotifierEndpoint *e);
@@ -224,7 +245,7 @@ public:
void removeItemChangeListener(QDeclarativeItemChangeListener *, ChangeTypes types);
QPODVector<ChangeListener,4> changeListeners;
- QDeclarativeStateGroup *states();
+ QDeclarativeStateGroup *_states();
QDeclarativeStateGroup *_stateGroup;
QDeclarativeItem::TransformOrigin origin:4;
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
index 13ee4e6..3f1d2ac 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
@@ -443,7 +443,7 @@ void QDeclarativeColumn::reportConflictingAnchors()
for (int ii = 0; ii < positionedItems.count(); ++ii) {
const PositionedItem &child = positionedItems.at(ii);
if (child.item) {
- QDeclarativeAnchors::Anchors usedAnchors = child.item->anchors()->usedAnchors();
+ QDeclarativeAnchors::Anchors usedAnchors = QDeclarativeItemPrivate::get(child.item)->anchors()->usedAnchors();
if (usedAnchors & QDeclarativeAnchors::TopAnchor ||
usedAnchors & QDeclarativeAnchors::BottomAnchor ||
usedAnchors & QDeclarativeAnchors::VCenterAnchor) {
@@ -578,7 +578,7 @@ void QDeclarativeRow::reportConflictingAnchors()
for (int ii = 0; ii < positionedItems.count(); ++ii) {
const PositionedItem &child = positionedItems.at(ii);
if (child.item) {
- QDeclarativeAnchors::Anchors usedAnchors = child.item->anchors()->usedAnchors();
+ QDeclarativeAnchors::Anchors usedAnchors = QDeclarativeItemPrivate::get(child.item)->anchors()->usedAnchors();
if (usedAnchors & QDeclarativeAnchors::LeftAnchor ||
usedAnchors & QDeclarativeAnchors::RightAnchor ||
usedAnchors & QDeclarativeAnchors::HCenterAnchor) {
@@ -868,7 +868,7 @@ void QDeclarativeGrid::reportConflictingAnchors()
bool childsWithConflictingAnchors(false);
for (int ii = 0; ii < positionedItems.count(); ++ii) {
const PositionedItem &child = positionedItems.at(ii);
- if (child.item && child.item->anchors()->usedAnchors()) {
+ if (child.item && QDeclarativeItemPrivate::get(child.item)->anchors()->usedAnchors()) {
childsWithConflictingAnchors = true;
break;
}
@@ -1025,7 +1025,7 @@ void QDeclarativeFlow::reportConflictingAnchors()
bool childsWithConflictingAnchors(false);
for (int ii = 0; ii < positionedItems.count(); ++ii) {
const PositionedItem &child = positionedItems.at(ii);
- if (child.item && child.item->anchors()->usedAnchors()) {
+ if (child.item && QDeclarativeItemPrivate::get(child.item)->anchors()->usedAnchors()) {
childsWithConflictingAnchors = true;
break;
}
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp
index d44e7fb..8043ea9 100644
--- a/src/declarative/qml/qdeclarativebinding.cpp
+++ b/src/declarative/qml/qdeclarativebinding.cpp
@@ -193,7 +193,18 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags)
data->error.setColumn(-1);
data->error.setDescription(QLatin1String("Unable to assign [undefined] to ") + QLatin1String(QMetaType::typeName(data->property.propertyType())));
- } else if (data->property.object() &&
+ } else if (!scriptValue.isRegExp() && scriptValue.isFunction()) {
+
+ QUrl url = QUrl(data->url);
+ int line = data->line;
+ if (url.isEmpty()) url = QUrl(QLatin1String("<Unknown File>"));
+
+ data->error.setUrl(url);
+ data->error.setLine(line);
+ data->error.setColumn(-1);
+ data->error.setDescription(QLatin1String("Unable to assign a function to a property."));
+
+ } else if (data->property.object() &&
!QDeclarativePropertyPrivate::write(data->property, value, flags)) {
QUrl url = QUrl(data->url);
diff --git a/src/declarative/qml/qdeclarativedata_p.h b/src/declarative/qml/qdeclarativedata_p.h
index 4a56536..e916273 100644
--- a/src/declarative/qml/qdeclarativedata_p.h
+++ b/src/declarative/qml/qdeclarativedata_p.h
@@ -152,11 +152,11 @@ public:
template<class T>
void QDeclarativeGuard<T>::addGuard()
{
- if (QObjectPrivate::get(o)->wasDeleted) {
- if (prev) remGuard();
+ Q_ASSERT(!prev);
+
+ if (QObjectPrivate::get(o)->wasDeleted)
return;
- }
-
+
QDeclarativeData *data = QDeclarativeData::get(o, true);
next = data->guards;
if (next) reinterpret_cast<QDeclarativeGuard<T> *>(next)->prev = &next;
@@ -167,6 +167,8 @@ void QDeclarativeGuard<T>::addGuard()
template<class T>
void QDeclarativeGuard<T>::remGuard()
{
+ Q_ASSERT(prev);
+
if (next) reinterpret_cast<QDeclarativeGuard<T> *>(next)->prev = prev;
*prev = next;
next = 0;
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 19d4b57..8992d50 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -870,14 +870,10 @@ void QDeclarativeData::destroyed(QObject *object)
if (ownContext && context)
context->destroy();
- QDeclarativeGuard<QObject> *guard = guards;
- while (guard) {
- QDeclarativeGuard<QObject> *g = guard;
- guard = guard->next;
- g->o = 0;
- g->prev = 0;
- g->next = 0;
- g->objectDestroyed(object);
+ while (guards) {
+ QDeclarativeGuard<QObject> *guard = guards;
+ *guard = (QObject *)0;
+ guard->objectDestroyed(object);
}
if (scriptValue)
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index 671a262..33e47fb 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -368,6 +368,9 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj,
QString error = QLatin1String("Cannot assign [undefined] to ") +
QLatin1String(QMetaType::typeName(lastData->propType));
context->throwError(error);
+ } else if (!value.isRegExp() && value.isFunction()) {
+ QString error = QLatin1String("Cannot assign a function to a property.");
+ context->throwError(error);
} else {
QVariant v;
if (lastData->flags & QDeclarativePropertyCache::Data::IsQList)
diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp
index 45f04a0..13e9c26 100644
--- a/src/declarative/qml/qdeclarativevmemetaobject.cpp
+++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp
@@ -106,8 +106,7 @@ QDeclarativeVMEVariant::~QDeclarativeVMEVariant()
void QDeclarativeVMEVariant::cleanup()
{
if (type == QVariant::Invalid) {
- } else if (type == QMetaType::QObjectStar ||
- type == QMetaType::Int ||
+ } else if (type == QMetaType::Int ||
type == QMetaType::Bool ||
type == QMetaType::Double) {
type = QVariant::Invalid;
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 689f53c..a93a25d 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -1056,40 +1056,41 @@ void QDeclarativeAnchorChanges::execute(Reason reason)
if (!d->target)
return;
+ QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
//incorporate any needed "reverts"
if (d->applyOrigLeft) {
if (!d->origLeftBinding)
- d->target->anchors()->resetLeft();
+ targetPrivate->anchors()->resetLeft();
QDeclarativePropertyPrivate::setBinding(d->leftProp, d->origLeftBinding);
}
if (d->applyOrigRight) {
if (!d->origRightBinding)
- d->target->anchors()->resetRight();
+ targetPrivate->anchors()->resetRight();
QDeclarativePropertyPrivate::setBinding(d->rightProp, d->origRightBinding);
}
if (d->applyOrigHCenter) {
if (!d->origHCenterBinding)
- d->target->anchors()->resetHorizontalCenter();
+ targetPrivate->anchors()->resetHorizontalCenter();
QDeclarativePropertyPrivate::setBinding(d->hCenterProp, d->origHCenterBinding);
}
if (d->applyOrigTop) {
if (!d->origTopBinding)
- d->target->anchors()->resetTop();
+ targetPrivate->anchors()->resetTop();
QDeclarativePropertyPrivate::setBinding(d->topProp, d->origTopBinding);
}
if (d->applyOrigBottom) {
if (!d->origBottomBinding)
- d->target->anchors()->resetBottom();
+ targetPrivate->anchors()->resetBottom();
QDeclarativePropertyPrivate::setBinding(d->bottomProp, d->origBottomBinding);
}
if (d->applyOrigVCenter) {
if (!d->origVCenterBinding)
- d->target->anchors()->resetVerticalCenter();
+ targetPrivate->anchors()->resetVerticalCenter();
QDeclarativePropertyPrivate::setBinding(d->vCenterProp, d->origVCenterBinding);
}
if (d->applyOrigBaseline) {
if (!d->origBaselineBinding)
- d->target->anchors()->resetBaseline();
+ targetPrivate->anchors()->resetBaseline();
QDeclarativePropertyPrivate::setBinding(d->baselineProp, d->origBaselineBinding);
}
@@ -1105,31 +1106,31 @@ void QDeclarativeAnchorChanges::execute(Reason reason)
//reset any anchors that have been specified as "undefined"
if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::LeftAnchor) {
- d->target->anchors()->resetLeft();
+ targetPrivate->anchors()->resetLeft();
QDeclarativePropertyPrivate::setBinding(d->leftProp, 0);
}
if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::RightAnchor) {
- d->target->anchors()->resetRight();
+ targetPrivate->anchors()->resetRight();
QDeclarativePropertyPrivate::setBinding(d->rightProp, 0);
}
if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::HCenterAnchor) {
- d->target->anchors()->resetHorizontalCenter();
+ targetPrivate->anchors()->resetHorizontalCenter();
QDeclarativePropertyPrivate::setBinding(d->hCenterProp, 0);
}
if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::TopAnchor) {
- d->target->anchors()->resetTop();
+ targetPrivate->anchors()->resetTop();
QDeclarativePropertyPrivate::setBinding(d->topProp, 0);
}
if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::BottomAnchor) {
- d->target->anchors()->resetBottom();
+ targetPrivate->anchors()->resetBottom();
QDeclarativePropertyPrivate::setBinding(d->bottomProp, 0);
}
if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::VCenterAnchor) {
- d->target->anchors()->resetVerticalCenter();
+ targetPrivate->anchors()->resetVerticalCenter();
QDeclarativePropertyPrivate::setBinding(d->vCenterProp, 0);
}
if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::BaselineAnchor) {
- d->target->anchors()->resetBaseline();
+ targetPrivate->anchors()->resetBaseline();
QDeclarativePropertyPrivate::setBinding(d->baselineProp, 0);
}
@@ -1161,51 +1162,52 @@ void QDeclarativeAnchorChanges::reverse(Reason reason)
if (!d->target)
return;
+ QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
//reset any anchors set by the state
if (d->leftBinding) {
- d->target->anchors()->resetLeft();
+ targetPrivate->anchors()->resetLeft();
QDeclarativePropertyPrivate::setBinding(d->leftBinding->property(), 0);
if (reason == ActualChange) {
d->leftBinding->destroy(); d->leftBinding = 0;
}
}
if (d->rightBinding) {
- d->target->anchors()->resetRight();
+ targetPrivate->anchors()->resetRight();
QDeclarativePropertyPrivate::setBinding(d->rightBinding->property(), 0);
if (reason == ActualChange) {
d->rightBinding->destroy(); d->rightBinding = 0;
}
}
if (d->hCenterBinding) {
- d->target->anchors()->resetHorizontalCenter();
+ targetPrivate->anchors()->resetHorizontalCenter();
QDeclarativePropertyPrivate::setBinding(d->hCenterBinding->property(), 0);
if (reason == ActualChange) {
d->hCenterBinding->destroy(); d->hCenterBinding = 0;
}
}
if (d->topBinding) {
- d->target->anchors()->resetTop();
+ targetPrivate->anchors()->resetTop();
QDeclarativePropertyPrivate::setBinding(d->topBinding->property(), 0);
if (reason == ActualChange) {
d->topBinding->destroy(); d->topBinding = 0;
}
}
if (d->bottomBinding) {
- d->target->anchors()->resetBottom();
+ targetPrivate->anchors()->resetBottom();
QDeclarativePropertyPrivate::setBinding(d->bottomBinding->property(), 0);
if (reason == ActualChange) {
d->bottomBinding->destroy(); d->bottomBinding = 0;
}
}
if (d->vCenterBinding) {
- d->target->anchors()->resetVerticalCenter();
+ targetPrivate->anchors()->resetVerticalCenter();
QDeclarativePropertyPrivate::setBinding(d->vCenterBinding->property(), 0);
if (reason == ActualChange) {
d->vCenterBinding->destroy(); d->vCenterBinding = 0;
}
}
if (d->baselineBinding) {
- d->target->anchors()->resetBaseline();
+ targetPrivate->anchors()->resetBaseline();
QDeclarativePropertyPrivate::setBinding(d->baselineBinding->property(), 0);
if (reason == ActualChange) {
d->baselineBinding->destroy(); d->baselineBinding = 0;
@@ -1335,37 +1337,38 @@ void QDeclarativeAnchorChanges::clearBindings()
d->fromWidth = d->target->width();
d->fromHeight = d->target->height();
+ QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
//reset any anchors with corresponding reverts
//reset any anchors that have been specified as "undefined"
//reset any anchors that we'll be setting in the state
QDeclarativeAnchors::Anchors combined = d->anchorSet->d_func()->resetAnchors |
d->anchorSet->d_func()->usedAnchors;
if (d->applyOrigLeft || (combined & QDeclarativeAnchors::LeftAnchor)) {
- d->target->anchors()->resetLeft();
+ targetPrivate->anchors()->resetLeft();
QDeclarativePropertyPrivate::setBinding(d->leftProp, 0);
}
if (d->applyOrigRight || (combined & QDeclarativeAnchors::RightAnchor)) {
- d->target->anchors()->resetRight();
+ targetPrivate->anchors()->resetRight();
QDeclarativePropertyPrivate::setBinding(d->rightProp, 0);
}
if (d->applyOrigHCenter || (combined & QDeclarativeAnchors::HCenterAnchor)) {
- d->target->anchors()->resetHorizontalCenter();
+ targetPrivate->anchors()->resetHorizontalCenter();
QDeclarativePropertyPrivate::setBinding(d->hCenterProp, 0);
}
if (d->applyOrigTop || (combined & QDeclarativeAnchors::TopAnchor)) {
- d->target->anchors()->resetTop();
+ targetPrivate->anchors()->resetTop();
QDeclarativePropertyPrivate::setBinding(d->topProp, 0);
}
if (d->applyOrigBottom || (combined & QDeclarativeAnchors::BottomAnchor)) {
- d->target->anchors()->resetBottom();
+ targetPrivate->anchors()->resetBottom();
QDeclarativePropertyPrivate::setBinding(d->bottomProp, 0);
}
if (d->applyOrigVCenter || (combined & QDeclarativeAnchors::VCenterAnchor)) {
- d->target->anchors()->resetVerticalCenter();
+ targetPrivate->anchors()->resetVerticalCenter();
QDeclarativePropertyPrivate::setBinding(d->vCenterProp, 0);
}
if (d->applyOrigBaseline || (combined & QDeclarativeAnchors::BaselineAnchor)) {
- d->target->anchors()->resetBaseline();
+ targetPrivate->anchors()->resetBaseline();
QDeclarativePropertyPrivate::setBinding(d->baselineProp, 0);
}
}
@@ -1387,21 +1390,22 @@ void QDeclarativeAnchorChanges::rewind()
if (!d->target)
return;
+ QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
//restore previous anchors
if (d->rewindLeft.anchorLine != QDeclarativeAnchorLine::Invalid)
- d->target->anchors()->setLeft(d->rewindLeft);
+ targetPrivate->anchors()->setLeft(d->rewindLeft);
if (d->rewindRight.anchorLine != QDeclarativeAnchorLine::Invalid)
- d->target->anchors()->setRight(d->rewindRight);
+ targetPrivate->anchors()->setRight(d->rewindRight);
if (d->rewindHCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
- d->target->anchors()->setHorizontalCenter(d->rewindHCenter);
+ targetPrivate->anchors()->setHorizontalCenter(d->rewindHCenter);
if (d->rewindTop.anchorLine != QDeclarativeAnchorLine::Invalid)
- d->target->anchors()->setTop(d->rewindTop);
+ targetPrivate->anchors()->setTop(d->rewindTop);
if (d->rewindBottom.anchorLine != QDeclarativeAnchorLine::Invalid)
- d->target->anchors()->setBottom(d->rewindBottom);
+ targetPrivate->anchors()->setBottom(d->rewindBottom);
if (d->rewindVCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
- d->target->anchors()->setVerticalCenter(d->rewindVCenter);
+ targetPrivate->anchors()->setVerticalCenter(d->rewindVCenter);
if (d->rewindBaseline.anchorLine != QDeclarativeAnchorLine::Invalid)
- d->target->anchors()->setBaseline(d->rewindBaseline);
+ targetPrivate->anchors()->setBaseline(d->rewindBaseline);
d->target->setX(d->rewindX);
d->target->setY(d->rewindY);
@@ -1415,13 +1419,14 @@ void QDeclarativeAnchorChanges::saveCurrentValues()
if (!d->target)
return;
- d->rewindLeft = d->target->anchors()->left();
- d->rewindRight = d->target->anchors()->right();
- d->rewindHCenter = d->target->anchors()->horizontalCenter();
- d->rewindTop = d->target->anchors()->top();
- d->rewindBottom = d->target->anchors()->bottom();
- d->rewindVCenter = d->target->anchors()->verticalCenter();
- d->rewindBaseline = d->target->anchors()->baseline();
+ QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
+ d->rewindLeft = targetPrivate->anchors()->left();
+ d->rewindRight = targetPrivate->anchors()->right();
+ d->rewindHCenter = targetPrivate->anchors()->horizontalCenter();
+ d->rewindTop = targetPrivate->anchors()->top();
+ d->rewindBottom = targetPrivate->anchors()->bottom();
+ d->rewindVCenter = targetPrivate->anchors()->verticalCenter();
+ d->rewindBaseline = targetPrivate->anchors()->baseline();
d->rewindX = d->target->x();
d->rewindY = d->target->y();