summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--src/declarative/debugger/qdeclarativedebug.h4
-rw-r--r--src/declarative/debugger/qdeclarativedebugclient_p.h4
-rw-r--r--src/declarative/debugger/qdeclarativedebuggerstatus_p.h4
-rw-r--r--src/declarative/debugger/qdeclarativedebughelper_p.h4
-rw-r--r--src/declarative/debugger/qdeclarativedebugserver_p.h4
-rw-r--r--src/declarative/debugger/qdeclarativedebugserverconnection_p.h4
-rw-r--r--src/declarative/debugger/qdeclarativedebugservice_p.h4
-rw-r--r--src/declarative/debugger/qdeclarativedebugservice_p_p.h4
-rw-r--r--src/declarative/debugger/qdeclarativedebugtrace_p.h4
-rw-r--r--src/declarative/debugger/qdeclarativeenginedebug_p.h4
-rw-r--r--src/declarative/debugger/qdeclarativeenginedebugservice.cpp2
-rw-r--r--src/declarative/debugger/qdeclarativeinspectorinterface_p.h4
-rw-r--r--src/declarative/debugger/qdeclarativeinspectorservice_p.h4
-rw-r--r--src/declarative/debugger/qjsdebuggeragent_p.h4
-rw-r--r--src/declarative/debugger/qjsdebugservice_p.h4
-rw-r--r--src/declarative/debugger/qpacketprotocol.cpp1
-rw-r--r--src/declarative/debugger/qpacketprotocol_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanchors_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp38
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflipable_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativefocuspanel_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativefocusscope_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativegraphicswidget_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimplicitsizeitem_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp24
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem_p.h23
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitemsmodule_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativelayoutitem_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp40
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativepainteditem_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativepincharea_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativerepeater_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativescalegrid_p_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextlayout_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetranslate_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h4
-rw-r--r--src/declarative/qml/qdeclarative.h18
-rw-r--r--src/declarative/qml/qdeclarativecompiledbindings_p.h4
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp9
-rw-r--r--src/declarative/qml/qdeclarativecomponent.h4
-rw-r--r--src/declarative/qml/qdeclarativecontext.h4
-rw-r--r--src/declarative/qml/qdeclarativecontextscriptclass_p.h2
-rw-r--r--src/declarative/qml/qdeclarativecustomparser_p.h4
-rw-r--r--src/declarative/qml/qdeclarativedom_p.h4
-rw-r--r--src/declarative/qml/qdeclarativeengine.h4
-rw-r--r--src/declarative/qml/qdeclarativeerror.h4
-rw-r--r--src/declarative/qml/qdeclarativeexpression.h4
-rw-r--r--src/declarative/qml/qdeclarativeextensioninterface.h4
-rw-r--r--src/declarative/qml/qdeclarativeextensionplugin.h4
-rw-r--r--src/declarative/qml/qdeclarativefastproperties_p.h4
-rw-r--r--src/declarative/qml/qdeclarativeglobal_p.h4
-rw-r--r--src/declarative/qml/qdeclarativeimageprovider.cpp6
-rw-r--r--src/declarative/qml/qdeclarativeimageprovider.h4
-rw-r--r--src/declarative/qml/qdeclarativeimport.cpp31
-rw-r--r--src/declarative/qml/qdeclarativeinfo.h4
-rw-r--r--src/declarative/qml/qdeclarativelist.h4
-rw-r--r--src/declarative/qml/qdeclarativemetatype.cpp75
-rw-r--r--src/declarative/qml/qdeclarativemetatype_p.h4
-rw-r--r--src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.h4
-rw-r--r--src/declarative/qml/qdeclarativeparser_p.h4
-rw-r--r--src/declarative/qml/qdeclarativeparserstatus.h4
-rw-r--r--src/declarative/qml/qdeclarativeprivate.h15
-rw-r--r--src/declarative/qml/qdeclarativeproperty.h4
-rw-r--r--src/declarative/qml/qdeclarativepropertyvalueinterceptor.h4
-rw-r--r--src/declarative/qml/qdeclarativepropertyvaluesource.h4
-rw-r--r--src/declarative/qml/qdeclarativeproxymetaobject_p.h4
-rw-r--r--src/declarative/qml/qdeclarativerefcount_p.h4
-rw-r--r--src/declarative/qml/qdeclarativescriptparser_p.h6
-rw-r--r--src/declarative/qml/qdeclarativescriptstring.h4
-rw-r--r--src/declarative/qml/qdeclarativetypeloader.cpp72
-rw-r--r--src/declarative/qml/qdeclarativetypenotavailable_p.h4
-rw-r--r--src/declarative/qml/qdeclarativevme.cpp13
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript_p.h4
-rw-r--r--src/declarative/qml/rewriter/textwriter_p.h2
-rw-r--r--src/declarative/qtdeclarativeglobal.h4
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp4
-rw-r--r--src/declarative/util/qdeclarativeanimation_p.h4
-rw-r--r--src/declarative/util/qdeclarativeapplication_p.h4
-rw-r--r--src/declarative/util/qdeclarativebehavior_p.h4
-rw-r--r--src/declarative/util/qdeclarativebind_p.h4
-rw-r--r--src/declarative/util/qdeclarativeconnections_p.h4
-rw-r--r--src/declarative/util/qdeclarativefontloader_p.h4
-rw-r--r--src/declarative/util/qdeclarativelistaccessor_p.h4
-rw-r--r--src/declarative/util/qdeclarativelistmodel_p.h4
-rw-r--r--src/declarative/util/qdeclarativelistmodel_p_p.h4
-rw-r--r--src/declarative/util/qdeclarativelistmodelworkeragent_p.h4
-rw-r--r--src/declarative/util/qdeclarativeopenmetaobject_p.h4
-rw-r--r--src/declarative/util/qdeclarativepackage_p.h4
-rw-r--r--src/declarative/util/qdeclarativepixmapcache_p.h4
-rw-r--r--src/declarative/util/qdeclarativepropertychanges_p.h4
-rw-r--r--src/declarative/util/qdeclarativepropertymap.h4
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation.cpp4
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation_p.h4
-rw-r--r--src/declarative/util/qdeclarativespringanimation_p.h4
-rw-r--r--src/declarative/util/qdeclarativestate_p.h4
-rw-r--r--src/declarative/util/qdeclarativestategroup_p.h4
-rw-r--r--src/declarative/util/qdeclarativestateoperations_p.h4
-rw-r--r--src/declarative/util/qdeclarativesystempalette_p.h4
-rw-r--r--src/declarative/util/qdeclarativetimer_p.h4
-rw-r--r--src/declarative/util/qdeclarativetransition_p.h4
-rw-r--r--src/declarative/util/qdeclarativeutilmodule_p.h4
-rw-r--r--src/declarative/util/qdeclarativeview.h4
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel_p.h4
-rw-r--r--src/declarative/util/qlistmodelinterface_p.h3
-rw-r--r--src/doc/src/declarative/qtdeclarative.qdoc15
-rw-r--r--src/imports/folderlistmodel/qdeclarativefolderlistmodel.h4
-rw-r--r--src/imports/gestures/qdeclarativegesturearea_p.h4
-rw-r--r--src/imports/particles/qdeclarativeparticles_p.h4
-rw-r--r--src/imports/shaders/scenegraph/qsggeometry.h4
-rw-r--r--src/imports/shaders/shadereffect.h4
-rw-r--r--src/imports/shaders/shadereffectbuffer.h4
-rw-r--r--src/imports/shaders/shadereffectitem.h4
-rw-r--r--src/imports/shaders/shadereffectsource.h4
-rw-r--r--src/imports/webview/qdeclarativewebview_p.h4
-rw-r--r--sync.profile16
-rw-r--r--tests/auto/bic/data/QtDeclarative.5.0.0.linux-gcc-ia32.txt151
-rw-r--r--tests/auto/cmake/CMakeLists.txt2
-rw-r--r--tests/auto/cmake/cmake.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp20
-rw-r--r--tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h4
-rw-r--r--tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativedebugobservermode/tst_qdeclarativedebugobservermode.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp7
-rw-r--r--tests/auto/declarative/qdeclarativeflickable/data/nestedStopAtBounds.qml38
-rw-r--r--tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp82
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/data/notifications.qml81
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp293
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp179
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/LocalLast2.qml2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/MyComponentType.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/localOrderTest.qml7
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/qmlComponentType.qml4
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/testtypes.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp38
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp31
-rw-r--r--tests/auto/declarative/qdeclarativemousearea/data/nestedStopAtBounds.qml44
-rw-r--r--tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp96
-rw-r--r--tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp36
-rw-r--r--tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationZeroDuration.qml12
-rw-r--r--tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp21
-rw-r--r--tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp2
-rw-r--r--tools/qml/qdeclarativetester.cpp2
-rw-r--r--tools/qml/qdeclarativetester.h2
162 files changed, 1240 insertions, 789 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 02554aba..6aa780ca 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,4 +1,4 @@
load(qt_build_config)
CONFIG += qt_example_installs
-MODULE_VERSION = 5.0.2
+MODULE_VERSION = 5.1.0
diff --git a/src/declarative/debugger/qdeclarativedebug.h b/src/declarative/debugger/qdeclarativedebug.h
index ff021850..b4250604 100644
--- a/src/declarative/debugger/qdeclarativedebug.h
+++ b/src/declarative/debugger/qdeclarativedebug.h
@@ -44,8 +44,6 @@
#include <QtDeclarative/qtdeclarativeglobal.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -62,6 +60,4 @@ static QDeclarativeDebuggingEnabler qmlEnableDebuggingHelper;
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEDEBUG_H
diff --git a/src/declarative/debugger/qdeclarativedebugclient_p.h b/src/declarative/debugger/qdeclarativedebugclient_p.h
index 5332d5df..79046749 100644
--- a/src/declarative/debugger/qdeclarativedebugclient_p.h
+++ b/src/declarative/debugger/qdeclarativedebugclient_p.h
@@ -46,8 +46,6 @@
#include <private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -98,6 +96,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEDEBUGCLIENT_H
diff --git a/src/declarative/debugger/qdeclarativedebuggerstatus_p.h b/src/declarative/debugger/qdeclarativedebuggerstatus_p.h
index 3a9b2108..f9670608 100644
--- a/src/declarative/debugger/qdeclarativedebuggerstatus_p.h
+++ b/src/declarative/debugger/qdeclarativedebuggerstatus_p.h
@@ -46,8 +46,6 @@
#include <private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -66,6 +64,4 @@ Q_DECLARE_INTERFACE(QDeclarativeDebuggerStatus, QDeclarativeDebuggerStatus_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QLMDEBUGGERSTATUS_P_H
diff --git a/src/declarative/debugger/qdeclarativedebughelper_p.h b/src/declarative/debugger/qdeclarativedebughelper_p.h
index e72501ee..f05666ca 100644
--- a/src/declarative/debugger/qdeclarativedebughelper_p.h
+++ b/src/declarative/debugger/qdeclarativedebughelper_p.h
@@ -44,8 +44,6 @@
#include <private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QScriptEngine;
@@ -66,6 +64,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEDEBUGHELPER_P_H
diff --git a/src/declarative/debugger/qdeclarativedebugserver_p.h b/src/declarative/debugger/qdeclarativedebugserver_p.h
index 533d3d36..3adfc560 100644
--- a/src/declarative/debugger/qdeclarativedebugserver_p.h
+++ b/src/declarative/debugger/qdeclarativedebugserver_p.h
@@ -45,8 +45,6 @@
#include <private/qdeclarativeglobal_p.h>
#include <private/qdeclarativedebugserverconnection_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -86,6 +84,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEDEBUGSERVICE_H
diff --git a/src/declarative/debugger/qdeclarativedebugserverconnection_p.h b/src/declarative/debugger/qdeclarativedebugserverconnection_p.h
index 87ea9a8e..403ee520 100644
--- a/src/declarative/debugger/qdeclarativedebugserverconnection_p.h
+++ b/src/declarative/debugger/qdeclarativedebugserverconnection_p.h
@@ -56,8 +56,6 @@
// We mean it.
//
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -83,6 +81,4 @@ Q_DECLARE_INTERFACE(QDeclarativeDebugServerConnection, QDeclarativeDebugServerCo
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEDEBUGSERVERCONNECTION_H
diff --git a/src/declarative/debugger/qdeclarativedebugservice_p.h b/src/declarative/debugger/qdeclarativedebugservice_p.h
index 98ac7ea9..8961f0f6 100644
--- a/src/declarative/debugger/qdeclarativedebugservice_p.h
+++ b/src/declarative/debugger/qdeclarativedebugservice_p.h
@@ -46,8 +46,6 @@
#include <private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -90,7 +88,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEDEBUGSERVICE_H
diff --git a/src/declarative/debugger/qdeclarativedebugservice_p_p.h b/src/declarative/debugger/qdeclarativedebugservice_p_p.h
index 35b83f0e..56e3b851 100644
--- a/src/declarative/debugger/qdeclarativedebugservice_p_p.h
+++ b/src/declarative/debugger/qdeclarativedebugservice_p_p.h
@@ -45,8 +45,6 @@
#include <QtCore/qglobal.h>
#include <private/qobject_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -66,6 +64,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEDEBUGSERVICE_P_H
diff --git a/src/declarative/debugger/qdeclarativedebugtrace_p.h b/src/declarative/debugger/qdeclarativedebugtrace_p.h
index f968f46d..ba210a7f 100644
--- a/src/declarative/debugger/qdeclarativedebugtrace_p.h
+++ b/src/declarative/debugger/qdeclarativedebugtrace_p.h
@@ -47,8 +47,6 @@
#include <private/qdeclarativedebugservice_p.h>
#include <qelapsedtimer.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
struct QDeclarativeDebugData
@@ -144,7 +142,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEDEBUGTRACE_P_H
diff --git a/src/declarative/debugger/qdeclarativeenginedebug_p.h b/src/declarative/debugger/qdeclarativeenginedebug_p.h
index b802d36f..c16dddf5 100644
--- a/src/declarative/debugger/qdeclarativeenginedebug_p.h
+++ b/src/declarative/debugger/qdeclarativeenginedebug_p.h
@@ -47,8 +47,6 @@
#include <private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -389,6 +387,4 @@ Q_DECLARE_METATYPE(QDeclarativeDebugObjectReference)
Q_DECLARE_METATYPE(QDeclarativeDebugContextReference)
Q_DECLARE_METATYPE(QDeclarativeDebugPropertyReference)
-QT_END_HEADER
-
#endif // QDECLARATIVEENGINEDEBUG_H
diff --git a/src/declarative/debugger/qdeclarativeenginedebugservice.cpp b/src/declarative/debugger/qdeclarativeenginedebugservice.cpp
index d97349ed..5ee064a2 100644
--- a/src/declarative/debugger/qdeclarativeenginedebugservice.cpp
+++ b/src/declarative/debugger/qdeclarativeenginedebugservice.cpp
@@ -518,7 +518,7 @@ void QDeclarativeEngineDebugService::messageReceived(const QByteArray &message)
QVariant expr;
bool isLiteralValue;
QString filename;
- int line;
+ int line = 0;
ds >> objectId >> propertyName >> expr >> isLiteralValue;
if (!ds.atEnd()) { // backward compatibility from 2.1, 2.2
ds >> filename >> line;
diff --git a/src/declarative/debugger/qdeclarativeinspectorinterface_p.h b/src/declarative/debugger/qdeclarativeinspectorinterface_p.h
index 3596460b..685d7097 100644
--- a/src/declarative/debugger/qdeclarativeinspectorinterface_p.h
+++ b/src/declarative/debugger/qdeclarativeinspectorinterface_p.h
@@ -44,8 +44,6 @@
#include <QtDeclarative/private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -66,6 +64,4 @@ Q_DECLARE_INTERFACE(QDeclarativeInspectorInterface, QDeclarativeInspectorInterfa
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEOBSERVERINTERFACE_H
diff --git a/src/declarative/debugger/qdeclarativeinspectorservice_p.h b/src/declarative/debugger/qdeclarativeinspectorservice_p.h
index 2aabf3c7..4c39968e 100644
--- a/src/declarative/debugger/qdeclarativeinspectorservice_p.h
+++ b/src/declarative/debugger/qdeclarativeinspectorservice_p.h
@@ -47,8 +47,6 @@
#include <QtCore/QList>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -88,6 +86,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEOBSERVERSERVICE_H
diff --git a/src/declarative/debugger/qjsdebuggeragent_p.h b/src/declarative/debugger/qjsdebuggeragent_p.h
index decc7010..5a2ed140 100644
--- a/src/declarative/debugger/qjsdebuggeragent_p.h
+++ b/src/declarative/debugger/qjsdebuggeragent_p.h
@@ -62,8 +62,6 @@ class QScriptValue;
class QDeclarativeEngine;
QT_END_NAMESPACE
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -225,6 +223,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QJSDEBUGGERAGENT_P_H
diff --git a/src/declarative/debugger/qjsdebugservice_p.h b/src/declarative/debugger/qjsdebugservice_p.h
index 8f89f592..b7240e31 100644
--- a/src/declarative/debugger/qjsdebugservice_p.h
+++ b/src/declarative/debugger/qjsdebugservice_p.h
@@ -58,8 +58,6 @@
#include "private/qdeclarativedebugservice_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -118,6 +116,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QJSDEBUGSERVICE_P_H
diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp
index 3184d3f7..369f0610 100644
--- a/src/declarative/debugger/qpacketprotocol.cpp
+++ b/src/declarative/debugger/qpacketprotocol.cpp
@@ -300,6 +300,7 @@ void QPacketProtocol::send(const QPacket & p)
Q_ASSERT(writeBytes == sizeof(qint32));
writeBytes = d->dev->write(p.b);
Q_ASSERT(writeBytes == p.b.size());
+ Q_UNUSED(writeBytes);
}
/*!
diff --git a/src/declarative/debugger/qpacketprotocol_p.h b/src/declarative/debugger/qpacketprotocol_p.h
index 1a1e1464..ba8d200e 100644
--- a/src/declarative/debugger/qpacketprotocol_p.h
+++ b/src/declarative/debugger/qpacketprotocol_p.h
@@ -47,8 +47,6 @@
#include <private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -122,6 +120,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/graphicsitems/qdeclarativeanchors_p.h b/src/declarative/graphicsitems/qdeclarativeanchors_p.h
index fe23bfd3..0ced6746 100644
--- a/src/declarative/graphicsitems/qdeclarativeanchors_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeanchors_p.h
@@ -50,8 +50,6 @@
#include <private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -199,6 +197,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeAnchors)
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h
index 5f70491c..9ab6456c 100644
--- a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h
@@ -46,8 +46,6 @@
#ifndef QT_NO_MOVIE
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -109,8 +107,6 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeAnimatedImage)
-QT_END_HEADER
-
#endif // QT_NO_MOVIE
#endif
diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h
index 9cdb73cc..c73e0c19 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h
@@ -46,7 +46,6 @@
#include <QtNetwork/qnetworkreply.h>
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -104,6 +103,5 @@ private:
QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeBorderImage)
-QT_END_HEADER
#endif // QDECLARATIVEBORDERIMAGE_H
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index edbd9782..64ae2094 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -799,22 +799,19 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent
newY = minY + (newY - minY) / 2;
if (newY < maxY && maxY - minY <= 0)
newY = maxY + (newY - maxY) / 2;
- if (boundsBehavior == QDeclarativeFlickable::StopAtBounds && (newY > minY || newY < maxY)) {
- rejectY = true;
- if (newY < maxY) {
- newY = maxY;
- rejectY = false;
- }
- if (newY > minY) {
- newY = minY;
- rejectY = false;
- }
+ if (boundsBehavior == QDeclarativeFlickable::StopAtBounds && newY <= maxY) {
+ newY = maxY;
+ rejectY = vData.pressPos == maxY && dy < 0;
+ }
+ if (boundsBehavior == QDeclarativeFlickable::StopAtBounds && newY >= minY) {
+ newY = minY;
+ rejectY = vData.pressPos == minY && dy > 0;
}
if (!rejectY && stealMouse && dy != 0) {
vData.move.setValue(qRound(newY));
vMoved = true;
}
- if (qAbs(dy) > QApplication::startDragDistance())
+ if (!rejectY && qAbs(dy) > QApplication::startDragDistance())
stealY = true;
}
}
@@ -831,23 +828,20 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent
newX = minX + (newX - minX) / 2;
if (newX < maxX && maxX - minX <= 0)
newX = maxX + (newX - maxX) / 2;
- if (boundsBehavior == QDeclarativeFlickable::StopAtBounds && (newX > minX || newX < maxX)) {
- rejectX = true;
- if (newX < maxX) {
- newX = maxX;
- rejectX = false;
- }
- if (newX > minX) {
- newX = minX;
- rejectX = false;
- }
+ if (boundsBehavior == QDeclarativeFlickable::StopAtBounds && newX <= maxX) {
+ newX = maxX;
+ rejectX = hData.pressPos == maxX && dx < 0;
+ }
+ if (boundsBehavior == QDeclarativeFlickable::StopAtBounds && newX >= minX) {
+ newX = minX;
+ rejectX = hData.pressPos == minX && dx > 0;
}
if (!rejectX && stealMouse && dx != 0) {
hData.move.setValue(qRound(newX));
hMoved = true;
}
- if (qAbs(dx) > QApplication::startDragDistance())
+ if (!rejectX && qAbs(dx) > QApplication::startDragDistance())
stealX = true;
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h
index d1f45539..fbe809be 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h
@@ -44,8 +44,6 @@
#include "qdeclarativeitem.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -224,6 +222,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeFlickable)
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/graphicsitems/qdeclarativeflipable_p.h b/src/declarative/graphicsitems/qdeclarativeflipable_p.h
index 9bd65986..eebfa57e 100644
--- a/src/declarative/graphicsitems/qdeclarativeflipable_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeflipable_p.h
@@ -48,8 +48,6 @@
#include <QtGui/QTransform>
#include <QtGui/qvector3d.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -95,6 +93,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeFlipable)
-QT_END_HEADER
-
#endif // QDECLARATIVEFLIPABLE_H
diff --git a/src/declarative/graphicsitems/qdeclarativefocuspanel_p.h b/src/declarative/graphicsitems/qdeclarativefocuspanel_p.h
index c65f30b4..1b0fed65 100644
--- a/src/declarative/graphicsitems/qdeclarativefocuspanel_p.h
+++ b/src/declarative/graphicsitems/qdeclarativefocuspanel_p.h
@@ -44,8 +44,6 @@
#include "qdeclarativeitem.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -73,6 +71,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeFocusPanel)
-QT_END_HEADER
-
#endif // QDECLARATIVEFOCUSPANEL_H
diff --git a/src/declarative/graphicsitems/qdeclarativefocusscope_p.h b/src/declarative/graphicsitems/qdeclarativefocusscope_p.h
index d12f9e97..fe152118 100644
--- a/src/declarative/graphicsitems/qdeclarativefocusscope_p.h
+++ b/src/declarative/graphicsitems/qdeclarativefocusscope_p.h
@@ -44,8 +44,6 @@
#include "qdeclarativeitem.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -64,6 +62,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeFocusScope)
-QT_END_HEADER
-
#endif // QDECLARATIVEFOCUSSCOPE_H
diff --git a/src/declarative/graphicsitems/qdeclarativegraphicswidget_p.h b/src/declarative/graphicsitems/qdeclarativegraphicswidget_p.h
index 30c634c4..987399b5 100644
--- a/src/declarative/graphicsitems/qdeclarativegraphicswidget_p.h
+++ b/src/declarative/graphicsitems/qdeclarativegraphicswidget_p.h
@@ -45,8 +45,6 @@
#include <QObject>
#include <QtDeclarative/qdeclarativecomponent.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -85,6 +83,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEGRAPHICSWIDGET_P_H
diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h
index 4e882b40..9bdfcfa7 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h
@@ -45,8 +45,6 @@
#include "private/qdeclarativeflickable_p.h"
#include "private/qdeclarativeguard_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -281,6 +279,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeGridView)
QML_DECLARE_TYPEINFO(QDeclarativeGridView, QML_HAS_ATTACHED_PROPERTIES)
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/graphicsitems/qdeclarativeimage_p.h b/src/declarative/graphicsitems/qdeclarativeimage_p.h
index 5568561b..dee98c7d 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeimage_p.h
@@ -46,7 +46,6 @@
#include <QtNetwork/qnetworkreply.h>
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -95,6 +94,5 @@ private:
QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeImage)
-QT_END_HEADER
#endif // QDECLARATIVEIMAGE_H
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
index 7d56a027..ff771d93 100644
--- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
@@ -44,8 +44,6 @@
#include "qdeclarativeimplicitsizeitem_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeImageBasePrivate;
@@ -111,6 +109,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEIMAGEBASE_H
diff --git a/src/declarative/graphicsitems/qdeclarativeimplicitsizeitem_p.h b/src/declarative/graphicsitems/qdeclarativeimplicitsizeitem_p.h
index 3a261a10..629bbf7a 100644
--- a/src/declarative/graphicsitems/qdeclarativeimplicitsizeitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeimplicitsizeitem_p.h
@@ -44,8 +44,6 @@
#include "qdeclarativepainteditem_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeImplicitSizeItemPrivate;
@@ -95,6 +93,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEIMPLICITSIZEITEM_H
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 99b3857d..c3bb5d9f 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -2744,9 +2744,27 @@ QDeclarativeItem *QDeclarativeItem::childAt(qreal x, qreal y) const
void QDeclarativeItemPrivate::focusChanged(bool flag)
{
Q_Q(QDeclarativeItem);
- if (!(flags & QGraphicsItem::ItemIsFocusScope) && parent)
- emit q->activeFocusChanged(flag); //see also QDeclarativeItemPrivate::subFocusItemChange()
- emit q->focusChanged(flag);
+
+ if (hadActiveFocus != flag) {
+ hadActiveFocus = flag;
+ emit q->activeFocusChanged(flag);
+ }
+
+ QDeclarativeItem *focusItem = q;
+ for (QDeclarativeItem *p = q->parentItem(); p; p = p->parentItem()) {
+ if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
+ if (!flag && QGraphicsItemPrivate::get(p)->focusScopeItem != focusItem)
+ break;
+ if (p->d_func()->hadActiveFocus != flag) {
+ p->d_func()->hadActiveFocus = flag;
+ emit p->activeFocusChanged(flag);
+ }
+ focusItem = p;
+ }
+ }
+
+ // For all but the top most focus scope/item this will be called for us by QGraphicsItem.
+ focusItem->d_func()->focusScopeItemChange(flag);
}
QDeclarativeListProperty<QObject> QDeclarativeItemPrivate::resources()
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.h b/src/declarative/graphicsitems/qdeclarativeitem.h
index 6d5cd8be..47647d08 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem.h
@@ -52,8 +52,6 @@
#include <QtGui/qfont.h>
#include <QtWidgets/qaction.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -231,6 +229,4 @@ QML_DECLARE_TYPE(QGraphicsWidget)
QML_DECLARE_TYPE(QAction)
#endif
-QT_END_HEADER
-
#endif // QDECLARATIVEITEM_H
diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h
index 8ef91887..20262307 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h
@@ -128,8 +128,8 @@ public:
componentComplete(true), keepMouse(false),
smooth(false), transformOriginDirty(true), doneEventPreHandler(false),
inheritedLayoutMirror(false), effectiveLayoutMirror(false), isMirrorImplicit(true),
- inheritMirrorFromParent(false), inheritMirrorFromItem(false), keyHandler(0),
- mWidth(0), mHeight(0), mImplicitWidth(0), mImplicitHeight(0), attachedLayoutDirection(0), hadSubFocusItem(false)
+ inheritMirrorFromParent(false), inheritMirrorFromItem(false), hadFocus(false), hadActiveFocus(false), keyHandler(0),
+ mWidth(0), mHeight(0), mImplicitWidth(0), mImplicitHeight(0), attachedLayoutDirection(0)
{
QGraphicsItemPrivate::acceptedMouseButtons = 0;
isDeclarativeItem = 1;
@@ -289,6 +289,8 @@ public:
bool isMirrorImplicit:1;
bool inheritMirrorFromParent:1;
bool inheritMirrorFromItem:1;
+ bool hadFocus:1;
+ bool hadActiveFocus:1;
QDeclarativeItemKeyFilter *keyHandler;
@@ -299,7 +301,6 @@ public:
QDeclarativeLayoutMirroringAttached* attachedLayoutDirection;
- bool hadSubFocusItem;
QPointF computeTransformOrigin() const;
@@ -312,22 +313,14 @@ public:
}
// Reimplemented from QGraphicsItemPrivate
- virtual void subFocusItemChange()
- {
- bool hasSubFocusItem = subFocusItem != 0;
- if (((flags & QGraphicsItem::ItemIsFocusScope) || !parent) && hasSubFocusItem != hadSubFocusItem)
- emit q_func()->activeFocusChanged(hasSubFocusItem);
- //see also QDeclarativeItemPrivate::focusChanged
- hadSubFocusItem = hasSubFocusItem;
- }
-
- // Reimplemented from QGraphicsItemPrivate
virtual void focusScopeItemChange(bool isSubFocusItem)
{
- emit q_func()->focusChanged(isSubFocusItem);
+ if (hadFocus != isSubFocusItem) {
+ hadFocus = isSubFocusItem;
+ emit q_func()->focusChanged(isSubFocusItem);
+ }
}
-
// Reimplemented from QGraphicsItemPrivate
virtual void siblingOrderChange()
{
diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule_p.h b/src/declarative/graphicsitems/qdeclarativeitemsmodule_p.h
index 8a37e020..f7750c1e 100644
--- a/src/declarative/graphicsitems/qdeclarativeitemsmodule_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule_p.h
@@ -44,8 +44,6 @@
#include <qdeclarative.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -59,6 +57,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEITEMMODULE_H
diff --git a/src/declarative/graphicsitems/qdeclarativelayoutitem_p.h b/src/declarative/graphicsitems/qdeclarativelayoutitem_p.h
index 35e02e52..cc84830f 100644
--- a/src/declarative/graphicsitems/qdeclarativelayoutitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativelayoutitem_p.h
@@ -46,8 +46,6 @@
#include <QGraphicsLayoutItem>
#include <QSizeF>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -90,5 +88,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeLayoutItem)
-QT_END_HEADER
#endif
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 33d3db35..08e76363 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -896,6 +896,8 @@ void QDeclarativeListViewPrivate::layout()
fixupPosition();
q->refill();
}
+ if (sectionCriteria)
+ updateCurrentSection();
if (header)
updateHeader();
if (footer)
diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h
index dc5949cd..339c4960 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h
@@ -45,8 +45,6 @@
#include "private/qdeclarativeflickable_p.h"
#include "private/qdeclarativeguard_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -365,6 +363,4 @@ QML_DECLARE_TYPEINFO(QDeclarativeListView, QML_HAS_ATTACHED_PROPERTIES)
QML_DECLARE_TYPE(QDeclarativeListView)
QML_DECLARE_TYPE(QDeclarativeViewSection)
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/graphicsitems/qdeclarativeloader_p.h b/src/declarative/graphicsitems/qdeclarativeloader_p.h
index 894c4563..623ed757 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeloader_p.h
@@ -44,8 +44,6 @@
#include "qdeclarativeimplicitsizeitem_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -103,6 +101,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeLoader)
-QT_END_HEADER
-
#endif // QDECLARATIVELOADER_H
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index a7c38ea8..4752ec32 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -530,39 +530,35 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
curLocalPos = event->scenePos();
}
- const int dragThreshold = QApplication::startDragDistance();
- qreal dx = qAbs(curLocalPos.x() - startLocalPos.x());
- qreal dy = qAbs(curLocalPos.y() - startLocalPos.y());
-
if (keepMouseGrab() && d->stealMouse)
d->drag->setActive(true);
bool dragX = drag()->axis() & QDeclarativeDrag::XAxis;
bool dragY = drag()->axis() & QDeclarativeDrag::YAxis;
- if (dragX && d->drag->active()) {
- qreal x = (curLocalPos.x() - startLocalPos.x()) + d->startX;
- if (x < drag()->xmin())
- x = drag()->xmin();
- else if (x > drag()->xmax())
- x = drag()->xmax();
- drag()->target()->setX(x);
- }
- if (dragY && d->drag->active()) {
- qreal y = (curLocalPos.y() - startLocalPos.y()) + d->startY;
- if (y < drag()->ymin())
- y = drag()->ymin();
- else if (y > drag()->ymax())
- y = drag()->ymax();
- drag()->target()->setY(y);
+ const qreal x = dragX
+ ? qBound(d->drag->xmin(), d->startX + curLocalPos.x() - startLocalPos.x(), d->drag->xmax())
+ : d->startX;
+ const qreal y = dragY
+ ? qBound(d->drag->ymin(), d->startY + curLocalPos.y() - startLocalPos.y(), d->drag->ymax())
+ : d->startY;
+
+ if (d->drag->active()) {
+ if (dragX && dragY)
+ d->drag->target()->setPos(x, y);
+ else if (dragX)
+ d->drag->target()->setX(x);
+ else if (dragY)
+ d->drag->target()->setY(y);
}
if (!keepMouseGrab()) {
- if ((!dragY && dy < dragThreshold && dragX && dx > dragThreshold)
- || (!dragX && dx < dragThreshold && dragY && dy > dragThreshold)
- || (dragX && dragY && (dx > dragThreshold || dy > dragThreshold))) {
+ const int dragThreshold = QApplication::startDragDistance();
+
+ if (qAbs(x - d->startX) > dragThreshold || qAbs(y - d->startY) > dragThreshold) {
setKeepMouseGrab(true);
d->stealMouse = true;
+ d->startScene = event->scenePos();
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
index af3e23e7..75ca8c95 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h
+++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
@@ -44,8 +44,6 @@
#include "qdeclarativeitem.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -213,6 +211,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeDrag)
QML_DECLARE_TYPE(QDeclarativeMouseArea)
-QT_END_HEADER
-
#endif // QDECLARATIVEMOUSEAREA_H
diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem_p.h b/src/declarative/graphicsitems/qdeclarativepainteditem_p.h
index 0a23b38f..fa3a3b4f 100644
--- a/src/declarative/graphicsitems/qdeclarativepainteditem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepainteditem_p.h
@@ -44,8 +44,6 @@
#include "qdeclarativeitem.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -113,6 +111,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativePaintedItem)
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/graphicsitems/qdeclarativepath_p.h b/src/declarative/graphicsitems/qdeclarativepath_p.h
index aab0da4e..429224a7 100644
--- a/src/declarative/graphicsitems/qdeclarativepath_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepath_p.h
@@ -49,8 +49,6 @@
#include <QtCore/QObject>
#include <QtGui/QPainterPath>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -281,6 +279,4 @@ QML_DECLARE_TYPE(QDeclarativePathCubic)
QML_DECLARE_TYPE(QDeclarativePathPercent)
QML_DECLARE_TYPE(QDeclarativePath)
-QT_END_HEADER
-
#endif // QDECLARATIVEPATH_H
diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h
index 00835d8f..6a5a8443 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h
@@ -45,8 +45,6 @@
#include "qdeclarativeitem.h"
#include "private/qdeclarativepath_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -247,6 +245,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativePathView)
QML_DECLARE_TYPEINFO(QDeclarativePathView, QML_HAS_ATTACHED_PROPERTIES)
-QT_END_HEADER
-
#endif // QDECLARATIVEPATHVIEW_H
diff --git a/src/declarative/graphicsitems/qdeclarativepincharea_p.h b/src/declarative/graphicsitems/qdeclarativepincharea_p.h
index c601a4ae..eff6bfc9 100644
--- a/src/declarative/graphicsitems/qdeclarativepincharea_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepincharea_p.h
@@ -44,8 +44,6 @@
#include <qdeclarativeitem.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -308,6 +306,4 @@ QML_DECLARE_TYPE(QDeclarativePinch)
QML_DECLARE_TYPE(QDeclarativePinchEvent)
QML_DECLARE_TYPE(QDeclarativePinchArea)
-QT_END_HEADER
-
#endif // QDECLARATIVEPINCHAREA_H
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
index 3a78a0bb..4fe658ef 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
@@ -50,8 +50,6 @@
#include <QtCore/QObject>
#include <QtCore/QString>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -228,6 +226,4 @@ QML_DECLARE_TYPE(QDeclarativeRow)
QML_DECLARE_TYPE(QDeclarativeGrid)
QML_DECLARE_TYPE(QDeclarativeFlow)
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle_p.h b/src/declarative/graphicsitems/qdeclarativerectangle_p.h
index ccb01cfb..8d9d6e3b 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle_p.h
+++ b/src/declarative/graphicsitems/qdeclarativerectangle_p.h
@@ -48,8 +48,6 @@
#include <private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -183,6 +181,4 @@ QML_DECLARE_TYPE(QDeclarativeGradientStop)
QML_DECLARE_TYPE(QDeclarativeGradient)
QML_DECLARE_TYPE(QDeclarativeRectangle)
-QT_END_HEADER
-
#endif // QDECLARATIVERECT_H
diff --git a/src/declarative/graphicsitems/qdeclarativerepeater_p.h b/src/declarative/graphicsitems/qdeclarativerepeater_p.h
index d8772f3e..c9b8ad2b 100644
--- a/src/declarative/graphicsitems/qdeclarativerepeater_p.h
+++ b/src/declarative/graphicsitems/qdeclarativerepeater_p.h
@@ -44,8 +44,6 @@
#include "qdeclarativeitem.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -105,6 +103,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeRepeater)
-QT_END_HEADER
-
#endif // QDECLARATIVEREPEATER_H
diff --git a/src/declarative/graphicsitems/qdeclarativescalegrid_p_p.h b/src/declarative/graphicsitems/qdeclarativescalegrid_p_p.h
index 4a42f4ed..7e408915 100644
--- a/src/declarative/graphicsitems/qdeclarativescalegrid_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativescalegrid_p_p.h
@@ -51,8 +51,6 @@
#include <private/qdeclarativepixmapcache_p.h>
#include <private/qdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -129,6 +127,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeScaleGrid)
-QT_END_HEADER
-
#endif // QDECLARATIVESCALEGRID_H
diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h
index 3bd97a85..5a299ade 100644
--- a/src/declarative/graphicsitems/qdeclarativetext_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetext_p.h
@@ -47,8 +47,6 @@
#include <private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -206,6 +204,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeText)
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
index 46818723..a1d5a19b 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
@@ -50,8 +50,6 @@
#include <QtGui/qtextcursor.h>
#include <QtGui/qtextformat.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -300,6 +298,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeTextEdit)
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h
index 8e782e4a..119a08d7 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h
@@ -50,8 +50,6 @@
#ifndef QT_NO_LINEEDIT
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -297,8 +295,6 @@ QML_DECLARE_TYPE(QDoubleValidator)
QML_DECLARE_TYPE(QRegExpValidator)
#endif
-QT_END_HEADER
-
#endif // QT_NO_LINEEDIT
#endif // QDECLARATIVETEXTINPUT_H
diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
index 2918d39c..51436aee 100644
--- a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
@@ -44,8 +44,6 @@
#include <QtGui/qtextlayout.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -70,6 +68,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVETEXTLAYOUT_P_H
diff --git a/src/declarative/graphicsitems/qdeclarativetranslate_p.h b/src/declarative/graphicsitems/qdeclarativetranslate_p.h
index 797c2623..e82e85fb 100644
--- a/src/declarative/graphicsitems/qdeclarativetranslate_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetranslate_p.h
@@ -44,8 +44,6 @@
#include "qdeclarativeitem.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -84,6 +82,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeTranslate)
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h
index 8bc34635..1b91360e 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h
@@ -47,8 +47,6 @@
#include <QtCore/qobject.h>
#include <QtCore/qabstractitemmodel.h>
-QT_BEGIN_HEADER
-
Q_DECLARE_METATYPE(QModelIndex)
QT_BEGIN_NAMESPACE
@@ -252,6 +250,4 @@ QML_DECLARE_TYPE(QDeclarativeVisualItemModel)
QML_DECLARE_TYPEINFO(QDeclarativeVisualItemModel, QML_HAS_ATTACHED_PROPERTIES)
QML_DECLARE_TYPE(QDeclarativeVisualDataModel)
-QT_END_HEADER
-
#endif // QDECLARATIVEVISUALDATAMODEL_H
diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h
index 7168d4e4..dd08105e 100644
--- a/src/declarative/qml/qdeclarative.h
+++ b/src/declarative/qml/qdeclarative.h
@@ -49,10 +49,9 @@
#include <QtDeclarative/qdeclarativelist.h>
#include <QtCore/qbytearray.h>
+#include <QtCore/qurl.h>
#include <QtCore/qmetaobject.h>
-QT_BEGIN_HEADER
-
#define QML_DECLARE_TYPE(TYPE) \
Q_DECLARE_METATYPE(TYPE *) \
Q_DECLARE_METATYPE(QDeclarativeListProperty<TYPE>)
@@ -390,6 +389,19 @@ int qmlRegisterCustomType(const char *uri, int versionMajor, int versionMinor,
return QDeclarativePrivate::qmlregister(QDeclarativePrivate::TypeRegistration, &type);
}
+inline int qmlRegisterType(const QUrl &url, const char *uri, int versionMajor, int versionMinor, const char *qmlName)
+{
+ QDeclarativePrivate::RegisterComponent type = {
+ url,
+ uri,
+ qmlName,
+ versionMajor,
+ versionMinor
+ };
+
+ return QDeclarativePrivate::qmlregister(QDeclarativePrivate::ComponentRegistration, &type);
+}
+
class QDeclarativeContext;
class QDeclarativeEngine;
Q_DECLARATIVE_EXPORT void qmlExecuteDeferred(QObject *);
@@ -410,6 +422,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QObject)
Q_DECLARE_METATYPE(QVariant)
-QT_END_HEADER
-
#endif // QDECLARATIVE_H
diff --git a/src/declarative/qml/qdeclarativecompiledbindings_p.h b/src/declarative/qml/qdeclarativecompiledbindings_p.h
index 23249a79..1419742a 100644
--- a/src/declarative/qml/qdeclarativecompiledbindings_p.h
+++ b/src/declarative/qml/qdeclarativecompiledbindings_p.h
@@ -56,8 +56,6 @@
#include "private/qdeclarativeexpression_p.h"
#include "private/qdeclarativebinding_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
struct QDeclarativeBindingCompilerPrivate;
@@ -110,7 +108,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEBINDINGOPTIMIZATIONS_P_H
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index 69109d12..85ae3ebc 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -438,15 +438,14 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop,
case QVariant::DateTime:
{
QDateTime dateTime = QDeclarativeStringConverters::dateTimeFromString(string);
-#ifdef Q_CC_GNU
-# warning "QDateTime range has extended in Qt 5, please fix me"
-#endif
- int data[] = { int(dateTime.date().toJulianDay()),
+ // Stuff the qint64 julianDay into an array of int.
+ const qint64 julianDay = dateTime.date().toJulianDay();
+ int data[] = { int(julianDay & 0xFFFFFFFF), int(julianDay >> 32),
dateTime.time().hour(),
dateTime.time().minute(),
dateTime.time().second(),
dateTime.time().msec() };
- int index = output->indexForInt(data, 5);
+ const int index = output->indexForInt(data, 6);
instr.type = QDeclarativeInstruction::StoreDateTime;
instr.storeDateTime.propertyIndex = prop.propertyIndex();
instr.storeDateTime.valueIndex = index;
diff --git a/src/declarative/qml/qdeclarativecomponent.h b/src/declarative/qml/qdeclarativecomponent.h
index 9687cd8e..b75da2a1 100644
--- a/src/declarative/qml/qdeclarativecomponent.h
+++ b/src/declarative/qml/qdeclarativecomponent.h
@@ -49,8 +49,6 @@
#include <QtCore/qstring.h>
#include <QtScript/qscriptvalue.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -127,6 +125,4 @@ Q_DECLARE_METATYPE(QDeclarativeComponent::Status)
QML_DECLARE_TYPE(QDeclarativeComponent)
QML_DECLARE_TYPEINFO(QDeclarativeComponent, QML_HAS_ATTACHED_PROPERTIES)
-QT_END_HEADER
-
#endif // QDECLARATIVECOMPONENT_H
diff --git a/src/declarative/qml/qdeclarativecontext.h b/src/declarative/qml/qdeclarativecontext.h
index 3b3cb577..9ed71456 100644
--- a/src/declarative/qml/qdeclarativecontext.h
+++ b/src/declarative/qml/qdeclarativecontext.h
@@ -49,8 +49,6 @@
#include <QtCore/qmetatype.h>
#include <QtCore/qvariant.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -110,6 +108,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QList<QObject*>)
-QT_END_HEADER
-
#endif // QDECLARATIVECONTEXT_H
diff --git a/src/declarative/qml/qdeclarativecontextscriptclass_p.h b/src/declarative/qml/qdeclarativecontextscriptclass_p.h
index 1e4ffbf3..0e2d7cf5 100644
--- a/src/declarative/qml/qdeclarativecontextscriptclass_p.h
+++ b/src/declarative/qml/qdeclarativecontextscriptclass_p.h
@@ -96,8 +96,6 @@ private:
QDeclarativeTypeNameCache::Data *lastData;
int lastPropertyIndex;
QScriptValue lastFunction;
-
- uint m_id;
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativecustomparser_p.h b/src/declarative/qml/qdeclarativecustomparser_p.h
index 85f6cc48..415f7889 100644
--- a/src/declarative/qml/qdeclarativecustomparser_p.h
+++ b/src/declarative/qml/qdeclarativecustomparser_p.h
@@ -61,8 +61,6 @@
#include <QtCore/qbytearray.h>
#include <QtCore/qxmlstream.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -162,6 +160,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QDeclarativeCustomParserProperty)
Q_DECLARE_METATYPE(QDeclarativeCustomParserNode)
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/qml/qdeclarativedom_p.h b/src/declarative/qml/qdeclarativedom_p.h
index 5ad35dc7..df1cfdc2 100644
--- a/src/declarative/qml/qdeclarativedom_p.h
+++ b/src/declarative/qml/qdeclarativedom_p.h
@@ -60,8 +60,6 @@
#include <private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -357,6 +355,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEDOM_P_H
diff --git a/src/declarative/qml/qdeclarativeengine.h b/src/declarative/qml/qdeclarativeengine.h
index 8302ce5d..e0ec33ec 100644
--- a/src/declarative/qml/qdeclarativeengine.h
+++ b/src/declarative/qml/qdeclarativeengine.h
@@ -49,8 +49,6 @@
#include <QtDeclarative/qdeclarativeerror.h>
#include <QtDeclarative/qdeclarativedebug.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -125,6 +123,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEENGINE_H
diff --git a/src/declarative/qml/qdeclarativeerror.h b/src/declarative/qml/qdeclarativeerror.h
index ac4fba24..3967f503 100644
--- a/src/declarative/qml/qdeclarativeerror.h
+++ b/src/declarative/qml/qdeclarativeerror.h
@@ -46,8 +46,6 @@
#include <QtCore/qurl.h>
#include <QtCore/qstring.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -82,6 +80,4 @@ QDebug Q_DECLARATIVE_EXPORT operator<<(QDebug debug, const QDeclarativeError &er
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEERROR_H
diff --git a/src/declarative/qml/qdeclarativeexpression.h b/src/declarative/qml/qdeclarativeexpression.h
index 68b67315..728a4ac2 100644
--- a/src/declarative/qml/qdeclarativeexpression.h
+++ b/src/declarative/qml/qdeclarativeexpression.h
@@ -47,8 +47,6 @@
#include <QtCore/qobject.h>
#include <QtCore/qvariant.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -113,7 +111,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEEXPRESSION_H
diff --git a/src/declarative/qml/qdeclarativeextensioninterface.h b/src/declarative/qml/qdeclarativeextensioninterface.h
index 0e705f92..8e7f3f0f 100644
--- a/src/declarative/qml/qdeclarativeextensioninterface.h
+++ b/src/declarative/qml/qdeclarativeextensioninterface.h
@@ -45,8 +45,6 @@
#include <QtDeclarative/qtdeclarativeglobal.h>
#include <QtCore/qobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -66,6 +64,4 @@ Q_DECLARE_INTERFACE(QDeclarativeExtensionInterface, QDeclarativeExtensionInterfa
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEEXTENSIONINTERFACE_H
diff --git a/src/declarative/qml/qdeclarativeextensionplugin.h b/src/declarative/qml/qdeclarativeextensionplugin.h
index 745b2cd4..7ff9c787 100644
--- a/src/declarative/qml/qdeclarativeextensionplugin.h
+++ b/src/declarative/qml/qdeclarativeextensionplugin.h
@@ -46,8 +46,6 @@
#include <QtDeclarative/qdeclarativeextensioninterface.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -71,6 +69,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEEXTENSIONPLUGIN_H
diff --git a/src/declarative/qml/qdeclarativefastproperties_p.h b/src/declarative/qml/qdeclarativefastproperties_p.h
index 268dd474..9d3ead0a 100644
--- a/src/declarative/qml/qdeclarativefastproperties_p.h
+++ b/src/declarative/qml/qdeclarativefastproperties_p.h
@@ -45,8 +45,6 @@
#include <QtCore/qvector.h>
#include <QtCore/qhash.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QObject;
@@ -71,6 +69,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEFASTPROPERTIES_P_H
diff --git a/src/declarative/qml/qdeclarativeglobal_p.h b/src/declarative/qml/qdeclarativeglobal_p.h
index 52b14ffe..11ebd3fd 100644
--- a/src/declarative/qml/qdeclarativeglobal_p.h
+++ b/src/declarative/qml/qdeclarativeglobal_p.h
@@ -45,8 +45,6 @@
#include <QtCore/qglobal.h>
#include <QtCore/QObject>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -105,6 +103,4 @@ inline void QDeclarative_setParent_noEvent(QObject *object, QObject *parent)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEGLOBAL_H
diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp
index 94498967..0b14ee6f 100644
--- a/src/declarative/qml/qdeclarativeimageprovider.cpp
+++ b/src/declarative/qml/qdeclarativeimageprovider.cpp
@@ -115,8 +115,10 @@ public:
{
...
- QDeclarativeEngine engine;
- engine->addImageProvider(QLatin1String("colors"), new ColorPixmapProvider);
+ QDeclarativeView *view = new QDeclarativeView;
+ view->engine()->addImageProvider(QLatin1String("colors"),
+ new ColorPixmapProvider);
+ view->setSource(QUrl::fromLocalFile("main.qml"));
...
}
diff --git a/src/declarative/qml/qdeclarativeimageprovider.h b/src/declarative/qml/qdeclarativeimageprovider.h
index eb5b032e..1b6cc333 100644
--- a/src/declarative/qml/qdeclarativeimageprovider.h
+++ b/src/declarative/qml/qdeclarativeimageprovider.h
@@ -46,8 +46,6 @@
#include <QtGui/qimage.h>
#include <QtGui/qpixmap.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -76,6 +74,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEIMAGEPROVIDER
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp
index 94883abd..caf97b25 100644
--- a/src/declarative/qml/qdeclarativeimport.cpp
+++ b/src/declarative/qml/qdeclarativeimport.cpp
@@ -441,6 +441,13 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp
set.insert(prefix,(s=new QDeclarativeImportedNamespace));
}
+ bool appendInstead = false;
+ if (importType == QDeclarativeScriptParser::Import::Implicit) {
+ //Treat same as a File import, but lower precedence
+ appendInstead = true;
+ importType = QDeclarativeScriptParser::Import::File;
+ }
+
QString url = uri;
bool versionFound = false;
if (importType == QDeclarativeScriptParser::Import::Library) {
@@ -511,6 +518,9 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp
if (QDeclarativeMetaType::isModule(uri.toUtf8(), vmaj, vmin))
versionFound = true;
+ //Load any type->file mappings registered for this uri
+ qmldircomponents << QDeclarativeMetaType::qmlComponents(uri.toUtf8(), vmaj, vmin);
+
if (!versionFound && qmldircomponents.isEmpty()) {
if (errorString) {
bool anyversion = QDeclarativeMetaType::isModule(uri.toUtf8(), -1, -1);
@@ -588,12 +598,21 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp
}
}
- s->uris.prepend(uri);
- s->urls.prepend(url);
- s->majversions.prepend(vmaj);
- s->minversions.prepend(vmin);
- s->isLibrary.prepend(importType == QDeclarativeScriptParser::Import::Library);
- s->qmlDirComponents.prepend(qmldircomponents);
+ if (appendInstead) {
+ s->uris.append(uri);
+ s->urls.append(url);
+ s->majversions.append(vmaj);
+ s->minversions.append(vmin);
+ s->isLibrary.append(importType == QDeclarativeScriptParser::Import::Library);
+ s->qmlDirComponents.append(qmldircomponents);
+ } else {
+ s->uris.prepend(uri);
+ s->urls.prepend(url);
+ s->majversions.prepend(vmaj);
+ s->minversions.prepend(vmin);
+ s->isLibrary.prepend(importType == QDeclarativeScriptParser::Import::Library);
+ s->qmlDirComponents.prepend(qmldircomponents);
+ }
return true;
}
diff --git a/src/declarative/qml/qdeclarativeinfo.h b/src/declarative/qml/qdeclarativeinfo.h
index 8b9622d8..7b23a341 100644
--- a/src/declarative/qml/qdeclarativeinfo.h
+++ b/src/declarative/qml/qdeclarativeinfo.h
@@ -46,8 +46,6 @@
#include <QtCore/qurl.h>
#include <QtDeclarative/qdeclarativeerror.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -99,6 +97,4 @@ Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo(const QObject *me, const QList<QDe
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEINFO_H
diff --git a/src/declarative/qml/qdeclarativelist.h b/src/declarative/qml/qdeclarativelist.h
index 9722cefb..9b367dd1 100644
--- a/src/declarative/qml/qdeclarativelist.h
+++ b/src/declarative/qml/qdeclarativelist.h
@@ -46,8 +46,6 @@
#include <QtCore/qlist.h>
#include <QtCore/qvariant.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -147,6 +145,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QDeclarativeListReference)
-QT_END_HEADER
-
#endif // QDECLARATIVELIST_H
diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp
index 1d143963..d90ccad8 100644
--- a/src/declarative/qml/qdeclarativemetatype.cpp
+++ b/src/declarative/qml/qdeclarativemetatype.cpp
@@ -54,6 +54,8 @@
#include <QtCore/qmetaobject.h>
#include <QtCore/qbitarray.h>
#include <QtCore/qreadwritelock.h>
+#include <qfileinfo.h>
+#include <qdir.h>
#include <qmetatype.h>
#include <qobjectdefs.h>
#include <qdatetime.h>
@@ -122,6 +124,15 @@ struct QDeclarativeMetaTypeData
Q_GLOBAL_STATIC(QDeclarativeMetaTypeData, metaTypeData)
Q_GLOBAL_STATIC(QReadWriteLock, metaTypeDataLock)
+struct QDeclarativeRegisteredComponentData
+{
+ ~QDeclarativeRegisteredComponentData() {} ;
+ QMap<QByteArray, QDeclarativeDirComponents*> registeredComponents;
+};
+
+Q_GLOBAL_STATIC(QDeclarativeRegisteredComponentData, registeredComponentData)
+Q_GLOBAL_STATIC(QReadWriteLock, registeredComponentDataLock)
+
QDeclarativeMetaTypeData::~QDeclarativeMetaTypeData()
{
for (int i = 0; i < types.count(); ++i)
@@ -667,6 +678,45 @@ int registerType(const QDeclarativePrivate::RegisterType &type)
return index;
}
+int registerComponent(const QDeclarativePrivate::RegisterComponent& data)
+{
+ if (data.typeName) {
+ for (int ii = 0; data.typeName[ii]; ++ii) {
+ if (!isalnum(data.typeName[ii])) {
+ qWarning("qmlRegisterType(): Invalid QML type name \"%s\"", data.typeName);
+ return 0;
+ }
+ }
+ } else {
+ qWarning("qmlRegisterType(): No QML type name for \"%s\"", data.url.toString().toLatin1().constData());
+ return 0;
+ }
+
+ QWriteLocker lock(registeredComponentDataLock());
+ QString path;
+ // Relative paths are relative to application working directory
+ if (data.url.isRelative() || data.url.scheme() == QLatin1String("file")) // Workaround QTBUG-11929
+ path = QUrl::fromLocalFile(QDir::currentPath()+QLatin1String("/")).resolved(data.url).toString();
+ else
+ path = data.url.toString();
+ QDeclarativeRegisteredComponentData *d = registeredComponentData();
+ QDeclarativeDirParser::Component comp(
+ QString::fromUtf8(data.typeName),
+ path,
+ data.majorVersion,
+ data.minorVersion
+ );
+
+ QDeclarativeDirComponents* comps = d->registeredComponents.value(QByteArray(data.uri), 0);
+ if (!comps)
+ d->registeredComponents.insert(QByteArray(data.uri), comps = new QDeclarativeDirComponents);
+
+ // Types added later should take precedence, like registerType
+ comps->prepend(comp);
+
+ return 1;
+}
+
/*
This method is "over generalized" to allow us to (potentially) register more types of things in
the future without adding exported symbols.
@@ -679,6 +729,8 @@ int QDeclarativePrivate::qmlregister(RegistrationType type, void *data)
return registerInterface(*reinterpret_cast<RegisterInterface *>(data));
} else if (type == AutoParentRegistration) {
return registerAutoParentFunction(*reinterpret_cast<RegisterAutoParent *>(data));
+ } else if (type == ComponentRegistration) {
+ return registerComponent(*reinterpret_cast<RegisterComponent *>(data));
}
return -1;
}
@@ -984,6 +1036,29 @@ QDeclarativeType *QDeclarativeMetaType::qmlType(int userType)
}
/*!
+ Returns the component(s) that have been registered for the module specified by \a uri and the version specified
+ by \a version_major and \a version_minor. Returns an empty list if no such components were registered.
+*/
+QDeclarativeDirComponents QDeclarativeMetaType::qmlComponents(const QByteArray &module, int version_major, int version_minor)
+{
+ QReadLocker lock(registeredComponentDataLock());
+ QDeclarativeRegisteredComponentData *data = registeredComponentData();
+
+ QDeclarativeDirComponents* comps = data->registeredComponents.value(module, 0);
+ if (!comps)
+ return QDeclarativeDirComponents();
+ QDeclarativeDirComponents ret = *comps;
+ for (int i = ret.count() - 1; i >= 0; i--) {
+ QDeclarativeDirParser::Component &c = ret[i];
+ if (version_major >= 0 && (c.majorVersion != version_major || c.minorVersion > version_minor))
+ ret.removeAt(i);
+ }
+
+ return ret;
+}
+
+
+/*!
Returns the list of registered QML type names.
*/
QList<QByteArray> QDeclarativeMetaType::qmlTypeNames()
diff --git a/src/declarative/qml/qdeclarativemetatype_p.h b/src/declarative/qml/qdeclarativemetatype_p.h
index b8c958c3..2ba391a0 100644
--- a/src/declarative/qml/qdeclarativemetatype_p.h
+++ b/src/declarative/qml/qdeclarativemetatype_p.h
@@ -59,6 +59,7 @@
#include <QtCore/qvariant.h>
#include <QtCore/qbitarray.h>
#include <private/qtdeclarativeglobal_p.h>
+#include <private/qdeclarativedirparser_p.h>
QT_BEGIN_NAMESPACE
@@ -80,6 +81,8 @@ public:
static QDeclarativeType *qmlType(const QMetaObject *metaObject, const QByteArray &module, int version_major, int version_minor);
static QDeclarativeType *qmlType(int);
+ static QDeclarativeDirComponents qmlComponents(const QByteArray& module, int version_major, int version_minor); //### Is this the right place?
+
static QMetaProperty defaultProperty(const QMetaObject *);
static QMetaProperty defaultProperty(QObject *);
static QMetaMethod defaultMethod(const QMetaObject *);
@@ -161,6 +164,7 @@ private:
friend struct QDeclarativeMetaTypeData;
friend int registerType(const QDeclarativePrivate::RegisterType &);
friend int registerInterface(const QDeclarativePrivate::RegisterInterface &);
+ friend int registerComponent(const QDeclarativePrivate::RegisterComponent &);
QDeclarativeType(int, const QDeclarativePrivate::RegisterInterface &);
QDeclarativeType(int, const QDeclarativePrivate::RegisterType &);
~QDeclarativeType();
diff --git a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.h b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.h
index 22824b23..e791825c 100644
--- a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.h
+++ b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.h
@@ -45,8 +45,6 @@
#include <QtDeclarative/qtdeclarativeglobal.h>
#include <QtCore/qobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -62,6 +60,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVENETWORKACCESSMANAGERFACTORY_H
diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h
index 42c45210..7a968f1c 100644
--- a/src/declarative/qml/qdeclarativeparser_p.h
+++ b/src/declarative/qml/qdeclarativeparser_p.h
@@ -65,8 +65,6 @@
#include <private/qdeclarativerefcount_p.h>
#include <private/qdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -376,6 +374,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QDeclarativeParser::Variant)
-QT_END_HEADER
-
#endif // QDECLARATIVEPARSER_P_H
diff --git a/src/declarative/qml/qdeclarativeparserstatus.h b/src/declarative/qml/qdeclarativeparserstatus.h
index d2c809db..68a526fb 100644
--- a/src/declarative/qml/qdeclarativeparserstatus.h
+++ b/src/declarative/qml/qdeclarativeparserstatus.h
@@ -45,8 +45,6 @@
#include <QtDeclarative/qtdeclarativeglobal.h>
#include <QtCore/qobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -74,6 +72,4 @@ Q_DECLARE_INTERFACE(QDeclarativeParserStatus, QDeclarativeParserStatus_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEPARSERSTATUS_H
diff --git a/src/declarative/qml/qdeclarativeprivate.h b/src/declarative/qml/qdeclarativeprivate.h
index ab9fe415..05a457c3 100644
--- a/src/declarative/qml/qdeclarativeprivate.h
+++ b/src/declarative/qml/qdeclarativeprivate.h
@@ -56,8 +56,6 @@
#include <QtDeclarative/qtdeclarativeglobal.h>
#include <QtCore/qvariant.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -233,10 +231,19 @@ namespace QDeclarativePrivate
AutoParentFunction function;
};
+ struct RegisterComponent {
+ const QUrl &url;
+ const char *uri;
+ const char *typeName;
+ int majorVersion;
+ int minorVersion;
+ };
+
enum RegistrationType {
TypeRegistration = 0,
InterfaceRegistration = 1,
- AutoParentRegistration = 2
+ AutoParentRegistration = 2,
+ ComponentRegistration = 3
};
int Q_DECLARATIVE_EXPORT qmlregister(RegistrationType, void *);
@@ -244,6 +251,4 @@ namespace QDeclarativePrivate
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEPRIVATE_H
diff --git a/src/declarative/qml/qdeclarativeproperty.h b/src/declarative/qml/qdeclarativeproperty.h
index 7e8cbcf8..a6ae48d5 100644
--- a/src/declarative/qml/qdeclarativeproperty.h
+++ b/src/declarative/qml/qdeclarativeproperty.h
@@ -45,8 +45,6 @@
#include <QtDeclarative/qtdeclarativeglobal.h>
#include <QtCore/qmetaobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -139,6 +137,4 @@ inline uint qHash (const QDeclarativeProperty &key)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEPROPERTY_H
diff --git a/src/declarative/qml/qdeclarativepropertyvalueinterceptor.h b/src/declarative/qml/qdeclarativepropertyvalueinterceptor.h
index 71050211..f0a0a717 100644
--- a/src/declarative/qml/qdeclarativepropertyvalueinterceptor.h
+++ b/src/declarative/qml/qdeclarativepropertyvalueinterceptor.h
@@ -45,8 +45,6 @@
#include <QtDeclarative/qtdeclarativeglobal.h>
#include <QtCore/qobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -67,6 +65,4 @@ Q_DECLARE_INTERFACE(QDeclarativePropertyValueInterceptor, QDeclarativePropertyVa
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEPROPERTYVALUEINTERCEPTOR_H
diff --git a/src/declarative/qml/qdeclarativepropertyvaluesource.h b/src/declarative/qml/qdeclarativepropertyvaluesource.h
index fced27ec..e072fbd0 100644
--- a/src/declarative/qml/qdeclarativepropertyvaluesource.h
+++ b/src/declarative/qml/qdeclarativepropertyvaluesource.h
@@ -45,8 +45,6 @@
#include <QtDeclarative/qtdeclarativeglobal.h>
#include <QtCore/qobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -66,6 +64,4 @@ Q_DECLARE_INTERFACE(QDeclarativePropertyValueSource, QDeclarativePropertyValueSo
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEPROPERTYVALUESOURCE_H
diff --git a/src/declarative/qml/qdeclarativeproxymetaobject_p.h b/src/declarative/qml/qdeclarativeproxymetaobject_p.h
index 2178a939..6bfe1991 100644
--- a/src/declarative/qml/qdeclarativeproxymetaobject_p.h
+++ b/src/declarative/qml/qdeclarativeproxymetaobject_p.h
@@ -61,8 +61,6 @@
#include <private/qobject_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -94,7 +92,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEPROXYMETAOBJECT_P_H
diff --git a/src/declarative/qml/qdeclarativerefcount_p.h b/src/declarative/qml/qdeclarativerefcount_p.h
index 3c2780ee..ac847c6e 100644
--- a/src/declarative/qml/qdeclarativerefcount_p.h
+++ b/src/declarative/qml/qdeclarativerefcount_p.h
@@ -55,8 +55,6 @@
#include <QtDeclarative/qtdeclarativeglobal.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -75,6 +73,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEREFCOUNT_P_H
diff --git a/src/declarative/qml/qdeclarativescriptparser_p.h b/src/declarative/qml/qdeclarativescriptparser_p.h
index 831e1a40..42a29752 100644
--- a/src/declarative/qml/qdeclarativescriptparser_p.h
+++ b/src/declarative/qml/qdeclarativescriptparser_p.h
@@ -58,8 +58,6 @@
#include <QtCore/QList>
#include <QtCore/QUrl>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -75,7 +73,7 @@ public:
public:
Import() : type(Library) {}
- enum Type { Library, File, Script };
+ enum Type { Library, File, Script, Implicit }; //Implicit is only used internally
Type type;
QString uri;
@@ -143,6 +141,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVESCRIPTPARSER_P_H
diff --git a/src/declarative/qml/qdeclarativescriptstring.h b/src/declarative/qml/qdeclarativescriptstring.h
index f84bb980..0bb58093 100644
--- a/src/declarative/qml/qdeclarativescriptstring.h
+++ b/src/declarative/qml/qdeclarativescriptstring.h
@@ -47,8 +47,6 @@
#include <QtCore/qshareddata.h>
#include <QtCore/qmetatype.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -82,7 +80,5 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QDeclarativeScriptString)
-QT_END_HEADER
-
#endif // QDECLARATIVESCRIPTSTRING_H
diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp
index ee73b738..42847ea9 100644
--- a/src/declarative/qml/qdeclarativetypeloader.cpp
+++ b/src/declarative/qml/qdeclarativetypeloader.cpp
@@ -1055,19 +1055,6 @@ void QDeclarativeTypeData::resolveTypes()
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(m_typeLoader->engine());
QDeclarativeImportDatabase *importDatabase = &ep->importDatabase;
- // For local urls, add an implicit import "." as first (most overridden) lookup.
- // This will also trigger the loading of the qmldir and the import of any native
- // types from available plugins.
- if (QDeclarativeQmldirData *qmldir = qmldirForUrl(finalUrl().resolved(QUrl(QLatin1String("./qmldir"))))) {
- m_imports.addImport(importDatabase, QLatin1String("."),
- QString(), -1, -1, QDeclarativeScriptParser::Import::File,
- qmldir->dirComponents(), 0);
- } else {
- m_imports.addImport(importDatabase, QLatin1String("."),
- QString(), -1, -1, QDeclarativeScriptParser::Import::File,
- QDeclarativeDirComponents(), 0);
- }
-
foreach (const QDeclarativeScriptParser::Import &import, scriptParser.imports()) {
QDeclarativeDirComponents qmldircomponentsnetwork;
if (import.type == QDeclarativeScriptParser::Import::Script)
@@ -1107,6 +1094,7 @@ void QDeclarativeTypeData::resolveTypes()
}
}
+ bool implicitImportLoaded = false;
foreach (QDeclarativeScriptParser::TypeReference *parserRef, scriptParser.referencedTypes()) {
QByteArray typeName = parserRef->name.toUtf8();
@@ -1123,23 +1111,49 @@ void QDeclarativeTypeData::resolveTypes()
// Known to not be a type:
// - known to be a namespace (Namespace {})
// - type with unknown namespace (UnknownNamespace.SomeType {})
- QDeclarativeError error;
- error.setUrl(m_imports.baseUrl());
- QString userTypeName = parserRef->name;
- userTypeName.replace(QLatin1Char('/'),QLatin1Char('.'));
- if (typeNamespace)
- error.setDescription(QDeclarativeTypeLoader::tr("Namespace %1 cannot be used as a type").arg(userTypeName));
- else
- error.setDescription(QDeclarativeTypeLoader::tr("%1 %2").arg(userTypeName).arg(errorString));
-
- if (!parserRef->refObjects.isEmpty()) {
- QDeclarativeParser::Object *obj = parserRef->refObjects.first();
- error.setLine(obj->location.start.line);
- error.setColumn(obj->location.start.column);
+ bool typeFound = false;
+
+ if (!typeNamespace && !implicitImportLoaded) {
+ implicitImportLoaded = true;
+ // For local urls, add an implicit import "." as most overridden lookup.
+ // This will also trigger the loading of the qmldir and the import of any native
+ // types from available plugins.
+ // This is only done if the type is not otherwise found, side effects of plugin loading may be avoided
+ // ### This should be an acceptable variation because A) It's only side effects (and img providers) B) You shouldn't be doing that in "." anyways!
+ if (QDeclarativeQmldirData *qmldir = qmldirForUrl(finalUrl().resolved(QUrl(QLatin1String("./qmldir"))))) {
+ m_imports.addImport(importDatabase, QLatin1String("."),
+ QString(), -1, -1, QDeclarativeScriptParser::Import::Implicit,
+ qmldir->dirComponents(), 0);
+ } else {
+ m_imports.addImport(importDatabase, QLatin1String("."),
+ QString(), -1, -1, QDeclarativeScriptParser::Import::Implicit,
+ QDeclarativeDirComponents(), 0);
+ }
+ if (m_imports.resolveType(typeName, &ref.type, &url, &majorVersion, &minorVersion,
+ &typeNamespace, &errorString) || typeNamespace) {
+ typeFound = true;
+ }
+ }
+
+ if (!typeFound) {
+ QDeclarativeError error;
+ error.setUrl(m_imports.baseUrl());
+ QString userTypeName = parserRef->name;
+ userTypeName.replace(QLatin1Char('/'),QLatin1Char('.'));
+ if (typeNamespace)
+ error.setDescription(QDeclarativeTypeLoader::tr("Namespace %1 cannot be used as a type").arg(userTypeName));
+ else
+ error.setDescription(QDeclarativeTypeLoader::tr("%1 %2").arg(userTypeName).arg(errorString));
+
+ if (!parserRef->refObjects.isEmpty()) {
+ QDeclarativeParser::Object *obj = parserRef->refObjects.first();
+ error.setLine(obj->location.start.line);
+ error.setColumn(obj->location.start.column);
+ }
+
+ setError(error);
+ return;
}
-
- setError(error);
- return;
}
if (ref.type) {
diff --git a/src/declarative/qml/qdeclarativetypenotavailable_p.h b/src/declarative/qml/qdeclarativetypenotavailable_p.h
index 7a6b46fc..c16231cb 100644
--- a/src/declarative/qml/qdeclarativetypenotavailable_p.h
+++ b/src/declarative/qml/qdeclarativetypenotavailable_p.h
@@ -44,8 +44,6 @@
#include <qdeclarative.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -60,6 +58,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeTypeNotAvailable)
-QT_END_HEADER
-
#endif // QDECLARATIVETYPENOTAVAILABLE_H
diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp
index f3adbe76..c4be742c 100644
--- a/src/declarative/qml/qdeclarativevme.cpp
+++ b/src/declarative/qml/qdeclarativevme.cpp
@@ -534,12 +534,13 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEObjectStack &stack,
QObject *target = stack.top();
CLEAN_PROPERTY(target, instr.storeDateTime.propertyIndex);
- QTime t;
- t.setHMS(intData.at(instr.storeDateTime.valueIndex+1),
- intData.at(instr.storeDateTime.valueIndex+2),
- intData.at(instr.storeDateTime.valueIndex+3),
- intData.at(instr.storeDateTime.valueIndex+4));
- QDateTime dt(QDate::fromJulianDay(intData.at(instr.storeDateTime.valueIndex)), t);
+ const qint64 julianDay = qint64((quint64)(uint)(intData.at(instr.storeDateTime.valueIndex)))
+ + (qint64(intData.at(instr.storeDateTime.valueIndex + 1)) << 32);
+ QDateTime dt(QDate::fromJulianDay(julianDay),
+ QTime(intData.at(instr.storeDateTime.valueIndex + 2),
+ intData.at(instr.storeDateTime.valueIndex + 3),
+ intData.at(instr.storeDateTime.valueIndex + 4),
+ intData.at(instr.storeDateTime.valueIndex + 5)));
void *a[] = { &dt, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeDateTime.propertyIndex, a);
diff --git a/src/declarative/qml/qdeclarativeworkerscript_p.h b/src/declarative/qml/qdeclarativeworkerscript_p.h
index 1581fe57..ee271279 100644
--- a/src/declarative/qml/qdeclarativeworkerscript_p.h
+++ b/src/declarative/qml/qdeclarativeworkerscript_p.h
@@ -60,8 +60,6 @@
#include <QtScript/qscriptvalue.h>
#include <QtCore/qurl.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -124,6 +122,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeWorkerScript)
-QT_END_HEADER
-
#endif // QDECLARATIVEWORKERSCRIPT_P_H
diff --git a/src/declarative/qml/rewriter/textwriter_p.h b/src/declarative/qml/rewriter/textwriter_p.h
index 8a1dfdc8..38b81f6a 100644
--- a/src/declarative/qml/rewriter/textwriter_p.h
+++ b/src/declarative/qml/rewriter/textwriter_p.h
@@ -48,7 +48,6 @@
#include <QtCore/QList>
#include <QtGui/QTextCursor>
-QT_BEGIN_HEADER
QT_QML_BEGIN_NAMESPACE
namespace QDeclarativeJS {
@@ -96,6 +95,5 @@ public:
} // end of namespace QDeclarativeJS
QT_QML_END_NAMESPACE
-QT_END_HEADER
#endif // TEXTWRITER_H
diff --git a/src/declarative/qtdeclarativeglobal.h b/src/declarative/qtdeclarativeglobal.h
index dcfe3bea..e3237ba4 100644
--- a/src/declarative/qtdeclarativeglobal.h
+++ b/src/declarative/qtdeclarativeglobal.h
@@ -44,8 +44,6 @@
#include <QtCore/qglobal.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// This definition is in the process of being removed from qtbase - once it
@@ -66,6 +64,4 @@ QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QTDECLARATIVEGLOBAL_H
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 83bfa170..a72df77a 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -160,10 +160,6 @@ void QDeclarativeAbstractAnimationPrivate::commence()
q->transition(actions, properties, QDeclarativeAbstractAnimation::Forward);
q->qtAnimation()->start();
- if (q->qtAnimation()->state() != QAbstractAnimation::Running) {
- running = false;
- emit q->completed();
- }
}
QDeclarativeProperty QDeclarativeAbstractAnimationPrivate::createProperty(QObject *obj, const QString &str, QObject *infoObj)
diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h
index 478e30b3..ee301c74 100644
--- a/src/declarative/util/qdeclarativeanimation_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p.h
@@ -55,8 +55,6 @@
#include <QtCore/QAbstractAnimation>
#include <QtGui/qcolor.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -534,6 +532,4 @@ QML_DECLARE_TYPE(QDeclarativeRotationAnimation)
QML_DECLARE_TYPE(QDeclarativeParentAnimation)
QML_DECLARE_TYPE(QDeclarativeAnchorAnimation)
-QT_END_HEADER
-
#endif // QDECLARATIVEANIMATION_H
diff --git a/src/declarative/util/qdeclarativeapplication_p.h b/src/declarative/util/qdeclarativeapplication_p.h
index f8fdc95e..115413e2 100644
--- a/src/declarative/util/qdeclarativeapplication_p.h
+++ b/src/declarative/util/qdeclarativeapplication_p.h
@@ -46,8 +46,6 @@
#include <qdeclarative.h>
#include <private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -81,6 +79,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeApplication)
-QT_END_HEADER
-
#endif // QDECLARATIVEAPPLICATION_P_H
diff --git a/src/declarative/util/qdeclarativebehavior_p.h b/src/declarative/util/qdeclarativebehavior_p.h
index 06c09603..7a26d4a9 100644
--- a/src/declarative/util/qdeclarativebehavior_p.h
+++ b/src/declarative/util/qdeclarativebehavior_p.h
@@ -49,8 +49,6 @@
#include <qdeclarative.h>
#include <QtCore/QAbstractAnimation>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -93,6 +91,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeBehavior)
-QT_END_HEADER
-
#endif // QDECLARATIVEBEHAVIOR_H
diff --git a/src/declarative/util/qdeclarativebind_p.h b/src/declarative/util/qdeclarativebind_p.h
index d0ef54eb..0e4350ec 100644
--- a/src/declarative/util/qdeclarativebind_p.h
+++ b/src/declarative/util/qdeclarativebind_p.h
@@ -46,8 +46,6 @@
#include <QtCore/qobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -91,6 +89,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeBind)
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/util/qdeclarativeconnections_p.h b/src/declarative/util/qdeclarativeconnections_p.h
index 60be24a4..7c06d4a5 100644
--- a/src/declarative/util/qdeclarativeconnections_p.h
+++ b/src/declarative/util/qdeclarativeconnections_p.h
@@ -49,8 +49,6 @@
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -98,6 +96,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeConnections)
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/util/qdeclarativefontloader_p.h b/src/declarative/util/qdeclarativefontloader_p.h
index aa7dcabb..06860980 100644
--- a/src/declarative/util/qdeclarativefontloader_p.h
+++ b/src/declarative/util/qdeclarativefontloader_p.h
@@ -47,8 +47,6 @@
#include <QtCore/qobject.h>
#include <QtCore/qurl.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -91,7 +89,5 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeFontLoader)
-QT_END_HEADER
-
#endif // QDECLARATIVEFONTLOADER_H
diff --git a/src/declarative/util/qdeclarativelistaccessor_p.h b/src/declarative/util/qdeclarativelistaccessor_p.h
index 94f49150..cb7bbf3f 100644
--- a/src/declarative/util/qdeclarativelistaccessor_p.h
+++ b/src/declarative/util/qdeclarativelistaccessor_p.h
@@ -44,8 +44,6 @@
#include <QtCore/QVariant>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -75,6 +73,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVELISTACCESSOR_H
diff --git a/src/declarative/util/qdeclarativelistmodel_p.h b/src/declarative/util/qdeclarativelistmodel_p.h
index 567ac1fc..e4fa2eea 100644
--- a/src/declarative/util/qdeclarativelistmodel_p.h
+++ b/src/declarative/util/qdeclarativelistmodel_p.h
@@ -53,8 +53,6 @@
#include <private/qlistmodelinterface_p.h>
#include <QtScript/qscriptvalue.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -153,6 +151,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeListModel)
QML_DECLARE_TYPE(QDeclarativeListElement)
-QT_END_HEADER
-
#endif // QDECLARATIVELISTMODEL_H
diff --git a/src/declarative/util/qdeclarativelistmodel_p_p.h b/src/declarative/util/qdeclarativelistmodel_p_p.h
index 8beb5fa8..5b204a9a 100644
--- a/src/declarative/util/qdeclarativelistmodel_p_p.h
+++ b/src/declarative/util/qdeclarativelistmodel_p_p.h
@@ -60,8 +60,6 @@
#include <private/qscriptdeclarativeclass_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -275,7 +273,5 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(ModelNode *)
-QT_END_HEADER
-
#endif // QDECLARATIVELISTMODEL_P_P_H
diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent_p.h b/src/declarative/util/qdeclarativelistmodelworkeragent_p.h
index a12897c9..b076a855 100644
--- a/src/declarative/util/qdeclarativelistmodelworkeragent_p.h
+++ b/src/declarative/util/qdeclarativelistmodelworkeragent_p.h
@@ -60,8 +60,6 @@
#include <QMutex>
#include <QWaitCondition>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -157,7 +155,5 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QDeclarativeListModelWorkerAgent::VariantRef)
-QT_END_HEADER
-
#endif // QDECLARATIVEWORKERSCRIPT_P_H
diff --git a/src/declarative/util/qdeclarativeopenmetaobject_p.h b/src/declarative/util/qdeclarativeopenmetaobject_p.h
index 9ff064b2..e637e53c 100644
--- a/src/declarative/util/qdeclarativeopenmetaobject_p.h
+++ b/src/declarative/util/qdeclarativeopenmetaobject_p.h
@@ -49,8 +49,6 @@
#include <private/qdeclarativerefcount_p.h>
#include <private/qobject_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -124,6 +122,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEOPENMETAOBJECT_H
diff --git a/src/declarative/util/qdeclarativepackage_p.h b/src/declarative/util/qdeclarativepackage_p.h
index 4a418799..fad2ed08 100644
--- a/src/declarative/util/qdeclarativepackage_p.h
+++ b/src/declarative/util/qdeclarativepackage_p.h
@@ -44,8 +44,6 @@
#include <qdeclarative.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -93,6 +91,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativePackage)
QML_DECLARE_TYPEINFO(QDeclarativePackage, QML_HAS_ATTACHED_PROPERTIES)
-QT_END_HEADER
-
#endif // QDECLARATIVEPACKAGE_H
diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h
index 0d1ca5f7..e2f99fbf 100644
--- a/src/declarative/util/qdeclarativepixmapcache_p.h
+++ b/src/declarative/util/qdeclarativepixmapcache_p.h
@@ -49,8 +49,6 @@
#include <QtGui/qpixmap.h>
#include <QtCore/qurl.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -121,6 +119,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativePixmap::Options)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEPIXMAPCACHE_H
diff --git a/src/declarative/util/qdeclarativepropertychanges_p.h b/src/declarative/util/qdeclarativepropertychanges_p.h
index f6e36f41..fc7295bd 100644
--- a/src/declarative/util/qdeclarativepropertychanges_p.h
+++ b/src/declarative/util/qdeclarativepropertychanges_p.h
@@ -45,8 +45,6 @@
#include "private/qdeclarativestateoperations_p.h"
#include <private/qdeclarativecustomparser_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -107,6 +105,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativePropertyChanges)
-QT_END_HEADER
-
#endif // QDECLARATIVEPROPERTYCHANGES_H
diff --git a/src/declarative/util/qdeclarativepropertymap.h b/src/declarative/util/qdeclarativepropertymap.h
index e817e278..aaf38295 100644
--- a/src/declarative/util/qdeclarativepropertymap.h
+++ b/src/declarative/util/qdeclarativepropertymap.h
@@ -48,8 +48,6 @@
#include <QtCore/QStringList>
#include <QtCore/QVariant>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -86,6 +84,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp
index 1e68a7a1..240bc5d6 100644
--- a/src/declarative/util/qdeclarativesmoothedanimation.cpp
+++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp
@@ -100,10 +100,10 @@ bool QSmoothedAnimation::recalc()
s = (invert? qreal(-1.0): qreal(1.0)) * s;
- if (userDuration > 0 && velocity > 0) {
+ if (userDuration >= 0 && velocity > 0) {
tf = s / velocity;
if (tf > (userDuration / qreal(1000.))) tf = (userDuration / qreal(1000.));
- } else if (userDuration > 0) {
+ } else if (userDuration >= 0) {
tf = userDuration / qreal(1000.);
} else if (velocity > 0) {
tf = s / velocity;
diff --git a/src/declarative/util/qdeclarativesmoothedanimation_p.h b/src/declarative/util/qdeclarativesmoothedanimation_p.h
index ae272c0b..173df791 100644
--- a/src/declarative/util/qdeclarativesmoothedanimation_p.h
+++ b/src/declarative/util/qdeclarativesmoothedanimation_p.h
@@ -47,8 +47,6 @@
#include <QtCore/qobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -98,6 +96,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeSmoothedAnimation)
-QT_END_HEADER
-
#endif // QDECLARATIVESMOOTHEDANIMATION_H
diff --git a/src/declarative/util/qdeclarativespringanimation_p.h b/src/declarative/util/qdeclarativespringanimation_p.h
index 423d5322..b55d8dca 100644
--- a/src/declarative/util/qdeclarativespringanimation_p.h
+++ b/src/declarative/util/qdeclarativespringanimation_p.h
@@ -47,8 +47,6 @@
#include <QtCore/qobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -106,6 +104,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeSpringAnimation)
-QT_END_HEADER
-
#endif // QDECLARATIVESPRINGANIMATION_H
diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h
index 049397e5..ee3c8bf8 100644
--- a/src/declarative/util/qdeclarativestate_p.h
+++ b/src/declarative/util/qdeclarativestate_p.h
@@ -48,8 +48,6 @@
#include <QtCore/qsharedpointer.h>
#include <private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -205,6 +203,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeStateOperation)
QML_DECLARE_TYPE(QDeclarativeState)
-QT_END_HEADER
-
#endif // QDECLARATIVESTATE_H
diff --git a/src/declarative/util/qdeclarativestategroup_p.h b/src/declarative/util/qdeclarativestategroup_p.h
index 2a0fa87c..c5a1a75f 100644
--- a/src/declarative/util/qdeclarativestategroup_p.h
+++ b/src/declarative/util/qdeclarativestategroup_p.h
@@ -44,8 +44,6 @@
#include "private/qdeclarativestate_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -90,6 +88,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeStateGroup)
-QT_END_HEADER
-
#endif // QDECLARATIVESTATEGROUP_H
diff --git a/src/declarative/util/qdeclarativestateoperations_p.h b/src/declarative/util/qdeclarativestateoperations_p.h
index 6cf28416..01b3e1d8 100644
--- a/src/declarative/util/qdeclarativestateoperations_p.h
+++ b/src/declarative/util/qdeclarativestateoperations_p.h
@@ -48,8 +48,6 @@
#include <private/qdeclarativeanchors_p.h>
#include <qdeclarativescriptstring.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -294,6 +292,4 @@ QML_DECLARE_TYPE(QDeclarativeStateChangeScript)
QML_DECLARE_TYPE(QDeclarativeAnchorSet)
QML_DECLARE_TYPE(QDeclarativeAnchorChanges)
-QT_END_HEADER
-
#endif // QDECLARATIVESTATEOPERATIONS_H
diff --git a/src/declarative/util/qdeclarativesystempalette_p.h b/src/declarative/util/qdeclarativesystempalette_p.h
index 5a8561ed..306cadab 100644
--- a/src/declarative/util/qdeclarativesystempalette_p.h
+++ b/src/declarative/util/qdeclarativesystempalette_p.h
@@ -47,8 +47,6 @@
#include <QtCore/qobject.h>
#include <QPalette>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -117,6 +115,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeSystemPalette)
-QT_END_HEADER
-
#endif // QDECLARATIVESYSTEMPALETTE_H
diff --git a/src/declarative/util/qdeclarativetimer_p.h b/src/declarative/util/qdeclarativetimer_p.h
index 805ac348..a6730bcc 100644
--- a/src/declarative/util/qdeclarativetimer_p.h
+++ b/src/declarative/util/qdeclarativetimer_p.h
@@ -49,8 +49,6 @@
#include <private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -110,6 +108,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeTimer)
-QT_END_HEADER
-
#endif
diff --git a/src/declarative/util/qdeclarativetransition_p.h b/src/declarative/util/qdeclarativetransition_p.h
index 961790e5..b704e654 100644
--- a/src/declarative/util/qdeclarativetransition_p.h
+++ b/src/declarative/util/qdeclarativetransition_p.h
@@ -48,8 +48,6 @@
#include <QtCore/qobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -101,6 +99,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeTransition)
-QT_END_HEADER
-
#endif // QDECLARATIVETRANSITION_H
diff --git a/src/declarative/util/qdeclarativeutilmodule_p.h b/src/declarative/util/qdeclarativeutilmodule_p.h
index 6ba28400..05fae76e 100644
--- a/src/declarative/util/qdeclarativeutilmodule_p.h
+++ b/src/declarative/util/qdeclarativeutilmodule_p.h
@@ -44,8 +44,6 @@
#include <qdeclarative.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -59,6 +57,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEUTILMODULE_H
diff --git a/src/declarative/util/qdeclarativeview.h b/src/declarative/util/qdeclarativeview.h
index 7345f2d9..fd72b850 100644
--- a/src/declarative/util/qdeclarativeview.h
+++ b/src/declarative/util/qdeclarativeview.h
@@ -49,8 +49,6 @@
#include <QtWidgets/qwidget.h>
#include <QtDeclarative/qdeclarativedebug.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -114,6 +112,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEVIEW_H
diff --git a/src/declarative/util/qdeclarativexmllistmodel_p.h b/src/declarative/util/qdeclarativexmllistmodel_p.h
index 5f839ac6..2bcc4a79 100644
--- a/src/declarative/util/qdeclarativexmllistmodel_p.h
+++ b/src/declarative/util/qdeclarativexmllistmodel_p.h
@@ -51,8 +51,6 @@
#include <private/qlistmodelinterface_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -208,6 +206,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeXmlListModel)
QML_DECLARE_TYPE(QDeclarativeXmlListModelRole)
-QT_END_HEADER
-
#endif // QDECLARATIVEXMLLISTMODEL_H
diff --git a/src/declarative/util/qlistmodelinterface_p.h b/src/declarative/util/qlistmodelinterface_p.h
index a9d079b9..b485c5fe 100644
--- a/src/declarative/util/qlistmodelinterface_p.h
+++ b/src/declarative/util/qlistmodelinterface_p.h
@@ -47,8 +47,6 @@
#include <private/qtdeclarativeglobal_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -80,5 +78,4 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QListModelInterface : public QObject
QT_END_NAMESPACE
-QT_END_HEADER
#endif //QTREEMODELINTERFACE_H
diff --git a/src/doc/src/declarative/qtdeclarative.qdoc b/src/doc/src/declarative/qtdeclarative.qdoc
index 62629665..69b15821 100644
--- a/src/doc/src/declarative/qtdeclarative.qdoc
+++ b/src/doc/src/declarative/qtdeclarative.qdoc
@@ -211,3 +211,18 @@
Returns the QML type id.
*/
+
+/*!
+ \fn int qmlRegisterType(const char *url, const char *uri, int versionMajor, int versionMinor, const char *qmlName);
+ \relates QDeclarativeEngine
+
+ This function registers a type in the QML system with the name \a qmlName, in the library imported from \a uri having the
+ version number composed from \a versionMajor and \a versionMinor. The type is defined by the QML file located at \a url.
+
+ Normally QML files can be loaded as types directly from other QML files, or using a qmldir file. This function allows
+ registration of files to types from a C++ module, such as when the type mapping needs to be procedurally determined at startup.
+
+ #include <QtDeclarative> to use this function.
+
+ Returns non-zero if the registration was sucessful.
+*/
diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h
index d50bba9d..68dc25d2 100644
--- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h
+++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h
@@ -49,8 +49,6 @@
#ifndef QT_NO_DIRMODEL
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -153,8 +151,6 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeFolderListModel)
//![qml decl]
-QT_END_HEADER
-
#endif // QT_NO_DIRMODEL
#endif // QDECLARATIVEFOLDERLISTMODEL_H
diff --git a/src/imports/gestures/qdeclarativegesturearea_p.h b/src/imports/gestures/qdeclarativegesturearea_p.h
index 7a2d39e7..68f42641 100644
--- a/src/imports/gestures/qdeclarativegesturearea_p.h
+++ b/src/imports/gestures/qdeclarativegesturearea_p.h
@@ -52,8 +52,6 @@
#ifndef QT_NO_GESTURES
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -97,8 +95,6 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeGestureArea)
-QT_END_HEADER
-
#endif // QT_NO_GESTURES
#endif
diff --git a/src/imports/particles/qdeclarativeparticles_p.h b/src/imports/particles/qdeclarativeparticles_p.h
index 9031589e..dad3f142 100644
--- a/src/imports/particles/qdeclarativeparticles_p.h
+++ b/src/imports/particles/qdeclarativeparticles_p.h
@@ -44,8 +44,6 @@
#include <QtDeclarative/qdeclarativeitem.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -253,6 +251,4 @@ QML_DECLARE_TYPE(QDeclarativeParticleMotionGravity)
QML_DECLARE_TYPE(QDeclarativeParticleMotionWander)
QML_DECLARE_TYPE(QDeclarativeParticles)
-QT_END_HEADER
-
#endif
diff --git a/src/imports/shaders/scenegraph/qsggeometry.h b/src/imports/shaders/scenegraph/qsggeometry.h
index 2ec3cb9d..eca48c69 100644
--- a/src/imports/shaders/scenegraph/qsggeometry.h
+++ b/src/imports/shaders/scenegraph/qsggeometry.h
@@ -44,8 +44,6 @@
#include <QtOpenGL/qgl.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QSGGeometry
@@ -229,6 +227,4 @@ inline const QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSGGEOMETRY_H
diff --git a/src/imports/shaders/shadereffect.h b/src/imports/shaders/shadereffect.h
index 1fc45de6..3bc1bd1f 100644
--- a/src/imports/shaders/shadereffect.h
+++ b/src/imports/shaders/shadereffect.h
@@ -44,8 +44,6 @@
#include <QGraphicsEffect>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class ShaderEffectSource;
@@ -74,8 +72,6 @@ public:
bool m_changed : 1;
};
-QT_END_HEADER
-
QT_END_NAMESPACE
#endif // SHADEREFFECT_H
diff --git a/src/imports/shaders/shadereffectbuffer.h b/src/imports/shaders/shadereffectbuffer.h
index 8674ff7b..569d1ab2 100644
--- a/src/imports/shaders/shadereffectbuffer.h
+++ b/src/imports/shaders/shadereffectbuffer.h
@@ -44,8 +44,6 @@
#include <QGLFramebufferObject>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class ShaderEffectBuffer : public QGLFramebufferObject
@@ -55,8 +53,6 @@ public:
~ShaderEffectBuffer();
};
-QT_END_HEADER
-
QT_END_NAMESPACE
#endif // SHADEREFFECTBUFFER_H
diff --git a/src/imports/shaders/shadereffectitem.h b/src/imports/shaders/shadereffectitem.h
index 2538773d..7274656d 100644
--- a/src/imports/shaders/shadereffectitem.h
+++ b/src/imports/shaders/shadereffectitem.h
@@ -47,8 +47,6 @@
#include "shadereffectsource.h"
#include "scenegraph/qsggeometry.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QGLFramebufferObject;
@@ -148,8 +146,6 @@ private:
bool m_defaultVertexShader : 1;
};
-QT_END_HEADER
-
QT_END_NAMESPACE
#endif // SHADEREFFECTITEM_H
diff --git a/src/imports/shaders/shadereffectsource.h b/src/imports/shaders/shadereffectsource.h
index 5c8794e3..7003ff40 100644
--- a/src/imports/shaders/shadereffectsource.h
+++ b/src/imports/shaders/shadereffectsource.h
@@ -46,8 +46,6 @@
#include <QGLFunctions>
#include <QPointer>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class ShaderEffectBuffer;
@@ -152,8 +150,6 @@ private:
bool m_mirrored : 1;
};
-QT_END_HEADER
-
QT_END_NAMESPACE
diff --git a/src/imports/webview/qdeclarativewebview_p.h b/src/imports/webview/qdeclarativewebview_p.h
index 4effd00e..f2b5db79 100644
--- a/src/imports/webview/qdeclarativewebview_p.h
+++ b/src/imports/webview/qdeclarativewebview_p.h
@@ -51,8 +51,6 @@
#include <QWebPage>
-QT_BEGIN_HEADER
-
class QWebHistory;
class QWebSettings;
@@ -394,6 +392,4 @@ QML_DECLARE_TYPE(QDeclarativeWebView)
QML_DECLARE_TYPE(QDeclarativeWebSettings)
QML_DECLARE_TYPEINFO(QDeclarativeWebView, QML_HAS_ATTACHED_PROPERTIES)
-QT_END_HEADER
-
#endif
diff --git a/sync.profile b/sync.profile
index 78673d95..9ad1263a 100644
--- a/sync.profile
+++ b/sync.profile
@@ -8,12 +8,12 @@
# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch)
#
%dependencies = (
- "qtbase" => "refs/heads/release",
- "qtscript" => "refs/heads/release",
- "qtxmlpatterns" => "refs/heads/release",
- "qtdeclarative" => "refs/heads/release",
- "qtjsbackend" => "refs/heads/release",
- "qtactiveqt" => "refs/heads/release",
- "qttools" => "refs/heads/release",
- "qtwebkit" => "refs/heads/release",
+ "qtbase" => "refs/heads/stable",
+ "qtscript" => "refs/heads/stable",
+ "qtxmlpatterns" => "refs/heads/stable",
+ "qtdeclarative" => "refs/heads/stable",
+ "qtjsbackend" => "refs/heads/stable",
+ "qtactiveqt" => "refs/heads/stable",
+ "qttools" => "refs/heads/stable",
+ "qtwebkit" => "refs/heads/stable",
);
diff --git a/tests/auto/bic/data/QtDeclarative.5.0.0.linux-gcc-ia32.txt b/tests/auto/bic/data/QtDeclarative.5.0.0.linux-gcc-ia32.txt
index daa9c2b4..5dd9860c 100644
--- a/tests/auto/bic/data/QtDeclarative.5.0.0.linux-gcc-ia32.txt
+++ b/tests/auto/bic/data/QtDeclarative.5.0.0.linux-gcc-ia32.txt
@@ -4203,157 +4203,6 @@ QAccessibleTableModelChangeEvent (0xb3963ca8) 0
QAccessibleEvent (0xb388eab8) 0
primary-for QAccessibleTableModelChangeEvent (0xb3963ca8)
-Vtable for QAccessibleTextInterface
-QAccessibleTextInterface::_ZTV24QAccessibleTextInterface: 20u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI24QAccessibleTextInterface)
-8 (int (*)(...))QAccessibleTextInterface::~QAccessibleTextInterface
-12 (int (*)(...))QAccessibleTextInterface::~QAccessibleTextInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-36 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-44 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))QAccessibleTextInterface::textBeforeOffset
-52 (int (*)(...))QAccessibleTextInterface::textAfterOffset
-56 (int (*)(...))QAccessibleTextInterface::textAtOffset
-60 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-68 (int (*)(...))__cxa_pure_virtual
-72 (int (*)(...))__cxa_pure_virtual
-76 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTextInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleTextInterface (0xb38a10a8) 0 nearly-empty
- vptr=((& QAccessibleTextInterface::_ZTV24QAccessibleTextInterface) + 8u)
-
-Vtable for QAccessibleEditableTextInterface
-QAccessibleEditableTextInterface::_ZTV32QAccessibleEditableTextInterface: 7u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI32QAccessibleEditableTextInterface)
-8 (int (*)(...))QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface
-12 (int (*)(...))QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleEditableTextInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleEditableTextInterface (0xb38a1310) 0 nearly-empty
- vptr=((& QAccessibleEditableTextInterface::_ZTV32QAccessibleEditableTextInterface) + 8u)
-
-Vtable for QAccessibleValueInterface
-QAccessibleValueInterface::_ZTV25QAccessibleValueInterface: 9u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI25QAccessibleValueInterface)
-8 (int (*)(...))QAccessibleValueInterface::~QAccessibleValueInterface
-12 (int (*)(...))QAccessibleValueInterface::~QAccessibleValueInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleValueInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleValueInterface (0xb38a1578) 0 nearly-empty
- vptr=((& QAccessibleValueInterface::_ZTV25QAccessibleValueInterface) + 8u)
-
-Vtable for QAccessibleTableCellInterface
-QAccessibleTableCellInterface::_ZTV29QAccessibleTableCellInterface: 13u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI29QAccessibleTableCellInterface)
-8 (int (*)(...))QAccessibleTableCellInterface::~QAccessibleTableCellInterface
-12 (int (*)(...))QAccessibleTableCellInterface::~QAccessibleTableCellInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-36 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-44 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTableCellInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleTableCellInterface (0xb38a17e0) 0 nearly-empty
- vptr=((& QAccessibleTableCellInterface::_ZTV29QAccessibleTableCellInterface) + 8u)
-
-Vtable for QAccessibleTableInterface
-QAccessibleTableInterface::_ZTV25QAccessibleTableInterface: 23u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI25QAccessibleTableInterface)
-8 (int (*)(...))QAccessibleTableInterface::~QAccessibleTableInterface
-12 (int (*)(...))QAccessibleTableInterface::~QAccessibleTableInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-36 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-44 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-52 (int (*)(...))__cxa_pure_virtual
-56 (int (*)(...))__cxa_pure_virtual
-60 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-68 (int (*)(...))__cxa_pure_virtual
-72 (int (*)(...))__cxa_pure_virtual
-76 (int (*)(...))__cxa_pure_virtual
-80 (int (*)(...))__cxa_pure_virtual
-84 (int (*)(...))__cxa_pure_virtual
-88 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTableInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleTableInterface (0xb38a1a48) 0 nearly-empty
- vptr=((& QAccessibleTableInterface::_ZTV25QAccessibleTableInterface) + 8u)
-
-Vtable for QAccessibleActionInterface
-QAccessibleActionInterface::_ZTV26QAccessibleActionInterface: 9u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI26QAccessibleActionInterface)
-8 (int (*)(...))QAccessibleActionInterface::~QAccessibleActionInterface
-12 (int (*)(...))QAccessibleActionInterface::~QAccessibleActionInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))QAccessibleActionInterface::localizedActionName
-24 (int (*)(...))QAccessibleActionInterface::localizedActionDescription
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleActionInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleActionInterface (0xb38a1cb0) 0 nearly-empty
- vptr=((& QAccessibleActionInterface::_ZTV26QAccessibleActionInterface) + 8u)
-
-Vtable for QAccessibleImageInterface
-QAccessibleImageInterface::_ZTV25QAccessibleImageInterface: 7u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI25QAccessibleImageInterface)
-8 (int (*)(...))QAccessibleImageInterface::~QAccessibleImageInterface
-12 (int (*)(...))QAccessibleImageInterface::~QAccessibleImageInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleImageInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleImageInterface (0xb38a1118) 0 nearly-empty
- vptr=((& QAccessibleImageInterface::_ZTV25QAccessibleImageInterface) + 8u)
-
Vtable for QAccessibleBridge
QAccessibleBridge::_ZTV17QAccessibleBridge: 6u entries
0 (int (*)(...))0
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index 0ce9542b..f5135cbc 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -9,8 +9,6 @@ find_package(Qt5Core REQUIRED)
include("${_Qt5CTestMacros}")
-set(Qt5_MODULE_TEST_DEPENDS Script Widgets)
-
test_module_includes(
Declarative QDeclarativeEngine
)
diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro
index bf2dbcb7..61e8de78 100644
--- a/tests/auto/cmake/cmake.pro
+++ b/tests/auto/cmake/cmake.pro
@@ -2,4 +2,6 @@
# Cause make to do nothing.
TEMPLATE = subdirs
+CMAKE_QT_MODULES_UNDER_TEST = declarative
+
CONFIG += ctest_testcase
diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
index 00869268..6352d02b 100644
--- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
+++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
@@ -47,6 +47,7 @@
#include <private/qdeclarativeitem_p.h>
#include <QVariantAnimation>
#include <QEasingCurve>
+#include <QSignalSpy>
class tst_qdeclarativeanimations : public QObject
{
@@ -82,6 +83,7 @@ private slots:
void doubleRegistrationBug();
void alwaysRunToEndRestartBug();
void transitionAssignmentBug();
+ void zeroDurationTwoCompletedEmittedBug();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -850,6 +852,24 @@ void tst_qdeclarativeanimations::transitionAssignmentBug()
QCOMPARE(rect->property("nullObject").toBool(), false);
}
+void tst_qdeclarativeanimations::zeroDurationTwoCompletedEmittedBug()
+{
+ QDeclarativeRectangle rect;
+ QDeclarativePropertyAnimation animation;
+ animation.setTarget(&rect);
+ animation.setProperty("x");
+ animation.setFrom(1);
+ animation.setTo(200);
+ animation.setDuration(0);
+ QVERIFY(animation.from() == 1);
+ QSignalSpy spy(&animation, SIGNAL(completed(void)));
+ animation.start();
+ QVERIFY(!animation.isRunning());
+ QCOMPARE(rect.x(), qreal(200));
+ QCOMPARE(spy.size(), 1);
+}
+
+
QTEST_MAIN(tst_qdeclarativeanimations)
#include "tst_qdeclarativeanimations.moc"
diff --git a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h
index 57d8a3d2..a08d9b55 100644
--- a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h
+++ b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h
@@ -44,8 +44,6 @@
#include <QtCore/qglobal.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QScriptEngine;
@@ -66,6 +64,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDECLARATIVEDEBUGHELPER_P_H
diff --git a/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp b/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
index 903b3739..995c375a 100644
--- a/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
+++ b/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
@@ -133,10 +133,6 @@ private:
class tst_QDeclarativeDebugJS : public QDeclarativeDataTest
{
Q_OBJECT
-private:
- QDeclarativeDebugConnection *m_conn;
- QDeclarativeEngine *m_engine;
- QJSDebugClient *m_client;
private slots:
void initTestCase();
diff --git a/tests/auto/declarative/qdeclarativedebugobservermode/tst_qdeclarativedebugobservermode.cpp b/tests/auto/declarative/qdeclarativedebugobservermode/tst_qdeclarativedebugobservermode.cpp
index 83c2f21a..d97ae70d 100644
--- a/tests/auto/declarative/qdeclarativedebugobservermode/tst_qdeclarativedebugobservermode.cpp
+++ b/tests/auto/declarative/qdeclarativedebugobservermode/tst_qdeclarativedebugobservermode.cpp
@@ -117,10 +117,6 @@ private:
class tst_QDeclarativeDebugObserverMode : public QDeclarativeDataTest
{
Q_OBJECT
-private:
- QDeclarativeDebugConnection *m_conn;
- QDeclarativeEngine *m_engine;
- QDeclarativeObserverModeClient *m_client;
private slots:
void initTestCase();
diff --git a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp
index 7795e026..f67cecdc 100644
--- a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp
+++ b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp
@@ -334,6 +334,8 @@ public:
setFinished(true);
}
virtual qint64 readData(char* buffer, qint64 number) {
+ Q_UNUSED(buffer)
+ Q_UNUSED(number)
return 0;
}
virtual void abort() { }
@@ -348,6 +350,9 @@ public:
}
QNetworkReply *createRequest(Operation op, const QNetworkRequest & req, QIODevice * outgoingData = 0) {
+ Q_UNUSED(op)
+ Q_UNUSED(req)
+ Q_UNUSED(outgoingData)
return new MyReply;
}
};
@@ -356,7 +361,7 @@ class MyFactory : public QDeclarativeNetworkAccessManagerFactory {
public:
QNetworkAccessManager *create(QObject *parent) {
- return new MyManager;
+ return new MyManager(parent);
}
};
diff --git a/tests/auto/declarative/qdeclarativeflickable/data/nestedStopAtBounds.qml b/tests/auto/declarative/qdeclarativeflickable/data/nestedStopAtBounds.qml
new file mode 100644
index 00000000..6b28edf5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeflickable/data/nestedStopAtBounds.qml
@@ -0,0 +1,38 @@
+import QtQuick 1.1
+
+Flickable {
+ id: outer
+ objectName: "outerFlickable"
+ width: 400
+ height: 400
+ contentX: 50
+ contentY: 50
+ contentWidth: 500
+ contentHeight: 500
+ flickableDirection: inner.flickableDirection
+
+ Rectangle {
+ x: 100
+ y: 100
+ width: 300
+ height: 300
+
+ color: "yellow"
+ Flickable {
+ id: inner
+ objectName: "innerFlickable"
+ anchors.fill: parent
+ contentX: 100
+ contentY: 100
+ contentWidth: 400
+ contentHeight: 400
+ boundsBehavior: Flickable.StopAtBounds
+
+ Rectangle {
+ anchors.fill: parent
+ anchors.margins: 100
+ color: "blue"
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp
index d36e96f9..c8a98d33 100644
--- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp
+++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp
@@ -75,6 +75,8 @@ private slots:
void testQtQuick11Attributes_data();
void wheel();
void flickVelocity();
+ void nestedStopAtBounds();
+ void nestedStopAtBounds_data();
private:
QDeclarativeEngine engine;
@@ -524,6 +526,86 @@ void tst_qdeclarativeflickable::flick(QGraphicsView *canvas, const QPoint &from,
QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(to));
}
+void tst_qdeclarativeflickable::nestedStopAtBounds_data()
+{
+ QTest::addColumn<bool>("transpose");
+ QTest::addColumn<bool>("invert");
+
+ QTest::newRow("left") << false << false;
+ QTest::newRow("right") << false << true;
+ QTest::newRow("top") << true << false;
+ QTest::newRow("bottom") << true << true;
+}
+
+void tst_qdeclarativeflickable::nestedStopAtBounds()
+{
+ QFETCH(bool, transpose);
+ QFETCH(bool, invert);
+
+ QDeclarativeView view;
+ view.setSource(QUrl::fromLocalFile(SRCDIR "/data/nestedStopAtBounds.qml"));
+ view.show();
+ view.activateWindow();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(view.rootObject());
+
+ QDeclarativeFlickable *outer = qobject_cast<QDeclarativeFlickable*>(view.rootObject());
+ QVERIFY(outer);
+
+ QDeclarativeFlickable *inner = outer->findChild<QDeclarativeFlickable*>("innerFlickable");
+ QVERIFY(inner);
+ inner->setFlickableDirection(transpose ? QDeclarativeFlickable::VerticalFlick : QDeclarativeFlickable::HorizontalFlick);
+ inner->setContentX(invert ? 0 : 100);
+ inner->setContentY(invert ? 0 : 100);
+
+ const int threshold = QApplication::startDragDistance();
+
+ QPoint position(200, 200);
+ int &axis = transpose ? position.ry() : position.rx();
+
+ QGraphicsSceneMouseEvent moveEvent(QEvent::GraphicsSceneMouseMove);
+ moveEvent.setButton(Qt::LeftButton);
+ moveEvent.setButtons(Qt::LeftButton);
+
+ // drag toward the aligned boundary. Outer mouse area dragged.
+ QTest::mousePress(view.viewport(), Qt::LeftButton, 0, position);
+ QTest::qWait(10);
+ axis += invert ? threshold * 2 : -threshold * 2;
+ moveEvent.setScenePos(position);
+ QApplication::sendEvent(view.scene(), &moveEvent);
+ axis += invert ? threshold : -threshold;
+ moveEvent.setScenePos(position);
+ QApplication::sendEvent(view.scene(), &moveEvent);
+ axis += invert ? threshold : -threshold;
+ moveEvent.setScenePos(position);
+ QApplication::sendEvent(view.scene(), &moveEvent);
+ QVERIFY(outer->contentX() != 50 || outer->contentY() != 50);
+ QVERIFY((inner->contentX() == 0 || inner->contentX() == 100)
+ && (inner->contentY() == 0 || inner->contentY() == 100));
+ QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, position);
+
+ axis = 200;
+ outer->setContentX(50);
+ outer->setContentY(50);
+
+ // drag away from the aligned boundary. Inner mouse area dragged.
+ QTest::mousePress(view.viewport(), Qt::LeftButton, 0, position);
+ QTest::qWait(10);
+ axis += invert ? -threshold * 2 : threshold * 2;
+ moveEvent.setScenePos(position);
+ QApplication::sendEvent(view.scene(), &moveEvent);
+ axis += invert ? -threshold : threshold;
+ moveEvent.setScenePos(position);
+ QApplication::sendEvent(view.scene(), &moveEvent);
+ axis += invert ? -threshold : threshold;
+ moveEvent.setScenePos(position);
+ QApplication::sendEvent(view.scene(), &moveEvent);
+ QVERIFY(outer->contentX() == 50 && outer->contentY() == 50);
+ QVERIFY((inner->contentX() != 0 && inner->contentX() != 100)
+ || (inner->contentY() != 0 && inner->contentY() != 100));
+ QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, position);
+}
+
template<typename T>
T *tst_qdeclarativeflickable::findItem(QGraphicsObject *parent, const QString &objectName)
{
diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/notifications.qml b/tests/auto/declarative/qdeclarativefocusscope/data/notifications.qml
new file mode 100644
index 00000000..8345972a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativefocusscope/data/notifications.qml
@@ -0,0 +1,81 @@
+import QtQuick 1.1
+
+Item {
+ objectName: "rootItem"
+
+ property bool handlerFocus
+ property bool handlerActiveFocus
+
+ onFocusChanged: handlerFocus = focus
+ onActiveFocusChanged: handlerActiveFocus = activeFocus
+
+ Item {
+ objectName: "item1"
+
+ property bool handlerFocus
+ property bool handlerActiveFocus
+
+ onFocusChanged: handlerFocus = focus
+ onActiveFocusChanged: handlerActiveFocus = activeFocus
+ }
+
+ Item {
+ objectName: "item2"
+
+ property bool handlerFocus
+ property bool handlerActiveFocus
+
+ onFocusChanged: handlerFocus = focus
+ onActiveFocusChanged: handlerActiveFocus = activeFocus
+
+ Item {
+ objectName: "item3"
+
+ property bool handlerFocus
+ property bool handlerActiveFocus
+
+ onFocusChanged: handlerFocus = focus
+ onActiveFocusChanged: handlerActiveFocus = activeFocus
+ }
+ }
+
+ FocusScope {
+ objectName: "scope1"
+
+ property bool handlerFocus
+ property bool handlerActiveFocus
+
+ onFocusChanged: handlerFocus = focus
+ onActiveFocusChanged: handlerActiveFocus = activeFocus
+
+ Item {
+ objectName: "item4"
+
+ property bool handlerFocus
+ property bool handlerActiveFocus
+
+ onFocusChanged: handlerFocus = focus
+ onActiveFocusChanged: handlerActiveFocus = activeFocus
+ }
+
+ FocusScope {
+ objectName: "scope2"
+
+ property bool handlerFocus
+ property bool handlerActiveFocus
+
+ onFocusChanged: handlerFocus = focus
+ onActiveFocusChanged: handlerActiveFocus = activeFocus
+
+ Item {
+ objectName: "item5"
+
+ property bool handlerFocus
+ property bool handlerActiveFocus
+
+ onFocusChanged: handlerFocus = focus
+ onActiveFocusChanged: handlerActiveFocus = activeFocus
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
index 64c8d210..f7099ba2 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
+++ b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
@@ -68,6 +68,10 @@ private slots:
void signalEmission();
void qtBug13380();
void forceActiveFocus();
+ void notifications();
+ void notifications_data();
+ void notificationsInScope();
+ void notificationsInScope_data();
};
/*
@@ -396,8 +400,11 @@ void tst_qdeclarativefocusscope::forceActiveFocus()
{
QDeclarativeView *view = new QDeclarativeView;
view->setSource(QUrl::fromLocalFile(SRCDIR "/data/forceActiveFocus.qml"));
+ view->show();
+ view->activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(view));
- QGraphicsObject *rootObject = view->rootObject();
+ QDeclarativeItem *rootObject = qobject_cast<QDeclarativeItem *>(view->rootObject());
QVERIFY(rootObject);
QDeclarativeItem *scope = findItem<QDeclarativeItem>(rootObject, QLatin1String("scope"));
@@ -416,6 +423,11 @@ void tst_qdeclarativefocusscope::forceActiveFocus()
QVERIFY(scopeB);
QVERIFY(itemB2);
+ QCOMPARE(rootObject->hasActiveFocus(), false);
+ QCOMPARE(scope->hasActiveFocus(), false);
+ QCOMPARE(scopeA->hasActiveFocus(), false);
+ QCOMPARE(scopeB->hasActiveFocus(), false);
+
QSignalSpy rootSpy(rootObject, SIGNAL(activeFocusChanged(bool)));
QSignalSpy scopeSpy(scope, SIGNAL(activeFocusChanged(bool)));
QSignalSpy scopeASpy(scopeA, SIGNAL(activeFocusChanged(bool)));
@@ -424,22 +436,34 @@ void tst_qdeclarativefocusscope::forceActiveFocus()
// First, walk the focus from item-a1 down to item-a2 and back again
itemA1->forceActiveFocus();
QVERIFY(itemA1->hasActiveFocus());
- QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 0);
QCOMPARE(scopeSpy.count(), 1);
scopeA->forceActiveFocus();
QVERIFY(!itemA1->hasActiveFocus());
QVERIFY(scopeA->hasActiveFocus());
QCOMPARE(scopeASpy.count(), 1);
- QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 0);
QCOMPARE(scopeSpy.count(), 1);
itemA2->forceActiveFocus();
QVERIFY(!itemA1->hasActiveFocus());
QVERIFY(itemA2->hasActiveFocus());
QVERIFY(scopeA->hasActiveFocus());
+ if (scopeASpy.count() == 3) {
+ qWarning() << "ignoring spurious changed signals";
+ QCOMPARE(scopeASpy.takeFirst().first().toBool(), true);
+ QCOMPARE(scopeASpy.takeFirst().first().toBool(), false);
+ QCOMPARE(scopeASpy.first().first().toBool(), true);
+ }
QCOMPARE(scopeASpy.count(), 1);
- QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 0);
+ if (scopeSpy.count() == 3) {
+ qWarning() << "ignoring spurious changed signals";
+ QCOMPARE(scopeSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(scopeSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(scopeSpy.first().first().toBool(), true);
+ }
QCOMPARE(scopeSpy.count(), 1);
scopeA->forceActiveFocus();
@@ -447,7 +471,7 @@ void tst_qdeclarativefocusscope::forceActiveFocus()
QVERIFY(itemA2->hasActiveFocus());
QVERIFY(scopeA->hasActiveFocus());
QCOMPARE(scopeASpy.count(), 1);
- QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 0);
QCOMPARE(scopeSpy.count(), 1);
itemA1->forceActiveFocus();
@@ -455,13 +479,13 @@ void tst_qdeclarativefocusscope::forceActiveFocus()
QVERIFY(!scopeA->hasActiveFocus());
QVERIFY(!itemA2->hasActiveFocus());
QCOMPARE(scopeASpy.count(), 2);
- QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 0);
QCOMPARE(scopeSpy.count(), 1);
// Then jump back and forth between branch 'a' and 'b'
itemB1->forceActiveFocus();
QVERIFY(itemB1->hasActiveFocus());
- QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 0);
QCOMPARE(scopeSpy.count(), 1);
scopeA->forceActiveFocus();
@@ -469,7 +493,7 @@ void tst_qdeclarativefocusscope::forceActiveFocus()
QVERIFY(!itemB1->hasActiveFocus());
QVERIFY(scopeA->hasActiveFocus());
QCOMPARE(scopeASpy.count(), 3);
- QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 0);
QCOMPARE(scopeSpy.count(), 1);
scopeB->forceActiveFocus();
@@ -478,7 +502,7 @@ void tst_qdeclarativefocusscope::forceActiveFocus()
QVERIFY(scopeB->hasActiveFocus());
QCOMPARE(scopeASpy.count(), 4);
QCOMPARE(scopeBSpy.count(), 1);
- QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 0);
QCOMPARE(scopeSpy.count(), 1);
itemA2->forceActiveFocus();
@@ -486,7 +510,7 @@ void tst_qdeclarativefocusscope::forceActiveFocus()
QVERIFY(itemA2->hasActiveFocus());
QCOMPARE(scopeASpy.count(), 5);
QCOMPARE(scopeBSpy.count(), 2);
- QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 0);
QCOMPARE(scopeSpy.count(), 1);
itemB2->forceActiveFocus();
@@ -494,12 +518,259 @@ void tst_qdeclarativefocusscope::forceActiveFocus()
QVERIFY(itemB2->hasActiveFocus());
QCOMPARE(scopeASpy.count(), 6);
QCOMPARE(scopeBSpy.count(), 3);
- QCOMPARE(rootSpy.count(), 1);
+ QCOMPARE(rootSpy.count(), 0);
QCOMPARE(scopeSpy.count(), 1);
delete view;
}
+
+void tst_qdeclarativefocusscope::notifications_data()
+{
+ QTest::addColumn<QString>("objectName");
+
+ QTest::newRow("rootItem") << "";
+ QTest::newRow("item1") << "item1";
+ QTest::newRow("item3") << "item3";
+ QTest::newRow("focusScope") << "scope1";
+}
+
+void tst_qdeclarativefocusscope::notifications()
+{
+ QFETCH(QString, objectName);
+ QDeclarativeView canvas;
+ canvas.setSource(QUrl::fromLocalFile(SRCDIR "/data/notifications.qml"));
+ canvas.show();
+ canvas.activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(&canvas));
+
+ QGraphicsScene *scene = canvas.scene();
+
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(canvas.rootObject());
+ QVERIFY(item);
+
+ item = objectName.isEmpty() ? item : item->findChild<QDeclarativeItem *>(objectName);
+ QVERIFY(item);
+
+ QSignalSpy focusSpy(item, SIGNAL(focusChanged(bool)));
+ QSignalSpy activeFocusSpy(item, SIGNAL(activeFocusChanged(bool)));
+
+ QCOMPARE(item->hasFocus(), false);
+ QCOMPARE(item->hasActiveFocus(), false);
+
+ item->setFocus(true);
+
+ QCOMPARE(item->hasFocus(), true);
+ QCOMPARE(item->hasActiveFocus(), true);
+ QCOMPARE(focusSpy.count(), 1);
+ QCOMPARE(activeFocusSpy.count(), 1);
+ QCOMPARE(focusSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(activeFocusSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(item->property("handlerFocus").value<bool>(), true);
+ QCOMPARE(item->property("handlerActiveFocus").value<bool>(), true);
+
+ item->setFocus(false);
+
+ QCOMPARE(item->hasFocus(), false);
+ QCOMPARE(item->hasActiveFocus(), false);
+ QCOMPARE(focusSpy.count(), 1);
+ QCOMPARE(activeFocusSpy.count(), 1);
+ QCOMPARE(focusSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(activeFocusSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(item->property("handlerFocus").value<bool>(), false);
+ QCOMPARE(item->property("handlerActiveFocus").value<bool>(), false);
+
+ item->QGraphicsItem::setFocus();
+
+ QCOMPARE(item->hasFocus(), true);
+ QCOMPARE(item->hasActiveFocus(), true);
+ QCOMPARE(focusSpy.count(), 1);
+ QCOMPARE(activeFocusSpy.count(), 1);
+ QCOMPARE(focusSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(activeFocusSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(item->property("handlerFocus").value<bool>(), true);
+ QCOMPARE(item->property("handlerActiveFocus").value<bool>(), true);
+
+ item->clearFocus();
+
+ QCOMPARE(item->hasFocus(), false);
+ QCOMPARE(item->hasActiveFocus(), false);
+ QCOMPARE(focusSpy.count(), 1);
+ QCOMPARE(activeFocusSpy.count(), 1);
+ QCOMPARE(focusSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(activeFocusSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(item->property("handlerFocus").value<bool>(), false);
+ QCOMPARE(item->property("handlerActiveFocus").value<bool>(), false);
+
+ scene->setFocusItem(item);
+
+ QCOMPARE(item->hasFocus(), true);
+ QCOMPARE(item->hasActiveFocus(), true);
+ QCOMPARE(focusSpy.count(), 1);
+ QCOMPARE(activeFocusSpy.count(), 1);
+ QCOMPARE(focusSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(activeFocusSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(item->property("handlerFocus").value<bool>(), true);
+ QCOMPARE(item->property("handlerActiveFocus").value<bool>(), true);
+
+ scene->setFocusItem(0);
+
+ QCOMPARE(item->hasFocus(), false);
+ QCOMPARE(item->hasActiveFocus(), false);
+ QCOMPARE(focusSpy.count(), 1);
+ QCOMPARE(activeFocusSpy.count(), 1);
+ QCOMPARE(focusSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(activeFocusSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(item->property("handlerFocus").value<bool>(), false);
+ QCOMPARE(item->property("handlerActiveFocus").value<bool>(), false);
+}
+
+void tst_qdeclarativefocusscope::notificationsInScope_data()
+{
+ QTest::addColumn<QString>("itemName");
+ QTest::addColumn<QString>("scopeName");
+
+ QTest::newRow("item4") << "item4" << "scope1";
+ QTest::newRow("item5") << "item5" << "scope2";
+}
+
+void tst_qdeclarativefocusscope::notificationsInScope()
+{
+ QFETCH(QString, itemName);
+ QFETCH(QString, scopeName);
+ QDeclarativeView canvas;
+ canvas.setSource(QUrl::fromLocalFile(SRCDIR "/data/notifications.qml"));
+ canvas.show();
+ canvas.activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(&canvas));
+
+ QVERIFY(canvas.rootObject());
+
+ QDeclarativeItem *scope = canvas.rootObject()->findChild<QDeclarativeItem *>(scopeName);
+ QVERIFY(scope);
+
+ QDeclarativeItem *item = scope->findChild<QDeclarativeItem *>(itemName);
+ QVERIFY(item);
+
+ QSignalSpy itemFocusSpy(item, SIGNAL(focusChanged(bool)));
+ QSignalSpy itemActiveFocusSpy(item, SIGNAL(activeFocusChanged(bool)));
+
+ QSignalSpy scopeFocusSpy(scope, SIGNAL(focusChanged(bool)));
+ QSignalSpy scopeActiveFocusSpy(scope, SIGNAL(activeFocusChanged(bool)));
+
+ QCOMPARE(item->hasFocus(), false);
+ QCOMPARE(item->hasActiveFocus(), false);
+ QCOMPARE(scope->hasFocus(), false);
+ QCOMPARE(scope->hasActiveFocus(), false);
+ QCOMPARE(item->property("handlerFocus").value<bool>(), false);
+ QCOMPARE(item->property("handlerActiveFocus").value<bool>(), false);
+ QCOMPARE(scope->property("handlerFocus").value<bool>(), false);
+ QCOMPARE(scope->property("handlerActiveFocus").value<bool>(), false);
+
+ item->setFocus(true);
+ QCOMPARE(item->hasFocus(), true);
+ QCOMPARE(item->hasActiveFocus(), false);
+ QCOMPARE(scope->hasFocus(), false);
+ QCOMPARE(scope->hasActiveFocus(), false);
+ QCOMPARE(itemFocusSpy.count(), 1);
+ QCOMPARE(itemFocusSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(itemActiveFocusSpy.count(), 0);
+ QCOMPARE(scopeFocusSpy.count(), 0);
+ QCOMPARE(scopeActiveFocusSpy.count(), 0);
+ QCOMPARE(item->property("handlerFocus").value<bool>(), true);
+ QCOMPARE(item->property("handlerActiveFocus").value<bool>(), false);
+ QCOMPARE(scope->property("handlerFocus").value<bool>(), false);
+ QCOMPARE(scope->property("handlerActiveFocus").value<bool>(), false);
+
+ item->setFocus(false);
+ QCOMPARE(item->hasFocus(), false);
+ QCOMPARE(item->hasActiveFocus(), false);
+ QCOMPARE(scope->hasFocus(), false);
+ QCOMPARE(scope->hasActiveFocus(), false);
+ QCOMPARE(itemFocusSpy.count(), 1);
+ QCOMPARE(itemFocusSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(itemActiveFocusSpy.count(), 0);
+ QCOMPARE(scopeFocusSpy.count(), 0);
+ QCOMPARE(scopeActiveFocusSpy.count(), 0);
+ QCOMPARE(item->property("handlerFocus").value<bool>(), false);
+ QCOMPARE(item->property("handlerActiveFocus").value<bool>(), false);
+ QCOMPARE(scope->property("handlerFocus").value<bool>(), false);
+ QCOMPARE(scope->property("handlerActiveFocus").value<bool>(), false);
+
+ item->forceActiveFocus();
+ QCOMPARE(item->hasFocus(), true);
+ QCOMPARE(item->hasActiveFocus(), true);
+ QCOMPARE(scope->hasFocus(), true);
+ QCOMPARE(scope->hasActiveFocus(), true);
+ QCOMPARE(itemFocusSpy.count(), 1);
+ QCOMPARE(itemFocusSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(itemActiveFocusSpy.count(), 1);
+ QCOMPARE(itemActiveFocusSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(scopeFocusSpy.count(), 1);
+ QCOMPARE(scopeFocusSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(scopeActiveFocusSpy.count(), 1);
+ QCOMPARE(scopeActiveFocusSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(item->property("handlerFocus").value<bool>(), true);
+ QCOMPARE(item->property("handlerActiveFocus").value<bool>(), true);
+ QCOMPARE(scope->property("handlerFocus").value<bool>(), true);
+ QCOMPARE(scope->property("handlerActiveFocus").value<bool>(), true);
+
+ scope->setFocus(false);
+ QCOMPARE(item->hasFocus(), true);
+ QCOMPARE(item->hasActiveFocus(), false);
+ QCOMPARE(scope->hasFocus(), false);
+ QCOMPARE(scope->hasActiveFocus(), false);
+ QCOMPARE(itemFocusSpy.count(), 0);
+ QCOMPARE(itemActiveFocusSpy.count(), 1);
+ QCOMPARE(itemActiveFocusSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(scopeFocusSpy.count(), 1);
+ QCOMPARE(scopeFocusSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(scopeActiveFocusSpy.count(), 1);
+ QCOMPARE(scopeActiveFocusSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(item->property("handlerFocus").value<bool>(), true);
+ QCOMPARE(item->property("handlerActiveFocus").value<bool>(), false);
+ QCOMPARE(scope->property("handlerFocus").value<bool>(), false);
+ QCOMPARE(scope->property("handlerActiveFocus").value<bool>(), false);
+
+ scope->setFocus(true);
+ QCOMPARE(item->hasFocus(), true);
+ QCOMPARE(item->hasActiveFocus(), true);
+ QCOMPARE(scope->hasFocus(), true);
+ QCOMPARE(scope->hasActiveFocus(), true);
+ QCOMPARE(itemFocusSpy.count(), 0);
+ QCOMPARE(itemActiveFocusSpy.count(), 1);
+ QCOMPARE(itemActiveFocusSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(scopeFocusSpy.count(), 1);
+ QCOMPARE(scopeFocusSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(scopeActiveFocusSpy.count(), 1);
+ QCOMPARE(scopeActiveFocusSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(item->property("handlerFocus").value<bool>(), true);
+ QCOMPARE(item->property("handlerActiveFocus").value<bool>(), true);
+ QCOMPARE(scope->property("handlerFocus").value<bool>(), true);
+ QCOMPARE(scope->property("handlerActiveFocus").value<bool>(), true);
+
+ item->setFocus(false);
+ QCOMPARE(item->hasFocus(), false);
+ QCOMPARE(item->hasActiveFocus(), false);
+ QCOMPARE(scope->hasFocus(), true);
+ QCOMPARE(scope->hasActiveFocus(), true);
+ QCOMPARE(itemFocusSpy.count(), 1);
+ QCOMPARE(itemFocusSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(itemActiveFocusSpy.count(), 1);
+ QCOMPARE(itemActiveFocusSpy.takeFirst().first().toBool(), false);
+ if (scopeFocusSpy.count() == 2) {
+ qWarning() << "ignoring spurious changed signals";
+ QCOMPARE(scopeFocusSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(scopeFocusSpy.takeFirst().first().toBool(), true);
+ }
+ QCOMPARE(scopeFocusSpy.count(), 0);
+ QCOMPARE(scopeActiveFocusSpy.count(), 0);
+ QCOMPARE(item->property("handlerFocus").value<bool>(), false);
+ QCOMPARE(item->property("handlerActiveFocus").value<bool>(), false);
+ QCOMPARE(scope->property("handlerFocus").value<bool>(), true);
+ QCOMPARE(scope->property("handlerActiveFocus").value<bool>(), true);
+}
+
QTEST_MAIN(tst_qdeclarativefocusscope)
#include "tst_qdeclarativefocusscope.moc"
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index 0f61bb7e..0251d74d 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -86,6 +86,11 @@ private slots:
void qtbug_16871();
void qtbug_21045();
void hasActiveFocusAfterClear();
+ void setAndClearFocusOfItem();
+ void setAndClearFocusScopeFocus();
+ void setFocusThenSetFocusItem0();
+ void setFocusFocusItem0ThenHasActiveFocus();
+
private:
QDeclarativeEngine engine;
};
@@ -1043,6 +1048,7 @@ void tst_QDeclarativeItem::propertyChanges()
QCOMPARE(parentItem->childrenRect(), childrenRectArguments.at(0).toRectF());
QCOMPARE(item->hasActiveFocus(), true);
+ QCOMPARE(item->hasFocus(), true);
QCOMPARE(focusSpy.count(),1);
QList<QVariant> focusArguments = focusSpy.first();
QVERIFY(focusArguments.count() == 1);
@@ -1249,8 +1255,9 @@ void tst_QDeclarativeItem::qtbug_21045()
void tst_QDeclarativeItem::hasActiveFocusAfterClear()
{
QGraphicsScene scene;
- QGraphicsView view(&scene);
- view.show();
+ scene.setFocus();
+ QEvent event(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &event);
QDeclarativeEngine engine;
QDeclarativeComponent qmlComponent(&engine);
@@ -1273,6 +1280,174 @@ void tst_QDeclarativeItem::hasActiveFocusAfterClear()
QVERIFY(!createdItem->hasActiveFocus());
}
+void tst_QDeclarativeItem::setAndClearFocusOfItem()
+{
+ QGraphicsScene scene;
+ scene.setFocus();
+ QEvent event(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &event);
+
+ QDeclarativeEngine engine(&scene);
+ QDeclarativeComponent qmlComponent(&engine);
+ qmlComponent.setData(
+ "import QtQuick 1.1;"
+ "Item { id: root; "
+ "signal focusChangedTo(bool value);"
+ "signal activeFocusChangedTo(bool value);"
+ "onFocusChanged: root.focusChangedTo(focus);"
+ "onActiveFocusChanged: root.activeFocusChangedTo(activeFocus);"
+ "}", QUrl("test"));
+
+ QGraphicsItem *createdItem = qobject_cast<QGraphicsItem*>(qmlComponent.create(engine.rootContext()));
+ QVERIFY(createdItem);
+ scene.addItem(createdItem);
+
+ QSignalSpy focusChangedSpy(createdItem->toGraphicsObject(), SIGNAL(focusChangedTo(bool)));
+ QSignalSpy activeFocusChangedSpy(createdItem->toGraphicsObject(), SIGNAL(activeFocusChangedTo(bool)));
+
+ QVERIFY(!createdItem->hasFocus());
+ createdItem->toGraphicsObject()->setFocus();
+ QCOMPARE(focusChangedSpy.count(), 1);
+ QCOMPARE(activeFocusChangedSpy.count(), 1);
+ QCOMPARE(focusChangedSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(activeFocusChangedSpy.takeFirst().first().toBool(), true);
+
+ createdItem->toGraphicsObject()->clearFocus();
+ QCOMPARE(focusChangedSpy.count(), 1);
+ QCOMPARE(activeFocusChangedSpy.count(), 1);
+ QCOMPARE(focusChangedSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(activeFocusChangedSpy.takeFirst().first().toBool(), false);
+}
+
+void tst_QDeclarativeItem::setAndClearFocusScopeFocus()
+{
+ //graphicsview init
+ QGraphicsScene scene;
+ scene.setFocus();
+ QEvent event(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &event);
+
+ //declarative init
+ QDeclarativeEngine engine(&scene);
+ QDeclarativeComponent qmlComponent(&engine);
+
+ qmlComponent.setData(
+ "\nimport QtQuick 1.1"
+ "\nFocusScope {"
+ "\n id: root"
+ "\n signal listActiveFocusChangedTo(bool value)"
+ "\n signal topRectActiveFocusChangedTo(bool value)"
+ "\n Rectangle {"
+ "\n id: topRect"
+ "\n focus: true"
+ "\n onActiveFocusChanged: root.topRectActiveFocusChangedTo(topRect.activeFocus)"
+ "\n }"
+ "\n FocusScope {"
+ "\n objectName: \"focusScope\""
+ "\n onActiveFocusChanged: root.listActiveFocusChangedTo(activeFocus)"
+ "\n }"
+ "\n Rectangle { objectName: \"bottom\" }"
+ "}", QUrl(""));
+
+ QGraphicsItem *createdItem = qobject_cast<QGraphicsItem*>(qmlComponent.create(engine.rootContext()));
+ QVERIFY(createdItem);
+ scene.addItem(createdItem);
+
+ QDeclarativeItem *focusScope = createdItem->toGraphicsObject()->findChild<QDeclarativeItem*>("focusScope");
+ QDeclarativeItem *bottomRect = createdItem->toGraphicsObject()->findChild<QDeclarativeItem*>("bottom");
+
+ QSignalSpy focusScopeSpy(createdItem->toGraphicsObject(), SIGNAL(listActiveFocusChangedTo(bool)));
+ QSignalSpy topRectFocusSpy(createdItem->toGraphicsObject(), SIGNAL(topRectActiveFocusChangedTo(bool)));
+
+ //#1: root gets activefocus, and in turn the top rectangle
+ createdItem->setFocus();
+
+ //#2
+ focusScope->setFocus(true);
+
+ //#3
+ bottomRect->setFocus(true);
+
+ QCOMPARE(topRectFocusSpy.count(), 2);
+ QCOMPARE(focusScopeSpy.count(), 2);
+
+ QCOMPARE(topRectFocusSpy.takeFirst().first().toBool(), true); //from #1
+ QCOMPARE(topRectFocusSpy.takeFirst().first().toBool(), false); //from #2
+
+ QCOMPARE(focusScopeSpy.takeFirst().first().toBool(), true); //from #2
+ QCOMPARE(focusScopeSpy.takeFirst().first().toBool(), false); //from #3
+}
+
+void tst_QDeclarativeItem::setFocusThenSetFocusItem0()
+{
+ //graphicsview init
+ QGraphicsScene scene;
+ scene.setFocus();
+ QEvent event(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &event);
+
+ //declarative init
+ QDeclarativeEngine engine(&scene);
+ QDeclarativeComponent qmlComponent(&engine);
+ qmlComponent.setData(
+ "import QtQuick 1.1;"
+ "Item {"
+ "signal focusChangedTo(bool value);"
+ "signal activeFocusChangedTo(bool value);"
+ "onFocusChanged: focusChangedTo(focus);"
+ "onActiveFocusChanged: activeFocusChangedTo(activeFocus);"
+ "}", QUrl(""));
+
+ QGraphicsItem *createdItem = qobject_cast<QGraphicsItem*>(qmlComponent.create(engine.rootContext()));
+ QVERIFY(createdItem);
+
+ scene.addItem(createdItem);
+
+ QSignalSpy focusChangedSpy(createdItem->toGraphicsObject(), SIGNAL(focusChangedTo(bool)));
+ QSignalSpy activeFocusChangedSpy(createdItem->toGraphicsObject(), SIGNAL(activeFocusChangedTo(bool)));
+
+ createdItem->toGraphicsObject()->setFocus();
+ QVERIFY(!focusChangedSpy.isEmpty());
+ QVERIFY(!activeFocusChangedSpy.isEmpty());
+ QCOMPARE(focusChangedSpy.takeFirst().first().toBool(), true);
+ QCOMPARE(activeFocusChangedSpy.takeFirst().first().toBool(), true);
+
+ scene.setFocusItem(0);
+ QVERIFY(!focusChangedSpy.isEmpty());
+ QVERIFY(!activeFocusChangedSpy.isEmpty());
+ QCOMPARE(focusChangedSpy.takeFirst().first().toBool(), false);
+ QCOMPARE(activeFocusChangedSpy.takeFirst().first().toBool(), false);
+ QVERIFY(activeFocusChangedSpy.isEmpty());
+}
+
+void tst_QDeclarativeItem::setFocusFocusItem0ThenHasActiveFocus()
+{
+ QGraphicsScene scene;
+ scene.setFocus();
+ QEvent event(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &event);
+
+ QDeclarativeEngine engine(&scene);
+ QDeclarativeComponent qmlComponent(&engine);
+ qmlComponent.setData(
+ "import QtQuick 1.1;"
+ "TextInput {"
+ "width: 100; height: 100;"
+ "Rectangle { anchors.fill: parent; color: \"yellow\"; z: parent.z - 1 }"
+ "}", QUrl(""));
+ QDeclarativeItem *createdItem = qobject_cast<QDeclarativeItem*>(qmlComponent.create(engine.rootContext()));
+ QVERIFY(createdItem != 0);
+
+ scene.addItem(createdItem);
+
+ createdItem->QGraphicsItem::setFocus();
+ QCoreApplication::processEvents();
+ scene.setFocusItem(0);
+ QCoreApplication::processEvents();
+
+ QVERIFY(!createdItem->hasActiveFocus());
+}
+
QTEST_MAIN(tst_QDeclarativeItem)
#include "tst_qdeclarativeitem.moc"
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/LocalLast2.qml b/tests/auto/declarative/qdeclarativelanguage/data/LocalLast2.qml
new file mode 100644
index 00000000..4bf7eb2e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/LocalLast2.qml
@@ -0,0 +1,2 @@
+import QtQuick 1.0
+MouseArea {}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/MyComponentType.qml b/tests/auto/declarative/qdeclarativelanguage/data/MyComponentType.qml
new file mode 100644
index 00000000..9ba0d612
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/MyComponentType.qml
@@ -0,0 +1,5 @@
+import QtQuick 1.0
+
+Item {
+ property int test: 11
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/localOrderTest.qml b/tests/auto/declarative/qdeclarativelanguage/data/localOrderTest.qml
new file mode 100644
index 00000000..d3b31a3d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/localOrderTest.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.0
+import org.qtproject.installedtest 1.0
+
+LocalLast2 {
+ property Item item: LocalLast {}
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/qmlComponentType.qml b/tests/auto/declarative/qdeclarativelanguage/data/qmlComponentType.qml
new file mode 100644
index 00000000..532bc319
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/qmlComponentType.qml
@@ -0,0 +1,4 @@
+import QtQuick 1.0
+import Test 1.0
+
+MyComponentType {}
diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp
index ee01235b..f812110d 100644
--- a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp
@@ -69,7 +69,9 @@ void registerTypes()
qmlRegisterCustomType<MyCustomParserType>("Test", 1, 0, "MyCustomParserType", new MyCustomParserTypeParser);
+#ifdef QT_BUILD_INTERNAL
qmlRegisterTypeNotAvailable("Test",1,0,"UnavailableType", "UnavailableType is unavailable for testing");
+#endif
}
QVariant myCustomVariantTypeConverter(const QString &data)
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index b37873b2..1574aa4a 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -99,6 +99,7 @@ private slots:
void assignLiteralToVariant();
void customParserTypes();
void rootAsQmlComponent();
+ void qmlComponentType();
void inlineQmlComponents();
void idProperty();
void autoNotifyConnection();
@@ -132,6 +133,7 @@ private slots:
void reservedWords();
void inlineAssignmentsOverrideBindings();
void nestedComponentRoots();
+ void implicitImportsLast();
void basicRemote_data();
void basicRemote();
@@ -403,7 +405,9 @@ void tst_qdeclarativelanguage::errors_data()
QTest::newRow("invalidOn") << "invalidOn.qml" << "invalidOn.errors.txt" << false;
QTest::newRow("invalidProperty") << "invalidProperty.qml" << "invalidProperty.errors.txt" << false;
QTest::newRow("nonScriptableProperty") << "nonScriptableProperty.qml" << "nonScriptableProperty.errors.txt" << false;
+#ifdef QT_BUILD_INTERNAL
QTest::newRow("notAvailable") << "notAvailable.qml" << "notAvailable.errors.txt" << false;
+#endif
QTest::newRow("singularProperty") << "singularProperty.qml" << "singularProperty.errors.txt" << false;
QTest::newRow("singularProperty.2") << "singularProperty.2.qml" << "singularProperty.2.errors.txt" << false;
QTest::newRow("incorrectCase") << "incorrectCase.qml"
@@ -627,6 +631,16 @@ void tst_qdeclarativelanguage::rootAsQmlComponent()
QCOMPARE(object->getChildren()->count(), 2);
}
+// Tests that types can be specified from a QML only component
+void tst_qdeclarativelanguage::qmlComponentType()
+{
+ QDeclarativeComponent component(&engine, testFileUrl("qmlComponentType.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = qobject_cast<QObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test"), QVariant(11));
+}
+
// Tests that components can be specified inline
void tst_qdeclarativelanguage::inlineQmlComponents()
{
@@ -1806,6 +1820,11 @@ void tst_qdeclarativelanguage::importsOrder_data()
"LocalLast {}"
<< (!qmlCheckTypes()?"QDeclarativeRectangle":"")// i.e. from org.qtproject.installedtest, not data/LocalLast.qml
<< (!qmlCheckTypes()?"":"LocalLast is ambiguous. Found in lib/org/qtproject/installedtest and in local directory");
+ QTest::newRow("local last 3") <<
+ "import org.qtproject.installedtest 1.0\n"
+ "LocalLast {LocalLast2{}}"
+ << (!qmlCheckTypes()?"QDeclarativeRectangle":"")// i.e. from org.qtproject.installedtest, not data/LocalLast.qml
+ << (!qmlCheckTypes()?"":"LocalLast is ambiguous. Found in lib/org/qtproject/installedtest and in local directory");
}
void tst_qdeclarativelanguage::importsOrder()
@@ -1959,6 +1978,8 @@ void tst_qdeclarativelanguage::initTestCase()
{
QDeclarativeDataTest::initTestCase();
registerTypes();
+ // Registered here because it uses testFileUrl
+ qmlRegisterType(testFileUrl("MyComponentType.qml"), "Test", 1, 0, "MyComponentType");
// Registering the TestType class in other modules should have no adverse effects
qmlRegisterType<TestType>("org.qtproject.TestPre", 1, 0, "Test");
@@ -2021,6 +2042,23 @@ void tst_qdeclarativelanguage::compatibilitySemicolon()
QVERIFY(o != 0);
}
+// Tests that the implicit import has lowest precedence, in the case where
+// there are conflicting types and types only found in the local import.
+// Tests that just check one (or the root) type are in ::importsOrder
+void tst_qdeclarativelanguage::implicitImportsLast()
+{
+ if (qmlCheckTypes())
+ QSKIP("This test is about maintaining the same choice when type is ambiguous.");
+ QDeclarativeComponent component(&engine, testFileUrl("localOrderTest.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = qobject_cast<QObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(QString(object->metaObject()->className()).startsWith(QLatin1String("QDeclarativeMouseArea")));
+ QObject* object2 = object->property("item").value<QObject*>();
+ QVERIFY(object2 != 0);
+ QCOMPARE(QString(object2->metaObject()->className()), QLatin1String("QDeclarativeRectangle"));
+}
+
QTEST_MAIN(tst_qdeclarativelanguage)
#include "tst_qdeclarativelanguage.moc"
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index 5c00ac95..eb0e0948 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -85,6 +85,7 @@ private slots:
void enforceRange();
void spacing();
void sections();
+ void currentSection();
void sectionsDelegate();
void cacheBuffer();
void positionViewAtIndex();
@@ -1049,6 +1050,36 @@ void tst_QDeclarativeListView::sections()
delete canvas;
}
+void tst_QDeclarativeListView::currentSection()
+{
+ // QTBUG-29712
+ // update currentSection correctly if model modifications
+ // do not trigger a refill
+ QDeclarativeView *canvas = createView();
+
+ TestModel model;
+ for (int i = 0; i < 5; i++)
+ model.addItem("Item" + QString::number(i), QString::number(i));
+
+ QDeclarativeContext *ctxt = canvas->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-sections.qml"));
+ qApp->processEvents();
+
+ QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ // make sure the listView won't trigger refill when removing the first row
+ QTRY_VERIFY(listview->height() > model.count() * 40);
+
+ QTRY_COMPARE(listview->currentSection(), QString("0"));
+ model.removeItem(0);
+ QTRY_COMPARE(listview->currentSection(), QString("1"));
+
+ delete canvas;
+}
+
void tst_QDeclarativeListView::sectionsDelegate()
{
QDeclarativeView *canvas = createView();
diff --git a/tests/auto/declarative/qdeclarativemousearea/data/nestedStopAtBounds.qml b/tests/auto/declarative/qdeclarativemousearea/data/nestedStopAtBounds.qml
new file mode 100644
index 00000000..0379964d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemousearea/data/nestedStopAtBounds.qml
@@ -0,0 +1,44 @@
+import QtQuick 1.1
+
+Rectangle {
+ width: 400
+ height: 400
+
+ MouseArea {
+ id: outer
+ objectName: "outer"
+ x: 50
+ y: 50
+ width: 300
+ height: 300
+
+ drag.target: outer
+ drag.filterChildren: true
+
+ Rectangle {
+ anchors.fill: parent
+ color: "yellow"
+ }
+
+ MouseArea {
+ id: inner
+ objectName: "inner"
+
+ x: 0
+ y: 0
+ width: 200
+ height: 200
+
+ drag.target: inner
+ drag.minimumX: 0
+ drag.maximumX: 100
+ drag.minimumY: 0
+ drag.maximumY: 100
+
+ Rectangle {
+ anchors.fill: parent
+ color: "blue"
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
index b28381ef..0415c5c9 100644
--- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
+++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
@@ -71,6 +71,8 @@ private slots:
void preventContextMenu();
#endif // QT_NO_CONTEXTMENU
void changeAxis();
+ void nestedStopAtBounds();
+ void nestedStopAtBounds_data();
private:
QDeclarativeView *createView();
@@ -237,18 +239,18 @@ void tst_QDeclarativeMouseArea::dragging()
QApplication::sendEvent(scene, &moveEvent);
QVERIFY(drag->active());
- QCOMPARE(blackRect->x(), 72.0);
- QCOMPARE(blackRect->y(), 72.0);
+ QCOMPARE(blackRect->x(), 61.0);
+ QCOMPARE(blackRect->y(), 61.0);
QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease);
- releaseEvent.setScenePos(QPointF(110, 110));
+ releaseEvent.setScenePos(QPointF(122, 122));
releaseEvent.setButton(Qt::LeftButton);
releaseEvent.setButtons(Qt::LeftButton);
QApplication::sendEvent(scene, &releaseEvent);
QVERIFY(!drag->active());
- QCOMPARE(blackRect->x(), 72.0);
- QCOMPARE(blackRect->y(), 72.0);
+ QCOMPARE(blackRect->x(), 61.0);
+ QCOMPARE(blackRect->y(), 61.0);
delete canvas;
}
@@ -739,14 +741,14 @@ void tst_QDeclarativeMouseArea::changeAxis()
QApplication::sendEvent(scene, &moveEvent);
QVERIFY(drag->active());
- QCOMPARE(blackRect->x(), 72.0);
- QCOMPARE(blackRect->y(), 72.0);
+ QCOMPARE(blackRect->x(), 61.0);
+ QCOMPARE(blackRect->y(), 61.0);
QCOMPARE(drag->axis(), QDeclarativeDrag::XandYAxis);
/* When blackRect.x becomes bigger than 75, the drag axis is change to
* Drag.YAxis by the QML code. Verify that this happens, and that the drag
* movement is effectively constrained to the Y axis. */
- moveEvent.setScenePos(QPointF(133, 133));
+ moveEvent.setScenePos(QPointF(144, 144));
moveEvent.setButton(Qt::LeftButton);
moveEvent.setButtons(Qt::LeftButton);
QApplication::sendEvent(scene, &moveEvent);
@@ -755,7 +757,7 @@ void tst_QDeclarativeMouseArea::changeAxis()
QCOMPARE(blackRect->y(), 83.0);
QCOMPARE(drag->axis(), QDeclarativeDrag::YAxis);
- moveEvent.setScenePos(QPointF(144, 144));
+ moveEvent.setScenePos(QPointF(155, 155));
moveEvent.setButton(Qt::LeftButton);
moveEvent.setButtons(Qt::LeftButton);
QApplication::sendEvent(scene, &moveEvent);
@@ -764,7 +766,7 @@ void tst_QDeclarativeMouseArea::changeAxis()
QCOMPARE(blackRect->y(), 94.0);
QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease);
- releaseEvent.setScenePos(QPointF(144, 144));
+ releaseEvent.setScenePos(QPointF(155, 155));
releaseEvent.setButton(Qt::LeftButton);
releaseEvent.setButtons(Qt::LeftButton);
QApplication::sendEvent(scene, &releaseEvent);
@@ -776,6 +778,80 @@ void tst_QDeclarativeMouseArea::changeAxis()
delete canvas;
}
+void tst_QDeclarativeMouseArea::nestedStopAtBounds_data()
+{
+ QTest::addColumn<bool>("transpose");
+ QTest::addColumn<bool>("invert");
+
+ QTest::newRow("left") << false << false;
+ QTest::newRow("right") << false << true;
+ QTest::newRow("top") << true << false;
+ QTest::newRow("bottom") << true << true;
+}
+
+void tst_QDeclarativeMouseArea::nestedStopAtBounds()
+{
+ QFETCH(bool, transpose);
+ QFETCH(bool, invert);
+
+ QDeclarativeView view;
+ view.setSource(QUrl::fromLocalFile(SRCDIR "/data/nestedStopAtBounds.qml"));
+ view.show();
+ view.activateWindow();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(view.rootObject());
+
+ QDeclarativeMouseArea *outer = view.rootObject()->findChild<QDeclarativeMouseArea*>("outer");
+ QVERIFY(outer);
+
+ QDeclarativeMouseArea *inner = outer->findChild<QDeclarativeMouseArea*>("inner");
+ QVERIFY(inner);
+ inner->drag()->setAxis(transpose ? QDeclarativeDrag::YAxis : QDeclarativeDrag::XAxis);
+ inner->setX(invert ? 100 : 0);
+ inner->setY(invert ? 100 : 0);
+
+ const int threshold = QApplication::startDragDistance();
+
+ QPoint position(200, 200);
+ int &axis = transpose ? position.ry() : position.rx();
+
+ QGraphicsSceneMouseEvent moveEvent(QEvent::GraphicsSceneMouseMove);
+ moveEvent.setButton(Qt::LeftButton);
+ moveEvent.setButtons(Qt::LeftButton);
+
+ // drag toward the aligned boundary. Outer mouse area dragged.
+ QTest::mousePress(view.viewport(), Qt::LeftButton, 0, position);
+ QTest::qWait(10);
+ axis += invert ? threshold * 2 : -threshold * 2;
+ moveEvent.setScenePos(position);
+ QApplication::sendEvent(view.scene(), &moveEvent);
+ axis += invert ? threshold : -threshold;
+ moveEvent.setScenePos(position);
+ QApplication::sendEvent(view.scene(), &moveEvent);
+ QCOMPARE(outer->drag()->active(), true);
+ QCOMPARE(inner->drag()->active(), false);
+ QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, position);
+
+ QVERIFY(!outer->drag()->active());
+
+ axis = 200;
+ outer->setX(50);
+ outer->setY(50);
+
+ // drag away from the aligned boundary. Inner mouse area dragged.
+ QTest::mousePress(view.viewport(), Qt::LeftButton, 0, position);
+ QTest::qWait(10);
+ axis += invert ? -threshold * 2 : threshold * 2;
+ moveEvent.setScenePos(position);
+ QApplication::sendEvent(view.scene(), &moveEvent);
+ axis += invert ? -threshold : threshold;
+ moveEvent.setScenePos(position);
+ QApplication::sendEvent(view.scene(), &moveEvent);
+ QCOMPARE(outer->drag()->active(), false);
+ QCOMPARE(inner->drag()->active(), true);
+ QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, position);
+}
+
QTEST_MAIN(tst_QDeclarativeMouseArea)
#include "tst_qdeclarativemousearea.moc"
diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
index cd8c5aed..8815dbfb 100644
--- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
+++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
@@ -615,45 +615,44 @@ void tst_QDeclarativePathView::moveModel_data()
QTest::addColumn<int>("from");
QTest::addColumn<int>("to");
QTest::addColumn<int>("count");
- QTest::addColumn<qreal>("offset");
QTest::addColumn<int>("currentIndex");
// We have 8 items, with currentIndex == 4
QTest::newRow("move after current")
- << int(QDeclarativePathView::StrictlyEnforceRange) << 5 << 6 << 1 << 4. << 4;
+ << int(QDeclarativePathView::StrictlyEnforceRange) << 5 << 6 << 1 << 4;
QTest::newRow("move before current")
- << int(QDeclarativePathView::StrictlyEnforceRange) << 2 << 3 << 1 << 4. << 4;
+ << int(QDeclarativePathView::StrictlyEnforceRange) << 2 << 3 << 1 << 4;
QTest::newRow("move before current to after")
- << int(QDeclarativePathView::StrictlyEnforceRange) << 2 << 6 << 1 << 5. << 3;
+ << int(QDeclarativePathView::StrictlyEnforceRange) << 2 << 6 << 1 << 3;
QTest::newRow("move multiple after current")
- << int(QDeclarativePathView::StrictlyEnforceRange) << 5 << 6 << 2 << 4. << 4;
+ << int(QDeclarativePathView::StrictlyEnforceRange) << 5 << 6 << 2 << 4;
QTest::newRow("move multiple before current")
- << int(QDeclarativePathView::StrictlyEnforceRange) << 0 << 1 << 2 << 4. << 4;
+ << int(QDeclarativePathView::StrictlyEnforceRange) << 0 << 1 << 2 << 4;
QTest::newRow("move before current to end")
- << int(QDeclarativePathView::StrictlyEnforceRange) << 2 << 7 << 1 << 5. << 3;
+ << int(QDeclarativePathView::StrictlyEnforceRange) << 2 << 7 << 1 << 3;
QTest::newRow("move last to beginning")
- << int(QDeclarativePathView::StrictlyEnforceRange) << 7 << 0 << 1 << 3. << 5;
+ << int(QDeclarativePathView::StrictlyEnforceRange) << 7 << 0 << 1 << 5;
QTest::newRow("move current")
- << int(QDeclarativePathView::StrictlyEnforceRange) << 4 << 6 << 1 << 2. << 6;
+ << int(QDeclarativePathView::StrictlyEnforceRange) << 4 << 6 << 1 << 6;
QTest::newRow("no range - move after current")
- << int(QDeclarativePathView::NoHighlightRange) << 5 << 6 << 1 << 4. << 4;
+ << int(QDeclarativePathView::NoHighlightRange) << 5 << 6 << 1 << 4;
QTest::newRow("no range - move before current")
- << int(QDeclarativePathView::NoHighlightRange) << 2 << 3 << 1 << 4. << 4;
+ << int(QDeclarativePathView::NoHighlightRange) << 2 << 3 << 1 << 4;
QTest::newRow("no range - move before current to after")
- << int(QDeclarativePathView::NoHighlightRange) << 2 << 6 << 1 << 5. << 3;
+ << int(QDeclarativePathView::NoHighlightRange) << 2 << 6 << 1 << 3;
QTest::newRow("no range - move multiple after current")
- << int(QDeclarativePathView::NoHighlightRange) << 5 << 6 << 2 << 4. << 4;
+ << int(QDeclarativePathView::NoHighlightRange) << 5 << 6 << 2 << 4;
QTest::newRow("no range - move multiple before current")
- << int(QDeclarativePathView::NoHighlightRange) << 0 << 1 << 2 << 4. << 4;
+ << int(QDeclarativePathView::NoHighlightRange) << 0 << 1 << 2 << 4;
QTest::newRow("no range - move before current to end")
- << int(QDeclarativePathView::NoHighlightRange) << 2 << 7 << 1 << 5. << 3;
+ << int(QDeclarativePathView::NoHighlightRange) << 2 << 7 << 1 << 3;
QTest::newRow("no range - move last to beginning")
- << int(QDeclarativePathView::NoHighlightRange) << 7 << 0 << 1 << 3. << 5;
+ << int(QDeclarativePathView::NoHighlightRange) << 7 << 0 << 1 << 5;
QTest::newRow("no range - move current")
- << int(QDeclarativePathView::NoHighlightRange) << 4 << 6 << 1 << 4. << 6;
+ << int(QDeclarativePathView::NoHighlightRange) << 4 << 6 << 1 << 6;
QTest::newRow("no range - move multiple incl. current")
- << int(QDeclarativePathView::NoHighlightRange) << 0 << 1 << 5 << 4. << 5;
+ << int(QDeclarativePathView::NoHighlightRange) << 0 << 1 << 5 << 5;
}
void tst_QDeclarativePathView::moveModel()
@@ -662,7 +661,6 @@ void tst_QDeclarativePathView::moveModel()
QFETCH(int, from);
QFETCH(int, to);
QFETCH(int, count);
- QFETCH(qreal, offset);
QFETCH(int, currentIndex);
QDeclarativeView *window = createView();
diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationZeroDuration.qml b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationZeroDuration.qml
new file mode 100644
index 00000000..cba1ffe5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationZeroDuration.qml
@@ -0,0 +1,12 @@
+import QtQuick 1.0
+
+Rectangle {
+ width: 300; height: 300;
+ Rectangle {
+ objectName: "theRect"
+ color: "red"
+ width: 60; height: 60;
+ x: 100; y: 100;
+ SmoothedAnimation on x { objectName: "easeX"; to: 200; duration: 0 }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp b/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp
index 452168a6..1d511779 100644
--- a/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp
+++ b/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp
@@ -58,6 +58,7 @@ private slots:
void simpleAnimation();
void valueSource();
void behavior();
+ void zeroDuration();
private:
QDeclarativeEngine engine;
@@ -201,6 +202,26 @@ void tst_qdeclarativesmoothedanimation::behavior()
QTRY_COMPARE(theRect->y(), qreal(200));
}
+void tst_qdeclarativesmoothedanimation::zeroDuration()
+{
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimationZeroDuration.qml"));
+
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QDeclarativeRectangle *theRect = rect->findChild<QDeclarativeRectangle*>("theRect");
+ QVERIFY(theRect);
+
+ QDeclarativeSmoothedAnimation *easeX = rect->findChild<QDeclarativeSmoothedAnimation*>("easeX");
+ QVERIFY(easeX);
+ QVERIFY(easeX->isRunning());
+
+ QTRY_VERIFY(!easeX->isRunning());
+ QTRY_COMPARE(theRect->x(), qreal(200));
+}
+
QTEST_MAIN(tst_qdeclarativesmoothedanimation)
#include "tst_qdeclarativesmoothedanimation.moc"
diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp
index 1b2fdc4e..6e7c7f6b 100644
--- a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp
+++ b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp
@@ -520,7 +520,7 @@ void tst_qdeclarativevisualdatamodel::qaimRowsMoved()
SingleRoleModel model;
model.list.clear();
for (int i=0; i<30; i++)
- model.list << ("item " + i);
+ model.list << (QStringLiteral("item ") + QString::number(i));
engine.rootContext()->setContextProperty("myModel", &model);
QDeclarativeVisualDataModel *obj = qobject_cast<QDeclarativeVisualDataModel*>(c.create());
diff --git a/tools/qml/qdeclarativetester.cpp b/tools/qml/qdeclarativetester.cpp
index 6b7c395c..056216e2 100644
--- a/tools/qml/qdeclarativetester.cpp
+++ b/tools/qml/qdeclarativetester.cpp
@@ -355,7 +355,7 @@ void QDeclarativeTester::updateCurrentTime(int msec)
// Advance test script
while (testscript && testscript->count() > testscriptidx) {
- QObject *event = testscript->event(testscriptidx);
+ QObject *event = testscript->eventAt(testscriptidx);
if (QDeclarativeVisualTestFrame *frame = qobject_cast<QDeclarativeVisualTestFrame *>(event)) {
if (frame->msec() < msec) {
diff --git a/tools/qml/qdeclarativetester.h b/tools/qml/qdeclarativetester.h
index fc16565c..13bddbb5 100644
--- a/tools/qml/qdeclarativetester.h
+++ b/tools/qml/qdeclarativetester.h
@@ -65,7 +65,7 @@ public:
QDeclarativeListProperty<QObject> events() { return QDeclarativeListProperty<QObject>(this, m_events); }
int count() const { return m_events.count(); }
- QObject *event(int idx) { return m_events.at(idx); }
+ QObject *eventAt(int idx) const { return m_events.at(idx); }
private:
QList<QObject *> m_events;