summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-04-19 07:09:06 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-04-19 07:09:06 (GMT)
commit58bf0fc6b1f1815c4f22762c39c4374fd17beb4e (patch)
treea91643a12d62a0474fe203b6d5fe7c2a8fbafe7e
parent4223acff70de3036c5b7d75bccaec0c540c23556 (diff)
parent698a39fc699c3f8d6b7e28e10a8e3048fed274bd (diff)
downloadQt-58bf0fc6b1f1815c4f22762c39c4374fd17beb4e.zip
Qt-58bf0fc6b1f1815c4f22762c39c4374fd17beb4e.tar.gz
Qt-58bf0fc6b1f1815c4f22762c39c4374fd17beb4e.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
-rw-r--r--demos/declarative/minehunt/minehunt.cpp2
-rw-r--r--doc/src/declarative/extending-examples.qdoc5
-rw-r--r--doc/src/declarative/extending.qdoc1
-rw-r--r--doc/src/declarative/integrating.qdoc3
-rw-r--r--doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h3
-rw-r--r--doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h3
-rw-r--r--examples/declarative/extending/adding/person.h1
-rw-r--r--examples/declarative/extending/attached/birthdayparty.h2
-rw-r--r--examples/declarative/extending/attached/person.h4
-rw-r--r--examples/declarative/extending/binding/birthdayparty.h2
-rw-r--r--examples/declarative/extending/binding/happybirthday.h2
-rw-r--r--examples/declarative/extending/binding/person.h4
-rw-r--r--examples/declarative/extending/coercion/birthdayparty.h1
-rw-r--r--examples/declarative/extending/coercion/person.h6
-rw-r--r--examples/declarative/extending/default/birthdayparty.h1
-rw-r--r--examples/declarative/extending/default/person.h3
-rw-r--r--examples/declarative/extending/extended/lineedit.cpp2
-rw-r--r--examples/declarative/extending/grouped/birthdayparty.h2
-rw-r--r--examples/declarative/extending/grouped/person.h4
-rw-r--r--examples/declarative/extending/properties/birthdayparty.h1
-rw-r--r--examples/declarative/extending/properties/person.h1
-rw-r--r--examples/declarative/extending/signal/birthdayparty.h3
-rw-r--r--examples/declarative/extending/signal/person.h4
-rw-r--r--examples/declarative/extending/valuesource/birthdayparty.h3
-rw-r--r--examples/declarative/extending/valuesource/happybirthday.h1
-rw-r--r--examples/declarative/extending/valuesource/person.h4
-rw-r--r--examples/declarative/proxywidgets/proxywidgets.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp19
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.h6
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/testtypes.h16
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/data/enumerate.qml24
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp62
-rw-r--r--tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp1
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/testtypes.h3
37 files changed, 89 insertions, 118 deletions
diff --git a/demos/declarative/minehunt/minehunt.cpp b/demos/declarative/minehunt/minehunt.cpp
index d4b0039..93cd1c1 100644
--- a/demos/declarative/minehunt/minehunt.cpp
+++ b/demos/declarative/minehunt/minehunt.cpp
@@ -305,8 +305,6 @@ bool MinehuntGame::flag(int row, int col)
return true;
}
-QML_DECLARE_TYPE(TileData);
-
class MinehuntExtensionPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
diff --git a/doc/src/declarative/extending-examples.qdoc b/doc/src/declarative/extending-examples.qdoc
index cc66838..307162e 100644
--- a/doc/src/declarative/extending-examples.qdoc
+++ b/doc/src/declarative/extending-examples.qdoc
@@ -57,11 +57,6 @@ element, the C++ class can be named differently, or appear in a namespace.
\snippet examples/declarative/extending/adding/person.h 0
-Following the class declaration, we include the QML_DECLARE_TYPE() macro. This
-is necessary to declare the type to QML. It also includes the logic necessary
-to expose the class to Qt's meta system - that is, it includes the
-Q_DECLARE_METATYPE() functionality.
-
\section1 Define the Person class
\snippet examples/declarative/extending/adding/person.cpp 0
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc
index 4d477c6..a1d8a10 100644
--- a/doc/src/declarative/extending.qdoc
+++ b/doc/src/declarative/extending.qdoc
@@ -305,7 +305,6 @@ public:
};
QML_DECLARE_TYPEINFO(MyType, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(MyType)
\endcode
Return an attachment object, of type \a AttachedPropertiesType, for the
attachee \a object instance. It is customary, though not strictly required, for
diff --git a/doc/src/declarative/integrating.qdoc b/doc/src/declarative/integrating.qdoc
index d4034fa..65413ec 100644
--- a/doc/src/declarative/integrating.qdoc
+++ b/doc/src/declarative/integrating.qdoc
@@ -115,8 +115,7 @@ any custom C++ types and create a plugin that registers the custom types
so that they can be used from your QML file.
Here is an example. Suppose you have two classes, \c RedSquare and \c BlueCircle,
-that both inherit from QGraphicsWidget. First, you need to register these two types
-using the \c QML_DECLARE_TYPE macro from \c <QtDeclarative/qdeclarative.h>, like this:
+that both inherit from QGraphicsWidget:
\c [graphicswidgets/redsquare.h]
\snippet doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h 0
diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h b/doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h
index 028718f..73d66b7 100644
--- a/doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h
+++ b/doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h
@@ -39,7 +39,6 @@
**
****************************************************************************/
//![0]
-#include <QtDeclarative/qdeclarative.h>
#include <QGraphicsWidget>
#include <QPainter>
@@ -53,6 +52,4 @@ public:
painter->drawEllipse(0, 0, size().width(), size().height());
}
};
-
-QML_DECLARE_TYPE(BlueCircle)
//![0]
diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h b/doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h
index 76e7d11..3050662 100644
--- a/doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h
+++ b/doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h
@@ -39,7 +39,6 @@
**
****************************************************************************/
//![0]
-#include <QtDeclarative/qdeclarative.h>
#include <QGraphicsWidget>
#include <QPainter>
@@ -52,6 +51,4 @@ public:
painter->fillRect(0, 0, size().width(), size().height(), QColor(Qt::red));
}
};
-
-QML_DECLARE_TYPE(RedSquare)
//![0]
diff --git a/examples/declarative/extending/adding/person.h b/examples/declarative/extending/adding/person.h
index fbaf2df..7a9e0f0 100644
--- a/examples/declarative/extending/adding/person.h
+++ b/examples/declarative/extending/adding/person.h
@@ -61,7 +61,6 @@ private:
QString m_name;
int m_shoeSize;
};
-QML_DECLARE_TYPE(Person);
// ![0]
#endif // PERSON_H
diff --git a/examples/declarative/extending/attached/birthdayparty.h b/examples/declarative/extending/attached/birthdayparty.h
index d8ca2e1..7c45d21 100644
--- a/examples/declarative/extending/attached/birthdayparty.h
+++ b/examples/declarative/extending/attached/birthdayparty.h
@@ -59,7 +59,6 @@ public:
private:
QDate m_rsvp;
};
-QML_DECLARE_TYPE(BirthdayPartyAttached)
class BirthdayParty : public QObject
{
@@ -84,6 +83,5 @@ private:
};
QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(BirthdayParty)
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/attached/person.h b/examples/declarative/extending/attached/person.h
index 08caebf..7a4b9c3 100644
--- a/examples/declarative/extending/attached/person.h
+++ b/examples/declarative/extending/attached/person.h
@@ -71,7 +71,6 @@ private:
QString m_brand;
qreal m_price;
};
-QML_DECLARE_TYPE(ShoeDescription);
class Person : public QObject {
Q_OBJECT
@@ -88,20 +87,17 @@ private:
QString m_name;
ShoeDescription m_shoe;
};
-QML_DECLARE_TYPE(Person);
class Boy : public Person {
Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Boy);
class Girl : public Person {
Q_OBJECT
public:
Girl(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Girl);
#endif // PERSON_H
diff --git a/examples/declarative/extending/binding/birthdayparty.h b/examples/declarative/extending/binding/birthdayparty.h
index 8486442..e2757bc 100644
--- a/examples/declarative/extending/binding/birthdayparty.h
+++ b/examples/declarative/extending/binding/birthdayparty.h
@@ -63,7 +63,6 @@ signals:
private:
QDate m_rsvp;
};
-QML_DECLARE_TYPE(BirthdayPartyAttached)
class BirthdayParty : public QObject
{
@@ -100,6 +99,5 @@ private:
};
QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(BirthdayParty)
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/binding/happybirthday.h b/examples/declarative/extending/binding/happybirthday.h
index eb2da5e..0e5a90a 100644
--- a/examples/declarative/extending/binding/happybirthday.h
+++ b/examples/declarative/extending/binding/happybirthday.h
@@ -51,6 +51,7 @@ class HappyBirthday : public QObject, public QDeclarativePropertyValueSource
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+Q_INTERFACES(QDeclarativePropertyValueSource)
public:
HappyBirthday(QObject *parent = 0);
@@ -70,7 +71,6 @@ private:
QDeclarativeProperty m_target;
QString m_name;
};
-QML_DECLARE_TYPE(HappyBirthday);
#endif // HAPPYBIRTHDAY_H
diff --git a/examples/declarative/extending/binding/person.h b/examples/declarative/extending/binding/person.h
index 2d4ec12..0edfcdd 100644
--- a/examples/declarative/extending/binding/person.h
+++ b/examples/declarative/extending/binding/person.h
@@ -74,7 +74,6 @@ private:
QString m_brand;
qreal m_price;
};
-QML_DECLARE_TYPE(ShoeDescription);
class Person : public QObject {
Q_OBJECT
@@ -96,20 +95,17 @@ private:
QString m_name;
ShoeDescription m_shoe;
};
-QML_DECLARE_TYPE(Person);
class Boy : public Person {
Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Boy);
class Girl : public Person {
Q_OBJECT
public:
Girl(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Girl);
#endif // PERSON_H
diff --git a/examples/declarative/extending/coercion/birthdayparty.h b/examples/declarative/extending/coercion/birthdayparty.h
index fffd407..a5d14f9 100644
--- a/examples/declarative/extending/coercion/birthdayparty.h
+++ b/examples/declarative/extending/coercion/birthdayparty.h
@@ -66,6 +66,5 @@ private:
Person *m_celebrant;
QList<Person *> m_guests;
};
-QML_DECLARE_TYPE(BirthdayParty);
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/coercion/person.h b/examples/declarative/extending/coercion/person.h
index 298ffb1..861f135 100644
--- a/examples/declarative/extending/coercion/person.h
+++ b/examples/declarative/extending/coercion/person.h
@@ -60,7 +60,7 @@ private:
QString m_name;
int m_shoeSize;
};
-QML_DECLARE_TYPE(Person);
+
// ![0]
class Boy : public Person {
@@ -68,14 +68,14 @@ Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Boy);
+
class Girl : public Person {
Q_OBJECT
public:
Girl(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Girl);
+
// ![0]
#endif // PERSON_H
diff --git a/examples/declarative/extending/default/birthdayparty.h b/examples/declarative/extending/default/birthdayparty.h
index 49c20bd..c0cb0a4 100644
--- a/examples/declarative/extending/default/birthdayparty.h
+++ b/examples/declarative/extending/default/birthdayparty.h
@@ -67,6 +67,5 @@ private:
QList<Person *> m_guests;
};
// ![0]
-QML_DECLARE_TYPE(BirthdayParty);
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/default/person.h b/examples/declarative/extending/default/person.h
index b3eceaa..832bf11 100644
--- a/examples/declarative/extending/default/person.h
+++ b/examples/declarative/extending/default/person.h
@@ -60,20 +60,17 @@ private:
QString m_name;
int m_shoeSize;
};
-QML_DECLARE_TYPE(Person);
class Boy : public Person {
Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Boy);
class Girl : public Person {
Q_OBJECT
public:
Girl(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Girl);
#endif // PERSON_H
diff --git a/examples/declarative/extending/extended/lineedit.cpp b/examples/declarative/extending/extended/lineedit.cpp
index 417fbd9..0e521ec 100644
--- a/examples/declarative/extending/extended/lineedit.cpp
+++ b/examples/declarative/extending/extended/lineedit.cpp
@@ -102,4 +102,4 @@ void LineEditExtension::setBottomMargin(int m)
m_lineedit->setTextMargins(l, t, r, m);
}
-QML_DECLARE_TYPE(QLineEdit);
+
diff --git a/examples/declarative/extending/grouped/birthdayparty.h b/examples/declarative/extending/grouped/birthdayparty.h
index 42439c4..4ac5602 100644
--- a/examples/declarative/extending/grouped/birthdayparty.h
+++ b/examples/declarative/extending/grouped/birthdayparty.h
@@ -65,6 +65,6 @@ private:
Person *m_celebrant;
QList<Person *> m_guests;
};
-QML_DECLARE_TYPE(BirthdayParty);
+
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/grouped/person.h b/examples/declarative/extending/grouped/person.h
index 5ea2348..216c015 100644
--- a/examples/declarative/extending/grouped/person.h
+++ b/examples/declarative/extending/grouped/person.h
@@ -71,7 +71,6 @@ private:
QString m_brand;
qreal m_price;
};
-QML_DECLARE_TYPE(ShoeDescription);
class Person : public QObject {
Q_OBJECT
@@ -90,20 +89,17 @@ private:
QString m_name;
ShoeDescription m_shoe;
};
-QML_DECLARE_TYPE(Person);
class Boy : public Person {
Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Boy);
class Girl : public Person {
Q_OBJECT
public:
Girl(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Girl);
#endif // PERSON_H
diff --git a/examples/declarative/extending/properties/birthdayparty.h b/examples/declarative/extending/properties/birthdayparty.h
index c4cb536..dd01562 100644
--- a/examples/declarative/extending/properties/birthdayparty.h
+++ b/examples/declarative/extending/properties/birthdayparty.h
@@ -71,7 +71,6 @@ private:
Person *m_celebrant;
QList<Person *> m_guests;
};
-QML_DECLARE_TYPE(BirthdayParty);
// ![3]
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/properties/person.h b/examples/declarative/extending/properties/person.h
index 860a607..7504d18 100644
--- a/examples/declarative/extending/properties/person.h
+++ b/examples/declarative/extending/properties/person.h
@@ -60,6 +60,5 @@ private:
QString m_name;
int m_shoeSize;
};
-QML_DECLARE_TYPE(Person);
#endif // PERSON_H
diff --git a/examples/declarative/extending/signal/birthdayparty.h b/examples/declarative/extending/signal/birthdayparty.h
index bcdc513..a2b35cd 100644
--- a/examples/declarative/extending/signal/birthdayparty.h
+++ b/examples/declarative/extending/signal/birthdayparty.h
@@ -59,7 +59,6 @@ public:
private:
QDate m_rsvp;
};
-QML_DECLARE_TYPE(BirthdayPartyAttached)
class BirthdayParty : public QObject
{
@@ -89,8 +88,6 @@ private:
Person *m_celebrant;
QList<Person *> m_guests;
};
-
QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(BirthdayParty)
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/signal/person.h b/examples/declarative/extending/signal/person.h
index 08caebf..7a4b9c3 100644
--- a/examples/declarative/extending/signal/person.h
+++ b/examples/declarative/extending/signal/person.h
@@ -71,7 +71,6 @@ private:
QString m_brand;
qreal m_price;
};
-QML_DECLARE_TYPE(ShoeDescription);
class Person : public QObject {
Q_OBJECT
@@ -88,20 +87,17 @@ private:
QString m_name;
ShoeDescription m_shoe;
};
-QML_DECLARE_TYPE(Person);
class Boy : public Person {
Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Boy);
class Girl : public Person {
Q_OBJECT
public:
Girl(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Girl);
#endif // PERSON_H
diff --git a/examples/declarative/extending/valuesource/birthdayparty.h b/examples/declarative/extending/valuesource/birthdayparty.h
index 819a200..a9b3102 100644
--- a/examples/declarative/extending/valuesource/birthdayparty.h
+++ b/examples/declarative/extending/valuesource/birthdayparty.h
@@ -60,7 +60,6 @@ public:
private:
QDate m_rsvp;
};
-QML_DECLARE_TYPE(BirthdayPartyAttached)
class BirthdayParty : public QObject
{
@@ -95,8 +94,6 @@ private:
Person *m_celebrant;
QList<Person *> m_guests;
};
-
QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(BirthdayParty)
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/valuesource/happybirthday.h b/examples/declarative/extending/valuesource/happybirthday.h
index b48c012..8548eb8 100644
--- a/examples/declarative/extending/valuesource/happybirthday.h
+++ b/examples/declarative/extending/valuesource/happybirthday.h
@@ -74,7 +74,6 @@ private:
// ![2]
};
// ![2]
-QML_DECLARE_TYPE(HappyBirthday);
#endif // HAPPYBIRTHDAY_H
diff --git a/examples/declarative/extending/valuesource/person.h b/examples/declarative/extending/valuesource/person.h
index 08caebf..7a4b9c3 100644
--- a/examples/declarative/extending/valuesource/person.h
+++ b/examples/declarative/extending/valuesource/person.h
@@ -71,7 +71,6 @@ private:
QString m_brand;
qreal m_price;
};
-QML_DECLARE_TYPE(ShoeDescription);
class Person : public QObject {
Q_OBJECT
@@ -88,20 +87,17 @@ private:
QString m_name;
ShoeDescription m_shoe;
};
-QML_DECLARE_TYPE(Person);
class Boy : public Person {
Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Boy);
class Girl : public Person {
Q_OBJECT
public:
Girl(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Girl);
#endif // PERSON_H
diff --git a/examples/declarative/proxywidgets/proxywidgets.cpp b/examples/declarative/proxywidgets/proxywidgets.cpp
index 47d0cb9..067eb2c 100644
--- a/examples/declarative/proxywidgets/proxywidgets.cpp
+++ b/examples/declarative/proxywidgets/proxywidgets.cpp
@@ -94,6 +94,4 @@ public:
#include "proxywidgets.moc"
-QML_DECLARE_TYPE(MyPushButton)
-
Q_EXPORT_PLUGIN2(proxywidgetsplugin, ProxyWidgetsPlugin);
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index a27d19d..a194354 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -463,12 +463,21 @@ QStringList QDeclarativeObjectScriptClass::propertyNames(Object *object)
cache = ddata->propertyCache;
if (!cache) {
cache = enginePrivate->cache(obj);
- if (cache && ddata) { cache->addref(); ddata->propertyCache = cache; }
+ if (cache) {
+ if (ddata) { cache->addref(); ddata->propertyCache = cache; }
+ } else {
+ // Not cachable - fall back to QMetaObject (eg. dynamic meta object)
+ // XXX QDeclarativeOpenMetaObject has a cache, so this is suboptimal.
+ // XXX This is a workaround for QTBUG-9420.
+ const QMetaObject *mo = obj->metaObject();
+ QStringList r;
+ int pc = mo->propertyCount();
+ int po = mo->propertyOffset();
+ for (int i=po; i<pc; ++i)
+ r += QString::fromUtf8(mo->property(i).name());
+ return r;
+ }
}
-
- if (!cache)
- return QStringList();
-
return cache->propertyNames();
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
index 4424419..79d3226 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
+++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
@@ -170,7 +170,6 @@ private:
};
QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(MyQmlObject);
class MyQmlContainer : public QObject
{
@@ -185,7 +184,6 @@ private:
QList<MyQmlObject*> m_children;
};
-QML_DECLARE_TYPE(MyQmlContainer);
class MyExpression : public QDeclarativeExpression
{
@@ -258,7 +256,6 @@ private:
QObject *m_object;
QObject *m_object2;
};
-QML_DECLARE_TYPE(MyDeferredObject);
class MyBaseExtendedObject : public QObject
{
@@ -273,7 +270,6 @@ public:
private:
int m_value;
};
-QML_DECLARE_TYPE(MyBaseExtendedObject);
class MyExtendedObject : public MyBaseExtendedObject
{
@@ -288,7 +284,6 @@ public:
private:
int m_value;
};
-QML_DECLARE_TYPE(MyExtendedObject);
class MyTypeObject : public QObject
{
@@ -555,7 +550,6 @@ signals:
void rectPropertyChanged();
};
Q_DECLARE_OPERATORS_FOR_FLAGS(MyTypeObject::MyFlags)
-QML_DECLARE_TYPE(MyTypeObject);
Q_DECLARE_METATYPE(QScriptValue);
class MyInvokableObject : public QObject
diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
index 8c163a5..951cea0 100644
--- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h
+++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
@@ -167,8 +167,9 @@ private:
MyCustomVariantType m_custom;
int m_propertyWithNotify;
};
+QML_DECLARE_TYPE(MyQmlObject)
QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(MyQmlObject);
+
class MyGroupedObject : public QObject
{
@@ -187,8 +188,6 @@ private:
QDeclarativeScriptString m_script;
};
-QML_DECLARE_TYPE(MyGroupedObject);
-
class MyTypeObject : public QObject
{
@@ -462,7 +461,7 @@ signals:
void rectPropertyChanged();
};
Q_DECLARE_OPERATORS_FOR_FLAGS(MyTypeObject::MyFlags)
-QML_DECLARE_TYPE(MyTypeObject);
+
class MyContainer : public QObject
{
@@ -482,8 +481,6 @@ public:
QList<MyInterface *> m_interfaces;
};
-QML_DECLARE_TYPE(MyContainer);
-
class MyPropertyValueSource : public QObject, public QDeclarativePropertyValueSource
{
@@ -499,7 +496,7 @@ public:
prop = p;
}
};
-QML_DECLARE_TYPE(MyPropertyValueSource);
+
class MyDotPropertyObject : public QObject
{
@@ -540,7 +537,6 @@ private:
bool m_ownRWObj;
};
-QML_DECLARE_TYPE(MyDotPropertyObject);
namespace MyNamespace {
class MyNamespacedType : public QObject
@@ -559,8 +555,6 @@ namespace MyNamespace {
QList<MyNamespacedType *> m_list;
};
}
-QML_DECLARE_TYPE(MyNamespace::MyNamespacedType);
-QML_DECLARE_TYPE(MyNamespace::MySecondNamespacedType);
class MyCustomParserType : public QObject
{
@@ -574,8 +568,6 @@ public:
void setCustomData(QObject *, const QByteArray &) {}
};
-QML_DECLARE_TYPE(MyCustomParserType);
-
void registerTypes();
#endif // TESTTYPES_H
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index 9d4a1f5..07fbf83 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -1132,8 +1132,6 @@ void tst_qdeclarativelanguage::testType(const QString& qml, const QString& type,
}
}
-QML_DECLARE_TYPE(TestType)
-QML_DECLARE_TYPE(TestType2)
// Import tests (QT-558)
diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/enumerate.qml b/tests/auto/declarative/qdeclarativelistmodel/data/enumerate.qml
new file mode 100644
index 0000000..8d23d4b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistmodel/data/enumerate.qml
@@ -0,0 +1,24 @@
+import Qt 4.6
+
+Item {
+ property string result
+
+ ListModel {
+ id: model
+
+ ListElement {
+ val1: 1
+ val2: 2
+ val3: "str"
+ val4: false
+ val5: true
+ }
+ }
+
+ Component.onCompleted: {
+ var element = model.get(0);
+
+ for (var i in element)
+ result += i+"="+element[i]+(element[i] ? "Y" : "N")+":";
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index b44a4f7..bbea98a 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -51,11 +51,11 @@
#include "../../../shared/util.h"
-class tst_QDeclarativeListModel : public QObject
+class tst_qdeclarativelistmodel : public QObject
{
Q_OBJECT
public:
- tst_QDeclarativeListModel() {}
+ tst_qdeclarativelistmodel() {}
private:
QScriptValue nestedListValue(QScriptEngine *eng) const;
@@ -76,12 +76,13 @@ private slots:
void convertNestedToFlat_fail_data();
void convertNestedToFlat_ok();
void convertNestedToFlat_ok_data();
+ void enumerate();
void error_data();
void error();
void set();
};
-QScriptValue tst_QDeclarativeListModel::nestedListValue(QScriptEngine *eng) const
+QScriptValue tst_qdeclarativelistmodel::nestedListValue(QScriptEngine *eng) const
{
QScriptValue list = eng->newArray();
list.setProperty(0, eng->newObject());
@@ -91,7 +92,7 @@ QScriptValue tst_QDeclarativeListModel::nestedListValue(QScriptEngine *eng) cons
return sv;
}
-QDeclarativeItem *tst_QDeclarativeListModel::createWorkerTest(QDeclarativeEngine *eng, QDeclarativeComponent *component, QDeclarativeListModel *model)
+QDeclarativeItem *tst_qdeclarativelistmodel::createWorkerTest(QDeclarativeEngine *eng, QDeclarativeComponent *component, QDeclarativeListModel *model)
{
QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component->create());
QDeclarativeEngine::setContextForObject(model, eng->rootContext());
@@ -100,7 +101,7 @@ QDeclarativeItem *tst_QDeclarativeListModel::createWorkerTest(QDeclarativeEngine
return item;
}
-void tst_QDeclarativeListModel::waitForWorker(QDeclarativeItem *item)
+void tst_qdeclarativelistmodel::waitForWorker(QDeclarativeItem *item)
{
QEventLoop loop;
QTimer timer;
@@ -115,7 +116,7 @@ void tst_QDeclarativeListModel::waitForWorker(QDeclarativeItem *item)
QVERIFY(timer.isActive());
}
-void tst_QDeclarativeListModel::static_i18n()
+void tst_qdeclarativelistmodel::static_i18n()
{
QString expect = QString::fromUtf8("na\303\257ve");
QString componentStr = "import Qt 4.7\nListModel { ListElement { prop1: \""+expect+"\" } }";
@@ -129,7 +130,7 @@ void tst_QDeclarativeListModel::static_i18n()
delete obj;
}
-void tst_QDeclarativeListModel::static_nestedElements()
+void tst_qdeclarativelistmodel::static_nestedElements()
{
QFETCH(int, elementCount);
@@ -163,7 +164,7 @@ void tst_QDeclarativeListModel::static_nestedElements()
delete obj;
}
-void tst_QDeclarativeListModel::static_nestedElements_data()
+void tst_qdeclarativelistmodel::static_nestedElements_data()
{
QTest::addColumn<int>("elementCount");
@@ -173,7 +174,7 @@ void tst_QDeclarativeListModel::static_nestedElements_data()
QTest::newRow("many items") << 5;
}
-void tst_QDeclarativeListModel::dynamic_data()
+void tst_qdeclarativelistmodel::dynamic_data()
{
QTest::addColumn<QString>("script");
QTest::addColumn<int>("result");
@@ -264,7 +265,7 @@ void tst_QDeclarativeListModel::dynamic_data()
//QTest::newRow("nested-setprop") << "{append({'foo':123});setProperty(0,'foo',[{'x':123}]);get(0).foo.get(0).x}" << 123 << "";
}
-void tst_QDeclarativeListModel::dynamic()
+void tst_qdeclarativelistmodel::dynamic()
{
QFETCH(QString, script);
QFETCH(int, result);
@@ -285,12 +286,12 @@ void tst_QDeclarativeListModel::dynamic()
QCOMPARE(actual,result);
}
-void tst_QDeclarativeListModel::dynamic_worker_data()
+void tst_qdeclarativelistmodel::dynamic_worker_data()
{
dynamic_data();
}
-void tst_QDeclarativeListModel::dynamic_worker()
+void tst_qdeclarativelistmodel::dynamic_worker()
{
QFETCH(QString, script);
QFETCH(int, result);
@@ -340,7 +341,7 @@ void tst_QDeclarativeListModel::dynamic_worker()
qApp->processEvents();
}
-void tst_QDeclarativeListModel::convertNestedToFlat_fail()
+void tst_qdeclarativelistmodel::convertNestedToFlat_fail()
{
// If a model has nested data, it cannot be used at all from a worker script
@@ -369,7 +370,7 @@ void tst_QDeclarativeListModel::convertNestedToFlat_fail()
qApp->processEvents();
}
-void tst_QDeclarativeListModel::convertNestedToFlat_fail_data()
+void tst_qdeclarativelistmodel::convertNestedToFlat_fail_data()
{
QTest::addColumn<QString>("script");
@@ -383,7 +384,7 @@ void tst_QDeclarativeListModel::convertNestedToFlat_fail_data()
QTest::newRow("get") << "get(0)";
}
-void tst_QDeclarativeListModel::convertNestedToFlat_ok()
+void tst_qdeclarativelistmodel::convertNestedToFlat_ok()
{
// If a model only has plain data, it can be modified from a worker script. However,
// once the model is used from a worker script, it no longer accepts nested data
@@ -428,12 +429,12 @@ void tst_QDeclarativeListModel::convertNestedToFlat_ok()
qApp->processEvents();
}
-void tst_QDeclarativeListModel::convertNestedToFlat_ok_data()
+void tst_qdeclarativelistmodel::convertNestedToFlat_ok_data()
{
convertNestedToFlat_fail_data();
}
-void tst_QDeclarativeListModel::static_types_data()
+void tst_qdeclarativelistmodel::static_types_data()
{
QTest::addColumn<QString>("qml");
QTest::addColumn<QVariant>("value");
@@ -463,7 +464,7 @@ void tst_QDeclarativeListModel::static_types_data()
<< QVariant(double(QDeclarativeText::AlignHCenter));
}
-void tst_QDeclarativeListModel::static_types()
+void tst_qdeclarativelistmodel::static_types()
{
QFETCH(QString, qml);
QFETCH(QVariant, value);
@@ -494,7 +495,24 @@ void tst_QDeclarativeListModel::static_types()
delete obj;
}
-void tst_QDeclarativeListModel::error_data()
+void tst_qdeclarativelistmodel::enumerate()
+{
+ QDeclarativeEngine eng;
+ QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/enumerate.qml"));
+ QVERIFY(!component.isError());
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(item != 0);
+ QStringList r = item->property("result").toString().split(":");
+ QCOMPARE(r[0],QLatin1String("val1=1Y"));
+ QCOMPARE(r[1],QLatin1String("val2=2Y"));
+ QCOMPARE(r[2],QLatin1String("val3=strY"));
+ QCOMPARE(r[3],QLatin1String("val4=falseN"));
+ QCOMPARE(r[4],QLatin1String("val5=trueY"));
+ delete item;
+}
+
+
+void tst_qdeclarativelistmodel::error_data()
{
QTest::addColumn<QString>("qml");
QTest::addColumn<QString>("error");
@@ -532,7 +550,7 @@ void tst_QDeclarativeListModel::error_data()
<< "ListElement: cannot contain nested elements";
}
-void tst_QDeclarativeListModel::error()
+void tst_qdeclarativelistmodel::error()
{
QFETCH(QString, qml);
QFETCH(QString, error);
@@ -551,7 +569,7 @@ void tst_QDeclarativeListModel::error()
}
}
-void tst_QDeclarativeListModel::set()
+void tst_qdeclarativelistmodel::set()
{
QDeclarativeEngine engine;
QDeclarativeListModel model;
@@ -575,6 +593,6 @@ void tst_QDeclarativeListModel::set()
}
-QTEST_MAIN(tst_QDeclarativeListModel)
+QTEST_MAIN(tst_qdeclarativelistmodel)
#include "tst_qdeclarativelistmodel.moc"
diff --git a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp
index 908f336..7689270 100644
--- a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp
+++ b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp
@@ -102,7 +102,6 @@ public:
QList<TestType *> data;
QDeclarativeListProperty<TestType> property;
};
-QML_DECLARE_TYPE(TestType);
void tst_qdeclarativelistreference::initTestCase()
{
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp
index fd94cc6..7d89bee 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp
@@ -61,8 +61,6 @@ private:
int v;
};
-QML_DECLARE_TYPE(MyPluginType);
-
class MyPlugin : public QDeclarativeExtensionPlugin
{
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
index 1446920..bd3186a 100644
--- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
+++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
@@ -68,8 +68,6 @@ private:
int m_prop;
};
-QML_DECLARE_TYPE(MyRect)
-
class tst_qdeclarativestates : public QObject
{
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
index dd13429..8a9b981 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
+++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
@@ -133,7 +133,6 @@ signals:
public slots:
QSize method() { return QSize(13, 14); }
};
-QML_DECLARE_TYPE(MyTypeObject);
class MyConstantValueSource : public QObject, public QDeclarativePropertyValueSource
{
@@ -142,7 +141,6 @@ class MyConstantValueSource : public QObject, public QDeclarativePropertyValueSo
public:
virtual void setTarget(const QDeclarativeProperty &p) { p.write(3345); }
};
-QML_DECLARE_TYPE(MyConstantValueSource);
class MyOffsetValueInterceptor : public QObject, public QDeclarativePropertyValueInterceptor
{
@@ -155,7 +153,6 @@ public:
private:
QDeclarativeProperty prop;
};
-QML_DECLARE_TYPE(MyOffsetValueInterceptor);
void registerTypes();