From bbb3d5b403511f6e0bc1966835983b2574596e25 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 10 Jan 2013 14:07:37 -0800 Subject: [PATCH] Move ListModel and ListElement to the QtQml import They're already in the QtQml module, but were left in the QtQuick import because they were considered to be of minimal use without QtQuick types. QtQml types are being developed would could make ListModel useful without QtQuick, indicating that they should no longer be considered QtQuick depedent. Change-Id: I31499f2cc23baf4bc70fb451ba164408bed89ff6 Reviewed-by: Andrew den Exter --- src/qml/qml/qml.pri | 10 +- src/qml/qml/qqmlengine.cpp | 6 +- .../qml/{qquicklistmodel.cpp => qqmllistmodel.cpp} | 162 ++++++++++----------- .../qml/{qquicklistmodel_p.h => qqmllistmodel_p.h} | 40 ++--- .../{qquicklistmodel_p_p.h => qqmllistmodel_p_p.h} | 30 ++-- ...orkeragent.cpp => qqmllistmodelworkeragent.cpp} | 56 +++---- ...orkeragent_p.h => qqmllistmodelworkeragent_p.h} | 22 +-- src/qml/qml/qquickworkerscript.cpp | 6 +- src/qml/qml/v8/qv8worker.cpp | 12 +- tests/auto/qml/qml.pro | 4 +- .../data/enumerate.qml | 0 .../data/multipleroles.qml | 0 .../data/setmodelcachelist.qml | 0 .../data/signalhandlers.qml | 0 .../qqmllistmodel.pro} | 4 +- .../tst_qqmllistmodel.cpp} | 110 +++++++------- .../data/model.qml | 0 .../data/script.js | 0 .../data/workerremoveelement.js | 0 .../data/workerremoveelement.qml | 0 .../data/workerremovelist.js | 0 .../data/workerremovelist.qml | 0 .../data/workersync.js | 0 .../data/workersync.qml | 0 .../qqmllistmodelworkerscript.pro} | 4 +- .../tst_qqmllistmodelworkerscript.cpp} | 82 +++++------ .../imports/com/nokia/AutoTestQmlPluginType/qmldir | 1 - .../qquickworkerscript/tst_qquickworkerscript.cpp | 2 +- .../quick/qquickgridview/tst_qquickgridview.cpp | 4 +- .../quick/qquicklistview/tst_qquicklistview.cpp | 4 +- .../quick/qquickpathview/tst_qquickpathview.cpp | 4 +- 31 files changed, 281 insertions(+), 282 deletions(-) rename src/qml/qml/{qquicklistmodel.cpp => qqmllistmodel.cpp} (92%) rename src/qml/qml/{qquicklistmodel_p.h => qqmllistmodel_p.h} (83%) rename src/qml/qml/{qquicklistmodel_p_p.h => qqmllistmodel_p_p.h} (93%) rename src/qml/qml/{qquicklistmodelworkeragent.cpp => qqmllistmodelworkeragent.cpp} (77%) rename src/qml/qml/{qquicklistmodelworkeragent_p.h => qqmllistmodelworkeragent_p.h} (90%) rename tests/auto/qml/{qquicklistmodel => qqmllistmodel}/data/enumerate.qml (100%) rename tests/auto/qml/{qquicklistmodel => qqmllistmodel}/data/multipleroles.qml (100%) rename tests/auto/qml/{qquicklistmodel => qqmllistmodel}/data/setmodelcachelist.qml (100%) rename tests/auto/qml/{qquicklistmodel => qqmllistmodel}/data/signalhandlers.qml (100%) rename tests/auto/qml/{qquicklistmodel/qquicklistmodel.pro => qqmllistmodel/qqmllistmodel.pro} (79%) rename tests/auto/qml/{qquicklistmodel/tst_qquicklistmodel.cpp => qqmllistmodel/tst_qqmllistmodel.cpp} (95%) rename tests/auto/qml/{qquicklistmodelworkerscript => qqmllistmodelworkerscript}/data/model.qml (100%) rename tests/auto/qml/{qquicklistmodelworkerscript => qqmllistmodelworkerscript}/data/script.js (100%) rename tests/auto/qml/{qquicklistmodelworkerscript => qqmllistmodelworkerscript}/data/workerremoveelement.js (100%) rename tests/auto/qml/{qquicklistmodelworkerscript => qqmllistmodelworkerscript}/data/workerremoveelement.qml (100%) rename tests/auto/qml/{qquicklistmodelworkerscript => qqmllistmodelworkerscript}/data/workerremovelist.js (100%) rename tests/auto/qml/{qquicklistmodelworkerscript => qqmllistmodelworkerscript}/data/workerremovelist.qml (100%) rename tests/auto/qml/{qquicklistmodelworkerscript => qqmllistmodelworkerscript}/data/workersync.js (100%) rename tests/auto/qml/{qquicklistmodelworkerscript => qqmllistmodelworkerscript}/data/workersync.qml (100%) rename tests/auto/qml/{qquicklistmodelworkerscript/qquicklistmodelworkerscript.pro => qqmllistmodelworkerscript/qqmllistmodelworkerscript.pro} (71%) rename tests/auto/qml/{qquicklistmodelworkerscript/tst_qquicklistmodelworkerscript.cpp => qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp} (94%) delete mode 100644 tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/AutoTestQmlPluginType/qmldir diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri index 20b46f0..87fe477 100644 --- a/src/qml/qml/qml.pri +++ b/src/qml/qml/qml.pri @@ -1,7 +1,7 @@ SOURCES += \ $$PWD/qqmlinstruction.cpp \ - $$PWD/qquicklistmodel.cpp \ - $$PWD/qquicklistmodelworkeragent.cpp \ + $$PWD/qqmllistmodel.cpp \ + $$PWD/qqmllistmodelworkeragent.cpp \ $$PWD/qqmlopenmetaobject.cpp \ $$PWD/qqmlvmemetaobject.cpp \ $$PWD/qqmlengine.cpp \ @@ -60,9 +60,9 @@ SOURCES += \ HEADERS += \ $$PWD/qqmlglobal_p.h \ $$PWD/qqmlinstruction_p.h \ - $$PWD/qquicklistmodel_p.h\ - $$PWD/qquicklistmodel_p_p.h\ - $$PWD/qquicklistmodelworkeragent_p.h \ + $$PWD/qqmllistmodel_p.h\ + $$PWD/qqmllistmodel_p_p.h\ + $$PWD/qqmllistmodelworkeragent_p.h \ $$PWD/qqmlopenmetaobject_p.h \ $$PWD/qqmlvmemetaobject_p.h \ $$PWD/qqml.h \ diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 145818a..600f526 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -55,7 +55,7 @@ #include "qqmlxmlhttprequest_p.h" #include "qqmlscriptstring.h" #include "qqmlglobal_p.h" -#include "qquicklistmodel_p.h" +#include "qqmllistmodel_p.h" #include "qquickworkerscript_p.h" #include "qqmlcomponent_p.h" #include "qqmlnetworkaccessmanagerfactory.h" @@ -180,14 +180,14 @@ void QQmlEnginePrivate::registerBaseTypes(const char *uri, int versionMajor, int qmlRegisterType(uri, versionMajor, versionMinor,"Connections"); qmlRegisterType(uri, versionMajor, versionMinor,"Timer"); qmlRegisterCustomType(uri, versionMajor, versionMinor,"Connections", new QQmlConnectionsParser); + qmlRegisterType(uri, versionMajor, versionMinor, "ListElement"); + qmlRegisterCustomType(uri, versionMajor, versionMinor, "ListModel", new QQmlListModelParser); } // These QtQuick types' implementation resides in the QtQml module void QQmlEnginePrivate::registerQtQuick2Types(const char *uri, int versionMajor, int versionMinor) { - qmlRegisterType(uri, versionMajor, versionMinor, "ListElement"); - qmlRegisterCustomType(uri, versionMajor, versionMinor, "ListModel", new QQuickListModelParser); qmlRegisterType(uri, versionMajor, versionMinor, "WorkerScript"); } diff --git a/src/qml/qml/qquicklistmodel.cpp b/src/qml/qml/qqmllistmodel.cpp similarity index 92% rename from src/qml/qml/qquicklistmodel.cpp rename to src/qml/qml/qqmllistmodel.cpp index 91c1a9c..5d64d37 100644 --- a/src/qml/qml/qquicklistmodel.cpp +++ b/src/qml/qml/qqmllistmodel.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qquicklistmodel_p_p.h" -#include "qquicklistmodelworkeragent_p.h" +#include "qqmllistmodel_p_p.h" +#include "qqmllistmodelworkeragent_p.h" #include "qqmlopenmetaobject_p.h" #include #include @@ -246,7 +246,7 @@ const ListLayout::Role *ListLayout::getExistingRole(v8::Handle key) return r; } -ModelObject *ListModel::getOrCreateModelObject(QQuickListModel *model, int elementIndex) +ModelObject *ListModel::getOrCreateModelObject(QQmlListModel *model, int elementIndex) { ListElement *e = elements[elementIndex]; if (e->m_objectCache == 0) { @@ -326,7 +326,7 @@ void ListModel::sync(ListModel *src, ListModel *target, QHash } } -ListModel::ListModel(ListLayout *layout, QQuickListModel *modelCache, int uid) : m_layout(layout), m_modelCache(modelCache) +ListModel::ListModel(ListLayout *layout, QQmlListModel *modelCache, int uid) : m_layout(layout), m_modelCache(modelCache) { if (uid == -1) uid = uidCounter.fetchAndAddOrdered(1); @@ -394,7 +394,7 @@ void ListModel::updateCacheIndices() } } -QVariant ListModel::getProperty(int elementIndex, int roleIndex, const QQuickListModel *owner, QV8Engine *eng) +QVariant ListModel::getProperty(int elementIndex, int roleIndex, const QQmlListModel *owner, QV8Engine *eng) { ListElement *e = elements[elementIndex]; const ListLayout::Role &r = m_layout->getExistingRole(roleIndex); @@ -698,7 +698,7 @@ ListModel *ListElement::getListProperty(const ListLayout::Role &role) return *value; } -QVariant ListElement::getProperty(const ListLayout::Role &role, const QQuickListModel *owner, QV8Engine *eng) +QVariant ListElement::getProperty(const ListLayout::Role &role, const QQmlListModel *owner, QV8Engine *eng) { char *mem = getPropertyMemory(role); @@ -731,7 +731,7 @@ QVariant ListElement::getProperty(const ListLayout::Role &role, const QQuickList if (model) { if (model->m_modelCache == 0) { - model->m_modelCache = new QQuickListModel(owner, model, eng); + model->m_modelCache = new QQmlListModel(owner, model, eng); QQmlEngine::setContextForObject(model->m_modelCache, QQmlEngine::contextForObject(owner)); } @@ -1207,7 +1207,7 @@ int ListElement::setJsProperty(const ListLayout::Role &role, v8::Handle roles; @@ -1282,20 +1282,20 @@ DynamicRoleModelNode *DynamicRoleModelNode::create(const QVariantMap &obj, QQuic return object; } -void DynamicRoleModelNode::sync(DynamicRoleModelNode *src, DynamicRoleModelNode *target, QHash *targetModelHash) +void DynamicRoleModelNode::sync(DynamicRoleModelNode *src, DynamicRoleModelNode *target, QHash *targetModelHash) { for (int i=0 ; i < src->m_meta->count() ; ++i) { const QByteArray &name = src->m_meta->name(i); QVariant value = src->m_meta->value(i); - QQuickListModel *srcModel = qobject_cast(value.value()); - QQuickListModel *targetModel = qobject_cast(target->m_meta->value(i).value()); + QQmlListModel *srcModel = qobject_cast(value.value()); + QQmlListModel *targetModel = qobject_cast(target->m_meta->value(i).value()); if (srcModel) { if (targetModel == 0) - targetModel = QQuickListModel::createWithOwner(target->m_owner); + targetModel = QQmlListModel::createWithOwner(target->m_owner); - QQuickListModel::sync(srcModel, targetModel, targetModelHash); + QQmlListModel::sync(srcModel, targetModel, targetModelHash); QObject *targetModelObject = targetModel; value = QVariant::fromValue(targetModelObject); @@ -1326,7 +1326,7 @@ void DynamicRoleModelNode::updateValues(const QVariantMap &object, QVector QVariant value = object[key]; if (value.type() == QVariant::List) { - QQuickListModel *subModel = QQuickListModel::createWithOwner(m_owner); + QQmlListModel *subModel = QQmlListModel::createWithOwner(m_owner); QVariantList subArray = value.toList(); QVariantList::const_iterator subIt = subArray.begin(); @@ -1343,7 +1343,7 @@ void DynamicRoleModelNode::updateValues(const QVariantMap &object, QVector const QByteArray &keyUtf8 = key.toUtf8(); - QQuickListModel *existingModel = qobject_cast(m_meta->value(keyUtf8).value()); + QQmlListModel *existingModel = qobject_cast(m_meta->value(keyUtf8).value()); if (existingModel) delete existingModel; @@ -1362,7 +1362,7 @@ DynamicRoleModelNodeMetaObject::DynamicRoleModelNodeMetaObject(DynamicRoleModelN DynamicRoleModelNodeMetaObject::~DynamicRoleModelNodeMetaObject() { for (int i=0 ; i < count() ; ++i) { - QQuickListModel *subModel = qobject_cast(value(i).value()); + QQmlListModel *subModel = qobject_cast(value(i).value()); if (subModel) delete subModel; } @@ -1374,7 +1374,7 @@ void DynamicRoleModelNodeMetaObject::propertyWrite(int index) return; QVariant v = value(index); - QQuickListModel *model = qobject_cast(v.value()); + QQmlListModel *model = qobject_cast(v.value()); if (model) delete model; } @@ -1384,11 +1384,11 @@ void DynamicRoleModelNodeMetaObject::propertyWritten(int index) if (!m_enabled) return; - QQuickListModel *parentModel = m_owner->m_owner; + QQmlListModel *parentModel = m_owner->m_owner; QVariant v = value(index); if (v.type() == QVariant::List) { - QQuickListModel *subModel = QQuickListModel::createWithOwner(parentModel); + QQmlListModel *subModel = QQmlListModel::createWithOwner(parentModel); QVariantList subArray = v.toList(); QVariantList::const_iterator subIt = subArray.begin(); @@ -1417,14 +1417,14 @@ void DynamicRoleModelNodeMetaObject::propertyWritten(int index) } } -QQuickListModelParser::ListInstruction *QQuickListModelParser::ListModelData::instructions() const +QQmlListModelParser::ListInstruction *QQmlListModelParser::ListModelData::instructions() const { - return (QQuickListModelParser::ListInstruction *)((char *)this + sizeof(ListModelData)); + return (QQmlListModelParser::ListInstruction *)((char *)this + sizeof(ListModelData)); } /*! \qmltype ListModel - \instantiates QQuickListModel + \instantiates QQmlListModel \inqmlmodule QtQuick 2 \brief Defines a free-form list data source \ingroup qtquick-models @@ -1515,7 +1515,7 @@ QQuickListModelParser::ListInstruction *QQuickListModelParser::ListModelData::in \sa {qml-data-models}{Data Models}, {declarative/threading/threadedlistmodel}{Threaded ListModel example}, QtQml */ -QQuickListModel::QQuickListModel(QObject *parent) +QQmlListModel::QQmlListModel(QObject *parent) : QAbstractListModel(parent) { m_mainThread = true; @@ -1530,7 +1530,7 @@ QQuickListModel::QQuickListModel(QObject *parent) m_engine = 0; } -QQuickListModel::QQuickListModel(const QQuickListModel *owner, ListModel *data, QV8Engine *eng, QObject *parent) +QQmlListModel::QQmlListModel(const QQmlListModel *owner, ListModel *data, QV8Engine *eng, QObject *parent) : QAbstractListModel(parent) { m_mainThread = owner->m_mainThread; @@ -1545,7 +1545,7 @@ QQuickListModel::QQuickListModel(const QQuickListModel *owner, ListModel *data, m_engine = eng; } -QQuickListModel::QQuickListModel(QQuickListModel *orig, QQuickListModelWorkerAgent *agent) +QQmlListModel::QQmlListModel(QQmlListModel *orig, QQmlListModelWorkerAgent *agent) : QAbstractListModel(agent) { m_mainThread = false; @@ -1564,7 +1564,7 @@ QQuickListModel::QQuickListModel(QQuickListModel *orig, QQuickListModelWorkerAge m_engine = 0; } -QQuickListModel::~QQuickListModel() +QQmlListModel::~QQmlListModel() { for (int i=0 ; i < m_modelObjects.count() ; ++i) delete m_modelObjects[i]; @@ -1585,9 +1585,9 @@ QQuickListModel::~QQuickListModel() m_layout = 0; } -QQuickListModel *QQuickListModel::createWithOwner(QQuickListModel *newOwner) +QQmlListModel *QQmlListModel::createWithOwner(QQmlListModel *newOwner) { - QQuickListModel *model = new QQuickListModel; + QQmlListModel *model = new QQmlListModel; model->m_mainThread = newOwner->m_mainThread; model->m_engine = newOwner->m_engine; @@ -1602,7 +1602,7 @@ QQuickListModel *QQuickListModel::createWithOwner(QQuickListModel *newOwner) return model; } -QV8Engine *QQuickListModel::engine() const +QV8Engine *QQmlListModel::engine() const { if (m_engine == 0) { m_engine = QQmlEnginePrivate::getV8Engine(qmlEngine(this)); @@ -1611,7 +1611,7 @@ QV8Engine *QQuickListModel::engine() const return m_engine; } -void QQuickListModel::sync(QQuickListModel *src, QQuickListModel *target, QHash *targetModelHash) +void QQmlListModel::sync(QQmlListModel *src, QQmlListModel *target, QHash *targetModelHash) { Q_ASSERT(src->m_dynamicRoles && target->m_dynamicRoles); @@ -1672,7 +1672,7 @@ void QQuickListModel::sync(QQuickListModel *src, QQuickListModel *target, QHash< } } -void QQuickListModel::emitItemsChanged(int index, int count, const QVector &roles) +void QQmlListModel::emitItemsChanged(int index, int count, const QVector &roles) { if (count <= 0) return; @@ -1685,7 +1685,7 @@ void QQuickListModel::emitItemsChanged(int index, int count, const QVector } } -void QQuickListModel::emitItemsRemoved(int index, int count) +void QQmlListModel::emitItemsRemoved(int index, int count) { if (count <= 0) return; @@ -1702,7 +1702,7 @@ void QQuickListModel::emitItemsRemoved(int index, int count) } } -void QQuickListModel::emitItemsInserted(int index, int count) +void QQmlListModel::emitItemsInserted(int index, int count) { if (count <= 0) return; @@ -1717,7 +1717,7 @@ void QQuickListModel::emitItemsInserted(int index, int count) } } -void QQuickListModel::emitItemsMoved(int from, int to, int n) +void QQmlListModel::emitItemsMoved(int from, int to, int n) { if (n <= 0) return; @@ -1731,33 +1731,33 @@ void QQuickListModel::emitItemsMoved(int from, int to, int n) } } -QQuickListModelWorkerAgent *QQuickListModel::agent() +QQmlListModelWorkerAgent *QQmlListModel::agent() { if (m_agent) return m_agent; - m_agent = new QQuickListModelWorkerAgent(this); + m_agent = new QQmlListModelWorkerAgent(this); return m_agent; } -QModelIndex QQuickListModel::index(int row, int column, const QModelIndex &parent) const +QModelIndex QQmlListModel::index(int row, int column, const QModelIndex &parent) const { return row >= 0 && row < count() && column == 0 && !parent.isValid() ? createIndex(row, column) : QModelIndex(); } -int QQuickListModel::rowCount(const QModelIndex &parent) const +int QQmlListModel::rowCount(const QModelIndex &parent) const { return !parent.isValid() ? count() : 0; } -QVariant QQuickListModel::data(const QModelIndex &index, int role) const +QVariant QQmlListModel::data(const QModelIndex &index, int role) const { return data(index.row(), role); } -QVariant QQuickListModel::data(int index, int role) const +QVariant QQmlListModel::data(int index, int role) const { QVariant v; @@ -1772,7 +1772,7 @@ QVariant QQuickListModel::data(int index, int role) const return v; } -QHash QQuickListModel::roleNames() const +QHash QQmlListModel::roleNames() const { QHash roleNames; @@ -1790,7 +1790,7 @@ QHash QQuickListModel::roleNames() const } /*! - \qmlproperty bool QtQuick2::ListModel::dynamicRoles + \qmlproperty bool QtQml2::ListModel::dynamicRoles By default, the type of a role is fixed the first time the role is used. For example, if you create a role called @@ -1815,7 +1815,7 @@ QHash QQuickListModel::roleNames() const Due to the performance cost of using dynamic roles, they are disabled by default. */ -void QQuickListModel::setDynamicRoles(bool enableDynamicRoles) +void QQmlListModel::setDynamicRoles(bool enableDynamicRoles) { if (m_mainThread && m_agent == 0) { if (enableDynamicRoles) { @@ -1836,10 +1836,10 @@ void QQuickListModel::setDynamicRoles(bool enableDynamicRoles) } /*! - \qmlproperty int QtQuick2::ListModel::count + \qmlproperty int QtQml2::ListModel::count The number of data entries in the model. */ -int QQuickListModel::count() const +int QQmlListModel::count() const { int count; @@ -1853,13 +1853,13 @@ int QQuickListModel::count() const } /*! - \qmlmethod QtQuick2::ListModel::clear() + \qmlmethod QtQml2::ListModel::clear() Deletes all content from the model. \sa append(), remove() */ -void QQuickListModel::clear() +void QQmlListModel::clear() { int cleared = count(); @@ -1875,13 +1875,13 @@ void QQuickListModel::clear() } /*! - \qmlmethod QtQuick2::ListModel::remove(int index, int count = 1) + \qmlmethod QtQml2::ListModel::remove(int index, int count = 1) Deletes the content at \a index from the model. \sa clear() */ -void QQuickListModel::remove(QQmlV8Function *args) +void QQmlListModel::remove(QQmlV8Function *args) { int argLength = args->Length(); @@ -1909,7 +1909,7 @@ void QQuickListModel::remove(QQmlV8Function *args) } /*! - \qmlmethod QtQuick2::ListModel::insert(int index, jsobject dict) + \qmlmethod QtQml2::ListModel::insert(int index, jsobject dict) Adds a new item to the list model at position \a index, with the values in \a dict. @@ -1924,7 +1924,7 @@ void QQuickListModel::remove(QQmlV8Function *args) \sa set(), append() */ -void QQuickListModel::insert(QQmlV8Function *args) +void QQmlListModel::insert(QQmlV8Function *args) { if (args->Length() == 2) { @@ -1970,7 +1970,7 @@ void QQuickListModel::insert(QQmlV8Function *args) } /*! - \qmlmethod QtQuick2::ListModel::move(int from, int to, int n) + \qmlmethod QtQml2::ListModel::move(int from, int to, int n) Moves \a n items \a from one position \a to another. @@ -1983,7 +1983,7 @@ void QQuickListModel::insert(QQmlV8Function *args) \sa append() */ -void QQuickListModel::move(int from, int to, int n) +void QQmlListModel::move(int from, int to, int n) { if (n==0 || from==to) return; @@ -2023,7 +2023,7 @@ void QQuickListModel::move(int from, int to, int n) } /*! - \qmlmethod QtQuick2::ListModel::append(jsobject dict) + \qmlmethod QtQml2::ListModel::append(jsobject dict) Adds a new item to the end of the list model, with the values in \a dict. @@ -2034,7 +2034,7 @@ void QQuickListModel::move(int from, int to, int n) \sa set(), remove() */ -void QQuickListModel::append(QQmlV8Function *args) +void QQmlListModel::append(QQmlV8Function *args) { if (args->Length() == 1) { v8::Handle arg = (*args)[0]; @@ -2077,7 +2077,7 @@ void QQuickListModel::append(QQmlV8Function *args) } /*! - \qmlmethod object QtQuick2::ListModel::get(int index) + \qmlmethod object QtQml2::ListModel::get(int index) Returns the item at \a index in the list model. This allows the item data to be accessed or modified from JavaScript: @@ -2107,7 +2107,7 @@ void QQuickListModel::append(QQmlV8Function *args) \sa append() */ -QQmlV8Handle QQuickListModel::get(int index) const +QQmlV8Handle QQmlListModel::get(int index) const { v8::Handle result = v8::Undefined(); @@ -2118,7 +2118,7 @@ QQmlV8Handle QQuickListModel::get(int index) const DynamicRoleModelNode *object = m_modelObjects[index]; result = v8engine->newQObject(object); } else { - ModelObject *object = m_listModel->getOrCreateModelObject(const_cast(this), index); + ModelObject *object = m_listModel->getOrCreateModelObject(const_cast(this), index); result = v8engine->newQObject(object); } } @@ -2127,7 +2127,7 @@ QQmlV8Handle QQuickListModel::get(int index) const } /*! - \qmlmethod QtQuick2::ListModel::set(int index, jsobject dict) + \qmlmethod QtQml2::ListModel::set(int index, jsobject dict) Changes the item at \a index in the list model with the values in \a dict. Properties not appearing in \a dict @@ -2142,7 +2142,7 @@ QQmlV8Handle QQuickListModel::get(int index) const \sa append() */ -void QQuickListModel::set(int index, const QQmlV8Handle &handle) +void QQmlListModel::set(int index, const QQmlV8Handle &handle) { v8::Handle valuemap = handle.toHandle(); @@ -2182,7 +2182,7 @@ void QQuickListModel::set(int index, const QQmlV8Handle &handle) } /*! - \qmlmethod QtQuick2::ListModel::setProperty(int index, string property, variant value) + \qmlmethod QtQml2::ListModel::setProperty(int index, string property, variant value) Changes the \a property of the item at \a index in the list model to \a value. @@ -2194,7 +2194,7 @@ void QQuickListModel::set(int index, const QQmlV8Handle &handle) \sa append() */ -void QQuickListModel::setProperty(int index, const QString& property, const QVariant& value) +void QQmlListModel::setProperty(int index, const QString& property, const QVariant& value) { if (count() == 0 || index >= count() || index < 0) { qmlInfo(this) << tr("set: index %1 out of range").arg(index); @@ -2225,20 +2225,20 @@ void QQuickListModel::setProperty(int index, const QString& property, const QVar } /*! - \qmlmethod QtQuick2::ListModel::sync() + \qmlmethod QtQml2::ListModel::sync() Writes any unsaved changes to the list model after it has been modified from a worker script. */ -void QQuickListModel::sync() +void QQmlListModel::sync() { // This is just a dummy method to make it look like sync() exists in - // ListModel (and not just QQuickListModelWorkerAgent) and to let + // ListModel (and not just QQmlListModelWorkerAgent) and to let // us document sync(). qmlInfo(this) << "List sync() can only be called from a WorkerScript"; } -bool QQuickListModelParser::compileProperty(const QQmlCustomParserProperty &prop, QList &instr, QByteArray &data) +bool QQmlListModelParser::compileProperty(const QQmlCustomParserProperty &prop, QList &instr, QByteArray &data) { QList values = prop.assignedValues(); for(int ii = 0; ii < values.count(); ++ii) { @@ -2250,8 +2250,8 @@ bool QQuickListModelParser::compileProperty(const QQmlCustomParserProperty &prop if (node.name() != listElementTypeName) { const QMetaObject *mo = resolveType(node.name()); - if (mo != &QQuickListElement::staticMetaObject) { - error(node, QQuickListModel::tr("ListElement: cannot contain nested elements")); + if (mo != &QQmlListElement::staticMetaObject) { + error(node, QQmlListModel::tr("ListElement: cannot contain nested elements")); return false; } listElementTypeName = node.name(); // cache right name for next time @@ -2268,11 +2268,11 @@ bool QQuickListModelParser::compileProperty(const QQmlCustomParserProperty &prop for(int jj = 0; jj < props.count(); ++jj) { const QQmlCustomParserProperty &nodeProp = props.at(jj); if (nodeProp.name().isEmpty()) { - error(nodeProp, QQuickListModel::tr("ListElement: cannot contain nested elements")); + error(nodeProp, QQmlListModel::tr("ListElement: cannot contain nested elements")); return false; } if (nodeProp.name() == QStringLiteral("id")) { - error(nodeProp, QQuickListModel::tr("ListElement: cannot use reserved \"id\" property")); + error(nodeProp, QQmlListModel::tr("ListElement: cannot use reserved \"id\" property")); return false; } @@ -2331,14 +2331,14 @@ bool QQuickListModelParser::compileProperty(const QQmlCustomParserProperty &prop if (callExpr->arguments && !callExpr->arguments->next) literal = AST::cast(callExpr->arguments->expression); if (!literal) { - error(prop, QQuickListModel::tr("ListElement: improperly specified %1").arg(idExpr->name.toString())); + error(prop, QQmlListModel::tr("ListElement: improperly specified %1").arg(idExpr->name.toString())); return false; } } else if (idExpr->name == QLatin1String("QT_TRANSLATE_NOOP")) { if (callExpr->arguments && callExpr->arguments->next && !callExpr->arguments->next->next) literal = AST::cast(callExpr->arguments->next->expression); if (!literal) { - error(prop, QQuickListModel::tr("ListElement: improperly specified QT_TRANSLATE_NOOP")); + error(prop, QQmlListModel::tr("ListElement: improperly specified QT_TRANSLATE_NOOP")); return false; } } @@ -2349,7 +2349,7 @@ bool QQuickListModelParser::compileProperty(const QQmlCustomParserProperty &prop d[0] = char(QQmlScript::Variant::String); d += literal->value.toUtf8(); } else { - error(prop, QQuickListModel::tr("ListElement: cannot use script for property value")); + error(prop, QQmlListModel::tr("ListElement: cannot use script for property value")); return false; } } else { @@ -2371,7 +2371,7 @@ bool QQuickListModelParser::compileProperty(const QQmlCustomParserProperty &prop return true; } -QByteArray QQuickListModelParser::compile(const QList &customProps) +QByteArray QQmlListModelParser::compile(const QList &customProps) { QList instr; QByteArray data; @@ -2380,7 +2380,7 @@ QByteArray QQuickListModelParser::compile(const QList for(int ii = 0; ii < customProps.count(); ++ii) { const QQmlCustomParserProperty &prop = customProps.at(ii); if(!prop.name().isEmpty()) { // isn't default property - error(prop, QQuickListModel::tr("ListModel: undefined property '%1'").arg(prop.name())); + error(prop, QQmlListModel::tr("ListModel: undefined property '%1'").arg(prop.name())); return QByteArray(); } @@ -2407,9 +2407,9 @@ QByteArray QQuickListModelParser::compile(const QList return rv; } -void QQuickListModelParser::setCustomData(QObject *obj, const QByteArray &d) +void QQmlListModelParser::setCustomData(QObject *obj, const QByteArray &d) { - QQuickListModel *rv = static_cast(obj); + QQmlListModel *rv = static_cast(obj); QV8Engine *engine = QQmlEnginePrivate::getV8Engine(qmlEngine(rv)); rv->m_engine = engine; @@ -2508,7 +2508,7 @@ void QQuickListModelParser::setCustomData(QObject *obj, const QByteArray &d) qmlInfo(obj) << "All ListElement declarations are empty, no roles can be created unless dynamicRoles is set."; } -bool QQuickListModelParser::definesEmptyList(const QString &s) +bool QQmlListModelParser::definesEmptyList(const QString &s) { if (s.startsWith(QLatin1Char('[')) && s.endsWith(QLatin1Char(']'))) { for (int i=1; i #include @@ -60,19 +60,19 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QQuickListModelWorkerAgent; +class QQmlListModelWorkerAgent; class ListModel; class ListLayout; -class Q_QML_PRIVATE_EXPORT QQuickListModel : public QAbstractListModel +class Q_QML_PRIVATE_EXPORT QQmlListModel : public QAbstractListModel { Q_OBJECT Q_PROPERTY(int count READ count NOTIFY countChanged) Q_PROPERTY(bool dynamicRoles READ dynamicRoles WRITE setDynamicRoles) public: - QQuickListModel(QObject *parent=0); - ~QQuickListModel(); + QQmlListModel(QObject *parent=0); + ~QQmlListModel(); QModelIndex index(int row, int column, const QModelIndex &parent) const; int rowCount(const QModelIndex &parent) const; @@ -92,7 +92,7 @@ public: Q_INVOKABLE void move(int from, int to, int count); Q_INVOKABLE void sync(); - QQuickListModelWorkerAgent *agent(); + QQmlListModelWorkerAgent *agent(); bool dynamicRoles() const { return m_dynamicRoles; } void setDynamicRoles(bool enableDynamicRoles); @@ -101,8 +101,8 @@ Q_SIGNALS: void countChanged(); private: - friend class QQuickListModelParser; - friend class QQuickListModelWorkerAgent; + friend class QQmlListModelParser; + friend class QQmlListModelWorkerAgent; friend class ModelObject; friend class ModelNodeMetaObject; friend class ListModel; @@ -111,14 +111,14 @@ private: friend class DynamicRoleModelNodeMetaObject; // Constructs a flat list model for a worker agent - QQuickListModel(QQuickListModel *orig, QQuickListModelWorkerAgent *agent); - QQuickListModel(const QQuickListModel *owner, ListModel *data, QV8Engine *eng, QObject *parent=0); + QQmlListModel(QQmlListModel *orig, QQmlListModelWorkerAgent *agent); + QQmlListModel(const QQmlListModel *owner, ListModel *data, QV8Engine *eng, QObject *parent=0); QV8Engine *engine() const; inline bool canMove(int from, int to, int n) const { return !(from+n > count() || to+n > count() || from < 0 || to < 0 || n < 0); } - QQuickListModelWorkerAgent *m_agent; + QQmlListModelWorkerAgent *m_agent; mutable QV8Engine *m_engine; bool m_mainThread; bool m_primary; @@ -142,8 +142,8 @@ private: int getUid() const { return m_uid; } - static void sync(QQuickListModel *src, QQuickListModel *target, QHash *targetModelHash); - static QQuickListModel *createWithOwner(QQuickListModel *newOwner); + static void sync(QQmlListModel *src, QQmlListModel *target, QHash *targetModelHash); + static QQmlListModel *createWithOwner(QQmlListModel *newOwner); void emitItemsChanged(int index, int count, const QVector &roles); void emitItemsRemoved(int index, int count); @@ -152,15 +152,15 @@ private: }; // ### FIXME -class QQuickListElement : public QObject +class QQmlListElement : public QObject { Q_OBJECT }; -class QQuickListModelParser : public QQmlCustomParser +class QQmlListModelParser : public QQmlCustomParser { public: - QQuickListModelParser() : QQmlCustomParser(QQmlCustomParser::AcceptsSignalHandlers) {} + QQmlListModelParser() : QQmlCustomParser(QQmlCustomParser::AcceptsSignalHandlers) {} QByteArray compile(const QList &); void setCustomData(QObject *, const QByteArray &); @@ -194,9 +194,9 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QQuickListModel) -QML_DECLARE_TYPE(QQuickListElement) +QML_DECLARE_TYPE(QQmlListModel) +QML_DECLARE_TYPE(QQmlListElement) QT_END_HEADER -#endif // QQUICKLISTMODEL_H +#endif // QQMLLISTMODEL_H diff --git a/src/qml/qml/qquicklistmodel_p_p.h b/src/qml/qml/qqmllistmodel_p_p.h similarity index 93% rename from src/qml/qml/qquicklistmodel_p_p.h rename to src/qml/qml/qqmllistmodel_p_p.h index ff312f9..d48edec 100644 --- a/src/qml/qml/qquicklistmodel_p_p.h +++ b/src/qml/qml/qqmllistmodel_p_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QQUICKLISTMODEL_P_P_H -#define QQUICKLISTMODEL_P_P_H +#ifndef QQMLLISTMODEL_P_P_H +#define QQMLLISTMODEL_P_P_H // // W A R N I N G @@ -53,7 +53,7 @@ // We mean it. // -#include "qquicklistmodel_p.h" +#include "qqmllistmodel_p.h" #include #include "qqmlopenmetaobject_p.h" #include @@ -85,9 +85,9 @@ class DynamicRoleModelNode : public QObject { Q_OBJECT public: - DynamicRoleModelNode(QQuickListModel *owner, int uid); + DynamicRoleModelNode(QQmlListModel *owner, int uid); - static DynamicRoleModelNode *create(const QVariantMap &obj, QQuickListModel *owner); + static DynamicRoleModelNode *create(const QVariantMap &obj, QQmlListModel *owner); void updateValues(const QVariantMap &object, QVector &roles); @@ -111,10 +111,10 @@ public: return m_uid; } - static void sync(DynamicRoleModelNode *src, DynamicRoleModelNode *target, QHash *targetModelHash); + static void sync(DynamicRoleModelNode *src, DynamicRoleModelNode *target, QHash *targetModelHash); private: - QQuickListModel *m_owner; + QQmlListModel *m_owner; int m_uid; DynamicRoleModelNodeMetaObject *m_meta; @@ -143,7 +143,7 @@ class ModelObject : public QObject { Q_OBJECT public: - ModelObject(QQuickListModel *model, int elementIndex); + ModelObject(QQmlListModel *model, int elementIndex); void setValue(const QByteArray &name, const QVariant &val, bool force) { @@ -164,7 +164,7 @@ public: void updateValues(); void updateValues(const QVector &roles); - QQuickListModel *m_model; + QQmlListModel *m_model; int m_elementIndex; private: @@ -273,7 +273,7 @@ private: void clearProperty(const ListLayout::Role &role); - QVariant getProperty(const ListLayout::Role &role, const QQuickListModel *owner, QV8Engine *eng); + QVariant getProperty(const ListLayout::Role &role, const QQmlListModel *owner, QV8Engine *eng); ListModel *getListProperty(const ListLayout::Role &role); QString *getStringProperty(const ListLayout::Role &role); QObject *getQObjectProperty(const ListLayout::Role &role); @@ -298,7 +298,7 @@ class ListModel { public: - ListModel(ListLayout *layout, QQuickListModel *modelCache, int uid); + ListModel(ListLayout *layout, QQmlListModel *modelCache, int uid); ~ListModel() {} void destroy(); @@ -306,7 +306,7 @@ public: int setOrCreateProperty(int elementIndex, const QString &key, const QVariant &data); int setExistingProperty(int uid, const QString &key, v8::Handle data, QV8Engine *eng); - QVariant getProperty(int elementIndex, int roleIndex, const QQuickListModel *owner, QV8Engine *eng); + QVariant getProperty(int elementIndex, int roleIndex, const QQmlListModel *owner, QV8Engine *eng); ListModel *getListProperty(int elementIndex, const ListLayout::Role &role); int roleCount() const @@ -347,14 +347,14 @@ public: static void sync(ListModel *src, ListModel *target, QHash *srcModelHash); - ModelObject *getOrCreateModelObject(QQuickListModel *model, int elementIndex); + ModelObject *getOrCreateModelObject(QQmlListModel *model, int elementIndex); private: QPODVector elements; ListLayout *m_layout; int m_uid; - QQuickListModel *m_modelCache; + QQmlListModel *m_modelCache; struct ElementSync { @@ -369,7 +369,7 @@ private: void updateCacheIndices(); friend class ListElement; - friend class QQuickListModelWorkerAgent; + friend class QQmlListModelWorkerAgent; }; QT_END_NAMESPACE diff --git a/src/qml/qml/qquicklistmodelworkeragent.cpp b/src/qml/qml/qqmllistmodelworkeragent.cpp similarity index 77% rename from src/qml/qml/qquicklistmodelworkeragent.cpp rename to src/qml/qml/qqmllistmodelworkeragent.cpp index e0ab882..9554e6d 100644 --- a/src/qml/qml/qquicklistmodelworkeragent.cpp +++ b/src/qml/qml/qqmllistmodelworkeragent.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qquicklistmodelworkeragent_p.h" -#include "qquicklistmodel_p_p.h" +#include "qqmllistmodelworkeragent_p.h" +#include "qqmllistmodel_p_p.h" #include #include #include @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE -void QQuickListModelWorkerAgent::Data::clearChange(int uid) +void QQmlListModelWorkerAgent::Data::clearChange(int uid) { for (int i=0 ; i < changes.count() ; ++i) { if (changes[i].modelUid == uid) { @@ -63,53 +63,53 @@ void QQuickListModelWorkerAgent::Data::clearChange(int uid) } } -void QQuickListModelWorkerAgent::Data::insertChange(int uid, int index, int count) +void QQmlListModelWorkerAgent::Data::insertChange(int uid, int index, int count) { Change c = { uid, Change::Inserted, index, count, 0, QVector() }; changes << c; } -void QQuickListModelWorkerAgent::Data::removeChange(int uid, int index, int count) +void QQmlListModelWorkerAgent::Data::removeChange(int uid, int index, int count) { Change c = { uid, Change::Removed, index, count, 0, QVector() }; changes << c; } -void QQuickListModelWorkerAgent::Data::moveChange(int uid, int index, int count, int to) +void QQmlListModelWorkerAgent::Data::moveChange(int uid, int index, int count, int to) { Change c = { uid, Change::Moved, index, count, to, QVector() }; changes << c; } -void QQuickListModelWorkerAgent::Data::changedChange(int uid, int index, int count, const QVector &roles) +void QQmlListModelWorkerAgent::Data::changedChange(int uid, int index, int count, const QVector &roles) { Change c = { uid, Change::Changed, index, count, 0, roles }; changes << c; } -QQuickListModelWorkerAgent::QQuickListModelWorkerAgent(QQuickListModel *model) -: m_ref(1), m_orig(model), m_copy(new QQuickListModel(model, this)) +QQmlListModelWorkerAgent::QQmlListModelWorkerAgent(QQmlListModel *model) +: m_ref(1), m_orig(model), m_copy(new QQmlListModel(model, this)) { } -QQuickListModelWorkerAgent::~QQuickListModelWorkerAgent() +QQmlListModelWorkerAgent::~QQmlListModelWorkerAgent() { mutex.lock(); syncDone.wakeAll(); mutex.unlock(); } -void QQuickListModelWorkerAgent::setV8Engine(QV8Engine *eng) +void QQmlListModelWorkerAgent::setV8Engine(QV8Engine *eng) { m_copy->m_engine = eng; } -void QQuickListModelWorkerAgent::addref() +void QQmlListModelWorkerAgent::addref() { m_ref.ref(); } -void QQuickListModelWorkerAgent::release() +void QQmlListModelWorkerAgent::release() { bool del = !m_ref.deref(); @@ -117,57 +117,57 @@ void QQuickListModelWorkerAgent::release() deleteLater(); } -void QQuickListModelWorkerAgent::modelDestroyed() +void QQmlListModelWorkerAgent::modelDestroyed() { m_orig = 0; } -int QQuickListModelWorkerAgent::count() const +int QQmlListModelWorkerAgent::count() const { return m_copy->count(); } -void QQuickListModelWorkerAgent::clear() +void QQmlListModelWorkerAgent::clear() { m_copy->clear(); } -void QQuickListModelWorkerAgent::remove(QQmlV8Function *args) +void QQmlListModelWorkerAgent::remove(QQmlV8Function *args) { m_copy->remove(args); } -void QQuickListModelWorkerAgent::append(QQmlV8Function *args) +void QQmlListModelWorkerAgent::append(QQmlV8Function *args) { m_copy->append(args); } -void QQuickListModelWorkerAgent::insert(QQmlV8Function *args) +void QQmlListModelWorkerAgent::insert(QQmlV8Function *args) { m_copy->insert(args); } -QQmlV8Handle QQuickListModelWorkerAgent::get(int index) const +QQmlV8Handle QQmlListModelWorkerAgent::get(int index) const { return m_copy->get(index); } -void QQuickListModelWorkerAgent::set(int index, const QQmlV8Handle &value) +void QQmlListModelWorkerAgent::set(int index, const QQmlV8Handle &value) { m_copy->set(index, value); } -void QQuickListModelWorkerAgent::setProperty(int index, const QString& property, const QVariant& value) +void QQmlListModelWorkerAgent::setProperty(int index, const QString& property, const QVariant& value) { m_copy->setProperty(index, property, value); } -void QQuickListModelWorkerAgent::move(int from, int to, int count) +void QQmlListModelWorkerAgent::move(int from, int to, int count) { m_copy->move(from, to, count); } -void QQuickListModelWorkerAgent::sync() +void QQmlListModelWorkerAgent::sync() { Sync *s = new Sync; s->data = data; @@ -180,7 +180,7 @@ void QQuickListModelWorkerAgent::sync() mutex.unlock(); } -bool QQuickListModelWorkerAgent::event(QEvent *e) +bool QQmlListModelWorkerAgent::event(QEvent *e) { if (e->type() == QEvent::User) { bool cc = false; @@ -191,19 +191,19 @@ bool QQuickListModelWorkerAgent::event(QEvent *e) cc = m_orig->count() != s->list->count(); - QHash targetModelDynamicHash; + QHash targetModelDynamicHash; QHash targetModelStaticHash; Q_ASSERT(m_orig->m_dynamicRoles == s->list->m_dynamicRoles); if (m_orig->m_dynamicRoles) - QQuickListModel::sync(s->list, m_orig, &targetModelDynamicHash); + QQmlListModel::sync(s->list, m_orig, &targetModelDynamicHash); else ListModel::sync(s->list->m_listModel, m_orig->m_listModel, &targetModelStaticHash); for (int ii = 0; ii < changes.count(); ++ii) { const Change &change = changes.at(ii); - QQuickListModel *model = 0; + QQmlListModel *model = 0; if (m_orig->m_dynamicRoles) { model = targetModelDynamicHash.value(change.modelUid); } else { diff --git a/src/qml/qml/qquicklistmodelworkeragent_p.h b/src/qml/qml/qqmllistmodelworkeragent_p.h similarity index 90% rename from src/qml/qml/qquicklistmodelworkeragent_p.h rename to src/qml/qml/qqmllistmodelworkeragent_p.h index 7cff9be..9471d66 100644 --- a/src/qml/qml/qquicklistmodelworkeragent_p.h +++ b/src/qml/qml/qqmllistmodelworkeragent_p.h @@ -65,16 +65,16 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QQuickListModel; +class QQmlListModel; -class QQuickListModelWorkerAgent : public QObject +class QQmlListModelWorkerAgent : public QObject { Q_OBJECT Q_PROPERTY(int count READ count) public: - QQuickListModelWorkerAgent(QQuickListModel *); - ~QQuickListModelWorkerAgent(); + QQmlListModelWorkerAgent(QQmlListModel *); + ~QQmlListModelWorkerAgent(); void setV8Engine(QV8Engine *eng); void addref(); @@ -96,7 +96,7 @@ public: { VariantRef() : a(0) {} VariantRef(const VariantRef &r) : a(r.a) { if (a) a->addref(); } - VariantRef(QQuickListModelWorkerAgent *_a) : a(_a) { if (a) a->addref(); } + VariantRef(QQmlListModelWorkerAgent *_a) : a(_a) { if (a) a->addref(); } ~VariantRef() { if (a) a->release(); } VariantRef &operator=(const VariantRef &o) { @@ -105,7 +105,7 @@ public: return *this; } - QQuickListModelWorkerAgent *a; + QQmlListModelWorkerAgent *a; }; void modelDestroyed(); protected: @@ -113,7 +113,7 @@ protected: private: friend class QQuickWorkerScriptEnginePrivate; - friend class QQuickListModel; + friend class QQmlListModel; struct Change { @@ -140,19 +140,19 @@ private: struct Sync : public QEvent { Sync() : QEvent(QEvent::User) {} Data data; - QQuickListModel *list; + QQmlListModel *list; }; QAtomicInt m_ref; - QQuickListModel *m_orig; - QQuickListModel *m_copy; + QQmlListModel *m_orig; + QQmlListModel *m_copy; QMutex mutex; QWaitCondition syncDone; }; QT_END_NAMESPACE -Q_DECLARE_METATYPE(QQuickListModelWorkerAgent::VariantRef) +Q_DECLARE_METATYPE(QQmlListModelWorkerAgent::VariantRef) QT_END_HEADER diff --git a/src/qml/qml/qquickworkerscript.cpp b/src/qml/qml/qquickworkerscript.cpp index f7559f1..b9b027f 100644 --- a/src/qml/qml/qquickworkerscript.cpp +++ b/src/qml/qml/qquickworkerscript.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include "qquickworkerscript_p.h" -#include "qquicklistmodel_p.h" -#include "qquicklistmodelworkeragent_p.h" +#include "qqmllistmodel_p.h" +#include "qqmllistmodelworkeragent_p.h" #include "qqmlengine_p.h" #include "qqmlexpression_p.h" @@ -484,7 +484,7 @@ QQuickWorkerScriptEngine::~QQuickWorkerScriptEngine() //We have to force to cleanup the main thread's event queue here //to make sure the main GUI release all pending locks/wait conditions which - //some worker script/agent are waiting for (QQuickListModelWorkerAgent::sync() for example). + //some worker script/agent are waiting for (QQmlListModelWorkerAgent::sync() for example). while (!isFinished()) { // We can't simply wait here, because the worker thread will not terminate // until the main thread processes the last data event it generates diff --git a/src/qml/qml/v8/qv8worker.cpp b/src/qml/qml/v8/qv8worker.cpp index bf3379b..9556e14 100644 --- a/src/qml/qml/v8/qv8worker.cpp +++ b/src/qml/qml/v8/qv8worker.cpp @@ -41,8 +41,8 @@ #include "qv8worker_p.h" -#include -#include +#include +#include QT_BEGIN_NAMESPACE @@ -242,9 +242,9 @@ void QV8Worker::serialize(QByteArray &data, v8::Handle v, QV8Engine * } else if (engine->isQObject(v)) { // XXX TODO: Generalize passing objects between the main thread and worker scripts so // that others can trivially plug in their elements. - QQuickListModel *lm = qobject_cast(engine->toQObject(v)); + QQmlListModel *lm = qobject_cast(engine->toQObject(v)); if (lm && lm->agent()) { - QQuickListModelWorkerAgent *agent = lm->agent(); + QQmlListModelWorkerAgent *agent = lm->agent(); agent->addref(); push(data, valueheader(WorkerListModel)); push(data, (void *)agent); @@ -347,10 +347,10 @@ v8::Handle QV8Worker::deserialize(const char *&data, QV8Engine *engin case WorkerListModel: { void *ptr = popPtr(data); - QQuickListModelWorkerAgent *agent = (QQuickListModelWorkerAgent *)ptr; + QQmlListModelWorkerAgent *agent = (QQmlListModelWorkerAgent *)ptr; v8::Handle rv = engine->newQObject(agent); if (rv->IsObject()) { - QQuickListModelWorkerAgent::VariantRef ref(agent); + QQmlListModelWorkerAgent::VariantRef ref(agent); QVariant var = qVariantFromValue(ref); rv->ToObject()->SetHiddenValue(v8::String::New("qml::ref"), engine->fromVariant(var)); } diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro index b77effe..5d62b91 100644 --- a/tests/auto/qml/qml.pro +++ b/tests/auto/qml/qml.pro @@ -45,8 +45,8 @@ PRIVATETESTS += \ qquickchangeset \ qqmlconnections \ qquicklistcompositor \ - qquicklistmodel \ - qquicklistmodelworkerscript \ + qqmllistmodel \ + qqmllistmodelworkerscript \ qquickworkerscript \ qqmlbundle \ qrcqml \ diff --git a/tests/auto/qml/qquicklistmodel/data/enumerate.qml b/tests/auto/qml/qqmllistmodel/data/enumerate.qml similarity index 100% rename from tests/auto/qml/qquicklistmodel/data/enumerate.qml rename to tests/auto/qml/qqmllistmodel/data/enumerate.qml diff --git a/tests/auto/qml/qquicklistmodel/data/multipleroles.qml b/tests/auto/qml/qqmllistmodel/data/multipleroles.qml similarity index 100% rename from tests/auto/qml/qquicklistmodel/data/multipleroles.qml rename to tests/auto/qml/qqmllistmodel/data/multipleroles.qml diff --git a/tests/auto/qml/qquicklistmodel/data/setmodelcachelist.qml b/tests/auto/qml/qqmllistmodel/data/setmodelcachelist.qml similarity index 100% rename from tests/auto/qml/qquicklistmodel/data/setmodelcachelist.qml rename to tests/auto/qml/qqmllistmodel/data/setmodelcachelist.qml diff --git a/tests/auto/qml/qquicklistmodel/data/signalhandlers.qml b/tests/auto/qml/qqmllistmodel/data/signalhandlers.qml similarity index 100% rename from tests/auto/qml/qquicklistmodel/data/signalhandlers.qml rename to tests/auto/qml/qqmllistmodel/data/signalhandlers.qml diff --git a/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro b/tests/auto/qml/qqmllistmodel/qqmllistmodel.pro similarity index 79% rename from tests/auto/qml/qquicklistmodel/qquicklistmodel.pro rename to tests/auto/qml/qqmllistmodel/qqmllistmodel.pro index e2b88cc..ef044f1 100644 --- a/tests/auto/qml/qquicklistmodel/qquicklistmodel.pro +++ b/tests/auto/qml/qqmllistmodel/qqmllistmodel.pro @@ -1,8 +1,8 @@ CONFIG += testcase -TARGET = tst_qquicklistmodel +TARGET = tst_qqmllistmodel macx:CONFIG -= app_bundle -SOURCES += tst_qquicklistmodel.cpp +SOURCES += tst_qqmllistmodel.cpp include (../../shared/util.pri) diff --git a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp similarity index 95% rename from tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp rename to tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp index 8deaae9..22229fe 100644 --- a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp +++ b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include @@ -82,17 +82,17 @@ static bool isValidErrorMessage(const QString &msg, bool dynamicRoleTest) return valid; } -class tst_qquicklistmodel : public QQmlDataTest +class tst_qqmllistmodel : public QQmlDataTest { Q_OBJECT public: - tst_qquicklistmodel() + tst_qqmllistmodel() { qRegisterMetaType >(); } private: - int roleFromName(const QQuickListModel *model, const QString &roleName); + int roleFromName(const QQmlListModel *model, const QString &roleName); static bool compareVariantList(const QVariantList &testList, QVariant object); @@ -132,11 +132,11 @@ private slots: void datetime_data(); }; -bool tst_qquicklistmodel::compareVariantList(const QVariantList &testList, QVariant object) +bool tst_qqmllistmodel::compareVariantList(const QVariantList &testList, QVariant object) { bool allOk = true; - QQuickListModel *model = qobject_cast(object.value()); + QQmlListModel *model = qobject_cast(object.value()); if (model == 0) return false; @@ -178,12 +178,12 @@ bool tst_qquicklistmodel::compareVariantList(const QVariantList &testList, QVari return allOk; } -int tst_qquicklistmodel::roleFromName(const QQuickListModel *model, const QString &roleName) +int tst_qqmllistmodel::roleFromName(const QQmlListModel *model, const QString &roleName) { return model->roleNames().key(roleName.toUtf8(), -1); } -void tst_qquicklistmodel::static_types_data() +void tst_qqmllistmodel::static_types_data() { QTest::addColumn("qml"); QTest::addColumn("value"); @@ -240,7 +240,7 @@ void tst_qquicklistmodel::static_types_data() << QString(": Can't assign to existing role 'foo' of different type [List -> Number]"); } -void tst_qquicklistmodel::static_types() +void tst_qqmllistmodel::static_types() { QFETCH(QString, qml); QFETCH(QVariant, value); @@ -272,7 +272,7 @@ void tst_qquicklistmodel::static_types() delete obj; } -void tst_qquicklistmodel::static_i18n_data() +void tst_qqmllistmodel::static_i18n_data() { QTest::addColumn("qml"); QTest::addColumn("value"); @@ -309,7 +309,7 @@ void tst_qquicklistmodel::static_i18n_data() << QString("ListElement: improperly specified QT_TRID_NOOP"); } -void tst_qquicklistmodel::static_i18n() +void tst_qqmllistmodel::static_i18n() { QFETCH(QString, qml); QFETCH(QVariant, value); @@ -341,7 +341,7 @@ void tst_qquicklistmodel::static_i18n() delete obj; } -void tst_qquicklistmodel::static_nestedElements() +void tst_qqmllistmodel::static_nestedElements() { QFETCH(int, elementCount); @@ -379,7 +379,7 @@ void tst_qquicklistmodel::static_nestedElements() delete obj; } -void tst_qquicklistmodel::static_nestedElements_data() +void tst_qqmllistmodel::static_nestedElements_data() { QTest::addColumn("elementCount"); @@ -389,7 +389,7 @@ void tst_qquicklistmodel::static_nestedElements_data() QTest::newRow("many items") << 5; } -void tst_qquicklistmodel::dynamic_data() +void tst_qqmllistmodel::dynamic_data() { QTest::addColumn("script"); QTest::addColumn("result"); @@ -530,7 +530,7 @@ void tst_qquicklistmodel::dynamic_data() } } -void tst_qquicklistmodel::dynamic() +void tst_qqmllistmodel::dynamic() { QFETCH(QString, script); QFETCH(int, result); @@ -539,7 +539,7 @@ void tst_qquicklistmodel::dynamic() QQuickItem dummyItem0, dummyItem1; QQmlEngine engine; - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine::setContextForObject(&model,engine.rootContext()); engine.rootContext()->setContextObject(&model); @@ -561,7 +561,7 @@ void tst_qquicklistmodel::dynamic() QVERIFY(spyCount.count() > 0); } -void tst_qquicklistmodel::enumerate() +void tst_qqmllistmodel::enumerate() { QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("enumerate.qml")); @@ -602,7 +602,7 @@ void tst_qquicklistmodel::enumerate() delete item; } -void tst_qquicklistmodel::error_data() +void tst_qqmllistmodel::error_data() { QTest::addColumn("qml"); QTest::addColumn("error"); @@ -652,7 +652,7 @@ void tst_qquicklistmodel::error_data() << "Foo.ListElement - Foo is not a namespace"; } -void tst_qquicklistmodel::error() +void tst_qqmllistmodel::error() { QFETCH(QString, qml); QFETCH(QString, error); @@ -671,7 +671,7 @@ void tst_qquicklistmodel::error() } } -void tst_qquicklistmodel::syncError() +void tst_qqmllistmodel::syncError() { QString qml = "import QtQuick 2.0\nListModel { id: lm; Component.onCompleted: lm.sync() }"; QString error = "file:dummy.qml:2:1: QML ListModel: List sync() can only be called from a WorkerScript"; @@ -689,7 +689,7 @@ void tst_qquicklistmodel::syncError() /* Test model changes from set() are available to the view */ -void tst_qquicklistmodel::set_data() +void tst_qqmllistmodel::set_data() { QTest::addColumn("dynamicRoles"); @@ -697,12 +697,12 @@ void tst_qquicklistmodel::set_data() QTest::newRow("dynamicRoles") << true; } -void tst_qquicklistmodel::set() +void tst_qqmllistmodel::set() { QFETCH(bool, dynamicRoles); QQmlEngine engine; - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine::setContextForObject(&model,engine.rootContext()); engine.rootContext()->setContextProperty("model", &model); @@ -727,7 +727,7 @@ void tst_qquicklistmodel::set() /* Test model changes on values returned by get() are available to the view */ -void tst_qquicklistmodel::get() +void tst_qqmllistmodel::get() { QFETCH(QString, expression); QFETCH(int, index); @@ -740,7 +740,7 @@ void tst_qquicklistmodel::get() component.setData( "import QtQuick 2.0\n" "ListModel {}\n", QUrl()); - QQuickListModel *model = qobject_cast(component.create()); + QQmlListModel *model = qobject_cast(component.create()); model->setDynamicRoles(dynamicRoles); engine.rootContext()->setContextProperty("model", model); @@ -775,7 +775,7 @@ void tst_qquicklistmodel::get() delete model; } -void tst_qquicklistmodel::get_data() +void tst_qqmllistmodel::get_data() { QTest::addColumn("expression"); QTest::addColumn("index"); @@ -802,7 +802,7 @@ void tst_qquicklistmodel::get_data() /* Test that the tests run in get() also work for nested list data */ -void tst_qquicklistmodel::get_nested() +void tst_qqmllistmodel::get_nested() { QFETCH(QString, expression); QFETCH(int, index); @@ -818,10 +818,10 @@ void tst_qquicklistmodel::get_nested() component.setData( "import QtQuick 2.0\n" "ListModel {}", QUrl()); - QQuickListModel *model = qobject_cast(component.create()); + QQmlListModel *model = qobject_cast(component.create()); model->setDynamicRoles(dynamicRoles); QVERIFY(component.errorString().isEmpty()); - QQuickListModel *childModel; + QQmlListModel *childModel; engine.rootContext()->setContextProperty("model", model); RUNEXPR("model.append({ listRoleA: [\n" @@ -872,7 +872,7 @@ void tst_qquicklistmodel::get_nested() int outerListRole = roleFromName(model, outerListRoleName); QVERIFY(outerListRole >= 0); - childModel = qobject_cast(model->data(outerListIndex, outerListRole).value()); + childModel = qobject_cast(model->data(outerListIndex, outerListRole).value()); QVERIFY(childModel); QString extendedExpression = QString("get(%1).%2.%3").arg(outerListIndex).arg(outerListRoleName).arg(expression); @@ -900,20 +900,20 @@ void tst_qquicklistmodel::get_nested() delete model; } -void tst_qquicklistmodel::get_nested_data() +void tst_qqmllistmodel::get_nested_data() { get_data(); } //QTBUG-13754 -void tst_qquicklistmodel::crash_model_with_multiple_roles() +void tst_qqmllistmodel::crash_model_with_multiple_roles() { QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("multipleroles.qml")); QObject *rootItem = component.create(); QVERIFY(component.errorString().isEmpty()); QVERIFY(rootItem != 0); - QQuickListModel *model = rootItem->findChild("listModel"); + QQmlListModel *model = rootItem->findChild("listModel"); QVERIFY(model != 0); // used to cause a crash @@ -923,7 +923,7 @@ void tst_qquicklistmodel::crash_model_with_multiple_roles() } //QTBUG-15190 -void tst_qquicklistmodel::set_model_cache() +void tst_qqmllistmodel::set_model_cache() { QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("setmodelcachelist.qml")); @@ -935,7 +935,7 @@ void tst_qquicklistmodel::set_model_cache() delete model; } -void tst_qquicklistmodel::property_changes() +void tst_qqmllistmodel::property_changes() { QFETCH(QString, script_setup); QFETCH(QString, script_change); @@ -946,7 +946,7 @@ void tst_qquicklistmodel::property_changes() QFETCH(bool, dynamicRoles); QQmlEngine engine; - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine::setContextForObject(&model, engine.rootContext()); engine.rootContext()->setContextObject(&model); @@ -993,7 +993,7 @@ void tst_qquicklistmodel::property_changes() delete connectionsObject; } -void tst_qquicklistmodel::property_changes_data() +void tst_qqmllistmodel::property_changes_data() { QTest::addColumn("script_setup"); QTest::addColumn("script_change"); @@ -1066,7 +1066,7 @@ void tst_qquicklistmodel::property_changes_data() } } -void tst_qquicklistmodel::clear_data() +void tst_qqmllistmodel::clear_data() { QTest::addColumn("dynamicRoles"); @@ -1074,12 +1074,12 @@ void tst_qquicklistmodel::clear_data() QTest::newRow("dynamicRoles") << true; } -void tst_qquicklistmodel::clear() +void tst_qqmllistmodel::clear() { QFETCH(bool, dynamicRoles); QQmlEngine engine; - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine::setContextForObject(&model, engine.rootContext()); engine.rootContext()->setContextProperty("model", &model); @@ -1111,7 +1111,7 @@ void tst_qquicklistmodel::clear() QCOMPARE(roleNames[2], QByteArray("propertyC")); } -void tst_qquicklistmodel::signal_handlers_data() +void tst_qqmllistmodel::signal_handlers_data() { QTest::addColumn("dynamicRoles"); @@ -1119,14 +1119,14 @@ void tst_qquicklistmodel::signal_handlers_data() QTest::newRow("dynamicRoles") << true; } -void tst_qquicklistmodel::signal_handlers() +void tst_qqmllistmodel::signal_handlers() { QFETCH(bool, dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("signalhandlers.qml")); QObject *model = component.create(); - QQuickListModel *lm = qobject_cast(model); + QQmlListModel *lm = qobject_cast(model); QVERIFY(lm != 0); lm->setDynamicRoles(dynamicRoles); QVERIFY2(component.errorString().isEmpty(), QTest::toString(component.errorString())); @@ -1136,7 +1136,7 @@ void tst_qquicklistmodel::signal_handlers() delete model; } -void tst_qquicklistmodel::role_mode_data() +void tst_qqmllistmodel::role_mode_data() { QTest::addColumn("script"); QTest::addColumn("result"); @@ -1150,14 +1150,14 @@ void tst_qquicklistmodel::role_mode_data() QTest::newRow("enableDynamic2") << "{dynamicRoles=true;append({'a':1});dynamicRoles=false;dynamicRoles}" << 1 << ": QML ListModel: unable to enable static roles as this model is not empty!"; } -void tst_qquicklistmodel::role_mode() +void tst_qqmllistmodel::role_mode() { QFETCH(QString, script); QFETCH(int, result); QFETCH(QString, warning); QQmlEngine engine; - QQuickListModel model; + QQmlListModel model; QQmlEngine::setContextForObject(&model,engine.rootContext()); engine.rootContext()->setContextObject(&model); QQmlExpression e(engine.rootContext(), &model, script); @@ -1171,10 +1171,10 @@ void tst_qquicklistmodel::role_mode() QCOMPARE(actual,result); } -void tst_qquicklistmodel::string_to_list_crash() +void tst_qqmllistmodel::string_to_list_crash() { QQmlEngine engine; - QQuickListModel model; + QQmlListModel model; QQmlEngine::setContextForObject(&model,engine.rootContext()); engine.rootContext()->setContextObject(&model); QString script = QLatin1String("{append({'a':'data'});get(0).a = [{'x':123}]}"); @@ -1184,7 +1184,7 @@ void tst_qquicklistmodel::string_to_list_crash() e.evaluate(); } -void tst_qquicklistmodel::empty_element_warning_data() +void tst_qqmllistmodel::empty_element_warning_data() { QTest::addColumn("qml"); QTest::addColumn("warning"); @@ -1198,7 +1198,7 @@ void tst_qquicklistmodel::empty_element_warning_data() QTest::newRow("role3") << "import QtQuick 2.0\nListModel { ListElement {} ListElement {a:1} ListElement {b:2} }" << false; } -void tst_qquicklistmodel::empty_element_warning() +void tst_qqmllistmodel::empty_element_warning() { QFETCH(QString, qml); QFETCH(bool, warning); @@ -1219,7 +1219,7 @@ void tst_qquicklistmodel::empty_element_warning() delete obj; } -void tst_qquicklistmodel::datetime_data() +void tst_qqmllistmodel::datetime_data() { QTest::addColumn("qml"); QTest::addColumn("expected"); @@ -1234,13 +1234,13 @@ void tst_qquicklistmodel::datetime_data() QTest::newRow("dt3") << "{append({'date':dt0});get(0).date=undefined;get(0).date}" << dt; } -void tst_qquicklistmodel::datetime() +void tst_qqmllistmodel::datetime() { QFETCH(QString, qml); QFETCH(QDateTime, expected); QQmlEngine engine; - QQuickListModel model; + QQmlListModel model; QQmlEngine::setContextForObject(&model,engine.rootContext()); QDateTime dt0(QDate(1900, 1, 2), QTime( 8, 14)); QDateTime dt1(QDate(2000, 11, 22), QTime(10, 45)); @@ -1253,6 +1253,6 @@ void tst_qquicklistmodel::datetime() QVERIFY(expected == dtResult); } -QTEST_MAIN(tst_qquicklistmodel) +QTEST_MAIN(tst_qqmllistmodel) -#include "tst_qquicklistmodel.moc" +#include "tst_qqmllistmodel.moc" diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/model.qml b/tests/auto/qml/qqmllistmodelworkerscript/data/model.qml similarity index 100% rename from tests/auto/qml/qquicklistmodelworkerscript/data/model.qml rename to tests/auto/qml/qqmllistmodelworkerscript/data/model.qml diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/script.js b/tests/auto/qml/qqmllistmodelworkerscript/data/script.js similarity index 100% rename from tests/auto/qml/qquicklistmodelworkerscript/data/script.js rename to tests/auto/qml/qqmllistmodelworkerscript/data/script.js diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/workerremoveelement.js b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.js similarity index 100% rename from tests/auto/qml/qquicklistmodelworkerscript/data/workerremoveelement.js rename to tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.js diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/workerremoveelement.qml b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.qml similarity index 100% rename from tests/auto/qml/qquicklistmodelworkerscript/data/workerremoveelement.qml rename to tests/auto/qml/qqmllistmodelworkerscript/data/workerremoveelement.qml diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/workerremovelist.js b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.js similarity index 100% rename from tests/auto/qml/qquicklistmodelworkerscript/data/workerremovelist.js rename to tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.js diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/workerremovelist.qml b/tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.qml similarity index 100% rename from tests/auto/qml/qquicklistmodelworkerscript/data/workerremovelist.qml rename to tests/auto/qml/qqmllistmodelworkerscript/data/workerremovelist.qml diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/workersync.js b/tests/auto/qml/qqmllistmodelworkerscript/data/workersync.js similarity index 100% rename from tests/auto/qml/qquicklistmodelworkerscript/data/workersync.js rename to tests/auto/qml/qqmllistmodelworkerscript/data/workersync.js diff --git a/tests/auto/qml/qquicklistmodelworkerscript/data/workersync.qml b/tests/auto/qml/qqmllistmodelworkerscript/data/workersync.qml similarity index 100% rename from tests/auto/qml/qquicklistmodelworkerscript/data/workersync.qml rename to tests/auto/qml/qqmllistmodelworkerscript/data/workersync.qml diff --git a/tests/auto/qml/qquicklistmodelworkerscript/qquicklistmodelworkerscript.pro b/tests/auto/qml/qqmllistmodelworkerscript/qqmllistmodelworkerscript.pro similarity index 71% rename from tests/auto/qml/qquicklistmodelworkerscript/qquicklistmodelworkerscript.pro rename to tests/auto/qml/qqmllistmodelworkerscript/qqmllistmodelworkerscript.pro index 0787572..14f0604 100644 --- a/tests/auto/qml/qquicklistmodelworkerscript/qquicklistmodelworkerscript.pro +++ b/tests/auto/qml/qqmllistmodelworkerscript/qqmllistmodelworkerscript.pro @@ -1,8 +1,8 @@ CONFIG += testcase -TARGET = tst_qquicklistmodelworkerscript +TARGET = tst_qqmllistmodelworkerscript macx:CONFIG -= app_bundle -SOURCES += tst_qquicklistmodelworkerscript.cpp +SOURCES += tst_qqmllistmodelworkerscript.cpp include (../../shared/util.pri) diff --git a/tests/auto/qml/qquicklistmodelworkerscript/tst_qquicklistmodelworkerscript.cpp b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp similarity index 94% rename from tests/auto/qml/qquicklistmodelworkerscript/tst_qquicklistmodelworkerscript.cpp rename to tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp index 8d5f34c..a0edfb6 100644 --- a/tests/auto/qml/qquicklistmodelworkerscript/tst_qquicklistmodelworkerscript.cpp +++ b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include @@ -81,18 +81,18 @@ static bool isValidErrorMessage(const QString &msg, bool dynamicRoleTest) return valid; } -class tst_qquicklistmodelworkerscript : public QQmlDataTest +class tst_qqmllistmodelworkerscript : public QQmlDataTest { Q_OBJECT public: - tst_qquicklistmodelworkerscript() + tst_qqmllistmodelworkerscript() { qRegisterMetaType >(); } private: - int roleFromName(const QQuickListModel *model, const QString &roleName); - QQuickItem *createWorkerTest(QQmlEngine *eng, QQmlComponent *component, QQuickListModel *model); + int roleFromName(const QQmlListModel *model, const QString &roleName); + QQuickItem *createWorkerTest(QQmlEngine *eng, QQmlComponent *component, QQmlListModel *model); void waitForWorker(QQuickItem *item); static bool compareVariantList(const QVariantList &testList, QVariant object); @@ -119,11 +119,11 @@ private slots: void dynamic_role(); }; -bool tst_qquicklistmodelworkerscript::compareVariantList(const QVariantList &testList, QVariant object) +bool tst_qqmllistmodelworkerscript::compareVariantList(const QVariantList &testList, QVariant object) { bool allOk = true; - QQuickListModel *model = qobject_cast(object.value()); + QQmlListModel *model = qobject_cast(object.value()); if (model == 0) return false; @@ -165,12 +165,12 @@ bool tst_qquicklistmodelworkerscript::compareVariantList(const QVariantList &tes return allOk; } -int tst_qquicklistmodelworkerscript::roleFromName(const QQuickListModel *model, const QString &roleName) +int tst_qqmllistmodelworkerscript::roleFromName(const QQmlListModel *model, const QString &roleName) { return model->roleNames().key(roleName.toUtf8(), -1); } -QQuickItem *tst_qquicklistmodelworkerscript::createWorkerTest(QQmlEngine *eng, QQmlComponent *component, QQuickListModel *model) +QQuickItem *tst_qqmllistmodelworkerscript::createWorkerTest(QQmlEngine *eng, QQmlComponent *component, QQmlListModel *model) { QQuickItem *item = qobject_cast(component->create()); QQmlEngine::setContextForObject(model, eng->rootContext()); @@ -179,7 +179,7 @@ QQuickItem *tst_qquicklistmodelworkerscript::createWorkerTest(QQmlEngine *eng, Q return item; } -void tst_qquicklistmodelworkerscript::waitForWorker(QQuickItem *item) +void tst_qqmllistmodelworkerscript::waitForWorker(QQuickItem *item) { QQmlProperty prop(item, "done"); QVERIFY(prop.isValid()); @@ -198,7 +198,7 @@ void tst_qquicklistmodelworkerscript::waitForWorker(QQuickItem *item) QVERIFY(prop.read().toBool()); } -void tst_qquicklistmodelworkerscript::dynamic_data() +void tst_qqmllistmodelworkerscript::dynamic_data() { QTest::addColumn("script"); QTest::addColumn("result"); @@ -339,12 +339,12 @@ void tst_qquicklistmodelworkerscript::dynamic_data() } } -void tst_qquicklistmodelworkerscript::dynamic_worker_data() +void tst_qqmllistmodelworkerscript::dynamic_worker_data() { dynamic_data(); } -void tst_qquicklistmodelworkerscript::dynamic_worker() +void tst_qqmllistmodelworkerscript::dynamic_worker() { QFETCH(QString, script); QFETCH(int, result); @@ -357,7 +357,7 @@ void tst_qquicklistmodelworkerscript::dynamic_worker() // This is same as dynamic() except it applies the test to a ListModel called // from a WorkerScript. - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("model.qml")); @@ -389,12 +389,12 @@ void tst_qquicklistmodelworkerscript::dynamic_worker() qApp->processEvents(); } -void tst_qquicklistmodelworkerscript::dynamic_worker_sync_data() +void tst_qqmllistmodelworkerscript::dynamic_worker_sync_data() { dynamic_data(); } -void tst_qquicklistmodelworkerscript::dynamic_worker_sync() +void tst_qqmllistmodelworkerscript::dynamic_worker_sync() { QFETCH(QString, script); QFETCH(int, result); @@ -408,7 +408,7 @@ void tst_qquicklistmodelworkerscript::dynamic_worker_sync() // from the worker script, calls sync(), and tests the changes are reflected in the // list in the main thread - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("model.qml")); @@ -439,7 +439,7 @@ void tst_qquicklistmodelworkerscript::dynamic_worker_sync() qApp->processEvents(); } -void tst_qquicklistmodelworkerscript::get_data() +void tst_qqmllistmodelworkerscript::get_data() { QTest::addColumn("expression"); QTest::addColumn("index"); @@ -463,7 +463,7 @@ void tst_qquicklistmodelworkerscript::get_data() } } -void tst_qquicklistmodelworkerscript::get_worker() +void tst_qqmllistmodelworkerscript::get_worker() { QFETCH(QString, expression); QFETCH(int, index); @@ -471,7 +471,7 @@ void tst_qquicklistmodelworkerscript::get_worker() QFETCH(QVariant, roleValue); QFETCH(bool, dynamicRoles); - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("model.qml")); @@ -513,12 +513,12 @@ void tst_qquicklistmodelworkerscript::get_worker() delete item; } -void tst_qquicklistmodelworkerscript::get_worker_data() +void tst_qqmllistmodelworkerscript::get_worker_data() { get_data(); } -void tst_qquicklistmodelworkerscript::property_changes_data() +void tst_qqmllistmodelworkerscript::property_changes_data() { QTest::addColumn("script_setup"); QTest::addColumn("script_change"); @@ -591,7 +591,7 @@ void tst_qquicklistmodelworkerscript::property_changes_data() } } -void tst_qquicklistmodelworkerscript::property_changes_worker() +void tst_qqmllistmodelworkerscript::property_changes_worker() { QFETCH(QString, script_setup); QFETCH(QString, script_change); @@ -600,7 +600,7 @@ void tst_qquicklistmodelworkerscript::property_changes_worker() QFETCH(bool, itemsChanged); QFETCH(bool, dynamicRoles); - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("model.qml")); @@ -631,12 +631,12 @@ void tst_qquicklistmodelworkerscript::property_changes_worker() qApp->processEvents(); } -void tst_qquicklistmodelworkerscript::property_changes_worker_data() +void tst_qqmllistmodelworkerscript::property_changes_worker_data() { property_changes_data(); } -void tst_qquicklistmodelworkerscript::worker_sync_data() +void tst_qqmllistmodelworkerscript::worker_sync_data() { QTest::addColumn("dynamicRoles"); @@ -644,11 +644,11 @@ void tst_qquicklistmodelworkerscript::worker_sync_data() QTest::newRow("dynamicRoles") << true; } -void tst_qquicklistmodelworkerscript::worker_sync() +void tst_qqmllistmodelworkerscript::worker_sync() { QFETCH(bool, dynamicRoles); - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("workersync.qml")); @@ -661,7 +661,7 @@ void tst_qquicklistmodelworkerscript::worker_sync() QVERIFY(model.count() == 2); QVariant childData = model.data(0, 0); - QQuickListModel *childModel = qobject_cast(childData.value()); + QQmlListModel *childModel = qobject_cast(childData.value()); QVERIFY(childModel); QVERIFY(childModel->count() == 1); @@ -704,16 +704,16 @@ void tst_qquicklistmodelworkerscript::worker_sync() qApp->processEvents(); } -void tst_qquicklistmodelworkerscript::worker_remove_element_data() +void tst_qqmllistmodelworkerscript::worker_remove_element_data() { worker_sync_data(); } -void tst_qquicklistmodelworkerscript::worker_remove_element() +void tst_qqmllistmodelworkerscript::worker_remove_element() { QFETCH(bool, dynamicRoles); - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("workerremoveelement.qml")); @@ -746,7 +746,7 @@ void tst_qquicklistmodelworkerscript::worker_remove_element() { //don't crash if model was deleted earlier - QQuickListModel* model = new QQuickListModel; + QQmlListModel* model = new QQmlListModel; model->setDynamicRoles(dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("workerremoveelement.qml")); @@ -767,16 +767,16 @@ void tst_qquicklistmodelworkerscript::worker_remove_element() } } -void tst_qquicklistmodelworkerscript::worker_remove_list_data() +void tst_qqmllistmodelworkerscript::worker_remove_list_data() { worker_sync_data(); } -void tst_qquicklistmodelworkerscript::worker_remove_list() +void tst_qqmllistmodelworkerscript::worker_remove_list() { QFETCH(bool, dynamicRoles); - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(dynamicRoles); QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("workerremovelist.qml")); @@ -808,7 +808,7 @@ void tst_qquicklistmodelworkerscript::worker_remove_list() qApp->processEvents(); } -void tst_qquicklistmodelworkerscript::dynamic_role_data() +void tst_qqmllistmodelworkerscript::dynamic_role_data() { QTest::addColumn("preamble"); QTest::addColumn("script"); @@ -817,13 +817,13 @@ void tst_qquicklistmodelworkerscript::dynamic_role_data() QTest::newRow("sync1") << "{append({'a':[{'b':1},{'b':2}]})}" << "{get(0).a = 'string';count}" << 1; } -void tst_qquicklistmodelworkerscript::dynamic_role() +void tst_qqmllistmodelworkerscript::dynamic_role() { QFETCH(QString, preamble); QFETCH(QString, script); QFETCH(int, result); - QQuickListModel model; + QQmlListModel model; model.setDynamicRoles(true); QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("model.qml")); @@ -854,6 +854,6 @@ void tst_qquicklistmodelworkerscript::dynamic_role() qApp->processEvents(); } -QTEST_MAIN(tst_qquicklistmodelworkerscript) +QTEST_MAIN(tst_qqmllistmodelworkerscript) -#include "tst_qquicklistmodelworkerscript.moc" +#include "tst_qqmllistmodelworkerscript.moc" diff --git a/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/AutoTestQmlPluginType/qmldir b/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/AutoTestQmlPluginType/qmldir deleted file mode 100644 index 0a8b5d4..0000000 --- a/tests/auto/qml/qqmlmoduleplugin/imports/com/nokia/AutoTestQmlPluginType/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin plugin diff --git a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp index 46e0c9e..a2bf06c 100644 --- a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp +++ b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp @@ -145,7 +145,7 @@ void tst_QQuickWorkerScript::messaging_data() void tst_QQuickWorkerScript::messaging_sendQObjectList() { - // Not allowed to send QObjects other than QQuickListModelWorkerAgent + // Not allowed to send QObjects other than QQmlListModelWorkerAgent // instances. If objects are sent in a list, they will be sent as 'undefined' // js values. diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index 93ffbca..aee4e0d 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include "../../shared/util.h" #include "../shared/viewtestutil.h" #include "../shared/visualtestutil.h" @@ -2435,7 +2435,7 @@ void tst_QQuickGridView::modelChanges() QQuickGridView *gridView = window->rootObject()->findChild("gridView"); QTRY_VERIFY(gridView); - QQuickListModel *alternateModel = window->rootObject()->findChild("alternateModel"); + QQmlListModel *alternateModel = window->rootObject()->findChild("alternateModel"); QTRY_VERIFY(alternateModel); QVariant modelVariant = QVariant::fromValue(alternateModel); QSignalSpy modelSpy(gridView, SIGNAL(modelChanged())); diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 9fad01e..a1b2536 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include "../../shared/util.h" #include "../shared/viewtestutil.h" #include "../shared/visualtestutil.h" @@ -3257,7 +3257,7 @@ void tst_QQuickListView::modelChanges() QQuickListView *listView = window->rootObject()->findChild("listView"); QTRY_VERIFY(listView); - QQuickListModel *alternateModel = window->rootObject()->findChild("alternateModel"); + QQmlListModel *alternateModel = window->rootObject()->findChild("alternateModel"); QTRY_VERIFY(alternateModel); QVariant modelVariant = QVariant::fromValue(alternateModel); QSignalSpy modelSpy(listView, SIGNAL(modelChanged())); diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index 65fef9a..f52939e 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #include #include @@ -1269,7 +1269,7 @@ void tst_QQuickPathView::modelChanges() pathView->setCurrentIndex(3); QTRY_COMPARE(pathView->offset(), 6.0); - QQuickListModel *alternateModel = window->rootObject()->findChild("alternateModel"); + QQmlListModel *alternateModel = window->rootObject()->findChild("alternateModel"); QVERIFY(alternateModel); QVariant modelVariant = QVariant::fromValue(alternateModel); QSignalSpy modelSpy(pathView, SIGNAL(modelChanged())); -- 2.7.4