summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/graphicsitems.pri2
-rw-r--r--src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp269
-rw-r--r--src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h89
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp2
-rw-r--r--src/declarative/qml/qdeclarativebinding.cpp13
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp30
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp7
-rw-r--r--src/declarative/qml/qdeclarativescriptparser.cpp11
-rw-r--r--src/declarative/util/qdeclarativepropertychanges.cpp13
-rw-r--r--src/declarative/util/qdeclarativestate.cpp12
-rw-r--r--src/declarative/util/qdeclarativestate_p.h2
-rw-r--r--src/imports/widgets/graphicslayouts_p.h3
-rw-r--r--src/imports/widgets/graphicswidgets.cpp40
-rw-r--r--src/imports/widgets/graphicswidgets_p.h68
-rw-r--r--src/imports/widgets/widgets.cpp70
-rw-r--r--src/imports/widgets/widgets.pro1
16 files changed, 54 insertions, 578 deletions
diff --git a/src/declarative/graphicsitems/graphicsitems.pri b/src/declarative/graphicsitems/graphicsitems.pri
index af76a67..eab41e3 100644
--- a/src/declarative/graphicsitems/graphicsitems.pri
+++ b/src/declarative/graphicsitems/graphicsitems.pri
@@ -48,7 +48,6 @@ HEADERS += \
$$PWD/qdeclarativetext_p_p.h \
$$PWD/qdeclarativevisualitemmodel_p.h \
$$PWD/qdeclarativelistview_p.h \
- $$PWD/qdeclarativegraphicsobjectcontainer_p.h \
$$PWD/qdeclarativelayoutitem_p.h \
$$PWD/qdeclarativeitemchangelistener_p.h \
$$PWD/qdeclarativeeffects.cpp
@@ -82,5 +81,4 @@ SOURCES += \
$$PWD/qdeclarativetextedit.cpp \
$$PWD/qdeclarativevisualitemmodel.cpp \
$$PWD/qdeclarativelistview.cpp \
- $$PWD/qdeclarativegraphicsobjectcontainer.cpp \
$$PWD/qdeclarativelayoutitem.cpp
diff --git a/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp b/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp
deleted file mode 100644
index f5beebd..0000000
--- a/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
-** this package.
-**
-** 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.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.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "private/qdeclarativegraphicsobjectcontainer_p.h"
-
-#include "private/qdeclarativeitem_p.h"
-
-#include <QGraphicsObject>
-#include <QGraphicsWidget>
-#include <QGraphicsSceneResizeEvent>
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeGraphicsObjectContainerPrivate : public QDeclarativeItemPrivate
-{
- Q_DECLARE_PUBLIC(QDeclarativeGraphicsObjectContainer)
-
-public:
- QDeclarativeGraphicsObjectContainerPrivate() : QDeclarativeItemPrivate(), graphicsObject(0), syncedResize(false)
- { }
-
- void _q_updateSize();
-
- void setFiltering(bool on)
- {
- Q_Q(QDeclarativeGraphicsObjectContainer);
- if (graphicsObject && graphicsObject->isWidget()) {
- if (!on) {
- graphicsObject->removeEventFilter(q);
- QObject::disconnect(q, SIGNAL(widthChanged()), q, SLOT(_q_updateSize()));
- QObject::disconnect(q, SIGNAL(heightChanged()), q, SLOT(_q_updateSize()));
- } else {
- graphicsObject->installEventFilter(q);
- QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(_q_updateSize()));
- QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(_q_updateSize()));
- }
- }
- }
-
-
- QGraphicsObject *graphicsObject;
- bool syncedResize;
-};
-
-
-/*!
- \qmlclass GraphicsObjectContainer QDeclarativeGraphicsObjectContainer
- \since 4.7
- \brief The GraphicsObjectContainer element allows you to add QGraphicsObjects into Fluid UI elements.
-
- While any QObject based class can be exposed to QML, QDeclarativeItem
- provides a lot of important functionality, including anchors and proper
- management of child items. GraphicsObjectContainer helps provide these
- functions to other QGraphicsObjects, so that they can be used unaltered in
- a QML scene. QGraphicsObjects, which are not QDeclarativeItems, and which are
- placed in a QML scene outside of a GraphicsObjectContainer, will not appear
- on screen at all.
-
- A GraphicsObjectContainer can have one element inside it, and it must be a
- QGraphicsObject or subclass which has been exposed to the QML engine.
- The graphics object inside the GraphicsObjectContainer can then be used
- like any other item in QML with the exception of not being reparentable
- and not having the standard properties of QML items (such as anchors).
-
- As the contained object is positioned relative to the container, anchors
- affecting the container item will affect the onscreen position of the
- contained item. If synchronizedResizing is set to true, then anchors
- affecting the container item's size will also affect the contained item's
- size.
-
- Example:
- \code
- import Qt 4.7
- import MyApp 2.1 as Widgets
- Rectangle{
- id: rect
- property alias widgetPropertyThree: widget.myThirdProperty;
- GraphicsObjectContainer{
- synchronizedResizing: true
- anchors.margins: 10
- anchors.fill: parent
- Widgets.MyWidget{
- myProperty: "A Value"
- myOtherProperty: rect.color
- }
- }
- }
- \endcode
-*/
-
-/*!
- \internal
- \class QDeclarativeGraphicsObjectContainer
- \brief The QDeclarativeGraphicsObjectContainer class allows you to add QGraphicsObjects into Fluid UI applications.
-*/
-
-QDeclarativeGraphicsObjectContainer::QDeclarativeGraphicsObjectContainer(QDeclarativeItem *parent)
-: QDeclarativeItem(*new QDeclarativeGraphicsObjectContainerPrivate, parent)
-{
-}
-
-QDeclarativeGraphicsObjectContainer::~QDeclarativeGraphicsObjectContainer()
-{
-}
-
-QGraphicsObject *QDeclarativeGraphicsObjectContainer::graphicsObject() const
-{
- Q_D(const QDeclarativeGraphicsObjectContainer);
- return d->graphicsObject;
-}
-
-/*!
- \qmlproperty QGraphicsObject GraphicsObjectContainer::graphicsObject
- The QGraphicsObject associated with this element.
-*/
-void QDeclarativeGraphicsObjectContainer::setGraphicsObject(QGraphicsObject *object)
-{
- Q_D(QDeclarativeGraphicsObjectContainer);
- if (object == d->graphicsObject)
- return;
-
- //### remove previously set item?
-
- d->setFiltering(false);
-
- d->graphicsObject = object;
-
- if (d->graphicsObject) {
- d->graphicsObject->setParentItem(this);
-
- if (d->syncedResize && d->graphicsObject->isWidget()) {
- QGraphicsWidget *gw = static_cast<QGraphicsWidget*>(d->graphicsObject);
- QSizeF gwSize = gw->size(); //### should we use sizeHint?
- QSizeF newSize = gwSize;
- if (heightValid())
- newSize.setHeight(height());
- if (widthValid())
- newSize.setWidth(width());
- if (gwSize != newSize)
- gw->resize(newSize);
-
- gwSize = gw->size();
- setImplicitWidth(gwSize.width());
- setImplicitHeight(gwSize.height());
-
- d->setFiltering(true);
- }
- }
-}
-
-QVariant QDeclarativeGraphicsObjectContainer::itemChange(GraphicsItemChange change, const QVariant &value)
-{
- Q_D(QDeclarativeGraphicsObjectContainer);
- if (change == ItemSceneHasChanged) {
- QGraphicsObject *o = d->graphicsObject;
- d->graphicsObject = 0;
- setGraphicsObject(o);
- }
- return QDeclarativeItem::itemChange(change, value);
-}
-
-bool QDeclarativeGraphicsObjectContainer::eventFilter(QObject *watched, QEvent *e)
-{
- Q_D(QDeclarativeGraphicsObjectContainer);
- if (watched == d->graphicsObject && e->type() == QEvent::GraphicsSceneResize) {
- if (d->graphicsObject && d->graphicsObject->isWidget() && d->syncedResize) {
- QSizeF newSize = static_cast<QGraphicsWidget*>(d->graphicsObject)->size();
- setImplicitWidth(newSize.width());
- setImplicitHeight(newSize.height());
- }
- }
- return QDeclarativeItem::eventFilter(watched, e);
-}
-
-/*!
- \qmlproperty bool GraphicsObjectContainer::synchronizedResizing
-
- This property determines whether or not the container and graphics object will synchronize their
- sizes.
-
- \note This property only applies when wrapping a QGraphicsWidget.
-
- If synchronizedResizing is enabled, the container and widget will
- synchronize their sizes as follows.
- \list
- \o If a size has been set on the container, the widget will be resized to the container.
- Any changes in the container's size will be reflected in the widget.
-
- \o \e Otherwise, the container will initially be sized to the preferred size of the widget.
- Any changes to the container's size will be reflected in the widget, and any changes to the
- widget's size will be reflected in the container.
- \endlist
-*/
-bool QDeclarativeGraphicsObjectContainer::synchronizedResizing() const
-{
- Q_D(const QDeclarativeGraphicsObjectContainer);
- return d->syncedResize;
-}
-
-void QDeclarativeGraphicsObjectContainer::setSynchronizedResizing(bool on)
-{
- Q_D(QDeclarativeGraphicsObjectContainer);
- if (on == d->syncedResize)
- return;
-
- d->syncedResize = on;
- d->setFiltering(on);
-}
-
-void QDeclarativeGraphicsObjectContainerPrivate::_q_updateSize()
-{
- if (!graphicsObject || !graphicsObject->isWidget() || !syncedResize)
- return;
-
- QGraphicsWidget *gw = static_cast<QGraphicsWidget*>(graphicsObject);
- const QSizeF newSize(width(), height());
- gw->resize(newSize);
-
- //### will respecting the widgets min/max ever get us in trouble? (all other items always
- // size to exactly what you tell them)
- /*QSizeF constrainedSize = newSize.expandedTo(gw->minimumSize()).boundedTo(gw->maximumSize());
- gw->resize(constrainedSize);
- if (constrainedSize != newSize) {
- setImplicitWidth(constrainedSize.width());
- setImplicitHeight(constrainedSize.height());
- }*/
-}
-
-#include <moc_qdeclarativegraphicsobjectcontainer_p.cpp>
-
-QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h b/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h
deleted file mode 100644
index 20c5bcf..0000000
--- a/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
-** this package.
-**
-** 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.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.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVEGRAPHICSOBJECTCONTAINER_H
-#define QDECLARATIVEGRAPHICSOBJECTCONTAINER_H
-
-#include "qdeclarativeitem.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QGraphicsObject;
-class QDeclarativeGraphicsObjectContainerPrivate;
-
-class Q_DECLARATIVE_EXPORT QDeclarativeGraphicsObjectContainer : public QDeclarativeItem
-{
- Q_OBJECT
-
- Q_CLASSINFO("DefaultProperty", "graphicsObject")
- Q_PROPERTY(QGraphicsObject *graphicsObject READ graphicsObject WRITE setGraphicsObject)
- Q_PROPERTY(bool synchronizedResizing READ synchronizedResizing WRITE setSynchronizedResizing)
-
-public:
- QDeclarativeGraphicsObjectContainer(QDeclarativeItem *parent = 0);
- ~QDeclarativeGraphicsObjectContainer();
-
- QGraphicsObject *graphicsObject() const;
- void setGraphicsObject(QGraphicsObject *);
-
- bool synchronizedResizing() const;
- void setSynchronizedResizing(bool on);
-
-protected:
- QVariant itemChange(GraphicsItemChange change, const QVariant &value);
- bool eventFilter(QObject *watched, QEvent *e);
-
-private:
- Q_PRIVATE_SLOT(d_func(), void _q_updateSize())
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeGraphicsObjectContainer)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QDeclarativeGraphicsObjectContainer)
-
-QT_END_HEADER
-
-#endif // QDECLARATIVEGRAPHICSOBJECTCONTAINER_H
diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
index 35a4d00..7664af1 100644
--- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
@@ -57,7 +57,6 @@
#include "private/qdeclarativeflipable_p.h"
#include "private/qdeclarativefocuspanel_p.h"
#include "private/qdeclarativefocusscope_p.h"
-#include "private/qdeclarativegraphicsobjectcontainer_p.h"
#include "private/qdeclarativegridview_p.h"
#include "private/qdeclarativeimage_p.h"
#include "private/qdeclarativeitem_p.h"
@@ -96,7 +95,6 @@ void QDeclarativeItemModule::defineModule()
qmlRegisterType<QDeclarativeFocusScope>("Qt",4,6,"FocusScope");
qmlRegisterType<QDeclarativeGradient>("Qt",4,6,"Gradient");
qmlRegisterType<QDeclarativeGradientStop>("Qt",4,6,"GradientStop");
- qmlRegisterType<QDeclarativeGraphicsObjectContainer>("Qt",4,6,"GraphicsObjectContainer");
qmlRegisterType<QDeclarativeGrid>("Qt",4,6,"Grid");
qmlRegisterType<QDeclarativeGridView>("Qt",4,6,"GridView");
qmlRegisterType<QDeclarativeImage>("Qt",4,6,"Image");
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp
index 6a99855..91eb915 100644
--- a/src/declarative/qml/qdeclarativebinding.cpp
+++ b/src/declarative/qml/qdeclarativebinding.cpp
@@ -170,19 +170,6 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags)
if (data->error.isValid()) {
- } else if (!scriptValue.isVariant() && value.userType() == QMetaType::QVariantList &&
- data->property.propertyType() == qMetaTypeId<QVariant>()) {
-
- // This case catches QtScript's automatic conversion to QVariantList for arrays
- 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 JavaScript array to QML variant property"));
-
} else if (isUndefined && data->property.isResettable()) {
data->property.reset();
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 68ce953..8905713 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1479,13 +1479,17 @@ public:
QSet<QString> qmlDirFilesForWhichPluginsHaveBeenLoaded;
- QDeclarativeDirComponents importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine) {
+ QDeclarativeDirComponents importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine, QString *errorString) {
QFile file(absoluteFilePath);
QString filecontent;
if (file.open(QFile::ReadOnly)) {
filecontent = QString::fromUtf8(file.readAll());
if (qmlImportTrace())
qDebug() << "QDeclarativeEngine::add: loaded" << absoluteFilePath;
+ } else {
+ if (errorString)
+ *errorString = QDeclarativeEngine::tr("module \"%1\" definition \"%2\" not readable").arg(uri).arg(absoluteFilePath);
+ return QDeclarativeDirComponents();
}
QDir dir = QFileInfo(file).dir();
@@ -1505,7 +1509,15 @@ public:
plugin.name);
if (!resolvedFilePath.isEmpty()) {
- engine->importPlugin(resolvedFilePath, uri);
+ if (!engine->importPlugin(resolvedFilePath, uri)) {
+ if (errorString)
+ *errorString = QDeclarativeEngine::tr("plugin \"%1\" cannot be loaded for module \"%2\"").arg(resolvedFilePath).arg(uri);
+ return QDeclarativeDirComponents();
+ }
+ } else {
+ if (errorString)
+ *errorString = QDeclarativeEngine::tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name);
+ return QDeclarativeDirComponents();
}
}
}
@@ -1570,7 +1582,9 @@ public:
url = QUrl::fromLocalFile(fi.absolutePath()).toString();
uri = resolvedUri(dir, engine);
- qmldircomponents = importExtension(absoluteFilePath, uri, engine);
+ qmldircomponents = importExtension(absoluteFilePath, uri, engine, errorString);
+ if (qmldircomponents.isEmpty()) // error (or empty)
+ return false;
break;
}
}
@@ -1601,12 +1615,14 @@ public:
return false; // local import dirs must exist
}
uri = resolvedUri(toLocalFileOrQrc(base.resolved(QUrl(uri))), engine);
- qmldircomponents = importExtension(localFileOrQrc,
- uri,
- engine);
-
if (uri.endsWith(QLatin1Char('/')))
uri.chop(1);
+ if (QFile::exists(localFileOrQrc)) {
+ qmldircomponents = importExtension(localFileOrQrc,
+ uri,engine,errorString);
+ if (qmldircomponents.isEmpty()) // error (or empty)
+ return false;
+ }
} else {
if (prefix.isEmpty()) {
// directory must at least exist for valid import
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index ec84da9..4601aaa 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -361,12 +361,7 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj,
else
v = enginePriv->scriptValueToVariant(value, lastData->propType);
- if (!value.isVariant() && v.userType() == QMetaType::QVariantList &&
- lastData->propType == qMetaTypeId<QVariant>()) {
-
- QString error = QLatin1String("Cannot assign JavaScript array to QML variant property");
- context->throwError(error);
- } else if (!QDeclarativePropertyPrivate::write(obj, *lastData, v, evalContext)) {
+ if (!QDeclarativePropertyPrivate::write(obj, *lastData, v, evalContext)) {
const char *valueType = 0;
if (v.userType() == QVariant::Invalid) valueType = "null";
else valueType = QMetaType::typeName(v.userType());
diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp
index 507ff5b..92a10aa 100644
--- a/src/declarative/qml/qdeclarativescriptparser.cpp
+++ b/src/declarative/qml/qdeclarativescriptparser.cpp
@@ -535,7 +535,8 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
// { "time", Object::DynamicProperty::Time, "QTime" },
// { "date", Object::DynamicProperty::Date, "QDate" },
{ "date", Object::DynamicProperty::DateTime, "QDateTime" },
- { "var", Object::DynamicProperty::Variant, "QVariant" }
+ { "var", Object::DynamicProperty::Variant, "QVariant" },
+ { "variant", Object::DynamicProperty::Variant, "QVariant" }
};
const int propTypeNameToTypesCount = sizeof(propTypeNameToTypes) /
sizeof(propTypeNameToTypes[0]);
@@ -563,7 +564,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
_parser->_errors << error;
return false;
}
-
+
signal.parameterTypes << qtType;
signal.parameterNames << p->name->asString().toUtf8();
p = p->finish();
@@ -646,6 +647,11 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
property.location = location(node->firstSourceLocation(),
node->lastSourceLocation());
+ if (memberType == QByteArray("var"))
+ qWarning().nospace() << qPrintable(_parser->_scriptFile) << ":" << property.location.start.line << ":"
+ << property.location.start.column << ": var type has been replaced by variant. "
+ << "Support will be removed entirely shortly.";
+
if (node->expression) { // default value
property.defaultValue = new Property;
property.defaultValue->parent = _stateStack.top().object;
@@ -909,6 +915,7 @@ bool QDeclarativeScriptParser::parse(const QByteArray &qmldata, const QUrl &url)
clear();
const QString fileName = url.toString();
+ _scriptFile = fileName;
QTextStream stream(qmldata, QIODevice::ReadOnly);
stream.setCodec("UTF-8");
diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp
index ecbd71e..9c3ee9f 100644
--- a/src/declarative/util/qdeclarativepropertychanges.cpp
+++ b/src/declarative/util/qdeclarativepropertychanges.cpp
@@ -377,7 +377,7 @@ QDeclarativeProperty
QDeclarativePropertyChangesPrivate::property(const QByteArray &property)
{
Q_Q(QDeclarativePropertyChanges);
- QDeclarativeProperty prop(object, QString::fromUtf8(property));
+ QDeclarativeProperty prop(object, QString::fromUtf8(property), qmlContext(q));
if (!prop.isValid()) {
qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(property));
return QDeclarativeProperty();
@@ -400,16 +400,11 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions()
QByteArray property = d->properties.at(ii).first;
- QDeclarativeAction a(d->object, QString::fromLatin1(property),
- d->properties.at(ii).second);
+ QDeclarativeAction a(d->object, QString::fromUtf8(property),
+ qmlContext(this), d->properties.at(ii).second);
if (a.property.isValid()) {
a.restore = restoreEntryValues();
-
- if (a.property.propertyType() == QVariant::Url &&
- (a.toValue.userType() == QVariant::String || a.toValue.userType() == QVariant::ByteArray) && !a.toValue.isNull())
- a.toValue.setValue(qmlContext(this)->resolvedUrl(QUrl(a.toValue.toString())));
-
list << a;
}
}
@@ -436,7 +431,7 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions()
a.property = prop;
a.fromValue = a.property.read();
a.specifiedObject = d->object;
- a.specifiedProperty = QString::fromLatin1(property);
+ a.specifiedProperty = QString::fromUtf8(property);
if (d->isExplicit) {
a.toValue = d->expressions.at(ii).second->value();
diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp
index e4c968e..78813fa 100644
--- a/src/declarative/util/qdeclarativestate.cpp
+++ b/src/declarative/util/qdeclarativestate.cpp
@@ -74,6 +74,18 @@ QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyN
fromValue = property.read();
}
+QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyName,
+ QDeclarativeContext *context, const QVariant &value)
+: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false),
+ property(target, propertyName, context), toValue(value),
+ fromBinding(0), toBinding(0), event(0),
+ specifiedObject(target), specifiedProperty(propertyName)
+{
+ if (property.isValid())
+ fromValue = property.read();
+}
+
+
QDeclarativeActionEvent::~QDeclarativeActionEvent()
{
}
diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h
index ee2b7e8..472897e 100644
--- a/src/declarative/util/qdeclarativestate_p.h
+++ b/src/declarative/util/qdeclarativestate_p.h
@@ -61,6 +61,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeAction
public:
QDeclarativeAction();
QDeclarativeAction(QObject *, const QString &, const QVariant &);
+ QDeclarativeAction(QObject *, const QString &,
+ QDeclarativeContext *, const QVariant &);
bool restore:1;
bool actionDone:1;
diff --git a/src/imports/widgets/graphicslayouts_p.h b/src/imports/widgets/graphicslayouts_p.h
index f9b9ae8..1c3dfe5 100644
--- a/src/imports/widgets/graphicslayouts_p.h
+++ b/src/imports/widgets/graphicslayouts_p.h
@@ -42,10 +42,9 @@
#ifndef GRAPHICSLAYOUTS_H
#define GRAPHICSLAYOUTS_H
-#include "graphicswidgets_p.h"
-
#include <QtGui/QGraphicsLinearLayout>
#include <QtGui/QGraphicsGridLayout>
+#include <qdeclarative.h>
QT_BEGIN_HEADER
diff --git a/src/imports/widgets/graphicswidgets.cpp b/src/imports/widgets/graphicswidgets.cpp
deleted file mode 100644
index 062e516..0000000
--- a/src/imports/widgets/graphicswidgets.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
-** this package.
-**
-** 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.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.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
diff --git a/src/imports/widgets/graphicswidgets_p.h b/src/imports/widgets/graphicswidgets_p.h
deleted file mode 100644
index 2c2b707..0000000
--- a/src/imports/widgets/graphicswidgets_p.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying
-** this package.
-**
-** 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.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.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef GRAPHICSWIDGETS_H
-#define GRAPHICSWIDGETS_H
-
-#include <qdeclarative.h>
-
-#include <QtGui/QGraphicsScene>
-#include <QtGui/QGraphicsView>
-#include <QtGui/QGraphicsWidget>
-#include <QtGui/QGraphicsItem>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QGraphicsView)
-QML_DECLARE_TYPE_HASMETATYPE(QGraphicsScene)
-QML_DECLARE_TYPE(QGraphicsWidget)
-QML_DECLARE_TYPE(QGraphicsObject)
-QML_DECLARE_INTERFACE_HASMETATYPE(QGraphicsItem)
-
-QT_END_HEADER
-
-#endif // GRAPHICSWIDGETS_H
diff --git a/src/imports/widgets/widgets.cpp b/src/imports/widgets/widgets.cpp
index bc18e8a..f26969a 100644
--- a/src/imports/widgets/widgets.cpp
+++ b/src/imports/widgets/widgets.cpp
@@ -41,75 +41,12 @@
#include <QtDeclarative/qdeclarativeextensionplugin.h>
#include <QtDeclarative/qdeclarative.h>
+#include <QGraphicsWidget>
#include "graphicslayouts_p.h"
-#include "graphicswidgets_p.h"
QT_BEGIN_NAMESPACE
-class QGraphicsViewDeclarativeUI : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QGraphicsScene *scene READ scene WRITE setScene)
- Q_CLASSINFO("DefaultProperty", "scene")
-public:
- QGraphicsViewDeclarativeUI(QObject *other) : QObject(other) {}
-
- QGraphicsScene *scene() const { return static_cast<QGraphicsView *>(parent())->scene(); }
- void setScene(QGraphicsScene *scene)
- {
- static_cast<QGraphicsView *>(parent())->setScene(scene);
- }
-};
-
-class QGraphicsSceneDeclarativeUI : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QDeclarativeListProperty<QObject> children READ children)
- Q_CLASSINFO("DefaultProperty", "children")
-public:
- QGraphicsSceneDeclarativeUI(QObject *other) : QObject(other) {}
-
- QDeclarativeListProperty<QObject> children() { return QDeclarativeListProperty<QObject>(this->parent(), 0, children_append); }
-
-private:
- static void children_append(QDeclarativeListProperty<QObject> *prop, QObject *o) {
- if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o))
- static_cast<QGraphicsScene *>(prop->object)->addItem(go);
- }
-};
-
-class QGraphicsWidgetDeclarativeUI : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QDeclarativeListProperty<QGraphicsItem> children READ children)
- Q_PROPERTY(QGraphicsLayout *layout READ layout WRITE setLayout)
- Q_CLASSINFO("DefaultProperty", "children")
-public:
- QGraphicsWidgetDeclarativeUI(QObject *other) : QObject(other) {}
-
- QDeclarativeListProperty<QGraphicsItem> children() { return QDeclarativeListProperty<QGraphicsItem>(this, 0, children_append); }
-
- QGraphicsLayout *layout() const { return static_cast<QGraphicsWidget *>(parent())->layout(); }
- void setLayout(QGraphicsLayout *lo)
- {
- static_cast<QGraphicsWidget *>(parent())->setLayout(lo);
- }
-
-private:
- void setItemParent(QGraphicsItem *wid)
- {
- wid->setParentItem(static_cast<QGraphicsWidget *>(parent()));
- }
-
- static void children_append(QDeclarativeListProperty<QGraphicsItem> *prop, QGraphicsItem *i) {
- static_cast<QGraphicsWidgetDeclarativeUI*>(prop->object)->setItemParent(i);
- }
-};
-
class QWidgetsQmlModule : public QDeclarativeExtensionPlugin
{
Q_OBJECT
@@ -123,10 +60,7 @@ public:
qmlRegisterType<QGraphicsLinearLayoutStretchItemObject>(uri,4,6,"QGraphicsLinearLayoutStretchItem");
qmlRegisterType<QGraphicsLinearLayoutObject>(uri,4,6,"QGraphicsLinearLayout");
qmlRegisterType<QGraphicsGridLayoutObject>(uri,4,6,"QGraphicsGridLayout");
- qmlRegisterExtendedType<QGraphicsView, QGraphicsViewDeclarativeUI>(uri,4,6,"QGraphicsView");
- qmlRegisterExtendedType<QGraphicsScene,QGraphicsSceneDeclarativeUI>(uri,4,6,"QGraphicsScene");
- qmlRegisterExtendedType<QGraphicsWidget,QGraphicsWidgetDeclarativeUI>(uri,4,6,"QGraphicsWidget");
- qmlRegisterInterface<QGraphicsItem>("QGraphicsItem");
+ qmlRegisterType<QGraphicsWidget>(uri,4,6,"QGraphicsWidget");
}
};
diff --git a/src/imports/widgets/widgets.pro b/src/imports/widgets/widgets.pro
index 408f878..f26e4b9 100644
--- a/src/imports/widgets/widgets.pro
+++ b/src/imports/widgets/widgets.pro
@@ -9,7 +9,6 @@ SOURCES += \
widgets.cpp
HEADERS += \
- graphicswidgets_p.h \
graphicslayouts_p.h
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH