summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/debugger/debugger.pri6
-rw-r--r--src/declarative/debugger/qdeclarativedebug_p.h1
-rw-r--r--src/declarative/debugger/qdeclarativedebughelper.cpp (renamed from src/declarative/qml/qdeclarativeclassfactory_p.h)40
-rw-r--r--src/declarative/debugger/qdeclarativedebughelper_p.h (renamed from src/declarative/qml/qdeclarativeclassfactory.cpp)23
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp10
-rw-r--r--src/declarative/qml/qdeclarative.h2
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp4
-rw-r--r--src/declarative/qml/qdeclarativeengine_p.h1
-rw-r--r--src/declarative/qml/qdeclarativeimport.cpp1
-rw-r--r--src/declarative/qml/qdeclarativetypenotavailable.cpp4
-rw-r--r--src/declarative/qml/qml.pri2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp9
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp42
-rw-r--r--src/declarative/util/qdeclarativelistmodel_p.h1
-rw-r--r--src/declarative/util/qdeclarativelistmodel_p_p.h3
-rw-r--r--src/declarative/util/qdeclarativetimer_p.h2
-rw-r--r--src/declarative/util/qdeclarativeview.cpp2
-rw-r--r--src/declarative/util/qlistmodelinterface_p.h3
19 files changed, 68 insertions, 90 deletions
diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri
index 33d0843..25f7687 100644
--- a/src/declarative/debugger/debugger.pri
+++ b/src/declarative/debugger/debugger.pri
@@ -6,7 +6,8 @@ SOURCES += \
$$PWD/qdeclarativedebugservice.cpp \
$$PWD/qdeclarativedebugclient.cpp \
$$PWD/qdeclarativedebug.cpp \
- $$PWD/qdeclarativedebugtrace.cpp
+ $$PWD/qdeclarativedebugtrace.cpp \
+ $$PWD/qdeclarativedebughelper.cpp
HEADERS += \
$$PWD/qdeclarativedebuggerstatus_p.h \
@@ -14,4 +15,5 @@ HEADERS += \
$$PWD/qdeclarativedebugservice_p.h \
$$PWD/qdeclarativedebugclient_p.h \
$$PWD/qdeclarativedebug_p.h \
- $$PWD/qdeclarativedebugtrace_p.h
+ $$PWD/qdeclarativedebugtrace_p.h \
+ $$PWD/qdeclarativedebughelper_p.h
diff --git a/src/declarative/debugger/qdeclarativedebug_p.h b/src/declarative/debugger/qdeclarativedebug_p.h
index f0fc488..2b1a115 100644
--- a/src/declarative/debugger/qdeclarativedebug_p.h
+++ b/src/declarative/debugger/qdeclarativedebug_p.h
@@ -365,7 +365,6 @@ private:
int m_queryId;
QVariant m_expr;
QVariant m_result;
-
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeclassfactory_p.h b/src/declarative/debugger/qdeclarativedebughelper.cpp
index 9f4a3de..207ad2b 100644
--- a/src/declarative/qml/qdeclarativeclassfactory_p.h
+++ b/src/declarative/debugger/qdeclarativedebughelper.cpp
@@ -39,36 +39,28 @@
**
****************************************************************************/
-#ifndef QDECLARATIVECLASSFACTORY_P_H
-#define QDECLARATIVECLASSFACTORY_P_H
+#include <QtScript/QScriptEngine>
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
+#include "private/qdeclarativedebughelper_p.h"
-#include <QtCore/qglobal.h>
+#include <QtCore/QAbstractAnimation>
+#include <QtScript/QScriptEngine>
+
+#include <private/qdeclarativeengine_p.h>
+#include <private/qabstractanimation_p.h>
QT_BEGIN_NAMESPACE
-class QDeclarativeEngine;
-class QByteArray;
-class QUrl;
-class QDeclarativeComponent;
+QScriptEngine *QDeclarativeDebugHelper::getScriptEngine(QDeclarativeEngine *engine)
+{
+ return QDeclarativeEnginePrivate::getScriptEngine(engine);
+}
-class QDeclarativeClassFactory
+void QDeclarativeDebugHelper::setAnimationSlowDownFactor(qreal factor)
{
-public:
- virtual ~QDeclarativeClassFactory();
- virtual QDeclarativeComponent *create(const QByteArray &, const QUrl& baseUrl, QDeclarativeEngine*) = 0;
-};
+ QUnifiedTimer *timer = QUnifiedTimer::instance();
+ timer->setSlowModeEnabled(factor != 1.0);
+ timer->setSlowdownFactor(factor);
+}
QT_END_NAMESPACE
-
-#endif // QDECLARATIVECLASSFACTORY_P_H
diff --git a/src/declarative/qml/qdeclarativeclassfactory.cpp b/src/declarative/debugger/qdeclarativedebughelper_p.h
index 798eacd..c9cb839 100644
--- a/src/declarative/qml/qdeclarativeclassfactory.cpp
+++ b/src/declarative/debugger/qdeclarativedebughelper_p.h
@@ -39,12 +39,29 @@
**
****************************************************************************/
-#include "private/qdeclarativeclassfactory_p.h"
+#ifndef QDECLARATIVEDEBUGHELPER_P_H
+#define QDECLARATIVEDEBUGHELPER_P_H
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QDeclarativeClassFactory::~QDeclarativeClassFactory()
+class QScriptEngine;
+class QDeclarativeEngine;
+
+// Helper methods to access private API through a stable interface
+// This is used in the qmljsdebugger library of QtCreator.
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper
{
-}
+public:
+ static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine);
+ static void setAnimationSlowDownFactor(qreal factor);
+};
QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QDECLARATIVEDEBUGHELPER_P_H
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
index f9ecc0a..15b91e5 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QDeclarativeBasePositionerPrivate;
-class Q_AUTOTEST_EXPORT QDeclarativeBasePositioner : public QDeclarativeItem
+class Q_DECLARATIVE_EXPORT QDeclarativeBasePositioner : public QDeclarativeItem
{
Q_OBJECT
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index a70886e..21d1ea7 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -621,7 +621,7 @@ QDeclarativeVisualDataModelParts::QDeclarativeVisualDataModelParts(QDeclarativeV
QDeclarativeVisualDataModelPrivate::QDeclarativeVisualDataModelPrivate(QDeclarativeContext *ctxt)
: m_listModelInterface(0), m_abstractItemModel(0), m_visualItemModel(0), m_delegate(0)
-, m_context(ctxt), m_parts(0), m_delegateDataType(0), m_metaDataCreated(false)
+, m_context(ctxt), m_modelDataPropId(-1), m_parts(0), m_delegateDataType(0), m_metaDataCreated(false)
, m_metaDataCacheable(false), m_delegateValidated(false), m_completePending(false), m_listAccessor(0)
{
}
@@ -1187,7 +1187,7 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count,
if (propId != -1) {
if (data->hasValue(propId)) {
if (d->m_listModelInterface) {
- data->setValue(propId, d->m_listModelInterface->data(idx, QList<int>() << role).value(role));
+ data->setValue(propId, d->m_listModelInterface->data(idx, role));
} else if (d->m_abstractItemModel) {
QModelIndex index = d->m_abstractItemModel->index(idx, 0, d->m_root);
data->setValue(propId, d->m_abstractItemModel->data(index, role));
@@ -1202,13 +1202,13 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count,
qmlInfo(this) << "Changing role not present in item: " << roleName;
}
}
- if (roles.count() == 1) {
+ if (d->m_roles.count() == 1) {
// Handle the modelData role we add if there is just one role.
int propId = data->modelDataPropertyId();
if (data->hasValue(propId)) {
- int role = roles.at(0);
+ int role = d->m_roles.at(0);
if (d->m_listModelInterface) {
- data->setValue(propId, d->m_listModelInterface->data(idx, QList<int>() << role).value(role));
+ data->setValue(propId, d->m_listModelInterface->data(idx, role));
} else if (d->m_abstractItemModel) {
QModelIndex index = d->m_abstractItemModel->index(idx, 0, d->m_root);
data->setValue(propId, d->m_abstractItemModel->data(index, role));
diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h
index 985ab72..f0c62f4 100644
--- a/src/declarative/qml/qdeclarative.h
+++ b/src/declarative/qml/qdeclarative.h
@@ -119,7 +119,7 @@ int qmlRegisterType()
return QDeclarativePrivate::qmlregister(QDeclarativePrivate::TypeRegistration, &type);
}
-int qmlRegisterTypeNotAvailable(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& message);
+int Q_AUTOTEST_EXPORT qmlRegisterTypeNotAvailable(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& message);
template<typename T>
int qmlRegisterUncreatableType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& reason)
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 06b1ed3..084fd38 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1783,7 +1783,9 @@ void QDeclarativeEnginePrivate::warning(QDeclarativeEnginePrivate *engine, const
/*!
\qmlmethod Qt::quit()
This function causes the QDeclarativeEngine::quit() signal to be emitted.
-Within the \l {QML Viewer}, this causes the launcher application to exit.
+Within the \l {QML Viewer}, this causes the launcher application to exit;
+to quit a C++ application when this method is called, connect the
+QDeclarativeEngine::quit() signal to the QCoreApplication::quit() slot.
*/
QScriptValue QDeclarativeEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptEngine *e)
diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h
index dc7315d..8539fbf 100644
--- a/src/declarative/qml/qdeclarativeengine_p.h
+++ b/src/declarative/qml/qdeclarativeengine_p.h
@@ -55,7 +55,6 @@
#include "qdeclarativeengine.h"
-#include "private/qdeclarativeclassfactory_p.h"
#include "private/qdeclarativetypeloader_p.h"
#include "private/qdeclarativeimport_p.h"
#include "private/qpodvector_p.h"
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp
index 8f95e26..fe4ed48 100644
--- a/src/declarative/qml/qdeclarativeimport.cpp
+++ b/src/declarative/qml/qdeclarativeimport.cpp
@@ -876,6 +876,7 @@ void QDeclarativeImportDatabase::addImportPath(const QString& path)
cPath = dir.canonicalPath();
} else {
cPath = path;
+ cPath.replace(QLatin1Char('\\'), QLatin1Char('/'));
}
if (!cPath.isEmpty()
diff --git a/src/declarative/qml/qdeclarativetypenotavailable.cpp b/src/declarative/qml/qdeclarativetypenotavailable.cpp
index 7a84732..9b79d70 100644
--- a/src/declarative/qml/qdeclarativetypenotavailable.cpp
+++ b/src/declarative/qml/qdeclarativetypenotavailable.cpp
@@ -41,9 +41,13 @@
#include "qdeclarativetypenotavailable_p.h"
+QT_BEGIN_NAMESPACE
+
int qmlRegisterTypeNotAvailable(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& message)
{
return qmlRegisterUncreatableType<QDeclarativeTypeNotAvailable>(uri,versionMajor,versionMinor,qmlName,message);
}
QDeclarativeTypeNotAvailable::QDeclarativeTypeNotAvailable() { }
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri
index 687ff52..66b69f9 100644
--- a/src/declarative/qml/qml.pri
+++ b/src/declarative/qml/qml.pri
@@ -22,7 +22,6 @@ SOURCES += \
$$PWD/qdeclarativerefcount.cpp \
$$PWD/qdeclarativemetatype.cpp \
$$PWD/qdeclarativestringconverters.cpp \
- $$PWD/qdeclarativeclassfactory.cpp \
$$PWD/qdeclarativeparserstatus.cpp \
$$PWD/qdeclarativetypeloader.cpp \
$$PWD/qdeclarativeinfo.cpp \
@@ -89,7 +88,6 @@ HEADERS += \
$$PWD/qdeclarativecontext.h \
$$PWD/qdeclarativeexpression.h \
$$PWD/qdeclarativestringconverters_p.h \
- $$PWD/qdeclarativeclassfactory_p.h \
$$PWD/qdeclarativeinfo.h \
$$PWD/qdeclarativeproperty_p.h \
$$PWD/qdeclarativecontext_p.h \
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 3a96f98..e6138f2 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -2192,6 +2192,13 @@ void QDeclarativePropertyAnimation::setProperties(const QString &prop)
The singular forms are slightly optimized, so if you do have only a single target/property
to animate you should try to use them.
+ The \c targets property allows multiple targets to be set. For example, this animates the
+ \c x property of both \c itemA and \c itemB:
+
+ \qml
+ NumberAnimation { targets: [itemA, itemB]; properties: "x"; to: 500 }
+ \endqml
+
In many cases these properties do not need to be explicitly specified, as they can be
inferred from the animation framework:
@@ -2255,7 +2262,7 @@ void QDeclarativePropertyAnimation::setProperties(const QString &prop)
As seen in the above example, properties is specified as a comma-separated string of property names to animate.
- \sa exclude
+ \sa exclude, {QML Animation}
*/
QDeclarativeListProperty<QObject> QDeclarativePropertyAnimation::targets()
{
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 5ce95e9..bbd20ac 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -310,14 +310,6 @@ QString QDeclarativeListModel::toString(int role) const
return m_flat ? m_flat->toString(role) : m_nested->toString(role);
}
-QHash<int,QVariant> QDeclarativeListModel::data(int index, const QList<int> &roles) const
-{
- if (index >= count() || index < 0)
- return QHash<int, QVariant>();
-
- return m_flat ? m_flat->data(index, roles) : m_nested->data(index, roles);
-}
-
QVariant QDeclarativeListModel::data(int index, int role) const
{
if (index >= count() || index < 0)
@@ -560,7 +552,8 @@ QScriptValue QDeclarativeListModel::get(int index) const
fruitModel.set(3, {"cost": 5.95, "name":"Pizza"})
\endcode
- The \a index must be an element in the list.
+ If \a index is equal to count() then a new item is appended to the
+ list. Otherwise, \a index must be an element in the list.
\sa append()
*/
@@ -570,7 +563,7 @@ void QDeclarativeListModel::set(int index, const QScriptValue& valuemap)
qmlInfo(this) << tr("set: value is not an object");
return;
}
- if (count() == 0 || index > count() || index < 0) {
+ if (index > count() || index < 0) {
qmlInfo(this) << tr("set: index %1 out of range").arg(index);
return;
}
@@ -920,19 +913,6 @@ FlatListModel::~FlatListModel()
qDeleteAll(m_nodeData);
}
-QHash<int,QVariant> FlatListModel::data(int index, const QList<int> &roles) const
-{
- Q_ASSERT(index >= 0 && index < m_values.count());
-
- QHash<int, QVariant> row;
- for (int i=0; i<roles.count(); i++) {
- int role = roles[i];
- if (m_values[index].contains(role))
- row.insert(role, m_values[index][role]);
- }
- return row;
-}
-
QVariant FlatListModel::data(int index, int role) const
{
Q_ASSERT(index >= 0 && index < m_values.count());
@@ -972,11 +952,6 @@ void FlatListModel::remove(int index)
removedNode(index);
}
-bool FlatListModel::append(const QScriptValue &value)
-{
- return insert(m_values.count(), value);
-}
-
bool FlatListModel::insert(int index, const QScriptValue &value)
{
Q_ASSERT(index >= 0 && index <= m_values.count());
@@ -1350,17 +1325,6 @@ void NestedListModel::move(int from, int to, int n)
qdeclarativelistmodel_move<QVariantList>(from, to, n, &_root->values);
}
-bool NestedListModel::append(const QScriptValue& valuemap)
-{
- if (!_root) {
- _root = new ModelNode(this);
- m_ownsRoot = true;
- }
-
- insert(count(), valuemap);
- return true;
-}
-
QScriptValue NestedListModel::get(int index) const
{
QDeclarativeEngine *eng = qmlEngine(m_listModel);
diff --git a/src/declarative/util/qdeclarativelistmodel_p.h b/src/declarative/util/qdeclarativelistmodel_p.h
index fe42ef6..e9673c8 100644
--- a/src/declarative/util/qdeclarativelistmodel_p.h
+++ b/src/declarative/util/qdeclarativelistmodel_p.h
@@ -76,7 +76,6 @@ public:
virtual QList<int> roles() const;
virtual QString toString(int role) const;
virtual int count() const;
- virtual QHash<int,QVariant> data(int index, const QList<int> &roles = (QList<int>())) const;
virtual QVariant data(int index, int role) const;
Q_INVOKABLE void clear();
diff --git a/src/declarative/util/qdeclarativelistmodel_p_p.h b/src/declarative/util/qdeclarativelistmodel_p_p.h
index d2d40ee..43a0a9b 100644
--- a/src/declarative/util/qdeclarativelistmodel_p_p.h
+++ b/src/declarative/util/qdeclarativelistmodel_p_p.h
@@ -79,7 +79,6 @@ public:
FlatListModel(QDeclarativeListModel *base);
~FlatListModel();
- QHash<int,QVariant> data(int index, const QList<int> &roles) const;
QVariant data(int index, int role) const;
QList<int> roles() const;
@@ -88,7 +87,6 @@ public:
int count() const;
void clear();
void remove(int index);
- bool append(const QScriptValue&);
bool insert(int index, const QScriptValue&);
QScriptValue get(int index) const;
void set(int index, const QScriptValue&, QList<int> *roles);
@@ -189,7 +187,6 @@ public:
int count() const;
void clear();
void remove(int index);
- bool append(const QScriptValue&);
bool insert(int index, const QScriptValue&);
QScriptValue get(int index) const;
void set(int index, const QScriptValue&, QList<int> *roles);
diff --git a/src/declarative/util/qdeclarativetimer_p.h b/src/declarative/util/qdeclarativetimer_p.h
index 93b0965..08c3d4e 100644
--- a/src/declarative/util/qdeclarativetimer_p.h
+++ b/src/declarative/util/qdeclarativetimer_p.h
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QDeclarativeTimerPrivate;
-class Q_AUTOTEST_EXPORT QDeclarativeTimer : public QObject, public QDeclarativeParserStatus
+class Q_DECLARATIVE_EXPORT QDeclarativeTimer : public QObject, public QDeclarativeParserStatus
{
Q_OBJECT
Q_DECLARE_PRIVATE(QDeclarativeTimer)
diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp
index 7b88610..163f626 100644
--- a/src/declarative/util/qdeclarativeview.cpp
+++ b/src/declarative/util/qdeclarativeview.cpp
@@ -392,7 +392,7 @@ QDeclarativeView::Status QDeclarativeView::status() const
/*!
Return the list of errors that occurred during the last compile or create
- operation. An empty list is returned if isError() is not set.
+ operation. When the status is not Error, an empty list is returned.
*/
QList<QDeclarativeError> QDeclarativeView::errors() const
{
diff --git a/src/declarative/util/qlistmodelinterface_p.h b/src/declarative/util/qlistmodelinterface_p.h
index 07592ad..8c8ebb3 100644
--- a/src/declarative/util/qlistmodelinterface_p.h
+++ b/src/declarative/util/qlistmodelinterface_p.h
@@ -59,10 +59,7 @@ class Q_DECLARATIVE_EXPORT QListModelInterface : public QObject
virtual ~QListModelInterface() {}
virtual int count() const = 0;
- virtual QHash<int,QVariant> data(int index, const QList<int>& roles = QList<int>()) const = 0;
virtual QVariant data(int index, int role) const = 0;
- virtual bool setData(int index, const QHash<int,QVariant>& values)
- { Q_UNUSED(index); Q_UNUSED(values); return false; }
virtual QList<int> roles() const = 0;
virtual QString toString(int role) const = 0;