diff options
Diffstat (limited to 'src/declarative/qml')
63 files changed, 789 insertions, 129 deletions
diff --git a/src/declarative/qml/parser/qmljs.g b/src/declarative/qml/parser/qmljs.g index 907ca52..ed5f653 100644 --- a/src/declarative/qml/parser/qmljs.g +++ b/src/declarative/qml/parser/qmljs.g @@ -3,7 +3,7 @@ -- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -- Contact: Qt Software Information (qt-info@nokia.com) -- --- This file is part of the QtScript module of the Qt Toolkit. +-- This file is part of the QtDeclarative module of the Qt Toolkit. -- -- $QT_BEGIN_LICENSE:LGPL$ -- No Commercial Usage diff --git a/src/declarative/qml/parser/qmljsast_p.h b/src/declarative/qml/parser/qmljsast_p.h index 8dc32ed..1db037a 100644 --- a/src/declarative/qml/parser/qmljsast_p.h +++ b/src/declarative/qml/parser/qmljsast_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/parser/qmljsengine_p.cpp b/src/declarative/qml/parser/qmljsengine_p.cpp index 42885d8..02d9b9c 100644 --- a/src/declarative/qml/parser/qmljsengine_p.cpp +++ b/src/declarative/qml/parser/qmljsengine_p.cpp @@ -1,20 +1,18 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) ** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** $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 @@ -22,10 +20,24 @@ ** 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 "qmljsengine_p.h" #include "qmljsnodepool_p.h" diff --git a/src/declarative/qml/parser/qmljsengine_p.h b/src/declarative/qml/parser/qmljsengine_p.h index b9ff042..5aea983 100644 --- a/src/declarative/qml/parser/qmljsengine_p.h +++ b/src/declarative/qml/parser/qmljsengine_p.h @@ -1,20 +1,18 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) ** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** $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 @@ -22,14 +20,39 @@ ** 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 QMLJSENGINE_P_H #define QMLJSENGINE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QString> #include <QSet> diff --git a/src/declarative/qml/parser/qmljslexer.cpp b/src/declarative/qml/parser/qmljslexer.cpp index 843f6ae..e0de71a 100644 --- a/src/declarative/qml/parser/qmljslexer.cpp +++ b/src/declarative/qml/parser/qmljslexer.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/parser/qmljsmemorypool_p.h b/src/declarative/qml/parser/qmljsmemorypool_p.h index d7506be..6bd21f8 100644 --- a/src/declarative/qml/parser/qmljsmemorypool_p.h +++ b/src/declarative/qml/parser/qmljsmemorypool_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/parser/qmljsnodepool_p.h b/src/declarative/qml/parser/qmljsnodepool_p.h index 1a5b7f6..e2f0a3c 100644 --- a/src/declarative/qml/parser/qmljsnodepool_p.h +++ b/src/declarative/qml/parser/qmljsnodepool_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/parser/qmljsprettypretty.cpp b/src/declarative/qml/parser/qmljsprettypretty.cpp index 1045792..b6733e5 100644 --- a/src/declarative/qml/parser/qmljsprettypretty.cpp +++ b/src/declarative/qml/parser/qmljsprettypretty.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/parser/qmljsprettypretty_p.h b/src/declarative/qml/parser/qmljsprettypretty_p.h index fe82ca2..3227e7d 100644 --- a/src/declarative/qml/parser/qmljsprettypretty_p.h +++ b/src/declarative/qml/parser/qmljsprettypretty_p.h @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/qml.h b/src/declarative/qml/qml.h index 51ca612..1990b7f 100644 --- a/src/declarative/qml/qml.h +++ b/src/declarative/qml/qml.h @@ -54,8 +54,6 @@ QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - QT_MODULE(Declarative) #define QML_DECLARE_TYPE(TYPE) \ @@ -73,6 +71,8 @@ QT_MODULE(Declarative) #define QML_DECLARE_INTERFACE_HASMETATYPE(INTERFACE) \ QML_DECLARE_TYPE_HASMETATYPE(INTERFACE) +QT_BEGIN_NAMESPACE + #define QML_DEFINE_INTERFACE(INTERFACE) \ template<> QmlPrivate::InstanceType QmlPrivate::Define<INTERFACE *>::instance(qmlRegisterInterface<INTERFACE>(#INTERFACE)); @@ -110,11 +110,11 @@ QObject *qmlAttachedPropertiesObject(const QObject *obj) return qmlAttachedPropertiesObjectById(idx, obj); } +QT_END_NAMESPACE + QML_DECLARE_TYPE(QObject) Q_DECLARE_METATYPE(QVariant) -QT_END_NAMESPACE - QT_END_HEADER #endif // QML_H diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp index f02a176..80ca5a9 100644 --- a/src/declarative/qml/qmlbasicscript.cpp +++ b/src/declarative/qml/qmlbasicscript.cpp @@ -3,9 +3,39 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $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$ ** ****************************************************************************/ diff --git a/src/declarative/qml/qmlbasicscript_p.h b/src/declarative/qml/qmlbasicscript_p.h index 43c0d36..c7ab280 100644 --- a/src/declarative/qml/qmlbasicscript_p.h +++ b/src/declarative/qml/qmlbasicscript_p.h @@ -3,15 +3,56 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the $MODULE$ of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $TROLLTECH_DUAL_LICENSE$ +** $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 QMLBASICSCRIPT_P_H #define QMLBASICSCRIPT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/QList> #include <QtCore/QByteArray> #include <QtCore/QVariant> @@ -109,5 +150,3 @@ QT_END_NAMESPACE QT_END_HEADER #endif // QMLBASICSCRIPT_P_H - - diff --git a/src/declarative/qml/qmlbindablevalue.cpp b/src/declarative/qml/qmlbindablevalue.cpp index 222ea87..f447d4f 100644 --- a/src/declarative/qml/qmlbindablevalue.cpp +++ b/src/declarative/qml/qmlbindablevalue.cpp @@ -48,6 +48,8 @@ #include <qfxperf.h> #include <QtCore/qdebug.h> +Q_DECLARE_METATYPE(QList<QObject *>); + QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(scriptWarnings, QML_SCRIPT_WARNINGS); @@ -114,7 +116,6 @@ void QmlBindableValue::forceUpdate() update(); } -Q_DECLARE_METATYPE(QList<QObject *>); void QmlBindableValue::update() { Q_D(QmlBindableValue); diff --git a/src/declarative/qml/qmlbindablevalue.h b/src/declarative/qml/qmlbindablevalue.h index 50bbf36..12da9f6 100644 --- a/src/declarative/qml/qmlbindablevalue.h +++ b/src/declarative/qml/qmlbindablevalue.h @@ -48,12 +48,12 @@ #include <QtDeclarative/qmlpropertyvaluesource.h> #include <QtDeclarative/qmlexpression.h> - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) + class QmlExpression; class QmlContext; class QmlBindableValuePrivate; @@ -88,10 +88,11 @@ protected: private: Q_DECLARE_PRIVATE(QmlBindableValue) }; -QML_DECLARE_TYPE(QmlBindableValue) - QT_END_NAMESPACE +QML_DECLARE_TYPE(QmlBindableValue) + QT_END_HEADER + #endif // QMLBINDABLEVALUE_H diff --git a/src/declarative/qml/qmlbindablevalue_p.h b/src/declarative/qml/qmlbindablevalue_p.h index b55a314..a37b2c0 100644 --- a/src/declarative/qml/qmlbindablevalue_p.h +++ b/src/declarative/qml/qmlbindablevalue_p.h @@ -42,6 +42,17 @@ #ifndef QMLBINDABLEVALUE_P_H #define QMLBINDABLEVALUE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <private/qobject_p.h> #include <QtDeclarative/qmlbindablevalue.h> #include <QtDeclarative/qmlmetaproperty.h> diff --git a/src/declarative/qml/qmlboundsignal.cpp b/src/declarative/qml/qmlboundsignal.cpp index 5815dc6..9779e46 100644 --- a/src/declarative/qml/qmlboundsignal.cpp +++ b/src/declarative/qml/qmlboundsignal.cpp @@ -47,6 +47,7 @@ #include <qmlmetatype.h> #include <qml.h> #include <qmlcontext.h> +#include <QDebug> QT_BEGIN_NAMESPACE @@ -88,7 +89,6 @@ int QmlBoundSignalProxy::qt_metacall(QMetaObject::Call c, int id, void **a) } } -#include <QDebug> QmlBoundSignalParameters::QmlBoundSignalParameters(const QMetaMethod &method, QObject *parent) : QObject(parent), types(0), values(0) diff --git a/src/declarative/qml/qmlboundsignal_p.h b/src/declarative/qml/qmlboundsignal_p.h index 2c05770..39c0c46 100644 --- a/src/declarative/qml/qmlboundsignal_p.h +++ b/src/declarative/qml/qmlboundsignal_p.h @@ -42,10 +42,22 @@ #ifndef QMLBOUNDSIGNAL_P_H #define QMLBOUNDSIGNAL_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtDeclarative/qmlexpression.h> #include <private/qobject_p.h> QT_BEGIN_NAMESPACE + class QmlBoundSignal : public QmlExpressionObject { Q_OBJECT @@ -98,7 +110,6 @@ private: QmlBoundSignalParameters *params; }; +QT_END_NAMESPACE #endif // QMLBOUNDSIGNAL_P_H - -QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlclassfactory.cpp b/src/declarative/qml/qmlclassfactory.cpp index 7e5b929..ddfbd78 100644 --- a/src/declarative/qml/qmlclassfactory.cpp +++ b/src/declarative/qml/qmlclassfactory.cpp @@ -41,7 +41,10 @@ #include "qmlclassfactory_p.h" +QT_BEGIN_NAMESPACE + QmlClassFactory::~QmlClassFactory() { } +QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlclassfactory_p.h b/src/declarative/qml/qmlclassfactory_p.h index e3e71c9..cd80ffc 100644 --- a/src/declarative/qml/qmlclassfactory_p.h +++ b/src/declarative/qml/qmlclassfactory_p.h @@ -42,6 +42,17 @@ #ifndef QMLCLASSFACTORY_P_H #define QMLCLASSFACTORY_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/qglobal.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/qml/qmlcompiledcomponent_p.h b/src/declarative/qml/qmlcompiledcomponent_p.h index 2201423..0945892 100644 --- a/src/declarative/qml/qmlcompiledcomponent_p.h +++ b/src/declarative/qml/qmlcompiledcomponent_p.h @@ -42,13 +42,26 @@ #ifndef QMLCOMPILEDCOMPONENT_P_H #define QMLCOMPILEDCOMPONENT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtDeclarative/qml.h> #include <private/qmlinstruction_p.h> #include <private/qmlcompiler_p.h> #include <private/qmlrefcount_p.h> QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE + namespace QmlParser { class Property; class Object; @@ -72,8 +85,8 @@ private: friend class QmlDomDocument; }; - QT_END_NAMESPACE + QT_END_HEADER #endif // QMLCOMPILEDCOMPONENT_P_H diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index cb0c571..c2b2fb4 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -633,7 +633,7 @@ bool QmlCompiler::compileObject(Object *obj, const BindingContext &ctxt) if (isCustomParser) { // Custom parser types don't support signal properties if (testProperty(prop, obj)) { - if (deferred.contains(prop->name)) + if (deferred.contains(QString::fromLatin1(prop->name.constData()))) deferredProps << prop; else COMPILE_CHECK(compileProperty(prop, obj, objCtxt)); @@ -644,7 +644,7 @@ bool QmlCompiler::compileObject(Object *obj, const BindingContext &ctxt) if (isSignalPropertyName(prop->name)) { COMPILE_CHECK(compileSignal(prop,obj)); } else { - if (deferred.contains(prop->name)) + if (deferred.contains(QString::fromLatin1(prop->name.constData()))) deferredProps << prop; else COMPILE_CHECK(compileProperty(prop, obj, objCtxt)); @@ -660,7 +660,7 @@ bool QmlCompiler::compileObject(Object *obj, const BindingContext &ctxt) if (isCustomParser) { if (testProperty(prop, obj)) { QMetaProperty p = deferred.isEmpty()?QMetaProperty():QmlMetaType::defaultProperty(obj->metaObject()); - if (deferred.contains(p.name())) + if (deferred.contains(QString::fromLatin1(p.name()))) deferredProps << prop; else COMPILE_CHECK(compileProperty(prop, obj, objCtxt)); @@ -669,7 +669,7 @@ bool QmlCompiler::compileObject(Object *obj, const BindingContext &ctxt) } } else { QMetaProperty p = deferred.isEmpty()?QMetaProperty():QmlMetaType::defaultProperty(obj->metaObject()); - if (deferred.contains(p.name())) + if (deferred.contains(QString::fromLatin1(p.name()))) deferredProps << prop; else COMPILE_CHECK(compileProperty(prop, obj, objCtxt)); @@ -1683,7 +1683,7 @@ QStringList QmlCompiler::deferredProperties(QmlParser::Object *obj) return QStringList(); QMetaClassInfo classInfo = mo->classInfo(idx); - QStringList rv = QString(QLatin1String(classInfo.value())).split(','); + QStringList rv = QString(QLatin1String(classInfo.value())).split(QLatin1Char(',')); return rv; } diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h index 2559b14..819c4ad 100644 --- a/src/declarative/qml/qmlcompiler_p.h +++ b/src/declarative/qml/qmlcompiler_p.h @@ -42,6 +42,17 @@ #ifndef QMLCOMPILER_P_H #define QMLCOMPILER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/qbytearray.h> #include <QtCore/qset.h> #include <QtDeclarative/qml.h> @@ -50,9 +61,8 @@ #include <private/qmlcompositetypemanager_p.h> #include <private/qmlparser_p.h> -class QStringList; - QT_BEGIN_NAMESPACE + class QmlEngine; class QmlComponent; class QmlCompiledComponent; @@ -215,4 +225,5 @@ private: }; QT_END_NAMESPACE + #endif // QMLCOMPILER_P_H diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index 3429813..1144639 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -58,6 +58,7 @@ #include "qmlscriptparser_p.h" QT_BEGIN_NAMESPACE + class QByteArray; int statusId = qRegisterMetaType<QmlComponent::Status>("QmlComponent::Status"); @@ -564,4 +565,5 @@ void QmlComponent::completeCreate() d->completePending = false; } } + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlcomponent.h b/src/declarative/qml/qmlcomponent.h index ae2f362..db34e16 100644 --- a/src/declarative/qml/qmlcomponent.h +++ b/src/declarative/qml/qmlcomponent.h @@ -54,6 +54,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) + class QmlCompiledComponent; class QByteArray; class QmlComponentPrivate; @@ -104,11 +105,12 @@ private: friend class QmlVME; friend struct QmlCompositeTypeData; }; -Q_DECLARE_METATYPE(QmlComponent::Status) -QML_DECLARE_TYPE(QmlComponent) QT_END_NAMESPACE +Q_DECLARE_METATYPE(QmlComponent::Status) +QML_DECLARE_TYPE(QmlComponent) + QT_END_HEADER #endif // QMLCOMPONENT_H diff --git a/src/declarative/qml/qmlcomponent_p.h b/src/declarative/qml/qmlcomponent_p.h index 254d9ba..0be3dc6 100644 --- a/src/declarative/qml/qmlcomponent_p.h +++ b/src/declarative/qml/qmlcomponent_p.h @@ -42,6 +42,17 @@ #ifndef QMLCOMPONENT_P_H #define QMLCOMPONENT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/QString> #include <QtCore/QStringList> #include <QtCore/QList> @@ -87,6 +98,6 @@ public: void clear(); }; -#endif // QMLCOMPONENT_P_H - QT_END_NAMESPACE + +#endif // QMLCOMPONENT_P_H diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp index 9950b48..ef77803 100644 --- a/src/declarative/qml/qmlcompositetypemanager.cpp +++ b/src/declarative/qml/qmlcompositetypemanager.cpp @@ -50,6 +50,8 @@ #include <QtDeclarative/qmlcomponent.h> #include <private/qmlcomponent_p.h> +QT_BEGIN_NAMESPACE + QmlCompositeTypeData::QmlCompositeTypeData() : status(Invalid), errorType(NoError), component(0), compiledComponent(0) { @@ -365,3 +367,5 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit) doComplete(unit); } } + +QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlcompositetypemanager_p.h b/src/declarative/qml/qmlcompositetypemanager_p.h index 9312819..96e77d6 100644 --- a/src/declarative/qml/qmlcompositetypemanager_p.h +++ b/src/declarative/qml/qmlcompositetypemanager_p.h @@ -42,6 +42,17 @@ #ifndef QMLCOMPOSITETYPEMANAGER_P_H #define QMLCOMPOSITETYPEMANAGER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/qglobal.h> #include <private/qmlscriptparser_p.h> #include <private/qmlrefcount_p.h> diff --git a/src/declarative/qml/qmlcontext.h b/src/declarative/qml/qmlcontext.h index 935c7ca..ce5fe52 100644 --- a/src/declarative/qml/qmlcontext.h +++ b/src/declarative/qml/qmlcontext.h @@ -99,7 +99,6 @@ private: QmlContext(QmlEngine *); }; - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/declarative/qml/qmlcontext_p.h b/src/declarative/qml/qmlcontext_p.h index 4d88fc2..569b320 100644 --- a/src/declarative/qml/qmlcontext_p.h +++ b/src/declarative/qml/qmlcontext_p.h @@ -42,6 +42,17 @@ #ifndef QMLCONTEXT_P_H #define QMLCONTEXT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtDeclarative/qmlcontext.h> #include <private/qobject_p.h> #include <private/qmldeclarativedata_p.h> @@ -50,6 +61,7 @@ #include <QtCore/qset.h> QT_BEGIN_NAMESPACE + class QmlContext; class QmlExpression; class QmlEngine; @@ -99,6 +111,7 @@ public: QmlSimpleDeclarativeData contextData; QObjectList contextObjects; }; + QT_END_NAMESPACE #endif // QMLCONTEXT_P_H diff --git a/src/declarative/qml/qmlcustomparser.cpp b/src/declarative/qml/qmlcustomparser.cpp index c90ab47..b543978 100644 --- a/src/declarative/qml/qmlcustomparser.cpp +++ b/src/declarative/qml/qmlcustomparser.cpp @@ -43,6 +43,8 @@ #include "qmlcustomparser_p_p.h" #include "qmlparser_p.h" +#include <QtCore/qdebug.h> + QT_BEGIN_NAMESPACE using namespace QmlParser; @@ -120,7 +122,6 @@ QmlCustomParserNodePrivate::fromObject(QmlParser::Object *root) return rootNode; } -#include <QtCore/qdebug.h> QmlCustomParserProperty QmlCustomParserNodePrivate::fromProperty(QmlParser::Property *p) { diff --git a/src/declarative/qml/qmlcustomparser_p.h b/src/declarative/qml/qmlcustomparser_p.h index 75da579..914ddbd 100644 --- a/src/declarative/qml/qmlcustomparser_p.h +++ b/src/declarative/qml/qmlcustomparser_p.h @@ -42,6 +42,17 @@ #ifndef QMLCUSTOMPARSER_H #define QMLCUSTOMPARSER_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/qbytearray.h> #include <QtCore/qxmlstream.h> #include <QtDeclarative/qfxglobal.h> @@ -74,7 +85,6 @@ private: friend class QmlCustomParserPropertyPrivate; QmlCustomParserPropertyPrivate *d; }; -Q_DECLARE_METATYPE(QmlCustomParserProperty) class QmlCustomParserNodePrivate; class Q_DECLARATIVE_EXPORT QmlCustomParserNode @@ -93,7 +103,6 @@ private: friend class QmlCustomParserNodePrivate; QmlCustomParserNodePrivate *d; }; -Q_DECLARE_METATYPE(QmlCustomParserNode) class Q_DECLARATIVE_EXPORT QmlCustomParser { @@ -108,6 +117,9 @@ public: QT_END_NAMESPACE +Q_DECLARE_METATYPE(QmlCustomParserProperty) +Q_DECLARE_METATYPE(QmlCustomParserNode) + QT_END_HEADER #endif diff --git a/src/declarative/qml/qmlcustomparser_p_p.h b/src/declarative/qml/qmlcustomparser_p_p.h index 96e9b32..0011c3b 100644 --- a/src/declarative/qml/qmlcustomparser_p_p.h +++ b/src/declarative/qml/qmlcustomparser_p_p.h @@ -42,6 +42,17 @@ #ifndef QMLCUSTOMPARSER_P_H #define QMLCUSTOMPARSER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/qglobal.h> #include "qmlcustomparser_p.h" diff --git a/src/declarative/qml/qmldeclarativedata_p.h b/src/declarative/qml/qmldeclarativedata_p.h index 85a80fa..559f0ee 100644 --- a/src/declarative/qml/qmldeclarativedata_p.h +++ b/src/declarative/qml/qmldeclarativedata_p.h @@ -42,6 +42,17 @@ #ifndef QMLDECLARATIVEDATA_P_H #define QMLDECLARATIVEDATA_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <private/qobject_p.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index 5271dc5..9015e5c 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -278,6 +278,23 @@ QmlDomPropertyPrivate::~QmlDomPropertyPrivate() if (property) property->release(); } +QmlDomDynamicPropertyPrivate::QmlDomDynamicPropertyPrivate(): + valid(false) +{ +} + +QmlDomDynamicPropertyPrivate::QmlDomDynamicPropertyPrivate(const QmlDomDynamicPropertyPrivate &other) +: QSharedData(other), valid(other.valid) +{ + property = other.property; + if (valid && property.defaultValue) property.defaultValue->addref(); +} + +QmlDomDynamicPropertyPrivate::~QmlDomDynamicPropertyPrivate() +{ + if (valid && property.defaultValue) property.defaultValue->release(); +} + /*! \class QmlDomProperty \internal @@ -322,8 +339,8 @@ QmlDomProperty &QmlDomProperty::operator=(const QmlDomProperty &other) } /*! - Return the name of this property. - + Return the name of this property. + \qml Text { x: 10 @@ -331,7 +348,7 @@ Text { font.bold: true } \endqml - + As illustrated above, a property name can be a simple string, such as "x" or "y", or a more complex "dot property", such as "font.bold". In both cases the full name is returned ("x", "y" and "font.bold") by this method. @@ -358,7 +375,7 @@ Text { } \endqml - For each of the properties shown above, this method would return ("x"), + For each of the properties shown above, this method would return ("x"), ("y") and ("font", "bold"). \sa QmlDomProperty::propertyName() @@ -370,7 +387,7 @@ QList<QByteArray> QmlDomProperty::propertyNameParts() const } /*! - Return true if this property is used as a default property in the QML + Return true if this property is used as a default property in the QML document. \qml @@ -380,8 +397,8 @@ QList<QByteArray> QmlDomProperty::propertyNameParts() const The above two examples return the same DOM tree, except that the second has the default property flag set on the text property. Observe that whether - or not a property has isDefaultProperty set is determined by how the - property is used, and not only by whether the property is the types default + or not a property has isDefaultProperty set is determined by how the + property is used, and not only by whether the property is the types default property. */ bool QmlDomProperty::isDefaultProperty() const @@ -415,7 +432,7 @@ void QmlDomProperty::setValue(const QmlDomValue &value) } /*! - Returns the position in the input data where the property ID startd, or 0 if + Returns the position in the input data where the property ID startd, or -1 if the property is invalid. */ int QmlDomProperty::position() const @@ -423,19 +440,174 @@ int QmlDomProperty::position() const if (d && d->property) { return d->property->location.range.offset; } else - return 0; + return -1; } /*! Returns the length in the input data from where the property ID started upto - the end of it, or 0 if the property is invalid. + the end of it, or -1 if the property is invalid. */ int QmlDomProperty::length() const { if (d && d->property) return d->property->location.range.length; else - return 0; + return -1; +} + +/*! + Construct an invalid QmlDomDynamicProperty. +*/ +QmlDomDynamicProperty::QmlDomDynamicProperty(): + d(new QmlDomDynamicPropertyPrivate) +{ +} + +/*! + Create a copy of \a other QmlDomDynamicProperty. +*/ +QmlDomDynamicProperty::QmlDomDynamicProperty(const QmlDomDynamicProperty &other): + d(other.d) +{ +} + +/*! + Destroy the QmlDomDynamicProperty. +*/ +QmlDomDynamicProperty::~QmlDomDynamicProperty() +{ +} + +/*! + Assign \a other to this QmlDomDynamicProperty. +*/ +QmlDomDynamicProperty &QmlDomDynamicProperty::operator=(const QmlDomDynamicProperty &other) +{ + d = other.d; + return *this; +} + +bool QmlDomDynamicProperty::isValid() const +{ + return d && d->valid; +} + +/*! + Return the name of this dynamic property. + + \qml +Item { + property int count: 10; +} + \endqml + + As illustrated above, a dynamic property name can have a name and a + default value ("10"). +*/ +QByteArray QmlDomDynamicProperty::propertyName() const +{ + if (isValid()) + return d->property.name; + else + return QByteArray(); +} + +int QmlDomDynamicProperty::propertyType() const +{ + if (isValid()) { + switch (d->property.type) { + case QmlParser::Object::DynamicProperty::Bool: + return QMetaType::type("bool"); + + case QmlParser::Object::DynamicProperty::Color: + return QMetaType::type("QColor"); + + case QmlParser::Object::DynamicProperty::Date: + return QMetaType::type("QDateTime"); + + case QmlParser::Object::DynamicProperty::Int: + return QMetaType::type("int"); + + case QmlParser::Object::DynamicProperty::Real: + return QMetaType::type("double"); + + case QmlParser::Object::DynamicProperty::String: + return QMetaType::type("QString"); + + case QmlParser::Object::DynamicProperty::Url: + return QMetaType::type("QUrl"); + + case QmlParser::Object::DynamicProperty::Variant: + return QMetaType::type("QVariant"); + + default: + break; + } + } + + return -1; +} + +/*! + Return true if this property is used as a default property in the QML + document. + + \qml +<Text text="hello"/> +<Text>hello</Text> + \endqml + + The above two examples return the same DOM tree, except that the second has + the default property flag set on the text property. Observe that whether + or not a property has isDefaultProperty set is determined by how the + property is used, and not only by whether the property is the types default + property. +*/ +bool QmlDomDynamicProperty::isDefaultProperty() const +{ + if (isValid()) + return d->property.isDefaultProperty; + else + return false; +} + +/*! + Returns the default value as a QmlDomProperty. +*/ +QmlDomProperty QmlDomDynamicProperty::defaultValue() const +{ + QmlDomProperty rp; + + if (isValid() && d->property.defaultValue) { + rp.d->property = d->property.defaultValue; + rp.d->property->addref(); + } + + return rp; +} + +/*! + Returns the position in the input data where the property ID startd, or 0 if + the property is invalid. +*/ +int QmlDomDynamicProperty::position() const +{ + if (isValid()) { + return d->property.range.offset; + } else + return -1; +} + +/*! + Returns the length in the input data from where the property ID started upto + the end of it, or 0 if the property is invalid. +*/ +int QmlDomDynamicProperty::length() const +{ + if (isValid()) + return d->property.range.length; + else + return -1; } QmlDomObjectPrivate::QmlDomObjectPrivate() @@ -701,6 +873,41 @@ void QmlDomObject::addProperty(const QByteArray &name, const QmlDomValue &value) qWarning("QmlDomObject::addProperty(const QByteArray &, const QmlDomValue &): Not implemented"); } +QList<QmlDomDynamicProperty> QmlDomObject::dynamicProperties() const +{ + QList<QmlDomDynamicProperty> properties; + + for (int i = 0; i < d->object->dynamicProperties.size(); ++i) { + QmlDomDynamicProperty p; + p.d = new QmlDomDynamicPropertyPrivate; + p.d->property = d->object->dynamicProperties.at(i); + p.d->valid = true; + + if (p.d->property.defaultValue) + p.d->property.defaultValue->addref(); + + properties.append(p); + } + + return properties; +} + +QmlDomDynamicProperty QmlDomObject::dynamicProperty(const QByteArray &name) const +{ + QmlDomDynamicProperty p; + + for (int i = 0; i < d->object->dynamicProperties.size(); ++i) { + if (d->object->dynamicProperties.at(i).name == name) { + p.d = new QmlDomDynamicPropertyPrivate; + p.d->property = d->object->dynamicProperties.at(i); + if (p.d->property.defaultValue) p.d->property.defaultValue->addref(); + p.d->valid = true; + } + } + + return p; +} + /*! Returns true if this object is a custom type. Custom types are special types that allow embeddeding non-QML data, such as SVG or HTML data, @@ -769,26 +976,26 @@ QmlDomComponent QmlDomObject::toComponent() const /*! Returns the position in the input data where the property assignment started -, or 0 if the property is invalid. +, or -1 if the property is invalid. */ int QmlDomObject::position() const { if (d && d->object) return d->object->location.range.offset; else - return 0; + return -1; } /*! Returns the length in the input data from where the property assignment star -ted upto the end of it, or 0 if the property is invalid. +ted upto the end of it, or -1 if the property is invalid. */ int QmlDomObject::length() const { if (d && d->object) return d->object->location.range.length; else - return 0; + return -1; } // Returns the URL of the type, if it is an external type, or an empty URL if @@ -1323,25 +1530,25 @@ QmlDomList QmlDomValue::toList() const } /*! - Returns the position in the input data where the property value startd, or 0 + Returns the position in the input data where the property value startd, or -1 if the value is invalid. */ int QmlDomValue::position() const { if (type() == Invalid) - return 0; + return -1; else return d->value->location.range.offset; } /*! Returns the length in the input data from where the property value started u -pto the end of it, or 0 if the value is invalid. +pto the end of it, or -1 if the value is invalid. */ int QmlDomValue::length() const { if (type() == Invalid) - return 0; + return -1; else return d->value->location.range.length; } @@ -1436,7 +1643,7 @@ void QmlDomList::setValues(const QList<QmlDomValue> &values) } /*! - Returns the position in the input data where the list started, or 0 if + Returns the position in the input data where the list started, or -1 if the property is invalid. */ int QmlDomList::position() const @@ -1444,7 +1651,7 @@ int QmlDomList::position() const if (d && d->property) { return d->property->listValueRange.offset; } else - return 0; + return -1; } /*! @@ -1456,7 +1663,7 @@ int QmlDomList::length() const if (d && d->property) return d->property->listValueRange.length; else - return 0; + return -1; } /*! @@ -1571,4 +1778,3 @@ void QmlDomComponent::setComponentRoot(const QmlDomObject &root) } QT_END_NAMESPACE - diff --git a/src/declarative/qml/qmldom.h b/src/declarative/qml/qmldom.h index ab3e39f..170ef56 100644 --- a/src/declarative/qml/qmldom.h +++ b/src/declarative/qml/qmldom.h @@ -107,9 +107,36 @@ public: private: friend class QmlDomObject; + friend class QmlDomDynamicProperty; QSharedDataPointer<QmlDomPropertyPrivate> d; }; +class QmlDomDynamicPropertyPrivate; +class Q_DECLARATIVE_EXPORT QmlDomDynamicProperty +{ +public: + QmlDomDynamicProperty(); + QmlDomDynamicProperty(const QmlDomDynamicProperty &); + ~QmlDomDynamicProperty(); + QmlDomDynamicProperty &operator=(const QmlDomDynamicProperty &); + + bool isValid() const; + + QByteArray propertyName() const; + int propertyType() const; + + bool isDefaultProperty() const; + + QmlDomProperty defaultValue() const; + + int position() const; + int length() const; + +private: + friend class QmlDomObject; + QSharedDataPointer<QmlDomDynamicPropertyPrivate> d; +}; + class QmlDomObjectPrivate; class Q_DECLARATIVE_EXPORT QmlDomObject { @@ -133,6 +160,9 @@ public: void removeProperty(const QByteArray &); void addProperty(const QByteArray &, const QmlDomValue &); + QList<QmlDomDynamicProperty> dynamicProperties() const; + QmlDomDynamicProperty dynamicProperty(const QByteArray &) const; + bool isCustomType() const; QByteArray customTypeData() const; void setCustomTypeData(const QByteArray &); diff --git a/src/declarative/qml/qmldom_p.h b/src/declarative/qml/qmldom_p.h index 441269c..5345c44 100644 --- a/src/declarative/qml/qmldom_p.h +++ b/src/declarative/qml/qmldom_p.h @@ -42,16 +42,22 @@ #ifndef QMLDOM_P_H #define QMLDOM_P_H -#include <QtCore/QtGlobal> +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// -QT_BEGIN_HEADER +#include <QtCore/QtGlobal> +#include "qmlparser_p.h" QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) - -#include "qmlparser_p.h" - class QmlDomDocumentPrivate : public QSharedData { public: @@ -91,6 +97,17 @@ public: QmlParser::Property *property; }; +class QmlDomDynamicPropertyPrivate : public QSharedData +{ +public: + QmlDomDynamicPropertyPrivate(); + QmlDomDynamicPropertyPrivate(const QmlDomDynamicPropertyPrivate &); + ~QmlDomDynamicPropertyPrivate(); + + bool valid; + QmlParser::Object::DynamicProperty property; +}; + class QmlDomValuePrivate : public QSharedData { public: @@ -114,7 +131,5 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif // QMLDOM_P_H diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 8c926b7..294e333 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -73,12 +73,13 @@ #include <private/qmlbindablevalue_p.h> #include <private/qmlvme_p.h> +Q_DECLARE_METATYPE(QmlMetaProperty) +Q_DECLARE_METATYPE(QList<QObject *>); + QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(qmlDebugger, QML_DEBUGGER) -Q_DECLARE_METATYPE(QmlMetaProperty) - QML_DEFINE_TYPE(QObject,Object) static QScriptValue qmlMetaProperty_emit(QScriptContext *ctx, QScriptEngine *engine) @@ -1077,8 +1078,6 @@ void QmlExpression::valueChanged() { } -Q_DECLARE_METATYPE(QList<QObject *>); - void BindExpressionProxy::changed() { e->valueChanged(); @@ -1552,7 +1551,7 @@ QmlObjectScriptClass::QmlObjectScriptClass(QmlEngine *bindEngine) { engine = bindEngine; prototypeObject = engine->scriptEngine()->newObject(); - prototypeObject.setProperty("destroy", + prototypeObject.setProperty(QLatin1String("destroy"), engine->scriptEngine()->newFunction(QmlObjectDestroy)); } diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index a1028e6..93ae704 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -42,6 +42,17 @@ #ifndef QMLENGINE_P_H #define QMLENGINE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtScript/QScriptClass> #include <QtScript/QScriptValue> #include <QtScript/QScriptString> @@ -61,6 +72,7 @@ #include <QtScript/qscriptengine.h> QT_BEGIN_NAMESPACE + class QmlContext; class QmlEngine; class QmlContextPrivate; @@ -288,7 +300,7 @@ public: void addLog(const QmlExpressionLog &); QList<QmlExpressionLog> *log; }; + QT_END_NAMESPACE #endif // QMLENGINE_P_H - diff --git a/src/declarative/qml/qmlexpression.h b/src/declarative/qml/qmlexpression.h index 15d026a..e8cac7a 100644 --- a/src/declarative/qml/qmlexpression.h +++ b/src/declarative/qml/qmlexpression.h @@ -109,7 +109,6 @@ Q_SIGNALS: void valueChanged(); }; - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp index a618fe7..1647a12 100644 --- a/src/declarative/qml/qmlinstruction.cpp +++ b/src/declarative/qml/qmlinstruction.cpp @@ -44,6 +44,7 @@ #include <QDebug> QT_BEGIN_NAMESPACE + void QmlCompiledComponent::dump(QmlInstruction *instr, int idx) { QByteArray lineNumber = QByteArray::number(instr->line); diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h index e3b0dfe..f2f3ac2 100644 --- a/src/declarative/qml/qmlinstruction_p.h +++ b/src/declarative/qml/qmlinstruction_p.h @@ -42,10 +42,21 @@ #ifndef QMLINSTRUCTION_P_H #define QMLINSTRUCTION_P_H -#include <QtDeclarative/qfxglobal.h> +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// +#include <QtDeclarative/qfxglobal.h> QT_BEGIN_NAMESPACE + class QmlCompiledComponent; class Q_DECLARATIVE_EXPORT QmlInstruction { @@ -283,6 +294,6 @@ public: void dump(QmlCompiledComponent *); }; -#endif // QMLINSTRUCTION_P_H - QT_END_NAMESPACE + +#endif // QMLINSTRUCTION_P_H diff --git a/src/declarative/qml/qmllist.h b/src/declarative/qml/qmllist.h index cc13924..80c3138 100644 --- a/src/declarative/qml/qmllist.h +++ b/src/declarative/qml/qmllist.h @@ -119,7 +119,6 @@ class Qml_ProxyList_ ##ListName : public QmlList<ListType> \ friend class Qml_ProxyList_ ##ListName ; \ Qml_ProxyList_##ListName ListName; - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 30e818b..448671e 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -50,6 +50,7 @@ #include <math.h> #include <QtCore/qdebug.h> +Q_DECLARE_METATYPE(QList<QObject *>); QT_BEGIN_NAMESPACE @@ -652,8 +653,6 @@ QVariant QmlMetaProperty::read() const return QVariant(); } -Q_DECLARE_METATYPE(QList<QObject *>); - void QmlMetaPropertyPrivate::writeSignalProperty(const QVariant &value) { QString expr = value.toString(); @@ -1035,4 +1034,34 @@ QMetaMethod QmlMetaProperty::method() const return d->signal; } +/*! + \internal + + Creates a QmlMetaProperty for the property \a name of \a obj. Unlike + the QmlMetaProperty(QObject*, QString) constructor, this static function + will correctly handle dot properties. +*/ +QmlMetaProperty QmlMetaProperty::createProperty(QObject *obj, const QString &name) +{ + QStringList path = name.split('.'); + + QObject *object = obj; + + for (int jj = 0; jj < path.count() - 1; ++jj) { + const QString &pathName = path.at(jj); + QmlMetaProperty prop(object, pathName); + QObject *objVal = QmlMetaType::toQObject(prop.read()); + if (!objVal) + return QmlMetaProperty(); + object = objVal; + } + + const QString &propName = path.last(); + QmlMetaProperty prop(object, propName); + if (!prop.isValid()) + return QmlMetaProperty(); + else + return prop; +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlmetaproperty.h b/src/declarative/qml/qmlmetaproperty.h index ce2fbcf..6c28a86 100644 --- a/src/declarative/qml/qmlmetaproperty.h +++ b/src/declarative/qml/qmlmetaproperty.h @@ -127,6 +127,7 @@ public: QmlBindableValue *setBinding(QmlBindableValue *) const; static int findSignal(const QObject *, const char *); + static QmlMetaProperty createProperty(QObject *, const QString &); int coreIndex() const; private: diff --git a/src/declarative/qml/qmlmetaproperty_p.h b/src/declarative/qml/qmlmetaproperty_p.h index 738bfec..69fd5c3 100644 --- a/src/declarative/qml/qmlmetaproperty_p.h +++ b/src/declarative/qml/qmlmetaproperty_p.h @@ -42,8 +42,21 @@ #ifndef QMLMETAPROPERTY_P_H #define QMLMETAPROPERTY_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qmlmetaproperty.h" +QT_BEGIN_NAMESPACE + class QmlContext; class QmlMetaPropertyPrivate { @@ -78,5 +91,6 @@ public: void writeValueProperty(const QVariant &); }; -#endif // QMLMETAPROPERTY_P_H +QT_END_NAMESPACE +#endif // QMLMETAPROPERTY_P_H diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp index 8ce8571..b15f711 100644 --- a/src/declarative/qml/qmlmetatype.cpp +++ b/src/declarative/qml/qmlmetatype.cpp @@ -59,7 +59,6 @@ #include <QtCore/qcryptographichash.h> #include <private/qmlcustomparser_p.h> -QT_BEGIN_NAMESPACE #ifdef QT_BOOTSTRAPPED # ifndef QT_NO_GEOM_VARIANT # define QT_NO_GEOM_VARIANT @@ -78,6 +77,8 @@ QT_BEGIN_NAMESPACE #endif #define NS(x) QT_PREPEND_NAMESPACE(x) +QT_BEGIN_NAMESPACE + struct QmlMetaTypeData { QList<QmlType *> types; diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp index 5ad4a6e..6f0b0b7 100644 --- a/src/declarative/qml/qmlparser.cpp +++ b/src/declarative/qml/qmlparser.cpp @@ -113,7 +113,8 @@ QmlParser::Object::DynamicProperty::DynamicProperty(const DynamicProperty &o) : isDefaultProperty(o.isDefaultProperty), type(o.type), name(o.name), - defaultValue(o.defaultValue) + defaultValue(o.defaultValue), + range(o.range) { } diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h index 78040da..3aab066 100644 --- a/src/declarative/qml/qmlparser_p.h +++ b/src/declarative/qml/qmlparser_p.h @@ -42,6 +42,17 @@ #ifndef QMLPARSER_P_H #define QMLPARSER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/QByteArray> #include <QtCore/QList> #include <QtCore/qstring.h> @@ -139,6 +150,7 @@ namespace QmlParser Type type; QByteArray name; QmlParser::Property *defaultValue; + LocationRange range; }; struct DynamicSignal { DynamicSignal(); @@ -284,10 +296,11 @@ namespace QmlParser void dump(int = 0) const; }; } -Q_DECLARE_METATYPE(QmlParser::Variant) QT_END_NAMESPACE +Q_DECLARE_METATYPE(QmlParser::Variant) + QT_END_HEADER #endif // QMLPARSER_P_H diff --git a/src/declarative/qml/qmlparserstatus.h b/src/declarative/qml/qmlparserstatus.h index 7c2e141..4db6d8c 100644 --- a/src/declarative/qml/qmlparserstatus.h +++ b/src/declarative/qml/qmlparserstatus.h @@ -68,7 +68,6 @@ private: }; Q_DECLARE_INTERFACE(QmlParserStatus, "com.trolltech.qml.QmlParserStatus") - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h index ed1304a..3d5fa61 100644 --- a/src/declarative/qml/qmlprivate.h +++ b/src/declarative/qml/qmlprivate.h @@ -394,10 +394,8 @@ int QmlPrivate::list_interface_op(QmlPrivate::ListOp op, int val, return 0; } - -#endif // QMLPRIVATE_H - - QT_END_NAMESPACE QT_END_HEADER + +#endif // QMLPRIVATE_H diff --git a/src/declarative/qml/qmlpropertyvaluesource.cpp b/src/declarative/qml/qmlpropertyvaluesource.cpp index 18092c8..c6ff596 100644 --- a/src/declarative/qml/qmlpropertyvaluesource.cpp +++ b/src/declarative/qml/qmlpropertyvaluesource.cpp @@ -42,8 +42,8 @@ #include "qmlpropertyvaluesource.h" #include "qml.h" - QT_BEGIN_NAMESPACE + /*! \class QmlPropertyValueSource \brief The QmlPropertyValueSource class is inherited by property value sources such as animations and bindings. diff --git a/src/declarative/qml/qmlpropertyvaluesource.h b/src/declarative/qml/qmlpropertyvaluesource.h index 9cef150..4e5f1c5 100644 --- a/src/declarative/qml/qmlpropertyvaluesource.h +++ b/src/declarative/qml/qmlpropertyvaluesource.h @@ -46,12 +46,12 @@ #include <QtDeclarative/qml.h> #include <QtCore/QObject> - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) + class QObjectPrivate; class QmlMetaProperty; class Q_DECLARATIVE_EXPORT QmlPropertyValueSource : public QObject @@ -69,11 +69,11 @@ protected: private: Q_DISABLE_COPY(QmlPropertyValueSource) }; -QML_DECLARE_TYPE(QmlPropertyValueSource) - -#endif // QMLPROPERTYVALUESOURCE_H - QT_END_NAMESPACE +QML_DECLARE_TYPE(QmlPropertyValueSource) + QT_END_HEADER + +#endif // QMLPROPERTYVALUESOURCE_H diff --git a/src/declarative/qml/qmlproxymetaobject.cpp b/src/declarative/qml/qmlproxymetaobject.cpp index 06d8a50..0baea31 100644 --- a/src/declarative/qml/qmlproxymetaobject.cpp +++ b/src/declarative/qml/qmlproxymetaobject.cpp @@ -41,8 +41,10 @@ #include "qmlproxymetaobject_p.h" +#include <QDebug> QT_BEGIN_NAMESPACE + QmlProxyMetaObject::QmlProxyMetaObject(QObject *obj, QList<ProxyData> *mList) : metaObjects(mList), proxies(0), parent(0), object(obj) { @@ -78,7 +80,6 @@ QmlProxyMetaObject::~QmlProxyMetaObject() proxies = 0; } -#include <QDebug> int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a) { if ((c == QMetaObject::ReadProperty || diff --git a/src/declarative/qml/qmlproxymetaobject_p.h b/src/declarative/qml/qmlproxymetaobject_p.h index c0ce36e..736bd91 100644 --- a/src/declarative/qml/qmlproxymetaobject_p.h +++ b/src/declarative/qml/qmlproxymetaobject_p.h @@ -42,6 +42,17 @@ #ifndef QMLPROXYMETAOBJECT_P_H #define QMLPROXYMETAOBJECT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/QMetaObject> #include <QtCore/QObject> #include <private/qmetaobjectbuilder_p.h> @@ -53,6 +64,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) + class QmlProxyMetaObject : public QAbstractDynamicMetaObject { public: diff --git a/src/declarative/qml/qmlrefcount.cpp b/src/declarative/qml/qmlrefcount.cpp index 8f71f1b..6c409e1 100644 --- a/src/declarative/qml/qmlrefcount.cpp +++ b/src/declarative/qml/qmlrefcount.cpp @@ -41,6 +41,8 @@ #include "qmlrefcount_p.h" +QT_BEGIN_NAMESPACE + QmlRefCount::QmlRefCount() : refCount(1) { @@ -64,3 +66,5 @@ void QmlRefCount::release() delete this; } +QT_END_NAMESPACE + diff --git a/src/declarative/qml/qmlrefcount_p.h b/src/declarative/qml/qmlrefcount_p.h index 1355c86..a87d596 100644 --- a/src/declarative/qml/qmlrefcount_p.h +++ b/src/declarative/qml/qmlrefcount_p.h @@ -42,6 +42,17 @@ #ifndef QMLREFCOUNT_P_H #define QMLREFCOUNT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/qglobal.h> QT_BEGIN_HEADER diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index fb7492d..f1f1710 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -532,6 +532,8 @@ bool ProcessAST::visit(AST::UiPublicMember *node) property.isDefaultProperty = node->isDefaultMember; property.type = type; property.name = name.toUtf8(); + property.range.offset = node->firstSourceLocation().offset; + property.range.length = node->semicolonToken.end() - property.range.offset; if (node->expression) { // default value property.defaultValue = new Property; @@ -886,5 +888,4 @@ void QmlScriptParser::addNamespacePath(const QString &path) _nameSpacePaths.insertMulti(QString(), path); } - QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlscriptparser_p.h b/src/declarative/qml/qmlscriptparser_p.h index b057e2b..15f165c 100644 --- a/src/declarative/qml/qmlscriptparser_p.h +++ b/src/declarative/qml/qmlscriptparser_p.h @@ -41,13 +41,24 @@ #ifndef QMLSCRIPTPARSER_P_H #define QMLSCRIPTPARSER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/QList> #include <QtCore/QUrl> #include <QtDeclarative/qmlerror.h> #include "qmlparser_p.h" - QT_BEGIN_HEADER + QT_BEGIN_NAMESPACE QT_MODULE(Declarative) @@ -107,6 +118,7 @@ public: }; QT_END_NAMESPACE + QT_END_HEADER #endif // QMLSCRIPTPARSER_P_H diff --git a/src/declarative/qml/qmlstringconverters_p.h b/src/declarative/qml/qmlstringconverters_p.h index ed1f959..52426a7 100644 --- a/src/declarative/qml/qmlstringconverters_p.h +++ b/src/declarative/qml/qmlstringconverters_p.h @@ -42,6 +42,17 @@ #ifndef QMLSTRINGCONVERTERS_P_H #define QMLSTRINGCONVERTERS_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/qglobal.h> class QColor; class QPointF; diff --git a/src/declarative/qml/qmlvme_p.h b/src/declarative/qml/qmlvme_p.h index 149c82c..2da7bb4 100644 --- a/src/declarative/qml/qmlvme_p.h +++ b/src/declarative/qml/qmlvme_p.h @@ -42,11 +42,23 @@ #ifndef QMLVME_P_H #define QMLVME_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/QString> #include <QtCore/QStack> #include <QtDeclarative/qmlerror.h> QT_BEGIN_NAMESPACE + class QObject; class QmlInstruction; class QmlCompiledComponent; @@ -70,4 +82,5 @@ private: }; QT_END_NAMESPACE + #endif // QMLVME_P_H diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qmlvmemetaobject.cpp index 4b2c64c..3b784a4 100644 --- a/src/declarative/qml/qmlvmemetaobject.cpp +++ b/src/declarative/qml/qmlvmemetaobject.cpp @@ -48,8 +48,8 @@ #include <QtCore/qdebug.h> #include <qmlexpression.h> - QT_BEGIN_NAMESPACE + QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj, const QMetaObject *other, QList<QString> *strData, diff --git a/src/declarative/qml/qmlvmemetaobject_p.h b/src/declarative/qml/qmlvmemetaobject_p.h index 17140ef..7b6fd2d 100644 --- a/src/declarative/qml/qmlvmemetaobject_p.h +++ b/src/declarative/qml/qmlvmemetaobject_p.h @@ -42,6 +42,17 @@ #ifndef QMLVMEMETAOBJECT_P_H #define QMLVMEMETAOBJECT_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtDeclarative/qml.h> #include <QtCore/QMetaObject> #include <QtCore/QBitArray> @@ -73,4 +84,5 @@ private: }; QT_END_NAMESPACE + #endif // QMLVMEMETAOBJECT_P_H diff --git a/src/declarative/qml/qpodvector_p.h b/src/declarative/qml/qpodvector_p.h index 55c04e7..101c62d 100644 --- a/src/declarative/qml/qpodvector_p.h +++ b/src/declarative/qml/qpodvector_p.h @@ -42,6 +42,17 @@ #ifndef QPODVECTOR_P_H #define QPODVECTOR_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/qglobal.h> QT_BEGIN_NAMESPACE @@ -119,6 +130,7 @@ private: int m_capacity; T *m_data; }; + QT_END_NAMESPACE #endif |