summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-02-23 05:46:14 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-02-23 06:29:52 (GMT)
commiteefe993a4241b48f14991c44baa2c074b10bc194 (patch)
treea1a6ecdeb90c17707839c9c5e9cb8776ec4ff97f /src/declarative
parentf8eee22dcdd9b6b530c0e5c346e16552352ec03b (diff)
parente988763395625171bed001b5916d4da003d39aee (diff)
downloadQt-eefe993a4241b48f14991c44baa2c074b10bc194.zip
Qt-eefe993a4241b48f14991c44baa2c074b10bc194.tar.gz
Qt-eefe993a4241b48f14991c44baa2c074b10bc194.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/3rdparty/qlistmodelinterface.cpp36
-rw-r--r--src/declarative/3rdparty/qlistmodelinterface_p.h34
-rw-r--r--src/declarative/QmlChanges.txt33
-rw-r--r--src/declarative/debugger/qmldebug.cpp2
-rw-r--r--src/declarative/debugger/qmldebug_p.h2
-rw-r--r--src/declarative/debugger/qmldebugclient.cpp2
-rw-r--r--src/declarative/debugger/qmldebugclient_p.h2
-rw-r--r--src/declarative/debugger/qmldebuggerstatus.cpp2
-rw-r--r--src/declarative/debugger/qmldebuggerstatus_p.h2
-rw-r--r--src/declarative/debugger/qmldebugservice.cpp2
-rw-r--r--src/declarative/debugger/qmldebugservice_p.h2
-rw-r--r--src/declarative/debugger/qpacketprotocol.cpp2
-rw-r--r--src/declarative/debugger/qpacketprotocol_p.h2
-rw-r--r--src/declarative/graphicsitems/graphicsitems.pri6
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsanchors.cpp28
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsanchors_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsanimatedimage.cpp3
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsanimatedimage_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsanimatedimage_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsborderimage.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsborderimage_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsborderimage_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicseffects.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicseffects_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsevents.cpp4
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsevents_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsflickable.cpp67
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsflickable_p.h22
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsflickable_p_p.h17
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsflipable.cpp10
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsflipable_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsfocuspanel.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsfocuspanel_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsfocusscope.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsfocusscope_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsgridview.cpp29
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsgridview_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsimage.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsimage_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsimage_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsimagebase.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsimagebase_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsimagebase_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitem.cpp203
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitem.h32
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitem_p.h41
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitemchangelistener_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp7
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitemsmodule_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicslayoutitem.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicslayoutitem_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicslistview.cpp64
-rw-r--r--src/declarative/graphicsitems/qmlgraphicslistview_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsloader.cpp5
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsloader_p.h6
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsloader_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsmousearea.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsmouseregion.cpp)212
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsmousearea_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsmouseregion_p.h)44
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsmousearea_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsmouseregion_p_p.h)14
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspainteditem.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspainteditem_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspainteditem_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsparticles.cpp4
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsparticles_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspath.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspath_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspath_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspathview.cpp11
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspathview_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspathview_p_p.h5
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspositioners.cpp10
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspositioners_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspositioners_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsrectangle.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsrectangle_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsrepeater.cpp11
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsrepeater_p.h9
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsrepeater_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsscalegrid.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsscalegrid_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstext.cpp15
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstext_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstext_p_p.h4
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstextedit.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstextedit_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstextedit_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstextinput.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstextinput_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstextinput_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp41
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h6
-rw-r--r--src/declarative/graphicsitems/qmlgraphicswebview.cpp26
-rw-r--r--src/declarative/graphicsitems/qmlgraphicswebview_p.h6
-rw-r--r--src/declarative/graphicsitems/qmlgraphicswebview_p_p.h2
-rw-r--r--src/declarative/qml/parser/qmljsast.cpp2
-rw-r--r--src/declarative/qml/parser/qmljsast_p.h2
-rw-r--r--src/declarative/qml/parser/qmljsastfwd_p.h2
-rw-r--r--src/declarative/qml/parser/qmljsastvisitor.cpp2
-rw-r--r--src/declarative/qml/parser/qmljsastvisitor_p.h2
-rw-r--r--src/declarative/qml/parser/qmljsengine_p.cpp2
-rw-r--r--src/declarative/qml/parser/qmljsengine_p.h2
-rw-r--r--src/declarative/qml/parser/qmljsglobal_p.h2
-rw-r--r--src/declarative/qml/parser/qmljsgrammar.cpp2
-rw-r--r--src/declarative/qml/parser/qmljsgrammar_p.h2
-rw-r--r--src/declarative/qml/parser/qmljslexer.cpp2
-rw-r--r--src/declarative/qml/parser/qmljslexer_p.h2
-rw-r--r--src/declarative/qml/parser/qmljsmemorypool_p.h2
-rw-r--r--src/declarative/qml/parser/qmljsnodepool_p.h2
-rw-r--r--src/declarative/qml/qbitfield_p.h2
-rw-r--r--src/declarative/qml/qmetaobjectbuilder.cpp2
-rw-r--r--src/declarative/qml/qmetaobjectbuilder_p.h2
-rw-r--r--src/declarative/qml/qml.h12
-rw-r--r--src/declarative/qml/qml.pri7
-rw-r--r--src/declarative/qml/qmlbinding.cpp4
-rw-r--r--src/declarative/qml/qmlbinding.h2
-rw-r--r--src/declarative/qml/qmlbinding_p.h2
-rw-r--r--src/declarative/qml/qmlboundsignal.cpp2
-rw-r--r--src/declarative/qml/qmlboundsignal_p.h2
-rw-r--r--src/declarative/qml/qmlclassfactory.cpp2
-rw-r--r--src/declarative/qml/qmlclassfactory_p.h2
-rw-r--r--src/declarative/qml/qmlcleanup.cpp2
-rw-r--r--src/declarative/qml/qmlcleanup_p.h2
-rw-r--r--src/declarative/qml/qmlcompiledbindings.cpp2
-rw-r--r--src/declarative/qml/qmlcompiledbindings_p.h2
-rw-r--r--src/declarative/qml/qmlcompileddata.cpp2
-rw-r--r--src/declarative/qml/qmlcompiler.cpp117
-rw-r--r--src/declarative/qml/qmlcompiler_p.h2
-rw-r--r--src/declarative/qml/qmlcomponent.cpp2
-rw-r--r--src/declarative/qml/qmlcomponent.h2
-rw-r--r--src/declarative/qml/qmlcomponent_p.h2
-rw-r--r--src/declarative/qml/qmlcompositetypedata_p.h2
-rw-r--r--src/declarative/qml/qmlcompositetypemanager.cpp2
-rw-r--r--src/declarative/qml/qmlcompositetypemanager_p.h2
-rw-r--r--src/declarative/qml/qmlcontext.cpp33
-rw-r--r--src/declarative/qml/qmlcontext.h6
-rw-r--r--src/declarative/qml/qmlcontext_p.h5
-rw-r--r--src/declarative/qml/qmlcontextscriptclass.cpp11
-rw-r--r--src/declarative/qml/qmlcontextscriptclass_p.h2
-rw-r--r--src/declarative/qml/qmlcustomparser.cpp2
-rw-r--r--src/declarative/qml/qmlcustomparser_p.h2
-rw-r--r--src/declarative/qml/qmlcustomparser_p_p.h2
-rw-r--r--src/declarative/qml/qmldeclarativedata_p.h2
-rw-r--r--src/declarative/qml/qmldom.cpp5
-rw-r--r--src/declarative/qml/qmldom.h349
-rw-r--r--src/declarative/qml/qmldom_p.h321
-rw-r--r--src/declarative/qml/qmldom_p_p.h157
-rw-r--r--src/declarative/qml/qmlengine.cpp45
-rw-r--r--src/declarative/qml/qmlengine.h2
-rw-r--r--src/declarative/qml/qmlengine_p.h8
-rw-r--r--src/declarative/qml/qmlenginedebug.cpp12
-rw-r--r--src/declarative/qml/qmlenginedebug_p.h2
-rw-r--r--src/declarative/qml/qmlerror.cpp2
-rw-r--r--src/declarative/qml/qmlerror.h2
-rw-r--r--src/declarative/qml/qmlexpression.cpp4
-rw-r--r--src/declarative/qml/qmlexpression.h2
-rw-r--r--src/declarative/qml/qmlexpression_p.h2
-rw-r--r--src/declarative/qml/qmlglobal_p.h2
-rw-r--r--src/declarative/qml/qmlglobalscriptclass.cpp2
-rw-r--r--src/declarative/qml/qmlglobalscriptclass_p.h2
-rw-r--r--src/declarative/qml/qmlguard_p.h2
-rw-r--r--src/declarative/qml/qmlimageprovider.cpp2
-rw-r--r--src/declarative/qml/qmlimageprovider.h2
-rw-r--r--src/declarative/qml/qmlinfo.cpp2
-rw-r--r--src/declarative/qml/qmlinfo.h2
-rw-r--r--src/declarative/qml/qmlinstruction.cpp8
-rw-r--r--src/declarative/qml/qmlinstruction_p.h4
-rw-r--r--src/declarative/qml/qmlintegercache.cpp2
-rw-r--r--src/declarative/qml/qmlintegercache_p.h2
-rw-r--r--src/declarative/qml/qmllist.cpp312
-rw-r--r--src/declarative/qml/qmllist.h134
-rw-r--r--src/declarative/qml/qmllist_p.h85
-rw-r--r--src/declarative/qml/qmllistscriptclass.cpp91
-rw-r--r--src/declarative/qml/qmllistscriptclass_p.h7
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp127
-rw-r--r--src/declarative/qml/qmlmetaproperty.h3
-rw-r--r--src/declarative/qml/qmlmetaproperty_p.h2
-rw-r--r--src/declarative/qml/qmlmetatype.cpp161
-rw-r--r--src/declarative/qml/qmlmetatype.h27
-rw-r--r--src/declarative/qml/qmlmoduleplugin.cpp4
-rw-r--r--src/declarative/qml/qmlmoduleplugin.h2
-rw-r--r--src/declarative/qml/qmlnetworkaccessmanagerfactory.cpp6
-rw-r--r--src/declarative/qml/qmlnetworkaccessmanagerfactory.h2
-rw-r--r--src/declarative/qml/qmlobjectscriptclass.cpp12
-rw-r--r--src/declarative/qml/qmlobjectscriptclass_p.h2
-rw-r--r--src/declarative/qml/qmlparser.cpp2
-rw-r--r--src/declarative/qml/qmlparser_p.h2
-rw-r--r--src/declarative/qml/qmlparserstatus.cpp2
-rw-r--r--src/declarative/qml/qmlparserstatus.h2
-rw-r--r--src/declarative/qml/qmlprivate.cpp2
-rw-r--r--src/declarative/qml/qmlprivate.h16
-rw-r--r--src/declarative/qml/qmlpropertycache.cpp4
-rw-r--r--src/declarative/qml/qmlpropertycache_p.h3
-rw-r--r--src/declarative/qml/qmlpropertyvalueinterceptor.cpp2
-rw-r--r--src/declarative/qml/qmlpropertyvalueinterceptor.h2
-rw-r--r--src/declarative/qml/qmlpropertyvaluesource.cpp2
-rw-r--r--src/declarative/qml/qmlpropertyvaluesource.h2
-rw-r--r--src/declarative/qml/qmlproxymetaobject.cpp2
-rw-r--r--src/declarative/qml/qmlproxymetaobject_p.h2
-rw-r--r--src/declarative/qml/qmlrefcount.cpp2
-rw-r--r--src/declarative/qml/qmlrefcount_p.h2
-rw-r--r--src/declarative/qml/qmlrewrite.cpp2
-rw-r--r--src/declarative/qml/qmlrewrite_p.h2
-rw-r--r--src/declarative/qml/qmlscript.cpp4
-rw-r--r--src/declarative/qml/qmlscriptclass_p.h2
-rw-r--r--src/declarative/qml/qmlscriptparser.cpp2
-rw-r--r--src/declarative/qml/qmlscriptparser_p.h2
-rw-r--r--src/declarative/qml/qmlscriptstring.cpp2
-rw-r--r--src/declarative/qml/qmlscriptstring.h2
-rw-r--r--src/declarative/qml/qmlsqldatabase.cpp2
-rw-r--r--src/declarative/qml/qmlsqldatabase_p.h5
-rw-r--r--src/declarative/qml/qmlstringconverters.cpp2
-rw-r--r--src/declarative/qml/qmlstringconverters_p.h2
-rw-r--r--src/declarative/qml/qmltypenamecache.cpp2
-rw-r--r--src/declarative/qml/qmltypenamecache_p.h2
-rw-r--r--src/declarative/qml/qmltypenamescriptclass.cpp2
-rw-r--r--src/declarative/qml/qmltypenamescriptclass_p.h2
-rw-r--r--src/declarative/qml/qmlvaluetype.cpp2
-rw-r--r--src/declarative/qml/qmlvaluetype_p.h2
-rw-r--r--src/declarative/qml/qmlvaluetypescriptclass.cpp2
-rw-r--r--src/declarative/qml/qmlvaluetypescriptclass_p.h2
-rw-r--r--src/declarative/qml/qmlvme.cpp44
-rw-r--r--src/declarative/qml/qmlvme_p.h2
-rw-r--r--src/declarative/qml/qmlvmemetaobject.cpp38
-rw-r--r--src/declarative/qml/qmlvmemetaobject_p.h33
-rw-r--r--src/declarative/qml/qmlwatcher.cpp2
-rw-r--r--src/declarative/qml/qmlwatcher_p.h2
-rw-r--r--src/declarative/qml/qmlworkerscript.cpp2
-rw-r--r--src/declarative/qml/qmlworkerscript_p.h2
-rw-r--r--src/declarative/qml/qmlxmlhttprequest.cpp2
-rw-r--r--src/declarative/qml/qmlxmlhttprequest_p.h5
-rw-r--r--src/declarative/qml/qpodvector_p.h2
-rw-r--r--src/declarative/qml/rewriter/rewriter.cpp2
-rw-r--r--src/declarative/qml/rewriter/rewriter_p.h2
-rw-r--r--src/declarative/qml/rewriter/textwriter.cpp2
-rw-r--r--src/declarative/qml/rewriter/textwriter_p.h2
-rw-r--r--src/declarative/util/qfxperf.cpp2
-rw-r--r--src/declarative/util/qfxperf_p_p.h2
-rw-r--r--src/declarative/util/qmlanimation.cpp975
-rw-r--r--src/declarative/util/qmlanimation_p.h62
-rw-r--r--src/declarative/util/qmlanimation_p_p.h88
-rw-r--r--src/declarative/util/qmlbehavior.cpp12
-rw-r--r--src/declarative/util/qmlbehavior_p.h2
-rw-r--r--src/declarative/util/qmlbind.cpp2
-rw-r--r--src/declarative/util/qmlbind_p.h2
-rw-r--r--src/declarative/util/qmlconnection.cpp8
-rw-r--r--src/declarative/util/qmlconnection_p.h2
-rw-r--r--src/declarative/util/qmldatetimeformatter.cpp2
-rw-r--r--src/declarative/util/qmldatetimeformatter_p.h2
-rw-r--r--src/declarative/util/qmleasefollow.cpp13
-rw-r--r--src/declarative/util/qmleasefollow_p.h2
-rw-r--r--src/declarative/util/qmlfontloader.cpp2
-rw-r--r--src/declarative/util/qmlfontloader_p.h2
-rw-r--r--src/declarative/util/qmllistaccessor.cpp131
-rw-r--r--src/declarative/util/qmllistaccessor_p.h9
-rw-r--r--src/declarative/util/qmllistmodel.cpp46
-rw-r--r--src/declarative/util/qmllistmodel_p.h2
-rw-r--r--src/declarative/util/qmlnullablevalue_p_p.h2
-rw-r--r--src/declarative/util/qmlnumberformatter.cpp2
-rw-r--r--src/declarative/util/qmlnumberformatter_p.h2
-rw-r--r--src/declarative/util/qmlopenmetaobject.cpp2
-rw-r--r--src/declarative/util/qmlopenmetaobject_p.h2
-rw-r--r--src/declarative/util/qmlpackage.cpp42
-rw-r--r--src/declarative/util/qmlpackage_p.h6
-rw-r--r--src/declarative/util/qmlpixmapcache.cpp40
-rw-r--r--src/declarative/util/qmlpixmapcache_p.h2
-rw-r--r--src/declarative/util/qmlpropertychanges.cpp8
-rw-r--r--src/declarative/util/qmlpropertychanges_p.h2
-rw-r--r--src/declarative/util/qmlpropertymap.cpp2
-rw-r--r--src/declarative/util/qmlpropertymap.h2
-rw-r--r--src/declarative/util/qmlspringfollow.cpp2
-rw-r--r--src/declarative/util/qmlspringfollow_p.h2
-rw-r--r--src/declarative/util/qmlstate.cpp22
-rw-r--r--src/declarative/util/qmlstate_p.h9
-rw-r--r--src/declarative/util/qmlstate_p_p.h35
-rw-r--r--src/declarative/util/qmlstategroup.cpp55
-rw-r--r--src/declarative/util/qmlstategroup_p.h10
-rw-r--r--src/declarative/util/qmlstateoperations.cpp12
-rw-r--r--src/declarative/util/qmlstateoperations_p.h2
-rw-r--r--src/declarative/util/qmlstyledtext.cpp2
-rw-r--r--src/declarative/util/qmlstyledtext_p.h2
-rw-r--r--src/declarative/util/qmlsystempalette.cpp2
-rw-r--r--src/declarative/util/qmlsystempalette_p.h2
-rw-r--r--src/declarative/util/qmltimeline.cpp49
-rw-r--r--src/declarative/util/qmltimeline_p_p.h53
-rw-r--r--src/declarative/util/qmltimer.cpp2
-rw-r--r--src/declarative/util/qmltimer_p.h2
-rw-r--r--src/declarative/util/qmltransition.cpp41
-rw-r--r--src/declarative/util/qmltransition_p.h6
-rw-r--r--src/declarative/util/qmltransitionmanager.cpp2
-rw-r--r--src/declarative/util/qmltransitionmanager_p_p.h2
-rw-r--r--src/declarative/util/qmlview.cpp367
-rw-r--r--src/declarative/util/qmlview.h47
-rw-r--r--src/declarative/util/qmlxmllistmodel.cpp81
-rw-r--r--src/declarative/util/qmlxmllistmodel_p.h6
-rw-r--r--src/declarative/util/qnumberformat.cpp2
-rw-r--r--src/declarative/util/qnumberformat_p.h2
-rw-r--r--src/declarative/util/qperformancelog.cpp2
-rw-r--r--src/declarative/util/qperformancelog_p_p.h2
-rw-r--r--src/declarative/widgets/graphicslayouts.cpp6
-rw-r--r--src/declarative/widgets/graphicslayouts_p.h85
-rw-r--r--src/declarative/widgets/graphicswidgets.cpp74
-rw-r--r--src/declarative/widgets/graphicswidgets_p.h2
306 files changed, 3090 insertions, 3008 deletions
diff --git a/src/declarative/3rdparty/qlistmodelinterface.cpp b/src/declarative/3rdparty/qlistmodelinterface.cpp
index cfd4cff..939e985 100644
--- a/src/declarative/3rdparty/qlistmodelinterface.cpp
+++ b/src/declarative/3rdparty/qlistmodelinterface.cpp
@@ -1,16 +1,17 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** This file is part of the QtDeclaractive module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/declarative/3rdparty/qlistmodelinterface_p.h b/src/declarative/3rdparty/qlistmodelinterface_p.h
index a958ead..07592ad 100644
--- a/src/declarative/3rdparty/qlistmodelinterface_p.h
+++ b/src/declarative/3rdparty/qlistmodelinterface_p.h
@@ -1,7 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
@@ -9,8 +10,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** contained in the Technology Preview License Agreement accompanying
+** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -20,21 +21,20 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt
index e54ec95..06fa720 100644
--- a/src/declarative/QmlChanges.txt
+++ b/src/declarative/QmlChanges.txt
@@ -1,7 +1,38 @@
+=============================================================================
+The changes below are pre Qt 4.7.0 alpha
+
+Renamed MouseRegion -> MouseArea
+
+QmlView
+-------
+The API of QmlView has been narrowed and its role as a convenience class
+reinforced.
+- remove addItem()
+- remove clearItems() - use 'delete root()'
+- remove reset()
+- resizeContent -> enum ResizeMode { SizeViewToRootObject, SizeRootObjectToView }
+- remove setQml(), qml()
+- rename setUrl(), ur() to setSource(), source()
+- root() -> rootObject(), returns QGraphicsObject rather than QmlGraphicsItem
+- remove quit() signal -> use quit() signal of engine()
+- initialSize() signal removed
+- Added status() to determine status of the internal QmlComponent
+sectionExpression has been replaced by section.property, section.criteria
-Listview: sectionExpression has been replaced by section.property, section.criteria
+ListModel
+---------
+- types are strictly checked (previously, everything was a string)
+ - foo: "bar" continues to work as before
+ - foo: bar is now invalid, use foo: "bar"
+ - foo: true is now a bool (not string "true")
+ - foo: false is now a bool (not string "false" == true!)
+PropertyAnimation
+------------------
+matchProperties and matchTargets have been renamed back to properties and targets.
+The semantics are explained in the PropertyAnimation::properties documentation
+and the animation overview documentation.
=============================================================================
The changes below are pre-4.6.0 release.
diff --git a/src/declarative/debugger/qmldebug.cpp b/src/declarative/debugger/qmldebug.cpp
index 489eaa1..32d8bbb 100644
--- a/src/declarative/debugger/qmldebug.cpp
+++ b/src/declarative/debugger/qmldebug.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/debugger/qmldebug_p.h b/src/declarative/debugger/qmldebug_p.h
index 58c66ec..a1371d5 100644
--- a/src/declarative/debugger/qmldebug_p.h
+++ b/src/declarative/debugger/qmldebug_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/debugger/qmldebugclient.cpp b/src/declarative/debugger/qmldebugclient.cpp
index 68e14c2..ae42b5b 100644
--- a/src/declarative/debugger/qmldebugclient.cpp
+++ b/src/declarative/debugger/qmldebugclient.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/debugger/qmldebugclient_p.h b/src/declarative/debugger/qmldebugclient_p.h
index d64541b..c3e6eff 100644
--- a/src/declarative/debugger/qmldebugclient_p.h
+++ b/src/declarative/debugger/qmldebugclient_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/debugger/qmldebuggerstatus.cpp b/src/declarative/debugger/qmldebuggerstatus.cpp
index dc1cfb0..0f2a973 100644
--- a/src/declarative/debugger/qmldebuggerstatus.cpp
+++ b/src/declarative/debugger/qmldebuggerstatus.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/debugger/qmldebuggerstatus_p.h b/src/declarative/debugger/qmldebuggerstatus_p.h
index 7c8070b..42538f3 100644
--- a/src/declarative/debugger/qmldebuggerstatus_p.h
+++ b/src/declarative/debugger/qmldebuggerstatus_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/debugger/qmldebugservice.cpp b/src/declarative/debugger/qmldebugservice.cpp
index 2c9586f..7b21869 100644
--- a/src/declarative/debugger/qmldebugservice.cpp
+++ b/src/declarative/debugger/qmldebugservice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/debugger/qmldebugservice_p.h b/src/declarative/debugger/qmldebugservice_p.h
index ec90d95..33ddda0 100644
--- a/src/declarative/debugger/qmldebugservice_p.h
+++ b/src/declarative/debugger/qmldebugservice_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp
index fb07c62..7440b87 100644
--- a/src/declarative/debugger/qpacketprotocol.cpp
+++ b/src/declarative/debugger/qpacketprotocol.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/debugger/qpacketprotocol_p.h b/src/declarative/debugger/qpacketprotocol_p.h
index 265af81..cfdce4e 100644
--- a/src/declarative/debugger/qpacketprotocol_p.h
+++ b/src/declarative/debugger/qpacketprotocol_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/graphicsitems.pri b/src/declarative/graphicsitems/graphicsitems.pri
index db9c29e..e5343c6 100644
--- a/src/declarative/graphicsitems/graphicsitems.pri
+++ b/src/declarative/graphicsitems/graphicsitems.pri
@@ -28,8 +28,8 @@ HEADERS += \
$$PWD/qmlgraphicspositioners_p_p.h \
$$PWD/qmlgraphicsloader_p.h \
$$PWD/qmlgraphicsloader_p_p.h \
- $$PWD/qmlgraphicsmouseregion_p.h \
- $$PWD/qmlgraphicsmouseregion_p_p.h \
+ $$PWD/qmlgraphicsmousearea_p.h \
+ $$PWD/qmlgraphicsmousearea_p_p.h \
$$PWD/qmlgraphicspath_p.h \
$$PWD/qmlgraphicspath_p_p.h \
$$PWD/qmlgraphicspathview_p.h \
@@ -70,7 +70,7 @@ SOURCES += \
$$PWD/qmlgraphicsfocusscope.cpp \
$$PWD/qmlgraphicspositioners.cpp \
$$PWD/qmlgraphicsloader.cpp \
- $$PWD/qmlgraphicsmouseregion.cpp \
+ $$PWD/qmlgraphicsmousearea.cpp \
$$PWD/qmlgraphicspath.cpp \
$$PWD/qmlgraphicspathview.cpp \
$$PWD/qmlgraphicsrectangle.cpp \
diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp
index 816e580..cde9ec7 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -364,7 +364,7 @@ void QmlGraphicsAnchors::setFill(QmlGraphicsItem *f)
return;
}
if (f != d->item->parentItem() && f->parentItem() != d->item->parentItem()){
- qmlInfo(d->item) << tr("Can't anchor to an item that isn't a parent or sibling.");
+ qmlInfo(d->item) << tr("Cannot anchor to an item that isn't a parent or sibling.");
return;
}
d->remDepend(d->fill);
@@ -398,7 +398,7 @@ void QmlGraphicsAnchors::setCenterIn(QmlGraphicsItem* c)
return;
}
if (c != d->item->parentItem() && c->parentItem() != d->item->parentItem()){
- qmlInfo(d->item) << tr("Can't anchor to an item that isn't a parent or sibling.");
+ qmlInfo(d->item) << tr("Cannot anchor to an item that isn't a parent or sibling.");
return;
}
@@ -989,7 +989,7 @@ bool QmlGraphicsAnchorsPrivate::checkHValid() const
if (usedAnchors & QmlGraphicsAnchors::HasLeftAnchor &&
usedAnchors & QmlGraphicsAnchors::HasRightAnchor &&
usedAnchors & QmlGraphicsAnchors::HasHCenterAnchor) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't specify left, right, and hcenter anchors.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot specify left, right, and hcenter anchors.");
return false;
}
@@ -999,16 +999,16 @@ bool QmlGraphicsAnchorsPrivate::checkHValid() const
bool QmlGraphicsAnchorsPrivate::checkHAnchorValid(QmlGraphicsAnchorLine anchor) const
{
if (!anchor.item) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to a null item.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor to a null item.");
return false;
} else if (anchor.anchorLine & QmlGraphicsAnchorLine::Vertical_Mask) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor a horizontal edge to a vertical edge.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor a horizontal edge to a vertical edge.");
return false;
} else if (anchor.item != item->parentItem() && anchor.item->parentItem() != item->parentItem()){
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to an item that isn't a parent or sibling.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor to an item that isn't a parent or sibling.");
return false;
} else if (anchor.item == item) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor item to self.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor item to self.");
return false;
}
@@ -1020,13 +1020,13 @@ bool QmlGraphicsAnchorsPrivate::checkVValid() const
if (usedAnchors & QmlGraphicsAnchors::HasTopAnchor &&
usedAnchors & QmlGraphicsAnchors::HasBottomAnchor &&
usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't specify top, bottom, and vcenter anchors.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot specify top, bottom, and vcenter anchors.");
return false;
} else if (usedAnchors & QmlGraphicsAnchors::HasBaselineAnchor &&
(usedAnchors & QmlGraphicsAnchors::HasTopAnchor ||
usedAnchors & QmlGraphicsAnchors::HasBottomAnchor ||
usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor)) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors.");
return false;
}
@@ -1036,16 +1036,16 @@ bool QmlGraphicsAnchorsPrivate::checkVValid() const
bool QmlGraphicsAnchorsPrivate::checkVAnchorValid(QmlGraphicsAnchorLine anchor) const
{
if (!anchor.item) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to a null item.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor to a null item.");
return false;
} else if (anchor.anchorLine & QmlGraphicsAnchorLine::Horizontal_Mask) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor a vertical edge to a horizontal edge.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor a vertical edge to a horizontal edge.");
return false;
} else if (anchor.item != item->parentItem() && anchor.item->parentItem() != item->parentItem()){
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to an item that isn't a parent or sibling.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor to an item that isn't a parent or sibling.");
return false;
} else if (anchor.item == item){
- qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor item to self.");
+ qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor item to self.");
return false;
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors_p.h b/src/declarative/graphicsitems/qmlgraphicsanchors_p.h
index 5a8f8c1..41911ff 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanchors_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsanchors_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h b/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h
index 22eabdd..a2e41d3 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsanimatedimage.cpp b/src/declarative/graphicsitems/qmlgraphicsanimatedimage.cpp
index 7d1c87a..697be15 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanimatedimage.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsanimatedimage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -295,6 +295,7 @@ void QmlGraphicsAnimatedImage::playingStatusChanged()
void QmlGraphicsAnimatedImage::componentComplete()
{
Q_D(QmlGraphicsAnimatedImage);
+ QmlGraphicsImage::componentComplete();
if (!d->reply) {
setCurrentFrame(d->preset_currentframe);
d->preset_currentframe = 0;
diff --git a/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p.h b/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p.h
index a837702..a6cee0d 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p_p.h b/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p_p.h
index 0d1c749..5e04a93 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
index 19da151..f739464 100644
--- a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsborderimage_p.h b/src/declarative/graphicsitems/qmlgraphicsborderimage_p.h
index cf3c518..32dc388 100644
--- a/src/declarative/graphicsitems/qmlgraphicsborderimage_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsborderimage_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsborderimage_p_p.h b/src/declarative/graphicsitems/qmlgraphicsborderimage_p_p.h
index 51ebb02..b97ae6d 100644
--- a/src/declarative/graphicsitems/qmlgraphicsborderimage_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsborderimage_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicseffects.cpp b/src/declarative/graphicsitems/qmlgraphicseffects.cpp
index 268ba28..6a93b12 100644
--- a/src/declarative/graphicsitems/qmlgraphicseffects.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicseffects.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicseffects_p.h b/src/declarative/graphicsitems/qmlgraphicseffects_p.h
index 2e561f8..4b94a14 100644
--- a/src/declarative/graphicsitems/qmlgraphicseffects_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicseffects_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsevents.cpp b/src/declarative/graphicsitems/qmlgraphicsevents.cpp
index 0d6adf6..efd7b4a 100644
--- a/src/declarative/graphicsitems/qmlgraphicsevents.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsevents.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -183,7 +183,7 @@ Item {
For example, to react to a Shift key + Left mouse button click:
\qml
-MouseRegion {
+MouseArea {
onClicked: { if (mouse.button == Qt.LeftButton && mouse.modifiers & Qt.ShiftModifier) doSomething(); }
}
\endqml
diff --git a/src/declarative/graphicsitems/qmlgraphicsevents_p_p.h b/src/declarative/graphicsitems/qmlgraphicsevents_p_p.h
index b07fd88..0ed852a 100644
--- a/src/declarative/graphicsitems/qmlgraphicsevents_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsevents_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp
index 5143251..e92fea4 100644
--- a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -132,8 +132,6 @@ QmlGraphicsFlickablePrivate::QmlGraphicsFlickablePrivate()
, horizontalVelocity(this), verticalVelocity(this), vTime(0), visibleArea(0)
, flickDirection(QmlGraphicsFlickable::AutoFlickDirection)
{
- fixupXEvent = QmlTimeLineEvent::timeLineEvent<QmlGraphicsFlickablePrivate, &QmlGraphicsFlickablePrivate::fixupX>(&_moveX, this);
- fixupYEvent = QmlTimeLineEvent::timeLineEvent<QmlGraphicsFlickablePrivate, &QmlGraphicsFlickablePrivate::fixupY>(&_moveY, this);
}
void QmlGraphicsFlickablePrivate::init()
@@ -176,7 +174,7 @@ void QmlGraphicsFlickablePrivate::flickX(qreal velocity)
}
timeline.reset(_moveX);
timeline.accel(_moveX, v, deceleration, maxDistance);
- timeline.execute(fixupXEvent);
+ timeline.callback(QmlTimeLineCallback(&_moveX, fixupX_callback, this));
if (!flicked) {
flicked = true;
emit q->flickingChanged();
@@ -214,7 +212,7 @@ void QmlGraphicsFlickablePrivate::flickY(qreal velocity)
}
timeline.reset(_moveY);
timeline.accel(_moveY, v, deceleration, maxDistance);
- timeline.execute(fixupYEvent);
+ timeline.callback(QmlTimeLineCallback(&_moveY, fixupY_callback, this));
if (!flicked) {
flicked = true;
emit q->flickingChanged();
@@ -255,6 +253,16 @@ void QmlGraphicsFlickablePrivate::fixupX()
vTime = timeline.time();
}
+void QmlGraphicsFlickablePrivate::fixupY_callback(void *data)
+{
+ ((QmlGraphicsFlickablePrivate *)data)->fixupY();
+}
+
+void QmlGraphicsFlickablePrivate::fixupX_callback(void *data)
+{
+ ((QmlGraphicsFlickablePrivate *)data)->fixupX();
+}
+
void QmlGraphicsFlickablePrivate::fixupY()
{
Q_Q(QmlGraphicsFlickable);
@@ -937,51 +945,22 @@ void QmlGraphicsFlickable::cancelFlick()
movementEnding();
}
-void QmlGraphicsFlickablePrivate::data_removeAt(int)
+void QmlGraphicsFlickablePrivate::data_append(QmlListProperty<QObject> *prop, QObject *o)
{
- // ###
-}
-
-int QmlGraphicsFlickablePrivate::data_count() const
-{
- // ###
- return 0;
-}
-
-void QmlGraphicsFlickablePrivate::data_append(QObject *o)
-{
- Q_Q(QmlGraphicsFlickable);
QmlGraphicsItem *i = qobject_cast<QmlGraphicsItem *>(o);
if (i)
- viewport->fxChildren()->append(i);
+ i->setParentItem(static_cast<QmlGraphicsFlickablePrivate*>(prop->data)->viewport);
else
- o->setParent(q);
+ o->setParent(prop->object);
}
-void QmlGraphicsFlickablePrivate::data_insert(int, QObject *)
-{
- // ###
-}
-
-QObject *QmlGraphicsFlickablePrivate::data_at(int) const
-{
- // ###
- return 0;
-}
-
-void QmlGraphicsFlickablePrivate::data_clear()
-{
- // ###
-}
-
-
-QmlList<QObject *> *QmlGraphicsFlickable::flickableData()
+QmlListProperty<QObject> QmlGraphicsFlickable::flickableData()
{
Q_D(QmlGraphicsFlickable);
- return &d->data;
+ return QmlListProperty<QObject>(this, (void *)d, QmlGraphicsFlickablePrivate::data_append);
}
-QmlList<QmlGraphicsItem *> *QmlGraphicsFlickable::flickableChildren()
+QmlListProperty<QmlGraphicsItem> QmlGraphicsFlickable::flickableChildren()
{
Q_D(QmlGraphicsFlickable);
return d->viewport->fxChildren();
@@ -1006,7 +985,10 @@ bool QmlGraphicsFlickable::overShoot() const
void QmlGraphicsFlickable::setOverShoot(bool o)
{
Q_D(QmlGraphicsFlickable);
+ if (d->overShoot == o)
+ return;
d->overShoot = o;
+ emit overShootChanged();
}
/*!
@@ -1215,6 +1197,7 @@ void QmlGraphicsFlickable::setMaximumFlickVelocity(qreal v)
if (v == d->maxVelocity)
return;
d->maxVelocity = v;
+ emit maximumFlickVelocityChanged();
}
/*!
@@ -1232,7 +1215,10 @@ qreal QmlGraphicsFlickable::flickDeceleration() const
void QmlGraphicsFlickable::setFlickDeceleration(qreal deceleration)
{
Q_D(QmlGraphicsFlickable);
+ if (deceleration == d->deceleration)
+ return;
d->deceleration = deceleration;
+ emit flickDecelerationChanged();
}
/*!
@@ -1270,6 +1256,7 @@ void QmlGraphicsFlickable::setPressDelay(int delay)
if (d->pressDelay == delay)
return;
d->pressDelay = delay;
+ emit pressDelayChanged();
}
qreal QmlGraphicsFlickable::reportedVelocitySmoothing() const
diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable_p.h b/src/declarative/graphicsitems/qmlgraphicsflickable_p.h
index ea07da4..580d01e 100644
--- a/src/declarative/graphicsitems/qmlgraphicsflickable_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsflickable_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -65,15 +65,15 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsFlickable : public QmlGraphicsItem
Q_PROPERTY(qreal verticalVelocity READ verticalVelocity NOTIFY verticalVelocityChanged)
Q_PROPERTY(qreal reportedVelocitySmoothing READ reportedVelocitySmoothing WRITE setReportedVelocitySmoothing NOTIFY reportedVelocitySmoothingChanged)
- Q_PROPERTY(bool overShoot READ overShoot WRITE setOverShoot)
- Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity)
- Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration)
+ Q_PROPERTY(bool overShoot READ overShoot WRITE setOverShoot NOTIFY overShootChanged)
+ Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity NOTIFY maximumFlickVelocityChanged)
+ Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged)
Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged)
Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged)
Q_PROPERTY(FlickDirection flickDirection READ flickDirection WRITE setFlickDirection NOTIFY flickDirectionChanged)
Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged)
- Q_PROPERTY(int pressDelay READ pressDelay WRITE setPressDelay)
+ Q_PROPERTY(int pressDelay READ pressDelay WRITE setPressDelay NOTIFY pressDelayChanged)
Q_PROPERTY(bool atXEnd READ isAtXEnd NOTIFY isAtBoundaryChanged)
Q_PROPERTY(bool atYEnd READ isAtYEnd NOTIFY isAtBoundaryChanged)
@@ -82,8 +82,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsFlickable : public QmlGraphicsItem
Q_PROPERTY(QmlGraphicsFlickableVisibleArea *visibleArea READ visibleArea CONSTANT)
- Q_PROPERTY(QmlList<QObject *>* flickableData READ flickableData)
- Q_PROPERTY(QmlList<QmlGraphicsItem *>* flickableChildren READ flickableChildren)
+ Q_PROPERTY(QmlListProperty<QObject> flickableData READ flickableData)
+ Q_PROPERTY(QmlListProperty<QmlGraphicsItem> flickableChildren READ flickableChildren)
Q_CLASSINFO("DefaultProperty", "flickableData")
Q_ENUMS(FlickDirection)
@@ -92,8 +92,8 @@ public:
QmlGraphicsFlickable(QmlGraphicsItem *parent=0);
~QmlGraphicsFlickable();
- QmlList<QObject *> *flickableData();
- QmlList<QmlGraphicsItem *> *flickableChildren();
+ QmlListProperty<QObject> flickableData();
+ QmlListProperty<QmlGraphicsItem> flickableChildren();
bool overShoot() const;
void setOverShoot(bool);
@@ -160,6 +160,10 @@ Q_SIGNALS:
void pageChanged();
void flickDirectionChanged();
void interactiveChanged();
+ void overShootChanged();
+ void maximumFlickVelocityChanged();
+ void flickDecelerationChanged();
+ void pressDelayChanged();
protected:
virtual bool sceneEventFilter(QGraphicsItem *, QEvent *);
diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable_p_p.h b/src/declarative/graphicsitems/qmlgraphicsflickable_p_p.h
index e83e81b..e58cc0c 100644
--- a/src/declarative/graphicsitems/qmlgraphicsflickable_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsflickable_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -110,8 +110,6 @@ public:
qreal velocityX;
qreal velocityY;
QTime pressTime;
- QmlTimeLineEvent fixupXEvent;
- QmlTimeLineEvent fixupYEvent;
qreal deceleration;
qreal maxVelocity;
QTime velocityTime;
@@ -125,6 +123,9 @@ public:
int pressDelay;
int fixupDuration;
+ static void fixupY_callback(void *);
+ static void fixupX_callback(void *);
+
void updateVelocity();
struct Velocity : public QmlTimeLineValue
{
@@ -148,15 +149,7 @@ public:
void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *);
// flickableData property
- void data_removeAt(int);
- int data_count() const;
- void data_append(QObject *);
- void data_insert(int, QObject *);
- QObject *data_at(int) const;
- void data_clear();
-
- friend class QmlGraphicsFlickableVisibleArea;
- QML_DECLARE_LIST_PROXY(QmlGraphicsFlickablePrivate, QObject *, data)
+ static void data_append(QmlListProperty<QObject> *, QObject *);
};
class QmlGraphicsFlickableVisibleArea : public QObject
diff --git a/src/declarative/graphicsitems/qmlgraphicsflipable.cpp b/src/declarative/graphicsitems/qmlgraphicsflipable.cpp
index 4116817..5bab868 100644
--- a/src/declarative/graphicsitems/qmlgraphicsflipable.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsflipable.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -94,10 +94,10 @@ public:
}
transitions: Transition {
- NumberAnimation { matchProperties: "angle"; duration: 2000 }
+ NumberAnimation { properties: "angle"; duration: 2000 }
}
- MouseRegion {
+ MouseArea {
// change between default and 'back' states
onClicked: flipable.state = (flipable.state == 'back' ? '' : 'back')
anchors.fill: parent
@@ -149,7 +149,7 @@ void QmlGraphicsFlipable::setFront(QmlGraphicsItem *front)
return;
}
d->front = front;
- fxChildren()->append(d->front);
+ d->front->setParentItem(this);
if (Back == d->current)
d->front->setOpacity(0.);
}
@@ -168,7 +168,7 @@ void QmlGraphicsFlipable::setBack(QmlGraphicsItem *back)
return;
}
d->back = back;
- fxChildren()->append(d->back);
+ d->back->setParentItem(this);
if (Front == d->current)
d->back->setOpacity(0.);
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsflipable_p.h b/src/declarative/graphicsitems/qmlgraphicsflipable_p.h
index c189786..2b9e44e 100644
--- a/src/declarative/graphicsitems/qmlgraphicsflipable_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsflipable_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsfocuspanel.cpp b/src/declarative/graphicsitems/qmlgraphicsfocuspanel.cpp
index 4e1542a..d564e86 100644
--- a/src/declarative/graphicsitems/qmlgraphicsfocuspanel.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsfocuspanel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsfocuspanel_p.h b/src/declarative/graphicsitems/qmlgraphicsfocuspanel_p.h
index 4c5cc14..935b04e 100644
--- a/src/declarative/graphicsitems/qmlgraphicsfocuspanel_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsfocuspanel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsfocusscope.cpp b/src/declarative/graphicsitems/qmlgraphicsfocusscope.cpp
index ce0e376..9930396 100644
--- a/src/declarative/graphicsitems/qmlgraphicsfocusscope.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsfocusscope.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsfocusscope_p.h b/src/declarative/graphicsitems/qmlgraphicsfocusscope_p.h
index 0ea9da5..ca53b01 100644
--- a/src/declarative/graphicsitems/qmlgraphicsfocusscope_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsfocusscope_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer.cpp b/src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer.cpp
index f2b3c00..497d950 100644
--- a/src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer_p.h b/src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer_p.h
index 1091145..e263aa0 100644
--- a/src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
index ee711b4..bf370ae 100644
--- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1656,9 +1656,32 @@ void QmlGraphicsGridView::itemsMoved(int from, int to, int count)
++endIndex;
}
+ // update visibleIndex
+ for (it = d->visibleItems.begin(); it != d->visibleItems.end(); ++it) {
+ if ((*it)->index != -1) {
+ d->visibleIndex = (*it)->index;
+ break;
+ }
+ }
+
+ // Fix current index
+ if (d->currentIndex >= 0 && d->currentItem) {
+ int oldCurrent = d->currentIndex;
+ d->currentIndex = d->model->indexOf(d->currentItem->item, this);
+ if (oldCurrent != d->currentIndex) {
+ d->currentItem->index = d->currentIndex;
+ emit currentIndexChanged();
+ }
+ }
+
// Whatever moved items remain are no longer visible items.
- while (moved.count())
- d->releaseItem(moved.take(moved.begin().key()));
+ while (moved.count()) {
+ int idx = moved.begin().key();
+ FxGridItem *item = moved.take(idx);
+ if (item->item == d->currentItem->item)
+ item->setPosition(d->colPosAt(idx), d->rowPosAt(idx));
+ d->releaseItem(item);
+ }
d->layout(removedBeforeVisible);
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview_p.h b/src/declarative/graphicsitems/qmlgraphicsgridview_p.h
index 25a76a3..bd18daf 100644
--- a/src/declarative/graphicsitems/qmlgraphicsgridview_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsgridview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsimage.cpp b/src/declarative/graphicsitems/qmlgraphicsimage.cpp
index 558511d..c586452 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimage.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsimage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsimage_p.h b/src/declarative/graphicsitems/qmlgraphicsimage_p.h
index dde5d79..b8befeb 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimage_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsimage_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsimage_p_p.h b/src/declarative/graphicsitems/qmlgraphicsimage_p_p.h
index 3a5acca..e404935 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimage_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsimage_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp b/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp
index 08617ac..c09b661 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsimagebase_p.h b/src/declarative/graphicsitems/qmlgraphicsimagebase_p.h
index 61ea975..e8bda4c 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimagebase_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsimagebase_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsimagebase_p_p.h b/src/declarative/graphicsitems/qmlgraphicsimagebase_p_p.h
index 44b2332..d86785f 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimagebase_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsimagebase_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.cpp b/src/declarative/graphicsitems/qmlgraphicsitem.cpp
index e10c919..2e68264 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitem.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsitem.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1223,6 +1223,10 @@ QmlGraphicsKeysAttached *QmlGraphicsKeysAttached::qmlAttachedProperties(QObject
\internal
*/
+/*! \fn void QmlGraphicsItem::transformOriginChanged(TransformOrigin)
+ \internal
+*/
+
/*!
\fn void QmlGraphicsItem::childrenChanged()
\internal
@@ -1331,12 +1335,8 @@ void QmlGraphicsItem::setParentItem(QmlGraphicsItem *parent)
QmlGraphicsItem *oldParent = parentItem();
if (parent == oldParent || !parent) return;
- Q_D(QmlGraphicsItem);
QObject::setParent(parent);
- d->setParentItemHelper(parent, /*newParentVariant=*/0, /*thisPointerVariant=*/0);
- if (oldParent)
- emit oldParent->childrenChanged();
- emit parentChanged();
+ QGraphicsObject::setParentItem(parent);
}
/*!
@@ -1419,154 +1419,95 @@ QmlGraphicsAnchors *QmlGraphicsItem::anchors()
return d->anchors();
}
-void QmlGraphicsItemPrivate::data_removeAt(int)
-{
- // ###
-}
-
-int QmlGraphicsItemPrivate::data_count() const
-{
- // ###
- return 0;
-}
-
-void QmlGraphicsItemPrivate::data_append(QObject *o)
+void QmlGraphicsItemPrivate::data_append(QmlListProperty<QObject> *prop, QObject *o)
{
- Q_Q(QmlGraphicsItem);
QmlGraphicsItem *i = qobject_cast<QmlGraphicsItem *>(o);
- if (i)
- q->fxChildren()->append(i);
+ if (i)
+ i->setParentItem(static_cast<QmlGraphicsItem *>(prop->object));
else
- resources_append(o);
-}
-
-void QmlGraphicsItemPrivate::data_insert(int, QObject *)
-{
- // ###
-}
-
-QObject *QmlGraphicsItemPrivate::data_at(int) const
-{
- // ###
- return 0;
-}
-
-void QmlGraphicsItemPrivate::data_clear()
-{
- // ###
-}
-
-void QmlGraphicsItemPrivate::resources_removeAt(int)
-{
- // ###
-}
-
-int QmlGraphicsItemPrivate::resources_count() const
-{
- Q_Q(const QmlGraphicsItem);
- return q->children().count();
-}
-
-void QmlGraphicsItemPrivate::resources_append(QObject *o)
-{
- Q_Q(QmlGraphicsItem);
- o->setParent(q);
+ o->setParent(static_cast<QmlGraphicsItem *>(prop->object));
}
-void QmlGraphicsItemPrivate::resources_insert(int, QObject *)
+QObject *QmlGraphicsItemPrivate::resources_at(QmlListProperty<QObject> *prop, int index)
{
- // ###
-}
-
-QObject *QmlGraphicsItemPrivate::resources_at(int idx) const
-{
- Q_Q(const QmlGraphicsItem);
- QObjectList children = q->children();
- if (idx < children.count())
- return children.at(idx);
+ QObjectList children = prop->object->children();
+ if (index < children.count())
+ return children.at(index);
else
return 0;
}
-void QmlGraphicsItemPrivate::resources_clear()
-{
- // ###
-}
-
-void QmlGraphicsItemPrivate::children_removeAt(int)
-{
- // ###
-}
-
-int QmlGraphicsItemPrivate::children_count() const
+void QmlGraphicsItemPrivate::resources_append(QmlListProperty<QObject> *prop, QObject *o)
{
- Q_Q(const QmlGraphicsItem);
- return q->childItems().count();
+ o->setParent(prop->object);
}
-void QmlGraphicsItemPrivate::children_append(QmlGraphicsItem *i)
+int QmlGraphicsItemPrivate::resources_count(QmlListProperty<QObject> *prop)
{
- Q_Q(QmlGraphicsItem);
- i->setParentItem(q);
+ return prop->object->children().count();
}
-void QmlGraphicsItemPrivate::children_insert(int, QmlGraphicsItem *)
+QmlGraphicsItem *QmlGraphicsItemPrivate::children_at(QmlListProperty<QmlGraphicsItem> *prop, int index)
{
- // ###
-}
+ QList<QGraphicsItem *> children = static_cast<QmlGraphicsItem*>(prop->object)->childItems();
-QmlGraphicsItem *QmlGraphicsItemPrivate::children_at(int idx) const
-{
- Q_Q(const QmlGraphicsItem);
- QList<QGraphicsItem *> children = q->childItems();
- if (idx < children.count())
- return qobject_cast<QmlGraphicsItem *>(children.at(idx));
+ if (index < children.count())
+ return qobject_cast<QmlGraphicsItem *>(children.at(index));
else
return 0;
}
-void QmlGraphicsItemPrivate::children_clear()
+void QmlGraphicsItemPrivate::children_append(QmlListProperty<QmlGraphicsItem> *prop, QmlGraphicsItem *i)
{
- // ###
-}
-
-
-void QmlGraphicsItemPrivate::transform_removeAt(int i)
-{
- if (!transformData)
- return;
- transformData->graphicsTransforms.removeAt(i);
- dirtySceneTransform = 1;
+ if (i)
+ i->setParentItem(static_cast<QmlGraphicsItem*>(prop->object));
}
-int QmlGraphicsItemPrivate::transform_count() const
+int QmlGraphicsItemPrivate::children_count(QmlListProperty<QmlGraphicsItem> *prop)
{
- return transformData ? transformData->graphicsTransforms.size() : 0;
+ return static_cast<QmlGraphicsItem*>(prop->object)->childItems().count();
}
-void QmlGraphicsItemPrivate::transform_append(QGraphicsTransform *item)
+int QmlGraphicsItemPrivate::transform_count(QmlListProperty<QGraphicsTransform> *list)
{
- appendGraphicsTransform(item);
+ QGraphicsObject *object = qobject_cast<QGraphicsObject *>(list->object);
+ if (object) {
+ QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(object);
+ return d->transformData ? d->transformData->graphicsTransforms.size() : 0;
+ } else {
+ return 0;
+ }
}
-void QmlGraphicsItemPrivate::transform_insert(int, QGraphicsTransform *)
+void QmlGraphicsItemPrivate::transform_append(QmlListProperty<QGraphicsTransform> *list, QGraphicsTransform *item)
{
- // ###
+ QGraphicsObject *object = qobject_cast<QGraphicsObject *>(list->object);
+ if (object)
+ QGraphicsItemPrivate::get(object)->appendGraphicsTransform(item);
}
-QGraphicsTransform *QmlGraphicsItemPrivate::transform_at(int idx) const
+QGraphicsTransform *QmlGraphicsItemPrivate::transform_at(QmlListProperty<QGraphicsTransform> *list, int idx)
{
- if (!transformData)
+ QGraphicsObject *object = qobject_cast<QGraphicsObject *>(list->object);
+ if (object) {
+ QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(object);
+ if (!d->transformData)
+ return 0;
+ return d->transformData->graphicsTransforms.at(idx);
+ } else {
return 0;
- return transformData->graphicsTransforms.at(idx);
+ }
}
-void QmlGraphicsItemPrivate::transform_clear()
+void QmlGraphicsItemPrivate::transform_clear(QmlListProperty<QGraphicsTransform> *list)
{
- if (!transformData)
- return;
- Q_Q(QmlGraphicsItem);
- q->setTransformations(QList<QGraphicsTransform *>());
+ QGraphicsObject *object = qobject_cast<QGraphicsObject *>(list->object);
+ if (object) {
+ QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(object);
+ if (!d->transformData)
+ return;
+ object->setTransformations(QList<QGraphicsTransform *>());
+ }
}
/*!
@@ -1609,10 +1550,9 @@ void QmlGraphicsItemPrivate::transform_clear()
*/
/*! \internal */
-QmlList<QObject *> *QmlGraphicsItem::data()
+QmlListProperty<QObject> QmlGraphicsItem::data()
{
- Q_D(QmlGraphicsItem);
- return &d->data;
+ return QmlListProperty<QObject>(this, 0, QmlGraphicsItemPrivate::data_append);
}
/*!
@@ -1639,7 +1579,10 @@ bool QmlGraphicsItem::clip() const
void QmlGraphicsItem::setClip(bool c)
{
+ if (clip() == c)
+ return;
setFlag(ItemClipsChildrenToShape, c);
+ emit clipChanged();
}
/*!
@@ -2211,17 +2154,19 @@ void QmlGraphicsItem::focusChanged(bool flag)
}
/*! \internal */
-QmlList<QmlGraphicsItem *> *QmlGraphicsItem::fxChildren()
+QmlListProperty<QmlGraphicsItem> QmlGraphicsItem::fxChildren()
{
- Q_D(QmlGraphicsItem);
- return &(d->children);
+ return QmlListProperty<QmlGraphicsItem>(this, 0, QmlGraphicsItemPrivate::children_append,
+ QmlGraphicsItemPrivate::children_count,
+ QmlGraphicsItemPrivate::children_at);
}
/*! \internal */
-QmlList<QObject *> *QmlGraphicsItem::resources()
+QmlListProperty<QObject> QmlGraphicsItem::resources()
{
- Q_D(QmlGraphicsItem);
- return &(d->resources);
+ return QmlListProperty<QObject>(this, 0, QmlGraphicsItemPrivate::resources_append,
+ QmlGraphicsItemPrivate::resources_count,
+ QmlGraphicsItemPrivate::resources_at);
}
/*!
@@ -2246,7 +2191,7 @@ QmlList<QObject *> *QmlGraphicsItem::resources()
\internal
*/
/*! \internal */
-QmlList<QmlState *>* QmlGraphicsItem::states()
+QmlListProperty<QmlState> QmlGraphicsItem::states()
{
Q_D(QmlGraphicsItem);
return d->states()->statesProperty();
@@ -2275,7 +2220,7 @@ QmlList<QmlState *>* QmlGraphicsItem::states()
*/
/*! \internal */
-QmlList<QmlTransition *>* QmlGraphicsItem::transitions()
+QmlListProperty<QmlTransition> QmlGraphicsItem::transitions()
{
Q_D(QmlGraphicsItem);
return d->states()->transitionsProperty();
@@ -2383,10 +2328,11 @@ void QmlGraphicsItem::setState(const QString &state)
*/
/*! \internal */
-QmlList<QGraphicsTransform *>* QmlGraphicsItem::transform()
+QmlListProperty<QGraphicsTransform> QmlGraphicsItem::transform()
{
Q_D(QmlGraphicsItem);
- return &(d->transform);
+ return QmlListProperty<QGraphicsTransform>(this, 0, d->transform_append, d->transform_count,
+ d->transform_at, d->transform_clear);
}
/*!
@@ -2627,6 +2573,7 @@ void QmlGraphicsItem::setSmooth(bool smooth)
if (d->smooth == smooth)
return;
d->smooth = smooth;
+ emit smoothChanged();
update();
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.h b/src/declarative/graphicsitems/qmlgraphicsitem.h
index e0f33c7..891fc88 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitem.h
+++ b/src/declarative/graphicsitems/qmlgraphicsitem.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -70,11 +70,11 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsItem : public QGraphicsObject, public QmlP
Q_INTERFACES(QmlParserStatus)
Q_PROPERTY(QmlGraphicsItem * parent READ parentItem WRITE setParentItem NOTIFY parentChanged DESIGNABLE false FINAL)
- Q_PROPERTY(QmlList<QObject *> *data READ data DESIGNABLE false)
- Q_PROPERTY(QmlList<QmlGraphicsItem *>* children READ fxChildren DESIGNABLE false NOTIFY childrenChanged)
- Q_PROPERTY(QmlList<QObject *>* resources READ resources DESIGNABLE false)
- Q_PROPERTY(QmlList<QmlState *>* states READ states DESIGNABLE false)
- Q_PROPERTY(QmlList<QmlTransition *>* transitions READ transitions DESIGNABLE false)
+ Q_PROPERTY(QmlListProperty<QObject> data READ data DESIGNABLE false)
+ Q_PROPERTY(QmlListProperty<QmlGraphicsItem> children READ fxChildren DESIGNABLE false NOTIFY childrenChanged)
+ Q_PROPERTY(QmlListProperty<QObject> resources READ resources DESIGNABLE false)
+ Q_PROPERTY(QmlListProperty<QmlState> states READ states DESIGNABLE false)
+ Q_PROPERTY(QmlListProperty<QmlTransition> transitions READ transitions DESIGNABLE false)
Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged)
Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged RESET resetWidth FINAL)
Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged RESET resetHeight FINAL)
@@ -88,12 +88,12 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsItem : public QGraphicsObject, public QmlP
Q_PROPERTY(QmlGraphicsAnchorLine verticalCenter READ verticalCenter CONSTANT FINAL)
Q_PROPERTY(QmlGraphicsAnchorLine baseline READ baseline CONSTANT FINAL)
Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged)
- Q_PROPERTY(bool clip READ clip WRITE setClip) // ### move to QGI/QGO, NOTIFY
+ Q_PROPERTY(bool clip READ clip WRITE setClip NOTIFY clipChanged) // ### move to QGI/QGO, NOTIFY
Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged FINAL)
Q_PROPERTY(bool wantsFocus READ wantsFocus NOTIFY wantsFocusChanged)
- Q_PROPERTY(QmlList<QGraphicsTransform *>* transform READ transform DESIGNABLE false FINAL)
+ Q_PROPERTY(QmlListProperty<QGraphicsTransform> transform READ transform DESIGNABLE false FINAL)
Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin NOTIFY transformOriginChanged)
- Q_PROPERTY(bool smooth READ smooth WRITE setSmooth)
+ Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged)
Q_PROPERTY(QGraphicsEffect *effect READ graphicsEffect WRITE setGraphicsEffect)
Q_ENUMS(TransformOrigin)
Q_CLASSINFO("DefaultProperty", "data")
@@ -112,9 +112,9 @@ public:
void setParentItem(QmlGraphicsItem *parent);
void setParent(QmlGraphicsItem *parent) { setParentItem(parent); }
- QmlList<QObject *> *data();
- QmlList<QmlGraphicsItem *> *fxChildren();
- QmlList<QObject *> *resources();
+ QmlListProperty<QObject> data();
+ QmlListProperty<QmlGraphicsItem> fxChildren();
+ QmlListProperty<QObject> resources();
QmlGraphicsAnchors *anchors();
QRectF childrenRect();
@@ -122,8 +122,8 @@ public:
bool clip() const;
void setClip(bool);
- QmlList<QmlState *>* states();
- QmlList<QmlTransition *>* transitions();
+ QmlListProperty<QmlState> states();
+ QmlListProperty<QmlTransition> transitions();
QString state() const;
void setState(const QString &);
@@ -131,7 +131,7 @@ public:
qreal baselineOffset() const;
void setBaselineOffset(qreal);
- QmlList<QGraphicsTransform *> *transform();
+ QmlListProperty<QGraphicsTransform> transform();
qreal width() const;
void setWidth(qreal);
@@ -178,6 +178,8 @@ Q_SIGNALS:
void wantsFocusChanged();
void parentChanged();
void transformOriginChanged(TransformOrigin);
+ void smoothChanged();
+ void clipChanged();
protected:
bool isComponentComplete() const;
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem_p.h b/src/declarative/graphicsitems/qmlgraphicsitem_p.h
index 7ebbd85..4860b83 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitem_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsitem_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -137,40 +137,23 @@ public:
QString _id;
// data property
- void data_removeAt(int);
- int data_count() const;
- void data_append(QObject *);
- void data_insert(int, QObject *);
- QObject *data_at(int) const;
- void data_clear();
- QML_DECLARE_LIST_PROXY(QmlGraphicsItemPrivate, QObject *, data)
+ static void data_append(QmlListProperty<QObject> *, QObject *);
// resources property
- void resources_removeAt(int);
- int resources_count() const;
- void resources_append(QObject *);
- void resources_insert(int, QObject *);
- QObject *resources_at(int) const;
- void resources_clear();
- QML_DECLARE_LIST_PROXY(QmlGraphicsItemPrivate, QObject *, resources)
+ static QObject *resources_at(QmlListProperty<QObject> *, int);
+ static void resources_append(QmlListProperty<QObject> *, QObject *);
+ static int resources_count(QmlListProperty<QObject> *);
// children property
- void children_removeAt(int);
- int children_count() const;
- void children_append(QmlGraphicsItem *);
- void children_insert(int, QmlGraphicsItem *);
- QmlGraphicsItem *children_at(int) const;
- void children_clear();
- QML_DECLARE_LIST_PROXY(QmlGraphicsItemPrivate, QmlGraphicsItem *, children)
+ static QmlGraphicsItem *children_at(QmlListProperty<QmlGraphicsItem> *, int);
+ static void children_append(QmlListProperty<QmlGraphicsItem> *, QmlGraphicsItem *);
+ static int children_count(QmlListProperty<QmlGraphicsItem> *);
// transform property
- void transform_removeAt(int);
- int transform_count() const;
- void transform_append(QGraphicsTransform *);
- void transform_insert(int, QGraphicsTransform *);
- QGraphicsTransform *transform_at(int) const;
- void transform_clear();
- QML_DECLARE_LIST_PROXY(QmlGraphicsItemPrivate, QGraphicsTransform *, transform)
+ static int transform_count(QmlListProperty<QGraphicsTransform> *list);
+ static void transform_append(QmlListProperty<QGraphicsTransform> *list, QGraphicsTransform *);
+ static QGraphicsTransform *transform_at(QmlListProperty<QGraphicsTransform> *list, int);
+ static void transform_clear(QmlListProperty<QGraphicsTransform> *list);
QmlGraphicsAnchors *anchors() {
if (!_anchors) {
diff --git a/src/declarative/graphicsitems/qmlgraphicsitemchangelistener_p.h b/src/declarative/graphicsitems/qmlgraphicsitemchangelistener_p.h
index f430df0..a1c7b89 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitemchangelistener_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsitemchangelistener_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp b/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp
index 66d62f0..9263f49 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp
@@ -51,7 +51,7 @@
#include "qmlgraphicsanimatedimage_p.h"
#include "qmlgraphicsborderimage_p.h"
#include "qmlgraphicspositioners_p.h"
-#include "qmlgraphicsmouseregion_p.h"
+#include "qmlgraphicsmousearea_p.h"
#include "qmlgraphicsflickable_p.h"
#include "qmlgraphicsflickable_p_p.h"
#include "qmlgraphicsflipable_p.h"
@@ -64,7 +64,7 @@
#include "qmlgraphicslayoutitem_p.h"
#include "qmlgraphicslistview_p.h"
#include "qmlgraphicsloader_p.h"
-#include "qmlgraphicsmouseregion_p.h"
+#include "qmlgraphicsmousearea_p.h"
#include "qmlgraphicsparticles_p.h"
#include "qmlgraphicspath_p.h"
#include "qmlgraphicspathview_p.h"
@@ -112,7 +112,8 @@ void QmlGraphicsItemModule::defineModule()
QML_REGISTER_TYPE(Qt,4,6,LayoutItem,QmlGraphicsLayoutItem);
QML_REGISTER_TYPE(Qt,4,6,ListView,QmlGraphicsListView);
QML_REGISTER_TYPE(Qt,4,6,Loader,QmlGraphicsLoader);
- QML_REGISTER_TYPE(Qt,4,6,MouseRegion,QmlGraphicsMouseRegion);
+ QML_REGISTER_TYPE(Qt,4,6,MouseRegion,QmlGraphicsMouseArea);
+ QML_REGISTER_TYPE(Qt,4,6,MouseArea,QmlGraphicsMouseArea);
QML_REGISTER_TYPE(Qt,4,6,Opacity,QGraphicsOpacityEffect);
QML_REGISTER_TYPE(Qt,4,6,ParticleMotion,QmlGraphicsParticleMotion);
QML_REGISTER_TYPE(Qt,4,6,ParticleMotionGravity,QmlGraphicsParticleMotionGravity);
diff --git a/src/declarative/graphicsitems/qmlgraphicsitemsmodule_p.h b/src/declarative/graphicsitems/qmlgraphicsitemsmodule_p.h
index bf38c24..76fea7e 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitemsmodule_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsitemsmodule_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicslayoutitem.cpp b/src/declarative/graphicsitems/qmlgraphicslayoutitem.cpp
index 856a37f..961065e 100644
--- a/src/declarative/graphicsitems/qmlgraphicslayoutitem.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicslayoutitem.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicslayoutitem_p.h b/src/declarative/graphicsitems/qmlgraphicslayoutitem_p.h
index 3278b63..fbc891d 100644
--- a/src/declarative/graphicsitems/qmlgraphicslayoutitem_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicslayoutitem_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp
index db0afe1..108ac75 100644
--- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1069,9 +1069,13 @@ void QmlGraphicsListViewPrivate::fixupY()
fixupDuration = moveReason == Mouse ? fixupDuration : 0;
if (haveHighlightRange && highlightRange == QmlGraphicsListView::StrictlyEnforceRange) {
- if (currentItem && highlight && currentItem->position() != highlight->position()) {
+ if (currentItem && currentItem->position() - position() != highlightRangeStart) {
+ qreal pos = currentItem->position() - highlightRangeStart;
timeline.reset(_moveY);
- timeline.move(_moveY, -(currentItem->position() - highlightRangeStart), QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
+ if (fixupDuration)
+ timeline.move(_moveY, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
+ else
+ _moveY.setValue(-pos);
vTime = timeline.time();
}
} else if (snapMode != QmlGraphicsListView::NoSnap) {
@@ -1080,7 +1084,10 @@ void QmlGraphicsListViewPrivate::fixupY()
qreal dist = qAbs(_moveY + pos);
if (dist > 0) {
timeline.reset(_moveY);
- timeline.move(_moveY, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
+ if (fixupDuration)
+ timeline.move(_moveY, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
+ else
+ _moveY.setValue(-pos);
vTime = timeline.time();
}
}
@@ -1102,9 +1109,13 @@ void QmlGraphicsListViewPrivate::fixupX()
fixupDuration = moveReason == Mouse ? fixupDuration : 0;
if (haveHighlightRange && highlightRange == QmlGraphicsListView::StrictlyEnforceRange) {
- if (currentItem && highlight && currentItem->position() != highlight->position()) {
+ if (currentItem && currentItem->position() - position() != highlightRangeStart) {
+ qreal pos = currentItem->position() - highlightRangeStart;
timeline.reset(_moveX);
- timeline.move(_moveX, -(currentItem->position() - highlightRangeStart), QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
+ if (fixupDuration)
+ timeline.move(_moveX, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
+ else
+ _moveX.setValue(-pos);
vTime = timeline.time();
}
} else if (snapMode != QmlGraphicsListView::NoSnap) {
@@ -1113,7 +1124,10 @@ void QmlGraphicsListViewPrivate::fixupX()
qreal dist = qAbs(_moveX + pos);
if (dist > 0) {
timeline.reset(_moveX);
- timeline.move(_moveX, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
+ if (fixupDuration)
+ timeline.move(_moveX, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
+ else
+ _moveX.setValue(-pos);
vTime = timeline.time();
}
}
@@ -1186,7 +1200,7 @@ void QmlGraphicsListViewPrivate::flickX(qreal velocity)
}
timeline.reset(_moveX);
timeline.accel(_moveX, v, accel, maxDistance + overshootDist);
- timeline.execute(fixupXEvent);
+ timeline.callback(QmlTimeLineCallback(&_moveX, fixupX_callback, this));
flicked = true;
emit q->flickingChanged();
emit q->flickStarted();
@@ -1212,7 +1226,7 @@ void QmlGraphicsListViewPrivate::flickX(qreal velocity)
}
timeline.reset(_moveX);
timeline.accelDistance(_moveX, v, -dist + (v < 0 ? -overshootDist : overshootDist));
- timeline.execute(fixupXEvent);
+ timeline.callback(QmlTimeLineCallback(&_moveX, fixupX_callback, this));
}
} else {
correctFlick = false;
@@ -1284,7 +1298,7 @@ void QmlGraphicsListViewPrivate::flickY(qreal velocity)
}
timeline.reset(_moveY);
timeline.accel(_moveY, v, accel, maxDistance + overshootDist);
- timeline.execute(fixupYEvent);
+ timeline.callback(QmlTimeLineCallback(&_moveY, fixupY_callback, this));
flicked = true;
emit q->flickingChanged();
emit q->flickStarted();
@@ -1310,7 +1324,7 @@ void QmlGraphicsListViewPrivate::flickY(qreal velocity)
}
timeline.reset(_moveY);
timeline.accelDistance(_moveY, v, -dist + (v < 0 ? -overshootDist : overshootDist));
- timeline.execute(fixupYEvent);
+ timeline.callback(QmlTimeLineCallback(&_moveY, fixupY_callback, this));
}
} else {
correctFlick = false;
@@ -2261,6 +2275,7 @@ void QmlGraphicsListView::positionViewAtIndex(int index)
for (int i = 0; i < oldVisible.count(); ++i)
d->releaseItem(oldVisible.at(i));
}
+ d->fixupPosition();
}
@@ -2633,9 +2648,32 @@ void QmlGraphicsListView::itemsMoved(int from, int to, int count)
++endIndex;
}
+ // update visibleIndex
+ for (it = d->visibleItems.begin(); it != d->visibleItems.end(); ++it) {
+ if ((*it)->index != -1) {
+ d->visibleIndex = (*it)->index;
+ break;
+ }
+ }
+
+ // Fix current index
+ if (d->currentIndex >= 0 && d->currentItem) {
+ int oldCurrent = d->currentIndex;
+ d->currentIndex = d->model->indexOf(d->currentItem->item, this);
+ if (oldCurrent != d->currentIndex) {
+ d->currentItem->index = d->currentIndex;
+ emit currentIndexChanged();
+ }
+ }
+
// Whatever moved items remain are no longer visible items.
- while (moved.count())
- d->releaseItem(moved.take(moved.begin().key()));
+ while (moved.count()) {
+ int idx = moved.begin().key();
+ FxListItem *item = moved.take(idx);
+ if (item->item == d->currentItem->item)
+ item->setPosition(d->positionAt(idx));
+ d->releaseItem(item);
+ }
// Ensure we don't cause an ugly list scroll.
d->visibleItems.first()->setPosition(d->visibleItems.first()->position() + moveBy);
diff --git a/src/declarative/graphicsitems/qmlgraphicslistview_p.h b/src/declarative/graphicsitems/qmlgraphicslistview_p.h
index 42ace15..c5b4aab 100644
--- a/src/declarative/graphicsitems/qmlgraphicslistview_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicslistview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsloader.cpp b/src/declarative/graphicsitems/qmlgraphicsloader.cpp
index d778c83..e4c7411 100644
--- a/src/declarative/graphicsitems/qmlgraphicsloader.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsloader.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -124,7 +124,7 @@ void QmlGraphicsLoaderPrivate::initResize()
\code
Loader { id: pageLoader }
Rectangle {
- MouseRegion { anchors.fill: parent; onClicked: pageLoader.source = "Page1.qml" }
+ MouseArea { anchors.fill: parent; onClicked: pageLoader.source = "Page1.qml" }
}
\endcode
@@ -398,6 +398,7 @@ void QmlGraphicsLoader::setResizeMode(ResizeMode mode)
}
d->resizeMode = mode;
+ emit resizeModeChanged();
d->initResize();
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsloader_p.h b/src/declarative/graphicsitems/qmlgraphicsloader_p.h
index 87b6a52..0ab67ac 100644
--- a/src/declarative/graphicsitems/qmlgraphicsloader_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsloader_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -59,7 +59,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsLoader : public QmlGraphicsItem
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
Q_PROPERTY(QmlComponent *sourceComponent READ sourceComponent WRITE setSourceComponent NOTIFY sourceChanged)
- Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode)
+ Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode NOTIFY resizeModeChanged)
Q_PROPERTY(QGraphicsObject *item READ item NOTIFY itemChanged)
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
@@ -89,6 +89,8 @@ Q_SIGNALS:
void sourceChanged();
void statusChanged();
void progressChanged();
+ void resizeModeChanged();
+
protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
diff --git a/src/declarative/graphicsitems/qmlgraphicsloader_p_p.h b/src/declarative/graphicsitems/qmlgraphicsloader_p_p.h
index 7f10eff..61dab58 100644
--- a/src/declarative/graphicsitems/qmlgraphicsloader_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsloader_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsmouseregion.cpp b/src/declarative/graphicsitems/qmlgraphicsmousearea.cpp
index fe72e84..cc07989 100644
--- a/src/declarative/graphicsitems/qmlgraphicsmouseregion.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsmousearea.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#include "qmlgraphicsmouseregion_p.h"
-#include "qmlgraphicsmouseregion_p_p.h"
+#include "qmlgraphicsmousearea_p.h"
+#include "qmlgraphicsmousearea_p_p.h"
#include "qmlgraphicsevents_p_p.h"
@@ -65,7 +65,10 @@ QmlGraphicsItem *QmlGraphicsDrag::target() const
void QmlGraphicsDrag::setTarget(QmlGraphicsItem *t)
{
+ if (_target == t)
+ return;
_target = t;
+ emit targetChanged();
}
QmlGraphicsDrag::Axis QmlGraphicsDrag::axis() const
@@ -75,7 +78,10 @@ QmlGraphicsDrag::Axis QmlGraphicsDrag::axis() const
void QmlGraphicsDrag::setAxis(QmlGraphicsDrag::Axis a)
{
+ if (_axis == a)
+ return;
_axis = a;
+ emit axisChanged();
}
qreal QmlGraphicsDrag::xmin() const
@@ -85,7 +91,10 @@ qreal QmlGraphicsDrag::xmin() const
void QmlGraphicsDrag::setXmin(qreal m)
{
+ if (_xmin == m)
+ return;
_xmin = m;
+ emit minimumXChanged();
}
qreal QmlGraphicsDrag::xmax() const
@@ -95,7 +104,10 @@ qreal QmlGraphicsDrag::xmax() const
void QmlGraphicsDrag::setXmax(qreal m)
{
+ if (_xmax == m)
+ return;
_xmax = m;
+ emit maximumXChanged();
}
qreal QmlGraphicsDrag::ymin() const
@@ -105,7 +117,10 @@ qreal QmlGraphicsDrag::ymin() const
void QmlGraphicsDrag::setYmin(qreal m)
{
+ if (_ymin == m)
+ return;
_ymin = m;
+ emit minimumYChanged();
}
qreal QmlGraphicsDrag::ymax() const
@@ -115,27 +130,30 @@ qreal QmlGraphicsDrag::ymax() const
void QmlGraphicsDrag::setYmax(qreal m)
{
+ if (_ymax == m)
+ return;
_ymax = m;
+ emit maximumYChanged();
}
-QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate()
+QmlGraphicsMouseAreaPrivate::~QmlGraphicsMouseAreaPrivate()
{
delete drag;
}
/*!
- \qmlclass MouseRegion QmlGraphicsMouseRegion
- \brief The MouseRegion item enables simple mouse handling.
+ \qmlclass MouseArea QmlGraphicsMouseArea
+ \brief The MouseArea item enables simple mouse handling.
\inherits Item
- A MouseRegion is typically used in conjunction with a visible item,
- where the MouseRegion effectively 'proxies' mouse handling for that
- item. For example, we can put a MouseRegion in a Rectangle that changes
+ A MouseArea is typically used in conjunction with a visible item,
+ where the MouseArea effectively 'proxies' mouse handling for that
+ item. For example, we can put a MouseArea in a Rectangle that changes
the Rectangle color to red when clicked:
\snippet doc/src/snippets/declarative/mouseregion.qml 0
- Many MouseRegion signals pass a \l {MouseEvent}{mouse} parameter that contains
+ Many MouseArea signals pass a \l {MouseEvent}{mouse} parameter that contains
additional information about the mouse event, such as the position, button,
and any key modifiers.
@@ -145,25 +163,37 @@ QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate()
For basic key handling, see the \l {Keys}{Keys attached property}.
- MouseRegion is an invisible item: it is never painted.
+ MouseArea is an invisible item: it is never painted.
\sa MouseEvent
*/
/*!
- \qmlsignal MouseRegion::onEntered()
+ \qmlsignal MouseArea::onEntered()
This handler is called when the mouse enters the mouse region.
+
+ By default the onEntered handler is only called while a button is
+ pressed. Setting hoverEnabled to true enables handling of
+ onExited when no mouse button is pressed.
+
+ \sa hoverEnabled
*/
/*!
- \qmlsignal MouseRegion::onExited()
+ \qmlsignal MouseArea::onExited()
This handler is called when the mouse exists the mouse region.
+
+ By default the onExited handler is only called while a button is
+ pressed. Setting hoverEnabled to true enables handling of
+ onExited when no mouse button is pressed.
+
+ \sa hoverEnabled
*/
/*!
- \qmlsignal MouseRegion::onPositionChanged(MouseEvent mouse)
+ \qmlsignal MouseArea::onPositionChanged(MouseEvent mouse)
This handler is called when the mouse position changes.
@@ -171,13 +201,17 @@ QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate()
position, and any buttons currently pressed.
The \e accepted property of the MouseEvent parameter is ignored in this handler.
+
+ By default the onPositionChanged handler is only called while a button is
+ pressed. Setting hoverEnabled to true enables handling of
+ onPositionChanged when no mouse button is pressed.
*/
/*!
- \qmlsignal MouseRegion::onClicked(mouse)
+ \qmlsignal MouseArea::onClicked(mouse)
This handler is called when there is a click. A click is defined as a press followed by a release,
- both inside the MouseRegion (pressing, moving outside the MouseRegion, and then moving back inside and
+ both inside the MouseArea (pressing, moving outside the MouseArea, and then moving back inside and
releasing is also considered a click).
The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y
@@ -187,21 +221,21 @@ QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate()
*/
/*!
- \qmlsignal MouseRegion::onPressed(mouse)
+ \qmlsignal MouseArea::onPressed(mouse)
This handler is called when there is a press.
The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y
position and which button was pressed.
- The \e accepted property of the MouseEvent parameter determines whether this MouseRegion
+ The \e accepted property of the MouseEvent parameter determines whether this MouseArea
will handle the press and all future mouse events until release. The default is to accept
- the event and not allow other MouseRegions beneath this one to handle the event. If \e accepted
- is set to false, no further events will be sent to this MouseRegion until the button is next
+ the event and not allow other MouseArea beneath this one to handle the event. If \e accepted
+ is set to false, no further events will be sent to this MouseArea until the button is next
pressed.
*/
/*!
- \qmlsignal MouseRegion::onReleased(mouse)
+ \qmlsignal MouseArea::onReleased(mouse)
This handler is called when there is a release.
The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y
@@ -211,7 +245,7 @@ QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate()
*/
/*!
- \qmlsignal MouseRegion::onPressAndHold(mouse)
+ \qmlsignal MouseArea::onPressAndHold(mouse)
This handler is called when there is a long press (currently 800ms).
The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y
@@ -221,7 +255,7 @@ QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate()
*/
/*!
- \qmlsignal MouseRegion::onDoubleClicked(mouse)
+ \qmlsignal MouseArea::onDoubleClicked(mouse)
This handler is called when there is a double-click (a press followed by a release followed by a press).
The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y
@@ -232,30 +266,30 @@ QmlGraphicsMouseRegionPrivate::~QmlGraphicsMouseRegionPrivate()
/*!
\internal
- \class QmlGraphicsMouseRegion
- \brief The QmlGraphicsMouseRegion class provides a simple mouse handling abstraction for use within Qml.
+ \class QmlGraphicsMouseArea
+ \brief The QmlGraphicsMouseArea class provides a simple mouse handling abstraction for use within Qml.
\ingroup group_coreitems
- All QmlGraphicsItem derived classes can do mouse handling but the QmlGraphicsMouseRegion class exposes mouse
+ All QmlGraphicsItem derived classes can do mouse handling but the QmlGraphicsMouseArea class exposes mouse
handling data as properties and tracks flicking and dragging of the mouse.
- A QmlGraphicsMouseRegion object can be instantiated in Qml using the tag \l MouseRegion.
+ A QmlGraphicsMouseArea object can be instantiated in Qml using the tag \l MouseArea.
*/
-QmlGraphicsMouseRegion::QmlGraphicsMouseRegion(QmlGraphicsItem *parent)
- : QmlGraphicsItem(*(new QmlGraphicsMouseRegionPrivate), parent)
+QmlGraphicsMouseArea::QmlGraphicsMouseArea(QmlGraphicsItem *parent)
+ : QmlGraphicsItem(*(new QmlGraphicsMouseAreaPrivate), parent)
{
- Q_D(QmlGraphicsMouseRegion);
+ Q_D(QmlGraphicsMouseArea);
d->init();
}
-QmlGraphicsMouseRegion::~QmlGraphicsMouseRegion()
+QmlGraphicsMouseArea::~QmlGraphicsMouseArea()
{
}
/*!
- \qmlproperty real MouseRegion::mouseX
- \qmlproperty real MouseRegion::mouseY
+ \qmlproperty real MouseArea::mouseX
+ \qmlproperty real MouseArea::mouseY
These properties hold the coordinates of the mouse.
If the hoverEnabled property is false then these properties will only be valid
@@ -264,44 +298,44 @@ QmlGraphicsMouseRegion::~QmlGraphicsMouseRegion()
If hoverEnabled is true then these properties will be valid:
\list
- \i when no button is pressed, but the mouse is within the MouseRegion (containsMouse is true).
+ \i when no button is pressed, but the mouse is within the MouseArea (containsMouse is true).
\i if a button is pressed and held, even if it has since moved out of the region.
\endlist
- The coordinates are relative to the MouseRegion.
+ The coordinates are relative to the MouseArea.
*/
-qreal QmlGraphicsMouseRegion::mouseX() const
+qreal QmlGraphicsMouseArea::mouseX() const
{
- Q_D(const QmlGraphicsMouseRegion);
+ Q_D(const QmlGraphicsMouseArea);
return d->lastPos.x();
}
-qreal QmlGraphicsMouseRegion::mouseY() const
+qreal QmlGraphicsMouseArea::mouseY() const
{
- Q_D(const QmlGraphicsMouseRegion);
+ Q_D(const QmlGraphicsMouseArea);
return d->lastPos.y();
}
/*!
- \qmlproperty bool MouseRegion::enabled
+ \qmlproperty bool MouseArea::enabled
This property holds whether the item accepts mouse events.
*/
-bool QmlGraphicsMouseRegion::isEnabled() const
+bool QmlGraphicsMouseArea::isEnabled() const
{
- Q_D(const QmlGraphicsMouseRegion);
+ Q_D(const QmlGraphicsMouseArea);
return d->absorb;
}
-void QmlGraphicsMouseRegion::setEnabled(bool a)
+void QmlGraphicsMouseArea::setEnabled(bool a)
{
- Q_D(QmlGraphicsMouseRegion);
+ Q_D(QmlGraphicsMouseArea);
if (a != d->absorb) {
d->absorb = a;
emit enabledChanged();
}
}
/*!
- \qmlproperty MouseButtons MouseRegion::pressedButtons
+ \qmlproperty MouseButtons MouseArea::pressedButtons
This property holds the mouse buttons currently pressed.
It contains a bitwise combination of:
@@ -317,7 +351,7 @@ void QmlGraphicsMouseRegion::setEnabled(bool a)
text: mr.pressedButtons & Qt.RightButton ? "right" : ""
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
- MouseRegion {
+ MouseArea {
id: mr
acceptedButtons: Qt.LeftButton | Qt.RightButton
anchors.fill: parent
@@ -327,15 +361,15 @@ void QmlGraphicsMouseRegion::setEnabled(bool a)
\sa acceptedButtons
*/
-Qt::MouseButtons QmlGraphicsMouseRegion::pressedButtons() const
+Qt::MouseButtons QmlGraphicsMouseArea::pressedButtons() const
{
- Q_D(const QmlGraphicsMouseRegion);
+ Q_D(const QmlGraphicsMouseArea);
return d->lastButtons;
}
-void QmlGraphicsMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event)
+void QmlGraphicsMouseArea::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsMouseRegion);
+ Q_D(QmlGraphicsMouseArea);
d->moved = false;
if (!d->absorb)
QmlGraphicsItem::mousePressEvent(event);
@@ -358,9 +392,9 @@ void QmlGraphicsMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event)
}
}
-void QmlGraphicsMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+void QmlGraphicsMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsMouseRegion);
+ Q_D(QmlGraphicsMouseArea);
if (!d->absorb) {
QmlGraphicsItem::mouseMoveEvent(event);
return;
@@ -428,9 +462,9 @@ void QmlGraphicsMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
-void QmlGraphicsMouseRegion::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+void QmlGraphicsMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsMouseRegion);
+ Q_D(QmlGraphicsMouseArea);
if (!d->absorb) {
QmlGraphicsItem::mouseReleaseEvent(event);
} else {
@@ -443,9 +477,9 @@ void QmlGraphicsMouseRegion::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
}
}
-void QmlGraphicsMouseRegion::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
+void QmlGraphicsMouseArea::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsMouseRegion);
+ Q_D(QmlGraphicsMouseArea);
if (!d->absorb) {
QmlGraphicsItem::mouseDoubleClickEvent(event);
} else {
@@ -459,18 +493,18 @@ void QmlGraphicsMouseRegion::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *eve
}
}
-void QmlGraphicsMouseRegion::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
+void QmlGraphicsMouseArea::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
- Q_D(QmlGraphicsMouseRegion);
+ Q_D(QmlGraphicsMouseArea);
if (!d->absorb)
QmlGraphicsItem::hoverEnterEvent(event);
else
setHovered(true);
}
-void QmlGraphicsMouseRegion::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
+void QmlGraphicsMouseArea::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
- Q_D(QmlGraphicsMouseRegion);
+ Q_D(QmlGraphicsMouseArea);
if (!d->absorb) {
QmlGraphicsItem::hoverEnterEvent(event);
} else {
@@ -480,20 +514,20 @@ void QmlGraphicsMouseRegion::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
}
}
-void QmlGraphicsMouseRegion::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+void QmlGraphicsMouseArea::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
- Q_D(QmlGraphicsMouseRegion);
+ Q_D(QmlGraphicsMouseArea);
if (!d->absorb)
QmlGraphicsItem::hoverLeaveEvent(event);
else
setHovered(false);
}
-bool QmlGraphicsMouseRegion::sceneEvent(QEvent *event)
+bool QmlGraphicsMouseArea::sceneEvent(QEvent *event)
{
bool rv = QmlGraphicsItem::sceneEvent(event);
if (event->type() == QEvent::UngrabMouse) {
- Q_D(QmlGraphicsMouseRegion);
+ Q_D(QmlGraphicsMouseArea);
if (d->pressed) {
// if our mouse grab has been removed (probably by Flickable), fix our
// state
@@ -506,9 +540,9 @@ bool QmlGraphicsMouseRegion::sceneEvent(QEvent *event)
return rv;
}
-void QmlGraphicsMouseRegion::timerEvent(QTimerEvent *event)
+void QmlGraphicsMouseArea::timerEvent(QTimerEvent *event)
{
- Q_D(QmlGraphicsMouseRegion);
+ Q_D(QmlGraphicsMouseArea);
if (event->timerId() == d->pressAndHoldTimer.timerId()) {
d->pressAndHoldTimer.stop();
if (d->pressed && d->dragged == false && d->hovered == true) {
@@ -520,7 +554,7 @@ void QmlGraphicsMouseRegion::timerEvent(QTimerEvent *event)
}
/*!
- \qmlproperty bool MouseRegion::hoverEnabled
+ \qmlproperty bool MouseArea::hoverEnabled
This property holds whether hover events are handled.
By default, mouse events are only handled in response to a button event, or when a button is
@@ -531,31 +565,31 @@ void QmlGraphicsMouseRegion::timerEvent(QTimerEvent *event)
*/
/*!
- \qmlproperty bool MouseRegion::containsMouse
+ \qmlproperty bool MouseArea::containsMouse
This property holds whether the mouse is currently inside the mouse region.
\warning This property is not updated if the region moves under the mouse: \e containsMouse will not change.
In addition, if hoverEnabled is false, containsMouse will only be valid when the mouse is pressed.
*/
-bool QmlGraphicsMouseRegion::hovered() const
+bool QmlGraphicsMouseArea::hovered() const
{
- Q_D(const QmlGraphicsMouseRegion);
+ Q_D(const QmlGraphicsMouseArea);
return d->hovered;
}
/*!
- \qmlproperty bool MouseRegion::pressed
+ \qmlproperty bool MouseArea::pressed
This property holds whether the mouse region is currently pressed.
*/
-bool QmlGraphicsMouseRegion::pressed() const
+bool QmlGraphicsMouseArea::pressed() const
{
- Q_D(const QmlGraphicsMouseRegion);
+ Q_D(const QmlGraphicsMouseArea);
return d->pressed;
}
-void QmlGraphicsMouseRegion::setHovered(bool h)
+void QmlGraphicsMouseArea::setHovered(bool h)
{
- Q_D(QmlGraphicsMouseRegion);
+ Q_D(QmlGraphicsMouseArea);
if (d->hovered != h) {
d->hovered = h;
emit hoveredChanged();
@@ -564,7 +598,7 @@ void QmlGraphicsMouseRegion::setHovered(bool h)
}
/*!
- \qmlproperty Qt::MouseButtons MouseRegion::acceptedButtons
+ \qmlproperty Qt::MouseButtons MouseArea::acceptedButtons
This property holds the mouse buttons that the mouse region reacts to.
The available buttons are:
@@ -578,17 +612,17 @@ void QmlGraphicsMouseRegion::setHovered(bool h)
"|" (or) operator:
\code
- MouseRegion { acceptedButtons: Qt.LeftButton | Qt.RightButton }
+ MouseArea { acceptedButtons: Qt.LeftButton | Qt.RightButton }
\endcode
The default is to accept the Left button.
*/
-Qt::MouseButtons QmlGraphicsMouseRegion::acceptedButtons() const
+Qt::MouseButtons QmlGraphicsMouseArea::acceptedButtons() const
{
return acceptedMouseButtons();
}
-void QmlGraphicsMouseRegion::setAcceptedButtons(Qt::MouseButtons buttons)
+void QmlGraphicsMouseArea::setAcceptedButtons(Qt::MouseButtons buttons)
{
if (buttons != acceptedMouseButtons()) {
setAcceptedMouseButtons(buttons);
@@ -596,9 +630,9 @@ void QmlGraphicsMouseRegion::setAcceptedButtons(Qt::MouseButtons buttons)
}
}
-bool QmlGraphicsMouseRegion::setPressed(bool p)
+bool QmlGraphicsMouseArea::setPressed(bool p)
{
- Q_D(QmlGraphicsMouseRegion);
+ Q_D(QmlGraphicsMouseArea);
bool isclick = d->pressed == true && p == false && d->dragged == false && d->hovered == true;
if (d->pressed != p) {
@@ -619,21 +653,21 @@ bool QmlGraphicsMouseRegion::setPressed(bool p)
return false;
}
-QmlGraphicsDrag *QmlGraphicsMouseRegion::drag()
+QmlGraphicsDrag *QmlGraphicsMouseArea::drag()
{
- Q_D(QmlGraphicsMouseRegion);
+ Q_D(QmlGraphicsMouseArea);
if (!d->drag)
d->drag = new QmlGraphicsDrag;
return d->drag;
}
/*!
- \qmlproperty Item MouseRegion::drag.target
- \qmlproperty Axis MouseRegion::drag.axis
- \qmlproperty real MouseRegion::drag.minimumX
- \qmlproperty real MouseRegion::drag.maximumX
- \qmlproperty real MouseRegion::drag.minimumY
- \qmlproperty real MouseRegion::drag.maximumY
+ \qmlproperty Item MouseArea::drag.target
+ \qmlproperty Axis MouseArea::drag.axis
+ \qmlproperty real MouseArea::drag.minimumX
+ \qmlproperty real MouseArea::drag.maximumX
+ \qmlproperty real MouseArea::drag.minimumY
+ \qmlproperty real MouseArea::drag.maximumY
drag provides a convenient way to make an item draggable.
diff --git a/src/declarative/graphicsitems/qmlgraphicsmouseregion_p.h b/src/declarative/graphicsitems/qmlgraphicsmousearea_p.h
index 0ddad1b..2e2f8c9 100644
--- a/src/declarative/graphicsitems/qmlgraphicsmouseregion_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsmousearea_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSMOUSEREGION_H
-#define QMLGRAPHICSMOUSEREGION_H
+#ifndef QMLGRAPHICSMOUSEAREA_H
+#define QMLGRAPHICSMOUSEAREA_H
#include "qmlgraphicsitem.h"
@@ -55,12 +55,12 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsDrag : public QObject
Q_OBJECT
Q_ENUMS(Axis)
- Q_PROPERTY(QmlGraphicsItem *target READ target WRITE setTarget)
- Q_PROPERTY(Axis axis READ axis WRITE setAxis)
- Q_PROPERTY(qreal minimumX READ xmin WRITE setXmin)
- Q_PROPERTY(qreal maximumX READ xmax WRITE setXmax)
- Q_PROPERTY(qreal minimumY READ ymin WRITE setYmin)
- Q_PROPERTY(qreal maximumY READ ymax WRITE setYmax)
+ Q_PROPERTY(QmlGraphicsItem *target READ target WRITE setTarget NOTIFY targetChanged)
+ Q_PROPERTY(Axis axis READ axis WRITE setAxis NOTIFY axisChanged)
+ Q_PROPERTY(qreal minimumX READ xmin WRITE setXmin NOTIFY minimumXChanged)
+ Q_PROPERTY(qreal maximumX READ xmax WRITE setXmax NOTIFY maximumXChanged)
+ Q_PROPERTY(qreal minimumY READ ymin WRITE setYmin NOTIFY minimumYChanged)
+ Q_PROPERTY(qreal maximumY READ ymax WRITE setYmax NOTIFY maximumYChanged)
//### consider drag and drop
public:
@@ -83,6 +83,14 @@ public:
qreal ymax() const;
void setYmax(qreal);
+Q_SIGNALS:
+ void targetChanged();
+ void axisChanged();
+ void minimumXChanged();
+ void maximumXChanged();
+ void minimumYChanged();
+ void maximumYChanged();
+
private:
QmlGraphicsItem *_target;
Axis _axis;
@@ -94,8 +102,8 @@ private:
};
class QmlGraphicsMouseEvent;
-class QmlGraphicsMouseRegionPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsMouseRegion : public QmlGraphicsItem
+class QmlGraphicsMouseAreaPrivate;
+class Q_DECLARATIVE_EXPORT QmlGraphicsMouseArea : public QmlGraphicsItem
{
Q_OBJECT
@@ -107,11 +115,11 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsMouseRegion : public QmlGraphicsItem
Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons NOTIFY pressedChanged)
Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged)
Q_PROPERTY(bool hoverEnabled READ acceptHoverEvents WRITE setAcceptHoverEvents)
- Q_PROPERTY(QmlGraphicsDrag *drag READ drag) //### add flicking to QmlGraphicsDrag or add a QmlGraphicsFlick ???
+ Q_PROPERTY(QmlGraphicsDrag *drag READ drag CONSTANT) //### add flicking to QmlGraphicsDrag or add a QmlGraphicsFlick ???
public:
- QmlGraphicsMouseRegion(QmlGraphicsItem *parent=0);
- ~QmlGraphicsMouseRegion();
+ QmlGraphicsMouseArea(QmlGraphicsItem *parent=0);
+ ~QmlGraphicsMouseArea();
qreal mouseX() const;
qreal mouseY() const;
@@ -163,15 +171,15 @@ private:
void handleRelease();
private:
- Q_DISABLE_COPY(QmlGraphicsMouseRegion)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsMouseRegion)
+ Q_DISABLE_COPY(QmlGraphicsMouseArea)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsMouseArea)
};
QT_END_NAMESPACE
QML_DECLARE_TYPE(QmlGraphicsDrag)
-QML_DECLARE_TYPE(QmlGraphicsMouseRegion)
+QML_DECLARE_TYPE(QmlGraphicsMouseArea)
QT_END_HEADER
-#endif // QMLGRAPHICSMOUSEREGION_H
+#endif // QMLGRAPHICSMOUSEAREA_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsmouseregion_p_p.h b/src/declarative/graphicsitems/qmlgraphicsmousearea_p_p.h
index 0f1b0d4..fadb430 100644
--- a/src/declarative/graphicsitems/qmlgraphicsmouseregion_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsmousearea_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -61,21 +61,21 @@
QT_BEGIN_NAMESPACE
-class QmlGraphicsMouseRegionPrivate : public QmlGraphicsItemPrivate
+class QmlGraphicsMouseAreaPrivate : public QmlGraphicsItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsMouseRegion)
+ Q_DECLARE_PUBLIC(QmlGraphicsMouseArea)
public:
- QmlGraphicsMouseRegionPrivate()
+ QmlGraphicsMouseAreaPrivate()
: absorb(true), hovered(false), pressed(false), longPress(false), drag(0)
{
}
- ~QmlGraphicsMouseRegionPrivate();
+ ~QmlGraphicsMouseAreaPrivate();
void init()
{
- Q_Q(QmlGraphicsMouseRegion);
+ Q_Q(QmlGraphicsMouseArea);
q->setAcceptedMouseButtons(Qt::LeftButton);
}
@@ -87,7 +87,7 @@ public:
}
bool isConnected(const char *signal) {
- Q_Q(QmlGraphicsMouseRegion);
+ Q_Q(QmlGraphicsMouseArea);
int idx = QObjectPrivate::get(q)->signalIndex(signal);
return QObjectPrivate::get(q)->isSignalConnected(idx);
}
diff --git a/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp b/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp
index e50e3e4..3daa0c6 100644
--- a/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicspainteditem_p.h b/src/declarative/graphicsitems/qmlgraphicspainteditem_p.h
index ab21f36..f2f9be0 100644
--- a/src/declarative/graphicsitems/qmlgraphicspainteditem_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicspainteditem_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicspainteditem_p_p.h b/src/declarative/graphicsitems/qmlgraphicspainteditem_p_p.h
index 6bcc51a..7d49914 100644
--- a/src/declarative/graphicsitems/qmlgraphicspainteditem_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicspainteditem_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsparticles.cpp b/src/declarative/graphicsitems/qmlgraphicsparticles.cpp
index 5edd59e..08fce74 100644
--- a/src/declarative/graphicsitems/qmlgraphicsparticles.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsparticles.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -635,7 +635,7 @@ QmlGraphicsParticles::~QmlGraphicsParticles()
}
/*!
- \qmlproperty string Particles::src
+ \qmlproperty string Particles::source
This property holds the URL of the particle image.
*/
diff --git a/src/declarative/graphicsitems/qmlgraphicsparticles_p.h b/src/declarative/graphicsitems/qmlgraphicsparticles_p.h
index c34d55b..7f0f9cd 100644
--- a/src/declarative/graphicsitems/qmlgraphicsparticles_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsparticles_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicspath.cpp b/src/declarative/graphicsitems/qmlgraphicspath.cpp
index eaf0d88..4e4459d 100644
--- a/src/declarative/graphicsitems/qmlgraphicspath.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspath.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicspath_p.h b/src/declarative/graphicsitems/qmlgraphicspath_p.h
index 50ea15b..7ba5bbc 100644
--- a/src/declarative/graphicsitems/qmlgraphicspath_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicspath_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicspath_p_p.h b/src/declarative/graphicsitems/qmlgraphicspath_p_p.h
index 04342a8..acff7c8 100644
--- a/src/declarative/graphicsitems/qmlgraphicspath_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicspath_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicspathview.cpp b/src/declarative/graphicsitems/qmlgraphicspathview.cpp
index a1c9229..aba184d 100644
--- a/src/declarative/graphicsitems/qmlgraphicspathview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspathview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -524,7 +524,7 @@ void QmlGraphicsPathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *)
qreal dist = qAbs(velocity/2 - qmlMod(velocity/2, qreal(100.0 / d->model->count()) - inc));
d->moveOffset.setValue(d->_offset);
d->tl.accel(d->moveOffset, velocity, 10, dist);
- d->tl.execute(d->fixupOffsetEvent);
+ d->tl.callback(QmlTimeLineCallback(&d->moveOffset, d->fixOffsetCallback, d));
} else {
d->fixOffset();
}
@@ -886,6 +886,11 @@ void QmlGraphicsPathViewPrivate::updateCurrent()
}
}
+void QmlGraphicsPathViewPrivate::fixOffsetCallback(void *d)
+{
+ ((QmlGraphicsPathViewPrivate *)d)->fixOffset();
+}
+
void QmlGraphicsPathViewPrivate::fixOffset()
{
Q_Q(QmlGraphicsPathView);
@@ -938,7 +943,7 @@ void QmlGraphicsPathViewPrivate::snapToCurrent()
rounds++;
tl.move(moveOffset, targetOffset + 100.0*(-rounds), QEasingCurve(QEasingCurve::InOutQuad),
int(100*items.count()*qMax((qreal)(2.0/items.count()),(qreal)qAbs(rounds))));
- tl.execute(fixupOffsetEvent);
+ tl.callback(QmlTimeLineCallback(&moveOffset, fixOffsetCallback, this));
return;
}
diff --git a/src/declarative/graphicsitems/qmlgraphicspathview_p.h b/src/declarative/graphicsitems/qmlgraphicspathview_p.h
index 17106a2..8273ccc 100644
--- a/src/declarative/graphicsitems/qmlgraphicspathview_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicspathview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicspathview_p_p.h b/src/declarative/graphicsitems/qmlgraphicspathview_p_p.h
index 18cb205..c635833 100644
--- a/src/declarative/graphicsitems/qmlgraphicspathview_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicspathview_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -82,7 +82,6 @@ public:
, firstIndex(0), pathItems(-1), pathOffset(0), requestedIndex(-1)
, moveReason(Other)
{
- fixupOffsetEvent = QmlTimeLineEvent::timeLineEvent<QmlGraphicsPathViewPrivate, &QmlGraphicsPathViewPrivate::fixOffset>(&moveOffset, this);
}
void init()
@@ -104,6 +103,7 @@ public:
int calcCurrentIndex();
void updateCurrent();
+ static void fixOffsetCallback(void*);
void fixOffset();
void setOffset(qreal offset);
void regenerate();
@@ -127,7 +127,6 @@ public:
qreal dragMargin;
QmlTimeLine tl;
QmlTimeLineValueProxy<QmlGraphicsPathViewPrivate> moveOffset;
- QmlTimeLineEvent fixupOffsetEvent;
int firstIndex;
int pathItems;
int pathOffset;
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
index 142cdce..8adf239 100644
--- a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -361,7 +361,7 @@ Column {
Column {
move: Transition {
NumberAnimation {
- matchProperties: "y"
+ properties: "y"
ease: "easeOutBounce"
}
}
@@ -470,7 +470,7 @@ Row {
id: positioner
move: Transition {
NumberAnimation {
- matchProperties: "x"
+ properties: "x"
ease: "easeOutBounce"
}
}
@@ -592,7 +592,7 @@ Grid {
Grid {
move: Transition {
NumberAnimation {
- matchProperties: "x,y"
+ properties: "x,y"
ease: "easeOutBounce"
}
}
@@ -737,7 +737,7 @@ Flow {
id: positioner
move: Transition {
NumberAnimation {
- matchProperties: "x,y"
+ properties: "x,y"
ease: "easeOutBounce"
}
}
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners_p.h b/src/declarative/graphicsitems/qmlgraphicspositioners_p.h
index d6711f6..1fb687a 100644
--- a/src/declarative/graphicsitems/qmlgraphicspositioners_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicspositioners_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners_p_p.h b/src/declarative/graphicsitems/qmlgraphicspositioners_p_p.h
index 55a31c7..e9b6aa8 100644
--- a/src/declarative/graphicsitems/qmlgraphicspositioners_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicspositioners_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsrectangle.cpp b/src/declarative/graphicsitems/qmlgraphicsrectangle.cpp
index ec44d93..f357ed0 100644
--- a/src/declarative/graphicsitems/qmlgraphicsrectangle.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsrectangle.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsrectangle_p.h b/src/declarative/graphicsitems/qmlgraphicsrectangle_p.h
index b8c2179..66552f6 100644
--- a/src/declarative/graphicsitems/qmlgraphicsrectangle_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsrectangle_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h b/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h
index c4bbbe4..f91e7e2 100644
--- a/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp
index f0e5bb3..fc78ef8 100644
--- a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -157,6 +157,9 @@ QVariant QmlGraphicsRepeater::model() const
void QmlGraphicsRepeater::setModel(const QVariant &model)
{
Q_D(QmlGraphicsRepeater);
+ if (d->dataSource == model)
+ return;
+
clear();
if (d->model) {
disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
@@ -168,6 +171,7 @@ void QmlGraphicsRepeater::setModel(const QVariant &model)
*/
}
d->dataSource = model;
+ emit modelChanged();
QObject *object = qvariant_cast<QObject*>(model);
QmlGraphicsVisualModel *vim = 0;
if (object && (vim = qobject_cast<QmlGraphicsVisualModel *>(object))) {
@@ -219,6 +223,10 @@ QmlComponent *QmlGraphicsRepeater::delegate() const
void QmlGraphicsRepeater::setDelegate(QmlComponent *delegate)
{
Q_D(QmlGraphicsRepeater);
+ if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model))
+ if (delegate == dataModel->delegate())
+ return;
+
if (!d->ownModel) {
d->model = new QmlGraphicsVisualDataModel(qmlContext(this));
d->ownModel = true;
@@ -226,6 +234,7 @@ void QmlGraphicsRepeater::setDelegate(QmlComponent *delegate)
if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model)) {
dataModel->setDelegate(delegate);
regenerate();
+ emit delegateChanged();
}
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater_p.h b/src/declarative/graphicsitems/qmlgraphicsrepeater_p.h
index 61f82d7..2324916 100644
--- a/src/declarative/graphicsitems/qmlgraphicsrepeater_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsrepeater_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -55,8 +55,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsRepeater : public QmlGraphicsItem
{
Q_OBJECT
- Q_PROPERTY(QVariant model READ model WRITE setModel)
- Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate)
+ Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
+ Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_CLASSINFO("DefaultProperty", "delegate")
@@ -73,8 +73,9 @@ public:
int count() const;
Q_SIGNALS:
+ void modelChanged();
+ void delegateChanged();
void countChanged();
-
private:
void clear();
void regenerate();
diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater_p_p.h b/src/declarative/graphicsitems/qmlgraphicsrepeater_p_p.h
index e6d7bfd..5680288 100644
--- a/src/declarative/graphicsitems/qmlgraphicsrepeater_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsrepeater_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsscalegrid.cpp b/src/declarative/graphicsitems/qmlgraphicsscalegrid.cpp
index 94b562b..1956939 100644
--- a/src/declarative/graphicsitems/qmlgraphicsscalegrid.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsscalegrid.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsscalegrid_p_p.h b/src/declarative/graphicsitems/qmlgraphicsscalegrid_p_p.h
index 88938a7..650be62 100644
--- a/src/declarative/graphicsitems/qmlgraphicsscalegrid_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsscalegrid_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicstext.cpp b/src/declarative/graphicsitems/qmlgraphicstext.cpp
index 89081eb..409fa3a 100644
--- a/src/declarative/graphicsitems/qmlgraphicstext.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicstext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -554,6 +554,7 @@ void QmlGraphicsTextPrivate::updateSize()
else
doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug)
dy -= (int)doc->size().height();
+ cachedLayoutSize = doc->size().toSize();
}
int yoff = 0;
@@ -769,7 +770,7 @@ void QmlGraphicsText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidg
{
Q_D(QmlGraphicsText);
- if (d->cache || d->richText || d->style != Normal) {
+ if (d->cache || d->style != Normal) {
d->checkImgCache();
if (d->imgCache.isNull())
return;
@@ -846,7 +847,15 @@ void QmlGraphicsText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidg
p->save();
p->setClipRect(boundingRect(), Qt::IntersectClip);
}
- d->drawWrappedText(p, QPointF(0,y), false);
+ if (d->richText) {
+ QAbstractTextDocumentLayout::PaintContext context;
+ context.palette.setColor(QPalette::Text, d->color);
+ p->translate(0, y);
+ d->doc->documentLayout()->draw(p, context);
+ p->translate(0, -y);
+ } else {
+ d->drawWrappedText(p, QPointF(0,y), false);
+ }
if (needClip)
p->restore();
}
diff --git a/src/declarative/graphicsitems/qmlgraphicstext_p.h b/src/declarative/graphicsitems/qmlgraphicstext_p.h
index 8fa2e65..ad35524 100644
--- a/src/declarative/graphicsitems/qmlgraphicstext_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicstext_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicstext_p_p.h b/src/declarative/graphicsitems/qmlgraphicstext_p_p.h
index 1e29e58..f67d57c 100644
--- a/src/declarative/graphicsitems/qmlgraphicstext_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicstext_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -75,7 +75,7 @@ public:
dirty(true), wrap(false), richText(false), singleline(false), cache(true), doc(0),
format(QmlGraphicsText::AutoText)
{
-#ifdef QML_NO_TEXT_CACHE
+#if defined(QML_NO_TEXT_CACHE)
cache = false;
#endif
}
diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp
index 00f7e42..3dadbe0 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit_p.h b/src/declarative/graphicsitems/qmlgraphicstextedit_p.h
index e95b077..337cd9d 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextedit_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicstextedit_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit_p_p.h b/src/declarative/graphicsitems/qmlgraphicstextedit_p_p.h
index 8914bfd..7d4ca88 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextedit_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicstextedit_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp b/src/declarative/graphicsitems/qmlgraphicstextinput.cpp
index 6d9b7b1..6b4407f 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicstextinput.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicstextinput_p.h b/src/declarative/graphicsitems/qmlgraphicstextinput_p.h
index a91e71a..2b37b78 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextinput_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicstextinput_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicstextinput_p_p.h b/src/declarative/graphicsitems/qmlgraphicstextinput_p_p.h
index 9eb6e07..694ec93 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextinput_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicstextinput_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
index d14fc84..9216793 100644
--- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -71,16 +71,14 @@ class QmlGraphicsVisualItemModelPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QmlGraphicsVisualItemModel)
public:
- QmlGraphicsVisualItemModelPrivate() : QObjectPrivate(), children(this) {}
+ QmlGraphicsVisualItemModelPrivate() : QObjectPrivate() {}
- struct ItemList : public QmlConcreteList<QmlGraphicsItem *>
- {
- ItemList(QmlGraphicsVisualItemModelPrivate *m) : QmlConcreteList<QmlGraphicsItem *>(), model(m) {}
-
- void append(QmlGraphicsItem *item);
-
- QmlGraphicsVisualItemModelPrivate *model;
- };
+ static void children_append(QmlListProperty<QmlGraphicsItem> *prop, QmlGraphicsItem *item) {
+ item->QObject::setParent(prop->object);
+ static_cast<QmlGraphicsVisualItemModelPrivate *>(prop->data)->children.append(item);
+ static_cast<QmlGraphicsVisualItemModelPrivate *>(prop->data)->itemAppended();
+ static_cast<QmlGraphicsVisualItemModelPrivate *>(prop->data)->emitChildrenChanged();
+ }
void itemAppended() {
Q_Q(QmlGraphicsVisualItemModel);
@@ -94,7 +92,8 @@ public:
Q_Q(QmlGraphicsVisualItemModel);
emit q->childrenChanged();
}
- ItemList children;
+
+ QList<QmlGraphicsItem *> children;
};
@@ -132,10 +131,10 @@ QmlGraphicsVisualItemModel::QmlGraphicsVisualItemModel()
{
}
-QmlList<QmlGraphicsItem *> *QmlGraphicsVisualItemModel::children()
+QmlListProperty<QmlGraphicsItem> QmlGraphicsVisualItemModel::children()
{
Q_D(QmlGraphicsVisualItemModel);
- return &(d->children);
+ return QmlListProperty<QmlGraphicsItem>(this, d, QmlGraphicsVisualItemModelPrivate::children_append);
}
/*!
@@ -200,15 +199,6 @@ int QmlGraphicsVisualItemModel::indexOf(QmlGraphicsItem *item, QObject *) const
return d->children.indexOf(item);
}
-void QmlGraphicsVisualItemModelPrivate::ItemList::append(QmlGraphicsItem *item)
-{
- QmlConcreteList<QmlGraphicsItem*>::append(item);
- item->QObject::setParent(model->q_ptr);
- model->itemAppended();
-
- model->emitChildrenChanged();
-}
-
QmlGraphicsVisualItemModelAttached *QmlGraphicsVisualItemModel::qmlAttachedProperties(QObject *obj)
{
return QmlGraphicsVisualItemModelAttached::properties(obj);
@@ -422,11 +412,10 @@ int QmlGraphicsVisualDataModelDataMetaObject::createProperty(const char *name, c
QmlGraphicsVisualDataModelPrivate *model = QmlGraphicsVisualDataModelPrivate::get(data->m_model);
if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) {
- if (model->m_listAccessor->type() == QmlListAccessor::QmlList
- || model->m_listAccessor->type() == QmlListAccessor::ListProperty) {
+ if (model->m_listAccessor->type() == QmlListAccessor::ListProperty) {
model->ensureRoles();
QObject *object = model->m_listAccessor->at(data->m_index).value<QObject*>();
- if (object && object->property(name).isValid())
+ if (object && (object->property(name).isValid() || qstrcmp(name,"modelData")==0))
return QmlOpenMetaObject::createProperty(name, type);
}
}
@@ -685,7 +674,7 @@ void QmlGraphicsVisualDataModel::setModel(const QVariant &model)
}
d->m_listAccessor = new QmlListAccessor;
d->m_listAccessor->setList(model, d->m_context?d->m_context->engine():qmlEngine(this));
- if (d->m_listAccessor->type() != QmlListAccessor::QmlList && d->m_listAccessor->type() != QmlListAccessor::ListProperty)
+ if (d->m_listAccessor->type() != QmlListAccessor::ListProperty)
d->m_metaDataCacheable = true;
if (d->m_delegate && d->modelCount()) {
emit itemsInserted(0, d->modelCount());
diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h
index 9ebf626..49f9b27 100644
--- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -109,7 +109,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsVisualItemModel : public QmlGraphicsVisual
Q_OBJECT
Q_DECLARE_PRIVATE(QmlGraphicsVisualItemModel)
- Q_PROPERTY(QmlList<QmlGraphicsItem *>* children READ children NOTIFY childrenChanged DESIGNABLE false)
+ Q_PROPERTY(QmlListProperty<QmlGraphicsItem> children READ children NOTIFY childrenChanged DESIGNABLE false)
Q_CLASSINFO("DefaultProperty", "children")
public:
@@ -126,7 +126,7 @@ public:
virtual int indexOf(QmlGraphicsItem *item, QObject *objectContext) const;
- QmlList<QmlGraphicsItem *> *children();
+ QmlListProperty<QmlGraphicsItem> children();
static QmlGraphicsVisualItemModelAttached *qmlAttachedProperties(QObject *obj);
diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp
index 533df2a..0c21f75 100644
--- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -77,7 +77,6 @@ public:
progress(1.0), status(QmlGraphicsWebView::Null), pending(PendingNone),
newWindowComponent(0), newWindowParent(0),
pressTime(400),
- windowObjects(this),
rendering(true)
{
}
@@ -101,19 +100,14 @@ public:
QPoint pressPoint;
int pressTime; // milliseconds before it's a "hold"
+
+ static void windowObjects_append(QmlListProperty<QObject> *prop, QObject *o) {
+ static_cast<QmlGraphicsWebViewPrivate *>(prop->data)->windowObjects.append(o);
+ static_cast<QmlGraphicsWebViewPrivate *>(prop->data)->updateWindowObjects();
+ }
+
void updateWindowObjects();
- class WindowObjectList : public QmlConcreteList<QObject *>
- {
- public:
- WindowObjectList(QmlGraphicsWebViewPrivate *p)
- : priv(p) {}
- virtual void append(QObject *v) {
- QmlConcreteList<QObject *>::append(v);
- priv->updateWindowObjects();
- }
- private:
- QmlGraphicsWebViewPrivate *priv;
- } windowObjects;
+ QObjectList windowObjects;
bool rendering;
};
@@ -451,10 +445,10 @@ void QmlGraphicsWebView::paintPage(const QRect& r)
If Javascript is not enabled for this page, then this property does nothing.
*/
-QmlList<QObject *> *QmlGraphicsWebView::javaScriptWindowObjects()
+QmlListProperty<QObject> QmlGraphicsWebView::javaScriptWindowObjects()
{
Q_D(QmlGraphicsWebView);
- return &d->windowObjects;
+ return QmlListProperty<QObject>(this, d, &QmlGraphicsWebViewPrivate::windowObjects_append);
}
QmlGraphicsWebViewAttached *QmlGraphicsWebView::qmlAttachedProperties(QObject *o)
diff --git a/src/declarative/graphicsitems/qmlgraphicswebview_p.h b/src/declarative/graphicsitems/qmlgraphicswebview_p.h
index 0aaf895..30ba0e4 100644
--- a/src/declarative/graphicsitems/qmlgraphicswebview_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicswebview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -114,7 +114,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsWebView : public QmlGraphicsPaintedItem
Q_PROPERTY(QmlGraphicsWebSettings* settings READ settingsObject CONSTANT)
- Q_PROPERTY(QmlList<QObject *>* javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT)
+ Q_PROPERTY(QmlListProperty<QObject> javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT)
Q_PROPERTY(QmlComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent)
Q_PROPERTY(QmlGraphicsItem* newWindowParent READ newWindowParent WRITE setNewWindowParent)
@@ -174,7 +174,7 @@ public:
bool renderingEnabled() const;
void setRenderingEnabled(bool);
- QmlList<QObject *> *javaScriptWindowObjects();
+ QmlListProperty<QObject> javaScriptWindowObjects();
static QmlGraphicsWebViewAttached *qmlAttachedProperties(QObject *);
diff --git a/src/declarative/graphicsitems/qmlgraphicswebview_p_p.h b/src/declarative/graphicsitems/qmlgraphicswebview_p_p.h
index 5659059..e132cae 100644
--- a/src/declarative/graphicsitems/qmlgraphicswebview_p_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicswebview_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/parser/qmljsast.cpp b/src/declarative/qml/parser/qmljsast.cpp
index e80b05e..d3ceba6 100644
--- a/src/declarative/qml/parser/qmljsast.cpp
+++ b/src/declarative/qml/parser/qmljsast.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/parser/qmljsast_p.h b/src/declarative/qml/parser/qmljsast_p.h
index 032fbb1..9de733c 100644
--- a/src/declarative/qml/parser/qmljsast_p.h
+++ b/src/declarative/qml/parser/qmljsast_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/parser/qmljsastfwd_p.h b/src/declarative/qml/parser/qmljsastfwd_p.h
index f571a2e..2c42fd9 100644
--- a/src/declarative/qml/parser/qmljsastfwd_p.h
+++ b/src/declarative/qml/parser/qmljsastfwd_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/parser/qmljsastvisitor.cpp b/src/declarative/qml/parser/qmljsastvisitor.cpp
index 1290c89..bd7439c 100644
--- a/src/declarative/qml/parser/qmljsastvisitor.cpp
+++ b/src/declarative/qml/parser/qmljsastvisitor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/parser/qmljsastvisitor_p.h b/src/declarative/qml/parser/qmljsastvisitor_p.h
index 1b50bcc..9007a2c 100644
--- a/src/declarative/qml/parser/qmljsastvisitor_p.h
+++ b/src/declarative/qml/parser/qmljsastvisitor_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/parser/qmljsengine_p.cpp b/src/declarative/qml/parser/qmljsengine_p.cpp
index b8ecd18..84bb1c5 100644
--- a/src/declarative/qml/parser/qmljsengine_p.cpp
+++ b/src/declarative/qml/parser/qmljsengine_p.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/parser/qmljsengine_p.h b/src/declarative/qml/parser/qmljsengine_p.h
index 2c15af3..ebfeb1b 100644
--- a/src/declarative/qml/parser/qmljsengine_p.h
+++ b/src/declarative/qml/parser/qmljsengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/parser/qmljsglobal_p.h b/src/declarative/qml/parser/qmljsglobal_p.h
index 49e50cf..4457450 100644
--- a/src/declarative/qml/parser/qmljsglobal_p.h
+++ b/src/declarative/qml/parser/qmljsglobal_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/parser/qmljsgrammar.cpp b/src/declarative/qml/parser/qmljsgrammar.cpp
index b416959..12071db 100644
--- a/src/declarative/qml/parser/qmljsgrammar.cpp
+++ b/src/declarative/qml/parser/qmljsgrammar.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/parser/qmljsgrammar_p.h b/src/declarative/qml/parser/qmljsgrammar_p.h
index c2e2693..21fddba 100644
--- a/src/declarative/qml/parser/qmljsgrammar_p.h
+++ b/src/declarative/qml/parser/qmljsgrammar_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/parser/qmljslexer.cpp b/src/declarative/qml/parser/qmljslexer.cpp
index cf3ed34..816542f 100644
--- a/src/declarative/qml/parser/qmljslexer.cpp
+++ b/src/declarative/qml/parser/qmljslexer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/parser/qmljslexer_p.h b/src/declarative/qml/parser/qmljslexer_p.h
index b830071..8f95a90 100644
--- a/src/declarative/qml/parser/qmljslexer_p.h
+++ b/src/declarative/qml/parser/qmljslexer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/parser/qmljsmemorypool_p.h b/src/declarative/qml/parser/qmljsmemorypool_p.h
index 3da2678..5dffdc8 100644
--- a/src/declarative/qml/parser/qmljsmemorypool_p.h
+++ b/src/declarative/qml/parser/qmljsmemorypool_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/parser/qmljsnodepool_p.h b/src/declarative/qml/parser/qmljsnodepool_p.h
index abe4cc8..2055a7e 100644
--- a/src/declarative/qml/parser/qmljsnodepool_p.h
+++ b/src/declarative/qml/parser/qmljsnodepool_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qbitfield_p.h b/src/declarative/qml/qbitfield_p.h
index 8b3afdb..28afa40 100644
--- a/src/declarative/qml/qbitfield_p.h
+++ b/src/declarative/qml/qbitfield_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmetaobjectbuilder.cpp b/src/declarative/qml/qmetaobjectbuilder.cpp
index 11b9f80..a518b03 100644
--- a/src/declarative/qml/qmetaobjectbuilder.cpp
+++ b/src/declarative/qml/qmetaobjectbuilder.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmetaobjectbuilder_p.h b/src/declarative/qml/qmetaobjectbuilder_p.h
index 3eff4ff..dbaf9e6 100644
--- a/src/declarative/qml/qmetaobjectbuilder_p.h
+++ b/src/declarative/qml/qmetaobjectbuilder_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qml.h b/src/declarative/qml/qml.h
index 859fd66..7972305 100644
--- a/src/declarative/qml/qml.h
+++ b/src/declarative/qml/qml.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -59,12 +59,10 @@ QT_MODULE(Declarative)
#define QML_DECLARE_TYPE(TYPE) \
Q_DECLARE_METATYPE(TYPE *) \
- Q_DECLARE_METATYPE(QmlListProperty<TYPE>) \
- Q_DECLARE_METATYPE(QmlList<TYPE *> *)
+ Q_DECLARE_METATYPE(QmlListProperty<TYPE>)
#define QML_DECLARE_TYPE_HASMETATYPE(TYPE) \
- Q_DECLARE_METATYPE(QmlListProperty<TYPE>) \
- Q_DECLARE_METATYPE(QmlList<TYPE *> *)
+ Q_DECLARE_METATYPE(QmlListProperty<TYPE>)
#define QML_DECLARE_INTERFACE(INTERFACE) \
QML_DECLARE_TYPE(INTERFACE)
@@ -77,6 +75,7 @@ enum { /* TYPEINFO flags */
};
#define QML_DECLARE_TYPEINFO(TYPE, FLAGS) \
+QT_BEGIN_NAMESPACE \
template <> \
class QmlTypeInfo<TYPE > \
{ \
@@ -84,7 +83,8 @@ public: \
enum { \
hasAttachedProperties = (((FLAGS) & QML_HAS_ATTACHED_PROPERTIES) == QML_HAS_ATTACHED_PROPERTIES) \
}; \
-};
+}; \
+QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri
index 021ef9e..2313c37 100644
--- a/src/declarative/qml/qml.pri
+++ b/src/declarative/qml/qml.pri
@@ -51,7 +51,9 @@ SOURCES += \
$$PWD/qmllistscriptclass.cpp \
$$PWD/qmlworkerscript.cpp \
$$PWD/qmlimageprovider.cpp \
- $$PWD/qmlnetworkaccessmanagerfactory.cpp
+ $$PWD/qmlnetworkaccessmanagerfactory.cpp \
+ $$PWD/qmllist.cpp
+
HEADERS += \
$$PWD/qmlparser_p.h \
$$PWD/qmlglobal_p.h \
@@ -76,8 +78,8 @@ HEADERS += \
$$PWD/qmlengine_p.h \
$$PWD/qmlexpression_p.h \
$$PWD/qmlprivate.h \
- $$PWD/qmldom.h \
$$PWD/qmldom_p.h \
+ $$PWD/qmldom_p_p.h \
$$PWD/qmlrefcount_p.h \
$$PWD/qmlmetatype.h \
$$PWD/qmlengine.h \
@@ -91,6 +93,7 @@ HEADERS += \
$$PWD/qmlcompositetypedata_p.h \
$$PWD/qmlcompositetypemanager_p.h \
$$PWD/qmllist.h \
+ $$PWD/qmllist_p.h \
$$PWD/qmldeclarativedata_p.h \
$$PWD/qmlerror.h \
$$PWD/qmlscriptparser_p.h \
diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp
index a986818..feadd0f 100644
--- a/src/declarative/qml/qmlbinding.cpp
+++ b/src/declarative/qml/qmlbinding.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -54,8 +54,6 @@
#include <QVariant>
#include <QtCore/qdebug.h>
-Q_DECLARE_METATYPE(QList<QObject *>);
-
QT_BEGIN_NAMESPACE
QML_DEFINE_NOCREATE_TYPE(QmlBinding);
diff --git a/src/declarative/qml/qmlbinding.h b/src/declarative/qml/qmlbinding.h
index bae971d..151b71c 100644
--- a/src/declarative/qml/qmlbinding.h
+++ b/src/declarative/qml/qmlbinding.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlbinding_p.h b/src/declarative/qml/qmlbinding_p.h
index c6c1935..b4f88b5 100644
--- a/src/declarative/qml/qmlbinding_p.h
+++ b/src/declarative/qml/qmlbinding_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlboundsignal.cpp b/src/declarative/qml/qmlboundsignal.cpp
index d42e7ba..a075899 100644
--- a/src/declarative/qml/qmlboundsignal.cpp
+++ b/src/declarative/qml/qmlboundsignal.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlboundsignal_p.h b/src/declarative/qml/qmlboundsignal_p.h
index 971fc89..51d21d7 100644
--- a/src/declarative/qml/qmlboundsignal_p.h
+++ b/src/declarative/qml/qmlboundsignal_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlclassfactory.cpp b/src/declarative/qml/qmlclassfactory.cpp
index 3c19c2f..2adff09 100644
--- a/src/declarative/qml/qmlclassfactory.cpp
+++ b/src/declarative/qml/qmlclassfactory.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlclassfactory_p.h b/src/declarative/qml/qmlclassfactory_p.h
index 91f616e..2ddadcf 100644
--- a/src/declarative/qml/qmlclassfactory_p.h
+++ b/src/declarative/qml/qmlclassfactory_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcleanup.cpp b/src/declarative/qml/qmlcleanup.cpp
index e7767d2..581d4a3 100644
--- a/src/declarative/qml/qmlcleanup.cpp
+++ b/src/declarative/qml/qmlcleanup.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcleanup_p.h b/src/declarative/qml/qmlcleanup_p.h
index c140e43..50803f3 100644
--- a/src/declarative/qml/qmlcleanup_p.h
+++ b/src/declarative/qml/qmlcleanup_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcompiledbindings.cpp b/src/declarative/qml/qmlcompiledbindings.cpp
index bc62d9a..7a8cf0e 100644
--- a/src/declarative/qml/qmlcompiledbindings.cpp
+++ b/src/declarative/qml/qmlcompiledbindings.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcompiledbindings_p.h b/src/declarative/qml/qmlcompiledbindings_p.h
index 1d8fac4..38fb2a3 100644
--- a/src/declarative/qml/qmlcompiledbindings_p.h
+++ b/src/declarative/qml/qmlcompiledbindings_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcompileddata.cpp b/src/declarative/qml/qmlcompileddata.cpp
index 48a0893..0120f56 100644
--- a/src/declarative/qml/qmlcompileddata.cpp
+++ b/src/declarative/qml/qmlcompileddata.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index 10150de..bbae201 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -730,7 +730,7 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
compileState.parserStatusCount++;
// Check if this is a custom parser type. Custom parser types allow
- // assignments to non-existant properties. These assignments are then
+ // assignments to non-existent properties. These assignments are then
// compiled by the type.
bool isCustomParser = output->types.at(obj->type).type &&
output->types.at(obj->type).type->customParser() != 0;
@@ -1429,7 +1429,7 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
ctxt));
return true;
} else if (!type || !type->attachedPropertiesType()) {
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existant attached object"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existent attached object"));
}
if (!prop->value)
@@ -1486,17 +1486,16 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
} else if (prop->index == -1) {
if (prop->isDefault) {
- COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QmlCompiler","Cannot assign to non-existant default property"));
+ COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QmlCompiler","Cannot assign to non-existent default property"));
} else {
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name)));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name)));
}
} else if (prop->value) {
COMPILE_CHECK(buildGroupedProperty(prop, obj, ctxt));
- } else if (QmlEnginePrivate::get(engine)->isQmlList(prop->type) ||
- QmlMetaType::isList(prop->type)) {
+ } else if (QmlEnginePrivate::get(engine)->isList(prop->type)) {
COMPILE_CHECK(buildListProperty(prop, obj, ctxt));
@@ -1534,7 +1533,7 @@ QmlCompiler::buildPropertyInNamespace(QmlEnginePrivate::ImportedNamespace *ns,
&type, 0, 0, 0);
if (!type || !type->attachedPropertiesType())
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existant attached object"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existent attached object"));
if (!prop->value)
COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid attached object assignment"));
@@ -1552,8 +1551,7 @@ QmlCompiler::buildPropertyInNamespace(QmlEnginePrivate::ImportedNamespace *ns,
void QmlCompiler::genValueProperty(QmlParser::Property *prop,
QmlParser::Object *obj)
{
- if (QmlEnginePrivate::get(engine)->isQmlList(prop->type) ||
- QmlMetaType::isList(prop->type)) {
+ if (QmlEnginePrivate::get(engine)->isList(prop->type)) {
genListProperty(prop, obj);
} else {
genPropertyAssignment(prop, obj);
@@ -1563,22 +1561,10 @@ void QmlCompiler::genValueProperty(QmlParser::Property *prop,
void QmlCompiler::genListProperty(QmlParser::Property *prop,
QmlParser::Object *obj)
{
- QmlInstruction::Type fetchType;
- QmlInstruction::Type storeType;
- int listType;
-
- if (QmlEnginePrivate::get(engine)->isQmlList(prop->type)) {
- fetchType = QmlInstruction::FetchQmlList;
- storeType = QmlInstruction::StoreObjectQmlList;
- listType = QmlEnginePrivate::get(engine)->qmlListType(prop->type);
- } else {
- fetchType = QmlInstruction::FetchQList;
- storeType = QmlInstruction::StoreObjectQList;
- listType = QmlMetaType::listType(prop->type);
- }
+ int listType = QmlEnginePrivate::get(engine)->listType(prop->type);
QmlInstruction fetch;
- fetch.type = fetchType;
+ fetch.type = QmlInstruction::FetchQList;
fetch.line = prop->location.start.line;
fetch.fetchQmlList.property = prop->index;
bool listTypeIsInterface = QmlMetaType::isInterface(listType);
@@ -1598,7 +1584,7 @@ void QmlCompiler::genListProperty(QmlParser::Property *prop,
output->bytecode << assign;
} else {
QmlInstruction store;
- store.type = storeType;
+ store.type = QmlInstruction::StoreObjectQList;
store.line = prop->location.start.line;
output->bytecode << store;
}
@@ -1841,7 +1827,7 @@ bool QmlCompiler::buildValueTypeProperty(QObject *type,
foreach (Property *prop, obj->properties) {
int idx = type->metaObject()->indexOfProperty(prop->name.constData());
if (idx == -1)
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name)));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name)));
QMetaProperty p = type->metaObject()->property(idx);
prop->index = idx;
prop->type = p.userType();
@@ -1895,67 +1881,40 @@ bool QmlCompiler::buildListProperty(QmlParser::Property *prop,
QmlParser::Object *obj,
const BindingContext &ctxt)
{
- Q_ASSERT(QmlMetaType::isList(prop->type) ||
- QmlEnginePrivate::get(engine)->isQmlList(prop->type));
+ Q_ASSERT(QmlEnginePrivate::get(engine)->isList(prop->type));
int t = prop->type;
obj->addValueProperty(prop);
- if (QmlEnginePrivate::get(engine)->isQmlList(t)) {
- int listType = QmlEnginePrivate::get(engine)->qmlListType(t);
- bool listTypeIsInterface = QmlMetaType::isInterface(listType);
-
- for (int ii = 0; ii < prop->values.count(); ++ii) {
- Value *v = prop->values.at(ii);
- if (v->object) {
- v->type = Value::CreatedObject;
- COMPILE_CHECK(buildObject(v->object, ctxt));
-
- // We check object coercian here. We check interface assignment
- // at runtime.
- if (!listTypeIsInterface) {
- if (!canCoerce(listType, v->object)) {
- COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Cannot assign object to list"));
- }
- }
+ int listType = QmlEnginePrivate::get(engine)->listType(t);
+ bool listTypeIsInterface = QmlMetaType::isInterface(listType);
- } else {
- COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Cannot assign primitives to lists"));
- }
- }
+ bool assignedBinding = false;
+ for (int ii = 0; ii < prop->values.count(); ++ii) {
+ Value *v = prop->values.at(ii);
+ if (v->object) {
+ v->type = Value::CreatedObject;
+ COMPILE_CHECK(buildObject(v->object, ctxt));
- } else {
- int listType = QmlMetaType::listType(t);
- bool listTypeIsInterface = QmlMetaType::isInterface(listType);
-
- bool assignedBinding = false;
- for (int ii = 0; ii < prop->values.count(); ++ii) {
- Value *v = prop->values.at(ii);
- if (v->object) {
- v->type = Value::CreatedObject;
- COMPILE_CHECK(buildObject(v->object, ctxt));
-
- // We check object coercian here. We check interface assignment
- // at runtime.
- if (!listTypeIsInterface) {
- if (!canCoerce(listType, v->object)) {
- COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Cannot assign object to list"));
- }
+ // We check object coercian here. We check interface assignment
+ // at runtime.
+ if (!listTypeIsInterface) {
+ if (!canCoerce(listType, v->object)) {
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Cannot assign object to list"));
}
+ }
- } else if (v->value.isScript()) {
- if (assignedBinding)
- COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Can only assign one binding to lists"));
+ } else if (v->value.isScript()) {
+ if (assignedBinding)
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Can only assign one binding to lists"));
- assignedBinding = true;
- COMPILE_CHECK(buildBinding(v, prop, ctxt));
- v->type = Value::PropertyBinding;
- } else {
- COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Cannot assign primitives to lists"));
- }
+ assignedBinding = true;
+ COMPILE_CHECK(buildBinding(v, prop, ctxt));
+ v->type = Value::PropertyBinding;
+ } else {
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Cannot assign primitives to lists"));
}
-
}
return true;
@@ -2335,10 +2294,10 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
propertyType = QMetaType::QObjectStar;
} else {
readonly = true;
- type = "QmlList<";
+ type = "QmlListProperty<";
type.append(customTypeName);
- type.append("*>*");
- propertyType = qMetaTypeId<QmlList<QObject*>* >();
+ type.append(">");
+ propertyType = qMetaTypeId<QmlListProperty<QObject> >();
}
}
break;
diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h
index f3f266b..744d397 100644
--- a/src/declarative/qml/qmlcompiler_p.h
+++ b/src/declarative/qml/qmlcompiler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp
index 343bd4b..87ecb8a 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qmlcomponent.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcomponent.h b/src/declarative/qml/qmlcomponent.h
index 342f503..8996481 100644
--- a/src/declarative/qml/qmlcomponent.h
+++ b/src/declarative/qml/qmlcomponent.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcomponent_p.h b/src/declarative/qml/qmlcomponent_p.h
index 4039a61..b7a3038 100644
--- a/src/declarative/qml/qmlcomponent_p.h
+++ b/src/declarative/qml/qmlcomponent_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcompositetypedata_p.h b/src/declarative/qml/qmlcompositetypedata_p.h
index 5358963..342c88a 100644
--- a/src/declarative/qml/qmlcompositetypedata_p.h
+++ b/src/declarative/qml/qmlcompositetypedata_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp
index 3504fe9..71d6f16 100644
--- a/src/declarative/qml/qmlcompositetypemanager.cpp
+++ b/src/declarative/qml/qmlcompositetypemanager.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcompositetypemanager_p.h b/src/declarative/qml/qmlcompositetypemanager_p.h
index 89e2353..2da5d34 100644
--- a/src/declarative/qml/qmlcompositetypemanager_p.h
+++ b/src/declarative/qml/qmlcompositetypemanager_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp
index 3c419b6..56038cf 100644
--- a/src/declarative/qml/qmlcontext.cpp
+++ b/src/declarative/qml/qmlcontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -428,7 +428,7 @@ void QmlContextPrivate::setIdPropertyData(QmlIntegerCache *data)
}
/*!
- Set a the \a value of the \a name property on this context.
+ Set the \a value of the \a name property on this context.
QmlContext does \bold not take ownership of \a value.
*/
@@ -452,6 +452,10 @@ void QmlContext::setContextProperty(const QString &name, QObject *value)
}
}
+/*!
+ Returns the value of the \a name property for this context
+ as a QVariant.
+ */
QVariant QmlContext::contextProperty(const QString &name) const
{
Q_D(const QmlContext);
@@ -540,5 +544,30 @@ QUrl QmlContext::baseUrl() const
return QUrl();
}
+int QmlContextPrivate::context_count(QmlListProperty<QObject> *prop)
+{
+ QmlContext *context = static_cast<QmlContext*>(prop->object);
+ QmlContextPrivate *d = QmlContextPrivate::get(context);
+ int contextProperty = (int)(intptr_t)prop->data;
+
+ if (d->propertyValues.at(contextProperty).userType() != qMetaTypeId<QList<QObject*> >()) {
+ return 0;
+ } else {
+ return ((const QList<QObject> *)d->propertyValues.at(contextProperty).constData())->count();
+ }
+}
+
+QObject *QmlContextPrivate::context_at(QmlListProperty<QObject> *prop, int index)
+{
+ QmlContext *context = static_cast<QmlContext*>(prop->object);
+ QmlContextPrivate *d = QmlContextPrivate::get(context);
+ int contextProperty = (int)(intptr_t)prop->data;
+
+ if (d->propertyValues.at(contextProperty).userType() != qMetaTypeId<QList<QObject*> >()) {
+ return 0;
+ } else {
+ return ((const QList<QObject*> *)d->propertyValues.at(contextProperty).constData())->at(index);
+ }
+}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlcontext.h b/src/declarative/qml/qmlcontext.h
index bf389a0..e96ed84 100644
--- a/src/declarative/qml/qmlcontext.h
+++ b/src/declarative/qml/qmlcontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -45,6 +45,7 @@
#include <QtCore/qurl.h>
#include <QtCore/qobject.h>
#include <QtScript/qscriptvalue.h>
+#include <QtCore/qmetatype.h>
QT_BEGIN_HEADER
@@ -97,9 +98,10 @@ private:
QmlContext(QmlContext *parent, QObject *objParent, bool);
QmlContext(QmlEngine *, bool);
};
-
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QList<QObject*>);
+
QT_END_HEADER
#endif // QMLCONTEXT_H
diff --git a/src/declarative/qml/qmlcontext_p.h b/src/declarative/qml/qmlcontext_p.h
index cd7e1b6..965eeed 100644
--- a/src/declarative/qml/qmlcontext_p.h
+++ b/src/declarative/qml/qmlcontext_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -152,6 +152,9 @@ public:
// Only used for debugging
QList<QPointer<QObject> > instances;
+
+ static int context_count(QmlListProperty<QObject> *);
+ static QObject *context_at(QmlListProperty<QObject> *, int);
};
QmlContextPrivate::IdNotifier::IdNotifier()
diff --git a/src/declarative/qml/qmlcontextscriptclass.cpp b/src/declarative/qml/qmlcontextscriptclass.cpp
index 80d52ad..4c71903 100644
--- a/src/declarative/qml/qmlcontextscriptclass.cpp
+++ b/src/declarative/qml/qmlcontextscriptclass.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -44,6 +44,7 @@
#include "qmlengine_p.h"
#include "qmlcontext_p.h"
#include "qmltypenamescriptclass_p.h"
+#include "qmllistscriptclass_p.h"
#include "qmlguard_p.h"
QT_BEGIN_NAMESPACE
@@ -227,8 +228,12 @@ QmlContextScriptClass::property(Object *object, const Identifier &name)
if (lastPropertyIndex < cp->idValueCount) {
rv = ep->objectClass->newQObject(cp->idValues[lastPropertyIndex].data());
} else {
- QVariant value = cp->propertyValues.at(lastPropertyIndex);
- rv = ep->scriptValueFromVariant(value);
+ const QVariant &value = cp->propertyValues.at(lastPropertyIndex);
+ if (value.userType() == qMetaTypeId<QList<QObject*> >()) {
+ rv = ep->listClass->newList(QmlListProperty<QObject>(bindContext, (void*)lastPropertyIndex, 0, QmlContextPrivate::context_count, QmlContextPrivate::context_at), qMetaTypeId<QmlListProperty<QObject> >());
+ } else {
+ rv = ep->scriptValueFromVariant(value);
+ }
}
ep->capturedProperties <<
diff --git a/src/declarative/qml/qmlcontextscriptclass_p.h b/src/declarative/qml/qmlcontextscriptclass_p.h
index f98d44f..c878f3c 100644
--- a/src/declarative/qml/qmlcontextscriptclass_p.h
+++ b/src/declarative/qml/qmlcontextscriptclass_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcustomparser.cpp b/src/declarative/qml/qmlcustomparser.cpp
index 116644a..d781110 100644
--- a/src/declarative/qml/qmlcustomparser.cpp
+++ b/src/declarative/qml/qmlcustomparser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcustomparser_p.h b/src/declarative/qml/qmlcustomparser_p.h
index 9502b08..7aebb0d 100644
--- a/src/declarative/qml/qmlcustomparser_p.h
+++ b/src/declarative/qml/qmlcustomparser_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlcustomparser_p_p.h b/src/declarative/qml/qmlcustomparser_p_p.h
index c27a5bc..52e7b4f 100644
--- a/src/declarative/qml/qmlcustomparser_p_p.h
+++ b/src/declarative/qml/qmlcustomparser_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmldeclarativedata_p.h b/src/declarative/qml/qmldeclarativedata_p.h
index e2717e0..efdc5fd 100644
--- a/src/declarative/qml/qmldeclarativedata_p.h
+++ b/src/declarative/qml/qmldeclarativedata_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp
index 52530db..c75a299 100644
--- a/src/declarative/qml/qmldom.cpp
+++ b/src/declarative/qml/qmldom.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#include "qmldom.h"
#include "qmldom_p.h"
+#include "qmldom_p_p.h"
#include "qmlcompositetypedata_p.h"
#include "qmlcompiler_p.h"
@@ -1346,7 +1346,6 @@ QmlDomValue::Type QmlDomValue::type() const
{
if (d->property)
if (QmlMetaType::isList(d->property->type) ||
- QmlMetaType::isQmlList(d->property->type) ||
(d->property && d->property->values.count() > 1))
return List;
diff --git a/src/declarative/qml/qmldom.h b/src/declarative/qml/qmldom.h
deleted file mode 100644
index 8442f49..0000000
--- a/src/declarative/qml/qmldom.h
+++ /dev/null
@@ -1,349 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMLDOM_H
-#define QMLDOM_H
-
-#include "qmlerror.h"
-
-#include <QtCore/qlist.h>
-#include <QtCore/qshareddata.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QString;
-class QByteArray;
-class QmlDomObject;
-class QmlDomList;
-class QmlDomValue;
-class QmlEngine;
-class QmlDomComponent;
-class QmlDomImport;
-class QIODevice;
-
-class QmlDomDocumentPrivate;
-
-class Q_DECLARATIVE_EXPORT QmlDomDocument
-{
-public:
- QmlDomDocument();
- QmlDomDocument(const QmlDomDocument &);
- ~QmlDomDocument();
- QmlDomDocument &operator=(const QmlDomDocument &);
-
- QList<QmlDomImport> imports() const;
-
- QList<QmlError> errors() const;
- bool load(QmlEngine *, const QByteArray &, const QUrl & = QUrl());
-
- QmlDomObject rootObject() const;
-
-private:
- QSharedDataPointer<QmlDomDocumentPrivate> d;
-};
-
-class QmlDomPropertyPrivate;
-class Q_DECLARATIVE_EXPORT QmlDomProperty
-{
-public:
- QmlDomProperty();
- QmlDomProperty(const QmlDomProperty &);
- ~QmlDomProperty();
- QmlDomProperty &operator=(const QmlDomProperty &);
-
- bool isValid() const;
-
- QByteArray propertyName() const;
- QList<QByteArray> propertyNameParts() const;
-
- bool isDefaultProperty() const;
-
- QmlDomValue value() const;
-
- int position() const;
- int length() const;
-
-private:
- friend class QmlDomObject;
- friend class QmlDomDynamicProperty;
- QSharedDataPointer<QmlDomPropertyPrivate> d;
-};
-
-class QmlDomDynamicPropertyPrivate;
-class Q_DECLARATIVE_EXPORT QmlDomDynamicProperty
-{
-public:
- QmlDomDynamicProperty();
- QmlDomDynamicProperty(const QmlDomDynamicProperty &);
- ~QmlDomDynamicProperty();
- QmlDomDynamicProperty &operator=(const QmlDomDynamicProperty &);
-
- bool isValid() const;
-
- QByteArray propertyName() const;
- int propertyType() const;
- QByteArray propertyTypeName() const;
-
- bool isDefaultProperty() const;
- QmlDomProperty defaultValue() const;
-
- bool isAlias() const;
-
- int position() const;
- int length() const;
-
-private:
- friend class QmlDomObject;
- QSharedDataPointer<QmlDomDynamicPropertyPrivate> d;
-};
-
-class QmlDomObjectPrivate;
-class Q_DECLARATIVE_EXPORT QmlDomObject
-{
-public:
- QmlDomObject();
- QmlDomObject(const QmlDomObject &);
- ~QmlDomObject();
- QmlDomObject &operator=(const QmlDomObject &);
-
- bool isValid() const;
-
- QByteArray objectType() const;
- QByteArray objectClassName() const;
-
- int objectTypeMajorVersion() const;
- int objectTypeMinorVersion() const;
-
- QString objectId() const;
-
- QList<QmlDomProperty> properties() const;
- QmlDomProperty property(const QByteArray &) const;
-
- QList<QmlDomDynamicProperty> dynamicProperties() const;
- QmlDomDynamicProperty dynamicProperty(const QByteArray &) const;
-
- bool isCustomType() const;
- QByteArray customTypeData() const;
-
- bool isComponent() const;
- QmlDomComponent toComponent() const;
-
- int position() const;
- int length() const;
-
- QUrl url() const;
-private:
- friend class QmlDomDocument;
- friend class QmlDomComponent;
- friend class QmlDomValue;
- friend class QmlDomValueValueSource;
- friend class QmlDomValueValueInterceptor;
- QSharedDataPointer<QmlDomObjectPrivate> d;
-};
-
-class QmlDomValuePrivate;
-class QmlDomBasicValuePrivate;
-class Q_DECLARATIVE_EXPORT QmlDomValueLiteral
-{
-public:
- QmlDomValueLiteral();
- QmlDomValueLiteral(const QmlDomValueLiteral &);
- ~QmlDomValueLiteral();
- QmlDomValueLiteral &operator=(const QmlDomValueLiteral &);
-
- QString literal() const;
-
-private:
- friend class QmlDomValue;
- QSharedDataPointer<QmlDomBasicValuePrivate> d;
-};
-
-class Q_DECLARATIVE_EXPORT QmlDomValueBinding
-{
-public:
- QmlDomValueBinding();
- QmlDomValueBinding(const QmlDomValueBinding &);
- ~QmlDomValueBinding();
- QmlDomValueBinding &operator=(const QmlDomValueBinding &);
-
- QString binding() const;
-
-private:
- friend class QmlDomValue;
- QSharedDataPointer<QmlDomBasicValuePrivate> d;
-};
-
-class Q_DECLARATIVE_EXPORT QmlDomValueValueSource
-{
-public:
- QmlDomValueValueSource();
- QmlDomValueValueSource(const QmlDomValueValueSource &);
- ~QmlDomValueValueSource();
- QmlDomValueValueSource &operator=(const QmlDomValueValueSource &);
-
- QmlDomObject object() const;
-
-private:
- friend class QmlDomValue;
- QSharedDataPointer<QmlDomBasicValuePrivate> d;
-};
-
-class Q_DECLARATIVE_EXPORT QmlDomValueValueInterceptor
-{
-public:
- QmlDomValueValueInterceptor();
- QmlDomValueValueInterceptor(const QmlDomValueValueInterceptor &);
- ~QmlDomValueValueInterceptor();
- QmlDomValueValueInterceptor &operator=(const QmlDomValueValueInterceptor &);
-
- QmlDomObject object() const;
-
-private:
- friend class QmlDomValue;
- QSharedDataPointer<QmlDomBasicValuePrivate> d;
-};
-
-
-class Q_DECLARATIVE_EXPORT QmlDomComponent : public QmlDomObject
-{
-public:
- QmlDomComponent();
- QmlDomComponent(const QmlDomComponent &);
- ~QmlDomComponent();
- QmlDomComponent &operator=(const QmlDomComponent &);
-
- QmlDomObject componentRoot() const;
-};
-
-class Q_DECLARATIVE_EXPORT QmlDomValue
-{
-public:
- enum Type {
- Invalid,
- Literal,
- PropertyBinding,
- ValueSource,
- ValueInterceptor,
- Object,
- List
- };
-
- QmlDomValue();
- QmlDomValue(const QmlDomValue &);
- ~QmlDomValue();
- QmlDomValue &operator=(const QmlDomValue &);
-
- Type type() const;
-
- bool isInvalid() const;
- bool isLiteral() const;
- bool isBinding() const;
- bool isValueSource() const;
- bool isValueInterceptor() const;
- bool isObject() const;
- bool isList() const;
-
- QmlDomValueLiteral toLiteral() const;
- QmlDomValueBinding toBinding() const;
- QmlDomValueValueSource toValueSource() const;
- QmlDomValueValueInterceptor toValueInterceptor() const;
- QmlDomObject toObject() const;
- QmlDomList toList() const;
-
- int position() const;
- int length() const;
-
-private:
- friend class QmlDomProperty;
- friend class QmlDomList;
- QSharedDataPointer<QmlDomValuePrivate> d;
-};
-
-class Q_DECLARATIVE_EXPORT QmlDomList
-{
-public:
- QmlDomList();
- QmlDomList(const QmlDomList &);
- ~QmlDomList();
- QmlDomList &operator=(const QmlDomList &);
-
- QList<QmlDomValue> values() const;
-
- int position() const;
- int length() const;
-
- QList<int> commaPositions() const;
-
-private:
- friend class QmlDomValue;
- QSharedDataPointer<QmlDomValuePrivate> d;
-};
-
-class QmlDomImportPrivate;
-class Q_DECLARATIVE_EXPORT QmlDomImport
-{
-public:
- enum Type { Library, File };
-
- QmlDomImport();
- QmlDomImport(const QmlDomImport &);
- ~QmlDomImport();
- QmlDomImport &operator=(const QmlDomImport &);
-
- Type type() const;
- QString uri() const;
- QString version() const;
- QString qualifier() const;
-
-private:
- friend class QmlDomDocument;
- QSharedDataPointer<QmlDomImportPrivate> d;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMLDOM_H
diff --git a/src/declarative/qml/qmldom_p.h b/src/declarative/qml/qmldom_p.h
index df6a980..8c7288e 100644
--- a/src/declarative/qml/qmldom_p.h
+++ b/src/declarative/qml/qmldom_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -53,105 +53,308 @@
// We mean it.
//
-#include "qmlparser_p.h"
+#include "qmlerror.h"
-#include <QtCore/QtGlobal>
+#include <QtCore/qlist.h>
+#include <QtCore/qshareddata.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QmlDomDocumentPrivate : public QSharedData
+QT_MODULE(Declarative)
+
+class QString;
+class QByteArray;
+class QmlDomObject;
+class QmlDomList;
+class QmlDomValue;
+class QmlEngine;
+class QmlDomComponent;
+class QmlDomImport;
+class QIODevice;
+
+class QmlDomDocumentPrivate;
+
+class Q_DECLARATIVE_EXPORT QmlDomDocument
{
public:
- QmlDomDocumentPrivate();
- QmlDomDocumentPrivate(const QmlDomDocumentPrivate &o)
- : QSharedData(o) { qFatal("Not impl"); }
- ~QmlDomDocumentPrivate();
-
- QList<QmlError> errors;
- QList<QmlDomImport> imports;
- QmlParser::Object *root;
- QList<int> automaticSemicolonOffsets;
+ QmlDomDocument();
+ QmlDomDocument(const QmlDomDocument &);
+ ~QmlDomDocument();
+ QmlDomDocument &operator=(const QmlDomDocument &);
+
+ QList<QmlDomImport> imports() const;
+
+ QList<QmlError> errors() const;
+ bool load(QmlEngine *, const QByteArray &, const QUrl & = QUrl());
+
+ QmlDomObject rootObject() const;
+
+private:
+ QSharedDataPointer<QmlDomDocumentPrivate> d;
+};
+
+class QmlDomPropertyPrivate;
+class Q_DECLARATIVE_EXPORT QmlDomProperty
+{
+public:
+ QmlDomProperty();
+ QmlDomProperty(const QmlDomProperty &);
+ ~QmlDomProperty();
+ QmlDomProperty &operator=(const QmlDomProperty &);
+
+ bool isValid() const;
+
+ QByteArray propertyName() const;
+ QList<QByteArray> propertyNameParts() const;
+
+ bool isDefaultProperty() const;
+
+ QmlDomValue value() const;
+
+ int position() const;
+ int length() const;
+
+private:
+ friend class QmlDomObject;
+ friend class QmlDomDynamicProperty;
+ QSharedDataPointer<QmlDomPropertyPrivate> d;
};
-class QmlDomObjectPrivate : public QSharedData
+class QmlDomDynamicPropertyPrivate;
+class Q_DECLARATIVE_EXPORT QmlDomDynamicProperty
{
public:
- QmlDomObjectPrivate();
- QmlDomObjectPrivate(const QmlDomObjectPrivate &o)
- : QSharedData(o) { qFatal("Not impl"); }
- ~QmlDomObjectPrivate();
+ QmlDomDynamicProperty();
+ QmlDomDynamicProperty(const QmlDomDynamicProperty &);
+ ~QmlDomDynamicProperty();
+ QmlDomDynamicProperty &operator=(const QmlDomDynamicProperty &);
+
+ bool isValid() const;
+
+ QByteArray propertyName() const;
+ int propertyType() const;
+ QByteArray propertyTypeName() const;
+
+ bool isDefaultProperty() const;
+ QmlDomProperty defaultValue() const;
+
+ bool isAlias() const;
- typedef QList<QPair<QmlParser::Property *, QByteArray> > Properties;
- Properties properties() const;
- Properties properties(QmlParser::Property *) const;
+ int position() const;
+ int length() const;
- QmlParser::Object *object;
+private:
+ friend class QmlDomObject;
+ QSharedDataPointer<QmlDomDynamicPropertyPrivate> d;
};
-class QmlDomPropertyPrivate : public QSharedData
+class QmlDomObjectPrivate;
+class Q_DECLARATIVE_EXPORT QmlDomObject
{
public:
- QmlDomPropertyPrivate();
- QmlDomPropertyPrivate(const QmlDomPropertyPrivate &o)
- : QSharedData(o) { qFatal("Not impl"); }
- ~QmlDomPropertyPrivate();
+ QmlDomObject();
+ QmlDomObject(const QmlDomObject &);
+ ~QmlDomObject();
+ QmlDomObject &operator=(const QmlDomObject &);
+
+ bool isValid() const;
+
+ QByteArray objectType() const;
+ QByteArray objectClassName() const;
+
+ int objectTypeMajorVersion() const;
+ int objectTypeMinorVersion() const;
+
+ QString objectId() const;
- QByteArray propertyName;
- QmlParser::Property *property;
+ QList<QmlDomProperty> properties() const;
+ QmlDomProperty property(const QByteArray &) const;
+
+ QList<QmlDomDynamicProperty> dynamicProperties() const;
+ QmlDomDynamicProperty dynamicProperty(const QByteArray &) const;
+
+ bool isCustomType() const;
+ QByteArray customTypeData() const;
+
+ bool isComponent() const;
+ QmlDomComponent toComponent() const;
+
+ int position() const;
+ int length() const;
+
+ QUrl url() const;
+private:
+ friend class QmlDomDocument;
+ friend class QmlDomComponent;
+ friend class QmlDomValue;
+ friend class QmlDomValueValueSource;
+ friend class QmlDomValueValueInterceptor;
+ QSharedDataPointer<QmlDomObjectPrivate> d;
};
-class QmlDomDynamicPropertyPrivate : public QSharedData
+class QmlDomValuePrivate;
+class QmlDomBasicValuePrivate;
+class Q_DECLARATIVE_EXPORT QmlDomValueLiteral
{
public:
- QmlDomDynamicPropertyPrivate();
- QmlDomDynamicPropertyPrivate(const QmlDomDynamicPropertyPrivate &o)
- : QSharedData(o) { qFatal("Not impl"); }
- ~QmlDomDynamicPropertyPrivate();
+ QmlDomValueLiteral();
+ QmlDomValueLiteral(const QmlDomValueLiteral &);
+ ~QmlDomValueLiteral();
+ QmlDomValueLiteral &operator=(const QmlDomValueLiteral &);
+
+ QString literal() const;
- bool valid;
- QmlParser::Object::DynamicProperty property;
+private:
+ friend class QmlDomValue;
+ QSharedDataPointer<QmlDomBasicValuePrivate> d;
};
-class QmlDomValuePrivate : public QSharedData
+class Q_DECLARATIVE_EXPORT QmlDomValueBinding
{
public:
- QmlDomValuePrivate();
- QmlDomValuePrivate(const QmlDomValuePrivate &o)
- : QSharedData(o) { qFatal("Not impl"); }
- ~QmlDomValuePrivate();
+ QmlDomValueBinding();
+ QmlDomValueBinding(const QmlDomValueBinding &);
+ ~QmlDomValueBinding();
+ QmlDomValueBinding &operator=(const QmlDomValueBinding &);
- QmlParser::Property *property;
- QmlParser::Value *value;
+ QString binding() const;
+
+private:
+ friend class QmlDomValue;
+ QSharedDataPointer<QmlDomBasicValuePrivate> d;
};
-class QmlDomBasicValuePrivate : public QSharedData
+class Q_DECLARATIVE_EXPORT QmlDomValueValueSource
{
public:
- QmlDomBasicValuePrivate();
- QmlDomBasicValuePrivate(const QmlDomBasicValuePrivate &o)
- : QSharedData(o) { qFatal("Not impl"); }
- ~QmlDomBasicValuePrivate();
+ QmlDomValueValueSource();
+ QmlDomValueValueSource(const QmlDomValueValueSource &);
+ ~QmlDomValueValueSource();
+ QmlDomValueValueSource &operator=(const QmlDomValueValueSource &);
+
+ QmlDomObject object() const;
- QmlParser::Value *value;
+private:
+ friend class QmlDomValue;
+ QSharedDataPointer<QmlDomBasicValuePrivate> d;
};
-class QmlDomImportPrivate : public QSharedData
+class Q_DECLARATIVE_EXPORT QmlDomValueValueInterceptor
{
public:
- QmlDomImportPrivate();
- QmlDomImportPrivate(const QmlDomImportPrivate &o)
- : QSharedData(o) { qFatal("Not impl"); }
- ~QmlDomImportPrivate();
+ QmlDomValueValueInterceptor();
+ QmlDomValueValueInterceptor(const QmlDomValueValueInterceptor &);
+ ~QmlDomValueValueInterceptor();
+ QmlDomValueValueInterceptor &operator=(const QmlDomValueValueInterceptor &);
+ QmlDomObject object() const;
+
+private:
+ friend class QmlDomValue;
+ QSharedDataPointer<QmlDomBasicValuePrivate> d;
+};
+
+
+class Q_DECLARATIVE_EXPORT QmlDomComponent : public QmlDomObject
+{
+public:
+ QmlDomComponent();
+ QmlDomComponent(const QmlDomComponent &);
+ ~QmlDomComponent();
+ QmlDomComponent &operator=(const QmlDomComponent &);
+
+ QmlDomObject componentRoot() const;
+};
+
+class Q_DECLARATIVE_EXPORT QmlDomValue
+{
+public:
+ enum Type {
+ Invalid,
+ Literal,
+ PropertyBinding,
+ ValueSource,
+ ValueInterceptor,
+ Object,
+ List
+ };
+
+ QmlDomValue();
+ QmlDomValue(const QmlDomValue &);
+ ~QmlDomValue();
+ QmlDomValue &operator=(const QmlDomValue &);
+
+ Type type() const;
+
+ bool isInvalid() const;
+ bool isLiteral() const;
+ bool isBinding() const;
+ bool isValueSource() const;
+ bool isValueInterceptor() const;
+ bool isObject() const;
+ bool isList() const;
+
+ QmlDomValueLiteral toLiteral() const;
+ QmlDomValueBinding toBinding() const;
+ QmlDomValueValueSource toValueSource() const;
+ QmlDomValueValueInterceptor toValueInterceptor() const;
+ QmlDomObject toObject() const;
+ QmlDomList toList() const;
+
+ int position() const;
+ int length() const;
+
+private:
+ friend class QmlDomProperty;
+ friend class QmlDomList;
+ QSharedDataPointer<QmlDomValuePrivate> d;
+};
+
+class Q_DECLARATIVE_EXPORT QmlDomList
+{
+public:
+ QmlDomList();
+ QmlDomList(const QmlDomList &);
+ ~QmlDomList();
+ QmlDomList &operator=(const QmlDomList &);
+
+ QList<QmlDomValue> values() const;
+
+ int position() const;
+ int length() const;
+
+ QList<int> commaPositions() const;
+
+private:
+ friend class QmlDomValue;
+ QSharedDataPointer<QmlDomValuePrivate> d;
+};
+
+class QmlDomImportPrivate;
+class Q_DECLARATIVE_EXPORT QmlDomImport
+{
+public:
enum Type { Library, File };
- Type type;
- QString uri;
- QString version;
- QString qualifier;
+ QmlDomImport();
+ QmlDomImport(const QmlDomImport &);
+ ~QmlDomImport();
+ QmlDomImport &operator=(const QmlDomImport &);
+
+ Type type() const;
+ QString uri() const;
+ QString version() const;
+ QString qualifier() const;
+
+private:
+ friend class QmlDomDocument;
+ QSharedDataPointer<QmlDomImportPrivate> d;
};
QT_END_NAMESPACE
-#endif // QMLDOM_P_H
+QT_END_HEADER
+#endif // QMLDOM_P_H
diff --git a/src/declarative/qml/qmldom_p_p.h b/src/declarative/qml/qmldom_p_p.h
new file mode 100644
index 0000000..9d955b0
--- /dev/null
+++ b/src/declarative/qml/qmldom_p_p.h
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMLDOM_P_P_H
+#define QMLDOM_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qmlparser_p.h"
+
+#include <QtCore/QtGlobal>
+
+QT_BEGIN_NAMESPACE
+
+class QmlDomDocumentPrivate : public QSharedData
+{
+public:
+ QmlDomDocumentPrivate();
+ QmlDomDocumentPrivate(const QmlDomDocumentPrivate &o)
+ : QSharedData(o) { qFatal("Not impl"); }
+ ~QmlDomDocumentPrivate();
+
+ QList<QmlError> errors;
+ QList<QmlDomImport> imports;
+ QmlParser::Object *root;
+ QList<int> automaticSemicolonOffsets;
+};
+
+class QmlDomObjectPrivate : public QSharedData
+{
+public:
+ QmlDomObjectPrivate();
+ QmlDomObjectPrivate(const QmlDomObjectPrivate &o)
+ : QSharedData(o) { qFatal("Not impl"); }
+ ~QmlDomObjectPrivate();
+
+ typedef QList<QPair<QmlParser::Property *, QByteArray> > Properties;
+ Properties properties() const;
+ Properties properties(QmlParser::Property *) const;
+
+ QmlParser::Object *object;
+};
+
+class QmlDomPropertyPrivate : public QSharedData
+{
+public:
+ QmlDomPropertyPrivate();
+ QmlDomPropertyPrivate(const QmlDomPropertyPrivate &o)
+ : QSharedData(o) { qFatal("Not impl"); }
+ ~QmlDomPropertyPrivate();
+
+ QByteArray propertyName;
+ QmlParser::Property *property;
+};
+
+class QmlDomDynamicPropertyPrivate : public QSharedData
+{
+public:
+ QmlDomDynamicPropertyPrivate();
+ QmlDomDynamicPropertyPrivate(const QmlDomDynamicPropertyPrivate &o)
+ : QSharedData(o) { qFatal("Not impl"); }
+ ~QmlDomDynamicPropertyPrivate();
+
+ bool valid;
+ QmlParser::Object::DynamicProperty property;
+};
+
+class QmlDomValuePrivate : public QSharedData
+{
+public:
+ QmlDomValuePrivate();
+ QmlDomValuePrivate(const QmlDomValuePrivate &o)
+ : QSharedData(o) { qFatal("Not impl"); }
+ ~QmlDomValuePrivate();
+
+ QmlParser::Property *property;
+ QmlParser::Value *value;
+};
+
+class QmlDomBasicValuePrivate : public QSharedData
+{
+public:
+ QmlDomBasicValuePrivate();
+ QmlDomBasicValuePrivate(const QmlDomBasicValuePrivate &o)
+ : QSharedData(o) { qFatal("Not impl"); }
+ ~QmlDomBasicValuePrivate();
+
+ QmlParser::Value *value;
+};
+
+class QmlDomImportPrivate : public QSharedData
+{
+public:
+ QmlDomImportPrivate();
+ QmlDomImportPrivate(const QmlDomImportPrivate &o)
+ : QSharedData(o) { qFatal("Not impl"); }
+ ~QmlDomImportPrivate();
+
+ enum Type { Library, File };
+
+ Type type;
+ QString uri;
+ QString version;
+ QString qualifier;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMLDOM_P_P_H
+
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 7da24f4..97d8250 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -66,6 +66,7 @@
#include "qmlscriptclass_p.h"
#include "qmlnetworkaccessmanagerfactory.h"
#include "qmlimageprovider.h"
+#include "qmllist_p.h"
#include <qfxperf_p_p.h>
@@ -107,7 +108,6 @@
#endif
Q_DECLARE_METATYPE(QmlMetaProperty)
-Q_DECLARE_METATYPE(QList<QObject *>);
QT_BEGIN_NAMESPACE
@@ -393,6 +393,10 @@ QmlEngine::~QmlEngine()
QmlEngineDebugServer::remEngine(this);
}
+/*! \fn void QmlEngine::quit()
+ This signal is emitted when the QmlEngine quits.
+ */
+
/*!
Clears the engine's internal component cache.
@@ -1080,7 +1084,7 @@ QScriptValue QmlEnginePrivate::consoleLog(QScriptContext *ctxt, QScriptEngine *e
void QmlEnginePrivate::sendQuit ()
{
Q_Q(QmlEngine);
- emit q->quit ();
+ emit q->quit();
}
QScriptValue QmlEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptEngine *e)
@@ -1166,6 +1170,15 @@ QScriptValue QmlEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
QScriptValue QmlEnginePrivate::scriptValueFromVariant(const QVariant &val)
{
+ if (val.userType() == qMetaTypeId<QmlListReference>()) {
+ QmlListReferencePrivate *p = QmlListReferencePrivate::get((QmlListReference*)val.constData());
+ if (p->object) {
+ return listClass->newList(p->property, p->propertyType);
+ } else {
+ return scriptEngine.nullValue();
+ }
+ }
+
bool objOk;
QObject *obj = QmlMetaType::toQObject(val, &objOk);
if (objOk) {
@@ -1663,7 +1676,7 @@ void QmlEnginePrivate::registerCompositeType(QmlCompiledData *data)
QByteArray name = data->root->className();
QByteArray ptr = name + '*';
- QByteArray lst = "QmlList<" + ptr + ">*";
+ QByteArray lst = "QmlListProperty<" + name + ">";
int ptr_type = QMetaType::registerType(ptr.constData(), voidptr_destructor,
voidptr_constructor);
@@ -1675,9 +1688,18 @@ void QmlEnginePrivate::registerCompositeType(QmlCompiledData *data)
data->addref();
}
-bool QmlEnginePrivate::isQmlList(int t) const
+bool QmlEnginePrivate::isList(int t) const
{
- return m_qmlLists.contains(t) || QmlMetaType::isQmlList(t);
+ return m_qmlLists.contains(t) || QmlMetaType::isList(t);
+}
+
+int QmlEnginePrivate::listType(int t) const
+{
+ QHash<int, int>::ConstIterator iter = m_qmlLists.find(t);
+ if (iter != m_qmlLists.end())
+ return *iter;
+ else
+ return QmlMetaType::listType(t);
}
bool QmlEnginePrivate::isQObject(int t)
@@ -1696,21 +1718,12 @@ QObject *QmlEnginePrivate::toQObject(const QVariant &v, bool *ok) const
}
}
-int QmlEnginePrivate::qmlListType(int t) const
-{
- QHash<int, int>::ConstIterator iter = m_qmlLists.find(t);
- if (iter != m_qmlLists.end())
- return *iter;
- else
- return QmlMetaType::qmlListType(t);
-}
-
QmlMetaType::TypeCategory QmlEnginePrivate::typeCategory(int t) const
{
if (m_compositeTypes.contains(t))
return QmlMetaType::Object;
else if (m_qmlLists.contains(t))
- return QmlMetaType::QmlList;
+ return QmlMetaType::List;
else
return QmlMetaType::typeCategory(t);
}
diff --git a/src/declarative/qml/qmlengine.h b/src/declarative/qml/qmlengine.h
index a59a1ba..64d0b9d 100644
--- a/src/declarative/qml/qmlengine.h
+++ b/src/declarative/qml/qmlengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h
index 5586311..3fe7991 100644
--- a/src/declarative/qml/qmlengine_p.h
+++ b/src/declarative/qml/qmlengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -274,11 +274,12 @@ public:
void registerCompositeType(QmlCompiledData *);
- bool isQmlList(int) const;
+
bool isQObject(int);
QObject *toQObject(const QVariant &, bool *ok = 0) const;
- int qmlListType(int) const;
QmlMetaType::TypeCategory typeCategory(int) const;
+ bool isList(int) const;
+ int listType(int) const;
const QMetaObject *rawMetaObjectForType(int) const;
const QMetaObject *metaObjectForType(int) const;
QHash<int, int> m_qmlLists;
@@ -322,7 +323,6 @@ public:
QmlContext *getContext(QScriptContext *);
};
-
QT_END_NAMESPACE
#endif // QMLENGINE_P_H
diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp
index b0c1ec9..654157c 100644
--- a/src/declarative/qml/qmlenginedebug.cpp
+++ b/src/declarative/qml/qmlenginedebug.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -119,8 +119,7 @@ QmlEngineDebugServer::propertyData(QObject *obj, int propIdx)
rv.type = QmlObjectProperty::Basic;
} else if (QmlMetaType::isQObject(prop.userType())) {
rv.type = QmlObjectProperty::Object;
- } else if (QmlMetaType::isList(prop.userType()) ||
- QmlMetaType::isQmlList(prop.userType())) {
+ } else if (QmlMetaType::isList(prop.userType())) {
rv.type = QmlObjectProperty::List;
}
@@ -133,14 +132,15 @@ QVariant QmlEngineDebugServer::valueContents(const QVariant &value) const
if (QVariant::Type(userType) < QVariant::UserType)
return value;
-
- if (QmlMetaType::isList(userType) || QmlMetaType::isQmlList(userType)) {
+ /*
+ if (QmlMetaType::isList(userType)) {
int count = QmlMetaType::listCount(value);
QVariantList contents;
for (int i=0; i<count; i++)
contents << valueContents(QmlMetaType::listAt(value, i));
return contents;
- } else if (QmlMetaType::isQObject(userType)) {
+ } else */
+ if (QmlMetaType::isQObject(userType)) {
QObject *o = QmlMetaType::toQObject(value);
if (o) {
QString name = o->objectName();
diff --git a/src/declarative/qml/qmlenginedebug_p.h b/src/declarative/qml/qmlenginedebug_p.h
index 7c48b8b..a6f296a 100644
--- a/src/declarative/qml/qmlenginedebug_p.h
+++ b/src/declarative/qml/qmlenginedebug_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlerror.cpp b/src/declarative/qml/qmlerror.cpp
index d9ca20d..5ba7719 100644
--- a/src/declarative/qml/qmlerror.cpp
+++ b/src/declarative/qml/qmlerror.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlerror.h b/src/declarative/qml/qmlerror.h
index c54f932..8c4d785 100644
--- a/src/declarative/qml/qmlerror.h
+++ b/src/declarative/qml/qmlerror.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp
index 6f32ef4..8f0c945 100644
--- a/src/declarative/qml/qmlexpression.cpp
+++ b/src/declarative/qml/qmlexpression.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -52,8 +52,6 @@
#include <private/qscriptdeclarativeclass_p.h>
-Q_DECLARE_METATYPE(QList<QObject *>);
-
QT_BEGIN_NAMESPACE
bool QmlDelayedError::addError(QmlEnginePrivate *e)
diff --git a/src/declarative/qml/qmlexpression.h b/src/declarative/qml/qmlexpression.h
index 4df7641..428eefa 100644
--- a/src/declarative/qml/qmlexpression.h
+++ b/src/declarative/qml/qmlexpression.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlexpression_p.h b/src/declarative/qml/qmlexpression_p.h
index b19c60c..e52a199 100644
--- a/src/declarative/qml/qmlexpression_p.h
+++ b/src/declarative/qml/qmlexpression_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlglobal_p.h b/src/declarative/qml/qmlglobal_p.h
index dc282bc..06ae6e6 100644
--- a/src/declarative/qml/qmlglobal_p.h
+++ b/src/declarative/qml/qmlglobal_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlglobalscriptclass.cpp b/src/declarative/qml/qmlglobalscriptclass.cpp
index 13c1017..d2198b6 100644
--- a/src/declarative/qml/qmlglobalscriptclass.cpp
+++ b/src/declarative/qml/qmlglobalscriptclass.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlglobalscriptclass_p.h b/src/declarative/qml/qmlglobalscriptclass_p.h
index 56c91fe..d002da6 100644
--- a/src/declarative/qml/qmlglobalscriptclass_p.h
+++ b/src/declarative/qml/qmlglobalscriptclass_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlguard_p.h b/src/declarative/qml/qmlguard_p.h
index ad8dd84..0e90f79 100644
--- a/src/declarative/qml/qmlguard_p.h
+++ b/src/declarative/qml/qmlguard_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlimageprovider.cpp b/src/declarative/qml/qmlimageprovider.cpp
index ebb8656..7f15d08 100644
--- a/src/declarative/qml/qmlimageprovider.cpp
+++ b/src/declarative/qml/qmlimageprovider.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlimageprovider.h b/src/declarative/qml/qmlimageprovider.h
index 9804815..52fe066 100644
--- a/src/declarative/qml/qmlimageprovider.h
+++ b/src/declarative/qml/qmlimageprovider.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp
index dabf944..1f3d434 100644
--- a/src/declarative/qml/qmlinfo.cpp
+++ b/src/declarative/qml/qmlinfo.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlinfo.h b/src/declarative/qml/qmlinfo.h
index fd56118..379f211 100644
--- a/src/declarative/qml/qmlinfo.h
+++ b/src/declarative/qml/qmlinfo.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp
index d99bf65..e37ade7 100644
--- a/src/declarative/qml/qmlinstruction.cpp
+++ b/src/declarative/qml/qmlinstruction.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -171,9 +171,6 @@ void QmlCompiledData::dump(QmlInstruction *instr, int idx)
case QmlInstruction::BeginObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "BEGIN\t\t\t" << instr->begin.castValue;
break;
- case QmlInstruction::StoreObjectQmlList:
- qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT_QMLLIST";
- break;
case QmlInstruction::StoreObjectQList:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT_QLIST";
break;
@@ -183,9 +180,6 @@ void QmlCompiledData::dump(QmlInstruction *instr, int idx)
case QmlInstruction::FetchAttached:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_ATTACHED\t\t" << instr->fetchAttached.id;
break;
- case QmlInstruction::FetchQmlList:
- qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_QMLLIST\t\t" << instr->fetchQmlList.property << "\t" << instr->fetchQmlList.type;
- break;
case QmlInstruction::FetchQList:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_QLIST\t\t" << instr->fetch.property;
break;
diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h
index 0639397..ea785b6 100644
--- a/src/declarative/qml/qmlinstruction_p.h
+++ b/src/declarative/qml/qmlinstruction_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -134,12 +134,10 @@ public:
BeginObject, /* begin */
- StoreObjectQmlList, /* NA */
StoreObjectQList, /* NA */
AssignObjectList, /* NA */
FetchAttached, /* fetchAttached */
- FetchQmlList, /* fetchQmlList */
FetchQList, /* fetch */
FetchObject, /* fetch */
FetchValueType, /* fetchValue */
diff --git a/src/declarative/qml/qmlintegercache.cpp b/src/declarative/qml/qmlintegercache.cpp
index 1968873..2c2d494 100644
--- a/src/declarative/qml/qmlintegercache.cpp
+++ b/src/declarative/qml/qmlintegercache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlintegercache_p.h b/src/declarative/qml/qmlintegercache_p.h
index d9df52a..f38138f 100644
--- a/src/declarative/qml/qmlintegercache_p.h
+++ b/src/declarative/qml/qmlintegercache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmllist.cpp b/src/declarative/qml/qmllist.cpp
new file mode 100644
index 0000000..4cd2120
--- /dev/null
+++ b/src/declarative/qml/qmllist.cpp
@@ -0,0 +1,312 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmllist.h"
+#include "qmllist_p.h"
+#include "qmlengine_p.h"
+#include "qmlmetaproperty_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QmlListReferencePrivate::QmlListReferencePrivate()
+: propertyType(-1), refCount(1)
+{
+}
+
+QmlListReference QmlListReferencePrivate::init(const QmlListProperty<QObject> &prop, int propType, QmlEngine *engine)
+{
+ QmlListReference rv;
+
+ if (!prop.object) return rv;
+
+ QmlEnginePrivate *p = engine?QmlEnginePrivate::get(engine):0;
+
+ int listType = p?p->listType(propType):QmlMetaType::listType(propType);
+ if (listType == -1) return rv;
+
+ rv.d = new QmlListReferencePrivate;
+ rv.d->object = prop.object;
+ rv.d->elementType = p?p->rawMetaObjectForType(listType):QmlMetaType::qmlType(listType)->baseMetaObject();
+ rv.d->property = prop;
+ rv.d->propertyType = propType;
+
+ return rv;
+}
+
+void QmlListReferencePrivate::addref()
+{
+ Q_ASSERT(refCount > 0);
+ ++refCount;
+}
+
+void QmlListReferencePrivate::release()
+{
+ Q_ASSERT(refCount > 0);
+ --refCount;
+ if (!refCount)
+ delete this;
+}
+
+QmlListReference::QmlListReference()
+: d(0)
+{
+}
+
+QmlListReference::QmlListReference(QObject *o, const char *property, QmlEngine *engine)
+: d(0)
+{
+ if (!o || !property) return;
+
+ QmlPropertyCache::Data local;
+ QmlPropertyCache::Data *data = QmlPropertyCache::property(engine, o, QLatin1String(property), local);
+
+ if (!data || !(data->flags & QmlPropertyCache::Data::IsQList)) return;
+
+ QmlEnginePrivate *p = engine?QmlEnginePrivate::get(engine):0;
+
+ int listType = p?p->listType(data->propType):QmlMetaType::listType(data->propType);
+ if (listType == -1) return;
+
+ d = new QmlListReferencePrivate;
+ d->object = o;
+ d->elementType = p?p->rawMetaObjectForType(listType):QmlMetaType::qmlType(listType)->baseMetaObject();
+ d->propertyType = data->propType;
+
+ void *args[] = { &d->property, 0 };
+ QMetaObject::metacall(o, QMetaObject::ReadProperty, data->coreIndex, args);
+}
+
+QmlListReference::QmlListReference(const QmlListReference &o)
+: d(o.d)
+{
+ if (d) d->addref();
+}
+
+QmlListReference &QmlListReference::operator=(const QmlListReference &o)
+{
+ if (o.d) o.d->addref();
+ if (d) d->release();
+ d = o.d;
+ return *this;
+}
+
+QmlListReference::~QmlListReference()
+{
+ if (d) d->release();
+}
+
+bool QmlListReference::isValid() const
+{
+ return d && d->object;
+}
+
+QObject *QmlListReference::object() const
+{
+ if (isValid()) return d->object;
+ else return 0;
+}
+
+const QMetaObject *QmlListReference::listElementType() const
+{
+ if (isValid()) return d->elementType;
+ else return 0;
+}
+
+bool QmlListReference::canAppend() const
+{
+ return (isValid() && d->property.append);
+}
+
+bool QmlListReference::canAt() const
+{
+ return (isValid() && d->property.at);
+}
+
+bool QmlListReference::canClear() const
+{
+ return (isValid() && d->property.clear);
+}
+
+bool QmlListReference::canCount() const
+{
+ return (isValid() && d->property.count);
+}
+
+bool QmlListReference::append(QObject *o) const
+{
+ if (!canAppend()) return false;
+
+ if (o && !QmlMetaPropertyPrivate::canConvert(o->metaObject(), d->elementType))
+ return false;
+
+ d->property.append(&d->property, o);
+
+ return true;
+}
+
+QObject *QmlListReference::at(int index) const
+{
+ if (!canAt()) return 0;
+
+ return d->property.at(&d->property, index);
+}
+
+bool QmlListReference::clear() const
+{
+ if (!canClear()) return false;
+
+ d->property.clear(&d->property);
+
+ return true;
+}
+
+int QmlListReference::count() const
+{
+ if (!canCount()) return 0;
+
+ return d->property.count(&d->property);
+}
+
+/*!
+\class QmlListProperty
+\brief The QmlListProperty class allows applications to explose list-like
+properties to QML.
+
+QML has many list properties, where more than one object value can be assigned.
+The use of a list property from QML looks like this:
+
+\code
+FruitBasket {
+ fruit: [
+ Apple {},
+ Orange{},
+ Banana {}
+ ]
+}
+\endcode
+
+The QmlListProperty encapsulates a group of function pointers that represet the
+set of actions QML can perform on the list - adding items, retrieving items and
+clearing the list. In the future, additional operations may be supported. All
+list properties must implement the append operation, but the rest are optional.
+
+To provide a list property, a C++ class must implement the operation callbacks,
+and then return an appropriate QmlListProperty value from the property getter.
+List properties should have no setter. In the example above, the Q_PROPERTY()
+declarative will look like this:
+
+\code
+Q_PROPERTY(QmlListProperty<Fruit> fruit READ fruit);
+\endcode
+
+QML list properties are typesafe - in this case \c {Fruit} is a QObject type that
+\c {Apple}, \c {Orange} and \c {Banana} all derive from.
+*/
+
+/*!
+\fn QmlListProperty::QmlListProperty()
+\internal
+*/
+
+/*!
+\fn QmlListProperty::QmlListProperty(QObject *object, QList<T *> &list)
+
+Convenience constructor for making a QmlListProperty value from an existing
+QList \a list. The \a list reference must remain valid for as long as \a object
+exists. \a object must be provided.
+
+Generally this constructor should not be used in production code, as a
+writable QList violates QML's memory management rules. However, this constructor
+can very useful while prototyping.
+*/
+
+/*!
+\fn QmlListProperty::QmlListProperty(QObject *object, void *data, AppendFunction append,
+ CountFunction count = 0, AtFunction at = 0,
+ ClearFunction clear = 0)
+
+Construct a QmlListProperty from a set of operation functions. An opaque \a data handle
+may be passed which can be accessed from within the operation functions. The list property
+remains valid while \a object exists.
+
+The \a append operation is compulsory and must be provided, while the \a count, \a at and
+\a clear methods are optional.
+*/
+
+/*!
+\typedef QmlListProperty::AppendFunction
+
+Synonym for \c {void (*)(QmlListProperty<T> *property, T *value)}.
+
+Append the \a value to the list \a property.
+*/
+
+/*!
+\typedef QmlListProperty::CountFunction
+
+Synonym for \c {int (*)(QmlListProperty<T> *property)}.
+
+Return the number of elements in the list \a property.
+*/
+
+/*!
+\fn bool QmlListProperty::operator==(const QmlListProperty &other) const
+
+Returns true if this QmlListProperty is equal to \a other, otherwise false.
+*/
+
+/*!
+\typedef QmlListProperty::AtFunction
+
+Synonym for \c {T *(*)(QmlListProperty<T> *property, int index)}.
+
+Return the element at position \a index in the list \a property.
+*/
+
+/*!
+\typedef QmlListProperty::ClearFunction
+
+Synonym for \c {void (*)(QmlListProperty<T> *property)}.
+
+Clear the list \a property.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmllist.h b/src/declarative/qml/qmllist.h
index b1a81c4..cedc35b 100644
--- a/src/declarative/qml/qmllist.h
+++ b/src/declarative/qml/qmllist.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -51,106 +51,30 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
template<typename T>
-class QmlList : private QmlPrivate::ListInterface
-{
-public:
- virtual void append(T) = 0;
- virtual void insert(int, T) = 0;
- virtual void removeAt(int) = 0;
- virtual T at(int) const = 0;
- virtual int count() const = 0;
- virtual void clear() = 0;
- QmlList<T> &operator<<(T t) { append(t); return *this; }
-
-protected:
- virtual int type() const { return qMetaTypeId<T>(); }
- virtual void append(void *d) { const T &v = *(T *)d; append(v); }
- virtual void insert(int i, void *d) { const T &v = *(T *)d; insert(i, v); }
- virtual void at(int i, void *p) const { const T &v = at(i); *((T*)p) = v; }
-};
-
-template<typename T>
-class QmlConcreteList : public QList<T>, public QmlList<T>
-{
-public:
- virtual void append(T v) { QList<T>::append(v); }
- virtual void insert(int i, T v) { QList<T>::insert(i, v); }
- virtual void clear() { QList<T>::clear(); }
- virtual T at(int i) const { return QList<T>::at(i); }
- virtual void removeAt(int i) { QList<T>::removeAt(i); }
- virtual int count() const { return QList<T>::count(); }
-};
-
-#define QML_DECLARE_LIST_PROXY(ClassName, ListType, ListName) \
-class Qml_ProxyList_ ##ListName : public QmlList<ListType> \
-{ \
- public: \
- virtual void removeAt(int idx) \
- { \
- ClassName *p = (ClassName *)((char *)this + ((char *)(ClassName *)(0x10000000) - (char *)&((ClassName *)(0x10000000))->ListName)); \
- p->ListName ## _removeAt(idx); \
- } \
- virtual int count() const \
- { \
- ClassName *p = (ClassName *)((char *)this + ((char *)(ClassName *)(0x10000000) - (char *)&((ClassName *)(0x10000000))->ListName)); \
- return p->ListName ## _count(); \
- } \
- virtual void append(ListType v) \
- { \
- ClassName *p = (ClassName *)((char *)this + ((char *)(ClassName *)(0x10000000) - (char *)&((ClassName *)(0x10000000))->ListName)); \
- p->ListName ## _append(v); \
- } \
- virtual void insert(int idx, ListType v) \
- { \
- ClassName *p = (ClassName *)((char *)this + ((char *)(ClassName *)(0x10000000) - (char *)&((ClassName *)(0x10000000))->ListName)); \
- p->ListName ## _insert(idx, v); \
- } \
- virtual ListType at(int idx) const \
- { \
- ClassName *p = (ClassName *)((char *)this + ((char *)(ClassName *)(0x10000000) - (char *)&((ClassName *)(0x10000000))->ListName)); \
- return p->ListName ## _at(idx); \
- } \
- virtual void clear() \
- { \
- ClassName *p = (ClassName *)((char *)this + ((char *)(ClassName *)(0x10000000) - (char *)&((ClassName *)(0x10000000))->ListName)); \
- p->ListName ## _clear(); \
- } \
-}; \
-friend class Qml_ProxyList_ ##ListName ; \
-Qml_ProxyList_##ListName ListName;
-
-template<typename T>
struct QmlListProperty {
typedef void (*AppendFunction)(QmlListProperty<T> *, T*);
typedef int (*CountFunction)(QmlListProperty<T> *);
typedef T *(*AtFunction)(QmlListProperty<T> *, int);
typedef void (*ClearFunction)(QmlListProperty<T> *);
- typedef void (*InsertFunction)(QmlListProperty<T> *, int, T *);
- typedef void (*RemoveAtFunction)(QmlListProperty<T> *, int);
QmlListProperty()
- : version(1), object(0), data(0), append(0), count(0), at(0), clear(0), insert(0), removeAt(0) {}
+ : object(0), data(0), append(0), count(0), at(0), clear(0), dummy1(0), dummy2(0) {}
QmlListProperty(QObject *o, QList<T *> &list)
- : version(1), object(o), data(&list), append(qlist_append), count(qlist_count), at(qlist_at),
- clear(qlist_clear), insert(qlist_insert), removeAt(qlist_removeAt) {}
+ : object(o), data(&list), append(qlist_append), count(qlist_count), at(qlist_at),
+ clear(qlist_clear), dummy1(0), dummy2(0) {}
QmlListProperty(QObject *o, void *d, AppendFunction a, CountFunction c = 0, AtFunction t = 0,
- ClearFunction l = 0, InsertFunction i = 0, RemoveAtFunction r = 0)
- : version(1), object(o), data(d), append(a), count(c), at(t), clear(l), insert(i), removeAt(r) {}
+ ClearFunction r = 0)
+ : object(o), data(d), append(a), count(c), at(t), clear(r), dummy1(0), dummy2(0) {}
bool operator==(const QmlListProperty &o) const {
- return version == o.version &&
- object == o.object &&
+ return object == o.object &&
data == o.data &&
append == o.append &&
count == o.count &&
at == o.at &&
- clear == o.clear &&
- insert == o.insert &&
- removeAt == o.removeAt;
+ clear == o.clear;
}
- int version;
-
QObject *object;
void *data;
@@ -161,8 +85,8 @@ struct QmlListProperty {
ClearFunction clear;
- InsertFunction insert;
- RemoveAtFunction removeAt;
+ void *dummy1;
+ void *dummy2;
private:
static void qlist_append(QmlListProperty *p, T *v) {
@@ -177,14 +101,40 @@ private:
static void qlist_clear(QmlListProperty *p) {
return ((QList<T *> *)p->data)->clear();
}
- static void qlist_insert(QmlListProperty *p, int idx, T *v) {
- return ((QList<T *> *)p->data)->insert(idx, v);
- }
- static void qlist_removeAt(QmlListProperty *p, int idx) {
- return ((QList<T *> *)p->data)->removeAt(idx);
- }
};
+class QmlEngine;
+class QmlListReferencePrivate;
+class Q_DECLARATIVE_EXPORT QmlListReference
+{
+public:
+ QmlListReference();
+ QmlListReference(QObject *, const char *property, QmlEngine * = 0);
+ QmlListReference(const QmlListReference &);
+ QmlListReference &operator=(const QmlListReference &);
+ ~QmlListReference();
+
+ bool isValid() const;
+
+ QObject *object() const;
+ const QMetaObject *listElementType() const;
+
+ bool canAppend() const;
+ bool canAt() const;
+ bool canClear() const;
+ bool canCount() const;
+
+ bool append(QObject *) const;
+ QObject *at(int) const;
+ bool clear() const;
+ int count() const;
+
+private:
+ friend class QmlListReferencePrivate;
+ QmlListReferencePrivate* d;
+};
+Q_DECLARE_METATYPE(QmlListReference);
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/declarative/qml/qmllist_p.h b/src/declarative/qml/qmllist_p.h
new file mode 100644
index 0000000..4660e47
--- /dev/null
+++ b/src/declarative/qml/qmllist_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMLLIST_P_H
+#define QMLLIST_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qmllist.h"
+#include "qmlguard_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QmlListReferencePrivate
+{
+public:
+ QmlListReferencePrivate();
+
+ static QmlListReference init(const QmlListProperty<QObject> &, int, QmlEngine *);
+
+ QmlGuard<QObject> object;
+ const QMetaObject *elementType;
+ QmlListProperty<QObject> property;
+ int propertyType;
+
+ void addref();
+ void release();
+ int refCount;
+
+ static inline QmlListReferencePrivate *get(QmlListReference *ref) {
+ return ref->d;
+ }
+};
+
+
+QT_END_NAMESPACE
+
+#endif // QMLLIST_P_H
diff --git a/src/declarative/qml/qmllistscriptclass.cpp b/src/declarative/qml/qmllistscriptclass.cpp
index caa4e4e..bb29763 100644
--- a/src/declarative/qml/qmllistscriptclass.cpp
+++ b/src/declarative/qml/qmllistscriptclass.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -43,13 +43,13 @@
#include "qmlengine_p.h"
#include "qmlguard_p.h"
+#include "qmllist_p.h"
QT_BEGIN_NAMESPACE
struct ListData : public QScriptDeclarativeClass::Object {
QmlGuard<QObject> object;
- int propertyIdx;
- QmlListScriptClass::ListCategory type;
+ QmlListProperty<QObject> property;
int propertyType;
};
@@ -66,7 +66,7 @@ QmlListScriptClass::~QmlListScriptClass()
{
}
-QScriptValue QmlListScriptClass::newList(QObject *object, int propId, ListCategory type, int propType)
+QScriptValue QmlListScriptClass::newList(QObject *object, int propId, int propType)
{
QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
@@ -75,8 +75,20 @@ QScriptValue QmlListScriptClass::newList(QObject *object, int propId, ListCatego
ListData *data = new ListData;
data->object = object;
- data->propertyIdx = propId;
- data->type = type;
+ data->propertyType = propType;
+ void *args[] = { &data->property, 0 };
+ QMetaObject::metacall(object, QMetaObject::ReadProperty, propId, args);
+
+ return newObject(scriptEngine, this, data);
+}
+
+QScriptValue QmlListScriptClass::newList(const QmlListProperty<QObject> &prop, int propType)
+{
+ QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+
+ ListData *data = new ListData;
+ data->object = prop.object;
+ data->property = prop;
data->propertyType = propType;
return newObject(scriptEngine, this, data);
@@ -111,43 +123,14 @@ QmlListScriptClass::ScriptValue QmlListScriptClass::property(Object *obj, const
if (!data->object)
return Value();
- if (data->type == ListProperty) {
- QmlListProperty<QObject> list;
- void *args[] = { &list, 0 };
-
- QMetaObject::metacall(data->object, QMetaObject::ReadProperty,
- data->propertyIdx, args);
-
- quint32 count = list.count(&list);
-
- if (name == m_lengthId.identifier)
- return Value(scriptEngine, count);
- else if (lastIndex < count)
- return Value(scriptEngine, enginePriv->objectClass->newQObject(list.at(&list, lastIndex)));
- else
- return Value();
-
- } else {
- void *list = 0;
- void *args[] = { &list, 0 };
- QMetaObject::metacall(data->object, QMetaObject::ReadProperty,
- data->propertyIdx, args);
-
- if (!list)
- return Value();
-
- Q_ASSERT(data->type == QmlListPtr);
- const QmlList<QObject *> &qmllist = *((QmlList<QObject *>*)list);
-
- quint32 count = qmllist.count();
+ quint32 count = data->property.count?data->property.count(&data->property):0;
- if (name == m_lengthId.identifier)
- return Value(scriptEngine, count);
- else if (lastIndex < count)
- return Value(scriptEngine, enginePriv->objectClass->newQObject(qmllist.at(lastIndex)));
- else
- return Value();
- }
+ if (name == m_lengthId.identifier)
+ return Value(scriptEngine, count);
+ else if (lastIndex < count && data->property.at)
+ return Value(scriptEngine, enginePriv->objectClass->newQObject(data->property.at(&data->property, lastIndex)));
+ else
+ return Value();
}
QVariant QmlListScriptClass::toVariant(Object *obj, bool *ok)
@@ -159,29 +142,7 @@ QVariant QmlListScriptClass::toVariant(Object *obj, bool *ok)
return QVariant();
}
- if (data->type == QmlListScriptClass::QmlListPtr) {
- void *list = 0;
- void *args[] = { &list, 0 };
- QMetaObject::metacall(data->object, QMetaObject::ReadProperty,
- data->propertyIdx, args);
-
- if (!list) {
- if (ok) *ok = false;
- return QVariant();
- }
-
- if (ok) *ok = true;
- return QVariant(data->propertyType, &list);
- } else {
- QmlListProperty<QObject> list;
- void *args[] = { &list, 0 };
-
- QMetaObject::metacall(data->object, QMetaObject::ReadProperty,
- data->propertyIdx, args);
-
- if (ok) *ok = true;
- return QVariant(data->propertyType, &list);
- }
+ return QVariant::fromValue(QmlListReferencePrivate::init(data->property, data->propertyType, engine));
}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmllistscriptclass_p.h b/src/declarative/qml/qmllistscriptclass_p.h
index 464f91e..07b09c3 100644
--- a/src/declarative/qml/qmllistscriptclass_p.h
+++ b/src/declarative/qml/qmllistscriptclass_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -54,6 +54,7 @@
//
#include <private/qmlscriptclass_p.h>
+#include "qmllist.h"
QT_BEGIN_NAMESPACE
@@ -64,8 +65,8 @@ public:
QmlListScriptClass(QmlEngine *);
~QmlListScriptClass();
- enum ListCategory { ListProperty, QmlListPtr };
- QScriptValue newList(QObject *, int, ListCategory, int);
+ QScriptValue newList(QObject *, int, int);
+ QScriptValue newList(const QmlListProperty<QObject> &, int);
protected:
virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &,
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index fc11bd6..1742c43 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -52,16 +52,13 @@
#include "qmlengine_p.h"
#include "qmldeclarativedata_p.h"
#include "qmlstringconverters_p.h"
-
-#include <qfxperf_p_p.h>
+#include "qmllist_p.h"
#include <QStringList>
#include <QtCore/qdebug.h>
#include <math.h>
-Q_DECLARE_METATYPE(QList<QObject *>);
-
QT_BEGIN_NAMESPACE
/*!
@@ -213,7 +210,6 @@ QmlMetaProperty::QmlMetaProperty(const QmlMetaProperty &other)
\value InvalidProperty The property is invalid.
\value Bindable The property is a QmlBinding.
\value List The property is a QList pointer
- \value QmlList The property is a QmlList pointer
\value Object The property is a QObject derived type pointer
\value Normal The property is none of the above.
*/
@@ -257,8 +253,6 @@ QmlMetaPropertyPrivate::propertyCategory() const
return QmlMetaProperty::Bindable;
else if (core.flags & QmlPropertyCache::Data::IsQObjectDerived)
return QmlMetaProperty::Object;
- else if (core.flags & QmlPropertyCache::Data::IsQmlList)
- return QmlMetaProperty::QmlList;
else if (core.flags & QmlPropertyCache::Data::IsQList)
return QmlMetaProperty::List;
else
@@ -384,7 +378,9 @@ QmlMetaProperty &QmlMetaProperty::operator=(const QmlMetaProperty &other)
d->object = other.d->object;
d->isDefaultProperty = other.d->isDefaultProperty;
+ d->isNameCached = other.d->isNameCached;
d->core = other.d->core;
+ d->nameCache = other.d->nameCache;
d->valueType = other.d->valueType;
@@ -401,7 +397,7 @@ bool QmlMetaProperty::isWritable() const
if (!d->object)
return false;
- if (category == List || category == QmlList)
+ if (category == List)
return true;
else if (type() & SignalProperty)
return false;
@@ -703,6 +699,13 @@ QVariant QmlMetaPropertyPrivate::readValueProperty()
if (!ep) delete valueType;
return rv;
+ } else if(core.flags & QmlPropertyCache::Data::IsQList) {
+
+ QmlListProperty<QObject> prop;
+ void *args[] = { &prop, 0 };
+ QMetaObject::metacall(object, QMetaObject::ReadProperty, core.coreIndex, args);
+ return QVariant::fromValue(QmlListReferencePrivate::init(prop, core.propType, context?context->engine():0));
+
} else {
return object->metaObject()->property(core.coreIndex).read(object.data());
@@ -810,24 +813,22 @@ bool QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data
return writeEnumProperty(prop, coreIdx, object, v, flags);
}
- int t = property.propType;
- int vt = value.userType();
+ int propertyType = property.propType;
+ int variantType = value.userType();
- QmlEnginePrivate *enginePriv = 0;
- if (context && context->engine())
- enginePriv = QmlEnginePrivate::get(context->engine());
+ QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(context);
- if (t == QVariant::Url) {
+ if (propertyType == QVariant::Url) {
QUrl u;
bool found = false;
- if (vt == QVariant::Url) {
+ if (variantType == QVariant::Url) {
u = value.toUrl();
found = true;
- } else if (vt == QVariant::ByteArray) {
+ } else if (variantType == QVariant::ByteArray) {
u = QUrl(QString::fromUtf8(value.toByteArray()));
found = true;
- } else if (vt == QVariant::String) {
+ } else if (variantType == QVariant::String) {
u = QUrl(value.toString());
found = true;
}
@@ -841,12 +842,12 @@ bool QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data
void *argv[] = { &u, 0, &status, &flags };
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, argv);
- } else if (vt == t) {
+ } else if (variantType == propertyType) {
void *a[] = { (void *)value.constData(), 0, &status, &flags };
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
- } else if (qMetaTypeId<QVariant>() == t) {
+ } else if (qMetaTypeId<QVariant>() == propertyType) {
void *a[] = { (void *)&value, 0, &status, &flags };
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
@@ -859,7 +860,7 @@ bool QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data
return false;
QObject *o = *(QObject **)value.constData();
- const QMetaObject *propMo = rawMetaObjectForType(enginePriv, t);
+ const QMetaObject *propMo = rawMetaObjectForType(enginePriv, propertyType);
if (o) valMo = o->metaObject();
@@ -880,76 +881,60 @@ bool QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data
} else if (property.flags & QmlPropertyCache::Data::IsQList) {
- int listType = QmlMetaType::listType(t);
- QMetaProperty prop = object->metaObject()->property(property.coreIndex);
+ const QMetaObject *listType = 0;
+ if (enginePriv) {
+ listType = enginePriv->rawMetaObjectForType(enginePriv->listType(property.propType));
+ } else {
+ QmlType *type = QmlMetaType::qmlType(QmlMetaType::listType(property.propType));
+ if (!type) return false;
+ listType = type->baseMetaObject();
+ }
+ if (!listType) return false;
+
+ QmlListProperty<void> prop;
+ void *args[] = { &prop, 0 };
+ QMetaObject::metacall(object, QMetaObject::ReadProperty, coreIdx, args);
+
+ if (!prop.clear) return false;
+
+ prop.clear(&prop);
if (value.userType() == qMetaTypeId<QList<QObject *> >()) {
- const QList<QObject *> &list =
- qvariant_cast<QList<QObject *> >(value);
- QVariant listVar = prop.read(object);
- QmlMetaType::clear(listVar);
+ const QList<QObject *> &list = qvariant_cast<QList<QObject *> >(value);
+
for (int ii = 0; ii < list.count(); ++ii) {
QObject *o = list.at(ii);
- QVariant v = QVariant(listType, &o);
- QmlMetaType::append(listVar, v);
+ if (!canConvert(o->metaObject(), listType))
+ o = 0;
+ prop.append(&prop, (void *)o);
}
-
- } else if (vt == listType ||
- value.userType() == listType) {
- QVariant listVar = prop.read(object);
- QmlMetaType::append(listVar, value);
+ } else {
+ QObject *o = enginePriv?enginePriv->toQObject(value):QmlMetaType::toQObject(value);
+ if (!canConvert(o->metaObject(), listType))
+ o = 0;
+ prop.append(&prop, (void *)o);
}
- } else if (property.flags & QmlPropertyCache::Data::IsQmlList) {
-
- // XXX - optimize!
- QMetaProperty prop = object->metaObject()->property(property.coreIndex);
- QVariant list = prop.read(object);
- QmlPrivate::ListInterface *li =
- *(QmlPrivate::ListInterface **)list.constData();
-
- int type = li->type();
-
- if (QObject *obj = QmlMetaType::toQObject(value)) {
- const QMetaObject *mo = rawMetaObjectForType(enginePriv, type);
-
- const QMetaObject *objMo = obj->metaObject();
- bool found = false;
- while(!found && objMo) {
- if (equal(objMo, mo))
- found = true;
- else
- objMo = objMo->superClass();
- }
-
- if (!found)
- return false;
-
- // NOTE: This assumes a cast to QObject does not alter
- // the object pointer
- void *d = (void *)&obj;
- li->append(d);
- }
} else {
- Q_ASSERT(vt != t);
+ Q_ASSERT(variantType != propertyType);
QVariant v = value;
- if (v.convert((QVariant::Type)t)) {
+ if (v.convert((QVariant::Type)propertyType)) {
void *a[] = { (void *)v.constData(), 0, &status, &flags};
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
- } else if ((uint)t >= QVariant::UserType && vt == QVariant::String) {
- QmlMetaType::StringConverter con = QmlMetaType::customStringConverter(t);
+ } else if ((uint)propertyType >= QVariant::UserType && variantType == QVariant::String) {
+ QmlMetaType::StringConverter con = QmlMetaType::customStringConverter(propertyType);
if (!con)
return false;
QVariant v = con(value.toString());
- if (v.userType() == t) {
+ if (v.userType() == propertyType) {
void *a[] = { (void *)v.constData(), 0, &status, &flags};
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
}
- } else if (vt == QVariant::String) {
+ } else if (variantType == QVariant::String) {
bool ok = false;
- QVariant v = QmlStringConverters::variantFromString(value.toString(), t, &ok);
+ QVariant v = QmlStringConverters::variantFromString(value.toString(), propertyType, &ok);
if (!ok)
return false;
diff --git a/src/declarative/qml/qmlmetaproperty.h b/src/declarative/qml/qmlmetaproperty.h
index 240f5a2..82266c8 100644
--- a/src/declarative/qml/qmlmetaproperty.h
+++ b/src/declarative/qml/qmlmetaproperty.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -68,7 +68,6 @@ public:
InvalidProperty,
Bindable,
List,
- QmlList, //XXX
Object,
Normal
};
diff --git a/src/declarative/qml/qmlmetaproperty_p.h b/src/declarative/qml/qmlmetaproperty_p.h
index 90b443e..b99e5be 100644
--- a/src/declarative/qml/qmlmetaproperty_p.h
+++ b/src/declarative/qml/qmlmetaproperty_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp
index e613b7c..6db70d4 100644
--- a/src/declarative/qml/qmlmetatype.cpp
+++ b/src/declarative/qml/qmlmetatype.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -100,7 +100,6 @@ struct QmlMetaTypeData
QBitArray objects;
QBitArray interfaces;
- QBitArray qmllists;
QBitArray lists;
};
Q_GLOBAL_STATIC(QmlMetaTypeData, metaTypeData)
@@ -124,7 +123,7 @@ public:
QByteArray m_name;
int m_version_maj;
int m_version_min;
- int m_typeId; int m_listId; int m_qmlListId;
+ int m_typeId; int m_listId;
QObject *(*m_newFunc)();
const QMetaObject *m_baseMetaObject;
QmlAttachedPropertiesFunc m_attachedPropertiesFunc;
@@ -141,7 +140,7 @@ public:
};
QmlTypePrivate::QmlTypePrivate()
-: m_isInterface(false), m_iid(0), m_typeId(0), m_listId(0), m_qmlListId(0),
+: m_isInterface(false), m_iid(0), m_typeId(0), m_listId(0),
m_newFunc(0), m_baseMetaObject(0), m_attachedPropertiesFunc(0), m_attachedPropertiesType(0),
m_parserStatusCast(-1), m_propertyValueSourceCast(-1), m_propertyValueInterceptorCast(-1),
m_extFunc(0), m_extMetaObject(0), m_index(-1), m_customParser(0), m_isSetup(false)
@@ -149,14 +148,13 @@ QmlTypePrivate::QmlTypePrivate()
}
-QmlType::QmlType(int type, int listType, int qmlListType, const char *iid, int index)
+QmlType::QmlType(int type, int listType, const char *iid, int index)
: d(new QmlTypePrivate)
{
d->m_isInterface = true;
d->m_iid = iid;
d->m_typeId = type;
d->m_listId = listType;
- d->m_qmlListId = qmlListType;
d->m_newFunc = 0;
d->m_index = index;
d->m_isSetup = true;
@@ -164,7 +162,7 @@ QmlType::QmlType(int type, int listType, int qmlListType, const char *iid, int i
d->m_version_min = 0;
}
-QmlType::QmlType(int type, int listType, int qmlListType,
+QmlType::QmlType(int type, int listType,
QObject *(*newFunc)(), const char *qmlName,
int version_maj, int version_min,
const QMetaObject *metaObject,
@@ -181,7 +179,6 @@ QmlType::QmlType(int type, int listType, int qmlListType,
d->m_version_min = version_min;
d->m_typeId = type;
d->m_listId = listType;
- d->m_qmlListId = qmlListType;
d->m_newFunc = newFunc;
d->m_baseMetaObject = metaObject;
d->m_attachedPropertiesFunc = attachedPropertiesFunc;
@@ -309,45 +306,6 @@ int QmlType::qListTypeId() const
return d->m_listId;
}
-int QmlType::qmlListTypeId() const
-{
- return d->m_qmlListId;
-}
-
-void QmlType::listClear(const QVariant &list)
-{
- Q_ASSERT(list.userType() == qListTypeId());
- QmlListProperty<void> *l = (QmlListProperty<void> *)list.data();
- if (l->clear) l->clear(l);
-}
-
-void QmlType::listAppend(const QVariant &list, const QVariant &item)
-{
- Q_ASSERT(list.userType() == qListTypeId());
- QmlListProperty<void> *l = (QmlListProperty<void> *)list.data();
- if (l->append) l->append(l, *(void **)item.data());
-}
-
-QVariant QmlType::listAt(const QVariant &list, int idx)
-{
- Q_ASSERT(list.userType() == qListTypeId());
- QmlListProperty<void> *l = (QmlListProperty<void> *)list.data();
- if (l->at) {
- void *v = l->at(l, idx);
- return QVariant(typeId(), &v);
- } else {
- return QVariant();
- }
-}
-
-int QmlType::listCount(const QVariant &list)
-{
- Q_ASSERT(list.userType() == qListTypeId());
- QmlListProperty<void> *l = (QmlListProperty<void> *)list.data();
- if (l->count) return l->count(l);
- return 0;
-}
-
const QMetaObject *QmlType::metaObject() const
{
d->init();
@@ -407,25 +365,20 @@ int QmlMetaType::registerInterface(const QmlPrivate::MetaTypeIds &id,
int index = data->types.count();
- QmlType *type = new QmlType(id.typeId, id.listId, id.qmlListId,
- iid, index);
+ QmlType *type = new QmlType(id.typeId, id.listId, iid, index);
data->types.append(type);
data->idToType.insert(type->typeId(), type);
data->idToType.insert(type->qListTypeId(), type);
- data->idToType.insert(type->qmlListTypeId(), type);
// XXX No insertMulti, so no multi-version interfaces?
if (!type->qmlTypeName().isEmpty())
data->nameToType.insert(type->qmlTypeName(), type);
- if (data->interfaces.size() < id.typeId)
+ if (data->interfaces.size() <= id.typeId)
data->interfaces.resize(id.typeId + 16);
- if (data->qmllists.size() < id.qmlListId)
- data->qmllists.resize(id.qmlListId + 16);
- if (data->lists.size() < id.listId)
+ if (data->lists.size() <= id.listId)
data->lists.resize(id.listId + 16);
data->interfaces.setBit(id.typeId, true);
- data->qmllists.setBit(id.qmlListId, true);
data->lists.setBit(id.listId, true);
return index;
@@ -456,14 +409,13 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QObject *(*func
name += '/';
name += cname;
- QmlType *type = new QmlType(id.typeId, id.listId, id.qmlListId,
+ QmlType *type = new QmlType(id.typeId, id.listId,
func, name, version_maj, version_min, mo, attach, attachMo, pStatus,
valueSource, valueInterceptor, extFunc, extmo, index, parser);
data->types.append(type);
data->idToType.insert(type->typeId(), type);
data->idToType.insert(type->qListTypeId(), type);
- data->idToType.insert(type->qmlListTypeId(), type);
if (!type->qmlTypeName().isEmpty())
data->nameToType.insertMulti(type->qmlTypeName(), type);
@@ -472,12 +424,9 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QObject *(*func
if (data->objects.size() <= id.typeId)
data->objects.resize(id.typeId + 16);
- if (data->qmllists.size() <= id.qmlListId)
- data->qmllists.resize(id.qmlListId + 16);
if (data->lists.size() <= id.listId)
data->lists.resize(id.listId + 16);
data->objects.setBit(id.typeId, true);
- data->qmllists.setBit(id.qmlListId, true);
data->lists.setBit(id.listId, true);
return index;
@@ -519,51 +468,6 @@ int QmlMetaType::listType(int id)
return 0;
}
-/*
- Returns the item type for a qml list of type \a id.
- */
-int QmlMetaType::qmlListType(int id)
-{
- QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
- QmlType *type = data->idToType.value(id);
- if (type && type->qmlListTypeId() == id)
- return type->typeId();
- else
- return 0;
-}
-
-bool QmlMetaType::clear(const QVariant &list)
-{
- int userType = list.userType();
- QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
- QmlType *type = data->idToType.value(userType);
- lock.unlock();
- if (type && type->qListTypeId() == userType) {
- type->listClear(list);
- return true;
- } else {
- return false;
- }
-}
-
-bool QmlMetaType::append(const QVariant &list, const QVariant &item)
-{
- int userType = list.userType();
- QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
- QmlType *type = data->idToType.value(userType);
- lock.unlock();
- if (type && type->qListTypeId() == userType &&
- item.userType() == type->typeId()) {
- type->listAppend(list, item);
- return true;
- } else {
- return false;
- }
-}
-
int QmlMetaType::attachedPropertiesFuncId(const QMetaObject *mo)
{
QReadLocker lock(metaTypeDataLock());
@@ -648,8 +552,6 @@ QmlMetaType::TypeCategory QmlMetaType::typeCategory(int userType)
QmlMetaTypeData *data = metaTypeData();
if (userType < data->objects.size() && data->objects.testBit(userType))
return Object;
- else if (userType < data->qmllists.size() && data->qmllists.testBit(userType))
- return QmlList;
else if (userType < data->lists.size() && data->lists.testBit(userType))
return List;
else
@@ -675,13 +577,6 @@ const char *QmlMetaType::interfaceIId(int userType)
return 0;
}
-bool QmlMetaType::isQmlList(int userType)
-{
- QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
- return userType >= 0 && userType < data->qmllists.size() && data->qmllists.testBit(userType);
-}
-
bool QmlMetaType::isList(int userType)
{
QReadLocker lock(metaTypeDataLock());
@@ -689,44 +584,6 @@ bool QmlMetaType::isList(int userType)
return userType >= 0 && userType < data->lists.size() && data->lists.testBit(userType);
}
-bool QmlMetaType::isList(const QVariant &v)
-{
- return (v.type() == QVariant::UserType && isList(v.userType()));
-}
-
-int QmlMetaType::listCount(const QVariant &v)
-{
- int userType = v.userType();
-
- QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
- QmlType *type = data->idToType.value(userType);
- lock.unlock();
-
- if (type && type->qListTypeId() == userType)
- return type->listCount(v);
- else
- return 0;
-}
-
-QVariant QmlMetaType::listAt(const QVariant &v, int idx)
-{
- if (idx < 0)
- return QVariant();
-
- int userType = v.userType();
-
- QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
- QmlType *type = data->idToType.value(userType);
- lock.unlock();
-
- if (type && type->qListTypeId() == userType)
- return type->listAt(v, idx);
- else
- return QVariant();
-}
-
/*!
A custom string convertor allows you to specify a function pointer that
returns a variant of \a type. For example, if you have written your own icon
diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h
index 1d9c096..98d04c1 100644
--- a/src/declarative/qml/qmlmetatype.h
+++ b/src/declarative/qml/qmlmetatype.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -84,22 +84,15 @@ public:
static QObject *toQObject(const QVariant &, bool *ok = 0);
static int listType(int);
- static bool clear(const QVariant &);
- static bool append(const QVariant &, const QVariant &);
static int attachedPropertiesFuncId(const QMetaObject *);
static QmlAttachedPropertiesFunc attachedPropertiesFuncById(int);
- enum TypeCategory { Unknown, Object, List, QmlList };
+ enum TypeCategory { Unknown, Object, List };
static TypeCategory typeCategory(int);
static bool isInterface(int);
static const char *interfaceIId(int);
static bool isList(int);
- static bool isList(const QVariant &);
- static bool isQmlList(int);
- static int qmlListType(int);
- static int listCount(const QVariant &);
- static QVariant listAt(const QVariant &, int);
typedef QVariant (*StringConverter)(const QString &);
static void registerCustomStringConverter(int, StringConverter);
@@ -124,12 +117,6 @@ public:
bool isInterface() const;
int typeId() const;
int qListTypeId() const;
- int qmlListTypeId() const;
-
- void listClear(const QVariant &);
- void listAppend(const QVariant &, const QVariant &);
- QVariant listAt(const QVariant &, int);
- int listCount(const QVariant &);
const QMetaObject *metaObject() const;
const QMetaObject *baseMetaObject() const;
@@ -148,8 +135,8 @@ private:
friend class QmlMetaType;
friend class QmlTypePrivate;
friend struct QmlMetaTypeData;
- QmlType(int, int, int, const char *, int);
- QmlType(int, int, int, QObject *(*)(), const char *, int, int, const QMetaObject *, QmlAttachedPropertiesFunc, const QMetaObject *, int, int, int, QmlPrivate::CreateFunc, const QMetaObject *, int, QmlCustomParser *);
+ QmlType(int, int, const char *, int);
+ QmlType(int, int, QObject *(*)(), const char *, int, int, const QMetaObject *, QmlAttachedPropertiesFunc, const QMetaObject *, int, int, int, QmlPrivate::CreateFunc, const QMetaObject *, int, QmlCustomParser *);
~QmlType();
QmlTypePrivate *d;
@@ -162,7 +149,6 @@ int qmlRegisterType(const char *typeName)
QmlPrivate::MetaTypeIds ids = {
qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
qRegisterMetaType<QmlListProperty<T> >(QByteArray("QmlListProperty<" + name + ">").constData()),
- qRegisterMetaType<QmlList<T *>*>(QByteArray("QmlList<" + name + "*>*").constData())
};
return QmlMetaType::registerType(ids, 0, 0, 0, 0, 0,
@@ -183,7 +169,6 @@ int qmlRegisterType(const char *uri, int version_maj, int version_min, const cha
QmlPrivate::MetaTypeIds ids = {
qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
qRegisterMetaType<QmlListProperty<T> >(QByteArray("QmlListProperty<" + name + ">").constData()),
- qRegisterMetaType<QmlList<T *>*>(QByteArray("QmlList<" + name + "*>*").constData())
};
return QmlMetaType::registerType(ids, QmlPrivate::create<T>,
@@ -205,7 +190,6 @@ int qmlRegisterExtendedType(const char *typeName)
QmlPrivate::MetaTypeIds ids = {
qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
qRegisterMetaType<QmlListProperty<T> >(QByteArray("QmlListProperty<" + name + ">").constData()),
- qRegisterMetaType<QmlList<T *>*>(QByteArray("QmlList<" + name + "*>*").constData())
};
QmlAttachedPropertiesFunc attached =
@@ -233,7 +217,6 @@ int qmlRegisterExtendedType(const char *uri, int version_maj, int version_min, c
QmlPrivate::MetaTypeIds ids = {
qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
qRegisterMetaType<QmlListProperty<T> >(QByteArray("QmlListProperty<" + name + ">").constData()),
- qRegisterMetaType<QmlList<T *>*>(QByteArray("QmlList<" + name + "*>*").constData())
};
QmlAttachedPropertiesFunc attached =
@@ -264,7 +247,6 @@ int qmlRegisterInterface(const char *typeName)
QmlPrivate::MetaTypeIds ids = {
qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
qRegisterMetaType<QmlListProperty<T> >(QByteArray("QmlListProperty<" + name + ">").constData()),
- qRegisterMetaType<QmlList<T *>*>(QByteArray("QmlList<" + name + "*>*").constData())
};
return QmlMetaType::registerInterface(ids, qobject_interface_iid<T *>());
@@ -277,7 +259,6 @@ int qmlRegisterCustomType(const char *uri, int version_maj, int version_min, con
QmlPrivate::MetaTypeIds ids = {
qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
qRegisterMetaType<QmlListProperty<T> >(QByteArray("QmlListProperty<" + name + ">").constData()),
- qRegisterMetaType<QmlList<T *>*>(QByteArray("QmlList<" + name + "*>*").constData())
};
return QmlMetaType::registerType(ids, QmlPrivate::create<T>,
diff --git a/src/declarative/qml/qmlmoduleplugin.cpp b/src/declarative/qml/qmlmoduleplugin.cpp
index 2f2cb25..8019805 100644
--- a/src/declarative/qml/qmlmoduleplugin.cpp
+++ b/src/declarative/qml/qmlmoduleplugin.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
The plugin should register QML types with qmlRegisterType() when the
defineModule() method is called.
- \sa examples/declarative/plugins
+ See the example in \c{examples/declarative/plugins}.
*/
/*!
diff --git a/src/declarative/qml/qmlmoduleplugin.h b/src/declarative/qml/qmlmoduleplugin.h
index 384e05e..b28f1ad 100644
--- a/src/declarative/qml/qmlmoduleplugin.h
+++ b/src/declarative/qml/qmlmoduleplugin.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlnetworkaccessmanagerfactory.cpp b/src/declarative/qml/qmlnetworkaccessmanagerfactory.cpp
index 76f20d8..1ba0694 100644
--- a/src/declarative/qml/qmlnetworkaccessmanagerfactory.cpp
+++ b/src/declarative/qml/qmlnetworkaccessmanagerfactory.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -62,6 +62,10 @@ QT_BEGIN_NAMESPACE
Note: the create() method may be called by multiple threads, so ensure the
implementation of this method is reentrant.
*/
+
+/*!
+ The destructor is empty.
+ */
QmlNetworkAccessManagerFactory::~QmlNetworkAccessManagerFactory()
{
}
diff --git a/src/declarative/qml/qmlnetworkaccessmanagerfactory.h b/src/declarative/qml/qmlnetworkaccessmanagerfactory.h
index ce9860f..1660929 100644
--- a/src/declarative/qml/qmlnetworkaccessmanagerfactory.h
+++ b/src/declarative/qml/qmlnetworkaccessmanagerfactory.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp
index 75b5c08..15ece1d 100644
--- a/src/declarative/qml/qmlobjectscriptclass.cpp
+++ b/src/declarative/qml/qmlobjectscriptclass.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -239,9 +239,7 @@ QmlObjectScriptClass::property(QObject *obj, const Identifier &name)
}
if (lastData->flags & QmlPropertyCache::Data::IsQList) {
- return Value(scriptEngine, enginePriv->listClass->newList(obj, lastData->coreIndex, QmlListScriptClass::ListProperty, lastData->propType));
- } else if (lastData->flags & QmlPropertyCache::Data::IsQmlList) {
- return Value(scriptEngine, enginePriv->listClass->newList(obj, lastData->coreIndex, QmlListScriptClass::QmlListPtr, lastData->propType));
+ return Value(scriptEngine, enginePriv->listClass->newList(obj, lastData->coreIndex, lastData->propType));
} else if (lastData->flags & QmlPropertyCache::Data::IsQObjectDerived) {
QObject *rv = 0;
void *args[] = { &rv, 0 };
@@ -313,7 +311,7 @@ void QmlObjectScriptClass::setProperty(QObject *obj,
Q_ASSERT(lastData);
if (!lastData->isValid()) {
- QString error = QLatin1String("Cannot assign to non-existant property \"") +
+ QString error = QLatin1String("Cannot assign to non-existent property \"") +
toString(name) + QLatin1Char('\"');
if (context())
context()->throwError(error);
@@ -628,11 +626,11 @@ QmlObjectMethodScriptClass::Value QmlObjectMethodScriptClass::call(Object *o, QS
for (int ii = 0; ii < argTypeNames.count(); ++ii) {
argTypes[ii] = QMetaType::type(argTypeNames.at(ii));
if (argTypes[ii] == QVariant::Invalid)
- return Value(ctxt, ctxt->throwError(QString(QLatin1String("Unknown method parameter type: %1")).arg(QLatin1String(argTypeNames.at(ii)))));
+ return Value(ctxt, ctxt->throwError(QString::fromLatin1("Unknown method parameter type: %1").arg(QLatin1String(argTypeNames.at(ii)))));
}
if (argTypes.count() > ctxt->argumentCount())
- return Value(ctxt, ctxt->throwError("Insufficient arguments"));
+ return Value(ctxt, ctxt->throwError(QLatin1String("Insufficient arguments")));
QVarLengthArray<MetaCallArgument, 9> args(argTypes.count() + 1);
args[0].initAsType(method->data.propType, engine);
diff --git a/src/declarative/qml/qmlobjectscriptclass_p.h b/src/declarative/qml/qmlobjectscriptclass_p.h
index 470c555..729f34f 100644
--- a/src/declarative/qml/qmlobjectscriptclass_p.h
+++ b/src/declarative/qml/qmlobjectscriptclass_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp
index 02a9e70..f2690e2 100644
--- a/src/declarative/qml/qmlparser.cpp
+++ b/src/declarative/qml/qmlparser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h
index aa7a762..222229b 100644
--- a/src/declarative/qml/qmlparser_p.h
+++ b/src/declarative/qml/qmlparser_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlparserstatus.cpp b/src/declarative/qml/qmlparserstatus.cpp
index 69ccfda..435d620 100644
--- a/src/declarative/qml/qmlparserstatus.cpp
+++ b/src/declarative/qml/qmlparserstatus.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlparserstatus.h b/src/declarative/qml/qmlparserstatus.h
index e12c7b5..e4cfe8b 100644
--- a/src/declarative/qml/qmlparserstatus.h
+++ b/src/declarative/qml/qmlparserstatus.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlprivate.cpp b/src/declarative/qml/qmlprivate.cpp
index 01353cc..f85e280 100644
--- a/src/declarative/qml/qmlprivate.cpp
+++ b/src/declarative/qml/qmlprivate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h
index c367497..e5ea07f 100644
--- a/src/declarative/qml/qmlprivate.h
+++ b/src/declarative/qml/qmlprivate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -72,19 +72,6 @@ public:
namespace QmlPrivate
{
- class ListInterface
- {
- public:
- virtual ~ListInterface() {}
- virtual int type() const = 0;
- virtual void append(void *) = 0;
- virtual void insert(int, void *) = 0;
- virtual void removeAt(int) = 0;
- virtual void at(int, void *) const = 0;
- virtual int count() const = 0;
- virtual void clear() = 0;
- };
-
template<typename T>
QObject *create() { return new T; }
@@ -183,7 +170,6 @@ namespace QmlPrivate
struct MetaTypeIds {
int typeId;
int listId;
- int qmlListId;
};
typedef QObject *(*CreateFunc)(QObject *);
diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp
index a0a7cea..a3e655b 100644
--- a/src/declarative/qml/qmlpropertycache.cpp
+++ b/src/declarative/qml/qmlpropertycache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -77,8 +77,6 @@ void QmlPropertyCache::Data::load(const QMetaProperty &p, QmlEngine *engine)
flags |= Data::IsQObjectDerived;
else if (cat == QmlMetaType::List)
flags |= Data::IsQList;
- else if (cat == QmlMetaType::QmlList)
- flags |= Data::IsQmlList;
}
}
diff --git a/src/declarative/qml/qmlpropertycache_p.h b/src/declarative/qml/qmlpropertycache_p.h
index efc4643..18eea80 100644
--- a/src/declarative/qml/qmlpropertycache_p.h
+++ b/src/declarative/qml/qmlpropertycache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -86,7 +86,6 @@ public:
IsFunction = 0x00000008,
IsQObjectDerived = 0x00000010,
IsEnumType = 0x00000020,
- IsQmlList = 0x00000040,
IsQList = 0x00000080,
IsQmlBinding = 0x00000100,
IsQScriptValue = 0x00000200,
diff --git a/src/declarative/qml/qmlpropertyvalueinterceptor.cpp b/src/declarative/qml/qmlpropertyvalueinterceptor.cpp
index 9d0d7f6..ea53e16 100644
--- a/src/declarative/qml/qmlpropertyvalueinterceptor.cpp
+++ b/src/declarative/qml/qmlpropertyvalueinterceptor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlpropertyvalueinterceptor.h b/src/declarative/qml/qmlpropertyvalueinterceptor.h
index 71cc6c5..74cd5fa 100644
--- a/src/declarative/qml/qmlpropertyvalueinterceptor.h
+++ b/src/declarative/qml/qmlpropertyvalueinterceptor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlpropertyvaluesource.cpp b/src/declarative/qml/qmlpropertyvaluesource.cpp
index 50f2f8c..bccdfb7 100644
--- a/src/declarative/qml/qmlpropertyvaluesource.cpp
+++ b/src/declarative/qml/qmlpropertyvaluesource.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlpropertyvaluesource.h b/src/declarative/qml/qmlpropertyvaluesource.h
index 2017fb2..fc53b8a 100644
--- a/src/declarative/qml/qmlpropertyvaluesource.h
+++ b/src/declarative/qml/qmlpropertyvaluesource.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlproxymetaobject.cpp b/src/declarative/qml/qmlproxymetaobject.cpp
index 983c350..29aad34 100644
--- a/src/declarative/qml/qmlproxymetaobject.cpp
+++ b/src/declarative/qml/qmlproxymetaobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlproxymetaobject_p.h b/src/declarative/qml/qmlproxymetaobject_p.h
index f983030..96cfbf5 100644
--- a/src/declarative/qml/qmlproxymetaobject_p.h
+++ b/src/declarative/qml/qmlproxymetaobject_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlrefcount.cpp b/src/declarative/qml/qmlrefcount.cpp
index 9422625..76a6ab6 100644
--- a/src/declarative/qml/qmlrefcount.cpp
+++ b/src/declarative/qml/qmlrefcount.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlrefcount_p.h b/src/declarative/qml/qmlrefcount_p.h
index 7448042..9b2f52b 100644
--- a/src/declarative/qml/qmlrefcount_p.h
+++ b/src/declarative/qml/qmlrefcount_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlrewrite.cpp b/src/declarative/qml/qmlrewrite.cpp
index 34bd198..d8a9350 100644
--- a/src/declarative/qml/qmlrewrite.cpp
+++ b/src/declarative/qml/qmlrewrite.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlrewrite_p.h b/src/declarative/qml/qmlrewrite_p.h
index a04a0db..27140ba 100644
--- a/src/declarative/qml/qmlrewrite_p.h
+++ b/src/declarative/qml/qmlrewrite_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlscript.cpp b/src/declarative/qml/qmlscript.cpp
index 10fc9a6..ef142a5 100644
--- a/src/declarative/qml/qmlscript.cpp
+++ b/src/declarative/qml/qmlscript.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -58,7 +58,7 @@
console.log(otherinterestingitem.property);
}
}
- MouseRegion { onClicked: debugMyComponent() }
+ MouseArea { onClicked: debugMyComponent() }
\endqml
\note While it is possible to use any JavaScript code within a Script element,
diff --git a/src/declarative/qml/qmlscriptclass_p.h b/src/declarative/qml/qmlscriptclass_p.h
index 847ee66..e7ccc13 100644
--- a/src/declarative/qml/qmlscriptclass_p.h
+++ b/src/declarative/qml/qmlscriptclass_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp
index a24ef51..c0d5cf9 100644
--- a/src/declarative/qml/qmlscriptparser.cpp
+++ b/src/declarative/qml/qmlscriptparser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlscriptparser_p.h b/src/declarative/qml/qmlscriptparser_p.h
index 16888aa..b420b9a 100644
--- a/src/declarative/qml/qmlscriptparser_p.h
+++ b/src/declarative/qml/qmlscriptparser_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlscriptstring.cpp b/src/declarative/qml/qmlscriptstring.cpp
index 1ccad53..29118e6 100644
--- a/src/declarative/qml/qmlscriptstring.cpp
+++ b/src/declarative/qml/qmlscriptstring.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlscriptstring.h b/src/declarative/qml/qmlscriptstring.h
index d07137e..1789eb5 100644
--- a/src/declarative/qml/qmlscriptstring.h
+++ b/src/declarative/qml/qmlscriptstring.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlsqldatabase.cpp b/src/declarative/qml/qmlsqldatabase.cpp
index 9c951fc..4e0e0fb 100644
--- a/src/declarative/qml/qmlsqldatabase.cpp
+++ b/src/declarative/qml/qmlsqldatabase.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlsqldatabase_p.h b/src/declarative/qml/qmlsqldatabase_p.h
index 9965a2b..0fd275b 100644
--- a/src/declarative/qml/qmlsqldatabase_p.h
+++ b/src/declarative/qml/qmlsqldatabase_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -53,6 +53,9 @@
//
// We mean it.
//
+
+#include <QtCore/qglobal.h>
+
QT_BEGIN_NAMESPACE
class QScriptEngine;
diff --git a/src/declarative/qml/qmlstringconverters.cpp b/src/declarative/qml/qmlstringconverters.cpp
index 2963ab5..6ba70d3 100644
--- a/src/declarative/qml/qmlstringconverters.cpp
+++ b/src/declarative/qml/qmlstringconverters.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlstringconverters_p.h b/src/declarative/qml/qmlstringconverters_p.h
index 46b2de6..c83a1de 100644
--- a/src/declarative/qml/qmlstringconverters_p.h
+++ b/src/declarative/qml/qmlstringconverters_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmltypenamecache.cpp b/src/declarative/qml/qmltypenamecache.cpp
index 7e68492..eef3bae 100644
--- a/src/declarative/qml/qmltypenamecache.cpp
+++ b/src/declarative/qml/qmltypenamecache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmltypenamecache_p.h b/src/declarative/qml/qmltypenamecache_p.h
index 754399f..e578277 100644
--- a/src/declarative/qml/qmltypenamecache_p.h
+++ b/src/declarative/qml/qmltypenamecache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmltypenamescriptclass.cpp b/src/declarative/qml/qmltypenamescriptclass.cpp
index 14c8652..32a7a25 100644
--- a/src/declarative/qml/qmltypenamescriptclass.cpp
+++ b/src/declarative/qml/qmltypenamescriptclass.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmltypenamescriptclass_p.h b/src/declarative/qml/qmltypenamescriptclass_p.h
index cf8c621..fd5752d 100644
--- a/src/declarative/qml/qmltypenamescriptclass_p.h
+++ b/src/declarative/qml/qmltypenamescriptclass_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlvaluetype.cpp b/src/declarative/qml/qmlvaluetype.cpp
index 058fd6e..33c3e76 100644
--- a/src/declarative/qml/qmlvaluetype.cpp
+++ b/src/declarative/qml/qmlvaluetype.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlvaluetype_p.h b/src/declarative/qml/qmlvaluetype_p.h
index 800edee..0a152e8 100644
--- a/src/declarative/qml/qmlvaluetype_p.h
+++ b/src/declarative/qml/qmlvaluetype_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlvaluetypescriptclass.cpp b/src/declarative/qml/qmlvaluetypescriptclass.cpp
index 5e222a1..0a92014 100644
--- a/src/declarative/qml/qmlvaluetypescriptclass.cpp
+++ b/src/declarative/qml/qmlvaluetypescriptclass.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlvaluetypescriptclass_p.h b/src/declarative/qml/qmlvaluetypescriptclass_p.h
index 09af967..12aef49 100644
--- a/src/declarative/qml/qmlvaluetypescriptclass_p.h
+++ b/src/declarative/qml/qmlvaluetypescriptclass_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index 4ab205e..8655809 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -92,15 +92,12 @@ QmlVME::QmlVME()
struct ListInstance
{
ListInstance()
- : type(0), qmlListInterface(0) {}
+ : type(0) {}
ListInstance(int t)
- : type(t), qmlListInterface(0) {}
- ListInstance(QmlPrivate::ListInterface *q, int t)
- : type(t), qmlListInterface(q) {}
+ : type(t) {}
int type;
QmlListProperty<void> qListProperty;
- QmlPrivate::ListInterface *qmlListInterface;
};
QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledData *comp,
@@ -655,16 +652,6 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreObjectQmlList:
- {
- QObject *assign = stack.pop();
- const ListInstance &list = qliststack.top();
-
- void *d = (void *)&assign;
- list.qmlListInterface->append(d);
- }
- break;
-
case QmlInstruction::StoreObjectQList:
{
QObject *assign = stack.pop();
@@ -691,12 +678,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot assign object to list"));
- if (list.qmlListInterface) {
- void *d = (void *)&ptr;
- list.qmlListInterface->append(d);
- } else {
- list.qListProperty.append((QmlListProperty<void>*)&list.qListProperty, ptr);
- }
+ list.qListProperty.append((QmlListProperty<void>*)&list.qListProperty, ptr);
}
break;
@@ -751,24 +733,6 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::FetchQmlList:
- {
- QObject *target = stack.top();
-
- void *a[1];
- // We know that QmlList<*> can be converted to
- // QmlPrivate::ListInterface
- QmlPrivate::ListInterface *list = 0;
- a[0] = &list;
- QMetaObject::metacall(target, QMetaObject::ReadProperty,
- instr.fetchQmlList.property, a);
- if (!list)
- VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot assign to null list"));
-
- qliststack.push(ListInstance(list, instr.fetchQmlList.type));
- }
- break;
-
case QmlInstruction::FetchQList:
{
QObject *target = stack.top();
diff --git a/src/declarative/qml/qmlvme_p.h b/src/declarative/qml/qmlvme_p.h
index 9c45dc1..ae7dd7f 100644
--- a/src/declarative/qml/qmlvme_p.h
+++ b/src/declarative/qml/qmlvme_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qmlvmemetaobject.cpp
index 8faa922..4886680 100644
--- a/src/declarative/qml/qmlvmemetaobject.cpp
+++ b/src/declarative/qml/qmlvmemetaobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -77,13 +77,14 @@ QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj,
data = new QVariant[metaData->propertyCount];
aConnected.resize(metaData->aliasCount);
- int list_type = qMetaTypeId<QmlList<QObject*>* >();
+ int list_type = qMetaTypeId<QmlListProperty<QObject> >();
// ### Optimize
for (int ii = 0; ii < metaData->propertyCount; ++ii) {
int t = (metaData->propertyData() + ii)->propertyType;
if (t == list_type) {
- listProperties.append(new List(this, ii));
- data[ii] = QVariant::fromValue((QmlList<QObject *>*)listProperties.last());
+ listProperties.append(new List(methodOffset + ii));
+ data[ii] = QVariant::fromValue(QmlListProperty<QObject>(obj, listProperties.last(), list_append,
+ list_count, list_at, list_clear));
} else if (t != -1) {
data[ii] = QVariant((QVariant::Type)t);
}
@@ -182,8 +183,9 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
default:
break;
}
- if (t == qMetaTypeId<QmlList<QObject*>* >()) {
- *reinterpret_cast<QmlList<QObject *> **>(a[0]) = data[id].value<QmlList<QObject*>*>();
+ if (t == qMetaTypeId<QmlListProperty<QObject> >()) {
+ *reinterpret_cast<QmlListProperty<QObject> *>(a[0]) =
+ data[id].value<QmlListProperty<QObject> >();
}
} else if (c == QMetaObject::WriteProperty) {
@@ -318,6 +320,30 @@ void QmlVMEMetaObject::listChanged(int id)
activate(object, methodOffset + id, 0);
}
+void QmlVMEMetaObject::list_append(QmlListProperty<QObject> *prop, QObject *o)
+{
+ List *list = static_cast<List *>(prop->data);
+ list->append(o);
+ QMetaObject::activate(prop->object, list->notifyIndex, 0);
+}
+
+int QmlVMEMetaObject::list_count(QmlListProperty<QObject> *prop)
+{
+ return static_cast<List *>(prop->data)->count();
+}
+
+QObject *QmlVMEMetaObject::list_at(QmlListProperty<QObject> *prop, int index)
+{
+ return static_cast<List *>(prop->data)->at(index);
+}
+
+void QmlVMEMetaObject::list_clear(QmlListProperty<QObject> *prop)
+{
+ List *list = static_cast<List *>(prop->data);
+ list->clear();
+ QMetaObject::activate(prop->object, list->notifyIndex, 0);
+}
+
void QmlVMEMetaObject::registerInterceptor(int index, int valueIndex, QmlPropertyValueInterceptor *interceptor)
{
if (aInterceptors.isEmpty())
diff --git a/src/declarative/qml/qmlvmemetaobject_p.h b/src/declarative/qml/qmlvmemetaobject_p.h
index 497d8f6..3eb776e 100644
--- a/src/declarative/qml/qmlvmemetaobject_p.h
+++ b/src/declarative/qml/qmlvmemetaobject_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -138,33 +138,18 @@ private:
QAbstractDynamicMetaObject *parent;
void listChanged(int);
- class List : public QmlConcreteList<QObject*>
+ class List : public QList<QObject*>
{
public:
- List(QmlVMEMetaObject *p, int propIdx)
- : parent(p), parentProperty(propIdx) { }
-
- virtual void append(QObject *v) {
- QmlConcreteList<QObject*>::append(v);
- parent->listChanged(parentProperty);
- }
- virtual void insert(int i, QObject *v) {
- QmlConcreteList<QObject*>::insert(i, v);
- parent->listChanged(parentProperty);
- }
- virtual void clear() {
- QmlConcreteList<QObject*>::clear();
- parent->listChanged(parentProperty);
- }
- virtual void removeAt(int i) {
- QmlConcreteList<QObject*>::removeAt(i);
- parent->listChanged(parentProperty);
- }
- private:
- QmlVMEMetaObject *parent;
- int parentProperty;
+ List(int lpi) : notifyIndex(lpi) {}
+ int notifyIndex;
};
QList<List *> listProperties;
+
+ static void list_append(QmlListProperty<QObject> *, QObject *);
+ static int list_count(QmlListProperty<QObject> *);
+ static QObject *list_at(QmlListProperty<QObject> *, int);
+ static void list_clear(QmlListProperty<QObject> *);
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlwatcher.cpp b/src/declarative/qml/qmlwatcher.cpp
index 507c11d..59503de 100644
--- a/src/declarative/qml/qmlwatcher.cpp
+++ b/src/declarative/qml/qmlwatcher.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlwatcher_p.h b/src/declarative/qml/qmlwatcher_p.h
index 5050949..57b358d 100644
--- a/src/declarative/qml/qmlwatcher_p.h
+++ b/src/declarative/qml/qmlwatcher_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlworkerscript.cpp b/src/declarative/qml/qmlworkerscript.cpp
index ec790ca..a2e8c7a 100644
--- a/src/declarative/qml/qmlworkerscript.cpp
+++ b/src/declarative/qml/qmlworkerscript.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlworkerscript_p.h b/src/declarative/qml/qmlworkerscript_p.h
index 3a29498..7698a21 100644
--- a/src/declarative/qml/qmlworkerscript_p.h
+++ b/src/declarative/qml/qmlworkerscript_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlxmlhttprequest.cpp b/src/declarative/qml/qmlxmlhttprequest.cpp
index 54e26df..eda2d9e 100644
--- a/src/declarative/qml/qmlxmlhttprequest.cpp
+++ b/src/declarative/qml/qmlxmlhttprequest.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/qmlxmlhttprequest_p.h b/src/declarative/qml/qmlxmlhttprequest_p.h
index 3a81278..59cb211 100644
--- a/src/declarative/qml/qmlxmlhttprequest_p.h
+++ b/src/declarative/qml/qmlxmlhttprequest_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -53,6 +53,9 @@
//
// We mean it.
//
+
+#include <QtCore/qglobal.h>
+
QT_BEGIN_NAMESPACE
class QScriptEngine;
diff --git a/src/declarative/qml/qpodvector_p.h b/src/declarative/qml/qpodvector_p.h
index 42d6017..caf564a 100644
--- a/src/declarative/qml/qpodvector_p.h
+++ b/src/declarative/qml/qpodvector_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/rewriter/rewriter.cpp b/src/declarative/qml/rewriter/rewriter.cpp
index 237d33f..f848936 100644
--- a/src/declarative/qml/rewriter/rewriter.cpp
+++ b/src/declarative/qml/rewriter/rewriter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/rewriter/rewriter_p.h b/src/declarative/qml/rewriter/rewriter_p.h
index 57e7ea2..36e8df7 100644
--- a/src/declarative/qml/rewriter/rewriter_p.h
+++ b/src/declarative/qml/rewriter/rewriter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/rewriter/textwriter.cpp b/src/declarative/qml/rewriter/textwriter.cpp
index 8f89f12..cd3f26a 100644
--- a/src/declarative/qml/rewriter/textwriter.cpp
+++ b/src/declarative/qml/rewriter/textwriter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/qml/rewriter/textwriter_p.h b/src/declarative/qml/rewriter/textwriter_p.h
index a19fa5e..43ef669 100644
--- a/src/declarative/qml/rewriter/textwriter_p.h
+++ b/src/declarative/qml/rewriter/textwriter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qfxperf.cpp b/src/declarative/util/qfxperf.cpp
index f62f810..8f5617c 100644
--- a/src/declarative/util/qfxperf.cpp
+++ b/src/declarative/util/qfxperf.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qfxperf_p_p.h b/src/declarative/util/qfxperf_p_p.h
index e3f820c..106f761 100644
--- a/src/declarative/util/qfxperf_p_p.h
+++ b/src/declarative/util/qfxperf_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index 4f68b6c..c044f97 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -77,7 +77,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
if (hasParams) {
QString easeName = curve.trimmed();
if (!easeName.endsWith(QLatin1Char(')'))) {
- qmlInfo(obj) << obj->tr("Unmatched parenthesis in easing function \"%1\"").arg(curve);
+ qmlInfo(obj) << QmlPropertyAnimation::tr("Unmatched parenthesis in easing function \"%1\"").arg(curve);
return easingCurve;
}
@@ -86,7 +86,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
easeName.mid(idx + 1, easeName.length() - 1 - idx - 1);
normalizedCurve = easeName.left(idx);
if (!normalizedCurve.startsWith(QLatin1String("ease"))) {
- qmlInfo(obj) << obj->tr("Easing function \"%1\" must start with \"ease\"").arg(curve);
+ qmlInfo(obj) << QmlPropertyAnimation::tr("Easing function \"%1\" must start with \"ease\"").arg(curve);
return easingCurve;
}
@@ -101,7 +101,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
int value = me.keyToValue(normalizedCurve.toUtf8().constData());
if (value < 0) {
- qmlInfo(obj) << obj->tr("Unknown easing curve \"%1\"").arg(curve);
+ qmlInfo(obj) << QmlPropertyAnimation::tr("Unknown easing curve \"%1\"").arg(curve);
return easingCurve;
}
easingCurve.setType((QEasingCurve::Type)value);
@@ -111,7 +111,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
int sep = str.indexOf(QLatin1Char(':'));
if (sep == -1) {
- qmlInfo(obj) << obj->tr("Improperly specified parameter in easing function \"%1\"").arg(curve);
+ qmlInfo(obj) << QmlPropertyAnimation::tr("Improperly specified parameter in easing function \"%1\"").arg(curve);
continue;
}
@@ -120,7 +120,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
qreal propValue = str.mid(sep + 1).trimmed().toDouble(&isOk);
if (propName.isEmpty() || !isOk) {
- qmlInfo(obj) << obj->tr("Improperly specified parameter in easing function \"%1\"").arg(curve);
+ qmlInfo(obj) << QmlPropertyAnimation::tr("Improperly specified parameter in easing function \"%1\"").arg(curve);
continue;
}
@@ -131,7 +131,7 @@ static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
} else if (propName == QLatin1String("overshoot")) {
easingCurve.setOvershoot(propValue);
} else {
- qmlInfo(obj) << obj->tr("Unknown easing parameter \"%1\"").arg(propName);
+ qmlInfo(obj) << QmlPropertyAnimation::tr("Unknown easing parameter \"%1\"").arg(propName);
continue;
}
}
@@ -176,7 +176,7 @@ QmlAbstractAnimation::QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObj
The \c running property can be set to declaratively control whether or not
an animation is running. The following example will animate a rectangle
- whenever the \l MouseRegion is pressed.
+ whenever the \l MouseArea is pressed.
\code
Rectangle {
@@ -185,7 +185,7 @@ QmlAbstractAnimation::QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObj
running: myMouse.pressed
from: 0; to: 100
}
- MouseRegion { id: myMouse }
+ MouseArea { id: myMouse }
}
\endcode
@@ -210,11 +210,16 @@ bool QmlAbstractAnimation::isRunning() const
return d->running;
}
+//commence is called to start an animation when it is used as a
+//simple animation, and not as part of a transition
void QmlAbstractAnimationPrivate::commence()
{
Q_Q(QmlAbstractAnimation);
- q->prepare(userProperty.value);
+ QmlStateActions actions;
+ QmlMetaProperties properties;
+ q->transition(actions, properties, QmlAbstractAnimation::Forward);
+
q->qtAnimation()->start();
if (q->qtAnimation()->state() != QAbstractAnimation::Running) {
running = false;
@@ -226,7 +231,7 @@ QmlMetaProperty QmlAbstractAnimationPrivate::createProperty(QObject *obj, const
{
QmlMetaProperty prop = QmlMetaProperty::createProperty(obj, str, qmlContext(infoObj));
if (!prop.isValid()) {
- qmlInfo(infoObj) << QmlAbstractAnimation::tr("Cannot animate non-existant property \"%1\"").arg(str);
+ qmlInfo(infoObj) << QmlAbstractAnimation::tr("Cannot animate non-existent property \"%1\"").arg(str);
return QmlMetaProperty();
} else if (!prop.isWritable()) {
qmlInfo(infoObj) << QmlAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str);
@@ -238,14 +243,17 @@ QmlMetaProperty QmlAbstractAnimationPrivate::createProperty(QObject *obj, const
void QmlAbstractAnimation::setRunning(bool r)
{
Q_D(QmlAbstractAnimation);
-
- if (r == false)
- d->avoidPropertyValueSourceStart = true;
+ if (!d->componentComplete) {
+ d->running = r;
+ if (r == false)
+ d->avoidPropertyValueSourceStart = true;
+ return;
+ }
if (d->running == r)
return;
- if (d->group) {
+ if (d->group || d->disableUserControl) {
qWarning("QmlAbstractAnimation: setRunning() cannot be used on non-root animation nodes");
return;
}
@@ -262,10 +270,7 @@ void QmlAbstractAnimation::setRunning(bool r)
this, SLOT(timelineComplete()));
d->connectedTimeLine = true;
}
- if (d->componentComplete)
- d->commence();
- else
- d->startOnCompletion = true;
+ d->commence();
emit started();
} else {
if (d->alwaysRunToEnd) {
@@ -304,7 +309,7 @@ void QmlAbstractAnimation::setPaused(bool p)
if (d->paused == p)
return;
- if (d->group) {
+ if (d->group || d->disableUserControl) {
qWarning("QmlAbstractAnimation: setPaused() cannot be used on non-root animation nodes");
return;
}
@@ -315,7 +320,7 @@ void QmlAbstractAnimation::setPaused(bool p)
else
qtAnimation()->resume();
- emit pausedChanged(d->running);
+ emit pausedChanged(d->paused);
}
void QmlAbstractAnimation::classBegin()
@@ -327,9 +332,11 @@ void QmlAbstractAnimation::classBegin()
void QmlAbstractAnimation::componentComplete()
{
Q_D(QmlAbstractAnimation);
- if (d->startOnCompletion)
- d->commence();
d->componentComplete = true;
+ if (d->running) {
+ d->running = false;
+ setRunning(true);
+ }
}
/*!
@@ -534,17 +541,32 @@ void QmlAbstractAnimation::complete()
void QmlAbstractAnimation::setTarget(const QmlMetaProperty &p)
{
Q_D(QmlAbstractAnimation);
- if (d->userProperty.isNull)
- d->userProperty = p;
+ d->defaultProperty = p;
if (!d->avoidPropertyValueSourceStart)
setRunning(true);
}
-//prepare is called before an animation begins
-//(when an animation is used as a simple animation, and not as part of a transition)
-void QmlAbstractAnimation::prepare(QmlMetaProperty &)
+/*
+ we rely on setTarget only being called when used as a value source
+ so this function allows us to do the same thing as setTarget without
+ that assumption
+*/
+void QmlAbstractAnimation::setDefaultTarget(const QmlMetaProperty &p)
+{
+ Q_D(QmlAbstractAnimation);
+ d->defaultProperty = p;
+}
+
+/*
+ don't allow start/stop/pause/resume to be manually invoked,
+ because something else (like a Behavior) already has control
+ over the animation.
+*/
+void QmlAbstractAnimation::setDisableUserControl()
{
+ Q_D(QmlAbstractAnimation);
+ d->disableUserControl = true;
}
void QmlAbstractAnimation::transition(QmlStateActions &actions,
@@ -685,7 +707,7 @@ void QmlColorAnimation::setFrom(const QColor &f)
}
/*!
- \qmlproperty color ColorAnimation::from
+ \qmlproperty color ColorAnimation::to
This property holds the ending color.
*/
QColor QmlColorAnimation::to() const
@@ -819,7 +841,7 @@ QML_DEFINE_TYPE(Qt,4,6,ScriptAction,QmlScriptAction)
Set \c thewebview.url to the value set for the destination state:
\code
- PropertyAction { matchTargets: thewebview; matchProperties: "url" }
+ PropertyAction { target: thewebview; property: "url" }
\endcode
The PropertyAction is immediate -
@@ -866,25 +888,10 @@ void QmlPropertyAction::setTarget(QObject *o)
Q_D(QmlPropertyAction);
if (d->target == o)
return;
-
d->target = o;
- if (d->target && !d->propertyName.isEmpty()) {
- d->userProperty = d->createProperty(d->target, d->propertyName, this);
- } else {
- d->userProperty.invalidate();
- }
-
emit targetChanged(d->target, d->propertyName);
}
-/*!
- \qmlproperty string PropertyAction::property
- This property holds an explicit property to animated.
-
- The exact effect of the \c property property depends on how the animation
- is being used. Refer to the \l animation documentation for details.
-*/
-
QString QmlPropertyAction::property() const
{
Q_D(const QmlPropertyAction);
@@ -896,29 +903,24 @@ void QmlPropertyAction::setProperty(const QString &n)
Q_D(QmlPropertyAction);
if (d->propertyName == n)
return;
-
d->propertyName = n;
- if (d->target && !d->propertyName.isEmpty()) {
- d->userProperty = d->createProperty(d->target, d->propertyName, this);
- } else {
- d->userProperty.invalidate();
- }
-
emit targetChanged(d->target, d->propertyName);
}
/*!
- \qmlproperty string PropertyAction::matchProperties
- This property holds a comma-separated list of property names this action
- will match against. These names are used in conjunction with matchTargets
- to create a list of properties that the action will set, assuming those
- properties have changed.
+ \qmlproperty string PropertyAction::property
+ \qmlproperty string PropertyAction::properties
+ \qmlproperty Object PropertyAction::target
+ \qmlproperty list<Object> PropertyAction::targets
- This property is typically used for an action appearing as part of a Transition.
+ These properties are used as a set to determine which properties should be
+ affected by this action.
- By default, no property names will be matched.
+ The details of how these properties are interpreted in different situations
+ is covered in the \l{PropertyAnimation::properties}{corresponding} PropertyAnimation
+ documentation.
- \sa matchTargets PropertyAnimation::matchProperties
+ \sa exclude
*/
QString QmlPropertyAction::properties() const
{
@@ -935,18 +937,6 @@ void QmlPropertyAction::setProperties(const QString &p)
emit propertiesChanged(p);
}
-/*!
- \qmlproperty list<Object> PropertyAction::matchTargets
- This property holds a list of objects this action will match against.
- These objects are used in conjunction with matchProperties to create a list of properties
- that the action will set, assuming those properties have changed.
-
- This property is typically used for an action appearing as part of a Transition.
-
- By default, all changing targets will be matched.
-
- \sa exclude matchProperties PropertyAnimation::matchTargets
-*/
QmlListProperty<QObject> QmlPropertyAction::targets()
{
Q_D(QmlPropertyAction);
@@ -956,7 +946,7 @@ QmlListProperty<QObject> QmlPropertyAction::targets()
/*!
\qmlproperty list<Object> PropertyAction::exclude
This property holds the objects not to be affected by this animation.
- \sa matchTargets
+ \sa targets
*/
QmlListProperty<QObject> QmlPropertyAction::exclude()
{
@@ -984,29 +974,12 @@ void QmlPropertyAction::setValue(const QVariant &v)
}
}
-void QmlPropertyActionPrivate::doAction()
-{
- property.write(value, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
-}
-
QAbstractAnimation *QmlPropertyAction::qtAnimation()
{
Q_D(QmlPropertyAction);
return d->spa;
}
-void QmlPropertyAction::prepare(QmlMetaProperty &p)
-{
- Q_D(QmlPropertyAction);
-
- if (d->userProperty.isNull)
- d->property = p;
- else
- d->property = d->userProperty;
-
- d->spa->setAnimAction(&d->proxy, QAbstractAnimation::KeepWhenStopped);
-}
-
void QmlPropertyAction::transition(QmlStateActions &actions,
QmlMetaProperties &modified,
TransitionDirection direction)
@@ -1029,31 +1002,42 @@ void QmlPropertyAction::transition(QmlStateActions &actions,
QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(','));
for (int ii = 0; ii < props.count(); ++ii)
props[ii] = props.at(ii).trimmed();
+ if (!d->propertyName.isEmpty())
+ props << d->propertyName;
- bool hasSelectors = !props.isEmpty() || !d->targets.isEmpty() || !d->exclude.isEmpty();
- bool hasTarget = !d->propertyName.isEmpty() || d->target;
+ QList<QObject*> targets = d->targets;
+ if (d->target)
+ targets.append(d->target);
- if (hasSelectors && hasTarget) {
- qmlInfo(this) << tr("matchTargets/matchProperties/exclude and target/property are mutually exclusive.");
- return;
+ bool hasSelectors = !props.isEmpty() || !targets.isEmpty() || !d->exclude.isEmpty();
+
+ if (d->defaultProperty.isValid() && !hasSelectors) {
+ props << d->defaultProperty.name();
+ targets << d->defaultProperty.object();
}
QmlSetPropertyAnimationAction *data = new QmlSetPropertyAnimationAction;
bool hasExplicit = false;
- if (hasTarget && d->value.isValid()) {
- QmlAction myAction;
- myAction.property = d->createProperty(target(), d->propertyName, this);
- if (myAction.property.isValid()) {
- myAction.toValue = d->value;
- data->actions << myAction;
- hasExplicit = true;
- for (int ii = 0; ii < actions.count(); ++ii) {
- QmlAction &action = actions[ii];
- if (action.property.object() == myAction.property.object() &&
- myAction.property.name() == action.property.name()) {
- modified << action.property;
- break; //### any chance there could be multiples?
+ //an explicit animation has been specified
+ if (d->value.isValid()) {
+ for (int i = 0; i < props.count(); ++i) {
+ for (int j = 0; j < targets.count(); ++j) {
+ QmlAction myAction;
+ myAction.property = d->createProperty(targets.at(j), props.at(i), this);
+ if (myAction.property.isValid()) {
+ myAction.toValue = d->value;
+ QmlPropertyAnimationPrivate::convertVariant(myAction.toValue, myAction.property.propertyType());
+ data->actions << myAction;
+ hasExplicit = true;
+ for (int ii = 0; ii < actions.count(); ++ii) {
+ QmlAction &action = actions[ii];
+ if (action.property.object() == myAction.property.object() &&
+ myAction.property.name() == action.property.name()) {
+ modified << action.property;
+ break; //### any chance there could be multiples?
+ }
+ }
}
}
}
@@ -1069,31 +1053,18 @@ void QmlPropertyAction::transition(QmlStateActions &actions,
QString sPropertyName = action.specifiedProperty;
bool same = (obj == sObj);
- if ((d->targets.isEmpty() || d->targets.contains(obj) || (!same && d->targets.contains(sObj))) &&
+ if ((targets.isEmpty() || targets.contains(obj) || (!same && targets.contains(sObj))) &&
(!d->exclude.contains(obj)) && (same || (!d->exclude.contains(sObj))) &&
(props.contains(propertyName) || (!same && props.contains(sPropertyName)))) {
QmlAction myAction = action;
if (d->value.isValid())
myAction.toValue = d->value;
+ QmlPropertyAnimationPrivate::convertVariant(myAction.toValue, myAction.property.propertyType());
modified << action.property;
data->actions << myAction;
action.fromValue = myAction.toValue;
- } else if (d->userProperty.isValid() &&
- !hasSelectors && !hasTarget) {
- if ((d->userProperty.value.object() == obj || (!same && d->userProperty.value.object() == sObj)) &&
- (d->userProperty.value.name() == propertyName || (!same && d->userProperty.value.name() == sPropertyName))) {
- //### same as above. merge
- QmlAction myAction = action;
-
- if (d->value.isValid())
- myAction.toValue = d->value;
-
- modified << action.property;
- data->actions << myAction;
- action.fromValue = myAction.toValue;
- }
}
}
@@ -1161,24 +1132,7 @@ void QmlParentActionPrivate::init()
/*!
\qmlproperty Item ParentAction::target
- This property holds an explicit target item to reparent.
- */
-QmlGraphicsItem *QmlParentAction::object() const
-{
- Q_D(const QmlParentAction);
- return d->pcTarget;
-}
-
-void QmlParentAction::setObject(QmlGraphicsItem *target)
-{
- Q_D(QmlParentAction);
- d->pcTarget = target;
-}
-
-/*!
- \qmlproperty Item ParentAction::matchTarget
- This property holds the item this action will match against -- the item
- that the action will reparent, assuming its parent has changed.
+ This property holds a target item to reparent.
In the following example, \c myItem will be reparented by the ParentAction, while
\c myOtherItem will not.
@@ -1196,24 +1150,23 @@ void QmlParentAction::setObject(QmlGraphicsItem *target)
Transition {
SequentialAnimation {
PropertyAnimation { ... }
- ParentAction { matchTargets: myItem }
+ ParentAction { target: myItem }
PropertyAnimation { ... }
}
}
\endqml
- This property is typically used for an action appearing as part of a Transition.
*/
-QmlGraphicsItem *QmlParentAction::matchTarget() const
+QmlGraphicsItem *QmlParentAction::object() const
{
Q_D(const QmlParentAction);
return d->pcTarget;
}
-void QmlParentAction::setMatchTarget(QmlGraphicsItem *target)
+void QmlParentAction::setObject(QmlGraphicsItem *target)
{
Q_D(QmlParentAction);
- d->pcMatchTarget = target;
+ d->pcTarget = target;
}
/*!
@@ -1277,17 +1230,27 @@ void QmlParentAction::transition(QmlStateActions &actions,
QmlParentActionData *data = new QmlParentActionData;
- if (d->pcTarget && d->pcMatchTarget) {
- qmlInfo(this) << tr("matchTarget and target are mutually exclusive.");
- return;
+ //### need to correctly handle modified/done
+
+ bool hasExplicit = false;
+ if (d->pcTarget && d->pcParent) {
+ data->reverse = false;
+ QmlAction myAction;
+ QmlParentChange *pc = new QmlParentChange;
+ pc->setObject(d->pcTarget);
+ pc->setParent(d->pcParent);
+ myAction.event = pc;
+ data->pc = pc;
+ data->actions << myAction;
+ hasExplicit = true;
}
+ if (!hasExplicit)
for (int ii = 0; ii < actions.count(); ++ii) {
QmlAction &action = actions[ii];
if (action.event && action.event->typeName() == QLatin1String("ParentChange")
- && !d->pcTarget
- && (!d->pcMatchTarget || static_cast<QmlParentChange*>(action.event)->object() == d->pcMatchTarget)) {
+ && (!d->pcTarget || static_cast<QmlParentChange*>(action.event)->object() == d->pcTarget)) {
QmlAction myAction = action;
data->reverse = action.reverseEvent;
//### this logic differs from PropertyAnimation
@@ -1308,17 +1271,6 @@ void QmlParentAction::transition(QmlStateActions &actions,
}
}
- if (d->pcTarget && d->pcParent) {
- data->reverse = false;
- QmlAction myAction;
- QmlParentChange *pc = new QmlParentChange;
- pc->setObject(d->pcTarget);
- pc->setParent(d->pcParent);
- myAction.event = pc;
- data->pc = pc;
- data->actions << myAction;
- }
-
if (data->actions.count()) {
d->cpa->setAnimAction(data, QAbstractAnimation::DeleteWhenStopped);
} else {
@@ -1336,7 +1288,7 @@ QML_DEFINE_TYPE(Qt,4,6,ParentAction,QmlParentAction)
Animate a set of properties over 200ms, from their values in the start state to
their values in the end state of the transition:
\code
- NumberAnimation { matchProperties: "x,y,scale"; duration: 200 }
+ NumberAnimation { properties: "x,y,scale"; duration: 200 }
\endcode
*/
@@ -1376,7 +1328,7 @@ void QmlNumberAnimation::setFrom(qreal f)
/*!
\qmlproperty real NumberAnimation::to
This property holds the ending value.
- If not set, then the value defined in the end state of the transition.
+ If not set, then the value defined in the end state of the transition or Behavior.
*/
qreal QmlNumberAnimation::to() const
{
@@ -1434,7 +1386,7 @@ void QmlVector3dAnimation::setFrom(QVector3D f)
/*!
\qmlproperty real Vector3dAnimation::to
This property holds the ending value.
- If not set, then the value defined in the end state of the transition.
+ If not set, then the value defined in the end state of the transition or Behavior.
*/
QVector3D QmlVector3dAnimation::to() const
{
@@ -1449,19 +1401,212 @@ void QmlVector3dAnimation::setTo(QVector3D t)
QML_DEFINE_TYPE(Qt,4,6,Vector3dAnimation,QmlVector3dAnimation)
+/*!
+ \qmlclass RotationAnimation QmlRotationAnimation
+ \inherits PropertyAnimation
+ \brief The RotationAnimation element allows you to animate rotations.
+
+ RotationAnimation is a specialized PropertyAnimation that gives control
+ over the direction of rotation.
+
+ The RotationAnimation in the following example ensures that we always take
+ the shortest rotation path when switching between our states.
+ \qml
+ states: {
+ State { name: "180"; PropertyChanges { target: myItem; rotation: 180 } }
+ State { name: "-180"; PropertyChanges { target: myItem; rotation: -180 } }
+ State { name: "180"; PropertyChanges { target: myItem; rotation: 270 } }
+ }
+ transition: Transition {
+ RotationAnimation { direction: RotationAnimation.Shortest }
+ }
+ \endqml
+
+ By default, when used in a transition RotationAnimation will rotate all
+ properties named "rotation" or "angle". You can override this by providing
+ your own properties via \c properties or \c property.
+*/
+
+/*!
+ \internal
+ \class QmlRotationAnimation
+*/
+
+QVariant _q_interpolateShortestRotation(qreal &f, qreal &t, qreal progress)
+{
+ qreal newt = t;
+ qreal diff = t-f;
+ while(diff > 180.0){
+ newt -= 360.0;
+ diff -= 360.0;
+ }
+ while(diff < -180.0){
+ newt += 360.0;
+ diff += 360.0;
+ }
+ return QVariant(f + (newt - f) * progress);
+}
+
+QVariant _q_interpolateClockwiseRotation(qreal &f, qreal &t, qreal progress)
+{
+ qreal newt = t;
+ qreal diff = t-f;
+ while(diff < 0.0){
+ newt += 360.0;
+ diff += 360.0;
+ }
+ return QVariant(f + (newt - f) * progress);
+}
+
+QVariant _q_interpolateCounterclockwiseRotation(qreal &f, qreal &t, qreal progress)
+{
+ qreal newt = t;
+ qreal diff = t-f;
+ while(diff > 0.0){
+ newt -= 360.0;
+ diff -= 360.0;
+ }
+ return QVariant(f + (newt - f) * progress);
+}
+
+QmlRotationAnimation::QmlRotationAnimation(QObject *parent)
+: QmlPropertyAnimation(*(new QmlRotationAnimationPrivate), parent)
+{
+ Q_D(QmlRotationAnimation);
+ d->interpolatorType = QMetaType::QReal;
+ d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&_q_interpolateShortestRotation);
+ d->defaultProperties = QLatin1String("rotation,angle");
+}
+
+QmlRotationAnimation::~QmlRotationAnimation()
+{
+}
+
+/*!
+ \qmlproperty real RotationAnimation::from
+ This property holds the starting value.
+ If not set, then the value defined in the start state of the transition.
+*/
+qreal QmlRotationAnimation::from() const
+{
+ Q_D(const QmlRotationAnimation);
+ return d->from.toReal();
+}
+
+void QmlRotationAnimation::setFrom(qreal f)
+{
+ QmlPropertyAnimation::setFrom(f);
+}
+
+/*!
+ \qmlproperty real RotationAnimation::to
+ This property holds the ending value.
+ If not set, then the value defined in the end state of the transition or Behavior.
+*/
+qreal QmlRotationAnimation::to() const
+{
+ Q_D(const QmlRotationAnimation);
+ return d->to.toReal();
+}
+
+void QmlRotationAnimation::setTo(qreal t)
+{
+ QmlPropertyAnimation::setTo(t);
+}
+
+/*!
+ \qmlproperty enum RotationAnimation::direction
+ The direction in which to rotate.
+ Possible values are Numerical, Clockwise, Counterclockwise,
+ or Shortest.
+
+ \list
+ \row
+ \o Numerical
+ \o Rotate by linearly interpolating between the two numbers.
+ A rotation from 10 to 350 will rotate 340 degrees clockwise.
+ \row
+ \o Clockwise
+ \o Rotate clockwise between the two values
+ \row
+ \o Counterclockwise
+ \o Rotate counterclockwise between the two values
+ \row
+ \o Shortest
+ \o Rotate in the direction that produces the shortest animation path.
+ A rotation from 10 to 350 will rotate 20 degrees counterclockwise.
+ \list
+
+ The default direction is Shortest.
+*/
+QmlRotationAnimation::RotationDirection QmlRotationAnimation::direction() const
+{
+ Q_D(const QmlRotationAnimation);
+ return d->direction;
+}
+
+void QmlRotationAnimation::setDirection(QmlRotationAnimation::RotationDirection direction)
+{
+ Q_D(QmlRotationAnimation);
+ if (d->direction == direction)
+ return;
+
+ d->direction = direction;
+ switch(d->direction) {
+ case Clockwise:
+ d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&_q_interpolateClockwiseRotation);
+ break;
+ case Counterclockwise:
+ d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&_q_interpolateCounterclockwiseRotation);
+ break;
+ case Shortest:
+ d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&_q_interpolateShortestRotation);
+ break;
+ default:
+ d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
+ break;
+ }
+
+ emit directionChanged();
+}
+
+QML_DEFINE_TYPE(Qt,4,6,RotationAnimation,QmlRotationAnimation)
+
QmlAnimationGroup::QmlAnimationGroup(QObject *parent)
: QmlAbstractAnimation(*(new QmlAnimationGroupPrivate), parent)
{
}
+void QmlAnimationGroupPrivate::append_animation(QmlListProperty<QmlAbstractAnimation> *list, QmlAbstractAnimation *a)
+{
+ QmlAnimationGroup *q = qobject_cast<QmlAnimationGroup *>(list->object);
+ if (q) {
+ q->d_func()->animations.append(a);
+ a->setGroup(q);
+ }
+}
+
+void QmlAnimationGroupPrivate::clear_animation(QmlListProperty<QmlAbstractAnimation> *list)
+{
+ QmlAnimationGroup *q = qobject_cast<QmlAnimationGroup *>(list->object);
+ if (q) {
+ for (int i = 0; i < q->d_func()->animations.count(); ++i)
+ q->d_func()->animations.at(i)->setGroup(0);
+ q->d_func()->animations.clear();
+ }
+}
+
QmlAnimationGroup::~QmlAnimationGroup()
{
}
-QmlList<QmlAbstractAnimation *> *QmlAnimationGroup::animations()
+QmlListProperty<QmlAbstractAnimation> QmlAnimationGroup::animations()
{
Q_D(QmlAnimationGroup);
- return &d->animations;
+ QmlListProperty<QmlAbstractAnimation> list(this, d->animations);
+ list.append = &QmlAnimationGroupPrivate::append_animation;
+ list.clear = &QmlAnimationGroupPrivate::clear_animation;
+ return list;
}
/*!
@@ -1495,18 +1640,6 @@ QmlSequentialAnimation::~QmlSequentialAnimation()
{
}
-void QmlSequentialAnimation::prepare(QmlMetaProperty &p)
-{
- Q_D(QmlAnimationGroup);
- if (d->userProperty.isNull)
- d->property = p;
- else
- d->property = d->userProperty;
-
- for (int i = 0; i < d->animations.size(); ++i)
- d->animations.at(i)->prepare(d->property);
-}
-
QAbstractAnimation *QmlSequentialAnimation::qtAnimation()
{
Q_D(QmlAnimationGroup);
@@ -1526,13 +1659,10 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions,
from = d->animations.count() - 1;
}
- //needed for Behavior
- if (d->userProperty.isValid()) {
- for (int i = 0; i < d->animations.count(); ++i)
- d->animations.at(i)->setTarget(d->userProperty);
- }
-
+ bool valid = d->defaultProperty.isValid();
for (int ii = from; ii < d->animations.count() && ii >= 0; ii += inc) {
+ if (valid)
+ d->animations.at(ii)->setDefaultTarget(d->defaultProperty);
d->animations.at(ii)->transition(actions, modified, direction);
}
}
@@ -1574,18 +1704,6 @@ QmlParallelAnimation::~QmlParallelAnimation()
{
}
-void QmlParallelAnimation::prepare(QmlMetaProperty &p)
-{
- Q_D(QmlAnimationGroup);
- if (d->userProperty.isNull)
- d->property = p;
- else
- d->property = d->userProperty;
-
- for (int i = 0; i < d->animations.size(); ++i)
- d->animations.at(i)->prepare(d->property);
-}
-
QAbstractAnimation *QmlParallelAnimation::qtAnimation()
{
Q_D(QmlAnimationGroup);
@@ -1597,14 +1715,10 @@ void QmlParallelAnimation::transition(QmlStateActions &actions,
TransitionDirection direction)
{
Q_D(QmlAnimationGroup);
-
- //needed for Behavior
- if (d->userProperty.isValid()) {
- for (int i = 0; i < d->animations.count(); ++i)
- d->animations.at(i)->setTarget(d->userProperty);
- }
-
+ bool valid = d->defaultProperty.isValid();
for (int ii = 0; ii < d->animations.count(); ++ii) {
+ if (valid)
+ d->animations.at(ii)->setDefaultTarget(d->defaultProperty);
d->animations.at(ii)->transition(actions, modified, direction);
}
}
@@ -1668,12 +1782,56 @@ void QmlPropertyAnimationPrivate::convertVariant(QVariant &variant, int type)
\inherits Animation
\brief The PropertyAnimation element allows you to animate property changes.
- Animate theObject's size property over 200ms, from its current size to 20-by-20:
- \code
+ PropertyAnimation provides a way to animate changes to a property's value. It can
+ be used in many different situations:
+ \list
+ \o In a Transition
+
+ Animate any objects that have changed their x or y properties in the target state using
+ an InOutQuad easing curve:
+ \qml
+ Transition { PropertyAnimation { properties: "x,y"; easing: "InOutQuad" } }
+ \endqml
+ \o In a Behavior
+
+ Animate all changes to a rectangle's x property.
+ \qml
+ Rectangle {
+ x: Behavior { PropertyAnimation {} }
+ }
+ \endqml
+ \o As a property value source
+
+ Repeatedly animate the rectangle's x property.
+ \qml
+ Rectangle {
+ x: SequentialAnimation {
+ repeat: true
+ PropertyAnimation { to: 50 }
+ PropertyAnimation { to: 0 }
+ }
+ }
+ \endqml
+ \o In a signal handler
+
+ Fade out \c theObject when clicked:
+ \qml
+ MouseArea {
+ anchors.fill: theObject
+ onClicked: PropertyAnimation { target: theObject; property: "opacity"; to: 0 }
+ }
+ \endqml
+ \o Standalone
+
+ Animate \c theObject's size property over 200ms, from its current size to 20-by-20:
+ \qml
PropertyAnimation { target: theObject; property: "size"; to: "20x20"; duration: 200 }
- \endcode
+ \endqml
+ \endlist
- For an introduction to animation in QML, see \l{QML Animation}.
+ Depending on how the animation is used, the set of properties normally used will be
+ different. For more information see the individual property documentation, as well
+ as the \l{QML Animation} introduction.
*/
QmlPropertyAnimation::QmlPropertyAnimation(QObject *parent)
@@ -1683,6 +1841,13 @@ QmlPropertyAnimation::QmlPropertyAnimation(QObject *parent)
d->init();
}
+QmlPropertyAnimation::QmlPropertyAnimation(QmlPropertyAnimationPrivate &dd, QObject *parent)
+: QmlAbstractAnimation(dd, parent)
+{
+ Q_D(QmlPropertyAnimation);
+ d->init();
+}
+
QmlPropertyAnimation::~QmlPropertyAnimation()
{
}
@@ -1744,7 +1909,7 @@ void QmlPropertyAnimation::setFrom(const QVariant &f)
/*!
\qmlproperty real PropertyAnimation::to
This property holds the ending value.
- If not set, then the value defined in the end state of the transition.
+ If not set, then the value defined in the end state of the transition or Behavior.
*/
QVariant QmlPropertyAnimation::to() const
{
@@ -1955,16 +2120,6 @@ void QmlPropertyAnimation::setEasing(const QString &e)
emit easingChanged(e);
}
-/*!
- \qmlproperty Object PropertyAnimation::target
- This property holds an explicit target object to animate.
-
- target is used in conjunction with property to determine
- what property should be animated.
-
- \sa property matchTargets
-*/
-
QObject *QmlPropertyAnimation::target() const
{
Q_D(const QmlPropertyAnimation);
@@ -1976,27 +2131,10 @@ void QmlPropertyAnimation::setTarget(QObject *o)
Q_D(QmlPropertyAnimation);
if (d->target == o)
return;
-
d->target = o;
- if (d->target && !d->propertyName.isEmpty()) {
- d->userProperty = d->createProperty(d->target, d->propertyName, this);
- } else {
- d->userProperty.invalidate();
- }
-
emit targetChanged(d->target, d->propertyName);
}
-/*!
- \qmlproperty string PropertyAnimation::property
- This property holds an explicit property name to animate.
-
- property is used in conjunction with target to determine
- what property should be animated.
-
- \sa target matchProperties
-*/
-
QString QmlPropertyAnimation::property() const
{
Q_D(const QmlPropertyAnimation);
@@ -2008,46 +2146,10 @@ void QmlPropertyAnimation::setProperty(const QString &n)
Q_D(QmlPropertyAnimation);
if (d->propertyName == n)
return;
-
d->propertyName = n;
- if (d->target && !d->propertyName.isEmpty()) {
- d->userProperty = d->createProperty(d->target, d->propertyName, this);
- } else {
- d->userProperty.invalidate();
- }
-
emit targetChanged(d->target, d->propertyName);
}
-/*!
- \qmlproperty string PropertyAnimation::matchProperties
- This property holds a comma-separated list of property names this animation
- will match against. These names are used in conjunction with matchTargets
- to create a list of properties that the animation will animate, assuming those
- properties have changed.
-
- In the following example, the change in 'x' will be animated by the transition, while
- the change in 'y' will not.
- \qml
- State {
- PropertyChanges {
- target: myItem
- x: 15; y: 15
- }
- }
- Transition {
- PropertyAnimation {
- matchProperties: "x"
- }
- }
- \endqml
-
- This property is typically used for an animation appearing as part of a Transition.
-
- By default, no property names will be matched.
-
- \sa matchTargets PropertyAction::matchTargets
-*/
QString QmlPropertyAnimation::properties() const
{
Q_D(const QmlPropertyAnimation);
@@ -2065,37 +2167,86 @@ void QmlPropertyAnimation::setProperties(const QString &prop)
}
/*!
- \qmlproperty list<Object> PropertyAnimation::matchTargets
- This property holds a list of objects this animation will match against.
- These objects are used in conjunction with matchProperties to create a list of properties
- that the animation will animate, assuming those properties have changed.
+ \qmlproperty string PropertyAnimation::property
+ \qmlproperty string PropertyAnimation::properties
+ \qmlproperty Object PropertyAnimation::target
+ \qmlproperty list<Object> PropertyAnimation::targets
- In the following example, the changes to \c myItem will be animated by the transition, while
- the changes to \c myOtherItem will not.
+ These properties are used as a set to determine which properties should be animated.
+ The singular and plural forms are functionally identical, e.g.
\qml
- State {
- PropertyChanges {
- target: myItem
- x: 15; y: 15
- }
- PropertyChanges {
- target: myOtherItem
- x: 30; y: 30
- }
- }
- Transition {
- PropertyAnimation {
- matchTargets: myItem
- matchProperties: "x,y"
- }
- }
+ NumberAnimation { target: theItem; property: "x"; to: 500 }
+ \endqml
+ has the same meaning as
+ \qml
+ NumberAnimation { targets: theItem; properties: "x"; to: 500 }
\endqml
+ The singular forms are slightly optimized, so if you do have only a single target/property
+ to animate you should try to use them.
- This property is typically used for an animation appearing as part of a Transition.
+ In many cases these properties do not need to be explicitly specified -- they can be
+ inferred from the animation framework.
+ \table 80%
+ \row
+ \o Value Source / Behavior
+ \o When an animation is used as a value source or in a Behavior, the default target and property
+ name to be animated can both be inferred.
+ \qml
+ Rectangle {
+ id: theRect
+ width: 100; height: 100
+ color: Qt.rgba(0,0,1)
+ x: NumberAnimation { to: 500; repeat: true } //animate theRect's x property
+ y: Behavior { NumberAnimation {} } //animate theRect's y property
+ }
+ \endqml
+ \row
+ \o Transition
+ \o When used in a transition, a property animation is assumed to match \e all targets
+ but \e no properties. In practice, that means you need to specify at least the properties
+ in order for the animation to do anything.
+ \qml
+ Rectangle {
+ id: theRect
+ width: 100; height: 100
+ color: Qt.rgba(0,0,1)
+ Item { id: uselessItem }
+ states: State {
+ name: "state1"
+ PropertyChanges { target: theRect; x: 200; y: 200; z: 4 }
+ PropertyChanges { target: uselessItem; x: 10; y: 10; z: 2 }
+ }
+ transitions: Transition {
+ //animate both theRect's and uselessItem's x and y to their final values
+ NumberAnimation { properties: "x,y" }
+
+ //animate theRect's z to its final value
+ NumberAnimation { target: theRect; property: "z" }
+ }
+ }
+ \endqml
+ \row
+ \o Standalone
+ \o When an animation is used standalone, both the target and property need to be
+ explicitly specified.
+ \qml
+ Rectangle {
+ id: theRect
+ width: 100; height: 100
+ color: Qt.rgba(0,0,1)
+ //need to explicitly specify target and property
+ NumberAnimation { id: theAnim; target: theRect; property: "x" to: 500 }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: theAnim.start()
+ }
+ }
+ \endqml
+ \endtable
- By default, all changing targets will be matched.
-
- \sa exclude matchProperties
+ As seen in the above example, properties is specified as a comma-separated string of property names to animate.
+
+ \sa exclude
*/
QmlListProperty<QObject> QmlPropertyAnimation::targets()
{
@@ -2106,7 +2257,7 @@ QmlListProperty<QObject> QmlPropertyAnimation::targets()
/*!
\qmlproperty list<Object> PropertyAnimation::exclude
This property holds the items not to be affected by this animation.
- \sa matchTargets
+ \sa targets
*/
QmlListProperty<QObject> QmlPropertyAnimation::exclude()
{
@@ -2114,152 +2265,119 @@ QmlListProperty<QObject> QmlPropertyAnimation::exclude()
return QmlListProperty<QObject>(this, d->exclude);
}
-void QmlPropertyAnimationPrivate::valueChanged(qreal r)
-{
- if (!fromSourced) {
- if (!fromIsDefined) {
- from = property.read();
- convertVariant(from, interpolatorType ? interpolatorType : property.propertyType());
- //### check for invalid variant if using property type
- }
- fromSourced = true;
- }
-
- if (r == 1.) {
- property.write(to, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
- } else {
- if (interpolator)
- property.write(interpolator(from.constData(), to.constData(), r), QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
- }
-}
-
QAbstractAnimation *QmlPropertyAnimation::qtAnimation()
{
Q_D(QmlPropertyAnimation);
return d->va;
}
-void QmlPropertyAnimation::prepare(QmlMetaProperty &p)
+struct PropertyUpdater : public QmlTimeLineValue
{
- Q_D(QmlPropertyAnimation);
- if (d->userProperty.isNull)
- d->property = p;
- else
- d->property = d->userProperty;
-
- if (!d->rangeIsSet) {
- d->va->setStartValue(qreal(0));
- d->va->setEndValue(qreal(1));
- d->rangeIsSet = true;
- }
-
- int propType = d->property.propertyType();
- d->convertVariant(d->to, d->interpolatorType ? d->interpolatorType : propType);
- if (d->fromIsDefined)
- d->convertVariant(d->from, d->interpolatorType ? d->interpolatorType : propType);
-
- if (!d->interpolatorType) {
- //### check for invalid variants
- d->interpolator = QVariantAnimationPrivate::getInterpolator(propType);
+ QmlStateActions actions;
+ int interpolatorType; //for Number/ColorAnimation
+ int prevInterpolatorType; //for generic
+ QVariantAnimation::Interpolator interpolator;
+ bool reverse;
+ bool fromSourced;
+ bool fromDefined;
+ bool *wasDeleted;
+ PropertyUpdater() : wasDeleted(0) {}
+ ~PropertyUpdater() { if (wasDeleted) *wasDeleted = true; }
+ void setValue(qreal v)
+ {
+ bool deleted = false;
+ wasDeleted = &deleted;
+ if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1
+ v = 1 - v;
+ QmlTimeLineValue::setValue(v);
+ for (int ii = 0; ii < actions.count(); ++ii) {
+ QmlAction &action = actions[ii];
+
+ if (v == 1.)
+ action.property.write(action.toValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
+ else {
+ if (!fromSourced && !fromDefined) {
+ action.fromValue = action.property.read();
+ if (interpolatorType)
+ QmlPropertyAnimationPrivate::convertVariant(action.fromValue, interpolatorType);
+ }
+ if (!interpolatorType) {
+ int propType = action.property.propertyType();
+ if (!prevInterpolatorType || prevInterpolatorType != propType) {
+ prevInterpolatorType = propType;
+ interpolator = QVariantAnimationPrivate::getInterpolator(prevInterpolatorType);
+ }
+ }
+ if (interpolator)
+ action.property.write(interpolator(action.fromValue.constData(), action.toValue.constData(), v), QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
+ }
+ if (deleted)
+ return;
+ }
+ wasDeleted = 0;
+ fromSourced = true;
}
-
- d->fromSourced = false;
- d->value.QmlTimeLineValue::setValue(0.);
- d->va->setAnimValue(&d->value, QAbstractAnimation::KeepWhenStopped);
- d->va->setFromSourcedValue(&d->fromSourced);
-}
+};
void QmlPropertyAnimation::transition(QmlStateActions &actions,
QmlMetaProperties &modified,
TransitionDirection direction)
{
Q_D(QmlPropertyAnimation);
- Q_UNUSED(direction);
-
- struct PropertyUpdater : public QmlTimeLineValue
- {
- QmlStateActions actions;
- int interpolatorType; //for Number/ColorAnimation
- int prevInterpolatorType; //for generic
- QVariantAnimation::Interpolator interpolator;
- bool reverse;
- bool *wasDeleted;
- PropertyUpdater() : wasDeleted(0) {}
- ~PropertyUpdater() { if (wasDeleted) *wasDeleted = true; }
- void setValue(qreal v)
- {
- bool deleted = false;
- wasDeleted = &deleted;
- if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1
- v = 1 - v;
- QmlTimeLineValue::setValue(v);
- for (int ii = 0; ii < actions.count(); ++ii) {
- QmlAction &action = actions[ii];
-
- if (v == 1.)
- action.property.write(action.toValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
- else {
- if (action.fromValue.isNull()) {
- action.fromValue = action.property.read();
- if (interpolatorType)
- QmlPropertyAnimationPrivate::convertVariant(action.fromValue, interpolatorType);
- }
- if (!interpolatorType) {
- int propType = action.property.propertyType();
- if (!prevInterpolatorType || prevInterpolatorType != propType) {
- prevInterpolatorType = propType;
- interpolator = QVariantAnimationPrivate::getInterpolator(prevInterpolatorType);
- }
- }
- if (interpolator)
- action.property.write(interpolator(action.fromValue.constData(), action.toValue.constData(), v), QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
- }
- if (deleted)
- return;
- }
- wasDeleted = 0;
- }
- };
QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(','));
for (int ii = 0; ii < props.count(); ++ii)
props[ii] = props.at(ii).trimmed();
+ if (!d->propertyName.isEmpty())
+ props << d->propertyName;
- bool hasSelectors = !props.isEmpty() || !d->targets.isEmpty() || !d->exclude.isEmpty();
- bool hasTarget = !d->propertyName.isEmpty() || d->target;
+ QList<QObject*> targets = d->targets;
+ if (d->target)
+ targets.append(d->target);
- if (hasSelectors && hasTarget) {
- qmlInfo(this) << tr("matchTargets/matchProperties/exclude and target/property are mutually exclusive.");
- return;
+ bool hasSelectors = !props.isEmpty() || !targets.isEmpty() || !d->exclude.isEmpty();
+ bool useType = (props.isEmpty() && d->defaultToInterpolatorType) ? true : false;
+
+ if (d->defaultProperty.isValid() && !hasSelectors) {
+ props << d->defaultProperty.name();
+ targets << d->defaultProperty.object();
}
- bool useType = (props.isEmpty() && d->propertyName.isEmpty() && d->defaultToInterpolatorType) ? true : false;
+ if (props.isEmpty() && !d->defaultProperties.isEmpty()) {
+ props << d->defaultProperties.split(QLatin1Char(','));
+ }
PropertyUpdater *data = new PropertyUpdater;
data->interpolatorType = d->interpolatorType;
data->interpolator = d->interpolator;
data->reverse = direction == Backward ? true : false;
+ data->fromSourced = false;
+ data->fromDefined = d->fromIsDefined;
bool hasExplicit = false;
//an explicit animation has been specified
- if (hasTarget && d->toIsDefined) {
- QmlAction myAction;
- myAction.property = d->createProperty(target(), d->propertyName, this);
- if (myAction.property.isValid()) {
- if (d->fromIsDefined) {
- d->convertVariant(d->from, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
- myAction.fromValue = d->from;
- }
- d->convertVariant(d->to, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
- myAction.toValue = d->to;
- data->actions << myAction;
- hasExplicit = true;
- for (int ii = 0; ii < actions.count(); ++ii) {
- QmlAction &action = actions[ii];
- if (action.property.object() == myAction.property.object() &&
- myAction.property.name() == action.property.name()) {
- modified << action.property;
- break; //### any chance there could be multiples?
+ if (d->toIsDefined) {
+ for (int i = 0; i < props.count(); ++i) {
+ for (int j = 0; j < targets.count(); ++j) {
+ QmlAction myAction;
+ myAction.property = d->createProperty(targets.at(j), props.at(i), this);
+ if (myAction.property.isValid()) {
+ if (d->fromIsDefined) {
+ myAction.fromValue = d->from;
+ d->convertVariant(myAction.fromValue, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
+ }
+ myAction.toValue = d->to;
+ d->convertVariant(myAction.toValue, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
+ data->actions << myAction;
+ hasExplicit = true;
+ for (int ii = 0; ii < actions.count(); ++ii) {
+ QmlAction &action = actions[ii];
+ if (action.property.object() == myAction.property.object() &&
+ myAction.property.name() == action.property.name()) {
+ modified << action.property;
+ break; //### any chance there could be multiples?
+ }
+ }
}
}
}
@@ -2275,7 +2393,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
QString sPropertyName = action.specifiedProperty;
bool same = (obj == sObj);
- if ((d->targets.isEmpty() || d->targets.contains(obj) || (!same && d->targets.contains(sObj))) &&
+ if ((targets.isEmpty() || targets.contains(obj) || (!same && targets.contains(sObj))) &&
(!d->exclude.contains(obj)) && (same || (!d->exclude.contains(sObj))) &&
(props.contains(propertyName) || (!same && props.contains(sPropertyName))
|| (useType && action.property.propertyType() == d->interpolatorType))) {
@@ -2295,29 +2413,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
data->actions << myAction;
action.fromValue = myAction.toValue;
- } else if (d->userProperty.isValid() &&
- !hasSelectors && !hasTarget) {
- if ((d->userProperty.value.object() == obj || (!same && d->userProperty.value.object() == sObj)) &&
- (d->userProperty.value.name() == propertyName || (!same && d->userProperty.value.name() == sPropertyName))) {
- //### same as above. merge
- QmlAction myAction = action;
-
- if (d->fromIsDefined)
- myAction.fromValue = d->from;
- else
- myAction.fromValue = QVariant();
- if (d->toIsDefined)
- myAction.toValue = d->to;
-
- d->convertVariant(myAction.fromValue, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
- d->convertVariant(myAction.toValue, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
-
- modified << action.property;
-
- data->actions << myAction;
- action.fromValue = myAction.toValue;
- }
- }
+ }
}
if (data->actions.count()) {
@@ -2327,6 +2423,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
d->rangeIsSet = true;
}
d->va->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
+ d->va->setFromSourcedValue(&data->fromSourced);
} else {
delete data;
}
diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h
index a566074..623ad8d 100644
--- a/src/declarative/util/qmlanimation_p.h
+++ b/src/declarative/util/qmlanimation_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -94,7 +94,8 @@ public:
QmlAnimationGroup *group() const;
void setGroup(QmlAnimationGroup *);
- virtual void setTarget(const QmlMetaProperty &);
+ void setDefaultTarget(const QmlMetaProperty &);
+ void setDisableUserControl();
void classBegin();
void componentComplete();
@@ -123,11 +124,13 @@ public:
virtual void transition(QmlStateActions &actions,
QmlMetaProperties &modified,
TransitionDirection direction);
- virtual void prepare(QmlMetaProperty &);
virtual QAbstractAnimation *qtAnimation() = 0;
private Q_SLOTS:
void timelineComplete();
+
+private:
+ virtual void setTarget(const QmlMetaProperty &);
};
class QmlPauseAnimationPrivate;
@@ -186,8 +189,8 @@ class QmlPropertyAction : public QmlAbstractAnimation
Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged)
- Q_PROPERTY(QString matchProperties READ properties WRITE setProperties NOTIFY propertiesChanged)
- Q_PROPERTY(QmlListProperty<QObject> matchTargets READ targets)
+ Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged)
+ Q_PROPERTY(QmlListProperty<QObject> targets READ targets)
Q_PROPERTY(QmlListProperty<QObject> exclude READ exclude)
Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
@@ -220,7 +223,6 @@ protected:
QmlMetaProperties &modified,
TransitionDirection direction);
virtual QAbstractAnimation *qtAnimation();
- virtual void prepare(QmlMetaProperty &);
};
class QmlGraphicsItem;
@@ -231,8 +233,7 @@ class QmlParentAction : public QmlAbstractAnimation
Q_DECLARE_PRIVATE(QmlParentAction)
Q_PROPERTY(QmlGraphicsItem *target READ object WRITE setObject)
- Q_PROPERTY(QmlGraphicsItem *matchTarget READ matchTarget WRITE setMatchTarget)
- Q_PROPERTY(QmlGraphicsItem *parent READ parent WRITE setParent)
+ Q_PROPERTY(QmlGraphicsItem *parent READ parent WRITE setParent) //### newParent
public:
QmlParentAction(QObject *parent=0);
@@ -241,9 +242,6 @@ public:
QmlGraphicsItem *object() const;
void setObject(QmlGraphicsItem *);
- QmlGraphicsItem *matchTarget() const;
- void setMatchTarget(QmlGraphicsItem *);
-
QmlGraphicsItem *parent() const;
void setParent(QmlGraphicsItem *);
@@ -266,8 +264,8 @@ class Q_AUTOTEST_EXPORT QmlPropertyAnimation : public QmlAbstractAnimation
Q_PROPERTY(QString easing READ easing WRITE setEasing NOTIFY easingChanged)
Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged)
- Q_PROPERTY(QString matchProperties READ properties WRITE setProperties NOTIFY propertiesChanged)
- Q_PROPERTY(QmlListProperty<QObject> matchTargets READ targets)
+ Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged)
+ Q_PROPERTY(QmlListProperty<QObject> targets READ targets)
Q_PROPERTY(QmlListProperty<QObject> exclude READ exclude)
public:
@@ -299,11 +297,11 @@ public:
QmlListProperty<QObject> exclude();
protected:
+ QmlPropertyAnimation(QmlPropertyAnimationPrivate &dd, QObject *parent);
virtual void transition(QmlStateActions &actions,
QmlMetaProperties &modified,
TransitionDirection direction);
virtual QAbstractAnimation *qtAnimation();
- virtual void prepare(QmlMetaProperty &);
Q_SIGNALS:
void durationChanged(int);
@@ -370,6 +368,35 @@ public:
void setTo(QVector3D);
};
+class QmlRotationAnimationPrivate;
+class Q_AUTOTEST_EXPORT QmlRotationAnimation : public QmlPropertyAnimation
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QmlRotationAnimation)
+ Q_ENUMS(RotationDirection)
+
+ Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged)
+ Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged)
+ Q_PROPERTY(RotationDirection direction READ direction WRITE setDirection NOTIFY directionChanged)
+
+public:
+ QmlRotationAnimation(QObject *parent=0);
+ virtual ~QmlRotationAnimation();
+
+ qreal from() const;
+ void setFrom(qreal);
+
+ qreal to() const;
+ void setTo(qreal);
+
+ enum RotationDirection { Numerical, Shortest, Clockwise, Counterclockwise };
+ RotationDirection direction() const;
+ void setDirection(RotationDirection direction);
+
+Q_SIGNALS:
+ void directionChanged();
+};
+
class QmlAnimationGroupPrivate;
class QmlAnimationGroup : public QmlAbstractAnimation
{
@@ -377,13 +404,13 @@ class QmlAnimationGroup : public QmlAbstractAnimation
Q_DECLARE_PRIVATE(QmlAnimationGroup)
Q_CLASSINFO("DefaultProperty", "animations")
- Q_PROPERTY(QmlList<QmlAbstractAnimation *> *animations READ animations)
+ Q_PROPERTY(QmlListProperty<QmlAbstractAnimation> animations READ animations)
public:
QmlAnimationGroup(QObject *parent);
virtual ~QmlAnimationGroup();
- QmlList<QmlAbstractAnimation *>* animations();
+ QmlListProperty<QmlAbstractAnimation> animations();
friend class QmlAbstractAnimation;
};
@@ -401,7 +428,6 @@ protected:
QmlMetaProperties &modified,
TransitionDirection direction);
virtual QAbstractAnimation *qtAnimation();
- virtual void prepare(QmlMetaProperty &);
};
class QmlParallelAnimation : public QmlAnimationGroup
@@ -418,7 +444,6 @@ protected:
QmlMetaProperties &modified,
TransitionDirection direction);
virtual QAbstractAnimation *qtAnimation();
- virtual void prepare(QmlMetaProperty &);
};
QT_END_NAMESPACE
@@ -434,6 +459,7 @@ QML_DECLARE_TYPE(QmlNumberAnimation)
QML_DECLARE_TYPE(QmlSequentialAnimation)
QML_DECLARE_TYPE(QmlParallelAnimation)
QML_DECLARE_TYPE(QmlVector3dAnimation)
+QML_DECLARE_TYPE(QmlRotationAnimation)
QT_END_HEADER
diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h
index d680194..056ce82 100644
--- a/src/declarative/util/qmlanimation_p_p.h
+++ b/src/declarative/util/qmlanimation_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -108,6 +108,8 @@ public:
{
if (state() == Running)
stop();
+ if (policy == DeleteWhenStopped)
+ delete animAction;
animAction = action;
policy = p;
}
@@ -126,12 +128,12 @@ protected:
animAction = 0;
}
}
- } else if (newState == Stopped && policy == DeleteWhenStopped) {
+ } /*else if (newState == Stopped && policy == DeleteWhenStopped) {
if (!running) {
delete animAction;
animAction = 0;
}
- }
+ }*/
}
private:
@@ -151,6 +153,8 @@ public:
{
if (state() == Running)
stop();
+ if (policy == DeleteWhenStopped)
+ delete animValue;
animValue = value;
policy = p;
}
@@ -165,16 +169,17 @@ protected:
animValue->setValue(value.toReal());
}
virtual void updateState(State newState, State oldState)
- {
+ {
QVariantAnimation::updateState(newState, oldState);
if (newState == Running) {
//check for new from every loop
if (fromSourced)
*fromSourced = false;
- } else if (newState == Stopped && policy == DeleteWhenStopped) {
+ } /*else if (newState == Stopped && policy == DeleteWhenStopped) {
delete animValue;
animValue = 0;
- }
+ }*/ //### we get a stop each loop if we are in a group
+ //### top-level animation is the only reliable one for this
}
private:
@@ -204,24 +209,22 @@ class QmlAbstractAnimationPrivate : public QObjectPrivate
public:
QmlAbstractAnimationPrivate()
: running(false), paused(false), alwaysRunToEnd(false), repeat(false),
- connectedTimeLine(false), componentComplete(true), startOnCompletion(false),
- avoidPropertyValueSourceStart(false), group(0) {}
+ connectedTimeLine(false), componentComplete(true),
+ avoidPropertyValueSourceStart(false), disableUserControl(false), group(0) {}
bool running:1;
bool paused:1;
bool alwaysRunToEnd:1;
bool repeat:1;
bool connectedTimeLine:1;
-
bool componentComplete:1;
- bool startOnCompletion:1;
bool avoidPropertyValueSourceStart:1;
+ bool disableUserControl:1;
void commence();
- QmlNullableValue<QmlMetaProperty> userProperty;
+ QmlMetaProperty defaultProperty;
- QmlMetaProperty property;
QmlAnimationGroup *group;
static QmlMetaProperty createProperty(QObject *obj, const QString &str, QObject *infoObj);
@@ -265,7 +268,7 @@ class QmlPropertyActionPrivate : public QmlAbstractAnimationPrivate
Q_DECLARE_PUBLIC(QmlPropertyAction)
public:
QmlPropertyActionPrivate()
- : QmlAbstractAnimationPrivate(), target(0), proxy(this), spa(0) {}
+ : QmlAbstractAnimationPrivate(), target(0), spa(0) {}
void init();
@@ -277,10 +280,6 @@ public:
QmlNullableValue<QVariant> value;
- void doAction();
-
- QAnimationActionProxy<QmlPropertyActionPrivate,
- &QmlPropertyActionPrivate::doAction> proxy;
QActionAnimation *spa;
};
@@ -289,12 +288,11 @@ class QmlParentActionPrivate : public QmlAbstractAnimationPrivate
Q_DECLARE_PUBLIC(QmlParentAction)
public:
QmlParentActionPrivate()
- : QmlAbstractAnimationPrivate(), pcTarget(0), pcMatchTarget(0), pcParent(0) {}
+ : QmlAbstractAnimationPrivate(), pcTarget(0), pcParent(0) {}
void init();
QmlGraphicsItem *pcTarget;
- QmlGraphicsItem *pcMatchTarget;
QmlGraphicsItem *pcParent;
void doAction();
@@ -306,37 +304,13 @@ class QmlAnimationGroupPrivate : public QmlAbstractAnimationPrivate
Q_DECLARE_PUBLIC(QmlAnimationGroup)
public:
QmlAnimationGroupPrivate()
- : QmlAbstractAnimationPrivate(), animations(this), ag(0) {}
+ : QmlAbstractAnimationPrivate(), ag(0) {}
- struct AnimationList : public QmlConcreteList<QmlAbstractAnimation *>
- {
- AnimationList(QmlAnimationGroupPrivate *p)
- : anim(p) {}
- virtual void append(QmlAbstractAnimation *a) {
- QmlConcreteList<QmlAbstractAnimation *>::append(a);
- a->setGroup(anim->q_func());
- }
- virtual void clear()
- {
- for (int i = 0; i < count(); ++i)
- at(i)->setGroup(0);
- QmlConcreteList<QmlAbstractAnimation *>::clear();
- }
- virtual void removeAt(int i)
- {
- at(i)->setGroup(0);
- QmlConcreteList<QmlAbstractAnimation *>::removeAt(i);
- }
- virtual void insert(int i, QmlAbstractAnimation *a)
- {
- QmlConcreteList<QmlAbstractAnimation *>::insert(i, a);
- a->setGroup(anim->q_func());
- }
-
- QmlAnimationGroupPrivate *anim;
- };
-
- AnimationList animations;
+ static void append_animation(QmlListProperty<QmlAbstractAnimation> *list, QmlAbstractAnimation *role);
+ static void clear_animation(QmlListProperty<QmlAbstractAnimation> *list);
+ static void removeAt_animation(QmlListProperty<QmlAbstractAnimation> *list, int i);
+ static void insert_animation(QmlListProperty<QmlAbstractAnimation> *list, int i, QmlAbstractAnimation *role);
+ QList<QmlAbstractAnimation *> animations;
QAnimationGroup *ag;
};
@@ -346,8 +320,7 @@ class QmlPropertyAnimationPrivate : public QmlAbstractAnimationPrivate
public:
QmlPropertyAnimationPrivate()
: QmlAbstractAnimationPrivate(), target(0), fromSourced(false), fromIsDefined(false), toIsDefined(false),
- rangeIsSet(false), defaultToInterpolatorType(0), interpolatorType(0), interpolator(0), va(0),
- value(this, &QmlPropertyAnimationPrivate::valueChanged) {}
+ rangeIsSet(false), defaultToInterpolatorType(0), interpolatorType(0), interpolator(0), va(0) {}
void init();
@@ -361,6 +334,7 @@ public:
QString properties;
QList<QObject *> targets;
QList<QObject *> exclude;
+ QString defaultProperties;
bool fromSourced;
bool fromIsDefined:1;
@@ -371,14 +345,20 @@ public:
QVariantAnimation::Interpolator interpolator;
QmlTimeLineValueAnimator *va;
- virtual void valueChanged(qreal);
-
- QmlTimeLineValueProxy<QmlPropertyAnimationPrivate> value;
static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress);
static void convertVariant(QVariant &variant, int type);
};
+class QmlRotationAnimationPrivate : public QmlPropertyAnimationPrivate
+{
+ Q_DECLARE_PUBLIC(QmlRotationAnimation)
+public:
+ QmlRotationAnimationPrivate() : direction(QmlRotationAnimation::Shortest) {}
+
+ QmlRotationAnimation::RotationDirection direction;
+};
+
QT_END_NAMESPACE
#endif // QMLANIMATION_P_H
diff --git a/src/declarative/util/qmlbehavior.cpp b/src/declarative/util/qmlbehavior.cpp
index b9c77f5..d65d8cd 100644
--- a/src/declarative/util/qmlbehavior.cpp
+++ b/src/declarative/util/qmlbehavior.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -119,13 +119,15 @@ void QmlBehavior::setAnimation(QmlAbstractAnimation *animation)
{
Q_D(QmlBehavior);
if (d->animation) {
- qmlInfo(this) << tr("Can't change the animation assigned to a Behavior.");
+ qmlInfo(this) << tr("Cannot change the animation assigned to a Behavior.");
return;
}
d->animation = animation;
- if (d->animation)
- d->animation->setTarget(d->property);
+ if (d->animation) {
+ d->animation->setDefaultTarget(d->property);
+ d->animation->setDisableUserControl();
+ }
}
/*!
@@ -183,7 +185,7 @@ void QmlBehavior::setTarget(const QmlMetaProperty &property)
d->property = property;
d->currentValue = property.read();
if (d->animation)
- d->animation->setTarget(property);
+ d->animation->setDefaultTarget(property);
}
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlbehavior_p.h b/src/declarative/util/qmlbehavior_p.h
index da3b40f..ee9e862 100644
--- a/src/declarative/util/qmlbehavior_p.h
+++ b/src/declarative/util/qmlbehavior_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlbind.cpp b/src/declarative/util/qmlbind.cpp
index c68cef2..fc1562b 100644
--- a/src/declarative/util/qmlbind.cpp
+++ b/src/declarative/util/qmlbind.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlbind_p.h b/src/declarative/util/qmlbind_p.h
index 4d7cd1f..6fdd2dc 100644
--- a/src/declarative/util/qmlbind_p.h
+++ b/src/declarative/util/qmlbind_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlconnection.cpp b/src/declarative/util/qmlconnection.cpp
index 800fd6b..3d04aaf 100644
--- a/src/declarative/util/qmlconnection.cpp
+++ b/src/declarative/util/qmlconnection.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -72,7 +72,7 @@ public:
"on<Signal>" handler that reacts when a signal is received, like this:
\qml
- MouseRegion {
+ MouseArea {
onClicked: { foo(x+123,y+456) }
}
\endqml
@@ -94,7 +94,7 @@ public:
like this:
\qml
- MouseRegion {
+ MouseArea {
Connection {
signal: "clicked(x,y)"
script: { foo(x+123,y+456) }
@@ -106,7 +106,7 @@ public:
the sender of the signal, and the script is the default attribute:
\qml
- MouseRegion {
+ MouseArea {
id: mr
}
...
diff --git a/src/declarative/util/qmlconnection_p.h b/src/declarative/util/qmlconnection_p.h
index 52bc247..2106cb0 100644
--- a/src/declarative/util/qmlconnection_p.h
+++ b/src/declarative/util/qmlconnection_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmldatetimeformatter.cpp b/src/declarative/util/qmldatetimeformatter.cpp
index 9d216cf..c44ca5e 100644
--- a/src/declarative/util/qmldatetimeformatter.cpp
+++ b/src/declarative/util/qmldatetimeformatter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmldatetimeformatter_p.h b/src/declarative/util/qmldatetimeformatter_p.h
index c90ee8c..2cd80b9 100644
--- a/src/declarative/util/qmldatetimeformatter_p.h
+++ b/src/declarative/util/qmldatetimeformatter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmleasefollow.cpp b/src/declarative/util/qmleasefollow.cpp
index e3153b1..deb474a 100644
--- a/src/declarative/util/qmleasefollow.cpp
+++ b/src/declarative/util/qmleasefollow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -300,6 +300,13 @@ Rectangle {
}
\endcode
+ The default velocity of EaseFollow is 200 units/second. Note that if the range of the
+ value being animated is small, then the velocity will need to be adjusted
+ appropriately. For example, the opacity of an item ranges from 0 - 1.0.
+ To enable a smooth animation in this range the velocity will need to be
+ set to a value such as 0.5 units/second. Animating from 0 to 1.0 with a velocity
+ of 0.5 will take 2000 ms to complete.
+
\sa SpringFollow
*/
@@ -415,7 +422,7 @@ void QmlEaseFollow::setSourceValue(qreal s)
This property holds the animation duration used when tracking the source.
- Setting this to -1 disables the duration value.
+ Setting this to -1 (the default) disables the duration value.
*/
qreal QmlEaseFollow::duration() const
{
@@ -449,6 +456,8 @@ qreal QmlEaseFollow::velocity() const
This property holds the average velocity allowed when tracking the source.
+ The default velocity of EaseFollow is 200 units/second.
+
Setting this to -1 disables the velocity value.
*/
void QmlEaseFollow::setVelocity(qreal v)
diff --git a/src/declarative/util/qmleasefollow_p.h b/src/declarative/util/qmleasefollow_p.h
index ef095a3..dddf54f 100644
--- a/src/declarative/util/qmleasefollow_p.h
+++ b/src/declarative/util/qmleasefollow_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlfontloader.cpp b/src/declarative/util/qmlfontloader.cpp
index b56043b..4599b99 100644
--- a/src/declarative/util/qmlfontloader.cpp
+++ b/src/declarative/util/qmlfontloader.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlfontloader_p.h b/src/declarative/util/qmlfontloader_p.h
index aac8a71..3d27452 100644
--- a/src/declarative/util/qmlfontloader_p.h
+++ b/src/declarative/util/qmlfontloader_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qmllistaccessor.cpp
index 2e37d49..abdb626 100644
--- a/src/declarative/util/qmllistaccessor.cpp
+++ b/src/declarative/util/qmllistaccessor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -84,10 +84,7 @@ void QmlListAccessor::setList(const QVariant &v, QmlEngine *engine)
QObject *data = enginePrivate?enginePrivate->toQObject(v):QmlMetaType::toQObject(v);
d = QVariant::fromValue(data);
m_type = Instance;
- } else if ((!enginePrivate && QmlMetaType::isQmlList(d.userType())) ||
- (enginePrivate && enginePrivate->isQmlList(d.userType()))) {
- m_type = QmlList;
- } else if (QmlMetaType::isList(d.userType())) {
+ } else if (d.userType() == qMetaTypeId<QmlListReference>()) {
m_type = ListProperty;
} else {
m_type = Instance;
@@ -101,17 +98,8 @@ int QmlListAccessor::count() const
return qvariant_cast<QStringList>(d).count();
case VariantList:
return qvariant_cast<QVariantList>(d).count();
- case QmlList:
- {
- QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData();
- return li->count();
- }
case ListProperty:
- {
- QmlListProperty<void> *li = (QmlListProperty<void>*)d.constData();
- if (li->count) return li->count(li);
- else return 0;
- }
+ return ((QmlListReference *)d.constData())->count();
case Instance:
return 1;
case Integer:
@@ -130,19 +118,8 @@ QVariant QmlListAccessor::at(int idx) const
return QVariant::fromValue(qvariant_cast<QStringList>(d).at(idx));
case VariantList:
return qvariant_cast<QVariantList>(d).at(idx);
- case QmlList:
- {
- QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData();
- void *ptr[1];
- li->at(idx, ptr);
- return QVariant::fromValue((QObject*)ptr[0]);
- }
case ListProperty:
- {
- QmlListProperty<void> *li = (QmlListProperty<void>*)d.constData();
- if (li->at) return QVariant::fromValue((QObject *)li->at(li, idx));
- else return QVariant();
- }
+ return QVariant::fromValue(((QmlListReference *)d.constData())->at(idx));
case Instance:
return d;
case Integer:
@@ -153,106 +130,6 @@ QVariant QmlListAccessor::at(int idx) const
}
}
-bool QmlListAccessor::append(const QVariant &value)
-{
- switch(m_type) {
- case QmlList:
- {
- QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData();
- li->append(const_cast<void *>(value.constData())); //XXX Typesafety
- return true;
- }
- case ListProperty:
- {
- QmlListProperty<void> *li = (QmlListProperty<void>*)d.constData();
- if (li->append) li->append(li, *(void **)value.constData()); // XXX Typesafety
- return true;
- }
- case StringList:
- case VariantList:
- case Invalid:
- case Instance:
- case Integer:
- default:
- return false;
- }
-}
-
-bool QmlListAccessor::insert(int index, const QVariant &value)
-{
- switch(m_type) {
- case QmlList:
- {
- QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData();
- li->insert(index, const_cast<void *>(value.constData())); //XXX Typesafety
- return true;
- }
- case ListProperty:
- {
- QmlListProperty<void> *li = (QmlListProperty<void>*)d.constData();
- if (li->insert) li->insert(li, index, *(void **)value.constData()); // XXX Typesafety
- return true;
- }
- case StringList:
- case VariantList:
- case Invalid:
- case Instance:
- case Integer:
- default:
- return false;
- }
-}
-
-bool QmlListAccessor::removeAt(int index)
-{
- switch(m_type) {
- case QmlList:
- {
- QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData();
- li->removeAt(index);
- return true;
- }
- case ListProperty:
- {
- QmlListProperty<void> *li = (QmlListProperty<void>*)d.constData();
- if (li->removeAt) li->removeAt(li, index);
- return true;
- }
- case StringList:
- case VariantList:
- case Invalid:
- case Instance:
- case Integer:
- default:
- return false;
- }
-}
-
-bool QmlListAccessor::clear()
-{
- switch(m_type) {
- case QmlList:
- {
- QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData();
- li->clear();
- return true;
- }
- case ListProperty:
- {
- QmlListProperty<void> *li = (QmlListProperty<void>*)d.constData();
- if (li->clear) li->clear(li);
- return true;
- }
- case StringList:
- case VariantList:
- case Invalid:
- case Instance:
- case Integer:
- default:
- return false;
- }
-}
-
bool QmlListAccessor::isValid() const
{
return m_type != Invalid;
diff --git a/src/declarative/util/qmllistaccessor_p.h b/src/declarative/util/qmllistaccessor_p.h
index 6866150..611eebb 100644
--- a/src/declarative/util/qmllistaccessor_p.h
+++ b/src/declarative/util/qmllistaccessor_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -65,12 +65,7 @@ public:
int count() const;
QVariant at(int) const;
- bool append(const QVariant &);
- bool insert(int, const QVariant &);
- bool removeAt(int);
- bool clear();
-
- enum Type { Invalid, StringList, VariantList, QmlList, ListProperty, Instance, Integer };
+ enum Type { Invalid, StringList, VariantList, ListProperty, Instance, Integer };
Type type() const { return m_type; }
private:
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index 61fc50d..8fda3ae 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -188,7 +188,7 @@ static void dump(ModelNode *node, int ind);
Text { text: '$'+cost; anchors.right: parent.right }
// Double the price when clicked.
- MouseRegion {
+ MouseArea {
anchors.fill: parent
onClicked: fruitModel.set(index, "cost", cost*2)
}
@@ -806,7 +806,23 @@ bool QmlListModelParser::compileProperty(const QmlCustomParserProperty &prop, QL
qvariant_cast<QmlParser::Variant>(value);
int ref = data.count();
- QByteArray d = variant.asScript().toUtf8();
+
+ QByteArray d;
+ d += char(variant.type()); // type tag
+ if (variant.isString()) {
+ d += variant.asString().toUtf8();
+ } else if (variant.isNumber()) {
+ d += QByteArray::number(variant.asNumber(),'g',20);
+ } else if (variant.isBoolean()) {
+ d += char(variant.asBoolean());
+ } else if (variant.isScript()) {
+ if (definesEmptyList(variant.asScript())) {
+ d[0] = 0; // QmlParser::Variant::Invalid - marks empty list
+ } else {
+ error(prop, QmlListModel::tr("ListElement: cannot use script for property value"));
+ return false;
+ }
+ }
d.append('\0');
data.append(d);
@@ -814,7 +830,6 @@ bool QmlListModelParser::compileProperty(const QmlCustomParserProperty &prop, QL
li.type = ListInstruction::Value;
li.dataIdx = ref;
instr << li;
-
}
}
@@ -892,15 +907,22 @@ void QmlListModelParser::setCustomData(QObject *obj, const QByteArray &d)
case ListInstruction::Value:
{
ModelNode *n = nodes.top();
- QString s = QString::fromUtf8(QByteArray(data + instr.dataIdx));
-
- bool isEmptyList = false;
- if (!n->isArray)
- isEmptyList = definesEmptyList(s);
- if (isEmptyList)
+ switch (QmlParser::Variant::Type(data[instr.dataIdx])) {
+ case QmlParser::Variant::Invalid:
n->isArray = true;
- else
- n->values.append(s);
+ break;
+ case QmlParser::Variant::Boolean:
+ n->values.append(bool(data[1 + instr.dataIdx]));
+ break;
+ case QmlParser::Variant::Number:
+ n->values.append(QByteArray(data + 1 + instr.dataIdx).toDouble());
+ break;
+ case QmlParser::Variant::String:
+ n->values.append(QString::fromUtf8(data + 1 + instr.dataIdx));
+ break;
+ default:
+ Q_ASSERT("Format error in ListInstruction");
+ }
processingSet = false;
}
diff --git a/src/declarative/util/qmllistmodel_p.h b/src/declarative/util/qmllistmodel_p.h
index e18d3fd..4cf6746 100644
--- a/src/declarative/util/qmllistmodel_p.h
+++ b/src/declarative/util/qmllistmodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlnullablevalue_p_p.h b/src/declarative/util/qmlnullablevalue_p_p.h
index 151a3d4..c426258 100644
--- a/src/declarative/util/qmlnullablevalue_p_p.h
+++ b/src/declarative/util/qmlnullablevalue_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlnumberformatter.cpp b/src/declarative/util/qmlnumberformatter.cpp
index 073dc68..f78abdf 100644
--- a/src/declarative/util/qmlnumberformatter.cpp
+++ b/src/declarative/util/qmlnumberformatter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlnumberformatter_p.h b/src/declarative/util/qmlnumberformatter_p.h
index 71fceb2..d08885b 100644
--- a/src/declarative/util/qmlnumberformatter_p.h
+++ b/src/declarative/util/qmlnumberformatter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlopenmetaobject.cpp b/src/declarative/util/qmlopenmetaobject.cpp
index 1be81de..0847c47 100644
--- a/src/declarative/util/qmlopenmetaobject.cpp
+++ b/src/declarative/util/qmlopenmetaobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlopenmetaobject_p.h b/src/declarative/util/qmlopenmetaobject_p.h
index c6da71a..3f9450d 100644
--- a/src/declarative/util/qmlopenmetaobject_p.h
+++ b/src/declarative/util/qmlopenmetaobject_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qmlpackage.cpp
index 3214dc8..82f776f 100644
--- a/src/declarative/util/qmlpackage.cpp
+++ b/src/declarative/util/qmlpackage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -51,28 +51,33 @@ class QmlPackagePrivate : public QObjectPrivate
public:
QmlPackagePrivate() {}
- class DataList;
struct DataGuard : public QmlGuard<QObject>
{
- DataGuard(QObject *obj, DataList *l) : list(l) { (QmlGuard<QObject>&)*this = obj; }
- DataList *list;
+ DataGuard(QObject *obj, QList<DataGuard> *l) : list(l) { (QmlGuard<QObject>&)*this = obj; }
+ QList<DataGuard> *list;
void objectDestroyed(QObject *) {
// we assume priv will always be destroyed after objectDestroyed calls
list->removeOne(*this);
}
};
- class DataList : public QList<DataGuard>, public QmlList<QObject*>
- {
- public:
- virtual void append(QObject* v) { QList<DataGuard>::append(DataGuard(v, this)); }
- virtual void insert(int i, QObject* v) { QList<DataGuard>::insert(i, DataGuard(v, this)); }
- virtual void clear() { QList<DataGuard>::clear(); }
- virtual QObject* at(int i) const { return QList<DataGuard>::at(i); }
- virtual void removeAt(int i) { QList<DataGuard>::removeAt(i); }
- virtual int count() const { return QList<DataGuard>::count(); }
- };
- DataList dataList;
+ QList<DataGuard> dataList;
+ static void data_append(QmlListProperty<QObject> *prop, QObject *o) {
+ QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data);
+ list->append(DataGuard(o, list));
+ }
+ static void data_clear(QmlListProperty<QObject> *prop) {
+ QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data);
+ list->clear();
+ }
+ static QObject *data_at(QmlListProperty<QObject> *prop, int index) {
+ QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data);
+ return list->at(index);
+ }
+ static int data_count(QmlListProperty<QObject> *prop) {
+ QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data);
+ return list->count();
+ }
};
class QmlPackageAttached : public QObject
@@ -128,10 +133,13 @@ QmlPackage::~QmlPackage()
}
}
-QmlList<QObject *> *QmlPackage::data()
+QmlListProperty<QObject> QmlPackage::data()
{
Q_D(QmlPackage);
- return &d->dataList;
+ return QmlListProperty<QObject>(this, &d->dataList, QmlPackagePrivate::data_append,
+ QmlPackagePrivate::data_count,
+ QmlPackagePrivate::data_at,
+ QmlPackagePrivate::data_clear);
}
bool QmlPackage::hasPart(const QString &name)
diff --git a/src/declarative/util/qmlpackage_p.h b/src/declarative/util/qmlpackage_p.h
index ff42aad..29b6bbe 100644
--- a/src/declarative/util/qmlpackage_p.h
+++ b/src/declarative/util/qmlpackage_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -64,13 +64,13 @@ class QmlPackage : public QObject
Q_DECLARE_PRIVATE(QmlPackage)
Q_CLASSINFO("DefaultProperty", "data")
- Q_PROPERTY(QmlList<QObject *> *data READ data SCRIPTABLE false)
+ Q_PROPERTY(QmlListProperty<QObject> data READ data SCRIPTABLE false)
public:
QmlPackage(QObject *parent=0);
virtual ~QmlPackage();
- QmlList<QObject *> *data();
+ QmlListProperty<QObject> data();
QObject *part(const QString & = QString());
bool hasPart(const QString &);
diff --git a/src/declarative/util/qmlpixmapcache.cpp b/src/declarative/util/qmlpixmapcache.cpp
index 4e581bd..2459651 100644
--- a/src/declarative/util/qmlpixmapcache.cpp
+++ b/src/declarative/util/qmlpixmapcache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -179,11 +179,19 @@ bool QmlImageRequestHandler::event(QEvent *event)
if (reader->cancelled.count()) {
for (int i = 0; i < reader->cancelled.count(); ++i) {
QmlPixmapReply *job = reader->cancelled.at(i);
+ // cancel any jobs already started
QNetworkReply *reply = replies.key(job, 0);
if (reply && reply->isRunning()) {
replies.remove(reply);
reply->close();
- job->release(true);
+ }
+ // remove from pending job list
+ for (int j = 0; j < reader->jobs.count(); ++j) {
+ if (reader->jobs.at(j) == job) {
+ reader->jobs.removeAt(j);
+ job->release(true);
+ break;
+ }
}
}
reader->cancelled.clear();
@@ -195,8 +203,6 @@ bool QmlImageRequestHandler::event(QEvent *event)
}
QmlPixmapReply *runningJob = reader->jobs.takeLast();
- runningJob->addRef();
- runningJob->setLoading();
QUrl url = runningJob->url();
reader->mutex.unlock();
@@ -267,12 +273,12 @@ QmlImageReader::QmlImageReader(QmlEngine *eng)
QmlImageReader::~QmlImageReader()
{
- quit();
- wait();
readerMutex.lock();
readers.remove(engine);
readerMutex.unlock();
- delete handler;
+
+ quit();
+ wait();
}
QmlImageReader *QmlImageReader::instance(QmlEngine *engine)
@@ -292,6 +298,8 @@ QmlPixmapReply *QmlImageReader::getImage(const QUrl &url)
{
mutex.lock();
QmlPixmapReply *reply = new QmlPixmapReply(this, url);
+ reply->addRef();
+ reply->setLoading();
jobs.append(reply);
if (jobs.count() == 1 && handler)
QCoreApplication::postEvent(handler, new QEvent(QEvent::User));
@@ -303,21 +311,10 @@ void QmlImageReader::cancel(QmlPixmapReply *reply)
{
mutex.lock();
if (reply->isLoading()) {
- // Already requested. Add to cancel list to be cancelled in reader thread.
+ // Add to cancel list to be cancelled in reader thread.
cancelled.append(reply);
if (cancelled.count() == 1 && handler)
QCoreApplication::postEvent(handler, new QEvent(QEvent::User));
- } else {
- // Not yet processed - just remove from waiting list
- QList<QmlPixmapReply*>::iterator it = jobs.begin();
- while (it != jobs.end()) {
- QmlPixmapReply *job = *it;
- if (job == reply) {
- jobs.erase(it);
- break;
- }
- ++it;
- }
}
mutex.unlock();
}
@@ -335,6 +332,9 @@ void QmlImageReader::run()
handler = new QmlImageRequestHandler(this, engine);
exec();
+
+ delete handler;
+ handler = 0;
}
//===========================================================================
@@ -479,8 +479,6 @@ bool QmlPixmapReply::release(bool defer)
--d->refCount;
if (d->refCount == 0) {
qmlActivePixmapReplies()->remove(d->url);
- if (d->status == Loading && !d->loading)
- d->reader->cancel(this);
if (defer)
deleteLater();
else
diff --git a/src/declarative/util/qmlpixmapcache_p.h b/src/declarative/util/qmlpixmapcache_p.h
index 462faf6..86908cc 100644
--- a/src/declarative/util/qmlpixmapcache_p.h
+++ b/src/declarative/util/qmlpixmapcache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp
index 68fc5cc..068cb4d 100644
--- a/src/declarative/util/qmlpropertychanges.cpp
+++ b/src/declarative/util/qmlpropertychanges.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE
}
}
- MouseRegion { anchors.fill: parent; onClicked: myText.state = 'myState' }
+ MouseArea { anchors.fill: parent; onClicked: myText.state = 'myState' }
}
\endqml
@@ -91,7 +91,7 @@ QT_BEGIN_NAMESPACE
\qml
PropertyChanges {
- target: myMouseRegion
+ target: myMouseArea
onClicked: doSomethingDifferent()
}
\endqml
@@ -357,7 +357,7 @@ QmlPropertyChangesPrivate::property(const QByteArray &property)
Q_Q(QmlPropertyChanges);
QmlMetaProperty prop = QmlMetaProperty::createProperty(object, QString::fromUtf8(property));
if (!prop.isValid()) {
- qmlInfo(q) << QmlPropertyChanges::tr("Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(property));
+ qmlInfo(q) << QmlPropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(property));
return QmlMetaProperty();
} else if (!(prop.type() & QmlMetaProperty::SignalProperty) && !prop.isWritable()) {
qmlInfo(q) << QmlPropertyChanges::tr("Cannot assign to read-only property \"%1\"").arg(QString::fromUtf8(property));
diff --git a/src/declarative/util/qmlpropertychanges_p.h b/src/declarative/util/qmlpropertychanges_p.h
index 461730d..19dcf9d 100644
--- a/src/declarative/util/qmlpropertychanges_p.h
+++ b/src/declarative/util/qmlpropertychanges_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlpropertymap.cpp b/src/declarative/util/qmlpropertymap.cpp
index 226f82e..ccbec6f 100644
--- a/src/declarative/util/qmlpropertymap.cpp
+++ b/src/declarative/util/qmlpropertymap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlpropertymap.h b/src/declarative/util/qmlpropertymap.h
index bb397fe..a56ed0f 100644
--- a/src/declarative/util/qmlpropertymap.h
+++ b/src/declarative/util/qmlpropertymap.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlspringfollow.cpp b/src/declarative/util/qmlspringfollow.cpp
index 764d7f9..6d4ecf2 100644
--- a/src/declarative/util/qmlspringfollow.cpp
+++ b/src/declarative/util/qmlspringfollow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlspringfollow_p.h b/src/declarative/util/qmlspringfollow_p.h
index 7731b9e..4a0ed1c 100644
--- a/src/declarative/util/qmlspringfollow_p.h
+++ b/src/declarative/util/qmlspringfollow_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index cae8054..4462b1f 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -242,16 +242,30 @@ void QmlState::setExtends(const QString &extends)
extends another state, then the changes are applied against the state being
extended.
*/
-QmlList<QmlStateOperation *> *QmlState::changes()
+QmlListProperty<QmlStateOperation> QmlState::changes()
{
Q_D(QmlState);
- return &d->operations;
+ return QmlListProperty<QmlStateOperation>(this, &d->operations, QmlStatePrivate::operations_append,
+ QmlStatePrivate::operations_count, QmlStatePrivate::operations_at,
+ QmlStatePrivate::operations_clear);
+}
+
+int QmlState::operationCount() const
+{
+ Q_D(const QmlState);
+ return d->operations.count();
+}
+
+QmlStateOperation *QmlState::operationAt(int index) const
+{
+ Q_D(const QmlState);
+ return d->operations.at(index);
}
QmlState &QmlState::operator<<(QmlStateOperation *op)
{
Q_D(QmlState);
- d->operations.append(op);
+ d->operations.append(QmlStatePrivate::OperationGuard(op, &d->operations));
return *this;
}
diff --git a/src/declarative/util/qmlstate_p.h b/src/declarative/util/qmlstate_p.h
index 5862c02..2c92387 100644
--- a/src/declarative/util/qmlstate_p.h
+++ b/src/declarative/util/qmlstate_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -131,7 +131,7 @@ class Q_DECLARATIVE_EXPORT QmlState : public QObject
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(QmlBinding *when READ when WRITE setWhen)
Q_PROPERTY(QString extend READ extends WRITE setExtends)
- Q_PROPERTY(QmlList<QmlStateOperation *>* changes READ changes)
+ Q_PROPERTY(QmlListProperty<QmlStateOperation> changes READ changes)
Q_CLASSINFO("DefaultProperty", "changes")
Q_CLASSINFO("DeferredPropertyNames", "changes")
@@ -151,7 +151,10 @@ public:
QString extends() const;
void setExtends(const QString &);
- QmlList<QmlStateOperation *> *changes();
+ QmlListProperty<QmlStateOperation> changes();
+ int operationCount() const;
+ QmlStateOperation *operationAt(int) const;
+
QmlState &operator<<(QmlStateOperation *);
void apply(QmlStateGroup *, QmlTransition *, QmlState *revert);
diff --git a/src/declarative/util/qmlstate_p_p.h b/src/declarative/util/qmlstate_p_p.h
index 235fe62..d138e4e 100644
--- a/src/declarative/util/qmlstate_p_p.h
+++ b/src/declarative/util/qmlstate_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -107,28 +107,33 @@ public:
QString name;
QmlBinding *when;
- class OperationList;
struct OperationGuard : public QmlGuard<QmlStateOperation>
{
- OperationGuard(QObject *obj, OperationList *l) : list(l) { (QmlGuard<QObject>&)*this = obj; }
- OperationList *list;
+ OperationGuard(QObject *obj, QList<OperationGuard> *l) : list(l) { (QmlGuard<QObject>&)*this = obj; }
+ QList<OperationGuard> *list;
void objectDestroyed(QmlStateOperation *) {
// we assume priv will always be destroyed after objectDestroyed calls
list->removeOne(*this);
}
};
+ QList<OperationGuard> operations;
- class OperationList : public QList<OperationGuard>, public QmlList<QmlStateOperation*>
- {
- public:
- virtual void append(QmlStateOperation* v) { QList<OperationGuard>::append(OperationGuard(v, this)); }
- virtual void insert(int i, QmlStateOperation* v) { QList<OperationGuard>::insert(i, OperationGuard(v, this)); }
- virtual void clear() { QList<OperationGuard>::clear(); }
- virtual QmlStateOperation* at(int i) const { return QList<OperationGuard>::at(i); }
- virtual void removeAt(int i) { QList<OperationGuard>::removeAt(i); }
- virtual int count() const { return QList<OperationGuard>::count(); }
- };
- OperationList operations;
+ static void operations_append(QmlListProperty<QmlStateOperation> *prop, QmlStateOperation *op) {
+ QList<OperationGuard> *list = static_cast<QList<OperationGuard> *>(prop->data);
+ list->append(OperationGuard(op, list));
+ }
+ static void operations_clear(QmlListProperty<QmlStateOperation> *prop) {
+ QList<OperationGuard> *list = static_cast<QList<OperationGuard> *>(prop->data);
+ list->clear();
+ }
+ static int operations_count(QmlListProperty<QmlStateOperation> *prop) {
+ QList<OperationGuard> *list = static_cast<QList<OperationGuard> *>(prop->data);
+ return list->count();
+ }
+ static QmlStateOperation *operations_at(QmlListProperty<QmlStateOperation> *prop, int index) {
+ QList<OperationGuard> *list = static_cast<QList<OperationGuard> *>(prop->data);
+ return list->at(index);
+ }
QmlTransitionManager transitionManager;
diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp
index aad19d9..4ad77c8 100644
--- a/src/declarative/util/qmlstategroup.cpp
+++ b/src/declarative/util/qmlstategroup.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,26 +60,19 @@ class QmlStateGroupPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QmlStateGroup)
public:
QmlStateGroupPrivate(QmlStateGroup *p)
- : nullState(0), states(p), componentComplete(true),
+ : nullState(0), componentComplete(true),
ignoreTrans(false), applyingState(false) {}
QString currentState;
QmlState *nullState;
- struct StateList : public QmlConcreteList<QmlState *>
- {
- StateList(QmlStateGroup *g)
- :group(g) {}
- void append(QmlState *s) {
- QmlConcreteList<QmlState *>::append(s);
- if (s) s->setStateGroup(group);
- }
- private:
- QmlStateGroup *group;
- };
- StateList states;
+ static void append_state(QmlListProperty<QmlState> *list, QmlState *state);
+ static int count_state(QmlListProperty<QmlState> *list);
+ static QmlState *at_state(QmlListProperty<QmlState> *list, int index);
+
+ QList<QmlState *> states;
+ QList<QmlTransition *> transitions;
- QmlConcreteList<QmlTransition *> transitions;
bool componentComplete;
bool ignoreTrans;
bool applyingState;
@@ -151,10 +144,34 @@ QList<QmlState *> QmlStateGroup::states() const
\sa {qmlstate}{States}
*/
-QmlList<QmlState *>* QmlStateGroup::statesProperty()
+QmlListProperty<QmlState> QmlStateGroup::statesProperty()
{
Q_D(QmlStateGroup);
- return &(d->states);
+ return QmlListProperty<QmlState>(this, &d->states, &QmlStateGroupPrivate::append_state,
+ &QmlStateGroupPrivate::count_state,
+ &QmlStateGroupPrivate::at_state);
+}
+
+void QmlStateGroupPrivate::append_state(QmlListProperty<QmlState> *list, QmlState *state)
+{
+ QmlStateGroup *_this = static_cast<QmlStateGroup *>(list->object);
+ if (state) {
+ _this->d_func()->states.append(state);
+ state->setStateGroup(_this);
+ }
+
+}
+
+int QmlStateGroupPrivate::count_state(QmlListProperty<QmlState> *list)
+{
+ QmlStateGroup *_this = static_cast<QmlStateGroup *>(list->object);
+ return _this->d_func()->states.count();
+}
+
+QmlState *QmlStateGroupPrivate::at_state(QmlListProperty<QmlState> *list, int index)
+{
+ QmlStateGroup *_this = static_cast<QmlStateGroup *>(list->object);
+ return _this->d_func()->states.at(index);
}
/*!
@@ -173,10 +190,10 @@ QmlList<QmlState *>* QmlStateGroup::statesProperty()
\sa {state-transitions}{Transitions}
*/
-QmlList<QmlTransition *>* QmlStateGroup::transitionsProperty()
+QmlListProperty<QmlTransition> QmlStateGroup::transitionsProperty()
{
Q_D(QmlStateGroup);
- return &(d->transitions);
+ return QmlListProperty<QmlTransition>(this, d->transitions);
}
/*!
diff --git a/src/declarative/util/qmlstategroup_p.h b/src/declarative/util/qmlstategroup_p.h
index 112c9eb..d39ca03 100644
--- a/src/declarative/util/qmlstategroup_p.h
+++ b/src/declarative/util/qmlstategroup_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -58,8 +58,8 @@ class Q_DECLARATIVE_EXPORT QmlStateGroup : public QObject, public QmlParserStatu
Q_DECLARE_PRIVATE(QmlStateGroup)
Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged)
- Q_PROPERTY(QmlList<QmlState *>* states READ statesProperty DESIGNABLE false)
- Q_PROPERTY(QmlList<QmlTransition *>* transitions READ transitionsProperty DESIGNABLE false)
+ Q_PROPERTY(QmlListProperty<QmlState> states READ statesProperty DESIGNABLE false)
+ Q_PROPERTY(QmlListProperty<QmlTransition> transitions READ transitionsProperty DESIGNABLE false)
public:
QmlStateGroup(QObject * = 0);
@@ -68,10 +68,10 @@ public:
QString state() const;
void setState(const QString &);
- QmlList<QmlState *>* statesProperty();
+ QmlListProperty<QmlState> statesProperty();
QList<QmlState *> states() const;
- QmlList<QmlTransition *>* transitionsProperty();
+ QmlListProperty<QmlTransition> transitionsProperty();
QmlState *findState(const QString &name) const;
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index 35c8f7d..bd1f5f0 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -82,7 +82,7 @@ void QmlParentChangePrivate::doChange(QmlGraphicsItem *targetParent, QmlGraphics
bool ok;
const QTransform &transform = target->itemTransform(targetParent, &ok);
if (transform.type() >= QTransform::TxShear || !ok) {
- qmlInfo(q) << QObject::tr("Unable to preserve appearance under complex transform");
+ qmlInfo(q) << QmlParentChange::tr("Unable to preserve appearance under complex transform");
ok = false;
}
@@ -92,21 +92,21 @@ void QmlParentChangePrivate::doChange(QmlGraphicsItem *targetParent, QmlGraphics
if (transform.m11() == transform.m22())
scale = transform.m11();
else {
- qmlInfo(q) << QObject::tr("Unable to preserve appearance under non-uniform scale");
+ qmlInfo(q) << QmlParentChange::tr("Unable to preserve appearance under non-uniform scale");
ok = false;
}
} else if (ok && transform.type() == QTransform::TxRotate) {
if (transform.m11() == transform.m22())
scale = qSqrt(transform.m11()*transform.m11() + transform.m12()*transform.m12());
else {
- qmlInfo(q) << QObject::tr("Unable to preserve appearance under non-uniform scale");
+ qmlInfo(q) << QmlParentChange::tr("Unable to preserve appearance under non-uniform scale");
ok = false;
}
if (scale != 0)
rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI;
else {
- qmlInfo(q) << QObject::tr("Unable to preserve appearance under scale of 0");
+ qmlInfo(q) << QmlParentChange::tr("Unable to preserve appearance under scale of 0");
ok = false;
}
}
@@ -403,7 +403,7 @@ QString QmlStateChangeScript::typeName() const
so you can animate them as you would normally changes to these properties:
\qml
//animate our anchor changes
- NumberAnimation { matchTargets: content; matchProperties: "x,y,width,height" }
+ NumberAnimation { targets: content; properties: "x,y,width,height" }
\endqml
For more information on anchors see \l {anchor-layout}{Anchor Layouts}.
diff --git a/src/declarative/util/qmlstateoperations_p.h b/src/declarative/util/qmlstateoperations_p.h
index 1a9f76f..dc1974b 100644
--- a/src/declarative/util/qmlstateoperations_p.h
+++ b/src/declarative/util/qmlstateoperations_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlstyledtext.cpp b/src/declarative/util/qmlstyledtext.cpp
index 63f341e..1f31214 100644
--- a/src/declarative/util/qmlstyledtext.cpp
+++ b/src/declarative/util/qmlstyledtext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlstyledtext_p.h b/src/declarative/util/qmlstyledtext_p.h
index 502a4b5..4698279 100644
--- a/src/declarative/util/qmlstyledtext_p.h
+++ b/src/declarative/util/qmlstyledtext_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlsystempalette.cpp b/src/declarative/util/qmlsystempalette.cpp
index 39d8f3e..cc4fb3e 100644
--- a/src/declarative/util/qmlsystempalette.cpp
+++ b/src/declarative/util/qmlsystempalette.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlsystempalette_p.h b/src/declarative/util/qmlsystempalette_p.h
index 7c39d4a..e25bf7f 100644
--- a/src/declarative/util/qmlsystempalette_p.h
+++ b/src/declarative/util/qmlsystempalette_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmltimeline.cpp b/src/declarative/util/qmltimeline.cpp
index 130e02d..5c5df40 100644
--- a/src/declarative/util/qmltimeline.cpp
+++ b/src/declarative/util/qmltimeline.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -55,12 +55,12 @@ QT_BEGIN_NAMESPACE
struct Update {
Update(QmlTimeLineValue *_g, qreal _v)
: g(_g), v(_v) {}
- Update(const QmlTimeLineEvent &_e)
+ Update(const QmlTimeLineCallback &_e)
: g(0), v(0), e(_e) {}
QmlTimeLineValue *g;
qreal v;
- QmlTimeLineEvent e;
+ QmlTimeLineCallback e;
};
struct QmlTimeLinePrivate
@@ -79,7 +79,7 @@ struct QmlTimeLinePrivate
};
Op() {}
Op(Type t, int l, qreal v, qreal v2, int o,
- const QmlTimeLineEvent &ev = QmlTimeLineEvent(), const QEasingCurve &es = QEasingCurve())
+ const QmlTimeLineCallback &ev = QmlTimeLineCallback(), const QEasingCurve &es = QEasingCurve())
: type(t), length(l), value(v), value2(v2), order(o), event(ev),
easing(es) {}
Op(const Op &o)
@@ -98,7 +98,7 @@ struct QmlTimeLinePrivate
qreal value2;
int order;
- QmlTimeLineEvent event;
+ QmlTimeLineCallback event;
QEasingCurve easing;
};
struct TimeLine
@@ -244,7 +244,7 @@ qreal QmlTimeLinePrivate::value(const Op &op, int time, qreal base, bool *change
}
case Op::Execute:
- op.event.execute();
+ op.event.d0(op.event.d1);
*changed = false;
return -1;
}
@@ -364,10 +364,10 @@ void QmlTimeLine::pause(QmlTimeLineObject &obj, int time)
/*!
Execute the \a event.
*/
-void QmlTimeLine::execute(const QmlTimeLineEvent &event)
+void QmlTimeLine::callback(const QmlTimeLineCallback &callback)
{
- QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Execute, 0, 0, 0., d->order++, event);
- d->add(*event.eventObject(), op);
+ QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Execute, 0, 0, 0., d->order++, callback);
+ d->add(*callback.callbackObject(), op);
}
/*!
@@ -466,7 +466,7 @@ void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, int t
void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, const QEasingCurve &easing, int time)
{
if (time <= 0) return;
- QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Move, time, destination, 0.0f, d->order++, QmlTimeLineEvent(), easing);
+ QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Move, time, destination, 0.0f, d->order++, QmlTimeLineCallback(), easing);
d->add(timeLineValue, op);
}
@@ -488,7 +488,7 @@ void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, int time
void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, const QEasingCurve &easing, int time)
{
if (time <= 0) return;
- QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::MoveBy, time, change, 0.0f, d->order++, QmlTimeLineEvent(), easing);
+ QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::MoveBy, time, change, 0.0f, d->order++, QmlTimeLineCallback(), easing);
d->add(timeLineValue, op);
}
@@ -805,10 +805,11 @@ int QmlTimeLinePrivate::advance(int t)
updateQueue = &updates;
for (int ii = 0; ii < updates.count(); ++ii) {
const Update &v = updates.at(ii).second;
- if (v.g)
+ if (v.g) {
v.g->setValue(v.v);
- else
- v.e.execute();
+ } else {
+ v.e.d0(v.e.d1);
+ }
}
updateQueue = 0;
} while(t);
@@ -854,7 +855,7 @@ void QmlTimeLine::remove(QmlTimeLineObject *v)
if (d->updateQueue) {
for (int ii = 0; ii < d->updateQueue->count(); ++ii) {
if (d->updateQueue->at(ii).second.g == v ||
- d->updateQueue->at(ii).second.e.eventObject() == v) {
+ d->updateQueue->at(ii).second.e.callbackObject() == v) {
d->updateQueue->removeAt(ii);
--ii;
}
@@ -910,17 +911,22 @@ QmlTimeLineObject::~QmlTimeLineObject()
}
}
-QmlTimeLineEvent::QmlTimeLineEvent()
+QmlTimeLineCallback::QmlTimeLineCallback()
: d0(0), d1(0), d2(0)
{
}
-QmlTimeLineEvent::QmlTimeLineEvent(const QmlTimeLineEvent &o)
+QmlTimeLineCallback::QmlTimeLineCallback(QmlTimeLineObject *b, Callback f, void *d)
+: d0(f), d1(d), d2(b)
+{
+}
+
+QmlTimeLineCallback::QmlTimeLineCallback(const QmlTimeLineCallback &o)
: d0(o.d0), d1(o.d1), d2(o.d2)
{
}
-QmlTimeLineEvent &QmlTimeLineEvent::operator=(const QmlTimeLineEvent &o)
+QmlTimeLineCallback &QmlTimeLineCallback::operator=(const QmlTimeLineCallback &o)
{
d0 = o.d0;
d1 = o.d1;
@@ -928,12 +934,7 @@ QmlTimeLineEvent &QmlTimeLineEvent::operator=(const QmlTimeLineEvent &o)
return *this;
}
-void QmlTimeLineEvent::execute() const
-{
- d0(d1);
-}
-
-QmlTimeLineObject *QmlTimeLineEvent::eventObject() const
+QmlTimeLineObject *QmlTimeLineCallback::callbackObject() const
{
return d2;
}
diff --git a/src/declarative/util/qmltimeline_p_p.h b/src/declarative/util/qmltimeline_p_p.h
index 09d46ba..076355d 100644
--- a/src/declarative/util/qmltimeline_p_p.h
+++ b/src/declarative/util/qmltimeline_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,10 +60,10 @@ QT_BEGIN_NAMESPACE
class QEasingCurve;
class QmlTimeLineValue;
-class QmlTimeLineEvent;
+class QmlTimeLineCallback;
struct QmlTimeLinePrivate;
class QmlTimeLineObject;
-class Q_DECLARATIVE_EXPORT QmlTimeLine : public QAbstractAnimation
+class QmlTimeLine : public QAbstractAnimation
{
Q_OBJECT
public:
@@ -75,7 +75,7 @@ public:
void setSyncMode(SyncMode);
void pause(QmlTimeLineObject &, int);
- void execute(const QmlTimeLineEvent &);
+ void callback(const QmlTimeLineCallback &);
void set(QmlTimeLineValue &, qreal);
int accel(QmlTimeLineValue &, qreal velocity, qreal accel);
@@ -117,7 +117,7 @@ private:
QmlTimeLinePrivate *d;
};
-class Q_DECLARATIVE_EXPORT QmlTimeLineObject
+class QmlTimeLineObject
{
public:
QmlTimeLineObject();
@@ -129,7 +129,7 @@ protected:
QmlTimeLine *_t;
};
-class Q_DECLARATIVE_EXPORT QmlTimeLineValue : public QmlTimeLineObject
+class QmlTimeLineValue : public QmlTimeLineObject
{
public:
QmlTimeLineValue(qreal v = 0.) : _v(v) {}
@@ -147,44 +147,21 @@ private:
qreal _v;
};
-class Q_DECLARATIVE_EXPORT QmlTimeLineEvent
+class QmlTimeLineCallback
{
public:
- QmlTimeLineEvent();
- QmlTimeLineEvent(const QmlTimeLineEvent &o);
+ typedef void (*Callback)(void *);
- template<class T, void (T::*method)()>
- QmlTimeLineEvent(QmlTimeLineObject *b, T *c)
- {
- d0 = &callFunc<T, method>;
- d1 = (void *)c;
- d2 = b;
- }
-
- template<class T, void (T::*method)()>
- static QmlTimeLineEvent timeLineEvent(QmlTimeLineObject *b, T *c)
- {
- QmlTimeLineEvent rv;
- rv.d0 = &callFunc<T, method>;
- rv.d1 = (void *)c;
- rv.d2 = b;
- return rv;
- }
+ QmlTimeLineCallback();
+ QmlTimeLineCallback(QmlTimeLineObject *b, Callback, void * = 0);
+ QmlTimeLineCallback(const QmlTimeLineCallback &o);
- QmlTimeLineEvent &operator=(const QmlTimeLineEvent &o);
- void execute() const;
- QmlTimeLineObject *eventObject() const;
+ QmlTimeLineCallback &operator=(const QmlTimeLineCallback &o);
+ QmlTimeLineObject *callbackObject() const;
private:
- typedef void (*CallFunc)(void *c);
-
- template <class T, void (T::*method)()>
- static void callFunc(void *c)
- {
- T *cls = (T *)c;
- (cls->*method)();
- }
- CallFunc d0;
+ friend class QmlTimeLinePrivate;
+ Callback d0;
void *d1;
QmlTimeLineObject *d2;
};
diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qmltimer.cpp
index 046dfe9..d3a1a7c 100644
--- a/src/declarative/util/qmltimer.cpp
+++ b/src/declarative/util/qmltimer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmltimer_p.h b/src/declarative/util/qmltimer_p.h
index fcd6c84..d1c5ee5 100644
--- a/src/declarative/util/qmltimer_p.h
+++ b/src/declarative/util/qmltimer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp
index 215fc91..e90fc20 100644
--- a/src/declarative/util/qmltransition.cpp
+++ b/src/declarative/util/qmltransition.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -82,10 +82,11 @@ class QmlTransitionPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QmlTransition)
public:
- QmlTransitionPrivate() : fromState(QLatin1String("*")), toState(QLatin1String("*"))
- , reversed(false), reversible(false), endState(0)
+ QmlTransitionPrivate()
+ : fromState(QLatin1String("*")), toState(QLatin1String("*")),
+ reversed(false), reversible(false), endState(0)
{
- animations.parent = this;
+ group.trans = this;
}
QString fromState;
@@ -95,32 +96,20 @@ public:
ParallelAnimationWrapper group;
QmlTransitionManager *endState;
- void init()
- {
- group.trans = this;
- }
-
void complete()
{
endState->complete();
}
-
- class AnimationList : public QmlConcreteList<QmlAbstractAnimation *>
- {
- public:
- AnimationList() : parent(0) {}
- virtual void append(QmlAbstractAnimation *a);
- virtual void clear() { QmlConcreteList<QmlAbstractAnimation *>::clear(); } //###
-
- QmlTransitionPrivate *parent;
- };
- AnimationList animations;
+ static void append_animation(QmlListProperty<QmlAbstractAnimation> *list, QmlAbstractAnimation *a);
+ QList<QmlAbstractAnimation *> animations;
};
-void QmlTransitionPrivate::AnimationList::append(QmlAbstractAnimation *a)
+void QmlTransitionPrivate::append_animation(QmlListProperty<QmlAbstractAnimation> *list, QmlAbstractAnimation *a)
{
- QmlConcreteList<QmlAbstractAnimation *>::append(a);
- parent->group.addAnimation(a->qtAnimation());
+ QmlTransition *q = static_cast<QmlTransition *>(list->object);
+ q->d_func()->animations.append(a);
+ q->d_func()->group.addAnimation(a->qtAnimation());
+ a->setDisableUserControl();
}
void ParallelAnimationWrapper::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
@@ -139,8 +128,6 @@ QML_DEFINE_TYPE(Qt,4,6,Transition,QmlTransition)
QmlTransition::QmlTransition(QObject *parent)
: QObject(*(new QmlTransitionPrivate), parent)
{
- Q_D(QmlTransition);
- d->init();
}
QmlTransition::~QmlTransition()
@@ -250,10 +237,10 @@ void QmlTransition::setToState(const QString &t)
and assign that to animations the animations property.
\default
*/
-QmlList<QmlAbstractAnimation *>* QmlTransition::animations()
+QmlListProperty<QmlAbstractAnimation> QmlTransition::animations()
{
Q_D(QmlTransition);
- return &d->animations;
+ return QmlListProperty<QmlAbstractAnimation>(this, &d->animations, QmlTransitionPrivate::append_animation);
}
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmltransition_p.h b/src/declarative/util/qmltransition_p.h
index c1a6f66..ea02a33 100644
--- a/src/declarative/util/qmltransition_p.h
+++ b/src/declarative/util/qmltransition_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -65,7 +65,7 @@ class Q_DECLARATIVE_EXPORT QmlTransition : public QObject
Q_PROPERTY(QString from READ fromState WRITE setFromState)
Q_PROPERTY(QString to READ toState WRITE setToState)
Q_PROPERTY(bool reversible READ reversible WRITE setReversible)
- Q_PROPERTY(QmlList<QmlAbstractAnimation *>* animations READ animations)
+ Q_PROPERTY(QmlListProperty<QmlAbstractAnimation> animations READ animations)
Q_CLASSINFO("DefaultProperty", "animations")
Q_CLASSINFO("DeferredPropertyNames", "animations")
@@ -82,7 +82,7 @@ public:
bool reversible() const;
void setReversible(bool);
- QmlList<QmlAbstractAnimation *>* animations();
+ QmlListProperty<QmlAbstractAnimation> animations();
void prepare(QmlStateOperation::ActionList &actions,
QList<QmlMetaProperty> &after,
diff --git a/src/declarative/util/qmltransitionmanager.cpp b/src/declarative/util/qmltransitionmanager.cpp
index a3a16ca..f2a4d64 100644
--- a/src/declarative/util/qmltransitionmanager.cpp
+++ b/src/declarative/util/qmltransitionmanager.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmltransitionmanager_p_p.h b/src/declarative/util/qmltransitionmanager_p_p.h
index cb4111c..19ee706 100644
--- a/src/declarative/util/qmltransitionmanager_p_p.h
+++ b/src/declarative/util/qmltransitionmanager_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp
index 690924f..400ae52 100644
--- a/src/declarative/util/qmlview.cpp
+++ b/src/declarative/util/qmlview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -64,6 +64,7 @@
#include <qboxlayout.h>
#include <qbasictimer.h>
#include <QtCore/qabstractanimation.h>
+#include <private/qgraphicsview_p.h>
QT_BEGIN_NAMESPACE
@@ -128,21 +129,22 @@ void FrameBreakAnimation::updateCurrentTime(int msecs)
class QmlViewPrivate
{
public:
- QmlViewPrivate(QmlView *w)
- : q(w), root(0), component(0), resizable(false) {}
+ QmlViewPrivate(QmlView *view)
+ : q(view), root(0), component(0), resizeMode(QmlView::SizeViewToRootObject) {}
QmlView *q;
- QmlGraphicsItem *root;
+
+ QGuard<QGraphicsObject> root;
+ QGuard<QmlGraphicsItem> qmlRoot;
QUrl source;
- QString qml;
QmlEngine engine;
QmlComponent *component;
QBasicTimer resizetimer;
- QSize initialSize;
- bool resizable;
+ mutable QSize initialSize;
+ QmlView::ResizeMode resizeMode;
QTime frameTimer;
void init();
@@ -154,9 +156,30 @@ public:
\class QmlView
\brief The QmlView class provides a widget for displaying a Qt Declarative user interface.
- QmlView currently provides a minimal interface for displaying QML
+ Any QGraphicsObject or QmlGraphicsItem
+ created via QML can be placed on a standard QGraphicsScene and viewed with a standard
+ QGraphicsView.
+
+ QmlView is a QGraphicsView subclass provided as a convenience for displaying QML
files, and connecting between QML and C++ Qt objects.
+ QmlView performs the following functions:
+
+ \list
+ \o Manages QmlComponent loading and object creation.
+ \o Initializes QGraphicsView for optimal performance with QML:
+ \list
+ \o QGraphicsView::setOptimizationFlags(QGraphicsView::DontSavePainterState);
+ \o QGraphicsView::setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
+ \o QGraphicsScene::setItemIndexMethod(QGraphicsScene::NoIndex);
+ \endlist
+ \o Initializes QGraphicsView for QML key handling:
+ \list
+ \o QGraphicsView::viewport()->setFocusPolicy(Qt::NoFocus);
+ \o QGraphicsScene::setStickyFocus(true);
+ \endlist
+ \endlist
+
Typical usage:
\code
...
@@ -164,7 +187,7 @@ public:
vbox->addWidget(view);
QUrl url(fileName);
- view->setUrl(url);
+ view->setSource(url);
...
view->execute();
...
@@ -172,7 +195,17 @@ public:
\endcode
To receive errors related to loading and executing QML with QmlView,
- you can connect to the errors() signal.
+ you can connect to the statusChanged() signal and monitor for QmlView::Error.
+ The errors are available via QmlView::errors().
+*/
+
+
+/*! \fn void QmlView::sceneResized(QSize size)
+ This signal is emitted when the view is resized to \a size.
+*/
+
+/*! \fn void QmlView::statusChanged(QmlView::Status status)
+ This signal is emitted when the component's current \l{QmlView::Status} {status} changes.
*/
/*!
@@ -212,56 +245,37 @@ void QmlViewPrivate::init()
}
/*!
- The destructor clears the view's \l {QmlGraphicsItem} {items} and
+ The destructor clears the view's \l {QGraphicsObject} {items} and
deletes the internal representation.
-
- \sa clearItems()
*/
QmlView::~QmlView()
{
- clearItems();
- delete d; d = 0;
+ delete d->root;
}
/*!
- Sets the source to the \a url. The QML string is set to
- empty.
+ Sets the source to the \a url.
+
+ Call \l execute() to load the QML and instantiate the component.
+
+ \sa execute()
*/
-void QmlView::setUrl(const QUrl& url)
+void QmlView::setSource(const QUrl& url)
{
d->source = url;
- d->qml = QString();
}
/*!
Returns the source URL, if set.
- \sa setUrl()
+ \sa setSource()
*/
-QUrl QmlView::url() const
+QUrl QmlView::source() const
{
return d->source;
}
/*!
- Sets the source to the URL from the \a filename, and sets
- the QML string to \a qml.
- */
-void QmlView::setQml(const QString &qml, const QString &filename)
-{
- d->source = QUrl::fromLocalFile(filename);
- d->qml = qml;
-}
-
-/*!
- Returns the QML string.
- */
-QString QmlView::qml() const
-{
- return d->qml;
-}
-
-/*!
Returns a pointer to the QmlEngine used for instantiating
QML Components.
*/
@@ -283,17 +297,15 @@ QmlContext* QmlView::rootContext()
}
/*!
- Displays the Qt Declarative user interface.
+ Loads and instantiates the QML component set by the \l setSource() method.
+
+ \sa setSource()
*/
void QmlView::execute()
{
- if (d->qml.isEmpty()) {
- d->component = new QmlComponent(&d->engine, d->source, this);
- } else {
- d->component = new QmlComponent(&d->engine, this);
- d->component->setData(d->qml.toUtf8(), d->source);
- }
- connect (&d->engine, SIGNAL (quit ()), this, SIGNAL (quit ()));
+ delete d->root;
+ delete d->component;
+ d->component = new QmlComponent(&d->engine, d->source, this);
if (!d->component->isLoading()) {
continueExecute();
@@ -302,26 +314,95 @@ void QmlView::execute()
}
}
+/*!
+ \enum QmlView::Status
+
+ Specifies the loading status of the QmlView.
+
+ \value Null This QmlView has no source set.
+ \value Ready This QmlView has loaded and created the QML component.
+ \value Loading This QmlView is loading network data.
+ \value Error An error has occured. Calling errorDescription() to retrieve a description.
+*/
+
+/*!
+ \property QmlView::status
+ The component's current \l{QmlView::Status} {status}.
+*/
+
+QmlView::Status QmlView::status() const
+{
+ if (!d->component)
+ return QmlView::Null;
+
+ return QmlView::Status(d->component->status());
+}
+
+/*!
+ Return the list of errors that occured during the last compile or create
+ operation. An empty list is returned if isError() is not set.
+*/
+QList<QmlError> QmlView::errors() const
+{
+ if (d->component)
+ return d->component->errors();
+ return QList<QmlError>();
+}
+
+
+/*!
+ \property QmlView::resizeMode
+ \brief whether the view should resize the canvas contents
+
+ If this property is set to SizeViewToRootObject (the default), the view
+ resizes with the root item in the QML.
+
+ If this property is set to SizeRootObjectToView, the view will
+ automatically resize the root item.
+
+ Regardless of this property, the sizeHint of the view
+ is the initial size of the root item. Note though that
+ since QML may load dynamically, that size may change.
+
+ \sa initialSize()
+*/
+
+void QmlView::setResizeMode(ResizeMode mode)
+{
+ if (d->resizeMode == mode)
+ return;
+
+ d->resizeMode = mode;
+ if (d->qmlRoot) {
+ if (d->resizeMode == SizeRootObjectToView) {
+ d->qmlRoot->setWidth(width());
+ d->qmlRoot->setHeight(height());
+ } else {
+ d->qmlRoot->setWidth(d->initialSize.width());
+ d->qmlRoot->setHeight(d->initialSize.height());
+ }
+ }
+}
+
+QmlView::ResizeMode QmlView::resizeMode() const
+{
+ return d->resizeMode;
+}
/*!
\internal
*/
void QmlView::continueExecute()
{
- disconnect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute()));
- if (!d->component) {
- qWarning() << "Error in loading" << d->source;
- return;
- }
+ disconnect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute()));
- if(d->component->isError()) {
+ if (d->component->isError()) {
QList<QmlError> errorList = d->component->errors();
foreach (const QmlError &error, errorList) {
qWarning() << error;
}
- emit errors(errorList);
-
+ emit statusChanged(status());
return;
}
@@ -332,8 +413,7 @@ void QmlView::continueExecute()
foreach (const QmlError &error, errorList) {
qWarning() << error;
}
- emit errors(errorList);
-
+ emit statusChanged(status());
return;
}
@@ -345,24 +425,27 @@ void QmlView::continueExecute()
QPerformanceLog::displayData();
QPerformanceLog::clear();
d->root = item;
+ d->qmlRoot = item;
connect(item, SIGNAL(widthChanged()), this, SLOT(sizeChanged()));
connect(item, SIGNAL(heightChanged()), this, SLOT(sizeChanged()));
- if (d->initialSize.height() <= 0 && d->root->width() > 0)
- d->initialSize.setWidth(d->root->width());
- if (d->initialSize.height() <= 0 && d->root->height() > 0)
- d->initialSize.setHeight(d->root->height());
+ if (d->initialSize.height() <= 0 && d->qmlRoot->width() > 0)
+ d->initialSize.setWidth(d->qmlRoot->width());
+ if (d->initialSize.height() <= 0 && d->qmlRoot->height() > 0)
+ d->initialSize.setHeight(d->qmlRoot->height());
resize(d->initialSize);
- if (d->resizable) {
- d->root->setWidth(width());
- d->root->setHeight(height());
+ if (d->resizeMode == SizeRootObjectToView) {
+ d->qmlRoot->setWidth(width());
+ d->qmlRoot->setHeight(height());
} else {
- QSize sz(d->root->width(),d->root->height());
+ QSize sz(d->qmlRoot->width(),d->qmlRoot->height());
emit sceneResized(sz);
resize(sz);
}
updateGeometry();
- emit initialSize(d->initialSize);
+ } else if (QGraphicsObject *item = qobject_cast<QGraphicsObject *>(obj)) {
+ d->scene.addItem(item);
+ qWarning() << "QmlView::resizeMode is not honored for components of type QGraphicsObject";
} else if (QWidget *wid = qobject_cast<QWidget *>(obj)) {
window()->setAttribute(Qt::WA_OpaquePaintEvent, false);
window()->setAttribute(Qt::WA_NoSystemBackground, false);
@@ -377,23 +460,11 @@ void QmlView::continueExecute()
}
layout()->addWidget(wid);
emit sceneResized(wid->size());
- emit initialSize(wid->size());
}
}
+ emit statusChanged(status());
}
-/*! \fn void QmlView::sceneResized(QSize size)
- This signal is emitted when the view is resized to \a size.
- */
-
-/*! \fn void QmlView::initialSize(QSize size)
- This signal is emitted when the initial \a size of the root item is known.
- */
-
-/*! \fn void QmlView::errors(const QList<QmlError> &errors)
- This signal is emitted when the qml loaded contains \a errors.
- */
-
/*!
\internal
*/
@@ -404,14 +475,15 @@ void QmlView::sizeChanged()
}
/*!
+ \internal
If the \l {QTimerEvent} {timer event} \a e is this
view's resize timer, sceneResized() is emitted.
*/
void QmlView::timerEvent(QTimerEvent* e)
{
if (!e || e->timerId() == d->resizetimer.timerId()) {
- if (d->root) {
- QSize sz(d->root->width(),d->root->height());
+ if (d->qmlRoot) {
+ QSize sz(d->qmlRoot->width(),d->qmlRoot->height());
emit sceneResized(sz);
//if (!d->resizable)
//resize(sz);
@@ -421,147 +493,44 @@ void QmlView::timerEvent(QTimerEvent* e)
}
}
-// modelled on QScrollArea::widgetResizable
-/*!
- \property QmlView::contentResizable
- \brief whether the view should resize the canvas contents
-
- If this property is set to false (the default), the view
- resizes with the root item in the QML.
-
- If this property is set to true, the view will
- automatically resize the root item.
-
- Regardless of this property, the sizeHint of the view
- is the initial size of the root item. Note though that
- since QML may load dynamically, that size may change.
-
- \sa initialSize()
-*/
-
-void QmlView::setContentResizable(bool on)
-{
- if (d->resizable != on) {
- d->resizable = on;
- if (d->root) {
- if (on) {
- d->root->setWidth(width());
- d->root->setHeight(height());
- } else {
- d->root->setWidth(d->initialSize.width());
- d->root->setHeight(d->initialSize.height());
- }
- }
- }
-}
-
-bool QmlView::contentResizable() const
-{
- return d->resizable;
-}
-
-
/*!
+ \internal
The size hint is the size of the root item.
*/
QSize QmlView::sizeHint() const
{
- if (d->root) {
+ if (d->qmlRoot) {
if (d->initialSize.width() <= 0)
- d->initialSize.setWidth(d->root->width());
+ d->initialSize.setWidth(d->qmlRoot->width());
if (d->initialSize.height() <= 0)
- d->initialSize.setHeight(d->root->height());
+ d->initialSize.setHeight(d->qmlRoot->height());
}
return d->initialSize;
}
/*!
- Creates a \l{QmlComponent} {component} from the \a qml
- string, and returns it as an \l {QmlGraphicsItem} {item}. If the
- \a parent item is provided, it becomes the new item's
- parent. \a parent should be in this view's item hierarchy.
+ Returns the view's root \l {QGraphicsObject} {item}.
*/
-QmlGraphicsItem* QmlView::addItem(const QString &qml, QmlGraphicsItem* parent)
-{
- if (!d->root)
- return 0;
-
- QmlComponent component(&d->engine);
- component.setData(qml.toUtf8(), QUrl());
- if(d->component->isError()) {
- QList<QmlError> errorList = d->component->errors();
- foreach (const QmlError &error, errorList) {
- qWarning() << error;
- }
- emit errors(errorList);
-
- return 0;
- }
-
- QObject *obj = component.create();
- if(d->component->isError()) {
- QList<QmlError> errorList = d->component->errors();
- foreach (const QmlError &error, errorList) {
- qWarning() << error;
- }
- emit errors(errorList);
-
- return 0;
- }
-
- if (obj){
- QmlGraphicsItem *item = static_cast<QmlGraphicsItem *>(obj);
- if (!parent)
- parent = d->root;
-
- item->setParentItem(parent);
- return item;
- }
- return 0;
-}
-
-/*!
- Deletes the view's \l {QmlGraphicsItem} {items} and clears the \l {QmlEngine}
- {QML engine's} Component cache.
- */
-void QmlView::reset()
-{
- clearItems();
- d->engine.clearComponentCache();
- d->initialSize = QSize();
-}
-
-/*!
- Deletes the view's \l {QmlGraphicsItem} {items}.
- */
-void QmlView::clearItems()
-{
- if (!d->root)
- return;
- delete d->root;
- d->root = 0;
-}
-
-/*!
- Returns the view's root \l {QmlGraphicsItem} {item}.
- */
-QmlGraphicsItem *QmlView::root() const
+QGraphicsObject *QmlView::rootObject() const
{
return d->root;
}
/*!
+ \internal
This function handles the \l {QResizeEvent} {resize event}
\a e.
*/
void QmlView::resizeEvent(QResizeEvent *e)
{
- if (d->resizable && d->root) {
- d->root->setWidth(width());
- d->root->setHeight(height());
+ if (d->resizeMode == SizeRootObjectToView && d->qmlRoot) {
+ d->qmlRoot->setWidth(width());
+ d->qmlRoot->setHeight(height());
}
- if (d->root) {
- setSceneRect(QRectF(0, 0, d->root->width(), d->root->height()));
+ if (d->qmlRoot) {
+ setSceneRect(QRectF(0, 0, d->qmlRoot->width(), d->qmlRoot->height()));
+ } else if (d->root) {
+ setSceneRect(d->root->boundingRect());
} else {
setSceneRect(rect());
}
@@ -569,7 +538,7 @@ void QmlView::resizeEvent(QResizeEvent *e)
}
/*!
- \reimp
+ \internal
*/
void QmlView::paintEvent(QPaintEvent *event)
{
diff --git a/src/declarative/util/qmlview.h b/src/declarative/util/qmlview.h
index f4f58fd..1d6ef1c 100644
--- a/src/declarative/util/qmlview.h
+++ b/src/declarative/util/qmlview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QFXVIEW_H
-#define QFXVIEW_H
+#ifndef QMLVIEW_H
+#define QMLVIEW_H
#include <QtCore/qdatetime.h>
#include <QtGui/qgraphicssceneevent.h>
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsItem;
+class QGraphicsObject;
class QmlEngine;
class QmlContext;
class QmlError;
@@ -62,35 +62,36 @@ class QmlViewPrivate;
class Q_DECLARATIVE_EXPORT QmlView : public QGraphicsView
{
Q_OBJECT
- Q_PROPERTY(bool contentResizable READ contentResizable WRITE setContentResizable)
+ Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode)
+ Q_PROPERTY(Status status READ status NOTIFY statusChanged)
+
public:
explicit QmlView(QWidget *parent = 0);
-
virtual ~QmlView();
- void setUrl(const QUrl&);
- QUrl url() const;
- void setQml(const QString &qml, const QString &filename=QString());
- QString qml() const;
+ QUrl source() const;
+ void setSource(const QUrl&);
+
QmlEngine* engine();
QmlContext* rootContext();
- virtual void execute();
- virtual void reset();
+ void execute();
+
+ QGraphicsObject *rootObject() const;
+
+ enum ResizeMode { SizeViewToRootObject, SizeRootObjectToView };
+ ResizeMode resizeMode() const;
+ void setResizeMode(ResizeMode);
- virtual QmlGraphicsItem* addItem(const QString &qml, QmlGraphicsItem* parent=0);
- virtual void clearItems();
+ enum Status { Null, Ready, Loading, Error };
+ Status status() const;
- virtual QmlGraphicsItem *root() const;
+ QList<QmlError> errors() const;
- void setContentResizable(bool);
- bool contentResizable() const;
QSize sizeHint() const;
Q_SIGNALS:
- void initialSize(QSize size);
- void sceneResized(QSize size);
- void errors(const QList<QmlError> &error);
- void quit ();
+ void sceneResized(QSize size); // ???
+ void statusChanged(QmlView::Status);
private Q_SLOTS:
void continueExecute();
@@ -101,8 +102,6 @@ protected:
virtual void paintEvent(QPaintEvent *event);
void timerEvent(QTimerEvent*);
-private:
- friend class QmlViewPrivate;
QmlViewPrivate *d;
};
@@ -110,4 +109,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QFXVIEW_H
+#endif // QMLVIEW_H
diff --git a/src/declarative/util/qmlxmllistmodel.cpp b/src/declarative/util/qmlxmllistmodel.cpp
index 5de4d6f..7e66576 100644
--- a/src/declarative/util/qmlxmllistmodel.cpp
+++ b/src/declarative/util/qmlxmllistmodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -148,19 +148,6 @@ QML_DECLARE_TYPE(QmlXmlListModelRole)
QT_BEGIN_NAMESPACE
-class QmlXmlListModelPrivate;
-struct QmlXmlRoleList : public QmlConcreteList<QmlXmlListModelRole *>
-{
- QmlXmlRoleList(QmlXmlListModelPrivate *p)
- : model(p) {}
- virtual void append(QmlXmlListModelRole *role);
- virtual void clear();
- virtual void removeAt(int i);
- virtual void insert(int i, QmlXmlListModelRole *role);
-
- QmlXmlListModelPrivate *model;
-};
-
class QmlXmlQuery : public QThread
{
Q_OBJECT
@@ -182,7 +169,7 @@ public:
m_abort = true;
}
- int doQuery(QString query, QString namespaces, QByteArray data, QmlXmlRoleList *roleObjects) {
+ int doQuery(QString query, QString namespaces, QByteArray data, QList<QmlXmlListModelRole *> *roleObjects) {
QMutexLocker locker(&m_mutex);
m_size = 0;
m_data = data;
@@ -257,7 +244,7 @@ private:
QString m_prefix;
int m_size;
int m_queryId;
- const QmlXmlRoleList *m_roleObjects;
+ const QList<QmlXmlListModelRole *> *m_roleObjects;
QList<QList<QVariant> > m_modelData;
QStringList m_keysValues;
QList<QmlXmlListRange> m_insertedItemRanges;
@@ -441,7 +428,7 @@ public:
QmlXmlListModelPrivate()
: isComponentComplete(true), size(-1), highestRole(Qt::UserRole)
, reply(0), status(QmlXmlListModel::Null), progress(0.0)
- , queryId(-1), roleObjects(this) {}
+ , queryId(-1), roleObjects() {}
bool isComponentComplete;
QUrl src;
@@ -457,42 +444,39 @@ public:
qreal progress;
QmlXmlQuery qmlXmlQuery;
int queryId;
- QmlXmlRoleList roleObjects;
+ QList<QmlXmlListModelRole *> roleObjects;
+ static void append_role(QmlListProperty<QmlXmlListModelRole> *list, QmlXmlListModelRole *role);
+ static void clear_role(QmlListProperty<QmlXmlListModelRole> *list);
+ static void removeAt_role(QmlListProperty<QmlXmlListModelRole> *list, int i);
+ static void insert_role(QmlListProperty<QmlXmlListModelRole> *list, int i, QmlXmlListModelRole *role);
QList<QList<QVariant> > data;
};
-void QmlXmlRoleList::append(QmlXmlListModelRole *role)
+void QmlXmlListModelPrivate::append_role(QmlListProperty<QmlXmlListModelRole> *list, QmlXmlListModelRole *role)
{
- insert(size(), role);
+ QmlXmlListModel *_this = qobject_cast<QmlXmlListModel *>(list->object);
+ if (_this) {
+ int i = _this->d_func()->roleObjects.count();
+ _this->d_func()->roleObjects.append(role);
+ if (_this->d_func()->roleNames.contains(role->name())) {
+ qmlInfo(role) << QObject::tr("\"%1\" duplicates a previous role name and will be disabled.").arg(role->name());
+ return;
+ }
+ _this->d_func()->roles.insert(i, _this->d_func()->highestRole);
+ _this->d_func()->roleNames.insert(i, role->name());
+ ++_this->d_func()->highestRole;
+ }
}
-//### clear, removeAt, and insert need to invalidate any cached data (in data table) as well
+//### clear needs to invalidate any cached data (in data table) as well
// (and the model should emit the appropriate signals)
-void QmlXmlRoleList::clear()
+void QmlXmlListModelPrivate::clear_role(QmlListProperty<QmlXmlListModelRole> *list)
{
- model->roles.clear();
- model->roleNames.clear();
- QmlConcreteList<QmlXmlListModelRole *>::clear();
-}
-
-void QmlXmlRoleList::removeAt(int i)
-{
- model->roles.removeAt(i);
- model->roleNames.removeAt(i);
- QmlConcreteList<QmlXmlListModelRole *>::removeAt(i);
-}
-
-void QmlXmlRoleList::insert(int i, QmlXmlListModelRole *role)
-{
- QmlConcreteList<QmlXmlListModelRole *>::insert(i, role);
- if (model->roleNames.contains(role->name())) {
- qmlInfo(role) << QObject::tr("\"%1\" duplicates a previous role name and will be disabled.").arg(role->name());
- return;
- }
- model->roles.insert(i, model->highestRole);
- model->roleNames.insert(i, role->name());
- ++model->highestRole;
+ QmlXmlListModel *_this = static_cast<QmlXmlListModel *>(list->object);
+ _this->d_func()->roles.clear();
+ _this->d_func()->roleNames.clear();
+ _this->d_func()->roleObjects.clear();
}
/*!
@@ -555,10 +539,13 @@ QmlXmlListModel::~QmlXmlListModel()
The roles to make available for this model.
*/
-QmlList<QmlXmlListModelRole *> *QmlXmlListModel::roleObjects()
+QmlListProperty<QmlXmlListModelRole> QmlXmlListModel::roleObjects()
{
Q_D(QmlXmlListModel);
- return &d->roleObjects;
+ QmlListProperty<QmlXmlListModelRole> list(this, d->roleObjects);
+ list.append = &QmlXmlListModelPrivate::append_role;
+ list.clear = &QmlXmlListModelPrivate::clear_role;
+ return list;
}
QHash<int,QVariant> QmlXmlListModel::data(int index, const QList<int> &roles) const
@@ -662,7 +649,7 @@ void QmlXmlListModel::setQuery(const QString &query)
{
Q_D(QmlXmlListModel);
if (!query.startsWith(QLatin1Char('/'))) {
- qmlInfo(this) << tr("An XmlListModel query must start with '/' or \"//\"");
+ qmlInfo(this) << QCoreApplication::translate("QmlXmlRoleList", "An XmlListModel query must start with '/' or \"//\"");
return;
}
diff --git a/src/declarative/util/qmlxmllistmodel_p.h b/src/declarative/util/qmlxmllistmodel_p.h
index e4b8cab..a6627e2 100644
--- a/src/declarative/util/qmlxmllistmodel_p.h
+++ b/src/declarative/util/qmlxmllistmodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -70,7 +70,7 @@ class Q_DECLARATIVE_EXPORT QmlXmlListModel : public QListModelInterface, public
Q_PROPERTY(QString xml READ xml WRITE setXml)
Q_PROPERTY(QString query READ query WRITE setQuery)
Q_PROPERTY(QString namespaceDeclarations READ namespaceDeclarations WRITE setNamespaceDeclarations)
- Q_PROPERTY(QmlList<QmlXmlListModelRole *> *roles READ roleObjects)
+ Q_PROPERTY(QmlListProperty<QmlXmlListModelRole> roles READ roleObjects)
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_CLASSINFO("DefaultProperty", "roles")
@@ -84,7 +84,7 @@ public:
virtual QList<int> roles() const;
virtual QString toString(int role) const;
- QmlList<QmlXmlListModelRole *> *roleObjects();
+ QmlListProperty<QmlXmlListModelRole> roleObjects();
QUrl source() const;
void setSource(const QUrl&);
diff --git a/src/declarative/util/qnumberformat.cpp b/src/declarative/util/qnumberformat.cpp
index fd44db1..42c12fe 100644
--- a/src/declarative/util/qnumberformat.cpp
+++ b/src/declarative/util/qnumberformat.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qnumberformat_p.h b/src/declarative/util/qnumberformat_p.h
index c73ef8a..902dcde 100644
--- a/src/declarative/util/qnumberformat_p.h
+++ b/src/declarative/util/qnumberformat_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qperformancelog.cpp b/src/declarative/util/qperformancelog.cpp
index 2f91dfb..83cc919 100644
--- a/src/declarative/util/qperformancelog.cpp
+++ b/src/declarative/util/qperformancelog.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/util/qperformancelog_p_p.h b/src/declarative/util/qperformancelog_p_p.h
index e7a3b5e..a212f28 100644
--- a/src/declarative/util/qperformancelog_p_p.h
+++ b/src/declarative/util/qperformancelog_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/declarative/widgets/graphicslayouts.cpp b/src/declarative/widgets/graphicslayouts.cpp
index 065040f..62e941a 100644
--- a/src/declarative/widgets/graphicslayouts.cpp
+++ b/src/declarative/widgets/graphicslayouts.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -109,7 +109,7 @@ QSizeF QGraphicsLinearLayoutStretchItemObject::sizeHint(Qt::SizeHint which, cons
QGraphicsLinearLayoutObject::QGraphicsLinearLayoutObject(QObject *parent)
-: QObject(parent), _children(this)
+: QObject(parent)
{
}
@@ -246,7 +246,7 @@ private:
QGraphicsGridLayoutObject::QGraphicsGridLayoutObject(QObject *parent)
-: QObject(parent), _children(this)
+: QObject(parent)
{
}
diff --git a/src/declarative/widgets/graphicslayouts_p.h b/src/declarative/widgets/graphicslayouts_p.h
index 34e2556..3076af1 100644
--- a/src/declarative/widgets/graphicslayouts_p.h
+++ b/src/declarative/widgets/graphicslayouts_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -69,7 +69,7 @@ class QGraphicsLinearLayoutObject : public QObject, public QGraphicsLinearLayout
Q_OBJECT
Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem)
- Q_PROPERTY(QmlList<QGraphicsLayoutItem *> *children READ children)
+ Q_PROPERTY(QmlListProperty<QGraphicsLayoutItem> children READ children)
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing)
Q_CLASSINFO("DefaultProperty", "children")
@@ -77,7 +77,7 @@ public:
QGraphicsLinearLayoutObject(QObject * = 0);
~QGraphicsLinearLayoutObject();
- QmlList<QGraphicsLayoutItem *> *children() { return &_children; }
+ QmlListProperty<QGraphicsLayoutItem> children() { return QmlListProperty<QGraphicsLayoutItem>(this, 0, children_append, children_count, children_at, children_clear); }
static LinearLayoutAttached *qmlAttachedProperties(QObject *);
@@ -91,27 +91,21 @@ private:
void insertLayoutItem(int, QGraphicsLayoutItem *);
static QHash<QGraphicsLayoutItem*, LinearLayoutAttached*> attachedProperties;
- class ChildList : public QmlList<QGraphicsLayoutItem *>
- {
- public:
- ChildList(QGraphicsLinearLayoutObject *o)
- : obj(o) {}
-
- virtual void append(QGraphicsLayoutItem *item)
- {
- insert(-1, item);
- }
- virtual void clear() { obj->clearChildren(); }
- virtual int count() const { return obj->count(); }
- virtual void removeAt(int i) { obj->removeAt(i); }
- virtual QGraphicsLayoutItem *at(int i) const { return obj->itemAt(i); }
- virtual void insert(int i, QGraphicsLayoutItem *item) { obj->insertLayoutItem(i, item); }
-
- private:
- QGraphicsLinearLayoutObject *obj;
- };
-
- ChildList _children;
+ static void children_append(QmlListProperty<QGraphicsLayoutItem> *prop, QGraphicsLayoutItem *item) {
+ static_cast<QGraphicsLinearLayoutObject*>(prop->object)->insertLayoutItem(-1, item);
+ }
+
+ static void children_clear(QmlListProperty<QGraphicsLayoutItem> *prop) {
+ static_cast<QGraphicsLinearLayoutObject*>(prop->object)->clearChildren();
+ }
+
+ static int children_count(QmlListProperty<QGraphicsLayoutItem> *prop) {
+ return static_cast<QGraphicsLinearLayoutObject*>(prop->object)->count();
+ }
+
+ static QGraphicsLayoutItem *children_at(QmlListProperty<QGraphicsLayoutItem> *prop, int index) {
+ return static_cast<QGraphicsLinearLayoutObject*>(prop->object)->itemAt(index);
+ }
};
class GridLayoutAttached;
@@ -120,7 +114,7 @@ class QGraphicsGridLayoutObject : public QObject, public QGraphicsGridLayout
Q_OBJECT
Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem)
- Q_PROPERTY(QmlList<QGraphicsLayoutItem *> *children READ children)
+ Q_PROPERTY(QmlListProperty<QGraphicsLayoutItem> children READ children)
Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing)
Q_PROPERTY(qreal verticalSpacing READ verticalSpacing WRITE setVerticalSpacing)
Q_PROPERTY(qreal horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing)
@@ -129,7 +123,7 @@ public:
QGraphicsGridLayoutObject(QObject * = 0);
~QGraphicsGridLayoutObject();
- QmlList<QGraphicsLayoutItem *> *children() { return &_children; }
+ QmlListProperty<QGraphicsLayoutItem> children() { return QmlListProperty<QGraphicsLayoutItem>(this, 0, children_append, children_count, children_at, children_clear); }
qreal spacing() const;
@@ -142,30 +136,21 @@ private:
void addLayoutItem(QGraphicsLayoutItem *);
static QHash<QGraphicsLayoutItem*, GridLayoutAttached*> attachedProperties;
- class ChildList : public QmlList<QGraphicsLayoutItem *>
- {
- public:
- ChildList(QGraphicsGridLayoutObject *o)
- : obj(o) {}
-
- virtual void append(QGraphicsLayoutItem *o)
- {
- obj->addLayoutItem(o);
- }
- virtual void clear() { obj->clearChildren(); }
- virtual int count() const { return obj->count(); }
- virtual void removeAt(int i) { obj->removeAt(i); }
- virtual QGraphicsLayoutItem *at(int i) const { return obj->itemAt(i); }
- //### GridLayout doesn't have an insert, so for now we treat it as an append.
- // this is obviously potenitally dangerous -- perhaps should be a concrete
- // list with no relation to layout index, etc at all.
- virtual void insert(int, QGraphicsLayoutItem *item) { append(item); }
-
- private:
- QGraphicsGridLayoutObject *obj;
- };
-
- ChildList _children;
+ static void children_append(QmlListProperty<QGraphicsLayoutItem> *prop, QGraphicsLayoutItem *item) {
+ static_cast<QGraphicsGridLayoutObject*>(prop->object)->addLayoutItem(item);
+ }
+
+ static void children_clear(QmlListProperty<QGraphicsLayoutItem> *prop) {
+ static_cast<QGraphicsGridLayoutObject*>(prop->object)->clearChildren();
+ }
+
+ static int children_count(QmlListProperty<QGraphicsLayoutItem> *prop) {
+ return static_cast<QGraphicsGridLayoutObject*>(prop->object)->count();
+ }
+
+ static QGraphicsLayoutItem *children_at(QmlListProperty<QGraphicsLayoutItem> *prop, int index) {
+ return static_cast<QGraphicsGridLayoutObject*>(prop->object)->itemAt(index);
+ }
};
QT_END_NAMESPACE
diff --git a/src/declarative/widgets/graphicswidgets.cpp b/src/declarative/widgets/graphicswidgets.cpp
index 4c13865..bb4dc74 100644
--- a/src/declarative/widgets/graphicswidgets.cpp
+++ b/src/declarative/widgets/graphicswidgets.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -63,63 +63,31 @@ class QGraphicsSceneDeclarativeUI : public QObject
{
Q_OBJECT
- Q_PROPERTY(QmlList<QObject *> *children READ children)
+ Q_PROPERTY(QmlListProperty<QObject> children READ children)
Q_CLASSINFO("DefaultProperty", "children")
public:
- QGraphicsSceneDeclarativeUI(QObject *other) : QObject(other), _children(other) {}
+ QGraphicsSceneDeclarativeUI(QObject *other) : QObject(other) {}
- QmlList<QObject *> *children() { return &_children; }
+ QmlListProperty<QObject> children() { return QmlListProperty<QObject>(this->parent(), 0, children_append); }
private:
- class Children : public QmlConcreteList<QObject *>
- {
- public:
- Children(QObject *scene) : q(scene) {}
- virtual void append(QObject *o)
- {
- insert(-1, o);
- }
- virtual void clear()
- {
- for (int i = 0; i < count(); ++i)
- if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(at(i)))
- static_cast<QGraphicsScene *>(q)->removeItem(go);
- QmlConcreteList<QObject *>::clear();
- }
- virtual void removeAt(int i)
- {
- if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(at(i)))
- static_cast<QGraphicsScene *>(q)->removeItem(go);
- QmlConcreteList<QObject *>::removeAt(i);
- }
- virtual void insert(int i, QObject *o)
- {
- QmlConcreteList<QObject *>::insert(i, o);
- if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o))
- static_cast<QGraphicsScene *>(q)->addItem(go);
- //else if (QWidget *w = qobject_cast<QWidget *>(o))
- // static_cast<QGraphicsScene *>(q)->addWidget(w);
- }
- private:
- QObject *q;
- };
- Children _children;
+ static void children_append(QmlListProperty<QObject> *prop, QObject *o) {
+ if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o))
+ static_cast<QGraphicsScene *>(prop->object)->addItem(go);
+ }
};
class QGraphicsWidgetDeclarativeUI : public QObject
{
Q_OBJECT
- Q_PROPERTY(QmlList<QObject *> *data READ data)
- Q_PROPERTY(QmlList<QGraphicsItem *> *children READ children)
+ Q_PROPERTY(QmlListProperty<QGraphicsItem> children READ children)
Q_PROPERTY(QGraphicsLayout *layout READ layout WRITE setLayout)
Q_CLASSINFO("DefaultProperty", "children")
public:
- QGraphicsWidgetDeclarativeUI(QObject *other) : QObject(other), _widgets(this) {}
-
- QmlList<QObject *> *data() { return &_data; }
+ QGraphicsWidgetDeclarativeUI(QObject *other) : QObject(other) {}
- QmlList<QGraphicsItem *> *children() { return &_widgets; }
+ QmlListProperty<QGraphicsItem> children() { return QmlListProperty<QGraphicsItem>(this, 0, children_append); }
QGraphicsLayout *layout() const { return static_cast<QGraphicsWidget *>(parent())->layout(); }
void setLayout(QGraphicsLayout *lo)
@@ -128,28 +96,14 @@ public:
}
private:
- friend class WidgetList;
void setItemParent(QGraphicsItem *wid)
{
wid->setParentItem(static_cast<QGraphicsWidget *>(parent()));
}
- class WidgetList : public QmlConcreteList<QGraphicsItem *>
- {
- public:
- WidgetList(QGraphicsWidgetDeclarativeUI *o)
- : obj(o) {}
-
- virtual void append(QGraphicsItem *w) { QmlConcreteList<QGraphicsItem *>::append(w); obj->setItemParent(w); }
- virtual void clear() { QmlConcreteList<QGraphicsItem *>::clear(); } //###
- virtual void removeAt(int i) { QmlConcreteList<QGraphicsItem *>::removeAt(i); } //###
- virtual void insert(int i, QGraphicsItem *item) { QmlConcreteList<QGraphicsItem *>::insert(i, item); obj->setItemParent(item); }
-
- private:
- QGraphicsWidgetDeclarativeUI *obj;
- };
- WidgetList _widgets;
- QmlConcreteList<QObject *> _data;
+ static void children_append(QmlListProperty<QGraphicsItem> *prop, QGraphicsItem *i) {
+ static_cast<QGraphicsWidgetDeclarativeUI*>(prop->object)->setItemParent(i);
+ }
};
QML_DEFINE_EXTENDED_TYPE(Qt,4,6,QGraphicsView,QGraphicsView,QGraphicsViewDeclarativeUI)
diff --git a/src/declarative/widgets/graphicswidgets_p.h b/src/declarative/widgets/graphicswidgets_p.h
index 0de5c89..6255d2b 100644
--- a/src/declarative/widgets/graphicswidgets_p.h
+++ b/src/declarative/widgets/graphicswidgets_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**