summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@nokia.com>2010-02-26 15:19:54 (GMT)
committerJoerg Bornemann <joerg.bornemann@nokia.com>2010-02-26 15:19:54 (GMT)
commited1d9f24d035857438e5bb9ccb423310bc30310b (patch)
treeef949d57470b11331a6a2b667f2cdb5467c285cd /src
parentab9a87eb2a5af0b74834e247f44fb4fad0dfb8cb (diff)
parent27e403d9c6185c606980bb7881e39a2c88138a13 (diff)
downloadQt-ed1d9f24d035857438e5bb9ccb423310bc30310b.zip
Qt-ed1d9f24d035857438e5bb9ccb423310bc30310b.tar.gz
Qt-ed1d9f24d035857438e5bb9ccb423310bc30310b.tar.bz2
Merge remote branch 'origin/master' into berlin-master
Conflicts: configure.exe
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp6
-rw-r--r--src/3rdparty/libpng/png.h2
-rw-r--r--src/3rdparty/libpng/pngconf.h2
-rw-r--r--src/3rdparty/libpng/pngpriv.h4
-rw-r--r--src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp4
-rw-r--r--src/activeqt/container/qaxbase.cpp4
-rw-r--r--src/activeqt/container/qaxwidget.cpp34
-rw-r--r--src/activeqt/control/qaxserverbase.cpp10
-rw-r--r--src/corelib/corelib.pro22
-rw-r--r--src/corelib/global/qlibraryinfo.cpp8
-rw-r--r--src/corelib/global/qlibraryinfo.h3
-rw-r--r--src/corelib/io/qurl.cpp2
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp12
-rw-r--r--src/corelib/kernel/qmetatype.cpp26
-rw-r--r--src/corelib/kernel/qmetatype.h8
-rw-r--r--src/corelib/kernel/qvariant.cpp57
-rw-r--r--src/corelib/kernel/qvariant.h12
-rw-r--r--src/corelib/thread/qmutex.cpp7
-rw-r--r--src/corelib/tools/qeasingcurve.cpp69
-rw-r--r--src/corelib/tools/qeasingcurve.h11
-rw-r--r--src/corelib/tools/qlocale.cpp10
-rw-r--r--src/corelib/tools/qlocale_symbian.cpp6
-rw-r--r--src/corelib/tools/qregexp.cpp11
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h1
-rw-r--r--src/corelib/tools/qsimd.cpp246
-rw-r--r--src/corelib/tools/qsimd_p.h126
-rw-r--r--src/corelib/tools/qstring.cpp112
-rw-r--r--src/corelib/tools/qstring.h10
-rw-r--r--src/corelib/tools/qstringbuilder.h40
-rw-r--r--src/corelib/tools/tools.pri2
-rw-r--r--src/declarative/3rdparty/qlistmodelinterface.cpp4
-rw-r--r--src/declarative/QmlChanges.txt18
-rw-r--r--src/declarative/debugger/debugger.pri16
-rw-r--r--src/declarative/debugger/qdeclarativedebug.cpp937
-rw-r--r--src/declarative/debugger/qdeclarativedebug_p.h371
-rw-r--r--src/declarative/debugger/qdeclarativedebugclient.cpp (renamed from src/declarative/debugger/qmldebugclient.cpp)74
-rw-r--r--src/declarative/debugger/qdeclarativedebugclient_p.h (renamed from src/declarative/debugger/qmldebugclient_p.h)34
-rw-r--r--src/declarative/debugger/qdeclarativedebuggerstatus.cpp (renamed from src/declarative/debugger/qmldebuggerstatus.cpp)6
-rw-r--r--src/declarative/debugger/qdeclarativedebuggerstatus_p.h (renamed from src/declarative/debugger/qmldebuggerstatus_p.h)10
-rw-r--r--src/declarative/debugger/qdeclarativedebugservice.cpp (renamed from src/declarative/debugger/qmldebugservice.cpp)142
-rw-r--r--src/declarative/debugger/qdeclarativedebugservice_p.h (renamed from src/declarative/debugger/qmldebugservice_p.h)18
-rw-r--r--src/declarative/debugger/qmldebug.cpp937
-rw-r--r--src/declarative/debugger/qmldebug_p.h371
-rw-r--r--src/declarative/declarative.pro3
-rw-r--r--src/declarative/graphicsitems/graphicsitems.pri168
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanchors.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsanchors.cpp)418
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanchors_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsanchors_p.h)84
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanchors_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h)64
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsanimatedimage.cpp)68
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsanimatedimage_p.h)22
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanimatedimage_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsanimatedimage_p_p.h)14
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsborderimage.cpp)142
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsborderimage_p.h)35
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsborderimage_p_p.h)34
-rw-r--r--src/declarative/graphicsitems/qdeclarativeeffects.cpp (renamed from src/declarative/graphicsitems/qmlgraphicseffects.cpp)2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeeffects_p.h (renamed from src/declarative/graphicsitems/qmlgraphicseffects_p.h)8
-rw-r--r--src/declarative/graphicsitems/qdeclarativeevents.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsevents.cpp)10
-rw-r--r--src/declarative/graphicsitems/qdeclarativeevents_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsevents_p_p.h)22
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsflickable.cpp)485
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsflickable_p.h)77
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsflickable_p_p.h)56
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflipable.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsflipable.cpp)72
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflipable_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsflipable_p.h)34
-rw-r--r--src/declarative/graphicsitems/qdeclarativefocuspanel.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsfocuspanel.cpp)16
-rw-r--r--src/declarative/graphicsitems/qdeclarativefocuspanel_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsfocuspanel_p.h)18
-rw-r--r--src/declarative/graphicsitems/qdeclarativefocusscope.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsfocusscope.cpp)12
-rw-r--r--src/declarative/graphicsitems/qdeclarativefocusscope_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsfocusscope_p.h)16
-rw-r--r--src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer.cpp)60
-rw-r--r--src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer_p.h)20
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsgridview.cpp)462
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsgridview_p.h)71
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsimage.cpp)91
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsimage_p.h)25
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsimage_p_p.h)20
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsimagebase.cpp)100
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsimagebase_p.h)27
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsimagebase_p_p.h)22
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsitem.cpp)665
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.h (renamed from src/declarative/graphicsitems/qmlgraphicsitem.h)110
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem_p.h471
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitemchangelistener_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsitemchangelistener_p.h)24
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp161
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitemsmodule_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsitemsmodule_p.h)10
-rw-r--r--src/declarative/graphicsitems/qdeclarativelayoutitem.cpp (renamed from src/declarative/graphicsitems/qmlgraphicslayoutitem.cpp)16
-rw-r--r--src/declarative/graphicsitems/qdeclarativelayoutitem_p.h (renamed from src/declarative/graphicsitems/qmlgraphicslayoutitem_p.h)12
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp (renamed from src/declarative/graphicsitems/qmlgraphicslistview.cpp)696
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview_p.h (renamed from src/declarative/graphicsitems/qmlgraphicslistview_p.h)93
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsloader.cpp)150
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsloader_p.h)28
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsloader_p_p.h)28
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsmousearea.cpp)186
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsmousearea_p.h)58
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsmousearea_p_p.h)22
-rw-r--r--src/declarative/graphicsitems/qdeclarativepainteditem.cpp (renamed from src/declarative/graphicsitems/qmlgraphicspainteditem.cpp)98
-rw-r--r--src/declarative/graphicsitems/qdeclarativepainteditem_p.h (renamed from src/declarative/graphicsitems/qmlgraphicspainteditem_p.h)22
-rw-r--r--src/declarative/graphicsitems/qdeclarativepainteditem_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicspainteditem_p_p.h)12
-rw-r--r--src/declarative/graphicsitems/qdeclarativeparticles.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsparticles.cpp)391
-rw-r--r--src/declarative/graphicsitems/qdeclarativeparticles_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsparticles_p.h)129
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath.cpp (renamed from src/declarative/graphicsitems/qmlgraphicspath.cpp)202
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath_p.h (renamed from src/declarative/graphicsitems/qmlgraphicspath_p.h)74
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicspath_p_p.h)18
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp (renamed from src/declarative/graphicsitems/qmlgraphicspathview.cpp)272
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview_p.h (renamed from src/declarative/graphicsitems/qmlgraphicspathview_p.h)45
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicspathview_p_p.h)44
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners.cpp (renamed from src/declarative/graphicsitems/qmlgraphicspositioners.cpp)223
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners_p.h (renamed from src/declarative/graphicsitems/qmlgraphicspositioners_p.h)91
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicspositioners_p_p.h)64
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsrectangle.cpp)90
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsrectangle_p.h)58
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h)32
-rw-r--r--src/declarative/graphicsitems/qdeclarativerepeater.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsrepeater.cpp)101
-rw-r--r--src/declarative/graphicsitems/qdeclarativerepeater_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsrepeater_p.h)29
-rw-r--r--src/declarative/graphicsitems/qdeclarativerepeater_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsrepeater_p_p.h)26
-rw-r--r--src/declarative/graphicsitems/qdeclarativescalegrid.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsscalegrid.cpp)56
-rw-r--r--src/declarative/graphicsitems/qdeclarativescalegrid_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsscalegrid_p_p.h)40
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp (renamed from src/declarative/graphicsitems/qmlgraphicstext.cpp)202
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext_p.h (renamed from src/declarative/graphicsitems/qmlgraphicstext_p.h)20
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicstext_p_p.h)36
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp (renamed from src/declarative/graphicsitems/qmlgraphicstextedit.cpp)294
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit_p.h (renamed from src/declarative/graphicsitems/qmlgraphicstextedit_p.h)26
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicstextedit_p_p.h)30
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp (renamed from src/declarative/graphicsitems/qmlgraphicstextinput.cpp)254
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput_p.h (renamed from src/declarative/graphicsitems/qmlgraphicstextinput_p.h)28
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicstextinput_p_p.h)30
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp)650
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h)127
-rw-r--r--src/declarative/graphicsitems/qdeclarativewebview.cpp (renamed from src/declarative/graphicsitems/qmlgraphicswebview.cpp)385
-rw-r--r--src/declarative/graphicsitems/qdeclarativewebview_p.h (renamed from src/declarative/graphicsitems/qmlgraphicswebview_p.h)77
-rw-r--r--src/declarative/graphicsitems/qdeclarativewebview_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicswebview_p_p.h)12
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitem_p.h471
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp167
-rw-r--r--src/declarative/qml/parser/parser.pri32
-rw-r--r--src/declarative/qml/parser/qdeclarativejs.g (renamed from src/declarative/qml/parser/qmljs.g)99
-rw-r--r--src/declarative/qml/parser/qdeclarativejsast.cpp (renamed from src/declarative/qml/parser/qmljsast.cpp)8
-rw-r--r--src/declarative/qml/parser/qdeclarativejsast_p.h (renamed from src/declarative/qml/parser/qmljsast_p.h)209
-rw-r--r--src/declarative/qml/parser/qdeclarativejsastfwd_p.h (renamed from src/declarative/qml/parser/qmljsastfwd_p.h)8
-rw-r--r--src/declarative/qml/parser/qdeclarativejsastvisitor.cpp (renamed from src/declarative/qml/parser/qmljsastvisitor.cpp)6
-rw-r--r--src/declarative/qml/parser/qdeclarativejsastvisitor_p.h (renamed from src/declarative/qml/parser/qmljsastvisitor_p.h)14
-rw-r--r--src/declarative/qml/parser/qdeclarativejsengine_p.cpp (renamed from src/declarative/qml/parser/qmljsengine_p.cpp)16
-rw-r--r--src/declarative/qml/parser/qdeclarativejsengine_p.h (renamed from src/declarative/qml/parser/qmljsengine_p.h)28
-rw-r--r--src/declarative/qml/parser/qdeclarativejsglobal_p.h (renamed from src/declarative/qml/parser/qmljsglobal_p.h)10
-rw-r--r--src/declarative/qml/parser/qdeclarativejsgrammar.cpp992
-rw-r--r--src/declarative/qml/parser/qdeclarativejsgrammar_p.h (renamed from src/declarative/qml/parser/qmljsgrammar_p.h)41
-rw-r--r--src/declarative/qml/parser/qdeclarativejslexer.cpp (renamed from src/declarative/qml/parser/qmljslexer.cpp)290
-rw-r--r--src/declarative/qml/parser/qdeclarativejslexer_p.h (renamed from src/declarative/qml/parser/qmljslexer_p.h)10
-rw-r--r--src/declarative/qml/parser/qdeclarativejsmemorypool_p.h (renamed from src/declarative/qml/parser/qmljsmemorypool_p.h)10
-rw-r--r--src/declarative/qml/parser/qdeclarativejsnodepool_p.h (renamed from src/declarative/qml/parser/qmljsnodepool_p.h)12
-rw-r--r--src/declarative/qml/parser/qdeclarativejsparser.cpp (renamed from src/declarative/qml/parser/qmljsparser.cpp)456
-rw-r--r--src/declarative/qml/parser/qdeclarativejsparser_p.h (renamed from src/declarative/qml/parser/qmljsparser_p.h)24
-rw-r--r--src/declarative/qml/parser/qmljsgrammar.cpp939
-rw-r--r--src/declarative/qml/qdeclarative.h312
-rw-r--r--src/declarative/qml/qdeclarativebinding.cpp (renamed from src/declarative/qml/qmlbinding.cpp)118
-rw-r--r--src/declarative/qml/qdeclarativebinding_p.h137
-rw-r--r--src/declarative/qml/qdeclarativebinding_p_p.h (renamed from src/declarative/qml/qmlbinding_p.h)32
-rw-r--r--src/declarative/qml/qdeclarativeboundsignal.cpp (renamed from src/declarative/qml/qmlboundsignal.cpp)93
-rw-r--r--src/declarative/qml/qdeclarativeboundsignal_p.h (renamed from src/declarative/qml/qmlboundsignal_p.h)34
-rw-r--r--src/declarative/qml/qdeclarativeclassfactory.cpp (renamed from src/declarative/qml/qmlclassfactory.cpp)4
-rw-r--r--src/declarative/qml/qdeclarativeclassfactory_p.h (renamed from src/declarative/qml/qmlclassfactory_p.h)16
-rw-r--r--src/declarative/qml/qdeclarativecleanup.cpp (renamed from src/declarative/qml/qmlcleanup.cpp)22
-rw-r--r--src/declarative/qml/qdeclarativecleanup_p.h (renamed from src/declarative/qml/qmlcleanup_p.h)20
-rw-r--r--src/declarative/qml/qdeclarativecompiledbindings.cpp (renamed from src/declarative/qml/qmlcompiledbindings.cpp)344
-rw-r--r--src/declarative/qml/qdeclarativecompiledbindings_p.h (renamed from src/declarative/qml/qmlcompiledbindings_p.h)48
-rw-r--r--src/declarative/qml/qdeclarativecompileddata.cpp (renamed from src/declarative/qml/qmlcompileddata.cpp)48
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp (renamed from src/declarative/qml/qmlcompiler.cpp)869
-rw-r--r--src/declarative/qml/qdeclarativecompiler_p.h338
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp (renamed from src/declarative/qml/qmlcomponent.cpp)323
-rw-r--r--src/declarative/qml/qdeclarativecomponent.h (renamed from src/declarative/qml/qmlcomponent.h)60
-rw-r--r--src/declarative/qml/qdeclarativecomponent_p.h (renamed from src/declarative/qml/qmlcomponent_p.h)76
-rw-r--r--src/declarative/qml/qdeclarativecompositetypedata_p.h (renamed from src/declarative/qml/qmlcompositetypedata_p.h)72
-rw-r--r--src/declarative/qml/qdeclarativecompositetypemanager.cpp (renamed from src/declarative/qml/qmlcompositetypemanager.cpp)244
-rw-r--r--src/declarative/qml/qdeclarativecompositetypemanager_p.h (renamed from src/declarative/qml/qmlcompositetypemanager_p.h)68
-rw-r--r--src/declarative/qml/qdeclarativecontext.cpp (renamed from src/declarative/qml/qmlcontext.cpp)208
-rw-r--r--src/declarative/qml/qdeclarativecontext.h (renamed from src/declarative/qml/qmlcontext.h)54
-rw-r--r--src/declarative/qml/qdeclarativecontext_p.h (renamed from src/declarative/qml/qmlcontext_p.h)90
-rw-r--r--src/declarative/qml/qdeclarativecontextscriptclass.cpp (renamed from src/declarative/qml/qmlcontextscriptclass.cpp)84
-rw-r--r--src/declarative/qml/qdeclarativecontextscriptclass_p.h (renamed from src/declarative/qml/qmlcontextscriptclass_p.h)32
-rw-r--r--src/declarative/qml/qdeclarativecustomparser.cpp (renamed from src/declarative/qml/qmlcustomparser.cpp)94
-rw-r--r--src/declarative/qml/qdeclarativecustomparser_p.h (renamed from src/declarative/qml/qmlcustomparser_p.h)82
-rw-r--r--src/declarative/qml/qdeclarativecustomparser_p_p.h (renamed from src/declarative/qml/qmlcustomparser_p_p.h)26
-rw-r--r--src/declarative/qml/qdeclarativedeclarativedata_p.h (renamed from src/declarative/qml/qmldeclarativedata_p.h)58
-rw-r--r--src/declarative/qml/qdeclarativedirparser.cpp220
-rw-r--r--src/declarative/qml/qdeclarativedirparser_p.h125
-rw-r--r--src/declarative/qml/qdeclarativedom.cpp (renamed from src/declarative/qml/qmldom.cpp)720
-rw-r--r--src/declarative/qml/qdeclarativedom_p.h360
-rw-r--r--src/declarative/qml/qdeclarativedom_p_p.h (renamed from src/declarative/qml/qmldom_p_p.h)86
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp (renamed from src/declarative/qml/qmlengine.cpp)941
-rw-r--r--src/declarative/qml/qdeclarativeengine.h (renamed from src/declarative/qml/qmlengine.h)45
-rw-r--r--src/declarative/qml/qdeclarativeengine_p.h (renamed from src/declarative/qml/qmlengine_p.h)190
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug.cpp (renamed from src/declarative/qml/qmlenginedebug.cpp)143
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug_p.h (renamed from src/declarative/qml/qmlenginedebug_p.h)44
-rw-r--r--src/declarative/qml/qdeclarativeerror.cpp (renamed from src/declarative/qml/qmlerror.cpp)56
-rw-r--r--src/declarative/qml/qdeclarativeerror.h (renamed from src/declarative/qml/qmlerror.h)22
-rw-r--r--src/declarative/qml/qdeclarativeexpression.cpp (renamed from src/declarative/qml/qmlexpression.cpp)304
-rw-r--r--src/declarative/qml/qdeclarativeexpression.h (renamed from src/declarative/qml/qmlexpression.h)55
-rw-r--r--src/declarative/qml/qdeclarativeexpression_p.h (renamed from src/declarative/qml/qmlexpression_p.h)96
-rw-r--r--src/declarative/qml/qdeclarativeextensioninterface.h68
-rw-r--r--src/declarative/qml/qdeclarativeextensionplugin.cpp99
-rw-r--r--src/declarative/qml/qdeclarativeextensionplugin.h73
-rw-r--r--src/declarative/qml/qdeclarativeglobal_p.h (renamed from src/declarative/qml/qmlglobal_p.h)12
-rw-r--r--src/declarative/qml/qdeclarativeglobalscriptclass.cpp (renamed from src/declarative/qml/qmlglobalscriptclass.cpp)12
-rw-r--r--src/declarative/qml/qdeclarativeglobalscriptclass_p.h (renamed from src/declarative/qml/qmlglobalscriptclass_p.h)10
-rw-r--r--src/declarative/qml/qdeclarativeguard_p.h (renamed from src/declarative/qml/qmlguard_p.h)43
-rw-r--r--src/declarative/qml/qdeclarativeimageprovider.cpp (renamed from src/declarative/qml/qmlimageprovider.cpp)12
-rw-r--r--src/declarative/qml/qdeclarativeimageprovider.h (renamed from src/declarative/qml/qmlimageprovider.h)10
-rw-r--r--src/declarative/qml/qdeclarativeinfo.cpp (renamed from src/declarative/qml/qmlinfo.cpp)22
-rw-r--r--src/declarative/qml/qdeclarativeinfo.h92
-rw-r--r--src/declarative/qml/qdeclarativeinstruction.cpp (renamed from src/declarative/qml/qmlinstruction.cpp)100
-rw-r--r--src/declarative/qml/qdeclarativeinstruction_p.h (renamed from src/declarative/qml/qmlinstruction_p.h)14
-rw-r--r--src/declarative/qml/qdeclarativeintegercache.cpp (renamed from src/declarative/qml/qmlintegercache.cpp)20
-rw-r--r--src/declarative/qml/qdeclarativeintegercache_p.h (renamed from src/declarative/qml/qmlintegercache_p.h)26
-rw-r--r--src/declarative/qml/qdeclarativelist.cpp409
-rw-r--r--src/declarative/qml/qdeclarativelist.h (renamed from src/declarative/qml/qmllist.h)60
-rw-r--r--src/declarative/qml/qdeclarativelist_p.h (renamed from src/declarative/qml/qmllist_p.h)22
-rw-r--r--src/declarative/qml/qdeclarativelistscriptclass.cpp (renamed from src/declarative/qml/qmllistscriptclass.cpp)40
-rw-r--r--src/declarative/qml/qdeclarativelistscriptclass_p.h (renamed from src/declarative/qml/qmllistscriptclass_p.h)22
-rw-r--r--src/declarative/qml/qdeclarativemetatype.cpp (renamed from src/declarative/qml/qmlmetatype.cpp)309
-rw-r--r--src/declarative/qml/qdeclarativemetatype_p.h149
-rw-r--r--src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp (renamed from src/declarative/qml/qmlnetworkaccessmanagerfactory.cpp)12
-rw-r--r--src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.h (renamed from src/declarative/qml/qmlnetworkaccessmanagerfactory.h)10
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp (renamed from src/declarative/qml/qmlobjectscriptclass.cpp)168
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass_p.h (renamed from src/declarative/qml/qmlobjectscriptclass_p.h)48
-rw-r--r--src/declarative/qml/qdeclarativeparser.cpp (renamed from src/declarative/qml/qmlparser.cpp)102
-rw-r--r--src/declarative/qml/qdeclarativeparser_p.h (renamed from src/declarative/qml/qmlparser_p.h)60
-rw-r--r--src/declarative/qml/qdeclarativeparserstatus.cpp (renamed from src/declarative/qml/qmlparserstatus.cpp)14
-rw-r--r--src/declarative/qml/qdeclarativeparserstatus.h (renamed from src/declarative/qml/qmlparserstatus.h)24
-rw-r--r--src/declarative/qml/qdeclarativeprivate.h (renamed from src/declarative/qml/qmlprivate.h)87
-rw-r--r--src/declarative/qml/qdeclarativeproperty.cpp1306
-rw-r--r--src/declarative/qml/qdeclarativeproperty.h (renamed from src/declarative/qml/qmlmetaproperty.h)119
-rw-r--r--src/declarative/qml/qdeclarativeproperty_p.h142
-rw-r--r--src/declarative/qml/qdeclarativepropertycache.cpp (renamed from src/declarative/qml/qmlpropertycache.cpp)110
-rw-r--r--src/declarative/qml/qdeclarativepropertycache_p.h (renamed from src/declarative/qml/qmlpropertycache_p.h)63
-rw-r--r--src/declarative/qml/qdeclarativepropertyvalueinterceptor.cpp (renamed from src/declarative/qml/qmlpropertyvalueinterceptor.cpp)18
-rw-r--r--src/declarative/qml/qdeclarativepropertyvalueinterceptor.h (renamed from src/declarative/qml/qmlpropertyvalueinterceptor.h)18
-rw-r--r--src/declarative/qml/qdeclarativepropertyvaluesource.cpp (renamed from src/declarative/qml/qmlpropertyvaluesource.cpp)16
-rw-r--r--src/declarative/qml/qdeclarativepropertyvaluesource.h (renamed from src/declarative/qml/qmlpropertyvaluesource.h)18
-rw-r--r--src/declarative/qml/qdeclarativeproxymetaobject.cpp (renamed from src/declarative/qml/qmlproxymetaobject.cpp)14
-rw-r--r--src/declarative/qml/qdeclarativeproxymetaobject_p.h (renamed from src/declarative/qml/qmlproxymetaobject_p.h)14
-rw-r--r--src/declarative/qml/qdeclarativerefcount.cpp (renamed from src/declarative/qml/qmlrefcount.cpp)10
-rw-r--r--src/declarative/qml/qdeclarativerefcount_p.h (renamed from src/declarative/qml/qmlrefcount_p.h)12
-rw-r--r--src/declarative/qml/qdeclarativerewrite.cpp (renamed from src/declarative/qml/qmlrewrite.cpp)8
-rw-r--r--src/declarative/qml/qdeclarativerewrite_p.h (renamed from src/declarative/qml/qmlrewrite_p.h)18
-rw-r--r--src/declarative/qml/qdeclarativescript.cpp (renamed from src/declarative/qml/qmlscript.cpp)2
-rw-r--r--src/declarative/qml/qdeclarativescriptclass_p.h (renamed from src/declarative/qml/qmlscriptclass_p.h)14
-rw-r--r--src/declarative/qml/qdeclarativescriptparser.cpp (renamed from src/declarative/qml/qmlscriptparser.cpp)142
-rw-r--r--src/declarative/qml/qdeclarativescriptparser_p.h (renamed from src/declarative/qml/qmlscriptparser_p.h)34
-rw-r--r--src/declarative/qml/qdeclarativescriptstring.cpp (renamed from src/declarative/qml/qmlscriptstring.cpp)38
-rw-r--r--src/declarative/qml/qdeclarativescriptstring.h (renamed from src/declarative/qml/qmlscriptstring.h)28
-rw-r--r--src/declarative/qml/qdeclarativesqldatabase.cpp (renamed from src/declarative/qml/qmlsqldatabase.cpp)36
-rw-r--r--src/declarative/qml/qdeclarativesqldatabase_p.h (renamed from src/declarative/qml/qmlsqldatabase_p.h)6
-rw-r--r--src/declarative/qml/qdeclarativestringconverters.cpp (renamed from src/declarative/qml/qmlstringconverters.cpp)22
-rw-r--r--src/declarative/qml/qdeclarativestringconverters_p.h (renamed from src/declarative/qml/qmlstringconverters_p.h)8
-rw-r--r--src/declarative/qml/qdeclarativetypenamecache.cpp (renamed from src/declarative/qml/qmltypenamecache.cpp)22
-rw-r--r--src/declarative/qml/qdeclarativetypenamecache_p.h (renamed from src/declarative/qml/qmltypenamecache_p.h)36
-rw-r--r--src/declarative/qml/qdeclarativetypenamescriptclass.cpp (renamed from src/declarative/qml/qmltypenamescriptclass.cpp)48
-rw-r--r--src/declarative/qml/qdeclarativetypenamescriptclass_p.h (renamed from src/declarative/qml/qmltypenamescriptclass_p.h)30
-rw-r--r--src/declarative/qml/qdeclarativevaluetype.cpp706
-rw-r--r--src/declarative/qml/qdeclarativevaluetype_p.h (renamed from src/declarative/qml/qmlvaluetype_p.h)132
-rw-r--r--src/declarative/qml/qdeclarativevaluetypescriptclass.cpp (renamed from src/declarative/qml/qmlvaluetypescriptclass.cpp)48
-rw-r--r--src/declarative/qml/qdeclarativevaluetypescriptclass_p.h (renamed from src/declarative/qml/qmlvaluetypescriptclass_p.h)22
-rw-r--r--src/declarative/qml/qdeclarativevme.cpp (renamed from src/declarative/qml/qmlvme.cpp)305
-rw-r--r--src/declarative/qml/qdeclarativevme_p.h (renamed from src/declarative/qml/qmlvme_p.h)34
-rw-r--r--src/declarative/qml/qdeclarativevmemetaobject.cpp (renamed from src/declarative/qml/qmlvmemetaobject.cpp)76
-rw-r--r--src/declarative/qml/qdeclarativevmemetaobject_p.h (renamed from src/declarative/qml/qmlvmemetaobject_p.h)44
-rw-r--r--src/declarative/qml/qdeclarativewatcher.cpp (renamed from src/declarative/qml/qmlwatcher.cpp)73
-rw-r--r--src/declarative/qml/qdeclarativewatcher_p.h (renamed from src/declarative/qml/qmlwatcher_p.h)20
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript.cpp (renamed from src/declarative/qml/qmlworkerscript.cpp)200
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript_p.h (renamed from src/declarative/qml/qmlworkerscript_p.h)52
-rw-r--r--src/declarative/qml/qdeclarativexmlhttprequest.cpp (renamed from src/declarative/qml/qmlxmlhttprequest.cpp)146
-rw-r--r--src/declarative/qml/qdeclarativexmlhttprequest_p.h (renamed from src/declarative/qml/qmlxmlhttprequest_p.h)6
-rw-r--r--src/declarative/qml/qml.h155
-rw-r--r--src/declarative/qml/qml.pri237
-rw-r--r--src/declarative/qml/qmlbinding.h132
-rw-r--r--src/declarative/qml/qmlcompiler_p.h337
-rw-r--r--src/declarative/qml/qmldom_p.h360
-rw-r--r--src/declarative/qml/qmlinfo.h92
-rw-r--r--src/declarative/qml/qmllist.cpp312
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp1230
-rw-r--r--src/declarative/qml/qmlmetaproperty_p.h124
-rw-r--r--src/declarative/qml/qmlmetatype.h281
-rw-r--r--src/declarative/qml/qmlmoduleplugin.cpp112
-rw-r--r--src/declarative/qml/qmlmoduleplugin.h86
-rw-r--r--src/declarative/qml/qmlvaluetype.cpp636
-rw-r--r--src/declarative/qml/rewriter/rewriter.cpp8
-rw-r--r--src/declarative/qml/rewriter/rewriter_p.h6
-rw-r--r--src/declarative/qml/rewriter/textwriter.cpp2
-rw-r--r--src/declarative/qml/rewriter/textwriter_p.h6
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp (renamed from src/declarative/util/qmlanimation.cpp)1163
-rw-r--r--src/declarative/util/qdeclarativeanimation_p.h501
-rw-r--r--src/declarative/util/qdeclarativeanimation_p_p.h (renamed from src/declarative/util/qmlanimation_p_p.h)155
-rw-r--r--src/declarative/util/qdeclarativebehavior.cpp (renamed from src/declarative/util/qmlbehavior.cpp)69
-rw-r--r--src/declarative/util/qdeclarativebehavior_p.h (renamed from src/declarative/util/qmlbehavior_p.h)38
-rw-r--r--src/declarative/util/qdeclarativebind.cpp (renamed from src/declarative/util/qmlbind.cpp)73
-rw-r--r--src/declarative/util/qdeclarativebind_p.h (renamed from src/declarative/util/qmlbind_p.h)20
-rw-r--r--src/declarative/util/qdeclarativeconnections.cpp245
-rw-r--r--src/declarative/util/qdeclarativeconnections_p.h (renamed from src/declarative/util/qmlconnection_p.h)53
-rw-r--r--src/declarative/util/qdeclarativedatetimeformatter.cpp (renamed from src/declarative/util/qmldatetimeformatter.cpp)102
-rw-r--r--src/declarative/util/qdeclarativedatetimeformatter_p.h (renamed from src/declarative/util/qmldatetimeformatter_p.h)22
-rw-r--r--src/declarative/util/qdeclarativeeasefollow.cpp (renamed from src/declarative/util/qmleasefollow.cpp)98
-rw-r--r--src/declarative/util/qdeclarativeeasefollow_p.h (renamed from src/declarative/util/qmleasefollow_p.h)30
-rw-r--r--src/declarative/util/qdeclarativefontloader.cpp (renamed from src/declarative/util/qmlfontloader.cpp)61
-rw-r--r--src/declarative/util/qdeclarativefontloader_p.h (renamed from src/declarative/util/qmlfontloader_p.h)21
-rw-r--r--src/declarative/util/qdeclarativelistaccessor.cpp (renamed from src/declarative/util/qmllistaccessor.cpp)34
-rw-r--r--src/declarative/util/qdeclarativelistaccessor_p.h (renamed from src/declarative/util/qmllistaccessor_p.h)16
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp (renamed from src/declarative/util/qmllistmodel.cpp)155
-rw-r--r--src/declarative/util/qdeclarativelistmodel_p.h (renamed from src/declarative/util/qmllistmodel_p.h)50
-rw-r--r--src/declarative/util/qdeclarativenullablevalue_p_p.h (renamed from src/declarative/util/qmlnullablevalue_p_p.h)18
-rw-r--r--src/declarative/util/qdeclarativenumberformatter.cpp (renamed from src/declarative/util/qmlnumberformatter.cpp)52
-rw-r--r--src/declarative/util/qdeclarativenumberformatter_p.h (renamed from src/declarative/util/qmlnumberformatter_p.h)22
-rw-r--r--src/declarative/util/qdeclarativeopenmetaobject.cpp (renamed from src/declarative/util/qmlopenmetaobject.cpp)94
-rw-r--r--src/declarative/util/qdeclarativeopenmetaobject_p.h (renamed from src/declarative/util/qmlopenmetaobject_p.h)40
-rw-r--r--src/declarative/util/qdeclarativepackage.cpp (renamed from src/declarative/util/qmlpackage.cpp)113
-rw-r--r--src/declarative/util/qdeclarativepackage_p.h (renamed from src/declarative/util/qmlpackage_p.h)46
-rw-r--r--src/declarative/util/qdeclarativepixmapcache.cpp (renamed from src/declarative/util/qmlpixmapcache.cpp)311
-rw-r--r--src/declarative/util/qdeclarativepixmapcache_p.h (renamed from src/declarative/util/qmlpixmapcache_p.h)34
-rw-r--r--src/declarative/util/qdeclarativepropertychanges.cpp (renamed from src/declarative/util/qmlpropertychanges.cpp)221
-rw-r--r--src/declarative/util/qdeclarativepropertychanges_p.h (renamed from src/declarative/util/qmlpropertychanges_p.h)31
-rw-r--r--src/declarative/util/qdeclarativepropertymap.cpp (renamed from src/declarative/util/qmlpropertymap.cpp)88
-rw-r--r--src/declarative/util/qdeclarativepropertymap.h (renamed from src/declarative/util/qmlpropertymap.h)16
-rw-r--r--src/declarative/util/qdeclarativespringfollow.cpp (renamed from src/declarative/util/qmlspringfollow.cpp)114
-rw-r--r--src/declarative/util/qdeclarativespringfollow_p.h (renamed from src/declarative/util/qmlspringfollow_p.h)28
-rw-r--r--src/declarative/util/qdeclarativestate.cpp (renamed from src/declarative/util/qmlstate.cpp)198
-rw-r--r--src/declarative/util/qdeclarativestate_p.h (renamed from src/declarative/util/qmlstate_p.h)92
-rw-r--r--src/declarative/util/qdeclarativestate_p_p.h (renamed from src/declarative/util/qmlstate_p_p.h)59
-rw-r--r--src/declarative/util/qdeclarativestategroup.cpp (renamed from src/declarative/util/qmlstategroup.cpp)130
-rw-r--r--src/declarative/util/qdeclarativestategroup_p.h (renamed from src/declarative/util/qmlstategroup_p.h)38
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp989
-rw-r--r--src/declarative/util/qdeclarativestateoperations_p.h216
-rw-r--r--src/declarative/util/qdeclarativestyledtext.cpp (renamed from src/declarative/util/qmlstyledtext.cpp)70
-rw-r--r--src/declarative/util/qdeclarativestyledtext_p.h (renamed from src/declarative/util/qmlstyledtext_p.h)15
-rw-r--r--src/declarative/util/qdeclarativesystempalette.cpp (renamed from src/declarative/util/qmlsystempalette.cpp)90
-rw-r--r--src/declarative/util/qdeclarativesystempalette_p.h (renamed from src/declarative/util/qmlsystempalette_p.h)26
-rw-r--r--src/declarative/util/qdeclarativetimeline.cpp (renamed from src/declarative/util/qmltimeline.cpp)230
-rw-r--r--src/declarative/util/qdeclarativetimeline_p_p.h (renamed from src/declarative/util/qmltimeline_p_p.h)104
-rw-r--r--src/declarative/util/qdeclarativetimer.cpp (renamed from src/declarative/util/qmltimer.cpp)80
-rw-r--r--src/declarative/util/qdeclarativetimer_p.h (renamed from src/declarative/util/qmltimer_p.h)18
-rw-r--r--src/declarative/util/qdeclarativetransition.cpp (renamed from src/declarative/util/qmltransition.cpp)98
-rw-r--r--src/declarative/util/qdeclarativetransition_p.h (renamed from src/declarative/util/qmltransition_p.h)36
-rw-r--r--src/declarative/util/qdeclarativetransitionmanager.cpp (renamed from src/declarative/util/qmltransitionmanager.cpp)83
-rw-r--r--src/declarative/util/qdeclarativetransitionmanager_p_p.h (renamed from src/declarative/util/qmltransitionmanager_p_p.h)30
-rw-r--r--src/declarative/util/qdeclarativeutilmodule.cpp122
-rw-r--r--src/declarative/util/qdeclarativeutilmodule_p.h63
-rw-r--r--src/declarative/util/qdeclarativeview.cpp (renamed from src/declarative/util/qmlview.cpp)310
-rw-r--r--src/declarative/util/qdeclarativeview.h (renamed from src/declarative/util/qmlview.h)36
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp (renamed from src/declarative/util/qmlxmllistmodel.cpp)376
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel_p.h (renamed from src/declarative/util/qmlxmllistmodel_p.h)74
-rw-r--r--src/declarative/util/qfxperf.cpp22
-rw-r--r--src/declarative/util/qfxperf_p_p.h8
-rw-r--r--src/declarative/util/qmlanimation_p.h466
-rw-r--r--src/declarative/util/qmlconnection.cpp288
-rw-r--r--src/declarative/util/qmlstateoperations.cpp834
-rw-r--r--src/declarative/util/qmlstateoperations_p.h184
-rw-r--r--src/declarative/util/qnumberformat.cpp3
-rw-r--r--src/declarative/util/qnumberformat_p.h2
-rw-r--r--src/declarative/util/util.pri116
-rw-r--r--src/declarative/widgets/graphicslayouts.cpp319
-rw-r--r--src/declarative/widgets/widgets.pri9
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h13
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp452
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h15
-rw-r--r--src/gui/image/qpaintengine_pic.cpp5
-rw-r--r--src/gui/itemviews/qheaderview.cpp9
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp8
-rw-r--r--src/gui/itemviews/qtreeview.cpp13
-rw-r--r--src/gui/kernel/qapplication_x11.cpp76
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm57
-rw-r--r--src/gui/kernel/qcocoaview_mac_p.h1
-rw-r--r--src/gui/kernel/qgesture_p.h2
-rw-r--r--src/gui/kernel/qgesturerecognizer.cpp1
-rw-r--r--src/gui/kernel/qkeymapper_win.cpp2
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm10
-rw-r--r--src/gui/kernel/qwidget.cpp9
-rw-r--r--src/gui/painting/qdrawhelper.cpp233
-rw-r--r--src/gui/painting/qdrawhelper_p.h11
-rw-r--r--src/gui/painting/qdrawutil.cpp210
-rw-r--r--src/gui/painting/qdrawutil.h25
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp3
-rw-r--r--src/gui/painting/qpaintengineex.cpp21
-rw-r--r--src/gui/painting/qpaintengineex_p.h2
-rw-r--r--src/gui/painting/qpainter.cpp209
-rw-r--r--src/gui/painting/qpainter.h26
-rw-r--r--src/gui/painting/qpainter_p.h8
-rw-r--r--src/gui/painting/qprintengine_win.cpp3
-rw-r--r--src/gui/styles/qmacstyle_mac.mm2
-rw-r--r--src/gui/text/qfont.h1
-rw-r--r--src/gui/text/qfontengine.cpp10
-rw-r--r--src/gui/text/qfontengine_win.cpp6
-rw-r--r--src/gui/text/qstatictext.cpp4
-rw-r--r--src/multimedia/base/qgraphicsvideoitem.cpp3
-rw-r--r--src/multimedia/base/qmediacontent.cpp1
-rw-r--r--src/multimedia/base/qmediacontrol.cpp1
-rw-r--r--src/multimedia/base/qmediaobject.cpp1
-rw-r--r--src/multimedia/base/qmediaplaylist.cpp1
-rw-r--r--src/multimedia/base/qmediaplaylistcontrol.cpp1
-rw-r--r--src/multimedia/base/qmediaplaylistioplugin.cpp3
-rw-r--r--src/multimedia/base/qmediaplaylistnavigator.cpp1
-rw-r--r--src/multimedia/base/qmediaplaylistprovider.cpp1
-rw-r--r--src/multimedia/base/qmediaresource.cpp1
-rw-r--r--src/multimedia/base/qmediaservice.cpp1
-rw-r--r--src/multimedia/base/qmediaserviceprovider.cpp6
-rw-r--r--src/multimedia/base/qmediatimerange.cpp2
-rw-r--r--src/multimedia/base/qmetadatacontrol.cpp2
-rw-r--r--src/multimedia/base/qvideodevicecontrol.cpp1
-rw-r--r--src/multimedia/base/qvideooutputcontrol.cpp2
-rw-r--r--src/multimedia/base/qvideorenderercontrol.cpp2
-rw-r--r--src/multimedia/base/qvideowidget.cpp2
-rw-r--r--src/multimedia/base/qvideowidgetcontrol.cpp2
-rw-r--r--src/multimedia/base/qvideowindowcontrol.cpp1
-rw-r--r--src/multimedia/playback/qmediaplayer.cpp2
-rw-r--r--src/multimedia/playback/qmediaplayercontrol.cpp2
-rw-r--r--src/multimedia/qml/multimediadeclarative.cpp (renamed from src/multimedia/qml/multimediaqml.cpp)16
-rw-r--r--src/multimedia/qml/multimediadeclarative.h (renamed from src/multimedia/qml/multimediaqml.h)2
-rw-r--r--src/multimedia/qml/qdeclarativeaudio.cpp (renamed from src/multimedia/qml/qmlaudio.cpp)26
-rw-r--r--src/multimedia/qml/qdeclarativeaudio_p.h (renamed from src/multimedia/qml/qmlaudio_p.h)24
-rw-r--r--src/multimedia/qml/qdeclarativemediabase.cpp (renamed from src/multimedia/qml/qmlmediabase.cpp)72
-rw-r--r--src/multimedia/qml/qdeclarativemediabase_p.h (renamed from src/multimedia/qml/qmlmediabase_p.h)16
-rw-r--r--src/multimedia/qml/qdeclarativevideo.cpp (renamed from src/multimedia/qml/qmlgraphicsvideo.cpp)44
-rw-r--r--src/multimedia/qml/qdeclarativevideo_p.h (renamed from src/multimedia/qml/qmlgraphicsvideo_p.h)22
-rw-r--r--src/multimedia/qml/qml.pri16
-rw-r--r--src/multimedia/qml/qsoundeffect_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp51
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h4
-rw-r--r--src/openvg/qpaintengine_vg.cpp26
-rw-r--r--src/openvg/qpaintengine_vg_p.h2
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp12
-rw-r--r--src/plugins/bearer/symbian/symbian.pro1
-rw-r--r--src/plugins/mediaservices/gstreamer/gstreamer.pro12
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp2
-rw-r--r--src/plugins/mediaservices/mediaservices.pro13
-rw-r--r--src/plugins/plugins.pro2
-rw-r--r--src/plugins/qdeclarativemodules/multimedia/multimedia.cpp (renamed from src/plugins/qmlmodules/multimedia/multimedia.cpp)20
-rw-r--r--src/plugins/qdeclarativemodules/multimedia/multimedia.pro15
-rw-r--r--src/plugins/qdeclarativemodules/qdeclarativemodules.pro (renamed from src/plugins/qmlmodules/qmlmodules.pro)2
-rw-r--r--src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp260
-rw-r--r--src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h (renamed from src/declarative/widgets/graphicslayouts_p.h)82
-rw-r--r--src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp (renamed from src/declarative/qml/qmlprivate.cpp)8
-rw-r--r--src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h (renamed from src/declarative/widgets/graphicswidgets_p.h)2
-rw-r--r--src/plugins/qdeclarativemodules/widgets/widgets.cpp (renamed from src/declarative/widgets/graphicswidgets.cpp)49
-rw-r--r--src/plugins/qdeclarativemodules/widgets/widgets.pro20
-rw-r--r--src/plugins/qmlmodules/multimedia/multimedia.pro11
-rw-r--r--src/qbase.pri1
-rw-r--r--src/qt3support/text/q3richtext.cpp2
-rw-r--r--src/qt3support/text/q3textedit.cpp2
-rw-r--r--src/qt3support/text/q3textstream.cpp2
-rw-r--r--src/qt3support/tools/q3gcache.cpp10
-rw-r--r--src/qt3support/tools/q3gdict.cpp4
-rw-r--r--src/script/api/qscriptengine_p.h2
-rw-r--r--src/sql/drivers/oci/qsql_oci.cpp6
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp2
449 files changed, 25381 insertions, 22277 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
index 1e717cb..abe15c8 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
@@ -241,7 +241,7 @@ NEVER_INLINE CollectorBlock* Heap::allocateBlock()
#elif PLATFORM(WINCE)
void* address = VirtualAlloc(NULL, BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
#elif PLATFORM(WIN_OS)
-#if COMPILER(MINGW)
+#if COMPILER(MINGW) && !PLATFORM(X86_64)
void* address = __mingw_aligned_malloc(BLOCK_SIZE, BLOCK_SIZE);
#else
void* address = _aligned_malloc(BLOCK_SIZE, BLOCK_SIZE);
@@ -327,7 +327,7 @@ NEVER_INLINE void Heap::freeBlock(CollectorBlock* block)
#elif PLATFORM(WINCE)
VirtualFree(block, 0, MEM_RELEASE);
#elif PLATFORM(WIN_OS)
-#if COMPILER(MINGW)
+#if COMPILER(MINGW) && !PLATFORM(X86_64)
__mingw_aligned_free(block);
#else
_aligned_free(block);
@@ -617,7 +617,7 @@ static inline void* currentThreadStackBase()
MOV pTib, EAX
}
return static_cast<void*>(pTib->StackBase);
-#elif PLATFORM(WIN_OS) && PLATFORM(X86_64) && COMPILER(MSVC)
+#elif PLATFORM(WIN_OS) && PLATFORM(X86_64) && (COMPILER(MSVC) ||COMPILER(GCC))
PNT_TIB64 pTib = reinterpret_cast<PNT_TIB64>(NtCurrentTeb());
return reinterpret_cast<void*>(pTib->StackBase);
#elif PLATFORM(WIN_OS) && PLATFORM(X86) && COMPILER(GCC)
diff --git a/src/3rdparty/libpng/png.h b/src/3rdparty/libpng/png.h
index 14e3416..5ea2b0d 100644
--- a/src/3rdparty/libpng/png.h
+++ b/src/3rdparty/libpng/png.h
@@ -386,7 +386,7 @@
#include "zlib.h"
#endif
-#ifdef AIX
+#ifdef _AIX
#define jmpbuf __jmpbuf
#endif
diff --git a/src/3rdparty/libpng/pngconf.h b/src/3rdparty/libpng/pngconf.h
index 5d202db..1f8bef8 100644
--- a/src/3rdparty/libpng/pngconf.h
+++ b/src/3rdparty/libpng/pngconf.h
@@ -1379,7 +1379,7 @@ typedef char FAR * FAR * FAR * png_charppp;
/* memory model/platform independent fns */
#ifndef PNG_ABORT
-# ifdef _WINDOWS_
+# if defined(_WINDOWS_) || defined(_WIN32_WCE)
# define PNG_ABORT() ExitProcess(0)
# else
# define PNG_ABORT() abort()
diff --git a/src/3rdparty/libpng/pngpriv.h b/src/3rdparty/libpng/pngpriv.h
index 13c2b3f..87a4ba6 100644
--- a/src/3rdparty/libpng/pngpriv.h
+++ b/src/3rdparty/libpng/pngpriv.h
@@ -74,7 +74,9 @@
#if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \
defined(_WIN32) || defined(__WIN32__)
-# include <windows.h> /* defines _WINDOWS_ macro */
+# if !defined(__SYMBIAN32__)
+# include <windows.h> /* defines _WINDOWS_ macro */
+# endif
/* I have no idea why is this necessary... */
# ifdef _MSC_VER
# include <malloc.h>
diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp
index 79fc51e..5c87fe6 100644
--- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp
@@ -368,7 +368,7 @@ static inline void handleElementNamespaces(Element* newElement, const QXmlStream
for (int i = 0; i < ns.count(); ++i) {
const QXmlStreamNamespaceDeclaration &decl = ns[i];
String namespaceURI = decl.namespaceUri();
- String namespaceQName = decl.prefix().isEmpty() ? String("xmlns") : String("xmlns:") + decl.prefix();
+ String namespaceQName = decl.prefix().isEmpty() ? String("xmlns") : String("xmlns:") + String(decl.prefix());
newElement->setAttributeNS("http://www.w3.org/2000/xmlns/", namespaceQName, namespaceURI, ec);
if (ec) // exception setting attributes
return;
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
index 7a1bfd5..5fbc876 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
@@ -179,7 +179,7 @@ void InspectorClientQt::populateSetting(const String& key, InspectorController::
return;
}
- QString settingKey(settingStoragePrefix + key);
+ QString settingKey(settingStoragePrefix + QString(key));
QString storedValueType = qsettings.value(settingKey + settingStorageTypeSuffix).toString();
QVariant storedValue = qsettings.value(settingKey);
storedValue.convert(QVariant::nameToType(storedValueType.toAscii().data()));
@@ -196,7 +196,7 @@ void InspectorClientQt::storeSetting(const String& key, const InspectorControlle
}
QVariant valueToStore = settingToVariant(setting);
- QString settingKey(settingStoragePrefix + key);
+ QString settingKey(settingStoragePrefix + QString(key));
qsettings.setValue(settingKey, valueToStore);
qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type()));
}
diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp
index 02a29d9..7692749 100644
--- a/src/activeqt/container/qaxbase.cpp
+++ b/src/activeqt/container/qaxbase.cpp
@@ -1353,11 +1353,9 @@ bool QAxBase::initializeFromFile(IUnknown** ptr)
// There seams to be a naming problem in mingw headers
-#ifdef Q_CC_GNU
-#ifndef COAUTHIDENTITY
+#if defined(Q_CC_GNU) && !defined(COAUTHIDENTITY) && !defined(__MINGW64_VERSION_MAJOR)
#define COAUTHIDENTITY AUTH_IDENTITY
#endif
-#endif
/*!
diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp
index 9149320..7d2dde7 100644
--- a/src/activeqt/container/qaxwidget.cpp
+++ b/src/activeqt/container/qaxwidget.cpp
@@ -77,25 +77,21 @@
// #define QAX_SUPPORT_BORDERSPACE
// missing interface from win32api
-#if defined(Q_CC_GNU)
-# if !defined(IOleInPlaceObjectWindowless)
-# undef INTERFACE
-# define INTERFACE IOleInPlaceObjectWindowless
- DECLARE_INTERFACE_(IOleInPlaceObjectWindowless,IOleInPlaceObject)
- {
- STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
- STDMETHOD_(ULONG,AddRef)(THIS) PURE;
- STDMETHOD_(ULONG,Release)(THIS) PURE;
- STDMETHOD(GetWindow)(THIS_ HWND*) PURE;
- STDMETHOD(ContextSensitiveHelp)(THIS_ BOOL) PURE;
- STDMETHOD(InPlaceDeactivate)(THIS) PURE;
- STDMETHOD(UIDeactivate)(THIS) PURE;
- STDMETHOD(SetObjectRects)(THIS_ LPCRECT,LPCRECT) PURE;
- STDMETHOD(ReactivateAndUndo)(THIS) PURE;
- STDMETHOD(OnWindowMessage)(THIS_ UINT, WPARAM, LPARAM, LRESULT*) PURE;
- STDMETHOD(GetDropTarget)(THIS_ IDropTarget**) PURE;
- };
-# endif
+#if defined(Q_CC_GNU) && !defined(__MINGW64_VERSION_MAJOR)
+ DECLARE_INTERFACE_(IOleInPlaceObjectWindowless,IOleInPlaceObject)
+ {
+ STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(GetWindow)(THIS_ HWND*) PURE;
+ STDMETHOD(ContextSensitiveHelp)(THIS_ BOOL) PURE;
+ STDMETHOD(InPlaceDeactivate)(THIS) PURE;
+ STDMETHOD(UIDeactivate)(THIS) PURE;
+ STDMETHOD(SetObjectRects)(THIS_ LPCRECT,LPCRECT) PURE;
+ STDMETHOD(ReactivateAndUndo)(THIS) PURE;
+ STDMETHOD(OnWindowMessage)(THIS_ UINT, WPARAM, LPARAM, LRESULT*) PURE;
+ STDMETHOD(GetDropTarget)(THIS_ IDropTarget**) PURE;
+ };
#endif
#include "../shared/qaxtypes.h"
diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp
index 5fa0aad..ce71490 100644
--- a/src/activeqt/control/qaxserverbase.cpp
+++ b/src/activeqt/control/qaxserverbase.cpp
@@ -1536,7 +1536,7 @@ HWND QAxServerBase::create(HWND hWndParent, RECT& rcPos)
HINSTANCE hInst = (HINSTANCE)qAxInstance;
EnterCriticalSection(&createWindowSection);
QString cn(QLatin1String("QAxControl"));
- cn += QString::number((int)ActiveXProc);
+ cn += QString::number((quintptr)ActiveXProc);
if (!atom) {
WNDCLASS wcTemp;
wcTemp.style = CS_DBLCLKS;
@@ -1599,10 +1599,10 @@ HMENU QAxServerBase::createPopup(QMenu *popup, HMENU oldMenu)
ushort itemId;
if (flags & MF_POPUP) {
itemId = static_cast<ushort>(
- reinterpret_cast<ulong>(createPopup(action->menu()))
+ reinterpret_cast<quintptr>(createPopup(action->menu()))
);
} else {
- itemId = static_cast<ushort>(reinterpret_cast<ulong>(action));
+ itemId = static_cast<ushort>(reinterpret_cast<quintptr>(action));
actionMap.remove(itemId);
actionMap.insert(itemId, action);
}
@@ -1646,10 +1646,10 @@ void QAxServerBase::createMenu(QMenuBar *menuBar)
ushort itemId;
if (flags & MF_POPUP) {
itemId = static_cast<ushort>(
- reinterpret_cast<ulong>(createPopup(action->menu()))
+ reinterpret_cast<quintptr>(createPopup(action->menu()))
);
} else {
- itemId = static_cast<ushort>(reinterpret_cast<ulong>(action));
+ itemId = static_cast<ushort>(reinterpret_cast<quintptr>(action));
actionMap.insert(itemId, action);
}
AppendMenu(hmenuShared, flags, itemId, (const wchar_t *)action->text().utf16());
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index efee610..df9a463 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -52,3 +52,25 @@ symbian: {
partial_upgrade.path = c:/sys/bin
DEPLOYMENT = partial_upgrade $$DEPLOYMENT
}
+
+mmx {
+ DEFINES += QT_HAVE_MMX
+}
+3dnow {
+ DEFINES += QT_HAVE_3DNOW
+}
+sse {
+ DEFINES += QT_HAVE_SSE
+ DEFINES += QT_HAVE_MMXEXT
+}
+sse2 {
+ DEFINES += QT_HAVE_SSE2
+}
+iwmmxt {
+ DEFINES += QT_HAVE_IWMMXT
+}
+neon {
+ DEFINES += QT_HAVE_NEON
+ QMAKE_CXXFLAGS *= -mfpu=neon
+}
+
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index a9ea44a..9490225 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -266,6 +266,11 @@ QLibraryInfo::location(LibraryLocation loc)
path = QT_CONFIGURE_PLUGINS_PATH;
break;
#endif
+#ifdef QT_CONFIGURE_IMPORTS_PATH
+ case ImportsPath:
+ path = QT_CONFIGURE_IMPORTS_PATH;
+ break;
+#endif
#ifdef QT_CONFIGURE_DATA_PATH
case DataPath:
path = QT_CONFIGURE_DATA_PATH;
@@ -439,7 +444,7 @@ QLibraryInfo::location(LibraryLocation loc)
QCFType<CFURLRef> urlRef = CFBundleCopyBundleURL(bundleRef);
if (urlRef) {
QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle);
- return QDir::cleanPath(path + QLatin1String("/Contents/") + ret);
+ return QDir::cleanPath(QString(path) + QLatin1String("/Contents/") + ret);
}
}
#endif
@@ -470,6 +475,7 @@ QLibraryInfo::location(LibraryLocation loc)
\value LibrariesPath The location of installed librarires.
\value BinariesPath The location of installed Qt binaries (tools and applications).
\value PluginsPath The location of installed Qt plugins.
+ \value ImportsPath The location of installed QML extensions to import.
\value DataPath The location of general Qt data.
\value TranslationsPath The location of translation information for Qt strings.
\value SettingsPath The location for Qt settings.
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index e64b760..4a7ba06 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -76,7 +76,8 @@ public:
TranslationsPath,
SettingsPath,
DemosPath,
- ExamplesPath
+ ExamplesPath,
+ ImportsPath
};
static QString location(LibraryLocation); // ### Qt 5: consider renaming it to path()
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 076cc33..0290fb8 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -6348,7 +6348,7 @@ QUrl QUrl::fromUserInput(const QString &userInput)
return QUrl::fromLocalFile(trimmedString);
QUrl url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode);
- QUrl urlPrepended = QUrl::fromEncoded((QLatin1String("http://") + trimmedString).toUtf8(), QUrl::TolerantMode);
+ QUrl urlPrepended = QUrl::fromEncoded("http://" + trimmedString.toUtf8(), QUrl::TolerantMode);
// Check the most common case of a valid url with scheme and host
// We check if the port would be valid by adding the scheme to handle the case host:port
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index 5990f86..566626d 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -1021,14 +1021,14 @@ QString decodeMSG(const MSG& msg)
LPWINDOWPOS winPos = (LPWINDOWPOS)lParam;
if (!winPos)
break;
- QString hwndAfter = valueCheck((uint)winPos->hwndInsertAfter,
- FLAG_STRING((uint)HWND_BOTTOM, "HWND_BOTTOM"),
- FLAG_STRING((int)HWND_NOTOPMOST, "HWND_NOTOPMOST"),
- FLAG_STRING((uint)HWND_TOP, "HWND_TOP"),
- FLAG_STRING((int)HWND_TOPMOST, "HWND_TOPMOST"),
+ QString hwndAfter = valueCheck(quint64(winPos->hwndInsertAfter),
+ FLAG_STRING((quintptr)HWND_BOTTOM, "HWND_BOTTOM"),
+ FLAG_STRING((quintptr)HWND_NOTOPMOST, "HWND_NOTOPMOST"),
+ FLAG_STRING((quintptr)HWND_TOP, "HWND_TOP"),
+ FLAG_STRING((quintptr)HWND_TOPMOST, "HWND_TOPMOST"),
FLAG_STRING());
if (hwndAfter.size() == 0)
- hwndAfter = QString::number((uint)winPos->hwndInsertAfter, 16);
+ hwndAfter = QString::number((quintptr)winPos->hwndInsertAfter, 16);
QString flags = flagCheck(winPos->flags,
FLGSTR(SWP_DRAWFRAME),
FLGSTR(SWP_FRAMECHANGED),
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 870baab..9e187d4 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -48,6 +48,7 @@
#include "qstringlist.h"
#include "qvector.h"
#include "qlocale.h"
+#include "qeasingcurve.h"
#ifdef QT_BOOTSTRAPPED
# ifndef QT_NO_GEOM_VARIANT
@@ -176,6 +177,7 @@ QT_BEGIN_NAMESPACE
\value QVector3D QVector3D
\value QVector4D QVector4D
\value QQuaternion QQuaternion
+ \value QEasingCurve QEasingCurve
\value User Base value for user types
@@ -256,6 +258,7 @@ static const struct { const char * typeName; int type; } types[] = {
{"QPointF", QMetaType::QPointF},
{"QRegExp", QMetaType::QRegExp},
{"QVariantHash", QMetaType::QVariantHash},
+ {"QEasingCurve", QMetaType::QEasingCurve},
/* All GUI types */
{"QColorGroup", 63},
@@ -666,6 +669,11 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data)
stream << *static_cast<const NS(QRegExp)*>(data);
break;
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QEasingCurve:
+ stream << *static_cast<const NS(QEasingCurve)*>(data);
+ break;
+#endif
#ifdef QT3_SUPPORT
case QMetaType::QColorGroup:
#endif
@@ -863,6 +871,11 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
stream >> *static_cast< NS(QRegExp)*>(data);
break;
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QEasingCurve:
+ stream >> *static_cast< NS(QEasingCurve)*>(data);
+ break;
+#endif
#ifdef QT3_SUPPORT
case QMetaType::QColorGroup:
#endif
@@ -1007,6 +1020,10 @@ void *QMetaType::construct(int type, const void *copy)
case QMetaType::QRegExp:
return new NS(QRegExp)(*static_cast<const NS(QRegExp)*>(copy));
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QEasingCurve:
+ return new NS(QEasingCurve)(*static_cast<const NS(QEasingCurve)*>(copy));
+#endif
case QMetaType::Void:
return 0;
default:
@@ -1098,6 +1115,10 @@ void *QMetaType::construct(int type, const void *copy)
case QMetaType::QRegExp:
return new NS(QRegExp);
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QEasingCurve:
+ return new NS(QEasingCurve);
+#endif
case QMetaType::Void:
return 0;
default:
@@ -1253,6 +1274,11 @@ void QMetaType::destroy(int type, void *data)
delete static_cast< NS(QRegExp)* >(data);
break;
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QEasingCurve:
+ delete static_cast< NS(QEasingCurve)* >(data);
+ break;
+#endif
case QMetaType::Void:
break;
default: {
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index c23caed..33126e8 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -69,7 +69,7 @@ public:
QBitArray = 13, QDate = 14, QTime = 15, QDateTime = 16, QUrl = 17,
QLocale = 18, QRect = 19, QRectF = 20, QSize = 21, QSizeF = 22,
QLine = 23, QLineF = 24, QPoint = 25, QPointF = 26, QRegExp = 27,
- QVariantHash = 28, LastCoreType = 28 /* QVariantHash */,
+ QVariantHash = 28, QEasingCurve = 29, LastCoreType = QEasingCurve,
FirstGuiType = 63 /* QColorGroup */,
#ifdef QT3_SUPPORT
@@ -81,12 +81,12 @@ public:
QTextLength = 78, QTextFormat = 79, QMatrix = 80, QTransform = 81,
QMatrix4x4 = 82, QVector2D = 83, QVector3D = 84, QVector4D = 85,
QQuaternion = 86,
- LastGuiType = 86 /* QQuaternion */,
+ LastGuiType = QQuaternion,
FirstCoreExtType = 128 /* VoidStar */,
VoidStar = 128, Long = 129, Short = 130, Char = 131, ULong = 132,
UShort = 133, UChar = 134, Float = 135, QObjectStar = 136, QWidgetStar = 137,
- LastCoreExtType = 137 /* QWidgetStar */,
+ LastCoreExtType = QWidgetStar,
// This logic must match the one in qglobal.h
#if defined(QT_COORD_TYPE)
@@ -290,6 +290,7 @@ class QPointF;
#ifndef QT_NO_REGEXP
class QRegExp;
#endif
+class QEasingCurve;
class QWidget;
class QObject;
@@ -359,6 +360,7 @@ Q_DECLARE_BUILTIN_METATYPE(QPointF, QPointF)
#ifndef QT_NO_REGEXP
Q_DECLARE_BUILTIN_METATYPE(QRegExp, QRegExp)
#endif
+Q_DECLARE_BUILTIN_METATYPE(QEasingCurve, QEasingCurve)
#ifdef QT3_SUPPORT
Q_DECLARE_BUILTIN_METATYPE(QColorGroup, QColorGroup)
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index e1b5825..227a60d 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -46,6 +46,7 @@
#include "qdebug.h"
#include "qmap.h"
#include "qdatetime.h"
+#include "qeasingcurve.h"
#include "qlist.h"
#include "qstring.h"
#include "qstringlist.h"
@@ -146,6 +147,11 @@ static void construct(QVariant::Private *x, const void *copy)
v_construct<QRegExp>(x, copy);
break;
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QVariant::EasingCurve:
+ v_construct<QEasingCurve>(x, copy);
+ break;
+#endif
case QVariant::Int:
x->data.i = copy ? *static_cast<const int *>(copy) : 0;
break;
@@ -259,6 +265,11 @@ static void clear(QVariant::Private *d)
v_clear<QRegExp>(d);
break;
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QVariant::EasingCurve:
+ v_clear<QEasingCurve>(d);
+ break;
+#endif
case QVariant::LongLong:
case QVariant::ULongLong:
case QVariant::Double:
@@ -317,6 +328,9 @@ static bool isNull(const QVariant::Private *d)
case QVariant::PointF:
return v_cast<QPointF>(d)->isNull();
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QVariant::EasingCurve:
+#endif
case QVariant::Url:
case QVariant::Locale:
case QVariant::RegExp:
@@ -435,6 +449,10 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
return *v_cast<QTime>(a) == *v_cast<QTime>(b);
case QVariant::DateTime:
return *v_cast<QDateTime>(a) == *v_cast<QDateTime>(b);
+#ifndef QT_BOOTSTRAPPED
+ case QVariant::EasingCurve:
+ return *v_cast<QEasingCurve>(a) == *v_cast<QEasingCurve>(b);
+#endif
case QVariant::ByteArray:
return *v_cast<QByteArray>(a) == *v_cast<QByteArray>(b);
case QVariant::BitArray:
@@ -1097,6 +1115,11 @@ static void streamDebug(QDebug dbg, const QVariant &v)
case QVariant::DateTime:
dbg.nospace() << v.toDateTime();
break;
+#ifndef QT_BOOTSTRAPPED
+ case QVariant::EasingCurve:
+ dbg.nospace() << v.toEasingCurve();
+ break;
+#endif
case QVariant::ByteArray:
dbg.nospace() << v.toByteArray();
break;
@@ -1265,6 +1288,7 @@ const QVariant::Handler *QVariant::handler = &qt_kernel_variant_handler;
\value Date a QDate
\value DateTime a QDateTime
\value Double a double
+ \value EasingCurve a QEasingCurve
\value Font a QFont
\value Hash a QVariantHash
\value Icon a QIcon
@@ -1483,6 +1507,12 @@ QVariant::QVariant(const char *val)
*/
/*!
+ \fn QVariant::QVariant(const QEasingCurve &val)
+
+ Constructs a new variant with an easing curve value, \a val.
+*/
+
+/*!
\fn QVariant::QVariant(const QByteArray &val)
Constructs a new variant with a bytearray value, \a val.
@@ -1681,6 +1711,10 @@ QVariant::QVariant(const QTime &val)
{ d.is_null = false; d.type = Time; v_construct<QTime>(&d, val); }
QVariant::QVariant(const QDateTime &val)
{ d.is_null = false; d.type = DateTime; v_construct<QDateTime>(&d, val); }
+#ifndef QT_BOOTSTRAPPED
+QVariant::QVariant(const QEasingCurve &val)
+{ d.is_null = false; d.type = EasingCurve; v_construct<QEasingCurve>(&d, val); }
+#endif
QVariant::QVariant(const QList<QVariant> &list)
{ d.is_null = false; d.type = List; v_construct<QVariantList>(&d, list); }
QVariant::QVariant(const QMap<QString, QVariant> &map)
@@ -1870,7 +1904,7 @@ QVariant::Type QVariant::nameToType(const char *name)
}
#ifndef QT_NO_DATASTREAM
-enum { MapFromThreeCount = 35 };
+enum { MapFromThreeCount = 36 };
static const ushort map_from_three[MapFromThreeCount] =
{
QVariant::Invalid,
@@ -1907,7 +1941,8 @@ static const ushort map_from_three[MapFromThreeCount] =
QVariant::KeySequence,
QVariant::Pen,
QVariant::LongLong,
- QVariant::ULongLong
+ QVariant::ULongLong,
+ QVariant::EasingCurve
};
/*!
@@ -2165,6 +2200,21 @@ QDateTime QVariant::toDateTime() const
}
/*!
+ \fn QEasingCurve QVariant::toEasingCurve() const
+
+ Returns the variant as a QEasingCurve if the variant has type() \l
+ EasingCurve; otherwise returns a default easing curve.
+
+ \sa canConvert(), convert()
+*/
+#ifndef QT_BOOTSTRAPPED
+QEasingCurve QVariant::toEasingCurve() const
+{
+ return qVariantToHelper<QEasingCurve>(d, EasingCurve, handler);
+}
+#endif
+
+/*!
\fn QByteArray QVariant::toByteArray() const
Returns the variant as a QByteArray if the variant has type() \l
@@ -2605,8 +2655,9 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
/*QRegExp*/ 0,
-/*QHash*/ 0
+/*QHash*/ 0,
+/*QEasingCurve*/ 0
};
/*!
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 1a9e43a..9628dbf 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -60,6 +60,7 @@ class QBitArray;
class QDataStream;
class QDate;
class QDateTime;
+class QEasingCurve;
class QLine;
class QLineF;
class QLocale;
@@ -128,9 +129,10 @@ class Q_CORE_EXPORT QVariant
LineF = 24,
Point = 25,
PointF = 26,
- RegExp = 27,
+ RegExp = 27,
Hash = 28,
- LastCoreType = Hash,
+ EasingCurve = 29,
+ LastCoreType = EasingCurve,
// value 62 is internally reserved
#ifdef QT3_SUPPORT
@@ -219,6 +221,9 @@ class Q_CORE_EXPORT QVariant
#ifndef QT_NO_REGEXP
QVariant(const QRegExp &regExp);
#endif
+#ifndef QT_BOOTSTRAPPED
+ QVariant(const QEasingCurve &easing);
+#endif
QVariant(Qt::GlobalColor color);
QVariant& operator=(const QVariant &other);
@@ -280,6 +285,9 @@ class Q_CORE_EXPORT QVariant
#ifndef QT_NO_REGEXP
QRegExp toRegExp() const;
#endif
+#ifndef QT_BOOTSTRAPPED
+ QEasingCurve toEasingCurve() const;
+#endif
#ifdef QT3_SUPPORT
inline QT3_SUPPORT int &asInt();
diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp
index ec50ac8..43df13a 100644
--- a/src/corelib/thread/qmutex.cpp
+++ b/src/corelib/thread/qmutex.cpp
@@ -41,6 +41,7 @@
#include "qplatformdefs.h"
#include "qmutex.h"
+#include <qdebug.h>
#ifndef QT_NO_THREAD
#include "qatomic.h"
@@ -159,8 +160,7 @@ void QMutex::lock()
if (!isLocked) {
#ifndef QT_NO_DEBUG
if (d->owner == self)
- qWarning("QMutex::lock: Deadlock detected in thread %ld",
- long(d->owner));
+ qWarning() << "QMutex::lock: Deadlock detected in thread" << d->owner;
#endif
// didn't get the lock, wait for it
@@ -197,8 +197,7 @@ void QMutex::lock()
if (!isLocked) {
#ifndef QT_NO_DEBUG
if (d->owner == self)
- qWarning("QMutex::lock: Deadlock detected in thread %ld",
- long(d->owner));
+ qWarning() << "QMutex::lock: Deadlock detected in thread" << d->owner;
#endif
// didn't get the lock, wait for it
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index b6a2df4..d4b2c27 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -600,11 +600,11 @@ QEasingCurve::QEasingCurve(Type type)
Construct a copy of \a other.
*/
QEasingCurve::QEasingCurve(const QEasingCurve &other)
-: d_ptr(new QEasingCurvePrivate)
+ : d_ptr(new QEasingCurvePrivate)
{
// ### non-atomic, requires malloc on shallow copy
*d_ptr = *other.d_ptr;
- if(other.d_ptr->config)
+ if (other.d_ptr->config)
d_ptr->config = other.d_ptr->config->copy();
}
@@ -629,7 +629,7 @@ QEasingCurve &QEasingCurve::operator=(const QEasingCurve &other)
}
*d_ptr = *other.d_ptr;
- if(other.d_ptr->config)
+ if (other.d_ptr->config)
d_ptr->config = other.d_ptr->config->copy();
return *this;
@@ -845,6 +845,67 @@ QDebug operator<<(QDebug debug, const QEasingCurve &item)
}
return debug;
}
-#endif
+#endif // QT_NO_DEBUG_STREAM
+
+#ifndef QT_NO_DATASTREAM
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing)
+ \relates QEasingCurve
+
+ Writes the given \a easing curve to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing)
+{
+ stream << quint8(easing.d_ptr->type);
+ stream << quint64(quintptr(easing.d_ptr->func));
+
+ bool hasConfig = easing.d_ptr->config;
+ stream << hasConfig;
+ if (hasConfig) {
+ stream << easing.d_ptr->config->_p;
+ stream << easing.d_ptr->config->_a;
+ stream << easing.d_ptr->config->_o;
+ }
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing)
+ \relates QQuaternion
+
+ Reads an easing curve from the given \a stream into the given \a quaternion
+ and returns a reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing)
+{
+ QEasingCurve::Type type;
+ quint8 int_type;
+ stream >> int_type;
+ type = static_cast<QEasingCurve::Type>(int_type);
+ easing.setType(type);
+
+ quint64 ptr_func;
+ stream >> ptr_func;
+ easing.d_ptr->func = QEasingCurve::EasingFunction(quintptr(ptr_func));
+
+ bool hasConfig;
+ stream >> hasConfig;
+ if (hasConfig) {
+ QEasingCurveFunction *config = curveToFunctionObject(type);
+ stream >> config->_p;
+ stream >> config->_a;
+ stream >> config->_o;
+ easing.d_ptr->config = config;
+ }
+ return stream;
+}
+#endif // QT_NO_DATASTREAM
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h
index ae8822e..173fba4 100644
--- a/src/corelib/tools/qeasingcurve.h
+++ b/src/corelib/tools/qeasingcurve.h
@@ -100,13 +100,24 @@ public:
qreal valueForProgress(qreal progress) const;
private:
QEasingCurvePrivate *d_ptr;
+#ifndef QT_NO_DEBUG_STREAM
friend Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item);
+#endif
+#ifndef QT_NO_DATASTREAM
+ friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve&);
+ friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &);
+#endif
};
#ifndef QT_NO_DEBUG_STREAM
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item);
#endif
+#ifndef QT_NO_DATASTREAM
+Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve&);
+Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &);
+#endif
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index b4bfcaf..84bc154 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -465,7 +465,7 @@ static QString winToQtFormat(const QString &sys_fmt)
if (text == QLatin1String("'"))
result += QLatin1String("''");
else
- result += QLatin1Char('\'') + text + QLatin1Char('\'');
+ result += QString(QLatin1Char('\'') + text + QLatin1Char('\''));
continue;
}
@@ -681,8 +681,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
case DateTimeFormatLong:
case DateTimeFormatShort:
- return query(type == DateTimeFormatLong ? DateFormatLong : DateFormatShort).toString()
- + QLatin1Char(' ') + query(type == DateTimeFormatLong ? TimeFormatLong : TimeFormatShort).toString();
+ return QString(query(type == DateTimeFormatLong ? DateFormatLong : DateFormatShort).toString()
+ + QLatin1Char(' ') + query(type == DateTimeFormatLong ? TimeFormatLong : TimeFormatShort).toString());
case DayNameLong:
case DayNameShort:
return winDayName(in.toInt(), (type == DayNameShort));
@@ -698,8 +698,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
case DateTimeToStringShort:
case DateTimeToStringLong: {
const QDateTime dt = in.toDateTime();
- return winDateToString(dt.date(), type == DateTimeToStringShort ? DATE_SHORTDATE : DATE_LONGDATE)
- + QLatin1Char(' ') + winTimeToString(dt.time()); }
+ return QString(winDateToString(dt.date(), type == DateTimeToStringShort ? DATE_SHORTDATE : DATE_LONGDATE)
+ + QLatin1Char(' ') + winTimeToString(dt.time())); }
case ZeroDigit:
locale_info = LOCALE_SNATIVEDIGITS;
diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp
index b1a7caa..58e3ba8 100644
--- a/src/corelib/tools/qlocale_symbian.cpp
+++ b/src/corelib/tools/qlocale_symbian.cpp
@@ -841,7 +841,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
return symbianTimeFormat();
case DateTimeFormatLong:
case DateTimeFormatShort:
- return symbianDateFormat( (type == DateTimeFormatShort) ) + QLatin1Char(' ') + symbianTimeFormat();
+ return QString(symbianDateFormat( (type == DateTimeFormatShort) ) + QLatin1Char(' ') + symbianTimeFormat());
case DateToStringShort:
case DateToStringLong:
return symbianDateToString(in.toDate(), (type == DateToStringShort) );
@@ -851,8 +851,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
case DateTimeToStringShort:
case DateTimeToStringLong: {
const QDateTime dt = in.toDateTime();
- return symbianDateToString(dt.date(), (type == DateTimeToStringShort) )
- + QLatin1Char(' ') + symbianTimeToString(dt.time());
+ return QString(symbianDateToString(dt.date(), (type == DateTimeToStringShort) )
+ + QLatin1Char(' ') + symbianTimeToString(dt.time()));
}
case MeasurementSystem:
return static_cast<int>(symbianMeasurementSystem());
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index 25255f9..20ad444 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -1466,9 +1466,14 @@ void QRegExpMatchState::match(const QChar *str0, int len0, int pos0,
#ifndef QT_NO_REGEXP_CAPTURE
for (int i = 0; i < numCaptures; ++i) {
int j = eng->captureForOfficialCapture.at(i);
- int len = capEnd[j] - capBegin[j];
- *c++ = (len > 0) ? pos + capBegin[j] : 0;
- *c++ = len;
+ if (capBegin[j] != EmptyCapture) {
+ int len = capEnd[j] - capBegin[j];
+ *c++ = (len > 0) ? pos + capBegin[j] : 0;
+ *c++ = len;
+ } else {
+ *c++ = -1;
+ *c++ = -1;
+ }
}
#endif
} else {
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index d85c248..bfc65bc 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -209,6 +209,7 @@ namespace QtSharedPointer {
inline bool destroy() { destroyer(this); return true; }
inline void operator delete(void *ptr) { ::operator delete(ptr); }
+ inline void operator delete(void *, void *) { }
};
// sizeof(ExternalRefCountWithDestroyFn) = 16 (32-bit) / 24 (64-bit)
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
new file mode 100644
index 0000000..52d2cea
--- /dev/null
+++ b/src/corelib/tools/qsimd.cpp
@@ -0,0 +1,246 @@
+/****************************************************************************
+**
+** 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 QtCore 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 "qsimd_p.h"
+#include <QByteArray>
+
+QT_BEGIN_NAMESPACE
+
+uint qDetectCPUFeatures()
+{
+ static uint features = 0xffffffff;
+ if (features != 0xffffffff)
+ return features;
+
+#if defined (Q_OS_WINCE)
+#if defined (ARM)
+ if (IsProcessorFeaturePresent(PF_ARM_INTEL_WMMX)) {
+ features = IWMMXT;
+ return features;
+ }
+#elif defined(_X86_)
+ features = 0;
+#if defined QT_HAVE_MMX
+ if (IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE))
+ features |= MMX;
+#endif
+#if defined QT_HAVE_3DNOW
+ if (IsProcessorFeaturePresent(PF_3DNOW_INSTRUCTIONS_AVAILABLE))
+ features |= MMX3DNOW;
+#endif
+ return features;
+#endif
+ features = 0;
+ return features;
+#elif defined(QT_HAVE_IWMMXT)
+ // runtime detection only available when running as a previlegied process
+ static const bool doIWMMXT = !qgetenv("QT_NO_IWMMXT").toInt();
+ features = doIWMMXT ? IWMMXT : 0;
+ return features;
+#elif defined(QT_HAVE_NEON)
+ static const bool doNEON = !qgetenv("QT_NO_NEON").toInt();
+ features = doNEON ? NEON : 0;
+ return features;
+#else
+ features = 0;
+#if defined(__x86_64__) || defined(Q_OS_WIN64)
+ features = MMX|SSE|SSE2|CMOV;
+#elif defined(__ia64__)
+ features = MMX|SSE|SSE2;
+#elif defined(__i386__) || defined(_M_IX86)
+ unsigned int extended_result = 0;
+ uint result = 0;
+ /* see p. 118 of amd64 instruction set manual Vol3 */
+#if defined(Q_CC_GNU)
+ asm ("push %%ebx\n"
+ "pushf\n"
+ "pop %%eax\n"
+ "mov %%eax, %%ebx\n"
+ "xor $0x00200000, %%eax\n"
+ "push %%eax\n"
+ "popf\n"
+ "pushf\n"
+ "pop %%eax\n"
+ "xor %%edx, %%edx\n"
+ "xor %%ebx, %%eax\n"
+ "jz 1f\n"
+
+ "mov $0x00000001, %%eax\n"
+ "cpuid\n"
+ "1:\n"
+ "pop %%ebx\n"
+ "mov %%edx, %0\n"
+ : "=r" (result)
+ :
+ : "%eax", "%ecx", "%edx"
+ );
+
+ asm ("push %%ebx\n"
+ "pushf\n"
+ "pop %%eax\n"
+ "mov %%eax, %%ebx\n"
+ "xor $0x00200000, %%eax\n"
+ "push %%eax\n"
+ "popf\n"
+ "pushf\n"
+ "pop %%eax\n"
+ "xor %%edx, %%edx\n"
+ "xor %%ebx, %%eax\n"
+ "jz 2f\n"
+
+ "mov $0x80000000, %%eax\n"
+ "cpuid\n"
+ "cmp $0x80000000, %%eax\n"
+ "jbe 2f\n"
+ "mov $0x80000001, %%eax\n"
+ "cpuid\n"
+ "2:\n"
+ "pop %%ebx\n"
+ "mov %%edx, %0\n"
+ : "=r" (extended_result)
+ :
+ : "%eax", "%ecx", "%edx"
+ );
+#elif defined (Q_OS_WIN)
+ _asm {
+ push eax
+ push ebx
+ push ecx
+ push edx
+ pushfd
+ pop eax
+ mov ebx, eax
+ xor eax, 00200000h
+ push eax
+ popfd
+ pushfd
+ pop eax
+ mov edx, 0
+ xor eax, ebx
+ jz skip
+
+ mov eax, 1
+ cpuid
+ mov result, edx
+ skip:
+ pop edx
+ pop ecx
+ pop ebx
+ pop eax
+ }
+
+ _asm {
+ push eax
+ push ebx
+ push ecx
+ push edx
+ pushfd
+ pop eax
+ mov ebx, eax
+ xor eax, 00200000h
+ push eax
+ popfd
+ pushfd
+ pop eax
+ mov edx, 0
+ xor eax, ebx
+ jz skip2
+
+ mov eax, 80000000h
+ cpuid
+ cmp eax, 80000000h
+ jbe skip2
+ mov eax, 80000001h
+ cpuid
+ mov extended_result, edx
+ skip2:
+ pop edx
+ pop ecx
+ pop ebx
+ pop eax
+ }
+#endif
+
+ // result now contains the standard feature bits
+ if (result & (1u << 15))
+ features |= CMOV;
+ if (result & (1u << 23))
+ features |= MMX;
+ if (extended_result & (1u << 22))
+ features |= MMXEXT;
+ if (extended_result & (1u << 31))
+ features |= MMX3DNOW;
+ if (extended_result & (1u << 30))
+ features |= MMX3DNOWEXT;
+ if (result & (1u << 25))
+ features |= SSE;
+ if (result & (1u << 26))
+ features |= SSE2;
+#endif // i386
+
+#if defined(QT_HAVE_MMX)
+ if (qgetenv("QT_NO_MMX").toInt())
+ features ^= MMX;
+#endif
+ if (qgetenv("QT_NO_MMXEXT").toInt())
+ features ^= MMXEXT;
+
+#if defined(QT_HAVE_3DNOW)
+ if (qgetenv("QT_NO_3DNOW").toInt())
+ features ^= MMX3DNOW;
+#endif
+ if (qgetenv("QT_NO_3DNOWEXT").toInt())
+ features ^= MMX3DNOWEXT;
+
+#if defined(QT_HAVE_SSE)
+ if (qgetenv("QT_NO_SSE").toInt())
+ features ^= SSE;
+#endif
+#if defined(QT_HAVE_SSE2)
+ if (qgetenv("QT_NO_SSE2").toInt())
+ features ^= SSE2;
+#endif
+
+ return features;
+#endif
+}
+
+QT_END_NAMESPACE
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
new file mode 100644
index 0000000..556db14
--- /dev/null
+++ b/src/corelib/tools/qsimd_p.h
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** 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 QtCore 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 QSIMD_P_H
+#define QSIMD_P_H
+
+#include <qglobal.h>
+
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Core)
+
+#if defined(QT_NO_MAC_XARCH) || (defined(Q_OS_DARWIN) && (defined(__ppc__) || defined(__ppc64__)))
+// Disable MMX and SSE on Mac/PPC builds, or if the compiler
+// does not support -Xarch argument passing
+#undef QT_HAVE_SSE2
+#undef QT_HAVE_SSE
+#undef QT_HAVE_3DNOW
+#undef QT_HAVE_MMX
+#endif
+
+// SSE intrinsics
+#if defined(__SSE2__)
+#if defined(QT_LINUXBASE)
+/// this is an evil hack - the posix_memalign declaration in LSB
+/// is wrong - see http://bugs.linuxbase.org/show_bug.cgi?id=2431
+# define posix_memalign _lsb_hack_posix_memalign
+# include <emmintrin.h>
+# undef posix_memalign
+#else
+# include <emmintrin.h>
+#endif
+
+#define QT_ALWAYS_HAVE_SSE2
+#endif
+
+// NEON intrinsics
+#if defined(QT_HAVE_NEON)
+#include <arm_neon.h>
+#endif
+
+
+// IWMMXT intrinsics
+#if defined(QT_HAVE_IWMMXT)
+#include <mmintrin.h>
+#if defined(Q_OS_WINCE)
+# include "qplatformdefs.h"
+#endif
+#endif
+
+#if defined(QT_HAVE_IWMMXT)
+#if !defined(__IWMMXT__) && !defined(Q_OS_WINCE)
+# include <xmmintrin.h>
+#elif defined(Q_OS_WINCE_STD) && defined(_X86_)
+# pragma warning(disable: 4391)
+# include <xmmintrin.h>
+#endif
+#endif
+
+// 3D now intrinsics
+#if defined(QT_HAVE_3DNOW)
+#include <mm3dnow.h>
+#endif
+
+enum CPUFeatures {
+ None = 0,
+ MMX = 0x1,
+ MMXEXT = 0x2,
+ MMX3DNOW = 0x4,
+ MMX3DNOWEXT = 0x8,
+ SSE = 0x10,
+ SSE2 = 0x20,
+ CMOV = 0x40,
+ IWMMXT = 0x80,
+ NEON = 0x100
+};
+
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+Q_CORE_EXPORT uint qDetectCPUFeatures();
+
+#endif // QSIMD_P_H
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index ac1bee7..e9b7b9a 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -46,6 +46,7 @@
#include <qtextcodec.h>
#endif
#include <private/qutfcodec_p.h>
+#include "qsimd_p.h"
#include <qdatastream.h>
#include <qlist.h>
#include "qlocale.h"
@@ -3479,12 +3480,82 @@ static QByteArray toLatin1_helper(const QChar *data, int length)
QByteArray ba;
if (length) {
ba.resize(length);
- const ushort *i = reinterpret_cast<const ushort *>(data);
- const ushort *e = i + length;
- uchar *s = (uchar*) ba.data();
- while (i != e) {
- *s++ = (*i>0xff) ? '?' : (uchar) *i;
- ++i;
+ const ushort *src = reinterpret_cast<const ushort *>(data);
+ uchar *dst = (uchar*) ba.data();
+#if defined(QT_ALWAYS_HAVE_SSE2)
+ if (length >= 16) {
+ const int chunkCount = length >> 4; // divided by 16
+ const __m128i questionMark = _mm_set1_epi16('?');
+ // SSE has no compare instruction for unsigned comparison.
+ // The variables must be shiffted + 0x8000 to be compared
+ const __m128i signedBitOffset = _mm_set1_epi16(0x8000);
+ const __m128i thresholdMask = _mm_set1_epi16(0xff + 0x8000);
+ for (int i = 0; i < chunkCount; ++i) {
+ __m128i chunk1 = _mm_loadu_si128((__m128i*)src); // load
+ src += 8;
+ {
+ // each 16 bit is equal to 0xFF if the source is outside latin 1 (>0xff)
+ const __m128i signedChunk = _mm_add_epi16(chunk1, signedBitOffset);
+ const __m128i offLimitMask = _mm_cmpgt_epi16(signedChunk, thresholdMask);
+
+ // offLimitQuestionMark contains '?' for each 16 bits that was off-limit
+ // the 16 bits that were correct contains zeros
+ const __m128i offLimitQuestionMark = _mm_and_si128(offLimitMask, questionMark);
+
+ // correctBytes contains the bytes that were in limit
+ // the 16 bits that were off limits contains zeros
+ const __m128i correctBytes = _mm_andnot_si128(offLimitMask, chunk1);
+
+ // merge offLimitQuestionMark and correctBytes to have the result
+ chunk1 = _mm_or_si128(correctBytes, offLimitQuestionMark);
+ }
+
+ __m128i chunk2 = _mm_loadu_si128((__m128i*)src); // load
+ src += 8;
+ {
+ // exactly the same operations as for the previous chunk of data
+ const __m128i signedChunk = _mm_add_epi16(chunk2, signedBitOffset);
+ const __m128i offLimitMask = _mm_cmpgt_epi16(signedChunk, thresholdMask);
+ const __m128i offLimitQuestionMark = _mm_and_si128(offLimitMask, questionMark);
+ const __m128i correctBytes = _mm_andnot_si128(offLimitMask, chunk2);
+ chunk2 = _mm_or_si128(correctBytes, offLimitQuestionMark);
+ }
+
+ // pack the two vector to 16 x 8bits elements
+ const __m128i result = _mm_packus_epi16(chunk1, chunk2);
+
+ _mm_storeu_si128((__m128i*)dst, result); // store
+ dst += 16;
+ }
+ length = length % 16;
+ }
+#elif QT_HAVE_NEON
+ // Refer to the documentation of the SSE2 implementation
+ // this use eactly the same method as for SSE except:
+ // 1) neon has unsigned comparison
+ // 2) packing is done to 64 bits (8 x 8bits component).
+ if (length >= 16) {
+ const int chunkCount = length >> 3; // divided by 8
+ const uint16x8_t questionMark = vdupq_n_u16('?'); // set
+ const uint16x8_t thresholdMask = vdupq_n_u16(0xff); // set
+ for (int i = 0; i < chunkCount; ++i) {
+ uint16x8_t chunk = vld1q_u16((uint16_t *)src); // load
+ src += 8;
+
+ const uint16x8_t offLimitMask = vcgtq_u16(chunk, thresholdMask); // chunk > thresholdMask
+ const uint16x8_t offLimitQuestionMark = vandq_u16(offLimitMask, questionMark); // offLimitMask & questionMark
+ const uint16x8_t correctBytes = vbicq_u16(chunk, offLimitMask); // !offLimitMask & chunk
+ chunk = vorrq_u16(correctBytes, offLimitQuestionMark); // correctBytes | offLimitQuestionMark
+ const uint8x8_t result = vmovn_u16(chunk); // narrowing move->packing
+ vst1_u8(dst, result); // store
+ dst += 8;
+ }
+ length = length % 8;
+ }
+#endif
+ while (length--) {
+ *dst++ = (*src>0xff) ? '?' : (uchar) *src;
+ ++src;
}
}
return ba;
@@ -3647,10 +3718,35 @@ QString::Data *QString::fromLatin1_helper(const char *str, int size)
d->alloc = d->size = size;
d->clean = d->asciiCache = d->simpletext = d->righttoleft = d->capacity = 0;
d->data = d->array;
- ushort *i = d->data;
d->array[size] = '\0';
+ ushort *dst = d->data;
+ /* SIMD:
+ * Unpacking with SSE has been shown to improve performance on recent CPUs
+ * The same method gives no improvement with NEON.
+ */
+#if defined(QT_ALWAYS_HAVE_SSE2)
+ if (size >= 16) {
+ int chunkCount = size >> 4; // divided by 16
+ const __m128i nullMask = _mm_set1_epi32(0);
+ for (int i = 0; i < chunkCount; ++i) {
+ const __m128i chunk = _mm_loadu_si128((__m128i*)str); // load
+ str += 16;
+
+ // unpack the first 8 bytes, padding with zeros
+ const __m128i firstHalf = _mm_unpacklo_epi8(chunk, nullMask);
+ _mm_storeu_si128((__m128i*)dst, firstHalf); // store
+ dst += 8;
+
+ // unpack the last 8 bytes, padding with zeros
+ const __m128i secondHalf = _mm_unpackhi_epi8 (chunk, nullMask);
+ _mm_storeu_si128((__m128i*)dst, secondHalf); // store
+ dst += 8;
+ }
+ size = size % 16;
+ }
+#endif
while (size--)
- *i++ = (uchar)*str++;
+ *dst++ = (uchar)*str++;
}
return d;
}
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 8de3c7d..a59c0bd 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -73,6 +73,16 @@ typedef std::basic_string<wchar_t> QStdWString;
#error qstring.h must be included before any header file that defines truncate
#endif
+#if defined(Q_CC_GNU) && (__GNUC__ == 4 && __GNUC_MINOR__ == 0)
+//There is a bug in GCC 4.0 that tries to instantiate template of annonymous enum
+# ifdef QT_USE_FAST_OPERATOR_PLUS
+# undef QT_USE_FAST_OPERATOR_PLUS
+# endif
+# ifdef QT_USE_FAST_CONCATENATION
+# undef QT_USE_FAST_CONCATENATION
+# endif
+#endif
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index 74661c2..0c3ba06 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -100,14 +100,18 @@ public:
operator QString() const
{
- QString s(QConcatenable< QStringBuilder<A, B> >::size(*this),
- Qt::Uninitialized);
+ const uint size = QConcatenable< QStringBuilder<A, B> >::size(*this);
+ QString s(size, Qt::Uninitialized);
QChar *d = s.data();
+ const QChar * const start = d;
QConcatenable< QStringBuilder<A, B> >::appendTo(*this, d);
- // this resize is necessary since we allocate a bit too much
- // when dealing with variable sized 8-bit encodings
- s.resize(d - s.data());
+
+ if (!QConcatenable< QStringBuilder<A, B> >::ExactSize && int(size) != d - start) {
+ // this resize is necessary since we allocate a bit too much
+ // when dealing with variable sized 8-bit encodings
+ s.resize(d - start);
+ }
return s;
}
QByteArray toLatin1() const { return QString(*this).toLatin1(); }
@@ -116,10 +120,24 @@ public:
const B &b;
};
+template <>
+class QStringBuilder <QString, QString>
+{
+ public:
+ QStringBuilder(const QString &a_, const QString &b_) : a(a_), b(b_) {}
+
+ operator QString() const
+ { QString r(a); r += b; return r; }
+ QByteArray toLatin1() const { return QString(*this).toLatin1(); }
+
+ const QString &a;
+ const QString &b;
+};
template <> struct QConcatenable<char> : private QAbstractConcatenable
{
typedef char type;
+ enum { ExactSize = true };
static int size(const char) { return 1; }
static inline void appendTo(const char c, QChar *&out)
{
@@ -130,6 +148,7 @@ template <> struct QConcatenable<char> : private QAbstractConcatenable
template <> struct QConcatenable<QLatin1Char>
{
typedef QLatin1Char type;
+ enum { ExactSize = true };
static int size(const QLatin1Char) { return 1; }
static inline void appendTo(const QLatin1Char c, QChar *&out)
{
@@ -140,6 +159,7 @@ template <> struct QConcatenable<QLatin1Char>
template <> struct QConcatenable<QChar>
{
typedef QChar type;
+ enum { ExactSize = true };
static int size(const QChar) { return 1; }
static inline void appendTo(const QChar c, QChar *&out)
{
@@ -150,6 +170,7 @@ template <> struct QConcatenable<QChar>
template <> struct QConcatenable<QCharRef>
{
typedef QCharRef type;
+ enum { ExactSize = true };
static int size(const QCharRef &) { return 1; }
static inline void appendTo(const QCharRef &c, QChar *&out)
{
@@ -160,6 +181,7 @@ template <> struct QConcatenable<QCharRef>
template <> struct QConcatenable<QLatin1String>
{
typedef QLatin1String type;
+ enum { ExactSize = true };
static int size(const QLatin1String &a) { return qstrlen(a.latin1()); }
static inline void appendTo(const QLatin1String &a, QChar *&out)
{
@@ -172,6 +194,7 @@ template <> struct QConcatenable<QLatin1String>
template <> struct QConcatenable<QLatin1Literal>
{
typedef QLatin1Literal type;
+ enum { ExactSize = true };
static int size(const QLatin1Literal &a) { return a.size(); }
static inline void appendTo(const QLatin1Literal &a, QChar *&out)
{
@@ -183,6 +206,7 @@ template <> struct QConcatenable<QLatin1Literal>
template <> struct QConcatenable<QString>
{
typedef QString type;
+ enum { ExactSize = true };
static int size(const QString &a) { return a.size(); }
static inline void appendTo(const QString &a, QChar *&out)
{
@@ -195,6 +219,7 @@ template <> struct QConcatenable<QString>
template <> struct QConcatenable<QStringRef>
{
typedef QStringRef type;
+ enum { ExactSize = true };
static int size(const QStringRef &a) { return a.size(); }
static inline void appendTo(QStringRef a, QChar *&out)
{
@@ -208,6 +233,7 @@ template <> struct QConcatenable<QStringRef>
template <int N> struct QConcatenable<char[N]> : private QAbstractConcatenable
{
typedef char type[N];
+ enum { ExactSize = false };
static int size(const char[N])
{
return N - 1;
@@ -221,6 +247,7 @@ template <int N> struct QConcatenable<char[N]> : private QAbstractConcatenable
template <int N> struct QConcatenable<const char[N]> : private QAbstractConcatenable
{
typedef const char type[N];
+ enum { ExactSize = false };
static int size(const char[N]) { return N - 1; }
static inline void appendTo(const char a[N], QChar *&out)
{
@@ -231,6 +258,7 @@ template <int N> struct QConcatenable<const char[N]> : private QAbstractConcaten
template <> struct QConcatenable<const char *> : private QAbstractConcatenable
{
typedef char const *type;
+ enum { ExactSize = false };
static int size(const char *a) { return qstrlen(a); }
static inline void appendTo(const char *a, QChar *&out)
{
@@ -241,6 +269,7 @@ template <> struct QConcatenable<const char *> : private QAbstractConcatenable
template <> struct QConcatenable<QByteArray> : private QAbstractConcatenable
{
typedef QByteArray type;
+ enum { ExactSize = false };
static int size(const QByteArray &ba) { return qstrnlen(ba.constData(), ba.size()); }
static inline void appendTo(const QByteArray &ba, QChar *&out)
{
@@ -253,6 +282,7 @@ template <typename A, typename B>
struct QConcatenable< QStringBuilder<A, B> >
{
typedef QStringBuilder<A, B> type;
+ enum { ExactSize = QConcatenable<A>::ExactSize && QConcatenable<B>::ExactSize };
static int size(const type &p)
{
return QConcatenable<A>::size(p.a) + QConcatenable<B>::size(p.b);
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 3406e41..6d64915 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -33,6 +33,7 @@ HEADERS += \
tools/qsharedpointer.h \
tools/qsharedpointer_impl.h \
tools/qset.h \
+ tools/qsimd_p.h \
tools/qsize.h \
tools/qstack.h \
tools/qstring.h \
@@ -68,6 +69,7 @@ SOURCES += \
tools/qregexp.cpp \
tools/qshareddata.cpp \
tools/qsharedpointer.cpp \
+ tools/qsimd.cpp \
tools/qsize.cpp \
tools/qstring.cpp \
tools/qstringbuilder.cpp \
diff --git a/src/declarative/3rdparty/qlistmodelinterface.cpp b/src/declarative/3rdparty/qlistmodelinterface.cpp
index 939e985..50714ce 100644
--- a/src/declarative/3rdparty/qlistmodelinterface.cpp
+++ b/src/declarative/3rdparty/qlistmodelinterface.cpp
@@ -46,11 +46,11 @@ QT_BEGIN_NAMESPACE
/*!
\internal
\class QListModelInterface
- \brief The QListModelInterface class can be subclassed to provide C++ models to QmlGraphics Views
+ \brief The QListModelInterface class can be subclassed to provide C++ models to QDeclarativeGraphics Views
This class is comprised primarily of pure virtual functions which
you must implement in a subclass. You can then use the subclass
- as a model for a QmlGraphics view, such as a QmlGraphicsListView.
+ as a model for a QDeclarativeGraphics view, such as a QDeclarativeListView.
*/
/*! \fn QListModelInterface::QListModelInterface(QObject *parent)
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt
index 06fa720..34e4834 100644
--- a/src/declarative/QmlChanges.txt
+++ b/src/declarative/QmlChanges.txt
@@ -1,7 +1,17 @@
=============================================================================
The changes below are pre Qt 4.7.0 alpha
+Flickable: renamed viewportWidth -> contentWidth
+Flickable: renamed viewportHeight -> contentHeight
+Flickable: renamed viewportX -> contentX
+Flickable: renamed viewportY -> contentY
+Removed Flickable.reportedVelocitySmoothing
Renamed MouseRegion -> MouseArea
+Connection: syntax and rename:
+ Connection { sender: a; signal: foo(); script: xxx }
+ Connection { sender: a; signal: bar(); script: yyy }
+ becomes:
+ Connections { target: a; onFoo: xxx; onBar: yyy }
QmlView
-------
@@ -28,6 +38,14 @@ ListModel
- foo: true is now a bool (not string "true")
- foo: false is now a bool (not string "false" == true!)
+C++ API
+-------
+QML_DEFINE_... definition macros, previously global macros, are replaced by
+QML_REGISTER_... registration macros, which must be called explicitly. C++ API users
+should also consider using the QmlExtensionPlugin (previously named QmlModulePlugin)
+as a cleaner mechanism for publishing libraries of QML types, or the upcoming
+application plugin features of the qmlviewer / qmlruntime / qml.
+
PropertyAnimation
------------------
matchProperties and matchTargets have been renamed back to properties and targets.
diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri
index 261b2ff..dedea55 100644
--- a/src/declarative/debugger/debugger.pri
+++ b/src/declarative/debugger/debugger.pri
@@ -1,15 +1,15 @@
INCLUDEPATH += $$PWD
SOURCES += \
- $$PWD/qmldebuggerstatus.cpp \
+ $$PWD/qdeclarativedebuggerstatus.cpp \
$$PWD/qpacketprotocol.cpp \
- $$PWD/qmldebugservice.cpp \
- $$PWD/qmldebugclient.cpp \
- $$PWD/qmldebug.cpp
+ $$PWD/qdeclarativedebugservice.cpp \
+ $$PWD/qdeclarativedebugclient.cpp \
+ $$PWD/qdeclarativedebug.cpp
HEADERS += \
- $$PWD/qmldebuggerstatus_p.h \
+ $$PWD/qdeclarativedebuggerstatus_p.h \
$$PWD/qpacketprotocol_p.h \
- $$PWD/qmldebugservice_p.h \
- $$PWD/qmldebugclient_p.h \
- $$PWD/qmldebug_p.h
+ $$PWD/qdeclarativedebugservice_p.h \
+ $$PWD/qdeclarativedebugclient_p.h \
+ $$PWD/qdeclarativedebug_p.h
diff --git a/src/declarative/debugger/qdeclarativedebug.cpp b/src/declarative/debugger/qdeclarativedebug.cpp
new file mode 100644
index 0000000..e4b7d4d
--- /dev/null
+++ b/src/declarative/debugger/qdeclarativedebug.cpp
@@ -0,0 +1,937 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 "qdeclarativedebug_p.h"
+
+#include "qdeclarativedebugclient_p.h"
+
+#include <qdeclarativeenginedebug_p.h>
+
+#include <private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeEngineDebugClient : public QDeclarativeDebugClient
+{
+public:
+ QDeclarativeEngineDebugClient(QDeclarativeDebugConnection *client, QDeclarativeEngineDebugPrivate *p);
+
+protected:
+ virtual void messageReceived(const QByteArray &);
+
+private:
+ QDeclarativeEngineDebugPrivate *priv;
+};
+
+class QDeclarativeEngineDebugPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QDeclarativeEngineDebug)
+public:
+ QDeclarativeEngineDebugPrivate(QDeclarativeDebugConnection *);
+
+ void message(const QByteArray &);
+
+ QDeclarativeEngineDebugClient *client;
+ int nextId;
+ int getId();
+
+ void decode(QDataStream &, QDeclarativeDebugContextReference &);
+ void decode(QDataStream &, QDeclarativeDebugObjectReference &, bool simple);
+
+ static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugEnginesQuery *);
+ static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugRootContextQuery *);
+ static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugObjectQuery *);
+ static void remove(QDeclarativeEngineDebug *, QDeclarativeDebugExpressionQuery *);
+
+ QHash<int, QDeclarativeDebugEnginesQuery *> enginesQuery;
+ QHash<int, QDeclarativeDebugRootContextQuery *> rootContextQuery;
+ QHash<int, QDeclarativeDebugObjectQuery *> objectQuery;
+ QHash<int, QDeclarativeDebugExpressionQuery *> expressionQuery;
+
+ QHash<int, QDeclarativeDebugWatch *> watched;
+};
+
+QDeclarativeEngineDebugClient::QDeclarativeEngineDebugClient(QDeclarativeDebugConnection *client,
+ QDeclarativeEngineDebugPrivate *p)
+: QDeclarativeDebugClient(QLatin1String("QDeclarativeEngine"), client), priv(p)
+{
+ setEnabled(true);
+}
+
+void QDeclarativeEngineDebugClient::messageReceived(const QByteArray &data)
+{
+ priv->message(data);
+}
+
+QDeclarativeEngineDebugPrivate::QDeclarativeEngineDebugPrivate(QDeclarativeDebugConnection *c)
+: client(new QDeclarativeEngineDebugClient(c, this)), nextId(0)
+{
+}
+
+int QDeclarativeEngineDebugPrivate::getId()
+{
+ return nextId++;
+}
+
+void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclarativeDebugEnginesQuery *q)
+{
+ if (c && q) {
+ QDeclarativeEngineDebugPrivate *p = (QDeclarativeEngineDebugPrivate *)QObjectPrivate::get(c);
+ p->enginesQuery.remove(q->m_queryId);
+ }
+}
+
+void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c,
+ QDeclarativeDebugRootContextQuery *q)
+{
+ if (c && q) {
+ QDeclarativeEngineDebugPrivate *p = (QDeclarativeEngineDebugPrivate *)QObjectPrivate::get(c);
+ p->rootContextQuery.remove(q->m_queryId);
+ }
+}
+
+void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclarativeDebugObjectQuery *q)
+{
+ if (c && q) {
+ QDeclarativeEngineDebugPrivate *p = (QDeclarativeEngineDebugPrivate *)QObjectPrivate::get(c);
+ p->objectQuery.remove(q->m_queryId);
+ }
+}
+
+void QDeclarativeEngineDebugPrivate::remove(QDeclarativeEngineDebug *c, QDeclarativeDebugExpressionQuery *q)
+{
+ if (c && q) {
+ QDeclarativeEngineDebugPrivate *p = (QDeclarativeEngineDebugPrivate *)QObjectPrivate::get(c);
+ p->expressionQuery.remove(q->m_queryId);
+ }
+}
+
+void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugObjectReference &o,
+ bool simple)
+{
+ QDeclarativeEngineDebugServer::QDeclarativeObjectData data;
+ ds >> data;
+ o.m_debugId = data.objectId;
+ o.m_class = data.objectType;
+ o.m_name = data.objectName;
+ o.m_source.m_url = data.url;
+ o.m_source.m_lineNumber = data.lineNumber;
+ o.m_source.m_columnNumber = data.columnNumber;
+ o.m_contextDebugId = data.contextId;
+
+ if (simple)
+ return;
+
+ int childCount;
+ bool recur;
+ ds >> childCount >> recur;
+
+ for (int ii = 0; ii < childCount; ++ii) {
+ o.m_children.append(QDeclarativeDebugObjectReference());
+ decode(ds, o.m_children.last(), !recur);
+ }
+
+ int propCount;
+ ds >> propCount;
+
+ for (int ii = 0; ii < propCount; ++ii) {
+ QDeclarativeEngineDebugServer::QDeclarativeObjectProperty data;
+ ds >> data;
+ QDeclarativeDebugPropertyReference prop;
+ prop.m_objectDebugId = o.m_debugId;
+ prop.m_name = data.name;
+ prop.m_binding = data.binding;
+ prop.m_hasNotifySignal = data.hasNotifySignal;
+ prop.m_valueTypeName = data.valueTypeName;
+ switch (data.type) {
+ case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Basic:
+ case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::List:
+ case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::SignalProperty:
+ {
+ prop.m_value = data.value;
+ break;
+ }
+ case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Object:
+ {
+ QDeclarativeDebugObjectReference obj;
+ obj.m_debugId = prop.m_value.toInt();
+ prop.m_value = qVariantFromValue(obj);
+ break;
+ }
+ case QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Unknown:
+ break;
+ }
+ o.m_properties << prop;
+ }
+}
+
+void QDeclarativeEngineDebugPrivate::decode(QDataStream &ds, QDeclarativeDebugContextReference &c)
+{
+ ds >> c.m_name >> c.m_debugId;
+
+ int contextCount;
+ ds >> contextCount;
+
+ for (int ii = 0; ii < contextCount; ++ii) {
+ c.m_contexts.append(QDeclarativeDebugContextReference());
+ decode(ds, c.m_contexts.last());
+ }
+
+ int objectCount;
+ ds >> objectCount;
+
+ for (int ii = 0; ii < objectCount; ++ii) {
+ QDeclarativeDebugObjectReference obj;
+ decode(ds, obj, true);
+
+ obj.m_contextDebugId = c.m_debugId;
+ c.m_objects << obj;
+ }
+}
+
+void QDeclarativeEngineDebugPrivate::message(const QByteArray &data)
+{
+ QDataStream ds(data);
+
+ QByteArray type;
+ ds >> type;
+
+ //qDebug() << "QDeclarativeEngineDebugPrivate::message()" << type;
+
+ if (type == "LIST_ENGINES_R") {
+ int queryId;
+ ds >> queryId;
+
+ QDeclarativeDebugEnginesQuery *query = enginesQuery.value(queryId);
+ if (!query)
+ return;
+ enginesQuery.remove(queryId);
+
+ int count;
+ ds >> count;
+
+ for (int ii = 0; ii < count; ++ii) {
+ QDeclarativeDebugEngineReference ref;
+ ds >> ref.m_name;
+ ds >> ref.m_debugId;
+ query->m_engines << ref;
+ }
+
+ query->m_client = 0;
+ query->setState(QDeclarativeDebugQuery::Completed);
+ } else if (type == "LIST_OBJECTS_R") {
+ int queryId;
+ ds >> queryId;
+
+ QDeclarativeDebugRootContextQuery *query = rootContextQuery.value(queryId);
+ if (!query)
+ return;
+ rootContextQuery.remove(queryId);
+
+ if (!ds.atEnd())
+ decode(ds, query->m_context);
+
+ query->m_client = 0;
+ query->setState(QDeclarativeDebugQuery::Completed);
+ } else if (type == "FETCH_OBJECT_R") {
+ int queryId;
+ ds >> queryId;
+
+ QDeclarativeDebugObjectQuery *query = objectQuery.value(queryId);
+ if (!query)
+ return;
+ objectQuery.remove(queryId);
+
+ if (!ds.atEnd())
+ decode(ds, query->m_object, false);
+
+ query->m_client = 0;
+ query->setState(QDeclarativeDebugQuery::Completed);
+ } else if (type == "EVAL_EXPRESSION_R") {
+ int queryId;
+ QVariant result;
+ ds >> queryId >> result;
+
+ QDeclarativeDebugExpressionQuery *query = expressionQuery.value(queryId);
+ if (!query)
+ return;
+ expressionQuery.remove(queryId);
+
+ query->m_result = result;
+ query->m_client = 0;
+ query->setState(QDeclarativeDebugQuery::Completed);
+ } else if (type == "WATCH_PROPERTY_R") {
+ int queryId;
+ bool ok;
+ ds >> queryId >> ok;
+
+ QDeclarativeDebugWatch *watch = watched.value(queryId);
+ if (!watch)
+ return;
+
+ watch->setState(ok ? QDeclarativeDebugWatch::Active : QDeclarativeDebugWatch::Inactive);
+ } else if (type == "WATCH_OBJECT_R") {
+ int queryId;
+ bool ok;
+ ds >> queryId >> ok;
+
+ QDeclarativeDebugWatch *watch = watched.value(queryId);
+ if (!watch)
+ return;
+
+ watch->setState(ok ? QDeclarativeDebugWatch::Active : QDeclarativeDebugWatch::Inactive);
+ } else if (type == "WATCH_EXPR_OBJECT_R") {
+ int queryId;
+ bool ok;
+ ds >> queryId >> ok;
+
+ QDeclarativeDebugWatch *watch = watched.value(queryId);
+ if (!watch)
+ return;
+
+ watch->setState(ok ? QDeclarativeDebugWatch::Active : QDeclarativeDebugWatch::Inactive);
+ } else if (type == "UPDATE_WATCH") {
+ int queryId;
+ int debugId;
+ QByteArray name;
+ QVariant value;
+ ds >> queryId >> debugId >> name >> value;
+
+ QDeclarativeDebugWatch *watch = watched.value(queryId, 0);
+ if (!watch)
+ return;
+ emit watch->valueChanged(name, value);
+ }
+}
+
+QDeclarativeEngineDebug::QDeclarativeEngineDebug(QDeclarativeDebugConnection *client, QObject *parent)
+: QObject(*(new QDeclarativeEngineDebugPrivate(client)), parent)
+{
+}
+
+QDeclarativeDebugPropertyWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugPropertyReference &property, QObject *parent)
+{
+ Q_D(QDeclarativeEngineDebug);
+
+ QDeclarativeDebugPropertyWatch *watch = new QDeclarativeDebugPropertyWatch(parent);
+ if (d->client->isConnected()) {
+ int queryId = d->getId();
+ watch->m_queryId = queryId;
+ watch->m_client = this;
+ watch->m_objectDebugId = property.objectDebugId();
+ watch->m_name = property.name();
+ d->watched.insert(queryId, watch);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("WATCH_PROPERTY") << queryId << property.objectDebugId() << property.name().toUtf8();
+ d->client->sendMessage(message);
+ } else {
+ watch->m_state = QDeclarativeDebugWatch::Dead;
+ }
+
+ return watch;
+}
+
+QDeclarativeDebugWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugContextReference &, const QString &, QObject *)
+{
+ qWarning("QDeclarativeEngineDebug::addWatch(): Not implemented");
+ return 0;
+}
+
+QDeclarativeDebugObjectExpressionWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugObjectReference &object, const QString &expr, QObject *parent)
+{
+ Q_D(QDeclarativeEngineDebug);
+ QDeclarativeDebugObjectExpressionWatch *watch = new QDeclarativeDebugObjectExpressionWatch(parent);
+ if (d->client->isConnected()) {
+ int queryId = d->getId();
+ watch->m_queryId = queryId;
+ watch->m_client = this;
+ watch->m_objectDebugId = object.debugId();
+ watch->m_expr = expr;
+ d->watched.insert(queryId, watch);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("WATCH_EXPR_OBJECT") << queryId << object.debugId() << expr;
+ d->client->sendMessage(message);
+ } else {
+ watch->m_state = QDeclarativeDebugWatch::Dead;
+ }
+ return watch;
+}
+
+QDeclarativeDebugWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugObjectReference &object, QObject *parent)
+{
+ Q_D(QDeclarativeEngineDebug);
+
+ QDeclarativeDebugWatch *watch = new QDeclarativeDebugWatch(parent);
+ if (d->client->isConnected()) {
+ int queryId = d->getId();
+ watch->m_queryId = queryId;
+ watch->m_client = this;
+ watch->m_objectDebugId = object.debugId();
+ d->watched.insert(queryId, watch);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("WATCH_OBJECT") << queryId << object.debugId();
+ d->client->sendMessage(message);
+ } else {
+ watch->m_state = QDeclarativeDebugWatch::Dead;
+ }
+
+ return watch;
+}
+
+QDeclarativeDebugWatch *QDeclarativeEngineDebug::addWatch(const QDeclarativeDebugFileReference &, QObject *)
+{
+ qWarning("QDeclarativeEngineDebug::addWatch(): Not implemented");
+ return 0;
+}
+
+void QDeclarativeEngineDebug::removeWatch(QDeclarativeDebugWatch *watch)
+{
+ Q_D(QDeclarativeEngineDebug);
+
+ if (!watch || !watch->m_client)
+ return;
+
+ watch->m_client = 0;
+ watch->setState(QDeclarativeDebugWatch::Inactive);
+
+ d->watched.remove(watch->queryId());
+
+ if (d->client && d->client->isConnected()) {
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("NO_WATCH") << watch->queryId();
+ d->client->sendMessage(message);
+ }
+}
+
+QDeclarativeDebugEnginesQuery *QDeclarativeEngineDebug::queryAvailableEngines(QObject *parent)
+{
+ Q_D(QDeclarativeEngineDebug);
+
+ QDeclarativeDebugEnginesQuery *query = new QDeclarativeDebugEnginesQuery(parent);
+ if (d->client->isConnected()) {
+ query->m_client = this;
+ int queryId = d->getId();
+ query->m_queryId = queryId;
+ d->enginesQuery.insert(queryId, query);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("LIST_ENGINES") << queryId;
+ d->client->sendMessage(message);
+ } else {
+ query->m_state = QDeclarativeDebugQuery::Error;
+ }
+
+ return query;
+}
+
+QDeclarativeDebugRootContextQuery *QDeclarativeEngineDebug::queryRootContexts(const QDeclarativeDebugEngineReference &engine, QObject *parent)
+{
+ Q_D(QDeclarativeEngineDebug);
+
+ QDeclarativeDebugRootContextQuery *query = new QDeclarativeDebugRootContextQuery(parent);
+ if (d->client->isConnected() && engine.debugId() != -1) {
+ query->m_client = this;
+ int queryId = d->getId();
+ query->m_queryId = queryId;
+ d->rootContextQuery.insert(queryId, query);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("LIST_OBJECTS") << queryId << engine.debugId();
+ d->client->sendMessage(message);
+ } else {
+ query->m_state = QDeclarativeDebugQuery::Error;
+ }
+
+ return query;
+}
+
+QDeclarativeDebugObjectQuery *QDeclarativeEngineDebug::queryObject(const QDeclarativeDebugObjectReference &object, QObject *parent)
+{
+ Q_D(QDeclarativeEngineDebug);
+
+ QDeclarativeDebugObjectQuery *query = new QDeclarativeDebugObjectQuery(parent);
+ if (d->client->isConnected() && object.debugId() != -1) {
+ query->m_client = this;
+ int queryId = d->getId();
+ query->m_queryId = queryId;
+ d->objectQuery.insert(queryId, query);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId()
+ << false;
+ d->client->sendMessage(message);
+ } else {
+ query->m_state = QDeclarativeDebugQuery::Error;
+ }
+
+ return query;
+}
+
+QDeclarativeDebugObjectQuery *QDeclarativeEngineDebug::queryObjectRecursive(const QDeclarativeDebugObjectReference &object, QObject *parent)
+{
+ Q_D(QDeclarativeEngineDebug);
+
+ QDeclarativeDebugObjectQuery *query = new QDeclarativeDebugObjectQuery(parent);
+ if (d->client->isConnected() && object.debugId() != -1) {
+ query->m_client = this;
+ int queryId = d->getId();
+ query->m_queryId = queryId;
+ d->objectQuery.insert(queryId, query);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId()
+ << true;
+ d->client->sendMessage(message);
+ } else {
+ query->m_state = QDeclarativeDebugQuery::Error;
+ }
+
+ return query;
+}
+
+QDeclarativeDebugExpressionQuery *QDeclarativeEngineDebug::queryExpressionResult(int objectDebugId, const QString &expr, QObject *parent)
+{
+ Q_D(QDeclarativeEngineDebug);
+
+ QDeclarativeDebugExpressionQuery *query = new QDeclarativeDebugExpressionQuery(parent);
+ if (d->client->isConnected() && objectDebugId != -1) {
+ query->m_client = this;
+ query->m_expr = expr;
+ int queryId = d->getId();
+ query->m_queryId = queryId;
+ d->expressionQuery.insert(queryId, query);
+
+ QByteArray message;
+ QDataStream ds(&message, QIODevice::WriteOnly);
+ ds << QByteArray("EVAL_EXPRESSION") << queryId << objectDebugId << expr;
+ d->client->sendMessage(message);
+ } else {
+ query->m_state = QDeclarativeDebugQuery::Error;
+ }
+
+ return query;
+}
+
+QDeclarativeDebugWatch::QDeclarativeDebugWatch(QObject *parent)
+: QObject(parent), m_state(Waiting), m_queryId(-1), m_client(0), m_objectDebugId(-1)
+{
+}
+
+QDeclarativeDebugWatch::~QDeclarativeDebugWatch()
+{
+}
+
+int QDeclarativeDebugWatch::queryId() const
+{
+ return m_queryId;
+}
+
+int QDeclarativeDebugWatch::objectDebugId() const
+{
+ return m_objectDebugId;
+}
+
+QDeclarativeDebugWatch::State QDeclarativeDebugWatch::state() const
+{
+ return m_state;
+}
+
+void QDeclarativeDebugWatch::setState(State s)
+{
+ if (m_state == s)
+ return;
+ m_state = s;
+ emit stateChanged(m_state);
+}
+
+QDeclarativeDebugPropertyWatch::QDeclarativeDebugPropertyWatch(QObject *parent)
+ : QDeclarativeDebugWatch(parent)
+{
+}
+
+QString QDeclarativeDebugPropertyWatch::name() const
+{
+ return m_name;
+}
+
+
+QDeclarativeDebugObjectExpressionWatch::QDeclarativeDebugObjectExpressionWatch(QObject *parent)
+ : QDeclarativeDebugWatch(parent)
+{
+}
+
+QString QDeclarativeDebugObjectExpressionWatch::expression() const
+{
+ return m_expr;
+}
+
+
+QDeclarativeDebugQuery::QDeclarativeDebugQuery(QObject *parent)
+: QObject(parent), m_state(Waiting)
+{
+}
+
+QDeclarativeDebugQuery::State QDeclarativeDebugQuery::state() const
+{
+ return m_state;
+}
+
+bool QDeclarativeDebugQuery::isWaiting() const
+{
+ return m_state == Waiting;
+}
+
+void QDeclarativeDebugQuery::setState(State s)
+{
+ if (m_state == s)
+ return;
+ m_state = s;
+ emit stateChanged(m_state);
+}
+
+QDeclarativeDebugEnginesQuery::QDeclarativeDebugEnginesQuery(QObject *parent)
+: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1)
+{
+}
+
+QDeclarativeDebugEnginesQuery::~QDeclarativeDebugEnginesQuery()
+{
+ if (m_client && m_queryId != -1)
+ QDeclarativeEngineDebugPrivate::remove(m_client, this);
+}
+
+QList<QDeclarativeDebugEngineReference> QDeclarativeDebugEnginesQuery::engines() const
+{
+ return m_engines;
+}
+
+QDeclarativeDebugRootContextQuery::QDeclarativeDebugRootContextQuery(QObject *parent)
+: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1)
+{
+}
+
+QDeclarativeDebugRootContextQuery::~QDeclarativeDebugRootContextQuery()
+{
+ if (m_client && m_queryId != -1)
+ QDeclarativeEngineDebugPrivate::remove(m_client, this);
+}
+
+QDeclarativeDebugContextReference QDeclarativeDebugRootContextQuery::rootContext() const
+{
+ return m_context;
+}
+
+QDeclarativeDebugObjectQuery::QDeclarativeDebugObjectQuery(QObject *parent)
+: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1)
+{
+}
+
+QDeclarativeDebugObjectQuery::~QDeclarativeDebugObjectQuery()
+{
+ if (m_client && m_queryId != -1)
+ QDeclarativeEngineDebugPrivate::remove(m_client, this);
+}
+
+QDeclarativeDebugObjectReference QDeclarativeDebugObjectQuery::object() const
+{
+ return m_object;
+}
+
+QDeclarativeDebugExpressionQuery::QDeclarativeDebugExpressionQuery(QObject *parent)
+: QDeclarativeDebugQuery(parent), m_client(0), m_queryId(-1)
+{
+}
+
+QDeclarativeDebugExpressionQuery::~QDeclarativeDebugExpressionQuery()
+{
+ if (m_client && m_queryId != -1)
+ QDeclarativeEngineDebugPrivate::remove(m_client, this);
+}
+
+QString QDeclarativeDebugExpressionQuery::expression() const
+{
+ return m_expr;
+}
+
+QVariant QDeclarativeDebugExpressionQuery::result() const
+{
+ return m_result;
+}
+
+QDeclarativeDebugEngineReference::QDeclarativeDebugEngineReference()
+: m_debugId(-1)
+{
+}
+
+QDeclarativeDebugEngineReference::QDeclarativeDebugEngineReference(int debugId)
+: m_debugId(debugId)
+{
+}
+
+QDeclarativeDebugEngineReference::QDeclarativeDebugEngineReference(const QDeclarativeDebugEngineReference &o)
+: m_debugId(o.m_debugId), m_name(o.m_name)
+{
+}
+
+QDeclarativeDebugEngineReference &
+QDeclarativeDebugEngineReference::operator=(const QDeclarativeDebugEngineReference &o)
+{
+ m_debugId = o.m_debugId; m_name = o.m_name;
+ return *this;
+}
+
+int QDeclarativeDebugEngineReference::debugId() const
+{
+ return m_debugId;
+}
+
+QString QDeclarativeDebugEngineReference::name() const
+{
+ return m_name;
+}
+
+QDeclarativeDebugObjectReference::QDeclarativeDebugObjectReference()
+: m_debugId(-1), m_contextDebugId(-1)
+{
+}
+
+QDeclarativeDebugObjectReference::QDeclarativeDebugObjectReference(int debugId)
+: m_debugId(debugId), m_contextDebugId(-1)
+{
+}
+
+QDeclarativeDebugObjectReference::QDeclarativeDebugObjectReference(const QDeclarativeDebugObjectReference &o)
+: m_debugId(o.m_debugId), m_class(o.m_class), m_name(o.m_name),
+ m_source(o.m_source), m_contextDebugId(o.m_contextDebugId),
+ m_properties(o.m_properties), m_children(o.m_children)
+{
+}
+
+QDeclarativeDebugObjectReference &
+QDeclarativeDebugObjectReference::operator=(const QDeclarativeDebugObjectReference &o)
+{
+ m_debugId = o.m_debugId; m_class = o.m_class; m_name = o.m_name;
+ m_source = o.m_source; m_contextDebugId = o.m_contextDebugId;
+ m_properties = o.m_properties; m_children = o.m_children;
+ return *this;
+}
+
+int QDeclarativeDebugObjectReference::debugId() const
+{
+ return m_debugId;
+}
+
+QString QDeclarativeDebugObjectReference::className() const
+{
+ return m_class;
+}
+
+QString QDeclarativeDebugObjectReference::name() const
+{
+ return m_name;
+}
+
+QDeclarativeDebugFileReference QDeclarativeDebugObjectReference::source() const
+{
+ return m_source;
+}
+
+int QDeclarativeDebugObjectReference::contextDebugId() const
+{
+ return m_contextDebugId;
+}
+
+QList<QDeclarativeDebugPropertyReference> QDeclarativeDebugObjectReference::properties() const
+{
+ return m_properties;
+}
+
+QList<QDeclarativeDebugObjectReference> QDeclarativeDebugObjectReference::children() const
+{
+ return m_children;
+}
+
+QDeclarativeDebugContextReference::QDeclarativeDebugContextReference()
+: m_debugId(-1)
+{
+}
+
+QDeclarativeDebugContextReference::QDeclarativeDebugContextReference(const QDeclarativeDebugContextReference &o)
+: m_debugId(o.m_debugId), m_name(o.m_name), m_objects(o.m_objects), m_contexts(o.m_contexts)
+{
+}
+
+QDeclarativeDebugContextReference &QDeclarativeDebugContextReference::operator=(const QDeclarativeDebugContextReference &o)
+{
+ m_debugId = o.m_debugId; m_name = o.m_name; m_objects = o.m_objects;
+ m_contexts = o.m_contexts;
+ return *this;
+}
+
+int QDeclarativeDebugContextReference::debugId() const
+{
+ return m_debugId;
+}
+
+QString QDeclarativeDebugContextReference::name() const
+{
+ return m_name;
+}
+
+QList<QDeclarativeDebugObjectReference> QDeclarativeDebugContextReference::objects() const
+{
+ return m_objects;
+}
+
+QList<QDeclarativeDebugContextReference> QDeclarativeDebugContextReference::contexts() const
+{
+ return m_contexts;
+}
+
+QDeclarativeDebugFileReference::QDeclarativeDebugFileReference()
+: m_lineNumber(-1), m_columnNumber(-1)
+{
+}
+
+QDeclarativeDebugFileReference::QDeclarativeDebugFileReference(const QDeclarativeDebugFileReference &o)
+: m_url(o.m_url), m_lineNumber(o.m_lineNumber), m_columnNumber(o.m_columnNumber)
+{
+}
+
+QDeclarativeDebugFileReference &QDeclarativeDebugFileReference::operator=(const QDeclarativeDebugFileReference &o)
+{
+ m_url = o.m_url; m_lineNumber = o.m_lineNumber; m_columnNumber = o.m_columnNumber;
+ return *this;
+}
+
+QUrl QDeclarativeDebugFileReference::url() const
+{
+ return m_url;
+}
+
+void QDeclarativeDebugFileReference::setUrl(const QUrl &u)
+{
+ m_url = u;
+}
+
+int QDeclarativeDebugFileReference::lineNumber() const
+{
+ return m_lineNumber;
+}
+
+void QDeclarativeDebugFileReference::setLineNumber(int l)
+{
+ m_lineNumber = l;
+}
+
+int QDeclarativeDebugFileReference::columnNumber() const
+{
+ return m_columnNumber;
+}
+
+void QDeclarativeDebugFileReference::setColumnNumber(int c)
+{
+ m_columnNumber = c;
+}
+
+QDeclarativeDebugPropertyReference::QDeclarativeDebugPropertyReference()
+: m_objectDebugId(-1), m_hasNotifySignal(false)
+{
+}
+
+QDeclarativeDebugPropertyReference::QDeclarativeDebugPropertyReference(const QDeclarativeDebugPropertyReference &o)
+: m_objectDebugId(o.m_objectDebugId), m_name(o.m_name), m_value(o.m_value),
+ m_valueTypeName(o.m_valueTypeName), m_binding(o.m_binding),
+ m_hasNotifySignal(o.m_hasNotifySignal)
+{
+}
+
+QDeclarativeDebugPropertyReference &QDeclarativeDebugPropertyReference::operator=(const QDeclarativeDebugPropertyReference &o)
+{
+ m_objectDebugId = o.m_objectDebugId; m_name = o.m_name; m_value = o.m_value;
+ m_valueTypeName = o.m_valueTypeName; m_binding = o.m_binding;
+ m_hasNotifySignal = o.m_hasNotifySignal;
+ return *this;
+}
+
+int QDeclarativeDebugPropertyReference::objectDebugId() const
+{
+ return m_objectDebugId;
+}
+
+QString QDeclarativeDebugPropertyReference::name() const
+{
+ return m_name;
+}
+
+QString QDeclarativeDebugPropertyReference::valueTypeName() const
+{
+ return m_valueTypeName;
+}
+
+QVariant QDeclarativeDebugPropertyReference::value() const
+{
+ return m_value;
+}
+
+QString QDeclarativeDebugPropertyReference::binding() const
+{
+ return m_binding;
+}
+
+bool QDeclarativeDebugPropertyReference::hasNotifySignal() const
+{
+ return m_hasNotifySignal;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/declarative/debugger/qdeclarativedebug_p.h b/src/declarative/debugger/qdeclarativedebug_p.h
new file mode 100644
index 0000000..f0c7a77
--- /dev/null
+++ b/src/declarative/debugger/qdeclarativedebug_p.h
@@ -0,0 +1,371 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVEDEBUG_H
+#define QDECLARATIVEDEBUG_H
+
+#include <QtCore/qobject.h>
+#include <QtCore/qurl.h>
+#include <QtCore/qvariant.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class QDeclarativeDebugConnection;
+class QDeclarativeDebugWatch;
+class QDeclarativeDebugPropertyWatch;
+class QDeclarativeDebugObjectExpressionWatch;
+class QDeclarativeDebugEnginesQuery;
+class QDeclarativeDebugRootContextQuery;
+class QDeclarativeDebugObjectQuery;
+class QDeclarativeDebugExpressionQuery;
+class QDeclarativeDebugPropertyReference;
+class QDeclarativeDebugContextReference;
+class QDeclarativeDebugObjectReference;
+class QDeclarativeDebugFileReference;
+class QDeclarativeDebugEngineReference;
+class QDeclarativeEngineDebugPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeEngineDebug : public QObject
+{
+Q_OBJECT
+public:
+ QDeclarativeEngineDebug(QDeclarativeDebugConnection *, QObject * = 0);
+
+ QDeclarativeDebugPropertyWatch *addWatch(const QDeclarativeDebugPropertyReference &,
+ QObject *parent = 0);
+ QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugContextReference &, const QString &,
+ QObject *parent = 0);
+ QDeclarativeDebugObjectExpressionWatch *addWatch(const QDeclarativeDebugObjectReference &, const QString &,
+ QObject *parent = 0);
+ QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugObjectReference &,
+ QObject *parent = 0);
+ QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugFileReference &,
+ QObject *parent = 0);
+
+ void removeWatch(QDeclarativeDebugWatch *watch);
+
+ QDeclarativeDebugEnginesQuery *queryAvailableEngines(QObject *parent = 0);
+ QDeclarativeDebugRootContextQuery *queryRootContexts(const QDeclarativeDebugEngineReference &,
+ QObject *parent = 0);
+ QDeclarativeDebugObjectQuery *queryObject(const QDeclarativeDebugObjectReference &,
+ QObject *parent = 0);
+ QDeclarativeDebugObjectQuery *queryObjectRecursive(const QDeclarativeDebugObjectReference &,
+ QObject *parent = 0);
+ QDeclarativeDebugExpressionQuery *queryExpressionResult(int objectDebugId,
+ const QString &expr,
+ QObject *parent = 0);
+
+private:
+ Q_DECLARE_PRIVATE(QDeclarativeEngineDebug)
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugWatch : public QObject
+{
+Q_OBJECT
+public:
+ enum State { Waiting, Active, Inactive, Dead };
+
+ QDeclarativeDebugWatch(QObject *);
+ ~QDeclarativeDebugWatch();
+
+ int queryId() const;
+ int objectDebugId() const;
+ State state() const;
+
+Q_SIGNALS:
+ void stateChanged(QDeclarativeDebugWatch::State);
+ //void objectChanged(int, const QDeclarativeDebugObjectReference &);
+ //void valueChanged(int, const QVariant &);
+
+ // Server sends value as string if it is a user-type variant
+ void valueChanged(const QByteArray &name, const QVariant &value);
+
+private:
+ friend class QDeclarativeEngineDebug;
+ friend class QDeclarativeEngineDebugPrivate;
+ void setState(State);
+ State m_state;
+ int m_queryId;
+ QDeclarativeEngineDebug *m_client;
+ int m_objectDebugId;
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugPropertyWatch : public QDeclarativeDebugWatch
+{
+ Q_OBJECT
+public:
+ QDeclarativeDebugPropertyWatch(QObject *parent);
+
+ QString name() const;
+
+private:
+ friend class QDeclarativeEngineDebug;
+ QString m_name;
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugObjectExpressionWatch : public QDeclarativeDebugWatch
+{
+ Q_OBJECT
+public:
+ QDeclarativeDebugObjectExpressionWatch(QObject *parent);
+
+ QString expression() const;
+
+private:
+ friend class QDeclarativeEngineDebug;
+ QString m_expr;
+ int m_debugId;
+};
+
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugQuery : public QObject
+{
+Q_OBJECT
+public:
+ enum State { Waiting, Error, Completed };
+
+ State state() const;
+ bool isWaiting() const;
+
+// bool waitUntilCompleted();
+
+Q_SIGNALS:
+ void stateChanged(QDeclarativeDebugQuery::State);
+
+protected:
+ QDeclarativeDebugQuery(QObject *);
+
+private:
+ friend class QDeclarativeEngineDebug;
+ friend class QDeclarativeEngineDebugPrivate;
+ void setState(State);
+ State m_state;
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugFileReference
+{
+public:
+ QDeclarativeDebugFileReference();
+ QDeclarativeDebugFileReference(const QDeclarativeDebugFileReference &);
+ QDeclarativeDebugFileReference &operator=(const QDeclarativeDebugFileReference &);
+
+ QUrl url() const;
+ void setUrl(const QUrl &);
+ int lineNumber() const;
+ void setLineNumber(int);
+ int columnNumber() const;
+ void setColumnNumber(int);
+
+private:
+ friend class QDeclarativeEngineDebugPrivate;
+ QUrl m_url;
+ int m_lineNumber;
+ int m_columnNumber;
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugEngineReference
+{
+public:
+ QDeclarativeDebugEngineReference();
+ QDeclarativeDebugEngineReference(int);
+ QDeclarativeDebugEngineReference(const QDeclarativeDebugEngineReference &);
+ QDeclarativeDebugEngineReference &operator=(const QDeclarativeDebugEngineReference &);
+
+ int debugId() const;
+ QString name() const;
+
+private:
+ friend class QDeclarativeEngineDebugPrivate;
+ int m_debugId;
+ QString m_name;
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugObjectReference
+{
+public:
+ QDeclarativeDebugObjectReference();
+ QDeclarativeDebugObjectReference(int);
+ QDeclarativeDebugObjectReference(const QDeclarativeDebugObjectReference &);
+ QDeclarativeDebugObjectReference &operator=(const QDeclarativeDebugObjectReference &);
+
+ int debugId() const;
+ QString className() const;
+ QString name() const;
+
+ QDeclarativeDebugFileReference source() const;
+ int contextDebugId() const;
+
+ QList<QDeclarativeDebugPropertyReference> properties() const;
+ QList<QDeclarativeDebugObjectReference> children() const;
+
+private:
+ friend class QDeclarativeEngineDebugPrivate;
+ int m_debugId;
+ QString m_class;
+ QString m_name;
+ QDeclarativeDebugFileReference m_source;
+ int m_contextDebugId;
+ QList<QDeclarativeDebugPropertyReference> m_properties;
+ QList<QDeclarativeDebugObjectReference> m_children;
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugContextReference
+{
+public:
+ QDeclarativeDebugContextReference();
+ QDeclarativeDebugContextReference(const QDeclarativeDebugContextReference &);
+ QDeclarativeDebugContextReference &operator=(const QDeclarativeDebugContextReference &);
+
+ int debugId() const;
+ QString name() const;
+
+ QList<QDeclarativeDebugObjectReference> objects() const;
+ QList<QDeclarativeDebugContextReference> contexts() const;
+
+private:
+ friend class QDeclarativeEngineDebugPrivate;
+ int m_debugId;
+ QString m_name;
+ QList<QDeclarativeDebugObjectReference> m_objects;
+ QList<QDeclarativeDebugContextReference> m_contexts;
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugPropertyReference
+{
+public:
+ QDeclarativeDebugPropertyReference();
+ QDeclarativeDebugPropertyReference(const QDeclarativeDebugPropertyReference &);
+ QDeclarativeDebugPropertyReference &operator=(const QDeclarativeDebugPropertyReference &);
+
+ int objectDebugId() const;
+ QString name() const;
+ QVariant value() const;
+ QString valueTypeName() const;
+ QString binding() const;
+ bool hasNotifySignal() const;
+
+private:
+ friend class QDeclarativeEngineDebugPrivate;
+ int m_objectDebugId;
+ QString m_name;
+ QVariant m_value;
+ QString m_valueTypeName;
+ QString m_binding;
+ bool m_hasNotifySignal;
+};
+
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugEnginesQuery : public QDeclarativeDebugQuery
+{
+Q_OBJECT
+public:
+ virtual ~QDeclarativeDebugEnginesQuery();
+ QList<QDeclarativeDebugEngineReference> engines() const;
+private:
+ friend class QDeclarativeEngineDebug;
+ friend class QDeclarativeEngineDebugPrivate;
+ QDeclarativeDebugEnginesQuery(QObject *);
+ QDeclarativeEngineDebug *m_client;
+ int m_queryId;
+ QList<QDeclarativeDebugEngineReference> m_engines;
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugRootContextQuery : public QDeclarativeDebugQuery
+{
+Q_OBJECT
+public:
+ virtual ~QDeclarativeDebugRootContextQuery();
+ QDeclarativeDebugContextReference rootContext() const;
+private:
+ friend class QDeclarativeEngineDebug;
+ friend class QDeclarativeEngineDebugPrivate;
+ QDeclarativeDebugRootContextQuery(QObject *);
+ QDeclarativeEngineDebug *m_client;
+ int m_queryId;
+ QDeclarativeDebugContextReference m_context;
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugObjectQuery : public QDeclarativeDebugQuery
+{
+Q_OBJECT
+public:
+ virtual ~QDeclarativeDebugObjectQuery();
+ QDeclarativeDebugObjectReference object() const;
+private:
+ friend class QDeclarativeEngineDebug;
+ friend class QDeclarativeEngineDebugPrivate;
+ QDeclarativeDebugObjectQuery(QObject *);
+ QDeclarativeEngineDebug *m_client;
+ int m_queryId;
+ QDeclarativeDebugObjectReference m_object;
+
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugExpressionQuery : public QDeclarativeDebugQuery
+{
+Q_OBJECT
+public:
+ virtual ~QDeclarativeDebugExpressionQuery();
+ QString expression() const;
+ QVariant result() const;
+private:
+ friend class QDeclarativeEngineDebug;
+ friend class QDeclarativeEngineDebugPrivate;
+ QDeclarativeDebugExpressionQuery(QObject *);
+ QDeclarativeEngineDebug *m_client;
+ int m_queryId;
+ QString m_expr;
+ QVariant m_result;
+
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QDeclarativeDebugEngineReference)
+Q_DECLARE_METATYPE(QDeclarativeDebugObjectReference)
+Q_DECLARE_METATYPE(QDeclarativeDebugContextReference)
+Q_DECLARE_METATYPE(QDeclarativeDebugPropertyReference)
+
+QT_END_HEADER
+
+#endif // QDECLARATIVEDEBUG_H
diff --git a/src/declarative/debugger/qmldebugclient.cpp b/src/declarative/debugger/qdeclarativedebugclient.cpp
index ae42b5b..c23e32f 100644
--- a/src/declarative/debugger/qmldebugclient.cpp
+++ b/src/declarative/debugger/qdeclarativedebugclient.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmldebugclient_p.h"
+#include "qdeclarativedebugclient_p.h"
#include "qpacketprotocol_p.h"
@@ -50,22 +50,22 @@
QT_BEGIN_NAMESPACE
-class QmlDebugConnectionPrivate : public QObject
+class QDeclarativeDebugConnectionPrivate : public QObject
{
Q_OBJECT
public:
- QmlDebugConnectionPrivate(QmlDebugConnection *c);
- QmlDebugConnection *q;
+ QDeclarativeDebugConnectionPrivate(QDeclarativeDebugConnection *c);
+ QDeclarativeDebugConnection *q;
QPacketProtocol *protocol;
QStringList enabled;
- QHash<QString, QmlDebugClient *> plugins;
+ QHash<QString, QDeclarativeDebugClient *> plugins;
public Q_SLOTS:
void connected();
void readyRead();
};
-QmlDebugConnectionPrivate::QmlDebugConnectionPrivate(QmlDebugConnection *c)
+QDeclarativeDebugConnectionPrivate::QDeclarativeDebugConnectionPrivate(QDeclarativeDebugConnection *c)
: QObject(c), q(c), protocol(0)
{
protocol = new QPacketProtocol(q, this);
@@ -73,59 +73,59 @@ QmlDebugConnectionPrivate::QmlDebugConnectionPrivate(QmlDebugConnection *c)
QObject::connect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
}
-void QmlDebugConnectionPrivate::connected()
+void QDeclarativeDebugConnectionPrivate::connected()
{
QPacket pack;
- pack << QString(QLatin1String("QmlDebugServer")) << enabled;
+ pack << QString(QLatin1String("QDeclarativeDebugServer")) << enabled;
protocol->send(pack);
}
-void QmlDebugConnectionPrivate::readyRead()
+void QDeclarativeDebugConnectionPrivate::readyRead()
{
QPacket pack = protocol->read();
QString name; QByteArray message;
pack >> name >> message;
- QHash<QString, QmlDebugClient *>::Iterator iter =
+ QHash<QString, QDeclarativeDebugClient *>::Iterator iter =
plugins.find(name);
if (iter == plugins.end()) {
- qWarning() << "QmlDebugConnection: Message received for missing plugin" << name;
+ qWarning() << "QDeclarativeDebugConnection: Message received for missing plugin" << name;
} else {
(*iter)->messageReceived(message);
}
}
-QmlDebugConnection::QmlDebugConnection(QObject *parent)
-: QTcpSocket(parent), d(new QmlDebugConnectionPrivate(this))
+QDeclarativeDebugConnection::QDeclarativeDebugConnection(QObject *parent)
+: QTcpSocket(parent), d(new QDeclarativeDebugConnectionPrivate(this))
{
}
-bool QmlDebugConnection::isConnected() const
+bool QDeclarativeDebugConnection::isConnected() const
{
return state() == ConnectedState;
}
-class QmlDebugClientPrivate : public QObjectPrivate
+class QDeclarativeDebugClientPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlDebugClient)
+ Q_DECLARE_PUBLIC(QDeclarativeDebugClient)
public:
- QmlDebugClientPrivate();
+ QDeclarativeDebugClientPrivate();
QString name;
- QmlDebugConnection *client;
+ QDeclarativeDebugConnection *client;
bool enabled;
};
-QmlDebugClientPrivate::QmlDebugClientPrivate()
+QDeclarativeDebugClientPrivate::QDeclarativeDebugClientPrivate()
: client(0), enabled(false)
{
}
-QmlDebugClient::QmlDebugClient(const QString &name,
- QmlDebugConnection *parent)
-: QObject(*(new QmlDebugClientPrivate), parent)
+QDeclarativeDebugClient::QDeclarativeDebugClient(const QString &name,
+ QDeclarativeDebugConnection *parent)
+: QObject(*(new QDeclarativeDebugClientPrivate), parent)
{
- Q_D(QmlDebugClient);
+ Q_D(QDeclarativeDebugClient);
d->name = name;
d->client = parent;
@@ -133,28 +133,28 @@ QmlDebugClient::QmlDebugClient(const QString &name,
return;
if (d->client->d->plugins.contains(name)) {
- qWarning() << "QmlDebugClient: Conflicting plugin name" << name;
+ qWarning() << "QDeclarativeDebugClient: Conflicting plugin name" << name;
d->client = 0;
} else {
d->client->d->plugins.insert(name, this);
}
}
-QString QmlDebugClient::name() const
+QString QDeclarativeDebugClient::name() const
{
- Q_D(const QmlDebugClient);
+ Q_D(const QDeclarativeDebugClient);
return d->name;
}
-bool QmlDebugClient::isEnabled() const
+bool QDeclarativeDebugClient::isEnabled() const
{
- Q_D(const QmlDebugClient);
+ Q_D(const QDeclarativeDebugClient);
return d->enabled;
}
-void QmlDebugClient::setEnabled(bool e)
+void QDeclarativeDebugClient::setEnabled(bool e)
{
- Q_D(QmlDebugClient);
+ Q_D(QDeclarativeDebugClient);
if (e == d->enabled)
return;
@@ -168,7 +168,7 @@ void QmlDebugClient::setEnabled(bool e)
if (d->client->state() == QTcpSocket::ConnectedState) {
QPacket pack;
- pack << QString(QLatin1String("QmlDebugServer"));
+ pack << QString(QLatin1String("QDeclarativeDebugServer"));
if (e) pack << (int)1;
else pack << (int)2;
pack << d->name;
@@ -177,18 +177,18 @@ void QmlDebugClient::setEnabled(bool e)
}
}
-bool QmlDebugClient::isConnected() const
+bool QDeclarativeDebugClient::isConnected() const
{
- Q_D(const QmlDebugClient);
+ Q_D(const QDeclarativeDebugClient);
if (!d->client)
return false;
return d->client->isConnected();
}
-void QmlDebugClient::sendMessage(const QByteArray &message)
+void QDeclarativeDebugClient::sendMessage(const QByteArray &message)
{
- Q_D(QmlDebugClient);
+ Q_D(QDeclarativeDebugClient);
if (!d->client || !d->client->isConnected())
return;
@@ -198,10 +198,10 @@ void QmlDebugClient::sendMessage(const QByteArray &message)
d->client->d->protocol->send(pack);
}
-void QmlDebugClient::messageReceived(const QByteArray &)
+void QDeclarativeDebugClient::messageReceived(const QByteArray &)
{
}
QT_END_NAMESPACE
-#include <qmldebugclient.moc>
+#include <qdeclarativedebugclient.moc>
diff --git a/src/declarative/debugger/qmldebugclient_p.h b/src/declarative/debugger/qdeclarativedebugclient_p.h
index c3e6eff..4144a66 100644
--- a/src/declarative/debugger/qmldebugclient_p.h
+++ b/src/declarative/debugger/qdeclarativedebugclient_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLDEBUGCLIENT_H
-#define QMLDEBUGCLIENT_H
+#ifndef QDECLARATIVEDEBUGCLIENT_H
+#define QDECLARATIVEDEBUGCLIENT_H
#include <QtNetwork/qtcpsocket.h>
@@ -50,30 +50,30 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlDebugConnectionPrivate;
-class Q_DECLARATIVE_EXPORT QmlDebugConnection : public QTcpSocket
+class QDeclarativeDebugConnectionPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugConnection : public QTcpSocket
{
Q_OBJECT
- Q_DISABLE_COPY(QmlDebugConnection)
+ Q_DISABLE_COPY(QDeclarativeDebugConnection)
public:
- QmlDebugConnection(QObject * = 0);
+ QDeclarativeDebugConnection(QObject * = 0);
bool isConnected() const;
private:
- QmlDebugConnectionPrivate *d;
- friend class QmlDebugClient;
- friend class QmlDebugClientPrivate;
+ QDeclarativeDebugConnectionPrivate *d;
+ friend class QDeclarativeDebugClient;
+ friend class QDeclarativeDebugClientPrivate;
};
-class QmlDebugClientPrivate;
-class Q_DECLARATIVE_EXPORT QmlDebugClient : public QObject
+class QDeclarativeDebugClientPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugClient : public QObject
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlDebugClient)
- Q_DISABLE_COPY(QmlDebugClient)
+ Q_DECLARE_PRIVATE(QDeclarativeDebugClient)
+ Q_DISABLE_COPY(QDeclarativeDebugClient)
public:
- QmlDebugClient(const QString &, QmlDebugConnection *parent);
+ QDeclarativeDebugClient(const QString &, QDeclarativeDebugConnection *parent);
QString name() const;
@@ -88,12 +88,12 @@ protected:
virtual void messageReceived(const QByteArray &);
private:
- friend class QmlDebugConnection;
- friend class QmlDebugConnectionPrivate;
+ friend class QDeclarativeDebugConnection;
+ friend class QDeclarativeDebugConnectionPrivate;
};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLDEBUGCLIENT_H
+#endif // QDECLARATIVEDEBUGCLIENT_H
diff --git a/src/declarative/debugger/qmldebuggerstatus.cpp b/src/declarative/debugger/qdeclarativedebuggerstatus.cpp
index 0f2a973..5908628 100644
--- a/src/declarative/debugger/qmldebuggerstatus.cpp
+++ b/src/declarative/debugger/qdeclarativedebuggerstatus.cpp
@@ -39,15 +39,15 @@
**
****************************************************************************/
-#include "qmldebuggerstatus_p.h"
+#include "qdeclarativedebuggerstatus_p.h"
QT_BEGIN_NAMESPACE
-QmlDebuggerStatus::~QmlDebuggerStatus()
+QDeclarativeDebuggerStatus::~QDeclarativeDebuggerStatus()
{
}
-void QmlDebuggerStatus::setSelectedState(bool)
+void QDeclarativeDebuggerStatus::setSelectedState(bool)
{
}
diff --git a/src/declarative/debugger/qmldebuggerstatus_p.h b/src/declarative/debugger/qdeclarativedebuggerstatus_p.h
index 42538f3..a3ba40a 100644
--- a/src/declarative/debugger/qmldebuggerstatus_p.h
+++ b/src/declarative/debugger/qdeclarativedebuggerstatus_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLDEBUGGERSTATUS_P_H
-#define QMLDEBUGGERSTATUS_P_H
+#ifndef QDECLARATIVEDEBUGGERSTATUS_P_H
+#define QDECLARATIVEDEBUGGERSTATUS_P_H
#include <QtCore/qobject.h>
@@ -50,14 +50,14 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class Q_DECLARATIVE_EXPORT QmlDebuggerStatus
+class Q_DECLARATIVE_EXPORT QDeclarativeDebuggerStatus
{
public:
- virtual ~QmlDebuggerStatus();
+ virtual ~QDeclarativeDebuggerStatus();
virtual void setSelectedState(bool);
};
-Q_DECLARE_INTERFACE(QmlDebuggerStatus, "com.trolltech.qml.QmlDebuggerStatus")
+Q_DECLARE_INTERFACE(QDeclarativeDebuggerStatus, "com.trolltech.qml.QDeclarativeDebuggerStatus")
QT_END_NAMESPACE
diff --git a/src/declarative/debugger/qmldebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp
index 7b21869..d9bbdb5 100644
--- a/src/declarative/debugger/qmldebugservice.cpp
+++ b/src/declarative/debugger/qdeclarativedebugservice.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmldebugservice_p.h"
+#include "qdeclarativedebugservice_p.h"
#include "qpacketprotocol_p.h"
@@ -52,14 +52,14 @@
QT_BEGIN_NAMESPACE
-class QmlDebugServerPrivate;
-class QmlDebugServer : public QObject
+class QDeclarativeDebugServerPrivate;
+class QDeclarativeDebugServer : public QObject
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlDebugServer)
- Q_DISABLE_COPY(QmlDebugServer)
+ Q_DECLARE_PRIVATE(QDeclarativeDebugServer)
+ Q_DISABLE_COPY(QDeclarativeDebugServer)
public:
- static QmlDebugServer *instance();
+ static QDeclarativeDebugServer *instance();
void wait();
void registerForStartNotification(QObject *object, const char *receiver);
@@ -68,63 +68,63 @@ private Q_SLOTS:
void registeredObjectDestroyed(QObject *object);
private:
- friend class QmlDebugService;
- friend class QmlDebugServicePrivate;
- QmlDebugServer(int);
+ friend class QDeclarativeDebugService;
+ friend class QDeclarativeDebugServicePrivate;
+ QDeclarativeDebugServer(int);
};
-class QmlDebugServerPrivate : public QObjectPrivate
+class QDeclarativeDebugServerPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlDebugServer)
+ Q_DECLARE_PUBLIC(QDeclarativeDebugServer)
public:
- QmlDebugServerPrivate();
+ QDeclarativeDebugServerPrivate();
void wait();
int port;
QTcpSocket *connection;
QPacketProtocol *protocol;
- QHash<QString, QmlDebugService *> plugins;
+ QHash<QString, QDeclarativeDebugService *> plugins;
QStringList enabledPlugins;
QList<QPair<QObject*, QByteArray> > notifyClients;
};
-class QmlDebugServicePrivate : public QObjectPrivate
+class QDeclarativeDebugServicePrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlDebugService)
+ Q_DECLARE_PUBLIC(QDeclarativeDebugService)
public:
- QmlDebugServicePrivate();
+ QDeclarativeDebugServicePrivate();
QString name;
- QmlDebugServer *server;
+ QDeclarativeDebugServer *server;
};
-QmlDebugServerPrivate::QmlDebugServerPrivate()
+QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate()
: connection(0), protocol(0)
{
}
-void QmlDebugServerPrivate::wait()
+void QDeclarativeDebugServerPrivate::wait()
{
- Q_Q(QmlDebugServer);
+ Q_Q(QDeclarativeDebugServer);
QTcpServer server;
if (!server.listen(QHostAddress::Any, port)) {
- qWarning("QmlDebugServer: Unable to listen on port %d", port);
+ qWarning("QDeclarativeDebugServer: Unable to listen on port %d", port);
return;
}
- qWarning("QmlDebugServer: Waiting for connection on port %d...", port);
+ qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", port);
for (int i=0; i<notifyClients.count(); i++) {
if (!QMetaObject::invokeMethod(notifyClients[i].first, notifyClients[i].second)) {
- qWarning() << "QmlDebugServer: unable to call method" << notifyClients[i].second
+ qWarning() << "QDeclarativeDebugServer: unable to call method" << notifyClients[i].second
<< "on object" << notifyClients[i].first << "to notify of debug server start";
}
}
notifyClients.clear();
if (!server.waitForNewConnection(-1)) {
- qWarning("QmlDebugServer: Connection error");
+ qWarning("QDeclarativeDebugServer: Connection error");
return;
}
@@ -139,8 +139,8 @@ void QmlDebugServerPrivate::wait()
QPacket hello = protocol->read();
QString name;
hello >> name >> enabledPlugins;
- if (name != QLatin1String("QmlDebugServer")) {
- qWarning("QmlDebugServer: Invalid hello message");
+ if (name != QLatin1String("QDeclarativeDebugServer")) {
+ qWarning("QDeclarativeDebugServer: Invalid hello message");
delete protocol; delete connection; connection = 0; protocol = 0;
return;
}
@@ -148,13 +148,13 @@ void QmlDebugServerPrivate::wait()
QObject::connect(protocol, SIGNAL(readyRead()), q, SLOT(readyRead()));
q->readyRead();
- qWarning("QmlDebugServer: Connection established");
+ qWarning("QDeclarativeDebugServer: Connection established");
}
-QmlDebugServer *QmlDebugServer::instance()
+QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
{
static bool envTested = false;
- static QmlDebugServer *server = 0;
+ static QDeclarativeDebugServer *server = 0;
if (!envTested) {
envTested = true;
@@ -164,28 +164,28 @@ QmlDebugServer *QmlDebugServer::instance()
int port = env.toInt(&ok);
if (ok && port > 1024)
- server = new QmlDebugServer(port);
+ server = new QDeclarativeDebugServer(port);
}
return server;
}
-void QmlDebugServer::wait()
+void QDeclarativeDebugServer::wait()
{
- Q_D(QmlDebugServer);
+ Q_D(QDeclarativeDebugServer);
d->wait();
}
-void QmlDebugServer::registerForStartNotification(QObject *object, const char *methodName)
+void QDeclarativeDebugServer::registerForStartNotification(QObject *object, const char *methodName)
{
- Q_D(QmlDebugServer);
+ Q_D(QDeclarativeDebugServer);
connect(object, SIGNAL(destroyed(QObject*)), SLOT(registeredObjectDestroyed(QObject*)));
d->notifyClients.append(qMakePair(object, QByteArray(methodName)));
}
-void QmlDebugServer::registeredObjectDestroyed(QObject *object)
+void QDeclarativeDebugServer::registeredObjectDestroyed(QObject *object)
{
- Q_D(QmlDebugServer);
+ Q_D(QDeclarativeDebugServer);
QMutableListIterator<QPair<QObject*, QByteArray> > i(d->notifyClients);
while (i.hasNext()) {
if (i.next().first == object)
@@ -193,18 +193,18 @@ void QmlDebugServer::registeredObjectDestroyed(QObject *object)
}
}
-QmlDebugServer::QmlDebugServer(int port)
-: QObject(*(new QmlDebugServerPrivate))
+QDeclarativeDebugServer::QDeclarativeDebugServer(int port)
+: QObject(*(new QDeclarativeDebugServerPrivate))
{
- Q_D(QmlDebugServer);
+ Q_D(QDeclarativeDebugServer);
d->port = port;
}
-void QmlDebugServer::readyRead()
+void QDeclarativeDebugServer::readyRead()
{
- Q_D(QmlDebugServer);
+ Q_D(QDeclarativeDebugServer);
- QString debugServer(QLatin1String("QmlDebugServer"));
+ QString debugServer(QLatin1String("QDeclarativeDebugServer"));
while (d->protocol->packetsAvailable()) {
QPacket pack = d->protocol->read();
@@ -220,7 +220,7 @@ void QmlDebugServer::readyRead()
// Enable
if (!d->enabledPlugins.contains(plugin)) {
d->enabledPlugins.append(plugin);
- QHash<QString, QmlDebugService *>::Iterator iter =
+ QHash<QString, QDeclarativeDebugService *>::Iterator iter =
d->plugins.find(plugin);
if (iter != d->plugins.end())
(*iter)->enabledChanged(true);
@@ -230,23 +230,23 @@ void QmlDebugServer::readyRead()
// Disable
if (d->enabledPlugins.contains(plugin)) {
d->enabledPlugins.removeAll(plugin);
- QHash<QString, QmlDebugService *>::Iterator iter =
+ QHash<QString, QDeclarativeDebugService *>::Iterator iter =
d->plugins.find(plugin);
if (iter != d->plugins.end())
(*iter)->enabledChanged(false);
}
} else {
- qWarning("QmlDebugServer: Invalid control message %d", op);
+ qWarning("QDeclarativeDebugServer: Invalid control message %d", op);
}
} else {
QByteArray message;
pack >> message;
- QHash<QString, QmlDebugService *>::Iterator iter =
+ QHash<QString, QDeclarativeDebugService *>::Iterator iter =
d->plugins.find(name);
if (iter == d->plugins.end()) {
- qWarning() << "QmlDebugServer: Message received for missing plugin" << name;
+ qWarning() << "QDeclarativeDebugServer: Message received for missing plugin" << name;
} else {
(*iter)->messageReceived(message);
}
@@ -254,38 +254,38 @@ void QmlDebugServer::readyRead()
}
}
-QmlDebugServicePrivate::QmlDebugServicePrivate()
+QDeclarativeDebugServicePrivate::QDeclarativeDebugServicePrivate()
: server(0)
{
}
-QmlDebugService::QmlDebugService(const QString &name, QObject *parent)
-: QObject(*(new QmlDebugServicePrivate), parent)
+QDeclarativeDebugService::QDeclarativeDebugService(const QString &name, QObject *parent)
+: QObject(*(new QDeclarativeDebugServicePrivate), parent)
{
- Q_D(QmlDebugService);
+ Q_D(QDeclarativeDebugService);
d->name = name;
- d->server = QmlDebugServer::instance();
+ d->server = QDeclarativeDebugServer::instance();
if (!d->server)
return;
if (d->server->d_func()->plugins.contains(name)) {
- qWarning() << "QmlDebugService: Conflicting plugin name" << name;
+ qWarning() << "QDeclarativeDebugService: Conflicting plugin name" << name;
d->server = 0;
} else {
d->server->d_func()->plugins.insert(name, this);
}
}
-QString QmlDebugService::name() const
+QString QDeclarativeDebugService::name() const
{
- Q_D(const QmlDebugService);
+ Q_D(const QDeclarativeDebugService);
return d->name;
}
-bool QmlDebugService::isEnabled() const
+bool QDeclarativeDebugService::isEnabled() const
{
- Q_D(const QmlDebugService);
+ Q_D(const QDeclarativeDebugService);
return (d->server && d->server->d_func()->enabledPlugins.contains(d->name));
}
@@ -315,7 +315,7 @@ Q_GLOBAL_STATIC(ObjectReferenceHash, objectReferenceHash);
Returns a unique id for \a object. Calling this method multiple times
for the same object will return the same id.
*/
-int QmlDebugService::idForObject(QObject *object)
+int QDeclarativeDebugService::idForObject(QObject *object)
{
if (!object)
return -1;
@@ -348,7 +348,7 @@ int QmlDebugService::idForObject(QObject *object)
assigned an id, through idForObject(), then 0 is returned. If the object
has been destroyed, 0 is returned.
*/
-QObject *QmlDebugService::objectForId(int id)
+QObject *QDeclarativeDebugService::objectForId(int id)
{
ObjectReferenceHash *hash = objectReferenceHash();
@@ -370,12 +370,12 @@ QObject *QmlDebugService::objectForId(int id)
}
}
-bool QmlDebugService::isDebuggingEnabled()
+bool QDeclarativeDebugService::isDebuggingEnabled()
{
- return QmlDebugServer::instance() != 0;
+ return QDeclarativeDebugServer::instance() != 0;
}
-QString QmlDebugService::objectToString(QObject *obj)
+QString QDeclarativeDebugService::objectToString(QObject *obj)
{
if(!obj)
return QLatin1String("NULL");
@@ -390,19 +390,19 @@ QString QmlDebugService::objectToString(QObject *obj)
return rv;
}
-void QmlDebugService::waitForClients()
+void QDeclarativeDebugService::waitForClients()
{
- QmlDebugServer::instance()->wait();
+ QDeclarativeDebugServer::instance()->wait();
}
-void QmlDebugService::notifyOnServerStart(QObject *object, const char *receiver)
+void QDeclarativeDebugService::notifyOnServerStart(QObject *object, const char *receiver)
{
- QmlDebugServer::instance()->registerForStartNotification(object, receiver);
+ QDeclarativeDebugServer::instance()->registerForStartNotification(object, receiver);
}
-void QmlDebugService::sendMessage(const QByteArray &message)
+void QDeclarativeDebugService::sendMessage(const QByteArray &message)
{
- Q_D(QmlDebugService);
+ Q_D(QDeclarativeDebugService);
if (!d->server || !d->server->d_func()->connection)
return;
@@ -413,14 +413,14 @@ void QmlDebugService::sendMessage(const QByteArray &message)
d->server->d_func()->connection->flush();
}
-void QmlDebugService::enabledChanged(bool)
+void QDeclarativeDebugService::enabledChanged(bool)
{
}
-void QmlDebugService::messageReceived(const QByteArray &)
+void QDeclarativeDebugService::messageReceived(const QByteArray &)
{
}
QT_END_NAMESPACE
-#include <qmldebugservice.moc>
+#include <qdeclarativedebugservice.moc>
diff --git a/src/declarative/debugger/qmldebugservice_p.h b/src/declarative/debugger/qdeclarativedebugservice_p.h
index 33ddda0..498edf3 100644
--- a/src/declarative/debugger/qmldebugservice_p.h
+++ b/src/declarative/debugger/qdeclarativedebugservice_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLDEBUGSERVICE_H
-#define QMLDEBUGSERVICE_H
+#ifndef QDECLARATIVEDEBUGSERVICE_H
+#define QDECLARATIVEDEBUGSERVICE_H
#include <QtCore/qobject.h>
@@ -50,14 +50,14 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlDebugServicePrivate;
-class Q_DECLARATIVE_EXPORT QmlDebugService : public QObject
+class QDeclarativeDebugServicePrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeDebugService : public QObject
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlDebugService)
- Q_DISABLE_COPY(QmlDebugService)
+ Q_DECLARE_PRIVATE(QDeclarativeDebugService)
+ Q_DISABLE_COPY(QDeclarativeDebugService)
public:
- QmlDebugService(const QString &, QObject *parent = 0);
+ QDeclarativeDebugService(const QString &, QObject *parent = 0);
QString name() const;
@@ -81,12 +81,12 @@ protected:
private:
void registerForStartNotification(QObject *object, const char *methodName);
- friend class QmlDebugServer;
+ friend class QDeclarativeDebugServer;
};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLDEBUGSERVICE_H
+#endif // QDECLARATIVEDEBUGSERVICE_H
diff --git a/src/declarative/debugger/qmldebug.cpp b/src/declarative/debugger/qmldebug.cpp
deleted file mode 100644
index 32d8bbb..0000000
--- a/src/declarative/debugger/qmldebug.cpp
+++ /dev/null
@@ -1,937 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 "qmldebug_p.h"
-
-#include "qmldebugclient_p.h"
-
-#include <qmlenginedebug_p.h>
-
-#include <private/qobject_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QmlEngineDebugClient : public QmlDebugClient
-{
-public:
- QmlEngineDebugClient(QmlDebugConnection *client, QmlEngineDebugPrivate *p);
-
-protected:
- virtual void messageReceived(const QByteArray &);
-
-private:
- QmlEngineDebugPrivate *priv;
-};
-
-class QmlEngineDebugPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QmlEngineDebug)
-public:
- QmlEngineDebugPrivate(QmlDebugConnection *);
-
- void message(const QByteArray &);
-
- QmlEngineDebugClient *client;
- int nextId;
- int getId();
-
- void decode(QDataStream &, QmlDebugContextReference &);
- void decode(QDataStream &, QmlDebugObjectReference &, bool simple);
-
- static void remove(QmlEngineDebug *, QmlDebugEnginesQuery *);
- static void remove(QmlEngineDebug *, QmlDebugRootContextQuery *);
- static void remove(QmlEngineDebug *, QmlDebugObjectQuery *);
- static void remove(QmlEngineDebug *, QmlDebugExpressionQuery *);
-
- QHash<int, QmlDebugEnginesQuery *> enginesQuery;
- QHash<int, QmlDebugRootContextQuery *> rootContextQuery;
- QHash<int, QmlDebugObjectQuery *> objectQuery;
- QHash<int, QmlDebugExpressionQuery *> expressionQuery;
-
- QHash<int, QmlDebugWatch *> watched;
-};
-
-QmlEngineDebugClient::QmlEngineDebugClient(QmlDebugConnection *client,
- QmlEngineDebugPrivate *p)
-: QmlDebugClient(QLatin1String("QmlEngine"), client), priv(p)
-{
- setEnabled(true);
-}
-
-void QmlEngineDebugClient::messageReceived(const QByteArray &data)
-{
- priv->message(data);
-}
-
-QmlEngineDebugPrivate::QmlEngineDebugPrivate(QmlDebugConnection *c)
-: client(new QmlEngineDebugClient(c, this)), nextId(0)
-{
-}
-
-int QmlEngineDebugPrivate::getId()
-{
- return nextId++;
-}
-
-void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, QmlDebugEnginesQuery *q)
-{
- if (c && q) {
- QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c);
- p->enginesQuery.remove(q->m_queryId);
- }
-}
-
-void QmlEngineDebugPrivate::remove(QmlEngineDebug *c,
- QmlDebugRootContextQuery *q)
-{
- if (c && q) {
- QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c);
- p->rootContextQuery.remove(q->m_queryId);
- }
-}
-
-void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, QmlDebugObjectQuery *q)
-{
- if (c && q) {
- QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c);
- p->objectQuery.remove(q->m_queryId);
- }
-}
-
-void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, QmlDebugExpressionQuery *q)
-{
- if (c && q) {
- QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c);
- p->expressionQuery.remove(q->m_queryId);
- }
-}
-
-void QmlEngineDebugPrivate::decode(QDataStream &ds, QmlDebugObjectReference &o,
- bool simple)
-{
- QmlEngineDebugServer::QmlObjectData data;
- ds >> data;
- o.m_debugId = data.objectId;
- o.m_class = data.objectType;
- o.m_name = data.objectName;
- o.m_source.m_url = data.url;
- o.m_source.m_lineNumber = data.lineNumber;
- o.m_source.m_columnNumber = data.columnNumber;
- o.m_contextDebugId = data.contextId;
-
- if (simple)
- return;
-
- int childCount;
- bool recur;
- ds >> childCount >> recur;
-
- for (int ii = 0; ii < childCount; ++ii) {
- o.m_children.append(QmlDebugObjectReference());
- decode(ds, o.m_children.last(), !recur);
- }
-
- int propCount;
- ds >> propCount;
-
- for (int ii = 0; ii < propCount; ++ii) {
- QmlEngineDebugServer::QmlObjectProperty data;
- ds >> data;
- QmlDebugPropertyReference prop;
- prop.m_objectDebugId = o.m_debugId;
- prop.m_name = data.name;
- prop.m_binding = data.binding;
- prop.m_hasNotifySignal = data.hasNotifySignal;
- prop.m_valueTypeName = data.valueTypeName;
- switch (data.type) {
- case QmlEngineDebugServer::QmlObjectProperty::Basic:
- case QmlEngineDebugServer::QmlObjectProperty::List:
- case QmlEngineDebugServer::QmlObjectProperty::SignalProperty:
- {
- prop.m_value = data.value;
- break;
- }
- case QmlEngineDebugServer::QmlObjectProperty::Object:
- {
- QmlDebugObjectReference obj;
- obj.m_debugId = prop.m_value.toInt();
- prop.m_value = qVariantFromValue(obj);
- break;
- }
- case QmlEngineDebugServer::QmlObjectProperty::Unknown:
- break;
- }
- o.m_properties << prop;
- }
-}
-
-void QmlEngineDebugPrivate::decode(QDataStream &ds, QmlDebugContextReference &c)
-{
- ds >> c.m_name >> c.m_debugId;
-
- int contextCount;
- ds >> contextCount;
-
- for (int ii = 0; ii < contextCount; ++ii) {
- c.m_contexts.append(QmlDebugContextReference());
- decode(ds, c.m_contexts.last());
- }
-
- int objectCount;
- ds >> objectCount;
-
- for (int ii = 0; ii < objectCount; ++ii) {
- QmlDebugObjectReference obj;
- decode(ds, obj, true);
-
- obj.m_contextDebugId = c.m_debugId;
- c.m_objects << obj;
- }
-}
-
-void QmlEngineDebugPrivate::message(const QByteArray &data)
-{
- QDataStream ds(data);
-
- QByteArray type;
- ds >> type;
-
- //qDebug() << "QmlEngineDebugPrivate::message()" << type;
-
- if (type == "LIST_ENGINES_R") {
- int queryId;
- ds >> queryId;
-
- QmlDebugEnginesQuery *query = enginesQuery.value(queryId);
- if (!query)
- return;
- enginesQuery.remove(queryId);
-
- int count;
- ds >> count;
-
- for (int ii = 0; ii < count; ++ii) {
- QmlDebugEngineReference ref;
- ds >> ref.m_name;
- ds >> ref.m_debugId;
- query->m_engines << ref;
- }
-
- query->m_client = 0;
- query->setState(QmlDebugQuery::Completed);
- } else if (type == "LIST_OBJECTS_R") {
- int queryId;
- ds >> queryId;
-
- QmlDebugRootContextQuery *query = rootContextQuery.value(queryId);
- if (!query)
- return;
- rootContextQuery.remove(queryId);
-
- if (!ds.atEnd())
- decode(ds, query->m_context);
-
- query->m_client = 0;
- query->setState(QmlDebugQuery::Completed);
- } else if (type == "FETCH_OBJECT_R") {
- int queryId;
- ds >> queryId;
-
- QmlDebugObjectQuery *query = objectQuery.value(queryId);
- if (!query)
- return;
- objectQuery.remove(queryId);
-
- if (!ds.atEnd())
- decode(ds, query->m_object, false);
-
- query->m_client = 0;
- query->setState(QmlDebugQuery::Completed);
- } else if (type == "EVAL_EXPRESSION_R") {
- int queryId;
- QVariant result;
- ds >> queryId >> result;
-
- QmlDebugExpressionQuery *query = expressionQuery.value(queryId);
- if (!query)
- return;
- expressionQuery.remove(queryId);
-
- query->m_result = result;
- query->m_client = 0;
- query->setState(QmlDebugQuery::Completed);
- } else if (type == "WATCH_PROPERTY_R") {
- int queryId;
- bool ok;
- ds >> queryId >> ok;
-
- QmlDebugWatch *watch = watched.value(queryId);
- if (!watch)
- return;
-
- watch->setState(ok ? QmlDebugWatch::Active : QmlDebugWatch::Inactive);
- } else if (type == "WATCH_OBJECT_R") {
- int queryId;
- bool ok;
- ds >> queryId >> ok;
-
- QmlDebugWatch *watch = watched.value(queryId);
- if (!watch)
- return;
-
- watch->setState(ok ? QmlDebugWatch::Active : QmlDebugWatch::Inactive);
- } else if (type == "WATCH_EXPR_OBJECT_R") {
- int queryId;
- bool ok;
- ds >> queryId >> ok;
-
- QmlDebugWatch *watch = watched.value(queryId);
- if (!watch)
- return;
-
- watch->setState(ok ? QmlDebugWatch::Active : QmlDebugWatch::Inactive);
- } else if (type == "UPDATE_WATCH") {
- int queryId;
- int debugId;
- QByteArray name;
- QVariant value;
- ds >> queryId >> debugId >> name >> value;
-
- QmlDebugWatch *watch = watched.value(queryId, 0);
- if (!watch)
- return;
- emit watch->valueChanged(name, value);
- }
-}
-
-QmlEngineDebug::QmlEngineDebug(QmlDebugConnection *client, QObject *parent)
-: QObject(*(new QmlEngineDebugPrivate(client)), parent)
-{
-}
-
-QmlDebugPropertyWatch *QmlEngineDebug::addWatch(const QmlDebugPropertyReference &property, QObject *parent)
-{
- Q_D(QmlEngineDebug);
-
- QmlDebugPropertyWatch *watch = new QmlDebugPropertyWatch(parent);
- if (d->client->isConnected()) {
- int queryId = d->getId();
- watch->m_queryId = queryId;
- watch->m_client = this;
- watch->m_objectDebugId = property.objectDebugId();
- watch->m_name = property.name();
- d->watched.insert(queryId, watch);
-
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("WATCH_PROPERTY") << queryId << property.objectDebugId() << property.name().toUtf8();
- d->client->sendMessage(message);
- } else {
- watch->m_state = QmlDebugWatch::Dead;
- }
-
- return watch;
-}
-
-QmlDebugWatch *QmlEngineDebug::addWatch(const QmlDebugContextReference &, const QString &, QObject *)
-{
- qWarning("QmlEngineDebug::addWatch(): Not implemented");
- return 0;
-}
-
-QmlDebugObjectExpressionWatch *QmlEngineDebug::addWatch(const QmlDebugObjectReference &object, const QString &expr, QObject *parent)
-{
- Q_D(QmlEngineDebug);
- QmlDebugObjectExpressionWatch *watch = new QmlDebugObjectExpressionWatch(parent);
- if (d->client->isConnected()) {
- int queryId = d->getId();
- watch->m_queryId = queryId;
- watch->m_client = this;
- watch->m_objectDebugId = object.debugId();
- watch->m_expr = expr;
- d->watched.insert(queryId, watch);
-
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("WATCH_EXPR_OBJECT") << queryId << object.debugId() << expr;
- d->client->sendMessage(message);
- } else {
- watch->m_state = QmlDebugWatch::Dead;
- }
- return watch;
-}
-
-QmlDebugWatch *QmlEngineDebug::addWatch(const QmlDebugObjectReference &object, QObject *parent)
-{
- Q_D(QmlEngineDebug);
-
- QmlDebugWatch *watch = new QmlDebugWatch(parent);
- if (d->client->isConnected()) {
- int queryId = d->getId();
- watch->m_queryId = queryId;
- watch->m_client = this;
- watch->m_objectDebugId = object.debugId();
- d->watched.insert(queryId, watch);
-
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("WATCH_OBJECT") << queryId << object.debugId();
- d->client->sendMessage(message);
- } else {
- watch->m_state = QmlDebugWatch::Dead;
- }
-
- return watch;
-}
-
-QmlDebugWatch *QmlEngineDebug::addWatch(const QmlDebugFileReference &, QObject *)
-{
- qWarning("QmlEngineDebug::addWatch(): Not implemented");
- return 0;
-}
-
-void QmlEngineDebug::removeWatch(QmlDebugWatch *watch)
-{
- Q_D(QmlEngineDebug);
-
- if (!watch || !watch->m_client)
- return;
-
- watch->m_client = 0;
- watch->setState(QmlDebugWatch::Inactive);
-
- d->watched.remove(watch->queryId());
-
- if (d->client && d->client->isConnected()) {
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("NO_WATCH") << watch->queryId();
- d->client->sendMessage(message);
- }
-}
-
-QmlDebugEnginesQuery *QmlEngineDebug::queryAvailableEngines(QObject *parent)
-{
- Q_D(QmlEngineDebug);
-
- QmlDebugEnginesQuery *query = new QmlDebugEnginesQuery(parent);
- if (d->client->isConnected()) {
- query->m_client = this;
- int queryId = d->getId();
- query->m_queryId = queryId;
- d->enginesQuery.insert(queryId, query);
-
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("LIST_ENGINES") << queryId;
- d->client->sendMessage(message);
- } else {
- query->m_state = QmlDebugQuery::Error;
- }
-
- return query;
-}
-
-QmlDebugRootContextQuery *QmlEngineDebug::queryRootContexts(const QmlDebugEngineReference &engine, QObject *parent)
-{
- Q_D(QmlEngineDebug);
-
- QmlDebugRootContextQuery *query = new QmlDebugRootContextQuery(parent);
- if (d->client->isConnected() && engine.debugId() != -1) {
- query->m_client = this;
- int queryId = d->getId();
- query->m_queryId = queryId;
- d->rootContextQuery.insert(queryId, query);
-
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("LIST_OBJECTS") << queryId << engine.debugId();
- d->client->sendMessage(message);
- } else {
- query->m_state = QmlDebugQuery::Error;
- }
-
- return query;
-}
-
-QmlDebugObjectQuery *QmlEngineDebug::queryObject(const QmlDebugObjectReference &object, QObject *parent)
-{
- Q_D(QmlEngineDebug);
-
- QmlDebugObjectQuery *query = new QmlDebugObjectQuery(parent);
- if (d->client->isConnected() && object.debugId() != -1) {
- query->m_client = this;
- int queryId = d->getId();
- query->m_queryId = queryId;
- d->objectQuery.insert(queryId, query);
-
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId()
- << false;
- d->client->sendMessage(message);
- } else {
- query->m_state = QmlDebugQuery::Error;
- }
-
- return query;
-}
-
-QmlDebugObjectQuery *QmlEngineDebug::queryObjectRecursive(const QmlDebugObjectReference &object, QObject *parent)
-{
- Q_D(QmlEngineDebug);
-
- QmlDebugObjectQuery *query = new QmlDebugObjectQuery(parent);
- if (d->client->isConnected() && object.debugId() != -1) {
- query->m_client = this;
- int queryId = d->getId();
- query->m_queryId = queryId;
- d->objectQuery.insert(queryId, query);
-
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("FETCH_OBJECT") << queryId << object.debugId()
- << true;
- d->client->sendMessage(message);
- } else {
- query->m_state = QmlDebugQuery::Error;
- }
-
- return query;
-}
-
-QmlDebugExpressionQuery *QmlEngineDebug::queryExpressionResult(int objectDebugId, const QString &expr, QObject *parent)
-{
- Q_D(QmlEngineDebug);
-
- QmlDebugExpressionQuery *query = new QmlDebugExpressionQuery(parent);
- if (d->client->isConnected() && objectDebugId != -1) {
- query->m_client = this;
- query->m_expr = expr;
- int queryId = d->getId();
- query->m_queryId = queryId;
- d->expressionQuery.insert(queryId, query);
-
- QByteArray message;
- QDataStream ds(&message, QIODevice::WriteOnly);
- ds << QByteArray("EVAL_EXPRESSION") << queryId << objectDebugId << expr;
- d->client->sendMessage(message);
- } else {
- query->m_state = QmlDebugQuery::Error;
- }
-
- return query;
-}
-
-QmlDebugWatch::QmlDebugWatch(QObject *parent)
-: QObject(parent), m_state(Waiting), m_queryId(-1), m_client(0), m_objectDebugId(-1)
-{
-}
-
-QmlDebugWatch::~QmlDebugWatch()
-{
-}
-
-int QmlDebugWatch::queryId() const
-{
- return m_queryId;
-}
-
-int QmlDebugWatch::objectDebugId() const
-{
- return m_objectDebugId;
-}
-
-QmlDebugWatch::State QmlDebugWatch::state() const
-{
- return m_state;
-}
-
-void QmlDebugWatch::setState(State s)
-{
- if (m_state == s)
- return;
- m_state = s;
- emit stateChanged(m_state);
-}
-
-QmlDebugPropertyWatch::QmlDebugPropertyWatch(QObject *parent)
- : QmlDebugWatch(parent)
-{
-}
-
-QString QmlDebugPropertyWatch::name() const
-{
- return m_name;
-}
-
-
-QmlDebugObjectExpressionWatch::QmlDebugObjectExpressionWatch(QObject *parent)
- : QmlDebugWatch(parent)
-{
-}
-
-QString QmlDebugObjectExpressionWatch::expression() const
-{
- return m_expr;
-}
-
-
-QmlDebugQuery::QmlDebugQuery(QObject *parent)
-: QObject(parent), m_state(Waiting)
-{
-}
-
-QmlDebugQuery::State QmlDebugQuery::state() const
-{
- return m_state;
-}
-
-bool QmlDebugQuery::isWaiting() const
-{
- return m_state == Waiting;
-}
-
-void QmlDebugQuery::setState(State s)
-{
- if (m_state == s)
- return;
- m_state = s;
- emit stateChanged(m_state);
-}
-
-QmlDebugEnginesQuery::QmlDebugEnginesQuery(QObject *parent)
-: QmlDebugQuery(parent), m_client(0), m_queryId(-1)
-{
-}
-
-QmlDebugEnginesQuery::~QmlDebugEnginesQuery()
-{
- if (m_client && m_queryId != -1)
- QmlEngineDebugPrivate::remove(m_client, this);
-}
-
-QList<QmlDebugEngineReference> QmlDebugEnginesQuery::engines() const
-{
- return m_engines;
-}
-
-QmlDebugRootContextQuery::QmlDebugRootContextQuery(QObject *parent)
-: QmlDebugQuery(parent), m_client(0), m_queryId(-1)
-{
-}
-
-QmlDebugRootContextQuery::~QmlDebugRootContextQuery()
-{
- if (m_client && m_queryId != -1)
- QmlEngineDebugPrivate::remove(m_client, this);
-}
-
-QmlDebugContextReference QmlDebugRootContextQuery::rootContext() const
-{
- return m_context;
-}
-
-QmlDebugObjectQuery::QmlDebugObjectQuery(QObject *parent)
-: QmlDebugQuery(parent), m_client(0), m_queryId(-1)
-{
-}
-
-QmlDebugObjectQuery::~QmlDebugObjectQuery()
-{
- if (m_client && m_queryId != -1)
- QmlEngineDebugPrivate::remove(m_client, this);
-}
-
-QmlDebugObjectReference QmlDebugObjectQuery::object() const
-{
- return m_object;
-}
-
-QmlDebugExpressionQuery::QmlDebugExpressionQuery(QObject *parent)
-: QmlDebugQuery(parent), m_client(0), m_queryId(-1)
-{
-}
-
-QmlDebugExpressionQuery::~QmlDebugExpressionQuery()
-{
- if (m_client && m_queryId != -1)
- QmlEngineDebugPrivate::remove(m_client, this);
-}
-
-QString QmlDebugExpressionQuery::expression() const
-{
- return m_expr;
-}
-
-QVariant QmlDebugExpressionQuery::result() const
-{
- return m_result;
-}
-
-QmlDebugEngineReference::QmlDebugEngineReference()
-: m_debugId(-1)
-{
-}
-
-QmlDebugEngineReference::QmlDebugEngineReference(int debugId)
-: m_debugId(debugId)
-{
-}
-
-QmlDebugEngineReference::QmlDebugEngineReference(const QmlDebugEngineReference &o)
-: m_debugId(o.m_debugId), m_name(o.m_name)
-{
-}
-
-QmlDebugEngineReference &
-QmlDebugEngineReference::operator=(const QmlDebugEngineReference &o)
-{
- m_debugId = o.m_debugId; m_name = o.m_name;
- return *this;
-}
-
-int QmlDebugEngineReference::debugId() const
-{
- return m_debugId;
-}
-
-QString QmlDebugEngineReference::name() const
-{
- return m_name;
-}
-
-QmlDebugObjectReference::QmlDebugObjectReference()
-: m_debugId(-1), m_contextDebugId(-1)
-{
-}
-
-QmlDebugObjectReference::QmlDebugObjectReference(int debugId)
-: m_debugId(debugId), m_contextDebugId(-1)
-{
-}
-
-QmlDebugObjectReference::QmlDebugObjectReference(const QmlDebugObjectReference &o)
-: m_debugId(o.m_debugId), m_class(o.m_class), m_name(o.m_name),
- m_source(o.m_source), m_contextDebugId(o.m_contextDebugId),
- m_properties(o.m_properties), m_children(o.m_children)
-{
-}
-
-QmlDebugObjectReference &
-QmlDebugObjectReference::operator=(const QmlDebugObjectReference &o)
-{
- m_debugId = o.m_debugId; m_class = o.m_class; m_name = o.m_name;
- m_source = o.m_source; m_contextDebugId = o.m_contextDebugId;
- m_properties = o.m_properties; m_children = o.m_children;
- return *this;
-}
-
-int QmlDebugObjectReference::debugId() const
-{
- return m_debugId;
-}
-
-QString QmlDebugObjectReference::className() const
-{
- return m_class;
-}
-
-QString QmlDebugObjectReference::name() const
-{
- return m_name;
-}
-
-QmlDebugFileReference QmlDebugObjectReference::source() const
-{
- return m_source;
-}
-
-int QmlDebugObjectReference::contextDebugId() const
-{
- return m_contextDebugId;
-}
-
-QList<QmlDebugPropertyReference> QmlDebugObjectReference::properties() const
-{
- return m_properties;
-}
-
-QList<QmlDebugObjectReference> QmlDebugObjectReference::children() const
-{
- return m_children;
-}
-
-QmlDebugContextReference::QmlDebugContextReference()
-: m_debugId(-1)
-{
-}
-
-QmlDebugContextReference::QmlDebugContextReference(const QmlDebugContextReference &o)
-: m_debugId(o.m_debugId), m_name(o.m_name), m_objects(o.m_objects), m_contexts(o.m_contexts)
-{
-}
-
-QmlDebugContextReference &QmlDebugContextReference::operator=(const QmlDebugContextReference &o)
-{
- m_debugId = o.m_debugId; m_name = o.m_name; m_objects = o.m_objects;
- m_contexts = o.m_contexts;
- return *this;
-}
-
-int QmlDebugContextReference::debugId() const
-{
- return m_debugId;
-}
-
-QString QmlDebugContextReference::name() const
-{
- return m_name;
-}
-
-QList<QmlDebugObjectReference> QmlDebugContextReference::objects() const
-{
- return m_objects;
-}
-
-QList<QmlDebugContextReference> QmlDebugContextReference::contexts() const
-{
- return m_contexts;
-}
-
-QmlDebugFileReference::QmlDebugFileReference()
-: m_lineNumber(-1), m_columnNumber(-1)
-{
-}
-
-QmlDebugFileReference::QmlDebugFileReference(const QmlDebugFileReference &o)
-: m_url(o.m_url), m_lineNumber(o.m_lineNumber), m_columnNumber(o.m_columnNumber)
-{
-}
-
-QmlDebugFileReference &QmlDebugFileReference::operator=(const QmlDebugFileReference &o)
-{
- m_url = o.m_url; m_lineNumber = o.m_lineNumber; m_columnNumber = o.m_columnNumber;
- return *this;
-}
-
-QUrl QmlDebugFileReference::url() const
-{
- return m_url;
-}
-
-void QmlDebugFileReference::setUrl(const QUrl &u)
-{
- m_url = u;
-}
-
-int QmlDebugFileReference::lineNumber() const
-{
- return m_lineNumber;
-}
-
-void QmlDebugFileReference::setLineNumber(int l)
-{
- m_lineNumber = l;
-}
-
-int QmlDebugFileReference::columnNumber() const
-{
- return m_columnNumber;
-}
-
-void QmlDebugFileReference::setColumnNumber(int c)
-{
- m_columnNumber = c;
-}
-
-QmlDebugPropertyReference::QmlDebugPropertyReference()
-: m_objectDebugId(-1), m_hasNotifySignal(false)
-{
-}
-
-QmlDebugPropertyReference::QmlDebugPropertyReference(const QmlDebugPropertyReference &o)
-: m_objectDebugId(o.m_objectDebugId), m_name(o.m_name), m_value(o.m_value),
- m_valueTypeName(o.m_valueTypeName), m_binding(o.m_binding),
- m_hasNotifySignal(o.m_hasNotifySignal)
-{
-}
-
-QmlDebugPropertyReference &QmlDebugPropertyReference::operator=(const QmlDebugPropertyReference &o)
-{
- m_objectDebugId = o.m_objectDebugId; m_name = o.m_name; m_value = o.m_value;
- m_valueTypeName = o.m_valueTypeName; m_binding = o.m_binding;
- m_hasNotifySignal = o.m_hasNotifySignal;
- return *this;
-}
-
-int QmlDebugPropertyReference::objectDebugId() const
-{
- return m_objectDebugId;
-}
-
-QString QmlDebugPropertyReference::name() const
-{
- return m_name;
-}
-
-QString QmlDebugPropertyReference::valueTypeName() const
-{
- return m_valueTypeName;
-}
-
-QVariant QmlDebugPropertyReference::value() const
-{
- return m_value;
-}
-
-QString QmlDebugPropertyReference::binding() const
-{
- return m_binding;
-}
-
-bool QmlDebugPropertyReference::hasNotifySignal() const
-{
- return m_hasNotifySignal;
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/declarative/debugger/qmldebug_p.h b/src/declarative/debugger/qmldebug_p.h
deleted file mode 100644
index a1371d5..0000000
--- a/src/declarative/debugger/qmldebug_p.h
+++ /dev/null
@@ -1,371 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 QMLDEBUG_H
-#define QMLDEBUG_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qvariant.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QmlDebugConnection;
-class QmlDebugWatch;
-class QmlDebugPropertyWatch;
-class QmlDebugObjectExpressionWatch;
-class QmlDebugEnginesQuery;
-class QmlDebugRootContextQuery;
-class QmlDebugObjectQuery;
-class QmlDebugExpressionQuery;
-class QmlDebugPropertyReference;
-class QmlDebugContextReference;
-class QmlDebugObjectReference;
-class QmlDebugFileReference;
-class QmlDebugEngineReference;
-class QmlEngineDebugPrivate;
-class Q_DECLARATIVE_EXPORT QmlEngineDebug : public QObject
-{
-Q_OBJECT
-public:
- QmlEngineDebug(QmlDebugConnection *, QObject * = 0);
-
- QmlDebugPropertyWatch *addWatch(const QmlDebugPropertyReference &,
- QObject *parent = 0);
- QmlDebugWatch *addWatch(const QmlDebugContextReference &, const QString &,
- QObject *parent = 0);
- QmlDebugObjectExpressionWatch *addWatch(const QmlDebugObjectReference &, const QString &,
- QObject *parent = 0);
- QmlDebugWatch *addWatch(const QmlDebugObjectReference &,
- QObject *parent = 0);
- QmlDebugWatch *addWatch(const QmlDebugFileReference &,
- QObject *parent = 0);
-
- void removeWatch(QmlDebugWatch *watch);
-
- QmlDebugEnginesQuery *queryAvailableEngines(QObject *parent = 0);
- QmlDebugRootContextQuery *queryRootContexts(const QmlDebugEngineReference &,
- QObject *parent = 0);
- QmlDebugObjectQuery *queryObject(const QmlDebugObjectReference &,
- QObject *parent = 0);
- QmlDebugObjectQuery *queryObjectRecursive(const QmlDebugObjectReference &,
- QObject *parent = 0);
- QmlDebugExpressionQuery *queryExpressionResult(int objectDebugId,
- const QString &expr,
- QObject *parent = 0);
-
-private:
- Q_DECLARE_PRIVATE(QmlEngineDebug)
-};
-
-class Q_DECLARATIVE_EXPORT QmlDebugWatch : public QObject
-{
-Q_OBJECT
-public:
- enum State { Waiting, Active, Inactive, Dead };
-
- QmlDebugWatch(QObject *);
- ~QmlDebugWatch();
-
- int queryId() const;
- int objectDebugId() const;
- State state() const;
-
-Q_SIGNALS:
- void stateChanged(QmlDebugWatch::State);
- //void objectChanged(int, const QmlDebugObjectReference &);
- //void valueChanged(int, const QVariant &);
-
- // Server sends value as string if it is a user-type variant
- void valueChanged(const QByteArray &name, const QVariant &value);
-
-private:
- friend class QmlEngineDebug;
- friend class QmlEngineDebugPrivate;
- void setState(State);
- State m_state;
- int m_queryId;
- QmlEngineDebug *m_client;
- int m_objectDebugId;
-};
-
-class Q_DECLARATIVE_EXPORT QmlDebugPropertyWatch : public QmlDebugWatch
-{
- Q_OBJECT
-public:
- QmlDebugPropertyWatch(QObject *parent);
-
- QString name() const;
-
-private:
- friend class QmlEngineDebug;
- QString m_name;
-};
-
-class Q_DECLARATIVE_EXPORT QmlDebugObjectExpressionWatch : public QmlDebugWatch
-{
- Q_OBJECT
-public:
- QmlDebugObjectExpressionWatch(QObject *parent);
-
- QString expression() const;
-
-private:
- friend class QmlEngineDebug;
- QString m_expr;
- int m_debugId;
-};
-
-
-class Q_DECLARATIVE_EXPORT QmlDebugQuery : public QObject
-{
-Q_OBJECT
-public:
- enum State { Waiting, Error, Completed };
-
- State state() const;
- bool isWaiting() const;
-
-// bool waitUntilCompleted();
-
-Q_SIGNALS:
- void stateChanged(QmlDebugQuery::State);
-
-protected:
- QmlDebugQuery(QObject *);
-
-private:
- friend class QmlEngineDebug;
- friend class QmlEngineDebugPrivate;
- void setState(State);
- State m_state;
-};
-
-class Q_DECLARATIVE_EXPORT QmlDebugFileReference
-{
-public:
- QmlDebugFileReference();
- QmlDebugFileReference(const QmlDebugFileReference &);
- QmlDebugFileReference &operator=(const QmlDebugFileReference &);
-
- QUrl url() const;
- void setUrl(const QUrl &);
- int lineNumber() const;
- void setLineNumber(int);
- int columnNumber() const;
- void setColumnNumber(int);
-
-private:
- friend class QmlEngineDebugPrivate;
- QUrl m_url;
- int m_lineNumber;
- int m_columnNumber;
-};
-
-class Q_DECLARATIVE_EXPORT QmlDebugEngineReference
-{
-public:
- QmlDebugEngineReference();
- QmlDebugEngineReference(int);
- QmlDebugEngineReference(const QmlDebugEngineReference &);
- QmlDebugEngineReference &operator=(const QmlDebugEngineReference &);
-
- int debugId() const;
- QString name() const;
-
-private:
- friend class QmlEngineDebugPrivate;
- int m_debugId;
- QString m_name;
-};
-
-class Q_DECLARATIVE_EXPORT QmlDebugObjectReference
-{
-public:
- QmlDebugObjectReference();
- QmlDebugObjectReference(int);
- QmlDebugObjectReference(const QmlDebugObjectReference &);
- QmlDebugObjectReference &operator=(const QmlDebugObjectReference &);
-
- int debugId() const;
- QString className() const;
- QString name() const;
-
- QmlDebugFileReference source() const;
- int contextDebugId() const;
-
- QList<QmlDebugPropertyReference> properties() const;
- QList<QmlDebugObjectReference> children() const;
-
-private:
- friend class QmlEngineDebugPrivate;
- int m_debugId;
- QString m_class;
- QString m_name;
- QmlDebugFileReference m_source;
- int m_contextDebugId;
- QList<QmlDebugPropertyReference> m_properties;
- QList<QmlDebugObjectReference> m_children;
-};
-
-class Q_DECLARATIVE_EXPORT QmlDebugContextReference
-{
-public:
- QmlDebugContextReference();
- QmlDebugContextReference(const QmlDebugContextReference &);
- QmlDebugContextReference &operator=(const QmlDebugContextReference &);
-
- int debugId() const;
- QString name() const;
-
- QList<QmlDebugObjectReference> objects() const;
- QList<QmlDebugContextReference> contexts() const;
-
-private:
- friend class QmlEngineDebugPrivate;
- int m_debugId;
- QString m_name;
- QList<QmlDebugObjectReference> m_objects;
- QList<QmlDebugContextReference> m_contexts;
-};
-
-class Q_DECLARATIVE_EXPORT QmlDebugPropertyReference
-{
-public:
- QmlDebugPropertyReference();
- QmlDebugPropertyReference(const QmlDebugPropertyReference &);
- QmlDebugPropertyReference &operator=(const QmlDebugPropertyReference &);
-
- int objectDebugId() const;
- QString name() const;
- QVariant value() const;
- QString valueTypeName() const;
- QString binding() const;
- bool hasNotifySignal() const;
-
-private:
- friend class QmlEngineDebugPrivate;
- int m_objectDebugId;
- QString m_name;
- QVariant m_value;
- QString m_valueTypeName;
- QString m_binding;
- bool m_hasNotifySignal;
-};
-
-
-class Q_DECLARATIVE_EXPORT QmlDebugEnginesQuery : public QmlDebugQuery
-{
-Q_OBJECT
-public:
- virtual ~QmlDebugEnginesQuery();
- QList<QmlDebugEngineReference> engines() const;
-private:
- friend class QmlEngineDebug;
- friend class QmlEngineDebugPrivate;
- QmlDebugEnginesQuery(QObject *);
- QmlEngineDebug *m_client;
- int m_queryId;
- QList<QmlDebugEngineReference> m_engines;
-};
-
-class Q_DECLARATIVE_EXPORT QmlDebugRootContextQuery : public QmlDebugQuery
-{
-Q_OBJECT
-public:
- virtual ~QmlDebugRootContextQuery();
- QmlDebugContextReference rootContext() const;
-private:
- friend class QmlEngineDebug;
- friend class QmlEngineDebugPrivate;
- QmlDebugRootContextQuery(QObject *);
- QmlEngineDebug *m_client;
- int m_queryId;
- QmlDebugContextReference m_context;
-};
-
-class Q_DECLARATIVE_EXPORT QmlDebugObjectQuery : public QmlDebugQuery
-{
-Q_OBJECT
-public:
- virtual ~QmlDebugObjectQuery();
- QmlDebugObjectReference object() const;
-private:
- friend class QmlEngineDebug;
- friend class QmlEngineDebugPrivate;
- QmlDebugObjectQuery(QObject *);
- QmlEngineDebug *m_client;
- int m_queryId;
- QmlDebugObjectReference m_object;
-
-};
-
-class Q_DECLARATIVE_EXPORT QmlDebugExpressionQuery : public QmlDebugQuery
-{
-Q_OBJECT
-public:
- virtual ~QmlDebugExpressionQuery();
- QString expression() const;
- QVariant result() const;
-private:
- friend class QmlEngineDebug;
- friend class QmlEngineDebugPrivate;
- QmlDebugExpressionQuery(QObject *);
- QmlEngineDebug *m_client;
- int m_queryId;
- QString m_expr;
- QVariant m_result;
-
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QmlDebugEngineReference)
-Q_DECLARE_METATYPE(QmlDebugObjectReference)
-Q_DECLARE_METATYPE(QmlDebugContextReference)
-Q_DECLARE_METATYPE(QmlDebugPropertyReference)
-
-QT_END_HEADER
-
-#endif // QMLDEBUG_H
diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro
index 86a0370..4287e25 100644
--- a/src/declarative/declarative.pro
+++ b/src/declarative/declarative.pro
@@ -9,7 +9,7 @@ solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtXml
-exists("qml_enable_gcov") {
+exists("qdeclarative_enable_gcov") {
QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors
LIBS += -lgcov
}
@@ -24,7 +24,6 @@ include(3rdparty/3rdparty.pri)
include(util/util.pri)
include(graphicsitems/graphicsitems.pri)
include(qml/qml.pri)
-include(widgets/widgets.pri)
include(debugger/debugger.pri)
symbian:TARGET.UID3=0x2001E623
diff --git a/src/declarative/graphicsitems/graphicsitems.pri b/src/declarative/graphicsitems/graphicsitems.pri
index e5343c6..7a85f00 100644
--- a/src/declarative/graphicsitems/graphicsitems.pri
+++ b/src/declarative/graphicsitems/graphicsitems.pri
@@ -1,93 +1,93 @@
INCLUDEPATH += $$PWD
HEADERS += \
- $$PWD/qmlgraphicsitemsmodule_p.h \
- $$PWD/qmlgraphicsanchors_p.h \
- $$PWD/qmlgraphicsanchors_p_p.h \
- $$PWD/qmlgraphicsevents_p_p.h \
- $$PWD/qmlgraphicseffects_p.h \
- $$PWD/qmlgraphicsflickable_p.h \
- $$PWD/qmlgraphicsflickable_p_p.h \
- $$PWD/qmlgraphicsflipable_p.h \
- $$PWD/qmlgraphicsgridview_p.h \
- $$PWD/qmlgraphicsimage_p.h \
- $$PWD/qmlgraphicsimagebase_p.h \
- $$PWD/qmlgraphicsborderimage_p.h \
- $$PWD/qmlgraphicspainteditem_p.h \
- $$PWD/qmlgraphicspainteditem_p_p.h \
- $$PWD/qmlgraphicsimage_p_p.h \
- $$PWD/qmlgraphicsborderimage_p_p.h \
- $$PWD/qmlgraphicsimagebase_p_p.h \
- $$PWD/qmlgraphicsanimatedimage_p.h \
- $$PWD/qmlgraphicsanimatedimage_p_p.h \
- $$PWD/qmlgraphicsitem.h \
- $$PWD/qmlgraphicsitem_p.h \
- $$PWD/qmlgraphicsfocuspanel_p.h \
- $$PWD/qmlgraphicsfocusscope_p.h \
- $$PWD/qmlgraphicspositioners_p.h \
- $$PWD/qmlgraphicspositioners_p_p.h \
- $$PWD/qmlgraphicsloader_p.h \
- $$PWD/qmlgraphicsloader_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 \
- $$PWD/qmlgraphicspathview_p_p.h \
- $$PWD/qmlgraphicsrectangle_p.h \
- $$PWD/qmlgraphicsrectangle_p_p.h \
- $$PWD/qmlgraphicsrepeater_p.h \
- $$PWD/qmlgraphicsrepeater_p_p.h \
- $$PWD/qmlgraphicsscalegrid_p_p.h \
- $$PWD/qmlgraphicstextinput_p.h \
- $$PWD/qmlgraphicstextinput_p_p.h \
- $$PWD/qmlgraphicstextedit_p.h \
- $$PWD/qmlgraphicstextedit_p_p.h \
- $$PWD/qmlgraphicstext_p.h \
- $$PWD/qmlgraphicstext_p_p.h \
- $$PWD/qmlgraphicsvisualitemmodel_p.h \
- $$PWD/qmlgraphicslistview_p.h \
- $$PWD/qmlgraphicsgraphicsobjectcontainer_p.h \
- $$PWD/qmlgraphicsparticles_p.h \
- $$PWD/qmlgraphicslayoutitem_p.h \
- $$PWD/qmlgraphicsitemchangelistener_p.h \
- $$PWD/qmlgraphicseffects.cpp
+ $$PWD/qdeclarativeitemsmodule_p.h \
+ $$PWD/qdeclarativeanchors_p.h \
+ $$PWD/qdeclarativeanchors_p_p.h \
+ $$PWD/qdeclarativeevents_p_p.h \
+ $$PWD/qdeclarativeeffects_p.h \
+ $$PWD/qdeclarativeflickable_p.h \
+ $$PWD/qdeclarativeflickable_p_p.h \
+ $$PWD/qdeclarativeflipable_p.h \
+ $$PWD/qdeclarativegridview_p.h \
+ $$PWD/qdeclarativeimage_p.h \
+ $$PWD/qdeclarativeimagebase_p.h \
+ $$PWD/qdeclarativeborderimage_p.h \
+ $$PWD/qdeclarativepainteditem_p.h \
+ $$PWD/qdeclarativepainteditem_p_p.h \
+ $$PWD/qdeclarativeimage_p_p.h \
+ $$PWD/qdeclarativeborderimage_p_p.h \
+ $$PWD/qdeclarativeimagebase_p_p.h \
+ $$PWD/qdeclarativeanimatedimage_p.h \
+ $$PWD/qdeclarativeanimatedimage_p_p.h \
+ $$PWD/qdeclarativeitem.h \
+ $$PWD/qdeclarativeitem_p.h \
+ $$PWD/qdeclarativefocuspanel_p.h \
+ $$PWD/qdeclarativefocusscope_p.h \
+ $$PWD/qdeclarativepositioners_p.h \
+ $$PWD/qdeclarativepositioners_p_p.h \
+ $$PWD/qdeclarativeloader_p.h \
+ $$PWD/qdeclarativeloader_p_p.h \
+ $$PWD/qdeclarativemousearea_p.h \
+ $$PWD/qdeclarativemousearea_p_p.h \
+ $$PWD/qdeclarativepath_p.h \
+ $$PWD/qdeclarativepath_p_p.h \
+ $$PWD/qdeclarativepathview_p.h \
+ $$PWD/qdeclarativepathview_p_p.h \
+ $$PWD/qdeclarativerectangle_p.h \
+ $$PWD/qdeclarativerectangle_p_p.h \
+ $$PWD/qdeclarativerepeater_p.h \
+ $$PWD/qdeclarativerepeater_p_p.h \
+ $$PWD/qdeclarativescalegrid_p_p.h \
+ $$PWD/qdeclarativetextinput_p.h \
+ $$PWD/qdeclarativetextinput_p_p.h \
+ $$PWD/qdeclarativetextedit_p.h \
+ $$PWD/qdeclarativetextedit_p_p.h \
+ $$PWD/qdeclarativetext_p.h \
+ $$PWD/qdeclarativetext_p_p.h \
+ $$PWD/qdeclarativevisualitemmodel_p.h \
+ $$PWD/qdeclarativelistview_p.h \
+ $$PWD/qdeclarativegraphicsobjectcontainer_p.h \
+ $$PWD/qdeclarativeparticles_p.h \
+ $$PWD/qdeclarativelayoutitem_p.h \
+ $$PWD/qdeclarativeitemchangelistener_p.h \
+ $$PWD/qdeclarativeeffects.cpp
SOURCES += \
- $$PWD/qmlgraphicsitemsmodule.cpp \
- $$PWD/qmlgraphicsanchors.cpp \
- $$PWD/qmlgraphicsevents.cpp \
- $$PWD/qmlgraphicsflickable.cpp \
- $$PWD/qmlgraphicsflipable.cpp \
- $$PWD/qmlgraphicsgridview.cpp \
- $$PWD/qmlgraphicsimage.cpp \
- $$PWD/qmlgraphicsborderimage.cpp \
- $$PWD/qmlgraphicsimagebase.cpp \
- $$PWD/qmlgraphicsanimatedimage.cpp \
- $$PWD/qmlgraphicspainteditem.cpp \
- $$PWD/qmlgraphicsitem.cpp \
- $$PWD/qmlgraphicsfocuspanel.cpp \
- $$PWD/qmlgraphicsfocusscope.cpp \
- $$PWD/qmlgraphicspositioners.cpp \
- $$PWD/qmlgraphicsloader.cpp \
- $$PWD/qmlgraphicsmousearea.cpp \
- $$PWD/qmlgraphicspath.cpp \
- $$PWD/qmlgraphicspathview.cpp \
- $$PWD/qmlgraphicsrectangle.cpp \
- $$PWD/qmlgraphicsrepeater.cpp \
- $$PWD/qmlgraphicsscalegrid.cpp \
- $$PWD/qmlgraphicstextinput.cpp \
- $$PWD/qmlgraphicstext.cpp \
- $$PWD/qmlgraphicstextedit.cpp \
- $$PWD/qmlgraphicsvisualitemmodel.cpp \
- $$PWD/qmlgraphicslistview.cpp \
- $$PWD/qmlgraphicsgraphicsobjectcontainer.cpp \
- $$PWD/qmlgraphicsparticles.cpp \
- $$PWD/qmlgraphicslayoutitem.cpp \
+ $$PWD/qdeclarativeitemsmodule.cpp \
+ $$PWD/qdeclarativeanchors.cpp \
+ $$PWD/qdeclarativeevents.cpp \
+ $$PWD/qdeclarativeflickable.cpp \
+ $$PWD/qdeclarativeflipable.cpp \
+ $$PWD/qdeclarativegridview.cpp \
+ $$PWD/qdeclarativeimage.cpp \
+ $$PWD/qdeclarativeborderimage.cpp \
+ $$PWD/qdeclarativeimagebase.cpp \
+ $$PWD/qdeclarativeanimatedimage.cpp \
+ $$PWD/qdeclarativepainteditem.cpp \
+ $$PWD/qdeclarativeitem.cpp \
+ $$PWD/qdeclarativefocuspanel.cpp \
+ $$PWD/qdeclarativefocusscope.cpp \
+ $$PWD/qdeclarativepositioners.cpp \
+ $$PWD/qdeclarativeloader.cpp \
+ $$PWD/qdeclarativemousearea.cpp \
+ $$PWD/qdeclarativepath.cpp \
+ $$PWD/qdeclarativepathview.cpp \
+ $$PWD/qdeclarativerectangle.cpp \
+ $$PWD/qdeclarativerepeater.cpp \
+ $$PWD/qdeclarativescalegrid.cpp \
+ $$PWD/qdeclarativetextinput.cpp \
+ $$PWD/qdeclarativetext.cpp \
+ $$PWD/qdeclarativetextedit.cpp \
+ $$PWD/qdeclarativevisualitemmodel.cpp \
+ $$PWD/qdeclarativelistview.cpp \
+ $$PWD/qdeclarativegraphicsobjectcontainer.cpp \
+ $$PWD/qdeclarativeparticles.cpp \
+ $$PWD/qdeclarativelayoutitem.cpp \
contains(QT_CONFIG, webkit) {
QT+=webkit
- SOURCES += $$PWD/qmlgraphicswebview.cpp
- HEADERS += $$PWD/qmlgraphicswebview_p.h
- HEADERS += $$PWD/qmlgraphicswebview_p_p.h
+ SOURCES += $$PWD/qdeclarativewebview.cpp
+ HEADERS += $$PWD/qdeclarativewebview_p.h
+ HEADERS += $$PWD/qdeclarativewebview_p_p.h
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp b/src/declarative/graphicsitems/qdeclarativeanchors.cpp
index 72b4717..274d778 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeanchors.cpp
@@ -39,12 +39,12 @@
**
****************************************************************************/
-#include "qmlgraphicsanchors_p_p.h"
+#include "qdeclarativeanchors_p_p.h"
-#include "qmlgraphicsitem.h"
-#include "qmlgraphicsitem_p.h"
+#include "qdeclarativeitem.h"
+#include "qdeclarativeitem_p.h"
-#include <qmlinfo.h>
+#include <qdeclarativeinfo.h>
#include <QDebug>
@@ -55,29 +55,29 @@ QT_BEGIN_NAMESPACE
//### const item?
//local position
-static qreal position(QmlGraphicsItem *item, QmlGraphicsAnchorLine::AnchorLine anchorLine)
+static qreal position(QDeclarativeItem *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
{
qreal ret = 0.0;
switch(anchorLine) {
- case QmlGraphicsAnchorLine::Left:
+ case QDeclarativeAnchorLine::Left:
ret = item->x();
break;
- case QmlGraphicsAnchorLine::Right:
+ case QDeclarativeAnchorLine::Right:
ret = item->x() + item->width();
break;
- case QmlGraphicsAnchorLine::Top:
+ case QDeclarativeAnchorLine::Top:
ret = item->y();
break;
- case QmlGraphicsAnchorLine::Bottom:
+ case QDeclarativeAnchorLine::Bottom:
ret = item->y() + item->height();
break;
- case QmlGraphicsAnchorLine::HCenter:
+ case QDeclarativeAnchorLine::HCenter:
ret = item->x() + item->width()/2;
break;
- case QmlGraphicsAnchorLine::VCenter:
+ case QDeclarativeAnchorLine::VCenter:
ret = item->y() + item->height()/2;
break;
- case QmlGraphicsAnchorLine::Baseline:
+ case QDeclarativeAnchorLine::Baseline:
ret = item->y() + item->baselineOffset();
break;
default:
@@ -88,29 +88,29 @@ static qreal position(QmlGraphicsItem *item, QmlGraphicsAnchorLine::AnchorLine a
}
//position when origin is 0,0
-static qreal adjustedPosition(QmlGraphicsItem *item, QmlGraphicsAnchorLine::AnchorLine anchorLine)
+static qreal adjustedPosition(QDeclarativeItem *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
{
int ret = 0;
switch(anchorLine) {
- case QmlGraphicsAnchorLine::Left:
+ case QDeclarativeAnchorLine::Left:
ret = 0;
break;
- case QmlGraphicsAnchorLine::Right:
+ case QDeclarativeAnchorLine::Right:
ret = item->width();
break;
- case QmlGraphicsAnchorLine::Top:
+ case QDeclarativeAnchorLine::Top:
ret = 0;
break;
- case QmlGraphicsAnchorLine::Bottom:
+ case QDeclarativeAnchorLine::Bottom:
ret = item->height();
break;
- case QmlGraphicsAnchorLine::HCenter:
+ case QDeclarativeAnchorLine::HCenter:
ret = item->width()/2;
break;
- case QmlGraphicsAnchorLine::VCenter:
+ case QDeclarativeAnchorLine::VCenter:
ret = item->height()/2;
break;
- case QmlGraphicsAnchorLine::Baseline:
+ case QDeclarativeAnchorLine::Baseline:
ret = item->baselineOffset();
break;
default:
@@ -122,28 +122,28 @@ static qreal adjustedPosition(QmlGraphicsItem *item, QmlGraphicsAnchorLine::Anch
/*!
\internal
- \class QmlGraphicsAnchors
+ \class QDeclarativeAnchors
\since 4.7
\ingroup group_layouts
- \brief The QmlGraphicsAnchors class provides a way to lay out items relative to other items.
+ \brief The QDeclarativeAnchors class provides a way to lay out items relative to other items.
\warning Currently, only anchoring to siblings or parent is supported.
*/
-QmlGraphicsAnchors::QmlGraphicsAnchors(QObject *parent)
- : QObject(*new QmlGraphicsAnchorsPrivate(0), parent)
+QDeclarativeAnchors::QDeclarativeAnchors(QObject *parent)
+ : QObject(*new QDeclarativeAnchorsPrivate(0), parent)
{
- qFatal("QmlGraphicsAnchors::QmlGraphicsAnchors(QObject*) called");
+ qFatal("QDeclarativeAnchors::QDeclarativeAnchors(QObject*) called");
}
-QmlGraphicsAnchors::QmlGraphicsAnchors(QmlGraphicsItem *item, QObject *parent)
- : QObject(*new QmlGraphicsAnchorsPrivate(item), parent)
+QDeclarativeAnchors::QDeclarativeAnchors(QDeclarativeItem *item, QObject *parent)
+ : QObject(*new QDeclarativeAnchorsPrivate(item), parent)
{
}
-QmlGraphicsAnchors::~QmlGraphicsAnchors()
+QDeclarativeAnchors::~QDeclarativeAnchors()
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
d->remDepend(d->fill);
d->remDepend(d->centerIn);
d->remDepend(d->left.item);
@@ -155,7 +155,7 @@ QmlGraphicsAnchors::~QmlGraphicsAnchors()
d->remDepend(d->baseline.item);
}
-void QmlGraphicsAnchorsPrivate::fillChanged()
+void QDeclarativeAnchorsPrivate::fillChanged()
{
if (!fill || !isItemComplete())
return;
@@ -174,12 +174,12 @@ void QmlGraphicsAnchorsPrivate::fillChanged()
--updatingFill;
} else {
// ### Make this certain :)
- qmlInfo(item) << QmlGraphicsAnchors::tr("Possible anchor loop detected on fill.");
+ qmlInfo(item) << QDeclarativeAnchors::tr("Possible anchor loop detected on fill.");
}
}
-void QmlGraphicsAnchorsPrivate::centerInChanged()
+void QDeclarativeAnchorsPrivate::centerInChanged()
{
if (!centerIn || fill || !isItemComplete())
return;
@@ -202,11 +202,11 @@ void QmlGraphicsAnchorsPrivate::centerInChanged()
--updatingCenterIn;
} else {
// ### Make this certain :)
- qmlInfo(item) << QmlGraphicsAnchors::tr("Possible anchor loop detected on centerIn.");
+ qmlInfo(item) << QDeclarativeAnchors::tr("Possible anchor loop detected on centerIn.");
}
}
-void QmlGraphicsAnchorsPrivate::clearItem(QmlGraphicsItem *item)
+void QDeclarativeAnchorsPrivate::clearItem(QDeclarativeItem *item)
{
if (!item)
return;
@@ -216,105 +216,105 @@ void QmlGraphicsAnchorsPrivate::clearItem(QmlGraphicsItem *item)
centerIn = 0;
if (left.item == item) {
left.item = 0;
- usedAnchors &= ~QmlGraphicsAnchors::HasLeftAnchor;
+ usedAnchors &= ~QDeclarativeAnchors::HasLeftAnchor;
}
if (right.item == item) {
right.item = 0;
- usedAnchors &= ~QmlGraphicsAnchors::HasRightAnchor;
+ usedAnchors &= ~QDeclarativeAnchors::HasRightAnchor;
}
if (top.item == item) {
top.item = 0;
- usedAnchors &= ~QmlGraphicsAnchors::HasTopAnchor;
+ usedAnchors &= ~QDeclarativeAnchors::HasTopAnchor;
}
if (bottom.item == item) {
bottom.item = 0;
- usedAnchors &= ~QmlGraphicsAnchors::HasBottomAnchor;
+ usedAnchors &= ~QDeclarativeAnchors::HasBottomAnchor;
}
if (vCenter.item == item) {
vCenter.item = 0;
- usedAnchors &= ~QmlGraphicsAnchors::HasVCenterAnchor;
+ usedAnchors &= ~QDeclarativeAnchors::HasVCenterAnchor;
}
if (hCenter.item == item) {
hCenter.item = 0;
- usedAnchors &= ~QmlGraphicsAnchors::HasHCenterAnchor;
+ usedAnchors &= ~QDeclarativeAnchors::HasHCenterAnchor;
}
if (baseline.item == item) {
baseline.item = 0;
- usedAnchors &= ~QmlGraphicsAnchors::HasBaselineAnchor;
+ usedAnchors &= ~QDeclarativeAnchors::HasBaselineAnchor;
}
}
-void QmlGraphicsAnchorsPrivate::addDepend(QmlGraphicsItem *item)
+void QDeclarativeAnchorsPrivate::addDepend(QDeclarativeItem *item)
{
if (!item)
return;
- QmlGraphicsItemPrivate *p =
- static_cast<QmlGraphicsItemPrivate *>(QGraphicsItemPrivate::get(item));
- p->addItemChangeListener(this, QmlGraphicsItemPrivate::Geometry);
+ QDeclarativeItemPrivate *p =
+ static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(item));
+ p->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
}
-void QmlGraphicsAnchorsPrivate::remDepend(QmlGraphicsItem *item)
+void QDeclarativeAnchorsPrivate::remDepend(QDeclarativeItem *item)
{
if (!item)
return;
- QmlGraphicsItemPrivate *p =
- static_cast<QmlGraphicsItemPrivate *>(QGraphicsItemPrivate::get(item));
- p->removeItemChangeListener(this, QmlGraphicsItemPrivate::Geometry);
+ QDeclarativeItemPrivate *p =
+ static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(item));
+ p->removeItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
}
-bool QmlGraphicsAnchorsPrivate::isItemComplete() const
+bool QDeclarativeAnchorsPrivate::isItemComplete() const
{
return componentComplete;
}
-void QmlGraphicsAnchors::classBegin()
+void QDeclarativeAnchors::classBegin()
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
d->componentComplete = false;
}
-void QmlGraphicsAnchors::componentComplete()
+void QDeclarativeAnchors::componentComplete()
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
d->componentComplete = true;
}
-void QmlGraphicsAnchorsPrivate::setItemHeight(qreal v)
+void QDeclarativeAnchorsPrivate::setItemHeight(qreal v)
{
updatingMe = true;
item->setHeight(v);
updatingMe = false;
}
-void QmlGraphicsAnchorsPrivate::setItemWidth(qreal v)
+void QDeclarativeAnchorsPrivate::setItemWidth(qreal v)
{
updatingMe = true;
item->setWidth(v);
updatingMe = false;
}
-void QmlGraphicsAnchorsPrivate::setItemX(qreal v)
+void QDeclarativeAnchorsPrivate::setItemX(qreal v)
{
updatingMe = true;
item->setX(v);
updatingMe = false;
}
-void QmlGraphicsAnchorsPrivate::setItemY(qreal v)
+void QDeclarativeAnchorsPrivate::setItemY(qreal v)
{
updatingMe = true;
item->setY(v);
updatingMe = false;
}
-void QmlGraphicsAnchorsPrivate::setItemPos(const QPointF &v)
+void QDeclarativeAnchorsPrivate::setItemPos(const QPointF &v)
{
updatingMe = true;
item->setPos(v);
updatingMe = false;
}
-void QmlGraphicsAnchorsPrivate::updateMe()
+void QDeclarativeAnchorsPrivate::updateMe()
{
if (updatingMe) {
updatingMe = false;
@@ -327,7 +327,7 @@ void QmlGraphicsAnchorsPrivate::updateMe()
updateVerticalAnchors();
}
-void QmlGraphicsAnchorsPrivate::updateOnComplete()
+void QDeclarativeAnchorsPrivate::updateOnComplete()
{
fillChanged();
centerInChanged();
@@ -335,7 +335,7 @@ void QmlGraphicsAnchorsPrivate::updateOnComplete()
updateVerticalAnchors();
}
-void QmlGraphicsAnchorsPrivate::itemGeometryChanged(QmlGraphicsItem *, const QRectF &newG, const QRectF &oldG)
+void QDeclarativeAnchorsPrivate::itemGeometryChanged(QDeclarativeItem *, const QRectF &newG, const QRectF &oldG)
{
fillChanged();
centerInChanged();
@@ -346,15 +346,15 @@ void QmlGraphicsAnchorsPrivate::itemGeometryChanged(QmlGraphicsItem *, const QRe
updateVerticalAnchors();
}
-QmlGraphicsItem *QmlGraphicsAnchors::fill() const
+QDeclarativeItem *QDeclarativeAnchors::fill() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->fill;
}
-void QmlGraphicsAnchors::setFill(QmlGraphicsItem *f)
+void QDeclarativeAnchors::setFill(QDeclarativeItem *f)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (d->fill == f)
return;
@@ -375,20 +375,20 @@ void QmlGraphicsAnchors::setFill(QmlGraphicsItem *f)
d->fillChanged();
}
-void QmlGraphicsAnchors::resetFill()
+void QDeclarativeAnchors::resetFill()
{
setFill(0);
}
-QmlGraphicsItem *QmlGraphicsAnchors::centerIn() const
+QDeclarativeItem *QDeclarativeAnchors::centerIn() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->centerIn;
}
-void QmlGraphicsAnchors::setCenterIn(QmlGraphicsItem* c)
+void QDeclarativeAnchors::setCenterIn(QDeclarativeItem* c)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (d->centerIn == c)
return;
@@ -410,16 +410,16 @@ void QmlGraphicsAnchors::setCenterIn(QmlGraphicsItem* c)
d->centerInChanged();
}
-void QmlGraphicsAnchors::resetCenterIn()
+void QDeclarativeAnchors::resetCenterIn()
{
setCenterIn(0);
}
-bool QmlGraphicsAnchorsPrivate::calcStretch(const QmlGraphicsAnchorLine &edge1,
- const QmlGraphicsAnchorLine &edge2,
+bool QDeclarativeAnchorsPrivate::calcStretch(const QDeclarativeAnchorLine &edge1,
+ const QDeclarativeAnchorLine &edge2,
int offset1,
int offset2,
- QmlGraphicsAnchorLine::AnchorLine line,
+ QDeclarativeAnchorLine::AnchorLine line,
int &stretch)
{
bool edge1IsParent = (edge1.item == item->parentItem());
@@ -444,21 +444,21 @@ bool QmlGraphicsAnchorsPrivate::calcStretch(const QmlGraphicsAnchorLine &edge1,
return invalid;
}
-void QmlGraphicsAnchorsPrivate::updateVerticalAnchors()
+void QDeclarativeAnchorsPrivate::updateVerticalAnchors()
{
if (fill || centerIn || !isItemComplete())
return;
if (updatingVerticalAnchor < 2) {
++updatingVerticalAnchor;
- if (usedAnchors & QmlGraphicsAnchors::HasTopAnchor) {
+ if (usedAnchors & QDeclarativeAnchors::HasTopAnchor) {
//Handle stretching
bool invalid = true;
int height = 0;
- if (usedAnchors & QmlGraphicsAnchors::HasBottomAnchor) {
- invalid = calcStretch(top, bottom, topMargin, -bottomMargin, QmlGraphicsAnchorLine::Top, height);
- } else if (usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor) {
- invalid = calcStretch(top, vCenter, topMargin, vCenterOffset, QmlGraphicsAnchorLine::Top, height);
+ if (usedAnchors & QDeclarativeAnchors::HasBottomAnchor) {
+ invalid = calcStretch(top, bottom, topMargin, -bottomMargin, QDeclarativeAnchorLine::Top, height);
+ } else if (usedAnchors & QDeclarativeAnchors::HasVCenterAnchor) {
+ invalid = calcStretch(top, vCenter, topMargin, vCenterOffset, QDeclarativeAnchorLine::Top, height);
height *= 2;
}
if (!invalid)
@@ -470,12 +470,12 @@ void QmlGraphicsAnchorsPrivate::updateVerticalAnchors()
} else if (top.item->parentItem() == item->parentItem()) {
setItemY(position(top.item, top.anchorLine) + topMargin);
}
- } else if (usedAnchors & QmlGraphicsAnchors::HasBottomAnchor) {
+ } else if (usedAnchors & QDeclarativeAnchors::HasBottomAnchor) {
//Handle stretching (top + bottom case is handled above)
- if (usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor) {
+ if (usedAnchors & QDeclarativeAnchors::HasVCenterAnchor) {
int height = 0;
bool invalid = calcStretch(vCenter, bottom, vCenterOffset, -bottomMargin,
- QmlGraphicsAnchorLine::Top, height);
+ QDeclarativeAnchorLine::Top, height);
if (!invalid)
setItemHeight(height*2);
}
@@ -486,7 +486,7 @@ void QmlGraphicsAnchorsPrivate::updateVerticalAnchors()
} else if (bottom.item->parentItem() == item->parentItem()) {
setItemY(position(bottom.item, bottom.anchorLine) - item->height() - bottomMargin);
}
- } else if (usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor) {
+ } else if (usedAnchors & QDeclarativeAnchors::HasVCenterAnchor) {
//(stetching handled above)
//Handle vCenter
@@ -496,7 +496,7 @@ void QmlGraphicsAnchorsPrivate::updateVerticalAnchors()
} else if (vCenter.item->parentItem() == item->parentItem()) {
setItemY(position(vCenter.item, vCenter.anchorLine) - item->height()/2 + vCenterOffset);
}
- } else if (usedAnchors & QmlGraphicsAnchors::HasBaselineAnchor) {
+ } else if (usedAnchors & QDeclarativeAnchors::HasBaselineAnchor) {
//Handle baseline
if (baseline.item == item->parentItem()) {
setItemY(adjustedPosition(baseline.item, baseline.anchorLine)
@@ -509,11 +509,11 @@ void QmlGraphicsAnchorsPrivate::updateVerticalAnchors()
--updatingVerticalAnchor;
} else {
// ### Make this certain :)
- qmlInfo(item) << QmlGraphicsAnchors::tr("Possible anchor loop detected on vertical anchor.");
+ qmlInfo(item) << QDeclarativeAnchors::tr("Possible anchor loop detected on vertical anchor.");
}
}
-void QmlGraphicsAnchorsPrivate::updateHorizontalAnchors()
+void QDeclarativeAnchorsPrivate::updateHorizontalAnchors()
{
if (fill || centerIn || !isItemComplete())
return;
@@ -521,14 +521,14 @@ void QmlGraphicsAnchorsPrivate::updateHorizontalAnchors()
if (updatingHorizontalAnchor < 2) {
++updatingHorizontalAnchor;
- if (usedAnchors & QmlGraphicsAnchors::HasLeftAnchor) {
+ if (usedAnchors & QDeclarativeAnchors::HasLeftAnchor) {
//Handle stretching
bool invalid = true;
int width = 0;
- if (usedAnchors & QmlGraphicsAnchors::HasRightAnchor) {
- invalid = calcStretch(left, right, leftMargin, -rightMargin, QmlGraphicsAnchorLine::Left, width);
- } else if (usedAnchors & QmlGraphicsAnchors::HasHCenterAnchor) {
- invalid = calcStretch(left, hCenter, leftMargin, hCenterOffset, QmlGraphicsAnchorLine::Left, width);
+ if (usedAnchors & QDeclarativeAnchors::HasRightAnchor) {
+ invalid = calcStretch(left, right, leftMargin, -rightMargin, QDeclarativeAnchorLine::Left, width);
+ } else if (usedAnchors & QDeclarativeAnchors::HasHCenterAnchor) {
+ invalid = calcStretch(left, hCenter, leftMargin, hCenterOffset, QDeclarativeAnchorLine::Left, width);
width *= 2;
}
if (!invalid)
@@ -540,12 +540,12 @@ void QmlGraphicsAnchorsPrivate::updateHorizontalAnchors()
} else if (left.item->parentItem() == item->parentItem()) {
setItemX(position(left.item, left.anchorLine) + leftMargin);
}
- } else if (usedAnchors & QmlGraphicsAnchors::HasRightAnchor) {
+ } else if (usedAnchors & QDeclarativeAnchors::HasRightAnchor) {
//Handle stretching (left + right case is handled in updateLeftAnchor)
- if (usedAnchors & QmlGraphicsAnchors::HasHCenterAnchor) {
+ if (usedAnchors & QDeclarativeAnchors::HasHCenterAnchor) {
int width = 0;
bool invalid = calcStretch(hCenter, right, hCenterOffset, -rightMargin,
- QmlGraphicsAnchorLine::Left, width);
+ QDeclarativeAnchorLine::Left, width);
if (!invalid)
setItemWidth(width*2);
}
@@ -556,7 +556,7 @@ void QmlGraphicsAnchorsPrivate::updateHorizontalAnchors()
} else if (right.item->parentItem() == item->parentItem()) {
setItemX(position(right.item, right.anchorLine) - item->width() - rightMargin);
}
- } else if (usedAnchors & QmlGraphicsAnchors::HasHCenterAnchor) {
+ } else if (usedAnchors & QDeclarativeAnchors::HasHCenterAnchor) {
//Handle hCenter
if (hCenter.item == item->parentItem()) {
setItemX(adjustedPosition(hCenter.item, hCenter.anchorLine) - item->width()/2 + hCenterOffset);
@@ -568,19 +568,19 @@ void QmlGraphicsAnchorsPrivate::updateHorizontalAnchors()
--updatingHorizontalAnchor;
} else {
// ### Make this certain :)
- qmlInfo(item) << QmlGraphicsAnchors::tr("Possible anchor loop detected on horizontal anchor.");
+ qmlInfo(item) << QDeclarativeAnchors::tr("Possible anchor loop detected on horizontal anchor.");
}
}
-QmlGraphicsAnchorLine QmlGraphicsAnchors::top() const
+QDeclarativeAnchorLine QDeclarativeAnchors::top() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->top;
}
-void QmlGraphicsAnchors::setTop(const QmlGraphicsAnchorLine &edge)
+void QDeclarativeAnchors::setTop(const QDeclarativeAnchorLine &edge)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (!d->checkVAnchorValid(edge) || d->top == edge)
return;
@@ -598,25 +598,25 @@ void QmlGraphicsAnchors::setTop(const QmlGraphicsAnchorLine &edge)
d->updateVerticalAnchors();
}
-void QmlGraphicsAnchors::resetTop()
+void QDeclarativeAnchors::resetTop()
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
d->usedAnchors &= ~HasTopAnchor;
d->remDepend(d->top.item);
- d->top = QmlGraphicsAnchorLine();
+ d->top = QDeclarativeAnchorLine();
emit topChanged();
d->updateVerticalAnchors();
}
-QmlGraphicsAnchorLine QmlGraphicsAnchors::bottom() const
+QDeclarativeAnchorLine QDeclarativeAnchors::bottom() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->bottom;
}
-void QmlGraphicsAnchors::setBottom(const QmlGraphicsAnchorLine &edge)
+void QDeclarativeAnchors::setBottom(const QDeclarativeAnchorLine &edge)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (!d->checkVAnchorValid(edge) || d->bottom == edge)
return;
@@ -634,25 +634,25 @@ void QmlGraphicsAnchors::setBottom(const QmlGraphicsAnchorLine &edge)
d->updateVerticalAnchors();
}
-void QmlGraphicsAnchors::resetBottom()
+void QDeclarativeAnchors::resetBottom()
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
d->usedAnchors &= ~HasBottomAnchor;
d->remDepend(d->bottom.item);
- d->bottom = QmlGraphicsAnchorLine();
+ d->bottom = QDeclarativeAnchorLine();
emit bottomChanged();
d->updateVerticalAnchors();
}
-QmlGraphicsAnchorLine QmlGraphicsAnchors::verticalCenter() const
+QDeclarativeAnchorLine QDeclarativeAnchors::verticalCenter() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->vCenter;
}
-void QmlGraphicsAnchors::setVerticalCenter(const QmlGraphicsAnchorLine &edge)
+void QDeclarativeAnchors::setVerticalCenter(const QDeclarativeAnchorLine &edge)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (!d->checkVAnchorValid(edge) || d->vCenter == edge)
return;
@@ -670,25 +670,25 @@ void QmlGraphicsAnchors::setVerticalCenter(const QmlGraphicsAnchorLine &edge)
d->updateVerticalAnchors();
}
-void QmlGraphicsAnchors::resetVerticalCenter()
+void QDeclarativeAnchors::resetVerticalCenter()
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
d->usedAnchors &= ~HasVCenterAnchor;
d->remDepend(d->vCenter.item);
- d->vCenter = QmlGraphicsAnchorLine();
+ d->vCenter = QDeclarativeAnchorLine();
emit verticalCenterChanged();
d->updateVerticalAnchors();
}
-QmlGraphicsAnchorLine QmlGraphicsAnchors::baseline() const
+QDeclarativeAnchorLine QDeclarativeAnchors::baseline() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->baseline;
}
-void QmlGraphicsAnchors::setBaseline(const QmlGraphicsAnchorLine &edge)
+void QDeclarativeAnchors::setBaseline(const QDeclarativeAnchorLine &edge)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (!d->checkVAnchorValid(edge) || d->baseline == edge)
return;
@@ -706,25 +706,25 @@ void QmlGraphicsAnchors::setBaseline(const QmlGraphicsAnchorLine &edge)
d->updateVerticalAnchors();
}
-void QmlGraphicsAnchors::resetBaseline()
+void QDeclarativeAnchors::resetBaseline()
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
d->usedAnchors &= ~HasBaselineAnchor;
d->remDepend(d->baseline.item);
- d->baseline = QmlGraphicsAnchorLine();
+ d->baseline = QDeclarativeAnchorLine();
emit baselineChanged();
d->updateVerticalAnchors();
}
-QmlGraphicsAnchorLine QmlGraphicsAnchors::left() const
+QDeclarativeAnchorLine QDeclarativeAnchors::left() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->left;
}
-void QmlGraphicsAnchors::setLeft(const QmlGraphicsAnchorLine &edge)
+void QDeclarativeAnchors::setLeft(const QDeclarativeAnchorLine &edge)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (!d->checkHAnchorValid(edge) || d->left == edge)
return;
@@ -742,25 +742,25 @@ void QmlGraphicsAnchors::setLeft(const QmlGraphicsAnchorLine &edge)
d->updateHorizontalAnchors();
}
-void QmlGraphicsAnchors::resetLeft()
+void QDeclarativeAnchors::resetLeft()
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
d->usedAnchors &= ~HasLeftAnchor;
d->remDepend(d->left.item);
- d->left = QmlGraphicsAnchorLine();
+ d->left = QDeclarativeAnchorLine();
emit leftChanged();
d->updateHorizontalAnchors();
}
-QmlGraphicsAnchorLine QmlGraphicsAnchors::right() const
+QDeclarativeAnchorLine QDeclarativeAnchors::right() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->right;
}
-void QmlGraphicsAnchors::setRight(const QmlGraphicsAnchorLine &edge)
+void QDeclarativeAnchors::setRight(const QDeclarativeAnchorLine &edge)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (!d->checkHAnchorValid(edge) || d->right == edge)
return;
@@ -778,25 +778,25 @@ void QmlGraphicsAnchors::setRight(const QmlGraphicsAnchorLine &edge)
d->updateHorizontalAnchors();
}
-void QmlGraphicsAnchors::resetRight()
+void QDeclarativeAnchors::resetRight()
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
d->usedAnchors &= ~HasRightAnchor;
d->remDepend(d->right.item);
- d->right = QmlGraphicsAnchorLine();
+ d->right = QDeclarativeAnchorLine();
emit rightChanged();
d->updateHorizontalAnchors();
}
-QmlGraphicsAnchorLine QmlGraphicsAnchors::horizontalCenter() const
+QDeclarativeAnchorLine QDeclarativeAnchors::horizontalCenter() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->hCenter;
}
-void QmlGraphicsAnchors::setHorizontalCenter(const QmlGraphicsAnchorLine &edge)
+void QDeclarativeAnchors::setHorizontalCenter(const QDeclarativeAnchorLine &edge)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (!d->checkHAnchorValid(edge) || d->hCenter == edge)
return;
@@ -814,25 +814,25 @@ void QmlGraphicsAnchors::setHorizontalCenter(const QmlGraphicsAnchorLine &edge)
d->updateHorizontalAnchors();
}
-void QmlGraphicsAnchors::resetHorizontalCenter()
+void QDeclarativeAnchors::resetHorizontalCenter()
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
d->usedAnchors &= ~HasHCenterAnchor;
d->remDepend(d->hCenter.item);
- d->hCenter = QmlGraphicsAnchorLine();
+ d->hCenter = QDeclarativeAnchorLine();
emit horizontalCenterChanged();
d->updateHorizontalAnchors();
}
-qreal QmlGraphicsAnchors::leftMargin() const
+qreal QDeclarativeAnchors::leftMargin() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->leftMargin;
}
-void QmlGraphicsAnchors::setLeftMargin(qreal offset)
+void QDeclarativeAnchors::setLeftMargin(qreal offset)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (d->leftMargin == offset)
return;
d->leftMargin = offset;
@@ -843,15 +843,15 @@ void QmlGraphicsAnchors::setLeftMargin(qreal offset)
emit leftMarginChanged();
}
-qreal QmlGraphicsAnchors::rightMargin() const
+qreal QDeclarativeAnchors::rightMargin() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->rightMargin;
}
-void QmlGraphicsAnchors::setRightMargin(qreal offset)
+void QDeclarativeAnchors::setRightMargin(qreal offset)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (d->rightMargin == offset)
return;
d->rightMargin = offset;
@@ -862,15 +862,15 @@ void QmlGraphicsAnchors::setRightMargin(qreal offset)
emit rightMarginChanged();
}
-qreal QmlGraphicsAnchors::margins() const
+qreal QDeclarativeAnchors::margins() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->margins;
}
-void QmlGraphicsAnchors::setMargins(qreal offset)
+void QDeclarativeAnchors::setMargins(qreal offset)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (d->margins == offset)
return;
//###Is it significantly faster to set them directly so we can call fillChanged only once?
@@ -887,15 +887,15 @@ void QmlGraphicsAnchors::setMargins(qreal offset)
}
-qreal QmlGraphicsAnchors::horizontalCenterOffset() const
+qreal QDeclarativeAnchors::horizontalCenterOffset() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->hCenterOffset;
}
-void QmlGraphicsAnchors::setHorizontalCenterOffset(qreal offset)
+void QDeclarativeAnchors::setHorizontalCenterOffset(qreal offset)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (d->hCenterOffset == offset)
return;
d->hCenterOffset = offset;
@@ -906,15 +906,15 @@ void QmlGraphicsAnchors::setHorizontalCenterOffset(qreal offset)
emit horizontalCenterOffsetChanged();
}
-qreal QmlGraphicsAnchors::topMargin() const
+qreal QDeclarativeAnchors::topMargin() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->topMargin;
}
-void QmlGraphicsAnchors::setTopMargin(qreal offset)
+void QDeclarativeAnchors::setTopMargin(qreal offset)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (d->topMargin == offset)
return;
d->topMargin = offset;
@@ -925,15 +925,15 @@ void QmlGraphicsAnchors::setTopMargin(qreal offset)
emit topMarginChanged();
}
-qreal QmlGraphicsAnchors::bottomMargin() const
+qreal QDeclarativeAnchors::bottomMargin() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->bottomMargin;
}
-void QmlGraphicsAnchors::setBottomMargin(qreal offset)
+void QDeclarativeAnchors::setBottomMargin(qreal offset)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (d->bottomMargin == offset)
return;
d->bottomMargin = offset;
@@ -944,15 +944,15 @@ void QmlGraphicsAnchors::setBottomMargin(qreal offset)
emit bottomMarginChanged();
}
-qreal QmlGraphicsAnchors::verticalCenterOffset() const
+qreal QDeclarativeAnchors::verticalCenterOffset() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->vCenterOffset;
}
-void QmlGraphicsAnchors::setVerticalCenterOffset(qreal offset)
+void QDeclarativeAnchors::setVerticalCenterOffset(qreal offset)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (d->vCenterOffset == offset)
return;
d->vCenterOffset = offset;
@@ -963,15 +963,15 @@ void QmlGraphicsAnchors::setVerticalCenterOffset(qreal offset)
emit verticalCenterOffsetChanged();
}
-qreal QmlGraphicsAnchors::baselineOffset() const
+qreal QDeclarativeAnchors::baselineOffset() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->baselineOffset;
}
-void QmlGraphicsAnchors::setBaselineOffset(qreal offset)
+void QDeclarativeAnchors::setBaselineOffset(qreal offset)
{
- Q_D(QmlGraphicsAnchors);
+ Q_D(QDeclarativeAnchors);
if (d->baselineOffset == offset)
return;
d->baselineOffset = offset;
@@ -979,81 +979,81 @@ void QmlGraphicsAnchors::setBaselineOffset(qreal offset)
emit baselineOffsetChanged();
}
-QmlGraphicsAnchors::UsedAnchors QmlGraphicsAnchors::usedAnchors() const
+QDeclarativeAnchors::UsedAnchors QDeclarativeAnchors::usedAnchors() const
{
- Q_D(const QmlGraphicsAnchors);
+ Q_D(const QDeclarativeAnchors);
return d->usedAnchors;
}
-bool QmlGraphicsAnchorsPrivate::checkHValid() const
+bool QDeclarativeAnchorsPrivate::checkHValid() const
{
- if (usedAnchors & QmlGraphicsAnchors::HasLeftAnchor &&
- usedAnchors & QmlGraphicsAnchors::HasRightAnchor &&
- usedAnchors & QmlGraphicsAnchors::HasHCenterAnchor) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot specify left, right, and hcenter anchors.");
+ if (usedAnchors & QDeclarativeAnchors::HasLeftAnchor &&
+ usedAnchors & QDeclarativeAnchors::HasRightAnchor &&
+ usedAnchors & QDeclarativeAnchors::HasHCenterAnchor) {
+ qmlInfo(item) << QDeclarativeAnchors::tr("Cannot specify left, right, and hcenter anchors.");
return false;
}
return true;
}
-bool QmlGraphicsAnchorsPrivate::checkHAnchorValid(QmlGraphicsAnchorLine anchor) const
+bool QDeclarativeAnchorsPrivate::checkHAnchorValid(QDeclarativeAnchorLine anchor) const
{
if (!anchor.item) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor to a null item.");
+ qmlInfo(item) << QDeclarativeAnchors::tr("Cannot anchor to a null item.");
return false;
- } else if (anchor.anchorLine & QmlGraphicsAnchorLine::Vertical_Mask) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor a horizontal edge to a vertical edge.");
+ } else if (anchor.anchorLine & QDeclarativeAnchorLine::Vertical_Mask) {
+ qmlInfo(item) << QDeclarativeAnchors::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("Cannot anchor to an item that isn't a parent or sibling.");
+ qmlInfo(item) << QDeclarativeAnchors::tr("Cannot anchor to an item that isn't a parent or sibling.");
return false;
} else if (anchor.item == item) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor item to self.");
+ qmlInfo(item) << QDeclarativeAnchors::tr("Cannot anchor item to self.");
return false;
}
return true;
}
-bool QmlGraphicsAnchorsPrivate::checkVValid() const
+bool QDeclarativeAnchorsPrivate::checkVValid() const
{
- if (usedAnchors & QmlGraphicsAnchors::HasTopAnchor &&
- usedAnchors & QmlGraphicsAnchors::HasBottomAnchor &&
- usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot specify top, bottom, and vcenter anchors.");
+ if (usedAnchors & QDeclarativeAnchors::HasTopAnchor &&
+ usedAnchors & QDeclarativeAnchors::HasBottomAnchor &&
+ usedAnchors & QDeclarativeAnchors::HasVCenterAnchor) {
+ qmlInfo(item) << QDeclarativeAnchors::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 cannot be used in conjunction with top, bottom, or vcenter anchors.");
+ } else if (usedAnchors & QDeclarativeAnchors::HasBaselineAnchor &&
+ (usedAnchors & QDeclarativeAnchors::HasTopAnchor ||
+ usedAnchors & QDeclarativeAnchors::HasBottomAnchor ||
+ usedAnchors & QDeclarativeAnchors::HasVCenterAnchor)) {
+ qmlInfo(item) << QDeclarativeAnchors::tr("Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors.");
return false;
}
return true;
}
-bool QmlGraphicsAnchorsPrivate::checkVAnchorValid(QmlGraphicsAnchorLine anchor) const
+bool QDeclarativeAnchorsPrivate::checkVAnchorValid(QDeclarativeAnchorLine anchor) const
{
if (!anchor.item) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor to a null item.");
+ qmlInfo(item) << QDeclarativeAnchors::tr("Cannot anchor to a null item.");
return false;
- } else if (anchor.anchorLine & QmlGraphicsAnchorLine::Horizontal_Mask) {
- qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor a vertical edge to a horizontal edge.");
+ } else if (anchor.anchorLine & QDeclarativeAnchorLine::Horizontal_Mask) {
+ qmlInfo(item) << QDeclarativeAnchors::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("Cannot anchor to an item that isn't a parent or sibling.");
+ qmlInfo(item) << QDeclarativeAnchors::tr("Cannot anchor to an item that isn't a parent or sibling.");
return false;
} else if (anchor.item == item){
- qmlInfo(item) << QmlGraphicsAnchors::tr("Cannot anchor item to self.");
+ qmlInfo(item) << QDeclarativeAnchors::tr("Cannot anchor item to self.");
return false;
}
return true;
}
-#include <moc_qmlgraphicsanchors_p.cpp>
+#include <moc_qdeclarativeanchors_p.cpp>
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors_p.h b/src/declarative/graphicsitems/qdeclarativeanchors_p.h
index 41911ff..0b97e8c 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanchors_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeanchors_p.h
@@ -39,12 +39,12 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSANCHORS_H
-#define QMLGRAPHICSANCHORS_H
+#ifndef QDECLARATIVEANCHORS_H
+#define QDECLARATIVEANCHORS_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtCore/QObject>
@@ -54,19 +54,19 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsAnchorsPrivate;
-class QmlGraphicsAnchorLine;
-class Q_DECLARATIVE_EXPORT QmlGraphicsAnchors : public QObject
+class QDeclarativeAnchorsPrivate;
+class QDeclarativeAnchorLine;
+class Q_DECLARATIVE_EXPORT QDeclarativeAnchors : public QObject
{
Q_OBJECT
- Q_PROPERTY(QmlGraphicsAnchorLine left READ left WRITE setLeft RESET resetLeft NOTIFY leftChanged)
- Q_PROPERTY(QmlGraphicsAnchorLine right READ right WRITE setRight RESET resetRight NOTIFY rightChanged)
- Q_PROPERTY(QmlGraphicsAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter NOTIFY horizontalCenterChanged)
- Q_PROPERTY(QmlGraphicsAnchorLine top READ top WRITE setTop RESET resetTop NOTIFY topChanged)
- Q_PROPERTY(QmlGraphicsAnchorLine bottom READ bottom WRITE setBottom RESET resetBottom NOTIFY bottomChanged)
- Q_PROPERTY(QmlGraphicsAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter NOTIFY verticalCenterChanged)
- Q_PROPERTY(QmlGraphicsAnchorLine baseline READ baseline WRITE setBaseline RESET resetBaseline NOTIFY baselineChanged)
+ Q_PROPERTY(QDeclarativeAnchorLine left READ left WRITE setLeft RESET resetLeft NOTIFY leftChanged)
+ Q_PROPERTY(QDeclarativeAnchorLine right READ right WRITE setRight RESET resetRight NOTIFY rightChanged)
+ Q_PROPERTY(QDeclarativeAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter NOTIFY horizontalCenterChanged)
+ Q_PROPERTY(QDeclarativeAnchorLine top READ top WRITE setTop RESET resetTop NOTIFY topChanged)
+ Q_PROPERTY(QDeclarativeAnchorLine bottom READ bottom WRITE setBottom RESET resetBottom NOTIFY bottomChanged)
+ Q_PROPERTY(QDeclarativeAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter NOTIFY verticalCenterChanged)
+ Q_PROPERTY(QDeclarativeAnchorLine baseline READ baseline WRITE setBaseline RESET resetBaseline NOTIFY baselineChanged)
Q_PROPERTY(qreal margins READ margins WRITE setMargins NOTIFY marginsChanged)
Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged)
Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged)
@@ -75,13 +75,13 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsAnchors : public QObject
Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged)
Q_PROPERTY(qreal verticalCenterOffset READ verticalCenterOffset WRITE setVerticalCenterOffset NOTIFY verticalCenterOffsetChanged())
Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged())
- Q_PROPERTY(QmlGraphicsItem *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged)
- Q_PROPERTY(QmlGraphicsItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged)
+ Q_PROPERTY(QDeclarativeItem *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged)
+ Q_PROPERTY(QDeclarativeItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged)
public:
- QmlGraphicsAnchors(QObject *parent=0);
- QmlGraphicsAnchors(QmlGraphicsItem *item, QObject *parent=0);
- virtual ~QmlGraphicsAnchors();
+ QDeclarativeAnchors(QObject *parent=0);
+ QDeclarativeAnchors(QDeclarativeItem *item, QObject *parent=0);
+ virtual ~QDeclarativeAnchors();
enum UsedAnchor {
HasLeftAnchor = 0x01,
@@ -96,32 +96,32 @@ public:
};
Q_DECLARE_FLAGS(UsedAnchors, UsedAnchor)
- QmlGraphicsAnchorLine left() const;
- void setLeft(const QmlGraphicsAnchorLine &edge);
+ QDeclarativeAnchorLine left() const;
+ void setLeft(const QDeclarativeAnchorLine &edge);
void resetLeft();
- QmlGraphicsAnchorLine right() const;
- void setRight(const QmlGraphicsAnchorLine &edge);
+ QDeclarativeAnchorLine right() const;
+ void setRight(const QDeclarativeAnchorLine &edge);
void resetRight();
- QmlGraphicsAnchorLine horizontalCenter() const;
- void setHorizontalCenter(const QmlGraphicsAnchorLine &edge);
+ QDeclarativeAnchorLine horizontalCenter() const;
+ void setHorizontalCenter(const QDeclarativeAnchorLine &edge);
void resetHorizontalCenter();
- QmlGraphicsAnchorLine top() const;
- void setTop(const QmlGraphicsAnchorLine &edge);
+ QDeclarativeAnchorLine top() const;
+ void setTop(const QDeclarativeAnchorLine &edge);
void resetTop();
- QmlGraphicsAnchorLine bottom() const;
- void setBottom(const QmlGraphicsAnchorLine &edge);
+ QDeclarativeAnchorLine bottom() const;
+ void setBottom(const QDeclarativeAnchorLine &edge);
void resetBottom();
- QmlGraphicsAnchorLine verticalCenter() const;
- void setVerticalCenter(const QmlGraphicsAnchorLine &edge);
+ QDeclarativeAnchorLine verticalCenter() const;
+ void setVerticalCenter(const QDeclarativeAnchorLine &edge);
void resetVerticalCenter();
- QmlGraphicsAnchorLine baseline() const;
- void setBaseline(const QmlGraphicsAnchorLine &edge);
+ QDeclarativeAnchorLine baseline() const;
+ void setBaseline(const QDeclarativeAnchorLine &edge);
void resetBaseline();
qreal leftMargin() const;
@@ -148,12 +148,12 @@ public:
qreal baselineOffset() const;
void setBaselineOffset(qreal);
- QmlGraphicsItem *fill() const;
- void setFill(QmlGraphicsItem *);
+ QDeclarativeItem *fill() const;
+ void setFill(QDeclarativeItem *);
void resetFill();
- QmlGraphicsItem *centerIn() const;
- void setCenterIn(QmlGraphicsItem *);
+ QDeclarativeItem *centerIn() const;
+ void setCenterIn(QDeclarativeItem *);
void resetCenterIn();
UsedAnchors usedAnchors() const;
@@ -181,15 +181,15 @@ Q_SIGNALS:
void baselineOffsetChanged();
private:
- friend class QmlGraphicsItem;
- Q_DISABLE_COPY(QmlGraphicsAnchors)
- Q_DECLARE_PRIVATE(QmlGraphicsAnchors)
+ friend class QDeclarativeItem;
+ Q_DISABLE_COPY(QDeclarativeAnchors)
+ Q_DECLARE_PRIVATE(QDeclarativeAnchors)
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QmlGraphicsAnchors::UsedAnchors)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeAnchors::UsedAnchors)
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsAnchors)
+QML_DECLARE_TYPE(QDeclarativeAnchors)
QT_END_HEADER
diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h b/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h
index a2e41d3..d9d7ffa 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanchors_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSANCHORS_P_H
-#define QMLGRAPHICSANCHORS_P_H
+#ifndef QDECLARATIVEANCHORS_P_H
+#define QDECLARATIVEANCHORS_P_H
//
// W A R N I N G
@@ -53,16 +53,16 @@
// We mean it.
//
-#include "qmlgraphicsanchors_p.h"
-#include "qmlgraphicsitemchangelistener_p.h"
+#include "qdeclarativeanchors_p.h"
+#include "qdeclarativeitemchangelistener_p.h"
#include <private/qobject_p.h>
QT_BEGIN_NAMESPACE
-class QmlGraphicsAnchorLine
+class QDeclarativeAnchorLine
{
public:
- QmlGraphicsAnchorLine() : item(0), anchorLine(Invalid)
+ QDeclarativeAnchorLine() : item(0), anchorLine(Invalid)
{
}
@@ -79,20 +79,20 @@ public:
Vertical_Mask = Top | Bottom | VCenter | Baseline
};
- QmlGraphicsItem *item;
+ QDeclarativeItem *item;
AnchorLine anchorLine;
- bool operator==(const QmlGraphicsAnchorLine& other) const
+ bool operator==(const QDeclarativeAnchorLine& other) const
{
return item == other.item && anchorLine == other.anchorLine;
}
};
-class QmlGraphicsAnchorsPrivate : public QObjectPrivate, public QmlGraphicsItemChangeListener
+class QDeclarativeAnchorsPrivate : public QObjectPrivate, public QDeclarativeItemChangeListener
{
- Q_DECLARE_PUBLIC(QmlGraphicsAnchors)
+ Q_DECLARE_PUBLIC(QDeclarativeAnchors)
public:
- QmlGraphicsAnchorsPrivate(QmlGraphicsItem *i)
+ QDeclarativeAnchorsPrivate(QDeclarativeItem *i)
: updatingMe(false), updatingHorizontalAnchor(0),
updatingVerticalAnchor(0), updatingFill(0), updatingCenterIn(0), item(i), usedAnchors(0), fill(0),
centerIn(0), leftMargin(0), rightMargin(0), topMargin(0), bottomMargin(0),
@@ -105,10 +105,10 @@ public:
{
}
- void clearItem(QmlGraphicsItem *);
+ void clearItem(QDeclarativeItem *);
- void addDepend(QmlGraphicsItem *);
- void remDepend(QmlGraphicsItem *);
+ void addDepend(QDeclarativeItem *);
+ void remDepend(QDeclarativeItem *);
bool isItemComplete() const;
bool updatingMe;
@@ -126,34 +126,34 @@ public:
void updateOnComplete();
void updateMe();
- // QmlGraphicsItemGeometryListener interface
- void itemGeometryChanged(QmlGraphicsItem *, const QRectF &, const QRectF &);
- QmlGraphicsAnchorsPrivate *anchorPrivate() { return this; }
+ // QDeclarativeItemGeometryListener interface
+ void itemGeometryChanged(QDeclarativeItem *, const QRectF &, const QRectF &);
+ QDeclarativeAnchorsPrivate *anchorPrivate() { return this; }
bool checkHValid() const;
bool checkVValid() const;
- bool checkHAnchorValid(QmlGraphicsAnchorLine anchor) const;
- bool checkVAnchorValid(QmlGraphicsAnchorLine anchor) const;
- bool calcStretch(const QmlGraphicsAnchorLine &edge1, const QmlGraphicsAnchorLine &edge2, int offset1, int offset2, QmlGraphicsAnchorLine::AnchorLine line, int &stretch);
+ bool checkHAnchorValid(QDeclarativeAnchorLine anchor) const;
+ bool checkVAnchorValid(QDeclarativeAnchorLine anchor) const;
+ bool calcStretch(const QDeclarativeAnchorLine &edge1, const QDeclarativeAnchorLine &edge2, int offset1, int offset2, QDeclarativeAnchorLine::AnchorLine line, int &stretch);
void updateHorizontalAnchors();
void updateVerticalAnchors();
void fillChanged();
void centerInChanged();
- QmlGraphicsItem *item;
- QmlGraphicsAnchors::UsedAnchors usedAnchors;
+ QDeclarativeItem *item;
+ QDeclarativeAnchors::UsedAnchors usedAnchors;
- QmlGraphicsItem *fill;
- QmlGraphicsItem *centerIn;
+ QDeclarativeItem *fill;
+ QDeclarativeItem *centerIn;
- QmlGraphicsAnchorLine left;
- QmlGraphicsAnchorLine right;
- QmlGraphicsAnchorLine top;
- QmlGraphicsAnchorLine bottom;
- QmlGraphicsAnchorLine vCenter;
- QmlGraphicsAnchorLine hCenter;
- QmlGraphicsAnchorLine baseline;
+ QDeclarativeAnchorLine left;
+ QDeclarativeAnchorLine right;
+ QDeclarativeAnchorLine top;
+ QDeclarativeAnchorLine bottom;
+ QDeclarativeAnchorLine vCenter;
+ QDeclarativeAnchorLine hCenter;
+ QDeclarativeAnchorLine baseline;
qreal leftMargin;
qreal rightMargin;
@@ -169,6 +169,6 @@ public:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QmlGraphicsAnchorLine)
+Q_DECLARE_METATYPE(QDeclarativeAnchorLine)
#endif
diff --git a/src/declarative/graphicsitems/qmlgraphicsanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
index 4dea33c..20b1de3 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanimatedimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#include "qmlgraphicsanimatedimage_p.h"
-#include "qmlgraphicsanimatedimage_p_p.h"
+#include "qdeclarativeanimatedimage_p.h"
+#include "qdeclarativeanimatedimage_p_p.h"
-#include <qmlengine.h>
+#include <qdeclarativeengine.h>
#include <QMovie>
#include <QNetworkRequest>
@@ -51,12 +51,12 @@
QT_BEGIN_NAMESPACE
/*!
- \class QmlGraphicsAnimatedImage
+ \class QDeclarativeAnimatedImage
\internal
*/
/*!
- \qmlclass AnimatedImage QmlGraphicsAnimatedImage
+ \qmlclass AnimatedImage QDeclarativeAnimatedImage
\inherits Image
\since 4.7
@@ -80,14 +80,14 @@ Item {
\endtable
*/
-QmlGraphicsAnimatedImage::QmlGraphicsAnimatedImage(QmlGraphicsItem *parent)
- : QmlGraphicsImage(*(new QmlGraphicsAnimatedImagePrivate), parent)
+QDeclarativeAnimatedImage::QDeclarativeAnimatedImage(QDeclarativeItem *parent)
+ : QDeclarativeImage(*(new QDeclarativeAnimatedImagePrivate), parent)
{
}
-QmlGraphicsAnimatedImage::~QmlGraphicsAnimatedImage()
+QDeclarativeAnimatedImage::~QDeclarativeAnimatedImage()
{
- Q_D(QmlGraphicsAnimatedImage);
+ Q_D(QDeclarativeAnimatedImage);
delete d->_movie;
}
@@ -97,17 +97,17 @@ QmlGraphicsAnimatedImage::~QmlGraphicsAnimatedImage()
Defaults to false, and can be set to true when you want to pause.
*/
-bool QmlGraphicsAnimatedImage::isPaused() const
+bool QDeclarativeAnimatedImage::isPaused() const
{
- Q_D(const QmlGraphicsAnimatedImage);
+ Q_D(const QDeclarativeAnimatedImage);
if(!d->_movie)
return false;
return d->_movie->state()==QMovie::Paused;
}
-void QmlGraphicsAnimatedImage::setPaused(bool pause)
+void QDeclarativeAnimatedImage::setPaused(bool pause)
{
- Q_D(QmlGraphicsAnimatedImage);
+ Q_D(QDeclarativeAnimatedImage);
if(pause == d->paused)
return;
d->paused = pause;
@@ -121,17 +121,17 @@ void QmlGraphicsAnimatedImage::setPaused(bool pause)
Defaults to true, so as to start playing immediately.
*/
-bool QmlGraphicsAnimatedImage::isPlaying() const
+bool QDeclarativeAnimatedImage::isPlaying() const
{
- Q_D(const QmlGraphicsAnimatedImage);
+ Q_D(const QDeclarativeAnimatedImage);
if (!d->_movie)
return false;
return d->_movie->state()!=QMovie::NotRunning;
}
-void QmlGraphicsAnimatedImage::setPlaying(bool play)
+void QDeclarativeAnimatedImage::setPlaying(bool play)
{
- Q_D(QmlGraphicsAnimatedImage);
+ Q_D(QDeclarativeAnimatedImage);
if(play == d->playing)
return;
d->playing = play;
@@ -151,17 +151,17 @@ void QmlGraphicsAnimatedImage::setPlaying(bool play)
allow other things to animate at the same time as the image. frameCount is the number
of frames in the animation. For some animation formats, frameCount is unknown and set to zero.
*/
-int QmlGraphicsAnimatedImage::currentFrame() const
+int QDeclarativeAnimatedImage::currentFrame() const
{
- Q_D(const QmlGraphicsAnimatedImage);
+ Q_D(const QDeclarativeAnimatedImage);
if (!d->_movie)
return d->preset_currentframe;
return d->_movie->currentFrameNumber();
}
-void QmlGraphicsAnimatedImage::setCurrentFrame(int frame)
+void QDeclarativeAnimatedImage::setCurrentFrame(int frame)
{
- Q_D(QmlGraphicsAnimatedImage);
+ Q_D(QDeclarativeAnimatedImage);
if (!d->_movie) {
d->preset_currentframe = frame;
return;
@@ -169,9 +169,9 @@ void QmlGraphicsAnimatedImage::setCurrentFrame(int frame)
d->_movie->jumpToFrame(frame);
}
-int QmlGraphicsAnimatedImage::frameCount() const
+int QDeclarativeAnimatedImage::frameCount() const
{
- Q_D(const QmlGraphicsAnimatedImage);
+ Q_D(const QDeclarativeAnimatedImage);
if (!d->_movie)
return 0;
return d->_movie->frameCount();
@@ -185,9 +185,9 @@ static QString toLocalFileOrQrc(const QUrl& url)
return r;
}
-void QmlGraphicsAnimatedImage::setSource(const QUrl &url)
+void QDeclarativeAnimatedImage::setSource(const QUrl &url)
{
- Q_D(QmlGraphicsAnimatedImage);
+ Q_D(QDeclarativeAnimatedImage);
if (url == d->url)
return;
@@ -247,9 +247,9 @@ void QmlGraphicsAnimatedImage::setSource(const QUrl &url)
emit statusChanged(d->status);
}
-void QmlGraphicsAnimatedImage::movieRequestFinished()
+void QDeclarativeAnimatedImage::movieRequestFinished()
{
- Q_D(QmlGraphicsAnimatedImage);
+ Q_D(QDeclarativeAnimatedImage);
d->_movie = new QMovie(d->reply);
if (!d->_movie->isValid()){
qWarning() << "Error Reading Animated Image File " << d->url;
@@ -273,16 +273,16 @@ void QmlGraphicsAnimatedImage::movieRequestFinished()
d->setPixmap(d->_movie->currentPixmap());
}
-void QmlGraphicsAnimatedImage::movieUpdate()
+void QDeclarativeAnimatedImage::movieUpdate()
{
- Q_D(QmlGraphicsAnimatedImage);
+ Q_D(QDeclarativeAnimatedImage);
d->setPixmap(d->_movie->currentPixmap());
emit frameChanged();
}
-void QmlGraphicsAnimatedImage::playingStatusChanged()
+void QDeclarativeAnimatedImage::playingStatusChanged()
{
- Q_D(QmlGraphicsAnimatedImage);
+ Q_D(QDeclarativeAnimatedImage);
if((d->_movie->state() != QMovie::NotRunning) != d->playing){
d->playing = (d->_movie->state() != QMovie::NotRunning);
emit playingChanged();
@@ -293,10 +293,10 @@ void QmlGraphicsAnimatedImage::playingStatusChanged()
}
}
-void QmlGraphicsAnimatedImage::componentComplete()
+void QDeclarativeAnimatedImage::componentComplete()
{
- Q_D(QmlGraphicsAnimatedImage);
- QmlGraphicsImage::componentComplete();
+ Q_D(QDeclarativeAnimatedImage);
+ QDeclarativeImage::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/qdeclarativeanimatedimage_p.h
index a6cee0d..b2979fe 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSANIMATEDIMAGE_H
-#define QMLGRAPHICSANIMATEDIMAGE_H
+#ifndef QDECLARATIVEANIMATEDIMAGE_H
+#define QDECLARATIVEANIMATEDIMAGE_H
-#include "qmlgraphicsimage_p.h"
+#include "qdeclarativeimage_p.h"
QT_BEGIN_HEADER
@@ -51,9 +51,9 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QMovie;
-class QmlGraphicsAnimatedImagePrivate;
+class QDeclarativeAnimatedImagePrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsAnimatedImage : public QmlGraphicsImage
+class Q_DECLARATIVE_EXPORT QDeclarativeAnimatedImage : public QDeclarativeImage
{
Q_OBJECT
@@ -62,8 +62,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsAnimatedImage : public QmlGraphicsImage
Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY frameChanged)
Q_PROPERTY(int frameCount READ frameCount)
public:
- QmlGraphicsAnimatedImage(QmlGraphicsItem *parent=0);
- ~QmlGraphicsAnimatedImage();
+ QDeclarativeAnimatedImage(QDeclarativeItem *parent=0);
+ ~QDeclarativeAnimatedImage();
bool isPlaying() const;
void setPlaying(bool play);
@@ -76,7 +76,7 @@ public:
int frameCount() const;
- // Extends QmlGraphicsImage's src property*/
+ // Extends QDeclarativeImage's src property*/
virtual void setSource(const QUrl&);
Q_SIGNALS:
@@ -93,13 +93,13 @@ protected:
void componentComplete();
private:
- Q_DISABLE_COPY(QmlGraphicsAnimatedImage)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsAnimatedImage)
+ Q_DISABLE_COPY(QDeclarativeAnimatedImage)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeAnimatedImage)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsAnimatedImage)
+QML_DECLARE_TYPE(QDeclarativeAnimatedImage)
QT_END_HEADER
diff --git a/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p_p.h b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p_p.h
index 5e04a93..39bb3e5 100644
--- a/src/declarative/graphicsitems/qmlgraphicsanimatedimage_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSANIMATEDIMAGE_P_H
-#define QMLGRAPHICSANIMATEDIMAGE_P_H
+#ifndef QDECLARATIVEANIMATEDIMAGE_P_H
+#define QDECLARATIVEANIMATEDIMAGE_P_H
//
// W A R N I N G
@@ -53,19 +53,19 @@
// We mean it.
//
-#include "qmlgraphicsimage_p_p.h"
+#include "qdeclarativeimage_p_p.h"
QT_BEGIN_NAMESPACE
class QMovie;
class QNetworkReply;
-class QmlGraphicsAnimatedImagePrivate : public QmlGraphicsImagePrivate
+class QDeclarativeAnimatedImagePrivate : public QDeclarativeImagePrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsAnimatedImage)
+ Q_DECLARE_PUBLIC(QDeclarativeAnimatedImage)
public:
- QmlGraphicsAnimatedImagePrivate()
+ QDeclarativeAnimatedImagePrivate()
: playing(true), paused(false), preset_currentframe(0), _movie(0), reply(0)
{
}
@@ -79,4 +79,4 @@ public:
QT_END_NAMESPACE
-#endif // QMLGRAPHICSANIMATEDIMAGE_P_H
+#endif // QDECLARATIVEANIMATEDIMAGE_P_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
index 25a220f..de16668 100644
--- a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#include "qmlgraphicsborderimage_p.h"
-#include "qmlgraphicsborderimage_p_p.h"
+#include "qdeclarativeborderimage_p.h"
+#include "qdeclarativeborderimage_p_p.h"
-#include <qmlengine.h>
+#include <qdeclarativeengine.h>
#include <QNetworkRequest>
#include <QNetworkReply>
@@ -51,7 +51,7 @@
QT_BEGIN_NAMESPACE
/*!
- \qmlclass BorderImage QmlGraphicsBorderImage
+ \qmlclass BorderImage QDeclarativeBorderImage
\brief The BorderImage element provides an image that can be used as a border.
\inherits Item
\since 4.7
@@ -62,23 +62,23 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \class QmlGraphicsBorderImage BorderImage
+ \class QDeclarativeBorderImage BorderImage
\internal
- \brief The QmlGraphicsBorderImage class provides an image item that you can add to a QmlView.
+ \brief The QDeclarativeBorderImage class provides an image item that you can add to a QDeclarativeView.
*/
-QmlGraphicsBorderImage::QmlGraphicsBorderImage(QmlGraphicsItem *parent)
- : QmlGraphicsImageBase(*(new QmlGraphicsBorderImagePrivate), parent)
+QDeclarativeBorderImage::QDeclarativeBorderImage(QDeclarativeItem *parent)
+ : QDeclarativeImageBase(*(new QDeclarativeBorderImagePrivate), parent)
{
}
-QmlGraphicsBorderImage::~QmlGraphicsBorderImage()
+QDeclarativeBorderImage::~QDeclarativeBorderImage()
{
- Q_D(QmlGraphicsBorderImage);
+ Q_D(QDeclarativeBorderImage);
if (d->sciReply)
d->sciReply->deleteLater();
if (d->sciPendingPixmapCache)
- QmlPixmapCache::cancel(d->sciurl, this);
+ QDeclarativePixmapCache::cancel(d->sciurl, this);
}
/*!
\qmlproperty enum BorderImage::status
@@ -145,9 +145,9 @@ static QString toLocalFileOrQrc(const QUrl& url)
}
-void QmlGraphicsBorderImage::setSource(const QUrl &url)
+void QDeclarativeBorderImage::setSource(const QUrl &url)
{
- Q_D(QmlGraphicsBorderImage);
+ Q_D(QDeclarativeBorderImage);
//equality is fairly expensive, so we bypass for simple, common case
if ((d->url.isEmpty() == url.isEmpty()) && url == d->url)
return;
@@ -158,28 +158,36 @@ void QmlGraphicsBorderImage::setSource(const QUrl &url)
}
if (d->pendingPixmapCache) {
- QmlPixmapCache::cancel(d->url, this);
+ QDeclarativePixmapCache::cancel(d->url, this);
d->pendingPixmapCache = false;
}
if (d->sciPendingPixmapCache) {
- QmlPixmapCache::cancel(d->sciurl, this);
+ QDeclarativePixmapCache::cancel(d->sciurl, this);
d->sciPendingPixmapCache = false;
}
d->url = url;
d->sciurl = QUrl();
+ emit sourceChanged(d->url);
+
+ if (isComponentComplete())
+ load();
+}
+
+void QDeclarativeBorderImage::load()
+{
+ Q_D(QDeclarativeBorderImage);
if (d->progress != 0.0) {
d->progress = 0.0;
emit progressChanged(d->progress);
}
- if (url.isEmpty()) {
+ if (d->url.isEmpty()) {
d->pix = QPixmap();
d->status = Null;
setImplicitWidth(0);
setImplicitHeight(0);
emit statusChanged(d->status);
- emit sourceChanged(d->url);
update();
} else {
d->status = Loading;
@@ -189,19 +197,29 @@ void QmlGraphicsBorderImage::setSource(const QUrl &url)
if (!lf.isEmpty()) {
QFile file(lf);
file.open(QIODevice::ReadOnly);
- setGridScaledImage(QmlGraphicsGridScaledImage(&file));
+ setGridScaledImage(QDeclarativeGridScaledImage(&file));
} else
#endif
{
QNetworkRequest req(d->url);
d->sciReply = qmlEngine(this)->networkAccessManager()->get(req);
- QObject::connect(d->sciReply, SIGNAL(finished()),
- this, SLOT(sciRequestFinished()));
+
+ static int sciReplyFinished = -1;
+ static int thisSciRequestFinished = -1;
+ if (sciReplyFinished == -1) {
+ sciReplyFinished =
+ QNetworkReply::staticMetaObject.indexOfSignal("finished()");
+ thisSciRequestFinished =
+ QDeclarativeBorderImage::staticMetaObject.indexOfSlot("sciRequestFinished()");
+ }
+
+ QMetaObject::connect(d->sciReply, sciReplyFinished, this,
+ thisSciRequestFinished, Qt::DirectConnection);
}
} else {
- QmlPixmapReply::Status status = QmlPixmapCache::get(d->url, &d->pix);
- if (status != QmlPixmapReply::Ready && status != QmlPixmapReply::Error) {
- QmlPixmapReply *reply = QmlPixmapCache::request(qmlEngine(this), d->url);
+ QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->url, &d->pix, d->async);
+ if (status != QDeclarativePixmapReply::Ready && status != QDeclarativePixmapReply::Error) {
+ QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(this), d->url);
d->pendingPixmapCache = true;
connect(reply, SIGNAL(finished()), this, SLOT(requestFinished()));
connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
@@ -217,7 +235,6 @@ void QmlGraphicsBorderImage::setSource(const QUrl &url)
d->status = Ready;
d->progress = 1.0;
emit statusChanged(d->status);
- emit sourceChanged(d->url);
emit progressChanged(d->progress);
update();
}
@@ -253,9 +270,9 @@ void QmlGraphicsBorderImage::setSource(const QUrl &url)
\l {BorderImage::source}{.sci file}.
*/
-QmlGraphicsScaleGrid *QmlGraphicsBorderImage::border()
+QDeclarativeScaleGrid *QDeclarativeBorderImage::border()
{
- Q_D(QmlGraphicsBorderImage);
+ Q_D(QDeclarativeBorderImage);
return d->getScaleGrid();
}
@@ -271,15 +288,15 @@ QmlGraphicsScaleGrid *QmlGraphicsBorderImage::border()
\o Round - Like Repeat, but scales the images down to ensure that the last image is not cropped.
\endlist
*/
-QmlGraphicsBorderImage::TileMode QmlGraphicsBorderImage::horizontalTileMode() const
+QDeclarativeBorderImage::TileMode QDeclarativeBorderImage::horizontalTileMode() const
{
- Q_D(const QmlGraphicsBorderImage);
+ Q_D(const QDeclarativeBorderImage);
return d->horizontalTileMode;
}
-void QmlGraphicsBorderImage::setHorizontalTileMode(TileMode t)
+void QDeclarativeBorderImage::setHorizontalTileMode(TileMode t)
{
- Q_D(QmlGraphicsBorderImage);
+ Q_D(QDeclarativeBorderImage);
if (t != d->horizontalTileMode) {
d->horizontalTileMode = t;
emit horizontalTileModeChanged();
@@ -287,15 +304,15 @@ void QmlGraphicsBorderImage::setHorizontalTileMode(TileMode t)
}
}
-QmlGraphicsBorderImage::TileMode QmlGraphicsBorderImage::verticalTileMode() const
+QDeclarativeBorderImage::TileMode QDeclarativeBorderImage::verticalTileMode() const
{
- Q_D(const QmlGraphicsBorderImage);
+ Q_D(const QDeclarativeBorderImage);
return d->verticalTileMode;
}
-void QmlGraphicsBorderImage::setVerticalTileMode(TileMode t)
+void QDeclarativeBorderImage::setVerticalTileMode(TileMode t)
{
- Q_D(QmlGraphicsBorderImage);
+ Q_D(QDeclarativeBorderImage);
if (t != d->verticalTileMode) {
d->verticalTileMode = t;
emit verticalTileModeChanged();
@@ -303,14 +320,14 @@ void QmlGraphicsBorderImage::setVerticalTileMode(TileMode t)
}
}
-void QmlGraphicsBorderImage::setGridScaledImage(const QmlGraphicsGridScaledImage& sci)
+void QDeclarativeBorderImage::setGridScaledImage(const QDeclarativeGridScaledImage& sci)
{
- Q_D(QmlGraphicsBorderImage);
+ Q_D(QDeclarativeBorderImage);
if (!sci.isValid()) {
d->status = Error;
emit statusChanged(d->status);
} else {
- QmlGraphicsScaleGrid *sg = border();
+ QDeclarativeScaleGrid *sg = border();
sg->setTop(sci.gridTop());
sg->setBottom(sci.gridBottom());
sg->setLeft(sci.gridLeft());
@@ -319,13 +336,30 @@ void QmlGraphicsBorderImage::setGridScaledImage(const QmlGraphicsGridScaledImage
d->verticalTileMode = sci.verticalTileRule();
d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl()));
- QmlPixmapReply::Status status = QmlPixmapCache::get(d->sciurl, &d->pix);
- if (status != QmlPixmapReply::Ready && status != QmlPixmapReply::Error) {
- QmlPixmapReply *reply = QmlPixmapCache::request(qmlEngine(this), d->sciurl);
+ QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->sciurl, &d->pix, d->async);
+ if (status != QDeclarativePixmapReply::Ready && status != QDeclarativePixmapReply::Error) {
+ QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(this), d->sciurl);
d->sciPendingPixmapCache = true;
- connect(reply, SIGNAL(finished()), this, SLOT(requestFinished()));
- connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
- this, SLOT(requestProgress(qint64,qint64)));
+
+ static int replyDownloadProgress = -1;
+ static int replyFinished = -1;
+ static int thisRequestProgress = -1;
+ static int thisRequestFinished = -1;
+ if (replyDownloadProgress == -1) {
+ replyDownloadProgress =
+ QDeclarativePixmapReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)");
+ replyFinished =
+ QDeclarativePixmapReply::staticMetaObject.indexOfSignal("finished()");
+ thisRequestProgress =
+ QDeclarativeBorderImage::staticMetaObject.indexOfSlot("requestProgress(qint64,qint64)");
+ thisRequestFinished =
+ QDeclarativeBorderImage::staticMetaObject.indexOfSlot("requestFinished()");
+ }
+
+ QMetaObject::connect(reply, replyFinished, this,
+ thisRequestFinished, Qt::DirectConnection);
+ QMetaObject::connect(reply, replyDownloadProgress, this,
+ thisRequestProgress, Qt::DirectConnection);
} else {
//### should be unified with requestFinished
setImplicitWidth(d->pix.width());
@@ -337,23 +371,22 @@ void QmlGraphicsBorderImage::setGridScaledImage(const QmlGraphicsGridScaledImage
d->status = Ready;
d->progress = 1.0;
emit statusChanged(d->status);
- emit sourceChanged(d->url);
emit progressChanged(1.0);
update();
}
}
}
-void QmlGraphicsBorderImage::requestFinished()
+void QDeclarativeBorderImage::requestFinished()
{
- Q_D(QmlGraphicsBorderImage);
+ Q_D(QDeclarativeBorderImage);
if (d->url.path().endsWith(QLatin1String(".sci"))) {
d->sciPendingPixmapCache = false;
- QmlPixmapCache::get(d->sciurl, &d->pix);
+ QDeclarativePixmapCache::get(d->sciurl, &d->pix, d->async);
} else {
d->pendingPixmapCache = false;
- if (QmlPixmapCache::get(d->url, &d->pix) != QmlPixmapReply::Ready)
+ if (QDeclarativePixmapCache::get(d->url, &d->pix, d->async) != QDeclarativePixmapReply::Ready)
d->status = Error;
}
setImplicitWidth(d->pix.width());
@@ -363,30 +396,29 @@ void QmlGraphicsBorderImage::requestFinished()
d->status = Ready;
d->progress = 1.0;
emit statusChanged(d->status);
- emit sourceChanged(d->url);
emit progressChanged(1.0);
update();
}
-void QmlGraphicsBorderImage::sciRequestFinished()
+void QDeclarativeBorderImage::sciRequestFinished()
{
- Q_D(QmlGraphicsBorderImage);
+ Q_D(QDeclarativeBorderImage);
if (d->sciReply->error() != QNetworkReply::NoError) {
d->status = Error;
d->sciReply->deleteLater();
d->sciReply = 0;
emit statusChanged(d->status);
} else {
- QmlGraphicsGridScaledImage sci(d->sciReply);
+ QDeclarativeGridScaledImage sci(d->sciReply);
d->sciReply->deleteLater();
d->sciReply = 0;
setGridScaledImage(sci);
}
}
-void QmlGraphicsBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
+void QDeclarativeBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
- Q_D(QmlGraphicsBorderImage);
+ Q_D(QDeclarativeBorderImage);
if (d->pix.isNull())
return;
@@ -395,7 +427,7 @@ void QmlGraphicsBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem *
if (d->smooth)
p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth);
- const QmlGraphicsScaleGrid *border = d->getScaleGrid();
+ const QDeclarativeScaleGrid *border = d->getScaleGrid();
QMargins margins(border->left(), border->top(), border->right(), border->bottom());
QTileRules rules((Qt::TileRule)d->horizontalTileMode, (Qt::TileRule)d->verticalTileMode);
qDrawBorderPixmap(p, QRect(0, 0, (int)d->width, (int)d->height), margins, d->pix, d->pix.rect(), margins, rules);
diff --git a/src/declarative/graphicsitems/qmlgraphicsborderimage_p.h b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h
index 32dc388..a759e67 100644
--- a/src/declarative/graphicsitems/qmlgraphicsborderimage_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSBORDERIMAGE_H
-#define QMLGRAPHICSBORDERIMAGE_H
+#ifndef QDECLARATIVEBORDERIMAGE_H
+#define QDECLARATIVEBORDERIMAGE_H
-#include "qmlgraphicsimagebase_p.h"
+#include "qdeclarativeimagebase_p.h"
#include <QtNetwork/qnetworkreply.h>
@@ -51,23 +51,23 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsScaleGrid;
-class QmlGraphicsGridScaledImage;
-class QmlGraphicsBorderImagePrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsBorderImage : public QmlGraphicsImageBase
+class QDeclarativeScaleGrid;
+class QDeclarativeGridScaledImage;
+class QDeclarativeBorderImagePrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeBorderImage : public QDeclarativeImageBase
{
Q_OBJECT
Q_ENUMS(TileMode)
- Q_PROPERTY(QmlGraphicsScaleGrid *border READ border CONSTANT)
+ Q_PROPERTY(QDeclarativeScaleGrid *border READ border CONSTANT)
Q_PROPERTY(TileMode horizontalTileMode READ horizontalTileMode WRITE setHorizontalTileMode NOTIFY horizontalTileModeChanged)
Q_PROPERTY(TileMode verticalTileMode READ verticalTileMode WRITE setVerticalTileMode NOTIFY verticalTileModeChanged)
public:
- QmlGraphicsBorderImage(QmlGraphicsItem *parent=0);
- ~QmlGraphicsBorderImage();
+ QDeclarativeBorderImage(QDeclarativeItem *parent=0);
+ ~QDeclarativeBorderImage();
- QmlGraphicsScaleGrid *border();
+ QDeclarativeScaleGrid *border();
enum TileMode { Stretch = Qt::StretchTile, Repeat = Qt::RepeatTile, Round = Qt::RoundTile };
@@ -84,20 +84,23 @@ Q_SIGNALS:
void horizontalTileModeChanged();
void verticalTileModeChanged();
+protected:
+ virtual void load();
+
private:
- void setGridScaledImage(const QmlGraphicsGridScaledImage& sci);
+ void setGridScaledImage(const QDeclarativeGridScaledImage& sci);
private Q_SLOTS:
void requestFinished();
void sciRequestFinished();
private:
- Q_DISABLE_COPY(QmlGraphicsBorderImage)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsBorderImage)
+ Q_DISABLE_COPY(QDeclarativeBorderImage)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeBorderImage)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsBorderImage)
+QML_DECLARE_TYPE(QDeclarativeBorderImage)
QT_END_HEADER
-#endif // QMLGRAPHICSBORDERIMAGE_H
+#endif // QDECLARATIVEBORDERIMAGE_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsborderimage_p_p.h b/src/declarative/graphicsitems/qdeclarativeborderimage_p_p.h
index b97ae6d..b9cf73a 100644
--- a/src/declarative/graphicsitems/qmlgraphicsborderimage_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSBORDERIMAGE_P_H
-#define QMLGRAPHICSBORDERIMAGE_P_H
+#ifndef QDECLARATIVEBORDERIMAGE_P_H
+#define QDECLARATIVEBORDERIMAGE_P_H
//
// W A R N I N G
@@ -53,45 +53,45 @@
// We mean it.
//
-#include "qmlgraphicsimagebase_p_p.h"
-#include "qmlgraphicsscalegrid_p_p.h"
+#include "qdeclarativeimagebase_p_p.h"
+#include "qdeclarativescalegrid_p_p.h"
QT_BEGIN_NAMESPACE
class QNetworkReply;
-class QmlGraphicsBorderImagePrivate : public QmlGraphicsImageBasePrivate
+class QDeclarativeBorderImagePrivate : public QDeclarativeImageBasePrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsBorderImage)
+ Q_DECLARE_PUBLIC(QDeclarativeBorderImage)
public:
- QmlGraphicsBorderImagePrivate()
+ QDeclarativeBorderImagePrivate()
: border(0), sciReply(0),
sciPendingPixmapCache(false),
- horizontalTileMode(QmlGraphicsBorderImage::Stretch),
- verticalTileMode(QmlGraphicsBorderImage::Stretch)
+ horizontalTileMode(QDeclarativeBorderImage::Stretch),
+ verticalTileMode(QDeclarativeBorderImage::Stretch)
{
}
- ~QmlGraphicsBorderImagePrivate()
+ ~QDeclarativeBorderImagePrivate()
{
}
- QmlGraphicsScaleGrid *getScaleGrid()
+ QDeclarativeScaleGrid *getScaleGrid()
{
- Q_Q(QmlGraphicsBorderImage);
+ Q_Q(QDeclarativeBorderImage);
if (!border)
- border = new QmlGraphicsScaleGrid(q);
+ border = new QDeclarativeScaleGrid(q);
return border;
}
- QmlGraphicsScaleGrid *border;
+ QDeclarativeScaleGrid *border;
QUrl sciurl;
QNetworkReply *sciReply;
bool sciPendingPixmapCache;
- QmlGraphicsBorderImage::TileMode horizontalTileMode;
- QmlGraphicsBorderImage::TileMode verticalTileMode;
+ QDeclarativeBorderImage::TileMode horizontalTileMode;
+ QDeclarativeBorderImage::TileMode verticalTileMode;
};
QT_END_NAMESPACE
-#endif // QMLGRAPHICSBORDERIMAGE_P_H
+#endif // QDECLARATIVEBORDERIMAGE_P_H
diff --git a/src/declarative/graphicsitems/qmlgraphicseffects.cpp b/src/declarative/graphicsitems/qdeclarativeeffects.cpp
index 6a93b12..efab24e 100644
--- a/src/declarative/graphicsitems/qmlgraphicseffects.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeeffects.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtGui/qgraphicseffect.h>
diff --git a/src/declarative/graphicsitems/qmlgraphicseffects_p.h b/src/declarative/graphicsitems/qdeclarativeeffects_p.h
index 4b94a14..73eec6a 100644
--- a/src/declarative/graphicsitems/qmlgraphicseffects_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeeffects_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSEFFECTS_P_H
-#define QMLGRAPHICSEFFECTS_P_H
+#ifndef QDECLARATIVEEFFECTS_P_H
+#define QDECLARATIVEEFFECTS_P_H
//
// W A R N I N G
@@ -53,7 +53,7 @@
// We mean it.
//
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtGui/qgraphicseffect.h>
QML_DECLARE_TYPE(QGraphicsEffect)
@@ -62,4 +62,4 @@ QML_DECLARE_TYPE(QGraphicsColorizeEffect)
QML_DECLARE_TYPE(QGraphicsDropShadowEffect)
QML_DECLARE_TYPE(QGraphicsOpacityEffect)
-#endif // QMLGRAPHICSEFFECTS_P_H
+#endif // QDECLARATIVEEFFECTS_P_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp
index e8ba885..d2cbb54 100644
--- a/src/declarative/graphicsitems/qmlgraphicsevents.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#include "qmlgraphicsevents_p_p.h"
+#include "qdeclarativeevents_p_p.h"
QT_BEGIN_NAMESPACE
/*!
- \qmlclass KeyEvent QmlGraphicsKeyEvent
+ \qmlclass KeyEvent QDeclarativeKeyEvent
\since 4.7
\brief The KeyEvent object provides information about a key event.
@@ -59,7 +59,7 @@ Item {
/*!
\internal
- \class QmlGraphicsKeyEvent
+ \class QDeclarativeKeyEvent
*/
/*!
@@ -113,7 +113,7 @@ Item {
/*!
- \qmlclass MouseEvent QmlGraphicsMouseEvent
+ \qmlclass MouseEvent QDeclarativeMouseEvent
\brief The MouseEvent object provides information about a mouse event.
The position of the mouse can be found via the x and y properties.
@@ -122,7 +122,7 @@ Item {
/*!
\internal
- \class QmlGraphicsMouseEvent
+ \class QDeclarativeMouseEvent
*/
/*!
diff --git a/src/declarative/graphicsitems/qmlgraphicsevents_p_p.h b/src/declarative/graphicsitems/qdeclarativeevents_p_p.h
index 0ed852a..65ac8de 100644
--- a/src/declarative/graphicsitems/qmlgraphicsevents_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeevents_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSEVENTS_P_H
-#define QMLGRAPHICSEVENTS_P_H
+#ifndef QDECLARATIVEEVENTS_P_H
+#define QDECLARATIVEEVENTS_P_H
//
// W A R N I N G
@@ -53,14 +53,14 @@
// We mean it.
//
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtCore/qobject.h>
#include <QtGui/qevent.h>
QT_BEGIN_NAMESPACE
-class QmlGraphicsKeyEvent : public QObject
+class QDeclarativeKeyEvent : public QObject
{
Q_OBJECT
Q_PROPERTY(int key READ key)
@@ -71,9 +71,9 @@ class QmlGraphicsKeyEvent : public QObject
Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
public:
- QmlGraphicsKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text=QString(), bool autorep=false, ushort count=1)
+ QDeclarativeKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text=QString(), bool autorep=false, ushort count=1)
: event(type, key, modifiers, text, autorep, count) { event.setAccepted(false); }
- QmlGraphicsKeyEvent(const QKeyEvent &ke)
+ QDeclarativeKeyEvent(const QKeyEvent &ke)
: event(ke) { event.setAccepted(false); }
int key() const { return event.key(); }
@@ -89,7 +89,7 @@ private:
QKeyEvent event;
};
-class QmlGraphicsMouseEvent : public QObject
+class QDeclarativeMouseEvent : public QObject
{
Q_OBJECT
Q_PROPERTY(int x READ x)
@@ -102,7 +102,7 @@ class QmlGraphicsMouseEvent : public QObject
Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
public:
- QmlGraphicsMouseEvent(int x, int y, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers
+ QDeclarativeMouseEvent(int x, int y, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers
, bool isClick=false, bool wasHeld=false)
: _x(x), _y(y), _button(button), _buttons(buttons), _modifiers(modifiers)
, _wasHeld(wasHeld), _isClick(isClick), _accepted(true) {}
@@ -131,7 +131,7 @@ private:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsKeyEvent)
-QML_DECLARE_TYPE(QmlGraphicsMouseEvent)
+QML_DECLARE_TYPE(QDeclarativeKeyEvent)
+QML_DECLARE_TYPE(QDeclarativeMouseEvent)
-#endif // QMLGRAPHICSEVENTS_P_H
+#endif // QDECLARATIVEEVENTS_P_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index e92fea4..3f4a9ce 100644
--- a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#include "qmlgraphicsflickable_p.h"
-#include "qmlgraphicsflickable_p_p.h"
+#include "qdeclarativeflickable_p.h"
+#include "qdeclarativeflickable_p_p.h"
#include <QGraphicsSceneMouseEvent>
#include <QPointer>
@@ -56,35 +56,35 @@ static const int FlickThreshold = 20;
// Really slow flicks can be annoying.
static const int minimumFlickVelocity = 200;
-QmlGraphicsFlickableVisibleArea::QmlGraphicsFlickableVisibleArea(QmlGraphicsFlickable *parent)
+QDeclarativeFlickableVisibleArea::QDeclarativeFlickableVisibleArea(QDeclarativeFlickable *parent)
: QObject(parent), flickable(parent), m_xPosition(0.), m_widthRatio(0.)
, m_yPosition(0.), m_heightRatio(0.)
{
}
-qreal QmlGraphicsFlickableVisibleArea::widthRatio() const
+qreal QDeclarativeFlickableVisibleArea::widthRatio() const
{
return m_widthRatio;
}
-qreal QmlGraphicsFlickableVisibleArea::xPosition() const
+qreal QDeclarativeFlickableVisibleArea::xPosition() const
{
return m_xPosition;
}
-qreal QmlGraphicsFlickableVisibleArea::heightRatio() const
+qreal QDeclarativeFlickableVisibleArea::heightRatio() const
{
return m_heightRatio;
}
-qreal QmlGraphicsFlickableVisibleArea::yPosition() const
+qreal QDeclarativeFlickableVisibleArea::yPosition() const
{
return m_yPosition;
}
-void QmlGraphicsFlickableVisibleArea::updateVisible()
+void QDeclarativeFlickableVisibleArea::updateVisible()
{
- QmlGraphicsFlickablePrivate *p = static_cast<QmlGraphicsFlickablePrivate *>(QGraphicsItemPrivate::get(flickable));
+ QDeclarativeFlickablePrivate *p = static_cast<QDeclarativeFlickablePrivate *>(QGraphicsItemPrivate::get(flickable));
bool pageChange = false;
// Vertical
@@ -121,47 +121,64 @@ void QmlGraphicsFlickableVisibleArea::updateVisible()
}
-QmlGraphicsFlickablePrivate::QmlGraphicsFlickablePrivate()
- : viewport(new QmlGraphicsItem)
- , _moveX(this, &QmlGraphicsFlickablePrivate::setRoundedViewportX)
- , _moveY(this, &QmlGraphicsFlickablePrivate::setRoundedViewportY)
+QDeclarativeFlickablePrivate::QDeclarativeFlickablePrivate()
+ : viewport(new QDeclarativeItem)
+ , _moveX(this, &QDeclarativeFlickablePrivate::setRoundedViewportX)
+ , _moveY(this, &QDeclarativeFlickablePrivate::setRoundedViewportY)
, vWidth(-1), vHeight(-1), overShoot(true), flicked(false), moving(false), stealMouse(false)
, pressed(false), atXEnd(false), atXBeginning(true), atYEnd(false), atYBeginning(true)
, interactive(true), deceleration(500), maxVelocity(2000), reportedVelocitySmoothing(100)
- , delayedPressEvent(0), delayedPressTarget(0), pressDelay(0), fixupDuration(200)
+ , delayedPressEvent(0), delayedPressTarget(0), pressDelay(0), fixupDuration(600)
, horizontalVelocity(this), verticalVelocity(this), vTime(0), visibleArea(0)
- , flickDirection(QmlGraphicsFlickable::AutoFlickDirection)
+ , flickDirection(QDeclarativeFlickable::AutoFlickDirection)
{
}
-void QmlGraphicsFlickablePrivate::init()
+void QDeclarativeFlickablePrivate::init()
{
- Q_Q(QmlGraphicsFlickable);
+ Q_Q(QDeclarativeFlickable);
viewport->setParent(q);
QObject::connect(&timeline, SIGNAL(updated()), q, SLOT(ticked()));
QObject::connect(&timeline, SIGNAL(completed()), q, SLOT(movementEnding()));
q->setAcceptedMouseButtons(Qt::LeftButton);
q->setFiltersChildEvents(true);
- QObject::connect(viewport, SIGNAL(xChanged()), q, SIGNAL(positionXChanged()));
- QObject::connect(viewport, SIGNAL(yChanged()), q, SIGNAL(positionYChanged()));
+ QObject::connect(viewport, SIGNAL(xChanged()), q, SIGNAL(contentXChanged()));
+ QObject::connect(viewport, SIGNAL(yChanged()), q, SIGNAL(contentYChanged()));
QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(heightChange()));
QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(widthChange()));
}
-void QmlGraphicsFlickablePrivate::flickX(qreal velocity)
+/*
+ Returns the amount to overshoot by given a velocity.
+ Will be roughly in range 0 - size/4
+*/
+qreal QDeclarativeFlickablePrivate::overShootDistance(qreal velocity, qreal size)
+{
+ Q_Q(QDeclarativeFlickable);
+ if (maxVelocity <= 0)
+ return 0.0;
+
+ velocity = qAbs(velocity);
+ if (velocity > maxVelocity)
+ velocity = maxVelocity;
+ qreal dist = size / 4 * velocity / maxVelocity;
+ return dist;
+}
+
+void QDeclarativeFlickablePrivate::flickX(qreal velocity)
{
- Q_Q(QmlGraphicsFlickable);
+ Q_Q(QDeclarativeFlickable);
qreal maxDistance = -1;
// -ve velocity means list is moving up
if (velocity > 0) {
const qreal minX = q->minXExtent();
if (_moveX.value() < minX)
- maxDistance = qAbs(minX -_moveX.value() + (overShoot?30:0));
+ maxDistance = qAbs(minX -_moveX.value() + (overShoot?overShootDistance(velocity,q->width()):0));
flickTargetX = minX;
} else {
const qreal maxX = q->maxXExtent();
if (_moveX.value() > maxX)
- maxDistance = qAbs(maxX - _moveX.value()) + (overShoot?30:0);
+ maxDistance = qAbs(maxX - _moveX.value()) + (overShoot?overShootDistance(velocity,q->width()):0);
flickTargetX = maxX;
}
if (maxDistance > 0) {
@@ -174,7 +191,7 @@ void QmlGraphicsFlickablePrivate::flickX(qreal velocity)
}
timeline.reset(_moveX);
timeline.accel(_moveX, v, deceleration, maxDistance);
- timeline.callback(QmlTimeLineCallback(&_moveX, fixupX_callback, this));
+ timeline.callback(QDeclarativeTimeLineCallback(&_moveX, fixupX_callback, this));
if (!flicked) {
flicked = true;
emit q->flickingChanged();
@@ -186,20 +203,20 @@ void QmlGraphicsFlickablePrivate::flickX(qreal velocity)
}
}
-void QmlGraphicsFlickablePrivate::flickY(qreal velocity)
+void QDeclarativeFlickablePrivate::flickY(qreal velocity)
{
- Q_Q(QmlGraphicsFlickable);
+ Q_Q(QDeclarativeFlickable);
qreal maxDistance = -1;
// -ve velocity means list is moving up
if (velocity > 0) {
const qreal minY = q->minYExtent();
if (_moveY.value() < minY)
- maxDistance = qAbs(minY -_moveY.value() + (overShoot?30:0));
+ maxDistance = qAbs(minY -_moveY.value() + (overShoot?overShootDistance(velocity,q->height()):0));
flickTargetY = minY;
} else {
const qreal maxY = q->maxYExtent();
if (_moveY.value() > maxY)
- maxDistance = qAbs(maxY - _moveY.value()) + (overShoot?30:0);
+ maxDistance = qAbs(maxY - _moveY.value()) + (overShoot?overShootDistance(velocity,q->height()):0);
flickTargetY = maxY;
}
if (maxDistance > 0) {
@@ -212,7 +229,7 @@ void QmlGraphicsFlickablePrivate::flickY(qreal velocity)
}
timeline.reset(_moveY);
timeline.accel(_moveY, v, deceleration, maxDistance);
- timeline.callback(QmlTimeLineCallback(&_moveY, fixupY_callback, this));
+ timeline.callback(QDeclarativeTimeLineCallback(&_moveY, fixupY_callback, this));
if (!flicked) {
flicked = true;
emit q->flickingChanged();
@@ -224,27 +241,33 @@ void QmlGraphicsFlickablePrivate::flickY(qreal velocity)
}
}
-void QmlGraphicsFlickablePrivate::fixupX()
+void QDeclarativeFlickablePrivate::fixupX()
{
- Q_Q(QmlGraphicsFlickable);
+ Q_Q(QDeclarativeFlickable);
if (!q->xflick() || _moveX.timeLine())
return;
if (_moveX.value() > q->minXExtent() || (q->maxXExtent() > q->minXExtent())) {
timeline.reset(_moveX);
if (_moveX.value() != q->minXExtent()) {
- if (fixupDuration)
- timeline.move(_moveX, q->minXExtent(), QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
- else
- _moveY.setValue(q->minYExtent());
+ if (fixupDuration) {
+ qreal dist = q->minXExtent() - _moveX;
+ timeline.move(_moveX, q->minXExtent() - dist/2, QEasingCurve(QEasingCurve::InQuad), fixupDuration/4);
+ timeline.move(_moveX, q->minXExtent(), QEasingCurve(QEasingCurve::OutQuint), 3*fixupDuration/4);
+ } else {
+ _moveX.setValue(q->minXExtent());
+ }
}
//emit flickingChanged();
} else if (_moveX.value() < q->maxXExtent()) {
timeline.reset(_moveX);
- if (fixupDuration)
- timeline.move(_moveX, q->maxXExtent(), QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
- else
- _moveY.setValue(q->maxYExtent());
+ if (fixupDuration) {
+ qreal dist = q->maxXExtent() - _moveX;
+ timeline.move(_moveX, q->maxXExtent() - dist/2, QEasingCurve(QEasingCurve::InQuad), fixupDuration/4);
+ timeline.move(_moveX, q->maxXExtent(), QEasingCurve(QEasingCurve::OutQuint), 3*fixupDuration/4);
+ } else {
+ _moveX.setValue(q->maxXExtent());
+ }
//emit flickingChanged();
} else {
flicked = false;
@@ -253,37 +276,43 @@ void QmlGraphicsFlickablePrivate::fixupX()
vTime = timeline.time();
}
-void QmlGraphicsFlickablePrivate::fixupY_callback(void *data)
+void QDeclarativeFlickablePrivate::fixupY_callback(void *data)
{
- ((QmlGraphicsFlickablePrivate *)data)->fixupY();
+ ((QDeclarativeFlickablePrivate *)data)->fixupY();
}
-void QmlGraphicsFlickablePrivate::fixupX_callback(void *data)
+void QDeclarativeFlickablePrivate::fixupX_callback(void *data)
{
- ((QmlGraphicsFlickablePrivate *)data)->fixupX();
+ ((QDeclarativeFlickablePrivate *)data)->fixupX();
}
-void QmlGraphicsFlickablePrivate::fixupY()
+void QDeclarativeFlickablePrivate::fixupY()
{
- Q_Q(QmlGraphicsFlickable);
+ Q_Q(QDeclarativeFlickable);
if (!q->yflick() || _moveY.timeLine())
return;
if (_moveY.value() > q->minYExtent() || (q->maxYExtent() > q->minYExtent())) {
timeline.reset(_moveY);
if (_moveY.value() != q->minYExtent()) {
- if (fixupDuration)
- timeline.move(_moveY, q->minYExtent(), QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
- else
+ if (fixupDuration) {
+ qreal dist = q->minYExtent() - _moveY;
+ timeline.move(_moveY, q->minYExtent() - dist/2, QEasingCurve(QEasingCurve::InQuad), fixupDuration/4);
+ timeline.move(_moveY, q->minYExtent(), QEasingCurve(QEasingCurve::OutQuint), 3*fixupDuration/4);
+ } else {
_moveY.setValue(q->minYExtent());
+ }
}
//emit flickingChanged();
} else if (_moveY.value() < q->maxYExtent()) {
timeline.reset(_moveY);
- if (fixupDuration)
- timeline.move(_moveY, q->maxYExtent(), QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
- else
+ if (fixupDuration) {
+ qreal dist = q->maxYExtent() - _moveY;
+ timeline.move(_moveY, q->maxYExtent() - dist/2, QEasingCurve(QEasingCurve::InQuad), fixupDuration/4);
+ timeline.move(_moveY, q->maxYExtent(), QEasingCurve(QEasingCurve::OutQuint), 3*fixupDuration/4);
+ } else {
_moveY.setValue(q->maxYExtent());
+ }
//emit flickingChanged();
} else {
flicked = false;
@@ -292,9 +321,9 @@ void QmlGraphicsFlickablePrivate::fixupY()
vTime = timeline.time();
}
-void QmlGraphicsFlickablePrivate::updateBeginningEnd()
+void QDeclarativeFlickablePrivate::updateBeginningEnd()
{
- Q_Q(QmlGraphicsFlickable);
+ Q_Q(QDeclarativeFlickable);
bool atBoundaryChange = false;
// Vertical
@@ -335,7 +364,7 @@ void QmlGraphicsFlickablePrivate::updateBeginningEnd()
}
/*!
- \qmlclass Flickable QmlGraphicsFlickable
+ \qmlclass Flickable QDeclarativeFlickable
\brief The Flickable item provides a surface that can be "flicked".
\inherits Item
@@ -343,7 +372,7 @@ void QmlGraphicsFlickablePrivate::updateBeginningEnd()
\code
Flickable {
- width: 200; height: 200; viewportWidth: image.width; viewportHeight: image.height
+ width: 200; height: 200; contentWidth: image.width; contentHeight: image.height
Image { id: image; source: "bigimage.png" }
}
\endcode
@@ -410,41 +439,41 @@ void QmlGraphicsFlickablePrivate::updateBeginningEnd()
\endcode
*/
-QmlGraphicsFlickable::QmlGraphicsFlickable(QmlGraphicsItem *parent)
- : QmlGraphicsItem(*(new QmlGraphicsFlickablePrivate), parent)
+QDeclarativeFlickable::QDeclarativeFlickable(QDeclarativeItem *parent)
+ : QDeclarativeItem(*(new QDeclarativeFlickablePrivate), parent)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
d->init();
}
-QmlGraphicsFlickable::QmlGraphicsFlickable(QmlGraphicsFlickablePrivate &dd, QmlGraphicsItem *parent)
- : QmlGraphicsItem(dd, parent)
+QDeclarativeFlickable::QDeclarativeFlickable(QDeclarativeFlickablePrivate &dd, QDeclarativeItem *parent)
+ : QDeclarativeItem(dd, parent)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
d->init();
}
-QmlGraphicsFlickable::~QmlGraphicsFlickable()
+QDeclarativeFlickable::~QDeclarativeFlickable()
{
}
/*!
- \qmlproperty int Flickable::viewportX
- \qmlproperty int Flickable::viewportY
+ \qmlproperty int Flickable::contentX
+ \qmlproperty int Flickable::contentY
These properties hold the surface coordinate currently at the top-left
corner of the Flickable. For example, if you flick an image up 100 pixels,
- \c yPosition will be 100.
+ \c contentY will be 100.
*/
-qreal QmlGraphicsFlickable::viewportX() const
+qreal QDeclarativeFlickable::contentX() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return -d->_moveX.value();
}
-void QmlGraphicsFlickable::setViewportX(qreal pos)
+void QDeclarativeFlickable::setContentX(qreal pos)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
pos = qRound(pos);
d->timeline.reset(d->_moveX);
d->vTime = d->timeline.time();
@@ -454,15 +483,15 @@ void QmlGraphicsFlickable::setViewportX(qreal pos)
}
}
-qreal QmlGraphicsFlickable::viewportY() const
+qreal QDeclarativeFlickable::contentY() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return -d->_moveY.value();
}
-void QmlGraphicsFlickable::setViewportY(qreal pos)
+void QDeclarativeFlickable::setContentY(qreal pos)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
pos = qRound(pos);
d->timeline.reset(d->_moveY);
d->vTime = d->timeline.time();
@@ -481,15 +510,15 @@ void QmlGraphicsFlickable::setViewportY(qreal pos)
special interaction with Flickable's children: for example, you might want to
freeze a flickable map while viewing detailed information on a location popup that is a child of the Flickable.
*/
-bool QmlGraphicsFlickable::isInteractive() const
+bool QDeclarativeFlickable::isInteractive() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->interactive;
}
-void QmlGraphicsFlickable::setInteractive(bool interactive)
+void QDeclarativeFlickable::setInteractive(bool interactive)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (interactive != d->interactive) {
d->interactive = interactive;
if (!interactive && d->flicked) {
@@ -506,22 +535,20 @@ void QmlGraphicsFlickable::setInteractive(bool interactive)
/*!
\qmlproperty real Flickable::horizontalVelocity
\qmlproperty real Flickable::verticalVelocity
- \qmlproperty real Flickable::reportedVelocitySmoothing
The instantaneous velocity of movement along the x and y axes, in pixels/sec.
The reported velocity is smoothed to avoid erratic output.
- reportedVelocitySmoothing determines how much smoothing is applied.
*/
-qreal QmlGraphicsFlickable::horizontalVelocity() const
+qreal QDeclarativeFlickable::horizontalVelocity() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->horizontalVelocity.value();
}
-qreal QmlGraphicsFlickable::verticalVelocity() const
+qreal QDeclarativeFlickable::verticalVelocity() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->verticalVelocity.value();
}
@@ -534,46 +561,46 @@ qreal QmlGraphicsFlickable::verticalVelocity() const
These properties are true if the flickable view is positioned at the beginning,
or end respecively.
*/
-bool QmlGraphicsFlickable::isAtXEnd() const
+bool QDeclarativeFlickable::isAtXEnd() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->atXEnd;
}
-bool QmlGraphicsFlickable::isAtXBeginning() const
+bool QDeclarativeFlickable::isAtXBeginning() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->atXBeginning;
}
-bool QmlGraphicsFlickable::isAtYEnd() const
+bool QDeclarativeFlickable::isAtYEnd() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->atYEnd;
}
-bool QmlGraphicsFlickable::isAtYBeginning() const
+bool QDeclarativeFlickable::isAtYBeginning() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->atYBeginning;
}
-void QmlGraphicsFlickable::ticked()
+void QDeclarativeFlickable::ticked()
{
viewportMoved();
}
-QmlGraphicsItem *QmlGraphicsFlickable::viewport()
+QDeclarativeItem *QDeclarativeFlickable::viewport()
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
return d->viewport;
}
-QmlGraphicsFlickableVisibleArea *QmlGraphicsFlickable::visibleArea()
+QDeclarativeFlickableVisibleArea *QDeclarativeFlickable::visibleArea()
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (!d->visibleArea)
- d->visibleArea = new QmlGraphicsFlickableVisibleArea(this);
+ d->visibleArea = new QDeclarativeFlickableVisibleArea(this);
return d->visibleArea;
}
@@ -584,30 +611,30 @@ QmlGraphicsFlickableVisibleArea *QmlGraphicsFlickable::visibleArea()
\list
\o AutoFlickDirection (default) - allows flicking vertically if the
- \e viewportHeight is not equal to the \e height of the Flickable.
- Allows flicking horizontally if the \e viewportWidth is not equal
+ \e contentHeight is not equal to the \e height of the Flickable.
+ Allows flicking horizontally if the \e contentWidth is not equal
to the \e width of the Flickable.
\o HorizontalFlick - allows flicking horizontally.
\o VerticalFlick - allows flicking vertically.
\o HorizontalAndVerticalFlick - allows flicking in both directions.
\endlist
*/
-QmlGraphicsFlickable::FlickDirection QmlGraphicsFlickable::flickDirection() const
+QDeclarativeFlickable::FlickDirection QDeclarativeFlickable::flickDirection() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->flickDirection;
}
-void QmlGraphicsFlickable::setFlickDirection(FlickDirection direction)
+void QDeclarativeFlickable::setFlickDirection(FlickDirection direction)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (direction != d->flickDirection) {
d->flickDirection = direction;
emit flickDirectionChanged();
}
}
-void QmlGraphicsFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event)
{
if (interactive && timeline.isActive() && (qAbs(velocityX) > 10 || qAbs(velocityY) > 10))
stealMouse = true; // If we've been flicked then steal the click.
@@ -618,18 +645,18 @@ void QmlGraphicsFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent
velocityX = 0;
velocityY = 0;
lastPos = QPoint();
- QmlGraphicsItemPrivate::start(lastPosTime);
+ QDeclarativeItemPrivate::start(lastPosTime);
pressPos = event->pos();
pressX = _moveX.value();
pressY = _moveY.value();
flicked = false;
- QmlGraphicsItemPrivate::start(pressTime);
- QmlGraphicsItemPrivate::start(velocityTime);
+ QDeclarativeItemPrivate::start(pressTime);
+ QDeclarativeItemPrivate::start(velocityTime);
}
-void QmlGraphicsFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
- Q_Q(QmlGraphicsFlickable);
+ Q_Q(QDeclarativeFlickable);
if (!interactive || lastPosTime.isNull())
return;
bool rejectY = false;
@@ -638,7 +665,7 @@ void QmlGraphicsFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent
if (q->yflick()) {
int dy = int(event->pos().y() - pressPos.y());
- if (qAbs(dy) > QApplication::startDragDistance() || QmlGraphicsItemPrivate::elapsed(pressTime) > 200) {
+ if (qAbs(dy) > QApplication::startDragDistance() || QDeclarativeItemPrivate::elapsed(pressTime) > 200) {
qreal newY = dy + pressY;
const qreal minY = q->minYExtent();
const qreal maxY = q->maxYExtent();
@@ -665,7 +692,7 @@ void QmlGraphicsFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent
if (q->xflick()) {
int dx = int(event->pos().x() - pressPos.x());
- if (qAbs(dx) > QApplication::startDragDistance() || QmlGraphicsItemPrivate::elapsed(pressTime) > 200) {
+ if (qAbs(dx) > QApplication::startDragDistance() || QDeclarativeItemPrivate::elapsed(pressTime) > 200) {
qreal newX = dx + pressX;
const qreal minX = q->minXExtent();
const qreal maxX = q->maxXExtent();
@@ -692,7 +719,7 @@ void QmlGraphicsFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent
}
if (!lastPos.isNull()) {
- qreal elapsed = qreal(QmlGraphicsItemPrivate::restart(lastPosTime)) / 1000.;
+ qreal elapsed = qreal(QDeclarativeItemPrivate::restart(lastPosTime)) / 1000.;
if (elapsed <= 0)
elapsed = 1;
if (q->yflick()) {
@@ -721,14 +748,14 @@ void QmlGraphicsFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent
lastPos = event->pos();
}
-void QmlGraphicsFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
- Q_Q(QmlGraphicsFlickable);
+ Q_Q(QDeclarativeFlickable);
pressed = false;
if (lastPosTime.isNull())
return;
- if (QmlGraphicsItemPrivate::elapsed(lastPosTime) > 100) {
+ if (QDeclarativeItemPrivate::elapsed(lastPosTime) > 100) {
// if we drag then pause before release we should not cause a flick.
velocityX = 0.0;
velocityY = 0.0;
@@ -760,46 +787,46 @@ void QmlGraphicsFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEve
q->movementEnding();
}
-void QmlGraphicsFlickable::mousePressEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeFlickable::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (d->interactive) {
d->handleMousePressEvent(event);
event->accept();
} else {
- QmlGraphicsItem::mousePressEvent(event);
+ QDeclarativeItem::mousePressEvent(event);
}
}
-void QmlGraphicsFlickable::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeFlickable::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (d->interactive) {
d->handleMouseMoveEvent(event);
event->accept();
} else {
- QmlGraphicsItem::mouseMoveEvent(event);
+ QDeclarativeItem::mouseMoveEvent(event);
}
}
-void QmlGraphicsFlickable::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeFlickable::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (d->interactive) {
d->clearDelayedPress();
d->handleMouseReleaseEvent(event);
event->accept();
ungrabMouse();
} else {
- QmlGraphicsItem::mouseReleaseEvent(event);
+ QDeclarativeItem::mouseReleaseEvent(event);
}
}
-void QmlGraphicsFlickable::wheelEvent(QGraphicsSceneWheelEvent *event)
+void QDeclarativeFlickable::wheelEvent(QGraphicsSceneWheelEvent *event)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (!d->interactive) {
- QmlGraphicsItem::wheelEvent(event);
+ QDeclarativeItem::wheelEvent(event);
} else if (yflick()) {
if (event->delta() > 0)
d->velocityY = qMax(event->delta() - d->verticalVelocity.value(), qreal(250.0));
@@ -817,13 +844,13 @@ void QmlGraphicsFlickable::wheelEvent(QGraphicsSceneWheelEvent *event)
d->flickX(d->velocityX);
event->accept();
} else {
- QmlGraphicsItem::wheelEvent(event);
+ QDeclarativeItem::wheelEvent(event);
}
}
-void QmlGraphicsFlickablePrivate::captureDelayedPress(QGraphicsSceneMouseEvent *event)
+void QDeclarativeFlickablePrivate::captureDelayedPress(QGraphicsSceneMouseEvent *event)
{
- Q_Q(QmlGraphicsFlickable);
+ Q_Q(QDeclarativeFlickable);
if (!q->scene() || pressDelay <= 0)
return;
delayedPressTarget = q->scene()->mouseGrabberItem();
@@ -849,7 +876,7 @@ void QmlGraphicsFlickablePrivate::captureDelayedPress(QGraphicsSceneMouseEvent *
delayedPressTimer.start(pressDelay, q);
}
-void QmlGraphicsFlickablePrivate::clearDelayedPress()
+void QDeclarativeFlickablePrivate::clearDelayedPress()
{
if (delayedPressEvent) {
delayedPressTimer.stop();
@@ -858,23 +885,23 @@ void QmlGraphicsFlickablePrivate::clearDelayedPress()
}
}
-void QmlGraphicsFlickablePrivate::setRoundedViewportX(qreal x)
+void QDeclarativeFlickablePrivate::setRoundedViewportX(qreal x)
{
viewport->setX(qRound(x));
}
-void QmlGraphicsFlickablePrivate::setRoundedViewportY(qreal y)
+void QDeclarativeFlickablePrivate::setRoundedViewportY(qreal y)
{
viewport->setY(qRound(y));
}
-void QmlGraphicsFlickable::timerEvent(QTimerEvent *event)
+void QDeclarativeFlickable::timerEvent(QTimerEvent *event)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (event->timerId() == d->delayedPressTimer.timerId()) {
d->delayedPressTimer.stop();
if (d->delayedPressEvent) {
- QmlGraphicsItem *grabber = scene() ? qobject_cast<QmlGraphicsItem*>(scene()->mouseGrabberItem()) : 0;
+ QDeclarativeItem *grabber = scene() ? qobject_cast<QDeclarativeItem*>(scene()->mouseGrabberItem()) : 0;
if (!grabber || grabber != this)
scene()->sendEvent(d->delayedPressTarget, d->delayedPressEvent);
delete d->delayedPressEvent;
@@ -883,32 +910,32 @@ void QmlGraphicsFlickable::timerEvent(QTimerEvent *event)
}
}
-qreal QmlGraphicsFlickable::minYExtent() const
+qreal QDeclarativeFlickable::minYExtent() const
{
return 0.0;
}
-qreal QmlGraphicsFlickable::minXExtent() const
+qreal QDeclarativeFlickable::minXExtent() const
{
return 0.0;
}
/* returns -ve */
-qreal QmlGraphicsFlickable::maxXExtent() const
+qreal QDeclarativeFlickable::maxXExtent() const
{
return width() - vWidth();
}
/* returns -ve */
-qreal QmlGraphicsFlickable::maxYExtent() const
+qreal QDeclarativeFlickable::maxYExtent() const
{
return height() - vHeight();
}
-void QmlGraphicsFlickable::viewportMoved()
+void QDeclarativeFlickable::viewportMoved()
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
- int elapsed = QmlGraphicsItemPrivate::restart(d->velocityTime);
+ int elapsed = QDeclarativeItemPrivate::restart(d->velocityTime);
if (!elapsed)
return;
@@ -937,54 +964,54 @@ void QmlGraphicsFlickable::viewportMoved()
d->updateBeginningEnd();
}
-void QmlGraphicsFlickable::cancelFlick()
+void QDeclarativeFlickable::cancelFlick()
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
d->timeline.reset(d->_moveX);
d->timeline.reset(d->_moveY);
movementEnding();
}
-void QmlGraphicsFlickablePrivate::data_append(QmlListProperty<QObject> *prop, QObject *o)
+void QDeclarativeFlickablePrivate::data_append(QDeclarativeListProperty<QObject> *prop, QObject *o)
{
- QmlGraphicsItem *i = qobject_cast<QmlGraphicsItem *>(o);
+ QDeclarativeItem *i = qobject_cast<QDeclarativeItem *>(o);
if (i)
- i->setParentItem(static_cast<QmlGraphicsFlickablePrivate*>(prop->data)->viewport);
+ i->setParentItem(static_cast<QDeclarativeFlickablePrivate*>(prop->data)->viewport);
else
o->setParent(prop->object);
}
-QmlListProperty<QObject> QmlGraphicsFlickable::flickableData()
+QDeclarativeListProperty<QObject> QDeclarativeFlickable::flickableData()
{
- Q_D(QmlGraphicsFlickable);
- return QmlListProperty<QObject>(this, (void *)d, QmlGraphicsFlickablePrivate::data_append);
+ Q_D(QDeclarativeFlickable);
+ return QDeclarativeListProperty<QObject>(this, (void *)d, QDeclarativeFlickablePrivate::data_append);
}
-QmlListProperty<QmlGraphicsItem> QmlGraphicsFlickable::flickableChildren()
+QDeclarativeListProperty<QDeclarativeItem> QDeclarativeFlickable::flickableChildren()
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
return d->viewport->fxChildren();
}
/*!
\qmlproperty bool Flickable::overShoot
- This property holds the number of pixels the surface may overshoot the
+ This property holds whether the surface may overshoot the
Flickable's boundaries when flicked.
- If overShoot is non-zero the contents can be flicked beyond the boundary
+ If overShoot is true the contents can be flicked beyond the boundary
of the Flickable before being moved back to the boundary. This provides
the feeling that the edges of the view are soft, rather than a hard
physical boundary.
*/
-bool QmlGraphicsFlickable::overShoot() const
+bool QDeclarativeFlickable::overShoot() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->overShoot;
}
-void QmlGraphicsFlickable::setOverShoot(bool o)
+void QDeclarativeFlickable::setOverShoot(bool o)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (d->overShoot == o)
return;
d->overShoot = o;
@@ -992,28 +1019,28 @@ void QmlGraphicsFlickable::setOverShoot(bool o)
}
/*!
- \qmlproperty int Flickable::viewportWidth
- \qmlproperty int Flickable::viewportHeight
+ \qmlproperty int Flickable::contentWidth
+ \qmlproperty int Flickable::contentHeight
- The dimensions of the viewport (the surface controlled by Flickable). Typically this
+ The dimensions of the content (the surface controlled by Flickable). Typically this
should be set to the combined size of the items placed in the Flickable.
\code
Flickable {
- width: 320; height: 480; viewportWidth: image.width; viewportHeight: image.height
+ width: 320; height: 480; contentWidth: image.width; contentHeight: image.height
Image { id: image; source: "bigimage.png" }
}
\endcode
*/
-qreal QmlGraphicsFlickable::viewportWidth() const
+qreal QDeclarativeFlickable::contentWidth() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->vWidth;
}
-void QmlGraphicsFlickable::setViewportWidth(qreal w)
+void QDeclarativeFlickable::setContentWidth(qreal w)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (d->vWidth == w)
return;
d->vWidth = w;
@@ -1024,39 +1051,39 @@ void QmlGraphicsFlickable::setViewportWidth(qreal w)
// Make sure that we're entirely in view.
if (!d->pressed)
d->fixupX();
- emit viewportWidthChanged();
+ emit contentWidthChanged();
d->updateBeginningEnd();
}
-void QmlGraphicsFlickable::widthChange()
+void QDeclarativeFlickable::widthChange()
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (d->vWidth < 0) {
d->viewport->setWidth(width());
- emit viewportWidthChanged();
+ emit contentWidthChanged();
}
d->updateBeginningEnd();
}
-void QmlGraphicsFlickable::heightChange()
+void QDeclarativeFlickable::heightChange()
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (d->vHeight < 0) {
d->viewport->setHeight(height());
- emit viewportHeightChanged();
+ emit contentHeightChanged();
}
d->updateBeginningEnd();
}
-qreal QmlGraphicsFlickable::viewportHeight() const
+qreal QDeclarativeFlickable::contentHeight() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->vHeight;
}
-void QmlGraphicsFlickable::setViewportHeight(qreal h)
+void QDeclarativeFlickable::setContentHeight(qreal h)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (d->vHeight == h)
return;
d->vHeight = h;
@@ -1067,52 +1094,52 @@ void QmlGraphicsFlickable::setViewportHeight(qreal h)
// Make sure that we're entirely in view.
if (!d->pressed)
d->fixupY();
- emit viewportHeightChanged();
+ emit contentHeightChanged();
d->updateBeginningEnd();
}
-qreal QmlGraphicsFlickable::vWidth() const
+qreal QDeclarativeFlickable::vWidth() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
if (d->vWidth < 0)
return width();
else
return d->vWidth;
}
-qreal QmlGraphicsFlickable::vHeight() const
+qreal QDeclarativeFlickable::vHeight() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
if (d->vHeight < 0)
return height();
else
return d->vHeight;
}
-bool QmlGraphicsFlickable::xflick() const
+bool QDeclarativeFlickable::xflick() const
{
- Q_D(const QmlGraphicsFlickable);
- if (d->flickDirection == QmlGraphicsFlickable::AutoFlickDirection)
+ Q_D(const QDeclarativeFlickable);
+ if (d->flickDirection == QDeclarativeFlickable::AutoFlickDirection)
return vWidth() != width();
- return d->flickDirection & QmlGraphicsFlickable::HorizontalFlick;
+ return d->flickDirection & QDeclarativeFlickable::HorizontalFlick;
}
-bool QmlGraphicsFlickable::yflick() const
+bool QDeclarativeFlickable::yflick() const
{
- Q_D(const QmlGraphicsFlickable);
- if (d->flickDirection == QmlGraphicsFlickable::AutoFlickDirection)
+ Q_D(const QDeclarativeFlickable);
+ if (d->flickDirection == QDeclarativeFlickable::AutoFlickDirection)
return vHeight() != height();
- return d->flickDirection & QmlGraphicsFlickable::VerticalFlick;
+ return d->flickDirection & QDeclarativeFlickable::VerticalFlick;
}
-bool QmlGraphicsFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event)
+bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
QGraphicsSceneMouseEvent mouseEvent(event->type());
QRectF myRect = mapToScene(QRectF(0, 0, width(), height())).boundingRect();
QGraphicsScene *s = scene();
- QmlGraphicsItem *grabber = s ? qobject_cast<QmlGraphicsItem*>(s->mouseGrabberItem()) : 0;
+ QDeclarativeItem *grabber = s ? qobject_cast<QDeclarativeItem*>(s->mouseGrabberItem()) : 0;
if ((d->stealMouse || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) {
mouseEvent.setAccepted(false);
for (int i = 0x1; i <= 0x10; i <<= 1) {
@@ -1147,7 +1174,7 @@ bool QmlGraphicsFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event)
default:
break;
}
- grabber = qobject_cast<QmlGraphicsItem*>(s->mouseGrabberItem());
+ grabber = qobject_cast<QDeclarativeItem*>(s->mouseGrabberItem());
if (grabber && d->stealMouse && !grabber->keepMouseGrab() && grabber != this) {
d->clearDelayedPress();
grabMouse();
@@ -1162,11 +1189,11 @@ bool QmlGraphicsFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event)
return false;
}
-bool QmlGraphicsFlickable::sceneEventFilter(QGraphicsItem *i, QEvent *e)
+bool QDeclarativeFlickable::sceneEventFilter(QGraphicsItem *i, QEvent *e)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (!isVisible() || !d->interactive)
- return QmlGraphicsItem::sceneEventFilter(i, e);
+ return QDeclarativeItem::sceneEventFilter(i, e);
switch (e->type()) {
case QEvent::GraphicsSceneMousePress:
case QEvent::GraphicsSceneMouseMove:
@@ -1176,7 +1203,7 @@ bool QmlGraphicsFlickable::sceneEventFilter(QGraphicsItem *i, QEvent *e)
break;
}
- return QmlGraphicsItem::sceneEventFilter(i, e);
+ return QDeclarativeItem::sceneEventFilter(i, e);
}
/*!
@@ -1185,15 +1212,15 @@ bool QmlGraphicsFlickable::sceneEventFilter(QGraphicsItem *i, QEvent *e)
The default is 2000 pixels/s
*/
-qreal QmlGraphicsFlickable::maximumFlickVelocity() const
+qreal QDeclarativeFlickable::maximumFlickVelocity() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->maxVelocity;
}
-void QmlGraphicsFlickable::setMaximumFlickVelocity(qreal v)
+void QDeclarativeFlickable::setMaximumFlickVelocity(qreal v)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (v == d->maxVelocity)
return;
d->maxVelocity = v;
@@ -1206,15 +1233,15 @@ void QmlGraphicsFlickable::setMaximumFlickVelocity(qreal v)
The default is 500.
*/
-qreal QmlGraphicsFlickable::flickDeceleration() const
+qreal QDeclarativeFlickable::flickDeceleration() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->deceleration;
}
-void QmlGraphicsFlickable::setFlickDeceleration(qreal deceleration)
+void QDeclarativeFlickable::setFlickDeceleration(qreal deceleration)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (deceleration == d->deceleration)
return;
d->deceleration = deceleration;
@@ -1227,9 +1254,9 @@ void QmlGraphicsFlickable::setFlickDeceleration(qreal deceleration)
This property holds whether the view is currently moving due to
the user flicking the view.
*/
-bool QmlGraphicsFlickable::isFlicking() const
+bool QDeclarativeFlickable::isFlicking() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->flicked;
}
@@ -1244,52 +1271,36 @@ bool QmlGraphicsFlickable::isFlicking() const
the press event will not be delivered. If the button is released
within the timeout, both the press and release will be delivered.
*/
-int QmlGraphicsFlickable::pressDelay() const
+int QDeclarativeFlickable::pressDelay() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->pressDelay;
}
-void QmlGraphicsFlickable::setPressDelay(int delay)
+void QDeclarativeFlickable::setPressDelay(int delay)
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (d->pressDelay == delay)
return;
d->pressDelay = delay;
emit pressDelayChanged();
}
-qreal QmlGraphicsFlickable::reportedVelocitySmoothing() const
-{
- Q_D(const QmlGraphicsFlickable);
- return d->reportedVelocitySmoothing;
-}
-
-void QmlGraphicsFlickable::setReportedVelocitySmoothing(qreal reportedVelocitySmoothing)
-{
- Q_D(QmlGraphicsFlickable);
- Q_ASSERT(reportedVelocitySmoothing >= 0);
- if (reportedVelocitySmoothing == d->reportedVelocitySmoothing)
- return;
- d->reportedVelocitySmoothing = reportedVelocitySmoothing;
- emit reportedVelocitySmoothingChanged(reportedVelocitySmoothing);
-}
-
/*!
\qmlproperty bool Flickable::moving
This property holds whether the view is currently moving due to
the user either dragging or flicking the view.
*/
-bool QmlGraphicsFlickable::isMoving() const
+bool QDeclarativeFlickable::isMoving() const
{
- Q_D(const QmlGraphicsFlickable);
+ Q_D(const QDeclarativeFlickable);
return d->moving;
}
-void QmlGraphicsFlickable::movementStarting()
+void QDeclarativeFlickable::movementStarting()
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (!d->moving) {
d->moving = true;
emit movingChanged();
@@ -1297,9 +1308,9 @@ void QmlGraphicsFlickable::movementStarting()
}
}
-void QmlGraphicsFlickable::movementEnding()
+void QDeclarativeFlickable::movementEnding()
{
- Q_D(QmlGraphicsFlickable);
+ Q_D(QDeclarativeFlickable);
if (d->moving) {
d->moving = false;
emit movingChanged();
@@ -1314,9 +1325,9 @@ void QmlGraphicsFlickable::movementEnding()
d->verticalVelocity.setValue(0);
}
-void QmlGraphicsFlickablePrivate::updateVelocity()
+void QDeclarativeFlickablePrivate::updateVelocity()
{
- Q_Q(QmlGraphicsFlickable);
+ Q_Q(QDeclarativeFlickable);
emit q->horizontalVelocityChanged();
emit q->verticalVelocityChanged();
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h
index 580d01e..4617688 100644
--- a/src/declarative/graphicsitems/qmlgraphicsflickable_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSFLICKABLE_H
-#define QMLGRAPHICSFLICKABLE_H
+#ifndef QDECLARATIVEFLICKABLE_H
+#define QDECLARATIVEFLICKABLE_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
QT_BEGIN_HEADER
@@ -50,20 +50,19 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsFlickablePrivate;
-class QmlGraphicsFlickableVisibleArea;
-class Q_DECLARATIVE_EXPORT QmlGraphicsFlickable : public QmlGraphicsItem
+class QDeclarativeFlickablePrivate;
+class QDeclarativeFlickableVisibleArea;
+class Q_DECLARATIVE_EXPORT QDeclarativeFlickable : public QDeclarativeItem
{
Q_OBJECT
- Q_PROPERTY(qreal viewportWidth READ viewportWidth WRITE setViewportWidth NOTIFY viewportWidthChanged)
- Q_PROPERTY(qreal viewportHeight READ viewportHeight WRITE setViewportHeight NOTIFY viewportHeightChanged)
- Q_PROPERTY(qreal viewportX READ viewportX WRITE setViewportX NOTIFY positionXChanged)
- Q_PROPERTY(qreal viewportY READ viewportY WRITE setViewportY NOTIFY positionYChanged)
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged)
+ Q_PROPERTY(qreal contentX READ contentX WRITE setContentX NOTIFY contentXChanged)
+ Q_PROPERTY(qreal contentY READ contentY WRITE setContentY NOTIFY contentYChanged)
Q_PROPERTY(qreal horizontalVelocity READ horizontalVelocity NOTIFY horizontalVelocityChanged)
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 NOTIFY overShootChanged)
Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity NOTIFY maximumFlickVelocityChanged)
@@ -80,35 +79,35 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsFlickable : public QmlGraphicsItem
Q_PROPERTY(bool atXBeginning READ isAtXBeginning NOTIFY isAtBoundaryChanged)
Q_PROPERTY(bool atYBeginning READ isAtYBeginning NOTIFY isAtBoundaryChanged)
- Q_PROPERTY(QmlGraphicsFlickableVisibleArea *visibleArea READ visibleArea CONSTANT)
+ Q_PROPERTY(QDeclarativeFlickableVisibleArea *visibleArea READ visibleArea CONSTANT)
- Q_PROPERTY(QmlListProperty<QObject> flickableData READ flickableData)
- Q_PROPERTY(QmlListProperty<QmlGraphicsItem> flickableChildren READ flickableChildren)
+ Q_PROPERTY(QDeclarativeListProperty<QObject> flickableData READ flickableData)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeItem> flickableChildren READ flickableChildren)
Q_CLASSINFO("DefaultProperty", "flickableData")
Q_ENUMS(FlickDirection)
public:
- QmlGraphicsFlickable(QmlGraphicsItem *parent=0);
- ~QmlGraphicsFlickable();
+ QDeclarativeFlickable(QDeclarativeItem *parent=0);
+ ~QDeclarativeFlickable();
- QmlListProperty<QObject> flickableData();
- QmlListProperty<QmlGraphicsItem> flickableChildren();
+ QDeclarativeListProperty<QObject> flickableData();
+ QDeclarativeListProperty<QDeclarativeItem> flickableChildren();
bool overShoot() const;
void setOverShoot(bool);
- qreal viewportWidth() const;
- void setViewportWidth(qreal);
+ qreal contentWidth() const;
+ void setContentWidth(qreal);
- qreal viewportHeight() const;
- void setViewportHeight(qreal);
+ qreal contentHeight() const;
+ void setContentHeight(qreal);
- qreal viewportX() const;
- void setViewportX(qreal pos);
+ qreal contentX() const;
+ void setContentX(qreal pos);
- qreal viewportY() const;
- void setViewportY(qreal pos);
+ qreal contentY() const;
+ void setContentY(qreal pos);
bool isMoving() const;
bool isFlicking() const;
@@ -116,9 +115,6 @@ public:
int pressDelay() const;
void setPressDelay(int delay);
- qreal reportedVelocitySmoothing() const;
- void setReportedVelocitySmoothing(qreal);
-
qreal maximumFlickVelocity() const;
void setMaximumFlickVelocity(qreal);
@@ -136,24 +132,23 @@ public:
bool isAtYEnd() const;
bool isAtYBeginning() const;
- QmlGraphicsItem *viewport();
+ QDeclarativeItem *viewport();
enum FlickDirection { AutoFlickDirection=0x00, HorizontalFlick=0x01, VerticalFlick=0x02, HorizontalAndVerticalFlick=0x03 };
FlickDirection flickDirection() const;
void setFlickDirection(FlickDirection);
Q_SIGNALS:
- void viewportWidthChanged();
- void viewportHeightChanged();
- void positionXChanged();
- void positionYChanged();
+ void contentWidthChanged();
+ void contentHeightChanged();
+ void contentXChanged();
+ void contentYChanged();
void movingChanged();
void flickingChanged();
void movementStarted();
void movementEnded();
void flickStarted();
void flickEnded();
- void reportedVelocitySmoothingChanged(int);
void horizontalVelocityChanged();
void verticalVelocityChanged();
void isAtBoundaryChanged();
@@ -173,7 +168,7 @@ protected:
void wheelEvent(QGraphicsSceneWheelEvent *event);
void timerEvent(QTimerEvent *event);
- QmlGraphicsFlickableVisibleArea *visibleArea();
+ QDeclarativeFlickableVisibleArea *visibleArea();
protected Q_SLOTS:
virtual void ticked();
@@ -197,17 +192,17 @@ protected:
void cancelFlick();
protected:
- QmlGraphicsFlickable(QmlGraphicsFlickablePrivate &dd, QmlGraphicsItem *parent);
+ QDeclarativeFlickable(QDeclarativeFlickablePrivate &dd, QDeclarativeItem *parent);
private:
- Q_DISABLE_COPY(QmlGraphicsFlickable)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsFlickable)
- friend class QmlGraphicsFlickableVisibleArea;
+ Q_DISABLE_COPY(QDeclarativeFlickable)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeFlickable)
+ friend class QDeclarativeFlickableVisibleArea;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsFlickable)
+QML_DECLARE_TYPE(QDeclarativeFlickable)
QT_END_HEADER
diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
index e58cc0c..1ff4f92 100644
--- a/src/declarative/graphicsitems/qmlgraphicsflickable_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSFLICKABLE_P_H
-#define QMLGRAPHICSFLICKABLE_P_H
+#ifndef QDECLARATIVEFLICKABLE_P_H
+#define QDECLARATIVEFLICKABLE_P_H
//
// W A R N I N G
@@ -53,25 +53,25 @@
// We mean it.
//
-#include "qmlgraphicsflickable_p.h"
+#include "qdeclarativeflickable_p.h"
-#include "qmlgraphicsitem_p.h"
+#include "qdeclarativeitem_p.h"
-#include <qml.h>
-#include <qmltimeline_p_p.h>
-#include <qmlanimation_p_p.h>
+#include <qdeclarative.h>
+#include <qdeclarativetimeline_p_p.h>
+#include <qdeclarativeanimation_p_p.h>
#include <qdatetime.h>
QT_BEGIN_NAMESPACE
-class QmlGraphicsFlickableVisibleArea;
-class QmlGraphicsFlickablePrivate : public QmlGraphicsItemPrivate
+class QDeclarativeFlickableVisibleArea;
+class QDeclarativeFlickablePrivate : public QDeclarativeItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsFlickable)
+ Q_DECLARE_PUBLIC(QDeclarativeFlickable)
public:
- QmlGraphicsFlickablePrivate();
+ QDeclarativeFlickablePrivate();
void init();
virtual void flickX(qreal velocity);
virtual void flickY(qreal velocity);
@@ -85,11 +85,13 @@ public:
void setRoundedViewportX(qreal x);
void setRoundedViewportY(qreal y);
+ qreal overShootDistance(qreal velocity, qreal size);
+
public:
- QmlGraphicsItem *viewport;
- QmlTimeLineValueProxy<QmlGraphicsFlickablePrivate> _moveX;
- QmlTimeLineValueProxy<QmlGraphicsFlickablePrivate> _moveY;
- QmlTimeLine timeline;
+ QDeclarativeItem *viewport;
+ QDeclarativeTimeLineValueProxy<QDeclarativeFlickablePrivate> _moveX;
+ QDeclarativeTimeLineValueProxy<QDeclarativeFlickablePrivate> _moveY;
+ QDeclarativeTimeLine timeline;
qreal vWidth;
qreal vHeight;
bool overShoot : 1;
@@ -127,32 +129,32 @@ public:
static void fixupX_callback(void *);
void updateVelocity();
- struct Velocity : public QmlTimeLineValue
+ struct Velocity : public QDeclarativeTimeLineValue
{
- Velocity(QmlGraphicsFlickablePrivate *p)
+ Velocity(QDeclarativeFlickablePrivate *p)
: parent(p) {}
virtual void setValue(qreal v) {
- QmlTimeLineValue::setValue(v);
+ QDeclarativeTimeLineValue::setValue(v);
parent->updateVelocity();
}
- QmlGraphicsFlickablePrivate *parent;
+ QDeclarativeFlickablePrivate *parent;
};
Velocity horizontalVelocity;
Velocity verticalVelocity;
int vTime;
- QmlTimeLine velocityTimeline;
- QmlGraphicsFlickableVisibleArea *visibleArea;
- QmlGraphicsFlickable::FlickDirection flickDirection;
+ QDeclarativeTimeLine velocityTimeline;
+ QDeclarativeFlickableVisibleArea *visibleArea;
+ QDeclarativeFlickable::FlickDirection flickDirection;
void handleMousePressEvent(QGraphicsSceneMouseEvent *);
void handleMouseMoveEvent(QGraphicsSceneMouseEvent *);
void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *);
// flickableData property
- static void data_append(QmlListProperty<QObject> *, QObject *);
+ static void data_append(QDeclarativeListProperty<QObject> *, QObject *);
};
-class QmlGraphicsFlickableVisibleArea : public QObject
+class QDeclarativeFlickableVisibleArea : public QObject
{
Q_OBJECT
@@ -162,7 +164,7 @@ class QmlGraphicsFlickableVisibleArea : public QObject
Q_PROPERTY(qreal heightRatio READ heightRatio NOTIFY pageChanged)
public:
- QmlGraphicsFlickableVisibleArea(QmlGraphicsFlickable *parent=0);
+ QDeclarativeFlickableVisibleArea(QDeclarativeFlickable *parent=0);
qreal xPosition() const;
qreal widthRatio() const;
@@ -175,7 +177,7 @@ signals:
void pageChanged();
private:
- QmlGraphicsFlickable *flickable;
+ QDeclarativeFlickable *flickable;
qreal m_xPosition;
qreal m_widthRatio;
qreal m_yPosition;
@@ -184,6 +186,6 @@ private:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsFlickableVisibleArea)
+QML_DECLARE_TYPE(QDeclarativeFlickableVisibleArea)
#endif
diff --git a/src/declarative/graphicsitems/qmlgraphicsflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
index f51c203..b36127f 100644
--- a/src/declarative/graphicsitems/qmlgraphicsflipable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
@@ -39,31 +39,31 @@
**
****************************************************************************/
-#include "qmlgraphicsflipable_p.h"
+#include "qdeclarativeflipable_p.h"
-#include "qmlgraphicsitem_p.h"
+#include "qdeclarativeitem_p.h"
-#include <qmlinfo.h>
+#include <qdeclarativeinfo.h>
#include <QtGui/qgraphicstransform.h>
QT_BEGIN_NAMESPACE
-class QmlGraphicsFlipablePrivate : public QmlGraphicsItemPrivate
+class QDeclarativeFlipablePrivate : public QDeclarativeItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsFlipable)
+ Q_DECLARE_PUBLIC(QDeclarativeFlipable)
public:
- QmlGraphicsFlipablePrivate() : current(QmlGraphicsFlipable::Front), front(0), back(0) {}
+ QDeclarativeFlipablePrivate() : current(QDeclarativeFlipable::Front), front(0), back(0) {}
void updateSceneTransformFromParent();
- QmlGraphicsFlipable::Side current;
- QmlGraphicsItem *front;
- QmlGraphicsItem *back;
+ QDeclarativeFlipable::Side current;
+ QDeclarativeItem *front;
+ QDeclarativeItem *back;
};
/*!
- \qmlclass Flipable QmlGraphicsFlipable
+ \qmlclass Flipable QDeclarativeFlipable
\since 4.7
\brief The Flipable item provides a surface that can be flipped.
\inherits Item
@@ -111,21 +111,21 @@ public:
/*!
\internal
- \class QmlGraphicsFlipable
- \brief The QmlGraphicsFlipable class provides a flipable surface.
+ \class QDeclarativeFlipable
+ \brief The QDeclarativeFlipable class provides a flipable surface.
\ingroup group_widgets
- QmlGraphicsFlipable allows you to specify a front and a back, as well as an
+ QDeclarativeFlipable allows you to specify a front and a back, as well as an
axis for the flip.
*/
-QmlGraphicsFlipable::QmlGraphicsFlipable(QmlGraphicsItem *parent)
-: QmlGraphicsItem(*(new QmlGraphicsFlipablePrivate), parent)
+QDeclarativeFlipable::QDeclarativeFlipable(QDeclarativeItem *parent)
+: QDeclarativeItem(*(new QDeclarativeFlipablePrivate), parent)
{
}
-QmlGraphicsFlipable::~QmlGraphicsFlipable()
+QDeclarativeFlipable::~QDeclarativeFlipable()
{
}
@@ -136,15 +136,15 @@ QmlGraphicsFlipable::~QmlGraphicsFlipable()
The front and back sides of the flipable.
*/
-QmlGraphicsItem *QmlGraphicsFlipable::front()
+QDeclarativeItem *QDeclarativeFlipable::front()
{
- Q_D(const QmlGraphicsFlipable);
+ Q_D(const QDeclarativeFlipable);
return d->front;
}
-void QmlGraphicsFlipable::setFront(QmlGraphicsItem *front)
+void QDeclarativeFlipable::setFront(QDeclarativeItem *front)
{
- Q_D(QmlGraphicsFlipable);
+ Q_D(QDeclarativeFlipable);
if (d->front) {
qmlInfo(this) << tr("front is a write-once property");
return;
@@ -155,15 +155,15 @@ void QmlGraphicsFlipable::setFront(QmlGraphicsItem *front)
d->front->setOpacity(0.);
}
-QmlGraphicsItem *QmlGraphicsFlipable::back()
+QDeclarativeItem *QDeclarativeFlipable::back()
{
- Q_D(const QmlGraphicsFlipable);
+ Q_D(const QDeclarativeFlipable);
return d->back;
}
-void QmlGraphicsFlipable::setBack(QmlGraphicsItem *back)
+void QDeclarativeFlipable::setBack(QDeclarativeItem *back)
{
- Q_D(QmlGraphicsFlipable);
+ Q_D(QDeclarativeFlipable);
if (d->back) {
qmlInfo(this) << tr("back is a write-once property");
return;
@@ -180,11 +180,11 @@ void QmlGraphicsFlipable::setBack(QmlGraphicsItem *back)
The side of the Flippable currently visible. Possible values are \c
Front and \c Back.
*/
-QmlGraphicsFlipable::Side QmlGraphicsFlipable::side() const
+QDeclarativeFlipable::Side QDeclarativeFlipable::side() const
{
- Q_D(const QmlGraphicsFlipable);
+ Q_D(const QDeclarativeFlipable);
if (d->dirtySceneTransform)
- const_cast<QmlGraphicsFlipablePrivate *>(d)->updateSceneTransformFromParent();
+ const_cast<QDeclarativeFlipablePrivate *>(d)->updateSceneTransformFromParent();
return d->current;
}
@@ -192,11 +192,11 @@ QmlGraphicsFlipable::Side QmlGraphicsFlipable::side() const
// determination on the currently visible side of the flipable
// has to be done on the complete scene transform to give
// correct results.
-void QmlGraphicsFlipablePrivate::updateSceneTransformFromParent()
+void QDeclarativeFlipablePrivate::updateSceneTransformFromParent()
{
- Q_Q(QmlGraphicsFlipable);
+ Q_Q(QDeclarativeFlipable);
- QmlGraphicsItemPrivate::updateSceneTransformFromParent();
+ QDeclarativeItemPrivate::updateSceneTransformFromParent();
QPointF p1(0, 0);
QPointF p2(1, 0);
QPointF p3(1, 1);
@@ -208,16 +208,16 @@ void QmlGraphicsFlipablePrivate::updateSceneTransformFromParent()
qreal cross = (p1.x() - p2.x()) * (p3.y() - p2.y()) -
(p1.y() - p2.y()) * (p3.x() - p2.x());
- QmlGraphicsFlipable::Side newSide;
+ QDeclarativeFlipable::Side newSide;
if (cross > 0) {
- newSide = QmlGraphicsFlipable::Back;
+ newSide = QDeclarativeFlipable::Back;
} else {
- newSide = QmlGraphicsFlipable::Front;
+ newSide = QDeclarativeFlipable::Front;
}
if (newSide != current) {
current = newSide;
- if (current == QmlGraphicsFlipable::Back) {
+ if (current == QDeclarativeFlipable::Back) {
QTransform mat;
mat.translate(back->width()/2,back->height()/2);
if (back->width() && p1.x() >= p2.x())
@@ -228,9 +228,9 @@ void QmlGraphicsFlipablePrivate::updateSceneTransformFromParent()
back->setTransform(mat);
}
if (front)
- front->setOpacity((current==QmlGraphicsFlipable::Front)?1.:0.);
+ front->setOpacity((current==QDeclarativeFlipable::Front)?1.:0.);
if (back)
- back->setOpacity((current==QmlGraphicsFlipable::Back)?1.:0.);
+ back->setOpacity((current==QDeclarativeFlipable::Back)?1.:0.);
emit q->sideChanged();
}
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsflipable_p.h b/src/declarative/graphicsitems/qdeclarativeflipable_p.h
index 2b9e44e..8b9c24c 100644
--- a/src/declarative/graphicsitems/qmlgraphicsflipable_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeflipable_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSFLIPABLE_H
-#define QMLGRAPHICSFLIPABLE_H
+#ifndef QDECLARATIVEFLIPABLE_H
+#define QDECLARATIVEFLIPABLE_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
#include <QtCore/QObject>
#include <QtGui/QTransform>
@@ -54,26 +54,26 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsFlipablePrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsFlipable : public QmlGraphicsItem
+class QDeclarativeFlipablePrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeFlipable : public QDeclarativeItem
{
Q_OBJECT
Q_ENUMS(Side)
- Q_PROPERTY(QmlGraphicsItem *front READ front WRITE setFront)
- Q_PROPERTY(QmlGraphicsItem *back READ back WRITE setBack)
+ Q_PROPERTY(QDeclarativeItem *front READ front WRITE setFront)
+ Q_PROPERTY(QDeclarativeItem *back READ back WRITE setBack)
Q_PROPERTY(Side side READ side NOTIFY sideChanged)
//### flipAxis
//### flipRotation
public:
- QmlGraphicsFlipable(QmlGraphicsItem *parent=0);
- ~QmlGraphicsFlipable();
+ QDeclarativeFlipable(QDeclarativeItem *parent=0);
+ ~QDeclarativeFlipable();
- QmlGraphicsItem *front();
- void setFront(QmlGraphicsItem *);
+ QDeclarativeItem *front();
+ void setFront(QDeclarativeItem *);
- QmlGraphicsItem *back();
- void setBack(QmlGraphicsItem *);
+ QDeclarativeItem *back();
+ void setBack(QDeclarativeItem *);
enum Side { Front, Back };
Side side() const;
@@ -82,14 +82,14 @@ Q_SIGNALS:
void sideChanged();
private:
- Q_DISABLE_COPY(QmlGraphicsFlipable)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsFlipable)
+ Q_DISABLE_COPY(QDeclarativeFlipable)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeFlipable)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsFlipable)
+QML_DECLARE_TYPE(QDeclarativeFlipable)
QT_END_HEADER
-#endif // QMLGRAPHICSFLIPABLE_H
+#endif // QDECLARATIVEFLIPABLE_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsfocuspanel.cpp b/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp
index 4d7af54..0323a59 100644
--- a/src/declarative/graphicsitems/qmlgraphicsfocuspanel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativefocuspanel.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmlgraphicsfocuspanel_p.h"
+#include "qdeclarativefocuspanel_p.h"
#include <QtGui/qgraphicsscene.h>
#include <QEvent>
@@ -47,7 +47,7 @@
QT_BEGIN_NAMESPACE
/*!
- \qmlclass FocusPanel QmlGraphicsFocusPanel
+ \qmlclass FocusPanel QDeclarativeFocusPanel
\since 4.7
\brief The FocusPanel item explicitly creates a focus panel.
\inherits Item
@@ -59,16 +59,16 @@ QT_BEGIN_NAMESPACE
/*!
\internal
- \class QmlGraphicsFocusPanel
+ \class QDeclarativeFocusPanel
*/
-QmlGraphicsFocusPanel::QmlGraphicsFocusPanel(QmlGraphicsItem *parent) :
- QmlGraphicsItem(parent)
+QDeclarativeFocusPanel::QDeclarativeFocusPanel(QDeclarativeItem *parent) :
+ QDeclarativeItem(parent)
{
setFlag(ItemIsPanel);
}
-QmlGraphicsFocusPanel::~QmlGraphicsFocusPanel()
+QDeclarativeFocusPanel::~QDeclarativeFocusPanel()
{
}
@@ -78,12 +78,12 @@ QmlGraphicsFocusPanel::~QmlGraphicsFocusPanel()
Sets whether the item is the active focus panel.
*/
-bool QmlGraphicsFocusPanel::sceneEvent(QEvent *event)
+bool QDeclarativeFocusPanel::sceneEvent(QEvent *event)
{
if (event->type() == QEvent::WindowActivate ||
event->type() == QEvent::WindowDeactivate)
emit activeChanged();
- return QmlGraphicsItem::sceneEvent(event);
+ return QDeclarativeItem::sceneEvent(event);
}
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qmlgraphicsfocuspanel_p.h b/src/declarative/graphicsitems/qdeclarativefocuspanel_p.h
index 935b04e..1ad8b6e 100644
--- a/src/declarative/graphicsitems/qmlgraphicsfocuspanel_p.h
+++ b/src/declarative/graphicsitems/qdeclarativefocuspanel_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSFOCUSPANEL_H
-#define QMLGRAPHICSFOCUSPANEL_H
+#ifndef QDECLARATIVEFOCUSPANEL_H
+#define QDECLARATIVEFOCUSPANEL_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
QT_BEGIN_HEADER
@@ -50,13 +50,13 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class Q_DECLARATIVE_EXPORT QmlGraphicsFocusPanel : public QmlGraphicsItem
+class Q_DECLARATIVE_EXPORT QDeclarativeFocusPanel : public QDeclarativeItem
{
Q_OBJECT
Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged)
public:
- QmlGraphicsFocusPanel(QmlGraphicsItem *parent=0);
- virtual ~QmlGraphicsFocusPanel();
+ QDeclarativeFocusPanel(QDeclarativeItem *parent=0);
+ virtual ~QDeclarativeFocusPanel();
Q_SIGNALS:
void activeChanged();
@@ -65,13 +65,13 @@ protected:
bool sceneEvent(QEvent *event);
private:
- Q_DISABLE_COPY(QmlGraphicsFocusPanel)
+ Q_DISABLE_COPY(QDeclarativeFocusPanel)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsFocusPanel)
+QML_DECLARE_TYPE(QDeclarativeFocusPanel)
QT_END_HEADER
-#endif // QMLGRAPHICSFOCUSPANEL_H
+#endif // QDECLARATIVEFOCUSPANEL_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsfocusscope.cpp b/src/declarative/graphicsitems/qdeclarativefocusscope.cpp
index bba471a..384a47b 100644
--- a/src/declarative/graphicsitems/qmlgraphicsfocusscope.cpp
+++ b/src/declarative/graphicsitems/qdeclarativefocusscope.cpp
@@ -39,12 +39,12 @@
**
****************************************************************************/
-#include "qmlgraphicsfocusscope_p.h"
+#include "qdeclarativefocusscope_p.h"
QT_BEGIN_NAMESPACE
/*!
- \qmlclass FocusScope QmlGraphicsFocusScope
+ \qmlclass FocusScope QDeclarativeFocusScope
\since 4.7
\brief The FocusScope object explicitly creates a focus scope.
\inherits Item
@@ -56,16 +56,16 @@ QT_BEGIN_NAMESPACE
/*!
\internal
- \class QmlGraphicsFocusScope
+ \class QDeclarativeFocusScope
*/
-QmlGraphicsFocusScope::QmlGraphicsFocusScope(QmlGraphicsItem *parent) :
- QmlGraphicsItem(parent)
+QDeclarativeFocusScope::QDeclarativeFocusScope(QDeclarativeItem *parent) :
+ QDeclarativeItem(parent)
{
setFlag(QGraphicsItem::ItemIsFocusScope);
}
-QmlGraphicsFocusScope::~QmlGraphicsFocusScope()
+QDeclarativeFocusScope::~QDeclarativeFocusScope()
{
}
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qmlgraphicsfocusscope_p.h b/src/declarative/graphicsitems/qdeclarativefocusscope_p.h
index ca53b01..cd480b4 100644
--- a/src/declarative/graphicsitems/qmlgraphicsfocusscope_p.h
+++ b/src/declarative/graphicsitems/qdeclarativefocusscope_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSFOCUSSCOPE_H
-#define QMLGRAPHICSFOCUSSCOPE_H
+#ifndef QDECLARATIVEFOCUSSCOPE_H
+#define QDECLARATIVEFOCUSSCOPE_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
QT_BEGIN_HEADER
@@ -51,18 +51,18 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
//### set component root as focusscope
-class Q_DECLARATIVE_EXPORT QmlGraphicsFocusScope : public QmlGraphicsItem
+class Q_DECLARATIVE_EXPORT QDeclarativeFocusScope : public QDeclarativeItem
{
Q_OBJECT
public:
- QmlGraphicsFocusScope(QmlGraphicsItem *parent=0);
- virtual ~QmlGraphicsFocusScope();
+ QDeclarativeFocusScope(QDeclarativeItem *parent=0);
+ virtual ~QDeclarativeFocusScope();
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsFocusScope)
+QML_DECLARE_TYPE(QDeclarativeFocusScope)
QT_END_HEADER
-#endif // QMLGRAPHICSFOCUSSCOPE_H
+#endif // QDECLARATIVEFOCUSSCOPE_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer.cpp b/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp
index 692f7a9..1977817 100644
--- a/src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#include "qmlgraphicsgraphicsobjectcontainer_p.h"
+#include "qdeclarativegraphicsobjectcontainer_p.h"
-#include "qmlgraphicsitem_p.h"
+#include "qdeclarativeitem_p.h"
#include <QGraphicsObject>
#include <QGraphicsWidget>
@@ -49,19 +49,19 @@
QT_BEGIN_NAMESPACE
-class QmlGraphicsGraphicsObjectContainerPrivate : public QmlGraphicsItemPrivate
+class QDeclarativeGraphicsObjectContainerPrivate : public QDeclarativeItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsGraphicsObjectContainer)
+ Q_DECLARE_PUBLIC(QDeclarativeGraphicsObjectContainer)
public:
- QmlGraphicsGraphicsObjectContainerPrivate() : QmlGraphicsItemPrivate(), graphicsObject(0), syncedResize(false)
+ QDeclarativeGraphicsObjectContainerPrivate() : QDeclarativeItemPrivate(), graphicsObject(0), syncedResize(false)
{ }
void _q_updateSize();
void setFiltering(bool on)
{
- Q_Q(QmlGraphicsGraphicsObjectContainer);
+ Q_Q(QDeclarativeGraphicsObjectContainer);
if (graphicsObject && graphicsObject->isWidget()) {
if (!on) {
graphicsObject->removeEventFilter(q);
@@ -82,15 +82,15 @@ public:
/*!
- \qmlclass GraphicsObjectContainer QmlGraphicsGraphicsObjectContainer
+ \qmlclass GraphicsObjectContainer QDeclarativeGraphicsObjectContainer
\since 4.7
\brief The GraphicsObjectContainer element allows you to add QGraphicsObjects into Fluid UI elements.
- While any QObject based class can be exposed to QML, QmlGraphicsItem
+ While any QObject based class can be exposed to QML, QDeclarativeItem
provides a lot of important functionality, including anchors and proper
management of child items. GraphicsObjectContainer helps provide these
functions to other QGraphicsObjects, so that they can be used unaltered in
- a QML scene. QGraphicsObjects, which are not QmlGraphicsItems, and which are
+ a QML scene. QGraphicsObjects, which are not QDeclarativeItems, and which are
placed in a QML scene outside of a GraphicsObjectContainer, will not appear
on screen at all.
@@ -128,22 +128,22 @@ public:
/*!
\internal
- \class QmlGraphicsGraphicsObjectContainer
- \brief The QmlGraphicsGraphicsObjectContainer class allows you to add QGraphicsObjects into Fluid UI applications.
+ \class QDeclarativeGraphicsObjectContainer
+ \brief The QDeclarativeGraphicsObjectContainer class allows you to add QGraphicsObjects into Fluid UI applications.
*/
-QmlGraphicsGraphicsObjectContainer::QmlGraphicsGraphicsObjectContainer(QmlGraphicsItem *parent)
-: QmlGraphicsItem(*new QmlGraphicsGraphicsObjectContainerPrivate, parent)
+QDeclarativeGraphicsObjectContainer::QDeclarativeGraphicsObjectContainer(QDeclarativeItem *parent)
+: QDeclarativeItem(*new QDeclarativeGraphicsObjectContainerPrivate, parent)
{
}
-QmlGraphicsGraphicsObjectContainer::~QmlGraphicsGraphicsObjectContainer()
+QDeclarativeGraphicsObjectContainer::~QDeclarativeGraphicsObjectContainer()
{
}
-QGraphicsObject *QmlGraphicsGraphicsObjectContainer::graphicsObject() const
+QGraphicsObject *QDeclarativeGraphicsObjectContainer::graphicsObject() const
{
- Q_D(const QmlGraphicsGraphicsObjectContainer);
+ Q_D(const QDeclarativeGraphicsObjectContainer);
return d->graphicsObject;
}
@@ -151,9 +151,9 @@ QGraphicsObject *QmlGraphicsGraphicsObjectContainer::graphicsObject() const
\qmlproperty QGraphicsObject GraphicsObjectContainer::graphicsObject
The QGraphicsObject associated with this element.
*/
-void QmlGraphicsGraphicsObjectContainer::setGraphicsObject(QGraphicsObject *object)
+void QDeclarativeGraphicsObjectContainer::setGraphicsObject(QGraphicsObject *object)
{
- Q_D(QmlGraphicsGraphicsObjectContainer);
+ Q_D(QDeclarativeGraphicsObjectContainer);
if (object == d->graphicsObject)
return;
@@ -186,20 +186,20 @@ void QmlGraphicsGraphicsObjectContainer::setGraphicsObject(QGraphicsObject *obje
}
}
-QVariant QmlGraphicsGraphicsObjectContainer::itemChange(GraphicsItemChange change, const QVariant &value)
+QVariant QDeclarativeGraphicsObjectContainer::itemChange(GraphicsItemChange change, const QVariant &value)
{
- Q_D(QmlGraphicsGraphicsObjectContainer);
+ Q_D(QDeclarativeGraphicsObjectContainer);
if (change == ItemSceneHasChanged) {
QGraphicsObject *o = d->graphicsObject;
d->graphicsObject = 0;
setGraphicsObject(o);
}
- return QmlGraphicsItem::itemChange(change, value);
+ return QDeclarativeItem::itemChange(change, value);
}
-bool QmlGraphicsGraphicsObjectContainer::eventFilter(QObject *watched, QEvent *e)
+bool QDeclarativeGraphicsObjectContainer::eventFilter(QObject *watched, QEvent *e)
{
- Q_D(QmlGraphicsGraphicsObjectContainer);
+ Q_D(QDeclarativeGraphicsObjectContainer);
if (watched == d->graphicsObject && e->type() == QEvent::GraphicsSceneResize) {
if (d->graphicsObject && d->graphicsObject->isWidget() && d->syncedResize) {
QSizeF newSize = static_cast<QGraphicsWidget*>(d->graphicsObject)->size();
@@ -207,7 +207,7 @@ bool QmlGraphicsGraphicsObjectContainer::eventFilter(QObject *watched, QEvent *e
setImplicitHeight(newSize.height());
}
}
- return QmlGraphicsItem::eventFilter(watched, e);
+ return QDeclarativeItem::eventFilter(watched, e);
}
/*!
@@ -229,15 +229,15 @@ bool QmlGraphicsGraphicsObjectContainer::eventFilter(QObject *watched, QEvent *e
widget's size will be reflected in the container.
\endlist
*/
-bool QmlGraphicsGraphicsObjectContainer::synchronizedResizing() const
+bool QDeclarativeGraphicsObjectContainer::synchronizedResizing() const
{
- Q_D(const QmlGraphicsGraphicsObjectContainer);
+ Q_D(const QDeclarativeGraphicsObjectContainer);
return d->syncedResize;
}
-void QmlGraphicsGraphicsObjectContainer::setSynchronizedResizing(bool on)
+void QDeclarativeGraphicsObjectContainer::setSynchronizedResizing(bool on)
{
- Q_D(QmlGraphicsGraphicsObjectContainer);
+ Q_D(QDeclarativeGraphicsObjectContainer);
if (on == d->syncedResize)
return;
@@ -245,7 +245,7 @@ void QmlGraphicsGraphicsObjectContainer::setSynchronizedResizing(bool on)
d->setFiltering(on);
}
-void QmlGraphicsGraphicsObjectContainerPrivate::_q_updateSize()
+void QDeclarativeGraphicsObjectContainerPrivate::_q_updateSize()
{
if (!graphicsObject || !graphicsObject->isWidget() || !syncedResize)
return;
@@ -264,6 +264,6 @@ void QmlGraphicsGraphicsObjectContainerPrivate::_q_updateSize()
}*/
}
-#include <moc_qmlgraphicsgraphicsobjectcontainer_p.cpp>
+#include <moc_qdeclarativegraphicsobjectcontainer_p.cpp>
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer_p.h b/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h
index e263aa0..95d7a4b 100644
--- a/src/declarative/graphicsitems/qmlgraphicsgraphicsobjectcontainer_p.h
+++ b/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSGRAPHICSOBJECTCONTAINER_H
-#define QMLGRAPHICSGRAPHICSOBJECTCONTAINER_H
+#ifndef QDECLARATIVEGRAPHICSOBJECTCONTAINER_H
+#define QDECLARATIVEGRAPHICSOBJECTCONTAINER_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
QT_BEGIN_HEADER
@@ -51,9 +51,9 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QGraphicsObject;
-class QmlGraphicsGraphicsObjectContainerPrivate;
+class QDeclarativeGraphicsObjectContainerPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsGraphicsObjectContainer : public QmlGraphicsItem
+class Q_DECLARATIVE_EXPORT QDeclarativeGraphicsObjectContainer : public QDeclarativeItem
{
Q_OBJECT
@@ -62,8 +62,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsGraphicsObjectContainer : public QmlGraphi
Q_PROPERTY(bool synchronizedResizing READ synchronizedResizing WRITE setSynchronizedResizing)
public:
- QmlGraphicsGraphicsObjectContainer(QmlGraphicsItem *parent = 0);
- ~QmlGraphicsGraphicsObjectContainer();
+ QDeclarativeGraphicsObjectContainer(QDeclarativeItem *parent = 0);
+ ~QDeclarativeGraphicsObjectContainer();
QGraphicsObject *graphicsObject() const;
void setGraphicsObject(QGraphicsObject *);
@@ -77,14 +77,14 @@ protected:
private:
Q_PRIVATE_SLOT(d_func(), void _q_updateSize())
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsGraphicsObjectContainer)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeGraphicsObjectContainer)
};
QT_END_NAMESPACE
QML_DECLARE_TYPE(QGraphicsObject)
-QML_DECLARE_TYPE(QmlGraphicsGraphicsObjectContainer)
+QML_DECLARE_TYPE(QDeclarativeGraphicsObjectContainer)
QT_END_HEADER
-#endif // QMLGRAPHICSGRAPHICSOBJECTCONTAINER_H
+#endif // QDECLARATIVEGRAPHICSOBJECTCONTAINER_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index bf370ae..0a103f3 100644
--- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -39,19 +39,19 @@
**
****************************************************************************/
-#include "qmlgraphicsgridview_p.h"
+#include "qdeclarativegridview_p.h"
-#include "qmlgraphicsvisualitemmodel_p.h"
-#include "qmlgraphicsflickable_p_p.h"
+#include "qdeclarativevisualitemmodel_p.h"
+#include "qdeclarativeflickable_p_p.h"
-#include <qmleasefollow_p.h>
+#include <qdeclarativeeasefollow_p.h>
#include <qlistmodelinterface_p.h>
#include <QKeyEvent>
QT_BEGIN_NAMESPACE
-QHash<QObject*, QmlGraphicsGridViewAttached*> QmlGraphicsGridViewAttached::attachedProperties;
+QHash<QObject*, QDeclarativeGridViewAttached*> QDeclarativeGridViewAttached::attachedProperties;
//----------------------------------------------------------------------------
@@ -59,42 +59,42 @@ QHash<QObject*, QmlGraphicsGridViewAttached*> QmlGraphicsGridViewAttached::attac
class FxGridItem
{
public:
- FxGridItem(QmlGraphicsItem *i, QmlGraphicsGridView *v) : item(i), view(v) {
- attached = QmlGraphicsGridViewAttached::properties(item);
+ FxGridItem(QDeclarativeItem *i, QDeclarativeGridView *v) : item(i), view(v) {
+ attached = QDeclarativeGridViewAttached::properties(item);
attached->m_view = view;
}
~FxGridItem() {}
- qreal rowPos() const { return (view->flow() == QmlGraphicsGridView::LeftToRight ? item->y() : item->x()); }
- qreal colPos() const { return (view->flow() == QmlGraphicsGridView::LeftToRight ? item->x() : item->y()); }
+ qreal rowPos() const { return (view->flow() == QDeclarativeGridView::LeftToRight ? item->y() : item->x()); }
+ qreal colPos() const { return (view->flow() == QDeclarativeGridView::LeftToRight ? item->x() : item->y()); }
qreal endRowPos() const {
- return view->flow() == QmlGraphicsGridView::LeftToRight
+ return view->flow() == QDeclarativeGridView::LeftToRight
? item->y() + view->cellHeight() - 1
: item->x() + view->cellWidth() - 1;
}
void setPosition(qreal col, qreal row) {
- if (view->flow() == QmlGraphicsGridView::LeftToRight) {
+ if (view->flow() == QDeclarativeGridView::LeftToRight) {
item->setPos(QPointF(col, row));
} else {
item->setPos(QPointF(row, col));
}
}
- QmlGraphicsItem *item;
- QmlGraphicsGridView *view;
- QmlGraphicsGridViewAttached *attached;
+ QDeclarativeItem *item;
+ QDeclarativeGridView *view;
+ QDeclarativeGridViewAttached *attached;
int index;
};
//----------------------------------------------------------------------------
-class QmlGraphicsGridViewPrivate : public QmlGraphicsFlickablePrivate
+class QDeclarativeGridViewPrivate : public QDeclarativeFlickablePrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsGridView)
+ Q_DECLARE_PUBLIC(QDeclarativeGridView)
public:
- QmlGraphicsGridViewPrivate()
- : currentItem(0), flow(QmlGraphicsGridView::LeftToRight)
+ QDeclarativeGridViewPrivate()
+ : currentItem(0), flow(QDeclarativeGridView::LeftToRight)
, visiblePos(0), visibleIndex(0) , currentIndex(-1)
, cellWidth(100), cellHeight(100), columns(1), requestedIndex(-1)
, highlightComponent(0), highlight(0), trackedItem(0)
@@ -132,19 +132,19 @@ public:
}
qreal position() const {
- Q_Q(const QmlGraphicsGridView);
- return flow == QmlGraphicsGridView::LeftToRight ? q->viewportY() : q->viewportX();
+ Q_Q(const QDeclarativeGridView);
+ return flow == QDeclarativeGridView::LeftToRight ? q->contentY() : q->contentX();
}
void setPosition(qreal pos) {
- Q_Q(QmlGraphicsGridView);
- if (flow == QmlGraphicsGridView::LeftToRight)
- q->setViewportY(pos);
+ Q_Q(QDeclarativeGridView);
+ if (flow == QDeclarativeGridView::LeftToRight)
+ q->setContentY(pos);
else
- q->setViewportX(pos);
+ q->setContentX(pos);
}
int size() const {
- Q_Q(const QmlGraphicsGridView);
- return flow == QmlGraphicsGridView::LeftToRight ? q->height() : q->width();
+ Q_Q(const QDeclarativeGridView);
+ return flow == QDeclarativeGridView::LeftToRight ? q->height() : q->width();
}
qreal startPosition() const {
qreal pos = 0;
@@ -165,10 +165,10 @@ public:
}
int rowSize() const {
- return flow == QmlGraphicsGridView::LeftToRight ? cellHeight : cellWidth;
+ return flow == QDeclarativeGridView::LeftToRight ? cellHeight : cellWidth;
}
int colSize() const {
- return flow == QmlGraphicsGridView::LeftToRight ? cellWidth : cellHeight;
+ return flow == QDeclarativeGridView::LeftToRight ? cellWidth : cellHeight;
}
qreal colPosAt(int modelIndex) const {
@@ -251,12 +251,12 @@ public:
}
}
- QGuard<QmlGraphicsVisualModel> model;
+ QGuard<QDeclarativeVisualModel> model;
QVariant modelVariant;
QList<FxGridItem*> visibleItems;
- QHash<QmlGraphicsItem*,int> unrequestedItems;
+ QHash<QDeclarativeItem*,int> unrequestedItems;
FxGridItem *currentItem;
- QmlGraphicsGridView::Flow flow;
+ QDeclarativeGridView::Flow flow;
int visiblePos;
int visibleIndex;
int currentIndex;
@@ -264,14 +264,14 @@ public:
int cellHeight;
int columns;
int requestedIndex;
- QmlComponent *highlightComponent;
+ QDeclarativeComponent *highlightComponent;
FxGridItem *highlight;
FxGridItem *trackedItem;
enum MovementReason { Other, SetIndex, Mouse };
MovementReason moveReason;
int buffer;
- QmlEaseFollow *highlightXAnimator;
- QmlEaseFollow *highlightYAnimator;
+ QDeclarativeEaseFollow *highlightXAnimator;
+ QDeclarativeEaseFollow *highlightYAnimator;
enum BufferMode { NoBuffer = 0x00, BufferBefore = 0x01, BufferAfter = 0x02 };
BufferMode bufferMode;
@@ -284,16 +284,16 @@ public:
bool deferredRelease : 1;
};
-void QmlGraphicsGridViewPrivate::init()
+void QDeclarativeGridViewPrivate::init()
{
- Q_Q(QmlGraphicsGridView);
+ Q_Q(QDeclarativeGridView);
q->setFlag(QGraphicsItem::ItemIsFocusScope);
QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(sizeChange()));
QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(sizeChange()));
- q->setFlickDirection(QmlGraphicsFlickable::VerticalFlick);
+ q->setFlickDirection(QDeclarativeFlickable::VerticalFlick);
}
-void QmlGraphicsGridViewPrivate::clear()
+void QDeclarativeGridViewPrivate::clear()
{
for (int i = 0; i < visibleItems.count(); ++i)
releaseItem(visibleItems.at(i));
@@ -306,13 +306,13 @@ void QmlGraphicsGridViewPrivate::clear()
trackedItem = 0;
}
-FxGridItem *QmlGraphicsGridViewPrivate::createItem(int modelIndex)
+FxGridItem *QDeclarativeGridViewPrivate::createItem(int modelIndex)
{
- Q_Q(QmlGraphicsGridView);
+ Q_Q(QDeclarativeGridView);
// create object
requestedIndex = modelIndex;
FxGridItem *listItem = 0;
- if (QmlGraphicsItem *item = model->item(modelIndex, false)) {
+ if (QDeclarativeItem *item = model->item(modelIndex, false)) {
listItem = new FxGridItem(item, q);
listItem->index = modelIndex;
// complete
@@ -321,14 +321,14 @@ FxGridItem *QmlGraphicsGridViewPrivate::createItem(int modelIndex)
listItem->item->setParent(q->viewport());
unrequestedItems.remove(listItem->item);
}
- requestedIndex = 0;
+ requestedIndex = -1;
return listItem;
}
-void QmlGraphicsGridViewPrivate::releaseItem(FxGridItem *item)
+void QDeclarativeGridViewPrivate::releaseItem(FxGridItem *item)
{
- Q_Q(QmlGraphicsGridView);
+ Q_Q(QDeclarativeGridView);
if (!item || !model)
return;
if (trackedItem == item) {
@@ -343,9 +343,9 @@ void QmlGraphicsGridViewPrivate::releaseItem(FxGridItem *item)
delete item;
}
-void QmlGraphicsGridViewPrivate::refill(qreal from, qreal to, bool doBuffer)
+void QDeclarativeGridViewPrivate::refill(qreal from, qreal to, bool doBuffer)
{
- Q_Q(QmlGraphicsGridView);
+ Q_Q(QDeclarativeGridView);
if (!isValid() || !q->isComponentComplete())
return;
@@ -457,40 +457,40 @@ void QmlGraphicsGridViewPrivate::refill(qreal from, qreal to, bool doBuffer)
deferredRelease = true;
}
if (changed) {
- if (flow == QmlGraphicsGridView::LeftToRight)
- q->setViewportHeight(endPosition() - startPosition());
+ if (flow == QDeclarativeGridView::LeftToRight)
+ q->setContentHeight(endPosition() - startPosition());
else
- q->setViewportWidth(endPosition() - startPosition());
+ q->setContentWidth(endPosition() - startPosition());
} else if (!doBuffer && buffer && bufferMode != NoBuffer) {
refill(from, to, true);
}
lazyRelease = false;
}
-void QmlGraphicsGridViewPrivate::updateGrid()
+void QDeclarativeGridViewPrivate::updateGrid()
{
- Q_Q(QmlGraphicsGridView);
- columns = (int)qMax((flow == QmlGraphicsGridView::LeftToRight ? q->width() : q->height()) / colSize(), qreal(1.));
+ Q_Q(QDeclarativeGridView);
+ columns = (int)qMax((flow == QDeclarativeGridView::LeftToRight ? q->width() : q->height()) / colSize(), qreal(1.));
if (isValid()) {
- if (flow == QmlGraphicsGridView::LeftToRight)
- q->setViewportHeight(endPosition() - startPosition());
+ if (flow == QDeclarativeGridView::LeftToRight)
+ q->setContentHeight(endPosition() - startPosition());
else
- q->setViewportWidth(endPosition() - startPosition());
+ q->setContentWidth(endPosition() - startPosition());
}
}
-void QmlGraphicsGridViewPrivate::scheduleLayout()
+void QDeclarativeGridViewPrivate::scheduleLayout()
{
- Q_Q(QmlGraphicsGridView);
+ Q_Q(QDeclarativeGridView);
if (!layoutScheduled) {
layoutScheduled = true;
QMetaObject::invokeMethod(q, "layout", Qt::QueuedConnection);
}
}
-void QmlGraphicsGridViewPrivate::layout(bool removed)
+void QDeclarativeGridViewPrivate::layout(bool removed)
{
- Q_Q(QmlGraphicsGridView);
+ Q_Q(QDeclarativeGridView);
layoutScheduled = false;
if (visibleItems.count()) {
qreal rowPos = visibleItems.first()->rowPos();
@@ -515,29 +515,29 @@ void QmlGraphicsGridViewPrivate::layout(bool removed)
q->refill();
updateHighlight();
moveReason = Other;
- if (flow == QmlGraphicsGridView::LeftToRight) {
- q->setViewportHeight(endPosition() - startPosition());
+ if (flow == QDeclarativeGridView::LeftToRight) {
+ q->setContentHeight(endPosition() - startPosition());
fixupY();
} else {
- q->setViewportWidth(endPosition() - startPosition());
+ q->setContentWidth(endPosition() - startPosition());
fixupX();
}
updateUnrequestedPositions();
}
-void QmlGraphicsGridViewPrivate::updateUnrequestedIndexes()
+void QDeclarativeGridViewPrivate::updateUnrequestedIndexes()
{
- Q_Q(QmlGraphicsGridView);
- QHash<QmlGraphicsItem*,int>::iterator it;
+ Q_Q(QDeclarativeGridView);
+ QHash<QDeclarativeItem*,int>::iterator it;
for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it)
*it = model->indexOf(it.key(), q);
}
-void QmlGraphicsGridViewPrivate::updateUnrequestedPositions()
+void QDeclarativeGridViewPrivate::updateUnrequestedPositions()
{
- QHash<QmlGraphicsItem*,int>::const_iterator it;
+ QHash<QDeclarativeItem*,int>::const_iterator it;
for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) {
- if (flow == QmlGraphicsGridView::LeftToRight) {
+ if (flow == QDeclarativeGridView::LeftToRight) {
it.key()->setPos(QPointF(colPosAt(*it), rowPosAt(*it)));
} else {
it.key()->setPos(QPointF(rowPosAt(*it), colPosAt(*it)));
@@ -545,9 +545,9 @@ void QmlGraphicsGridViewPrivate::updateUnrequestedPositions()
}
}
-void QmlGraphicsGridViewPrivate::updateTrackedItem()
+void QDeclarativeGridViewPrivate::updateTrackedItem()
{
- Q_Q(QmlGraphicsGridView);
+ Q_Q(QDeclarativeGridView);
FxGridItem *item = currentItem;
if (highlight)
item = highlight;
@@ -569,9 +569,9 @@ void QmlGraphicsGridViewPrivate::updateTrackedItem()
q->trackedPositionChanged();
}
-void QmlGraphicsGridViewPrivate::createHighlight()
+void QDeclarativeGridViewPrivate::createHighlight()
{
- Q_Q(QmlGraphicsGridView);
+ Q_Q(QDeclarativeGridView);
bool changed = false;
if (highlight) {
if (trackedItem == highlight)
@@ -587,31 +587,31 @@ void QmlGraphicsGridViewPrivate::createHighlight()
}
if (currentItem) {
- QmlGraphicsItem *item = 0;
+ QDeclarativeItem *item = 0;
if (highlightComponent) {
- QmlContext *highlightContext = new QmlContext(qmlContext(q));
+ QDeclarativeContext *highlightContext = new QDeclarativeContext(qmlContext(q));
QObject *nobj = highlightComponent->create(highlightContext);
if (nobj) {
highlightContext->setParent(nobj);
- item = qobject_cast<QmlGraphicsItem *>(nobj);
+ item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item)
delete nobj;
} else {
delete highlightContext;
}
} else {
- item = new QmlGraphicsItem;
+ item = new QDeclarativeItem;
item->setParent(q->viewport());
}
if (item) {
item->setParent(q->viewport());
highlight = new FxGridItem(item, q);
- highlightXAnimator = new QmlEaseFollow(q);
- highlightXAnimator->setTarget(QmlMetaProperty(highlight->item, QLatin1String("x")));
+ highlightXAnimator = new QDeclarativeEaseFollow(q);
+ highlightXAnimator->setTarget(QDeclarativeProperty(highlight->item, QLatin1String("x")));
highlightXAnimator->setDuration(150);
highlightXAnimator->setEnabled(autoHighlight);
- highlightYAnimator = new QmlEaseFollow(q);
- highlightYAnimator->setTarget(QmlMetaProperty(highlight->item, QLatin1String("y")));
+ highlightYAnimator = new QDeclarativeEaseFollow(q);
+ highlightYAnimator->setTarget(QDeclarativeProperty(highlight->item, QLatin1String("y")));
highlightYAnimator->setDuration(150);
highlightYAnimator->setEnabled(autoHighlight);
changed = true;
@@ -621,7 +621,7 @@ void QmlGraphicsGridViewPrivate::createHighlight()
emit q->highlightChanged();
}
-void QmlGraphicsGridViewPrivate::updateHighlight()
+void QDeclarativeGridViewPrivate::updateHighlight()
{
if ((!currentItem && highlight) || (currentItem && !highlight))
createHighlight();
@@ -635,9 +635,9 @@ void QmlGraphicsGridViewPrivate::updateHighlight()
updateTrackedItem();
}
-void QmlGraphicsGridViewPrivate::updateCurrent(int modelIndex)
+void QDeclarativeGridViewPrivate::updateCurrent(int modelIndex)
{
- Q_Q(QmlGraphicsGridView);
+ Q_Q(QDeclarativeGridView);
if (!q->isComponentComplete() || !isValid() || modelIndex < 0 || modelIndex >= model->count()) {
if (currentItem) {
currentItem->attached->setIsCurrentItem(false);
@@ -674,7 +674,7 @@ void QmlGraphicsGridViewPrivate::updateCurrent(int modelIndex)
//----------------------------------------------------------------------------
/*!
- \qmlclass GridView QmlGraphicsGridView
+ \qmlclass GridView QDeclarativeGridView
\inherits Flickable
\brief The GridView item provides a grid view of items provided by a model.
@@ -696,16 +696,16 @@ void QmlGraphicsGridViewPrivate::updateCurrent(int modelIndex)
In this case ListModel is a handy way for us to test our UI. In practice
the model would be implemented in C++, or perhaps via a SQL data source.
*/
-QmlGraphicsGridView::QmlGraphicsGridView(QmlGraphicsItem *parent)
- : QmlGraphicsFlickable(*(new QmlGraphicsGridViewPrivate), parent)
+QDeclarativeGridView::QDeclarativeGridView(QDeclarativeItem *parent)
+ : QDeclarativeFlickable(*(new QDeclarativeGridViewPrivate), parent)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
d->init();
}
-QmlGraphicsGridView::~QmlGraphicsGridView()
+QDeclarativeGridView::~QDeclarativeGridView()
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
d->clear();
if (d->ownModel)
delete d->model;
@@ -774,27 +774,28 @@ QmlGraphicsGridView::~QmlGraphicsGridView()
\sa {qmlmodels}{Data Models}
*/
-QVariant QmlGraphicsGridView::model() const
+QVariant QDeclarativeGridView::model() const
{
- Q_D(const QmlGraphicsGridView);
+ Q_D(const QDeclarativeGridView);
return d->modelVariant;
}
-void QmlGraphicsGridView::setModel(const QVariant &model)
+void QDeclarativeGridView::setModel(const QVariant &model)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (d->model) {
disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int)));
- disconnect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*)));
- disconnect(d->model, SIGNAL(destroyingItem(QmlGraphicsItem*)), this, SLOT(destroyingItem(QmlGraphicsItem*)));
+ disconnect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset()));
+ disconnect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*)));
+ disconnect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*)));
}
d->clear();
d->modelVariant = model;
QObject *object = qvariant_cast<QObject*>(model);
- QmlGraphicsVisualModel *vim = 0;
- if (object && (vim = qobject_cast<QmlGraphicsVisualModel *>(object))) {
+ QDeclarativeVisualModel *vim = 0;
+ if (object && (vim = qobject_cast<QDeclarativeVisualModel *>(object))) {
if (d->ownModel) {
delete d->model;
d->ownModel = false;
@@ -802,10 +803,10 @@ void QmlGraphicsGridView::setModel(const QVariant &model)
d->model = vim;
} else {
if (!d->ownModel) {
- d->model = new QmlGraphicsVisualDataModel(qmlContext(this));
+ d->model = new QDeclarativeVisualDataModel(qmlContext(this));
d->ownModel = true;
}
- if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model))
+ if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model))
dataModel->setModel(model);
}
if (d->model) {
@@ -814,15 +815,16 @@ void QmlGraphicsGridView::setModel(const QVariant &model)
if (d->currentIndex >= d->model->count() || d->currentIndex < 0) {
setCurrentIndex(0);
} else {
- d->moveReason = QmlGraphicsGridViewPrivate::SetIndex;
+ d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
}
}
connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int)));
- connect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*)));
- connect(d->model, SIGNAL(destroyingItem(QmlGraphicsItem*)), this, SLOT(destroyingItem(QmlGraphicsItem*)));
+ connect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset()));
+ connect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*)));
+ connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*)));
emit countChanged();
}
}
@@ -840,32 +842,32 @@ void QmlGraphicsGridView::setModel(const QVariant &model)
Here is an example delegate:
\snippet doc/src/snippets/declarative/gridview/gridview.qml 0
*/
-QmlComponent *QmlGraphicsGridView::delegate() const
+QDeclarativeComponent *QDeclarativeGridView::delegate() const
{
- Q_D(const QmlGraphicsGridView);
+ Q_D(const QDeclarativeGridView);
if (d->model) {
- if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model))
+ if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model))
return dataModel->delegate();
}
return 0;
}
-void QmlGraphicsGridView::setDelegate(QmlComponent *delegate)
+void QDeclarativeGridView::setDelegate(QDeclarativeComponent *delegate)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (delegate == this->delegate())
return;
if (!d->ownModel) {
- d->model = new QmlGraphicsVisualDataModel(qmlContext(this));
+ d->model = new QDeclarativeVisualDataModel(qmlContext(this));
d->ownModel = true;
}
- if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model)) {
+ if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model)) {
dataModel->setDelegate(delegate);
if (isComponentComplete()) {
refill();
- d->moveReason = QmlGraphicsGridViewPrivate::SetIndex;
+ d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
}
}
@@ -879,17 +881,19 @@ void QmlGraphicsGridView::setDelegate(QmlComponent *delegate)
\c currentItem is the current item. Note that the position of the current item
may only be approximate until it becomes visible in the view.
*/
-int QmlGraphicsGridView::currentIndex() const
+int QDeclarativeGridView::currentIndex() const
{
- Q_D(const QmlGraphicsGridView);
+ Q_D(const QDeclarativeGridView);
return d->currentIndex;
}
-void QmlGraphicsGridView::setCurrentIndex(int index)
+void QDeclarativeGridView::setCurrentIndex(int index)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
+ if (d->requestedIndex >= 0) // currently creating item
+ return;
if (isComponentComplete() && d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) {
- d->moveReason = QmlGraphicsGridViewPrivate::SetIndex;
+ d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
cancelFlick();
d->updateCurrent(index);
} else {
@@ -897,9 +901,9 @@ void QmlGraphicsGridView::setCurrentIndex(int index)
}
}
-QmlGraphicsItem *QmlGraphicsGridView::currentItem()
+QDeclarativeItem *QDeclarativeGridView::currentItem()
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (!d->currentItem)
return 0;
return d->currentItem->item;
@@ -916,9 +920,9 @@ QmlGraphicsItem *QmlGraphicsGridView::currentItem()
\sa highlight, highlightFollowsCurrentItem
*/
-QmlGraphicsItem *QmlGraphicsGridView::highlightItem()
+QDeclarativeItem *QDeclarativeGridView::highlightItem()
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (!d->highlight)
return 0;
return d->highlight->item;
@@ -928,9 +932,9 @@ QmlGraphicsItem *QmlGraphicsGridView::highlightItem()
\qmlproperty int GridView::count
This property holds the number of items in the view.
*/
-int QmlGraphicsGridView::count() const
+int QDeclarativeGridView::count() const
{
- Q_D(const QmlGraphicsGridView);
+ Q_D(const QDeclarativeGridView);
if (d->model)
return d->model->count();
return 0;
@@ -949,15 +953,15 @@ int QmlGraphicsGridView::count() const
\sa highlightItem, highlightFollowsCurrentItem
*/
-QmlComponent *QmlGraphicsGridView::highlight() const
+QDeclarativeComponent *QDeclarativeGridView::highlight() const
{
- Q_D(const QmlGraphicsGridView);
+ Q_D(const QDeclarativeGridView);
return d->highlightComponent;
}
-void QmlGraphicsGridView::setHighlight(QmlComponent *highlight)
+void QDeclarativeGridView::setHighlight(QDeclarativeComponent *highlight)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (highlight != d->highlightComponent) {
d->highlightComponent = highlight;
d->updateCurrent(d->currentIndex);
@@ -977,22 +981,22 @@ void QmlGraphicsGridView::setHighlight(QmlComponent *highlight)
Component {
id: myHighlight
Rectangle {
- id: wrapper; color: "lightsteelblue"; radius: 4; width: 320; height: 60 >
+ id: wrapper; color: "lightsteelblue"; radius: 4; width: 320; height: 60
y: SpringFollow { source: Wrapper.GridView.view.currentItem.y; spring: 3; damping: 0.2 }
x: SpringFollow { source: Wrapper.GridView.view.currentItem.x; spring: 3; damping: 0.2 }
}
}
\endcode
*/
-bool QmlGraphicsGridView::highlightFollowsCurrentItem() const
+bool QDeclarativeGridView::highlightFollowsCurrentItem() const
{
- Q_D(const QmlGraphicsGridView);
+ Q_D(const QDeclarativeGridView);
return d->autoHighlight;
}
-void QmlGraphicsGridView::setHighlightFollowsCurrentItem(bool autoHighlight)
+void QDeclarativeGridView::setHighlightFollowsCurrentItem(bool autoHighlight)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (d->autoHighlight != autoHighlight) {
d->autoHighlight = autoHighlight;
if (d->highlightXAnimator) {
@@ -1012,23 +1016,23 @@ void QmlGraphicsGridView::setHighlightFollowsCurrentItem(bool autoHighlight)
If \a flow is \c LeftToRight, the view will scroll vertically.
If \a flow is \c TopToBottom, the view will scroll horizontally.
*/
-QmlGraphicsGridView::Flow QmlGraphicsGridView::flow() const
+QDeclarativeGridView::Flow QDeclarativeGridView::flow() const
{
- Q_D(const QmlGraphicsGridView);
+ Q_D(const QDeclarativeGridView);
return d->flow;
}
-void QmlGraphicsGridView::setFlow(Flow flow)
+void QDeclarativeGridView::setFlow(Flow flow)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (d->flow != flow) {
d->flow = flow;
if (d->flow == LeftToRight) {
- setViewportWidth(-1);
- setFlickDirection(QmlGraphicsFlickable::VerticalFlick);
+ setContentWidth(-1);
+ setFlickDirection(QDeclarativeFlickable::VerticalFlick);
} else {
- setViewportHeight(-1);
- setFlickDirection(QmlGraphicsFlickable::HorizontalFlick);
+ setContentHeight(-1);
+ setFlickDirection(QDeclarativeFlickable::HorizontalFlick);
}
d->clear();
d->updateGrid();
@@ -1044,15 +1048,15 @@ void QmlGraphicsGridView::setFlow(Flow flow)
If this property is true then key presses to move off of one end of the grid will cause the
selection to jump to the other side.
*/
-bool QmlGraphicsGridView::isWrapEnabled() const
+bool QDeclarativeGridView::isWrapEnabled() const
{
- Q_D(const QmlGraphicsGridView);
+ Q_D(const QDeclarativeGridView);
return d->wrap;
}
-void QmlGraphicsGridView::setWrapEnabled(bool wrap)
+void QDeclarativeGridView::setWrapEnabled(bool wrap)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
d->wrap = wrap;
}
@@ -1064,15 +1068,15 @@ void QmlGraphicsGridView::setWrapEnabled(bool wrap)
and below the bottom of the view to cache. Setting this value can make
scrolling the view smoother at the expense of additional memory usage.
*/
-int QmlGraphicsGridView::cacheBuffer() const
+int QDeclarativeGridView::cacheBuffer() const
{
- Q_D(const QmlGraphicsGridView);
+ Q_D(const QDeclarativeGridView);
return d->buffer;
}
-void QmlGraphicsGridView::setCacheBuffer(int buffer)
+void QDeclarativeGridView::setCacheBuffer(int buffer)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (d->buffer != buffer) {
d->buffer = buffer;
if (isComponentComplete())
@@ -1088,15 +1092,15 @@ void QmlGraphicsGridView::setCacheBuffer(int buffer)
The default cell size is 100x100.
*/
-int QmlGraphicsGridView::cellWidth() const
+int QDeclarativeGridView::cellWidth() const
{
- Q_D(const QmlGraphicsGridView);
+ Q_D(const QDeclarativeGridView);
return d->cellWidth;
}
-void QmlGraphicsGridView::setCellWidth(int cellWidth)
+void QDeclarativeGridView::setCellWidth(int cellWidth)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (cellWidth != d->cellWidth && cellWidth > 0) {
d->cellWidth = qMax(1, cellWidth);
d->updateGrid();
@@ -1105,15 +1109,15 @@ void QmlGraphicsGridView::setCellWidth(int cellWidth)
}
}
-int QmlGraphicsGridView::cellHeight() const
+int QDeclarativeGridView::cellHeight() const
{
- Q_D(const QmlGraphicsGridView);
+ Q_D(const QDeclarativeGridView);
return d->cellHeight;
}
-void QmlGraphicsGridView::setCellHeight(int cellHeight)
+void QDeclarativeGridView::setCellHeight(int cellHeight)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (cellHeight != d->cellHeight && cellHeight > 0) {
d->cellHeight = qMax(1, cellHeight);
d->updateGrid();
@@ -1122,51 +1126,51 @@ void QmlGraphicsGridView::setCellHeight(int cellHeight)
}
}
-void QmlGraphicsGridView::sizeChange()
+void QDeclarativeGridView::sizeChange()
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (isComponentComplete()) {
d->updateGrid();
d->layout();
}
}
-void QmlGraphicsGridView::viewportMoved()
+void QDeclarativeGridView::viewportMoved()
{
- Q_D(QmlGraphicsGridView);
- QmlGraphicsFlickable::viewportMoved();
+ Q_D(QDeclarativeGridView);
+ QDeclarativeFlickable::viewportMoved();
d->lazyRelease = true;
if (d->flicked) {
if (yflick()) {
if (d->velocityY > 0)
- d->bufferMode = QmlGraphicsGridViewPrivate::BufferBefore;
+ d->bufferMode = QDeclarativeGridViewPrivate::BufferBefore;
else if (d->velocityY < 0)
- d->bufferMode = QmlGraphicsGridViewPrivate::BufferAfter;
+ d->bufferMode = QDeclarativeGridViewPrivate::BufferAfter;
}
if (xflick()) {
if (d->velocityX > 0)
- d->bufferMode = QmlGraphicsGridViewPrivate::BufferBefore;
+ d->bufferMode = QDeclarativeGridViewPrivate::BufferBefore;
else if (d->velocityX < 0)
- d->bufferMode = QmlGraphicsGridViewPrivate::BufferAfter;
+ d->bufferMode = QDeclarativeGridViewPrivate::BufferAfter;
}
}
refill();
}
-qreal QmlGraphicsGridView::minYExtent() const
+qreal QDeclarativeGridView::minYExtent() const
{
- Q_D(const QmlGraphicsGridView);
- if (d->flow == QmlGraphicsGridView::TopToBottom)
- return QmlGraphicsFlickable::minYExtent();
+ Q_D(const QDeclarativeGridView);
+ if (d->flow == QDeclarativeGridView::TopToBottom)
+ return QDeclarativeFlickable::minYExtent();
return -d->startPosition();
}
-qreal QmlGraphicsGridView::maxYExtent() const
+qreal QDeclarativeGridView::maxYExtent() const
{
- Q_D(const QmlGraphicsGridView);
- if (d->flow == QmlGraphicsGridView::TopToBottom)
- return QmlGraphicsFlickable::maxYExtent();
+ Q_D(const QDeclarativeGridView);
+ if (d->flow == QDeclarativeGridView::TopToBottom)
+ return QDeclarativeFlickable::maxYExtent();
qreal extent = -(d->endPosition() - height());
const qreal minY = minYExtent();
if (extent > minY)
@@ -1174,19 +1178,19 @@ qreal QmlGraphicsGridView::maxYExtent() const
return extent;
}
-qreal QmlGraphicsGridView::minXExtent() const
+qreal QDeclarativeGridView::minXExtent() const
{
- Q_D(const QmlGraphicsGridView);
- if (d->flow == QmlGraphicsGridView::LeftToRight)
- return QmlGraphicsFlickable::minXExtent();
+ Q_D(const QDeclarativeGridView);
+ if (d->flow == QDeclarativeGridView::LeftToRight)
+ return QDeclarativeFlickable::minXExtent();
return -d->startPosition();
}
-qreal QmlGraphicsGridView::maxXExtent() const
+qreal QDeclarativeGridView::maxXExtent() const
{
- Q_D(const QmlGraphicsGridView);
- if (d->flow == QmlGraphicsGridView::LeftToRight)
- return QmlGraphicsFlickable::maxXExtent();
+ Q_D(const QDeclarativeGridView);
+ if (d->flow == QDeclarativeGridView::LeftToRight)
+ return QDeclarativeFlickable::maxXExtent();
qreal extent = -(d->endPosition() - width());
const qreal minX = minXExtent();
if (extent > minX)
@@ -1194,14 +1198,14 @@ qreal QmlGraphicsGridView::maxXExtent() const
return extent;
}
-void QmlGraphicsGridView::keyPressEvent(QKeyEvent *event)
+void QDeclarativeGridView::keyPressEvent(QKeyEvent *event)
{
- Q_D(QmlGraphicsGridView);
- QmlGraphicsFlickable::keyPressEvent(event);
+ Q_D(QDeclarativeGridView);
+ QDeclarativeFlickable::keyPressEvent(event);
if (event->isAccepted())
return;
if (d->model && d->model->count() && d->interactive) {
- d->moveReason = QmlGraphicsGridViewPrivate::SetIndex;
+ d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
int oldCurrent = currentIndex();
switch (event->key()) {
case Qt::Key_Up:
@@ -1224,7 +1228,7 @@ void QmlGraphicsGridView::keyPressEvent(QKeyEvent *event)
return;
}
}
- d->moveReason = QmlGraphicsGridViewPrivate::Other;
+ d->moveReason = QDeclarativeGridViewPrivate::Other;
event->ignore();
}
@@ -1235,10 +1239,10 @@ void QmlGraphicsGridView::keyPressEvent(QKeyEvent *event)
The current index will wrap if keyNavigationWraps is true and it
is currently at the end.
*/
-void QmlGraphicsGridView::moveCurrentIndexUp()
+void QDeclarativeGridView::moveCurrentIndexUp()
{
- Q_D(QmlGraphicsGridView);
- if (d->flow == QmlGraphicsGridView::LeftToRight) {
+ Q_D(QDeclarativeGridView);
+ if (d->flow == QDeclarativeGridView::LeftToRight) {
if (currentIndex() >= d->columns || d->wrap) {
int index = currentIndex() - d->columns;
setCurrentIndex(index >= 0 ? index : d->model->count()-1);
@@ -1258,10 +1262,10 @@ void QmlGraphicsGridView::moveCurrentIndexUp()
The current index will wrap if keyNavigationWraps is true and it
is currently at the end.
*/
-void QmlGraphicsGridView::moveCurrentIndexDown()
+void QDeclarativeGridView::moveCurrentIndexDown()
{
- Q_D(QmlGraphicsGridView);
- if (d->flow == QmlGraphicsGridView::LeftToRight) {
+ Q_D(QDeclarativeGridView);
+ if (d->flow == QDeclarativeGridView::LeftToRight) {
if (currentIndex() < d->model->count() - d->columns || d->wrap) {
int index = currentIndex()+d->columns;
setCurrentIndex(index < d->model->count() ? index : 0);
@@ -1281,10 +1285,10 @@ void QmlGraphicsGridView::moveCurrentIndexDown()
The current index will wrap if keyNavigationWraps is true and it
is currently at the end.
*/
-void QmlGraphicsGridView::moveCurrentIndexLeft()
+void QDeclarativeGridView::moveCurrentIndexLeft()
{
- Q_D(QmlGraphicsGridView);
- if (d->flow == QmlGraphicsGridView::LeftToRight) {
+ Q_D(QDeclarativeGridView);
+ if (d->flow == QDeclarativeGridView::LeftToRight) {
if (currentIndex() > 0 || d->wrap) {
int index = currentIndex() - 1;
setCurrentIndex(index >= 0 ? index : d->model->count()-1);
@@ -1304,10 +1308,10 @@ void QmlGraphicsGridView::moveCurrentIndexLeft()
The current index will wrap if keyNavigationWraps is true and it
is currently at the end.
*/
-void QmlGraphicsGridView::moveCurrentIndexRight()
+void QDeclarativeGridView::moveCurrentIndexRight()
{
- Q_D(QmlGraphicsGridView);
- if (d->flow == QmlGraphicsGridView::LeftToRight) {
+ Q_D(QDeclarativeGridView);
+ if (d->flow == QDeclarativeGridView::LeftToRight) {
if (currentIndex() < d->model->count() - 1 || d->wrap) {
int index = currentIndex() + 1;
setCurrentIndex(index < d->model->count() ? index : 0);
@@ -1320,13 +1324,13 @@ void QmlGraphicsGridView::moveCurrentIndexRight()
}
}
-void QmlGraphicsGridView::positionViewAtIndex(int index)
+void QDeclarativeGridView::positionViewAtIndex(int index)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (!d->isValid() || index < 0 || index >= d->model->count())
return;
- qreal maxExtent = d->flow == QmlGraphicsGridView::LeftToRight ? -maxYExtent() : -maxXExtent();
+ qreal maxExtent = d->flow == QDeclarativeGridView::LeftToRight ? -maxYExtent() : -maxXExtent();
FxGridItem *item = d->visibleItem(index);
if (item) {
// Already created - just move to top of view
@@ -1349,10 +1353,10 @@ void QmlGraphicsGridView::positionViewAtIndex(int index)
}
-void QmlGraphicsGridView::componentComplete()
+void QDeclarativeGridView::componentComplete()
{
- Q_D(QmlGraphicsGridView);
- QmlGraphicsFlickable::componentComplete();
+ Q_D(QDeclarativeGridView);
+ QDeclarativeFlickable::componentComplete();
d->updateGrid();
refill();
if (d->currentIndex < 0)
@@ -1361,12 +1365,12 @@ void QmlGraphicsGridView::componentComplete()
d->updateCurrent(d->currentIndex);
}
-void QmlGraphicsGridView::trackedPositionChanged()
+void QDeclarativeGridView::trackedPositionChanged()
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (!d->trackedItem || !d->currentItem)
return;
- if (!isFlicking() && !d->moving && d->moveReason == QmlGraphicsGridViewPrivate::SetIndex) {
+ if (!isFlicking() && !d->moving && d->moveReason == QDeclarativeGridViewPrivate::SetIndex) {
const qreal viewPos = d->position();
if (d->trackedItem->rowPos() < viewPos && d->currentItem->rowPos() < viewPos) {
d->setPosition(d->currentItem->rowPos() < d->trackedItem->rowPos() ? d->trackedItem->rowPos() : d->currentItem->rowPos());
@@ -1387,9 +1391,9 @@ void QmlGraphicsGridView::trackedPositionChanged()
}
}
-void QmlGraphicsGridView::itemsInserted(int modelIndex, int count)
+void QDeclarativeGridView::itemsInserted(int modelIndex, int count)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (!d->visibleItems.count() || d->model->count() <= 1) {
refill();
d->updateCurrent(qMax(0, qMin(d->currentIndex, d->model->count()-1)));
@@ -1496,9 +1500,9 @@ void QmlGraphicsGridView::itemsInserted(int modelIndex, int count)
emit countChanged();
}
-void QmlGraphicsGridView::itemsRemoved(int modelIndex, int count)
+void QDeclarativeGridView::itemsRemoved(int modelIndex, int count)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
bool currentRemoved = d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count;
bool removedVisible = false;
@@ -1565,16 +1569,16 @@ void QmlGraphicsGridView::itemsRemoved(int modelIndex, int count)
emit countChanged();
}
-void QmlGraphicsGridView::layout()
+void QDeclarativeGridView::layout()
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
if (d->layoutScheduled)
d->layout();
}
-void QmlGraphicsGridView::destroyRemoved()
+void QDeclarativeGridView::destroyRemoved()
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
for (QList<FxGridItem*>::Iterator it = d->visibleItems.begin();
it != d->visibleItems.end();) {
FxGridItem *listItem = *it;
@@ -1590,9 +1594,9 @@ void QmlGraphicsGridView::destroyRemoved()
d->layout();
}
-void QmlGraphicsGridView::itemsMoved(int from, int to, int count)
+void QDeclarativeGridView::itemsMoved(int from, int to, int count)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
QHash<int,FxGridItem*> moved;
bool removedBeforeVisible = false;
@@ -1686,14 +1690,24 @@ void QmlGraphicsGridView::itemsMoved(int from, int to, int count)
d->layout(removedBeforeVisible);
}
-void QmlGraphicsGridView::createdItem(int index, QmlGraphicsItem *item)
+void QDeclarativeGridView::modelReset()
+{
+ Q_D(QDeclarativeGridView);
+ d->clear();
+ refill();
+ d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
+ d->updateCurrent(d->currentIndex);
+ emit countChanged();
+}
+
+void QDeclarativeGridView::createdItem(int index, QDeclarativeItem *item)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
item->setParentItem(this);
if (d->requestedIndex != index) {
item->setParentItem(this);
d->unrequestedItems.insert(item, index);
- if (d->flow == QmlGraphicsGridView::LeftToRight) {
+ if (d->flow == QDeclarativeGridView::LeftToRight) {
item->setPos(QPointF(d->colPosAt(index), d->rowPosAt(index)));
} else {
item->setPos(QPointF(d->rowPosAt(index), d->colPosAt(index)));
@@ -1701,23 +1715,23 @@ void QmlGraphicsGridView::createdItem(int index, QmlGraphicsItem *item)
}
}
-void QmlGraphicsGridView::destroyingItem(QmlGraphicsItem *item)
+void QDeclarativeGridView::destroyingItem(QDeclarativeItem *item)
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
d->unrequestedItems.remove(item);
}
-void QmlGraphicsGridView::refill()
+void QDeclarativeGridView::refill()
{
- Q_D(QmlGraphicsGridView);
+ Q_D(QDeclarativeGridView);
d->refill(d->position(), d->position()+d->size()-1);
}
-QmlGraphicsGridViewAttached *QmlGraphicsGridView::qmlAttachedProperties(QObject *obj)
+QDeclarativeGridViewAttached *QDeclarativeGridView::qmlAttachedProperties(QObject *obj)
{
- return QmlGraphicsGridViewAttached::properties(obj);
+ return QDeclarativeGridViewAttached::properties(obj);
}
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h
index bd18daf..b488475 100644
--- a/src/declarative/graphicsitems/qmlgraphicsgridview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h
@@ -39,32 +39,32 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSGRIDVIEW_H
-#define QMLGRAPHICSGRIDVIEW_H
+#ifndef QDECLARATIVEGRIDVIEW_H
+#define QDECLARATIVEGRIDVIEW_H
-#include "qmlgraphicsflickable_p.h"
+#include "qdeclarativeflickable_p.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsVisualModel;
-class QmlGraphicsGridViewAttached;
-class QmlGraphicsGridViewPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsGridView : public QmlGraphicsFlickable
+class QDeclarativeVisualModel;
+class QDeclarativeGridViewAttached;
+class QDeclarativeGridViewPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeGridView : public QDeclarativeFlickable
{
Q_OBJECT
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsGridView)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeGridView)
Q_PROPERTY(QVariant model READ model WRITE setModel)
- Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate)
+ Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
- Q_PROPERTY(QmlGraphicsItem *currentItem READ currentItem NOTIFY currentIndexChanged)
+ Q_PROPERTY(QDeclarativeItem *currentItem READ currentItem NOTIFY currentIndexChanged)
Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_PROPERTY(QmlComponent *highlight READ highlight WRITE setHighlight)
- Q_PROPERTY(QmlGraphicsItem *highlightItem READ highlightItem NOTIFY highlightChanged)
+ Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight)
+ Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightChanged)
Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem)
Q_PROPERTY(Flow flow READ flow WRITE setFlow)
@@ -75,24 +75,24 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsGridView : public QmlGraphicsFlickable
Q_CLASSINFO("DefaultProperty", "data")
public:
- QmlGraphicsGridView(QmlGraphicsItem *parent=0);
- ~QmlGraphicsGridView();
+ QDeclarativeGridView(QDeclarativeItem *parent=0);
+ ~QDeclarativeGridView();
QVariant model() const;
void setModel(const QVariant &);
- QmlComponent *delegate() const;
- void setDelegate(QmlComponent *);
+ QDeclarativeComponent *delegate() const;
+ void setDelegate(QDeclarativeComponent *);
int currentIndex() const;
void setCurrentIndex(int idx);
- QmlGraphicsItem *currentItem();
- QmlGraphicsItem *highlightItem();
+ QDeclarativeItem *currentItem();
+ QDeclarativeItem *highlightItem();
int count() const;
- QmlComponent *highlight() const;
- void setHighlight(QmlComponent *highlight);
+ QDeclarativeComponent *highlight() const;
+ void setHighlight(QDeclarativeComponent *highlight);
bool highlightFollowsCurrentItem() const;
void setHighlightFollowsCurrentItem(bool);
@@ -114,7 +114,7 @@ public:
int cellHeight() const;
void setCellHeight(int);
- static QmlGraphicsGridViewAttached *qmlAttachedProperties(QObject *);
+ static QDeclarativeGridViewAttached *qmlAttachedProperties(QObject *);
public Q_SLOTS:
void moveCurrentIndexUp();
@@ -144,9 +144,10 @@ private Q_SLOTS:
void itemsInserted(int index, int count);
void itemsRemoved(int index, int count);
void itemsMoved(int from, int to, int count);
+ void modelReset();
void destroyRemoved();
- void createdItem(int index, QmlGraphicsItem *item);
- void destroyingItem(QmlGraphicsItem *item);
+ void createdItem(int index, QDeclarativeItem *item);
+ void destroyingItem(QDeclarativeItem *item);
void sizeChange();
void layout();
@@ -154,18 +155,18 @@ private:
void refill();
};
-class QmlGraphicsGridViewAttached : public QObject
+class QDeclarativeGridViewAttached : public QObject
{
Q_OBJECT
public:
- QmlGraphicsGridViewAttached(QObject *parent)
+ QDeclarativeGridViewAttached(QObject *parent)
: QObject(parent), m_isCurrent(false), m_delayRemove(false) {}
- ~QmlGraphicsGridViewAttached() {
+ ~QDeclarativeGridViewAttached() {
attachedProperties.remove(parent());
}
- Q_PROPERTY(QmlGraphicsGridView *view READ view CONSTANT)
- QmlGraphicsGridView *view() { return m_view; }
+ Q_PROPERTY(QDeclarativeGridView *view READ view CONSTANT)
+ QDeclarativeGridView *view() { return m_view; }
Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged)
bool isCurrentItem() const { return m_isCurrent; }
@@ -185,10 +186,10 @@ public:
}
}
- static QmlGraphicsGridViewAttached *properties(QObject *obj) {
- QmlGraphicsGridViewAttached *rv = attachedProperties.value(obj);
+ static QDeclarativeGridViewAttached *properties(QObject *obj) {
+ QDeclarativeGridViewAttached *rv = attachedProperties.value(obj);
if (!rv) {
- rv = new QmlGraphicsGridViewAttached(obj);
+ rv = new QDeclarativeGridViewAttached(obj);
attachedProperties.insert(obj, rv);
}
return rv;
@@ -204,18 +205,18 @@ Q_SIGNALS:
void remove();
public:
- QmlGraphicsGridView *m_view;
+ QDeclarativeGridView *m_view;
bool m_isCurrent;
bool m_delayRemove;
- static QHash<QObject*, QmlGraphicsGridViewAttached*> attachedProperties;
+ static QHash<QObject*, QDeclarativeGridViewAttached*> attachedProperties;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsGridView)
-QML_DECLARE_TYPEINFO(QmlGraphicsGridView, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPE(QDeclarativeGridView)
+QML_DECLARE_TYPEINFO(QDeclarativeGridView, QML_HAS_ATTACHED_PROPERTIES)
QT_END_HEADER
diff --git a/src/declarative/graphicsitems/qmlgraphicsimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index 6e93c52..99ab053 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#include "qmlgraphicsimage_p.h"
-#include "qmlgraphicsimage_p_p.h"
+#include "qdeclarativeimage_p.h"
+#include "qdeclarativeimage_p_p.h"
#include <QKeyEvent>
#include <QPainter>
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
- \qmlclass Image QmlGraphicsImage
+ \qmlclass Image QDeclarativeImage
\since 4.7
\brief The Image element allows you to add bitmaps to a scene.
\inherits Item
@@ -111,8 +111,8 @@ QT_BEGIN_NAMESPACE
/*!
\internal
- \class QmlGraphicsImage Image
- \brief The QmlGraphicsImage class provides an image item that you can add to a QmlView.
+ \class QDeclarativeImage Image
+ \brief The QDeclarativeImage class provides an image item that you can add to a QDeclarativeView.
\ingroup group_coreitems
@@ -121,30 +121,24 @@ QT_BEGIN_NAMESPACE
Image { source: "pics/star.png" }
\endqml
- A QmlGraphicsImage object can be instantiated in Qml using the tag \l Image.
+ A QDeclarativeImage object can be instantiated in Qml using the tag \l Image.
*/
-QmlGraphicsImage::QmlGraphicsImage(QmlGraphicsItem *parent)
- : QmlGraphicsImageBase(*(new QmlGraphicsImagePrivate), parent)
+QDeclarativeImage::QDeclarativeImage(QDeclarativeItem *parent)
+ : QDeclarativeImageBase(*(new QDeclarativeImagePrivate), parent)
{
- connect(this, SIGNAL(sourceChanged(QUrl)), this, SLOT(updatePaintedGeometry()));
+ connect(this, SIGNAL(pixmapChanged()), this, SLOT(updatePaintedGeometry()));
}
-QmlGraphicsImage::QmlGraphicsImage(QmlGraphicsImagePrivate &dd, QmlGraphicsItem *parent)
- : QmlGraphicsImageBase(dd, parent)
+QDeclarativeImage::QDeclarativeImage(QDeclarativeImagePrivate &dd, QDeclarativeItem *parent)
+ : QDeclarativeImageBase(dd, parent)
{
}
-QmlGraphicsImage::~QmlGraphicsImage()
+QDeclarativeImage::~QDeclarativeImage()
{
}
-void QmlGraphicsImage::setSource(const QUrl &url)
-{
- QmlGraphicsImageBase::setSource(url);
- updatePaintedGeometry();
-}
-
/*!
\qmlproperty QPixmap Image::pixmap
@@ -154,28 +148,28 @@ void QmlGraphicsImage::setSource(const QUrl &url)
for example, a model may provide a data role of type QPixmap.
*/
-QPixmap QmlGraphicsImage::pixmap() const
+QPixmap QDeclarativeImage::pixmap() const
{
- Q_D(const QmlGraphicsImage);
+ Q_D(const QDeclarativeImage);
return d->pix;
}
-void QmlGraphicsImage::setPixmap(const QPixmap &pix)
+void QDeclarativeImage::setPixmap(const QPixmap &pix)
{
- Q_D(QmlGraphicsImage);
+ Q_D(QDeclarativeImage);
if (!d->url.isEmpty())
return;
d->setPixmap(pix);
}
-void QmlGraphicsImagePrivate::setPixmap(const QPixmap &pixmap)
+void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap)
{
- Q_Q(QmlGraphicsImage);
+ Q_Q(QDeclarativeImage);
pix = pixmap;
q->setImplicitWidth(pix.width());
q->setImplicitHeight(pix.height());
- status = pix.isNull() ? QmlGraphicsImageBase::Null : QmlGraphicsImageBase::Ready;
+ status = pix.isNull() ? QDeclarativeImageBase::Null : QDeclarativeImageBase::Ready;
q->update();
emit q->pixmapChanged();
@@ -198,15 +192,15 @@ void QmlGraphicsImagePrivate::setPixmap(const QPixmap &pixmap)
\image declarative-image_fillMode.gif
*/
-QmlGraphicsImage::FillMode QmlGraphicsImage::fillMode() const
+QDeclarativeImage::FillMode QDeclarativeImage::fillMode() const
{
- Q_D(const QmlGraphicsImage);
+ Q_D(const QDeclarativeImage);
return d->fillMode;
}
-void QmlGraphicsImage::setFillMode(FillMode mode)
+void QDeclarativeImage::setFillMode(FillMode mode)
{
- Q_D(QmlGraphicsImage);
+ Q_D(QDeclarativeImage);
if (d->fillMode == mode)
return;
d->fillMode = mode;
@@ -215,15 +209,15 @@ void QmlGraphicsImage::setFillMode(FillMode mode)
emit fillModeChanged();
}
-qreal QmlGraphicsImage::paintedWidth() const
+qreal QDeclarativeImage::paintedWidth() const
{
- Q_D(const QmlGraphicsImage);
+ Q_D(const QDeclarativeImage);
return d->paintedWidth;
}
-qreal QmlGraphicsImage::paintedHeight() const
+qreal QDeclarativeImage::paintedHeight() const
{
- Q_D(const QmlGraphicsImage);
+ Q_D(const QDeclarativeImage);
return d->paintedHeight;
}
@@ -263,15 +257,15 @@ qreal QmlGraphicsImage::paintedHeight() const
filtering at the beginning of the animation and reenable it at the conclusion.
*/
-void QmlGraphicsImage::updatePaintedGeometry()
+void QDeclarativeImage::updatePaintedGeometry()
{
- Q_D(QmlGraphicsImage);
+ Q_D(QDeclarativeImage);
if (d->fillMode == PreserveAspectFit) {
- qreal widthScale = width() / qreal(d->pix.width());
- qreal heightScale = height() / qreal(d->pix.height());
if (!d->pix.width() || !d->pix.height())
return;
+ qreal widthScale = width() / qreal(d->pix.width());
+ qreal heightScale = height() / qreal(d->pix.height());
if (widthScale <= heightScale) {
d->paintedWidth = width();
d->paintedHeight = widthScale * qreal(d->pix.height());
@@ -286,9 +280,9 @@ void QmlGraphicsImage::updatePaintedGeometry()
emit paintedGeometryChanged();
}
-void QmlGraphicsImage::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+void QDeclarativeImage::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
- QmlGraphicsImageBase::geometryChanged(newGeometry, oldGeometry);
+ QDeclarativeImageBase::geometryChanged(newGeometry, oldGeometry);
updatePaintedGeometry();
}
@@ -300,9 +294,24 @@ void QmlGraphicsImage::geometryChanged(const QRectF &newGeometry, const QRectF &
The URL may be absolute, or relative to the URL of the component.
*/
-void QmlGraphicsImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
+/*!
+ \qmlproperty bool Image::asynchronous
+
+ Specifies that images on the local filesystem should be loaded
+ asynchronously in a separate thread. The default value is
+ false, causing the user interface thread to block while the
+ image is loaded. Setting \a asynchronous to true is useful where
+ maintaining a responsive user interface is more desireable
+ than having images immediately visible.
+
+ Note that this property is only valid for images read from the
+ local filesystem. Images loaded via a network resource (e.g. HTTP)
+ are always loaded asynchonously.
+*/
+
+void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
- Q_D(QmlGraphicsImage);
+ Q_D(QDeclarativeImage);
if (d->pix.isNull())
return;
diff --git a/src/declarative/graphicsitems/qmlgraphicsimage_p.h b/src/declarative/graphicsitems/qdeclarativeimage_p.h
index b8befeb..fb77ac9 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimage_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeimage_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSIMAGE_H
-#define QMLGRAPHICSIMAGE_H
+#ifndef QDECLARATIVEIMAGE_H
+#define QDECLARATIVEIMAGE_H
-#include "qmlgraphicsimagebase_p.h"
+#include "qdeclarativeimagebase_p.h"
#include <QtNetwork/qnetworkreply.h>
@@ -51,8 +51,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsImagePrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsImage : public QmlGraphicsImageBase
+class QDeclarativeImagePrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeImage : public QDeclarativeImageBase
{
Q_OBJECT
Q_ENUMS(FillMode)
@@ -63,8 +63,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsImage : public QmlGraphicsImageBase
Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedGeometryChanged)
public:
- QmlGraphicsImage(QmlGraphicsItem *parent=0);
- ~QmlGraphicsImage();
+ QDeclarativeImage(QDeclarativeItem *parent=0);
+ ~QDeclarativeImage();
enum FillMode { Stretch, PreserveAspectFit, PreserveAspectCrop, Tile, TileVertically, TileHorizontally };
FillMode fillMode() const;
@@ -76,7 +76,6 @@ public:
qreal paintedWidth() const;
qreal paintedHeight() const;
- void setSource(const QUrl &url);
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
Q_SIGNALS:
@@ -84,19 +83,19 @@ Q_SIGNALS:
void paintedGeometryChanged();
protected:
- QmlGraphicsImage(QmlGraphicsImagePrivate &dd, QmlGraphicsItem *parent);
+ QDeclarativeImage(QDeclarativeImagePrivate &dd, QDeclarativeItem *parent);
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
protected Q_SLOTS:
void updatePaintedGeometry();
private:
- Q_DISABLE_COPY(QmlGraphicsImage)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsImage)
+ Q_DISABLE_COPY(QDeclarativeImage)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeImage)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsImage)
+QML_DECLARE_TYPE(QDeclarativeImage)
QT_END_HEADER
-#endif // QMLGRAPHICSIMAGE_H
+#endif // QDECLARATIVEIMAGE_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsimage_p_p.h b/src/declarative/graphicsitems/qdeclarativeimage_p_p.h
index e404935..8102237 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimage_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeimage_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSIMAGE_P_H
-#define QMLGRAPHICSIMAGE_P_H
+#ifndef QDECLARATIVEIMAGE_P_H
+#define QDECLARATIVEIMAGE_P_H
//
// W A R N I N G
@@ -53,22 +53,22 @@
// We mean it.
//
-#include "qmlgraphicsitem_p.h"
-#include "qmlgraphicsimagebase_p_p.h"
+#include "qdeclarativeitem_p.h"
+#include "qdeclarativeimagebase_p_p.h"
QT_BEGIN_NAMESPACE
-class QmlGraphicsImagePrivate : public QmlGraphicsImageBasePrivate
+class QDeclarativeImagePrivate : public QDeclarativeImageBasePrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsImage)
+ Q_DECLARE_PUBLIC(QDeclarativeImage)
public:
- QmlGraphicsImagePrivate()
- : fillMode(QmlGraphicsImage::Stretch), paintedWidth(0), paintedHeight(0)
+ QDeclarativeImagePrivate()
+ : fillMode(QDeclarativeImage::Stretch), paintedWidth(0), paintedHeight(0)
{
}
- QmlGraphicsImage::FillMode fillMode;
+ QDeclarativeImage::FillMode fillMode;
qreal paintedWidth;
qreal paintedHeight;
void setPixmap(const QPixmap &pix);
@@ -76,4 +76,4 @@ public:
QT_END_NAMESPACE
-#endif // QMLGRAPHICSIMAGE_P_H
+#endif // QDECLARATIVEIMAGE_P_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
index c09b661..a8cce3f 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
@@ -39,80 +39,105 @@
**
****************************************************************************/
-#include "qmlgraphicsimagebase_p.h"
-#include "qmlgraphicsimagebase_p_p.h"
+#include "qdeclarativeimagebase_p.h"
+#include "qdeclarativeimagebase_p_p.h"
-#include <qmlengine.h>
-#include <qmlpixmapcache_p.h>
+#include <qdeclarativeengine.h>
+#include <qdeclarativepixmapcache_p.h>
#include <QFile>
QT_BEGIN_NAMESPACE
-QmlGraphicsImageBase::QmlGraphicsImageBase(QmlGraphicsImageBasePrivate &dd, QmlGraphicsItem *parent)
- : QmlGraphicsItem(dd, parent)
+QDeclarativeImageBase::QDeclarativeImageBase(QDeclarativeImageBasePrivate &dd, QDeclarativeItem *parent)
+ : QDeclarativeItem(dd, parent)
{
setFlag(QGraphicsItem::ItemHasNoContents, false);
}
-QmlGraphicsImageBase::~QmlGraphicsImageBase()
+QDeclarativeImageBase::~QDeclarativeImageBase()
{
- Q_D(QmlGraphicsImageBase);
+ Q_D(QDeclarativeImageBase);
if (d->pendingPixmapCache)
- QmlPixmapCache::cancel(d->url, this);
+ QDeclarativePixmapCache::cancel(d->url, this);
}
-QmlGraphicsImageBase::Status QmlGraphicsImageBase::status() const
+QDeclarativeImageBase::Status QDeclarativeImageBase::status() const
{
- Q_D(const QmlGraphicsImageBase);
+ Q_D(const QDeclarativeImageBase);
return d->status;
}
-qreal QmlGraphicsImageBase::progress() const
+qreal QDeclarativeImageBase::progress() const
{
- Q_D(const QmlGraphicsImageBase);
+ Q_D(const QDeclarativeImageBase);
return d->progress;
}
-QUrl QmlGraphicsImageBase::source() const
+
+bool QDeclarativeImageBase::asynchronous() const
+{
+ Q_D(const QDeclarativeImageBase);
+ return d->async;
+}
+
+void QDeclarativeImageBase::setAsynchronous(bool async)
+{
+ Q_D(QDeclarativeImageBase);
+ if (d->async != async) {
+ d->async = async;
+ emit asynchronousChanged();
+ }
+}
+
+
+QUrl QDeclarativeImageBase::source() const
{
- Q_D(const QmlGraphicsImageBase);
+ Q_D(const QDeclarativeImageBase);
return d->url;
}
-void QmlGraphicsImageBase::setSource(const QUrl &url)
+void QDeclarativeImageBase::setSource(const QUrl &url)
{
- Q_D(QmlGraphicsImageBase);
+ Q_D(QDeclarativeImageBase);
//equality is fairly expensive, so we bypass for simple, common case
if ((d->url.isEmpty() == url.isEmpty()) && url == d->url)
return;
if (d->pendingPixmapCache) {
- QmlPixmapCache::cancel(d->url, this);
+ QDeclarativePixmapCache::cancel(d->url, this);
d->pendingPixmapCache = false;
}
d->url = url;
+ emit sourceChanged(d->url);
+
+ if (isComponentComplete())
+ load();
+}
+
+void QDeclarativeImageBase::load()
+{
+ Q_D(QDeclarativeImageBase);
if (d->progress != 0.0) {
d->progress = 0.0;
emit progressChanged(d->progress);
}
- if (url.isEmpty()) {
+ if (d->url.isEmpty()) {
d->pix = QPixmap();
d->status = Null;
setImplicitWidth(0);
setImplicitHeight(0);
emit statusChanged(d->status);
- emit sourceChanged(d->url);
emit pixmapChanged();
update();
} else {
d->status = Loading;
- QmlPixmapReply::Status status = QmlPixmapCache::get(d->url, &d->pix);
- if (status != QmlPixmapReply::Ready && status != QmlPixmapReply::Error) {
- QmlPixmapReply *reply = QmlPixmapCache::request(qmlEngine(this), d->url);
+ QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->url, &d->pix, d->async);
+ if (status != QDeclarativePixmapReply::Ready && status != QDeclarativePixmapReply::Error) {
+ QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(this), d->url);
d->pendingPixmapCache = true;
static int replyDownloadProgress = -1;
@@ -121,13 +146,13 @@ void QmlGraphicsImageBase::setSource(const QUrl &url)
static int thisRequestFinished = -1;
if (replyDownloadProgress == -1) {
replyDownloadProgress =
- QmlPixmapReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)");
+ QDeclarativePixmapReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)");
replyFinished =
- QmlPixmapReply::staticMetaObject.indexOfSignal("finished()");
+ QDeclarativePixmapReply::staticMetaObject.indexOfSignal("finished()");
thisRequestProgress =
- QmlGraphicsImageBase::staticMetaObject.indexOfSlot("requestProgress(qint64,qint64)");
+ QDeclarativeImageBase::staticMetaObject.indexOfSlot("requestProgress(qint64,qint64)");
thisRequestFinished =
- QmlGraphicsImageBase::staticMetaObject.indexOfSlot("requestFinished()");
+ QDeclarativeImageBase::staticMetaObject.indexOfSlot("requestFinished()");
}
QMetaObject::connect(reply, replyFinished, this,
@@ -136,7 +161,7 @@ void QmlGraphicsImageBase::setSource(const QUrl &url)
thisRequestProgress, Qt::DirectConnection);
} else {
//### should be unified with requestFinished
- if (status == QmlPixmapReply::Ready) {
+ if (status == QDeclarativePixmapReply::Ready) {
setImplicitWidth(d->pix.width());
setImplicitHeight(d->pix.height());
@@ -147,7 +172,6 @@ void QmlGraphicsImageBase::setSource(const QUrl &url)
}
d->progress = 1.0;
emit statusChanged(d->status);
- emit sourceChanged(d->url);
emit progressChanged(d->progress);
emit pixmapChanged();
update();
@@ -157,13 +181,13 @@ void QmlGraphicsImageBase::setSource(const QUrl &url)
emit statusChanged(d->status);
}
-void QmlGraphicsImageBase::requestFinished()
+void QDeclarativeImageBase::requestFinished()
{
- Q_D(QmlGraphicsImageBase);
+ Q_D(QDeclarativeImageBase);
d->pendingPixmapCache = false;
- if (QmlPixmapCache::get(d->url, &d->pix) != QmlPixmapReply::Ready)
+ if (QDeclarativePixmapCache::get(d->url, &d->pix, d->async) != QDeclarativePixmapReply::Ready)
d->status = Error;
setImplicitWidth(d->pix.width());
setImplicitHeight(d->pix.height());
@@ -172,20 +196,26 @@ void QmlGraphicsImageBase::requestFinished()
d->status = Ready;
d->progress = 1.0;
emit statusChanged(d->status);
- emit sourceChanged(d->url);
emit progressChanged(1.0);
emit pixmapChanged();
update();
}
-void QmlGraphicsImageBase::requestProgress(qint64 received, qint64 total)
+void QDeclarativeImageBase::requestProgress(qint64 received, qint64 total)
{
- Q_D(QmlGraphicsImageBase);
+ Q_D(QDeclarativeImageBase);
if (d->status == Loading && total > 0) {
d->progress = qreal(received)/total;
emit progressChanged(d->progress);
}
}
+void QDeclarativeImageBase::componentComplete()
+{
+ Q_D(QDeclarativeImageBase);
+ QDeclarativeItem::componentComplete();
+ if (d->url.isValid())
+ load();
+}
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qmlgraphicsimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
index e8bda4c..c8c50ac 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimagebase_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
@@ -39,17 +39,17 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSIMAGEBASE_H
-#define QMLGRAPHICSIMAGEBASE_H
+#ifndef QDECLARATIVEIMAGEBASE_H
+#define QDECLARATIVEIMAGEBASE_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QmlGraphicsImageBasePrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsImageBase : public QmlGraphicsItem
+class QDeclarativeImageBasePrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeImageBase : public QDeclarativeItem
{
Q_OBJECT
Q_ENUMS(Status)
@@ -57,9 +57,10 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsImageBase : public QmlGraphicsItem
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
+ Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged)
public:
- ~QmlGraphicsImageBase();
+ ~QDeclarativeImageBase();
enum Status { Null, Ready, Loading, Error };
Status status() const;
qreal progress() const;
@@ -67,26 +68,32 @@ public:
QUrl source() const;
virtual void setSource(const QUrl &url);
+ bool asynchronous() const;
+ void setAsynchronous(bool);
+
Q_SIGNALS:
void sourceChanged(const QUrl &);
void statusChanged(Status);
void progressChanged(qreal progress);
void pixmapChanged();
+ void asynchronousChanged();
protected:
- QmlGraphicsImageBase(QmlGraphicsImageBasePrivate &dd, QmlGraphicsItem *parent);
+ virtual void load();
+ virtual void componentComplete();
+ QDeclarativeImageBase(QDeclarativeImageBasePrivate &dd, QDeclarativeItem *parent);
private Q_SLOTS:
virtual void requestFinished();
void requestProgress(qint64,qint64);
private:
- Q_DISABLE_COPY(QmlGraphicsImageBase)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsImageBase)
+ Q_DISABLE_COPY(QDeclarativeImageBase)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeImageBase)
};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLGRAPHICSIMAGEBASE_H
+#endif // QDECLARATIVEIMAGEBASE_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsimagebase_p_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h
index d86785f..2e062a8 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimagebase_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSIMAGEBASE_P_H
-#define QMLGRAPHICSIMAGEBASE_P_H
+#ifndef QDECLARATIVEIMAGEBASE_P_H
+#define QDECLARATIVEIMAGEBASE_P_H
//
// W A R N I N G
@@ -53,30 +53,32 @@
// We mean it.
//
-#include "qmlgraphicsitem_p.h"
+#include "qdeclarativeitem_p.h"
#include <QtCore/QPointer>
QT_BEGIN_NAMESPACE
class QNetworkReply;
-class QmlGraphicsImageBasePrivate : public QmlGraphicsItemPrivate
+class QDeclarativeImageBasePrivate : public QDeclarativeItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsImageBase)
+ Q_DECLARE_PUBLIC(QDeclarativeImageBase)
public:
- QmlGraphicsImageBasePrivate()
- : status(QmlGraphicsImageBase::Null),
+ QDeclarativeImageBasePrivate()
+ : status(QDeclarativeImageBase::Null),
progress(0.0),
- pendingPixmapCache(false)
+ pendingPixmapCache(false),
+ async(false)
{
}
QPixmap pix;
- QmlGraphicsImageBase::Status status;
+ QDeclarativeImageBase::Status status;
QUrl url;
qreal progress;
- bool pendingPixmapCache;
+ bool pendingPixmapCache : 1;
+ bool async : 1;
};
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index fce4e36..c282808 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -39,18 +39,18 @@
**
****************************************************************************/
-#include "qmlgraphicsitem_p.h"
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem_p.h"
+#include "qdeclarativeitem.h"
-#include "qmlgraphicsevents_p_p.h"
+#include "qdeclarativeevents_p_p.h"
#include <qfxperf_p_p.h>
-#include <qmlengine.h>
-#include <qmlopenmetaobject_p.h>
-#include <qmlstate_p.h>
-#include <qmlview.h>
-#include <qmlstategroup_p.h>
-#include <qmlcomponent.h>
+#include <qdeclarativeengine.h>
+#include <qdeclarativeopenmetaobject_p.h>
+#include <qdeclarativestate_p.h>
+#include <qdeclarativeview.h>
+#include <qdeclarativestategroup_p.h>
+#include <qdeclarativecomponent.h>
#include <QDebug>
#include <QPen>
@@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE
#define FLT_MAX 1E+37
#endif
-#include "qmlgraphicseffects.cpp"
+#include "qdeclarativeeffects.cpp"
/*!
\qmlclass Transform QGraphicsTransform
@@ -220,13 +220,13 @@ QT_BEGIN_NAMESPACE
/*!
\internal
- \class QmlGraphicsContents
+ \class QDeclarativeContents
\ingroup group_utility
- \brief The QmlGraphicsContents class gives access to the height and width of an item's contents.
+ \brief The QDeclarativeContents class gives access to the height and width of an item's contents.
*/
-QmlGraphicsContents::QmlGraphicsContents() : m_x(0), m_y(0), m_width(0), m_height(0)
+QDeclarativeContents::QDeclarativeContents() : m_x(0), m_y(0), m_width(0), m_height(0)
{
}
@@ -241,13 +241,13 @@ QmlGraphicsContents::QmlGraphicsContents() : m_x(0), m_y(0), m_width(0), m_heigh
sized to fit its children.
*/
-QRectF QmlGraphicsContents::rectF() const
+QRectF QDeclarativeContents::rectF() const
{
return QRectF(m_x, m_y, m_width, m_height);
}
//TODO: optimization: only check sender(), if there is one
-void QmlGraphicsContents::calcHeight()
+void QDeclarativeContents::calcHeight()
{
qreal oldy = m_y;
qreal oldheight = m_height;
@@ -257,8 +257,8 @@ void QmlGraphicsContents::calcHeight()
QList<QGraphicsItem *> children = m_item->childItems();
for (int i = 0; i < children.count(); ++i) {
- QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(children.at(i));
- if(!child)//### Should this be ignoring non-QmlGraphicsItem graphicsobjects?
+ QDeclarativeItem *child = qobject_cast<QDeclarativeItem *>(children.at(i));
+ if(!child)//### Should this be ignoring non-QDeclarativeItem graphicsobjects?
continue;
qreal y = child->y();
if (y + child->height() > bottom)
@@ -275,7 +275,7 @@ void QmlGraphicsContents::calcHeight()
}
//TODO: optimization: only check sender(), if there is one
-void QmlGraphicsContents::calcWidth()
+void QDeclarativeContents::calcWidth()
{
qreal oldx = m_x;
qreal oldwidth = m_width;
@@ -285,8 +285,8 @@ void QmlGraphicsContents::calcWidth()
QList<QGraphicsItem *> children = m_item->childItems();
for (int i = 0; i < children.count(); ++i) {
- QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(children.at(i));
- if(!child)//### Should this be ignoring non-QmlGraphicsItem graphicsobjects?
+ QDeclarativeItem *child = qobject_cast<QDeclarativeItem *>(children.at(i));
+ if(!child)//### Should this be ignoring non-QDeclarativeItem graphicsobjects?
continue;
qreal x = child->x();
if (x + child->width() > right)
@@ -302,14 +302,14 @@ void QmlGraphicsContents::calcWidth()
emit rectChanged();
}
-void QmlGraphicsContents::setItem(QmlGraphicsItem *item)
+void QDeclarativeContents::setItem(QDeclarativeItem *item)
{
m_item = item;
QList<QGraphicsItem *> children = m_item->childItems();
for (int i = 0; i < children.count(); ++i) {
- QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(children.at(i));
- if(!child)//### Should this be ignoring non-QmlGraphicsItem graphicsobjects?
+ QDeclarativeItem *child = qobject_cast<QDeclarativeItem *>(children.at(i));
+ if(!child)//### Should this be ignoring non-QDeclarativeItem graphicsobjects?
continue;
connect(child, SIGNAL(heightChanged()), this, SLOT(calcHeight()));
connect(child, SIGNAL(yChanged()), this, SLOT(calcHeight()));
@@ -322,43 +322,43 @@ void QmlGraphicsContents::setItem(QmlGraphicsItem *item)
calcWidth();
}
-QmlGraphicsItemKeyFilter::QmlGraphicsItemKeyFilter(QmlGraphicsItem *item)
+QDeclarativeItemKeyFilter::QDeclarativeItemKeyFilter(QDeclarativeItem *item)
: m_next(0)
{
- QmlGraphicsItemPrivate *p =
- item?static_cast<QmlGraphicsItemPrivate *>(QGraphicsItemPrivate::get(item)):0;
+ QDeclarativeItemPrivate *p =
+ item?static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(item)):0;
if (p) {
m_next = p->keyHandler;
p->keyHandler = this;
}
}
-QmlGraphicsItemKeyFilter::~QmlGraphicsItemKeyFilter()
+QDeclarativeItemKeyFilter::~QDeclarativeItemKeyFilter()
{
}
-void QmlGraphicsItemKeyFilter::keyPressed(QKeyEvent *event)
+void QDeclarativeItemKeyFilter::keyPressed(QKeyEvent *event)
{
if (m_next) m_next->keyPressed(event);
}
-void QmlGraphicsItemKeyFilter::keyReleased(QKeyEvent *event)
+void QDeclarativeItemKeyFilter::keyReleased(QKeyEvent *event)
{
if (m_next) m_next->keyReleased(event);
}
-void QmlGraphicsItemKeyFilter::inputMethodEvent(QInputMethodEvent *event)
+void QDeclarativeItemKeyFilter::inputMethodEvent(QInputMethodEvent *event)
{
if (m_next) m_next->inputMethodEvent(event);
}
-QVariant QmlGraphicsItemKeyFilter::inputMethodQuery(Qt::InputMethodQuery query) const
+QVariant QDeclarativeItemKeyFilter::inputMethodQuery(Qt::InputMethodQuery query) const
{
if (m_next) return m_next->inputMethodQuery(query);
return QVariant();
}
-void QmlGraphicsItemKeyFilter::componentComplete()
+void QDeclarativeItemKeyFilter::componentComplete()
{
if (m_next) m_next->componentComplete();
}
@@ -434,73 +434,73 @@ void QmlGraphicsItemKeyFilter::componentComplete()
pressed.
*/
-QmlGraphicsKeyNavigationAttached::QmlGraphicsKeyNavigationAttached(QObject *parent)
-: QObject(*(new QmlGraphicsKeyNavigationAttachedPrivate), parent),
- QmlGraphicsItemKeyFilter(qobject_cast<QmlGraphicsItem*>(parent))
+QDeclarativeKeyNavigationAttached::QDeclarativeKeyNavigationAttached(QObject *parent)
+: QObject(*(new QDeclarativeKeyNavigationAttachedPrivate), parent),
+ QDeclarativeItemKeyFilter(qobject_cast<QDeclarativeItem*>(parent))
{
}
-QmlGraphicsKeyNavigationAttached *
-QmlGraphicsKeyNavigationAttached::qmlAttachedProperties(QObject *obj)
+QDeclarativeKeyNavigationAttached *
+QDeclarativeKeyNavigationAttached::qmlAttachedProperties(QObject *obj)
{
- return new QmlGraphicsKeyNavigationAttached(obj);
+ return new QDeclarativeKeyNavigationAttached(obj);
}
-QmlGraphicsItem *QmlGraphicsKeyNavigationAttached::left() const
+QDeclarativeItem *QDeclarativeKeyNavigationAttached::left() const
{
- Q_D(const QmlGraphicsKeyNavigationAttached);
+ Q_D(const QDeclarativeKeyNavigationAttached);
return d->left;
}
-void QmlGraphicsKeyNavigationAttached::setLeft(QmlGraphicsItem *i)
+void QDeclarativeKeyNavigationAttached::setLeft(QDeclarativeItem *i)
{
- Q_D(QmlGraphicsKeyNavigationAttached);
+ Q_D(QDeclarativeKeyNavigationAttached);
d->left = i;
emit changed();
}
-QmlGraphicsItem *QmlGraphicsKeyNavigationAttached::right() const
+QDeclarativeItem *QDeclarativeKeyNavigationAttached::right() const
{
- Q_D(const QmlGraphicsKeyNavigationAttached);
+ Q_D(const QDeclarativeKeyNavigationAttached);
return d->right;
}
-void QmlGraphicsKeyNavigationAttached::setRight(QmlGraphicsItem *i)
+void QDeclarativeKeyNavigationAttached::setRight(QDeclarativeItem *i)
{
- Q_D(QmlGraphicsKeyNavigationAttached);
+ Q_D(QDeclarativeKeyNavigationAttached);
d->right = i;
emit changed();
}
-QmlGraphicsItem *QmlGraphicsKeyNavigationAttached::up() const
+QDeclarativeItem *QDeclarativeKeyNavigationAttached::up() const
{
- Q_D(const QmlGraphicsKeyNavigationAttached);
+ Q_D(const QDeclarativeKeyNavigationAttached);
return d->up;
}
-void QmlGraphicsKeyNavigationAttached::setUp(QmlGraphicsItem *i)
+void QDeclarativeKeyNavigationAttached::setUp(QDeclarativeItem *i)
{
- Q_D(QmlGraphicsKeyNavigationAttached);
+ Q_D(QDeclarativeKeyNavigationAttached);
d->up = i;
emit changed();
}
-QmlGraphicsItem *QmlGraphicsKeyNavigationAttached::down() const
+QDeclarativeItem *QDeclarativeKeyNavigationAttached::down() const
{
- Q_D(const QmlGraphicsKeyNavigationAttached);
+ Q_D(const QDeclarativeKeyNavigationAttached);
return d->down;
}
-void QmlGraphicsKeyNavigationAttached::setDown(QmlGraphicsItem *i)
+void QDeclarativeKeyNavigationAttached::setDown(QDeclarativeItem *i)
{
- Q_D(QmlGraphicsKeyNavigationAttached);
+ Q_D(QDeclarativeKeyNavigationAttached);
d->down = i;
emit changed();
}
-void QmlGraphicsKeyNavigationAttached::keyPressed(QKeyEvent *event)
+void QDeclarativeKeyNavigationAttached::keyPressed(QKeyEvent *event)
{
- Q_D(QmlGraphicsKeyNavigationAttached);
+ Q_D(QDeclarativeKeyNavigationAttached);
event->ignore();
@@ -533,12 +533,12 @@ void QmlGraphicsKeyNavigationAttached::keyPressed(QKeyEvent *event)
break;
}
- if (!event->isAccepted()) QmlGraphicsItemKeyFilter::keyPressed(event);
+ if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyPressed(event);
}
-void QmlGraphicsKeyNavigationAttached::keyReleased(QKeyEvent *event)
+void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event)
{
- Q_D(QmlGraphicsKeyNavigationAttached);
+ Q_D(QDeclarativeKeyNavigationAttached);
event->ignore();
@@ -567,7 +567,7 @@ void QmlGraphicsKeyNavigationAttached::keyReleased(QKeyEvent *event)
break;
}
- if (!event->isAccepted()) QmlGraphicsItemKeyFilter::keyReleased(event);
+ if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyReleased(event);
}
/*!
@@ -897,7 +897,7 @@ void QmlGraphicsKeyNavigationAttached::keyReleased(QKeyEvent *event)
parameter provides information about the event.
*/
-const QmlGraphicsKeysAttached::SigMap QmlGraphicsKeysAttached::sigMap[] = {
+const QDeclarativeKeysAttached::SigMap QDeclarativeKeysAttached::sigMap[] = {
{ Qt::Key_Left, "leftPressed" },
{ Qt::Key_Right, "rightPressed" },
{ Qt::Key_Up, "upPressed" },
@@ -927,26 +927,26 @@ const QmlGraphicsKeysAttached::SigMap QmlGraphicsKeysAttached::sigMap[] = {
{ 0, 0 }
};
-bool QmlGraphicsKeysAttachedPrivate::isConnected(const char *signalName)
+bool QDeclarativeKeysAttachedPrivate::isConnected(const char *signalName)
{
return isSignalConnected(signalIndex(signalName));
}
-QmlGraphicsKeysAttached::QmlGraphicsKeysAttached(QObject *parent)
-: QObject(*(new QmlGraphicsKeysAttachedPrivate), parent),
- QmlGraphicsItemKeyFilter(qobject_cast<QmlGraphicsItem*>(parent))
+QDeclarativeKeysAttached::QDeclarativeKeysAttached(QObject *parent)
+: QObject(*(new QDeclarativeKeysAttachedPrivate), parent),
+ QDeclarativeItemKeyFilter(qobject_cast<QDeclarativeItem*>(parent))
{
- Q_D(QmlGraphicsKeysAttached);
- d->item = qobject_cast<QmlGraphicsItem*>(parent);
+ Q_D(QDeclarativeKeysAttached);
+ d->item = qobject_cast<QDeclarativeItem*>(parent);
}
-QmlGraphicsKeysAttached::~QmlGraphicsKeysAttached()
+QDeclarativeKeysAttached::~QDeclarativeKeysAttached()
{
}
-void QmlGraphicsKeysAttached::componentComplete()
+void QDeclarativeKeysAttached::componentComplete()
{
- Q_D(QmlGraphicsKeysAttached);
+ Q_D(QDeclarativeKeysAttached);
if (d->item) {
for (int ii = 0; ii < d->targets.count(); ++ii) {
QGraphicsItem *targetItem = d->finalFocusProxy(d->targets.at(ii));
@@ -958,9 +958,9 @@ void QmlGraphicsKeysAttached::componentComplete()
}
}
-void QmlGraphicsKeysAttached::keyPressed(QKeyEvent *event)
+void QDeclarativeKeysAttached::keyPressed(QKeyEvent *event)
{
- Q_D(QmlGraphicsKeysAttached);
+ Q_D(QDeclarativeKeysAttached);
if (!d->enabled || d->inPress) {
event->ignore();
return;
@@ -982,27 +982,27 @@ void QmlGraphicsKeysAttached::keyPressed(QKeyEvent *event)
d->inPress = false;
}
- QmlGraphicsKeyEvent ke(*event);
+ QDeclarativeKeyEvent ke(*event);
QByteArray keySignal = keyToSignal(event->key());
if (!keySignal.isEmpty()) {
- keySignal += "(QmlGraphicsKeyEvent*)";
+ keySignal += "(QDeclarativeKeyEvent*)";
if (d->isConnected(keySignal)) {
// If we specifically handle a key then default to accepted
ke.setAccepted(true);
- int idx = QmlGraphicsKeysAttached::staticMetaObject.indexOfSignal(keySignal);
- metaObject()->method(idx).invoke(this, Qt::DirectConnection, Q_ARG(QmlGraphicsKeyEvent*, &ke));
+ int idx = QDeclarativeKeysAttached::staticMetaObject.indexOfSignal(keySignal);
+ metaObject()->method(idx).invoke(this, Qt::DirectConnection, Q_ARG(QDeclarativeKeyEvent*, &ke));
}
}
if (!ke.isAccepted())
emit pressed(&ke);
event->setAccepted(ke.isAccepted());
- if (!event->isAccepted()) QmlGraphicsItemKeyFilter::keyPressed(event);
+ if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyPressed(event);
}
-void QmlGraphicsKeysAttached::keyReleased(QKeyEvent *event)
+void QDeclarativeKeysAttached::keyReleased(QKeyEvent *event)
{
- Q_D(QmlGraphicsKeysAttached);
+ Q_D(QDeclarativeKeysAttached);
if (!d->enabled || d->inRelease) {
event->ignore();
return;
@@ -1023,16 +1023,16 @@ void QmlGraphicsKeysAttached::keyReleased(QKeyEvent *event)
d->inRelease = false;
}
- QmlGraphicsKeyEvent ke(*event);
+ QDeclarativeKeyEvent ke(*event);
emit released(&ke);
event->setAccepted(ke.isAccepted());
- if (!event->isAccepted()) QmlGraphicsItemKeyFilter::keyReleased(event);
+ if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyReleased(event);
}
-void QmlGraphicsKeysAttached::inputMethodEvent(QInputMethodEvent *event)
+void QDeclarativeKeysAttached::inputMethodEvent(QInputMethodEvent *event)
{
- Q_D(QmlGraphicsKeysAttached);
+ Q_D(QDeclarativeKeysAttached);
if (d->item && !d->inIM && d->item->scene()) {
d->inIM = true;
for (int ii = 0; ii < d->targets.count(); ++ii) {
@@ -1048,10 +1048,10 @@ void QmlGraphicsKeysAttached::inputMethodEvent(QInputMethodEvent *event)
}
d->inIM = false;
}
- if (!event->isAccepted()) QmlGraphicsItemKeyFilter::inputMethodEvent(event);
+ if (!event->isAccepted()) QDeclarativeItemKeyFilter::inputMethodEvent(event);
}
-class QmlGraphicsItemAccessor : public QGraphicsItem
+class QDeclarativeItemAccessor : public QGraphicsItem
{
public:
QVariant doInputMethodQuery(Qt::InputMethodQuery query) const {
@@ -1059,44 +1059,44 @@ public:
}
};
-QVariant QmlGraphicsKeysAttached::inputMethodQuery(Qt::InputMethodQuery query) const
+QVariant QDeclarativeKeysAttached::inputMethodQuery(Qt::InputMethodQuery query) const
{
- Q_D(const QmlGraphicsKeysAttached);
+ Q_D(const QDeclarativeKeysAttached);
if (d->item) {
for (int ii = 0; ii < d->targets.count(); ++ii) {
QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii));
if (i && (i->flags() & QGraphicsItem::ItemAcceptsInputMethod) && i == d->imeItem) { //### how robust is i == d->imeItem check?
- QVariant v = static_cast<QmlGraphicsItemAccessor *>(i)->doInputMethodQuery(query);
+ QVariant v = static_cast<QDeclarativeItemAccessor *>(i)->doInputMethodQuery(query);
if (v.userType() == QVariant::RectF)
v = d->item->mapRectFromItem(i, v.toRectF()); //### cost?
return v;
}
}
}
- return QmlGraphicsItemKeyFilter::inputMethodQuery(query);
+ return QDeclarativeItemKeyFilter::inputMethodQuery(query);
}
-QmlGraphicsKeysAttached *QmlGraphicsKeysAttached::qmlAttachedProperties(QObject *obj)
+QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObject *obj)
{
- return new QmlGraphicsKeysAttached(obj);
+ return new QDeclarativeKeysAttached(obj);
}
/*!
- \class QmlGraphicsItem
+ \class QDeclarativeItem
\since 4.7
- \brief The QmlGraphicsItem class provides the most basic of all visual items in QML.
+ \brief The QDeclarativeItem class provides the most basic of all visual items in QML.
- All visual items in Qt Declarative inherit from QmlGraphicsItem. Although QmlGraphicsItem
+ All visual items in Qt Declarative inherit from QDeclarativeItem. Although QDeclarativeItem
has no visual appearance, it defines all the properties that are
common across visual items - such as the x and y position, the
width and height, \l {anchor-layout}{anchoring} and key handling.
- You can subclass QmlGraphicsItem to provide your own custom visual item that inherits
+ You can subclass QDeclarativeItem to provide your own custom visual item that inherits
these features.
*/
/*!
- \qmlclass Item QmlGraphicsItem
+ \qmlclass Item QDeclarativeItem
\since 4.7
\brief The Item is the most basic of all visual items in QML.
@@ -1172,134 +1172,145 @@ QmlGraphicsKeysAttached *QmlGraphicsKeysAttached::qmlAttachedProperties(QObject
See the \l {Keys}{Keys} attached property for detailed documentation.
+ \section 1 Property Change Signals
+
+ Most properties on Item and Item derivatives have a signal
+ emitted when they change. By convention, the signals are
+ named <propertyName>Changed, e.g. xChanged will be emitted when an item's
+ x property changes. Note that these also have signal handers e.g.
+ the onXChanged signal handler will be called when an item's x property
+ changes. For many properties in Item or Item derivatives this can be used
+ to add a touch of imperative logic to your application (when absolutely
+ necessary).
+
\ingroup group_coreitems
*/
/*!
- \property QmlGraphicsItem::baseline
+ \property QDeclarativeItem::baseline
\internal
*/
/*!
- \property QmlGraphicsItem::effect
+ \property QDeclarativeItem::effect
\internal
*/
/*!
- \property QmlGraphicsItem::focus
+ \property QDeclarativeItem::focus
\internal
*/
/*!
- \property QmlGraphicsItem::wantsFocus
+ \property QDeclarativeItem::wantsFocus
\internal
*/
/*!
- \property QmlGraphicsItem::transformOrigin
+ \property QDeclarativeItem::transformOrigin
\internal
*/
/*!
- \fn void QmlGraphicsItem::childrenRectChanged()
+ \fn void QDeclarativeItem::childrenRectChanged()
\internal
*/
/*!
- \fn void QmlGraphicsItem::baselineOffsetChanged()
+ \fn void QDeclarativeItem::baselineOffsetChanged()
\internal
*/
/*!
- \fn void QmlGraphicsItem::widthChanged()
+ \fn void QDeclarativeItem::widthChanged()
\internal
*/
/*!
- \fn void QmlGraphicsItem::heightChanged()
+ \fn void QDeclarativeItem::heightChanged()
\internal
*/
/*!
- \fn void QmlGraphicsItem::stateChanged(const QString &state)
+ \fn void QDeclarativeItem::stateChanged(const QString &state)
\internal
*/
/*!
- \fn void QmlGraphicsItem::parentChanged()
+ \fn void QDeclarativeItem::parentChanged()
\internal
*/
-/*! \fn void QmlGraphicsItem::transformOriginChanged(TransformOrigin)
+/*! \fn void QDeclarativeItem::transformOriginChanged(TransformOrigin)
\internal
*/
/*!
- \fn void QmlGraphicsItem::childrenChanged()
+ \fn void QDeclarativeItem::childrenChanged()
\internal
*/
/*!
- \fn void QmlGraphicsItem::focusChanged()
+ \fn void QDeclarativeItem::focusChanged()
\internal
*/
/*!
- \fn void QmlGraphicsItem::wantsFocusChanged()
+ \fn void QDeclarativeItem::wantsFocusChanged()
\internal
*/
// ### Must fix
struct RegisterAnchorLineAtStartup {
RegisterAnchorLineAtStartup() {
- qRegisterMetaType<QmlGraphicsAnchorLine>("QmlGraphicsAnchorLine");
+ qRegisterMetaType<QDeclarativeAnchorLine>("QDeclarativeAnchorLine");
}
};
static RegisterAnchorLineAtStartup registerAnchorLineAtStartup;
/*!
- \fn QmlGraphicsItem::QmlGraphicsItem(QmlGraphicsItem *parent)
+ \fn QDeclarativeItem::QDeclarativeItem(QDeclarativeItem *parent)
- Constructs a QmlGraphicsItem with the given \a parent.
+ Constructs a QDeclarativeItem with the given \a parent.
*/
-QmlGraphicsItem::QmlGraphicsItem(QmlGraphicsItem* parent)
- : QGraphicsObject(*(new QmlGraphicsItemPrivate), parent, 0)
+QDeclarativeItem::QDeclarativeItem(QDeclarativeItem* parent)
+ : QGraphicsObject(*(new QDeclarativeItemPrivate), parent, 0)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
d->init(parent);
}
/*! \internal
*/
-QmlGraphicsItem::QmlGraphicsItem(QmlGraphicsItemPrivate &dd, QmlGraphicsItem *parent)
+QDeclarativeItem::QDeclarativeItem(QDeclarativeItemPrivate &dd, QDeclarativeItem *parent)
: QGraphicsObject(dd, parent, 0)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
d->init(parent);
}
/*!
- Destroys the QmlGraphicsItem.
+ Destroys the QDeclarativeItem.
*/
-QmlGraphicsItem::~QmlGraphicsItem()
+QDeclarativeItem::~QDeclarativeItem()
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
for (int ii = 0; ii < d->changeListeners.count(); ++ii) {
- QmlGraphicsAnchorsPrivate *anchor = d->changeListeners.at(ii).listener->anchorPrivate();
+ QDeclarativeAnchorsPrivate *anchor = d->changeListeners.at(ii).listener->anchorPrivate();
if (anchor)
anchor->clearItem(this);
}
if (!d->parent || (parentItem() && !parentItem()->QGraphicsItem::d_ptr->inDestructor)) {
for (int ii = 0; ii < d->changeListeners.count(); ++ii) {
- QmlGraphicsAnchorsPrivate *anchor = d->changeListeners.at(ii).listener->anchorPrivate();
+ QDeclarativeAnchorsPrivate *anchor = d->changeListeners.at(ii).listener->anchorPrivate();
if (anchor && anchor->item && anchor->item->parentItem() != this) //child will be deleted anyway
anchor->updateOnComplete();
}
}
for(int ii = 0; ii < d->changeListeners.count(); ++ii) {
- const QmlGraphicsItemPrivate::ChangeListener &change = d->changeListeners.at(ii);
- if (change.types & QmlGraphicsItemPrivate::Destroyed)
+ const QDeclarativeItemPrivate::ChangeListener &change = d->changeListeners.at(ii);
+ if (change.types & QDeclarativeItemPrivate::Destroyed)
change.listener->itemDestroyed(this);
}
d->changeListeners.clear();
@@ -1321,7 +1332,7 @@ QmlGraphicsItem::~QmlGraphicsItem()
Image {
source: "myimage.png"
transformOrigin: Item.BottomRight
- rotate: 45
+ rotation: 45
}
\endqml
@@ -1334,12 +1345,12 @@ QmlGraphicsItem::~QmlGraphicsItem()
*/
/*!
- \property QmlGraphicsItem::parent
+ \property QDeclarativeItem::parent
This property holds the parent of the item.
*/
-void QmlGraphicsItem::setParentItem(QmlGraphicsItem *parent)
+void QDeclarativeItem::setParentItem(QDeclarativeItem *parent)
{
- QmlGraphicsItem *oldParent = parentItem();
+ QDeclarativeItem *oldParent = parentItem();
if (parent == oldParent || !parent) return;
QObject::setParent(parent);
@@ -1347,7 +1358,7 @@ void QmlGraphicsItem::setParentItem(QmlGraphicsItem *parent)
}
/*!
- \fn void QmlGraphicsItem::setParent(QmlGraphicsItem *parent)
+ \fn void QDeclarativeItem::setParent(QDeclarativeItem *parent)
\overload
Sets both the parent object and parent item to \a parent. This
function avoids the programming error of calling setParent()
@@ -1355,11 +1366,11 @@ void QmlGraphicsItem::setParentItem(QmlGraphicsItem *parent)
*/
/*!
- Returns the QmlGraphicsItem parent of this item.
+ Returns the QDeclarativeItem parent of this item.
*/
-QmlGraphicsItem *QmlGraphicsItem::parentItem() const
+QDeclarativeItem *QDeclarativeItem::parentItem() const
{
- return qobject_cast<QmlGraphicsItem *>(QGraphicsObject::parentItem());
+ return qobject_cast<QDeclarativeItem *>(QGraphicsObject::parentItem());
}
/*!
@@ -1390,12 +1401,12 @@ QmlGraphicsItem *QmlGraphicsItem::parentItem() const
*/
/*!
- \property QmlGraphicsItem::children
+ \property QDeclarativeItem::children
\internal
*/
/*!
- \property QmlGraphicsItem::resources
+ \property QDeclarativeItem::resources
\internal
*/
@@ -1408,34 +1419,34 @@ QmlGraphicsItem *QmlGraphicsItem::parentItem() const
\sa componentComplete()
*/
-bool QmlGraphicsItem::isComponentComplete() const
+bool QDeclarativeItem::isComponentComplete() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->_componentComplete;
}
/*!
- \property QmlGraphicsItem::anchors
+ \property QDeclarativeItem::anchors
\internal
*/
/*! \internal */
-QmlGraphicsAnchors *QmlGraphicsItem::anchors()
+QDeclarativeAnchors *QDeclarativeItem::anchors()
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
return d->anchors();
}
-void QmlGraphicsItemPrivate::data_append(QmlListProperty<QObject> *prop, QObject *o)
+void QDeclarativeItemPrivate::data_append(QDeclarativeListProperty<QObject> *prop, QObject *o)
{
- QmlGraphicsItem *i = qobject_cast<QmlGraphicsItem *>(o);
+ QDeclarativeItem *i = qobject_cast<QDeclarativeItem *>(o);
if (i)
- i->setParentItem(static_cast<QmlGraphicsItem *>(prop->object));
+ i->setParentItem(static_cast<QDeclarativeItem *>(prop->object));
else
- o->setParent(static_cast<QmlGraphicsItem *>(prop->object));
+ o->setParent(static_cast<QDeclarativeItem *>(prop->object));
}
-QObject *QmlGraphicsItemPrivate::resources_at(QmlListProperty<QObject> *prop, int index)
+QObject *QDeclarativeItemPrivate::resources_at(QDeclarativeListProperty<QObject> *prop, int index)
{
QObjectList children = prop->object->children();
if (index < children.count())
@@ -1444,38 +1455,38 @@ QObject *QmlGraphicsItemPrivate::resources_at(QmlListProperty<QObject> *prop, in
return 0;
}
-void QmlGraphicsItemPrivate::resources_append(QmlListProperty<QObject> *prop, QObject *o)
+void QDeclarativeItemPrivate::resources_append(QDeclarativeListProperty<QObject> *prop, QObject *o)
{
o->setParent(prop->object);
}
-int QmlGraphicsItemPrivate::resources_count(QmlListProperty<QObject> *prop)
+int QDeclarativeItemPrivate::resources_count(QDeclarativeListProperty<QObject> *prop)
{
return prop->object->children().count();
}
-QmlGraphicsItem *QmlGraphicsItemPrivate::children_at(QmlListProperty<QmlGraphicsItem> *prop, int index)
+QDeclarativeItem *QDeclarativeItemPrivate::children_at(QDeclarativeListProperty<QDeclarativeItem> *prop, int index)
{
- QList<QGraphicsItem *> children = static_cast<QmlGraphicsItem*>(prop->object)->childItems();
+ QList<QGraphicsItem *> children = static_cast<QDeclarativeItem*>(prop->object)->childItems();
if (index < children.count())
- return qobject_cast<QmlGraphicsItem *>(children.at(index));
+ return qobject_cast<QDeclarativeItem *>(children.at(index));
else
return 0;
}
-void QmlGraphicsItemPrivate::children_append(QmlListProperty<QmlGraphicsItem> *prop, QmlGraphicsItem *i)
+void QDeclarativeItemPrivate::children_append(QDeclarativeListProperty<QDeclarativeItem> *prop, QDeclarativeItem *i)
{
if (i)
- i->setParentItem(static_cast<QmlGraphicsItem*>(prop->object));
+ i->setParentItem(static_cast<QDeclarativeItem*>(prop->object));
}
-int QmlGraphicsItemPrivate::children_count(QmlListProperty<QmlGraphicsItem> *prop)
+int QDeclarativeItemPrivate::children_count(QDeclarativeListProperty<QDeclarativeItem> *prop)
{
- return static_cast<QmlGraphicsItem*>(prop->object)->childItems().count();
+ return static_cast<QDeclarativeItem*>(prop->object)->childItems().count();
}
-int QmlGraphicsItemPrivate::transform_count(QmlListProperty<QGraphicsTransform> *list)
+int QDeclarativeItemPrivate::transform_count(QDeclarativeListProperty<QGraphicsTransform> *list)
{
QGraphicsObject *object = qobject_cast<QGraphicsObject *>(list->object);
if (object) {
@@ -1486,14 +1497,14 @@ int QmlGraphicsItemPrivate::transform_count(QmlListProperty<QGraphicsTransform>
}
}
-void QmlGraphicsItemPrivate::transform_append(QmlListProperty<QGraphicsTransform> *list, QGraphicsTransform *item)
+void QDeclarativeItemPrivate::transform_append(QDeclarativeListProperty<QGraphicsTransform> *list, QGraphicsTransform *item)
{
QGraphicsObject *object = qobject_cast<QGraphicsObject *>(list->object);
if (object)
QGraphicsItemPrivate::get(object)->appendGraphicsTransform(item);
}
-QGraphicsTransform *QmlGraphicsItemPrivate::transform_at(QmlListProperty<QGraphicsTransform> *list, int idx)
+QGraphicsTransform *QDeclarativeItemPrivate::transform_at(QDeclarativeListProperty<QGraphicsTransform> *list, int idx)
{
QGraphicsObject *object = qobject_cast<QGraphicsObject *>(list->object);
if (object) {
@@ -1506,7 +1517,7 @@ QGraphicsTransform *QmlGraphicsItemPrivate::transform_at(QmlListProperty<QGraphi
}
}
-void QmlGraphicsItemPrivate::transform_clear(QmlListProperty<QGraphicsTransform> *list)
+void QDeclarativeItemPrivate::transform_clear(QDeclarativeListProperty<QGraphicsTransform> *list)
{
QGraphicsObject *object = qobject_cast<QGraphicsObject *>(list->object);
if (object) {
@@ -1552,39 +1563,39 @@ void QmlGraphicsItemPrivate::transform_clear(QmlListProperty<QGraphicsTransform>
*/
/*!
- \property QmlGraphicsItem::data
+ \property QDeclarativeItem::data
\internal
*/
/*! \internal */
-QmlListProperty<QObject> QmlGraphicsItem::data()
+QDeclarativeListProperty<QObject> QDeclarativeItem::data()
{
- return QmlListProperty<QObject>(this, 0, QmlGraphicsItemPrivate::data_append);
+ return QDeclarativeListProperty<QObject>(this, 0, QDeclarativeItemPrivate::data_append);
}
/*!
- \property QmlGraphicsItem::childrenRect
+ \property QDeclarativeItem::childrenRect
\brief The geometry of an item's children.
childrenRect provides an easy way to access the (collective) position and size of the item's children.
*/
-QRectF QmlGraphicsItem::childrenRect()
+QRectF QDeclarativeItem::childrenRect()
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
if (!d->_contents) {
- d->_contents = new QmlGraphicsContents;
+ d->_contents = new QDeclarativeContents;
d->_contents->setParent(this);
d->_contents->setItem(this);
}
return d->_contents->rectF();
}
-bool QmlGraphicsItem::clip() const
+bool QDeclarativeItem::clip() const
{
return flags() & ItemClipsChildrenToShape;
}
-void QmlGraphicsItem::setClip(bool c)
+void QDeclarativeItem::setClip(bool c)
{
if (clip() == c)
return;
@@ -1606,13 +1617,13 @@ void QmlGraphicsItem::setClip(bool c)
*/
/*!
- \property QmlGraphicsItem::width
+ \property QDeclarativeItem::width
Defines the item's width relative to its parent.
*/
/*!
- \property QmlGraphicsItem::height
+ \property QDeclarativeItem::height
Defines the item's height relative to its parent.
*/
@@ -1711,15 +1722,15 @@ void QmlGraphicsItem::setClip(bool c)
geometry from \a oldGeometry to \a newGeometry. If the two
geometries are the same, it doesn't do anything.
*/
-void QmlGraphicsItem::geometryChanged(const QRectF &newGeometry,
+void QDeclarativeItem::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
if (d->_anchors)
d->_anchors->d_func()->updateMe();
- if (transformOrigin() != QmlGraphicsItem::TopLeft)
+ if (transformOrigin() != QDeclarativeItem::TopLeft)
setTransformOriginPoint(d->computeTransformOrigin());
if (newGeometry.x() != oldGeometry.x())
@@ -1732,22 +1743,22 @@ void QmlGraphicsItem::geometryChanged(const QRectF &newGeometry,
emit heightChanged();
for(int ii = 0; ii < d->changeListeners.count(); ++ii) {
- const QmlGraphicsItemPrivate::ChangeListener &change = d->changeListeners.at(ii);
- if (change.types & QmlGraphicsItemPrivate::Geometry)
+ const QDeclarativeItemPrivate::ChangeListener &change = d->changeListeners.at(ii);
+ if (change.types & QDeclarativeItemPrivate::Geometry)
change.listener->itemGeometryChanged(this, newGeometry, oldGeometry);
}
}
-void QmlGraphicsItemPrivate::removeItemChangeListener(QmlGraphicsItemChangeListener *listener, ChangeTypes types)
+void QDeclarativeItemPrivate::removeItemChangeListener(QDeclarativeItemChangeListener *listener, ChangeTypes types)
{
ChangeListener change(listener, types);
changeListeners.removeOne(change);
}
/*! \internal */
-void QmlGraphicsItem::keyPressEvent(QKeyEvent *event)
+void QDeclarativeItem::keyPressEvent(QKeyEvent *event)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
if (d->keyHandler)
d->keyHandler->keyPressed(event);
else
@@ -1755,9 +1766,9 @@ void QmlGraphicsItem::keyPressEvent(QKeyEvent *event)
}
/*! \internal */
-void QmlGraphicsItem::keyReleaseEvent(QKeyEvent *event)
+void QDeclarativeItem::keyReleaseEvent(QKeyEvent *event)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
if (d->keyHandler)
d->keyHandler->keyReleased(event);
else
@@ -1765,9 +1776,9 @@ void QmlGraphicsItem::keyReleaseEvent(QKeyEvent *event)
}
/*! \internal */
-void QmlGraphicsItem::inputMethodEvent(QInputMethodEvent *event)
+void QDeclarativeItem::inputMethodEvent(QInputMethodEvent *event)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
if (d->keyHandler)
d->keyHandler->inputMethodEvent(event);
else
@@ -1775,9 +1786,9 @@ void QmlGraphicsItem::inputMethodEvent(QInputMethodEvent *event)
}
/*! \internal */
-QVariant QmlGraphicsItem::inputMethodQuery(Qt::InputMethodQuery query) const
+QVariant QDeclarativeItem::inputMethodQuery(Qt::InputMethodQuery query) const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
QVariant v;
if (d->keyHandler)
v = d->keyHandler->inputMethodQuery(query);
@@ -1791,54 +1802,54 @@ QVariant QmlGraphicsItem::inputMethodQuery(Qt::InputMethodQuery query) const
/*!
\internal
*/
-QmlGraphicsAnchorLine QmlGraphicsItem::left() const
+QDeclarativeAnchorLine QDeclarativeItem::left() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->anchorLines()->left;
}
/*!
\internal
*/
-QmlGraphicsAnchorLine QmlGraphicsItem::right() const
+QDeclarativeAnchorLine QDeclarativeItem::right() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->anchorLines()->right;
}
/*!
\internal
*/
-QmlGraphicsAnchorLine QmlGraphicsItem::horizontalCenter() const
+QDeclarativeAnchorLine QDeclarativeItem::horizontalCenter() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->anchorLines()->hCenter;
}
/*!
\internal
*/
-QmlGraphicsAnchorLine QmlGraphicsItem::top() const
+QDeclarativeAnchorLine QDeclarativeItem::top() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->anchorLines()->top;
}
/*!
\internal
*/
-QmlGraphicsAnchorLine QmlGraphicsItem::bottom() const
+QDeclarativeAnchorLine QDeclarativeItem::bottom() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->anchorLines()->bottom;
}
/*!
\internal
*/
-QmlGraphicsAnchorLine QmlGraphicsItem::verticalCenter() const
+QDeclarativeAnchorLine QDeclarativeItem::verticalCenter() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->anchorLines()->vCenter;
}
@@ -1846,39 +1857,39 @@ QmlGraphicsAnchorLine QmlGraphicsItem::verticalCenter() const
/*!
\internal
*/
-QmlGraphicsAnchorLine QmlGraphicsItem::baseline() const
+QDeclarativeAnchorLine QDeclarativeItem::baseline() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->anchorLines()->baseline;
}
/*!
- \property QmlGraphicsItem::top
+ \property QDeclarativeItem::top
\internal
*/
/*!
- \property QmlGraphicsItem::bottom
+ \property QDeclarativeItem::bottom
\internal
*/
/*!
- \property QmlGraphicsItem::left
+ \property QDeclarativeItem::left
\internal
*/
/*!
- \property QmlGraphicsItem::right
+ \property QDeclarativeItem::right
\internal
*/
/*!
- \property QmlGraphicsItem::horizontalCenter
+ \property QDeclarativeItem::horizontalCenter
\internal
*/
/*!
- \property QmlGraphicsItem::verticalCenter
+ \property QDeclarativeItem::verticalCenter
\internal
*/
@@ -1966,7 +1977,7 @@ QmlGraphicsAnchorLine QmlGraphicsItem::baseline() const
*/
/*!
- \property QmlGraphicsItem::baselineOffset
+ \property QDeclarativeItem::baselineOffset
\brief The position of the item's baseline in local coordinates.
The baseline of a Text item is the imaginary line on which the text
@@ -1975,18 +1986,18 @@ QmlGraphicsAnchorLine QmlGraphicsItem::baseline() const
For non-text items, a default baseline offset of 0 is used.
*/
-qreal QmlGraphicsItem::baselineOffset() const
+qreal QDeclarativeItem::baselineOffset() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
if (!d->_baselineOffset.isValid()) {
return 0.0;
} else
return d->_baselineOffset;
}
-void QmlGraphicsItem::setBaselineOffset(qreal offset)
+void QDeclarativeItem::setBaselineOffset(qreal offset)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
if (offset == d->_baselineOffset)
return;
@@ -1994,9 +2005,9 @@ void QmlGraphicsItem::setBaselineOffset(qreal offset)
emit baselineOffsetChanged();
for(int ii = 0; ii < d->changeListeners.count(); ++ii) {
- const QmlGraphicsItemPrivate::ChangeListener &change = d->changeListeners.at(ii);
- if (change.types & QmlGraphicsItemPrivate::Geometry) {
- QmlGraphicsAnchorsPrivate *anchor = change.listener->anchorPrivate();
+ const QDeclarativeItemPrivate::ChangeListener &change = d->changeListeners.at(ii);
+ if (change.types & QDeclarativeItemPrivate::Geometry) {
+ QDeclarativeAnchorsPrivate *anchor = change.listener->anchorPrivate();
if (anchor)
anchor->updateVerticalAnchors();
}
@@ -2116,9 +2127,9 @@ void QmlGraphicsItem::setBaselineOffset(qreal offset)
\sa setKeepMouseGrab()
*/
-bool QmlGraphicsItem::keepMouseGrab() const
+bool QDeclarativeItem::keepMouseGrab() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->_keepMouse;
}
@@ -2140,9 +2151,9 @@ bool QmlGraphicsItem::keepMouseGrab() const
\sa keepMouseGrab()
*/
-void QmlGraphicsItem::setKeepMouseGrab(bool keep)
+void QDeclarativeItem::setKeepMouseGrab(bool keep)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
d->_keepMouse = keep;
}
@@ -2154,26 +2165,26 @@ void QmlGraphicsItem::setKeepMouseGrab(bool keep)
Subclasses overriding this function should call up
to their base class.
*/
-void QmlGraphicsItem::focusChanged(bool flag)
+void QDeclarativeItem::focusChanged(bool flag)
{
Q_UNUSED(flag);
emit focusChanged();
}
/*! \internal */
-QmlListProperty<QmlGraphicsItem> QmlGraphicsItem::fxChildren()
+QDeclarativeListProperty<QDeclarativeItem> QDeclarativeItem::fxChildren()
{
- return QmlListProperty<QmlGraphicsItem>(this, 0, QmlGraphicsItemPrivate::children_append,
- QmlGraphicsItemPrivate::children_count,
- QmlGraphicsItemPrivate::children_at);
+ return QDeclarativeListProperty<QDeclarativeItem>(this, 0, QDeclarativeItemPrivate::children_append,
+ QDeclarativeItemPrivate::children_count,
+ QDeclarativeItemPrivate::children_at);
}
/*! \internal */
-QmlListProperty<QObject> QmlGraphicsItem::resources()
+QDeclarativeListProperty<QObject> QDeclarativeItem::resources()
{
- return QmlListProperty<QObject>(this, 0, QmlGraphicsItemPrivate::resources_append,
- QmlGraphicsItemPrivate::resources_count,
- QmlGraphicsItemPrivate::resources_at);
+ return QDeclarativeListProperty<QObject>(this, 0, QDeclarativeItemPrivate::resources_append,
+ QDeclarativeItemPrivate::resources_count,
+ QDeclarativeItemPrivate::resources_at);
}
/*!
@@ -2194,13 +2205,13 @@ QmlListProperty<QObject> QmlGraphicsItem::resources()
*/
/*!
- \property QmlGraphicsItem::states
+ \property QDeclarativeItem::states
\internal
*/
/*! \internal */
-QmlListProperty<QmlState> QmlGraphicsItem::states()
+QDeclarativeListProperty<QDeclarativeState> QDeclarativeItem::states()
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
return d->states()->statesProperty();
}
@@ -2222,14 +2233,14 @@ QmlListProperty<QmlState> QmlGraphicsItem::states()
*/
/*!
- \property QmlGraphicsItem::transitions
+ \property QDeclarativeItem::transitions
\internal
*/
/*! \internal */
-QmlListProperty<QmlTransition> QmlGraphicsItem::transitions()
+QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItem::transitions()
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
return d->states()->transitionsProperty();
}
@@ -2265,7 +2276,7 @@ QmlListProperty<QmlTransition> QmlGraphicsItem::transitions()
*/
/*!
- \property QmlGraphicsItem::clip
+ \property QDeclarativeItem::clip
This property holds whether clipping is enabled.
if clipping is enabled, an item will clip its own painting, as well
@@ -2301,14 +2312,14 @@ QmlListProperty<QmlTransition> QmlGraphicsItem::transitions()
*/
/*!
- \property QmlGraphicsItem::state
+ \property QDeclarativeItem::state
\internal
*/
/*! \internal */
-QString QmlGraphicsItem::state() const
+QString QDeclarativeItem::state() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
if (!d->_stateGroup)
return QString();
else
@@ -2316,9 +2327,9 @@ QString QmlGraphicsItem::state() const
}
/*! \internal */
-void QmlGraphicsItem::setState(const QString &state)
+void QDeclarativeItem::setState(const QString &state)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
d->states()->setState(state);
}
@@ -2330,15 +2341,15 @@ void QmlGraphicsItem::setState(const QString &state)
*/
/*!
- \property QmlGraphicsItem::transform
+ \property QDeclarativeItem::transform
\internal
*/
/*! \internal */
-QmlListProperty<QGraphicsTransform> QmlGraphicsItem::transform()
+QDeclarativeListProperty<QGraphicsTransform> QDeclarativeItem::transform()
{
- Q_D(QmlGraphicsItem);
- return QmlListProperty<QGraphicsTransform>(this, 0, d->transform_append, d->transform_count,
+ Q_D(QDeclarativeItem);
+ return QDeclarativeListProperty<QGraphicsTransform>(this, 0, d->transform_append, d->transform_count,
d->transform_at, d->transform_clear);
}
@@ -2350,9 +2361,9 @@ QmlListProperty<QGraphicsTransform> QmlGraphicsItem::transform()
\sa componentComplete(), isComponentComplete()
*/
-void QmlGraphicsItem::classBegin()
+void QDeclarativeItem::classBegin()
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
d->_componentComplete = false;
if (d->_stateGroup)
d->_stateGroup->classBegin();
@@ -2368,13 +2379,13 @@ void QmlGraphicsItem::classBegin()
processing until the component is complete an all bindings in the
component have been resolved.
*/
-void QmlGraphicsItem::componentComplete()
+void QDeclarativeItem::componentComplete()
{
#ifdef Q_ENABLE_PERFORMANCE_LOG
- QmlPerfTimer<QmlPerf::ItemComponentComplete> cc;
+ QDeclarativePerfTimer<QDeclarativePerf::ItemComponentComplete> cc;
#endif
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
d->_componentComplete = true;
if (d->_stateGroup)
d->_stateGroup->componentComplete();
@@ -2386,11 +2397,11 @@ void QmlGraphicsItem::componentComplete()
d->keyHandler->componentComplete();
}
-QmlStateGroup *QmlGraphicsItemPrivate::states()
+QDeclarativeStateGroup *QDeclarativeItemPrivate::states()
{
- Q_Q(QmlGraphicsItem);
+ Q_Q(QDeclarativeItem);
if (!_stateGroup) {
- _stateGroup = new QmlStateGroup;
+ _stateGroup = new QDeclarativeStateGroup;
if (!_componentComplete)
_stateGroup->classBegin();
QObject::connect(_stateGroup, SIGNAL(stateChanged(QString)),
@@ -2400,55 +2411,55 @@ QmlStateGroup *QmlGraphicsItemPrivate::states()
return _stateGroup;
}
-QmlGraphicsItemPrivate::AnchorLines::AnchorLines(QmlGraphicsItem *q)
+QDeclarativeItemPrivate::AnchorLines::AnchorLines(QDeclarativeItem *q)
{
left.item = q;
- left.anchorLine = QmlGraphicsAnchorLine::Left;
+ left.anchorLine = QDeclarativeAnchorLine::Left;
right.item = q;
- right.anchorLine = QmlGraphicsAnchorLine::Right;
+ right.anchorLine = QDeclarativeAnchorLine::Right;
hCenter.item = q;
- hCenter.anchorLine = QmlGraphicsAnchorLine::HCenter;
+ hCenter.anchorLine = QDeclarativeAnchorLine::HCenter;
top.item = q;
- top.anchorLine = QmlGraphicsAnchorLine::Top;
+ top.anchorLine = QDeclarativeAnchorLine::Top;
bottom.item = q;
- bottom.anchorLine = QmlGraphicsAnchorLine::Bottom;
+ bottom.anchorLine = QDeclarativeAnchorLine::Bottom;
vCenter.item = q;
- vCenter.anchorLine = QmlGraphicsAnchorLine::VCenter;
+ vCenter.anchorLine = QDeclarativeAnchorLine::VCenter;
baseline.item = q;
- baseline.anchorLine = QmlGraphicsAnchorLine::Baseline;
+ baseline.anchorLine = QDeclarativeAnchorLine::Baseline;
}
-QPointF QmlGraphicsItemPrivate::computeTransformOrigin() const
+QPointF QDeclarativeItemPrivate::computeTransformOrigin() const
{
- Q_Q(const QmlGraphicsItem);
+ Q_Q(const QDeclarativeItem);
QRectF br = q->boundingRect();
switch(origin) {
default:
- case QmlGraphicsItem::TopLeft:
+ case QDeclarativeItem::TopLeft:
return QPointF(0, 0);
- case QmlGraphicsItem::Top:
+ case QDeclarativeItem::Top:
return QPointF(br.width() / 2., 0);
- case QmlGraphicsItem::TopRight:
+ case QDeclarativeItem::TopRight:
return QPointF(br.width(), 0);
- case QmlGraphicsItem::Left:
+ case QDeclarativeItem::Left:
return QPointF(0, br.height() / 2.);
- case QmlGraphicsItem::Center:
+ case QDeclarativeItem::Center:
return QPointF(br.width() / 2., br.height() / 2.);
- case QmlGraphicsItem::Right:
+ case QDeclarativeItem::Right:
return QPointF(br.width(), br.height() / 2.);
- case QmlGraphicsItem::BottomLeft:
+ case QDeclarativeItem::BottomLeft:
return QPointF(0, br.height());
- case QmlGraphicsItem::Bottom:
+ case QDeclarativeItem::Bottom:
return QPointF(br.width() / 2., br.height());
- case QmlGraphicsItem::BottomRight:
+ case QDeclarativeItem::BottomRight:
return QPointF(br.width(), br.height());
}
}
/*! \internal */
-bool QmlGraphicsItem::sceneEvent(QEvent *event)
+bool QDeclarativeItem::sceneEvent(QEvent *event)
{
bool rv = QGraphicsItem::sceneEvent(event);
@@ -2461,10 +2472,10 @@ bool QmlGraphicsItem::sceneEvent(QEvent *event)
}
/*! \internal */
-QVariant QmlGraphicsItem::itemChange(GraphicsItemChange change,
+QVariant QDeclarativeItem::itemChange(GraphicsItemChange change,
const QVariant &value)
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
switch (change) {
case ItemParentHasChanged:
emit parentChanged();
@@ -2475,8 +2486,8 @@ QVariant QmlGraphicsItem::itemChange(GraphicsItemChange change,
break;
case ItemVisibleHasChanged: {
for(int ii = 0; ii < d->changeListeners.count(); ++ii) {
- const QmlGraphicsItemPrivate::ChangeListener &change = d->changeListeners.at(ii);
- if (change.types & QmlGraphicsItemPrivate::Visibility) {
+ const QDeclarativeItemPrivate::ChangeListener &change = d->changeListeners.at(ii);
+ if (change.types & QDeclarativeItemPrivate::Visibility) {
change.listener->itemVisibilityChanged(this);
}
}
@@ -2484,8 +2495,8 @@ QVariant QmlGraphicsItem::itemChange(GraphicsItemChange change,
break;
case ItemOpacityHasChanged: {
for(int ii = 0; ii < d->changeListeners.count(); ++ii) {
- const QmlGraphicsItemPrivate::ChangeListener &change = d->changeListeners.at(ii);
- if (change.types & QmlGraphicsItemPrivate::Opacity) {
+ const QDeclarativeItemPrivate::ChangeListener &change = d->changeListeners.at(ii);
+ if (change.types & QDeclarativeItemPrivate::Opacity) {
change.listener->itemOpacityChanged(this);
}
}
@@ -2499,14 +2510,14 @@ QVariant QmlGraphicsItem::itemChange(GraphicsItemChange change,
}
/*! \internal */
-QRectF QmlGraphicsItem::boundingRect() const
+QRectF QDeclarativeItem::boundingRect() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return QRectF(0, 0, d->width, d->height);
}
/*!
- \enum QmlGraphicsItem::TransformOrigin
+ \enum QDeclarativeItem::TransformOrigin
Controls the point about which simple transforms like scale apply.
@@ -2524,18 +2535,18 @@ QRectF QmlGraphicsItem::boundingRect() const
/*!
Returns the current transform origin.
*/
-QmlGraphicsItem::TransformOrigin QmlGraphicsItem::transformOrigin() const
+QDeclarativeItem::TransformOrigin QDeclarativeItem::transformOrigin() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->origin;
}
/*!
Set the transform \a origin.
*/
-void QmlGraphicsItem::setTransformOrigin(TransformOrigin origin)
+void QDeclarativeItem::setTransformOrigin(TransformOrigin origin)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
if (origin != d->origin) {
d->origin = origin;
QGraphicsItem::setTransformOriginPoint(d->computeTransformOrigin());
@@ -2544,7 +2555,7 @@ void QmlGraphicsItem::setTransformOrigin(TransformOrigin origin)
}
/*!
- \property QmlGraphicsItem::smooth
+ \property QDeclarativeItem::smooth
\brief whether the item is smoothly transformed.
This property is provided purely for the purpose of optimization. Turning
@@ -2562,9 +2573,9 @@ void QmlGraphicsItem::setTransformOrigin(TransformOrigin origin)
\sa setSmooth()
*/
-bool QmlGraphicsItem::smooth() const
+bool QDeclarativeItem::smooth() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->smooth;
}
@@ -2574,9 +2585,9 @@ bool QmlGraphicsItem::smooth() const
\sa smooth()
*/
-void QmlGraphicsItem::setSmooth(bool smooth)
+void QDeclarativeItem::setSmooth(bool smooth)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
if (d->smooth == smooth)
return;
d->smooth = smooth;
@@ -2584,15 +2595,15 @@ void QmlGraphicsItem::setSmooth(bool smooth)
update();
}
-qreal QmlGraphicsItem::width() const
+qreal QDeclarativeItem::width() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->width;
}
-void QmlGraphicsItem::setWidth(qreal w)
+void QDeclarativeItem::setWidth(qreal w)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
if (qIsNaN(w))
return;
@@ -2604,15 +2615,14 @@ void QmlGraphicsItem::setWidth(qreal w)
prepareGeometryChange();
d->width = w;
- update();
geometryChanged(QRectF(x(), y(), width(), height()),
QRectF(x(), y(), oldWidth, height()));
}
-void QmlGraphicsItem::resetWidth()
+void QDeclarativeItem::resetWidth()
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
d->widthValid = false;
setImplicitWidth(implicitWidth());
}
@@ -2620,9 +2630,9 @@ void QmlGraphicsItem::resetWidth()
/*!
Returns the width of the item that is implied by other properties that determine the content.
*/
-qreal QmlGraphicsItem::implicitWidth() const
+qreal QDeclarativeItem::implicitWidth() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->implicitWidth;
}
@@ -2630,9 +2640,9 @@ qreal QmlGraphicsItem::implicitWidth() const
Sets the implied width of the item to \a w.
This is the width implied by other properties that determine the content.
*/
-void QmlGraphicsItem::setImplicitWidth(qreal w)
+void QDeclarativeItem::setImplicitWidth(qreal w)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
d->implicitWidth = w;
if (d->width == w || widthValid())
return;
@@ -2641,7 +2651,6 @@ void QmlGraphicsItem::setImplicitWidth(qreal w)
prepareGeometryChange();
d->width = w;
- update();
geometryChanged(QRectF(x(), y(), width(), height()),
QRectF(x(), y(), oldWidth, height()));
@@ -2650,21 +2659,21 @@ void QmlGraphicsItem::setImplicitWidth(qreal w)
/*!
Returns whether the width property has been set explicitly.
*/
-bool QmlGraphicsItem::widthValid() const
+bool QDeclarativeItem::widthValid() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->widthValid;
}
-qreal QmlGraphicsItem::height() const
+qreal QDeclarativeItem::height() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->height;
}
-void QmlGraphicsItem::setHeight(qreal h)
+void QDeclarativeItem::setHeight(qreal h)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
if (qIsNaN(h))
return;
@@ -2676,15 +2685,14 @@ void QmlGraphicsItem::setHeight(qreal h)
prepareGeometryChange();
d->height = h;
- update();
geometryChanged(QRectF(x(), y(), width(), height()),
QRectF(x(), y(), width(), oldHeight));
}
-void QmlGraphicsItem::resetHeight()
+void QDeclarativeItem::resetHeight()
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
d->heightValid = false;
setImplicitHeight(implicitHeight());
}
@@ -2692,9 +2700,9 @@ void QmlGraphicsItem::resetHeight()
/*!
Returns the height of the item that is implied by other properties that determine the content.
*/
-qreal QmlGraphicsItem::implicitHeight() const
+qreal QDeclarativeItem::implicitHeight() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->implicitHeight;
}
@@ -2702,9 +2710,9 @@ qreal QmlGraphicsItem::implicitHeight() const
Sets the implied height of the item to \a h.
This is the height implied by other properties that determine the content.
*/
-void QmlGraphicsItem::setImplicitHeight(qreal h)
+void QDeclarativeItem::setImplicitHeight(qreal h)
{
- Q_D(QmlGraphicsItem);
+ Q_D(QDeclarativeItem);
d->implicitHeight = h;
if (d->height == h || heightValid())
return;
@@ -2713,7 +2721,6 @@ void QmlGraphicsItem::setImplicitHeight(qreal h)
prepareGeometryChange();
d->height = h;
- update();
geometryChanged(QRectF(x(), y(), width(), height()),
QRectF(x(), y(), width(), oldHeight));
@@ -2722,9 +2729,9 @@ void QmlGraphicsItem::setImplicitHeight(qreal h)
/*!
Returns whether the height property has been set explicitly.
*/
-bool QmlGraphicsItem::heightValid() const
+bool QDeclarativeItem::heightValid() const
{
- Q_D(const QmlGraphicsItem);
+ Q_D(const QDeclarativeItem);
return d->heightValid;
}
@@ -2737,7 +2744,7 @@ bool QmlGraphicsItem::heightValid() const
*/
/*! \internal */
-bool QmlGraphicsItem::wantsFocus() const
+bool QDeclarativeItem::wantsFocus() const
{
return focusItem() != 0;
}
@@ -2751,13 +2758,13 @@ bool QmlGraphicsItem::wantsFocus() const
*/
/*! \internal */
-bool QmlGraphicsItem::hasFocus() const
+bool QDeclarativeItem::hasFocus() const
{
return QGraphicsItem::hasFocus();
}
/*! \internal */
-void QmlGraphicsItem::setFocus(bool focus)
+void QDeclarativeItem::setFocus(bool focus)
{
if (focus)
QGraphicsItem::setFocus(Qt::OtherFocusReason);
@@ -2769,7 +2776,7 @@ void QmlGraphicsItem::setFocus(bool focus)
\reimp
\internal
*/
-void QmlGraphicsItem::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
+void QDeclarativeItem::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
{
}
@@ -2777,15 +2784,15 @@ void QmlGraphicsItem::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidge
\reimp
\internal
*/
-bool QmlGraphicsItem::event(QEvent *ev)
+bool QDeclarativeItem::event(QEvent *ev)
{
return QGraphicsObject::event(ev);
}
-QDebug operator<<(QDebug debug, QmlGraphicsItem *item)
+QDebug operator<<(QDebug debug, QDeclarativeItem *item)
{
if (!item) {
- debug << "QmlGraphicsItem(0)";
+ debug << "QDeclarativeItem(0)";
return debug;
}
@@ -2796,13 +2803,13 @@ QDebug operator<<(QDebug debug, QmlGraphicsItem *item)
return debug;
}
-int QmlGraphicsItemPrivate::consistentTime = -1;
-void QmlGraphicsItemPrivate::setConsistentTime(int t)
+int QDeclarativeItemPrivate::consistentTime = -1;
+void QDeclarativeItemPrivate::setConsistentTime(int t)
{
consistentTime = t;
}
-QTime QmlGraphicsItemPrivate::currentTime()
+QTime QDeclarativeItemPrivate::currentTime()
{
if (consistentTime == -1)
return QTime::currentTime();
@@ -2810,12 +2817,12 @@ QTime QmlGraphicsItemPrivate::currentTime()
return QTime(0, 0).addMSecs(consistentTime);
}
-void QmlGraphicsItemPrivate::start(QTime &t)
+void QDeclarativeItemPrivate::start(QTime &t)
{
t = currentTime();
}
-int QmlGraphicsItemPrivate::elapsed(QTime &t)
+int QDeclarativeItemPrivate::elapsed(QTime &t)
{
int n = t.msecsTo(currentTime());
if (n < 0) // passed midnight
@@ -2823,7 +2830,7 @@ int QmlGraphicsItemPrivate::elapsed(QTime &t)
return n;
}
-int QmlGraphicsItemPrivate::restart(QTime &t)
+int QDeclarativeItemPrivate::restart(QTime &t)
{
QTime time = currentTime();
int n = t.msecsTo(time);
@@ -2835,4 +2842,4 @@ int QmlGraphicsItemPrivate::restart(QTime &t)
QT_END_NAMESPACE
-#include <moc_qmlgraphicsitem.cpp>
+#include <moc_qdeclarativeitem.cpp>
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.h b/src/declarative/graphicsitems/qdeclarativeitem.h
index 891fc88..3ae404d 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitem.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem.h
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSITEM_H
-#define QMLGRAPHICSITEM_H
+#ifndef QDECLARATIVEITEM_H
+#define QDECLARATIVEITEM_H
-#include <qml.h>
-#include <qmlcomponent.h>
+#include <qdeclarative.h>
+#include <qdeclarativecomponent.h>
#include <QtCore/QObject>
#include <QtCore/QList>
@@ -58,40 +58,40 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlState;
-class QmlGraphicsAnchorLine;
-class QmlTransition;
-class QmlGraphicsKeyEvent;
-class QmlGraphicsAnchors;
-class QmlGraphicsItemPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsItem : public QGraphicsObject, public QmlParserStatus
+class QDeclarativeState;
+class QDeclarativeAnchorLine;
+class QDeclarativeTransition;
+class QDeclarativeKeyEvent;
+class QDeclarativeAnchors;
+class QDeclarativeItemPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeItem : public QGraphicsObject, public QDeclarativeParserStatus
{
Q_OBJECT
- Q_INTERFACES(QmlParserStatus)
-
- Q_PROPERTY(QmlGraphicsItem * parent READ parentItem WRITE setParentItem NOTIFY parentChanged DESIGNABLE false FINAL)
- 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_INTERFACES(QDeclarativeParserStatus)
+
+ Q_PROPERTY(QDeclarativeItem * parent READ parentItem WRITE setParentItem NOTIFY parentChanged DESIGNABLE false FINAL)
+ Q_PROPERTY(QDeclarativeListProperty<QObject> data READ data DESIGNABLE false)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeItem> children READ fxChildren DESIGNABLE false NOTIFY childrenChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QObject> resources READ resources DESIGNABLE false)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeState> states READ states DESIGNABLE false)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeTransition> 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)
Q_PROPERTY(QRectF childrenRect READ childrenRect NOTIFY childrenRectChanged DESIGNABLE false FINAL)
- Q_PROPERTY(QmlGraphicsAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL)
- Q_PROPERTY(QmlGraphicsAnchorLine left READ left CONSTANT FINAL)
- Q_PROPERTY(QmlGraphicsAnchorLine right READ right CONSTANT FINAL)
- Q_PROPERTY(QmlGraphicsAnchorLine horizontalCenter READ horizontalCenter CONSTANT FINAL)
- Q_PROPERTY(QmlGraphicsAnchorLine top READ top CONSTANT FINAL)
- Q_PROPERTY(QmlGraphicsAnchorLine bottom READ bottom CONSTANT FINAL)
- Q_PROPERTY(QmlGraphicsAnchorLine verticalCenter READ verticalCenter CONSTANT FINAL)
- Q_PROPERTY(QmlGraphicsAnchorLine baseline READ baseline CONSTANT FINAL)
+ Q_PROPERTY(QDeclarativeAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL)
+ Q_PROPERTY(QDeclarativeAnchorLine left READ left CONSTANT FINAL)
+ Q_PROPERTY(QDeclarativeAnchorLine right READ right CONSTANT FINAL)
+ Q_PROPERTY(QDeclarativeAnchorLine horizontalCenter READ horizontalCenter CONSTANT FINAL)
+ Q_PROPERTY(QDeclarativeAnchorLine top READ top CONSTANT FINAL)
+ Q_PROPERTY(QDeclarativeAnchorLine bottom READ bottom CONSTANT FINAL)
+ Q_PROPERTY(QDeclarativeAnchorLine verticalCenter READ verticalCenter CONSTANT FINAL)
+ Q_PROPERTY(QDeclarativeAnchorLine baseline READ baseline CONSTANT FINAL)
Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged)
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(QmlListProperty<QGraphicsTransform> transform READ transform DESIGNABLE false FINAL)
+ Q_PROPERTY(QDeclarativeListProperty<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 NOTIFY smoothChanged)
Q_PROPERTY(QGraphicsEffect *effect READ graphicsEffect WRITE setGraphicsEffect)
@@ -105,25 +105,25 @@ public:
BottomLeft, Bottom, BottomRight
};
- QmlGraphicsItem(QmlGraphicsItem *parent = 0);
- virtual ~QmlGraphicsItem();
+ QDeclarativeItem(QDeclarativeItem *parent = 0);
+ virtual ~QDeclarativeItem();
- QmlGraphicsItem *parentItem() const;
- void setParentItem(QmlGraphicsItem *parent);
- void setParent(QmlGraphicsItem *parent) { setParentItem(parent); }
+ QDeclarativeItem *parentItem() const;
+ void setParentItem(QDeclarativeItem *parent);
+ void setParent(QDeclarativeItem *parent) { setParentItem(parent); }
- QmlListProperty<QObject> data();
- QmlListProperty<QmlGraphicsItem> fxChildren();
- QmlListProperty<QObject> resources();
+ QDeclarativeListProperty<QObject> data();
+ QDeclarativeListProperty<QDeclarativeItem> fxChildren();
+ QDeclarativeListProperty<QObject> resources();
- QmlGraphicsAnchors *anchors();
+ QDeclarativeAnchors *anchors();
QRectF childrenRect();
bool clip() const;
void setClip(bool);
- QmlListProperty<QmlState> states();
- QmlListProperty<QmlTransition> transitions();
+ QDeclarativeListProperty<QDeclarativeState> states();
+ QDeclarativeListProperty<QDeclarativeTransition> transitions();
QString state() const;
void setState(const QString &);
@@ -131,7 +131,7 @@ public:
qreal baselineOffset() const;
void setBaselineOffset(qreal);
- QmlListProperty<QGraphicsTransform> transform();
+ QDeclarativeListProperty<QGraphicsTransform> transform();
qreal width() const;
void setWidth(qreal);
@@ -159,13 +159,13 @@ public:
bool keepMouseGrab() const;
void setKeepMouseGrab(bool);
- QmlGraphicsAnchorLine left() const;
- QmlGraphicsAnchorLine right() const;
- QmlGraphicsAnchorLine horizontalCenter() const;
- QmlGraphicsAnchorLine top() const;
- QmlGraphicsAnchorLine bottom() const;
- QmlGraphicsAnchorLine verticalCenter() const;
- QmlGraphicsAnchorLine baseline() const;
+ QDeclarativeAnchorLine left() const;
+ QDeclarativeAnchorLine right() const;
+ QDeclarativeAnchorLine horizontalCenter() const;
+ QDeclarativeAnchorLine top() const;
+ QDeclarativeAnchorLine bottom() const;
+ QDeclarativeAnchorLine verticalCenter() const;
+ QDeclarativeAnchorLine baseline() const;
Q_SIGNALS:
void widthChanged();
@@ -203,13 +203,13 @@ protected:
const QRectF &oldGeometry);
protected:
- QmlGraphicsItem(QmlGraphicsItemPrivate &dd, QmlGraphicsItem *parent = 0);
+ QDeclarativeItem(QDeclarativeItemPrivate &dd, QDeclarativeItem *parent = 0);
private:
- friend class QmlStatePrivate;
- friend class QmlGraphicsAnchors;
- Q_DISABLE_COPY(QmlGraphicsItem)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsItem)
+ friend class QDeclarativeStatePrivate;
+ friend class QDeclarativeAnchors;
+ Q_DISABLE_COPY(QDeclarativeItem)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeItem)
};
template<typename T>
@@ -228,11 +228,11 @@ T qobject_cast(QGraphicsItem *item)
return qobject_cast<T>(o);
}
-QDebug Q_DECLARATIVE_EXPORT operator<<(QDebug debug, QmlGraphicsItem *item);
+QDebug Q_DECLARATIVE_EXPORT operator<<(QDebug debug, QDeclarativeItem *item);
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsItem)
+QML_DECLARE_TYPE(QDeclarativeItem)
QML_DECLARE_TYPE(QGraphicsTransform)
QML_DECLARE_TYPE(QGraphicsScale)
QML_DECLARE_TYPE(QGraphicsRotation)
@@ -240,4 +240,4 @@ QML_DECLARE_TYPE(QAction)
QT_END_HEADER
-#endif // QMLGRAPHICSITEM_H
+#endif // QDECLARATIVEITEM_H
diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h
new file mode 100644
index 0000000..81c5688
--- /dev/null
+++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h
@@ -0,0 +1,471 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVEITEM_P_H
+#define QDECLARATIVEITEM_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 "qdeclarativeitem.h"
+
+#include "qdeclarativeanchors_p.h"
+#include "qdeclarativeanchors_p_p.h"
+#include "qdeclarativeitemchangelistener_p.h"
+#include <private/qpodvector_p.h>
+
+#include "../util/qdeclarativestate_p.h"
+#include "../util/qdeclarativenullablevalue_p_p.h"
+#include <qdeclarative.h>
+#include <qdeclarativecontext.h>
+
+#include <QtCore/qlist.h>
+#include <QtCore/qdebug.h>
+
+#include <private/qgraphicsitem_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QNetworkReply;
+class QDeclarativeItemKeyFilter;
+
+//### merge into private?
+class QDeclarativeContents : public QObject
+{
+ Q_OBJECT
+public:
+ QDeclarativeContents();
+
+ QRectF rectF() const;
+
+ void setItem(QDeclarativeItem *item);
+
+public Q_SLOTS:
+ void calcHeight();
+ void calcWidth();
+
+Q_SIGNALS:
+ void rectChanged();
+
+private:
+ QDeclarativeItem *m_item;
+ qreal m_x;
+ qreal m_y;
+ qreal m_width;
+ qreal m_height;
+};
+
+class QDeclarativeItemPrivate : public QGraphicsItemPrivate
+{
+ Q_DECLARE_PUBLIC(QDeclarativeItem)
+
+public:
+ QDeclarativeItemPrivate()
+ : _anchors(0), _contents(0),
+ _baselineOffset(0),
+ _anchorLines(0),
+ _stateGroup(0), origin(QDeclarativeItem::Center),
+ widthValid(false), heightValid(false),
+ _componentComplete(true), _keepMouse(false),
+ smooth(false), keyHandler(0),
+ width(0), height(0), implicitWidth(0), implicitHeight(0)
+ {
+ QGraphicsItemPrivate::acceptedMouseButtons = 0;
+ QGraphicsItemPrivate::flags = QGraphicsItem::GraphicsItemFlags(
+ QGraphicsItem::ItemHasNoContents
+ | QGraphicsItem::ItemIsFocusable
+ | QGraphicsItem::ItemNegativeZStacksBehindParent);
+
+ }
+
+ void init(QDeclarativeItem *parent)
+ {
+ Q_Q(QDeclarativeItem);
+
+ if (parent)
+ q->setParentItem(parent);
+ _baselineOffset.invalidate();
+ mouseSetsFocus = false;
+ }
+
+ QString _id;
+
+ // data property
+ static void data_append(QDeclarativeListProperty<QObject> *, QObject *);
+
+ // resources property
+ static QObject *resources_at(QDeclarativeListProperty<QObject> *, int);
+ static void resources_append(QDeclarativeListProperty<QObject> *, QObject *);
+ static int resources_count(QDeclarativeListProperty<QObject> *);
+
+ // children property
+ static QDeclarativeItem *children_at(QDeclarativeListProperty<QDeclarativeItem> *, int);
+ static void children_append(QDeclarativeListProperty<QDeclarativeItem> *, QDeclarativeItem *);
+ static int children_count(QDeclarativeListProperty<QDeclarativeItem> *);
+
+ // transform property
+ static int transform_count(QDeclarativeListProperty<QGraphicsTransform> *list);
+ static void transform_append(QDeclarativeListProperty<QGraphicsTransform> *list, QGraphicsTransform *);
+ static QGraphicsTransform *transform_at(QDeclarativeListProperty<QGraphicsTransform> *list, int);
+ static void transform_clear(QDeclarativeListProperty<QGraphicsTransform> *list);
+
+ QDeclarativeAnchors *anchors() {
+ if (!_anchors) {
+ Q_Q(QDeclarativeItem);
+ _anchors = new QDeclarativeAnchors(q);
+ if (!_componentComplete)
+ _anchors->classBegin();
+ }
+ return _anchors;
+ }
+ QDeclarativeAnchors *_anchors;
+ QDeclarativeContents *_contents;
+
+ QDeclarativeNullableValue<qreal> _baselineOffset;
+
+ struct AnchorLines {
+ AnchorLines(QDeclarativeItem *);
+ QDeclarativeAnchorLine left;
+ QDeclarativeAnchorLine right;
+ QDeclarativeAnchorLine hCenter;
+ QDeclarativeAnchorLine top;
+ QDeclarativeAnchorLine bottom;
+ QDeclarativeAnchorLine vCenter;
+ QDeclarativeAnchorLine baseline;
+ };
+ mutable AnchorLines *_anchorLines;
+ AnchorLines *anchorLines() const {
+ Q_Q(const QDeclarativeItem);
+ if (!_anchorLines) _anchorLines =
+ new AnchorLines(const_cast<QDeclarativeItem *>(q));
+ return _anchorLines;
+ }
+
+ enum ChangeType {
+ Geometry = 0x01,
+ SiblingOrder = 0x02,
+ Visibility = 0x04,
+ Opacity = 0x08,
+ Destroyed = 0x10
+ };
+
+ Q_DECLARE_FLAGS(ChangeTypes, ChangeType)
+
+ struct ChangeListener {
+ ChangeListener(QDeclarativeItemChangeListener *l, QDeclarativeItemPrivate::ChangeTypes t) : listener(l), types(t) {}
+ QDeclarativeItemChangeListener *listener;
+ QDeclarativeItemPrivate::ChangeTypes types;
+ bool operator==(const ChangeListener &other) const { return listener == other.listener && types == other.types; }
+ };
+
+ void addItemChangeListener(QDeclarativeItemChangeListener *listener, ChangeTypes types) {
+ changeListeners.append(ChangeListener(listener, types));
+ }
+ void removeItemChangeListener(QDeclarativeItemChangeListener *, ChangeTypes types);
+ QPODVector<ChangeListener,4> changeListeners;
+
+ QDeclarativeStateGroup *states();
+ QDeclarativeStateGroup *_stateGroup;
+
+ QDeclarativeItem::TransformOrigin origin:4;
+ bool widthValid:1;
+ bool heightValid:1;
+ bool _componentComplete:1;
+ bool _keepMouse:1;
+ bool smooth:1;
+
+ QDeclarativeItemKeyFilter *keyHandler;
+
+ qreal width;
+ qreal height;
+ qreal implicitWidth;
+ qreal implicitHeight;
+
+ QPointF computeTransformOrigin() const;
+
+ virtual void setPosHelper(const QPointF &pos)
+ {
+ Q_Q(QDeclarativeItem);
+ QRectF oldGeometry(this->pos.x(), this->pos.y(), width, height);
+ QGraphicsItemPrivate::setPosHelper(pos);
+ q->geometryChanged(QRectF(this->pos.x(), this->pos.y(), width, height), oldGeometry);
+ }
+
+ // Reimplemented from QGraphicsItemPrivate
+ virtual void subFocusItemChange()
+ {
+ emit q_func()->wantsFocusChanged();
+ }
+
+ // Reimplemented from QGraphicsItemPrivate
+ virtual void siblingOrderChange()
+ {
+ Q_Q(QDeclarativeItem);
+ for(int ii = 0; ii < changeListeners.count(); ++ii) {
+ const QDeclarativeItemPrivate::ChangeListener &change = changeListeners.at(ii);
+ if (change.types & QDeclarativeItemPrivate::SiblingOrder) {
+ change.listener->itemSiblingOrderChanged(q);
+ }
+ }
+ }
+
+ static int consistentTime;
+ static QTime currentTime();
+ static void Q_DECLARATIVE_EXPORT setConsistentTime(int t);
+ static void start(QTime &);
+ static int elapsed(QTime &);
+ static int restart(QTime &);
+};
+
+/*
+ Key filters can be installed on a QDeclarativeItem, but not removed. Currently they
+ are only used by attached objects (which are only destroyed on Item
+ destruction), so this isn't a problem. If in future this becomes any form
+ of public API, they will have to support removal too.
+*/
+class QDeclarativeItemKeyFilter
+{
+public:
+ QDeclarativeItemKeyFilter(QDeclarativeItem * = 0);
+ virtual ~QDeclarativeItemKeyFilter();
+
+ virtual void keyPressed(QKeyEvent *event);
+ virtual void keyReleased(QKeyEvent *event);
+ virtual void inputMethodEvent(QInputMethodEvent *event);
+ virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
+ virtual void componentComplete();
+
+private:
+ QDeclarativeItemKeyFilter *m_next;
+};
+
+class QDeclarativeKeyNavigationAttachedPrivate : public QObjectPrivate
+{
+public:
+ QDeclarativeKeyNavigationAttachedPrivate()
+ : QObjectPrivate(), left(0), right(0), up(0), down(0) {}
+
+ QDeclarativeItem *left;
+ QDeclarativeItem *right;
+ QDeclarativeItem *up;
+ QDeclarativeItem *down;
+};
+
+class QDeclarativeKeyNavigationAttached : public QObject, public QDeclarativeItemKeyFilter
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativeKeyNavigationAttached)
+
+ Q_PROPERTY(QDeclarativeItem *left READ left WRITE setLeft NOTIFY changed)
+ Q_PROPERTY(QDeclarativeItem *right READ right WRITE setRight NOTIFY changed)
+ Q_PROPERTY(QDeclarativeItem *up READ up WRITE setUp NOTIFY changed)
+ Q_PROPERTY(QDeclarativeItem *down READ down WRITE setDown NOTIFY changed)
+public:
+ QDeclarativeKeyNavigationAttached(QObject * = 0);
+
+ QDeclarativeItem *left() const;
+ void setLeft(QDeclarativeItem *);
+ QDeclarativeItem *right() const;
+ void setRight(QDeclarativeItem *);
+ QDeclarativeItem *up() const;
+ void setUp(QDeclarativeItem *);
+ QDeclarativeItem *down() const;
+ void setDown(QDeclarativeItem *);
+
+ static QDeclarativeKeyNavigationAttached *qmlAttachedProperties(QObject *);
+
+Q_SIGNALS:
+ void changed();
+
+private:
+ virtual void keyPressed(QKeyEvent *event);
+ virtual void keyReleased(QKeyEvent *event);
+};
+
+class QDeclarativeKeysAttachedPrivate : public QObjectPrivate
+{
+public:
+ QDeclarativeKeysAttachedPrivate()
+ : QObjectPrivate(), inPress(false), inRelease(false)
+ , inIM(false), enabled(true), imeItem(0), item(0)
+ {}
+
+ bool isConnected(const char *signalName);
+
+ QGraphicsItem *finalFocusProxy(QGraphicsItem *item) const
+ {
+ QGraphicsItem *fp;
+ while ((fp = item->focusProxy()))
+ item = fp;
+ return item;
+ }
+
+ //loop detection
+ bool inPress:1;
+ bool inRelease:1;
+ bool inIM:1;
+
+ bool enabled : 1;
+
+ QGraphicsItem *imeItem;
+ QList<QDeclarativeItem *> targets;
+ QDeclarativeItem *item;
+};
+
+class QDeclarativeKeysAttached : public QObject, public QDeclarativeItemKeyFilter
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativeKeysAttached)
+
+ Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeItem> forwardTo READ forwardTo)
+
+public:
+ QDeclarativeKeysAttached(QObject *parent=0);
+ ~QDeclarativeKeysAttached();
+
+ bool enabled() const { Q_D(const QDeclarativeKeysAttached); return d->enabled; }
+ void setEnabled(bool enabled) {
+ Q_D(QDeclarativeKeysAttached);
+ if (enabled != d->enabled) {
+ d->enabled = enabled;
+ emit enabledChanged();
+ }
+ }
+
+ QDeclarativeListProperty<QDeclarativeItem> forwardTo() {
+ Q_D(QDeclarativeKeysAttached);
+ return QDeclarativeListProperty<QDeclarativeItem>(this, d->targets);
+ }
+
+ virtual void componentComplete();
+
+ static QDeclarativeKeysAttached *qmlAttachedProperties(QObject *);
+
+Q_SIGNALS:
+ void enabledChanged();
+ void pressed(QDeclarativeKeyEvent *event);
+ void released(QDeclarativeKeyEvent *event);
+ void digit0Pressed(QDeclarativeKeyEvent *event);
+ void digit1Pressed(QDeclarativeKeyEvent *event);
+ void digit2Pressed(QDeclarativeKeyEvent *event);
+ void digit3Pressed(QDeclarativeKeyEvent *event);
+ void digit4Pressed(QDeclarativeKeyEvent *event);
+ void digit5Pressed(QDeclarativeKeyEvent *event);
+ void digit6Pressed(QDeclarativeKeyEvent *event);
+ void digit7Pressed(QDeclarativeKeyEvent *event);
+ void digit8Pressed(QDeclarativeKeyEvent *event);
+ void digit9Pressed(QDeclarativeKeyEvent *event);
+
+ void leftPressed(QDeclarativeKeyEvent *event);
+ void rightPressed(QDeclarativeKeyEvent *event);
+ void upPressed(QDeclarativeKeyEvent *event);
+ void downPressed(QDeclarativeKeyEvent *event);
+
+ void asteriskPressed(QDeclarativeKeyEvent *event);
+ void numberSignPressed(QDeclarativeKeyEvent *event);
+ void escapePressed(QDeclarativeKeyEvent *event);
+ void returnPressed(QDeclarativeKeyEvent *event);
+ void enterPressed(QDeclarativeKeyEvent *event);
+ void deletePressed(QDeclarativeKeyEvent *event);
+ void spacePressed(QDeclarativeKeyEvent *event);
+ void backPressed(QDeclarativeKeyEvent *event);
+ void cancelPressed(QDeclarativeKeyEvent *event);
+ void selectPressed(QDeclarativeKeyEvent *event);
+ void yesPressed(QDeclarativeKeyEvent *event);
+ void noPressed(QDeclarativeKeyEvent *event);
+ void context1Pressed(QDeclarativeKeyEvent *event);
+ void context2Pressed(QDeclarativeKeyEvent *event);
+ void context3Pressed(QDeclarativeKeyEvent *event);
+ void context4Pressed(QDeclarativeKeyEvent *event);
+ void callPressed(QDeclarativeKeyEvent *event);
+ void hangupPressed(QDeclarativeKeyEvent *event);
+ void flipPressed(QDeclarativeKeyEvent *event);
+ void menuPressed(QDeclarativeKeyEvent *event);
+ void volumeUpPressed(QDeclarativeKeyEvent *event);
+ void volumeDownPressed(QDeclarativeKeyEvent *event);
+
+private:
+ virtual void keyPressed(QKeyEvent *event);
+ virtual void keyReleased(QKeyEvent *event);
+ virtual void inputMethodEvent(QInputMethodEvent *);
+ virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
+
+ const QByteArray keyToSignal(int key) {
+ QByteArray keySignal;
+ if (key >= Qt::Key_0 && key <= Qt::Key_9) {
+ keySignal = "digit0Pressed";
+ keySignal[5] = '0' + (key - Qt::Key_0);
+ } else {
+ int i = 0;
+ while (sigMap[i].key && sigMap[i].key != key)
+ ++i;
+ keySignal = sigMap[i].sig;
+ }
+ return keySignal;
+ }
+
+ struct SigMap {
+ int key;
+ const char *sig;
+ };
+
+ static const SigMap sigMap[];
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeItemPrivate::ChangeTypes);
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QDeclarativeKeysAttached)
+QML_DECLARE_TYPEINFO(QDeclarativeKeysAttached, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPE(QDeclarativeKeyNavigationAttached)
+QML_DECLARE_TYPEINFO(QDeclarativeKeyNavigationAttached, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QDECLARATIVEITEM_P_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsitemchangelistener_p.h b/src/declarative/graphicsitems/qdeclarativeitemchangelistener_p.h
index a1c7b89..4da3bf7 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitemchangelistener_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitemchangelistener_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSITEMCHANGELISTENER
-#define QMLGRAPHICSITEMCHANGELISTENER
+#ifndef QDECLARATIVEITEMCHANGELISTENER
+#define QDECLARATIVEITEMCHANGELISTENER
//
// W A R N I N G
@@ -58,19 +58,19 @@
QT_BEGIN_NAMESPACE
class QRectF;
-class QmlGraphicsItem;
-class QmlGraphicsAnchorsPrivate;
-class QmlGraphicsItemChangeListener
+class QDeclarativeItem;
+class QDeclarativeAnchorsPrivate;
+class QDeclarativeItemChangeListener
{
public:
- virtual void itemGeometryChanged(QmlGraphicsItem *, const QRectF &, const QRectF &) {}
- virtual void itemSiblingOrderChanged(QmlGraphicsItem *) {}
- virtual void itemVisibilityChanged(QmlGraphicsItem *) {}
- virtual void itemOpacityChanged(QmlGraphicsItem *) {}
- virtual void itemDestroyed(QmlGraphicsItem *) {}
- virtual QmlGraphicsAnchorsPrivate *anchorPrivate() { return 0; }
+ virtual void itemGeometryChanged(QDeclarativeItem *, const QRectF &, const QRectF &) {}
+ virtual void itemSiblingOrderChanged(QDeclarativeItem *) {}
+ virtual void itemVisibilityChanged(QDeclarativeItem *) {}
+ virtual void itemOpacityChanged(QDeclarativeItem *) {}
+ virtual void itemDestroyed(QDeclarativeItem *) {}
+ virtual QDeclarativeAnchorsPrivate *anchorPrivate() { return 0; }
};
QT_END_NAMESPACE
-#endif // QMLGRAPHICSITEMCHANGELISTENER
+#endif // QDECLARATIVEITEMCHANGELISTENER
diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
new file mode 100644
index 0000000..f3b9385
--- /dev/null
+++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** 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 "qdeclarativeitemsmodule_p.h"
+
+#include <QtGui/qaction.h>
+#include <QtGui/qvalidator.h>
+#include <QtGui/qgraphicseffect.h>
+
+#include "qdeclarativeevents_p_p.h"
+#include "qdeclarativeeffects_p.h"
+#include "qdeclarativescalegrid_p_p.h"
+#include "qdeclarativeanimatedimage_p.h"
+#include "qdeclarativeborderimage_p.h"
+#include "qdeclarativepositioners_p.h"
+#include "qdeclarativemousearea_p.h"
+#include "qdeclarativeflickable_p.h"
+#include "qdeclarativeflickable_p_p.h"
+#include "qdeclarativeflipable_p.h"
+#include "qdeclarativefocuspanel_p.h"
+#include "qdeclarativefocusscope_p.h"
+#include "qdeclarativegraphicsobjectcontainer_p.h"
+#include "qdeclarativegridview_p.h"
+#include "qdeclarativeimage_p.h"
+#include "qdeclarativeitem_p.h"
+#include "qdeclarativelayoutitem_p.h"
+#include "qdeclarativelistview_p.h"
+#include "qdeclarativeloader_p.h"
+#include "qdeclarativemousearea_p.h"
+#include "qdeclarativeparticles_p.h"
+#include "qdeclarativepath_p.h"
+#include "qdeclarativepathview_p.h"
+#include "qdeclarativerectangle_p.h"
+#include "qdeclarativerepeater_p.h"
+#include "qdeclarativetext_p.h"
+#include "qdeclarativetextedit_p.h"
+#include "qdeclarativetextinput_p.h"
+#include "qdeclarativevisualitemmodel_p.h"
+#ifdef QT_WEBKIT_LIB
+#include "qdeclarativewebview_p.h"
+#include "qdeclarativewebview_p_p.h"
+#endif
+#include "qdeclarativeanchors_p.h"
+
+void QDeclarativeItemModule::defineModule()
+{
+ QML_REGISTER_TYPE(Qt,4,6,AnimatedImage,QDeclarativeAnimatedImage);
+ QML_REGISTER_TYPE(Qt,4,6,Blur,QGraphicsBlurEffect);
+ QML_REGISTER_TYPE(Qt,4,6,BorderImage,QDeclarativeBorderImage);
+ QML_REGISTER_TYPE(Qt,4,6,Colorize,QGraphicsColorizeEffect);
+ QML_REGISTER_TYPE(Qt,4,6,Column,QDeclarativeColumn);
+ QML_REGISTER_TYPE(Qt,4,6,Drag,QDeclarativeDrag);
+ QML_REGISTER_TYPE(Qt,4,6,DropShadow,QGraphicsDropShadowEffect);
+ QML_REGISTER_TYPE(Qt,4,6,Flickable,QDeclarativeFlickable);
+ QML_REGISTER_TYPE(Qt,4,6,Flipable,QDeclarativeFlipable);
+ QML_REGISTER_TYPE(Qt,4,6,Flow,QDeclarativeFlow);
+ QML_REGISTER_TYPE(Qt,4,6,FocusPanel,QDeclarativeFocusPanel);
+ QML_REGISTER_TYPE(Qt,4,6,FocusScope,QDeclarativeFocusScope);
+ QML_REGISTER_TYPE(Qt,4,6,Gradient,QDeclarativeGradient);
+ QML_REGISTER_TYPE(Qt,4,6,GradientStop,QDeclarativeGradientStop);
+ QML_REGISTER_TYPE(Qt,4,6,GraphicsObjectContainer,QDeclarativeGraphicsObjectContainer);
+ QML_REGISTER_TYPE(Qt,4,6,Grid,QDeclarativeGrid);
+ QML_REGISTER_TYPE(Qt,4,6,GridView,QDeclarativeGridView);
+ QML_REGISTER_TYPE(Qt,4,6,Image,QDeclarativeImage);
+ QML_REGISTER_TYPE(Qt,4,6,Item,QDeclarativeItem);
+ QML_REGISTER_TYPE(Qt,4,6,KeyNavigation,QDeclarativeKeyNavigationAttached);
+ QML_REGISTER_TYPE(Qt,4,6,Keys,QDeclarativeKeysAttached);
+ QML_REGISTER_TYPE(Qt,4,6,LayoutItem,QDeclarativeLayoutItem);
+ QML_REGISTER_TYPE(Qt,4,6,ListView,QDeclarativeListView);
+ QML_REGISTER_TYPE(Qt,4,6,Loader,QDeclarativeLoader);
+ QML_REGISTER_TYPE(Qt,4,6,MouseRegion,QDeclarativeMouseArea);
+ QML_REGISTER_TYPE(Qt,4,6,MouseArea,QDeclarativeMouseArea);
+ QML_REGISTER_TYPE(Qt,4,6,Opacity,QGraphicsOpacityEffect);
+ QML_REGISTER_TYPE(Qt,4,6,ParticleMotion,QDeclarativeParticleMotion);
+ QML_REGISTER_TYPE(Qt,4,6,ParticleMotionGravity,QDeclarativeParticleMotionGravity);
+ QML_REGISTER_TYPE(Qt,4,6,ParticleMotionLinear,QDeclarativeParticleMotionLinear);
+ QML_REGISTER_TYPE(Qt,4,6,ParticleMotionWander,QDeclarativeParticleMotionWander);
+ QML_REGISTER_TYPE(Qt,4,6,Particles,QDeclarativeParticles);
+ QML_REGISTER_TYPE(Qt,4,6,Path,QDeclarativePath);
+ QML_REGISTER_TYPE(Qt,4,6,PathAttribute,QDeclarativePathAttribute);
+ QML_REGISTER_TYPE(Qt,4,6,PathCubic,QDeclarativePathCubic);
+ QML_REGISTER_TYPE(Qt,4,6,PathLine,QDeclarativePathLine);
+ QML_REGISTER_TYPE(Qt,4,6,PathPercent,QDeclarativePathPercent);
+ QML_REGISTER_TYPE(Qt,4,6,PathQuad,QDeclarativePathQuad);
+ QML_REGISTER_TYPE(Qt,4,6,PathView,QDeclarativePathView);
+ QML_REGISTER_TYPE(Qt,4,6,Pen,QDeclarativePen);
+ QML_REGISTER_TYPE(Qt,4,6,QIntValidator,QIntValidator);
+#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0))
+ QML_REGISTER_TYPE(Qt,4,7,QDoubleValidator,QDoubleValidator);
+ QML_REGISTER_TYPE(Qt,4,7,QRegExpValidator,QRegExpValidator);
+#endif
+ QML_REGISTER_TYPE(Qt,4,6,Rectangle,QDeclarativeRectangle);
+ QML_REGISTER_TYPE(Qt,4,6,Repeater,QDeclarativeRepeater);
+ QML_REGISTER_TYPE(Qt,4,6,Rotation,QGraphicsRotation);
+ QML_REGISTER_TYPE(Qt,4,6,Row,QDeclarativeRow);
+ QML_REGISTER_TYPE(Qt,4,6,Scale,QGraphicsScale);
+ QML_REGISTER_TYPE(Qt,4,6,Text,QDeclarativeText);
+ QML_REGISTER_TYPE(Qt,4,6,TextEdit,QDeclarativeTextEdit);
+ QML_REGISTER_TYPE(Qt,4,6,TextInput,QDeclarativeTextInput);
+ QML_REGISTER_TYPE(Qt,4,6,ViewSection,QDeclarativeViewSection);
+ QML_REGISTER_TYPE(Qt,4,6,VisibleArea,QDeclarativeFlickableVisibleArea);
+ QML_REGISTER_TYPE(Qt,4,6,VisualDataModel,QDeclarativeVisualDataModel);
+ QML_REGISTER_TYPE(Qt,4,6,VisualItemModel,QDeclarativeVisualItemModel);
+#ifdef QT_WEBKIT_LIB
+ QML_REGISTER_TYPE(Qt,4,6,WebView,QDeclarativeWebView);
+#endif
+
+ QML_REGISTER_NOCREATE_TYPE(QDeclarativeAnchors);
+ QML_REGISTER_NOCREATE_TYPE(QGraphicsEffect);
+ QML_REGISTER_NOCREATE_TYPE(QDeclarativeKeyEvent);
+ QML_REGISTER_NOCREATE_TYPE(QDeclarativeMouseEvent);
+ QML_REGISTER_NOCREATE_TYPE(QGraphicsObject);
+ QML_REGISTER_NOCREATE_TYPE(QGraphicsTransform);
+ QML_REGISTER_NOCREATE_TYPE(QDeclarativePathElement);
+ QML_REGISTER_NOCREATE_TYPE(QDeclarativeCurve);
+ QML_REGISTER_NOCREATE_TYPE(QDeclarativeScaleGrid);
+ QML_REGISTER_NOCREATE_TYPE(QValidator);
+ QML_REGISTER_NOCREATE_TYPE(QDeclarativeVisualModel);
+ QML_REGISTER_NOCREATE_TYPE(QAction);
+#ifdef QT_WEBKIT_LIB
+ QML_REGISTER_NOCREATE_TYPE(QDeclarativeWebSettings);
+#endif
+}
diff --git a/src/declarative/graphicsitems/qmlgraphicsitemsmodule_p.h b/src/declarative/graphicsitems/qdeclarativeitemsmodule_p.h
index 76fea7e..5c49040 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitemsmodule_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSITEMMODULE_H
-#define QMLGRAPHICSITEMMODULE_H
+#ifndef QDECLARATIVEITEMMODULE_H
+#define QDECLARATIVEITEMMODULE_H
-#include <qml.h>
+#include <qdeclarative.h>
QT_BEGIN_HEADER
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsItemModule
+class QDeclarativeItemModule
{
public:
static void defineModule();
@@ -60,4 +60,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLGRAPHICSITEMMODULE_H
+#endif // QDECLARATIVEITEMMODULE_H
diff --git a/src/declarative/graphicsitems/qmlgraphicslayoutitem.cpp b/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp
index b55beda..a23ea65 100644
--- a/src/declarative/graphicsitems/qmlgraphicslayoutitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelayoutitem.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmlgraphicslayoutitem_p.h"
+#include "qdeclarativelayoutitem_p.h"
#include <QDebug>
@@ -48,7 +48,7 @@
QT_BEGIN_NAMESPACE
/*!
- \qmlclass LayoutItem QmlGraphicsLayoutItem
+ \qmlclass LayoutItem QDeclarativeLayoutItem
\since 4.7
\brief The LayoutItem element allows you to place your Fluid UI elements inside a classical Qt layout.
@@ -62,8 +62,8 @@ QT_BEGIN_NAMESPACE
/*!
\internal
- \class QmlGraphicsLayoutItem
- \brief The QmlGraphicsLayoutItem class allows you to place your Fluid UI elements inside a classical Qt layout.
+ \class QDeclarativeLayoutItem
+ \brief The QDeclarativeLayoutItem class allows you to place your Fluid UI elements inside a classical Qt layout.
*/
@@ -85,13 +85,13 @@ QT_BEGIN_NAMESPACE
The preferredSize property can be set to specify the preferred size of this LayoutItem
*/
-QmlGraphicsLayoutItem::QmlGraphicsLayoutItem(QmlGraphicsItem* parent)
- : QmlGraphicsItem(parent), m_maximumSize(INT_MAX,INT_MAX), m_minimumSize(0,0), m_preferredSize(0,0)
+QDeclarativeLayoutItem::QDeclarativeLayoutItem(QDeclarativeItem* parent)
+ : QDeclarativeItem(parent), m_maximumSize(INT_MAX,INT_MAX), m_minimumSize(0,0), m_preferredSize(0,0)
{
setGraphicsItem(this);
}
-void QmlGraphicsLayoutItem::setGeometry(const QRectF & rect)
+void QDeclarativeLayoutItem::setGeometry(const QRectF & rect)
{
setX(rect.x());
setY(rect.y());
@@ -99,7 +99,7 @@ void QmlGraphicsLayoutItem::setGeometry(const QRectF & rect)
setHeight(rect.height());
}
-QSizeF QmlGraphicsLayoutItem::sizeHint(Qt::SizeHint w, const QSizeF &constraint) const
+QSizeF QDeclarativeLayoutItem::sizeHint(Qt::SizeHint w, const QSizeF &constraint) const
{
Q_UNUSED(constraint);
if(w == Qt::MinimumSize){
diff --git a/src/declarative/graphicsitems/qmlgraphicslayoutitem_p.h b/src/declarative/graphicsitems/qdeclarativelayoutitem_p.h
index fbc891d..b35f2f5 100644
--- a/src/declarative/graphicsitems/qmlgraphicslayoutitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativelayoutitem_p.h
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSGRAPHICSLAYOUTITEM_H
-#define QMLGRAPHICSGRAPHICSLAYOUTITEM_H
-#include "qmlgraphicsitem.h"
+#ifndef QDECLARATIVEGRAPHICSLAYOUTITEM_H
+#define QDECLARATIVEGRAPHICSLAYOUTITEM_H
+#include "qdeclarativeitem.h"
#include <QGraphicsLayoutItem>
#include <QSizeF>
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsLayoutItem : public QmlGraphicsItem, public QGraphicsLayoutItem
+class QDeclarativeLayoutItem : public QDeclarativeItem, public QGraphicsLayoutItem
{
Q_OBJECT
Q_INTERFACES(QGraphicsLayoutItem)
@@ -60,7 +60,7 @@ class QmlGraphicsLayoutItem : public QmlGraphicsItem, public QGraphicsLayoutItem
Q_PROPERTY(QSizeF minimumSize READ minimumSize WRITE setMinimumSize NOTIFY minimumSizeChanged)
Q_PROPERTY(QSizeF preferredSize READ preferredSize WRITE setPreferredSize NOTIFY preferredSizeChanged)
public:
- QmlGraphicsLayoutItem(QmlGraphicsItem* parent=0);
+ QDeclarativeLayoutItem(QDeclarativeItem* parent=0);
QSizeF maximumSize() const { return m_maximumSize; }
void setMaximumSize(const QSizeF &s) { if(s==m_maximumSize) return; m_maximumSize = s; emit maximumSizeChanged(); }
@@ -88,7 +88,7 @@ private:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsLayoutItem)
+QML_DECLARE_TYPE(QDeclarativeLayoutItem)
QT_END_HEADER
#endif
diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 28b21c9..c496c97 100644
--- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -39,21 +39,21 @@
**
****************************************************************************/
-#include "qmlgraphicslistview_p.h"
+#include "qdeclarativelistview_p.h"
-#include "qmlgraphicsflickable_p_p.h"
-#include "qmlgraphicsvisualitemmodel_p.h"
+#include "qdeclarativeflickable_p_p.h"
+#include "qdeclarativevisualitemmodel_p.h"
-#include <qmleasefollow_p.h>
-#include <qmlexpression.h>
-#include <qmlengine.h>
+#include <qdeclarativeeasefollow_p.h>
+#include <qdeclarativeexpression.h>
+#include <qdeclarativeengine.h>
#include <qlistmodelinterface_p.h>
#include <QKeyEvent>
QT_BEGIN_NAMESPACE
-void QmlGraphicsViewSection::setProperty(const QString &property)
+void QDeclarativeViewSection::setProperty(const QString &property)
{
if (property != m_property) {
m_property = property;
@@ -61,7 +61,7 @@ void QmlGraphicsViewSection::setProperty(const QString &property)
}
}
-void QmlGraphicsViewSection::setCriteria(QmlGraphicsViewSection::SectionCriteria criteria)
+void QDeclarativeViewSection::setCriteria(QDeclarativeViewSection::SectionCriteria criteria)
{
if (criteria != m_criteria) {
m_criteria = criteria;
@@ -69,7 +69,7 @@ void QmlGraphicsViewSection::setCriteria(QmlGraphicsViewSection::SectionCriteria
}
}
-void QmlGraphicsViewSection::setDelegate(QmlComponent *delegate)
+void QDeclarativeViewSection::setDelegate(QDeclarativeComponent *delegate)
{
if (delegate != m_delegate) {
m_delegate = delegate;
@@ -77,7 +77,7 @@ void QmlGraphicsViewSection::setDelegate(QmlComponent *delegate)
}
}
-QString QmlGraphicsViewSection::sectionString(const QString &value)
+QString QDeclarativeViewSection::sectionString(const QString &value)
{
if (m_criteria == FirstCharacter)
return value.isEmpty() ? QString() : value.at(0);
@@ -90,31 +90,31 @@ QString QmlGraphicsViewSection::sectionString(const QString &value)
class FxListItem
{
public:
- FxListItem(QmlGraphicsItem *i, QmlGraphicsListView *v) : item(i), section(0), view(v) {
- attached = static_cast<QmlGraphicsListViewAttached*>(qmlAttachedPropertiesObject<QmlGraphicsListView>(item));
+ FxListItem(QDeclarativeItem *i, QDeclarativeListView *v) : item(i), section(0), view(v) {
+ attached = static_cast<QDeclarativeListViewAttached*>(qmlAttachedPropertiesObject<QDeclarativeListView>(item));
if (attached)
attached->m_view = view;
}
~FxListItem() {}
qreal position() const {
if (section)
- return (view->orientation() == QmlGraphicsListView::Vertical ? section->y() : section->x());
+ return (view->orientation() == QDeclarativeListView::Vertical ? section->y() : section->x());
else
- return (view->orientation() == QmlGraphicsListView::Vertical ? item->y() : item->x());
+ return (view->orientation() == QDeclarativeListView::Vertical ? item->y() : item->x());
}
int size() const {
if (section)
- return (view->orientation() == QmlGraphicsListView::Vertical ? item->height()+section->height() : item->width()+section->height());
+ return (view->orientation() == QDeclarativeListView::Vertical ? item->height()+section->height() : item->width()+section->height());
else
- return (view->orientation() == QmlGraphicsListView::Vertical ? item->height() : item->width());
+ return (view->orientation() == QDeclarativeListView::Vertical ? item->height() : item->width());
}
qreal endPosition() const {
- return (view->orientation() == QmlGraphicsListView::Vertical
+ return (view->orientation() == QDeclarativeListView::Vertical
? item->y() + (item->height() > 0 ? item->height() : 1)
: item->x() + (item->width() > 0 ? item->width() : 1)) - 1;
}
void setPosition(qreal pos) {
- if (view->orientation() == QmlGraphicsListView::Vertical) {
+ if (view->orientation() == QDeclarativeListView::Vertical) {
if (section) {
section->setY(pos);
pos += section->height();
@@ -129,30 +129,30 @@ public:
}
}
- QmlGraphicsItem *item;
- QmlGraphicsItem *section;
- QmlGraphicsListView *view;
- QmlGraphicsListViewAttached *attached;
+ QDeclarativeItem *item;
+ QDeclarativeItem *section;
+ QDeclarativeListView *view;
+ QDeclarativeListViewAttached *attached;
int index;
};
//----------------------------------------------------------------------------
-class QmlGraphicsListViewPrivate : public QmlGraphicsFlickablePrivate, private QmlGraphicsItemChangeListener
+class QDeclarativeListViewPrivate : public QDeclarativeFlickablePrivate, private QDeclarativeItemChangeListener
{
- Q_DECLARE_PUBLIC(QmlGraphicsListView)
+ Q_DECLARE_PUBLIC(QDeclarativeListView)
public:
- QmlGraphicsListViewPrivate()
- : currentItem(0), orient(QmlGraphicsListView::Vertical)
+ QDeclarativeListViewPrivate()
+ : currentItem(0), orient(QDeclarativeListView::Vertical)
, visiblePos(0), visibleIndex(0)
, averageSize(100.0), currentIndex(-1), requestedIndex(-1)
, highlightRangeStart(0), highlightRangeEnd(0)
, highlightComponent(0), highlight(0), trackedItem(0)
, moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0)
, sectionCriteria(0), spacing(0.0)
- , highlightMoveSpeed(400), highlightResizeSpeed(400), highlightRange(QmlGraphicsListView::NoHighlightRange)
- , snapMode(QmlGraphicsListView::NoSnap), overshootDist(0.0)
+ , highlightMoveSpeed(400), highlightResizeSpeed(400), highlightRange(QDeclarativeListView::NoHighlightRange)
+ , snapMode(QDeclarativeListView::NoSnap), overshootDist(0.0)
, footerComponent(0), footer(0), headerComponent(0), header(0)
, bufferMode(NoBuffer)
, ownModel(false), wrap(false), autoHighlight(true), haveHighlightRange(false)
@@ -202,19 +202,19 @@ public:
}
qreal position() const {
- Q_Q(const QmlGraphicsListView);
- return orient == QmlGraphicsListView::Vertical ? q->viewportY() : q->viewportX();
+ Q_Q(const QDeclarativeListView);
+ return orient == QDeclarativeListView::Vertical ? q->contentY() : q->contentX();
}
void setPosition(qreal pos) {
- Q_Q(QmlGraphicsListView);
- if (orient == QmlGraphicsListView::Vertical)
- q->setViewportY(pos);
+ Q_Q(QDeclarativeListView);
+ if (orient == QDeclarativeListView::Vertical)
+ q->setContentY(pos);
else
- q->setViewportX(pos);
+ q->setContentX(pos);
}
qreal size() const {
- Q_Q(const QmlGraphicsListView);
- return orient == QmlGraphicsListView::Vertical ? q->height() : q->width();
+ Q_Q(const QDeclarativeListView);
+ return orient == QDeclarativeListView::Vertical ? q->height() : q->width();
}
qreal startPosition() const {
@@ -380,16 +380,16 @@ public:
}
void updateViewport() {
- Q_Q(QmlGraphicsListView);
- if (orient == QmlGraphicsListView::Vertical) {
- q->setViewportHeight(endPosition() - startPosition() + 1);
+ Q_Q(QDeclarativeListView);
+ if (orient == QDeclarativeListView::Vertical) {
+ q->setContentHeight(endPosition() - startPosition() + 1);
} else {
- q->setViewportWidth(endPosition() - startPosition() + 1);
+ q->setContentWidth(endPosition() - startPosition() + 1);
}
}
- void itemGeometryChanged(QmlGraphicsItem *, const QRectF &newGeometry, const QRectF &oldGeometry) {
- if ((orient == QmlGraphicsListView::Vertical && newGeometry.height() != oldGeometry.height())
+ void itemGeometryChanged(QDeclarativeItem *, const QRectF &newGeometry, const QRectF &oldGeometry) {
+ if ((orient == QDeclarativeListView::Vertical && newGeometry.height() != oldGeometry.height())
|| newGeometry.width() != oldGeometry.width()) {
layout();
fixupPosition();
@@ -429,12 +429,12 @@ public:
virtual void flickX(qreal velocity);
virtual void flickY(qreal velocity);
- QGuard<QmlGraphicsVisualModel> model;
+ QGuard<QDeclarativeVisualModel> model;
QVariant modelVariant;
QList<FxListItem*> visibleItems;
- QHash<QmlGraphicsItem*,int> unrequestedItems;
+ QHash<QDeclarativeItem*,int> unrequestedItems;
FxListItem *currentItem;
- QmlGraphicsListView::Orientation orient;
+ QDeclarativeListView::Orientation orient;
int visiblePos;
int visibleIndex;
qreal averageSize;
@@ -442,27 +442,27 @@ public:
int requestedIndex;
qreal highlightRangeStart;
qreal highlightRangeEnd;
- QmlComponent *highlightComponent;
+ QDeclarativeComponent *highlightComponent;
FxListItem *highlight;
FxListItem *trackedItem;
enum MovementReason { Other, SetIndex, Mouse };
MovementReason moveReason;
int buffer;
- QmlEaseFollow *highlightPosAnimator;
- QmlEaseFollow *highlightSizeAnimator;
- QmlGraphicsViewSection *sectionCriteria;
+ QDeclarativeEaseFollow *highlightPosAnimator;
+ QDeclarativeEaseFollow *highlightSizeAnimator;
+ QDeclarativeViewSection *sectionCriteria;
QString currentSection;
static const int sectionCacheSize = 3;
- QmlGraphicsItem *sectionCache[sectionCacheSize];
+ QDeclarativeItem *sectionCache[sectionCacheSize];
qreal spacing;
qreal highlightMoveSpeed;
qreal highlightResizeSpeed;
- QmlGraphicsListView::HighlightRangeMode highlightRange;
- QmlGraphicsListView::SnapMode snapMode;
+ QDeclarativeListView::HighlightRangeMode highlightRange;
+ QDeclarativeListView::SnapMode snapMode;
qreal overshootDist;
- QmlComponent *footerComponent;
+ QDeclarativeComponent *footerComponent;
FxListItem *footer;
- QmlComponent *headerComponent;
+ QDeclarativeComponent *headerComponent;
FxListItem *header;
enum BufferMode { NoBuffer = 0x00, BufferBefore = 0x01, BufferAfter = 0x02 };
int bufferMode;
@@ -481,17 +481,17 @@ public:
mutable bool maxExtentDirty : 1;
};
-void QmlGraphicsListViewPrivate::init()
+void QDeclarativeListViewPrivate::init()
{
- Q_Q(QmlGraphicsListView);
+ Q_Q(QDeclarativeListView);
q->setFlag(QGraphicsItem::ItemIsFocusScope);
addItemChangeListener(this, Geometry);
QObject::connect(q, SIGNAL(movementEnded()), q, SLOT(animStopped()));
- q->setFlickDirection(QmlGraphicsFlickable::VerticalFlick);
- ::memset(sectionCache, 0, sizeof(QmlGraphicsItem*) * sectionCacheSize);
+ q->setFlickDirection(QDeclarativeFlickable::VerticalFlick);
+ ::memset(sectionCache, 0, sizeof(QDeclarativeItem*) * sectionCacheSize);
}
-void QmlGraphicsListViewPrivate::clear()
+void QDeclarativeListViewPrivate::clear()
{
for (int i = 0; i < visibleItems.count(); ++i)
releaseItem(visibleItems.at(i));
@@ -510,13 +510,13 @@ void QmlGraphicsListViewPrivate::clear()
maxExtentDirty = true;
}
-FxListItem *QmlGraphicsListViewPrivate::createItem(int modelIndex)
+FxListItem *QDeclarativeListViewPrivate::createItem(int modelIndex)
{
- Q_Q(QmlGraphicsListView);
+ Q_Q(QDeclarativeListView);
// create object
requestedIndex = modelIndex;
FxListItem *listItem = 0;
- if (QmlGraphicsItem *item = model->item(modelIndex, false)) {
+ if (QDeclarativeItem *item = model->item(modelIndex, false)) {
listItem = new FxListItem(item, q);
listItem->index = modelIndex;
// initialise attached properties
@@ -534,8 +534,8 @@ FxListItem *QmlGraphicsListViewPrivate::createItem(int modelIndex)
model->completeItem();
listItem->item->setZValue(1);
listItem->item->setParent(q->viewport());
- QmlGraphicsItemPrivate *itemPrivate = static_cast<QmlGraphicsItemPrivate*>(QGraphicsItemPrivate::get(item));
- itemPrivate->addItemChangeListener(this, QmlGraphicsItemPrivate::Geometry);
+ QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item));
+ itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
if (sectionCriteria && sectionCriteria->delegate()) {
if (listItem->attached->m_prevSection != listItem->attached->m_section)
createSection(listItem);
@@ -547,20 +547,20 @@ FxListItem *QmlGraphicsListViewPrivate::createItem(int modelIndex)
return listItem;
}
-void QmlGraphicsListViewPrivate::releaseItem(FxListItem *item)
+void QDeclarativeListViewPrivate::releaseItem(FxListItem *item)
{
- Q_Q(QmlGraphicsListView);
+ Q_Q(QDeclarativeListView);
if (!item || !model)
return;
if (trackedItem == item) {
- const char *notifier1 = orient == QmlGraphicsListView::Vertical ? SIGNAL(yChanged()) : SIGNAL(xChanged());
- const char *notifier2 = orient == QmlGraphicsListView::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged());
+ const char *notifier1 = orient == QDeclarativeListView::Vertical ? SIGNAL(yChanged()) : SIGNAL(xChanged());
+ const char *notifier2 = orient == QDeclarativeListView::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged());
QObject::disconnect(trackedItem->item, notifier1, q, SLOT(trackedPositionChanged()));
QObject::disconnect(trackedItem->item, notifier2, q, SLOT(trackedPositionChanged()));
trackedItem = 0;
}
- QmlGraphicsItemPrivate *itemPrivate = static_cast<QmlGraphicsItemPrivate*>(QGraphicsItemPrivate::get(item->item));
- itemPrivate->removeItemChangeListener(this, QmlGraphicsItemPrivate::Geometry);
+ QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item->item));
+ itemPrivate->removeItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
if (model->release(item->item) == 0) {
// item was not destroyed, and we no longer reference it.
unrequestedItems.insert(item->item, model->indexOf(item->item, q));
@@ -581,9 +581,9 @@ void QmlGraphicsListViewPrivate::releaseItem(FxListItem *item)
delete item;
}
-void QmlGraphicsListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
+void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
{
- Q_Q(QmlGraphicsListView);
+ Q_Q(QDeclarativeListView);
if (!isValid() || !q->isComponentComplete())
return;
qreal bufferFrom = from - buffer;
@@ -677,9 +677,9 @@ void QmlGraphicsListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
lazyRelease = false;
}
-void QmlGraphicsListViewPrivate::layout()
+void QDeclarativeListViewPrivate::layout()
{
- Q_Q(QmlGraphicsListView);
+ Q_Q(QDeclarativeListView);
updateSections();
if (!visibleItems.isEmpty()) {
int oldEnd = visibleItems.last()->endPosition();
@@ -708,23 +708,23 @@ void QmlGraphicsListViewPrivate::layout()
updateViewport();
}
-void QmlGraphicsListViewPrivate::updateUnrequestedIndexes()
+void QDeclarativeListViewPrivate::updateUnrequestedIndexes()
{
- Q_Q(QmlGraphicsListView);
- QHash<QmlGraphicsItem*,int>::iterator it;
+ Q_Q(QDeclarativeListView);
+ QHash<QDeclarativeItem*,int>::iterator it;
for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it)
*it = model->indexOf(it.key(), q);
}
-void QmlGraphicsListViewPrivate::updateUnrequestedPositions()
+void QDeclarativeListViewPrivate::updateUnrequestedPositions()
{
- Q_Q(QmlGraphicsListView);
+ Q_Q(QDeclarativeListView);
if (unrequestedItems.count()) {
qreal pos = position();
- QHash<QmlGraphicsItem*,int>::const_iterator it;
+ QHash<QDeclarativeItem*,int>::const_iterator it;
for (it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it) {
- QmlGraphicsItem *item = it.key();
- if (orient == QmlGraphicsListView::Vertical) {
+ QDeclarativeItem *item = it.key();
+ if (orient == QDeclarativeListView::Vertical) {
if (item->y() + item->height() > pos && item->y() < pos + q->height())
item->setY(positionAt(*it));
} else {
@@ -735,17 +735,17 @@ void QmlGraphicsListViewPrivate::updateUnrequestedPositions()
}
}
-void QmlGraphicsListViewPrivate::updateTrackedItem()
+void QDeclarativeListViewPrivate::updateTrackedItem()
{
- Q_Q(QmlGraphicsListView);
+ Q_Q(QDeclarativeListView);
FxListItem *item = currentItem;
if (highlight)
item = highlight;
FxListItem *oldTracked = trackedItem;
- const char *notifier1 = orient == QmlGraphicsListView::Vertical ? SIGNAL(yChanged()) : SIGNAL(xChanged());
- const char *notifier2 = orient == QmlGraphicsListView::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged());
+ const char *notifier1 = orient == QDeclarativeListView::Vertical ? SIGNAL(yChanged()) : SIGNAL(xChanged());
+ const char *notifier2 = orient == QDeclarativeListView::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged());
if (trackedItem && item != trackedItem) {
QObject::disconnect(trackedItem->item, notifier1, q, SLOT(trackedPositionChanged()));
@@ -762,9 +762,9 @@ void QmlGraphicsListViewPrivate::updateTrackedItem()
q->trackedPositionChanged();
}
-void QmlGraphicsListViewPrivate::createHighlight()
+void QDeclarativeListViewPrivate::createHighlight()
{
- Q_Q(QmlGraphicsListView);
+ Q_Q(QDeclarativeListView);
bool changed = false;
if (highlight) {
if (trackedItem == highlight)
@@ -780,37 +780,37 @@ void QmlGraphicsListViewPrivate::createHighlight()
}
if (currentItem) {
- QmlGraphicsItem *item = 0;
+ QDeclarativeItem *item = 0;
if (highlightComponent) {
- QmlContext *highlightContext = new QmlContext(qmlContext(q));
+ QDeclarativeContext *highlightContext = new QDeclarativeContext(qmlContext(q));
QObject *nobj = highlightComponent->create(highlightContext);
if (nobj) {
highlightContext->setParent(nobj);
- item = qobject_cast<QmlGraphicsItem *>(nobj);
+ item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item)
delete nobj;
} else {
delete highlightContext;
}
} else {
- item = new QmlGraphicsItem;
+ item = new QDeclarativeItem;
}
if (item) {
item->setParent(q->viewport());
highlight = new FxListItem(item, q);
- if (orient == QmlGraphicsListView::Vertical)
+ if (orient == QDeclarativeListView::Vertical)
highlight->item->setHeight(currentItem->item->height());
else
highlight->item->setWidth(currentItem->item->width());
- const QLatin1String posProp(orient == QmlGraphicsListView::Vertical ? "y" : "x");
- highlightPosAnimator = new QmlEaseFollow(q);
- highlightPosAnimator->setTarget(QmlMetaProperty(highlight->item, posProp));
+ const QLatin1String posProp(orient == QDeclarativeListView::Vertical ? "y" : "x");
+ highlightPosAnimator = new QDeclarativeEaseFollow(q);
+ highlightPosAnimator->setTarget(QDeclarativeProperty(highlight->item, posProp));
highlightPosAnimator->setVelocity(highlightMoveSpeed);
highlightPosAnimator->setEnabled(autoHighlight);
- const QLatin1String sizeProp(orient == QmlGraphicsListView::Vertical ? "height" : "width");
- highlightSizeAnimator = new QmlEaseFollow(q);
+ const QLatin1String sizeProp(orient == QDeclarativeListView::Vertical ? "height" : "width");
+ highlightSizeAnimator = new QDeclarativeEaseFollow(q);
highlightSizeAnimator->setVelocity(highlightResizeSpeed);
- highlightSizeAnimator->setTarget(QmlMetaProperty(highlight->item, sizeProp));
+ highlightSizeAnimator->setTarget(QDeclarativeProperty(highlight->item, sizeProp));
highlightSizeAnimator->setEnabled(autoHighlight);
changed = true;
}
@@ -819,7 +819,7 @@ void QmlGraphicsListViewPrivate::createHighlight()
emit q->highlightChanged();
}
-void QmlGraphicsListViewPrivate::updateHighlight()
+void QDeclarativeListViewPrivate::updateHighlight()
{
if ((!currentItem && highlight) || (currentItem && !highlight))
createHighlight();
@@ -827,7 +827,7 @@ void QmlGraphicsListViewPrivate::updateHighlight()
// auto-update highlight
highlightPosAnimator->setSourceValue(currentItem->position());
highlightSizeAnimator->setSourceValue(currentItem->size());
- if (orient == QmlGraphicsListView::Vertical) {
+ if (orient == QDeclarativeListView::Vertical) {
if (highlight->item->width() == 0)
highlight->item->setWidth(currentItem->item->width());
} else {
@@ -838,9 +838,9 @@ void QmlGraphicsListViewPrivate::updateHighlight()
updateTrackedItem();
}
-void QmlGraphicsListViewPrivate::createSection(FxListItem *listItem)
+void QDeclarativeListViewPrivate::createSection(FxListItem *listItem)
{
- Q_Q(QmlGraphicsListView);
+ Q_Q(QDeclarativeListView);
if (!sectionCriteria || !sectionCriteria->delegate())
return;
if (listItem->attached->m_prevSection != listItem->attached->m_section) {
@@ -852,15 +852,15 @@ void QmlGraphicsListViewPrivate::createSection(FxListItem *listItem)
listItem->section = sectionCache[i];
sectionCache[i] = 0;
listItem->section->setVisible(true);
- QmlContext *context = QmlEngine::contextForObject(listItem->section)->parentContext();
+ QDeclarativeContext *context = QDeclarativeEngine::contextForObject(listItem->section)->parentContext();
context->setContextProperty(QLatin1String("section"), listItem->attached->m_section);
} else {
- QmlContext *context = new QmlContext(qmlContext(q));
+ QDeclarativeContext *context = new QDeclarativeContext(qmlContext(q));
context->setContextProperty(QLatin1String("section"), listItem->attached->m_section);
QObject *nobj = sectionCriteria->delegate()->create(context);
if (nobj) {
context->setParent(nobj);
- listItem->section = qobject_cast<QmlGraphicsItem *>(nobj);
+ listItem->section = qobject_cast<QDeclarativeItem *>(nobj);
if (!listItem->section) {
delete nobj;
} else {
@@ -888,7 +888,7 @@ void QmlGraphicsListViewPrivate::createSection(FxListItem *listItem)
}
}
-void QmlGraphicsListViewPrivate::updateSections()
+void QDeclarativeListViewPrivate::updateSections()
{
if (sectionCriteria) {
QString prevSection;
@@ -896,7 +896,7 @@ void QmlGraphicsListViewPrivate::updateSections()
prevSection = sectionAt(visibleIndex-1);
for (int i = 0; i < visibleItems.count(); ++i) {
if (visibleItems.at(i)->index != -1) {
- QmlGraphicsListViewAttached *attached = visibleItems.at(i)->attached;
+ QDeclarativeListViewAttached *attached = visibleItems.at(i)->attached;
attached->setPrevSection(prevSection);
createSection(visibleItems.at(i));
prevSection = attached->section();
@@ -905,7 +905,7 @@ void QmlGraphicsListViewPrivate::updateSections()
}
}
-void QmlGraphicsListViewPrivate::updateCurrentSection()
+void QDeclarativeListViewPrivate::updateCurrentSection()
{
if (!sectionCriteria || visibleItems.isEmpty()) {
currentSection = QString();
@@ -921,9 +921,9 @@ void QmlGraphicsListViewPrivate::updateCurrentSection()
currentSection = visibleItems.first()->attached->section();
}
-void QmlGraphicsListViewPrivate::updateCurrent(int modelIndex)
+void QDeclarativeListViewPrivate::updateCurrent(int modelIndex)
{
- Q_Q(QmlGraphicsListView);
+ Q_Q(QDeclarativeListView);
if (!q->isComponentComplete() || !isValid() || modelIndex < 0 || modelIndex >= model->count()) {
if (currentItem) {
currentItem->attached->setIsCurrentItem(false);
@@ -963,7 +963,7 @@ void QmlGraphicsListViewPrivate::updateCurrent(int modelIndex)
releaseItem(oldCurrentItem);
}
-void QmlGraphicsListViewPrivate::updateAverage()
+void QDeclarativeListViewPrivate::updateAverage()
{
if (!visibleItems.count())
return;
@@ -973,16 +973,16 @@ void QmlGraphicsListViewPrivate::updateAverage()
averageSize = sum / visibleItems.count();
}
-void QmlGraphicsListViewPrivate::updateFooter()
+void QDeclarativeListViewPrivate::updateFooter()
{
- Q_Q(QmlGraphicsListView);
+ Q_Q(QDeclarativeListView);
if (!footer && footerComponent) {
- QmlGraphicsItem *item = 0;
- QmlContext *context = new QmlContext(qmlContext(q));
+ QDeclarativeItem *item = 0;
+ QDeclarativeContext *context = new QDeclarativeContext(qmlContext(q));
QObject *nobj = footerComponent->create(context);
if (nobj) {
context->setParent(nobj);
- item = qobject_cast<QmlGraphicsItem *>(nobj);
+ item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item)
delete nobj;
} else {
@@ -1010,16 +1010,16 @@ void QmlGraphicsListViewPrivate::updateFooter()
}
}
-void QmlGraphicsListViewPrivate::updateHeader()
+void QDeclarativeListViewPrivate::updateHeader()
{
- Q_Q(QmlGraphicsListView);
+ Q_Q(QDeclarativeListView);
if (!header && headerComponent) {
- QmlGraphicsItem *item = 0;
- QmlContext *context = new QmlContext(qmlContext(q));
+ QDeclarativeItem *item = 0;
+ QDeclarativeContext *context = new QDeclarativeContext(qmlContext(q));
QObject *nobj = headerComponent->create(context);
if (nobj) {
context->setParent(nobj);
- item = qobject_cast<QmlGraphicsItem *>(nobj);
+ item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item)
delete nobj;
} else {
@@ -1048,19 +1048,19 @@ void QmlGraphicsListViewPrivate::updateHeader()
}
}
-void QmlGraphicsListViewPrivate::fixupPosition()
+void QDeclarativeListViewPrivate::fixupPosition()
{
moveReason = Other;
- if (orient == QmlGraphicsListView::Vertical)
+ if (orient == QDeclarativeListView::Vertical)
fixupY();
else
fixupX();
}
-void QmlGraphicsListViewPrivate::fixupY()
+void QDeclarativeListViewPrivate::fixupY()
{
- Q_Q(QmlGraphicsListView);
- if (orient == QmlGraphicsListView::Horizontal)
+ Q_Q(QDeclarativeListView);
+ if (orient == QDeclarativeListView::Horizontal)
return;
if (!q->yflick() || _moveY.timeLine())
return;
@@ -1068,39 +1068,39 @@ void QmlGraphicsListViewPrivate::fixupY()
int oldDuration = fixupDuration;
fixupDuration = moveReason == Mouse ? fixupDuration : 0;
- if (haveHighlightRange && highlightRange == QmlGraphicsListView::StrictlyEnforceRange) {
+ if (haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange) {
if (currentItem && currentItem->position() - position() != highlightRangeStart) {
qreal pos = currentItem->position() - highlightRangeStart;
timeline.reset(_moveY);
if (fixupDuration)
- timeline.move(_moveY, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
+ timeline.move(_moveY, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2);
else
_moveY.setValue(-pos);
vTime = timeline.time();
}
- } else if (snapMode != QmlGraphicsListView::NoSnap) {
+ } else if (snapMode != QDeclarativeListView::NoSnap) {
if (FxListItem *item = snapItemAt(position())) {
qreal pos = qMin(item->position() - highlightRangeStart, -q->maxYExtent());
qreal dist = qAbs(_moveY + pos);
if (dist > 0) {
timeline.reset(_moveY);
if (fixupDuration)
- timeline.move(_moveY, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration);
+ timeline.move(_moveY, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2);
else
_moveY.setValue(-pos);
vTime = timeline.time();
}
}
} else {
- QmlGraphicsFlickablePrivate::fixupY();
+ QDeclarativeFlickablePrivate::fixupY();
}
fixupDuration = oldDuration;
}
-void QmlGraphicsListViewPrivate::fixupX()
+void QDeclarativeListViewPrivate::fixupX()
{
- Q_Q(QmlGraphicsListView);
- if (orient == QmlGraphicsListView::Vertical)
+ Q_Q(QDeclarativeListView);
+ if (orient == QDeclarativeListView::Vertical)
return;
if (!q->xflick() || _moveX.timeLine())
return;
@@ -1108,7 +1108,7 @@ void QmlGraphicsListViewPrivate::fixupX()
int oldDuration = fixupDuration;
fixupDuration = moveReason == Mouse ? fixupDuration : 0;
- if (haveHighlightRange && highlightRange == QmlGraphicsListView::StrictlyEnforceRange) {
+ if (haveHighlightRange && highlightRange == QDeclarativeListView::StrictlyEnforceRange) {
if (currentItem && currentItem->position() - position() != highlightRangeStart) {
qreal pos = currentItem->position() - highlightRangeStart;
timeline.reset(_moveX);
@@ -1118,7 +1118,7 @@ void QmlGraphicsListViewPrivate::fixupX()
_moveX.setValue(-pos);
vTime = timeline.time();
}
- } else if (snapMode != QmlGraphicsListView::NoSnap) {
+ } else if (snapMode != QDeclarativeListView::NoSnap) {
if (FxListItem *item = snapItemAt(position())) {
qreal pos = qMin(item->position() - highlightRangeStart, -q->maxXExtent());
qreal dist = qAbs(_moveX + pos);
@@ -1132,18 +1132,18 @@ void QmlGraphicsListViewPrivate::fixupX()
}
}
} else {
- QmlGraphicsFlickablePrivate::fixupX();
+ QDeclarativeFlickablePrivate::fixupX();
}
fixupDuration = oldDuration;
}
-void QmlGraphicsListViewPrivate::flickX(qreal velocity)
+void QDeclarativeListViewPrivate::flickX(qreal velocity)
{
- Q_Q(QmlGraphicsListView);
+ Q_Q(QDeclarativeListView);
moveReason = Mouse;
- if ((!haveHighlightRange || highlightRange != QmlGraphicsListView::StrictlyEnforceRange) && snapMode == QmlGraphicsListView::NoSnap) {
- QmlGraphicsFlickablePrivate::flickX(velocity);
+ if ((!haveHighlightRange || highlightRange != QDeclarativeListView::StrictlyEnforceRange) && snapMode == QDeclarativeListView::NoSnap) {
+ QDeclarativeFlickablePrivate::flickX(velocity);
return;
}
qreal maxDistance = -1;
@@ -1151,25 +1151,25 @@ void QmlGraphicsListViewPrivate::flickX(qreal velocity)
const qreal minX = q->minXExtent();
// -ve velocity means list is moving up
if (velocity > 0) {
- if (snapMode == QmlGraphicsListView::SnapOneItem) {
+ if (snapMode == QDeclarativeListView::SnapOneItem) {
if (FxListItem *item = firstVisibleItem())
maxDistance = qAbs(item->position() + _moveX.value());
} else if (_moveX.value() < minX) {
- maxDistance = qAbs(minX -_moveX.value() + (overShoot?30:0));
+ maxDistance = qAbs(minX -_moveX.value() + (overShoot?overShootDistance(velocity, q->width()):0));
}
- if (snapMode != QmlGraphicsListView::SnapToItem && highlightRange != QmlGraphicsListView::StrictlyEnforceRange)
+ if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange)
flickTargetX = minX;
} else {
- if (snapMode == QmlGraphicsListView::SnapOneItem) {
+ if (snapMode == QDeclarativeListView::SnapOneItem) {
if (FxListItem *item = nextVisibleItem())
maxDistance = qAbs(item->position() + _moveX.value());
} else if (_moveX.value() > maxX) {
- maxDistance = qAbs(maxX - _moveX.value()) + (overShoot?30:0);
+ maxDistance = qAbs(maxX - _moveX.value()) + (overShoot?overShootDistance(velocity, q->width()):0);
}
- if (snapMode != QmlGraphicsListView::SnapToItem && highlightRange != QmlGraphicsListView::StrictlyEnforceRange)
+ if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange)
flickTargetX = maxX;
}
- if (maxDistance > 0 && (snapMode != QmlGraphicsListView::NoSnap || highlightRange == QmlGraphicsListView::StrictlyEnforceRange)) {
+ if (maxDistance > 0 && (snapMode != QDeclarativeListView::NoSnap || highlightRange == QDeclarativeListView::StrictlyEnforceRange)) {
// These modes require the list to stop exactly on an item boundary.
// The initial flick will estimate the boundary to stop on.
// Since list items can have variable sizes, the boundary will be
@@ -1196,11 +1196,11 @@ void QmlGraphicsListViewPrivate::flickX(qreal velocity)
overshootDist = 0.0;
} else {
flickTargetX = velocity > 0 ? minX : maxX;
- overshootDist = overShoot ? 30 : 0;
+ overshootDist = overShoot ? overShootDistance(v, q->width()) : 0;
}
timeline.reset(_moveX);
timeline.accel(_moveX, v, accel, maxDistance + overshootDist);
- timeline.callback(QmlTimeLineCallback(&_moveX, fixupX_callback, this));
+ timeline.callback(QDeclarativeTimeLineCallback(&_moveX, fixupX_callback, this));
flicked = true;
emit q->flickingChanged();
emit q->flickStarted();
@@ -1208,7 +1208,7 @@ void QmlGraphicsListViewPrivate::flickX(qreal velocity)
} else {
// reevaluate the target boundary.
qreal newtarget = flickTargetX;
- if (snapMode != QmlGraphicsListView::NoSnap || highlightRange == QmlGraphicsListView::StrictlyEnforceRange)
+ if (snapMode != QDeclarativeListView::NoSnap || highlightRange == QDeclarativeListView::StrictlyEnforceRange)
newtarget = -snapPosAt(-(flickTargetX - highlightRangeStart)) + highlightRangeStart;
if (velocity < 0 && newtarget < maxX)
newtarget = maxX;
@@ -1226,7 +1226,7 @@ void QmlGraphicsListViewPrivate::flickX(qreal velocity)
}
timeline.reset(_moveX);
timeline.accelDistance(_moveX, v, -dist + (v < 0 ? -overshootDist : overshootDist));
- timeline.callback(QmlTimeLineCallback(&_moveX, fixupX_callback, this));
+ timeline.callback(QDeclarativeTimeLineCallback(&_moveX, fixupX_callback, this));
}
} else {
correctFlick = false;
@@ -1235,13 +1235,13 @@ void QmlGraphicsListViewPrivate::flickX(qreal velocity)
}
}
-void QmlGraphicsListViewPrivate::flickY(qreal velocity)
+void QDeclarativeListViewPrivate::flickY(qreal velocity)
{
- Q_Q(QmlGraphicsListView);
+ Q_Q(QDeclarativeListView);
moveReason = Mouse;
- if ((!haveHighlightRange || highlightRange != QmlGraphicsListView::StrictlyEnforceRange) && snapMode == QmlGraphicsListView::NoSnap) {
- QmlGraphicsFlickablePrivate::flickY(velocity);
+ if ((!haveHighlightRange || highlightRange != QDeclarativeListView::StrictlyEnforceRange) && snapMode == QDeclarativeListView::NoSnap) {
+ QDeclarativeFlickablePrivate::flickY(velocity);
return;
}
qreal maxDistance = -1;
@@ -1249,25 +1249,25 @@ void QmlGraphicsListViewPrivate::flickY(qreal velocity)
const qreal minY = q->minYExtent();
// -ve velocity means list is moving up
if (velocity > 0) {
- if (snapMode == QmlGraphicsListView::SnapOneItem) {
+ if (snapMode == QDeclarativeListView::SnapOneItem) {
if (FxListItem *item = firstVisibleItem())
maxDistance = qAbs(item->position() + _moveY.value());
} else if (_moveY.value() < minY) {
- maxDistance = qAbs(minY -_moveY.value() + (overShoot?30:0));
+ maxDistance = qAbs(minY -_moveY.value() + (overShoot?overShootDistance(velocity, q->height()):0));
}
- if (snapMode != QmlGraphicsListView::SnapToItem && highlightRange != QmlGraphicsListView::StrictlyEnforceRange)
+ if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange)
flickTargetY = minY;
} else {
- if (snapMode == QmlGraphicsListView::SnapOneItem) {
+ if (snapMode == QDeclarativeListView::SnapOneItem) {
if (FxListItem *item = nextVisibleItem())
maxDistance = qAbs(item->position() + _moveY.value());
} else if (_moveY.value() > maxY) {
- maxDistance = qAbs(maxY - _moveY.value()) + (overShoot?30:0);
+ maxDistance = qAbs(maxY - _moveY.value()) + (overShoot?overShootDistance(velocity, q->height()):0);
}
- if (snapMode != QmlGraphicsListView::SnapToItem && highlightRange != QmlGraphicsListView::StrictlyEnforceRange)
+ if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange)
flickTargetY = maxY;
}
- if (maxDistance > 0 && (snapMode != QmlGraphicsListView::NoSnap || highlightRange == QmlGraphicsListView::StrictlyEnforceRange)) {
+ if (maxDistance > 0 && (snapMode != QDeclarativeListView::NoSnap || highlightRange == QDeclarativeListView::StrictlyEnforceRange)) {
// These modes require the list to stop exactly on an item boundary.
// The initial flick will estimate the boundary to stop on.
// Since list items can have variable sizes, the boundary will be
@@ -1294,11 +1294,11 @@ void QmlGraphicsListViewPrivate::flickY(qreal velocity)
overshootDist = 0.0;
} else {
flickTargetY = velocity > 0 ? minY : maxY;
- overshootDist = overShoot ? 30 : 0;
+ overshootDist = overShoot ? overShootDistance(v, q->height()) : 0;
}
timeline.reset(_moveY);
timeline.accel(_moveY, v, accel, maxDistance + overshootDist);
- timeline.callback(QmlTimeLineCallback(&_moveY, fixupY_callback, this));
+ timeline.callback(QDeclarativeTimeLineCallback(&_moveY, fixupY_callback, this));
flicked = true;
emit q->flickingChanged();
emit q->flickStarted();
@@ -1306,7 +1306,7 @@ void QmlGraphicsListViewPrivate::flickY(qreal velocity)
} else {
// reevaluate the target boundary.
qreal newtarget = flickTargetY;
- if (snapMode != QmlGraphicsListView::NoSnap || highlightRange == QmlGraphicsListView::StrictlyEnforceRange)
+ if (snapMode != QDeclarativeListView::NoSnap || highlightRange == QDeclarativeListView::StrictlyEnforceRange)
newtarget = -snapPosAt(-(flickTargetY - highlightRangeStart)) + highlightRangeStart;
if (velocity < 0 && newtarget < maxY)
newtarget = maxY;
@@ -1324,7 +1324,7 @@ void QmlGraphicsListViewPrivate::flickY(qreal velocity)
}
timeline.reset(_moveY);
timeline.accelDistance(_moveY, v, -dist + (v < 0 ? -overshootDist : overshootDist));
- timeline.callback(QmlTimeLineCallback(&_moveY, fixupY_callback, this));
+ timeline.callback(QDeclarativeTimeLineCallback(&_moveY, fixupY_callback, this));
}
} else {
correctFlick = false;
@@ -1336,7 +1336,7 @@ void QmlGraphicsListViewPrivate::flickY(qreal velocity)
//----------------------------------------------------------------------------
/*!
- \qmlclass ListView QmlGraphicsListView
+ \qmlclass ListView QDeclarativeListView
\since 4.7
\inherits Flickable
\brief The ListView item provides a list view of items provided by a model.
@@ -1360,16 +1360,16 @@ void QmlGraphicsListViewPrivate::flickY(qreal velocity)
the model would be implemented in C++, or perhaps via a SQL data source.
*/
-QmlGraphicsListView::QmlGraphicsListView(QmlGraphicsItem *parent)
- : QmlGraphicsFlickable(*(new QmlGraphicsListViewPrivate), parent)
+QDeclarativeListView::QDeclarativeListView(QDeclarativeItem *parent)
+ : QDeclarativeFlickable(*(new QDeclarativeListViewPrivate), parent)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
d->init();
}
-QmlGraphicsListView::~QmlGraphicsListView()
+QDeclarativeListView::~QDeclarativeListView()
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
d->clear();
if (d->ownModel)
delete d->model;
@@ -1464,27 +1464,28 @@ QmlGraphicsListView::~QmlGraphicsListView()
\sa {qmlmodels}{Data Models}
*/
-QVariant QmlGraphicsListView::model() const
+QVariant QDeclarativeListView::model() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->modelVariant;
}
-void QmlGraphicsListView::setModel(const QVariant &model)
+void QDeclarativeListView::setModel(const QVariant &model)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (d->model) {
disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int)));
- disconnect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*)));
- disconnect(d->model, SIGNAL(destroyingItem(QmlGraphicsItem*)), this, SLOT(destroyingItem(QmlGraphicsItem*)));
+ disconnect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset()));
+ disconnect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*)));
+ disconnect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*)));
}
d->clear();
d->modelVariant = model;
QObject *object = qvariant_cast<QObject*>(model);
- QmlGraphicsVisualModel *vim = 0;
- if (object && (vim = qobject_cast<QmlGraphicsVisualModel *>(object))) {
+ QDeclarativeVisualModel *vim = 0;
+ if (object && (vim = qobject_cast<QDeclarativeVisualModel *>(object))) {
if (d->ownModel) {
delete d->model;
d->ownModel = false;
@@ -1492,10 +1493,10 @@ void QmlGraphicsListView::setModel(const QVariant &model)
d->model = vim;
} else {
if (!d->ownModel) {
- d->model = new QmlGraphicsVisualDataModel(qmlContext(this));
+ d->model = new QDeclarativeVisualDataModel(qmlContext(this));
d->ownModel = true;
}
- if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model))
+ if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model))
dataModel->setModel(model);
}
if (d->model) {
@@ -1504,15 +1505,16 @@ void QmlGraphicsListView::setModel(const QVariant &model)
if (d->currentIndex >= d->model->count() || d->currentIndex < 0) {
setCurrentIndex(0);
} else {
- d->moveReason = QmlGraphicsListViewPrivate::SetIndex;
+ d->moveReason = QDeclarativeListViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
}
}
connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int)));
- connect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*)));
- connect(d->model, SIGNAL(destroyingItem(QmlGraphicsItem*)), this, SLOT(destroyingItem(QmlGraphicsItem*)));
+ connect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset()));
+ connect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*)));
+ connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*)));
emit countChanged();
}
}
@@ -1530,34 +1532,34 @@ void QmlGraphicsListView::setModel(const QVariant &model)
Here is an example delegate:
\snippet doc/src/snippets/declarative/listview/listview.qml 0
*/
-QmlComponent *QmlGraphicsListView::delegate() const
+QDeclarativeComponent *QDeclarativeListView::delegate() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
if (d->model) {
- if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model))
+ if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model))
return dataModel->delegate();
}
return 0;
}
-void QmlGraphicsListView::setDelegate(QmlComponent *delegate)
+void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (delegate == this->delegate())
return;
if (!d->ownModel) {
- d->model = new QmlGraphicsVisualDataModel(qmlContext(this));
+ d->model = new QDeclarativeVisualDataModel(qmlContext(this));
d->ownModel = true;
}
- if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model)) {
+ if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model)) {
dataModel->setDelegate(delegate);
if (isComponentComplete()) {
for (int i = 0; i < d->visibleItems.count(); ++i)
d->releaseItem(d->visibleItems.at(i));
d->visibleItems.clear();
refill();
- d->moveReason = QmlGraphicsListViewPrivate::SetIndex;
+ d->moveReason = QDeclarativeListViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
}
}
@@ -1571,17 +1573,19 @@ void QmlGraphicsListView::setDelegate(QmlComponent *delegate)
\c currentItem is the current item. Note that the position of the current item
may only be approximate until it becomes visible in the view.
*/
-int QmlGraphicsListView::currentIndex() const
+int QDeclarativeListView::currentIndex() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->currentIndex;
}
-void QmlGraphicsListView::setCurrentIndex(int index)
+void QDeclarativeListView::setCurrentIndex(int index)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
+ if (d->requestedIndex >= 0) // currently creating item
+ return;
if (isComponentComplete() && d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) {
- d->moveReason = QmlGraphicsListViewPrivate::SetIndex;
+ d->moveReason = QDeclarativeListViewPrivate::SetIndex;
cancelFlick();
d->updateCurrent(index);
} else {
@@ -1589,9 +1593,9 @@ void QmlGraphicsListView::setCurrentIndex(int index)
}
}
-QmlGraphicsItem *QmlGraphicsListView::currentItem()
+QDeclarativeItem *QDeclarativeListView::currentItem()
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (!d->currentItem)
return 0;
return d->currentItem->item;
@@ -1608,9 +1612,9 @@ QmlGraphicsItem *QmlGraphicsListView::currentItem()
\sa highlight, highlightFollowsCurrentItem
*/
-QmlGraphicsItem *QmlGraphicsListView::highlightItem()
+QDeclarativeItem *QDeclarativeListView::highlightItem()
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (!d->highlight)
return 0;
return d->highlight->item;
@@ -1620,9 +1624,9 @@ QmlGraphicsItem *QmlGraphicsListView::highlightItem()
\qmlproperty int ListView::count
This property holds the number of items in the view.
*/
-int QmlGraphicsListView::count() const
+int QDeclarativeListView::count() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
if (d->model)
return d->model->count();
return 0;
@@ -1645,15 +1649,15 @@ int QmlGraphicsListView::count() const
\sa highlightItem, highlightFollowsCurrentItem
*/
-QmlComponent *QmlGraphicsListView::highlight() const
+QDeclarativeComponent *QDeclarativeListView::highlight() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->highlightComponent;
}
-void QmlGraphicsListView::setHighlight(QmlComponent *highlight)
+void QDeclarativeListView::setHighlight(QDeclarativeComponent *highlight)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (highlight != d->highlightComponent) {
d->highlightComponent = highlight;
d->createHighlight();
@@ -1680,15 +1684,15 @@ void QmlGraphicsListView::setHighlight(QmlComponent *highlight)
\sa highlight, highlightMoveSpeed
*/
-bool QmlGraphicsListView::highlightFollowsCurrentItem() const
+bool QDeclarativeListView::highlightFollowsCurrentItem() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->autoHighlight;
}
-void QmlGraphicsListView::setHighlightFollowsCurrentItem(bool autoHighlight)
+void QDeclarativeListView::setHighlightFollowsCurrentItem(bool autoHighlight)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (d->autoHighlight != autoHighlight) {
d->autoHighlight = autoHighlight;
if (d->highlightPosAnimator) {
@@ -1732,41 +1736,41 @@ void QmlGraphicsListView::setHighlightFollowsCurrentItem(bool autoHighlight)
Note that a valid range requires preferredHighlightEnd to be greater
than or equal to preferredHighlightBegin.
*/
-qreal QmlGraphicsListView::preferredHighlightBegin() const
+qreal QDeclarativeListView::preferredHighlightBegin() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->highlightRangeStart;
}
-void QmlGraphicsListView::setPreferredHighlightBegin(qreal start)
+void QDeclarativeListView::setPreferredHighlightBegin(qreal start)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
d->highlightRangeStart = start;
d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd;
}
-qreal QmlGraphicsListView::preferredHighlightEnd() const
+qreal QDeclarativeListView::preferredHighlightEnd() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->highlightRangeEnd;
}
-void QmlGraphicsListView::setPreferredHighlightEnd(qreal end)
+void QDeclarativeListView::setPreferredHighlightEnd(qreal end)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
d->highlightRangeEnd = end;
d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd;
}
-QmlGraphicsListView::HighlightRangeMode QmlGraphicsListView::highlightRangeMode() const
+QDeclarativeListView::HighlightRangeMode QDeclarativeListView::highlightRangeMode() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->highlightRange;
}
-void QmlGraphicsListView::setHighlightRangeMode(HighlightRangeMode mode)
+void QDeclarativeListView::setHighlightRangeMode(HighlightRangeMode mode)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
d->highlightRange = mode;
d->haveHighlightRange = d->highlightRange != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd;
}
@@ -1776,15 +1780,15 @@ void QmlGraphicsListView::setHighlightRangeMode(HighlightRangeMode mode)
This property holds the spacing to leave between items.
*/
-qreal QmlGraphicsListView::spacing() const
+qreal QDeclarativeListView::spacing() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->spacing;
}
-void QmlGraphicsListView::setSpacing(qreal spacing)
+void QDeclarativeListView::setSpacing(qreal spacing)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (spacing != d->spacing) {
d->spacing = spacing;
d->layout();
@@ -1803,22 +1807,22 @@ void QmlGraphicsListView::setSpacing(qreal spacing)
Horizontal Example:
\image ListViewHorizontal.png
*/
-QmlGraphicsListView::Orientation QmlGraphicsListView::orientation() const
+QDeclarativeListView::Orientation QDeclarativeListView::orientation() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->orient;
}
-void QmlGraphicsListView::setOrientation(QmlGraphicsListView::Orientation orientation)
+void QDeclarativeListView::setOrientation(QDeclarativeListView::Orientation orientation)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (d->orient != orientation) {
d->orient = orientation;
- if (d->orient == QmlGraphicsListView::Vertical) {
- setViewportWidth(-1);
+ if (d->orient == QDeclarativeListView::Vertical) {
+ setContentWidth(-1);
setFlickDirection(VerticalFlick);
} else {
- setViewportHeight(-1);
+ setContentHeight(-1);
setFlickDirection(HorizontalFlick);
}
d->clear();
@@ -1835,15 +1839,15 @@ void QmlGraphicsListView::setOrientation(QmlGraphicsListView::Orientation orient
If this property is true then key presses to move off of one end of the list will cause the
current item to jump to the other end.
*/
-bool QmlGraphicsListView::isWrapEnabled() const
+bool QDeclarativeListView::isWrapEnabled() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->wrap;
}
-void QmlGraphicsListView::setWrapEnabled(bool wrap)
+void QDeclarativeListView::setWrapEnabled(bool wrap)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
d->wrap = wrap;
}
@@ -1855,19 +1859,19 @@ void QmlGraphicsListView::setWrapEnabled(bool wrap)
and below the bottom of the list to cache. Setting this value can make
scrolling the list smoother at the expense of additional memory usage.
*/
-int QmlGraphicsListView::cacheBuffer() const
+int QDeclarativeListView::cacheBuffer() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->buffer;
}
-void QmlGraphicsListView::setCacheBuffer(int b)
+void QDeclarativeListView::setCacheBuffer(int b)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (d->buffer != b) {
d->buffer = b;
if (isComponentComplete()) {
- d->bufferMode = QmlGraphicsListViewPrivate::BufferBefore | QmlGraphicsListViewPrivate::BufferAfter;
+ d->bufferMode = QDeclarativeListViewPrivate::BufferBefore | QDeclarativeListViewPrivate::BufferAfter;
refill();
}
}
@@ -1898,11 +1902,11 @@ void QmlGraphicsListView::setCacheBuffer(int b)
\image ListViewSections.png
*/
-QmlGraphicsViewSection *QmlGraphicsListView::sectionCriteria()
+QDeclarativeViewSection *QDeclarativeListView::sectionCriteria()
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (!d->sectionCriteria)
- d->sectionCriteria = new QmlGraphicsViewSection(this);
+ d->sectionCriteria = new QDeclarativeViewSection(this);
return d->sectionCriteria;
}
@@ -1910,9 +1914,9 @@ QmlGraphicsViewSection *QmlGraphicsListView::sectionCriteria()
\qmlproperty string ListView::currentSection
This property holds the section that is currently at the beginning of the view.
*/
-QString QmlGraphicsListView::currentSection() const
+QString QDeclarativeListView::currentSection() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->currentSection;
}
@@ -1928,15 +1932,15 @@ QString QmlGraphicsListView::currentSection() const
\sa highlightFollowsCurrentItem
*/
-qreal QmlGraphicsListView::highlightMoveSpeed() const
+qreal QDeclarativeListView::highlightMoveSpeed() const
{
- Q_D(const QmlGraphicsListView);\
+ Q_D(const QDeclarativeListView);\
return d->highlightMoveSpeed;
}
-void QmlGraphicsListView::setHighlightMoveSpeed(qreal speed)
+void QDeclarativeListView::setHighlightMoveSpeed(qreal speed)
{
- Q_D(QmlGraphicsListView);\
+ Q_D(QDeclarativeListView);\
if (d->highlightMoveSpeed != speed) {
d->highlightMoveSpeed = speed;
if (d->highlightPosAnimator)
@@ -1945,15 +1949,15 @@ void QmlGraphicsListView::setHighlightMoveSpeed(qreal speed)
}
}
-qreal QmlGraphicsListView::highlightResizeSpeed() const
+qreal QDeclarativeListView::highlightResizeSpeed() const
{
- Q_D(const QmlGraphicsListView);\
+ Q_D(const QDeclarativeListView);\
return d->highlightResizeSpeed;
}
-void QmlGraphicsListView::setHighlightResizeSpeed(qreal speed)
+void QDeclarativeListView::setHighlightResizeSpeed(qreal speed)
{
- Q_D(QmlGraphicsListView);\
+ Q_D(QDeclarativeListView);\
if (d->highlightResizeSpeed != speed) {
d->highlightResizeSpeed = speed;
if (d->highlightSizeAnimator)
@@ -1977,29 +1981,29 @@ void QmlGraphicsListView::setHighlightResizeSpeed(qreal speed)
useful for moving one page at a time.
\endlist
*/
-QmlGraphicsListView::SnapMode QmlGraphicsListView::snapMode() const
+QDeclarativeListView::SnapMode QDeclarativeListView::snapMode() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->snapMode;
}
-void QmlGraphicsListView::setSnapMode(SnapMode mode)
+void QDeclarativeListView::setSnapMode(SnapMode mode)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (d->snapMode != mode) {
d->snapMode = mode;
}
}
-QmlComponent *QmlGraphicsListView::footer() const
+QDeclarativeComponent *QDeclarativeListView::footer() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->footerComponent;
}
-void QmlGraphicsListView::setFooter(QmlComponent *footer)
+void QDeclarativeListView::setFooter(QDeclarativeComponent *footer)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (d->footerComponent != footer) {
if (d->footer) {
delete d->footer;
@@ -2013,15 +2017,15 @@ void QmlGraphicsListView::setFooter(QmlComponent *footer)
}
}
-QmlComponent *QmlGraphicsListView::header() const
+QDeclarativeComponent *QDeclarativeListView::header() const
{
- Q_D(const QmlGraphicsListView);
+ Q_D(const QDeclarativeListView);
return d->headerComponent;
}
-void QmlGraphicsListView::setHeader(QmlComponent *header)
+void QDeclarativeListView::setHeader(QDeclarativeComponent *header)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (d->headerComponent != header) {
if (d->header) {
delete d->header;
@@ -2036,15 +2040,15 @@ void QmlGraphicsListView::setHeader(QmlComponent *header)
}
}
-void QmlGraphicsListView::viewportMoved()
+void QDeclarativeListView::viewportMoved()
{
- Q_D(QmlGraphicsListView);
- QmlGraphicsFlickable::viewportMoved();
+ Q_D(QDeclarativeListView);
+ QDeclarativeFlickable::viewportMoved();
d->lazyRelease = true;
refill();
if (isFlicking() || d->moving)
- d->moveReason = QmlGraphicsListViewPrivate::Mouse;
- if (d->moveReason != QmlGraphicsListViewPrivate::SetIndex) {
+ d->moveReason = QDeclarativeListViewPrivate::Mouse;
+ if (d->moveReason != QDeclarativeListViewPrivate::SetIndex) {
if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange && d->highlight) {
// reposition highlight
qreal pos = d->highlight->position();
@@ -2071,13 +2075,13 @@ void QmlGraphicsListView::viewportMoved()
if ((minY - d->_moveY.value() < height()/2 || d->flickTargetY - d->_moveY.value() < height()/2)
&& minY != d->flickTargetY)
d->flickY(-d->verticalVelocity.value());
- d->bufferMode = QmlGraphicsListViewPrivate::BufferBefore;
+ d->bufferMode = QDeclarativeListViewPrivate::BufferBefore;
} else if (d->velocityY < 0) {
const qreal maxY = maxYExtent();
if ((d->_moveY.value() - maxY < height()/2 || d->_moveY.value() - d->flickTargetY < height()/2)
&& maxY != d->flickTargetY)
d->flickY(-d->verticalVelocity.value());
- d->bufferMode = QmlGraphicsListViewPrivate::BufferAfter;
+ d->bufferMode = QDeclarativeListViewPrivate::BufferAfter;
}
}
@@ -2087,24 +2091,24 @@ void QmlGraphicsListView::viewportMoved()
if ((minX - d->_moveX.value() < height()/2 || d->flickTargetX - d->_moveX.value() < height()/2)
&& minX != d->flickTargetX)
d->flickX(-d->horizontalVelocity.value());
- d->bufferMode = QmlGraphicsListViewPrivate::BufferBefore;
+ d->bufferMode = QDeclarativeListViewPrivate::BufferBefore;
} else if (d->velocityX < 0) {
const qreal maxX = maxXExtent();
if ((d->_moveX.value() - maxX < height()/2 || d->_moveX.value() - d->flickTargetX < height()/2)
&& maxX != d->flickTargetX)
d->flickX(-d->horizontalVelocity.value());
- d->bufferMode = QmlGraphicsListViewPrivate::BufferAfter;
+ d->bufferMode = QDeclarativeListViewPrivate::BufferAfter;
}
}
d->inFlickCorrection = false;
}
}
-qreal QmlGraphicsListView::minYExtent() const
+qreal QDeclarativeListView::minYExtent() const
{
- Q_D(const QmlGraphicsListView);
- if (d->orient == QmlGraphicsListView::Horizontal)
- return QmlGraphicsFlickable::minYExtent();
+ Q_D(const QDeclarativeListView);
+ if (d->orient == QDeclarativeListView::Horizontal)
+ return QDeclarativeFlickable::minYExtent();
if (d->minExtentDirty) {
d->minExtent = -d->startPosition();
if (d->header && d->visibleItems.count())
@@ -2117,10 +2121,10 @@ qreal QmlGraphicsListView::minYExtent() const
return d->minExtent;
}
-qreal QmlGraphicsListView::maxYExtent() const
+qreal QDeclarativeListView::maxYExtent() const
{
- Q_D(const QmlGraphicsListView);
- if (d->orient == QmlGraphicsListView::Horizontal)
+ Q_D(const QDeclarativeListView);
+ if (d->orient == QDeclarativeListView::Horizontal)
return height();
if (d->maxExtentDirty) {
if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange)
@@ -2137,11 +2141,11 @@ qreal QmlGraphicsListView::maxYExtent() const
return d->maxExtent;
}
-qreal QmlGraphicsListView::minXExtent() const
+qreal QDeclarativeListView::minXExtent() const
{
- Q_D(const QmlGraphicsListView);
- if (d->orient == QmlGraphicsListView::Vertical)
- return QmlGraphicsFlickable::minXExtent();
+ Q_D(const QDeclarativeListView);
+ if (d->orient == QDeclarativeListView::Vertical)
+ return QDeclarativeFlickable::minXExtent();
if (d->minExtentDirty) {
d->minExtent = -d->startPosition();
if (d->header)
@@ -2154,10 +2158,10 @@ qreal QmlGraphicsListView::minXExtent() const
return d->minExtent;
}
-qreal QmlGraphicsListView::maxXExtent() const
+qreal QDeclarativeListView::maxXExtent() const
{
- Q_D(const QmlGraphicsListView);
- if (d->orient == QmlGraphicsListView::Vertical)
+ Q_D(const QDeclarativeListView);
+ if (d->orient == QDeclarativeListView::Vertical)
return width();
if (d->maxExtentDirty) {
if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange)
@@ -2175,16 +2179,16 @@ qreal QmlGraphicsListView::maxXExtent() const
return d->maxExtent;
}
-void QmlGraphicsListView::keyPressEvent(QKeyEvent *event)
+void QDeclarativeListView::keyPressEvent(QKeyEvent *event)
{
- Q_D(QmlGraphicsListView);
- QmlGraphicsFlickable::keyPressEvent(event);
+ Q_D(QDeclarativeListView);
+ QDeclarativeFlickable::keyPressEvent(event);
if (event->isAccepted())
return;
if (d->model && d->model->count() && d->interactive) {
- if ((d->orient == QmlGraphicsListView::Horizontal && event->key() == Qt::Key_Left)
- || (d->orient == QmlGraphicsListView::Vertical && event->key() == Qt::Key_Up)) {
+ if ((d->orient == QDeclarativeListView::Horizontal && event->key() == Qt::Key_Left)
+ || (d->orient == QDeclarativeListView::Vertical && event->key() == Qt::Key_Up)) {
if (currentIndex() > 0 || (d->wrap && !event->isAutoRepeat())) {
decrementCurrentIndex();
event->accept();
@@ -2193,8 +2197,8 @@ void QmlGraphicsListView::keyPressEvent(QKeyEvent *event)
event->accept();
return;
}
- } else if ((d->orient == QmlGraphicsListView::Horizontal && event->key() == Qt::Key_Right)
- || (d->orient == QmlGraphicsListView::Vertical && event->key() == Qt::Key_Down)) {
+ } else if ((d->orient == QDeclarativeListView::Horizontal && event->key() == Qt::Key_Right)
+ || (d->orient == QDeclarativeListView::Vertical && event->key() == Qt::Key_Down)) {
if (currentIndex() < d->model->count() - 1 || (d->wrap && !event->isAutoRepeat())) {
incrementCurrentIndex();
event->accept();
@@ -2214,11 +2218,11 @@ void QmlGraphicsListView::keyPressEvent(QKeyEvent *event)
Increments the current index. The current index will wrap
if keyNavigationWraps is true and it is currently at the end.
*/
-void QmlGraphicsListView::incrementCurrentIndex()
+void QDeclarativeListView::incrementCurrentIndex()
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (currentIndex() < d->model->count() - 1 || d->wrap) {
- d->moveReason = QmlGraphicsListViewPrivate::SetIndex;
+ d->moveReason = QDeclarativeListViewPrivate::SetIndex;
int index = currentIndex()+1;
cancelFlick();
d->updateCurrent(index < d->model->count() ? index : 0);
@@ -2231,11 +2235,11 @@ void QmlGraphicsListView::incrementCurrentIndex()
Decrements the current index. The current index will wrap
if keyNavigationWraps is true and it is currently at the beginning.
*/
-void QmlGraphicsListView::decrementCurrentIndex()
+void QDeclarativeListView::decrementCurrentIndex()
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (currentIndex() > 0 || d->wrap) {
- d->moveReason = QmlGraphicsListViewPrivate::SetIndex;
+ d->moveReason = QDeclarativeListViewPrivate::SetIndex;
int index = currentIndex()-1;
cancelFlick();
d->updateCurrent(index >= 0 ? index : d->model->count()-1);
@@ -2249,13 +2253,13 @@ void QmlGraphicsListView::decrementCurrentIndex()
If positioning the view at the index would cause empty space to be displayed at
the end of the view, the view will be positioned at the end.
*/
-void QmlGraphicsListView::positionViewAtIndex(int index)
+void QDeclarativeListView::positionViewAtIndex(int index)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (!d->isValid() || index < 0 || index >= d->model->count())
return;
- qreal maxExtent = d->orient == QmlGraphicsListView::Vertical ? -maxYExtent() : -maxXExtent();
+ qreal maxExtent = d->orient == QDeclarativeListView::Vertical ? -maxYExtent() : -maxXExtent();
FxListItem *item = d->visibleItem(index);
if (item) {
// Already created - just move to top of view
@@ -2280,12 +2284,12 @@ void QmlGraphicsListView::positionViewAtIndex(int index)
}
-void QmlGraphicsListView::componentComplete()
+void QDeclarativeListView::componentComplete()
{
- Q_D(QmlGraphicsListView);
- QmlGraphicsFlickable::componentComplete();
+ Q_D(QDeclarativeListView);
+ QDeclarativeFlickable::componentComplete();
refill();
- d->moveReason = QmlGraphicsListViewPrivate::SetIndex;
+ d->moveReason = QDeclarativeListViewPrivate::SetIndex;
if (d->currentIndex < 0)
d->updateCurrent(0);
else
@@ -2293,18 +2297,18 @@ void QmlGraphicsListView::componentComplete()
d->fixupPosition();
}
-void QmlGraphicsListView::refill()
+void QDeclarativeListView::refill()
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
d->refill(d->position(), d->position()+d->size()-1);
}
-void QmlGraphicsListView::trackedPositionChanged()
+void QDeclarativeListView::trackedPositionChanged()
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (!d->trackedItem || !d->currentItem)
return;
- if (!isFlicking() && !d->moving && d->moveReason == QmlGraphicsListViewPrivate::SetIndex) {
+ if (!isFlicking() && !d->moving && d->moveReason == QDeclarativeListViewPrivate::SetIndex) {
const qreal trackedPos = d->trackedItem->position();
const qreal viewPos = d->position();
if (d->haveHighlightRange) {
@@ -2353,11 +2357,11 @@ void QmlGraphicsListView::trackedPositionChanged()
}
}
-void QmlGraphicsListView::itemsInserted(int modelIndex, int count)
+void QDeclarativeListView::itemsInserted(int modelIndex, int count)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
d->updateUnrequestedIndexes();
- d->moveReason = QmlGraphicsListViewPrivate::Other;
+ d->moveReason = QDeclarativeListViewPrivate::Other;
if (!d->visibleItems.count() || d->model->count() <= 1) {
d->layout();
d->updateCurrent(qMax(0, qMin(d->currentIndex, d->model->count()-1)));
@@ -2480,10 +2484,10 @@ void QmlGraphicsListView::itemsInserted(int modelIndex, int count)
emit countChanged();
}
-void QmlGraphicsListView::itemsRemoved(int modelIndex, int count)
+void QDeclarativeListView::itemsRemoved(int modelIndex, int count)
{
- Q_D(QmlGraphicsListView);
- d->moveReason = QmlGraphicsListViewPrivate::Other;
+ Q_D(QDeclarativeListView);
+ d->moveReason = QDeclarativeListViewPrivate::Other;
d->updateUnrequestedIndexes();
FxListItem *firstVisible = d->firstVisibleItem();
@@ -2563,9 +2567,9 @@ void QmlGraphicsListView::itemsRemoved(int modelIndex, int count)
emit countChanged();
}
-void QmlGraphicsListView::destroyRemoved()
+void QDeclarativeListView::destroyRemoved()
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
for (QList<FxListItem*>::Iterator it = d->visibleItems.begin();
it != d->visibleItems.end();) {
FxListItem *listItem = *it;
@@ -2581,9 +2585,9 @@ void QmlGraphicsListView::destroyRemoved()
d->layout();
}
-void QmlGraphicsListView::itemsMoved(int from, int to, int count)
+void QDeclarativeListView::itemsMoved(int from, int to, int count)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
d->updateUnrequestedIndexes();
if (d->visibleItems.isEmpty()) {
@@ -2591,7 +2595,7 @@ void QmlGraphicsListView::itemsMoved(int from, int to, int count)
return;
}
- d->moveReason = QmlGraphicsListViewPrivate::Other;
+ d->moveReason = QDeclarativeListViewPrivate::Other;
FxListItem *firstVisible = d->firstVisibleItem();
qreal firstItemPos = firstVisible->position();
QHash<int,FxListItem*> moved;
@@ -2682,35 +2686,45 @@ void QmlGraphicsListView::itemsMoved(int from, int to, int count)
d->layout();
}
-void QmlGraphicsListView::createdItem(int index, QmlGraphicsItem *item)
+void QDeclarativeListView::modelReset()
+{
+ Q_D(QDeclarativeListView);
+ d->clear();
+ refill();
+ d->moveReason = QDeclarativeListViewPrivate::SetIndex;
+ d->updateCurrent(d->currentIndex);
+ emit countChanged();
+}
+
+void QDeclarativeListView::createdItem(int index, QDeclarativeItem *item)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
if (d->requestedIndex != index) {
item->setParentItem(viewport());
d->unrequestedItems.insert(item, index);
- if (d->orient == QmlGraphicsListView::Vertical)
+ if (d->orient == QDeclarativeListView::Vertical)
item->setY(d->positionAt(index));
else
item->setX(d->positionAt(index));
}
}
-void QmlGraphicsListView::destroyingItem(QmlGraphicsItem *item)
+void QDeclarativeListView::destroyingItem(QDeclarativeItem *item)
{
- Q_D(QmlGraphicsListView);
+ Q_D(QDeclarativeListView);
d->unrequestedItems.remove(item);
}
-void QmlGraphicsListView::animStopped()
+void QDeclarativeListView::animStopped()
{
- Q_D(QmlGraphicsListView);
- d->moveReason = QmlGraphicsListViewPrivate::Other;
- d->bufferMode = QmlGraphicsListViewPrivate::NoBuffer;
+ Q_D(QDeclarativeListView);
+ d->moveReason = QDeclarativeListViewPrivate::Other;
+ d->bufferMode = QDeclarativeListViewPrivate::NoBuffer;
}
-QmlGraphicsListViewAttached *QmlGraphicsListView::qmlAttachedProperties(QObject *obj)
+QDeclarativeListViewAttached *QDeclarativeListView::qmlAttachedProperties(QObject *obj)
{
- return new QmlGraphicsListViewAttached(obj);
+ return new QDeclarativeListViewAttached(obj);
}
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qmlgraphicslistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h
index c5b4aab..5e3edb0 100644
--- a/src/declarative/graphicsitems/qmlgraphicslistview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSLISTVIEW_H
-#define QMLGRAPHICSLISTVIEW_H
+#ifndef QDECLARATIVELISTVIEW_H
+#define QDECLARATIVELISTVIEW_H
-#include "qmlgraphicsflickable_p.h"
+#include "qdeclarativeflickable_p.h"
QT_BEGIN_HEADER
@@ -50,15 +50,15 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class Q_DECLARATIVE_EXPORT QmlGraphicsViewSection : public QObject
+class Q_DECLARATIVE_EXPORT QDeclarativeViewSection : public QObject
{
Q_OBJECT
Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY changed)
Q_PROPERTY(SectionCriteria criteria READ criteria WRITE setCriteria NOTIFY changed)
- Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
+ Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
Q_ENUMS(SectionCriteria)
public:
- QmlGraphicsViewSection(QObject *parent=0) : QObject(parent), m_criteria(FullString), m_delegate(0) {}
+ QDeclarativeViewSection(QObject *parent=0) : QObject(parent), m_criteria(FullString), m_delegate(0) {}
QString property() const { return m_property; }
void setProperty(const QString &);
@@ -67,8 +67,8 @@ public:
SectionCriteria criteria() const { return m_criteria; }
void setCriteria(SectionCriteria);
- QmlComponent *delegate() const { return m_delegate; }
- void setDelegate(QmlComponent *delegate);
+ QDeclarativeComponent *delegate() const { return m_delegate; }
+ void setDelegate(QDeclarativeComponent *delegate);
QString sectionString(const QString &value);
@@ -79,26 +79,26 @@ Q_SIGNALS:
private:
QString m_property;
SectionCriteria m_criteria;
- QmlComponent *m_delegate;
+ QDeclarativeComponent *m_delegate;
};
-class QmlGraphicsVisualModel;
-class QmlGraphicsListViewAttached;
-class QmlGraphicsListViewPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsListView : public QmlGraphicsFlickable
+class QDeclarativeVisualModel;
+class QDeclarativeListViewAttached;
+class QDeclarativeListViewPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeListView : public QDeclarativeFlickable
{
Q_OBJECT
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsListView)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeListView)
Q_PROPERTY(QVariant model READ model WRITE setModel)
- Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate)
+ Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
- Q_PROPERTY(QmlGraphicsItem *currentItem READ currentItem NOTIFY currentIndexChanged)
+ Q_PROPERTY(QDeclarativeItem *currentItem READ currentItem NOTIFY currentIndexChanged)
Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_PROPERTY(QmlComponent *highlight READ highlight WRITE setHighlight)
- Q_PROPERTY(QmlGraphicsItem *highlightItem READ highlightItem NOTIFY highlightChanged)
+ Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight)
+ Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightChanged)
Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem)
Q_PROPERTY(qreal highlightMoveSpeed READ highlightMoveSpeed WRITE setHighlightMoveSpeed NOTIFY highlightMoveSpeedChanged)
Q_PROPERTY(qreal highlightResizeSpeed READ highlightResizeSpeed WRITE setHighlightResizeSpeed NOTIFY highlightResizeSpeedChanged)
@@ -111,13 +111,13 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsListView : public QmlGraphicsFlickable
Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged)
Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled)
Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer)
- Q_PROPERTY(QmlGraphicsViewSection *section READ sectionCriteria CONSTANT)
+ Q_PROPERTY(QDeclarativeViewSection *section READ sectionCriteria CONSTANT)
Q_PROPERTY(QString currentSection READ currentSection NOTIFY currentSectionChanged)
Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode)
- Q_PROPERTY(QmlComponent *header READ header WRITE setHeader)
- Q_PROPERTY(QmlComponent *footer READ footer WRITE setFooter)
+ Q_PROPERTY(QDeclarativeComponent *header READ header WRITE setHeader)
+ Q_PROPERTY(QDeclarativeComponent *footer READ footer WRITE setFooter)
Q_ENUMS(HighlightRangeMode)
Q_ENUMS(Orientation)
@@ -125,24 +125,24 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsListView : public QmlGraphicsFlickable
Q_CLASSINFO("DefaultProperty", "data")
public:
- QmlGraphicsListView(QmlGraphicsItem *parent=0);
- ~QmlGraphicsListView();
+ QDeclarativeListView(QDeclarativeItem *parent=0);
+ ~QDeclarativeListView();
QVariant model() const;
void setModel(const QVariant &);
- QmlComponent *delegate() const;
- void setDelegate(QmlComponent *);
+ QDeclarativeComponent *delegate() const;
+ void setDelegate(QDeclarativeComponent *);
int currentIndex() const;
void setCurrentIndex(int idx);
- QmlGraphicsItem *currentItem();
- QmlGraphicsItem *highlightItem();
+ QDeclarativeItem *currentItem();
+ QDeclarativeItem *highlightItem();
int count() const;
- QmlComponent *highlight() const;
- void setHighlight(QmlComponent *highlight);
+ QDeclarativeComponent *highlight() const;
+ void setHighlight(QDeclarativeComponent *highlight);
bool highlightFollowsCurrentItem() const;
void setHighlightFollowsCurrentItem(bool);
@@ -170,7 +170,7 @@ public:
int cacheBuffer() const;
void setCacheBuffer(int);
- QmlGraphicsViewSection *sectionCriteria();
+ QDeclarativeViewSection *sectionCriteria();
QString currentSection() const;
qreal highlightMoveSpeed() const;
@@ -183,13 +183,13 @@ public:
SnapMode snapMode() const;
void setSnapMode(SnapMode mode);
- QmlComponent *footer() const;
- void setFooter(QmlComponent *);
+ QDeclarativeComponent *footer() const;
+ void setFooter(QDeclarativeComponent *);
- QmlComponent *header() const;
- void setHeader(QmlComponent *);
+ QDeclarativeComponent *header() const;
+ void setHeader(QDeclarativeComponent *);
- static QmlGraphicsListViewAttached *qmlAttachedProperties(QObject *);
+ static QDeclarativeListViewAttached *qmlAttachedProperties(QObject *);
public Q_SLOTS:
void incrementCurrentIndex();
@@ -221,22 +221,23 @@ private Q_SLOTS:
void itemsInserted(int index, int count);
void itemsRemoved(int index, int count);
void itemsMoved(int from, int to, int count);
+ void modelReset();
void destroyRemoved();
- void createdItem(int index, QmlGraphicsItem *item);
- void destroyingItem(QmlGraphicsItem *item);
+ void createdItem(int index, QDeclarativeItem *item);
+ void destroyingItem(QDeclarativeItem *item);
void animStopped();
};
-class QmlGraphicsListViewAttached : public QObject
+class QDeclarativeListViewAttached : public QObject
{
Q_OBJECT
public:
- QmlGraphicsListViewAttached(QObject *parent)
+ QDeclarativeListViewAttached(QObject *parent)
: QObject(parent), m_view(0), m_isCurrent(false), m_delayRemove(false) {}
- ~QmlGraphicsListViewAttached() {}
+ ~QDeclarativeListViewAttached() {}
- Q_PROPERTY(QmlGraphicsListView *view READ view CONSTANT)
- QmlGraphicsListView *view() { return m_view; }
+ Q_PROPERTY(QDeclarativeListView *view READ view CONSTANT)
+ QDeclarativeListView *view() { return m_view; }
Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY currentItemChanged)
bool isCurrentItem() const { return m_isCurrent; }
@@ -286,7 +287,7 @@ Q_SIGNALS:
void remove();
public:
- QmlGraphicsListView *m_view;
+ QDeclarativeListView *m_view;
bool m_isCurrent;
mutable QString m_section;
QString m_prevSection;
@@ -296,9 +297,9 @@ public:
QT_END_NAMESPACE
-QML_DECLARE_TYPEINFO(QmlGraphicsListView, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(QmlGraphicsListView)
-QML_DECLARE_TYPE(QmlGraphicsViewSection)
+QML_DECLARE_TYPEINFO(QDeclarativeListView, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPE(QDeclarativeListView)
+QML_DECLARE_TYPE(QDeclarativeViewSection)
QT_END_HEADER
diff --git a/src/declarative/graphicsitems/qmlgraphicsloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index b9780f2..bd89321 100644
--- a/src/declarative/graphicsitems/qmlgraphicsloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -39,31 +39,31 @@
**
****************************************************************************/
-#include "qmlgraphicsloader_p_p.h"
+#include "qdeclarativeloader_p_p.h"
-#include <qmlengine_p.h>
+#include <qdeclarativeengine_p.h>
QT_BEGIN_NAMESPACE
-QmlGraphicsLoaderPrivate::QmlGraphicsLoaderPrivate()
+QDeclarativeLoaderPrivate::QDeclarativeLoaderPrivate()
: item(0), component(0), ownComponent(false)
- , resizeMode(QmlGraphicsLoader::SizeLoaderToItem)
+ , resizeMode(QDeclarativeLoader::SizeLoaderToItem)
{
}
-QmlGraphicsLoaderPrivate::~QmlGraphicsLoaderPrivate()
+QDeclarativeLoaderPrivate::~QDeclarativeLoaderPrivate()
{
}
-void QmlGraphicsLoaderPrivate::itemGeometryChanged(QmlGraphicsItem *resizeItem, const QRectF &newGeometry, const QRectF &oldGeometry)
+void QDeclarativeLoaderPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, const QRectF &newGeometry, const QRectF &oldGeometry)
{
- if (resizeItem == item && resizeMode == QmlGraphicsLoader::SizeLoaderToItem) {
+ if (resizeItem == item && resizeMode == QDeclarativeLoader::SizeLoaderToItem) {
_q_updateSize();
}
- QmlGraphicsItemChangeListener::itemGeometryChanged(resizeItem, newGeometry, oldGeometry);
+ QDeclarativeItemChangeListener::itemGeometryChanged(resizeItem, newGeometry, oldGeometry);
}
-void QmlGraphicsLoaderPrivate::clear()
+void QDeclarativeLoaderPrivate::clear()
{
if (ownComponent) {
delete component;
@@ -73,11 +73,11 @@ void QmlGraphicsLoaderPrivate::clear()
source = QUrl();
if (item) {
- if (QmlGraphicsItem *qmlItem = qobject_cast<QmlGraphicsItem*>(item)) {
- if (resizeMode == QmlGraphicsLoader::SizeLoaderToItem) {
- QmlGraphicsItemPrivate *p =
- static_cast<QmlGraphicsItemPrivate *>(QGraphicsItemPrivate::get(qmlItem));
- p->removeItemChangeListener(this, QmlGraphicsItemPrivate::Geometry);
+ if (QDeclarativeItem *qmlItem = qobject_cast<QDeclarativeItem*>(item)) {
+ if (resizeMode == QDeclarativeLoader::SizeLoaderToItem) {
+ QDeclarativeItemPrivate *p =
+ static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(qmlItem));
+ p->removeItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
}
}
@@ -90,18 +90,18 @@ void QmlGraphicsLoaderPrivate::clear()
}
}
-void QmlGraphicsLoaderPrivate::initResize()
+void QDeclarativeLoaderPrivate::initResize()
{
- Q_Q(QmlGraphicsLoader);
- if (QmlGraphicsItem *qmlItem = qobject_cast<QmlGraphicsItem*>(item)) {
- if (resizeMode == QmlGraphicsLoader::SizeLoaderToItem) {
- QmlGraphicsItemPrivate *p =
- static_cast<QmlGraphicsItemPrivate *>(QGraphicsItemPrivate::get(qmlItem));
- p->addItemChangeListener(this, QmlGraphicsItemPrivate::Geometry);
+ Q_Q(QDeclarativeLoader);
+ if (QDeclarativeItem *qmlItem = qobject_cast<QDeclarativeItem*>(item)) {
+ if (resizeMode == QDeclarativeLoader::SizeLoaderToItem) {
+ QDeclarativeItemPrivate *p =
+ static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(qmlItem));
+ p->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
}
} else if (item && item->isWidget()) {
QGraphicsWidget *widget = static_cast<QGraphicsWidget*>(item);
- if (resizeMode == QmlGraphicsLoader::SizeLoaderToItem) {
+ if (resizeMode == QDeclarativeLoader::SizeLoaderToItem) {
widget->installEventFilter(q);
}
}
@@ -109,7 +109,7 @@ void QmlGraphicsLoaderPrivate::initResize()
}
/*!
- \qmlclass Loader QmlGraphicsLoader
+ \qmlclass Loader QDeclarativeLoader
\since 4.7
\inherits Item
@@ -145,22 +145,22 @@ void QmlGraphicsLoaderPrivate::initResize()
/*!
\internal
- \class QmlGraphicsLoader
+ \class QDeclarativeLoader
\qmlclass Loader
*/
/*!
- Create a new QmlGraphicsLoader instance.
+ Create a new QDeclarativeLoader instance.
*/
-QmlGraphicsLoader::QmlGraphicsLoader(QmlGraphicsItem *parent)
- : QmlGraphicsItem(*(new QmlGraphicsLoaderPrivate), parent)
+QDeclarativeLoader::QDeclarativeLoader(QDeclarativeItem *parent)
+ : QDeclarativeItem(*(new QDeclarativeLoaderPrivate), parent)
{
}
/*!
Destroy the loader instance.
*/
-QmlGraphicsLoader::~QmlGraphicsLoader()
+QDeclarativeLoader::~QDeclarativeLoader()
{
}
@@ -171,15 +171,15 @@ QmlGraphicsLoader::~QmlGraphicsLoader()
\sa sourceComponent, status, progress
*/
-QUrl QmlGraphicsLoader::source() const
+QUrl QDeclarativeLoader::source() const
{
- Q_D(const QmlGraphicsLoader);
+ Q_D(const QDeclarativeLoader);
return d->source;
}
-void QmlGraphicsLoader::setSource(const QUrl &url)
+void QDeclarativeLoader::setSource(const QUrl &url)
{
- Q_D(QmlGraphicsLoader);
+ Q_D(QDeclarativeLoader);
if (d->source == url)
return;
@@ -194,12 +194,12 @@ void QmlGraphicsLoader::setSource(const QUrl &url)
return;
}
- d->component = new QmlComponent(qmlEngine(this), d->source, this);
+ d->component = new QDeclarativeComponent(qmlEngine(this), d->source, this);
d->ownComponent = true;
if (!d->component->isLoading()) {
d->_q_sourceLoaded();
} else {
- connect(d->component, SIGNAL(statusChanged(QmlComponent::Status)),
+ connect(d->component, SIGNAL(statusChanged(QDeclarativeComponent::Status)),
this, SLOT(_q_sourceLoaded()));
connect(d->component, SIGNAL(progressChanged(qreal)),
this, SIGNAL(progressChanged()));
@@ -229,15 +229,15 @@ void QmlGraphicsLoader::setSource(const QUrl &url)
\sa source, progress
*/
-QmlComponent *QmlGraphicsLoader::sourceComponent() const
+QDeclarativeComponent *QDeclarativeLoader::sourceComponent() const
{
- Q_D(const QmlGraphicsLoader);
+ Q_D(const QDeclarativeLoader);
return d->component;
}
-void QmlGraphicsLoader::setSourceComponent(QmlComponent *comp)
+void QDeclarativeLoader::setSourceComponent(QDeclarativeComponent *comp)
{
- Q_D(QmlGraphicsLoader);
+ Q_D(QDeclarativeLoader);
if (comp == d->component)
return;
@@ -256,7 +256,7 @@ void QmlGraphicsLoader::setSourceComponent(QmlComponent *comp)
if (!d->component->isLoading()) {
d->_q_sourceLoaded();
} else {
- connect(d->component, SIGNAL(statusChanged(QmlComponent::Status)),
+ connect(d->component, SIGNAL(statusChanged(QDeclarativeComponent::Status)),
this, SLOT(_q_sourceLoaded()));
connect(d->component, SIGNAL(progressChanged(qreal)),
this, SIGNAL(progressChanged()));
@@ -267,12 +267,12 @@ void QmlGraphicsLoader::setSourceComponent(QmlComponent *comp)
}
}
-void QmlGraphicsLoaderPrivate::_q_sourceLoaded()
+void QDeclarativeLoaderPrivate::_q_sourceLoaded()
{
- Q_Q(QmlGraphicsLoader);
+ Q_Q(QDeclarativeLoader);
if (component) {
- QmlContext *ctxt = new QmlContext(qmlContext(q));
+ QDeclarativeContext *ctxt = new QDeclarativeContext(qmlContext(q));
ctxt->addDefaultObject(q);
if (!component->errors().isEmpty()) {
@@ -288,7 +288,7 @@ void QmlGraphicsLoaderPrivate::_q_sourceLoaded()
ctxt->setParent(obj);
item = qobject_cast<QGraphicsObject *>(obj);
if (item) {
- if (QmlGraphicsItem* qmlItem = qobject_cast<QmlGraphicsItem *>(item)) {
+ if (QDeclarativeItem* qmlItem = qobject_cast<QDeclarativeItem *>(item)) {
qmlItem->setParentItem(q);
} else {
item->setParentItem(q);
@@ -323,12 +323,12 @@ void QmlGraphicsLoaderPrivate::_q_sourceLoaded()
\sa progress
*/
-QmlGraphicsLoader::Status QmlGraphicsLoader::status() const
+QDeclarativeLoader::Status QDeclarativeLoader::status() const
{
- Q_D(const QmlGraphicsLoader);
+ Q_D(const QDeclarativeLoader);
if (d->component)
- return static_cast<QmlGraphicsLoader::Status>(d->component->status());
+ return static_cast<QDeclarativeLoader::Status>(d->component->status());
if (d->item)
return Ready;
@@ -344,9 +344,9 @@ QmlGraphicsLoader::Status QmlGraphicsLoader::status() const
\sa status
*/
-qreal QmlGraphicsLoader::progress() const
+qreal QDeclarativeLoader::progress() const
{
- Q_D(const QmlGraphicsLoader);
+ Q_D(const QDeclarativeLoader);
if (d->item)
return 1.0;
@@ -375,23 +375,23 @@ qreal QmlGraphicsLoader::progress() const
The default resizeMode is SizeLoaderToItem.
*/
-QmlGraphicsLoader::ResizeMode QmlGraphicsLoader::resizeMode() const
+QDeclarativeLoader::ResizeMode QDeclarativeLoader::resizeMode() const
{
- Q_D(const QmlGraphicsLoader);
+ Q_D(const QDeclarativeLoader);
return d->resizeMode;
}
-void QmlGraphicsLoader::setResizeMode(ResizeMode mode)
+void QDeclarativeLoader::setResizeMode(ResizeMode mode)
{
- Q_D(QmlGraphicsLoader);
+ Q_D(QDeclarativeLoader);
if (mode == d->resizeMode)
return;
- if (QmlGraphicsItem *qmlItem = qobject_cast<QmlGraphicsItem*>(d->item)) {
+ if (QDeclarativeItem *qmlItem = qobject_cast<QDeclarativeItem*>(d->item)) {
if (d->resizeMode == SizeLoaderToItem) {
- QmlGraphicsItemPrivate *p =
- static_cast<QmlGraphicsItemPrivate *>(QGraphicsItemPrivate::get(qmlItem));
- p->removeItemChangeListener(d, QmlGraphicsItemPrivate::Geometry);
+ QDeclarativeItemPrivate *p =
+ static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(qmlItem));
+ p->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry);
}
} else if (d->item && d->item->isWidget()) {
if (d->resizeMode == SizeLoaderToItem)
@@ -403,28 +403,28 @@ void QmlGraphicsLoader::setResizeMode(ResizeMode mode)
d->initResize();
}
-void QmlGraphicsLoaderPrivate::_q_updateSize()
+void QDeclarativeLoaderPrivate::_q_updateSize()
{
- Q_Q(QmlGraphicsLoader);
+ Q_Q(QDeclarativeLoader);
if (!item)
return;
- if (QmlGraphicsItem *qmlItem = qobject_cast<QmlGraphicsItem*>(item)) {
- if (resizeMode == QmlGraphicsLoader::SizeLoaderToItem) {
+ if (QDeclarativeItem *qmlItem = qobject_cast<QDeclarativeItem*>(item)) {
+ if (resizeMode == QDeclarativeLoader::SizeLoaderToItem) {
q->setWidth(qmlItem->width());
q->setHeight(qmlItem->height());
- } else if (resizeMode == QmlGraphicsLoader::SizeItemToLoader) {
+ } else if (resizeMode == QDeclarativeLoader::SizeItemToLoader) {
qmlItem->setWidth(q->width());
qmlItem->setHeight(q->height());
}
} else if (item && item->isWidget()) {
QGraphicsWidget *widget = static_cast<QGraphicsWidget*>(item);
- if (resizeMode == QmlGraphicsLoader::SizeLoaderToItem) {
+ if (resizeMode == QDeclarativeLoader::SizeLoaderToItem) {
QSizeF newSize = widget->size();
if (newSize.isValid()) {
q->setWidth(newSize.width());
q->setHeight(newSize.height());
}
- } else if (resizeMode == QmlGraphicsLoader::SizeItemToLoader) {
+ } else if (resizeMode == QDeclarativeLoader::SizeItemToLoader) {
QSizeF oldSize = widget->size();
QSizeF newSize = oldSize;
if (q->heightValid())
@@ -441,26 +441,26 @@ void QmlGraphicsLoaderPrivate::_q_updateSize()
\qmlproperty Item Loader::item
This property holds the top-level item created from source.
*/
-QGraphicsObject *QmlGraphicsLoader::item() const
+QGraphicsObject *QDeclarativeLoader::item() const
{
- Q_D(const QmlGraphicsLoader);
+ Q_D(const QDeclarativeLoader);
return d->item;
}
-void QmlGraphicsLoader::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+void QDeclarativeLoader::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
- Q_D(QmlGraphicsLoader);
+ Q_D(QDeclarativeLoader);
if (newGeometry != oldGeometry) {
if (d->resizeMode == SizeItemToLoader) {
d->_q_updateSize();
}
}
- QmlGraphicsItem::geometryChanged(newGeometry, oldGeometry);
+ QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
}
-QVariant QmlGraphicsLoader::itemChange(GraphicsItemChange change, const QVariant &value)
+QVariant QDeclarativeLoader::itemChange(GraphicsItemChange change, const QVariant &value)
{
- Q_D(QmlGraphicsLoader);
+ Q_D(QDeclarativeLoader);
if (change == ItemSceneHasChanged) {
if (d->item && d->item->isWidget()) {
if (d->resizeMode == SizeLoaderToItem) {
@@ -469,20 +469,20 @@ QVariant QmlGraphicsLoader::itemChange(GraphicsItemChange change, const QVariant
}
}
}
- return QmlGraphicsItem::itemChange(change, value);
+ return QDeclarativeItem::itemChange(change, value);
}
-bool QmlGraphicsLoader::eventFilter(QObject *watched, QEvent *e)
+bool QDeclarativeLoader::eventFilter(QObject *watched, QEvent *e)
{
- Q_D(QmlGraphicsLoader);
+ Q_D(QDeclarativeLoader);
if (watched == d->item && e->type() == QEvent::GraphicsSceneResize) {
if (d->item && d->item->isWidget() && d->resizeMode == SizeLoaderToItem) {
d->_q_updateSize();
}
}
- return QmlGraphicsItem::eventFilter(watched, e);
+ return QDeclarativeItem::eventFilter(watched, e);
}
-#include <moc_qmlgraphicsloader_p.cpp>
+#include <moc_qdeclarativeloader_p.cpp>
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qmlgraphicsloader_p.h b/src/declarative/graphicsitems/qdeclarativeloader_p.h
index 0ab67ac..65538a8 100644
--- a/src/declarative/graphicsitems/qmlgraphicsloader_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeloader_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSLOADER_H
-#define QMLGRAPHICSLOADER_H
+#ifndef QDECLARATIVELOADER_H
+#define QDECLARATIVELOADER_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
QT_BEGIN_HEADER
@@ -50,29 +50,29 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsLoaderPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsLoader : public QmlGraphicsItem
+class QDeclarativeLoaderPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeLoader : public QDeclarativeItem
{
Q_OBJECT
Q_ENUMS(Status)
Q_ENUMS(ResizeMode)
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
- Q_PROPERTY(QmlComponent *sourceComponent READ sourceComponent WRITE setSourceComponent NOTIFY sourceChanged)
+ Q_PROPERTY(QDeclarativeComponent *sourceComponent READ sourceComponent WRITE setSourceComponent NOTIFY sourceChanged)
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)
public:
- QmlGraphicsLoader(QmlGraphicsItem *parent=0);
- virtual ~QmlGraphicsLoader();
+ QDeclarativeLoader(QDeclarativeItem *parent=0);
+ virtual ~QDeclarativeLoader();
QUrl source() const;
void setSource(const QUrl &);
- QmlComponent *sourceComponent() const;
- void setSourceComponent(QmlComponent *);
+ QDeclarativeComponent *sourceComponent() const;
+ void setSourceComponent(QDeclarativeComponent *);
enum Status { Null, Ready, Loading, Error };
Status status() const;
@@ -96,16 +96,16 @@ protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
bool eventFilter(QObject *watched, QEvent *e);
private:
- Q_DISABLE_COPY(QmlGraphicsLoader)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsLoader)
+ Q_DISABLE_COPY(QDeclarativeLoader)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeLoader)
Q_PRIVATE_SLOT(d_func(), void _q_sourceLoaded())
Q_PRIVATE_SLOT(d_func(), void _q_updateSize())
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsLoader)
+QML_DECLARE_TYPE(QDeclarativeLoader)
QT_END_HEADER
-#endif // QMLGRAPHICSLOADER_H
+#endif // QDECLARATIVELOADER_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsloader_p_p.h b/src/declarative/graphicsitems/qdeclarativeloader_p_p.h
index 61dab58..fc5e665 100644
--- a/src/declarative/graphicsitems/qmlgraphicsloader_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeloader_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSLOADER_P_H
-#define QMLGRAPHICSLOADER_P_H
+#ifndef QDECLARATIVELOADER_P_H
+#define QDECLARATIVELOADER_P_H
//
// W A R N I N G
@@ -53,31 +53,31 @@
// We mean it.
//
-#include "qmlgraphicsloader_p.h"
+#include "qdeclarativeloader_p.h"
-#include "qmlgraphicsitem_p.h"
-#include "qmlgraphicsitemchangelistener_p.h"
+#include "qdeclarativeitem_p.h"
+#include "qdeclarativeitemchangelistener_p.h"
QT_BEGIN_NAMESPACE
-class QmlContext;
-class QmlGraphicsLoaderPrivate : public QmlGraphicsItemPrivate, public QmlGraphicsItemChangeListener
+class QDeclarativeContext;
+class QDeclarativeLoaderPrivate : public QDeclarativeItemPrivate, public QDeclarativeItemChangeListener
{
- Q_DECLARE_PUBLIC(QmlGraphicsLoader)
+ Q_DECLARE_PUBLIC(QDeclarativeLoader)
public:
- QmlGraphicsLoaderPrivate();
- ~QmlGraphicsLoaderPrivate();
+ QDeclarativeLoaderPrivate();
+ ~QDeclarativeLoaderPrivate();
- void itemGeometryChanged(QmlGraphicsItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
+ void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
void clear();
void initResize();
QUrl source;
QGraphicsObject *item;
- QmlComponent *component;
+ QDeclarativeComponent *component;
bool ownComponent : 1;
- QmlGraphicsLoader::ResizeMode resizeMode;
+ QDeclarativeLoader::ResizeMode resizeMode;
void _q_sourceLoaded();
void _q_updateSize();
@@ -85,4 +85,4 @@ public:
QT_END_NAMESPACE
-#endif // QMLGRAPHICSLOADER_P_H
+#endif // QDECLARATIVELOADER_P_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsmousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index 07354f4..ec7aa62 100644
--- a/src/declarative/graphicsitems/qmlgraphicsmousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -39,31 +39,31 @@
**
****************************************************************************/
-#include "qmlgraphicsmousearea_p.h"
-#include "qmlgraphicsmousearea_p_p.h"
+#include "qdeclarativemousearea_p.h"
+#include "qdeclarativemousearea_p_p.h"
-#include "qmlgraphicsevents_p_p.h"
+#include "qdeclarativeevents_p_p.h"
#include <QGraphicsSceneMouseEvent>
QT_BEGIN_NAMESPACE
static const int PressAndHoldDelay = 800;
-QmlGraphicsDrag::QmlGraphicsDrag(QObject *parent)
+QDeclarativeDrag::QDeclarativeDrag(QObject *parent)
: QObject(parent), _target(0), _axis(XandYAxis), _xmin(0), _xmax(0), _ymin(0), _ymax(0)
{
}
-QmlGraphicsDrag::~QmlGraphicsDrag()
+QDeclarativeDrag::~QDeclarativeDrag()
{
}
-QmlGraphicsItem *QmlGraphicsDrag::target() const
+QDeclarativeItem *QDeclarativeDrag::target() const
{
return _target;
}
-void QmlGraphicsDrag::setTarget(QmlGraphicsItem *t)
+void QDeclarativeDrag::setTarget(QDeclarativeItem *t)
{
if (_target == t)
return;
@@ -71,12 +71,12 @@ void QmlGraphicsDrag::setTarget(QmlGraphicsItem *t)
emit targetChanged();
}
-QmlGraphicsDrag::Axis QmlGraphicsDrag::axis() const
+QDeclarativeDrag::Axis QDeclarativeDrag::axis() const
{
return _axis;
}
-void QmlGraphicsDrag::setAxis(QmlGraphicsDrag::Axis a)
+void QDeclarativeDrag::setAxis(QDeclarativeDrag::Axis a)
{
if (_axis == a)
return;
@@ -84,12 +84,12 @@ void QmlGraphicsDrag::setAxis(QmlGraphicsDrag::Axis a)
emit axisChanged();
}
-qreal QmlGraphicsDrag::xmin() const
+qreal QDeclarativeDrag::xmin() const
{
return _xmin;
}
-void QmlGraphicsDrag::setXmin(qreal m)
+void QDeclarativeDrag::setXmin(qreal m)
{
if (_xmin == m)
return;
@@ -97,12 +97,12 @@ void QmlGraphicsDrag::setXmin(qreal m)
emit minimumXChanged();
}
-qreal QmlGraphicsDrag::xmax() const
+qreal QDeclarativeDrag::xmax() const
{
return _xmax;
}
-void QmlGraphicsDrag::setXmax(qreal m)
+void QDeclarativeDrag::setXmax(qreal m)
{
if (_xmax == m)
return;
@@ -110,12 +110,12 @@ void QmlGraphicsDrag::setXmax(qreal m)
emit maximumXChanged();
}
-qreal QmlGraphicsDrag::ymin() const
+qreal QDeclarativeDrag::ymin() const
{
return _ymin;
}
-void QmlGraphicsDrag::setYmin(qreal m)
+void QDeclarativeDrag::setYmin(qreal m)
{
if (_ymin == m)
return;
@@ -123,12 +123,12 @@ void QmlGraphicsDrag::setYmin(qreal m)
emit minimumYChanged();
}
-qreal QmlGraphicsDrag::ymax() const
+qreal QDeclarativeDrag::ymax() const
{
return _ymax;
}
-void QmlGraphicsDrag::setYmax(qreal m)
+void QDeclarativeDrag::setYmax(qreal m)
{
if (_ymax == m)
return;
@@ -136,14 +136,14 @@ void QmlGraphicsDrag::setYmax(qreal m)
emit maximumYChanged();
}
-QmlGraphicsMouseAreaPrivate::~QmlGraphicsMouseAreaPrivate()
+QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate()
{
delete drag;
}
/*!
- \qmlclass MouseRegion QmlGraphicsMouseRegion
+ \qmlclass MouseArea QDeclarativeMouseArea
\since 4.7
\brief The MouseArea item enables simple mouse handling.
\inherits Item
@@ -172,7 +172,7 @@ QmlGraphicsMouseAreaPrivate::~QmlGraphicsMouseAreaPrivate()
/*!
\qmlsignal MouseArea::onEntered()
- This handler is called when the mouse enters the mouse region.
+ This handler is called when the mouse enters the mouse area.
By default the onEntered handler is only called while a button is
pressed. Setting hoverEnabled to true enables handling of
@@ -184,7 +184,7 @@ QmlGraphicsMouseAreaPrivate::~QmlGraphicsMouseAreaPrivate()
/*!
\qmlsignal MouseArea::onExited()
- This handler is called when the mouse exists the mouse region.
+ This handler is called when the mouse exists the mouse area.
By default the onExited handler is only called while a button is
pressed. Setting hoverEnabled to true enables handling of
@@ -267,24 +267,24 @@ QmlGraphicsMouseAreaPrivate::~QmlGraphicsMouseAreaPrivate()
/*!
\internal
- \class QmlGraphicsMouseArea
- \brief The QmlGraphicsMouseArea class provides a simple mouse handling abstraction for use within Qml.
+ \class QDeclarativeMouseArea
+ \brief The QDeclarativeMouseArea class provides a simple mouse handling abstraction for use within Qml.
\ingroup group_coreitems
- All QmlGraphicsItem derived classes can do mouse handling but the QmlGraphicsMouseArea class exposes mouse
+ All QDeclarativeItem derived classes can do mouse handling but the QDeclarativeMouseArea class exposes mouse
handling data as properties and tracks flicking and dragging of the mouse.
- A QmlGraphicsMouseArea object can be instantiated in Qml using the tag \l MouseArea.
+ A QDeclarativeMouseArea object can be instantiated in Qml using the tag \l MouseArea.
*/
-QmlGraphicsMouseArea::QmlGraphicsMouseArea(QmlGraphicsItem *parent)
- : QmlGraphicsItem(*(new QmlGraphicsMouseAreaPrivate), parent)
+QDeclarativeMouseArea::QDeclarativeMouseArea(QDeclarativeItem *parent)
+ : QDeclarativeItem(*(new QDeclarativeMouseAreaPrivate), parent)
{
- Q_D(QmlGraphicsMouseArea);
+ Q_D(QDeclarativeMouseArea);
d->init();
}
-QmlGraphicsMouseArea::~QmlGraphicsMouseArea()
+QDeclarativeMouseArea::~QDeclarativeMouseArea()
{
}
@@ -295,25 +295,25 @@ QmlGraphicsMouseArea::~QmlGraphicsMouseArea()
If the hoverEnabled property is false then these properties will only be valid
while a button is pressed, and will remain valid as long as the button is held
- even if the mouse is moved outside the region.
+ even if the mouse is moved outside the area.
If hoverEnabled is true then these properties will be valid:
\list
\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.
+ \i if a button is pressed and held, even if it has since moved out of the area.
\endlist
The coordinates are relative to the MouseArea.
*/
-qreal QmlGraphicsMouseArea::mouseX() const
+qreal QDeclarativeMouseArea::mouseX() const
{
- Q_D(const QmlGraphicsMouseArea);
+ Q_D(const QDeclarativeMouseArea);
return d->lastPos.x();
}
-qreal QmlGraphicsMouseArea::mouseY() const
+qreal QDeclarativeMouseArea::mouseY() const
{
- Q_D(const QmlGraphicsMouseArea);
+ Q_D(const QDeclarativeMouseArea);
return d->lastPos.y();
}
@@ -321,15 +321,15 @@ qreal QmlGraphicsMouseArea::mouseY() const
\qmlproperty bool MouseArea::enabled
This property holds whether the item accepts mouse events.
*/
-bool QmlGraphicsMouseArea::isEnabled() const
+bool QDeclarativeMouseArea::isEnabled() const
{
- Q_D(const QmlGraphicsMouseArea);
+ Q_D(const QDeclarativeMouseArea);
return d->absorb;
}
-void QmlGraphicsMouseArea::setEnabled(bool a)
+void QDeclarativeMouseArea::setEnabled(bool a)
{
- Q_D(QmlGraphicsMouseArea);
+ Q_D(QDeclarativeMouseArea);
if (a != d->absorb) {
d->absorb = a;
emit enabledChanged();
@@ -362,42 +362,42 @@ void QmlGraphicsMouseArea::setEnabled(bool a)
\sa acceptedButtons
*/
-Qt::MouseButtons QmlGraphicsMouseArea::pressedButtons() const
+Qt::MouseButtons QDeclarativeMouseArea::pressedButtons() const
{
- Q_D(const QmlGraphicsMouseArea);
+ Q_D(const QDeclarativeMouseArea);
return d->lastButtons;
}
-void QmlGraphicsMouseArea::mousePressEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeMouseArea::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsMouseArea);
+ Q_D(QDeclarativeMouseArea);
d->moved = false;
if (!d->absorb)
- QmlGraphicsItem::mousePressEvent(event);
+ QDeclarativeItem::mousePressEvent(event);
else {
d->longPress = false;
d->saveEvent(event);
if (d->drag) {
- d->dragX = drag()->axis() & QmlGraphicsDrag::XAxis;
- d->dragY = drag()->axis() & QmlGraphicsDrag::YAxis;
+ d->dragX = drag()->axis() & QDeclarativeDrag::XAxis;
+ d->dragY = drag()->axis() & QDeclarativeDrag::YAxis;
}
d->dragged = false;
setHovered(true);
d->start = event->pos();
d->startScene = event->scenePos();
// we should only start timer if pressAndHold is connected to.
- if (d->isConnected("pressAndHold(QmlGraphicsMouseEvent*)"))
+ if (d->isConnected("pressAndHold(QDeclarativeMouseEvent*)"))
d->pressAndHoldTimer.start(PressAndHoldDelay, this);
setKeepMouseGrab(false);
event->setAccepted(setPressed(true));
}
}
-void QmlGraphicsMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsMouseArea);
+ Q_D(QDeclarativeMouseArea);
if (!d->absorb) {
- QmlGraphicsItem::mouseMoveEvent(event);
+ QDeclarativeItem::mouseMoveEvent(event);
return;
}
@@ -458,16 +458,16 @@ void QmlGraphicsMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
d->moved = true;
- QmlGraphicsMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress);
+ QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress);
emit positionChanged(&me);
}
-void QmlGraphicsMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsMouseArea);
+ Q_D(QDeclarativeMouseArea);
if (!d->absorb) {
- QmlGraphicsItem::mouseReleaseEvent(event);
+ QDeclarativeItem::mouseReleaseEvent(event);
} else {
d->saveEvent(event);
setPressed(false);
@@ -478,57 +478,57 @@ void QmlGraphicsMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
}
}
-void QmlGraphicsMouseArea::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeMouseArea::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsMouseArea);
+ Q_D(QDeclarativeMouseArea);
if (!d->absorb) {
- QmlGraphicsItem::mouseDoubleClickEvent(event);
+ QDeclarativeItem::mouseDoubleClickEvent(event);
} else {
- QmlGraphicsItem::mouseDoubleClickEvent(event);
+ QDeclarativeItem::mouseDoubleClickEvent(event);
if (event->isAccepted()) {
// Only deliver the event if we have accepted the press.
d->saveEvent(event);
- QmlGraphicsMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, true, false);
+ QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, true, false);
emit this->doubleClicked(&me);
}
}
}
-void QmlGraphicsMouseArea::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
+void QDeclarativeMouseArea::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
- Q_D(QmlGraphicsMouseArea);
+ Q_D(QDeclarativeMouseArea);
if (!d->absorb)
- QmlGraphicsItem::hoverEnterEvent(event);
+ QDeclarativeItem::hoverEnterEvent(event);
else
setHovered(true);
}
-void QmlGraphicsMouseArea::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
+void QDeclarativeMouseArea::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
- Q_D(QmlGraphicsMouseArea);
+ Q_D(QDeclarativeMouseArea);
if (!d->absorb) {
- QmlGraphicsItem::hoverEnterEvent(event);
+ QDeclarativeItem::hoverEnterEvent(event);
} else {
d->lastPos = event->pos();
- QmlGraphicsMouseEvent me(d->lastPos.x(), d->lastPos.y(), Qt::NoButton, d->lastButtons, d->lastModifiers, false, d->longPress);
+ QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), Qt::NoButton, d->lastButtons, d->lastModifiers, false, d->longPress);
emit positionChanged(&me);
}
}
-void QmlGraphicsMouseArea::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+void QDeclarativeMouseArea::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
- Q_D(QmlGraphicsMouseArea);
+ Q_D(QDeclarativeMouseArea);
if (!d->absorb)
- QmlGraphicsItem::hoverLeaveEvent(event);
+ QDeclarativeItem::hoverLeaveEvent(event);
else
setHovered(false);
}
-bool QmlGraphicsMouseArea::sceneEvent(QEvent *event)
+bool QDeclarativeMouseArea::sceneEvent(QEvent *event)
{
- bool rv = QmlGraphicsItem::sceneEvent(event);
+ bool rv = QDeclarativeItem::sceneEvent(event);
if (event->type() == QEvent::UngrabMouse) {
- Q_D(QmlGraphicsMouseArea);
+ Q_D(QDeclarativeMouseArea);
if (d->pressed) {
// if our mouse grab has been removed (probably by Flickable), fix our
// state
@@ -541,14 +541,14 @@ bool QmlGraphicsMouseArea::sceneEvent(QEvent *event)
return rv;
}
-void QmlGraphicsMouseArea::timerEvent(QTimerEvent *event)
+void QDeclarativeMouseArea::timerEvent(QTimerEvent *event)
{
- Q_D(QmlGraphicsMouseArea);
+ Q_D(QDeclarativeMouseArea);
if (event->timerId() == d->pressAndHoldTimer.timerId()) {
d->pressAndHoldTimer.stop();
if (d->pressed && d->dragged == false && d->hovered == true) {
d->longPress = true;
- QmlGraphicsMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress);
+ QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress);
emit pressAndHold(&me);
}
}
@@ -567,30 +567,30 @@ void QmlGraphicsMouseArea::timerEvent(QTimerEvent *event)
/*!
\qmlproperty bool MouseArea::containsMouse
- This property holds whether the mouse is currently inside the mouse region.
+ This property holds whether the mouse is currently inside the mouse area.
- \warning This property is not updated if the region moves under the mouse: \e containsMouse will not change.
+ \warning This property is not updated if the area 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 QmlGraphicsMouseArea::hovered() const
+bool QDeclarativeMouseArea::hovered() const
{
- Q_D(const QmlGraphicsMouseArea);
+ Q_D(const QDeclarativeMouseArea);
return d->hovered;
}
/*!
\qmlproperty bool MouseArea::pressed
- This property holds whether the mouse region is currently pressed.
+ This property holds whether the mouse area is currently pressed.
*/
-bool QmlGraphicsMouseArea::pressed() const
+bool QDeclarativeMouseArea::pressed() const
{
- Q_D(const QmlGraphicsMouseArea);
+ Q_D(const QDeclarativeMouseArea);
return d->pressed;
}
-void QmlGraphicsMouseArea::setHovered(bool h)
+void QDeclarativeMouseArea::setHovered(bool h)
{
- Q_D(QmlGraphicsMouseArea);
+ Q_D(QDeclarativeMouseArea);
if (d->hovered != h) {
d->hovered = h;
emit hoveredChanged();
@@ -600,7 +600,7 @@ void QmlGraphicsMouseArea::setHovered(bool h)
/*!
\qmlproperty Qt::MouseButtons MouseArea::acceptedButtons
- This property holds the mouse buttons that the mouse region reacts to.
+ This property holds the mouse buttons that the mouse area reacts to.
The available buttons are:
\list
@@ -618,12 +618,12 @@ void QmlGraphicsMouseArea::setHovered(bool h)
The default is to accept the Left button.
*/
-Qt::MouseButtons QmlGraphicsMouseArea::acceptedButtons() const
+Qt::MouseButtons QDeclarativeMouseArea::acceptedButtons() const
{
return acceptedMouseButtons();
}
-void QmlGraphicsMouseArea::setAcceptedButtons(Qt::MouseButtons buttons)
+void QDeclarativeMouseArea::setAcceptedButtons(Qt::MouseButtons buttons)
{
if (buttons != acceptedMouseButtons()) {
setAcceptedMouseButtons(buttons);
@@ -631,14 +631,14 @@ void QmlGraphicsMouseArea::setAcceptedButtons(Qt::MouseButtons buttons)
}
}
-bool QmlGraphicsMouseArea::setPressed(bool p)
+bool QDeclarativeMouseArea::setPressed(bool p)
{
- Q_D(QmlGraphicsMouseArea);
+ Q_D(QDeclarativeMouseArea);
bool isclick = d->pressed == true && p == false && d->dragged == false && d->hovered == true;
if (d->pressed != p) {
d->pressed = p;
- QmlGraphicsMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress);
+ QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress);
if (d->pressed) {
emit positionChanged(&me);
emit pressed(&me);
@@ -654,11 +654,11 @@ bool QmlGraphicsMouseArea::setPressed(bool p)
return false;
}
-QmlGraphicsDrag *QmlGraphicsMouseArea::drag()
+QDeclarativeDrag *QDeclarativeMouseArea::drag()
{
- Q_D(QmlGraphicsMouseArea);
+ Q_D(QDeclarativeMouseArea);
if (!d->drag)
- d->drag = new QmlGraphicsDrag;
+ d->drag = new QDeclarativeDrag;
return d->drag;
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsmousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
index 2e2f8c9..33422e2 100644
--- a/src/declarative/graphicsitems/qmlgraphicsmousearea_p.h
+++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSMOUSEAREA_H
-#define QMLGRAPHICSMOUSEAREA_H
+#ifndef QDECLARATIVEMOUSEAREA_H
+#define QDECLARATIVEMOUSEAREA_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
QT_BEGIN_HEADER
@@ -50,12 +50,12 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class Q_DECLARATIVE_EXPORT QmlGraphicsDrag : public QObject
+class Q_DECLARATIVE_EXPORT QDeclarativeDrag : public QObject
{
Q_OBJECT
Q_ENUMS(Axis)
- Q_PROPERTY(QmlGraphicsItem *target READ target WRITE setTarget NOTIFY targetChanged)
+ Q_PROPERTY(QDeclarativeItem *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)
@@ -64,11 +64,11 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsDrag : public QObject
//### consider drag and drop
public:
- QmlGraphicsDrag(QObject *parent=0);
- ~QmlGraphicsDrag();
+ QDeclarativeDrag(QObject *parent=0);
+ ~QDeclarativeDrag();
- QmlGraphicsItem *target() const;
- void setTarget(QmlGraphicsItem *);
+ QDeclarativeItem *target() const;
+ void setTarget(QDeclarativeItem *);
enum Axis { XAxis=0x01, YAxis=0x02, XandYAxis=0x03 };
Axis axis() const;
@@ -92,18 +92,18 @@ Q_SIGNALS:
void maximumYChanged();
private:
- QmlGraphicsItem *_target;
+ QDeclarativeItem *_target;
Axis _axis;
qreal _xmin;
qreal _xmax;
qreal _ymin;
qreal _ymax;
- Q_DISABLE_COPY(QmlGraphicsDrag)
+ Q_DISABLE_COPY(QDeclarativeDrag)
};
-class QmlGraphicsMouseEvent;
-class QmlGraphicsMouseAreaPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsMouseArea : public QmlGraphicsItem
+class QDeclarativeMouseEvent;
+class QDeclarativeMouseAreaPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeMouseArea : public QDeclarativeItem
{
Q_OBJECT
@@ -115,11 +115,11 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsMouseArea : 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 CONSTANT) //### add flicking to QmlGraphicsDrag or add a QmlGraphicsFlick ???
+ Q_PROPERTY(QDeclarativeDrag *drag READ drag CONSTANT) //### add flicking to QDeclarativeDrag or add a QDeclarativeFlick ???
public:
- QmlGraphicsMouseArea(QmlGraphicsItem *parent=0);
- ~QmlGraphicsMouseArea();
+ QDeclarativeMouseArea(QDeclarativeItem *parent=0);
+ ~QDeclarativeMouseArea();
qreal mouseX() const;
qreal mouseY() const;
@@ -135,20 +135,20 @@ public:
Qt::MouseButtons acceptedButtons() const;
void setAcceptedButtons(Qt::MouseButtons buttons);
- QmlGraphicsDrag *drag();
+ QDeclarativeDrag *drag();
Q_SIGNALS:
void hoveredChanged();
void pressedChanged();
void enabledChanged();
void acceptedButtonsChanged();
- void positionChanged(QmlGraphicsMouseEvent *mouse);
+ void positionChanged(QDeclarativeMouseEvent *mouse);
- void pressed(QmlGraphicsMouseEvent *mouse);
- void pressAndHold(QmlGraphicsMouseEvent *mouse);
- void released(QmlGraphicsMouseEvent *mouse);
- void clicked(QmlGraphicsMouseEvent *mouse);
- void doubleClicked(QmlGraphicsMouseEvent *mouse);
+ void pressed(QDeclarativeMouseEvent *mouse);
+ void pressAndHold(QDeclarativeMouseEvent *mouse);
+ void released(QDeclarativeMouseEvent *mouse);
+ void clicked(QDeclarativeMouseEvent *mouse);
+ void doubleClicked(QDeclarativeMouseEvent *mouse);
void entered();
void exited();
@@ -171,15 +171,15 @@ private:
void handleRelease();
private:
- Q_DISABLE_COPY(QmlGraphicsMouseArea)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsMouseArea)
+ Q_DISABLE_COPY(QDeclarativeMouseArea)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeMouseArea)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsDrag)
-QML_DECLARE_TYPE(QmlGraphicsMouseArea)
+QML_DECLARE_TYPE(QDeclarativeDrag)
+QML_DECLARE_TYPE(QDeclarativeMouseArea)
QT_END_HEADER
-#endif // QMLGRAPHICSMOUSEAREA_H
+#endif // QDECLARATIVEMOUSEAREA_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsmousearea_p_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h
index fadb430..d4871f2 100644
--- a/src/declarative/graphicsitems/qmlgraphicsmousearea_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSMOUSEREGION_P_H
-#define QMLGRAPHICSMOUSEREGION_P_H
+#ifndef QDECLARATIVEMOUSEREGION_P_H
+#define QDECLARATIVEMOUSEREGION_P_H
//
// W A R N I N G
@@ -53,7 +53,7 @@
// We mean it.
//
-#include "qmlgraphicsitem_p.h"
+#include "qdeclarativeitem_p.h"
#include <qdatetime.h>
#include <qbasictimer.h>
@@ -61,21 +61,21 @@
QT_BEGIN_NAMESPACE
-class QmlGraphicsMouseAreaPrivate : public QmlGraphicsItemPrivate
+class QDeclarativeMouseAreaPrivate : public QDeclarativeItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsMouseArea)
+ Q_DECLARE_PUBLIC(QDeclarativeMouseArea)
public:
- QmlGraphicsMouseAreaPrivate()
+ QDeclarativeMouseAreaPrivate()
: absorb(true), hovered(false), pressed(false), longPress(false), drag(0)
{
}
- ~QmlGraphicsMouseAreaPrivate();
+ ~QDeclarativeMouseAreaPrivate();
void init()
{
- Q_Q(QmlGraphicsMouseArea);
+ Q_Q(QDeclarativeMouseArea);
q->setAcceptedMouseButtons(Qt::LeftButton);
}
@@ -87,7 +87,7 @@ public:
}
bool isConnected(const char *signal) {
- Q_Q(QmlGraphicsMouseArea);
+ Q_Q(QDeclarativeMouseArea);
int idx = QObjectPrivate::get(q)->signalIndex(signal);
return QObjectPrivate::get(q)->isSignalConnected(idx);
}
@@ -100,7 +100,7 @@ public:
bool dragX : 1;
bool dragY : 1;
bool dragged : 1;
- QmlGraphicsDrag *drag;
+ QDeclarativeDrag *drag;
QPointF start;
QPointF startScene;
qreal startX;
@@ -114,4 +114,4 @@ public:
QT_END_NAMESPACE
-#endif // QMLGRAPHICSMOUSEREGION_P_H
+#endif // QDECLARATIVEMOUSEREGION_P_H
diff --git a/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
index 3daa0c6..ab6007a 100644
--- a/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#include "qmlgraphicspainteditem_p.h"
-#include "qmlgraphicspainteditem_p_p.h"
+#include "qdeclarativepainteditem_p.h"
+#include "qdeclarativepainteditem_p_p.h"
#include <QDebug>
#include <QPen>
@@ -55,8 +55,8 @@
QT_BEGIN_NAMESPACE
/*!
- \class QmlGraphicsPaintedItem
- \brief The QmlGraphicsPaintedItem class is an abstract base class for QmlView items that want cached painting.
+ \class QDeclarativePaintedItem
+ \brief The QDeclarativePaintedItem class is an abstract base class for QDeclarativeView items that want cached painting.
\internal
This is a convenience class for implementing items that paint their contents
@@ -64,21 +64,21 @@ QT_BEGIN_NAMESPACE
The dirtyCache() function should be called if the contents change to
ensure the cache is refreshed the next time painting occurs.
- To subclass QmlGraphicsPaintedItem, you must reimplement drawContents() to draw
+ To subclass QDeclarativePaintedItem, you must reimplement drawContents() to draw
the contents of the item.
*/
/*!
- \fn void QmlGraphicsPaintedItem::drawContents(QPainter *painter, const QRect &rect)
+ \fn void QDeclarativePaintedItem::drawContents(QPainter *painter, const QRect &rect)
This function is called when the cache needs to be refreshed. When
- sub-classing QmlGraphicsPaintedItem this function should be implemented so as to
+ sub-classing QDeclarativePaintedItem this function should be implemented so as to
paint the contents of the item using the given \a painter for the
area of the contents specified by \a rect.
*/
/*!
- \property QmlGraphicsPaintedItem::contentsSize
+ \property QDeclarativePaintedItem::contentsSize
\brief The size of the contents
The contents size is the size of the item in regards to how it is painted
@@ -96,15 +96,15 @@ static int inpaint_clearcache=0;
\sa clearCache()
*/
-void QmlGraphicsPaintedItem::dirtyCache(const QRect& rect)
+void QDeclarativePaintedItem::dirtyCache(const QRect& rect)
{
- Q_D(QmlGraphicsPaintedItem);
+ Q_D(QDeclarativePaintedItem);
QRect srect(qCeil(rect.x()*d->contentsScale),
qCeil(rect.y()*d->contentsScale),
qCeil(rect.width()*d->contentsScale),
qCeil(rect.height()*d->contentsScale));
for (int i=0; i < d->imagecache.count(); ) {
- QmlGraphicsPaintedItemPrivate::ImageCacheItem *c = d->imagecache[i];
+ QDeclarativePaintedItemPrivate::ImageCacheItem *c = d->imagecache[i];
QRect isect = (c->area & srect) | c->dirty;
if (isect == c->area && !inpaint) {
delete d->imagecache.takeAt(i);
@@ -120,13 +120,13 @@ void QmlGraphicsPaintedItem::dirtyCache(const QRect& rect)
\sa dirtyCache()
*/
-void QmlGraphicsPaintedItem::clearCache()
+void QDeclarativePaintedItem::clearCache()
{
if (inpaint) {
inpaint_clearcache=1;
return;
}
- Q_D(QmlGraphicsPaintedItem);
+ Q_D(QDeclarativePaintedItem);
qDeleteAll(d->imagecache);
d->imagecache.clear();
}
@@ -136,9 +136,9 @@ void QmlGraphicsPaintedItem::clearCache()
\sa setContentsSize()
*/
-QSize QmlGraphicsPaintedItem::contentsSize() const
+QSize QDeclarativePaintedItem::contentsSize() const
{
- Q_D(const QmlGraphicsPaintedItem);
+ Q_D(const QDeclarativePaintedItem);
return d->contentsSize;
}
@@ -147,9 +147,9 @@ QSize QmlGraphicsPaintedItem::contentsSize() const
\sa contentsSize()
*/
-void QmlGraphicsPaintedItem::setContentsSize(const QSize &size)
+void QDeclarativePaintedItem::setContentsSize(const QSize &size)
{
- Q_D(QmlGraphicsPaintedItem);
+ Q_D(QDeclarativePaintedItem);
if (d->contentsSize == size) return;
d->contentsSize = size;
setImplicitWidth(size.width()*d->contentsScale);
@@ -159,15 +159,15 @@ void QmlGraphicsPaintedItem::setContentsSize(const QSize &size)
emit contentsSizeChanged();
}
-qreal QmlGraphicsPaintedItem::contentsScale() const
+qreal QDeclarativePaintedItem::contentsScale() const
{
- Q_D(const QmlGraphicsPaintedItem);
+ Q_D(const QDeclarativePaintedItem);
return d->contentsScale;
}
-void QmlGraphicsPaintedItem::setContentsScale(qreal scale)
+void QDeclarativePaintedItem::setContentsScale(qreal scale)
{
- Q_D(QmlGraphicsPaintedItem);
+ Q_D(QDeclarativePaintedItem);
if (d->contentsScale == scale) return;
d->contentsScale = scale;
setImplicitWidth(d->contentsSize.width()*scale);
@@ -179,21 +179,21 @@ void QmlGraphicsPaintedItem::setContentsScale(qreal scale)
/*!
- Constructs a new QmlGraphicsPaintedItem with the given \a parent.
+ Constructs a new QDeclarativePaintedItem with the given \a parent.
*/
-QmlGraphicsPaintedItem::QmlGraphicsPaintedItem(QmlGraphicsItem *parent)
- : QmlGraphicsItem(*(new QmlGraphicsPaintedItemPrivate), parent)
+QDeclarativePaintedItem::QDeclarativePaintedItem(QDeclarativeItem *parent)
+ : QDeclarativeItem(*(new QDeclarativePaintedItemPrivate), parent)
{
init();
}
/*!
\internal
- Constructs a new QmlGraphicsPaintedItem with the given \a parent and
+ Constructs a new QDeclarativePaintedItem with the given \a parent and
initialized private data member \a dd.
*/
-QmlGraphicsPaintedItem::QmlGraphicsPaintedItem(QmlGraphicsPaintedItemPrivate &dd, QmlGraphicsItem *parent)
- : QmlGraphicsItem(dd, parent)
+QDeclarativePaintedItem::QDeclarativePaintedItem(QDeclarativePaintedItemPrivate &dd, QDeclarativeItem *parent)
+ : QDeclarativeItem(dd, parent)
{
init();
}
@@ -201,7 +201,7 @@ QmlGraphicsPaintedItem::QmlGraphicsPaintedItem(QmlGraphicsPaintedItemPrivate &dd
/*!
Destroys the image item.
*/
-QmlGraphicsPaintedItem::~QmlGraphicsPaintedItem()
+QDeclarativePaintedItem::~QDeclarativePaintedItem()
{
clearCache();
}
@@ -209,16 +209,16 @@ QmlGraphicsPaintedItem::~QmlGraphicsPaintedItem()
/*!
\internal
*/
-void QmlGraphicsPaintedItem::init()
+void QDeclarativePaintedItem::init()
{
connect(this,SIGNAL(widthChanged()),this,SLOT(clearCache()));
connect(this,SIGNAL(heightChanged()),this,SLOT(clearCache()));
connect(this,SIGNAL(visibleChanged()),this,SLOT(clearCache()));
}
-void QmlGraphicsPaintedItem::setCacheFrozen(bool frozen)
+void QDeclarativePaintedItem::setCacheFrozen(bool frozen)
{
- Q_D(QmlGraphicsPaintedItem);
+ Q_D(QDeclarativePaintedItem);
if (d->cachefrozen == frozen)
return;
d->cachefrozen = frozen;
@@ -228,9 +228,9 @@ void QmlGraphicsPaintedItem::setCacheFrozen(bool frozen)
/*!
\reimp
*/
-void QmlGraphicsPaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
+void QDeclarativePaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
- Q_D(QmlGraphicsPaintedItem);
+ Q_D(QDeclarativePaintedItem);
const QRect content(0,0,qCeil(d->contentsSize.width()*d->contentsScale),
qCeil(d->contentsSize.height()*d->contentsScale));
if (content.width() <= 0 || content.height() <= 0)
@@ -344,7 +344,7 @@ void QmlGraphicsPaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem *
qCeil(r.height()/d->contentsScale+r.y()/d->contentsScale-qFloor(r.y()/d->contentsScale)));
drawContents(&qp, sclip);
}
- QmlGraphicsPaintedItemPrivate::ImageCacheItem *newitem = new QmlGraphicsPaintedItemPrivate::ImageCacheItem;
+ QDeclarativePaintedItemPrivate::ImageCacheItem *newitem = new QDeclarativePaintedItemPrivate::ImageCacheItem;
newitem->area = r;
newitem->image = img;
d->imagecache.append(newitem);
@@ -373,21 +373,21 @@ void QmlGraphicsPaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem *
than the (unscaled) size of the WebView.
*/
/*!
- \property QmlGraphicsPaintedItem::pixelCacheSize
+ \property QDeclarativePaintedItem::pixelCacheSize
The maximum number of pixels of image cache to allow. The default
is 0.1 megapixels. The cache will not be larger than the (unscaled)
- size of the QmlGraphicsPaintedItem.
+ size of the QDeclarativePaintedItem.
*/
-int QmlGraphicsPaintedItem::pixelCacheSize() const
+int QDeclarativePaintedItem::pixelCacheSize() const
{
- Q_D(const QmlGraphicsPaintedItem);
+ Q_D(const QDeclarativePaintedItem);
return d->max_imagecache_size;
}
-void QmlGraphicsPaintedItem::setPixelCacheSize(int pixels)
+void QDeclarativePaintedItem::setPixelCacheSize(int pixels)
{
- Q_D(QmlGraphicsPaintedItem);
+ Q_D(QDeclarativePaintedItem);
if (pixels < d->max_imagecache_size) {
int cachesize=0;
for (int i=0; i<d->imagecache.count(); ++i) {
@@ -414,7 +414,7 @@ void QmlGraphicsPaintedItem::setPixelCacheSize(int pixels)
/*!
- \property QmlGraphicsPaintedItem::fillColor
+ \property QDeclarativePaintedItem::fillColor
The color to be used to fill the item prior to calling drawContents().
By default, this is Qt::transparent.
@@ -422,9 +422,9 @@ void QmlGraphicsPaintedItem::setPixelCacheSize(int pixels)
Performance improvements can be achieved if subclasses call this with either an
invalid color (QColor()), or an appropriate solid color.
*/
-void QmlGraphicsPaintedItem::setFillColor(const QColor& c)
+void QDeclarativePaintedItem::setFillColor(const QColor& c)
{
- Q_D(QmlGraphicsPaintedItem);
+ Q_D(QDeclarativePaintedItem);
if (d->fillColor == c)
return;
d->fillColor = c;
@@ -432,9 +432,9 @@ void QmlGraphicsPaintedItem::setFillColor(const QColor& c)
update();
}
-QColor QmlGraphicsPaintedItem::fillColor() const
+QColor QDeclarativePaintedItem::fillColor() const
{
- Q_D(const QmlGraphicsPaintedItem);
+ Q_D(const QDeclarativePaintedItem);
return d->fillColor;
}
@@ -447,15 +447,15 @@ QColor QmlGraphicsPaintedItem::fillColor() const
This is in addition toe Item::smooth, which controls the smooth painting of
the already-painted cached tiles under transformation.
*/
-bool QmlGraphicsPaintedItem::smoothCache() const
+bool QDeclarativePaintedItem::smoothCache() const
{
- Q_D(const QmlGraphicsPaintedItem);
+ Q_D(const QDeclarativePaintedItem);
return d->smoothCache;
}
-void QmlGraphicsPaintedItem::setSmoothCache(bool on)
+void QDeclarativePaintedItem::setSmoothCache(bool on)
{
- Q_D(QmlGraphicsPaintedItem);
+ Q_D(QDeclarativePaintedItem);
if (d->smoothCache != on) {
d->smoothCache = on;
clearCache();
diff --git a/src/declarative/graphicsitems/qmlgraphicspainteditem_p.h b/src/declarative/graphicsitems/qdeclarativepainteditem_p.h
index f2f9be0..cc616af 100644
--- a/src/declarative/graphicsitems/qmlgraphicspainteditem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepainteditem_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSIMAGEITEM_H
-#define QMLGRAPHICSIMAGEITEM_H
+#ifndef QDECLARATIVEIMAGEITEM_H
+#define QDECLARATIVEIMAGEITEM_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
QT_BEGIN_HEADER
@@ -50,8 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsPaintedItemPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsPaintedItem : public QmlGraphicsItem
+class QDeclarativePaintedItemPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativePaintedItem : public QDeclarativeItem
{
Q_OBJECT
@@ -63,8 +63,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsPaintedItem : public QmlGraphicsItem
public:
- QmlGraphicsPaintedItem(QmlGraphicsItem *parent=0);
- ~QmlGraphicsPaintedItem();
+ QDeclarativePaintedItem(QDeclarativeItem *parent=0);
+ ~QDeclarativePaintedItem();
QSize contentsSize() const;
void setContentsSize(const QSize &);
@@ -84,7 +84,7 @@ public:
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
protected:
- QmlGraphicsPaintedItem(QmlGraphicsPaintedItemPrivate &dd, QmlGraphicsItem *parent);
+ QDeclarativePaintedItem(QDeclarativePaintedItemPrivate &dd, QDeclarativeItem *parent);
virtual void drawContents(QPainter *p, const QRect &) = 0;
@@ -101,13 +101,13 @@ protected Q_SLOTS:
private:
void init();
- Q_DISABLE_COPY(QmlGraphicsPaintedItem)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsPaintedItem)
+ Q_DISABLE_COPY(QDeclarativePaintedItem)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativePaintedItem)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsPaintedItem)
+QML_DECLARE_TYPE(QDeclarativePaintedItem)
QT_END_HEADER
diff --git a/src/declarative/graphicsitems/qmlgraphicspainteditem_p_p.h b/src/declarative/graphicsitems/qdeclarativepainteditem_p_p.h
index 7d49914..a15febb 100644
--- a/src/declarative/graphicsitems/qmlgraphicspainteditem_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepainteditem_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSIMAGEITEM_P_H
-#define QMLGRAPHICSIMAGEITEM_P_H
+#ifndef QDECLARATIVEIMAGEITEM_P_H
+#define QDECLARATIVEIMAGEITEM_P_H
//
// W A R N I N G
@@ -53,16 +53,16 @@
// We mean it.
//
-#include "qmlgraphicsitem_p.h"
+#include "qdeclarativeitem_p.h"
QT_BEGIN_NAMESPACE
-class QmlGraphicsPaintedItemPrivate : public QmlGraphicsItemPrivate
+class QDeclarativePaintedItemPrivate : public QDeclarativeItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsPaintedItem)
+ Q_DECLARE_PUBLIC(QDeclarativePaintedItem)
public:
- QmlGraphicsPaintedItemPrivate()
+ QDeclarativePaintedItemPrivate()
: max_imagecache_size(100000), contentsScale(1.0), fillColor(Qt::transparent), cachefrozen(false), smoothCache(true)
{
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsparticles.cpp b/src/declarative/graphicsitems/qdeclarativeparticles.cpp
index 14c7c71..1a58d3f 100644
--- a/src/declarative/graphicsitems/qmlgraphicsparticles.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeparticles.cpp
@@ -39,13 +39,13 @@
**
****************************************************************************/
-#include "qmlgraphicsparticles_p.h"
+#include "qdeclarativeparticles_p.h"
-#include "qmlgraphicsitem_p.h"
+#include "qdeclarativeitem_p.h"
-#include <qmlpixmapcache_p.h>
+#include <qdeclarativepixmapcache_p.h>
#include <qfxperf_p_p.h>
-#include <qmlanimation_p_p.h>
+#include <qdeclarativeanimation_p_p.h>
#include <QNetworkReply>
#include <QPainter>
@@ -84,10 +84,10 @@ inline qreal fastCos(qreal theta)
return fastSin(theta);
}
-class QmlGraphicsParticle
+class QDeclarativeParticle
{
public:
- QmlGraphicsParticle(int time) : lifeSpan(1000), fadeOutAge(800)
+ QDeclarativeParticle(int time) : lifeSpan(1000), fadeOutAge(800)
, opacity(0), birthTime(time), x_velocity(0), y_velocity(0)
, state(FadeIn), data(0)
{
@@ -109,18 +109,18 @@ public:
//---------------------------------------------------------------------------
/*!
- \class QmlGraphicsParticleMotion
+ \class QDeclarativeParticleMotion
\ingroup group_effects
- \brief The QmlGraphicsParticleMotion class is the base class for particle motion.
+ \brief The QDeclarativeParticleMotion class is the base class for particle motion.
\internal
This class causes the particles to remain static.
*/
/*!
- Constructs a QmlGraphicsParticleMotion with parent object \a parent.
+ Constructs a QDeclarativeParticleMotion with parent object \a parent.
*/
-QmlGraphicsParticleMotion::QmlGraphicsParticleMotion(QObject *parent) :
+QDeclarativeParticleMotion::QDeclarativeParticleMotion(QObject *parent) :
QObject(parent)
{
}
@@ -129,7 +129,7 @@ QmlGraphicsParticleMotion::QmlGraphicsParticleMotion(QObject *parent) :
Move the \a particle to its new position. \a interval is the number of
milliseconds elapsed since it was last moved.
*/
-void QmlGraphicsParticleMotion::advance(QmlGraphicsParticle &particle, int interval)
+void QDeclarativeParticleMotion::advance(QDeclarativeParticle &particle, int interval)
{
Q_UNUSED(particle);
Q_UNUSED(interval);
@@ -139,7 +139,7 @@ void QmlGraphicsParticleMotion::advance(QmlGraphicsParticle &particle, int inter
The \a particle has just been created. Some motion strategies require
additional state information. This can be allocated by this function.
*/
-void QmlGraphicsParticleMotion::created(QmlGraphicsParticle &particle)
+void QDeclarativeParticleMotion::created(QDeclarativeParticle &particle)
{
Q_UNUSED(particle);
}
@@ -148,7 +148,7 @@ void QmlGraphicsParticleMotion::created(QmlGraphicsParticle &particle)
The \a particle is about to be destroyed. Any additional memory
that has been allocated for the particle should be freed.
*/
-void QmlGraphicsParticleMotion::destroy(QmlGraphicsParticle &particle)
+void QDeclarativeParticleMotion::destroy(QDeclarativeParticle &particle)
{
Q_UNUSED(particle);
}
@@ -163,12 +163,12 @@ void QmlGraphicsParticleMotion::destroy(QmlGraphicsParticle &particle)
/*!
\internal
- \class QmlGraphicsParticleMotionLinear
+ \class QDeclarativeParticleMotionLinear
\ingroup group_effects
- \brief The QmlGraphicsParticleMotionLinear class moves the particles linearly.
+ \brief The QDeclarativeParticleMotionLinear class moves the particles linearly.
*/
-void QmlGraphicsParticleMotionLinear::advance(QmlGraphicsParticle &p, int interval)
+void QDeclarativeParticleMotionLinear::advance(QDeclarativeParticle &p, int interval)
{
p.x += interval * p.x_velocity;
p.y += interval * p.y_velocity;
@@ -184,38 +184,63 @@ void QmlGraphicsParticleMotionLinear::advance(QmlGraphicsParticle &p, int interv
/*!
\internal
- \class QmlGraphicsParticleMotionGravity
+ \class QDeclarativeParticleMotionGravity
\ingroup group_effects
- \brief The QmlGraphicsParticleMotionGravity class moves the particles towards a point.
+ \brief The QDeclarativeParticleMotionGravity class moves the particles towards a point.
*/
/*!
- \qmlproperty int ParticleMotionGravity::xattractor
- \qmlproperty int ParticleMotionGravity::yattractor
+ \qmlproperty qreal ParticleMotionGravity::xattractor
+ \qmlproperty qreal ParticleMotionGravity::yattractor
These properties hold the x and y coordinates of the point attracting the particles.
*/
/*!
- \qmlproperty int ParticleMotionGravity::acceleration
+ \qmlproperty qreal ParticleMotionGravity::acceleration
This property holds the acceleration to apply to the particles.
*/
/*!
- \property QmlGraphicsParticleMotionGravity::xattractor
+ \property QDeclarativeParticleMotionGravity::xattractor
\brief the x coordinate of the point attracting the particles.
*/
/*!
- \property QmlGraphicsParticleMotionGravity::yattractor
+ \property QDeclarativeParticleMotionGravity::yattractor
\brief the y coordinate of the point attracting the particles.
*/
/*!
- \property QmlGraphicsParticleMotionGravity::acceleration
+ \property QDeclarativeParticleMotionGravity::acceleration
\brief the acceleration to apply to the particles.
*/
-void QmlGraphicsParticleMotionGravity::advance(QmlGraphicsParticle &p, int interval)
+void QDeclarativeParticleMotionGravity::setXAttractor(qreal x)
+{
+ if (qFuzzyCompare(x, _xAttr))
+ return;
+ _xAttr = x;
+ emit xattractorChanged();
+}
+
+void QDeclarativeParticleMotionGravity::setYAttractor(qreal y)
+{
+ if (qFuzzyCompare(y, _yAttr))
+ return;
+ _yAttr = y;
+ emit yattractorChanged();
+}
+
+void QDeclarativeParticleMotionGravity::setAcceleration(qreal accel)
+{
+ qreal scaledAccel = accel/1000000.0;
+ if (qFuzzyCompare(scaledAccel, _accel))
+ return;
+ _accel = scaledAccel;
+ emit accelerationChanged();
+}
+
+void QDeclarativeParticleMotionGravity::advance(QDeclarativeParticle &p, int interval)
{
qreal xdiff = p.x - _xAttr;
qreal ydiff = p.y - _yAttr;
@@ -270,30 +295,30 @@ Rectangle {
/*!
\internal
- \class QmlGraphicsParticleMotionWander
+ \class QDeclarativeParticleMotionWander
\ingroup group_effects
- \brief The QmlGraphicsParticleMotionWander class moves particles in a somewhat random fashion.
+ \brief The QDeclarativeParticleMotionWander class moves particles in a somewhat random fashion.
The particles will continue roughly in the original direction, however will randomly
drift to each side.
*/
/*!
- \qmlproperty int QmlGraphicsParticleMotionWander::xvariance
- \qmlproperty int QmlGraphicsParticleMotionWander::yvariance
+ \qmlproperty qreal QDeclarativeParticleMotionWander::xvariance
+ \qmlproperty qreal QDeclarativeParticleMotionWander::yvariance
These properties set the amount to wander in the x and y directions.
*/
/*!
- \qmlproperty int QmlGraphicsParticleMotionWander::pace
+ \qmlproperty qreal QDeclarativeParticleMotionWander::pace
This property holds how quickly the paricles will move from side to side.
*/
-void QmlGraphicsParticleMotionWander::advance(QmlGraphicsParticle &p, int interval)
+void QDeclarativeParticleMotionWander::advance(QDeclarativeParticle &p, int interval)
{
if (!particles)
- particles = qobject_cast<QmlGraphicsParticles*>(parent());
+ particles = qobject_cast<QDeclarativeParticles*>(parent());
if (particles) {
Data *d = (Data*)p.data;
if (_xvariance != 0.) {
@@ -318,7 +343,7 @@ void QmlGraphicsParticleMotionWander::advance(QmlGraphicsParticle &p, int interv
}
}
-void QmlGraphicsParticleMotionWander::created(QmlGraphicsParticle &p)
+void QDeclarativeParticleMotionWander::created(QDeclarativeParticle &p)
{
if (!p.data) {
Data *d = new Data;
@@ -332,18 +357,45 @@ void QmlGraphicsParticleMotionWander::created(QmlGraphicsParticle &p)
}
}
-void QmlGraphicsParticleMotionWander::destroy(QmlGraphicsParticle &p)
+void QDeclarativeParticleMotionWander::destroy(QDeclarativeParticle &p)
{
if (p.data)
delete (Data*)p.data;
}
+void QDeclarativeParticleMotionWander::setXVariance(qreal var)
+{
+ qreal scaledVar = var / 1000.0;
+ if (qFuzzyCompare(scaledVar, _xvariance))
+ return;
+ _xvariance = scaledVar;
+ emit xvarianceChanged();
+}
+
+void QDeclarativeParticleMotionWander::setYVariance(qreal var)
+{
+ qreal scaledVar = var / 1000.0;
+ if (qFuzzyCompare(scaledVar, _yvariance))
+ return;
+ _yvariance = scaledVar;
+ emit yvarianceChanged();
+}
+
+void QDeclarativeParticleMotionWander::setPace(qreal pace)
+{
+ qreal scaledPace = pace / 1000.0;
+ if (qFuzzyCompare(scaledPace, _pace))
+ return;
+ _pace = scaledPace;
+ emit paceChanged();
+}
+
//---------------------------------------------------------------------------
-class QmlGraphicsParticlesPainter : public QmlGraphicsItem
+class QDeclarativeParticlesPainter : public QDeclarativeItem
{
public:
- QmlGraphicsParticlesPainter(QmlGraphicsParticlesPrivate *p, QmlGraphicsItem* parent)
- : QmlGraphicsItem(parent), d(p)
+ QDeclarativeParticlesPainter(QDeclarativeParticlesPrivate *p, QDeclarativeItem* parent)
+ : QDeclarativeItem(parent), d(p)
{
setFlag(QGraphicsItem::ItemHasNoContents, false);
maxX = minX = maxY = minY = 0;
@@ -357,15 +409,15 @@ public:
qreal minX;
qreal maxY;
qreal minY;
- QmlGraphicsParticlesPrivate* d;
+ QDeclarativeParticlesPrivate* d;
};
//---------------------------------------------------------------------------
-class QmlGraphicsParticlesPrivate : public QmlGraphicsItemPrivate
+class QDeclarativeParticlesPrivate : public QDeclarativeItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsParticles)
+ Q_DECLARE_PUBLIC(QDeclarativeParticles)
public:
- QmlGraphicsParticlesPrivate()
+ QDeclarativeParticlesPrivate()
: count(1), emissionRate(-1), emissionVariance(0.5), lifeSpan(1000)
, lifeSpanDev(1000), fadeInDur(200), fadeOutDur(300)
, angle(0), angleDev(0), velocity(0), velocityDev(0), emissionCarry(0.)
@@ -374,19 +426,19 @@ public:
{
}
- ~QmlGraphicsParticlesPrivate()
+ ~QDeclarativeParticlesPrivate()
{
}
void init()
{
- Q_Q(QmlGraphicsParticles);
- paintItem = new QmlGraphicsParticlesPainter(this, q);
+ Q_Q(QDeclarativeParticles);
+ paintItem = new QDeclarativeParticlesPainter(this, q);
}
void tick(int time);
void createParticle(int time);
- void updateOpacity(QmlGraphicsParticle &p, int age);
+ void updateOpacity(QDeclarativeParticle &p, int age);
QUrl url;
QPixmap image;
@@ -405,31 +457,31 @@ public:
int addParticleTime;
int addParticleCount;
int lastAdvTime;
- QmlGraphicsParticleMotion *motion;
- QmlGraphicsParticlesPainter *paintItem;
+ QDeclarativeParticleMotion *motion;
+ QDeclarativeParticlesPainter *paintItem;
bool pendingPixmapCache;
QList<QPair<int, int> > bursts;//countLeft, emissionRate pairs
- QList<QmlGraphicsParticle> particles;
- QTickAnimationProxy<QmlGraphicsParticlesPrivate, &QmlGraphicsParticlesPrivate::tick> clock;
+ QList<QDeclarativeParticle> particles;
+ QTickAnimationProxy<QDeclarativeParticlesPrivate, &QDeclarativeParticlesPrivate::tick> clock;
};
-void QmlGraphicsParticlesPrivate::tick(int time)
+void QDeclarativeParticlesPrivate::tick(int time)
{
- Q_Q(QmlGraphicsParticles);
+ Q_Q(QDeclarativeParticles);
if (!motion)
- motion = new QmlGraphicsParticleMotionLinear(q);
+ motion = new QDeclarativeParticleMotionLinear(q);
int oldCount = particles.count();
int removed = 0;
int interval = time - lastAdvTime;
for (int i = 0; i < particles.count(); ) {
- QmlGraphicsParticle &particle = particles[i];
+ QDeclarativeParticle &particle = particles[i];
int age = time - particle.birthTime;
if (age >= particle.lifeSpan) {
- QmlGraphicsParticle part = particles.takeAt(i);
+ QDeclarativeParticle part = particles.takeAt(i);
motion->destroy(part);
++removed;
} else {
@@ -500,13 +552,13 @@ void QmlGraphicsParticlesPrivate::tick(int time)
}
}
-void QmlGraphicsParticlesPrivate::createParticle(int time)
+void QDeclarativeParticlesPrivate::createParticle(int time)
{
#ifdef Q_ENABLE_PERFORMANCE_LOG
- QmlPerfTimer<QmlPerf::CreateParticle> x;
+ QDeclarativePerfTimer<QDeclarativePerf::CreateParticle> x;
#endif
- Q_Q(QmlGraphicsParticles);
- QmlGraphicsParticle p(time);
+ Q_Q(QDeclarativeParticles);
+ QDeclarativeParticle p(time);
p.x = q->x() + q->width() * qreal(qrand()) / RAND_MAX - image.width()/2.0;
p.y = q->y() + q->height() * qreal(qrand()) / RAND_MAX - image.height()/2.0;
p.lifeSpan = lifeSpan;
@@ -514,7 +566,7 @@ void QmlGraphicsParticlesPrivate::createParticle(int time)
p.lifeSpan += int(lifeSpanDev/2 - lifeSpanDev * qreal(qrand()) / RAND_MAX);
p.fadeOutAge = p.lifeSpan - fadeOutDur;
if (fadeInDur == 0.) {
- p.state= QmlGraphicsParticle::Solid;
+ p.state= QDeclarativeParticle::Solid;
p.opacity = 1.0;
}
qreal a = angle;
@@ -531,26 +583,26 @@ void QmlGraphicsParticlesPrivate::createParticle(int time)
motion->created(particles.last());
}
-void QmlGraphicsParticlesPrivate::updateOpacity(QmlGraphicsParticle &p, int age)
+void QDeclarativeParticlesPrivate::updateOpacity(QDeclarativeParticle &p, int age)
{
switch (p.state) {
- case QmlGraphicsParticle::FadeIn:
+ case QDeclarativeParticle::FadeIn:
if (age <= fadeInDur) {
p.opacity = qreal(age) / fadeInDur;
break;
} else {
p.opacity = 1.0;
- p.state = QmlGraphicsParticle::Solid;
+ p.state = QDeclarativeParticle::Solid;
// Fall through
}
- case QmlGraphicsParticle::Solid:
+ case QDeclarativeParticle::Solid:
if (age <= p.fadeOutAge) {
break;
} else {
- p.state = QmlGraphicsParticle::FadeOut;
+ p.state = QDeclarativeParticle::FadeOut;
// Fall through
}
- case QmlGraphicsParticle::FadeOut:
+ case QDeclarativeParticle::FadeOut:
p.opacity = qreal(p.lifeSpan - age) / fadeOutDur;
break;
}
@@ -624,23 +676,23 @@ Rectangle {
/*!
\internal
- \class QmlGraphicsParticles
+ \class QDeclarativeParticles
\ingroup group_effects
- \brief The QmlGraphicsParticles class generates and moves particles.
+ \brief The QDeclarativeParticles class generates and moves particles.
*/
-QmlGraphicsParticles::QmlGraphicsParticles(QmlGraphicsItem *parent)
- : QmlGraphicsItem(*(new QmlGraphicsParticlesPrivate), parent)
+QDeclarativeParticles::QDeclarativeParticles(QDeclarativeItem *parent)
+ : QDeclarativeItem(*(new QDeclarativeParticlesPrivate), parent)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
d->init();
}
-QmlGraphicsParticles::~QmlGraphicsParticles()
+QDeclarativeParticles::~QDeclarativeParticles()
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
if (d->pendingPixmapCache)
- QmlPixmapCache::cancel(d->url, this);
+ QDeclarativePixmapCache::cancel(d->url, this);
}
/*!
@@ -649,33 +701,33 @@ QmlGraphicsParticles::~QmlGraphicsParticles()
*/
/*!
- \property QmlGraphicsParticles::source
+ \property QDeclarativeParticles::source
\brief the URL of the particle image.
*/
-QUrl QmlGraphicsParticles::source() const
+QUrl QDeclarativeParticles::source() const
{
- Q_D(const QmlGraphicsParticles);
+ Q_D(const QDeclarativeParticles);
return d->url;
}
-void QmlGraphicsParticles::imageLoaded()
+void QDeclarativeParticles::imageLoaded()
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
d->pendingPixmapCache = false;
- QmlPixmapCache::get(d->url, &d->image);
+ QDeclarativePixmapCache::get(d->url, &d->image);
d->paintItem->updateSize();
d->paintItem->update();
}
-void QmlGraphicsParticles::setSource(const QUrl &name)
+void QDeclarativeParticles::setSource(const QUrl &name)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
if ((d->url.isEmpty() == name.isEmpty()) && name == d->url)
return;
if (d->pendingPixmapCache) {
- QmlPixmapCache::cancel(d->url, this);
+ QDeclarativePixmapCache::cancel(d->url, this);
d->pendingPixmapCache = false;
}
if (name.isEmpty()) {
@@ -686,9 +738,9 @@ void QmlGraphicsParticles::setSource(const QUrl &name)
} else {
d->url = name;
Q_ASSERT(!name.isRelative());
- QmlPixmapReply::Status status = QmlPixmapCache::get(d->url, &d->image);
- if (status != QmlPixmapReply::Ready && status != QmlPixmapReply::Error) {
- QmlPixmapReply *reply = QmlPixmapCache::request(qmlEngine(this), d->url);
+ QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->url, &d->image);
+ if (status != QDeclarativePixmapReply::Ready && status != QDeclarativePixmapReply::Error) {
+ QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(this), d->url);
connect(reply, SIGNAL(finished()), this, SLOT(imageLoaded()));
d->pendingPixmapCache = true;
} else {
@@ -716,18 +768,18 @@ void QmlGraphicsParticles::setSource(const QUrl &name)
*/
/*!
- \property QmlGraphicsParticles::count
+ \property QDeclarativeParticles::count
\brief the maximum number of particles
*/
-int QmlGraphicsParticles::count() const
+int QDeclarativeParticles::count() const
{
- Q_D(const QmlGraphicsParticles);
+ Q_D(const QDeclarativeParticles);
return d->count;
}
-void QmlGraphicsParticles::setCount(int cnt)
+void QDeclarativeParticles::setCount(int cnt)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
if (cnt == d->count)
return;
@@ -762,17 +814,17 @@ void QmlGraphicsParticles::setCount(int cnt)
*/
/*!
- \property QmlGraphicsParticles::emissionRate
+ \property QDeclarativeParticles::emissionRate
\brief the emission rate of particles
*/
-int QmlGraphicsParticles::emissionRate() const
+int QDeclarativeParticles::emissionRate() const
{
- Q_D(const QmlGraphicsParticles);
+ Q_D(const QDeclarativeParticles);
return d->emissionRate;
}
-void QmlGraphicsParticles::setEmissionRate(int er)
+void QDeclarativeParticles::setEmissionRate(int er)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
if(er == d->emissionRate)
return;
d->emissionRate = er;
@@ -808,19 +860,19 @@ void QmlGraphicsParticles::setEmissionRate(int er)
*/
/*!
- \property QmlGraphicsParticles::emissionVariance
+ \property QDeclarativeParticles::emissionVariance
\brief how much the particle emission amounts vary per tick
*/
-qreal QmlGraphicsParticles::emissionVariance() const
+qreal QDeclarativeParticles::emissionVariance() const
{
- Q_D(const QmlGraphicsParticles);
+ Q_D(const QDeclarativeParticles);
return d->emissionVariance;
}
-void QmlGraphicsParticles::setEmissionVariance(qreal ev)
+void QDeclarativeParticles::setEmissionVariance(qreal ev)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
if(d->emissionVariance == ev)
return;
d->emissionVariance = ev;
@@ -849,22 +901,22 @@ Particles {
*/
/*!
- \property QmlGraphicsParticles::lifeSpan
+ \property QDeclarativeParticles::lifeSpan
\brief the life span of each particle.
Default value is 1000ms.
- \sa QmlGraphicsParticles::lifeSpanDeviation
+ \sa QDeclarativeParticles::lifeSpanDeviation
*/
-int QmlGraphicsParticles::lifeSpan() const
+int QDeclarativeParticles::lifeSpan() const
{
- Q_D(const QmlGraphicsParticles);
+ Q_D(const QDeclarativeParticles);
return d->lifeSpan;
}
-void QmlGraphicsParticles::setLifeSpan(int ls)
+void QDeclarativeParticles::setLifeSpan(int ls)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
if(d->lifeSpan == ls)
return;
d->lifeSpan = ls;
@@ -872,7 +924,7 @@ void QmlGraphicsParticles::setLifeSpan(int ls)
}
/*!
- \property QmlGraphicsParticles::lifeSpanDeviation
+ \property QDeclarativeParticles::lifeSpanDeviation
\brief the maximum possible deviation from the set lifeSpan.
Randomly varies the lifeSpan up to the specified variation. For
@@ -887,17 +939,17 @@ Particles {
}
\endqml
- \sa QmlGraphicsParticles::lifeSpan
+ \sa QDeclarativeParticles::lifeSpan
*/
-int QmlGraphicsParticles::lifeSpanDeviation() const
+int QDeclarativeParticles::lifeSpanDeviation() const
{
- Q_D(const QmlGraphicsParticles);
+ Q_D(const QDeclarativeParticles);
return d->lifeSpanDev;
}
-void QmlGraphicsParticles::setLifeSpanDeviation(int dev)
+void QDeclarativeParticles::setLifeSpanDeviation(int dev)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
if(d->lifeSpanDev == dev)
return;
d->lifeSpanDev = dev;
@@ -913,20 +965,20 @@ void QmlGraphicsParticles::setLifeSpanDeviation(int dev)
*/
/*!
- \property QmlGraphicsParticles::fadeInDuration
+ \property QDeclarativeParticles::fadeInDuration
\brief the time taken to fade in the particles.
Default value is 200ms.
*/
-int QmlGraphicsParticles::fadeInDuration() const
+int QDeclarativeParticles::fadeInDuration() const
{
- Q_D(const QmlGraphicsParticles);
+ Q_D(const QDeclarativeParticles);
return d->fadeInDur;
}
-void QmlGraphicsParticles::setFadeInDuration(int dur)
+void QDeclarativeParticles::setFadeInDuration(int dur)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
if (dur < 0.0 || dur == d->fadeInDur)
return;
d->fadeInDur = dur;
@@ -934,20 +986,20 @@ void QmlGraphicsParticles::setFadeInDuration(int dur)
}
/*!
- \property QmlGraphicsParticles::fadeOutDuration
+ \property QDeclarativeParticles::fadeOutDuration
\brief the time taken to fade out the particles.
Default value is 300ms.
*/
-int QmlGraphicsParticles::fadeOutDuration() const
+int QDeclarativeParticles::fadeOutDuration() const
{
- Q_D(const QmlGraphicsParticles);
+ Q_D(const QDeclarativeParticles);
return d->fadeOutDur;
}
-void QmlGraphicsParticles::setFadeOutDuration(int dur)
+void QDeclarativeParticles::setFadeOutDuration(int dur)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
if (dur < 0.0 || d->fadeOutDur == dur)
return;
d->fadeOutDur = dur;
@@ -974,20 +1026,20 @@ Particles {
*/
/*!
- \property QmlGraphicsParticles::angle
+ \property QDeclarativeParticles::angle
\brief the initial angle of direction.
- \sa QmlGraphicsParticles::angleDeviation
+ \sa QDeclarativeParticles::angleDeviation
*/
-qreal QmlGraphicsParticles::angle() const
+qreal QDeclarativeParticles::angle() const
{
- Q_D(const QmlGraphicsParticles);
+ Q_D(const QDeclarativeParticles);
return d->angle * 180.0 / M_PI;
}
-void QmlGraphicsParticles::setAngle(qreal angle)
+void QDeclarativeParticles::setAngle(qreal angle)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
qreal radAngle = angle * M_PI / 180.0;
if(radAngle == d->angle)
return;
@@ -996,7 +1048,7 @@ void QmlGraphicsParticles::setAngle(qreal angle)
}
/*!
- \property QmlGraphicsParticles::angleDeviation
+ \property QDeclarativeParticles::angleDeviation
\brief the maximum possible deviation from the set angle.
Randomly varies the direction up to the specified variation. For
@@ -1011,17 +1063,17 @@ Particles {
}
\endqml
- \sa QmlGraphicsParticles::angle
+ \sa QDeclarativeParticles::angle
*/
-qreal QmlGraphicsParticles::angleDeviation() const
+qreal QDeclarativeParticles::angleDeviation() const
{
- Q_D(const QmlGraphicsParticles);
+ Q_D(const QDeclarativeParticles);
return d->angleDev * 180.0 / M_PI;
}
-void QmlGraphicsParticles::setAngleDeviation(qreal dev)
+void QDeclarativeParticles::setAngleDeviation(qreal dev)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
qreal radDev = dev * M_PI / 180.0;
if(radDev == d->angleDev)
return;
@@ -1049,20 +1101,20 @@ Particles {
*/
/*!
- \property QmlGraphicsParticles::velocity
+ \property QDeclarativeParticles::velocity
\brief the initial velocity of the particles.
- \sa QmlGraphicsParticles::velocityDeviation
+ \sa QDeclarativeParticles::velocityDeviation
*/
-qreal QmlGraphicsParticles::velocity() const
+qreal QDeclarativeParticles::velocity() const
{
- Q_D(const QmlGraphicsParticles);
+ Q_D(const QDeclarativeParticles);
return d->velocity * 1000.0;
}
-void QmlGraphicsParticles::setVelocity(qreal velocity)
+void QDeclarativeParticles::setVelocity(qreal velocity)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
qreal realVel = velocity / 1000.0;
if(realVel == d->velocity)
return;
@@ -1071,7 +1123,7 @@ void QmlGraphicsParticles::setVelocity(qreal velocity)
}
/*!
- \property QmlGraphicsParticles::velocityDeviation
+ \property QDeclarativeParticles::velocityDeviation
\brief the maximum possible deviation from the set velocity.
Randomly varies the velocity up to the specified variation. For
@@ -1086,17 +1138,17 @@ Particles {
}
\endqml
- \sa QmlGraphicsParticles::velocity
+ \sa QDeclarativeParticles::velocity
*/
-qreal QmlGraphicsParticles::velocityDeviation() const
+qreal QDeclarativeParticles::velocityDeviation() const
{
- Q_D(const QmlGraphicsParticles);
+ Q_D(const QDeclarativeParticles);
return d->velocityDev * 1000.0;
}
-void QmlGraphicsParticles::setVelocityDeviation(qreal velocity)
+void QDeclarativeParticles::setVelocityDeviation(qreal velocity)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
qreal realDev = velocity / 1000.0;
if(realDev == d->velocityDev)
return;
@@ -1116,25 +1168,28 @@ void QmlGraphicsParticles::setVelocityDeviation(qreal velocity)
*/
/*!
- \property QmlGraphicsParticles::motion
+ \property QDeclarativeParticles::motion
\brief sets the type of motion to apply to the particles.
When a particle is created it will have an initial direction and velocity.
The motion of the particle during its lifeSpan is then influenced by the
motion property.
- Default motion is QmlGraphicsParticleMotionLinear.
+ Default motion is QDeclarativeParticleMotionLinear.
*/
-QmlGraphicsParticleMotion *QmlGraphicsParticles::motion() const
+QDeclarativeParticleMotion *QDeclarativeParticles::motion() const
{
- Q_D(const QmlGraphicsParticles);
+ Q_D(const QDeclarativeParticles);
return d->motion;
}
-void QmlGraphicsParticles::setMotion(QmlGraphicsParticleMotion *motion)
+void QDeclarativeParticles::setMotion(QDeclarativeParticleMotion *motion)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
+ if (motion == d->motion)
+ return;
d->motion = motion;
+ emit motionChanged();
}
/*!
@@ -1154,15 +1209,15 @@ void QmlGraphicsParticles::setMotion(QmlGraphicsParticleMotion *motion)
normal emission. To avoid this behavior, use two Particles elements.
*/
-void QmlGraphicsParticles::burst(int count, int emissionRate)
+void QDeclarativeParticles::burst(int count, int emissionRate)
{
- Q_D(QmlGraphicsParticles);
+ Q_D(QDeclarativeParticles);
d->bursts << qMakePair(count, emissionRate);
if (d->clock.state() != QAbstractAnimation::Running)
d->clock.start();
}
-void QmlGraphicsParticlesPainter::updateSize()
+void QDeclarativeParticlesPainter::updateSize()
{
if (!isComponentComplete())
return;
@@ -1170,7 +1225,7 @@ void QmlGraphicsParticlesPainter::updateSize()
const int parentX = parentItem()->x();
const int parentY = parentItem()->y();
for (int i = 0; i < d->particles.count(); ++i) {
- const QmlGraphicsParticle &particle = d->particles.at(i);
+ const QDeclarativeParticle &particle = d->particles.at(i);
if(particle.x > maxX)
maxX = particle.x;
if(particle.x < minX)
@@ -1191,13 +1246,13 @@ void QmlGraphicsParticlesPainter::updateSize()
setY(myY);
}
-void QmlGraphicsParticles::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
+void QDeclarativeParticles::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
Q_UNUSED(p);
//painting is done by the ParticlesPainter, so it can have the right size
}
-void QmlGraphicsParticlesPainter::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
+void QDeclarativeParticlesPainter::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
if (d->image.isNull() || d->particles.isEmpty())
return;
@@ -1205,30 +1260,34 @@ void QmlGraphicsParticlesPainter::paint(QPainter *p, const QStyleOptionGraphicsI
const int myX = x() + parentItem()->x();
const int myY = y() + parentItem()->y();
- QVarLengthArray<QDrawPixmaps::Data, 256> pixmapData;
+ QVarLengthArray<QPainter::Fragment, 256> pixmapData;
pixmapData.resize(d->particles.count());
const QRectF sourceRect = d->image.rect();
qreal halfPWidth = sourceRect.width()/2.;
qreal halfPHeight = sourceRect.height()/2.;
for (int i = 0; i < d->particles.count(); ++i) {
- const QmlGraphicsParticle &particle = d->particles.at(i);
- pixmapData[i].point = QPointF(particle.x - myX + halfPWidth, particle.y - myY + halfPHeight);
+ const QDeclarativeParticle &particle = d->particles.at(i);
+ pixmapData[i].x = particle.x - myX + halfPWidth;
+ pixmapData[i].y = particle.y - myY + halfPHeight;
pixmapData[i].opacity = particle.opacity;
//these never change
pixmapData[i].rotation = 0;
pixmapData[i].scaleX = 1;
pixmapData[i].scaleY = 1;
- pixmapData[i].source = sourceRect;
+ pixmapData[i].sourceLeft = sourceRect.left();
+ pixmapData[i].sourceTop = sourceRect.top();
+ pixmapData[i].width = sourceRect.width();
+ pixmapData[i].height = sourceRect.height();
}
- qDrawPixmaps(p, pixmapData.data(), d->particles.count(), d->image);
+ p->drawPixmapFragments(pixmapData.data(), d->particles.count(), d->image);
}
-void QmlGraphicsParticles::componentComplete()
+void QDeclarativeParticles::componentComplete()
{
- Q_D(QmlGraphicsParticles);
- QmlGraphicsItem::componentComplete();
+ Q_D(QDeclarativeParticles);
+ QDeclarativeItem::componentComplete();
if (d->count) {
d->paintItem->updateSize();
d->clock.start();
diff --git a/src/declarative/graphicsitems/qmlgraphicsparticles_p.h b/src/declarative/graphicsitems/qdeclarativeparticles_p.h
index 7f0f9cd..06acbb9 100644
--- a/src/declarative/graphicsitems/qmlgraphicsparticles_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeparticles_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSPARTICLES_H
-#define QMLGRAPHICSPARTICLES_H
+#ifndef QDECLARATIVEPARTICLES_H
+#define QDECLARATIVEPARTICLES_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
QT_BEGIN_HEADER
@@ -50,67 +50,72 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsParticle;
-class QmlGraphicsParticles;
-class Q_DECLARATIVE_EXPORT QmlGraphicsParticleMotion : public QObject
+class QDeclarativeParticle;
+class QDeclarativeParticles;
+class Q_DECLARATIVE_EXPORT QDeclarativeParticleMotion : public QObject
{
Q_OBJECT
public:
- QmlGraphicsParticleMotion(QObject *parent=0);
+ QDeclarativeParticleMotion(QObject *parent=0);
- virtual void advance(QmlGraphicsParticle &, int interval);
- virtual void created(QmlGraphicsParticle &);
- virtual void destroy(QmlGraphicsParticle &);
+ virtual void advance(QDeclarativeParticle &, int interval);
+ virtual void created(QDeclarativeParticle &);
+ virtual void destroy(QDeclarativeParticle &);
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsParticleMotionLinear : public QmlGraphicsParticleMotion
+class Q_DECLARATIVE_EXPORT QDeclarativeParticleMotionLinear : public QDeclarativeParticleMotion
{
Q_OBJECT
public:
- QmlGraphicsParticleMotionLinear(QObject *parent=0)
- : QmlGraphicsParticleMotion(parent) {}
+ QDeclarativeParticleMotionLinear(QObject *parent=0)
+ : QDeclarativeParticleMotion(parent) {}
- virtual void advance(QmlGraphicsParticle &, int interval);
+ virtual void advance(QDeclarativeParticle &, int interval);
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsParticleMotionGravity : public QmlGraphicsParticleMotion
+class Q_DECLARATIVE_EXPORT QDeclarativeParticleMotionGravity : public QDeclarativeParticleMotion
{
Q_OBJECT
- Q_PROPERTY(int xattractor READ xAttractor WRITE setXAttractor)
- Q_PROPERTY(int yattractor READ yAttractor WRITE setYAttractor)
- Q_PROPERTY(int acceleration READ acceleration WRITE setAcceleration)
+ Q_PROPERTY(qreal xattractor READ xAttractor WRITE setXAttractor NOTIFY xattractorChanged)
+ Q_PROPERTY(qreal yattractor READ yAttractor WRITE setYAttractor NOTIFY yattractorChanged)
+ Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged)
public:
- QmlGraphicsParticleMotionGravity(QObject *parent=0)
- : QmlGraphicsParticleMotion(parent), _xAttr(0), _yAttr(0), _accel(0.00005) {}
+ QDeclarativeParticleMotionGravity(QObject *parent=0)
+ : QDeclarativeParticleMotion(parent), _xAttr(0.0), _yAttr(0.0), _accel(0.00005) {}
- int xAttractor() const { return _xAttr; }
- void setXAttractor(int x) { _xAttr = x; }
+ qreal xAttractor() const { return _xAttr; }
+ void setXAttractor(qreal x);
- int yAttractor() const { return _yAttr; }
- void setYAttractor(int y) { _yAttr = y; }
+ qreal yAttractor() const { return _yAttr; }
+ void setYAttractor(qreal y);
- int acceleration() const { return int(_accel * 1000000); }
- void setAcceleration(int accel) { _accel = qreal(accel)/1000000.0; }
+ qreal acceleration() const { return _accel * 1000000; }
+ void setAcceleration(qreal accel);
- virtual void advance(QmlGraphicsParticle &, int interval);
+ virtual void advance(QDeclarativeParticle &, int interval);
+
+Q_SIGNALS:
+ void xattractorChanged();
+ void yattractorChanged();
+ void accelerationChanged();
private:
- int _xAttr;
- int _yAttr;
+ qreal _xAttr;
+ qreal _yAttr;
qreal _accel;
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsParticleMotionWander : public QmlGraphicsParticleMotion
+class Q_DECLARATIVE_EXPORT QDeclarativeParticleMotionWander : public QDeclarativeParticleMotion
{
Q_OBJECT
public:
- QmlGraphicsParticleMotionWander()
- : QmlGraphicsParticleMotion(), particles(0), _xvariance(0), _yvariance(0) {}
+ QDeclarativeParticleMotionWander()
+ : QDeclarativeParticleMotion(), particles(0), _xvariance(0), _yvariance(0) {}
- virtual void advance(QmlGraphicsParticle &, int interval);
- virtual void created(QmlGraphicsParticle &);
- virtual void destroy(QmlGraphicsParticle &);
+ virtual void advance(QDeclarativeParticle &, int interval);
+ virtual void created(QDeclarativeParticle &);
+ virtual void destroy(QDeclarativeParticle &);
struct Data {
qreal x_targetV;
@@ -121,27 +126,32 @@ public:
qreal y_var;
};
- Q_PROPERTY(int xvariance READ xVariance WRITE setXVariance)
- int xVariance() const { return int(_xvariance * 1000); }
- void setXVariance(int var) { _xvariance = var / 1000.0; }
+ Q_PROPERTY(qreal xvariance READ xVariance WRITE setXVariance NOTIFY xvarianceChanged)
+ qreal xVariance() const { return _xvariance * 1000.0; }
+ void setXVariance(qreal var);
- Q_PROPERTY(int yvariance READ yVariance WRITE setYVariance)
- int yVariance() const { return int(_yvariance * 1000); }
- void setYVariance(int var) { _yvariance = var / 1000.0; }
+ Q_PROPERTY(qreal yvariance READ yVariance WRITE setYVariance NOTIFY yvarianceChanged)
+ qreal yVariance() const { return _yvariance * 1000.0; }
+ void setYVariance(qreal var);
- Q_PROPERTY(int pace READ pace WRITE setPace)
- int pace() const { return int(_pace * 1000); }
- void setPace(int pace) { _pace = pace / 1000.0; }
+ Q_PROPERTY(qreal pace READ pace WRITE setPace NOTIFY paceChanged)
+ qreal pace() const { return _pace * 1000.0; }
+ void setPace(qreal pace);
+Q_SIGNALS:
+ void xvarianceChanged();
+ void yvarianceChanged();
+ void paceChanged();
+
private:
- QmlGraphicsParticles *particles;
+ QDeclarativeParticles *particles;
qreal _xvariance;
qreal _yvariance;
qreal _pace;
};
-class QmlGraphicsParticlesPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsParticles : public QmlGraphicsItem
+class QDeclarativeParticlesPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeParticles : public QDeclarativeItem
{
Q_OBJECT
@@ -157,12 +167,12 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsParticles : public QmlGraphicsItem
Q_PROPERTY(qreal angleDeviation READ angleDeviation WRITE setAngleDeviation NOTIFY angleDeviationChanged)
Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity NOTIFY velocityChanged)
Q_PROPERTY(qreal velocityDeviation READ velocityDeviation WRITE setVelocityDeviation NOTIFY velocityDeviationChanged)
- Q_PROPERTY(QmlGraphicsParticleMotion *motion READ motion WRITE setMotion)
+ Q_PROPERTY(QDeclarativeParticleMotion *motion READ motion WRITE setMotion NOTIFY motionChanged)
Q_CLASSINFO("DefaultProperty", "motion")
public:
- QmlGraphicsParticles(QmlGraphicsItem *parent=0);
- ~QmlGraphicsParticles();
+ QDeclarativeParticles(QDeclarativeItem *parent=0);
+ ~QDeclarativeParticles();
QUrl source() const;
void setSource(const QUrl &);
@@ -200,8 +210,8 @@ public:
qreal velocityDeviation() const;
void setVelocityDeviation(qreal);
- QmlGraphicsParticleMotion *motion() const;
- void setMotion(QmlGraphicsParticleMotion *);
+ QDeclarativeParticleMotion *motion() const;
+ void setMotion(QDeclarativeParticleMotion *);
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
@@ -225,22 +235,23 @@ Q_SIGNALS:
void velocityChanged();
void velocityDeviationChanged();
void emittingChanged();
+ void motionChanged();
private Q_SLOTS:
void imageLoaded();
private:
- Q_DISABLE_COPY(QmlGraphicsParticles)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsParticles)
+ Q_DISABLE_COPY(QDeclarativeParticles)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeParticles)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsParticleMotion)
-QML_DECLARE_TYPE(QmlGraphicsParticleMotionLinear)
-QML_DECLARE_TYPE(QmlGraphicsParticleMotionGravity)
-QML_DECLARE_TYPE(QmlGraphicsParticleMotionWander)
-QML_DECLARE_TYPE(QmlGraphicsParticles)
+QML_DECLARE_TYPE(QDeclarativeParticleMotion)
+QML_DECLARE_TYPE(QDeclarativeParticleMotionLinear)
+QML_DECLARE_TYPE(QDeclarativeParticleMotionGravity)
+QML_DECLARE_TYPE(QDeclarativeParticleMotionWander)
+QML_DECLARE_TYPE(QDeclarativeParticles)
QT_END_HEADER
diff --git a/src/declarative/graphicsitems/qmlgraphicspath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp
index 0da246f..48f112a 100644
--- a/src/declarative/graphicsitems/qmlgraphicspath.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepath.cpp
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#include "qmlgraphicspath_p.h"
-#include "qmlgraphicspath_p_p.h"
+#include "qdeclarativepath_p.h"
+#include "qdeclarativepath_p_p.h"
#include <qfxperf_p_p.h>
@@ -51,7 +51,7 @@
QT_BEGIN_NAMESPACE
/*!
- \qmlclass PathElement QmlGraphicsPathElement
+ \qmlclass PathElement QDeclarativePathElement
\since 4.7
\brief PathElement is the base path type.
@@ -63,12 +63,12 @@ QT_BEGIN_NAMESPACE
/*!
\internal
- \class QmlGraphicsPathElement
+ \class QDeclarativePathElement
\ingroup group_utility
*/
/*!
- \qmlclass Path QmlGraphicsPath
+ \qmlclass Path QDeclarativePath
\since 4.7
\brief A Path object defines a path for use by \l PathView.
@@ -86,17 +86,17 @@ QT_BEGIN_NAMESPACE
/*!
\internal
- \class QmlGraphicsPath
+ \class QDeclarativePath
\ingroup group_utility
- \brief The QmlGraphicsPath class defines a path.
- \sa QmlGraphicsPathView
+ \brief The QDeclarativePath class defines a path.
+ \sa QDeclarativePathView
*/
-QmlGraphicsPath::QmlGraphicsPath(QObject *parent)
- : QObject(*(new QmlGraphicsPathPrivate), parent)
+QDeclarativePath::QDeclarativePath(QObject *parent)
+ : QObject(*(new QDeclarativePathPrivate), parent)
{
}
-QmlGraphicsPath::~QmlGraphicsPath()
+QDeclarativePath::~QDeclarativePath()
{
}
@@ -105,27 +105,27 @@ QmlGraphicsPath::~QmlGraphicsPath()
\qmlproperty real Path::startY
These properties hold the starting position of the path.
*/
-qreal QmlGraphicsPath::startX() const
+qreal QDeclarativePath::startX() const
{
- Q_D(const QmlGraphicsPath);
+ Q_D(const QDeclarativePath);
return d->startX;
}
-void QmlGraphicsPath::setStartX(qreal x)
+void QDeclarativePath::setStartX(qreal x)
{
- Q_D(QmlGraphicsPath);
+ Q_D(QDeclarativePath);
d->startX = x;
}
-qreal QmlGraphicsPath::startY() const
+qreal QDeclarativePath::startY() const
{
- Q_D(const QmlGraphicsPath);
+ Q_D(const QDeclarativePath);
return d->startY;
}
-void QmlGraphicsPath::setStartY(qreal y)
+void QDeclarativePath::setStartY(qreal y)
{
- Q_D(QmlGraphicsPath);
+ Q_D(QDeclarativePath);
d->startY = y;
}
@@ -133,9 +133,9 @@ void QmlGraphicsPath::setStartY(qreal y)
\qmlproperty bool Path::closed
This property holds whether the start and end of the path are identical.
*/
-bool QmlGraphicsPath::isClosed() const
+bool QDeclarativePath::isClosed() const
{
- Q_D(const QmlGraphicsPath);
+ Q_D(const QDeclarativePath);
return d->closed;
}
@@ -157,15 +157,15 @@ bool QmlGraphicsPath::isClosed() const
\snippet doc/src/snippets/declarative/pathview/pathattributes.qml 2
*/
-QmlListProperty<QmlGraphicsPathElement> QmlGraphicsPath::pathElements()
+QDeclarativeListProperty<QDeclarativePathElement> QDeclarativePath::pathElements()
{
- Q_D(QmlGraphicsPath);
- return QmlListProperty<QmlGraphicsPathElement>(this, d->_pathElements);
+ Q_D(QDeclarativePath);
+ return QDeclarativeListProperty<QDeclarativePathElement>(this, d->_pathElements);
}
-void QmlGraphicsPath::interpolate(int idx, const QString &name, qreal value)
+void QDeclarativePath::interpolate(int idx, const QString &name, qreal value)
{
- Q_D(QmlGraphicsPath);
+ Q_D(QDeclarativePath);
if (!idx)
return;
@@ -194,9 +194,9 @@ void QmlGraphicsPath::interpolate(int idx, const QString &name, qreal value)
}
}
-void QmlGraphicsPath::endpoint(const QString &name)
+void QDeclarativePath::endpoint(const QString &name)
{
- Q_D(QmlGraphicsPath);
+ Q_D(QDeclarativePath);
const AttributePoint &first = d->_attributePoints.first();
qreal val = first.values.value(name);
for (int ii = d->_attributePoints.count() - 1; ii >= 0; ii--) {
@@ -211,9 +211,9 @@ void QmlGraphicsPath::endpoint(const QString &name)
}
}
-void QmlGraphicsPath::processPath()
+void QDeclarativePath::processPath()
{
- Q_D(QmlGraphicsPath);
+ Q_D(QDeclarativePath);
d->_pointCache.clear();
d->_attributePoints.clear();
@@ -226,19 +226,19 @@ void QmlGraphicsPath::processPath()
d->_path.moveTo(d->startX, d->startY);
- QmlGraphicsCurve *lastCurve = 0;
- foreach (QmlGraphicsPathElement *pathElement, d->_pathElements) {
- if (QmlGraphicsCurve *curve = qobject_cast<QmlGraphicsCurve *>(pathElement)) {
+ QDeclarativeCurve *lastCurve = 0;
+ foreach (QDeclarativePathElement *pathElement, d->_pathElements) {
+ if (QDeclarativeCurve *curve = qobject_cast<QDeclarativeCurve *>(pathElement)) {
curve->addToPath(d->_path);
AttributePoint p;
p.origpercent = d->_path.length();
d->_attributePoints << p;
lastCurve = curve;
- } else if (QmlGraphicsPathAttribute *attribute = qobject_cast<QmlGraphicsPathAttribute *>(pathElement)) {
+ } else if (QDeclarativePathAttribute *attribute = qobject_cast<QDeclarativePathAttribute *>(pathElement)) {
AttributePoint &point = d->_attributePoints.last();
point.values[attribute->name()] = attribute->value();
interpolate(d->_attributePoints.count() - 1, attribute->name(), attribute->value());
- } else if (QmlGraphicsPathPercent *percent = qobject_cast<QmlGraphicsPathPercent *>(pathElement)) {
+ } else if (QDeclarativePathPercent *percent = qobject_cast<QDeclarativePathPercent *>(pathElement)) {
AttributePoint &point = d->_attributePoints.last();
point.values[QLatin1String("_qfx_percent")] = percent->value();
interpolate(d->_attributePoints.count() - 1, QLatin1String("_qfx_percent"), percent->value());
@@ -258,7 +258,7 @@ void QmlGraphicsPath::processPath()
qreal prevorigpercent = 0;
for (int ii = 0; ii < d->_attributePoints.count(); ++ii) {
const AttributePoint &point = d->_attributePoints.at(ii);
- if (point.values.contains(QLatin1String("_qfx_percent"))) { //special string for QmlGraphicsPathPercent
+ if (point.values.contains(QLatin1String("_qfx_percent"))) { //special string for QDeclarativePathPercent
if ( ii > 0) {
qreal scale = (d->_attributePoints[ii].origpercent/length - prevorigpercent) /
(point.values.value(QLatin1String("_qfx_percent"))-prevpercent);
@@ -279,33 +279,33 @@ void QmlGraphicsPath::processPath()
emit changed();
}
-void QmlGraphicsPath::componentComplete()
+void QDeclarativePath::componentComplete()
{
- Q_D(QmlGraphicsPath);
+ Q_D(QDeclarativePath);
QSet<QString> attrs;
// First gather up all the attributes
- foreach (QmlGraphicsPathElement *pathElement, d->_pathElements) {
- if (QmlGraphicsPathAttribute *attribute =
- qobject_cast<QmlGraphicsPathAttribute *>(pathElement))
+ foreach (QDeclarativePathElement *pathElement, d->_pathElements) {
+ if (QDeclarativePathAttribute *attribute =
+ qobject_cast<QDeclarativePathAttribute *>(pathElement))
attrs.insert(attribute->name());
}
d->_attributes = attrs.toList();
processPath();
- foreach (QmlGraphicsPathElement *pathElement, d->_pathElements)
+ foreach (QDeclarativePathElement *pathElement, d->_pathElements)
connect(pathElement, SIGNAL(changed()), this, SLOT(processPath()));
}
-QPainterPath QmlGraphicsPath::path() const
+QPainterPath QDeclarativePath::path() const
{
- Q_D(const QmlGraphicsPath);
+ Q_D(const QDeclarativePath);
return d->_path;
}
-QStringList QmlGraphicsPath::attributes() const
+QStringList QDeclarativePath::attributes() const
{
- Q_D(const QmlGraphicsPath);
+ Q_D(const QDeclarativePath);
return d->_attributes;
}
#include <QTime>
@@ -347,11 +347,11 @@ static inline QBezier nextBezier(const QPainterPath &path, int *from, qreal *bez
return QBezier();
}
-void QmlGraphicsPath::createPointCache() const
+void QDeclarativePath::createPointCache() const
{
- Q_D(const QmlGraphicsPath);
+ Q_D(const QDeclarativePath);
#ifdef Q_ENABLE_PERFORMANCE_LOG
- QmlPerfTimer<QmlPerf::QmlGraphicsPathViewPathCache> pc;
+ QDeclarativePerfTimer<QDeclarativePerf::QDeclarativePathViewPathCache> pc;
#endif
qreal pathLength = d->_path.length();
const int points = int(pathLength*2);
@@ -398,9 +398,9 @@ void QmlGraphicsPath::createPointCache() const
}
}
-QPointF QmlGraphicsPath::pointAt(qreal p) const
+QPointF QDeclarativePath::pointAt(qreal p) const
{
- Q_D(const QmlGraphicsPath);
+ Q_D(const QDeclarativePath);
if (d->_pointCache.isEmpty()) {
createPointCache();
}
@@ -412,9 +412,9 @@ QPointF QmlGraphicsPath::pointAt(qreal p) const
return d->_pointCache.at(idx);
}
-qreal QmlGraphicsPath::attributeAt(const QString &name, qreal percent) const
+qreal QDeclarativePath::attributeAt(const QString &name, qreal percent) const
{
- Q_D(const QmlGraphicsPath);
+ Q_D(const QDeclarativePath);
if (percent < 0 || percent > 1)
return 0;
@@ -440,12 +440,12 @@ qreal QmlGraphicsPath::attributeAt(const QString &name, qreal percent) const
/****************************************************************************/
-qreal QmlGraphicsCurve::x() const
+qreal QDeclarativeCurve::x() const
{
return _x;
}
-void QmlGraphicsCurve::setX(qreal x)
+void QDeclarativeCurve::setX(qreal x)
{
if (_x != x) {
_x = x;
@@ -453,12 +453,12 @@ void QmlGraphicsCurve::setX(qreal x)
}
}
-qreal QmlGraphicsCurve::y() const
+qreal QDeclarativeCurve::y() const
{
return _y;
}
-void QmlGraphicsCurve::setY(qreal y)
+void QDeclarativeCurve::setY(qreal y)
{
if (_y != y) {
_y = y;
@@ -469,14 +469,14 @@ void QmlGraphicsCurve::setY(qreal y)
/****************************************************************************/
/*!
- \qmlclass PathAttribute QmlGraphicsPathAttribute
+ \qmlclass PathAttribute QDeclarativePathAttribute
\since 4.7
\brief The PathAttribute allows setting an attribute at a given position in a Path.
The PathAttribute object allows attibutes consisting of a name and
a value to be specified for the endpoints of path segments. The
attributes are exposed to the delegate as
- \l{qmlintroduction.html#attached-properties} {Attached Properties}.
+ \l{qdeclarativeintroduction.html#attached-properties} {Attached Properties}.
The value of an attribute at any particular point is interpolated
from the PathAttributes bounding the point.
@@ -498,11 +498,11 @@ void QmlGraphicsCurve::setY(qreal y)
/*!
\internal
- \class QmlGraphicsPathAttribute
+ \class QDeclarativePathAttribute
\ingroup group_utility
- \brief The QmlGraphicsPathAttribute class allows to set the value of an attribute at a given position in the path.
+ \brief The QDeclarativePathAttribute class allows to set the value of an attribute at a given position in the path.
- \sa QmlGraphicsPath
+ \sa QDeclarativePath
*/
@@ -515,12 +515,12 @@ void QmlGraphicsCurve::setY(qreal y)
the name of the attribute to change.
*/
-QString QmlGraphicsPathAttribute::name() const
+QString QDeclarativePathAttribute::name() const
{
return _name;
}
-void QmlGraphicsPathAttribute::setName(const QString &name)
+void QDeclarativePathAttribute::setName(const QString &name)
{
_name = name;
}
@@ -533,12 +533,12 @@ void QmlGraphicsPathAttribute::setName(const QString &name)
/*!
the new value of the attribute.
*/
-qreal QmlGraphicsPathAttribute::value() const
+qreal QDeclarativePathAttribute::value() const
{
return _value;
}
-void QmlGraphicsPathAttribute::setValue(qreal value)
+void QDeclarativePathAttribute::setValue(qreal value)
{
if (_value != value) {
_value = value;
@@ -549,7 +549,7 @@ void QmlGraphicsPathAttribute::setValue(qreal value)
/****************************************************************************/
/*!
- \qmlclass PathLine QmlGraphicsPathLine
+ \qmlclass PathLine QDeclarativePathLine
\since 4.7
\brief The PathLine defines a straight line.
@@ -568,11 +568,11 @@ void QmlGraphicsPathAttribute::setValue(qreal value)
/*!
\internal
- \class QmlGraphicsPathLine
+ \class QDeclarativePathLine
\ingroup group_utility
- \brief The QmlGraphicsPathLine class defines a straight line.
+ \brief The QDeclarativePathLine class defines a straight line.
- \sa QmlGraphicsPath
+ \sa QDeclarativePath
*/
/*!
@@ -582,7 +582,7 @@ void QmlGraphicsPathAttribute::setValue(qreal value)
Defines the end point of the line.
*/
-void QmlGraphicsPathLine::addToPath(QPainterPath &path)
+void QDeclarativePathLine::addToPath(QPainterPath &path)
{
path.lineTo(x(), y());
}
@@ -590,7 +590,7 @@ void QmlGraphicsPathLine::addToPath(QPainterPath &path)
/****************************************************************************/
/*!
- \qmlclass PathQuad QmlGraphicsPathQuad
+ \qmlclass PathQuad QDeclarativePathQuad
\since 4.7
\brief The PathQuad defines a quadratic Bezier curve with a control point.
@@ -612,11 +612,11 @@ void QmlGraphicsPathLine::addToPath(QPainterPath &path)
/*!
\internal
- \class QmlGraphicsPathQuad
+ \class QDeclarativePathQuad
\ingroup group_utility
- \brief The QmlGraphicsPathQuad class defines a quadratic Bezier curve with a control point.
+ \brief The QDeclarativePathQuad class defines a quadratic Bezier curve with a control point.
- \sa QmlGraphicsPath
+ \sa QDeclarativePath
*/
@@ -637,12 +637,12 @@ void QmlGraphicsPathLine::addToPath(QPainterPath &path)
/*!
the x position of the control point.
*/
-qreal QmlGraphicsPathQuad::controlX() const
+qreal QDeclarativePathQuad::controlX() const
{
return _controlX;
}
-void QmlGraphicsPathQuad::setControlX(qreal x)
+void QDeclarativePathQuad::setControlX(qreal x)
{
if (_controlX != x) {
_controlX = x;
@@ -654,12 +654,12 @@ void QmlGraphicsPathQuad::setControlX(qreal x)
/*!
the y position of the control point.
*/
-qreal QmlGraphicsPathQuad::controlY() const
+qreal QDeclarativePathQuad::controlY() const
{
return _controlY;
}
-void QmlGraphicsPathQuad::setControlY(qreal y)
+void QDeclarativePathQuad::setControlY(qreal y)
{
if (_controlY != y) {
_controlY = y;
@@ -667,7 +667,7 @@ void QmlGraphicsPathQuad::setControlY(qreal y)
}
}
-void QmlGraphicsPathQuad::addToPath(QPainterPath &path)
+void QDeclarativePathQuad::addToPath(QPainterPath &path)
{
path.quadTo(controlX(), controlY(), x(), y());
}
@@ -675,7 +675,7 @@ void QmlGraphicsPathQuad::addToPath(QPainterPath &path)
/****************************************************************************/
/*!
- \qmlclass PathCubic QmlGraphicsPathCubic
+ \qmlclass PathCubic QDeclarativePathCubic
\since 4.7
\brief The PathCubic defines a cubic Bezier curve with two control points.
@@ -700,11 +700,11 @@ void QmlGraphicsPathQuad::addToPath(QPainterPath &path)
/*!
\internal
- \class QmlGraphicsPathCubic
+ \class QDeclarativePathCubic
\ingroup group_utility
- \brief The QmlGraphicsPathCubic class defines a cubic Bezier curve with two control points.
+ \brief The QDeclarativePathCubic class defines a cubic Bezier curve with two control points.
- \sa QmlGraphicsPath
+ \sa QDeclarativePath
*/
/*!
@@ -720,12 +720,12 @@ void QmlGraphicsPathQuad::addToPath(QPainterPath &path)
Defines the position of the first control point.
*/
-qreal QmlGraphicsPathCubic::control1X() const
+qreal QDeclarativePathCubic::control1X() const
{
return _control1X;
}
-void QmlGraphicsPathCubic::setControl1X(qreal x)
+void QDeclarativePathCubic::setControl1X(qreal x)
{
if (_control1X != x) {
_control1X = x;
@@ -733,12 +733,12 @@ void QmlGraphicsPathCubic::setControl1X(qreal x)
}
}
-qreal QmlGraphicsPathCubic::control1Y() const
+qreal QDeclarativePathCubic::control1Y() const
{
return _control1Y;
}
-void QmlGraphicsPathCubic::setControl1Y(qreal y)
+void QDeclarativePathCubic::setControl1Y(qreal y)
{
if (_control1Y != y) {
_control1Y = y;
@@ -752,12 +752,12 @@ void QmlGraphicsPathCubic::setControl1Y(qreal y)
Defines the position of the second control point.
*/
-qreal QmlGraphicsPathCubic::control2X() const
+qreal QDeclarativePathCubic::control2X() const
{
return _control2X;
}
-void QmlGraphicsPathCubic::setControl2X(qreal x)
+void QDeclarativePathCubic::setControl2X(qreal x)
{
if (_control2X != x) {
_control2X = x;
@@ -765,12 +765,12 @@ void QmlGraphicsPathCubic::setControl2X(qreal x)
}
}
-qreal QmlGraphicsPathCubic::control2Y() const
+qreal QDeclarativePathCubic::control2Y() const
{
return _control2Y;
}
-void QmlGraphicsPathCubic::setControl2Y(qreal y)
+void QDeclarativePathCubic::setControl2Y(qreal y)
{
if (_control2Y != y) {
_control2Y = y;
@@ -778,7 +778,7 @@ void QmlGraphicsPathCubic::setControl2Y(qreal y)
}
}
-void QmlGraphicsPathCubic::addToPath(QPainterPath &path)
+void QDeclarativePathCubic::addToPath(QPainterPath &path)
{
path.cubicTo(control1X(), control1Y(), control2X(), control2Y(), x(), y());
}
@@ -786,7 +786,7 @@ void QmlGraphicsPathCubic::addToPath(QPainterPath &path)
/****************************************************************************/
/*!
- \qmlclass PathPercent QmlGraphicsPathPercent
+ \qmlclass PathPercent QDeclarativePathPercent
\since 4.7
\brief The PathPercent manipulates the way a path is interpreted.
@@ -826,23 +826,23 @@ void QmlGraphicsPathCubic::addToPath(QPainterPath &path)
/*!
\internal
- \class QmlGraphicsPathPercent
+ \class QDeclarativePathPercent
\ingroup group_utility
- \brief The QmlGraphicsPathPercent class manipulates the way a path is interpreted.
+ \brief The QDeclarativePathPercent class manipulates the way a path is interpreted.
- QmlGraphicsPathPercent allows you to bunch up items (or spread out items) along various
- segments of a QmlGraphicsPathView's path.
+ QDeclarativePathPercent allows you to bunch up items (or spread out items) along various
+ segments of a QDeclarativePathView's path.
- \sa QmlGraphicsPath
+ \sa QDeclarativePath
*/
-qreal QmlGraphicsPathPercent::value() const
+qreal QDeclarativePathPercent::value() const
{
return _value;
}
-void QmlGraphicsPathPercent::setValue(qreal value)
+void QDeclarativePathPercent::setValue(qreal value)
{
_value = value;
}
diff --git a/src/declarative/graphicsitems/qmlgraphicspath_p.h b/src/declarative/graphicsitems/qdeclarativepath_p.h
index 7ba5bbc..b3139f8 100644
--- a/src/declarative/graphicsitems/qmlgraphicspath_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepath_p.h
@@ -39,12 +39,12 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSPATH_H
-#define QMLGRAPHICSPATH_H
+#ifndef QDECLARATIVEPATH_H
+#define QDECLARATIVEPATH_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtCore/QObject>
#include <QtGui/QPainterPath>
@@ -54,23 +54,23 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class Q_DECLARATIVE_EXPORT QmlGraphicsPathElement : public QObject
+class Q_DECLARATIVE_EXPORT QDeclarativePathElement : public QObject
{
Q_OBJECT
public:
- QmlGraphicsPathElement(QObject *parent=0) : QObject(parent) {}
+ QDeclarativePathElement(QObject *parent=0) : QObject(parent) {}
Q_SIGNALS:
void changed();
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsPathAttribute : public QmlGraphicsPathElement
+class Q_DECLARATIVE_EXPORT QDeclarativePathAttribute : public QDeclarativePathElement
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed)
public:
- QmlGraphicsPathAttribute(QObject *parent=0) : QmlGraphicsPathElement(parent), _value(0) {}
+ QDeclarativePathAttribute(QObject *parent=0) : QDeclarativePathElement(parent), _value(0) {}
QString name() const;
@@ -84,14 +84,14 @@ private:
qreal _value;
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsCurve : public QmlGraphicsPathElement
+class Q_DECLARATIVE_EXPORT QDeclarativeCurve : public QDeclarativePathElement
{
Q_OBJECT
Q_PROPERTY(qreal x READ x WRITE setX NOTIFY changed)
Q_PROPERTY(qreal y READ y WRITE setY NOTIFY changed)
public:
- QmlGraphicsCurve(QObject *parent=0) : QmlGraphicsPathElement(parent), _x(0), _y(0) {}
+ QDeclarativeCurve(QObject *parent=0) : QDeclarativePathElement(parent), _x(0), _y(0) {}
qreal x() const;
void setX(qreal x);
@@ -106,23 +106,23 @@ private:
qreal _y;
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsPathLine : public QmlGraphicsCurve
+class Q_DECLARATIVE_EXPORT QDeclarativePathLine : public QDeclarativeCurve
{
Q_OBJECT
public:
- QmlGraphicsPathLine(QObject *parent=0) : QmlGraphicsCurve(parent) {}
+ QDeclarativePathLine(QObject *parent=0) : QDeclarativeCurve(parent) {}
void addToPath(QPainterPath &path);
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsPathQuad : public QmlGraphicsCurve
+class Q_DECLARATIVE_EXPORT QDeclarativePathQuad : public QDeclarativeCurve
{
Q_OBJECT
Q_PROPERTY(qreal controlX READ controlX WRITE setControlX NOTIFY changed)
Q_PROPERTY(qreal controlY READ controlY WRITE setControlY NOTIFY changed)
public:
- QmlGraphicsPathQuad(QObject *parent=0) : QmlGraphicsCurve(parent), _controlX(0), _controlY(0) {}
+ QDeclarativePathQuad(QObject *parent=0) : QDeclarativeCurve(parent), _controlX(0), _controlY(0) {}
qreal controlX() const;
void setControlX(qreal x);
@@ -137,7 +137,7 @@ private:
qreal _controlY;
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsPathCubic : public QmlGraphicsCurve
+class Q_DECLARATIVE_EXPORT QDeclarativePathCubic : public QDeclarativeCurve
{
Q_OBJECT
@@ -146,7 +146,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsPathCubic : public QmlGraphicsCurve
Q_PROPERTY(qreal control2X READ control2X WRITE setControl2X NOTIFY changed)
Q_PROPERTY(qreal control2Y READ control2Y WRITE setControl2Y NOTIFY changed)
public:
- QmlGraphicsPathCubic(QObject *parent=0) : QmlGraphicsCurve(parent), _control1X(0), _control1Y(0), _control2X(0), _control2Y(0) {}
+ QDeclarativePathCubic(QObject *parent=0) : QDeclarativeCurve(parent), _control1X(0), _control1Y(0), _control2X(0), _control2Y(0) {}
qreal control1X() const;
void setControl1X(qreal x);
@@ -169,12 +169,12 @@ private:
int _control2Y;
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsPathPercent : public QmlGraphicsPathElement
+class Q_DECLARATIVE_EXPORT QDeclarativePathPercent : public QDeclarativePathElement
{
Q_OBJECT
Q_PROPERTY(qreal value READ value WRITE setValue)
public:
- QmlGraphicsPathPercent(QObject *parent=0) : QmlGraphicsPathElement(parent) {}
+ QDeclarativePathPercent(QObject *parent=0) : QDeclarativePathElement(parent) {}
qreal value() const;
void setValue(qreal value);
@@ -183,23 +183,23 @@ private:
qreal _value;
};
-class QmlGraphicsPathPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsPath : public QObject, public QmlParserStatus
+class QDeclarativePathPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativePath : public QObject, public QDeclarativeParserStatus
{
Q_OBJECT
- Q_INTERFACES(QmlParserStatus)
- Q_PROPERTY(QmlListProperty<QmlGraphicsPathElement> pathElements READ pathElements)
+ Q_INTERFACES(QDeclarativeParserStatus)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativePathElement> pathElements READ pathElements)
Q_PROPERTY(qreal startX READ startX WRITE setStartX)
Q_PROPERTY(qreal startY READ startY WRITE setStartY)
Q_PROPERTY(bool closed READ isClosed NOTIFY changed)
Q_CLASSINFO("DefaultProperty", "pathElements")
- Q_INTERFACES(QmlParserStatus)
+ Q_INTERFACES(QDeclarativeParserStatus)
public:
- QmlGraphicsPath(QObject *parent=0);
- ~QmlGraphicsPath();
+ QDeclarativePath(QObject *parent=0);
+ ~QDeclarativePath();
- QmlListProperty<QmlGraphicsPathElement> pathElements();
+ QDeclarativeListProperty<QDeclarativePathElement> pathElements();
qreal startX() const;
void setStartX(qreal x);
@@ -242,21 +242,21 @@ private:
void createPointCache() const;
private:
- Q_DISABLE_COPY(QmlGraphicsPath)
- Q_DECLARE_PRIVATE(QmlGraphicsPath)
+ Q_DISABLE_COPY(QDeclarativePath)
+ Q_DECLARE_PRIVATE(QDeclarativePath)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsPathElement)
-QML_DECLARE_TYPE(QmlGraphicsPathAttribute)
-QML_DECLARE_TYPE(QmlGraphicsCurve)
-QML_DECLARE_TYPE(QmlGraphicsPathLine)
-QML_DECLARE_TYPE(QmlGraphicsPathQuad)
-QML_DECLARE_TYPE(QmlGraphicsPathCubic)
-QML_DECLARE_TYPE(QmlGraphicsPathPercent)
-QML_DECLARE_TYPE(QmlGraphicsPath)
+QML_DECLARE_TYPE(QDeclarativePathElement)
+QML_DECLARE_TYPE(QDeclarativePathAttribute)
+QML_DECLARE_TYPE(QDeclarativeCurve)
+QML_DECLARE_TYPE(QDeclarativePathLine)
+QML_DECLARE_TYPE(QDeclarativePathQuad)
+QML_DECLARE_TYPE(QDeclarativePathCubic)
+QML_DECLARE_TYPE(QDeclarativePathPercent)
+QML_DECLARE_TYPE(QDeclarativePath)
QT_END_HEADER
-#endif // QMLGRAPHICSPATH_H
+#endif // QDECLARATIVEPATH_H
diff --git a/src/declarative/graphicsitems/qmlgraphicspath_p_p.h b/src/declarative/graphicsitems/qdeclarativepath_p_p.h
index acff7c8..fb63867 100644
--- a/src/declarative/graphicsitems/qmlgraphicspath_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepath_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSPATH_P_H
-#define QMLGRAPHICSPATH_P_H
+#ifndef QDECLARATIVEPATH_P_H
+#define QDECLARATIVEPATH_P_H
//
// W A R N I N G
@@ -53,24 +53,24 @@
// We mean it.
//
-#include "qmlgraphicspath_p.h"
+#include "qdeclarativepath_p.h"
-#include <qml.h>
+#include <qdeclarative.h>
#include <private/qobject_p.h>
QT_BEGIN_NAMESPACE
-class QmlGraphicsPathPrivate : public QObjectPrivate
+class QDeclarativePathPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsPath)
+ Q_DECLARE_PUBLIC(QDeclarativePath)
public:
- QmlGraphicsPathPrivate() : startX(0), startY(0), closed(false) { }
+ QDeclarativePathPrivate() : startX(0), startY(0), closed(false) { }
QPainterPath _path;
- QList<QmlGraphicsPathElement*> _pathElements;
+ QList<QDeclarativePathElement*> _pathElements;
mutable QVector<QPointF> _pointCache;
- QList<QmlGraphicsPath::AttributePoint> _attributePoints;
+ QList<QDeclarativePath::AttributePoint> _attributePoints;
QStringList _attributes;
int startX;
int startY;
diff --git a/src/declarative/graphicsitems/qmlgraphicspathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 9a2c24d..c131f4c 100644
--- a/src/declarative/graphicsitems/qmlgraphicspathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#include "qmlgraphicspathview_p.h"
-#include "qmlgraphicspathview_p_p.h"
+#include "qdeclarativepathview_p.h"
+#include "qdeclarativepathview_p_p.h"
-#include <qmlstate_p.h>
-#include <qmlopenmetaobject_p.h>
+#include <qdeclarativestate_p.h>
+#include <qdeclarativeopenmetaobject_p.h>
#include <QDebug>
#include <QEvent>
@@ -65,20 +65,20 @@ inline qreal qmlMod(qreal x, qreal y)
}
-class QmlGraphicsPathViewAttached : public QObject
+class QDeclarativePathViewAttached : public QObject
{
Q_OBJECT
Q_PROPERTY(bool onPath READ isOnPath NOTIFY onPathChanged)
public:
- QmlGraphicsPathViewAttached(QObject *parent)
- : QObject(parent), mo(new QmlOpenMetaObject(this)), onPath(false)
+ QDeclarativePathViewAttached(QObject *parent)
+ : QObject(parent), mo(new QDeclarativeOpenMetaObject(this)), onPath(false)
{
}
- ~QmlGraphicsPathViewAttached()
+ ~QDeclarativePathViewAttached()
{
- QmlGraphicsPathView::attachedProperties.remove(parent());
+ QDeclarativePathView::attachedProperties.remove(parent());
}
QVariant value(const QByteArray &name) const
@@ -102,39 +102,39 @@ Q_SIGNALS:
void onPathChanged();
private:
- QmlOpenMetaObject *mo;
+ QDeclarativeOpenMetaObject *mo;
bool onPath;
};
-QmlGraphicsItem *QmlGraphicsPathViewPrivate::getItem(int modelIndex)
+QDeclarativeItem *QDeclarativePathViewPrivate::getItem(int modelIndex)
{
- Q_Q(QmlGraphicsPathView);
+ Q_Q(QDeclarativePathView);
requestedIndex = modelIndex;
- QmlGraphicsItem *item = model->item(modelIndex);
+ QDeclarativeItem *item = model->item(modelIndex);
if (item) {
- if (QObject *obj = QmlGraphicsPathView::qmlAttachedProperties(item))
- static_cast<QmlGraphicsPathViewAttached *>(obj)->setOnPath(true);
+ if (QObject *obj = QDeclarativePathView::qmlAttachedProperties(item))
+ static_cast<QDeclarativePathViewAttached *>(obj)->setOnPath(true);
item->setParentItem(q);
}
requestedIndex = -1;
return item;
}
-void QmlGraphicsPathViewPrivate::releaseItem(QmlGraphicsItem *item)
+void QDeclarativePathViewPrivate::releaseItem(QDeclarativeItem *item)
{
if (!item || !model)
return;
- if (QObject *obj = QmlGraphicsPathView::qmlAttachedProperties(item))
- static_cast<QmlGraphicsPathViewAttached *>(obj)->setOnPath(false);
+ if (QObject *obj = QDeclarativePathView::qmlAttachedProperties(item))
+ static_cast<QDeclarativePathViewAttached *>(obj)->setOnPath(false);
if (model->release(item) == 0) {
- if (QObject *obj = QmlGraphicsPathView::qmlAttachedProperties(item))
- static_cast<QmlGraphicsPathViewAttached *>(obj)->setOnPath(false);
+ if (QObject *obj = QDeclarativePathView::qmlAttachedProperties(item))
+ static_cast<QDeclarativePathViewAttached *>(obj)->setOnPath(false);
}
}
/*!
- \qmlclass PathView QmlGraphicsPathView
+ \qmlclass PathView QDeclarativePathView
\since 4.7
\brief The PathView element lays out model-provided items on a path.
\inherits Item
@@ -150,16 +150,16 @@ void QmlGraphicsPathViewPrivate::releaseItem(QmlGraphicsItem *item)
\sa Path
*/
-QmlGraphicsPathView::QmlGraphicsPathView(QmlGraphicsItem *parent)
- : QmlGraphicsItem(*(new QmlGraphicsPathViewPrivate), parent)
+QDeclarativePathView::QDeclarativePathView(QDeclarativeItem *parent)
+ : QDeclarativeItem(*(new QDeclarativePathViewPrivate), parent)
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
d->init();
}
-QmlGraphicsPathView::~QmlGraphicsPathView()
+QDeclarativePathView::~QDeclarativePathView()
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
if (d->ownModel)
delete d->model;
}
@@ -194,21 +194,22 @@ QmlGraphicsPathView::~QmlGraphicsPathView()
\sa {qmlmodels}{Data Models}
*/
-QVariant QmlGraphicsPathView::model() const
+QVariant QDeclarativePathView::model() const
{
- Q_D(const QmlGraphicsPathView);
+ Q_D(const QDeclarativePathView);
return d->modelVariant;
}
-void QmlGraphicsPathView::setModel(const QVariant &model)
+void QDeclarativePathView::setModel(const QVariant &model)
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
if (d->model) {
disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
- disconnect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*)));
+ disconnect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset()));
+ disconnect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*)));
for (int i=0; i<d->items.count(); i++){
- QmlGraphicsItem *p = d->items[i];
+ QDeclarativeItem *p = d->items[i];
d->model->release(p);
}
d->items.clear();
@@ -216,8 +217,8 @@ void QmlGraphicsPathView::setModel(const QVariant &model)
d->modelVariant = model;
QObject *object = qvariant_cast<QObject*>(model);
- QmlGraphicsVisualModel *vim = 0;
- if (object && (vim = qobject_cast<QmlGraphicsVisualModel *>(object))) {
+ QDeclarativeVisualModel *vim = 0;
+ if (object && (vim = qobject_cast<QDeclarativeVisualModel *>(object))) {
if (d->ownModel) {
delete d->model;
d->ownModel = false;
@@ -225,16 +226,17 @@ void QmlGraphicsPathView::setModel(const QVariant &model)
d->model = vim;
} else {
if (!d->ownModel) {
- d->model = new QmlGraphicsVisualDataModel(qmlContext(this));
+ d->model = new QDeclarativeVisualDataModel(qmlContext(this));
d->ownModel = true;
}
- if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model))
+ if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model))
dataModel->setModel(model);
}
if (d->model) {
connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
- connect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*)));
+ connect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset()));
+ connect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*)));
}
d->firstIndex = 0;
d->pathOffset = 0;
@@ -246,9 +248,9 @@ void QmlGraphicsPathView::setModel(const QVariant &model)
\qmlproperty int PathView::count
This property holds the number of items in the model.
*/
-int QmlGraphicsPathView::count() const
+int QDeclarativePathView::count() const
{
- Q_D(const QmlGraphicsPathView);
+ Q_D(const QDeclarativePathView);
return d->model ? d->model->count() : 0;
}
@@ -258,15 +260,15 @@ int QmlGraphicsPathView::count() const
This property holds the path used to lay out the items.
For more information see the \l Path documentation.
*/
-QmlGraphicsPath *QmlGraphicsPathView::path() const
+QDeclarativePath *QDeclarativePathView::path() const
{
- Q_D(const QmlGraphicsPathView);
+ Q_D(const QDeclarativePathView);
return d->path;
}
-void QmlGraphicsPathView::setPath(QmlGraphicsPath *path)
+void QDeclarativePathView::setPath(QDeclarativePath *path)
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
d->path = path;
connect(d->path, SIGNAL(changed()), this, SLOT(refill()));
d->regenerate();
@@ -276,15 +278,15 @@ void QmlGraphicsPathView::setPath(QmlGraphicsPath *path)
\qmlproperty int PathView::currentIndex
This property holds the index of the current item.
*/
-int QmlGraphicsPathView::currentIndex() const
+int QDeclarativePathView::currentIndex() const
{
- Q_D(const QmlGraphicsPathView);
+ Q_D(const QDeclarativePathView);
return d->currentIndex;
}
-void QmlGraphicsPathView::setCurrentIndex(int idx)
+void QDeclarativePathView::setCurrentIndex(int idx)
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
if (d->model && d->model->count())
idx = qAbs(idx % d->model->count());
if (d->model && idx != d->currentIndex) {
@@ -304,22 +306,22 @@ void QmlGraphicsPathView::setCurrentIndex(int idx)
The offset specifies how far along the path the items are from their initial positions.
*/
-qreal QmlGraphicsPathView::offset() const
+qreal QDeclarativePathView::offset() const
{
- Q_D(const QmlGraphicsPathView);
+ Q_D(const QDeclarativePathView);
return d->_offset;
}
-void QmlGraphicsPathView::setOffset(qreal offset)
+void QDeclarativePathView::setOffset(qreal offset)
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
d->setOffset(offset);
d->updateCurrent();
}
-void QmlGraphicsPathViewPrivate::setOffset(qreal o)
+void QDeclarativePathViewPrivate::setOffset(qreal o)
{
- Q_Q(QmlGraphicsPathView);
+ Q_Q(QDeclarativePathView);
if (_offset != o) {
_offset = qmlMod(o, qreal(100.0));
if (_offset < 0)
@@ -333,15 +335,15 @@ void QmlGraphicsPathViewPrivate::setOffset(qreal o)
This property determines the position (0-100) the nearest item will snap to.
*/
-qreal QmlGraphicsPathView::snapPosition() const
+qreal QDeclarativePathView::snapPosition() const
{
- Q_D(const QmlGraphicsPathView);
+ Q_D(const QDeclarativePathView);
return d->snapPos;
}
-void QmlGraphicsPathView::setSnapPosition(qreal pos)
+void QDeclarativePathView::setSnapPosition(qreal pos)
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
d->snapPos = pos/100;
d->fixOffset();
}
@@ -354,15 +356,15 @@ void QmlGraphicsPathView::setSnapPosition(qreal pos)
dragMargin is greater than zero, a drag can be initiated by clicking
within dragMargin pixels of the path.
*/
-qreal QmlGraphicsPathView::dragMargin() const
+qreal QDeclarativePathView::dragMargin() const
{
- Q_D(const QmlGraphicsPathView);
+ Q_D(const QDeclarativePathView);
return d->dragMargin;
}
-void QmlGraphicsPathView::setDragMargin(qreal dragMargin)
+void QDeclarativePathView::setDragMargin(qreal dragMargin)
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
d->dragMargin = dragMargin;
}
@@ -379,25 +381,25 @@ void QmlGraphicsPathView::setDragMargin(qreal dragMargin)
Here is an example delegate:
\snippet doc/src/snippets/declarative/pathview/pathview.qml 1
*/
-QmlComponent *QmlGraphicsPathView::delegate() const
+QDeclarativeComponent *QDeclarativePathView::delegate() const
{
- Q_D(const QmlGraphicsPathView);
+ Q_D(const QDeclarativePathView);
if (d->model) {
- if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model))
+ if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model))
return dataModel->delegate();
}
return 0;
}
-void QmlGraphicsPathView::setDelegate(QmlComponent *c)
+void QDeclarativePathView::setDelegate(QDeclarativeComponent *c)
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
if (!d->ownModel) {
- d->model = new QmlGraphicsVisualDataModel(qmlContext(this));
+ d->model = new QDeclarativeVisualDataModel(qmlContext(this));
d->ownModel = true;
}
- if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model)) {
+ if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model)) {
dataModel->setDelegate(c);
d->regenerate();
}
@@ -407,22 +409,22 @@ void QmlGraphicsPathView::setDelegate(QmlComponent *c)
\qmlproperty int PathView::pathItemCount
This property holds the number of items visible on the path at any one time
*/
-int QmlGraphicsPathView::pathItemCount() const
+int QDeclarativePathView::pathItemCount() const
{
- Q_D(const QmlGraphicsPathView);
+ Q_D(const QDeclarativePathView);
return d->pathItems;
}
-void QmlGraphicsPathView::setPathItemCount(int i)
+void QDeclarativePathView::setPathItemCount(int i)
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
if (i == d->pathItems)
return;
d->pathItems = i;
d->regenerate();
}
-QPointF QmlGraphicsPathViewPrivate::pointNear(const QPointF &point, qreal *nearPercent) const
+QPointF QDeclarativePathViewPrivate::pointNear(const QPointF &point, qreal *nearPercent) const
{
//XXX maybe do recursively at increasing resolution.
qreal mindist = 1e10; // big number
@@ -446,9 +448,9 @@ QPointF QmlGraphicsPathViewPrivate::pointNear(const QPointF &point, qreal *nearP
}
-void QmlGraphicsPathView::mousePressEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativePathView::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
if (!d->items.count())
return;
QPointF scenePoint = mapToScene(event->pos());
@@ -472,13 +474,13 @@ void QmlGraphicsPathView::mousePressEvent(QGraphicsSceneMouseEvent *event)
d->stealMouse = false;
d->lastElapsed = 0;
d->lastDist = 0;
- QmlGraphicsItemPrivate::start(d->lastPosTime);
+ QDeclarativeItemPrivate::start(d->lastPosTime);
d->tl.clear();
}
-void QmlGraphicsPathView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativePathView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
if (d->lastPosTime.isNull())
return;
@@ -489,7 +491,7 @@ void QmlGraphicsPathView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
if (d->stealMouse) {
- d->moveReason = QmlGraphicsPathViewPrivate::Mouse;
+ d->moveReason = QDeclarativePathViewPrivate::Mouse;
qreal newPc;
d->pointNear(event->pos(), &newPc);
qreal diff = newPc - d->startPc;
@@ -501,20 +503,20 @@ void QmlGraphicsPathView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
else if (diff < -50)
diff += 100;
- d->lastElapsed = QmlGraphicsItemPrivate::restart(d->lastPosTime);
+ d->lastElapsed = QDeclarativeItemPrivate::restart(d->lastPosTime);
d->lastDist = diff;
d->startPc = newPc;
}
}
}
-void QmlGraphicsPathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *)
+void QDeclarativePathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *)
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
if (d->lastPosTime.isNull())
return;
- qreal elapsed = qreal(d->lastElapsed + QmlGraphicsItemPrivate::elapsed(d->lastPosTime)) / 1000.;
+ qreal elapsed = qreal(d->lastElapsed + QDeclarativeItemPrivate::elapsed(d->lastPosTime)) / 1000.;
qreal velocity = elapsed > 0. ? d->lastDist / elapsed : 0;
if (d->model && d->model->count() && qAbs(velocity) > 5) {
if (velocity > 100)
@@ -525,7 +527,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.callback(QmlTimeLineCallback(&d->moveOffset, d->fixOffsetCallback, d));
+ d->tl.callback(QDeclarativeTimeLineCallback(&d->moveOffset, d->fixOffsetCallback, d));
} else {
d->fixOffset();
}
@@ -535,13 +537,13 @@ void QmlGraphicsPathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *)
ungrabMouse();
}
-bool QmlGraphicsPathView::sendMouseEvent(QGraphicsSceneMouseEvent *event)
+bool QDeclarativePathView::sendMouseEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
QGraphicsSceneMouseEvent mouseEvent(event->type());
QRectF myRect = mapToScene(QRectF(0, 0, width(), height())).boundingRect();
QGraphicsScene *s = scene();
- QmlGraphicsItem *grabber = s ? qobject_cast<QmlGraphicsItem*>(s->mouseGrabberItem()) : 0;
+ QDeclarativeItem *grabber = s ? qobject_cast<QDeclarativeItem*>(s->mouseGrabberItem()) : 0;
if ((d->stealMouse || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) {
mouseEvent.setAccepted(false);
for (int i = 0x1; i <= 0x10; i <<= 1) {
@@ -568,7 +570,7 @@ bool QmlGraphicsPathView::sendMouseEvent(QGraphicsSceneMouseEvent *event)
default:
break;
}
- grabber = qobject_cast<QmlGraphicsItem*>(s->mouseGrabberItem());
+ grabber = qobject_cast<QDeclarativeItem*>(s->mouseGrabberItem());
if (grabber && d->stealMouse && !grabber->keepMouseGrab() && grabber != this)
grabMouse();
@@ -579,10 +581,10 @@ bool QmlGraphicsPathView::sendMouseEvent(QGraphicsSceneMouseEvent *event)
return false;
}
-bool QmlGraphicsPathView::sceneEventFilter(QGraphicsItem *i, QEvent *e)
+bool QDeclarativePathView::sceneEventFilter(QGraphicsItem *i, QEvent *e)
{
if (!isVisible())
- return QmlGraphicsItem::sceneEventFilter(i, e);
+ return QDeclarativeItem::sceneEventFilter(i, e);
switch (e->type()) {
case QEvent::GraphicsSceneMousePress:
@@ -598,13 +600,13 @@ bool QmlGraphicsPathView::sceneEventFilter(QGraphicsItem *i, QEvent *e)
break;
}
- return QmlGraphicsItem::sceneEventFilter(i, e);
+ return QDeclarativeItem::sceneEventFilter(i, e);
}
-void QmlGraphicsPathView::componentComplete()
+void QDeclarativePathView::componentComplete()
{
- Q_D(QmlGraphicsPathView);
- QmlGraphicsItem::componentComplete();
+ Q_D(QDeclarativePathView);
+ QDeclarativeItem::componentComplete();
d->regenerate();
// move to correct offset
@@ -623,14 +625,14 @@ void QmlGraphicsPathView::componentComplete()
}
}
-void QmlGraphicsPathViewPrivate::regenerate()
+void QDeclarativePathViewPrivate::regenerate()
{
- Q_Q(QmlGraphicsPathView);
+ Q_Q(QDeclarativePathView);
if (!q->isComponentComplete())
return;
for (int i=0; i<items.count(); i++){
- QmlGraphicsItem *p = items[i];
+ QDeclarativeItem *p = items[i];
releaseItem(p);
}
items.clear();
@@ -646,7 +648,7 @@ void QmlGraphicsPathViewPrivate::regenerate()
int numItems = pathItems >= 0 ? pathItems : model->count();
for (int i=0; i < numItems && i < model->count(); ++i){
int index = (i + firstIndex) % model->count();
- QmlGraphicsItem *item = getItem(index);
+ QDeclarativeItem *item = getItem(index);
if (!item) {
qWarning() << "PathView: Cannot create item, index" << (i + firstIndex) % model->count();
return;
@@ -659,20 +661,20 @@ void QmlGraphicsPathViewPrivate::regenerate()
q->refill();
}
-void QmlGraphicsPathViewPrivate::updateItem(QmlGraphicsItem *item, qreal percent)
+void QDeclarativePathViewPrivate::updateItem(QDeclarativeItem *item, qreal percent)
{
- if (QObject *obj = QmlGraphicsPathView::qmlAttachedProperties(item)) {
+ if (QObject *obj = QDeclarativePathView::qmlAttachedProperties(item)) {
foreach(const QString &attr, path->attributes())
- static_cast<QmlGraphicsPathViewAttached *>(obj)->setValue(attr.toUtf8(), path->attributeAt(attr, percent));
+ static_cast<QDeclarativePathViewAttached *>(obj)->setValue(attr.toUtf8(), path->attributeAt(attr, percent));
}
QPointF pf = path->pointAt(percent);
item->setX(pf.x() - item->width()*item->scale()/2);
item->setY(pf.y() - item->height()*item->scale()/2);
}
-void QmlGraphicsPathView::refill()
+void QDeclarativePathView::refill()
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
if (!d->isValid() || !isComponentComplete())
return;
@@ -705,13 +707,13 @@ void QmlGraphicsPathView::refill()
//A wraparound has occured
if (wrapIndex < d->items.count()/2){
while(wrapIndex-- >= 0){
- QmlGraphicsItem* p = d->items.takeFirst();
+ QDeclarativeItem* p = d->items.takeFirst();
d->updateItem(p, 0.0);
d->releaseItem(p);
d->firstIndex++;
d->firstIndex %= d->model->count();
int index = (d->firstIndex + d->items.count())%d->model->count();
- QmlGraphicsItem *item = d->getItem(index);
+ QDeclarativeItem *item = d->getItem(index);
item->setZValue(wrapIndex);
if (d->currentIndex == index)
item->setFocus(true);
@@ -721,13 +723,13 @@ void QmlGraphicsPathView::refill()
}
} else {
while(wrapIndex++ < d->items.count()-1){
- QmlGraphicsItem* p = d->items.takeLast();
+ QDeclarativeItem* p = d->items.takeLast();
d->updateItem(p, 1.0);
d->releaseItem(p);
d->firstIndex--;
if (d->firstIndex < 0)
d->firstIndex = d->model->count() - 1;
- QmlGraphicsItem *item = d->getItem(d->firstIndex);
+ QDeclarativeItem *item = d->getItem(d->firstIndex);
item->setZValue(d->firstIndex);
if (d->currentIndex == d->firstIndex)
item->setFocus(true);
@@ -745,15 +747,15 @@ void QmlGraphicsPathView::refill()
d->updateItem(d->items.at(i), rotatedPositions[i]);
}
-void QmlGraphicsPathView::itemsInserted(int modelIndex, int count)
+void QDeclarativePathView::itemsInserted(int modelIndex, int count)
{
//XXX support animated insertion
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
if (!d->isValid() || !isComponentComplete())
return;
if (d->pathItems == -1) {
for (int i = 0; i < count; ++i) {
- QmlGraphicsItem *item = d->getItem(modelIndex + i);
+ QDeclarativeItem *item = d->getItem(modelIndex + i);
item->setZValue(modelIndex + i);
d->items.insert(modelIndex + i, item);
}
@@ -775,15 +777,15 @@ void QmlGraphicsPathView::itemsInserted(int modelIndex, int count)
d->moveOffset.setValue(targetOffset);
}
-void QmlGraphicsPathView::itemsRemoved(int modelIndex, int count)
+void QDeclarativePathView::itemsRemoved(int modelIndex, int count)
{
//XXX support animated removal
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
if (!d->isValid() || !isComponentComplete())
return;
if (d->pathItems == -1) {
- for (int i = 0; i < count; ++i) {
- QmlGraphicsItem* p = d->items.takeAt(modelIndex);
+ for (int i = 0; i < count && d->items.count() > modelIndex; ++i) {
+ QDeclarativeItem* p = d->items.takeAt(modelIndex);
d->model->release(p);
}
d->snapToCurrent();
@@ -812,28 +814,34 @@ void QmlGraphicsPathView::itemsRemoved(int modelIndex, int count)
d->moveOffset.setValue(targetOffset);
}
-void QmlGraphicsPathView::createdItem(int index, QmlGraphicsItem *item)
+void QDeclarativePathView::modelReset()
+{
+ Q_D(QDeclarativePathView);
+ d->regenerate();
+}
+
+void QDeclarativePathView::createdItem(int index, QDeclarativeItem *item)
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
if (d->requestedIndex != index) {
item->setParentItem(this);
d->updateItem(item, index < d->firstIndex ? 0.0 : 1.0);
}
}
-void QmlGraphicsPathView::destroyingItem(QmlGraphicsItem *item)
+void QDeclarativePathView::destroyingItem(QDeclarativeItem *item)
{
Q_UNUSED(item);
}
-void QmlGraphicsPathView::ticked()
+void QDeclarativePathView::ticked()
{
- Q_D(QmlGraphicsPathView);
+ Q_D(QDeclarativePathView);
d->updateCurrent();
}
// find the item closest to the snap position
-int QmlGraphicsPathViewPrivate::calcCurrentIndex()
+int QDeclarativePathViewPrivate::calcCurrentIndex()
{
int current = -1;
if (model && items.count()) {
@@ -872,9 +880,9 @@ int QmlGraphicsPathViewPrivate::calcCurrentIndex()
return current;
}
-void QmlGraphicsPathViewPrivate::updateCurrent()
+void QDeclarativePathViewPrivate::updateCurrent()
{
- Q_Q(QmlGraphicsPathView);
+ Q_Q(QDeclarativePathView);
if (moveReason != Mouse)
return;
int idx = calcCurrentIndex();
@@ -887,14 +895,14 @@ void QmlGraphicsPathViewPrivate::updateCurrent()
}
}
-void QmlGraphicsPathViewPrivate::fixOffsetCallback(void *d)
+void QDeclarativePathViewPrivate::fixOffsetCallback(void *d)
{
- ((QmlGraphicsPathViewPrivate *)d)->fixOffset();
+ ((QDeclarativePathViewPrivate *)d)->fixOffset();
}
-void QmlGraphicsPathViewPrivate::fixOffset()
+void QDeclarativePathViewPrivate::fixOffset()
{
- Q_Q(QmlGraphicsPathView);
+ Q_Q(QDeclarativePathView);
if (model && items.count()) {
int curr = calcCurrentIndex();
if (curr != currentIndex)
@@ -904,7 +912,7 @@ void QmlGraphicsPathViewPrivate::fixOffset()
}
}
-void QmlGraphicsPathViewPrivate::snapToCurrent()
+void QDeclarativePathViewPrivate::snapToCurrent()
{
if (!model || model->count() <= 0)
return;
@@ -944,7 +952,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.callback(QmlTimeLineCallback(&moveOffset, fixOffsetCallback, this));
+ tl.callback(QDeclarativeTimeLineCallback(&moveOffset, fixOffsetCallback, this));
return;
}
@@ -963,12 +971,12 @@ void QmlGraphicsPathViewPrivate::snapToCurrent()
}
}
-QHash<QObject*, QObject*> QmlGraphicsPathView::attachedProperties;
-QObject *QmlGraphicsPathView::qmlAttachedProperties(QObject *obj)
+QHash<QObject*, QObject*> QDeclarativePathView::attachedProperties;
+QObject *QDeclarativePathView::qmlAttachedProperties(QObject *obj)
{
QObject *rv = attachedProperties.value(obj);
if (!rv) {
- rv = new QmlGraphicsPathViewAttached(obj);
+ rv = new QDeclarativePathViewAttached(obj);
attachedProperties.insert(obj, rv);
}
return rv;
@@ -976,4 +984,4 @@ QObject *QmlGraphicsPathView::qmlAttachedProperties(QObject *obj)
QT_END_NAMESPACE
-#include <qmlgraphicspathview.moc>
+#include <qdeclarativepathview.moc>
diff --git a/src/declarative/graphicsitems/qmlgraphicspathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h
index 8273ccc..709a4fc 100644
--- a/src/declarative/graphicsitems/qmlgraphicspathview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSPATHVIEW_H
-#define QMLGRAPHICSPATHVIEW_H
+#ifndef QDECLARATIVEPATHVIEW_H
+#define QDECLARATIVEPATHVIEW_H
-#include "qmlgraphicsitem.h"
-#include "qmlgraphicspath_p.h"
+#include "qdeclarativeitem.h"
+#include "qdeclarativepath_p.h"
QT_BEGIN_HEADER
@@ -51,30 +51,30 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsPathViewPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsPathView : public QmlGraphicsItem
+class QDeclarativePathViewPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativePathView : public QDeclarativeItem
{
Q_OBJECT
Q_PROPERTY(QVariant model READ model WRITE setModel)
- Q_PROPERTY(QmlGraphicsPath *path READ path WRITE setPath)
+ Q_PROPERTY(QDeclarativePath *path READ path WRITE setPath)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
Q_PROPERTY(qreal offset READ offset WRITE setOffset NOTIFY offsetChanged)
Q_PROPERTY(qreal snapPosition READ snapPosition WRITE setSnapPosition)
Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin)
Q_PROPERTY(int count READ count)
- Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate)
+ Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate)
Q_PROPERTY(int pathItemCount READ pathItemCount WRITE setPathItemCount)
public:
- QmlGraphicsPathView(QmlGraphicsItem *parent=0);
- virtual ~QmlGraphicsPathView();
+ QDeclarativePathView(QDeclarativeItem *parent=0);
+ virtual ~QDeclarativePathView();
QVariant model() const;
void setModel(const QVariant &);
- QmlGraphicsPath *path() const;
- void setPath(QmlGraphicsPath *);
+ QDeclarativePath *path() const;
+ void setPath(QDeclarativePath *);
int currentIndex() const;
void setCurrentIndex(int idx);
@@ -90,8 +90,8 @@ public:
int count() const;
- QmlComponent *delegate() const;
- void setDelegate(QmlComponent *);
+ QDeclarativeComponent *delegate() const;
+ void setDelegate(QDeclarativeComponent *);
int pathItemCount() const;
void setPathItemCount(int);
@@ -115,20 +115,21 @@ private Q_SLOTS:
void ticked();
void itemsInserted(int index, int count);
void itemsRemoved(int index, int count);
- void createdItem(int index, QmlGraphicsItem *item);
- void destroyingItem(QmlGraphicsItem *item);
+ void modelReset();
+ void createdItem(int index, QDeclarativeItem *item);
+ void destroyingItem(QDeclarativeItem *item);
private:
- friend class QmlGraphicsPathViewAttached;
+ friend class QDeclarativePathViewAttached;
static QHash<QObject*, QObject*> attachedProperties;
- Q_DISABLE_COPY(QmlGraphicsPathView)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsPathView)
+ Q_DISABLE_COPY(QDeclarativePathView)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativePathView)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsPathView)
-QML_DECLARE_TYPEINFO(QmlGraphicsPathView, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPE(QDeclarativePathView)
+QML_DECLARE_TYPEINFO(QDeclarativePathView, QML_HAS_ATTACHED_PROPERTIES)
QT_END_HEADER
-#endif // QMLGRAPHICSPATHVIEW_H
+#endif // QDECLARATIVEPATHVIEW_H
diff --git a/src/declarative/graphicsitems/qmlgraphicspathview_p_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
index c635833..ca50910 100644
--- a/src/declarative/graphicsitems/qmlgraphicspathview_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSPATHVIEW_P_H
-#define QMLGRAPHICSPATHVIEW_P_H
+#ifndef QDECLARATIVEPATHVIEW_P_H
+#define QDECLARATIVEPATHVIEW_P_H
//
// W A R N I N G
@@ -53,13 +53,13 @@
// We mean it.
//
-#include "qmlgraphicspathview_p.h"
+#include "qdeclarativepathview_p.h"
-#include "qmlgraphicsitem_p.h"
-#include "qmlgraphicsvisualitemmodel_p.h"
+#include "qdeclarativeitem_p.h"
+#include "qdeclarativevisualitemmodel_p.h"
-#include <qml.h>
-#include <qmlanimation_p_p.h>
+#include <qdeclarative.h>
+#include <qdeclarativeanimation_p_p.h>
#include <qdatetime.h>
@@ -67,18 +67,18 @@ QT_BEGIN_NAMESPACE
typedef struct PathViewItem{
int index;
- QmlGraphicsItem* item;
+ QDeclarativeItem* item;
}PathViewItem;
-class QmlGraphicsPathViewPrivate : public QmlGraphicsItemPrivate
+class QDeclarativePathViewPrivate : public QDeclarativeItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsPathView)
+ Q_DECLARE_PUBLIC(QDeclarativePathView)
public:
- QmlGraphicsPathViewPrivate()
+ QDeclarativePathViewPrivate()
: path(0), currentIndex(0), startPc(0), lastDist(0)
, lastElapsed(0), stealMouse(false), ownModel(false), activeItem(0)
- , snapPos(0), dragMargin(0), moveOffset(this, &QmlGraphicsPathViewPrivate::setOffset)
+ , snapPos(0), dragMargin(0), moveOffset(this, &QDeclarativePathViewPrivate::setOffset)
, firstIndex(0), pathItems(-1), pathOffset(0), requestedIndex(-1)
, moveReason(Other)
{
@@ -86,7 +86,7 @@ public:
void init()
{
- Q_Q(QmlGraphicsPathView);
+ Q_Q(QDeclarativePathView);
_offset = 0;
q->setAcceptedMouseButtons(Qt::LeftButton);
q->setFlag(QGraphicsItem::ItemIsFocusScope);
@@ -94,8 +94,8 @@ public:
q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked()));
}
- QmlGraphicsItem *getItem(int modelIndex);
- void releaseItem(QmlGraphicsItem *item);
+ QDeclarativeItem *getItem(int modelIndex);
+ void releaseItem(QDeclarativeItem *item);
bool isValid() const {
return model && model->count() > 0 && model->isValid() && path;
@@ -107,11 +107,11 @@ public:
void fixOffset();
void setOffset(qreal offset);
void regenerate();
- void updateItem(QmlGraphicsItem *, qreal);
+ void updateItem(QDeclarativeItem *, qreal);
void snapToCurrent();
QPointF pointNear(const QPointF &point, qreal *nearPercent=0) const;
- QmlGraphicsPath *path;
+ QDeclarativePath *path;
int currentIndex;
qreal startPc;
QPointF startPoint;
@@ -122,17 +122,17 @@ public:
bool ownModel : 1;
QTime lastPosTime;
QPointF lastPos;
- QmlGraphicsItem *activeItem;
+ QDeclarativeItem *activeItem;
qreal snapPos;
qreal dragMargin;
- QmlTimeLine tl;
- QmlTimeLineValueProxy<QmlGraphicsPathViewPrivate> moveOffset;
+ QDeclarativeTimeLine tl;
+ QDeclarativeTimeLineValueProxy<QDeclarativePathViewPrivate> moveOffset;
int firstIndex;
int pathItems;
int pathOffset;
int requestedIndex;
- QList<QmlGraphicsItem *> items;
- QGuard<QmlGraphicsVisualModel> model;
+ QList<QDeclarativeItem *> items;
+ QGuard<QDeclarativeVisualModel> model;
QVariant modelVariant;
enum MovementReason { Other, Key, Mouse };
MovementReason moveReason;
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
index 84af67d..1212e89 100644
--- a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
@@ -39,13 +39,13 @@
**
****************************************************************************/
-#include "qmlgraphicspositioners_p.h"
-#include "qmlgraphicspositioners_p_p.h"
+#include "qdeclarativepositioners_p.h"
+#include "qdeclarativepositioners_p_p.h"
-#include <qml.h>
-#include <qmlstate_p.h>
-#include <qmlstategroup_p.h>
-#include <qmlstateoperations_p.h>
+#include <qdeclarative.h>
+#include <qdeclarativestate_p.h>
+#include <qdeclarativestategroup_p.h>
+#include <qdeclarativestateoperations_p.h>
#include <qfxperf_p_p.h>
#include <QtCore/qmath.h>
@@ -54,34 +54,34 @@
QT_BEGIN_NAMESPACE
-static const QmlGraphicsItemPrivate::ChangeTypes watchedChanges
- = QmlGraphicsItemPrivate::Geometry
- | QmlGraphicsItemPrivate::SiblingOrder
- | QmlGraphicsItemPrivate::Visibility
- | QmlGraphicsItemPrivate::Opacity
- | QmlGraphicsItemPrivate::Destroyed;
+static const QDeclarativeItemPrivate::ChangeTypes watchedChanges
+ = QDeclarativeItemPrivate::Geometry
+ | QDeclarativeItemPrivate::SiblingOrder
+ | QDeclarativeItemPrivate::Visibility
+ | QDeclarativeItemPrivate::Opacity
+ | QDeclarativeItemPrivate::Destroyed;
-void QmlGraphicsBasePositionerPrivate::watchChanges(QmlGraphicsItem *other)
+void QDeclarativeBasePositionerPrivate::watchChanges(QDeclarativeItem *other)
{
- QmlGraphicsItemPrivate *otherPrivate = static_cast<QmlGraphicsItemPrivate*>(QGraphicsItemPrivate::get(other));
+ QDeclarativeItemPrivate *otherPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(other));
otherPrivate->addItemChangeListener(this, watchedChanges);
}
-void QmlGraphicsBasePositionerPrivate::unwatchChanges(QmlGraphicsItem* other)
+void QDeclarativeBasePositionerPrivate::unwatchChanges(QDeclarativeItem* other)
{
- QmlGraphicsItemPrivate *otherPrivate = static_cast<QmlGraphicsItemPrivate*>(QGraphicsItemPrivate::get(other));
+ QDeclarativeItemPrivate *otherPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(other));
otherPrivate->removeItemChangeListener(this, watchedChanges);
}
/*!
\internal
- \class QmlGraphicsBasePositioner
+ \class QDeclarativeBasePositioner
\ingroup group_layouts
- \brief The QmlGraphicsBasePositioner class provides a base for QmlGraphics layouts.
+ \brief The QDeclarativeBasePositioner class provides a base for QDeclarativeGraphics layouts.
- To create a QmlGraphics Positioner, simply subclass QmlGraphicsBasePositioner and implement
+ To create a QDeclarativeGraphics Positioner, simply subclass QDeclarativeBasePositioner and implement
doLayout(), which is automatically called when the layout might need
- updating. In doLayout() use the setX and setY functions from QmlBasePositioner, and the
+ updating. In doLayout() use the setX and setY functions from QDeclarativeBasePositioner, and the
base class will apply the positions along with the appropriate transitions. The items to
position are provided in order as the protected member positionedItems.
@@ -91,37 +91,37 @@ void QmlGraphicsBasePositionerPrivate::unwatchChanges(QmlGraphicsItem* other)
Note that the subclass is responsible for adding the
spacing in between items.
*/
-QmlGraphicsBasePositioner::QmlGraphicsBasePositioner(PositionerType at, QmlGraphicsItem *parent)
- : QmlGraphicsItem(*(new QmlGraphicsBasePositionerPrivate), parent)
+QDeclarativeBasePositioner::QDeclarativeBasePositioner(PositionerType at, QDeclarativeItem *parent)
+ : QDeclarativeItem(*(new QDeclarativeBasePositionerPrivate), parent)
{
- Q_D(QmlGraphicsBasePositioner);
+ Q_D(QDeclarativeBasePositioner);
d->init(at);
}
-QmlGraphicsBasePositioner::QmlGraphicsBasePositioner(QmlGraphicsBasePositionerPrivate &dd, PositionerType at, QmlGraphicsItem *parent)
- : QmlGraphicsItem(dd, parent)
+QDeclarativeBasePositioner::QDeclarativeBasePositioner(QDeclarativeBasePositionerPrivate &dd, PositionerType at, QDeclarativeItem *parent)
+ : QDeclarativeItem(dd, parent)
{
- Q_D(QmlGraphicsBasePositioner);
+ Q_D(QDeclarativeBasePositioner);
d->init(at);
}
-QmlGraphicsBasePositioner::~QmlGraphicsBasePositioner()
+QDeclarativeBasePositioner::~QDeclarativeBasePositioner()
{
- Q_D(QmlGraphicsBasePositioner);
+ Q_D(QDeclarativeBasePositioner);
for (int i = 0; i < positionedItems.count(); ++i)
d->unwatchChanges(positionedItems.at(i).item);
positionedItems.clear();
}
-int QmlGraphicsBasePositioner::spacing() const
+int QDeclarativeBasePositioner::spacing() const
{
- Q_D(const QmlGraphicsBasePositioner);
+ Q_D(const QDeclarativeBasePositioner);
return d->spacing;
}
-void QmlGraphicsBasePositioner::setSpacing(int s)
+void QDeclarativeBasePositioner::setSpacing(int s)
{
- Q_D(QmlGraphicsBasePositioner);
+ Q_D(QDeclarativeBasePositioner);
if (s==d->spacing)
return;
d->spacing = s;
@@ -129,59 +129,66 @@ void QmlGraphicsBasePositioner::setSpacing(int s)
emit spacingChanged();
}
-QmlTransition *QmlGraphicsBasePositioner::move() const
+QDeclarativeTransition *QDeclarativeBasePositioner::move() const
{
- Q_D(const QmlGraphicsBasePositioner);
+ Q_D(const QDeclarativeBasePositioner);
return d->moveTransition;
}
-void QmlGraphicsBasePositioner::setMove(QmlTransition *mt)
+void QDeclarativeBasePositioner::setMove(QDeclarativeTransition *mt)
{
- Q_D(QmlGraphicsBasePositioner);
+ Q_D(QDeclarativeBasePositioner);
+ if (mt == d->moveTransition)
+ return;
d->moveTransition = mt;
+ emit moveChanged();
}
-QmlTransition *QmlGraphicsBasePositioner::add() const
+QDeclarativeTransition *QDeclarativeBasePositioner::add() const
{
- Q_D(const QmlGraphicsBasePositioner);
+ Q_D(const QDeclarativeBasePositioner);
return d->addTransition;
}
-void QmlGraphicsBasePositioner::setAdd(QmlTransition *add)
+void QDeclarativeBasePositioner::setAdd(QDeclarativeTransition *add)
{
- Q_D(QmlGraphicsBasePositioner);
+ Q_D(QDeclarativeBasePositioner);
+ if (add == d->addTransition)
+ return;
+
d->addTransition = add;
+ emit addChanged();
}
-void QmlGraphicsBasePositioner::componentComplete()
+void QDeclarativeBasePositioner::componentComplete()
{
- Q_D(QmlGraphicsBasePositioner);
- QmlGraphicsItem::componentComplete();
+ Q_D(QDeclarativeBasePositioner);
+ QDeclarativeItem::componentComplete();
#ifdef Q_ENABLE_PERFORMANCE_LOG
- QmlPerfTimer<QmlPerf::BasepositionerComponentComplete> cc;
+ QDeclarativePerfTimer<QDeclarativePerf::BasepositionerComponentComplete> cc;
#endif
positionedItems.reserve(d->QGraphicsItemPrivate::children.count());
prePositioning();
}
-QVariant QmlGraphicsBasePositioner::itemChange(GraphicsItemChange change,
+QVariant QDeclarativeBasePositioner::itemChange(GraphicsItemChange change,
const QVariant &value)
{
- Q_D(QmlGraphicsBasePositioner);
+ Q_D(QDeclarativeBasePositioner);
if (change == ItemChildAddedChange){
QGraphicsItem* item = value.value<QGraphicsItem*>();
- QmlGraphicsItem* child = 0;
+ QDeclarativeItem* child = 0;
if(item)
- child = qobject_cast<QmlGraphicsItem*>(item->toGraphicsObject());
+ child = qobject_cast<QDeclarativeItem*>(item->toGraphicsObject());
if (child)
prePositioning();
} else if (change == ItemChildRemovedChange) {
QGraphicsItem* item = value.value<QGraphicsItem*>();
- QmlGraphicsItem* child = 0;
+ QDeclarativeItem* child = 0;
if(item)
- child = qobject_cast<QmlGraphicsItem*>(item->toGraphicsObject());
+ child = qobject_cast<QDeclarativeItem*>(item->toGraphicsObject());
if (child) {
- QmlGraphicsBasePositioner::PositionedItem posItem(child);
+ QDeclarativeBasePositioner::PositionedItem posItem(child);
int idx = positionedItems.find(posItem);
if (idx >= 0) {
d->unwatchChanges(child);
@@ -191,12 +198,12 @@ QVariant QmlGraphicsBasePositioner::itemChange(GraphicsItemChange change,
}
}
- return QmlGraphicsItem::itemChange(change, value);
+ return QDeclarativeItem::itemChange(change, value);
}
-void QmlGraphicsBasePositioner::prePositioning()
+void QDeclarativeBasePositioner::prePositioning()
{
- Q_D(QmlGraphicsBasePositioner);
+ Q_D(QDeclarativeBasePositioner);
if (!isComponentComplete())
return;
@@ -206,7 +213,7 @@ void QmlGraphicsBasePositioner::prePositioning()
qSort(children.begin(), children.end(), d->insertionOrder);
for (int ii = 0; ii < children.count(); ++ii) {
- QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(children.at(ii));
+ QDeclarativeItem *child = qobject_cast<QDeclarativeItem *>(children.at(ii));
if (!child)
continue;
PositionedItem *item = 0;
@@ -247,39 +254,39 @@ void QmlGraphicsBasePositioner::prePositioning()
setImplicitWidth(w);
}
-void QmlGraphicsBasePositioner::positionX(int x, const PositionedItem &target)
+void QDeclarativeBasePositioner::positionX(int x, const PositionedItem &target)
{
- Q_D(QmlGraphicsBasePositioner);
+ Q_D(QDeclarativeBasePositioner);
if(d->type == Horizontal || d->type == Both){
if(!d->addTransition && !d->moveTransition){
target.item->setX(x);
}else{
if(target.isNew)
- d->addActions << QmlAction(target.item, QLatin1String("x"), QVariant(x));
+ d->addActions << QDeclarativeAction(target.item, QLatin1String("x"), QVariant(x));
else
- d->moveActions << QmlAction(target.item, QLatin1String("x"), QVariant(x));
+ d->moveActions << QDeclarativeAction(target.item, QLatin1String("x"), QVariant(x));
}
}
}
-void QmlGraphicsBasePositioner::positionY(int y, const PositionedItem &target)
+void QDeclarativeBasePositioner::positionY(int y, const PositionedItem &target)
{
- Q_D(QmlGraphicsBasePositioner);
+ Q_D(QDeclarativeBasePositioner);
if(d->type == Vertical || d->type == Both){
if(!d->addTransition && !d->moveTransition){
target.item->setY(y);
}else{
if(target.isNew)
- d->addActions << QmlAction(target.item, QLatin1String("y"), QVariant(y));
+ d->addActions << QDeclarativeAction(target.item, QLatin1String("y"), QVariant(y));
else
- d->moveActions << QmlAction(target.item, QLatin1String("y"), QVariant(y));
+ d->moveActions << QDeclarativeAction(target.item, QLatin1String("y"), QVariant(y));
}
}
}
-void QmlGraphicsBasePositioner::finishApplyTransitions()
+void QDeclarativeBasePositioner::finishApplyTransitions()
{
- Q_D(QmlGraphicsBasePositioner);
+ Q_D(QDeclarativeBasePositioner);
// Note that if a transition is not set the transition manager will
// apply the changes directly, in the case add/move aren't set
d->addTransitionManager.transition(d->addActions, d->addTransition);
@@ -289,7 +296,7 @@ void QmlGraphicsBasePositioner::finishApplyTransitions()
}
/*!
- \qmlclass Column QmlGraphicsColumn
+ \qmlclass Column QDeclarativeColumn
\since 4.7
\brief The Column item lines up its children vertically.
\inherits Item
@@ -372,7 +379,7 @@ Column {
move: Transition {
NumberAnimation {
properties: "y"
- ease: "easeOutBounce"
+ easing: "easeOutBounce"
}
}
}
@@ -396,21 +403,21 @@ Column {
*/
/*!
\internal
- \class QmlGraphicsColumn
- \brief The QmlGraphicsColumn class lines up items vertically.
+ \class QDeclarativeColumn
+ \brief The QDeclarativeColumn class lines up items vertically.
\ingroup group_positioners
*/
-QmlGraphicsColumn::QmlGraphicsColumn(QmlGraphicsItem *parent)
-: QmlGraphicsBasePositioner(Vertical, parent)
+QDeclarativeColumn::QDeclarativeColumn(QDeclarativeItem *parent)
+: QDeclarativeBasePositioner(Vertical, parent)
{
}
-static inline bool isInvisible(QmlGraphicsItem *child)
+static inline bool isInvisible(QDeclarativeItem *child)
{
return child->opacity() == 0.0 || !child->isVisible() || !child->width() || !child->height();
}
-void QmlGraphicsColumn::doPositioning()
+void QDeclarativeColumn::doPositioning()
{
int voffset = 0;
@@ -428,7 +435,7 @@ void QmlGraphicsColumn::doPositioning()
}
/*!
- \qmlclass Row QmlGraphicsRow
+ \qmlclass Row QDeclarativeRow
\since 4.7
\brief The Row item lines up its children horizontally.
\inherits Item
@@ -512,16 +519,16 @@ Row {
*/
/*!
\internal
- \class QmlGraphicsRow
- \brief The QmlGraphicsRow class lines up items horizontally.
+ \class QDeclarativeRow
+ \brief The QDeclarativeRow class lines up items horizontally.
\ingroup group_positioners
*/
-QmlGraphicsRow::QmlGraphicsRow(QmlGraphicsItem *parent)
-: QmlGraphicsBasePositioner(Horizontal, parent)
+QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent)
+: QDeclarativeBasePositioner(Horizontal, parent)
{
}
-void QmlGraphicsRow::doPositioning()
+void QDeclarativeRow::doPositioning()
{
int hoffset = 0;
@@ -540,7 +547,7 @@ void QmlGraphicsRow::doPositioning()
/*!
- \qmlclass Grid QmlGraphicsGrid
+ \qmlclass Grid QDeclarativeGrid
\since 4.7
\brief The Grid item positions its children in a grid.
\inherits Item
@@ -635,13 +642,13 @@ Grid {
*/
/*!
\internal
- \class QmlGraphicsGrid
- \brief The QmlGraphicsGrid class lays out items in a grid.
+ \class QDeclarativeGrid
+ \brief The QDeclarativeGrid class lays out items in a grid.
\ingroup group_layouts
*/
-QmlGraphicsGrid::QmlGraphicsGrid(QmlGraphicsItem *parent) :
- QmlGraphicsBasePositioner(Both, parent)
+QDeclarativeGrid::QDeclarativeGrid(QDeclarativeItem *parent) :
+ QDeclarativeBasePositioner(Both, parent)
{
_columns=-1;
_rows=-1;
@@ -665,7 +672,25 @@ QmlGraphicsGrid::QmlGraphicsGrid(QmlGraphicsItem *parent) :
many rows some rows will be of zero width.
*/
-void QmlGraphicsGrid::doPositioning()
+void QDeclarativeGrid::setColumns(const int columns)
+{
+ if (columns == _columns)
+ return;
+ _columns = columns;
+ prePositioning();
+ emit columnsChanged();
+}
+
+void QDeclarativeGrid::setRows(const int rows)
+{
+ if (rows == _rows)
+ return;
+ _rows = rows;
+ prePositioning();
+ emit rowsChanged();
+}
+
+void QDeclarativeGrid::doPositioning()
{
int c=_columns,r=_rows;//Actual number of rows/columns
int numVisible = positionedItems.count();
@@ -727,7 +752,7 @@ void QmlGraphicsGrid::doPositioning()
/*!
- \qmlclass Flow QmlGraphicsFlow
+ \qmlclass Flow QDeclarativeFlow
\since 4.7
\brief The Flow item lines up its children side by side, wrapping as necessary.
\inherits Item
@@ -772,20 +797,20 @@ Flow {
*/
-class QmlGraphicsFlowPrivate : public QmlGraphicsBasePositionerPrivate
+class QDeclarativeFlowPrivate : public QDeclarativeBasePositionerPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsFlow)
+ Q_DECLARE_PUBLIC(QDeclarativeFlow)
public:
- QmlGraphicsFlowPrivate()
- : QmlGraphicsBasePositionerPrivate(), flow(QmlGraphicsFlow::LeftToRight)
+ QDeclarativeFlowPrivate()
+ : QDeclarativeBasePositionerPrivate(), flow(QDeclarativeFlow::LeftToRight)
{}
- QmlGraphicsFlow::Flow flow;
+ QDeclarativeFlow::Flow flow;
};
-QmlGraphicsFlow::QmlGraphicsFlow(QmlGraphicsItem *parent)
-: QmlGraphicsBasePositioner(*(new QmlGraphicsFlowPrivate), Both, parent)
+QDeclarativeFlow::QDeclarativeFlow(QDeclarativeItem *parent)
+: QDeclarativeBasePositioner(*(new QDeclarativeFlowPrivate), Both, parent)
{
}
@@ -802,15 +827,15 @@ QmlGraphicsFlow::QmlGraphicsFlow(QmlGraphicsItem *parent)
other from top to bottom until the height of the Flow is exceeded,
then wrapped to the next column.
*/
-QmlGraphicsFlow::Flow QmlGraphicsFlow::flow() const
+QDeclarativeFlow::Flow QDeclarativeFlow::flow() const
{
- Q_D(const QmlGraphicsFlow);
+ Q_D(const QDeclarativeFlow);
return d->flow;
}
-void QmlGraphicsFlow::setFlow(Flow flow)
+void QDeclarativeFlow::setFlow(Flow flow)
{
- Q_D(QmlGraphicsFlow);
+ Q_D(QDeclarativeFlow);
if (d->flow != flow) {
d->flow = flow;
prePositioning();
@@ -818,9 +843,9 @@ void QmlGraphicsFlow::setFlow(Flow flow)
}
}
-void QmlGraphicsFlow::doPositioning()
+void QDeclarativeFlow::doPositioning()
{
- Q_D(QmlGraphicsFlow);
+ Q_D(QDeclarativeFlow);
int hoffset = 0;
int voffset = 0;
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
index 1fb687a..ff6fc4b 100644
--- a/src/declarative/graphicsitems/qmlgraphicspositioners_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
@@ -39,12 +39,12 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSLAYOUTS_H
-#define QMLGRAPHICSLAYOUTS_H
+#ifndef QDECLARATIVELAYOUTS_H
+#define QDECLARATIVELAYOUTS_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
-#include "../util/qmlstate_p.h"
+#include "../util/qdeclarativestate_p.h"
#include <private/qpodvector_p.h>
#include <QtCore/QObject>
@@ -55,37 +55,39 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsBasePositionerPrivate;
+class QDeclarativeBasePositionerPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsBasePositioner : public QmlGraphicsItem
+class Q_DECLARATIVE_EXPORT QDeclarativeBasePositioner : public QDeclarativeItem
{
Q_OBJECT
Q_PROPERTY(int spacing READ spacing WRITE setSpacing NOTIFY spacingChanged)
- Q_PROPERTY(QmlTransition *move READ move WRITE setMove)
- Q_PROPERTY(QmlTransition *add READ add WRITE setAdd)
+ Q_PROPERTY(QDeclarativeTransition *move READ move WRITE setMove NOTIFY moveChanged)
+ Q_PROPERTY(QDeclarativeTransition *add READ add WRITE setAdd NOTIFY addChanged)
public:
enum PositionerType { None = 0x0, Horizontal = 0x1, Vertical = 0x2, Both = 0x3 };
- QmlGraphicsBasePositioner(PositionerType, QmlGraphicsItem *parent);
- ~QmlGraphicsBasePositioner();
+ QDeclarativeBasePositioner(PositionerType, QDeclarativeItem *parent);
+ ~QDeclarativeBasePositioner();
int spacing() const;
void setSpacing(int);
- QmlTransition *move() const;
- void setMove(QmlTransition *);
+ QDeclarativeTransition *move() const;
+ void setMove(QDeclarativeTransition *);
- QmlTransition *add() const;
- void setAdd(QmlTransition *);
+ QDeclarativeTransition *add() const;
+ void setAdd(QDeclarativeTransition *);
protected:
- QmlGraphicsBasePositioner(QmlGraphicsBasePositionerPrivate &dd, PositionerType at, QmlGraphicsItem *parent);
+ QDeclarativeBasePositioner(QDeclarativeBasePositionerPrivate &dd, PositionerType at, QDeclarativeItem *parent);
virtual void componentComplete();
virtual QVariant itemChange(GraphicsItemChange, const QVariant &);
void finishApplyTransitions();
Q_SIGNALS:
void spacingChanged();
+ void moveChanged();
+ void addChanged();
protected Q_SLOTS:
virtual void doPositioning()=0;
@@ -93,9 +95,9 @@ protected Q_SLOTS:
protected:
struct PositionedItem {
- PositionedItem(QmlGraphicsItem *i) : item(i), isNew(false), isVisible(true) {}
+ PositionedItem(QDeclarativeItem *i) : item(i), isNew(false), isVisible(true) {}
bool operator==(const PositionedItem &other) const { return other.item == item; }
- QmlGraphicsItem *item;
+ QDeclarativeItem *item;
bool isNew;
bool isVisible;
};
@@ -105,61 +107,66 @@ protected:
void positionY(int,const PositionedItem &target);
private:
- Q_DISABLE_COPY(QmlGraphicsBasePositioner)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsBasePositioner)
+ Q_DISABLE_COPY(QDeclarativeBasePositioner)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeBasePositioner)
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsColumn : public QmlGraphicsBasePositioner
+class Q_DECLARATIVE_EXPORT QDeclarativeColumn : public QDeclarativeBasePositioner
{
Q_OBJECT
public:
- QmlGraphicsColumn(QmlGraphicsItem *parent=0);
+ QDeclarativeColumn(QDeclarativeItem *parent=0);
protected Q_SLOTS:
virtual void doPositioning();
private:
- Q_DISABLE_COPY(QmlGraphicsColumn)
+ Q_DISABLE_COPY(QDeclarativeColumn)
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsRow: public QmlGraphicsBasePositioner
+class Q_DECLARATIVE_EXPORT QDeclarativeRow: public QDeclarativeBasePositioner
{
Q_OBJECT
public:
- QmlGraphicsRow(QmlGraphicsItem *parent=0);
+ QDeclarativeRow(QDeclarativeItem *parent=0);
protected Q_SLOTS:
virtual void doPositioning();
private:
- Q_DISABLE_COPY(QmlGraphicsRow)
+ Q_DISABLE_COPY(QDeclarativeRow)
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsGrid : public QmlGraphicsBasePositioner
+class Q_DECLARATIVE_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner
{
Q_OBJECT
- Q_PROPERTY(int rows READ rows WRITE setRows)
- Q_PROPERTY(int columns READ columns WRITE setcolumns)
+ Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowChanged)
+ Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged)
public:
- QmlGraphicsGrid(QmlGraphicsItem *parent=0);
+ QDeclarativeGrid(QDeclarativeItem *parent=0);
int rows() const {return _rows;}
- void setRows(const int rows){_rows = rows;}
+ void setRows(const int rows);
int columns() const {return _columns;}
- void setcolumns(const int columns){_columns = columns;}
+ void setColumns(const int columns);
+
+Q_SIGNALS:
+ void rowsChanged();
+ void columnsChanged();
+
protected Q_SLOTS:
virtual void doPositioning();
private:
int _rows;
int _columns;
- Q_DISABLE_COPY(QmlGraphicsGrid)
+ Q_DISABLE_COPY(QDeclarativeGrid)
};
-class QmlGraphicsFlowPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsFlow: public QmlGraphicsBasePositioner
+class QDeclarativeFlowPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeFlow: public QDeclarativeBasePositioner
{
Q_OBJECT
Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged)
public:
- QmlGraphicsFlow(QmlGraphicsItem *parent=0);
+ QDeclarativeFlow(QDeclarativeItem *parent=0);
Q_ENUMS(Flow)
enum Flow { LeftToRight, TopToBottom };
@@ -173,19 +180,19 @@ protected Q_SLOTS:
virtual void doPositioning();
protected:
- QmlGraphicsFlow(QmlGraphicsFlowPrivate &dd, QmlGraphicsItem *parent);
+ QDeclarativeFlow(QDeclarativeFlowPrivate &dd, QDeclarativeItem *parent);
private:
- Q_DISABLE_COPY(QmlGraphicsFlow)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsFlow)
+ Q_DISABLE_COPY(QDeclarativeFlow)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeFlow)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsColumn)
-QML_DECLARE_TYPE(QmlGraphicsRow)
-QML_DECLARE_TYPE(QmlGraphicsGrid)
-QML_DECLARE_TYPE(QmlGraphicsFlow)
+QML_DECLARE_TYPE(QDeclarativeColumn)
+QML_DECLARE_TYPE(QDeclarativeRow)
+QML_DECLARE_TYPE(QDeclarativeGrid)
+QML_DECLARE_TYPE(QDeclarativeFlow)
QT_END_HEADER
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners_p_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
index e9b6aa8..3a1edee 100644
--- a/src/declarative/graphicsitems/qmlgraphicspositioners_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSLAYOUTS_P_H
-#define QMLGRAPHICSLAYOUTS_P_H
+#ifndef QDECLARATIVELAYOUTS_P_H
+#define QDECLARATIVELAYOUTS_P_H
//
// W A R N I N G
@@ -53,13 +53,13 @@
// We mean it.
//
-#include "qmlgraphicspositioners_p.h"
+#include "qdeclarativepositioners_p.h"
-#include "qmlgraphicsitem_p.h"
+#include "qdeclarativeitem_p.h"
-#include <qmlstate_p.h>
-#include <qmltransitionmanager_p_p.h>
-#include <qmlstateoperations_p.h>
+#include <qdeclarativestate_p.h>
+#include <qdeclarativetransitionmanager_p_p.h>
+#include <qdeclarativestateoperations_p.h>
#include <QtCore/QObject>
#include <QtCore/QString>
@@ -67,38 +67,38 @@
#include <QDebug>
QT_BEGIN_NAMESPACE
-class QmlGraphicsBasePositionerPrivate : public QmlGraphicsItemPrivate, public QmlGraphicsItemChangeListener
+class QDeclarativeBasePositionerPrivate : public QDeclarativeItemPrivate, public QDeclarativeItemChangeListener
{
- Q_DECLARE_PUBLIC(QmlGraphicsBasePositioner)
+ Q_DECLARE_PUBLIC(QDeclarativeBasePositioner)
public:
- QmlGraphicsBasePositionerPrivate()
- : spacing(0), type(QmlGraphicsBasePositioner::None), moveTransition(0), addTransition(0),
+ QDeclarativeBasePositionerPrivate()
+ : spacing(0), type(QDeclarativeBasePositioner::None), moveTransition(0), addTransition(0),
queuedPositioning(false)
{
}
- void init(QmlGraphicsBasePositioner::PositionerType at)
+ void init(QDeclarativeBasePositioner::PositionerType at)
{
type = at;
}
int spacing;
- QmlGraphicsBasePositioner::PositionerType type;
- QmlTransition *moveTransition;
- QmlTransition *addTransition;
- QmlStateOperation::ActionList addActions;
- QmlStateOperation::ActionList moveActions;
- QmlTransitionManager addTransitionManager;
- QmlTransitionManager moveTransitionManager;
+ QDeclarativeBasePositioner::PositionerType type;
+ QDeclarativeTransition *moveTransition;
+ QDeclarativeTransition *addTransition;
+ QDeclarativeStateOperation::ActionList addActions;
+ QDeclarativeStateOperation::ActionList moveActions;
+ QDeclarativeTransitionManager addTransitionManager;
+ QDeclarativeTransitionManager moveTransitionManager;
- void watchChanges(QmlGraphicsItem *other);
- void unwatchChanges(QmlGraphicsItem* other);
+ void watchChanges(QDeclarativeItem *other);
+ void unwatchChanges(QDeclarativeItem* other);
bool queuedPositioning;
- virtual void itemSiblingOrderChanged(QmlGraphicsItem* other)
+ virtual void itemSiblingOrderChanged(QDeclarativeItem* other)
{
- Q_Q(QmlGraphicsBasePositioner);
+ Q_Q(QDeclarativeBasePositioner);
Q_UNUSED(other);
if(!queuedPositioning){
//Delay is due to many children often being reordered at once
@@ -108,27 +108,27 @@ public:
}
}
- void itemGeometryChanged(QmlGraphicsItem *, const QRectF &newGeometry, const QRectF &oldGeometry)
+ void itemGeometryChanged(QDeclarativeItem *, const QRectF &newGeometry, const QRectF &oldGeometry)
{
- Q_Q(QmlGraphicsBasePositioner);
+ Q_Q(QDeclarativeBasePositioner);
if (newGeometry.size() != oldGeometry.size())
q->prePositioning();
}
- virtual void itemVisibilityChanged(QmlGraphicsItem *)
+ virtual void itemVisibilityChanged(QDeclarativeItem *)
{
- Q_Q(QmlGraphicsBasePositioner);
+ Q_Q(QDeclarativeBasePositioner);
q->prePositioning();
}
- virtual void itemOpacityChanged(QmlGraphicsItem *)
+ virtual void itemOpacityChanged(QDeclarativeItem *)
{
- Q_Q(QmlGraphicsBasePositioner);
+ Q_Q(QDeclarativeBasePositioner);
q->prePositioning();
}
- void itemDestroyed(QmlGraphicsItem *item)
+ void itemDestroyed(QDeclarativeItem *item)
{
- Q_Q(QmlGraphicsBasePositioner);
- q->positionedItems.removeOne(QmlGraphicsBasePositioner::PositionedItem(item));
+ Q_Q(QDeclarativeBasePositioner);
+ q->positionedItems.removeOne(QDeclarativeBasePositioner::PositionedItem(item));
}
};
diff --git a/src/declarative/graphicsitems/qmlgraphicsrectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index adc4cf3..d534f21 100644
--- a/src/declarative/graphicsitems/qmlgraphicsrectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#include "qmlgraphicsrectangle_p.h"
-#include "qmlgraphicsrectangle_p_p.h"
+#include "qdeclarativerectangle_p.h"
+#include "qdeclarativerectangle_p_p.h"
#include <QPainter>
#include <QtCore/qmath.h>
@@ -49,8 +49,8 @@ QT_BEGIN_NAMESPACE
/*!
\internal
- \class QmlGraphicsPen
- \brief The QmlGraphicsPen class provides a pen used for drawing rectangle borders on a QmlView.
+ \class QDeclarativePen
+ \brief The QDeclarativePen class provides a pen used for drawing rectangle borders on a QDeclarativeView.
By default, the pen is invalid and nothing is drawn. You must either set a color (then the default
width is 1) or a width (then the default color is black).
@@ -63,14 +63,14 @@ QT_BEGIN_NAMESPACE
\endqml
*/
-void QmlGraphicsPen::setColor(const QColor &c)
+void QDeclarativePen::setColor(const QColor &c)
{
_color = c;
_valid = _color.alpha() ? true : false;
emit penChanged();
}
-void QmlGraphicsPen::setWidth(int w)
+void QDeclarativePen::setWidth(int w)
{
if (_width == w && _valid)
return;
@@ -82,7 +82,7 @@ void QmlGraphicsPen::setWidth(int w)
/*!
- \qmlclass GradientStop QmlGraphicsGradientStop
+ \qmlclass GradientStop QDeclarativeGradientStop
\since 4.7
\brief The GradientStop item defines the color at a position in a Gradient
@@ -96,14 +96,14 @@ void QmlGraphicsPen::setWidth(int w)
Sets a \e color at a \e position in a gradient.
*/
-void QmlGraphicsGradientStop::updateGradient()
+void QDeclarativeGradientStop::updateGradient()
{
- if (QmlGraphicsGradient *grad = qobject_cast<QmlGraphicsGradient*>(parent()))
+ if (QDeclarativeGradient *grad = qobject_cast<QDeclarativeGradient*>(parent()))
grad->doUpdate();
}
/*!
- \qmlclass Gradient QmlGraphicsGradient
+ \qmlclass Gradient QDeclarativeGradient
\since 4.7
\brief The Gradient item defines a gradient fill.
@@ -127,12 +127,12 @@ void QmlGraphicsGradientStop::updateGradient()
This property holds the gradient stops describing the gradient.
*/
-const QGradient *QmlGraphicsGradient::gradient() const
+const QGradient *QDeclarativeGradient::gradient() const
{
if (!m_gradient && !m_stops.isEmpty()) {
m_gradient = new QLinearGradient(0,0,0,1.0);
for (int i = 0; i < m_stops.count(); ++i) {
- const QmlGraphicsGradientStop *stop = m_stops.at(i);
+ const QDeclarativeGradientStop *stop = m_stops.at(i);
m_gradient->setCoordinateMode(QGradient::ObjectBoundingMode);
m_gradient->setColorAt(stop->position(), stop->color());
}
@@ -141,7 +141,7 @@ const QGradient *QmlGraphicsGradient::gradient() const
return m_gradient;
}
-void QmlGraphicsGradient::doUpdate()
+void QDeclarativeGradient::doUpdate()
{
delete m_gradient;
m_gradient = 0;
@@ -150,7 +150,7 @@ void QmlGraphicsGradient::doUpdate()
/*!
- \qmlclass Rectangle QmlGraphicsRectangle
+ \qmlclass Rectangle QDeclarativeRectangle
\since 4.7
\brief The Rectangle item allows you to add rectangles to a scene.
\inherits Item
@@ -174,20 +174,20 @@ void QmlGraphicsGradient::doUpdate()
/*!
\internal
- \class QmlGraphicsRectangle
- \brief The QmlGraphicsRectangle class provides a rectangle item that you can add to a QmlView.
+ \class QDeclarativeRectangle
+ \brief The QDeclarativeRectangle class provides a rectangle item that you can add to a QDeclarativeView.
*/
-QmlGraphicsRectangle::QmlGraphicsRectangle(QmlGraphicsItem *parent)
- : QmlGraphicsItem(*(new QmlGraphicsRectanglePrivate), parent)
+QDeclarativeRectangle::QDeclarativeRectangle(QDeclarativeItem *parent)
+ : QDeclarativeItem(*(new QDeclarativeRectanglePrivate), parent)
{
- Q_D(QmlGraphicsRectangle);
+ Q_D(QDeclarativeRectangle);
d->init();
setFlag(QGraphicsItem::ItemHasNoContents, false);
}
-void QmlGraphicsRectangle::doUpdate()
+void QDeclarativeRectangle::doUpdate()
{
- Q_D(QmlGraphicsRectangle);
+ Q_D(QDeclarativeRectangle);
d->rectImage = QPixmap();
const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
d->setPaintMargin((pw+1)/2);
@@ -205,9 +205,9 @@ void QmlGraphicsRectangle::doUpdate()
To keep the border smooth (rather than blurry), odd widths cause the rectangle to be painted at
a half-pixel offset;
*/
-QmlGraphicsPen *QmlGraphicsRectangle::border()
+QDeclarativePen *QDeclarativeRectangle::border()
{
- Q_D(QmlGraphicsRectangle);
+ Q_D(QDeclarativeRectangle);
return d->getPen();
}
@@ -245,15 +245,15 @@ QmlGraphicsPen *QmlGraphicsRectangle::border()
\sa Gradient, color
*/
-QmlGraphicsGradient *QmlGraphicsRectangle::gradient() const
+QDeclarativeGradient *QDeclarativeRectangle::gradient() const
{
- Q_D(const QmlGraphicsRectangle);
+ Q_D(const QDeclarativeRectangle);
return d->gradient;
}
-void QmlGraphicsRectangle::setGradient(QmlGraphicsGradient *gradient)
+void QDeclarativeRectangle::setGradient(QDeclarativeGradient *gradient)
{
- Q_D(QmlGraphicsRectangle);
+ Q_D(QDeclarativeRectangle);
if (d->gradient == gradient)
return;
if (d->gradient)
@@ -273,15 +273,15 @@ void QmlGraphicsRectangle::setGradient(QmlGraphicsGradient *gradient)
painted as a normal rectangle. The same radius is used by all 4 corners; there is currently
no way to specify different radii for different corners.
*/
-qreal QmlGraphicsRectangle::radius() const
+qreal QDeclarativeRectangle::radius() const
{
- Q_D(const QmlGraphicsRectangle);
+ Q_D(const QDeclarativeRectangle);
return d->radius;
}
-void QmlGraphicsRectangle::setRadius(qreal radius)
+void QDeclarativeRectangle::setRadius(qreal radius)
{
- Q_D(QmlGraphicsRectangle);
+ Q_D(QDeclarativeRectangle);
if (d->radius == radius)
return;
@@ -307,15 +307,15 @@ void QmlGraphicsRectangle::setRadius(qreal radius)
If both a gradient and a color are specified, the gradient will be used.
*/
-QColor QmlGraphicsRectangle::color() const
+QColor QDeclarativeRectangle::color() const
{
- Q_D(const QmlGraphicsRectangle);
+ Q_D(const QDeclarativeRectangle);
return d->color;
}
-void QmlGraphicsRectangle::setColor(const QColor &c)
+void QDeclarativeRectangle::setColor(const QColor &c)
{
- Q_D(QmlGraphicsRectangle);
+ Q_D(QDeclarativeRectangle);
if (d->color == c)
return;
@@ -325,9 +325,9 @@ void QmlGraphicsRectangle::setColor(const QColor &c)
emit colorChanged();
}
-void QmlGraphicsRectangle::generateRoundedRect()
+void QDeclarativeRectangle::generateRoundedRect()
{
- Q_D(QmlGraphicsRectangle);
+ Q_D(QDeclarativeRectangle);
if (d->rectImage.isNull()) {
const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
const int radius = qCeil(d->radius); //ensure odd numbered width/height so we get 1-pixel center
@@ -349,9 +349,9 @@ void QmlGraphicsRectangle::generateRoundedRect()
}
}
-void QmlGraphicsRectangle::generateBorderedRect()
+void QDeclarativeRectangle::generateBorderedRect()
{
- Q_D(QmlGraphicsRectangle);
+ Q_D(QDeclarativeRectangle);
if (d->rectImage.isNull()) {
const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
d->rectImage = QPixmap(pw*2 + 3, pw*2 + 3);
@@ -373,9 +373,9 @@ void QmlGraphicsRectangle::generateBorderedRect()
}
}
-void QmlGraphicsRectangle::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
+void QDeclarativeRectangle::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
- Q_D(QmlGraphicsRectangle);
+ Q_D(QDeclarativeRectangle);
if (d->radius > 0 || (d->pen && d->pen->isValid())
|| (d->gradient && d->gradient->gradient()) ) {
drawRect(*p);
@@ -390,9 +390,9 @@ void QmlGraphicsRectangle::paint(QPainter *p, const QStyleOptionGraphicsItem *,
}
}
-void QmlGraphicsRectangle::drawRect(QPainter &p)
+void QDeclarativeRectangle::drawRect(QPainter &p)
{
- Q_D(QmlGraphicsRectangle);
+ Q_D(QDeclarativeRectangle);
if (d->gradient && d->gradient->gradient()) {
// XXX This path is still slower than the image path
// Image path won't work for gradients though
@@ -457,9 +457,9 @@ void QmlGraphicsRectangle::drawRect(QPainter &p)
\image rect-smooth.png
*/
-QRectF QmlGraphicsRectangle::boundingRect() const
+QRectF QDeclarativeRectangle::boundingRect() const
{
- Q_D(const QmlGraphicsRectangle);
+ Q_D(const QDeclarativeRectangle);
return QRectF(-d->paintmargin, -d->paintmargin, d->width+d->paintmargin*2, d->height+d->paintmargin*2);
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsrectangle_p.h b/src/declarative/graphicsitems/qdeclarativerectangle_p.h
index 66552f6..7272962 100644
--- a/src/declarative/graphicsitems/qmlgraphicsrectangle_p.h
+++ b/src/declarative/graphicsitems/qdeclarativerectangle_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSRECT_H
-#define QMLGRAPHICSRECT_H
+#ifndef QDECLARATIVERECT_H
+#define QDECLARATIVERECT_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
#include <QtGui/qbrush.h>
@@ -51,14 +51,14 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class Q_DECLARATIVE_EXPORT QmlGraphicsPen : public QObject
+class Q_DECLARATIVE_EXPORT QDeclarativePen : public QObject
{
Q_OBJECT
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY penChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY penChanged)
public:
- QmlGraphicsPen(QObject *parent=0)
+ QDeclarativePen(QObject *parent=0)
: QObject(parent), _width(1), _color("#000000"), _valid(false)
{}
@@ -79,7 +79,7 @@ private:
bool _valid;
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsGradientStop : public QObject
+class Q_DECLARATIVE_EXPORT QDeclarativeGradientStop : public QObject
{
Q_OBJECT
@@ -87,7 +87,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsGradientStop : public QObject
Q_PROPERTY(QColor color READ color WRITE setColor)
public:
- QmlGraphicsGradientStop(QObject *parent=0) : QObject(parent) {}
+ QDeclarativeGradientStop(QObject *parent=0) : QObject(parent) {}
qreal position() const { return m_position; }
void setPosition(qreal position) { m_position = position; updateGradient(); }
@@ -103,18 +103,18 @@ private:
QColor m_color;
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsGradient : public QObject
+class Q_DECLARATIVE_EXPORT QDeclarativeGradient : public QObject
{
Q_OBJECT
- Q_PROPERTY(QmlListProperty<QmlGraphicsGradientStop> stops READ stops)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeGradientStop> stops READ stops)
Q_CLASSINFO("DefaultProperty", "stops")
public:
- QmlGraphicsGradient(QObject *parent=0) : QObject(parent), m_gradient(0) {}
- ~QmlGraphicsGradient() { delete m_gradient; }
+ QDeclarativeGradient(QObject *parent=0) : QObject(parent), m_gradient(0) {}
+ ~QDeclarativeGradient() { delete m_gradient; }
- QmlListProperty<QmlGraphicsGradientStop> stops() { return QmlListProperty<QmlGraphicsGradientStop>(this, m_stops); }
+ QDeclarativeListProperty<QDeclarativeGradientStop> stops() { return QDeclarativeListProperty<QDeclarativeGradientStop>(this, m_stops); }
const QGradient *gradient() const;
@@ -125,30 +125,30 @@ private:
void doUpdate();
private:
- QList<QmlGraphicsGradientStop *> m_stops;
+ QList<QDeclarativeGradientStop *> m_stops;
mutable QGradient *m_gradient;
- friend class QmlGraphicsGradientStop;
+ friend class QDeclarativeGradientStop;
};
-class QmlGraphicsRectanglePrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsRectangle : public QmlGraphicsItem
+class QDeclarativeRectanglePrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeRectangle : public QDeclarativeItem
{
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
- Q_PROPERTY(QmlGraphicsGradient *gradient READ gradient WRITE setGradient)
- Q_PROPERTY(QmlGraphicsPen * border READ border CONSTANT)
+ Q_PROPERTY(QDeclarativeGradient *gradient READ gradient WRITE setGradient)
+ Q_PROPERTY(QDeclarativePen * border READ border CONSTANT)
Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged)
public:
- QmlGraphicsRectangle(QmlGraphicsItem *parent=0);
+ QDeclarativeRectangle(QDeclarativeItem *parent=0);
QColor color() const;
void setColor(const QColor &);
- QmlGraphicsPen *border();
+ QDeclarativePen *border();
- QmlGraphicsGradient *gradient() const;
- void setGradient(QmlGraphicsGradient *gradient);
+ QDeclarativeGradient *gradient() const;
+ void setGradient(QDeclarativeGradient *gradient);
qreal radius() const;
void setRadius(qreal radius);
@@ -170,17 +170,17 @@ private:
void drawRect(QPainter &painter);
private:
- Q_DISABLE_COPY(QmlGraphicsRectangle)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsRectangle)
+ Q_DISABLE_COPY(QDeclarativeRectangle)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeRectangle)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsPen)
-QML_DECLARE_TYPE(QmlGraphicsGradientStop)
-QML_DECLARE_TYPE(QmlGraphicsGradient)
-QML_DECLARE_TYPE(QmlGraphicsRectangle)
+QML_DECLARE_TYPE(QDeclarativePen)
+QML_DECLARE_TYPE(QDeclarativeGradientStop)
+QML_DECLARE_TYPE(QDeclarativeGradient)
+QML_DECLARE_TYPE(QDeclarativeRectangle)
QT_END_HEADER
-#endif // QMLGRAPHICSRECT_H
+#endif // QDECLARATIVERECT_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h b/src/declarative/graphicsitems/qdeclarativerectangle_p_p.h
index f91e7e2..b87c57f 100644
--- a/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativerectangle_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSRECT_P_H
-#define QMLGRAPHICSRECT_P_H
+#ifndef QDECLARATIVERECT_P_H
+#define QDECLARATIVERECT_P_H
//
// W A R N I N G
@@ -53,23 +53,23 @@
// We mean it.
//
-#include "qmlgraphicsitem_p.h"
+#include "qdeclarativeitem_p.h"
QT_BEGIN_NAMESPACE
-class QmlGraphicsGradient;
-class QmlGraphicsRectangle;
-class QmlGraphicsRectanglePrivate : public QmlGraphicsItemPrivate
+class QDeclarativeGradient;
+class QDeclarativeRectangle;
+class QDeclarativeRectanglePrivate : public QDeclarativeItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsRectangle)
+ Q_DECLARE_PUBLIC(QDeclarativeRectangle)
public:
- QmlGraphicsRectanglePrivate() :
+ QDeclarativeRectanglePrivate() :
color(Qt::white), gradient(0), pen(0), radius(0), paintmargin(0)
{
}
- ~QmlGraphicsRectanglePrivate()
+ ~QDeclarativeRectanglePrivate()
{
delete pen;
}
@@ -80,23 +80,23 @@ public:
QColor getColor();
QColor color;
- QmlGraphicsGradient *gradient;
- QmlGraphicsPen *getPen() {
+ QDeclarativeGradient *gradient;
+ QDeclarativePen *getPen() {
if (!pen) {
- Q_Q(QmlGraphicsRectangle);
- pen = new QmlGraphicsPen;
+ Q_Q(QDeclarativeRectangle);
+ pen = new QDeclarativePen;
QObject::connect(pen, SIGNAL(penChanged()), q, SLOT(doUpdate()));
}
return pen;
}
- QmlGraphicsPen *pen;
+ QDeclarativePen *pen;
qreal radius;
qreal paintmargin;
QPixmap rectImage;
void setPaintMargin(qreal margin)
{
- Q_Q(QmlGraphicsRectangle);
+ Q_Q(QDeclarativeRectangle);
if (margin == paintmargin)
return;
q->prepareGeometryChange();
@@ -106,4 +106,4 @@ public:
QT_END_NAMESPACE
-#endif // QMLGRAPHICSRECT_P_H
+#endif // QDECLARATIVERECT_P_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp
index 23c3aae..e4cd499 100644
--- a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp
@@ -39,29 +39,29 @@
**
****************************************************************************/
-#include "qmlgraphicsrepeater_p.h"
-#include "qmlgraphicsrepeater_p_p.h"
+#include "qdeclarativerepeater_p.h"
+#include "qdeclarativerepeater_p_p.h"
-#include "qmlgraphicsvisualitemmodel_p.h"
+#include "qdeclarativevisualitemmodel_p.h"
-#include <qmllistaccessor_p.h>
+#include <qdeclarativelistaccessor_p.h>
#include <qlistmodelinterface_p.h>
QT_BEGIN_NAMESPACE
-QmlGraphicsRepeaterPrivate::QmlGraphicsRepeaterPrivate()
+QDeclarativeRepeaterPrivate::QDeclarativeRepeaterPrivate()
: model(0), ownModel(false)
{
}
-QmlGraphicsRepeaterPrivate::~QmlGraphicsRepeaterPrivate()
+QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate()
{
if (ownModel)
delete model;
}
/*!
- \qmlclass Repeater QmlGraphicsRepeater
+ \qmlclass Repeater QDeclarativeRepeater
\since 4.7
\inherits Item
@@ -106,7 +106,7 @@ QmlGraphicsRepeaterPrivate::~QmlGraphicsRepeaterPrivate()
/*!
\internal
- \class QmlGraphicsRepeater
+ \class QDeclarativeRepeater
\qmlclass Repeater
XXX Repeater is very conservative in how it instatiates/deletes items. Also
@@ -114,10 +114,10 @@ QmlGraphicsRepeaterPrivate::~QmlGraphicsRepeaterPrivate()
*/
/*!
- Create a new QmlGraphicsRepeater instance.
+ Create a new QDeclarativeRepeater instance.
*/
-QmlGraphicsRepeater::QmlGraphicsRepeater(QmlGraphicsItem *parent)
- : QmlGraphicsItem(*(new QmlGraphicsRepeaterPrivate), parent)
+QDeclarativeRepeater::QDeclarativeRepeater(QDeclarativeItem *parent)
+ : QDeclarativeItem(*(new QDeclarativeRepeaterPrivate), parent)
{
}
@@ -125,7 +125,7 @@ QmlGraphicsRepeater::QmlGraphicsRepeater(QmlGraphicsItem *parent)
Destroy the repeater instance. All items it instantiated are also
destroyed.
*/
-QmlGraphicsRepeater::~QmlGraphicsRepeater()
+QDeclarativeRepeater::~QDeclarativeRepeater()
{
}
@@ -149,15 +149,15 @@ QmlGraphicsRepeater::~QmlGraphicsRepeater()
\sa {qmlmodels}{Data Models}
*/
-QVariant QmlGraphicsRepeater::model() const
+QVariant QDeclarativeRepeater::model() const
{
- Q_D(const QmlGraphicsRepeater);
+ Q_D(const QDeclarativeRepeater);
return d->dataSource;
}
-void QmlGraphicsRepeater::setModel(const QVariant &model)
+void QDeclarativeRepeater::setModel(const QVariant &model)
{
- Q_D(QmlGraphicsRepeater);
+ Q_D(QDeclarativeRepeater);
if (d->dataSource == model)
return;
@@ -166,16 +166,17 @@ void QmlGraphicsRepeater::setModel(const QVariant &model)
disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int)));
+ disconnect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset()));
/*
- disconnect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*)));
- disconnect(d->model, SIGNAL(destroyingItem(QmlGraphicsItem*)), this, SLOT(destroyingItem(QmlGraphicsItem*)));
+ disconnect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*)));
+ disconnect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*)));
*/
}
d->dataSource = model;
emit modelChanged();
QObject *object = qvariant_cast<QObject*>(model);
- QmlGraphicsVisualModel *vim = 0;
- if (object && (vim = qobject_cast<QmlGraphicsVisualModel *>(object))) {
+ QDeclarativeVisualModel *vim = 0;
+ if (object && (vim = qobject_cast<QDeclarativeVisualModel *>(object))) {
if (d->ownModel) {
delete d->model;
d->ownModel = false;
@@ -183,19 +184,20 @@ void QmlGraphicsRepeater::setModel(const QVariant &model)
d->model = vim;
} else {
if (!d->ownModel) {
- d->model = new QmlGraphicsVisualDataModel(qmlContext(this));
+ d->model = new QDeclarativeVisualDataModel(qmlContext(this));
d->ownModel = true;
}
- if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model))
+ if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model))
dataModel->setModel(model);
}
if (d->model) {
connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int)));
connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int)));
connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int)));
+ connect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset()));
/*
- connect(d->model, SIGNAL(createdItem(int, QmlGraphicsItem*)), this, SLOT(createdItem(int,QmlGraphicsItem*)));
- connect(d->model, SIGNAL(destroyingItem(QmlGraphicsItem*)), this, SLOT(destroyingItem(QmlGraphicsItem*)));
+ connect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*)));
+ connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*)));
*/
regenerate();
emit countChanged();
@@ -210,29 +212,29 @@ void QmlGraphicsRepeater::setModel(const QVariant &model)
The index is exposed as an accessible \c index property. Properties of the
model are also available depending upon the type of \l {qmlmodels}{Data Model}.
*/
-QmlComponent *QmlGraphicsRepeater::delegate() const
+QDeclarativeComponent *QDeclarativeRepeater::delegate() const
{
- Q_D(const QmlGraphicsRepeater);
+ Q_D(const QDeclarativeRepeater);
if (d->model) {
- if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model))
+ if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model))
return dataModel->delegate();
}
return 0;
}
-void QmlGraphicsRepeater::setDelegate(QmlComponent *delegate)
+void QDeclarativeRepeater::setDelegate(QDeclarativeComponent *delegate)
{
- Q_D(QmlGraphicsRepeater);
- if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model))
+ Q_D(QDeclarativeRepeater);
+ if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model))
if (delegate == dataModel->delegate())
return;
if (!d->ownModel) {
- d->model = new QmlGraphicsVisualDataModel(qmlContext(this));
+ d->model = new QDeclarativeVisualDataModel(qmlContext(this));
d->ownModel = true;
}
- if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model)) {
+ if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model)) {
dataModel->setDelegate(delegate);
regenerate();
emit delegateChanged();
@@ -244,9 +246,9 @@ void QmlGraphicsRepeater::setDelegate(QmlComponent *delegate)
This property holds the number of items in the repeater.
*/
-int QmlGraphicsRepeater::count() const
+int QDeclarativeRepeater::count() const
{
- Q_D(const QmlGraphicsRepeater);
+ Q_D(const QDeclarativeRepeater);
if (d->model)
return d->model->count();
return 0;
@@ -256,19 +258,19 @@ int QmlGraphicsRepeater::count() const
/*!
\internal
*/
-void QmlGraphicsRepeater::componentComplete()
+void QDeclarativeRepeater::componentComplete()
{
- QmlGraphicsItem::componentComplete();
+ QDeclarativeItem::componentComplete();
regenerate();
}
/*!
\internal
*/
-QVariant QmlGraphicsRepeater::itemChange(GraphicsItemChange change,
+QVariant QDeclarativeRepeater::itemChange(GraphicsItemChange change,
const QVariant &value)
{
- QVariant rv = QmlGraphicsItem::itemChange(change, value);
+ QVariant rv = QDeclarativeItem::itemChange(change, value);
if (change == ItemParentHasChanged) {
regenerate();
}
@@ -276,11 +278,11 @@ QVariant QmlGraphicsRepeater::itemChange(GraphicsItemChange change,
return rv;
}
-void QmlGraphicsRepeater::clear()
+void QDeclarativeRepeater::clear()
{
- Q_D(QmlGraphicsRepeater);
+ Q_D(QDeclarativeRepeater);
if (d->model) {
- foreach (QmlGraphicsItem *item, d->deletables) {
+ foreach (QDeclarativeItem *item, d->deletables) {
item->setParentItem(this);
d->model->release(item);
}
@@ -291,9 +293,9 @@ void QmlGraphicsRepeater::clear()
/*!
\internal
*/
-void QmlGraphicsRepeater::regenerate()
+void QDeclarativeRepeater::regenerate()
{
- Q_D(QmlGraphicsRepeater);
+ Q_D(QDeclarativeRepeater);
clear();
@@ -301,7 +303,7 @@ void QmlGraphicsRepeater::regenerate()
return;
for (int ii = 0; ii < count(); ++ii) {
- QmlGraphicsItem *item = d->model->item(ii);
+ QDeclarativeItem *item = d->model->item(ii);
if (item) {
item->setParent(parentItem());
item->stackBefore(this);
@@ -310,17 +312,22 @@ void QmlGraphicsRepeater::regenerate()
}
}
-void QmlGraphicsRepeater::itemsInserted(int, int)
+void QDeclarativeRepeater::itemsInserted(int, int)
{
regenerate();
}
-void QmlGraphicsRepeater::itemsRemoved(int, int)
+void QDeclarativeRepeater::itemsRemoved(int, int)
{
regenerate();
}
-void QmlGraphicsRepeater::itemsMoved(int,int,int)
+void QDeclarativeRepeater::itemsMoved(int,int,int)
+{
+ regenerate();
+}
+
+void QDeclarativeRepeater::modelReset()
{
regenerate();
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater_p.h b/src/declarative/graphicsitems/qdeclarativerepeater_p.h
index 2324916..db46699 100644
--- a/src/declarative/graphicsitems/qmlgraphicsrepeater_p.h
+++ b/src/declarative/graphicsitems/qdeclarativerepeater_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSREPEATER_H
-#define QMLGRAPHICSREPEATER_H
+#ifndef QDECLARATIVEREPEATER_H
+#define QDECLARATIVEREPEATER_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
QT_BEGIN_HEADER
@@ -50,25 +50,25 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsRepeaterPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsRepeater : public QmlGraphicsItem
+class QDeclarativeRepeaterPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeRepeater : public QDeclarativeItem
{
Q_OBJECT
Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
- Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
+ Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_CLASSINFO("DefaultProperty", "delegate")
public:
- QmlGraphicsRepeater(QmlGraphicsItem *parent=0);
- virtual ~QmlGraphicsRepeater();
+ QDeclarativeRepeater(QDeclarativeItem *parent=0);
+ virtual ~QDeclarativeRepeater();
QVariant model() const;
void setModel(const QVariant &);
- QmlComponent *delegate() const;
- void setDelegate(QmlComponent *);
+ QDeclarativeComponent *delegate() const;
+ void setDelegate(QDeclarativeComponent *);
int count() const;
@@ -88,16 +88,17 @@ private Q_SLOTS:
void itemsInserted(int,int);
void itemsRemoved(int,int);
void itemsMoved(int,int,int);
+ void modelReset();
private:
- Q_DISABLE_COPY(QmlGraphicsRepeater)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsRepeater)
+ Q_DISABLE_COPY(QDeclarativeRepeater)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeRepeater)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsRepeater)
+QML_DECLARE_TYPE(QDeclarativeRepeater)
QT_END_HEADER
-#endif // QMLGRAPHICSREPEATER_H
+#endif // QDECLARATIVEREPEATER_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater_p_p.h b/src/declarative/graphicsitems/qdeclarativerepeater_p_p.h
index 5680288..11773ff 100644
--- a/src/declarative/graphicsitems/qmlgraphicsrepeater_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativerepeater_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSREPEATER_P_H
-#define QMLGRAPHICSREPEATER_P_H
+#ifndef QDECLARATIVEREPEATER_P_H
+#define QDECLARATIVEREPEATER_P_H
//
// W A R N I N G
@@ -53,30 +53,30 @@
// We mean it.
//
-#include "qmlgraphicsrepeater_p.h"
+#include "qdeclarativerepeater_p.h"
-#include "qmlgraphicsitem_p.h"
+#include "qdeclarativeitem_p.h"
#include <QPointer>
QT_BEGIN_NAMESPACE
-class QmlContext;
-class QmlGraphicsVisualModel;
-class QmlGraphicsRepeaterPrivate : public QmlGraphicsItemPrivate
+class QDeclarativeContext;
+class QDeclarativeVisualModel;
+class QDeclarativeRepeaterPrivate : public QDeclarativeItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsRepeater)
+ Q_DECLARE_PUBLIC(QDeclarativeRepeater)
public:
- QmlGraphicsRepeaterPrivate();
- ~QmlGraphicsRepeaterPrivate();
+ QDeclarativeRepeaterPrivate();
+ ~QDeclarativeRepeaterPrivate();
- QmlGraphicsVisualModel *model;
+ QDeclarativeVisualModel *model;
QVariant dataSource;
bool ownModel;
- QList<QPointer<QmlGraphicsItem> > deletables;
+ QList<QPointer<QDeclarativeItem> > deletables;
};
QT_END_NAMESPACE
-#endif // QMLGRAPHICSREPEATER_P_H
+#endif // QDECLARATIVEREPEATER_P_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsscalegrid.cpp b/src/declarative/graphicsitems/qdeclarativescalegrid.cpp
index 1956939..dbc7568 100644
--- a/src/declarative/graphicsitems/qmlgraphicsscalegrid.cpp
+++ b/src/declarative/graphicsitems/qdeclarativescalegrid.cpp
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#include "qmlgraphicsscalegrid_p_p.h"
+#include "qdeclarativescalegrid_p_p.h"
-#include <qml.h>
+#include <qdeclarative.h>
#include <QBuffer>
#include <QDebug>
@@ -49,24 +49,24 @@
QT_BEGIN_NAMESPACE
/*!
\internal
- \class QmlGraphicsScaleGrid
- \brief The QmlGraphicsScaleGrid class allows you to specify a 3x3 grid to use in scaling an image.
+ \class QDeclarativeScaleGrid
+ \brief The QDeclarativeScaleGrid class allows you to specify a 3x3 grid to use in scaling an image.
*/
-QmlGraphicsScaleGrid::QmlGraphicsScaleGrid(QObject *parent) : QObject(parent), _left(0), _top(0), _right(0), _bottom(0)
+QDeclarativeScaleGrid::QDeclarativeScaleGrid(QObject *parent) : QObject(parent), _left(0), _top(0), _right(0), _bottom(0)
{
}
-QmlGraphicsScaleGrid::~QmlGraphicsScaleGrid()
+QDeclarativeScaleGrid::~QDeclarativeScaleGrid()
{
}
-bool QmlGraphicsScaleGrid::isNull() const
+bool QDeclarativeScaleGrid::isNull() const
{
return !_left && !_top && !_right && !_bottom;
}
-void QmlGraphicsScaleGrid::setLeft(int pos)
+void QDeclarativeScaleGrid::setLeft(int pos)
{
if (_left != pos) {
_left = pos;
@@ -74,7 +74,7 @@ void QmlGraphicsScaleGrid::setLeft(int pos)
}
}
-void QmlGraphicsScaleGrid::setTop(int pos)
+void QDeclarativeScaleGrid::setTop(int pos)
{
if (_top != pos) {
_top = pos;
@@ -82,7 +82,7 @@ void QmlGraphicsScaleGrid::setTop(int pos)
}
}
-void QmlGraphicsScaleGrid::setRight(int pos)
+void QDeclarativeScaleGrid::setRight(int pos)
{
if (_right != pos) {
_right = pos;
@@ -90,7 +90,7 @@ void QmlGraphicsScaleGrid::setRight(int pos)
}
}
-void QmlGraphicsScaleGrid::setBottom(int pos)
+void QDeclarativeScaleGrid::setBottom(int pos)
{
if (_bottom != pos) {
_bottom = pos;
@@ -98,18 +98,18 @@ void QmlGraphicsScaleGrid::setBottom(int pos)
}
}
-QmlGraphicsGridScaledImage::QmlGraphicsGridScaledImage()
+QDeclarativeGridScaledImage::QDeclarativeGridScaledImage()
: _l(-1), _r(-1), _t(-1), _b(-1),
- _h(QmlGraphicsBorderImage::Stretch), _v(QmlGraphicsBorderImage::Stretch)
+ _h(QDeclarativeBorderImage::Stretch), _v(QDeclarativeBorderImage::Stretch)
{
}
-QmlGraphicsGridScaledImage::QmlGraphicsGridScaledImage(const QmlGraphicsGridScaledImage &o)
+QDeclarativeGridScaledImage::QDeclarativeGridScaledImage(const QDeclarativeGridScaledImage &o)
: _l(o._l), _r(o._r), _t(o._t), _b(o._b), _h(o._h), _v(o._v), _pix(o._pix)
{
}
-QmlGraphicsGridScaledImage &QmlGraphicsGridScaledImage::operator=(const QmlGraphicsGridScaledImage &o)
+QDeclarativeGridScaledImage &QDeclarativeGridScaledImage::operator=(const QDeclarativeGridScaledImage &o)
{
_l = o._l;
_r = o._r;
@@ -121,8 +121,8 @@ QmlGraphicsGridScaledImage &QmlGraphicsGridScaledImage::operator=(const QmlGraph
return *this;
}
-QmlGraphicsGridScaledImage::QmlGraphicsGridScaledImage(QIODevice *data)
-: _l(-1), _r(-1), _t(-1), _b(-1), _h(QmlGraphicsBorderImage::Stretch), _v(QmlGraphicsBorderImage::Stretch)
+QDeclarativeGridScaledImage::QDeclarativeGridScaledImage(QIODevice *data)
+: _l(-1), _r(-1), _t(-1), _b(-1), _h(QDeclarativeBorderImage::Stretch), _v(QDeclarativeBorderImage::Stretch)
{
int l = -1;
int r = -1;
@@ -166,45 +166,45 @@ QmlGraphicsGridScaledImage::QmlGraphicsGridScaledImage(QIODevice *data)
_pix = imgFile;
}
-QmlGraphicsBorderImage::TileMode QmlGraphicsGridScaledImage::stringToRule(const QString &s)
+QDeclarativeBorderImage::TileMode QDeclarativeGridScaledImage::stringToRule(const QString &s)
{
if (s == QLatin1String("Stretch"))
- return QmlGraphicsBorderImage::Stretch;
+ return QDeclarativeBorderImage::Stretch;
if (s == QLatin1String("Repeat"))
- return QmlGraphicsBorderImage::Repeat;
+ return QDeclarativeBorderImage::Repeat;
if (s == QLatin1String("Round"))
- return QmlGraphicsBorderImage::Round;
+ return QDeclarativeBorderImage::Round;
qWarning() << "Unknown tile rule specified. Using Stretch";
- return QmlGraphicsBorderImage::Stretch;
+ return QDeclarativeBorderImage::Stretch;
}
-bool QmlGraphicsGridScaledImage::isValid() const
+bool QDeclarativeGridScaledImage::isValid() const
{
return _l >= 0;
}
-int QmlGraphicsGridScaledImage::gridLeft() const
+int QDeclarativeGridScaledImage::gridLeft() const
{
return _l;
}
-int QmlGraphicsGridScaledImage::gridRight() const
+int QDeclarativeGridScaledImage::gridRight() const
{
return _r;
}
-int QmlGraphicsGridScaledImage::gridTop() const
+int QDeclarativeGridScaledImage::gridTop() const
{
return _t;
}
-int QmlGraphicsGridScaledImage::gridBottom() const
+int QDeclarativeGridScaledImage::gridBottom() const
{
return _b;
}
-QString QmlGraphicsGridScaledImage::pixmapUrl() const
+QString QDeclarativeGridScaledImage::pixmapUrl() const
{
return _pix;
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsscalegrid_p_p.h b/src/declarative/graphicsitems/qdeclarativescalegrid_p_p.h
index 650be62..92b3f91 100644
--- a/src/declarative/graphicsitems/qmlgraphicsscalegrid_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativescalegrid_p_p.h
@@ -39,13 +39,13 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSSCALEGRID_H
-#define QMLGRAPHICSSCALEGRID_H
+#ifndef QDECLARATIVESCALEGRID_H
+#define QDECLARATIVESCALEGRID_H
-#include "qmlgraphicsborderimage_p.h"
+#include "qdeclarativeborderimage_p.h"
-#include "../util/qmlpixmapcache_p.h"
-#include <qml.h>
+#include "../util/qdeclarativepixmapcache_p.h"
+#include <qdeclarative.h>
#include <QtCore/QString>
#include <QtCore/QObject>
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class Q_DECLARATIVE_EXPORT QmlGraphicsScaleGrid : public QObject
+class Q_DECLARATIVE_EXPORT QDeclarativeScaleGrid : public QObject
{
Q_OBJECT
Q_ENUMS(TileRule)
@@ -67,8 +67,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsScaleGrid : public QObject
Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY borderChanged)
public:
- QmlGraphicsScaleGrid(QObject *parent=0);
- ~QmlGraphicsScaleGrid();
+ QDeclarativeScaleGrid(QObject *parent=0);
+ ~QDeclarativeScaleGrid();
bool isNull() const;
@@ -94,40 +94,40 @@ private:
int _bottom;
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsGridScaledImage
+class Q_DECLARATIVE_EXPORT QDeclarativeGridScaledImage
{
public:
- QmlGraphicsGridScaledImage();
- QmlGraphicsGridScaledImage(const QmlGraphicsGridScaledImage &);
- QmlGraphicsGridScaledImage(QIODevice*);
- QmlGraphicsGridScaledImage &operator=(const QmlGraphicsGridScaledImage &);
+ QDeclarativeGridScaledImage();
+ QDeclarativeGridScaledImage(const QDeclarativeGridScaledImage &);
+ QDeclarativeGridScaledImage(QIODevice*);
+ QDeclarativeGridScaledImage &operator=(const QDeclarativeGridScaledImage &);
bool isValid() const;
int gridLeft() const;
int gridRight() const;
int gridTop() const;
int gridBottom() const;
- QmlGraphicsBorderImage::TileMode horizontalTileRule() const { return _h; }
- QmlGraphicsBorderImage::TileMode verticalTileRule() const { return _v; }
+ QDeclarativeBorderImage::TileMode horizontalTileRule() const { return _h; }
+ QDeclarativeBorderImage::TileMode verticalTileRule() const { return _v; }
QString pixmapUrl() const;
private:
- static QmlGraphicsBorderImage::TileMode stringToRule(const QString &);
+ static QDeclarativeBorderImage::TileMode stringToRule(const QString &);
private:
int _l;
int _r;
int _t;
int _b;
- QmlGraphicsBorderImage::TileMode _h;
- QmlGraphicsBorderImage::TileMode _v;
+ QDeclarativeBorderImage::TileMode _h;
+ QDeclarativeBorderImage::TileMode _v;
QString _pix;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsScaleGrid)
+QML_DECLARE_TYPE(QDeclarativeScaleGrid)
QT_END_HEADER
-#endif // QMLGRAPHICSSCALEGRID_H
+#endif // QDECLARATIVESCALEGRID_H
diff --git a/src/declarative/graphicsitems/qmlgraphicstext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 57b44d2..ca253df 100644
--- a/src/declarative/graphicsitems/qmlgraphicstext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#include "qmlgraphicstext_p.h"
-#include "qmlgraphicstext_p_p.h"
-#include <qmlstyledtext_p.h>
+#include "qdeclarativetext_p.h"
+#include "qdeclarativetext_p_p.h"
+#include <qdeclarativestyledtext_p.h>
#include <qfxperf_p_p.h>
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
/*!
- \qmlclass Text QmlGraphicsText
+ \qmlclass Text QDeclarativeText
\since 4.7
\brief The Text item allows you to add formatted text to a scene.
\inherits Item
@@ -83,11 +83,11 @@ QT_BEGIN_NAMESPACE
/*!
\internal
- \class QmlGraphicsText
+ \class QDeclarativeText
\qmlclass Text
\ingroup group_coreitems
- \brief The QmlGraphicsText class provides a formatted text item that you can add to a QmlView.
+ \brief The QDeclarativeText class provides a formatted text item that you can add to a QDeclarativeView.
Text was designed for read-only text; it does not allow for any text editing.
It can display both plain and rich text. For example:
@@ -105,21 +105,21 @@ QT_BEGIN_NAMESPACE
The \c elide property can alternatively be used to fit a line of plain text to a set width.
- A QmlGraphicsText object can be instantiated in Qml using the tag \c Text.
+ A QDeclarativeText object can be instantiated in Qml using the tag \c Text.
*/
-QmlGraphicsText::QmlGraphicsText(QmlGraphicsItem *parent)
- : QmlGraphicsItem(*(new QmlGraphicsTextPrivate), parent)
+QDeclarativeText::QDeclarativeText(QDeclarativeItem *parent)
+ : QDeclarativeItem(*(new QDeclarativeTextPrivate), parent)
{
setAcceptedMouseButtons(Qt::LeftButton);
setFlag(QGraphicsItem::ItemHasNoContents, false);
}
-QmlGraphicsText::~QmlGraphicsText()
+QDeclarativeText::~QDeclarativeText()
{
}
-QmlGraphicsTextPrivate::~QmlGraphicsTextPrivate()
+QDeclarativeTextPrivate::~QDeclarativeTextPrivate()
{
}
@@ -133,15 +133,15 @@ QmlGraphicsTextPrivate::~QmlGraphicsTextPrivate()
Set the Text's font attributes.
*/
-QFont QmlGraphicsText::font() const
+QFont QDeclarativeText::font() const
{
- Q_D(const QmlGraphicsText);
+ Q_D(const QDeclarativeText);
return d->font;
}
-void QmlGraphicsText::setFont(const QFont &font)
+void QDeclarativeText::setFont(const QFont &font)
{
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
if (d->font == font)
return;
@@ -152,12 +152,12 @@ void QmlGraphicsText::setFont(const QFont &font)
emit fontChanged(d->font);
}
-void QmlGraphicsText::setText(const QString &n)
+void QDeclarativeText::setText(const QString &n)
{
#ifdef Q_ENABLE_PERFORMANCE_LOG
- QmlPerfTimer<QmlPerf::QmlGraphicsText_setText> st;
+ QDeclarativePerfTimer<QDeclarativePerf::QDeclarativeText_setText> st;
#endif
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
if (d->text == n)
return;
@@ -184,15 +184,15 @@ void QmlGraphicsText::setText(const QString &n)
The item will try to automatically determine whether the text should
be treated as rich text. This determination is made using Qt::mightBeRichText().
*/
-QString QmlGraphicsText::text() const
+QString QDeclarativeText::text() const
{
- Q_D(const QmlGraphicsText);
+ Q_D(const QDeclarativeText);
return d->text;
}
-void QmlGraphicsText::setColor(const QColor &color)
+void QDeclarativeText::setColor(const QColor &color)
{
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
if (d->color == color)
return;
@@ -215,9 +215,9 @@ void QmlGraphicsText::setColor(const QColor &color)
\endqml
*/
-QColor QmlGraphicsText::color() const
+QColor QDeclarativeText::color() const
{
- Q_D(const QmlGraphicsText);
+ Q_D(const QDeclarativeText);
return d->color;
}
@@ -239,15 +239,15 @@ QColor QmlGraphicsText::color() const
\image declarative-textstyle.png
*/
-QmlGraphicsText::TextStyle QmlGraphicsText::style() const
+QDeclarativeText::TextStyle QDeclarativeText::style() const
{
- Q_D(const QmlGraphicsText);
+ Q_D(const QDeclarativeText);
return d->style;
}
-void QmlGraphicsText::setStyle(QmlGraphicsText::TextStyle style)
+void QDeclarativeText::setStyle(QDeclarativeText::TextStyle style)
{
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
if (d->style == style)
return;
@@ -256,9 +256,9 @@ void QmlGraphicsText::setStyle(QmlGraphicsText::TextStyle style)
emit styleChanged(d->style);
}
-void QmlGraphicsText::setStyleColor(const QColor &color)
+void QDeclarativeText::setStyleColor(const QColor &color)
{
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
if (d->styleColor == color)
return;
@@ -276,9 +276,9 @@ void QmlGraphicsText::setStyleColor(const QColor &color)
shadow color for raised or sunken text. If no style has been set, it is not
used at all.
*/
-QColor QmlGraphicsText::styleColor() const
+QColor QDeclarativeText::styleColor() const
{
- Q_D(const QmlGraphicsText);
+ Q_D(const QDeclarativeText);
return d->styleColor;
}
@@ -293,15 +293,15 @@ QColor QmlGraphicsText::styleColor() const
\c AlignHCenter. The valid values for \c verticalAlignment are \c AlignTop, \c AlignBottom
and \c AlignVCenter.
*/
-QmlGraphicsText::HAlignment QmlGraphicsText::hAlign() const
+QDeclarativeText::HAlignment QDeclarativeText::hAlign() const
{
- Q_D(const QmlGraphicsText);
+ Q_D(const QDeclarativeText);
return d->hAlign;
}
-void QmlGraphicsText::setHAlign(HAlignment align)
+void QDeclarativeText::setHAlign(HAlignment align)
{
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
if (d->hAlign == align)
return;
@@ -309,15 +309,15 @@ void QmlGraphicsText::setHAlign(HAlignment align)
emit horizontalAlignmentChanged(align);
}
-QmlGraphicsText::VAlignment QmlGraphicsText::vAlign() const
+QDeclarativeText::VAlignment QDeclarativeText::vAlign() const
{
- Q_D(const QmlGraphicsText);
+ Q_D(const QDeclarativeText);
return d->vAlign;
}
-void QmlGraphicsText::setVAlign(VAlignment align)
+void QDeclarativeText::setVAlign(VAlignment align)
{
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
if (d->vAlign == align)
return;
@@ -338,15 +338,15 @@ void QmlGraphicsText::setVAlign(VAlignment align)
Wrapping is off by default.
*/
//### Future may provide choice of wrap modes, such as QTextOption::WrapAtWordBoundaryOrAnywhere
-bool QmlGraphicsText::wrap() const
+bool QDeclarativeText::wrap() const
{
- Q_D(const QmlGraphicsText);
+ Q_D(const QDeclarativeText);
return d->wrap;
}
-void QmlGraphicsText::setWrap(bool w)
+void QDeclarativeText::setWrap(bool w)
{
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
if (w == d->wrap)
return;
@@ -406,15 +406,15 @@ Column {
\endtable
*/
-QmlGraphicsText::TextFormat QmlGraphicsText::textFormat() const
+QDeclarativeText::TextFormat QDeclarativeText::textFormat() const
{
- Q_D(const QmlGraphicsText);
+ Q_D(const QDeclarativeText);
return d->format;
}
-void QmlGraphicsText::setTextFormat(TextFormat format)
+void QDeclarativeText::setTextFormat(TextFormat format)
{
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
if (format == d->format)
return;
d->format = format;
@@ -454,15 +454,15 @@ void QmlGraphicsText::setTextFormat(TextFormat format)
Multi-length strings are ordered from longest to shortest, separated by the
Unicode "String Terminator" character \c U009C (write this in QML with \c{"\u009C"} or \c{"\x9C"}).
*/
-QmlGraphicsText::TextElideMode QmlGraphicsText::elideMode() const
+QDeclarativeText::TextElideMode QDeclarativeText::elideMode() const
{
- Q_D(const QmlGraphicsText);
+ Q_D(const QDeclarativeText);
return d->elideMode;
}
-void QmlGraphicsText::setElideMode(QmlGraphicsText::TextElideMode mode)
+void QDeclarativeText::setElideMode(QDeclarativeText::TextElideMode mode)
{
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
if (mode == d->elideMode)
return;
@@ -473,14 +473,14 @@ void QmlGraphicsText::setElideMode(QmlGraphicsText::TextElideMode mode)
emit elideModeChanged(d->elideMode);
}
-void QmlGraphicsText::geometryChanged(const QRectF &newGeometry,
+void QDeclarativeText::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
if (newGeometry.width() != oldGeometry.width()) {
- if (d->wrap || d->elideMode != QmlGraphicsText::ElideNone) {
+ if (d->wrap || d->elideMode != QDeclarativeText::ElideNone) {
//re-elide if needed
- if (d->singleline && d->elideMode != QmlGraphicsText::ElideNone &&
+ if (d->singleline && d->elideMode != QDeclarativeText::ElideNone &&
isComponentComplete() && widthValid()) {
QFontMetrics fm(d->font);
@@ -492,29 +492,29 @@ void QmlGraphicsText::geometryChanged(const QRectF &newGeometry,
d->updateSize();
}
}
- QmlGraphicsItem::geometryChanged(newGeometry, oldGeometry);
+ QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
}
-void QmlGraphicsTextPrivate::updateLayout()
+void QDeclarativeTextPrivate::updateLayout()
{
- Q_Q(QmlGraphicsText);
+ Q_Q(QDeclarativeText);
if (q->isComponentComplete()) {
//setup instance of QTextLayout for all cases other than richtext
if (!richText) {
layout.clearLayout();
layout.setFont(font);
- if (format != QmlGraphicsText::StyledText) {
+ if (format != QDeclarativeText::StyledText) {
QString tmp = text;
tmp.replace(QLatin1Char('\n'), QChar::LineSeparator);
singleline = !tmp.contains(QChar::LineSeparator);
- if (singleline && elideMode != QmlGraphicsText::ElideNone && q->widthValid()) {
+ if (singleline && elideMode != QDeclarativeText::ElideNone && q->widthValid()) {
QFontMetrics fm(font);
tmp = fm.elidedText(tmp,(Qt::TextElideMode)elideMode,q->width()); // XXX still worth layout...?
}
layout.setText(tmp);
} else {
singleline = false;
- QmlStyledText::parse(text, layout);
+ QDeclarativeStyledText::parse(text, layout);
}
}
updateSize();
@@ -523,9 +523,9 @@ void QmlGraphicsTextPrivate::updateLayout()
}
}
-void QmlGraphicsTextPrivate::updateSize()
+void QDeclarativeTextPrivate::updateSize()
{
- Q_Q(QmlGraphicsText);
+ Q_Q(QDeclarativeText);
if (q->isComponentComplete()) {
QFontMetrics fm(font);
if (text.isEmpty()) {
@@ -560,9 +560,9 @@ void QmlGraphicsTextPrivate::updateSize()
int yoff = 0;
if (q->heightValid()) {
- if (vAlign == QmlGraphicsText::AlignBottom)
+ if (vAlign == QDeclarativeText::AlignBottom)
yoff = dy;
- else if (vAlign == QmlGraphicsText::AlignVCenter)
+ else if (vAlign == QDeclarativeText::AlignVCenter)
yoff = dy/2;
}
q->setBaselineOffset(fm.ascent() + yoff);
@@ -578,7 +578,7 @@ void QmlGraphicsTextPrivate::updateSize()
// ### text layout handling should be profiled and optimized as needed
// what about QStackTextEngine engine(tmp, d->font.font()); QTextLayout textLayout(&engine);
-void QmlGraphicsTextPrivate::drawOutline()
+void QDeclarativeTextPrivate::drawOutline()
{
QPixmap img = QPixmap(imgStyleCache.width()+2,imgStyleCache.height()+2);
img.fill(Qt::transparent);
@@ -602,7 +602,7 @@ void QmlGraphicsTextPrivate::drawOutline()
imgCache = img;
}
-void QmlGraphicsTextPrivate::drawOutline(int yOffset)
+void QDeclarativeTextPrivate::drawOutline(int yOffset)
{
QPixmap img = QPixmap(imgStyleCache.width()+2,imgStyleCache.height()+2);
img.fill(Qt::transparent);
@@ -620,9 +620,9 @@ void QmlGraphicsTextPrivate::drawOutline(int yOffset)
imgCache = img;
}
-QSize QmlGraphicsTextPrivate::setupTextLayout(QTextLayout *layout)
+QSize QDeclarativeTextPrivate::setupTextLayout(QTextLayout *layout)
{
- Q_Q(QmlGraphicsText);
+ Q_Q(QDeclarativeText);
layout->setCacheEnabled(true);
int height = 0;
@@ -630,7 +630,7 @@ QSize QmlGraphicsTextPrivate::setupTextLayout(QTextLayout *layout)
qreal lineWidth = 0;
//set manual width
- if ((wrap || elideMode != QmlGraphicsText::ElideNone) && q->widthValid())
+ if ((wrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid())
lineWidth = q->width();
layout->beginLayout();
@@ -640,7 +640,7 @@ QSize QmlGraphicsTextPrivate::setupTextLayout(QTextLayout *layout)
if (!line.isValid())
break;
- if ((wrap || elideMode != QmlGraphicsText::ElideNone) && q->widthValid())
+ if ((wrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid())
line.setLineWidth(lineWidth);
}
layout->endLayout();
@@ -653,11 +653,11 @@ QSize QmlGraphicsTextPrivate::setupTextLayout(QTextLayout *layout)
height += int(line.height());
if (!cache) {
- if (hAlign == QmlGraphicsText::AlignLeft) {
+ if (hAlign == QDeclarativeText::AlignLeft) {
x = 0;
- } else if (hAlign == QmlGraphicsText::AlignRight) {
+ } else if (hAlign == QDeclarativeText::AlignRight) {
x = q->width() - (int)line.naturalTextWidth();
- } else if (hAlign == QmlGraphicsText::AlignHCenter) {
+ } else if (hAlign == QDeclarativeText::AlignHCenter) {
x = (q->width() - (int)line.naturalTextWidth()) / 2;
}
line.setPosition(QPoint(x, (int)line.y()));
@@ -667,7 +667,7 @@ QSize QmlGraphicsTextPrivate::setupTextLayout(QTextLayout *layout)
return QSize(qCeil(widthUsed), height);
}
-QPixmap QmlGraphicsTextPrivate::wrappedTextImage(bool drawStyle)
+QPixmap QDeclarativeTextPrivate::wrappedTextImage(bool drawStyle)
{
//do layout
QSize size = cachedLayoutSize;
@@ -675,11 +675,11 @@ QPixmap QmlGraphicsTextPrivate::wrappedTextImage(bool drawStyle)
int x = 0;
for (int i = 0; i < layout.lineCount(); ++i) {
QTextLine line = layout.lineAt(i);
- if (hAlign == QmlGraphicsText::AlignLeft) {
+ if (hAlign == QDeclarativeText::AlignLeft) {
x = 0;
- } else if (hAlign == QmlGraphicsText::AlignRight) {
+ } else if (hAlign == QDeclarativeText::AlignRight) {
x = size.width() - (int)line.naturalTextWidth();
- } else if (hAlign == QmlGraphicsText::AlignHCenter) {
+ } else if (hAlign == QDeclarativeText::AlignHCenter) {
x = (size.width() - (int)line.naturalTextWidth()) / 2;
}
line.setPosition(QPoint(x, (int)line.y()));
@@ -695,7 +695,7 @@ QPixmap QmlGraphicsTextPrivate::wrappedTextImage(bool drawStyle)
return img;
}
-void QmlGraphicsTextPrivate::drawWrappedText(QPainter *p, const QPointF &pos, bool drawStyle)
+void QDeclarativeTextPrivate::drawWrappedText(QPainter *p, const QPointF &pos, bool drawStyle)
{
if (drawStyle)
p->setPen(styleColor);
@@ -705,7 +705,7 @@ void QmlGraphicsTextPrivate::drawWrappedText(QPainter *p, const QPointF &pos, bo
layout.draw(p, pos);
}
-QPixmap QmlGraphicsTextPrivate::richTextImage(bool drawStyle)
+QPixmap QDeclarativeTextPrivate::richTextImage(bool drawStyle)
{
QSize size = doc->size().toSize();
@@ -731,7 +731,7 @@ QPixmap QmlGraphicsTextPrivate::richTextImage(bool drawStyle)
return img;
}
-void QmlGraphicsTextPrivate::checkImgCache()
+void QDeclarativeTextPrivate::checkImgCache()
{
if (!imgDirty)
return;
@@ -742,22 +742,22 @@ void QmlGraphicsTextPrivate::checkImgCache()
imgStyleCache = QPixmap();
} else if (richText) {
imgCache = richTextImage(false);
- if (style != QmlGraphicsText::Normal)
+ if (style != QDeclarativeText::Normal)
imgStyleCache = richTextImage(true); //### should use styleColor
} else {
imgCache = wrappedTextImage(false);
- if (style != QmlGraphicsText::Normal)
+ if (style != QDeclarativeText::Normal)
imgStyleCache = wrappedTextImage(true); //### should use styleColor
}
if (!empty)
switch (style) {
- case QmlGraphicsText::Outline:
+ case QDeclarativeText::Outline:
drawOutline();
break;
- case QmlGraphicsText::Sunken:
+ case QDeclarativeText::Sunken:
drawOutline(-1);
break;
- case QmlGraphicsText::Raised:
+ case QDeclarativeText::Raised:
drawOutline(1);
break;
default:
@@ -767,9 +767,9 @@ void QmlGraphicsTextPrivate::checkImgCache()
imgDirty = false;
}
-void QmlGraphicsText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
+void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
if (d->cache || d->style != Normal) {
d->checkImgCache();
@@ -811,8 +811,8 @@ void QmlGraphicsText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidg
break;
}
- bool needClip = !clip() && (d->imgCache.width() > width() ||
- d->imgCache.height() > height());
+ bool needClip = clip() && (d->imgCache.width() > width() ||
+ d->imgCache.height() > height());
if (needClip) {
p->save();
@@ -875,13 +875,13 @@ void QmlGraphicsText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidg
filtering at the beginning of the animation and reenable it at the conclusion.
*/
-void QmlGraphicsText::componentComplete()
+void QDeclarativeText::componentComplete()
{
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
#ifdef Q_ENABLE_PERFORMANCE_LOG
- QmlPerfTimer<QmlPerf::TextComponentComplete> cc;
+ QDeclarativePerfTimer<QDeclarativePerf::TextComponentComplete> cc;
#endif
- QmlGraphicsItem::componentComplete();
+ QDeclarativeItem::componentComplete();
if (d->dirty) {
d->updateLayout();
d->dirty = false;
@@ -892,9 +892,9 @@ void QmlGraphicsText::componentComplete()
\overload
Handles the given mouse \a event.
*/
-void QmlGraphicsText::mousePressEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeText::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
if (!d->richText || !d->doc || d->doc->documentLayout()->anchorAt(event->pos()).isEmpty()) {
event->setAccepted(false);
@@ -906,7 +906,7 @@ void QmlGraphicsText::mousePressEvent(QGraphicsSceneMouseEvent *event)
// ### may malfunction if two of the same links are clicked & dragged onto each other)
if (!event->isAccepted())
- QmlGraphicsItem::mousePressEvent(event);
+ QDeclarativeItem::mousePressEvent(event);
}
@@ -920,9 +920,9 @@ void QmlGraphicsText::mousePressEvent(QGraphicsSceneMouseEvent *event)
\overload
Handles the given mouse \a event.
*/
-void QmlGraphicsText::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeText::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsText);
+ Q_D(QDeclarativeText);
// ### confirm the link, and send a signal out
if (d->richText && d->doc && d->activeLink == d->doc->documentLayout()->anchorAt(event->pos()))
@@ -931,6 +931,6 @@ void QmlGraphicsText::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
event->setAccepted(false);
if (!event->isAccepted())
- QmlGraphicsItem::mouseReleaseEvent(event);
+ QDeclarativeItem::mouseReleaseEvent(event);
}
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qmlgraphicstext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h
index ad35524..cbea8f3 100644
--- a/src/declarative/graphicsitems/qmlgraphicstext_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetext_p.h
@@ -39,18 +39,18 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSTEXT_H
-#define QMLGRAPHICSTEXT_H
+#ifndef QDECLARATIVETEXT_H
+#define QDECLARATIVETEXT_H
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsTextPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsText : public QmlGraphicsItem
+class QDeclarativeTextPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeText : public QDeclarativeItem
{
Q_OBJECT
Q_ENUMS(HAlignment)
@@ -71,8 +71,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsText : public QmlGraphicsItem
Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode NOTIFY elideModeChanged) //### elideMode?
public:
- QmlGraphicsText(QmlGraphicsItem *parent=0);
- ~QmlGraphicsText();
+ QDeclarativeText(QDeclarativeItem *parent=0);
+ ~QDeclarativeText();
enum HAlignment { AlignLeft = Qt::AlignLeft,
AlignRight = Qt::AlignRight,
@@ -147,13 +147,13 @@ protected:
const QRectF &oldGeometry);
private:
- Q_DISABLE_COPY(QmlGraphicsText)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsText)
+ Q_DISABLE_COPY(QDeclarativeText)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeText)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsText)
+QML_DECLARE_TYPE(QDeclarativeText)
QT_END_HEADER
diff --git a/src/declarative/graphicsitems/qmlgraphicstext_p_p.h b/src/declarative/graphicsitems/qdeclarativetext_p_p.h
index f67d57c..a0c8abe 100644
--- a/src/declarative/graphicsitems/qmlgraphicstext_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetext_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSTEXT_P_H
-#define QMLGRAPHICSTEXT_P_H
+#ifndef QDECLARATIVETEXT_P_H
+#define QDECLARATIVETEXT_P_H
//
// W A R N I N G
@@ -53,10 +53,10 @@
// We mean it.
//
-#include "qmlgraphicsitem.h"
-#include "qmlgraphicsitem_p.h"
+#include "qdeclarativeitem.h"
+#include "qdeclarativeitem_p.h"
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtGui/qtextlayout.h>
@@ -65,27 +65,27 @@ QT_BEGIN_NAMESPACE
class QTextLayout;
class QTextDocument;
-class QmlGraphicsTextPrivate : public QmlGraphicsItemPrivate
+class QDeclarativeTextPrivate : public QDeclarativeItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsText)
+ Q_DECLARE_PUBLIC(QDeclarativeText)
public:
- QmlGraphicsTextPrivate()
- : color((QRgb)0), style(QmlGraphicsText::Normal), imgDirty(true),
- hAlign(QmlGraphicsText::AlignLeft), vAlign(QmlGraphicsText::AlignTop), elideMode(QmlGraphicsText::ElideNone),
+ QDeclarativeTextPrivate()
+ : color((QRgb)0), style(QDeclarativeText::Normal), imgDirty(true),
+ hAlign(QDeclarativeText::AlignLeft), vAlign(QDeclarativeText::AlignTop), elideMode(QDeclarativeText::ElideNone),
dirty(true), wrap(false), richText(false), singleline(false), cache(true), doc(0),
- format(QmlGraphicsText::AutoText)
+ format(QDeclarativeText::AutoText)
{
#if defined(QML_NO_TEXT_CACHE)
cache = false;
#endif
}
- ~QmlGraphicsTextPrivate();
+ ~QDeclarativeTextPrivate();
void updateSize();
void updateLayout();
void markImgDirty() {
- Q_Q(QmlGraphicsText);
+ Q_Q(QDeclarativeText);
imgDirty = true;
if (q->isComponentComplete())
q->update();
@@ -103,15 +103,15 @@ public:
QString text;
QFont font;
QColor color;
- QmlGraphicsText::TextStyle style;
+ QDeclarativeText::TextStyle style;
QColor styleColor;
QString activeLink;
bool imgDirty;
QPixmap imgCache;
QPixmap imgStyleCache;
- QmlGraphicsText::HAlignment hAlign;
- QmlGraphicsText::VAlignment vAlign;
- QmlGraphicsText::TextElideMode elideMode;
+ QDeclarativeText::HAlignment hAlign;
+ QDeclarativeText::VAlignment vAlign;
+ QDeclarativeText::TextElideMode elideMode;
bool dirty:1;
bool wrap:1;
bool richText:1;
@@ -120,7 +120,7 @@ public:
QTextDocument *doc;
QTextLayout layout;
QSize cachedLayoutSize;
- QmlGraphicsText::TextFormat format;
+ QDeclarativeText::TextFormat format;
};
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 364751d..8e44b26 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#include "qmlgraphicstextedit_p.h"
-#include "qmlgraphicstextedit_p_p.h"
+#include "qdeclarativetextedit_p.h"
+#include "qdeclarativetextedit_p_p.h"
-#include "qmlgraphicsevents_p_p.h"
+#include "qdeclarativeevents_p_p.h"
#include <qfxperf_p_p.h>
@@ -58,7 +58,7 @@
QT_BEGIN_NAMESPACE
/*!
- \qmlclass TextEdit QmlGraphicsTextEdit
+ \qmlclass TextEdit QDeclarativeTextEdit
\since 4.7
\brief The TextEdit item allows you to add editable formatted text to a scene.
@@ -83,32 +83,32 @@ TextEdit {
/*!
\internal
- \class QmlGraphicsTextEdit
+ \class QDeclarativeTextEdit
\qmlclass TextEdit
\ingroup group_coreitems
- \brief The QmlGraphicsTextEdit class provides an editable formatted text item that you can add to a QmlView.
+ \brief The QDeclarativeTextEdit class provides an editable formatted text item that you can add to a QDeclarativeView.
It can display both plain and rich text.
\image declarative-textedit.png
- A QmlGraphicsTextEdit object can be instantiated in Qml using the tag \c &lt;TextEdit&gt;.
+ A QDeclarativeTextEdit object can be instantiated in Qml using the tag \c &lt;TextEdit&gt;.
*/
/*!
- Constructs a new QmlGraphicsTextEdit.
+ Constructs a new QDeclarativeTextEdit.
*/
-QmlGraphicsTextEdit::QmlGraphicsTextEdit(QmlGraphicsItem *parent)
-: QmlGraphicsPaintedItem(*(new QmlGraphicsTextEditPrivate), parent)
+QDeclarativeTextEdit::QDeclarativeTextEdit(QDeclarativeItem *parent)
+: QDeclarativePaintedItem(*(new QDeclarativeTextEditPrivate), parent)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
d->init();
}
-QString QmlGraphicsTextEdit::text() const
+QString QDeclarativeTextEdit::text() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
if (d->richText)
return d->document->toHtml();
@@ -134,10 +134,10 @@ QString QmlGraphicsTextEdit::text() const
automatically determine whether the text should be treated as
rich text. This determination is made using Qt::mightBeRichText().
*/
-void QmlGraphicsTextEdit::setText(const QString &text)
+void QDeclarativeTextEdit::setText(const QString &text)
{
- Q_D(QmlGraphicsTextEdit);
- if (QmlGraphicsTextEdit::text() == text)
+ Q_D(QDeclarativeTextEdit);
+ if (QDeclarativeTextEdit::text() == text)
return;
d->text = text;
d->richText = d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(text));
@@ -184,15 +184,15 @@ Column {
\o \image declarative-textformat.png
\endtable
*/
-QmlGraphicsTextEdit::TextFormat QmlGraphicsTextEdit::textFormat() const
+QDeclarativeTextEdit::TextFormat QDeclarativeTextEdit::textFormat() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->format;
}
-void QmlGraphicsTextEdit::setTextFormat(TextFormat format)
+void QDeclarativeTextEdit::setTextFormat(TextFormat format)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (format == d->format)
return;
bool wasRich = d->richText;
@@ -209,15 +209,15 @@ void QmlGraphicsTextEdit::setTextFormat(TextFormat format)
emit textFormatChanged(d->format);
}
-QFont QmlGraphicsTextEdit::font() const
+QFont QDeclarativeTextEdit::font() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->font;
}
-void QmlGraphicsTextEdit::setFont(const QFont &font)
+void QDeclarativeTextEdit::setFont(const QFont &font)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
d->font = font;
clearCache();
@@ -243,15 +243,15 @@ TextEdit { color: "#00FF00"; ... }
TextEdit { color: "steelblue"; ... }
\endqml
*/
-QColor QmlGraphicsTextEdit::color() const
+QColor QDeclarativeTextEdit::color() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->color;
}
-void QmlGraphicsTextEdit::setColor(const QColor &color)
+void QDeclarativeTextEdit::setColor(const QColor &color)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (d->color == color)
return;
@@ -269,15 +269,15 @@ void QmlGraphicsTextEdit::setColor(const QColor &color)
The text highlight color, used behind selections.
*/
-QColor QmlGraphicsTextEdit::selectionColor() const
+QColor QDeclarativeTextEdit::selectionColor() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->selectionColor;
}
-void QmlGraphicsTextEdit::setSelectionColor(const QColor &color)
+void QDeclarativeTextEdit::setSelectionColor(const QColor &color)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (d->selectionColor == color)
return;
@@ -295,15 +295,15 @@ void QmlGraphicsTextEdit::setSelectionColor(const QColor &color)
The selected text color, used in selections.
*/
-QColor QmlGraphicsTextEdit::selectedTextColor() const
+QColor QDeclarativeTextEdit::selectedTextColor() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->selectedTextColor;
}
-void QmlGraphicsTextEdit::setSelectedTextColor(const QColor &color)
+void QDeclarativeTextEdit::setSelectedTextColor(const QColor &color)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (d->selectedTextColor == color)
return;
@@ -327,15 +327,15 @@ void QmlGraphicsTextEdit::setSelectedTextColor(const QColor &color)
\c AlignHCenter. The valid values for \c verticalAlignment are \c AlignTop, \c AlignBottom
and \c AlignVCenter.
*/
-QmlGraphicsTextEdit::HAlignment QmlGraphicsTextEdit::hAlign() const
+QDeclarativeTextEdit::HAlignment QDeclarativeTextEdit::hAlign() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->hAlign;
}
-void QmlGraphicsTextEdit::setHAlign(QmlGraphicsTextEdit::HAlignment alignment)
+void QDeclarativeTextEdit::setHAlign(QDeclarativeTextEdit::HAlignment alignment)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (alignment == d->hAlign)
return;
d->hAlign = alignment;
@@ -344,15 +344,15 @@ void QmlGraphicsTextEdit::setHAlign(QmlGraphicsTextEdit::HAlignment alignment)
emit horizontalAlignmentChanged(d->hAlign);
}
-QmlGraphicsTextEdit::VAlignment QmlGraphicsTextEdit::vAlign() const
+QDeclarativeTextEdit::VAlignment QDeclarativeTextEdit::vAlign() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->vAlign;
}
-void QmlGraphicsTextEdit::setVAlign(QmlGraphicsTextEdit::VAlignment alignment)
+void QDeclarativeTextEdit::setVAlign(QDeclarativeTextEdit::VAlignment alignment)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (alignment == d->vAlign)
return;
d->vAlign = alignment;
@@ -361,9 +361,9 @@ void QmlGraphicsTextEdit::setVAlign(QmlGraphicsTextEdit::VAlignment alignment)
emit verticalAlignmentChanged(d->vAlign);
}
-bool QmlGraphicsTextEdit::wrap() const
+bool QDeclarativeTextEdit::wrap() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->wrap;
}
@@ -375,9 +375,9 @@ bool QmlGraphicsTextEdit::wrap() const
Wrapping is done on word boundaries (i.e. it is a "word-wrap"). Wrapping is off by default.
*/
-void QmlGraphicsTextEdit::setWrap(bool w)
+void QDeclarativeTextEdit::setWrap(bool w)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (w == d->wrap)
return;
d->wrap = w;
@@ -393,15 +393,15 @@ void QmlGraphicsTextEdit::setWrap(bool w)
This property is set and unset when the text edit gets focus, but it can also
be set directly (useful, for example, if a KeyProxy might forward keys to it).
*/
-bool QmlGraphicsTextEdit::isCursorVisible() const
+bool QDeclarativeTextEdit::isCursorVisible() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->cursorVisible;
}
-void QmlGraphicsTextEdit::setCursorVisible(bool on)
+void QDeclarativeTextEdit::setCursorVisible(bool on)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (d->cursorVisible == on)
return;
d->cursorVisible = on;
@@ -416,15 +416,15 @@ void QmlGraphicsTextEdit::setCursorVisible(bool on)
\qmlproperty int TextEdit::cursorPosition
The position of the cursor in the TextEdit.
*/
-int QmlGraphicsTextEdit::cursorPosition() const
+int QDeclarativeTextEdit::cursorPosition() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->control->textCursor().position();
}
-void QmlGraphicsTextEdit::setCursorPosition(int pos)
+void QDeclarativeTextEdit::setCursorPosition(int pos)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
QTextCursor cursor = d->control->textCursor();
if (cursor.position() == pos)
return;
@@ -442,18 +442,18 @@ void QmlGraphicsTextEdit::setCursorPosition(int pos)
needed, and the x and y properties of delegate instance will be set so as
to be one pixel before the top left of the current character.
- Note that the root item of the delegate component must be a QmlGraphicsItem or
- QmlGraphicsItem derived item.
+ Note that the root item of the delegate component must be a QDeclarativeItem or
+ QDeclarativeItem derived item.
*/
-QmlComponent* QmlGraphicsTextEdit::cursorDelegate() const
+QDeclarativeComponent* QDeclarativeTextEdit::cursorDelegate() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->cursorComponent;
}
-void QmlGraphicsTextEdit::setCursorDelegate(QmlComponent* c)
+void QDeclarativeTextEdit::setCursorDelegate(QDeclarativeComponent* c)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if(d->cursorComponent){
if(d->cursor){
disconnect(d->control, SIGNAL(cursorPositionChanged()),
@@ -476,12 +476,12 @@ void QmlGraphicsTextEdit::setCursorDelegate(QmlComponent* c)
emit cursorDelegateChanged();
}
-void QmlGraphicsTextEdit::loadCursorDelegate()
+void QDeclarativeTextEdit::loadCursorDelegate()
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if(d->cursorComponent->isLoading())
return;
- d->cursor = qobject_cast<QmlGraphicsItem*>(d->cursorComponent->create(qmlContext(this)));
+ d->cursor = qobject_cast<QDeclarativeItem*>(d->cursorComponent->create(qmlContext(this)));
if(d->cursor){
connect(d->control, SIGNAL(cursorPositionChanged()),
this, SLOT(moveCursorDelegate()));
@@ -508,15 +508,15 @@ void QmlGraphicsTextEdit::loadCursorDelegate()
\sa selectionEnd, cursorPosition, selectedText
*/
-int QmlGraphicsTextEdit::selectionStart() const
+int QDeclarativeTextEdit::selectionStart() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->control->textCursor().selectionStart();
}
-void QmlGraphicsTextEdit::setSelectionStart(int s)
+void QDeclarativeTextEdit::setSelectionStart(int s)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if(d->lastSelectionStart == s || s < 0 || s > text().length())
return;
d->lastSelectionStart = s;
@@ -536,15 +536,15 @@ void QmlGraphicsTextEdit::setSelectionStart(int s)
\sa selectionStart, cursorPosition, selectedText
*/
-int QmlGraphicsTextEdit::selectionEnd() const
+int QDeclarativeTextEdit::selectionEnd() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->control->textCursor().selectionEnd();
}
-void QmlGraphicsTextEdit::setSelectionEnd(int s)
+void QDeclarativeTextEdit::setSelectionEnd(int s)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if(d->lastSelectionEnd == s || s < 0 || s > text().length())
return;
d->lastSelectionEnd = s;
@@ -565,9 +565,9 @@ void QmlGraphicsTextEdit::setSelectionEnd(int s)
myTextEdit.selectionEnd);
\endcode
*/
-QString QmlGraphicsTextEdit::selectedText() const
+QString QDeclarativeTextEdit::selectedText() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->control->textCursor().selectedText();
}
@@ -577,15 +577,15 @@ QString QmlGraphicsTextEdit::selectedText() const
Whether the TextEdit should gain focus on a mouse press. By default this is
set to true.
*/
-bool QmlGraphicsTextEdit::focusOnPress() const
+bool QDeclarativeTextEdit::focusOnPress() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->focusOnPress;
}
-void QmlGraphicsTextEdit::setFocusOnPress(bool on)
+void QDeclarativeTextEdit::setFocusOnPress(bool on)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (d->focusOnPress == on)
return;
d->focusOnPress = on;
@@ -598,30 +598,30 @@ void QmlGraphicsTextEdit::setFocusOnPress(bool on)
Whether the TextEdit should keep the selection visible when it loses focus to another
item in the scene. By default this is set to true;
*/
-bool QmlGraphicsTextEdit::persistentSelection() const
+bool QDeclarativeTextEdit::persistentSelection() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->persistentSelection;
}
-void QmlGraphicsTextEdit::setPersistentSelection(bool on)
+void QDeclarativeTextEdit::setPersistentSelection(bool on)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (d->persistentSelection == on)
return;
d->persistentSelection = on;
emit persistentSelectionChanged(d->persistentSelection);
}
-qreal QmlGraphicsTextEdit::textMargin() const
+qreal QDeclarativeTextEdit::textMargin() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->textMargin;
}
-void QmlGraphicsTextEdit::setTextMargin(qreal margin)
+void QDeclarativeTextEdit::setTextMargin(qreal margin)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (d->textMargin == margin)
return;
d->textMargin = margin;
@@ -629,22 +629,22 @@ void QmlGraphicsTextEdit::setTextMargin(qreal margin)
emit textMarginChanged(d->textMargin);
}
-void QmlGraphicsTextEdit::geometryChanged(const QRectF &newGeometry,
+void QDeclarativeTextEdit::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
if (newGeometry.width() != oldGeometry.width())
updateSize();
- QmlGraphicsPaintedItem::geometryChanged(newGeometry, oldGeometry);
+ QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry);
}
/*!
Ensures any delayed caching or data loading the class
needs to performed is complete.
*/
-void QmlGraphicsTextEdit::componentComplete()
+void QDeclarativeTextEdit::componentComplete()
{
- Q_D(QmlGraphicsTextEdit);
- QmlGraphicsPaintedItem::componentComplete();
+ Q_D(QDeclarativeTextEdit);
+ QDeclarativePaintedItem::componentComplete();
if (d->dirty) {
updateSize();
d->dirty = false;
@@ -659,9 +659,9 @@ void QmlGraphicsTextEdit::componentComplete()
By default this property is false.
*/
-void QmlGraphicsTextEdit::setReadOnly(bool r)
+void QDeclarativeTextEdit::setReadOnly(bool r)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (r == isReadOnly())
return;
@@ -679,9 +679,9 @@ void QmlGraphicsTextEdit::setReadOnly(bool r)
emit readOnlyChanged(r);
}
-bool QmlGraphicsTextEdit::isReadOnly() const
+bool QDeclarativeTextEdit::isReadOnly() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return !(d->control->textInteractionFlags() & Qt::TextEditable);
}
@@ -689,9 +689,9 @@ bool QmlGraphicsTextEdit::isReadOnly() const
Sets how the text edit should interact with user input to the given
\a flags.
*/
-void QmlGraphicsTextEdit::setTextInteractionFlags(Qt::TextInteractionFlags flags)
+void QDeclarativeTextEdit::setTextInteractionFlags(Qt::TextInteractionFlags flags)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
d->control->setTextInteractionFlags(flags);
}
@@ -699,9 +699,9 @@ void QmlGraphicsTextEdit::setTextInteractionFlags(Qt::TextInteractionFlags flags
Returns the flags specifying how the text edit should interact
with user input.
*/
-Qt::TextInteractionFlags QmlGraphicsTextEdit::textInteractionFlags() const
+Qt::TextInteractionFlags QDeclarativeTextEdit::textInteractionFlags() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->control->textInteractionFlags();
}
@@ -709,9 +709,9 @@ Qt::TextInteractionFlags QmlGraphicsTextEdit::textInteractionFlags() const
Returns the rectangle where the text cursor is rendered
within the text edit.
*/
-QRect QmlGraphicsTextEdit::cursorRect() const
+QRect QDeclarativeTextEdit::cursorRect() const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->control->cursorRect().toRect();
}
@@ -720,39 +720,39 @@ QRect QmlGraphicsTextEdit::cursorRect() const
\overload
Handles the given \a event.
*/
-bool QmlGraphicsTextEdit::event(QEvent *event)
+bool QDeclarativeTextEdit::event(QEvent *event)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (event->type() == QEvent::ShortcutOverride) {
d->control->processEvent(event, QPointF(0, 0));
return event->isAccepted();
}
- return QmlGraphicsPaintedItem::event(event);
+ return QDeclarativePaintedItem::event(event);
}
/*!
\overload
Handles the given key \a event.
*/
-void QmlGraphicsTextEdit::keyPressEvent(QKeyEvent *event)
+void QDeclarativeTextEdit::keyPressEvent(QKeyEvent *event)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
d->control->processEvent(event, QPointF(0, 0));
if (!event->isAccepted())
- QmlGraphicsPaintedItem::keyPressEvent(event);
+ QDeclarativePaintedItem::keyPressEvent(event);
}
/*!
\overload
Handles the given key \a event.
*/
-void QmlGraphicsTextEdit::keyReleaseEvent(QKeyEvent *event)
+void QDeclarativeTextEdit::keyReleaseEvent(QKeyEvent *event)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
d->control->processEvent(event, QPointF(0, 0));
if (!event->isAccepted())
- QmlGraphicsPaintedItem::keyReleaseEvent(event);
+ QDeclarativePaintedItem::keyReleaseEvent(event);
}
/*!
@@ -762,18 +762,18 @@ void QmlGraphicsTextEdit::keyReleaseEvent(QKeyEvent *event)
like KeyProxy can give the behavior of focus even when hasFocus() isn't
true.
*/
-void QmlGraphicsTextEdit::focusChanged(bool hasFocus)
+void QDeclarativeTextEdit::focusChanged(bool hasFocus)
{
setCursorVisible(hasFocus);
- QmlGraphicsItem::focusChanged(hasFocus);
+ QDeclarativeItem::focusChanged(hasFocus);
}
/*!
Causes all text to be selected.
*/
-void QmlGraphicsTextEdit::selectAll()
+void QDeclarativeTextEdit::selectAll()
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
d->control->selectAll();
}
@@ -781,9 +781,9 @@ void QmlGraphicsTextEdit::selectAll()
\overload
Handles the given mouse \a event.
*/
-void QmlGraphicsTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (d->focusOnPress){
QGraphicsItem *p = parentItem();//###Is there a better way to find my focus scope?
while(p) {
@@ -797,56 +797,56 @@ void QmlGraphicsTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
}
d->control->processEvent(event, QPointF(0, 0));
if (!event->isAccepted())
- QmlGraphicsPaintedItem::mousePressEvent(event);
+ QDeclarativePaintedItem::mousePressEvent(event);
}
/*!
\overload
Handles the given mouse \a event.
*/
-void QmlGraphicsTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
QWidget *widget = event->widget();
if (widget && (d->control->textInteractionFlags() & Qt::TextEditable) && boundingRect().contains(event->pos()))
qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), d->focusOnPress);
d->control->processEvent(event, QPointF(0, 0));
if (!event->isAccepted())
- QmlGraphicsPaintedItem::mousePressEvent(event);
+ QDeclarativePaintedItem::mousePressEvent(event);
}
/*!
\overload
Handles the given mouse \a event.
*/
-void QmlGraphicsTextEdit::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeTextEdit::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
d->control->processEvent(event, QPointF(0, 0));
if (!event->isAccepted())
- QmlGraphicsPaintedItem::mouseDoubleClickEvent(event);
+ QDeclarativePaintedItem::mouseDoubleClickEvent(event);
}
/*!
\overload
Handles the given mouse \a event.
*/
-void QmlGraphicsTextEdit::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeTextEdit::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
d->control->processEvent(event, QPointF(0, 0));
if (!event->isAccepted())
- QmlGraphicsPaintedItem::mousePressEvent(event);
+ QDeclarativePaintedItem::mousePressEvent(event);
}
/*!
\overload
Handles the given input method \a event.
*/
-void QmlGraphicsTextEdit::inputMethodEvent(QInputMethodEvent *event)
+void QDeclarativeTextEdit::inputMethodEvent(QInputMethodEvent *event)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
d->control->processEvent(event, QPointF(0, 0));
}
@@ -854,9 +854,9 @@ void QmlGraphicsTextEdit::inputMethodEvent(QInputMethodEvent *event)
\overload
Returns the value of the given \a property.
*/
-QVariant QmlGraphicsTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const
+QVariant QDeclarativeTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const
{
- Q_D(const QmlGraphicsTextEdit);
+ Q_D(const QDeclarativeTextEdit);
return d->control->inputMethodQuery(property);
}
@@ -864,16 +864,16 @@ QVariant QmlGraphicsTextEdit::inputMethodQuery(Qt::InputMethodQuery property) co
Draws the contents of the text edit using the given \a painter within
the given \a bounds.
*/
-void QmlGraphicsTextEdit::drawContents(QPainter *painter, const QRect &bounds)
+void QDeclarativeTextEdit::drawContents(QPainter *painter, const QRect &bounds)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
painter->setRenderHint(QPainter::TextAntialiasing, true);
d->control->drawContents(painter, bounds);
}
-void QmlGraphicsTextEdit::updateImgCache(const QRectF &r)
+void QDeclarativeTextEdit::updateImgCache(const QRectF &r)
{
dirtyCache(r.toRect());
emit update();
@@ -892,9 +892,9 @@ void QmlGraphicsTextEdit::updateImgCache(const QRectF &r)
filtering at the beginning of the animation and reenable it at the conclusion.
*/
-void QmlGraphicsTextEditPrivate::init()
+void QDeclarativeTextEditPrivate::init()
{
- Q_Q(QmlGraphicsTextEdit);
+ Q_Q(QDeclarativeTextEdit);
q->setSmooth(smooth);
q->setAcceptedMouseButtons(Qt::LeftButton);
@@ -920,15 +920,15 @@ void QmlGraphicsTextEditPrivate::init()
updateDefaultTextOption();
}
-void QmlGraphicsTextEdit::q_textChanged()
+void QDeclarativeTextEdit::q_textChanged()
{
updateSize();
emit textChanged(text());
}
-void QmlGraphicsTextEdit::moveCursorDelegate()
+void QDeclarativeTextEdit::moveCursorDelegate()
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if(!d->cursor)
return;
QRectF cursorRect = d->control->cursorRect();
@@ -936,9 +936,9 @@ void QmlGraphicsTextEdit::moveCursorDelegate()
d->cursor->setY(cursorRect.y());
}
-void QmlGraphicsTextEditPrivate::updateSelection()
+void QDeclarativeTextEditPrivate::updateSelection()
{
- Q_Q(QmlGraphicsTextEdit);
+ Q_Q(QDeclarativeTextEdit);
QTextCursor cursor = control->textCursor();
bool startChange = (lastSelectionStart != cursor.selectionStart());
bool endChange = (lastSelectionEnd != cursor.selectionEnd());
@@ -955,12 +955,12 @@ void QmlGraphicsTextEditPrivate::updateSelection()
startChange = (lastSelectionStart != control->textCursor().selectionStart());
endChange = (lastSelectionEnd != control->textCursor().selectionEnd());
if(startChange || endChange)
- qWarning() << "QmlGraphicsTextEditPrivate::updateSelection() has failed you.";
+ qWarning() << "QDeclarativeTextEditPrivate::updateSelection() has failed you.";
}
-void QmlGraphicsTextEdit::updateSelectionMarkers()
+void QDeclarativeTextEdit::updateSelectionMarkers()
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if(d->lastSelectionStart != d->control->textCursor().selectionStart()){
d->lastSelectionStart = d->control->textCursor().selectionStart();
emit selectionStartChanged();
@@ -973,9 +973,9 @@ void QmlGraphicsTextEdit::updateSelectionMarkers()
//### we should perhaps be a bit smarter here -- depending on what has changed, we shouldn't
// need to do all the calculations each time
-void QmlGraphicsTextEdit::updateSize()
+void QDeclarativeTextEdit::updateSize()
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (isComponentComplete()) {
QFontMetrics fm = QFontMetrics(d->font);
int dy = height();
@@ -1014,7 +1014,7 @@ void QmlGraphicsTextEdit::updateSize()
emit update();
}
-void QmlGraphicsTextEditPrivate::updateDefaultTextOption()
+void QDeclarativeTextEditPrivate::updateDefaultTextOption()
{
QTextOption opt = document->defaultTextOption();
int oldAlignment = opt.alignment();
diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
index 337cd9d..6183b1d 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextedit_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSTEXTEDIT_H
-#define QMLGRAPHICSTEXTEDIT_H
+#ifndef QDECLARATIVETEXTEDIT_H
+#define QDECLARATIVETEXTEDIT_H
-#include "qmlgraphicstext_p.h"
-#include "qmlgraphicspainteditem_p.h"
+#include "qdeclarativetext_p.h"
+#include "qdeclarativepainteditem_p.h"
#include <QtGui/qtextdocument.h>
#include <QtGui/qtextoption.h>
@@ -57,8 +57,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsTextEditPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsTextEdit : public QmlGraphicsPaintedItem
+class QDeclarativeTextEditPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem
{
Q_OBJECT
Q_ENUMS(VAlignment)
@@ -77,7 +77,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsTextEdit : public QmlGraphicsPaintedItem
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged)
Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged)
Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged)
- Q_PROPERTY(QmlComponent* cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged)
+ Q_PROPERTY(QDeclarativeComponent* cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged)
Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged)
Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged)
Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectionChanged)
@@ -87,7 +87,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsTextEdit : public QmlGraphicsPaintedItem
Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints)
public:
- QmlGraphicsTextEdit(QmlGraphicsItem *parent=0);
+ QDeclarativeTextEdit(QDeclarativeItem *parent=0);
enum HAlignment {
AlignLeft = Qt::AlignLeft,
@@ -140,8 +140,8 @@ public:
int cursorPosition() const;
void setCursorPosition(int pos);
- QmlComponent* cursorDelegate() const;
- void setCursorDelegate(QmlComponent*);
+ QDeclarativeComponent* cursorDelegate() const;
+ void setCursorDelegate(QDeclarativeComponent*);
int selectionStart() const;
void setSelectionStart(int);
@@ -227,13 +227,13 @@ protected:
void drawContents(QPainter *, const QRect &);
private:
- Q_DISABLE_COPY(QmlGraphicsTextEdit)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsTextEdit)
+ Q_DISABLE_COPY(QDeclarativeTextEdit)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeTextEdit)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsTextEdit)
+QML_DECLARE_TYPE(QDeclarativeTextEdit)
QT_END_HEADER
diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
index 7d4ca88..002fac4 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextedit_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSTEXTEDIT_P_H
-#define QMLGRAPHICSTEXTEDIT_P_H
+#ifndef QDECLARATIVETEXTEDIT_P_H
+#define QDECLARATIVETEXTEDIT_P_H
//
// W A R N I N G
@@ -53,25 +53,25 @@
// We mean it.
//
-#include "qmlgraphicsitem.h"
-#include "qmlgraphicspainteditem_p_p.h"
+#include "qdeclarativeitem.h"
+#include "qdeclarativepainteditem_p_p.h"
-#include <qml.h>
+#include <qdeclarative.h>
QT_BEGIN_NAMESPACE
class QTextLayout;
class QTextDocument;
class QTextControl;
-class QmlGraphicsTextEditPrivate : public QmlGraphicsPaintedItemPrivate
+class QDeclarativeTextEditPrivate : public QDeclarativePaintedItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsTextEdit)
+ Q_DECLARE_PUBLIC(QDeclarativeTextEdit)
public:
- QmlGraphicsTextEditPrivate()
- : color("black"), imgDirty(true), hAlign(QmlGraphicsTextEdit::AlignLeft), vAlign(QmlGraphicsTextEdit::AlignTop),
+ QDeclarativeTextEditPrivate()
+ : color("black"), imgDirty(true), hAlign(QDeclarativeTextEdit::AlignLeft), vAlign(QDeclarativeTextEdit::AlignTop),
dirty(false), wrap(false), richText(false), cursorVisible(false), focusOnPress(true),
persistentSelection(true), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0),
- cursorComponent(0), cursor(0), format(QmlGraphicsTextEdit::AutoText), document(0)
+ cursorComponent(0), cursor(0), format(QDeclarativeTextEdit::AutoText), document(0)
{
}
@@ -91,8 +91,8 @@ public:
bool imgDirty;
QPixmap imgCache;
QPixmap imgStyleCache;
- QmlGraphicsTextEdit::HAlignment hAlign;
- QmlGraphicsTextEdit::VAlignment vAlign;
+ QDeclarativeTextEdit::HAlignment hAlign;
+ QDeclarativeTextEdit::VAlignment vAlign;
bool dirty;
bool wrap;
bool richText;
@@ -102,9 +102,9 @@ public:
qreal textMargin;
int lastSelectionStart;
int lastSelectionEnd;
- QmlComponent* cursorComponent;
- QmlGraphicsItem* cursor;
- QmlGraphicsTextEdit::TextFormat format;
+ QDeclarativeComponent* cursorComponent;
+ QDeclarativeItem* cursor;
+ QDeclarativeTextEdit::TextFormat format;
QTextDocument *document;
QTextControl *control;
};
diff --git a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index d3c1f1f..9919904 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#include "qmlgraphicstextinput_p.h"
-#include "qmlgraphicstextinput_p_p.h"
+#include "qdeclarativetextinput_p.h"
+#include "qdeclarativetextinput_p_p.h"
-#include <qmlinfo.h>
+#include <qdeclarativeinfo.h>
#include <QValidator>
#include <QApplication>
@@ -52,7 +52,7 @@
QT_BEGIN_NAMESPACE
/*!
- \qmlclass TextInput QmlGraphicsTextInput
+ \qmlclass TextInput QDeclarativeTextInput
\since 4.7
The TextInput item allows you to add an editable line of text to a scene.
@@ -62,14 +62,14 @@ QT_BEGIN_NAMESPACE
Input constraints include setting a QValidator, an input mask, or a
maximum input length.
*/
-QmlGraphicsTextInput::QmlGraphicsTextInput(QmlGraphicsItem* parent)
- : QmlGraphicsPaintedItem(*(new QmlGraphicsTextInputPrivate), parent)
+QDeclarativeTextInput::QDeclarativeTextInput(QDeclarativeItem* parent)
+ : QDeclarativePaintedItem(*(new QDeclarativeTextInputPrivate), parent)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
d->init();
}
-QmlGraphicsTextInput::~QmlGraphicsTextInput()
+QDeclarativeTextInput::~QDeclarativeTextInput()
{
}
@@ -79,15 +79,15 @@ QmlGraphicsTextInput::~QmlGraphicsTextInput()
The text in the TextInput.
*/
-QString QmlGraphicsTextInput::text() const
+QString QDeclarativeTextInput::text() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->control->text();
}
-void QmlGraphicsTextInput::setText(const QString &s)
+void QDeclarativeTextInput::setText(const QString &s)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if(s == text())
return;
d->control->setText(s);
@@ -104,15 +104,15 @@ void QmlGraphicsTextInput::setText(const QString &s)
Set the TextInput's font attributes.
*/
-QFont QmlGraphicsTextInput::font() const
+QFont QDeclarativeTextInput::font() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->font;
}
-void QmlGraphicsTextInput::setFont(const QFont &font)
+void QDeclarativeTextInput::setFont(const QFont &font)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if (d->font == font)
return;
@@ -132,15 +132,15 @@ void QmlGraphicsTextInput::setFont(const QFont &font)
The text color.
*/
-QColor QmlGraphicsTextInput::color() const
+QColor QDeclarativeTextInput::color() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->color;
}
-void QmlGraphicsTextInput::setColor(const QColor &c)
+void QDeclarativeTextInput::setColor(const QColor &c)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
d->color = c;
}
@@ -150,15 +150,15 @@ void QmlGraphicsTextInput::setColor(const QColor &c)
The text highlight color, used behind selections.
*/
-QColor QmlGraphicsTextInput::selectionColor() const
+QColor QDeclarativeTextInput::selectionColor() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->selectionColor;
}
-void QmlGraphicsTextInput::setSelectionColor(const QColor &color)
+void QDeclarativeTextInput::setSelectionColor(const QColor &color)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if (d->selectionColor == color)
return;
@@ -174,15 +174,15 @@ void QmlGraphicsTextInput::setSelectionColor(const QColor &color)
The highlighted text color, used in selections.
*/
-QColor QmlGraphicsTextInput::selectedTextColor() const
+QColor QDeclarativeTextInput::selectedTextColor() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->selectedTextColor;
}
-void QmlGraphicsTextInput::setSelectedTextColor(const QColor &color)
+void QDeclarativeTextInput::setSelectedTextColor(const QColor &color)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if (d->selectedTextColor == color)
return;
@@ -208,30 +208,30 @@ void QmlGraphicsTextInput::setSelectedTextColor(const QColor &color)
The valid values for \c horizontalAlignment are \c AlignLeft, \c AlignRight and
\c AlignHCenter.
*/
-QmlGraphicsTextInput::HAlignment QmlGraphicsTextInput::hAlign() const
+QDeclarativeTextInput::HAlignment QDeclarativeTextInput::hAlign() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->hAlign;
}
-void QmlGraphicsTextInput::setHAlign(HAlignment align)
+void QDeclarativeTextInput::setHAlign(HAlignment align)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if(align == d->hAlign)
return;
d->hAlign = align;
emit horizontalAlignmentChanged(d->hAlign);
}
-bool QmlGraphicsTextInput::isReadOnly() const
+bool QDeclarativeTextInput::isReadOnly() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->control->isReadOnly();
}
-void QmlGraphicsTextInput::setReadOnly(bool ro)
+void QDeclarativeTextInput::setReadOnly(bool ro)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if (d->control->isReadOnly() == ro)
return;
@@ -240,15 +240,15 @@ void QmlGraphicsTextInput::setReadOnly(bool ro)
emit readOnlyChanged(ro);
}
-int QmlGraphicsTextInput::maxLength() const
+int QDeclarativeTextInput::maxLength() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->control->maxLength();
}
-void QmlGraphicsTextInput::setMaxLength(int ml)
+void QDeclarativeTextInput::setMaxLength(int ml)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if (d->control->maxLength() == ml)
return;
@@ -283,15 +283,15 @@ void QmlGraphicsTextInput::setMaxLength(int ml)
In the above snippet the cursor will still become visible when the
TextInput gains focus.
*/
-bool QmlGraphicsTextInput::isCursorVisible() const
+bool QDeclarativeTextInput::isCursorVisible() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->cursorVisible;
}
-void QmlGraphicsTextInput::setCursorVisible(bool on)
+void QDeclarativeTextInput::setCursorVisible(bool on)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if (d->cursorVisible == on)
return;
d->cursorVisible = on;
@@ -304,14 +304,14 @@ void QmlGraphicsTextInput::setCursorVisible(bool on)
\qmlproperty int TextInput::cursorPosition
The position of the cursor in the TextInput.
*/
-int QmlGraphicsTextInput::cursorPosition() const
+int QDeclarativeTextInput::cursorPosition() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->control->cursor();
}
-void QmlGraphicsTextInput::setCursorPosition(int cp)
+void QDeclarativeTextInput::setCursorPosition(int cp)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
d->control->moveCursor(cp);
}
@@ -321,9 +321,9 @@ void QmlGraphicsTextInput::setCursorPosition(int cp)
Returns a Rect which encompasses the cursor, but which may be larger than is
required. Ignores custom cursor delegates.
*/
-QRect QmlGraphicsTextInput::cursorRect() const
+QRect QDeclarativeTextInput::cursorRect() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->control->cursorRect();
}
@@ -340,15 +340,15 @@ QRect QmlGraphicsTextInput::cursorRect() const
\sa selectionEnd, cursorPosition, selectedText
*/
-int QmlGraphicsTextInput::selectionStart() const
+int QDeclarativeTextInput::selectionStart() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->lastSelectionStart;
}
-void QmlGraphicsTextInput::setSelectionStart(int s)
+void QDeclarativeTextInput::setSelectionStart(int s)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if(d->lastSelectionStart == s || s < 0 || s > text().length())
return;
d->lastSelectionStart = s;
@@ -368,15 +368,15 @@ void QmlGraphicsTextInput::setSelectionStart(int s)
\sa selectionStart, cursorPosition, selectedText
*/
-int QmlGraphicsTextInput::selectionEnd() const
+int QDeclarativeTextInput::selectionEnd() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->lastSelectionEnd;
}
-void QmlGraphicsTextInput::setSelectionEnd(int s)
+void QDeclarativeTextInput::setSelectionEnd(int s)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if(d->lastSelectionEnd == s || s < 0 || s > text().length())
return;
d->lastSelectionEnd = s;
@@ -397,9 +397,9 @@ void QmlGraphicsTextInput::setSelectionEnd(int s)
myTextInput.selectionEnd);
\endqml
*/
-QString QmlGraphicsTextInput::selectedText() const
+QString QDeclarativeTextInput::selectedText() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->control->selectedText();
}
@@ -409,15 +409,15 @@ QString QmlGraphicsTextInput::selectedText() const
Whether the TextInput should gain focus on a mouse press. By default this is
set to true.
*/
-bool QmlGraphicsTextInput::focusOnPress() const
+bool QDeclarativeTextInput::focusOnPress() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->focusOnPress;
}
-void QmlGraphicsTextInput::setFocusOnPress(bool b)
+void QDeclarativeTextInput::setFocusOnPress(bool b)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if (d->focusOnPress == b)
return;
@@ -455,16 +455,16 @@ void QmlGraphicsTextInput::setFocusOnPress(bool b)
\sa acceptableInput, inputMask
*/
-QValidator* QmlGraphicsTextInput::validator() const
+QValidator* QDeclarativeTextInput::validator() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
//###const cast isn't good, but needed for property system?
return const_cast<QValidator*>(d->control->validator());
}
-void QmlGraphicsTextInput::setValidator(QValidator* v)
+void QDeclarativeTextInput::setValidator(QValidator* v)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if (d->control->validator() == v)
return;
@@ -486,15 +486,15 @@ void QmlGraphicsTextInput::setValidator(QValidator* v)
\sa acceptableInput, validator
*/
-QString QmlGraphicsTextInput::inputMask() const
+QString QDeclarativeTextInput::inputMask() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->control->inputMask();
}
-void QmlGraphicsTextInput::setInputMask(const QString &im)
+void QDeclarativeTextInput::setInputMask(const QString &im)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if (d->control->inputMask() == im)
return;
@@ -510,9 +510,9 @@ void QmlGraphicsTextInput::setInputMask(const QString &im)
if the current text is acceptable to the validator or input mask as a final
string (not as an intermediate string).
*/
-bool QmlGraphicsTextInput::hasAcceptableInput() const
+bool QDeclarativeTextInput::hasAcceptableInput() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->control->hasAcceptableInput();
}
@@ -526,15 +526,15 @@ bool QmlGraphicsTextInput::hasAcceptableInput() const
current character as asterixes.
*/
-QmlGraphicsTextInput::EchoMode QmlGraphicsTextInput::echoMode() const
+QDeclarativeTextInput::EchoMode QDeclarativeTextInput::echoMode() const
{
- Q_D(const QmlGraphicsTextInput);
- return (QmlGraphicsTextInput::EchoMode)d->control->echoMode();
+ Q_D(const QDeclarativeTextInput);
+ return (QDeclarativeTextInput::EchoMode)d->control->echoMode();
}
-void QmlGraphicsTextInput::setEchoMode(QmlGraphicsTextInput::EchoMode echo)
+void QDeclarativeTextInput::setEchoMode(QDeclarativeTextInput::EchoMode echo)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if (echoMode() == echo)
return;
@@ -552,18 +552,18 @@ void QmlGraphicsTextInput::setEchoMode(QmlGraphicsTextInput::EchoMode echo)
needed, and the x property of delegate instance will be set so as
to be one pixel before the top left of the current character.
- Note that the root item of the delegate component must be a QmlGraphicsItem or
- QmlGraphicsItem derived item.
+ Note that the root item of the delegate component must be a QDeclarativeItem or
+ QDeclarativeItem derived item.
*/
-QmlComponent* QmlGraphicsTextInput::cursorDelegate() const
+QDeclarativeComponent* QDeclarativeTextInput::cursorDelegate() const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->cursorComponent;
}
-void QmlGraphicsTextInput::setCursorDelegate(QmlComponent* c)
+void QDeclarativeTextInput::setCursorDelegate(QDeclarativeComponent* c)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if (d->cursorComponent == c)
return;
@@ -580,9 +580,9 @@ void QmlGraphicsTextInput::setCursorDelegate(QmlComponent* c)
emit cursorDelegateChanged();
}
-void QmlGraphicsTextInputPrivate::startCreatingCursor()
+void QDeclarativeTextInputPrivate::startCreatingCursor()
{
- Q_Q(QmlGraphicsTextInput);
+ Q_Q(QDeclarativeTextInput);
q->connect(control, SIGNAL(cursorPositionChanged(int, int)),
q, SLOT(moveCursor()));
if(cursorComponent->isReady()){
@@ -591,14 +591,14 @@ void QmlGraphicsTextInputPrivate::startCreatingCursor()
q->connect(cursorComponent, SIGNAL(statusChanged(int)),
q, SLOT(createCursor()));
}else{//isError
- qmlInfo(q) << QmlGraphicsTextInput::tr("Could not load cursor delegate");
+ qmlInfo(q) << QDeclarativeTextInput::tr("Could not load cursor delegate");
qWarning() << cursorComponent->errors();
}
}
-void QmlGraphicsTextInput::createCursor()
+void QDeclarativeTextInput::createCursor()
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if(d->cursorComponent->isError()){
qmlInfo(this) << tr("Could not load cursor delegate");
qWarning() << d->cursorComponent->errors();
@@ -610,7 +610,7 @@ void QmlGraphicsTextInput::createCursor()
if(d->cursorItem)
delete d->cursorItem;
- d->cursorItem = qobject_cast<QmlGraphicsItem*>(d->cursorComponent->create());
+ d->cursorItem = qobject_cast<QDeclarativeItem*>(d->cursorComponent->create());
if(!d->cursorItem){
qmlInfo(this) << tr("Could not instantiate cursor delegate");
//The failed instantiation should print its own error messages
@@ -622,31 +622,31 @@ void QmlGraphicsTextInput::createCursor()
d->cursorItem->setHeight(d->control->height());
}
-void QmlGraphicsTextInput::moveCursor()
+void QDeclarativeTextInput::moveCursor()
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if(!d->cursorItem)
return;
d->cursorItem->setX(d->control->cursorToX() - d->hscroll);
}
-int QmlGraphicsTextInput::xToPos(int x)
+int QDeclarativeTextInput::xToPos(int x)
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
return d->control->xToPos(x - d->hscroll);
}
-void QmlGraphicsTextInput::focusChanged(bool hasFocus)
+void QDeclarativeTextInput::focusChanged(bool hasFocus)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
d->focused = hasFocus;
setCursorVisible(hasFocus);
- QmlGraphicsItem::focusChanged(hasFocus);
+ QDeclarativeItem::focusChanged(hasFocus);
}
-void QmlGraphicsTextInput::keyPressEvent(QKeyEvent* ev)
+void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if(((d->control->cursor() == 0 && ev->key() == Qt::Key_Left)
|| (d->control->cursor() == d->control->text().length()
&& ev->key() == Qt::Key_Right))
@@ -658,12 +658,12 @@ void QmlGraphicsTextInput::keyPressEvent(QKeyEvent* ev)
d->control->processKeyEvent(ev);
}
if (!ev->isAccepted())
- QmlGraphicsPaintedItem::keyPressEvent(ev);
+ QDeclarativePaintedItem::keyPressEvent(ev);
}
-void QmlGraphicsTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
if(d->focusOnPress){
QGraphicsItem *p = parentItem();//###Is there a better way to find my focus scope?
while(p) {
@@ -682,18 +682,18 @@ void QmlGraphicsTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event)
\overload
Handles the given mouse \a event.
*/
-void QmlGraphicsTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
QWidget *widget = event->widget();
if (widget && !d->control->isReadOnly() && boundingRect().contains(event->pos()))
qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), d->focusOnPress);
d->control->processEvent(event);
}
-bool QmlGraphicsTextInput::event(QEvent* ev)
+bool QDeclarativeTextInput::event(QEvent* ev)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
//Anything we don't deal with ourselves, pass to the control
bool handled = false;
switch(ev->type()){
@@ -706,21 +706,21 @@ bool QmlGraphicsTextInput::event(QEvent* ev)
handled = d->control->processEvent(ev);
}
if(!handled)
- return QmlGraphicsPaintedItem::event(ev);
+ return QDeclarativePaintedItem::event(ev);
return true;
}
-void QmlGraphicsTextInput::geometryChanged(const QRectF &newGeometry,
+void QDeclarativeTextInput::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
if (newGeometry.width() != oldGeometry.width())
updateSize();
- QmlGraphicsPaintedItem::geometryChanged(newGeometry, oldGeometry);
+ QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry);
}
-void QmlGraphicsTextInput::drawContents(QPainter *p, const QRect &r)
+void QDeclarativeTextInput::drawContents(QPainter *p, const QRect &r)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
p->setRenderHint(QPainter::TextAntialiasing, true);
p->save();
p->setPen(QPen(d->color));
@@ -757,9 +757,9 @@ void QmlGraphicsTextInput::drawContents(QPainter *p, const QRect &r)
\overload
Returns the value of the given \a property.
*/
-QVariant QmlGraphicsTextInput::inputMethodQuery(Qt::InputMethodQuery property) const
+QVariant QDeclarativeTextInput::inputMethodQuery(Qt::InputMethodQuery property) const
{
- Q_D(const QmlGraphicsTextInput);
+ Q_D(const QDeclarativeTextInput);
switch(property) {
case Qt::ImFont:
return font();
@@ -783,9 +783,9 @@ QVariant QmlGraphicsTextInput::inputMethodQuery(Qt::InputMethodQuery property) c
}
}
-void QmlGraphicsTextInput::selectAll()
+void QDeclarativeTextInput::selectAll()
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
d->control->setSelection(0, d->control->text().length());
}
@@ -803,9 +803,9 @@ void QmlGraphicsTextInput::selectAll()
filtering at the beginning of the animation and reenable it at the conclusion.
*/
-void QmlGraphicsTextInputPrivate::init()
+void QDeclarativeTextInputPrivate::init()
{
- Q_Q(QmlGraphicsTextInput);
+ Q_Q(QDeclarativeTextInput);
control->setCursorWidth(1);
control->setPasswordCharacter(QLatin1Char('*'));
control->setLayoutDirection(Qt::LeftToRight);
@@ -834,9 +834,9 @@ void QmlGraphicsTextInputPrivate::init()
lastSelectionEnd = 0;
}
-void QmlGraphicsTextInput::cursorPosChanged()
+void QDeclarativeTextInput::cursorPosChanged()
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
emit cursorPositionChanged();
if(!d->control->hasSelectedText()){
@@ -851,9 +851,9 @@ void QmlGraphicsTextInput::cursorPosChanged()
}
}
-void QmlGraphicsTextInput::selectionChanged()
+void QDeclarativeTextInput::selectionChanged()
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
emit selectedTextChanged();
if(d->lastSelectionStart != d->control->selectionStart()){
@@ -870,9 +870,9 @@ void QmlGraphicsTextInput::selectionChanged()
}
}
-void QmlGraphicsTextInput::q_textChanged()
+void QDeclarativeTextInput::q_textChanged()
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
updateSize();
emit textChanged();
if(hasAcceptableInput() != d->oldValidity){
@@ -881,7 +881,7 @@ void QmlGraphicsTextInput::q_textChanged()
}
}
-void QmlGraphicsTextInput::updateRect(const QRect &r)
+void QDeclarativeTextInput::updateRect(const QRect &r)
{
if(r == QRect())
clearCache();
@@ -890,9 +890,9 @@ void QmlGraphicsTextInput::updateRect(const QRect &r)
update();
}
-void QmlGraphicsTextInput::updateSize(bool needsRedraw)
+void QDeclarativeTextInput::updateSize(bool needsRedraw)
{
- Q_D(QmlGraphicsTextInput);
+ Q_D(QDeclarativeTextInput);
int w = width();
int h = height();
setImplicitHeight(d->control->height());
diff --git a/src/declarative/graphicsitems/qmlgraphicstextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h
index 2b37b78..f690ae2 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextinput_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSTEXTINPUT_H
-#define QMLGRAPHICSTEXTINPUT_H
+#ifndef QDECLARATIVETEXTINPUT_H
+#define QDECLARATIVETEXTINPUT_H
-#include "qmlgraphicstext_p.h"
-#include "qmlgraphicspainteditem_p.h"
+#include "qdeclarativetext_p.h"
+#include "qdeclarativepainteditem_p.h"
#include <QGraphicsSceneMouseEvent>
#include <QIntValidator>
@@ -54,9 +54,9 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsTextInputPrivate;
+class QDeclarativeTextInputPrivate;
class QValidator;
-class Q_DECLARATIVE_EXPORT QmlGraphicsTextInput : public QmlGraphicsPaintedItem
+class Q_DECLARATIVE_EXPORT QDeclarativeTextInput : public QDeclarativePaintedItem
{
Q_OBJECT
Q_ENUMS(HAlignment)
@@ -73,7 +73,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsTextInput : public QmlGraphicsPaintedItem
Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged)
Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged)
Q_PROPERTY(QRect cursorRect READ cursorRect NOTIFY cursorPositionChanged)
- Q_PROPERTY(QmlComponent *cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged)
+ Q_PROPERTY(QDeclarativeComponent *cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged)
Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged)
Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged)
Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged)
@@ -88,8 +88,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsTextInput : public QmlGraphicsPaintedItem
Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress NOTIFY focusOnPressChanged)
public:
- QmlGraphicsTextInput(QmlGraphicsItem* parent=0);
- ~QmlGraphicsTextInput();
+ QDeclarativeTextInput(QDeclarativeItem* parent=0);
+ ~QDeclarativeTextInput();
enum EchoMode {//To match QLineEdit::EchoMode
Normal,
@@ -157,8 +157,8 @@ public:
EchoMode echoMode() const;
void setEchoMode(EchoMode echo);
- QmlComponent* cursorDelegate() const;
- void setCursorDelegate(QmlComponent*);
+ QDeclarativeComponent* cursorDelegate() const;
+ void setCursorDelegate(QDeclarativeComponent*);
bool focusOnPress() const;
void setFocusOnPress(bool);
@@ -214,12 +214,12 @@ private Q_SLOTS:
void updateRect(const QRect &r = QRect());
private:
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsTextInput)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeTextInput)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsTextInput)
+QML_DECLARE_TYPE(QDeclarativeTextInput)
QML_DECLARE_TYPE(QValidator)
QML_DECLARE_TYPE(QIntValidator)
#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0))
@@ -229,4 +229,4 @@ QML_DECLARE_TYPE(QRegExpValidator)
QT_END_HEADER
-#endif // QMLGRAPHICSTEXTINPUT_H
+#endif // QDECLARATIVETEXTINPUT_H
diff --git a/src/declarative/graphicsitems/qmlgraphicstextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
index 694ec93..3d28f40 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextinput_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
@@ -39,14 +39,14 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSTEXTINPUT_P_H
-#define QMLGRAPHICSTEXTINPUT_P_H
+#ifndef QDECLARATIVETEXTINPUT_P_H
+#define QDECLARATIVETEXTINPUT_P_H
-#include "qmlgraphicstextinput_p.h"
+#include "qdeclarativetextinput_p.h"
-#include "qmlgraphicspainteditem_p_p.h"
+#include "qdeclarativepainteditem_p_p.h"
-#include <qml.h>
+#include <qdeclarative.h>
#include <QPointer>
@@ -64,19 +64,19 @@
QT_BEGIN_NAMESPACE
-class QmlGraphicsTextInputPrivate : public QmlGraphicsPaintedItemPrivate
+class QDeclarativeTextInputPrivate : public QDeclarativePaintedItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsTextInput)
+ Q_DECLARE_PUBLIC(QDeclarativeTextInput)
public:
- QmlGraphicsTextInputPrivate() : control(new QLineControl(QString())),
- color((QRgb)0), style(QmlGraphicsText::Normal),
- styleColor((QRgb)0), hAlign(QmlGraphicsTextInput::AlignLeft),
+ QDeclarativeTextInputPrivate() : control(new QLineControl(QString())),
+ color((QRgb)0), style(QDeclarativeText::Normal),
+ styleColor((QRgb)0), hAlign(QDeclarativeTextInput::AlignLeft),
hscroll(0), oldScroll(0), focused(false), focusOnPress(true),
cursorVisible(false)
{
}
- ~QmlGraphicsTextInputPrivate()
+ ~QDeclarativeTextInputPrivate()
{
delete control;
}
@@ -90,11 +90,11 @@ public:
QColor color;
QColor selectionColor;
QColor selectedTextColor;
- QmlGraphicsText::TextStyle style;
+ QDeclarativeText::TextStyle style;
QColor styleColor;
- QmlGraphicsTextInput::HAlignment hAlign;
- QPointer<QmlComponent> cursorComponent;
- QPointer<QmlGraphicsItem> cursorItem;
+ QDeclarativeTextInput::HAlignment hAlign;
+ QPointer<QDeclarativeComponent> cursorComponent;
+ QPointer<QDeclarativeItem> cursorItem;
int lastSelectionStart;
int lastSelectionEnd;
diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index 1928195..2402648 100644
--- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -39,20 +39,20 @@
**
****************************************************************************/
-#include "qmlgraphicsvisualitemmodel_p.h"
+#include "qdeclarativevisualitemmodel_p.h"
-#include "qmlgraphicsitem.h"
+#include "qdeclarativeitem.h"
-#include <qmlcontext.h>
-#include <qmlengine.h>
-#include <qmlexpression.h>
-#include <qmlpackage_p.h>
-#include <qmlopenmetaobject_p.h>
-#include <qmllistaccessor_p.h>
-#include <qmlinfo.h>
-#include <qmldeclarativedata_p.h>
-#include <qmlpropertycache_p.h>
-#include <qmlguard_p.h>
+#include <qdeclarativecontext.h>
+#include <qdeclarativeengine.h>
+#include <qdeclarativeexpression.h>
+#include <qdeclarativepackage_p.h>
+#include <qdeclarativeopenmetaobject_p.h>
+#include <qdeclarativelistaccessor_p.h>
+#include <qdeclarativeinfo.h>
+#include <qdeclarativedeclarativedata_p.h>
+#include <qdeclarativepropertycache_p.h>
+#include <qdeclarativeguard_p.h>
#include <qlistmodelinterface_p.h>
#include <qhash.h>
@@ -64,41 +64,41 @@
QT_BEGIN_NAMESPACE
-QHash<QObject*, QmlGraphicsVisualItemModelAttached*> QmlGraphicsVisualItemModelAttached::attachedProperties;
+QHash<QObject*, QDeclarativeVisualItemModelAttached*> QDeclarativeVisualItemModelAttached::attachedProperties;
-class QmlGraphicsVisualItemModelPrivate : public QObjectPrivate
+class QDeclarativeVisualItemModelPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsVisualItemModel)
+ Q_DECLARE_PUBLIC(QDeclarativeVisualItemModel)
public:
- QmlGraphicsVisualItemModelPrivate() : QObjectPrivate() {}
+ QDeclarativeVisualItemModelPrivate() : QObjectPrivate() {}
- static void children_append(QmlListProperty<QmlGraphicsItem> *prop, QmlGraphicsItem *item) {
+ static void children_append(QDeclarativeListProperty<QDeclarativeItem> *prop, QDeclarativeItem *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();
+ static_cast<QDeclarativeVisualItemModelPrivate *>(prop->data)->children.append(item);
+ static_cast<QDeclarativeVisualItemModelPrivate *>(prop->data)->itemAppended();
+ static_cast<QDeclarativeVisualItemModelPrivate *>(prop->data)->emitChildrenChanged();
}
void itemAppended() {
- Q_Q(QmlGraphicsVisualItemModel);
- QmlGraphicsVisualItemModelAttached *attached = QmlGraphicsVisualItemModelAttached::properties(children.last());
+ Q_Q(QDeclarativeVisualItemModel);
+ QDeclarativeVisualItemModelAttached *attached = QDeclarativeVisualItemModelAttached::properties(children.last());
attached->setIndex(children.count()-1);
emit q->itemsInserted(children.count()-1, 1);
emit q->countChanged();
}
void emitChildrenChanged() {
- Q_Q(QmlGraphicsVisualItemModel);
+ Q_Q(QDeclarativeVisualItemModel);
emit q->childrenChanged();
}
- QList<QmlGraphicsItem *> children;
+ QList<QDeclarativeItem *> children;
};
/*!
- \qmlclass VisualItemModel QmlGraphicsVisualItemModel
+ \qmlclass VisualItemModel QDeclarativeVisualItemModel
\since 4.7
\brief The VisualItemModel allows items to be provided to a view.
@@ -127,15 +127,15 @@ public:
}
\endcode
*/
-QmlGraphicsVisualItemModel::QmlGraphicsVisualItemModel()
- : QmlGraphicsVisualModel(*(new QmlGraphicsVisualItemModelPrivate))
+QDeclarativeVisualItemModel::QDeclarativeVisualItemModel()
+ : QDeclarativeVisualModel(*(new QDeclarativeVisualItemModelPrivate))
{
}
-QmlListProperty<QmlGraphicsItem> QmlGraphicsVisualItemModel::children()
+QDeclarativeListProperty<QDeclarativeItem> QDeclarativeVisualItemModel::children()
{
- Q_D(QmlGraphicsVisualItemModel);
- return QmlListProperty<QmlGraphicsItem>(this, d, QmlGraphicsVisualItemModelPrivate::children_append);
+ Q_D(QDeclarativeVisualItemModel);
+ return QDeclarativeListProperty<QDeclarativeItem>(this, d, QDeclarativeVisualItemModelPrivate::children_append);
}
/*!
@@ -143,98 +143,97 @@ QmlListProperty<QmlGraphicsItem> QmlGraphicsVisualItemModel::children()
The number of items in the model. This property is readonly.
*/
-int QmlGraphicsVisualItemModel::count() const
+int QDeclarativeVisualItemModel::count() const
{
- Q_D(const QmlGraphicsVisualItemModel);
+ Q_D(const QDeclarativeVisualItemModel);
return d->children.count();
}
-bool QmlGraphicsVisualItemModel::isValid() const
+bool QDeclarativeVisualItemModel::isValid() const
{
return true;
}
-QmlGraphicsItem *QmlGraphicsVisualItemModel::item(int index, bool)
+QDeclarativeItem *QDeclarativeVisualItemModel::item(int index, bool)
{
- Q_D(QmlGraphicsVisualItemModel);
+ Q_D(QDeclarativeVisualItemModel);
return d->children.at(index);
}
-QmlGraphicsVisualModel::ReleaseFlags QmlGraphicsVisualItemModel::release(QmlGraphicsItem *)
+QDeclarativeVisualModel::ReleaseFlags QDeclarativeVisualItemModel::release(QDeclarativeItem *)
{
// Nothing to do
return 0;
}
-void QmlGraphicsVisualItemModel::completeItem()
+void QDeclarativeVisualItemModel::completeItem()
{
// Nothing to do
}
-QString QmlGraphicsVisualItemModel::stringValue(int index, const QString &name)
+QString QDeclarativeVisualItemModel::stringValue(int index, const QString &name)
{
- Q_D(QmlGraphicsVisualItemModel);
+ Q_D(QDeclarativeVisualItemModel);
if (index < 0 || index >= d->children.count())
return QString();
- return QmlEngine::contextForObject(d->children.at(index))->contextProperty(name).toString();
+ return QDeclarativeEngine::contextForObject(d->children.at(index))->contextProperty(name).toString();
}
-QVariant QmlGraphicsVisualItemModel::evaluate(int index, const QString &expression, QObject *objectContext)
+QVariant QDeclarativeVisualItemModel::evaluate(int index, const QString &expression, QObject *objectContext)
{
- Q_D(QmlGraphicsVisualItemModel);
+ Q_D(QDeclarativeVisualItemModel);
if (index < 0 || index >= d->children.count())
return QVariant();
- QmlContext *ccontext = qmlContext(this);
- QmlContext *ctxt = new QmlContext(ccontext);
+ QDeclarativeContext *ccontext = qmlContext(this);
+ QDeclarativeContext *ctxt = new QDeclarativeContext(ccontext);
ctxt->addDefaultObject(d->children.at(index));
- QmlExpression e(ctxt, expression, objectContext);
- e.setTrackChange(false);
+ QDeclarativeExpression e(ctxt, expression, objectContext);
QVariant value = e.value();
delete ctxt;
return value;
}
-int QmlGraphicsVisualItemModel::indexOf(QmlGraphicsItem *item, QObject *) const
+int QDeclarativeVisualItemModel::indexOf(QDeclarativeItem *item, QObject *) const
{
- Q_D(const QmlGraphicsVisualItemModel);
+ Q_D(const QDeclarativeVisualItemModel);
return d->children.indexOf(item);
}
-QmlGraphicsVisualItemModelAttached *QmlGraphicsVisualItemModel::qmlAttachedProperties(QObject *obj)
+QDeclarativeVisualItemModelAttached *QDeclarativeVisualItemModel::qmlAttachedProperties(QObject *obj)
{
- return QmlGraphicsVisualItemModelAttached::properties(obj);
+ return QDeclarativeVisualItemModelAttached::properties(obj);
}
//============================================================================
-class VDMDelegateDataType : public QmlOpenMetaObjectType
+class VDMDelegateDataType : public QDeclarativeOpenMetaObjectType
{
public:
- VDMDelegateDataType(const QMetaObject *base, QmlEngine *engine) : QmlOpenMetaObjectType(base, engine) {}
+ VDMDelegateDataType(const QMetaObject *base, QDeclarativeEngine *engine) : QDeclarativeOpenMetaObjectType(base, engine) {}
void propertyCreated(int, QMetaPropertyBuilder &prop) {
prop.setWritable(false);
}
};
-class QmlGraphicsVisualDataModelParts;
-class QmlGraphicsVisualDataModelData;
-class QmlGraphicsVisualDataModelPrivate : public QObjectPrivate
+class QDeclarativeVisualDataModelParts;
+class QDeclarativeVisualDataModelData;
+class QDeclarativeVisualDataModelPrivate : public QObjectPrivate
{
public:
- QmlGraphicsVisualDataModelPrivate(QmlContext *);
+ QDeclarativeVisualDataModelPrivate(QDeclarativeContext *);
- static QmlGraphicsVisualDataModelPrivate *get(QmlGraphicsVisualDataModel *m) {
- return static_cast<QmlGraphicsVisualDataModelPrivate *>(QObjectPrivate::get(m));
+ static QDeclarativeVisualDataModelPrivate *get(QDeclarativeVisualDataModel *m) {
+ return static_cast<QDeclarativeVisualDataModelPrivate *>(QObjectPrivate::get(m));
}
- QmlGuard<QListModelInterface> m_listModelInterface;
- QmlGuard<QAbstractItemModel> m_abstractItemModel;
- QmlGuard<QmlGraphicsVisualDataModel> m_visualItemModel;
+ QDeclarativeGuard<QListModelInterface> m_listModelInterface;
+ QDeclarativeGuard<QAbstractItemModel> m_abstractItemModel;
+ QDeclarativeGuard<QDeclarativeVisualDataModel> m_visualItemModel;
QString m_part;
- QmlComponent *m_delegate;
- QmlContext *m_context;
+ QDeclarativeComponent *m_delegate;
+ QDeclarativeContext *m_context;
QList<int> m_roles;
QHash<QByteArray,int> m_roleNames;
void ensureRoles() {
@@ -255,7 +254,7 @@ public:
m_roleNames.insert("modelData", m_roles.at(0));
} else if (m_listAccessor) {
m_roleNames.insert("modelData", 0);
- if (m_listAccessor->type() == QmlListAccessor::Instance) {
+ if (m_listAccessor->type() == QDeclarativeListAccessor::Instance) {
if (QObject *object = m_listAccessor->at(0).value<QObject*>()) {
int count = object->metaObject()->propertyCount();
for (int ii = 1; ii < count; ++ii) {
@@ -328,49 +327,51 @@ public:
if (m_listModelInterface)
return m_listModelInterface->count();
if (m_abstractItemModel)
- return m_abstractItemModel->rowCount();
+ return m_abstractItemModel->rowCount(m_root);
if (m_listAccessor)
return m_listAccessor->count();
return 0;
}
Cache m_cache;
- QHash<QObject *, QmlPackage*> m_packaged;
+ QHash<QObject *, QDeclarativePackage*> m_packaged;
- QmlGraphicsVisualDataModelParts *m_parts;
- friend class QmlGraphicsVisualItemParts;
+ QDeclarativeVisualDataModelParts *m_parts;
+ friend class QDeclarativeVisualItemParts;
VDMDelegateDataType *m_delegateDataType;
- friend class QmlGraphicsVisualDataModelData;
+ friend class QDeclarativeVisualDataModelData;
bool m_metaDataCreated;
bool m_metaDataCacheable;
- QmlGraphicsVisualDataModelData *data(QObject *item);
+ QDeclarativeVisualDataModelData *data(QObject *item);
QVariant m_modelVariant;
- QmlListAccessor *m_listAccessor;
+ QDeclarativeListAccessor *m_listAccessor;
+
+ QModelIndex m_root;
};
-class QmlGraphicsVisualDataModelDataMetaObject : public QmlOpenMetaObject
+class QDeclarativeVisualDataModelDataMetaObject : public QDeclarativeOpenMetaObject
{
public:
- QmlGraphicsVisualDataModelDataMetaObject(QObject *parent, QmlOpenMetaObjectType *type)
- : QmlOpenMetaObject(parent, type) {}
+ QDeclarativeVisualDataModelDataMetaObject(QObject *parent, QDeclarativeOpenMetaObjectType *type)
+ : QDeclarativeOpenMetaObject(parent, type) {}
virtual QVariant initialValue(int);
virtual int createProperty(const char *, const char *);
private:
- friend class QmlGraphicsVisualDataModelData;
+ friend class QDeclarativeVisualDataModelData;
QHash<int,int> roleToProp;
};
-class QmlGraphicsVisualDataModelData : public QObject
+class QDeclarativeVisualDataModelData : public QObject
{
Q_OBJECT
public:
- QmlGraphicsVisualDataModelData(int index, QmlGraphicsVisualDataModel *model);
- ~QmlGraphicsVisualDataModelData();
+ QDeclarativeVisualDataModelData(int index, QDeclarativeVisualDataModel *model);
+ ~QDeclarativeVisualDataModelData();
Q_PROPERTY(int index READ index NOTIFY indexChanged)
int index() const;
@@ -383,13 +384,13 @@ Q_SIGNALS:
void indexChanged();
private:
- friend class QmlGraphicsVisualDataModelDataMetaObject;
+ friend class QDeclarativeVisualDataModelDataMetaObject;
int m_index;
- QmlGuard<QmlGraphicsVisualDataModel> m_model;
- QmlGraphicsVisualDataModelDataMetaObject *m_meta;
+ QDeclarativeGuard<QDeclarativeVisualDataModel> m_model;
+ QDeclarativeVisualDataModelDataMetaObject *m_meta;
};
-int QmlGraphicsVisualDataModelData::propForRole(int id) const
+int QDeclarativeVisualDataModelData::propForRole(int id) const
{
QHash<int,int>::const_iterator it = m_meta->roleToProp.find(id);
if (it != m_meta->roleToProp.end())
@@ -397,44 +398,44 @@ int QmlGraphicsVisualDataModelData::propForRole(int id) const
return -1;
}
-void QmlGraphicsVisualDataModelData::setValue(int id, const QVariant &val)
+void QDeclarativeVisualDataModelData::setValue(int id, const QVariant &val)
{
m_meta->setValue(id, val);
}
-int QmlGraphicsVisualDataModelDataMetaObject::createProperty(const char *name, const char *type)
+int QDeclarativeVisualDataModelDataMetaObject::createProperty(const char *name, const char *type)
{
- QmlGraphicsVisualDataModelData *data =
- static_cast<QmlGraphicsVisualDataModelData *>(object());
+ QDeclarativeVisualDataModelData *data =
+ static_cast<QDeclarativeVisualDataModelData *>(object());
if (!data->m_model)
return -1;
- QmlGraphicsVisualDataModelPrivate *model = QmlGraphicsVisualDataModelPrivate::get(data->m_model);
+ QDeclarativeVisualDataModelPrivate *model = QDeclarativeVisualDataModelPrivate::get(data->m_model);
if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) {
- if (model->m_listAccessor->type() == QmlListAccessor::ListProperty) {
+ if (model->m_listAccessor->type() == QDeclarativeListAccessor::ListProperty) {
model->ensureRoles();
QObject *object = model->m_listAccessor->at(data->m_index).value<QObject*>();
- if (object && object->property(name).isValid())
- return QmlOpenMetaObject::createProperty(name, type);
+ if (object && (object->property(name).isValid() || qstrcmp(name,"modelData")==0))
+ return QDeclarativeOpenMetaObject::createProperty(name, type);
}
}
return -1;
}
-QVariant QmlGraphicsVisualDataModelDataMetaObject::initialValue(int propId)
+QVariant QDeclarativeVisualDataModelDataMetaObject::initialValue(int propId)
{
- QmlGraphicsVisualDataModelData *data =
- static_cast<QmlGraphicsVisualDataModelData *>(object());
+ QDeclarativeVisualDataModelData *data =
+ static_cast<QDeclarativeVisualDataModelData *>(object());
Q_ASSERT(data->m_model);
- QmlGraphicsVisualDataModelPrivate *model = QmlGraphicsVisualDataModelPrivate::get(data->m_model);
+ QDeclarativeVisualDataModelPrivate *model = QDeclarativeVisualDataModelPrivate::get(data->m_model);
QByteArray propName = name(propId);
if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) {
if (propName == "modelData") {
- if (model->m_listAccessor->type() == QmlListAccessor::Instance) {
+ if (model->m_listAccessor->type() == QDeclarativeListAccessor::Instance) {
QObject *object = model->m_listAccessor->at(0).value<QObject*>();
return object->metaObject()->property(1).read(object); // the first property after objectName
}
@@ -462,7 +463,7 @@ QVariant QmlGraphicsVisualDataModelDataMetaObject::initialValue(int propId)
QHash<QByteArray,int>::const_iterator it = model->m_roleNames.find(propName);
if (it != model->m_roleNames.end()) {
roleToProp.insert(*it, propId);
- QModelIndex index = model->m_abstractItemModel->index(data->m_index, 0);
+ QModelIndex index = model->m_abstractItemModel->index(data->m_index, 0, model->m_root);
return model->m_abstractItemModel->data(index, *it);
}
}
@@ -470,12 +471,12 @@ QVariant QmlGraphicsVisualDataModelDataMetaObject::initialValue(int propId)
return QVariant();
}
-QmlGraphicsVisualDataModelData::QmlGraphicsVisualDataModelData(int index,
- QmlGraphicsVisualDataModel *model)
+QDeclarativeVisualDataModelData::QDeclarativeVisualDataModelData(int index,
+ QDeclarativeVisualDataModel *model)
: m_index(index), m_model(model),
-m_meta(new QmlGraphicsVisualDataModelDataMetaObject(this, QmlGraphicsVisualDataModelPrivate::get(model)->m_delegateDataType))
+m_meta(new QDeclarativeVisualDataModelDataMetaObject(this, QDeclarativeVisualDataModelPrivate::get(model)->m_delegateDataType))
{
- QmlGraphicsVisualDataModelPrivate *modelPriv = QmlGraphicsVisualDataModelPrivate::get(model);
+ QDeclarativeVisualDataModelPrivate *modelPriv = QDeclarativeVisualDataModelPrivate::get(model);
if (modelPriv->m_metaDataCacheable) {
if (!modelPriv->m_metaDataCreated)
modelPriv->createMetaData();
@@ -483,17 +484,17 @@ m_meta(new QmlGraphicsVisualDataModelDataMetaObject(this, QmlGraphicsVisualDataM
}
}
-QmlGraphicsVisualDataModelData::~QmlGraphicsVisualDataModelData()
+QDeclarativeVisualDataModelData::~QDeclarativeVisualDataModelData()
{
}
-int QmlGraphicsVisualDataModelData::index() const
+int QDeclarativeVisualDataModelData::index() const
{
return m_index;
}
// This is internal only - it should not be set from qml
-void QmlGraphicsVisualDataModelData::setIndex(int index)
+void QDeclarativeVisualDataModelData::setIndex(int index)
{
m_index = index;
emit indexChanged();
@@ -501,94 +502,141 @@ void QmlGraphicsVisualDataModelData::setIndex(int index)
//---------------------------------------------------------------------------
-class QmlGraphicsVisualDataModelPartsMetaObject : public QmlOpenMetaObject
+class QDeclarativeVisualDataModelPartsMetaObject : public QDeclarativeOpenMetaObject
{
public:
- QmlGraphicsVisualDataModelPartsMetaObject(QObject *parent)
- : QmlOpenMetaObject(parent) {}
+ QDeclarativeVisualDataModelPartsMetaObject(QObject *parent)
+ : QDeclarativeOpenMetaObject(parent) {}
virtual void propertyCreated(int, QMetaPropertyBuilder &);
virtual QVariant initialValue(int);
};
-class QmlGraphicsVisualDataModelParts : public QObject
+class QDeclarativeVisualDataModelParts : public QObject
{
Q_OBJECT
public:
- QmlGraphicsVisualDataModelParts(QmlGraphicsVisualDataModel *parent);
+ QDeclarativeVisualDataModelParts(QDeclarativeVisualDataModel *parent);
private:
- friend class QmlGraphicsVisualDataModelPartsMetaObject;
- QmlGraphicsVisualDataModel *model;
+ friend class QDeclarativeVisualDataModelPartsMetaObject;
+ QDeclarativeVisualDataModel *model;
};
-void QmlGraphicsVisualDataModelPartsMetaObject::propertyCreated(int, QMetaPropertyBuilder &prop)
+void QDeclarativeVisualDataModelPartsMetaObject::propertyCreated(int, QMetaPropertyBuilder &prop)
{
prop.setWritable(false);
}
-QVariant QmlGraphicsVisualDataModelPartsMetaObject::initialValue(int id)
+QVariant QDeclarativeVisualDataModelPartsMetaObject::initialValue(int id)
{
- QmlGraphicsVisualDataModel *m = new QmlGraphicsVisualDataModel;
+ QDeclarativeVisualDataModel *m = new QDeclarativeVisualDataModel;
m->setParent(object());
m->setPart(QString::fromUtf8(name(id)));
- m->setModel(QVariant::fromValue(static_cast<QmlGraphicsVisualDataModelParts *>(object())->model));
+ m->setModel(QVariant::fromValue(static_cast<QDeclarativeVisualDataModelParts *>(object())->model));
QVariant var = QVariant::fromValue((QObject *)m);
return var;
}
-QmlGraphicsVisualDataModelParts::QmlGraphicsVisualDataModelParts(QmlGraphicsVisualDataModel *parent)
+QDeclarativeVisualDataModelParts::QDeclarativeVisualDataModelParts(QDeclarativeVisualDataModel *parent)
: QObject(parent), model(parent)
{
- new QmlGraphicsVisualDataModelPartsMetaObject(this);
+ new QDeclarativeVisualDataModelPartsMetaObject(this);
}
-QmlGraphicsVisualDataModelPrivate::QmlGraphicsVisualDataModelPrivate(QmlContext *ctxt)
+QDeclarativeVisualDataModelPrivate::QDeclarativeVisualDataModelPrivate(QDeclarativeContext *ctxt)
: m_listModelInterface(0), m_abstractItemModel(0), m_visualItemModel(0), m_delegate(0)
, m_context(ctxt), m_parts(0), m_delegateDataType(0), m_metaDataCreated(false)
, m_metaDataCacheable(false), m_listAccessor(0)
{
}
-QmlGraphicsVisualDataModelData *QmlGraphicsVisualDataModelPrivate::data(QObject *item)
+QDeclarativeVisualDataModelData *QDeclarativeVisualDataModelPrivate::data(QObject *item)
{
- QmlGraphicsVisualDataModelData *dataItem =
- item->findChild<QmlGraphicsVisualDataModelData *>();
+ QDeclarativeVisualDataModelData *dataItem =
+ item->findChild<QDeclarativeVisualDataModelData *>();
Q_ASSERT(dataItem);
return dataItem;
}
//---------------------------------------------------------------------------
-QmlGraphicsVisualDataModel::QmlGraphicsVisualDataModel()
-: QmlGraphicsVisualModel(*(new QmlGraphicsVisualDataModelPrivate(0)))
+/*!
+ \qmlclass VisualDataModel QDeclarativeVisualDataModel
+ \brief The VisualDataModel encapsulates a model and delegate
+
+ A VisualDataModel encapsulates a model and the delegate that will
+ be instantiated for items in the model.
+
+ It is usually not necessary to create a VisualDataModel directly,
+ since the QML views will create one internally.
+
+ The example below illustrates using a VisualDataModel with a ListView.
+
+ \code
+ VisualDataModel {
+ id: visualModel
+ model: myModel
+ delegate: Component {
+ Rectangle {
+ height: 25
+ width: 100
+ Text { text: "Name:" + name}
+ }
+ }
+ }
+ ListView {
+ width: 100
+ height: 100
+ anchors.fill: parent
+ model: visualModel
+ }
+ \endcode
+*/
+
+QDeclarativeVisualDataModel::QDeclarativeVisualDataModel()
+: QDeclarativeVisualModel(*(new QDeclarativeVisualDataModelPrivate(0)))
{
}
-QmlGraphicsVisualDataModel::QmlGraphicsVisualDataModel(QmlContext *ctxt)
-: QmlGraphicsVisualModel(*(new QmlGraphicsVisualDataModelPrivate(ctxt)))
+QDeclarativeVisualDataModel::QDeclarativeVisualDataModel(QDeclarativeContext *ctxt)
+: QDeclarativeVisualModel(*(new QDeclarativeVisualDataModelPrivate(ctxt)))
{
}
-QmlGraphicsVisualDataModel::~QmlGraphicsVisualDataModel()
+QDeclarativeVisualDataModel::~QDeclarativeVisualDataModel()
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
if (d->m_listAccessor)
delete d->m_listAccessor;
if (d->m_delegateDataType)
d->m_delegateDataType->release();
}
-QVariant QmlGraphicsVisualDataModel::model() const
+/*!
+ \qmlproperty model VisualDataModel::model
+ This property holds the model providing data for the VisualDataModel.
+
+ The model provides a set of data that is used to create the items
+ for a view. For large or dynamic datasets the model is usually
+ provided by a C++ model object. The C++ model object must be a \l
+ {QAbstractItemModel} subclass or a simple list.
+
+ Models can also be created directly in QML, using a \l{ListModel} or
+ \l{XmlListModel}.
+
+ \sa {qmlmodels}{Data Models}
+*/
+QVariant QDeclarativeVisualDataModel::model() const
{
- Q_D(const QmlGraphicsVisualDataModel);
+ Q_D(const QDeclarativeVisualDataModel);
return d->m_modelVariant;
}
-void QmlGraphicsVisualDataModel::setModel(const QVariant &model)
+void QDeclarativeVisualDataModel::setModel(const QVariant &model)
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
delete d->m_listAccessor;
d->m_listAccessor = 0;
d->m_modelVariant = model;
@@ -612,6 +660,7 @@ void QmlGraphicsVisualDataModel::setModel(const QVariant &model)
this, SLOT(_q_dataChanged(const QModelIndex&,const QModelIndex&)));
QObject::disconnect(d->m_abstractItemModel, SIGNAL(rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int)),
this, SLOT(_q_rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int)));
+ QObject::disconnect(d->m_abstractItemModel, SIGNAL(modelReset()), this, SLOT(_q_modelReset()));
} else if (d->m_visualItemModel) {
QObject::disconnect(d->m_visualItemModel, SIGNAL(itemsInserted(int,int)),
this, SIGNAL(itemsInserted(int,int)));
@@ -619,10 +668,10 @@ void QmlGraphicsVisualDataModel::setModel(const QVariant &model)
this, SIGNAL(itemsRemoved(int,int)));
QObject::disconnect(d->m_visualItemModel, SIGNAL(itemsMoved(int,int,int)),
this, SIGNAL(itemsMoved(int,int,int)));
- QObject::disconnect(d->m_visualItemModel, SIGNAL(createdPackage(int,QmlPackage*)),
- this, SLOT(_q_createdPackage(int,QmlPackage*)));
- QObject::disconnect(d->m_visualItemModel, SIGNAL(destroyingPackage(QmlPackage*)),
- this, SLOT(_q_destroyingPackage(QmlPackage*)));
+ QObject::disconnect(d->m_visualItemModel, SIGNAL(createdPackage(int,QDeclarativePackage*)),
+ this, SLOT(_q_createdPackage(int,QDeclarativePackage*)));
+ QObject::disconnect(d->m_visualItemModel, SIGNAL(destroyingPackage(QDeclarativePackage*)),
+ this, SLOT(_q_destroyingPackage(QDeclarativePackage*)));
d->m_visualItemModel = 0;
}
@@ -632,7 +681,7 @@ void QmlGraphicsVisualDataModel::setModel(const QVariant &model)
d->m_delegateDataType->release();
d->m_metaDataCreated = 0;
d->m_metaDataCacheable = false;
- d->m_delegateDataType = new VDMDelegateDataType(&QmlGraphicsVisualDataModelData::staticMetaObject, d->m_context?d->m_context->engine():qmlEngine(this));
+ d->m_delegateDataType = new VDMDelegateDataType(&QDeclarativeVisualDataModelData::staticMetaObject, d->m_context?d->m_context->engine():qmlEngine(this));
QObject *object = qvariant_cast<QObject *>(model);
if (object && (d->m_listModelInterface = qobject_cast<QListModelInterface *>(object))) {
@@ -657,25 +706,26 @@ void QmlGraphicsVisualDataModel::setModel(const QVariant &model)
this, SLOT(_q_dataChanged(const QModelIndex&,const QModelIndex&)));
QObject::connect(d->m_abstractItemModel, SIGNAL(rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int)),
this, SLOT(_q_rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int)));
+ QObject::connect(d->m_abstractItemModel, SIGNAL(modelReset()), this, SLOT(_q_modelReset()));
d->m_metaDataCacheable = true;
return;
}
- if ((d->m_visualItemModel = qvariant_cast<QmlGraphicsVisualDataModel *>(model))) {
+ if ((d->m_visualItemModel = qvariant_cast<QDeclarativeVisualDataModel *>(model))) {
QObject::connect(d->m_visualItemModel, SIGNAL(itemsInserted(int,int)),
this, SIGNAL(itemsInserted(int,int)));
QObject::connect(d->m_visualItemModel, SIGNAL(itemsRemoved(int,int)),
this, SIGNAL(itemsRemoved(int,int)));
QObject::connect(d->m_visualItemModel, SIGNAL(itemsMoved(int,int,int)),
this, SIGNAL(itemsMoved(int,int,int)));
- QObject::connect(d->m_visualItemModel, SIGNAL(createdPackage(int,QmlPackage*)),
- this, SLOT(_q_createdPackage(int,QmlPackage*)));
- QObject::connect(d->m_visualItemModel, SIGNAL(destroyingPackage(QmlPackage*)),
- this, SLOT(_q_destroyingPackage(QmlPackage*)));
+ QObject::connect(d->m_visualItemModel, SIGNAL(createdPackage(int,QDeclarativePackage*)),
+ this, SLOT(_q_createdPackage(int,QDeclarativePackage*)));
+ QObject::connect(d->m_visualItemModel, SIGNAL(destroyingPackage(QDeclarativePackage*)),
+ this, SLOT(_q_destroyingPackage(QDeclarativePackage*)));
return;
}
- d->m_listAccessor = new QmlListAccessor;
+ d->m_listAccessor = new QDeclarativeListAccessor;
d->m_listAccessor->setList(model, d->m_context?d->m_context->engine():qmlEngine(this));
- if (d->m_listAccessor->type() != QmlListAccessor::ListProperty)
+ if (d->m_listAccessor->type() != QDeclarativeListAccessor::ListProperty)
d->m_metaDataCacheable = true;
if (d->m_delegate && d->modelCount()) {
emit itemsInserted(0, d->modelCount());
@@ -683,17 +733,27 @@ void QmlGraphicsVisualDataModel::setModel(const QVariant &model)
}
}
-QmlComponent *QmlGraphicsVisualDataModel::delegate() const
+/*!
+ \qmlproperty component VisualDataModel::delegate
+
+ The delegate provides a template defining each item instantiated by a view.
+ The index is exposed as an accessible \c index property. Properties of the
+ model are also available depending upon the type of \l {qmlmodels}{Data Model}.
+
+ Here is an example delegate:
+ \snippet doc/src/snippets/declarative/listview/listview.qml 0
+*/
+QDeclarativeComponent *QDeclarativeVisualDataModel::delegate() const
{
- Q_D(const QmlGraphicsVisualDataModel);
+ Q_D(const QDeclarativeVisualDataModel);
if (d->m_visualItemModel)
return d->m_visualItemModel->delegate();
return d->m_delegate;
}
-void QmlGraphicsVisualDataModel::setDelegate(QmlComponent *delegate)
+void QDeclarativeVisualDataModel::setDelegate(QDeclarativeComponent *delegate)
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
bool wasValid = d->m_delegate != 0;
d->m_delegate = delegate;
if (!wasValid && d->modelCount() && d->m_delegate) {
@@ -706,27 +766,125 @@ void QmlGraphicsVisualDataModel::setDelegate(QmlComponent *delegate)
}
}
-QString QmlGraphicsVisualDataModel::part() const
+/*!
+ \qmlproperty QModelIndex VisualDataModel::rootIndex
+
+ QAbstractItemModel provides a heirachical tree of data, whereas
+ QML only operates on list data. rootIndex allows the children of
+ any node in a QAbstractItemModel to be provided by this model.
+
+ This property only affects models of type QAbstractItemModel.
+
+ \code
+ // main.cpp
+ Q_DECLARE_METATYPE(QModelIndex)
+
+ class MyModel : public QDirModel
+ {
+ Q_OBJECT
+ public:
+ MyModel(QDeclarativeContext *ctxt) : QDirModel(), context(ctxt) {
+ QHash<int,QByteArray> roles = roleNames();
+ roles.insert(FilePathRole, "path");
+ setRoleNames(roles);
+ context->setContextProperty("myModel", this);
+ context->setContextProperty("myRoot", QVariant::fromValue(index(0,0,QModelIndex())));
+ }
+
+ Q_INVOKABLE void setRoot(const QString &path) {
+ QModelIndex root = index(path);
+ context->setContextProperty("myRoot", QVariant::fromValue(root));
+ }
+
+ QDeclarativeContext *context;
+ };
+
+ int main(int argc, char ** argv)
+ {
+ QApplication app(argc, argv);
+
+ QDeclarativeView view;
+
+ MyModel model(view.rootContext());
+
+ view.setSource(QUrl("qrc:view.qml"));
+ view.show();
+
+ return app.exec();
+ }
+
+ #include "main.moc"
+ \endcode
+
+ \code
+ // view.qml
+ import Qt 4.6
+
+ ListView {
+ width: 200
+ height: 200
+ model: VisualDataModel {
+ model: myModel
+ rootIndex: myRoot
+ delegate: Component {
+ Rectangle {
+ height: 25; width: 100
+ Text { text: path }
+ MouseRegion {
+ anchors.fill: parent;
+ onClicked: myModel.setRoot(path)
+ }
+ }
+ }
+ }
+ }
+ \endcode
+
+*/
+QModelIndex QDeclarativeVisualDataModel::rootIndex() const
+{
+ Q_D(const QDeclarativeVisualDataModel);
+ return d->m_root;
+}
+
+void QDeclarativeVisualDataModel::setRootIndex(const QModelIndex &root)
+{
+ Q_D(QDeclarativeVisualDataModel);
+ if (d->m_root != root) {
+ int oldCount = d->modelCount();
+ d->m_root = root;
+ int newCount = d->modelCount();
+ if (d->m_delegate && oldCount)
+ emit itemsRemoved(0, oldCount);
+ if (d->m_delegate && newCount)
+ emit itemsInserted(0, newCount);
+ if (newCount != oldCount)
+ emit countChanged();
+ emit rootIndexChanged();
+ }
+}
+
+QString QDeclarativeVisualDataModel::part() const
{
- Q_D(const QmlGraphicsVisualDataModel);
+ Q_D(const QDeclarativeVisualDataModel);
return d->m_part;
}
-void QmlGraphicsVisualDataModel::setPart(const QString &part)
+void QDeclarativeVisualDataModel::setPart(const QString &part)
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
d->m_part = part;
}
-int QmlGraphicsVisualDataModel::count() const
+int QDeclarativeVisualDataModel::count() const
{
- Q_D(const QmlGraphicsVisualDataModel);
+ Q_D(const QDeclarativeVisualDataModel);
return d->modelCount();
}
-QmlGraphicsItem *QmlGraphicsVisualDataModel::item(int index, bool complete)
+QDeclarativeItem *QDeclarativeVisualDataModel::item(int index, bool complete)
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
if (d->m_visualItemModel)
return d->m_visualItemModel->item(index, d->m_part.toUtf8(), complete);
return item(index, QByteArray(), complete);
@@ -735,9 +893,9 @@ QmlGraphicsItem *QmlGraphicsVisualDataModel::item(int index, bool complete)
/*
Returns ReleaseStatus flags.
*/
-QmlGraphicsVisualDataModel::ReleaseFlags QmlGraphicsVisualDataModel::release(QmlGraphicsItem *item)
+QDeclarativeVisualDataModel::ReleaseFlags QDeclarativeVisualDataModel::release(QDeclarativeItem *item)
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
if (d->m_visualItemModel)
return d->m_visualItemModel->release(item);
@@ -745,9 +903,9 @@ QmlGraphicsVisualDataModel::ReleaseFlags QmlGraphicsVisualDataModel::release(Qml
QObject *obj = item;
bool inPackage = false;
- QHash<QObject*,QmlPackage*>::iterator it = d->m_packaged.find(item);
+ QHash<QObject*,QDeclarativePackage*>::iterator it = d->m_packaged.find(item);
if (it != d->m_packaged.end()) {
- QmlPackage *package = *it;
+ QDeclarativePackage *package = *it;
d->m_packaged.erase(it);
if (d->m_packaged.contains(item))
stat |= Referenced;
@@ -757,7 +915,7 @@ QmlGraphicsVisualDataModel::ReleaseFlags QmlGraphicsVisualDataModel::release(Qml
if (d->m_cache.releaseItem(obj)) {
if (inPackage) {
- emit destroyingPackage(qobject_cast<QmlPackage*>(obj));
+ emit destroyingPackage(qobject_cast<QDeclarativePackage*>(obj));
} else {
item->setVisible(false);
static_cast<QGraphicsItem*>(item)->setParentItem(0);
@@ -771,29 +929,55 @@ QmlGraphicsVisualDataModel::ReleaseFlags QmlGraphicsVisualDataModel::release(Qml
return stat;
}
-QObject *QmlGraphicsVisualDataModel::parts()
+/*!
+ \qmlproperty object VisualDataModel::parts
+
+ The \a parts property selects a VisualDataModel which creates
+ delegates from the part named. This is used in conjunction with
+ the Package element.
+
+ For example, the code below selects a model which creates
+ delegates named \e list from a Package:
+
+ \code
+ VisualDataModel {
+ id: visualModel
+ delegate: Package {
+ Item { Package.name: "list" }
+ }
+ model: myModel
+ }
+
+ ListView {
+ width: 200; height:200
+ model: visualModel.parts.list
+ }
+ \endcode
+
+ \sa Package
+*/
+QObject *QDeclarativeVisualDataModel::parts()
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
if (!d->m_parts)
- d->m_parts = new QmlGraphicsVisualDataModelParts(this);
+ d->m_parts = new QDeclarativeVisualDataModelParts(this);
return d->m_parts;
}
-QmlGraphicsItem *QmlGraphicsVisualDataModel::item(int index, const QByteArray &viewId, bool complete)
+QDeclarativeItem *QDeclarativeVisualDataModel::item(int index, const QByteArray &viewId, bool complete)
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
if (d->m_visualItemModel)
return d->m_visualItemModel->item(index, viewId, complete);
if (d->modelCount() <= 0 || !d->m_delegate)
return 0;
-
QObject *nobj = d->m_cache.getItem(index);
if (!nobj) {
- QmlContext *ccontext = d->m_context;
+ QDeclarativeContext *ccontext = d->m_context;
if (!ccontext) ccontext = qmlContext(this);
- QmlContext *ctxt = new QmlContext(ccontext);
- QmlGraphicsVisualDataModelData *data = new QmlGraphicsVisualDataModelData(index, this);
+ QDeclarativeContext *ctxt = new QDeclarativeContext(ccontext);
+ QDeclarativeVisualDataModelData *data = new QDeclarativeVisualDataModelData(index, this);
ctxt->setContextProperty(QLatin1String("model"), data);
ctxt->addDefaultObject(data);
nobj = d->m_delegate->beginCreate(ctxt);
@@ -803,7 +987,7 @@ QmlGraphicsItem *QmlGraphicsVisualDataModel::item(int index, const QByteArray &v
ctxt->setParent(nobj);
data->setParent(nobj);
d->m_cache.insertItem(index, nobj);
- if (QmlPackage *package = qobject_cast<QmlPackage *>(nobj))
+ if (QDeclarativePackage *package = qobject_cast<QDeclarativePackage *>(nobj))
emit createdPackage(index, package);
} else {
delete data;
@@ -811,27 +995,27 @@ QmlGraphicsItem *QmlGraphicsVisualDataModel::item(int index, const QByteArray &v
qWarning() << d->m_delegate->errors();
}
}
- QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem *>(nobj);
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item) {
- QmlPackage *package = qobject_cast<QmlPackage *>(nobj);
+ QDeclarativePackage *package = qobject_cast<QDeclarativePackage *>(nobj);
if (package) {
QObject *o = package->part(QString::fromUtf8(viewId));
- item = qobject_cast<QmlGraphicsItem *>(o);
+ item = qobject_cast<QDeclarativeItem *>(o);
if (item)
d->m_packaged.insertMulti(item, package);
}
}
if (!item) {
d->m_cache.releaseItem(nobj);
- qmlInfo(d->m_delegate) << QmlGraphicsVisualDataModel::tr("Delegate component must be Item type.");
+ qmlInfo(d->m_delegate) << QDeclarativeVisualDataModel::tr("Delegate component must be Item type.");
}
return item;
}
-void QmlGraphicsVisualDataModel::completeItem()
+void QDeclarativeVisualDataModel::completeItem()
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
if (d->m_visualItemModel) {
d->m_visualItemModel->completeItem();
return;
@@ -840,9 +1024,9 @@ void QmlGraphicsVisualDataModel::completeItem()
d->m_delegate->completeCreate();
}
-QString QmlGraphicsVisualDataModel::stringValue(int index, const QString &name)
+QString QDeclarativeVisualDataModel::stringValue(int index, const QString &name)
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
if (d->m_visualItemModel)
return d->m_visualItemModel->stringValue(index, name);
@@ -856,13 +1040,13 @@ QString QmlGraphicsVisualDataModel::stringValue(int index, const QString &name)
if (QObject *nobj = d->m_cache.item(index))
data = d->data(nobj);
if (!data) {
- data = new QmlGraphicsVisualDataModelData(index, this);
+ data = new QDeclarativeVisualDataModelData(index, this);
tempData = true;
}
- QmlDeclarativeData *ddata = QmlDeclarativeData::get(data);
+ QDeclarativeDeclarativeData *ddata = QDeclarativeDeclarativeData::get(data);
if (ddata && ddata->propertyCache) {
- QmlPropertyCache::Data *prop = ddata->propertyCache->property(name);
+ QDeclarativePropertyCache::Data *prop = ddata->propertyCache->property(name);
if (prop) {
if (prop->propType == QVariant::String) {
void *args[] = { &val, 0 };
@@ -886,9 +1070,9 @@ QString QmlGraphicsVisualDataModel::stringValue(int index, const QString &name)
return val;
}
-QVariant QmlGraphicsVisualDataModel::evaluate(int index, const QString &expression, QObject *objectContext)
+QVariant QDeclarativeVisualDataModel::evaluate(int index, const QString &expression, QObject *objectContext)
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
if (d->m_visualItemModel)
return d->m_visualItemModel->evaluate(index, expression, objectContext);
@@ -898,20 +1082,18 @@ QVariant QmlGraphicsVisualDataModel::evaluate(int index, const QString &expressi
QVariant value;
QObject *nobj = d->m_cache.item(index);
if (nobj) {
- QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem *>(nobj);
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(nobj);
if (item) {
- QmlExpression e(qmlContext(item), expression, objectContext);
- e.setTrackChange(false);
+ QDeclarativeExpression e(qmlContext(item), expression, objectContext);
value = e.value();
}
} else {
- QmlContext *ccontext = d->m_context;
+ QDeclarativeContext *ccontext = d->m_context;
if (!ccontext) ccontext = qmlContext(this);
- QmlContext *ctxt = new QmlContext(ccontext);
- QmlGraphicsVisualDataModelData *data = new QmlGraphicsVisualDataModelData(index, this);
+ QDeclarativeContext *ctxt = new QDeclarativeContext(ccontext);
+ QDeclarativeVisualDataModelData *data = new QDeclarativeVisualDataModelData(index, this);
ctxt->addDefaultObject(data);
- QmlExpression e(ctxt, expression, objectContext);
- e.setTrackChange(false);
+ QDeclarativeExpression e(ctxt, expression, objectContext);
value = e.value();
delete data;
delete ctxt;
@@ -920,22 +1102,22 @@ QVariant QmlGraphicsVisualDataModel::evaluate(int index, const QString &expressi
return value;
}
-int QmlGraphicsVisualDataModel::indexOf(QmlGraphicsItem *item, QObject *) const
+int QDeclarativeVisualDataModel::indexOf(QDeclarativeItem *item, QObject *) const
{
- QVariant val = QmlEngine::contextForObject(item)->contextProperty(QLatin1String("index"));
+ QVariant val = QDeclarativeEngine::contextForObject(item)->contextProperty(QLatin1String("index"));
return val.toInt();
return -1;
}
-void QmlGraphicsVisualDataModel::_q_itemsChanged(int index, int count,
+void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count,
const QList<int> &roles)
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
// XXX - highly inefficient
for (int ii = index; ii < index + count; ++ii) {
if (QObject *item = d->m_cache.item(ii)) {
- QmlGraphicsVisualDataModelData *data = d->data(item);
+ QDeclarativeVisualDataModelData *data = d->data(item);
for (int roleIdx = 0; roleIdx < roles.count(); ++roleIdx) {
int role = roles.at(roleIdx);
@@ -944,7 +1126,7 @@ void QmlGraphicsVisualDataModel::_q_itemsChanged(int index, int count,
if (d->m_listModelInterface) {
data->setValue(propId, d->m_listModelInterface->data(ii, QList<int>() << role).value(role));
} else if (d->m_abstractItemModel) {
- QModelIndex index = d->m_abstractItemModel->index(ii, 0);
+ QModelIndex index = d->m_abstractItemModel->index(ii, 0, d->m_root);
data->setValue(propId, d->m_abstractItemModel->data(index, role));
}
}
@@ -953,22 +1135,22 @@ void QmlGraphicsVisualDataModel::_q_itemsChanged(int index, int count,
}
}
-void QmlGraphicsVisualDataModel::_q_itemsInserted(int index, int count)
+void QDeclarativeVisualDataModel::_q_itemsInserted(int index, int count)
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
// XXX - highly inefficient
- QHash<int,QmlGraphicsVisualDataModelPrivate::ObjectRef> items;
- for (QHash<int,QmlGraphicsVisualDataModelPrivate::ObjectRef>::Iterator iter = d->m_cache.begin();
+ QHash<int,QDeclarativeVisualDataModelPrivate::ObjectRef> items;
+ for (QHash<int,QDeclarativeVisualDataModelPrivate::ObjectRef>::Iterator iter = d->m_cache.begin();
iter != d->m_cache.end(); ) {
if (iter.key() >= index) {
- QmlGraphicsVisualDataModelPrivate::ObjectRef objRef = *iter;
+ QDeclarativeVisualDataModelPrivate::ObjectRef objRef = *iter;
int index = iter.key() + count;
iter = d->m_cache.erase(iter);
items.insert(index, objRef);
- QmlGraphicsVisualDataModelData *data = d->data(objRef.obj);
+ QDeclarativeVisualDataModelData *data = d->data(objRef.obj);
data->setIndex(index);
} else {
++iter;
@@ -980,25 +1162,25 @@ void QmlGraphicsVisualDataModel::_q_itemsInserted(int index, int count)
emit countChanged();
}
-void QmlGraphicsVisualDataModel::_q_itemsRemoved(int index, int count)
+void QDeclarativeVisualDataModel::_q_itemsRemoved(int index, int count)
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
// XXX - highly inefficient
- QHash<int, QmlGraphicsVisualDataModelPrivate::ObjectRef> items;
- for (QHash<int, QmlGraphicsVisualDataModelPrivate::ObjectRef>::Iterator iter = d->m_cache.begin();
+ QHash<int, QDeclarativeVisualDataModelPrivate::ObjectRef> items;
+ for (QHash<int, QDeclarativeVisualDataModelPrivate::ObjectRef>::Iterator iter = d->m_cache.begin();
iter != d->m_cache.end(); ) {
if (iter.key() >= index && iter.key() < index + count) {
- QmlGraphicsVisualDataModelPrivate::ObjectRef objRef = *iter;
+ QDeclarativeVisualDataModelPrivate::ObjectRef objRef = *iter;
iter = d->m_cache.erase(iter);
items.insertMulti(-1, objRef); //XXX perhaps better to maintain separately
- QmlGraphicsVisualDataModelData *data = d->data(objRef.obj);
+ QDeclarativeVisualDataModelData *data = d->data(objRef.obj);
data->setIndex(-1);
} else if (iter.key() >= index + count) {
- QmlGraphicsVisualDataModelPrivate::ObjectRef objRef = *iter;
+ QDeclarativeVisualDataModelPrivate::ObjectRef objRef = *iter;
int index = iter.key() - count;
iter = d->m_cache.erase(iter);
items.insert(index, objRef);
- QmlGraphicsVisualDataModelData *data = d->data(objRef.obj);
+ QDeclarativeVisualDataModelData *data = d->data(objRef.obj);
data->setIndex(index);
} else {
++iter;
@@ -1010,39 +1192,39 @@ void QmlGraphicsVisualDataModel::_q_itemsRemoved(int index, int count)
emit countChanged();
}
-void QmlGraphicsVisualDataModel::_q_itemsMoved(int from, int to, int count)
+void QDeclarativeVisualDataModel::_q_itemsMoved(int from, int to, int count)
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
// XXX - highly inefficient
- QHash<int,QmlGraphicsVisualDataModelPrivate::ObjectRef> items;
- for (QHash<int,QmlGraphicsVisualDataModelPrivate::ObjectRef>::Iterator iter = d->m_cache.begin();
+ QHash<int,QDeclarativeVisualDataModelPrivate::ObjectRef> items;
+ for (QHash<int,QDeclarativeVisualDataModelPrivate::ObjectRef>::Iterator iter = d->m_cache.begin();
iter != d->m_cache.end(); ) {
if (iter.key() >= from && iter.key() < from + count) {
- QmlGraphicsVisualDataModelPrivate::ObjectRef objRef = *iter;
+ QDeclarativeVisualDataModelPrivate::ObjectRef objRef = *iter;
int index = iter.key() - from + to;
iter = d->m_cache.erase(iter);
items.insert(index, objRef);
- QmlGraphicsVisualDataModelData *data = d->data(objRef.obj);
+ QDeclarativeVisualDataModelData *data = d->data(objRef.obj);
data->setIndex(index);
} else {
++iter;
}
}
- for (QHash<int,QmlGraphicsVisualDataModelPrivate::ObjectRef>::Iterator iter = d->m_cache.begin();
+ for (QHash<int,QDeclarativeVisualDataModelPrivate::ObjectRef>::Iterator iter = d->m_cache.begin();
iter != d->m_cache.end(); ) {
int diff = from > to ? count : -count;
if (iter.key() >= qMin(from,to) && iter.key() < qMax(from+count,to+count)) {
- QmlGraphicsVisualDataModelPrivate::ObjectRef objRef = *iter;
+ QDeclarativeVisualDataModelPrivate::ObjectRef objRef = *iter;
int index = iter.key() + diff;
iter = d->m_cache.erase(iter);
items.insert(index, objRef);
- QmlGraphicsVisualDataModelData *data = d->data(objRef.obj);
+ QDeclarativeVisualDataModelData *data = d->data(objRef.obj);
data->setIndex(index);
} else {
++iter;
@@ -1053,19 +1235,19 @@ void QmlGraphicsVisualDataModel::_q_itemsMoved(int from, int to, int count)
emit itemsMoved(from, to, count);
}
-void QmlGraphicsVisualDataModel::_q_rowsInserted(const QModelIndex &parent, int begin, int end)
+void QDeclarativeVisualDataModel::_q_rowsInserted(const QModelIndex &parent, int begin, int end)
{
if (!parent.isValid())
_q_itemsInserted(begin, end - begin + 1);
}
-void QmlGraphicsVisualDataModel::_q_rowsRemoved(const QModelIndex &parent, int begin, int end)
+void QDeclarativeVisualDataModel::_q_rowsRemoved(const QModelIndex &parent, int begin, int end)
{
if (!parent.isValid())
_q_itemsRemoved(begin, end - begin + 1);
}
-void QmlGraphicsVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
+void QDeclarativeVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
{
const int count = sourceEnd - sourceStart + 1;
if (!destinationParent.isValid() && !sourceParent.isValid()) {
@@ -1077,27 +1259,33 @@ void QmlGraphicsVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent, i
}
}
-void QmlGraphicsVisualDataModel::_q_dataChanged(const QModelIndex &begin, const QModelIndex &end)
+void QDeclarativeVisualDataModel::_q_dataChanged(const QModelIndex &begin, const QModelIndex &end)
{
- Q_D(QmlGraphicsVisualDataModel);
+ Q_D(QDeclarativeVisualDataModel);
if (!begin.parent().isValid())
_q_itemsChanged(begin.row(), end.row() - begin.row() + 1, d->m_roles);
}
-void QmlGraphicsVisualDataModel::_q_createdPackage(int index, QmlPackage *package)
+void QDeclarativeVisualDataModel::_q_modelReset()
+{
+ Q_D(QDeclarativeVisualDataModel);
+ emit modelReset();
+}
+
+void QDeclarativeVisualDataModel::_q_createdPackage(int index, QDeclarativePackage *package)
{
- Q_D(QmlGraphicsVisualDataModel);
- emit createdItem(index, qobject_cast<QmlGraphicsItem*>(package->part(d->m_part)));
+ Q_D(QDeclarativeVisualDataModel);
+ emit createdItem(index, qobject_cast<QDeclarativeItem*>(package->part(d->m_part)));
}
-void QmlGraphicsVisualDataModel::_q_destroyingPackage(QmlPackage *package)
+void QDeclarativeVisualDataModel::_q_destroyingPackage(QDeclarativePackage *package)
{
- Q_D(QmlGraphicsVisualDataModel);
- emit destroyingItem(qobject_cast<QmlGraphicsItem*>(package->part(d->m_part)));
+ Q_D(QDeclarativeVisualDataModel);
+ emit destroyingItem(qobject_cast<QDeclarativeItem*>(package->part(d->m_part)));
}
QT_END_NAMESPACE
QML_DECLARE_TYPE(QListModelInterface)
-#include <qmlgraphicsvisualitemmodel.moc>
+#include <qdeclarativevisualitemmodel.moc>
diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h
index 49f9b27..d34bcaf 100644
--- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h
@@ -39,16 +39,18 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSVISUALDATAMODEL_H
-#define QMLGRAPHICSVISUALDATAMODEL_H
+#ifndef QDECLARATIVEVISUALDATAMODEL_H
+#define QDECLARATIVEVISUALDATAMODEL_H
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtCore/qobject.h>
#include <QtCore/qabstractitemmodel.h>
QT_BEGIN_HEADER
+Q_DECLARE_METATYPE(QModelIndex)
+
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -58,126 +60,132 @@ QT_MODULE(Declarative)
*****************************************************************************
*****************************************************************************/
-class QmlGraphicsItem;
-class QmlComponent;
-class QmlPackage;
-class QmlGraphicsVisualDataModelPrivate;
+class QDeclarativeItem;
+class QDeclarativeComponent;
+class QDeclarativePackage;
+class QDeclarativeVisualDataModelPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsVisualModel : public QObject
+class Q_DECLARATIVE_EXPORT QDeclarativeVisualModel : public QObject
{
Q_OBJECT
Q_PROPERTY(int count READ count NOTIFY countChanged)
public:
- QmlGraphicsVisualModel() {}
- virtual ~QmlGraphicsVisualModel() {}
+ QDeclarativeVisualModel() {}
+ virtual ~QDeclarativeVisualModel() {}
enum ReleaseFlag { Referenced = 0x01, Destroyed = 0x02 };
Q_DECLARE_FLAGS(ReleaseFlags, ReleaseFlag)
virtual int count() const = 0;
virtual bool isValid() const = 0;
- virtual QmlGraphicsItem *item(int index, bool complete=true) = 0;
- virtual ReleaseFlags release(QmlGraphicsItem *item) = 0;
+ virtual QDeclarativeItem *item(int index, bool complete=true) = 0;
+ virtual ReleaseFlags release(QDeclarativeItem *item) = 0;
virtual void completeItem() = 0;
virtual QVariant evaluate(int index, const QString &expression, QObject *objectContext) = 0;
virtual QString stringValue(int, const QString &) { return QString(); }
- virtual int indexOf(QmlGraphicsItem *item, QObject *objectContext) const = 0;
+ virtual int indexOf(QDeclarativeItem *item, QObject *objectContext) const = 0;
Q_SIGNALS:
void countChanged();
void itemsInserted(int index, int count);
void itemsRemoved(int index, int count);
void itemsMoved(int from, int to, int count);
- void createdItem(int index, QmlGraphicsItem *item);
- void destroyingItem(QmlGraphicsItem *item);
+ void modelReset();
+ void createdItem(int index, QDeclarativeItem *item);
+ void destroyingItem(QDeclarativeItem *item);
protected:
- QmlGraphicsVisualModel(QObjectPrivate &dd, QObject *parent = 0)
+ QDeclarativeVisualModel(QObjectPrivate &dd, QObject *parent = 0)
: QObject(dd, parent) {}
private:
- Q_DISABLE_COPY(QmlGraphicsVisualModel)
+ Q_DISABLE_COPY(QDeclarativeVisualModel)
};
-class QmlGraphicsVisualItemModelAttached;
-class QmlGraphicsVisualItemModelPrivate;
-class Q_DECLARATIVE_EXPORT QmlGraphicsVisualItemModel : public QmlGraphicsVisualModel
+class QDeclarativeVisualItemModelAttached;
+class QDeclarativeVisualItemModelPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeVisualItemModel : public QDeclarativeVisualModel
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlGraphicsVisualItemModel)
+ Q_DECLARE_PRIVATE(QDeclarativeVisualItemModel)
- Q_PROPERTY(QmlListProperty<QmlGraphicsItem> children READ children NOTIFY childrenChanged DESIGNABLE false)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeItem> children READ children NOTIFY childrenChanged DESIGNABLE false)
Q_CLASSINFO("DefaultProperty", "children")
public:
- QmlGraphicsVisualItemModel();
- virtual ~QmlGraphicsVisualItemModel() {}
+ QDeclarativeVisualItemModel();
+ virtual ~QDeclarativeVisualItemModel() {}
virtual int count() const;
virtual bool isValid() const;
- virtual QmlGraphicsItem *item(int index, bool complete=true);
- virtual ReleaseFlags release(QmlGraphicsItem *item);
+ virtual QDeclarativeItem *item(int index, bool complete=true);
+ virtual ReleaseFlags release(QDeclarativeItem *item);
virtual void completeItem();
virtual QString stringValue(int index, const QString &role);
virtual QVariant evaluate(int index, const QString &expression, QObject *objectContext);
- virtual int indexOf(QmlGraphicsItem *item, QObject *objectContext) const;
+ virtual int indexOf(QDeclarativeItem *item, QObject *objectContext) const;
- QmlListProperty<QmlGraphicsItem> children();
+ QDeclarativeListProperty<QDeclarativeItem> children();
- static QmlGraphicsVisualItemModelAttached *qmlAttachedProperties(QObject *obj);
+ static QDeclarativeVisualItemModelAttached *qmlAttachedProperties(QObject *obj);
Q_SIGNALS:
void childrenChanged();
private:
- Q_DISABLE_COPY(QmlGraphicsVisualItemModel)
+ Q_DISABLE_COPY(QDeclarativeVisualItemModel)
};
-class Q_DECLARATIVE_EXPORT QmlGraphicsVisualDataModel : public QmlGraphicsVisualModel
+class Q_DECLARATIVE_EXPORT QDeclarativeVisualDataModel : public QDeclarativeVisualModel
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlGraphicsVisualDataModel)
+ Q_DECLARE_PRIVATE(QDeclarativeVisualDataModel)
Q_PROPERTY(QVariant model READ model WRITE setModel)
- Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate)
+ Q_PROPERTY(QDeclarativeComponent *delegate READ delegate WRITE setDelegate)
Q_PROPERTY(QString part READ part WRITE setPart)
Q_PROPERTY(QObject *parts READ parts CONSTANT)
+ Q_PROPERTY(QModelIndex rootIndex READ rootIndex WRITE setRootIndex NOTIFY rootIndexChanged)
Q_CLASSINFO("DefaultProperty", "delegate")
public:
- QmlGraphicsVisualDataModel();
- QmlGraphicsVisualDataModel(QmlContext *);
- virtual ~QmlGraphicsVisualDataModel();
+ QDeclarativeVisualDataModel();
+ QDeclarativeVisualDataModel(QDeclarativeContext *);
+ virtual ~QDeclarativeVisualDataModel();
QVariant model() const;
void setModel(const QVariant &);
- QmlComponent *delegate() const;
- void setDelegate(QmlComponent *);
+ QDeclarativeComponent *delegate() const;
+ void setDelegate(QDeclarativeComponent *);
+
+ QModelIndex rootIndex() const;
+ void setRootIndex(const QModelIndex &root);
QString part() const;
void setPart(const QString &);
int count() const;
bool isValid() const { return delegate() != 0; }
- QmlGraphicsItem *item(int index, bool complete=true);
- QmlGraphicsItem *item(int index, const QByteArray &, bool complete=true);
- ReleaseFlags release(QmlGraphicsItem *item);
+ QDeclarativeItem *item(int index, bool complete=true);
+ QDeclarativeItem *item(int index, const QByteArray &, bool complete=true);
+ ReleaseFlags release(QDeclarativeItem *item);
void completeItem();
virtual QString stringValue(int index, const QString &role);
QVariant evaluate(int index, const QString &expression, QObject *objectContext);
- int indexOf(QmlGraphicsItem *item, QObject *objectContext) const;
+ int indexOf(QDeclarativeItem *item, QObject *objectContext) const;
QObject *parts();
Q_SIGNALS:
- void createdPackage(int index, QmlPackage *package);
- void destroyingPackage(QmlPackage *package);
+ void createdPackage(int index, QDeclarativePackage *package);
+ void destroyingPackage(QDeclarativePackage *package);
+ void rootIndexChanged();
private Q_SLOTS:
void _q_itemsChanged(int, int, const QList<int> &);
@@ -188,21 +196,22 @@ private Q_SLOTS:
void _q_rowsRemoved(const QModelIndex &,int,int);
void _q_rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int);
void _q_dataChanged(const QModelIndex&,const QModelIndex&);
- void _q_createdPackage(int index, QmlPackage *package);
- void _q_destroyingPackage(QmlPackage *package);
+ void _q_modelReset();
+ void _q_createdPackage(int index, QDeclarativePackage *package);
+ void _q_destroyingPackage(QDeclarativePackage *package);
private:
- Q_DISABLE_COPY(QmlGraphicsVisualDataModel)
+ Q_DISABLE_COPY(QDeclarativeVisualDataModel)
};
-class QmlGraphicsVisualItemModelAttached : public QObject
+class QDeclarativeVisualItemModelAttached : public QObject
{
Q_OBJECT
public:
- QmlGraphicsVisualItemModelAttached(QObject *parent)
+ QDeclarativeVisualItemModelAttached(QObject *parent)
: QObject(parent), m_index(0) {}
- ~QmlGraphicsVisualItemModelAttached() {
+ ~QDeclarativeVisualItemModelAttached() {
attachedProperties.remove(parent());
}
@@ -215,10 +224,10 @@ public:
}
}
- static QmlGraphicsVisualItemModelAttached *properties(QObject *obj) {
- QmlGraphicsVisualItemModelAttached *rv = attachedProperties.value(obj);
+ static QDeclarativeVisualItemModelAttached *properties(QObject *obj) {
+ QDeclarativeVisualItemModelAttached *rv = attachedProperties.value(obj);
if (!rv) {
- rv = new QmlGraphicsVisualItemModelAttached(obj);
+ rv = new QDeclarativeVisualItemModelAttached(obj);
attachedProperties.insert(obj, rv);
}
return rv;
@@ -230,17 +239,17 @@ Q_SIGNALS:
public:
int m_index;
- static QHash<QObject*, QmlGraphicsVisualItemModelAttached*> attachedProperties;
+ static QHash<QObject*, QDeclarativeVisualItemModelAttached*> attachedProperties;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsVisualModel)
-QML_DECLARE_TYPE(QmlGraphicsVisualItemModel)
-QML_DECLARE_TYPEINFO(QmlGraphicsVisualItemModel, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(QmlGraphicsVisualDataModel)
+QML_DECLARE_TYPE(QDeclarativeVisualModel)
+QML_DECLARE_TYPE(QDeclarativeVisualItemModel)
+QML_DECLARE_TYPEINFO(QDeclarativeVisualItemModel, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPE(QDeclarativeVisualDataModel)
QT_END_HEADER
-#endif // QMLGRAPHICSVISUALDATAMODEL_H
+#endif // QDECLARATIVEVISUALDATAMODEL_H
diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qdeclarativewebview.cpp
index 7d9bf52..a2b16ba 100644
--- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativewebview.cpp
@@ -39,14 +39,14 @@
**
****************************************************************************/
-#include "qmlgraphicswebview_p.h"
-#include "qmlgraphicswebview_p_p.h"
+#include "qdeclarativewebview_p.h"
+#include "qdeclarativewebview_p_p.h"
-#include "qmlgraphicspainteditem_p_p.h"
+#include "qdeclarativepainteditem_p_p.h"
-#include <qml.h>
-#include <qmlengine.h>
-#include <qmlstate_p.h>
+#include <qdeclarative.h>
+#include <qdeclarativeengine.h>
+#include <qdeclarativestate_p.h>
#include <QDebug>
#include <QPen>
@@ -67,14 +67,14 @@ QT_BEGIN_NAMESPACE
static const int MAX_DOUBLECLICK_TIME=500; // XXX need better gesture system
-class QmlGraphicsWebViewPrivate : public QmlGraphicsPaintedItemPrivate
+class QDeclarativeWebViewPrivate : public QDeclarativePaintedItemPrivate
{
- Q_DECLARE_PUBLIC(QmlGraphicsWebView)
+ Q_DECLARE_PUBLIC(QDeclarativeWebView)
public:
- QmlGraphicsWebViewPrivate()
- : QmlGraphicsPaintedItemPrivate(), page(0), preferredwidth(0), preferredheight(0),
- progress(1.0), status(QmlGraphicsWebView::Null), pending(PendingNone),
+ QDeclarativeWebViewPrivate()
+ : QDeclarativePaintedItemPrivate(), page(0), preferredwidth(0), preferredheight(0),
+ progress(1.0), status(QDeclarativeWebView::Null), pending(PendingNone),
newWindowComponent(0), newWindowParent(0),
pressTime(400),
rendering(true)
@@ -86,24 +86,24 @@ public:
int preferredwidth, preferredheight;
qreal progress;
- QmlGraphicsWebView::Status status;
+ QDeclarativeWebView::Status status;
QString statusText;
enum { PendingNone, PendingUrl, PendingHtml, PendingContent } pending;
QUrl pending_url;
QString pending_string;
QByteArray pending_data;
- mutable QmlGraphicsWebSettings settings;
- QmlComponent *newWindowComponent;
- QmlGraphicsItem *newWindowParent;
+ mutable QDeclarativeWebSettings settings;
+ QDeclarativeComponent *newWindowComponent;
+ QDeclarativeItem *newWindowParent;
QBasicTimer pressTimer;
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();
+ static void windowObjects_append(QDeclarativeListProperty<QObject> *prop, QObject *o) {
+ static_cast<QDeclarativeWebViewPrivate *>(prop->data)->windowObjects.append(o);
+ static_cast<QDeclarativeWebViewPrivate *>(prop->data)->updateWindowObjects();
}
void updateWindowObjects();
@@ -113,7 +113,7 @@ public:
};
/*!
- \qmlclass WebView QmlGraphicsWebView
+ \qmlclass WebView QDeclarativeWebView
\since 4.7
\brief The WebView item allows you to add web content to a canvas.
\inherits Item
@@ -147,8 +147,8 @@ public:
/*!
\internal
- \class QmlGraphicsWebView
- \brief The QmlGraphicsWebView class allows you to add web content to a QmlView.
+ \class QDeclarativeWebView
+ \brief The QDeclarativeWebView class allows you to add web content to a QDeclarativeView.
A WebView renders web content base on a URL.
@@ -158,24 +158,26 @@ public:
toolbars, etc., those must be implemented around WebView. See the WebBrowser example
for a demonstration of this.
- A QmlGraphicsWebView object can be instantiated in Qml using the tag \l WebView.
+ A QDeclarativeWebView object can be instantiated in Qml using the tag \l WebView.
*/
-QmlGraphicsWebView::QmlGraphicsWebView(QmlGraphicsItem *parent)
- : QmlGraphicsPaintedItem(*(new QmlGraphicsWebViewPrivate), parent)
+QDeclarativeWebView::QDeclarativeWebView(QDeclarativeItem *parent)
+ : QDeclarativePaintedItem(*(new QDeclarativeWebViewPrivate), parent)
{
init();
}
-QmlGraphicsWebView::~QmlGraphicsWebView()
+QDeclarativeWebView::~QDeclarativeWebView()
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
delete d->page;
}
-void QmlGraphicsWebView::init()
+void QDeclarativeWebView::init()
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
+
+ QWebSettings::enablePersistentStorage();
setAcceptHoverEvents(true);
setAcceptedMouseButtons(Qt::LeftButton);
@@ -184,30 +186,30 @@ void QmlGraphicsWebView::init()
d->page = 0;
}
-void QmlGraphicsWebView::componentComplete()
+void QDeclarativeWebView::componentComplete()
{
- QmlGraphicsPaintedItem::componentComplete();
- Q_D(QmlGraphicsWebView);
+ QDeclarativePaintedItem::componentComplete();
+ Q_D(QDeclarativeWebView);
switch (d->pending) {
- case QmlGraphicsWebViewPrivate::PendingUrl:
+ case QDeclarativeWebViewPrivate::PendingUrl:
setUrl(d->pending_url);
break;
- case QmlGraphicsWebViewPrivate::PendingHtml:
+ case QDeclarativeWebViewPrivate::PendingHtml:
setHtml(d->pending_string, d->pending_url);
break;
- case QmlGraphicsWebViewPrivate::PendingContent:
+ case QDeclarativeWebViewPrivate::PendingContent:
setContent(d->pending_data, d->pending_string, d->pending_url);
break;
default:
break;
}
- d->pending = QmlGraphicsWebViewPrivate::PendingNone;
+ d->pending = QDeclarativeWebViewPrivate::PendingNone;
d->updateWindowObjects();
}
-QmlGraphicsWebView::Status QmlGraphicsWebView::status() const
+QDeclarativeWebView::Status QDeclarativeWebView::status() const
{
- Q_D(const QmlGraphicsWebView);
+ Q_D(const QDeclarativeWebView);
return d->status;
}
@@ -219,15 +221,15 @@ QmlGraphicsWebView::Status QmlGraphicsWebView::status() const
If you just want to know when progress gets to 1, use
WebView::onLoadFinished() or WebView::onLoadFailed() instead.
*/
-qreal QmlGraphicsWebView::progress() const
+qreal QDeclarativeWebView::progress() const
{
- Q_D(const QmlGraphicsWebView);
+ Q_D(const QDeclarativeWebView);
return d->progress;
}
-void QmlGraphicsWebView::doLoadStarted()
+void QDeclarativeWebView::doLoadStarted()
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
if (!d->url.isEmpty()) {
d->status = Loading;
@@ -236,18 +238,18 @@ void QmlGraphicsWebView::doLoadStarted()
emit loadStarted();
}
-void QmlGraphicsWebView::doLoadProgress(int p)
+void QDeclarativeWebView::doLoadProgress(int p)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
if (d->progress == p/100.0)
return;
d->progress = p/100.0;
emit progressChanged();
}
-void QmlGraphicsWebView::pageUrlChanged()
+void QDeclarativeWebView::pageUrlChanged()
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
page()->setViewportSize(QSize(
d->preferredwidth>0 ? d->preferredwidth : width(),
@@ -264,9 +266,9 @@ void QmlGraphicsWebView::pageUrlChanged()
}
}
-void QmlGraphicsWebView::doLoadFinished(bool ok)
+void QDeclarativeWebView::doLoadFinished(bool ok)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
if (title().isEmpty())
pageUrlChanged(); // XXX bug 232556 - pages with no title never get urlChanged()
@@ -291,15 +293,15 @@ void QmlGraphicsWebView::doLoadFinished(bool ok)
The url is always absolute (QML will resolve relative URL strings in the context
of the containing QML document).
*/
-QUrl QmlGraphicsWebView::url() const
+QUrl QDeclarativeWebView::url() const
{
- Q_D(const QmlGraphicsWebView);
+ Q_D(const QDeclarativeWebView);
return d->url;
}
-void QmlGraphicsWebView::setUrl(const QUrl &url)
+void QDeclarativeWebView::setUrl(const QUrl &url)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
if (url == d->url)
return;
@@ -327,15 +329,15 @@ void QmlGraphicsWebView::setUrl(const QUrl &url)
\qmlproperty int WebView::preferredWidth
This property holds the ideal width for displaying the current URL.
*/
-int QmlGraphicsWebView::preferredWidth() const
+int QDeclarativeWebView::preferredWidth() const
{
- Q_D(const QmlGraphicsWebView);
+ Q_D(const QDeclarativeWebView);
return d->preferredwidth;
}
-void QmlGraphicsWebView::setPreferredWidth(int iw)
+void QDeclarativeWebView::setPreferredWidth(int iw)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
if (d->preferredwidth == iw) return;
d->preferredwidth = iw;
//expandToWebPage();
@@ -347,14 +349,14 @@ void QmlGraphicsWebView::setPreferredWidth(int iw)
This property holds the ideal height for displaying the current URL.
This only affects the area zoomed by heuristicZoom().
*/
-int QmlGraphicsWebView::preferredHeight() const
+int QDeclarativeWebView::preferredHeight() const
{
- Q_D(const QmlGraphicsWebView);
+ Q_D(const QDeclarativeWebView);
return d->preferredheight;
}
-void QmlGraphicsWebView::setPreferredHeight(int ih)
+void QDeclarativeWebView::setPreferredHeight(int ih)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
if (d->preferredheight == ih) return;
d->preferredheight = ih;
emit preferredHeightChanged();
@@ -369,31 +371,31 @@ void QmlGraphicsWebView::setPreferredHeight(int ih)
Note that this JavaScript does \e not have any access to QML objects
except as made available as windowObjects.
*/
-QVariant QmlGraphicsWebView::evaluateJavaScript(const QString &scriptSource)
+QVariant QDeclarativeWebView::evaluateJavaScript(const QString &scriptSource)
{
return this->page()->mainFrame()->evaluateJavaScript(scriptSource);
}
-void QmlGraphicsWebView::focusChanged(bool hasFocus)
+void QDeclarativeWebView::focusChanged(bool hasFocus)
{
QFocusEvent e(hasFocus ? QEvent::FocusIn : QEvent::FocusOut);
page()->event(&e);
- QmlGraphicsItem::focusChanged(hasFocus);
+ QDeclarativeItem::focusChanged(hasFocus);
}
-void QmlGraphicsWebView::initialLayout()
+void QDeclarativeWebView::initialLayout()
{
// nothing useful to do at this point
}
-void QmlGraphicsWebView::noteContentsSizeChanged(const QSize&)
+void QDeclarativeWebView::noteContentsSizeChanged(const QSize&)
{
expandToWebPage();
}
-void QmlGraphicsWebView::expandToWebPage()
+void QDeclarativeWebView::expandToWebPage()
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
QSize cs = page()->mainFrame()->contentsSize();
if (cs.width() < d->preferredwidth)
cs.setWidth(d->preferredwidth);
@@ -410,15 +412,15 @@ void QmlGraphicsWebView::expandToWebPage()
setContentsSize(cs);
}
-void QmlGraphicsWebView::geometryChanged(const QRectF &newGeometry,
+void QDeclarativeWebView::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
if (newGeometry.size() != oldGeometry.size())
expandToWebPage();
- QmlGraphicsPaintedItem::geometryChanged(newGeometry, oldGeometry);
+ QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry);
}
-void QmlGraphicsWebView::paintPage(const QRect& r)
+void QDeclarativeWebView::paintPage(const QRect& r)
{
dirtyCache(r);
update();
@@ -446,58 +448,60 @@ void QmlGraphicsWebView::paintPage(const QRect& r)
If Javascript is not enabled for this page, then this property does nothing.
*/
-QmlListProperty<QObject> QmlGraphicsWebView::javaScriptWindowObjects()
+QDeclarativeListProperty<QObject> QDeclarativeWebView::javaScriptWindowObjects()
{
- Q_D(QmlGraphicsWebView);
- return QmlListProperty<QObject>(this, d, &QmlGraphicsWebViewPrivate::windowObjects_append);
+ Q_D(QDeclarativeWebView);
+ return QDeclarativeListProperty<QObject>(this, d, &QDeclarativeWebViewPrivate::windowObjects_append);
}
-QmlGraphicsWebViewAttached *QmlGraphicsWebView::qmlAttachedProperties(QObject *o)
+QDeclarativeWebViewAttached *QDeclarativeWebView::qmlAttachedProperties(QObject *o)
{
- return new QmlGraphicsWebViewAttached(o);
+ return new QDeclarativeWebViewAttached(o);
}
-void QmlGraphicsWebViewPrivate::updateWindowObjects()
+void QDeclarativeWebViewPrivate::updateWindowObjects()
{
- Q_Q(QmlGraphicsWebView);
+ Q_Q(QDeclarativeWebView);
if (!q->isComponentComplete() || !page)
return;
for (int ii = 0; ii < windowObjects.count(); ++ii) {
QObject *object = windowObjects.at(ii);
- QmlGraphicsWebViewAttached *attached = static_cast<QmlGraphicsWebViewAttached *>(qmlAttachedPropertiesObject<QmlGraphicsWebView>(object));
+ QDeclarativeWebViewAttached *attached = static_cast<QDeclarativeWebViewAttached *>(qmlAttachedPropertiesObject<QDeclarativeWebView>(object));
if (attached && !attached->windowObjectName().isEmpty()) {
page->mainFrame()->addToJavaScriptWindowObject(attached->windowObjectName(), object);
}
}
}
-bool QmlGraphicsWebView::renderingEnabled() const
+bool QDeclarativeWebView::renderingEnabled() const
{
- Q_D(const QmlGraphicsWebView);
+ Q_D(const QDeclarativeWebView);
return d->rendering;
}
-void QmlGraphicsWebView::setRenderingEnabled(bool enabled)
+void QDeclarativeWebView::setRenderingEnabled(bool enabled)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
if (d->rendering == enabled)
return;
d->rendering = enabled;
+ emit renderingEnabledChanged();
+
setCacheFrozen(!enabled);
if (enabled)
clearCache();
}
-void QmlGraphicsWebView::drawContents(QPainter *p, const QRect &r)
+void QDeclarativeWebView::drawContents(QPainter *p, const QRect &r)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
if (d->rendering)
page()->mainFrame()->render(p,r);
}
-QMouseEvent *QmlGraphicsWebView::sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e)
+QMouseEvent *QDeclarativeWebView::sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e)
{
QEvent::Type t;
switch(e->type()) {
@@ -520,7 +524,7 @@ QMouseEvent *QmlGraphicsWebView::sceneMouseEventToMouseEvent(QGraphicsSceneMouse
return me;
}
-QMouseEvent *QmlGraphicsWebView::sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *e)
+QMouseEvent *QDeclarativeWebView::sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *e)
{
QEvent::Type t = QEvent::MouseMove;
@@ -537,7 +541,7 @@ QMouseEvent *QmlGraphicsWebView::sceneHoverMoveEventToMouseEvent(QGraphicsSceneH
emits this signals.
*/
-void QmlGraphicsWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
QMouseEvent *me = sceneMouseEventToMouseEvent(event);
emit doubleClick(me->x(),me->y());
@@ -559,9 +563,9 @@ void QmlGraphicsWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
If such a zoom exists, emits zoomTo(zoom,centerX,centerY) and returns true; otherwise,
no signal is emitted and returns false.
*/
-bool QmlGraphicsWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom)
+bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
if (contentsScale() >= maxzoom/zoomFactor())
return false;
qreal ozf = contentsScale();
@@ -588,21 +592,24 @@ bool QmlGraphicsWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom)
Defaults to 400ms. Set to 0 to always grab and pass move events to
the web engine.
*/
-int QmlGraphicsWebView::pressGrabTime() const
+int QDeclarativeWebView::pressGrabTime() const
{
- Q_D(const QmlGraphicsWebView);
+ Q_D(const QDeclarativeWebView);
return d->pressTime;
}
-void QmlGraphicsWebView::setPressGrabTime(int ms)
+void QDeclarativeWebView::setPressGrabTime(int ms)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
+ if (d->pressTime == ms)
+ return;
d->pressTime = ms;
+ emit pressGrabTimeChanged();
}
-void QmlGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeWebView::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
setFocus (true);
QMouseEvent *me = sceneMouseEventToMouseEvent(event);
@@ -631,13 +638,13 @@ void QmlGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent *event)
);
delete me;
if (!event->isAccepted()) {
- QmlGraphicsPaintedItem::mousePressEvent(event);
+ QDeclarativePaintedItem::mousePressEvent(event);
}
}
-void QmlGraphicsWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
QMouseEvent *me = sceneMouseEventToMouseEvent(event);
page()->event(me);
@@ -655,15 +662,15 @@ void QmlGraphicsWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
);
delete me;
if (!event->isAccepted()) {
- QmlGraphicsPaintedItem::mouseReleaseEvent(event);
+ QDeclarativePaintedItem::mouseReleaseEvent(event);
}
setKeepMouseGrab(false);
ungrabMouse();
}
-void QmlGraphicsWebView::timerEvent(QTimerEvent *event)
+void QDeclarativeWebView::timerEvent(QTimerEvent *event)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
if (event->timerId() == d->pressTimer.timerId()) {
d->pressTimer.stop();
grabMouse();
@@ -671,9 +678,9 @@ void QmlGraphicsWebView::timerEvent(QTimerEvent *event)
}
}
-void QmlGraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+void QDeclarativeWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
QMouseEvent *me = sceneMouseEventToMouseEvent(event);
if (d->pressTimer.isActive()) {
@@ -698,10 +705,10 @@ void QmlGraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
delete me;
if (!event->isAccepted())
- QmlGraphicsPaintedItem::mouseMoveEvent(event);
+ QDeclarativePaintedItem::mouseMoveEvent(event);
}
-void QmlGraphicsWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event)
+void QDeclarativeWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event)
{
QMouseEvent *me = sceneHoverMoveEventToMouseEvent(event);
page()->event(me);
@@ -714,24 +721,24 @@ void QmlGraphicsWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event)
);
delete me;
if (!event->isAccepted())
- QmlGraphicsPaintedItem::hoverMoveEvent(event);
+ QDeclarativePaintedItem::hoverMoveEvent(event);
}
-void QmlGraphicsWebView::keyPressEvent(QKeyEvent* event)
+void QDeclarativeWebView::keyPressEvent(QKeyEvent* event)
{
page()->event(event);
if (!event->isAccepted())
- QmlGraphicsPaintedItem::keyPressEvent(event);
+ QDeclarativePaintedItem::keyPressEvent(event);
}
-void QmlGraphicsWebView::keyReleaseEvent(QKeyEvent* event)
+void QDeclarativeWebView::keyReleaseEvent(QKeyEvent* event)
{
page()->event(event);
if (!event->isAccepted())
- QmlGraphicsPaintedItem::keyReleaseEvent(event);
+ QDeclarativePaintedItem::keyReleaseEvent(event);
}
-bool QmlGraphicsWebView::sceneEvent(QEvent *event)
+bool QDeclarativeWebView::sceneEvent(QEvent *event)
{
if (event->type() == QEvent::KeyPress) {
QKeyEvent *k = static_cast<QKeyEvent *>(event);
@@ -743,7 +750,7 @@ bool QmlGraphicsWebView::sceneEvent(QEvent *event)
}
}
}
- return QmlGraphicsPaintedItem::sceneEvent(event);
+ return QDeclarativePaintedItem::sceneEvent(event);
}
@@ -751,7 +758,7 @@ bool QmlGraphicsWebView::sceneEvent(QEvent *event)
\qmlproperty action WebView::back
This property holds the action for causing the previous URL in the history to be displayed.
*/
-QAction *QmlGraphicsWebView::backAction() const
+QAction *QDeclarativeWebView::backAction() const
{
return page()->action(QWebPage::Back);
}
@@ -760,7 +767,7 @@ QAction *QmlGraphicsWebView::backAction() const
\qmlproperty action WebView::forward
This property holds the action for causing the next URL in the history to be displayed.
*/
-QAction *QmlGraphicsWebView::forwardAction() const
+QAction *QDeclarativeWebView::forwardAction() const
{
return page()->action(QWebPage::Forward);
}
@@ -769,7 +776,7 @@ QAction *QmlGraphicsWebView::forwardAction() const
\qmlproperty action WebView::reload
This property holds the action for reloading with the current URL
*/
-QAction *QmlGraphicsWebView::reloadAction() const
+QAction *QDeclarativeWebView::reloadAction() const
{
return page()->action(QWebPage::Reload);
}
@@ -778,7 +785,7 @@ QAction *QmlGraphicsWebView::reloadAction() const
\qmlproperty action WebView::stop
This property holds the action for stopping loading with the current URL
*/
-QAction *QmlGraphicsWebView::stopAction() const
+QAction *QDeclarativeWebView::stopAction() const
{
return page()->action(QWebPage::Stop);
}
@@ -789,7 +796,7 @@ QAction *QmlGraphicsWebView::stopAction() const
By default, this property contains an empty string.
*/
-QString QmlGraphicsWebView::title() const
+QString QDeclarativeWebView::title() const
{
return page()->mainFrame()->title();
}
@@ -800,7 +807,7 @@ QString QmlGraphicsWebView::title() const
\qmlproperty pixmap WebView::icon
This property holds the icon associated with the web page currently viewed
*/
-QPixmap QmlGraphicsWebView::icon() const
+QPixmap QDeclarativeWebView::icon() const
{
return page()->mainFrame()->icon().pixmap(QSize(256,256));
}
@@ -810,9 +817,9 @@ QPixmap QmlGraphicsWebView::icon() const
\qmlproperty real WebView::zoomFactor
This property holds the multiplier used to scale the contents of a Web page.
*/
-void QmlGraphicsWebView::setZoomFactor(qreal factor)
+void QDeclarativeWebView::setZoomFactor(qreal factor)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
if (factor == page()->mainFrame()->zoomFactor())
return;
@@ -825,7 +832,7 @@ void QmlGraphicsWebView::setZoomFactor(qreal factor)
emit zoomFactorChanged();
}
-qreal QmlGraphicsWebView::zoomFactor() const
+qreal QDeclarativeWebView::zoomFactor() const
{
return page()->mainFrame()->zoomFactor();
}
@@ -836,32 +843,32 @@ qreal QmlGraphicsWebView::zoomFactor() const
This property is the current status suggested by the current web page. In a web browser,
such status is often shown in some kind of status bar.
*/
-void QmlGraphicsWebView::setStatusText(const QString& s)
+void QDeclarativeWebView::setStatusText(const QString& s)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
d->statusText = s;
emit statusTextChanged();
}
-void QmlGraphicsWebView::windowObjectCleared()
+void QDeclarativeWebView::windowObjectCleared()
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
d->updateWindowObjects();
}
-QString QmlGraphicsWebView::statusText() const
+QString QDeclarativeWebView::statusText() const
{
- Q_D(const QmlGraphicsWebView);
+ Q_D(const QDeclarativeWebView);
return d->statusText;
}
-QWebPage *QmlGraphicsWebView::page() const
+QWebPage *QDeclarativeWebView::page() const
{
- Q_D(const QmlGraphicsWebView);
+ Q_D(const QDeclarativeWebView);
if (!d->page) {
- QmlGraphicsWebView *self = const_cast<QmlGraphicsWebView*>(this);
- QWebPage *wp = new QmlGraphicsWebPage(self);
+ QDeclarativeWebView *self = const_cast<QDeclarativeWebView*>(this);
+ QWebPage *wp = new QDeclarativeWebPage(self);
// QML items don't default to having a background,
// even though most we pages will set one anyway.
@@ -922,16 +929,16 @@ QWebPage *QmlGraphicsWebView::page() const
}
\endqml
*/
-QmlGraphicsWebSettings *QmlGraphicsWebView::settingsObject() const
+QDeclarativeWebSettings *QDeclarativeWebView::settingsObject() const
{
- Q_D(const QmlGraphicsWebView);
+ Q_D(const QDeclarativeWebView);
d->settings.s = page()->settings();
return &d->settings;
}
-void QmlGraphicsWebView::setPage(QWebPage *page)
+void QDeclarativeWebView::setPage(QWebPage *page)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
if (d->page == page)
return;
if (d->page) {
@@ -950,6 +957,7 @@ void QmlGraphicsWebView::setPage(QWebPage *page)
connect(d->page,SIGNAL(repaintRequested(QRect)),this,SLOT(paintPage(QRect)));
connect(d->page->mainFrame(),SIGNAL(urlChanged(QUrl)),this,SLOT(pageUrlChanged()));
connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
+ connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(iconChanged()));
connect(d->page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged()));
connect(d->page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(noteContentsSizeChanged(QSize)));
connect(d->page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout()));
@@ -988,14 +996,14 @@ void QmlGraphicsWebView::setPage(QWebPage *page)
(WebView::onLoadFinished() will be emitted on success).
*/
-void QmlGraphicsWebView::load(const QNetworkRequest &request,
+void QDeclarativeWebView::load(const QNetworkRequest &request,
QNetworkAccessManager::Operation operation,
const QByteArray &body)
{
page()->mainFrame()->load(request, operation, body);
}
-QString QmlGraphicsWebView::html() const
+QString QDeclarativeWebView::html() const
{
return page()->mainFrame()->toHtml();
}
@@ -1012,9 +1020,9 @@ QString QmlGraphicsWebView::html() const
}
\endqml
*/
-void QmlGraphicsWebView::setHtml(const QString &html, const QUrl &baseUrl)
+void QDeclarativeWebView::setHtml(const QString &html, const QUrl &baseUrl)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
page()->setViewportSize(QSize(
d->preferredwidth>0 ? d->preferredwidth : width(),
d->preferredheight>0 ? d->preferredheight : height()));
@@ -1025,11 +1033,12 @@ void QmlGraphicsWebView::setHtml(const QString &html, const QUrl &baseUrl)
d->pending_url = baseUrl;
d->pending_string = html;
}
+ emit htmlChanged();
}
-void QmlGraphicsWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl)
+void QDeclarativeWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
page()->setViewportSize(QSize(
d->preferredwidth>0 ? d->preferredwidth : width(),
d->preferredheight>0 ? d->preferredheight : height()));
@@ -1044,19 +1053,19 @@ void QmlGraphicsWebView::setContent(const QByteArray &data, const QString &mimeT
}
}
-QWebHistory *QmlGraphicsWebView::history() const
+QWebHistory *QDeclarativeWebView::history() const
{
return page()->history();
}
-QWebSettings *QmlGraphicsWebView::settings() const
+QWebSettings *QDeclarativeWebView::settings() const
{
return page()->settings();
}
-QmlGraphicsWebView *QmlGraphicsWebView::createWindow(QWebPage::WebWindowType type)
+QDeclarativeWebView *QDeclarativeWebView::createWindow(QWebPage::WebWindowType type)
{
- Q_D(QmlGraphicsWebView);
+ Q_D(QDeclarativeWebView);
switch (type) {
case QWebPage::WebBrowserWindow: {
if (!d->newWindowComponent && d->newWindowParent)
@@ -1064,17 +1073,17 @@ QmlGraphicsWebView *QmlGraphicsWebView::createWindow(QWebPage::WebWindowType typ
else if (d->newWindowComponent && !d->newWindowParent)
qWarning("WebView::newWindowParent not set - WebView::newWindowComponent ignored");
else if (d->newWindowComponent && d->newWindowParent) {
- QmlGraphicsWebView *webview = 0;
- QmlContext *windowContext = new QmlContext(qmlContext(this));
+ QDeclarativeWebView *webview = 0;
+ QDeclarativeContext *windowContext = new QDeclarativeContext(qmlContext(this));
QObject *nobj = d->newWindowComponent->create(windowContext);
if (nobj) {
windowContext->setParent(nobj);
- QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem *>(nobj);
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item) {
delete nobj;
} else {
- webview = item->findChild<QmlGraphicsWebView*>();
+ webview = item->findChild<QDeclarativeWebView*>();
if (!webview) {
delete item;
} else {
@@ -1108,17 +1117,19 @@ QmlGraphicsWebView *QmlGraphicsWebView::createWindow(QWebPage::WebWindowType typ
The parent of the new window is set by newWindowParent. It must be set.
*/
-QmlComponent *QmlGraphicsWebView::newWindowComponent() const
+QDeclarativeComponent *QDeclarativeWebView::newWindowComponent() const
{
- Q_D(const QmlGraphicsWebView);
+ Q_D(const QDeclarativeWebView);
return d->newWindowComponent;
}
-void QmlGraphicsWebView::setNewWindowComponent(QmlComponent *newWindow)
+void QDeclarativeWebView::setNewWindowComponent(QDeclarativeComponent *newWindow)
{
- Q_D(QmlGraphicsWebView);
- delete d->newWindowComponent;
+ Q_D(QDeclarativeWebView);
+ if (newWindow == d->newWindowComponent)
+ return;
d->newWindowComponent = newWindow;
+ emit newWindowComponentChanged();
}
@@ -1129,17 +1140,25 @@ void QmlGraphicsWebView::setNewWindowComponent(QmlComponent *newWindow)
\sa newWindowComponent
*/
-QmlGraphicsItem *QmlGraphicsWebView::newWindowParent() const
+QDeclarativeItem *QDeclarativeWebView::newWindowParent() const
{
- Q_D(const QmlGraphicsWebView);
+ Q_D(const QDeclarativeWebView);
return d->newWindowParent;
}
-void QmlGraphicsWebView::setNewWindowParent(QmlGraphicsItem *parent)
+void QDeclarativeWebView::setNewWindowParent(QDeclarativeItem *parent)
{
- Q_D(QmlGraphicsWebView);
- delete d->newWindowParent;
+ Q_D(QDeclarativeWebView);
+ if (parent == d->newWindowParent)
+ return;
+ if (d->newWindowParent && parent) {
+ QList<QGraphicsItem *> children = d->newWindowParent->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ children.at(i)->setParentItem(parent);
+ }
+ }
d->newWindowParent = parent;
+ emit newWindowParentChanged();
}
/*!
@@ -1148,7 +1167,7 @@ void QmlGraphicsWebView::setNewWindowParent(QmlGraphicsItem *parent)
May return an area larger in the case when no smaller element is at the position.
*/
-QRect QmlGraphicsWebView::elementAreaAt(int x, int y, int maxwidth, int maxheight) const
+QRect QDeclarativeWebView::elementAreaAt(int x, int y, int maxwidth, int maxheight) const
{
QWebHitTestResult hit = page()->mainFrame()->hitTestContent(QPoint(x,y));
QRect rv = hit.boundingRect();
@@ -1164,26 +1183,26 @@ QRect QmlGraphicsWebView::elementAreaAt(int x, int y, int maxwidth, int maxheigh
/*!
\internal
- \class QmlGraphicsWebPage
- \brief The QmlGraphicsWebPage class is a QWebPage that can create QML plugins.
+ \class QDeclarativeWebPage
+ \brief The QDeclarativeWebPage class is a QWebPage that can create QML plugins.
- \sa QmlGraphicsWebView
+ \sa QDeclarativeWebView
*/
-QmlGraphicsWebPage::QmlGraphicsWebPage(QmlGraphicsWebView *parent) :
+QDeclarativeWebPage::QDeclarativeWebPage(QDeclarativeWebView *parent) :
QWebPage(parent)
{
}
-QmlGraphicsWebPage::~QmlGraphicsWebPage()
+QDeclarativeWebPage::~QDeclarativeWebPage()
{
}
-void QmlGraphicsWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID)
+void QDeclarativeWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID)
{
qWarning() << sourceID << ':' << lineNumber << ':' << message;
}
-QString QmlGraphicsWebPage::chooseFile(QWebFrame *originatingFrame, const QString& oldFile)
+QString QDeclarativeWebPage::chooseFile(QWebFrame *originatingFrame, const QString& oldFile)
{
// Not supported (it's modal)
Q_UNUSED(originatingFrame)
@@ -1191,13 +1210,13 @@ QString QmlGraphicsWebPage::chooseFile(QWebFrame *originatingFrame, const QStrin
return oldFile;
}
-void QmlGraphicsWebPage::javaScriptAlert(QWebFrame *originatingFrame, const QString& msg)
+void QDeclarativeWebPage::javaScriptAlert(QWebFrame *originatingFrame, const QString& msg)
{
Q_UNUSED(originatingFrame)
emit viewItem()->alert(msg);
}
-bool QmlGraphicsWebPage::javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg)
+bool QDeclarativeWebPage::javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg)
{
// Not supported (it's modal)
Q_UNUSED(originatingFrame)
@@ -1205,7 +1224,7 @@ bool QmlGraphicsWebPage::javaScriptConfirm(QWebFrame *originatingFrame, const QS
return false;
}
-bool QmlGraphicsWebPage::javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result)
+bool QDeclarativeWebPage::javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result)
{
// Not supported (it's modal)
Q_UNUSED(originatingFrame)
@@ -1237,17 +1256,17 @@ public:
}
return dsp;
}
- QWidget_Dummy_Plugin(const QUrl& url, QmlGraphicsWebView *view, const QStringList &paramNames, const QStringList &paramValues) :
+ QWidget_Dummy_Plugin(const QUrl& url, QDeclarativeWebView *view, const QStringList &paramNames, const QStringList &paramValues) :
QWidget(dummy_shared_parent()),
propertyNames(paramNames),
propertyValues(paramValues),
webview(view)
{
- QmlEngine *engine = qmlEngine(webview);
- component = new QmlComponent(engine, url, this);
+ QDeclarativeEngine *engine = qmlEngine(webview);
+ component = new QDeclarativeComponent(engine, url, this);
item = 0;
if (component->isLoading())
- connect(component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(qmlLoaded()));
+ connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(qmlLoaded()));
else
qmlLoaded();
}
@@ -1260,7 +1279,7 @@ public Q_SLOTS:
qWarning() << component->errors();
return;
}
- item = qobject_cast<QmlGraphicsItem*>(component->create(qmlContext(webview)));
+ item = qobject_cast<QDeclarativeItem*>(component->create(qmlContext(webview)));
item->setParent(webview);
QString jsObjName;
for (int i=0; i<propertyNames.count(); ++i) {
@@ -1289,26 +1308,26 @@ public Q_SLOTS:
}
private:
- QmlComponent *component;
- QmlGraphicsItem *item;
+ QDeclarativeComponent *component;
+ QDeclarativeItem *item;
QStringList propertyNames, propertyValues;
- QmlGraphicsWebView *webview;
+ QDeclarativeWebView *webview;
};
-QmlGraphicsWebView *QmlGraphicsWebPage::viewItem()
+QDeclarativeWebView *QDeclarativeWebPage::viewItem()
{
- return static_cast<QmlGraphicsWebView*>(parent());
+ return static_cast<QDeclarativeWebView*>(parent());
}
-QObject *QmlGraphicsWebPage::createPlugin(const QString &, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues)
+QObject *QDeclarativeWebPage::createPlugin(const QString &, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues)
{
QUrl comp = qmlContext(viewItem())->resolvedUrl(url);
return new QWidget_Dummy_Plugin(comp,viewItem(),paramNames,paramValues);
}
-QWebPage *QmlGraphicsWebPage::createWindow(WebWindowType type)
+QWebPage *QDeclarativeWebPage::createWindow(WebWindowType type)
{
- QmlGraphicsWebView *newView = viewItem()->createWindow(type);
+ QDeclarativeWebView *newView = viewItem()->createWindow(type);
if (newView)
return newView->page();
return 0;
@@ -1316,4 +1335,4 @@ QWebPage *QmlGraphicsWebPage::createWindow(WebWindowType type)
QT_END_NAMESPACE
-#include <qmlgraphicswebview.moc>
+#include <qdeclarativewebview.moc>
diff --git a/src/declarative/graphicsitems/qmlgraphicswebview_p.h b/src/declarative/graphicsitems/qdeclarativewebview_p.h
index 30ba0e4..a65aab3 100644
--- a/src/declarative/graphicsitems/qmlgraphicswebview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativewebview_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSWEBVIEW_H
-#define QMLGRAPHICSWEBVIEW_H
+#ifndef QDECLARATIVEWEBVIEW_H
+#define QDECLARATIVEWEBVIEW_H
-#include "qmlgraphicspainteditem_p.h"
+#include "qdeclarativepainteditem_p.h"
#include <QtGui/QAction>
#include <QtCore/QUrl>
@@ -57,16 +57,16 @@ class QWebSettings;
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsWebViewPrivate;
+class QDeclarativeWebViewPrivate;
class QNetworkRequest;
-class QmlGraphicsWebView;
+class QDeclarativeWebView;
-class Q_DECLARATIVE_EXPORT QmlGraphicsWebPage : public QWebPage
+class Q_DECLARATIVE_EXPORT QDeclarativeWebPage : public QWebPage
{
Q_OBJECT
public:
- explicit QmlGraphicsWebPage(QmlGraphicsWebView *parent);
- ~QmlGraphicsWebPage();
+ explicit QDeclarativeWebPage(QDeclarativeWebView *parent);
+ ~QDeclarativeWebPage();
protected:
QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues);
QWebPage *createWindow(WebWindowType type);
@@ -77,16 +77,16 @@ protected:
bool javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result);
private:
- QmlGraphicsWebView *viewItem();
+ QDeclarativeWebView *viewItem();
};
-class QmlGraphicsWebViewAttached;
-class QmlGraphicsWebSettings;
+class QDeclarativeWebViewAttached;
+class QDeclarativeWebSettings;
//### TODO: browser plugins
-class Q_DECLARATIVE_EXPORT QmlGraphicsWebView : public QmlGraphicsPaintedItem
+class Q_DECLARATIVE_EXPORT QDeclarativeWebView : public QDeclarativePaintedItem
{
Q_OBJECT
@@ -97,9 +97,9 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsWebView : public QmlGraphicsPaintedItem
Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged)
Q_PROPERTY(QString statusText READ statusText NOTIFY statusTextChanged)
- Q_PROPERTY(QString html READ html WRITE setHtml)
+ Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged)
- Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime)
+ Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime NOTIFY pressGrabTimeChanged)
Q_PROPERTY(int preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged)
Q_PROPERTY(int preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged)
@@ -112,18 +112,18 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsWebView : public QmlGraphicsPaintedItem
Q_PROPERTY(QAction* forward READ forwardAction CONSTANT)
Q_PROPERTY(QAction* stop READ stopAction CONSTANT)
- Q_PROPERTY(QmlGraphicsWebSettings* settings READ settingsObject CONSTANT)
+ Q_PROPERTY(QDeclarativeWebSettings* settings READ settingsObject CONSTANT)
- Q_PROPERTY(QmlListProperty<QObject> javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT)
+ Q_PROPERTY(QDeclarativeListProperty<QObject> javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT)
- Q_PROPERTY(QmlComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent)
- Q_PROPERTY(QmlGraphicsItem* newWindowParent READ newWindowParent WRITE setNewWindowParent)
+ Q_PROPERTY(QDeclarativeComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent NOTIFY newWindowComponentChanged)
+ Q_PROPERTY(QDeclarativeItem* newWindowParent READ newWindowParent WRITE setNewWindowParent NOTIFY newWindowParentChanged)
- Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled)
+ Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged)
public:
- QmlGraphicsWebView(QmlGraphicsItem *parent=0);
- ~QmlGraphicsWebView();
+ QDeclarativeWebView(QDeclarativeItem *parent=0);
+ ~QDeclarativeWebView();
QUrl url() const;
void setUrl(const QUrl &);
@@ -169,19 +169,19 @@ public:
QWebHistory *history() const;
QWebSettings *settings() const;
- QmlGraphicsWebSettings *settingsObject() const;
+ QDeclarativeWebSettings *settingsObject() const;
bool renderingEnabled() const;
void setRenderingEnabled(bool);
- QmlListProperty<QObject> javaScriptWindowObjects();
+ QDeclarativeListProperty<QObject> javaScriptWindowObjects();
- static QmlGraphicsWebViewAttached *qmlAttachedProperties(QObject *);
+ static QDeclarativeWebViewAttached *qmlAttachedProperties(QObject *);
- QmlComponent *newWindowComponent() const;
- void setNewWindowComponent(QmlComponent *newWindow);
- QmlGraphicsItem *newWindowParent() const;
- void setNewWindowParent(QmlGraphicsItem *newWindow);
+ QDeclarativeComponent *newWindowComponent() const;
+ void setNewWindowComponent(QDeclarativeComponent *newWindow);
+ QDeclarativeItem *newWindowParent() const;
+ void setNewWindowParent(QDeclarativeItem *newWindow);
Q_SIGNALS:
void preferredWidthChanged();
@@ -192,7 +192,12 @@ Q_SIGNALS:
void titleChanged(const QString&);
void iconChanged();
void statusTextChanged();
+ void htmlChanged();
+ void pressGrabTimeChanged();
void zoomFactorChanged();
+ void newWindowComponentChanged();
+ void newWindowParentChanged();
+ void renderingEnabledChanged();
void loadStarted();
void loadFinished();
@@ -234,24 +239,24 @@ protected:
const QRectF &oldGeometry);
virtual void focusChanged(bool);
virtual bool sceneEvent(QEvent *event);
- QmlGraphicsWebView *createWindow(QWebPage::WebWindowType type);
+ QDeclarativeWebView *createWindow(QWebPage::WebWindowType type);
private:
void init();
virtual void componentComplete();
- Q_DISABLE_COPY(QmlGraphicsWebView)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsWebView)
+ Q_DISABLE_COPY(QDeclarativeWebView)
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeWebView)
QMouseEvent *sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *);
QMouseEvent *sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *);
- friend class QmlGraphicsWebPage;
+ friend class QDeclarativeWebPage;
};
-class QmlGraphicsWebViewAttached : public QObject
+class QDeclarativeWebViewAttached : public QObject
{
Q_OBJECT
Q_PROPERTY(QString windowObjectName READ windowObjectName WRITE setWindowObjectName)
public:
- QmlGraphicsWebViewAttached(QObject *parent)
+ QDeclarativeWebViewAttached(QObject *parent)
: QObject(parent)
{
}
@@ -273,8 +278,8 @@ private:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsWebView)
-QML_DECLARE_TYPEINFO(QmlGraphicsWebView, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPE(QDeclarativeWebView)
+QML_DECLARE_TYPEINFO(QDeclarativeWebView, QML_HAS_ATTACHED_PROPERTIES)
QT_END_HEADER
diff --git a/src/declarative/graphicsitems/qmlgraphicswebview_p_p.h b/src/declarative/graphicsitems/qdeclarativewebview_p_p.h
index e132cae..258b472 100644
--- a/src/declarative/graphicsitems/qmlgraphicswebview_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativewebview_p_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSWEBVIEW_P_H
-#define QMLGRAPHICSWEBVIEW_P_H
+#ifndef QDECLARATIVEWEBVIEW_P_H
+#define QDECLARATIVEWEBVIEW_P_H
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtWebKit/QWebPage>
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlGraphicsWebSettings : public QObject {
+class QDeclarativeWebSettings : public QObject {
Q_OBJECT
Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily)
@@ -84,7 +84,7 @@ class QmlGraphicsWebSettings : public QObject {
Q_PROPERTY(bool localContentCanAccessRemoteUrls READ localContentCanAccessRemoteUrls WRITE setLocalContentCanAccessRemoteUrls)
public:
- QmlGraphicsWebSettings() {}
+ QDeclarativeWebSettings() {}
QString standardFontFamily() const { return s->fontFamily(QWebSettings::StandardFont); }
void setStandardFontFamily(const QString& f) { s->setFontFamily(QWebSettings::StandardFont,f); }
@@ -144,7 +144,7 @@ public:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlGraphicsWebSettings)
+QML_DECLARE_TYPE(QDeclarativeWebSettings)
QT_END_HEADER
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem_p.h b/src/declarative/graphicsitems/qmlgraphicsitem_p.h
deleted file mode 100644
index 4860b83..0000000
--- a/src/declarative/graphicsitems/qmlgraphicsitem_p.h
+++ /dev/null
@@ -1,471 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 QMLGRAPHICSITEM_P_H
-#define QMLGRAPHICSITEM_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 "qmlgraphicsitem.h"
-
-#include "qmlgraphicsanchors_p.h"
-#include "qmlgraphicsanchors_p_p.h"
-#include "qmlgraphicsitemchangelistener_p.h"
-#include <private/qpodvector_p.h>
-
-#include "../util/qmlstate_p.h"
-#include "../util/qmlnullablevalue_p_p.h"
-#include <qml.h>
-#include <qmlcontext.h>
-
-#include <QtCore/qlist.h>
-#include <QtCore/qdebug.h>
-
-#include <private/qgraphicsitem_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QNetworkReply;
-class QmlGraphicsItemKeyFilter;
-
-//### merge into private?
-class QmlGraphicsContents : public QObject
-{
- Q_OBJECT
-public:
- QmlGraphicsContents();
-
- QRectF rectF() const;
-
- void setItem(QmlGraphicsItem *item);
-
-public Q_SLOTS:
- void calcHeight();
- void calcWidth();
-
-Q_SIGNALS:
- void rectChanged();
-
-private:
- QmlGraphicsItem *m_item;
- qreal m_x;
- qreal m_y;
- qreal m_width;
- qreal m_height;
-};
-
-class QmlGraphicsItemPrivate : public QGraphicsItemPrivate
-{
- Q_DECLARE_PUBLIC(QmlGraphicsItem)
-
-public:
- QmlGraphicsItemPrivate()
- : _anchors(0), _contents(0),
- _baselineOffset(0),
- _anchorLines(0),
- _stateGroup(0), origin(QmlGraphicsItem::Center),
- widthValid(false), heightValid(false),
- _componentComplete(true), _keepMouse(false),
- smooth(false), keyHandler(0),
- width(0), height(0), implicitWidth(0), implicitHeight(0)
- {
- QGraphicsItemPrivate::acceptedMouseButtons = 0;
- QGraphicsItemPrivate::flags = QGraphicsItem::GraphicsItemFlags(
- QGraphicsItem::ItemHasNoContents
- | QGraphicsItem::ItemIsFocusable
- | QGraphicsItem::ItemNegativeZStacksBehindParent);
-
- }
-
- void init(QmlGraphicsItem *parent)
- {
- Q_Q(QmlGraphicsItem);
-
- if (parent)
- q->setParentItem(parent);
- _baselineOffset.invalidate();
- mouseSetsFocus = false;
- }
-
- QString _id;
-
- // data property
- static void data_append(QmlListProperty<QObject> *, QObject *);
-
- // resources property
- static QObject *resources_at(QmlListProperty<QObject> *, int);
- static void resources_append(QmlListProperty<QObject> *, QObject *);
- static int resources_count(QmlListProperty<QObject> *);
-
- // children property
- static QmlGraphicsItem *children_at(QmlListProperty<QmlGraphicsItem> *, int);
- static void children_append(QmlListProperty<QmlGraphicsItem> *, QmlGraphicsItem *);
- static int children_count(QmlListProperty<QmlGraphicsItem> *);
-
- // transform property
- 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) {
- Q_Q(QmlGraphicsItem);
- _anchors = new QmlGraphicsAnchors(q);
- if (!_componentComplete)
- _anchors->classBegin();
- }
- return _anchors;
- }
- QmlGraphicsAnchors *_anchors;
- QmlGraphicsContents *_contents;
-
- QmlNullableValue<qreal> _baselineOffset;
-
- struct AnchorLines {
- AnchorLines(QmlGraphicsItem *);
- QmlGraphicsAnchorLine left;
- QmlGraphicsAnchorLine right;
- QmlGraphicsAnchorLine hCenter;
- QmlGraphicsAnchorLine top;
- QmlGraphicsAnchorLine bottom;
- QmlGraphicsAnchorLine vCenter;
- QmlGraphicsAnchorLine baseline;
- };
- mutable AnchorLines *_anchorLines;
- AnchorLines *anchorLines() const {
- Q_Q(const QmlGraphicsItem);
- if (!_anchorLines) _anchorLines =
- new AnchorLines(const_cast<QmlGraphicsItem *>(q));
- return _anchorLines;
- }
-
- enum ChangeType {
- Geometry = 0x01,
- SiblingOrder = 0x02,
- Visibility = 0x04,
- Opacity = 0x08,
- Destroyed = 0x10
- };
-
- Q_DECLARE_FLAGS(ChangeTypes, ChangeType)
-
- struct ChangeListener {
- ChangeListener(QmlGraphicsItemChangeListener *l, QmlGraphicsItemPrivate::ChangeTypes t) : listener(l), types(t) {}
- QmlGraphicsItemChangeListener *listener;
- QmlGraphicsItemPrivate::ChangeTypes types;
- bool operator==(const ChangeListener &other) const { return listener == other.listener && types == other.types; }
- };
-
- void addItemChangeListener(QmlGraphicsItemChangeListener *listener, ChangeTypes types) {
- changeListeners.append(ChangeListener(listener, types));
- }
- void removeItemChangeListener(QmlGraphicsItemChangeListener *, ChangeTypes types);
- QPODVector<ChangeListener,4> changeListeners;
-
- QmlStateGroup *states();
- QmlStateGroup *_stateGroup;
-
- QmlGraphicsItem::TransformOrigin origin:4;
- bool widthValid:1;
- bool heightValid:1;
- bool _componentComplete:1;
- bool _keepMouse:1;
- bool smooth:1;
-
- QmlGraphicsItemKeyFilter *keyHandler;
-
- qreal width;
- qreal height;
- qreal implicitWidth;
- qreal implicitHeight;
-
- QPointF computeTransformOrigin() const;
-
- virtual void setPosHelper(const QPointF &pos)
- {
- Q_Q(QmlGraphicsItem);
- QRectF oldGeometry(this->pos.x(), this->pos.y(), width, height);
- QGraphicsItemPrivate::setPosHelper(pos);
- q->geometryChanged(QRectF(this->pos.x(), this->pos.y(), width, height), oldGeometry);
- }
-
- // Reimplemented from QGraphicsItemPrivate
- virtual void subFocusItemChange()
- {
- emit q_func()->wantsFocusChanged();
- }
-
- // Reimplemented from QGraphicsItemPrivate
- virtual void siblingOrderChange()
- {
- Q_Q(QmlGraphicsItem);
- for(int ii = 0; ii < changeListeners.count(); ++ii) {
- const QmlGraphicsItemPrivate::ChangeListener &change = changeListeners.at(ii);
- if (change.types & QmlGraphicsItemPrivate::SiblingOrder) {
- change.listener->itemSiblingOrderChanged(q);
- }
- }
- }
-
- static int consistentTime;
- static QTime currentTime();
- static void Q_DECLARATIVE_EXPORT setConsistentTime(int t);
- static void start(QTime &);
- static int elapsed(QTime &);
- static int restart(QTime &);
-};
-
-/*
- Key filters can be installed on a QmlGraphicsItem, but not removed. Currently they
- are only used by attached objects (which are only destroyed on Item
- destruction), so this isn't a problem. If in future this becomes any form
- of public API, they will have to support removal too.
-*/
-class QmlGraphicsItemKeyFilter
-{
-public:
- QmlGraphicsItemKeyFilter(QmlGraphicsItem * = 0);
- virtual ~QmlGraphicsItemKeyFilter();
-
- virtual void keyPressed(QKeyEvent *event);
- virtual void keyReleased(QKeyEvent *event);
- virtual void inputMethodEvent(QInputMethodEvent *event);
- virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
- virtual void componentComplete();
-
-private:
- QmlGraphicsItemKeyFilter *m_next;
-};
-
-class QmlGraphicsKeyNavigationAttachedPrivate : public QObjectPrivate
-{
-public:
- QmlGraphicsKeyNavigationAttachedPrivate()
- : QObjectPrivate(), left(0), right(0), up(0), down(0) {}
-
- QmlGraphicsItem *left;
- QmlGraphicsItem *right;
- QmlGraphicsItem *up;
- QmlGraphicsItem *down;
-};
-
-class QmlGraphicsKeyNavigationAttached : public QObject, public QmlGraphicsItemKeyFilter
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlGraphicsKeyNavigationAttached)
-
- Q_PROPERTY(QmlGraphicsItem *left READ left WRITE setLeft NOTIFY changed)
- Q_PROPERTY(QmlGraphicsItem *right READ right WRITE setRight NOTIFY changed)
- Q_PROPERTY(QmlGraphicsItem *up READ up WRITE setUp NOTIFY changed)
- Q_PROPERTY(QmlGraphicsItem *down READ down WRITE setDown NOTIFY changed)
-public:
- QmlGraphicsKeyNavigationAttached(QObject * = 0);
-
- QmlGraphicsItem *left() const;
- void setLeft(QmlGraphicsItem *);
- QmlGraphicsItem *right() const;
- void setRight(QmlGraphicsItem *);
- QmlGraphicsItem *up() const;
- void setUp(QmlGraphicsItem *);
- QmlGraphicsItem *down() const;
- void setDown(QmlGraphicsItem *);
-
- static QmlGraphicsKeyNavigationAttached *qmlAttachedProperties(QObject *);
-
-Q_SIGNALS:
- void changed();
-
-private:
- virtual void keyPressed(QKeyEvent *event);
- virtual void keyReleased(QKeyEvent *event);
-};
-
-class QmlGraphicsKeysAttachedPrivate : public QObjectPrivate
-{
-public:
- QmlGraphicsKeysAttachedPrivate()
- : QObjectPrivate(), inPress(false), inRelease(false)
- , inIM(false), enabled(true), imeItem(0), item(0)
- {}
-
- bool isConnected(const char *signalName);
-
- QGraphicsItem *finalFocusProxy(QGraphicsItem *item) const
- {
- QGraphicsItem *fp;
- while ((fp = item->focusProxy()))
- item = fp;
- return item;
- }
-
- //loop detection
- bool inPress:1;
- bool inRelease:1;
- bool inIM:1;
-
- bool enabled : 1;
-
- QGraphicsItem *imeItem;
- QList<QmlGraphicsItem *> targets;
- QmlGraphicsItem *item;
-};
-
-class QmlGraphicsKeysAttached : public QObject, public QmlGraphicsItemKeyFilter
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlGraphicsKeysAttached)
-
- Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
- Q_PROPERTY(QmlListProperty<QmlGraphicsItem> forwardTo READ forwardTo)
-
-public:
- QmlGraphicsKeysAttached(QObject *parent=0);
- ~QmlGraphicsKeysAttached();
-
- bool enabled() const { Q_D(const QmlGraphicsKeysAttached); return d->enabled; }
- void setEnabled(bool enabled) {
- Q_D(QmlGraphicsKeysAttached);
- if (enabled != d->enabled) {
- d->enabled = enabled;
- emit enabledChanged();
- }
- }
-
- QmlListProperty<QmlGraphicsItem> forwardTo() {
- Q_D(QmlGraphicsKeysAttached);
- return QmlListProperty<QmlGraphicsItem>(this, d->targets);
- }
-
- virtual void componentComplete();
-
- static QmlGraphicsKeysAttached *qmlAttachedProperties(QObject *);
-
-Q_SIGNALS:
- void enabledChanged();
- void pressed(QmlGraphicsKeyEvent *event);
- void released(QmlGraphicsKeyEvent *event);
- void digit0Pressed(QmlGraphicsKeyEvent *event);
- void digit1Pressed(QmlGraphicsKeyEvent *event);
- void digit2Pressed(QmlGraphicsKeyEvent *event);
- void digit3Pressed(QmlGraphicsKeyEvent *event);
- void digit4Pressed(QmlGraphicsKeyEvent *event);
- void digit5Pressed(QmlGraphicsKeyEvent *event);
- void digit6Pressed(QmlGraphicsKeyEvent *event);
- void digit7Pressed(QmlGraphicsKeyEvent *event);
- void digit8Pressed(QmlGraphicsKeyEvent *event);
- void digit9Pressed(QmlGraphicsKeyEvent *event);
-
- void leftPressed(QmlGraphicsKeyEvent *event);
- void rightPressed(QmlGraphicsKeyEvent *event);
- void upPressed(QmlGraphicsKeyEvent *event);
- void downPressed(QmlGraphicsKeyEvent *event);
-
- void asteriskPressed(QmlGraphicsKeyEvent *event);
- void numberSignPressed(QmlGraphicsKeyEvent *event);
- void escapePressed(QmlGraphicsKeyEvent *event);
- void returnPressed(QmlGraphicsKeyEvent *event);
- void enterPressed(QmlGraphicsKeyEvent *event);
- void deletePressed(QmlGraphicsKeyEvent *event);
- void spacePressed(QmlGraphicsKeyEvent *event);
- void backPressed(QmlGraphicsKeyEvent *event);
- void cancelPressed(QmlGraphicsKeyEvent *event);
- void selectPressed(QmlGraphicsKeyEvent *event);
- void yesPressed(QmlGraphicsKeyEvent *event);
- void noPressed(QmlGraphicsKeyEvent *event);
- void context1Pressed(QmlGraphicsKeyEvent *event);
- void context2Pressed(QmlGraphicsKeyEvent *event);
- void context3Pressed(QmlGraphicsKeyEvent *event);
- void context4Pressed(QmlGraphicsKeyEvent *event);
- void callPressed(QmlGraphicsKeyEvent *event);
- void hangupPressed(QmlGraphicsKeyEvent *event);
- void flipPressed(QmlGraphicsKeyEvent *event);
- void menuPressed(QmlGraphicsKeyEvent *event);
- void volumeUpPressed(QmlGraphicsKeyEvent *event);
- void volumeDownPressed(QmlGraphicsKeyEvent *event);
-
-private:
- virtual void keyPressed(QKeyEvent *event);
- virtual void keyReleased(QKeyEvent *event);
- virtual void inputMethodEvent(QInputMethodEvent *);
- virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
-
- const QByteArray keyToSignal(int key) {
- QByteArray keySignal;
- if (key >= Qt::Key_0 && key <= Qt::Key_9) {
- keySignal = "digit0Pressed";
- keySignal[5] = '0' + (key - Qt::Key_0);
- } else {
- int i = 0;
- while (sigMap[i].key && sigMap[i].key != key)
- ++i;
- keySignal = sigMap[i].sig;
- }
- return keySignal;
- }
-
- struct SigMap {
- int key;
- const char *sig;
- };
-
- static const SigMap sigMap[];
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QmlGraphicsItemPrivate::ChangeTypes);
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QmlGraphicsKeysAttached)
-QML_DECLARE_TYPEINFO(QmlGraphicsKeysAttached, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(QmlGraphicsKeyNavigationAttached)
-QML_DECLARE_TYPEINFO(QmlGraphicsKeyNavigationAttached, QML_HAS_ATTACHED_PROPERTIES)
-
-#endif // QMLGRAPHICSITEM_P_H
diff --git a/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp b/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp
deleted file mode 100644
index 9263f49..0000000
--- a/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp
+++ /dev/null
@@ -1,167 +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$
-**
-****************************************************************************/
-
-#include "qmlgraphicsitemsmodule_p.h"
-
-#include <QtGui/qaction.h>
-#include <QtGui/qvalidator.h>
-#include <QtGui/qgraphicseffect.h>
-
-#include "qmlgraphicsevents_p_p.h"
-#include "qmlgraphicseffects_p.h"
-#include "qmlgraphicsscalegrid_p_p.h"
-#include "qmlgraphicsanimatedimage_p.h"
-#include "qmlgraphicsborderimage_p.h"
-#include "qmlgraphicspositioners_p.h"
-#include "qmlgraphicsmousearea_p.h"
-#include "qmlgraphicsflickable_p.h"
-#include "qmlgraphicsflickable_p_p.h"
-#include "qmlgraphicsflipable_p.h"
-#include "qmlgraphicsfocuspanel_p.h"
-#include "qmlgraphicsfocusscope_p.h"
-#include "qmlgraphicsgraphicsobjectcontainer_p.h"
-#include "qmlgraphicsgridview_p.h"
-#include "qmlgraphicsimage_p.h"
-#include "qmlgraphicsitem_p.h"
-#include "qmlgraphicslayoutitem_p.h"
-#include "qmlgraphicslistview_p.h"
-#include "qmlgraphicsloader_p.h"
-#include "qmlgraphicsmousearea_p.h"
-#include "qmlgraphicsparticles_p.h"
-#include "qmlgraphicspath_p.h"
-#include "qmlgraphicspathview_p.h"
-#include "qmlgraphicsrectangle_p.h"
-#include "qmlgraphicsrepeater_p.h"
-#include "qmlgraphicstext_p.h"
-#include "qmlgraphicstextedit_p.h"
-#include "qmlgraphicstextinput_p.h"
-#include "qmlgraphicsvisualitemmodel_p.h"
-#ifdef QT_WEBKIT_LIB
-#include "qmlgraphicswebview_p.h"
-#include "qmlgraphicswebview_p_p.h"
-#endif
-#include "qmlgraphicsanchors_p.h"
-
-#define QML_REGISTER_TYPE(URI,VMAJ,VMIN,TYPE,CLASS) \
- qmlRegisterType<CLASS>(#URI, VMAJ, VMIN, #TYPE, #CLASS)
-
-#define QML_REGISTER_NOCREATE_TYPE(CLASS) \
- qmlRegisterType<CLASS>(#CLASS)
-
-void QmlGraphicsItemModule::defineModule()
-{
- QML_REGISTER_TYPE(Qt,4,6,AnimatedImage,QmlGraphicsAnimatedImage);
- QML_REGISTER_TYPE(Qt,4,6,Blur,QGraphicsBlurEffect);
- QML_REGISTER_TYPE(Qt,4,6,BorderImage,QmlGraphicsBorderImage);
- QML_REGISTER_TYPE(Qt,4,6,Colorize,QGraphicsColorizeEffect);
- QML_REGISTER_TYPE(Qt,4,6,Column,QmlGraphicsColumn);
- QML_REGISTER_TYPE(Qt,4,6,Drag,QmlGraphicsDrag);
- QML_REGISTER_TYPE(Qt,4,6,DropShadow,QGraphicsDropShadowEffect);
- QML_REGISTER_TYPE(Qt,4,6,Flickable,QmlGraphicsFlickable);
- QML_REGISTER_TYPE(Qt,4,6,Flipable,QmlGraphicsFlipable);
- QML_REGISTER_TYPE(Qt,4,6,Flow,QmlGraphicsFlow);
- QML_REGISTER_TYPE(Qt,4,6,FocusPanel,QmlGraphicsFocusPanel);
- QML_REGISTER_TYPE(Qt,4,6,FocusScope,QmlGraphicsFocusScope);
- QML_REGISTER_TYPE(Qt,4,6,Gradient,QmlGraphicsGradient);
- QML_REGISTER_TYPE(Qt,4,6,GradientStop,QmlGraphicsGradientStop);
- QML_REGISTER_TYPE(Qt,4,6,GraphicsObjectContainer,QmlGraphicsGraphicsObjectContainer);
- QML_REGISTER_TYPE(Qt,4,6,Grid,QmlGraphicsGrid);
- QML_REGISTER_TYPE(Qt,4,6,GridView,QmlGraphicsGridView);
- QML_REGISTER_TYPE(Qt,4,6,Image,QmlGraphicsImage);
- QML_REGISTER_TYPE(Qt,4,6,Item,QmlGraphicsItem);
- QML_REGISTER_TYPE(Qt,4,6,KeyNavigation,QmlGraphicsKeyNavigationAttached);
- QML_REGISTER_TYPE(Qt,4,6,Keys,QmlGraphicsKeysAttached);
- 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,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);
- QML_REGISTER_TYPE(Qt,4,6,ParticleMotionLinear,QmlGraphicsParticleMotionLinear);
- QML_REGISTER_TYPE(Qt,4,6,ParticleMotionWander,QmlGraphicsParticleMotionWander);
- QML_REGISTER_TYPE(Qt,4,6,Particles,QmlGraphicsParticles);
- QML_REGISTER_TYPE(Qt,4,6,Path,QmlGraphicsPath);
- QML_REGISTER_TYPE(Qt,4,6,PathAttribute,QmlGraphicsPathAttribute);
- QML_REGISTER_TYPE(Qt,4,6,PathCubic,QmlGraphicsPathCubic);
- QML_REGISTER_TYPE(Qt,4,6,PathLine,QmlGraphicsPathLine);
- QML_REGISTER_TYPE(Qt,4,6,PathPercent,QmlGraphicsPathPercent);
- QML_REGISTER_TYPE(Qt,4,6,PathQuad,QmlGraphicsPathQuad);
- QML_REGISTER_TYPE(Qt,4,6,PathView,QmlGraphicsPathView);
- QML_REGISTER_TYPE(Qt,4,6,Pen,QmlGraphicsPen);
- QML_REGISTER_TYPE(Qt,4,6,QIntValidator,QIntValidator);
-#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0))
- QML_REGISTER_TYPE(Qt,4,7,QDoubleValidator,QDoubleValidator);
- QML_REGISTER_TYPE(Qt,4,7,QRegExpValidator,QRegExpValidator);
-#endif
- QML_REGISTER_TYPE(Qt,4,6,Rectangle,QmlGraphicsRectangle);
- QML_REGISTER_TYPE(Qt,4,6,Repeater,QmlGraphicsRepeater);
- QML_REGISTER_TYPE(Qt,4,6,Rotation,QGraphicsRotation);
- QML_REGISTER_TYPE(Qt,4,6,Row,QmlGraphicsRow);
- QML_REGISTER_TYPE(Qt,4,6,Scale,QGraphicsScale);
- QML_REGISTER_TYPE(Qt,4,6,Text,QmlGraphicsText);
- QML_REGISTER_TYPE(Qt,4,6,TextEdit,QmlGraphicsTextEdit);
- QML_REGISTER_TYPE(Qt,4,6,TextInput,QmlGraphicsTextInput);
- QML_REGISTER_TYPE(Qt,4,6,ViewSection,QmlGraphicsViewSection);
- QML_REGISTER_TYPE(Qt,4,6,VisibleArea,QmlGraphicsFlickableVisibleArea);
- QML_REGISTER_TYPE(Qt,4,6,VisualDataModel,QmlGraphicsVisualDataModel);
- QML_REGISTER_TYPE(Qt,4,6,VisualItemModel,QmlGraphicsVisualItemModel);
-#ifdef QT_WEBKIT_LIB
- QML_REGISTER_TYPE(Qt,4,6,WebView,QmlGraphicsWebView);
-#endif
-
- QML_REGISTER_NOCREATE_TYPE(QmlGraphicsAnchors);
- QML_REGISTER_NOCREATE_TYPE(QGraphicsEffect);
- QML_REGISTER_NOCREATE_TYPE(QmlGraphicsKeyEvent);
- QML_REGISTER_NOCREATE_TYPE(QmlGraphicsMouseEvent);
- QML_REGISTER_NOCREATE_TYPE(QGraphicsObject);
- QML_REGISTER_NOCREATE_TYPE(QGraphicsTransform);
- QML_REGISTER_NOCREATE_TYPE(QmlGraphicsPathElement);
- QML_REGISTER_NOCREATE_TYPE(QmlGraphicsCurve);
- QML_REGISTER_NOCREATE_TYPE(QmlGraphicsScaleGrid);
- QML_REGISTER_NOCREATE_TYPE(QValidator);
- QML_REGISTER_NOCREATE_TYPE(QmlGraphicsVisualModel);
- QML_REGISTER_NOCREATE_TYPE(QAction);
-#ifdef QT_WEBKIT_LIB
- QML_REGISTER_NOCREATE_TYPE(QmlGraphicsWebSettings);
-#endif
-}
diff --git a/src/declarative/qml/parser/parser.pri b/src/declarative/qml/parser/parser.pri
index 4530479..fd4361c 100644
--- a/src/declarative/qml/parser/parser.pri
+++ b/src/declarative/qml/parser/parser.pri
@@ -1,21 +1,21 @@
INCLUDEPATH += $$PWD
HEADERS += \
- $$PWD/qmljsast_p.h \
- $$PWD/qmljsastfwd_p.h \
- $$PWD/qmljsastvisitor_p.h \
- $$PWD/qmljsengine_p.h \
- $$PWD/qmljsgrammar_p.h \
- $$PWD/qmljslexer_p.h \
- $$PWD/qmljsmemorypool_p.h \
- $$PWD/qmljsnodepool_p.h \
- $$PWD/qmljsparser_p.h \
- $$PWD/qmljsglobal_p.h
+ $$PWD/qdeclarativejsast_p.h \
+ $$PWD/qdeclarativejsastfwd_p.h \
+ $$PWD/qdeclarativejsastvisitor_p.h \
+ $$PWD/qdeclarativejsengine_p.h \
+ $$PWD/qdeclarativejsgrammar_p.h \
+ $$PWD/qdeclarativejslexer_p.h \
+ $$PWD/qdeclarativejsmemorypool_p.h \
+ $$PWD/qdeclarativejsnodepool_p.h \
+ $$PWD/qdeclarativejsparser_p.h \
+ $$PWD/qdeclarativejsglobal_p.h
SOURCES += \
- $$PWD/qmljsast.cpp \
- $$PWD/qmljsastvisitor.cpp \
- $$PWD/qmljsengine_p.cpp \
- $$PWD/qmljsgrammar.cpp \
- $$PWD/qmljslexer.cpp \
- $$PWD/qmljsparser.cpp
+ $$PWD/qdeclarativejsast.cpp \
+ $$PWD/qdeclarativejsastvisitor.cpp \
+ $$PWD/qdeclarativejsengine_p.cpp \
+ $$PWD/qdeclarativejsgrammar.cpp \
+ $$PWD/qdeclarativejslexer.cpp \
+ $$PWD/qdeclarativejsparser.cpp
diff --git a/src/declarative/qml/parser/qmljs.g b/src/declarative/qml/parser/qdeclarativejs.g
index 90949d5..7cf81b2 100644
--- a/src/declarative/qml/parser/qmljs.g
+++ b/src/declarative/qml/parser/qdeclarativejs.g
@@ -21,9 +21,9 @@
--
----------------------------------------------------------------------------
-%parser QmlJSGrammar
-%decl qmljsparser_p.h
-%impl qmljsparser.cpp
+%parser QDeclarativeJSGrammar
+%decl qdeclarativejsparser_p.h
+%impl qdeclarativejsparser.cpp
%expect 2
%expect-rr 2
@@ -65,6 +65,7 @@
%token T_PUBLIC "public"
%token T_IMPORT "import"
%token T_AS "as"
+%token T_ON "on"
--- feed tokens
%token T_FEED_UI_PROGRAM
@@ -126,10 +127,10 @@
#include <string.h>
-#include "qmljsengine_p.h"
-#include "qmljslexer_p.h"
-#include "qmljsast_p.h"
-#include "qmljsnodepool_p.h"
+#include "qdeclarativejsengine_p.h"
+#include "qdeclarativejslexer_p.h"
+#include "qdeclarativejsast_p.h"
+#include "qdeclarativejsnodepool_p.h"
./
@@ -191,20 +192,20 @@
// Changes will be lost.
//
-#ifndef QMLJSPARSER_P_H
-#define QMLJSPARSER_P_H
+#ifndef QDECLARATIVEJSPARSER_P_H
+#define QDECLARATIVEJSPARSER_P_H
-#include "qmljsglobal_p.h"
-#include "qmljsgrammar_p.h"
-#include "qmljsast_p.h"
-#include "qmljsengine_p.h"
+#include "qdeclarativejsglobal_p.h"
+#include "qdeclarativejsgrammar_p.h"
+#include "qdeclarativejsast_p.h"
+#include "qdeclarativejsengine_p.h"
#include <QtCore/QList>
#include <QtCore/QString>
QT_QML_BEGIN_NAMESPACE
-namespace QmlJS {
+namespace QDeclarativeJS {
class Engine;
class NameId;
@@ -366,7 +367,7 @@ protected:
QList<DiagnosticMessage> diagnostic_messages;
};
-} // end of namespace QmlJS
+} // end of namespace QDeclarativeJS
:/
@@ -374,7 +375,7 @@ protected:
/.
-#include "qmljsparser_p.h"
+#include "qdeclarativejsparser_p.h"
#include <QVarLengthArray>
//
@@ -382,7 +383,7 @@ protected:
// Changes will be lost.
//
-using namespace QmlJS;
+using namespace QDeclarativeJS;
QT_QML_BEGIN_NAMESPACE
@@ -773,6 +774,17 @@ case $rule_number: {
} break;
./
+UiObjectMember: UiQualifiedId T_ON UiQualifiedId UiObjectInitializer ;
+/.
+case $rule_number: {
+ AST::UiObjectBinding *node = makeAstNode<AST::UiObjectBinding> (driver->nodePool(),
+ sym(3).UiQualifiedId, sym(1).UiQualifiedId, sym(4).UiObjectInitializer);
+ node->colonToken = loc(2);
+ node->hasOnToken = true;
+ sym(1).Node = node;
+} break;
+./
+
UiObjectMember: UiQualifiedId T_COLON Block ;
/.case $rule_number:./
@@ -870,8 +882,8 @@ case $rule_number: {
} break;
./
-UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT T_IDENTIFIER T_AUTOMATIC_SEMICOLON ;
-UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT T_IDENTIFIER T_SEMICOLON ;
+UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_AUTOMATIC_SEMICOLON ;
+UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_SEMICOLON ;
/.
case $rule_number: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval);
@@ -885,8 +897,8 @@ case $rule_number: {
} break;
./
-UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_AUTOMATIC_SEMICOLON ;
-UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_SEMICOLON ;
+UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_AUTOMATIC_SEMICOLON ;
+UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ;
/.
case $rule_number: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
@@ -898,8 +910,8 @@ case $rule_number: {
} break;
./
-UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType T_IDENTIFIER T_AUTOMATIC_SEMICOLON ;
-UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType T_IDENTIFIER T_SEMICOLON ;
+UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_AUTOMATIC_SEMICOLON ;
+UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ;
/.
case $rule_number: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval);
@@ -913,8 +925,8 @@ case $rule_number: {
} break;
./
-UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_AUTOMATIC_SEMICOLON ;
-UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_SEMICOLON ;
+UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_AUTOMATIC_SEMICOLON ;
+UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_SEMICOLON ;
/.
case $rule_number: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
@@ -928,8 +940,8 @@ case $rule_number: {
} break;
./
-UiObjectMember: T_READONLY T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_AUTOMATIC_SEMICOLON ;
-UiObjectMember: T_READONLY T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_SEMICOLON ;
+UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_AUTOMATIC_SEMICOLON ;
+UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_SEMICOLON ;
/.
case $rule_number: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
@@ -945,8 +957,8 @@ case $rule_number: {
} break;
./
-UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_AUTOMATIC_SEMICOLON ;
-UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_SEMICOLON ;
+UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_AUTOMATIC_SEMICOLON ;
+UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_SEMICOLON ;
/.
case $rule_number: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
@@ -981,7 +993,7 @@ JsIdentifier: T_IDENTIFIER;
JsIdentifier: T_PROPERTY ;
/.
case $rule_number: {
- QString s = QLatin1String(QmlJSGrammar::spell[T_PROPERTY]);
+ QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_PROPERTY]);
sym(1).sval = driver->intern(s.constData(), s.length());
break;
}
@@ -990,7 +1002,7 @@ case $rule_number: {
JsIdentifier: T_SIGNAL ;
/.
case $rule_number: {
- QString s = QLatin1String(QmlJSGrammar::spell[T_SIGNAL]);
+ QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_SIGNAL]);
sym(1).sval = driver->intern(s.constData(), s.length());
break;
}
@@ -999,7 +1011,16 @@ case $rule_number: {
JsIdentifier: T_READONLY ;
/.
case $rule_number: {
- QString s = QLatin1String(QmlJSGrammar::spell[T_READONLY]);
+ QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_READONLY]);
+ sym(1).sval = driver->intern(s.constData(), s.length());
+ break;
+}
+./
+
+JsIdentifier: T_ON ;
+/.
+case $rule_number: {
+ QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_READONLY]);
sym(1).sval = driver->intern(s.constData(), s.length());
break;
}
@@ -2960,7 +2981,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
yylloc.startColumn += yylloc.length;
yylloc.length = 0;
- //const QString msg = qApp->translate("QmlParser", "Missing `;'");
+ //const QString msg = qApp->translate("QDeclarativeParser", "Missing `;'");
//diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg));
first_token = &token_buffer[0];
@@ -2988,9 +3009,9 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
QString msg;
int token = token_buffer[0].token;
if (token < 0 || token >= TERMINAL_COUNT)
- msg = qApp->translate("QmlParser", "Syntax error");
+ msg = qApp->translate("QDeclarativeParser", "Syntax error");
else
- msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
+ msg = qApp->translate("QDeclarativeParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
action = errorState;
@@ -3018,7 +3039,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
int a = t_action(errorState, *tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
+ const QString msg = qApp->translate("QDeclarativeParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = *tk;
@@ -3042,7 +3063,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
int a = t_action(errorState, tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
+ const QString msg = qApp->translate("QDeclarativeParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = tk;
@@ -3055,7 +3076,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
}
}
- const QString msg = qApp->translate("QmlParser", "Syntax error");
+ const QString msg = qApp->translate("QDeclarativeParser", "Syntax error");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
}
@@ -3071,5 +3092,5 @@ QT_QML_END_NAMESPACE
-#endif // QMLJSPARSER_P_H
+#endif // QDECLARATIVEJSPARSER_P_H
:/
diff --git a/src/declarative/qml/parser/qmljsast.cpp b/src/declarative/qml/parser/qdeclarativejsast.cpp
index d3ceba6..3b569a7 100644
--- a/src/declarative/qml/parser/qmljsast.cpp
+++ b/src/declarative/qml/parser/qdeclarativejsast.cpp
@@ -39,13 +39,13 @@
**
****************************************************************************/
-#include "qmljsast_p.h"
+#include "qdeclarativejsast_p.h"
-#include "qmljsastvisitor_p.h"
+#include "qdeclarativejsastvisitor_p.h"
QT_QML_BEGIN_NAMESPACE
-namespace QmlJS { namespace AST {
+namespace QDeclarativeJS { namespace AST {
void Node::accept(Visitor *visitor)
{
@@ -948,7 +948,7 @@ void UiSourceElement::accept0(Visitor *visitor)
visitor->endVisit(this);
}
-} } // namespace QmlJS::AST
+} } // namespace QDeclarativeJS::AST
QT_QML_END_NAMESPACE
diff --git a/src/declarative/qml/parser/qmljsast_p.h b/src/declarative/qml/parser/qdeclarativejsast_p.h
index 9de733c..c1945ce 100644
--- a/src/declarative/qml/parser/qmljsast_p.h
+++ b/src/declarative/qml/parser/qdeclarativejsast_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLJSAST_P_H
-#define QMLJSAST_P_H
+#ifndef QDECLARATIVEJSAST_P_H
+#define QDECLARATIVEJSAST_P_H
//
// W A R N I N G
@@ -53,14 +53,14 @@
// We mean it.
//
-#include "qmljsastvisitor_p.h"
-#include "qmljsglobal_p.h"
+#include "qdeclarativejsastvisitor_p.h"
+#include "qdeclarativejsglobal_p.h"
#include <QtCore/QString>
QT_QML_BEGIN_NAMESPACE
-#define QMLJS_DECLARE_AST_NODE(name) \
+#define QDECLARATIVEJS_DECLARE_AST_NODE(name) \
enum { K = Kind_##name };
namespace QSOperator // ### rename
@@ -106,7 +106,7 @@ enum Op {
} // namespace QSOperator
-namespace QmlJS {
+namespace QDeclarativeJS {
class NameId;
namespace AST {
@@ -270,7 +270,7 @@ public:
class QML_PARSER_EXPORT UiFormal: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(UiFormal)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiFormal)
UiFormal(NameId *name, NameId *alias = 0)
: name(name), alias(alias)
@@ -295,7 +295,7 @@ public:
class QML_PARSER_EXPORT UiFormalList: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(UiFormalList)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiFormalList)
UiFormalList(UiFormal *formal)
: formal(formal), next(this) {}
@@ -330,7 +330,7 @@ public:
class QML_PARSER_EXPORT UiSignature: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(UiSignature)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiSignature)
UiSignature(UiFormalList *formals = 0)
: formals(formals)
@@ -353,7 +353,7 @@ public:
class QML_PARSER_EXPORT NestedExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(NestedExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(NestedExpression)
NestedExpression(ExpressionNode *expression)
: expression(expression)
@@ -376,7 +376,7 @@ public:
class QML_PARSER_EXPORT ThisExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(ThisExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(ThisExpression)
ThisExpression() { kind = K; }
virtual ~ThisExpression() {}
@@ -396,7 +396,7 @@ public:
class QML_PARSER_EXPORT IdentifierExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(IdentifierExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(IdentifierExpression)
IdentifierExpression(NameId *n):
name (n) { kind = K; }
@@ -419,7 +419,7 @@ public:
class QML_PARSER_EXPORT NullExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(NullExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(NullExpression)
NullExpression() { kind = K; }
virtual ~NullExpression() {}
@@ -439,7 +439,7 @@ public:
class QML_PARSER_EXPORT TrueLiteral: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(TrueLiteral)
+ QDECLARATIVEJS_DECLARE_AST_NODE(TrueLiteral)
TrueLiteral() { kind = K; }
virtual ~TrueLiteral() {}
@@ -459,7 +459,7 @@ public:
class QML_PARSER_EXPORT FalseLiteral: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(FalseLiteral)
+ QDECLARATIVEJS_DECLARE_AST_NODE(FalseLiteral)
FalseLiteral() { kind = K; }
virtual ~FalseLiteral() {}
@@ -479,7 +479,7 @@ public:
class QML_PARSER_EXPORT NumericLiteral: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(NumericLiteral)
+ QDECLARATIVEJS_DECLARE_AST_NODE(NumericLiteral)
NumericLiteral(double v):
value(v) { kind = K; }
@@ -501,7 +501,7 @@ public:
class QML_PARSER_EXPORT StringLiteral: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(StringLiteral)
+ QDECLARATIVEJS_DECLARE_AST_NODE(StringLiteral)
StringLiteral(NameId *v):
value (v) { kind = K; }
@@ -524,7 +524,7 @@ public:
class QML_PARSER_EXPORT RegExpLiteral: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(RegExpLiteral)
+ QDECLARATIVEJS_DECLARE_AST_NODE(RegExpLiteral)
RegExpLiteral(NameId *p, int f):
pattern (p), flags (f) { kind = K; }
@@ -548,7 +548,7 @@ public:
class QML_PARSER_EXPORT ArrayLiteral: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(ArrayLiteral)
+ QDECLARATIVEJS_DECLARE_AST_NODE(ArrayLiteral)
ArrayLiteral(Elision *e):
elements (0), elision (e)
@@ -583,7 +583,7 @@ public:
class QML_PARSER_EXPORT ObjectLiteral: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(ObjectLiteral)
+ QDECLARATIVEJS_DECLARE_AST_NODE(ObjectLiteral)
ObjectLiteral():
properties (0) { kind = K; }
@@ -610,7 +610,7 @@ public:
class QML_PARSER_EXPORT ElementList: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(ElementList)
+ QDECLARATIVEJS_DECLARE_AST_NODE(ElementList)
ElementList(Elision *e, ExpressionNode *expr):
elision (e), expression (expr), next (this)
@@ -645,7 +645,7 @@ public:
class QML_PARSER_EXPORT Elision: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(Elision)
+ QDECLARATIVEJS_DECLARE_AST_NODE(Elision)
Elision():
next (this) { kind = K; }
@@ -676,7 +676,7 @@ public:
class QML_PARSER_EXPORT PropertyNameAndValueList: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(PropertyNameAndValueList)
+ QDECLARATIVEJS_DECLARE_AST_NODE(PropertyNameAndValueList)
PropertyNameAndValueList(PropertyName *n, ExpressionNode *v):
name (n), value (v), next (this)
@@ -712,7 +712,7 @@ public:
class QML_PARSER_EXPORT PropertyName: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(PropertyName)
+ QDECLARATIVEJS_DECLARE_AST_NODE(PropertyName)
PropertyName() { kind = K; }
virtual ~PropertyName() {}
@@ -724,7 +724,7 @@ public:
class QML_PARSER_EXPORT IdentifierPropertyName: public PropertyName
{
public:
- QMLJS_DECLARE_AST_NODE(IdentifierPropertyName)
+ QDECLARATIVEJS_DECLARE_AST_NODE(IdentifierPropertyName)
IdentifierPropertyName(NameId *n):
id (n) { kind = K; }
@@ -740,7 +740,7 @@ public:
class QML_PARSER_EXPORT StringLiteralPropertyName: public PropertyName
{
public:
- QMLJS_DECLARE_AST_NODE(StringLiteralPropertyName)
+ QDECLARATIVEJS_DECLARE_AST_NODE(StringLiteralPropertyName)
StringLiteralPropertyName(NameId *n):
id (n) { kind = K; }
@@ -755,7 +755,7 @@ public:
class QML_PARSER_EXPORT NumericLiteralPropertyName: public PropertyName
{
public:
- QMLJS_DECLARE_AST_NODE(NumericLiteralPropertyName)
+ QDECLARATIVEJS_DECLARE_AST_NODE(NumericLiteralPropertyName)
NumericLiteralPropertyName(double n):
id (n) { kind = K; }
@@ -770,7 +770,7 @@ public:
class QML_PARSER_EXPORT ArrayMemberExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(ArrayMemberExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(ArrayMemberExpression)
ArrayMemberExpression(ExpressionNode *b, ExpressionNode *e):
base (b), expression (e)
@@ -796,7 +796,7 @@ public:
class QML_PARSER_EXPORT FieldMemberExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(FieldMemberExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(FieldMemberExpression)
FieldMemberExpression(ExpressionNode *b, NameId *n):
base (b), name (n)
@@ -822,7 +822,7 @@ public:
class QML_PARSER_EXPORT NewMemberExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(NewMemberExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(NewMemberExpression)
NewMemberExpression(ExpressionNode *b, ArgumentList *a):
base (b), arguments (a)
@@ -849,7 +849,7 @@ public:
class QML_PARSER_EXPORT NewExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(NewExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(NewExpression)
NewExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -872,7 +872,7 @@ public:
class QML_PARSER_EXPORT CallExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(CallExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(CallExpression)
CallExpression(ExpressionNode *b, ArgumentList *a):
base (b), arguments (a)
@@ -898,7 +898,7 @@ public:
class QML_PARSER_EXPORT ArgumentList: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(ArgumentList)
+ QDECLARATIVEJS_DECLARE_AST_NODE(ArgumentList)
ArgumentList(ExpressionNode *e):
expression (e), next (this)
@@ -932,7 +932,7 @@ public:
class QML_PARSER_EXPORT PostIncrementExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(PostIncrementExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(PostIncrementExpression)
PostIncrementExpression(ExpressionNode *b):
base (b) { kind = K; }
@@ -955,7 +955,7 @@ public:
class QML_PARSER_EXPORT PostDecrementExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(PostDecrementExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(PostDecrementExpression)
PostDecrementExpression(ExpressionNode *b):
base (b) { kind = K; }
@@ -978,7 +978,7 @@ public:
class QML_PARSER_EXPORT DeleteExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(DeleteExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(DeleteExpression)
DeleteExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1000,7 +1000,7 @@ public:
class QML_PARSER_EXPORT VoidExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(VoidExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(VoidExpression)
VoidExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1023,7 +1023,7 @@ public:
class QML_PARSER_EXPORT TypeOfExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(TypeOfExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(TypeOfExpression)
TypeOfExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1046,7 +1046,7 @@ public:
class QML_PARSER_EXPORT PreIncrementExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(PreIncrementExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(PreIncrementExpression)
PreIncrementExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1069,7 +1069,7 @@ public:
class QML_PARSER_EXPORT PreDecrementExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(PreDecrementExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(PreDecrementExpression)
PreDecrementExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1092,7 +1092,7 @@ public:
class QML_PARSER_EXPORT UnaryPlusExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(UnaryPlusExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UnaryPlusExpression)
UnaryPlusExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1115,7 +1115,7 @@ public:
class QML_PARSER_EXPORT UnaryMinusExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(UnaryMinusExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UnaryMinusExpression)
UnaryMinusExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1138,7 +1138,7 @@ public:
class QML_PARSER_EXPORT TildeExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(TildeExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(TildeExpression)
TildeExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1161,7 +1161,7 @@ public:
class QML_PARSER_EXPORT NotExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(NotExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(NotExpression)
NotExpression(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1184,7 +1184,7 @@ public:
class QML_PARSER_EXPORT BinaryExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(BinaryExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(BinaryExpression)
BinaryExpression(ExpressionNode *l, int o, ExpressionNode *r):
left (l), op (o), right (r)
@@ -1212,7 +1212,7 @@ public:
class QML_PARSER_EXPORT ConditionalExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(ConditionalExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(ConditionalExpression)
ConditionalExpression(ExpressionNode *e, ExpressionNode *t, ExpressionNode *f):
expression (e), ok (t), ko (f)
@@ -1239,7 +1239,7 @@ public:
class QML_PARSER_EXPORT Expression: public ExpressionNode // ### rename
{
public:
- QMLJS_DECLARE_AST_NODE(Expression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(Expression)
Expression(ExpressionNode *l, ExpressionNode *r):
left (l), right (r) { kind = K; }
@@ -1263,7 +1263,7 @@ public:
class QML_PARSER_EXPORT Block: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(Block)
+ QDECLARATIVEJS_DECLARE_AST_NODE(Block)
Block(StatementList *slist):
statements (slist) { kind = K; }
@@ -1287,7 +1287,7 @@ public:
class QML_PARSER_EXPORT StatementList: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(StatementList)
+ QDECLARATIVEJS_DECLARE_AST_NODE(StatementList)
StatementList(Statement *stmt):
statement (stmt), next (this)
@@ -1320,7 +1320,7 @@ public:
class QML_PARSER_EXPORT VariableStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(VariableStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(VariableStatement)
VariableStatement(VariableDeclarationList *vlist):
declarations (vlist)
@@ -1345,7 +1345,7 @@ public:
class QML_PARSER_EXPORT VariableDeclaration: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(VariableDeclaration)
+ QDECLARATIVEJS_DECLARE_AST_NODE(VariableDeclaration)
VariableDeclaration(NameId *n, ExpressionNode *e):
name (n), expression (e), readOnly(false)
@@ -1365,7 +1365,7 @@ public:
class QML_PARSER_EXPORT VariableDeclarationList: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(VariableDeclarationList)
+ QDECLARATIVEJS_DECLARE_AST_NODE(VariableDeclarationList)
VariableDeclarationList(VariableDeclaration *decl):
declaration (decl), next (this)
@@ -1404,7 +1404,7 @@ public:
class QML_PARSER_EXPORT EmptyStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(EmptyStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(EmptyStatement)
EmptyStatement() { kind = K; }
virtual ~EmptyStatement() {}
@@ -1424,7 +1424,7 @@ public:
class QML_PARSER_EXPORT ExpressionStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(ExpressionStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(ExpressionStatement)
ExpressionStatement(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1447,7 +1447,7 @@ public:
class QML_PARSER_EXPORT IfStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(IfStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(IfStatement)
IfStatement(ExpressionNode *e, Statement *t, Statement *f = 0):
expression (e), ok (t), ko (f)
@@ -1481,7 +1481,7 @@ public:
class QML_PARSER_EXPORT DoWhileStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(DoWhileStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(DoWhileStatement)
DoWhileStatement(Statement *stmt, ExpressionNode *e):
statement (stmt), expression (e)
@@ -1510,7 +1510,7 @@ public:
class QML_PARSER_EXPORT WhileStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(WhileStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(WhileStatement)
WhileStatement(ExpressionNode *e, Statement *stmt):
expression (e), statement (stmt)
@@ -1537,7 +1537,7 @@ public:
class QML_PARSER_EXPORT ForStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(ForStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(ForStatement)
ForStatement(ExpressionNode *i, ExpressionNode *c, ExpressionNode *e, Statement *stmt):
initialiser (i), condition (c), expression (e), statement (stmt)
@@ -1568,7 +1568,7 @@ public:
class QML_PARSER_EXPORT LocalForStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(LocalForStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(LocalForStatement)
LocalForStatement(VariableDeclarationList *vlist, ExpressionNode *c, ExpressionNode *e, Statement *stmt):
declarations (vlist), condition (c), expression (e), statement (stmt)
@@ -1600,7 +1600,7 @@ public:
class QML_PARSER_EXPORT ForEachStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(ForEachStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(ForEachStatement)
ForEachStatement(ExpressionNode *i, ExpressionNode *e, Statement *stmt):
initialiser (i), expression (e), statement (stmt)
@@ -1629,7 +1629,7 @@ public:
class QML_PARSER_EXPORT LocalForEachStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(LocalForEachStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(LocalForEachStatement)
LocalForEachStatement(VariableDeclaration *v, ExpressionNode *e, Statement *stmt):
declaration (v), expression (e), statement (stmt)
@@ -1659,7 +1659,7 @@ public:
class QML_PARSER_EXPORT ContinueStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(ContinueStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(ContinueStatement)
ContinueStatement(NameId *l = 0):
label (l) { kind = K; }
@@ -1684,7 +1684,7 @@ public:
class QML_PARSER_EXPORT BreakStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(BreakStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(BreakStatement)
BreakStatement(NameId *l = 0):
label (l) { kind = K; }
@@ -1709,7 +1709,7 @@ public:
class QML_PARSER_EXPORT ReturnStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(ReturnStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(ReturnStatement)
ReturnStatement(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1733,7 +1733,7 @@ public:
class QML_PARSER_EXPORT WithStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(WithStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(WithStatement)
WithStatement(ExpressionNode *e, Statement *stmt):
expression (e), statement (stmt)
@@ -1760,7 +1760,7 @@ public:
class QML_PARSER_EXPORT CaseBlock: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(CaseBlock)
+ QDECLARATIVEJS_DECLARE_AST_NODE(CaseBlock)
CaseBlock(CaseClauses *c, DefaultClause *d = 0, CaseClauses *r = 0):
clauses (c), defaultClause (d), moreClauses (r)
@@ -1781,7 +1781,7 @@ public:
class QML_PARSER_EXPORT SwitchStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(SwitchStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(SwitchStatement)
SwitchStatement(ExpressionNode *e, CaseBlock *b):
expression (e), block (b)
@@ -1808,7 +1808,7 @@ public:
class QML_PARSER_EXPORT CaseClauses: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(CaseClauses)
+ QDECLARATIVEJS_DECLARE_AST_NODE(CaseClauses)
CaseClauses(CaseClause *c):
clause (c), next (this)
@@ -1841,7 +1841,7 @@ public:
class QML_PARSER_EXPORT CaseClause: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(CaseClause)
+ QDECLARATIVEJS_DECLARE_AST_NODE(CaseClause)
CaseClause(ExpressionNode *e, StatementList *slist):
expression (e), statements (slist)
@@ -1861,7 +1861,7 @@ public:
class QML_PARSER_EXPORT DefaultClause: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(DefaultClause)
+ QDECLARATIVEJS_DECLARE_AST_NODE(DefaultClause)
DefaultClause(StatementList *slist):
statements (slist)
@@ -1880,7 +1880,7 @@ public:
class QML_PARSER_EXPORT LabelledStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(LabelledStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(LabelledStatement)
LabelledStatement(NameId *l, Statement *stmt):
label (l), statement (stmt)
@@ -1906,7 +1906,7 @@ public:
class QML_PARSER_EXPORT ThrowStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(ThrowStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(ThrowStatement)
ThrowStatement(ExpressionNode *e):
expression (e) { kind = K; }
@@ -1930,7 +1930,7 @@ public:
class QML_PARSER_EXPORT Catch: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(Catch)
+ QDECLARATIVEJS_DECLARE_AST_NODE(Catch)
Catch(NameId *n, Block *stmt):
name (n), statement (stmt)
@@ -1952,7 +1952,7 @@ public:
class QML_PARSER_EXPORT Finally: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(Finally)
+ QDECLARATIVEJS_DECLARE_AST_NODE(Finally)
Finally(Block *stmt):
statement (stmt)
@@ -1970,7 +1970,7 @@ public:
class QML_PARSER_EXPORT TryStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(TryStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(TryStatement)
TryStatement(Statement *stmt, Catch *c, Finally *f):
statement (stmt), catchExpression (c), finallyExpression (f)
@@ -2011,7 +2011,7 @@ public:
class QML_PARSER_EXPORT FunctionExpression: public ExpressionNode
{
public:
- QMLJS_DECLARE_AST_NODE(FunctionExpression)
+ QDECLARATIVEJS_DECLARE_AST_NODE(FunctionExpression)
FunctionExpression(NameId *n, FormalParameterList *f, FunctionBody *b):
name (n), formals (f), body (b)
@@ -2042,7 +2042,7 @@ public:
class QML_PARSER_EXPORT FunctionDeclaration: public FunctionExpression
{
public:
- QMLJS_DECLARE_AST_NODE(FunctionDeclaration)
+ QDECLARATIVEJS_DECLARE_AST_NODE(FunctionDeclaration)
FunctionDeclaration(NameId *n, FormalParameterList *f, FunctionBody *b):
FunctionExpression(n, f, b)
@@ -2056,7 +2056,7 @@ public:
class QML_PARSER_EXPORT FormalParameterList: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(FormalParameterList)
+ QDECLARATIVEJS_DECLARE_AST_NODE(FormalParameterList)
FormalParameterList(NameId *n):
name (n), next (this)
@@ -2091,7 +2091,7 @@ public:
class QML_PARSER_EXPORT FunctionBody: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(FunctionBody)
+ QDECLARATIVEJS_DECLARE_AST_NODE(FunctionBody)
FunctionBody(SourceElements *elts):
elements (elts)
@@ -2108,7 +2108,7 @@ public:
class QML_PARSER_EXPORT Program: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(Program)
+ QDECLARATIVEJS_DECLARE_AST_NODE(Program)
Program(SourceElements *elts):
elements (elts)
@@ -2125,7 +2125,7 @@ public:
class QML_PARSER_EXPORT SourceElements: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(SourceElements)
+ QDECLARATIVEJS_DECLARE_AST_NODE(SourceElements)
SourceElements(SourceElement *elt):
element (elt), next (this)
@@ -2158,7 +2158,7 @@ public:
class QML_PARSER_EXPORT SourceElement: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(SourceElement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(SourceElement)
inline SourceElement()
{ kind = K; }
@@ -2169,7 +2169,7 @@ public:
class QML_PARSER_EXPORT FunctionSourceElement: public SourceElement
{
public:
- QMLJS_DECLARE_AST_NODE(FunctionSourceElement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(FunctionSourceElement)
FunctionSourceElement(FunctionDeclaration *f):
declaration (f)
@@ -2186,7 +2186,7 @@ public:
class QML_PARSER_EXPORT StatementSourceElement: public SourceElement
{
public:
- QMLJS_DECLARE_AST_NODE(StatementSourceElement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(StatementSourceElement)
StatementSourceElement(Statement *stmt):
statement (stmt)
@@ -2203,7 +2203,7 @@ public:
class QML_PARSER_EXPORT DebuggerStatement: public Statement
{
public:
- QMLJS_DECLARE_AST_NODE(DebuggerStatement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(DebuggerStatement)
DebuggerStatement()
{ kind = K; }
@@ -2226,7 +2226,7 @@ public:
class QML_PARSER_EXPORT UiProgram: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(UiProgram)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiProgram)
UiProgram(UiImportList *imports, UiObjectMemberList *members)
: imports(imports), members(members)
@@ -2242,7 +2242,7 @@ public:
class QML_PARSER_EXPORT UiQualifiedId: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(UiQualifiedId)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiQualifiedId)
UiQualifiedId(NameId *name)
: next(this), name(name)
@@ -2276,7 +2276,7 @@ public:
class QML_PARSER_EXPORT UiImport: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(UiImport)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiImport)
UiImport(NameId *fileName)
: fileName(fileName), importUri(0), importId(0)
@@ -2309,7 +2309,7 @@ public:
class QML_PARSER_EXPORT UiImportList: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(UiImportList)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiImportList)
UiImportList(UiImport *import)
: import(import),
@@ -2365,7 +2365,7 @@ public:
class QML_PARSER_EXPORT UiObjectMemberList: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(UiObjectMemberList)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiObjectMemberList)
UiObjectMemberList(UiObjectMember *member)
: next(this), member(member)
@@ -2396,7 +2396,7 @@ public:
class QML_PARSER_EXPORT UiArrayMemberList: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(UiArrayMemberList)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiArrayMemberList)
UiArrayMemberList(UiObjectMember *member)
: next(this), member(member)
@@ -2428,7 +2428,7 @@ public:
class QML_PARSER_EXPORT UiObjectInitializer: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(UiObjectInitializer)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiObjectInitializer)
UiObjectInitializer(UiObjectMemberList *members)
: members(members)
@@ -2445,7 +2445,7 @@ public:
class QML_PARSER_EXPORT UiParameterList: public Node
{
public:
- QMLJS_DECLARE_AST_NODE(UiParameterList)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiParameterList)
UiParameterList(NameId *t, NameId *n):
type (t), name (n), next (this)
@@ -2481,7 +2481,7 @@ public:
class QML_PARSER_EXPORT UiPublicMember: public UiObjectMember
{
public:
- QMLJS_DECLARE_AST_NODE(UiPublicMember)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiPublicMember)
UiPublicMember(NameId *memberType,
NameId *name)
@@ -2533,7 +2533,7 @@ public:
class QML_PARSER_EXPORT UiObjectDefinition: public UiObjectMember
{
public:
- QMLJS_DECLARE_AST_NODE(UiObjectDefinition)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiObjectDefinition)
UiObjectDefinition(UiQualifiedId *qualifiedTypeNameId,
UiObjectInitializer *initializer)
@@ -2556,7 +2556,7 @@ public:
class QML_PARSER_EXPORT UiSourceElement: public UiObjectMember
{
public:
- QMLJS_DECLARE_AST_NODE(UiSourceElement)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiSourceElement)
UiSourceElement(Node *sourceElement)
: sourceElement(sourceElement)
@@ -2592,18 +2592,24 @@ public:
class QML_PARSER_EXPORT UiObjectBinding: public UiObjectMember
{
public:
- QMLJS_DECLARE_AST_NODE(UiObjectBinding)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiObjectBinding)
UiObjectBinding(UiQualifiedId *qualifiedId,
UiQualifiedId *qualifiedTypeNameId,
UiObjectInitializer *initializer)
: qualifiedId(qualifiedId),
qualifiedTypeNameId(qualifiedTypeNameId),
- initializer(initializer)
+ initializer(initializer),
+ hasOnToken(false)
{ kind = K; }
virtual SourceLocation firstSourceLocation() const
- { return qualifiedId->identifierToken; }
+ {
+ if (hasOnToken && qualifiedTypeNameId)
+ return qualifiedTypeNameId->identifierToken;
+
+ return qualifiedId->identifierToken;
+ }
virtual SourceLocation lastSourceLocation() const
{ return initializer->rbraceToken; }
@@ -2615,12 +2621,13 @@ public:
UiQualifiedId *qualifiedTypeNameId;
UiObjectInitializer *initializer;
SourceLocation colonToken;
+ bool hasOnToken;
};
class QML_PARSER_EXPORT UiScriptBinding: public UiObjectMember
{
public:
- QMLJS_DECLARE_AST_NODE(UiScriptBinding)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiScriptBinding)
UiScriptBinding(UiQualifiedId *qualifiedId,
Statement *statement)
@@ -2645,7 +2652,7 @@ public:
class QML_PARSER_EXPORT UiArrayBinding: public UiObjectMember
{
public:
- QMLJS_DECLARE_AST_NODE(UiArrayBinding)
+ QDECLARATIVEJS_DECLARE_AST_NODE(UiArrayBinding)
UiArrayBinding(UiQualifiedId *qualifiedId,
UiArrayMemberList *members)
diff --git a/src/declarative/qml/parser/qmljsastfwd_p.h b/src/declarative/qml/parser/qdeclarativejsastfwd_p.h
index 2c42fd9..5a444b7 100644
--- a/src/declarative/qml/parser/qmljsastfwd_p.h
+++ b/src/declarative/qml/parser/qdeclarativejsastfwd_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLJSAST_FWD_P_H
-#define QMLJSAST_FWD_P_H
+#ifndef QDECLARATIVEJSAST_FWD_P_H
+#define QDECLARATIVEJSAST_FWD_P_H
-#include "qmljsglobal_p.h"
+#include "qdeclarativejsglobal_p.h"
#include <QtCore/qglobal.h>
@@ -59,7 +59,7 @@
QT_QML_BEGIN_NAMESPACE
-namespace QmlJS { namespace AST {
+namespace QDeclarativeJS { namespace AST {
class SourceLocation
{
diff --git a/src/declarative/qml/parser/qmljsastvisitor.cpp b/src/declarative/qml/parser/qdeclarativejsastvisitor.cpp
index bd7439c..d8002cf 100644
--- a/src/declarative/qml/parser/qmljsastvisitor.cpp
+++ b/src/declarative/qml/parser/qdeclarativejsastvisitor.cpp
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#include "qmljsastvisitor_p.h"
+#include "qdeclarativejsastvisitor_p.h"
QT_QML_BEGIN_NAMESPACE
-namespace QmlJS { namespace AST {
+namespace QDeclarativeJS { namespace AST {
Visitor::Visitor()
{
@@ -53,6 +53,6 @@ Visitor::~Visitor()
{
}
-} } // namespace QmlJS::AST
+} } // namespace QDeclarativeJS::AST
QT_QML_END_NAMESPACE
diff --git a/src/declarative/qml/parser/qmljsastvisitor_p.h b/src/declarative/qml/parser/qdeclarativejsastvisitor_p.h
index 9007a2c..82abbcf 100644
--- a/src/declarative/qml/parser/qmljsastvisitor_p.h
+++ b/src/declarative/qml/parser/qdeclarativejsastvisitor_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLJSASTVISITOR_P_H
-#define QMLJSASTVISITOR_P_H
+#ifndef QDECLARATIVEJSASTVISITOR_P_H
+#define QDECLARATIVEJSASTVISITOR_P_H
//
// W A R N I N G
@@ -53,12 +53,12 @@
// We mean it.
//
-#include "qmljsastfwd_p.h"
-#include "qmljsglobal_p.h"
+#include "qdeclarativejsastfwd_p.h"
+#include "qdeclarativejsglobal_p.h"
QT_QML_BEGIN_NAMESPACE
-namespace QmlJS { namespace AST {
+namespace QDeclarativeJS { namespace AST {
class QML_PARSER_EXPORT Visitor
{
@@ -104,7 +104,7 @@ public:
virtual void endVisit(UiFormalList *) {}
virtual void endVisit(UiFormal *) {}
- // QmlJS
+ // QDeclarativeJS
virtual bool visit(ThisExpression *) { return true; }
virtual void endVisit(ThisExpression *) {}
@@ -332,4 +332,4 @@ public:
QT_QML_END_NAMESPACE
-#endif // QMLJSASTVISITOR_P_H
+#endif // QDECLARATIVEJSASTVISITOR_P_H
diff --git a/src/declarative/qml/parser/qmljsengine_p.cpp b/src/declarative/qml/parser/qdeclarativejsengine_p.cpp
index 84bb1c5..7d39134 100644
--- a/src/declarative/qml/parser/qmljsengine_p.cpp
+++ b/src/declarative/qml/parser/qdeclarativejsengine_p.cpp
@@ -39,19 +39,19 @@
**
****************************************************************************/
-#include "qmljsengine_p.h"
+#include "qdeclarativejsengine_p.h"
-#include "qmljsglobal_p.h"
-#include "qmljsnodepool_p.h"
+#include "qdeclarativejsglobal_p.h"
+#include "qdeclarativejsnodepool_p.h"
#include <qnumeric.h>
#include <QHash>
QT_QML_BEGIN_NAMESPACE
-namespace QmlJS {
+namespace QDeclarativeJS {
-uint qHash(const QmlJS::NameId &id)
+uint qHash(const QDeclarativeJS::NameId &id)
{ return qHash(id.asString()); }
QString numberToString(double value)
@@ -182,9 +182,9 @@ QSet<NameId> Engine::literals() const
{ return _literals; }
void Engine::addComment(int pos, int len, int line, int col)
-{ if (len > 0) _comments.append(QmlJS::AST::SourceLocation(pos, len, line, col)); }
+{ if (len > 0) _comments.append(QDeclarativeJS::AST::SourceLocation(pos, len, line, col)); }
-QList<QmlJS::AST::SourceLocation> Engine::comments() const
+QList<QDeclarativeJS::AST::SourceLocation> Engine::comments() const
{ return _comments; }
NameId *Engine::intern(const QChar *u, int s)
@@ -207,6 +207,6 @@ void Engine::setNodePool(NodePool *nodePool)
-} // end of namespace QmlJS
+} // end of namespace QDeclarativeJS
QT_QML_END_NAMESPACE
diff --git a/src/declarative/qml/parser/qmljsengine_p.h b/src/declarative/qml/parser/qdeclarativejsengine_p.h
index ebfeb1b..61188f7 100644
--- a/src/declarative/qml/parser/qmljsengine_p.h
+++ b/src/declarative/qml/parser/qdeclarativejsengine_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLJSENGINE_P_H
-#define QMLJSENGINE_P_H
+#ifndef QDECLARATIVEJSENGINE_P_H
+#define QDECLARATIVEJSENGINE_P_H
//
// W A R N I N G
@@ -53,15 +53,15 @@
// We mean it.
//
-#include "qmljsglobal_p.h"
-#include "qmljsastfwd_p.h"
+#include "qdeclarativejsglobal_p.h"
+#include "qdeclarativejsastfwd_p.h"
#include <QString>
#include <QSet>
QT_QML_BEGIN_NAMESPACE
-namespace QmlJS {
+namespace QDeclarativeJS {
class QML_PARSER_EXPORT NameId
{
QString _text;
@@ -84,17 +84,17 @@ public:
{ return _text < other._text; }
};
-uint qHash(const QmlJS::NameId &id);
+uint qHash(const QDeclarativeJS::NameId &id);
-} // end of namespace QmlJS
+} // end of namespace QDeclarativeJS
#if defined(Q_CC_MSVC) && _MSC_VER <= 1300
-//this ensures that code outside QmlJS can use the hash function
+//this ensures that code outside QDeclarativeJS can use the hash function
//it also a workaround for some compilers
-inline uint qHash(const QmlJS::NameId &nameId) { return QmlJS::qHash(nameId); }
+inline uint qHash(const QDeclarativeJS::NameId &nameId) { return QDeclarativeJS::qHash(nameId); }
#endif
-namespace QmlJS {
+namespace QDeclarativeJS {
class Lexer;
class NodePool;
@@ -144,7 +144,7 @@ class QML_PARSER_EXPORT Engine
Lexer *_lexer;
NodePool *_nodePool;
QSet<NameId> _literals;
- QList<QmlJS::AST::SourceLocation> _comments;
+ QList<QDeclarativeJS::AST::SourceLocation> _comments;
public:
Engine();
@@ -153,7 +153,7 @@ public:
QSet<NameId> literals() const;
void addComment(int pos, int len, int line, int col);
- QList<QmlJS::AST::SourceLocation> comments() const;
+ QList<QDeclarativeJS::AST::SourceLocation> comments() const;
NameId *intern(const QChar *u, int s);
@@ -166,8 +166,8 @@ public:
void setNodePool(NodePool *nodePool);
};
-} // end of namespace QmlJS
+} // end of namespace QDeclarativeJS
QT_QML_END_NAMESPACE
-#endif // QMLJSENGINE_P_H
+#endif // QDECLARATIVEJSENGINE_P_H
diff --git a/src/declarative/qml/parser/qmljsglobal_p.h b/src/declarative/qml/parser/qdeclarativejsglobal_p.h
index 4457450..7c901ae 100644
--- a/src/declarative/qml/parser/qmljsglobal_p.h
+++ b/src/declarative/qml/parser/qdeclarativejsglobal_p.h
@@ -38,8 +38,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef QMLJSGLOBAL_P_H
-#define QMLJSGLOBAL_P_H
+#ifndef QDECLARATIVEJSGLOBAL_P_H
+#define QDECLARATIVEJSGLOBAL_P_H
#include <QtCore/qglobal.h>
@@ -47,13 +47,13 @@
# define QT_QML_BEGIN_NAMESPACE
# define QT_QML_END_NAMESPACE
-# ifdef QMLJS_BUILD_DIR
+# ifdef QDECLARATIVEJS_BUILD_DIR
# define QML_PARSER_EXPORT Q_DECL_EXPORT
# elif QML_BUILD_STATIC_LIB
# define QML_PARSER_EXPORT
# else
# define QML_PARSER_EXPORT Q_DECL_IMPORT
-# endif // QMLJS_BUILD_DIR
+# endif // QDECLARATIVEJS_BUILD_DIR
#else // !QT_CREATOR
# define QT_QML_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@@ -61,4 +61,4 @@
# define QML_PARSER_EXPORT
#endif // QT_CREATOR
-#endif // QMLJSGLOBAL_P_H
+#endif // QDECLARATIVEJSGLOBAL_P_H
diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp
new file mode 100644
index 0000000..0677bc5
--- /dev/null
+++ b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp
@@ -0,0 +1,992 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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$
+**
+****************************************************************************/
+
+// This file was generated by qlalr - DO NOT EDIT!
+#include "qdeclarativejsgrammar_p.h"
+
+QT_BEGIN_NAMESPACE
+
+const char *const QDeclarativeJSGrammar::spell [] = {
+ "end of file", "&", "&&", "&=", "break", "case", "catch", ":", ";", "continue",
+ "default", "delete", "/", "/=", "do", ".", "else", "=", "==", "===",
+ "finally", "for", "function", ">=", ">", ">>", ">>=", ">>>", ">>>=", "identifier",
+ "if", "in", "instanceof", "{", "[", "<=", "(", "<", "<<", "<<=",
+ "-", "-=", "--", "new", "!", "!=", "!==", "numeric literal", "|", "|=",
+ "||", "+", "+=", "++", "?", "}", "]", "%", "%=", "return",
+ ")", ";", 0, "*", "*=", "string literal", "property", "signal", "readonly", "switch",
+ "this", "throw", "~", "try", "typeof", "var", "void", "while", "with", "^",
+ "^=", "null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "comment", "public",
+ "import", "as", "on", 0, 0, 0, 0, 0, 0, 0,
+ 0};
+
+const short QDeclarativeJSGrammar::lhs [] = {
+ 101, 101, 101, 101, 101, 101, 102, 108, 108, 111,
+ 111, 113, 112, 112, 112, 112, 112, 112, 112, 112,
+ 115, 110, 109, 118, 118, 119, 119, 120, 120, 117,
+ 106, 106, 106, 106, 106, 106, 106, 106, 126, 126,
+ 126, 127, 127, 128, 128, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 116, 116, 116, 116, 116, 131, 131,
+ 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+ 131, 131, 131, 131, 131, 131, 121, 133, 133, 133,
+ 133, 132, 132, 135, 135, 137, 137, 137, 137, 137,
+ 137, 138, 138, 138, 138, 138, 138, 138, 138, 138,
+ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
+ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
+ 138, 138, 139, 139, 114, 114, 114, 114, 114, 142,
+ 142, 143, 143, 143, 143, 141, 141, 144, 144, 145,
+ 145, 146, 146, 146, 147, 147, 147, 147, 147, 147,
+ 147, 147, 147, 147, 148, 148, 148, 148, 149, 149,
+ 149, 150, 150, 150, 150, 151, 151, 151, 151, 151,
+ 151, 151, 152, 152, 152, 152, 152, 152, 153, 153,
+ 153, 153, 153, 154, 154, 154, 154, 154, 155, 155,
+ 156, 156, 157, 157, 158, 158, 159, 159, 160, 160,
+ 161, 161, 162, 162, 163, 163, 164, 164, 165, 165,
+ 166, 166, 136, 136, 167, 167, 168, 168, 168, 168,
+ 168, 168, 168, 168, 168, 168, 168, 168, 104, 104,
+ 169, 169, 170, 170, 171, 171, 103, 103, 103, 103,
+ 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
+ 103, 122, 183, 183, 182, 182, 130, 130, 184, 184,
+ 185, 185, 187, 187, 186, 188, 191, 189, 189, 192,
+ 190, 190, 123, 124, 124, 125, 125, 172, 172, 172,
+ 172, 172, 172, 172, 173, 173, 173, 173, 174, 174,
+ 174, 174, 175, 175, 176, 178, 193, 193, 196, 196,
+ 194, 194, 197, 195, 177, 177, 177, 179, 179, 180,
+ 180, 180, 198, 199, 181, 181, 129, 140, 203, 203,
+ 200, 200, 201, 201, 204, 107, 205, 205, 105, 105,
+ 202, 202, 134, 134, 206};
+
+const short QDeclarativeJSGrammar::rhs [] = {
+ 2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
+ 2, 1, 2, 2, 3, 3, 5, 5, 4, 4,
+ 2, 0, 1, 1, 2, 1, 3, 2, 3, 2,
+ 1, 5, 4, 4, 3, 3, 3, 3, 1, 1,
+ 1, 0, 1, 2, 4, 6, 6, 3, 3, 7,
+ 7, 4, 4, 5, 5, 6, 6, 7, 7, 7,
+ 7, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 3, 4, 5, 3, 4, 3, 1, 1, 2, 3,
+ 4, 1, 2, 3, 5, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 4, 3, 5, 1,
+ 2, 4, 4, 4, 3, 0, 1, 1, 3, 1,
+ 1, 1, 2, 2, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 1, 3, 3, 3, 1, 3,
+ 3, 1, 3, 3, 3, 1, 3, 3, 3, 3,
+ 3, 3, 1, 3, 3, 3, 3, 3, 1, 3,
+ 3, 3, 3, 1, 3, 3, 3, 3, 1, 3,
+ 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
+ 1, 3, 1, 3, 1, 3, 1, 3, 1, 5,
+ 1, 5, 1, 3, 1, 3, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
+ 0, 1, 1, 3, 0, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 3, 1, 2, 0, 1, 3, 3, 1, 1,
+ 1, 3, 1, 3, 2, 2, 2, 0, 1, 2,
+ 0, 1, 1, 2, 2, 7, 5, 7, 7, 5,
+ 9, 10, 7, 8, 2, 2, 3, 3, 2, 2,
+ 3, 3, 3, 3, 5, 5, 3, 5, 1, 2,
+ 0, 1, 4, 3, 3, 3, 3, 3, 3, 3,
+ 3, 4, 5, 2, 2, 2, 8, 8, 1, 3,
+ 0, 1, 0, 1, 1, 1, 1, 2, 1, 1,
+ 0, 1, 0, 1, 2};
+
+const short QDeclarativeJSGrammar::action_default [] = {
+ 0, 0, 0, 0, 0, 0, 22, 0, 172, 239,
+ 203, 211, 207, 151, 223, 199, 3, 136, 70, 152,
+ 215, 219, 140, 169, 150, 155, 135, 189, 176, 0,
+ 77, 78, 73, 341, 64, 343, 0, 0, 0, 0,
+ 75, 0, 0, 71, 74, 68, 0, 0, 65, 67,
+ 66, 76, 69, 0, 72, 0, 0, 165, 0, 0,
+ 152, 171, 154, 153, 0, 0, 0, 167, 168, 166,
+ 170, 0, 200, 0, 0, 0, 0, 190, 0, 0,
+ 0, 0, 0, 0, 180, 0, 0, 0, 174, 175,
+ 173, 178, 182, 181, 179, 177, 192, 191, 193, 0,
+ 208, 0, 204, 0, 0, 146, 133, 145, 134, 102,
+ 103, 104, 129, 105, 130, 106, 107, 108, 109, 110,
+ 111, 112, 113, 114, 115, 116, 117, 118, 131, 119,
+ 120, 121, 122, 123, 124, 125, 126, 127, 128, 132,
+ 0, 0, 144, 240, 147, 0, 148, 0, 149, 143,
+ 0, 236, 229, 227, 234, 235, 233, 232, 238, 231,
+ 230, 228, 237, 224, 0, 212, 0, 0, 216, 0,
+ 0, 220, 0, 0, 146, 138, 0, 137, 0, 142,
+ 156, 0, 342, 331, 332, 0, 329, 0, 330, 0,
+ 333, 247, 254, 253, 261, 249, 0, 250, 334, 0,
+ 340, 251, 252, 257, 255, 337, 335, 339, 258, 0,
+ 269, 0, 0, 0, 0, 341, 64, 0, 343, 65,
+ 241, 283, 66, 0, 0, 0, 270, 0, 0, 259,
+ 260, 0, 248, 256, 284, 285, 328, 338, 0, 299,
+ 300, 301, 302, 0, 295, 296, 297, 298, 325, 326,
+ 0, 0, 0, 0, 0, 288, 289, 245, 243, 205,
+ 213, 209, 225, 201, 246, 0, 152, 217, 221, 194,
+ 183, 0, 0, 202, 0, 0, 0, 0, 195, 0,
+ 0, 0, 0, 0, 187, 185, 188, 186, 184, 197,
+ 196, 198, 0, 210, 0, 206, 0, 244, 152, 0,
+ 226, 241, 242, 0, 241, 0, 0, 291, 0, 0,
+ 0, 293, 0, 214, 0, 0, 218, 0, 0, 222,
+ 281, 0, 273, 282, 276, 0, 280, 0, 241, 274,
+ 0, 241, 0, 0, 292, 0, 0, 0, 294, 342,
+ 331, 0, 0, 333, 0, 327, 0, 317, 0, 0,
+ 0, 287, 0, 286, 0, 344, 0, 101, 263, 266,
+ 0, 102, 269, 105, 130, 107, 108, 73, 112, 113,
+ 64, 114, 117, 71, 74, 65, 241, 66, 76, 120,
+ 69, 122, 72, 124, 125, 270, 127, 128, 132, 0,
+ 94, 0, 0, 96, 100, 98, 85, 97, 99, 0,
+ 95, 84, 264, 262, 140, 141, 146, 0, 139, 0,
+ 316, 0, 303, 304, 0, 315, 0, 0, 0, 306,
+ 311, 309, 312, 0, 0, 310, 311, 0, 307, 0,
+ 308, 265, 314, 0, 265, 313, 0, 318, 319, 0,
+ 265, 320, 321, 0, 0, 322, 0, 0, 0, 323,
+ 324, 158, 157, 0, 0, 0, 290, 0, 0, 0,
+ 305, 278, 271, 0, 279, 275, 0, 277, 267, 0,
+ 268, 272, 88, 0, 0, 92, 79, 0, 81, 90,
+ 0, 82, 91, 93, 83, 89, 80, 0, 86, 162,
+ 160, 164, 161, 159, 163, 6, 336, 4, 2, 62,
+ 87, 0, 0, 65, 67, 66, 31, 5, 0, 63,
+ 0, 41, 40, 39, 0, 0, 54, 0, 55, 0,
+ 60, 61, 0, 41, 0, 0, 0, 0, 0, 50,
+ 51, 0, 52, 0, 53, 0, 56, 57, 0, 0,
+ 0, 0, 0, 58, 59, 0, 48, 42, 49, 43,
+ 0, 0, 0, 0, 45, 0, 46, 47, 44, 0,
+ 0, 0, 30, 35, 36, 37, 38, 140, 265, 0,
+ 0, 102, 269, 105, 130, 107, 108, 73, 112, 113,
+ 64, 114, 117, 71, 74, 65, 241, 66, 76, 120,
+ 69, 122, 72, 124, 125, 270, 127, 128, 132, 140,
+ 0, 26, 0, 0, 32, 27, 33, 28, 24, 0,
+ 29, 25, 0, 34, 8, 0, 10, 0, 9, 0,
+ 1, 21, 12, 0, 13, 0, 14, 0, 19, 20,
+ 0, 15, 16, 0, 17, 18, 11, 23, 7, 345};
+
+const short QDeclarativeJSGrammar::goto_default [] = {
+ 7, 620, 207, 196, 205, 507, 495, 619, 638, 614,
+ 618, 616, 621, 22, 617, 18, 506, 609, 600, 562,
+ 508, 191, 195, 197, 201, 524, 550, 549, 200, 232,
+ 26, 474, 473, 356, 355, 9, 354, 357, 107, 17,
+ 145, 24, 13, 144, 19, 25, 57, 23, 8, 28,
+ 27, 269, 15, 263, 10, 259, 12, 261, 11, 260,
+ 20, 267, 21, 268, 14, 262, 258, 299, 411, 264,
+ 265, 202, 193, 192, 204, 233, 203, 208, 229, 230,
+ 194, 360, 359, 231, 463, 462, 321, 322, 465, 324,
+ 464, 323, 419, 423, 426, 422, 421, 441, 442, 185,
+ 199, 181, 184, 198, 206, 0};
+
+const short QDeclarativeJSGrammar::action_index [] = {
+ 314, 1273, 2404, 2404, 2307, 1001, 58, 98, 78, -101,
+ 95, 56, 4, 236, -101, 296, 86, -101, -101, 545,
+ 97, 115, 162, 197, -101, -101, -101, 447, 192, 1273,
+ -101, -101, -101, 369, -101, 2113, 1919, 1273, 1273, 1273,
+ -101, 732, 1273, -101, -101, -101, 1273, 1273, -101, -101,
+ -101, -101, -101, 1273, -101, 1273, 1273, -101, 1273, 1273,
+ 81, 195, -101, -101, 1273, 1273, 1273, -101, -101, -101,
+ 185, 1273, 283, 1273, 1273, 1273, 1273, 447, 1273, 1273,
+ 1273, 1273, 1273, 1273, 297, 1273, 1273, 1273, 107, 85,
+ 116, 297, 297, 297, 297, 191, 447, 447, 447, 1273,
+ 74, 1273, 102, 2016, 1273, 1273, -101, -101, -101, -101,
+ -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,
+ -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,
+ -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,
+ 112, 1273, -101, -101, 92, 61, -101, 1273, -101, -101,
+ 1273, -101, -101, -101, -101, -101, -101, -101, -101, -101,
+ -101, -101, -101, -101, 1273, 36, 1273, 1273, 65, 62,
+ 1273, -101, 2016, 1273, 1273, -101, 127, -101, 42, -101,
+ -101, 57, -101, 294, 60, 35, -101, 259, -101, 32,
+ 2404, -101, -101, -101, -101, -101, 200, -101, -101, 33,
+ -101, -101, -101, -101, -101, -101, 2404, -101, -101, 436,
+ -101, 433, 100, 2307, 34, 369, 67, 45, 2598, 71,
+ 1273, -101, 72, 51, 1273, 59, -101, 54, 55, -101,
+ -101, 324, -101, -101, -101, -101, -101, -101, 88, -101,
+ -101, -101, -101, 76, -101, -101, -101, -101, -101, -101,
+ 5, 49, 1273, 104, 84, -101, -101, 1457, -101, 70,
+ 41, 1, -101, 287, 68, 46, 643, 73, 77, 364,
+ 297, 369, 1273, 238, 1273, 1273, 1273, 1273, 341, 1273,
+ 1273, 1273, 1273, 1273, 297, 175, 167, 161, 176, 348,
+ 315, 331, 1273, -13, 1273, 63, 1273, -101, 545, 1273,
+ -101, 1273, 64, 40, 1273, 2, 2307, -101, 1273, 152,
+ 2307, -101, 1273, 69, 1273, 1273, 75, 79, 1273, -101,
+ 44, 149, 66, -101, -101, 1273, -101, 369, 1273, -101,
+ 52, 1273, -54, 2307, -101, 1273, 151, 2307, -101, -29,
+ 369, -41, -11, 2404, -46, -101, 2307, -101, 1273, 131,
+ 2307, -5, 2307, -101, 8, 13, -55, -101, -101, 2307,
+ -51, 360, -2, 352, 119, 1273, 2307, 39, -19, 366,
+ 3, -24, 910, 6, 7, -101, 1367, -101, 11, -16,
+ -4, 1273, -6, -31, 1273, 9, 1273, -12, 17, 1273,
+ -101, 2210, 37, -101, -101, -101, -101, -101, -101, 1273,
+ -101, -101, -101, -101, 258, -101, 1273, -15, -101, 2307,
+ -101, 117, -101, -101, 2307, -101, 1273, 106, 16, -101,
+ 38, -101, 135, 96, 1273, -101, 135, 43, -101, 18,
+ -101, 2307, -101, 101, 2307, -101, 179, -101, -101, 99,
+ 2307, 31, -101, -7, -8, -101, 369, -34, -1, -101,
+ -101, -101, -101, 1273, 124, 2307, -101, 1273, 122, 2307,
+ -101, 25, -101, 207, -101, -101, 1273, -101, -101, 290,
+ -101, -101, -101, 114, 1733, -101, -101, 1826, -101, -101,
+ 1550, -101, -101, -101, -101, -101, -101, 103, -101, -101,
+ -101, -101, -101, -101, -101, -101, 2404, -101, -101, -101,
+ 221, -43, 704, 164, -26, 12, -101, -101, 188, -101,
+ 196, -101, -101, -101, 369, 183, -101, 1273, -101, 165,
+ -101, -101, 170, 0, 369, 160, 10, 369, 113, -101,
+ -101, 215, -101, 1273, -101, 225, -101, -101, 203, 369,
+ 28, 1273, 229, -101, -101, 202, -101, 218, -101, 30,
+ -21, 369, 199, 278, -101, 110, -101, -101, -101, 1640,
+ 1092, 583, -101, -101, -101, -101, -101, 284, 2501, 1919,
+ 14, 388, 29, 424, 93, 1273, 2307, 39, -9, 338,
+ 21, -3, 821, 24, 23, -101, 1367, -101, 48, 20,
+ 47, 1273, 50, 26, 1273, 53, 1273, 27, 22, 264,
+ 120, -101, 15, 813, -101, -101, -101, -101, -101, 1183,
+ -101, -101, 19, -101, -101, 498, -101, 249, -82, 902,
+ -101, -101, 118, 369, -101, 204, -101, 80, -101, -101,
+ 369, -101, -101, 82, -101, -101, -101, -101, -101, -101,
+
+ -106, 17, -83, 19, 24, 228, -106, -106, -106, -106,
+ -106, -106, -106, -106, -106, -106, -106, -106, -106, -49,
+ -106, -106, -106, -106, -106, -106, -106, -106, -106, 101,
+ -106, -106, -106, 2, -106, -106, -2, 29, 107, 166,
+ -106, 204, 183, -106, -106, -106, 174, 169, -106, -106,
+ -106, -106, -106, 145, -106, 141, 137, -106, 152, 161,
+ -106, -106, -106, -106, 163, 158, 157, -106, -106, -106,
+ -106, 132, -106, 142, 138, 187, 178, -106, 167, 181,
+ 81, 82, 85, 83, -106, 93, 114, 96, -106, -106,
+ -106, -106, -106, -106, -106, -106, -106, -106, -106, 170,
+ -106, 74, -106, 109, 80, 51, -106, -106, -106, -106,
+ -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
+ -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
+ -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
+ -106, 25, -106, -106, -106, -106, -106, 41, -106, -106,
+ 50, -106, -106, -106, -106, -106, -106, -106, -106, -106,
+ -106, -106, -106, -106, 98, -106, 104, 43, -106, -106,
+ 42, -106, 221, 64, 117, -106, -106, -106, -106, -106,
+ -106, -106, -106, 54, -106, -106, -106, 55, -106, -106,
+ -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
+ -106, -106, -106, -106, -106, -106, 47, -106, -106, 38,
+ -106, 33, -106, 92, -106, 73, -106, -106, 88, -106,
+ 86, -106, -106, -106, 94, 23, -106, -106, -106, -106,
+ -106, -11, -106, -106, -106, -106, -106, -106, -106, -106,
+ -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
+ -106, -106, 22, -106, -106, -106, -106, 105, -106, -106,
+ -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
+ -106, 7, 235, -106, 249, 219, 216, 222, -106, 124,
+ 125, 123, 122, 116, -106, -106, -106, -106, -106, -106,
+ -106, -106, 191, -106, 232, -106, 225, -106, -106, 231,
+ -106, 156, -106, -106, 130, -106, 91, -106, 5, -106,
+ 8, -106, 233, -106, 200, 189, -106, -106, 198, -106,
+ -106, -106, -106, -106, -106, 245, -106, 108, 95, -106,
+ -106, 298, -106, 195, -106, 89, -106, 71, -106, -106,
+ 120, -106, -106, -5, -106, -106, 52, -106, 53, -106,
+ 56, -106, 60, -106, -106, -106, -106, -106, -106, 39,
+ -106, 37, -106, 49, -106, 133, 69, -106, -106, 59,
+ -106, -106, 102, -106, -106, -106, 79, -106, -106, -106,
+ -106, 62, -106, 45, 67, -106, 75, -106, -106, 44,
+ -106, 1, -106, -106, -106, -106, -106, -106, -106, 46,
+ -106, -106, -106, -106, -106, -106, 115, -106, -106, 66,
+ -106, -106, -106, -106, 70, -106, 77, -106, -106, -106,
+ -106, -106, -9, -106, 72, -106, -38, -106, -106, -106,
+ -106, 97, -106, -106, 99, -106, -106, -106, -106, -106,
+ 40, -51, -106, -106, 36, -106, 34, -106, 63, -106,
+ -106, -106, -106, 35, -106, 48, -106, 58, -106, 57,
+ -106, -106, -106, -106, -106, -106, 28, -106, -106, 90,
+ -106, -106, -106, -106, 65, -106, -106, 159, -106, -106,
+ 61, -106, -106, -106, -106, -106, -106, -106, -106, -106,
+ -106, -106, -106, -106, -106, -106, 87, -106, -106, -106,
+ -106, -106, -13, -106, -106, -106, -106, -106, -106, -106,
+ -18, -106, -106, -106, -10, -106, -106, 0, -106, -106,
+ -106, -106, -106, -106, -4, -12, -106, -6, -106, -106,
+ -106, -106, -106, 3, -106, -106, -106, -106, -23, -14,
+ -106, 11, -106, -106, -106, -106, -106, 15, -106, -106,
+ -106, 16, 18, 14, -106, -106, -106, -106, -106, 292,
+ 399, 180, -106, -106, -106, -106, -106, -106, 26, 286,
+ 20, 21, -106, 30, -106, 177, 10, -106, -106, 31,
+ -106, -106, 193, -106, -106, -106, 32, -106, -106, -106,
+ -106, 27, -106, 13, 76, -106, 68, -106, -106, -106,
+ -106, -106, -106, 230, -106, -106, -106, -106, -106, 290,
+ -106, -106, -3, -106, -106, 6, -106, -106, 4, 270,
+ -106, -106, -106, 9, -106, -106, -106, -106, -106, -106,
+ 12, -106, -106, -106, -106, -106, -106, -106, -106, -106};
+
+const short QDeclarativeJSGrammar::action_info [] = {
+ 401, -123, 440, -121, 403, -129, 333, 340, 615, 345,
+ -96, 352, 348, -118, -100, 389, -126, 257, -99, 342,
+ 416, 391, 343, 510, 453, 440, 448, 257, -96, 446,
+ -100, -118, 440, 348, 527, 541, -129, 525, 552, 555,
+ 538, 545, 466, 424, 399, 408, -110, 560, 560, 420,
+ 431, 444, 560, 457, -121, -99, 416, -123, 457, 440,
+ -126, 325, 306, 453, 272, 190, 294, 164, 187, 170,
+ 257, 272, 141, 430, 346, 312, 296, 312, 409, 414,
+ 294, 348, 251, 101, 99, 252, 318, 416, 236, 292,
+ 453, 457, 440, 183, 141, 189, 71, 335, 639, 164,
+ 147, 304, 179, 71, 99, 443, 427, 301, 434, 141,
+ 0, 141, 141, 331, 141, 0, 0, 292, 58, 444,
+ 141, 149, 477, 62, 0, 58, 0, 314, 603, 59,
+ 141, 315, 141, 172, 63, 141, 59, 247, 246, 141,
+ 424, 629, 628, 635, 634, 256, 255, 58, 615, 242,
+ 241, 428, 173, 101, 249, 248, 58, 327, 59, 141,
+ 141, 249, 248, 488, 254, 166, 418, 59, 142, 167,
+ 478, 557, 556, 141, 530, 529, 604, 172, 413, 412,
+ 249, 248, 459, 177, 455, 172, 85, 141, 86, 511,
+ 517, 350, 85, 523, 86, 559, 173, 64, 174, 87,
+ 85, 85, 86, 86, 173, 87, 406, 64, 141, 64,
+ 328, 337, 310, 87, 87, 469, 85, 85, 86, 86,
+ 0, 560, 533, 0, 0, 511, 521, 520, 511, 87,
+ 87, 0, 511, 141, 0, 513, 172, 141, 547, 513,
+ 438, 437, 65, 0, 518, 516, 512, 511, 66, 0,
+ 512, 103, 65, 0, 65, 173, 274, 275, 66, 0,
+ 66, 235, 234, 548, 546, 632, 631, 0, 470, 468,
+ 104, 513, 105, 172, 513, 0, 534, 532, 513, 172,
+ 561, 0, 512, 276, 277, 512, 537, 536, 34, 512,
+ 544, 543, 173, 513, 406, 630, 625, -87, 173, 172,
+ 174, 73, 74, 0, 512, 274, 275, 34, 0, 0,
+ 626, 624, 0, 0, 73, 74, 0, -87, 173, 34,
+ 174, 0, 85, 34, 86, 48, 50, 49, 75, 76,
+ 0, 0, 276, 277, 0, 87, 0, 0, 279, 280,
+ 623, 75, 76, 0, 48, 50, 49, 281, 0, 0,
+ 282, 45, 283, 34, 279, 280, 48, 50, 49, 0,
+ 48, 50, 49, 281, 279, 280, 282, 34, 283, 0,
+ 45, 279, 280, 281, -341, 0, 282, 0, 283, 0,
+ 281, 34, 45, 282, 0, 283, 45, 279, 280, 34,
+ 48, 50, 49, 0, 0, 34, 281, 0, 34, 282,
+ 0, 283, -341, 0, 48, 50, 49, 6, 5, 4,
+ 1, 3, 2, 245, 244, 0, 45, 34, 48, 50,
+ 49, 240, 239, 0, 0, 0, 48, 50, 49, 0,
+ 45, 0, 48, 50, 49, 48, 50, 49, 0, 0,
+ 0, 0, 0, 0, 45, 0, 0, 0, 0, 240,
+ 239, 0, 45, 34, 48, 50, 49, 0, 45, 0,
+ 0, 45, 34, 0, 0, 34, 0, 0, 0, 0,
+ 78, 79, 0, 0, 0, 0, 0, 0, 80, 81,
+ 45, 0, 82, 0, 83, 245, 244, 0, 0, 0,
+ 48, 50, 49, 0, 245, 244, 0, 240, 239, 48,
+ 50, 49, 48, 50, 49, 0, 0, 0, 0, 0,
+ 30, 31, 0, 0, 0, 0, 45, 0, 0, 0,
+ 33, 0, 0, 0, 0, 45, 0, 34, 45, 0,
+ 0, 35, 36, 0, 37, 0, 0, 0, 0, 0,
+ 0, 502, 0, 0, 0, 44, 0, 0, 151, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 152, 0,
+ 0, 0, 153, 51, 48, 50, 49, 0, 52, 0,
+ 0, 154, 0, 155, 0, 0, 0, 0, 0, 43,
+ 54, 32, 0, 0, 156, 40, 157, 62, 0, 0,
+ 45, 0, 0, 0, 158, 30, 31, 159, 63, 0,
+ 0, 0, 0, 160, 0, 33, 0, 0, 0, 161,
+ 0, 0, 34, 0, 0, 0, 35, 36, 0, 37,
+ 0, 0, 0, 0, 0, 162, 502, 0, 0, 0,
+ 44, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 151, 0, 51, 48,
+ 50, 49, 0, 52, 0, 0, 152, 0, 0, 0,
+ 153, 0, 0, 0, 43, 54, 32, 0, 0, 154,
+ 40, 155, 0, 0, 308, 45, 0, 0, 0, 0,
+ 0, 0, 156, 0, 157, 62, 0, 0, 0, 0,
+ 0, 0, 158, 0, 0, 159, 63, 0, 0, 0,
+ 0, 160, 0, 0, 0, 0, 0, 161, 0, 0,
+ 0, 0, 0, 0, 0, 0, 30, 31, 0, 0,
+ 0, 0, 0, 162, 0, 0, 33, 0, 0, 0,
+ 0, 0, 0, 34, 0, 0, 0, 35, 36, 0,
+ 37, 0, 0, 0, 30, 31, 0, 502, 0, 0,
+ 0, 44, 0, 0, 33, 0, 0, 0, 0, 0,
+ 0, 34, 0, 0, 0, 35, 36, 0, 37, 51,
+ 48, 50, 49, 0, 52, 41, 0, 0, 0, 44,
+ 0, 0, 0, 0, 0, 43, 54, 32, 0, 0,
+ 0, 40, 0, 0, 0, 0, 45, 51, 48, 50,
+ 49, 0, 52, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 43, 54, 32, 0, 0, 0, 40,
+ 0, 0, 0, 0, 45, 30, 31, 0, 0, 0,
+ 0, 0, 0, 30, 31, 33, 0, 0, 0, 0,
+ 0, 0, 34, 33, 0, 0, 35, 36, 0, 37,
+ 34, 0, 0, 0, 35, 36, 502, 37, 0, 0,
+ 44, 0, 0, 0, 41, 0, 0, 0, 44, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 51, 48,
+ 50, 49, 0, 52, 0, 0, 51, 48, 50, 49,
+ 0, 52, 0, 0, 43, 54, 32, 0, 0, 0,
+ 40, 0, 43, 54, 32, 45, 0, 0, 40, 0,
+ 0, 0, 0, 45, 30, 31, 0, 0, 0, 0,
+ 0, 0, 30, 31, 33, 0, 0, 0, 0, 0,
+ 0, 34, 33, 0, 0, 35, 36, 0, 37, 34,
+ 0, 0, 0, 35, 36, 502, 37, 0, 0, 44,
+ 0, 0, 0, 41, 0, 0, 0, 44, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 51, 48, 50,
+ 49, 0, 52, 0, 0, 51, 48, 50, 49, 0,
+ 52, 0, 0, 43, 54, 32, 0, 0, 0, 40,
+ 0, 43, 54, 32, 45, 0, 0, 40, 0, 0,
+ 0, 0, 45, 0, 0, 0, 0, 0, 0, 0,
+ 0, 501, 0, 30, 31, 0, 0, 0, 0, 0,
+ 0, 0, 0, 215, 0, 0, 0, 0, 0, 0,
+ 34, 0, 0, 0, 35, 36, 0, 37, 0, 0,
+ 0, 0, 0, 0, 502, 0, 0, 0, 44, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 51, 503, 505, 504,
+ 0, 52, 0, 0, 0, 0, 226, 0, 0, 0,
+ 0, 0, 43, 54, 32, 210, 0, 0, 40, 0,
+ 0, 0, 0, 45, 0, 0, 0, 0, 0, 0,
+ 0, 0, 501, 0, 30, 31, 0, 0, 0, 0,
+ 0, 0, 0, 0, 215, 0, 0, 0, 0, 0,
+ 0, 34, 0, 0, 0, 35, 36, 0, 37, 0,
+ 0, 0, 0, 0, 0, 502, 0, 0, 0, 44,
+ 0, 0, 0, 0, 0, 0, 0, 607, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 51, 503, 505,
+ 504, 0, 52, 0, 0, 0, 0, 226, 0, 0,
+ 0, 0, 0, 43, 54, 32, 210, 0, 0, 40,
+ 0, 0, 0, 0, 45, 0, 0, 0, 0, 0,
+ 0, 0, 0, 501, 0, 30, 31, 0, 0, 0,
+ 0, 0, 0, 0, 0, 215, 0, 0, 0, 0,
+ 0, 0, 34, 0, 0, 0, 35, 36, 0, 37,
+ 0, 0, 0, 0, 0, 0, 502, 0, 0, 0,
+ 44, 0, 0, 0, 0, 0, 0, 0, 610, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 51, 503,
+ 505, 504, 0, 52, 0, 0, 0, 0, 226, 0,
+ 0, 0, 0, 0, 43, 54, 32, 210, 0, 0,
+ 40, 0, 0, 0, 0, 45, 0, 0, 0, 0,
+ 0, 0, 0, 0, 29, 30, 31, 0, 0, 0,
+ 0, 0, 0, 0, 0, 33, 0, 0, 0, 0,
+ 0, 0, 34, 0, 0, 0, 35, 36, 0, 37,
+ 0, 0, 0, 38, 0, 39, 41, 42, 0, 0,
+ 44, 0, 0, 0, 46, 0, 47, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 51, 48,
+ 50, 49, 0, 52, 0, 53, 0, 55, 0, 56,
+ 0, 0, 0, 0, 43, 54, 32, 0, 0, 0,
+ 40, 0, 0, 0, 0, 45, 0, 0, 0, 0,
+ 0, 0, 0, 0, -119, 0, 0, 0, 29, 30,
+ 31, 0, 0, 0, 0, 0, 0, 0, 0, 33,
+ 0, 0, 0, 0, 0, 0, 34, 0, 0, 0,
+ 35, 36, 0, 37, 0, 0, 0, 38, 0, 39,
+ 41, 42, 0, 0, 44, 0, 0, 0, 46, 0,
+ 47, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 51, 48, 50, 49, 0, 52, 0, 53,
+ 0, 55, 0, 56, 0, 0, 0, 0, 43, 54,
+ 32, 0, 0, 0, 40, 0, 0, 0, 0, 45,
+ 0, 0, 0, 0, 0, 0, 0, 0, 29, 30,
+ 31, 0, 0, 0, 0, 0, 0, 0, 0, 33,
+ 0, 0, 0, 0, 0, 0, 34, 0, 0, 0,
+ 35, 36, 0, 37, 0, 0, 0, 38, 0, 39,
+ 41, 42, 0, 0, 44, 0, 0, 0, 46, 0,
+ 47, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 51, 48, 50, 49, 0, 52, 0, 53,
+ 0, 55, 271, 56, 0, 0, 0, 0, 43, 54,
+ 32, 0, 0, 0, 40, 0, 0, 0, 0, 45,
+ 0, 0, 0, 0, 0, 0, 0, 0, 483, 0,
+ 0, 29, 30, 31, 0, 0, 0, 0, 0, 0,
+ 0, 0, 33, 0, 0, 0, 0, 0, 0, 34,
+ 0, 0, 0, 35, 36, 0, 37, 0, 0, 0,
+ 38, 0, 39, 41, 42, 0, 0, 44, 0, 0,
+ 0, 46, 0, 47, 0, 0, 484, 0, 0, 0,
+ 0, 0, 0, 0, 0, 51, 48, 50, 49, 0,
+ 52, 0, 53, 0, 55, 0, 56, 0, 0, 0,
+ 0, 43, 54, 32, 0, 0, 0, 40, 0, 0,
+ 0, 0, 45, 0, 0, 0, 0, 0, 0, 0,
+ 0, 29, 30, 31, 0, 0, 0, 0, 0, 0,
+ 0, 0, 33, 0, 0, 0, 0, 0, 0, 34,
+ 217, 0, 0, 568, 569, 0, 37, 0, 0, 0,
+ 38, 0, 39, 41, 42, 0, 0, 44, 0, 0,
+ 0, 46, 0, 47, 0, 0, 0, 0, 0, 0,
+ 0, 221, 0, 0, 0, 51, 48, 50, 49, 0,
+ 52, 0, 53, 0, 55, 0, 56, 0, 0, 0,
+ 0, 43, 54, 32, 0, 0, 0, 40, 0, 0,
+ 0, 0, 45, 0, 0, 0, 0, 0, 0, 0,
+ 0, 483, 0, 0, 29, 30, 31, 0, 0, 0,
+ 0, 0, 0, 0, 0, 33, 0, 0, 0, 0,
+ 0, 0, 34, 0, 0, 0, 35, 36, 0, 37,
+ 0, 0, 0, 38, 0, 39, 41, 42, 0, 0,
+ 44, 0, 0, 0, 46, 0, 47, 0, 0, 486,
+ 0, 0, 0, 0, 0, 0, 0, 0, 51, 48,
+ 50, 49, 0, 52, 0, 53, 0, 55, 0, 56,
+ 0, 0, 0, 0, 43, 54, 32, 0, 0, 0,
+ 40, 0, 0, 0, 0, 45, 0, 0, 0, 0,
+ 0, 0, 0, 0, 475, 0, 0, 29, 30, 31,
+ 0, 0, 0, 0, 0, 0, 0, 0, 33, 0,
+ 0, 0, 0, 0, 0, 34, 0, 0, 0, 35,
+ 36, 0, 37, 0, 0, 0, 38, 0, 39, 41,
+ 42, 0, 0, 44, 0, 0, 0, 46, 0, 47,
+ 0, 0, 481, 0, 0, 0, 0, 0, 0, 0,
+ 0, 51, 48, 50, 49, 0, 52, 0, 53, 0,
+ 55, 0, 56, 0, 0, 0, 0, 43, 54, 32,
+ 0, 0, 0, 40, 0, 0, 0, 0, 45, 0,
+ 0, 0, 0, 0, 0, 0, 0, 475, 0, 0,
+ 29, 30, 31, 0, 0, 0, 0, 0, 0, 0,
+ 0, 33, 0, 0, 0, 0, 0, 0, 34, 0,
+ 0, 0, 35, 36, 0, 37, 0, 0, 0, 38,
+ 0, 39, 41, 42, 0, 0, 44, 0, 0, 0,
+ 46, 0, 47, 0, 0, 476, 0, 0, 0, 0,
+ 0, 0, 0, 0, 51, 48, 50, 49, 0, 52,
+ 0, 53, 0, 55, 0, 56, 0, 0, 0, 0,
+ 43, 54, 32, 0, 0, 0, 40, 0, 0, 0,
+ 0, 45, 0, 0, 0, 0, 0, 0, 0, 0,
+ 109, 110, 111, 0, 0, 113, 115, 116, 0, 0,
+ 117, 0, 118, 0, 0, 0, 120, 121, 122, 0,
+ 0, 0, 0, 0, 0, 34, 123, 124, 125, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 126,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 129, 0, 0, 0, 0,
+ 0, 0, 48, 50, 49, 130, 131, 132, 0, 134,
+ 135, 136, 137, 138, 139, 0, 0, 127, 133, 119,
+ 112, 114, 128, 0, 0, 0, 0, 0, 45, 0,
+ 0, 0, 0, 0, 0, 0, 0, 109, 110, 111,
+ 0, 0, 113, 115, 116, 0, 0, 117, 0, 118,
+ 0, 0, 0, 120, 121, 122, 0, 0, 0, 0,
+ 0, 0, 393, 123, 124, 125, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 126, 0, 0, 0,
+ 394, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 129, 0, 0, 0, 0, 0, 398, 395,
+ 397, 0, 130, 131, 132, 0, 134, 135, 136, 137,
+ 138, 139, 0, 0, 127, 133, 119, 112, 114, 128,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 109, 110, 111, 0, 0, 113,
+ 115, 116, 0, 0, 117, 0, 118, 0, 0, 0,
+ 120, 121, 122, 0, 0, 0, 0, 0, 0, 393,
+ 123, 124, 125, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 126, 0, 0, 0, 394, 0, 0,
+ 0, 0, 0, 0, 0, 396, 0, 0, 0, 129,
+ 0, 0, 0, 0, 0, 398, 395, 397, 0, 130,
+ 131, 132, 0, 134, 135, 136, 137, 138, 139, 0,
+ 0, 127, 133, 119, 112, 114, 128, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 209, 0, 0, 0, 0, 211, 0, 29, 30,
+ 31, 213, 0, 0, 0, 0, 0, 0, 214, 33,
+ 0, 0, 0, 0, 0, 0, 216, 217, 0, 0,
+ 218, 36, 0, 37, 0, 0, 0, 38, 0, 39,
+ 41, 42, 0, 0, 44, 0, 0, 0, 46, 0,
+ 47, 0, 0, 0, 0, 0, 220, 0, 221, 0,
+ 0, 0, 51, 219, 222, 49, 223, 52, 224, 53,
+ 225, 55, 226, 56, 227, 228, 0, 0, 43, 54,
+ 32, 210, 212, 0, 40, 0, 0, 0, 0, 45,
+ 0, 0, 0, 0, 0, 0, 0, 0, 209, 0,
+ 0, 0, 0, 211, 0, 29, 30, 31, 213, 0,
+ 0, 0, 0, 0, 0, 214, 215, 0, 0, 0,
+ 0, 0, 0, 216, 217, 0, 0, 218, 36, 0,
+ 37, 0, 0, 0, 38, 0, 39, 41, 42, 0,
+ 0, 44, 0, 0, 0, 46, 0, 47, 0, 0,
+ 0, 0, 0, 220, 0, 221, 0, 0, 0, 51,
+ 219, 222, 49, 223, 52, 224, 53, 225, 55, 226,
+ 56, 227, 228, 0, 0, 43, 54, 32, 210, 212,
+ 0, 40, 0, 0, 0, 0, 45, 0, 0, 0,
+ 0, 0, 0, 0, 0, 571, 110, 111, 0, 0,
+ 573, 115, 575, 30, 31, 576, 0, 118, 0, 0,
+ 0, 120, 578, 579, 0, 0, 0, 0, 0, 0,
+ 580, 581, 124, 125, 218, 36, 0, 37, 0, 0,
+ 0, 38, 0, 39, 582, 42, 0, 0, 584, 0,
+ 0, 0, 46, 0, 47, 0, 0, 0, 0, 0,
+ 586, 0, 221, 0, 0, 0, 588, 585, 587, 49,
+ 589, 590, 591, 53, 593, 594, 595, 596, 597, 598,
+ 0, 0, 583, 592, 577, 572, 574, 128, 40, 0,
+ 0, 0, 0, 45, 0, 0, 0, 0, 0, 0,
+ 0, 0, 361, 110, 111, 0, 0, 363, 115, 365,
+ 30, 31, 366, 0, 118, 0, 0, 0, 120, 368,
+ 369, 0, 0, 0, 0, 0, 0, 370, 371, 124,
+ 125, 218, 36, 0, 37, 0, 0, 0, 38, 0,
+ 39, 372, 42, 0, 0, 374, 0, 0, 0, 46,
+ 0, 47, 0, -265, 0, 0, 0, 376, 0, 221,
+ 0, 0, 0, 378, 375, 377, 49, 379, 380, 381,
+ 53, 383, 384, 385, 386, 387, 388, 0, 0, 373,
+ 382, 367, 362, 364, 128, 40, 0, 0, 0, 0,
+ 45, 0, 0, 0, 0, 0, 0, 0, 0,
+
+ 522, 540, 539, 519, 461, 515, 535, 514, 309, 528,
+ 311, 531, 250, 526, 542, 636, 613, 182, 150, 622,
+ 16, 496, 320, 497, 627, 253, 498, 633, 358, 554,
+ 436, 558, 487, 472, 439, 302, 238, 392, 454, 606,
+ 551, 402, 358, 553, 439, 243, 182, 445, 243, 447,
+ 456, 237, 238, 238, 347, 429, 349, 450, 351, 460,
+ 143, 458, 353, 467, 243, 436, 439, 176, 410, 186,
+ 188, 250, 415, 338, 182, 433, 148, 171, 169, 390,
+ 417, 400, 302, 140, 449, 163, 146, 425, 339, 302,
+ 358, 237, 336, 307, 250, 344, 482, 436, 302, 358,
+ 485, 358, 0, 0, 0, 461, 0, 0, 0, 0,
+ 0, 60, 60, 451, 452, 404, 0, 0, 60, 60,
+ 60, 452, 451, 320, 106, 60, 60, 60, 102, 60,
+ 92, 93, 95, 302, 94, 186, 0, 60, 0, 0,
+ 60, 88, 60, 405, 90, 60, 108, 180, 60, 266,
+ 146, 60, 146, 489, 270, 407, 165, 178, 60, 302,
+ 60, 0, 89, 330, 168, 288, 60, 60, 60, 60,
+ 0, 287, 286, 284, 285, 471, 60, 60, 432, 180,
+ 435, 60, 60, 452, 72, 60, 60, 451, 96, 60,
+ 480, 494, 77, 500, 479, 329, 60, 334, 305, 61,
+ 612, 60, 60, 69, 68, 60, 404, 60, 70, 67,
+ 60, 60, 490, 60, 60, 493, 84, 404, 60, 341,
+ 492, 60, 60, 180, 303, 60, 100, 60, 98, 491,
+ 91, 60, 0, 298, 405, 60, 106, 97, 270, 0,
+ 270, 500, 298, 500, 60, 405, 605, 270, 293, 270,
+ 602, 0, 0, 0, 0, 317, 499, 509, 108, 175,
+ 60, 316, 0, 60, 319, 270, 60, 290, 270, 298,
+ 289, 270, 0, 291, 270, 298, 60, 60, 0, 60,
+ 270, 270, 270, 500, 270, 0, 637, 295, 273, 298,
+ 602, 297, 313, 60, 270, 611, 0, 300, 270, 599,
+ 278, 302, 601, 500, 0, 567, 602, 0, 0, 0,
+ 0, 326, 570, 563, 564, 565, 566, 0, 499, 509,
+ 0, 472, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 332, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 608, 0, 0, 0, 0, 0,
+ 0, 0, 500, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 499, 509, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0};
+
+const short QDeclarativeJSGrammar::action_check [] = {
+ 55, 7, 33, 7, 55, 7, 60, 36, 90, 55,
+ 7, 16, 36, 7, 7, 7, 7, 36, 7, 60,
+ 36, 8, 33, 66, 36, 33, 60, 36, 7, 36,
+ 7, 7, 33, 36, 24, 7, 7, 37, 8, 60,
+ 66, 29, 17, 5, 7, 60, 7, 33, 33, 33,
+ 7, 20, 33, 36, 7, 7, 36, 7, 36, 33,
+ 7, 17, 60, 36, 1, 33, 79, 2, 8, 7,
+ 36, 1, 8, 55, 7, 2, 8, 2, 7, 7,
+ 79, 36, 77, 79, 48, 36, 7, 36, 55, 48,
+ 36, 36, 33, 36, 8, 60, 1, 31, 0, 2,
+ 8, 61, 60, 1, 48, 6, 10, 61, 7, 8,
+ -1, 8, 8, 61, 8, -1, -1, 48, 40, 20,
+ 8, 60, 8, 42, -1, 40, -1, 50, 8, 51,
+ 8, 54, 8, 15, 53, 8, 51, 61, 62, 8,
+ 5, 61, 62, 61, 62, 61, 62, 40, 90, 61,
+ 62, 55, 34, 79, 61, 62, 40, 8, 51, 8,
+ 8, 61, 62, 60, 60, 50, 60, 51, 56, 54,
+ 56, 61, 62, 8, 61, 62, 56, 15, 61, 62,
+ 61, 62, 60, 56, 60, 15, 25, 8, 27, 29,
+ 7, 60, 25, 29, 27, 7, 34, 12, 36, 38,
+ 25, 25, 27, 27, 34, 38, 36, 12, 8, 12,
+ 61, 60, 60, 38, 38, 8, 25, 25, 27, 27,
+ -1, 33, 7, -1, -1, 29, 61, 62, 29, 38,
+ 38, -1, 29, 8, -1, 75, 15, 8, 36, 75,
+ 61, 62, 57, -1, 61, 62, 86, 29, 63, -1,
+ 86, 15, 57, -1, 57, 34, 18, 19, 63, -1,
+ 63, 61, 62, 61, 62, 61, 62, -1, 61, 62,
+ 34, 75, 36, 15, 75, -1, 61, 62, 75, 15,
+ 92, -1, 86, 45, 46, 86, 61, 62, 29, 86,
+ 61, 62, 34, 75, 36, 91, 47, 33, 34, 15,
+ 36, 18, 19, -1, 86, 18, 19, 29, -1, -1,
+ 61, 62, -1, -1, 18, 19, -1, 33, 34, 29,
+ 36, -1, 25, 29, 27, 66, 67, 68, 45, 46,
+ -1, -1, 45, 46, -1, 38, -1, -1, 23, 24,
+ 91, 45, 46, -1, 66, 67, 68, 32, -1, -1,
+ 35, 92, 37, 29, 23, 24, 66, 67, 68, -1,
+ 66, 67, 68, 32, 23, 24, 35, 29, 37, -1,
+ 92, 23, 24, 32, 36, -1, 35, -1, 37, -1,
+ 32, 29, 92, 35, -1, 37, 92, 23, 24, 29,
+ 66, 67, 68, -1, -1, 29, 32, -1, 29, 35,
+ -1, 37, 36, -1, 66, 67, 68, 93, 94, 95,
+ 96, 97, 98, 61, 62, -1, 92, 29, 66, 67,
+ 68, 61, 62, -1, -1, -1, 66, 67, 68, -1,
+ 92, -1, 66, 67, 68, 66, 67, 68, -1, -1,
+ -1, -1, -1, -1, 92, -1, -1, -1, -1, 61,
+ 62, -1, 92, 29, 66, 67, 68, -1, 92, -1,
+ -1, 92, 29, -1, -1, 29, -1, -1, -1, -1,
+ 23, 24, -1, -1, -1, -1, -1, -1, 31, 32,
+ 92, -1, 35, -1, 37, 61, 62, -1, -1, -1,
+ 66, 67, 68, -1, 61, 62, -1, 61, 62, 66,
+ 67, 68, 66, 67, 68, -1, -1, -1, -1, -1,
+ 12, 13, -1, -1, -1, -1, 92, -1, -1, -1,
+ 22, -1, -1, -1, -1, 92, -1, 29, 92, -1,
+ -1, 33, 34, -1, 36, -1, -1, -1, -1, -1,
+ -1, 43, -1, -1, -1, 47, -1, -1, 3, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 13, -1,
+ -1, -1, 17, 65, 66, 67, 68, -1, 70, -1,
+ -1, 26, -1, 28, -1, -1, -1, -1, -1, 81,
+ 82, 83, -1, -1, 39, 87, 41, 42, -1, -1,
+ 92, -1, -1, -1, 49, 12, 13, 52, 53, -1,
+ -1, -1, -1, 58, -1, 22, -1, -1, -1, 64,
+ -1, -1, 29, -1, -1, -1, 33, 34, -1, 36,
+ -1, -1, -1, -1, -1, 80, 43, -1, -1, -1,
+ 47, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 3, -1, 65, 66,
+ 67, 68, -1, 70, -1, -1, 13, -1, -1, -1,
+ 17, -1, -1, -1, 81, 82, 83, -1, -1, 26,
+ 87, 28, -1, -1, 31, 92, -1, -1, -1, -1,
+ -1, -1, 39, -1, 41, 42, -1, -1, -1, -1,
+ -1, -1, 49, -1, -1, 52, 53, -1, -1, -1,
+ -1, 58, -1, -1, -1, -1, -1, 64, -1, -1,
+ -1, -1, -1, -1, -1, -1, 12, 13, -1, -1,
+ -1, -1, -1, 80, -1, -1, 22, -1, -1, -1,
+ -1, -1, -1, 29, -1, -1, -1, 33, 34, -1,
+ 36, -1, -1, -1, 12, 13, -1, 43, -1, -1,
+ -1, 47, -1, -1, 22, -1, -1, -1, -1, -1,
+ -1, 29, -1, -1, -1, 33, 34, -1, 36, 65,
+ 66, 67, 68, -1, 70, 43, -1, -1, -1, 47,
+ -1, -1, -1, -1, -1, 81, 82, 83, -1, -1,
+ -1, 87, -1, -1, -1, -1, 92, 65, 66, 67,
+ 68, -1, 70, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 81, 82, 83, -1, -1, -1, 87,
+ -1, -1, -1, -1, 92, 12, 13, -1, -1, -1,
+ -1, -1, -1, 12, 13, 22, -1, -1, -1, -1,
+ -1, -1, 29, 22, -1, -1, 33, 34, -1, 36,
+ 29, -1, -1, -1, 33, 34, 43, 36, -1, -1,
+ 47, -1, -1, -1, 43, -1, -1, -1, 47, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 65, 66,
+ 67, 68, -1, 70, -1, -1, 65, 66, 67, 68,
+ -1, 70, -1, -1, 81, 82, 83, -1, -1, -1,
+ 87, -1, 81, 82, 83, 92, -1, -1, 87, -1,
+ -1, -1, -1, 92, 12, 13, -1, -1, -1, -1,
+ -1, -1, 12, 13, 22, -1, -1, -1, -1, -1,
+ -1, 29, 22, -1, -1, 33, 34, -1, 36, 29,
+ -1, -1, -1, 33, 34, 43, 36, -1, -1, 47,
+ -1, -1, -1, 43, -1, -1, -1, 47, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 65, 66, 67,
+ 68, -1, 70, -1, -1, 65, 66, 67, 68, -1,
+ 70, -1, -1, 81, 82, 83, -1, -1, -1, 87,
+ -1, 81, 82, 83, 92, -1, -1, 87, -1, -1,
+ -1, -1, 92, -1, -1, -1, -1, -1, -1, -1,
+ -1, 10, -1, 12, 13, -1, -1, -1, -1, -1,
+ -1, -1, -1, 22, -1, -1, -1, -1, -1, -1,
+ 29, -1, -1, -1, 33, 34, -1, 36, -1, -1,
+ -1, -1, -1, -1, 43, -1, -1, -1, 47, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 65, 66, 67, 68,
+ -1, 70, -1, -1, -1, -1, 75, -1, -1, -1,
+ -1, -1, 81, 82, 83, 84, -1, -1, 87, -1,
+ -1, -1, -1, 92, -1, -1, -1, -1, -1, -1,
+ -1, -1, 10, -1, 12, 13, -1, -1, -1, -1,
+ -1, -1, -1, -1, 22, -1, -1, -1, -1, -1,
+ -1, 29, -1, -1, -1, 33, 34, -1, 36, -1,
+ -1, -1, -1, -1, -1, 43, -1, -1, -1, 47,
+ -1, -1, -1, -1, -1, -1, -1, 55, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 65, 66, 67,
+ 68, -1, 70, -1, -1, -1, -1, 75, -1, -1,
+ -1, -1, -1, 81, 82, 83, 84, -1, -1, 87,
+ -1, -1, -1, -1, 92, -1, -1, -1, -1, -1,
+ -1, -1, -1, 10, -1, 12, 13, -1, -1, -1,
+ -1, -1, -1, -1, -1, 22, -1, -1, -1, -1,
+ -1, -1, 29, -1, -1, -1, 33, 34, -1, 36,
+ -1, -1, -1, -1, -1, -1, 43, -1, -1, -1,
+ 47, -1, -1, -1, -1, -1, -1, -1, 55, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 65, 66,
+ 67, 68, -1, 70, -1, -1, -1, -1, 75, -1,
+ -1, -1, -1, -1, 81, 82, 83, 84, -1, -1,
+ 87, -1, -1, -1, -1, 92, -1, -1, -1, -1,
+ -1, -1, -1, -1, 11, 12, 13, -1, -1, -1,
+ -1, -1, -1, -1, -1, 22, -1, -1, -1, -1,
+ -1, -1, 29, -1, -1, -1, 33, 34, -1, 36,
+ -1, -1, -1, 40, -1, 42, 43, 44, -1, -1,
+ 47, -1, -1, -1, 51, -1, 53, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 65, 66,
+ 67, 68, -1, 70, -1, 72, -1, 74, -1, 76,
+ -1, -1, -1, -1, 81, 82, 83, -1, -1, -1,
+ 87, -1, -1, -1, -1, 92, -1, -1, -1, -1,
+ -1, -1, -1, -1, 7, -1, -1, -1, 11, 12,
+ 13, -1, -1, -1, -1, -1, -1, -1, -1, 22,
+ -1, -1, -1, -1, -1, -1, 29, -1, -1, -1,
+ 33, 34, -1, 36, -1, -1, -1, 40, -1, 42,
+ 43, 44, -1, -1, 47, -1, -1, -1, 51, -1,
+ 53, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 65, 66, 67, 68, -1, 70, -1, 72,
+ -1, 74, -1, 76, -1, -1, -1, -1, 81, 82,
+ 83, -1, -1, -1, 87, -1, -1, -1, -1, 92,
+ -1, -1, -1, -1, -1, -1, -1, -1, 11, 12,
+ 13, -1, -1, -1, -1, -1, -1, -1, -1, 22,
+ -1, -1, -1, -1, -1, -1, 29, -1, -1, -1,
+ 33, 34, -1, 36, -1, -1, -1, 40, -1, 42,
+ 43, 44, -1, -1, 47, -1, -1, -1, 51, -1,
+ 53, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 65, 66, 67, 68, -1, 70, -1, 72,
+ -1, 74, 75, 76, -1, -1, -1, -1, 81, 82,
+ 83, -1, -1, -1, 87, -1, -1, -1, -1, 92,
+ -1, -1, -1, -1, -1, -1, -1, -1, 8, -1,
+ -1, 11, 12, 13, -1, -1, -1, -1, -1, -1,
+ -1, -1, 22, -1, -1, -1, -1, -1, -1, 29,
+ -1, -1, -1, 33, 34, -1, 36, -1, -1, -1,
+ 40, -1, 42, 43, 44, -1, -1, 47, -1, -1,
+ -1, 51, -1, 53, -1, -1, 56, -1, -1, -1,
+ -1, -1, -1, -1, -1, 65, 66, 67, 68, -1,
+ 70, -1, 72, -1, 74, -1, 76, -1, -1, -1,
+ -1, 81, 82, 83, -1, -1, -1, 87, -1, -1,
+ -1, -1, 92, -1, -1, -1, -1, -1, -1, -1,
+ -1, 11, 12, 13, -1, -1, -1, -1, -1, -1,
+ -1, -1, 22, -1, -1, -1, -1, -1, -1, 29,
+ 30, -1, -1, 33, 34, -1, 36, -1, -1, -1,
+ 40, -1, 42, 43, 44, -1, -1, 47, -1, -1,
+ -1, 51, -1, 53, -1, -1, -1, -1, -1, -1,
+ -1, 61, -1, -1, -1, 65, 66, 67, 68, -1,
+ 70, -1, 72, -1, 74, -1, 76, -1, -1, -1,
+ -1, 81, 82, 83, -1, -1, -1, 87, -1, -1,
+ -1, -1, 92, -1, -1, -1, -1, -1, -1, -1,
+ -1, 8, -1, -1, 11, 12, 13, -1, -1, -1,
+ -1, -1, -1, -1, -1, 22, -1, -1, -1, -1,
+ -1, -1, 29, -1, -1, -1, 33, 34, -1, 36,
+ -1, -1, -1, 40, -1, 42, 43, 44, -1, -1,
+ 47, -1, -1, -1, 51, -1, 53, -1, -1, 56,
+ -1, -1, -1, -1, -1, -1, -1, -1, 65, 66,
+ 67, 68, -1, 70, -1, 72, -1, 74, -1, 76,
+ -1, -1, -1, -1, 81, 82, 83, -1, -1, -1,
+ 87, -1, -1, -1, -1, 92, -1, -1, -1, -1,
+ -1, -1, -1, -1, 8, -1, -1, 11, 12, 13,
+ -1, -1, -1, -1, -1, -1, -1, -1, 22, -1,
+ -1, -1, -1, -1, -1, 29, -1, -1, -1, 33,
+ 34, -1, 36, -1, -1, -1, 40, -1, 42, 43,
+ 44, -1, -1, 47, -1, -1, -1, 51, -1, 53,
+ -1, -1, 56, -1, -1, -1, -1, -1, -1, -1,
+ -1, 65, 66, 67, 68, -1, 70, -1, 72, -1,
+ 74, -1, 76, -1, -1, -1, -1, 81, 82, 83,
+ -1, -1, -1, 87, -1, -1, -1, -1, 92, -1,
+ -1, -1, -1, -1, -1, -1, -1, 8, -1, -1,
+ 11, 12, 13, -1, -1, -1, -1, -1, -1, -1,
+ -1, 22, -1, -1, -1, -1, -1, -1, 29, -1,
+ -1, -1, 33, 34, -1, 36, -1, -1, -1, 40,
+ -1, 42, 43, 44, -1, -1, 47, -1, -1, -1,
+ 51, -1, 53, -1, -1, 56, -1, -1, -1, -1,
+ -1, -1, -1, -1, 65, 66, 67, 68, -1, 70,
+ -1, 72, -1, 74, -1, 76, -1, -1, -1, -1,
+ 81, 82, 83, -1, -1, -1, 87, -1, -1, -1,
+ -1, 92, -1, -1, -1, -1, -1, -1, -1, -1,
+ 4, 5, 6, -1, -1, 9, 10, 11, -1, -1,
+ 14, -1, 16, -1, -1, -1, 20, 21, 22, -1,
+ -1, -1, -1, -1, -1, 29, 30, 31, 32, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 43,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 59, -1, -1, -1, -1,
+ -1, -1, 66, 67, 68, 69, 70, 71, -1, 73,
+ 74, 75, 76, 77, 78, -1, -1, 81, 82, 83,
+ 84, 85, 86, -1, -1, -1, -1, -1, 92, -1,
+ -1, -1, -1, -1, -1, -1, -1, 4, 5, 6,
+ -1, -1, 9, 10, 11, -1, -1, 14, -1, 16,
+ -1, -1, -1, 20, 21, 22, -1, -1, -1, -1,
+ -1, -1, 29, 30, 31, 32, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 43, -1, -1, -1,
+ 47, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 59, -1, -1, -1, -1, -1, 65, 66,
+ 67, -1, 69, 70, 71, -1, 73, 74, 75, 76,
+ 77, 78, -1, -1, 81, 82, 83, 84, 85, 86,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 4, 5, 6, -1, -1, 9,
+ 10, 11, -1, -1, 14, -1, 16, -1, -1, -1,
+ 20, 21, 22, -1, -1, -1, -1, -1, -1, 29,
+ 30, 31, 32, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 43, -1, -1, -1, 47, -1, -1,
+ -1, -1, -1, -1, -1, 55, -1, -1, -1, 59,
+ -1, -1, -1, -1, -1, 65, 66, 67, -1, 69,
+ 70, 71, -1, 73, 74, 75, 76, 77, 78, -1,
+ -1, 81, 82, 83, 84, 85, 86, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 4, -1, -1, -1, -1, 9, -1, 11, 12,
+ 13, 14, -1, -1, -1, -1, -1, -1, 21, 22,
+ -1, -1, -1, -1, -1, -1, 29, 30, -1, -1,
+ 33, 34, -1, 36, -1, -1, -1, 40, -1, 42,
+ 43, 44, -1, -1, 47, -1, -1, -1, 51, -1,
+ 53, -1, -1, -1, -1, -1, 59, -1, 61, -1,
+ -1, -1, 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 75, 76, 77, 78, -1, -1, 81, 82,
+ 83, 84, 85, -1, 87, -1, -1, -1, -1, 92,
+ -1, -1, -1, -1, -1, -1, -1, -1, 4, -1,
+ -1, -1, -1, 9, -1, 11, 12, 13, 14, -1,
+ -1, -1, -1, -1, -1, 21, 22, -1, -1, -1,
+ -1, -1, -1, 29, 30, -1, -1, 33, 34, -1,
+ 36, -1, -1, -1, 40, -1, 42, 43, 44, -1,
+ -1, 47, -1, -1, -1, 51, -1, 53, -1, -1,
+ -1, -1, -1, 59, -1, 61, -1, -1, -1, 65,
+ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ 76, 77, 78, -1, -1, 81, 82, 83, 84, 85,
+ -1, 87, -1, -1, -1, -1, 92, -1, -1, -1,
+ -1, -1, -1, -1, -1, 4, 5, 6, -1, -1,
+ 9, 10, 11, 12, 13, 14, -1, 16, -1, -1,
+ -1, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ 29, 30, 31, 32, 33, 34, -1, 36, -1, -1,
+ -1, 40, -1, 42, 43, 44, -1, -1, 47, -1,
+ -1, -1, 51, -1, 53, -1, -1, -1, -1, -1,
+ 59, -1, 61, -1, -1, -1, 65, 66, 67, 68,
+ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+ -1, -1, 81, 82, 83, 84, 85, 86, 87, -1,
+ -1, -1, -1, 92, -1, -1, -1, -1, -1, -1,
+ -1, -1, 4, 5, 6, -1, -1, 9, 10, 11,
+ 12, 13, 14, -1, 16, -1, -1, -1, 20, 21,
+ 22, -1, -1, -1, -1, -1, -1, 29, 30, 31,
+ 32, 33, 34, -1, 36, -1, -1, -1, 40, -1,
+ 42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
+ -1, 53, -1, 55, -1, -1, -1, 59, -1, 61,
+ -1, -1, -1, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, -1, -1, 81,
+ 82, 83, 84, 85, 86, 87, -1, -1, -1, -1,
+ 92, -1, -1, -1, -1, -1, -1, -1, -1,
+
+ 13, 15, 25, 3, 15, 15, 3, 25, 3, 15,
+ 2, 15, 2, 25, 3, 11, 19, 15, 67, 13,
+ 3, 104, 15, 4, 15, 3, 2, 15, 2, 15,
+ 3, 15, 3, 35, 21, 3, 15, 36, 3, 19,
+ 25, 2, 2, 25, 21, 15, 15, 98, 15, 15,
+ 2, 4, 15, 15, 2, 93, 3, 21, 2, 2,
+ 35, 3, 2, 35, 15, 3, 21, 3, 2, 15,
+ 15, 2, 2, 2, 15, 3, 35, 35, 35, 35,
+ 3, 35, 3, 3, 21, 35, 35, 96, 15, 3,
+ 2, 4, 3, 2, 2, 100, 35, 3, 3, 2,
+ 35, 2, -1, -1, -1, 15, -1, -1, -1, -1,
+ -1, 44, 44, 46, 46, 13, -1, -1, 44, 44,
+ 44, 46, 46, 15, 15, 44, 44, 44, 54, 44,
+ 49, 49, 49, 3, 49, 15, -1, 44, -1, -1,
+ 44, 48, 44, 41, 48, 44, 37, 46, 44, 44,
+ 35, 44, 35, 46, 49, 40, 58, 40, 44, 3,
+ 44, -1, 48, 68, 60, 49, 44, 44, 44, 44,
+ -1, 49, 49, 49, 49, 85, 44, 44, 81, 46,
+ 81, 44, 44, 46, 52, 44, 44, 46, 50, 44,
+ 31, 46, 50, 13, 35, 87, 44, 2, 68, 47,
+ 20, 44, 44, 46, 46, 44, 13, 44, 47, 46,
+ 44, 44, 46, 44, 44, 46, 49, 13, 44, 99,
+ 46, 44, 44, 46, 68, 44, 56, 44, 50, 46,
+ 49, 44, -1, 44, 41, 44, 15, 50, 49, -1,
+ 49, 13, 44, 13, 44, 41, 16, 49, 57, 49,
+ 20, -1, -1, -1, -1, 66, 28, 29, 37, 38,
+ 44, 61, -1, 44, 66, 49, 44, 51, 49, 44,
+ 51, 49, -1, 51, 49, 44, 44, 44, -1, 44,
+ 49, 49, 49, 13, 49, -1, 16, 55, 53, 44,
+ 20, 66, 59, 44, 49, 5, -1, 66, 49, 13,
+ 51, 3, 16, 13, -1, 13, 20, -1, -1, -1,
+ -1, 66, 20, 21, 22, 23, 24, -1, 28, 29,
+ -1, 35, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 68, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 5, -1, -1, -1, -1, -1,
+ -1, -1, 13, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 28, 29, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1};
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/parser/qmljsgrammar_p.h b/src/declarative/qml/parser/qdeclarativejsgrammar_p.h
index 21fddba..2b2e3d1 100644
--- a/src/declarative/qml/parser/qmljsgrammar_p.h
+++ b/src/declarative/qml/parser/qdeclarativejsgrammar_p.h
@@ -51,20 +51,20 @@
//
// This file was generated by qlalr - DO NOT EDIT!
-#ifndef QMLJSGRAMMAR_P_H
-#define QMLJSGRAMMAR_P_H
+#ifndef QDECLARATIVEJSGRAMMAR_P_H
+#define QDECLARATIVEJSGRAMMAR_P_H
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
-class QmlJSGrammar
+class QDeclarativeJSGrammar
{
public:
- enum VariousConstants {
+ enum {
EOF_SYMBOL = 0,
- REDUCE_HERE = 99,
- SHIFT_THERE = 98,
+ REDUCE_HERE = 100,
+ SHIFT_THERE = 99,
T_AND = 1,
T_AND_AND = 2,
T_AND_EQ = 3,
@@ -90,12 +90,12 @@ public:
T_EQ_EQ = 18,
T_EQ_EQ_EQ = 19,
T_FALSE = 83,
- T_FEED_JS_EXPRESSION = 95,
- T_FEED_JS_PROGRAM = 97,
- T_FEED_JS_SOURCE_ELEMENT = 96,
- T_FEED_JS_STATEMENT = 94,
- T_FEED_UI_OBJECT_MEMBER = 93,
- T_FEED_UI_PROGRAM = 92,
+ T_FEED_JS_EXPRESSION = 96,
+ T_FEED_JS_PROGRAM = 98,
+ T_FEED_JS_SOURCE_ELEMENT = 97,
+ T_FEED_JS_STATEMENT = 95,
+ T_FEED_UI_OBJECT_MEMBER = 94,
+ T_FEED_UI_PROGRAM = 93,
T_FINALLY = 20,
T_FOR = 21,
T_FUNCTION = 22,
@@ -127,6 +127,7 @@ public:
T_NOT_EQ_EQ = 46,
T_NULL = 81,
T_NUMERIC_LITERAL = 47,
+ T_ON = 92,
T_OR = 48,
T_OR_EQ = 49,
T_OR_OR = 50,
@@ -163,15 +164,15 @@ public:
T_XOR = 79,
T_XOR_EQ = 80,
- ACCEPT_STATE = 635,
- RULE_COUNT = 343,
- STATE_COUNT = 636,
- TERMINAL_COUNT = 100,
+ ACCEPT_STATE = 639,
+ RULE_COUNT = 345,
+ STATE_COUNT = 640,
+ TERMINAL_COUNT = 101,
NON_TERMINAL_COUNT = 106,
- GOTO_INDEX_OFFSET = 636,
- GOTO_INFO_OFFSET = 2520,
- GOTO_CHECK_OFFSET = 2520
+ GOTO_INDEX_OFFSET = 640,
+ GOTO_INFO_OFFSET = 2699,
+ GOTO_CHECK_OFFSET = 2699
};
static const char *const spell [];
@@ -205,5 +206,5 @@ public:
QT_END_NAMESPACE
-#endif // QMLJSGRAMMAR_P_H
+#endif // QDECLARATIVEJSGRAMMAR_P_H
diff --git a/src/declarative/qml/parser/qmljslexer.cpp b/src/declarative/qml/parser/qdeclarativejslexer.cpp
index 816542f..34163a4 100644
--- a/src/declarative/qml/parser/qmljslexer.cpp
+++ b/src/declarative/qml/parser/qdeclarativejslexer.cpp
@@ -43,11 +43,11 @@
#include <config.h>
#endif
-#include "qmljslexer_p.h"
+#include "qdeclarativejslexer_p.h"
-#include "qmljsglobal_p.h"
-#include "qmljsengine_p.h"
-#include "qmljsgrammar_p.h"
+#include "qdeclarativejsglobal_p.h"
+#include "qdeclarativejsengine_p.h"
+#include "qdeclarativejsgrammar_p.h"
#include <QtCore/qcoreapplication.h>
@@ -69,11 +69,11 @@ extern double qstrtod(const char *s00, char const **se, bool *ok);
} \
while (0)
-namespace QmlJS {
+namespace QDeclarativeJS {
extern double integerFromString(const char *buf, int size, int radix);
}
-using namespace QmlJS;
+using namespace QDeclarativeJS;
Lexer::Lexer(Engine *eng, bool tokenizeComments)
: driver(eng),
@@ -159,68 +159,70 @@ int Lexer::findReservedWord(const QChar *c, int size) const
switch (size) {
case 2: {
if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('o'))
- return QmlJSGrammar::T_DO;
+ return QDeclarativeJSGrammar::T_DO;
else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('f'))
- return QmlJSGrammar::T_IF;
+ return QDeclarativeJSGrammar::T_IF;
else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n'))
- return QmlJSGrammar::T_IN;
+ return QDeclarativeJSGrammar::T_IN;
else if (c[0] == QLatin1Char('a') && c[1] == QLatin1Char('s'))
- return QmlJSGrammar::T_AS;
+ return QDeclarativeJSGrammar::T_AS;
+ else if (c[0] == QLatin1Char('o') && c[1] == QLatin1Char('n'))
+ return QDeclarativeJSGrammar::T_ON;
} break;
case 3: {
if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('o') && c[2] == QLatin1Char('r'))
- return QmlJSGrammar::T_FOR;
+ return QDeclarativeJSGrammar::T_FOR;
else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('e') && c[2] == QLatin1Char('w'))
- return QmlJSGrammar::T_NEW;
+ return QDeclarativeJSGrammar::T_NEW;
else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r') && c[2] == QLatin1Char('y'))
- return QmlJSGrammar::T_TRY;
+ return QDeclarativeJSGrammar::T_TRY;
else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('a') && c[2] == QLatin1Char('r'))
- return QmlJSGrammar::T_VAR;
+ return QDeclarativeJSGrammar::T_VAR;
else if (check_reserved) {
if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n') && c[2] == QLatin1Char('t'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
}
} break;
case 4: {
if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('a')
&& c[2] == QLatin1Char('s') && c[3] == QLatin1Char('e'))
- return QmlJSGrammar::T_CASE;
+ return QDeclarativeJSGrammar::T_CASE;
else if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('l')
&& c[2] == QLatin1Char('s') && c[3] == QLatin1Char('e'))
- return QmlJSGrammar::T_ELSE;
+ return QDeclarativeJSGrammar::T_ELSE;
else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h')
&& c[2] == QLatin1Char('i') && c[3] == QLatin1Char('s'))
- return QmlJSGrammar::T_THIS;
+ return QDeclarativeJSGrammar::T_THIS;
else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('o')
&& c[2] == QLatin1Char('i') && c[3] == QLatin1Char('d'))
- return QmlJSGrammar::T_VOID;
+ return QDeclarativeJSGrammar::T_VOID;
else if (c[0] == QLatin1Char('w') && c[1] == QLatin1Char('i')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('h'))
- return QmlJSGrammar::T_WITH;
+ return QDeclarativeJSGrammar::T_WITH;
else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r')
&& c[2] == QLatin1Char('u') && c[3] == QLatin1Char('e'))
- return QmlJSGrammar::T_TRUE;
+ return QDeclarativeJSGrammar::T_TRUE;
else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('u')
&& c[2] == QLatin1Char('l') && c[3] == QLatin1Char('l'))
- return QmlJSGrammar::T_NULL;
+ return QDeclarativeJSGrammar::T_NULL;
else if (check_reserved) {
if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('n')
&& c[2] == QLatin1Char('u') && c[3] == QLatin1Char('m'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('y')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('e'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('l') && c[1] == QLatin1Char('o')
&& c[2] == QLatin1Char('n') && c[3] == QLatin1Char('g'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('h')
&& c[2] == QLatin1Char('a') && c[3] == QLatin1Char('r'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('g') && c[1] == QLatin1Char('o')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('o'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -228,48 +230,48 @@ int Lexer::findReservedWord(const QChar *c, int size) const
if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('r')
&& c[2] == QLatin1Char('e') && c[3] == QLatin1Char('a')
&& c[4] == QLatin1Char('k'))
- return QmlJSGrammar::T_BREAK;
+ return QDeclarativeJSGrammar::T_BREAK;
else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('a')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('c')
&& c[4] == QLatin1Char('h'))
- return QmlJSGrammar::T_CATCH;
+ return QDeclarativeJSGrammar::T_CATCH;
else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h')
&& c[2] == QLatin1Char('r') && c[3] == QLatin1Char('o')
&& c[4] == QLatin1Char('w'))
- return QmlJSGrammar::T_THROW;
+ return QDeclarativeJSGrammar::T_THROW;
else if (c[0] == QLatin1Char('w') && c[1] == QLatin1Char('h')
&& c[2] == QLatin1Char('i') && c[3] == QLatin1Char('l')
&& c[4] == QLatin1Char('e'))
- return QmlJSGrammar::T_WHILE;
+ return QDeclarativeJSGrammar::T_WHILE;
else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('o')
&& c[2] == QLatin1Char('n') && c[3] == QLatin1Char('s')
&& c[4] == QLatin1Char('t'))
- return QmlJSGrammar::T_CONST;
+ return QDeclarativeJSGrammar::T_CONST;
else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('a')
&& c[2] == QLatin1Char('l') && c[3] == QLatin1Char('s')
&& c[4] == QLatin1Char('e'))
- return QmlJSGrammar::T_FALSE;
+ return QDeclarativeJSGrammar::T_FALSE;
else if (check_reserved) {
if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('h')
&& c[2] == QLatin1Char('o') && c[3] == QLatin1Char('r')
&& c[4] == QLatin1Char('t'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('u')
&& c[2] == QLatin1Char('p') && c[3] == QLatin1Char('e')
&& c[4] == QLatin1Char('r'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('i')
&& c[2] == QLatin1Char('n') && c[3] == QLatin1Char('a')
&& c[4] == QLatin1Char('l'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('c') && c[1] == QLatin1Char('l')
&& c[2] == QLatin1Char('a') && c[3] == QLatin1Char('s')
&& c[4] == QLatin1Char('s'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('l')
&& c[2] == QLatin1Char('o') && c[3] == QLatin1Char('a')
&& c[4] == QLatin1Char('t'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -277,56 +279,56 @@ int Lexer::findReservedWord(const QChar *c, int size) const
if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('e')
&& c[2] == QLatin1Char('l') && c[3] == QLatin1Char('e')
&& c[4] == QLatin1Char('t') && c[5] == QLatin1Char('e'))
- return QmlJSGrammar::T_DELETE;
+ return QDeclarativeJSGrammar::T_DELETE;
else if (c[0] == QLatin1Char('r') && c[1] == QLatin1Char('e')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('u')
&& c[4] == QLatin1Char('r') && c[5] == QLatin1Char('n'))
- return QmlJSGrammar::T_RETURN;
+ return QDeclarativeJSGrammar::T_RETURN;
else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('w')
&& c[2] == QLatin1Char('i') && c[3] == QLatin1Char('t')
&& c[4] == QLatin1Char('c') && c[5] == QLatin1Char('h'))
- return QmlJSGrammar::T_SWITCH;
+ return QDeclarativeJSGrammar::T_SWITCH;
else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('y')
&& c[2] == QLatin1Char('p') && c[3] == QLatin1Char('e')
&& c[4] == QLatin1Char('o') && c[5] == QLatin1Char('f'))
- return QmlJSGrammar::T_TYPEOF;
+ return QDeclarativeJSGrammar::T_TYPEOF;
else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('m')
&& c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o')
&& c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t'))
- return QmlJSGrammar::T_IMPORT;
+ return QDeclarativeJSGrammar::T_IMPORT;
else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('i')
&& c[2] == QLatin1Char('g') && c[3] == QLatin1Char('n')
&& c[4] == QLatin1Char('a') && c[5] == QLatin1Char('l'))
- return QmlJSGrammar::T_SIGNAL;
+ return QDeclarativeJSGrammar::T_SIGNAL;
else if (check_reserved) {
if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('x')
&& c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o')
&& c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('s') && c[1] == QLatin1Char('t')
&& c[2] == QLatin1Char('a') && c[3] == QLatin1Char('t')
&& c[4] == QLatin1Char('i') && c[5] == QLatin1Char('c'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('o')
&& c[2] == QLatin1Char('u') && c[3] == QLatin1Char('b')
&& c[4] == QLatin1Char('l') && c[5] == QLatin1Char('e'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('m')
&& c[2] == QLatin1Char('p') && c[3] == QLatin1Char('o')
&& c[4] == QLatin1Char('r') && c[5] == QLatin1Char('t'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('u')
&& c[2] == QLatin1Char('b') && c[3] == QLatin1Char('l')
&& c[4] == QLatin1Char('i') && c[5] == QLatin1Char('c'))
- return QmlJSGrammar::T_PUBLIC;
+ return QDeclarativeJSGrammar::T_PUBLIC;
else if (c[0] == QLatin1Char('n') && c[1] == QLatin1Char('a')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('i')
&& c[4] == QLatin1Char('v') && c[5] == QLatin1Char('e'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('h')
&& c[2] == QLatin1Char('r') && c[3] == QLatin1Char('o')
&& c[4] == QLatin1Char('w') && c[5] == QLatin1Char('s'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -335,33 +337,33 @@ int Lexer::findReservedWord(const QChar *c, int size) const
&& c[2] == QLatin1Char('f') && c[3] == QLatin1Char('a')
&& c[4] == QLatin1Char('u') && c[5] == QLatin1Char('l')
&& c[6] == QLatin1Char('t'))
- return QmlJSGrammar::T_DEFAULT;
+ return QDeclarativeJSGrammar::T_DEFAULT;
else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('i')
&& c[2] == QLatin1Char('n') && c[3] == QLatin1Char('a')
&& c[4] == QLatin1Char('l') && c[5] == QLatin1Char('l')
&& c[6] == QLatin1Char('y'))
- return QmlJSGrammar::T_FINALLY;
+ return QDeclarativeJSGrammar::T_FINALLY;
else if (check_reserved) {
if (c[0] == QLatin1Char('b') && c[1] == QLatin1Char('o')
&& c[2] == QLatin1Char('o') && c[3] == QLatin1Char('l')
&& c[4] == QLatin1Char('e') && c[5] == QLatin1Char('a')
&& c[6] == QLatin1Char('n'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('e') && c[1] == QLatin1Char('x')
&& c[2] == QLatin1Char('t') && c[3] == QLatin1Char('e')
&& c[4] == QLatin1Char('n') && c[5] == QLatin1Char('d')
&& c[6] == QLatin1Char('s'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('a')
&& c[2] == QLatin1Char('c') && c[3] == QLatin1Char('k')
&& c[4] == QLatin1Char('a') && c[5] == QLatin1Char('g')
&& c[6] == QLatin1Char('e'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('r')
&& c[2] == QLatin1Char('i') && c[3] == QLatin1Char('v')
&& c[4] == QLatin1Char('a') && c[5] == QLatin1Char('t')
&& c[6] == QLatin1Char('e'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -370,38 +372,38 @@ int Lexer::findReservedWord(const QChar *c, int size) const
&& c[2] == QLatin1Char('n') && c[3] == QLatin1Char('t')
&& c[4] == QLatin1Char('i') && c[5] == QLatin1Char('n')
&& c[6] == QLatin1Char('u') && c[7] == QLatin1Char('e'))
- return QmlJSGrammar::T_CONTINUE;
+ return QDeclarativeJSGrammar::T_CONTINUE;
else if (c[0] == QLatin1Char('f') && c[1] == QLatin1Char('u')
&& c[2] == QLatin1Char('n') && c[3] == QLatin1Char('c')
&& c[4] == QLatin1Char('t') && c[5] == QLatin1Char('i')
&& c[6] == QLatin1Char('o') && c[7] == QLatin1Char('n'))
- return QmlJSGrammar::T_FUNCTION;
+ return QDeclarativeJSGrammar::T_FUNCTION;
else if (c[0] == QLatin1Char('d') && c[1] == QLatin1Char('e')
&& c[2] == QLatin1Char('b') && c[3] == QLatin1Char('u')
&& c[4] == QLatin1Char('g') && c[5] == QLatin1Char('g')
&& c[6] == QLatin1Char('e') && c[7] == QLatin1Char('r'))
- return QmlJSGrammar::T_DEBUGGER;
+ return QDeclarativeJSGrammar::T_DEBUGGER;
else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('r')
&& c[2] == QLatin1Char('o') && c[3] == QLatin1Char('p')
&& c[4] == QLatin1Char('e') && c[5] == QLatin1Char('r')
&& c[6] == QLatin1Char('t') && c[7] == QLatin1Char('y'))
- return QmlJSGrammar::T_PROPERTY;
+ return QDeclarativeJSGrammar::T_PROPERTY;
else if (c[0] == QLatin1Char('r') && c[1] == QLatin1Char('e')
&& c[2] == QLatin1Char('a') && c[3] == QLatin1Char('d')
&& c[4] == QLatin1Char('o') && c[5] == QLatin1Char('n')
&& c[6] == QLatin1Char('l') && c[7] == QLatin1Char('y'))
- return QmlJSGrammar::T_READONLY;
+ return QDeclarativeJSGrammar::T_READONLY;
else if (check_reserved) {
if (c[0] == QLatin1Char('a') && c[1] == QLatin1Char('b')
&& c[2] == QLatin1Char('s') && c[3] == QLatin1Char('t')
&& c[4] == QLatin1Char('r') && c[5] == QLatin1Char('a')
&& c[6] == QLatin1Char('c') && c[7] == QLatin1Char('t'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('v') && c[1] == QLatin1Char('o')
&& c[2] == QLatin1Char('l') && c[3] == QLatin1Char('a')
&& c[4] == QLatin1Char('t') && c[5] == QLatin1Char('i')
&& c[6] == QLatin1Char('l') && c[7] == QLatin1Char('e'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -412,19 +414,19 @@ int Lexer::findReservedWord(const QChar *c, int size) const
&& c[4] == QLatin1Char('r') && c[5] == QLatin1Char('f')
&& c[6] == QLatin1Char('a') && c[7] == QLatin1Char('c')
&& c[8] == QLatin1Char('e'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('t') && c[1] == QLatin1Char('r')
&& c[2] == QLatin1Char('a') && c[3] == QLatin1Char('n')
&& c[4] == QLatin1Char('s') && c[5] == QLatin1Char('i')
&& c[6] == QLatin1Char('e') && c[7] == QLatin1Char('n')
&& c[8] == QLatin1Char('t'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
else if (c[0] == QLatin1Char('p') && c[1] == QLatin1Char('r')
&& c[2] == QLatin1Char('o') && c[3] == QLatin1Char('t')
&& c[4] == QLatin1Char('e') && c[5] == QLatin1Char('c')
&& c[6] == QLatin1Char('t') && c[7] == QLatin1Char('e')
&& c[8] == QLatin1Char('d'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -434,14 +436,14 @@ int Lexer::findReservedWord(const QChar *c, int size) const
&& c[4] == QLatin1Char('a') && c[5] == QLatin1Char('n')
&& c[6] == QLatin1Char('c') && c[7] == QLatin1Char('e')
&& c[8] == QLatin1Char('o') && c[9] == QLatin1Char('f'))
- return QmlJSGrammar::T_INSTANCEOF;
+ return QDeclarativeJSGrammar::T_INSTANCEOF;
else if (check_reserved) {
if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('m')
&& c[2] == QLatin1Char('p') && c[3] == QLatin1Char('l')
&& c[4] == QLatin1Char('e') && c[5] == QLatin1Char('m')
&& c[6] == QLatin1Char('e') && c[7] == QLatin1Char('n')
&& c[8] == QLatin1Char('t') && c[9] == QLatin1Char('s'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -453,7 +455,7 @@ int Lexer::findReservedWord(const QChar *c, int size) const
&& c[6] == QLatin1Char('o') && c[7] == QLatin1Char('n')
&& c[8] == QLatin1Char('i') && c[9] == QLatin1Char('z')
&& c[10] == QLatin1Char('e') && c[11] == QLatin1Char('d'))
- return QmlJSGrammar::T_RESERVED_WORD;
+ return QDeclarativeJSGrammar::T_RESERVED_WORD;
}
} break;
@@ -497,7 +499,7 @@ int Lexer::lex()
syncProhibitAutomaticSemicolon();
if (!terminator && !delimited && !prohibitAutomaticSemicolon) {
// automatic semicolon insertion if program incomplete
- token = QmlJSGrammar::T_SEMICOLON;
+ token = QDeclarativeJSGrammar::T_SEMICOLON;
stackToken = 0;
setDone(Other);
} else {
@@ -511,7 +513,7 @@ int Lexer::lex()
terminator = true;
syncProhibitAutomaticSemicolon();
if (restrKeyword) {
- token = QmlJSGrammar::T_SEMICOLON;
+ token = QDeclarativeJSGrammar::T_SEMICOLON;
setDone(Other);
}
} else if (current == '"' || current == '\'') {
@@ -540,18 +542,18 @@ int Lexer::lex()
token = matchPunctuator(current, next1, next2, next3);
if (token != -1) {
if (terminator && !delimited && !prohibitAutomaticSemicolon
- && (token == QmlJSGrammar::T_PLUS_PLUS
- || token == QmlJSGrammar::T_MINUS_MINUS)) {
+ && (token == QDeclarativeJSGrammar::T_PLUS_PLUS
+ || token == QDeclarativeJSGrammar::T_MINUS_MINUS)) {
// automatic semicolon insertion
stackToken = token;
- token = QmlJSGrammar::T_SEMICOLON;
+ token = QDeclarativeJSGrammar::T_SEMICOLON;
}
setDone(Other);
}
else {
setDone(Bad);
err = IllegalCharacter;
- errmsg = QCoreApplication::translate("QmlParser", "Illegal character");
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal character");
}
}
break;
@@ -565,7 +567,7 @@ int Lexer::lex()
} else if (current == 0 || isLineTerminator()) {
setDone(Bad);
err = UnclosedStringLiteral;
- errmsg = QCoreApplication::translate("QmlParser", "Unclosed string at end of line");
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Unclosed string at end of line");
} else if (current == '\\') {
state = InEscapeSequence;
} else {
@@ -591,7 +593,7 @@ int Lexer::lex()
} else {
setDone(Bad);
err = IllegalEscapeSequence;
- errmsg = QCoreApplication::translate("QmlParser", "Illegal escape squence");
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal escape squence");
}
} else if (current == 'x')
state = InHexEscape;
@@ -637,7 +639,7 @@ int Lexer::lex()
} else {
setDone(Bad);
err = IllegalUnicodeEscapeSequence;
- errmsg = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence");
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal unicode escape sequence");
}
break;
case InSingleLineComment:
@@ -648,7 +650,7 @@ int Lexer::lex()
terminator = true;
bol = true;
if (restrKeyword) {
- token = QmlJSGrammar::T_SEMICOLON;
+ token = QDeclarativeJSGrammar::T_SEMICOLON;
setDone(Other);
} else
state = Start;
@@ -663,7 +665,7 @@ int Lexer::lex()
if (current == 0) {
setDone(Bad);
err = UnclosedComment;
- errmsg = QCoreApplication::translate("QmlParser", "Unclosed comment at end of file");
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Unclosed comment at end of file");
driver->addComment(startpos, tokenLength(), startlineno, startcolumn);
} else if (isLineTerminator()) {
shiftWindowsLineBreak();
@@ -750,7 +752,7 @@ int Lexer::lex()
} else {
setDone(Bad);
err = IllegalExponentIndicator;
- errmsg = QCoreApplication::translate("QmlParser", "Illegal syntax for exponential number");
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal syntax for exponential number");
}
break;
case InExponent:
@@ -776,7 +778,7 @@ int Lexer::lex()
&& isIdentLetter(current)) {
state = Bad;
err = IllegalIdentifier;
- errmsg = QCoreApplication::translate("QmlParser", "Identifier cannot start with numeric literal");
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Identifier cannot start with numeric literal");
}
// terminate string
@@ -800,11 +802,11 @@ int Lexer::lex()
case IgnoreParentheses:
break;
case CountParentheses:
- if (token == QmlJSGrammar::T_RPAREN) {
+ if (token == QDeclarativeJSGrammar::T_RPAREN) {
--parenthesesCount;
if (parenthesesCount == 0)
parenthesesState = BalancedParentheses;
- } else if (token == QmlJSGrammar::T_LPAREN) {
+ } else if (token == QDeclarativeJSGrammar::T_LPAREN) {
++parenthesesCount;
}
break;
@@ -817,7 +819,7 @@ int Lexer::lex()
case Eof:
return 0;
case Other:
- if (token == QmlJSGrammar::T_RBRACE || token == QmlJSGrammar::T_SEMICOLON)
+ if (token == QDeclarativeJSGrammar::T_RBRACE || token == QDeclarativeJSGrammar::T_SEMICOLON)
delimited = true;
return token;
case Identifier:
@@ -827,16 +829,16 @@ int Lexer::lex()
qsyylval.ustr = driver->intern(buffer16, pos16);
else
qsyylval.ustr = 0;
- return QmlJSGrammar::T_IDENTIFIER;
+ return QDeclarativeJSGrammar::T_IDENTIFIER;
}
- if (token == QmlJSGrammar::T_CONTINUE || token == QmlJSGrammar::T_BREAK
- || token == QmlJSGrammar::T_RETURN || token == QmlJSGrammar::T_THROW) {
+ if (token == QDeclarativeJSGrammar::T_CONTINUE || token == QDeclarativeJSGrammar::T_BREAK
+ || token == QDeclarativeJSGrammar::T_RETURN || token == QDeclarativeJSGrammar::T_THROW) {
restrKeyword = true;
- } else if (token == QmlJSGrammar::T_IF || token == QmlJSGrammar::T_FOR
- || token == QmlJSGrammar::T_WHILE || token == QmlJSGrammar::T_WITH) {
+ } else if (token == QDeclarativeJSGrammar::T_IF || token == QDeclarativeJSGrammar::T_FOR
+ || token == QDeclarativeJSGrammar::T_WHILE || token == QDeclarativeJSGrammar::T_WITH) {
parenthesesState = CountParentheses;
parenthesesCount = 0;
- } else if (token == QmlJSGrammar::T_DO) {
+ } else if (token == QDeclarativeJSGrammar::T_DO) {
parenthesesState = BalancedParentheses;
}
return token;
@@ -845,10 +847,10 @@ int Lexer::lex()
qsyylval.ustr = driver->intern(buffer16, pos16);
else
qsyylval.ustr = 0;
- return multiLineString?QmlJSGrammar::T_MULTILINE_STRING_LITERAL:QmlJSGrammar::T_STRING_LITERAL;
+ return multiLineString?QDeclarativeJSGrammar::T_MULTILINE_STRING_LITERAL:QDeclarativeJSGrammar::T_STRING_LITERAL;
case Number:
qsyylval.dval = dval;
- return QmlJSGrammar::T_NUMERIC_LITERAL;
+ return QDeclarativeJSGrammar::T_NUMERIC_LITERAL;
case Bad:
return -1;
default:
@@ -904,103 +906,103 @@ int Lexer::matchPunctuator(ushort c1, ushort c2,
{
if (c1 == '>' && c2 == '>' && c3 == '>' && c4 == '=') {
shift(4);
- return QmlJSGrammar::T_GT_GT_GT_EQ;
+ return QDeclarativeJSGrammar::T_GT_GT_GT_EQ;
} else if (c1 == '=' && c2 == '=' && c3 == '=') {
shift(3);
- return QmlJSGrammar::T_EQ_EQ_EQ;
+ return QDeclarativeJSGrammar::T_EQ_EQ_EQ;
} else if (c1 == '!' && c2 == '=' && c3 == '=') {
shift(3);
- return QmlJSGrammar::T_NOT_EQ_EQ;
+ return QDeclarativeJSGrammar::T_NOT_EQ_EQ;
} else if (c1 == '>' && c2 == '>' && c3 == '>') {
shift(3);
- return QmlJSGrammar::T_GT_GT_GT;
+ return QDeclarativeJSGrammar::T_GT_GT_GT;
} else if (c1 == '<' && c2 == '<' && c3 == '=') {
shift(3);
- return QmlJSGrammar::T_LT_LT_EQ;
+ return QDeclarativeJSGrammar::T_LT_LT_EQ;
} else if (c1 == '>' && c2 == '>' && c3 == '=') {
shift(3);
- return QmlJSGrammar::T_GT_GT_EQ;
+ return QDeclarativeJSGrammar::T_GT_GT_EQ;
} else if (c1 == '<' && c2 == '=') {
shift(2);
- return QmlJSGrammar::T_LE;
+ return QDeclarativeJSGrammar::T_LE;
} else if (c1 == '>' && c2 == '=') {
shift(2);
- return QmlJSGrammar::T_GE;
+ return QDeclarativeJSGrammar::T_GE;
} else if (c1 == '!' && c2 == '=') {
shift(2);
- return QmlJSGrammar::T_NOT_EQ;
+ return QDeclarativeJSGrammar::T_NOT_EQ;
} else if (c1 == '+' && c2 == '+') {
shift(2);
- return QmlJSGrammar::T_PLUS_PLUS;
+ return QDeclarativeJSGrammar::T_PLUS_PLUS;
} else if (c1 == '-' && c2 == '-') {
shift(2);
- return QmlJSGrammar::T_MINUS_MINUS;
+ return QDeclarativeJSGrammar::T_MINUS_MINUS;
} else if (c1 == '=' && c2 == '=') {
shift(2);
- return QmlJSGrammar::T_EQ_EQ;
+ return QDeclarativeJSGrammar::T_EQ_EQ;
} else if (c1 == '+' && c2 == '=') {
shift(2);
- return QmlJSGrammar::T_PLUS_EQ;
+ return QDeclarativeJSGrammar::T_PLUS_EQ;
} else if (c1 == '-' && c2 == '=') {
shift(2);
- return QmlJSGrammar::T_MINUS_EQ;
+ return QDeclarativeJSGrammar::T_MINUS_EQ;
} else if (c1 == '*' && c2 == '=') {
shift(2);
- return QmlJSGrammar::T_STAR_EQ;
+ return QDeclarativeJSGrammar::T_STAR_EQ;
} else if (c1 == '/' && c2 == '=') {
shift(2);
- return QmlJSGrammar::T_DIVIDE_EQ;
+ return QDeclarativeJSGrammar::T_DIVIDE_EQ;
} else if (c1 == '&' && c2 == '=') {
shift(2);
- return QmlJSGrammar::T_AND_EQ;
+ return QDeclarativeJSGrammar::T_AND_EQ;
} else if (c1 == '^' && c2 == '=') {
shift(2);
- return QmlJSGrammar::T_XOR_EQ;
+ return QDeclarativeJSGrammar::T_XOR_EQ;
} else if (c1 == '%' && c2 == '=') {
shift(2);
- return QmlJSGrammar::T_REMAINDER_EQ;
+ return QDeclarativeJSGrammar::T_REMAINDER_EQ;
} else if (c1 == '|' && c2 == '=') {
shift(2);
- return QmlJSGrammar::T_OR_EQ;
+ return QDeclarativeJSGrammar::T_OR_EQ;
} else if (c1 == '<' && c2 == '<') {
shift(2);
- return QmlJSGrammar::T_LT_LT;
+ return QDeclarativeJSGrammar::T_LT_LT;
} else if (c1 == '>' && c2 == '>') {
shift(2);
- return QmlJSGrammar::T_GT_GT;
+ return QDeclarativeJSGrammar::T_GT_GT;
} else if (c1 == '&' && c2 == '&') {
shift(2);
- return QmlJSGrammar::T_AND_AND;
+ return QDeclarativeJSGrammar::T_AND_AND;
} else if (c1 == '|' && c2 == '|') {
shift(2);
- return QmlJSGrammar::T_OR_OR;
+ return QDeclarativeJSGrammar::T_OR_OR;
}
switch(c1) {
- case '=': shift(1); return QmlJSGrammar::T_EQ;
- case '>': shift(1); return QmlJSGrammar::T_GT;
- case '<': shift(1); return QmlJSGrammar::T_LT;
- case ',': shift(1); return QmlJSGrammar::T_COMMA;
- case '!': shift(1); return QmlJSGrammar::T_NOT;
- case '~': shift(1); return QmlJSGrammar::T_TILDE;
- case '?': shift(1); return QmlJSGrammar::T_QUESTION;
- case ':': shift(1); return QmlJSGrammar::T_COLON;
- case '.': shift(1); return QmlJSGrammar::T_DOT;
- case '+': shift(1); return QmlJSGrammar::T_PLUS;
- case '-': shift(1); return QmlJSGrammar::T_MINUS;
- case '*': shift(1); return QmlJSGrammar::T_STAR;
- case '/': shift(1); return QmlJSGrammar::T_DIVIDE_;
- case '&': shift(1); return QmlJSGrammar::T_AND;
- case '|': shift(1); return QmlJSGrammar::T_OR;
- case '^': shift(1); return QmlJSGrammar::T_XOR;
- case '%': shift(1); return QmlJSGrammar::T_REMAINDER;
- case '(': shift(1); return QmlJSGrammar::T_LPAREN;
- case ')': shift(1); return QmlJSGrammar::T_RPAREN;
- case '{': shift(1); return QmlJSGrammar::T_LBRACE;
- case '}': shift(1); return QmlJSGrammar::T_RBRACE;
- case '[': shift(1); return QmlJSGrammar::T_LBRACKET;
- case ']': shift(1); return QmlJSGrammar::T_RBRACKET;
- case ';': shift(1); return QmlJSGrammar::T_SEMICOLON;
+ case '=': shift(1); return QDeclarativeJSGrammar::T_EQ;
+ case '>': shift(1); return QDeclarativeJSGrammar::T_GT;
+ case '<': shift(1); return QDeclarativeJSGrammar::T_LT;
+ case ',': shift(1); return QDeclarativeJSGrammar::T_COMMA;
+ case '!': shift(1); return QDeclarativeJSGrammar::T_NOT;
+ case '~': shift(1); return QDeclarativeJSGrammar::T_TILDE;
+ case '?': shift(1); return QDeclarativeJSGrammar::T_QUESTION;
+ case ':': shift(1); return QDeclarativeJSGrammar::T_COLON;
+ case '.': shift(1); return QDeclarativeJSGrammar::T_DOT;
+ case '+': shift(1); return QDeclarativeJSGrammar::T_PLUS;
+ case '-': shift(1); return QDeclarativeJSGrammar::T_MINUS;
+ case '*': shift(1); return QDeclarativeJSGrammar::T_STAR;
+ case '/': shift(1); return QDeclarativeJSGrammar::T_DIVIDE_;
+ case '&': shift(1); return QDeclarativeJSGrammar::T_AND;
+ case '|': shift(1); return QDeclarativeJSGrammar::T_OR;
+ case '^': shift(1); return QDeclarativeJSGrammar::T_XOR;
+ case '%': shift(1); return QDeclarativeJSGrammar::T_REMAINDER;
+ case '(': shift(1); return QDeclarativeJSGrammar::T_LPAREN;
+ case ')': shift(1); return QDeclarativeJSGrammar::T_RPAREN;
+ case '{': shift(1); return QDeclarativeJSGrammar::T_LBRACE;
+ case '}': shift(1); return QDeclarativeJSGrammar::T_RBRACE;
+ case '[': shift(1); return QDeclarativeJSGrammar::T_LBRACKET;
+ case ']': shift(1); return QDeclarativeJSGrammar::T_RBRACKET;
+ case ';': shift(1); return QDeclarativeJSGrammar::T_SEMICOLON;
default: return -1;
}
@@ -1107,7 +1109,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
while (1) {
if (isLineTerminator() || current == 0) {
- errmsg = QCoreApplication::translate("QmlParser", "Unterminated regular expression literal");
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Unterminated regular expression literal");
return false;
}
else if (current != '/' || lastWasEscape == true)
@@ -1131,7 +1133,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
while (isIdentLetter(current)) {
int flag = Ecma::RegExp::flagFromChar(current);
if (flag == 0) {
- errmsg = QCoreApplication::translate("QmlParser", "Invalid regular expression flag '%0'")
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Invalid regular expression flag '%0'")
.arg(QChar(current));
return false;
}
diff --git a/src/declarative/qml/parser/qmljslexer_p.h b/src/declarative/qml/parser/qdeclarativejslexer_p.h
index 8f95a90..71bd08c 100644
--- a/src/declarative/qml/parser/qmljslexer_p.h
+++ b/src/declarative/qml/parser/qdeclarativejslexer_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLJSLEXER_P_H
-#define QMLJSLEXER_P_H
+#ifndef QDECLARATIVEJSLEXER_P_H
+#define QDECLARATIVEJSLEXER_P_H
//
// W A R N I N G
@@ -53,13 +53,13 @@
// We mean it.
//
-#include "qmljsglobal_p.h"
+#include "qdeclarativejsglobal_p.h"
#include <QtCore/QString>
QT_QML_BEGIN_NAMESPACE
-namespace QmlJS {
+namespace QDeclarativeJS {
class Engine;
class NameId;
@@ -242,7 +242,7 @@ private:
bool tokenizeComments;
};
-} // namespace QmlJS
+} // namespace QDeclarativeJS
QT_QML_END_NAMESPACE
diff --git a/src/declarative/qml/parser/qmljsmemorypool_p.h b/src/declarative/qml/parser/qdeclarativejsmemorypool_p.h
index 5dffdc8..c8d52d0 100644
--- a/src/declarative/qml/parser/qmljsmemorypool_p.h
+++ b/src/declarative/qml/parser/qdeclarativejsmemorypool_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLJSMEMORYPOOL_P_H
-#define QMLJSMEMORYPOOL_P_H
+#ifndef QDECLARATIVEJSMEMORYPOOL_P_H
+#define QDECLARATIVEJSMEMORYPOOL_P_H
//
// W A R N I N G
@@ -53,7 +53,7 @@
// We mean it.
//
-#include "qmljsglobal_p.h"
+#include "qdeclarativejsglobal_p.h"
#include <QtCore/qglobal.h>
#include <QtCore/qshareddata.h>
@@ -62,7 +62,7 @@
QT_QML_BEGIN_NAMESPACE
-namespace QmlJS {
+namespace QDeclarativeJS {
class QML_PARSER_EXPORT MemoryPool : public QSharedData
{
@@ -126,7 +126,7 @@ private:
Q_DISABLE_COPY(MemoryPool)
};
-} // namespace QmlJS
+} // namespace QDeclarativeJS
QT_QML_END_NAMESPACE
diff --git a/src/declarative/qml/parser/qmljsnodepool_p.h b/src/declarative/qml/parser/qdeclarativejsnodepool_p.h
index 2055a7e..94637fd 100644
--- a/src/declarative/qml/parser/qmljsnodepool_p.h
+++ b/src/declarative/qml/parser/qdeclarativejsnodepool_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLJSNODEPOOL_P_H
-#define QMLJSNODEPOOL_P_H
+#ifndef QDECLARATIVEJSNODEPOOL_P_H
+#define QDECLARATIVEJSNODEPOOL_P_H
//
// W A R N I N G
@@ -53,15 +53,15 @@
// We mean it.
//
-#include "qmljsglobal_p.h"
-#include "qmljsmemorypool_p.h"
+#include "qdeclarativejsglobal_p.h"
+#include "qdeclarativejsmemorypool_p.h"
#include <QtCore/QHash>
#include <QtCore/QString>
QT_QML_BEGIN_NAMESPACE
-namespace QmlJS {
+namespace QDeclarativeJS {
namespace AST {
class Node;
@@ -132,7 +132,7 @@ private:
Q_DISABLE_COPY(NodePool)
};
-} // namespace QmlJS
+} // namespace QDeclarativeJS
QT_QML_END_NAMESPACE
diff --git a/src/declarative/qml/parser/qmljsparser.cpp b/src/declarative/qml/parser/qdeclarativejsparser.cpp
index 856d06d..fd9e690 100644
--- a/src/declarative/qml/parser/qmljsparser.cpp
+++ b/src/declarative/qml/parser/qdeclarativejsparser.cpp
@@ -44,14 +44,14 @@
#include <string.h>
-#include "qmljsengine_p.h"
-#include "qmljslexer_p.h"
-#include "qmljsast_p.h"
-#include "qmljsnodepool_p.h"
+#include "qdeclarativejsengine_p.h"
+#include "qdeclarativejslexer_p.h"
+#include "qdeclarativejsast_p.h"
+#include "qdeclarativejsnodepool_p.h"
-#include "qmljsparser_p.h"
+#include "qdeclarativejsparser_p.h"
#include <QVarLengthArray>
//
@@ -59,7 +59,7 @@
// Changes will be lost.
//
-using namespace QmlJS;
+using namespace QDeclarativeJS;
QT_QML_BEGIN_NAMESPACE
@@ -77,7 +77,7 @@ void Parser::reallocateStack()
inline static bool automatic(Engine *driver, int token)
{
- return token == QmlJSGrammar::T_RBRACE
+ return token == QDeclarativeJSGrammar::T_RBRACE
|| token == 0
|| driver->lexer()->prevTerminator();
}
@@ -356,7 +356,15 @@ case 32: {
node->colonToken = loc(2);
sym(1).Node = node;
} break;
-case 33:case 34:case 35:case 36:
+
+case 33: {
+ AST::UiObjectBinding *node = makeAstNode<AST::UiObjectBinding> (driver->nodePool(),
+ sym(3).UiQualifiedId, sym(1).UiQualifiedId, sym(4).UiObjectInitializer);
+ node->colonToken = loc(2);
+ node->hasOnToken = true;
+ sym(1).Node = node;
+} break;
+case 34:case 35:case 36:case 37:
{
AST::UiScriptBinding *node = makeAstNode<AST::UiScriptBinding> (driver->nodePool(),
sym(1).UiQualifiedId, sym(3).Statement);
@@ -364,35 +372,35 @@ case 33:case 34:case 35:case 36:
sym(1).Node = node;
} break;
-case 37:
+case 38:
-case 38: {
+case 39: {
sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
break;
}
-case 40: {
+case 41: {
sym(1).Node = 0;
} break;
-case 41: {
+case 42: {
sym(1).Node = sym(1).UiParameterList->finish ();
} break;
-case 42: {
+case 43: {
AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).sval, sym(2).sval);
node->identifierToken = loc(2);
sym(1).Node = node;
} break;
-case 43: {
+case 44: {
AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).UiParameterList, sym(3).sval, sym(4).sval);
node->commaToken = loc(2);
node->identifierToken = loc(4);
sym(1).Node = node;
} break;
-case 45: {
+case 46: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval);
node->type = AST::UiPublicMember::Signal;
node->propertyToken = loc(1);
@@ -403,7 +411,7 @@ case 45: {
sym(1).Node = node;
} break;
-case 47: {
+case 48: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval);
node->type = AST::UiPublicMember::Signal;
node->propertyToken = loc(1);
@@ -413,7 +421,7 @@ case 47: {
sym(1).Node = node;
} break;
-case 49: {
+case 50: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval);
node->typeModifier = sym(2).sval;
node->propertyToken = loc(1);
@@ -424,7 +432,7 @@ case 49: {
sym(1).Node = node;
} break;
-case 51: {
+case 52: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
node->propertyToken = loc(1);
node->typeToken = loc(2);
@@ -433,7 +441,7 @@ case 51: {
sym(1).Node = node;
} break;
-case 53: {
+case 54: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval);
node->isDefaultMember = true;
node->defaultToken = loc(1);
@@ -444,7 +452,7 @@ case 53: {
sym(1).Node = node;
} break;
-case 55: {
+case 56: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
sym(5).Expression);
node->propertyToken = loc(1);
@@ -455,7 +463,7 @@ case 55: {
sym(1).Node = node;
} break;
-case 57: {
+case 58: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
sym(6).Expression);
node->isReadonlyMember = true;
@@ -468,7 +476,7 @@ case 57: {
sym(1).Node = node;
} break;
-case 59: {
+case 60: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
sym(6).Expression);
node->isDefaultMember = true;
@@ -481,75 +489,81 @@ case 59: {
sym(1).Node = node;
} break;
-case 60: {
+case 61: {
sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node);
} break;
-case 61: {
+case 62: {
sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node);
} break;
-case 63: {
- QString s = QLatin1String(QmlJSGrammar::spell[T_PROPERTY]);
+case 64: {
+ QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_PROPERTY]);
sym(1).sval = driver->intern(s.constData(), s.length());
break;
}
-case 64: {
- QString s = QLatin1String(QmlJSGrammar::spell[T_SIGNAL]);
+case 65: {
+ QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_SIGNAL]);
sym(1).sval = driver->intern(s.constData(), s.length());
break;
}
-case 65: {
- QString s = QLatin1String(QmlJSGrammar::spell[T_READONLY]);
+case 66: {
+ QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_READONLY]);
sym(1).sval = driver->intern(s.constData(), s.length());
break;
}
-case 66: {
+case 67: {
+ QString s = QLatin1String(QDeclarativeJSGrammar::spell[T_READONLY]);
+ sym(1).sval = driver->intern(s.constData(), s.length());
+ break;
+}
+
+case 68: {
AST::ThisExpression *node = makeAstNode<AST::ThisExpression> (driver->nodePool());
node->thisToken = loc(1);
sym(1).Node = node;
} break;
-case 67: {
+case 69: {
AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), sym(1).sval);
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
-case 68: {
+case 70: {
AST::NullExpression *node = makeAstNode<AST::NullExpression> (driver->nodePool());
node->nullToken = loc(1);
sym(1).Node = node;
} break;
-case 69: {
+case 71: {
AST::TrueLiteral *node = makeAstNode<AST::TrueLiteral> (driver->nodePool());
node->trueToken = loc(1);
sym(1).Node = node;
} break;
-case 70: {
+case 72: {
AST::FalseLiteral *node = makeAstNode<AST::FalseLiteral> (driver->nodePool());
node->falseToken = loc(1);
sym(1).Node = node;
} break;
-case 71: {
+case 73: {
AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval);
node->literalToken = loc(1);
sym(1).Node = node;
} break;
-case 72:
-case 73: {
+case 74:
+case 75: {
AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval);
node->literalToken = loc(1);
sym(1).Node = node;
} break;
-case 74: {
+case 76: {
bool rx = lexer->scanRegExp(Lexer::NoPrefix);
if (!rx) {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
@@ -560,7 +574,7 @@ case 74: {
sym(1).Node = node;
} break;
-case 75: {
+case 77: {
bool rx = lexer->scanRegExp(Lexer::EqualPrefix);
if (!rx) {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
@@ -571,28 +585,28 @@ case 75: {
sym(1).Node = node;
} break;
-case 76: {
+case 78: {
AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), (AST::Elision *) 0);
node->lbracketToken = loc(1);
node->rbracketToken = loc(2);
sym(1).Node = node;
} break;
-case 77: {
+case 79: {
AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision->finish());
node->lbracketToken = loc(1);
node->rbracketToken = loc(3);
sym(1).Node = node;
} break;
-case 78: {
+case 80: {
AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ());
node->lbracketToken = loc(1);
node->rbracketToken = loc(3);
sym(1).Node = node;
} break;
-case 79: {
+case 81: {
AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (),
(AST::Elision *) 0);
node->lbracketToken = loc(1);
@@ -601,7 +615,7 @@ case 79: {
sym(1).Node = node;
} break;
-case 80: {
+case 82: {
AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (),
sym(4).Elision->finish());
node->lbracketToken = loc(1);
@@ -610,7 +624,7 @@ case 80: {
sym(1).Node = node;
} break;
-case 81: {
+case 83: {
AST::ObjectLiteral *node = 0;
if (sym(2).Node)
node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(),
@@ -622,7 +636,7 @@ case 81: {
sym(1).Node = node;
} break;
-case 82: {
+case 84: {
AST::ObjectLiteral *node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(),
sym(2).PropertyNameAndValueList->finish ());
node->lbraceToken = loc(1);
@@ -630,14 +644,14 @@ case 82: {
sym(1).Node = node;
} break;
-case 83: {
+case 85: {
AST::NestedExpression *node = makeAstNode<AST::NestedExpression>(driver->nodePool(), sym(2).Expression);
node->lparenToken = loc(1);
node->rparenToken = loc(3);
sym(1).Node = node;
} break;
-case 84: {
+case 86: {
if (AST::ArrayMemberExpression *mem = AST::cast<AST::ArrayMemberExpression *>(sym(1).Expression)) {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, mem->lbracketToken,
QLatin1String("Ignored annotation")));
@@ -657,48 +671,48 @@ case 84: {
}
} break;
-case 85: {
+case 87: {
sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), (AST::Elision *) 0, sym(1).Expression);
} break;
-case 86: {
+case 88: {
sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).Elision->finish(), sym(2).Expression);
} break;
-case 87: {
+case 89: {
AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList,
(AST::Elision *) 0, sym(3).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 88: {
+case 90: {
AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision->finish(),
sym(4).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 89: {
+case 91: {
AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool());
node->commaToken = loc(1);
sym(1).Node = node;
} break;
-case 90: {
+case 92: {
AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool(), sym(1).Elision);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 91: {
+case 93: {
AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(),
sym(1).PropertyName, sym(3).Expression);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
-case 92: {
+case 94: {
AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(),
sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression);
node->commaToken = loc(2);
@@ -706,40 +720,36 @@ case 92: {
sym(1).Node = node;
} break;
-case 93: {
+case 95: {
AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
node->propertyNameToken = loc(1);
sym(1).Node = node;
} break;
-case 94:
-case 95: {
+case 96:
+case 97: {
AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()));
node->propertyNameToken = loc(1);
sym(1).Node = node;
} break;
-case 96: {
+case 98: {
AST::StringLiteralPropertyName *node = makeAstNode<AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval);
node->propertyNameToken = loc(1);
sym(1).Node = node;
} break;
-case 97: {
+case 99: {
AST::NumericLiteralPropertyName *node = makeAstNode<AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval);
node->propertyNameToken = loc(1);
sym(1).Node = node;
} break;
-case 98: {
+case 100: {
AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
node->propertyNameToken = loc(1);
sym(1).Node = node;
} break;
-case 99:
-
-case 100:
-
case 101:
case 102:
@@ -797,25 +807,29 @@ case 127:
case 128:
case 129:
+
+case 130:
+
+case 131:
{
sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount());
} break;
-case 134: {
+case 136: {
AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
node->lbracketToken = loc(2);
node->rbracketToken = loc(4);
sym(1).Node = node;
} break;
-case 135: {
+case 137: {
AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
node->dotToken = loc(2);
node->identifierToken = loc(3);
sym(1).Node = node;
} break;
-case 136: {
+case 138: {
AST::NewMemberExpression *node = makeAstNode<AST::NewMemberExpression> (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList);
node->newToken = loc(1);
node->lparenToken = loc(3);
@@ -823,316 +837,309 @@ case 136: {
sym(1).Node = node;
} break;
-case 138: {
+case 140: {
AST::NewExpression *node = makeAstNode<AST::NewExpression> (driver->nodePool(), sym(2).Expression);
node->newToken = loc(1);
sym(1).Node = node;
} break;
-case 139: {
+case 141: {
AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList);
node->lparenToken = loc(2);
node->rparenToken = loc(4);
sym(1).Node = node;
} break;
-case 140: {
+case 142: {
AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList);
node->lparenToken = loc(2);
node->rparenToken = loc(4);
sym(1).Node = node;
} break;
-case 141: {
+case 143: {
AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
node->lbracketToken = loc(2);
node->rbracketToken = loc(4);
sym(1).Node = node;
} break;
-case 142: {
+case 144: {
AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval);
node->dotToken = loc(2);
node->identifierToken = loc(3);
sym(1).Node = node;
} break;
-case 143: {
+case 145: {
sym(1).Node = 0;
} break;
-case 144: {
+case 146: {
sym(1).Node = sym(1).ArgumentList->finish();
} break;
-case 145: {
+case 147: {
sym(1).Node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).Expression);
} break;
-case 146: {
+case 148: {
AST::ArgumentList *node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 150: {
+case 152: {
AST::PostIncrementExpression *node = makeAstNode<AST::PostIncrementExpression> (driver->nodePool(), sym(1).Expression);
node->incrementToken = loc(2);
sym(1).Node = node;
} break;
-case 151: {
+case 153: {
AST::PostDecrementExpression *node = makeAstNode<AST::PostDecrementExpression> (driver->nodePool(), sym(1).Expression);
node->decrementToken = loc(2);
sym(1).Node = node;
} break;
-case 153: {
+case 155: {
AST::DeleteExpression *node = makeAstNode<AST::DeleteExpression> (driver->nodePool(), sym(2).Expression);
node->deleteToken = loc(1);
sym(1).Node = node;
} break;
-case 154: {
+case 156: {
AST::VoidExpression *node = makeAstNode<AST::VoidExpression> (driver->nodePool(), sym(2).Expression);
node->voidToken = loc(1);
sym(1).Node = node;
} break;
-case 155: {
+case 157: {
AST::TypeOfExpression *node = makeAstNode<AST::TypeOfExpression> (driver->nodePool(), sym(2).Expression);
node->typeofToken = loc(1);
sym(1).Node = node;
} break;
-case 156: {
+case 158: {
AST::PreIncrementExpression *node = makeAstNode<AST::PreIncrementExpression> (driver->nodePool(), sym(2).Expression);
node->incrementToken = loc(1);
sym(1).Node = node;
} break;
-case 157: {
+case 159: {
AST::PreDecrementExpression *node = makeAstNode<AST::PreDecrementExpression> (driver->nodePool(), sym(2).Expression);
node->decrementToken = loc(1);
sym(1).Node = node;
} break;
-case 158: {
+case 160: {
AST::UnaryPlusExpression *node = makeAstNode<AST::UnaryPlusExpression> (driver->nodePool(), sym(2).Expression);
node->plusToken = loc(1);
sym(1).Node = node;
} break;
-case 159: {
+case 161: {
AST::UnaryMinusExpression *node = makeAstNode<AST::UnaryMinusExpression> (driver->nodePool(), sym(2).Expression);
node->minusToken = loc(1);
sym(1).Node = node;
} break;
-case 160: {
+case 162: {
AST::TildeExpression *node = makeAstNode<AST::TildeExpression> (driver->nodePool(), sym(2).Expression);
node->tildeToken = loc(1);
sym(1).Node = node;
} break;
-case 161: {
+case 163: {
AST::NotExpression *node = makeAstNode<AST::NotExpression> (driver->nodePool(), sym(2).Expression);
node->notToken = loc(1);
sym(1).Node = node;
} break;
-case 163: {
+case 165: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Mul, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 164: {
+case 166: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Div, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 165: {
+case 167: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Mod, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 167: {
+case 169: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Add, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 168: {
+case 170: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Sub, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 170: {
+case 172: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::LShift, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 171: {
+case 173: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::RShift, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 172: {
+case 174: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::URShift, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 174: {
+case 176: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Lt, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 175: {
+case 177: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Gt, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 176: {
+case 178: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Le, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 177: {
+case 179: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Ge, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 178: {
+case 180: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::InstanceOf, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 179: {
+case 181: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::In, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 181: {
+case 183: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Lt, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 182: {
+case 184: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Gt, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 183: {
+case 185: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Le, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 184: {
+case 186: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Ge, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 185: {
+case 187: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::InstanceOf, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 187: {
+case 189: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Equal, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 188: {
+case 190: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::NotEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 189: {
+case 191: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::StrictEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 190: {
+case 192: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::StrictNotEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 192: {
+case 194: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::Equal, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 193: {
+case 195: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::NotEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 194: {
+case 196: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
QSOperator::StrictEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 195: {
- AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
- QSOperator::StrictNotEqual, sym(3).Expression);
- node->operatorToken = loc(2);
- sym(1).Node = node;
-} break;
-
case 197: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
- QSOperator::BitAnd, sym(3).Expression);
+ QSOperator::StrictNotEqual, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
@@ -1146,7 +1153,7 @@ case 199: {
case 201: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
- QSOperator::BitXor, sym(3).Expression);
+ QSOperator::BitAnd, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
@@ -1160,7 +1167,7 @@ case 203: {
case 205: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
- QSOperator::BitOr, sym(3).Expression);
+ QSOperator::BitXor, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
@@ -1174,7 +1181,7 @@ case 207: {
case 209: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
- QSOperator::And, sym(3).Expression);
+ QSOperator::BitOr, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
@@ -1188,7 +1195,7 @@ case 211: {
case 213: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
- QSOperator::Or, sym(3).Expression);
+ QSOperator::And, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
@@ -1201,6 +1208,13 @@ case 215: {
} break;
case 217: {
+ AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
+ QSOperator::Or, sym(3).Expression);
+ node->operatorToken = loc(2);
+ sym(1).Node = node;
+} break;
+
+case 219: {
AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression,
sym(3).Expression, sym(5).Expression);
node->questionToken = loc(2);
@@ -1208,7 +1222,7 @@ case 217: {
sym(1).Node = node;
} break;
-case 219: {
+case 221: {
AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression,
sym(3).Expression, sym(5).Expression);
node->questionToken = loc(2);
@@ -1216,112 +1230,112 @@ case 219: {
sym(1).Node = node;
} break;
-case 221: {
+case 223: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
sym(2).ival, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 223: {
+case 225: {
AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression,
sym(2).ival, sym(3).Expression);
node->operatorToken = loc(2);
sym(1).Node = node;
} break;
-case 224: {
+case 226: {
sym(1).ival = QSOperator::Assign;
} break;
-case 225: {
+case 227: {
sym(1).ival = QSOperator::InplaceMul;
} break;
-case 226: {
+case 228: {
sym(1).ival = QSOperator::InplaceDiv;
} break;
-case 227: {
+case 229: {
sym(1).ival = QSOperator::InplaceMod;
} break;
-case 228: {
+case 230: {
sym(1).ival = QSOperator::InplaceAdd;
} break;
-case 229: {
+case 231: {
sym(1).ival = QSOperator::InplaceSub;
} break;
-case 230: {
+case 232: {
sym(1).ival = QSOperator::InplaceLeftShift;
} break;
-case 231: {
+case 233: {
sym(1).ival = QSOperator::InplaceRightShift;
} break;
-case 232: {
+case 234: {
sym(1).ival = QSOperator::InplaceURightShift;
} break;
-case 233: {
+case 235: {
sym(1).ival = QSOperator::InplaceAnd;
} break;
-case 234: {
+case 236: {
sym(1).ival = QSOperator::InplaceXor;
} break;
-case 235: {
+case 237: {
sym(1).ival = QSOperator::InplaceOr;
} break;
-case 237: {
+case 239: {
AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 238: {
+case 240: {
sym(1).Node = 0;
} break;
-case 241: {
+case 243: {
AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 242: {
+case 244: {
sym(1).Node = 0;
} break;
-case 259: {
+case 261: {
AST::Block *node = makeAstNode<AST::Block> (driver->nodePool(), sym(2).StatementList);
node->lbraceToken = loc(1);
node->rbraceToken = loc(3);
sym(1).Node = node;
} break;
-case 260: {
+case 262: {
sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).Statement);
} break;
-case 261: {
+case 263: {
sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).StatementList, sym(2).Statement);
} break;
-case 262: {
+case 264: {
sym(1).Node = 0;
} break;
-case 263: {
+case 265: {
sym(1).Node = sym(1).StatementList->finish ();
} break;
-case 265: {
+case 267: {
AST::VariableStatement *node = makeAstNode<AST::VariableStatement> (driver->nodePool(),
sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST));
node->declarationKindToken = loc(1);
@@ -1329,76 +1343,76 @@ case 265: {
sym(1).Node = node;
} break;
-case 266: {
+case 268: {
sym(1).ival = T_CONST;
} break;
-case 267: {
+case 269: {
sym(1).ival = T_VAR;
} break;
-case 268: {
+case 270: {
sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration);
} break;
-case 269: {
+case 271: {
AST::VariableDeclarationList *node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(),
sym(1).VariableDeclarationList, sym(3).VariableDeclaration);
node->commaToken = loc(2);
sym(1).Node = node;
} break;
-case 270: {
+case 272: {
sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration);
} break;
-case 271: {
+case 273: {
sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration);
} break;
-case 272: {
+case 274: {
AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
-case 273: {
+case 275: {
AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression);
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
-case 274: {
+case 276: {
// ### TODO: AST for initializer
sym(1) = sym(2);
} break;
-case 275: {
+case 277: {
sym(1).Node = 0;
} break;
-case 277: {
+case 279: {
// ### TODO: AST for initializer
sym(1) = sym(2);
} break;
-case 278: {
+case 280: {
sym(1).Node = 0;
} break;
-case 280: {
+case 282: {
AST::EmptyStatement *node = makeAstNode<AST::EmptyStatement> (driver->nodePool());
node->semicolonToken = loc(1);
sym(1).Node = node;
} break;
-case 282: {
+case 284: {
AST::ExpressionStatement *node = makeAstNode<AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
-case 283: {
+case 285: {
AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement);
node->ifToken = loc(1);
node->lparenToken = loc(2);
@@ -1407,7 +1421,7 @@ case 283: {
sym(1).Node = node;
} break;
-case 284: {
+case 286: {
AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
node->ifToken = loc(1);
node->lparenToken = loc(2);
@@ -1415,7 +1429,7 @@ case 284: {
sym(1).Node = node;
} break;
-case 286: {
+case 288: {
AST::DoWhileStatement *node = makeAstNode<AST::DoWhileStatement> (driver->nodePool(), sym(2).Statement, sym(5).Expression);
node->doToken = loc(1);
node->whileToken = loc(3);
@@ -1425,7 +1439,7 @@ case 286: {
sym(1).Node = node;
} break;
-case 287: {
+case 289: {
AST::WhileStatement *node = makeAstNode<AST::WhileStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
node->whileToken = loc(1);
node->lparenToken = loc(2);
@@ -1433,7 +1447,7 @@ case 287: {
sym(1).Node = node;
} break;
-case 288: {
+case 290: {
AST::ForStatement *node = makeAstNode<AST::ForStatement> (driver->nodePool(), sym(3).Expression,
sym(5).Expression, sym(7).Expression, sym(9).Statement);
node->forToken = loc(1);
@@ -1444,7 +1458,7 @@ case 288: {
sym(1).Node = node;
} break;
-case 289: {
+case 291: {
AST::LocalForStatement *node = makeAstNode<AST::LocalForStatement> (driver->nodePool(),
sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression,
sym(8).Expression, sym(10).Statement);
@@ -1457,7 +1471,7 @@ case 289: {
sym(1).Node = node;
} break;
-case 290: {
+case 292: {
AST:: ForEachStatement *node = makeAstNode<AST::ForEachStatement> (driver->nodePool(), sym(3).Expression,
sym(5).Expression, sym(7).Statement);
node->forToken = loc(1);
@@ -1467,7 +1481,7 @@ case 290: {
sym(1).Node = node;
} break;
-case 291: {
+case 293: {
AST::LocalForEachStatement *node = makeAstNode<AST::LocalForEachStatement> (driver->nodePool(),
sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement);
node->forToken = loc(1);
@@ -1478,14 +1492,14 @@ case 291: {
sym(1).Node = node;
} break;
-case 293: {
+case 295: {
AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool());
node->continueToken = loc(1);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
-case 295: {
+case 297: {
AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool(), sym(2).sval);
node->continueToken = loc(1);
node->identifierToken = loc(2);
@@ -1493,14 +1507,14 @@ case 295: {
sym(1).Node = node;
} break;
-case 297: {
+case 299: {
AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool());
node->breakToken = loc(1);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
-case 299: {
+case 301: {
AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), sym(2).sval);
node->breakToken = loc(1);
node->identifierToken = loc(2);
@@ -1508,14 +1522,14 @@ case 299: {
sym(1).Node = node;
} break;
-case 301: {
+case 303: {
AST::ReturnStatement *node = makeAstNode<AST::ReturnStatement> (driver->nodePool(), sym(2).Expression);
node->returnToken = loc(1);
node->semicolonToken = loc(3);
sym(1).Node = node;
} break;
-case 302: {
+case 304: {
AST::WithStatement *node = makeAstNode<AST::WithStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement);
node->withToken = loc(1);
node->lparenToken = loc(2);
@@ -1523,7 +1537,7 @@ case 302: {
sym(1).Node = node;
} break;
-case 303: {
+case 305: {
AST::SwitchStatement *node = makeAstNode<AST::SwitchStatement> (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock);
node->switchToken = loc(1);
node->lparenToken = loc(2);
@@ -1531,90 +1545,90 @@ case 303: {
sym(1).Node = node;
} break;
-case 304: {
+case 306: {
AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses);
node->lbraceToken = loc(1);
node->rbraceToken = loc(3);
sym(1).Node = node;
} break;
-case 305: {
+case 307: {
AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses);
node->lbraceToken = loc(1);
node->rbraceToken = loc(5);
sym(1).Node = node;
} break;
-case 306: {
+case 308: {
sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClause);
} break;
-case 307: {
+case 309: {
sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause);
} break;
-case 308: {
+case 310: {
sym(1).Node = 0;
} break;
-case 309: {
+case 311: {
sym(1).Node = sym(1).CaseClauses->finish ();
} break;
-case 310: {
+case 312: {
AST::CaseClause *node = makeAstNode<AST::CaseClause> (driver->nodePool(), sym(2).Expression, sym(4).StatementList);
node->caseToken = loc(1);
node->colonToken = loc(3);
sym(1).Node = node;
} break;
-case 311: {
+case 313: {
AST::DefaultClause *node = makeAstNode<AST::DefaultClause> (driver->nodePool(), sym(3).StatementList);
node->defaultToken = loc(1);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
-case 312:
-case 313: {
+case 314:
+case 315: {
AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()), sym(3).Statement);
node->identifierToken = loc(1);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
-case 314: {
+case 316: {
AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), sym(1).sval, sym(3).Statement);
node->identifierToken = loc(1);
node->colonToken = loc(2);
sym(1).Node = node;
} break;
-case 316: {
+case 318: {
AST::ThrowStatement *node = makeAstNode<AST::ThrowStatement> (driver->nodePool(), sym(2).Expression);
node->throwToken = loc(1);
node->semicolonToken = loc(3);
sym(1).Node = node;
} break;
-case 317: {
+case 319: {
AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch);
node->tryToken = loc(1);
sym(1).Node = node;
} break;
-case 318: {
+case 320: {
AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Finally);
node->tryToken = loc(1);
sym(1).Node = node;
} break;
-case 319: {
+case 321: {
AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally);
node->tryToken = loc(1);
sym(1).Node = node;
} break;
-case 320: {
+case 322: {
AST::Catch *node = makeAstNode<AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Block);
node->catchToken = loc(1);
node->lparenToken = loc(2);
@@ -1623,20 +1637,20 @@ case 320: {
sym(1).Node = node;
} break;
-case 321: {
+case 323: {
AST::Finally *node = makeAstNode<AST::Finally> (driver->nodePool(), sym(2).Block);
node->finallyToken = loc(1);
sym(1).Node = node;
} break;
-case 323: {
+case 325: {
AST::DebuggerStatement *node = makeAstNode<AST::DebuggerStatement> (driver->nodePool());
node->debuggerToken = loc(1);
node->semicolonToken = loc(2);
sym(1).Node = node;
} break;
-case 324: {
+case 326: {
AST::FunctionDeclaration *node = makeAstNode<AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
node->functionToken = loc(1);
node->identifierToken = loc(2);
@@ -1647,7 +1661,7 @@ case 324: {
sym(1).Node = node;
} break;
-case 325: {
+case 327: {
AST::FunctionExpression *node = makeAstNode<AST::FunctionExpression> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody);
node->functionToken = loc(1);
if (sym(2).sval)
@@ -1659,60 +1673,60 @@ case 325: {
sym(1).Node = node;
} break;
-case 326: {
+case 328: {
AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).sval);
node->identifierToken = loc(1);
sym(1).Node = node;
} break;
-case 327: {
+case 329: {
AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval);
node->commaToken = loc(2);
node->identifierToken = loc(3);
sym(1).Node = node;
} break;
-case 328: {
+case 330: {
sym(1).Node = 0;
} break;
-case 329: {
+case 331: {
sym(1).Node = sym(1).FormalParameterList->finish ();
} break;
-case 330: {
+case 332: {
sym(1).Node = 0;
} break;
-case 332: {
+case 334: {
sym(1).Node = makeAstNode<AST::FunctionBody> (driver->nodePool(), sym(1).SourceElements->finish ());
} break;
-case 333: {
+case 335: {
sym(1).Node = makeAstNode<AST::Program> (driver->nodePool(), sym(1).SourceElements->finish ());
} break;
-case 334: {
+case 336: {
sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElement);
} break;
-case 335: {
+case 337: {
sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement);
} break;
-case 336: {
+case 338: {
sym(1).Node = makeAstNode<AST::StatementSourceElement> (driver->nodePool(), sym(1).Statement);
} break;
-case 337: {
+case 339: {
sym(1).Node = makeAstNode<AST::FunctionSourceElement> (driver->nodePool(), sym(1).FunctionDeclaration);
} break;
-case 338: {
+case 340: {
sym(1).sval = 0;
} break;
-case 340: {
+case 342: {
sym(1).Node = 0;
} break;
@@ -1736,7 +1750,7 @@ case 340: {
yylloc.startColumn += yylloc.length;
yylloc.length = 0;
- //const QString msg = qApp->translate("QmlParser", "Missing `;'");
+ //const QString msg = qApp->translate("QDeclarativeParser", "Missing `;'");
//diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg));
first_token = &token_buffer[0];
@@ -1764,9 +1778,9 @@ case 340: {
QString msg;
int token = token_buffer[0].token;
if (token < 0 || token >= TERMINAL_COUNT)
- msg = qApp->translate("QmlParser", "Syntax error");
+ msg = qApp->translate("QDeclarativeParser", "Syntax error");
else
- msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
+ msg = qApp->translate("QDeclarativeParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
action = errorState;
@@ -1794,7 +1808,7 @@ case 340: {
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
int a = t_action(errorState, *tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
+ const QString msg = qApp->translate("QDeclarativeParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = *tk;
@@ -1818,7 +1832,7 @@ case 340: {
int a = t_action(errorState, tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
+ const QString msg = qApp->translate("QDeclarativeParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = tk;
@@ -1831,7 +1845,7 @@ case 340: {
}
}
- const QString msg = qApp->translate("QmlParser", "Syntax error");
+ const QString msg = qApp->translate("QDeclarativeParser", "Syntax error");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
}
diff --git a/src/declarative/qml/parser/qmljsparser_p.h b/src/declarative/qml/parser/qdeclarativejsparser_p.h
index 42fb422..3864398 100644
--- a/src/declarative/qml/parser/qmljsparser_p.h
+++ b/src/declarative/qml/parser/qdeclarativejsparser_p.h
@@ -56,25 +56,25 @@
// Changes will be lost.
//
-#ifndef QMLJSPARSER_P_H
-#define QMLJSPARSER_P_H
+#ifndef QDECLARATIVEJSPARSER_P_H
+#define QDECLARATIVEJSPARSER_P_H
-#include "qmljsglobal_p.h"
-#include "qmljsgrammar_p.h"
-#include "qmljsast_p.h"
-#include "qmljsengine_p.h"
+#include "qdeclarativejsglobal_p.h"
+#include "qdeclarativejsgrammar_p.h"
+#include "qdeclarativejsast_p.h"
+#include "qdeclarativejsengine_p.h"
#include <QtCore/QList>
#include <QtCore/QString>
QT_QML_BEGIN_NAMESPACE
-namespace QmlJS {
+namespace QDeclarativeJS {
class Engine;
class NameId;
-class QML_PARSER_EXPORT Parser: protected QmlJSGrammar
+class QML_PARSER_EXPORT Parser: protected QDeclarativeJSGrammar
{
public:
union Value {
@@ -231,16 +231,16 @@ protected:
QList<DiagnosticMessage> diagnostic_messages;
};
-} // end of namespace QmlJS
+} // end of namespace QDeclarativeJS
-#define J_SCRIPT_REGEXPLITERAL_RULE1 74
+#define J_SCRIPT_REGEXPLITERAL_RULE1 76
-#define J_SCRIPT_REGEXPLITERAL_RULE2 75
+#define J_SCRIPT_REGEXPLITERAL_RULE2 77
QT_QML_END_NAMESPACE
-#endif // QMLJSPARSER_P_H
+#endif // QDECLARATIVEJSPARSER_P_H
diff --git a/src/declarative/qml/parser/qmljsgrammar.cpp b/src/declarative/qml/parser/qmljsgrammar.cpp
deleted file mode 100644
index 12071db..0000000
--- a/src/declarative/qml/parser/qmljsgrammar.cpp
+++ /dev/null
@@ -1,939 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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$
-**
-****************************************************************************/
-
-// This file was generated by qlalr - DO NOT EDIT!
-#include "qmljsgrammar_p.h"
-
-QT_BEGIN_NAMESPACE
-
-const char *const QmlJSGrammar::spell [] = {
- "end of file", "&", "&&", "&=", "break", "case", "catch", ":", ";", "continue",
- "default", "delete", "/", "/=", "do", ".", "else", "=", "==", "===",
- "finally", "for", "function", ">=", ">", ">>", ">>=", ">>>", ">>>=", "identifier",
- "if", "in", "instanceof", "{", "[", "<=", "(", "<", "<<", "<<=",
- "-", "-=", "--", "new", "!", "!=", "!==", "numeric literal", "|", "|=",
- "||", "+", "+=", "++", "?", "}", "]", "%", "%=", "return",
- ")", ";", 0, "*", "*=", "string literal", "property", "signal", "readonly", "switch",
- "this", "throw", "~", "try", "typeof", "var", "void", "while", "with", "^",
- "^=", "null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "comment", "public",
- "import", "as", 0, 0, 0, 0, 0, 0, 0, 0};
-
-const short QmlJSGrammar::lhs [] = {
- 100, 100, 100, 100, 100, 100, 101, 107, 107, 110,
- 110, 112, 111, 111, 111, 111, 111, 111, 111, 111,
- 114, 109, 108, 117, 117, 118, 118, 119, 119, 116,
- 105, 105, 105, 105, 105, 105, 105, 125, 125, 125,
- 126, 126, 127, 127, 105, 105, 105, 105, 105, 105,
- 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
- 105, 105, 115, 115, 115, 115, 130, 130, 130, 130,
- 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
- 130, 130, 130, 130, 120, 132, 132, 132, 132, 131,
- 131, 134, 134, 136, 136, 136, 136, 136, 136, 137,
- 137, 137, 137, 137, 137, 137, 137, 137, 137, 137,
- 137, 137, 137, 137, 137, 137, 137, 137, 137, 137,
- 137, 137, 137, 137, 137, 137, 137, 137, 137, 137,
- 138, 138, 113, 113, 113, 113, 113, 141, 141, 142,
- 142, 142, 142, 140, 140, 143, 143, 144, 144, 145,
- 145, 145, 146, 146, 146, 146, 146, 146, 146, 146,
- 146, 146, 147, 147, 147, 147, 148, 148, 148, 149,
- 149, 149, 149, 150, 150, 150, 150, 150, 150, 150,
- 151, 151, 151, 151, 151, 151, 152, 152, 152, 152,
- 152, 153, 153, 153, 153, 153, 154, 154, 155, 155,
- 156, 156, 157, 157, 158, 158, 159, 159, 160, 160,
- 161, 161, 162, 162, 163, 163, 164, 164, 165, 165,
- 135, 135, 166, 166, 167, 167, 167, 167, 167, 167,
- 167, 167, 167, 167, 167, 167, 103, 103, 168, 168,
- 169, 169, 170, 170, 102, 102, 102, 102, 102, 102,
- 102, 102, 102, 102, 102, 102, 102, 102, 102, 121,
- 182, 182, 181, 181, 129, 129, 183, 183, 184, 184,
- 186, 186, 185, 187, 190, 188, 188, 191, 189, 189,
- 122, 123, 123, 124, 124, 171, 171, 171, 171, 171,
- 171, 171, 172, 172, 172, 172, 173, 173, 173, 173,
- 174, 174, 175, 177, 192, 192, 195, 195, 193, 193,
- 196, 194, 176, 176, 176, 178, 178, 179, 179, 179,
- 197, 198, 180, 180, 128, 139, 202, 202, 199, 199,
- 200, 200, 203, 106, 204, 204, 104, 104, 201, 201,
- 133, 133, 205};
-
-const short QmlJSGrammar::rhs [] = {
- 2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
- 2, 1, 2, 2, 3, 3, 5, 5, 4, 4,
- 2, 0, 1, 1, 2, 1, 3, 2, 3, 2,
- 1, 5, 4, 3, 3, 3, 3, 1, 1, 1,
- 0, 1, 2, 4, 6, 6, 3, 3, 7, 7,
- 4, 4, 5, 5, 6, 6, 7, 7, 7, 7,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 2, 3, 3, 4,
- 5, 3, 4, 3, 1, 1, 2, 3, 4, 1,
- 2, 3, 5, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 4, 3, 5, 1, 2, 4,
- 4, 4, 3, 0, 1, 1, 3, 1, 1, 1,
- 2, 2, 1, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 1, 3, 3, 3, 1, 3, 3, 1,
- 3, 3, 3, 1, 3, 3, 3, 3, 3, 3,
- 1, 3, 3, 3, 3, 3, 1, 3, 3, 3,
- 3, 1, 3, 3, 3, 3, 1, 3, 1, 3,
- 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
- 1, 3, 1, 3, 1, 3, 1, 5, 1, 5,
- 1, 3, 1, 3, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 3, 0, 1,
- 1, 3, 0, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
- 1, 2, 0, 1, 3, 3, 1, 1, 1, 3,
- 1, 3, 2, 2, 2, 0, 1, 2, 0, 1,
- 1, 2, 2, 7, 5, 7, 7, 5, 9, 10,
- 7, 8, 2, 2, 3, 3, 2, 2, 3, 3,
- 3, 3, 5, 5, 3, 5, 1, 2, 0, 1,
- 4, 3, 3, 3, 3, 3, 3, 3, 3, 4,
- 5, 2, 2, 2, 8, 8, 1, 3, 0, 1,
- 0, 1, 1, 1, 1, 2, 1, 1, 0, 1,
- 0, 1, 2};
-
-const short QmlJSGrammar::action_default [] = {
- 0, 0, 0, 0, 0, 0, 22, 0, 170, 237,
- 201, 209, 205, 149, 221, 197, 3, 134, 68, 150,
- 213, 217, 138, 167, 148, 153, 133, 187, 174, 0,
- 75, 76, 71, 339, 63, 341, 0, 0, 0, 0,
- 73, 0, 0, 69, 72, 0, 0, 64, 66, 65,
- 74, 67, 0, 70, 0, 0, 163, 0, 0, 150,
- 169, 152, 151, 0, 0, 0, 165, 166, 164, 168,
- 0, 198, 0, 0, 0, 0, 188, 0, 0, 0,
- 0, 0, 0, 178, 0, 0, 0, 172, 173, 171,
- 176, 180, 179, 177, 175, 190, 189, 191, 0, 206,
- 0, 202, 0, 0, 144, 131, 143, 132, 100, 101,
- 102, 127, 103, 128, 104, 105, 106, 107, 108, 109,
- 110, 111, 112, 113, 114, 115, 116, 129, 117, 118,
- 119, 120, 121, 122, 123, 124, 125, 126, 130, 0,
- 0, 142, 238, 145, 0, 146, 0, 147, 141, 0,
- 234, 227, 225, 232, 233, 231, 230, 236, 229, 228,
- 226, 235, 222, 0, 210, 0, 0, 214, 0, 0,
- 218, 0, 0, 144, 136, 0, 135, 0, 140, 154,
- 0, 340, 329, 330, 0, 327, 0, 328, 0, 331,
- 245, 252, 251, 259, 247, 0, 248, 332, 0, 338,
- 249, 250, 255, 253, 335, 333, 337, 256, 0, 267,
- 0, 0, 0, 0, 339, 63, 0, 341, 64, 239,
- 281, 65, 0, 0, 0, 268, 0, 0, 257, 258,
- 0, 246, 254, 282, 283, 326, 336, 0, 297, 298,
- 299, 300, 0, 293, 294, 295, 296, 323, 324, 0,
- 0, 0, 0, 0, 286, 287, 243, 241, 203, 211,
- 207, 223, 199, 244, 0, 150, 215, 219, 192, 181,
- 0, 0, 200, 0, 0, 0, 0, 193, 0, 0,
- 0, 0, 0, 185, 183, 186, 184, 182, 195, 194,
- 196, 0, 208, 0, 204, 0, 242, 150, 0, 224,
- 239, 240, 0, 239, 0, 0, 289, 0, 0, 0,
- 291, 0, 212, 0, 0, 216, 0, 0, 220, 279,
- 0, 271, 280, 274, 0, 278, 0, 239, 272, 0,
- 239, 0, 0, 290, 0, 0, 0, 292, 340, 329,
- 0, 0, 331, 0, 325, 0, 315, 0, 0, 0,
- 285, 0, 284, 0, 342, 0, 99, 261, 264, 0,
- 100, 267, 103, 128, 105, 106, 71, 110, 111, 63,
- 112, 115, 69, 72, 64, 239, 65, 74, 118, 67,
- 120, 70, 122, 123, 268, 125, 126, 130, 0, 92,
- 0, 0, 94, 98, 96, 83, 95, 97, 0, 93,
- 82, 262, 260, 138, 139, 144, 0, 137, 0, 314,
- 0, 301, 302, 0, 313, 0, 0, 0, 304, 309,
- 307, 310, 0, 0, 308, 309, 0, 305, 0, 306,
- 263, 312, 0, 263, 311, 0, 316, 317, 0, 263,
- 318, 319, 0, 0, 320, 0, 0, 0, 321, 322,
- 156, 155, 0, 0, 0, 288, 0, 0, 0, 303,
- 276, 269, 0, 277, 273, 0, 275, 265, 0, 266,
- 270, 86, 0, 0, 90, 77, 0, 79, 88, 0,
- 80, 89, 91, 81, 87, 78, 0, 84, 160, 158,
- 162, 159, 157, 161, 6, 334, 4, 2, 61, 85,
- 0, 0, 64, 66, 65, 31, 5, 0, 62, 0,
- 40, 39, 38, 0, 0, 53, 0, 54, 0, 59,
- 60, 0, 40, 0, 0, 0, 0, 0, 49, 50,
- 0, 51, 0, 52, 0, 55, 56, 0, 0, 0,
- 0, 0, 57, 58, 0, 47, 41, 48, 42, 0,
- 0, 0, 0, 44, 0, 45, 46, 43, 0, 0,
- 30, 34, 35, 36, 37, 138, 263, 0, 0, 100,
- 267, 103, 128, 105, 106, 71, 110, 111, 63, 112,
- 115, 69, 72, 64, 239, 65, 74, 118, 67, 120,
- 70, 122, 123, 268, 125, 126, 130, 138, 0, 26,
- 0, 0, 32, 27, 33, 28, 24, 0, 29, 25,
- 8, 0, 10, 0, 9, 0, 1, 21, 12, 0,
- 13, 0, 14, 0, 19, 20, 0, 15, 16, 0,
- 17, 18, 11, 23, 7, 343};
-
-const short QmlJSGrammar::goto_default [] = {
- 7, 616, 206, 195, 204, 506, 494, 615, 634, 610,
- 614, 612, 617, 22, 613, 18, 505, 607, 598, 560,
- 507, 190, 194, 196, 200, 523, 549, 548, 199, 231,
- 26, 473, 472, 355, 354, 9, 353, 356, 106, 17,
- 144, 24, 13, 143, 19, 25, 56, 23, 8, 28,
- 27, 268, 15, 262, 10, 258, 12, 260, 11, 259,
- 20, 266, 21, 267, 14, 261, 257, 298, 410, 263,
- 264, 201, 192, 191, 203, 232, 202, 207, 228, 229,
- 193, 359, 358, 230, 462, 461, 320, 321, 464, 323,
- 463, 322, 418, 422, 425, 421, 420, 440, 441, 184,
- 198, 180, 183, 197, 205, 0};
-
-const short QmlJSGrammar::action_index [] = {
- 439, 1109, 2228, 2228, 2132, 814, -74, 18, 147, -100,
- 31, -17, -49, 232, -100, 318, 85, -100, -100, 554,
- 33, 94, 331, 215, -100, -100, -100, 448, 231, 1109,
- -100, -100, -100, 320, -100, 1940, 1472, 1109, 1109, 1109,
- -100, 724, 1109, -100, -100, 1109, 1109, -100, -100, -100,
- -100, -100, 1109, -100, 1109, 1109, -100, 1109, 1109, 129,
- 157, -100, -100, 1109, 1109, 1109, -100, -100, -100, 200,
- 1109, 293, 1109, 1109, 1109, 1109, 466, 1109, 1109, 1109,
- 1109, 1109, 1109, 179, 1109, 1109, 1109, 119, 125, 95,
- 188, 198, 184, 203, 178, 567, 567, 484, 1109, -5,
- 1109, 67, 1844, 1109, 1109, -100, -100, -100, -100, -100,
- -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,
- -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,
- -100, -100, -100, -100, -100, -100, -100, -100, -100, 110,
- 1109, -100, -100, 70, 61, -100, 1109, -100, -100, 1109,
- -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,
- -100, -100, -100, 1109, 55, 1109, 1109, 73, 63, 1109,
- -100, 1844, 1109, 1109, -100, 141, -100, 41, -100, -100,
- 87, -100, 255, 80, 78, -100, 287, -100, 83, 2228,
- -100, -100, -100, -100, -100, 225, -100, -100, 52, -100,
- -100, -100, -100, -100, -100, 2228, -100, -100, 420, -100,
- 408, 113, 2132, 50, 330, 65, 46, 2420, 72, 1109,
- -100, 74, 75, 1109, 77, -100, 53, 56, -100, -100,
- 323, -100, -100, -100, -100, -100, -100, 96, -100, -100,
- -100, -100, 99, -100, -100, -100, -100, -100, -100, 60,
- 47, 1109, 118, 93, -100, -100, 1291, -100, 79, 66,
- 64, -100, 413, 76, 51, 664, 89, 97, 393, 183,
- 337, 1109, 413, 1109, 1109, 1109, 1109, 411, 1109, 1109,
- 1109, 1109, 1109, 252, 272, 212, 217, 221, 490, 490,
- 383, 1109, 64, 1109, 84, 1109, -100, 536, 1109, -100,
- 1109, 69, 68, 1109, 44, 2132, -100, 1109, 124, 2132,
- -100, 1109, 54, 1109, 1109, 71, 88, 1109, -100, 82,
- 122, 154, -100, -100, 1109, -100, 343, 1109, -100, 81,
- 1109, 90, 2132, -100, 1109, 112, 2132, -100, 86, 333,
- -39, -10, 2228, -33, -100, 2132, -100, 1109, 246, 2132,
- 4, 2132, -100, 10, 16, -21, -100, -100, 2132, -26,
- 480, 19, 462, 128, 1109, 2132, 6, -9, 400, 8,
- -22, 840, -3, -6, -100, 1202, -100, -7, -28, 5,
- 1109, 2, -23, 1109, 0, 1109, -34, -30, 1109, -100,
- 2036, 21, -100, -100, -100, -100, -100, -100, 1109, -100,
- -100, -100, -100, 209, -100, 1109, 40, -100, 2132, -100,
- 101, -100, -100, 2132, -100, 1109, 120, 43, -100, 62,
- -100, 59, 109, 1109, -100, 57, 58, -100, 39, -100,
- 2132, -100, 117, 2132, -100, 199, -100, -100, 107, 2132,
- 34, -100, 24, 11, -100, 346, -19, 14, -100, -100,
- -100, -100, 1109, 133, 2132, -100, 1109, 126, 2132, -100,
- 20, -100, 173, -100, -100, 1109, -100, -100, 303, -100,
- -100, -100, 100, 1656, -100, -100, 1564, -100, -100, 1748,
- -100, -100, -100, -100, -100, -100, 131, -100, -100, -100,
- -100, -100, -100, -100, -100, 2228, -100, -100, -100, 158,
- -20, 752, 165, -16, 22, -100, -100, 98, -100, 189,
- -100, -100, -100, 28, 170, -100, 1109, -100, 230, -100,
- -100, 247, 1, 13, 238, 37, -24, 106, -100, -100,
- 273, -100, 1109, -100, 265, -100, -100, 242, -4, 12,
- 1109, 241, -100, -100, 234, -100, 245, -100, 3, 9,
- 311, 190, 316, -100, 134, -100, -100, -100, 1380, 1020,
- -100, -100, -100, -100, -100, 359, 2324, 1472, 15, 444,
- 38, 394, 138, 1109, 2132, 36, 17, 397, 42, 23,
- 840, 32, 29, -100, 1202, -100, 26, 35, 48, 1109,
- 45, 25, 1109, 49, 1109, 27, 30, 314, 132, -100,
- 7, 752, -100, -100, -100, -100, -100, 930, -100, -100,
- -100, 752, -100, 253, -87, 617, -100, -100, 102, 290,
- -100, 191, -100, 140, -100, -100, 275, -100, -100, 91,
- -100, -100, -100, -100, -100, -100,
-
- -106, 12, -87, 18, 17, 212, -106, -106, -106, -106,
- -106, -106, -106, -106, -106, -106, -106, -106, -106, -53,
- -106, -106, -106, -106, -106, -106, -106, -106, -106, 162,
- -106, -106, -106, -4, -106, -106, -11, 24, 75, 76,
- -106, 83, 55, -106, -106, 157, 158, -106, -106, -106,
- -106, -106, 150, -106, 172, 176, -106, 168, 167, -106,
- -106, -106, -106, 173, 154, 115, -106, -106, -106, -106,
- 147, -106, 121, 113, 112, 125, -106, 128, 143, 146,
- 140, 139, 136, -106, 122, 138, 130, -106, -106, -106,
- -106, -106, -106, -106, -106, -106, -106, -106, 149, -106,
- 153, -106, 110, 82, 46, -106, -106, -106, -106, -106,
- -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
- -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
- -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
- 35, -106, -106, -106, -106, -106, 37, -106, -106, 45,
- -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
- -106, -106, -106, 92, -106, 88, 58, -106, -106, 51,
- -106, 209, 72, 78, -106, -106, -106, -106, -106, -106,
- -106, -106, 27, -106, -106, -106, 63, -106, -106, -106,
- -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
- -106, -106, -106, -106, -106, 50, -106, -106, 28, -106,
- 29, -106, 47, -106, 33, -106, -106, 66, -106, 73,
- -106, -106, -106, 81, 53, -106, -106, -106, -106, -106,
- -13, -106, -106, -106, -106, -106, -106, -106, -106, -106,
- -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
- -106, 9, -106, -106, -106, -106, 111, -106, -106, -106,
- -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
- 3, 186, -106, 220, 228, 234, 204, -106, 90, 91,
- 94, 97, 93, -106, -106, -106, -106, -106, -106, -106,
- -106, 210, -106, 187, -106, 214, -106, -106, 208, -106,
- 207, -106, -106, 155, -106, 8, -106, 4, -106, -1,
- -106, 217, -106, 177, 185, -106, -106, 184, -106, -106,
- -106, -106, -106, -106, 183, -106, 194, 105, -106, -106,
- 99, -106, 71, -106, 74, -106, 65, -106, -106, 114,
- -106, -106, -55, -106, -106, 64, -106, 44, -106, 30,
- -106, 31, -106, -106, -106, -106, -106, -106, 57, -106,
- 36, -106, 40, -106, 70, 59, -106, -106, 42, -106,
- -106, 104, -106, -106, -106, 38, -106, -106, -106, -106,
- 79, -106, 69, 108, -106, 84, -106, -106, 56, -106,
- 68, -106, -106, -106, -106, -106, -106, -106, 52, -106,
- -106, -106, -106, -106, -106, 109, -106, -106, 77, -106,
- -106, -106, -106, 86, -106, 80, -106, -106, -106, -106,
- -106, -59, -106, 43, -106, -63, -106, -106, -106, -106,
- 98, -106, -106, 95, -106, -106, -106, -106, -106, 60,
- -34, -106, -106, 32, -106, 41, -106, 39, -106, -106,
- -106, -106, 49, -106, 61, -106, 62, -106, 48, -106,
- -106, -106, -106, -106, -106, 23, -106, -106, 96, -106,
- -106, -106, -106, 34, -106, -106, 133, -106, -106, 54,
- -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
- -106, -106, -106, -106, -106, 67, -106, -106, -106, -106,
- -106, 22, -106, -106, -106, -106, -106, -106, -106, -22,
- -106, -106, -106, -106, -106, -106, 2, -106, -106, -106,
- -106, -106, -106, -106, -19, -106, -106, -106, -106, -106,
- -106, -106, 100, -106, -106, -106, -106, -21, -106, -106,
- -3, -106, -106, -106, -106, -106, 13, -106, -106, -106,
- 11, 14, 10, -106, -106, -106, -106, -106, 279, 283,
- -106, -106, -106, -106, -106, -106, 19, 273, 15, 16,
- -106, 21, -106, 224, 6, -106, -106, 25, -106, -106,
- 85, -106, -106, -106, 26, -106, -106, -106, -106, 20,
- -106, 7, 87, -106, 107, -106, -106, -106, -106, -106,
- -106, 317, -106, -106, -106, -106, -106, 277, -106, -106,
- -106, 0, -106, -106, -2, 271, -106, -106, -106, 1,
- -106, -106, -106, -106, -106, -106, 5, -106, -106, -106,
- -106, -106, -106, -106, -106, -106};
-
-const short QmlJSGrammar::action_info [] = {
- -97, -98, 452, 611, -116, 527, 456, -124, 415, -121,
- 439, 551, -119, -108, 347, -94, 611, 388, 635, 540,
- 351, 341, 344, 342, 390, 539, -127, 256, 398, 402,
- 100, 98, 70, -97, 400, 163, -98, 465, 524, -116,
- 559, 447, 530, -108, 439, -127, 509, 439, 559, -94,
- 537, 544, -121, 256, 443, -119, -124, 514, 439, 347,
- 445, 526, 423, 452, 423, 430, 456, 423, 70, 554,
- 169, 415, 345, 311, 100, 163, 419, 140, 146, 408,
- 271, 413, 347, 251, 295, 271, 256, 0, 186, 452,
- 0, 311, 456, 140, 429, 317, 0, 0, 0, 324,
- 407, 178, 291, 98, 305, 558, 0, 235, 476, 0,
- 439, 415, 300, 442, 291, 0, 189, 171, 140, 426,
- 140, 148, 339, 182, 433, 140, 140, 443, 140, 303,
- 326, 559, 140, 0, 140, 57, 172, 250, 188, 140,
- 601, 140, 330, 293, 165, 0, 58, 313, 166, 140,
- 332, 314, 631, 630, 255, 254, 477, 241, 240, 57,
- 246, 245, 412, 411, 427, 57, 141, 529, 528, 63,
- 58, 61, 336, 171, 248, 247, 58, 516, 253, 0,
- 417, 468, 62, 327, 309, 334, 458, 57, 602, 248,
- 247, 487, 172, 454, 522, 556, 555, 176, 58, 248,
- 247, 625, 624, 84, 84, 85, 85, 140, 84, 84,
- 85, 85, 63, 84, 64, 85, 86, 86, 510, 510,
- 65, 86, 86, 84, 171, 85, 86, 63, 84, 0,
- 85, 517, 515, 140, 469, 467, 86, 84, 140, 85,
- 512, 86, 84, 172, 85, 405, 84, 102, 85, 140,
- 86, 511, 628, 627, 140, 86, 84, 64, 85, 86,
- 437, 436, 171, 65, 512, 512, 103, 510, 104, 86,
- 546, 510, 64, 140, 510, 511, 511, 84, 65, 85,
- 532, 172, 626, 405, 34, 0, 234, 233, 0, 0,
- 86, 520, 519, 0, 0, 547, 545, 84, 0, 85,
- 621, 0, 543, 542, 34, 0, 349, 0, 0, 0,
- 86, 72, 73, 512, 622, 620, 34, 512, 0, 34,
- 512, 47, 49, 48, 511, 0, 536, 535, 511, 171,
- 0, 511, 34, 0, 533, 531, 72, 73, 74, 75,
- 34, 47, 49, 48, 619, 34, 171, -85, 172, 34,
- 173, 0, 34, 47, 49, 48, 47, 49, 48, 34,
- 0, 0, 34, 74, 75, 172, 34, 173, 0, 47,
- 49, 48, 34, 0, 171, 34, 0, 47, 49, 48,
- 0, 0, 47, 49, 48, 0, 47, 49, 48, 47,
- 49, 48, -85, 172, 0, 173, 47, 49, 48, 47,
- 49, 48, 0, 47, 49, 48, 278, 279, 0, 47,
- 49, 48, 47, 49, 48, 280, 278, 279, 281, 0,
- 282, 0, 0, 34, 0, 280, 34, 0, 281, 34,
- 282, 273, 274, -339, 278, 279, -339, 34, 0, 0,
- 0, 0, 0, 280, 0, 0, 281, 0, 282, 34,
- 0, 0, 0, 0, 0, 244, 243, 0, 275, 276,
- 47, 49, 48, 47, 49, 48, 47, 49, 48, 244,
- 243, 77, 78, 34, 47, 49, 48, 0, 0, 79,
- 80, 239, 238, 81, 0, 82, 47, 49, 48, 77,
- 78, 34, 0, 0, 0, 0, 0, 79, 80, 0,
- 0, 81, 0, 82, 0, 239, 238, 77, 78, 34,
- 47, 49, 48, 278, 279, 79, 80, 0, 0, 81,
- 0, 82, 280, 244, 243, 281, 0, 282, 47, 49,
- 48, 6, 5, 4, 1, 3, 2, 0, 0, 150,
- 0, 239, 238, 0, 0, 0, 47, 49, 48, 151,
- 0, 0, 0, 152, 0, 0, 0, 150, 0, 0,
- 0, 0, 153, 0, 154, 0, 0, 151, 0, 0,
- 0, 152, 0, 0, 0, 155, 0, 156, 61, 0,
- 153, 0, 154, 0, 0, 157, 0, 0, 158, 62,
- 77, 78, 0, 155, 159, 156, 61, 0, 79, 80,
- 160, 0, 81, 157, 82, 0, 158, 62, 0, 0,
- 0, 0, 159, 0, 0, 0, 161, 0, 160, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 30,
- 31, 0, 0, 0, 161, 0, 0, 0, 0, 33,
- 0, 0, 0, 0, 0, 0, 34, 0, 0, 0,
- 35, 36, 0, 37, 0, 0, 0, 0, 0, 0,
- 501, 0, 0, 0, 44, 0, 0, 150, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 151, 0, 0,
- 0, 152, 50, 47, 49, 48, 0, 51, 0, 0,
- 153, 0, 154, 0, 0, 307, 0, 0, 43, 53,
- 32, 0, 0, 155, 40, 156, 61, 0, 0, 0,
- 0, 0, 0, 157, 0, 0, 158, 62, 0, 0,
- 0, 0, 159, 0, 0, 0, 0, 0, 160, 0,
- 0, 0, 0, 0, 0, 0, 30, 31, 0, 0,
- 0, 0, 0, 0, 161, 0, 33, 0, 0, 0,
- 0, 0, 0, 34, 0, 0, 0, 35, 36, 0,
- 37, 0, 0, 0, 30, 31, 0, 41, 0, 0,
- 0, 44, 0, 0, 33, 0, 0, 0, 0, 0,
- 0, 34, 0, 0, 0, 35, 36, 0, 37, 50,
- 47, 49, 48, 0, 51, 501, 0, 0, 0, 44,
- 0, 0, 0, 0, 0, 43, 53, 32, 0, 0,
- 0, 40, 0, 0, 0, 0, 0, 50, 47, 49,
- 48, 0, 51, 0, 500, 0, 30, 31, 0, 0,
- 0, 0, 0, 43, 53, 32, 214, 0, 0, 40,
- 0, 0, 0, 34, 0, 0, 0, 35, 36, 0,
- 37, 0, 30, 31, 0, 0, 0, 501, 0, 0,
- 0, 44, 33, 0, 0, 0, 0, 0, 0, 34,
- 0, 0, 0, 35, 36, 0, 37, 0, 0, 50,
- 502, 504, 503, 41, 51, 0, 0, 44, 0, 225,
- 0, 0, 0, 0, 0, 43, 53, 32, 209, 0,
- 0, 40, 0, 0, 0, 50, 47, 49, 48, 0,
- 51, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 43, 53, 32, 0, 0, 0, 40, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 500, 0, 30, 31, 0, 0, 0, 0, 0, 0,
- 0, 0, 214, 0, 0, 0, 0, 0, 0, 34,
- 0, 0, 0, 35, 36, 0, 37, 0, 0, 0,
- 0, 0, 0, 501, 0, 0, 0, 44, 0, 0,
- 0, 0, 0, 0, 0, 608, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 50, 502, 504, 503, 0,
- 51, 0, 0, 0, 0, 225, 0, 0, 0, 0,
- 0, 43, 53, 32, 209, 0, 0, 40, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 500, 0, 30, 31, 0, 0, 0, 0, 0, 0,
- 0, 0, 214, 0, 0, 0, 0, 0, 0, 34,
- 0, 0, 0, 35, 36, 0, 37, 0, 0, 0,
- 0, 0, 0, 501, 0, 0, 0, 44, 0, 0,
- 0, 0, 0, 0, 0, 605, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 50, 502, 504, 503, 0,
- 51, 0, 0, 0, 0, 225, 0, 0, 0, 0,
- 0, 43, 53, 32, 209, 0, 0, 40, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 29, 30, 31, 0, 0, 0, 0, 0, 0, 0,
- 0, 33, 0, 0, 0, 0, 0, 0, 34, 0,
- 0, 0, 35, 36, 0, 37, 0, 0, 0, 38,
- 0, 39, 41, 42, 0, 0, 44, 0, 0, 0,
- 45, 0, 46, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 50, 47, 49, 48, 0, 51,
- 0, 52, 0, 54, 0, 55, 0, 0, 0, 0,
- 43, 53, 32, 0, 0, 0, 40, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, -117,
- 0, 0, 0, 29, 30, 31, 0, 0, 0, 0,
- 0, 0, 0, 0, 33, 0, 0, 0, 0, 0,
- 0, 34, 0, 0, 0, 35, 36, 0, 37, 0,
- 0, 0, 38, 0, 39, 41, 42, 0, 0, 44,
- 0, 0, 0, 45, 0, 46, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 50, 47, 49,
- 48, 0, 51, 0, 52, 0, 54, 0, 55, 0,
- 0, 0, 0, 43, 53, 32, 0, 0, 0, 40,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 29, 30, 31, 0, 0, 0, 0, 0,
- 0, 0, 0, 33, 0, 0, 0, 0, 0, 0,
- 34, 0, 0, 0, 35, 36, 0, 37, 0, 0,
- 0, 38, 0, 39, 41, 42, 0, 0, 44, 0,
- 0, 0, 45, 0, 46, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 50, 47, 49, 48,
- 0, 51, 0, 52, 0, 54, 270, 55, 0, 0,
- 0, 0, 43, 53, 32, 0, 0, 0, 40, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 29, 30, 31, 0, 0, 0, 0, 0, 0,
- 0, 0, 33, 0, 0, 0, 0, 0, 0, 34,
- 216, 0, 0, 566, 567, 0, 37, 0, 0, 0,
- 38, 0, 39, 41, 42, 0, 0, 44, 0, 0,
- 0, 45, 0, 46, 0, 0, 0, 0, 0, 0,
- 0, 220, 0, 0, 0, 50, 47, 49, 48, 0,
- 51, 0, 52, 0, 54, 0, 55, 0, 0, 0,
- 0, 43, 53, 32, 0, 0, 0, 40, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 474, 0, 0, 29, 30, 31, 0, 0, 0, 0,
- 0, 0, 0, 0, 33, 0, 0, 0, 0, 0,
- 0, 34, 0, 0, 0, 35, 36, 0, 37, 0,
- 0, 0, 38, 0, 39, 41, 42, 0, 0, 44,
- 0, 0, 0, 45, 0, 46, 0, 0, 475, 0,
- 0, 0, 0, 0, 0, 0, 0, 50, 47, 49,
- 48, 0, 51, 0, 52, 0, 54, 0, 55, 0,
- 0, 0, 0, 43, 53, 32, 0, 0, 0, 40,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 474, 0, 0, 29, 30, 31, 0, 0,
- 0, 0, 0, 0, 0, 0, 33, 0, 0, 0,
- 0, 0, 0, 34, 0, 0, 0, 35, 36, 0,
- 37, 0, 0, 0, 38, 0, 39, 41, 42, 0,
- 0, 44, 0, 0, 0, 45, 0, 46, 0, 0,
- 480, 0, 0, 0, 0, 0, 0, 0, 0, 50,
- 47, 49, 48, 0, 51, 0, 52, 0, 54, 0,
- 55, 0, 0, 0, 0, 43, 53, 32, 0, 0,
- 0, 40, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 482, 0, 0, 29, 30, 31,
- 0, 0, 0, 0, 0, 0, 0, 0, 33, 0,
- 0, 0, 0, 0, 0, 34, 0, 0, 0, 35,
- 36, 0, 37, 0, 0, 0, 38, 0, 39, 41,
- 42, 0, 0, 44, 0, 0, 0, 45, 0, 46,
- 0, 0, 485, 0, 0, 0, 0, 0, 0, 0,
- 0, 50, 47, 49, 48, 0, 51, 0, 52, 0,
- 54, 0, 55, 0, 0, 0, 0, 43, 53, 32,
- 0, 0, 0, 40, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 482, 0, 0, 29,
- 30, 31, 0, 0, 0, 0, 0, 0, 0, 0,
- 33, 0, 0, 0, 0, 0, 0, 34, 0, 0,
- 0, 35, 36, 0, 37, 0, 0, 0, 38, 0,
- 39, 41, 42, 0, 0, 44, 0, 0, 0, 45,
- 0, 46, 0, 0, 483, 0, 0, 0, 0, 0,
- 0, 0, 0, 50, 47, 49, 48, 0, 51, 0,
- 52, 0, 54, 0, 55, 0, 0, 0, 0, 43,
- 53, 32, 0, 0, 0, 40, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 108, 109,
- 110, 0, 0, 112, 114, 115, 0, 0, 116, 0,
- 117, 0, 0, 0, 119, 120, 121, 0, 0, 0,
- 0, 0, 0, 34, 122, 123, 124, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 125, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 128, 0, 0, 0, 0, 0, 0,
- 47, 49, 48, 129, 130, 131, 0, 133, 134, 135,
- 136, 137, 138, 0, 0, 126, 132, 118, 111, 113,
- 127, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 108, 109, 110, 0, 0, 112,
- 114, 115, 0, 0, 116, 0, 117, 0, 0, 0,
- 119, 120, 121, 0, 0, 0, 0, 0, 0, 392,
- 122, 123, 124, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 125, 0, 0, 0, 393, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
- 0, 0, 0, 0, 0, 397, 394, 396, 0, 129,
- 130, 131, 0, 133, 134, 135, 136, 137, 138, 0,
- 0, 126, 132, 118, 111, 113, 127, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 108, 109, 110, 0, 0, 112, 114, 115, 0, 0,
- 116, 0, 117, 0, 0, 0, 119, 120, 121, 0,
- 0, 0, 0, 0, 0, 392, 122, 123, 124, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 125,
- 0, 0, 0, 393, 0, 0, 0, 0, 0, 0,
- 0, 395, 0, 0, 0, 128, 0, 0, 0, 0,
- 0, 397, 394, 396, 0, 129, 130, 131, 0, 133,
- 134, 135, 136, 137, 138, 0, 0, 126, 132, 118,
- 111, 113, 127, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 208, 0, 0, 0,
- 0, 210, 0, 29, 30, 31, 212, 0, 0, 0,
- 0, 0, 0, 213, 33, 0, 0, 0, 0, 0,
- 0, 215, 216, 0, 0, 217, 36, 0, 37, 0,
- 0, 0, 38, 0, 39, 41, 42, 0, 0, 44,
- 0, 0, 0, 45, 0, 46, 0, 0, 0, 0,
- 0, 219, 0, 220, 0, 0, 0, 50, 218, 221,
- 48, 222, 51, 223, 52, 224, 54, 225, 55, 226,
- 227, 0, 0, 43, 53, 32, 209, 211, 0, 40,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 208, 0, 0, 0, 0, 210, 0, 29,
- 30, 31, 212, 0, 0, 0, 0, 0, 0, 213,
- 214, 0, 0, 0, 0, 0, 0, 215, 216, 0,
- 0, 217, 36, 0, 37, 0, 0, 0, 38, 0,
- 39, 41, 42, 0, 0, 44, 0, 0, 0, 45,
- 0, 46, 0, 0, 0, 0, 0, 219, 0, 220,
- 0, 0, 0, 50, 218, 221, 48, 222, 51, 223,
- 52, 224, 54, 225, 55, 226, 227, 0, 0, 43,
- 53, 32, 209, 211, 0, 40, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 569, 109,
- 110, 0, 0, 571, 114, 573, 30, 31, 574, 0,
- 117, 0, 0, 0, 119, 576, 577, 0, 0, 0,
- 0, 0, 0, 578, 579, 123, 124, 217, 36, 0,
- 37, 0, 0, 0, 38, 0, 39, 580, 42, 0,
- 0, 582, 0, 0, 0, 45, 0, 46, 0, 0,
- 0, 0, 0, 584, 0, 220, 0, 0, 0, 586,
- 583, 585, 48, 587, 588, 589, 52, 591, 592, 593,
- 594, 595, 596, 0, 0, 581, 590, 575, 570, 572,
- 127, 40, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 360, 109, 110, 0, 0, 362,
- 114, 364, 30, 31, 365, 0, 117, 0, 0, 0,
- 119, 367, 368, 0, 0, 0, 0, 0, 0, 369,
- 370, 123, 124, 217, 36, 0, 37, 0, 0, 0,
- 38, 0, 39, 371, 42, 0, 0, 373, 0, 0,
- 0, 45, 0, 46, 0, -263, 0, 0, 0, 375,
- 0, 220, 0, 0, 0, 377, 374, 376, 48, 378,
- 379, 380, 52, 382, 383, 384, 385, 386, 387, 0,
- 0, 372, 381, 366, 361, 363, 127, 40, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 541, 310, 460, 513, 538, 518, 525, 308, 249, 632,
- 306, 181, 252, 618, 149, 16, 623, 495, 319, 497,
- 629, 357, 496, 435, 471, 553, 557, 486, 438, 301,
- 428, 237, 350, 352, 604, 521, 242, 424, 550, 552,
- 181, 301, 185, 237, 242, 343, 432, 348, 338, 249,
- 459, 237, 453, 449, 236, 242, 446, 181, 466, 401,
- 448, 249, 357, 455, 444, 457, 346, 337, 357, 484,
- 142, 236, 147, 333, 438, 175, 301, 335, 187, 409,
- 162, 145, 435, 416, 435, 139, 170, 399, 414, 481,
- 438, 389, 0, 168, 0, 0, 403, 357, 403, 59,
- 357, 490, 301, 534, 391, 0, 0, 0, 301, 0,
- 0, 460, 0, 145, 59, 0, 179, 403, 177, 59,
- 59, 488, 489, 0, 404, 105, 404, 0, 59, 185,
- 451, 59, 59, 450, 59, 59, 59, 59, 59, 283,
- 284, 59, 287, 285, 145, 404, 286, 107, 167, 406,
- 164, 59, 59, 451, 450, 265, 59, 59, 301, 59,
- 269, 68, 96, 95, 479, 59, 59, 331, 478, 59,
- 87, 76, 59, 329, 59, 97, 434, 83, 89, 431,
- 59, 470, 59, 59, 59, 94, 88, 59, 93, 92,
- 59, 59, 90, 59, 59, 91, 493, 59, 59, 71,
- 67, 59, 59, 491, 492, 99, 59, 101, 179, 319,
- 301, 59, 59, 340, 69, 60, 59, 59, 450, 66,
- 59, 59, 451, 304, 105, 499, 269, 297, 297, 297,
- 59, 59, 269, 269, 269, 269, 269, 0, 315, 272,
- 498, 508, 294, 0, 0, 0, 107, 174, 59, 325,
- 318, 316, 297, 269, 59, 290, 0, 269, 297, 269,
- 0, 59, 0, 269, 59, 0, 269, 292, 59, 269,
- 179, 277, 59, 0, 299, 302, 312, 269, 59, 288,
- 296, 328, 609, 269, 499, 289, 597, 633, 606, 599,
- 499, 600, 565, 600, 0, 0, 499, 0, 0, 568,
- 561, 562, 563, 564, 0, 498, 508, 0, 471, 0,
- 0, 498, 508, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 499, 0, 0, 603, 0, 0, 0, 600, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0};
-
-const short QmlJSGrammar::action_check [] = {
- 7, 7, 36, 90, 7, 29, 36, 7, 36, 7,
- 33, 8, 7, 7, 36, 7, 90, 7, 0, 7,
- 16, 60, 55, 33, 8, 29, 7, 36, 7, 55,
- 79, 48, 1, 7, 55, 2, 7, 17, 37, 7,
- 33, 60, 29, 7, 33, 7, 66, 33, 33, 7,
- 66, 29, 7, 36, 20, 7, 7, 29, 33, 36,
- 36, 24, 5, 36, 5, 7, 36, 5, 1, 60,
- 7, 36, 7, 2, 79, 2, 33, 8, 8, 7,
- 1, 7, 36, 36, 8, 1, 36, -1, 8, 36,
- -1, 2, 36, 8, 55, 7, -1, -1, -1, 17,
- 60, 60, 48, 48, 60, 7, -1, 55, 8, -1,
- 33, 36, 61, 6, 48, -1, 33, 15, 8, 10,
- 8, 60, 36, 36, 7, 8, 8, 20, 8, 61,
- 8, 33, 8, -1, 8, 40, 34, 77, 60, 8,
- 8, 8, 61, 79, 50, -1, 51, 50, 54, 8,
- 60, 54, 61, 62, 61, 62, 56, 61, 62, 40,
- 61, 62, 61, 62, 55, 40, 56, 61, 62, 12,
- 51, 42, 60, 15, 61, 62, 51, 7, 60, -1,
- 60, 8, 53, 61, 60, 31, 60, 40, 56, 61,
- 62, 60, 34, 60, 29, 61, 62, 56, 51, 61,
- 62, 61, 62, 25, 25, 27, 27, 8, 25, 25,
- 27, 27, 12, 25, 57, 27, 38, 38, 29, 29,
- 63, 38, 38, 25, 15, 27, 38, 12, 25, -1,
- 27, 61, 62, 8, 61, 62, 38, 25, 8, 27,
- 75, 38, 25, 34, 27, 36, 25, 15, 27, 8,
- 38, 86, 61, 62, 8, 38, 25, 57, 27, 38,
- 61, 62, 15, 63, 75, 75, 34, 29, 36, 38,
- 36, 29, 57, 8, 29, 86, 86, 25, 63, 27,
- 7, 34, 91, 36, 29, -1, 61, 62, -1, -1,
- 38, 61, 62, -1, -1, 61, 62, 25, -1, 27,
- 47, -1, 61, 62, 29, -1, 60, -1, -1, -1,
- 38, 18, 19, 75, 61, 62, 29, 75, -1, 29,
- 75, 66, 67, 68, 86, -1, 61, 62, 86, 15,
- -1, 86, 29, -1, 61, 62, 18, 19, 45, 46,
- 29, 66, 67, 68, 91, 29, 15, 33, 34, 29,
- 36, -1, 29, 66, 67, 68, 66, 67, 68, 29,
- -1, -1, 29, 45, 46, 34, 29, 36, -1, 66,
- 67, 68, 29, -1, 15, 29, -1, 66, 67, 68,
- -1, -1, 66, 67, 68, -1, 66, 67, 68, 66,
- 67, 68, 33, 34, -1, 36, 66, 67, 68, 66,
- 67, 68, -1, 66, 67, 68, 23, 24, -1, 66,
- 67, 68, 66, 67, 68, 32, 23, 24, 35, -1,
- 37, -1, -1, 29, -1, 32, 29, -1, 35, 29,
- 37, 18, 19, 36, 23, 24, 36, 29, -1, -1,
- -1, -1, -1, 32, -1, -1, 35, -1, 37, 29,
- -1, -1, -1, -1, -1, 61, 62, -1, 45, 46,
- 66, 67, 68, 66, 67, 68, 66, 67, 68, 61,
- 62, 23, 24, 29, 66, 67, 68, -1, -1, 31,
- 32, 61, 62, 35, -1, 37, 66, 67, 68, 23,
- 24, 29, -1, -1, -1, -1, -1, 31, 32, -1,
- -1, 35, -1, 37, -1, 61, 62, 23, 24, 29,
- 66, 67, 68, 23, 24, 31, 32, -1, -1, 35,
- -1, 37, 32, 61, 62, 35, -1, 37, 66, 67,
- 68, 92, 93, 94, 95, 96, 97, -1, -1, 3,
- -1, 61, 62, -1, -1, -1, 66, 67, 68, 13,
- -1, -1, -1, 17, -1, -1, -1, 3, -1, -1,
- -1, -1, 26, -1, 28, -1, -1, 13, -1, -1,
- -1, 17, -1, -1, -1, 39, -1, 41, 42, -1,
- 26, -1, 28, -1, -1, 49, -1, -1, 52, 53,
- 23, 24, -1, 39, 58, 41, 42, -1, 31, 32,
- 64, -1, 35, 49, 37, -1, 52, 53, -1, -1,
- -1, -1, 58, -1, -1, -1, 80, -1, 64, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 12,
- 13, -1, -1, -1, 80, -1, -1, -1, -1, 22,
- -1, -1, -1, -1, -1, -1, 29, -1, -1, -1,
- 33, 34, -1, 36, -1, -1, -1, -1, -1, -1,
- 43, -1, -1, -1, 47, -1, -1, 3, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 13, -1, -1,
- -1, 17, 65, 66, 67, 68, -1, 70, -1, -1,
- 26, -1, 28, -1, -1, 31, -1, -1, 81, 82,
- 83, -1, -1, 39, 87, 41, 42, -1, -1, -1,
- -1, -1, -1, 49, -1, -1, 52, 53, -1, -1,
- -1, -1, 58, -1, -1, -1, -1, -1, 64, -1,
- -1, -1, -1, -1, -1, -1, 12, 13, -1, -1,
- -1, -1, -1, -1, 80, -1, 22, -1, -1, -1,
- -1, -1, -1, 29, -1, -1, -1, 33, 34, -1,
- 36, -1, -1, -1, 12, 13, -1, 43, -1, -1,
- -1, 47, -1, -1, 22, -1, -1, -1, -1, -1,
- -1, 29, -1, -1, -1, 33, 34, -1, 36, 65,
- 66, 67, 68, -1, 70, 43, -1, -1, -1, 47,
- -1, -1, -1, -1, -1, 81, 82, 83, -1, -1,
- -1, 87, -1, -1, -1, -1, -1, 65, 66, 67,
- 68, -1, 70, -1, 10, -1, 12, 13, -1, -1,
- -1, -1, -1, 81, 82, 83, 22, -1, -1, 87,
- -1, -1, -1, 29, -1, -1, -1, 33, 34, -1,
- 36, -1, 12, 13, -1, -1, -1, 43, -1, -1,
- -1, 47, 22, -1, -1, -1, -1, -1, -1, 29,
- -1, -1, -1, 33, 34, -1, 36, -1, -1, 65,
- 66, 67, 68, 43, 70, -1, -1, 47, -1, 75,
- -1, -1, -1, -1, -1, 81, 82, 83, 84, -1,
- -1, 87, -1, -1, -1, 65, 66, 67, 68, -1,
- 70, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 81, 82, 83, -1, -1, -1, 87, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 10, -1, 12, 13, -1, -1, -1, -1, -1, -1,
- -1, -1, 22, -1, -1, -1, -1, -1, -1, 29,
- -1, -1, -1, 33, 34, -1, 36, -1, -1, -1,
- -1, -1, -1, 43, -1, -1, -1, 47, -1, -1,
- -1, -1, -1, -1, -1, 55, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 65, 66, 67, 68, -1,
- 70, -1, -1, -1, -1, 75, -1, -1, -1, -1,
- -1, 81, 82, 83, 84, -1, -1, 87, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 10, -1, 12, 13, -1, -1, -1, -1, -1, -1,
- -1, -1, 22, -1, -1, -1, -1, -1, -1, 29,
- -1, -1, -1, 33, 34, -1, 36, -1, -1, -1,
- -1, -1, -1, 43, -1, -1, -1, 47, -1, -1,
- -1, -1, -1, -1, -1, 55, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 65, 66, 67, 68, -1,
- 70, -1, -1, -1, -1, 75, -1, -1, -1, -1,
- -1, 81, 82, 83, 84, -1, -1, 87, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 11, 12, 13, -1, -1, -1, -1, -1, -1, -1,
- -1, 22, -1, -1, -1, -1, -1, -1, 29, -1,
- -1, -1, 33, 34, -1, 36, -1, -1, -1, 40,
- -1, 42, 43, 44, -1, -1, 47, -1, -1, -1,
- 51, -1, 53, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 65, 66, 67, 68, -1, 70,
- -1, 72, -1, 74, -1, 76, -1, -1, -1, -1,
- 81, 82, 83, -1, -1, -1, 87, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 7,
- -1, -1, -1, 11, 12, 13, -1, -1, -1, -1,
- -1, -1, -1, -1, 22, -1, -1, -1, -1, -1,
- -1, 29, -1, -1, -1, 33, 34, -1, 36, -1,
- -1, -1, 40, -1, 42, 43, 44, -1, -1, 47,
- -1, -1, -1, 51, -1, 53, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 65, 66, 67,
- 68, -1, 70, -1, 72, -1, 74, -1, 76, -1,
- -1, -1, -1, 81, 82, 83, -1, -1, -1, 87,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 11, 12, 13, -1, -1, -1, -1, -1,
- -1, -1, -1, 22, -1, -1, -1, -1, -1, -1,
- 29, -1, -1, -1, 33, 34, -1, 36, -1, -1,
- -1, 40, -1, 42, 43, 44, -1, -1, 47, -1,
- -1, -1, 51, -1, 53, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 65, 66, 67, 68,
- -1, 70, -1, 72, -1, 74, 75, 76, -1, -1,
- -1, -1, 81, 82, 83, -1, -1, -1, 87, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 11, 12, 13, -1, -1, -1, -1, -1, -1,
- -1, -1, 22, -1, -1, -1, -1, -1, -1, 29,
- 30, -1, -1, 33, 34, -1, 36, -1, -1, -1,
- 40, -1, 42, 43, 44, -1, -1, 47, -1, -1,
- -1, 51, -1, 53, -1, -1, -1, -1, -1, -1,
- -1, 61, -1, -1, -1, 65, 66, 67, 68, -1,
- 70, -1, 72, -1, 74, -1, 76, -1, -1, -1,
- -1, 81, 82, 83, -1, -1, -1, 87, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 8, -1, -1, 11, 12, 13, -1, -1, -1, -1,
- -1, -1, -1, -1, 22, -1, -1, -1, -1, -1,
- -1, 29, -1, -1, -1, 33, 34, -1, 36, -1,
- -1, -1, 40, -1, 42, 43, 44, -1, -1, 47,
- -1, -1, -1, 51, -1, 53, -1, -1, 56, -1,
- -1, -1, -1, -1, -1, -1, -1, 65, 66, 67,
- 68, -1, 70, -1, 72, -1, 74, -1, 76, -1,
- -1, -1, -1, 81, 82, 83, -1, -1, -1, 87,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 8, -1, -1, 11, 12, 13, -1, -1,
- -1, -1, -1, -1, -1, -1, 22, -1, -1, -1,
- -1, -1, -1, 29, -1, -1, -1, 33, 34, -1,
- 36, -1, -1, -1, 40, -1, 42, 43, 44, -1,
- -1, 47, -1, -1, -1, 51, -1, 53, -1, -1,
- 56, -1, -1, -1, -1, -1, -1, -1, -1, 65,
- 66, 67, 68, -1, 70, -1, 72, -1, 74, -1,
- 76, -1, -1, -1, -1, 81, 82, 83, -1, -1,
- -1, 87, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 8, -1, -1, 11, 12, 13,
- -1, -1, -1, -1, -1, -1, -1, -1, 22, -1,
- -1, -1, -1, -1, -1, 29, -1, -1, -1, 33,
- 34, -1, 36, -1, -1, -1, 40, -1, 42, 43,
- 44, -1, -1, 47, -1, -1, -1, 51, -1, 53,
- -1, -1, 56, -1, -1, -1, -1, -1, -1, -1,
- -1, 65, 66, 67, 68, -1, 70, -1, 72, -1,
- 74, -1, 76, -1, -1, -1, -1, 81, 82, 83,
- -1, -1, -1, 87, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 8, -1, -1, 11,
- 12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
- 22, -1, -1, -1, -1, -1, -1, 29, -1, -1,
- -1, 33, 34, -1, 36, -1, -1, -1, 40, -1,
- 42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
- -1, 53, -1, -1, 56, -1, -1, -1, -1, -1,
- -1, -1, -1, 65, 66, 67, 68, -1, 70, -1,
- 72, -1, 74, -1, 76, -1, -1, -1, -1, 81,
- 82, 83, -1, -1, -1, 87, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 4, 5,
- 6, -1, -1, 9, 10, 11, -1, -1, 14, -1,
- 16, -1, -1, -1, 20, 21, 22, -1, -1, -1,
- -1, -1, -1, 29, 30, 31, 32, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 43, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 59, -1, -1, -1, -1, -1, -1,
- 66, 67, 68, 69, 70, 71, -1, 73, 74, 75,
- 76, 77, 78, -1, -1, 81, 82, 83, 84, 85,
- 86, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 4, 5, 6, -1, -1, 9,
- 10, 11, -1, -1, 14, -1, 16, -1, -1, -1,
- 20, 21, 22, -1, -1, -1, -1, -1, -1, 29,
- 30, 31, 32, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 43, -1, -1, -1, 47, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 59,
- -1, -1, -1, -1, -1, 65, 66, 67, -1, 69,
- 70, 71, -1, 73, 74, 75, 76, 77, 78, -1,
- -1, 81, 82, 83, 84, 85, 86, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 4, 5, 6, -1, -1, 9, 10, 11, -1, -1,
- 14, -1, 16, -1, -1, -1, 20, 21, 22, -1,
- -1, -1, -1, -1, -1, 29, 30, 31, 32, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 43,
- -1, -1, -1, 47, -1, -1, -1, -1, -1, -1,
- -1, 55, -1, -1, -1, 59, -1, -1, -1, -1,
- -1, 65, 66, 67, -1, 69, 70, 71, -1, 73,
- 74, 75, 76, 77, 78, -1, -1, 81, 82, 83,
- 84, 85, 86, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 4, -1, -1, -1,
- -1, 9, -1, 11, 12, 13, 14, -1, -1, -1,
- -1, -1, -1, 21, 22, -1, -1, -1, -1, -1,
- -1, 29, 30, -1, -1, 33, 34, -1, 36, -1,
- -1, -1, 40, -1, 42, 43, 44, -1, -1, 47,
- -1, -1, -1, 51, -1, 53, -1, -1, -1, -1,
- -1, 59, -1, 61, -1, -1, -1, 65, 66, 67,
- 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
- 78, -1, -1, 81, 82, 83, 84, 85, -1, 87,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 4, -1, -1, -1, -1, 9, -1, 11,
- 12, 13, 14, -1, -1, -1, -1, -1, -1, 21,
- 22, -1, -1, -1, -1, -1, -1, 29, 30, -1,
- -1, 33, 34, -1, 36, -1, -1, -1, 40, -1,
- 42, 43, 44, -1, -1, 47, -1, -1, -1, 51,
- -1, 53, -1, -1, -1, -1, -1, 59, -1, 61,
- -1, -1, -1, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 76, 77, 78, -1, -1, 81,
- 82, 83, 84, 85, -1, 87, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 4, 5,
- 6, -1, -1, 9, 10, 11, 12, 13, 14, -1,
- 16, -1, -1, -1, 20, 21, 22, -1, -1, -1,
- -1, -1, -1, 29, 30, 31, 32, 33, 34, -1,
- 36, -1, -1, -1, 40, -1, 42, 43, 44, -1,
- -1, 47, -1, -1, -1, 51, -1, 53, -1, -1,
- -1, -1, -1, 59, -1, 61, -1, -1, -1, 65,
- 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
- 76, 77, 78, -1, -1, 81, 82, 83, 84, 85,
- 86, 87, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 4, 5, 6, -1, -1, 9,
- 10, 11, 12, 13, 14, -1, 16, -1, -1, -1,
- 20, 21, 22, -1, -1, -1, -1, -1, -1, 29,
- 30, 31, 32, 33, 34, -1, 36, -1, -1, -1,
- 40, -1, 42, 43, 44, -1, -1, 47, -1, -1,
- -1, 51, -1, 53, -1, 55, -1, -1, -1, 59,
- -1, 61, -1, -1, -1, 65, 66, 67, 68, 69,
- 70, 71, 72, 73, 74, 75, 76, 77, 78, -1,
- -1, 81, 82, 83, 84, 85, 86, 87, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-
- 3, 2, 15, 25, 25, 3, 25, 3, 2, 11,
- 2, 15, 3, 13, 67, 3, 15, 104, 15, 2,
- 15, 2, 4, 3, 35, 15, 15, 3, 21, 3,
- 93, 15, 2, 2, 19, 13, 15, 96, 25, 25,
- 15, 3, 15, 15, 15, 100, 3, 3, 15, 2,
- 2, 15, 3, 21, 4, 15, 15, 15, 35, 2,
- 21, 2, 2, 2, 98, 3, 2, 2, 2, 35,
- 35, 4, 35, 2, 21, 3, 3, 3, 15, 2,
- 35, 35, 3, 3, 3, 3, 35, 35, 2, 35,
- 21, 35, -1, 35, -1, -1, 13, 2, 13, 44,
- 2, 46, 3, 3, 36, -1, -1, -1, 3, -1,
- -1, 15, -1, 35, 44, -1, 46, 13, 40, 44,
- 44, 46, 46, -1, 41, 15, 41, -1, 44, 15,
- 46, 44, 44, 46, 44, 44, 44, 44, 44, 49,
- 49, 44, 49, 49, 35, 41, 49, 37, 60, 40,
- 58, 44, 44, 46, 46, 44, 44, 44, 3, 44,
- 49, 46, 50, 50, 31, 44, 44, 68, 35, 44,
- 48, 50, 44, 68, 44, 50, 81, 49, 48, 81,
- 44, 85, 44, 44, 44, 49, 48, 44, 49, 49,
- 44, 44, 49, 44, 44, 49, 46, 44, 44, 52,
- 46, 44, 44, 46, 46, 56, 44, 54, 46, 15,
- 3, 44, 44, 99, 47, 47, 44, 44, 46, 46,
- 44, 44, 46, 68, 15, 13, 49, 44, 44, 44,
- 44, 44, 49, 49, 49, 49, 49, -1, 61, 53,
- 28, 29, 55, -1, -1, -1, 37, 38, 44, 66,
- 66, 66, 44, 49, 44, 51, -1, 49, 44, 49,
- -1, 44, -1, 49, 44, -1, 49, 57, 44, 49,
- 46, 51, 44, -1, 66, 68, 59, 49, 44, 51,
- 66, 87, 5, 49, 13, 51, 13, 16, 5, 16,
- 13, 20, 13, 20, -1, -1, 13, -1, -1, 20,
- 21, 22, 23, 24, -1, 28, 29, -1, 35, -1,
- -1, 28, 29, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 13, -1, -1, 16, -1, -1, -1, 20, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1};
-
-QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h
new file mode 100644
index 0000000..77b7484
--- /dev/null
+++ b/src/declarative/qml/qdeclarative.h
@@ -0,0 +1,312 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVE_H
+#define QDECLARATIVE_H
+
+#include "qdeclarativeprivate.h"
+#include "qdeclarativeparserstatus.h"
+#include "qdeclarativepropertyvaluesource.h"
+#include "qdeclarativepropertyvalueinterceptor.h"
+#include "qdeclarativelist.h"
+
+#include <QtCore/qbytearray.h>
+#include <QtCore/qmetaobject.h>
+
+QT_BEGIN_HEADER
+
+#define QML_DECLARE_TYPE(TYPE) \
+ Q_DECLARE_METATYPE(TYPE *) \
+ Q_DECLARE_METATYPE(QDeclarativeListProperty<TYPE>)
+
+#define QML_DECLARE_TYPE_HASMETATYPE(TYPE) \
+ Q_DECLARE_METATYPE(QDeclarativeListProperty<TYPE>)
+
+#define QML_DECLARE_INTERFACE(INTERFACE) \
+ QML_DECLARE_TYPE(INTERFACE)
+
+#define QML_DECLARE_INTERFACE_HASMETATYPE(INTERFACE) \
+ QML_DECLARE_TYPE_HASMETATYPE(INTERFACE)
+
+enum { /* TYPEINFO flags */
+ QML_HAS_ATTACHED_PROPERTIES = 0x01,
+};
+
+#define QML_DECLARE_TYPEINFO(TYPE, FLAGS) \
+QT_BEGIN_NAMESPACE \
+template <> \
+class QDeclarativeTypeInfo<TYPE > \
+{ \
+public: \
+ enum { \
+ hasAttachedProperties = (((FLAGS) & QML_HAS_ATTACHED_PROPERTIES) == QML_HAS_ATTACHED_PROPERTIES) \
+ }; \
+}; \
+QT_END_NAMESPACE
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+template<typename T>
+int qmlRegisterType()
+{
+ QByteArray name(T::staticMetaObject.className());
+
+ QByteArray pointerName(name + '*');
+ QByteArray listName("QDeclarativeListProperty<" + name + ">");
+
+ QDeclarativePrivate::RegisterType type = {
+ 0,
+
+ qRegisterMetaType<T *>(pointerName.constData()),
+ qRegisterMetaType<QDeclarativeListProperty<T> >(listName.constData()),
+ 0,
+
+ 0, 0, 0, 0, &T::staticMetaObject,
+
+ QDeclarativePrivate::attachedPropertiesFunc<T>(),
+ QDeclarativePrivate::attachedPropertiesMetaObject<T>(),
+
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativeParserStatus>::cast(),
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativePropertyValueSource>::cast(),
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativePropertyValueInterceptor>::cast(),
+
+ 0, 0,
+
+ 0
+ };
+
+ return QDeclarativePrivate::registerType(type);
+}
+
+template<typename T>
+int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
+{
+ QByteArray name(T::staticMetaObject.className());
+
+ QByteArray pointerName(name + '*');
+ QByteArray listName("QDeclarativeListProperty<" + name + ">");
+
+ QDeclarativePrivate::RegisterType type = {
+ 0,
+
+ qRegisterMetaType<T *>(pointerName.constData()),
+ qRegisterMetaType<QDeclarativeListProperty<T> >(listName.constData()),
+ QDeclarativePrivate::create<T>,
+
+ uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject,
+
+ QDeclarativePrivate::attachedPropertiesFunc<T>(),
+ QDeclarativePrivate::attachedPropertiesMetaObject<T>(),
+
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativeParserStatus>::cast(),
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativePropertyValueSource>::cast(),
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativePropertyValueInterceptor>::cast(),
+
+ 0, 0,
+
+ 0
+ };
+
+ return QDeclarativePrivate::registerType(type);
+}
+
+template<typename T, typename E>
+int qmlRegisterExtendedType()
+{
+ QByteArray name(T::staticMetaObject.className());
+
+ QByteArray pointerName(name + '*');
+ QByteArray listName("QDeclarativeListProperty<" + name + ">");
+
+ QDeclarativePrivate::RegisterType type = {
+ 0,
+
+ qRegisterMetaType<T *>(pointerName.constData()),
+ qRegisterMetaType<QDeclarativeListProperty<T> >(listName.constData()),
+ 0,
+
+ 0, 0, 0, 0, &T::staticMetaObject,
+
+ QDeclarativePrivate::attachedPropertiesFunc<T>(),
+ QDeclarativePrivate::attachedPropertiesMetaObject<T>(),
+
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativeParserStatus>::cast(),
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativePropertyValueSource>::cast(),
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativePropertyValueInterceptor>::cast(),
+
+ QDeclarativePrivate::createParent<E>, &E::staticMetaObject,
+
+ 0
+ };
+
+ return QDeclarativePrivate::registerType(type);
+}
+
+template<typename T, typename E>
+int qmlRegisterExtendedType(const char *uri, int versionMajor, int versionMinor,
+ const char *qmlName)
+{
+ QByteArray name(T::staticMetaObject.className());
+
+ QByteArray pointerName(name + '*');
+ QByteArray listName("QDeclarativeListProperty<" + name + ">");
+
+ QDeclarativeAttachedPropertiesFunc attached = QDeclarativePrivate::attachedPropertiesFunc<E>();
+ const QMetaObject * attachedMetaObject = QDeclarativePrivate::attachedPropertiesMetaObject<E>();
+ if (!attached) {
+ attached = QDeclarativePrivate::attachedPropertiesFunc<T>();
+ attachedMetaObject = QDeclarativePrivate::attachedPropertiesMetaObject<T>();
+ }
+
+ QDeclarativePrivate::RegisterType type = {
+ 0,
+
+ qRegisterMetaType<T *>(pointerName.constData()),
+ qRegisterMetaType<QDeclarativeListProperty<T> >(listName.constData()),
+ QDeclarativePrivate::create<T>,
+
+ uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject,
+
+ attached,
+ attachedMetaObject,
+
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativeParserStatus>::cast(),
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativePropertyValueSource>::cast(),
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativePropertyValueInterceptor>::cast(),
+
+ QDeclarativePrivate::createParent<E>, &E::staticMetaObject,
+
+ 0
+ };
+
+ return QDeclarativePrivate::registerType(type);
+}
+
+template<typename T>
+int qmlRegisterInterface(const char *typeName)
+{
+ QByteArray name(typeName);
+
+ QByteArray pointerName(name + '*');
+ QByteArray listName("QDeclarativeListProperty<" + name + ">");
+
+ QDeclarativePrivate::RegisterInterface interface = {
+ 0,
+
+ qRegisterMetaType<T *>(pointerName.constData()),
+ qRegisterMetaType<QDeclarativeListProperty<T> >(listName.constData()),
+
+ qobject_interface_iid<T *>()
+ };
+
+ return QDeclarativePrivate::registerType(interface);
+}
+
+template<typename T>
+int qmlRegisterCustomType(const char *uri, int versionMajor, int versionMinor,
+ const char *qmlName, const char *typeName, QDeclarativeCustomParser *parser)
+{
+ QByteArray name(typeName);
+
+ QByteArray pointerName(name + '*');
+ QByteArray listName("QDeclarativeListProperty<" + name + ">");
+
+ QDeclarativePrivate::RegisterType type = {
+ 0,
+
+ qRegisterMetaType<T *>(pointerName.constData()),
+ qRegisterMetaType<QDeclarativeListProperty<T> >(listName.constData()),
+ QDeclarativePrivate::create<T>,
+
+ uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject,
+
+ QDeclarativePrivate::attachedPropertiesFunc<T>(),
+ QDeclarativePrivate::attachedPropertiesMetaObject<T>(),
+
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativeParserStatus>::cast(),
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativePropertyValueSource>::cast(),
+ QDeclarativePrivate::StaticCastSelector<T,QDeclarativePropertyValueInterceptor>::cast(),
+
+ 0, 0,
+
+ parser
+ };
+
+ return QDeclarativePrivate::registerType(type);
+}
+
+#define QML_REGISTER_INTERFACE(INTERFACE) \
+ qmlRegisterInterface<INTERFACE>(#INTERFACE)
+
+#define QML_REGISTER_EXTENDED_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, CLASS, EXTENSION) \
+ qmlRegisterExtendedType<CLASS,EXTENSION>(#URI, VERSION_MAJ, VERSION_MIN, #NAME)
+
+#define QML_REGISTER_TYPE(URI,VMAJ,VMIN,NAME,CLASS) \
+ qmlRegisterType<CLASS>(#URI, VMAJ, VMIN, #NAME)
+
+#define QML_REGISTER_NOCREATE_TYPE(CLASS) \
+ qmlRegisterType<CLASS>()
+
+class QDeclarativeContext;
+class QDeclarativeEngine;
+Q_DECLARATIVE_EXPORT void qmlExecuteDeferred(QObject *);
+Q_DECLARATIVE_EXPORT QDeclarativeContext *qmlContext(const QObject *);
+Q_DECLARATIVE_EXPORT QDeclarativeEngine *qmlEngine(const QObject *);
+Q_DECLARATIVE_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *, bool create = true);
+Q_DECLARATIVE_EXPORT QObject *qmlAttachedPropertiesObject(int *, const QObject *, const QMetaObject *, bool create);
+
+template<typename T>
+QObject *qmlAttachedPropertiesObject(const QObject *obj, bool create = true)
+{
+ static int idx = -1;
+ return qmlAttachedPropertiesObject(&idx, obj, &T::staticMetaObject, create);
+}
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QObject)
+Q_DECLARE_METATYPE(QVariant)
+
+QT_END_HEADER
+
+#endif // QDECLARATIVE_H
diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp
index feadd0f..88ca5cd 100644
--- a/src/declarative/qml/qmlbinding.cpp
+++ b/src/declarative/qml/qdeclarativebinding.cpp
@@ -39,15 +39,15 @@
**
****************************************************************************/
-#include "qmlbinding.h"
-#include "qmlbinding_p.h"
+#include "qdeclarativebinding_p.h"
+#include "qdeclarativebinding_p_p.h"
-#include "qml.h"
-#include "qmlcontext.h"
-#include "qmlinfo.h"
-#include "qmlcontext_p.h"
-#include "qmldeclarativedata_p.h"
-#include "qmlstringconverters_p.h"
+#include "qdeclarative.h"
+#include "qdeclarativecontext.h"
+#include "qdeclarativeinfo.h"
+#include "qdeclarativecontext_p.h"
+#include "qdeclarativedeclarativedata_p.h"
+#include "qdeclarativestringconverters_p.h"
#include <qfxperf_p_p.h>
@@ -56,69 +56,69 @@
QT_BEGIN_NAMESPACE
-QML_DEFINE_NOCREATE_TYPE(QmlBinding);
-
-QmlBindingData::QmlBindingData()
+QDeclarativeBindingData::QDeclarativeBindingData()
: updating(false), enabled(false)
{
}
-QmlBindingData::~QmlBindingData()
+QDeclarativeBindingData::~QDeclarativeBindingData()
{
removeError();
}
-void QmlBindingData::refresh()
+void QDeclarativeBindingData::refresh()
{
if (enabled && !updating && q) {
- QmlBinding *b = static_cast<QmlBinding *>(QmlExpressionPrivate::get(q));
+ QDeclarativeBinding *b = static_cast<QDeclarativeBinding *>(QDeclarativeExpressionPrivate::get(q));
b->update();
}
}
-QmlBindingPrivate::QmlBindingPrivate()
-: QmlExpressionPrivate(new QmlBindingData)
+QDeclarativeBindingPrivate::QDeclarativeBindingPrivate()
+: QDeclarativeExpressionPrivate(new QDeclarativeBindingData)
{
}
-QmlBinding::QmlBinding(void *data, QmlRefCount *rc, QObject *obj, QmlContext *ctxt, const QString &url, int lineNumber, QObject *parent)
-: QmlExpression(ctxt, data, rc, obj, url, lineNumber, *new QmlBindingPrivate)
+QDeclarativeBinding::QDeclarativeBinding(void *data, QDeclarativeRefCount *rc, QObject *obj, QDeclarativeContext *ctxt, const QString &url, int lineNumber, QObject *parent)
+: QDeclarativeExpression(ctxt, data, rc, obj, url, lineNumber, *new QDeclarativeBindingPrivate)
{
setParent(parent);
+ setNotifyOnValueChanged(true);
}
-QmlBinding::QmlBinding(const QString &str, QObject *obj, QmlContext *ctxt, QObject *parent)
-: QmlExpression(ctxt, str, obj, *new QmlBindingPrivate)
+QDeclarativeBinding::QDeclarativeBinding(const QString &str, QObject *obj, QDeclarativeContext *ctxt, QObject *parent)
+: QDeclarativeExpression(ctxt, str, obj, *new QDeclarativeBindingPrivate)
{
setParent(parent);
+ setNotifyOnValueChanged(true);
}
-QmlBinding::~QmlBinding()
+QDeclarativeBinding::~QDeclarativeBinding()
{
}
-void QmlBinding::setTarget(const QmlMetaProperty &prop)
+void QDeclarativeBinding::setTarget(const QDeclarativeProperty &prop)
{
- Q_D(QmlBinding);
+ Q_D(QDeclarativeBinding);
d->bindingData()->property = prop;
update();
}
-QmlMetaProperty QmlBinding::property() const
+QDeclarativeProperty QDeclarativeBinding::property() const
{
- Q_D(const QmlBinding);
+ Q_D(const QDeclarativeBinding);
return d->bindingData()->property;
}
-void QmlBinding::update(QmlMetaProperty::WriteFlags flags)
+void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags)
{
- Q_D(QmlBinding);
+ Q_D(QDeclarativeBinding);
#ifdef Q_ENABLE_PERFORMANCE_LOG
- QmlPerfTimer<QmlPerf::BindableValueUpdate> bu;
+ QDeclarativePerfTimer<QDeclarativePerf::BindableValueUpdate> bu;
#endif
- QmlBindingData *data = d->bindingData();
+ QDeclarativeBindingData *data = d->bindingData();
if (!data->enabled)
return;
@@ -128,13 +128,13 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags)
if (!data->updating) {
data->updating = true;
- if (data->property.propertyCategory() == QmlMetaProperty::Bindable) {
+ if (data->property.propertyType() == qMetaTypeId<QDeclarativeBinding *>()) {
- int idx = data->property.coreIndex();
+ int idx = data->property.index();
Q_ASSERT(idx != -1);
- QmlBinding *t = this;
+ QDeclarativeBinding *t = this;
int status = -1;
void *a[] = { &t, 0, &status, &flags };
QMetaObject::metacall(data->property.object(),
@@ -161,7 +161,7 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags)
data->error.setDescription(QLatin1String("Unable to assign [undefined] to ") + QLatin1String(QMetaType::typeName(data->property.propertyType())));
} else if (!isUndefined && data->property.object() &&
- !data->property.write(value, flags)) {
+ !QDeclarativePropertyPrivate::write(data->property, value, flags)) {
QUrl url = QUrl(data->url);
int line = data->line;
@@ -181,8 +181,8 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags)
}
if (data->error.isValid()) {
- QmlEnginePrivate *p = (data->context() && data->context()->engine())?
- QmlEnginePrivate::get(data->context()->engine()):0;
+ QDeclarativeEnginePrivate *p = (data->context() && data->context()->engine())?
+ QDeclarativeEnginePrivate::get(data->context()->engine()):0;
if (!data->addError(p))
qWarning().nospace() << qPrintable(this->error().toString());
} else {
@@ -198,19 +198,19 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags)
data->release();
}
-void QmlBinding::emitValueChanged()
+void QDeclarativeBindingPrivate::emitValueChanged()
{
- update();
- // don't bother calling valueChanged()
+ Q_Q(QDeclarativeBinding);
+ q->update();
}
-void QmlBinding::setEnabled(bool e, QmlMetaProperty::WriteFlags flags)
+void QDeclarativeBinding::setEnabled(bool e, QDeclarativePropertyPrivate::WriteFlags flags)
{
- Q_D(QmlBinding);
+ Q_D(QDeclarativeBinding);
d->bindingData()->enabled = e;
- setTrackChange(e);
+ setNotifyOnValueChanged(e);
- QmlAbstractBinding::setEnabled(e, flags);
+ QDeclarativeAbstractBinding::setEnabled(e, flags);
if (e) {
addToObject(d->bindingData()->property.object());
@@ -220,42 +220,42 @@ void QmlBinding::setEnabled(bool e, QmlMetaProperty::WriteFlags flags)
}
}
-int QmlBinding::propertyIndex()
+int QDeclarativeBinding::propertyIndex()
{
- Q_D(QmlBinding);
- return d->bindingData()->property.coreIndex();
+ Q_D(QDeclarativeBinding);
+ return d->bindingData()->property.index();
}
-bool QmlBinding::enabled() const
+bool QDeclarativeBinding::enabled() const
{
- Q_D(const QmlBinding);
+ Q_D(const QDeclarativeBinding);
return d->bindingData()->enabled;
}
-QString QmlBinding::expression() const
+QString QDeclarativeBinding::expression() const
{
- return QmlExpression::expression();
+ return QDeclarativeExpression::expression();
}
-QmlAbstractBinding::QmlAbstractBinding()
+QDeclarativeAbstractBinding::QDeclarativeAbstractBinding()
: m_object(0), m_mePtr(0), m_prevBinding(0), m_nextBinding(0)
{
}
-QmlAbstractBinding::~QmlAbstractBinding()
+QDeclarativeAbstractBinding::~QDeclarativeAbstractBinding()
{
removeFromObject();
if (m_mePtr)
*m_mePtr = 0;
}
-void QmlAbstractBinding::destroy()
+void QDeclarativeAbstractBinding::destroy()
{
delete this;
}
-void QmlAbstractBinding::addToObject(QObject *object)
+void QDeclarativeAbstractBinding::addToObject(QObject *object)
{
Q_ASSERT(object);
@@ -263,7 +263,7 @@ void QmlAbstractBinding::addToObject(QObject *object)
Q_ASSERT(!m_prevBinding);
- QmlDeclarativeData *data = QmlDeclarativeData::get(object, true);
+ QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(object, true);
m_nextBinding = data->bindings;
if (m_nextBinding) m_nextBinding->m_prevBinding = &m_nextBinding;
m_prevBinding = &data->bindings;
@@ -273,7 +273,7 @@ void QmlAbstractBinding::addToObject(QObject *object)
data->setBindingBit(m_object, propertyIndex());
}
-void QmlAbstractBinding::removeFromObject()
+void QDeclarativeAbstractBinding::removeFromObject()
{
if (m_prevBinding) {
Q_ASSERT(m_object);
@@ -283,24 +283,24 @@ void QmlAbstractBinding::removeFromObject()
m_prevBinding = 0;
m_nextBinding = 0;
- QmlDeclarativeData *data = QmlDeclarativeData::get(m_object, false);
+ QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(m_object, false);
if (data) data->clearBindingBit(propertyIndex());
m_object = 0;
}
}
-void QmlAbstractBinding::clear()
+void QDeclarativeAbstractBinding::clear()
{
if (m_mePtr)
*m_mePtr = 0;
}
-QString QmlAbstractBinding::expression() const
+QString QDeclarativeAbstractBinding::expression() const
{
return QLatin1String("<Unknown>");
}
-void QmlAbstractBinding::setEnabled(bool e, QmlMetaProperty::WriteFlags)
+void QDeclarativeAbstractBinding::setEnabled(bool e, QDeclarativePropertyPrivate::WriteFlags)
{
if (e) m_mePtr = 0;
}
diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h
new file mode 100644
index 0000000..f66b9c7
--- /dev/null
+++ b/src/declarative/qml/qdeclarativebinding_p.h
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVEBINDING_P_H
+#define QDECLARATIVEBINDING_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 "qdeclarative.h"
+#include "qdeclarativepropertyvaluesource.h"
+#include "qdeclarativeexpression.h"
+#include "qdeclarativeproperty.h"
+#include "qdeclarativeproperty_p.h"
+
+#include <QtCore/QObject>
+#include <QtCore/QMetaProperty>
+
+QT_BEGIN_NAMESPACE
+
+class Q_AUTOTEST_EXPORT QDeclarativeAbstractBinding
+{
+public:
+ QDeclarativeAbstractBinding();
+ virtual ~QDeclarativeAbstractBinding();
+
+ virtual void destroy();
+
+ virtual QString expression() const;
+
+ void setEnabled(bool e) { setEnabled(e, QDeclarativePropertyPrivate::DontRemoveBinding); }
+ virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags) = 0;
+ virtual int propertyIndex() = 0;
+
+ void update() { update(QDeclarativePropertyPrivate::DontRemoveBinding); }
+ virtual void update(QDeclarativePropertyPrivate::WriteFlags) = 0;
+
+ void addToObject(QObject *);
+ void removeFromObject();
+
+protected:
+ void clear();
+
+private:
+ friend class QDeclarativeDeclarativeData;
+ friend class QDeclarativeProperty;
+ friend class QDeclarativePropertyPrivate;
+ friend class QDeclarativeVME;
+
+ QObject *m_object;
+ QDeclarativeAbstractBinding **m_mePtr;
+ QDeclarativeAbstractBinding **m_prevBinding;
+ QDeclarativeAbstractBinding *m_nextBinding;
+};
+
+class QDeclarativeContext;
+class QDeclarativeBindingPrivate;
+class Q_AUTOTEST_EXPORT QDeclarativeBinding : public QDeclarativeExpression, public QDeclarativeAbstractBinding
+{
+Q_OBJECT
+public:
+ QDeclarativeBinding(const QString &, QObject *, QDeclarativeContext *, QObject *parent=0);
+ QDeclarativeBinding(void *, QDeclarativeRefCount *, QObject *, QDeclarativeContext *, const QString &, int,
+ QObject *parent);
+ ~QDeclarativeBinding();
+
+ void setTarget(const QDeclarativeProperty &);
+ QDeclarativeProperty property() const;
+
+ bool enabled() const;
+
+ // Inherited from QDeclarativeAbstractBinding
+ virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags flags);
+ virtual int propertyIndex();
+ virtual void update(QDeclarativePropertyPrivate::WriteFlags flags);
+ virtual QString expression() const;
+
+public Q_SLOTS:
+ void update() { update(QDeclarativePropertyPrivate::DontRemoveBinding); }
+
+protected:
+ void emitValueChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QDeclarativeBinding)
+};
+Q_DECLARE_METATYPE(QDeclarativeBinding*);
+
+QT_END_NAMESPACE
+
+#endif // QDECLARATIVEBINDING_P_H
diff --git a/src/declarative/qml/qmlbinding_p.h b/src/declarative/qml/qdeclarativebinding_p_p.h
index b4f88b5..041103c 100644
--- a/src/declarative/qml/qmlbinding_p.h
+++ b/src/declarative/qml/qdeclarativebinding_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLBINDING_P_H
-#define QMLBINDING_P_H
+#ifndef QDECLARATIVEBINDING_P_P_H
+#define QDECLARATIVEBINDING_P_P_H
//
// W A R N I N G
@@ -53,37 +53,39 @@
// We mean it.
//
-#include "qmlbinding.h"
+#include "qdeclarativebinding_p.h"
-#include "qmlmetaproperty.h"
-#include "qmlexpression_p.h"
+#include "qdeclarativeproperty.h"
+#include "qdeclarativeexpression_p.h"
QT_BEGIN_NAMESPACE
-class QmlBindingData : public QmlExpressionData
+class QDeclarativeBindingData : public QDeclarativeExpressionData
{
public:
- QmlBindingData();
- virtual ~QmlBindingData();
+ QDeclarativeBindingData();
+ virtual ~QDeclarativeBindingData();
bool updating:1;
bool enabled:1;
- QmlMetaProperty property;
+ QDeclarativeProperty property;
virtual void refresh();
};
-class QmlBindingPrivate : public QmlExpressionPrivate
+class QDeclarativeBindingPrivate : public QDeclarativeExpressionPrivate
{
- Q_DECLARE_PUBLIC(QmlBinding)
+ Q_DECLARE_PUBLIC(QDeclarativeBinding)
public:
- QmlBindingPrivate();
+ QDeclarativeBindingPrivate();
- QmlBindingData *bindingData() { return static_cast<QmlBindingData *>(data); }
- const QmlBindingData *bindingData() const { return static_cast<const QmlBindingData *>(data); }
+ QDeclarativeBindingData *bindingData() { return static_cast<QDeclarativeBindingData *>(data); }
+ const QDeclarativeBindingData *bindingData() const { return static_cast<const QDeclarativeBindingData *>(data); }
+
+ virtual void emitValueChanged();
};
QT_END_NAMESPACE
-#endif // QMLBINDING_P_H
+#endif // QDECLARATIVEBINDING_P_P_H
diff --git a/src/declarative/qml/qmlboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp
index a075899..ce396fd 100644
--- a/src/declarative/qml/qmlboundsignal.cpp
+++ b/src/declarative/qml/qdeclarativeboundsignal.cpp
@@ -39,27 +39,27 @@
**
****************************************************************************/
-#include "qmlboundsignal_p.h"
+#include "qdeclarativeboundsignal_p.h"
#include "qmetaobjectbuilder_p.h"
-#include "qmlengine_p.h"
-#include "qmlexpression_p.h"
-#include "qmlcontext_p.h"
-#include "qmlmetatype.h"
-#include "qml.h"
-#include "qmlcontext.h"
-#include "qmlglobal_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativeexpression_p.h"
+#include "qdeclarativecontext_p.h"
+#include "qdeclarativemetatype_p.h"
+#include "qdeclarative.h"
+#include "qdeclarativecontext.h"
+#include "qdeclarativeglobal_p.h"
#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
-class QmlBoundSignalParameters : public QObject
+class QDeclarativeBoundSignalParameters : public QObject
{
Q_OBJECT
public:
- QmlBoundSignalParameters(const QMetaMethod &, QObject * = 0);
- ~QmlBoundSignalParameters();
+ QDeclarativeBoundSignalParameters(const QMetaMethod &, QObject * = 0);
+ ~QDeclarativeBoundSignalParameters();
void setValues(void **);
void clearValues();
@@ -68,13 +68,13 @@ private:
friend class MetaObject;
int metaCall(QMetaObject::Call, int _id, void **);
struct MetaObject : public QAbstractDynamicMetaObject {
- MetaObject(QmlBoundSignalParameters *b)
+ MetaObject(QDeclarativeBoundSignalParameters *b)
: parent(b) {}
int metaCall(QMetaObject::Call c, int id, void **a) {
return parent->metaCall(c, id, a);
}
- QmlBoundSignalParameters *parent;
+ QDeclarativeBoundSignalParameters *parent;
};
int *types;
@@ -84,56 +84,55 @@ private:
static int evaluateIdx = -1;
-QmlAbstractBoundSignal::QmlAbstractBoundSignal(QObject *parent)
+QDeclarativeAbstractBoundSignal::QDeclarativeAbstractBoundSignal(QObject *parent)
: QObject(parent)
{
}
-QmlAbstractBoundSignal::~QmlAbstractBoundSignal()
+QDeclarativeAbstractBoundSignal::~QDeclarativeAbstractBoundSignal()
{
}
-QmlBoundSignal::QmlBoundSignal(QObject *scope, const QMetaMethod &signal,
+QDeclarativeBoundSignal::QDeclarativeBoundSignal(QObject *scope, const QMetaMethod &signal,
QObject *parent)
: m_expression(0), m_signal(signal), m_paramsValid(false), m_params(0)
{
- // A cached evaluation of the QmlExpression::value() slot index.
+ // A cached evaluation of the QDeclarativeExpression::value() slot index.
//
// This is thread safe. Although it may be updated by two threads, they
// will both set it to the same value - so the worst thing that can happen
// is that they both do the work to figure it out. Boo hoo.
if (evaluateIdx == -1) evaluateIdx = metaObject()->methodCount();
- QmlGraphics_setParent_noEvent(this, parent);
+ QDeclarativeGraphics_setParent_noEvent(this, parent);
QMetaObject::connect(scope, m_signal.methodIndex(), this, evaluateIdx);
}
-QmlBoundSignal::QmlBoundSignal(QmlContext *ctxt, const QString &val,
+QDeclarativeBoundSignal::QDeclarativeBoundSignal(QDeclarativeContext *ctxt, const QString &val,
QObject *scope, const QMetaMethod &signal,
QObject *parent)
: m_expression(0), m_signal(signal), m_paramsValid(false), m_params(0)
{
- // A cached evaluation of the QmlExpression::value() slot index.
+ // A cached evaluation of the QDeclarativeExpression::value() slot index.
//
// This is thread safe. Although it may be updated by two threads, they
// will both set it to the same value - so the worst thing that can happen
// is that they both do the work to figure it out. Boo hoo.
if (evaluateIdx == -1) evaluateIdx = metaObject()->methodCount();
- QmlGraphics_setParent_noEvent(this, parent);
+ QDeclarativeGraphics_setParent_noEvent(this, parent);
QMetaObject::connect(scope, m_signal.methodIndex(), this, evaluateIdx);
- m_expression = new QmlExpression(ctxt, val, scope);
- m_expression->setTrackChange(false);
+ m_expression = new QDeclarativeExpression(ctxt, val, scope);
}
-QmlBoundSignal::~QmlBoundSignal()
+QDeclarativeBoundSignal::~QDeclarativeBoundSignal()
{
delete m_expression;
m_expression = 0;
}
-int QmlBoundSignal::index() const
+int QDeclarativeBoundSignal::index() const
{
return m_signal.methodIndex();
}
@@ -141,7 +140,7 @@ int QmlBoundSignal::index() const
/*!
Returns the signal expression.
*/
-QmlExpression *QmlBoundSignal::expression() const
+QDeclarativeExpression *QDeclarativeBoundSignal::expression() const
{
return m_expression;
}
@@ -150,35 +149,35 @@ QmlExpression *QmlBoundSignal::expression() const
Sets the signal expression to \a e. Returns the current signal expression,
or null if there is no signal expression.
- The QmlBoundSignal instance takes ownership of \a e. The caller is
- assumes ownership of the returned QmlExpression.
+ The QDeclarativeBoundSignal instance takes ownership of \a e. The caller is
+ assumes ownership of the returned QDeclarativeExpression.
*/
-QmlExpression *QmlBoundSignal::setExpression(QmlExpression *e)
+QDeclarativeExpression *QDeclarativeBoundSignal::setExpression(QDeclarativeExpression *e)
{
- QmlExpression *rv = m_expression;
+ QDeclarativeExpression *rv = m_expression;
m_expression = e;
- if (m_expression) m_expression->setTrackChange(false);
+ if (m_expression) m_expression->setNotifyOnValueChanged(false);
return rv;
}
-QmlBoundSignal *QmlBoundSignal::cast(QObject *o)
+QDeclarativeBoundSignal *QDeclarativeBoundSignal::cast(QObject *o)
{
- QmlAbstractBoundSignal *s = qobject_cast<QmlAbstractBoundSignal*>(o);
- return static_cast<QmlBoundSignal *>(s);
+ QDeclarativeAbstractBoundSignal *s = qobject_cast<QDeclarativeAbstractBoundSignal*>(o);
+ return static_cast<QDeclarativeBoundSignal *>(s);
}
-int QmlBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a)
+int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a)
{
if (c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) {
if (!m_paramsValid) {
if (!m_signal.parameterTypes().isEmpty())
- m_params = new QmlBoundSignalParameters(m_signal, this);
+ m_params = new QDeclarativeBoundSignalParameters(m_signal, this);
m_paramsValid = true;
}
if (m_params) m_params->setValues(a);
if (m_expression) {
- QmlExpressionPrivate::get(m_expression)->value(m_params);
+ QDeclarativeExpressionPrivate::get(m_expression)->value(m_params);
if (m_expression && m_expression->hasError())
qWarning().nospace() << qPrintable(m_expression->error().toString());
}
@@ -189,7 +188,7 @@ int QmlBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a)
}
}
-QmlBoundSignalParameters::QmlBoundSignalParameters(const QMetaMethod &method,
+QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters(const QMetaMethod &method,
QObject *parent)
: QObject(parent), types(0), values(0)
{
@@ -198,8 +197,8 @@ QmlBoundSignalParameters::QmlBoundSignalParameters(const QMetaMethod &method,
// ### Optimize!
// ### Ensure only supported types are allowed, otherwise it might crash
QMetaObjectBuilder mob;
- mob.setSuperClass(&QmlBoundSignalParameters::staticMetaObject);
- mob.setClassName("QmlBoundSignalParameters");
+ mob.setSuperClass(&QDeclarativeBoundSignalParameters::staticMetaObject);
+ mob.setClassName("QDeclarativeBoundSignalParameters");
QList<QByteArray> paramTypes = method.parameterTypes();
QList<QByteArray> paramNames = method.parameterNames();
@@ -214,7 +213,7 @@ QmlBoundSignalParameters::QmlBoundSignalParameters(const QMetaMethod &method,
}
QVariant::Type t = (QVariant::Type)QMetaType::type(type.constData());
- if (QmlMetaType::isQObject(t)) {
+ if (QDeclarativeMetaType::isQObject(t)) {
types[ii] = QMetaType::QObjectStar;
QMetaPropertyBuilder prop = mob.addProperty(name, "QObject*");
prop.setWritable(false);
@@ -230,29 +229,29 @@ QmlBoundSignalParameters::QmlBoundSignalParameters(const QMetaMethod &method,
d_ptr->metaObject = mo;
}
-QmlBoundSignalParameters::~QmlBoundSignalParameters()
+QDeclarativeBoundSignalParameters::~QDeclarativeBoundSignalParameters()
{
delete [] types;
qFree(myMetaObject);
}
-void QmlBoundSignalParameters::setValues(void **v)
+void QDeclarativeBoundSignalParameters::setValues(void **v)
{
values = v;
}
-void QmlBoundSignalParameters::clearValues()
+void QDeclarativeBoundSignalParameters::clearValues()
{
values = 0;
}
-int QmlBoundSignalParameters::metaCall(QMetaObject::Call c, int id, void **a)
+int QDeclarativeBoundSignalParameters::metaCall(QMetaObject::Call c, int id, void **a)
{
if (!values)
return -1;
if (c == QMetaObject::ReadProperty && id >= 1) {
- QmlMetaType::copy(types[id - 1], a[0], values[id]);
+ QDeclarativeMetaType::copy(types[id - 1], a[0], values[id]);
return -1;
} else {
return qt_metacall(c, id, a);
@@ -261,4 +260,4 @@ int QmlBoundSignalParameters::metaCall(QMetaObject::Call c, int id, void **a)
QT_END_NAMESPACE
-#include <qmlboundsignal.moc>
+#include <qdeclarativeboundsignal.moc>
diff --git a/src/declarative/qml/qmlboundsignal_p.h b/src/declarative/qml/qdeclarativeboundsignal_p.h
index 51d21d7..bba4eec 100644
--- a/src/declarative/qml/qmlboundsignal_p.h
+++ b/src/declarative/qml/qdeclarativeboundsignal_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLBOUNDSIGNAL_P_H
-#define QMLBOUNDSIGNAL_P_H
+#ifndef QDECLARATIVEBOUNDSIGNAL_P_H
+#define QDECLARATIVEBOUNDSIGNAL_P_H
//
// W A R N I N G
@@ -53,7 +53,7 @@
// We mean it.
//
-#include "qmlexpression.h"
+#include "qdeclarativeexpression.h"
#include <QtCore/qmetaobject.h>
@@ -61,40 +61,40 @@
QT_BEGIN_NAMESPACE
-class QmlAbstractBoundSignal : public QObject
+class QDeclarativeAbstractBoundSignal : public QObject
{
Q_OBJECT
public:
- QmlAbstractBoundSignal(QObject *parent = 0);
- virtual ~QmlAbstractBoundSignal() = 0;
+ QDeclarativeAbstractBoundSignal(QObject *parent = 0);
+ virtual ~QDeclarativeAbstractBoundSignal() = 0;
};
-class QmlBoundSignalParameters;
-class QmlBoundSignal : public QmlAbstractBoundSignal
+class QDeclarativeBoundSignalParameters;
+class QDeclarativeBoundSignal : public QDeclarativeAbstractBoundSignal
{
public:
- QmlBoundSignal(QObject *scope, const QMetaMethod &signal, QObject *parent);
- QmlBoundSignal(QmlContext *ctxt, const QString &val, QObject *scope,
+ QDeclarativeBoundSignal(QObject *scope, const QMetaMethod &signal, QObject *parent);
+ QDeclarativeBoundSignal(QDeclarativeContext *ctxt, const QString &val, QObject *scope,
const QMetaMethod &signal, QObject *parent);
- virtual ~QmlBoundSignal();
+ virtual ~QDeclarativeBoundSignal();
int index() const;
- QmlExpression *expression() const;
- QmlExpression *setExpression(QmlExpression *);
+ QDeclarativeExpression *expression() const;
+ QDeclarativeExpression *setExpression(QDeclarativeExpression *);
- static QmlBoundSignal *cast(QObject *);
+ static QDeclarativeBoundSignal *cast(QObject *);
protected:
virtual int qt_metacall(QMetaObject::Call c, int id, void **a);
private:
- QmlExpression *m_expression;
+ QDeclarativeExpression *m_expression;
QMetaMethod m_signal;
bool m_paramsValid;
- QmlBoundSignalParameters *m_params;
+ QDeclarativeBoundSignalParameters *m_params;
};
QT_END_NAMESPACE
-#endif // QMLBOUNDSIGNAL_P_H
+#endif // QDECLARATIVEBOUNDSIGNAL_P_H
diff --git a/src/declarative/qml/qmlclassfactory.cpp b/src/declarative/qml/qdeclarativeclassfactory.cpp
index 2adff09..ae4975c 100644
--- a/src/declarative/qml/qmlclassfactory.cpp
+++ b/src/declarative/qml/qdeclarativeclassfactory.cpp
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#include "qmlclassfactory_p.h"
+#include "qdeclarativeclassfactory_p.h"
QT_BEGIN_NAMESPACE
-QmlClassFactory::~QmlClassFactory()
+QDeclarativeClassFactory::~QDeclarativeClassFactory()
{
}
diff --git a/src/declarative/qml/qmlclassfactory_p.h b/src/declarative/qml/qdeclarativeclassfactory_p.h
index 2ddadcf..9f4a3de 100644
--- a/src/declarative/qml/qmlclassfactory_p.h
+++ b/src/declarative/qml/qdeclarativeclassfactory_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLCLASSFACTORY_P_H
-#define QMLCLASSFACTORY_P_H
+#ifndef QDECLARATIVECLASSFACTORY_P_H
+#define QDECLARATIVECLASSFACTORY_P_H
//
// W A R N I N G
@@ -57,18 +57,18 @@
QT_BEGIN_NAMESPACE
-class QmlEngine;
+class QDeclarativeEngine;
class QByteArray;
class QUrl;
-class QmlComponent;
+class QDeclarativeComponent;
-class QmlClassFactory
+class QDeclarativeClassFactory
{
public:
- virtual ~QmlClassFactory();
- virtual QmlComponent *create(const QByteArray &, const QUrl& baseUrl, QmlEngine*) = 0;
+ virtual ~QDeclarativeClassFactory();
+ virtual QDeclarativeComponent *create(const QByteArray &, const QUrl& baseUrl, QDeclarativeEngine*) = 0;
};
QT_END_NAMESPACE
-#endif // QMLCLASSFACTORY_P_H
+#endif // QDECLARATIVECLASSFACTORY_P_H
diff --git a/src/declarative/qml/qmlcleanup.cpp b/src/declarative/qml/qdeclarativecleanup.cpp
index 581d4a3..0fa49d1 100644
--- a/src/declarative/qml/qmlcleanup.cpp
+++ b/src/declarative/qml/qdeclarativecleanup.cpp
@@ -39,34 +39,34 @@
**
****************************************************************************/
-#include "qmlcleanup_p.h"
+#include "qdeclarativecleanup_p.h"
-#include "qmlengine_p.h"
+#include "qdeclarativeengine_p.h"
QT_BEGIN_NAMESPACE
/*!
\internal
-\class QmlCleanup
-\brief The QmlCleanup provides a callback when a QmlEngine is deleted.
+\class QDeclarativeCleanup
+\brief The QDeclarativeCleanup provides a callback when a QDeclarativeEngine is deleted.
-Any object that needs cleanup to occur before the QmlEngine's QScriptEngine is
-destroyed should inherit from QmlCleanup. The clear() virtual method will be
-called by QmlEngine just before it deletes the QScriptEngine.
+Any object that needs cleanup to occur before the QDeclarativeEngine's QScriptEngine is
+destroyed should inherit from QDeclarativeCleanup. The clear() virtual method will be
+called by QDeclarativeEngine just before it deletes the QScriptEngine.
*/
/*!
\internal
-Create a QmlCleanup for \a engine
+Create a QDeclarativeCleanup for \a engine
*/
-QmlCleanup::QmlCleanup(QmlEngine *engine)
+QDeclarativeCleanup::QDeclarativeCleanup(QDeclarativeEngine *engine)
: prev(0), next(0)
{
if (!engine)
return;
- QmlEnginePrivate *p = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *p = QDeclarativeEnginePrivate::get(engine);
if (p->cleanup) next = p->cleanup;
p->cleanup = this;
@@ -77,7 +77,7 @@ QmlCleanup::QmlCleanup(QmlEngine *engine)
/*!
\internal
*/
-QmlCleanup::~QmlCleanup()
+QDeclarativeCleanup::~QDeclarativeCleanup()
{
if (prev) *prev = next;
if (next) next->prev = prev;
diff --git a/src/declarative/qml/qmlcleanup_p.h b/src/declarative/qml/qdeclarativecleanup_p.h
index 50803f3..e9b6b45 100644
--- a/src/declarative/qml/qmlcleanup_p.h
+++ b/src/declarative/qml/qdeclarativecleanup_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLCLEANUP_P_H
-#define QMLCLEANUP_P_H
+#ifndef QDECLARATIVECLEANUP_P_H
+#define QDECLARATIVECLEANUP_P_H
#include <QtCore/qglobal.h>
@@ -57,23 +57,23 @@
QT_BEGIN_NAMESPACE
-class QmlEngine;
-class QmlCleanup
+class QDeclarativeEngine;
+class QDeclarativeCleanup
{
public:
- QmlCleanup(QmlEngine *);
- virtual ~QmlCleanup();
+ QDeclarativeCleanup(QDeclarativeEngine *);
+ virtual ~QDeclarativeCleanup();
protected:
virtual void clear() = 0;
private:
- friend class QmlEnginePrivate;
- QmlCleanup **prev;
- QmlCleanup *next;
+ friend class QDeclarativeEnginePrivate;
+ QDeclarativeCleanup **prev;
+ QDeclarativeCleanup *next;
};
QT_END_NAMESPACE
-#endif // QMLCLEANUP_P_H
+#endif // QDECLARATIVECLEANUP_P_H
diff --git a/src/declarative/qml/qmlcompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp
index 7a8cf0e..17937fd 100644
--- a/src/declarative/qml/qmlcompiledbindings.cpp
+++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp
@@ -41,20 +41,20 @@
// #define COMPILEDBINDINGS_DEBUG
-#include "qmlcompiledbindings_p.h"
+#include "qdeclarativecompiledbindings_p.h"
-#include <QtDeclarative/qmlinfo.h>
-#include <private/qmlcontext_p.h>
-#include <private/qmljsast_p.h>
-#include <private/qmljsengine_p.h>
-#include <private/qmlexpression_p.h>
+#include <QtDeclarative/qdeclarativeinfo.h>
+#include <private/qdeclarativecontext_p.h>
+#include <private/qdeclarativejsast_p.h>
+#include <private/qdeclarativejsengine_p.h>
+#include <private/qdeclarativeexpression_p.h>
#include <QtCore/qdebug.h>
#include <QtCore/qnumeric.h>
-#include <private/qmlgraphicsanchors_p_p.h>
+#include <private/qdeclarativeanchors_p_p.h>
QT_BEGIN_NAMESPACE
-using namespace QmlJS;
+using namespace QDeclarativeJS;
namespace {
// Supported types: int, qreal, QString (needs constr/destr), QObject*, bool
@@ -96,22 +96,22 @@ struct Register {
};
}
-class QmlCompiledBindingsPrivate : public QObjectPrivate
+class QDeclarativeCompiledBindingsPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlCompiledBindings)
+ Q_DECLARE_PUBLIC(QDeclarativeCompiledBindings)
public:
- QmlCompiledBindingsPrivate();
- virtual ~QmlCompiledBindingsPrivate();
+ QDeclarativeCompiledBindingsPrivate();
+ virtual ~QDeclarativeCompiledBindingsPrivate();
- struct Binding : public QmlAbstractBinding, public QmlDelayedError {
+ struct Binding : public QDeclarativeAbstractBinding, public QDeclarativeDelayedError {
Binding() : enabled(false), updating(0), property(0),
scope(0), target(0), parent(0) {}
- // Inherited from QmlAbstractBinding
- virtual void setEnabled(bool, QmlMetaProperty::WriteFlags flags);
+ // Inherited from QDeclarativeAbstractBinding
+ virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags flags);
virtual int propertyIndex();
- virtual void update(QmlMetaProperty::WriteFlags flags);
+ virtual void update(QDeclarativePropertyPrivate::WriteFlags flags);
virtual void destroy();
int index:30;
@@ -121,12 +121,12 @@ public:
QObject *scope;
QObject *target;
- QmlCompiledBindingsPrivate *parent;
+ QDeclarativeCompiledBindingsPrivate *parent;
};
struct Subscription {
struct Signal {
- QmlGuard<QObject> source;
+ QDeclarativeGuard<QObject> source;
int notifyIndex;
};
@@ -136,10 +136,10 @@ public:
bool isSignal() const { return type == SignalType; }
bool isId() const { return type == IdType; }
inline Signal *signal();
- inline QmlContextPrivate::IdNotifier *id();
+ inline QDeclarativeContextPrivate::IdNotifier *id();
union {
char signalData[sizeof(Signal)];
- char idData[sizeof(QmlContextPrivate::IdNotifier)];
+ char idData[sizeof(QDeclarativeContextPrivate::IdNotifier)];
};
};
Subscription *subscriptions;
@@ -154,84 +154,84 @@ public:
static int methodCount;
void init();
- void run(int instr, QmlContextPrivate *context,
- QmlDelayedError *error, QObject *scope, QObject *output);
+ void run(int instr, QDeclarativeContextPrivate *context,
+ QDeclarativeDelayedError *error, QObject *scope, QObject *output);
inline void unsubscribe(int subIndex);
- inline void subscribeId(QmlContextPrivate *p, int idIndex, int subIndex);
+ inline void subscribeId(QDeclarativeContextPrivate *p, int idIndex, int subIndex);
inline void subscribe(QObject *o, int notifyIndex, int subIndex);
- QmlPropertyCache::Data *findproperty(QObject *obj,
+ QDeclarativePropertyCache::Data *findproperty(QObject *obj,
const QScriptDeclarativeClass::Identifier &name,
- QmlEnginePrivate *enginePriv,
- QmlPropertyCache::Data &local);
+ QDeclarativeEnginePrivate *enginePriv,
+ QDeclarativePropertyCache::Data &local);
bool findproperty(QObject *obj,
Register *output,
- QmlEnginePrivate *enginePriv,
+ QDeclarativeEnginePrivate *enginePriv,
int subIdx,
const QScriptDeclarativeClass::Identifier &name,
bool isTerminal);
void findgeneric(Register *output, // value output
int subIdx, // Subscription index in config
- QmlContextPrivate *context, // Context to search in
+ QDeclarativeContextPrivate *context, // Context to search in
const QScriptDeclarativeClass::Identifier &name,
bool isTerminal);
};
-QmlCompiledBindingsPrivate::QmlCompiledBindingsPrivate()
+QDeclarativeCompiledBindingsPrivate::QDeclarativeCompiledBindingsPrivate()
: subscriptions(0), identifiers(0)
{
}
-QmlCompiledBindingsPrivate::~QmlCompiledBindingsPrivate()
+QDeclarativeCompiledBindingsPrivate::~QDeclarativeCompiledBindingsPrivate()
{
delete [] subscriptions; subscriptions = 0;
delete [] identifiers; identifiers = 0;
}
-QmlCompiledBindingsPrivate::Subscription::Subscription()
+QDeclarativeCompiledBindingsPrivate::Subscription::Subscription()
: type(InvalidType)
{
}
-QmlCompiledBindingsPrivate::Subscription::~Subscription()
+QDeclarativeCompiledBindingsPrivate::Subscription::~Subscription()
{
if (type == SignalType) ((Signal *)signalData)->~Signal();
- else if (type == IdType) ((QmlContextPrivate::IdNotifier *)idData)->~IdNotifier();
+ else if (type == IdType) ((QDeclarativeContextPrivate::IdNotifier *)idData)->~IdNotifier();
}
-int QmlCompiledBindingsPrivate::methodCount = -1;
+int QDeclarativeCompiledBindingsPrivate::methodCount = -1;
-QmlCompiledBindings::QmlCompiledBindings(const char *program, QmlContext *context)
-: QObject(*(new QmlCompiledBindingsPrivate))
+QDeclarativeCompiledBindings::QDeclarativeCompiledBindings(const char *program, QDeclarativeContext *context)
+: QObject(*(new QDeclarativeCompiledBindingsPrivate))
{
- Q_D(QmlCompiledBindings);
+ Q_D(QDeclarativeCompiledBindings);
if (d->methodCount == -1)
- d->methodCount = QmlCompiledBindings::staticMetaObject.methodCount();
+ d->methodCount = QDeclarativeCompiledBindings::staticMetaObject.methodCount();
d->programData = program;
d->init();
- QmlAbstractExpression::setContext(context);
+ QDeclarativeAbstractExpression::setContext(context);
}
-QmlCompiledBindings::~QmlCompiledBindings()
+QDeclarativeCompiledBindings::~QDeclarativeCompiledBindings()
{
- Q_D(QmlCompiledBindings);
+ Q_D(QDeclarativeCompiledBindings);
delete [] d->m_bindings;
}
-QmlAbstractBinding *QmlCompiledBindings::configBinding(int index, QObject *target,
+QDeclarativeAbstractBinding *QDeclarativeCompiledBindings::configBinding(int index, QObject *target,
QObject *scope, int property)
{
- Q_D(QmlCompiledBindings);
+ Q_D(QDeclarativeCompiledBindings);
- QmlCompiledBindingsPrivate::Binding *rv = d->m_bindings + index;
+ QDeclarativeCompiledBindingsPrivate::Binding *rv = d->m_bindings + index;
rv->index = index;
rv->property = property;
@@ -244,7 +244,7 @@ QmlAbstractBinding *QmlCompiledBindings::configBinding(int index, QObject *targe
return rv;
}
-void QmlCompiledBindingsPrivate::Binding::setEnabled(bool e, QmlMetaProperty::WriteFlags flags)
+void QDeclarativeCompiledBindingsPrivate::Binding::setEnabled(bool e, QDeclarativePropertyPrivate::WriteFlags flags)
{
if (e) {
addToObject(target);
@@ -253,7 +253,7 @@ void QmlCompiledBindingsPrivate::Binding::setEnabled(bool e, QmlMetaProperty::Wr
removeFromObject();
}
- QmlAbstractBinding::setEnabled(e, flags);
+ QDeclarativeAbstractBinding::setEnabled(e, flags);
if (enabled != e) {
enabled = e;
@@ -262,17 +262,17 @@ void QmlCompiledBindingsPrivate::Binding::setEnabled(bool e, QmlMetaProperty::Wr
}
}
-int QmlCompiledBindingsPrivate::Binding::propertyIndex()
+int QDeclarativeCompiledBindingsPrivate::Binding::propertyIndex()
{
return property & 0xFFFF;
}
-void QmlCompiledBindingsPrivate::Binding::update(QmlMetaProperty::WriteFlags)
+void QDeclarativeCompiledBindingsPrivate::Binding::update(QDeclarativePropertyPrivate::WriteFlags)
{
parent->run(this);
}
-void QmlCompiledBindingsPrivate::Binding::destroy()
+void QDeclarativeCompiledBindingsPrivate::Binding::destroy()
{
enabled = false;
removeFromObject();
@@ -280,9 +280,9 @@ void QmlCompiledBindingsPrivate::Binding::destroy()
clear();
}
-int QmlCompiledBindings::qt_metacall(QMetaObject::Call c, int id, void **)
+int QDeclarativeCompiledBindings::qt_metacall(QMetaObject::Call c, int id, void **)
{
- Q_D(QmlCompiledBindings);
+ Q_D(QDeclarativeCompiledBindings);
if (c == QMetaObject::InvokeMetaMethod && id >= d->methodCount) {
id -= d->methodCount;
@@ -297,26 +297,26 @@ int QmlCompiledBindings::qt_metacall(QMetaObject::Call c, int id, void **)
return -1;
}
-void QmlCompiledBindingsPrivate::run(Binding *binding)
+void QDeclarativeCompiledBindingsPrivate::run(Binding *binding)
{
- Q_Q(QmlCompiledBindings);
+ Q_Q(QDeclarativeCompiledBindings);
if (!binding->enabled)
return;
if (binding->updating)
qWarning("ERROR: Circular binding");
- QmlContext *context = q->QmlAbstractExpression::context();
+ QDeclarativeContext *context = q->QDeclarativeAbstractExpression::context();
if (!context) {
- qWarning("QmlCompiledBindings: Attempted to evaluate an expression in an invalid context");
+ qWarning("QDeclarativeCompiledBindings: Attempted to evaluate an expression in an invalid context");
return;
}
- QmlContextPrivate *cp = QmlContextPrivate::get(context);
+ QDeclarativeContextPrivate *cp = QDeclarativeContextPrivate::get(context);
if (binding->property & 0xFFFF0000) {
- QmlEnginePrivate *ep = QmlEnginePrivate::get(cp->engine);
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(cp->engine);
- QmlValueType *vt = ep->valueTypes[(binding->property >> 16) & 0xFF];
+ QDeclarativeValueType *vt = ep->valueTypes[(binding->property >> 16) & 0xFF];
Q_ASSERT(vt);
vt->read(binding->target, binding->property & 0xFFFF);
@@ -324,26 +324,26 @@ void QmlCompiledBindingsPrivate::run(Binding *binding)
run(binding->index, cp, binding, binding->scope, target);
vt->write(binding->target, binding->property & 0xFFFF,
- QmlMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::DontRemoveBinding);
} else {
run(binding->index, cp, binding, binding->scope, binding->target);
}
}
-QmlCompiledBindingsPrivate::Subscription::Signal *QmlCompiledBindingsPrivate::Subscription::signal()
+QDeclarativeCompiledBindingsPrivate::Subscription::Signal *QDeclarativeCompiledBindingsPrivate::Subscription::signal()
{
- if (type == IdType) ((QmlContextPrivate::IdNotifier *)idData)->~IdNotifier();
+ if (type == IdType) ((QDeclarativeContextPrivate::IdNotifier *)idData)->~IdNotifier();
if (type != SignalType) new (signalData) Signal;
type = SignalType;
return (Signal *)signalData;
}
-QmlContextPrivate::IdNotifier *QmlCompiledBindingsPrivate::Subscription::id()
+QDeclarativeContextPrivate::IdNotifier *QDeclarativeCompiledBindingsPrivate::Subscription::id()
{
if (type == SignalType) ((Signal *)signalData)->~Signal();
- if (type != IdType) new (idData) QmlContextPrivate::IdNotifier;
+ if (type != IdType) new (idData) QDeclarativeContextPrivate::IdNotifier;
type = IdType;
- return (QmlContextPrivate::IdNotifier *)idData;
+ return (QDeclarativeContextPrivate::IdNotifier *)idData;
}
namespace {
@@ -547,7 +547,7 @@ struct Program {
};
}
-struct QmlBindingCompilerPrivate
+struct QDeclarativeBindingCompilerPrivate
{
struct Result {
Result() : unknownType(false), metaObject(0), type(-1), reg(-1) {}
@@ -568,46 +568,46 @@ struct QmlBindingCompilerPrivate
QSet<QString> subscriptionSet;
};
- QmlBindingCompilerPrivate() : registers(0) {}
+ QDeclarativeBindingCompilerPrivate() : registers(0) {}
void resetInstanceState();
int commitCompile();
- QmlParser::Object *context;
- QmlParser::Object *component;
- QmlParser::Property *destination;
- QHash<QString, QmlParser::Object *> ids;
- QmlEnginePrivate::Imports imports;
- QmlEnginePrivate *engine;
+ QDeclarativeParser::Object *context;
+ QDeclarativeParser::Object *component;
+ QDeclarativeParser::Property *destination;
+ QHash<QString, QDeclarativeParser::Object *> ids;
+ QDeclarativeEnginePrivate::Imports imports;
+ QDeclarativeEnginePrivate *engine;
QString contextName() const { return QLatin1String("$$$SCOPE_") + QString::number((intptr_t)context, 16); }
- bool compile(QmlJS::AST::Node *);
+ bool compile(QDeclarativeJS::AST::Node *);
- bool parseExpression(QmlJS::AST::Node *, Result &);
+ bool parseExpression(QDeclarativeJS::AST::Node *, Result &);
- bool tryName(QmlJS::AST::Node *);
- bool parseName(QmlJS::AST::Node *, Result &);
+ bool tryName(QDeclarativeJS::AST::Node *);
+ bool parseName(QDeclarativeJS::AST::Node *, Result &);
- bool tryArith(QmlJS::AST::Node *);
- bool parseArith(QmlJS::AST::Node *, Result &);
+ bool tryArith(QDeclarativeJS::AST::Node *);
+ bool parseArith(QDeclarativeJS::AST::Node *, Result &);
bool numberArith(Result &, const Result &, const Result &, QSOperator::Op op);
bool stringArith(Result &, const Result &, const Result &, QSOperator::Op op);
- bool tryLogic(QmlJS::AST::Node *);
- bool parseLogic(QmlJS::AST::Node *, Result &);
+ bool tryLogic(QDeclarativeJS::AST::Node *);
+ bool parseLogic(QDeclarativeJS::AST::Node *, Result &);
- bool tryConditional(QmlJS::AST::Node *);
- bool parseConditional(QmlJS::AST::Node *, Result &);
+ bool tryConditional(QDeclarativeJS::AST::Node *);
+ bool parseConditional(QDeclarativeJS::AST::Node *, Result &);
- bool tryConstant(QmlJS::AST::Node *);
- bool parseConstant(QmlJS::AST::Node *, Result &);
+ bool tryConstant(QDeclarativeJS::AST::Node *);
+ bool parseConstant(QDeclarativeJS::AST::Node *, Result &);
- bool tryMethod(QmlJS::AST::Node *);
- bool parseMethod(QmlJS::AST::Node *, Result &);
+ bool tryMethod(QDeclarativeJS::AST::Node *);
+ bool parseMethod(QDeclarativeJS::AST::Node *, Result &);
- bool buildName(QStringList &, QmlJS::AST::Node *, QList<QmlJS::AST::ExpressionNode *> *nodes = 0);
- bool fetch(Result &type, const QMetaObject *, int reg, int idx, const QStringList &, QmlJS::AST::ExpressionNode *);
+ bool buildName(QStringList &, QDeclarativeJS::AST::Node *, QList<QDeclarativeJS::AST::ExpressionNode *> *nodes = 0);
+ bool fetch(Result &type, const QMetaObject *, int reg, int idx, const QStringList &, QDeclarativeJS::AST::ExpressionNode *);
quint32 registers;
QHash<int, QPair<int, int> > registerCleanups;
@@ -624,7 +624,7 @@ struct QmlBindingCompilerPrivate
int subscriptionIndex(const QStringList &);
bool subscriptionNeutral(const QSet<QString> &base, const QSet<QString> &lhs, const QSet<QString> &rhs);
- quint8 exceptionId(QmlJS::AST::ExpressionNode *);
+ quint8 exceptionId(QDeclarativeJS::AST::ExpressionNode *);
QVector<quint64> exceptions;
QSet<int> usedSubscriptionIds;
@@ -651,13 +651,13 @@ struct QmlBindingCompilerPrivate
QByteArray buildExceptionData() const;
};
-void QmlCompiledBindingsPrivate::unsubscribe(int subIndex)
+void QDeclarativeCompiledBindingsPrivate::unsubscribe(int subIndex)
{
- Q_Q(QmlCompiledBindings);
+ Q_Q(QDeclarativeCompiledBindings);
- QmlCompiledBindingsPrivate::Subscription *sub = (subscriptions + subIndex);
+ QDeclarativeCompiledBindingsPrivate::Subscription *sub = (subscriptions + subIndex);
if (sub->isSignal()) {
- QmlCompiledBindingsPrivate::Subscription::Signal *s = sub->signal();
+ QDeclarativeCompiledBindingsPrivate::Subscription::Signal *s = sub->signal();
if (s->source)
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 2))
QMetaObject::disconnectOne(s->source, s->notifyIndex,
@@ -672,15 +672,15 @@ void QmlCompiledBindingsPrivate::unsubscribe(int subIndex)
}
}
-void QmlCompiledBindingsPrivate::subscribeId(QmlContextPrivate *p, int idIndex, int subIndex)
+void QDeclarativeCompiledBindingsPrivate::subscribeId(QDeclarativeContextPrivate *p, int idIndex, int subIndex)
{
- Q_Q(QmlCompiledBindings);
+ Q_Q(QDeclarativeCompiledBindings);
unsubscribe(subIndex);
if (p->idValues[idIndex]) {
- QmlCompiledBindingsPrivate::Subscription *sub = (subscriptions + subIndex);
- QmlContextPrivate::IdNotifier *i = sub->id();
+ QDeclarativeCompiledBindingsPrivate::Subscription *sub = (subscriptions + subIndex);
+ QDeclarativeContextPrivate::IdNotifier *i = sub->id();
i->next = p->idValues[idIndex].bindings;
i->prev = &p->idValues[idIndex].bindings;
@@ -692,16 +692,16 @@ void QmlCompiledBindingsPrivate::subscribeId(QmlContextPrivate *p, int idIndex,
}
}
-void QmlCompiledBindingsPrivate::subscribe(QObject *o, int notifyIndex, int subIndex)
+void QDeclarativeCompiledBindingsPrivate::subscribe(QObject *o, int notifyIndex, int subIndex)
{
- Q_Q(QmlCompiledBindings);
+ Q_Q(QDeclarativeCompiledBindings);
- QmlCompiledBindingsPrivate::Subscription *sub = (subscriptions + subIndex);
+ QDeclarativeCompiledBindingsPrivate::Subscription *sub = (subscriptions + subIndex);
if (sub->isId())
unsubscribe(subIndex);
- QmlCompiledBindingsPrivate::Subscription::Signal *s = sub->signal();
+ QDeclarativeCompiledBindingsPrivate::Subscription::Signal *s = sub->signal();
if (o != s->source || notifyIndex != s->notifyIndex) {
if (s->source)
#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 2))
@@ -767,7 +767,7 @@ inline static bool toBool(Register *reg, int type, bool *ok = 0)
}
}
-inline static QUrl toUrl(Register *reg, int type, QmlContextPrivate *context, bool *ok = 0)
+inline static QUrl toUrl(Register *reg, int type, QDeclarativeContextPrivate *context, bool *ok = 0)
{
if (ok) *ok = true;
@@ -810,8 +810,8 @@ static QObject *variantToQObject(const QVariant &value, bool *ok)
}
}
-bool QmlCompiledBindingsPrivate::findproperty(QObject *obj, Register *output,
- QmlEnginePrivate *enginePriv,
+bool QDeclarativeCompiledBindingsPrivate::findproperty(QObject *obj, Register *output,
+ QDeclarativeEnginePrivate *enginePriv,
int subIdx, const QScriptDeclarativeClass::Identifier &name,
bool isTerminal)
{
@@ -820,15 +820,15 @@ bool QmlCompiledBindingsPrivate::findproperty(QObject *obj, Register *output,
return false;
}
- QmlPropertyCache::Data local;
- QmlPropertyCache::Data *property =
- QmlPropertyCache::property(QmlEnginePrivate::get(enginePriv), obj, name, local);
+ QDeclarativePropertyCache::Data local;
+ QDeclarativePropertyCache::Data *property =
+ QDeclarativePropertyCache::property(QDeclarativeEnginePrivate::get(enginePriv), obj, name, local);
if (property) {
if (subIdx != -1)
subscribe(obj, property->notifyIndex, subIdx);
- if (property->flags & QmlPropertyCache::Data::IsQObjectDerived) {
+ if (property->flags & QDeclarativePropertyCache::Data::IsQObjectDerived) {
void *args[] = { output->typeDataPtr(), 0 };
QMetaObject::metacall(obj, QMetaObject::ReadProperty, property->coreIndex, args);
output->settype(QMetaType::QObjectStar);
@@ -883,13 +883,13 @@ bool QmlCompiledBindingsPrivate::findproperty(QObject *obj, Register *output,
}
}
-void QmlCompiledBindingsPrivate::findgeneric(Register *output,
+void QDeclarativeCompiledBindingsPrivate::findgeneric(Register *output,
int subIdx,
- QmlContextPrivate *context,
+ QDeclarativeContextPrivate *context,
const QScriptDeclarativeClass::Identifier &name,
bool isTerminal)
{
- QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(context->engine);
+ QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(context->engine);
while (context) {
@@ -899,7 +899,7 @@ void QmlCompiledBindingsPrivate::findgeneric(Register *output,
if (contextPropertyIndex != -1) {
if (subIdx != -1)
- subscribe(QmlContextPrivate::get(context), contextPropertyIndex + context->notifyIndex, subIdx);
+ subscribe(QDeclarativeContextPrivate::get(context), contextPropertyIndex + context->notifyIndex, subIdx);
if (contextPropertyIndex < context->idValueCount) {
output->setQObject(context->idValues[contextPropertyIndex]);
@@ -936,7 +936,7 @@ void QmlCompiledBindingsPrivate::findgeneric(Register *output,
}
if (context->parent) {
- context = QmlContextPrivate::get(context->parent);
+ context = QDeclarativeContextPrivate::get(context->parent);
} else {
context = 0;
}
@@ -945,20 +945,20 @@ void QmlCompiledBindingsPrivate::findgeneric(Register *output,
output->setUndefined();
}
-void QmlCompiledBindingsPrivate::init()
+void QDeclarativeCompiledBindingsPrivate::init()
{
Program *program = (Program *)programData;
if (program->subscriptions)
- subscriptions = new QmlCompiledBindingsPrivate::Subscription[program->subscriptions];
+ subscriptions = new QDeclarativeCompiledBindingsPrivate::Subscription[program->subscriptions];
if (program->identifiers)
identifiers = new QScriptDeclarativeClass::PersistentIdentifier[program->identifiers];
m_signalTable = (quint32 *)(program->data() + program->signalTableOffset);
- m_bindings = new QmlCompiledBindingsPrivate::Binding[program->bindings];
+ m_bindings = new QDeclarativeCompiledBindingsPrivate::Binding[program->bindings];
}
-static void throwException(int id, QmlDelayedError *error,
- Program *program, QmlContextPrivate *context,
+static void throwException(int id, QDeclarativeDelayedError *error,
+ Program *program, QDeclarativeContextPrivate *context,
const QString &description = QString())
{
error->error.setUrl(context->url);
@@ -974,7 +974,7 @@ static void throwException(int id, QmlDelayedError *error,
error->error.setLine(-1);
error->error.setColumn(-1);
}
- if (!context->engine || !error->addError(QmlEnginePrivate::get(context->engine)))
+ if (!context->engine || !error->addError(QDeclarativeEnginePrivate::get(context->engine)))
qWarning() << error->error;
}
@@ -1119,8 +1119,8 @@ static void dumpInstruction(const Instr *instr)
}
}
-void QmlCompiledBindingsPrivate::run(int instrIndex,
- QmlContextPrivate *context, QmlDelayedError *error,
+void QDeclarativeCompiledBindingsPrivate::run(int instrIndex,
+ QDeclarativeContextPrivate *context, QDeclarativeDelayedError *error,
QObject *scope, QObject *output)
{
error->removeError();
@@ -1128,7 +1128,7 @@ void QmlCompiledBindingsPrivate::run(int instrIndex,
Register registers[32];
int storeFlags = 0;
- QmlEnginePrivate *engine = QmlEnginePrivate::get(context->engine);
+ QDeclarativeEnginePrivate *engine = QDeclarativeEnginePrivate::get(context->engine);
Program *program = (Program *)programData;
const Instr *instr = program->instructions();
instr += instrIndex;
@@ -1455,7 +1455,7 @@ void QmlCompiledBindingsPrivate::run(int instrIndex,
// name is not present in the current context or it would have been
// found during the static compile
findgeneric(registers + instr->find.reg, instr->find.subscribeIndex,
- QmlContextPrivate::get(context->parent),
+ QDeclarativeContextPrivate::get(context->parent),
identifiers[instr->find.name].identifier,
instr->common.type == Instr::FindGenericTerminal);
break;
@@ -1470,7 +1470,7 @@ void QmlCompiledBindingsPrivate::run(int instrIndex,
}
findproperty(object.getQObject(), registers + instr->find.reg,
- QmlEnginePrivate::get(context->engine),
+ QDeclarativeEnginePrivate::get(context->engine),
instr->find.subscribeIndex, identifiers[instr->find.name].identifier,
instr->common.type == Instr::FindPropertyTerminal);
}
@@ -1540,7 +1540,7 @@ void QmlCompiledBindingsPrivate::run(int instrIndex,
}
}
-void QmlBindingCompiler::dump(const QByteArray &programData)
+void QDeclarativeBindingCompiler::dump(const QByteArray &programData)
{
const Program *program = (const Program *)programData.constData();
@@ -1563,7 +1563,7 @@ void QmlBindingCompiler::dump(const QByteArray &programData)
Clear the state associated with attempting to compile a specific binding.
This does not clear the global "commited binding" states.
*/
-void QmlBindingCompilerPrivate::resetInstanceState()
+void QDeclarativeBindingCompilerPrivate::resetInstanceState()
{
registers = 0;
registerCleanups.clear();
@@ -1582,7 +1582,7 @@ section.
Returns the index for the committed binding.
*/
-int QmlBindingCompilerPrivate::commitCompile()
+int QDeclarativeBindingCompilerPrivate::commitCompile()
{
int rv = committed.count();
committed.offsets << committed.bytecode.count();
@@ -1595,7 +1595,7 @@ int QmlBindingCompilerPrivate::commitCompile()
return rv;
}
-bool QmlBindingCompilerPrivate::compile(QmlJS::AST::Node *node)
+bool QDeclarativeBindingCompilerPrivate::compile(QDeclarativeJS::AST::Node *node)
{
resetInstanceState();
@@ -1701,7 +1701,7 @@ bool QmlBindingCompilerPrivate::compile(QmlJS::AST::Node *node)
const QMetaObject *from = type.metaObject;
const QMetaObject *to = engine->rawMetaObjectForType(destination->type);
- if (QmlMetaPropertyPrivate::canConvert(from, to))
+ if (QDeclarativePropertyPrivate::canConvert(from, to))
type.type = destination->type;
}
@@ -1727,7 +1727,7 @@ bool QmlBindingCompilerPrivate::compile(QmlJS::AST::Node *node)
}
}
-bool QmlBindingCompilerPrivate::parseExpression(QmlJS::AST::Node *node, Result &type)
+bool QDeclarativeBindingCompilerPrivate::parseExpression(QDeclarativeJS::AST::Node *node, Result &type)
{
while (node->kind == AST::Node::Kind_NestedExpression)
node = static_cast<AST::NestedExpression *>(node)->expression;
@@ -1750,13 +1750,13 @@ bool QmlBindingCompilerPrivate::parseExpression(QmlJS::AST::Node *node, Result &
return true;
}
-bool QmlBindingCompilerPrivate::tryName(QmlJS::AST::Node *node)
+bool QDeclarativeBindingCompilerPrivate::tryName(QDeclarativeJS::AST::Node *node)
{
return node->kind == AST::Node::Kind_IdentifierExpression ||
node->kind == AST::Node::Kind_FieldMemberExpression;
}
-bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
+bool QDeclarativeBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
{
QStringList nameParts;
QList<AST::ExpressionNode *> nameNodes;
@@ -1768,7 +1768,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
return false;
type.reg = reg;
- QmlParser::Object *absType = 0;
+ QDeclarativeParser::Object *absType = 0;
QStringList subscribeName;
@@ -1782,7 +1782,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
name.at(2).isUpper())
return false;
- QmlType *attachType = 0;
+ QDeclarativeType *attachType = 0;
if (name.at(0).isUpper()) {
// Could be an attached property
if (ii == nameParts.count() - 1)
@@ -1790,7 +1790,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
if (nameParts.at(ii + 1).at(0).isUpper())
return false;
- QmlEnginePrivate::ImportedNamespace *ns = 0;
+ QDeclarativeEnginePrivate::ImportedNamespace *ns = 0;
if (!engine->resolveType(imports, name.toUtf8(), &attachType, 0, 0, 0, &ns))
return false;
if (ns || !attachType || !attachType->attachedPropertiesType())
@@ -1824,7 +1824,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
continue;
} else if (ids.contains(name)) {
- QmlParser::Object *idObject = ids.value(name);
+ QDeclarativeParser::Object *idObject = ids.value(name);
absType = idObject;
type.metaObject = absType->metaObject();
@@ -1988,7 +1988,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type)
return true;
}
-bool QmlBindingCompilerPrivate::tryArith(QmlJS::AST::Node *node)
+bool QDeclarativeBindingCompilerPrivate::tryArith(QDeclarativeJS::AST::Node *node)
{
if (node->kind != AST::Node::Kind_BinaryExpression)
return false;
@@ -2001,7 +2001,7 @@ bool QmlBindingCompilerPrivate::tryArith(QmlJS::AST::Node *node)
return false;
}
-bool QmlBindingCompilerPrivate::parseArith(QmlJS::AST::Node *node, Result &type)
+bool QDeclarativeBindingCompilerPrivate::parseArith(QDeclarativeJS::AST::Node *node, Result &type)
{
AST::BinaryExpression *expression = static_cast<AST::BinaryExpression *>(node);
@@ -2026,7 +2026,7 @@ bool QmlBindingCompilerPrivate::parseArith(QmlJS::AST::Node *node, Result &type)
return false;
}
-bool QmlBindingCompilerPrivate::numberArith(Result &type, const Result &lhs, const Result &rhs, QSOperator::Op op)
+bool QDeclarativeBindingCompilerPrivate::numberArith(Result &type, const Result &lhs, const Result &rhs, QSOperator::Op op)
{
bool nativeReal = rhs.type == QMetaType::QReal ||
lhs.type == QMetaType::QReal ||
@@ -2098,7 +2098,7 @@ bool QmlBindingCompilerPrivate::numberArith(Result &type, const Result &lhs, con
return true;
}
-bool QmlBindingCompilerPrivate::stringArith(Result &type, const Result &lhs, const Result &rhs, QSOperator::Op op)
+bool QDeclarativeBindingCompilerPrivate::stringArith(Result &type, const Result &lhs, const Result &rhs, QSOperator::Op op)
{
if (op != QSOperator::Add)
return false;
@@ -2142,7 +2142,7 @@ bool QmlBindingCompilerPrivate::stringArith(Result &type, const Result &lhs, con
return true;
}
-bool QmlBindingCompilerPrivate::tryLogic(QmlJS::AST::Node *node)
+bool QDeclarativeBindingCompilerPrivate::tryLogic(QDeclarativeJS::AST::Node *node)
{
if (node->kind != AST::Node::Kind_BinaryExpression)
return false;
@@ -2156,7 +2156,7 @@ bool QmlBindingCompilerPrivate::tryLogic(QmlJS::AST::Node *node)
return false;
}
-bool QmlBindingCompilerPrivate::parseLogic(QmlJS::AST::Node *node, Result &type)
+bool QDeclarativeBindingCompilerPrivate::parseLogic(QDeclarativeJS::AST::Node *node, Result &type)
{
AST::BinaryExpression *expression = static_cast<AST::BinaryExpression *>(node);
@@ -2211,12 +2211,12 @@ bool QmlBindingCompilerPrivate::parseLogic(QmlJS::AST::Node *node, Result &type)
return true;
}
-bool QmlBindingCompilerPrivate::tryConditional(QmlJS::AST::Node *node)
+bool QDeclarativeBindingCompilerPrivate::tryConditional(QDeclarativeJS::AST::Node *node)
{
return (node->kind == AST::Node::Kind_ConditionalExpression);
}
-bool QmlBindingCompilerPrivate::parseConditional(QmlJS::AST::Node *node, Result &type)
+bool QDeclarativeBindingCompilerPrivate::parseConditional(QDeclarativeJS::AST::Node *node, Result &type)
{
AST::ConditionalExpression *expression = static_cast<AST::ConditionalExpression *>(node);
@@ -2279,7 +2279,7 @@ bool QmlBindingCompilerPrivate::parseConditional(QmlJS::AST::Node *node, Result
return true;
}
-bool QmlBindingCompilerPrivate::tryConstant(QmlJS::AST::Node *node)
+bool QDeclarativeBindingCompilerPrivate::tryConstant(QDeclarativeJS::AST::Node *node)
{
return node->kind == AST::Node::Kind_TrueLiteral ||
node->kind == AST::Node::Kind_FalseLiteral ||
@@ -2287,7 +2287,7 @@ bool QmlBindingCompilerPrivate::tryConstant(QmlJS::AST::Node *node)
node->kind == AST::Node::Kind_StringLiteral;
}
-bool QmlBindingCompilerPrivate::parseConstant(QmlJS::AST::Node *node, Result &type)
+bool QDeclarativeBindingCompilerPrivate::parseConstant(QDeclarativeJS::AST::Node *node, Result &type)
{
type.metaObject = 0;
type.type = -1;
@@ -2332,12 +2332,12 @@ bool QmlBindingCompilerPrivate::parseConstant(QmlJS::AST::Node *node, Result &ty
}
}
-bool QmlBindingCompilerPrivate::tryMethod(QmlJS::AST::Node *node)
+bool QDeclarativeBindingCompilerPrivate::tryMethod(QDeclarativeJS::AST::Node *node)
{
return node->kind == AST::Node::Kind_CallExpression;
}
-bool QmlBindingCompilerPrivate::parseMethod(QmlJS::AST::Node *node, Result &result)
+bool QDeclarativeBindingCompilerPrivate::parseMethod(QDeclarativeJS::AST::Node *node, Result &result)
{
AST::CallExpression *expr = static_cast<AST::CallExpression *>(node);
@@ -2390,9 +2390,9 @@ bool QmlBindingCompilerPrivate::parseMethod(QmlJS::AST::Node *node, Result &resu
return true;
}
-bool QmlBindingCompilerPrivate::buildName(QStringList &name,
- QmlJS::AST::Node *node,
- QList<QmlJS::AST::ExpressionNode *> *nodes)
+bool QDeclarativeBindingCompilerPrivate::buildName(QStringList &name,
+ QDeclarativeJS::AST::Node *node,
+ QList<QDeclarativeJS::AST::ExpressionNode *> *nodes)
{
if (node->kind == AST::Node::Kind_IdentifierExpression) {
name << static_cast<AST::IdentifierExpression*>(node)->name->asString();
@@ -2414,8 +2414,8 @@ bool QmlBindingCompilerPrivate::buildName(QStringList &name,
}
-bool QmlBindingCompilerPrivate::fetch(Result &rv, const QMetaObject *mo, int reg,
- int idx, const QStringList &subName, QmlJS::AST::ExpressionNode *node)
+bool QDeclarativeBindingCompilerPrivate::fetch(Result &rv, const QMetaObject *mo, int reg,
+ int idx, const QStringList &subName, QDeclarativeJS::AST::ExpressionNode *node)
{
QMetaProperty prop = mo->property(idx);
rv.metaObject = 0;
@@ -2464,7 +2464,7 @@ bool QmlBindingCompilerPrivate::fetch(Result &rv, const QMetaObject *mo, int reg
rv.type != QMetaType::QReal &&
rv.type != QMetaType::Int &&
rv.type != QMetaType::Bool &&
- rv.type != qMetaTypeId<QmlGraphicsAnchorLine>() &&
+ rv.type != qMetaTypeId<QDeclarativeAnchorLine>() &&
rv.type != QMetaType::QString) {
rv.metaObject = 0;
rv.type = 0;
@@ -2474,12 +2474,12 @@ bool QmlBindingCompilerPrivate::fetch(Result &rv, const QMetaObject *mo, int reg
return true;
}
-void QmlBindingCompilerPrivate::registerCleanup(int reg, int cleanup, int cleanupType)
+void QDeclarativeBindingCompilerPrivate::registerCleanup(int reg, int cleanup, int cleanupType)
{
registerCleanups.insert(reg, qMakePair(cleanup, cleanupType));
}
-int QmlBindingCompilerPrivate::acquireReg(int cleanup, int cleanupType)
+int QDeclarativeBindingCompilerPrivate::acquireReg(int cleanup, int cleanupType)
{
for (int ii = 0; ii < 32; ++ii) {
if (!(registers & (1 << ii))) {
@@ -2494,7 +2494,7 @@ int QmlBindingCompilerPrivate::acquireReg(int cleanup, int cleanupType)
return -1;
}
-void QmlBindingCompilerPrivate::releaseReg(int reg)
+void QDeclarativeBindingCompilerPrivate::releaseReg(int reg)
{
Q_ASSERT(reg >= 0 && reg <= 31);
@@ -2512,7 +2512,7 @@ void QmlBindingCompilerPrivate::releaseReg(int reg)
}
// Returns a reg
-int QmlBindingCompilerPrivate::registerLiteralString(const QString &str)
+int QDeclarativeBindingCompilerPrivate::registerLiteralString(const QString &str)
{
QByteArray strdata((const char *)str.constData(), str.length() * sizeof(QChar));
int offset = data.count();
@@ -2531,7 +2531,7 @@ int QmlBindingCompilerPrivate::registerLiteralString(const QString &str)
}
// Returns an identifier offset
-int QmlBindingCompilerPrivate::registerString(const QString &string)
+int QDeclarativeBindingCompilerPrivate::registerString(const QString &string)
{
Q_ASSERT(!string.isEmpty());
@@ -2556,7 +2556,7 @@ int QmlBindingCompilerPrivate::registerString(const QString &string)
return reg.initstring.offset;
}
-bool QmlBindingCompilerPrivate::subscription(const QStringList &sub, Result *result)
+bool QDeclarativeBindingCompilerPrivate::subscription(const QStringList &sub, Result *result)
{
QString str = sub.join(QLatin1String("."));
result->subscriptionSet.insert(str);
@@ -2569,7 +2569,7 @@ bool QmlBindingCompilerPrivate::subscription(const QStringList &sub, Result *res
}
}
-int QmlBindingCompilerPrivate::subscriptionIndex(const QStringList &sub)
+int QDeclarativeBindingCompilerPrivate::subscriptionIndex(const QStringList &sub)
{
QString str = sub.join(QLatin1String("."));
QHash<QString, int>::ConstIterator iter = subscriptionIds.find(str);
@@ -2583,7 +2583,7 @@ int QmlBindingCompilerPrivate::subscriptionIndex(const QStringList &sub)
Returns true if lhs contains no subscriptions that aren't also in base or rhs AND
rhs contains no subscriptions that aren't also in base or lhs.
*/
-bool QmlBindingCompilerPrivate::subscriptionNeutral(const QSet<QString> &base,
+bool QDeclarativeBindingCompilerPrivate::subscriptionNeutral(const QSet<QString> &base,
const QSet<QString> &lhs,
const QSet<QString> &rhs)
{
@@ -2598,12 +2598,12 @@ bool QmlBindingCompilerPrivate::subscriptionNeutral(const QSet<QString> &base,
return difflhs.isEmpty();
}
-quint8 QmlBindingCompilerPrivate::exceptionId(QmlJS::AST::ExpressionNode *n)
+quint8 QDeclarativeBindingCompilerPrivate::exceptionId(QDeclarativeJS::AST::ExpressionNode *n)
{
quint8 rv = 0xFF;
if (n && exceptions.count() < 0xFF) {
rv = (quint8)exceptions.count();
- QmlJS::AST::SourceLocation l = n->firstSourceLocation();
+ QDeclarativeJS::AST::SourceLocation l = n->firstSourceLocation();
quint64 e = l.startLine;
e <<= 32;
e |= l.startColumn;
@@ -2612,12 +2612,12 @@ quint8 QmlBindingCompilerPrivate::exceptionId(QmlJS::AST::ExpressionNode *n)
return rv;
}
-QmlBindingCompiler::QmlBindingCompiler()
-: d(new QmlBindingCompilerPrivate)
+QDeclarativeBindingCompiler::QDeclarativeBindingCompiler()
+: d(new QDeclarativeBindingCompilerPrivate)
{
}
-QmlBindingCompiler::~QmlBindingCompiler()
+QDeclarativeBindingCompiler::~QDeclarativeBindingCompiler()
{
delete d; d = 0;
}
@@ -2625,7 +2625,7 @@ QmlBindingCompiler::~QmlBindingCompiler()
/*
Returns true if any bindings were compiled.
*/
-bool QmlBindingCompiler::isValid() const
+bool QDeclarativeBindingCompiler::isValid() const
{
return !d->committed.bytecode.isEmpty();
}
@@ -2633,7 +2633,7 @@ bool QmlBindingCompiler::isValid() const
/*
-1 on failure, otherwise the binding index to use.
*/
-int QmlBindingCompiler::compile(const Expression &expression, QmlEnginePrivate *engine)
+int QDeclarativeBindingCompiler::compile(const Expression &expression, QDeclarativeEnginePrivate *engine)
{
if (!expression.expression.asAST()) return false;
@@ -2652,7 +2652,7 @@ int QmlBindingCompiler::compile(const Expression &expression, QmlEnginePrivate *
}
-QByteArray QmlBindingCompilerPrivate::buildSignalTable() const
+QByteArray QDeclarativeBindingCompilerPrivate::buildSignalTable() const
{
QHash<int, QList<int> > table;
@@ -2676,7 +2676,7 @@ QByteArray QmlBindingCompilerPrivate::buildSignalTable() const
return QByteArray((const char *)header.constData(), header.count() * sizeof(quint32));
}
-QByteArray QmlBindingCompilerPrivate::buildExceptionData() const
+QByteArray QDeclarativeBindingCompilerPrivate::buildExceptionData() const
{
QByteArray rv;
rv.resize(committed.exceptions.count() * sizeof(quint64));
@@ -2687,7 +2687,7 @@ QByteArray QmlBindingCompilerPrivate::buildExceptionData() const
/*
Returns the compiled program.
*/
-QByteArray QmlBindingCompiler::program() const
+QByteArray QDeclarativeBindingCompiler::program() const
{
QByteArray programData;
diff --git a/src/declarative/qml/qmlcompiledbindings_p.h b/src/declarative/qml/qdeclarativecompiledbindings_p.h
index 38fb2a3..2e24371 100644
--- a/src/declarative/qml/qmlcompiledbindings_p.h
+++ b/src/declarative/qml/qdeclarativecompiledbindings_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLBINDINGOPTIMIZATIONS_P_H
-#define QMLBINDINGOPTIMIZATIONS_P_H
+#ifndef QDECLARATIVEBINDINGOPTIMIZATIONS_P_H
+#define QDECLARATIVEBINDINGOPTIMIZATIONS_P_H
//
// W A R N I N G
@@ -53,64 +53,64 @@
// We mean it.
//
-#include "qmlexpression_p.h"
-#include "qmlbinding.h"
+#include "qdeclarativeexpression_p.h"
+#include "qdeclarativebinding_p.h"
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QmlBindingCompilerPrivate;
-class QmlBindingCompiler
+class QDeclarativeBindingCompilerPrivate;
+class QDeclarativeBindingCompiler
{
public:
- QmlBindingCompiler();
- ~QmlBindingCompiler();
+ QDeclarativeBindingCompiler();
+ ~QDeclarativeBindingCompiler();
// Returns true if bindings were compiled
bool isValid() const;
struct Expression
{
- QmlParser::Object *component;
- QmlParser::Object *context;
- QmlParser::Property *property;
- QmlParser::Variant expression;
- QHash<QString, QmlParser::Object *> ids;
- QmlEnginePrivate::Imports imports;
+ QDeclarativeParser::Object *component;
+ QDeclarativeParser::Object *context;
+ QDeclarativeParser::Property *property;
+ QDeclarativeParser::Variant expression;
+ QHash<QString, QDeclarativeParser::Object *> ids;
+ QDeclarativeEnginePrivate::Imports imports;
};
// -1 on failure, otherwise the binding index to use
- int compile(const Expression &, QmlEnginePrivate *);
+ int compile(const Expression &, QDeclarativeEnginePrivate *);
// Returns the compiled program
QByteArray program() const;
static void dump(const QByteArray &);
private:
- QmlBindingCompilerPrivate *d;
+ QDeclarativeBindingCompilerPrivate *d;
};
-class QmlCompiledBindingsPrivate;
-class QmlCompiledBindings : public QObject, public QmlAbstractExpression, public QmlRefCount
+class QDeclarativeCompiledBindingsPrivate;
+class QDeclarativeCompiledBindings : public QObject, public QDeclarativeAbstractExpression, public QDeclarativeRefCount
{
public:
- QmlCompiledBindings(const char *program, QmlContext *context);
- virtual ~QmlCompiledBindings();
+ QDeclarativeCompiledBindings(const char *program, QDeclarativeContext *context);
+ virtual ~QDeclarativeCompiledBindings();
- QmlAbstractBinding *configBinding(int index, QObject *target, QObject *scope, int property);
+ QDeclarativeAbstractBinding *configBinding(int index, QObject *target, QObject *scope, int property);
protected:
int qt_metacall(QMetaObject::Call, int, void **);
private:
- Q_DISABLE_COPY(QmlCompiledBindings);
- Q_DECLARE_PRIVATE(QmlCompiledBindings);
+ Q_DISABLE_COPY(QDeclarativeCompiledBindings);
+ Q_DECLARE_PRIVATE(QDeclarativeCompiledBindings);
};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLBINDINGOPTIMIZATIONS_P_H
+#endif // QDECLARATIVEBINDINGOPTIMIZATIONS_P_H
diff --git a/src/declarative/qml/qmlcompileddata.cpp b/src/declarative/qml/qdeclarativecompileddata.cpp
index 0120f56..bdf16a3 100644
--- a/src/declarative/qml/qmlcompileddata.cpp
+++ b/src/declarative/qml/qdeclarativecompileddata.cpp
@@ -39,12 +39,12 @@
**
****************************************************************************/
-#include "qmlcompiler_p.h"
-#include "qmlengine.h"
-#include "qmlcomponent.h"
-#include "qmlcomponent_p.h"
-#include "qmlcontext.h"
-#include "qmlcontext_p.h"
+#include "qdeclarativecompiler_p.h"
+#include "qdeclarativeengine.h"
+#include "qdeclarativecomponent.h"
+#include "qdeclarativecomponent_p.h"
+#include "qdeclarativecontext.h"
+#include "qdeclarativecontext_p.h"
#include <QtCore/qdebug.h>
@@ -52,7 +52,7 @@
QT_BEGIN_NAMESPACE
-int QmlCompiledData::pack(const char *data, size_t size)
+int QDeclarativeCompiledData::pack(const char *data, size_t size)
{
const char *p = packData.constData();
unsigned int ps = packData.size();
@@ -67,7 +67,7 @@ int QmlCompiledData::pack(const char *data, size_t size)
return rv;
}
-int QmlCompiledData::indexForString(const QString &data)
+int QDeclarativeCompiledData::indexForString(const QString &data)
{
int idx = primitives.indexOf(data);
if (idx == -1) {
@@ -77,7 +77,7 @@ int QmlCompiledData::indexForString(const QString &data)
return idx;
}
-int QmlCompiledData::indexForByteArray(const QByteArray &data)
+int QDeclarativeCompiledData::indexForByteArray(const QByteArray &data)
{
int idx = datas.indexOf(data);
if (idx == -1) {
@@ -87,7 +87,7 @@ int QmlCompiledData::indexForByteArray(const QByteArray &data)
return idx;
}
-int QmlCompiledData::indexForUrl(const QUrl &data)
+int QDeclarativeCompiledData::indexForUrl(const QUrl &data)
{
int idx = urls.indexOf(data);
if (idx == -1) {
@@ -97,7 +97,7 @@ int QmlCompiledData::indexForUrl(const QUrl &data)
return idx;
}
-int QmlCompiledData::indexForFloat(float *data, int count)
+int QDeclarativeCompiledData::indexForFloat(float *data, int count)
{
Q_ASSERT(count > 0);
@@ -121,7 +121,7 @@ int QmlCompiledData::indexForFloat(float *data, int count)
return idx;
}
-int QmlCompiledData::indexForInt(int *data, int count)
+int QDeclarativeCompiledData::indexForInt(int *data, int count)
{
Q_ASSERT(count > 0);
@@ -145,7 +145,7 @@ int QmlCompiledData::indexForInt(int *data, int count)
return idx;
}
-int QmlCompiledData::indexForLocation(const QmlParser::Location &l)
+int QDeclarativeCompiledData::indexForLocation(const QDeclarativeParser::Location &l)
{
// ### FIXME
int rv = locations.count();
@@ -153,7 +153,7 @@ int QmlCompiledData::indexForLocation(const QmlParser::Location &l)
return rv;
}
-int QmlCompiledData::indexForLocation(const QmlParser::LocationSpan &l)
+int QDeclarativeCompiledData::indexForLocation(const QDeclarativeParser::LocationSpan &l)
{
// ### FIXME
int rv = locations.count();
@@ -161,12 +161,12 @@ int QmlCompiledData::indexForLocation(const QmlParser::LocationSpan &l)
return rv;
}
-QmlCompiledData::QmlCompiledData(QmlEngine *engine)
-: QmlCleanup(engine), importCache(0), root(0), rootPropertyCache(0)
+QDeclarativeCompiledData::QDeclarativeCompiledData(QDeclarativeEngine *engine)
+: QDeclarativeCleanup(engine), importCache(0), root(0), rootPropertyCache(0)
{
}
-QmlCompiledData::~QmlCompiledData()
+QDeclarativeCompiledData::~QDeclarativeCompiledData()
{
for (int ii = 0; ii < types.count(); ++ii) {
if (types.at(ii).ref)
@@ -189,7 +189,7 @@ QmlCompiledData::~QmlCompiledData()
qDeleteAll(cachedClosures);
}
-void QmlCompiledData::clear()
+void QDeclarativeCompiledData::clear()
{
qDeleteAll(cachedPrograms);
qDeleteAll(cachedClosures);
@@ -200,30 +200,30 @@ void QmlCompiledData::clear()
}
-QObject *QmlCompiledData::TypeReference::createInstance(QmlContext *ctxt, const QBitField &bindings) const
+QObject *QDeclarativeCompiledData::TypeReference::createInstance(QDeclarativeContext *ctxt, const QBitField &bindings) const
{
if (type) {
QObject *rv = type->create();
if (rv)
- QmlEngine::setContextForObject(rv, ctxt);
+ QDeclarativeEngine::setContextForObject(rv, ctxt);
return rv;
} else {
Q_ASSERT(component);
- return QmlComponentPrivate::get(component)->create(ctxt, bindings);
+ return QDeclarativeComponentPrivate::get(component)->create(ctxt, bindings);
}
}
-const QMetaObject *QmlCompiledData::TypeReference::metaObject() const
+const QMetaObject *QDeclarativeCompiledData::TypeReference::metaObject() const
{
if (type) {
return type->metaObject();
} else {
Q_ASSERT(component);
- return static_cast<QmlComponentPrivate *>(QObjectPrivate::get(component))->cc->root;
+ return static_cast<QDeclarativeComponentPrivate *>(QObjectPrivate::get(component))->cc->root;
}
}
-void QmlCompiledData::dumpInstructions()
+void QDeclarativeCompiledData::dumpInstructions()
{
if (!name.isEmpty())
qWarning() << name;
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index bbae201..5da207d 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -39,32 +39,32 @@
**
****************************************************************************/
-#include "qmlcompiler_p.h"
+#include "qdeclarativecompiler_p.h"
-#include "qmlcompositetypedata_p.h"
-#include "qmlparser_p.h"
-#include "qmlscriptparser_p.h"
-#include "qmlpropertyvaluesource.h"
-#include "qmlcomponent.h"
+#include "qdeclarativecompositetypedata_p.h"
+#include "qdeclarativeparser_p.h"
+#include "qdeclarativescriptparser_p.h"
+#include "qdeclarativepropertyvaluesource.h"
+#include "qdeclarativecomponent.h"
#include "qmetaobjectbuilder_p.h"
-#include "qmlstringconverters_p.h"
-#include "qmlengine_p.h"
-#include "qmlengine.h"
-#include "qmlcontext.h"
-#include "qmlmetatype.h"
-#include "qmlcustomparser_p_p.h"
-#include "qmlcontext_p.h"
-#include "qmlcomponent_p.h"
-#include "parser/qmljsast_p.h"
-#include "qmlvmemetaobject_p.h"
-#include "qmlexpression_p.h"
-#include "qmlmetaproperty_p.h"
-#include "qmlrewrite_p.h"
-#include "qmlscriptstring.h"
-#include "qmlglobal_p.h"
-#include "qmlscriptparser_p.h"
-#include "qmlbinding.h"
-#include "qmlcompiledbindings_p.h"
+#include "qdeclarativestringconverters_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativeengine.h"
+#include "qdeclarativecontext.h"
+#include "qdeclarativemetatype_p.h"
+#include "qdeclarativecustomparser_p_p.h"
+#include "qdeclarativecontext_p.h"
+#include "qdeclarativecomponent_p.h"
+#include "parser/qdeclarativejsast_p.h"
+#include "qdeclarativevmemetaobject_p.h"
+#include "qdeclarativeexpression_p.h"
+#include "qdeclarativeproperty_p.h"
+#include "qdeclarativerewrite_p.h"
+#include "qdeclarativescriptstring.h"
+#include "qdeclarativeglobal_p.h"
+#include "qdeclarativescriptparser_p.h"
+#include "qdeclarativebinding_p.h"
+#include "qdeclarativecompiledbindings_p.h"
#include <qfxperf_p_p.h>
@@ -83,12 +83,12 @@ DEFINE_BOOL_CONFIG_OPTION(compilerDump, QML_COMPILER_DUMP);
DEFINE_BOOL_CONFIG_OPTION(compilerStatDump, QML_COMPILER_STATISTICS_DUMP);
DEFINE_BOOL_CONFIG_OPTION(qmlExperimental, QML_EXPERIMENTAL);
-using namespace QmlParser;
+using namespace QDeclarativeParser;
/*!
- Instantiate a new QmlCompiler.
+ Instantiate a new QDeclarativeCompiler.
*/
-QmlCompiler::QmlCompiler()
+QDeclarativeCompiler::QDeclarativeCompiler()
: output(0), engine(0), unitRoot(0), unit(0)
{
}
@@ -98,7 +98,7 @@ QmlCompiler::QmlCompiler()
\sa errors()
*/
-bool QmlCompiler::isError() const
+bool QDeclarativeCompiler::isError() const
{
return !exceptions.isEmpty();
}
@@ -107,7 +107,7 @@ bool QmlCompiler::isError() const
Return the list of errors from the last call to compile(), or an empty list
if there were no errors.
*/
-QList<QmlError> QmlCompiler::errors() const
+QList<QDeclarativeError> QDeclarativeCompiler::errors() const
{
return exceptions;
}
@@ -118,15 +118,14 @@ QList<QmlError> QmlCompiler::errors() const
Legal ids must start with a lower-case letter or underscore, and contain only
letters, numbers and underscores.
*/
-bool QmlCompiler::isValidId(const QString &val)
+bool QDeclarativeCompiler::isValidId(const QString &val)
{
if (val.isEmpty())
return false;
- // TODO this will be enforced and return false
if (val.at(0).isLetter() && !val.at(0).isLower()) {
- //return false;
- qWarning().nospace() << "id '" << val << "' is invalid: ids cannot start with uppercase letters. This will be enforced in an upcoming version of QML.";
+ qWarning().nospace() << "id " << val << " is invalid: ids cannot start with uppercase letters";
+ return false;
}
QChar u(QLatin1Char('_'));
@@ -144,7 +143,7 @@ bool QmlCompiler::isValidId(const QString &val)
Attached property names are those that start with a capital letter.
*/
-bool QmlCompiler::isAttachedPropertyName(const QByteArray &name)
+bool QDeclarativeCompiler::isAttachedPropertyName(const QByteArray &name)
{
return !name.isEmpty() && name.at(0) >= 'A' && name.at(0) <= 'Z';
}
@@ -155,7 +154,7 @@ bool QmlCompiler::isAttachedPropertyName(const QByteArray &name)
Signal property names are those that start with "on", followed by a capital
letter.
*/
-bool QmlCompiler::isSignalPropertyName(const QByteArray &name)
+bool QDeclarativeCompiler::isSignalPropertyName(const QByteArray &name)
{
return name.length() >= 3 && name.startsWith("on") &&
'A' <= name.at(2) && 'Z' >= name.at(2);
@@ -164,7 +163,7 @@ bool QmlCompiler::isSignalPropertyName(const QByteArray &name)
/*!
\macro COMPILE_EXCEPTION
\internal
- Inserts an error into the QmlCompiler error list, and returns false
+ Inserts an error into the QDeclarativeCompiler error list, and returns false
(failure).
\a token is used to source the error line and column, and \a desc is the
@@ -173,13 +172,13 @@ bool QmlCompiler::isSignalPropertyName(const QByteArray &name)
For example:
\code
- COMPILE_EXCEPTION(property, QCoreApplication::translate("QmlCompiler","Error for property \"%1\"").arg(QString::fromUtf8(property->name)));
+ COMPILE_EXCEPTION(property, QCoreApplication::translate("QDeclarativeCompiler","Error for property \"%1\"").arg(QString::fromUtf8(property->name)));
\endcode
*/
#define COMPILE_EXCEPTION(token, desc) \
{ \
QString exceptionDescription; \
- QmlError error; \
+ QDeclarativeError error; \
error.setUrl(output->url); \
error.setLine((token)->location.start.line); \
error.setColumn((token)->location.start.column); \
@@ -205,13 +204,13 @@ bool QmlCompiler::isSignalPropertyName(const QByteArray &name)
This test corresponds to action taken by genLiteralAssignment(). Any change
made here, must have a corresponding action in genLiteralAssigment().
*/
-bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
- QmlParser::Value *v)
+bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop,
+ QDeclarativeParser::Value *v)
{
QString string = v->value.asScript();
if (!prop.isWritable())
- COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name())));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name())));
if (prop.isEnumType()) {
int value;
@@ -220,7 +219,7 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
} else
value = prop.enumerator().keyToValue(string.toUtf8().constData());
if (value == -1)
- COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: unknown enumeration"));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: unknown enumeration"));
return true;
}
int type = prop.userType();
@@ -228,110 +227,110 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
case -1:
break;
case QVariant::String:
- if (!v->value.isString()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: string expected"));
+ if (!v->value.isString()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: string expected"));
break;
case QVariant::Url:
- if (!v->value.isString()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: url expected"));
+ if (!v->value.isString()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: url expected"));
break;
case QVariant::UInt:
{
bool ok;
string.toUInt(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: unsigned int expected"));
+ if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: unsigned int expected"));
}
break;
case QVariant::Int:
{
bool ok;
string.toInt(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: int expected"));
+ if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: int expected"));
}
break;
case QMetaType::Float:
{
bool ok;
string.toFloat(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: float expected"));
+ if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: float expected"));
}
break;
case QVariant::Double:
{
bool ok;
string.toDouble(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: double expected"));
+ if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: double expected"));
}
break;
case QVariant::Color:
{
bool ok;
- QmlStringConverters::colorFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: color expected"));
+ QDeclarativeStringConverters::colorFromString(string, &ok);
+ if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: color expected"));
}
break;
case QVariant::Date:
{
bool ok;
- QmlStringConverters::dateFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: date expected"));
+ QDeclarativeStringConverters::dateFromString(string, &ok);
+ if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: date expected"));
}
break;
case QVariant::Time:
{
bool ok;
- QmlStringConverters::timeFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: time expected"));
+ QDeclarativeStringConverters::timeFromString(string, &ok);
+ if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: time expected"));
}
break;
case QVariant::DateTime:
{
bool ok;
- QmlStringConverters::dateTimeFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: datetime expected"));
+ QDeclarativeStringConverters::dateTimeFromString(string, &ok);
+ if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: datetime expected"));
}
break;
case QVariant::Point:
case QVariant::PointF:
{
bool ok;
- QPointF point = QmlStringConverters::pointFFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: point expected"));
+ QPointF point = QDeclarativeStringConverters::pointFFromString(string, &ok);
+ if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: point expected"));
}
break;
case QVariant::Size:
case QVariant::SizeF:
{
bool ok;
- QSizeF size = QmlStringConverters::sizeFFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: size expected"));
+ QSizeF size = QDeclarativeStringConverters::sizeFFromString(string, &ok);
+ if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: size expected"));
}
break;
case QVariant::Rect:
case QVariant::RectF:
{
bool ok;
- QRectF rect = QmlStringConverters::rectFFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: rect expected"));
+ QRectF rect = QDeclarativeStringConverters::rectFFromString(string, &ok);
+ if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: rect expected"));
}
break;
case QVariant::Bool:
{
- if (!v->value.isBoolean()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: boolean expected"));
+ if (!v->value.isBoolean()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: boolean expected"));
}
break;
case QVariant::Vector3D:
{
bool ok;
- QmlStringConverters::vector3DFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: 3D vector expected"));
+ QDeclarativeStringConverters::vector3DFromString(string, &ok);
+ if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: 3D vector expected"));
}
break;
default:
{
int t = prop.userType();
- QmlMetaType::StringConverter converter =
- QmlMetaType::customStringConverter(t);
+ QDeclarativeMetaType::StringConverter converter =
+ QDeclarativeMetaType::customStringConverter(t);
if (!converter)
- COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: unsupported type \"%1\"").arg(QString::fromLatin1(QVariant::typeToName(prop.type()))));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: unsupported type \"%1\"").arg(QString::fromLatin1(QVariant::typeToName(prop.type()))));
}
break;
}
@@ -344,12 +343,12 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
Any literal assignment that is approved in testLiteralAssignment() must have
a corresponding action in this method.
*/
-void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
- QmlParser::Value *v)
+void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop,
+ QDeclarativeParser::Value *v)
{
QString string = v->value.asScript();
- QmlInstruction instr;
+ QDeclarativeInstruction instr;
instr.line = v->location.start.line;
if (prop.isEnumType()) {
int value;
@@ -358,7 +357,7 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
} else
value = prop.enumerator().keyToValue(string.toUtf8().constData());
- instr.type = QmlInstruction::StoreInteger;
+ instr.type = QDeclarativeInstruction::StoreInteger;
instr.storeInteger.propertyIndex = prop.propertyIndex();
instr.storeInteger.value = value;
output->bytecode << instr;
@@ -369,21 +368,21 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
switch(type) {
case -1:
{
- instr.type = QmlInstruction::StoreVariant;
+ instr.type = QDeclarativeInstruction::StoreVariant;
instr.storeString.propertyIndex = prop.propertyIndex();
instr.storeString.value = output->indexForString(string);
}
break;
case QVariant::String:
{
- instr.type = QmlInstruction::StoreString;
+ instr.type = QDeclarativeInstruction::StoreString;
instr.storeString.propertyIndex = prop.propertyIndex();
instr.storeString.value = output->indexForString(string);
}
break;
case QVariant::Url:
{
- instr.type = QmlInstruction::StoreUrl;
+ instr.type = QDeclarativeInstruction::StoreUrl;
QUrl u = string.isEmpty() ? QUrl() : output->url.resolved(QUrl(string));
instr.storeUrl.propertyIndex = prop.propertyIndex();
instr.storeUrl.value = output->indexForUrl(u);
@@ -391,69 +390,69 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
break;
case QVariant::UInt:
{
- instr.type = QmlInstruction::StoreInteger;
+ instr.type = QDeclarativeInstruction::StoreInteger;
instr.storeInteger.propertyIndex = prop.propertyIndex();
instr.storeInteger.value = string.toUInt();
}
break;
case QVariant::Int:
{
- instr.type = QmlInstruction::StoreInteger;
+ instr.type = QDeclarativeInstruction::StoreInteger;
instr.storeInteger.propertyIndex = prop.propertyIndex();
instr.storeInteger.value = string.toInt();
}
break;
case QMetaType::Float:
{
- instr.type = QmlInstruction::StoreFloat;
+ instr.type = QDeclarativeInstruction::StoreFloat;
instr.storeFloat.propertyIndex = prop.propertyIndex();
instr.storeFloat.value = string.toFloat();
}
break;
case QVariant::Double:
{
- instr.type = QmlInstruction::StoreDouble;
+ instr.type = QDeclarativeInstruction::StoreDouble;
instr.storeDouble.propertyIndex = prop.propertyIndex();
instr.storeDouble.value = string.toDouble();
}
break;
case QVariant::Color:
{
- QColor c = QmlStringConverters::colorFromString(string);
- instr.type = QmlInstruction::StoreColor;
+ QColor c = QDeclarativeStringConverters::colorFromString(string);
+ instr.type = QDeclarativeInstruction::StoreColor;
instr.storeColor.propertyIndex = prop.propertyIndex();
instr.storeColor.value = c.rgba();
}
break;
case QVariant::Date:
{
- QDate d = QmlStringConverters::dateFromString(string);
- instr.type = QmlInstruction::StoreDate;
+ QDate d = QDeclarativeStringConverters::dateFromString(string);
+ instr.type = QDeclarativeInstruction::StoreDate;
instr.storeDate.propertyIndex = prop.propertyIndex();
instr.storeDate.value = d.toJulianDay();
}
break;
case QVariant::Time:
{
- QTime time = QmlStringConverters::timeFromString(string);
+ QTime time = QDeclarativeStringConverters::timeFromString(string);
int data[] = { time.hour(), time.minute(),
time.second(), time.msec() };
int index = output->indexForInt(data, 4);
- instr.type = QmlInstruction::StoreTime;
+ instr.type = QDeclarativeInstruction::StoreTime;
instr.storeTime.propertyIndex = prop.propertyIndex();
instr.storeTime.valueIndex = index;
}
break;
case QVariant::DateTime:
{
- QDateTime dateTime = QmlStringConverters::dateTimeFromString(string);
+ QDateTime dateTime = QDeclarativeStringConverters::dateTimeFromString(string);
int data[] = { dateTime.date().toJulianDay(),
dateTime.time().hour(),
dateTime.time().minute(),
dateTime.time().second(),
dateTime.time().msec() };
int index = output->indexForInt(data, 5);
- instr.type = QmlInstruction::StoreDateTime;
+ instr.type = QDeclarativeInstruction::StoreDateTime;
instr.storeDateTime.propertyIndex = prop.propertyIndex();
instr.storeDateTime.valueIndex = index;
}
@@ -463,13 +462,13 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
{
bool ok;
QPointF point =
- QmlStringConverters::pointFFromString(string, &ok);
+ QDeclarativeStringConverters::pointFFromString(string, &ok);
float data[] = { point.x(), point.y() };
int index = output->indexForFloat(data, 2);
if (type == QVariant::PointF)
- instr.type = QmlInstruction::StorePointF;
+ instr.type = QDeclarativeInstruction::StorePointF;
else
- instr.type = QmlInstruction::StorePoint;
+ instr.type = QDeclarativeInstruction::StorePoint;
instr.storeRealPair.propertyIndex = prop.propertyIndex();
instr.storeRealPair.valueIndex = index;
}
@@ -478,13 +477,13 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
case QVariant::SizeF:
{
bool ok;
- QSizeF size = QmlStringConverters::sizeFFromString(string, &ok);
+ QSizeF size = QDeclarativeStringConverters::sizeFFromString(string, &ok);
float data[] = { size.width(), size.height() };
int index = output->indexForFloat(data, 2);
if (type == QVariant::SizeF)
- instr.type = QmlInstruction::StoreSizeF;
+ instr.type = QDeclarativeInstruction::StoreSizeF;
else
- instr.type = QmlInstruction::StoreSize;
+ instr.type = QDeclarativeInstruction::StoreSize;
instr.storeRealPair.propertyIndex = prop.propertyIndex();
instr.storeRealPair.valueIndex = index;
}
@@ -493,14 +492,14 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
case QVariant::RectF:
{
bool ok;
- QRectF rect = QmlStringConverters::rectFFromString(string, &ok);
+ QRectF rect = QDeclarativeStringConverters::rectFFromString(string, &ok);
float data[] = { rect.x(), rect.y(),
rect.width(), rect.height() };
int index = output->indexForFloat(data, 4);
if (type == QVariant::RectF)
- instr.type = QmlInstruction::StoreRectF;
+ instr.type = QDeclarativeInstruction::StoreRectF;
else
- instr.type = QmlInstruction::StoreRect;
+ instr.type = QDeclarativeInstruction::StoreRect;
instr.storeRect.propertyIndex = prop.propertyIndex();
instr.storeRect.valueIndex = index;
}
@@ -508,7 +507,7 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
case QVariant::Bool:
{
bool b = v->value.asBoolean();
- instr.type = QmlInstruction::StoreBool;
+ instr.type = QDeclarativeInstruction::StoreBool;
instr.storeBool.propertyIndex = prop.propertyIndex();
instr.storeBool.value = b;
}
@@ -517,10 +516,10 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
{
bool ok;
QVector3D vector =
- QmlStringConverters::vector3DFromString(string, &ok);
+ QDeclarativeStringConverters::vector3DFromString(string, &ok);
float data[] = { vector.x(), vector.y(), vector.z() };
int index = output->indexForFloat(data, 3);
- instr.type = QmlInstruction::StoreVector3D;
+ instr.type = QDeclarativeInstruction::StoreVector3D;
instr.storeRealPair.propertyIndex = prop.propertyIndex();
instr.storeRealPair.valueIndex = index;
}
@@ -529,11 +528,11 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
{
int t = prop.userType();
int index = output->customTypeData.count();
- instr.type = QmlInstruction::AssignCustomType;
+ instr.type = QDeclarativeInstruction::AssignCustomType;
instr.assignCustomType.propertyIndex = prop.propertyIndex();
instr.assignCustomType.valueIndex = index;
- QmlCompiledData::CustomTypeData data;
+ QDeclarativeCompiledData::CustomTypeData data;
data.index = output->indexForString(string);
data.type = t;
output->customTypeData << data;
@@ -544,9 +543,9 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
}
/*!
- Resets data by clearing the lists that the QmlCompiler modifies.
+ Resets data by clearing the lists that the QDeclarativeCompiler modifies.
*/
-void QmlCompiler::reset(QmlCompiledData *data)
+void QDeclarativeCompiler::reset(QDeclarativeCompiledData *data)
{
data->types.clear();
data->primitives.clear();
@@ -558,8 +557,8 @@ void QmlCompiler::reset(QmlCompiledData *data)
}
/*!
- Compile \a unit, and store the output in \a out. \a engine is the QmlEngine
- with which the QmlCompiledData will be associated.
+ Compile \a unit, and store the output in \a out. \a engine is the QDeclarativeEngine
+ with which the QDeclarativeCompiledData will be associated.
Returns true on success, false on failure. On failure, the compile errors
are available from errors().
@@ -568,12 +567,12 @@ void QmlCompiler::reset(QmlCompiledData *data)
(eg. QML_COMPILER_DUMP=1) the compiled instructions will be dumped to stderr
on a successful compiler.
*/
-bool QmlCompiler::compile(QmlEngine *engine,
- QmlCompositeTypeData *unit,
- QmlCompiledData *out)
+bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine,
+ QDeclarativeCompositeTypeData *unit,
+ QDeclarativeCompiledData *out)
{
#ifdef Q_ENABLE_PERFORMANCE_LOG
- QmlPerfTimer<QmlPerf::Compilation> pc;
+ QDeclarativePerfTimer<QDeclarativePerf::Compilation> pc;
#endif
exceptions.clear();
@@ -584,21 +583,21 @@ bool QmlCompiler::compile(QmlEngine *engine,
// Compile types
for (int ii = 0; ii < unit->types.count(); ++ii) {
- QmlCompositeTypeData::TypeReference &tref = unit->types[ii];
- QmlCompiledData::TypeReference ref;
- QmlScriptParser::TypeReference *parserRef = unit->data.referencedTypes().at(ii);
+ QDeclarativeCompositeTypeData::TypeReference &tref = unit->types[ii];
+ QDeclarativeCompiledData::TypeReference ref;
+ QDeclarativeScriptParser::TypeReference *parserRef = unit->data.referencedTypes().at(ii);
if (tref.type)
ref.type = tref.type;
else if (tref.unit) {
ref.component = tref.unit->toComponent(engine);
if (ref.component->isError()) {
- QmlError error;
+ QDeclarativeError error;
error.setUrl(output->url);
error.setDescription(QLatin1String("Unable to create type ") +
parserRef->name);
if (!parserRef->refObjects.isEmpty()) {
- QmlParser::Object *parserObject = parserRef->refObjects.first();
+ QDeclarativeParser::Object *parserObject = parserRef->refObjects.first();
error.setLine(parserObject->location.start.line);
error.setColumn(parserObject->location.start.column);
}
@@ -642,15 +641,15 @@ bool QmlCompiler::compile(QmlEngine *engine,
return !isError();
}
-void QmlCompiler::compileTree(Object *tree)
+void QDeclarativeCompiler::compileTree(Object *tree)
{
compileState.root = tree;
if (!buildObject(tree, BindingContext()) || !completeComponentBuild())
return;
- QmlInstruction init;
- init.type = QmlInstruction::Init;
+ QDeclarativeInstruction init;
+ init.type = QDeclarativeInstruction::Init;
init.line = 0;
init.init.bindingsSize = compileState.bindings.count();
init.init.parserStatusSize = compileState.parserStatusCount;
@@ -663,9 +662,9 @@ void QmlCompiler::compileTree(Object *tree)
genObject(tree);
- QmlInstruction def;
+ QDeclarativeInstruction def;
init.line = 0;
- def.type = QmlInstruction::SetDefault;
+ def.type = QDeclarativeInstruction::SetDefault;
output->bytecode << def;
output->imports = unit->imports;
@@ -680,7 +679,7 @@ void QmlCompiler::compileTree(Object *tree)
output->root = &output->rootData;
}
if (!tree->metadata.isEmpty())
- QmlEnginePrivate::get(engine)->registerCompositeType(output);
+ QDeclarativeEnginePrivate::get(engine)->registerCompositeType(output);
}
static bool ValuePtrLessThan(const Value *t1, const Value *t2)
@@ -690,12 +689,12 @@ static bool ValuePtrLessThan(const Value *t1, const Value *t2)
t1->location.start.column < t2->location.start.column);
}
-bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
+bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt)
{
componentStat.objects++;
Q_ASSERT (obj->type != -1);
- const QmlCompiledData::TypeReference &tr =
+ const QDeclarativeCompiledData::TypeReference &tr =
output->types.at(obj->type);
obj->metatype = tr.metaObject();
@@ -706,7 +705,7 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
obj->className = tr.className;
// This object is a "Component" element
- if (tr.type && obj->metatype == &QmlComponent::staticMetaObject) {
+ if (tr.type && obj->metatype == &QDeclarativeComponent::staticMetaObject) {
COMPILE_CHECK(buildComponent(obj, ctxt));
return true;
}
@@ -722,8 +721,8 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
COMPILE_CHECK(mergeDynamicMetaProperties(obj));
COMPILE_CHECK(buildDynamicMeta(obj, IgnoreAliases));
- // Find the native type and check for the QmlParserStatus interface
- QmlType *type = toQmlType(obj);
+ // Find the native type and check for the QDeclarativeParserStatus interface
+ QDeclarativeType *type = toQmlType(obj);
Q_ASSERT(type);
obj->parserStatusCast = type->parserStatusCast();
if (obj->parserStatusCast != -1)
@@ -734,7 +733,7 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
// compiled by the type.
bool isCustomParser = output->types.at(obj->type).type &&
output->types.at(obj->type).type->customParser() != 0;
- QList<QmlCustomParserProperty> customProps;
+ QList<QDeclarativeCustomParserProperty> customProps;
// Fetch the list of deferred properties
QStringList deferredList = deferredProperties(obj);
@@ -755,7 +754,7 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
if (obj->defaultProperty) {
const QMetaObject *metaObject = obj->metaObject();
Q_ASSERT(metaObject);
- QMetaProperty p = QmlMetaType::defaultProperty(metaObject);
+ QMetaProperty p = QDeclarativeMetaType::defaultProperty(metaObject);
if (p.name()) {
Property *explicitProperty = obj->getProperty(p.name(), false);
if (explicitProperty && !explicitProperty->value) {
@@ -799,7 +798,7 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
COMPILE_CHECK(buildProperty(prop, obj, objCtxt));
canDefer = ids == compileState.ids.count();
} else {
- customProps << QmlCustomParserNodePrivate::fromProperty(prop);
+ customProps << QDeclarativeCustomParserNodePrivate::fromProperty(prop);
}
} else {
if (isSignalPropertyName(prop->name)) {
@@ -828,7 +827,7 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
COMPILE_CHECK(buildProperty(prop, obj, objCtxt));
canDefer = ids == compileState.ids.count();
} else {
- customProps << QmlCustomParserNodePrivate::fromProperty(prop);
+ customProps << QDeclarativeCustomParserNodePrivate::fromProperty(prop);
}
} else {
int ids = compileState.ids.count();
@@ -846,10 +845,10 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
// Compile custom parser parts
if (isCustomParser && !customProps.isEmpty()) {
- QmlCustomParser *cp = output->types.at(obj->type).type->customParser();
+ QDeclarativeCustomParser *cp = output->types.at(obj->type).type->customParser();
cp->clearErrors();
obj->custom = cp->compile(customProps);
- foreach (QmlError err, cp->errors()) {
+ foreach (QDeclarativeError err, cp->errors()) {
err.setUrl(output->url);
exceptions << err;
}
@@ -858,18 +857,18 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt)
return true;
}
-void QmlCompiler::genObject(QmlParser::Object *obj)
+void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj)
{
- const QmlCompiledData::TypeReference &tr =
+ const QDeclarativeCompiledData::TypeReference &tr =
output->types.at(obj->type);
- if (tr.type && obj->metatype == &QmlComponent::staticMetaObject) {
+ if (tr.type && obj->metatype == &QDeclarativeComponent::staticMetaObject) {
genComponent(obj);
return;
}
// Create the object
- QmlInstruction create;
- create.type = QmlInstruction::CreateObject;
+ QDeclarativeInstruction create;
+ create.type = QDeclarativeInstruction::CreateObject;
create.line = obj->location.start.line;
create.create.column = obj->location.start.column;
create.create.data = -1;
@@ -888,21 +887,21 @@ void QmlCompiler::genObject(QmlParser::Object *obj)
// Setup the synthesized meta object if necessary
if (!obj->metadata.isEmpty()) {
- QmlInstruction meta;
- meta.type = QmlInstruction::StoreMetaObject;
+ QDeclarativeInstruction meta;
+ meta.type = QDeclarativeInstruction::StoreMetaObject;
meta.line = 0;
meta.storeMeta.data = output->indexForByteArray(obj->metadata);
meta.storeMeta.aliasData = output->indexForByteArray(obj->synthdata);
meta.storeMeta.propertyCache = output->propertyCaches.count();
// ### Surely the creation of this property cache could be more efficient
- QmlPropertyCache *propertyCache = 0;
- if (tr.component && QmlComponentPrivate::get(tr.component)->cc->rootPropertyCache) {
- propertyCache = QmlComponentPrivate::get(tr.component)->cc->rootPropertyCache->copy();
+ QDeclarativePropertyCache *propertyCache = 0;
+ if (tr.component && QDeclarativeComponentPrivate::get(tr.component)->cc->rootPropertyCache) {
+ propertyCache = QDeclarativeComponentPrivate::get(tr.component)->cc->rootPropertyCache->copy();
} else {
- propertyCache = QmlPropertyCache::create(engine, obj->metaObject()->superClass());
+ propertyCache = QDeclarativePropertyCache::create(engine, obj->metaObject()->superClass());
}
- propertyCache->append(engine, obj->metaObject(), QmlPropertyCache::Data::NoFlags,
- QmlPropertyCache::Data::IsVMEFunction);
+ propertyCache->append(engine, obj->metaObject(), QDeclarativePropertyCache::Data::NoFlags,
+ QDeclarativePropertyCache::Data::IsVMEFunction);
if (obj == unitRoot) {
propertyCache->addref();
output->rootPropertyCache = propertyCache;
@@ -913,8 +912,8 @@ void QmlCompiler::genObject(QmlParser::Object *obj)
// Set the object id
if (!obj->id.isEmpty()) {
- QmlInstruction id;
- id.type = QmlInstruction::SetId;
+ QDeclarativeInstruction id;
+ id.type = QDeclarativeInstruction::SetId;
id.line = 0;
id.setId.value = output->indexForString(obj->id);
id.setId.index = obj->idIndex;
@@ -923,8 +922,8 @@ void QmlCompiler::genObject(QmlParser::Object *obj)
// Set any script blocks
for (int ii = 0; ii < obj->scripts.count(); ++ii) {
- QmlInstruction script;
- script.type = QmlInstruction::StoreScript;
+ QDeclarativeInstruction script;
+ script.type = QDeclarativeInstruction::StoreScript;
script.line = 0; // ###
int idx = output->scripts.count();
output->scripts << obj->scripts.at(ii);
@@ -934,8 +933,8 @@ void QmlCompiler::genObject(QmlParser::Object *obj)
// Begin the class
if (obj->parserStatusCast != -1) {
- QmlInstruction begin;
- begin.type = QmlInstruction::BeginObject;
+ QDeclarativeInstruction begin;
+ begin.type = QDeclarativeInstruction::BeginObject;
begin.begin.castValue = obj->parserStatusCast;
begin.line = obj->location.start.line;
output->bytecode << begin;
@@ -944,12 +943,12 @@ void QmlCompiler::genObject(QmlParser::Object *obj)
genObjectBody(obj);
}
-void QmlCompiler::genObjectBody(QmlParser::Object *obj)
+void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj)
{
typedef QPair<Property *, int> PropPair;
foreach(const PropPair &prop, obj->scriptStringProperties) {
- QmlInstruction ss;
- ss.type = QmlInstruction::StoreScriptString;
+ QDeclarativeInstruction ss;
+ ss.type = QDeclarativeInstruction::StoreScriptString;
ss.storeScriptString.propertyIndex = prop.first->index;
ss.storeScriptString.value =
output->indexForString(prop.first->values.at(0)->value.asScript());
@@ -966,15 +965,15 @@ void QmlCompiler::genObjectBody(QmlParser::Object *obj)
genValueProperty(prop, obj);
}
if (seenDefer) {
- QmlInstruction defer;
- defer.type = QmlInstruction::Defer;
+ QDeclarativeInstruction defer;
+ defer.type = QDeclarativeInstruction::Defer;
defer.line = 0;
defer.defer.deferCount = 0;
int deferIdx = output->bytecode.count();
output->bytecode << defer;
- QmlInstruction init;
- init.type = QmlInstruction::Init;
+ QDeclarativeInstruction init;
+ init.type = QDeclarativeInstruction::Init;
init.init.bindingsSize = compileState.bindings.count(); // XXX - bigger than necessary
init.init.parserStatusSize = compileState.parserStatusCount; // XXX - bigger than necessary
init.init.contextCache = -1;
@@ -993,14 +992,14 @@ void QmlCompiler::genObjectBody(QmlParser::Object *obj)
foreach(Property *prop, obj->signalProperties) {
- QmlParser::Value *v = prop->values.at(0);
+ QDeclarativeParser::Value *v = prop->values.at(0);
if (v->type == Value::SignalObject) {
genObject(v->object);
- QmlInstruction assign;
- assign.type = QmlInstruction::AssignSignalObject;
+ QDeclarativeInstruction assign;
+ assign.type = QDeclarativeInstruction::AssignSignalObject;
assign.line = v->location.start.line;
assign.assignSignalObject.signal =
output->indexForByteArray(prop->name);
@@ -1008,8 +1007,8 @@ void QmlCompiler::genObjectBody(QmlParser::Object *obj)
} else if (v->type == Value::SignalExpression) {
- QmlInstruction store;
- store.type = QmlInstruction::StoreSignal;
+ QDeclarativeInstruction store;
+ store.type = QDeclarativeInstruction::StoreSignal;
store.line = v->location.start.line;
store.storeSignal.signalIndex = prop->index;
store.storeSignal.value =
@@ -1021,38 +1020,38 @@ void QmlCompiler::genObjectBody(QmlParser::Object *obj)
}
foreach(Property *prop, obj->attachedProperties) {
- QmlInstruction fetch;
- fetch.type = QmlInstruction::FetchAttached;
+ QDeclarativeInstruction fetch;
+ fetch.type = QDeclarativeInstruction::FetchAttached;
fetch.line = prop->location.start.line;
fetch.fetchAttached.id = prop->index;
output->bytecode << fetch;
genObjectBody(prop->value);
- QmlInstruction pop;
- pop.type = QmlInstruction::PopFetchedObject;
+ QDeclarativeInstruction pop;
+ pop.type = QDeclarativeInstruction::PopFetchedObject;
pop.line = prop->location.start.line;
output->bytecode << pop;
}
foreach(Property *prop, obj->groupedProperties) {
- QmlInstruction fetch;
- fetch.type = QmlInstruction::FetchObject;
+ QDeclarativeInstruction fetch;
+ fetch.type = QDeclarativeInstruction::FetchObject;
fetch.fetch.property = prop->index;
fetch.line = prop->location.start.line;
output->bytecode << fetch;
genObjectBody(prop->value);
- QmlInstruction pop;
- pop.type = QmlInstruction::PopFetchedObject;
+ QDeclarativeInstruction pop;
+ pop.type = QDeclarativeInstruction::PopFetchedObject;
pop.line = prop->location.start.line;
output->bytecode << pop;
}
foreach(Property *prop, obj->valueTypeProperties) {
- QmlInstruction fetch;
- fetch.type = QmlInstruction::FetchValueType;
+ QDeclarativeInstruction fetch;
+ fetch.type = QDeclarativeInstruction::FetchValueType;
fetch.fetchValue.property = prop->index;
fetch.fetchValue.type = prop->type;
fetch.line = prop->location.start.line;
@@ -1063,8 +1062,8 @@ void QmlCompiler::genObjectBody(QmlParser::Object *obj)
genPropertyAssignment(vprop, prop->value, prop);
}
- QmlInstruction pop;
- pop.type = QmlInstruction::PopValueType;
+ QDeclarativeInstruction pop;
+ pop.type = QDeclarativeInstruction::PopValueType;
pop.fetchValue.property = prop->index;
pop.fetchValue.type = prop->type;
pop.line = prop->location.start.line;
@@ -1072,13 +1071,13 @@ void QmlCompiler::genObjectBody(QmlParser::Object *obj)
}
}
-void QmlCompiler::genComponent(QmlParser::Object *obj)
+void QDeclarativeCompiler::genComponent(QDeclarativeParser::Object *obj)
{
- QmlParser::Object *root = obj->defaultProperty->values.at(0)->object;
+ QDeclarativeParser::Object *root = obj->defaultProperty->values.at(0)->object;
Q_ASSERT(root);
- QmlInstruction create;
- create.type = QmlInstruction::CreateComponent;
+ QDeclarativeInstruction create;
+ create.type = QDeclarativeInstruction::CreateComponent;
create.line = root->location.start.line;
create.createComponent.column = root->location.start.column;
create.createComponent.endLine = root->location.end.line;
@@ -1088,8 +1087,8 @@ void QmlCompiler::genComponent(QmlParser::Object *obj)
ComponentCompileState oldCompileState = compileState;
compileState = componentState(root);
- QmlInstruction init;
- init.type = QmlInstruction::Init;
+ QDeclarativeInstruction init;
+ init.type = QDeclarativeInstruction::Init;
init.init.bindingsSize = compileState.bindings.count();
init.init.parserStatusSize = compileState.parserStatusCount;
init.init.contextCache = genContextCache();
@@ -1102,9 +1101,9 @@ void QmlCompiler::genComponent(QmlParser::Object *obj)
genObject(root);
- QmlInstruction def;
+ QDeclarativeInstruction def;
init.line = 0;
- def.type = QmlInstruction::SetDefault;
+ def.type = QDeclarativeInstruction::SetDefault;
output->bytecode << def;
output->bytecode[count - 1].createComponent.count =
@@ -1113,8 +1112,8 @@ void QmlCompiler::genComponent(QmlParser::Object *obj)
compileState = oldCompileState;
if (!obj->id.isEmpty()) {
- QmlInstruction id;
- id.type = QmlInstruction::SetId;
+ QDeclarativeInstruction id;
+ id.type = QDeclarativeInstruction::SetId;
id.line = 0;
id.setId.value = output->indexForString(obj->id);
id.setId.index = obj->idIndex;
@@ -1122,7 +1121,7 @@ void QmlCompiler::genComponent(QmlParser::Object *obj)
}
}
-bool QmlCompiler::buildComponent(QmlParser::Object *obj,
+bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj,
const BindingContext &ctxt)
{
// The special "Component" element can only have the id property and a
@@ -1132,22 +1131,22 @@ bool QmlCompiler::buildComponent(QmlParser::Object *obj,
Property *idProp = 0;
if (obj->properties.count() > 1 ||
(obj->properties.count() == 1 && obj->properties.begin().key() != "id"))
- COMPILE_EXCEPTION(*obj->properties.begin(), QCoreApplication::translate("QmlCompiler","Invalid component specification"));
+ COMPILE_EXCEPTION(*obj->properties.begin(), QCoreApplication::translate("QDeclarativeCompiler","Component elements may not contain properties other than id"));
if (!obj->scriptBlockObjects.isEmpty())
- COMPILE_EXCEPTION(obj->scriptBlockObjects.first(), QCoreApplication::translate("QmlCompiler","Invalid component specification"));
+ COMPILE_EXCEPTION(obj->scriptBlockObjects.first(), QCoreApplication::translate("QDeclarativeCompiler","Component elements may not contain script blocks"));
if (obj->properties.count())
idProp = *obj->properties.begin();
if (idProp && (idProp->value || idProp->values.count() > 1 || !isValidId(idProp->values.first()->primitive())))
- COMPILE_EXCEPTION(idProp, QCoreApplication::translate("QmlCompiler","Invalid component id specification"));
+ COMPILE_EXCEPTION(idProp, QCoreApplication::translate("QDeclarativeCompiler","Invalid component id specification"));
if (idProp) {
QString idVal = idProp->values.first()->primitive();
if (compileState.ids.contains(idVal))
- COMPILE_EXCEPTION(idProp, QCoreApplication::translate("QmlCompiler","id is not unique"));
+ COMPILE_EXCEPTION(idProp, QCoreApplication::translate("QDeclarativeCompiler","id is not unique"));
obj->id = idVal;
addId(idVal, obj);
@@ -1157,14 +1156,14 @@ bool QmlCompiler::buildComponent(QmlParser::Object *obj,
if (obj->defaultProperty &&
(obj->defaultProperty->value || obj->defaultProperty->values.count() > 1 ||
(obj->defaultProperty->values.count() == 1 && !obj->defaultProperty->values.first()->object)))
- COMPILE_EXCEPTION(obj, QCoreApplication::translate("QmlCompiler","Invalid component body specification"));
+ COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Invalid component body specification"));
Object *root = 0;
if (obj->defaultProperty && obj->defaultProperty->values.count())
root = obj->defaultProperty->values.first()->object;
if (!root)
- COMPILE_EXCEPTION(obj, QCoreApplication::translate("QmlCompiler","Cannot create empty component specification"));
+ COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Cannot create empty component specification"));
// Build the component tree
COMPILE_CHECK(buildComponentFromRoot(root, ctxt));
@@ -1172,7 +1171,7 @@ bool QmlCompiler::buildComponent(QmlParser::Object *obj,
return true;
}
-bool QmlCompiler::buildScript(QmlParser::Object *obj, QmlParser::Object *script)
+bool QDeclarativeCompiler::buildScript(QDeclarativeParser::Object *obj, QDeclarativeParser::Object *script)
{
Object::ScriptBlock scriptBlock;
@@ -1181,11 +1180,11 @@ bool QmlCompiler::buildScript(QmlParser::Object *obj, QmlParser::Object *script)
Property *source = *script->properties.begin();
if (script->defaultProperty)
- COMPILE_EXCEPTION(source, QCoreApplication::translate("QmlCompiler","Invalid Script block. Specify either the source property or inline script"));
+ COMPILE_EXCEPTION(source, QCoreApplication::translate("QDeclarativeCompiler","Invalid Script block. Specify either the source property or inline script"));
if (source->value || source->values.count() != 1 ||
source->values.at(0)->object || !source->values.at(0)->value.isStringList())
- COMPILE_EXCEPTION(source, QCoreApplication::translate("QmlCompiler","Invalid Script source value"));
+ COMPILE_EXCEPTION(source, QCoreApplication::translate("QDeclarativeCompiler","Invalid Script source value"));
QStringList sources = source->values.at(0)->value.asStringList();
@@ -1209,21 +1208,21 @@ bool QmlCompiler::buildScript(QmlParser::Object *obj, QmlParser::Object *script)
}
} else if (!script->properties.isEmpty()) {
- COMPILE_EXCEPTION(*script->properties.begin(), QCoreApplication::translate("QmlCompiler","Properties cannot be set on Script block"));
+ COMPILE_EXCEPTION(*script->properties.begin(), QCoreApplication::translate("QDeclarativeCompiler","Properties cannot be set on Script block"));
} else if (script->defaultProperty) {
QString scriptCode;
int lineNumber = 1;
QString sourceUrl = output->url.toString();
- QmlParser::Location currentLocation;
+ QDeclarativeParser::Location currentLocation;
for (int ii = 0; ii < script->defaultProperty->values.count(); ++ii) {
Value *v = script->defaultProperty->values.at(ii);
if (lineNumber == 1)
lineNumber = v->location.start.line;
if (v->object || !v->value.isString())
- COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid Script block"));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid Script block"));
if (ii == 0) {
currentLocation = v->location.start;
@@ -1256,7 +1255,7 @@ bool QmlCompiler::buildScript(QmlParser::Object *obj, QmlParser::Object *script)
return true;
}
-bool QmlCompiler::buildComponentFromRoot(QmlParser::Object *obj,
+bool QDeclarativeCompiler::buildComponentFromRoot(QDeclarativeParser::Object *obj,
const BindingContext &ctxt)
{
ComponentCompileState oldComponentCompileState = compileState;
@@ -1283,7 +1282,7 @@ bool QmlCompiler::buildComponentFromRoot(QmlParser::Object *obj,
// Build a sub-object. A sub-object is one that was not created directly by
// QML - such as a grouped property object, or an attached object. Sub-object's
// can't have an id, involve a custom parser, have attached properties etc.
-bool QmlCompiler::buildSubObject(Object *obj, const BindingContext &ctxt)
+bool QDeclarativeCompiler::buildSubObject(Object *obj, const BindingContext &ctxt)
{
Q_ASSERT(obj->metatype);
Q_ASSERT(!obj->defaultProperty);
@@ -1301,22 +1300,23 @@ bool QmlCompiler::buildSubObject(Object *obj, const BindingContext &ctxt)
return true;
}
-int QmlCompiler::componentTypeRef()
+int QDeclarativeCompiler::componentTypeRef()
{
- QmlType *t = QmlMetaType::qmlType("Qt/Component",4,6);
+ QDeclarativeType *t = QDeclarativeMetaType::qmlType("Qt/Component",4,6);
for (int ii = output->types.count() - 1; ii >= 0; --ii) {
if (output->types.at(ii).type == t)
return ii;
}
- QmlCompiledData::TypeReference ref;
+ QDeclarativeCompiledData::TypeReference ref;
ref.className = "Component";
ref.type = t;
output->types << ref;
return output->types.count() - 1;
}
-int QmlCompiler::findSignalByName(const QMetaObject *mo, const QByteArray &name)
+QMetaMethod QDeclarativeCompiler::findSignalByName(const QMetaObject *mo, const QByteArray &name)
{
+ Q_ASSERT(mo);
int methods = mo->methodCount();
for (int ii = methods - 1; ii >= 0; --ii) {
QMetaMethod method = mo->method(ii);
@@ -1325,12 +1325,25 @@ int QmlCompiler::findSignalByName(const QMetaObject *mo, const QByteArray &name)
methodName = methodName.left(idx);
if (methodName == name)
- return ii;
+ return method;
+ }
+
+ // If no signal is found, but the signal is of the form "onBlahChanged",
+ // return the notify signal for the property "Blah"
+ if (name.endsWith("Changed")) {
+ QByteArray propName = name.mid(0, name.length() - 7);
+ int propIdx = mo->indexOfProperty(propName.constData());
+ if (propIdx >= 0) {
+ QMetaProperty prop = mo->property(propIdx);
+ if (prop.hasNotifySignal())
+ return prop.notifySignal();
+ }
}
- return -1;
+
+ return QMetaMethod();
}
-bool QmlCompiler::buildSignal(QmlParser::Property *prop, QmlParser::Object *obj,
+bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj,
const BindingContext &ctxt)
{
Q_ASSERT(obj->metaObject());
@@ -1342,7 +1355,7 @@ bool QmlCompiler::buildSignal(QmlParser::Property *prop, QmlParser::Object *obj,
if(name[0] >= 'A' && name[0] <= 'Z')
name[0] = name[0] - 'A' + 'a';
- int sigIdx = findSignalByName(obj->metaObject(), name);
+ int sigIdx = findSignalByName(obj->metaObject(), name).methodIndex();
if (sigIdx == -1) {
@@ -1353,7 +1366,7 @@ bool QmlCompiler::buildSignal(QmlParser::Property *prop, QmlParser::Object *obj,
} else {
if (prop->value || prop->values.count() > 1)
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Incorrectly specified signal"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Incorrectly specified signal"));
prop->index = sigIdx;
obj->addSignalProperty(prop);
@@ -1366,7 +1379,7 @@ bool QmlCompiler::buildSignal(QmlParser::Property *prop, QmlParser::Object *obj,
QString script = prop->values.at(0)->value.asScript().trimmed();
if (script.isEmpty())
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Empty signal assignment"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Empty signal assignment"));
}
}
@@ -1377,8 +1390,8 @@ bool QmlCompiler::buildSignal(QmlParser::Property *prop, QmlParser::Object *obj,
/*!
Returns true if (value) property \a prop exists on obj, false otherwise.
*/
-bool QmlCompiler::doesPropertyExist(QmlParser::Property *prop,
- QmlParser::Object *obj)
+bool QDeclarativeCompiler::doesPropertyExist(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj)
{
if(isAttachedPropertyName(prop->name) || prop->name == "id")
return true;
@@ -1386,7 +1399,7 @@ bool QmlCompiler::doesPropertyExist(QmlParser::Property *prop,
const QMetaObject *mo = obj->metaObject();
if (mo) {
if (prop->isDefault) {
- QMetaProperty p = QmlMetaType::defaultProperty(mo);
+ QMetaProperty p = QDeclarativeMetaType::defaultProperty(mo);
return p.name() != 0;
} else {
int idx = mo->indexOfProperty(prop->name.constData());
@@ -1397,12 +1410,12 @@ bool QmlCompiler::doesPropertyExist(QmlParser::Property *prop,
return false;
}
-bool QmlCompiler::buildProperty(QmlParser::Property *prop,
- QmlParser::Object *obj,
+bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
const BindingContext &ctxt)
{
if (prop->isEmpty())
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Empty property assignment"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Empty property assignment"));
const QMetaObject *metaObject = obj->metaObject();
Q_ASSERT(metaObject);
@@ -1414,12 +1427,12 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
// Attached properties cannot be used on sub-objects. Sub-objects
// always exist in a binding sub-context, which is what we test
// for here.
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Attached properties cannot be used here"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Attached properties cannot be used here"));
}
- QmlType *type = 0;
- QmlEnginePrivate::ImportedNamespace *typeNamespace = 0;
- QmlEnginePrivate::get(engine)->resolveType(unit->imports, prop->name,
+ QDeclarativeType *type = 0;
+ QDeclarativeEnginePrivate::ImportedNamespace *typeNamespace = 0;
+ QDeclarativeEnginePrivate::get(engine)->resolveType(unit->imports, prop->name,
&type, 0, 0, 0, &typeNamespace);
if (typeNamespace) {
@@ -1429,11 +1442,11 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
ctxt));
return true;
} else if (!type || !type->attachedPropertiesType()) {
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existent attached object"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Non-existent attached object"));
}
if (!prop->value)
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid attached object assignment"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid attached object assignment"));
Q_ASSERT(type->attachedPropertiesFunction());
prop->index = type->index();
@@ -1443,7 +1456,7 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
QMetaProperty p;
if (prop->isDefault) {
- p = QmlMetaType::defaultProperty(metaObject);
+ p = QDeclarativeMetaType::defaultProperty(metaObject);
if (p.name()) {
prop->index = p.propertyIndex();
@@ -1486,20 +1499,20 @@ 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-existent default property"));
+ COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QDeclarativeCompiler","Cannot assign to non-existent default property"));
} else {
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name)));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","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)->isList(prop->type)) {
+ } else if (QDeclarativeEnginePrivate::get(engine)->isList(prop->type)) {
COMPILE_CHECK(buildListProperty(prop, obj, ctxt));
- } else if (prop->type == qMetaTypeId<QmlScriptString>()) {
+ } else if (prop->type == qMetaTypeId<QDeclarativeScriptString>()) {
COMPILE_CHECK(buildScriptStringProperty(prop, obj, ctxt));
@@ -1513,30 +1526,30 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
}
bool
-QmlCompiler::buildPropertyInNamespace(QmlEnginePrivate::ImportedNamespace *ns,
- QmlParser::Property *nsProp,
- QmlParser::Object *obj,
+QDeclarativeCompiler::buildPropertyInNamespace(QDeclarativeEnginePrivate::ImportedNamespace *ns,
+ QDeclarativeParser::Property *nsProp,
+ QDeclarativeParser::Object *obj,
const BindingContext &ctxt)
{
if (!nsProp->value)
- COMPILE_EXCEPTION(nsProp, QCoreApplication::translate("QmlCompiler","Invalid use of namespace"));
+ COMPILE_EXCEPTION(nsProp, QCoreApplication::translate("QDeclarativeCompiler","Invalid use of namespace"));
foreach (Property *prop, nsProp->value->properties) {
if (!isAttachedPropertyName(prop->name))
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Not an attached property name"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Not an attached property name"));
// Setup attached property data
- QmlType *type = 0;
- QmlEnginePrivate::get(engine)->resolveTypeInNamespace(ns, prop->name,
+ QDeclarativeType *type = 0;
+ QDeclarativeEnginePrivate::get(engine)->resolveTypeInNamespace(ns, prop->name,
&type, 0, 0, 0);
if (!type || !type->attachedPropertiesType())
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existent attached object"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Non-existent attached object"));
if (!prop->value)
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid attached object assignment"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid attached object assignment"));
Q_ASSERT(type->attachedPropertiesFunction());
prop->index = type->index();
@@ -1548,26 +1561,26 @@ QmlCompiler::buildPropertyInNamespace(QmlEnginePrivate::ImportedNamespace *ns,
return true;
}
-void QmlCompiler::genValueProperty(QmlParser::Property *prop,
- QmlParser::Object *obj)
+void QDeclarativeCompiler::genValueProperty(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj)
{
- if (QmlEnginePrivate::get(engine)->isList(prop->type)) {
+ if (QDeclarativeEnginePrivate::get(engine)->isList(prop->type)) {
genListProperty(prop, obj);
} else {
genPropertyAssignment(prop, obj);
}
}
-void QmlCompiler::genListProperty(QmlParser::Property *prop,
- QmlParser::Object *obj)
+void QDeclarativeCompiler::genListProperty(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj)
{
- int listType = QmlEnginePrivate::get(engine)->listType(prop->type);
+ int listType = QDeclarativeEnginePrivate::get(engine)->listType(prop->type);
- QmlInstruction fetch;
- fetch.type = QmlInstruction::FetchQList;
+ QDeclarativeInstruction fetch;
+ fetch.type = QDeclarativeInstruction::FetchQList;
fetch.line = prop->location.start.line;
fetch.fetchQmlList.property = prop->index;
- bool listTypeIsInterface = QmlMetaType::isInterface(listType);
+ bool listTypeIsInterface = QDeclarativeMetaType::isInterface(listType);
fetch.fetchQmlList.type = listType;
output->bytecode << fetch;
@@ -1578,13 +1591,13 @@ void QmlCompiler::genListProperty(QmlParser::Property *prop,
genObject(v->object);
if (listTypeIsInterface) {
- QmlInstruction assign;
- assign.type = QmlInstruction::AssignObjectList;
+ QDeclarativeInstruction assign;
+ assign.type = QDeclarativeInstruction::AssignObjectList;
assign.line = prop->location.start.line;
output->bytecode << assign;
} else {
- QmlInstruction store;
- store.type = QmlInstruction::StoreObjectQList;
+ QDeclarativeInstruction store;
+ store.type = QDeclarativeInstruction::StoreObjectQList;
store.line = prop->location.start.line;
output->bytecode << store;
}
@@ -1597,43 +1610,43 @@ void QmlCompiler::genListProperty(QmlParser::Property *prop,
}
- QmlInstruction pop;
- pop.type = QmlInstruction::PopQList;
+ QDeclarativeInstruction pop;
+ pop.type = QDeclarativeInstruction::PopQList;
pop.line = prop->location.start.line;
output->bytecode << pop;
}
-void QmlCompiler::genPropertyAssignment(QmlParser::Property *prop,
- QmlParser::Object *obj,
- QmlParser::Property *valueTypeProperty)
+void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ QDeclarativeParser::Property *valueTypeProperty)
{
for (int ii = 0; ii < prop->values.count(); ++ii) {
- QmlParser::Value *v = prop->values.at(ii);
+ QDeclarativeParser::Value *v = prop->values.at(ii);
if (v->type == Value::CreatedObject) {
genObject(v->object);
- if (QmlMetaType::isInterface(prop->type)) {
+ if (QDeclarativeMetaType::isInterface(prop->type)) {
- QmlInstruction store;
- store.type = QmlInstruction::StoreInterface;
+ QDeclarativeInstruction store;
+ store.type = QDeclarativeInstruction::StoreInterface;
store.line = v->object->location.start.line;
store.storeObject.propertyIndex = prop->index;
output->bytecode << store;
} else if (prop->type == -1) {
- QmlInstruction store;
- store.type = QmlInstruction::StoreVariantObject;
+ QDeclarativeInstruction store;
+ store.type = QDeclarativeInstruction::StoreVariantObject;
store.line = v->object->location.start.line;
store.storeObject.propertyIndex = prop->index;
output->bytecode << store;
} else {
- QmlInstruction store;
- store.type = QmlInstruction::StoreObject;
+ QDeclarativeInstruction store;
+ store.type = QDeclarativeInstruction::StoreObject;
store.line = v->object->location.start.line;
store.storeObject.propertyIndex = prop->index;
output->bytecode << store;
@@ -1642,8 +1655,8 @@ void QmlCompiler::genPropertyAssignment(QmlParser::Property *prop,
} else if (v->type == Value::ValueSource) {
genObject(v->object);
- QmlInstruction store;
- store.type = QmlInstruction::StoreValueSource;
+ QDeclarativeInstruction store;
+ store.type = QDeclarativeInstruction::StoreValueSource;
store.line = v->object->location.start.line;
if (valueTypeProperty) {
store.assignValueSource.property = genValueTypeData(prop, valueTypeProperty);
@@ -1652,15 +1665,15 @@ void QmlCompiler::genPropertyAssignment(QmlParser::Property *prop,
store.assignValueSource.property = genPropertyData(prop);
store.assignValueSource.owner = 0;
}
- QmlType *valueType = toQmlType(v->object);
+ QDeclarativeType *valueType = toQmlType(v->object);
store.assignValueSource.castValue = valueType->propertyValueSourceCast();
output->bytecode << store;
} else if (v->type == Value::ValueInterceptor) {
genObject(v->object);
- QmlInstruction store;
- store.type = QmlInstruction::StoreValueInterceptor;
+ QDeclarativeInstruction store;
+ store.type = QDeclarativeInstruction::StoreValueInterceptor;
store.line = v->object->location.start.line;
if (valueTypeProperty) {
store.assignValueInterceptor.property = genValueTypeData(prop, valueTypeProperty);
@@ -1669,7 +1682,7 @@ void QmlCompiler::genPropertyAssignment(QmlParser::Property *prop,
store.assignValueInterceptor.property = genPropertyData(prop);
store.assignValueInterceptor.owner = 0;
}
- QmlType *valueType = toQmlType(v->object);
+ QDeclarativeType *valueType = toQmlType(v->object);
store.assignValueInterceptor.castValue = valueType->propertyValueInterceptorCast();
output->bytecode << store;
@@ -1687,32 +1700,32 @@ void QmlCompiler::genPropertyAssignment(QmlParser::Property *prop,
}
}
-bool QmlCompiler::buildIdProperty(QmlParser::Property *prop,
- QmlParser::Object *obj)
+bool QDeclarativeCompiler::buildIdProperty(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj)
{
if (prop->value ||
prop->values.count() > 1 ||
prop->values.at(0)->object)
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid use of id property"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid use of id property"));
- QmlParser::Value *idValue = prop->values.at(0);
+ QDeclarativeParser::Value *idValue = prop->values.at(0);
QString val = idValue->primitive();
if (!isValidId(val))
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","\"%1\" is not a valid object id").arg(val));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","\"%1\" is not a valid object id").arg(val));
// We disallow id's that conflict with import prefixes and types
- QmlEnginePrivate::ImportedNamespace *ns = 0;
- QmlType *type = 0;
- QmlEnginePrivate::get(engine)->resolveType(unit->imports, val.toUtf8(),
+ QDeclarativeEnginePrivate::ImportedNamespace *ns = 0;
+ QDeclarativeType *type = 0;
+ QDeclarativeEnginePrivate::get(engine)->resolveType(unit->imports, val.toUtf8(),
&type, 0, 0, 0, &ns);
if (type)
- COMPILE_EXCEPTION(idValue, QCoreApplication::translate("QmlCompiler","id conflicts with type name"));
+ COMPILE_EXCEPTION(idValue, QCoreApplication::translate("QDeclarativeCompiler","id conflicts with type name"));
if (ns)
- COMPILE_EXCEPTION(idValue, QCoreApplication::translate("QmlCompiler","id conflicts with namespace prefix"));
+ COMPILE_EXCEPTION(idValue, QCoreApplication::translate("QDeclarativeCompiler","id conflicts with namespace prefix"));
if (compileState.ids.contains(val))
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","id is not unique"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","id is not unique"));
prop->values.at(0)->type = Value::Id;
@@ -1722,7 +1735,7 @@ bool QmlCompiler::buildIdProperty(QmlParser::Property *prop,
return true;
}
-void QmlCompiler::addId(const QString &id, QmlParser::Object *obj)
+void QDeclarativeCompiler::addId(const QString &id, QDeclarativeParser::Object *obj)
{
Q_ASSERT(!compileState.ids.contains(id));
Q_ASSERT(obj->id == id);
@@ -1731,13 +1744,13 @@ void QmlCompiler::addId(const QString &id, QmlParser::Object *obj)
compileState.idIndexes.insert(obj->idIndex, obj);
}
-void QmlCompiler::addBindingReference(const BindingReference &ref)
+void QDeclarativeCompiler::addBindingReference(const BindingReference &ref)
{
Q_ASSERT(ref.value && !compileState.bindings.contains(ref.value));
compileState.bindings.insert(ref.value, ref);
}
-void QmlCompiler::saveComponentState()
+void QDeclarativeCompiler::saveComponentState()
{
Q_ASSERT(compileState.root);
Q_ASSERT(!savedCompileStates.contains(compileState.root));
@@ -1746,8 +1759,8 @@ void QmlCompiler::saveComponentState()
savedComponentStats.append(componentStat);
}
-QmlCompiler::ComponentCompileState
-QmlCompiler::componentState(QmlParser::Object *obj)
+QDeclarativeCompiler::ComponentCompileState
+QDeclarativeCompiler::componentState(QDeclarativeParser::Object *obj)
{
Q_ASSERT(savedCompileStates.contains(obj));
return savedCompileStates.value(obj);
@@ -1758,8 +1771,8 @@ QmlCompiler::componentState(QmlParser::Object *obj)
// GridView.row: 10
// }
// GridView is an attached property object.
-bool QmlCompiler::buildAttachedProperty(QmlParser::Property *prop,
- QmlParser::Object *obj,
+bool QDeclarativeCompiler::buildAttachedProperty(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
const BindingContext &ctxt)
{
Q_ASSERT(prop->value);
@@ -1779,33 +1792,33 @@ bool QmlCompiler::buildAttachedProperty(QmlParser::Property *prop,
// font.family: "Helvetica"
// }
// font is a nested property. pointSize and family are not.
-bool QmlCompiler::buildGroupedProperty(QmlParser::Property *prop,
- QmlParser::Object *obj,
+bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
const BindingContext &ctxt)
{
Q_ASSERT(prop->type != 0);
Q_ASSERT(prop->index != -1);
if (prop->values.count())
- COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QmlCompiler", "Invalid value in grouped property"));
+ COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QDeclarativeCompiler", "Invalid value in grouped property"));
if (prop->type < (int)QVariant::UserType) {
- QmlEnginePrivate *ep =
- static_cast<QmlEnginePrivate *>(QObjectPrivate::get(engine));
+ QDeclarativeEnginePrivate *ep =
+ static_cast<QDeclarativeEnginePrivate *>(QObjectPrivate::get(engine));
if (prop->type >= 0 /* QVariant == -1 */ && ep->valueTypes[prop->type]) {
COMPILE_CHECK(buildValueTypeProperty(ep->valueTypes[prop->type],
prop->value, obj, ctxt.incr()));
obj->addValueTypeProperty(prop);
} else {
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid grouped property access"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid grouped property access"));
}
} else {
// Load the nested property's meta type
prop->value->metatype =
- QmlEnginePrivate::get(engine)->metaObjectForType(prop->type);
+ QDeclarativeEnginePrivate::get(engine)->metaObjectForType(prop->type);
if (!prop->value->metatype)
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid grouped property access"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid grouped property access"));
obj->addGroupedProperty(prop);
@@ -1815,28 +1828,28 @@ bool QmlCompiler::buildGroupedProperty(QmlParser::Property *prop,
return true;
}
-bool QmlCompiler::buildValueTypeProperty(QObject *type,
- QmlParser::Object *obj,
- QmlParser::Object *baseObj,
+bool QDeclarativeCompiler::buildValueTypeProperty(QObject *type,
+ QDeclarativeParser::Object *obj,
+ QDeclarativeParser::Object *baseObj,
const BindingContext &ctxt)
{
if (obj->defaultProperty)
- COMPILE_EXCEPTION(obj, QCoreApplication::translate("QmlCompiler","Invalid property use"));
+ COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Invalid property use"));
obj->metatype = type->metaObject();
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-existent property \"%1\"").arg(QString::fromUtf8(prop->name)));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","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();
if (prop->value)
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Property assignment expected"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Property assignment expected"));
if (prop->values.count() != 1)
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Single property assignment expected"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Single property assignment expected"));
Value *value = prop->values.at(0);
@@ -1844,7 +1857,7 @@ bool QmlCompiler::buildValueTypeProperty(QObject *type,
bool isPropertyValue = output->types.at(value->object->type).type->propertyValueSourceCast() != -1;
bool isPropertyInterceptor = output->types.at(value->object->type).type->propertyValueInterceptorCast() != -1;
if (!isPropertyValue && !isPropertyInterceptor) {
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Unexpected object assignment"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Unexpected object assignment"));
} else {
COMPILE_CHECK(buildObject(value->object, ctxt));
@@ -1873,22 +1886,22 @@ bool QmlCompiler::buildValueTypeProperty(QObject *type,
}
// Build assignments to QML lists. QML lists are properties of type
-// QList<T *> * and QmlList<T *> *.
+// QList<T *> * and QDeclarativeList<T *> *.
//
// QList<T *> * types can accept a list of objects, or a single binding
-// QmlList<T *> * types can accept a list of objects
-bool QmlCompiler::buildListProperty(QmlParser::Property *prop,
- QmlParser::Object *obj,
+// QDeclarativeList<T *> * types can accept a list of objects
+bool QDeclarativeCompiler::buildListProperty(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
const BindingContext &ctxt)
{
- Q_ASSERT(QmlEnginePrivate::get(engine)->isList(prop->type));
+ Q_ASSERT(QDeclarativeEnginePrivate::get(engine)->isList(prop->type));
int t = prop->type;
obj->addValueProperty(prop);
- int listType = QmlEnginePrivate::get(engine)->listType(t);
- bool listTypeIsInterface = QmlMetaType::isInterface(listType);
+ int listType = QDeclarativeEnginePrivate::get(engine)->listType(t);
+ bool listTypeIsInterface = QDeclarativeMetaType::isInterface(listType);
bool assignedBinding = false;
for (int ii = 0; ii < prop->values.count(); ++ii) {
@@ -1901,35 +1914,35 @@ bool QmlCompiler::buildListProperty(QmlParser::Property *prop,
// at runtime.
if (!listTypeIsInterface) {
if (!canCoerce(listType, v->object)) {
- COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Cannot assign object to list"));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","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"));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","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"));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Cannot assign primitives to lists"));
}
}
return true;
}
-// Compiles an assignment to a QmlScriptString property
-bool QmlCompiler::buildScriptStringProperty(QmlParser::Property *prop,
- QmlParser::Object *obj,
+// Compiles an assignment to a QDeclarativeScriptString property
+bool QDeclarativeCompiler::buildScriptStringProperty(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
const BindingContext &ctxt)
{
if (prop->values.count() > 1)
- COMPILE_EXCEPTION(prop->values.at(1), QCoreApplication::translate("QmlCompiler", "Cannot assign multiple values to a script property"));
+ COMPILE_EXCEPTION(prop->values.at(1), QCoreApplication::translate("QDeclarativeCompiler", "Cannot assign multiple values to a script property"));
if (prop->values.at(0)->object || !prop->values.at(0)->value.isScript())
- COMPILE_EXCEPTION(prop->values.at(0), QCoreApplication::translate("QmlCompiler", "Invalid property assignment: script expected"));
+ COMPILE_EXCEPTION(prop->values.at(0), QCoreApplication::translate("QDeclarativeCompiler", "Invalid property assignment: script expected"));
obj->addScriptStringProperty(prop, ctxt.stack);
@@ -1951,8 +1964,8 @@ bool QmlCompiler::buildScriptStringProperty(QmlParser::Property *prop,
// }
//
// We allow assignming multiple values to single value properties
-bool QmlCompiler::buildPropertyAssignment(QmlParser::Property *prop,
- QmlParser::Object *obj,
+bool QDeclarativeCompiler::buildPropertyAssignment(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
const BindingContext &ctxt)
{
obj->addValueProperty(prop);
@@ -1974,18 +1987,18 @@ bool QmlCompiler::buildPropertyAssignment(QmlParser::Property *prop,
}
// Compile assigning a single object instance to a regular property
-bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop,
- QmlParser::Object *obj,
- QmlParser::Value *v,
+bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ QDeclarativeParser::Value *v,
const BindingContext &ctxt)
{
Q_ASSERT(prop->index != -1);
Q_ASSERT(v->object->type != -1);
if (!obj->metaObject()->property(prop->index).isWritable())
- COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name)));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name)));
- if (QmlMetaType::isInterface(prop->type)) {
+ if (QDeclarativeMetaType::isInterface(prop->type)) {
// Assigning an object to an interface ptr property
COMPILE_CHECK(buildObject(v->object, ctxt));
@@ -2006,11 +2019,11 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop,
v->object->metatype = output->types.at(v->object->type).metaObject();
Q_ASSERT(v->object->metaObject());
- // Will be true if the assigned type inherits QmlPropertyValueSource
+ // Will be true if the assigned type inherits QDeclarativePropertyValueSource
bool isPropertyValue = false;
- // Will be true if the assigned type inherits QmlPropertyValueInterceptor
+ // Will be true if the assigned type inherits QDeclarativePropertyValueInterceptor
bool isPropertyInterceptor = false;
- if (QmlType *valueType = toQmlType(v->object)) {
+ if (QDeclarativeType *valueType = toQmlType(v->object)) {
isPropertyValue = valueType->propertyValueSourceCast() != -1;
isPropertyInterceptor = valueType->propertyValueInterceptorCast() != -1;
}
@@ -2019,7 +2032,7 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop,
// actual property type before we applied any extensions that might
// effect the properties on the type, but don't effect assignability
const QMetaObject *propertyMetaObject =
- QmlEnginePrivate::get(engine)->rawMetaObjectForType(prop->type);
+ QDeclarativeEnginePrivate::get(engine)->rawMetaObjectForType(prop->type);
// Will be true if the assgned type inherits propertyMetaObject
bool isAssignable = false;
@@ -2027,7 +2040,7 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop,
if (propertyMetaObject) {
const QMetaObject *c = v->object->metatype;
while(c) {
- isAssignable |= (QmlMetaPropertyPrivate::equal(c, propertyMetaObject));
+ isAssignable |= (QDeclarativePropertyPrivate::equal(c, propertyMetaObject));
c = c->superClass();
}
}
@@ -2037,15 +2050,15 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop,
COMPILE_CHECK(buildObject(v->object, ctxt));
v->type = Value::CreatedObject;
- } else if (propertyMetaObject == &QmlComponent::staticMetaObject) {
+ } else if (propertyMetaObject == &QDeclarativeComponent::staticMetaObject) {
// Automatic "Component" insertion
- QmlParser::Object *root = v->object;
- QmlParser::Object *component = new QmlParser::Object;
+ QDeclarativeParser::Object *root = v->object;
+ QDeclarativeParser::Object *component = new QDeclarativeParser::Object;
component->type = componentTypeRef();
component->typeName = "Qt/Component";
- component->metatype = &QmlComponent::staticMetaObject;
+ component->metatype = &QDeclarativeComponent::staticMetaObject;
component->location = root->location;
- QmlParser::Value *componentValue = new QmlParser::Value;
+ QDeclarativeParser::Value *componentValue = new QDeclarativeParser::Value;
componentValue->object = root;
component->getDefaultProperty()->addValue(componentValue);
v->object = component;
@@ -2058,7 +2071,7 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop,
buildDynamicMeta(prop->parent, ForceCreation);
v->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor;
} else {
- COMPILE_EXCEPTION(v->object, QCoreApplication::translate("QmlCompiler","Cannot assign object to property"));
+ COMPILE_EXCEPTION(v->object, QCoreApplication::translate("QDeclarativeCompiler","Cannot assign object to property"));
}
}
@@ -2066,9 +2079,9 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop,
}
// Compile assigning a literal or binding to a regular property
-bool QmlCompiler::buildPropertyLiteralAssignment(QmlParser::Property *prop,
- QmlParser::Object *obj,
- QmlParser::Value *v,
+bool QDeclarativeCompiler::buildPropertyLiteralAssignment(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ QDeclarativeParser::Value *v,
const BindingContext &ctxt)
{
Q_ASSERT(prop->index != -1);
@@ -2097,9 +2110,9 @@ bool QmlCompiler::buildPropertyLiteralAssignment(QmlParser::Property *prop,
return true;
}
-bool QmlCompiler::testQualifiedEnumAssignment(const QMetaProperty &prop,
- QmlParser::Object *obj,
- QmlParser::Value *v,
+bool QDeclarativeCompiler::testQualifiedEnumAssignment(const QMetaProperty &prop,
+ QDeclarativeParser::Object *obj,
+ QDeclarativeParser::Value *v,
bool *isAssignment)
{
*isAssignment = false;
@@ -2107,7 +2120,7 @@ bool QmlCompiler::testQualifiedEnumAssignment(const QMetaProperty &prop,
return true;
if (!prop.isWritable())
- COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name())));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name())));
QString string = v->value.asString();
if (!string.at(0).isUpper())
@@ -2118,8 +2131,8 @@ bool QmlCompiler::testQualifiedEnumAssignment(const QMetaProperty &prop,
return true;
QString typeName = parts.at(0);
- QmlType *type = 0;
- QmlEnginePrivate::get(engine)->resolveType(unit->imports, typeName.toUtf8(),
+ QDeclarativeType *type = 0;
+ QDeclarativeEnginePrivate::get(engine)->resolveType(unit->imports, typeName.toUtf8(),
&type, 0, 0, 0, 0);
if (!type || obj->typeName != type->qmlTypeName())
@@ -2135,14 +2148,14 @@ bool QmlCompiler::testQualifiedEnumAssignment(const QMetaProperty &prop,
return true;
v->type = Value::Literal;
- v->value = QmlParser::Variant(enumValue);
+ v->value = QDeclarativeParser::Variant(enumValue);
*isAssignment = true;
return true;
}
// Ensures that the dynamic meta specification on obj is valid
-bool QmlCompiler::checkDynamicMeta(QmlParser::Object *obj)
+bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj)
{
QSet<QByteArray> propNames;
QSet<QByteArray> methodNames;
@@ -2150,17 +2163,17 @@ bool QmlCompiler::checkDynamicMeta(QmlParser::Object *obj)
// Check properties
for (int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
- const QmlParser::Object::DynamicProperty &prop =
+ const QDeclarativeParser::Object::DynamicProperty &prop =
obj->dynamicProperties.at(ii);
if (prop.isDefaultProperty) {
if (seenDefaultProperty)
- COMPILE_EXCEPTION(&prop, QCoreApplication::translate("QmlCompiler","Duplicate default property"));
+ COMPILE_EXCEPTION(&prop, QCoreApplication::translate("QDeclarativeCompiler","Duplicate default property"));
seenDefaultProperty = true;
}
if (propNames.contains(prop.name))
- COMPILE_EXCEPTION(&prop, QCoreApplication::translate("QmlCompiler","Duplicate property name"));
+ COMPILE_EXCEPTION(&prop, QCoreApplication::translate("QDeclarativeCompiler","Duplicate property name"));
propNames.insert(prop.name);
}
@@ -2168,20 +2181,20 @@ bool QmlCompiler::checkDynamicMeta(QmlParser::Object *obj)
for (int ii = 0; ii < obj->dynamicSignals.count(); ++ii) {
QByteArray name = obj->dynamicSignals.at(ii).name;
if (methodNames.contains(name))
- COMPILE_EXCEPTION(obj, QCoreApplication::translate("QmlCompiler","Duplicate signal name"));
+ COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Duplicate signal name"));
methodNames.insert(name);
}
for (int ii = 0; ii < obj->dynamicSlots.count(); ++ii) {
QByteArray name = obj->dynamicSlots.at(ii).name;
if (methodNames.contains(name))
- COMPILE_EXCEPTION(obj, QCoreApplication::translate("QmlCompiler","Duplicate method name"));
+ COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Duplicate method name"));
methodNames.insert(name);
}
return true;
}
-bool QmlCompiler::mergeDynamicMetaProperties(QmlParser::Object *obj)
+bool QDeclarativeCompiler::mergeDynamicMetaProperties(QDeclarativeParser::Object *obj)
{
for (int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
const Object::DynamicProperty &p = obj->dynamicProperties.at(ii);
@@ -2196,7 +2209,7 @@ bool QmlCompiler::mergeDynamicMetaProperties(QmlParser::Object *obj)
property = obj->getProperty(p.name);
if (property->value)
- COMPILE_EXCEPTION(property, QCoreApplication::translate("QmlCompiler","Invalid property nesting"));
+ COMPILE_EXCEPTION(property, QCoreApplication::translate("QDeclarativeCompiler","Invalid property nesting"));
for (int ii = 0; ii < p.defaultValue->values.count(); ++ii) {
Value *v = p.defaultValue->values.at(ii);
@@ -2209,7 +2222,7 @@ bool QmlCompiler::mergeDynamicMetaProperties(QmlParser::Object *obj)
Q_GLOBAL_STATIC(QAtomicInt, classIndexCounter)
-bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
+bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, DynamicMetaMode mode)
{
Q_ASSERT(obj);
Q_ASSERT(obj->metatype);
@@ -2222,7 +2235,7 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
COMPILE_CHECK(checkDynamicMeta(obj));
- QByteArray dynamicData(sizeof(QmlVMEMetaData), (char)0);
+ QByteArray dynamicData(sizeof(QDeclarativeVMEMetaData), (char)0);
QByteArray newClassName = obj->metatype->className();
newClassName.append("_QML_");
@@ -2251,7 +2264,7 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
if (-1 != propIdx) {
QMetaProperty prop = obj->metaObject()->property(propIdx);
if (prop.isFinal())
- COMPILE_EXCEPTION(&p, QCoreApplication::translate("QmlCompiler","Cannot override FINAL property"));
+ COMPILE_EXCEPTION(&p, QCoreApplication::translate("QDeclarativeCompiler","Cannot override FINAL property"));
}
if (p.isDefaultProperty &&
@@ -2271,19 +2284,19 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
case Object::DynamicProperty::Custom:
{
QByteArray customTypeName;
- QmlType *qmltype = 0;
+ QDeclarativeType *qmltype = 0;
QUrl url;
- QmlEnginePrivate *priv = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(engine);
if (!priv->resolveType(unit->imports, p.customType, &qmltype,
&url, 0, 0, 0))
- COMPILE_EXCEPTION(&p, QCoreApplication::translate("QmlCompiler","Invalid property type"));
+ COMPILE_EXCEPTION(&p, QCoreApplication::translate("QDeclarativeCompiler","Invalid property type"));
if (!qmltype) {
- QmlCompositeTypeData *tdata = priv->typeManager.get(url);
+ QDeclarativeCompositeTypeData *tdata = priv->typeManager.get(url);
Q_ASSERT(tdata);
- Q_ASSERT(tdata->status == QmlCompositeTypeData::Complete);
+ Q_ASSERT(tdata->status == QDeclarativeCompositeTypeData::Complete);
- QmlCompiledData *data = tdata->toCompiledComponent(engine);
+ QDeclarativeCompiledData *data = tdata->toCompiledComponent(engine);
customTypeName = data->root->className();
} else {
customTypeName = qmltype->typeName();
@@ -2294,10 +2307,10 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
propertyType = QMetaType::QObjectStar;
} else {
readonly = true;
- type = "QmlListProperty<";
+ type = "QDeclarativeListProperty<";
type.append(customTypeName);
type.append(">");
- propertyType = qMetaTypeId<QmlListProperty<QObject> >();
+ propertyType = qMetaTypeId<QDeclarativeListProperty<QObject> >();
}
}
break;
@@ -2335,8 +2348,8 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
break;
}
- ((QmlVMEMetaData *)dynamicData.data())->propertyCount++;
- QmlVMEMetaData::PropertyData propertyData = { propertyType };
+ ((QDeclarativeVMEMetaData *)dynamicData.data())->propertyCount++;
+ QDeclarativeVMEMetaData::PropertyData propertyData = { propertyType };
dynamicData.append((char *)&propertyData, sizeof(propertyData));
builder.addSignal(p.name + "Changed()");
@@ -2351,7 +2364,7 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
const Object::DynamicProperty &p = obj->dynamicProperties.at(ii);
if (p.type == Object::DynamicProperty::Alias) {
- ((QmlVMEMetaData *)dynamicData.data())->aliasCount++;
+ ((QDeclarativeVMEMetaData *)dynamicData.data())->aliasCount++;
compileAlias(builder, dynamicData, obj, p);
}
}
@@ -2367,7 +2380,7 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
sig.append(')');
QMetaMethodBuilder b = builder.addSignal(sig);
b.setParameterNames(s.parameterNames);
- ((QmlVMEMetaData *)dynamicData.data())->signalCount++;
+ ((QDeclarativeVMEMetaData *)dynamicData.data())->signalCount++;
}
QStringList funcScripts;
@@ -2395,8 +2408,8 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
b.setReturnType("QVariant");
b.setParameterNames(s.parameterNames);
- ((QmlVMEMetaData *)dynamicData.data())->methodCount++;
- QmlVMEMetaData::MethodData methodData =
+ ((QDeclarativeVMEMetaData *)dynamicData.data())->methodCount++;
+ QDeclarativeVMEMetaData::MethodData methodData =
{ s.parameterNames.count(), 0, funcScript.length(), 0 };
dynamicData.append((char *)&methodData, sizeof(methodData));
@@ -2404,8 +2417,8 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
for (int ii = 0; ii < obj->dynamicSlots.count(); ++ii) {
const QString &funcScript = funcScripts.at(ii);
- QmlVMEMetaData::MethodData *data =
- ((QmlVMEMetaData *)dynamicData.data())->methodData() + ii;
+ QDeclarativeVMEMetaData::MethodData *data =
+ ((QDeclarativeVMEMetaData *)dynamicData.data())->methodData() + ii;
data->bodyOffset = dynamicData.size();
@@ -2424,16 +2437,16 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
return true;
}
-#include <qmljsparser_p.h>
+#include <qdeclarativejsparser_p.h>
-static QStringList astNodeToStringList(QmlJS::AST::Node *node)
+static QStringList astNodeToStringList(QDeclarativeJS::AST::Node *node)
{
- if (node->kind == QmlJS::AST::Node::Kind_IdentifierExpression) {
+ if (node->kind == QDeclarativeJS::AST::Node::Kind_IdentifierExpression) {
QString name =
- static_cast<QmlJS::AST::IdentifierExpression *>(node)->name->asString();
+ static_cast<QDeclarativeJS::AST::IdentifierExpression *>(node)->name->asString();
return QStringList() << name;
- } else if (node->kind == QmlJS::AST::Node::Kind_FieldMemberExpression) {
- QmlJS::AST::FieldMemberExpression *expr = static_cast<QmlJS::AST::FieldMemberExpression *>(node);
+ } else if (node->kind == QDeclarativeJS::AST::Node::Kind_FieldMemberExpression) {
+ QDeclarativeJS::AST::FieldMemberExpression *expr = static_cast<QDeclarativeJS::AST::FieldMemberExpression *>(node);
QStringList rv = astNodeToStringList(expr->base);
if (rv.isEmpty())
@@ -2444,30 +2457,30 @@ static QStringList astNodeToStringList(QmlJS::AST::Node *node)
return QStringList();
}
-bool QmlCompiler::compileAlias(QMetaObjectBuilder &builder,
+bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder,
QByteArray &data,
Object *obj,
const Object::DynamicProperty &prop)
{
if (!prop.defaultValue)
- COMPILE_EXCEPTION(obj, QCoreApplication::translate("QmlCompiler","No property alias location"));
+ COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","No property alias location"));
if (prop.defaultValue->values.count() != 1 ||
prop.defaultValue->values.at(0)->object ||
!prop.defaultValue->values.at(0)->value.isScript())
- COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QmlCompiler","Invalid alias location"));
+ COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QDeclarativeCompiler","Invalid alias location"));
- QmlJS::AST::Node *node = prop.defaultValue->values.at(0)->value.asAST();
+ QDeclarativeJS::AST::Node *node = prop.defaultValue->values.at(0)->value.asAST();
if (!node)
- COMPILE_EXCEPTION(obj, QCoreApplication::translate("QmlCompiler","No property alias location")); // ### Can this happen?
+ COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","No property alias location")); // ### Can this happen?
QStringList alias = astNodeToStringList(node);
if (alias.count() != 1 && alias.count() != 2)
- COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QmlCompiler","Invalid alias reference. An alias reference must be specified as <id> or <id>.<property>"));
+ COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QDeclarativeCompiler","Invalid alias reference. An alias reference must be specified as <id> or <id>.<property>"));
if (!compileState.ids.contains(alias.at(0)))
- COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QmlCompiler","Invalid alias reference. Unable to find id \"%1\"").arg(alias.at(0)));
+ COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QDeclarativeCompiler","Invalid alias reference. Unable to find id \"%1\"").arg(alias.at(0)));
Object *idObject = compileState.ids[alias.at(0)];
@@ -2480,7 +2493,7 @@ bool QmlCompiler::compileAlias(QMetaObjectBuilder &builder,
propIdx = idObject->metaObject()->indexOfProperty(alias.at(1).toUtf8().constData());
if (-1 == propIdx)
- COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QmlCompiler","Invalid alias location"));
+ COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QDeclarativeCompiler","Invalid alias location"));
QMetaProperty aliasProperty = idObject->metaObject()->property(propIdx);
writable = aliasProperty.isWritable();
@@ -2524,8 +2537,8 @@ bool QmlCompiler::compileAlias(QMetaObjectBuilder &builder,
return true;
}
-bool QmlCompiler::buildBinding(QmlParser::Value *value,
- QmlParser::Property *prop,
+bool QDeclarativeCompiler::buildBinding(QDeclarativeParser::Value *value,
+ QDeclarativeParser::Property *prop,
const BindingContext &ctxt)
{
Q_ASSERT(prop->index != -1);
@@ -2533,8 +2546,8 @@ bool QmlCompiler::buildBinding(QmlParser::Value *value,
Q_ASSERT(prop->parent->metaObject());
QMetaProperty mp = prop->parent->metaObject()->property(prop->index);
- if (!mp.isWritable() && !QmlMetaType::isList(prop->type))
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name)));
+ if (!mp.isWritable() && !QDeclarativeMetaType::isList(prop->type))
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name)));
BindingReference reference;
reference.expression = value->value;
@@ -2546,18 +2559,18 @@ bool QmlCompiler::buildBinding(QmlParser::Value *value,
return true;
}
-void QmlCompiler::genBindingAssignment(QmlParser::Value *binding,
- QmlParser::Property *prop,
- QmlParser::Object *obj,
- QmlParser::Property *valueTypeProperty)
+void QDeclarativeCompiler::genBindingAssignment(QDeclarativeParser::Value *binding,
+ QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ QDeclarativeParser::Property *valueTypeProperty)
{
Q_UNUSED(obj);
Q_ASSERT(compileState.bindings.contains(binding));
const BindingReference &ref = compileState.bindings.value(binding);
if (ref.dataType == BindingReference::Experimental) {
- QmlInstruction store;
- store.type = QmlInstruction::StoreCompiledBinding;
+ QDeclarativeInstruction store;
+ store.type = QDeclarativeInstruction::StoreCompiledBinding;
store.assignBinding.value = ref.compiledIndex;
store.assignBinding.context = ref.bindingContext.stack;
store.assignBinding.owner = ref.bindingContext.owner;
@@ -2572,8 +2585,8 @@ void QmlCompiler::genBindingAssignment(QmlParser::Value *binding,
return;
}
- QmlInstruction store;
- store.type = QmlInstruction::StoreBinding;
+ QDeclarativeInstruction store;
+ store.type = QDeclarativeInstruction::StoreBinding;
store.assignBinding.value = output->indexForByteArray(ref.compiledData);
store.assignBinding.context = ref.bindingContext.stack;
store.assignBinding.owner = ref.bindingContext.owner;
@@ -2590,14 +2603,14 @@ void QmlCompiler::genBindingAssignment(QmlParser::Value *binding,
output->bytecode << store;
}
-int QmlCompiler::genContextCache()
+int QDeclarativeCompiler::genContextCache()
{
if (compileState.ids.count() == 0)
return -1;
- QmlIntegerCache *cache = new QmlIntegerCache(engine);
+ QDeclarativeIntegerCache *cache = new QDeclarativeIntegerCache(engine);
- for (QHash<QString, QmlParser::Object *>::ConstIterator iter = compileState.ids.begin();
+ for (QHash<QString, QDeclarativeParser::Object *>::ConstIterator iter = compileState.ids.begin();
iter != compileState.ids.end();
++iter)
cache->add(iter.key(), (*iter)->idIndex);
@@ -2606,18 +2619,24 @@ int QmlCompiler::genContextCache()
return output->contextCaches.count() - 1;
}
-int QmlCompiler::genValueTypeData(QmlParser::Property *valueTypeProp,
- QmlParser::Property *prop)
+int QDeclarativeCompiler::genValueTypeData(QDeclarativeParser::Property *valueTypeProp,
+ QDeclarativeParser::Property *prop)
{
- return output->indexForByteArray(QmlMetaPropertyPrivate::saveValueType(prop->parent->metaObject(), prop->index, valueTypeProp->index, valueTypeProp->type));
+ QByteArray data =
+ QDeclarativePropertyPrivate::saveValueType(prop->parent->metaObject(), prop->index,
+ QDeclarativeEnginePrivate::get(engine)->valueTypes[prop->type]->metaObject(),
+ valueTypeProp->index);
+// valueTypeProp->index, valueTypeProp->type);
+
+ return output->indexForByteArray(data);
}
-int QmlCompiler::genPropertyData(QmlParser::Property *prop)
+int QDeclarativeCompiler::genPropertyData(QDeclarativeParser::Property *prop)
{
- return output->indexForByteArray(QmlMetaPropertyPrivate::saveProperty(prop->parent->metaObject(), prop->index));
+ return output->indexForByteArray(QDeclarativePropertyPrivate::saveProperty(prop->parent->metaObject(), prop->index));
}
-bool QmlCompiler::completeComponentBuild()
+bool QDeclarativeCompiler::completeComponentBuild()
{
componentStat.ids = compileState.ids.count();
@@ -2626,13 +2645,13 @@ bool QmlCompiler::completeComponentBuild()
COMPILE_CHECK(buildDynamicMeta(aliasObject, ResolveAliases));
}
- QmlBindingCompiler::Expression expr;
+ QDeclarativeBindingCompiler::Expression expr;
expr.component = compileState.root;
expr.ids = compileState.ids;
- QmlBindingCompiler bindingCompiler;
+ QDeclarativeBindingCompiler bindingCompiler;
- for (QHash<QmlParser::Value*,BindingReference>::Iterator iter = compileState.bindings.begin(); iter != compileState.bindings.end(); ++iter) {
+ for (QHash<QDeclarativeParser::Value*,BindingReference>::Iterator iter = compileState.bindings.begin(); iter != compileState.bindings.end(); ++iter) {
BindingReference &binding = *iter;
expr.context = binding.bindingContext.object;
@@ -2641,7 +2660,7 @@ bool QmlCompiler::completeComponentBuild()
expr.imports = unit->imports;
if (qmlExperimental()) {
- int index = bindingCompiler.compile(expr, QmlEnginePrivate::get(engine));
+ int index = bindingCompiler.compile(expr, QDeclarativeEnginePrivate::get(engine));
if (index != -1) {
qWarning() << "Accepted for optimization:" << qPrintable(expr.expression.asScript());
binding.dataType = BindingReference::Experimental;
@@ -2659,10 +2678,10 @@ bool QmlCompiler::completeComponentBuild()
QString expression = binding.expression.asScript();
// ### Optimize
- QmlRewrite::SharedBindingTester sharableTest;
+ QDeclarativeRewrite::SharedBindingTester sharableTest;
bool isSharable = sharableTest.isSharable(expression);
- QmlRewrite::RewriteBinding rewriteBinding;
+ QDeclarativeRewrite::RewriteBinding rewriteBinding;
expression = rewriteBinding(expression);
quint32 length = expression.length();
@@ -2688,7 +2707,7 @@ bool QmlCompiler::completeComponentBuild()
if (bindingCompiler.isValid()) {
compileState.compiledBindingData = bindingCompiler.program();
- QmlBindingCompiler::dump(compileState.compiledBindingData);
+ QDeclarativeBindingCompiler::dump(compileState.compiledBindingData);
}
saveComponentState();
@@ -2696,7 +2715,7 @@ bool QmlCompiler::completeComponentBuild()
return true;
}
-void QmlCompiler::dumpStats()
+void QDeclarativeCompiler::dumpStats()
{
qWarning().nospace() << "QML Document: " << output->url.toString();
for (int ii = 0; ii < savedComponentStats.count(); ++ii) {
@@ -2713,14 +2732,14 @@ void QmlCompiler::dumpStats()
Returns true if from can be assigned to a (QObject) property of type
to.
*/
-bool QmlCompiler::canCoerce(int to, QmlParser::Object *from)
+bool QDeclarativeCompiler::canCoerce(int to, QDeclarativeParser::Object *from)
{
const QMetaObject *toMo =
- QmlEnginePrivate::get(engine)->rawMetaObjectForType(to);
+ QDeclarativeEnginePrivate::get(engine)->rawMetaObjectForType(to);
const QMetaObject *fromMo = from->metaObject();
while (fromMo) {
- if (QmlMetaPropertyPrivate::equal(fromMo, toMo))
+ if (QDeclarativePropertyPrivate::equal(fromMo, toMo))
return true;
fromMo = fromMo->superClass();
}
@@ -2731,34 +2750,34 @@ bool QmlCompiler::canCoerce(int to, QmlParser::Object *from)
Returns true if from can be assigned to a (QObject) property of type
to.
*/
-bool QmlCompiler::canCoerce(int to, int from)
+bool QDeclarativeCompiler::canCoerce(int to, int from)
{
const QMetaObject *toMo =
- QmlEnginePrivate::get(engine)->rawMetaObjectForType(to);
+ QDeclarativeEnginePrivate::get(engine)->rawMetaObjectForType(to);
const QMetaObject *fromMo =
- QmlEnginePrivate::get(engine)->rawMetaObjectForType(from);
+ QDeclarativeEnginePrivate::get(engine)->rawMetaObjectForType(from);
while (fromMo) {
- if (QmlMetaPropertyPrivate::equal(fromMo, toMo))
+ if (QDeclarativePropertyPrivate::equal(fromMo, toMo))
return true;
fromMo = fromMo->superClass();
}
return false;
}
-QmlType *QmlCompiler::toQmlType(QmlParser::Object *from)
+QDeclarativeType *QDeclarativeCompiler::toQmlType(QDeclarativeParser::Object *from)
{
// ### Optimize
const QMetaObject *mo = from->metatype;
- QmlType *type = 0;
+ QDeclarativeType *type = 0;
while (!type && mo) {
- type = QmlMetaType::qmlType(mo);
+ type = QDeclarativeMetaType::qmlType(mo);
mo = mo->superClass();
}
return type;
}
-QStringList QmlCompiler::deferredProperties(QmlParser::Object *obj)
+QStringList QDeclarativeCompiler::deferredProperties(QDeclarativeParser::Object *obj)
{
const QMetaObject *mo = obj->metatype;
diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h
new file mode 100644
index 0000000..2ea3366
--- /dev/null
+++ b/src/declarative/qml/qdeclarativecompiler_p.h
@@ -0,0 +1,338 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVECOMPILER_P_H
+#define QDECLARATIVECOMPILER_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 "qdeclarative.h"
+#include "qdeclarativeerror.h"
+#include "qdeclarativeinstruction_p.h"
+#include "qdeclarativecompositetypemanager_p.h"
+#include "qdeclarativeparser_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qbitfield_p.h"
+#include "qdeclarativepropertycache_p.h"
+#include "qdeclarativeintegercache_p.h"
+#include "qdeclarativetypenamecache_p.h"
+
+#include <QtCore/qbytearray.h>
+#include <QtCore/qset.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeEngine;
+class QDeclarativeComponent;
+class QDeclarativeContext;
+
+class QScriptProgram;
+class Q_AUTOTEST_EXPORT QDeclarativeCompiledData : public QDeclarativeRefCount, public QDeclarativeCleanup
+{
+public:
+ QDeclarativeCompiledData(QDeclarativeEngine *engine);
+ virtual ~QDeclarativeCompiledData();
+
+ QString name;
+ QUrl url;
+ QDeclarativeEnginePrivate::Imports imports;
+ QDeclarativeTypeNameCache *importCache;
+
+ struct TypeReference
+ {
+ TypeReference()
+ : type(0), component(0), ref(0) {}
+
+ QByteArray className;
+ QDeclarativeType *type;
+ QDeclarativeComponent *component;
+
+ QDeclarativeRefCount *ref;
+ QObject *createInstance(QDeclarativeContext *, const QBitField &) const;
+ const QMetaObject *metaObject() const;
+ };
+ QList<TypeReference> types;
+ struct CustomTypeData
+ {
+ int index;
+ int type;
+ };
+
+ const QMetaObject *root;
+ QAbstractDynamicMetaObject rootData;
+ QDeclarativePropertyCache *rootPropertyCache;
+ QList<QString> primitives;
+ QList<float> floatData;
+ QList<int> intData;
+ QList<CustomTypeData> customTypeData;
+ QList<QByteArray> datas;
+ QList<QDeclarativeParser::Location> locations;
+ QList<QDeclarativeInstruction> bytecode;
+ QList<QScriptProgram *> cachedPrograms;
+ QList<QScriptValue *> cachedClosures;
+ QList<QDeclarativePropertyCache *> propertyCaches;
+ QList<QDeclarativeIntegerCache *> contextCaches;
+ QList<QDeclarativeParser::Object::ScriptBlock> scripts;
+ QList<QUrl> urls;
+
+ void dumpInstructions();
+
+protected:
+ virtual void clear(); // From QDeclarativeCleanup
+
+private:
+ void dump(QDeclarativeInstruction *, int idx = -1);
+ QDeclarativeCompiledData(const QDeclarativeCompiledData &other);
+ QDeclarativeCompiledData &operator=(const QDeclarativeCompiledData &other);
+ QByteArray packData;
+ friend class QDeclarativeCompiler;
+ int pack(const char *, size_t);
+
+ int indexForString(const QString &);
+ int indexForByteArray(const QByteArray &);
+ int indexForFloat(float *, int);
+ int indexForInt(int *, int);
+ int indexForLocation(const QDeclarativeParser::Location &);
+ int indexForLocation(const QDeclarativeParser::LocationSpan &);
+ int indexForUrl(const QUrl &);
+};
+
+class QMetaObjectBuilder;
+class Q_DECLARATIVE_EXPORT QDeclarativeCompiler
+{
+public:
+ QDeclarativeCompiler();
+
+ bool compile(QDeclarativeEngine *, QDeclarativeCompositeTypeData *, QDeclarativeCompiledData *);
+
+ bool isError() const;
+ QList<QDeclarativeError> errors() const;
+
+ static bool isValidId(const QString &);
+ static bool isAttachedPropertyName(const QByteArray &);
+ static bool isSignalPropertyName(const QByteArray &);
+
+ static QMetaMethod findSignalByName(const QMetaObject *, const QByteArray &name);
+
+private:
+ static void reset(QDeclarativeCompiledData *);
+
+ struct BindingContext {
+ BindingContext()
+ : stack(0), owner(0), object(0) {}
+ BindingContext(QDeclarativeParser::Object *o)
+ : stack(0), owner(0), object(o) {}
+ BindingContext incr() const {
+ BindingContext rv(object);
+ rv.stack = stack + 1;
+ return rv;
+ }
+ bool isSubContext() const { return stack != 0; }
+ int stack;
+ int owner;
+ QDeclarativeParser::Object *object;
+ };
+
+ void compileTree(QDeclarativeParser::Object *tree);
+
+
+ bool buildObject(QDeclarativeParser::Object *obj, const BindingContext &);
+ bool buildScript(QDeclarativeParser::Object *obj, QDeclarativeParser::Object *script);
+ bool buildComponent(QDeclarativeParser::Object *obj, const BindingContext &);
+ bool buildSubObject(QDeclarativeParser::Object *obj, const BindingContext &);
+ bool buildSignal(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj,
+ const BindingContext &);
+ bool buildProperty(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj,
+ const BindingContext &);
+ bool buildPropertyInNamespace(QDeclarativeEnginePrivate::ImportedNamespace *ns,
+ QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ const BindingContext &);
+ bool buildIdProperty(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj);
+ bool buildAttachedProperty(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ const BindingContext &ctxt);
+ bool buildGroupedProperty(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ const BindingContext &ctxt);
+ bool buildValueTypeProperty(QObject *type,
+ QDeclarativeParser::Object *obj,
+ QDeclarativeParser::Object *baseObj,
+ const BindingContext &ctxt);
+ bool buildListProperty(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ const BindingContext &ctxt);
+ bool buildScriptStringProperty(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ const BindingContext &ctxt);
+ bool buildPropertyAssignment(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ const BindingContext &ctxt);
+ bool buildPropertyObjectAssignment(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ QDeclarativeParser::Value *value,
+ const BindingContext &ctxt);
+ bool buildPropertyLiteralAssignment(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ QDeclarativeParser::Value *value,
+ const BindingContext &ctxt);
+ bool doesPropertyExist(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj);
+ bool testLiteralAssignment(const QMetaProperty &prop,
+ QDeclarativeParser::Value *value);
+ bool testQualifiedEnumAssignment(const QMetaProperty &prop,
+ QDeclarativeParser::Object *obj,
+ QDeclarativeParser::Value *value,
+ bool *isAssignment);
+ enum DynamicMetaMode { IgnoreAliases, ResolveAliases, ForceCreation };
+ bool mergeDynamicMetaProperties(QDeclarativeParser::Object *obj);
+ bool buildDynamicMeta(QDeclarativeParser::Object *obj, DynamicMetaMode mode);
+ bool checkDynamicMeta(QDeclarativeParser::Object *obj);
+ bool buildBinding(QDeclarativeParser::Value *, QDeclarativeParser::Property *prop,
+ const BindingContext &ctxt);
+ bool buildComponentFromRoot(QDeclarativeParser::Object *obj, const BindingContext &);
+ bool compileAlias(QMetaObjectBuilder &,
+ QByteArray &data,
+ QDeclarativeParser::Object *obj,
+ const QDeclarativeParser::Object::DynamicProperty &);
+ bool completeComponentBuild();
+
+
+ void genObject(QDeclarativeParser::Object *obj);
+ void genObjectBody(QDeclarativeParser::Object *obj);
+ void genComponent(QDeclarativeParser::Object *obj);
+ void genValueProperty(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj);
+ void genListProperty(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj);
+ void genPropertyAssignment(QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ QDeclarativeParser::Property *valueTypeProperty = 0);
+ void genLiteralAssignment(const QMetaProperty &prop,
+ QDeclarativeParser::Value *value);
+ void genBindingAssignment(QDeclarativeParser::Value *binding,
+ QDeclarativeParser::Property *prop,
+ QDeclarativeParser::Object *obj,
+ QDeclarativeParser::Property *valueTypeProperty = 0);
+ int genContextCache();
+
+ int genValueTypeData(QDeclarativeParser::Property *prop, QDeclarativeParser::Property *valueTypeProp);
+ int genPropertyData(QDeclarativeParser::Property *prop);
+
+ int componentTypeRef();
+
+ static QDeclarativeType *toQmlType(QDeclarativeParser::Object *from);
+ bool canCoerce(int to, QDeclarativeParser::Object *from);
+ bool canCoerce(int to, int from);
+
+ QStringList deferredProperties(QDeclarativeParser::Object *);
+
+ void addId(const QString &, QDeclarativeParser::Object *);
+
+ void dumpStats();
+
+ struct BindingReference {
+ QDeclarativeParser::Variant expression;
+ QDeclarativeParser::Property *property;
+ QDeclarativeParser::Value *value;
+
+ enum DataType { QtScript, Experimental };
+ DataType dataType;
+
+ int compiledIndex;
+
+ QByteArray compiledData;
+ BindingContext bindingContext;
+ };
+ void addBindingReference(const BindingReference &);
+
+ struct ComponentCompileState
+ {
+ ComponentCompileState()
+ : parserStatusCount(0), pushedProperties(0), root(0) {}
+ QHash<QString, QDeclarativeParser::Object *> ids;
+ QHash<int, QDeclarativeParser::Object *> idIndexes;
+ int parserStatusCount;
+ int pushedProperties;
+
+ QByteArray compiledBindingData;
+
+ QHash<QDeclarativeParser::Value *, BindingReference> bindings;
+ QList<QDeclarativeParser::Object *> aliasingObjects;
+ QDeclarativeParser::Object *root;
+ };
+ ComponentCompileState compileState;
+
+ struct ComponentStat
+ {
+ ComponentStat()
+ : ids(0), scriptBindings(0), optimizedBindings(0), objects(0) {}
+
+ int lineNumber;
+
+ int ids;
+ int scriptBindings;
+ int optimizedBindings;
+ int objects;
+ };
+ ComponentStat componentStat;
+
+ void saveComponentState();
+
+ ComponentCompileState componentState(QDeclarativeParser::Object *);
+ QHash<QDeclarativeParser::Object *, ComponentCompileState> savedCompileStates;
+ QList<ComponentStat> savedComponentStats;
+
+ QList<QDeclarativeError> exceptions;
+ QDeclarativeCompiledData *output;
+ QDeclarativeEngine *engine;
+ QDeclarativeParser::Object *unitRoot;
+ QDeclarativeCompositeTypeData *unit;
+};
+QT_END_NAMESPACE
+
+#endif // QDECLARATIVECOMPILER_P_H
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 1bdc883..fe63ad2 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -39,20 +39,20 @@
**
****************************************************************************/
-#include "qmlcomponent.h"
-#include "qmlcomponent_p.h"
-
-#include "qmlcompiler_p.h"
-#include "qmlcontext_p.h"
-#include "qmlcompositetypedata_p.h"
-#include "qmlengine_p.h"
-#include "qmlvme_p.h"
-#include "qml.h"
-#include "qmlengine.h"
-#include "qmlbinding.h"
-#include "qmlbinding_p.h"
-#include "qmlglobal_p.h"
-#include "qmlscriptparser_p.h"
+#include "qdeclarativecomponent.h"
+#include "qdeclarativecomponent_p.h"
+
+#include "qdeclarativecompiler_p.h"
+#include "qdeclarativecontext_p.h"
+#include "qdeclarativecompositetypedata_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativevme_p.h"
+#include "qdeclarative.h"
+#include "qdeclarativeengine.h"
+#include "qdeclarativebinding_p.h"
+#include "qdeclarativebinding_p_p.h"
+#include "qdeclarativeglobal_p.h"
+#include "qdeclarativescriptparser_p.h"
#include <qfxperf_p_p.h>
@@ -65,22 +65,22 @@
QT_BEGIN_NAMESPACE
class QByteArray;
-int statusId = qRegisterMetaType<QmlComponent::Status>("QmlComponent::Status");
+int statusId = qRegisterMetaType<QDeclarativeComponent::Status>("QDeclarativeComponent::Status");
/*!
- \class QmlComponent
+ \class QDeclarativeComponent
\since 4.7
- \brief The QmlComponent class encapsulates a QML component description.
+ \brief The QDeclarativeComponent class encapsulates a QML component description.
\mainclass
*/
/*!
- \qmlclass Component QmlComponent
+ \qmlclass Component QDeclarativeComponent
\since 4.7
\brief The Component element encapsulates a QML component description.
Components are reusable, encapsulated Qml element with a well-defined interface.
- They are often defined in \l {qmldocuments.html}{Component Files}.
+ They are often defined in \l {qdeclarativedocuments.html}{Component Files}.
The \e Component element allows defining components within a QML file.
This can be useful for reusing a small component within a single QML
@@ -123,22 +123,21 @@ Item {
}
\endqml
*/
-QML_DEFINE_TYPE(Qt,4,6,Component,QmlComponent);
/*!
- \enum QmlComponent::Status
+ \enum QDeclarativeComponent::Status
- Specifies the loading status of the QmlComponent.
+ Specifies the loading status of the QDeclarativeComponent.
- \value Null This QmlComponent has no data. Call loadUrl() or setData() to add QML content.
- \value Ready This QmlComponent is ready and create() may be called.
- \value Loading This QmlComponent is loading network data.
+ \value Null This QDeclarativeComponent has no data. Call loadUrl() or setData() to add QML content.
+ \value Ready This QDeclarativeComponent is ready and create() may be called.
+ \value Loading This QDeclarativeComponent is loading network data.
\value Error An error has occured. Calling errorDescription() to retrieve a description.
*/
-void QmlComponentPrivate::typeDataReady()
+void QDeclarativeComponentPrivate::typeDataReady()
{
- Q_Q(QmlComponent);
+ Q_Q(QDeclarativeComponent);
Q_ASSERT(typeData);
@@ -148,21 +147,21 @@ void QmlComponentPrivate::typeDataReady()
emit q->statusChanged(q->status());
}
-void QmlComponentPrivate::updateProgress(qreal p)
+void QDeclarativeComponentPrivate::updateProgress(qreal p)
{
- Q_Q(QmlComponent);
+ Q_Q(QDeclarativeComponent);
progress = p;
emit q->progressChanged(p);
}
-void QmlComponentPrivate::fromTypeData(QmlCompositeTypeData *data)
+void QDeclarativeComponentPrivate::fromTypeData(QDeclarativeCompositeTypeData *data)
{
url = data->imports.baseUrl();
- QmlCompiledData *c = data->toCompiledComponent(engine);
+ QDeclarativeCompiledData *c = data->toCompiledComponent(engine);
if (!c) {
- Q_ASSERT(data->status == QmlCompositeTypeData::Error);
+ Q_ASSERT(data->status == QDeclarativeCompositeTypeData::Error);
state.errors = data->errors;
@@ -175,7 +174,7 @@ void QmlComponentPrivate::fromTypeData(QmlCompositeTypeData *data)
data->release();
}
-void QmlComponentPrivate::clear()
+void QDeclarativeComponentPrivate::clear()
{
if (typeData) {
typeData->remWaiter(this);
@@ -192,20 +191,20 @@ void QmlComponentPrivate::clear()
/*!
\internal
*/
-QmlComponent::QmlComponent(QObject *parent)
- : QObject(*(new QmlComponentPrivate), parent)
+QDeclarativeComponent::QDeclarativeComponent(QObject *parent)
+ : QObject(*(new QDeclarativeComponentPrivate), parent)
{
}
/*!
- Destruct the QmlComponent.
+ Destruct the QDeclarativeComponent.
*/
-QmlComponent::~QmlComponent()
+QDeclarativeComponent::~QDeclarativeComponent()
{
- Q_D(QmlComponent);
+ Q_D(QDeclarativeComponent);
if (d->state.completePending) {
- qWarning("QmlComponent: Component destroyed while completion pending");
+ qWarning("QDeclarativeComponent: Component destroyed while completion pending");
d->completeCreate();
}
@@ -218,12 +217,12 @@ QmlComponent::~QmlComponent()
}
/*!
- \property QmlComponent::status
- The component's current \l{QmlComponent::Status} {status}.
+ \property QDeclarativeComponent::status
+ The component's current \l{QDeclarativeComponent::Status} {status}.
*/
-QmlComponent::Status QmlComponent::status() const
+QDeclarativeComponent::Status QDeclarativeComponent::status() const
{
- Q_D(const QmlComponent);
+ Q_D(const QDeclarativeComponent);
if (d->typeData)
return Loading;
@@ -236,114 +235,114 @@ QmlComponent::Status QmlComponent::status() const
}
/*!
- \property QmlComponent::isNull
+ \property QDeclarativeComponent::isNull
Is true if the component is in the Null state, false otherwise.
- Equivalent to status() == QmlComponent::Null.
+ Equivalent to status() == QDeclarativeComponent::Null.
*/
-bool QmlComponent::isNull() const
+bool QDeclarativeComponent::isNull() const
{
return status() == Null;
}
/*!
- \property QmlComponent::isReady
+ \property QDeclarativeComponent::isReady
Is true if the component is in the Ready state, false otherwise.
- Equivalent to status() == QmlComponent::Ready.
+ Equivalent to status() == QDeclarativeComponent::Ready.
*/
-bool QmlComponent::isReady() const
+bool QDeclarativeComponent::isReady() const
{
return status() == Ready;
}
/*!
- \property QmlComponent::isError
+ \property QDeclarativeComponent::isError
Is true if the component is in the Error state, false otherwise.
- Equivalent to status() == QmlComponent::Error.
+ Equivalent to status() == QDeclarativeComponent::Error.
*/
-bool QmlComponent::isError() const
+bool QDeclarativeComponent::isError() const
{
return status() == Error;
}
/*!
- \property QmlComponent::isLoading
+ \property QDeclarativeComponent::isLoading
Is true if the component is in the Loading state, false otherwise.
- Equivalent to status() == QmlComponent::Loading.
+ Equivalent to status() == QDeclarativeComponent::Loading.
*/
-bool QmlComponent::isLoading() const
+bool QDeclarativeComponent::isLoading() const
{
return status() == Loading;
}
/*!
- \property QmlComponent::progress
+ \property QDeclarativeComponent::progress
The progress of loading the component, from 0.0 (nothing loaded)
to 1.0 (finished).
*/
-qreal QmlComponent::progress() const
+qreal QDeclarativeComponent::progress() const
{
- Q_D(const QmlComponent);
+ Q_D(const QDeclarativeComponent);
return d->progress;
}
/*!
- \fn void QmlComponent::progressChanged(qreal progress)
+ \fn void QDeclarativeComponent::progressChanged(qreal progress)
Emitted whenever the component's loading progress changes. \a progress will be the
current progress between 0.0 (nothing loaded) and 1.0 (finished).
*/
/*!
- \fn void QmlComponent::statusChanged(QmlComponent::Status status)
+ \fn void QDeclarativeComponent::statusChanged(QDeclarativeComponent::Status status)
Emitted whenever the component's status changes. \a status will be the
new status.
*/
/*!
- Create a QmlComponent with no data and give it the specified
+ Create a QDeclarativeComponent with no data and give it the specified
\a engine and \a parent. Set the data with setData().
*/
-QmlComponent::QmlComponent(QmlEngine *engine, QObject *parent)
- : QObject(*(new QmlComponentPrivate), parent)
+QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, QObject *parent)
+ : QObject(*(new QDeclarativeComponentPrivate), parent)
{
- Q_D(QmlComponent);
+ Q_D(QDeclarativeComponent);
d->engine = engine;
}
/*!
- Create a QmlComponent from the given \a url and give it the
+ Create a QDeclarativeComponent from the given \a url and give it the
specified \a parent and \a engine.
\sa loadUrl()
*/
-QmlComponent::QmlComponent(QmlEngine *engine, const QUrl &url, QObject *parent)
-: QObject(*(new QmlComponentPrivate), parent)
+QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, const QUrl &url, QObject *parent)
+: QObject(*(new QDeclarativeComponentPrivate), parent)
{
- Q_D(QmlComponent);
+ Q_D(QDeclarativeComponent);
d->engine = engine;
loadUrl(url);
}
/*!
- Create a QmlComponent from the given \a fileName and give it the specified
+ Create a QDeclarativeComponent from the given \a fileName and give it the specified
\a parent and \a engine.
\sa loadUrl()
*/
-QmlComponent::QmlComponent(QmlEngine *engine, const QString &fileName,
+QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, const QString &fileName,
QObject *parent)
-: QObject(*(new QmlComponentPrivate), parent)
+: QObject(*(new QDeclarativeComponentPrivate), parent)
{
- Q_D(QmlComponent);
+ Q_D(QDeclarativeComponent);
d->engine = engine;
loadUrl(QUrl::fromLocalFile(fileName));
}
@@ -351,10 +350,10 @@ QmlComponent::QmlComponent(QmlEngine *engine, const QString &fileName,
/*!
\internal
*/
-QmlComponent::QmlComponent(QmlEngine *engine, QmlCompiledData *cc, int start, int count, QObject *parent)
- : QObject(*(new QmlComponentPrivate), parent)
+QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, QDeclarativeCompiledData *cc, int start, int count, QObject *parent)
+ : QObject(*(new QDeclarativeComponentPrivate), parent)
{
- Q_D(QmlComponent);
+ Q_D(QDeclarativeComponent);
d->engine = engine;
d->cc = cc;
cc->addref();
@@ -365,23 +364,23 @@ QmlComponent::QmlComponent(QmlEngine *engine, QmlCompiledData *cc, int start, in
}
/*!
- Sets the QmlComponent to use the given QML \a data. If \a url
+ Sets the QDeclarativeComponent to use the given QML \a data. If \a url
is provided, it is used to set the component name and to provide
a base path for items resolved by this component.
*/
-void QmlComponent::setData(const QByteArray &data, const QUrl &url)
+void QDeclarativeComponent::setData(const QByteArray &data, const QUrl &url)
{
- Q_D(QmlComponent);
+ Q_D(QDeclarativeComponent);
d->clear();
d->url = url;
- QmlCompositeTypeData *typeData =
- QmlEnginePrivate::get(d->engine)->typeManager.getImmediate(data, url);
+ QDeclarativeCompositeTypeData *typeData =
+ QDeclarativeEnginePrivate::get(d->engine)->typeManager.getImmediate(data, url);
- if (typeData->status == QmlCompositeTypeData::Waiting
- || typeData->status == QmlCompositeTypeData::WaitingResources)
+ if (typeData->status == QDeclarativeCompositeTypeData::Waiting
+ || typeData->status == QDeclarativeCompositeTypeData::WaitingResources)
{
d->typeData = typeData;
d->typeData->addWaiter(d);
@@ -398,15 +397,15 @@ void QmlComponent::setData(const QByteArray &data, const QUrl &url)
}
/*!
-Returns the QmlContext the component was created in. This is only
+Returns the QDeclarativeContext the component was created in. This is only
valid for components created directly from QML.
*/
-QmlContext *QmlComponent::creationContext() const
+QDeclarativeContext *QDeclarativeComponent::creationContext() const
{
- Q_D(const QmlComponent);
+ Q_D(const QDeclarativeComponent);
if(d->creationContext)
return d->creationContext;
- QmlDeclarativeData *ddata = QmlDeclarativeData::get(this);
+ QDeclarativeDeclarativeData *ddata = QDeclarativeDeclarativeData::get(this);
if (ddata)
return ddata->context;
else
@@ -415,21 +414,21 @@ QmlContext *QmlComponent::creationContext() const
/*!
\internal
- Sets the QmlContext the component was created in. This is only
+ Sets the QDeclarativeContext the component was created in. This is only
desirable for components created in QML script.
*/
-void QmlComponent::setCreationContext(QmlContext* c)
+void QDeclarativeComponent::setCreationContext(QDeclarativeContext* c)
{
- Q_D(QmlComponent);
+ Q_D(QDeclarativeComponent);
d->creationContext = c;
}
/*!
- Load the QmlComponent from the provided \a url.
+ Load the QDeclarativeComponent from the provided \a url.
*/
-void QmlComponent::loadUrl(const QUrl &url)
+void QDeclarativeComponent::loadUrl(const QUrl &url)
{
- Q_D(QmlComponent);
+ Q_D(QDeclarativeComponent);
d->clear();
@@ -438,11 +437,11 @@ void QmlComponent::loadUrl(const QUrl &url)
else
d->url = url;
- QmlCompositeTypeData *data =
- QmlEnginePrivate::get(d->engine)->typeManager.get(d->url);
+ QDeclarativeCompositeTypeData *data =
+ QDeclarativeEnginePrivate::get(d->engine)->typeManager.get(d->url);
- if (data->status == QmlCompositeTypeData::Waiting
- || data->status == QmlCompositeTypeData::WaitingResources)
+ if (data->status == QDeclarativeCompositeTypeData::Waiting
+ || data->status == QDeclarativeCompositeTypeData::WaitingResources)
{
d->typeData = data;
d->typeData->addWaiter(d);
@@ -460,26 +459,26 @@ void QmlComponent::loadUrl(const QUrl &url)
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> QmlComponent::errors() const
+QList<QDeclarativeError> QDeclarativeComponent::errors() const
{
- Q_D(const QmlComponent);
+ Q_D(const QDeclarativeComponent);
if (isError())
return d->state.errors;
else
- return QList<QmlError>();
+ return QList<QDeclarativeError>();
}
/*!
\internal
errorsString is only meant as a way to get the errors in script
*/
-QString QmlComponent::errorsString() const
+QString QDeclarativeComponent::errorsString() const
{
- Q_D(const QmlComponent);
+ Q_D(const QDeclarativeComponent);
QString ret;
if(!isError())
return ret;
- foreach(const QmlError &e, d->state.errors) {
+ foreach(const QDeclarativeError &e, d->state.errors) {
ret += e.url().toString() + QLatin1Char(':') +
QString::number(e.line()) + QLatin1Char(' ') +
e.description() + QLatin1Char('\n');
@@ -488,20 +487,20 @@ QString QmlComponent::errorsString() const
}
/*!
- \property QmlComponent::url
+ \property QDeclarativeComponent::url
The component URL. This is the URL passed to either the constructor,
or the loadUrl() or setData() methods.
*/
-QUrl QmlComponent::url() const
+QUrl QDeclarativeComponent::url() const
{
- Q_D(const QmlComponent);
+ Q_D(const QDeclarativeComponent);
return d->url;
}
/*!
\internal
*/
-QmlComponent::QmlComponent(QmlComponentPrivate &dd, QObject *parent)
+QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, QObject *parent)
: QObject(dd, parent)
{
}
@@ -511,16 +510,16 @@ QmlComponent::QmlComponent(QmlComponentPrivate &dd, QObject *parent)
\internal
A version of create which returns a scriptObject, for use in script
*/
-QScriptValue QmlComponent::createObject()
+QScriptValue QDeclarativeComponent::createObject()
{
- Q_D(QmlComponent);
- QmlContext* ctxt = creationContext();
+ Q_D(QDeclarativeComponent);
+ QDeclarativeContext* ctxt = creationContext();
if(!ctxt){
qWarning() << QLatin1String("createObject can only be used in QML");
return QScriptValue();
}
QObject* ret = create(ctxt);
- return QmlEnginePrivate::qmlScriptObject(ret, d->engine);
+ return QDeclarativeEnginePrivate::qmlScriptObject(ret, d->engine);
}
/*!
@@ -529,23 +528,23 @@ QScriptValue QmlComponent::createObject()
instance.
If \a context is 0 (the default), it will create the instance in the
- engine' s \l {QmlEngine::rootContext()}{root context}.
+ engine' s \l {QDeclarativeEngine::rootContext()}{root context}.
*/
-QObject *QmlComponent::create(QmlContext *context)
+QObject *QDeclarativeComponent::create(QDeclarativeContext *context)
{
- Q_D(QmlComponent);
+ Q_D(QDeclarativeComponent);
return d->create(context, QBitField());
}
-QObject *QmlComponentPrivate::create(QmlContext *context,
+QObject *QDeclarativeComponentPrivate::create(QDeclarativeContext *context,
const QBitField &bindings)
{
if (!context)
context = engine->rootContext();
if (context->engine() != engine) {
- qWarning("QmlComponent::create(): Must create component in context from the same QmlEngine");
+ qWarning("QDeclarativeComponent::create(): Must create component in context from the same QDeclarativeEngine");
return 0;
}
@@ -556,70 +555,70 @@ QObject *QmlComponentPrivate::create(QmlContext *context,
/*!
This method provides more advanced control over component instance creation.
- In general, programmers should use QmlComponent::create() to create a
+ In general, programmers should use QDeclarativeComponent::create() to create a
component.
Create an object instance from this component. Returns 0 if creation
failed. \a context specifies the context within which to create the object
instance.
- When QmlComponent constructs an instance, it occurs in three steps:
+ When QDeclarativeComponent constructs an instance, it occurs in three steps:
\list 1
\i The object hierarchy is created, and constant values are assigned.
\i Property bindings are evaluated for the the first time.
- \i If applicable, QmlParserStatus::componentComplete() is called on objects.
+ \i If applicable, QDeclarativeParserStatus::componentComplete() is called on objects.
\endlist
- QmlComponent::beginCreate() differs from QmlComponent::create() in that it
- only performs step 1. QmlComponent::completeCreate() must be called to
+ QDeclarativeComponent::beginCreate() differs from QDeclarativeComponent::create() in that it
+ only performs step 1. QDeclarativeComponent::completeCreate() must be called to
complete steps 2 and 3.
This breaking point is sometimes useful when using attached properties to
communicate information to an instantiated component, as it allows their
initial values to be configured before property bindings take effect.
*/
-QObject *QmlComponent::beginCreate(QmlContext *context)
+QObject *QDeclarativeComponent::beginCreate(QDeclarativeContext *context)
{
- Q_D(QmlComponent);
+ Q_D(QDeclarativeComponent);
return d->beginCreate(context, QBitField());
}
QObject *
-QmlComponentPrivate::beginCreate(QmlContext *context, const QBitField &bindings)
+QDeclarativeComponentPrivate::beginCreate(QDeclarativeContext *context, const QBitField &bindings)
{
- Q_Q(QmlComponent);
+ Q_Q(QDeclarativeComponent);
if (!context) {
- qWarning("QmlComponent::beginCreate(): Cannot create a component in a null context");
+ qWarning("QDeclarativeComponent::beginCreate(): Cannot create a component in a null context");
return 0;
}
if (context->engine() != engine) {
- qWarning("QmlComponent::beginCreate(): Must create component in context from the same QmlEngine");
+ qWarning("QDeclarativeComponent::beginCreate(): Must create component in context from the same QDeclarativeEngine");
return 0;
}
if (state.completePending) {
- qWarning("QmlComponent: Cannot create new component instance before completing the previous");
+ qWarning("QDeclarativeComponent: Cannot create new component instance before completing the previous");
return 0;
}
if (!q->isReady()) {
- qWarning("QmlComponent: Component is not ready");
+ qWarning("QDeclarativeComponent: Component is not ready");
return 0;
}
- QmlEnginePrivate *ep = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
- QmlContextPrivate *contextPriv =
- static_cast<QmlContextPrivate *>(QObjectPrivate::get(context));
- QmlContext *ctxt = new QmlContext(context, 0, true);
- static_cast<QmlContextPrivate*>(ctxt->d_func())->url = cc->url;
- static_cast<QmlContextPrivate*>(ctxt->d_func())->imports = cc->importCache;
+ QDeclarativeContextPrivate *contextPriv =
+ static_cast<QDeclarativeContextPrivate *>(QObjectPrivate::get(context));
+ QDeclarativeContext *ctxt = new QDeclarativeContext(context, 0, true);
+ static_cast<QDeclarativeContextPrivate*>(ctxt->d_func())->url = cc->url;
+ static_cast<QDeclarativeContextPrivate*>(ctxt->d_func())->imports = cc->importCache;
cc->importCache->addref();
QObject *rv = begin(ctxt, ep, cc, start, count, &state, bindings);
if (rv) {
- QmlGraphics_setParent_noEvent(ctxt, rv);
+ QDeclarativeGraphics_setParent_noEvent(ctxt, rv);
} else {
delete ctxt;
}
@@ -629,14 +628,14 @@ QmlComponentPrivate::beginCreate(QmlContext *context, const QBitField &bindings)
return rv;
}
-QObject * QmlComponentPrivate::begin(QmlContext *ctxt, QmlEnginePrivate *enginePriv,
- QmlCompiledData *component, int start, int count,
+QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContext *ctxt, QDeclarativeEnginePrivate *enginePriv,
+ QDeclarativeCompiledData *component, int start, int count,
ConstructionState *state, const QBitField &bindings)
{
bool isRoot = !enginePriv->inBeginCreate;
enginePriv->inBeginCreate = true;
- QmlVME vme;
+ QDeclarativeVME vme;
QObject *rv = vme.run(ctxt, component, start, count, bindings);
if (vme.isError())
@@ -661,13 +660,13 @@ QObject * QmlComponentPrivate::begin(QmlContext *ctxt, QmlEnginePrivate *engineP
return rv;
}
-void QmlComponentPrivate::beginDeferred(QmlContext *, QmlEnginePrivate *enginePriv,
+void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeContext *, QDeclarativeEnginePrivate *enginePriv,
QObject *object, ConstructionState *state)
{
bool isRoot = !enginePriv->inBeginCreate;
enginePriv->inBeginCreate = true;
- QmlVME vme;
+ QDeclarativeVME vme;
vme.runDeferred(object);
if (vme.isError())
@@ -690,37 +689,37 @@ void QmlComponentPrivate::beginDeferred(QmlContext *, QmlEnginePrivate *enginePr
}
}
-void QmlComponentPrivate::complete(QmlEnginePrivate *enginePriv, ConstructionState *state)
+void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePriv, ConstructionState *state)
{
if (state->completePending) {
for (int ii = 0; ii < state->bindValues.count(); ++ii) {
- QmlEnginePrivate::SimpleList<QmlAbstractBinding> bv =
+ QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> bv =
state->bindValues.at(ii);
for (int jj = 0; jj < bv.count; ++jj) {
if(bv.at(jj))
- bv.at(jj)->setEnabled(true, QmlMetaProperty::BypassInterceptor |
- QmlMetaProperty::DontRemoveBinding);
+ bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor |
+ QDeclarativePropertyPrivate::DontRemoveBinding);
}
- QmlEnginePrivate::clear(bv);
+ QDeclarativeEnginePrivate::clear(bv);
}
for (int ii = 0; ii < state->parserStatus.count(); ++ii) {
- QmlEnginePrivate::SimpleList<QmlParserStatus> ps =
+ QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> ps =
state->parserStatus.at(ii);
for (int jj = ps.count - 1; jj >= 0; --jj) {
- QmlParserStatus *status = ps.at(jj);
+ QDeclarativeParserStatus *status = ps.at(jj);
if (status && status->d) {
status->d = 0;
status->componentComplete();
}
}
- QmlEnginePrivate::clear(ps);
+ QDeclarativeEnginePrivate::clear(ps);
}
while (state->componentAttacheds) {
- QmlComponentAttached *a = state->componentAttacheds;
+ QDeclarativeComponentAttached *a = state->componentAttacheds;
if (a->next) a->next->prev = &state->componentAttacheds;
state->componentAttacheds = a->next;
a->prev = 0; a->next = 0;
@@ -743,31 +742,31 @@ void QmlComponentPrivate::complete(QmlEnginePrivate *enginePriv, ConstructionSta
/*!
This method provides more advanced control over component instance creation.
- In general, programmers should use QmlComponent::create() to create a
+ In general, programmers should use QDeclarativeComponent::create() to create a
component.
- Complete a component creation begin with QmlComponent::beginCreate().
+ Complete a component creation begin with QDeclarativeComponent::beginCreate().
*/
-void QmlComponent::completeCreate()
+void QDeclarativeComponent::completeCreate()
{
- Q_D(QmlComponent);
+ Q_D(QDeclarativeComponent);
d->completeCreate();
}
-void QmlComponentPrivate::completeCreate()
+void QDeclarativeComponentPrivate::completeCreate()
{
if (state.completePending) {
- QmlEnginePrivate *ep = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
complete(ep, &state);
}
}
-QmlComponentAttached::QmlComponentAttached(QObject *parent)
+QDeclarativeComponentAttached::QDeclarativeComponentAttached(QObject *parent)
: QObject(parent), prev(0), next(0)
{
}
-QmlComponentAttached::~QmlComponentAttached()
+QDeclarativeComponentAttached::~QDeclarativeComponentAttached()
{
if (prev) *prev = next;
if (next) next->prev = prev;
@@ -778,15 +777,15 @@ QmlComponentAttached::~QmlComponentAttached()
/*!
\internal
*/
-QmlComponentAttached *QmlComponent::qmlAttachedProperties(QObject *obj)
+QDeclarativeComponentAttached *QDeclarativeComponent::qmlAttachedProperties(QObject *obj)
{
- QmlComponentAttached *a = new QmlComponentAttached(obj);
+ QDeclarativeComponentAttached *a = new QDeclarativeComponentAttached(obj);
- QmlEngine *engine = qmlEngine(obj);
- if (!engine || !QmlEnginePrivate::get(engine)->inBeginCreate)
+ QDeclarativeEngine *engine = qmlEngine(obj);
+ if (!engine || !QDeclarativeEnginePrivate::get(engine)->inBeginCreate)
return a;
- QmlEnginePrivate *p = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *p = QDeclarativeEnginePrivate::get(engine);
a->next = p->componentAttacheds;
a->prev = &p->componentAttacheds;
diff --git a/src/declarative/qml/qmlcomponent.h b/src/declarative/qml/qdeclarativecomponent.h
index 8996481..aec0480 100644
--- a/src/declarative/qml/qmlcomponent.h
+++ b/src/declarative/qml/qdeclarativecomponent.h
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#ifndef QMLCOMPONENT_H
-#define QMLCOMPONENT_H
+#ifndef QDECLARATIVECOMPONENT_H
+#define QDECLARATIVECOMPONENT_H
-#include "qml.h"
-#include "qmlerror.h"
+#include "qdeclarative.h"
+#include "qdeclarativeerror.h"
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
@@ -55,15 +55,15 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlCompiledData;
+class QDeclarativeCompiledData;
class QByteArray;
-class QmlComponentPrivate;
-class QmlEngine;
-class QmlComponentAttached;
-class Q_DECLARATIVE_EXPORT QmlComponent : public QObject
+class QDeclarativeComponentPrivate;
+class QDeclarativeEngine;
+class QDeclarativeComponentAttached;
+class Q_DECLARATIVE_EXPORT QDeclarativeComponent : public QObject
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlComponent)
+ Q_DECLARE_PRIVATE(QDeclarativeComponent)
Q_PROPERTY(bool isNull READ isNull NOTIFY statusChanged)
Q_PROPERTY(bool isReady READ isReady NOTIFY statusChanged)
Q_PROPERTY(bool isError READ isError NOTIFY statusChanged)
@@ -73,11 +73,11 @@ class Q_DECLARATIVE_EXPORT QmlComponent : public QObject
Q_PROPERTY(QUrl url READ url CONSTANT)
public:
- QmlComponent(QObject *parent = 0);
- QmlComponent(QmlEngine *, QObject *parent=0);
- QmlComponent(QmlEngine *, const QString &fileName, QObject *parent = 0);
- QmlComponent(QmlEngine *, const QUrl &url, QObject *parent = 0);
- virtual ~QmlComponent();
+ QDeclarativeComponent(QObject *parent = 0);
+ QDeclarativeComponent(QDeclarativeEngine *, QObject *parent=0);
+ QDeclarativeComponent(QDeclarativeEngine *, const QString &fileName, QObject *parent = 0);
+ QDeclarativeComponent(QDeclarativeEngine *, const QUrl &url, QObject *parent = 0);
+ virtual ~QDeclarativeComponent();
Q_ENUMS(Status)
enum Status { Null, Ready, Loading, Error };
@@ -88,15 +88,15 @@ public:
bool isError() const;
bool isLoading() const;
- QList<QmlError> errors() const;
+ QList<QDeclarativeError> errors() const;
Q_INVOKABLE QString errorsString() const;
qreal progress() const;
QUrl url() const;
- virtual QObject *create(QmlContext *context = 0);
- virtual QObject *beginCreate(QmlContext *);
+ virtual QObject *create(QDeclarativeContext *context = 0);
+ virtual QObject *beginCreate(QDeclarativeContext *);
virtual void completeCreate();
Q_INVOKABLE QScriptValue createObject();
@@ -104,31 +104,31 @@ public:
void loadUrl(const QUrl &url);
void setData(const QByteArray &, const QUrl &baseUrl);
- void setCreationContext(QmlContext*);
- QmlContext *creationContext() const;
+ void setCreationContext(QDeclarativeContext*);
+ QDeclarativeContext *creationContext() const;
- static QmlComponentAttached *qmlAttachedProperties(QObject *);
+ static QDeclarativeComponentAttached *qmlAttachedProperties(QObject *);
Q_SIGNALS:
- void statusChanged(QmlComponent::Status);
+ void statusChanged(QDeclarativeComponent::Status);
void progressChanged(qreal);
protected:
- QmlComponent(QmlComponentPrivate &dd, QObject* parent);
+ QDeclarativeComponent(QDeclarativeComponentPrivate &dd, QObject* parent);
private:
- QmlComponent(QmlEngine *, QmlCompiledData *, int, int, QObject *parent);
+ QDeclarativeComponent(QDeclarativeEngine *, QDeclarativeCompiledData *, int, int, QObject *parent);
- friend class QmlVME;
- friend class QmlCompositeTypeData;
+ friend class QDeclarativeVME;
+ friend class QDeclarativeCompositeTypeData;
};
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QmlComponent::Status)
-QML_DECLARE_TYPE(QmlComponent)
-QML_DECLARE_TYPEINFO(QmlComponent, QML_HAS_ATTACHED_PROPERTIES)
+Q_DECLARE_METATYPE(QDeclarativeComponent::Status)
+QML_DECLARE_TYPE(QDeclarativeComponent)
+QML_DECLARE_TYPEINFO(QDeclarativeComponent, QML_HAS_ATTACHED_PROPERTIES)
QT_END_HEADER
-#endif // QMLCOMPONENT_H
+#endif // QDECLARATIVECOMPONENT_H
diff --git a/src/declarative/qml/qmlcomponent_p.h b/src/declarative/qml/qdeclarativecomponent_p.h
index b7a3038..3155813 100644
--- a/src/declarative/qml/qmlcomponent_p.h
+++ b/src/declarative/qml/qdeclarativecomponent_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLCOMPONENT_P_H
-#define QMLCOMPONENT_P_H
+#ifndef QDECLARATIVECOMPONENT_P_H
+#define QDECLARATIVECOMPONENT_P_H
//
// W A R N I N G
@@ -53,13 +53,13 @@
// We mean it.
//
-#include "qmlcomponent.h"
+#include "qdeclarativecomponent.h"
-#include "qmlengine_p.h"
-#include "qmlcompositetypemanager_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativecompositetypemanager_p.h"
#include "qbitfield_p.h"
-#include "qmlerror.h"
-#include "qml.h"
+#include "qdeclarativeerror.h"
+#include "qdeclarative.h"
#include <QtCore/QString>
#include <QtCore/QStringList>
@@ -69,79 +69,79 @@
QT_BEGIN_NAMESPACE
-class QmlComponent;
-class QmlEngine;
-class QmlCompiledData;
+class QDeclarativeComponent;
+class QDeclarativeEngine;
+class QDeclarativeCompiledData;
-class QmlComponentAttached;
-class QmlComponentPrivate : public QObjectPrivate
+class QDeclarativeComponentAttached;
+class QDeclarativeComponentPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlComponent)
+ Q_DECLARE_PUBLIC(QDeclarativeComponent)
public:
- QmlComponentPrivate() : typeData(0), progress(0.), start(-1), count(-1), cc(0), engine(0), creationContext(0) {}
+ QDeclarativeComponentPrivate() : typeData(0), progress(0.), start(-1), count(-1), cc(0), engine(0), creationContext(0) {}
- QObject *create(QmlContext *context, const QBitField &);
- QObject *beginCreate(QmlContext *, const QBitField &);
+ QObject *create(QDeclarativeContext *context, const QBitField &);
+ QObject *beginCreate(QDeclarativeContext *, const QBitField &);
void completeCreate();
- QmlCompositeTypeData *typeData;
+ QDeclarativeCompositeTypeData *typeData;
void typeDataReady();
void updateProgress(qreal);
- void fromTypeData(QmlCompositeTypeData *data);
+ void fromTypeData(QDeclarativeCompositeTypeData *data);
QUrl url;
qreal progress;
int start;
int count;
- QmlCompiledData *cc;
+ QDeclarativeCompiledData *cc;
struct ConstructionState {
ConstructionState() : componentAttacheds(0), completePending(false) {}
- QList<QmlEnginePrivate::SimpleList<QmlAbstractBinding> > bindValues;
- QList<QmlEnginePrivate::SimpleList<QmlParserStatus> > parserStatus;
- QmlComponentAttached *componentAttacheds;
- QList<QmlError> errors;
+ QList<QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> > bindValues;
+ QList<QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> > parserStatus;
+ QDeclarativeComponentAttached *componentAttacheds;
+ QList<QDeclarativeError> errors;
bool completePending;
};
ConstructionState state;
- static QObject *begin(QmlContext *ctxt, QmlEnginePrivate *enginePriv,
- QmlCompiledData *component, int start, int count,
+ static QObject *begin(QDeclarativeContext *ctxt, QDeclarativeEnginePrivate *enginePriv,
+ QDeclarativeCompiledData *component, int start, int count,
ConstructionState *state, const QBitField &bindings = QBitField());
- static void beginDeferred(QmlContext *ctxt, QmlEnginePrivate *enginePriv,
+ static void beginDeferred(QDeclarativeContext *ctxt, QDeclarativeEnginePrivate *enginePriv,
QObject *object, ConstructionState *state);
- static void complete(QmlEnginePrivate *enginePriv, ConstructionState *state);
+ static void complete(QDeclarativeEnginePrivate *enginePriv, ConstructionState *state);
- QmlEngine *engine;
- QmlContext *creationContext;
+ QDeclarativeEngine *engine;
+ QDeclarativeContext *creationContext;
void clear();
- static QmlComponentPrivate *get(QmlComponent *c) {
- return static_cast<QmlComponentPrivate *>(QObjectPrivate::get(c));
+ static QDeclarativeComponentPrivate *get(QDeclarativeComponent *c) {
+ return static_cast<QDeclarativeComponentPrivate *>(QObjectPrivate::get(c));
}
};
-class QmlComponentAttached : public QObject
+class QDeclarativeComponentAttached : public QObject
{
Q_OBJECT
public:
- QmlComponentAttached(QObject *parent = 0);
- ~QmlComponentAttached();
+ QDeclarativeComponentAttached(QObject *parent = 0);
+ ~QDeclarativeComponentAttached();
- QmlComponentAttached **prev;
- QmlComponentAttached *next;
+ QDeclarativeComponentAttached **prev;
+ QDeclarativeComponentAttached *next;
Q_SIGNALS:
void completed();
private:
- friend class QmlComponentPrivate;
+ friend class QDeclarativeComponentPrivate;
};
QT_END_NAMESPACE
-#endif // QMLCOMPONENT_P_H
+#endif // QDECLARATIVECOMPONENT_P_H
diff --git a/src/declarative/qml/qmlcompositetypedata_p.h b/src/declarative/qml/qdeclarativecompositetypedata_p.h
index 342c88a..fb26af9 100644
--- a/src/declarative/qml/qmlcompositetypedata_p.h
+++ b/src/declarative/qml/qdeclarativecompositetypedata_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLCOMPOSITETYPEDATA_P_H
-#define QMLCOMPOSITETYPEDATA_P_H
+#ifndef QDECLARATIVECOMPOSITETYPEDATA_P_H
+#define QDECLARATIVECOMPOSITETYPEDATA_P_H
//
// W A R N I N G
@@ -53,18 +53,18 @@
// We mean it.
//
-#include "qmlengine_p.h"
+#include "qdeclarativeengine_p.h"
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
-class QmlCompositeTypeResource;
-class QmlCompositeTypeData : public QmlRefCount
+class QDeclarativeCompositeTypeResource;
+class QDeclarativeCompositeTypeData : public QDeclarativeRefCount
{
public:
- QmlCompositeTypeData();
- virtual ~QmlCompositeTypeData();
+ QDeclarativeCompositeTypeData();
+ virtual ~QDeclarativeCompositeTypeData();
enum Status {
Invalid,
@@ -81,56 +81,56 @@ public:
};
ErrorType errorType;
- QList<QmlError> errors;
+ QList<QDeclarativeError> errors;
- QmlEnginePrivate::Imports imports;
+ QDeclarativeEnginePrivate::Imports imports;
- QList<QmlCompositeTypeData *> dependants;
+ QList<QDeclarativeCompositeTypeData *> dependants;
- // Return a QmlComponent if the QmlCompositeTypeData is not in the Waiting
- // state. The QmlComponent is owned by the QmlCompositeTypeData, so a
- // reference should be kept to keep the QmlComponent alive.
- QmlComponent *toComponent(QmlEngine *);
- // Return a QmlCompiledData if possible, or 0 if an error
+ // Return a QDeclarativeComponent if the QDeclarativeCompositeTypeData is not in the Waiting
+ // state. The QDeclarativeComponent is owned by the QDeclarativeCompositeTypeData, so a
+ // reference should be kept to keep the QDeclarativeComponent alive.
+ QDeclarativeComponent *toComponent(QDeclarativeEngine *);
+ // Return a QDeclarativeCompiledData if possible, or 0 if an error
// occurs
- QmlCompiledData *toCompiledComponent(QmlEngine *);
+ QDeclarativeCompiledData *toCompiledComponent(QDeclarativeEngine *);
struct TypeReference
{
TypeReference();
- QmlType *type;
- QmlCompositeTypeData *unit;
+ QDeclarativeType *type;
+ QDeclarativeCompositeTypeData *unit;
};
QList<TypeReference> types;
- QList<QmlCompositeTypeResource *> resources;
+ QList<QDeclarativeCompositeTypeResource *> resources;
- // Add or remove p as a waiter. When the QmlCompositeTypeData becomes
- // ready, the QmlComponentPrivate::typeDataReady() method will be invoked on
+ // Add or remove p as a waiter. When the QDeclarativeCompositeTypeData becomes
+ // ready, the QDeclarativeComponentPrivate::typeDataReady() method will be invoked on
// p. The waiter is automatically removed when the typeDataReady() method
// is invoked, so there is no need to call remWaiter() in this case.
- void addWaiter(QmlComponentPrivate *p);
- void remWaiter(QmlComponentPrivate *p);
+ void addWaiter(QDeclarativeComponentPrivate *p);
+ void remWaiter(QDeclarativeComponentPrivate *p);
qreal progress;
private:
- friend class QmlCompositeTypeManager;
- friend class QmlCompiler;
- friend class QmlDomDocument;
-
- QmlScriptParser data;
- QList<QmlComponentPrivate *> waiters;
- QmlComponent *component;
- QmlCompiledData *compiledComponent;
+ friend class QDeclarativeCompositeTypeManager;
+ friend class QDeclarativeCompiler;
+ friend class QDeclarativeDomDocument;
+
+ QDeclarativeScriptParser data;
+ QList<QDeclarativeComponentPrivate *> waiters;
+ QDeclarativeComponent *component;
+ QDeclarativeCompiledData *compiledComponent;
};
-class QmlCompositeTypeResource : public QmlRefCount
+class QDeclarativeCompositeTypeResource : public QDeclarativeRefCount
{
public:
- QmlCompositeTypeResource();
- virtual ~QmlCompositeTypeResource();
+ QDeclarativeCompositeTypeResource();
+ virtual ~QDeclarativeCompositeTypeResource();
enum Status {
Invalid,
@@ -140,7 +140,7 @@ public:
};
Status status;
- QList<QmlCompositeTypeData *> dependants;
+ QList<QDeclarativeCompositeTypeData *> dependants;
QString url;
QByteArray data;
@@ -148,5 +148,5 @@ public:
QT_END_NAMESPACE
-#endif // QMLCOMPOSITETYPEDATA_P_H
+#endif // QDECLARATIVECOMPOSITETYPEDATA_P_H
diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp
index 71d6f16..b90a598 100644
--- a/src/declarative/qml/qmlcompositetypemanager.cpp
+++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp
@@ -39,15 +39,15 @@
**
****************************************************************************/
-#include "qmlcompositetypemanager_p.h"
+#include "qdeclarativecompositetypemanager_p.h"
-#include "qmlcompositetypedata_p.h"
-#include "qmlscriptparser_p.h"
-#include "qmlengine.h"
-#include "qmlengine_p.h"
-#include "qmlcomponent.h"
-#include "qmlcomponent_p.h"
-#include "qmlcompiler_p.h"
+#include "qdeclarativecompositetypedata_p.h"
+#include "qdeclarativescriptparser_p.h"
+#include "qdeclarativeengine.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativecomponent.h"
+#include "qdeclarativecomponent_p.h"
+#include "qdeclarativecompiler_p.h"
#include <QtNetwork/qnetworkreply.h>
#include <QtCore/qdebug.h>
@@ -62,12 +62,12 @@ inline uint qHash(const QUrl &uri)
}
#endif
-QmlCompositeTypeData::QmlCompositeTypeData()
+QDeclarativeCompositeTypeData::QDeclarativeCompositeTypeData()
: status(Invalid), errorType(NoError), component(0), compiledComponent(0)
{
}
-QmlCompositeTypeData::~QmlCompositeTypeData()
+QDeclarativeCompositeTypeData::~QDeclarativeCompositeTypeData()
{
for (int ii = 0; ii < dependants.count(); ++ii)
dependants.at(ii)->release();
@@ -82,36 +82,36 @@ QmlCompositeTypeData::~QmlCompositeTypeData()
delete component;
}
-QmlCompositeTypeResource::QmlCompositeTypeResource()
+QDeclarativeCompositeTypeResource::QDeclarativeCompositeTypeResource()
{
}
-QmlCompositeTypeResource::~QmlCompositeTypeResource()
+QDeclarativeCompositeTypeResource::~QDeclarativeCompositeTypeResource()
{
for (int ii = 0; ii < dependants.count(); ++ii)
dependants.at(ii)->release();
}
-void QmlCompositeTypeData::addWaiter(QmlComponentPrivate *p)
+void QDeclarativeCompositeTypeData::addWaiter(QDeclarativeComponentPrivate *p)
{
waiters << p;
}
-void QmlCompositeTypeData::remWaiter(QmlComponentPrivate *p)
+void QDeclarativeCompositeTypeData::remWaiter(QDeclarativeComponentPrivate *p)
{
waiters.removeAll(p);
}
-QmlComponent *QmlCompositeTypeData::toComponent(QmlEngine *engine)
+QDeclarativeComponent *QDeclarativeCompositeTypeData::toComponent(QDeclarativeEngine *engine)
{
if (!component) {
- QmlCompiledData *cc = toCompiledComponent(engine);
+ QDeclarativeCompiledData *cc = toCompiledComponent(engine);
if (cc) {
- component = new QmlComponent(engine, cc, -1, -1, 0);
+ component = new QDeclarativeComponent(engine, cc, -1, -1, 0);
cc->release();
} else {
- component = new QmlComponent(engine, 0);
+ component = new QDeclarativeComponent(engine, 0);
component->d_func()->url = imports.baseUrl();
component->d_func()->state.errors = errors;
}
@@ -121,16 +121,16 @@ QmlComponent *QmlCompositeTypeData::toComponent(QmlEngine *engine)
return component;
}
-QmlCompiledData *
-QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine)
+QDeclarativeCompiledData *
+QDeclarativeCompositeTypeData::toCompiledComponent(QDeclarativeEngine *engine)
{
if (status == Complete && !compiledComponent) {
- compiledComponent = new QmlCompiledData(engine);
+ compiledComponent = new QDeclarativeCompiledData(engine);
compiledComponent->url = imports.baseUrl();
compiledComponent->name = compiledComponent->url.toString();
- QmlCompiler compiler;
+ QDeclarativeCompiler compiler;
if (!compiler.compile(engine, this, compiledComponent)) {
status = Error;
errors = compiler.errors();
@@ -148,17 +148,17 @@ QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine)
return compiledComponent;
}
-QmlCompositeTypeData::TypeReference::TypeReference()
+QDeclarativeCompositeTypeData::TypeReference::TypeReference()
: type(0), unit(0)
{
}
-QmlCompositeTypeManager::QmlCompositeTypeManager(QmlEngine *e)
+QDeclarativeCompositeTypeManager::QDeclarativeCompositeTypeManager(QDeclarativeEngine *e)
: engine(e)
{
}
-QmlCompositeTypeManager::~QmlCompositeTypeManager()
+QDeclarativeCompositeTypeManager::~QDeclarativeCompositeTypeManager()
{
for (Components::Iterator iter = components.begin(); iter != components.end();) {
(*iter)->release();
@@ -170,13 +170,13 @@ QmlCompositeTypeManager::~QmlCompositeTypeManager()
}
}
-QmlCompositeTypeData *QmlCompositeTypeManager::get(const QUrl &url)
+QDeclarativeCompositeTypeData *QDeclarativeCompositeTypeManager::get(const QUrl &url)
{
- QmlCompositeTypeData *unit = components.value(url);
+ QDeclarativeCompositeTypeData *unit = components.value(url);
if (!unit) {
- unit = new QmlCompositeTypeData;
- unit->status = QmlCompositeTypeData::Waiting;
+ unit = new QDeclarativeCompositeTypeData;
+ unit->status = QDeclarativeCompositeTypeData::Waiting;
unit->progress = 0.0;
unit->imports.setBaseUrl(url);
components.insert(url, unit);
@@ -188,20 +188,20 @@ QmlCompositeTypeData *QmlCompositeTypeManager::get(const QUrl &url)
return unit;
}
-QmlCompositeTypeData *
-QmlCompositeTypeManager::getImmediate(const QByteArray &data, const QUrl &url)
+QDeclarativeCompositeTypeData *
+QDeclarativeCompositeTypeManager::getImmediate(const QByteArray &data, const QUrl &url)
{
- QmlCompositeTypeData *unit = new QmlCompositeTypeData;
- unit->status = QmlCompositeTypeData::Waiting;
+ QDeclarativeCompositeTypeData *unit = new QDeclarativeCompositeTypeData;
+ unit->status = QDeclarativeCompositeTypeData::Waiting;
unit->imports.setBaseUrl(url);
setData(unit, data, url);
return unit;
}
-void QmlCompositeTypeManager::clearCache()
+void QDeclarativeCompositeTypeManager::clearCache()
{
for (Components::Iterator iter = components.begin(); iter != components.end();) {
- if ((*iter)->status != QmlCompositeTypeData::Waiting) {
+ if ((*iter)->status != QDeclarativeCompositeTypeData::Waiting) {
(*iter)->release();
iter = components.erase(iter);
} else {
@@ -210,7 +210,7 @@ void QmlCompositeTypeManager::clearCache()
}
for (Resources::Iterator iter = resources.begin(); iter != resources.end();) {
- if ((*iter)->status != QmlCompositeTypeResource::Waiting) {
+ if ((*iter)->status != QDeclarativeCompositeTypeResource::Waiting) {
(*iter)->release();
iter = resources.erase(iter);
} else {
@@ -219,11 +219,11 @@ void QmlCompositeTypeManager::clearCache()
}
}
-void QmlCompositeTypeManager::replyFinished()
+void QDeclarativeCompositeTypeManager::replyFinished()
{
QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
- QmlCompositeTypeData *unit = components.value(reply->url());
+ QDeclarativeCompositeTypeData *unit = components.value(reply->url());
Q_ASSERT(unit);
if (reply->error() != QNetworkReply::NoError) {
@@ -232,11 +232,11 @@ void QmlCompositeTypeManager::replyFinished()
errorDescription = QLatin1String("Network error for URL ") +
reply->url().toString();
- unit->status = QmlCompositeTypeData::Error;
+ unit->status = QDeclarativeCompositeTypeData::Error;
// ### FIXME
- QmlError error;
+ QDeclarativeError error;
error.setDescription(errorDescription);
- unit->errorType = QmlCompositeTypeData::AccessError;
+ unit->errorType = QDeclarativeCompositeTypeData::AccessError;
unit->errors << error;
doComplete(unit);
@@ -249,20 +249,20 @@ void QmlCompositeTypeManager::replyFinished()
reply->deleteLater();
}
-void QmlCompositeTypeManager::resourceReplyFinished()
+void QDeclarativeCompositeTypeManager::resourceReplyFinished()
{
QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
- QmlCompositeTypeResource *resource = resources.value(reply->url());
+ QDeclarativeCompositeTypeResource *resource = resources.value(reply->url());
Q_ASSERT(resource);
if (reply->error() != QNetworkReply::NoError) {
- resource->status = QmlCompositeTypeResource::Error;
+ resource->status = QDeclarativeCompositeTypeResource::Error;
} else {
- resource->status = QmlCompositeTypeResource::Complete;
+ resource->status = QDeclarativeCompositeTypeResource::Complete;
resource->data = reply->readAll();
}
@@ -279,7 +279,7 @@ static QString toLocalFileOrQrc(const QUrl& url)
return r;
}
-void QmlCompositeTypeManager::loadResource(QmlCompositeTypeResource *resource)
+void QDeclarativeCompositeTypeManager::loadResource(QDeclarativeCompositeTypeResource *resource)
{
QUrl url(resource->url);
@@ -289,9 +289,9 @@ void QmlCompositeTypeManager::loadResource(QmlCompositeTypeResource *resource)
QFile file(lf);
if (file.open(QFile::ReadOnly)) {
resource->data = file.readAll();
- resource->status = QmlCompositeTypeResource::Complete;
+ resource->status = QDeclarativeCompositeTypeResource::Complete;
} else {
- resource->status = QmlCompositeTypeResource::Error;
+ resource->status = QDeclarativeCompositeTypeResource::Error;
}
} else {
@@ -304,7 +304,7 @@ void QmlCompositeTypeManager::loadResource(QmlCompositeTypeResource *resource)
}
}
-void QmlCompositeTypeManager::loadSource(QmlCompositeTypeData *unit)
+void QDeclarativeCompositeTypeManager::loadSource(QDeclarativeCompositeTypeData *unit)
{
QUrl url(unit->imports.baseUrl());
@@ -319,11 +319,11 @@ void QmlCompositeTypeManager::loadSource(QmlCompositeTypeData *unit)
QString errorDescription;
// ### - Fill in error
errorDescription = QLatin1String("File error for URL ") + url.toString();
- unit->status = QmlCompositeTypeData::Error;
+ unit->status = QDeclarativeCompositeTypeData::Error;
// ### FIXME
- QmlError error;
+ QDeclarativeError error;
error.setDescription(errorDescription);
- unit->errorType = QmlCompositeTypeData::AccessError;
+ unit->errorType = QDeclarativeCompositeTypeData::AccessError;
unit->errors << error;
doComplete(unit);
}
@@ -338,22 +338,22 @@ void QmlCompositeTypeManager::loadSource(QmlCompositeTypeData *unit)
}
}
-void QmlCompositeTypeManager::requestProgress(qint64 received, qint64 total)
+void QDeclarativeCompositeTypeManager::requestProgress(qint64 received, qint64 total)
{
if (total <= 0)
return;
QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
- QmlCompositeTypeData *unit = components.value(reply->url());
+ QDeclarativeCompositeTypeData *unit = components.value(reply->url());
Q_ASSERT(unit);
unit->progress = qreal(received)/total;
- foreach (QmlComponentPrivate *comp, unit->waiters)
+ foreach (QDeclarativeComponentPrivate *comp, unit->waiters)
comp->updateProgress(unit->progress);
}
-void QmlCompositeTypeManager::setData(QmlCompositeTypeData *unit,
+void QDeclarativeCompositeTypeManager::setData(QDeclarativeCompositeTypeData *unit,
const QByteArray &data,
const QUrl &url)
{
@@ -366,13 +366,13 @@ void QmlCompositeTypeManager::setData(QmlCompositeTypeData *unit,
if (ok) {
compile(unit);
} else {
- unit->status = QmlCompositeTypeData::Error;
- unit->errorType = QmlCompositeTypeData::GeneralError;
+ unit->status = QDeclarativeCompositeTypeData::Error;
+ unit->errorType = QDeclarativeCompositeTypeData::GeneralError;
doComplete(unit);
}
}
-void QmlCompositeTypeManager::doComplete(QmlCompositeTypeData *unit)
+void QDeclarativeCompositeTypeManager::doComplete(QDeclarativeCompositeTypeData *unit)
{
for (int ii = 0; ii < unit->dependants.count(); ++ii) {
checkComplete(unit->dependants.at(ii));
@@ -381,12 +381,12 @@ void QmlCompositeTypeManager::doComplete(QmlCompositeTypeData *unit)
unit->dependants.clear();
while(!unit->waiters.isEmpty()) {
- QmlComponentPrivate *p = unit->waiters.takeFirst();
+ QDeclarativeComponentPrivate *p = unit->waiters.takeFirst();
p->typeDataReady();
}
}
-void QmlCompositeTypeManager::doComplete(QmlCompositeTypeResource *resource)
+void QDeclarativeCompositeTypeManager::doComplete(QDeclarativeCompositeTypeResource *resource)
{
for (int ii = 0; ii < resource->dependants.count(); ++ii) {
checkComplete(resource->dependants.at(ii));
@@ -395,54 +395,54 @@ void QmlCompositeTypeManager::doComplete(QmlCompositeTypeResource *resource)
resource->dependants.clear();
}
-void QmlCompositeTypeManager::checkComplete(QmlCompositeTypeData *unit)
+void QDeclarativeCompositeTypeManager::checkComplete(QDeclarativeCompositeTypeData *unit)
{
- if (unit->status != QmlCompositeTypeData::Waiting
- && unit->status != QmlCompositeTypeData::WaitingResources)
+ if (unit->status != QDeclarativeCompositeTypeData::Waiting
+ && unit->status != QDeclarativeCompositeTypeData::WaitingResources)
return;
int waiting = 0;
for (int ii = 0; ii < unit->resources.count(); ++ii) {
- QmlCompositeTypeResource *r = unit->resources.at(ii);
+ QDeclarativeCompositeTypeResource *r = unit->resources.at(ii);
if (!r)
continue;
- if (r->status == QmlCompositeTypeResource::Error) {
- unit->status = QmlCompositeTypeData::Error;
- QmlError error;
+ if (r->status == QDeclarativeCompositeTypeResource::Error) {
+ unit->status = QDeclarativeCompositeTypeData::Error;
+ QDeclarativeError error;
error.setUrl(unit->imports.baseUrl());
error.setDescription(tr("Resource %1 unavailable").arg(r->url));
unit->errors << error;
doComplete(unit);
return;
- } else if (r->status == QmlCompositeTypeResource::Waiting) {
+ } else if (r->status == QDeclarativeCompositeTypeResource::Waiting) {
waiting++;
}
}
if (waiting == 0) {
- if (unit->status == QmlCompositeTypeData::WaitingResources) {
+ if (unit->status == QDeclarativeCompositeTypeData::WaitingResources) {
waiting += resolveTypes(unit);
- if (unit->status != QmlCompositeTypeData::Error) {
+ if (unit->status != QDeclarativeCompositeTypeData::Error) {
if (waiting)
- unit->status = QmlCompositeTypeData::Waiting;
+ unit->status = QDeclarativeCompositeTypeData::Waiting;
} else {
return;
}
} else {
for (int ii = 0; ii < unit->types.count(); ++ii) {
- QmlCompositeTypeData *u = unit->types.at(ii).unit;
+ QDeclarativeCompositeTypeData *u = unit->types.at(ii).unit;
if (!u)
continue;
- if (u->status == QmlCompositeTypeData::Error) {
- unit->status = QmlCompositeTypeData::Error;
+ if (u->status == QDeclarativeCompositeTypeData::Error) {
+ unit->status = QDeclarativeCompositeTypeData::Error;
unit->errors = u->errors;
doComplete(unit);
return;
- } else if (u->status == QmlCompositeTypeData::Waiting) {
+ } else if (u->status == QDeclarativeCompositeTypeData::Waiting) {
waiting++;
}
}
@@ -450,20 +450,20 @@ void QmlCompositeTypeManager::checkComplete(QmlCompositeTypeData *unit)
}
if (!waiting) {
- unit->status = QmlCompositeTypeData::Complete;
+ unit->status = QDeclarativeCompositeTypeData::Complete;
doComplete(unit);
}
}
-int QmlCompositeTypeManager::resolveTypes(QmlCompositeTypeData *unit)
+int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData *unit)
{
// not called until all resources are loaded (they include import URLs)
int waiting = 0;
- foreach (QmlScriptParser::Import imp, unit->data.imports()) {
+ foreach (QDeclarativeScriptParser::Import imp, unit->data.imports()) {
QString qmldir;
- if (imp.type == QmlScriptParser::Import::File && imp.qualifier.isEmpty()) {
+ if (imp.type == QDeclarativeScriptParser::Import::File && imp.qualifier.isEmpty()) {
QString importUrl = unit->imports.baseUrl().resolved(QUrl(imp.uri + QLatin1String("/qmldir"))).toString();
for (int ii = 0; ii < unit->resources.count(); ++ii) {
if (unit->resources.at(ii)->url == importUrl) {
@@ -486,58 +486,58 @@ int QmlCompositeTypeManager::resolveTypes(QmlCompositeTypeData *unit)
}
}
- if (!QmlEnginePrivate::get(engine)->
+ if (!QDeclarativeEnginePrivate::get(engine)->
addToImport(&unit->imports, qmldir, imp.uri, imp.qualifier, vmaj, vmin, imp.type))
{
- QmlError error;
+ QDeclarativeError error;
error.setUrl(unit->imports.baseUrl());
error.setDescription(tr("Import %1 unavailable").arg(imp.uri));
- unit->status = QmlCompositeTypeData::Error;
- unit->errorType = QmlCompositeTypeData::GeneralError;
+ unit->status = QDeclarativeCompositeTypeData::Error;
+ unit->errorType = QDeclarativeCompositeTypeData::GeneralError;
unit->errors << error;
doComplete(unit);
return 0;
}
}
- QList<QmlScriptParser::TypeReference*> types = unit->data.referencedTypes();
+ QList<QDeclarativeScriptParser::TypeReference*> types = unit->data.referencedTypes();
for (int ii = 0; ii < types.count(); ++ii) {
- QmlScriptParser::TypeReference *parserRef = types.at(ii);
+ QDeclarativeScriptParser::TypeReference *parserRef = types.at(ii);
QByteArray typeName = parserRef->name.toUtf8();
- QmlCompositeTypeData::TypeReference ref;
+ QDeclarativeCompositeTypeData::TypeReference ref;
QUrl url;
int majorVersion;
int minorVersion;
- QmlEnginePrivate::ImportedNamespace *typeNamespace = 0;
- if (!QmlEnginePrivate::get(engine)->resolveType(unit->imports, typeName, &ref.type, &url, &majorVersion, &minorVersion, &typeNamespace)
+ QDeclarativeEnginePrivate::ImportedNamespace *typeNamespace = 0;
+ if (!QDeclarativeEnginePrivate::get(engine)->resolveType(unit->imports, typeName, &ref.type, &url, &majorVersion, &minorVersion, &typeNamespace)
|| typeNamespace)
{
// Known to not be a type:
// - known to be a namespace (Namespace {})
// - type with unknown namespace (UnknownNamespace.SomeType {})
- QmlError error;
+ QDeclarativeError error;
error.setUrl(unit->imports.baseUrl());
if (typeNamespace)
error.setDescription(tr("Namespace %1 cannot be used as a type").arg(QString::fromUtf8(typeName)));
else
error.setDescription(tr("%1 is not a type").arg(QString::fromUtf8(typeName)));
if (!parserRef->refObjects.isEmpty()) {
- QmlParser::Object *obj = parserRef->refObjects.first();
+ QDeclarativeParser::Object *obj = parserRef->refObjects.first();
error.setLine(obj->location.start.line);
error.setColumn(obj->location.start.column);
}
- unit->status = QmlCompositeTypeData::Error;
- unit->errorType = QmlCompositeTypeData::GeneralError;
+ unit->status = QDeclarativeCompositeTypeData::Error;
+ unit->errorType = QDeclarativeCompositeTypeData::GeneralError;
unit->errors << error;
doComplete(unit);
return 0;
}
if (ref.type) {
- foreach (QmlParser::Object *obj, parserRef->refObjects) {
+ foreach (QDeclarativeParser::Object *obj, parserRef->refObjects) {
// store namespace for DOM
obj->majorVersion = majorVersion;
obj->minorVersion = minorVersion;
@@ -546,11 +546,11 @@ int QmlCompositeTypeManager::resolveTypes(QmlCompositeTypeData *unit)
continue;
}
- QmlCompositeTypeData *urlUnit = components.value(url);
+ QDeclarativeCompositeTypeData *urlUnit = components.value(url);
if (!urlUnit) {
- urlUnit = new QmlCompositeTypeData;
- urlUnit->status = QmlCompositeTypeData::Waiting;
+ urlUnit = new QDeclarativeCompositeTypeData;
+ urlUnit->status = QDeclarativeCompositeTypeData::Waiting;
urlUnit->imports.setBaseUrl(url);
components.insert(url, urlUnit);
@@ -559,30 +559,30 @@ int QmlCompositeTypeManager::resolveTypes(QmlCompositeTypeData *unit)
ref.unit = urlUnit;
switch(urlUnit->status) {
- case QmlCompositeTypeData::Invalid:
- case QmlCompositeTypeData::Error:
- unit->status = QmlCompositeTypeData::Error;
+ case QDeclarativeCompositeTypeData::Invalid:
+ case QDeclarativeCompositeTypeData::Error:
+ unit->status = QDeclarativeCompositeTypeData::Error;
{
- QmlError error;
+ QDeclarativeError error;
error.setUrl(unit->imports.baseUrl());
error.setDescription(tr("Type %1 unavailable").arg(QString::fromUtf8(typeName)));
if (!parserRef->refObjects.isEmpty()) {
- QmlParser::Object *obj = parserRef->refObjects.first();
+ QDeclarativeParser::Object *obj = parserRef->refObjects.first();
error.setLine(obj->location.start.line);
error.setColumn(obj->location.start.column);
}
unit->errors << error;
}
- if (urlUnit->errorType != QmlCompositeTypeData::AccessError)
+ if (urlUnit->errorType != QDeclarativeCompositeTypeData::AccessError)
unit->errors << urlUnit->errors;
doComplete(unit);
return 0;
- case QmlCompositeTypeData::Complete:
+ case QDeclarativeCompositeTypeData::Complete:
break;
- case QmlCompositeTypeData::Waiting:
- case QmlCompositeTypeData::WaitingResources:
+ case QDeclarativeCompositeTypeData::Waiting:
+ case QDeclarativeCompositeTypeData::WaitingResources:
unit->addref();
ref.unit->dependants << unit;
waiting++;
@@ -595,14 +595,14 @@ int QmlCompositeTypeManager::resolveTypes(QmlCompositeTypeData *unit)
}
// ### Check ref counting in here
-void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
+void QDeclarativeCompositeTypeManager::compile(QDeclarativeCompositeTypeData *unit)
{
int waiting = 0;
QList<QUrl> resourceList = unit->data.referencedResources();
- foreach (QmlScriptParser::Import imp, unit->data.imports()) {
- if (imp.type == QmlScriptParser::Import::File && imp.qualifier.isEmpty()) {
+ foreach (QDeclarativeScriptParser::Import imp, unit->data.imports()) {
+ if (imp.type == QDeclarativeScriptParser::Import::File && imp.qualifier.isEmpty()) {
QUrl importUrl = unit->imports.baseUrl().resolved(QUrl(imp.uri + QLatin1String("/qmldir")));
if (toLocalFileOrQrc(importUrl).isEmpty()) {
// Import requires remote qmldir
@@ -614,11 +614,11 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
for (int ii = 0; ii < resourceList.count(); ++ii) {
QUrl url = unit->imports.baseUrl().resolved(resourceList.at(ii));
- QmlCompositeTypeResource *resource = resources.value(url);
+ QDeclarativeCompositeTypeResource *resource = resources.value(url);
if (!resource) {
- resource = new QmlCompositeTypeResource;
- resource->status = QmlCompositeTypeResource::Waiting;
+ resource = new QDeclarativeCompositeTypeResource;
+ resource->status = QDeclarativeCompositeTypeResource::Waiting;
resource->url = url.toString();
resources.insert(url, resource);
@@ -626,11 +626,11 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
}
switch(resource->status) {
- case QmlCompositeTypeResource::Invalid:
- case QmlCompositeTypeResource::Error:
- unit->status = QmlCompositeTypeData::Error;
+ case QDeclarativeCompositeTypeResource::Invalid:
+ case QDeclarativeCompositeTypeResource::Error:
+ unit->status = QDeclarativeCompositeTypeData::Error;
{
- QmlError error;
+ QDeclarativeError error;
error.setUrl(unit->imports.baseUrl());
error.setDescription(tr("Resource %1 unavailable").arg(resource->url));
unit->errors << error;
@@ -638,10 +638,10 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
doComplete(unit);
return;
- case QmlCompositeTypeData::Complete:
+ case QDeclarativeCompositeTypeData::Complete:
break;
- case QmlCompositeTypeData::Waiting:
+ case QDeclarativeCompositeTypeData::Waiting:
unit->addref();
resource->dependants << unit;
waiting++;
@@ -654,16 +654,16 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit)
if (waiting == 0) {
waiting += resolveTypes(unit);
- if (unit->status != QmlCompositeTypeData::Error) {
+ if (unit->status != QDeclarativeCompositeTypeData::Error) {
if (!waiting) {
- unit->status = QmlCompositeTypeData::Complete;
+ unit->status = QDeclarativeCompositeTypeData::Complete;
doComplete(unit);
} else {
- unit->status = QmlCompositeTypeData::Waiting;
+ unit->status = QDeclarativeCompositeTypeData::Waiting;
}
}
} else {
- unit->status = QmlCompositeTypeData::WaitingResources;
+ unit->status = QDeclarativeCompositeTypeData::WaitingResources;
}
}
diff --git a/src/declarative/qml/qmlcompositetypemanager_p.h b/src/declarative/qml/qdeclarativecompositetypemanager_p.h
index 2da5d34..03d16b8 100644
--- a/src/declarative/qml/qmlcompositetypemanager_p.h
+++ b/src/declarative/qml/qdeclarativecompositetypemanager_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLCOMPOSITETYPEMANAGER_P_H
-#define QMLCOMPOSITETYPEMANAGER_P_H
+#ifndef QDECLARATIVECOMPOSITETYPEMANAGER_P_H
+#define QDECLARATIVECOMPOSITETYPEMANAGER_P_H
//
// W A R N I N G
@@ -53,36 +53,36 @@
// We mean it.
//
-#include "qmlscriptparser_p.h"
-#include "qmlrefcount_p.h"
-#include "qmlerror.h"
-#include "qmlengine.h"
+#include "qdeclarativescriptparser_p.h"
+#include "qdeclarativerefcount_p.h"
+#include "qdeclarativeerror.h"
+#include "qdeclarativeengine.h"
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
-class QmlCompiledData;
-class QmlComponentPrivate;
-class QmlComponent;
-class QmlDomDocument;
+class QDeclarativeCompiledData;
+class QDeclarativeComponentPrivate;
+class QDeclarativeComponent;
+class QDeclarativeDomDocument;
-class QmlCompositeTypeData;
-class QmlCompositeTypeResource;
+class QDeclarativeCompositeTypeData;
+class QDeclarativeCompositeTypeResource;
-class QmlCompositeTypeManager : public QObject
+class QDeclarativeCompositeTypeManager : public QObject
{
Q_OBJECT
public:
- QmlCompositeTypeManager(QmlEngine *);
- ~QmlCompositeTypeManager();
+ QDeclarativeCompositeTypeManager(QDeclarativeEngine *);
+ ~QDeclarativeCompositeTypeManager();
- // Return a QmlCompositeTypeData for url. The QmlCompositeTypeData may be
+ // Return a QDeclarativeCompositeTypeData for url. The QDeclarativeCompositeTypeData may be
// cached.
- QmlCompositeTypeData *get(const QUrl &url);
- // Return a QmlCompositeTypeData for data, with the provided base url. The
- // QmlCompositeTypeData will not be cached.
- QmlCompositeTypeData *getImmediate(const QByteArray &data, const QUrl &url);
+ QDeclarativeCompositeTypeData *get(const QUrl &url);
+ // Return a QDeclarativeCompositeTypeData for data, with the provided base url. The
+ // QDeclarativeCompositeTypeData will not be cached.
+ QDeclarativeCompositeTypeData *getImmediate(const QByteArray &data, const QUrl &url);
// Clear cached types. Only types that aren't in the Waiting state will
// be cleared.
@@ -94,24 +94,24 @@ private Q_SLOTS:
void requestProgress(qint64 received, qint64 total);
private:
- void loadSource(QmlCompositeTypeData *);
- void loadResource(QmlCompositeTypeResource *);
- void compile(QmlCompositeTypeData *);
- void setData(QmlCompositeTypeData *, const QByteArray &, const QUrl &);
-
- void doComplete(QmlCompositeTypeData *);
- void doComplete(QmlCompositeTypeResource *);
- void checkComplete(QmlCompositeTypeData *);
- int resolveTypes(QmlCompositeTypeData *);
-
- QmlEngine *engine;
- typedef QHash<QUrl, QmlCompositeTypeData *> Components;
+ void loadSource(QDeclarativeCompositeTypeData *);
+ void loadResource(QDeclarativeCompositeTypeResource *);
+ void compile(QDeclarativeCompositeTypeData *);
+ void setData(QDeclarativeCompositeTypeData *, const QByteArray &, const QUrl &);
+
+ void doComplete(QDeclarativeCompositeTypeData *);
+ void doComplete(QDeclarativeCompositeTypeResource *);
+ void checkComplete(QDeclarativeCompositeTypeData *);
+ int resolveTypes(QDeclarativeCompositeTypeData *);
+
+ QDeclarativeEngine *engine;
+ typedef QHash<QUrl, QDeclarativeCompositeTypeData *> Components;
Components components;
- typedef QHash<QUrl, QmlCompositeTypeResource *> Resources;
+ typedef QHash<QUrl, QDeclarativeCompositeTypeResource *> Resources;
Resources resources;
};
QT_END_NAMESPACE
-#endif // QMLCOMPOSITETYPEMANAGER_P_H
+#endif // QDECLARATIVECOMPOSITETYPEMANAGER_P_H
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp
index 1718387..b244cd8 100644
--- a/src/declarative/qml/qmlcontext.cpp
+++ b/src/declarative/qml/qdeclarativecontext.cpp
@@ -39,14 +39,14 @@
**
****************************************************************************/
-#include "qmlcontext.h"
-#include "qmlcontext_p.h"
+#include "qdeclarativecontext.h"
+#include "qdeclarativecontext_p.h"
-#include "qmlexpression_p.h"
-#include "qmlengine_p.h"
-#include "qmlengine.h"
-#include "qmlcompiledbindings_p.h"
-#include "qmlinfo.h"
+#include "qdeclarativeexpression_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativeengine.h"
+#include "qdeclarativecompiledbindings_p.h"
+#include "qdeclarativeinfo.h"
#include <qscriptengine.h>
#include <QtCore/qvarlengtharray.h>
@@ -56,22 +56,22 @@
QT_BEGIN_NAMESPACE
-QmlContextPrivate::QmlContextPrivate()
+QDeclarativeContextPrivate::QDeclarativeContextPrivate()
: parent(0), engine(0), isInternal(false), propertyNames(0),
notifyIndex(-1), highPriorityCount(0), imports(0), expressions(0), contextObjects(0),
idValues(0), idValueCount(0), optimizedBindings(0)
{
}
-void QmlContextPrivate::addScript(const QmlParser::Object::ScriptBlock &script, QObject *scopeObject)
+void QDeclarativeContextPrivate::addScript(const QDeclarativeParser::Object::ScriptBlock &script, QObject *scopeObject)
{
- Q_Q(QmlContext);
+ Q_Q(QDeclarativeContext);
if (!engine)
return;
- QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(engine);
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine);
scriptContext->pushScope(enginePriv->contextClass->newContext(q, scopeObject));
@@ -83,8 +83,8 @@ void QmlContextPrivate::addScript(const QmlParser::Object::ScriptBlock &script,
scriptEngine->evaluate(script.codes.at(ii), script.files.at(ii), script.lineNumbers.at(ii));
if (scriptEngine->hasUncaughtException()) {
- QmlError error;
- QmlExpressionPrivate::exceptionToError(scriptEngine, error);
+ QDeclarativeError error;
+ QDeclarativeExpressionPrivate::exceptionToError(scriptEngine, error);
qWarning().nospace() << qPrintable(error.toString());
}
}
@@ -94,9 +94,9 @@ void QmlContextPrivate::addScript(const QmlParser::Object::ScriptBlock &script,
scripts.append(scope);
}
-void QmlContextPrivate::destroyed(ContextGuard *guard)
+void QDeclarativeContextPrivate::destroyed(ContextGuard *guard)
{
- Q_Q(QmlContext);
+ Q_Q(QDeclarativeContext);
// process of being deleted (which is *probably* why obj has been destroyed
// anyway), as we're about to get deleted which will invalidate all the
@@ -120,43 +120,43 @@ void QmlContextPrivate::destroyed(ContextGuard *guard)
}
}
-void QmlContextPrivate::init()
+void QDeclarativeContextPrivate::init()
{
- Q_Q(QmlContext);
+ Q_Q(QDeclarativeContext);
if (parent)
parent->d_func()->childContexts.insert(q);
}
/*!
- \class QmlContext
+ \class QDeclarativeContext
\since 4.7
- \brief The QmlContext class defines a context within a QML engine.
+ \brief The QDeclarativeContext class defines a context within a QML engine.
\mainclass
Contexts allow data to be exposed to the QML components instantiated by the
QML engine.
- Each QmlContext contains a set of properties, distinct from
+ Each QDeclarativeContext contains a set of properties, distinct from
its QObject properties, that allow data to be
explicitly bound to a context by name. The context properties are defined or
- updated by calling QmlContext::setContextProperty(). The following example shows
+ updated by calling QDeclarativeContext::setContextProperty(). The following example shows
a Qt model being bound to a context and then accessed from a QML file.
\code
- QmlEngine engine;
- QmlContext context(engine.rootContext());
+ QDeclarativeEngine engine;
+ QDeclarativeContext context(engine.rootContext());
context.setContextProperty("myModel", modelData);
- QmlComponent component(&engine, "ListView { model=myModel }");
+ QDeclarativeComponent component(&engine, "ListView { model=myModel }");
component.create(&context);
\endcode
To simplify binding and maintaining larger data sets, QObject's can be
- added to a QmlContext. These objects are known as the context's default
+ added to a QDeclarativeContext. These objects are known as the context's default
objects. In this case all the properties of the QObject are
made available by name in the context, as though they were all individually
- added by calling QmlContext::setContextProperty(). Changes to the property's
+ added by calling QDeclarativeContext::setContextProperty(). Changes to the property's
values are detected through the property's notify signal. This method is
also slightly more faster than manually adding property values.
@@ -171,33 +171,33 @@ void QmlContextPrivate::init()
};
MyDataSet myDataSet;
- QmlEngine engine;
- QmlContext context(engine.rootContext());
+ QDeclarativeEngine engine;
+ QDeclarativeContext context(engine.rootContext());
context.addDefaultObject(&myDataSet);
- QmlComponent component(&engine, "ListView { model=myModel }");
+ QDeclarativeComponent component(&engine, "ListView { model=myModel }");
component.create(&context);
\endcode
Default objects added first take precedence over those added later. All properties
- added explicitly by QmlContext::setContextProperty() take precedence over default
+ added explicitly by QDeclarativeContext::setContextProperty() take precedence over default
object properties.
- Contexts are hierarchal, with the \l {QmlEngine::rootContext()}{root context}
- being created by the QmlEngine. A component instantiated in a given context
+ Contexts are hierarchal, with the \l {QDeclarativeEngine::rootContext()}{root context}
+ being created by the QDeclarativeEngine. A component instantiated in a given context
has access to that context's data, as well as the data defined by its
ancestor contexts. Data values (including those added implicitly by the
default objects) in a context override those in ancestor contexts. Data
- that should be available to all components instantiated by the QmlEngine
- should be added to the \l {QmlEngine::rootContext()}{root context}.
+ that should be available to all components instantiated by the QDeclarativeEngine
+ should be added to the \l {QDeclarativeEngine::rootContext()}{root context}.
In the following example,
\code
- QmlEngine engine;
- QmlContext context1(engine.rootContext());
- QmlContext context2(&context1);
- QmlContext context3(&context2);
+ QDeclarativeEngine engine;
+ QDeclarativeContext context1(engine.rootContext());
+ QDeclarativeContext context2(&context1);
+ QDeclarativeContext context3(&context2);
context1.setContextProperty("a", 12);
context2.setContextProperty("b", 13);
@@ -213,36 +213,36 @@ void QmlContextPrivate::init()
*/
/*! \internal */
-QmlContext::QmlContext(QmlEngine *e, bool)
-: QObject(*(new QmlContextPrivate))
+QDeclarativeContext::QDeclarativeContext(QDeclarativeEngine *e, bool)
+: QObject(*(new QDeclarativeContextPrivate))
{
- Q_D(QmlContext);
+ Q_D(QDeclarativeContext);
d->engine = e;
d->init();
}
/*!
- Create a new QmlContext as a child of \a engine's root context, and the
+ Create a new QDeclarativeContext as a child of \a engine's root context, and the
QObject \a parent.
*/
-QmlContext::QmlContext(QmlEngine *engine, QObject *parent)
-: QObject(*(new QmlContextPrivate), parent)
+QDeclarativeContext::QDeclarativeContext(QDeclarativeEngine *engine, QObject *parent)
+: QObject(*(new QDeclarativeContextPrivate), parent)
{
- Q_D(QmlContext);
- QmlContext *parentContext = engine?engine->rootContext():0;
+ Q_D(QDeclarativeContext);
+ QDeclarativeContext *parentContext = engine?engine->rootContext():0;
d->parent = parentContext;
d->engine = parentContext->engine();
d->init();
}
/*!
- Create a new QmlContext with the given \a parentContext, and the
+ Create a new QDeclarativeContext with the given \a parentContext, and the
QObject \a parent.
*/
-QmlContext::QmlContext(QmlContext *parentContext, QObject *parent)
-: QObject(*(new QmlContextPrivate), parent)
+QDeclarativeContext::QDeclarativeContext(QDeclarativeContext *parentContext, QObject *parent)
+: QObject(*(new QDeclarativeContextPrivate), parent)
{
- Q_D(QmlContext);
+ Q_D(QDeclarativeContext);
d->parent = parentContext;
d->engine = parentContext->engine();
d->init();
@@ -251,10 +251,10 @@ QmlContext::QmlContext(QmlContext *parentContext, QObject *parent)
/*!
\internal
*/
-QmlContext::QmlContext(QmlContext *parentContext, QObject *parent, bool)
-: QObject(*(new QmlContextPrivate), parent)
+QDeclarativeContext::QDeclarativeContext(QDeclarativeContext *parentContext, QObject *parent, bool)
+: QObject(*(new QDeclarativeContextPrivate), parent)
{
- Q_D(QmlContext);
+ Q_D(QDeclarativeContext);
d->parent = parentContext;
d->engine = parentContext->engine();
d->isInternal = true;
@@ -262,28 +262,28 @@ QmlContext::QmlContext(QmlContext *parentContext, QObject *parent, bool)
}
/*!
- Destroys the QmlContext.
+ Destroys the QDeclarativeContext.
Any expressions, or sub-contexts dependent on this context will be
- invalidated, but not destroyed (unless they are parented to the QmlContext
+ invalidated, but not destroyed (unless they are parented to the QDeclarativeContext
object).
*/
-QmlContext::~QmlContext()
+QDeclarativeContext::~QDeclarativeContext()
{
- Q_D(QmlContext);
+ Q_D(QDeclarativeContext);
if (d->parent)
d->parent->d_func()->childContexts.remove(this);
- for (QSet<QmlContext *>::ConstIterator iter = d->childContexts.begin();
+ for (QSet<QDeclarativeContext *>::ConstIterator iter = d->childContexts.begin();
iter != d->childContexts.end();
++iter) {
(*iter)->d_func()->invalidateEngines();
(*iter)->d_func()->parent = 0;
}
- QmlAbstractExpression *expression = d->expressions;
+ QDeclarativeAbstractExpression *expression = d->expressions;
while (expression) {
- QmlAbstractExpression *nextExpression = expression->m_nextExpression;
+ QDeclarativeAbstractExpression *nextExpression = expression->m_nextExpression;
expression->m_context = 0;
expression->m_prevExpression = 0;
@@ -293,7 +293,7 @@ QmlContext::~QmlContext()
}
while (d->contextObjects) {
- QmlDeclarativeData *co = d->contextObjects;
+ QDeclarativeDeclarativeData *co = d->contextObjects;
d->contextObjects = d->contextObjects->nextContextObject;
co->context = 0;
@@ -313,12 +313,12 @@ QmlContext::~QmlContext()
delete [] d->idValues;
}
-void QmlContextPrivate::invalidateEngines()
+void QDeclarativeContextPrivate::invalidateEngines()
{
if (!engine)
return;
engine = 0;
- for (QSet<QmlContext *>::ConstIterator iter = childContexts.begin();
+ for (QSet<QDeclarativeContext *>::ConstIterator iter = childContexts.begin();
iter != childContexts.end();
++iter) {
(*iter)->d_func()->invalidateEngines();
@@ -330,15 +330,15 @@ Refreshes all expressions that could possibly depend on this context.
Refreshing flushes all context-tree dependent caches in the expressions, and should occur every
time the context tree *structure* (not values) changes.
*/
-void QmlContextPrivate::refreshExpressions()
+void QDeclarativeContextPrivate::refreshExpressions()
{
- for (QSet<QmlContext *>::ConstIterator iter = childContexts.begin();
+ for (QSet<QDeclarativeContext *>::ConstIterator iter = childContexts.begin();
iter != childContexts.end();
++iter) {
(*iter)->d_func()->refreshExpressions();
}
- QmlAbstractExpression *expression = expressions;
+ QDeclarativeAbstractExpression *expression = expressions;
while (expression) {
expression->refresh();
expression = expression->m_nextExpression;
@@ -346,22 +346,22 @@ void QmlContextPrivate::refreshExpressions()
}
/*!
- Return the context's QmlEngine, or 0 if the context has no QmlEngine or the
- QmlEngine was destroyed.
+ Return the context's QDeclarativeEngine, or 0 if the context has no QDeclarativeEngine or the
+ QDeclarativeEngine was destroyed.
*/
-QmlEngine *QmlContext::engine() const
+QDeclarativeEngine *QDeclarativeContext::engine() const
{
- Q_D(const QmlContext);
+ Q_D(const QDeclarativeContext);
return d->engine;
}
/*!
- Return the context's parent QmlContext, or 0 if this context has no
+ Return the context's parent QDeclarativeContext, or 0 if this context has no
parent or if the parent has been destroyed.
*/
-QmlContext *QmlContext::parentContext() const
+QDeclarativeContext *QDeclarativeContext::parentContext() const
{
- Q_D(const QmlContext);
+ Q_D(const QDeclarativeContext);
return d->parent;
}
@@ -369,31 +369,31 @@ QmlContext *QmlContext::parentContext() const
Add \a defaultObject to this context. The object will be added after
any existing default objects.
*/
-void QmlContext::addDefaultObject(QObject *defaultObject)
+void QDeclarativeContext::addDefaultObject(QObject *defaultObject)
{
- Q_D(QmlContext);
+ Q_D(QDeclarativeContext);
d->defaultObjects.prepend(defaultObject);
}
/*!
Set a the \a value of the \a name property on this context.
*/
-void QmlContext::setContextProperty(const QString &name, const QVariant &value)
+void QDeclarativeContext::setContextProperty(const QString &name, const QVariant &value)
{
- Q_D(QmlContext);
+ Q_D(QDeclarativeContext);
if (d->notifyIndex == -1)
d->notifyIndex = this->metaObject()->methodCount();
if (d->engine) {
bool ok;
- QObject *o = QmlEnginePrivate::get(d->engine)->toQObject(value, &ok);
+ QObject *o = QDeclarativeEnginePrivate::get(d->engine)->toQObject(value, &ok);
if (ok) {
setContextProperty(name, o);
return;
}
}
- if (!d->propertyNames) d->propertyNames = new QmlIntegerCache(d->engine);
+ if (!d->propertyNames) d->propertyNames = new QDeclarativeIntegerCache(d->engine);
int idx = d->propertyNames->value(name);
if (idx == -1) {
@@ -407,10 +407,10 @@ void QmlContext::setContextProperty(const QString &name, const QVariant &value)
}
}
-void QmlContextPrivate::setIdProperty(int idx, QObject *obj)
+void QDeclarativeContextPrivate::setIdProperty(int idx, QObject *obj)
{
if (notifyIndex == -1) {
- Q_Q(QmlContext);
+ Q_Q(QDeclarativeContext);
notifyIndex = q->metaObject()->methodCount();
}
@@ -418,7 +418,7 @@ void QmlContextPrivate::setIdProperty(int idx, QObject *obj)
idValues[idx] = obj;
}
-void QmlContextPrivate::setIdPropertyData(QmlIntegerCache *data)
+void QDeclarativeContextPrivate::setIdPropertyData(QDeclarativeIntegerCache *data)
{
Q_ASSERT(!propertyNames);
propertyNames = data;
@@ -431,15 +431,15 @@ void QmlContextPrivate::setIdPropertyData(QmlIntegerCache *data)
/*!
Set the \a value of the \a name property on this context.
- QmlContext does \bold not take ownership of \a value.
+ QDeclarativeContext does \bold not take ownership of \a value.
*/
-void QmlContext::setContextProperty(const QString &name, QObject *value)
+void QDeclarativeContext::setContextProperty(const QString &name, QObject *value)
{
- Q_D(QmlContext);
+ Q_D(QDeclarativeContext);
if (d->notifyIndex == -1)
d->notifyIndex = this->metaObject()->methodCount();
- if (!d->propertyNames) d->propertyNames = new QmlIntegerCache(d->engine);
+ if (!d->propertyNames) d->propertyNames = new QDeclarativeIntegerCache(d->engine);
int idx = d->propertyNames->value(name);
if (idx == -1) {
@@ -457,9 +457,9 @@ 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
+QVariant QDeclarativeContext::contextProperty(const QString &name) const
{
- Q_D(const QmlContext);
+ Q_D(const QDeclarativeContext);
QVariant value;
int idx = -1;
if (d->propertyNames)
@@ -469,8 +469,8 @@ QVariant QmlContext::contextProperty(const QString &name) const
QByteArray utf8Name = name.toUtf8();
for (int ii = d->defaultObjects.count() - 1; ii >= 0; --ii) {
QObject *obj = d->defaultObjects.at(ii);
- QmlPropertyCache::Data local;
- QmlPropertyCache::Data *property = QmlPropertyCache::property(d->engine, obj, name, local);
+ QDeclarativePropertyCache::Data local;
+ QDeclarativePropertyCache::Data *property = QDeclarativePropertyCache::property(d->engine, obj, name, local);
if (property) {
value = obj->metaObject()->property(property->coreIndex).read(obj);
@@ -490,12 +490,12 @@ QVariant QmlContext::contextProperty(const QString &name) const
Resolves the URL \a src relative to the URL of the
containing component.
- \sa QmlEngine::baseUrl(), setBaseUrl()
+ \sa QDeclarativeEngine::baseUrl(), setBaseUrl()
*/
-QUrl QmlContext::resolvedUrl(const QUrl &src)
+QUrl QDeclarativeContext::resolvedUrl(const QUrl &src)
{
- Q_D(QmlContext);
- QmlContext *ctxt = this;
+ Q_D(QDeclarativeContext);
+ QDeclarativeContext *ctxt = this;
if (src.isRelative() && !src.isEmpty()) {
if (ctxt) {
while(ctxt) {
@@ -524,7 +524,7 @@ QUrl QmlContext::resolvedUrl(const QUrl &src)
\sa resolvedUrl()
*/
-void QmlContext::setBaseUrl(const QUrl &baseUrl)
+void QDeclarativeContext::setBaseUrl(const QUrl &baseUrl)
{
d_func()->url = baseUrl;
}
@@ -533,9 +533,9 @@ void QmlContext::setBaseUrl(const QUrl &baseUrl)
Returns the base url of the component, or the containing component
if none is set.
*/
-QUrl QmlContext::baseUrl() const
+QUrl QDeclarativeContext::baseUrl() const
{
- const QmlContext* p = this;
+ const QDeclarativeContext* p = this;
while (p && p->d_func()->url.isEmpty()) {
p = p->parentContext();
}
@@ -545,10 +545,10 @@ QUrl QmlContext::baseUrl() const
return QUrl();
}
-int QmlContextPrivate::context_count(QmlListProperty<QObject> *prop)
+int QDeclarativeContextPrivate::context_count(QDeclarativeListProperty<QObject> *prop)
{
- QmlContext *context = static_cast<QmlContext*>(prop->object);
- QmlContextPrivate *d = QmlContextPrivate::get(context);
+ QDeclarativeContext *context = static_cast<QDeclarativeContext*>(prop->object);
+ QDeclarativeContextPrivate *d = QDeclarativeContextPrivate::get(context);
int contextProperty = (int)(intptr_t)prop->data;
if (d->propertyValues.at(contextProperty).userType() != qMetaTypeId<QList<QObject*> >()) {
@@ -558,10 +558,10 @@ int QmlContextPrivate::context_count(QmlListProperty<QObject> *prop)
}
}
-QObject *QmlContextPrivate::context_at(QmlListProperty<QObject> *prop, int index)
+QObject *QDeclarativeContextPrivate::context_at(QDeclarativeListProperty<QObject> *prop, int index)
{
- QmlContext *context = static_cast<QmlContext*>(prop->object);
- QmlContextPrivate *d = QmlContextPrivate::get(context);
+ QDeclarativeContext *context = static_cast<QDeclarativeContext*>(prop->object);
+ QDeclarativeContextPrivate *d = QDeclarativeContextPrivate::get(context);
int contextProperty = (int)(intptr_t)prop->data;
if (d->propertyValues.at(contextProperty).userType() != qMetaTypeId<QList<QObject*> >()) {
diff --git a/src/declarative/qml/qmlcontext.h b/src/declarative/qml/qdeclarativecontext.h
index e96ed84..0fb9bee 100644
--- a/src/declarative/qml/qmlcontext.h
+++ b/src/declarative/qml/qdeclarativecontext.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLCONTEXT_H
-#define QMLCONTEXT_H
+#ifndef QDECLARATIVECONTEXT_H
+#define QDECLARATIVECONTEXT_H
#include <QtCore/qurl.h>
#include <QtCore/qobject.h>
@@ -54,23 +54,23 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QString;
-class QmlEngine;
-class QmlRefCount;
-class QmlContextPrivate;
-class QmlCompositeTypeData;
+class QDeclarativeEngine;
+class QDeclarativeRefCount;
+class QDeclarativeContextPrivate;
+class QDeclarativeCompositeTypeData;
-class Q_DECLARATIVE_EXPORT QmlContext : public QObject
+class Q_DECLARATIVE_EXPORT QDeclarativeContext : public QObject
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlContext)
+ Q_DECLARE_PRIVATE(QDeclarativeContext)
public:
- QmlContext(QmlEngine *parent, QObject *objParent=0);
- QmlContext(QmlContext *parent, QObject *objParent=0);
- virtual ~QmlContext();
+ QDeclarativeContext(QDeclarativeEngine *parent, QObject *objParent=0);
+ QDeclarativeContext(QDeclarativeContext *parent, QObject *objParent=0);
+ virtual ~QDeclarativeContext();
- QmlEngine *engine() const;
- QmlContext *parentContext() const;
+ QDeclarativeEngine *engine() const;
+ QDeclarativeContext *parentContext() const;
void addDefaultObject(QObject *);
void setContextProperty(const QString &, QObject *);
@@ -84,19 +84,19 @@ public:
QUrl baseUrl() const;
private:
- friend class QmlVME;
- friend class QmlEngine;
- friend class QmlEnginePrivate;
- friend class QmlExpression;
- friend class QmlExpressionPrivate;
- friend class QmlContextScriptClass;
- friend class QmlObjectScriptClass;
- friend class QmlComponent;
- friend class QmlComponentPrivate;
- friend class QmlScriptPrivate;
- friend class QmlBoundSignalProxy;
- QmlContext(QmlContext *parent, QObject *objParent, bool);
- QmlContext(QmlEngine *, bool);
+ friend class QDeclarativeVME;
+ friend class QDeclarativeEngine;
+ friend class QDeclarativeEnginePrivate;
+ friend class QDeclarativeExpression;
+ friend class QDeclarativeExpressionPrivate;
+ friend class QDeclarativeContextScriptClass;
+ friend class QDeclarativeObjectScriptClass;
+ friend class QDeclarativeComponent;
+ friend class QDeclarativeComponentPrivate;
+ friend class QDeclarativeScriptPrivate;
+ friend class QDeclarativeBoundSignalProxy;
+ QDeclarativeContext(QDeclarativeContext *parent, QObject *objParent, bool);
+ QDeclarativeContext(QDeclarativeEngine *, bool);
};
QT_END_NAMESPACE
@@ -104,4 +104,4 @@ Q_DECLARE_METATYPE(QList<QObject*>);
QT_END_HEADER
-#endif // QMLCONTEXT_H
+#endif // QDECLARATIVECONTEXT_H
diff --git a/src/declarative/qml/qmlcontext_p.h b/src/declarative/qml/qdeclarativecontext_p.h
index 965eeed..8297280 100644
--- a/src/declarative/qml/qmlcontext_p.h
+++ b/src/declarative/qml/qdeclarativecontext_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLCONTEXT_P_H
-#define QMLCONTEXT_P_H
+#ifndef QDECLARATIVECONTEXT_P_H
+#define QDECLARATIVECONTEXT_P_H
//
// W A R N I N G
@@ -53,43 +53,43 @@
// We mean it.
//
-#include "qmlcontext.h"
+#include "qdeclarativecontext.h"
-#include "qmldeclarativedata_p.h"
-#include "qmlengine_p.h"
-#include "qmlintegercache_p.h"
-#include "qmltypenamecache_p.h"
+#include "qdeclarativedeclarativedata_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativeintegercache_p.h"
+#include "qdeclarativetypenamecache_p.h"
#include <QtCore/qhash.h>
#include <QtScript/qscriptvalue.h>
#include <QtCore/qset.h>
#include <private/qobject_p.h>
-#include "qmlguard_p.h"
+#include "qdeclarativeguard_p.h"
QT_BEGIN_NAMESPACE
-class QmlContext;
-class QmlExpression;
-class QmlEngine;
-class QmlExpression;
-class QmlExpressionPrivate;
-class QmlAbstractExpression;
-class QmlBinding_Id;
-class QmlCompiledBindings;
+class QDeclarativeContext;
+class QDeclarativeExpression;
+class QDeclarativeEngine;
+class QDeclarativeExpression;
+class QDeclarativeExpressionPrivate;
+class QDeclarativeAbstractExpression;
+class QDeclarativeBinding_Id;
+class QDeclarativeCompiledBindings;
-class Q_DECLARATIVE_EXPORT QmlContextPrivate : public QObjectPrivate
+class Q_DECLARATIVE_EXPORT QDeclarativeContextPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlContext)
+ Q_DECLARE_PUBLIC(QDeclarativeContext)
public:
- QmlContextPrivate();
+ QDeclarativeContextPrivate();
- QmlContext *parent;
- QmlEngine *engine;
+ QDeclarativeContext *parent;
+ QDeclarativeEngine *engine;
bool isInternal;
- QmlIntegerCache *propertyNames;
+ QDeclarativeIntegerCache *propertyNames;
QList<QVariant> propertyValues;
int notifyIndex;
@@ -97,21 +97,21 @@ public:
int highPriorityCount;
QList<QScriptValue> scripts;
- void addScript(const QmlParser::Object::ScriptBlock &, QObject *);
+ void addScript(const QDeclarativeParser::Object::ScriptBlock &, QObject *);
QUrl url;
- QmlTypeNameCache *imports;
+ QDeclarativeTypeNameCache *imports;
void init();
void invalidateEngines();
void refreshExpressions();
- QSet<QmlContext *> childContexts;
+ QSet<QDeclarativeContext *> childContexts;
- QmlAbstractExpression *expressions;
+ QDeclarativeAbstractExpression *expressions;
- QmlDeclarativeData *contextObjects;
+ QDeclarativeDeclarativeData *contextObjects;
struct IdNotifier
{
@@ -126,48 +126,48 @@ public:
int methodIndex;
};
- struct ContextGuard : public QmlGuard<QObject>
+ struct ContextGuard : public QDeclarativeGuard<QObject>
{
inline ContextGuard();
inline ContextGuard &operator=(QObject *obj);
inline virtual void objectDestroyed(QObject *);
- QmlContextPrivate *priv;
+ QDeclarativeContextPrivate *priv;
IdNotifier *bindings;
};
ContextGuard *idValues;
int idValueCount;
void setIdProperty(int, QObject *);
- void setIdPropertyData(QmlIntegerCache *);
+ void setIdPropertyData(QDeclarativeIntegerCache *);
void destroyed(ContextGuard *);
- static QmlContextPrivate *get(QmlContext *context) {
- return static_cast<QmlContextPrivate *>(QObjectPrivate::get(context));
+ static QDeclarativeContextPrivate *get(QDeclarativeContext *context) {
+ return static_cast<QDeclarativeContextPrivate *>(QObjectPrivate::get(context));
}
- static QmlContext *get(QmlContextPrivate *context) {
- return static_cast<QmlContext *>(context->q_func());
+ static QDeclarativeContext *get(QDeclarativeContextPrivate *context) {
+ return static_cast<QDeclarativeContext *>(context->q_func());
}
- QmlCompiledBindings *optimizedBindings;
+ QDeclarativeCompiledBindings *optimizedBindings;
// Only used for debugging
QList<QPointer<QObject> > instances;
- static int context_count(QmlListProperty<QObject> *);
- static QObject *context_at(QmlListProperty<QObject> *, int);
+ static int context_count(QDeclarativeListProperty<QObject> *);
+ static QObject *context_at(QDeclarativeListProperty<QObject> *, int);
};
-QmlContextPrivate::IdNotifier::IdNotifier()
+QDeclarativeContextPrivate::IdNotifier::IdNotifier()
: next(0), prev(0), target(0), methodIndex(-1)
{
}
-QmlContextPrivate::IdNotifier::~IdNotifier()
+QDeclarativeContextPrivate::IdNotifier::~IdNotifier()
{
clear();
}
-void QmlContextPrivate::IdNotifier::clear()
+void QDeclarativeContextPrivate::IdNotifier::clear()
{
if (next) next->prev = prev;
if (prev) *prev = next;
@@ -175,21 +175,21 @@ void QmlContextPrivate::IdNotifier::clear()
methodIndex = -1;
}
-QmlContextPrivate::ContextGuard::ContextGuard()
+QDeclarativeContextPrivate::ContextGuard::ContextGuard()
: priv(0), bindings(0)
{
}
-QmlContextPrivate::ContextGuard &QmlContextPrivate::ContextGuard::operator=(QObject *obj)
+QDeclarativeContextPrivate::ContextGuard &QDeclarativeContextPrivate::ContextGuard::operator=(QObject *obj)
{
- (QmlGuard<QObject>&)*this = obj; return *this;
+ (QDeclarativeGuard<QObject>&)*this = obj; return *this;
}
-void QmlContextPrivate::ContextGuard::objectDestroyed(QObject *)
+void QDeclarativeContextPrivate::ContextGuard::objectDestroyed(QObject *)
{
priv->destroyed(this);
}
QT_END_NAMESPACE
-#endif // QMLCONTEXT_P_H
+#endif // QDECLARATIVECONTEXT_P_H
diff --git a/src/declarative/qml/qmlcontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
index 4c71903..7deed0b 100644
--- a/src/declarative/qml/qmlcontextscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
@@ -39,34 +39,34 @@
**
****************************************************************************/
-#include "qmlcontextscriptclass_p.h"
+#include "qdeclarativecontextscriptclass_p.h"
-#include "qmlengine_p.h"
-#include "qmlcontext_p.h"
-#include "qmltypenamescriptclass_p.h"
-#include "qmllistscriptclass_p.h"
-#include "qmlguard_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativecontext_p.h"
+#include "qdeclarativetypenamescriptclass_p.h"
+#include "qdeclarativelistscriptclass_p.h"
+#include "qdeclarativeguard_p.h"
QT_BEGIN_NAMESPACE
struct ContextData : public QScriptDeclarativeClass::Object {
ContextData() : isSharedContext(true) {}
- ContextData(QmlContext *c, QObject *o) : context(c), scopeObject(o), isSharedContext(false) {}
- QmlGuard<QmlContext> context;
- QmlGuard<QObject> scopeObject;
+ ContextData(QDeclarativeContext *c, QObject *o) : context(c), scopeObject(o), isSharedContext(false) {}
+ QDeclarativeGuard<QDeclarativeContext> context;
+ QDeclarativeGuard<QObject> scopeObject;
bool isSharedContext;
- QmlContext *getContext(QmlEngine *engine) {
+ QDeclarativeContext *getContext(QDeclarativeEngine *engine) {
if (isSharedContext) {
- return QmlEnginePrivate::get(engine)->sharedContext;
+ return QDeclarativeEnginePrivate::get(engine)->sharedContext;
} else {
return context.data();
}
}
- QObject *getScope(QmlEngine *engine) {
+ QObject *getScope(QDeclarativeEngine *engine) {
if (isSharedContext) {
- return QmlEnginePrivate::get(engine)->sharedScope;
+ return QDeclarativeEnginePrivate::get(engine)->sharedScope;
} else {
return scopeObject.data();
}
@@ -74,34 +74,34 @@ struct ContextData : public QScriptDeclarativeClass::Object {
};
/*
- The QmlContextScriptClass handles property access for a QmlContext
+ The QDeclarativeContextScriptClass handles property access for a QDeclarativeContext
via QtScript.
*/
-QmlContextScriptClass::QmlContextScriptClass(QmlEngine *bindEngine)
-: QmlScriptClass(QmlEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine),
+QDeclarativeContextScriptClass::QDeclarativeContextScriptClass(QDeclarativeEngine *bindEngine)
+: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine),
lastScopeObject(0), lastContext(0), lastData(0), lastPropertyIndex(-1), lastDefaultObject(-1)
{
}
-QmlContextScriptClass::~QmlContextScriptClass()
+QDeclarativeContextScriptClass::~QDeclarativeContextScriptClass()
{
}
-QScriptValue QmlContextScriptClass::newContext(QmlContext *context, QObject *scopeObject)
+QScriptValue QDeclarativeContextScriptClass::newContext(QDeclarativeContext *context, QObject *scopeObject)
{
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
return newObject(scriptEngine, this, new ContextData(context, scopeObject));
}
-QScriptValue QmlContextScriptClass::newSharedContext()
+QScriptValue QDeclarativeContextScriptClass::newSharedContext()
{
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
return newObject(scriptEngine, this, new ContextData());
}
-QmlContext *QmlContextScriptClass::contextFromValue(const QScriptValue &v)
+QDeclarativeContext *QDeclarativeContextScriptClass::contextFromValue(const QScriptValue &v)
{
if (scriptClass(v) != this)
return 0;
@@ -111,7 +111,7 @@ QmlContext *QmlContextScriptClass::contextFromValue(const QScriptValue &v)
}
QScriptClass::QueryFlags
-QmlContextScriptClass::queryProperty(Object *object, const Identifier &name,
+QDeclarativeContextScriptClass::queryProperty(Object *object, const Identifier &name,
QScriptClass::QueryFlags flags)
{
Q_UNUSED(flags);
@@ -122,7 +122,7 @@ QmlContextScriptClass::queryProperty(Object *object, const Identifier &name,
lastPropertyIndex = -1;
lastDefaultObject = -1;
- QmlContext *bindContext = ((ContextData *)object)->getContext(engine);
+ QDeclarativeContext *bindContext = ((ContextData *)object)->getContext(engine);
QObject *scopeObject = ((ContextData *)object)->getScope(engine);
if (!bindContext)
return 0;
@@ -141,13 +141,13 @@ QmlContextScriptClass::queryProperty(Object *object, const Identifier &name,
}
QScriptClass::QueryFlags
-QmlContextScriptClass::queryProperty(QmlContext *bindContext, QObject *scopeObject,
+QDeclarativeContextScriptClass::queryProperty(QDeclarativeContext *bindContext, QObject *scopeObject,
const Identifier &name,
QScriptClass::QueryFlags flags,
bool includeTypes)
{
- QmlEnginePrivate *ep = QmlEnginePrivate::get(engine);
- QmlContextPrivate *cp = QmlContextPrivate::get(bindContext);
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
+ QDeclarativeContextPrivate *cp = QDeclarativeContextPrivate::get(bindContext);
lastPropertyIndex = cp->propertyNames?cp->propertyNames->value(name):-1;
if (lastPropertyIndex != -1) {
@@ -156,7 +156,7 @@ QmlContextScriptClass::queryProperty(QmlContext *bindContext, QObject *scopeObje
}
if (includeTypes && cp->imports) {
- QmlTypeNameCache::Data *data = cp->imports->data(name);
+ QDeclarativeTypeNameCache::Data *data = cp->imports->data(name);
if (data) {
lastData = data;
@@ -176,7 +176,7 @@ QmlContextScriptClass::queryProperty(QmlContext *bindContext, QObject *scopeObje
if (scopeObject) {
QScriptClass::QueryFlags rv =
ep->objectClass->queryProperty(scopeObject, name, flags, bindContext,
- QmlObjectScriptClass::ImplicitObject | QmlObjectScriptClass::SkipAttachedProperties);
+ QDeclarativeObjectScriptClass::ImplicitObject | QDeclarativeObjectScriptClass::SkipAttachedProperties);
if (rv) {
lastScopeObject = scopeObject;
lastContext = bindContext;
@@ -187,7 +187,7 @@ QmlContextScriptClass::queryProperty(QmlContext *bindContext, QObject *scopeObje
for (int ii = cp->defaultObjects.count() - 1; ii >= 0; --ii) {
QScriptClass::QueryFlags rv =
ep->objectClass->queryProperty(cp->defaultObjects.at(ii), name, flags, bindContext,
- QmlObjectScriptClass::ImplicitObject | QmlObjectScriptClass::SkipAttachedProperties);
+ QDeclarativeObjectScriptClass::ImplicitObject | QDeclarativeObjectScriptClass::SkipAttachedProperties);
if (rv) {
lastDefaultObject = ii;
@@ -199,17 +199,17 @@ QmlContextScriptClass::queryProperty(QmlContext *bindContext, QObject *scopeObje
return 0;
}
-QmlContextScriptClass::ScriptValue
-QmlContextScriptClass::property(Object *object, const Identifier &name)
+QDeclarativeContextScriptClass::ScriptValue
+QDeclarativeContextScriptClass::property(Object *object, const Identifier &name)
{
Q_UNUSED(object);
- QmlContext *bindContext = lastContext;
+ QDeclarativeContext *bindContext = lastContext;
Q_ASSERT(bindContext);
- QmlEnginePrivate *ep = QmlEnginePrivate::get(engine);
- QmlContextPrivate *cp = QmlContextPrivate::get(bindContext);
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
+ QDeclarativeContextPrivate *cp = QDeclarativeContextPrivate::get(bindContext);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
if (lastScopeObject) {
@@ -230,14 +230,14 @@ QmlContextScriptClass::property(Object *object, const Identifier &name)
} else {
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> >());
+ rv = ep->listClass->newList(QDeclarativeListProperty<QObject>(bindContext, (void*)lastPropertyIndex, 0, QDeclarativeContextPrivate::context_count, QDeclarativeContextPrivate::context_at), qMetaTypeId<QDeclarativeListProperty<QObject> >());
} else {
rv = ep->scriptValueFromVariant(value);
}
}
ep->capturedProperties <<
- QmlEnginePrivate::CapturedProperty(bindContext, -1, lastPropertyIndex + cp->notifyIndex);
+ QDeclarativeEnginePrivate::CapturedProperty(bindContext, -1, lastPropertyIndex + cp->notifyIndex);
return Value(scriptEngine, rv);
} else if(lastDefaultObject != -1) {
@@ -252,17 +252,17 @@ QmlContextScriptClass::property(Object *object, const Identifier &name)
}
}
-void QmlContextScriptClass::setProperty(Object *object, const Identifier &name,
+void QDeclarativeContextScriptClass::setProperty(Object *object, const Identifier &name,
const QScriptValue &value)
{
Q_UNUSED(object);
Q_ASSERT(lastScopeObject || lastDefaultObject != -1);
- QmlContext *bindContext = lastContext;
+ QDeclarativeContext *bindContext = lastContext;
Q_ASSERT(bindContext);
- QmlEnginePrivate *ep = QmlEnginePrivate::get(engine);
- QmlContextPrivate *cp = QmlContextPrivate::get(bindContext);
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
+ QDeclarativeContextPrivate *cp = QDeclarativeContextPrivate::get(bindContext);
if (lastScopeObject) {
ep->objectClass->setProperty(lastScopeObject, name, value, bindContext);
diff --git a/src/declarative/qml/qmlcontextscriptclass_p.h b/src/declarative/qml/qdeclarativecontextscriptclass_p.h
index c878f3c..26086ec 100644
--- a/src/declarative/qml/qmlcontextscriptclass_p.h
+++ b/src/declarative/qml/qdeclarativecontextscriptclass_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLCONTEXTSCRIPTCLASS_P_H
-#define QMLCONTEXTSCRIPTCLASS_P_H
+#ifndef QDECLARATIVECONTEXTSCRIPTCLASS_P_H
+#define QDECLARATIVECONTEXTSCRIPTCLASS_P_H
//
// W A R N I N G
@@ -53,23 +53,23 @@
// We mean it.
//
-#include "qmltypenamecache_p.h"
-#include "qmlscriptclass_p.h"
+#include "qdeclarativetypenamecache_p.h"
+#include "qdeclarativescriptclass_p.h"
QT_BEGIN_NAMESPACE
-class QmlEngine;
-class QmlContext;
-class QmlContextScriptClass : public QmlScriptClass
+class QDeclarativeEngine;
+class QDeclarativeContext;
+class QDeclarativeContextScriptClass : public QDeclarativeScriptClass
{
public:
- QmlContextScriptClass(QmlEngine *);
- ~QmlContextScriptClass();
+ QDeclarativeContextScriptClass(QDeclarativeEngine *);
+ ~QDeclarativeContextScriptClass();
- QScriptValue newContext(QmlContext *, QObject * = 0);
+ QScriptValue newContext(QDeclarativeContext *, QObject * = 0);
QScriptValue newSharedContext();
- QmlContext *contextFromValue(const QScriptValue &);
+ QDeclarativeContext *contextFromValue(const QScriptValue &);
protected:
virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &,
@@ -78,16 +78,16 @@ protected:
virtual void setProperty(Object *, const Identifier &name, const QScriptValue &);
private:
- QScriptClass::QueryFlags queryProperty(QmlContext *, QObject *scopeObject,
+ QScriptClass::QueryFlags queryProperty(QDeclarativeContext *, QObject *scopeObject,
const Identifier &,
QScriptClass::QueryFlags flags,
bool includeTypes);
- QmlEngine *engine;
+ QDeclarativeEngine *engine;
QObject *lastScopeObject;
- QmlContext *lastContext;
- QmlTypeNameCache::Data *lastData;
+ QDeclarativeContext *lastContext;
+ QDeclarativeTypeNameCache::Data *lastData;
int lastPropertyIndex;
int lastDefaultObject;
QScriptValue lastFunction;
@@ -97,5 +97,5 @@ private:
QT_END_NAMESPACE
-#endif // QMLCONTEXTSCRIPTCLASS_P_H
+#endif // QDECLARATIVECONTEXTSCRIPTCLASS_P_H
diff --git a/src/declarative/qml/qmlcustomparser.cpp b/src/declarative/qml/qdeclarativecustomparser.cpp
index d781110..67f0963 100644
--- a/src/declarative/qml/qmlcustomparser.cpp
+++ b/src/declarative/qml/qdeclarativecustomparser.cpp
@@ -39,35 +39,35 @@
**
****************************************************************************/
-#include "qmlcustomparser_p.h"
-#include "qmlcustomparser_p_p.h"
+#include "qdeclarativecustomparser_p.h"
+#include "qdeclarativecustomparser_p_p.h"
-#include "qmlparser_p.h"
+#include "qdeclarativeparser_p.h"
#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
-using namespace QmlParser;
+using namespace QDeclarativeParser;
/*!
- \class QmlCustomParser
- \brief The QmlCustomParser class allows you to add new arbitrary types to QML.
+ \class QDeclarativeCustomParser
+ \brief The QDeclarativeCustomParser class allows you to add new arbitrary types to QML.
\internal
- By subclassing QmlCustomParser, you can add a parser for
+ By subclassing QDeclarativeCustomParser, you can add a parser for
building a particular type.
- The subclass must implement compile() and setCustomData(), and define
- itself in the meta type system with the macro:
+ The subclass must implement compile() and setCustomData(), and register
+ itself in the meta type system by calling the macro:
\code
- QML_DEFINE_CUSTOM_TYPE(Module, MajorVersion, MinorVersion, Name, TypeClass, ParserClass)
+ QML_REGISTER_CUSTOM_TYPE(Module, MajorVersion, MinorVersion, Name, TypeClass, ParserClass)
\endcode
*/
/*
- \fn QByteArray QmlCustomParser::compile(const QList<QmlCustomParserProperty> & properties)
+ \fn QByteArray QDeclarativeCustomParser::compile(const QList<QDeclarativeCustomParserProperty> & properties)
The custom parser processes \a properties, and returns
a QByteArray containing data meaningful only to the
@@ -82,19 +82,19 @@ using namespace QmlParser;
*/
/*
- \fn void QmlCustomParser::setCustomData(QObject *object, const QByteArray &data)
+ \fn void QDeclarativeCustomParser::setCustomData(QObject *object, const QByteArray &data)
This function sets \a object to have the properties defined
by \a data, which is a block of data previously returned by a call
to compile().
- The \a object will be an instance of the TypeClass specified by QML_DEFINE_CUSTOM_TYPE.
+ The \a object will be an instance of the TypeClass specified by QML_REGISTER_CUSTOM_TYPE.
*/
-QmlCustomParserNode
-QmlCustomParserNodePrivate::fromObject(QmlParser::Object *root)
+QDeclarativeCustomParserNode
+QDeclarativeCustomParserNodePrivate::fromObject(QDeclarativeParser::Object *root)
{
- QmlCustomParserNode rootNode;
+ QDeclarativeCustomParserNode rootNode;
rootNode.d->name = root->typeName;
rootNode.d->location = root->location.start;
@@ -110,26 +110,26 @@ QmlCustomParserNodePrivate::fromObject(QmlParser::Object *root)
return rootNode;
}
-QmlCustomParserProperty
-QmlCustomParserNodePrivate::fromProperty(QmlParser::Property *p)
+QDeclarativeCustomParserProperty
+QDeclarativeCustomParserNodePrivate::fromProperty(QDeclarativeParser::Property *p)
{
- QmlCustomParserProperty prop;
+ QDeclarativeCustomParserProperty prop;
prop.d->name = p->name;
prop.d->isList = (p->values.count() > 1);
prop.d->location = p->location.start;
if (p->value) {
- QmlCustomParserNode node = fromObject(p->value);
- QList<QmlCustomParserProperty> props = node.properties();
+ QDeclarativeCustomParserNode node = fromObject(p->value);
+ QList<QDeclarativeCustomParserProperty> props = node.properties();
for (int ii = 0; ii < props.count(); ++ii)
prop.d->values << QVariant::fromValue(props.at(ii));
} else {
for(int ii = 0; ii < p->values.count(); ++ii) {
Value *v = p->values.at(ii);
- v->type = QmlParser::Value::Literal;
+ v->type = QDeclarativeParser::Value::Literal;
if(v->object) {
- QmlCustomParserNode node = fromObject(v->object);
+ QDeclarativeCustomParserNode node = fromObject(v->object);
prop.d->values << QVariant::fromValue(node);
} else {
prop.d->values << QVariant::fromValue(v->value);
@@ -141,18 +141,18 @@ QmlCustomParserNodePrivate::fromProperty(QmlParser::Property *p)
return prop;
}
-QmlCustomParserNode::QmlCustomParserNode()
-: d(new QmlCustomParserNodePrivate)
+QDeclarativeCustomParserNode::QDeclarativeCustomParserNode()
+: d(new QDeclarativeCustomParserNodePrivate)
{
}
-QmlCustomParserNode::QmlCustomParserNode(const QmlCustomParserNode &other)
-: d(new QmlCustomParserNodePrivate)
+QDeclarativeCustomParserNode::QDeclarativeCustomParserNode(const QDeclarativeCustomParserNode &other)
+: d(new QDeclarativeCustomParserNodePrivate)
{
*this = other;
}
-QmlCustomParserNode &QmlCustomParserNode::operator=(const QmlCustomParserNode &other)
+QDeclarativeCustomParserNode &QDeclarativeCustomParserNode::operator=(const QDeclarativeCustomParserNode &other)
{
d->name = other.d->name;
d->properties = other.d->properties;
@@ -160,38 +160,38 @@ QmlCustomParserNode &QmlCustomParserNode::operator=(const QmlCustomParserNode &o
return *this;
}
-QmlCustomParserNode::~QmlCustomParserNode()
+QDeclarativeCustomParserNode::~QDeclarativeCustomParserNode()
{
delete d; d = 0;
}
-QByteArray QmlCustomParserNode::name() const
+QByteArray QDeclarativeCustomParserNode::name() const
{
return d->name;
}
-QList<QmlCustomParserProperty> QmlCustomParserNode::properties() const
+QList<QDeclarativeCustomParserProperty> QDeclarativeCustomParserNode::properties() const
{
return d->properties;
}
-QmlParser::Location QmlCustomParserNode::location() const
+QDeclarativeParser::Location QDeclarativeCustomParserNode::location() const
{
return d->location;
}
-QmlCustomParserProperty::QmlCustomParserProperty()
-: d(new QmlCustomParserPropertyPrivate)
+QDeclarativeCustomParserProperty::QDeclarativeCustomParserProperty()
+: d(new QDeclarativeCustomParserPropertyPrivate)
{
}
-QmlCustomParserProperty::QmlCustomParserProperty(const QmlCustomParserProperty &other)
-: d(new QmlCustomParserPropertyPrivate)
+QDeclarativeCustomParserProperty::QDeclarativeCustomParserProperty(const QDeclarativeCustomParserProperty &other)
+: d(new QDeclarativeCustomParserPropertyPrivate)
{
*this = other;
}
-QmlCustomParserProperty &QmlCustomParserProperty::operator=(const QmlCustomParserProperty &other)
+QDeclarativeCustomParserProperty &QDeclarativeCustomParserProperty::operator=(const QDeclarativeCustomParserProperty &other)
{
d->name = other.d->name;
d->isList = other.d->isList;
@@ -200,32 +200,32 @@ QmlCustomParserProperty &QmlCustomParserProperty::operator=(const QmlCustomParse
return *this;
}
-QmlCustomParserProperty::~QmlCustomParserProperty()
+QDeclarativeCustomParserProperty::~QDeclarativeCustomParserProperty()
{
delete d; d = 0;
}
-QByteArray QmlCustomParserProperty::name() const
+QByteArray QDeclarativeCustomParserProperty::name() const
{
return d->name;
}
-bool QmlCustomParserProperty::isList() const
+bool QDeclarativeCustomParserProperty::isList() const
{
return d->isList;
}
-QmlParser::Location QmlCustomParserProperty::location() const
+QDeclarativeParser::Location QDeclarativeCustomParserProperty::location() const
{
return d->location;
}
-QList<QVariant> QmlCustomParserProperty::assignedValues() const
+QList<QVariant> QDeclarativeCustomParserProperty::assignedValues() const
{
return d->values;
}
-void QmlCustomParser::clearErrors()
+void QDeclarativeCustomParser::clearErrors()
{
exceptions.clear();
}
@@ -235,9 +235,9 @@ void QmlCustomParser::clearErrors()
An error is generated referring to the position of \a node in the source file.
*/
-void QmlCustomParser::error(const QmlCustomParserProperty& prop, const QString& description)
+void QDeclarativeCustomParser::error(const QDeclarativeCustomParserProperty& prop, const QString& description)
{
- QmlError error;
+ QDeclarativeError error;
QString exceptionDescription;
error.setLine(prop.location().line);
error.setColumn(prop.location().column);
@@ -250,9 +250,9 @@ void QmlCustomParser::error(const QmlCustomParserProperty& prop, const QString&
An error is generated referring to the position of \a node in the source file.
*/
-void QmlCustomParser::error(const QmlCustomParserNode& node, const QString& description)
+void QDeclarativeCustomParser::error(const QDeclarativeCustomParserNode& node, const QString& description)
{
- QmlError error;
+ QDeclarativeError error;
QString exceptionDescription;
error.setLine(node.location().line);
error.setColumn(node.location().column);
diff --git a/src/declarative/qml/qmlcustomparser_p.h b/src/declarative/qml/qdeclarativecustomparser_p.h
index 7aebb0d..99587a8 100644
--- a/src/declarative/qml/qmlcustomparser_p.h
+++ b/src/declarative/qml/qdeclarativecustomparser_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLCUSTOMPARSER_H
-#define QMLCUSTOMPARSER_H
+#ifndef QDECLARATIVECUSTOMPARSER_H
+#define QDECLARATIVECUSTOMPARSER_H
//
// W A R N I N G
@@ -53,9 +53,9 @@
// We mean it.
//
-#include "qmlmetatype.h"
-#include "qmlerror.h"
-#include "qmlparser_p.h"
+#include "qdeclarativemetatype_p.h"
+#include "qdeclarativeerror.h"
+#include "qdeclarativeparser_p.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qxmlstream.h>
@@ -66,80 +66,76 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlCustomParserPropertyPrivate;
-class Q_DECLARATIVE_EXPORT QmlCustomParserProperty
+class QDeclarativeCustomParserPropertyPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeCustomParserProperty
{
public:
- QmlCustomParserProperty();
- QmlCustomParserProperty(const QmlCustomParserProperty &);
- QmlCustomParserProperty &operator=(const QmlCustomParserProperty &);
- ~QmlCustomParserProperty();
+ QDeclarativeCustomParserProperty();
+ QDeclarativeCustomParserProperty(const QDeclarativeCustomParserProperty &);
+ QDeclarativeCustomParserProperty &operator=(const QDeclarativeCustomParserProperty &);
+ ~QDeclarativeCustomParserProperty();
QByteArray name() const;
- QmlParser::Location location() const;
+ QDeclarativeParser::Location location() const;
bool isList() const;
- // Will be one of QmlParser::Variant, QmlCustomParserProperty or
- // QmlCustomParserNode
+ // Will be one of QDeclarativeParser::Variant, QDeclarativeCustomParserProperty or
+ // QDeclarativeCustomParserNode
QList<QVariant> assignedValues() const;
private:
- friend class QmlCustomParserNodePrivate;
- friend class QmlCustomParserPropertyPrivate;
- QmlCustomParserPropertyPrivate *d;
+ friend class QDeclarativeCustomParserNodePrivate;
+ friend class QDeclarativeCustomParserPropertyPrivate;
+ QDeclarativeCustomParserPropertyPrivate *d;
};
-class QmlCustomParserNodePrivate;
-class Q_DECLARATIVE_EXPORT QmlCustomParserNode
+class QDeclarativeCustomParserNodePrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeCustomParserNode
{
public:
- QmlCustomParserNode();
- QmlCustomParserNode(const QmlCustomParserNode &);
- QmlCustomParserNode &operator=(const QmlCustomParserNode &);
- ~QmlCustomParserNode();
+ QDeclarativeCustomParserNode();
+ QDeclarativeCustomParserNode(const QDeclarativeCustomParserNode &);
+ QDeclarativeCustomParserNode &operator=(const QDeclarativeCustomParserNode &);
+ ~QDeclarativeCustomParserNode();
QByteArray name() const;
- QmlParser::Location location() const;
+ QDeclarativeParser::Location location() const;
- QList<QmlCustomParserProperty> properties() const;
+ QList<QDeclarativeCustomParserProperty> properties() const;
private:
- friend class QmlCustomParserNodePrivate;
- QmlCustomParserNodePrivate *d;
+ friend class QDeclarativeCustomParserNodePrivate;
+ QDeclarativeCustomParserNodePrivate *d;
};
-class Q_DECLARATIVE_EXPORT QmlCustomParser
+class Q_DECLARATIVE_EXPORT QDeclarativeCustomParser
{
public:
- virtual ~QmlCustomParser() {}
+ virtual ~QDeclarativeCustomParser() {}
void clearErrors();
- virtual QByteArray compile(const QList<QmlCustomParserProperty> &)=0;
+ virtual QByteArray compile(const QList<QDeclarativeCustomParserProperty> &)=0;
virtual void setCustomData(QObject *, const QByteArray &)=0;
- QList<QmlError> errors() const { return exceptions; }
+ QList<QDeclarativeError> errors() const { return exceptions; }
protected:
- void error(const QmlCustomParserProperty&, const QString& description);
- void error(const QmlCustomParserNode&, const QString& description);
+ void error(const QDeclarativeCustomParserProperty&, const QString& description);
+ void error(const QDeclarativeCustomParserNode&, const QString& description);
private:
- QList<QmlError> exceptions;
+ QList<QDeclarativeError> exceptions;
};
-#if defined(Q_OS_SYMBIAN)
-# define QML_DEFINE_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, CUSTOMTYPE) \
- static int defineCustomType##NAME = qmlRegisterCustomType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE, new CUSTOMTYPE);
-#else
-# define QML_DEFINE_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, CUSTOMTYPE) \
- template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,(VERSION_MAJ), (VERSION_MIN)>::instance(qmlRegisterCustomType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE, new CUSTOMTYPE));
-#endif
+#define QML_REGISTER_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, CUSTOMTYPE) \
+ qmlRegisterCustomType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE, new CUSTOMTYPE)
+
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QmlCustomParserProperty)
-Q_DECLARE_METATYPE(QmlCustomParserNode)
+Q_DECLARE_METATYPE(QDeclarativeCustomParserProperty)
+Q_DECLARE_METATYPE(QDeclarativeCustomParserNode)
QT_END_HEADER
diff --git a/src/declarative/qml/qmlcustomparser_p_p.h b/src/declarative/qml/qdeclarativecustomparser_p_p.h
index 52e7b4f..b580db6 100644
--- a/src/declarative/qml/qmlcustomparser_p_p.h
+++ b/src/declarative/qml/qdeclarativecustomparser_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLCUSTOMPARSER_P_H
-#define QMLCUSTOMPARSER_P_H
+#ifndef QDECLARATIVECUSTOMPARSER_P_H
+#define QDECLARATIVECUSTOMPARSER_P_H
//
// W A R N I N G
@@ -53,37 +53,37 @@
// We mean it.
//
-#include "qmlcustomparser_p.h"
+#include "qdeclarativecustomparser_p.h"
-#include "qmlparser_p.h"
+#include "qdeclarativeparser_p.h"
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
-class QmlCustomParserNodePrivate
+class QDeclarativeCustomParserNodePrivate
{
public:
QByteArray name;
- QList<QmlCustomParserProperty> properties;
- QmlParser::Location location;
+ QList<QDeclarativeCustomParserProperty> properties;
+ QDeclarativeParser::Location location;
- static QmlCustomParserNode fromObject(QmlParser::Object *);
- static QmlCustomParserProperty fromProperty(QmlParser::Property *);
+ static QDeclarativeCustomParserNode fromObject(QDeclarativeParser::Object *);
+ static QDeclarativeCustomParserProperty fromProperty(QDeclarativeParser::Property *);
};
-class QmlCustomParserPropertyPrivate
+class QDeclarativeCustomParserPropertyPrivate
{
public:
- QmlCustomParserPropertyPrivate()
+ QDeclarativeCustomParserPropertyPrivate()
: isList(false) {}
QByteArray name;
bool isList;
- QmlParser::Location location;
+ QDeclarativeParser::Location location;
QList<QVariant> values;
};
QT_END_NAMESPACE
-#endif // QMLCUSTOMPARSER_P_H
+#endif // QDECLARATIVECUSTOMPARSER_P_H
diff --git a/src/declarative/qml/qmldeclarativedata_p.h b/src/declarative/qml/qdeclarativedeclarativedata_p.h
index efdc5fd..2c92419 100644
--- a/src/declarative/qml/qmldeclarativedata_p.h
+++ b/src/declarative/qml/qdeclarativedeclarativedata_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLDECLARATIVEDATA_P_H
-#define QMLDECLARATIVEDATA_P_H
+#ifndef QDECLARATIVEDECLARATIVEDATA_P_H
+#define QDECLARATIVEDECLARATIVEDATA_P_H
//
// W A R N I N G
@@ -55,18 +55,18 @@
#include <QtScript/qscriptvalue.h>
#include <private/qobject_p.h>
-#include "qmlguard_p.h"
+#include "qdeclarativeguard_p.h"
QT_BEGIN_NAMESPACE
-class QmlCompiledData;
-class QmlAbstractBinding;
-class QmlContext;
-class QmlPropertyCache;
-class Q_AUTOTEST_EXPORT QmlDeclarativeData : public QDeclarativeData
+class QDeclarativeCompiledData;
+class QDeclarativeAbstractBinding;
+class QDeclarativeContext;
+class QDeclarativePropertyCache;
+class Q_AUTOTEST_EXPORT QDeclarativeDeclarativeData : public QDeclarativeData
{
public:
- QmlDeclarativeData(QmlContext *ctxt = 0)
+ QDeclarativeDeclarativeData(QDeclarativeContext *ctxt = 0)
: context(ctxt), bindings(0), nextContextObject(0), prevContextObject(0),
bindingBitsSize(0), bindingBits(0), outerContext(0), lineNumber(0),
columnNumber(0), deferredComponent(0), deferredIdx(0), attachedProperties(0),
@@ -74,12 +74,12 @@ public:
virtual void destroyed(QObject *);
- QmlContext *context;
- QmlAbstractBinding *bindings;
+ QDeclarativeContext *context;
+ QDeclarativeAbstractBinding *bindings;
- // Linked list for QmlContext::contextObjects
- QmlDeclarativeData *nextContextObject;
- QmlDeclarativeData**prevContextObject;
+ // Linked list for QDeclarativeContext::contextObjects
+ QDeclarativeDeclarativeData *nextContextObject;
+ QDeclarativeDeclarativeData**prevContextObject;
int bindingBitsSize;
quint32 *bindingBits;
@@ -87,27 +87,27 @@ public:
void clearBindingBit(int);
void setBindingBit(QObject *obj, int);
- QmlContext *outerContext; // Can't this be found from context?
+ QDeclarativeContext *outerContext; // Can't this be found from context?
ushort lineNumber;
ushort columnNumber;
- QmlCompiledData *deferredComponent; // Can't this be found from the context?
+ QDeclarativeCompiledData *deferredComponent; // Can't this be found from the context?
unsigned int deferredIdx;
QHash<int, QObject *> *attachedProperties;
QScriptValue scriptValue;
- QmlPropertyCache *propertyCache;
+ QDeclarativePropertyCache *propertyCache;
- QmlGuard<QObject> *guards;
+ QDeclarativeGuard<QObject> *guards;
- static QmlDeclarativeData *get(const QObject *object, bool create = false) {
+ static QDeclarativeDeclarativeData *get(const QObject *object, bool create = false) {
QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
if (priv->declarativeData) {
- return static_cast<QmlDeclarativeData *>(priv->declarativeData);
+ return static_cast<QDeclarativeDeclarativeData *>(priv->declarativeData);
} else if (create) {
- priv->declarativeData = new QmlDeclarativeData;
- return static_cast<QmlDeclarativeData *>(priv->declarativeData);
+ priv->declarativeData = new QDeclarativeDeclarativeData;
+ return static_cast<QDeclarativeDeclarativeData *>(priv->declarativeData);
} else {
return 0;
}
@@ -115,19 +115,19 @@ public:
};
template<class T>
-void QmlGuard<T>::addGuard()
+void QDeclarativeGuard<T>::addGuard()
{
- QmlDeclarativeData *data = QmlDeclarativeData::get(o, true);
+ QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(o, true);
next = data->guards;
- if (next) reinterpret_cast<QmlGuard<T> *>(next)->prev = &next;
- data->guards = reinterpret_cast<QmlGuard<QObject> *>(this);
+ if (next) reinterpret_cast<QDeclarativeGuard<T> *>(next)->prev = &next;
+ data->guards = reinterpret_cast<QDeclarativeGuard<QObject> *>(this);
prev = &data->guards;
}
template<class T>
-void QmlGuard<T>::remGuard()
+void QDeclarativeGuard<T>::remGuard()
{
- if (next) reinterpret_cast<QmlGuard<T> *>(next)->prev = prev;
+ if (next) reinterpret_cast<QDeclarativeGuard<T> *>(next)->prev = prev;
*prev = next;
next = 0;
prev = 0;
@@ -135,4 +135,4 @@ void QmlGuard<T>::remGuard()
QT_END_NAMESPACE
-#endif // QMLDECLARATIVEDATA_P_H
+#endif // QDECLARATIVEDECLARATIVEDATA_P_H
diff --git a/src/declarative/qml/qdeclarativedirparser.cpp b/src/declarative/qml/qdeclarativedirparser.cpp
new file mode 100644
index 0000000..e730b92
--- /dev/null
+++ b/src/declarative/qml/qdeclarativedirparser.cpp
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 "qdeclarativedirparser_p.h"
+#include "qdeclarativeerror.h"
+
+#include <QtCore/QTextStream>
+#include <QtCore/QtDebug>
+
+QT_BEGIN_NAMESPACE
+
+QDeclarativeDirParser::QDeclarativeDirParser()
+ : _isParsed(false)
+{
+}
+
+QDeclarativeDirParser::~QDeclarativeDirParser()
+{
+}
+
+QUrl QDeclarativeDirParser::url() const
+{
+ return _url;
+}
+
+void QDeclarativeDirParser::setUrl(const QUrl &url)
+{
+ _url = url;
+}
+
+QString QDeclarativeDirParser::source() const
+{
+ return _source;
+}
+
+void QDeclarativeDirParser::setSource(const QString &source)
+{
+ _isParsed = false;
+ _source = source;
+}
+
+bool QDeclarativeDirParser::isParsed() const
+{
+ return _isParsed;
+}
+
+bool QDeclarativeDirParser::parse()
+{
+ if (_isParsed)
+ return true;
+
+ _isParsed = true;
+ _errors.clear();
+ _plugins.clear();
+ _components.clear();
+
+ QTextStream stream(&_source);
+ int lineNumber = 0;
+
+ forever {
+ ++lineNumber;
+
+ const QString line = stream.readLine();
+ if (line.isNull())
+ break;
+
+ QString sections[3];
+ int sectionCount = 0;
+
+ int index = 0;
+ const int length = line.length();
+
+ while (index != length) {
+ const QChar ch = line.at(index);
+
+ if (ch.isSpace()) {
+ do { ++index; }
+ while (index != length && line.at(index).isSpace());
+
+ } else if (ch == QLatin1Char('#')) {
+ // recognized a comment
+ break;
+
+ } else {
+ const int start = index;
+
+ do { ++index; }
+ while (index != length && !line.at(index).isSpace());
+
+ const QString lexeme = line.mid(start, index - start);
+
+ if (sectionCount >= 3) {
+ reportError(lineNumber, start, QLatin1String("unexpected token"));
+
+ } else {
+ sections[sectionCount++] = lexeme;
+ }
+ }
+ }
+
+ if (sectionCount == 0) {
+ continue; // no sections, no party.
+
+ } else if (sections[0] == QLatin1String("plugin")) {
+ if (sectionCount < 2) {
+ reportError(lineNumber, -1,
+ QString::fromUtf8("plugin directive requires 2 arguments, but %1 were provided").arg(sectionCount + 1));
+
+ continue;
+ }
+
+ const Plugin entry(sections[1], sections[2]);
+
+ _plugins.append(entry);
+
+ } else if (sectionCount == 3) {
+ const QString &version = sections[1];
+ const int dotIndex = version.indexOf(QLatin1Char('.'));
+
+ if (dotIndex == -1) {
+ qWarning() << "expected '.'"; // ### use reportError
+
+ } else if (version.indexOf(QLatin1Char('.'), dotIndex + 1) != -1) {
+ qWarning() << "unexpected '.'"; // ### use reportError
+
+ } else {
+ bool validVersionNumber = false;
+ const int majorVersion = version.left(dotIndex).toInt(&validVersionNumber);
+
+ if (validVersionNumber) {
+ const int minorVersion = version.mid(dotIndex + 1).toInt(&validVersionNumber);
+
+ if (validVersionNumber) {
+ const Component entry(sections[0], sections[2], majorVersion, minorVersion);
+
+ _components.append(entry);
+ }
+ }
+ }
+ } else {
+ // ### use reportError
+ qWarning() << "a component declaration requires 3 arguments, but" << (sectionCount + 1) << "were provided";
+ }
+ }
+
+ return hasError();
+}
+
+void QDeclarativeDirParser::reportError(int line, int column, const QString &description)
+{
+ QDeclarativeError error;
+ error.setUrl(_url);
+ error.setLine(line);
+ error.setColumn(column);
+ error.setDescription(description);
+ _errors.append(error);
+}
+
+bool QDeclarativeDirParser::hasError() const
+{
+ if (! _errors.isEmpty())
+ return true;
+
+ return false;
+}
+
+QList<QDeclarativeError> QDeclarativeDirParser::errors() const
+{
+ return _errors;
+}
+
+QList<QDeclarativeDirParser::Plugin> QDeclarativeDirParser::plugins() const
+{
+ return _plugins;
+}
+
+QList<QDeclarativeDirParser::Component> QDeclarativeDirParser::components() const
+{
+ return _components;
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativedirparser_p.h b/src/declarative/qml/qdeclarativedirparser_p.h
new file mode 100644
index 0000000..5df7117
--- /dev/null
+++ b/src/declarative/qml/qdeclarativedirparser_p.h
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVEDIRPARSER_P_H
+#define QDECLARATIVEDIRPARSER_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 <QtCore/QUrl>
+#include <QtCore/QHash>
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeError;
+
+class QDeclarativeDirParser
+{
+ Q_DISABLE_COPY(QDeclarativeDirParser)
+
+public:
+ QDeclarativeDirParser();
+ ~QDeclarativeDirParser();
+
+ QUrl url() const;
+ void setUrl(const QUrl &url);
+
+ QString source() const;
+ void setSource(const QString &source);
+
+ bool isParsed() const;
+ bool parse();
+
+ bool hasError() const;
+ QList<QDeclarativeError> errors() const;
+
+ struct Plugin
+ {
+ Plugin() {}
+
+ Plugin(const QString &name, const QString &path)
+ : name(name), path(path) {}
+
+ QString name;
+ QString path;
+ };
+
+ struct Component
+ {
+ Component()
+ : majorVersion(0), minorVersion(0) {}
+
+ Component(const QString &typeName, const QString &fileName, int majorVersion, int minorVersion)
+ : typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion) {}
+
+ QString typeName;
+ QString fileName;
+ int majorVersion;
+ int minorVersion;
+ };
+
+ QList<Component> components() const;
+ QList<Plugin> plugins() const;
+
+private:
+ void reportError(int line, int column, const QString &message);
+
+private:
+ QList<QDeclarativeError> _errors;
+ QUrl _url;
+ QString _source;
+ QList<Component> _components;
+ QList<Plugin> _plugins;
+ unsigned _isParsed: 1;
+};
+
+QT_END_NAMESPACE
+
+#endif // QDECLARATIVEDIRPARSER_P_H
diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qdeclarativedom.cpp
index c75a299..6c81f34 100644
--- a/src/declarative/qml/qmldom.cpp
+++ b/src/declarative/qml/qdeclarativedom.cpp
@@ -39,14 +39,14 @@
**
****************************************************************************/
-#include "qmldom_p.h"
-#include "qmldom_p_p.h"
+#include "qdeclarativedom_p.h"
+#include "qdeclarativedom_p_p.h"
-#include "qmlcompositetypedata_p.h"
-#include "qmlcompiler_p.h"
-#include "qmlengine_p.h"
-#include "qmlscriptparser_p.h"
-#include "qmlglobal_p.h"
+#include "qdeclarativecompositetypedata_p.h"
+#include "qdeclarativecompiler_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativescriptparser_p.h"
+#include "qdeclarativeglobal_p.h"
#include <QtCore/QByteArray>
#include <QtCore/QDebug>
@@ -54,27 +54,27 @@
QT_BEGIN_NAMESPACE
-QmlDomDocumentPrivate::QmlDomDocumentPrivate()
+QDeclarativeDomDocumentPrivate::QDeclarativeDomDocumentPrivate()
: root(0)
{
}
-QmlDomDocumentPrivate::~QmlDomDocumentPrivate()
+QDeclarativeDomDocumentPrivate::~QDeclarativeDomDocumentPrivate()
{
if (root) root->release();
}
/*!
- \class QmlDomDocument
+ \class QDeclarativeDomDocument
\internal
- \brief The QmlDomDocument class represents the root of a QML document
+ \brief The QDeclarativeDomDocument class represents the root of a QML document
A QML document is a self-contained snippet of QML, usually contained in a
single file. Each document has a root object, accessible through
- QmlDomDocument::rootObject().
+ QDeclarativeDomDocument::rootObject().
- The QmlDomDocument class allows the programmer to inspect a QML document by
- calling QmlDomDocument::load().
+ The QDeclarativeDomDocument class allows the programmer to inspect a QML document by
+ calling QDeclarativeDomDocument::load().
The following example loads a QML file from disk, and prints out its root
object type and the properties assigned in the root object.
@@ -83,43 +83,43 @@ QmlDomDocumentPrivate::~QmlDomDocumentPrivate()
file.open(QIODevice::ReadOnly);
QByteArray xmlData = file.readAll();
- QmlDomDocument document;
+ QDeclarativeDomDocument document;
document.load(qmlengine, xmlData);
- QmlDomObject rootObject = document.rootObject();
+ QDeclarativeDomObject rootObject = document.rootObject();
qDebug() << rootObject.objectType();
- foreach(QmlDomProperty property, rootObject.properties())
+ foreach(QDeclarativeDomProperty property, rootObject.properties())
qDebug() << property.propertyName();
\endcode
*/
/*!
- Construct an empty QmlDomDocument.
+ Construct an empty QDeclarativeDomDocument.
*/
-QmlDomDocument::QmlDomDocument()
-: d(new QmlDomDocumentPrivate)
+QDeclarativeDomDocument::QDeclarativeDomDocument()
+: d(new QDeclarativeDomDocumentPrivate)
{
}
/*!
- Create a copy of \a other QmlDomDocument.
+ Create a copy of \a other QDeclarativeDomDocument.
*/
-QmlDomDocument::QmlDomDocument(const QmlDomDocument &other)
+QDeclarativeDomDocument::QDeclarativeDomDocument(const QDeclarativeDomDocument &other)
: d(other.d)
{
}
/*!
- Destroy the QmlDomDocument
+ Destroy the QDeclarativeDomDocument
*/
-QmlDomDocument::~QmlDomDocument()
+QDeclarativeDomDocument::~QDeclarativeDomDocument()
{
}
/*!
- Assign \a other to this QmlDomDocument.
+ Assign \a other to this QDeclarativeDomDocument.
*/
-QmlDomDocument &QmlDomDocument::operator=(const QmlDomDocument &other)
+QDeclarativeDomDocument &QDeclarativeDomDocument::operator=(const QDeclarativeDomDocument &other)
{
d = other.d;
return *this;
@@ -128,37 +128,37 @@ QmlDomDocument &QmlDomDocument::operator=(const QmlDomDocument &other)
/*!
Returns all import statements in qml.
*/
-QList<QmlDomImport> QmlDomDocument::imports() const
+QList<QDeclarativeDomImport> QDeclarativeDomDocument::imports() const
{
return d->imports;
}
/*!
- Loads a QmlDomDocument from \a data. \a data should be valid QML
+ Loads a QDeclarativeDomDocument from \a data. \a data should be valid QML
data. On success, true is returned. If the \a data is malformed, false
- is returned and QmlDomDocument::errors() contains an error description.
+ is returned and QDeclarativeDomDocument::errors() contains an error description.
- \sa QmlDomDocument::loadError()
+ \sa QDeclarativeDomDocument::loadError()
*/
-bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data, const QUrl &url)
+bool QDeclarativeDomDocument::load(QDeclarativeEngine *engine, const QByteArray &data, const QUrl &url)
{
d->errors.clear();
d->imports.clear();
- QmlCompiledData *component = new QmlCompiledData(engine);
- QmlCompiler compiler;
+ QDeclarativeCompiledData *component = new QDeclarativeCompiledData(engine);
+ QDeclarativeCompiler compiler;
- QmlCompositeTypeData *td = ((QmlEnginePrivate *)QmlEnginePrivate::get(engine))->typeManager.getImmediate(data, url);
+ QDeclarativeCompositeTypeData *td = ((QDeclarativeEnginePrivate *)QDeclarativeEnginePrivate::get(engine))->typeManager.getImmediate(data, url);
- if(td->status == QmlCompositeTypeData::Error) {
+ if(td->status == QDeclarativeCompositeTypeData::Error) {
d->errors = td->errors;
td->release();
component->release();
return false;
- } else if(td->status == QmlCompositeTypeData::Waiting ||
- td->status == QmlCompositeTypeData::WaitingResources) {
- QmlError error;
- error.setDescription(QLatin1String("QmlDomDocument supports local types only"));
+ } else if(td->status == QDeclarativeCompositeTypeData::Waiting ||
+ td->status == QDeclarativeCompositeTypeData::WaitingResources) {
+ QDeclarativeError error;
+ error.setDescription(QLatin1String("QDeclarativeDomDocument supports local types only"));
d->errors << error;
td->release();
component->release();
@@ -175,9 +175,9 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data, const QUrl
}
for (int i = 0; i < td->data.imports().size(); ++i) {
- QmlScriptParser::Import parserImport = td->data.imports().at(i);
- QmlDomImport domImport;
- domImport.d->type = static_cast<QmlDomImportPrivate::Type>(parserImport.type);
+ QDeclarativeScriptParser::Import parserImport = td->data.imports().at(i);
+ QDeclarativeDomImport domImport;
+ domImport.d->type = static_cast<QDeclarativeDomImportPrivate::Type>(parserImport.type);
domImport.d->uri = parserImport.uri;
domImport.d->qualifier = parserImport.qualifier;
domImport.d->version = parserImport.version;
@@ -199,16 +199,16 @@ bool QmlDomDocument::load(QmlEngine *engine, const QByteArray &data, const QUrl
\sa load()
*/
-QList<QmlError> QmlDomDocument::errors() const
+QList<QDeclarativeError> QDeclarativeDomDocument::errors() const
{
return d->errors;
}
/*!
- Returns the document's root object, or an invalid QmlDomObject if the
+ Returns the document's root object, or an invalid QDeclarativeDomObject if the
document has no root.
- In the sample QML below, the root object will be the QmlGraphicsItem type.
+ In the sample QML below, the root object will be the QDeclarativeItem type.
\qml
Item {
Text {
@@ -217,81 +217,81 @@ Item {
}
\endqml
*/
-QmlDomObject QmlDomDocument::rootObject() const
+QDeclarativeDomObject QDeclarativeDomDocument::rootObject() const
{
- QmlDomObject rv;
+ QDeclarativeDomObject rv;
rv.d->object = d->root;
if (rv.d->object) rv.d->object->addref();
return rv;
}
-QmlDomPropertyPrivate::QmlDomPropertyPrivate()
+QDeclarativeDomPropertyPrivate::QDeclarativeDomPropertyPrivate()
: property(0)
{
}
-QmlDomPropertyPrivate::~QmlDomPropertyPrivate()
+QDeclarativeDomPropertyPrivate::~QDeclarativeDomPropertyPrivate()
{
if (property) property->release();
}
-QmlDomDynamicPropertyPrivate::QmlDomDynamicPropertyPrivate():
+QDeclarativeDomDynamicPropertyPrivate::QDeclarativeDomDynamicPropertyPrivate():
valid(false)
{
}
-QmlDomDynamicPropertyPrivate::~QmlDomDynamicPropertyPrivate()
+QDeclarativeDomDynamicPropertyPrivate::~QDeclarativeDomDynamicPropertyPrivate()
{
if (valid && property.defaultValue) property.defaultValue->release();
}
/*!
- \class QmlDomProperty
+ \class QDeclarativeDomProperty
\internal
- \brief The QmlDomProperty class represents one property assignment in the
+ \brief The QDeclarativeDomProperty class represents one property assignment in the
QML DOM tree
- Properties in QML can be assigned QML \l {QmlDomValue}{values}.
+ Properties in QML can be assigned QML \l {QDeclarativeDomValue}{values}.
- \sa QmlDomObject
+ \sa QDeclarativeDomObject
*/
/*!
- Construct an invalid QmlDomProperty.
+ Construct an invalid QDeclarativeDomProperty.
*/
-QmlDomProperty::QmlDomProperty()
-: d(new QmlDomPropertyPrivate)
+QDeclarativeDomProperty::QDeclarativeDomProperty()
+: d(new QDeclarativeDomPropertyPrivate)
{
}
/*!
- Create a copy of \a other QmlDomProperty.
+ Create a copy of \a other QDeclarativeDomProperty.
*/
-QmlDomProperty::QmlDomProperty(const QmlDomProperty &other)
+QDeclarativeDomProperty::QDeclarativeDomProperty(const QDeclarativeDomProperty &other)
: d(other.d)
{
}
/*!
- Destroy the QmlDomProperty.
+ Destroy the QDeclarativeDomProperty.
*/
-QmlDomProperty::~QmlDomProperty()
+QDeclarativeDomProperty::~QDeclarativeDomProperty()
{
}
/*!
- Assign \a other to this QmlDomProperty.
+ Assign \a other to this QDeclarativeDomProperty.
*/
-QmlDomProperty &QmlDomProperty::operator=(const QmlDomProperty &other)
+QDeclarativeDomProperty &QDeclarativeDomProperty::operator=(const QDeclarativeDomProperty &other)
{
d = other.d;
return *this;
}
/*!
- Returns true if this is a valid QmlDomProperty, false otherwise.
+ Returns true if this is a valid QDeclarativeDomProperty, false otherwise.
*/
-bool QmlDomProperty::isValid() const
+bool QDeclarativeDomProperty::isValid() const
{
return d->property != 0;
}
@@ -313,11 +313,11 @@ Text {
the full name is returned ("x", "y" and "font.bold") by this method.
For dot properties, a split version of the name can be accessed by calling
- QmlDomProperty::propertyNameParts().
+ QDeclarativeDomProperty::propertyNameParts().
- \sa QmlDomProperty::propertyNameParts()
+ \sa QDeclarativeDomProperty::propertyNameParts()
*/
-QByteArray QmlDomProperty::propertyName() const
+QByteArray QDeclarativeDomProperty::propertyName() const
{
return d->propertyName;
}
@@ -337,9 +337,9 @@ Text {
For each of the properties shown above, this method would return ("x"),
("y") and ("font", "bold").
- \sa QmlDomProperty::propertyName()
+ \sa QDeclarativeDomProperty::propertyName()
*/
-QList<QByteArray> QmlDomProperty::propertyNameParts() const
+QList<QByteArray> QDeclarativeDomProperty::propertyNameParts() const
{
if (d->propertyName.isEmpty()) return QList<QByteArray>();
else return d->propertyName.split('.');
@@ -360,18 +360,18 @@ QList<QByteArray> QmlDomProperty::propertyNameParts() const
property is used, and not only by whether the property is the types default
property.
*/
-bool QmlDomProperty::isDefaultProperty() const
+bool QDeclarativeDomProperty::isDefaultProperty() const
{
return d->property && d->property->isDefault;
}
/*!
- Returns the QmlDomValue that is assigned to this property, or an invalid
- QmlDomValue if no value is assigned.
+ Returns the QDeclarativeDomValue that is assigned to this property, or an invalid
+ QDeclarativeDomValue if no value is assigned.
*/
-QmlDomValue QmlDomProperty::value() const
+QDeclarativeDomValue QDeclarativeDomProperty::value() const
{
- QmlDomValue rv;
+ QDeclarativeDomValue rv;
if (d->property) {
rv.d->property = d->property;
rv.d->value = d->property->values.at(0);
@@ -385,7 +385,7 @@ QmlDomValue QmlDomProperty::value() const
Returns the position in the input data where the property ID startd, or -1 if
the property is invalid.
*/
-int QmlDomProperty::position() const
+int QDeclarativeDomProperty::position() const
{
if (d && d->property) {
return d->property->location.range.offset;
@@ -397,7 +397,7 @@ int QmlDomProperty::position() const
Returns the length in the input data from where the property ID started upto
the end of it, or -1 if the property is invalid.
*/
-int QmlDomProperty::length() const
+int QDeclarativeDomProperty::length() const
{
if (d && d->property)
return d->property->location.range.length;
@@ -406,38 +406,38 @@ int QmlDomProperty::length() const
}
/*!
- Construct an invalid QmlDomDynamicProperty.
+ Construct an invalid QDeclarativeDomDynamicProperty.
*/
-QmlDomDynamicProperty::QmlDomDynamicProperty():
- d(new QmlDomDynamicPropertyPrivate)
+QDeclarativeDomDynamicProperty::QDeclarativeDomDynamicProperty():
+ d(new QDeclarativeDomDynamicPropertyPrivate)
{
}
/*!
- Create a copy of \a other QmlDomDynamicProperty.
+ Create a copy of \a other QDeclarativeDomDynamicProperty.
*/
-QmlDomDynamicProperty::QmlDomDynamicProperty(const QmlDomDynamicProperty &other):
+QDeclarativeDomDynamicProperty::QDeclarativeDomDynamicProperty(const QDeclarativeDomDynamicProperty &other):
d(other.d)
{
}
/*!
- Destroy the QmlDomDynamicProperty.
+ Destroy the QDeclarativeDomDynamicProperty.
*/
-QmlDomDynamicProperty::~QmlDomDynamicProperty()
+QDeclarativeDomDynamicProperty::~QDeclarativeDomDynamicProperty()
{
}
/*!
- Assign \a other to this QmlDomDynamicProperty.
+ Assign \a other to this QDeclarativeDomDynamicProperty.
*/
-QmlDomDynamicProperty &QmlDomDynamicProperty::operator=(const QmlDomDynamicProperty &other)
+QDeclarativeDomDynamicProperty &QDeclarativeDomDynamicProperty::operator=(const QDeclarativeDomDynamicProperty &other)
{
d = other.d;
return *this;
}
-bool QmlDomDynamicProperty::isValid() const
+bool QDeclarativeDomDynamicProperty::isValid() const
{
return d && d->valid;
}
@@ -454,7 +454,7 @@ Item {
As illustrated above, a dynamic property name can have a name and a
default value ("10").
*/
-QByteArray QmlDomDynamicProperty::propertyName() const
+QByteArray QDeclarativeDomDynamicProperty::propertyName() const
{
if (isValid())
return d->property.name;
@@ -464,35 +464,35 @@ QByteArray QmlDomDynamicProperty::propertyName() const
/*!
Returns the type of the dynamic property. Note that when the property is an
- alias property, this will return -1. Use QmlDomProperty::isAlias() to check
+ alias property, this will return -1. Use QDeclarativeDomProperty::isAlias() to check
if the property is an alias.
*/
-int QmlDomDynamicProperty::propertyType() const
+int QDeclarativeDomDynamicProperty::propertyType() const
{
if (isValid()) {
switch (d->property.type) {
- case QmlParser::Object::DynamicProperty::Bool:
+ case QDeclarativeParser::Object::DynamicProperty::Bool:
return QMetaType::type("bool");
- case QmlParser::Object::DynamicProperty::Color:
+ case QDeclarativeParser::Object::DynamicProperty::Color:
return QMetaType::type("QColor");
- case QmlParser::Object::DynamicProperty::Date:
+ case QDeclarativeParser::Object::DynamicProperty::Date:
return QMetaType::type("QDate");
- case QmlParser::Object::DynamicProperty::Int:
+ case QDeclarativeParser::Object::DynamicProperty::Int:
return QMetaType::type("int");
- case QmlParser::Object::DynamicProperty::Real:
+ case QDeclarativeParser::Object::DynamicProperty::Real:
return QMetaType::type("double");
- case QmlParser::Object::DynamicProperty::String:
+ case QDeclarativeParser::Object::DynamicProperty::String:
return QMetaType::type("QString");
- case QmlParser::Object::DynamicProperty::Url:
+ case QDeclarativeParser::Object::DynamicProperty::Url:
return QMetaType::type("QUrl");
- case QmlParser::Object::DynamicProperty::Variant:
+ case QDeclarativeParser::Object::DynamicProperty::Variant:
return QMetaType::type("QVariant");
default:
@@ -503,7 +503,7 @@ int QmlDomDynamicProperty::propertyType() const
return -1;
}
-QByteArray QmlDomDynamicProperty::propertyTypeName() const
+QByteArray QDeclarativeDomDynamicProperty::propertyTypeName() const
{
if (isValid())
return d->property.customType;
@@ -526,7 +526,7 @@ QByteArray QmlDomDynamicProperty::propertyTypeName() const
property is used, and not only by whether the property is the types default
property.
*/
-bool QmlDomDynamicProperty::isDefaultProperty() const
+bool QDeclarativeDomDynamicProperty::isDefaultProperty() const
{
if (isValid())
return d->property.isDefaultProperty;
@@ -535,11 +535,11 @@ bool QmlDomDynamicProperty::isDefaultProperty() const
}
/*!
- Returns the default value as a QmlDomProperty.
+ Returns the default value as a QDeclarativeDomProperty.
*/
-QmlDomProperty QmlDomDynamicProperty::defaultValue() const
+QDeclarativeDomProperty QDeclarativeDomDynamicProperty::defaultValue() const
{
- QmlDomProperty rp;
+ QDeclarativeDomProperty rp;
if (isValid() && d->property.defaultValue) {
rp.d->property = d->property.defaultValue;
@@ -554,10 +554,10 @@ QmlDomProperty QmlDomDynamicProperty::defaultValue() const
Returns true if this dynamic property is an alias for another property,
false otherwise.
*/
-bool QmlDomDynamicProperty::isAlias() const
+bool QDeclarativeDomDynamicProperty::isAlias() const
{
if (isValid())
- return d->property.type == QmlParser::Object::DynamicProperty::Alias;
+ return d->property.type == QDeclarativeParser::Object::DynamicProperty::Alias;
else
return false;
}
@@ -566,7 +566,7 @@ bool QmlDomDynamicProperty::isAlias() const
Returns the position in the input data where the property ID startd, or 0 if
the property is invalid.
*/
-int QmlDomDynamicProperty::position() const
+int QDeclarativeDomDynamicProperty::position() const
{
if (isValid()) {
return d->property.location.range.offset;
@@ -578,7 +578,7 @@ int QmlDomDynamicProperty::position() const
Returns the length in the input data from where the property ID started upto
the end of it, or 0 if the property is invalid.
*/
-int QmlDomDynamicProperty::length() const
+int QDeclarativeDomDynamicProperty::length() const
{
if (isValid())
return d->property.location.range.length;
@@ -586,22 +586,22 @@ int QmlDomDynamicProperty::length() const
return -1;
}
-QmlDomObjectPrivate::QmlDomObjectPrivate()
+QDeclarativeDomObjectPrivate::QDeclarativeDomObjectPrivate()
: object(0)
{
}
-QmlDomObjectPrivate::~QmlDomObjectPrivate()
+QDeclarativeDomObjectPrivate::~QDeclarativeDomObjectPrivate()
{
if (object) object->release();
}
-QmlDomObjectPrivate::Properties
-QmlDomObjectPrivate::properties() const
+QDeclarativeDomObjectPrivate::Properties
+QDeclarativeDomObjectPrivate::properties() const
{
Properties rv;
- for (QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
+ for (QHash<QByteArray, QDeclarativeParser::Property *>::ConstIterator iter =
object->properties.begin();
iter != object->properties.end();
++iter) {
@@ -612,14 +612,14 @@ QmlDomObjectPrivate::properties() const
return rv;
}
-QmlDomObjectPrivate::Properties
-QmlDomObjectPrivate::properties(QmlParser::Property *property) const
+QDeclarativeDomObjectPrivate::Properties
+QDeclarativeDomObjectPrivate::properties(QDeclarativeParser::Property *property) const
{
Properties rv;
if (property->value) {
- for (QHash<QByteArray, QmlParser::Property *>::ConstIterator iter =
+ for (QHash<QByteArray, QDeclarativeParser::Property *>::ConstIterator iter =
property->value->properties.begin();
iter != property->value->properties.end();
++iter) {
@@ -640,16 +640,16 @@ QmlDomObjectPrivate::properties(QmlParser::Property *property) const
}
/*!
- \class QmlDomObject
+ \class QDeclarativeDomObject
\internal
- \brief The QmlDomObject class represents an object instantiation.
+ \brief The QDeclarativeDomObject class represents an object instantiation.
- Each object instantiated in a QML file has a corresponding QmlDomObject
+ Each object instantiated in a QML file has a corresponding QDeclarativeDomObject
node in the QML DOM.
In addition to the type information that determines the object to
- instantiate, QmlDomObject's also have a set of associated QmlDomProperty's.
- Each QmlDomProperty represents a QML property assignment on the instantiated
+ instantiate, QDeclarativeDomObject's also have a set of associated QDeclarativeDomProperty's.
+ Each QDeclarativeDomProperty represents a QML property assignment on the instantiated
object. For example,
\qml
@@ -659,48 +659,48 @@ QGraphicsWidget {
}
\endqml
- describes a single QmlDomObject - "QGraphicsWidget" - with two properties,
+ describes a single QDeclarativeDomObject - "QGraphicsWidget" - with two properties,
"opacity" and "size". Obviously QGraphicsWidget has many more properties than just
these two, but the QML DOM representation only contains those assigned
values (or bindings) in the QML file.
*/
/*!
- Construct an invalid QmlDomObject.
+ Construct an invalid QDeclarativeDomObject.
*/
-QmlDomObject::QmlDomObject()
-: d(new QmlDomObjectPrivate)
+QDeclarativeDomObject::QDeclarativeDomObject()
+: d(new QDeclarativeDomObjectPrivate)
{
}
/*!
- Create a copy of \a other QmlDomObject.
+ Create a copy of \a other QDeclarativeDomObject.
*/
-QmlDomObject::QmlDomObject(const QmlDomObject &other)
+QDeclarativeDomObject::QDeclarativeDomObject(const QDeclarativeDomObject &other)
: d(other.d)
{
}
/*!
- Destroy the QmlDomObject.
+ Destroy the QDeclarativeDomObject.
*/
-QmlDomObject::~QmlDomObject()
+QDeclarativeDomObject::~QDeclarativeDomObject()
{
}
/*!
- Assign \a other to this QmlDomObject.
+ Assign \a other to this QDeclarativeDomObject.
*/
-QmlDomObject &QmlDomObject::operator=(const QmlDomObject &other)
+QDeclarativeDomObject &QDeclarativeDomObject::operator=(const QDeclarativeDomObject &other)
{
d = other.d;
return *this;
}
/*!
- Returns true if this is a valid QmlDomObject, false otherwise.
+ Returns true if this is a valid QDeclarativeDomObject, false otherwise.
*/
-bool QmlDomObject::isValid() const
+bool QDeclarativeDomObject::isValid() const
{
return d->object != 0;
}
@@ -713,7 +713,7 @@ bool QmlDomObject::isValid() const
Rectangle { }
\endqml
*/
-QByteArray QmlDomObject::objectType() const
+QByteArray QDeclarativeDomObject::objectType() const
{
if (d->object) return d->object->typeName;
else return QByteArray();
@@ -727,7 +727,7 @@ QByteArray QmlDomObject::objectType() const
Rectangle { }
\endqml
*/
-QByteArray QmlDomObject::objectClassName() const
+QByteArray QDeclarativeDomObject::objectClassName() const
{
if (d->object)
return d->object->className;
@@ -735,7 +735,7 @@ QByteArray QmlDomObject::objectClassName() const
return QByteArray();
}
-int QmlDomObject::objectTypeMajorVersion() const
+int QDeclarativeDomObject::objectTypeMajorVersion() const
{
if (d->object)
return d->object->majorVersion;
@@ -743,7 +743,7 @@ int QmlDomObject::objectTypeMajorVersion() const
return -1;
}
-int QmlDomObject::objectTypeMinorVersion() const
+int QDeclarativeDomObject::objectTypeMinorVersion() const
{
if (d->object)
return d->object->minorVersion;
@@ -760,7 +760,7 @@ int QmlDomObject::objectTypeMinorVersion() const
Text { id: myText }
\endqml
*/
-QString QmlDomObject::objectId() const
+QString QDeclarativeDomObject::objectId() const
{
if (d->object) {
return d->object->id;
@@ -780,17 +780,17 @@ Text {
}
\endqml
*/
-QList<QmlDomProperty> QmlDomObject::properties() const
+QList<QDeclarativeDomProperty> QDeclarativeDomObject::properties() const
{
- QList<QmlDomProperty> rv;
+ QList<QDeclarativeDomProperty> rv;
if (!d->object || isComponent())
return rv;
- QmlDomObjectPrivate::Properties properties = d->properties();
+ QDeclarativeDomObjectPrivate::Properties properties = d->properties();
for (int ii = 0; ii < properties.count(); ++ii) {
- QmlDomProperty domProperty;
+ QDeclarativeDomProperty domProperty;
domProperty.d->property = properties.at(ii).first;
domProperty.d->property->addref();
domProperty.d->propertyName = properties.at(ii).second;
@@ -799,7 +799,7 @@ QList<QmlDomProperty> QmlDomObject::properties() const
}
if (d->object->defaultProperty) {
- QmlDomProperty domProperty;
+ QDeclarativeDomProperty domProperty;
domProperty.d->property = d->object->defaultProperty;
domProperty.d->property->addref();
domProperty.d->propertyName = d->object->defaultProperty->name;
@@ -811,31 +811,31 @@ QList<QmlDomProperty> QmlDomObject::properties() const
/*!
Returns the object's \a name property if a value has been assigned to
- it, or an invalid QmlDomProperty otherwise.
+ it, or an invalid QDeclarativeDomProperty otherwise.
In the example below, \c {object.property("source")} would return a valid
- QmlDomProperty, and \c {object.property("tile")} an invalid QmlDomProperty.
+ QDeclarativeDomProperty, and \c {object.property("tile")} an invalid QDeclarativeDomProperty.
\qml
Image { source: "sample.jpg" }
\endqml
*/
-QmlDomProperty QmlDomObject::property(const QByteArray &name) const
+QDeclarativeDomProperty QDeclarativeDomObject::property(const QByteArray &name) const
{
- QList<QmlDomProperty> props = properties();
+ QList<QDeclarativeDomProperty> props = properties();
for (int ii = 0; ii < props.count(); ++ii)
if (props.at(ii).propertyName() == name)
return props.at(ii);
- return QmlDomProperty();
+ return QDeclarativeDomProperty();
}
-QList<QmlDomDynamicProperty> QmlDomObject::dynamicProperties() const
+QList<QDeclarativeDomDynamicProperty> QDeclarativeDomObject::dynamicProperties() const
{
- QList<QmlDomDynamicProperty> properties;
+ QList<QDeclarativeDomDynamicProperty> properties;
for (int i = 0; i < d->object->dynamicProperties.size(); ++i) {
- QmlDomDynamicProperty p;
- p.d = new QmlDomDynamicPropertyPrivate;
+ QDeclarativeDomDynamicProperty p;
+ p.d = new QDeclarativeDomDynamicPropertyPrivate;
p.d->property = d->object->dynamicProperties.at(i);
p.d->valid = true;
@@ -848,16 +848,16 @@ QList<QmlDomDynamicProperty> QmlDomObject::dynamicProperties() const
return properties;
}
-QmlDomDynamicProperty QmlDomObject::dynamicProperty(const QByteArray &name) const
+QDeclarativeDomDynamicProperty QDeclarativeDomObject::dynamicProperty(const QByteArray &name) const
{
- QmlDomDynamicProperty p;
+ QDeclarativeDomDynamicProperty p;
if (!isValid())
return p;
for (int i = 0; i < d->object->dynamicProperties.size(); ++i) {
if (d->object->dynamicProperties.at(i).name == name) {
- p.d = new QmlDomDynamicPropertyPrivate;
+ p.d = new QDeclarativeDomDynamicPropertyPrivate;
p.d->property = d->object->dynamicProperties.at(i);
if (p.d->property.defaultValue) p.d->property.defaultValue->addref();
p.d->valid = true;
@@ -875,9 +875,9 @@ QmlDomDynamicProperty QmlDomObject::dynamicProperty(const QByteArray &name) cons
\note Currently this method will always return false, and is a placekeeper
for future functionality.
- \sa QmlDomObject::customTypeData()
+ \sa QDeclarativeDomObject::customTypeData()
*/
-bool QmlDomObject::isCustomType() const
+bool QDeclarativeDomObject::isCustomType() const
{
return false;
}
@@ -885,36 +885,36 @@ bool QmlDomObject::isCustomType() const
/*!
If this object represents a custom type, returns the data associated with
the custom type, otherwise returns an empty QByteArray().
- QmlDomObject::isCustomType() can be used to check if this object represents
+ QDeclarativeDomObject::isCustomType() can be used to check if this object represents
a custom type.
*/
-QByteArray QmlDomObject::customTypeData() const
+QByteArray QDeclarativeDomObject::customTypeData() const
{
return QByteArray();
}
/*!
Returns true if this object is a sub-component object. Sub-component
- objects can be converted into QmlDomComponent instances by calling
- QmlDomObject::toComponent().
+ objects can be converted into QDeclarativeDomComponent instances by calling
+ QDeclarativeDomObject::toComponent().
- \sa QmlDomObject::toComponent()
+ \sa QDeclarativeDomObject::toComponent()
*/
-bool QmlDomObject::isComponent() const
+bool QDeclarativeDomObject::isComponent() const
{
return (d->object && d->object->typeName == "Qt/Component");
}
/*!
- Returns a QmlDomComponent for this object if it is a sub-component, or
- an invalid QmlDomComponent if not. QmlDomObject::isComponent() can be used
+ Returns a QDeclarativeDomComponent for this object if it is a sub-component, or
+ an invalid QDeclarativeDomComponent if not. QDeclarativeDomObject::isComponent() can be used
to check if this object represents a sub-component.
- \sa QmlDomObject::isComponent()
+ \sa QDeclarativeDomObject::isComponent()
*/
-QmlDomComponent QmlDomObject::toComponent() const
+QDeclarativeDomComponent QDeclarativeDomObject::toComponent() const
{
- QmlDomComponent rv;
+ QDeclarativeDomComponent rv;
if (isComponent())
rv.d = d;
return rv;
@@ -924,7 +924,7 @@ QmlDomComponent QmlDomObject::toComponent() const
Returns the position in the input data where the property assignment started
, or -1 if the property is invalid.
*/
-int QmlDomObject::position() const
+int QDeclarativeDomObject::position() const
{
if (d && d->object)
return d->object->location.range.offset;
@@ -936,7 +936,7 @@ int QmlDomObject::position() const
Returns the length in the input data from where the property assignment star
ted upto the end of it, or -1 if the property is invalid.
*/
-int QmlDomObject::length() const
+int QDeclarativeDomObject::length() const
{
if (d && d->object)
return d->object->location.range.length;
@@ -946,7 +946,7 @@ int QmlDomObject::length() const
// Returns the URL of the type, if it is an external type, or an empty URL if
// not
-QUrl QmlDomObject::url() const
+QUrl QDeclarativeDomObject::url() const
{
if (d && d->object)
return d->object->url;
@@ -954,20 +954,20 @@ QUrl QmlDomObject::url() const
return QUrl();
}
-QmlDomBasicValuePrivate::QmlDomBasicValuePrivate()
+QDeclarativeDomBasicValuePrivate::QDeclarativeDomBasicValuePrivate()
: value(0)
{
}
-QmlDomBasicValuePrivate::~QmlDomBasicValuePrivate()
+QDeclarativeDomBasicValuePrivate::~QDeclarativeDomBasicValuePrivate()
{
if (value) value->release();
}
/*!
- \class QmlDomValueLiteral
+ \class QDeclarativeDomValueLiteral
\internal
- \brief The QmlDomValueLiteral class represents a literal value.
+ \brief The QDeclarativeDomValueLiteral class represents a literal value.
A literal value is a simple value, written inline with the QML. In the
example below, the "x", "y" and "color" properties are being assigned
@@ -983,32 +983,32 @@ Rectangle {
*/
/*!
- Construct an empty QmlDomValueLiteral.
+ Construct an empty QDeclarativeDomValueLiteral.
*/
-QmlDomValueLiteral::QmlDomValueLiteral():
- d(new QmlDomBasicValuePrivate)
+QDeclarativeDomValueLiteral::QDeclarativeDomValueLiteral():
+ d(new QDeclarativeDomBasicValuePrivate)
{
}
/*!
- Create a copy of \a other QmlDomValueLiteral.
+ Create a copy of \a other QDeclarativeDomValueLiteral.
*/
-QmlDomValueLiteral::QmlDomValueLiteral(const QmlDomValueLiteral &other)
+QDeclarativeDomValueLiteral::QDeclarativeDomValueLiteral(const QDeclarativeDomValueLiteral &other)
: d(other.d)
{
}
/*!
- Destroy the QmlDomValueLiteral.
+ Destroy the QDeclarativeDomValueLiteral.
*/
-QmlDomValueLiteral::~QmlDomValueLiteral()
+QDeclarativeDomValueLiteral::~QDeclarativeDomValueLiteral()
{
}
/*!
- Assign \a other to this QmlDomValueLiteral.
+ Assign \a other to this QDeclarativeDomValueLiteral.
*/
-QmlDomValueLiteral &QmlDomValueLiteral::operator=(const QmlDomValueLiteral &other)
+QDeclarativeDomValueLiteral &QDeclarativeDomValueLiteral::operator=(const QDeclarativeDomValueLiteral &other)
{
d = other.d;
return *this;
@@ -1022,16 +1022,16 @@ QmlDomValueLiteral &QmlDomValueLiteral::operator=(const QmlDomValueLiteral &othe
Rectangle { x: 10 }
\endqml
*/
-QString QmlDomValueLiteral::literal() const
+QString QDeclarativeDomValueLiteral::literal() const
{
if (d->value) return d->value->primitive();
else return QString();
}
/*!
- \class QmlDomValueBinding
+ \class QDeclarativeDomValueBinding
\internal
- \brief The QmlDomValueBinding class represents a property binding.
+ \brief The QDeclarativeDomValueBinding class represents a property binding.
A property binding is an ECMAScript expression assigned to a property. In
the example below, the "x" property is being assigned a property binding.
@@ -1042,32 +1042,32 @@ Rectangle { x: Other.x }
*/
/*!
- Construct an empty QmlDomValueBinding.
+ Construct an empty QDeclarativeDomValueBinding.
*/
-QmlDomValueBinding::QmlDomValueBinding():
- d(new QmlDomBasicValuePrivate)
+QDeclarativeDomValueBinding::QDeclarativeDomValueBinding():
+ d(new QDeclarativeDomBasicValuePrivate)
{
}
/*!
- Create a copy of \a other QmlDomValueBinding.
+ Create a copy of \a other QDeclarativeDomValueBinding.
*/
-QmlDomValueBinding::QmlDomValueBinding(const QmlDomValueBinding &other)
+QDeclarativeDomValueBinding::QDeclarativeDomValueBinding(const QDeclarativeDomValueBinding &other)
: d(other.d)
{
}
/*!
- Destroy the QmlDomValueBinding.
+ Destroy the QDeclarativeDomValueBinding.
*/
-QmlDomValueBinding::~QmlDomValueBinding()
+QDeclarativeDomValueBinding::~QDeclarativeDomValueBinding()
{
}
/*!
- Assign \a other to this QmlDomValueBinding.
+ Assign \a other to this QDeclarativeDomValueBinding.
*/
-QmlDomValueBinding &QmlDomValueBinding::operator=(const QmlDomValueBinding &other)
+QDeclarativeDomValueBinding &QDeclarativeDomValueBinding::operator=(const QDeclarativeDomValueBinding &other)
{
d = other.d;
return *this;
@@ -1081,7 +1081,7 @@ QmlDomValueBinding &QmlDomValueBinding::operator=(const QmlDomValueBinding &othe
Rectangle { x: Other.x }
\endqml
*/
-QString QmlDomValueBinding::binding() const
+QString QDeclarativeDomValueBinding::binding() const
{
if (d->value)
return d->value->value.asScript();
@@ -1090,12 +1090,12 @@ QString QmlDomValueBinding::binding() const
}
/*!
- \class QmlDomValueValueSource
+ \class QDeclarativeDomValueValueSource
\internal
- \brief The QmlDomValueValueSource class represents a value source assignment value.
+ \brief The QDeclarativeDomValueValueSource class represents a value source assignment value.
In QML, value sources are special value generating types that may be
- assigned to properties. Value sources inherit the QmlPropertyValueSource
+ assigned to properties. Value sources inherit the QDeclarativePropertyValueSource
class. In the example below, the "x" property is being assigned the
NumberAnimation value source.
@@ -1112,32 +1112,32 @@ Rectangle {
*/
/*!
- Construct an empty QmlDomValueValueSource.
+ Construct an empty QDeclarativeDomValueValueSource.
*/
-QmlDomValueValueSource::QmlDomValueValueSource():
- d(new QmlDomBasicValuePrivate)
+QDeclarativeDomValueValueSource::QDeclarativeDomValueValueSource():
+ d(new QDeclarativeDomBasicValuePrivate)
{
}
/*!
- Create a copy of \a other QmlDomValueValueSource.
+ Create a copy of \a other QDeclarativeDomValueValueSource.
*/
-QmlDomValueValueSource::QmlDomValueValueSource(const QmlDomValueValueSource &other)
+QDeclarativeDomValueValueSource::QDeclarativeDomValueValueSource(const QDeclarativeDomValueValueSource &other)
: d(other.d)
{
}
/*!
- Destroy the QmlDomValueValueSource.
+ Destroy the QDeclarativeDomValueValueSource.
*/
-QmlDomValueValueSource::~QmlDomValueValueSource()
+QDeclarativeDomValueValueSource::~QDeclarativeDomValueValueSource()
{
}
/*!
- Assign \a other to this QmlDomValueValueSource.
+ Assign \a other to this QDeclarativeDomValueValueSource.
*/
-QmlDomValueValueSource &QmlDomValueValueSource::operator=(const QmlDomValueValueSource &other)
+QDeclarativeDomValueValueSource &QDeclarativeDomValueValueSource::operator=(const QDeclarativeDomValueValueSource &other)
{
d = other.d;
return *this;
@@ -1159,9 +1159,9 @@ Rectangle {
}
\endqml
*/
-QmlDomObject QmlDomValueValueSource::object() const
+QDeclarativeDomObject QDeclarativeDomValueValueSource::object() const
{
- QmlDomObject rv;
+ QDeclarativeDomObject rv;
if (d->value) {
rv.d->object = d->value->object;
rv.d->object->addref();
@@ -1170,12 +1170,12 @@ QmlDomObject QmlDomValueValueSource::object() const
}
/*!
- \class QmlDomValueValueInterceptor
+ \class QDeclarativeDomValueValueInterceptor
\internal
- \brief The QmlDomValueValueInterceptor class represents a value interceptor assignment value.
+ \brief The QDeclarativeDomValueValueInterceptor class represents a value interceptor assignment value.
In QML, value interceptor are special write-intercepting types that may be
- assigned to properties. Value interceptor inherit the QmlPropertyValueInterceptor
+ assigned to properties. Value interceptor inherit the QDeclarativePropertyValueInterceptor
class. In the example below, the "x" property is being assigned the
Behavior value interceptor.
@@ -1187,32 +1187,32 @@ Rectangle {
*/
/*!
- Construct an empty QmlDomValueValueInterceptor.
+ Construct an empty QDeclarativeDomValueValueInterceptor.
*/
-QmlDomValueValueInterceptor::QmlDomValueValueInterceptor():
- d(new QmlDomBasicValuePrivate)
+QDeclarativeDomValueValueInterceptor::QDeclarativeDomValueValueInterceptor():
+ d(new QDeclarativeDomBasicValuePrivate)
{
}
/*!
- Create a copy of \a other QmlDomValueValueInterceptor.
+ Create a copy of \a other QDeclarativeDomValueValueInterceptor.
*/
-QmlDomValueValueInterceptor::QmlDomValueValueInterceptor(const QmlDomValueValueInterceptor &other)
+QDeclarativeDomValueValueInterceptor::QDeclarativeDomValueValueInterceptor(const QDeclarativeDomValueValueInterceptor &other)
: d(other.d)
{
}
/*!
- Destroy the QmlDomValueValueInterceptor.
+ Destroy the QDeclarativeDomValueValueInterceptor.
*/
-QmlDomValueValueInterceptor::~QmlDomValueValueInterceptor()
+QDeclarativeDomValueValueInterceptor::~QDeclarativeDomValueValueInterceptor()
{
}
/*!
- Assign \a other to this QmlDomValueValueInterceptor.
+ Assign \a other to this QDeclarativeDomValueValueInterceptor.
*/
-QmlDomValueValueInterceptor &QmlDomValueValueInterceptor::operator=(const QmlDomValueValueInterceptor &other)
+QDeclarativeDomValueValueInterceptor &QDeclarativeDomValueValueInterceptor::operator=(const QDeclarativeDomValueValueInterceptor &other)
{
d = other.d;
return *this;
@@ -1229,9 +1229,9 @@ Rectangle {
}
\endqml
*/
-QmlDomObject QmlDomValueValueInterceptor::object() const
+QDeclarativeDomObject QDeclarativeDomValueValueInterceptor::object() const
{
- QmlDomObject rv;
+ QDeclarativeDomObject rv;
if (d->value) {
rv.d->object = d->value->object;
rv.d->object->addref();
@@ -1239,26 +1239,26 @@ QmlDomObject QmlDomValueValueInterceptor::object() const
return rv;
}
-QmlDomValuePrivate::QmlDomValuePrivate()
+QDeclarativeDomValuePrivate::QDeclarativeDomValuePrivate()
: property(0), value(0)
{
}
-QmlDomValuePrivate::~QmlDomValuePrivate()
+QDeclarativeDomValuePrivate::~QDeclarativeDomValuePrivate()
{
if (property) property->release();
if (value) value->release();
}
/*!
- \class QmlDomValue
+ \class QDeclarativeDomValue
\internal
- \brief The QmlDomValue class represents a generic Qml value.
+ \brief The QDeclarativeDomValue class represents a generic Qml value.
- QmlDomValue's can be assigned to QML \l {QmlDomProperty}{properties}. In
+ QDeclarativeDomValue's can be assigned to QML \l {QDeclarativeDomProperty}{properties}. In
QML, properties can be assigned various different values, including basic
literals, property bindings, property value sources, objects and lists of
- values. The QmlDomValue class allows a programmer to determine the specific
+ values. The QDeclarativeDomValue class allows a programmer to determine the specific
value type being assigned and access more detailed information through a
corresponding value type class.
@@ -1276,101 +1276,101 @@ Text {
above example from C++,
\code
- QmlDomDocument document;
- QmlDomObject root = document.rootObject();
+ QDeclarativeDomDocument document;
+ QDeclarativeDomObject root = document.rootObject();
- QmlDomProperty text = root.property("text");
+ QDeclarativeDomProperty text = root.property("text");
if (text.value().isLiteral()) {
- QmlDomValueLiteral literal = text.value().toLiteral();
+ QDeclarativeDomValueLiteral literal = text.value().toLiteral();
qDebug() << literal.literal();
}
- QmlDomProperty y = root.property("y");
+ QDeclarativeDomProperty y = root.property("y");
if (y.value().isBinding()) {
- QmlDomValueBinding binding = y.value().toBinding();
+ QDeclarativeDomValueBinding binding = y.value().toBinding();
qDebug() << binding.binding();
}
\endcode
*/
/*!
- Construct an invalid QmlDomValue.
+ Construct an invalid QDeclarativeDomValue.
*/
-QmlDomValue::QmlDomValue()
-: d(new QmlDomValuePrivate)
+QDeclarativeDomValue::QDeclarativeDomValue()
+: d(new QDeclarativeDomValuePrivate)
{
}
/*!
- Create a copy of \a other QmlDomValue.
+ Create a copy of \a other QDeclarativeDomValue.
*/
-QmlDomValue::QmlDomValue(const QmlDomValue &other)
+QDeclarativeDomValue::QDeclarativeDomValue(const QDeclarativeDomValue &other)
: d(other.d)
{
}
/*!
- Destroy the QmlDomValue
+ Destroy the QDeclarativeDomValue
*/
-QmlDomValue::~QmlDomValue()
+QDeclarativeDomValue::~QDeclarativeDomValue()
{
}
/*!
- Assign \a other to this QmlDomValue.
+ Assign \a other to this QDeclarativeDomValue.
*/
-QmlDomValue &QmlDomValue::operator=(const QmlDomValue &other)
+QDeclarativeDomValue &QDeclarativeDomValue::operator=(const QDeclarativeDomValue &other)
{
d = other.d;
return *this;
}
/*!
- \enum QmlDomValue::Type
+ \enum QDeclarativeDomValue::Type
- The type of the QmlDomValue node.
+ The type of the QDeclarativeDomValue node.
- \value Invalid The QmlDomValue is invalid.
- \value Literal The QmlDomValue is a literal value assignment. Use QmlDomValue::toLiteral() to access the type instance.
- \value PropertyBinding The QmlDomValue is a property binding. Use QmlDomValue::toBinding() to access the type instance.
- \value ValueSource The QmlDomValue is a property value source. Use QmlDomValue::toValueSource() to access the type instance.
- \value ValueInterceptor The QmlDomValue is a property value interceptor. Use QmlDomValue::toValueInterceptor() to access the type instance.
- \value Object The QmlDomValue is an object assignment. Use QmlDomValue::toObject() to access the type instnace.
- \value List The QmlDomValue is a list of other values. Use QmlDomValue::toList() to access the type instance.
+ \value Invalid The QDeclarativeDomValue is invalid.
+ \value Literal The QDeclarativeDomValue is a literal value assignment. Use QDeclarativeDomValue::toLiteral() to access the type instance.
+ \value PropertyBinding The QDeclarativeDomValue is a property binding. Use QDeclarativeDomValue::toBinding() to access the type instance.
+ \value ValueSource The QDeclarativeDomValue is a property value source. Use QDeclarativeDomValue::toValueSource() to access the type instance.
+ \value ValueInterceptor The QDeclarativeDomValue is a property value interceptor. Use QDeclarativeDomValue::toValueInterceptor() to access the type instance.
+ \value Object The QDeclarativeDomValue is an object assignment. Use QDeclarativeDomValue::toObject() to access the type instnace.
+ \value List The QDeclarativeDomValue is a list of other values. Use QDeclarativeDomValue::toList() to access the type instance.
*/
/*!
- Returns the type of this QmlDomValue.
+ Returns the type of this QDeclarativeDomValue.
*/
-QmlDomValue::Type QmlDomValue::type() const
+QDeclarativeDomValue::Type QDeclarativeDomValue::type() const
{
if (d->property)
- if (QmlMetaType::isList(d->property->type) ||
+ if (QDeclarativeMetaType::isList(d->property->type) ||
(d->property && d->property->values.count() > 1))
return List;
- QmlParser::Value *value = d->value;
+ QDeclarativeParser::Value *value = d->value;
if (!value && !d->property)
return Invalid;
switch(value->type) {
- case QmlParser::Value::Unknown:
+ case QDeclarativeParser::Value::Unknown:
return Invalid;
- case QmlParser::Value::Literal:
+ case QDeclarativeParser::Value::Literal:
return Literal;
- case QmlParser::Value::PropertyBinding:
+ case QDeclarativeParser::Value::PropertyBinding:
return PropertyBinding;
- case QmlParser::Value::ValueSource:
+ case QDeclarativeParser::Value::ValueSource:
return ValueSource;
- case QmlParser::Value::ValueInterceptor:
+ case QDeclarativeParser::Value::ValueInterceptor:
return ValueInterceptor;
- case QmlParser::Value::CreatedObject:
+ case QDeclarativeParser::Value::CreatedObject:
return Object;
- case QmlParser::Value::SignalObject:
+ case QDeclarativeParser::Value::SignalObject:
return Invalid;
- case QmlParser::Value::SignalExpression:
+ case QDeclarativeParser::Value::SignalExpression:
return Literal;
- case QmlParser::Value::Id:
+ case QDeclarativeParser::Value::Id:
return Literal;
}
return Invalid;
@@ -1379,7 +1379,7 @@ QmlDomValue::Type QmlDomValue::type() const
/*!
Returns true if this is an invalid value, otherwise false.
*/
-bool QmlDomValue::isInvalid() const
+bool QDeclarativeDomValue::isInvalid() const
{
return type() == Invalid;
}
@@ -1387,7 +1387,7 @@ bool QmlDomValue::isInvalid() const
/*!
Returns true if this is a literal value, otherwise false.
*/
-bool QmlDomValue::isLiteral() const
+bool QDeclarativeDomValue::isLiteral() const
{
return type() == Literal;
}
@@ -1395,7 +1395,7 @@ bool QmlDomValue::isLiteral() const
/*!
Returns true if this is a property binding value, otherwise false.
*/
-bool QmlDomValue::isBinding() const
+bool QDeclarativeDomValue::isBinding() const
{
return type() == PropertyBinding;
}
@@ -1403,7 +1403,7 @@ bool QmlDomValue::isBinding() const
/*!
Returns true if this is a value source value, otherwise false.
*/
-bool QmlDomValue::isValueSource() const
+bool QDeclarativeDomValue::isValueSource() const
{
return type() == ValueSource;
}
@@ -1411,7 +1411,7 @@ bool QmlDomValue::isValueSource() const
/*!
Returns true if this is a value interceptor value, otherwise false.
*/
-bool QmlDomValue::isValueInterceptor() const
+bool QDeclarativeDomValue::isValueInterceptor() const
{
return type() == ValueInterceptor;
}
@@ -1419,7 +1419,7 @@ bool QmlDomValue::isValueInterceptor() const
/*!
Returns true if this is an object value, otherwise false.
*/
-bool QmlDomValue::isObject() const
+bool QDeclarativeDomValue::isObject() const
{
return type() == Object;
}
@@ -1427,20 +1427,20 @@ bool QmlDomValue::isObject() const
/*!
Returns true if this is a list value, otherwise false.
*/
-bool QmlDomValue::isList() const
+bool QDeclarativeDomValue::isList() const
{
return type() == List;
}
/*!
- Returns a QmlDomValueLiteral if this value is a literal type, otherwise
- returns an invalid QmlDomValueLiteral.
+ Returns a QDeclarativeDomValueLiteral if this value is a literal type, otherwise
+ returns an invalid QDeclarativeDomValueLiteral.
- \sa QmlDomValue::type()
+ \sa QDeclarativeDomValue::type()
*/
-QmlDomValueLiteral QmlDomValue::toLiteral() const
+QDeclarativeDomValueLiteral QDeclarativeDomValue::toLiteral() const
{
- QmlDomValueLiteral rv;
+ QDeclarativeDomValueLiteral rv;
if (type() == Literal) {
rv.d->value = d->value;
rv.d->value->addref();
@@ -1449,14 +1449,14 @@ QmlDomValueLiteral QmlDomValue::toLiteral() const
}
/*!
- Returns a QmlDomValueBinding if this value is a property binding type,
- otherwise returns an invalid QmlDomValueBinding.
+ Returns a QDeclarativeDomValueBinding if this value is a property binding type,
+ otherwise returns an invalid QDeclarativeDomValueBinding.
- \sa QmlDomValue::type()
+ \sa QDeclarativeDomValue::type()
*/
-QmlDomValueBinding QmlDomValue::toBinding() const
+QDeclarativeDomValueBinding QDeclarativeDomValue::toBinding() const
{
- QmlDomValueBinding rv;
+ QDeclarativeDomValueBinding rv;
if (type() == PropertyBinding) {
rv.d->value = d->value;
rv.d->value->addref();
@@ -1465,14 +1465,14 @@ QmlDomValueBinding QmlDomValue::toBinding() const
}
/*!
- Returns a QmlDomValueValueSource if this value is a property value source
- type, otherwise returns an invalid QmlDomValueValueSource.
+ Returns a QDeclarativeDomValueValueSource if this value is a property value source
+ type, otherwise returns an invalid QDeclarativeDomValueValueSource.
- \sa QmlDomValue::type()
+ \sa QDeclarativeDomValue::type()
*/
-QmlDomValueValueSource QmlDomValue::toValueSource() const
+QDeclarativeDomValueValueSource QDeclarativeDomValue::toValueSource() const
{
- QmlDomValueValueSource rv;
+ QDeclarativeDomValueValueSource rv;
if (type() == ValueSource) {
rv.d->value = d->value;
rv.d->value->addref();
@@ -1481,14 +1481,14 @@ QmlDomValueValueSource QmlDomValue::toValueSource() const
}
/*!
- Returns a QmlDomValueValueInterceptor if this value is a property value interceptor
- type, otherwise returns an invalid QmlDomValueValueInterceptor.
+ Returns a QDeclarativeDomValueValueInterceptor if this value is a property value interceptor
+ type, otherwise returns an invalid QDeclarativeDomValueValueInterceptor.
- \sa QmlDomValue::type()
+ \sa QDeclarativeDomValue::type()
*/
-QmlDomValueValueInterceptor QmlDomValue::toValueInterceptor() const
+QDeclarativeDomValueValueInterceptor QDeclarativeDomValue::toValueInterceptor() const
{
- QmlDomValueValueInterceptor rv;
+ QDeclarativeDomValueValueInterceptor rv;
if (type() == ValueInterceptor) {
rv.d->value = d->value;
rv.d->value->addref();
@@ -1497,14 +1497,14 @@ QmlDomValueValueInterceptor QmlDomValue::toValueInterceptor() const
}
/*!
- Returns a QmlDomObject if this value is an object assignment type, otherwise
- returns an invalid QmlDomObject.
+ Returns a QDeclarativeDomObject if this value is an object assignment type, otherwise
+ returns an invalid QDeclarativeDomObject.
- \sa QmlDomValue::type()
+ \sa QDeclarativeDomValue::type()
*/
-QmlDomObject QmlDomValue::toObject() const
+QDeclarativeDomObject QDeclarativeDomValue::toObject() const
{
- QmlDomObject rv;
+ QDeclarativeDomObject rv;
if (type() == Object) {
rv.d->object = d->value->object;
rv.d->object->addref();
@@ -1513,14 +1513,14 @@ QmlDomObject QmlDomValue::toObject() const
}
/*!
- Returns a QmlDomList if this value is a list type, otherwise returns an
- invalid QmlDomList.
+ Returns a QDeclarativeDomList if this value is a list type, otherwise returns an
+ invalid QDeclarativeDomList.
- \sa QmlDomValue::type()
+ \sa QDeclarativeDomValue::type()
*/
-QmlDomList QmlDomValue::toList() const
+QDeclarativeDomList QDeclarativeDomValue::toList() const
{
- QmlDomList rv;
+ QDeclarativeDomList rv;
if (type() == List) {
rv.d = d;
}
@@ -1531,7 +1531,7 @@ QmlDomList QmlDomValue::toList() const
Returns the position in the input data where the property value startd, or -1
if the value is invalid.
*/
-int QmlDomValue::position() const
+int QDeclarativeDomValue::position() const
{
if (type() == Invalid)
return -1;
@@ -1543,7 +1543,7 @@ int QmlDomValue::position() const
Returns the length in the input data from where the property value started u
pto the end of it, or -1 if the value is invalid.
*/
-int QmlDomValue::length() const
+int QDeclarativeDomValue::length() const
{
if (type() == Invalid)
return -1;
@@ -1552,9 +1552,9 @@ int QmlDomValue::length() const
}
/*!
- \class QmlDomList
+ \class QDeclarativeDomList
\internal
- \brief The QmlDomList class represents a list of values assigned to a QML property.
+ \brief The QDeclarativeDomList class represents a list of values assigned to a QML property.
Lists of values can be assigned to properties. For example, the following
example assigns multiple objects to Item's "children" property
@@ -1568,7 +1568,7 @@ Item {
\endqml
Lists can also be implicitly created by assigning multiple
- \l {QmlDomValueValueSource}{value sources} or constants to a property.
+ \l {QDeclarativeDomValueValueSource}{value sources} or constants to a property.
\qml
Item {
x: 10
@@ -1582,47 +1582,47 @@ Item {
*/
/*!
- Construct an empty QmlDomList.
+ Construct an empty QDeclarativeDomList.
*/
-QmlDomList::QmlDomList()
+QDeclarativeDomList::QDeclarativeDomList()
{
}
/*!
- Create a copy of \a other QmlDomList.
+ Create a copy of \a other QDeclarativeDomList.
*/
-QmlDomList::QmlDomList(const QmlDomList &other)
+QDeclarativeDomList::QDeclarativeDomList(const QDeclarativeDomList &other)
: d(other.d)
{
}
/*!
- Destroy the QmlDomList.
+ Destroy the QDeclarativeDomList.
*/
-QmlDomList::~QmlDomList()
+QDeclarativeDomList::~QDeclarativeDomList()
{
}
/*!
- Assign \a other to this QmlDomList.
+ Assign \a other to this QDeclarativeDomList.
*/
-QmlDomList &QmlDomList::operator=(const QmlDomList &other)
+QDeclarativeDomList &QDeclarativeDomList::operator=(const QDeclarativeDomList &other)
{
d = other.d;
return *this;
}
/*!
- Returns the list of QmlDomValue's.
+ Returns the list of QDeclarativeDomValue's.
*/
-QList<QmlDomValue> QmlDomList::values() const
+QList<QDeclarativeDomValue> QDeclarativeDomList::values() const
{
- QList<QmlDomValue> rv;
+ QList<QDeclarativeDomValue> rv;
if (!d->property)
return rv;
for (int ii = 0; ii < d->property->values.count(); ++ii) {
- QmlDomValue v;
+ QDeclarativeDomValue v;
v.d->value = d->property->values.at(ii);
v.d->value->addref();
rv << v;
@@ -1635,7 +1635,7 @@ QList<QmlDomValue> QmlDomList::values() const
Returns the position in the input data where the list started, or -1 if
the property is invalid.
*/
-int QmlDomList::position() const
+int QDeclarativeDomList::position() const
{
if (d && d->property) {
return d->property->listValueRange.offset;
@@ -1647,7 +1647,7 @@ int QmlDomList::position() const
Returns the length in the input data from where the list started upto
the end of it, or 0 if the property is invalid.
*/
-int QmlDomList::length() const
+int QDeclarativeDomList::length() const
{
if (d && d->property)
return d->property->listValueRange.length;
@@ -1658,7 +1658,7 @@ int QmlDomList::length() const
/*!
Returns a list of positions of the commas in the QML file.
*/
-QList<int> QmlDomList:: commaPositions() const
+QList<int> QDeclarativeDomList:: commaPositions() const
{
if (d && d->property)
return d->property->listCommaPositions;
@@ -1667,11 +1667,11 @@ QList<int> QmlDomList:: commaPositions() const
}
/*!
- \class QmlDomComponent
+ \class QDeclarativeDomComponent
\internal
- \brief The QmlDomComponent class represents sub-component within a QML document.
+ \brief The QDeclarativeDomComponent class represents sub-component within a QML document.
- Sub-components are QmlComponents defined within a QML document. The
+ Sub-components are QDeclarativeComponents defined within a QML document. The
following example shows the definition of a sub-component with the id
"listDelegate".
@@ -1686,37 +1686,37 @@ Item {
}
\endqml
- Like QmlDomDocument's, components contain a single root object.
+ Like QDeclarativeDomDocument's, components contain a single root object.
*/
/*!
- Construct an empty QmlDomComponent.
+ Construct an empty QDeclarativeDomComponent.
*/
-QmlDomComponent::QmlDomComponent()
+QDeclarativeDomComponent::QDeclarativeDomComponent()
{
}
/*!
- Create a copy of \a other QmlDomComponent.
+ Create a copy of \a other QDeclarativeDomComponent.
*/
-QmlDomComponent::QmlDomComponent(const QmlDomComponent &other)
-: QmlDomObject(other)
+QDeclarativeDomComponent::QDeclarativeDomComponent(const QDeclarativeDomComponent &other)
+: QDeclarativeDomObject(other)
{
}
/*!
- Destroy the QmlDomComponent.
+ Destroy the QDeclarativeDomComponent.
*/
-QmlDomComponent::~QmlDomComponent()
+QDeclarativeDomComponent::~QDeclarativeDomComponent()
{
}
/*!
- Assign \a other to this QmlDomComponent.
+ Assign \a other to this QDeclarativeDomComponent.
*/
-QmlDomComponent &QmlDomComponent::operator=(const QmlDomComponent &other)
+QDeclarativeDomComponent &QDeclarativeDomComponent::operator=(const QDeclarativeDomComponent &other)
{
- static_cast<QmlDomObject &>(*this) = other;
+ static_cast<QDeclarativeDomObject &>(*this) = other;
return *this;
}
@@ -1735,11 +1735,11 @@ Item {
}
\endqml
*/
-QmlDomObject QmlDomComponent::componentRoot() const
+QDeclarativeDomObject QDeclarativeDomComponent::componentRoot() const
{
- QmlDomObject rv;
+ QDeclarativeDomObject rv;
if (d->object) {
- QmlParser::Object *obj = 0;
+ QDeclarativeParser::Object *obj = 0;
if (d->object->defaultProperty &&
d->object->defaultProperty->values.count() == 1 &&
d->object->defaultProperty->values.at(0)->object)
@@ -1754,48 +1754,48 @@ QmlDomObject QmlDomComponent::componentRoot() const
return rv;
}
-QmlDomImportPrivate::QmlDomImportPrivate()
+QDeclarativeDomImportPrivate::QDeclarativeDomImportPrivate()
: type(File)
{
}
-QmlDomImportPrivate::~QmlDomImportPrivate()
+QDeclarativeDomImportPrivate::~QDeclarativeDomImportPrivate()
{
}
/*!
- \class QmlDomImport
+ \class QDeclarativeDomImport
\internal
- \brief The QmlDomImport class represents an import statement.
+ \brief The QDeclarativeDomImport class represents an import statement.
*/
/*!
- Construct an empty QmlDomImport.
+ Construct an empty QDeclarativeDomImport.
*/
-QmlDomImport::QmlDomImport()
-: d(new QmlDomImportPrivate)
+QDeclarativeDomImport::QDeclarativeDomImport()
+: d(new QDeclarativeDomImportPrivate)
{
}
/*!
- Create a copy of \a other QmlDomImport.
+ Create a copy of \a other QDeclarativeDomImport.
*/
-QmlDomImport::QmlDomImport(const QmlDomImport &other)
+QDeclarativeDomImport::QDeclarativeDomImport(const QDeclarativeDomImport &other)
: d(other.d)
{
}
/*!
- Destroy the QmlDomImport.
+ Destroy the QDeclarativeDomImport.
*/
-QmlDomImport::~QmlDomImport()
+QDeclarativeDomImport::~QDeclarativeDomImport()
{
}
/*!
- Assign \a other to this QmlDomImport.
+ Assign \a other to this QDeclarativeDomImport.
*/
-QmlDomImport &QmlDomImport::operator=(const QmlDomImport &other)
+QDeclarativeDomImport &QDeclarativeDomImport::operator=(const QDeclarativeDomImport &other)
{
d = other.d;
return *this;
@@ -1804,15 +1804,15 @@ QmlDomImport &QmlDomImport::operator=(const QmlDomImport &other)
/*!
Returns the type of the import.
*/
-QmlDomImport::Type QmlDomImport::type() const
+QDeclarativeDomImport::Type QDeclarativeDomImport::type() const
{
- return static_cast<QmlDomImport::Type>(d->type);
+ return static_cast<QDeclarativeDomImport::Type>(d->type);
}
/*!
Returns the URI of the import (e.g. 'subdir' or 'com.nokia.Qt')
*/
-QString QmlDomImport::uri() const
+QString QDeclarativeDomImport::uri() const
{
return d->uri;
}
@@ -1820,7 +1820,7 @@ QString QmlDomImport::uri() const
/*!
Returns the version specified by the import. An empty string if no version was specified.
*/
-QString QmlDomImport::version() const
+QString QDeclarativeDomImport::version() const
{
return d->version;
}
@@ -1828,7 +1828,7 @@ QString QmlDomImport::version() const
/*!
Returns the (optional) qualifier string (the token following the 'as' keyword) of the import.
*/
-QString QmlDomImport::qualifier() const
+QString QDeclarativeDomImport::qualifier() const
{
return d->qualifier;
}
diff --git a/src/declarative/qml/qdeclarativedom_p.h b/src/declarative/qml/qdeclarativedom_p.h
new file mode 100644
index 0000000..6043ead
--- /dev/null
+++ b/src/declarative/qml/qdeclarativedom_p.h
@@ -0,0 +1,360 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVEDOM_P_H
+#define QDECLARATIVEDOM_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 "qdeclarativeerror.h"
+
+#include <QtCore/qlist.h>
+#include <QtCore/qshareddata.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class QString;
+class QByteArray;
+class QDeclarativeDomObject;
+class QDeclarativeDomList;
+class QDeclarativeDomValue;
+class QDeclarativeEngine;
+class QDeclarativeDomComponent;
+class QDeclarativeDomImport;
+class QIODevice;
+
+class QDeclarativeDomDocumentPrivate;
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDomDocument
+{
+public:
+ QDeclarativeDomDocument();
+ QDeclarativeDomDocument(const QDeclarativeDomDocument &);
+ ~QDeclarativeDomDocument();
+ QDeclarativeDomDocument &operator=(const QDeclarativeDomDocument &);
+
+ QList<QDeclarativeDomImport> imports() const;
+
+ QList<QDeclarativeError> errors() const;
+ bool load(QDeclarativeEngine *, const QByteArray &, const QUrl & = QUrl());
+
+ QDeclarativeDomObject rootObject() const;
+
+private:
+ QSharedDataPointer<QDeclarativeDomDocumentPrivate> d;
+};
+
+class QDeclarativeDomPropertyPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeDomProperty
+{
+public:
+ QDeclarativeDomProperty();
+ QDeclarativeDomProperty(const QDeclarativeDomProperty &);
+ ~QDeclarativeDomProperty();
+ QDeclarativeDomProperty &operator=(const QDeclarativeDomProperty &);
+
+ bool isValid() const;
+
+ QByteArray propertyName() const;
+ QList<QByteArray> propertyNameParts() const;
+
+ bool isDefaultProperty() const;
+
+ QDeclarativeDomValue value() const;
+
+ int position() const;
+ int length() const;
+
+private:
+ friend class QDeclarativeDomObject;
+ friend class QDeclarativeDomDynamicProperty;
+ QSharedDataPointer<QDeclarativeDomPropertyPrivate> d;
+};
+
+class QDeclarativeDomDynamicPropertyPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeDomDynamicProperty
+{
+public:
+ QDeclarativeDomDynamicProperty();
+ QDeclarativeDomDynamicProperty(const QDeclarativeDomDynamicProperty &);
+ ~QDeclarativeDomDynamicProperty();
+ QDeclarativeDomDynamicProperty &operator=(const QDeclarativeDomDynamicProperty &);
+
+ bool isValid() const;
+
+ QByteArray propertyName() const;
+ int propertyType() const;
+ QByteArray propertyTypeName() const;
+
+ bool isDefaultProperty() const;
+ QDeclarativeDomProperty defaultValue() const;
+
+ bool isAlias() const;
+
+ int position() const;
+ int length() const;
+
+private:
+ friend class QDeclarativeDomObject;
+ QSharedDataPointer<QDeclarativeDomDynamicPropertyPrivate> d;
+};
+
+class QDeclarativeDomObjectPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeDomObject
+{
+public:
+ QDeclarativeDomObject();
+ QDeclarativeDomObject(const QDeclarativeDomObject &);
+ ~QDeclarativeDomObject();
+ QDeclarativeDomObject &operator=(const QDeclarativeDomObject &);
+
+ bool isValid() const;
+
+ QByteArray objectType() const;
+ QByteArray objectClassName() const;
+
+ int objectTypeMajorVersion() const;
+ int objectTypeMinorVersion() const;
+
+ QString objectId() const;
+
+ QList<QDeclarativeDomProperty> properties() const;
+ QDeclarativeDomProperty property(const QByteArray &) const;
+
+ QList<QDeclarativeDomDynamicProperty> dynamicProperties() const;
+ QDeclarativeDomDynamicProperty dynamicProperty(const QByteArray &) const;
+
+ bool isCustomType() const;
+ QByteArray customTypeData() const;
+
+ bool isComponent() const;
+ QDeclarativeDomComponent toComponent() const;
+
+ int position() const;
+ int length() const;
+
+ QUrl url() const;
+private:
+ friend class QDeclarativeDomDocument;
+ friend class QDeclarativeDomComponent;
+ friend class QDeclarativeDomValue;
+ friend class QDeclarativeDomValueValueSource;
+ friend class QDeclarativeDomValueValueInterceptor;
+ QSharedDataPointer<QDeclarativeDomObjectPrivate> d;
+};
+
+class QDeclarativeDomValuePrivate;
+class QDeclarativeDomBasicValuePrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeDomValueLiteral
+{
+public:
+ QDeclarativeDomValueLiteral();
+ QDeclarativeDomValueLiteral(const QDeclarativeDomValueLiteral &);
+ ~QDeclarativeDomValueLiteral();
+ QDeclarativeDomValueLiteral &operator=(const QDeclarativeDomValueLiteral &);
+
+ QString literal() const;
+
+private:
+ friend class QDeclarativeDomValue;
+ QSharedDataPointer<QDeclarativeDomBasicValuePrivate> d;
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDomValueBinding
+{
+public:
+ QDeclarativeDomValueBinding();
+ QDeclarativeDomValueBinding(const QDeclarativeDomValueBinding &);
+ ~QDeclarativeDomValueBinding();
+ QDeclarativeDomValueBinding &operator=(const QDeclarativeDomValueBinding &);
+
+ QString binding() const;
+
+private:
+ friend class QDeclarativeDomValue;
+ QSharedDataPointer<QDeclarativeDomBasicValuePrivate> d;
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDomValueValueSource
+{
+public:
+ QDeclarativeDomValueValueSource();
+ QDeclarativeDomValueValueSource(const QDeclarativeDomValueValueSource &);
+ ~QDeclarativeDomValueValueSource();
+ QDeclarativeDomValueValueSource &operator=(const QDeclarativeDomValueValueSource &);
+
+ QDeclarativeDomObject object() const;
+
+private:
+ friend class QDeclarativeDomValue;
+ QSharedDataPointer<QDeclarativeDomBasicValuePrivate> d;
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDomValueValueInterceptor
+{
+public:
+ QDeclarativeDomValueValueInterceptor();
+ QDeclarativeDomValueValueInterceptor(const QDeclarativeDomValueValueInterceptor &);
+ ~QDeclarativeDomValueValueInterceptor();
+ QDeclarativeDomValueValueInterceptor &operator=(const QDeclarativeDomValueValueInterceptor &);
+
+ QDeclarativeDomObject object() const;
+
+private:
+ friend class QDeclarativeDomValue;
+ QSharedDataPointer<QDeclarativeDomBasicValuePrivate> d;
+};
+
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDomComponent : public QDeclarativeDomObject
+{
+public:
+ QDeclarativeDomComponent();
+ QDeclarativeDomComponent(const QDeclarativeDomComponent &);
+ ~QDeclarativeDomComponent();
+ QDeclarativeDomComponent &operator=(const QDeclarativeDomComponent &);
+
+ QDeclarativeDomObject componentRoot() const;
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDomValue
+{
+public:
+ enum Type {
+ Invalid,
+ Literal,
+ PropertyBinding,
+ ValueSource,
+ ValueInterceptor,
+ Object,
+ List
+ };
+
+ QDeclarativeDomValue();
+ QDeclarativeDomValue(const QDeclarativeDomValue &);
+ ~QDeclarativeDomValue();
+ QDeclarativeDomValue &operator=(const QDeclarativeDomValue &);
+
+ Type type() const;
+
+ bool isInvalid() const;
+ bool isLiteral() const;
+ bool isBinding() const;
+ bool isValueSource() const;
+ bool isValueInterceptor() const;
+ bool isObject() const;
+ bool isList() const;
+
+ QDeclarativeDomValueLiteral toLiteral() const;
+ QDeclarativeDomValueBinding toBinding() const;
+ QDeclarativeDomValueValueSource toValueSource() const;
+ QDeclarativeDomValueValueInterceptor toValueInterceptor() const;
+ QDeclarativeDomObject toObject() const;
+ QDeclarativeDomList toList() const;
+
+ int position() const;
+ int length() const;
+
+private:
+ friend class QDeclarativeDomProperty;
+ friend class QDeclarativeDomList;
+ QSharedDataPointer<QDeclarativeDomValuePrivate> d;
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeDomList
+{
+public:
+ QDeclarativeDomList();
+ QDeclarativeDomList(const QDeclarativeDomList &);
+ ~QDeclarativeDomList();
+ QDeclarativeDomList &operator=(const QDeclarativeDomList &);
+
+ QList<QDeclarativeDomValue> values() const;
+
+ int position() const;
+ int length() const;
+
+ QList<int> commaPositions() const;
+
+private:
+ friend class QDeclarativeDomValue;
+ QSharedDataPointer<QDeclarativeDomValuePrivate> d;
+};
+
+class QDeclarativeDomImportPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeDomImport
+{
+public:
+ enum Type { Library, File };
+
+ QDeclarativeDomImport();
+ QDeclarativeDomImport(const QDeclarativeDomImport &);
+ ~QDeclarativeDomImport();
+ QDeclarativeDomImport &operator=(const QDeclarativeDomImport &);
+
+ Type type() const;
+ QString uri() const;
+ QString version() const;
+ QString qualifier() const;
+
+private:
+ friend class QDeclarativeDomDocument;
+ QSharedDataPointer<QDeclarativeDomImportPrivate> d;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QDECLARATIVEDOM_P_H
diff --git a/src/declarative/qml/qmldom_p_p.h b/src/declarative/qml/qdeclarativedom_p_p.h
index 9d955b0..a065282 100644
--- a/src/declarative/qml/qmldom_p_p.h
+++ b/src/declarative/qml/qdeclarativedom_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLDOM_P_P_H
-#define QMLDOM_P_P_H
+#ifndef QDECLARATIVEDOM_P_P_H
+#define QDECLARATIVEDOM_P_P_H
//
// W A R N I N G
@@ -53,95 +53,95 @@
// We mean it.
//
-#include "qmlparser_p.h"
+#include "qdeclarativeparser_p.h"
#include <QtCore/QtGlobal>
QT_BEGIN_NAMESPACE
-class QmlDomDocumentPrivate : public QSharedData
+class QDeclarativeDomDocumentPrivate : public QSharedData
{
public:
- QmlDomDocumentPrivate();
- QmlDomDocumentPrivate(const QmlDomDocumentPrivate &o)
+ QDeclarativeDomDocumentPrivate();
+ QDeclarativeDomDocumentPrivate(const QDeclarativeDomDocumentPrivate &o)
: QSharedData(o) { qFatal("Not impl"); }
- ~QmlDomDocumentPrivate();
+ ~QDeclarativeDomDocumentPrivate();
- QList<QmlError> errors;
- QList<QmlDomImport> imports;
- QmlParser::Object *root;
+ QList<QDeclarativeError> errors;
+ QList<QDeclarativeDomImport> imports;
+ QDeclarativeParser::Object *root;
QList<int> automaticSemicolonOffsets;
};
-class QmlDomObjectPrivate : public QSharedData
+class QDeclarativeDomObjectPrivate : public QSharedData
{
public:
- QmlDomObjectPrivate();
- QmlDomObjectPrivate(const QmlDomObjectPrivate &o)
+ QDeclarativeDomObjectPrivate();
+ QDeclarativeDomObjectPrivate(const QDeclarativeDomObjectPrivate &o)
: QSharedData(o) { qFatal("Not impl"); }
- ~QmlDomObjectPrivate();
+ ~QDeclarativeDomObjectPrivate();
- typedef QList<QPair<QmlParser::Property *, QByteArray> > Properties;
+ typedef QList<QPair<QDeclarativeParser::Property *, QByteArray> > Properties;
Properties properties() const;
- Properties properties(QmlParser::Property *) const;
+ Properties properties(QDeclarativeParser::Property *) const;
- QmlParser::Object *object;
+ QDeclarativeParser::Object *object;
};
-class QmlDomPropertyPrivate : public QSharedData
+class QDeclarativeDomPropertyPrivate : public QSharedData
{
public:
- QmlDomPropertyPrivate();
- QmlDomPropertyPrivate(const QmlDomPropertyPrivate &o)
+ QDeclarativeDomPropertyPrivate();
+ QDeclarativeDomPropertyPrivate(const QDeclarativeDomPropertyPrivate &o)
: QSharedData(o) { qFatal("Not impl"); }
- ~QmlDomPropertyPrivate();
+ ~QDeclarativeDomPropertyPrivate();
QByteArray propertyName;
- QmlParser::Property *property;
+ QDeclarativeParser::Property *property;
};
-class QmlDomDynamicPropertyPrivate : public QSharedData
+class QDeclarativeDomDynamicPropertyPrivate : public QSharedData
{
public:
- QmlDomDynamicPropertyPrivate();
- QmlDomDynamicPropertyPrivate(const QmlDomDynamicPropertyPrivate &o)
+ QDeclarativeDomDynamicPropertyPrivate();
+ QDeclarativeDomDynamicPropertyPrivate(const QDeclarativeDomDynamicPropertyPrivate &o)
: QSharedData(o) { qFatal("Not impl"); }
- ~QmlDomDynamicPropertyPrivate();
+ ~QDeclarativeDomDynamicPropertyPrivate();
bool valid;
- QmlParser::Object::DynamicProperty property;
+ QDeclarativeParser::Object::DynamicProperty property;
};
-class QmlDomValuePrivate : public QSharedData
+class QDeclarativeDomValuePrivate : public QSharedData
{
public:
- QmlDomValuePrivate();
- QmlDomValuePrivate(const QmlDomValuePrivate &o)
+ QDeclarativeDomValuePrivate();
+ QDeclarativeDomValuePrivate(const QDeclarativeDomValuePrivate &o)
: QSharedData(o) { qFatal("Not impl"); }
- ~QmlDomValuePrivate();
+ ~QDeclarativeDomValuePrivate();
- QmlParser::Property *property;
- QmlParser::Value *value;
+ QDeclarativeParser::Property *property;
+ QDeclarativeParser::Value *value;
};
-class QmlDomBasicValuePrivate : public QSharedData
+class QDeclarativeDomBasicValuePrivate : public QSharedData
{
public:
- QmlDomBasicValuePrivate();
- QmlDomBasicValuePrivate(const QmlDomBasicValuePrivate &o)
+ QDeclarativeDomBasicValuePrivate();
+ QDeclarativeDomBasicValuePrivate(const QDeclarativeDomBasicValuePrivate &o)
: QSharedData(o) { qFatal("Not impl"); }
- ~QmlDomBasicValuePrivate();
+ ~QDeclarativeDomBasicValuePrivate();
- QmlParser::Value *value;
+ QDeclarativeParser::Value *value;
};
-class QmlDomImportPrivate : public QSharedData
+class QDeclarativeDomImportPrivate : public QSharedData
{
public:
- QmlDomImportPrivate();
- QmlDomImportPrivate(const QmlDomImportPrivate &o)
+ QDeclarativeDomImportPrivate();
+ QDeclarativeDomImportPrivate(const QDeclarativeDomImportPrivate &o)
: QSharedData(o) { qFatal("Not impl"); }
- ~QmlDomImportPrivate();
+ ~QDeclarativeDomImportPrivate();
enum Type { Library, File };
@@ -153,5 +153,5 @@ public:
QT_END_NAMESPACE
-#endif // QMLDOM_P_P_H
+#endif // QDECLARATIVEDOM_P_P_H
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 63ee7b1..af75e98 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -39,34 +39,35 @@
**
****************************************************************************/
-#include "qmlengine_p.h"
-#include "qmlengine.h"
-
-#include "qmlcontext_p.h"
-#include "qmlcompiler_p.h"
-#include "qmlglobalscriptclass_p.h"
-#include "qml.h"
-#include "qmlcontext.h"
-#include "qmlexpression.h"
-#include "qmlcomponent.h"
-#include "qmlmetaproperty_p.h"
-#include "qmlmoduleplugin.h"
-#include "qmlbinding_p.h"
-#include "qmlvme_p.h"
-#include "qmlenginedebug_p.h"
-#include "qmlstringconverters_p.h"
-#include "qmlxmlhttprequest_p.h"
-#include "qmlsqldatabase_p.h"
-#include "qmltypenamescriptclass_p.h"
-#include "qmllistscriptclass_p.h"
-#include "qmlscriptstring.h"
-#include "qmlglobal_p.h"
-#include "qmlworkerscript_p.h"
-#include "qmlcomponent_p.h"
-#include "qmlscriptclass_p.h"
-#include "qmlnetworkaccessmanagerfactory.h"
-#include "qmlimageprovider.h"
-#include "qmllist_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativeengine.h"
+
+#include "qdeclarativecontext_p.h"
+#include "qdeclarativecompiler_p.h"
+#include "qdeclarativeglobalscriptclass_p.h"
+#include "qdeclarative.h"
+#include "qdeclarativecontext.h"
+#include "qdeclarativeexpression.h"
+#include "qdeclarativecomponent.h"
+#include "qdeclarativebinding_p_p.h"
+#include "qdeclarativevme_p.h"
+#include "qdeclarativeenginedebug_p.h"
+#include "qdeclarativestringconverters_p.h"
+#include "qdeclarativexmlhttprequest_p.h"
+#include "qdeclarativesqldatabase_p.h"
+#include "qdeclarativetypenamescriptclass_p.h"
+#include "qdeclarativelistscriptclass_p.h"
+#include "qdeclarativescriptstring.h"
+#include "qdeclarativeglobal_p.h"
+#include "qdeclarativeworkerscript_p.h"
+#include "qdeclarativecomponent_p.h"
+#include "qdeclarativescriptclass_p.h"
+#include "qdeclarativenetworkaccessmanagerfactory.h"
+#include "qdeclarativeimageprovider.h"
+#include "qdeclarativedirparser_p.h"
+#include "qdeclarativeextensioninterface.h"
+#include "qdeclarativelist_p.h"
+#include "qdeclarativetypenamecache_p.h"
#include <qfxperf_p_p.h>
@@ -82,6 +83,7 @@
#include <QDebug>
#include <QMetaObject>
#include <QStack>
+#include <QPluginLoader>
#include <QtCore/qlibraryinfo.h>
#include <QtCore/qthreadstorage.h>
#include <QtCore/qthread.h>
@@ -94,11 +96,11 @@
#include <QGraphicsObject>
#include <QtCore/qcryptographichash.h>
-#include <private/qfactoryloader_p.h>
#include <private/qobject_p.h>
#include <private/qscriptdeclarativeclass_p.h>
-#include <private/qmlgraphicsitemsmodule_p.h>
+#include <private/qdeclarativeitemsmodule_p.h>
+#include <private/qdeclarativeutilmodule_p.h>
#ifdef Q_OS_WIN // for %APPDATA%
#include <qt_windows.h>
@@ -107,13 +109,12 @@
#define CSIDL_APPDATA 0x001a // <username>\Application Data
#endif
-Q_DECLARE_METATYPE(QmlMetaProperty)
+Q_DECLARE_METATYPE(QDeclarativeProperty)
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(qmlImportTrace, QML_IMPORT_TRACE)
-QML_DEFINE_TYPE(Qt,4,6,QtObject,QObject)
/*!
\qmlclass QtObject QObject
\since 4.7
@@ -143,7 +144,17 @@ struct StaticQtMetaObject : public QObject
static bool qt_QmlQtModule_registered = false;
-QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
+void QDeclarativeEnginePrivate::defineModule()
+{
+ QML_REGISTER_TYPE(Qt,4,6,Component,QDeclarativeComponent);
+ QML_REGISTER_TYPE(Qt,4,6,QtObject,QObject);
+ QML_REGISTER_TYPE(Qt,4,6,WorkerScript,QDeclarativeWorkerScript);
+ QML_REGISTER_TYPE(Qt,4,6,WorkerListModel,QDeclarativeWorkerListModel);
+
+ QML_REGISTER_NOCREATE_TYPE(QDeclarativeBinding);
+}
+
+QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e)
: captureProperties(false), rootContext(0), currentExpression(0), isDebugging(false),
contextClass(0), sharedContext(0), sharedScope(0), objectClass(0), valueTypeClass(0),
globalClass(0), cleanup(0), erroredBindings(0), inProgressCreations(0),
@@ -153,23 +164,39 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
{
if (!qt_QmlQtModule_registered) {
qt_QmlQtModule_registered = true;
- QmlGraphicsItemModule::defineModule();
+ QDeclarativeItemModule::defineModule();
+ QDeclarativeUtilModule::defineModule();
+ QDeclarativeEnginePrivate::defineModule();
+ }
+ globalClass = new QDeclarativeGlobalScriptClass(&scriptEngine);
+
+ // env import paths
+ QByteArray envImportPath = qgetenv("QML_IMPORT_PATH");
+ if (!envImportPath.isEmpty()) {
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ QLatin1Char pathSep(';');
+#else
+ QLatin1Char pathSep(':');
+#endif
+ foreach (const QString &path, QString::fromLatin1(envImportPath).split(pathSep, QString::SkipEmptyParts)) {
+ QString canonicalPath = QDir(path).canonicalPath();
+ if (!canonicalPath.isEmpty() && !environmentImportPath.contains(canonicalPath))
+ environmentImportPath.append(canonicalPath);
+ }
}
- globalClass = new QmlGlobalScriptClass(&scriptEngine);
- fileImportPath.append(QLibraryInfo::location(QLibraryInfo::DataPath)+QDir::separator()+QLatin1String("qml"));
}
-QUrl QmlScriptEngine::resolvedUrl(QScriptContext *context, const QUrl& url)
+QUrl QDeclarativeScriptEngine::resolvedUrl(QScriptContext *context, const QUrl& url)
{
if (p) {
- QmlContext *ctxt = QmlEnginePrivate::get(this)->getContext(context);
+ QDeclarativeContext *ctxt = QDeclarativeEnginePrivate::get(this)->getContext(context);
Q_ASSERT(ctxt);
return ctxt->resolvedUrl(url);
}
return baseUrl.resolved(url);
}
-QmlScriptEngine::QmlScriptEngine(QmlEnginePrivate *priv)
+QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *priv)
: p(priv), sqlQueryClass(0), namedNodeMapClass(0), nodeListClass(0)
{
// Note that all documentation for stuff put on the global object goes in
@@ -195,41 +222,41 @@ QmlScriptEngine::QmlScriptEngine(QmlEnginePrivate *priv)
//types
- qtObject.setProperty(QLatin1String("rgba"), newFunction(QmlEnginePrivate::rgba, 4));
- qtObject.setProperty(QLatin1String("hsla"), newFunction(QmlEnginePrivate::hsla, 4));
- qtObject.setProperty(QLatin1String("rect"), newFunction(QmlEnginePrivate::rect, 4));
- qtObject.setProperty(QLatin1String("point"), newFunction(QmlEnginePrivate::point, 2));
- qtObject.setProperty(QLatin1String("size"), newFunction(QmlEnginePrivate::size, 2));
- qtObject.setProperty(QLatin1String("vector3d"), newFunction(QmlEnginePrivate::vector, 3));
+ qtObject.setProperty(QLatin1String("rgba"), newFunction(QDeclarativeEnginePrivate::rgba, 4));
+ qtObject.setProperty(QLatin1String("hsla"), newFunction(QDeclarativeEnginePrivate::hsla, 4));
+ qtObject.setProperty(QLatin1String("rect"), newFunction(QDeclarativeEnginePrivate::rect, 4));
+ qtObject.setProperty(QLatin1String("point"), newFunction(QDeclarativeEnginePrivate::point, 2));
+ qtObject.setProperty(QLatin1String("size"), newFunction(QDeclarativeEnginePrivate::size, 2));
+ qtObject.setProperty(QLatin1String("vector3d"), newFunction(QDeclarativeEnginePrivate::vector, 3));
if (mainthread) {
//color helpers
- qtObject.setProperty(QLatin1String("lighter"), newFunction(QmlEnginePrivate::lighter, 1));
- qtObject.setProperty(QLatin1String("darker"), newFunction(QmlEnginePrivate::darker, 1));
- qtObject.setProperty(QLatin1String("tint"), newFunction(QmlEnginePrivate::tint, 2));
+ qtObject.setProperty(QLatin1String("lighter"), newFunction(QDeclarativeEnginePrivate::lighter, 1));
+ qtObject.setProperty(QLatin1String("darker"), newFunction(QDeclarativeEnginePrivate::darker, 1));
+ qtObject.setProperty(QLatin1String("tint"), newFunction(QDeclarativeEnginePrivate::tint, 2));
}
//misc methods
- qtObject.setProperty(QLatin1String("closestAngle"), newFunction(QmlEnginePrivate::closestAngle, 2));
- qtObject.setProperty(QLatin1String("playSound"), newFunction(QmlEnginePrivate::playSound, 1));
- qtObject.setProperty(QLatin1String("openUrlExternally"),newFunction(QmlEnginePrivate::desktopOpenUrl, 1));
- qtObject.setProperty(QLatin1String("md5"),newFunction(QmlEnginePrivate::md5, 1));
- qtObject.setProperty(QLatin1String("btoa"),newFunction(QmlEnginePrivate::btoa, 1));
- qtObject.setProperty(QLatin1String("atob"),newFunction(QmlEnginePrivate::atob, 1));
- qtObject.setProperty(QLatin1String("quit"), newFunction(QmlEnginePrivate::quit, 0));
- qtObject.setProperty(QLatin1String("resolvedUrl"),newFunction(QmlScriptEngine::resolvedUrl, 1));
+ qtObject.setProperty(QLatin1String("closestAngle"), newFunction(QDeclarativeEnginePrivate::closestAngle, 2));
+ qtObject.setProperty(QLatin1String("playSound"), newFunction(QDeclarativeEnginePrivate::playSound, 1));
+ qtObject.setProperty(QLatin1String("openUrlExternally"),newFunction(QDeclarativeEnginePrivate::desktopOpenUrl, 1));
+ qtObject.setProperty(QLatin1String("md5"),newFunction(QDeclarativeEnginePrivate::md5, 1));
+ qtObject.setProperty(QLatin1String("btoa"),newFunction(QDeclarativeEnginePrivate::btoa, 1));
+ qtObject.setProperty(QLatin1String("atob"),newFunction(QDeclarativeEnginePrivate::atob, 1));
+ qtObject.setProperty(QLatin1String("quit"), newFunction(QDeclarativeEnginePrivate::quit, 0));
+ qtObject.setProperty(QLatin1String("resolvedUrl"),newFunction(QDeclarativeScriptEngine::resolvedUrl, 1));
//firebug/webkit compat
QScriptValue consoleObject = newObject();
- consoleObject.setProperty(QLatin1String("log"),newFunction(QmlEnginePrivate::consoleLog, 1));
- consoleObject.setProperty(QLatin1String("debug"),newFunction(QmlEnginePrivate::consoleLog, 1));
+ consoleObject.setProperty(QLatin1String("log"),newFunction(QDeclarativeEnginePrivate::consoleLog, 1));
+ consoleObject.setProperty(QLatin1String("debug"),newFunction(QDeclarativeEnginePrivate::consoleLog, 1));
globalObject().setProperty(QLatin1String("console"), consoleObject);
if (mainthread) {
globalObject().setProperty(QLatin1String("createQmlObject"),
- newFunction(QmlEnginePrivate::createQmlObject, 1));
+ newFunction(QDeclarativeEnginePrivate::createQmlObject, 1));
globalObject().setProperty(QLatin1String("createComponent"),
- newFunction(QmlEnginePrivate::createComponent, 1));
+ newFunction(QDeclarativeEnginePrivate::createComponent, 1));
}
// translation functions need to be installed
@@ -237,29 +264,29 @@ QmlScriptEngine::QmlScriptEngine(QmlEnginePrivate *priv)
installTranslatorFunctions();
}
-QmlScriptEngine::~QmlScriptEngine()
+QDeclarativeScriptEngine::~QDeclarativeScriptEngine()
{
delete sqlQueryClass;
delete nodeListClass;
delete namedNodeMapClass;
}
-QScriptValue QmlScriptEngine::resolvedUrl(QScriptContext *ctxt, QScriptEngine *engine)
+QScriptValue QDeclarativeScriptEngine::resolvedUrl(QScriptContext *ctxt, QScriptEngine *engine)
{
QString arg = ctxt->argument(0).toString();
- QUrl r = QmlScriptEngine::get(engine)->resolvedUrl(ctxt,QUrl(arg));
+ QUrl r = QDeclarativeScriptEngine::get(engine)->resolvedUrl(ctxt,QUrl(arg));
return QScriptValue(r.toString());
}
-QNetworkAccessManager *QmlScriptEngine::networkAccessManager()
+QNetworkAccessManager *QDeclarativeScriptEngine::networkAccessManager()
{
return p->getNetworkAccessManager();
}
-QmlEnginePrivate::~QmlEnginePrivate()
+QDeclarativeEnginePrivate::~QDeclarativeEnginePrivate()
{
while (cleanup) {
- QmlCleanup *c = cleanup;
+ QDeclarativeCleanup *c = cleanup;
cleanup = c->next;
if (cleanup) cleanup->prev = &cleanup;
c->next = 0;
@@ -286,144 +313,145 @@ QmlEnginePrivate::~QmlEnginePrivate()
clear(bindValues[ii]);
for(int ii = 0; ii < parserStatus.count(); ++ii)
clear(parserStatus[ii]);
- for(QHash<int, QmlCompiledData*>::ConstIterator iter = m_compositeTypes.constBegin(); iter != m_compositeTypes.constEnd(); ++iter)
+ for(QHash<int, QDeclarativeCompiledData*>::ConstIterator iter = m_compositeTypes.constBegin(); iter != m_compositeTypes.constEnd(); ++iter)
(*iter)->release();
- for(QHash<const QMetaObject *, QmlPropertyCache *>::Iterator iter = propertyCache.begin(); iter != propertyCache.end(); ++iter)
+ for(QHash<const QMetaObject *, QDeclarativePropertyCache *>::Iterator iter = propertyCache.begin(); iter != propertyCache.end(); ++iter)
(*iter)->release();
}
-void QmlEnginePrivate::clear(SimpleList<QmlAbstractBinding> &bvs)
+void QDeclarativeEnginePrivate::clear(SimpleList<QDeclarativeAbstractBinding> &bvs)
{
bvs.clear();
}
-void QmlEnginePrivate::clear(SimpleList<QmlParserStatus> &pss)
+void QDeclarativeEnginePrivate::clear(SimpleList<QDeclarativeParserStatus> &pss)
{
for (int ii = 0; ii < pss.count; ++ii) {
- QmlParserStatus *ps = pss.at(ii);
+ QDeclarativeParserStatus *ps = pss.at(ii);
if(ps)
ps->d = 0;
}
pss.clear();
}
-Q_GLOBAL_STATIC(QmlEngineDebugServer, qmlEngineDebugServer);
+Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer);
+Q_GLOBAL_STATIC(QSet<QString>, qmlEnginePluginsWithRegisteredTypes);
-void QmlEnginePrivate::init()
+void QDeclarativeEnginePrivate::init()
{
- Q_Q(QmlEngine);
+ Q_Q(QDeclarativeEngine);
qRegisterMetaType<QVariant>("QVariant");
- qRegisterMetaType<QmlScriptString>("QmlScriptString");
+ qRegisterMetaType<QDeclarativeScriptString>("QDeclarativeScriptString");
qRegisterMetaType<QScriptValue>("QScriptValue");
- contextClass = new QmlContextScriptClass(q);
- objectClass = new QmlObjectScriptClass(q);
- valueTypeClass = new QmlValueTypeScriptClass(q);
- typeNameClass = new QmlTypeNameScriptClass(q);
- listClass = new QmlListScriptClass(q);
- rootContext = new QmlContext(q,true);
+ contextClass = new QDeclarativeContextScriptClass(q);
+ objectClass = new QDeclarativeObjectScriptClass(q);
+ valueTypeClass = new QDeclarativeValueTypeScriptClass(q);
+ typeNameClass = new QDeclarativeTypeNameScriptClass(q);
+ listClass = new QDeclarativeListScriptClass(q);
+ rootContext = new QDeclarativeContext(q,true);
if (QCoreApplication::instance()->thread() == q->thread() &&
- QmlEngineDebugServer::isDebuggingEnabled()) {
+ QDeclarativeEngineDebugServer::isDebuggingEnabled()) {
qmlEngineDebugServer();
isDebugging = true;
- QmlEngineDebugServer::addEngine(q);
+ QDeclarativeEngineDebugServer::addEngine(q);
qmlEngineDebugServer()->waitForClients();
}
}
-QmlWorkerScriptEngine *QmlEnginePrivate::getWorkerScriptEngine()
+QDeclarativeWorkerScriptEngine *QDeclarativeEnginePrivate::getWorkerScriptEngine()
{
- Q_Q(QmlEngine);
+ Q_Q(QDeclarativeEngine);
if (!workerScriptEngine)
- workerScriptEngine = new QmlWorkerScriptEngine(q);
+ workerScriptEngine = new QDeclarativeWorkerScriptEngine(q);
return workerScriptEngine;
}
/*!
- \class QmlEngine
+ \class QDeclarativeEngine
\since 4.7
- \brief The QmlEngine class provides an environment for instantiating QML components.
+ \brief The QDeclarativeEngine class provides an environment for instantiating QML components.
\mainclass
- Each QML component is instantiated in a QmlContext. QmlContext's are
+ Each QML component is instantiated in a QDeclarativeContext. QDeclarativeContext's are
essential for passing data to QML components. In QML, contexts are arranged
- hierarchically and this hierarchy is managed by the QmlEngine.
+ hierarchically and this hierarchy is managed by the QDeclarativeEngine.
Prior to creating any QML components, an application must have created a
- QmlEngine to gain access to a QML context. The following example shows how
+ QDeclarativeEngine to gain access to a QML context. The following example shows how
to create a simple Text item.
\code
- QmlEngine engine;
- QmlComponent component(&engine);
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine);
component.setData("import Qt 4.6\nText { text: \"Hello world!\" }", QUrl());
- QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem *>(component.create());
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(component.create());
//add item to view, etc
...
\endcode
In this case, the Text item will be created in the engine's
- \l {QmlEngine::rootContext()}{root context}.
+ \l {QDeclarativeEngine::rootContext()}{root context}.
- \sa QmlComponent QmlContext
+ \sa QDeclarativeComponent QDeclarativeContext
*/
/*!
- Create a new QmlEngine with the given \a parent.
+ Create a new QDeclarativeEngine with the given \a parent.
*/
-QmlEngine::QmlEngine(QObject *parent)
-: QObject(*new QmlEnginePrivate(this), parent)
+QDeclarativeEngine::QDeclarativeEngine(QObject *parent)
+: QObject(*new QDeclarativeEnginePrivate(this), parent)
{
- Q_D(QmlEngine);
+ Q_D(QDeclarativeEngine);
d->init();
}
/*!
- Destroys the QmlEngine.
+ Destroys the QDeclarativeEngine.
- Any QmlContext's created on this engine will be invalidated, but not
- destroyed (unless they are parented to the QmlEngine object).
+ Any QDeclarativeContext's created on this engine will be invalidated, but not
+ destroyed (unless they are parented to the QDeclarativeEngine object).
*/
-QmlEngine::~QmlEngine()
+QDeclarativeEngine::~QDeclarativeEngine()
{
- Q_D(QmlEngine);
+ Q_D(QDeclarativeEngine);
if (d->isDebugging)
- QmlEngineDebugServer::remEngine(this);
+ QDeclarativeEngineDebugServer::remEngine(this);
}
-/*! \fn void QmlEngine::quit()
- This signal is emitted when the QmlEngine quits.
+/*! \fn void QDeclarativeEngine::quit()
+ This signal is emitted when the QDeclarativeEngine quits.
*/
/*!
Clears the engine's internal component cache.
- Normally the QmlEngine caches components loaded from qml files. This method
+ Normally the QDeclarativeEngine caches components loaded from qml files. This method
clears this cache and forces the component to be reloaded.
*/
-void QmlEngine::clearComponentCache()
+void QDeclarativeEngine::clearComponentCache()
{
- Q_D(QmlEngine);
+ Q_D(QDeclarativeEngine);
d->typeManager.clearCache();
}
/*!
Returns the engine's root context.
- The root context is automatically created by the QmlEngine. Data that
+ The root context is automatically created by the QDeclarativeEngine. Data that
should be available to all QML component instances instantiated by the
engine should be put in the root context.
Additional data that should only be available to a subset of component
instances should be added to sub-contexts parented to the root context.
*/
-QmlContext *QmlEngine::rootContext()
+QDeclarativeContext *QDeclarativeEngine::rootContext()
{
- Q_D(QmlEngine);
+ Q_D(QDeclarativeEngine);
return d->rootContext;
}
@@ -437,25 +465,25 @@ QmlContext *QmlEngine::rootContext()
The factory must be set before exceuting the engine.
*/
-void QmlEngine::setNetworkAccessManagerFactory(QmlNetworkAccessManagerFactory *factory)
+void QDeclarativeEngine::setNetworkAccessManagerFactory(QDeclarativeNetworkAccessManagerFactory *factory)
{
- Q_D(QmlEngine);
+ Q_D(QDeclarativeEngine);
QMutexLocker locker(&d->mutex);
d->networkAccessManagerFactory = factory;
}
/*!
- Returns the current QmlNetworkAccessManagerFactory.
+ Returns the current QDeclarativeNetworkAccessManagerFactory.
\sa setNetworkAccessManagerFactory()
*/
-QmlNetworkAccessManagerFactory *QmlEngine::networkAccessManagerFactory() const
+QDeclarativeNetworkAccessManagerFactory *QDeclarativeEngine::networkAccessManagerFactory() const
{
- Q_D(const QmlEngine);
+ Q_D(const QDeclarativeEngine);
return d->networkAccessManagerFactory;
}
-QNetworkAccessManager *QmlEnginePrivate::createNetworkAccessManager(QObject *parent) const
+QNetworkAccessManager *QDeclarativeEnginePrivate::createNetworkAccessManager(QObject *parent) const
{
QMutexLocker locker(&mutex);
QNetworkAccessManager *nam;
@@ -468,11 +496,11 @@ QNetworkAccessManager *QmlEnginePrivate::createNetworkAccessManager(QObject *par
return nam;
}
-QNetworkAccessManager *QmlEnginePrivate::getNetworkAccessManager() const
+QNetworkAccessManager *QDeclarativeEnginePrivate::getNetworkAccessManager() const
{
- Q_Q(const QmlEngine);
+ Q_Q(const QDeclarativeEngine);
if (!networkAccessManager)
- networkAccessManager = createNetworkAccessManager(const_cast<QmlEngine*>(q));
+ networkAccessManager = createNetworkAccessManager(const_cast<QDeclarativeEngine*>(q));
return networkAccessManager;
}
@@ -480,16 +508,16 @@ QNetworkAccessManager *QmlEnginePrivate::getNetworkAccessManager() const
Returns a common QNetworkAccessManager which can be used by any QML element
instantiated by this engine.
- If a QmlNetworkAccessManagerFactory has been set and a QNetworkAccessManager
- has not yet been created, the QmlNetworkAccessManagerFactory will be used
+ If a QDeclarativeNetworkAccessManagerFactory has been set and a QNetworkAccessManager
+ has not yet been created, the QDeclarativeNetworkAccessManagerFactory will be used
to create the QNetworkAccessManager; otherwise the returned QNetworkAccessManager
will have no proxy or cache set.
\sa setNetworkAccessManagerFactory()
*/
-QNetworkAccessManager *QmlEngine::networkAccessManager() const
+QNetworkAccessManager *QDeclarativeEngine::networkAccessManager() const
{
- Q_D(const QmlEngine);
+ Q_D(const QDeclarativeEngine);
return d->getNetworkAccessManager();
}
@@ -497,15 +525,15 @@ QNetworkAccessManager *QmlEngine::networkAccessManager() const
Sets the \a provider to use for images requested via the \e image: url
scheme, with host \a providerId.
- QmlImageProvider allows images to be provided to QML asynchronously.
+ QDeclarativeImageProvider allows images to be provided to QML asynchronously.
The image request will be run in a low priority thread. This allows
potentially costly image loading to be done in the background, without
affecting the performance of the UI.
- Note that images loaded from a QmlImageProvider are cached by
+ Note that images loaded from a QDeclarativeImageProvider are cached by
QPixmapCache, similar to any image loaded by QML.
- The QmlEngine assumes ownership of the provider.
+ The QDeclarativeEngine assumes ownership of the provider.
This example creates a provider with id \e colors:
@@ -515,42 +543,42 @@ QNetworkAccessManager *QmlEngine::networkAccessManager() const
\sa removeImageProvider()
*/
-void QmlEngine::addImageProvider(const QString &providerId, QmlImageProvider *provider)
+void QDeclarativeEngine::addImageProvider(const QString &providerId, QDeclarativeImageProvider *provider)
{
- Q_D(QmlEngine);
+ Q_D(QDeclarativeEngine);
QMutexLocker locker(&d->mutex);
d->imageProviders.insert(providerId, provider);
}
/*!
- Returns the QmlImageProvider set for \a providerId.
+ Returns the QDeclarativeImageProvider set for \a providerId.
*/
-QmlImageProvider *QmlEngine::imageProvider(const QString &providerId) const
+QDeclarativeImageProvider *QDeclarativeEngine::imageProvider(const QString &providerId) const
{
- Q_D(const QmlEngine);
+ Q_D(const QDeclarativeEngine);
QMutexLocker locker(&d->mutex);
return d->imageProviders.value(providerId);
}
/*!
- Removes the QmlImageProvider for \a providerId.
+ Removes the QDeclarativeImageProvider for \a providerId.
Returns the provider if it was found; otherwise returns 0.
\sa addImageProvider()
*/
-void QmlEngine::removeImageProvider(const QString &providerId)
+void QDeclarativeEngine::removeImageProvider(const QString &providerId)
{
- Q_D(QmlEngine);
+ Q_D(QDeclarativeEngine);
QMutexLocker locker(&d->mutex);
delete d->imageProviders.take(providerId);
}
-QImage QmlEnginePrivate::getImageFromProvider(const QUrl &url)
+QImage QDeclarativeEnginePrivate::getImageFromProvider(const QUrl &url)
{
QMutexLocker locker(&mutex);
QImage image;
- QmlImageProvider *provider = imageProviders.value(url.host());
+ QDeclarativeImageProvider *provider = imageProviders.value(url.host());
if (provider)
image = provider->request(url.path().mid(1));
return image;
@@ -558,16 +586,16 @@ QImage QmlEnginePrivate::getImageFromProvider(const QUrl &url)
/*!
Return the base URL for this engine. The base URL is only used to resolve
- components when a relative URL is passed to the QmlComponent constructor.
+ components when a relative URL is passed to the QDeclarativeComponent constructor.
If a base URL has not been explicitly set, this method returns the
application's current working directory.
\sa setBaseUrl()
*/
-QUrl QmlEngine::baseUrl() const
+QUrl QDeclarativeEngine::baseUrl() const
{
- Q_D(const QmlEngine);
+ Q_D(const QDeclarativeEngine);
if (d->baseUrl.isEmpty()) {
return QUrl::fromLocalFile(QDir::currentPath() + QDir::separator());
} else {
@@ -580,26 +608,26 @@ QUrl QmlEngine::baseUrl() const
\sa baseUrl()
*/
-void QmlEngine::setBaseUrl(const QUrl &url)
+void QDeclarativeEngine::setBaseUrl(const QUrl &url)
{
- Q_D(QmlEngine);
+ Q_D(QDeclarativeEngine);
d->baseUrl = url;
}
/*!
- Returns the QmlContext for the \a object, or 0 if no context has been set.
+ Returns the QDeclarativeContext for the \a object, or 0 if no context has been set.
- When the QmlEngine instantiates a QObject, the context is set automatically.
+ When the QDeclarativeEngine instantiates a QObject, the context is set automatically.
*/
-QmlContext *QmlEngine::contextForObject(const QObject *object)
+QDeclarativeContext *QDeclarativeEngine::contextForObject(const QObject *object)
{
if(!object)
return 0;
QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
- QmlDeclarativeData *data =
- static_cast<QmlDeclarativeData *>(priv->declarativeData);
+ QDeclarativeDeclarativeData *data =
+ static_cast<QDeclarativeDeclarativeData *>(priv->declarativeData);
if (!data)
return 0;
@@ -610,20 +638,20 @@ QmlContext *QmlEngine::contextForObject(const QObject *object)
}
/*!
- Sets the QmlContext for the \a object to \a context.
+ Sets the QDeclarativeContext for the \a object to \a context.
If the \a object already has a context, a warning is
output, but the context is not changed.
- When the QmlEngine instantiates a QObject, the context is set automatically.
+ When the QDeclarativeEngine instantiates a QObject, the context is set automatically.
*/
-void QmlEngine::setContextForObject(QObject *object, QmlContext *context)
+void QDeclarativeEngine::setContextForObject(QObject *object, QDeclarativeContext *context)
{
if (!object || !context)
return;
- QmlDeclarativeData *data = QmlDeclarativeData::get(object, true);
+ QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(object, true);
if (data->context) {
- qWarning("QmlEngine::setContextForObject(): Object already has a QmlContext");
+ qWarning("QDeclarativeEngine::setContextForObject(): Object already has a QDeclarativeContext");
return;
}
@@ -637,19 +665,19 @@ void QmlEngine::setContextForObject(QObject *object, QmlContext *context)
void qmlExecuteDeferred(QObject *object)
{
- QmlDeclarativeData *data = QmlDeclarativeData::get(object);
+ QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(object);
if (data && data->deferredComponent) {
- QmlEnginePrivate *ep = QmlEnginePrivate::get(data->context->engine());
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(data->context->engine());
- QmlComponentPrivate::ConstructionState state;
- QmlComponentPrivate::beginDeferred(data->context, ep, object, &state);
+ QDeclarativeComponentPrivate::ConstructionState state;
+ QDeclarativeComponentPrivate::beginDeferred(data->context, ep, object, &state);
data->deferredComponent->release();
data->deferredComponent = 0;
- QmlComponentPrivate::complete(ep, &state);
+ QDeclarativeComponentPrivate::complete(ep, &state);
if (!state.errors.isEmpty())
qWarning() << state.errors;
@@ -657,20 +685,20 @@ void qmlExecuteDeferred(QObject *object)
}
}
-QmlContext *qmlContext(const QObject *obj)
+QDeclarativeContext *qmlContext(const QObject *obj)
{
- return QmlEngine::contextForObject(obj);
+ return QDeclarativeEngine::contextForObject(obj);
}
-QmlEngine *qmlEngine(const QObject *obj)
+QDeclarativeEngine *qmlEngine(const QObject *obj)
{
- QmlContext *context = QmlEngine::contextForObject(obj);
+ QDeclarativeContext *context = QDeclarativeEngine::contextForObject(obj);
return context?context->engine():0;
}
QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool create)
{
- QmlDeclarativeData *data = QmlDeclarativeData::get(object);
+ QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(object);
if (!data)
return 0; // Attached properties are only on objects created by QML
@@ -678,7 +706,7 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool cre
if (rv || !create)
return rv;
- QmlAttachedPropertiesFunc pf = QmlMetaType::attachedPropertiesFuncById(id);
+ QDeclarativeAttachedPropertiesFunc pf = QDeclarativeMetaType::attachedPropertiesFuncById(id);
if (!pf)
return 0;
@@ -693,7 +721,19 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool cre
return rv;
}
-void QmlDeclarativeData::destroyed(QObject *object)
+QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
+ const QMetaObject *attachedMetaObject, bool create)
+{
+ if (*idCache == -1)
+ *idCache = QDeclarativeMetaType::attachedPropertiesFuncId(attachedMetaObject);
+
+ if (*idCache == -1 || !object)
+ return 0;
+
+ return qmlAttachedPropertiesObjectById(*idCache, object, create);
+}
+
+void QDeclarativeDeclarativeData::destroyed(QObject *object)
{
if (deferredComponent)
deferredComponent->release();
@@ -705,9 +745,9 @@ void QmlDeclarativeData::destroyed(QObject *object)
if (prevContextObject)
*prevContextObject = nextContextObject;
- QmlAbstractBinding *binding = bindings;
+ QDeclarativeAbstractBinding *binding = bindings;
while (binding) {
- QmlAbstractBinding *next = binding->m_nextBinding;
+ QDeclarativeAbstractBinding *next = binding->m_nextBinding;
binding->m_prevBinding = 0;
binding->m_nextBinding = 0;
binding->destroy();
@@ -720,9 +760,9 @@ void QmlDeclarativeData::destroyed(QObject *object)
if (propertyCache)
propertyCache->release();
- QmlGuard<QObject> *guard = guards;
+ QDeclarativeGuard<QObject> *guard = guards;
while (guard) {
- QmlGuard<QObject> *g = guard;
+ QDeclarativeGuard<QObject> *g = guard;
guard = guard->next;
g->o = 0;
g->prev = 0;
@@ -733,7 +773,7 @@ void QmlDeclarativeData::destroyed(QObject *object)
delete this;
}
-bool QmlDeclarativeData::hasBindingBit(int bit) const
+bool QDeclarativeDeclarativeData::hasBindingBit(int bit) const
{
if (bindingBitsSize > bit)
return bindingBits[bit / 32] & (1 << (bit % 32));
@@ -741,13 +781,13 @@ bool QmlDeclarativeData::hasBindingBit(int bit) const
return false;
}
-void QmlDeclarativeData::clearBindingBit(int bit)
+void QDeclarativeDeclarativeData::clearBindingBit(int bit)
{
if (bindingBitsSize > bit)
bindingBits[bit / 32] &= ~(1 << (bit % 32));
}
-void QmlDeclarativeData::setBindingBit(QObject *obj, int bit)
+void QDeclarativeDeclarativeData::setBindingBit(QObject *obj, int bit)
{
if (bindingBitsSize <= bit) {
int props = obj->metaObject()->propertyCount();
@@ -771,23 +811,23 @@ void QmlDeclarativeData::setBindingBit(QObject *obj, int bit)
/*!
Creates a QScriptValue allowing you to use \a object in QML script.
- \a engine is the QmlEngine it is to be created in.
+ \a engine is the QDeclarativeEngine it is to be created in.
The QScriptValue returned is a QtScript Object, not a QtScript QObject, due
to the special needs of QML requiring more functionality than a standard
QtScript QObject.
*/
-QScriptValue QmlEnginePrivate::qmlScriptObject(QObject* object,
- QmlEngine* engine)
+QScriptValue QDeclarativeEnginePrivate::qmlScriptObject(QObject* object,
+ QDeclarativeEngine* engine)
{
- QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine);
return enginePriv->objectClass->newQObject(object);
}
/*!
- Returns the QmlContext for the executing QScript \a ctxt.
+ Returns the QDeclarativeContext for the executing QScript \a ctxt.
*/
-QmlContext *QmlEnginePrivate::getContext(QScriptContext *ctxt)
+QDeclarativeContext *QDeclarativeEnginePrivate::getContext(QScriptContext *ctxt)
{
QScriptValue scopeNode = QScriptDeclarativeClass::scopeChainValue(ctxt, -3);
Q_ASSERT(scopeNode.isValid());
@@ -795,14 +835,14 @@ QmlContext *QmlEnginePrivate::getContext(QScriptContext *ctxt)
return contextClass->contextFromValue(scopeNode);
}
-QScriptValue QmlEnginePrivate::createComponent(QScriptContext *ctxt,
+QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt,
QScriptEngine *engine)
{
- QmlEnginePrivate *activeEnginePriv =
- static_cast<QmlScriptEngine*>(engine)->p;
- QmlEngine* activeEngine = activeEnginePriv->q_func();
+ QDeclarativeEnginePrivate *activeEnginePriv =
+ static_cast<QDeclarativeScriptEngine*>(engine)->p;
+ QDeclarativeEngine* activeEngine = activeEnginePriv->q_func();
- QmlContext* context = activeEnginePriv->getContext(ctxt);
+ QDeclarativeContext* context = activeEnginePriv->getContext(ctxt);
Q_ASSERT(context);
if(ctxt->argumentCount() != 1) {
return engine->nullValue();
@@ -811,22 +851,22 @@ QScriptValue QmlEnginePrivate::createComponent(QScriptContext *ctxt,
if (arg.isEmpty())
return engine->nullValue();
QUrl url = QUrl(context->resolvedUrl(QUrl(arg)));
- QmlComponent *c = new QmlComponent(activeEngine, url, activeEngine);
+ QDeclarativeComponent *c = new QDeclarativeComponent(activeEngine, url, activeEngine);
c->setCreationContext(context);
- return activeEnginePriv->objectClass->newQObject(c, qMetaTypeId<QmlComponent*>());
+ return activeEnginePriv->objectClass->newQObject(c, qMetaTypeId<QDeclarativeComponent*>());
}
}
-QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngine *engine)
+QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngine *engine)
{
- QmlEnginePrivate *activeEnginePriv =
- static_cast<QmlScriptEngine*>(engine)->p;
- QmlEngine* activeEngine = activeEnginePriv->q_func();
+ QDeclarativeEnginePrivate *activeEnginePriv =
+ static_cast<QDeclarativeScriptEngine*>(engine)->p;
+ QDeclarativeEngine* activeEngine = activeEnginePriv->q_func();
if(ctxt->argumentCount() < 2 || ctxt->argumentCount() > 3)
return engine->nullValue();
- QmlContext* context = activeEnginePriv->getContext(ctxt);
+ QDeclarativeContext* context = activeEnginePriv->getContext(ctxt);
Q_ASSERT(context);
QString qml = ctxt->argument(0).toString();
@@ -846,20 +886,20 @@ QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngi
if(!parentArg)
return engine->nullValue();
- QmlComponent component(activeEngine);
+ QDeclarativeComponent component(activeEngine);
component.setData(qml.toUtf8(), url);
if(component.isError()) {
- QList<QmlError> errors = component.errors();
- qWarning().nospace() << "QmlEngine::createQmlObject():";
- foreach (const QmlError &error, errors)
+ QList<QDeclarativeError> errors = component.errors();
+ qWarning().nospace() << "QDeclarativeEngine::createQmlObject():";
+ foreach (const QDeclarativeError &error, errors)
qWarning().nospace() << " " << error;
return engine->nullValue();
}
if (!component.isReady()) {
- qWarning().nospace() << "QmlEngine::createQmlObject(): Component is not ready";
+ qWarning().nospace() << "QDeclarativeEngine::createQmlObject(): Component is not ready";
return engine->nullValue();
}
@@ -867,9 +907,9 @@ QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngi
QObject *obj = component.create(context);
if(component.isError()) {
- QList<QmlError> errors = component.errors();
- qWarning().nospace() << "QmlEngine::createQmlObject():";
- foreach (const QmlError &error, errors)
+ QList<QDeclarativeError> errors = component.errors();
+ qWarning().nospace() << "QDeclarativeEngine::createQmlObject():";
+ foreach (const QDeclarativeError &error, errors)
qWarning().nospace() << " " << error;
return engine->nullValue();
@@ -886,7 +926,7 @@ QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngi
return qmlScriptObject(obj, activeEngine);
}
-QScriptValue QmlEnginePrivate::vector(QScriptContext *ctxt, QScriptEngine *engine)
+QScriptValue QDeclarativeEnginePrivate::vector(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 3)
return engine->nullValue();
@@ -896,7 +936,7 @@ QScriptValue QmlEnginePrivate::vector(QScriptContext *ctxt, QScriptEngine *engin
return engine->newVariant(qVariantFromValue(QVector3D(x, y, z)));
}
-QScriptValue QmlEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine *engine)
+QScriptValue QDeclarativeEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine *engine)
{
int argCount = ctxt->argumentCount();
if(argCount < 3 || argCount > 4)
@@ -912,7 +952,7 @@ QScriptValue QmlEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine *engine)
return qScriptValueFromValue(engine, qVariantFromValue(QColor::fromRgbF(r, g, b, a)));
}
-QScriptValue QmlEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine *engine)
+QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine *engine)
{
int argCount = ctxt->argumentCount();
if(argCount < 3 || argCount > 4)
@@ -928,7 +968,7 @@ QScriptValue QmlEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine *engine)
return qScriptValueFromValue(engine, qVariantFromValue(QColor::fromHslF(h, s, l, a)));
}
-QScriptValue QmlEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine *engine)
+QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 4)
return engine->nullValue();
@@ -944,7 +984,7 @@ QScriptValue QmlEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine *engine)
return qScriptValueFromValue(engine, qVariantFromValue(QRectF(x, y, w, h)));
}
-QScriptValue QmlEnginePrivate::point(QScriptContext *ctxt, QScriptEngine *engine)
+QScriptValue QDeclarativeEnginePrivate::point(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
return engine->nullValue();
@@ -953,7 +993,7 @@ QScriptValue QmlEnginePrivate::point(QScriptContext *ctxt, QScriptEngine *engine
return qScriptValueFromValue(engine, qVariantFromValue(QPointF(x, y)));
}
-QScriptValue QmlEnginePrivate::size(QScriptContext *ctxt, QScriptEngine *engine)
+QScriptValue QDeclarativeEnginePrivate::size(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
return engine->nullValue();
@@ -962,7 +1002,7 @@ QScriptValue QmlEnginePrivate::size(QScriptContext *ctxt, QScriptEngine *engine)
return qScriptValueFromValue(engine, qVariantFromValue(QSizeF(w, h)));
}
-QScriptValue QmlEnginePrivate::lighter(QScriptContext *ctxt, QScriptEngine *engine)
+QScriptValue QDeclarativeEnginePrivate::lighter(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 1)
return engine->nullValue();
@@ -972,7 +1012,7 @@ QScriptValue QmlEnginePrivate::lighter(QScriptContext *ctxt, QScriptEngine *engi
color = v.value<QColor>();
else if (v.userType() == QVariant::String) {
bool ok;
- color = QmlStringConverters::colorFromString(v.toString(), &ok);
+ color = QDeclarativeStringConverters::colorFromString(v.toString(), &ok);
if (!ok)
return engine->nullValue();
} else
@@ -981,7 +1021,7 @@ QScriptValue QmlEnginePrivate::lighter(QScriptContext *ctxt, QScriptEngine *engi
return qScriptValueFromValue(engine, qVariantFromValue(color));
}
-QScriptValue QmlEnginePrivate::darker(QScriptContext *ctxt, QScriptEngine *engine)
+QScriptValue QDeclarativeEnginePrivate::darker(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 1)
return engine->nullValue();
@@ -991,7 +1031,7 @@ QScriptValue QmlEnginePrivate::darker(QScriptContext *ctxt, QScriptEngine *engin
color = v.value<QColor>();
else if (v.userType() == QVariant::String) {
bool ok;
- color = QmlStringConverters::colorFromString(v.toString(), &ok);
+ color = QDeclarativeStringConverters::colorFromString(v.toString(), &ok);
if (!ok)
return engine->nullValue();
} else
@@ -1000,16 +1040,16 @@ QScriptValue QmlEnginePrivate::darker(QScriptContext *ctxt, QScriptEngine *engin
return qScriptValueFromValue(engine, qVariantFromValue(color));
}
-QScriptValue QmlEnginePrivate::playSound(QScriptContext *ctxt, QScriptEngine *engine)
+QScriptValue QDeclarativeEnginePrivate::playSound(QScriptContext *ctxt, QScriptEngine *engine)
{
if (ctxt->argumentCount() != 1)
return engine->undefinedValue();
QUrl url(ctxt->argument(0).toString());
- QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine);
if (url.isRelative()) {
- QmlContext *context = enginePriv->getContext(ctxt);
+ QDeclarativeContext *context = enginePriv->getContext(ctxt);
if (!context)
return engine->undefinedValue();
@@ -1024,7 +1064,7 @@ QScriptValue QmlEnginePrivate::playSound(QScriptContext *ctxt, QScriptEngine *en
return engine->undefinedValue();
}
-QScriptValue QmlEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QScriptEngine *e)
+QScriptValue QDeclarativeEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QScriptEngine *e)
{
if(ctxt->argumentCount() < 1)
return e->newVariant(QVariant(false));
@@ -1032,7 +1072,7 @@ QScriptValue QmlEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QScriptEngin
return e->newVariant(QVariant(ret));
}
-QScriptValue QmlEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine *)
+QScriptValue QDeclarativeEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine *)
{
QByteArray data;
@@ -1044,7 +1084,7 @@ QScriptValue QmlEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine *)
return QScriptValue(QLatin1String(result.toHex()));
}
-QScriptValue QmlEnginePrivate::btoa(QScriptContext *ctxt, QScriptEngine *)
+QScriptValue QDeclarativeEnginePrivate::btoa(QScriptContext *ctxt, QScriptEngine *)
{
QByteArray data;
@@ -1054,7 +1094,7 @@ QScriptValue QmlEnginePrivate::btoa(QScriptContext *ctxt, QScriptEngine *)
return QScriptValue(QLatin1String(data.toBase64()));
}
-QScriptValue QmlEnginePrivate::atob(QScriptContext *ctxt, QScriptEngine *)
+QScriptValue QDeclarativeEnginePrivate::atob(QScriptContext *ctxt, QScriptEngine *)
{
QByteArray data;
@@ -1064,7 +1104,7 @@ QScriptValue QmlEnginePrivate::atob(QScriptContext *ctxt, QScriptEngine *)
return QScriptValue(QLatin1String(QByteArray::fromBase64(data)));
}
-QScriptValue QmlEnginePrivate::consoleLog(QScriptContext *ctxt, QScriptEngine *e)
+QScriptValue QDeclarativeEnginePrivate::consoleLog(QScriptContext *ctxt, QScriptEngine *e)
{
if(ctxt->argumentCount() < 1)
return e->newVariant(QVariant(false));
@@ -1083,20 +1123,20 @@ QScriptValue QmlEnginePrivate::consoleLog(QScriptContext *ctxt, QScriptEngine *e
return e->newVariant(QVariant(true));
}
-void QmlEnginePrivate::sendQuit ()
+void QDeclarativeEnginePrivate::sendQuit ()
{
- Q_Q(QmlEngine);
+ Q_Q(QDeclarativeEngine);
emit q->quit();
}
-QScriptValue QmlEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptEngine *e)
+QScriptValue QDeclarativeEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptEngine *e)
{
- QmlEnginePrivate *qe = get (e);
+ QDeclarativeEnginePrivate *qe = get (e);
qe->sendQuit ();
return QScriptValue();
}
-QScriptValue QmlEnginePrivate::closestAngle(QScriptContext *ctxt, QScriptEngine *e)
+QScriptValue QDeclarativeEnginePrivate::closestAngle(QScriptContext *ctxt, QScriptEngine *e)
{
if(ctxt->argumentCount() < 2)
return e->newVariant(QVariant(0.0));
@@ -1115,7 +1155,7 @@ QScriptValue QmlEnginePrivate::closestAngle(QScriptContext *ctxt, QScriptEngine
return e->newVariant(QVariant(ret));
}
-QScriptValue QmlEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
+QScriptValue QDeclarativeEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
return engine->nullValue();
@@ -1126,7 +1166,7 @@ QScriptValue QmlEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
color = v.value<QColor>();
else if (v.userType() == QVariant::String) {
bool ok;
- color = QmlStringConverters::colorFromString(v.toString(), &ok);
+ color = QDeclarativeStringConverters::colorFromString(v.toString(), &ok);
if (!ok)
return engine->nullValue();
} else
@@ -1139,7 +1179,7 @@ QScriptValue QmlEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
tintColor = v.value<QColor>();
else if (v.userType() == QVariant::String) {
bool ok;
- tintColor = QmlStringConverters::colorFromString(v.toString(), &ok);
+ tintColor = QDeclarativeStringConverters::colorFromString(v.toString(), &ok);
if (!ok)
return engine->nullValue();
} else
@@ -1170,10 +1210,10 @@ QScriptValue QmlEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
}
-QScriptValue QmlEnginePrivate::scriptValueFromVariant(const QVariant &val)
+QScriptValue QDeclarativeEnginePrivate::scriptValueFromVariant(const QVariant &val)
{
- if (val.userType() == qMetaTypeId<QmlListReference>()) {
- QmlListReferencePrivate *p = QmlListReferencePrivate::get((QmlListReference*)val.constData());
+ if (val.userType() == qMetaTypeId<QDeclarativeListReference>()) {
+ QDeclarativeListReferencePrivate *p = QDeclarativeListReferencePrivate::get((QDeclarativeListReference*)val.constData());
if (p->object) {
return listClass->newList(p->property, p->propertyType);
} else {
@@ -1182,7 +1222,7 @@ QScriptValue QmlEnginePrivate::scriptValueFromVariant(const QVariant &val)
}
bool objOk;
- QObject *obj = QmlMetaType::toQObject(val, &objOk);
+ QObject *obj = QDeclarativeMetaType::toQObject(val, &objOk);
if (objOk) {
return objectClass->newQObject(obj);
} else {
@@ -1190,7 +1230,7 @@ QScriptValue QmlEnginePrivate::scriptValueFromVariant(const QVariant &val)
}
}
-QVariant QmlEnginePrivate::scriptValueToVariant(const QScriptValue &val)
+QVariant QDeclarativeEnginePrivate::scriptValueToVariant(const QScriptValue &val)
{
QScriptDeclarativeClass *dc = QScriptDeclarativeClass::scriptClass(val);
if (dc == objectClass)
@@ -1208,15 +1248,15 @@ QVariant QmlEnginePrivate::scriptValueToVariant(const QScriptValue &val)
}
}
-QmlScriptClass::QmlScriptClass(QScriptEngine *engine)
+QDeclarativeScriptClass::QDeclarativeScriptClass(QScriptEngine *engine)
: QScriptDeclarativeClass(engine)
{
}
-QVariant QmlScriptClass::toVariant(QmlEngine *engine, const QScriptValue &val)
+QVariant QDeclarativeScriptClass::toVariant(QDeclarativeEngine *engine, const QScriptValue &val)
{
- QmlEnginePrivate *ep =
- static_cast<QmlEnginePrivate *>(QObjectPrivate::get(engine));
+ QDeclarativeEnginePrivate *ep =
+ static_cast<QDeclarativeEnginePrivate *>(QObjectPrivate::get(engine));
return ep->scriptValueToVariant(val);
}
@@ -1231,69 +1271,66 @@ static QString toLocalFileOrQrc(const QUrl& url)
}
/////////////////////////////////////////////////////////////
-struct QmlEnginePrivate::ImportedNamespace {
+struct QDeclarativeEnginePrivate::ImportedNamespace {
QStringList uris;
QStringList urls;
QList<int> majversions;
QList<int> minversions;
QList<bool> isLibrary;
- QList<bool> isBuiltin; // Types provided by C++ code (including plugins)
QList<QString> qmlDirContent;
- bool find(const QByteArray& type, int *vmajor, int *vminor, QmlType** type_return, QUrl* url_return) const
+ bool find(const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return, QUrl* url_return) const
{
for (int i=0; i<urls.count(); ++i) {
int vmaj = majversions.at(i);
int vmin = minversions.at(i);
- if (isBuiltin.at(i)) {
- QByteArray qt = uris.at(i).toUtf8();
- qt += '/';
- qt += type;
- if (qmlImportTrace())
- qDebug() << "Look in" << qt;
- QmlType *t = QmlMetaType::qmlType(qt,vmaj,vmin);
+ QByteArray qt = uris.at(i).toUtf8();
+ qt += '/';
+ qt += type;
+
+ if (qmlImportTrace())
+ qDebug() << "Look in" << qt;
+ QDeclarativeType *t = QDeclarativeMetaType::qmlType(qt,vmaj,vmin);
+ if (t) {
if (vmajor) *vmajor = vmaj;
if (vminor) *vminor = vmin;
- if (t) {
- if (qmlImportTrace())
- qDebug() << "Found" << qt;
- if (type_return)
- *type_return = t;
- return true;
- }
+ if (qmlImportTrace())
+ qDebug() << "Found" << qt;
+ if (type_return)
+ *type_return = t;
+ return true;
}
+
QUrl url = QUrl(urls.at(i) + QLatin1Char('/') + QString::fromUtf8(type) + QLatin1String(".qml"));
QString qmldircontent = qmlDirContent.at(i);
if (vmaj>=0 || !qmldircontent.isEmpty()) {
- // Check version file - XXX cache these in QmlEngine!
+ // Check version file - XXX cache these in QDeclarativeEngine!
if (qmldircontent.isEmpty()) {
QFile qmldir(toLocalFileOrQrc(QUrl(urls.at(i)+QLatin1String("/qmldir"))));
if (qmldir.open(QIODevice::ReadOnly)) {
qmldircontent = QString::fromUtf8(qmldir.readAll());
}
}
- QString typespace = QString::fromUtf8(type)+QLatin1Char(' ');
- QStringList lines = qmldircontent.split(QLatin1Char('\n'));
- foreach (QString line, lines) {
- if (line.isEmpty() || line.at(0) == QLatin1Char('#'))
- continue;
- if (line.startsWith(typespace)) {
- int space1 = line.indexOf(QLatin1Char(' '));
- int space2 = space1 >=0 ? line.indexOf(QLatin1Char(' '),space1+1) : -1;
- QString mapversions = line.mid(space1+1,space2<0?line.length()-space1-1:space2-space1-1);
- int dot = mapversions.indexOf(QLatin1Char('.'));
- int mapvmaj = mapversions.left(dot).toInt();
- if (mapvmaj<=vmaj) {
- if (mapvmaj<vmaj || vmin >= mapversions.mid(dot+1).toInt()) {
- QStringRef mapfile = space2<0 ? QStringRef() : line.midRef(space2+1,line.length()-space2-1);
- if (url_return)
- *url_return = url.resolved(QUrl(mapfile.toString()));
- return true;
- }
+
+ const QString typeName = QString::fromUtf8(type);
+
+ QDeclarativeDirParser qmldirParser;
+ qmldirParser.setUrl(url);
+ qmldirParser.setSource(qmldircontent);
+ qmldirParser.parse();
+
+ foreach (const QDeclarativeDirParser::Component &c, qmldirParser.components()) { // ### TODO: cache the components
+ if (c.majorVersion < vmaj || (c.majorVersion == vmaj && vmin >= c.minorVersion)) {
+ if (c.typeName == typeName) {
+ if (url_return)
+ *url_return = url.resolved(QUrl(c.fileName));
+
+ return true;
}
}
}
+
} else {
// XXX search non-files too! (eg. zip files, see QT-524)
QFileInfo f(toLocalFileOrQrc(url));
@@ -1308,72 +1345,98 @@ struct QmlEnginePrivate::ImportedNamespace {
}
};
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QmlModuleFactoryInterface_iid, QLatin1String("/qmlmodules")))
-
-class QmlImportsPrivate {
+class QDeclarativeImportsPrivate {
public:
- QmlImportsPrivate() : ref(1)
+ QDeclarativeImportsPrivate() : ref(1)
{
}
- ~QmlImportsPrivate()
+ ~QDeclarativeImportsPrivate()
{
- foreach (QmlEnginePrivate::ImportedNamespace* s, set.values())
+ foreach (QDeclarativeEnginePrivate::ImportedNamespace* s, set.values())
delete s;
}
- bool add(const QUrl& base, const QString& qmldircontent, const QString& uri, const QString& prefix, int vmaj, int vmin, QmlScriptParser::Import::Type importType, const QStringList& importPath)
+ QSet<QString> qmlDirFilesForWhichPluginsHaveBeenLoaded;
+
+ bool add(const QUrl& base, const QString& qmldircontent, const QString& uri, const QString& prefix, int vmaj, int vmin, QDeclarativeScriptParser::Import::Type importType, const QStringList& importPath, QDeclarativeEngine *engine)
{
- QmlEnginePrivate::ImportedNamespace *s;
+ QDeclarativeEnginePrivate::ImportedNamespace *s;
if (prefix.isEmpty()) {
s = &unqualifiedset;
} else {
s = set.value(prefix);
if (!s)
- set.insert(prefix,(s=new QmlEnginePrivate::ImportedNamespace));
+ set.insert(prefix,(s=new QDeclarativeEnginePrivate::ImportedNamespace));
}
QString url = uri;
- bool isbuiltin = false;
- if (importType == QmlScriptParser::Import::Library) {
- url.replace(QLatin1Char('.'),QLatin1Char('/'));
+ if (importType == QDeclarativeScriptParser::Import::Library) {
+ url.replace(QLatin1Char('.'), QLatin1Char('/'));
bool found = false;
- foreach (QString p, importPath) {
- QString dir = p+QLatin1Char('/')+url;
+ QString content;
+ QString dir;
+
+ // user import paths
+ QStringList paths;
+
+ // base..
+ paths += QFileInfo(base.toLocalFile()).path();
+ paths += importPath;
+ paths += QDeclarativeEnginePrivate::get(engine)->environmentImportPath;
+ QString builtinPath = QLibraryInfo::location(QLibraryInfo::ImportsPath);
+ if (!builtinPath.isEmpty())
+ paths += builtinPath;
+
+ foreach (const QString &p, paths) {
+ dir = p+QLatin1Char('/')+url;
QFileInfo fi(dir+QLatin1String("/qmldir"));
+ const QString absoluteFilePath = fi.absoluteFilePath();
+
if (fi.isFile()) {
- url = QUrl::fromLocalFile(fi.absolutePath()).toString();
found = true;
+
+ url = QUrl::fromLocalFile(fi.absolutePath()).toString();
+
+ QFile file(absoluteFilePath);
+ if (file.open(QFile::ReadOnly))
+ content = QString::fromUtf8(file.readAll());
+
+ if (! qmlDirFilesForWhichPluginsHaveBeenLoaded.contains(absoluteFilePath)) {
+ qmlDirFilesForWhichPluginsHaveBeenLoaded.insert(absoluteFilePath);
+
+ QDeclarativeDirParser qmldirParser;
+ qmldirParser.setSource(content);
+ qmldirParser.parse();
+
+ foreach (const QDeclarativeDirParser::Plugin &plugin, qmldirParser.plugins()) {
+ QString resolvedFilePath = QDeclarativeEnginePrivate::get(engine)->resolvePlugin(QDir(dir + QDir::separator() + plugin.path),
+ plugin.name);
+
+ if (!resolvedFilePath.isEmpty())
+ engine->importExtension(resolvedFilePath, uri);
+ }
+ }
+
break;
}
}
- if (!found) {
- // XXX assume it is a built-in type qualifier
- isbuiltin = true;
- }
- QFactoryLoader *l = loader();
- QmlModuleFactoryInterface *factory =
- qobject_cast<QmlModuleFactoryInterface*>(l->instance(uri));
- if (factory) {
- factory->defineModuleOnce(uri);
- isbuiltin = true;
- }
+
} else {
url = base.resolved(QUrl(url)).toString();
}
+
s->uris.prepend(uri);
s->urls.prepend(url);
s->majversions.prepend(vmaj);
s->minversions.prepend(vmin);
- s->isLibrary.prepend(importType == QmlScriptParser::Import::Library);
- s->isBuiltin.prepend(isbuiltin);
+ s->isLibrary.prepend(importType == QDeclarativeScriptParser::Import::Library);
s->qmlDirContent.prepend(qmldircontent);
return true;
}
- bool find(const QByteArray& type, int *vmajor, int *vminor, QmlType** type_return, QUrl* url_return)
+ bool find(const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return, QUrl* url_return)
{
- QmlEnginePrivate::ImportedNamespace *s = 0;
+ QDeclarativeEnginePrivate::ImportedNamespace *s = 0;
int slash = type.indexOf('/');
if (slash >= 0) {
s = set.value(QString::fromUtf8(type.left(slash)));
@@ -1389,10 +1452,11 @@ public:
if (s) {
if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return))
return true;
- if (s->urls.count() == 1 && !s->isBuiltin[0] && !s->isLibrary[0] && url_return) {
+ if (s->urls.count() == 1 && !s->isLibrary[0] && url_return) {
*url_return = QUrl(s->urls[0]+QLatin1Char('/')).resolved(QUrl(QString::fromUtf8(unqualifiedtype) + QLatin1String(".qml")));
return true;
}
+
}
if (url_return) {
*url_return = base.resolved(QUrl(QString::fromUtf8(type + ".qml")));
@@ -1402,7 +1466,7 @@ public:
}
}
- QmlEnginePrivate::ImportedNamespace *findNamespace(const QString& type)
+ QDeclarativeEnginePrivate::ImportedNamespace *findNamespace(const QString& type)
{
return set.value(type);
}
@@ -1411,18 +1475,18 @@ public:
int ref;
private:
- friend struct QmlEnginePrivate::Imports;
- QmlEnginePrivate::ImportedNamespace unqualifiedset;
- QHash<QString,QmlEnginePrivate::ImportedNamespace* > set;
+ friend struct QDeclarativeEnginePrivate::Imports;
+ QDeclarativeEnginePrivate::ImportedNamespace unqualifiedset;
+ QHash<QString,QDeclarativeEnginePrivate::ImportedNamespace* > set;
};
-QmlEnginePrivate::Imports::Imports(const Imports &copy) :
+QDeclarativeEnginePrivate::Imports::Imports(const Imports &copy) :
d(copy.d)
{
++d->ref;
}
-QmlEnginePrivate::Imports &QmlEnginePrivate::Imports::operator =(const Imports &copy)
+QDeclarativeEnginePrivate::Imports &QDeclarativeEnginePrivate::Imports::operator =(const Imports &copy)
{
++copy.d->ref;
if (--d->ref == 0)
@@ -1431,36 +1495,30 @@ QmlEnginePrivate::Imports &QmlEnginePrivate::Imports::operator =(const Imports &
return *this;
}
-QmlEnginePrivate::Imports::Imports() :
- d(new QmlImportsPrivate)
+QDeclarativeEnginePrivate::Imports::Imports() :
+ d(new QDeclarativeImportsPrivate)
{
}
-QmlEnginePrivate::Imports::~Imports()
+QDeclarativeEnginePrivate::Imports::~Imports()
{
if (--d->ref == 0)
delete d;
}
-#include "qmlmetatype.h"
-#include "qmltypenamecache_p.h"
-
-static QmlTypeNameCache *cacheForNamespace(QmlEngine *engine, const QmlEnginePrivate::ImportedNamespace &set, QmlTypeNameCache *cache)
+static QDeclarativeTypeNameCache *cacheForNamespace(QDeclarativeEngine *engine, const QDeclarativeEnginePrivate::ImportedNamespace &set, QDeclarativeTypeNameCache *cache)
{
if (!cache)
- cache = new QmlTypeNameCache(engine);
+ cache = new QDeclarativeTypeNameCache(engine);
- QList<QmlType *> types = QmlMetaType::qmlTypes();
+ QList<QDeclarativeType *> types = QDeclarativeMetaType::qmlTypes();
for (int ii = 0; ii < set.uris.count(); ++ii) {
- if (!set.isBuiltin.at(ii))
- continue;
-
QByteArray base = set.uris.at(ii).toUtf8() + '/';
int major = set.majversions.at(ii);
int minor = set.minversions.at(ii);
- foreach (QmlType *type, types) {
+ foreach (QDeclarativeType *type, types) {
if (type->qmlTypeName().startsWith(base) &&
type->qmlTypeName().lastIndexOf('/') == (base.length() - 1) &&
type->availableInVersion(major,minor))
@@ -1475,21 +1533,21 @@ static QmlTypeNameCache *cacheForNamespace(QmlEngine *engine, const QmlEnginePri
return cache;
}
-QmlTypeNameCache *QmlEnginePrivate::Imports::cache(QmlEngine *engine) const
+QDeclarativeTypeNameCache *QDeclarativeEnginePrivate::Imports::cache(QDeclarativeEngine *engine) const
{
- const QmlEnginePrivate::ImportedNamespace &set = d->unqualifiedset;
+ const QDeclarativeEnginePrivate::ImportedNamespace &set = d->unqualifiedset;
- QmlTypeNameCache *cache = new QmlTypeNameCache(engine);
+ QDeclarativeTypeNameCache *cache = new QDeclarativeTypeNameCache(engine);
- for (QHash<QString,QmlEnginePrivate::ImportedNamespace* >::ConstIterator iter = d->set.begin();
+ for (QHash<QString,QDeclarativeEnginePrivate::ImportedNamespace* >::ConstIterator iter = d->set.begin();
iter != d->set.end(); ++iter) {
- QmlTypeNameCache::Data *d = cache->data(iter.key());
+ QDeclarativeTypeNameCache::Data *d = cache->data(iter.key());
if (d) {
if (!d->typeNamespace)
cacheForNamespace(engine, *(*iter), d->typeNamespace);
} else {
- QmlTypeNameCache *nc = cacheForNamespace(engine, *(*iter), 0);
+ QDeclarativeTypeNameCache *nc = cacheForNamespace(engine, *(*iter), 0);
cache->add(iter.key(), nc);
nc->release();
}
@@ -1501,11 +1559,11 @@ QmlTypeNameCache *QmlEnginePrivate::Imports::cache(QmlEngine *engine) const
}
/*
-QStringList QmlEnginePrivate::Imports::unqualifiedSet() const
+QStringList QDeclarativeEnginePrivate::Imports::unqualifiedSet() const
{
QStringList rv;
- const QmlEnginePrivate::ImportedNamespace &set = d->unqualifiedset;
+ const QDeclarativeEnginePrivate::ImportedNamespace &set = d->unqualifiedset;
for (int ii = 0; ii < set.urls.count(); ++ii) {
if (set.isBuiltin.at(ii))
@@ -1519,7 +1577,7 @@ QStringList QmlEnginePrivate::Imports::unqualifiedSet() const
/*!
Sets the base URL to be used for all relative file imports added.
*/
-void QmlEnginePrivate::Imports::setBaseUrl(const QUrl& url)
+void QDeclarativeEnginePrivate::Imports::setBaseUrl(const QUrl& url)
{
d->base = url;
}
@@ -1527,7 +1585,7 @@ void QmlEnginePrivate::Imports::setBaseUrl(const QUrl& url)
/*!
Returns the base URL to be used for all relative file imports added.
*/
-QUrl QmlEnginePrivate::Imports::baseUrl() const
+QUrl QDeclarativeEnginePrivate::Imports::baseUrl() const
{
return d->base;
}
@@ -1536,31 +1594,74 @@ QUrl QmlEnginePrivate::Imports::baseUrl() const
Adds \a path as a directory where installed QML components are
defined in a URL-based directory structure.
- For example, if you add \c /opt/MyApp/lib/qml and then load QML
- that imports \c com.mycompany.Feature, then QmlEngine will look
- in \c /opt/MyApp/lib/qml/com/mycompany/Feature/ for the components
- provided by that module (and in the case of versioned imports,
- for the \c qmldir file definiting the type version mapping.
+ For example, if you add \c /opt/MyApp/lib/imports and then load QML
+ that imports \c com.mycompany.Feature, then QDeclarativeEngine will look
+ in \c /opt/MyApp/lib/imports/com/mycompany/Feature/ for the components
+ provided by that module. A \c qmldir file is required for definiting the
+ type version mapping and possibly declarative extensions plugins.
+
+ The engine searches in the base directory of the qml file, then
+ the paths added via addImportPath(), then the paths specified in the
+ \c QML_IMPORT_PATH environment variable, then the builtin \c ImportsPath from
+ QLibraryInfo.
- By default, only the "qml" subdirectory of QLibraryInfo::location(QLibraryInfo::DataPath)
- is included on the import path.
*/
-void QmlEngine::addImportPath(const QString& path)
+void QDeclarativeEngine::addImportPath(const QString& path)
{
if (qmlImportTrace())
- qDebug() << "QmlEngine::addImportPath" << path;
- Q_D(QmlEngine);
+ qDebug() << "QDeclarativeEngine::addImportPath" << path;
+ Q_D(QDeclarativeEngine);
d->fileImportPath.prepend(path);
}
/*!
- \property QmlEngine::offlineStoragePath
+ Imports the given \a extension into this QDeclarativeEngine. Returns
+ true if the extension was successfully imported.
+
+ \sa QDeclarativeExtensionInterface
+*/
+bool QDeclarativeEngine::importExtension(const QString &fileName, const QString &uri)
+{
+ QFileInfo fileInfo(fileName);
+ const QString absoluteFilePath = fileInfo.absoluteFilePath();
+ QPluginLoader loader(absoluteFilePath);
+
+ if (QDeclarativeExtensionInterface *iface = qobject_cast<QDeclarativeExtensionInterface *>(loader.instance())) {
+ const QByteArray bytes = uri.toUtf8();
+ const char *moduleId = bytes.constData();
+
+ // ### this code should probably be protected with a mutex.
+ if (! qmlEnginePluginsWithRegisteredTypes()->contains(absoluteFilePath)) {
+ // types should only be registered once (they're global).
+
+ qmlEnginePluginsWithRegisteredTypes()->insert(absoluteFilePath);
+ iface->registerTypes(moduleId);
+ }
+
+ QDeclarativeEnginePrivate *d = QDeclarativeEnginePrivate::get(this);
+
+ if (! d->initializedPlugins.contains(absoluteFilePath)) {
+ // things on the engine (eg. adding new global objects) have to be done for every engine.
+
+ // protect against double initialization
+ d->initializedPlugins.insert(absoluteFilePath);
+ iface->initializeEngine(this, moduleId);
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+/*!
+ \property QDeclarativeEngine::offlineStoragePath
\brief the directory for storing offline user data
Returns the directory where SQL and other offline
storage is placed.
- QmlGraphicsWebView and the SQL databases created with openDatabase()
+ QDeclarativeWebView and the SQL databases created with openDatabase()
are stored here.
The default is QML/OfflineStorage in the platform-standard
@@ -1570,18 +1671,99 @@ void QmlEngine::addImportPath(const QString& path)
callers wanting to \e create new files at this location should create
it first - see QDir::mkpath().
*/
-void QmlEngine::setOfflineStoragePath(const QString& dir)
+void QDeclarativeEngine::setOfflineStoragePath(const QString& dir)
{
- Q_D(QmlEngine);
+ Q_D(QDeclarativeEngine);
d->scriptEngine.offlineStoragePath = dir;
}
-QString QmlEngine::offlineStoragePath() const
+QString QDeclarativeEngine::offlineStoragePath() const
{
- Q_D(const QmlEngine);
+ Q_D(const QDeclarativeEngine);
return d->scriptEngine.offlineStoragePath;
}
+/*!
+ \internal
+
+ Returns the result of the merge of \a baseName with \a dir, \a suffixes, and \a prefix.
+ */
+QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString &baseName,
+ const QStringList &suffixes,
+ const QString &prefix)
+{
+ foreach (const QString &suffix, suffixes) {
+ QString pluginFileName = prefix;
+
+ pluginFileName += baseName;
+ pluginFileName += QLatin1Char('.');
+ pluginFileName += suffix;
+
+ QFileInfo fileInfo(dir, pluginFileName);
+
+ if (fileInfo.exists())
+ return fileInfo.absoluteFilePath();
+ }
+
+ return QString();
+}
+
+/*!
+ \internal
+
+ Returns the result of the merge of \a baseName with \a dir and the platform suffix.
+
+ \table
+ \header \i Platform \i Valid suffixes
+ \row \i Windows \i \c .dll
+ \row \i Unix/Linux \i \c .so
+ \row \i AIX \i \c .a
+ \row \i HP-UX \i \c .sl, \c .so (HP-UXi)
+ \row \i Mac OS X \i \c .dylib, \c .bundle, \c .so
+ \row \i Symbian \i \c .dll
+ \endtable
+
+ Version number on unix are ignored.
+*/
+QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString &baseName)
+{
+#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
+ return resolvePlugin(dir, baseName, QStringList(QLatin1String("dll")));
+#elif defined(Q_OS_SYMBIAN)
+ return resolvePlugin(dir, baseName, QStringList() << QLatin1String("dll") << QLatin1String("qtplugin"));
+#else
+
+# if defined(Q_OS_DARWIN)
+
+ return resolvePlugin(dir, baseName, QStringList() << QLatin1String("dylib") << QLatin1String("so") << QLatin1String("bundle"),
+ QLatin1String("lib"));
+# else // Generic Unix
+ QStringList validSuffixList;
+
+# if defined(Q_OS_HPUX)
+/*
+ See "HP-UX Linker and Libraries User's Guide", section "Link-time Differences between PA-RISC and IPF":
+ "In PA-RISC (PA-32 and PA-64) shared libraries are suffixed with .sl. In IPF (32-bit and 64-bit),
+ the shared libraries are suffixed with .so. For compatibility, the IPF linker also supports the .sl suffix."
+ */
+ validSuffixList << QLatin1String("sl");
+# if defined __ia64
+ validSuffixList << QLatin1String("so");
+# endif
+# elif defined(Q_OS_AIX)
+ validSuffixList << QLatin1String("a") << QLatin1String("so");
+# elif defined(Q_OS_UNIX)
+ validSuffixList << QLatin1String("so");
+# endif
+
+ // Examples of valid library names:
+ // libfoo.so
+
+ return resolvePlugin(dir, baseName, validSuffixList, QLatin1String("lib"));
+# endif
+
+#endif
+}
/*!
\internal
@@ -1597,11 +1779,12 @@ QString QmlEngine::offlineStoragePath() const
The base URL must already have been set with Import::setBaseUrl().
*/
-bool QmlEnginePrivate::addToImport(Imports* imports, const QString& qmldircontent, const QString& uri, const QString& prefix, int vmaj, int vmin, QmlScriptParser::Import::Type importType) const
+bool QDeclarativeEnginePrivate::addToImport(Imports* imports, const QString& qmldircontent, const QString& uri, const QString& prefix, int vmaj, int vmin, QDeclarativeScriptParser::Import::Type importType) const
{
- bool ok = imports->d->add(imports->d->base,qmldircontent,uri,prefix,vmaj,vmin,importType,fileImportPath);
+ QDeclarativeEngine *engine = QDeclarativeEnginePrivate::get(const_cast<QDeclarativeEnginePrivate *>(this));
+ bool ok = imports->d->add(imports->d->base,qmldircontent,uri,prefix,vmaj,vmin,importType,fileImportPath, engine);
if (qmlImportTrace())
- qDebug() << "QmlEngine::addToImport(" << imports << uri << prefix << vmaj << '.' << vmin << (importType==QmlScriptParser::Import::Library? "Library" : "File") << ": " << ok;
+ qDebug() << "QDeclarativeEngine::addToImport(" << imports << uri << prefix << vmaj << '.' << vmin << (importType==QDeclarativeScriptParser::Import::Library? "Library" : "File") << ": " << ok;
return ok;
}
@@ -1610,19 +1793,19 @@ bool QmlEnginePrivate::addToImport(Imports* imports, const QString& qmldirconten
Using the given \a imports, the given (namespace qualified) \a type is resolved to either
an ImportedNamespace stored at \a ns_return,
- a QmlType stored at \a type_return, or
+ a QDeclarativeType stored at \a type_return, or
a component located at \a url_return.
If any return pointer is 0, the corresponding search is not done.
\sa addToImport()
*/
-bool QmlEnginePrivate::resolveType(const Imports& imports, const QByteArray& type, QmlType** type_return, QUrl* url_return, int *vmaj, int *vmin, ImportedNamespace** ns_return) const
+bool QDeclarativeEnginePrivate::resolveType(const Imports& imports, const QByteArray& type, QDeclarativeType** type_return, QUrl* url_return, int *vmaj, int *vmin, ImportedNamespace** ns_return) const
{
ImportedNamespace* ns = imports.d->findNamespace(QString::fromUtf8(type));
if (ns) {
if (qmlImportTrace())
- qDebug() << "QmlEngine::resolveType" << type << "is namespace for" << ns->urls;
+ qDebug() << "QDeclarativeEngine::resolveType" << type << "is namespace for" << ns->urls;
if (ns_return)
*ns_return = ns;
return true;
@@ -1631,14 +1814,14 @@ bool QmlEnginePrivate::resolveType(const Imports& imports, const QByteArray& typ
if (imports.d->find(type,vmaj,vmin,type_return,url_return)) {
if (qmlImportTrace()) {
if (type_return && *type_return)
- qDebug() << "QmlEngine::resolveType" << type << '=' << (*type_return)->typeName();
+ qDebug() << "QDeclarativeEngine::resolveType" << type << '=' << (*type_return)->typeName();
if (url_return)
- qDebug() << "QmlEngine::resolveType" << type << '=' << *url_return;
+ qDebug() << "QDeclarativeEngine::resolveType" << type << '=' << *url_return;
}
return true;
}
if (qmlImportTrace())
- qDebug() << "QmlEngine::resolveType" << type << "not found";
+ qDebug() << "QDeclarativeEngine::resolveType" << type << "not found";
}
return false;
}
@@ -1648,12 +1831,12 @@ bool QmlEnginePrivate::resolveType(const Imports& imports, const QByteArray& typ
Searching \e only in the namespace \a ns (previously returned in a call to
resolveType(), \a type is found and returned to either
- a QmlType stored at \a type_return, or
+ a QDeclarativeType stored at \a type_return, or
a component located at \a url_return.
If either return pointer is 0, the corresponding search is not done.
*/
-void QmlEnginePrivate::resolveTypeInNamespace(ImportedNamespace* ns, const QByteArray& type, QmlType** type_return, QUrl* url_return, int *vmaj, int *vmin ) const
+void QDeclarativeEnginePrivate::resolveTypeInNamespace(ImportedNamespace* ns, const QByteArray& type, QDeclarativeType** type_return, QUrl* url_return, int *vmaj, int *vmin ) const
{
ns->find(type,vmaj,vmin,type_return,url_return);
}
@@ -1673,12 +1856,12 @@ static void *voidptr_constructor(const void *v)
}
}
-void QmlEnginePrivate::registerCompositeType(QmlCompiledData *data)
+void QDeclarativeEnginePrivate::registerCompositeType(QDeclarativeCompiledData *data)
{
QByteArray name = data->root->className();
QByteArray ptr = name + '*';
- QByteArray lst = "QmlListProperty<" + name + ">";
+ QByteArray lst = "QDeclarativeListProperty<" + name + ">";
int ptr_type = QMetaType::registerType(ptr.constData(), voidptr_destructor,
voidptr_constructor);
@@ -1690,64 +1873,64 @@ void QmlEnginePrivate::registerCompositeType(QmlCompiledData *data)
data->addref();
}
-bool QmlEnginePrivate::isList(int t) const
+bool QDeclarativeEnginePrivate::isList(int t) const
{
- return m_qmlLists.contains(t) || QmlMetaType::isList(t);
+ return m_qmlLists.contains(t) || QDeclarativeMetaType::isList(t);
}
-int QmlEnginePrivate::listType(int t) const
+int QDeclarativeEnginePrivate::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);
+ return QDeclarativeMetaType::listType(t);
}
-bool QmlEnginePrivate::isQObject(int t)
+bool QDeclarativeEnginePrivate::isQObject(int t)
{
- return m_compositeTypes.contains(t) || QmlMetaType::isQObject(t);
+ return m_compositeTypes.contains(t) || QDeclarativeMetaType::isQObject(t);
}
-QObject *QmlEnginePrivate::toQObject(const QVariant &v, bool *ok) const
+QObject *QDeclarativeEnginePrivate::toQObject(const QVariant &v, bool *ok) const
{
int t = v.userType();
if (m_compositeTypes.contains(t)) {
if (ok) *ok = true;
return *(QObject **)(v.constData());
} else {
- return QmlMetaType::toQObject(v, ok);
+ return QDeclarativeMetaType::toQObject(v, ok);
}
}
-QmlMetaType::TypeCategory QmlEnginePrivate::typeCategory(int t) const
+QDeclarativeMetaType::TypeCategory QDeclarativeEnginePrivate::typeCategory(int t) const
{
if (m_compositeTypes.contains(t))
- return QmlMetaType::Object;
+ return QDeclarativeMetaType::Object;
else if (m_qmlLists.contains(t))
- return QmlMetaType::List;
+ return QDeclarativeMetaType::List;
else
- return QmlMetaType::typeCategory(t);
+ return QDeclarativeMetaType::typeCategory(t);
}
-const QMetaObject *QmlEnginePrivate::rawMetaObjectForType(int t) const
+const QMetaObject *QDeclarativeEnginePrivate::rawMetaObjectForType(int t) const
{
- QHash<int, QmlCompiledData*>::ConstIterator iter = m_compositeTypes.find(t);
+ QHash<int, QDeclarativeCompiledData*>::ConstIterator iter = m_compositeTypes.find(t);
if (iter != m_compositeTypes.end()) {
return (*iter)->root;
} else {
- QmlType *type = QmlMetaType::qmlType(t);
+ QDeclarativeType *type = QDeclarativeMetaType::qmlType(t);
return type?type->baseMetaObject():0;
}
}
-const QMetaObject *QmlEnginePrivate::metaObjectForType(int t) const
+const QMetaObject *QDeclarativeEnginePrivate::metaObjectForType(int t) const
{
- QHash<int, QmlCompiledData*>::ConstIterator iter = m_compositeTypes.find(t);
+ QHash<int, QDeclarativeCompiledData*>::ConstIterator iter = m_compositeTypes.find(t);
if (iter != m_compositeTypes.end()) {
return (*iter)->root;
} else {
- QmlType *type = QmlMetaType::qmlType(t);
+ QDeclarativeType *type = QDeclarativeMetaType::qmlType(t);
return type?type->metaObject():0;
}
}
diff --git a/src/declarative/qml/qmlengine.h b/src/declarative/qml/qdeclarativeengine.h
index 64d0b9d..fd66358 100644
--- a/src/declarative/qml/qmlengine.h
+++ b/src/declarative/qml/qdeclarativeengine.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLENGINE_H
-#define QMLENGINE_H
+#ifndef QDECLARATIVEENGINE_H
+#define QDECLARATIVEENGINE_H
#include <QtCore/qurl.h>
#include <QtCore/qobject.h>
@@ -53,39 +53,40 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlComponent;
-class QmlEnginePrivate;
-class QmlImportsPrivate;
-class QmlExpression;
-class QmlContext;
-class QmlType;
+class QDeclarativeComponent;
+class QDeclarativeEnginePrivate;
+class QDeclarativeImportsPrivate;
+class QDeclarativeExpression;
+class QDeclarativeContext;
+class QDeclarativeType;
class QUrl;
class QScriptEngine;
class QScriptContext;
-class QmlImageProvider;
+class QDeclarativeImageProvider;
class QNetworkAccessManager;
-class QmlNetworkAccessManagerFactory;
-class Q_DECLARATIVE_EXPORT QmlEngine : public QObject
+class QDeclarativeNetworkAccessManagerFactory;
+class Q_DECLARATIVE_EXPORT QDeclarativeEngine : public QObject
{
Q_PROPERTY(QString offlineStoragePath READ offlineStoragePath WRITE setOfflineStoragePath)
Q_OBJECT
public:
- QmlEngine(QObject *p = 0);
- virtual ~QmlEngine();
+ QDeclarativeEngine(QObject *p = 0);
+ virtual ~QDeclarativeEngine();
- QmlContext *rootContext();
+ QDeclarativeContext *rootContext();
void clearComponentCache();
void addImportPath(const QString& dir);
+ bool importExtension(const QString &fileName, const QString &uri);
- void setNetworkAccessManagerFactory(QmlNetworkAccessManagerFactory *);
- QmlNetworkAccessManagerFactory *networkAccessManagerFactory() const;
+ void setNetworkAccessManagerFactory(QDeclarativeNetworkAccessManagerFactory *);
+ QDeclarativeNetworkAccessManagerFactory *networkAccessManagerFactory() const;
QNetworkAccessManager *networkAccessManager() const;
- void addImageProvider(const QString &id, QmlImageProvider *);
- QmlImageProvider *imageProvider(const QString &id) const;
+ void addImageProvider(const QString &id, QDeclarativeImageProvider *);
+ QDeclarativeImageProvider *imageProvider(const QString &id) const;
void removeImageProvider(const QString &id);
void setOfflineStoragePath(const QString& dir);
@@ -94,18 +95,18 @@ public:
QUrl baseUrl() const;
void setBaseUrl(const QUrl &);
- static QmlContext *contextForObject(const QObject *);
- static void setContextForObject(QObject *, QmlContext *);
+ static QDeclarativeContext *contextForObject(const QObject *);
+ static void setContextForObject(QObject *, QDeclarativeContext *);
Q_SIGNALS:
void quit ();
private:
- Q_DECLARE_PRIVATE(QmlEngine)
+ Q_DECLARE_PRIVATE(QDeclarativeEngine)
};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLENGINE_H
+#endif // QDECLARATIVEENGINE_H
diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h
index 3fe7991..0359f98 100644
--- a/src/declarative/qml/qmlengine_p.h
+++ b/src/declarative/qml/qdeclarativeengine_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLENGINE_P_H
-#define QMLENGINE_P_H
+#ifndef QDECLARATIVEENGINE_P_H
+#define QDECLARATIVEENGINE_P_H
//
// W A R N I N G
@@ -53,20 +53,21 @@
// We mean it.
//
-#include "qmlengine.h"
+#include "qdeclarativeengine.h"
-#include "qmlclassfactory_p.h"
-#include "qmlcompositetypemanager_p.h"
+#include "qdeclarativeclassfactory_p.h"
+#include "qdeclarativecompositetypemanager_p.h"
#include "qpodvector_p.h"
-#include "qml.h"
-#include "qmlvaluetype_p.h"
-#include "qmlcontext.h"
-#include "qmlexpression.h"
-#include "qmlmetaproperty_p.h"
-#include "qmlpropertycache_p.h"
-#include "qmlobjectscriptclass_p.h"
-#include "qmlcontextscriptclass_p.h"
-#include "qmlvaluetypescriptclass_p.h"
+#include "qdeclarative.h"
+#include "qdeclarativevaluetype_p.h"
+#include "qdeclarativecontext.h"
+#include "qdeclarativeexpression.h"
+#include "qdeclarativeproperty_p.h"
+#include "qdeclarativepropertycache_p.h"
+#include "qdeclarativeobjectscriptclass_p.h"
+#include "qdeclarativecontextscriptclass_p.h"
+#include "qdeclarativevaluetypescriptclass_p.h"
+#include "qdeclarativemetatype_p.h"
#include <QtScript/QScriptClass>
#include <QtScript/QScriptValue>
@@ -82,41 +83,42 @@
QT_BEGIN_NAMESPACE
-class QmlContext;
-class QmlEngine;
-class QmlContextPrivate;
-class QmlExpression;
-class QmlContextScriptClass;
-class QmlObjectScriptClass;
-class QmlTypeNameScriptClass;
-class QmlValueTypeScriptClass;
+class QDeclarativeContext;
+class QDeclarativeEngine;
+class QDeclarativeContextPrivate;
+class QDeclarativeExpression;
+class QDeclarativeContextScriptClass;
+class QDeclarativeObjectScriptClass;
+class QDeclarativeTypeNameScriptClass;
+class QDeclarativeValueTypeScriptClass;
class QScriptEngineDebugger;
class QNetworkReply;
class QNetworkAccessManager;
-class QmlNetworkAccessManagerFactory;
-class QmlAbstractBinding;
+class QDeclarativeNetworkAccessManagerFactory;
+class QDeclarativeAbstractBinding;
class QScriptDeclarativeClass;
-class QmlTypeNameScriptClass;
-class QmlTypeNameCache;
-class QmlComponentAttached;
-class QmlListScriptClass;
-class QmlCleanup;
-class QmlDelayedError;
-class QmlWorkerScriptEngine;
-class QmlGlobalScriptClass;
-
-class QmlScriptEngine : public QScriptEngine
+class QDeclarativeTypeNameScriptClass;
+class QDeclarativeTypeNameCache;
+class QDeclarativeComponentAttached;
+class QDeclarativeListScriptClass;
+class QDeclarativeCleanup;
+class QDeclarativeDelayedError;
+class QDeclarativeWorkerScriptEngine;
+class QDeclarativeGlobalScriptClass;
+class QDir;
+
+class QDeclarativeScriptEngine : public QScriptEngine
{
public:
- QmlScriptEngine(QmlEnginePrivate *priv);
- virtual ~QmlScriptEngine();
+ QDeclarativeScriptEngine(QDeclarativeEnginePrivate *priv);
+ virtual ~QDeclarativeScriptEngine();
QUrl resolvedUrl(QScriptContext *context, const QUrl& url); // resolved against p's context, or baseUrl if no p
static QScriptValue resolvedUrl(QScriptContext *ctxt, QScriptEngine *engine);
- static QmlScriptEngine *get(QScriptEngine* e) { return static_cast<QmlScriptEngine*>(e); }
+ static QDeclarativeScriptEngine *get(QScriptEngine* e) { return static_cast<QDeclarativeScriptEngine*>(e); }
- QmlEnginePrivate *p;
+ QDeclarativeEnginePrivate *p;
// User by SQL API
QScriptClass *sqlQueryClass;
@@ -131,12 +133,12 @@ public:
virtual QNetworkAccessManager *networkAccessManager();
};
-class Q_AUTOTEST_EXPORT QmlEnginePrivate : public QObjectPrivate
+class Q_AUTOTEST_EXPORT QDeclarativeEnginePrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlEngine)
+ Q_DECLARE_PUBLIC(QDeclarativeEngine)
public:
- QmlEnginePrivate(QmlEngine *);
- ~QmlEnginePrivate();
+ QDeclarativeEnginePrivate(QDeclarativeEngine *);
+ ~QDeclarativeEnginePrivate();
void init();
@@ -151,32 +153,32 @@ public:
bool captureProperties;
QPODVector<CapturedProperty> capturedProperties;
- QmlContext *rootContext;
- QmlExpression *currentExpression;
+ QDeclarativeContext *rootContext;
+ QDeclarativeExpression *currentExpression;
bool isDebugging;
struct ImportedNamespace;
- QmlContextScriptClass *contextClass;
- QmlContext *sharedContext;
+ QDeclarativeContextScriptClass *contextClass;
+ QDeclarativeContext *sharedContext;
QObject *sharedScope;
- QmlObjectScriptClass *objectClass;
- QmlValueTypeScriptClass *valueTypeClass;
- QmlTypeNameScriptClass *typeNameClass;
- QmlListScriptClass *listClass;
+ QDeclarativeObjectScriptClass *objectClass;
+ QDeclarativeValueTypeScriptClass *valueTypeClass;
+ QDeclarativeTypeNameScriptClass *typeNameClass;
+ QDeclarativeListScriptClass *listClass;
// Global script class
- QmlGlobalScriptClass *globalClass;
+ QDeclarativeGlobalScriptClass *globalClass;
// Registered cleanup handlers
- QmlCleanup *cleanup;
+ QDeclarativeCleanup *cleanup;
// Bindings that have had errors during startup
- QmlDelayedError *erroredBindings;
+ QDeclarativeDelayedError *erroredBindings;
int inProgressCreations;
- QmlScriptEngine scriptEngine;
+ QDeclarativeScriptEngine scriptEngine;
- QmlWorkerScriptEngine *getWorkerScriptEngine();
- QmlWorkerScriptEngine *workerScriptEngine;
+ QDeclarativeWorkerScriptEngine *getWorkerScriptEngine();
+ QDeclarativeWorkerScriptEngine *workerScriptEngine;
QUrl baseUrl;
@@ -203,26 +205,26 @@ public:
}
};
- static void clear(SimpleList<QmlAbstractBinding> &);
- static void clear(SimpleList<QmlParserStatus> &);
+ static void clear(SimpleList<QDeclarativeAbstractBinding> &);
+ static void clear(SimpleList<QDeclarativeParserStatus> &);
- QList<SimpleList<QmlAbstractBinding> > bindValues;
- QList<SimpleList<QmlParserStatus> > parserStatus;
- QmlComponentAttached *componentAttacheds;
+ QList<SimpleList<QDeclarativeAbstractBinding> > bindValues;
+ QList<SimpleList<QDeclarativeParserStatus> > parserStatus;
+ QDeclarativeComponentAttached *componentAttacheds;
bool inBeginCreate;
QNetworkAccessManager *createNetworkAccessManager(QObject *parent) const;
QNetworkAccessManager *getNetworkAccessManager() const;
mutable QNetworkAccessManager *networkAccessManager;
- mutable QmlNetworkAccessManagerFactory *networkAccessManagerFactory;
+ mutable QDeclarativeNetworkAccessManagerFactory *networkAccessManagerFactory;
- QHash<QString,QmlImageProvider*> imageProviders;
+ QHash<QString,QDeclarativeImageProvider*> imageProviders;
QImage getImageFromProvider(const QUrl &url);
mutable QMutex mutex;
- QmlCompositeTypeManager typeManager;
+ QDeclarativeCompositeTypeManager typeManager;
QStringList fileImportPath;
QString offlineStoragePath;
@@ -231,16 +233,16 @@ public:
return uniqueId++;
}
- QmlValueTypeFactory valueTypes;
+ QDeclarativeValueTypeFactory valueTypes;
- QHash<const QMetaObject *, QmlPropertyCache *> propertyCache;
- QmlPropertyCache *cache(QObject *obj) {
- Q_Q(QmlEngine);
+ QHash<const QMetaObject *, QDeclarativePropertyCache *> propertyCache;
+ QDeclarativePropertyCache *cache(QObject *obj) {
+ Q_Q(QDeclarativeEngine);
if (!obj || QObjectPrivate::get(obj)->metaObject) return 0;
const QMetaObject *mo = obj->metaObject();
- QmlPropertyCache *rv = propertyCache.value(mo);
+ QDeclarativePropertyCache *rv = propertyCache.value(mo);
if (!rv) {
- rv = QmlPropertyCache::create(q, mo);
+ rv = QDeclarativePropertyCache::create(q, mo);
propertyCache.insert(mo, rv);
}
return rv;
@@ -256,41 +258,51 @@ public:
void setBaseUrl(const QUrl& url);
QUrl baseUrl() const;
- QmlTypeNameCache *cache(QmlEngine *) const;
+ QDeclarativeTypeNameCache *cache(QDeclarativeEngine *) const;
private:
- friend class QmlEnginePrivate;
- QmlImportsPrivate *d;
+ friend class QDeclarativeEnginePrivate;
+ QDeclarativeImportsPrivate *d;
};
- bool addToImport(Imports*, const QString& qmlDirContent,const QString& uri, const QString& prefix, int vmaj, int vmin, QmlScriptParser::Import::Type importType) const;
+
+ QStringList environmentImportPath;
+ QSet<QString> initializedPlugins;
+
+ QString resolvePlugin(const QDir &dir, const QString &baseName,
+ const QStringList &suffixes,
+ const QString &prefix = QString());
+ QString resolvePlugin(const QDir &dir, const QString &baseName);
+
+
+ bool addToImport(Imports*, const QString& qmlDirContent,const QString& uri, const QString& prefix, int vmaj, int vmin, QDeclarativeScriptParser::Import::Type importType) const;
bool resolveType(const Imports&, const QByteArray& type,
- QmlType** type_return, QUrl* url_return,
+ QDeclarativeType** type_return, QUrl* url_return,
int *version_major, int *version_minor,
ImportedNamespace** ns_return) const;
void resolveTypeInNamespace(ImportedNamespace*, const QByteArray& type,
- QmlType** type_return, QUrl* url_return,
+ QDeclarativeType** type_return, QUrl* url_return,
int *version_major, int *version_minor ) const;
- void registerCompositeType(QmlCompiledData *);
+ void registerCompositeType(QDeclarativeCompiledData *);
bool isQObject(int);
QObject *toQObject(const QVariant &, bool *ok = 0) const;
- QmlMetaType::TypeCategory typeCategory(int) const;
+ QDeclarativeMetaType::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;
- QHash<int, QmlCompiledData *> m_compositeTypes;
+ QHash<int, QDeclarativeCompiledData *> m_compositeTypes;
QScriptValue scriptValueFromVariant(const QVariant &);
QVariant scriptValueToVariant(const QScriptValue &);
void sendQuit ();
- static QScriptValue qmlScriptObject(QObject*, QmlEngine*);
+ static QScriptValue qmlScriptObject(QObject*, QDeclarativeEngine*);
static QScriptValue createComponent(QScriptContext*, QScriptEngine*);
static QScriptValue createQmlObject(QScriptContext*, QScriptEngine*);
@@ -314,15 +326,17 @@ public:
static QScriptValue consoleLog(QScriptContext*, QScriptEngine*);
static QScriptValue quit(QScriptContext*, QScriptEngine*);
- static QScriptEngine *getScriptEngine(QmlEngine *e) { return &e->d_func()->scriptEngine; }
- static QmlEngine *getEngine(QScriptEngine *e) { return static_cast<QmlScriptEngine*>(e)->p->q_func(); }
- static QmlEnginePrivate *get(QmlEngine *e) { return e->d_func(); }
- static QmlEnginePrivate *get(QmlContext *c) { return (c && c->engine()) ? QmlEnginePrivate::get(c->engine()) : 0; }
- static QmlEnginePrivate *get(QScriptEngine *e) { return static_cast<QmlScriptEngine*>(e)->p; }
- static QmlEngine *get(QmlEnginePrivate *p) { return p->q_func(); }
- QmlContext *getContext(QScriptContext *);
+ static QScriptEngine *getScriptEngine(QDeclarativeEngine *e) { return &e->d_func()->scriptEngine; }
+ static QDeclarativeEngine *getEngine(QScriptEngine *e) { return static_cast<QDeclarativeScriptEngine*>(e)->p->q_func(); }
+ static QDeclarativeEnginePrivate *get(QDeclarativeEngine *e) { return e->d_func(); }
+ static QDeclarativeEnginePrivate *get(QDeclarativeContext *c) { return (c && c->engine()) ? QDeclarativeEnginePrivate::get(c->engine()) : 0; }
+ static QDeclarativeEnginePrivate *get(QScriptEngine *e) { return static_cast<QDeclarativeScriptEngine*>(e)->p; }
+ static QDeclarativeEngine *get(QDeclarativeEnginePrivate *p) { return p->q_func(); }
+ QDeclarativeContext *getContext(QScriptContext *);
+
+ static void defineModule();
};
QT_END_NAMESPACE
-#endif // QMLENGINE_P_H
+#endif // QDECLARATIVEENGINE_P_H
diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp
index 654157c..09882cb 100644
--- a/src/declarative/qml/qmlenginedebug.cpp
+++ b/src/declarative/qml/qdeclarativeenginedebug.cpp
@@ -39,32 +39,33 @@
**
****************************************************************************/
-#include "qmlenginedebug_p.h"
+#include "qdeclarativeenginedebug_p.h"
-#include "qmlboundsignal_p.h"
-#include "qmlengine.h"
-#include "qmlmetatype.h"
-#include "qmlmetaproperty.h"
-#include "qmlbinding.h"
-#include "qmlcontext_p.h"
-#include "qmlwatcher_p.h"
+#include "qdeclarativeboundsignal_p.h"
+#include "qdeclarativeengine.h"
+#include "qdeclarativemetatype_p.h"
+#include "qdeclarativeproperty.h"
+#include "qdeclarativeproperty_p.h"
+#include "qdeclarativebinding_p.h"
+#include "qdeclarativecontext_p.h"
+#include "qdeclarativewatcher_p.h"
#include <QtCore/qdebug.h>
#include <QtCore/qmetaobject.h>
QT_BEGIN_NAMESPACE
-QList<QmlEngine *> QmlEngineDebugServer::m_engines;
-QmlEngineDebugServer::QmlEngineDebugServer(QObject *parent)
-: QmlDebugService(QLatin1String("QmlEngine"), parent),
- m_watch(new QmlWatcher(this))
+QList<QDeclarativeEngine *> QDeclarativeEngineDebugServer::m_engines;
+QDeclarativeEngineDebugServer::QDeclarativeEngineDebugServer(QObject *parent)
+: QDeclarativeDebugService(QLatin1String("QDeclarativeEngine"), parent),
+ m_watch(new QDeclarativeWatcher(this))
{
QObject::connect(m_watch, SIGNAL(propertyChanged(int,int,QMetaProperty,QVariant)),
this, SLOT(propertyChanged(int,int,QMetaProperty,QVariant)));
}
QDataStream &operator<<(QDataStream &ds,
- const QmlEngineDebugServer::QmlObjectData &data)
+ const QDeclarativeEngineDebugServer::QDeclarativeObjectData &data)
{
ds << data.url << data.lineNumber << data.columnNumber << data.objectName
<< data.objectType << data.objectId << data.contextId;
@@ -72,7 +73,7 @@ QDataStream &operator<<(QDataStream &ds,
}
QDataStream &operator>>(QDataStream &ds,
- QmlEngineDebugServer::QmlObjectData &data)
+ QDeclarativeEngineDebugServer::QDeclarativeObjectData &data)
{
ds >> data.url >> data.lineNumber >> data.columnNumber >> data.objectName
>> data.objectType >> data.objectId >> data.contextId;
@@ -80,7 +81,7 @@ QDataStream &operator>>(QDataStream &ds,
}
QDataStream &operator<<(QDataStream &ds,
- const QmlEngineDebugServer::QmlObjectProperty &data)
+ const QDeclarativeEngineDebugServer::QDeclarativeObjectProperty &data)
{
ds << (int)data.type << data.name << data.value << data.valueTypeName
<< data.binding << data.hasNotifySignal;
@@ -88,27 +89,28 @@ QDataStream &operator<<(QDataStream &ds,
}
QDataStream &operator>>(QDataStream &ds,
- QmlEngineDebugServer::QmlObjectProperty &data)
+ QDeclarativeEngineDebugServer::QDeclarativeObjectProperty &data)
{
int type;
ds >> type >> data.name >> data.value >> data.valueTypeName
>> data.binding >> data.hasNotifySignal;
- data.type = (QmlEngineDebugServer::QmlObjectProperty::Type)type;
+ data.type = (QDeclarativeEngineDebugServer::QDeclarativeObjectProperty::Type)type;
return ds;
}
-QmlEngineDebugServer::QmlObjectProperty
-QmlEngineDebugServer::propertyData(QObject *obj, int propIdx)
+QDeclarativeEngineDebugServer::QDeclarativeObjectProperty
+QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx)
{
- QmlObjectProperty rv;
+ QDeclarativeObjectProperty rv;
QMetaProperty prop = obj->metaObject()->property(propIdx);
- rv.type = QmlObjectProperty::Unknown;
+ rv.type = QDeclarativeObjectProperty::Unknown;
rv.valueTypeName = QString::fromUtf8(prop.typeName());
rv.name = QString::fromUtf8(prop.name());
rv.hasNotifySignal = prop.hasNotifySignal();
- QmlAbstractBinding *binding = QmlMetaProperty(obj, rv.name).binding();
+ QDeclarativeAbstractBinding *binding =
+ QDeclarativePropertyPrivate::binding(QDeclarativeProperty(obj, rv.name));
if (binding)
rv.binding = binding->expression();
@@ -116,32 +118,32 @@ QmlEngineDebugServer::propertyData(QObject *obj, int propIdx)
rv.value = valueContents(value);
if (QVariant::Type(prop.userType()) < QVariant::UserType) {
- rv.type = QmlObjectProperty::Basic;
- } else if (QmlMetaType::isQObject(prop.userType())) {
- rv.type = QmlObjectProperty::Object;
- } else if (QmlMetaType::isList(prop.userType())) {
- rv.type = QmlObjectProperty::List;
+ rv.type = QDeclarativeObjectProperty::Basic;
+ } else if (QDeclarativeMetaType::isQObject(prop.userType())) {
+ rv.type = QDeclarativeObjectProperty::Object;
+ } else if (QDeclarativeMetaType::isList(prop.userType())) {
+ rv.type = QDeclarativeObjectProperty::List;
}
return rv;
}
-QVariant QmlEngineDebugServer::valueContents(const QVariant &value) const
+QVariant QDeclarativeEngineDebugServer::valueContents(const QVariant &value) const
{
int userType = value.userType();
if (QVariant::Type(userType) < QVariant::UserType)
return value;
/*
- if (QmlMetaType::isList(userType)) {
- int count = QmlMetaType::listCount(value);
+ if (QDeclarativeMetaType::isList(userType)) {
+ int count = QDeclarativeMetaType::listCount(value);
QVariantList contents;
for (int i=0; i<count; i++)
- contents << valueContents(QmlMetaType::listAt(value, i));
+ contents << valueContents(QDeclarativeMetaType::listAt(value, i));
return contents;
} else */
- if (QmlMetaType::isQObject(userType)) {
- QObject *o = QmlMetaType::toQObject(value);
+ if (QDeclarativeMetaType::isQObject(userType)) {
+ QObject *o = QDeclarativeMetaType::toQObject(value);
if (o) {
QString name = o->objectName();
if (name.isEmpty())
@@ -153,7 +155,7 @@ QVariant QmlEngineDebugServer::valueContents(const QVariant &value) const
return QLatin1String("<unknown value>");
}
-void QmlEngineDebugServer::buildObjectDump(QDataStream &message,
+void QDeclarativeEngineDebugServer::buildObjectDump(QDataStream &message,
QObject *object, bool recur)
{
message << objectData(object);
@@ -167,24 +169,24 @@ void QmlEngineDebugServer::buildObjectDump(QDataStream &message,
int childrenCount = children.count();
for (int ii = 0; ii < children.count(); ++ii) {
- if (qobject_cast<QmlContext*>(children[ii]) || QmlBoundSignal::cast(children[ii]))
+ if (qobject_cast<QDeclarativeContext*>(children[ii]) || QDeclarativeBoundSignal::cast(children[ii]))
--childrenCount;
}
message << childrenCount << recur;
- QList<QmlObjectProperty> fakeProperties;
+ QList<QDeclarativeObjectProperty> fakeProperties;
for (int ii = 0; ii < children.count(); ++ii) {
QObject *child = children.at(ii);
- if (qobject_cast<QmlContext*>(child))
+ if (qobject_cast<QDeclarativeContext*>(child))
continue;
- QmlBoundSignal *signal = QmlBoundSignal::cast(child);
+ QDeclarativeBoundSignal *signal = QDeclarativeBoundSignal::cast(child);
if (signal) {
- QmlObjectProperty prop;
- prop.type = QmlObjectProperty::SignalProperty;
+ QDeclarativeObjectProperty prop;
+ prop.type = QDeclarativeObjectProperty::SignalProperty;
prop.hasNotifySignal = false;
- QmlExpression *expr = signal->expression();
+ QDeclarativeExpression *expr = signal->expression();
if (expr) {
prop.value = expr->expression();
QObject *scope = expr->scopeObject();
@@ -216,21 +218,21 @@ void QmlEngineDebugServer::buildObjectDump(QDataStream &message,
message << fakeProperties[ii];
}
-void QmlEngineDebugServer::buildObjectList(QDataStream &message,
- QmlContext *ctxt)
+void QDeclarativeEngineDebugServer::buildObjectList(QDataStream &message,
+ QDeclarativeContext *ctxt)
{
- QmlContextPrivate *p = (QmlContextPrivate *)QObjectPrivate::get(ctxt);
+ QDeclarativeContextPrivate *p = (QDeclarativeContextPrivate *)QObjectPrivate::get(ctxt);
QString ctxtName = ctxt->objectName();
- int ctxtId = QmlDebugService::idForObject(ctxt);
+ int ctxtId = QDeclarativeDebugService::idForObject(ctxt);
message << ctxtName << ctxtId;
int count = 0;
- for (QSet<QmlContext *>::ConstIterator iter = p->childContexts.begin();
+ for (QSet<QDeclarativeContext *>::ConstIterator iter = p->childContexts.begin();
iter != p->childContexts.end(); ++iter) {
- QmlContextPrivate *p = (QmlContextPrivate *)QObjectPrivate::get(*iter);
+ QDeclarativeContextPrivate *p = (QDeclarativeContextPrivate *)QObjectPrivate::get(*iter);
if (p->isInternal)
continue;
++count;
@@ -238,9 +240,9 @@ void QmlEngineDebugServer::buildObjectList(QDataStream &message,
message << count;
- for (QSet<QmlContext *>::ConstIterator iter = p->childContexts.begin();
+ for (QSet<QDeclarativeContext *>::ConstIterator iter = p->childContexts.begin();
iter != p->childContexts.end(); ++iter) {
- QmlContextPrivate *p = (QmlContextPrivate *)QObjectPrivate::get(*iter);
+ QDeclarativeContextPrivate *p = (QDeclarativeContextPrivate *)QObjectPrivate::get(*iter);
if (p->isInternal)
continue;
buildObjectList(message, *iter);
@@ -260,11 +262,11 @@ void QmlEngineDebugServer::buildObjectList(QDataStream &message,
}
}
-QmlEngineDebugServer::QmlObjectData
-QmlEngineDebugServer::objectData(QObject *object)
+QDeclarativeEngineDebugServer::QDeclarativeObjectData
+QDeclarativeEngineDebugServer::objectData(QObject *object)
{
- QmlDeclarativeData *ddata = QmlDeclarativeData::get(object);
- QmlObjectData rv;
+ QDeclarativeDeclarativeData *ddata = QDeclarativeDeclarativeData::get(object);
+ QDeclarativeObjectData rv;
if (ddata) {
rv.url = ddata->outerContext->baseUrl();
rv.lineNumber = ddata->lineNumber;
@@ -275,10 +277,10 @@ QmlEngineDebugServer::objectData(QObject *object)
}
rv.objectName = object->objectName();
- rv.objectId = QmlDebugService::idForObject(object);
- rv.contextId = QmlDebugService::idForObject(qmlContext(object));
+ rv.objectId = QDeclarativeDebugService::idForObject(object);
+ rv.contextId = QDeclarativeDebugService::idForObject(qmlContext(object));
- QmlType *type = QmlMetaType::qmlType(object->metaObject());
+ QDeclarativeType *type = QDeclarativeMetaType::qmlType(object->metaObject());
if (type) {
QString typeName = QLatin1String(type->qmlTypeName());
int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
@@ -293,14 +295,14 @@ QmlEngineDebugServer::objectData(QObject *object)
return rv;
}
-void QmlEngineDebugServer::messageReceived(const QByteArray &message)
+void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message)
{
QDataStream ds(message);
QByteArray type;
ds >> type;
- //qDebug() << "QmlEngineDebugServer::messageReceived()" << type;
+ //qDebug() << "QDeclarativeEngineDebugServer::messageReceived()" << type;
if (type == "LIST_ENGINES") {
int queryId;
@@ -312,10 +314,10 @@ void QmlEngineDebugServer::messageReceived(const QByteArray &message)
rs << queryId << m_engines.count();
for (int ii = 0; ii < m_engines.count(); ++ii) {
- QmlEngine *engine = m_engines.at(ii);
+ QDeclarativeEngine *engine = m_engines.at(ii);
QString engineName = engine->objectName();
- int engineId = QmlDebugService::idForObject(engine);
+ int engineId = QDeclarativeDebugService::idForObject(engine);
rs << engineName << engineId;
}
@@ -326,8 +328,8 @@ void QmlEngineDebugServer::messageReceived(const QByteArray &message)
int engineId = -1;
ds >> queryId >> engineId;
- QmlEngine *engine =
- qobject_cast<QmlEngine *>(QmlDebugService::objectForId(engineId));
+ QDeclarativeEngine *engine =
+ qobject_cast<QDeclarativeEngine *>(QDeclarativeDebugService::objectForId(engineId));
QByteArray reply;
QDataStream rs(&reply, QIODevice::WriteOnly);
@@ -344,7 +346,7 @@ void QmlEngineDebugServer::messageReceived(const QByteArray &message)
ds >> queryId >> objectId >> recurse;
- QObject *object = QmlDebugService::objectForId(objectId);
+ QObject *object = QDeclarativeDebugService::objectForId(objectId);
QByteArray reply;
QDataStream rs(&reply, QIODevice::WriteOnly);
@@ -404,18 +406,17 @@ void QmlEngineDebugServer::messageReceived(const QByteArray &message)
ds >> queryId >> objectId >> expr;
- QObject *object = QmlDebugService::objectForId(objectId);
- QmlContext *context = qmlContext(object);
+ QObject *object = QDeclarativeDebugService::objectForId(objectId);
+ QDeclarativeContext *context = qmlContext(object);
QVariant result;
if (object && context) {
- QmlExpression *exprObj = new QmlExpression(context, expr, object);
+ QDeclarativeExpression exprObj(context, expr, object);
bool undefined = false;
- QVariant value = exprObj->value(&undefined);
+ QVariant value = exprObj.value(&undefined);
if (undefined)
result = QLatin1String("<undefined>");
else
result = valueContents(value);
- delete exprObj;
} else {
result = QLatin1String("<unknown context>");
}
@@ -428,7 +429,7 @@ void QmlEngineDebugServer::messageReceived(const QByteArray &message)
}
}
-void QmlEngineDebugServer::propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value)
+void QDeclarativeEngineDebugServer::propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value)
{
QByteArray reply;
QDataStream rs(&reply, QIODevice::WriteOnly);
@@ -438,7 +439,7 @@ void QmlEngineDebugServer::propertyChanged(int id, int objectId, const QMetaProp
sendMessage(reply);
}
-void QmlEngineDebugServer::addEngine(QmlEngine *engine)
+void QDeclarativeEngineDebugServer::addEngine(QDeclarativeEngine *engine)
{
Q_ASSERT(engine);
Q_ASSERT(!m_engines.contains(engine));
@@ -446,7 +447,7 @@ void QmlEngineDebugServer::addEngine(QmlEngine *engine)
m_engines.append(engine);
}
-void QmlEngineDebugServer::remEngine(QmlEngine *engine)
+void QDeclarativeEngineDebugServer::remEngine(QDeclarativeEngine *engine)
{
Q_ASSERT(engine);
Q_ASSERT(m_engines.contains(engine));
diff --git a/src/declarative/qml/qmlenginedebug_p.h b/src/declarative/qml/qdeclarativeenginedebug_p.h
index a6f296a..89da399 100644
--- a/src/declarative/qml/qmlenginedebug_p.h
+++ b/src/declarative/qml/qdeclarativeenginedebug_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLENGINEDEBUG_P_H
-#define QMLENGINEDEBUG_P_H
+#ifndef QDECLARATIVEENGINEDEBUG_P_H
+#define QDECLARATIVEENGINEDEBUG_P_H
//
// W A R N I N G
@@ -53,25 +53,25 @@
// We mean it.
//
-#include "../debugger/qmldebugservice_p.h"
+#include "../debugger/qdeclarativedebugservice_p.h"
#include <QtCore/qurl.h>
#include <QtCore/qvariant.h>
QT_BEGIN_NAMESPACE
-class QmlEngine;
-class QmlContext;
-class QmlWatcher;
+class QDeclarativeEngine;
+class QDeclarativeContext;
+class QDeclarativeWatcher;
class QDataStream;
-class QmlEngineDebugServer : public QmlDebugService
+class QDeclarativeEngineDebugServer : public QDeclarativeDebugService
{
Q_OBJECT
public:
- QmlEngineDebugServer(QObject * = 0);
+ QDeclarativeEngineDebugServer(QObject * = 0);
- struct QmlObjectData {
+ struct QDeclarativeObjectData {
QUrl url;
int lineNumber;
int columnNumber;
@@ -81,7 +81,7 @@ public:
int contextId;
};
- struct QmlObjectProperty {
+ struct QDeclarativeObjectProperty {
enum Type { Unknown, Basic, Object, List, SignalProperty };
Type type;
QString name;
@@ -91,8 +91,8 @@ public:
bool hasNotifySignal;
};
- static void addEngine(QmlEngine *);
- static void remEngine(QmlEngine *);
+ static void addEngine(QDeclarativeEngine *);
+ static void remEngine(QDeclarativeEngine *);
protected:
virtual void messageReceived(const QByteArray &);
@@ -101,21 +101,21 @@ private Q_SLOTS:
void propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value);
private:
- void buildObjectList(QDataStream &, QmlContext *);
+ void buildObjectList(QDataStream &, QDeclarativeContext *);
void buildObjectDump(QDataStream &, QObject *, bool);
- QmlObjectData objectData(QObject *);
- QmlObjectProperty propertyData(QObject *, int);
+ QDeclarativeObjectData objectData(QObject *);
+ QDeclarativeObjectProperty propertyData(QObject *, int);
QVariant valueContents(const QVariant &defaultValue) const;
- static QList<QmlEngine *> m_engines;
- QmlWatcher *m_watch;
+ static QList<QDeclarativeEngine *> m_engines;
+ QDeclarativeWatcher *m_watch;
};
-Q_DECLARATIVE_EXPORT QDataStream &operator<<(QDataStream &, const QmlEngineDebugServer::QmlObjectData &);
-Q_DECLARATIVE_EXPORT QDataStream &operator>>(QDataStream &, QmlEngineDebugServer::QmlObjectData &);
-Q_DECLARATIVE_EXPORT QDataStream &operator<<(QDataStream &, const QmlEngineDebugServer::QmlObjectProperty &);
-Q_DECLARATIVE_EXPORT QDataStream &operator>>(QDataStream &, QmlEngineDebugServer::QmlObjectProperty &);
+Q_DECLARATIVE_EXPORT QDataStream &operator<<(QDataStream &, const QDeclarativeEngineDebugServer::QDeclarativeObjectData &);
+Q_DECLARATIVE_EXPORT QDataStream &operator>>(QDataStream &, QDeclarativeEngineDebugServer::QDeclarativeObjectData &);
+Q_DECLARATIVE_EXPORT QDataStream &operator<<(QDataStream &, const QDeclarativeEngineDebugServer::QDeclarativeObjectProperty &);
+Q_DECLARATIVE_EXPORT QDataStream &operator>>(QDataStream &, QDeclarativeEngineDebugServer::QDeclarativeObjectProperty &);
QT_END_NAMESPACE
-#endif // QMLENGINEDEBUG_P_H
+#endif // QDECLARATIVEENGINEDEBUG_P_H
diff --git a/src/declarative/qml/qmlerror.cpp b/src/declarative/qml/qdeclarativeerror.cpp
index fc4bcd5..7e8aac0 100644
--- a/src/declarative/qml/qmlerror.cpp
+++ b/src/declarative/qml/qdeclarativeerror.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmlerror.h"
+#include "qdeclarativeerror.h"
#include <QtCore/qdebug.h>
#include <QtCore/qfile.h>
@@ -48,14 +48,14 @@
QT_BEGIN_NAMESPACE
/*!
- \class QmlError
+ \class QDeclarativeError
\since 4.7
- \brief The QmlError class encapsulates a QML error
+ \brief The QDeclarativeError class encapsulates a QML error
*/
-class QmlErrorPrivate
+class QDeclarativeErrorPrivate
{
public:
- QmlErrorPrivate();
+ QDeclarativeErrorPrivate();
QUrl url;
QString description;
@@ -63,7 +63,7 @@ public:
int column;
};
-QmlErrorPrivate::QmlErrorPrivate()
+QDeclarativeErrorPrivate::QDeclarativeErrorPrivate()
: line(-1), column(-1)
{
}
@@ -71,7 +71,7 @@ QmlErrorPrivate::QmlErrorPrivate()
/*!
Create an empty error object.
*/
-QmlError::QmlError()
+QDeclarativeError::QDeclarativeError()
: d(0)
{
}
@@ -79,7 +79,7 @@ QmlError::QmlError()
/*!
Create a copy of \a other.
*/
-QmlError::QmlError(const QmlError &other)
+QDeclarativeError::QDeclarativeError(const QDeclarativeError &other)
: d(0)
{
*this = other;
@@ -88,13 +88,13 @@ QmlError::QmlError(const QmlError &other)
/*!
Assign \a other to this error object.
*/
-QmlError &QmlError::operator=(const QmlError &other)
+QDeclarativeError &QDeclarativeError::operator=(const QDeclarativeError &other)
{
if (!other.d) {
delete d;
d = 0;
} else {
- if (!d) d = new QmlErrorPrivate;
+ if (!d) d = new QDeclarativeErrorPrivate;
d->url = other.d->url;
d->description = other.d->description;
d->line = other.d->line;
@@ -106,7 +106,7 @@ QmlError &QmlError::operator=(const QmlError &other)
/*!
\internal
*/
-QmlError::~QmlError()
+QDeclarativeError::~QDeclarativeError()
{
delete d; d = 0;
}
@@ -114,7 +114,7 @@ QmlError::~QmlError()
/*!
Return true if this error is valid, otherwise false.
*/
-bool QmlError::isValid() const
+bool QDeclarativeError::isValid() const
{
return d != 0;
}
@@ -122,7 +122,7 @@ bool QmlError::isValid() const
/*!
Return the url for the file that caused this error.
*/
-QUrl QmlError::url() const
+QUrl QDeclarativeError::url() const
{
if (d) return d->url;
else return QUrl();
@@ -131,16 +131,16 @@ QUrl QmlError::url() const
/*!
Set the \a url for the file that caused this error.
*/
-void QmlError::setUrl(const QUrl &url)
+void QDeclarativeError::setUrl(const QUrl &url)
{
- if (!d) d = new QmlErrorPrivate;
+ if (!d) d = new QDeclarativeErrorPrivate;
d->url = url;
}
/*!
Return the error description.
*/
-QString QmlError::description() const
+QString QDeclarativeError::description() const
{
if (d) return d->description;
else return QString();
@@ -149,16 +149,16 @@ QString QmlError::description() const
/*!
Set the error \a description.
*/
-void QmlError::setDescription(const QString &description)
+void QDeclarativeError::setDescription(const QString &description)
{
- if (!d) d = new QmlErrorPrivate;
+ if (!d) d = new QDeclarativeErrorPrivate;
d->description = description;
}
/*!
Return the error line number.
*/
-int QmlError::line() const
+int QDeclarativeError::line() const
{
if (d) return d->line;
else return -1;
@@ -167,16 +167,16 @@ int QmlError::line() const
/*!
Set the error \a line number.
*/
-void QmlError::setLine(int line)
+void QDeclarativeError::setLine(int line)
{
- if (!d) d = new QmlErrorPrivate;
+ if (!d) d = new QDeclarativeErrorPrivate;
d->line = line;
}
/*!
Return the error column number.
*/
-int QmlError::column() const
+int QDeclarativeError::column() const
{
if (d) return d->column;
else return -1;
@@ -185,16 +185,16 @@ int QmlError::column() const
/*!
Set the error \a column number.
*/
-void QmlError::setColumn(int column)
+void QDeclarativeError::setColumn(int column)
{
- if (!d) d = new QmlErrorPrivate;
+ if (!d) d = new QDeclarativeErrorPrivate;
d->column = column;
}
/*!
Return the error as a human readable string.
*/
-QString QmlError::toString() const
+QString QDeclarativeError::toString() const
{
QString rv;
rv = url().toString() + QLatin1Char(':') + QString::number(line());
@@ -207,13 +207,13 @@ QString QmlError::toString() const
}
/*!
- \relates QmlError
- \fn QDebug operator<<(QDebug debug, const QmlError &error)
+ \relates QDeclarativeError
+ \fn QDebug operator<<(QDebug debug, const QDeclarativeError &error)
Output a human readable version of \a error to \a debug.
*/
-QDebug operator<<(QDebug debug, const QmlError &error)
+QDebug operator<<(QDebug debug, const QDeclarativeError &error)
{
debug << qPrintable(error.toString());
diff --git a/src/declarative/qml/qmlerror.h b/src/declarative/qml/qdeclarativeerror.h
index 8c4d785..04d5ff2 100644
--- a/src/declarative/qml/qmlerror.h
+++ b/src/declarative/qml/qdeclarativeerror.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLERROR_H
-#define QMLERROR_H
+#ifndef QDECLARATIVEERROR_H
+#define QDECLARATIVEERROR_H
#include <QtCore/qurl.h>
#include <QtCore/qstring.h>
@@ -52,14 +52,14 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QDebug;
-class QmlErrorPrivate;
-class Q_DECLARATIVE_EXPORT QmlError
+class QDeclarativeErrorPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeError
{
public:
- QmlError();
- QmlError(const QmlError &);
- QmlError &operator=(const QmlError &);
- ~QmlError();
+ QDeclarativeError();
+ QDeclarativeError(const QDeclarativeError &);
+ QDeclarativeError &operator=(const QDeclarativeError &);
+ ~QDeclarativeError();
bool isValid() const;
@@ -74,13 +74,13 @@ public:
QString toString() const;
private:
- QmlErrorPrivate *d;
+ QDeclarativeErrorPrivate *d;
};
-QDebug Q_DECLARATIVE_EXPORT operator<<(QDebug debug, const QmlError &error);
+QDebug Q_DECLARATIVE_EXPORT operator<<(QDebug debug, const QDeclarativeError &error);
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLERROR_H
+#endif // QDECLARATIVEERROR_H
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp
index 3039fed..ae1e790 100644
--- a/src/declarative/qml/qmlexpression.cpp
+++ b/src/declarative/qml/qdeclarativeexpression.cpp
@@ -39,13 +39,13 @@
**
****************************************************************************/
-#include "qmlexpression.h"
-#include "qmlexpression_p.h"
+#include "qdeclarativeexpression.h"
+#include "qdeclarativeexpression_p.h"
-#include "qmlengine_p.h"
-#include "qmlcontext_p.h"
-#include "qmlrewrite_p.h"
-#include "qmlcompiler_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativecontext_p.h"
+#include "qdeclarativerewrite_p.h"
+#include "qdeclarativecompiler_p.h"
#include <QtCore/qdebug.h>
#include <QtScript/qscriptprogram.h>
@@ -54,7 +54,7 @@
QT_BEGIN_NAMESPACE
-bool QmlDelayedError::addError(QmlEnginePrivate *e)
+bool QDeclarativeDelayedError::addError(QDeclarativeEnginePrivate *e)
{
if (!e || prevError) return false;
@@ -68,45 +68,45 @@ bool QmlDelayedError::addError(QmlEnginePrivate *e)
return true;
}
-QmlExpressionData::QmlExpressionData()
+QDeclarativeExpressionData::QDeclarativeExpressionData()
: q(0), dataRef(0), expressionFunctionValid(false), expressionRewritten(false), me(0),
- trackChange(true), isShared(false), line(-1), guardList(0), guardListLength(0)
+ trackChange(false), isShared(false), line(-1), guardList(0), guardListLength(0)
{
}
-QmlExpressionData::~QmlExpressionData()
+QDeclarativeExpressionData::~QDeclarativeExpressionData()
{
if (guardList) { delete [] guardList; guardList = 0; }
if (dataRef) dataRef->release();
}
-QmlExpressionPrivate::QmlExpressionPrivate()
-: data(new QmlExpressionData)
+QDeclarativeExpressionPrivate::QDeclarativeExpressionPrivate()
+: data(new QDeclarativeExpressionData)
{
data->q = this;
}
-QmlExpressionPrivate::QmlExpressionPrivate(QmlExpressionData *d)
+QDeclarativeExpressionPrivate::QDeclarativeExpressionPrivate(QDeclarativeExpressionData *d)
: data(d)
{
data->q = this;
}
-QmlExpressionPrivate::~QmlExpressionPrivate()
+QDeclarativeExpressionPrivate::~QDeclarativeExpressionPrivate()
{
if (data) { data->q = 0; data->release(); data = 0; }
}
-void QmlExpressionPrivate::init(QmlContext *ctxt, const QString &expr,
+void QDeclarativeExpressionPrivate::init(QDeclarativeContext *ctxt, const QString &expr,
QObject *me)
{
data->expression = expr;
- data->QmlAbstractExpression::setContext(ctxt);
+ data->QDeclarativeAbstractExpression::setContext(ctxt);
data->me = me;
}
-void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc,
+void QDeclarativeExpressionPrivate::init(QDeclarativeContext *ctxt, void *expr, QDeclarativeRefCount *rc,
QObject *me, const QString &url, int lineNumber)
{
data->url = url;
@@ -117,7 +117,7 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc,
if (data->dataRef) data->dataRef->addref();
quint32 *exprData = (quint32 *)expr;
- QmlCompiledData *dd = (QmlCompiledData *)rc;
+ QDeclarativeCompiledData *dd = (QDeclarativeCompiledData *)rc;
data->expressionRewritten = true;
data->expression = QString::fromRawData((QChar *)(exprData + 2), exprData[1]);
@@ -126,9 +126,9 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc,
bool isShared = progIdx & 0x80000000;
progIdx &= 0x7FFFFFFF;
- QmlEngine *engine = ctxt->engine();
- QmlEnginePrivate *ep = QmlEnginePrivate::get(engine);
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QDeclarativeEngine *engine = ctxt->engine();
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
if (isShared) {
@@ -159,14 +159,14 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc,
data->expressionFunctionValid = true;
}
- data->QmlAbstractExpression::setContext(ctxt);
+ data->QDeclarativeAbstractExpression::setContext(ctxt);
data->me = me;
}
-QScriptValue QmlExpressionPrivate::evalInObjectScope(QmlContext *context, QObject *object,
+QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContext *context, QObject *object,
const QString &program)
{
- QmlEnginePrivate *ep = QmlEnginePrivate::get(context->engine());
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context->engine());
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(&ep->scriptEngine);
scriptContext->pushScope(ep->contextClass->newContext(context, object));
QScriptValue rv = ep->scriptEngine.evaluate(program);
@@ -174,10 +174,10 @@ QScriptValue QmlExpressionPrivate::evalInObjectScope(QmlContext *context, QObjec
return rv;
}
-QScriptValue QmlExpressionPrivate::evalInObjectScope(QmlContext *context, QObject *object,
+QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContext *context, QObject *object,
const QScriptProgram &program)
{
- QmlEnginePrivate *ep = QmlEnginePrivate::get(context->engine());
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context->engine());
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(&ep->scriptEngine);
scriptContext->pushScope(ep->contextClass->newContext(context, object));
QScriptValue rv = ep->scriptEngine.evaluate(program);
@@ -186,107 +186,99 @@ QScriptValue QmlExpressionPrivate::evalInObjectScope(QmlContext *context, QObjec
}
/*!
- \class QmlExpression
+ \class QDeclarativeExpression
\since 4.7
- \brief The QmlExpression class evaluates JavaScript in a QML context.
+ \brief The QDeclarativeExpression class evaluates JavaScript in a QML context.
*/
/*!
- Create an invalid QmlExpression.
+ Create an invalid QDeclarativeExpression.
- As the expression will not have an associated QmlContext, this will be a
+ As the expression will not have an associated QDeclarativeContext, this will be a
null expression object and its value will always be an invalid QVariant.
*/
-QmlExpression::QmlExpression()
-: QObject(*new QmlExpressionPrivate, 0)
+QDeclarativeExpression::QDeclarativeExpression()
+: QObject(*new QDeclarativeExpressionPrivate, 0)
{
}
/*! \internal */
-QmlExpression::QmlExpression(QmlContext *ctxt, void *expr,
- QmlRefCount *rc, QObject *me,
+QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContext *ctxt, void *expr,
+ QDeclarativeRefCount *rc, QObject *me,
const QString &url, int lineNumber,
- QmlExpressionPrivate &dd)
+ QDeclarativeExpressionPrivate &dd)
: QObject(dd, 0)
{
- Q_D(QmlExpression);
+ Q_D(QDeclarativeExpression);
d->init(ctxt, expr, rc, me, url, lineNumber);
}
/*!
- Create a QmlExpression object.
+ Create a QDeclarativeExpression object.
- The \a expression JavaScript will be executed in the \a ctxt QmlContext.
+ The \a expression JavaScript will be executed in the \a ctxt QDeclarativeContext.
If specified, the \a scope object's properties will also be in scope during
the expression's execution.
*/
-QmlExpression::QmlExpression(QmlContext *ctxt, const QString &expression,
+QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContext *ctxt, const QString &expression,
QObject *scope)
-: QObject(*new QmlExpressionPrivate, 0)
+: QObject(*new QDeclarativeExpressionPrivate, 0)
{
- Q_D(QmlExpression);
+ Q_D(QDeclarativeExpression);
d->init(ctxt, expression, scope);
}
/*! \internal */
-QmlExpression::QmlExpression(QmlContext *ctxt, const QString &expression,
- QObject *scope, QmlExpressionPrivate &dd)
+QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContext *ctxt, const QString &expression,
+ QObject *scope, QDeclarativeExpressionPrivate &dd)
: QObject(dd, 0)
{
- Q_D(QmlExpression);
+ Q_D(QDeclarativeExpression);
d->init(ctxt, expression, scope);
}
/*!
- Destroy the QmlExpression instance.
+ Destroy the QDeclarativeExpression instance.
*/
-QmlExpression::~QmlExpression()
+QDeclarativeExpression::~QDeclarativeExpression()
{
}
/*!
- Returns the QmlEngine this expression is associated with, or 0 if there
- is no association or the QmlEngine has been destroyed.
+ Returns the QDeclarativeEngine this expression is associated with, or 0 if there
+ is no association or the QDeclarativeEngine has been destroyed.
*/
-QmlEngine *QmlExpression::engine() const
+QDeclarativeEngine *QDeclarativeExpression::engine() const
{
- Q_D(const QmlExpression);
+ Q_D(const QDeclarativeExpression);
return d->data->context()?d->data->context()->engine():0;
}
/*!
- Returns the QmlContext this expression is associated with, or 0 if there
- is no association or the QmlContext has been destroyed.
+ Returns the QDeclarativeContext this expression is associated with, or 0 if there
+ is no association or the QDeclarativeContext has been destroyed.
*/
-QmlContext *QmlExpression::context() const
+QDeclarativeContext *QDeclarativeExpression::context() const
{
- Q_D(const QmlExpression);
+ Q_D(const QDeclarativeExpression);
return d->data->context();
}
/*!
Returns the expression string.
*/
-QString QmlExpression::expression() const
+QString QDeclarativeExpression::expression() const
{
- Q_D(const QmlExpression);
+ Q_D(const QDeclarativeExpression);
return d->data->expression;
}
/*!
- Clear the expression.
-*/
-void QmlExpression::clearExpression()
-{
- setExpression(QString());
-}
-
-/*!
Set the expression to \a expression.
*/
-void QmlExpression::setExpression(const QString &expression)
+void QDeclarativeExpression::setExpression(const QString &expression)
{
- Q_D(QmlExpression);
+ Q_D(QDeclarativeExpression);
d->clearGuards();
@@ -296,8 +288,8 @@ void QmlExpression::setExpression(const QString &expression)
d->data->expressionFunction = QScriptValue();
}
-void QmlExpressionPrivate::exceptionToError(QScriptEngine *scriptEngine,
- QmlError &error)
+void QDeclarativeExpressionPrivate::exceptionToError(QScriptEngine *scriptEngine,
+ QDeclarativeError &error)
{
if (scriptEngine->hasUncaughtException() &&
scriptEngine->uncaughtException().isError()) {
@@ -319,25 +311,25 @@ void QmlExpressionPrivate::exceptionToError(QScriptEngine *scriptEngine,
error.setColumn(-1);
error.setDescription(exception.toString());
} else {
- error = QmlError();
+ error = QDeclarativeError();
}
}
-QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUndefined)
+QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUndefined)
{
#ifdef Q_ENABLE_PERFORMANCE_LOG
- QmlPerfTimer<QmlPerf::BindValueQt> perfqt;
+ QDeclarativePerfTimer<QDeclarativePerf::BindValueQt> perfqt;
#endif
- QmlExpressionData *data = this->data;
- QmlContextPrivate *ctxtPriv = data->context()->d_func();
- QmlEngine *engine = data->context()->engine();
- QmlEnginePrivate *ep = QmlEnginePrivate::get(engine);
+ QDeclarativeExpressionData *data = this->data;
+ QDeclarativeContextPrivate *ctxtPriv = data->context()->d_func();
+ QDeclarativeEngine *engine = data->context()->engine();
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
if (secondaryScope)
ctxtPriv->defaultObjects.append(secondaryScope);
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
if (!data->expressionFunctionValid) {
@@ -348,7 +340,7 @@ QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUnd
data->expressionFunction = scriptEngine->evaluate(data->expression,
data->url, data->line);
} else {
- QmlRewrite::RewriteBinding rewriteBinding;
+ QDeclarativeRewrite::RewriteBinding rewriteBinding;
bool ok = true;
const QString code = rewriteBinding(data->expression, &ok);
@@ -363,7 +355,7 @@ QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUnd
data->expressionFunctionValid = true;
}
- QmlContext *oldSharedContext = 0;
+ QDeclarativeContext *oldSharedContext = 0;
QObject *oldSharedScope = 0;
if (data->isShared) {
oldSharedContext = ep->sharedContext;
@@ -388,7 +380,7 @@ QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUnd
scriptEngine->clearExceptions();
return QVariant();
} else {
- data->error = QmlError();
+ data->error = QDeclarativeError();
}
if (secondaryScope) {
@@ -428,13 +420,13 @@ QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUnd
return rv;
}
-QVariant QmlExpressionPrivate::value(QObject *secondaryScope, bool *isUndefined)
+QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isUndefined)
{
- Q_Q(QmlExpression);
+ Q_Q(QDeclarativeExpression);
QVariant rv;
if (!q->engine()) {
- qWarning("QmlExpression: Attempted to evaluate an expression in an invalid context");
+ qWarning("QDeclarativeExpression: Attempted to evaluate an expression in an invalid context");
return rv;
}
@@ -442,21 +434,21 @@ QVariant QmlExpressionPrivate::value(QObject *secondaryScope, bool *isUndefined)
return rv;
#ifdef Q_ENABLE_PERFORMANCE_LOG
- QmlPerfTimer<QmlPerf::BindValue> perf;
+ QDeclarativePerfTimer<QDeclarativePerf::BindValue> perf;
#endif
- QmlEnginePrivate *ep = QmlEnginePrivate::get(q->engine());
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(q->engine());
- QmlExpression *lastCurrentExpression = ep->currentExpression;
+ QDeclarativeExpression *lastCurrentExpression = ep->currentExpression;
bool lastCaptureProperties = ep->captureProperties;
- QPODVector<QmlEnginePrivate::CapturedProperty> lastCapturedProperties;
+ QPODVector<QDeclarativeEnginePrivate::CapturedProperty> lastCapturedProperties;
ep->capturedProperties.copyAndClear(lastCapturedProperties);
ep->currentExpression = q;
ep->captureProperties = data->trackChange;
// This object might be deleted during the eval
- QmlExpressionData *localData = data;
+ QDeclarativeExpressionData *localData = data;
localData->addref();
rv = evalQtScript(secondaryScope, isUndefined);
@@ -489,60 +481,50 @@ QVariant QmlExpressionPrivate::value(QObject *secondaryScope, bool *isUndefined)
\sa hasError(), error()
*/
-QVariant QmlExpression::value(bool *isUndefined)
+QVariant QDeclarativeExpression::value(bool *isUndefined)
{
- Q_D(QmlExpression);
+ Q_D(QDeclarativeExpression);
return d->value(0, isUndefined);
}
/*!
- Returns true if the expression results in a constant value.
- QmlExpression::value() must have been invoked at least once before the
- return from this method is valid.
- */
-bool QmlExpression::isConstant() const
-{
- Q_D(const QmlExpression);
- return !d->data->guardList;
-}
-
-/*!
- Returns true if the changes are tracked in the expression's value.
+Returns true if the valueChanged() signal is emitted when the expression's evaluated
+value changes.
*/
-bool QmlExpression::trackChange() const
+bool QDeclarativeExpression::notifyOnValueChanged() const
{
- Q_D(const QmlExpression);
+ Q_D(const QDeclarativeExpression);
return d->data->trackChange;
}
/*!
- Set whether changes are tracked in the expression's value to \a trackChange.
+Sets whether the valueChanged() signal is emitted when the expression's evaluated
+value changes.
- If true, the QmlExpression will monitor properties involved in the
- expression's evaluation, and call QmlExpression::valueChanged() if they have
- changed. This allows an application to ensure that any value associated
- with the result of the expression remains up to date.
+If true, the QDeclarativeExpression will monitor properties involved in the expression's
+evaluation, and emit QDeclarativeExpression::valueChanged() if they have changed. This allows
+an application to ensure that any value associated with the result of the expression
+remains up to date.
- If false, the QmlExpression will not montitor properties involved in the
- expression's evaluation, and QmlExpression::valueChanged() will never be
- called. This is more efficient if an application wants a "one off"
- evaluation of the expression.
+If false, the QDeclarativeExpression will not montitor properties involved in the expression's
+evaluation, and QDeclarativeExpression::valueChanged() will never be emitted. This is more efficient
+if an application wants a "one off" evaluation of the expression.
- By default, trackChange is true.
+By default, notifyOnChange is false.
*/
-void QmlExpression::setTrackChange(bool trackChange)
+void QDeclarativeExpression::setNotifyOnValueChanged(bool notifyOnChange)
{
- Q_D(QmlExpression);
- d->data->trackChange = trackChange;
+ Q_D(QDeclarativeExpression);
+ d->data->trackChange = notifyOnChange;
}
/*!
Returns the source file URL for this expression. The source location must
have been previously set by calling setSourceLocation().
*/
-QString QmlExpression::sourceFile() const
+QString QDeclarativeExpression::sourceFile() const
{
- Q_D(const QmlExpression);
+ Q_D(const QDeclarativeExpression);
return d->data->url;
}
@@ -550,9 +532,9 @@ QString QmlExpression::sourceFile() const
Returns the source file line number for this expression. The source location
must have been previously set by calling setSourceLocation().
*/
-int QmlExpression::lineNumber() const
+int QDeclarativeExpression::lineNumber() const
{
- Q_D(const QmlExpression);
+ Q_D(const QDeclarativeExpression);
return d->data->line;
}
@@ -560,9 +542,9 @@ int QmlExpression::lineNumber() const
Set the location of this expression to \a line of \a url. This information
is used by the script engine.
*/
-void QmlExpression::setSourceLocation(const QString &url, int line)
+void QDeclarativeExpression::setSourceLocation(const QString &url, int line)
{
- Q_D(QmlExpression);
+ Q_D(QDeclarativeExpression);
d->data->url = url;
d->data->line = line;
}
@@ -570,12 +552,12 @@ void QmlExpression::setSourceLocation(const QString &url, int line)
/*!
Returns the expression's scope object, if provided, otherwise 0.
- In addition to data provided by the expression's QmlContext, the scope
+ In addition to data provided by the expression's QDeclarativeContext, the scope
object's properties are also in scope during the expression's evaluation.
*/
-QObject *QmlExpression::scopeObject() const
+QObject *QDeclarativeExpression::scopeObject() const
{
- Q_D(const QmlExpression);
+ Q_D(const QDeclarativeExpression);
return d->data->me;
}
@@ -585,9 +567,9 @@ QObject *QmlExpression::scopeObject() const
\sa error(), clearError()
*/
-bool QmlExpression::hasError() const
+bool QDeclarativeExpression::hasError() const
{
- Q_D(const QmlExpression);
+ Q_D(const QDeclarativeExpression);
return d->data->error.isValid();
}
@@ -597,39 +579,40 @@ bool QmlExpression::hasError() const
\sa hasError(), error()
*/
-void QmlExpression::clearError()
+void QDeclarativeExpression::clearError()
{
- Q_D(QmlExpression);
- d->data->error = QmlError();
+ Q_D(QDeclarativeExpression);
+ d->data->error = QDeclarativeError();
}
/*!
Return any error from the last call to value(). If there was no error,
- this returns an invalid QmlError instance.
+ this returns an invalid QDeclarativeError instance.
\sa hasError(), clearError()
*/
-QmlError QmlExpression::error() const
+QDeclarativeError QDeclarativeExpression::error() const
{
- Q_D(const QmlExpression);
+ Q_D(const QDeclarativeExpression);
return d->data->error;
}
/*! \internal */
-void QmlExpression::__q_notify()
+void QDeclarativeExpression::__q_notify()
{
- emitValueChanged();
+ Q_D(QDeclarativeExpression);
+ d->emitValueChanged();
}
-void QmlExpressionPrivate::clearGuards()
+void QDeclarativeExpressionPrivate::clearGuards()
{
- Q_Q(QmlExpression);
+ Q_Q(QDeclarativeExpression);
static int notifyIdx = -1;
if (notifyIdx == -1)
notifyIdx =
- QmlExpression::staticMetaObject.indexOfMethod("__q_notify()");
+ QDeclarativeExpression::staticMetaObject.indexOfMethod("__q_notify()");
for (int ii = 0; ii < data->guardListLength; ++ii) {
if (data->guardList[ii].data()) {
@@ -650,25 +633,25 @@ void QmlExpressionPrivate::clearGuards()
data->guardListLength = 0;
}
-void QmlExpressionPrivate::updateGuards(const QPODVector<QmlEnginePrivate::CapturedProperty> &properties)
+void QDeclarativeExpressionPrivate::updateGuards(const QPODVector<QDeclarativeEnginePrivate::CapturedProperty> &properties)
{
//clearGuards();
- Q_Q(QmlExpression);
+ Q_Q(QDeclarativeExpression);
static int notifyIdx = -1;
if (notifyIdx == -1)
notifyIdx =
- QmlExpression::staticMetaObject.indexOfMethod("__q_notify()");
+ QDeclarativeExpression::staticMetaObject.indexOfMethod("__q_notify()");
- QmlExpressionData::SignalGuard *newGuardList = 0;
+ QDeclarativeExpressionData::SignalGuard *newGuardList = 0;
if (properties.count() != data->guardListLength)
- newGuardList = new QmlExpressionData::SignalGuard[properties.count()];
+ newGuardList = new QDeclarativeExpressionData::SignalGuard[properties.count()];
bool outputWarningHeader = false;
int hit = 0;
for (int ii = 0; ii < properties.count(); ++ii) {
- const QmlEnginePrivate::CapturedProperty &property = properties.at(ii);
+ const QDeclarativeEnginePrivate::CapturedProperty &property = properties.at(ii);
bool needGuard = true;
if (ii >= data->guardListLength) {
@@ -700,7 +683,7 @@ void QmlExpressionPrivate::updateGuards(const QPODVector<QmlEnginePrivate::Captu
if (needGuard) {
if (!newGuardList) {
- newGuardList = new QmlExpressionData::SignalGuard[properties.count()];
+ newGuardList = new QDeclarativeExpressionData::SignalGuard[properties.count()];
for (int jj = 0; jj < ii; ++jj)
newGuardList[jj] = data->guardList[jj];
}
@@ -721,7 +704,7 @@ void QmlExpressionPrivate::updateGuards(const QPODVector<QmlEnginePrivate::Captu
} else {
if (!outputWarningHeader) {
outputWarningHeader = true;
- qWarning() << "QmlExpression: Expression" << q->expression()
+ qWarning() << "QDeclarativeExpression: Expression" << q->expression()
<< "depends on non-NOTIFYable properties:";
}
@@ -759,28 +742,25 @@ void QmlExpressionPrivate::updateGuards(const QPODVector<QmlEnginePrivate::Captu
}
/*!
- \fn void QmlExpression::valueChanged()
+ \fn void QDeclarativeExpression::valueChanged()
Emitted each time the expression value changes from the last time it was
evaluated. The expression must have been evaluated at least once (by
- calling QmlExpression::value()) before this signal will be emitted.
+ calling QDeclarativeExpression::value()) before this signal will be emitted.
*/
-/*!
- Subclasses can capture the emission of the valueChanged() signal by overriding
- this function. They can choose whether to then call valueChanged().
-*/
-void QmlExpression::emitValueChanged()
+void QDeclarativeExpressionPrivate::emitValueChanged()
{
- emit valueChanged();
+ Q_Q(QDeclarativeExpression);
+ emit q->valueChanged();
}
-QmlAbstractExpression::QmlAbstractExpression()
+QDeclarativeAbstractExpression::QDeclarativeAbstractExpression()
: m_context(0), m_prevExpression(0), m_nextExpression(0)
{
}
-QmlAbstractExpression::~QmlAbstractExpression()
+QDeclarativeAbstractExpression::~QDeclarativeAbstractExpression()
{
if (m_prevExpression) {
*m_prevExpression = m_nextExpression;
@@ -789,12 +769,12 @@ QmlAbstractExpression::~QmlAbstractExpression()
}
}
-QmlContext *QmlAbstractExpression::context() const
+QDeclarativeContext *QDeclarativeAbstractExpression::context() const
{
return m_context;
}
-void QmlAbstractExpression::setContext(QmlContext *context)
+void QDeclarativeAbstractExpression::setContext(QDeclarativeContext *context)
{
if (m_prevExpression) {
*m_prevExpression = m_nextExpression;
@@ -807,8 +787,8 @@ void QmlAbstractExpression::setContext(QmlContext *context)
m_context = context;
if (m_context) {
- QmlContextPrivate *cp =
- static_cast<QmlContextPrivate *>(QObjectPrivate::get(m_context));
+ QDeclarativeContextPrivate *cp =
+ static_cast<QDeclarativeContextPrivate *>(QObjectPrivate::get(m_context));
m_nextExpression = cp->expressions;
if (m_nextExpression)
m_nextExpression->m_prevExpression = &m_nextExpression;
@@ -817,11 +797,11 @@ void QmlAbstractExpression::setContext(QmlContext *context)
}
}
-void QmlAbstractExpression::refresh()
+void QDeclarativeAbstractExpression::refresh()
{
}
-bool QmlAbstractExpression::isValid() const
+bool QDeclarativeAbstractExpression::isValid() const
{
return m_context != 0;
}
diff --git a/src/declarative/qml/qmlexpression.h b/src/declarative/qml/qdeclarativeexpression.h
index 428eefa..911d328 100644
--- a/src/declarative/qml/qmlexpression.h
+++ b/src/declarative/qml/qdeclarativeexpression.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLEXPRESSION_H
-#define QMLEXPRESSION_H
+#ifndef QDECLARATIVEEXPRESSION_H
+#define QDECLARATIVEEXPRESSION_H
-#include "qmlerror.h"
+#include "qdeclarativeerror.h"
#include <QtCore/qobject.h>
#include <QtCore/qvariant.h>
@@ -54,28 +54,26 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QString;
-class QmlRefCount;
-class QmlEngine;
-class QmlContext;
-class QmlExpressionPrivate;
-class Q_DECLARATIVE_EXPORT QmlExpression : public QObject
+class QDeclarativeRefCount;
+class QDeclarativeEngine;
+class QDeclarativeContext;
+class QDeclarativeExpressionPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeExpression : public QObject
{
Q_OBJECT
public:
- QmlExpression();
- QmlExpression(QmlContext *, const QString &, QObject *);
- virtual ~QmlExpression();
+ QDeclarativeExpression();
+ QDeclarativeExpression(QDeclarativeContext *, const QString &, QObject *);
+ virtual ~QDeclarativeExpression();
- QmlEngine *engine() const;
- QmlContext *context() const;
+ QDeclarativeEngine *engine() const;
+ QDeclarativeContext *context() const;
QString expression() const;
- void clearExpression();
- virtual void setExpression(const QString &);
- bool isConstant() const;
+ void setExpression(const QString &);
- bool trackChange() const;
- void setTrackChange(bool);
+ bool notifyOnValueChanged() const;
+ void setNotifyOnValueChanged(bool);
QString sourceFile() const;
int lineNumber() const;
@@ -85,34 +83,31 @@ public:
bool hasError() const;
void clearError();
- QmlError error() const;
+ QDeclarativeError error() const;
-public Q_SLOTS:
QVariant value(bool *isUndefined = 0);
Q_SIGNALS:
void valueChanged();
protected:
- virtual void emitValueChanged();
-
- QmlExpression(QmlContext *, const QString &, QObject *,
- QmlExpressionPrivate &dd);
- QmlExpression(QmlContext *, void *, QmlRefCount *rc, QObject *me, const QString &,
- int, QmlExpressionPrivate &dd);
+ QDeclarativeExpression(QDeclarativeContext *, const QString &, QObject *,
+ QDeclarativeExpressionPrivate &dd);
+ QDeclarativeExpression(QDeclarativeContext *, void *, QDeclarativeRefCount *rc, QObject *me, const QString &,
+ int, QDeclarativeExpressionPrivate &dd);
private Q_SLOTS:
void __q_notify();
private:
- Q_DECLARE_PRIVATE(QmlExpression)
- friend class QmlDebugger;
- friend class QmlContext;
+ Q_DECLARE_PRIVATE(QDeclarativeExpression)
+ friend class QDeclarativeDebugger;
+ friend class QDeclarativeContext;
};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLEXPRESSION_H
+#endif // QDECLARATIVEEXPRESSION_H
diff --git a/src/declarative/qml/qmlexpression_p.h b/src/declarative/qml/qdeclarativeexpression_p.h
index e52a199..91ac4c0 100644
--- a/src/declarative/qml/qmlexpression_p.h
+++ b/src/declarative/qml/qdeclarativeexpression_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLEXPRESSION_P_H
-#define QMLEXPRESSION_P_H
+#ifndef QDECLARATIVEEXPRESSION_P_H
+#define QDECLARATIVEEXPRESSION_P_H
//
// W A R N I N G
@@ -53,45 +53,45 @@
// We mean it.
//
-#include "qmlexpression.h"
+#include "qdeclarativeexpression.h"
-#include "qmlengine_p.h"
-#include "qmlguard_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativeguard_p.h"
#include <QtScript/qscriptvalue.h>
QT_BEGIN_NAMESPACE
-class QmlAbstractExpression
+class QDeclarativeAbstractExpression
{
public:
- QmlAbstractExpression();
- virtual ~QmlAbstractExpression();
+ QDeclarativeAbstractExpression();
+ virtual ~QDeclarativeAbstractExpression();
bool isValid() const;
- QmlContext *context() const;
- void setContext(QmlContext *);
+ QDeclarativeContext *context() const;
+ void setContext(QDeclarativeContext *);
virtual void refresh();
private:
- friend class QmlContext;
- friend class QmlContextPrivate;
- QmlContext *m_context;
- QmlAbstractExpression **m_prevExpression;
- QmlAbstractExpression *m_nextExpression;
+ friend class QDeclarativeContext;
+ friend class QDeclarativeContextPrivate;
+ QDeclarativeContext *m_context;
+ QDeclarativeAbstractExpression **m_prevExpression;
+ QDeclarativeAbstractExpression *m_nextExpression;
};
-class QmlDelayedError
+class QDeclarativeDelayedError
{
public:
- inline QmlDelayedError() : nextError(0), prevError(0) {}
- inline ~QmlDelayedError() { removeError(); }
+ inline QDeclarativeDelayedError() : nextError(0), prevError(0) {}
+ inline ~QDeclarativeDelayedError() { removeError(); }
- QmlError error;
+ QDeclarativeError error;
- bool addError(QmlEnginePrivate *);
+ bool addError(QDeclarativeEnginePrivate *);
inline void removeError() {
if (!prevError) return;
@@ -102,19 +102,19 @@ public:
}
private:
- QmlDelayedError *nextError;
- QmlDelayedError **prevError;
+ QDeclarativeDelayedError *nextError;
+ QDeclarativeDelayedError **prevError;
};
-class QmlExpressionData : public QmlAbstractExpression, public QmlDelayedError, public QmlRefCount
+class QDeclarativeExpressionData : public QDeclarativeAbstractExpression, public QDeclarativeDelayedError, public QDeclarativeRefCount
{
public:
- QmlExpressionData();
- virtual ~QmlExpressionData();
+ QDeclarativeExpressionData();
+ virtual ~QDeclarativeExpressionData();
- QmlExpressionPrivate *q;
+ QDeclarativeExpressionPrivate *q;
- QmlRefCount *dataRef;
+ QDeclarativeRefCount *dataRef;
QString expression;
bool expressionFunctionValid:1;
bool expressionRewritten:1;
@@ -128,15 +128,15 @@ public:
QString url; // This is a QString for a reason. QUrls are slooooooow...
int line;
- struct SignalGuard : public QmlGuard<QObject> {
+ struct SignalGuard : public QDeclarativeGuard<QObject> {
SignalGuard() : isDuplicate(false), notifyIndex(-1) {}
SignalGuard &operator=(QObject *obj) {
- QmlGuard<QObject>::operator=(obj);
+ QDeclarativeGuard<QObject>::operator=(obj);
return *this;
}
SignalGuard &operator=(const SignalGuard &o) {
- QmlGuard<QObject>::operator=(o);
+ QDeclarativeGuard<QObject>::operator=(o);
isDuplicate = o.isDuplicate;
notifyIndex = o.notifyIndex;
return *this;
@@ -149,39 +149,41 @@ public:
int guardListLength;
};
-class QmlExpression;
+class QDeclarativeExpression;
class QString;
-class QmlExpressionPrivate : public QObjectPrivate
+class QDeclarativeExpressionPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlExpression)
+ Q_DECLARE_PUBLIC(QDeclarativeExpression)
public:
- QmlExpressionPrivate();
- QmlExpressionPrivate(QmlExpressionData *);
- ~QmlExpressionPrivate();
+ QDeclarativeExpressionPrivate();
+ QDeclarativeExpressionPrivate(QDeclarativeExpressionData *);
+ ~QDeclarativeExpressionPrivate();
- void init(QmlContext *, const QString &, QObject *);
- void init(QmlContext *, void *, QmlRefCount *, QObject *, const QString &, int);
+ void init(QDeclarativeContext *, const QString &, QObject *);
+ void init(QDeclarativeContext *, void *, QDeclarativeRefCount *, QObject *, const QString &, int);
- QmlExpressionData *data;
+ QDeclarativeExpressionData *data;
QVariant value(QObject *secondaryScope = 0, bool *isUndefined = 0);
QVariant evalQtScript(QObject *secondaryScope, bool *isUndefined = 0);
- void updateGuards(const QPODVector<QmlEnginePrivate::CapturedProperty> &properties);
+ void updateGuards(const QPODVector<QDeclarativeEnginePrivate::CapturedProperty> &properties);
void clearGuards();
- static QmlExpressionPrivate *get(QmlExpression *expr) {
- return static_cast<QmlExpressionPrivate *>(QObjectPrivate::get(expr));
+ static QDeclarativeExpressionPrivate *get(QDeclarativeExpression *expr) {
+ return static_cast<QDeclarativeExpressionPrivate *>(QObjectPrivate::get(expr));
}
- static QmlExpression *get(QmlExpressionPrivate *expr) {
+ static QDeclarativeExpression *get(QDeclarativeExpressionPrivate *expr) {
return expr->q_func();
}
- static void exceptionToError(QScriptEngine *, QmlError &);
- static QScriptValue evalInObjectScope(QmlContext *, QObject *, const QString &);
- static QScriptValue evalInObjectScope(QmlContext *, QObject *, const QScriptProgram &);
+ virtual void emitValueChanged();
+
+ static void exceptionToError(QScriptEngine *, QDeclarativeError &);
+ static QScriptValue evalInObjectScope(QDeclarativeContext *, QObject *, const QString &);
+ static QScriptValue evalInObjectScope(QDeclarativeContext *, QObject *, const QScriptProgram &);
};
QT_END_NAMESPACE
-#endif // QMLEXPRESSION_P_H
+#endif // QDECLARATIVEEXPRESSION_P_H
diff --git a/src/declarative/qml/qdeclarativeextensioninterface.h b/src/declarative/qml/qdeclarativeextensioninterface.h
new file mode 100644
index 0000000..0fabd6d
--- /dev/null
+++ b/src/declarative/qml/qdeclarativeextensioninterface.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVEEXTENSIONINTERFACE_H
+#define QDECLARATIVEEXTENSIONINTERFACE_H
+
+#include <QtCore/qobject.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class QDeclarativeEngine;
+
+struct Q_DECLARATIVE_EXPORT QDeclarativeExtensionInterface
+{
+ virtual ~QDeclarativeExtensionInterface() {}
+ virtual void registerTypes(const char *uri) = 0;
+ virtual void initializeEngine(QDeclarativeEngine *engine, const char *uri) = 0;
+};
+
+Q_DECLARE_INTERFACE(QDeclarativeExtensionInterface, "com.trolltech.Qt.QDeclarativeExtensionInterface/1.0")
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QDECLARATIVEEXTENSIONINTERFACE_H
diff --git a/src/declarative/qml/qdeclarativeextensionplugin.cpp b/src/declarative/qml/qdeclarativeextensionplugin.cpp
new file mode 100644
index 0000000..3d44d63
--- /dev/null
+++ b/src/declarative/qml/qdeclarativeextensionplugin.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 "qdeclarativeextensionplugin.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \since 4.7
+ \class QDeclarativeExtensionPlugin
+ \brief The QDeclarativeExtensionPlugin class provides an abstract base for custom QML extension plugins.
+
+ \ingroup plugins
+
+ QDeclarativeExtensionPlugin is a plugin interface that makes it
+ possible to offer extensions that can be loaded dynamically into
+ applications using the QDeclarativeEngine class.
+
+ Writing a QML extension plugin is achieved by subclassing this
+ base class, reimplementing the pure virtual initialize()
+ function, and exporting the class using the Q_EXPORT_PLUGIN2()
+ macro. See \l {How to Create Qt Plugins} for details.
+
+ \sa QDeclarativeEngine::importExtension()
+*/
+
+/*!
+ \fn void QDeclarativeExtensionPlugin::registerTypes(const char *uri)
+
+ Registers the QML types in the given \a uri.
+*/
+
+/*!
+ Constructs a QML extension plugin with the given \a parent.
+
+ Note that this constructor is invoked automatically by the
+ Q_EXPORT_PLUGIN2() macro, so there is no need for calling it
+ explicitly.
+*/
+QDeclarativeExtensionPlugin::QDeclarativeExtensionPlugin(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QDeclarativeExtensionPlugin::~QDeclarativeExtensionPlugin()
+{
+}
+
+/*!
+ \fn void QDeclarativeExtensionPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
+
+ Initializes the extension specified in the given \a engine.
+*/
+
+void QDeclarativeExtensionPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
+{
+ Q_UNUSED(engine);
+ Q_UNUSED(uri);
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeextensionplugin.h b/src/declarative/qml/qdeclarativeextensionplugin.h
new file mode 100644
index 0000000..c2ad798
--- /dev/null
+++ b/src/declarative/qml/qdeclarativeextensionplugin.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVEEXTENSIONPLUGIN_H
+#define QDECLARATIVEEXTENSIONPLUGIN_H
+
+#include <QtCore/qplugin.h>
+
+#include "qdeclarativeextensioninterface.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class QDeclarativeEngine;
+
+class Q_DECLARATIVE_EXPORT QDeclarativeExtensionPlugin : public QObject, public QDeclarativeExtensionInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDeclarativeExtensionInterface)
+public:
+ explicit QDeclarativeExtensionPlugin(QObject *parent = 0);
+ ~QDeclarativeExtensionPlugin();
+
+ virtual void registerTypes(const char *uri) = 0;
+ virtual void initializeEngine(QDeclarativeEngine *engine, const char *uri);
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QDECLARATIVEEXTENSIONPLUGIN_H
diff --git a/src/declarative/qml/qmlglobal_p.h b/src/declarative/qml/qdeclarativeglobal_p.h
index 06ae6e6..bbdc91c 100644
--- a/src/declarative/qml/qmlglobal_p.h
+++ b/src/declarative/qml/qdeclarativeglobal_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGLOBAL_H
-#define QMLGLOBAL_H
+#ifndef QDECLARATIVEGLOBAL_H
+#define QDECLARATIVEGLOBAL_H
#include <QtCore/qglobal.h>
#include <QtCore/QObject>
@@ -64,7 +64,7 @@ QT_MODULE(Declarative)
return status == Yes; \
}
-struct QmlGraphics_DerivedObject : public QObject
+struct QDeclarativeGraphics_DerivedObject : public QObject
{
void setParent_noEvent(QObject *parent) {
bool sce = d_ptr->sendChildEvents;
@@ -79,13 +79,13 @@ struct QmlGraphics_DerivedObject : public QObject
neither \a parent nor the object's previous parent (if it had one) will
receive ChildRemoved or ChildAdded events.
*/
-inline void QmlGraphics_setParent_noEvent(QObject *object, QObject *parent)
+inline void QDeclarativeGraphics_setParent_noEvent(QObject *object, QObject *parent)
{
- static_cast<QmlGraphics_DerivedObject *>(object)->setParent_noEvent(parent);
+ static_cast<QDeclarativeGraphics_DerivedObject *>(object)->setParent_noEvent(parent);
}
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLGLOBAL_H
+#endif // QDECLARATIVEGLOBAL_H
diff --git a/src/declarative/qml/qmlglobalscriptclass.cpp b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
index d2198b6..5b06b42 100644
--- a/src/declarative/qml/qmlglobalscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmlglobalscriptclass_p.h"
+#include "qdeclarativeglobalscriptclass_p.h"
#include <QtScript/qscriptstring.h>
#include <QtScript/qscriptengine.h>
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
/*
Used to prevent any writes to the global object.
*/
-QmlGlobalScriptClass::QmlGlobalScriptClass(QScriptEngine *engine)
+QDeclarativeGlobalScriptClass::QDeclarativeGlobalScriptClass(QScriptEngine *engine)
: QScriptClass(engine)
{
QScriptValue v = engine->newObject();
@@ -67,7 +67,7 @@ QmlGlobalScriptClass::QmlGlobalScriptClass(QScriptEngine *engine)
}
QScriptClass::QueryFlags
-QmlGlobalScriptClass::queryProperty(const QScriptValue &object,
+QDeclarativeGlobalScriptClass::queryProperty(const QScriptValue &object,
const QScriptString &name,
QueryFlags flags, uint *id)
{
@@ -79,7 +79,7 @@ QmlGlobalScriptClass::queryProperty(const QScriptValue &object,
}
QScriptValue
-QmlGlobalScriptClass::property(const QScriptValue &object,
+QDeclarativeGlobalScriptClass::property(const QScriptValue &object,
const QScriptString &name,
uint id)
{
@@ -89,7 +89,7 @@ QmlGlobalScriptClass::property(const QScriptValue &object,
return engine()->undefinedValue();
}
-void QmlGlobalScriptClass::setProperty(QScriptValue &object,
+void QDeclarativeGlobalScriptClass::setProperty(QScriptValue &object,
const QScriptString &name,
uint id, const QScriptValue &value)
{
@@ -101,7 +101,7 @@ void QmlGlobalScriptClass::setProperty(QScriptValue &object,
engine()->currentContext()->throwError(error);
}
-void QmlGlobalScriptClass::explicitSetProperty(const QString &name, const QScriptValue &value)
+void QDeclarativeGlobalScriptClass::explicitSetProperty(const QString &name, const QScriptValue &value)
{
QScriptValue v = engine()->newObject();
globalObject = engine()->globalObject();
diff --git a/src/declarative/qml/qmlglobalscriptclass_p.h b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h
index d002da6..a33cf5e 100644
--- a/src/declarative/qml/qmlglobalscriptclass_p.h
+++ b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGLOBALSCRIPTCLASS_P_H
-#define QMLGLOBALSCRIPTCLASS_P_H
+#ifndef QDECLARATIVEGLOBALSCRIPTCLASS_P_H
+#define QDECLARATIVEGLOBALSCRIPTCLASS_P_H
//
// W A R N I N G
@@ -57,10 +57,10 @@
QT_BEGIN_NAMESPACE
-class Q_AUTOTEST_EXPORT QmlGlobalScriptClass : public QScriptClass
+class Q_AUTOTEST_EXPORT QDeclarativeGlobalScriptClass : public QScriptClass
{
public:
- QmlGlobalScriptClass(QScriptEngine *);
+ QDeclarativeGlobalScriptClass(QScriptEngine *);
virtual QueryFlags queryProperty(const QScriptValue &object,
const QScriptString &name,
@@ -80,4 +80,4 @@ private:
QT_END_NAMESPACE
-#endif // QMLGLOBALSCRIPTCLASS_P_H
+#endif // QDECLARATIVEGLOBALSCRIPTCLASS_P_H
diff --git a/src/declarative/qml/qmlguard_p.h b/src/declarative/qml/qdeclarativeguard_p.h
index 0e90f79..0861e9a 100644
--- a/src/declarative/qml/qmlguard_p.h
+++ b/src/declarative/qml/qdeclarativeguard_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGUARD_P_H
-#define QMLGUARD_P_H
+#ifndef QDECLARATIVEGUARD_P_H
+#define QDECLARATIVEGUARD_P_H
//
// W A R N I N G
@@ -54,25 +54,26 @@
//
#include <QtCore/qglobal.h>
+#include <QtCore/qvariant.h>
QT_BEGIN_NAMESPACE
class QObject;
template<class T>
-class QmlGuard
+class QDeclarativeGuard
{
QObject *o;
- QmlGuard<QObject> *next;
- QmlGuard<QObject> **prev;
- friend class QmlDeclarativeData;
+ QDeclarativeGuard<QObject> *next;
+ QDeclarativeGuard<QObject> **prev;
+ friend class QDeclarativeDeclarativeData;
public:
- inline QmlGuard();
- inline QmlGuard(T *);
- inline QmlGuard(const QmlGuard<T> &);
- inline virtual ~QmlGuard();
+ inline QDeclarativeGuard();
+ inline QDeclarativeGuard(T *);
+ inline QDeclarativeGuard(const QDeclarativeGuard<T> &);
+ inline virtual ~QDeclarativeGuard();
- inline QmlGuard<T> &operator=(const QmlGuard<T> &o);
- inline QmlGuard<T> &operator=(T *);
+ inline QDeclarativeGuard<T> &operator=(const QDeclarativeGuard<T> &o);
+ inline QDeclarativeGuard<T> &operator=(T *);
inline bool isNull() const
{ return !o; }
@@ -96,41 +97,41 @@ private:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QmlGuard<QObject>);
+Q_DECLARE_METATYPE(QDeclarativeGuard<QObject>);
-#include "qmldeclarativedata_p.h"
+#include "qdeclarativedeclarativedata_p.h"
QT_BEGIN_NAMESPACE
template<class T>
-QmlGuard<T>::QmlGuard()
+QDeclarativeGuard<T>::QDeclarativeGuard()
: o(0), next(0), prev(0)
{
}
template<class T>
-QmlGuard<T>::QmlGuard(T *g)
+QDeclarativeGuard<T>::QDeclarativeGuard(T *g)
: o(g), next(0), prev(0)
{
if (o) addGuard();
}
template<class T>
-QmlGuard<T>::QmlGuard(const QmlGuard<T> &g)
+QDeclarativeGuard<T>::QDeclarativeGuard(const QDeclarativeGuard<T> &g)
: o(g.o), next(0), prev(0)
{
if (o) addGuard();
}
template<class T>
-QmlGuard<T>::~QmlGuard()
+QDeclarativeGuard<T>::~QDeclarativeGuard()
{
if (prev) remGuard();
o = 0;
}
template<class T>
-QmlGuard<T> &QmlGuard<T>::operator=(const QmlGuard<T> &g)
+QDeclarativeGuard<T> &QDeclarativeGuard<T>::operator=(const QDeclarativeGuard<T> &g)
{
if (g.o != o) {
if (prev) remGuard();
@@ -141,7 +142,7 @@ QmlGuard<T> &QmlGuard<T>::operator=(const QmlGuard<T> &g)
}
template<class T>
-QmlGuard<T> &QmlGuard<T>::operator=(T *g)
+QDeclarativeGuard<T> &QDeclarativeGuard<T>::operator=(T *g)
{
if (g != o) {
if (prev) remGuard();
@@ -153,4 +154,4 @@ QmlGuard<T> &QmlGuard<T>::operator=(T *g)
QT_END_NAMESPACE
-#endif // QMLGUARD_P_H
+#endif // QDECLARATIVEGUARD_P_H
diff --git a/src/declarative/qml/qmlimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp
index 7f15d08..daa2e87 100644
--- a/src/declarative/qml/qmlimageprovider.cpp
+++ b/src/declarative/qml/qdeclarativeimageprovider.cpp
@@ -39,25 +39,25 @@
**
****************************************************************************/
-#include "qmlimageprovider.h"
+#include "qdeclarativeimageprovider.h"
QT_BEGIN_NAMESPACE
/*!
- \class QmlImageProvider
- \brief The QmlImageProvider class provides an interface for threaded image requests.
+ \class QDeclarativeImageProvider
+ \brief The QDeclarativeImageProvider class provides an interface for threaded image requests.
Note: the request() method may be called by multiple threads, so ensure the
implementation of this method is reentrant.
- \sa QmlEngine::addImageProvider()
+ \sa QDeclarativeEngine::addImageProvider()
*/
-QmlImageProvider::~QmlImageProvider()
+QDeclarativeImageProvider::~QDeclarativeImageProvider()
{
}
/*!
- \fn QImage QmlImageProvider::request(const QString &id)
+ \fn QImage QDeclarativeImageProvider::request(const QString &id)
Implement this method to return the image with \a id.
diff --git a/src/declarative/qml/qmlimageprovider.h b/src/declarative/qml/qdeclarativeimageprovider.h
index 52fe066..6ee7bcf 100644
--- a/src/declarative/qml/qmlimageprovider.h
+++ b/src/declarative/qml/qdeclarativeimageprovider.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLIMAGEPROVIDER_H
-#define QMLIMAGEPROVIDER_H
+#ifndef QDECLARATIVEIMAGEPROVIDER_H
+#define QDECLARATIVEIMAGEPROVIDER_H
#include <QtGui/qimage.h>
@@ -50,10 +50,10 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class Q_DECLARATIVE_EXPORT QmlImageProvider
+class Q_DECLARATIVE_EXPORT QDeclarativeImageProvider
{
public:
- virtual ~QmlImageProvider();
+ virtual ~QDeclarativeImageProvider();
virtual QImage request(const QString &id) = 0;
};
@@ -61,4 +61,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLIMAGEPROVIDER
+#endif // QDECLARATIVEIMAGEPROVIDER
diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qdeclarativeinfo.cpp
index 1f3d434..7dc61fd 100644
--- a/src/declarative/qml/qmlinfo.cpp
+++ b/src/declarative/qml/qdeclarativeinfo.cpp
@@ -39,18 +39,18 @@
**
****************************************************************************/
-#include "qmlinfo.h"
+#include "qdeclarativeinfo.h"
-#include "qmldeclarativedata_p.h"
-#include "qmlcontext.h"
-#include "qmlmetatype.h"
+#include "qdeclarativedeclarativedata_p.h"
+#include "qdeclarativecontext.h"
+#include "qdeclarativemetatype_p.h"
#include <QCoreApplication>
QT_BEGIN_NAMESPACE
/*!
- \fn QmlInfo qmlInfo(const QObject *object)
+ \fn QDeclarativeInfo qmlInfo(const QObject *object)
\brief Prints warnings messages that include the file and line number for QML types.
@@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE
\endcode
*/
-QmlInfo::QmlInfo(const QObject *object)
+QDeclarativeInfo::QDeclarativeInfo(const QObject *object)
: QDebug(QtWarningMsg)
{
QString pos = QLatin1String("QML");
@@ -84,7 +84,7 @@ QmlInfo::QmlInfo(const QObject *object)
pos += QLatin1Char(' ');
QString typeName;
- QmlType *type = QmlMetaType::qmlType(object->metaObject());
+ QDeclarativeType *type = QDeclarativeMetaType::qmlType(object->metaObject());
if (type) {
typeName = QLatin1String(type->qmlTypeName());
int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
@@ -99,7 +99,7 @@ QmlInfo::QmlInfo(const QObject *object)
pos += typeName;
}
- QmlDeclarativeData *ddata = object?QmlDeclarativeData::get(object):0;
+ QDeclarativeDeclarativeData *ddata = object?QDeclarativeDeclarativeData::get(object):0;
pos += QLatin1String(" (");
if (ddata) {
if (ddata->outerContext) {
@@ -109,17 +109,17 @@ QmlInfo::QmlInfo(const QObject *object)
pos += QLatin1Char(':');
pos += QString::number(ddata->columnNumber);
} else {
- pos += QCoreApplication::translate("QmlInfo","unknown location");
+ pos += QCoreApplication::translate("QDeclarativeInfo","unknown location");
}
} else {
- pos += QCoreApplication::translate("QmlInfo","unknown location");
+ pos += QCoreApplication::translate("QDeclarativeInfo","unknown location");
}
pos += QLatin1Char(')');
*this << pos;
nospace();
}
-QmlInfo::~QmlInfo()
+QDeclarativeInfo::~QDeclarativeInfo()
{
}
diff --git a/src/declarative/qml/qdeclarativeinfo.h b/src/declarative/qml/qdeclarativeinfo.h
new file mode 100644
index 0000000..8f69f73
--- /dev/null
+++ b/src/declarative/qml/qdeclarativeinfo.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVEINFO_H
+#define QDECLARATIVEINFO_H
+
+#include <QtCore/qdebug.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class Q_DECLARATIVE_EXPORT QDeclarativeInfo : public QDebug
+{
+public:
+ QDeclarativeInfo(const QObject *);
+ ~QDeclarativeInfo();
+
+ inline QDeclarativeInfo &operator<<(QChar t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(QBool t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(bool t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(char t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(signed short t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(unsigned short t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(signed int t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(unsigned int t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(signed long t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(unsigned long t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(qint64 t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(quint64 t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(float t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(double t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(const char* t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(const QString & t) { QDebug::operator<<(t.toLocal8Bit().constData()); return *this; }
+ inline QDeclarativeInfo &operator<<(const QStringRef & t) { return operator<<(t.toString()); }
+ inline QDeclarativeInfo &operator<<(const QLatin1String &t) { QDebug::operator<<(t.latin1()); return *this; }
+ inline QDeclarativeInfo &operator<<(const QByteArray & t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(const void * t) { QDebug::operator<<(t); return *this; }
+ inline QDeclarativeInfo &operator<<(QTextStreamFunction f) { QDebug::operator<<(f); return *this; }
+ inline QDeclarativeInfo &operator<<(QTextStreamManipulator m) { QDebug::operator<<(m); return *this; }
+};
+
+Q_DECLARATIVE_EXPORT inline QDeclarativeInfo qmlInfo(const QObject *me)
+{
+ return QDeclarativeInfo(me);
+}
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QDECLARATIVEINFO_H
diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp
index e37ade7..cf485fe 100644
--- a/src/declarative/qml/qmlinstruction.cpp
+++ b/src/declarative/qml/qdeclarativeinstruction.cpp
@@ -39,15 +39,15 @@
**
****************************************************************************/
-#include "qmlinstruction_p.h"
+#include "qdeclarativeinstruction_p.h"
-#include "qmlcompiler_p.h"
+#include "qdeclarativecompiler_p.h"
#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
-void QmlCompiledData::dump(QmlInstruction *instr, int idx)
+void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
{
QByteArray lineNumber = QByteArray::number(instr->line);
if (instr->line == (unsigned short)-1)
@@ -55,150 +55,150 @@ void QmlCompiledData::dump(QmlInstruction *instr, int idx)
const char *line = lineNumber.constData();
switch(instr->type) {
- case QmlInstruction::Init:
+ case QDeclarativeInstruction::Init:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "INIT\t\t\t" << instr->init.bindingsSize << "\t" << instr->init.parserStatusSize << "\t" << instr->init.contextCache << "\t" << instr->init.compiledBinding;
break;
- case QmlInstruction::CreateObject:
+ case QDeclarativeInstruction::CreateObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE\t\t\t" << instr->create.type << "\t\t\t" << types.at(instr->create.type).className;
break;
- case QmlInstruction::SetId:
+ case QDeclarativeInstruction::SetId:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "SETID\t\t\t" << instr->setId.value << "\t\t\t" << primitives.at(instr->setId.value);
break;
- case QmlInstruction::SetDefault:
+ case QDeclarativeInstruction::SetDefault:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "SET_DEFAULT";
break;
- case QmlInstruction::CreateComponent:
+ case QDeclarativeInstruction::CreateComponent:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE_COMPONENT\t" << instr->createComponent.count;
break;
- case QmlInstruction::StoreMetaObject:
+ case QDeclarativeInstruction::StoreMetaObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_META\t\t" << instr->storeMeta.data;
break;
- case QmlInstruction::StoreFloat:
+ case QDeclarativeInstruction::StoreFloat:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_FLOAT\t\t" << instr->storeFloat.propertyIndex << "\t" << instr->storeFloat.value;
break;
- case QmlInstruction::StoreDouble:
+ case QDeclarativeInstruction::StoreDouble:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value;
break;
- case QmlInstruction::StoreInteger:
+ case QDeclarativeInstruction::StoreInteger:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_INTEGER\t\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value;
break;
- case QmlInstruction::StoreBool:
+ case QDeclarativeInstruction::StoreBool:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value;
break;
- case QmlInstruction::StoreString:
+ case QDeclarativeInstruction::StoreString:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_STRING\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value);
break;
- case QmlInstruction::StoreUrl:
+ case QDeclarativeInstruction::StoreUrl:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_URL\t\t" << instr->storeUrl.propertyIndex << "\t" << instr->storeUrl.value << "\t\t" << primitives.at(instr->storeUrl.value);
break;
- case QmlInstruction::StoreColor:
+ case QDeclarativeInstruction::StoreColor:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_COLOR\t\t" << instr->storeColor.propertyIndex << "\t\t\t" << QString::number(instr->storeColor.value, 16);
break;
- case QmlInstruction::StoreDate:
+ case QDeclarativeInstruction::StoreDate:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DATE\t\t" << instr->storeDate.propertyIndex << "\t" << instr->storeDate.value;
break;
- case QmlInstruction::StoreTime:
+ case QDeclarativeInstruction::StoreTime:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_TIME\t\t" << instr->storeTime.propertyIndex << "\t" << instr->storeTime.valueIndex;
break;
- case QmlInstruction::StoreDateTime:
+ case QDeclarativeInstruction::StoreDateTime:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DATETIME\t\t" << instr->storeDateTime.propertyIndex << "\t" << instr->storeDateTime.valueIndex;
break;
- case QmlInstruction::StorePoint:
+ case QDeclarativeInstruction::StorePoint:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_POINT\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
break;
- case QmlInstruction::StorePointF:
+ case QDeclarativeInstruction::StorePointF:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_POINTF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
break;
- case QmlInstruction::StoreSize:
+ case QDeclarativeInstruction::StoreSize:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIZE\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
break;
- case QmlInstruction::StoreSizeF:
+ case QDeclarativeInstruction::StoreSizeF:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIZEF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
break;
- case QmlInstruction::StoreRect:
+ case QDeclarativeInstruction::StoreRect:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_RECT\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex;
break;
- case QmlInstruction::StoreRectF:
+ case QDeclarativeInstruction::StoreRectF:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_RECTF\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex;
break;
- case QmlInstruction::StoreVector3D:
+ case QDeclarativeInstruction::StoreVector3D:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VECTOR3D\t\t" << instr->storeVector3D.propertyIndex << "\t" << instr->storeVector3D.valueIndex;
break;
- case QmlInstruction::StoreVariant:
+ case QDeclarativeInstruction::StoreVariant:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value);
break;
- case QmlInstruction::StoreObject:
+ case QDeclarativeInstruction::StoreObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT\t\t" << instr->storeObject.propertyIndex;
break;
- case QmlInstruction::StoreVariantObject:
+ case QDeclarativeInstruction::StoreVariantObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_OBJECT\t" << instr->storeObject.propertyIndex;
break;
- case QmlInstruction::StoreInterface:
+ case QDeclarativeInstruction::StoreInterface:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_INTERFACE\t\t" << instr->storeObject.propertyIndex;
break;
- case QmlInstruction::StoreSignal:
+ case QDeclarativeInstruction::StoreSignal:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value << "\t\t" << primitives.at(instr->storeSignal.value);
break;
- case QmlInstruction::StoreScript:
+ case QDeclarativeInstruction::StoreScript:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SCRIPT\t\t" << instr->storeScript.value;
break;
- case QmlInstruction::StoreScriptString:
+ case QDeclarativeInstruction::StoreScriptString:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SCRIPT_STRING\t" << instr->storeScriptString.propertyIndex << "\t" << instr->storeScriptString.value << "\t" << instr->storeScriptString.scope;
break;
- case QmlInstruction::AssignSignalObject:
+ case QDeclarativeInstruction::AssignSignalObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal << "\t\t\t" << datas.at(instr->assignSignalObject.signal);
break;
- case QmlInstruction::AssignCustomType:
+ case QDeclarativeInstruction::AssignCustomType:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_CUSTOMTYPE\t" << instr->assignCustomType.propertyIndex << "\t" << instr->assignCustomType.valueIndex;
break;
- case QmlInstruction::StoreBinding:
+ case QDeclarativeInstruction::StoreBinding:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
break;
- case QmlInstruction::StoreCompiledBinding:
+ case QDeclarativeInstruction::StoreCompiledBinding:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_COMPILED_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
break;
- case QmlInstruction::StoreValueSource:
+ case QDeclarativeInstruction::StoreValueSource:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VALUE_SOURCE\t" << instr->assignValueSource.property << "\t" << instr->assignValueSource.castValue;
break;
- case QmlInstruction::StoreValueInterceptor:
+ case QDeclarativeInstruction::StoreValueInterceptor:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VALUE_INTERCEPTOR\t" << instr->assignValueInterceptor.property << "\t" << instr->assignValueInterceptor.castValue;
break;
- case QmlInstruction::BeginObject:
+ case QDeclarativeInstruction::BeginObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "BEGIN\t\t\t" << instr->begin.castValue;
break;
- case QmlInstruction::StoreObjectQList:
+ case QDeclarativeInstruction::StoreObjectQList:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT_QLIST";
break;
- case QmlInstruction::AssignObjectList:
+ case QDeclarativeInstruction::AssignObjectList:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_OBJECT_LIST";
break;
- case QmlInstruction::FetchAttached:
+ case QDeclarativeInstruction::FetchAttached:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_ATTACHED\t\t" << instr->fetchAttached.id;
break;
- case QmlInstruction::FetchQList:
+ case QDeclarativeInstruction::FetchQList:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_QLIST\t\t" << instr->fetch.property;
break;
- case QmlInstruction::FetchObject:
+ case QDeclarativeInstruction::FetchObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH\t\t\t" << instr->fetch.property;
break;
- case QmlInstruction::FetchValueType:
+ case QDeclarativeInstruction::FetchValueType:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type;
break;
- case QmlInstruction::PopFetchedObject:
+ case QDeclarativeInstruction::PopFetchedObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP";
break;
- case QmlInstruction::PopQList:
+ case QDeclarativeInstruction::PopQList:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP_QLIST";
break;
- case QmlInstruction::PopValueType:
+ case QDeclarativeInstruction::PopValueType:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type;
break;
- case QmlInstruction::Defer:
+ case QDeclarativeInstruction::Defer:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "DEFER" << "\t\t\t" << instr->defer.deferCount;
break;
default:
diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h
index ea785b6..d8af6a7 100644
--- a/src/declarative/qml/qmlinstruction_p.h
+++ b/src/declarative/qml/qdeclarativeinstruction_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLINSTRUCTION_P_H
-#define QMLINSTRUCTION_P_H
+#ifndef QDECLARATIVEINSTRUCTION_P_H
+#define QDECLARATIVEINSTRUCTION_P_H
//
// W A R N I N G
@@ -57,8 +57,8 @@
QT_BEGIN_NAMESPACE
-class QmlCompiledData;
-class Q_DECLARATIVE_EXPORT QmlInstruction
+class QDeclarativeCompiledData;
+class Q_DECLARATIVE_EXPORT QDeclarativeInstruction
{
public:
enum Type {
@@ -156,7 +156,7 @@ public:
//
Defer, /* defer */
};
- QmlInstruction()
+ QDeclarativeInstruction()
: line(0) {}
Type type;
@@ -311,9 +311,9 @@ public:
} defer;
};
- void dump(QmlCompiledData *);
+ void dump(QDeclarativeCompiledData *);
};
QT_END_NAMESPACE
-#endif // QMLINSTRUCTION_P_H
+#endif // QDECLARATIVEINSTRUCTION_P_H
diff --git a/src/declarative/qml/qmlintegercache.cpp b/src/declarative/qml/qdeclarativeintegercache.cpp
index 2c2d494..8fa210f 100644
--- a/src/declarative/qml/qmlintegercache.cpp
+++ b/src/declarative/qml/qdeclarativeintegercache.cpp
@@ -39,24 +39,24 @@
**
****************************************************************************/
-#include "qmlintegercache_p.h"
+#include "qdeclarativeintegercache_p.h"
-#include "qmlengine_p.h"
-#include "qmlmetatype.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativemetatype_p.h"
QT_BEGIN_NAMESPACE
-QmlIntegerCache::QmlIntegerCache(QmlEngine *e)
-: QmlCleanup(e), engine(e)
+QDeclarativeIntegerCache::QDeclarativeIntegerCache(QDeclarativeEngine *e)
+: QDeclarativeCleanup(e), engine(e)
{
}
-QmlIntegerCache::~QmlIntegerCache()
+QDeclarativeIntegerCache::~QDeclarativeIntegerCache()
{
clear();
}
-void QmlIntegerCache::clear()
+void QDeclarativeIntegerCache::clear()
{
qDeleteAll(stringCache);
stringCache.clear();
@@ -64,11 +64,11 @@ void QmlIntegerCache::clear()
engine = 0;
}
-void QmlIntegerCache::add(const QString &id, int value)
+void QDeclarativeIntegerCache::add(const QString &id, int value)
{
Q_ASSERT(!stringCache.contains(id));
- QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine);
// ### use contextClass
Data *d = new Data(enginePriv->objectClass->createPersistentIdentifier(id), value);
@@ -77,7 +77,7 @@ void QmlIntegerCache::add(const QString &id, int value)
identifierCache.insert(d->identifier, d);
}
-int QmlIntegerCache::value(const QString &id)
+int QDeclarativeIntegerCache::value(const QString &id)
{
Data *d = stringCache.value(id);
return d?d->value:-1;
diff --git a/src/declarative/qml/qmlintegercache_p.h b/src/declarative/qml/qdeclarativeintegercache_p.h
index f38138f..b57565e 100644
--- a/src/declarative/qml/qmlintegercache_p.h
+++ b/src/declarative/qml/qdeclarativeintegercache_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLINTEGERCACHE_P_H
-#define QMLINTEGERCACHE_P_H
+#ifndef QDECLARATIVEINTEGERCACHE_P_H
+#define QDECLARATIVEINTEGERCACHE_P_H
//
// W A R N I N G
@@ -53,8 +53,8 @@
// We mean it.
//
-#include "qmlrefcount_p.h"
-#include "qmlcleanup_p.h"
+#include "qdeclarativerefcount_p.h"
+#include "qdeclarativecleanup_p.h"
#include <QtCore/qhash.h>
@@ -62,13 +62,13 @@
QT_BEGIN_NAMESPACE
-class QmlType;
-class QmlEngine;
-class QmlIntegerCache : public QmlRefCount, public QmlCleanup
+class QDeclarativeType;
+class QDeclarativeEngine;
+class QDeclarativeIntegerCache : public QDeclarativeRefCount, public QDeclarativeCleanup
{
public:
- QmlIntegerCache(QmlEngine *);
- virtual ~QmlIntegerCache();
+ QDeclarativeIntegerCache(QDeclarativeEngine *);
+ virtual ~QDeclarativeIntegerCache();
inline int count() const;
void add(const QString &, int);
@@ -91,21 +91,21 @@ private:
StringCache stringCache;
IdentifierCache identifierCache;
- QmlEngine *engine;
+ QDeclarativeEngine *engine;
};
-int QmlIntegerCache::value(const QScriptDeclarativeClass::Identifier &id) const
+int QDeclarativeIntegerCache::value(const QScriptDeclarativeClass::Identifier &id) const
{
Data *d = identifierCache.value(id);
return d?d->value:-1;
}
-int QmlIntegerCache::count() const
+int QDeclarativeIntegerCache::count() const
{
return stringCache.count();
}
QT_END_NAMESPACE
-#endif // QMLINTEGERCACHE_P_H
+#endif // QDECLARATIVEINTEGERCACHE_P_H
diff --git a/src/declarative/qml/qdeclarativelist.cpp b/src/declarative/qml/qdeclarativelist.cpp
new file mode 100644
index 0000000..9691f32
--- /dev/null
+++ b/src/declarative/qml/qdeclarativelist.cpp
@@ -0,0 +1,409 @@
+/****************************************************************************
+**
+** 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 "qdeclarativelist.h"
+#include "qdeclarativelist_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativeproperty_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QDeclarativeListReferencePrivate::QDeclarativeListReferencePrivate()
+: propertyType(-1), refCount(1)
+{
+}
+
+QDeclarativeListReference QDeclarativeListReferencePrivate::init(const QDeclarativeListProperty<QObject> &prop, int propType, QDeclarativeEngine *engine)
+{
+ QDeclarativeListReference rv;
+
+ if (!prop.object) return rv;
+
+ QDeclarativeEnginePrivate *p = engine?QDeclarativeEnginePrivate::get(engine):0;
+
+ int listType = p?p->listType(propType):QDeclarativeMetaType::listType(propType);
+ if (listType == -1) return rv;
+
+ rv.d = new QDeclarativeListReferencePrivate;
+ rv.d->object = prop.object;
+ rv.d->elementType = p?p->rawMetaObjectForType(listType):QDeclarativeMetaType::qmlType(listType)->baseMetaObject();
+ rv.d->property = prop;
+ rv.d->propertyType = propType;
+
+ return rv;
+}
+
+void QDeclarativeListReferencePrivate::addref()
+{
+ Q_ASSERT(refCount > 0);
+ ++refCount;
+}
+
+void QDeclarativeListReferencePrivate::release()
+{
+ Q_ASSERT(refCount > 0);
+ --refCount;
+ if (!refCount)
+ delete this;
+}
+
+/*!
+\class QDeclarativeListReference
+\brief The QDeclarativeListReference class allows the manipulation of QDeclarativeListProperty properties.
+
+QDeclarativeListReference allows programs to read from, and assign values to a QML list property in a
+simple and type safe way. A QDeclarativeListReference can be created by passing an object and property
+name or through a QDeclarativeProperty instance. These two are equivalant:
+
+\code
+QDeclarativeListReference ref1(object, "children");
+
+QDeclarativeProperty ref2(object, "children");
+QDeclarativeListReference ref2 = qvariant_cast<QDeclarativeListReference>(ref2.read());
+\endcode
+
+Not all QML list properties support all operations. A set of methods, canAppend(), canAt(), canClear() and
+canCount() allow programs to query whether an operation is supported on a given property.
+
+QML list properties are typesafe. Only QObject's that derive from the correct base class can be assigned to
+the list. The listElementType() method can be used to query the QMetaObject of the QObject type supported.
+Attempting to add objects of the incorrect type to a list property will fail.
+
+Like with normal lists, when accessing a list element by index, it is the callers responsibility to ensure
+that it does not request an out of range element using the count() method before calling at().
+*/
+
+/*!
+Constructs an invalid instance.
+*/
+QDeclarativeListReference::QDeclarativeListReference()
+: d(0)
+{
+}
+
+/*!
+Constructs a QDeclarativeListReference for \a object's \a property. If \a property is not a list
+property, an invalid QDeclarativeListReference is created. If \a object is destroyed after
+the reference is constructed, it will automatically become invalid. That is, it is safe to hold
+QDeclarativeListReference instances even after \a object is deleted.
+
+Passing \a engine is required to access some QML created list properties. If in doubt, and an engine
+is available, pass it.
+*/
+QDeclarativeListReference::QDeclarativeListReference(QObject *object, const char *property, QDeclarativeEngine *engine)
+: d(0)
+{
+ if (!object || !property) return;
+
+ QDeclarativePropertyCache::Data local;
+ QDeclarativePropertyCache::Data *data =
+ QDeclarativePropertyCache::property(engine, object, QLatin1String(property), local);
+
+ if (!data || !(data->flags & QDeclarativePropertyCache::Data::IsQList)) return;
+
+ QDeclarativeEnginePrivate *p = engine?QDeclarativeEnginePrivate::get(engine):0;
+
+ int listType = p?p->listType(data->propType):QDeclarativeMetaType::listType(data->propType);
+ if (listType == -1) return;
+
+ d = new QDeclarativeListReferencePrivate;
+ d->object = object;
+ d->elementType = p?p->rawMetaObjectForType(listType):QDeclarativeMetaType::qmlType(listType)->baseMetaObject();
+ d->propertyType = data->propType;
+
+ void *args[] = { &d->property, 0 };
+ QMetaObject::metacall(object, QMetaObject::ReadProperty, data->coreIndex, args);
+}
+
+/*! \internal */
+QDeclarativeListReference::QDeclarativeListReference(const QDeclarativeListReference &o)
+: d(o.d)
+{
+ if (d) d->addref();
+}
+
+/*! \internal */
+QDeclarativeListReference &QDeclarativeListReference::operator=(const QDeclarativeListReference &o)
+{
+ if (o.d) o.d->addref();
+ if (d) d->release();
+ d = o.d;
+ return *this;
+}
+
+/*! \internal */
+QDeclarativeListReference::~QDeclarativeListReference()
+{
+ if (d) d->release();
+}
+
+/*!
+Returns true if the instance refers to a valid list property, otherwise false.
+*/
+bool QDeclarativeListReference::isValid() const
+{
+ return d && d->object;
+}
+
+/*!
+Returns the list property's object. Returns 0 if the reference is invalid.
+*/
+QObject *QDeclarativeListReference::object() const
+{
+ if (isValid()) return d->object;
+ else return 0;
+}
+
+/*!
+Returns the QMetaObject for the elements stored in the list property. Returns 0 if the reference
+is invalid.
+
+The QMetaObject can be used ahead of time to determine whether a given instance can be added
+to a list.
+*/
+const QMetaObject *QDeclarativeListReference::listElementType() const
+{
+ if (isValid()) return d->elementType;
+ else return 0;
+}
+
+/*!
+Returns true if the list property can be appended to, otherwise false. Returns false if the
+reference is invalid.
+
+\sa append()
+*/
+bool QDeclarativeListReference::canAppend() const
+{
+ return (isValid() && d->property.append);
+}
+
+/*!
+Returns true if the list property can queried by index, otherwise false. Returns false if the
+reference is invalid.
+
+\sa at()
+*/
+bool QDeclarativeListReference::canAt() const
+{
+ return (isValid() && d->property.at);
+}
+
+/*!
+Returns true if the list property can be cleared, otherwise false. Returns false if the
+reference is invalid.
+
+\sa clear()
+*/
+bool QDeclarativeListReference::canClear() const
+{
+ return (isValid() && d->property.clear);
+}
+
+/*!
+Returns true if the list property can be queried for its element count, otherwise false.
+Returns false if the reference is invalid.
+
+\sa count()
+*/
+bool QDeclarativeListReference::canCount() const
+{
+ return (isValid() && d->property.count);
+}
+
+/*!
+Appends \a object to the list. Returns true if the operation succeeded, otherwise false.
+
+\sa canAppend()
+*/
+bool QDeclarativeListReference::append(QObject *object) const
+{
+ if (!canAppend()) return false;
+
+ if (object && !QDeclarativePropertyPrivate::canConvert(object->metaObject(), d->elementType))
+ return false;
+
+ d->property.append(&d->property, object);
+
+ return true;
+}
+
+/*!
+Returns the list element at \a index, or 0 if the operation failed.
+
+\sa canAt()
+*/
+QObject *QDeclarativeListReference::at(int index) const
+{
+ if (!canAt()) return 0;
+
+ return d->property.at(&d->property, index);
+}
+
+/*!
+Clears the list. Returns true if the operation succeeded, otherwise false.
+
+\sa canClear()
+*/
+bool QDeclarativeListReference::clear() const
+{
+ if (!canClear()) return false;
+
+ d->property.clear(&d->property);
+
+ return true;
+}
+
+/*!
+Returns the number of objects in the list, or 0 if the operation failed.
+*/
+int QDeclarativeListReference::count() const
+{
+ if (!canCount()) return 0;
+
+ return d->property.count(&d->property);
+}
+
+/*!
+\class QDeclarativeListProperty
+\brief The QDeclarativeListProperty 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 QDeclarativeListProperty 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 QDeclarativeListProperty 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(QDeclarativeListProperty<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 QDeclarativeListProperty::QDeclarativeListProperty()
+\internal
+*/
+
+/*!
+\fn QDeclarativeListProperty::QDeclarativeListProperty(QObject *object, QList<T *> &list)
+
+Convenience constructor for making a QDeclarativeListProperty 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 QDeclarativeListProperty::QDeclarativeListProperty(QObject *object, void *data, AppendFunction append,
+ CountFunction count = 0, AtFunction at = 0,
+ ClearFunction clear = 0)
+
+Construct a QDeclarativeListProperty 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 QDeclarativeListProperty::AppendFunction
+
+Synonym for \c {void (*)(QDeclarativeListProperty<T> *property, T *value)}.
+
+Append the \a value to the list \a property.
+*/
+
+/*!
+\typedef QDeclarativeListProperty::CountFunction
+
+Synonym for \c {int (*)(QDeclarativeListProperty<T> *property)}.
+
+Return the number of elements in the list \a property.
+*/
+
+/*!
+\fn bool QDeclarativeListProperty::operator==(const QDeclarativeListProperty &other) const
+
+Returns true if this QDeclarativeListProperty is equal to \a other, otherwise false.
+*/
+
+/*!
+\typedef QDeclarativeListProperty::AtFunction
+
+Synonym for \c {T *(*)(QDeclarativeListProperty<T> *property, int index)}.
+
+Return the element at position \a index in the list \a property.
+*/
+
+/*!
+\typedef QDeclarativeListProperty::ClearFunction
+
+Synonym for \c {void (*)(QDeclarativeListProperty<T> *property)}.
+
+Clear the list \a property.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmllist.h b/src/declarative/qml/qdeclarativelist.h
index 5528d8d..8d59384 100644
--- a/src/declarative/qml/qmllist.h
+++ b/src/declarative/qml/qdeclarativelist.h
@@ -39,10 +39,12 @@
**
****************************************************************************/
-#ifndef QMLLIST_H
-#define QMLLIST_H
+#ifndef QDECLARATIVELIST_H
+#define QDECLARATIVELIST_H
-#include "qmlprivate.h"
+#include <QtCore/qglobal.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qvariant.h>
QT_BEGIN_HEADER
@@ -50,23 +52,25 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+class QObject;
+class QMetaObject;
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> *);
+struct QDeclarativeListProperty {
+ typedef void (*AppendFunction)(QDeclarativeListProperty<T> *, T*);
+ typedef int (*CountFunction)(QDeclarativeListProperty<T> *);
+ typedef T *(*AtFunction)(QDeclarativeListProperty<T> *, int);
+ typedef void (*ClearFunction)(QDeclarativeListProperty<T> *);
- QmlListProperty()
+ QDeclarativeListProperty()
: object(0), data(0), append(0), count(0), at(0), clear(0), dummy1(0), dummy2(0) {}
- QmlListProperty(QObject *o, QList<T *> &list)
+ QDeclarativeListProperty(QObject *o, QList<T *> &list)
: 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,
+ QDeclarativeListProperty(QObject *o, void *d, AppendFunction a, CountFunction c = 0, AtFunction t = 0,
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 {
+ bool operator==(const QDeclarativeListProperty &o) const {
return object == o.object &&
data == o.data &&
append == o.append &&
@@ -89,30 +93,30 @@ struct QmlListProperty {
void *dummy2;
private:
- static void qlist_append(QmlListProperty *p, T *v) {
+ static void qlist_append(QDeclarativeListProperty *p, T *v) {
((QList<T *> *)p->data)->append(v);
}
- static int qlist_count(QmlListProperty *p) {
+ static int qlist_count(QDeclarativeListProperty *p) {
return ((QList<T *> *)p->data)->count();
}
- static T *qlist_at(QmlListProperty *p, int idx) {
+ static T *qlist_at(QDeclarativeListProperty *p, int idx) {
return ((QList<T *> *)p->data)->at(idx);
}
- static void qlist_clear(QmlListProperty *p) {
+ static void qlist_clear(QDeclarativeListProperty *p) {
return ((QList<T *> *)p->data)->clear();
}
};
-class QmlEngine;
-class QmlListReferencePrivate;
-class Q_DECLARATIVE_EXPORT QmlListReference
+class QDeclarativeEngine;
+class QDeclarativeListReferencePrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeListReference
{
public:
- QmlListReference();
- QmlListReference(QObject *, const char *property, QmlEngine * = 0);
- QmlListReference(const QmlListReference &);
- QmlListReference &operator=(const QmlListReference &);
- ~QmlListReference();
+ QDeclarativeListReference();
+ QDeclarativeListReference(QObject *, const char *property, QDeclarativeEngine * = 0);
+ QDeclarativeListReference(const QDeclarativeListReference &);
+ QDeclarativeListReference &operator=(const QDeclarativeListReference &);
+ ~QDeclarativeListReference();
bool isValid() const;
@@ -130,14 +134,14 @@ public:
int count() const;
private:
- friend class QmlListReferencePrivate;
- QmlListReferencePrivate* d;
+ friend class QDeclarativeListReferencePrivate;
+ QDeclarativeListReferencePrivate* d;
};
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QmlListReference);
+Q_DECLARE_METATYPE(QDeclarativeListReference);
QT_END_HEADER
-#endif // QMLLIST_H
+#endif // QDECLARATIVELIST_H
diff --git a/src/declarative/qml/qmllist_p.h b/src/declarative/qml/qdeclarativelist_p.h
index 4660e47..45a805a 100644
--- a/src/declarative/qml/qmllist_p.h
+++ b/src/declarative/qml/qdeclarativelist_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLLIST_P_H
-#define QMLLIST_P_H
+#ifndef QDECLARATIVELIST_P_H
+#define QDECLARATIVELIST_P_H
//
// W A R N I N G
@@ -53,28 +53,28 @@
// We mean it.
//
-#include "qmllist.h"
-#include "qmlguard_p.h"
+#include "qdeclarativelist.h"
+#include "qdeclarativeguard_p.h"
QT_BEGIN_NAMESPACE
-class QmlListReferencePrivate
+class QDeclarativeListReferencePrivate
{
public:
- QmlListReferencePrivate();
+ QDeclarativeListReferencePrivate();
- static QmlListReference init(const QmlListProperty<QObject> &, int, QmlEngine *);
+ static QDeclarativeListReference init(const QDeclarativeListProperty<QObject> &, int, QDeclarativeEngine *);
- QmlGuard<QObject> object;
+ QDeclarativeGuard<QObject> object;
const QMetaObject *elementType;
- QmlListProperty<QObject> property;
+ QDeclarativeListProperty<QObject> property;
int propertyType;
void addref();
void release();
int refCount;
- static inline QmlListReferencePrivate *get(QmlListReference *ref) {
+ static inline QDeclarativeListReferencePrivate *get(QDeclarativeListReference *ref) {
return ref->d;
}
};
@@ -82,4 +82,4 @@ public:
QT_END_NAMESPACE
-#endif // QMLLIST_P_H
+#endif // QDECLARATIVELIST_P_H
diff --git a/src/declarative/qml/qmllistscriptclass.cpp b/src/declarative/qml/qdeclarativelistscriptclass.cpp
index bb29763..ea04ad9 100644
--- a/src/declarative/qml/qmllistscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativelistscriptclass.cpp
@@ -39,36 +39,36 @@
**
****************************************************************************/
-#include "qmllistscriptclass_p.h"
+#include "qdeclarativelistscriptclass_p.h"
-#include "qmlengine_p.h"
-#include "qmlguard_p.h"
-#include "qmllist_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativeguard_p.h"
+#include "qdeclarativelist_p.h"
QT_BEGIN_NAMESPACE
struct ListData : public QScriptDeclarativeClass::Object {
- QmlGuard<QObject> object;
- QmlListProperty<QObject> property;
+ QDeclarativeGuard<QObject> object;
+ QDeclarativeListProperty<QObject> property;
int propertyType;
};
-QmlListScriptClass::QmlListScriptClass(QmlEngine *e)
-: QmlScriptClass(QmlEnginePrivate::getScriptEngine(e)), engine(e)
+QDeclarativeListScriptClass::QDeclarativeListScriptClass(QDeclarativeEngine *e)
+: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(e)), engine(e)
{
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
Q_UNUSED(scriptEngine);
m_lengthId = createPersistentIdentifier(QLatin1String("length"));
}
-QmlListScriptClass::~QmlListScriptClass()
+QDeclarativeListScriptClass::~QDeclarativeListScriptClass()
{
}
-QScriptValue QmlListScriptClass::newList(QObject *object, int propId, int propType)
+QScriptValue QDeclarativeListScriptClass::newList(QObject *object, int propId, int propType)
{
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
if (!object || propId == -1)
return scriptEngine->nullValue();
@@ -82,9 +82,9 @@ QScriptValue QmlListScriptClass::newList(QObject *object, int propId, int propTy
return newObject(scriptEngine, this, data);
}
-QScriptValue QmlListScriptClass::newList(const QmlListProperty<QObject> &prop, int propType)
+QScriptValue QDeclarativeListScriptClass::newList(const QDeclarativeListProperty<QObject> &prop, int propType)
{
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
ListData *data = new ListData;
data->object = prop.object;
@@ -95,7 +95,7 @@ QScriptValue QmlListScriptClass::newList(const QmlListProperty<QObject> &prop, i
}
QScriptClass::QueryFlags
-QmlListScriptClass::queryProperty(Object *object, const Identifier &name,
+QDeclarativeListScriptClass::queryProperty(Object *object, const Identifier &name,
QScriptClass::QueryFlags flags)
{
Q_UNUSED(object);
@@ -114,10 +114,10 @@ QmlListScriptClass::queryProperty(Object *object, const Identifier &name,
}
}
-QmlListScriptClass::ScriptValue QmlListScriptClass::property(Object *obj, const Identifier &name)
+QDeclarativeListScriptClass::ScriptValue QDeclarativeListScriptClass::property(Object *obj, const Identifier &name)
{
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
- QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
+ QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine);
ListData *data = (ListData *)obj;
if (!data->object)
@@ -133,7 +133,7 @@ QmlListScriptClass::ScriptValue QmlListScriptClass::property(Object *obj, const
return Value();
}
-QVariant QmlListScriptClass::toVariant(Object *obj, bool *ok)
+QVariant QDeclarativeListScriptClass::toVariant(Object *obj, bool *ok)
{
ListData *data = (ListData *)obj;
@@ -142,7 +142,7 @@ QVariant QmlListScriptClass::toVariant(Object *obj, bool *ok)
return QVariant();
}
- return QVariant::fromValue(QmlListReferencePrivate::init(data->property, data->propertyType, engine));
+ return QVariant::fromValue(QDeclarativeListReferencePrivate::init(data->property, data->propertyType, engine));
}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmllistscriptclass_p.h b/src/declarative/qml/qdeclarativelistscriptclass_p.h
index 07b09c3..68c680d 100644
--- a/src/declarative/qml/qmllistscriptclass_p.h
+++ b/src/declarative/qml/qdeclarativelistscriptclass_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLLISTSCRIPTCLASS_P_H
-#define QMLLISTSCRIPTCLASS_P_H
+#ifndef QDECLARATIVELISTSCRIPTCLASS_P_H
+#define QDECLARATIVELISTSCRIPTCLASS_P_H
//
// W A R N I N G
@@ -53,20 +53,20 @@
// We mean it.
//
-#include <private/qmlscriptclass_p.h>
-#include "qmllist.h"
+#include <private/qdeclarativescriptclass_p.h>
+#include "qdeclarativelist.h"
QT_BEGIN_NAMESPACE
-class QmlEngine;
-class QmlListScriptClass : public QmlScriptClass
+class QDeclarativeEngine;
+class QDeclarativeListScriptClass : public QDeclarativeScriptClass
{
public:
- QmlListScriptClass(QmlEngine *);
- ~QmlListScriptClass();
+ QDeclarativeListScriptClass(QDeclarativeEngine *);
+ ~QDeclarativeListScriptClass();
QScriptValue newList(QObject *, int, int);
- QScriptValue newList(const QmlListProperty<QObject> &, int);
+ QScriptValue newList(const QDeclarativeListProperty<QObject> &, int);
protected:
virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &,
@@ -76,12 +76,12 @@ protected:
private:
PersistentIdentifier m_lengthId;
- QmlEngine *engine;
+ QDeclarativeEngine *engine;
quint32 lastIndex;
};
QT_END_NAMESPACE
-#endif // QMLLISTSCRIPTCLASS_P_H
+#endif // QDECLARATIVELISTSCRIPTCLASS_P_H
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp
index 6db70d4..abbb9d6 100644
--- a/src/declarative/qml/qmlmetatype.cpp
+++ b/src/declarative/qml/qdeclarativemetatype.cpp
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#include "qmlmetatype.h"
+#include "qdeclarativemetatype_p.h"
-#include "qmlproxymetaobject_p.h"
-#include "qmlcustomparser_p.h"
-#include "qmlguard_p.h"
+#include "qdeclarativeproxymetaobject_p.h"
+#include "qdeclarativecustomparser_p.h"
+#include "qdeclarativeguard_p.h"
#include <QtCore/qdebug.h>
#include <QtCore/qstringlist.h>
@@ -85,36 +85,36 @@
QT_BEGIN_NAMESPACE
-struct QmlMetaTypeData
+struct QDeclarativeMetaTypeData
{
- ~QmlMetaTypeData();
- QList<QmlType *> types;
- typedef QHash<int, QmlType *> Ids;
+ ~QDeclarativeMetaTypeData();
+ QList<QDeclarativeType *> types;
+ typedef QHash<int, QDeclarativeType *> Ids;
Ids idToType;
- typedef QHash<QByteArray, QmlType *> Names;
+ typedef QHash<QByteArray, QDeclarativeType *> Names;
Names nameToType;
- typedef QHash<const QMetaObject *, QmlType *> MetaObjects;
+ typedef QHash<const QMetaObject *, QDeclarativeType *> MetaObjects;
MetaObjects metaObjectToType;
- typedef QHash<int, QmlMetaType::StringConverter> StringConverters;
+ typedef QHash<int, QDeclarativeMetaType::StringConverter> StringConverters;
StringConverters stringConverters;
QBitArray objects;
QBitArray interfaces;
QBitArray lists;
};
-Q_GLOBAL_STATIC(QmlMetaTypeData, metaTypeData)
+Q_GLOBAL_STATIC(QDeclarativeMetaTypeData, metaTypeData)
Q_GLOBAL_STATIC(QReadWriteLock, metaTypeDataLock)
-QmlMetaTypeData::~QmlMetaTypeData()
+QDeclarativeMetaTypeData::~QDeclarativeMetaTypeData()
{
for (int i = 0; i < types.count(); ++i)
delete types.at(i);
}
-class QmlTypePrivate
+class QDeclarativeTypePrivate
{
public:
- QmlTypePrivate();
+ QDeclarativeTypePrivate();
void init() const;
@@ -126,20 +126,20 @@ public:
int m_typeId; int m_listId;
QObject *(*m_newFunc)();
const QMetaObject *m_baseMetaObject;
- QmlAttachedPropertiesFunc m_attachedPropertiesFunc;
+ QDeclarativeAttachedPropertiesFunc m_attachedPropertiesFunc;
const QMetaObject *m_attachedPropertiesType;
int m_parserStatusCast;
int m_propertyValueSourceCast;
int m_propertyValueInterceptorCast;
- QmlPrivate::CreateFunc m_extFunc;
+ QObject *(*m_extFunc)(QObject *);
const QMetaObject *m_extMetaObject;
int m_index;
- QmlCustomParser *m_customParser;
+ QDeclarativeCustomParser *m_customParser;
mutable volatile bool m_isSetup:1;
- mutable QList<QmlProxyMetaObject::ProxyData> m_metaObjects;
+ mutable QList<QDeclarativeProxyMetaObject::ProxyData> m_metaObjects;
};
-QmlTypePrivate::QmlTypePrivate()
+QDeclarativeTypePrivate::QDeclarativeTypePrivate()
: 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),
@@ -148,13 +148,13 @@ QmlTypePrivate::QmlTypePrivate()
}
-QmlType::QmlType(int type, int listType, const char *iid, int index)
-: d(new QmlTypePrivate)
+QDeclarativeType::QDeclarativeType(int index, const QDeclarativePrivate::RegisterInterface &interface)
+: d(new QDeclarativeTypePrivate)
{
d->m_isInterface = true;
- d->m_iid = iid;
- d->m_typeId = type;
- d->m_listId = listType;
+ d->m_iid = interface.iid;
+ d->m_typeId = interface.typeId;
+ d->m_listId = interface.listId;
d->m_newFunc = 0;
d->m_index = index;
d->m_isSetup = true;
@@ -162,60 +162,55 @@ QmlType::QmlType(int type, int listType, const char *iid, int index)
d->m_version_min = 0;
}
-QmlType::QmlType(int type, int listType,
- QObject *(*newFunc)(), const char *qmlName,
- int version_maj, int version_min,
- const QMetaObject *metaObject,
- QmlAttachedPropertiesFunc attachedPropertiesFunc,
- const QMetaObject *attachedType,
- int parserStatusCast, int propertyValueSourceCast, int propertyValueInterceptorCast,
- QmlPrivate::CreateFunc extFunc,
- const QMetaObject *extMetaObject, int index,
- QmlCustomParser *customParser)
-: d(new QmlTypePrivate)
+QDeclarativeType::QDeclarativeType(int index, const QDeclarativePrivate::RegisterType &type)
+: d(new QDeclarativeTypePrivate)
{
- d->m_name = qmlName;
- d->m_version_maj = version_maj;
- d->m_version_min = version_min;
- d->m_typeId = type;
- d->m_listId = listType;
- d->m_newFunc = newFunc;
- d->m_baseMetaObject = metaObject;
- d->m_attachedPropertiesFunc = attachedPropertiesFunc;
- d->m_attachedPropertiesType = attachedType;
- d->m_parserStatusCast = parserStatusCast;
- d->m_propertyValueSourceCast = propertyValueSourceCast;
- d->m_propertyValueInterceptorCast = propertyValueInterceptorCast;
- d->m_extFunc = extFunc;
+ QByteArray name = type.uri;
+ if (type.uri) name += '/';
+ name += type.elementName;
+
+ d->m_name = name;
+ d->m_version_maj = type.versionMajor;
+ d->m_version_min = type.versionMinor;
+ d->m_typeId = type.typeId;
+ d->m_listId = type.listId;
+ d->m_newFunc = type.create;
+ d->m_baseMetaObject = type.metaObject;
+ d->m_attachedPropertiesFunc = type.attachedPropertiesFunction;
+ d->m_attachedPropertiesType = type.attachedPropertiesMetaObject;
+ d->m_parserStatusCast = type.parserStatusCast;
+ d->m_propertyValueSourceCast = type.valueSourceCast;
+ d->m_propertyValueInterceptorCast = type.valueInterceptorCast;
+ d->m_extFunc = type.extensionObjectCreate;
d->m_index = index;
- d->m_customParser = customParser;
+ d->m_customParser = type.customParser;
- if (extMetaObject)
- d->m_extMetaObject = extMetaObject;
+ if (type.extensionMetaObject)
+ d->m_extMetaObject = type.extensionMetaObject;
}
-QmlType::~QmlType()
+QDeclarativeType::~QDeclarativeType()
{
delete d->m_customParser;
delete d;
}
-int QmlType::majorVersion() const
+int QDeclarativeType::majorVersion() const
{
return d->m_version_maj;
}
-int QmlType::minorVersion() const
+int QDeclarativeType::minorVersion() const
{
return d->m_version_min;
}
-bool QmlType::availableInVersion(int vmajor, int vminor) const
+bool QDeclarativeType::availableInVersion(int vmajor, int vminor) const
{
return vmajor > d->m_version_maj || (vmajor == d->m_version_maj && vminor >= d->m_version_min);
}
-void QmlTypePrivate::init() const
+void QDeclarativeTypePrivate::init() const
{
if (m_isSetup) return;
@@ -230,13 +225,13 @@ void QmlTypePrivate::init() const
QMetaObject *mmo = new QMetaObject;
*mmo = *m_extMetaObject;
mmo->d.superdata = mo;
- QmlProxyMetaObject::ProxyData data = { mmo, m_extFunc, 0, 0 };
+ QDeclarativeProxyMetaObject::ProxyData data = { mmo, m_extFunc, 0, 0 };
m_metaObjects << data;
}
mo = mo->d.superdata;
while(mo) {
- QmlType *t = metaTypeData()->metaObjectToType.value(mo);
+ QDeclarativeType *t = metaTypeData()->metaObjectToType.value(mo);
if (t) {
if (t->d->m_extFunc) {
QMetaObject *mmo = new QMetaObject;
@@ -244,7 +239,7 @@ void QmlTypePrivate::init() const
mmo->d.superdata = m_baseMetaObject;
if (!m_metaObjects.isEmpty())
m_metaObjects.last().metaObject->d.superdata = mmo;
- QmlProxyMetaObject::ProxyData data = { mmo, t->d->m_extFunc, 0, 0 };
+ QDeclarativeProxyMetaObject::ProxyData data = { mmo, t->d->m_extFunc, 0, 0 };
m_metaObjects << data;
}
}
@@ -262,7 +257,7 @@ void QmlTypePrivate::init() const
lock.unlock();
}
-QByteArray QmlType::typeName() const
+QByteArray QDeclarativeType::typeName() const
{
if (d->m_baseMetaObject)
return d->m_baseMetaObject->className();
@@ -270,43 +265,43 @@ QByteArray QmlType::typeName() const
return QByteArray();
}
-QByteArray QmlType::qmlTypeName() const
+QByteArray QDeclarativeType::qmlTypeName() const
{
return d->m_name;
}
-QObject *QmlType::create() const
+QObject *QDeclarativeType::create() const
{
d->init();
QObject *rv = d->m_newFunc();
if (rv && !d->m_metaObjects.isEmpty())
- (void *)new QmlProxyMetaObject(rv, &d->m_metaObjects);
+ (void *)new QDeclarativeProxyMetaObject(rv, &d->m_metaObjects);
return rv;
}
-QmlCustomParser *QmlType::customParser() const
+QDeclarativeCustomParser *QDeclarativeType::customParser() const
{
return d->m_customParser;
}
-bool QmlType::isInterface() const
+bool QDeclarativeType::isInterface() const
{
return d->m_isInterface;
}
-int QmlType::typeId() const
+int QDeclarativeType::typeId() const
{
return d->m_typeId;
}
-int QmlType::qListTypeId() const
+int QDeclarativeType::qListTypeId() const
{
return d->m_listId;
}
-const QMetaObject *QmlType::metaObject() const
+const QMetaObject *QDeclarativeType::metaObject() const
{
d->init();
@@ -317,55 +312,59 @@ const QMetaObject *QmlType::metaObject() const
}
-const QMetaObject *QmlType::baseMetaObject() const
+const QMetaObject *QDeclarativeType::baseMetaObject() const
{
return d->m_baseMetaObject;
}
-QmlAttachedPropertiesFunc QmlType::attachedPropertiesFunction() const
+QDeclarativeAttachedPropertiesFunc QDeclarativeType::attachedPropertiesFunction() const
{
return d->m_attachedPropertiesFunc;
}
-const QMetaObject *QmlType::attachedPropertiesType() const
+const QMetaObject *QDeclarativeType::attachedPropertiesType() const
{
return d->m_attachedPropertiesType;
}
-int QmlType::parserStatusCast() const
+int QDeclarativeType::parserStatusCast() const
{
return d->m_parserStatusCast;
}
-int QmlType::propertyValueSourceCast() const
+int QDeclarativeType::propertyValueSourceCast() const
{
return d->m_propertyValueSourceCast;
}
-int QmlType::propertyValueInterceptorCast() const
+int QDeclarativeType::propertyValueInterceptorCast() const
{
return d->m_propertyValueInterceptorCast;
}
-const char *QmlType::interfaceIId() const
+const char *QDeclarativeType::interfaceIId() const
{
return d->m_iid;
}
-int QmlType::index() const
+int QDeclarativeType::index() const
{
return d->m_index;
}
-int QmlMetaType::registerInterface(const QmlPrivate::MetaTypeIds &id,
- const char *iid)
+int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterInterface &interface)
{
+ if (interface.version > 0) {
+ qWarning("Cannot mix incompatible QML versions.");
+ return -1;
+ }
+
QWriteLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
int index = data->types.count();
- QmlType *type = new QmlType(id.typeId, id.listId, iid, index);
+ QDeclarativeType *type = new QDeclarativeType(index, interface);
data->types.append(type);
data->idToType.insert(type->typeId(), type);
@@ -374,65 +373,53 @@ int QmlMetaType::registerInterface(const QmlPrivate::MetaTypeIds &id,
if (!type->qmlTypeName().isEmpty())
data->nameToType.insert(type->qmlTypeName(), type);
- if (data->interfaces.size() <= id.typeId)
- data->interfaces.resize(id.typeId + 16);
- if (data->lists.size() <= id.listId)
- data->lists.resize(id.listId + 16);
- data->interfaces.setBit(id.typeId, true);
- data->lists.setBit(id.listId, true);
+ if (data->interfaces.size() <= interface.typeId)
+ data->interfaces.resize(interface.typeId + 16);
+ if (data->lists.size() <= interface.listId)
+ data->lists.resize(interface.listId + 16);
+ data->interfaces.setBit(interface.typeId, true);
+ data->lists.setBit(interface.listId, true);
return index;
}
-int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QObject *(*func)(),
- const char *uri, int version_maj, int version_min, const char *cname,
- const QMetaObject *mo, QmlAttachedPropertiesFunc attach, const QMetaObject *attachMo,
- int pStatus, int object, int valueSource, int valueInterceptor, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *parser)
+int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterType &type)
{
- Q_UNUSED(object);
-
- if (cname) {
- for (int ii = 0; cname[ii]; ++ii) {
- if (!isalnum(cname[ii])) {
- qWarning("QmlMetaType: Invalid QML name %s", cname);
+ if (type.elementName) {
+ for (int ii = 0; type.elementName[ii]; ++ii) {
+ if (!isalnum(type.elementName[ii])) {
+ qWarning("QDeclarativeMetaType: Invalid QML element name %s", type.elementName);
return -1;
}
}
}
QWriteLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
int index = data->types.count();
- QByteArray name = uri;
- if (uri)
- name += '/';
- name += cname;
+ QDeclarativeType *dtype = new QDeclarativeType(index, type);
- 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(dtype);
+ data->idToType.insert(dtype->typeId(), dtype);
+ data->idToType.insert(dtype->qListTypeId(), dtype);
- data->types.append(type);
- data->idToType.insert(type->typeId(), type);
- data->idToType.insert(type->qListTypeId(), type);
-
- if (!type->qmlTypeName().isEmpty())
- data->nameToType.insertMulti(type->qmlTypeName(), type);
+ if (!dtype->qmlTypeName().isEmpty())
+ data->nameToType.insertMulti(dtype->qmlTypeName(), dtype);
- data->metaObjectToType.insert(type->baseMetaObject(), type);
+ data->metaObjectToType.insert(dtype->baseMetaObject(), dtype);
- if (data->objects.size() <= id.typeId)
- data->objects.resize(id.typeId + 16);
- if (data->lists.size() <= id.listId)
- data->lists.resize(id.listId + 16);
- data->objects.setBit(id.typeId, true);
- data->lists.setBit(id.listId, true);
+ if (data->objects.size() <= type.typeId)
+ data->objects.resize(type.typeId + 16);
+ if (data->lists.size() <= type.listId)
+ data->lists.resize(type.listId + 16);
+ data->objects.setBit(type.typeId, true);
+ data->lists.setBit(type.listId, true);
return index;
}
-QObject *QmlMetaType::toQObject(const QVariant &v, bool *ok)
+QObject *QDeclarativeMetaType::toQObject(const QVariant &v, bool *ok)
{
if (!isQObject(v.userType())) {
if (ok) *ok = false;
@@ -444,52 +431,52 @@ QObject *QmlMetaType::toQObject(const QVariant &v, bool *ok)
return *(QObject **)v.constData();
}
-bool QmlMetaType::isQObject(int userType)
+bool QDeclarativeMetaType::isQObject(int userType)
{
if (userType == QMetaType::QObjectStar)
return true;
QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
return userType >= 0 && userType < data->objects.size() && data->objects.testBit(userType);
}
/*
Returns the item type for a list of type \a id.
*/
-int QmlMetaType::listType(int id)
+int QDeclarativeMetaType::listType(int id)
{
QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
- QmlType *type = data->idToType.value(id);
+ QDeclarativeMetaTypeData *data = metaTypeData();
+ QDeclarativeType *type = data->idToType.value(id);
if (type && type->qListTypeId() == id)
return type->typeId();
else
return 0;
}
-int QmlMetaType::attachedPropertiesFuncId(const QMetaObject *mo)
+int QDeclarativeMetaType::attachedPropertiesFuncId(const QMetaObject *mo)
{
QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
- QmlType *type = data->metaObjectToType.value(mo);
+ QDeclarativeType *type = data->metaObjectToType.value(mo);
if (type && type->attachedPropertiesFunction())
return type->index();
else
return -1;
}
-QmlAttachedPropertiesFunc QmlMetaType::attachedPropertiesFuncById(int id)
+QDeclarativeAttachedPropertiesFunc QDeclarativeMetaType::attachedPropertiesFuncById(int id)
{
if (id < 0)
return 0;
QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
return data->types.at(id)->attachedPropertiesFunction();
}
-QMetaProperty QmlMetaType::defaultProperty(const QMetaObject *metaObject)
+QMetaProperty QDeclarativeMetaType::defaultProperty(const QMetaObject *metaObject)
{
int idx = metaObject->indexOfClassInfo("DefaultProperty");
if (-1 == idx)
@@ -506,7 +493,7 @@ QMetaProperty QmlMetaType::defaultProperty(const QMetaObject *metaObject)
return metaObject->property(idx);
}
-QMetaProperty QmlMetaType::defaultProperty(QObject *obj)
+QMetaProperty QDeclarativeMetaType::defaultProperty(QObject *obj)
{
if (!obj)
return QMetaProperty();
@@ -515,7 +502,7 @@ QMetaProperty QmlMetaType::defaultProperty(QObject *obj)
return defaultProperty(metaObject);
}
-QMetaMethod QmlMetaType::defaultMethod(const QMetaObject *metaObject)
+QMetaMethod QDeclarativeMetaType::defaultMethod(const QMetaObject *metaObject)
{
int idx = metaObject->indexOfClassInfo("DefaultMethod");
if (-1 == idx)
@@ -532,7 +519,7 @@ QMetaMethod QmlMetaType::defaultMethod(const QMetaObject *metaObject)
return metaObject->method(idx);
}
-QMetaMethod QmlMetaType::defaultMethod(QObject *obj)
+QMetaMethod QDeclarativeMetaType::defaultMethod(QObject *obj)
{
if (!obj)
return QMetaMethod();
@@ -541,7 +528,7 @@ QMetaMethod QmlMetaType::defaultMethod(QObject *obj)
return defaultMethod(metaObject);
}
-QmlMetaType::TypeCategory QmlMetaType::typeCategory(int userType)
+QDeclarativeMetaType::TypeCategory QDeclarativeMetaType::typeCategory(int userType)
{
if (userType < 0)
return Unknown;
@@ -549,7 +536,7 @@ QmlMetaType::TypeCategory QmlMetaType::typeCategory(int userType)
return Object;
QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
if (userType < data->objects.size() && data->objects.testBit(userType))
return Object;
else if (userType < data->lists.size() && data->lists.testBit(userType))
@@ -558,18 +545,18 @@ QmlMetaType::TypeCategory QmlMetaType::typeCategory(int userType)
return Unknown;
}
-bool QmlMetaType::isInterface(int userType)
+bool QDeclarativeMetaType::isInterface(int userType)
{
QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
return userType >= 0 && userType < data->interfaces.size() && data->interfaces.testBit(userType);
}
-const char *QmlMetaType::interfaceIId(int userType)
+const char *QDeclarativeMetaType::interfaceIId(int userType)
{
QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
- QmlType *type = data->idToType.value(userType);
+ QDeclarativeMetaTypeData *data = metaTypeData();
+ QDeclarativeType *type = data->idToType.value(userType);
lock.unlock();
if (type && type->isInterface() && type->typeId() == userType)
return type->interfaceIId();
@@ -577,10 +564,10 @@ const char *QmlMetaType::interfaceIId(int userType)
return 0;
}
-bool QmlMetaType::isList(int userType)
+bool QDeclarativeMetaType::isList(int userType)
{
QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
return userType >= 0 && userType < data->lists.size() && data->lists.testBit(userType);
}
@@ -599,11 +586,11 @@ bool QmlMetaType::isList(int userType)
QVariant (*StringConverter)(const QString &);
\endcode
*/
-void QmlMetaType::registerCustomStringConverter(int type, StringConverter converter)
+void QDeclarativeMetaType::registerCustomStringConverter(int type, StringConverter converter)
{
QWriteLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
if (data->stringConverters.contains(type))
return;
data->stringConverters.insert(type, converter);
@@ -613,11 +600,11 @@ void QmlMetaType::registerCustomStringConverter(int type, StringConverter conver
Return the custom string converter for \a type, previously installed through
registerCustomStringConverter()
*/
-QmlMetaType::StringConverter QmlMetaType::customStringConverter(int type)
+QDeclarativeMetaType::StringConverter QDeclarativeMetaType::customStringConverter(int type)
{
QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
return data->stringConverters.value(type);
}
@@ -625,14 +612,14 @@ QmlMetaType::StringConverter QmlMetaType::customStringConverter(int type)
Returns the type (if any) of URI-qualified named \a name in version specified
by \a version_major and \a version_minor.
*/
-QmlType *QmlMetaType::qmlType(const QByteArray &name, int version_major, int version_minor)
+QDeclarativeType *QDeclarativeMetaType::qmlType(const QByteArray &name, int version_major, int version_minor)
{
QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
- QList<QmlType*> types = data->nameToType.values(name);
- foreach (QmlType *t, types) {
- // XXX version_major<0 just a kludge for QmlMetaPropertyPrivate::initProperty
+ QList<QDeclarativeType*> types = data->nameToType.values(name);
+ foreach (QDeclarativeType *t, types) {
+ // XXX version_major<0 just a kludge for QDeclarativePropertyPrivate::initProperty
if (version_major<0 || t->availableInVersion(version_major,version_minor))
return t;
}
@@ -643,10 +630,10 @@ QmlType *QmlMetaType::qmlType(const QByteArray &name, int version_major, int ver
Returns the type (if any) that corresponds to the \a metaObject. Returns null if no
type is registered.
*/
-QmlType *QmlMetaType::qmlType(const QMetaObject *metaObject)
+QDeclarativeType *QDeclarativeMetaType::qmlType(const QMetaObject *metaObject)
{
QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
return data->metaObjectToType.value(metaObject);
}
@@ -655,12 +642,12 @@ QmlType *QmlMetaType::qmlType(const QMetaObject *metaObject)
Returns the type (if any) that corresponds to the QVariant::Type \a userType.
Returns null if no type is registered.
*/
-QmlType *QmlMetaType::qmlType(int userType)
+QDeclarativeType *QDeclarativeMetaType::qmlType(int userType)
{
QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
- QmlType *type = data->idToType.value(userType);
+ QDeclarativeType *type = data->idToType.value(userType);
if (type && type->typeId() == userType)
return type;
else
@@ -670,10 +657,10 @@ QmlType *QmlMetaType::qmlType(int userType)
/*!
Returns the list of registered QML type names.
*/
-QList<QByteArray> QmlMetaType::qmlTypeNames()
+QList<QByteArray> QDeclarativeMetaType::qmlTypeNames()
{
QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
return data->nameToType.keys();
}
@@ -681,10 +668,10 @@ QList<QByteArray> QmlMetaType::qmlTypeNames()
/*!
Returns the list of registered QML types.
*/
-QList<QmlType*> QmlMetaType::qmlTypes()
+QList<QDeclarativeType*> QDeclarativeMetaType::qmlTypes()
{
QReadLocker lock(metaTypeDataLock());
- QmlMetaTypeData *data = metaTypeData();
+ QDeclarativeMetaTypeData *data = metaTypeData();
return data->nameToType.values();
}
@@ -727,7 +714,7 @@ QT_BEGIN_NAMESPACE
\note This should move into QMetaType once complete
*/
-bool QmlMetaType::copy(int type, void *data, const void *copy)
+bool QDeclarativeMetaType::copy(int type, void *data, const void *copy)
{
if (copy) {
switch(type) {
diff --git a/src/declarative/qml/qdeclarativemetatype_p.h b/src/declarative/qml/qdeclarativemetatype_p.h
new file mode 100644
index 0000000..ec5c045
--- /dev/null
+++ b/src/declarative/qml/qdeclarativemetatype_p.h
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVEMETATYPE_P_H
+#define QDECLARATIVEMETATYPE_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 "qdeclarative.h"
+
+#include <QtCore/qglobal.h>
+#include <QtCore/qvariant.h>
+#include <QtCore/qbitarray.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeType;
+class QDeclarativeCustomParser;
+class Q_DECLARATIVE_EXPORT QDeclarativeMetaType
+{
+public:
+ static bool copy(int type, void *data, const void *copy = 0);
+
+ static QList<QByteArray> qmlTypeNames();
+ static QList<QDeclarativeType*> qmlTypes();
+
+ static QDeclarativeType *qmlType(const QByteArray &, int, int);
+ static QDeclarativeType *qmlType(const QMetaObject *);
+ static QDeclarativeType *qmlType(int);
+
+ static QMetaProperty defaultProperty(const QMetaObject *);
+ static QMetaProperty defaultProperty(QObject *);
+ static QMetaMethod defaultMethod(const QMetaObject *);
+ static QMetaMethod defaultMethod(QObject *);
+
+ static bool isQObject(int);
+ static QObject *toQObject(const QVariant &, bool *ok = 0);
+
+ static int listType(int);
+ static int attachedPropertiesFuncId(const QMetaObject *);
+ static QDeclarativeAttachedPropertiesFunc attachedPropertiesFuncById(int);
+
+ enum TypeCategory { Unknown, Object, List };
+ static TypeCategory typeCategory(int);
+
+ static bool isInterface(int);
+ static const char *interfaceIId(int);
+ static bool isList(int);
+
+ typedef QVariant (*StringConverter)(const QString &);
+ static void registerCustomStringConverter(int, StringConverter);
+ static StringConverter customStringConverter(int);
+};
+
+class QDeclarativeTypePrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeType
+{
+public:
+ QByteArray typeName() const;
+ QByteArray qmlTypeName() const;
+
+ int majorVersion() const;
+ int minorVersion() const;
+ bool availableInVersion(int vmajor, int vminor) const;
+
+ QObject *create() const;
+
+ QDeclarativeCustomParser *customParser() const;
+
+ bool isInterface() const;
+ int typeId() const;
+ int qListTypeId() const;
+
+ const QMetaObject *metaObject() const;
+ const QMetaObject *baseMetaObject() const;
+
+ QDeclarativeAttachedPropertiesFunc attachedPropertiesFunction() const;
+ const QMetaObject *attachedPropertiesType() const;
+
+ int parserStatusCast() const;
+ QVariant fromObject(QObject *) const;
+ const char *interfaceIId() const;
+ int propertyValueSourceCast() const;
+ int propertyValueInterceptorCast() const;
+
+ int index() const;
+private:
+ friend class QDeclarativeTypePrivate;
+ friend class QDeclarativeMetaTypeData;
+ friend int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterInterface &);
+ friend int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterType &);
+ QDeclarativeType(int, const QDeclarativePrivate::RegisterInterface &);
+ QDeclarativeType(int, const QDeclarativePrivate::RegisterType &);
+ ~QDeclarativeType();
+
+ QDeclarativeTypePrivate *d;
+};
+
+QT_END_NAMESPACE
+
+#endif // QDECLARATIVEMETATYPE_P_H
+
diff --git a/src/declarative/qml/qmlnetworkaccessmanagerfactory.cpp b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp
index 455d09e..9dd7d39 100644
--- a/src/declarative/qml/qmlnetworkaccessmanagerfactory.cpp
+++ b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp
@@ -39,21 +39,21 @@
**
****************************************************************************/
-#include "qmlnetworkaccessmanagerfactory.h"
+#include "qdeclarativenetworkaccessmanagerfactory.h"
QT_BEGIN_NAMESPACE
/*!
- \class QmlNetworkAccessManagerFactory
+ \class QDeclarativeNetworkAccessManagerFactory
\since 4.7
- \brief The QmlNetworkAccessManagerFactory class provides a factory for QNetworkAccessManager
+ \brief The QDeclarativeNetworkAccessManagerFactory class provides a factory for QNetworkAccessManager
QNetworkAccessManager is used for all network access by QML.
By implementing a factory it is possible to create custom
QNetworkAccessManager with specialized caching, proxy and
cookie support.
- To implement a factory, subclass QmlNetworkAccessManagerFactory and implement
+ To implement a factory, subclass QDeclarativeNetworkAccessManagerFactory and implement
the create() method.
If the created QNetworkAccessManager becomes invalid, due to a
@@ -67,12 +67,12 @@ QT_BEGIN_NAMESPACE
/*!
The destructor is empty.
*/
-QmlNetworkAccessManagerFactory::~QmlNetworkAccessManagerFactory()
+QDeclarativeNetworkAccessManagerFactory::~QDeclarativeNetworkAccessManagerFactory()
{
}
/*!
- \fn QNetworkAccessManager *QmlNetworkAccessManagerFactory::create(QObject *parent)
+ \fn QNetworkAccessManager *QDeclarativeNetworkAccessManagerFactory::create(QObject *parent)
Implement this method to create a QNetworkAccessManager with \a parent.
This allows proxies, caching and cookie support to be setup appropriately.
diff --git a/src/declarative/qml/qmlnetworkaccessmanagerfactory.h b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.h
index 1660929..8c76013 100644
--- a/src/declarative/qml/qmlnetworkaccessmanagerfactory.h
+++ b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLNETWORKACCESSMANAGERFACTORY_H
-#define QMLNETWORKACCESSMANAGERFACTORY_H
+#ifndef QDECLARATIVENETWORKACCESSMANAGERFACTORY_H
+#define QDECLARATIVENETWORKACCESSMANAGERFACTORY_H
#include <QtCore/qobject.h>
@@ -51,10 +51,10 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QNetworkAccessManager;
-class Q_DECLARATIVE_EXPORT QmlNetworkAccessManagerFactory
+class Q_DECLARATIVE_EXPORT QDeclarativeNetworkAccessManagerFactory
{
public:
- virtual ~QmlNetworkAccessManagerFactory();
+ virtual ~QDeclarativeNetworkAccessManagerFactory();
virtual QNetworkAccessManager *create(QObject *parent) = 0;
};
@@ -63,4 +63,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLNETWORKACCESSMANAGERFACTORY_H
+#endif // QDECLARATIVENETWORKACCESSMANAGERFACTORY_H
diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index 15ece1d..542f417 100644
--- a/src/declarative/qml/qmlobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -39,16 +39,16 @@
**
****************************************************************************/
-#include "qmlobjectscriptclass_p.h"
+#include "qdeclarativeobjectscriptclass_p.h"
-#include "qmlengine_p.h"
-#include "qmlcontext_p.h"
-#include "qmldeclarativedata_p.h"
-#include "qmltypenamescriptclass_p.h"
-#include "qmllistscriptclass_p.h"
-#include "qmlbinding.h"
-#include "qmlguard_p.h"
-#include "qmlvmemetaobject_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativecontext_p.h"
+#include "qdeclarativedeclarativedata_p.h"
+#include "qdeclarativetypenamescriptclass_p.h"
+#include "qdeclarativelistscriptclass_p.h"
+#include "qdeclarativebinding_p.h"
+#include "qdeclarativeguard_p.h"
+#include "qdeclarativevmemetaobject_p.h"
#include <QtCore/qtimer.h>
#include <QtCore/qvarlengtharray.h>
@@ -59,23 +59,23 @@ QT_BEGIN_NAMESPACE
struct ObjectData : public QScriptDeclarativeClass::Object {
ObjectData(QObject *o, int t) : object(o), type(t) {}
- QmlGuard<QObject> object;
+ QDeclarativeGuard<QObject> object;
int type;
};
/*
- The QmlObjectScriptClass handles property access for QObjects
+ The QDeclarativeObjectScriptClass handles property access for QObjects
via QtScript. It is also used to provide a more useful API in
QtScript for QML.
*/
-QmlObjectScriptClass::QmlObjectScriptClass(QmlEngine *bindEngine)
-: QmlScriptClass(QmlEnginePrivate::getScriptEngine(bindEngine)),
+QDeclarativeObjectScriptClass::QDeclarativeObjectScriptClass(QDeclarativeEngine *bindEngine)
+: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)),
#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE)
methods(bindEngine),
#endif
lastData(0), engine(bindEngine)
{
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
m_destroy = scriptEngine->newFunction(destroy);
m_destroyId = createPersistentIdentifier(QLatin1String("destroy"));
@@ -83,35 +83,35 @@ QmlObjectScriptClass::QmlObjectScriptClass(QmlEngine *bindEngine)
m_toStringId = createPersistentIdentifier(QLatin1String("toString"));
}
-QmlObjectScriptClass::~QmlObjectScriptClass()
+QDeclarativeObjectScriptClass::~QDeclarativeObjectScriptClass()
{
}
-QScriptValue QmlObjectScriptClass::newQObject(QObject *object, int type)
+QScriptValue QDeclarativeObjectScriptClass::newQObject(QObject *object, int type)
{
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
if (!object)
return newObject(scriptEngine, this, new ObjectData(object, type));
- QmlDeclarativeData *ddata = QmlDeclarativeData::get(object, true);
+ QDeclarativeDeclarativeData *ddata = QDeclarativeDeclarativeData::get(object, true);
if (!ddata->scriptValue.isValid()) {
ddata->scriptValue = newObject(scriptEngine, this, new ObjectData(object, type));
return ddata->scriptValue;
- } else if (ddata->scriptValue.engine() == QmlEnginePrivate::getScriptEngine(engine)) {
+ } else if (ddata->scriptValue.engine() == QDeclarativeEnginePrivate::getScriptEngine(engine)) {
return ddata->scriptValue;
} else {
return newObject(scriptEngine, this, new ObjectData(object, type));
}
}
-QObject *QmlObjectScriptClass::toQObject(const QScriptValue &value) const
+QObject *QDeclarativeObjectScriptClass::toQObject(const QScriptValue &value) const
{
return value.toQObject();
}
-int QmlObjectScriptClass::objectType(const QScriptValue &value) const
+int QDeclarativeObjectScriptClass::objectType(const QScriptValue &value) const
{
if (scriptClass(value) != this)
return QVariant::Invalid;
@@ -121,15 +121,15 @@ int QmlObjectScriptClass::objectType(const QScriptValue &value) const
}
QScriptClass::QueryFlags
-QmlObjectScriptClass::queryProperty(Object *object, const Identifier &name,
+QDeclarativeObjectScriptClass::queryProperty(Object *object, const Identifier &name,
QScriptClass::QueryFlags flags)
{
return queryProperty(toQObject(object), name, flags, 0);
}
QScriptClass::QueryFlags
-QmlObjectScriptClass::queryProperty(QObject *obj, const Identifier &name,
- QScriptClass::QueryFlags flags, QmlContext *evalContext,
+QDeclarativeObjectScriptClass::queryProperty(QObject *obj, const Identifier &name,
+ QScriptClass::QueryFlags flags, QDeclarativeContext *evalContext,
QueryHints hints)
{
Q_UNUSED(flags);
@@ -143,15 +143,15 @@ QmlObjectScriptClass::queryProperty(QObject *obj, const Identifier &name,
if (!obj)
return 0;
- QmlEnginePrivate *enginePrivate = QmlEnginePrivate::get(engine);
- lastData = QmlPropertyCache::property(engine, obj, name, local);
+ QDeclarativeEnginePrivate *enginePrivate = QDeclarativeEnginePrivate::get(engine);
+ lastData = QDeclarativePropertyCache::property(engine, obj, name, local);
if (lastData)
return QScriptClass::HandlesReadAccess | QScriptClass::HandlesWriteAccess;
if (!(hints & SkipAttachedProperties)) {
if (!evalContext && context()) {
- // Global object, QScriptContext activation object, QmlContext object
+ // Global object, QScriptContext activation object, QDeclarativeContext object
QScriptValue scopeNode = scopeChainValue(context(), -3);
if (scopeNode.isValid()) {
Q_ASSERT(scriptClass(scopeNode) == enginePrivate->contextClass);
@@ -161,10 +161,10 @@ QmlObjectScriptClass::queryProperty(QObject *obj, const Identifier &name,
}
if (evalContext) {
- QmlContextPrivate *cp = QmlContextPrivate::get(evalContext);
+ QDeclarativeContextPrivate *cp = QDeclarativeContextPrivate::get(evalContext);
if (cp->imports) {
- QmlTypeNameCache::Data *data = cp->imports->data(name);
+ QDeclarativeTypeNameCache::Data *data = cp->imports->data(name);
if (data) {
lastTNData = data;
return QScriptClass::HandlesReadAccess;
@@ -182,16 +182,16 @@ QmlObjectScriptClass::queryProperty(QObject *obj, const Identifier &name,
return 0;
}
-QmlObjectScriptClass::ScriptValue
-QmlObjectScriptClass::property(Object *object, const Identifier &name)
+QDeclarativeObjectScriptClass::ScriptValue
+QDeclarativeObjectScriptClass::property(Object *object, const Identifier &name)
{
return property(toQObject(object), name);
}
-QmlObjectScriptClass::ScriptValue
-QmlObjectScriptClass::property(QObject *obj, const Identifier &name)
+QDeclarativeObjectScriptClass::ScriptValue
+QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name)
{
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
if (name == m_destroyId.identifier)
return Value(scriptEngine, m_destroy);
@@ -203,7 +203,7 @@ QmlObjectScriptClass::property(QObject *obj, const Identifier &name)
Q_ASSERT(obj);
- QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine);
if (lastTNData) {
@@ -212,9 +212,9 @@ QmlObjectScriptClass::property(QObject *obj, const Identifier &name)
else
return Value(scriptEngine, enginePriv->typeNameClass->newObject(obj, lastTNData->typeNamespace));
- } else if (lastData->flags & QmlPropertyCache::Data::IsFunction) {
- if (lastData->flags & QmlPropertyCache::Data::IsVMEFunction) {
- return Value(scriptEngine, ((QmlVMEMetaObject *)(obj->metaObject()))->vmeMethod(lastData->coreIndex));
+ } else if (lastData->flags & QDeclarativePropertyCache::Data::IsFunction) {
+ if (lastData->flags & QDeclarativePropertyCache::Data::IsVMEFunction) {
+ return Value(scriptEngine, ((QDeclarativeVMEMetaObject *)(obj->metaObject()))->vmeMethod(lastData->coreIndex));
} else {
#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE)
// Uncomment to use QtScript method call logic
@@ -227,25 +227,25 @@ QmlObjectScriptClass::property(QObject *obj, const Identifier &name)
#endif
}
} else {
- if (enginePriv->captureProperties && !(lastData->flags & QmlPropertyCache::Data::IsConstant)) {
+ if (enginePriv->captureProperties && !(lastData->flags & QDeclarativePropertyCache::Data::IsConstant)) {
enginePriv->capturedProperties <<
- QmlEnginePrivate::CapturedProperty(obj, lastData->coreIndex, lastData->notifyIndex);
+ QDeclarativeEnginePrivate::CapturedProperty(obj, lastData->coreIndex, lastData->notifyIndex);
}
if ((uint)lastData->propType < QVariant::UserType) {
- QmlValueType *valueType = enginePriv->valueTypes[lastData->propType];
+ QDeclarativeValueType *valueType = enginePriv->valueTypes[lastData->propType];
if (valueType)
return Value(scriptEngine, enginePriv->valueTypeClass->newObject(obj, lastData->coreIndex, valueType));
}
- if (lastData->flags & QmlPropertyCache::Data::IsQList) {
+ if (lastData->flags & QDeclarativePropertyCache::Data::IsQList) {
return Value(scriptEngine, enginePriv->listClass->newList(obj, lastData->coreIndex, lastData->propType));
- } else if (lastData->flags & QmlPropertyCache::Data::IsQObjectDerived) {
+ } else if (lastData->flags & QDeclarativePropertyCache::Data::IsQObjectDerived) {
QObject *rv = 0;
void *args[] = { &rv, 0 };
QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args);
return Value(scriptEngine, newQObject(rv, lastData->propType));
- } else if (lastData->flags & QmlPropertyCache::Data::IsQScriptValue) {
+ } else if (lastData->flags & QDeclarativePropertyCache::Data::IsQScriptValue) {
QScriptValue rv = scriptEngine->nullValue();
void *args[] = { &rv, 0 };
QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args);
@@ -293,17 +293,17 @@ QmlObjectScriptClass::property(QObject *obj, const Identifier &name)
}
}
-void QmlObjectScriptClass::setProperty(Object *object,
+void QDeclarativeObjectScriptClass::setProperty(Object *object,
const Identifier &name,
const QScriptValue &value)
{
return setProperty(toQObject(object), name, value);
}
-void QmlObjectScriptClass::setProperty(QObject *obj,
+void QDeclarativeObjectScriptClass::setProperty(QObject *obj,
const Identifier &name,
const QScriptValue &value,
- QmlContext *evalContext)
+ QDeclarativeContext *evalContext)
{
Q_UNUSED(name);
@@ -318,7 +318,7 @@ void QmlObjectScriptClass::setProperty(QObject *obj,
return;
}
- if (!(lastData->flags & QmlPropertyCache::Data::IsWritable)) {
+ if (!(lastData->flags & QDeclarativePropertyCache::Data::IsWritable)) {
QString error = QLatin1String("Cannot assign to read-only property \"") +
toString(name) + QLatin1Char('\"');
if (context())
@@ -326,10 +326,10 @@ void QmlObjectScriptClass::setProperty(QObject *obj,
return;
}
- QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine);
if (!evalContext && context()) {
- // Global object, QScriptContext activation object, QmlContext object
+ // Global object, QScriptContext activation object, QDeclarativeContext object
QScriptValue scopeNode = scopeChainValue(context(), -3);
if (scopeNode.isValid()) {
Q_ASSERT(scriptClass(scopeNode) == enginePriv->contextClass);
@@ -338,26 +338,26 @@ void QmlObjectScriptClass::setProperty(QObject *obj,
}
}
- QmlAbstractBinding *delBinding = QmlMetaPropertyPrivate::setBinding(obj, *lastData, 0);
+ QDeclarativeAbstractBinding *delBinding = QDeclarativePropertyPrivate::setBinding(obj, *lastData, 0);
if (delBinding)
delBinding->destroy();
- if (value.isUndefined() && lastData->flags & QmlPropertyCache::Data::IsResettable) {
+ if (value.isUndefined() && lastData->flags & QDeclarativePropertyCache::Data::IsResettable) {
void *a[] = { 0 };
QMetaObject::metacall(obj, QMetaObject::ResetProperty, lastData->coreIndex, a);
} else {
// ### Can well known types be optimized?
- QVariant v = QmlScriptClass::toVariant(engine, value);
- QmlMetaPropertyPrivate::write(obj, *lastData, v, evalContext);
+ QVariant v = QDeclarativeScriptClass::toVariant(engine, value);
+ QDeclarativePropertyPrivate::write(obj, *lastData, v, evalContext);
}
}
-bool QmlObjectScriptClass::isQObject() const
+bool QDeclarativeObjectScriptClass::isQObject() const
{
return true;
}
-QObject *QmlObjectScriptClass::toQObject(Object *object, bool *ok)
+QObject *QDeclarativeObjectScriptClass::toQObject(Object *object, bool *ok)
{
if (ok) *ok = true;
@@ -365,7 +365,7 @@ QObject *QmlObjectScriptClass::toQObject(Object *object, bool *ok)
return data->object.data();
}
-QScriptValue QmlObjectScriptClass::tostring(QScriptContext *context, QScriptEngine *)
+QScriptValue QDeclarativeObjectScriptClass::tostring(QScriptContext *context, QScriptEngine *)
{
QObject* obj = context->thisObject().toQObject();
@@ -390,7 +390,7 @@ QScriptValue QmlObjectScriptClass::tostring(QScriptContext *context, QScriptEngi
return QScriptValue(ret);
}
-QScriptValue QmlObjectScriptClass::destroy(QScriptContext *context, QScriptEngine *engine)
+QScriptValue QDeclarativeObjectScriptClass::destroy(QScriptContext *context, QScriptEngine *engine)
{
QObject* obj = context->thisObject().toQObject();
if(obj){
@@ -405,16 +405,16 @@ QScriptValue QmlObjectScriptClass::destroy(QScriptContext *context, QScriptEngin
return engine->nullValue();
}
-QStringList QmlObjectScriptClass::propertyNames(Object *object)
+QStringList QDeclarativeObjectScriptClass::propertyNames(Object *object)
{
QObject *obj = toQObject(object);
if (!obj)
return QStringList();
- QmlEnginePrivate *enginePrivate = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *enginePrivate = QDeclarativeEnginePrivate::get(engine);
- QmlPropertyCache *cache = 0;
- QmlDeclarativeData *ddata = QmlDeclarativeData::get(obj);
+ QDeclarativePropertyCache *cache = 0;
+ QDeclarativeDeclarativeData *ddata = QDeclarativeDeclarativeData::get(obj);
if (ddata)
cache = ddata->propertyCache;
if (!cache) {
@@ -431,26 +431,26 @@ QStringList QmlObjectScriptClass::propertyNames(Object *object)
#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE)
struct MethodData : public QScriptDeclarativeClass::Object {
- MethodData(QObject *o, const QmlPropertyCache::Data &d) : object(o), data(d) {}
+ MethodData(QObject *o, const QDeclarativePropertyCache::Data &d) : object(o), data(d) {}
- QmlGuard<QObject> object;
- QmlPropertyCache::Data data;
+ QDeclarativeGuard<QObject> object;
+ QDeclarativePropertyCache::Data data;
};
-QmlObjectMethodScriptClass::QmlObjectMethodScriptClass(QmlEngine *bindEngine)
-: QScriptDeclarativeClass(QmlEnginePrivate::getScriptEngine(bindEngine)),
+QDeclarativeObjectMethodScriptClass::QDeclarativeObjectMethodScriptClass(QDeclarativeEngine *bindEngine)
+: QScriptDeclarativeClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)),
engine(bindEngine)
{
setSupportsCall(true);
}
-QmlObjectMethodScriptClass::~QmlObjectMethodScriptClass()
+QDeclarativeObjectMethodScriptClass::~QDeclarativeObjectMethodScriptClass()
{
}
-QScriptValue QmlObjectMethodScriptClass::newMethod(QObject *object, const QmlPropertyCache::Data *method)
+QScriptValue QDeclarativeObjectMethodScriptClass::newMethod(QObject *object, const QDeclarativePropertyCache::Data *method)
{
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
return newObject(scriptEngine, this, new MethodData(object, *method));
}
@@ -461,9 +461,9 @@ struct MetaCallArgument {
inline ~MetaCallArgument();
inline void *dataPtr();
- inline void initAsType(int type, QmlEngine *);
- void fromScriptValue(int type, QmlEngine *, const QScriptValue &);
- inline QScriptDeclarativeClass::Value toValue(QmlEngine *);
+ inline void initAsType(int type, QDeclarativeEngine *);
+ void fromScriptValue(int type, QDeclarativeEngine *, const QScriptValue &);
+ inline QScriptDeclarativeClass::Value toValue(QDeclarativeEngine *);
private:
MetaCallArgument(const MetaCallArgument &);
@@ -504,12 +504,12 @@ void *MetaCallArgument::dataPtr()
return (void *)data;
}
-void MetaCallArgument::initAsType(int callType, QmlEngine *e)
+void MetaCallArgument::initAsType(int callType, QDeclarativeEngine *e)
{
if (type != 0) { cleanup(); type = 0; }
if (callType == 0) return;
- QScriptEngine *engine = QmlEnginePrivate::getScriptEngine(e);
+ QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(e);
if (callType == qMetaTypeId<QScriptValue>()) {
new (data) QScriptValue(engine->undefinedValue());
@@ -535,7 +535,7 @@ void MetaCallArgument::initAsType(int callType, QmlEngine *e)
}
}
-void MetaCallArgument::fromScriptValue(int callType, QmlEngine *engine, const QScriptValue &value)
+void MetaCallArgument::fromScriptValue(int callType, QDeclarativeEngine *engine, const QScriptValue &value)
{
if (type != 0) { cleanup(); type = 0; }
@@ -567,13 +567,13 @@ void MetaCallArgument::fromScriptValue(int callType, QmlEngine *engine, const QS
*((QObject **)data) = value.toQObject();
type = callType;
} else if (callType == qMetaTypeId<QVariant>()) {
- new (data) QVariant(QmlScriptClass::toVariant(engine, value));
+ new (data) QVariant(QDeclarativeScriptClass::toVariant(engine, value));
type = callType;
} else {
new (data) QVariant();
type = -1;
- QVariant v = QmlScriptClass::toVariant(engine, value);
+ QVariant v = QDeclarativeScriptClass::toVariant(engine, value);
if (v.userType() == callType) {
*((QVariant *)data) = v;
} else if (v.canConvert((QVariant::Type)callType)) {
@@ -585,9 +585,9 @@ void MetaCallArgument::fromScriptValue(int callType, QmlEngine *engine, const QS
}
}
-QScriptDeclarativeClass::Value MetaCallArgument::toValue(QmlEngine *e)
+QScriptDeclarativeClass::Value MetaCallArgument::toValue(QDeclarativeEngine *e)
{
- QScriptEngine *engine = QmlEnginePrivate::getScriptEngine(e);
+ QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(e);
if (type == qMetaTypeId<QScriptValue>()) {
return QScriptDeclarativeClass::Value(engine, *((QScriptValue *)data));
@@ -604,19 +604,19 @@ QScriptDeclarativeClass::Value MetaCallArgument::toValue(QmlEngine *e)
} else if (type == QMetaType::QString) {
return QScriptDeclarativeClass::Value(engine, *((QString *)data));
} else if (type == QMetaType::QObjectStar) {
- return QScriptDeclarativeClass::Value(engine, QmlEnginePrivate::get(e)->objectClass->newQObject(*((QObject **)data)));
+ return QScriptDeclarativeClass::Value(engine, QDeclarativeEnginePrivate::get(e)->objectClass->newQObject(*((QObject **)data)));
} else if (type == -1 || type == qMetaTypeId<QVariant>()) {
- return QScriptDeclarativeClass::Value(engine, QmlEnginePrivate::get(e)->scriptValueFromVariant(*((QVariant *)data)));
+ return QScriptDeclarativeClass::Value(engine, QDeclarativeEnginePrivate::get(e)->scriptValueFromVariant(*((QVariant *)data)));
} else {
return QScriptDeclarativeClass::Value();
}
}
-QmlObjectMethodScriptClass::Value QmlObjectMethodScriptClass::call(Object *o, QScriptContext *ctxt)
+QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass::call(Object *o, QScriptContext *ctxt)
{
MethodData *method = static_cast<MethodData *>(o);
- if (method->data.flags & QmlPropertyCache::Data::HasArguments) {
+ if (method->data.flags & QDeclarativePropertyCache::Data::HasArguments) {
QMetaMethod m = method->object->metaObject()->method(method->data.coreIndex);
QList<QByteArray> argTypeNames = m.parameterTypes();
diff --git a/src/declarative/qml/qmlobjectscriptclass_p.h b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h
index 729f34f..8023756 100644
--- a/src/declarative/qml/qmlobjectscriptclass_p.h
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLOBJECTSCRIPTCLASS_P_H
-#define QMLOBJECTSCRIPTCLASS_P_H
+#ifndef QDECLARATIVEOBJECTSCRIPTCLASS_P_H
+#define QDECLARATIVEOBJECTSCRIPTCLASS_P_H
//
// W A R N I N G
@@ -53,39 +53,39 @@
// We mean it.
//
-#include "qmlpropertycache_p.h"
-#include "qmltypenamecache_p.h"
+#include "qdeclarativepropertycache_p.h"
+#include "qdeclarativetypenamecache_p.h"
-#include <private/qmlscriptclass_p.h>
+#include <private/qdeclarativescriptclass_p.h>
QT_BEGIN_NAMESPACE
-class QmlEngine;
+class QDeclarativeEngine;
class QScriptContext;
class QScriptEngine;
-class QmlContext;
+class QDeclarativeContext;
#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE)
-class Q_AUTOTEST_EXPORT QmlObjectMethodScriptClass : public QScriptDeclarativeClass
+class Q_AUTOTEST_EXPORT QDeclarativeObjectMethodScriptClass : public QScriptDeclarativeClass
{
public:
- QmlObjectMethodScriptClass(QmlEngine *);
- ~QmlObjectMethodScriptClass();
+ QDeclarativeObjectMethodScriptClass(QDeclarativeEngine *);
+ ~QDeclarativeObjectMethodScriptClass();
- QScriptValue newMethod(QObject *, const QmlPropertyCache::Data *);
+ QScriptValue newMethod(QObject *, const QDeclarativePropertyCache::Data *);
protected:
virtual Value call(Object *, QScriptContext *);
private:
- QmlEngine *engine;
+ QDeclarativeEngine *engine;
};
#endif
-class Q_AUTOTEST_EXPORT QmlObjectScriptClass : public QmlScriptClass
+class Q_AUTOTEST_EXPORT QDeclarativeObjectScriptClass : public QDeclarativeScriptClass
{
public:
- QmlObjectScriptClass(QmlEngine *);
- ~QmlObjectScriptClass();
+ QDeclarativeObjectScriptClass(QDeclarativeEngine *);
+ ~QDeclarativeObjectScriptClass();
QScriptValue newQObject(QObject *, int type = QMetaType::QObjectStar);
QObject *toQObject(const QScriptValue &) const;
@@ -99,13 +99,13 @@ public:
QScriptClass::QueryFlags queryProperty(QObject *, const Identifier &,
QScriptClass::QueryFlags flags,
- QmlContext *evalContext,
+ QDeclarativeContext *evalContext,
QueryHints hints = 0);
ScriptValue property(QObject *, const Identifier &);
void setProperty(QObject *, const Identifier &name, const QScriptValue &,
- QmlContext *evalContext = 0);
+ QDeclarativeContext *evalContext = 0);
virtual QStringList propertyNames(Object *);
protected:
@@ -119,12 +119,12 @@ protected:
private:
#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE)
- QmlObjectMethodScriptClass methods;
+ QDeclarativeObjectMethodScriptClass methods;
#endif
- QmlTypeNameCache::Data *lastTNData;
- QmlPropertyCache::Data *lastData;
- QmlPropertyCache::Data local;
+ QDeclarativeTypeNameCache::Data *lastTNData;
+ QDeclarativePropertyCache::Data *lastData;
+ QDeclarativePropertyCache::Data local;
PersistentIdentifier m_destroyId;
PersistentIdentifier m_toStringId;
@@ -134,11 +134,11 @@ private:
static QScriptValue tostring(QScriptContext *context, QScriptEngine *engine);
static QScriptValue destroy(QScriptContext *context, QScriptEngine *engine);
- QmlEngine *engine;
+ QDeclarativeEngine *engine;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QmlObjectScriptClass::QueryHints);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeObjectScriptClass::QueryHints);
QT_END_NAMESPACE
-#endif // QMLOBJECTSCRIPTCLASS_P_H
+#endif // QDECLARATIVEOBJECTSCRIPTCLASS_P_H
diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qdeclarativeparser.cpp
index f2690e2..5ac49d5 100644
--- a/src/declarative/qml/qmlparser.cpp
+++ b/src/declarative/qml/qdeclarativeparser.cpp
@@ -39,18 +39,18 @@
**
****************************************************************************/
-#include "qmlparser_p.h"
+#include "qdeclarativeparser_p.h"
-#include "qmlpropertyvaluesource.h"
-#include "qmlvme_p.h"
-#include "qml.h"
-#include "qmlcomponent_p.h"
-#include "qmlcomponent.h"
+#include "qdeclarativepropertyvaluesource.h"
+#include "qdeclarativevme_p.h"
+#include "qdeclarative.h"
+#include "qdeclarativecomponent_p.h"
+#include "qdeclarativecomponent.h"
#include "qmetaobjectbuilder_p.h"
-#include "qmlvmemetaobject_p.h"
-#include "qmlcompiler_p.h"
-#include "parser/qmljsast_p.h"
-#include "parser/qmljsengine_p.h"
+#include "qdeclarativevmemetaobject_p.h"
+#include "qdeclarativecompiler_p.h"
+#include "parser/qdeclarativejsast_p.h"
+#include "parser/qdeclarativejsengine_p.h"
#include <qfxperf_p_p.h>
@@ -63,15 +63,15 @@
QT_BEGIN_NAMESPACE
-using namespace QmlJS;
-using namespace QmlParser;
+using namespace QDeclarativeJS;
+using namespace QDeclarativeParser;
-QmlParser::Object::Object()
+QDeclarativeParser::Object::Object()
: type(-1), majorVersion(-1), minorVersion(-1), idIndex(-1), metatype(0), defaultProperty(0), parserStatusCast(-1)
{
}
-QmlParser::Object::~Object()
+QDeclarativeParser::Object::~Object()
{
if (defaultProperty) defaultProperty->release();
foreach(Property *prop, properties)
@@ -112,7 +112,7 @@ const QMetaObject *Object::metaObject() const
return metatype;
}
-QmlParser::Property *Object::getDefaultProperty()
+QDeclarativeParser::Property *Object::getDefaultProperty()
{
if (!defaultProperty) {
defaultProperty = new Property;
@@ -121,44 +121,44 @@ QmlParser::Property *Object::getDefaultProperty()
return defaultProperty;
}
-void QmlParser::Object::addValueProperty(Property *p)
+void QDeclarativeParser::Object::addValueProperty(Property *p)
{
p->addref();
valueProperties << p;
}
-void QmlParser::Object::addSignalProperty(Property *p)
+void QDeclarativeParser::Object::addSignalProperty(Property *p)
{
p->addref();
signalProperties << p;
}
-void QmlParser::Object::addAttachedProperty(Property *p)
+void QDeclarativeParser::Object::addAttachedProperty(Property *p)
{
p->addref();
attachedProperties << p;
}
-void QmlParser::Object::addGroupedProperty(Property *p)
+void QDeclarativeParser::Object::addGroupedProperty(Property *p)
{
p->addref();
groupedProperties << p;
}
-void QmlParser::Object::addValueTypeProperty(Property *p)
+void QDeclarativeParser::Object::addValueTypeProperty(Property *p)
{
p->addref();
valueTypeProperties << p;
}
-void QmlParser::Object::addScriptStringProperty(Property *p, int stack)
+void QDeclarativeParser::Object::addScriptStringProperty(Property *p, int stack)
{
p->addref();
scriptStringProperties << qMakePair(p, stack);
}
-Property *QmlParser::Object::getProperty(const QByteArray &name, bool create)
+Property *QDeclarativeParser::Object::getProperty(const QByteArray &name, bool create)
{
if (!properties.contains(name)) {
if (create) {
@@ -172,12 +172,12 @@ Property *QmlParser::Object::getProperty(const QByteArray &name, bool create)
return properties[name];
}
-QmlParser::Object::DynamicProperty::DynamicProperty()
+QDeclarativeParser::Object::DynamicProperty::DynamicProperty()
: isDefaultProperty(false), type(Variant), defaultValue(0)
{
}
-QmlParser::Object::DynamicProperty::DynamicProperty(const DynamicProperty &o)
+QDeclarativeParser::Object::DynamicProperty::DynamicProperty(const DynamicProperty &o)
: isDefaultProperty(o.isDefaultProperty),
type(o.type),
customType(o.customType),
@@ -187,98 +187,98 @@ QmlParser::Object::DynamicProperty::DynamicProperty(const DynamicProperty &o)
{
}
-QmlParser::Object::DynamicSignal::DynamicSignal()
+QDeclarativeParser::Object::DynamicSignal::DynamicSignal()
{
}
-QmlParser::Object::DynamicSignal::DynamicSignal(const DynamicSignal &o)
+QDeclarativeParser::Object::DynamicSignal::DynamicSignal(const DynamicSignal &o)
: name(o.name), parameterTypes(o.parameterTypes),
parameterNames(o.parameterNames)
{
}
-QmlParser::Object::DynamicSlot::DynamicSlot()
+QDeclarativeParser::Object::DynamicSlot::DynamicSlot()
{
}
-QmlParser::Object::DynamicSlot::DynamicSlot(const DynamicSlot &o)
+QDeclarativeParser::Object::DynamicSlot::DynamicSlot(const DynamicSlot &o)
: name(o.name), body(o.body), parameterNames(o.parameterNames)
{
}
-QmlParser::Property::Property()
+QDeclarativeParser::Property::Property()
: parent(0), type(0), index(-1), value(0), isDefault(true), isDeferred(false)
{
}
-QmlParser::Property::Property(const QByteArray &n)
+QDeclarativeParser::Property::Property(const QByteArray &n)
: parent(0), type(0), index(-1), value(0), name(n), isDefault(false),
isDeferred(false)
{
}
-QmlParser::Property::~Property()
+QDeclarativeParser::Property::~Property()
{
foreach(Value *value, values)
value->release();
if (value) value->release();
}
-Object *QmlParser::Property::getValue()
+Object *QDeclarativeParser::Property::getValue()
{
if (!value) value = new Object;
return value;
}
-void QmlParser::Property::addValue(Value *v)
+void QDeclarativeParser::Property::addValue(Value *v)
{
values << v;
}
-bool QmlParser::Property::isEmpty() const
+bool QDeclarativeParser::Property::isEmpty() const
{
return !value && values.isEmpty();
}
-QmlParser::Value::Value()
+QDeclarativeParser::Value::Value()
: type(Unknown), object(0)
{
}
-QmlParser::Value::~Value()
+QDeclarativeParser::Value::~Value()
{
if (object) object->release();
}
-QmlParser::Variant::Variant()
+QDeclarativeParser::Variant::Variant()
: t(Invalid) {}
-QmlParser::Variant::Variant(const Variant &o)
+QDeclarativeParser::Variant::Variant(const Variant &o)
: t(o.t), d(o.d), s(o.s)
{
}
-QmlParser::Variant::Variant(bool v)
+QDeclarativeParser::Variant::Variant(bool v)
: t(Boolean), b(v)
{
}
-QmlParser::Variant::Variant(double v, const QString &asWritten)
+QDeclarativeParser::Variant::Variant(double v, const QString &asWritten)
: t(Number), d(v), s(asWritten)
{
}
-QmlParser::Variant::Variant(const QString &v)
+QDeclarativeParser::Variant::Variant(const QString &v)
: t(String), s(v)
{
}
-QmlParser::Variant::Variant(const QString &v, QmlJS::AST::Node *n)
+QDeclarativeParser::Variant::Variant(const QString &v, QDeclarativeJS::AST::Node *n)
: t(Script), n(n), s(v)
{
}
-QmlParser::Variant &QmlParser::Variant::operator=(const Variant &o)
+QDeclarativeParser::Variant &QDeclarativeParser::Variant::operator=(const Variant &o)
{
t = o.t;
d = o.d;
@@ -286,27 +286,27 @@ QmlParser::Variant &QmlParser::Variant::operator=(const Variant &o)
return *this;
}
-QmlParser::Variant::Type QmlParser::Variant::type() const
+QDeclarativeParser::Variant::Type QDeclarativeParser::Variant::type() const
{
return t;
}
-bool QmlParser::Variant::asBoolean() const
+bool QDeclarativeParser::Variant::asBoolean() const
{
return b;
}
-QString QmlParser::Variant::asString() const
+QString QDeclarativeParser::Variant::asString() const
{
return s;
}
-double QmlParser::Variant::asNumber() const
+double QDeclarativeParser::Variant::asNumber() const
{
return d;
}
-QString QmlParser::Variant::asScript() const
+QString QDeclarativeParser::Variant::asScript() const
{
switch(type()) {
default:
@@ -325,7 +325,7 @@ QString QmlParser::Variant::asScript() const
}
}
-QmlJS::AST::Node *QmlParser::Variant::asAST() const
+QDeclarativeJS::AST::Node *QDeclarativeParser::Variant::asAST() const
{
if (type() == Script)
return n;
@@ -333,7 +333,7 @@ QmlJS::AST::Node *QmlParser::Variant::asAST() const
return 0;
}
-bool QmlParser::Variant::isStringList() const
+bool QDeclarativeParser::Variant::isStringList() const
{
if (isString())
return true;
@@ -358,7 +358,7 @@ bool QmlParser::Variant::isStringList() const
return true;
}
-QStringList QmlParser::Variant::asStringList() const
+QStringList QDeclarativeParser::Variant::asStringList() const
{
QStringList rv;
if (isString()) {
diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h
index 222229b..aae507e 100644
--- a/src/declarative/qml/qmlparser_p.h
+++ b/src/declarative/qml/qdeclarativeparser_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLPARSER_P_H
-#define QMLPARSER_P_H
+#ifndef QDECLARATIVEPARSER_P_H
+#define QDECLARATIVEPARSER_P_H
//
// W A R N I N G
@@ -53,12 +53,14 @@
// We mean it.
//
-#include "qml.h"
-#include "qmlrefcount_p.h"
+#include "qdeclarative.h"
+#include "qdeclarativerefcount_p.h"
-#include <QtCore/QByteArray>
-#include <QtCore/QList>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qurl.h>
#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
#include <private/qobject_p.h>
@@ -68,20 +70,20 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-namespace QmlJS { namespace AST { class Node; } }
+namespace QDeclarativeJS { namespace AST { class Node; } }
/*
XXX
- These types are created (and owned) by the QmlXmlParser and consumed by the
- QmlCompiler. During the compilation phase the compiler will update some of
- the fields for both its own use and for the use of the upcoming QmlDom API.
+ These types are created (and owned) by the QDeclarativeXmlParser and consumed by the
+ QDeclarativeCompiler. During the compilation phase the compiler will update some of
+ the fields for both its own use and for the use of the upcoming QDeclarativeDom API.
- The types are part of the generic sounding "QmlParser" namespace for legacy
+ The types are part of the generic sounding "QDeclarativeParser" namespace for legacy
reasons (there used to be more in this namespace) and will be cleaned up and
migrated into a more appropriate location shortly.
*/
-namespace QmlParser
+namespace QDeclarativeParser
{
struct Location
{
@@ -105,14 +107,14 @@ namespace QmlParser
};
class Property;
- class Object : public QmlRefCount
+ class Object : public QDeclarativeRefCount
{
public:
Object();
virtual ~Object();
// Type of the object. The integer is an index into the
- // QmlCompiledData::types array, or -1 if the object is a property
+ // QDeclarativeCompiledData::types array, or -1 if the object is a property
// group.
int type;
// The url of this object if it is an external type. Used by the DOM
@@ -126,9 +128,9 @@ namespace QmlParser
QByteArray typeName;
// The class name
QByteArray className;
- // The id assigned to the object (if any). Set by the QmlCompiler
+ // The id assigned to the object (if any). Set by the QDeclarativeCompiler
QString id;
- // The id index assigned to the object (if any). Set by the QmlCompiler
+ // The id index assigned to the object (if any). Set by the QDeclarativeCompiler
int idIndex;
// Custom parsed data
QByteArray custom;
@@ -178,9 +180,9 @@ namespace QmlParser
};
QList<ScriptBlock> scripts;
- // The bytes to cast instances by to get to the QmlParserStatus
+ // The bytes to cast instances by to get to the QDeclarativeParserStatus
// interface. -1 indicates the type doesn't support this interface.
- // Set by the QmlCompiler.
+ // Set by the QDeclarativeCompiler.
int parserStatusCast;
LocationSpan location;
@@ -195,7 +197,7 @@ namespace QmlParser
Type type;
QByteArray customType;
QByteArray name;
- QmlParser::Property *defaultValue;
+ QDeclarativeParser::Property *defaultValue;
LocationSpan location;
};
struct DynamicSignal {
@@ -239,7 +241,7 @@ namespace QmlParser
Variant(bool);
Variant(double, const QString &asWritten=QString());
Variant(const QString &);
- Variant(const QString &, QmlJS::AST::Node *);
+ Variant(const QString &, QDeclarativeJS::AST::Node *);
Variant &operator=(const Variant &);
Type type() const;
@@ -254,7 +256,7 @@ namespace QmlParser
QString asString() const;
double asNumber() const;
QString asScript() const;
- QmlJS::AST::Node *asAST() const;
+ QDeclarativeJS::AST::Node *asAST() const;
QStringList asStringList() const;
private:
@@ -262,12 +264,12 @@ namespace QmlParser
union {
bool b;
double d;
- QmlJS::AST::Node *n;
+ QDeclarativeJS::AST::Node *n;
};
QString s;
};
- class Value : public QmlRefCount
+ class Value : public QDeclarativeRefCount
{
public:
Value();
@@ -280,9 +282,9 @@ namespace QmlParser
Literal,
// This is used as a property binding assignment
PropertyBinding,
- // This is used as a QmlPropertyValueSource assignment
+ // This is used as a QDeclarativePropertyValueSource assignment
ValueSource,
- // This is used as a QmlPropertyValueInterceptor assignment
+ // This is used as a QDeclarativePropertyValueInterceptor assignment
ValueInterceptor,
// This is used as a property QObject assignment
CreatedObject,
@@ -306,7 +308,7 @@ namespace QmlParser
LocationSpan location;
};
- class Property : public QmlRefCount
+ class Property : public QDeclarativeRefCount
{
public:
Property();
@@ -339,7 +341,7 @@ namespace QmlParser
// True if this property was accessed as the default property.
bool isDefault;
// True if the setting of this property will be deferred. Set by the
- // QmlCompiler
+ // QDeclarativeCompiler
bool isDeferred;
LocationSpan location;
@@ -350,8 +352,8 @@ namespace QmlParser
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QmlParser::Variant)
+Q_DECLARE_METATYPE(QDeclarativeParser::Variant)
QT_END_HEADER
-#endif // QMLPARSER_P_H
+#endif // QDECLARATIVEPARSER_P_H
diff --git a/src/declarative/qml/qmlparserstatus.cpp b/src/declarative/qml/qdeclarativeparserstatus.cpp
index 315bc75..ec6260e 100644
--- a/src/declarative/qml/qmlparserstatus.cpp
+++ b/src/declarative/qml/qdeclarativeparserstatus.cpp
@@ -39,24 +39,24 @@
**
****************************************************************************/
-#include "qmlparserstatus.h"
+#include "qdeclarativeparserstatus.h"
QT_BEGIN_NAMESPACE
/*!
- \class QmlParserStatus
+ \class QDeclarativeParserStatus
\since 4.7
- \brief The QmlParserStatus class provides updates on the parser state.
+ \brief The QDeclarativeParserStatus class provides updates on the parser state.
*/
/*! \internal */
-QmlParserStatus::QmlParserStatus()
+QDeclarativeParserStatus::QDeclarativeParserStatus()
: d(0)
{
}
/*! \internal */
-QmlParserStatus::~QmlParserStatus()
+QDeclarativeParserStatus::~QDeclarativeParserStatus()
{
if(d)
(*d) = 0;
@@ -65,7 +65,7 @@ QmlParserStatus::~QmlParserStatus()
/*!
Invoked after class creation, but before any properties have been set.
*/
-void QmlParserStatus::classBegin()
+void QDeclarativeParserStatus::classBegin()
{
}
@@ -74,7 +74,7 @@ void QmlParserStatus::classBegin()
completed construction. At this point all static values and binding values
have been assigned to the class.
*/
-void QmlParserStatus::componentComplete()
+void QDeclarativeParserStatus::componentComplete()
{
}
diff --git a/src/declarative/qml/qmlparserstatus.h b/src/declarative/qml/qdeclarativeparserstatus.h
index e4cfe8b..34528c1 100644
--- a/src/declarative/qml/qmlparserstatus.h
+++ b/src/declarative/qml/qdeclarativeparserstatus.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLPARSERSTATUS_H
-#define QMLPARSERSTATUS_H
+#ifndef QDECLARATIVEPARSERSTATUS_H
+#define QDECLARATIVEPARSERSTATUS_H
#include <QtCore/qobject.h>
@@ -50,26 +50,26 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class Q_DECLARATIVE_EXPORT QmlParserStatus
+class Q_DECLARATIVE_EXPORT QDeclarativeParserStatus
{
public:
- QmlParserStatus();
- virtual ~QmlParserStatus();
+ QDeclarativeParserStatus();
+ virtual ~QDeclarativeParserStatus();
virtual void classBegin();
virtual void componentComplete();
private:
- friend class QmlVME;
- friend class QmlComponent;
- friend class QmlComponentPrivate;
- friend class QmlEnginePrivate;
- QmlParserStatus **d;
+ friend class QDeclarativeVME;
+ friend class QDeclarativeComponent;
+ friend class QDeclarativeComponentPrivate;
+ friend class QDeclarativeEnginePrivate;
+ QDeclarativeParserStatus **d;
};
-Q_DECLARE_INTERFACE(QmlParserStatus, "com.trolltech.qml.QmlParserStatus")
+Q_DECLARE_INTERFACE(QDeclarativeParserStatus, "com.trolltech.qml.QDeclarativeParserStatus")
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLPARSERSTATUS_H
+#endif // QDECLARATIVEPARSERSTATUS_H
diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qdeclarativeprivate.h
index e5ea07f..01369d4 100644
--- a/src/declarative/qml/qmlprivate.h
+++ b/src/declarative/qml/qdeclarativeprivate.h
@@ -39,15 +39,14 @@
**
****************************************************************************/
-#ifndef QMLPRIVATE_H
-#define QMLPRIVATE_H
+#ifndef QDECLARATIVEPRIVATE_H
+#define QDECLARATIVEPRIVATE_H
#include <QtCore/qglobal.h>
-
+#include <QtCore/qvariant.h>
#ifndef Q_OS_WIN
#include <stdint.h>
#endif
-#include <QtCore/qvariant.h>
QT_BEGIN_HEADER
@@ -55,13 +54,10 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-typedef QObject *(*QmlAttachedPropertiesFunc)(QObject *);
-
-//template<typename T>
-//struct qml_hasAttached { static bool const value = false; };
+typedef QObject *(*QDeclarativeAttachedPropertiesFunc)(QObject *);
template <typename TYPE>
-class QmlTypeInfo
+class QDeclarativeTypeInfo
{
public:
enum {
@@ -70,11 +66,15 @@ public:
};
-namespace QmlPrivate
+class QDeclarativeCustomParser;
+namespace QDeclarativePrivate
{
template<typename T>
QObject *create() { return new T; }
+ template<typename T>
+ QObject *createParent(QObject *p) { return new T(p); }
+
template<class From, class To, int N>
struct StaticCastSelectorClass
{
@@ -105,7 +105,7 @@ namespace QmlPrivate
template <typename T>
struct has_attachedPropertiesMember
{
- static bool const value = QmlTypeInfo<T>::hasAttachedProperties;
+ static bool const value = QDeclarativeTypeInfo<T>::hasAttachedProperties;
};
template <typename T, bool hasMember>
@@ -133,7 +133,7 @@ namespace QmlPrivate
class AttachedPropertySelector
{
public:
- static inline QmlAttachedPropertiesFunc func() { return 0; }
+ static inline QDeclarativeAttachedPropertiesFunc func() { return 0; }
static inline const QMetaObject *metaObject() { return 0; }
};
template<typename T>
@@ -147,7 +147,7 @@ namespace QmlPrivate
return &ReturnType::staticMetaObject;
}
public:
- static inline QmlAttachedPropertiesFunc func() {
+ static inline QDeclarativeAttachedPropertiesFunc func() {
return &attachedProperties;
}
static inline const QMetaObject *metaObject() {
@@ -156,7 +156,7 @@ namespace QmlPrivate
};
template<typename T>
- inline QmlAttachedPropertiesFunc attachedPropertiesFunc()
+ inline QDeclarativeAttachedPropertiesFunc attachedPropertiesFunc()
{
return AttachedPropertySelector<T, has_attachedPropertiesMethod<T, has_attachedPropertiesMember<T>::value>::value>::func();
}
@@ -167,45 +167,48 @@ namespace QmlPrivate
return AttachedPropertySelector<T, has_attachedPropertiesMethod<T, has_attachedPropertiesMember<T>::value>::value>::metaObject();
}
- struct MetaTypeIds {
+ struct RegisterType {
+ int version;
+
int typeId;
int listId;
- };
- typedef QObject *(*CreateFunc)(QObject *);
+ QObject *(*create)();
- template<typename T>
- struct CreateParent {
- static QObject *create(QObject *other) {
- return new T(other);
- }
- };
+ const char *uri;
+ int versionMajor;
+ int versionMinor;
+ const char *elementName;
+ const QMetaObject *metaObject;
- template<typename T>
- struct CreateNoParent {
- static QObject *create() {
- return new T;
- }
- };
+ QDeclarativeAttachedPropertiesFunc attachedPropertiesFunction;
+ const QMetaObject *attachedPropertiesMetaObject;
- struct Q_DECLARATIVE_EXPORT InstanceType {
- InstanceType(int);
- };
+ int parserStatusCast;
+ int valueSourceCast;
+ int valueInterceptorCast;
+
+ QObject *(*extensionObjectCreate)(QObject *);
+ const QMetaObject *extensionMetaObject;
- template<typename T, int VMAJ, int VMIN>
- struct Define {
- static InstanceType instance;
+ QDeclarativeCustomParser *customParser;
};
-
- template<typename T>
- struct ExtCreate {
- static QObject *create(QObject *other) {
- return new T(other);
- }
+
+ struct RegisterInterface {
+ int version;
+
+ int typeId;
+ int listId;
+
+ const char *iid;
};
+
+ int Q_DECLARATIVE_EXPORT registerType(const RegisterType &);
+ int Q_DECLARATIVE_EXPORT registerType(const RegisterInterface &);
+
}
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLPRIVATE_H
+#endif // QDECLARATIVEPRIVATE_H
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp
new file mode 100644
index 0000000..e1ec2cd
--- /dev/null
+++ b/src/declarative/qml/qdeclarativeproperty.cpp
@@ -0,0 +1,1306 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 "qdeclarativeproperty.h"
+#include "qdeclarativeproperty_p.h"
+
+#include "qdeclarativecompositetypedata_p.h"
+#include "qdeclarative.h"
+#include "qdeclarativebinding_p.h"
+#include "qdeclarativecontext.h"
+#include "qdeclarativecontext_p.h"
+#include "qdeclarativeboundsignal_p.h"
+#include "qdeclarativeengine.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativedeclarativedata_p.h"
+#include "qdeclarativestringconverters_p.h"
+#include "qdeclarativelist_p.h"
+#include "qdeclarativecompiler_p.h"
+
+#include <QStringList>
+#include <QtCore/qdebug.h>
+
+#include <math.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+\class QDeclarativeProperty
+\brief The QDeclarativeProperty class abstracts accessing properties on objects created from QML.
+
+As QML uses Qt's meta-type system all of the existing QMetaObject classes can be used to introspect
+and interact with objects created by QML. However, some of the new features provided by QML - such
+as type safety and attached properties - are most easily used through the QDeclarativeProperty class
+that simplifies some of their natural complexity.
+
+Unlike QMetaProperty which represents a property on a class type, QDeclarativeProperty encapsulates
+a property on a specific object instance. To read a property's value, programmers create a
+QDeclarativeProperty instance and call the read() method. Likewise to write a property value the
+write() method is used.
+
+\code
+
+QObject *object = declarativeComponent.create();
+
+QDeclarativeProperty property(object, "font.pixelSize");
+qWarning() << "Current pixel size:" << property.read().toInt();
+property.write(24);
+qWarning() << "Pixel size should now be 24:" << property.read().toInt();
+
+\endcode
+*/
+
+/*!
+ Create an invalid QDeclarativeProperty.
+*/
+QDeclarativeProperty::QDeclarativeProperty()
+: d(new QDeclarativePropertyPrivate)
+{
+ d->q = this;
+}
+
+/*! \internal */
+QDeclarativeProperty::~QDeclarativeProperty()
+{
+ delete d; d = 0;
+}
+
+/*!
+ Creates a QDeclarativeProperty for the default property of \a obj. If there is no
+ default property, an invalid QDeclarativeProperty will be created.
+ */
+QDeclarativeProperty::QDeclarativeProperty(QObject *obj)
+: d(new QDeclarativePropertyPrivate)
+{
+ d->q = this;
+ d->initDefault(obj);
+}
+
+/*!
+ Creates a QDeclarativeProperty for the default property of \a obj. If there is no
+ default property, an invalid QDeclarativeProperty will be created.
+ */
+QDeclarativeProperty::QDeclarativeProperty(QObject *obj, QDeclarativeContext *ctxt)
+: d(new QDeclarativePropertyPrivate)
+{
+ d->q = this;
+ d->context = ctxt;
+ d->engine = ctxt?ctxt->engine():0;
+ d->initDefault(obj);
+}
+
+/*!
+ Creates a QDeclarativeProperty for the default property of \a obj. If there is no
+ default property, an invalid QDeclarativeProperty will be created.
+ */
+QDeclarativeProperty::QDeclarativeProperty(QObject *obj, QDeclarativeEngine *engine)
+: d(new QDeclarativePropertyPrivate)
+{
+ d->q = this;
+ d->context = 0;
+ d->engine = engine;
+ d->initDefault(obj);
+}
+
+/*!
+ Initialize from the default property of \a obj
+*/
+void QDeclarativePropertyPrivate::initDefault(QObject *obj)
+{
+ if (!obj)
+ return;
+
+ QMetaProperty p = QDeclarativeMetaType::defaultProperty(obj);
+ core.load(p);
+ if (core.isValid())
+ object = obj;
+}
+
+/*!
+ Creates a QDeclarativeProperty for the property \a name of \a obj.
+ */
+QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name)
+: d(new QDeclarativePropertyPrivate)
+{
+ d->q = this;
+ d->initProperty(obj, name);
+ if (!isValid()) d->object = 0;
+}
+
+/*!
+ Creates a QDeclarativeProperty for the property \a name of \a obj.
+ */
+QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name, QDeclarativeContext *ctxt)
+: d(new QDeclarativePropertyPrivate)
+{
+ d->q = this;
+ d->context = ctxt;
+ d->engine = ctxt?ctxt->engine():0;
+ d->initProperty(obj, name);
+ if (!isValid()) { d->object = 0; d->context = 0; d->engine = 0; }
+}
+
+/*!
+ Creates a QDeclarativeProperty for the property \a name of \a obj.
+ */
+QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name, QDeclarativeEngine *engine)
+: d(new QDeclarativePropertyPrivate)
+{
+ d->q = this;
+ d->context = 0;
+ d->engine = engine;
+ d->initProperty(obj, name);
+ if (!isValid()) { d->object = 0; d->context = 0; d->engine = 0; }
+}
+
+Q_GLOBAL_STATIC(QDeclarativeValueTypeFactory, qmlValueTypes);
+
+void QDeclarativePropertyPrivate::initProperty(QObject *obj, const QString &name)
+{
+ if (!obj) return;
+
+ QDeclarativeTypeNameCache *typeNameCache = context?QDeclarativeContextPrivate::get(context)->imports:0;
+
+ QStringList path = name.split(QLatin1Char('.'));
+ if (path.isEmpty()) return;
+
+ QObject *currentObject = obj;
+
+ // Everything up to the last property must be an "object type" property
+ for (int ii = 0; ii < path.count() - 1; ++ii) {
+ const QString &pathName = path.at(ii);
+
+ if (QDeclarativeTypeNameCache::Data *data = typeNameCache?typeNameCache->data(pathName):0) {
+ if (data->type) {
+ QDeclarativeAttachedPropertiesFunc func = data->type->attachedPropertiesFunction();
+ if (!func) return; // Not an attachable type
+
+ currentObject = qmlAttachedPropertiesObjectById(data->type->index(), currentObject);
+ if (!currentObject) return; // Something is broken with the attachable type
+ } else {
+ Q_ASSERT(data->typeNamespace);
+ if ((ii + 1) == path.count()) return; // No type following the namespace
+
+ ++ii; data = data->typeNamespace->data(path.at(ii));
+ if (!data || !data->type) return; // Invalid type in namespace
+
+ QDeclarativeAttachedPropertiesFunc func = data->type->attachedPropertiesFunction();
+ if (!func) return; // Not an attachable type
+
+ currentObject = qmlAttachedPropertiesObjectById(data->type->index(), currentObject);
+ if (!currentObject) return; // Something is broken with the attachable type
+ }
+ } else {
+
+ QDeclarativePropertyCache::Data local;
+ QDeclarativePropertyCache::Data *property =
+ QDeclarativePropertyCache::property(engine, obj, pathName, local);
+
+ if (!property) return; // Not a property
+ if (property->flags & QDeclarativePropertyCache::Data::IsFunction)
+ return; // Not an object property
+
+ if (ii == (path.count() - 2) && property->propType < (int)QVariant::UserType) {
+ // We're now at a value type property. We can use a global valuetypes array as we
+ // never actually use the objects, just look up their properties.
+ QObject *typeObject = qmlValueTypes()->valueTypes[property->propType];
+ if (!typeObject) return; // Not a value type
+
+ int idx = typeObject->metaObject()->indexOfProperty(path.last().toUtf8().constData());
+ if (idx == -1) return; // Value type property does not exist
+
+ QMetaProperty vtProp = typeObject->metaObject()->property(idx);
+
+ object = currentObject;
+ core = *property;
+ valueType.flags = QDeclarativePropertyCache::Data::flagsForProperty(vtProp);
+ valueType.valueTypeCoreIdx = idx;
+ valueType.valueTypePropType = vtProp.userType();
+
+ return;
+ } else {
+ if (!(property->flags & QDeclarativePropertyCache::Data::IsQObjectDerived))
+ return; // Not an object property
+
+ void *args[] = { &currentObject, 0 };
+ QMetaObject::metacall(currentObject, QMetaObject::ReadProperty, property->coreIndex, args);
+ if (!currentObject) return; // No value
+
+ }
+ }
+
+ }
+
+ const QString &terminal = path.last();
+
+ if (terminal.count() >= 3 &&
+ terminal.at(0) == QLatin1Char('o') &&
+ terminal.at(1) == QLatin1Char('n') &&
+ terminal.at(2).isUpper()) {
+
+ QString signalName = terminal.mid(2);
+ signalName[0] = signalName.at(0).toLower();
+
+ QMetaMethod method = QDeclarativeCompiler::findSignalByName(currentObject->metaObject(), signalName.toLatin1().constData());
+ if (method.signature()) {
+ object = currentObject;
+ core.load(method);
+ return;
+ }
+ }
+
+ // Property
+ QDeclarativePropertyCache::Data local;
+ QDeclarativePropertyCache::Data *property =
+ QDeclarativePropertyCache::property(engine, currentObject, terminal, local);
+ if (property && !(property->flags & QDeclarativePropertyCache::Data::IsFunction)) {
+ object = currentObject;
+ core = *property;
+ }
+}
+
+/*!
+ Create a copy of \a other.
+*/
+QDeclarativeProperty::QDeclarativeProperty(const QDeclarativeProperty &other)
+: d(new QDeclarativePropertyPrivate(*other.d))
+{
+ d->q = this;
+}
+
+/*!
+ \enum QDeclarativeProperty::PropertyTypeCategory
+
+ This enum specifies a category of QML property.
+
+ \value InvalidCategory The property is invalid, or is a signal property.
+ \value List The property is a QDeclarativeListProperty list property
+ \value Object The property is a QObject derived type pointer
+ \value Normal The property is a normal value property.
+ */
+
+/*!
+ \enum QDeclarativeProperty::Type
+
+ This enum specifies a type of QML property.
+
+ \value Invalid The property is invalid.
+ \value Property The property is a regular Qt property.
+ \value SignalProperty The property is a signal property.
+*/
+
+/*!
+ Returns the property category.
+*/
+QDeclarativeProperty::PropertyTypeCategory QDeclarativeProperty::propertyTypeCategory() const
+{
+ return d->propertyTypeCategory();
+}
+
+QDeclarativeProperty::PropertyTypeCategory
+QDeclarativePropertyPrivate::propertyTypeCategory() const
+{
+ uint type = q->type();
+
+ if (isValueType()) {
+ return QDeclarativeProperty::Normal;
+ } else if (type & QDeclarativeProperty::Property) {
+ int type = propertyType();
+ if (type == QVariant::Invalid)
+ return QDeclarativeProperty::InvalidCategory;
+ else if ((uint)type < QVariant::UserType)
+ return QDeclarativeProperty::Normal;
+ else if (core.flags & QDeclarativePropertyCache::Data::IsQObjectDerived)
+ return QDeclarativeProperty::Object;
+ else if (core.flags & QDeclarativePropertyCache::Data::IsQList)
+ return QDeclarativeProperty::List;
+ else
+ return QDeclarativeProperty::Normal;
+ } else {
+ return QDeclarativeProperty::InvalidCategory;
+ }
+}
+
+/*!
+ Returns the type name of the property, or 0 if the property has no type
+ name.
+*/
+const char *QDeclarativeProperty::propertyTypeName() const
+{
+ if (d->isValueType()) {
+
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(d->context);
+ QDeclarativeValueType *valueType = 0;
+ if (ep) valueType = ep->valueTypes[d->core.propType];
+ else valueType = QDeclarativeValueTypeFactory::valueType(d->core.propType);
+ Q_ASSERT(valueType);
+
+ const char *rv = valueType->metaObject()->property(d->valueType.valueTypeCoreIdx).typeName();
+
+ if (!ep) delete valueType;
+
+ return rv;
+ } else if (d->object && type() & Property && d->core.isValid()) {
+ return d->object->metaObject()->property(d->core.coreIndex).typeName();
+ } else {
+ return 0;
+ }
+}
+
+/*!
+ Returns true if \a other and this QDeclarativeProperty represent the same
+ property.
+*/
+bool QDeclarativeProperty::operator==(const QDeclarativeProperty &other) const
+{
+ // category is intentially omitted here as it is generated
+ // from the other members
+ return d->object == other.d->object &&
+ d->core == other.d->core &&
+ d->valueType == other.d->valueType;
+}
+
+/*!
+ Returns the QVariant type of the property, or QVariant::Invalid if the
+ property has no QVariant type.
+*/
+int QDeclarativeProperty::propertyType() const
+{
+ return d->propertyType();
+}
+
+bool QDeclarativePropertyPrivate::isValueType() const
+{
+ return valueType.valueTypeCoreIdx != -1;
+}
+
+int QDeclarativePropertyPrivate::propertyType() const
+{
+ uint type = q->type();
+ if (isValueType()) {
+ return valueType.valueTypePropType;
+ } else if (type & QDeclarativeProperty::Property) {
+ if (core.propType == (int)QVariant::LastType)
+ return qMetaTypeId<QVariant>();
+ else
+ return core.propType;
+ } else {
+ return QVariant::Invalid;
+ }
+}
+
+/*!
+ Returns the type of the property.
+*/
+QDeclarativeProperty::Type QDeclarativeProperty::type() const
+{
+ if (d->core.flags & QDeclarativePropertyCache::Data::IsFunction)
+ return SignalProperty;
+ else if (d->core.isValid())
+ return Property;
+ else
+ return Invalid;
+}
+
+/*!
+ Returns true if this QDeclarativeProperty represents a regular Qt property.
+*/
+bool QDeclarativeProperty::isProperty() const
+{
+ return type() & Property;
+}
+
+/*!
+ Returns true if this QDeclarativeProperty represents a QML signal property.
+*/
+bool QDeclarativeProperty::isSignalProperty() const
+{
+ return type() & SignalProperty;
+}
+
+/*!
+ Returns the QDeclarativeProperty's QObject.
+*/
+QObject *QDeclarativeProperty::object() const
+{
+ return d->object;
+}
+
+/*!
+ Assign \a other to this QDeclarativeProperty.
+*/
+QDeclarativeProperty &QDeclarativeProperty::operator=(const QDeclarativeProperty &other)
+{
+ d->context = other.d->context;
+ d->engine = other.d->engine;
+ d->object = other.d->object;
+
+ d->isNameCached = other.d->isNameCached;
+ d->core = other.d->core;
+ d->nameCache = other.d->nameCache;
+
+ d->valueType = other.d->valueType;
+
+ return *this;
+}
+
+/*!
+ Returns true if the property is writable, otherwise false.
+*/
+bool QDeclarativeProperty::isWritable() const
+{
+ QDeclarativeProperty::PropertyTypeCategory category = propertyTypeCategory();
+
+ if (!d->object)
+ return false;
+ if (category == List)
+ return true;
+ else if (type() & SignalProperty)
+ return false;
+ else if (d->core.isValid() && d->object)
+ return d->core.flags & QDeclarativePropertyCache::Data::IsWritable;
+ else
+ return false;
+}
+
+/*!
+ Returns true if the property is designable, otherwise false.
+*/
+bool QDeclarativeProperty::isDesignable() const
+{
+ if (type() & Property && d->core.isValid() && d->object)
+ return d->object->metaObject()->property(d->core.coreIndex).isDesignable();
+ else
+ return false;
+}
+
+/*!
+ Returns true if the property is resettable, otherwise false.
+*/
+bool QDeclarativeProperty::isResettable() const
+{
+ if (type() & Property && d->core.isValid() && d->object)
+ return d->core.flags & QDeclarativePropertyCache::Data::IsResettable;
+ else
+ return false;
+}
+
+/*!
+ Returns true if the QDeclarativeProperty refers to a valid property, otherwise
+ false.
+*/
+bool QDeclarativeProperty::isValid() const
+{
+ return type() != Invalid;
+}
+
+/*!
+ Return the name of this QML property.
+*/
+QString QDeclarativeProperty::name() const
+{
+ if (!d->isNameCached) {
+ // ###
+ if (!d->object) {
+ } else if (d->isValueType()) {
+ QString rv = d->core.name(d->object) + QLatin1Char('.');
+
+ QDeclarativeEnginePrivate *ep = d->engine?QDeclarativeEnginePrivate::get(d->engine):0;
+ QDeclarativeValueType *valueType = 0;
+ if (ep) valueType = ep->valueTypes[d->core.propType];
+ else valueType = QDeclarativeValueTypeFactory::valueType(d->core.propType);
+ Q_ASSERT(valueType);
+
+ rv += QString::fromUtf8(valueType->metaObject()->property(d->valueType.valueTypeCoreIdx).name());
+
+ if (!ep) delete valueType;
+
+ d->nameCache = rv;
+ } else if (type() & SignalProperty) {
+ QString name = QLatin1String("on") + d->core.name(d->object);
+ name[2] = name.at(2).toUpper();
+ d->nameCache = name;
+ } else {
+ d->nameCache = d->core.name(d->object);
+ }
+ d->isNameCached = true;
+ }
+
+ return d->nameCache;
+}
+
+/*!
+ Returns the \l{QMetaProperty} {Qt property} associated with
+ this QML property.
+ */
+QMetaProperty QDeclarativeProperty::property() const
+{
+ if (type() & Property && d->core.isValid() && d->object)
+ return d->object->metaObject()->property(d->core.coreIndex);
+ else
+ return QMetaProperty();
+}
+
+/*!
+ Return the QMetaMethod for this property if it is a SignalProperty,
+ otherwise returns an invalid QMetaMethod.
+*/
+QMetaMethod QDeclarativeProperty::method() const
+{
+ if (type() & SignalProperty && d->object)
+ return d->object->metaObject()->method(d->core.coreIndex);
+ else
+ return QMetaMethod();
+}
+
+
+/*!
+ Returns the binding associated with this property, or 0 if no binding
+ exists.
+*/
+QDeclarativeAbstractBinding *
+QDeclarativePropertyPrivate::binding(const QDeclarativeProperty &that)
+{
+ if (!that.isProperty() || !that.d->object)
+ return 0;
+
+ QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(that.d->object);
+ if (!data)
+ return 0;
+
+ if (!data->hasBindingBit(that.d->core.coreIndex))
+ return 0;
+
+ QDeclarativeAbstractBinding *binding = data->bindings;
+ while (binding) {
+ // ### This wont work for value types
+ if (binding->propertyIndex() == that.d->core.coreIndex)
+ return binding;
+ binding = binding->m_nextBinding;
+ }
+ return 0;
+}
+
+/*!
+ Set the binding associated with this property to \a newBinding. Returns
+ the existing binding (if any), otherwise 0.
+
+ \a newBinding will be enabled, and the returned binding (if any) will be
+ disabled.
+
+ Ownership of \a newBinding transfers to QML. Ownership of the return value
+ is assumed by the caller.
+
+ \a flags is passed through to the binding and is used for the initial update (when
+ the binding sets the intial value, it will use these flags for the write).
+*/
+QDeclarativeAbstractBinding *
+QDeclarativePropertyPrivate::setBinding(const QDeclarativeProperty &that,
+ QDeclarativeAbstractBinding *newBinding,
+ WriteFlags flags)
+{
+ if (!that.isProperty() || !that.d->object) {
+ if (newBinding)
+ newBinding->destroy();
+ return 0;
+ }
+
+ return that.d->setBinding(that.d->object, that.d->core, newBinding, flags);
+}
+
+QDeclarativeAbstractBinding *
+QDeclarativePropertyPrivate::setBinding(QObject *object, const QDeclarativePropertyCache::Data &core,
+ QDeclarativeAbstractBinding *newBinding, WriteFlags flags)
+{
+ QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(object, 0 != newBinding);
+
+ if (data && data->hasBindingBit(core.coreIndex)) {
+ QDeclarativeAbstractBinding *binding = data->bindings;
+ while (binding) {
+ // ### This wont work for value types
+ if (binding->propertyIndex() == core.coreIndex) {
+ binding->setEnabled(false);
+
+ if (newBinding)
+ newBinding->setEnabled(true, flags);
+
+ return binding; // ### QDeclarativeAbstractBinding;
+ }
+
+ binding = binding->m_nextBinding;
+ }
+ }
+
+ if (newBinding)
+ newBinding->setEnabled(true, flags);
+
+ return 0;
+}
+
+/*!
+ Returns the expression associated with this signal property, or 0 if no
+ signal expression exists.
+*/
+QDeclarativeExpression *
+QDeclarativePropertyPrivate::signalExpression(const QDeclarativeProperty &that)
+{
+ if (!(that.type() & QDeclarativeProperty::SignalProperty))
+ return 0;
+
+ const QObjectList &children = that.d->object->children();
+
+ for (int ii = 0; ii < children.count(); ++ii) {
+ QObject *child = children.at(ii);
+
+ QDeclarativeBoundSignal *signal = QDeclarativeBoundSignal::cast(child);
+ if (signal && signal->index() == that.index())
+ return signal->expression();
+ }
+
+ return 0;
+}
+
+/*!
+ Set the signal expression associated with this signal property to \a expr.
+ Returns the existing signal expression (if any), otherwise 0.
+
+ Ownership of \a expr transfers to QML. Ownership of the return value is
+ assumed by the caller.
+*/
+QDeclarativeExpression *
+QDeclarativePropertyPrivate::setSignalExpression(const QDeclarativeProperty &that,
+ QDeclarativeExpression *expr)
+{
+ if (!(that.type() & QDeclarativeProperty::SignalProperty)) {
+ delete expr;
+ return 0;
+ }
+
+ const QObjectList &children = that.d->object->children();
+
+ for (int ii = 0; ii < children.count(); ++ii) {
+ QObject *child = children.at(ii);
+
+ QDeclarativeBoundSignal *signal = QDeclarativeBoundSignal::cast(child);
+ if (signal && signal->index() == that.index())
+ return signal->setExpression(expr);
+ }
+
+ if (expr) {
+ QDeclarativeBoundSignal *signal = new QDeclarativeBoundSignal(that.d->object, that.method(), that.d->object);
+ return signal->setExpression(expr);
+ } else {
+ return 0;
+ }
+}
+
+/*!
+ Returns the property value.
+*/
+QVariant QDeclarativeProperty::read() const
+{
+ if (!d->object)
+ return QVariant();
+
+ if (type() & SignalProperty) {
+
+ return QVariant();
+
+ } else if (type() & Property) {
+
+ return d->readValueProperty();
+
+ }
+ return QVariant();
+}
+
+/*!
+Return the \a name property value of \a object. This method is equivalent to:
+\code
+ QDeclarativeProperty p(object, name);
+ p.read();
+\endcode
+*/
+QVariant QDeclarativeProperty::read(QObject *object, const QString &name)
+{
+ QDeclarativeProperty p(object, name);
+ return p.read();
+}
+
+/*!
+Return the \a name property value of \a object. This method is equivalent to:
+\code
+ QDeclarativeProperty p(object, name, context);
+ p.read();
+\endcode
+*/
+QVariant QDeclarativeProperty::read(QObject *object, const QString &name, QDeclarativeContext *ctxt)
+{
+ QDeclarativeProperty p(object, name, ctxt);
+ return p.read();
+}
+
+/*!
+Return the \a name property value of \a object. This method is equivalent to:
+\code
+ QDeclarativeProperty p(object, name, engine);
+ p.read();
+\endcode
+*/
+QVariant QDeclarativeProperty::read(QObject *object, const QString &name, QDeclarativeEngine *engine)
+{
+ QDeclarativeProperty p(object, name, engine);
+ return p.read();
+}
+
+QVariant QDeclarativePropertyPrivate::readValueProperty()
+{
+ if(isValueType()) {
+
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context);
+ QDeclarativeValueType *valueType = 0;
+ if (ep) valueType = ep->valueTypes[core.propType];
+ else valueType = QDeclarativeValueTypeFactory::valueType(core.propType);
+ Q_ASSERT(valueType);
+
+ valueType->read(object, core.coreIndex);
+
+ QVariant rv =
+ valueType->metaObject()->property(this->valueType.valueTypeCoreIdx).read(valueType);
+
+ if (!ep) delete valueType;
+ return rv;
+
+ } else if(core.flags & QDeclarativePropertyCache::Data::IsQList) {
+
+ QDeclarativeListProperty<QObject> prop;
+ void *args[] = { &prop, 0 };
+ QMetaObject::metacall(object, QMetaObject::ReadProperty, core.coreIndex, args);
+ return QVariant::fromValue(QDeclarativeListReferencePrivate::init(prop, core.propType, engine));
+
+ } else {
+
+ return object->metaObject()->property(core.coreIndex).read(object.data());
+
+ }
+}
+
+//writeEnumProperty MIRRORS the relelvant bit of QMetaProperty::write AND MUST BE KEPT IN SYNC!
+bool QDeclarativePropertyPrivate::writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object, const QVariant &value, int flags)
+{
+ if (!object || !prop.isWritable())
+ return false;
+
+ QVariant v = value;
+ if (prop.isEnumType()) {
+ QMetaEnum menum = prop.enumerator();
+ if (v.userType() == QVariant::String
+#ifdef QT3_SUPPORT
+ || v.userType() == QVariant::CString
+#endif
+ ) {
+ if (prop.isFlagType())
+ v = QVariant(menum.keysToValue(value.toByteArray()));
+ else
+ v = QVariant(menum.keyToValue(value.toByteArray()));
+ } else if (v.userType() != QVariant::Int && v.userType() != QVariant::UInt) {
+ int enumMetaTypeId = QMetaType::type(QByteArray(menum.scope()) + "::" + menum.name());
+ if ((enumMetaTypeId == 0) || (v.userType() != enumMetaTypeId) || !v.constData())
+ return false;
+ v = QVariant(*reinterpret_cast<const int *>(v.constData()));
+ }
+ v.convert(QVariant::Int);
+ }
+
+ // the status variable is changed by qt_metacall to indicate what it did
+ // this feature is currently only used by QtDBus and should not be depended
+ // upon. Don't change it without looking into QDBusAbstractInterface first
+ // -1 (unchanged): normal qt_metacall, result stored in argv[0]
+ // changed: result stored directly in value, return the value of status
+ int status = -1;
+ void *argv[] = { v.data(), &v, &status, &flags };
+ QMetaObject::metacall(object, QMetaObject::WriteProperty, idx, argv);
+ return status;
+}
+
+bool QDeclarativePropertyPrivate::writeValueProperty(const QVariant &value, WriteFlags flags)
+{
+ // Remove any existing bindings on this property
+ if (!(flags & DontRemoveBinding)) {
+ QDeclarativeAbstractBinding *binding = setBinding(*q, 0);
+ if (binding) binding->destroy();
+ }
+
+ bool rv = false;
+ if (isValueType()) {
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context);
+
+ QDeclarativeValueType *writeBack = 0;
+ if (ep) {
+ writeBack = ep->valueTypes[core.propType];
+ } else {
+ writeBack = QDeclarativeValueTypeFactory::valueType(core.propType);
+ }
+
+ writeBack->read(object, core.coreIndex);
+
+ QDeclarativePropertyCache::Data data = core;
+ data.flags = valueType.flags;
+ data.coreIndex = valueType.valueTypeCoreIdx;
+ data.propType = valueType.valueTypePropType;
+ rv = write(writeBack, data, value, context, flags);
+
+ writeBack->write(object, core.coreIndex, flags);
+ if (!ep) delete writeBack;
+
+ } else {
+
+ rv = write(object, core, value, context, flags);
+
+ }
+
+ return rv;
+}
+
+bool QDeclarativePropertyPrivate::write(QObject *object, const QDeclarativePropertyCache::Data &property,
+ const QVariant &value, QDeclarativeContext *context,
+ WriteFlags flags)
+{
+ int coreIdx = property.coreIndex;
+ int status = -1; //for dbus
+
+ if (property.flags & QDeclarativePropertyCache::Data::IsEnumType) {
+ QMetaProperty prop = object->metaObject()->property(property.coreIndex);
+ QVariant v = value;
+ // Enum values come through the script engine as doubles
+ if (value.userType() == QVariant::Double) {
+ double integral;
+ double fractional = modf(value.toDouble(), &integral);
+ if (qFuzzyIsNull(fractional))
+ v.convert(QVariant::Int);
+ }
+ return writeEnumProperty(prop, coreIdx, object, v, flags);
+ }
+
+ int propertyType = property.propType;
+ int variantType = value.userType();
+
+ QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(context);
+
+ if (propertyType == QVariant::Url) {
+
+ QUrl u;
+ bool found = false;
+ if (variantType == QVariant::Url) {
+ u = value.toUrl();
+ found = true;
+ } else if (variantType == QVariant::ByteArray) {
+ u = QUrl(QString::fromUtf8(value.toByteArray()));
+ found = true;
+ } else if (variantType == QVariant::String) {
+ u = QUrl(value.toString());
+ found = true;
+ }
+
+ if (!found)
+ return false;
+
+ if (context && u.isRelative() && !u.isEmpty())
+ u = context->resolvedUrl(u);
+ int status = -1;
+ void *argv[] = { &u, 0, &status, &flags };
+ QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, argv);
+
+ } else if (variantType == propertyType) {
+
+ void *a[] = { (void *)value.constData(), 0, &status, &flags };
+ QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
+
+ } else if (qMetaTypeId<QVariant>() == propertyType) {
+
+ void *a[] = { (void *)&value, 0, &status, &flags };
+ QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
+
+ } else if (property.flags & QDeclarativePropertyCache::Data::IsQObjectDerived) {
+
+ const QMetaObject *valMo = rawMetaObjectForType(enginePriv, value.userType());
+
+ if (!valMo)
+ return false;
+
+ QObject *o = *(QObject **)value.constData();
+ const QMetaObject *propMo = rawMetaObjectForType(enginePriv, propertyType);
+
+ if (o) valMo = o->metaObject();
+
+ if (canConvert(valMo, propMo)) {
+ void *args[] = { &o, 0, &status, &flags };
+ QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx,
+ args);
+ } else if (!o && canConvert(propMo, valMo)) {
+ // In the case of a null QObject, we assign the null if there is
+ // any change that the null variant type could be up or down cast to
+ // the property type.
+ void *args[] = { &o, 0, &status, &flags };
+ QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx,
+ args);
+ } else {
+ return false;
+ }
+
+ } else if (property.flags & QDeclarativePropertyCache::Data::IsQList) {
+
+ const QMetaObject *listType = 0;
+ if (enginePriv) {
+ listType = enginePriv->rawMetaObjectForType(enginePriv->listType(property.propType));
+ } else {
+ QDeclarativeType *type = QDeclarativeMetaType::qmlType(QDeclarativeMetaType::listType(property.propType));
+ if (!type) return false;
+ listType = type->baseMetaObject();
+ }
+ if (!listType) return false;
+
+ QDeclarativeListProperty<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);
+
+ for (int ii = 0; ii < list.count(); ++ii) {
+ QObject *o = list.at(ii);
+ if (o && !canConvert(o->metaObject(), listType))
+ o = 0;
+ prop.append(&prop, (void *)o);
+ }
+ } else {
+ QObject *o = enginePriv?enginePriv->toQObject(value):QDeclarativeMetaType::toQObject(value);
+ if (o && !canConvert(o->metaObject(), listType))
+ o = 0;
+ prop.append(&prop, (void *)o);
+ }
+
+ } else {
+ Q_ASSERT(variantType != propertyType);
+
+ QVariant v = value;
+ if (v.convert((QVariant::Type)propertyType)) {
+ void *a[] = { (void *)v.constData(), 0, &status, &flags};
+ QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
+ } else if ((uint)propertyType >= QVariant::UserType && variantType == QVariant::String) {
+ QDeclarativeMetaType::StringConverter con = QDeclarativeMetaType::customStringConverter(propertyType);
+ if (!con)
+ return false;
+
+ QVariant v = con(value.toString());
+ if (v.userType() == propertyType) {
+ void *a[] = { (void *)v.constData(), 0, &status, &flags};
+ QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
+ }
+ } else if (variantType == QVariant::String) {
+ bool ok = false;
+ QVariant v = QDeclarativeStringConverters::variantFromString(value.toString(), propertyType, &ok);
+ if (!ok)
+ return false;
+
+ void *a[] = { (void *)v.constData(), 0, &status, &flags};
+ QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
+ } else {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+const QMetaObject *QDeclarativePropertyPrivate::rawMetaObjectForType(QDeclarativeEnginePrivate *engine, int userType)
+{
+ if (engine) {
+ return engine->rawMetaObjectForType(userType);
+ } else {
+ QDeclarativeType *type = QDeclarativeMetaType::qmlType(userType);
+ return type?type->baseMetaObject():0;
+ }
+}
+
+/*!
+ Set the property value to \a value.
+*/
+bool QDeclarativeProperty::write(const QVariant &value) const
+{
+ return QDeclarativePropertyPrivate::write(*this, value, 0);
+}
+
+/*!
+Writes \a value to the \a name property of \a object. This method is equivalent to:
+\code
+ QDeclarativeProperty p(object, name);
+ p.write(value);
+\endcode
+*/
+bool QDeclarativeProperty::write(QObject *object, const QString &name, const QVariant &value)
+{
+ QDeclarativeProperty p(object, name);
+ return p.write(value);
+}
+
+/*!
+Writes \a value to the \a name property of \a object. This method is equivalent to:
+\code
+ QDeclarativeProperty p(object, name, ctxt);
+ p.write(value);
+\endcode
+*/
+bool QDeclarativeProperty::write(QObject *object, const QString &name, const QVariant &value,
+ QDeclarativeContext *ctxt)
+{
+ QDeclarativeProperty p(object, name, ctxt);
+ return p.write(value);
+}
+
+/*!
+Writes \a value to the \a name property of \a object. This method is equivalent to:
+\code
+ QDeclarativeProperty p(object, name, engine);
+ p.write(value);
+\endcode
+*/
+bool QDeclarativeProperty::write(QObject *object, const QString &name, const QVariant &value,
+ QDeclarativeEngine *engine)
+{
+ QDeclarativeProperty p(object, name, engine);
+ return p.write(value);
+}
+
+/*!
+ Resets the property value.
+*/
+bool QDeclarativeProperty::reset() const
+{
+ if (isResettable()) {
+ void *args[] = { 0 };
+ QMetaObject::metacall(d->object, QMetaObject::ResetProperty, d->core.coreIndex, args);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool QDeclarativePropertyPrivate::write(const QDeclarativeProperty &that,
+ const QVariant &value, WriteFlags flags)
+{
+ if (that.d->object && that.type() & QDeclarativeProperty::Property &&
+ that.d->core.isValid() && that.isWritable())
+ return that.d->writeValueProperty(value, flags);
+ else
+ return false;
+}
+
+/*!
+ Returns true if the property has a change notifier signal, otherwise false.
+*/
+bool QDeclarativeProperty::hasNotifySignal() const
+{
+ if (type() & Property && d->object) {
+ return d->object->metaObject()->property(d->core.coreIndex).hasNotifySignal();
+ }
+ return false;
+}
+
+/*!
+ Returns true if the property needs a change notifier signal for bindings
+ to remain upto date, false otherwise.
+
+ Some properties, such as attached properties or those whose value never
+ changes, do not require a change notifier.
+*/
+bool QDeclarativeProperty::needsNotifySignal() const
+{
+ return type() & Property && !property().isConstant();
+}
+
+/*!
+ Connects the property's change notifier signal to the
+ specified \a method of the \a dest object and returns
+ true. Returns false if this metaproperty does not
+ represent a regular Qt property or if it has no
+ change notifier signal, or if the \a dest object does
+ not have the specified \a method.
+*/
+bool QDeclarativeProperty::connectNotifySignal(QObject *dest, int method) const
+{
+ if (!(type() & Property) || !d->object)
+ return false;
+
+ QMetaProperty prop = d->object->metaObject()->property(d->core.coreIndex);
+ if (prop.hasNotifySignal()) {
+ return QMetaObject::connect(d->object, prop.notifySignalIndex(), dest, method, Qt::DirectConnection);
+ } else {
+ return false;
+ }
+}
+
+/*!
+ Connects the property's change notifier signal to the
+ specified \a slot of the \a dest object and returns
+ true. Returns false if this metaproperty does not
+ represent a regular Qt property or if it has no
+ change notifier signal, or if the \a dest object does
+ not have the specified \a slot.
+*/
+bool QDeclarativeProperty::connectNotifySignal(QObject *dest, const char *slot) const
+{
+ if (!(type() & Property) || !d->object)
+ return false;
+
+ QMetaProperty prop = d->object->metaObject()->property(d->core.coreIndex);
+ if (prop.hasNotifySignal()) {
+ QByteArray signal(QByteArray("2") + prop.notifySignal().signature());
+ return QObject::connect(d->object, signal.constData(), dest, slot);
+ } else {
+ return false;
+ }
+}
+
+/*!
+ Return the Qt metaobject index of the property.
+*/
+int QDeclarativeProperty::index() const
+{
+ return d->core.coreIndex;
+}
+
+int QDeclarativePropertyPrivate::valueTypeCoreIndex(const QDeclarativeProperty &that)
+{
+ return that.d->valueType.valueTypeCoreIdx;
+}
+
+struct SerializedData {
+ bool isValueType;
+ QDeclarativePropertyCache::Data core;
+};
+
+struct ValueTypeSerializedData : public SerializedData {
+ QDeclarativePropertyCache::ValueTypeData valueType;
+};
+
+QByteArray QDeclarativePropertyPrivate::saveValueType(const QMetaObject *metaObject, int index,
+ const QMetaObject *subObject, int subIndex)
+{
+ QMetaProperty prop = metaObject->property(index);
+ QMetaProperty subProp = subObject->property(subIndex);
+
+ ValueTypeSerializedData sd;
+ sd.isValueType = true;
+ sd.core.load(metaObject->property(index));
+ sd.valueType.flags = QDeclarativePropertyCache::Data::flagsForProperty(subProp);
+ sd.valueType.valueTypeCoreIdx = subIndex;
+ sd.valueType.valueTypePropType = subProp.userType();
+
+ QByteArray rv((const char *)&sd, sizeof(sd));
+
+ return rv;
+}
+
+QByteArray QDeclarativePropertyPrivate::saveProperty(const QMetaObject *metaObject, int index)
+{
+ SerializedData sd;
+ sd.isValueType = false;
+ sd.core.load(metaObject->property(index));
+
+ QByteArray rv((const char *)&sd, sizeof(sd));
+ return rv;
+}
+
+QDeclarativeProperty
+QDeclarativePropertyPrivate::restore(const QByteArray &data, QObject *object, QDeclarativeContext *ctxt)
+{
+ QDeclarativeProperty prop;
+
+ if (data.isEmpty())
+ return prop;
+
+ prop.d->object = object;
+ prop.d->context = ctxt;
+ prop.d->engine = ctxt?ctxt->engine():0;
+
+ const SerializedData *sd = (const SerializedData *)data.constData();
+ if (sd->isValueType) {
+ const ValueTypeSerializedData *vt = (const ValueTypeSerializedData *)sd;
+ prop.d->core = vt->core;
+ prop.d->valueType = vt->valueType;
+ } else {
+ prop.d->core = sd->core;
+ }
+
+ return prop;
+}
+
+/*!
+ Returns true if lhs and rhs refer to the same metaobject data
+*/
+bool QDeclarativePropertyPrivate::equal(const QMetaObject *lhs, const QMetaObject *rhs)
+{
+ return lhs == rhs || (1 && lhs && rhs && lhs->d.stringdata == rhs->d.stringdata);
+}
+
+/*!
+ Returns true if from inherits to.
+*/
+bool QDeclarativePropertyPrivate::canConvert(const QMetaObject *from, const QMetaObject *to)
+{
+ if (from && to == &QObject::staticMetaObject)
+ return true;
+
+ while (from) {
+ if (equal(from, to))
+ return true;
+ from = from->superClass();
+ }
+
+ return false;
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlmetaproperty.h b/src/declarative/qml/qdeclarativeproperty.h
index 82266c8..73bccf3 100644
--- a/src/declarative/qml/qmlmetaproperty.h
+++ b/src/declarative/qml/qdeclarativeproperty.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLMETAPROPERTY_H
-#define QMLMETAPROPERTY_H
+#ifndef QDECLARATIVEPROPERTY_H
+#define QDECLARATIVEPROPERTY_H
#include <QtCore/qmetaobject.h>
@@ -51,97 +51,88 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QObject;
-class QmlAbstractBinding;
-class QmlExpression;
-class QStringList;
class QVariant;
-struct QMetaObject;
-class QmlContext;
-class QmlEngine;
+class QDeclarativeContext;
+class QDeclarativeEngine;
-class QmlMetaPropertyPrivate;
-class Q_DECLARATIVE_EXPORT QmlMetaProperty
+class QDeclarativePropertyPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeProperty
{
public:
- enum PropertyCategory {
- Unknown,
- InvalidProperty,
- Bindable,
+ enum PropertyTypeCategory {
+ InvalidCategory,
List,
Object,
Normal
};
- QmlMetaProperty();
- QmlMetaProperty(QObject *);
- QmlMetaProperty(QObject *, const QString &);
- QmlMetaProperty(QObject *, QmlContext *);
- QmlMetaProperty(QObject *, const QString &, QmlContext *);
- QmlMetaProperty(const QmlMetaProperty &);
- QmlMetaProperty &operator=(const QmlMetaProperty &);
- ~QmlMetaProperty();
- QString name() const;
+ enum Type {
+ Invalid,
+ Property,
+ SignalProperty
+ };
- QVariant read() const;
- bool write(const QVariant &) const;
- enum WriteFlag { BypassInterceptor = 0x01, DontRemoveBinding = 0x02 };
- Q_DECLARE_FLAGS(WriteFlags, WriteFlag)
- bool write(const QVariant &, QmlMetaProperty::WriteFlags) const;
- bool reset() const;
+ QDeclarativeProperty();
+ ~QDeclarativeProperty();
- bool hasChangedNotifier() const;
- bool needsChangedNotifier() const;
- bool connectNotifier(QObject *dest, const char *slot) const;
- bool connectNotifier(QObject *dest, int method) const;
+ QDeclarativeProperty(QObject *);
+ QDeclarativeProperty(QObject *, QDeclarativeContext *);
+ QDeclarativeProperty(QObject *, QDeclarativeEngine *);
- QMetaMethod method() const;
+ QDeclarativeProperty(QObject *, const QString &);
+ QDeclarativeProperty(QObject *, const QString &, QDeclarativeContext *);
+ QDeclarativeProperty(QObject *, const QString &, QDeclarativeEngine *);
+
+ QDeclarativeProperty(const QDeclarativeProperty &);
+ QDeclarativeProperty &operator=(const QDeclarativeProperty &);
- enum Type { Invalid = 0x00,
- Property = 0x01,
- SignalProperty = 0x02,
- Default = 0x08,
- Attached = 0x10,
- ValueTypeProperty = 0x20 };
+ bool operator==(const QDeclarativeProperty &) const;
Type type() const;
- bool isProperty() const;
- bool isDefault() const;
- bool isWritable() const;
- bool isDesignable() const;
- bool isResettable() const;
bool isValid() const;
- QObject *object() const;
-
- PropertyCategory propertyCategory() const;
+ bool isProperty() const;
+ bool isSignalProperty() const;
int propertyType() const;
+ PropertyTypeCategory propertyTypeCategory() const;
const char *propertyTypeName() const;
- bool operator==(const QmlMetaProperty &) const;
+ QString name() const;
- QMetaProperty property() const;
+ QVariant read() const;
+ static QVariant read(QObject *, const QString &);
+ static QVariant read(QObject *, const QString &, QDeclarativeContext *);
+ static QVariant read(QObject *, const QString &, QDeclarativeEngine *);
- QmlAbstractBinding *binding() const;
- QmlAbstractBinding *setBinding(QmlAbstractBinding *,
- QmlMetaProperty::WriteFlags flags = QmlMetaProperty::DontRemoveBinding) const;
+ bool write(const QVariant &) const;
+ static bool write(QObject *, const QString &, const QVariant &);
+ static bool write(QObject *, const QString &, const QVariant &, QDeclarativeContext *);
+ static bool write(QObject *, const QString &, const QVariant &, QDeclarativeEngine *);
- QmlExpression *signalExpression() const;
- QmlExpression *setSignalExpression(QmlExpression *) const;
+ bool reset() const;
+
+ bool hasNotifySignal() const;
+ bool needsNotifySignal() const;
+ bool connectNotifySignal(QObject *dest, const char *slot) const;
+ bool connectNotifySignal(QObject *dest, int method) const;
- static QmlMetaProperty createProperty(QObject *, const QString &, QmlContext *context=0);
+ bool isWritable() const;
+ bool isDesignable() const;
+ bool isResettable() const;
+ QObject *object() const;
+
+ int index() const;
+ QMetaProperty property() const;
+ QMetaMethod method() const;
- int coreIndex() const;
- int valueTypeCoreIndex() const;
private:
- friend class QmlEnginePrivate;
- friend class QmlMetaPropertyPrivate;
- QmlMetaPropertyPrivate *d;
+ friend class QDeclarativePropertyPrivate;
+ QDeclarativePropertyPrivate *d;
};
-typedef QList<QmlMetaProperty> QmlMetaProperties;
- Q_DECLARE_OPERATORS_FOR_FLAGS(QmlMetaProperty::WriteFlags)
+typedef QList<QDeclarativeProperty> QDeclarativeProperties;
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLMETAPROPERTY_H
+#endif // QDECLARATIVEPROPERTY_H
diff --git a/src/declarative/qml/qdeclarativeproperty_p.h b/src/declarative/qml/qdeclarativeproperty_p.h
new file mode 100644
index 0000000..1fda7f4
--- /dev/null
+++ b/src/declarative/qml/qdeclarativeproperty_p.h
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVEPROPERTY_P_H
+#define QDECLARATIVEPROPERTY_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 "qdeclarativeproperty.h"
+
+#include "qdeclarativepropertycache_p.h"
+#include "qdeclarativeguard_p.h"
+
+#include <private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeContext;
+class QDeclarativeEnginePrivate;
+class QDeclarativeExpression;
+class Q_AUTOTEST_EXPORT QDeclarativePropertyPrivate
+{
+public:
+ enum WriteFlag { BypassInterceptor = 0x01, DontRemoveBinding = 0x02 };
+ Q_DECLARE_FLAGS(WriteFlags, WriteFlag)
+
+ QDeclarativePropertyPrivate()
+ : q(0), context(0), engine(0), object(0), isNameCached(false) {}
+
+
+ QDeclarativePropertyPrivate(const QDeclarativePropertyPrivate &other)
+ : q(0), context(other.context), engine(other.engine), object(other.object),
+ isNameCached(other.isNameCached),
+ core(other.core), nameCache(other.nameCache),
+ valueType(other.valueType) {}
+
+ QDeclarativeProperty *q;
+ QDeclarativeContext *context;
+ QDeclarativeEngine *engine;
+ QDeclarativeGuard<QObject> object;
+
+ bool isNameCached:1;
+ QDeclarativePropertyCache::Data core;
+ QString nameCache;
+
+ // Describes the "virtual" value-type sub-property.
+ QDeclarativePropertyCache::ValueTypeData valueType;
+
+ void initProperty(QObject *obj, const QString &name);
+ void initDefault(QObject *obj);
+
+ QMetaMethod findSignal(QObject *, const QString &);
+
+ bool isValueType() const;
+ int propertyType() const;
+ QDeclarativeProperty::PropertyTypeCategory propertyTypeCategory() const;
+
+ QVariant readValueProperty();
+ bool writeValueProperty(const QVariant &, WriteFlags);
+
+ static const QMetaObject *rawMetaObjectForType(QDeclarativeEnginePrivate *, int);
+ static bool writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object,
+ const QVariant &value, int flags);
+ static bool write(QObject *, const QDeclarativePropertyCache::Data &, const QVariant &,
+ QDeclarativeContext *, WriteFlags flags = 0);
+ static QDeclarativeAbstractBinding *setBinding(QObject *, const QDeclarativePropertyCache::Data &,
+ QDeclarativeAbstractBinding *,
+ WriteFlags flags = DontRemoveBinding);
+
+ static QByteArray saveValueType(const QMetaObject *, int,
+ const QMetaObject *, int);
+ static QByteArray saveProperty(const QMetaObject *, int);
+ static QDeclarativeProperty restore(const QByteArray &, QObject *, QDeclarativeContext *);
+
+ static bool equal(const QMetaObject *, const QMetaObject *);
+ static bool canConvert(const QMetaObject *from, const QMetaObject *to);
+
+
+ // "Public" (to QML) methods
+ static QDeclarativeAbstractBinding *binding(const QDeclarativeProperty &that);
+ static QDeclarativeAbstractBinding *setBinding(const QDeclarativeProperty &that,
+ QDeclarativeAbstractBinding *,
+ WriteFlags flags = DontRemoveBinding);
+ static QDeclarativeExpression *signalExpression(const QDeclarativeProperty &that);
+ static QDeclarativeExpression *setSignalExpression(const QDeclarativeProperty &that,
+ QDeclarativeExpression *) ;
+ static bool write(const QDeclarativeProperty &that, const QVariant &, WriteFlags);
+ static int valueTypeCoreIndex(const QDeclarativeProperty &that);
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativePropertyPrivate::WriteFlags)
+
+QT_END_NAMESPACE
+
+#endif // QDECLARATIVEPROPERTY_P_H
diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp
index a3e655b..08b47b7 100644
--- a/src/declarative/qml/qmlpropertycache.cpp
+++ b/src/declarative/qml/qdeclarativepropertycache.cpp
@@ -39,23 +39,21 @@
**
****************************************************************************/
-#include "qmlpropertycache_p.h"
+#include "qdeclarativepropertycache_p.h"
-#include "qmlengine_p.h"
-#include "qmlbinding.h"
-#include "qdebug.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativebinding_p.h"
+#include <QtCore/qdebug.h>
Q_DECLARE_METATYPE(QScriptValue);
QT_BEGIN_NAMESPACE
-void QmlPropertyCache::Data::load(const QMetaProperty &p, QmlEngine *engine)
+QDeclarativePropertyCache::Data::Flags QDeclarativePropertyCache::Data::flagsForProperty(const QMetaProperty &p, QDeclarativeEngine *engine)
{
- propType = p.userType();
- if (QVariant::Type(propType) == QVariant::LastType)
- propType = qMetaTypeId<QVariant>();
- coreIndex = p.propertyIndex();
- notifyIndex = p.notifySignalIndex();
+ int propType = p.userType();
+
+ Flags flags;
if (p.isConstant())
flags |= Data::IsConstant;
@@ -64,23 +62,35 @@ void QmlPropertyCache::Data::load(const QMetaProperty &p, QmlEngine *engine)
if (p.isResettable())
flags |= Data::IsResettable;
- if (propType == qMetaTypeId<QmlBinding *>()) {
+ if (propType == qMetaTypeId<QDeclarativeBinding *>()) {
flags |= Data::IsQmlBinding;
} else if (propType == qMetaTypeId<QScriptValue>()) {
flags |= Data::IsQScriptValue;
} else if (p.isEnumType()) {
flags |= Data::IsEnumType;
} else {
- QmlMetaType::TypeCategory cat = engine ? QmlEnginePrivate::get(engine)->typeCategory(propType)
- : QmlMetaType::typeCategory(propType);
- if (cat == QmlMetaType::Object)
+ QDeclarativeMetaType::TypeCategory cat = engine ? QDeclarativeEnginePrivate::get(engine)->typeCategory(propType)
+ : QDeclarativeMetaType::typeCategory(propType);
+ if (cat == QDeclarativeMetaType::Object)
flags |= Data::IsQObjectDerived;
- else if (cat == QmlMetaType::List)
+ else if (cat == QDeclarativeMetaType::List)
flags |= Data::IsQList;
}
+
+ return flags;
+}
+
+void QDeclarativePropertyCache::Data::load(const QMetaProperty &p, QDeclarativeEngine *engine)
+{
+ propType = p.userType();
+ if (QVariant::Type(propType) == QVariant::LastType)
+ propType = qMetaTypeId<QVariant>();
+ coreIndex = p.propertyIndex();
+ notifyIndex = p.notifySignalIndex();
+ flags = flagsForProperty(p, engine);
}
-void QmlPropertyCache::Data::load(const QMetaMethod &m)
+void QDeclarativePropertyCache::Data::load(const QMetaMethod &m)
{
coreIndex = m.methodIndex();
flags |= Data::IsFunction;
@@ -96,17 +106,17 @@ void QmlPropertyCache::Data::load(const QMetaMethod &m)
}
-QmlPropertyCache::QmlPropertyCache(QmlEngine *e)
-: QmlCleanup(e), engine(e)
+QDeclarativePropertyCache::QDeclarativePropertyCache(QDeclarativeEngine *e)
+: QDeclarativeCleanup(e), engine(e)
{
}
-QmlPropertyCache::~QmlPropertyCache()
+QDeclarativePropertyCache::~QDeclarativePropertyCache()
{
clear();
}
-void QmlPropertyCache::clear()
+void QDeclarativePropertyCache::clear()
{
for (int ii = 0; ii < indexCache.count(); ++ii)
indexCache.at(ii)->release();
@@ -124,12 +134,12 @@ void QmlPropertyCache::clear()
identifierCache.clear();
}
-QmlPropertyCache::Data QmlPropertyCache::create(const QMetaObject *metaObject,
+QDeclarativePropertyCache::Data QDeclarativePropertyCache::create(const QMetaObject *metaObject,
const QString &property)
{
Q_ASSERT(metaObject);
- QmlPropertyCache::Data rv;
+ QDeclarativePropertyCache::Data rv;
int idx = metaObject->indexOfProperty(property.toUtf8());
if (idx != -1) {
rv.load(metaObject->property(idx));
@@ -156,9 +166,9 @@ QmlPropertyCache::Data QmlPropertyCache::create(const QMetaObject *metaObject,
return rv;
}
-QmlPropertyCache *QmlPropertyCache::copy() const
+QDeclarativePropertyCache *QDeclarativePropertyCache::copy() const
{
- QmlPropertyCache *cache = new QmlPropertyCache(engine);
+ QDeclarativePropertyCache *cache = new QDeclarativePropertyCache(engine);
cache->indexCache = indexCache;
cache->stringCache = stringCache;
cache->identifierCache = identifierCache;
@@ -173,10 +183,10 @@ QmlPropertyCache *QmlPropertyCache::copy() const
return cache;
}
-void QmlPropertyCache::append(QmlEngine *engine, const QMetaObject *metaObject,
+void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaObject *metaObject,
Data::Flag propertyFlags, Data::Flag methodFlags)
{
- QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine);
int propCount = metaObject->propertyCount();
int propOffset = metaObject->propertyOffset();
@@ -236,21 +246,21 @@ void QmlPropertyCache::append(QmlEngine *engine, const QMetaObject *metaObject,
}
// ### Optimize - check engine for the parent meta object etc.
-QmlPropertyCache *QmlPropertyCache::create(QmlEngine *engine, const QMetaObject *metaObject)
+QDeclarativePropertyCache *QDeclarativePropertyCache::create(QDeclarativeEngine *engine, const QMetaObject *metaObject)
{
Q_ASSERT(engine);
Q_ASSERT(metaObject);
- QmlPropertyCache *cache = new QmlPropertyCache(engine);
+ QDeclarativePropertyCache *cache = new QDeclarativePropertyCache(engine);
cache->update(engine, metaObject);
return cache;
}
-void QmlPropertyCache::update(QmlEngine *engine, const QMetaObject *metaObject)
+void QDeclarativePropertyCache::update(QDeclarativeEngine *engine, const QMetaObject *metaObject)
{
Q_ASSERT(engine);
Q_ASSERT(metaObject);
- QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine);
clear();
@@ -303,8 +313,8 @@ void QmlPropertyCache::update(QmlEngine *engine, const QMetaObject *metaObject)
}
}
-QmlPropertyCache::Data *
-QmlPropertyCache::property(int index) const
+QDeclarativePropertyCache::Data *
+QDeclarativePropertyCache::property(int index) const
{
if (index < 0 || index >= indexCache.count())
return 0;
@@ -312,13 +322,13 @@ QmlPropertyCache::property(int index) const
return indexCache.at(index);
}
-QmlPropertyCache::Data *
-QmlPropertyCache::property(const QString &str) const
+QDeclarativePropertyCache::Data *
+QDeclarativePropertyCache::property(const QString &str) const
{
return stringCache.value(str);
}
-QString QmlPropertyCache::Data::name(QObject *object)
+QString QDeclarativePropertyCache::Data::name(QObject *object)
{
if (!object)
return QString();
@@ -326,7 +336,7 @@ QString QmlPropertyCache::Data::name(QObject *object)
return name(object->metaObject());
}
-QString QmlPropertyCache::Data::name(const QMetaObject *metaObject)
+QString QDeclarativePropertyCache::Data::name(const QMetaObject *metaObject)
{
if (!metaObject || coreIndex == -1)
return QString();
@@ -345,20 +355,20 @@ QString QmlPropertyCache::Data::name(const QMetaObject *metaObject)
}
}
-QStringList QmlPropertyCache::propertyNames() const
+QStringList QDeclarativePropertyCache::propertyNames() const
{
return stringCache.keys();
}
-QmlPropertyCache::Data *QmlPropertyCache::property(QmlEngine *engine, QObject *obj,
+QDeclarativePropertyCache::Data *QDeclarativePropertyCache::property(QDeclarativeEngine *engine, QObject *obj,
const QScriptDeclarativeClass::Identifier &name, Data &local)
{
- QmlPropertyCache::Data *rv = 0;
+ QDeclarativePropertyCache::Data *rv = 0;
- QmlEnginePrivate *enginePrivate = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *enginePrivate = QDeclarativeEnginePrivate::get(engine);
- QmlPropertyCache *cache = 0;
- QmlDeclarativeData *ddata = QmlDeclarativeData::get(obj);
+ QDeclarativePropertyCache *cache = 0;
+ QDeclarativeDeclarativeData *ddata = QDeclarativeDeclarativeData::get(obj);
if (ddata && ddata->propertyCache && ddata->propertyCache->qmlEngine() == engine)
cache = ddata->propertyCache;
if (!cache) {
@@ -369,7 +379,7 @@ QmlPropertyCache::Data *QmlPropertyCache::property(QmlEngine *engine, QObject *o
if (cache) {
rv = cache->property(name);
} else {
- local = QmlPropertyCache::create(obj->metaObject(), enginePrivate->objectClass->toString(name));
+ local = QDeclarativePropertyCache::create(obj->metaObject(), enginePrivate->objectClass->toString(name));
if (local.isValid())
rv = &local;
}
@@ -377,20 +387,20 @@ QmlPropertyCache::Data *QmlPropertyCache::property(QmlEngine *engine, QObject *o
return rv;
}
-QmlPropertyCache::Data *QmlPropertyCache::property(QmlEngine *engine, QObject *obj,
+QDeclarativePropertyCache::Data *QDeclarativePropertyCache::property(QDeclarativeEngine *engine, QObject *obj,
const QString &name, Data &local)
{
- QmlPropertyCache::Data *rv = 0;
+ QDeclarativePropertyCache::Data *rv = 0;
if (!engine) {
- local = QmlPropertyCache::create(obj->metaObject(), name);
+ local = QDeclarativePropertyCache::create(obj->metaObject(), name);
if (local.isValid())
rv = &local;
} else {
- QmlEnginePrivate *enginePrivate = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *enginePrivate = QDeclarativeEnginePrivate::get(engine);
- QmlPropertyCache *cache = 0;
- QmlDeclarativeData *ddata = QmlDeclarativeData::get(obj);
+ QDeclarativePropertyCache *cache = 0;
+ QDeclarativeDeclarativeData *ddata = QDeclarativeDeclarativeData::get(obj);
if (ddata && ddata->propertyCache && ddata->propertyCache->qmlEngine() == engine)
cache = ddata->propertyCache;
if (!cache) {
@@ -401,7 +411,7 @@ QmlPropertyCache::Data *QmlPropertyCache::property(QmlEngine *engine, QObject *o
if (cache) {
rv = cache->property(name);
} else {
- local = QmlPropertyCache::create(obj->metaObject(), name);
+ local = QDeclarativePropertyCache::create(obj->metaObject(), name);
if (local.isValid())
rv = &local;
}
diff --git a/src/declarative/qml/qmlpropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h
index 18eea80..68e6e6b 100644
--- a/src/declarative/qml/qmlpropertycache_p.h
+++ b/src/declarative/qml/qdeclarativepropertycache_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLPROPERTYCACHE_P_H
-#define QMLPROPERTYCACHE_P_H
+#ifndef QDECLARATIVEPROPERTYCACHE_P_H
+#define QDECLARATIVEPROPERTYCACHE_P_H
//
// W A R N I N G
@@ -53,22 +53,22 @@
// We mean it.
//
-#include "qmlrefcount_p.h"
-#include "qmlcleanup_p.h"
+#include "qdeclarativerefcount_p.h"
+#include "qdeclarativecleanup_p.h"
#include <QtCore/qvector.h>
-#include <private/qscriptdeclarativeclass_p.h>
+#include <QtScript/private/qscriptdeclarativeclass_p.h>
QT_BEGIN_NAMESPACE
-class QmlEngine;
+class QDeclarativeEngine;
class QMetaProperty;
-class QmlPropertyCache : public QmlRefCount, public QmlCleanup
+class QDeclarativePropertyCache : public QDeclarativeRefCount, public QDeclarativeCleanup
{
public:
- QmlPropertyCache(QmlEngine *);
- virtual ~QmlPropertyCache();
+ QDeclarativePropertyCache(QDeclarativeEngine *);
+ virtual ~QDeclarativePropertyCache();
struct Data {
inline Data();
@@ -104,7 +104,8 @@ public:
int coreIndex;
int notifyIndex;
- void load(const QMetaProperty &, QmlEngine *engine = 0);
+ static Flags flagsForProperty(const QMetaProperty &, QDeclarativeEngine *engine = 0);
+ void load(const QMetaProperty &, QDeclarativeEngine *engine = 0);
void load(const QMetaMethod &);
QString name(QObject *);
QString name(const QMetaObject *);
@@ -113,17 +114,18 @@ public:
struct ValueTypeData {
inline ValueTypeData();
inline bool operator==(const ValueTypeData &);
+ Data::Flags flags; // flags on the value type wrapper
int valueTypeCoreIdx; // The prop index of the access property on the value type wrapper
int valueTypePropType; // The QVariant::Type of access property on the value type wrapper
};
- void update(QmlEngine *, const QMetaObject *);
+ void update(QDeclarativeEngine *, const QMetaObject *);
- QmlPropertyCache *copy() const;
- void append(QmlEngine *, const QMetaObject *, Data::Flag propertyFlags = Data::NoFlags,
+ QDeclarativePropertyCache *copy() const;
+ void append(QDeclarativeEngine *, const QMetaObject *, Data::Flag propertyFlags = Data::NoFlags,
Data::Flag methodFlags = Data::NoFlags);
- static QmlPropertyCache *create(QmlEngine *, const QMetaObject *);
+ static QDeclarativePropertyCache *create(QDeclarativeEngine *, const QMetaObject *);
static Data create(const QMetaObject *, const QString &);
inline Data *property(const QScriptDeclarativeClass::Identifier &id) const;
@@ -131,14 +133,14 @@ public:
Data *property(int) const;
QStringList propertyNames() const;
- inline QmlEngine *qmlEngine() const;
- static Data *property(QmlEngine *, QObject *, const QScriptDeclarativeClass::Identifier &, Data &);
- static Data *property(QmlEngine *, QObject *, const QString &, Data &);
+ inline QDeclarativeEngine *qmlEngine() const;
+ static Data *property(QDeclarativeEngine *, QObject *, const QScriptDeclarativeClass::Identifier &, Data &);
+ static Data *property(QDeclarativeEngine *, QObject *, const QString &, Data &);
protected:
virtual void clear();
private:
- struct RData : public Data, public QmlRefCount {
+ struct RData : public Data, public QDeclarativeRefCount {
QScriptDeclarativeClass::PersistentIdentifier identifier;
};
@@ -146,19 +148,19 @@ private:
typedef QHash<QString, RData *> StringCache;
typedef QHash<QScriptDeclarativeClass::Identifier, RData *> IdentifierCache;
- QmlEngine *engine;
+ QDeclarativeEngine *engine;
IndexCache indexCache;
StringCache stringCache;
IdentifierCache identifierCache;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QmlPropertyCache::Data::Flags);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativePropertyCache::Data::Flags);
-QmlPropertyCache::Data::Data()
+QDeclarativePropertyCache::Data::Data()
: flags(0), propType(0), coreIndex(-1), notifyIndex(-1)
{
}
-bool QmlPropertyCache::Data::operator==(const QmlPropertyCache::Data &other)
+bool QDeclarativePropertyCache::Data::operator==(const QDeclarativePropertyCache::Data &other)
{
return flags == other.flags &&
propType == other.propType &&
@@ -166,28 +168,29 @@ bool QmlPropertyCache::Data::operator==(const QmlPropertyCache::Data &other)
notifyIndex == other.notifyIndex;
}
-QmlPropertyCache::Data *
-QmlPropertyCache::property(const QScriptDeclarativeClass::Identifier &id) const
+QDeclarativePropertyCache::Data *
+QDeclarativePropertyCache::property(const QScriptDeclarativeClass::Identifier &id) const
{
return identifierCache.value(id);
}
-QmlPropertyCache::ValueTypeData::ValueTypeData()
-: valueTypeCoreIdx(-1), valueTypePropType(0)
+QDeclarativePropertyCache::ValueTypeData::ValueTypeData()
+: flags(QDeclarativePropertyCache::Data::NoFlags), valueTypeCoreIdx(-1), valueTypePropType(0)
{
}
-bool QmlPropertyCache::ValueTypeData::operator==(const ValueTypeData &o)
+bool QDeclarativePropertyCache::ValueTypeData::operator==(const ValueTypeData &o)
{
- return valueTypeCoreIdx == o.valueTypeCoreIdx &&
+ return flags == o.flags &&
+ valueTypeCoreIdx == o.valueTypeCoreIdx &&
valueTypePropType == o.valueTypePropType;
}
-QmlEngine *QmlPropertyCache::qmlEngine() const
+QDeclarativeEngine *QDeclarativePropertyCache::qmlEngine() const
{
return engine;
}
QT_END_NAMESPACE
-#endif // QMLPROPERTYCACHE_P_H
+#endif // QDECLARATIVEPROPERTYCACHE_P_H
diff --git a/src/declarative/qml/qmlpropertyvalueinterceptor.cpp b/src/declarative/qml/qdeclarativepropertyvalueinterceptor.cpp
index ea53e16..3f6d805 100644
--- a/src/declarative/qml/qmlpropertyvalueinterceptor.cpp
+++ b/src/declarative/qml/qdeclarativepropertyvalueinterceptor.cpp
@@ -39,15 +39,15 @@
**
****************************************************************************/
-#include "qmlpropertyvalueinterceptor.h"
+#include "qdeclarativepropertyvalueinterceptor.h"
-#include "qml.h"
+#include "qdeclarative.h"
QT_BEGIN_NAMESPACE
/*!
- \class QmlPropertyValueInterceptor
- \brief The QmlPropertyValueInterceptor class is inherited by property interceptors such as Behavior.
+ \class QDeclarativePropertyValueInterceptor
+ \brief The QDeclarativePropertyValueInterceptor class is inherited by property interceptors such as Behavior.
\internal
This class intercepts property writes, allowing for custom handling. For example, Behavior uses this
@@ -55,24 +55,24 @@ QT_BEGIN_NAMESPACE
*/
/*!
- Constructs a QmlPropertyValueInterceptor.
+ Constructs a QDeclarativePropertyValueInterceptor.
*/
-QmlPropertyValueInterceptor::QmlPropertyValueInterceptor()
+QDeclarativePropertyValueInterceptor::QDeclarativePropertyValueInterceptor()
{
}
-QmlPropertyValueInterceptor::~QmlPropertyValueInterceptor()
+QDeclarativePropertyValueInterceptor::~QDeclarativePropertyValueInterceptor()
{
}
/*!
- \fn void QmlPropertyValueInterceptor::setTarget(const QmlMetaProperty &property)
+ \fn void QDeclarativePropertyValueInterceptor::setTarget(const QDeclarativeProperty &property)
Set the target \a property for the value interceptor. This method will
be called by the QML engine when assigning a value interceptor.
*/
/*!
- \fn void QmlPropertyValueInterceptor::write(const QVariant &value)
+ \fn void QDeclarativePropertyValueInterceptor::write(const QVariant &value)
This method will be called when a new \a value is assigned to the property being intercepted.
*/
diff --git a/src/declarative/qml/qmlpropertyvalueinterceptor.h b/src/declarative/qml/qdeclarativepropertyvalueinterceptor.h
index 74cd5fa..3de5abc 100644
--- a/src/declarative/qml/qmlpropertyvalueinterceptor.h
+++ b/src/declarative/qml/qdeclarativepropertyvalueinterceptor.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLPROPERTYVALUEINTERCEPTOR_H
-#define QMLPROPERTYVALUEINTERCEPTOR_H
+#ifndef QDECLARATIVEPROPERTYVALUEINTERCEPTOR_H
+#define QDECLARATIVEPROPERTYVALUEINTERCEPTOR_H
#include <QtCore/qobject.h>
@@ -50,19 +50,19 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlMetaProperty;
-class Q_DECLARATIVE_EXPORT QmlPropertyValueInterceptor
+class QDeclarativeProperty;
+class Q_DECLARATIVE_EXPORT QDeclarativePropertyValueInterceptor
{
public:
- QmlPropertyValueInterceptor();
- virtual ~QmlPropertyValueInterceptor();
- virtual void setTarget(const QmlMetaProperty &property) = 0;
+ QDeclarativePropertyValueInterceptor();
+ virtual ~QDeclarativePropertyValueInterceptor();
+ virtual void setTarget(const QDeclarativeProperty &property) = 0;
virtual void write(const QVariant &value) = 0;
};
-Q_DECLARE_INTERFACE(QmlPropertyValueInterceptor, "com.trolltech.qml.QmlPropertyValueInterceptor")
+Q_DECLARE_INTERFACE(QDeclarativePropertyValueInterceptor, "com.trolltech.qml.QDeclarativePropertyValueInterceptor")
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLPROPERTYVALUEINTERCEPTOR_H
+#endif // QDECLARATIVEPROPERTYVALUEINTERCEPTOR_H
diff --git a/src/declarative/qml/qmlpropertyvaluesource.cpp b/src/declarative/qml/qdeclarativepropertyvaluesource.cpp
index bccdfb7..b106d4f 100644
--- a/src/declarative/qml/qmlpropertyvaluesource.cpp
+++ b/src/declarative/qml/qdeclarativepropertyvaluesource.cpp
@@ -39,31 +39,31 @@
**
****************************************************************************/
-#include "qmlpropertyvaluesource.h"
+#include "qdeclarativepropertyvaluesource.h"
-#include "qml.h"
+#include "qdeclarative.h"
QT_BEGIN_NAMESPACE
/*!
- \class QmlPropertyValueSource
- \brief The QmlPropertyValueSource class is inherited by property value sources such as animations and bindings.
+ \class QDeclarativePropertyValueSource
+ \brief The QDeclarativePropertyValueSource class is inherited by property value sources such as animations and bindings.
\internal
*/
/*!
- Constructs a QmlPropertyValueSource.
+ Constructs a QDeclarativePropertyValueSource.
*/
-QmlPropertyValueSource::QmlPropertyValueSource()
+QDeclarativePropertyValueSource::QDeclarativePropertyValueSource()
{
}
-QmlPropertyValueSource::~QmlPropertyValueSource()
+QDeclarativePropertyValueSource::~QDeclarativePropertyValueSource()
{
}
/*!
- \fn void QmlPropertyValueSource::setTarget(const QmlMetaProperty &property)
+ \fn void QDeclarativePropertyValueSource::setTarget(const QDeclarativeProperty &property)
Set the target \a property for the value source. This method will
be called by the QML engine when assigning a value source.
*/
diff --git a/src/declarative/qml/qmlpropertyvaluesource.h b/src/declarative/qml/qdeclarativepropertyvaluesource.h
index fc53b8a..70d2c03 100644
--- a/src/declarative/qml/qmlpropertyvaluesource.h
+++ b/src/declarative/qml/qdeclarativepropertyvaluesource.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLPROPERTYVALUESOURCE_H
-#define QMLPROPERTYVALUESOURCE_H
+#ifndef QDECLARATIVEPROPERTYVALUESOURCE_H
+#define QDECLARATIVEPROPERTYVALUESOURCE_H
#include <QtCore/qobject.h>
@@ -50,18 +50,18 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlMetaProperty;
-class Q_DECLARATIVE_EXPORT QmlPropertyValueSource
+class QDeclarativeProperty;
+class Q_DECLARATIVE_EXPORT QDeclarativePropertyValueSource
{
public:
- QmlPropertyValueSource();
- virtual ~QmlPropertyValueSource();
- virtual void setTarget(const QmlMetaProperty &) = 0;
+ QDeclarativePropertyValueSource();
+ virtual ~QDeclarativePropertyValueSource();
+ virtual void setTarget(const QDeclarativeProperty &) = 0;
};
-Q_DECLARE_INTERFACE(QmlPropertyValueSource, "com.trolltech.qml.QmlPropertyValueSource")
+Q_DECLARE_INTERFACE(QDeclarativePropertyValueSource, "com.trolltech.qml.QDeclarativePropertyValueSource")
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLPROPERTYVALUESOURCE_H
+#endif // QDECLARATIVEPROPERTYVALUESOURCE_H
diff --git a/src/declarative/qml/qmlproxymetaobject.cpp b/src/declarative/qml/qdeclarativeproxymetaobject.cpp
index 29aad34..1decea1 100644
--- a/src/declarative/qml/qmlproxymetaobject.cpp
+++ b/src/declarative/qml/qdeclarativeproxymetaobject.cpp
@@ -39,17 +39,17 @@
**
****************************************************************************/
-#include "qmlproxymetaobject_p.h"
+#include "qdeclarativeproxymetaobject_p.h"
#include <QDebug>
QT_BEGIN_NAMESPACE
-QmlProxyMetaObject::QmlProxyMetaObject(QObject *obj, QList<ProxyData> *mList)
+QDeclarativeProxyMetaObject::QDeclarativeProxyMetaObject(QObject *obj, QList<ProxyData> *mList)
: metaObjects(mList), proxies(0), parent(0), object(obj)
{
-#ifdef QMLPROXYMETAOBJECT_DEBUG
- qWarning() << "QmlProxyMetaObject" << obj->metaObject()->className();
+#ifdef QDECLARATIVEPROXYMETAOBJECT_DEBUG
+ qWarning() << "QDeclarativeProxyMetaObject" << obj->metaObject()->className();
#endif
*static_cast<QMetaObject *>(this) = *metaObjects->first().metaObject;
@@ -60,7 +60,7 @@ QmlProxyMetaObject::QmlProxyMetaObject(QObject *obj, QList<ProxyData> *mList)
op->metaObject = this;
-#ifdef QMLPROXYMETAOBJECT_DEBUG
+#ifdef QDECLARATIVEPROXYMETAOBJECT_DEBUG
const QMetaObject *mo = obj->metaObject();
while(mo) {
qWarning() << " " << mo->className();
@@ -69,7 +69,7 @@ QmlProxyMetaObject::QmlProxyMetaObject(QObject *obj, QList<ProxyData> *mList)
#endif
}
-QmlProxyMetaObject::~QmlProxyMetaObject()
+QDeclarativeProxyMetaObject::~QDeclarativeProxyMetaObject()
{
if (parent)
delete parent;
@@ -80,7 +80,7 @@ QmlProxyMetaObject::~QmlProxyMetaObject()
proxies = 0;
}
-int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
+int QDeclarativeProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
{
if ((c == QMetaObject::ReadProperty ||
c == QMetaObject::WriteProperty) &&
diff --git a/src/declarative/qml/qmlproxymetaobject_p.h b/src/declarative/qml/qdeclarativeproxymetaobject_p.h
index 96cfbf5..3f103b6 100644
--- a/src/declarative/qml/qmlproxymetaobject_p.h
+++ b/src/declarative/qml/qdeclarativeproxymetaobject_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLPROXYMETAOBJECT_P_H
-#define QMLPROXYMETAOBJECT_P_H
+#ifndef QDECLARATIVEPROXYMETAOBJECT_P_H
+#define QDECLARATIVEPROXYMETAOBJECT_P_H
//
// W A R N I N G
@@ -54,7 +54,7 @@
//
#include "qmetaobjectbuilder_p.h"
-#include "qml.h"
+#include "qdeclarative.h"
#include <QtCore/QMetaObject>
#include <QtCore/QObject>
@@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlProxyMetaObject : public QAbstractDynamicMetaObject
+class QDeclarativeProxyMetaObject : public QAbstractDynamicMetaObject
{
public:
struct ProxyData {
@@ -78,8 +78,8 @@ public:
int methodOffset;
};
- QmlProxyMetaObject(QObject *, QList<ProxyData> *);
- virtual ~QmlProxyMetaObject();
+ QDeclarativeProxyMetaObject(QObject *, QList<ProxyData> *);
+ virtual ~QDeclarativeProxyMetaObject();
protected:
virtual int metaCall(QMetaObject::Call _c, int _id, void **_a);
@@ -96,5 +96,5 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLPROXYMETAOBJECT_P_H
+#endif // QDECLARATIVEPROXYMETAOBJECT_P_H
diff --git a/src/declarative/qml/qmlrefcount.cpp b/src/declarative/qml/qdeclarativerefcount.cpp
index 76a6ab6..943e35c 100644
--- a/src/declarative/qml/qmlrefcount.cpp
+++ b/src/declarative/qml/qdeclarativerefcount.cpp
@@ -39,26 +39,26 @@
**
****************************************************************************/
-#include "qmlrefcount_p.h"
+#include "qdeclarativerefcount_p.h"
QT_BEGIN_NAMESPACE
-QmlRefCount::QmlRefCount()
+QDeclarativeRefCount::QDeclarativeRefCount()
: refCount(1)
{
}
-QmlRefCount::~QmlRefCount()
+QDeclarativeRefCount::~QDeclarativeRefCount()
{
}
-void QmlRefCount::addref()
+void QDeclarativeRefCount::addref()
{
Q_ASSERT(refCount > 0);
++refCount;
}
-void QmlRefCount::release()
+void QDeclarativeRefCount::release()
{
Q_ASSERT(refCount > 0);
--refCount;
diff --git a/src/declarative/qml/qmlrefcount_p.h b/src/declarative/qml/qdeclarativerefcount_p.h
index 9b2f52b..1170b86 100644
--- a/src/declarative/qml/qmlrefcount_p.h
+++ b/src/declarative/qml/qdeclarativerefcount_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLREFCOUNT_P_H
-#define QMLREFCOUNT_P_H
+#ifndef QDECLARATIVEREFCOUNT_P_H
+#define QDECLARATIVEREFCOUNT_P_H
//
// W A R N I N G
@@ -61,11 +61,11 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class Q_AUTOTEST_EXPORT QmlRefCount
+class Q_AUTOTEST_EXPORT QDeclarativeRefCount
{
public:
- QmlRefCount();
- virtual ~QmlRefCount();
+ QDeclarativeRefCount();
+ virtual ~QDeclarativeRefCount();
void addref();
void release();
@@ -77,4 +77,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLREFCOUNT_P_H
+#endif // QDECLARATIVEREFCOUNT_P_H
diff --git a/src/declarative/qml/qmlrewrite.cpp b/src/declarative/qml/qdeclarativerewrite.cpp
index d8a9350..afc6e63 100644
--- a/src/declarative/qml/qmlrewrite.cpp
+++ b/src/declarative/qml/qdeclarativerewrite.cpp
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#include "qmlrewrite_p.h"
+#include "qdeclarativerewrite_p.h"
-#include "qmlglobal_p.h"
+#include "qdeclarativeglobal_p.h"
#include <QtCore/qdebug.h>
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(rewriteDump, QML_REWRITE_DUMP);
-namespace QmlRewrite {
+namespace QDeclarativeRewrite {
bool SharedBindingTester::isSharable(const QString &code)
{
@@ -210,6 +210,6 @@ void RewriteBinding::endVisit(AST::LocalForEachStatement *)
--_inLoop;
}
-} // namespace QmlRewrite
+} // namespace QDeclarativeRewrite
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlrewrite_p.h b/src/declarative/qml/qdeclarativerewrite_p.h
index 27140ba..33b168c 100644
--- a/src/declarative/qml/qmlrewrite_p.h
+++ b/src/declarative/qml/qdeclarativerewrite_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLREWRITE_P_H
-#define QMLREWRITE_P_H
+#ifndef QDECLARATIVEREWRITE_P_H
+#define QDECLARATIVEREWRITE_P_H
//
// W A R N I N G
@@ -54,14 +54,14 @@
//
#include "rewriter/textwriter_p.h"
-#include "parser/qmljslexer_p.h"
-#include "parser/qmljsparser_p.h"
-#include "parser/qmljsnodepool_p.h"
+#include "parser/qdeclarativejslexer_p.h"
+#include "parser/qdeclarativejsparser_p.h"
+#include "parser/qdeclarativejsnodepool_p.h"
QT_BEGIN_NAMESPACE
-namespace QmlRewrite {
-using namespace QmlJS;
+namespace QDeclarativeRewrite {
+using namespace QDeclarativeJS;
class SharedBindingTester : protected AST::Visitor
{
@@ -113,9 +113,9 @@ private:
int _inLoop;
};
-} // namespace QmlRewrite
+} // namespace QDeclarativeRewrite
QT_END_NAMESPACE
-#endif // QMLREWRITE_P_H
+#endif // QDECLARATIVEREWRITE_P_H
diff --git a/src/declarative/qml/qmlscript.cpp b/src/declarative/qml/qdeclarativescript.cpp
index ef142a5..acfb9e1 100644
--- a/src/declarative/qml/qmlscript.cpp
+++ b/src/declarative/qml/qdeclarativescript.cpp
@@ -42,7 +42,7 @@
// This is just a dummy file to include the documentation
/*!
- \qmlclass Script QmlScript
+ \qmlclass Script QDeclarativeScript
\brief The Script element provides a way to add JavaScript code snippets in QML.
\ingroup group_utility
diff --git a/src/declarative/qml/qmlscriptclass_p.h b/src/declarative/qml/qdeclarativescriptclass_p.h
index e7ccc13..d8733db 100644
--- a/src/declarative/qml/qmlscriptclass_p.h
+++ b/src/declarative/qml/qdeclarativescriptclass_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLSCRIPTCLASS_P_H
-#define QMLSCRIPTCLASS_P_H
+#ifndef QDECLARATIVESCRIPTCLASS_P_H
+#define QDECLARATIVESCRIPTCLASS_P_H
//
// W A R N I N G
@@ -58,13 +58,13 @@
QT_BEGIN_NAMESPACE
-class QmlEngine;
-class QmlScriptClass : public QScriptDeclarativeClass
+class QDeclarativeEngine;
+class QDeclarativeScriptClass : public QScriptDeclarativeClass
{
public:
- QmlScriptClass(QScriptEngine *);
+ QDeclarativeScriptClass(QScriptEngine *);
- static QVariant toVariant(QmlEngine *, const QScriptValue &);
+ static QVariant toVariant(QDeclarativeEngine *, const QScriptValue &);
#if (QT_VERSION <= QT_VERSION_CHECK(4, 6, 2)) && !defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE)
struct Value : public QScriptValue {
@@ -86,4 +86,4 @@ public:
QT_END_NAMESPACE
-#endif // QMLSCRIPTCLASS_P_H
+#endif // QDECLARATIVESCRIPTCLASS_P_H
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp
index c0d5cf9..f4c9cdd 100644
--- a/src/declarative/qml/qmlscriptparser.cpp
+++ b/src/declarative/qml/qdeclarativescriptparser.cpp
@@ -39,16 +39,16 @@
**
****************************************************************************/
-#include "qmlscriptparser_p.h"
+#include "qdeclarativescriptparser_p.h"
-#include "qmlparser_p.h"
-#include "parser/qmljsengine_p.h"
-#include "parser/qmljsparser_p.h"
-#include "parser/qmljslexer_p.h"
-#include "parser/qmljsnodepool_p.h"
-#include "parser/qmljsastvisitor_p.h"
-#include "parser/qmljsast_p.h"
-#include "qmlrewrite_p.h"
+#include "qdeclarativeparser_p.h"
+#include "parser/qdeclarativejsengine_p.h"
+#include "parser/qdeclarativejsparser_p.h"
+#include "parser/qdeclarativejslexer_p.h"
+#include "parser/qdeclarativejsnodepool_p.h"
+#include "parser/qdeclarativejsastvisitor_p.h"
+#include "parser/qdeclarativejsast_p.h"
+#include "qdeclarativerewrite_p.h"
#include <qfxperf_p_p.h>
@@ -58,8 +58,8 @@
QT_BEGIN_NAMESPACE
-using namespace QmlJS;
-using namespace QmlParser;
+using namespace QDeclarativeJS;
+using namespace QDeclarativeParser;
namespace {
@@ -100,7 +100,7 @@ class ProcessAST: protected AST::Visitor
};
public:
- ProcessAST(QmlScriptParser *parser);
+ ProcessAST(QDeclarativeScriptParser *parser);
virtual ~ProcessAST();
void operator()(const QString &code, AST::Node *node);
@@ -117,7 +117,7 @@ protected:
LocationSpan location,
AST::UiObjectInitializer *initializer = 0);
- QmlParser::Variant getVariant(AST::ExpressionNode *expr);
+ QDeclarativeParser::Variant getVariant(AST::ExpressionNode *expr);
LocationSpan location(AST::SourceLocation start, AST::SourceLocation end);
LocationSpan location(AST::UiQualifiedId *);
@@ -172,7 +172,7 @@ protected:
}
private:
- QmlScriptParser *_parser;
+ QDeclarativeScriptParser *_parser;
StateStack _stateStack;
QStringList _scope;
QString _contents;
@@ -184,7 +184,7 @@ private:
};
-ProcessAST::ProcessAST(QmlScriptParser *parser)
+ProcessAST::ProcessAST(QDeclarativeScriptParser *parser)
: _parser(parser)
{
}
@@ -263,8 +263,8 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName,
if (!isType) {
if(propertyCount || !currentObject()) {
- QmlError error;
- error.setDescription(QCoreApplication::translate("QmlParser","Expected type name"));
+ QDeclarativeError error;
+ error.setDescription(QCoreApplication::translate("QDeclarativeParser","Expected type name"));
error.setLine(typeLocation.startLine);
error.setColumn(typeLocation.startColumn);
_parser->_errors << error;
@@ -292,8 +292,8 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName,
if (isScript) {
if (_stateStack.isEmpty() || _stateStack.top().property) {
- QmlError error;
- error.setDescription(QCoreApplication::translate("QmlParser","Invalid use of Script block"));
+ QDeclarativeError error;
+ error.setDescription(QCoreApplication::translate("QDeclarativeParser","Invalid use of Script block"));
error.setLine(typeLocation.startLine);
error.setColumn(typeLocation.startColumn);
_parser->_errors << error;
@@ -304,7 +304,7 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName,
Object *obj = new Object;
if (!isScript) {
- QmlScriptParser::TypeReference *typeRef = _parser->findOrCreateType(resolvableObjectType);
+ QDeclarativeScriptParser::TypeReference *typeRef = _parser->findOrCreateType(resolvableObjectType);
obj->type = typeRef->id;
typeRef->refObjects.append(obj);
@@ -382,7 +382,7 @@ Object *ProcessAST::defineObjectBinding(AST::UiQualifiedId *qualifiedId,
QString propertyName = asString(scriptBinding->qualifiedId);
if (propertyName == QLatin1String("source")) {
if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(scriptBinding->statement)) {
- QmlParser::Variant string = getVariant(stmt->expression);
+ QDeclarativeParser::Variant string = getVariant(stmt->expression);
if (string.isStringList()) {
QStringList urls = string.asStringList();
// We need to add this as a resource
@@ -427,13 +427,13 @@ bool ProcessAST::visit(AST::UiProgram *node)
bool ProcessAST::visit(AST::UiImport *node)
{
QString uri;
- QmlScriptParser::Import import;
+ QDeclarativeScriptParser::Import import;
if (node->fileName) {
- import.type = QmlScriptParser::Import::File;
+ import.type = QDeclarativeScriptParser::Import::File;
uri = node->fileName->asString();
} else {
- import.type = QmlScriptParser::Import::Library;
+ import.type = QDeclarativeScriptParser::Import::Library;
uri = asString(node->importUri);
}
@@ -443,8 +443,8 @@ bool ProcessAST::visit(AST::UiImport *node)
if (node->importId) {
import.qualifier = node->importId->asString();
if (!import.qualifier.at(0).isUpper()) {
- QmlError error;
- error.setDescription(QCoreApplication::translate("QmlParser","Invalid import qualifier ID"));
+ QDeclarativeError error;
+ error.setDescription(QCoreApplication::translate("QDeclarativeParser","Invalid import qualifier ID"));
error.setLine(node->importIdToken.startLine);
error.setColumn(node->importIdToken.startColumn);
_parser->_errors << error;
@@ -453,9 +453,9 @@ bool ProcessAST::visit(AST::UiImport *node)
}
if (node->versionToken.isValid())
import.version = textAt(node->versionToken);
- else if (import.type == QmlScriptParser::Import::Library) {
- QmlError error;
- error.setDescription(QCoreApplication::translate("QmlParser","Library import requires a version"));
+ else if (import.type == QDeclarativeScriptParser::Import::Library) {
+ QDeclarativeError error;
+ error.setDescription(QCoreApplication::translate("QDeclarativeParser","Library import requires a version"));
error.setLine(node->importIdToken.startLine);
error.setColumn(node->importIdToken.startColumn);
_parser->_errors << error;
@@ -507,8 +507,8 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
}
if (!qtType) {
- QmlError error;
- error.setDescription(QCoreApplication::translate("QmlParser","Expected parameter type"));
+ QDeclarativeError error;
+ error.setDescription(QCoreApplication::translate("QDeclarativeParser","Expected parameter type"));
error.setLine(node->typeToken.startLine);
error.setColumn(node->typeToken.startColumn);
_parser->_errors << error;
@@ -549,8 +549,8 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
} else if(typemodifier == QLatin1String("list")) {
type = Object::DynamicProperty::CustomList;
} else {
- QmlError error;
- error.setDescription(QCoreApplication::translate("QmlParser","Invalid property type modifier"));
+ QDeclarativeError error;
+ error.setDescription(QCoreApplication::translate("QDeclarativeParser","Invalid property type modifier"));
error.setLine(node->typeModifierToken.startLine);
error.setColumn(node->typeModifierToken.startColumn);
_parser->_errors << error;
@@ -558,8 +558,8 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
}
typeFound = true;
} else if (node->typeModifier) {
- QmlError error;
- error.setDescription(QCoreApplication::translate("QmlParser","Unexpected property type modifier"));
+ QDeclarativeError error;
+ error.setDescription(QCoreApplication::translate("QDeclarativeParser","Unexpected property type modifier"));
error.setLine(node->typeModifierToken.startLine);
error.setColumn(node->typeModifierToken.startColumn);
_parser->_errors << error;
@@ -567,8 +567,8 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
}
if(!typeFound) {
- QmlError error;
- error.setDescription(QCoreApplication::translate("QmlParser","Expected property type"));
+ QDeclarativeError error;
+ error.setDescription(QCoreApplication::translate("QDeclarativeParser","Expected property type"));
error.setLine(node->typeToken.startLine);
error.setColumn(node->typeToken.startColumn);
_parser->_errors << error;
@@ -576,8 +576,8 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
}
if (node->isReadonlyMember) {
- QmlError error;
- error.setDescription(QCoreApplication::translate("QmlParser","Readonly not yet supported"));
+ QDeclarativeError error;
+ error.setDescription(QCoreApplication::translate("QDeclarativeParser","Readonly not yet supported"));
error.setLine(node->readonlyToken.startLine);
error.setColumn(node->readonlyToken.startColumn);
_parser->_errors << error;
@@ -588,7 +588,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
property.isDefaultProperty = node->isDefaultMember;
property.type = type;
if (type >= Object::DynamicProperty::Custom) {
- QmlScriptParser::TypeReference *typeRef =
+ QDeclarativeScriptParser::TypeReference *typeRef =
_parser->findOrCreateType(memberType);
typeRef->refObjects.append(_stateStack.top().object);
}
@@ -646,25 +646,25 @@ bool ProcessAST::visit(AST::UiObjectBinding *node)
return false;
}
-QmlParser::Variant ProcessAST::getVariant(AST::ExpressionNode *expr)
+QDeclarativeParser::Variant ProcessAST::getVariant(AST::ExpressionNode *expr)
{
if (AST::StringLiteral *lit = AST::cast<AST::StringLiteral *>(expr)) {
- return QmlParser::Variant(lit->value->asString());
+ return QDeclarativeParser::Variant(lit->value->asString());
} else if (expr->kind == AST::Node::Kind_TrueLiteral) {
- return QmlParser::Variant(true);
+ return QDeclarativeParser::Variant(true);
} else if (expr->kind == AST::Node::Kind_FalseLiteral) {
- return QmlParser::Variant(false);
+ return QDeclarativeParser::Variant(false);
} else if (AST::NumericLiteral *lit = AST::cast<AST::NumericLiteral *>(expr)) {
- return QmlParser::Variant(lit->value, asString(expr));
+ return QDeclarativeParser::Variant(lit->value, asString(expr));
} else {
if (AST::UnaryMinusExpression *unaryMinus = AST::cast<AST::UnaryMinusExpression *>(expr)) {
if (AST::NumericLiteral *lit = AST::cast<AST::NumericLiteral *>(unaryMinus->expression)) {
- return QmlParser::Variant(-lit->value, asString(expr));
+ return QDeclarativeParser::Variant(-lit->value, asString(expr));
}
}
- return QmlParser::Variant(asString(expr), expr);
+ return QDeclarativeParser::Variant(asString(expr), expr);
}
}
@@ -682,12 +682,12 @@ bool ProcessAST::visit(AST::UiScriptBinding *node)
Property *prop = currentProperty();
- QmlParser::Variant primitive;
+ QDeclarativeParser::Variant primitive;
if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(node->statement)) {
primitive = getVariant(stmt->expression);
} else { // do binding
- primitive = QmlParser::Variant(asString(node->statement),
+ primitive = QDeclarativeParser::Variant(asString(node->statement),
node->statement);
}
@@ -748,7 +748,7 @@ bool ProcessAST::visit(AST::UiArrayBinding *node)
bool ProcessAST::visit(AST::UiSourceElement *node)
{
- QmlParser::Object *obj = currentObject();
+ QDeclarativeParser::Object *obj = currentObject();
bool isScript = (obj && obj->typeName == "Script");
@@ -770,8 +770,8 @@ bool ProcessAST::visit(AST::UiSourceElement *node)
obj->dynamicSlots << slot;
} else {
- QmlError error;
- error.setDescription(QCoreApplication::translate("QmlParser","QmlJS declaration outside Script element"));
+ QDeclarativeError error;
+ error.setDescription(QCoreApplication::translate("QDeclarativeParser","JavaScript declaration outside Script element"));
error.setLine(node->firstSourceLocation().startLine);
error.setColumn(node->firstSourceLocation().startColumn);
_parser->_errors << error;
@@ -789,8 +789,8 @@ bool ProcessAST::visit(AST::UiSourceElement *node)
// ignore variable declarations
line = varStmt->declarationKindToken.startLine;
- QmlError error;
- error.setDescription(QCoreApplication::translate("QmlParser", "Variable declarations not allow in inline Script blocks"));
+ QDeclarativeError error;
+ error.setDescription(QCoreApplication::translate("QDeclarativeParser", "Variable declarations not allow in inline Script blocks"));
error.setLine(node->firstSourceLocation().startLine);
error.setColumn(node->firstSourceLocation().startColumn);
_parser->_errors << error;
@@ -800,7 +800,7 @@ bool ProcessAST::visit(AST::UiSourceElement *node)
Value *value = new Value;
value->location = location(node->firstSourceLocation(),
node->lastSourceLocation());
- value->value = QmlParser::Variant(source);
+ value->value = QDeclarativeParser::Variant(source);
obj->getDefaultProperty()->addValue(value);
}
@@ -811,31 +811,31 @@ bool ProcessAST::visit(AST::UiSourceElement *node)
} // end of anonymous namespace
-QmlScriptParser::QmlScriptParser()
+QDeclarativeScriptParser::QDeclarativeScriptParser()
: root(0), data(0)
{
}
-QmlScriptParser::~QmlScriptParser()
+QDeclarativeScriptParser::~QDeclarativeScriptParser()
{
clear();
}
-class QmlScriptParserJsASTData
+class QDeclarativeScriptParserJsASTData
{
public:
- QmlScriptParserJsASTData(const QString &filename)
+ QDeclarativeScriptParserJsASTData(const QString &filename)
: nodePool(filename, &engine) {}
Engine engine;
NodePool nodePool;
};
-bool QmlScriptParser::parse(const QByteArray &qmldata, const QUrl &url)
+bool QDeclarativeScriptParser::parse(const QByteArray &qmldata, const QUrl &url)
{
#ifdef Q_ENABLE_PERFORMANCE_LOG
- QmlPerfTimer<QmlPerf::QmlParsing> pt;
+ QDeclarativePerfTimer<QDeclarativePerf::QDeclarativeParsing> pt;
#endif
clear();
@@ -845,7 +845,7 @@ bool QmlScriptParser::parse(const QByteArray &qmldata, const QUrl &url)
stream.setCodec("UTF-8");
const QString code = stream.readAll();
- data = new QmlScriptParserJsASTData(fileName);
+ data = new QDeclarativeScriptParserJsASTData(fileName);
Lexer lexer(&data->engine);
lexer.setCode(code, /*line = */ 1);
@@ -860,7 +860,7 @@ bool QmlScriptParser::parse(const QByteArray &qmldata, const QUrl &url)
if (m.isWarning())
continue;
- QmlError error;
+ QDeclarativeError error;
error.setUrl(url);
error.setDescription(m.message);
error.setLine(m.loc.startLine);
@@ -882,32 +882,32 @@ bool QmlScriptParser::parse(const QByteArray &qmldata, const QUrl &url)
return _errors.isEmpty();
}
-QList<QmlScriptParser::TypeReference*> QmlScriptParser::referencedTypes() const
+QList<QDeclarativeScriptParser::TypeReference*> QDeclarativeScriptParser::referencedTypes() const
{
return _refTypes;
}
-QList<QUrl> QmlScriptParser::referencedResources() const
+QList<QUrl> QDeclarativeScriptParser::referencedResources() const
{
return _refUrls;
}
-Object *QmlScriptParser::tree() const
+Object *QDeclarativeScriptParser::tree() const
{
return root;
}
-QList<QmlScriptParser::Import> QmlScriptParser::imports() const
+QList<QDeclarativeScriptParser::Import> QDeclarativeScriptParser::imports() const
{
return _imports;
}
-QList<QmlError> QmlScriptParser::errors() const
+QList<QDeclarativeError> QDeclarativeScriptParser::errors() const
{
return _errors;
}
-void QmlScriptParser::clear()
+void QDeclarativeScriptParser::clear()
{
if (root) {
root->release();
@@ -924,7 +924,7 @@ void QmlScriptParser::clear()
}
}
-QmlScriptParser::TypeReference *QmlScriptParser::findOrCreateType(const QString &name)
+QDeclarativeScriptParser::TypeReference *QDeclarativeScriptParser::findOrCreateType(const QString &name)
{
TypeReference *type = 0;
int i = 0;
@@ -942,7 +942,7 @@ QmlScriptParser::TypeReference *QmlScriptParser::findOrCreateType(const QString
return type;
}
-void QmlScriptParser::setTree(Object *tree)
+void QDeclarativeScriptParser::setTree(Object *tree)
{
Q_ASSERT(! root);
diff --git a/src/declarative/qml/qmlscriptparser_p.h b/src/declarative/qml/qdeclarativescriptparser_p.h
index b420b9a..b8f77d1 100644
--- a/src/declarative/qml/qmlscriptparser_p.h
+++ b/src/declarative/qml/qdeclarativescriptparser_p.h
@@ -38,8 +38,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef QMLSCRIPTPARSER_P_H
-#define QMLSCRIPTPARSER_P_H
+#ifndef QDECLARATIVESCRIPTPARSER_P_H
+#define QDECLARATIVESCRIPTPARSER_P_H
//
// W A R N I N G
@@ -52,8 +52,8 @@
// We mean it.
//
-#include "qmlerror.h"
-#include "qmlparser_p.h"
+#include "qdeclarativeerror.h"
+#include "qdeclarativeparser_p.h"
#include <QtCore/QList>
#include <QtCore/QUrl>
@@ -66,8 +66,8 @@ QT_MODULE(Declarative)
class QByteArray;
-class QmlScriptParserJsASTData;
-class QmlScriptParser
+class QDeclarativeScriptParserJsASTData;
+class QDeclarativeScriptParser
{
public:
class Import
@@ -82,7 +82,7 @@ public:
QString qualifier;
QString version;
- QmlParser::LocationSpan location;
+ QDeclarativeParser::LocationSpan location;
};
class TypeReference
@@ -94,44 +94,44 @@ public:
// type as it has been referenced in Qml
QString name;
// objects in parse tree referencing the type
- QList<QmlParser::Object*> refObjects;
+ QList<QDeclarativeParser::Object*> refObjects;
};
- QmlScriptParser();
- ~QmlScriptParser();
+ QDeclarativeScriptParser();
+ ~QDeclarativeScriptParser();
bool parse(const QByteArray &data, const QUrl &url = QUrl());
QList<TypeReference*> referencedTypes() const;
QList<QUrl> referencedResources() const;
- QmlParser::Object *tree() const;
+ QDeclarativeParser::Object *tree() const;
QList<Import> imports() const;
void clear();
- QList<QmlError> errors() const;
+ QList<QDeclarativeError> errors() const;
// ### private:
TypeReference *findOrCreateType(const QString &name);
- void setTree(QmlParser::Object *tree);
+ void setTree(QDeclarativeParser::Object *tree);
void setScriptFile(const QString &filename) {_scriptFile = filename; }
QString scriptFile() const { return _scriptFile; }
// ### private:
- QList<QmlError> _errors;
+ QList<QDeclarativeError> _errors;
- QmlParser::Object *root;
+ QDeclarativeParser::Object *root;
QList<Import> _imports;
QList<TypeReference*> _refTypes;
QList<QUrl> _refUrls;
QString _scriptFile;
- QmlScriptParserJsASTData *data;
+ QDeclarativeScriptParserJsASTData *data;
};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLSCRIPTPARSER_P_H
+#endif // QDECLARATIVESCRIPTPARSER_P_H
diff --git a/src/declarative/qml/qmlscriptstring.cpp b/src/declarative/qml/qdeclarativescriptstring.cpp
index a80f66b..5b9afe9 100644
--- a/src/declarative/qml/qmlscriptstring.cpp
+++ b/src/declarative/qml/qdeclarativescriptstring.cpp
@@ -39,29 +39,29 @@
**
****************************************************************************/
-#include "qmlscriptstring.h"
+#include "qdeclarativescriptstring.h"
QT_BEGIN_NAMESPACE
-class QmlScriptStringPrivate : public QSharedData
+class QDeclarativeScriptStringPrivate : public QSharedData
{
public:
- QmlScriptStringPrivate() : context(0), scope(0) {}
+ QDeclarativeScriptStringPrivate() : context(0), scope(0) {}
- QmlContext *context;
+ QDeclarativeContext *context;
QObject *scope;
QString script;
};
/*!
-\class QmlScriptString
+\class QDeclarativeScriptString
\since 4.7
-\brief The QmlScriptString class encapsulates a script and its context.
+\brief The QDeclarativeScriptString class encapsulates a script and its context.
-The QmlScriptString is used by properties that want to accept a script "assignment" from QML.
+The QDeclarativeScriptString is used by properties that want to accept a script "assignment" from QML.
Normally, the following code would result in a binding being established for the \c script
-property. If the property had a type of QmlScriptString, the script - \e {console.log(1921)} - itself
+property. If the property had a type of QDeclarativeScriptString, the script - \e {console.log(1921)} - itself
would be passed to the property and it could choose how to handle it.
\code
@@ -74,15 +74,15 @@ MyType {
/*!
Construct an empty instance.
*/
-QmlScriptString::QmlScriptString()
-: d(new QmlScriptStringPrivate)
+QDeclarativeScriptString::QDeclarativeScriptString()
+: d(new QDeclarativeScriptStringPrivate)
{
}
/*!
Copy \a other.
*/
-QmlScriptString::QmlScriptString(const QmlScriptString &other)
+QDeclarativeScriptString::QDeclarativeScriptString(const QDeclarativeScriptString &other)
: d(other.d)
{
}
@@ -90,14 +90,14 @@ QmlScriptString::QmlScriptString(const QmlScriptString &other)
/*!
\internal
*/
-QmlScriptString::~QmlScriptString()
+QDeclarativeScriptString::~QDeclarativeScriptString()
{
}
/*!
Assign \a other to this.
*/
-QmlScriptString &QmlScriptString::operator=(const QmlScriptString &other)
+QDeclarativeScriptString &QDeclarativeScriptString::operator=(const QDeclarativeScriptString &other)
{
d = other.d;
return *this;
@@ -106,7 +106,7 @@ QmlScriptString &QmlScriptString::operator=(const QmlScriptString &other)
/*!
Return the context for the script.
*/
-QmlContext *QmlScriptString::context() const
+QDeclarativeContext *QDeclarativeScriptString::context() const
{
return d->context;
}
@@ -114,7 +114,7 @@ QmlContext *QmlScriptString::context() const
/*!
Sets the \a context for the script.
*/
-void QmlScriptString::setContext(QmlContext *context)
+void QDeclarativeScriptString::setContext(QDeclarativeContext *context)
{
d->context = context;
}
@@ -122,7 +122,7 @@ void QmlScriptString::setContext(QmlContext *context)
/*!
Returns the scope object for the script.
*/
-QObject *QmlScriptString::scopeObject() const
+QObject *QDeclarativeScriptString::scopeObject() const
{
return d->scope;
}
@@ -130,7 +130,7 @@ QObject *QmlScriptString::scopeObject() const
/*!
Sets the scope \a object for the script.
*/
-void QmlScriptString::setScopeObject(QObject *object)
+void QDeclarativeScriptString::setScopeObject(QObject *object)
{
d->scope = object;
}
@@ -138,7 +138,7 @@ void QmlScriptString::setScopeObject(QObject *object)
/*!
Returns the script text.
*/
-QString QmlScriptString::script() const
+QString QDeclarativeScriptString::script() const
{
return d->script;
}
@@ -146,7 +146,7 @@ QString QmlScriptString::script() const
/*!
Sets the \a script text.
*/
-void QmlScriptString::setScript(const QString &script)
+void QDeclarativeScriptString::setScript(const QString &script)
{
d->script = script;
}
diff --git a/src/declarative/qml/qmlscriptstring.h b/src/declarative/qml/qdeclarativescriptstring.h
index 1789eb5..43bef44 100644
--- a/src/declarative/qml/qmlscriptstring.h
+++ b/src/declarative/qml/qdeclarativescriptstring.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLSCRIPTSTRING_H
-#define QMLSCRIPTSTRING_H
+#ifndef QDECLARATIVESCRIPTSTRING_H
+#define QDECLARATIVESCRIPTSTRING_H
#include <QtCore/qstring.h>
#include <QtCore/qshareddata.h>
@@ -53,19 +53,19 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QObject;
-class QmlContext;
-class QmlScriptStringPrivate;
-class Q_DECLARATIVE_EXPORT QmlScriptString
+class QDeclarativeContext;
+class QDeclarativeScriptStringPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeScriptString
{
public:
- QmlScriptString();
- QmlScriptString(const QmlScriptString &);
- ~QmlScriptString();
+ QDeclarativeScriptString();
+ QDeclarativeScriptString(const QDeclarativeScriptString &);
+ ~QDeclarativeScriptString();
- QmlScriptString &operator=(const QmlScriptString &);
+ QDeclarativeScriptString &operator=(const QDeclarativeScriptString &);
- QmlContext *context() const;
- void setContext(QmlContext *);
+ QDeclarativeContext *context() const;
+ void setContext(QDeclarativeContext *);
QObject *scopeObject() const;
void setScopeObject(QObject *);
@@ -74,14 +74,14 @@ public:
void setScript(const QString &);
private:
- QSharedDataPointer<QmlScriptStringPrivate> d;
+ QSharedDataPointer<QDeclarativeScriptStringPrivate> d;
};
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QmlScriptString);
+Q_DECLARE_METATYPE(QDeclarativeScriptString);
QT_END_HEADER
-#endif // QMLSCRIPTSTRING_H
+#endif // QDECLARATIVESCRIPTSTRING_H
diff --git a/src/declarative/qml/qmlsqldatabase.cpp b/src/declarative/qml/qdeclarativesqldatabase.cpp
index 4e0e0fb..855d623 100644
--- a/src/declarative/qml/qmlsqldatabase.cpp
+++ b/src/declarative/qml/qdeclarativesqldatabase.cpp
@@ -39,12 +39,12 @@
**
****************************************************************************/
-#include "qmlsqldatabase_p.h"
+#include "qdeclarativesqldatabase_p.h"
-#include "qmlengine.h"
-#include "qmlengine_p.h"
-#include "qmlrefcount_p.h"
-#include "qmlengine_p.h"
+#include "qdeclarativeengine.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativerefcount_p.h"
+#include "qdeclarativeengine_p.h"
#include <QtCore/qobject.h>
#include <QtScript/qscriptvalue.h>
@@ -67,9 +67,9 @@ Q_DECLARE_METATYPE(QSqlQuery)
QT_BEGIN_NAMESPACE
-class QmlSqlQueryScriptClass: public QScriptClass {
+class QDeclarativeSqlQueryScriptClass: public QScriptClass {
public:
- QmlSqlQueryScriptClass(QScriptEngine *engine) : QScriptClass(engine)
+ QDeclarativeSqlQueryScriptClass(QScriptEngine *engine) : QScriptClass(engine)
{
str_length = engine->toStringHandle(QLatin1String("length"));
str_forwardOnly = engine->toStringHandle(QLatin1String("forwardOnly")); // not in HTML5 (an optimization)
@@ -138,7 +138,7 @@ private:
};
// If the spec changes to allow iteration, check git history...
-// class QmlSqlQueryScriptClassPropertyIterator : public QScriptClassPropertyIterator
+// class QDeclarativeSqlQueryScriptClassPropertyIterator : public QScriptClassPropertyIterator
@@ -175,7 +175,7 @@ static const char* sqlerror[] = {
static QString databaseFile(const QString& connectionName, QScriptEngine *engine)
{
- QmlScriptEngine *qmlengine = static_cast<QmlScriptEngine*>(engine);
+ QDeclarativeScriptEngine *qmlengine = static_cast<QDeclarativeScriptEngine*>(engine);
QString basename = qmlengine->offlineStoragePath
+ QDir::separator() + QLatin1String("Databases") + QDir::separator();
basename += connectionName;
@@ -201,7 +201,7 @@ static QScriptValue qmlsqldatabase_item(QScriptContext *context, QScriptEngine *
static QScriptValue qmlsqldatabase_executeSql_outsidetransaction(QScriptContext *context, QScriptEngine * /*engine*/)
{
- THROW_SQL(DATABASE_ERR,QmlEngine::tr("executeSql called outside transaction()"));
+ THROW_SQL(DATABASE_ERR,QDeclarativeEngine::tr("executeSql called outside transaction()"));
}
static QScriptValue qmlsqldatabase_executeSql(QScriptContext *context, QScriptEngine *engine)
@@ -227,9 +227,9 @@ static QScriptValue qmlsqldatabase_executeSql(QScriptContext *context, QScriptEn
}
if (query.exec()) {
result = engine->newObject();
- QmlScriptEngine *qmlengine = static_cast<QmlScriptEngine*>(engine);
+ QDeclarativeScriptEngine *qmlengine = static_cast<QDeclarativeScriptEngine*>(engine);
if (!qmlengine->sqlQueryClass)
- qmlengine->sqlQueryClass = new QmlSqlQueryScriptClass(engine);
+ qmlengine->sqlQueryClass = new QDeclarativeSqlQueryScriptClass(engine);
QScriptValue rows = engine->newObject(qmlengine->sqlQueryClass);
rows.setData(engine->newVariant(qVariantFromValue(query)));
rows.setProperty(QLatin1String("item"), engine->newFunction(qmlsqldatabase_item,1), QScriptValue::SkipInEnumeration);
@@ -253,7 +253,7 @@ static QScriptValue qmlsqldatabase_executeSql_readonly(QScriptContext *context,
if (sql.startsWith(QLatin1String("SELECT"),Qt::CaseInsensitive)) {
return qmlsqldatabase_executeSql(context,engine);
} else {
- THROW_SQL(SYNTAX_ERR,QmlEngine::tr("Read-only Transaction"))
+ THROW_SQL(SYNTAX_ERR,QDeclarativeEngine::tr("Read-only Transaction"))
}
}
@@ -273,7 +273,7 @@ static QScriptValue qmlsqldatabase_change_version(QScriptContext *context, QScri
QString foundvers = context->thisObject().property(QLatin1String("version")).toString();
if (from_version!=foundvers) {
- THROW_SQL(2,QmlEngine::tr("Version mismatch: expected %1, found %2").arg(from_version).arg(foundvers));
+ THROW_SQL(2,QDeclarativeEngine::tr("Version mismatch: expected %1, found %2").arg(from_version).arg(foundvers));
return engine->undefinedValue();
}
@@ -287,7 +287,7 @@ static QScriptValue qmlsqldatabase_change_version(QScriptContext *context, QScri
} else {
if (!db.commit()) {
db.rollback();
- THROW_SQL(0,QmlEngine::tr("SQL transaction failed"));
+ THROW_SQL(0,QDeclarativeEngine::tr("SQL transaction failed"));
} else {
ok = true;
}
@@ -308,7 +308,7 @@ static QScriptValue qmlsqldatabase_transaction_shared(QScriptContext *context, Q
QSqlDatabase db = qscriptvalue_cast<QSqlDatabase>(context->thisObject());
QScriptValue callback = context->argument(0);
if (!callback.isFunction())
- THROW_SQL(UNKNOWN_ERR,QmlEngine::tr("transaction: missing callback"));
+ THROW_SQL(UNKNOWN_ERR,QDeclarativeEngine::tr("transaction: missing callback"));
QScriptValue instance = engine->newObject();
instance.setProperty(QLatin1String("executeSql"),
@@ -365,7 +365,7 @@ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEng
database = QSqlDatabase::database(dbid);
version = ini.value(QLatin1String("Version")).toString();
if (version != dbversion && !dbversion.isEmpty() && !version.isEmpty())
- THROW_SQL(VERSION_ERR,QmlEngine::tr("SQL: database version mismatch"));
+ THROW_SQL(VERSION_ERR,QDeclarativeEngine::tr("SQL: database version mismatch"));
} else {
created = !QFile::exists(basename+QLatin1String(".sqlite"));
database = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), dbid);
@@ -381,7 +381,7 @@ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEng
} else {
if (!dbversion.isEmpty() && ini.value(QLatin1String("Version")) != dbversion) {
// Incompatible
- THROW_SQL(VERSION_ERR,QmlEngine::tr("SQL: database version mismatch"));
+ THROW_SQL(VERSION_ERR,QDeclarativeEngine::tr("SQL: database version mismatch"));
}
version = ini.value(QLatin1String("Version")).toString();
}
diff --git a/src/declarative/qml/qmlsqldatabase_p.h b/src/declarative/qml/qdeclarativesqldatabase_p.h
index 0fd275b..d0b6c0b 100644
--- a/src/declarative/qml/qmlsqldatabase_p.h
+++ b/src/declarative/qml/qdeclarativesqldatabase_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLSQLDATABASE_P_H
-#define QMLSQLDATABASE_P_H
+#ifndef QDECLARATIVESQLDATABASE_P_H
+#define QDECLARATIVESQLDATABASE_P_H
#include <QtScript/qscriptengine.h>
//
@@ -63,5 +63,5 @@ void qt_add_qmlsqldatabase(QScriptEngine *engine);
QT_END_NAMESPACE
-#endif // QMLSQLDATABASE_P_H
+#endif // QDECLARATIVESQLDATABASE_P_H
diff --git a/src/declarative/qml/qmlstringconverters.cpp b/src/declarative/qml/qdeclarativestringconverters.cpp
index 6ba70d3..f3497e5 100644
--- a/src/declarative/qml/qmlstringconverters.cpp
+++ b/src/declarative/qml/qdeclarativestringconverters.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmlstringconverters_p.h"
+#include "qdeclarativestringconverters_p.h"
#include <QtGui/qcolor.h>
#include <QtGui/qvector3d.h>
@@ -78,7 +78,7 @@ static uchar fromHex(const QString &s, int idx)
return fromHex(c, c2);
}
-QVariant QmlStringConverters::variantFromString(const QString &s)
+QVariant QDeclarativeStringConverters::variantFromString(const QString &s)
{
if (s.isEmpty())
return QVariant(s);
@@ -101,7 +101,7 @@ QVariant QmlStringConverters::variantFromString(const QString &s)
return QVariant(s);
}
-QVariant QmlStringConverters::variantFromString(const QString &s, int preferredType, bool *ok)
+QVariant QDeclarativeStringConverters::variantFromString(const QString &s, int preferredType, bool *ok)
{
switch (preferredType) {
case QMetaType::QColor:
@@ -132,7 +132,7 @@ QVariant QmlStringConverters::variantFromString(const QString &s, int preferredT
}
}
-QColor QmlStringConverters::colorFromString(const QString &s, bool *ok)
+QColor QDeclarativeStringConverters::colorFromString(const QString &s, bool *ok)
{
if (s.startsWith(QLatin1Char('#')) && s.length() == 9) {
uchar a = fromHex(s, 1);
@@ -150,21 +150,21 @@ QColor QmlStringConverters::colorFromString(const QString &s, bool *ok)
}
}
-QDate QmlStringConverters::dateFromString(const QString &s, bool *ok)
+QDate QDeclarativeStringConverters::dateFromString(const QString &s, bool *ok)
{
QDate d = QDate::fromString(s, Qt::ISODate);
if (ok) *ok = d.isValid();
return d;
}
-QTime QmlStringConverters::timeFromString(const QString &s, bool *ok)
+QTime QDeclarativeStringConverters::timeFromString(const QString &s, bool *ok)
{
QTime t = QTime::fromString(s, Qt::ISODate);
if (ok) *ok = t.isValid();
return t;
}
-QDateTime QmlStringConverters::dateTimeFromString(const QString &s, bool *ok)
+QDateTime QDeclarativeStringConverters::dateTimeFromString(const QString &s, bool *ok)
{
QDateTime d = QDateTime::fromString(s, Qt::ISODate);
if (ok) *ok = d.isValid();
@@ -172,7 +172,7 @@ QDateTime QmlStringConverters::dateTimeFromString(const QString &s, bool *ok)
}
//expects input of "x,y"
-QPointF QmlStringConverters::pointFFromString(const QString &s, bool *ok)
+QPointF QDeclarativeStringConverters::pointFFromString(const QString &s, bool *ok)
{
if (s.count(QLatin1Char(',')) != 1) {
if (ok)
@@ -196,7 +196,7 @@ QPointF QmlStringConverters::pointFFromString(const QString &s, bool *ok)
}
//expects input of "widthxheight"
-QSizeF QmlStringConverters::sizeFFromString(const QString &s, bool *ok)
+QSizeF QDeclarativeStringConverters::sizeFFromString(const QString &s, bool *ok)
{
if (s.count(QLatin1Char('x')) != 1) {
if (ok)
@@ -220,7 +220,7 @@ QSizeF QmlStringConverters::sizeFFromString(const QString &s, bool *ok)
}
//expects input of "x,y,widthxheight" //### use space instead of second comma?
-QRectF QmlStringConverters::rectFFromString(const QString &s, bool *ok)
+QRectF QDeclarativeStringConverters::rectFFromString(const QString &s, bool *ok)
{
if (s.count(QLatin1Char(',')) != 2 || s.count(QLatin1Char('x')) != 1) {
if (ok)
@@ -248,7 +248,7 @@ QRectF QmlStringConverters::rectFFromString(const QString &s, bool *ok)
}
//expects input of "x,y,z"
-QVector3D QmlStringConverters::vector3DFromString(const QString &s, bool *ok)
+QVector3D QDeclarativeStringConverters::vector3DFromString(const QString &s, bool *ok)
{
if (s.count(QLatin1Char(',')) != 2) {
if (ok)
diff --git a/src/declarative/qml/qmlstringconverters_p.h b/src/declarative/qml/qdeclarativestringconverters_p.h
index c83a1de..7afdfd3 100644
--- a/src/declarative/qml/qmlstringconverters_p.h
+++ b/src/declarative/qml/qdeclarativestringconverters_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLSTRINGCONVERTERS_P_H
-#define QMLSTRINGCONVERTERS_P_H
+#ifndef QDECLARATIVESTRINGCONVERTERS_P_H
+#define QDECLARATIVESTRINGCONVERTERS_P_H
//
// W A R N I N G
@@ -67,7 +67,7 @@ class QByteArray;
class QVector3D;
// XXX - Bauhaus currently uses these methods which is why they're exported
-namespace QmlStringConverters
+namespace QDeclarativeStringConverters
{
QVariant Q_DECLARATIVE_EXPORT variantFromString(const QString &);
QVariant Q_DECLARATIVE_EXPORT variantFromString(const QString &, int preferredType, bool *ok = 0);
@@ -84,4 +84,4 @@ namespace QmlStringConverters
QT_END_NAMESPACE
-#endif // QMLSTRINGCONVERTERS_P_H
+#endif // QDECLARATIVESTRINGCONVERTERS_P_H
diff --git a/src/declarative/qml/qmltypenamecache.cpp b/src/declarative/qml/qdeclarativetypenamecache.cpp
index eef3bae..f94f944 100644
--- a/src/declarative/qml/qmltypenamecache.cpp
+++ b/src/declarative/qml/qdeclarativetypenamecache.cpp
@@ -39,23 +39,23 @@
**
****************************************************************************/
-#include "qmltypenamecache_p.h"
+#include "qdeclarativetypenamecache_p.h"
-#include "qmlengine_p.h"
+#include "qdeclarativeengine_p.h"
QT_BEGIN_NAMESPACE
-QmlTypeNameCache::QmlTypeNameCache(QmlEngine *e)
-: QmlCleanup(e), engine(e)
+QDeclarativeTypeNameCache::QDeclarativeTypeNameCache(QDeclarativeEngine *e)
+: QDeclarativeCleanup(e), engine(e)
{
}
-QmlTypeNameCache::~QmlTypeNameCache()
+QDeclarativeTypeNameCache::~QDeclarativeTypeNameCache()
{
clear();
}
-void QmlTypeNameCache::clear()
+void QDeclarativeTypeNameCache::clear()
{
qDeleteAll(stringCache);
stringCache.clear();
@@ -63,12 +63,12 @@ void QmlTypeNameCache::clear()
engine = 0;
}
-void QmlTypeNameCache::add(const QString &name, QmlType *type)
+void QDeclarativeTypeNameCache::add(const QString &name, QDeclarativeType *type)
{
if (stringCache.contains(name))
return;
- QmlEnginePrivate *ep = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
RData *data = new RData;
// ### Use typename class
@@ -78,12 +78,12 @@ void QmlTypeNameCache::add(const QString &name, QmlType *type)
identifierCache.insert(data->identifier.identifier, data);
}
-void QmlTypeNameCache::add(const QString &name, QmlTypeNameCache *typeNamespace)
+void QDeclarativeTypeNameCache::add(const QString &name, QDeclarativeTypeNameCache *typeNamespace)
{
if (stringCache.contains(name))
return;
- QmlEnginePrivate *ep = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
RData *data = new RData;
// ### Use typename class
@@ -94,7 +94,7 @@ void QmlTypeNameCache::add(const QString &name, QmlTypeNameCache *typeNamespace)
typeNamespace->addref();
}
-QmlTypeNameCache::Data *QmlTypeNameCache::data(const QString &id) const
+QDeclarativeTypeNameCache::Data *QDeclarativeTypeNameCache::data(const QString &id) const
{
return stringCache.value(id);
}
diff --git a/src/declarative/qml/qmltypenamecache_p.h b/src/declarative/qml/qdeclarativetypenamecache_p.h
index e578277..eee5b77 100644
--- a/src/declarative/qml/qmltypenamecache_p.h
+++ b/src/declarative/qml/qdeclarativetypenamecache_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLTYPENAMECACHE_P_H
-#define QMLTYPENAMECACHE_P_H
+#ifndef QDECLARATIVETYPENAMECACHE_P_H
+#define QDECLARATIVETYPENAMECACHE_P_H
//
// W A R N I N G
@@ -53,30 +53,30 @@
// We mean it.
//
-#include "qmlrefcount_p.h"
-#include "qmlcleanup_p.h"
+#include "qdeclarativerefcount_p.h"
+#include "qdeclarativecleanup_p.h"
#include <private/qscriptdeclarativeclass_p.h>
QT_BEGIN_NAMESPACE
-class QmlType;
-class QmlEngine;
-class QmlTypeNameCache : public QmlRefCount, public QmlCleanup
+class QDeclarativeType;
+class QDeclarativeEngine;
+class QDeclarativeTypeNameCache : public QDeclarativeRefCount, public QDeclarativeCleanup
{
public:
- QmlTypeNameCache(QmlEngine *);
- virtual ~QmlTypeNameCache();
+ QDeclarativeTypeNameCache(QDeclarativeEngine *);
+ virtual ~QDeclarativeTypeNameCache();
struct Data {
inline Data();
inline ~Data();
- QmlType *type;
- QmlTypeNameCache *typeNamespace;
+ QDeclarativeType *type;
+ QDeclarativeTypeNameCache *typeNamespace;
};
- void add(const QString &, QmlType *);
- void add(const QString &, QmlTypeNameCache *);
+ void add(const QString &, QDeclarativeType *);
+ void add(const QString &, QDeclarativeTypeNameCache *);
Data *data(const QString &) const;
inline Data *data(const QScriptDeclarativeClass::Identifier &id) const;
@@ -93,25 +93,25 @@ private:
StringCache stringCache;
IdentifierCache identifierCache;
- QmlEngine *engine;
+ QDeclarativeEngine *engine;
};
-QmlTypeNameCache::Data::Data()
+QDeclarativeTypeNameCache::Data::Data()
: type(0), typeNamespace(0)
{
}
-QmlTypeNameCache::Data::~Data()
+QDeclarativeTypeNameCache::Data::~Data()
{
if (typeNamespace) typeNamespace->release();
}
-QmlTypeNameCache::Data *QmlTypeNameCache::data(const QScriptDeclarativeClass::Identifier &id) const
+QDeclarativeTypeNameCache::Data *QDeclarativeTypeNameCache::data(const QScriptDeclarativeClass::Identifier &id) const
{
return identifierCache.value(id);
}
QT_END_NAMESPACE
-#endif // QMLTYPENAMECACHE_P_H
+#endif // QDECLARATIVETYPENAMECACHE_P_H
diff --git a/src/declarative/qml/qmltypenamescriptclass.cpp b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp
index 32a7a25..02370e0 100644
--- a/src/declarative/qml/qmltypenamescriptclass.cpp
+++ b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp
@@ -39,16 +39,16 @@
**
****************************************************************************/
-#include "qmltypenamescriptclass_p.h"
+#include "qdeclarativetypenamescriptclass_p.h"
-#include "qmlengine_p.h"
-#include "qmltypenamecache_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativetypenamecache_p.h"
QT_BEGIN_NAMESPACE
struct TypeNameData : public QScriptDeclarativeClass::Object {
- TypeNameData(QObject *o, QmlType *t, QmlTypeNameScriptClass::TypeNameMode m) : object(o), type(t), typeNamespace(0), mode(m) {}
- TypeNameData(QObject *o, QmlTypeNameCache *n, QmlTypeNameScriptClass::TypeNameMode m) : object(o), type(0), typeNamespace(n), mode(m) {
+ TypeNameData(QObject *o, QDeclarativeType *t, QDeclarativeTypeNameScriptClass::TypeNameMode m) : object(o), type(t), typeNamespace(0), mode(m) {}
+ TypeNameData(QObject *o, QDeclarativeTypeNameCache *n, QDeclarativeTypeNameScriptClass::TypeNameMode m) : object(o), type(0), typeNamespace(n), mode(m) {
if (typeNamespace) typeNamespace->addref();
}
~TypeNameData() {
@@ -56,37 +56,37 @@ struct TypeNameData : public QScriptDeclarativeClass::Object {
}
QObject *object;
- QmlType *type;
- QmlTypeNameCache *typeNamespace;
- QmlTypeNameScriptClass::TypeNameMode mode;
+ QDeclarativeType *type;
+ QDeclarativeTypeNameCache *typeNamespace;
+ QDeclarativeTypeNameScriptClass::TypeNameMode mode;
};
-QmlTypeNameScriptClass::QmlTypeNameScriptClass(QmlEngine *bindEngine)
-: QmlScriptClass(QmlEnginePrivate::getScriptEngine(bindEngine)),
+QDeclarativeTypeNameScriptClass::QDeclarativeTypeNameScriptClass(QDeclarativeEngine *bindEngine)
+: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)),
engine(bindEngine), object(0), type(0)
{
}
-QmlTypeNameScriptClass::~QmlTypeNameScriptClass()
+QDeclarativeTypeNameScriptClass::~QDeclarativeTypeNameScriptClass()
{
}
-QScriptValue QmlTypeNameScriptClass::newObject(QObject *object, QmlType *type, TypeNameMode mode)
+QScriptValue QDeclarativeTypeNameScriptClass::newObject(QObject *object, QDeclarativeType *type, TypeNameMode mode)
{
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
return QScriptDeclarativeClass::newObject(scriptEngine, this, new TypeNameData(object, type, mode));
}
-QScriptValue QmlTypeNameScriptClass::newObject(QObject *object, QmlTypeNameCache *ns, TypeNameMode mode)
+QScriptValue QDeclarativeTypeNameScriptClass::newObject(QObject *object, QDeclarativeTypeNameCache *ns, TypeNameMode mode)
{
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
return QScriptDeclarativeClass::newObject(scriptEngine, this, new TypeNameData(object, ns, mode));
}
QScriptClass::QueryFlags
-QmlTypeNameScriptClass::queryProperty(Object *obj, const Identifier &name,
+QDeclarativeTypeNameScriptClass::queryProperty(Object *obj, const Identifier &name,
QScriptClass::QueryFlags flags)
{
Q_UNUSED(flags);
@@ -95,11 +95,11 @@ QmlTypeNameScriptClass::queryProperty(Object *obj, const Identifier &name,
object = 0;
type = 0;
- QmlEnginePrivate *ep = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
if (data->typeNamespace) {
- QmlTypeNameCache::Data *d = data->typeNamespace->data(name);
+ QDeclarativeTypeNameCache::Data *d = data->typeNamespace->data(name);
if (d && d->type) {
type = d->type;
return QScriptClass::HandlesReadAccess;
@@ -139,11 +139,11 @@ QmlTypeNameScriptClass::queryProperty(Object *obj, const Identifier &name,
return 0;
}
-QmlTypeNameScriptClass::ScriptValue
-QmlTypeNameScriptClass::property(Object *obj, const Identifier &name)
+QDeclarativeTypeNameScriptClass::ScriptValue
+QDeclarativeTypeNameScriptClass::property(Object *obj, const Identifier &name)
{
- QmlEnginePrivate *ep = QmlEnginePrivate::get(engine);
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
if (type) {
return Value(scriptEngine, newObject(((TypeNameData *)obj)->object, type, ((TypeNameData *)obj)->mode));
} else if (object) {
@@ -153,12 +153,12 @@ QmlTypeNameScriptClass::property(Object *obj, const Identifier &name)
}
}
-void QmlTypeNameScriptClass::setProperty(Object *o, const Identifier &n, const QScriptValue &v)
+void QDeclarativeTypeNameScriptClass::setProperty(Object *o, const Identifier &n, const QScriptValue &v)
{
Q_ASSERT(object);
Q_ASSERT(!type);
- QmlEnginePrivate *ep = QmlEnginePrivate::get(engine);
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
ep->objectClass->setProperty(((TypeNameData *)o)->object, n, v);
}
diff --git a/src/declarative/qml/qmltypenamescriptclass_p.h b/src/declarative/qml/qdeclarativetypenamescriptclass_p.h
index fd5752d..b6e3f51 100644
--- a/src/declarative/qml/qmltypenamescriptclass_p.h
+++ b/src/declarative/qml/qdeclarativetypenamescriptclass_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLTYPENAMESCRIPTCLASS_P_H
-#define QMLTYPENAMESCRIPTCLASS_P_H
+#ifndef QDECLARATIVETYPENAMESCRIPTCLASS_P_H
+#define QDECLARATIVETYPENAMESCRIPTCLASS_P_H
//
// W A R N I N G
@@ -52,26 +52,26 @@
//
// We mean it.
//
-#include "qmlengine_p.h"
+#include "qdeclarativeengine_p.h"
#include <QtScript/qscriptclass.h>
-#include <private/qmlscriptclass_p.h>
+#include <private/qdeclarativescriptclass_p.h>
QT_BEGIN_NAMESPACE
-class QmlEngine;
-class QmlType;
-class QmlTypeNameCache;
-class QmlTypeNameScriptClass : public QmlScriptClass
+class QDeclarativeEngine;
+class QDeclarativeType;
+class QDeclarativeTypeNameCache;
+class QDeclarativeTypeNameScriptClass : public QDeclarativeScriptClass
{
public:
- QmlTypeNameScriptClass(QmlEngine *);
- ~QmlTypeNameScriptClass();
+ QDeclarativeTypeNameScriptClass(QDeclarativeEngine *);
+ ~QDeclarativeTypeNameScriptClass();
enum TypeNameMode { IncludeEnums, ExcludeEnums };
- QScriptValue newObject(QObject *, QmlType *, TypeNameMode = IncludeEnums);
- QScriptValue newObject(QObject *, QmlTypeNameCache *, TypeNameMode = IncludeEnums);
+ QScriptValue newObject(QObject *, QDeclarativeType *, TypeNameMode = IncludeEnums);
+ QScriptValue newObject(QObject *, QDeclarativeTypeNameCache *, TypeNameMode = IncludeEnums);
protected:
virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &,
@@ -81,13 +81,13 @@ protected:
virtual void setProperty(Object *, const Identifier &name, const QScriptValue &);
private:
- QmlEngine *engine;
+ QDeclarativeEngine *engine;
QObject *object;
- QmlType *type;
+ QDeclarativeType *type;
quint32 enumValue;
};
QT_END_NAMESPACE
-#endif // QMLTYPENAMESCRIPTCLASS_P_H
+#endif // QDECLARATIVETYPENAMESCRIPTCLASS_P_H
diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp
new file mode 100644
index 0000000..01fa214
--- /dev/null
+++ b/src/declarative/qml/qdeclarativevaluetype.cpp
@@ -0,0 +1,706 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 "qdeclarativevaluetype_p.h"
+
+#include <QtCore/qdebug.h>
+
+QT_BEGIN_NAMESPACE
+
+QDeclarativeValueTypeFactory::QDeclarativeValueTypeFactory()
+{
+ // ### Optimize
+ for (unsigned int ii = 0; ii < (QVariant::UserType - 1); ++ii)
+ valueTypes[ii] = valueType(ii);
+}
+
+QDeclarativeValueTypeFactory::~QDeclarativeValueTypeFactory()
+{
+ for (unsigned int ii = 0; ii < (QVariant::UserType - 1); ++ii)
+ delete valueTypes[ii];
+}
+
+QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t)
+{
+ switch (t) {
+ case QVariant::Point:
+ return new QDeclarativePointValueType;
+ case QVariant::PointF:
+ return new QDeclarativePointFValueType;
+ case QVariant::Size:
+ return new QDeclarativeSizeValueType;
+ case QVariant::SizeF:
+ return new QDeclarativeSizeFValueType;
+ case QVariant::Rect:
+ return new QDeclarativeRectValueType;
+ case QVariant::RectF:
+ return new QDeclarativeRectFValueType;
+ case QVariant::Vector3D:
+ return new QDeclarativeVector3DValueType;
+ case QVariant::EasingCurve:
+ return new QDeclarativeEasingValueType;
+ case QVariant::Font:
+ return new QDeclarativeFontValueType;
+ default:
+ return 0;
+ }
+}
+
+QDeclarativeValueType::QDeclarativeValueType(QObject *parent)
+: QObject(parent)
+{
+}
+
+QDeclarativePointFValueType::QDeclarativePointFValueType(QObject *parent)
+: QDeclarativeValueType(parent)
+{
+}
+
+void QDeclarativePointFValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &point, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QDeclarativePointFValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &point, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QDeclarativePointFValueType::value()
+{
+ return QVariant(point);
+}
+
+void QDeclarativePointFValueType::setValue(QVariant value)
+{
+ point = qvariant_cast<QPointF>(value);
+}
+
+qreal QDeclarativePointFValueType::x() const
+{
+ return point.x();
+}
+
+qreal QDeclarativePointFValueType::y() const
+{
+ return point.y();
+}
+
+void QDeclarativePointFValueType::setX(qreal x)
+{
+ point.setX(x);
+}
+
+void QDeclarativePointFValueType::setY(qreal y)
+{
+ point.setY(y);
+}
+
+QDeclarativePointValueType::QDeclarativePointValueType(QObject *parent)
+: QDeclarativeValueType(parent)
+{
+}
+
+void QDeclarativePointValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &point, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QDeclarativePointValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &point, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QDeclarativePointValueType::value()
+{
+ return QVariant(point);
+}
+
+void QDeclarativePointValueType::setValue(QVariant value)
+{
+ point = qvariant_cast<QPoint>(value);
+}
+
+int QDeclarativePointValueType::x() const
+{
+ return point.x();
+}
+
+int QDeclarativePointValueType::y() const
+{
+ return point.y();
+}
+
+void QDeclarativePointValueType::setX(int x)
+{
+ point.setX(x);
+}
+
+void QDeclarativePointValueType::setY(int y)
+{
+ point.setY(y);
+}
+
+QDeclarativeSizeFValueType::QDeclarativeSizeFValueType(QObject *parent)
+: QDeclarativeValueType(parent)
+{
+}
+
+void QDeclarativeSizeFValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &size, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QDeclarativeSizeFValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &size, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QDeclarativeSizeFValueType::value()
+{
+ return QVariant(size);
+}
+
+void QDeclarativeSizeFValueType::setValue(QVariant value)
+{
+ size = qvariant_cast<QSizeF>(value);
+}
+
+qreal QDeclarativeSizeFValueType::width() const
+{
+ return size.width();
+}
+
+qreal QDeclarativeSizeFValueType::height() const
+{
+ return size.height();
+}
+
+void QDeclarativeSizeFValueType::setWidth(qreal w)
+{
+ size.setWidth(w);
+}
+
+void QDeclarativeSizeFValueType::setHeight(qreal h)
+{
+ size.setHeight(h);
+}
+
+QDeclarativeSizeValueType::QDeclarativeSizeValueType(QObject *parent)
+: QDeclarativeValueType(parent)
+{
+}
+
+void QDeclarativeSizeValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &size, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QDeclarativeSizeValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &size, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QDeclarativeSizeValueType::value()
+{
+ return QVariant(size);
+}
+
+void QDeclarativeSizeValueType::setValue(QVariant value)
+{
+ size = qvariant_cast<QSize>(value);
+}
+
+int QDeclarativeSizeValueType::width() const
+{
+ return size.width();
+}
+
+int QDeclarativeSizeValueType::height() const
+{
+ return size.height();
+}
+
+void QDeclarativeSizeValueType::setWidth(int w)
+{
+ size.setWidth(w);
+}
+
+void QDeclarativeSizeValueType::setHeight(int h)
+{
+ size.setHeight(h);
+}
+
+QDeclarativeRectFValueType::QDeclarativeRectFValueType(QObject *parent)
+: QDeclarativeValueType(parent)
+{
+}
+
+void QDeclarativeRectFValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &rect, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QDeclarativeRectFValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &rect, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QDeclarativeRectFValueType::value()
+{
+ return QVariant(rect);
+}
+
+void QDeclarativeRectFValueType::setValue(QVariant value)
+{
+ rect = qvariant_cast<QRectF>(value);
+}
+
+qreal QDeclarativeRectFValueType::x() const
+{
+ return rect.x();
+}
+
+qreal QDeclarativeRectFValueType::y() const
+{
+ return rect.y();
+}
+
+void QDeclarativeRectFValueType::setX(qreal x)
+{
+ rect.moveLeft(x);
+}
+
+void QDeclarativeRectFValueType::setY(qreal y)
+{
+ rect.moveTop(y);
+}
+
+qreal QDeclarativeRectFValueType::width() const
+{
+ return rect.width();
+}
+
+qreal QDeclarativeRectFValueType::height() const
+{
+ return rect.height();
+}
+
+void QDeclarativeRectFValueType::setWidth(qreal w)
+{
+ rect.setWidth(w);
+}
+
+void QDeclarativeRectFValueType::setHeight(qreal h)
+{
+ rect.setHeight(h);
+}
+
+QDeclarativeRectValueType::QDeclarativeRectValueType(QObject *parent)
+: QDeclarativeValueType(parent)
+{
+}
+
+void QDeclarativeRectValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &rect, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QDeclarativeRectValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &rect, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QDeclarativeRectValueType::value()
+{
+ return QVariant(rect);
+}
+
+void QDeclarativeRectValueType::setValue(QVariant value)
+{
+ rect = qvariant_cast<QRect>(value);
+}
+
+int QDeclarativeRectValueType::x() const
+{
+ return rect.x();
+}
+
+int QDeclarativeRectValueType::y() const
+{
+ return rect.y();
+}
+
+void QDeclarativeRectValueType::setX(int x)
+{
+ rect.moveLeft(x);
+}
+
+void QDeclarativeRectValueType::setY(int y)
+{
+ rect.moveTop(y);
+}
+
+int QDeclarativeRectValueType::width() const
+{
+ return rect.width();
+}
+
+int QDeclarativeRectValueType::height() const
+{
+ return rect.height();
+}
+
+void QDeclarativeRectValueType::setWidth(int w)
+{
+ rect.setWidth(w);
+}
+
+void QDeclarativeRectValueType::setHeight(int h)
+{
+ rect.setHeight(h);
+}
+
+QDeclarativeVector3DValueType::QDeclarativeVector3DValueType(QObject *parent)
+: QDeclarativeValueType(parent)
+{
+}
+
+void QDeclarativeVector3DValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &vector, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QDeclarativeVector3DValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &vector, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QDeclarativeVector3DValueType::value()
+{
+ return QVariant(vector);
+}
+
+void QDeclarativeVector3DValueType::setValue(QVariant value)
+{
+ vector = qvariant_cast<QVector3D>(value);
+}
+
+qreal QDeclarativeVector3DValueType::x() const
+{
+ return vector.x();
+}
+
+qreal QDeclarativeVector3DValueType::y() const
+{
+ return vector.y();
+}
+
+qreal QDeclarativeVector3DValueType::z() const
+{
+ return vector.z();
+}
+
+void QDeclarativeVector3DValueType::setX(qreal x)
+{
+ vector.setX(x);
+}
+
+void QDeclarativeVector3DValueType::setY(qreal y)
+{
+ vector.setY(y);
+}
+
+void QDeclarativeVector3DValueType::setZ(qreal z)
+{
+ vector.setZ(z);
+}
+
+QDeclarativeEasingValueType::QDeclarativeEasingValueType(QObject *parent)
+: QDeclarativeValueType(parent)
+{
+}
+
+void QDeclarativeEasingValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &easing, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QDeclarativeEasingValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &easing, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QDeclarativeEasingValueType::value()
+{
+ return QVariant(easing);
+}
+
+void QDeclarativeEasingValueType::setValue(QVariant value)
+{
+ easing = qvariant_cast<QEasingCurve>(value);
+}
+
+QDeclarativeEasingValueType::Type QDeclarativeEasingValueType::type() const
+{
+ return (QDeclarativeEasingValueType::Type)easing.type();
+}
+
+qreal QDeclarativeEasingValueType::amplitude() const
+{
+ return easing.amplitude();
+}
+
+qreal QDeclarativeEasingValueType::overshoot() const
+{
+ return easing.overshoot();
+}
+
+qreal QDeclarativeEasingValueType::period() const
+{
+ return easing.period();
+}
+
+void QDeclarativeEasingValueType::setType(QDeclarativeEasingValueType::Type type)
+{
+ easing.setType((QEasingCurve::Type)type);
+}
+
+void QDeclarativeEasingValueType::setAmplitude(qreal amplitude)
+{
+ easing.setAmplitude(amplitude);
+}
+
+void QDeclarativeEasingValueType::setOvershoot(qreal overshoot)
+{
+ easing.setOvershoot(overshoot);
+}
+
+void QDeclarativeEasingValueType::setPeriod(qreal period)
+{
+ easing.setPeriod(period);
+}
+
+QDeclarativeFontValueType::QDeclarativeFontValueType(QObject *parent)
+: QDeclarativeValueType(parent), hasPixelSize(false)
+{
+}
+
+void QDeclarativeFontValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &font, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QDeclarativeFontValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &font, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QDeclarativeFontValueType::value()
+{
+ return QVariant(font);
+}
+
+void QDeclarativeFontValueType::setValue(QVariant value)
+{
+ font = qvariant_cast<QFont>(value);
+}
+
+
+QString QDeclarativeFontValueType::family() const
+{
+ return font.family();
+}
+
+void QDeclarativeFontValueType::setFamily(const QString &family)
+{
+ font.setFamily(family);
+}
+
+bool QDeclarativeFontValueType::bold() const
+{
+ return font.bold();
+}
+
+void QDeclarativeFontValueType::setBold(bool b)
+{
+ font.setBold(b);
+}
+
+QDeclarativeFontValueType::FontWeight QDeclarativeFontValueType::weight() const
+{
+ return (QDeclarativeFontValueType::FontWeight)font.weight();
+}
+
+void QDeclarativeFontValueType::setWeight(QDeclarativeFontValueType::FontWeight w)
+{
+ font.setWeight((QFont::Weight)w);
+}
+
+bool QDeclarativeFontValueType::italic() const
+{
+ return font.italic();
+}
+
+void QDeclarativeFontValueType::setItalic(bool b)
+{
+ font.setItalic(b);
+}
+
+bool QDeclarativeFontValueType::underline() const
+{
+ return font.underline();
+}
+
+void QDeclarativeFontValueType::setUnderline(bool b)
+{
+ font.setUnderline(b);
+}
+
+bool QDeclarativeFontValueType::overline() const
+{
+ return font.overline();
+}
+
+void QDeclarativeFontValueType::setOverline(bool b)
+{
+ font.setOverline(b);
+}
+
+bool QDeclarativeFontValueType::strikeout() const
+{
+ return font.strikeOut();
+}
+
+void QDeclarativeFontValueType::setStrikeout(bool b)
+{
+ font.setStrikeOut(b);
+}
+
+qreal QDeclarativeFontValueType::pointSize() const
+{
+ return font.pointSizeF();
+}
+
+void QDeclarativeFontValueType::setPointSize(qreal size)
+{
+ if (hasPixelSize) {
+ qWarning() << "Both point size and pixel size set. Using pixel size.";
+ return;
+ }
+
+ if (size >= 0.0)
+ font.setPointSizeF(size);
+}
+
+int QDeclarativeFontValueType::pixelSize() const
+{
+ return font.pixelSize();
+}
+
+void QDeclarativeFontValueType::setPixelSize(int size)
+{
+ if (size >=0) {
+ font.setPixelSize(size);
+ hasPixelSize = true;
+ } else {
+ hasPixelSize = false;
+ }
+}
+
+QDeclarativeFontValueType::Capitalization QDeclarativeFontValueType::capitalization() const
+{
+ return (QDeclarativeFontValueType::Capitalization)font.capitalization();
+}
+
+void QDeclarativeFontValueType::setCapitalization(QDeclarativeFontValueType::Capitalization c)
+{
+ font.setCapitalization((QFont::Capitalization)c);
+}
+
+qreal QDeclarativeFontValueType::letterSpacing() const
+{
+ return font.letterSpacing();
+}
+
+void QDeclarativeFontValueType::setLetterSpacing(qreal size)
+{
+ font.setLetterSpacing(QFont::PercentageSpacing, size);
+}
+
+qreal QDeclarativeFontValueType::wordSpacing() const
+{
+ return font.wordSpacing();
+}
+
+void QDeclarativeFontValueType::setWordSpacing(qreal size)
+{
+ font.setWordSpacing(size);
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlvaluetype_p.h b/src/declarative/qml/qdeclarativevaluetype_p.h
index 0a152e8..cb153be 100644
--- a/src/declarative/qml/qmlvaluetype_p.h
+++ b/src/declarative/qml/qdeclarativevaluetype_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLVALUETYPE_P_H
-#define QMLVALUETYPE_P_H
+#ifndef QDECLARATIVEVALUETYPE_P_H
+#define QDECLARATIVEVALUETYPE_P_H
//
// W A R N I N G
@@ -53,48 +53,50 @@
// We mean it.
//
-#include "qmlmetaproperty.h"
+#include "qdeclarativeproperty.h"
+#include "qdeclarativeproperty_p.h"
#include <QtCore/qobject.h>
#include <QtCore/qrect.h>
+#include <QtCore/qeasingcurve.h>
#include <QtCore/qvariant.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qfont.h>
QT_BEGIN_NAMESPACE
-class Q_DECLARATIVE_EXPORT QmlValueType : public QObject
+class Q_DECLARATIVE_EXPORT QDeclarativeValueType : public QObject
{
Q_OBJECT
public:
- QmlValueType(QObject *parent = 0);
+ QDeclarativeValueType(QObject *parent = 0);
virtual void read(QObject *, int) = 0;
- virtual void write(QObject *, int, QmlMetaProperty::WriteFlags flags) = 0;
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags flags) = 0;
virtual QVariant value() = 0;
virtual void setValue(QVariant) = 0;
};
-class Q_DECLARATIVE_EXPORT QmlValueTypeFactory
+class Q_DECLARATIVE_EXPORT QDeclarativeValueTypeFactory
{
public:
- QmlValueTypeFactory();
- ~QmlValueTypeFactory();
- static QmlValueType *valueType(int);
+ QDeclarativeValueTypeFactory();
+ ~QDeclarativeValueTypeFactory();
+ static QDeclarativeValueType *valueType(int);
- QmlValueType *valueTypes[QVariant::UserType - 1];
- QmlValueType *operator[](int idx) const { return valueTypes[idx]; }
+ QDeclarativeValueType *valueTypes[QVariant::UserType - 1];
+ QDeclarativeValueType *operator[](int idx) const { return valueTypes[idx]; }
};
-class Q_AUTOTEST_EXPORT QmlPointFValueType : public QmlValueType
+class Q_AUTOTEST_EXPORT QDeclarativePointFValueType : public QDeclarativeValueType
{
Q_PROPERTY(qreal x READ x WRITE setX)
Q_PROPERTY(qreal y READ y WRITE setY)
Q_OBJECT
public:
- QmlPointFValueType(QObject *parent = 0);
+ QDeclarativePointFValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -107,16 +109,16 @@ private:
QPointF point;
};
-class Q_AUTOTEST_EXPORT QmlPointValueType : public QmlValueType
+class Q_AUTOTEST_EXPORT QDeclarativePointValueType : public QDeclarativeValueType
{
Q_PROPERTY(int x READ x WRITE setX)
Q_PROPERTY(int y READ y WRITE setY)
Q_OBJECT
public:
- QmlPointValueType(QObject *parent = 0);
+ QDeclarativePointValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -129,16 +131,16 @@ private:
QPoint point;
};
-class Q_AUTOTEST_EXPORT QmlSizeFValueType : public QmlValueType
+class Q_AUTOTEST_EXPORT QDeclarativeSizeFValueType : public QDeclarativeValueType
{
Q_PROPERTY(qreal width READ width WRITE setWidth)
Q_PROPERTY(qreal height READ height WRITE setHeight)
Q_OBJECT
public:
- QmlSizeFValueType(QObject *parent = 0);
+ QDeclarativeSizeFValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -151,16 +153,16 @@ private:
QSizeF size;
};
-class Q_AUTOTEST_EXPORT QmlSizeValueType : public QmlValueType
+class Q_AUTOTEST_EXPORT QDeclarativeSizeValueType : public QDeclarativeValueType
{
Q_PROPERTY(int width READ width WRITE setWidth)
Q_PROPERTY(int height READ height WRITE setHeight)
Q_OBJECT
public:
- QmlSizeValueType(QObject *parent = 0);
+ QDeclarativeSizeValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -173,7 +175,7 @@ private:
QSize size;
};
-class Q_AUTOTEST_EXPORT QmlRectFValueType : public QmlValueType
+class Q_AUTOTEST_EXPORT QDeclarativeRectFValueType : public QDeclarativeValueType
{
Q_PROPERTY(qreal x READ x WRITE setX)
Q_PROPERTY(qreal y READ y WRITE setY)
@@ -181,10 +183,10 @@ class Q_AUTOTEST_EXPORT QmlRectFValueType : public QmlValueType
Q_PROPERTY(qreal height READ height WRITE setHeight)
Q_OBJECT
public:
- QmlRectFValueType(QObject *parent = 0);
+ QDeclarativeRectFValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -202,7 +204,7 @@ private:
QRectF rect;
};
-class Q_AUTOTEST_EXPORT QmlRectValueType : public QmlValueType
+class Q_AUTOTEST_EXPORT QDeclarativeRectValueType : public QDeclarativeValueType
{
Q_PROPERTY(int x READ x WRITE setX)
Q_PROPERTY(int y READ y WRITE setY)
@@ -210,10 +212,10 @@ class Q_AUTOTEST_EXPORT QmlRectValueType : public QmlValueType
Q_PROPERTY(int height READ height WRITE setHeight)
Q_OBJECT
public:
- QmlRectValueType(QObject *parent = 0);
+ QDeclarativeRectValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -231,17 +233,17 @@ private:
QRect rect;
};
-class Q_AUTOTEST_EXPORT QmlVector3DValueType : public QmlValueType
+class Q_AUTOTEST_EXPORT QDeclarativeVector3DValueType : public QDeclarativeValueType
{
Q_PROPERTY(qreal x READ x WRITE setX)
Q_PROPERTY(qreal y READ y WRITE setY)
Q_PROPERTY(qreal z READ z WRITE setZ)
Q_OBJECT
public:
- QmlVector3DValueType(QObject *parent = 0);
+ QDeclarativeVector3DValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -256,7 +258,63 @@ private:
QVector3D vector;
};
-class Q_AUTOTEST_EXPORT QmlFontValueType : public QmlValueType
+class Q_AUTOTEST_EXPORT QDeclarativeEasingValueType : public QDeclarativeValueType
+{
+ Q_OBJECT
+ Q_ENUMS(Type)
+
+ Q_PROPERTY(QDeclarativeEasingValueType::Type type READ type WRITE setType)
+ Q_PROPERTY(qreal amplitude READ amplitude WRITE setAmplitude)
+ Q_PROPERTY(qreal overshoot READ overshoot WRITE setOvershoot)
+ Q_PROPERTY(qreal period READ period WRITE setPeriod)
+public:
+ enum Type {
+ Linear = QEasingCurve::Linear,
+ InQuad = QEasingCurve::InQuad, OutQuad = QEasingCurve::OutQuad,
+ InOutQuad = QEasingCurve::InOutQuad, OutInQuad = QEasingCurve::OutInQuad,
+ InCubic = QEasingCurve::InCubic, OutCubic = QEasingCurve::OutCubic,
+ InOutCubic = QEasingCurve::InOutCubic, OutInCubic = QEasingCurve::OutInCubic,
+ InQuart = QEasingCurve::InQuart, OutQuart = QEasingCurve::OutQuart,
+ InOutQuart = QEasingCurve::InOutQuart, OutInQuart = QEasingCurve::OutInQuart,
+ InQuint = QEasingCurve::InQuint, OutQuint = QEasingCurve::OutQuint,
+ InOutQuint = QEasingCurve::InOutQuint, OutInQuint = QEasingCurve::OutInQuint,
+ InSine = QEasingCurve::InSine, OutSine = QEasingCurve::OutSine,
+ InOutSine = QEasingCurve::InOutSine, OutInSine = QEasingCurve::OutInSine,
+ InExpo = QEasingCurve::InExpo, OutExpo = QEasingCurve::OutExpo,
+ InOutExpo = QEasingCurve::InOutExpo, OutInExpo = QEasingCurve::OutInExpo,
+ InCirc = QEasingCurve::InCirc, OutCirc = QEasingCurve::OutCirc,
+ InOutCirc = QEasingCurve::InOutCirc, OutInCirc = QEasingCurve::OutInCirc,
+ InElastic = QEasingCurve::InElastic, OutElastic = QEasingCurve::OutElastic,
+ InOutElastic = QEasingCurve::InOutElastic, OutInElastic = QEasingCurve::OutInElastic,
+ InBack = QEasingCurve::InBack, OutBack = QEasingCurve::OutBack,
+ InOutBack = QEasingCurve::InOutBack, OutInBack = QEasingCurve::OutInBack,
+ InBounce = QEasingCurve::InBounce, OutBounce = QEasingCurve::OutBounce,
+ InOutBounce = QEasingCurve::InOutBounce, OutInBounce = QEasingCurve::OutInBounce,
+ InCurve = QEasingCurve::InCurve, OutCurve = QEasingCurve::OutCurve,
+ SineCurve = QEasingCurve::SineCurve, CosineCurve = QEasingCurve::CosineCurve,
+ };
+
+ QDeclarativeEasingValueType(QObject *parent = 0);
+
+ virtual void read(QObject *, int);
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
+ virtual QVariant value();
+ virtual void setValue(QVariant value);
+
+ Type type() const;
+ qreal amplitude() const;
+ qreal overshoot() const;
+ qreal period() const;
+ void setType(Type);
+ void setAmplitude(qreal);
+ void setOvershoot(qreal);
+ void setPeriod(qreal);
+
+private:
+ QEasingCurve easing;
+};
+
+class Q_AUTOTEST_EXPORT QDeclarativeFontValueType : public QDeclarativeValueType
{
Q_OBJECT
Q_ENUMS(FontWeight)
@@ -287,10 +345,10 @@ public:
SmallCaps = QFont::SmallCaps,
Capitalize = QFont::Capitalize };
- QmlFontValueType(QObject *parent = 0);
+ QDeclarativeFontValueType(QObject *parent = 0);
virtual void read(QObject *, int);
- virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
virtual QVariant value();
virtual void setValue(QVariant value);
@@ -337,4 +395,4 @@ private:
QT_END_NAMESPACE
-#endif // QMLVALUETYPE_P_H
+#endif // QDECLARATIVEVALUETYPE_P_H
diff --git a/src/declarative/qml/qmlvaluetypescriptclass.cpp b/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp
index 0a92014..9cb65f8 100644
--- a/src/declarative/qml/qmlvaluetypescriptclass.cpp
+++ b/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp
@@ -39,43 +39,43 @@
**
****************************************************************************/
-#include "qmlvaluetypescriptclass_p.h"
+#include "qdeclarativevaluetypescriptclass_p.h"
-#include "qmlengine_p.h"
-#include "qmlguard_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativeguard_p.h"
QT_BEGIN_NAMESPACE
-struct QmlValueTypeReference : public QScriptDeclarativeClass::Object {
- QmlValueType *type;
- QmlGuard<QObject> object;
+struct QDeclarativeValueTypeReference : public QScriptDeclarativeClass::Object {
+ QDeclarativeValueType *type;
+ QDeclarativeGuard<QObject> object;
int property;
};
-QmlValueTypeScriptClass::QmlValueTypeScriptClass(QmlEngine *bindEngine)
-: QmlScriptClass(QmlEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine)
+QDeclarativeValueTypeScriptClass::QDeclarativeValueTypeScriptClass(QDeclarativeEngine *bindEngine)
+: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine)
{
}
-QmlValueTypeScriptClass::~QmlValueTypeScriptClass()
+QDeclarativeValueTypeScriptClass::~QDeclarativeValueTypeScriptClass()
{
}
-QScriptValue QmlValueTypeScriptClass::newObject(QObject *object, int coreIndex, QmlValueType *type)
+QScriptValue QDeclarativeValueTypeScriptClass::newObject(QObject *object, int coreIndex, QDeclarativeValueType *type)
{
- QmlValueTypeReference *ref = new QmlValueTypeReference;
+ QDeclarativeValueTypeReference *ref = new QDeclarativeValueTypeReference;
ref->type = type;
ref->object = object;
ref->property = coreIndex;
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
return QScriptDeclarativeClass::newObject(scriptEngine, this, ref);
}
QScriptClass::QueryFlags
-QmlValueTypeScriptClass::queryProperty(Object *obj, const Identifier &name,
+QDeclarativeValueTypeScriptClass::queryProperty(Object *obj, const Identifier &name,
QScriptClass::QueryFlags)
{
- QmlValueTypeReference *ref = static_cast<QmlValueTypeReference *>(obj);
+ QDeclarativeValueTypeReference *ref = static_cast<QDeclarativeValueTypeReference *>(obj);
m_lastIndex = -1;
@@ -98,24 +98,24 @@ QmlValueTypeScriptClass::queryProperty(Object *obj, const Identifier &name,
return rv;
}
-QmlValueTypeScriptClass::ScriptValue QmlValueTypeScriptClass::property(Object *obj, const Identifier &)
+QDeclarativeValueTypeScriptClass::ScriptValue QDeclarativeValueTypeScriptClass::property(Object *obj, const Identifier &)
{
- QmlValueTypeReference *ref = static_cast<QmlValueTypeReference *>(obj);
+ QDeclarativeValueTypeReference *ref = static_cast<QDeclarativeValueTypeReference *>(obj);
QMetaProperty p = ref->type->metaObject()->property(m_lastIndex);
ref->type->read(ref->object, ref->property);
QVariant rv = p.read(ref->type);
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
- return Value(scriptEngine, static_cast<QmlEnginePrivate *>(QObjectPrivate::get(engine))->scriptValueFromVariant(rv));
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
+ return Value(scriptEngine, static_cast<QDeclarativeEnginePrivate *>(QObjectPrivate::get(engine))->scriptValueFromVariant(rv));
}
-void QmlValueTypeScriptClass::setProperty(Object *obj, const Identifier &,
+void QDeclarativeValueTypeScriptClass::setProperty(Object *obj, const Identifier &,
const QScriptValue &value)
{
- QmlValueTypeReference *ref = static_cast<QmlValueTypeReference *>(obj);
+ QDeclarativeValueTypeReference *ref = static_cast<QDeclarativeValueTypeReference *>(obj);
- QVariant v = QmlScriptClass::toVariant(engine, value);
+ QVariant v = QDeclarativeScriptClass::toVariant(engine, value);
ref->type->read(ref->object, ref->property);
QMetaProperty p = ref->type->metaObject()->property(m_lastIndex);
@@ -123,9 +123,9 @@ void QmlValueTypeScriptClass::setProperty(Object *obj, const Identifier &,
ref->type->write(ref->object, ref->property, 0);
}
-QVariant QmlValueTypeScriptClass::toVariant(Object *obj, bool *ok)
+QVariant QDeclarativeValueTypeScriptClass::toVariant(Object *obj, bool *ok)
{
- QmlValueTypeReference *ref = static_cast<QmlValueTypeReference *>(obj);
+ QDeclarativeValueTypeReference *ref = static_cast<QDeclarativeValueTypeReference *>(obj);
if (ok) *ok = true;
@@ -137,7 +137,7 @@ QVariant QmlValueTypeScriptClass::toVariant(Object *obj, bool *ok)
}
}
-QVariant QmlValueTypeScriptClass::toVariant(const QScriptValue &value)
+QVariant QDeclarativeValueTypeScriptClass::toVariant(const QScriptValue &value)
{
Q_ASSERT(scriptClass(value) == this);
diff --git a/src/declarative/qml/qmlvaluetypescriptclass_p.h b/src/declarative/qml/qdeclarativevaluetypescriptclass_p.h
index 12aef49..31bd415 100644
--- a/src/declarative/qml/qmlvaluetypescriptclass_p.h
+++ b/src/declarative/qml/qdeclarativevaluetypescriptclass_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLVALUETYPESCRIPTCLASS_P_H
-#define QMLVALUETYPESCRIPTCLASS_P_H
+#ifndef QDECLARATIVEVALUETYPESCRIPTCLASS_P_H
+#define QDECLARATIVEVALUETYPESCRIPTCLASS_P_H
//
// W A R N I N G
@@ -54,19 +54,19 @@
//
-#include <private/qmlscriptclass_p.h>
+#include <private/qdeclarativescriptclass_p.h>
QT_BEGIN_NAMESPACE
-class QmlEngine;
-class QmlValueType;
-class QmlValueTypeScriptClass : public QmlScriptClass
+class QDeclarativeEngine;
+class QDeclarativeValueType;
+class QDeclarativeValueTypeScriptClass : public QDeclarativeScriptClass
{
public:
- QmlValueTypeScriptClass(QmlEngine *);
- ~QmlValueTypeScriptClass();
+ QDeclarativeValueTypeScriptClass(QDeclarativeEngine *);
+ ~QDeclarativeValueTypeScriptClass();
- QScriptValue newObject(QObject *object, int coreIndex, QmlValueType *);
+ QScriptValue newObject(QObject *object, int coreIndex, QDeclarativeValueType *);
virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &,
QScriptClass::QueryFlags flags);
@@ -76,11 +76,11 @@ public:
virtual QVariant toVariant(Object *, bool *ok = 0);
QVariant toVariant(const QScriptValue &);
private:
- QmlEngine *engine;
+ QDeclarativeEngine *engine;
int m_lastIndex;
};
QT_END_NAMESPACE
-#endif // QMLVALUETYPESCRIPTCLASS_P_H
+#endif // QDECLARATIVEVALUETYPESCRIPTCLASS_P_H
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qdeclarativevme.cpp
index 8655809..720b496 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qdeclarativevme.cpp
@@ -39,27 +39,27 @@
**
****************************************************************************/
-#include "qmlvme_p.h"
+#include "qdeclarativevme_p.h"
-#include "qmlcompiler_p.h"
-#include "qmlboundsignal_p.h"
-#include "qmlstringconverters_p.h"
+#include "qdeclarativecompiler_p.h"
+#include "qdeclarativeboundsignal_p.h"
+#include "qdeclarativestringconverters_p.h"
#include "qmetaobjectbuilder_p.h"
-#include "qmldeclarativedata_p.h"
-#include "qml.h"
-#include "qmlcustomparser_p.h"
-#include "qmlengine.h"
-#include "qmlcontext.h"
-#include "qmlcomponent.h"
-#include "qmlbinding.h"
-#include "qmlengine_p.h"
-#include "qmlcomponent_p.h"
-#include "qmlvmemetaobject_p.h"
-#include "qmlbinding_p.h"
-#include "qmlcontext_p.h"
-#include "qmlcompiledbindings_p.h"
-#include "qmlglobal_p.h"
-#include "qmlscriptstring.h"
+#include "qdeclarativedeclarativedata_p.h"
+#include "qdeclarative.h"
+#include "qdeclarativecustomparser_p.h"
+#include "qdeclarativeengine.h"
+#include "qdeclarativecontext.h"
+#include "qdeclarativecomponent.h"
+#include "qdeclarativebinding_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativecomponent_p.h"
+#include "qdeclarativevmemetaobject_p.h"
+#include "qdeclarativebinding_p_p.h"
+#include "qdeclarativecontext_p.h"
+#include "qdeclarativecompiledbindings_p.h"
+#include "qdeclarativeglobal_p.h"
+#include "qdeclarativescriptstring.h"
#include <qfxperf_p_p.h>
@@ -75,13 +75,13 @@
QT_BEGIN_NAMESPACE
-QmlVME::QmlVME()
+QDeclarativeVME::QDeclarativeVME()
{
}
#define VME_EXCEPTION(desc) \
{ \
- QmlError error; \
+ QDeclarativeError error; \
error.setDescription(desc.trimmed()); \
error.setLine(instr.line); \
error.setUrl(comp->url); \
@@ -97,14 +97,14 @@ struct ListInstance
: type(t) {}
int type;
- QmlListProperty<void> qListProperty;
+ QDeclarativeListProperty<void> qListProperty;
};
-QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledData *comp,
+QObject *QDeclarativeVME::run(QDeclarativeContext *ctxt, QDeclarativeCompiledData *comp,
int start, int count,
const QBitField &bindingSkipList)
{
- QmlVMEStack<QObject *> stack;
+ QDeclarativeVMEStack<QObject *> stack;
if (start == -1) start = 0;
if (count == -1) count = comp->bytecode.count();
@@ -112,70 +112,70 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledData *comp,
return run(stack, ctxt, comp, start, count, bindingSkipList);
}
-void QmlVME::runDeferred(QObject *object)
+void QDeclarativeVME::runDeferred(QObject *object)
{
- QmlDeclarativeData *data = QmlDeclarativeData::get(object);
+ QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(object);
if (!data || !data->context || !data->deferredComponent)
return;
- QmlContext *ctxt = data->context;
- QmlCompiledData *comp = data->deferredComponent;
+ QDeclarativeContext *ctxt = data->context;
+ QDeclarativeCompiledData *comp = data->deferredComponent;
int start = data->deferredIdx + 1;
int count = data->deferredComponent->bytecode.at(data->deferredIdx).defer.deferCount;
- QmlVMEStack<QObject *> stack;
+ QDeclarativeVMEStack<QObject *> stack;
stack.push(object);
run(stack, ctxt, comp, start, count, QBitField());
}
-QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
- QmlCompiledData *comp,
+QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, QDeclarativeContext *ctxt,
+ QDeclarativeCompiledData *comp,
int start, int count,
const QBitField &bindingSkipList)
{
Q_ASSERT(comp);
Q_ASSERT(ctxt);
- const QList<QmlCompiledData::TypeReference> &types = comp->types;
+ const QList<QDeclarativeCompiledData::TypeReference> &types = comp->types;
const QList<QString> &primitives = comp->primitives;
const QList<QByteArray> &datas = comp->datas;
- const QList<QmlCompiledData::CustomTypeData> &customTypeData = comp->customTypeData;
+ const QList<QDeclarativeCompiledData::CustomTypeData> &customTypeData = comp->customTypeData;
const QList<int> &intData = comp->intData;
const QList<float> &floatData = comp->floatData;
- const QList<QmlPropertyCache *> &propertyCaches = comp->propertyCaches;
- const QList<QmlParser::Object::ScriptBlock> &scripts = comp->scripts;
+ const QList<QDeclarativePropertyCache *> &propertyCaches = comp->propertyCaches;
+ const QList<QDeclarativeParser::Object::ScriptBlock> &scripts = comp->scripts;
const QList<QUrl> &urls = comp->urls;
- QmlEnginePrivate::SimpleList<QmlAbstractBinding> bindValues;
- QmlEnginePrivate::SimpleList<QmlParserStatus> parserStatus;
+ QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> bindValues;
+ QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> parserStatus;
- QmlVMEStack<ListInstance> qliststack;
+ QDeclarativeVMEStack<ListInstance> qliststack;
vmeErrors.clear();
- QmlEnginePrivate *ep = QmlEnginePrivate::get(ctxt->engine());
- QmlContextPrivate *cp = (QmlContextPrivate *)QObjectPrivate::get(ctxt);
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(ctxt->engine());
+ QDeclarativeContextPrivate *cp = (QDeclarativeContextPrivate *)QObjectPrivate::get(ctxt);
int status = -1; //for dbus
- QmlMetaProperty::WriteFlags flags = QmlMetaProperty::BypassInterceptor;
+ QDeclarativePropertyPrivate::WriteFlags flags = QDeclarativePropertyPrivate::BypassInterceptor;
for (int ii = start; !isError() && ii < (start + count); ++ii) {
- const QmlInstruction &instr = comp->bytecode.at(ii);
+ const QDeclarativeInstruction &instr = comp->bytecode.at(ii);
switch(instr.type) {
- case QmlInstruction::Init:
+ case QDeclarativeInstruction::Init:
{
if (instr.init.bindingsSize)
- bindValues = QmlEnginePrivate::SimpleList<QmlAbstractBinding>(instr.init.bindingsSize);
+ bindValues = QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding>(instr.init.bindingsSize);
if (instr.init.parserStatusSize)
- parserStatus = QmlEnginePrivate::SimpleList<QmlParserStatus>(instr.init.parserStatusSize);
+ parserStatus = QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus>(instr.init.parserStatusSize);
if (instr.init.contextCache != -1)
cp->setIdPropertyData(comp->contextCaches.at(instr.init.contextCache));
if (instr.init.compiledBinding != -1)
- cp->optimizedBindings = new QmlCompiledBindings(datas.at(instr.init.compiledBinding).constData(), ctxt);
+ cp->optimizedBindings = new QDeclarativeCompiledBindings(datas.at(instr.init.compiledBinding).constData(), ctxt);
}
break;
- case QmlInstruction::CreateObject:
+ case QDeclarativeInstruction::CreateObject:
{
QBitField bindings;
if (instr.create.bindingBits != -1) {
@@ -192,17 +192,17 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
if(types.at(instr.create.type).component)
vmeErrors << types.at(instr.create.type).component->errors();
- VME_EXCEPTION(QCoreApplication::translate("QmlVME","Unable to create object of type %1").arg(QString::fromLatin1(types.at(instr.create.type).className)));
+ VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Unable to create object of type %1").arg(QString::fromLatin1(types.at(instr.create.type).className)));
}
- QmlDeclarativeData *ddata = QmlDeclarativeData::get(o);
+ QDeclarativeDeclarativeData *ddata = QDeclarativeDeclarativeData::get(o);
Q_ASSERT(ddata);
ddata->outerContext = ctxt;
ddata->lineNumber = instr.line;
ddata->columnNumber = instr.create.column;
if (instr.create.data != -1) {
- QmlCustomParser *customParser =
+ QDeclarativeCustomParser *customParser =
types.at(instr.create.type).type->customParser();
customParser->setCustomData(o, datas.at(instr.create.data));
}
@@ -217,7 +217,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
// TODO: parent might be a layout
}
} else {
- QmlGraphics_setParent_noEvent(o, parent);
+ QDeclarativeGraphics_setParent_noEvent(o, parent);
// o->setParent(parent);
}
}
@@ -225,7 +225,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::SetId:
+ case QDeclarativeInstruction::SetId:
{
QObject *target = stack.top();
cp->setIdProperty(instr.setId.index, target);
@@ -233,19 +233,19 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
break;
- case QmlInstruction::SetDefault:
+ case QDeclarativeInstruction::SetDefault:
{
QObject *target = stack.top();
ctxt->addDefaultObject(target);
}
break;
- case QmlInstruction::CreateComponent:
+ case QDeclarativeInstruction::CreateComponent:
{
- QObject *qcomp = new QmlComponent(ctxt->engine(), comp, ii + 1, instr.createComponent.count, stack.isEmpty() ? 0 : stack.top());
+ QObject *qcomp = new QDeclarativeComponent(ctxt->engine(), comp, ii + 1, instr.createComponent.count, stack.isEmpty() ? 0 : stack.top());
- QmlEngine::setContextForObject(qcomp, ctxt);
- QmlDeclarativeData *ddata = QmlDeclarativeData::get(qcomp);
+ QDeclarativeEngine::setContextForObject(qcomp, ctxt);
+ QDeclarativeDeclarativeData *ddata = QDeclarativeDeclarativeData::get(qcomp);
Q_ASSERT(ddata);
ddata->outerContext = ctxt;
ddata->lineNumber = instr.line;
@@ -256,7 +256,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreMetaObject:
+ case QDeclarativeInstruction::StoreMetaObject:
{
QObject *target = stack.top();
@@ -264,30 +264,30 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
const QByteArray &metadata = datas.at(instr.storeMeta.data);
QMetaObjectBuilder::fromRelocatableData(&mo, 0, metadata);
- const QmlVMEMetaData *data =
- (const QmlVMEMetaData *)datas.at(instr.storeMeta.aliasData).constData();
+ const QDeclarativeVMEMetaData *data =
+ (const QDeclarativeVMEMetaData *)datas.at(instr.storeMeta.aliasData).constData();
- (void)new QmlVMEMetaObject(target, &mo, data, comp);
+ (void)new QDeclarativeVMEMetaObject(target, &mo, data, comp);
- QmlDeclarativeData *ddata = QmlDeclarativeData::get(target, true);
+ QDeclarativeDeclarativeData *ddata = QDeclarativeDeclarativeData::get(target, true);
if (ddata->propertyCache) ddata->propertyCache->release();
ddata->propertyCache = propertyCaches.at(instr.storeMeta.propertyCache);
ddata->propertyCache->addref();
}
break;
- case QmlInstruction::StoreVariant:
+ case QDeclarativeInstruction::StoreVariant:
{
QObject *target = stack.top();
// XXX - can be more efficient
- QVariant v = QmlStringConverters::variantFromString(primitives.at(instr.storeString.value));
+ QVariant v = QDeclarativeStringConverters::variantFromString(primitives.at(instr.storeString.value));
void *a[] = { &v, 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
instr.storeString.propertyIndex, a);
}
break;
- case QmlInstruction::StoreString:
+ case QDeclarativeInstruction::StoreString:
{
QObject *target = stack.top();
void *a[] = { (void *)&primitives.at(instr.storeString.value), 0, &status, &flags };
@@ -296,7 +296,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreUrl:
+ case QDeclarativeInstruction::StoreUrl:
{
QObject *target = stack.top();
void *a[] = { (void *)&urls.at(instr.storeUrl.value), 0, &status, &flags };
@@ -305,7 +305,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreFloat:
+ case QDeclarativeInstruction::StoreFloat:
{
QObject *target = stack.top();
float f = instr.storeFloat.value;
@@ -315,7 +315,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreDouble:
+ case QDeclarativeInstruction::StoreDouble:
{
QObject *target = stack.top();
double d = instr.storeDouble.value;
@@ -325,7 +325,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreBool:
+ case QDeclarativeInstruction::StoreBool:
{
QObject *target = stack.top();
void *a[] = { (void *)&instr.storeBool.value, 0, &status, &flags };
@@ -334,7 +334,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreInteger:
+ case QDeclarativeInstruction::StoreInteger:
{
QObject *target = stack.top();
void *a[] = { (void *)&instr.storeInteger.value, 0, &status, &flags };
@@ -343,7 +343,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreColor:
+ case QDeclarativeInstruction::StoreColor:
{
QObject *target = stack.top();
QColor c = QColor::fromRgba(instr.storeColor.value);
@@ -353,7 +353,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreDate:
+ case QDeclarativeInstruction::StoreDate:
{
QObject *target = stack.top();
QDate d = QDate::fromJulianDay(instr.storeDate.value);
@@ -363,7 +363,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreTime:
+ case QDeclarativeInstruction::StoreTime:
{
QObject *target = stack.top();
QTime t;
@@ -377,7 +377,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreDateTime:
+ case QDeclarativeInstruction::StoreDateTime:
{
QObject *target = stack.top();
QTime t;
@@ -392,7 +392,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StorePoint:
+ case QDeclarativeInstruction::StorePoint:
{
QObject *target = stack.top();
QPoint p = QPointF(floatData.at(instr.storeRealPair.valueIndex),
@@ -403,7 +403,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StorePointF:
+ case QDeclarativeInstruction::StorePointF:
{
QObject *target = stack.top();
QPointF p(floatData.at(instr.storeRealPair.valueIndex),
@@ -414,7 +414,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreSize:
+ case QDeclarativeInstruction::StoreSize:
{
QObject *target = stack.top();
QSize p = QSizeF(floatData.at(instr.storeRealPair.valueIndex),
@@ -425,7 +425,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreSizeF:
+ case QDeclarativeInstruction::StoreSizeF:
{
QObject *target = stack.top();
QSizeF s(floatData.at(instr.storeRealPair.valueIndex),
@@ -436,7 +436,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreRect:
+ case QDeclarativeInstruction::StoreRect:
{
QObject *target = stack.top();
QRect r = QRectF(floatData.at(instr.storeRect.valueIndex),
@@ -449,7 +449,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreRectF:
+ case QDeclarativeInstruction::StoreRectF:
{
QObject *target = stack.top();
QRectF r(floatData.at(instr.storeRect.valueIndex),
@@ -462,7 +462,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreVector3D:
+ case QDeclarativeInstruction::StoreVector3D:
{
QObject *target = stack.top();
QVector3D p(floatData.at(instr.storeVector3D.valueIndex),
@@ -474,7 +474,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreObject:
+ case QDeclarativeInstruction::StoreObject:
{
QObject *assignObj = stack.pop();
QObject *target = stack.top();
@@ -486,19 +486,19 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
break;
- case QmlInstruction::AssignCustomType:
+ case QDeclarativeInstruction::AssignCustomType:
{
QObject *target = stack.top();
- QmlCompiledData::CustomTypeData data = customTypeData.at(instr.assignCustomType.valueIndex);
+ QDeclarativeCompiledData::CustomTypeData data = customTypeData.at(instr.assignCustomType.valueIndex);
const QString &primitive = primitives.at(data.index);
- QmlMetaType::StringConverter converter =
- QmlMetaType::customStringConverter(data.type);
+ QDeclarativeMetaType::StringConverter converter =
+ QDeclarativeMetaType::customStringConverter(data.type);
QVariant v = (*converter)(primitive);
QMetaProperty prop =
target->metaObject()->property(instr.assignCustomType.propertyIndex);
if (v.isNull() || ((int)prop.type() != data.type && prop.userType() != data.type))
- VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot assign value %1 to property %2").arg(primitive).arg(QString::fromUtf8(prop.name())));
+ VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign value %1 to property %2").arg(primitive).arg(QString::fromUtf8(prop.name())));
void *a[] = { (void *)v.data(), 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
@@ -506,7 +506,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::AssignSignalObject:
+ case QDeclarativeInstruction::AssignSignalObject:
{
// XXX optimize
@@ -515,53 +515,53 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
int sigIdx = instr.assignSignalObject.signal;
const QByteArray &pr = datas.at(sigIdx);
- QmlMetaProperty prop(target, QString::fromUtf8(pr));
- if (prop.type() & QmlMetaProperty::SignalProperty) {
+ QDeclarativeProperty prop(target, QString::fromUtf8(pr));
+ if (prop.type() & QDeclarativeProperty::SignalProperty) {
- QMetaMethod method = QmlMetaType::defaultMethod(assign);
+ QMetaMethod method = QDeclarativeMetaType::defaultMethod(assign);
if (method.signature() == 0)
- VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className())));
+ VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className())));
if (!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature()))
- VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot connect mismatched signal/slot %1 %vs. %2").arg(QString::fromLatin1(method.signature())).arg(QString::fromLatin1(prop.method().signature())));
+ VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot connect mismatched signal/slot %1 %vs. %2").arg(QString::fromLatin1(method.signature())).arg(QString::fromLatin1(prop.method().signature())));
- QMetaObject::connect(target, prop.coreIndex(), assign, method.methodIndex());
+ QMetaObject::connect(target, prop.index(), assign, method.methodIndex());
} else {
- VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot assign an object to signal property %1").arg(QString::fromUtf8(pr)));
+ VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign an object to signal property %1").arg(QString::fromUtf8(pr)));
}
}
break;
- case QmlInstruction::StoreSignal:
+ case QDeclarativeInstruction::StoreSignal:
{
QObject *target = stack.top();
// XXX scope
QMetaMethod signal =
target->metaObject()->method(instr.storeSignal.signalIndex);
- QmlBoundSignal *bs = new QmlBoundSignal(target, signal, target);
- QmlExpression *expr =
- new QmlExpression(ctxt, primitives.at(instr.storeSignal.value), target);
+ QDeclarativeBoundSignal *bs = new QDeclarativeBoundSignal(target, signal, target);
+ QDeclarativeExpression *expr =
+ new QDeclarativeExpression(ctxt, primitives.at(instr.storeSignal.value), target);
expr->setSourceLocation(comp->name, instr.line);
bs->setExpression(expr);
}
break;
- case QmlInstruction::StoreScript:
+ case QDeclarativeInstruction::StoreScript:
{
QObject *target = stack.top();
cp->addScript(scripts.at(instr.storeScript.value), target);
}
break;
- case QmlInstruction::StoreScriptString:
+ case QDeclarativeInstruction::StoreScriptString:
{
QObject *target = stack.top();
QObject *scope = stack.at(stack.count() - 1 - instr.storeScriptString.scope);
- QmlScriptString ss;
+ QDeclarativeScriptString ss;
ss.setContext(ctxt);
ss.setScopeObject(scope);
ss.setScript(primitives.at(instr.storeScriptString.value));
@@ -572,10 +572,10 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::BeginObject:
+ case QDeclarativeInstruction::BeginObject:
{
QObject *target = stack.top();
- QmlParserStatus *status = reinterpret_cast<QmlParserStatus *>(reinterpret_cast<char *>(target) + instr.begin.castValue);
+ QDeclarativeParserStatus *status = reinterpret_cast<QDeclarativeParserStatus *>(reinterpret_cast<char *>(target) + instr.begin.castValue);
parserStatus.append(status);
status->d = &parserStatus.values[parserStatus.count - 1];
@@ -583,22 +583,22 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreBinding:
+ case QDeclarativeInstruction::StoreBinding:
{
QObject *target =
stack.at(stack.count() - 1 - instr.assignBinding.owner);
QObject *context =
stack.at(stack.count() - 1 - instr.assignBinding.context);
- QmlMetaProperty mp =
- QmlMetaPropertyPrivate::restore(datas.at(instr.assignBinding.property), target, ctxt);
+ QDeclarativeProperty mp =
+ QDeclarativePropertyPrivate::restore(datas.at(instr.assignBinding.property), target, ctxt);
- int coreIndex = mp.coreIndex();
+ int coreIndex = mp.index();
if (stack.count() == 1 && bindingSkipList.testBit(coreIndex))
break;
- QmlBinding *bind = new QmlBinding((void *)datas.at(instr.assignBinding.value).constData(), comp, context, ctxt, comp->name, instr.line, 0);
+ QDeclarativeBinding *bind = new QDeclarativeBinding((void *)datas.at(instr.assignBinding.value).constData(), comp, context, ctxt, comp->name, instr.line, 0);
bindValues.append(bind);
bind->m_mePtr = &bindValues.values[bindValues.count - 1];
bind->setTarget(mp);
@@ -606,7 +606,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreCompiledBinding:
+ case QDeclarativeInstruction::StoreCompiledBinding:
{
QObject *target =
stack.at(stack.count() - 1 - instr.assignBinding.owner);
@@ -617,7 +617,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
if (stack.count() == 1 && bindingSkipList.testBit(property & 0xFFFF))
break;
- QmlAbstractBinding *binding =
+ QDeclarativeAbstractBinding *binding =
cp->optimizedBindings->configBinding(instr.assignBinding.value, target, scope, property);
bindValues.append(binding);
binding->m_mePtr = &bindValues.values[bindValues.count - 1];
@@ -625,43 +625,43 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreValueSource:
+ case QDeclarativeInstruction::StoreValueSource:
{
QObject *obj = stack.pop();
- QmlPropertyValueSource *vs = reinterpret_cast<QmlPropertyValueSource *>(reinterpret_cast<char *>(obj) + instr.assignValueSource.castValue);
+ QDeclarativePropertyValueSource *vs = reinterpret_cast<QDeclarativePropertyValueSource *>(reinterpret_cast<char *>(obj) + instr.assignValueSource.castValue);
QObject *target = stack.at(stack.count() - 1 - instr.assignValueSource.owner);
- QmlMetaProperty prop =
- QmlMetaPropertyPrivate::restore(datas.at(instr.assignValueSource.property), target, ctxt);
+ QDeclarativeProperty prop =
+ QDeclarativePropertyPrivate::restore(datas.at(instr.assignValueSource.property), target, ctxt);
obj->setParent(target);
vs->setTarget(prop);
}
break;
- case QmlInstruction::StoreValueInterceptor:
+ case QDeclarativeInstruction::StoreValueInterceptor:
{
QObject *obj = stack.pop();
- QmlPropertyValueInterceptor *vi = reinterpret_cast<QmlPropertyValueInterceptor *>(reinterpret_cast<char *>(obj) + instr.assignValueInterceptor.castValue);
+ QDeclarativePropertyValueInterceptor *vi = reinterpret_cast<QDeclarativePropertyValueInterceptor *>(reinterpret_cast<char *>(obj) + instr.assignValueInterceptor.castValue);
QObject *target = stack.at(stack.count() - 1 - instr.assignValueInterceptor.owner);
- QmlMetaProperty prop =
- QmlMetaPropertyPrivate::restore(datas.at(instr.assignValueInterceptor.property), target, ctxt);
+ QDeclarativeProperty prop =
+ QDeclarativePropertyPrivate::restore(datas.at(instr.assignValueInterceptor.property), target, ctxt);
obj->setParent(target);
vi->setTarget(prop);
- QmlVMEMetaObject *mo = static_cast<QmlVMEMetaObject *>((QMetaObject*)target->metaObject());
- mo->registerInterceptor(prop.coreIndex(), prop.valueTypeCoreIndex(), vi);
+ QDeclarativeVMEMetaObject *mo = static_cast<QDeclarativeVMEMetaObject *>((QMetaObject*)target->metaObject());
+ mo->registerInterceptor(prop.index(), QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), vi);
}
break;
- case QmlInstruction::StoreObjectQList:
+ case QDeclarativeInstruction::StoreObjectQList:
{
QObject *assign = stack.pop();
const ListInstance &list = qliststack.top();
- list.qListProperty.append((QmlListProperty<void>*)&list.qListProperty, assign);
+ list.qListProperty.append((QDeclarativeListProperty<void>*)&list.qListProperty, assign);
}
break;
- case QmlInstruction::AssignObjectList:
+ case QDeclarativeInstruction::AssignObjectList:
{
// This is only used for assigning interfaces
QObject *assign = stack.pop();
@@ -671,18 +671,18 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
void *ptr = 0;
- const char *iid = QmlMetaType::interfaceIId(type);
+ const char *iid = QDeclarativeMetaType::interfaceIId(type);
if (iid)
ptr = assign->qt_metacast(iid);
if (!ptr)
- VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot assign object to list"));
+ VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object to list"));
- list.qListProperty.append((QmlListProperty<void>*)&list.qListProperty, ptr);
+ list.qListProperty.append((QDeclarativeListProperty<void>*)&list.qListProperty, ptr);
}
break;
- case QmlInstruction::StoreVariantObject:
+ case QDeclarativeInstruction::StoreVariantObject:
{
QObject *assign = stack.pop();
QObject *target = stack.top();
@@ -694,7 +694,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::StoreInterface:
+ case QDeclarativeInstruction::StoreInterface:
{
QObject *assign = stack.pop();
QObject *target = stack.top();
@@ -702,7 +702,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
int coreIdx = instr.storeObject.propertyIndex;
QMetaProperty prop = target->metaObject()->property(coreIdx);
int t = prop.userType();
- const char *iid = QmlMetaType::interfaceIId(t);
+ const char *iid = QDeclarativeMetaType::interfaceIId(t);
bool ok = false;
if (iid) {
void *ptr = assign->qt_metacast(iid);
@@ -716,24 +716,24 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
if (!ok)
- VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot assign object to interface property"));
+ VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object to interface property"));
}
break;
- case QmlInstruction::FetchAttached:
+ case QDeclarativeInstruction::FetchAttached:
{
QObject *target = stack.top();
QObject *qmlObject = qmlAttachedPropertiesObjectById(instr.fetchAttached.id, target);
if (!qmlObject)
- VME_EXCEPTION(QCoreApplication::translate("QmlVME","Unable to create attached object"));
+ VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Unable to create attached object"));
stack.push(qmlObject);
}
break;
- case QmlInstruction::FetchQList:
+ case QDeclarativeInstruction::FetchQList:
{
QObject *target = stack.top();
@@ -746,7 +746,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::FetchObject:
+ case QDeclarativeInstruction::FetchObject:
{
QObject *target = stack.top();
@@ -759,24 +759,24 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
instr.fetch.property, a);
if (!obj)
- VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot set properties on %1 as it is null").arg(QString::fromUtf8(target->metaObject()->property(instr.fetch.property).name())));
+ VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot set properties on %1 as it is null").arg(QString::fromUtf8(target->metaObject()->property(instr.fetch.property).name())));
stack.push(obj);
}
break;
- case QmlInstruction::PopQList:
+ case QDeclarativeInstruction::PopQList:
{
qliststack.pop();
}
break;
- case QmlInstruction::Defer:
+ case QDeclarativeInstruction::Defer:
{
if (instr.defer.deferCount) {
QObject *target = stack.top();
- QmlDeclarativeData *data =
- QmlDeclarativeData::get(target, true);
+ QDeclarativeDeclarativeData *data =
+ QDeclarativeDeclarativeData::get(target, true);
comp->addref();
data->deferredComponent = comp;
data->deferredIdx = ii;
@@ -785,33 +785,34 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
break;
- case QmlInstruction::PopFetchedObject:
+ case QDeclarativeInstruction::PopFetchedObject:
{
stack.pop();
}
break;
- case QmlInstruction::FetchValueType:
+ case QDeclarativeInstruction::FetchValueType:
{
QObject *target = stack.top();
- QmlValueType *valueHandler =
+ QDeclarativeValueType *valueHandler =
ep->valueTypes[instr.fetchValue.type];
valueHandler->read(target, instr.fetchValue.property);
stack.push(valueHandler);
}
break;
- case QmlInstruction::PopValueType:
+ case QDeclarativeInstruction::PopValueType:
{
- QmlValueType *valueHandler =
- static_cast<QmlValueType *>(stack.pop());
+ QDeclarativeValueType *valueHandler =
+ static_cast<QDeclarativeValueType *>(stack.pop());
QObject *target = stack.top();
- valueHandler->write(target, instr.fetchValue.property, QmlMetaProperty::BypassInterceptor);
+ valueHandler->write(target, instr.fetchValue.property,
+ QDeclarativePropertyPrivate::BypassInterceptor);
}
break;
default:
- qFatal("QmlCompiledData: Internal error - unknown instruction %d", instr.type);
+ qFatal("QDeclarativeCompiledData: Internal error - unknown instruction %d", instr.type);
break;
}
}
@@ -821,8 +822,8 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
delete stack.at(0);
}
- QmlEnginePrivate::clear(bindValues);
- QmlEnginePrivate::clear(parserStatus);
+ QDeclarativeEnginePrivate::clear(bindValues);
+ QDeclarativeEnginePrivate::clear(parserStatus);
return 0;
}
@@ -838,12 +839,12 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
return 0;
}
-bool QmlVME::isError() const
+bool QDeclarativeVME::isError() const
{
return !vmeErrors.isEmpty();
}
-QList<QmlError> QmlVME::errors() const
+QList<QDeclarativeError> QDeclarativeVME::errors() const
{
return vmeErrors;
}
diff --git a/src/declarative/qml/qmlvme_p.h b/src/declarative/qml/qdeclarativevme_p.h
index ae7dd7f..951f6a7 100644
--- a/src/declarative/qml/qmlvme_p.h
+++ b/src/declarative/qml/qdeclarativevme_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLVME_P_H
-#define QMLVME_P_H
+#ifndef QDECLARATIVEVME_P_H
+#define QDECLARATIVEVME_P_H
//
// W A R N I N G
@@ -53,7 +53,7 @@
// We mean it.
//
-#include "qmlerror.h"
+#include "qdeclarativeerror.h"
#include "qbitfield_p.h"
#include <QtCore/QString>
@@ -62,16 +62,16 @@
QT_BEGIN_NAMESPACE
class QObject;
-class QmlInstruction;
-class QmlCompiledData;
-class QmlCompiledData;
-class QmlContext;
+class QDeclarativeInstruction;
+class QDeclarativeCompiledData;
+class QDeclarativeCompiledData;
+class QDeclarativeContext;
template<typename T, int N = 128>
-class QmlVMEStack {
+class QDeclarativeVMEStack {
public:
- QmlVMEStack() : index(-1), maxSize(N), data(fixedData) {}
- ~QmlVMEStack() { if (data != fixedData) qFree(fixedData); }
+ QDeclarativeVMEStack() : index(-1), maxSize(N), data(fixedData) {}
+ ~QDeclarativeVMEStack() { if (data != fixedData) qFree(fixedData); }
bool isEmpty() const { return index == -1; }
const T &top() const { return data[index]; }
@@ -95,25 +95,25 @@ private:
T fixedData[N];
};
-class QmlVME
+class QDeclarativeVME
{
public:
- QmlVME();
+ QDeclarativeVME();
- QObject *run(QmlContext *, QmlCompiledData *,
+ QObject *run(QDeclarativeContext *, QDeclarativeCompiledData *,
int start = -1, int count = -1,
const QBitField & = QBitField());
void runDeferred(QObject *);
bool isError() const;
- QList<QmlError> errors() const;
+ QList<QDeclarativeError> errors() const;
private:
- QObject *run(QmlVMEStack<QObject *> &, QmlContext *, QmlCompiledData *,
+ QObject *run(QDeclarativeVMEStack<QObject *> &, QDeclarativeContext *, QDeclarativeCompiledData *,
int start, int count, const QBitField &);
- QList<QmlError> vmeErrors;
+ QList<QDeclarativeError> vmeErrors;
};
QT_END_NAMESPACE
-#endif // QMLVME_P_H
+#endif // QDECLARATIVEVME_P_H
diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp
index 4886680..d67c834 100644
--- a/src/declarative/qml/qmlvmemetaobject.cpp
+++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp
@@ -39,13 +39,13 @@
**
****************************************************************************/
-#include "qmlvmemetaobject_p.h"
+#include "qdeclarativevmemetaobject_p.h"
-#include "qml.h"
-#include "qmlrefcount_p.h"
-#include "qmlexpression.h"
-#include "qmlexpression_p.h"
-#include "qmlcontext_p.h"
+#include "qdeclarative.h"
+#include "qdeclarativerefcount_p.h"
+#include "qdeclarativeexpression.h"
+#include "qdeclarativeexpression_p.h"
+#include "qdeclarativecontext_p.h"
#include <QColor>
#include <QDate>
@@ -54,10 +54,10 @@
QT_BEGIN_NAMESPACE
-QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj,
+QDeclarativeVMEMetaObject::QDeclarativeVMEMetaObject(QObject *obj,
const QMetaObject *other,
- const QmlVMEMetaData *meta,
- QmlCompiledData *cdata)
+ const QDeclarativeVMEMetaData *meta,
+ QDeclarativeCompiledData *cdata)
: object(obj), compiledData(cdata), ctxt(qmlContext(obj)), metaData(meta), methods(0),
parent(0)
{
@@ -77,13 +77,13 @@ QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj,
data = new QVariant[metaData->propertyCount];
aConnected.resize(metaData->aliasCount);
- int list_type = qMetaTypeId<QmlListProperty<QObject> >();
+ int list_type = qMetaTypeId<QDeclarativeListProperty<QObject> >();
// ### Optimize
for (int ii = 0; ii < metaData->propertyCount; ++ii) {
int t = (metaData->propertyData() + ii)->propertyType;
if (t == list_type) {
listProperties.append(new List(methodOffset + ii));
- data[ii] = QVariant::fromValue(QmlListProperty<QObject>(obj, listProperties.last(), list_append,
+ data[ii] = QVariant::fromValue(QDeclarativeListProperty<QObject>(obj, listProperties.last(), list_append,
list_count, list_at, list_clear));
} else if (t != -1) {
data[ii] = QVariant((QVariant::Type)t);
@@ -91,7 +91,7 @@ QmlVMEMetaObject::QmlVMEMetaObject(QObject *obj,
}
}
-QmlVMEMetaObject::~QmlVMEMetaObject()
+QDeclarativeVMEMetaObject::~QDeclarativeVMEMetaObject()
{
compiledData->release();
delete parent;
@@ -100,25 +100,25 @@ QmlVMEMetaObject::~QmlVMEMetaObject()
delete [] methods;
}
-int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
+int QDeclarativeVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
{
int id = _id;
if(c == QMetaObject::WriteProperty) {
int flags = *reinterpret_cast<int*>(a[3]);
- if (!(flags & QmlMetaProperty::BypassInterceptor)
+ if (!(flags & QDeclarativePropertyPrivate::BypassInterceptor)
&& !aInterceptors.isEmpty()
&& aInterceptors.testBit(id)) {
- QPair<int, QmlPropertyValueInterceptor*> pair = interceptors.value(id);
+ QPair<int, QDeclarativePropertyValueInterceptor*> pair = interceptors.value(id);
int valueIndex = pair.first;
- QmlPropertyValueInterceptor *vi = pair.second;
+ QDeclarativePropertyValueInterceptor *vi = pair.second;
int type = property(id).userType();
if (type != QVariant::Invalid) {
if (valueIndex != -1) {
- QmlEnginePrivate *ep = ctxt?QmlEnginePrivate::get(ctxt->engine()):0;
- QmlValueType *valueType = 0;
+ QDeclarativeEnginePrivate *ep = ctxt?QDeclarativeEnginePrivate::get(ctxt->engine()):0;
+ QDeclarativeValueType *valueType = 0;
if (ep) valueType = ep->valueTypes[type];
- else valueType = QmlValueTypeFactory::valueType(type);
+ else valueType = QDeclarativeValueTypeFactory::valueType(type);
Q_ASSERT(valueType);
valueType->setValue(QVariant(type, a[0]));
@@ -183,9 +183,9 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
default:
break;
}
- if (t == qMetaTypeId<QmlListProperty<QObject> >()) {
- *reinterpret_cast<QmlListProperty<QObject> *>(a[0]) =
- data[id].value<QmlListProperty<QObject> >();
+ if (t == qMetaTypeId<QDeclarativeListProperty<QObject> >()) {
+ *reinterpret_cast<QDeclarativeListProperty<QObject> *>(a[0]) =
+ data[id].value<QDeclarativeListProperty<QObject> >();
}
} else if (c == QMetaObject::WriteProperty) {
@@ -208,14 +208,14 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
if (id < metaData->aliasCount) {
- QmlVMEMetaData::AliasData *d = metaData->aliasData() + id;
+ QDeclarativeVMEMetaData::AliasData *d = metaData->aliasData() + id;
if (d->flags & QML_ALIAS_FLAG_PTR && c == QMetaObject::ReadProperty)
*reinterpret_cast<void **>(a[0]) = 0;
if (!ctxt) return -1;
- QmlContextPrivate *ctxtPriv =
- (QmlContextPrivate *)QObjectPrivate::get(ctxt);
+ QDeclarativeContextPrivate *ctxtPriv =
+ (QDeclarativeContextPrivate *)QObjectPrivate::get(ctxt);
QObject *target = ctxtPriv->idValues[d->contextIdx].data();
if (!target)
@@ -265,12 +265,12 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
if (!ctxt->engine())
return -1; // We can't run the method
- QmlEnginePrivate *ep = QmlEnginePrivate::get(ctxt->engine());
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(ctxt->engine());
QScriptValue function = method(id);
QScriptValueList args;
- QmlVMEMetaData::MethodData *data = metaData->methodData() + id;
+ QDeclarativeVMEMetaData::MethodData *data = metaData->methodData() + id;
if (data->parameterCount) {
for (int ii = 0; ii < data->parameterCount; ++ii) {
args << ep->scriptValueFromVariant(*(QVariant *)a[ii + 1]);
@@ -292,13 +292,13 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
return object->qt_metacall(c, _id, a);
}
-QScriptValue QmlVMEMetaObject::method(int index)
+QScriptValue QDeclarativeVMEMetaObject::method(int index)
{
if (!methods)
methods = new QScriptValue[metaData->methodCount];
if (!methods[index].isValid()) {
- QmlVMEMetaData::MethodData *data = metaData->methodData() + index;
+ QDeclarativeVMEMetaData::MethodData *data = metaData->methodData() + index;
const QChar *body =
(const QChar *)(((const char*)metaData) + data->bodyOffset);
@@ -309,42 +309,42 @@ QScriptValue QmlVMEMetaObject::method(int index)
// XXX We should evaluate all methods in a single big script block to
// improve the call time between dynamic methods defined on the same
// object
- methods[index] = QmlExpressionPrivate::evalInObjectScope(ctxt, object, code);
+ methods[index] = QDeclarativeExpressionPrivate::evalInObjectScope(ctxt, object, code);
}
return methods[index];
}
-void QmlVMEMetaObject::listChanged(int id)
+void QDeclarativeVMEMetaObject::listChanged(int id)
{
activate(object, methodOffset + id, 0);
}
-void QmlVMEMetaObject::list_append(QmlListProperty<QObject> *prop, QObject *o)
+void QDeclarativeVMEMetaObject::list_append(QDeclarativeListProperty<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)
+int QDeclarativeVMEMetaObject::list_count(QDeclarativeListProperty<QObject> *prop)
{
return static_cast<List *>(prop->data)->count();
}
-QObject *QmlVMEMetaObject::list_at(QmlListProperty<QObject> *prop, int index)
+QObject *QDeclarativeVMEMetaObject::list_at(QDeclarativeListProperty<QObject> *prop, int index)
{
return static_cast<List *>(prop->data)->at(index);
}
-void QmlVMEMetaObject::list_clear(QmlListProperty<QObject> *prop)
+void QDeclarativeVMEMetaObject::list_clear(QDeclarativeListProperty<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)
+void QDeclarativeVMEMetaObject::registerInterceptor(int index, int valueIndex, QDeclarativePropertyValueInterceptor *interceptor)
{
if (aInterceptors.isEmpty())
aInterceptors.resize(propertyCount() + metaData->propertyCount);
@@ -352,11 +352,11 @@ void QmlVMEMetaObject::registerInterceptor(int index, int valueIndex, QmlPropert
interceptors.insert(index, qMakePair(valueIndex, interceptor));
}
-QScriptValue QmlVMEMetaObject::vmeMethod(int index)
+QScriptValue QDeclarativeVMEMetaObject::vmeMethod(int index)
{
if (index < methodOffset) {
Q_ASSERT(parent);
- return static_cast<QmlVMEMetaObject *>(parent)->vmeMethod(index);
+ return static_cast<QDeclarativeVMEMetaObject *>(parent)->vmeMethod(index);
}
int plainSignals = metaData->signalCount + metaData->propertyCount + metaData->aliasCount;
Q_ASSERT(index >= (methodOffset + plainSignals) && index < (methodOffset + plainSignals + metaData->methodCount));
diff --git a/src/declarative/qml/qmlvmemetaobject_p.h b/src/declarative/qml/qdeclarativevmemetaobject_p.h
index 3eb776e..37c0b7a 100644
--- a/src/declarative/qml/qmlvmemetaobject_p.h
+++ b/src/declarative/qml/qdeclarativevmemetaobject_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLVMEMETAOBJECT_P_H
-#define QMLVMEMETAOBJECT_P_H
+#ifndef QDECLARATIVEVMEMETAOBJECT_P_H
+#define QDECLARATIVEVMEMETAOBJECT_P_H
//
// W A R N I N G
@@ -53,7 +53,7 @@
// We mean it.
//
-#include "qml.h"
+#include "qdeclarative.h"
#include <QtCore/QMetaObject>
#include <QtCore/QBitArray>
@@ -61,14 +61,14 @@
#include <private/qobject_p.h>
-#include "qmlguard_p.h"
-#include "qmlcompiler_p.h"
+#include "qdeclarativeguard_p.h"
+#include "qdeclarativecompiler_p.h"
QT_BEGIN_NAMESPACE
#define QML_ALIAS_FLAG_PTR 0x00000001
-struct QmlVMEMetaData
+struct QDeclarativeVMEMetaData
{
short propertyCount;
short aliasCount;
@@ -93,7 +93,7 @@ struct QmlVMEMetaData
};
PropertyData *propertyData() const {
- return (PropertyData *)(((const char *)this) + sizeof(QmlVMEMetaData));
+ return (PropertyData *)(((const char *)this) + sizeof(QDeclarativeVMEMetaData));
}
AliasData *aliasData() const {
@@ -105,32 +105,32 @@ struct QmlVMEMetaData
}
};
-class QmlRefCount;
-class QmlVMEMetaObject : public QAbstractDynamicMetaObject
+class QDeclarativeRefCount;
+class QDeclarativeVMEMetaObject : public QAbstractDynamicMetaObject
{
public:
- QmlVMEMetaObject(QObject *obj, const QMetaObject *other, const QmlVMEMetaData *data,
- QmlCompiledData *compiledData);
- ~QmlVMEMetaObject();
+ QDeclarativeVMEMetaObject(QObject *obj, const QMetaObject *other, const QDeclarativeVMEMetaData *data,
+ QDeclarativeCompiledData *compiledData);
+ ~QDeclarativeVMEMetaObject();
- void registerInterceptor(int index, int valueIndex, QmlPropertyValueInterceptor *interceptor);
+ void registerInterceptor(int index, int valueIndex, QDeclarativePropertyValueInterceptor *interceptor);
QScriptValue vmeMethod(int index);
protected:
virtual int metaCall(QMetaObject::Call _c, int _id, void **_a);
private:
QObject *object;
- QmlCompiledData *compiledData;
- QmlGuard<QmlContext> ctxt;
+ QDeclarativeCompiledData *compiledData;
+ QDeclarativeGuard<QDeclarativeContext> ctxt;
- const QmlVMEMetaData *metaData;
+ const QDeclarativeVMEMetaData *metaData;
int propOffset;
int methodOffset;
QVariant *data;
QBitArray aConnected;
QBitArray aInterceptors;
- QHash<int, QPair<int, QmlPropertyValueInterceptor*> > interceptors;
+ QHash<int, QPair<int, QDeclarativePropertyValueInterceptor*> > interceptors;
QScriptValue *methods;
QScriptValue method(int);
@@ -146,12 +146,12 @@ private:
};
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> *);
+ static void list_append(QDeclarativeListProperty<QObject> *, QObject *);
+ static int list_count(QDeclarativeListProperty<QObject> *);
+ static QObject *list_at(QDeclarativeListProperty<QObject> *, int);
+ static void list_clear(QDeclarativeListProperty<QObject> *);
};
QT_END_NAMESPACE
-#endif // QMLVMEMETAOBJECT_P_H
+#endif // QDECLARATIVEVMEMETAOBJECT_P_H
diff --git a/src/declarative/qml/qmlwatcher.cpp b/src/declarative/qml/qdeclarativewatcher.cpp
index 59503de..2f61195 100644
--- a/src/declarative/qml/qmlwatcher.cpp
+++ b/src/declarative/qml/qdeclarativewatcher.cpp
@@ -39,13 +39,13 @@
**
****************************************************************************/
-#include "qmlwatcher_p.h"
+#include "qdeclarativewatcher_p.h"
-#include "qmlexpression.h"
-#include "qmlcontext.h"
-#include "qml.h"
+#include "qdeclarativeexpression.h"
+#include "qdeclarativecontext.h"
+#include "qdeclarative.h"
-#include <qmldebugservice_p.h>
+#include <qdeclarativedebugservice_p.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qdebug.h>
@@ -53,60 +53,60 @@
QT_BEGIN_NAMESPACE
-class QmlWatchProxy : public QObject
+class QDeclarativeWatchProxy : public QObject
{
Q_OBJECT
public:
- QmlWatchProxy(int id,
+ QDeclarativeWatchProxy(int id,
QObject *object,
int debugId,
const QMetaProperty &prop,
- QmlWatcher *parent = 0);
+ QDeclarativeWatcher *parent = 0);
- QmlWatchProxy(int id,
- QmlExpression *exp,
+ QDeclarativeWatchProxy(int id,
+ QDeclarativeExpression *exp,
int debugId,
- QmlWatcher *parent = 0);
+ QDeclarativeWatcher *parent = 0);
public slots:
void notifyValueChanged();
private:
- friend class QmlWatcher;
+ friend class QDeclarativeWatcher;
int m_id;
- QmlWatcher *m_watch;
+ QDeclarativeWatcher *m_watch;
QObject *m_object;
int m_debugId;
QMetaProperty m_property;
- QmlExpression *m_expr;
+ QDeclarativeExpression *m_expr;
};
-QmlWatchProxy::QmlWatchProxy(int id,
- QmlExpression *exp,
+QDeclarativeWatchProxy::QDeclarativeWatchProxy(int id,
+ QDeclarativeExpression *exp,
int debugId,
- QmlWatcher *parent)
+ QDeclarativeWatcher *parent)
: QObject(parent), m_id(id), m_watch(parent), m_object(0), m_debugId(debugId), m_expr(exp)
{
QObject::connect(m_expr, SIGNAL(valueChanged()), this, SLOT(notifyValueChanged()));
}
-QmlWatchProxy::QmlWatchProxy(int id,
+QDeclarativeWatchProxy::QDeclarativeWatchProxy(int id,
QObject *object,
int debugId,
const QMetaProperty &prop,
- QmlWatcher *parent)
+ QDeclarativeWatcher *parent)
: QObject(parent), m_id(id), m_watch(parent), m_object(object), m_debugId(debugId), m_property(prop), m_expr(0)
{
static int refreshIdx = -1;
if(refreshIdx == -1)
- refreshIdx = QmlWatchProxy::staticMetaObject.indexOfMethod("notifyValueChanged()");
+ refreshIdx = QDeclarativeWatchProxy::staticMetaObject.indexOfMethod("notifyValueChanged()");
if (prop.hasNotifySignal())
QMetaObject::connect(m_object, prop.notifySignalIndex(), this, refreshIdx);
}
-void QmlWatchProxy::notifyValueChanged()
+void QDeclarativeWatchProxy::notifyValueChanged()
{
QVariant v;
if (m_expr)
@@ -118,14 +118,14 @@ void QmlWatchProxy::notifyValueChanged()
}
-QmlWatcher::QmlWatcher(QObject *parent)
+QDeclarativeWatcher::QDeclarativeWatcher(QObject *parent)
: QObject(parent)
{
}
-bool QmlWatcher::addWatch(int id, quint32 debugId)
+bool QDeclarativeWatcher::addWatch(int id, quint32 debugId)
{
- QObject *object = QmlDebugService::objectForId(debugId);
+ QObject *object = QDeclarativeDebugService::objectForId(debugId);
if (object) {
int propCount = object->metaObject()->propertyCount();
for (int ii=0; ii<propCount; ii++)
@@ -135,9 +135,9 @@ bool QmlWatcher::addWatch(int id, quint32 debugId)
return false;
}
-bool QmlWatcher::addWatch(int id, quint32 debugId, const QByteArray &property)
+bool QDeclarativeWatcher::addWatch(int id, quint32 debugId, const QByteArray &property)
{
- QObject *object = QmlDebugService::objectForId(debugId);
+ QObject *object = QDeclarativeDebugService::objectForId(debugId);
if (object) {
int index = object->metaObject()->indexOfProperty(property.constData());
if (index >= 0) {
@@ -148,13 +148,14 @@ bool QmlWatcher::addWatch(int id, quint32 debugId, const QByteArray &property)
return false;
}
-bool QmlWatcher::addWatch(int id, quint32 objectId, const QString &expr)
+bool QDeclarativeWatcher::addWatch(int id, quint32 objectId, const QString &expr)
{
- QObject *object = QmlDebugService::objectForId(objectId);
- QmlContext *context = qmlContext(object);
+ QObject *object = QDeclarativeDebugService::objectForId(objectId);
+ QDeclarativeContext *context = qmlContext(object);
if (context) {
- QmlExpression *exprObj = new QmlExpression(context, expr, object);
- QmlWatchProxy *proxy = new QmlWatchProxy(id, exprObj, objectId, this);
+ QDeclarativeExpression *exprObj = new QDeclarativeExpression(context, expr, object);
+ exprObj->setNotifyOnValueChanged(true);
+ QDeclarativeWatchProxy *proxy = new QDeclarativeWatchProxy(id, exprObj, objectId, this);
exprObj->setParent(proxy);
m_proxies[id].append(proxy);
proxy->notifyValueChanged();
@@ -163,18 +164,18 @@ bool QmlWatcher::addWatch(int id, quint32 objectId, const QString &expr)
return false;
}
-void QmlWatcher::removeWatch(int id)
+void QDeclarativeWatcher::removeWatch(int id)
{
if (!m_proxies.contains(id))
return;
- QList<QPointer<QmlWatchProxy> > proxies = m_proxies.take(id);
+ QList<QPointer<QDeclarativeWatchProxy> > proxies = m_proxies.take(id);
qDeleteAll(proxies);
}
-void QmlWatcher::addPropertyWatch(int id, QObject *object, quint32 debugId, const QMetaProperty &property)
+void QDeclarativeWatcher::addPropertyWatch(int id, QObject *object, quint32 debugId, const QMetaProperty &property)
{
- QmlWatchProxy *proxy = new QmlWatchProxy(id, object, debugId, property, this);
+ QDeclarativeWatchProxy *proxy = new QDeclarativeWatchProxy(id, object, debugId, property, this);
m_proxies[id].append(proxy);
proxy->notifyValueChanged();
@@ -182,4 +183,4 @@ void QmlWatcher::addPropertyWatch(int id, QObject *object, quint32 debugId, cons
QT_END_NAMESPACE
-#include <qmlwatcher.moc>
+#include <qdeclarativewatcher.moc>
diff --git a/src/declarative/qml/qmlwatcher_p.h b/src/declarative/qml/qdeclarativewatcher_p.h
index 57b358d..4e3352f 100644
--- a/src/declarative/qml/qmlwatcher_p.h
+++ b/src/declarative/qml/qdeclarativewatcher_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLWATCHER_P_H
-#define QMLWATCHER_P_H
+#ifndef QDECLARATIVEWATCHER_P_H
+#define QDECLARATIVEWATCHER_P_H
//
// W A R N I N G
@@ -62,16 +62,16 @@
QT_BEGIN_NAMESPACE
-class QmlWatchProxy;
-class QmlExpression;
-class QmlContext;
+class QDeclarativeWatchProxy;
+class QDeclarativeExpression;
+class QDeclarativeContext;
class QMetaProperty;
-class QmlWatcher : public QObject
+class QDeclarativeWatcher : public QObject
{
Q_OBJECT
public:
- QmlWatcher(QObject * = 0);
+ QDeclarativeWatcher(QObject * = 0);
bool addWatch(int id, quint32 objectId);
bool addWatch(int id, quint32 objectId, const QByteArray &property);
@@ -83,12 +83,12 @@ Q_SIGNALS:
void propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value);
private:
- friend class QmlWatchProxy;
+ friend class QDeclarativeWatchProxy;
void addPropertyWatch(int id, QObject *object, quint32 objectId, const QMetaProperty &property);
- QHash<int, QList<QPointer<QmlWatchProxy> > > m_proxies;
+ QHash<int, QList<QPointer<QDeclarativeWatchProxy> > > m_proxies;
};
QT_END_NAMESPACE
-#endif // QMLWATCHER_P_H
+#endif // QDECLARATIVEWATCHER_P_H
diff --git a/src/declarative/qml/qmlworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp
index a2e8c7a..03151e4 100644
--- a/src/declarative/qml/qmlworkerscript.cpp
+++ b/src/declarative/qml/qdeclarativeworkerscript.cpp
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#include "qmlworkerscript_p.h"
+#include "qdeclarativeworkerscript_p.h"
-#include "qmlengine_p.h"
+#include "qdeclarativeengine_p.h"
#include <QtCore/qcoreevent.h>
#include <QtCore/qcoreapplication.h>
@@ -52,8 +52,8 @@
#include <QtScript/qscriptvalueiterator.h>
#include <QtCore/qfile.h>
#include <QtNetwork/qnetworkaccessmanager.h>
-#include <QtDeclarative/qmlinfo.h>
-#include "qmlnetworkaccessmanagerfactory.h"
+#include <QtDeclarative/qdeclarativeinfo.h>
+#include "qdeclarativenetworkaccessmanagerfactory.h"
QT_BEGIN_NAMESPACE
@@ -102,16 +102,16 @@ private:
int m_id;
};
-class QmlWorkerScriptEnginePrivate : public QObject
+class QDeclarativeWorkerScriptEnginePrivate : public QObject
{
public:
- QmlWorkerScriptEnginePrivate(QmlEngine *eng);
+ QDeclarativeWorkerScriptEnginePrivate(QDeclarativeEngine *eng);
- struct ScriptEngine : public QmlScriptEngine
+ struct ScriptEngine : public QDeclarativeScriptEngine
{
- ScriptEngine(QmlWorkerScriptEnginePrivate *parent) : QmlScriptEngine(0), p(parent), accessManager(0) {}
+ ScriptEngine(QDeclarativeWorkerScriptEnginePrivate *parent) : QDeclarativeScriptEngine(0), p(parent), accessManager(0) {}
~ScriptEngine() { delete accessManager; }
- QmlWorkerScriptEnginePrivate *p;
+ QDeclarativeWorkerScriptEnginePrivate *p;
QNetworkAccessManager *accessManager;
virtual QNetworkAccessManager *networkAccessManager() {
@@ -126,11 +126,11 @@ public:
}
};
ScriptEngine *workerEngine;
- static QmlWorkerScriptEnginePrivate *get(QScriptEngine *e) {
+ static QDeclarativeWorkerScriptEnginePrivate *get(QScriptEngine *e) {
return static_cast<ScriptEngine *>(e)->p;
}
- QmlEngine *qmlengine;
+ QDeclarativeEngine *qmlengine;
QMutex m_lock;
QWaitCondition m_wait;
@@ -140,7 +140,7 @@ public:
int id;
bool initialized;
- QmlWorkerScript *owner;
+ QDeclarativeWorkerScript *owner;
QScriptValue object;
QScriptValue callback;
@@ -166,14 +166,14 @@ private:
};
// Currently this will leak as no-one releases it in the worker thread
-class QmlWorkerListModelAgent : public QObject
+class QDeclarativeWorkerListModelAgent : public QObject
{
Q_OBJECT
- Q_PROPERTY(int count READ count);
+ Q_PROPERTY(int count READ count)
public:
- QmlWorkerListModelAgent(QmlWorkerListModel *);
- ~QmlWorkerListModelAgent();
+ QDeclarativeWorkerListModelAgent(QDeclarativeWorkerListModel *);
+ ~QDeclarativeWorkerListModelAgent();
void addref();
void release();
@@ -192,7 +192,7 @@ public:
{
VariantRef() : a(0) {}
VariantRef(const VariantRef &r) : a(r.a) { if (a) a->addref(); }
- VariantRef(QmlWorkerListModelAgent *_a) : a(_a) { if (a) a->addref(); }
+ VariantRef(QDeclarativeWorkerListModelAgent *_a) : a(_a) { if (a) a->addref(); }
~VariantRef() { if (a) a->release(); }
VariantRef &operator=(const VariantRef &o) {
@@ -201,14 +201,14 @@ public:
return *this;
}
- QmlWorkerListModelAgent *a;
+ QDeclarativeWorkerListModelAgent *a;
};
protected:
virtual bool event(QEvent *);
private:
- friend class QmlWorkerScriptEnginePrivate;
- friend class QmlWorkerListModel;
+ friend class QDeclarativeWorkerScriptEnginePrivate;
+ friend class QDeclarativeWorkerListModel;
QScriptEngine *m_engine;
struct Change {
@@ -237,23 +237,23 @@ private:
};
QAtomicInt m_ref;
- QmlWorkerListModel *m_model;
+ QDeclarativeWorkerListModel *m_model;
};
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QmlWorkerListModelAgent::VariantRef);
+Q_DECLARE_METATYPE(QDeclarativeWorkerListModelAgent::VariantRef);
QT_BEGIN_NAMESPACE
-QmlWorkerScriptEnginePrivate::QmlWorkerScriptEnginePrivate(QmlEngine *engine)
+QDeclarativeWorkerScriptEnginePrivate::QDeclarativeWorkerScriptEnginePrivate(QDeclarativeEngine *engine)
: workerEngine(0), qmlengine(engine), m_nextId(0)
{
}
-QScriptValue QmlWorkerScriptEnginePrivate::onMessage(QScriptContext *ctxt, QScriptEngine *engine)
+QScriptValue QDeclarativeWorkerScriptEnginePrivate::onMessage(QScriptContext *ctxt, QScriptEngine *engine)
{
- QmlWorkerScriptEnginePrivate *p = QmlWorkerScriptEnginePrivate::get(engine);
+ QDeclarativeWorkerScriptEnginePrivate *p = QDeclarativeWorkerScriptEnginePrivate::get(engine);
int id = ctxt->thisObject().data().toVariant().toInt();
@@ -267,12 +267,12 @@ QScriptValue QmlWorkerScriptEnginePrivate::onMessage(QScriptContext *ctxt, QScri
return script->callback;
}
-QScriptValue QmlWorkerScriptEnginePrivate::sendMessage(QScriptContext *ctxt, QScriptEngine *engine)
+QScriptValue QDeclarativeWorkerScriptEnginePrivate::sendMessage(QScriptContext *ctxt, QScriptEngine *engine)
{
if (!ctxt->argumentCount())
return engine->undefinedValue();
- QmlWorkerScriptEnginePrivate *p = QmlWorkerScriptEnginePrivate::get(engine);
+ QDeclarativeWorkerScriptEnginePrivate *p = QDeclarativeWorkerScriptEnginePrivate::get(engine);
int id = ctxt->thisObject().data().toVariant().toInt();
@@ -289,7 +289,7 @@ QScriptValue QmlWorkerScriptEnginePrivate::sendMessage(QScriptContext *ctxt, QSc
return engine->undefinedValue();
}
-QScriptValue QmlWorkerScriptEnginePrivate::getWorker(int id)
+QScriptValue QDeclarativeWorkerScriptEnginePrivate::getWorker(int id)
{
QHash<int, WorkerScript *>::ConstIterator iter = workers.find(id);
@@ -315,7 +315,7 @@ QScriptValue QmlWorkerScriptEnginePrivate::getWorker(int id)
return script->object;
}
-bool QmlWorkerScriptEnginePrivate::event(QEvent *event)
+bool QDeclarativeWorkerScriptEnginePrivate::event(QEvent *event)
{
if (event->type() == (QEvent::Type)WorkerDataEvent::WorkerData) {
WorkerDataEvent *workerEvent = static_cast<WorkerDataEvent *>(event);
@@ -330,7 +330,7 @@ bool QmlWorkerScriptEnginePrivate::event(QEvent *event)
}
}
-void QmlWorkerScriptEnginePrivate::processMessage(int id, const QVariant &data)
+void QDeclarativeWorkerScriptEnginePrivate::processMessage(int id, const QVariant &data)
{
WorkerScript *script = workers.value(id);
if (!script)
@@ -344,7 +344,7 @@ void QmlWorkerScriptEnginePrivate::processMessage(int id, const QVariant &data)
}
}
-void QmlWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url)
+void QDeclarativeWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url)
{
if (url.isRelative() || url.scheme() != QLatin1String("file"))
return;
@@ -368,7 +368,7 @@ void QmlWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url)
}
}
-QVariant QmlWorkerScriptEnginePrivate::scriptValueToVariant(const QScriptValue &value)
+QVariant QDeclarativeWorkerScriptEnginePrivate::scriptValueToVariant(const QScriptValue &value)
{
if (value.isBool()) {
return QVariant(value.toBool());
@@ -388,9 +388,9 @@ QVariant QmlWorkerScriptEnginePrivate::scriptValueToVariant(const QScriptValue &
return QVariant(list);
} else if (value.isQObject()) {
- QmlWorkerListModel *lm = qobject_cast<QmlWorkerListModel *>(value.toQObject());
+ QDeclarativeWorkerListModel *lm = qobject_cast<QDeclarativeWorkerListModel *>(value.toQObject());
if (lm) {
- QmlWorkerListModelAgent::VariantRef v(lm->agent());
+ QDeclarativeWorkerListModelAgent::VariantRef v(lm->agent());
return qVariantFromValue(v);
} else {
// No other QObject's are allowed to be sent
@@ -413,7 +413,7 @@ QVariant QmlWorkerScriptEnginePrivate::scriptValueToVariant(const QScriptValue &
}
-QScriptValue QmlWorkerScriptEnginePrivate::variantToScriptValue(const QVariant &value, QScriptEngine *engine)
+QScriptValue QDeclarativeWorkerScriptEnginePrivate::variantToScriptValue(const QVariant &value, QScriptEngine *engine)
{
if (value.userType() == QVariant::Bool) {
return QScriptValue(value.toBool());
@@ -421,8 +421,8 @@ QScriptValue QmlWorkerScriptEnginePrivate::variantToScriptValue(const QVariant &
return QScriptValue(value.toString());
} else if (value.userType() == QMetaType::QReal) {
return QScriptValue(value.toReal());
- } else if (value.userType() == qMetaTypeId<QmlWorkerListModelAgent::VariantRef>()) {
- QmlWorkerListModelAgent::VariantRef vr = qvariant_cast<QmlWorkerListModelAgent::VariantRef>(value);
+ } else if (value.userType() == qMetaTypeId<QDeclarativeWorkerListModelAgent::VariantRef>()) {
+ QDeclarativeWorkerListModelAgent::VariantRef vr = qvariant_cast<QDeclarativeWorkerListModelAgent::VariantRef>(value);
if (vr.a->m_engine == 0)
vr.a->m_engine = engine;
else if (vr.a->m_engine != engine)
@@ -497,8 +497,8 @@ int WorkerRemoveEvent::workerId() const
return m_id;
}
-QmlWorkerScriptEngine::QmlWorkerScriptEngine(QmlEngine *parent)
-: QThread(parent), d(new QmlWorkerScriptEnginePrivate(parent))
+QDeclarativeWorkerScriptEngine::QDeclarativeWorkerScriptEngine(QDeclarativeEngine *parent)
+: QThread(parent), d(new QDeclarativeWorkerScriptEnginePrivate(parent))
{
d->m_lock.lock();
start(QThread::LowPriority);
@@ -507,20 +507,20 @@ QmlWorkerScriptEngine::QmlWorkerScriptEngine(QmlEngine *parent)
d->m_lock.unlock();
}
-QmlWorkerScriptEngine::~QmlWorkerScriptEngine()
+QDeclarativeWorkerScriptEngine::~QDeclarativeWorkerScriptEngine()
{
qDeleteAll(d->workers);
delete d; d = 0;
}
-QmlWorkerScriptEnginePrivate::WorkerScript::WorkerScript()
+QDeclarativeWorkerScriptEnginePrivate::WorkerScript::WorkerScript()
: id(-1), initialized(false), owner(0)
{
}
-int QmlWorkerScriptEngine::registerWorkerScript(QmlWorkerScript *owner)
+int QDeclarativeWorkerScriptEngine::registerWorkerScript(QDeclarativeWorkerScript *owner)
{
- QmlWorkerScriptEnginePrivate::WorkerScript *script = new QmlWorkerScriptEnginePrivate::WorkerScript;
+ QDeclarativeWorkerScriptEnginePrivate::WorkerScript *script = new QDeclarativeWorkerScriptEnginePrivate::WorkerScript;
script->id = d->m_nextId++;
script->owner = owner;
@@ -531,26 +531,26 @@ int QmlWorkerScriptEngine::registerWorkerScript(QmlWorkerScript *owner)
return script->id;
}
-void QmlWorkerScriptEngine::removeWorkerScript(int id)
+void QDeclarativeWorkerScriptEngine::removeWorkerScript(int id)
{
QCoreApplication::postEvent(d, new WorkerRemoveEvent(id));
}
-void QmlWorkerScriptEngine::executeUrl(int id, const QUrl &url)
+void QDeclarativeWorkerScriptEngine::executeUrl(int id, const QUrl &url)
{
QCoreApplication::postEvent(d, new WorkerLoadEvent(id, url));
}
-void QmlWorkerScriptEngine::sendMessage(int id, const QVariant &data)
+void QDeclarativeWorkerScriptEngine::sendMessage(int id, const QVariant &data)
{
QCoreApplication::postEvent(d, new WorkerDataEvent(id, data));
}
-void QmlWorkerScriptEngine::run()
+void QDeclarativeWorkerScriptEngine::run()
{
d->m_lock.lock();
- d->workerEngine = new QmlWorkerScriptEnginePrivate::ScriptEngine(d);
+ d->workerEngine = new QDeclarativeWorkerScriptEnginePrivate::ScriptEngine(d);
d->m_wait.wakeAll();
@@ -561,22 +561,22 @@ void QmlWorkerScriptEngine::run()
delete d->workerEngine; d->workerEngine = 0;
}
-QmlWorkerScript::QmlWorkerScript(QObject *parent)
+QDeclarativeWorkerScript::QDeclarativeWorkerScript(QObject *parent)
: QObject(parent), m_engine(0), m_scriptId(-1)
{
}
-QmlWorkerScript::~QmlWorkerScript()
+QDeclarativeWorkerScript::~QDeclarativeWorkerScript()
{
if (m_scriptId != -1) m_engine->removeWorkerScript(m_scriptId);
}
-QUrl QmlWorkerScript::source() const
+QUrl QDeclarativeWorkerScript::source() const
{
return m_source;
}
-void QmlWorkerScript::setSource(const QUrl &source)
+void QDeclarativeWorkerScript::setSource(const QUrl &source)
{
if (m_source == source)
return;
@@ -589,26 +589,26 @@ void QmlWorkerScript::setSource(const QUrl &source)
emit sourceChanged();
}
-void QmlWorkerScript::sendMessage(const QScriptValue &message)
+void QDeclarativeWorkerScript::sendMessage(const QScriptValue &message)
{
if (!m_engine) {
- qWarning("QmlWorkerScript: Attempt to send message before WorkerScript establishment");
+ qWarning("QDeclarativeWorkerScript: Attempt to send message before WorkerScript establishment");
return;
}
- m_engine->sendMessage(m_scriptId, QmlWorkerScriptEnginePrivate::scriptValueToVariant(message));
+ m_engine->sendMessage(m_scriptId, QDeclarativeWorkerScriptEnginePrivate::scriptValueToVariant(message));
}
-void QmlWorkerScript::componentComplete()
+void QDeclarativeWorkerScript::componentComplete()
{
if (!m_engine) {
- QmlEngine *engine = qmlEngine(this);
+ QDeclarativeEngine *engine = qmlEngine(this);
if (!engine) {
- qWarning("QmlWorkerScript: componentComplete() called without qmlEngine() set");
+ qWarning("QDeclarativeWorkerScript: componentComplete() called without qmlEngine() set");
return;
}
- m_engine = QmlEnginePrivate::get(engine)->getWorkerScriptEngine();
+ m_engine = QDeclarativeEnginePrivate::get(engine)->getWorkerScriptEngine();
m_scriptId = m_engine->registerWorkerScript(this);
if (m_source.isValid())
@@ -616,15 +616,15 @@ void QmlWorkerScript::componentComplete()
}
}
-bool QmlWorkerScript::event(QEvent *event)
+bool QDeclarativeWorkerScript::event(QEvent *event)
{
if (event->type() == (QEvent::Type)WorkerDataEvent::WorkerData) {
- QmlEngine *engine = qmlEngine(this);
+ QDeclarativeEngine *engine = qmlEngine(this);
if (engine) {
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
WorkerDataEvent *workerEvent = static_cast<WorkerDataEvent *>(event);
QScriptValue value =
- QmlWorkerScriptEnginePrivate::variantToScriptValue(workerEvent->data(), scriptEngine);
+ QDeclarativeWorkerScriptEnginePrivate::variantToScriptValue(workerEvent->data(), scriptEngine);
emit message(value);
}
return true;
@@ -633,32 +633,30 @@ bool QmlWorkerScript::event(QEvent *event)
}
}
-QML_DEFINE_TYPE(Qt, 4, 6, WorkerScript, QmlWorkerScript);
-
-void QmlWorkerListModelAgent::Data::clearChange()
+void QDeclarativeWorkerListModelAgent::Data::clearChange()
{
changes.clear();
}
-void QmlWorkerListModelAgent::Data::insertChange(int index, int count)
+void QDeclarativeWorkerListModelAgent::Data::insertChange(int index, int count)
{
Change c = { Change::Inserted, index, count, 0 };
changes << c;
}
-void QmlWorkerListModelAgent::Data::removeChange(int index, int count)
+void QDeclarativeWorkerListModelAgent::Data::removeChange(int index, int count)
{
Change c = { Change::Removed, index, count, 0 };
changes << c;
}
-void QmlWorkerListModelAgent::Data::changedChange(int index, int count)
+void QDeclarativeWorkerListModelAgent::Data::changedChange(int index, int count)
{
Change c = { Change::Changed, index, count, 0 };
changes << c;
}
-QmlWorkerListModelAgent::QmlWorkerListModelAgent(QmlWorkerListModel *m)
+QDeclarativeWorkerListModelAgent::QDeclarativeWorkerListModelAgent(QDeclarativeWorkerListModel *m)
: m_engine(0), m_ref(1), m_model(m)
{
data.roles = m_model->m_roles;
@@ -666,16 +664,16 @@ QmlWorkerListModelAgent::QmlWorkerListModelAgent(QmlWorkerListModel *m)
data.values = m_model->m_values;
}
-QmlWorkerListModelAgent::~QmlWorkerListModelAgent()
+QDeclarativeWorkerListModelAgent::~QDeclarativeWorkerListModelAgent()
{
}
-void QmlWorkerListModelAgent::addref()
+void QDeclarativeWorkerListModelAgent::addref()
{
m_ref.ref();
}
-void QmlWorkerListModelAgent::release()
+void QDeclarativeWorkerListModelAgent::release()
{
bool del = !m_ref.deref();
@@ -683,19 +681,19 @@ void QmlWorkerListModelAgent::release()
delete this;
}
-int QmlWorkerListModelAgent::count() const
+int QDeclarativeWorkerListModelAgent::count() const
{
return data.values.count();
}
-void QmlWorkerListModelAgent::clear()
+void QDeclarativeWorkerListModelAgent::clear()
{
data.clearChange();
data.removeChange(0, data.values.count());
data.values.clear();
}
-void QmlWorkerListModelAgent::remove(int index)
+void QDeclarativeWorkerListModelAgent::remove(int index)
{
if (data.values.count() <= index)
return;
@@ -704,7 +702,7 @@ void QmlWorkerListModelAgent::remove(int index)
data.removeChange(index, 1);
}
-void QmlWorkerListModelAgent::append(const QScriptValue &value)
+void QDeclarativeWorkerListModelAgent::append(const QScriptValue &value)
{
QHash<int, QVariant> row;
@@ -727,7 +725,7 @@ void QmlWorkerListModelAgent::append(const QScriptValue &value)
data.insertChange(data.values.count() - 1, 1);
}
-void QmlWorkerListModelAgent::insert(int index, const QScriptValue &value)
+void QDeclarativeWorkerListModelAgent::insert(int index, const QScriptValue &value)
{
if (index > data.values.count())
return;
@@ -753,7 +751,7 @@ void QmlWorkerListModelAgent::insert(int index, const QScriptValue &value)
data.insertChange(index, 1);
}
-void QmlWorkerListModelAgent::set(int index, const QScriptValue &value)
+void QDeclarativeWorkerListModelAgent::set(int index, const QScriptValue &value)
{
if (data.values.count() <= index)
return;
@@ -781,7 +779,7 @@ void QmlWorkerListModelAgent::set(int index, const QScriptValue &value)
}
}
-QScriptValue QmlWorkerListModelAgent::get(int index) const
+QScriptValue QDeclarativeWorkerListModelAgent::get(int index) const
{
if (data.values.count() <= index)
return m_engine->undefinedValue();
@@ -795,7 +793,7 @@ QScriptValue QmlWorkerListModelAgent::get(int index) const
return rv;
}
-void QmlWorkerListModelAgent::sync()
+void QDeclarativeWorkerListModelAgent::sync()
{
Sync *s = new Sync;
s->data = data;
@@ -803,7 +801,7 @@ void QmlWorkerListModelAgent::sync()
QCoreApplication::postEvent(this, s);
}
-bool QmlWorkerListModelAgent::event(QEvent *e)
+bool QDeclarativeWorkerListModelAgent::event(QEvent *e)
{
if (e->type() == QEvent::User) {
Sync *s = static_cast<Sync *>(e);
@@ -843,12 +841,12 @@ bool QmlWorkerListModelAgent::event(QEvent *e)
return QObject::event(e);
}
-QmlWorkerListModel::QmlWorkerListModel(QObject *parent)
+QDeclarativeWorkerListModel::QDeclarativeWorkerListModel(QObject *parent)
: QListModelInterface(parent), m_agent(0)
{
}
-QmlWorkerListModel::~QmlWorkerListModel()
+QDeclarativeWorkerListModel::~QDeclarativeWorkerListModel()
{
if (m_agent) {
m_agent->m_model = 0;
@@ -856,7 +854,7 @@ QmlWorkerListModel::~QmlWorkerListModel()
}
}
-void QmlWorkerListModel::clear()
+void QDeclarativeWorkerListModel::clear()
{
if (m_agent) {
qmlInfo(this) << "List can only be modified from a WorkerScript";
@@ -871,7 +869,7 @@ void QmlWorkerListModel::clear()
}
}
-void QmlWorkerListModel::remove(int index)
+void QDeclarativeWorkerListModel::remove(int index)
{
if (m_agent) {
qmlInfo(this) << "List can only be modified from a WorkerScript";
@@ -886,7 +884,7 @@ void QmlWorkerListModel::remove(int index)
emit countChanged();
}
-void QmlWorkerListModel::append(const QScriptValue &value)
+void QDeclarativeWorkerListModel::append(const QScriptValue &value)
{
if (m_agent) {
qmlInfo(this) << "List can only be modified from a WorkerScript";
@@ -916,7 +914,7 @@ void QmlWorkerListModel::append(const QScriptValue &value)
emit countChanged();
}
-void QmlWorkerListModel::insert(int index, const QScriptValue &value)
+void QDeclarativeWorkerListModel::insert(int index, const QScriptValue &value)
{
if (m_agent) {
qmlInfo(this) << "List can only be modified from a WorkerScript";
@@ -948,13 +946,13 @@ void QmlWorkerListModel::insert(int index, const QScriptValue &value)
emit countChanged();
}
-QScriptValue QmlWorkerListModel::get(int index) const
+QScriptValue QDeclarativeWorkerListModel::get(int index) const
{
- QmlEngine *engine = qmlEngine(this);
+ QDeclarativeEngine *engine = qmlEngine(this);
if (!engine || m_values.count() <= index)
return QScriptValue();
- QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
QScriptValue rv = scriptEngine->newObject();
QHash<int, QVariant> data = m_values.at(index);
@@ -964,7 +962,7 @@ QScriptValue QmlWorkerListModel::get(int index) const
return rv;
}
-void QmlWorkerListModel::set(int index, const QScriptValue &value)
+void QDeclarativeWorkerListModel::set(int index, const QScriptValue &value)
{
if (m_agent) {
qmlInfo(this) << "List can only be modified from a WorkerScript";
@@ -997,30 +995,30 @@ void QmlWorkerListModel::set(int index, const QScriptValue &value)
}
}
-QmlWorkerListModelAgent *QmlWorkerListModel::agent()
+QDeclarativeWorkerListModelAgent *QDeclarativeWorkerListModel::agent()
{
if (!m_agent)
- m_agent = new QmlWorkerListModelAgent(this);
+ m_agent = new QDeclarativeWorkerListModelAgent(this);
return m_agent;
}
-QList<int> QmlWorkerListModel::roles() const
+QList<int> QDeclarativeWorkerListModel::roles() const
{
return m_roles.keys();
}
-QString QmlWorkerListModel::toString(int role) const
+QString QDeclarativeWorkerListModel::toString(int role) const
{
return m_roles.value(role);
}
-int QmlWorkerListModel::count() const
+int QDeclarativeWorkerListModel::count() const
{
return m_values.count();
}
-QHash<int,QVariant> QmlWorkerListModel::data(int index, const QList<int> &) const
+QHash<int,QVariant> QDeclarativeWorkerListModel::data(int index, const QList<int> &) const
{
if (m_values.count() <= index)
return QHash<int, QVariant>();
@@ -1028,7 +1026,7 @@ QHash<int,QVariant> QmlWorkerListModel::data(int index, const QList<int> &) cons
return m_values.at(index);
}
-QVariant QmlWorkerListModel::data(int index, int role) const
+QVariant QDeclarativeWorkerListModel::data(int index, int role) const
{
if (m_values.count() <= index)
return QVariant();
@@ -1038,8 +1036,6 @@ QVariant QmlWorkerListModel::data(int index, int role) const
QT_END_NAMESPACE
-QML_DEFINE_TYPE(Qt,4,6,WorkerListModel,QmlWorkerListModel)
-
-#include "qmlworkerscript.moc"
+#include "qdeclarativeworkerscript.moc"
diff --git a/src/declarative/qml/qmlworkerscript_p.h b/src/declarative/qml/qdeclarativeworkerscript_p.h
index 7698a21..8ebd2c1 100644
--- a/src/declarative/qml/qmlworkerscript_p.h
+++ b/src/declarative/qml/qdeclarativeworkerscript_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLWORKERSCRIPT_P_H
-#define QMLWORKERSCRIPT_P_H
+#ifndef QDECLARATIVEWORKERSCRIPT_P_H
+#define QDECLARATIVEWORKERSCRIPT_P_H
//
// W A R N I N G
@@ -53,8 +53,8 @@
// We mean it.
//
-#include "qml.h"
-#include "qmlparserstatus.h"
+#include "qdeclarative.h"
+#include "qdeclarativeparserstatus.h"
#include <private/qlistmodelinterface_p.h>
#include <QtCore/qthread.h>
@@ -63,16 +63,16 @@
QT_BEGIN_NAMESPACE
-class QmlWorkerScript;
-class QmlWorkerScriptEnginePrivate;
-class QmlWorkerScriptEngine : public QThread
+class QDeclarativeWorkerScript;
+class QDeclarativeWorkerScriptEnginePrivate;
+class QDeclarativeWorkerScriptEngine : public QThread
{
Q_OBJECT
public:
- QmlWorkerScriptEngine(QmlEngine *parent = 0);
- virtual ~QmlWorkerScriptEngine();
+ QDeclarativeWorkerScriptEngine(QDeclarativeEngine *parent = 0);
+ virtual ~QDeclarativeWorkerScriptEngine();
- int registerWorkerScript(QmlWorkerScript *);
+ int registerWorkerScript(QDeclarativeWorkerScript *);
void removeWorkerScript(int);
void executeUrl(int, const QUrl &);
void sendMessage(int, const QVariant &);
@@ -81,18 +81,18 @@ protected:
virtual void run();
private:
- QmlWorkerScriptEnginePrivate *d;
+ QDeclarativeWorkerScriptEnginePrivate *d;
};
-class QmlWorkerScript : public QObject, public QmlParserStatus
+class QDeclarativeWorkerScript : public QObject, public QDeclarativeParserStatus
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
- Q_INTERFACES(QmlParserStatus)
+ Q_INTERFACES(QDeclarativeParserStatus)
public:
- QmlWorkerScript(QObject *parent = 0);
- virtual ~QmlWorkerScript();
+ QDeclarativeWorkerScript(QObject *parent = 0);
+ virtual ~QDeclarativeWorkerScript();
QUrl source() const;
void setSource(const QUrl &);
@@ -109,20 +109,20 @@ protected:
virtual bool event(QEvent *);
private:
- QmlWorkerScriptEngine *m_engine;
+ QDeclarativeWorkerScriptEngine *m_engine;
int m_scriptId;
QUrl m_source;
};
-class QmlWorkerListModelAgent;
-class QmlWorkerListModel : public QListModelInterface
+class QDeclarativeWorkerListModelAgent;
+class QDeclarativeWorkerListModel : public QListModelInterface
{
Q_OBJECT
Q_PROPERTY(int count READ count NOTIFY countChanged)
public:
- QmlWorkerListModel(QObject * = 0);
- virtual ~QmlWorkerListModel();
+ QDeclarativeWorkerListModel(QObject * = 0);
+ virtual ~QDeclarativeWorkerListModel();
Q_INVOKABLE void clear();
Q_INVOKABLE void remove(int index);
@@ -131,7 +131,7 @@ public:
Q_INVOKABLE QScriptValue get(int index) const;
Q_INVOKABLE void set(int index, const QScriptValue &);
- QmlWorkerListModelAgent *agent();
+ QDeclarativeWorkerListModelAgent *agent();
virtual QList<int> roles() const;
virtual QString toString(int role) const;
@@ -143,18 +143,18 @@ Q_SIGNALS:
void countChanged();
private:
- friend class QmlWorkerListModelAgent;
+ friend class QDeclarativeWorkerListModelAgent;
QHash<int, QString> m_roles;
QHash<QString, int> m_strings;
QList<QHash<int, QVariant> > m_values;
- QmlWorkerListModelAgent *m_agent;
+ QDeclarativeWorkerListModelAgent *m_agent;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlWorkerScript);
-QML_DECLARE_TYPE(QmlWorkerListModel);
+QML_DECLARE_TYPE(QDeclarativeWorkerScript);
+QML_DECLARE_TYPE(QDeclarativeWorkerListModel);
-#endif // QMLWORKERSCRIPT_P_H
+#endif // QDECLARATIVEWORKERSCRIPT_P_H
diff --git a/src/declarative/qml/qmlxmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
index eda2d9e..3ba53f0 100644
--- a/src/declarative/qml/qmlxmlhttprequest.cpp
+++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
@@ -39,13 +39,13 @@
**
****************************************************************************/
-#include "qmlxmlhttprequest_p.h"
+#include "qdeclarativexmlhttprequest_p.h"
-#include "qmlengine.h"
-#include "qmlengine_p.h"
-#include "qmlrefcount_p.h"
-#include "qmlengine_p.h"
-#include "qmlexpression_p.h"
+#include "qdeclarativeengine.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativerefcount_p.h"
+#include "qdeclarativeengine_p.h"
+#include "qdeclarativeexpression_p.h"
#include <QtCore/qobject.h>
#include <QtScript/qscriptvalue.h>
@@ -137,7 +137,7 @@ public:
QList<NodeImpl *> attributes;
};
-class DocumentImpl : public QmlRefCount, public NodeImpl
+class DocumentImpl : public QDeclarativeRefCount, public NodeImpl
{
public:
DocumentImpl() : root(0) { type = Document; }
@@ -151,8 +151,8 @@ public:
NodeImpl *root;
- void addref() { QmlRefCount::addref(); }
- void release() { QmlRefCount::release(); }
+ void addref() { QDeclarativeRefCount::addref(); }
+ void release() { QDeclarativeRefCount::release(); }
};
class NamedNodeMap
@@ -757,10 +757,10 @@ QScriptValue NamedNodeMap::create(QScriptEngine *engine, NodeImpl *data, QList<N
instance.setData(engine->newVariant(qVariantFromValue(map)));
- if (!QmlScriptEngine::get(engine)->namedNodeMapClass)
- QmlScriptEngine::get(engine)->namedNodeMapClass= new NamedNodeMapClass(engine);
+ if (!QDeclarativeScriptEngine::get(engine)->namedNodeMapClass)
+ QDeclarativeScriptEngine::get(engine)->namedNodeMapClass= new NamedNodeMapClass(engine);
- instance.setScriptClass(QmlScriptEngine::get(engine)->namedNodeMapClass);
+ instance.setScriptClass(QDeclarativeScriptEngine::get(engine)->namedNodeMapClass);
return instance;
}
@@ -814,10 +814,10 @@ QScriptValue NodeList::create(QScriptEngine *engine, NodeImpl *data)
instance.setData(engine->newVariant(qVariantFromValue(list)));
- if (!QmlScriptEngine::get(engine)->nodeListClass)
- QmlScriptEngine::get(engine)->nodeListClass= new NodeListClass(engine);
+ if (!QDeclarativeScriptEngine::get(engine)->nodeListClass)
+ QDeclarativeScriptEngine::get(engine)->nodeListClass= new NodeListClass(engine);
- instance.setScriptClass(QmlScriptEngine::get(engine)->nodeListClass);
+ instance.setScriptClass(QDeclarativeScriptEngine::get(engine)->nodeListClass);
return instance;
}
@@ -934,7 +934,7 @@ QScriptValue Document::xmlEncoding(QScriptContext *context, QScriptEngine *engin
return QScriptValue(static_cast<DocumentImpl *>(document.d)->encoding);
}
-class QmlXMLHttpRequest : public QObject
+class QDeclarativeXMLHttpRequest : public QObject
{
Q_OBJECT
public:
@@ -942,8 +942,8 @@ public:
Opened = 1, HeadersReceived = 2,
Loading = 3, Done = 4 };
- QmlXMLHttpRequest(QNetworkAccessManager *manager);
- virtual ~QmlXMLHttpRequest();
+ QDeclarativeXMLHttpRequest(QNetworkAccessManager *manager);
+ virtual ~QDeclarativeXMLHttpRequest();
bool sendFlag() const;
bool errorFlag() const;
@@ -997,43 +997,43 @@ private:
QNetworkAccessManager *networkAccessManager() { return m_nam; }
};
-QmlXMLHttpRequest::QmlXMLHttpRequest(QNetworkAccessManager *manager)
+QDeclarativeXMLHttpRequest::QDeclarativeXMLHttpRequest(QNetworkAccessManager *manager)
: m_state(Unsent), m_errorFlag(false), m_sendFlag(false),
m_redirectCount(0), m_network(0), m_nam(manager)
{
}
-QmlXMLHttpRequest::~QmlXMLHttpRequest()
+QDeclarativeXMLHttpRequest::~QDeclarativeXMLHttpRequest()
{
destroyNetwork();
}
-bool QmlXMLHttpRequest::sendFlag() const
+bool QDeclarativeXMLHttpRequest::sendFlag() const
{
return m_sendFlag;
}
-bool QmlXMLHttpRequest::errorFlag() const
+bool QDeclarativeXMLHttpRequest::errorFlag() const
{
return m_errorFlag;
}
-quint32 QmlXMLHttpRequest::readyState() const
+quint32 QDeclarativeXMLHttpRequest::readyState() const
{
return m_state;
}
-int QmlXMLHttpRequest::replyStatus() const
+int QDeclarativeXMLHttpRequest::replyStatus() const
{
return m_status;
}
-QString QmlXMLHttpRequest::replyStatusText() const
+QString QDeclarativeXMLHttpRequest::replyStatusText() const
{
return m_statusText;
}
-QScriptValue QmlXMLHttpRequest::open(QScriptValue *me, const QString &method, const QUrl &url)
+QScriptValue QDeclarativeXMLHttpRequest::open(QScriptValue *me, const QString &method, const QUrl &url)
{
destroyNetwork();
m_sendFlag = false;
@@ -1045,7 +1045,7 @@ QScriptValue QmlXMLHttpRequest::open(QScriptValue *me, const QString &method, co
return dispatchCallback(me);
}
-void QmlXMLHttpRequest::addHeader(const QString &name, const QString &value)
+void QDeclarativeXMLHttpRequest::addHeader(const QString &name, const QString &value)
{
QByteArray utfname = name.toUtf8();
@@ -1056,7 +1056,7 @@ void QmlXMLHttpRequest::addHeader(const QString &name, const QString &value)
}
}
-QString QmlXMLHttpRequest::header(const QString &name)
+QString QDeclarativeXMLHttpRequest::header(const QString &name)
{
QByteArray utfname = name.toLower().toUtf8();
@@ -1067,7 +1067,7 @@ QString QmlXMLHttpRequest::header(const QString &name)
return QString();
}
-QString QmlXMLHttpRequest::headers()
+QString QDeclarativeXMLHttpRequest::headers()
{
QString ret;
@@ -1081,7 +1081,7 @@ QString QmlXMLHttpRequest::headers()
return ret;
}
-void QmlXMLHttpRequest::fillHeadersList()
+void QDeclarativeXMLHttpRequest::fillHeadersList()
{
QList<QByteArray> headerList = m_network->rawHeaderList();
@@ -1096,7 +1096,7 @@ void QmlXMLHttpRequest::fillHeadersList()
}
}
-void QmlXMLHttpRequest::requestFromUrl(const QUrl &url)
+void QDeclarativeXMLHttpRequest::requestFromUrl(const QUrl &url)
{
QNetworkRequest request = m_request;
request.setUrl(url);
@@ -1146,7 +1146,7 @@ void QmlXMLHttpRequest::requestFromUrl(const QUrl &url)
this, SLOT(finished()));
}
-QScriptValue QmlXMLHttpRequest::send(QScriptValue *me, const QByteArray &data)
+QScriptValue QDeclarativeXMLHttpRequest::send(QScriptValue *me, const QByteArray &data)
{
m_errorFlag = false;
m_sendFlag = true;
@@ -1159,7 +1159,7 @@ QScriptValue QmlXMLHttpRequest::send(QScriptValue *me, const QByteArray &data)
return QScriptValue();
}
-QScriptValue QmlXMLHttpRequest::abort(QScriptValue *me)
+QScriptValue QDeclarativeXMLHttpRequest::abort(QScriptValue *me)
{
destroyNetwork();
m_responseEntityBody = QByteArray();
@@ -1180,7 +1180,7 @@ QScriptValue QmlXMLHttpRequest::abort(QScriptValue *me)
return QScriptValue();
}
-void QmlXMLHttpRequest::downloadProgress(qint64 bytes)
+void QDeclarativeXMLHttpRequest::downloadProgress(qint64 bytes)
{
Q_UNUSED(bytes)
m_status =
@@ -1205,7 +1205,7 @@ void QmlXMLHttpRequest::downloadProgress(qint64 bytes)
}
}
-void QmlXMLHttpRequest::error(QNetworkReply::NetworkError error)
+void QDeclarativeXMLHttpRequest::error(QNetworkReply::NetworkError error)
{
Q_UNUSED(error)
m_status =
@@ -1237,7 +1237,7 @@ void QmlXMLHttpRequest::error(QNetworkReply::NetworkError error)
}
#define XMLHTTPREQUEST_MAXIMUM_REDIRECT_RECURSION 15
-void QmlXMLHttpRequest::finished()
+void QDeclarativeXMLHttpRequest::finished()
{
m_redirectCount++;
if (m_redirectCount < XMLHTTPREQUEST_MAXIMUM_REDIRECT_RECURSION) {
@@ -1277,25 +1277,25 @@ void QmlXMLHttpRequest::finished()
}
-QString QmlXMLHttpRequest::responseBody() const
+QString QDeclarativeXMLHttpRequest::responseBody() const
{
return QString::fromUtf8(m_responseEntityBody);
}
-QScriptValue QmlXMLHttpRequest::dispatchCallback(QScriptValue *me)
+QScriptValue QDeclarativeXMLHttpRequest::dispatchCallback(QScriptValue *me)
{
QScriptValue v = me->property(QLatin1String("callback"));
return v.call();
}
-void QmlXMLHttpRequest::printError(const QScriptValue& sv)
+void QDeclarativeXMLHttpRequest::printError(const QScriptValue& sv)
{
- QmlError error;
- QmlExpressionPrivate::exceptionToError(sv.engine(), error);
+ QDeclarativeError error;
+ QDeclarativeExpressionPrivate::exceptionToError(sv.engine(), error);
qWarning().nospace() << qPrintable(error.toString());
}
-void QmlXMLHttpRequest::destroyNetwork()
+void QDeclarativeXMLHttpRequest::destroyNetwork()
{
if (m_network) {
m_network->disconnect();
@@ -1308,7 +1308,7 @@ void QmlXMLHttpRequest::destroyNetwork()
static QScriptValue qmlxmlhttprequest_open(QScriptContext *context, QScriptEngine *engine)
{
QScriptValue dataObject = context->thisObject().data();
- QmlXMLHttpRequest *request = qobject_cast<QmlXMLHttpRequest *>(dataObject.toQObject());
+ QDeclarativeXMLHttpRequest *request = qobject_cast<QDeclarativeXMLHttpRequest *>(dataObject.toQObject());
if (!request)
THROW_REFERENCE("Not an XMLHttpRequest object");
@@ -1328,7 +1328,7 @@ static QScriptValue qmlxmlhttprequest_open(QScriptContext *context, QScriptEngin
QUrl url = QUrl::fromEncoded(context->argument(1).toString().toUtf8());
if (url.isRelative()) {
- url = QmlScriptEngine::get(engine)->resolvedUrl(context,url);
+ url = QDeclarativeScriptEngine::get(engine)->resolvedUrl(context,url);
}
// Argument 2 - async (optional)
@@ -1355,7 +1355,7 @@ static QScriptValue qmlxmlhttprequest_open(QScriptContext *context, QScriptEngin
static QScriptValue qmlxmlhttprequest_setRequestHeader(QScriptContext *context, QScriptEngine *engine)
{
- QmlXMLHttpRequest *request = qobject_cast<QmlXMLHttpRequest *>(context->thisObject().data().toQObject());
+ QDeclarativeXMLHttpRequest *request = qobject_cast<QDeclarativeXMLHttpRequest *>(context->thisObject().data().toQObject());
if (!request)
THROW_REFERENCE("Not an XMLHttpRequest object");
@@ -1363,7 +1363,7 @@ static QScriptValue qmlxmlhttprequest_setRequestHeader(QScriptContext *context,
THROW_DOM(SYNTAX_ERR, "Incorrect argument count");
- if (request->readyState() != QmlXMLHttpRequest::Opened ||
+ if (request->readyState() != QDeclarativeXMLHttpRequest::Opened ||
request->sendFlag())
THROW_DOM(INVALID_STATE_ERR, "Invalid state");
@@ -1404,11 +1404,11 @@ static QScriptValue qmlxmlhttprequest_setRequestHeader(QScriptContext *context,
static QScriptValue qmlxmlhttprequest_send(QScriptContext *context, QScriptEngine *)
{
QScriptValue dataObject = context->thisObject().data();
- QmlXMLHttpRequest *request = qobject_cast<QmlXMLHttpRequest *>(dataObject.toQObject());
+ QDeclarativeXMLHttpRequest *request = qobject_cast<QDeclarativeXMLHttpRequest *>(dataObject.toQObject());
if (!request)
THROW_REFERENCE("Not an XMLHttpRequest object");
- if (request->readyState() != QmlXMLHttpRequest::Opened)
+ if (request->readyState() != QDeclarativeXMLHttpRequest::Opened)
THROW_DOM(INVALID_STATE_ERR, "Invalid state");
if (request->sendFlag())
@@ -1424,7 +1424,7 @@ static QScriptValue qmlxmlhttprequest_send(QScriptContext *context, QScriptEngin
static QScriptValue qmlxmlhttprequest_abort(QScriptContext *context, QScriptEngine *)
{
QScriptValue dataObject = context->thisObject().data();
- QmlXMLHttpRequest *request = qobject_cast<QmlXMLHttpRequest *>(dataObject.toQObject());
+ QDeclarativeXMLHttpRequest *request = qobject_cast<QDeclarativeXMLHttpRequest *>(dataObject.toQObject());
if (!request)
THROW_REFERENCE("Not an XMLHttpRequest object");
@@ -1434,16 +1434,16 @@ static QScriptValue qmlxmlhttprequest_abort(QScriptContext *context, QScriptEngi
static QScriptValue qmlxmlhttprequest_getResponseHeader(QScriptContext *context, QScriptEngine *engine)
{
Q_UNUSED(engine)
- QmlXMLHttpRequest *request = qobject_cast<QmlXMLHttpRequest *>(context->thisObject().data().toQObject());
+ QDeclarativeXMLHttpRequest *request = qobject_cast<QDeclarativeXMLHttpRequest *>(context->thisObject().data().toQObject());
if (!request)
THROW_REFERENCE("Not an XMLHttpRequest object");
if (context->argumentCount() != 1)
THROW_DOM(SYNTAX_ERR, "Incorrect argument count");
- if (request->readyState() != QmlXMLHttpRequest::Loading &&
- request->readyState() != QmlXMLHttpRequest::Done &&
- request->readyState() != QmlXMLHttpRequest::HeadersReceived)
+ if (request->readyState() != QDeclarativeXMLHttpRequest::Loading &&
+ request->readyState() != QDeclarativeXMLHttpRequest::Done &&
+ request->readyState() != QDeclarativeXMLHttpRequest::HeadersReceived)
THROW_DOM(INVALID_STATE_ERR, "Invalid state");
QString headerName = context->argument(0).toString();
@@ -1454,16 +1454,16 @@ static QScriptValue qmlxmlhttprequest_getResponseHeader(QScriptContext *context,
static QScriptValue qmlxmlhttprequest_getAllResponseHeaders(QScriptContext *context, QScriptEngine *engine)
{
Q_UNUSED(engine)
- QmlXMLHttpRequest *request = qobject_cast<QmlXMLHttpRequest *>(context->thisObject().data().toQObject());
+ QDeclarativeXMLHttpRequest *request = qobject_cast<QDeclarativeXMLHttpRequest *>(context->thisObject().data().toQObject());
if (!request)
THROW_REFERENCE("Not an XMLHttpRequest object");
if (context->argumentCount() != 0)
THROW_DOM(SYNTAX_ERR, "Incorrect argument count");
- if (request->readyState() != QmlXMLHttpRequest::Loading &&
- request->readyState() != QmlXMLHttpRequest::Done &&
- request->readyState() != QmlXMLHttpRequest::HeadersReceived)
+ if (request->readyState() != QDeclarativeXMLHttpRequest::Loading &&
+ request->readyState() != QDeclarativeXMLHttpRequest::Done &&
+ request->readyState() != QDeclarativeXMLHttpRequest::HeadersReceived)
THROW_DOM(INVALID_STATE_ERR, "Invalid state");
return QScriptValue(request->headers());
@@ -1473,7 +1473,7 @@ static QScriptValue qmlxmlhttprequest_getAllResponseHeaders(QScriptContext *cont
static QScriptValue qmlxmlhttprequest_readyState(QScriptContext *context, QScriptEngine *engine)
{
Q_UNUSED(engine)
- QmlXMLHttpRequest *request = qobject_cast<QmlXMLHttpRequest *>(context->thisObject().data().toQObject());
+ QDeclarativeXMLHttpRequest *request = qobject_cast<QDeclarativeXMLHttpRequest *>(context->thisObject().data().toQObject());
if (!request)
THROW_REFERENCE("Not an XMLHttpRequest object");
@@ -1483,12 +1483,12 @@ static QScriptValue qmlxmlhttprequest_readyState(QScriptContext *context, QScrip
static QScriptValue qmlxmlhttprequest_status(QScriptContext *context, QScriptEngine *engine)
{
Q_UNUSED(engine)
- QmlXMLHttpRequest *request = qobject_cast<QmlXMLHttpRequest *>(context->thisObject().data().toQObject());
+ QDeclarativeXMLHttpRequest *request = qobject_cast<QDeclarativeXMLHttpRequest *>(context->thisObject().data().toQObject());
if (!request)
THROW_REFERENCE("Not an XMLHttpRequest object");
- if (request->readyState() == QmlXMLHttpRequest::Unsent ||
- request->readyState() == QmlXMLHttpRequest::Opened)
+ if (request->readyState() == QDeclarativeXMLHttpRequest::Unsent ||
+ request->readyState() == QDeclarativeXMLHttpRequest::Opened)
THROW_DOM(INVALID_STATE_ERR, "Invalid state");
if (request->errorFlag())
@@ -1500,12 +1500,12 @@ static QScriptValue qmlxmlhttprequest_status(QScriptContext *context, QScriptEng
static QScriptValue qmlxmlhttprequest_statusText(QScriptContext *context, QScriptEngine *engine)
{
Q_UNUSED(engine)
- QmlXMLHttpRequest *request = qobject_cast<QmlXMLHttpRequest *>(context->thisObject().data().toQObject());
+ QDeclarativeXMLHttpRequest *request = qobject_cast<QDeclarativeXMLHttpRequest *>(context->thisObject().data().toQObject());
if (!request)
THROW_REFERENCE("Not an XMLHttpRequest object");
- if (request->readyState() == QmlXMLHttpRequest::Unsent ||
- request->readyState() == QmlXMLHttpRequest::Opened)
+ if (request->readyState() == QDeclarativeXMLHttpRequest::Unsent ||
+ request->readyState() == QDeclarativeXMLHttpRequest::Opened)
THROW_DOM(INVALID_STATE_ERR, "Invalid state");
if (request->errorFlag())
@@ -1517,12 +1517,12 @@ static QScriptValue qmlxmlhttprequest_statusText(QScriptContext *context, QScrip
static QScriptValue qmlxmlhttprequest_responseText(QScriptContext *context, QScriptEngine *engine)
{
Q_UNUSED(engine)
- QmlXMLHttpRequest *request = qobject_cast<QmlXMLHttpRequest *>(context->thisObject().data().toQObject());
+ QDeclarativeXMLHttpRequest *request = qobject_cast<QDeclarativeXMLHttpRequest *>(context->thisObject().data().toQObject());
if (!request)
THROW_REFERENCE("Not an XMLHttpRequest object");
- if (request->readyState() != QmlXMLHttpRequest::Loading &&
- request->readyState() != QmlXMLHttpRequest::Done)
+ if (request->readyState() != QDeclarativeXMLHttpRequest::Loading &&
+ request->readyState() != QDeclarativeXMLHttpRequest::Done)
return QScriptValue(QString());
else
return QScriptValue(request->responseBody());
@@ -1530,12 +1530,12 @@ static QScriptValue qmlxmlhttprequest_responseText(QScriptContext *context, QScr
static QScriptValue qmlxmlhttprequest_responseXML(QScriptContext *context, QScriptEngine *engine)
{
- QmlXMLHttpRequest *request = qobject_cast<QmlXMLHttpRequest *>(context->thisObject().data().toQObject());
+ QDeclarativeXMLHttpRequest *request = qobject_cast<QDeclarativeXMLHttpRequest *>(context->thisObject().data().toQObject());
if (!request)
THROW_REFERENCE("Not an XMLHttpRequest object");
- if (request->readyState() != QmlXMLHttpRequest::Loading &&
- request->readyState() != QmlXMLHttpRequest::Done)
+ if (request->readyState() != QDeclarativeXMLHttpRequest::Loading &&
+ request->readyState() != QDeclarativeXMLHttpRequest::Done)
return engine->nullValue();
else
return Document::load(engine, request->responseBody());
@@ -1545,7 +1545,7 @@ static QScriptValue qmlxmlhttprequest_onreadystatechange(QScriptContext *context
{
Q_UNUSED(engine);
QScriptValue dataObject = context->thisObject().data();
- QmlXMLHttpRequest *request = qobject_cast<QmlXMLHttpRequest *>(dataObject.toQObject());
+ QDeclarativeXMLHttpRequest *request = qobject_cast<QDeclarativeXMLHttpRequest *>(dataObject.toQObject());
if (!request)
THROW_REFERENCE("Not an XMLHttpRequest object");
@@ -1562,7 +1562,7 @@ static QScriptValue qmlxmlhttprequest_onreadystatechange(QScriptContext *context
static QScriptValue qmlxmlhttprequest_new(QScriptContext *context, QScriptEngine *engine)
{
if (context->isCalledAsConstructor()) {
- context->thisObject().setData(engine->newQObject(new QmlXMLHttpRequest(QmlScriptEngine::get(engine)->networkAccessManager()), QScriptEngine::ScriptOwnership));
+ context->thisObject().setData(engine->newQObject(new QDeclarativeXMLHttpRequest(QDeclarativeScriptEngine::get(engine)->networkAccessManager()), QScriptEngine::ScriptOwnership));
}
return engine->undefinedValue();
}
@@ -1628,4 +1628,4 @@ void qt_add_qmlxmlhttprequest(QScriptEngine *engine)
QT_END_NAMESPACE
-#include <qmlxmlhttprequest.moc>
+#include <qdeclarativexmlhttprequest.moc>
diff --git a/src/declarative/qml/qmlxmlhttprequest_p.h b/src/declarative/qml/qdeclarativexmlhttprequest_p.h
index 59cb211..068cd0f 100644
--- a/src/declarative/qml/qmlxmlhttprequest_p.h
+++ b/src/declarative/qml/qdeclarativexmlhttprequest_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLXMLHTTPREQUEST_P_H
-#define QMLXMLHTTPREQUEST_P_H
+#ifndef QDECLARATIVEXMLHTTPREQUEST_P_H
+#define QDECLARATIVEXMLHTTPREQUEST_P_H
#include <QtScript/qscriptengine.h>
//
@@ -63,5 +63,5 @@ void qt_add_qmlxmlhttprequest(QScriptEngine *engine);
QT_END_NAMESPACE
-#endif // QMLXMLHTTPREQUEST_P_H
+#endif // QDECLARATIVEXMLHTTPREQUEST_P_H
diff --git a/src/declarative/qml/qml.h b/src/declarative/qml/qml.h
deleted file mode 100644
index 163d198..0000000
--- a/src/declarative/qml/qml.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 QML_H
-#define QML_H
-
-#include "qmlmetatype.h"
-#include "qmlmetaproperty.h"
-#include "qmlparserstatus.h"
-#include "qmlpropertyvaluesource.h"
-#include "qmllist.h"
-
-#include <QtCore/qbytearray.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qmetaobject.h>
-
-QT_BEGIN_HEADER
-
-#define QML_DECLARE_TYPE(TYPE) \
- Q_DECLARE_METATYPE(TYPE *) \
- Q_DECLARE_METATYPE(QmlListProperty<TYPE>)
-
-#define QML_DECLARE_TYPE_HASMETATYPE(TYPE) \
- Q_DECLARE_METATYPE(QmlListProperty<TYPE>)
-
-#define QML_DECLARE_INTERFACE(INTERFACE) \
- QML_DECLARE_TYPE(INTERFACE)
-
-#define QML_DECLARE_INTERFACE_HASMETATYPE(INTERFACE) \
- QML_DECLARE_TYPE_HASMETATYPE(INTERFACE)
-
-enum { /* TYPEINFO flags */
- QML_HAS_ATTACHED_PROPERTIES = 0x01,
-};
-
-#define QML_DECLARE_TYPEINFO(TYPE, FLAGS) \
-QT_BEGIN_NAMESPACE \
-template <> \
-class QmlTypeInfo<TYPE > \
-{ \
-public: \
- enum { \
- hasAttachedProperties = (((FLAGS) & QML_HAS_ATTACHED_PROPERTIES) == QML_HAS_ATTACHED_PROPERTIES) \
- }; \
-}; \
-QT_END_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-#if defined(Q_OS_SYMBIAN)
-#define QML_DEFINE_INTERFACE(INTERFACE) \
- static int defineInterface##INTERFACE = qmlRegisterInterface<INTERFACE>(#INTERFACE);
-
-#define QML_DEFINE_EXTENDED_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, EXTENSION) \
- static int registerExtended##TYPE = qmlRegisterExtendedType<TYPE,EXTENSION>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE);
-
-#define QML_DEFINE_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE) \
- static int defineType##TYPE = qmlRegisterType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE);
-
-#define QML_DEFINE_EXTENDED_NOCREATE_TYPE(TYPE, EXTENSION) \
- static int registerExtendedNoCreate##TYPE = qmlRegisterExtendedType<TYPE,EXTENSION>(#TYPE);
-
-#define QML_DEFINE_NOCREATE_TYPE(TYPE) \
- static int registerNoCreate##TYPE = qmlRegisterType<TYPE>(#TYPE);
-
-#else
-
-#define QML_DEFINE_INTERFACE(INTERFACE) \
- template<> QmlPrivate::InstanceType QmlPrivate::Define<INTERFACE *,0,0>::instance(qmlRegisterInterface<INTERFACE>(#INTERFACE));
-
-#define QML_DEFINE_EXTENDED_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, EXTENSION) \
- template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,(VERSION_MAJ), (VERSION_MIN)>::instance(qmlRegisterExtendedType<TYPE,EXTENSION>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE));
-
-#define QML_DEFINE_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE) \
- template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,(VERSION_MAJ), (VERSION_MIN)>::instance(qmlRegisterType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE));
-
-#define QML_DEFINE_EXTENDED_NOCREATE_TYPE(TYPE, EXTENSION) \
- template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,0,0>::instance(qmlRegisterExtendedType<TYPE,EXTENSION>(#TYPE));
-
-#define QML_DEFINE_NOCREATE_TYPE(TYPE) \
- template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,0,0>::instance(qmlRegisterType<TYPE>(#TYPE));
-
-#endif
-
-class QmlContext;
-class QmlEngine;
-Q_DECLARATIVE_EXPORT void qmlExecuteDeferred(QObject *);
-Q_DECLARATIVE_EXPORT QmlContext *qmlContext(const QObject *);
-Q_DECLARATIVE_EXPORT QmlEngine *qmlEngine(const QObject *);
-Q_DECLARATIVE_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *, bool create = true);
-
-template<typename T>
-QObject *qmlAttachedPropertiesObject(const QObject *obj, bool create = true)
-{
- // ### is this threadsafe?
- static int idx = -1;
-
- if (idx == -1)
- idx = QmlMetaType::attachedPropertiesFuncId(&T::staticMetaObject);
-
- if (idx == -1 || !obj)
- return 0;
-
- return qmlAttachedPropertiesObjectById(idx, obj, create);
-}
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QObject)
-Q_DECLARE_METATYPE(QVariant)
-
-QT_END_HEADER
-
-#endif // QML_H
diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri
index 2313c37..aa1a34b 100644
--- a/src/declarative/qml/qml.pri
+++ b/src/declarative/qml/qml.pri
@@ -1,128 +1,131 @@
INCLUDEPATH += $$PWD
SOURCES += \
- $$PWD/qmlparser.cpp \
- $$PWD/qmlinstruction.cpp \
- $$PWD/qmlvmemetaobject.cpp \
- $$PWD/qmlengine.cpp \
- $$PWD/qmlexpression.cpp \
- $$PWD/qmlbinding.cpp \
- $$PWD/qmlmetaproperty.cpp \
- $$PWD/qmlmoduleplugin.cpp \
- $$PWD/qmlcomponent.cpp \
- $$PWD/qmlcontext.cpp \
- $$PWD/qmlcustomparser.cpp \
- $$PWD/qmlpropertyvaluesource.cpp \
- $$PWD/qmlpropertyvalueinterceptor.cpp \
- $$PWD/qmlproxymetaobject.cpp \
- $$PWD/qmlvme.cpp \
- $$PWD/qmlcompiler.cpp \
- $$PWD/qmlcompileddata.cpp \
- $$PWD/qmlboundsignal.cpp \
- $$PWD/qmldom.cpp \
- $$PWD/qmlrefcount.cpp \
- $$PWD/qmlprivate.cpp \
- $$PWD/qmlmetatype.cpp \
- $$PWD/qmlstringconverters.cpp \
- $$PWD/qmlclassfactory.cpp \
- $$PWD/qmlparserstatus.cpp \
- $$PWD/qmlcompositetypemanager.cpp \
- $$PWD/qmlinfo.cpp \
- $$PWD/qmlerror.cpp \
- $$PWD/qmlscriptparser.cpp \
- $$PWD/qmlenginedebug.cpp \
- $$PWD/qmlrewrite.cpp \
- $$PWD/qmlvaluetype.cpp \
- $$PWD/qmlcompiledbindings.cpp \
- $$PWD/qmlxmlhttprequest.cpp \
- $$PWD/qmlsqldatabase.cpp \
+ $$PWD/qdeclarativeparser.cpp \
+ $$PWD/qdeclarativeinstruction.cpp \
+ $$PWD/qdeclarativevmemetaobject.cpp \
+ $$PWD/qdeclarativeengine.cpp \
+ $$PWD/qdeclarativeexpression.cpp \
+ $$PWD/qdeclarativebinding.cpp \
+ $$PWD/qdeclarativeproperty.cpp \
+ $$PWD/qdeclarativecomponent.cpp \
+ $$PWD/qdeclarativecontext.cpp \
+ $$PWD/qdeclarativecustomparser.cpp \
+ $$PWD/qdeclarativepropertyvaluesource.cpp \
+ $$PWD/qdeclarativepropertyvalueinterceptor.cpp \
+ $$PWD/qdeclarativeproxymetaobject.cpp \
+ $$PWD/qdeclarativevme.cpp \
+ $$PWD/qdeclarativecompiler.cpp \
+ $$PWD/qdeclarativecompileddata.cpp \
+ $$PWD/qdeclarativeboundsignal.cpp \
+ $$PWD/qdeclarativedom.cpp \
+ $$PWD/qdeclarativerefcount.cpp \
+ $$PWD/qdeclarativemetatype.cpp \
+ $$PWD/qdeclarativestringconverters.cpp \
+ $$PWD/qdeclarativeclassfactory.cpp \
+ $$PWD/qdeclarativeparserstatus.cpp \
+ $$PWD/qdeclarativecompositetypemanager.cpp \
+ $$PWD/qdeclarativeinfo.cpp \
+ $$PWD/qdeclarativeerror.cpp \
+ $$PWD/qdeclarativescriptparser.cpp \
+ $$PWD/qdeclarativeenginedebug.cpp \
+ $$PWD/qdeclarativerewrite.cpp \
+ $$PWD/qdeclarativevaluetype.cpp \
+ $$PWD/qdeclarativecompiledbindings.cpp \
+ $$PWD/qdeclarativexmlhttprequest.cpp \
+ $$PWD/qdeclarativesqldatabase.cpp \
$$PWD/qmetaobjectbuilder.cpp \
- $$PWD/qmlwatcher.cpp \
- $$PWD/qmlscript.cpp \
- $$PWD/qmlcleanup.cpp \
- $$PWD/qmlpropertycache.cpp \
- $$PWD/qmlintegercache.cpp \
- $$PWD/qmltypenamecache.cpp \
- $$PWD/qmlscriptstring.cpp \
- $$PWD/qmlobjectscriptclass.cpp \
- $$PWD/qmlcontextscriptclass.cpp \
- $$PWD/qmlglobalscriptclass.cpp \
- $$PWD/qmlvaluetypescriptclass.cpp \
- $$PWD/qmltypenamescriptclass.cpp \
- $$PWD/qmllistscriptclass.cpp \
- $$PWD/qmlworkerscript.cpp \
- $$PWD/qmlimageprovider.cpp \
- $$PWD/qmlnetworkaccessmanagerfactory.cpp \
- $$PWD/qmllist.cpp
+ $$PWD/qdeclarativewatcher.cpp \
+ $$PWD/qdeclarativescript.cpp \
+ $$PWD/qdeclarativecleanup.cpp \
+ $$PWD/qdeclarativepropertycache.cpp \
+ $$PWD/qdeclarativeintegercache.cpp \
+ $$PWD/qdeclarativetypenamecache.cpp \
+ $$PWD/qdeclarativescriptstring.cpp \
+ $$PWD/qdeclarativeobjectscriptclass.cpp \
+ $$PWD/qdeclarativecontextscriptclass.cpp \
+ $$PWD/qdeclarativeglobalscriptclass.cpp \
+ $$PWD/qdeclarativevaluetypescriptclass.cpp \
+ $$PWD/qdeclarativetypenamescriptclass.cpp \
+ $$PWD/qdeclarativelistscriptclass.cpp \
+ $$PWD/qdeclarativeworkerscript.cpp \
+ $$PWD/qdeclarativeimageprovider.cpp \
+ $$PWD/qdeclarativenetworkaccessmanagerfactory.cpp \
+ $$PWD/qdeclarativedirparser.cpp \
+ $$PWD/qdeclarativeextensionplugin.cpp \
+ $$PWD/qdeclarativelist.cpp
HEADERS += \
- $$PWD/qmlparser_p.h \
- $$PWD/qmlglobal_p.h \
- $$PWD/qmlinstruction_p.h \
- $$PWD/qmlvmemetaobject_p.h \
- $$PWD/qml.h \
- $$PWD/qmlbinding.h \
- $$PWD/qmlbinding_p.h \
- $$PWD/qmlmetaproperty.h \
- $$PWD/qmlmoduleplugin.h \
- $$PWD/qmlcomponent.h \
- $$PWD/qmlcomponent_p.h \
- $$PWD/qmlcustomparser_p.h \
- $$PWD/qmlcustomparser_p_p.h \
- $$PWD/qmlpropertyvaluesource.h \
- $$PWD/qmlpropertyvalueinterceptor.h \
- $$PWD/qmlboundsignal_p.h \
- $$PWD/qmlparserstatus.h \
- $$PWD/qmlproxymetaobject_p.h \
- $$PWD/qmlvme_p.h \
- $$PWD/qmlcompiler_p.h \
- $$PWD/qmlengine_p.h \
- $$PWD/qmlexpression_p.h \
- $$PWD/qmlprivate.h \
- $$PWD/qmldom_p.h \
- $$PWD/qmldom_p_p.h \
- $$PWD/qmlrefcount_p.h \
- $$PWD/qmlmetatype.h \
- $$PWD/qmlengine.h \
- $$PWD/qmlcontext.h \
- $$PWD/qmlexpression.h \
- $$PWD/qmlstringconverters_p.h \
- $$PWD/qmlclassfactory_p.h \
- $$PWD/qmlinfo.h \
- $$PWD/qmlmetaproperty_p.h \
- $$PWD/qmlcontext_p.h \
- $$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 \
- $$PWD/qmlenginedebug_p.h \
- $$PWD/qmlrewrite_p.h \
+ $$PWD/qdeclarativeparser_p.h \
+ $$PWD/qdeclarativeglobal_p.h \
+ $$PWD/qdeclarativeinstruction_p.h \
+ $$PWD/qdeclarativevmemetaobject_p.h \
+ $$PWD/qdeclarative.h \
+ $$PWD/qdeclarativebinding_p.h \
+ $$PWD/qdeclarativebinding_p_p.h \
+ $$PWD/qdeclarativeproperty.h \
+ $$PWD/qdeclarativecomponent.h \
+ $$PWD/qdeclarativecomponent_p.h \
+ $$PWD/qdeclarativecustomparser_p.h \
+ $$PWD/qdeclarativecustomparser_p_p.h \
+ $$PWD/qdeclarativepropertyvaluesource.h \
+ $$PWD/qdeclarativepropertyvalueinterceptor.h \
+ $$PWD/qdeclarativeboundsignal_p.h \
+ $$PWD/qdeclarativeparserstatus.h \
+ $$PWD/qdeclarativeproxymetaobject_p.h \
+ $$PWD/qdeclarativevme_p.h \
+ $$PWD/qdeclarativecompiler_p.h \
+ $$PWD/qdeclarativeengine_p.h \
+ $$PWD/qdeclarativeexpression_p.h \
+ $$PWD/qdeclarativeprivate.h \
+ $$PWD/qdeclarativedom_p.h \
+ $$PWD/qdeclarativedom_p_p.h \
+ $$PWD/qdeclarativerefcount_p.h \
+ $$PWD/qdeclarativemetatype_p.h \
+ $$PWD/qdeclarativeengine.h \
+ $$PWD/qdeclarativecontext.h \
+ $$PWD/qdeclarativeexpression.h \
+ $$PWD/qdeclarativestringconverters_p.h \
+ $$PWD/qdeclarativeclassfactory_p.h \
+ $$PWD/qdeclarativeinfo.h \
+ $$PWD/qdeclarativeproperty_p.h \
+ $$PWD/qdeclarativecontext_p.h \
+ $$PWD/qdeclarativecompositetypedata_p.h \
+ $$PWD/qdeclarativecompositetypemanager_p.h \
+ $$PWD/qdeclarativelist.h \
+ $$PWD/qdeclarativelist_p.h \
+ $$PWD/qdeclarativedeclarativedata_p.h \
+ $$PWD/qdeclarativeerror.h \
+ $$PWD/qdeclarativescriptparser_p.h \
+ $$PWD/qdeclarativeenginedebug_p.h \
+ $$PWD/qdeclarativerewrite_p.h \
$$PWD/qpodvector_p.h \
$$PWD/qbitfield_p.h \
- $$PWD/qmlvaluetype_p.h \
- $$PWD/qmlcompiledbindings_p.h \
- $$PWD/qmlxmlhttprequest_p.h \
- $$PWD/qmlsqldatabase_p.h \
+ $$PWD/qdeclarativevaluetype_p.h \
+ $$PWD/qdeclarativecompiledbindings_p.h \
+ $$PWD/qdeclarativexmlhttprequest_p.h \
+ $$PWD/qdeclarativesqldatabase_p.h \
$$PWD/qmetaobjectbuilder_p.h \
- $$PWD/qmlwatcher_p.h \
- $$PWD/qmlcleanup_p.h \
- $$PWD/qmlpropertycache_p.h \
- $$PWD/qmlintegercache_p.h \
- $$PWD/qmltypenamecache_p.h \
- $$PWD/qmlscriptstring.h \
- $$PWD/qmlobjectscriptclass_p.h \
- $$PWD/qmlcontextscriptclass_p.h \
- $$PWD/qmlglobalscriptclass_p.h \
- $$PWD/qmlvaluetypescriptclass_p.h \
- $$PWD/qmltypenamescriptclass_p.h \
- $$PWD/qmllistscriptclass_p.h \
- $$PWD/qmlworkerscript_p.h \
- $$PWD/qmlscriptclass_p.h \
- $$PWD/qmlguard_p.h \
- $$PWD/qmlimageprovider.h \
- $$PWD/qmlnetworkaccessmanagerfactory.h
+ $$PWD/qdeclarativewatcher_p.h \
+ $$PWD/qdeclarativecleanup_p.h \
+ $$PWD/qdeclarativepropertycache_p.h \
+ $$PWD/qdeclarativeintegercache_p.h \
+ $$PWD/qdeclarativetypenamecache_p.h \
+ $$PWD/qdeclarativescriptstring.h \
+ $$PWD/qdeclarativeobjectscriptclass_p.h \
+ $$PWD/qdeclarativecontextscriptclass_p.h \
+ $$PWD/qdeclarativeglobalscriptclass_p.h \
+ $$PWD/qdeclarativevaluetypescriptclass_p.h \
+ $$PWD/qdeclarativetypenamescriptclass_p.h \
+ $$PWD/qdeclarativelistscriptclass_p.h \
+ $$PWD/qdeclarativeworkerscript_p.h \
+ $$PWD/qdeclarativescriptclass_p.h \
+ $$PWD/qdeclarativeguard_p.h \
+ $$PWD/qdeclarativeimageprovider.h \
+ $$PWD/qdeclarativenetworkaccessmanagerfactory.h \
+ $$PWD/qdeclarativedirparser_p.h \
+ $$PWD/qdeclarativeextensioninterface.h \
+ $$PWD/qdeclarativeextensionplugin.h
+
QT += sql
include(parser/parser.pri)
include(rewriter/rewriter.pri)
diff --git a/src/declarative/qml/qmlbinding.h b/src/declarative/qml/qmlbinding.h
deleted file mode 100644
index 151b71c..0000000
--- a/src/declarative/qml/qmlbinding.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 QMLBINDING_H
-#define QMLBINDING_H
-
-#include "qml.h"
-#include "qmlpropertyvaluesource.h"
-#include "qmlexpression.h"
-
-#include <QtCore/QObject>
-#include <QtCore/QMetaProperty>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class Q_DECLARATIVE_EXPORT QmlAbstractBinding
-{
-public:
- QmlAbstractBinding();
- virtual ~QmlAbstractBinding();
-
- virtual void destroy();
-
- virtual QString expression() const;
-
- void setEnabled(bool e) { setEnabled(e, QmlMetaProperty::DontRemoveBinding); }
- virtual void setEnabled(bool, QmlMetaProperty::WriteFlags) = 0;
- virtual int propertyIndex() = 0;
-
- void update() { update(QmlMetaProperty::DontRemoveBinding); }
- virtual void update(QmlMetaProperty::WriteFlags) = 0;
-
- void addToObject(QObject *);
- void removeFromObject();
-
-protected:
- void clear();
-
-private:
- friend class QmlDeclarativeData;
- friend class QmlMetaProperty;
- friend class QmlMetaPropertyPrivate;
- friend class QmlVME;
-
- QObject *m_object;
- QmlAbstractBinding **m_mePtr;
- QmlAbstractBinding **m_prevBinding;
- QmlAbstractBinding *m_nextBinding;
-};
-
-class QmlContext;
-class QmlBindingPrivate;
-class Q_DECLARATIVE_EXPORT QmlBinding : public QmlExpression,
- public QmlAbstractBinding
-{
-Q_OBJECT
-public:
- QmlBinding(const QString &, QObject *, QmlContext *, QObject *parent=0);
- QmlBinding(void *, QmlRefCount *, QObject *, QmlContext *, const QString &, int,
- QObject *parent);
- ~QmlBinding();
-
- void setTarget(const QmlMetaProperty &);
- QmlMetaProperty property() const;
-
- bool enabled() const;
-
- // Inherited from QmlAbstractBinding
- virtual void setEnabled(bool, QmlMetaProperty::WriteFlags flags);
- virtual int propertyIndex();
- virtual void update(QmlMetaProperty::WriteFlags flags);
- virtual QString expression() const;
-
-public Q_SLOTS:
- void update() { update(QmlMetaProperty::DontRemoveBinding); }
-
-protected:
- void emitValueChanged();
-
-private:
- Q_DECLARE_PRIVATE(QmlBinding)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QmlBinding);
-
-QT_END_HEADER
-
-#endif // QMLBINDING_H
diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h
deleted file mode 100644
index 744d397..0000000
--- a/src/declarative/qml/qmlcompiler_p.h
+++ /dev/null
@@ -1,337 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 QMLCOMPILER_P_H
-#define QMLCOMPILER_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 "qml.h"
-#include "qmlerror.h"
-#include "qmlinstruction_p.h"
-#include "qmlcompositetypemanager_p.h"
-#include "qmlparser_p.h"
-#include "qmlengine_p.h"
-#include "qbitfield_p.h"
-#include "qmlpropertycache_p.h"
-#include "qmlintegercache_p.h"
-#include "qmltypenamecache_p.h"
-
-#include <QtCore/qbytearray.h>
-#include <QtCore/qset.h>
-
-QT_BEGIN_NAMESPACE
-
-class QmlEngine;
-class QmlComponent;
-class QmlContext;
-
-class QScriptProgram;
-class Q_AUTOTEST_EXPORT QmlCompiledData : public QmlRefCount, public QmlCleanup
-{
-public:
- QmlCompiledData(QmlEngine *engine);
- virtual ~QmlCompiledData();
-
- QString name;
- QUrl url;
- QmlEnginePrivate::Imports imports;
- QmlTypeNameCache *importCache;
-
- struct TypeReference
- {
- TypeReference()
- : type(0), component(0), ref(0) {}
-
- QByteArray className;
- QmlType *type;
- QmlComponent *component;
-
- QmlRefCount *ref;
- QObject *createInstance(QmlContext *, const QBitField &) const;
- const QMetaObject *metaObject() const;
- };
- QList<TypeReference> types;
- struct CustomTypeData
- {
- int index;
- int type;
- };
-
- const QMetaObject *root;
- QAbstractDynamicMetaObject rootData;
- QmlPropertyCache *rootPropertyCache;
- QList<QString> primitives;
- QList<float> floatData;
- QList<int> intData;
- QList<CustomTypeData> customTypeData;
- QList<QByteArray> datas;
- QList<QmlParser::Location> locations;
- QList<QmlInstruction> bytecode;
- QList<QScriptProgram *> cachedPrograms;
- QList<QScriptValue *> cachedClosures;
- QList<QmlPropertyCache *> propertyCaches;
- QList<QmlIntegerCache *> contextCaches;
- QList<QmlParser::Object::ScriptBlock> scripts;
- QList<QUrl> urls;
-
- void dumpInstructions();
-
-protected:
- virtual void clear(); // From QmlCleanup
-
-private:
- void dump(QmlInstruction *, int idx = -1);
- QmlCompiledData(const QmlCompiledData &other);
- QmlCompiledData &operator=(const QmlCompiledData &other);
- QByteArray packData;
- friend class QmlCompiler;
- int pack(const char *, size_t);
-
- int indexForString(const QString &);
- int indexForByteArray(const QByteArray &);
- int indexForFloat(float *, int);
- int indexForInt(int *, int);
- int indexForLocation(const QmlParser::Location &);
- int indexForLocation(const QmlParser::LocationSpan &);
- int indexForUrl(const QUrl &);
-};
-
-class QMetaObjectBuilder;
-class Q_DECLARATIVE_EXPORT QmlCompiler
-{
-public:
- QmlCompiler();
-
- bool compile(QmlEngine *, QmlCompositeTypeData *, QmlCompiledData *);
-
- bool isError() const;
- QList<QmlError> errors() const;
-
- static bool isValidId(const QString &);
- static bool isAttachedPropertyName(const QByteArray &);
- static bool isSignalPropertyName(const QByteArray &);
-
-private:
- static void reset(QmlCompiledData *);
-
- struct BindingContext {
- BindingContext()
- : stack(0), owner(0), object(0) {}
- BindingContext(QmlParser::Object *o)
- : stack(0), owner(0), object(o) {}
- BindingContext incr() const {
- BindingContext rv(object);
- rv.stack = stack + 1;
- return rv;
- }
- bool isSubContext() const { return stack != 0; }
- int stack;
- int owner;
- QmlParser::Object *object;
- };
-
- void compileTree(QmlParser::Object *tree);
-
-
- bool buildObject(QmlParser::Object *obj, const BindingContext &);
- bool buildScript(QmlParser::Object *obj, QmlParser::Object *script);
- bool buildComponent(QmlParser::Object *obj, const BindingContext &);
- bool buildSubObject(QmlParser::Object *obj, const BindingContext &);
- bool buildSignal(QmlParser::Property *prop, QmlParser::Object *obj,
- const BindingContext &);
- bool buildProperty(QmlParser::Property *prop, QmlParser::Object *obj,
- const BindingContext &);
- bool buildPropertyInNamespace(QmlEnginePrivate::ImportedNamespace *ns,
- QmlParser::Property *prop,
- QmlParser::Object *obj,
- const BindingContext &);
- bool buildIdProperty(QmlParser::Property *prop, QmlParser::Object *obj);
- bool buildAttachedProperty(QmlParser::Property *prop,
- QmlParser::Object *obj,
- const BindingContext &ctxt);
- bool buildGroupedProperty(QmlParser::Property *prop,
- QmlParser::Object *obj,
- const BindingContext &ctxt);
- bool buildValueTypeProperty(QObject *type,
- QmlParser::Object *obj,
- QmlParser::Object *baseObj,
- const BindingContext &ctxt);
- bool buildListProperty(QmlParser::Property *prop,
- QmlParser::Object *obj,
- const BindingContext &ctxt);
- bool buildScriptStringProperty(QmlParser::Property *prop,
- QmlParser::Object *obj,
- const BindingContext &ctxt);
- bool buildPropertyAssignment(QmlParser::Property *prop,
- QmlParser::Object *obj,
- const BindingContext &ctxt);
- bool buildPropertyObjectAssignment(QmlParser::Property *prop,
- QmlParser::Object *obj,
- QmlParser::Value *value,
- const BindingContext &ctxt);
- bool buildPropertyLiteralAssignment(QmlParser::Property *prop,
- QmlParser::Object *obj,
- QmlParser::Value *value,
- const BindingContext &ctxt);
- bool doesPropertyExist(QmlParser::Property *prop, QmlParser::Object *obj);
- bool testLiteralAssignment(const QMetaProperty &prop,
- QmlParser::Value *value);
- bool testQualifiedEnumAssignment(const QMetaProperty &prop,
- QmlParser::Object *obj,
- QmlParser::Value *value,
- bool *isAssignment);
- enum DynamicMetaMode { IgnoreAliases, ResolveAliases, ForceCreation };
- bool mergeDynamicMetaProperties(QmlParser::Object *obj);
- bool buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode);
- bool checkDynamicMeta(QmlParser::Object *obj);
- bool buildBinding(QmlParser::Value *, QmlParser::Property *prop,
- const BindingContext &ctxt);
- bool buildComponentFromRoot(QmlParser::Object *obj, const BindingContext &);
- bool compileAlias(QMetaObjectBuilder &,
- QByteArray &data,
- QmlParser::Object *obj,
- const QmlParser::Object::DynamicProperty &);
- bool completeComponentBuild();
-
-
- void genObject(QmlParser::Object *obj);
- void genObjectBody(QmlParser::Object *obj);
- void genComponent(QmlParser::Object *obj);
- void genValueProperty(QmlParser::Property *prop, QmlParser::Object *obj);
- void genListProperty(QmlParser::Property *prop, QmlParser::Object *obj);
- void genPropertyAssignment(QmlParser::Property *prop,
- QmlParser::Object *obj,
- QmlParser::Property *valueTypeProperty = 0);
- void genLiteralAssignment(const QMetaProperty &prop,
- QmlParser::Value *value);
- void genBindingAssignment(QmlParser::Value *binding,
- QmlParser::Property *prop,
- QmlParser::Object *obj,
- QmlParser::Property *valueTypeProperty = 0);
- int genContextCache();
-
- int genValueTypeData(QmlParser::Property *prop, QmlParser::Property *valueTypeProp);
- int genPropertyData(QmlParser::Property *prop);
-
- int componentTypeRef();
-
- static int findSignalByName(const QMetaObject *, const QByteArray &name);
- static QmlType *toQmlType(QmlParser::Object *from);
- bool canCoerce(int to, QmlParser::Object *from);
- bool canCoerce(int to, int from);
-
- QStringList deferredProperties(QmlParser::Object *);
-
- void addId(const QString &, QmlParser::Object *);
-
- void dumpStats();
-
- struct BindingReference {
- QmlParser::Variant expression;
- QmlParser::Property *property;
- QmlParser::Value *value;
-
- enum DataType { QtScript, Experimental };
- DataType dataType;
-
- int compiledIndex;
-
- QByteArray compiledData;
- BindingContext bindingContext;
- };
- void addBindingReference(const BindingReference &);
-
- struct ComponentCompileState
- {
- ComponentCompileState()
- : parserStatusCount(0), pushedProperties(0), root(0) {}
- QHash<QString, QmlParser::Object *> ids;
- QHash<int, QmlParser::Object *> idIndexes;
- int parserStatusCount;
- int pushedProperties;
-
- QByteArray compiledBindingData;
-
- QHash<QmlParser::Value *, BindingReference> bindings;
- QList<QmlParser::Object *> aliasingObjects;
- QmlParser::Object *root;
- };
- ComponentCompileState compileState;
-
- struct ComponentStat
- {
- ComponentStat()
- : ids(0), scriptBindings(0), optimizedBindings(0), objects(0) {}
-
- int lineNumber;
-
- int ids;
- int scriptBindings;
- int optimizedBindings;
- int objects;
- };
- ComponentStat componentStat;
-
- void saveComponentState();
-
- ComponentCompileState componentState(QmlParser::Object *);
- QHash<QmlParser::Object *, ComponentCompileState> savedCompileStates;
- QList<ComponentStat> savedComponentStats;
-
- QList<QmlError> exceptions;
- QmlCompiledData *output;
- QmlEngine *engine;
- QmlParser::Object *unitRoot;
- QmlCompositeTypeData *unit;
-};
-QT_END_NAMESPACE
-
-#endif // QMLCOMPILER_P_H
diff --git a/src/declarative/qml/qmldom_p.h b/src/declarative/qml/qmldom_p.h
deleted file mode 100644
index 8c7288e..0000000
--- a/src/declarative/qml/qmldom_p.h
+++ /dev/null
@@ -1,360 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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_H
-#define QMLDOM_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 "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_P_H
diff --git a/src/declarative/qml/qmlinfo.h b/src/declarative/qml/qmlinfo.h
deleted file mode 100644
index 379f211..0000000
--- a/src/declarative/qml/qmlinfo.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 QMLINFO_H
-#define QMLINFO_H
-
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class Q_DECLARATIVE_EXPORT QmlInfo : public QDebug
-{
-public:
- QmlInfo(const QObject *);
- ~QmlInfo();
-
- inline QmlInfo &operator<<(QChar t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(QBool t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(bool t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(char t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(signed short t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(unsigned short t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(signed int t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(unsigned int t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(signed long t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(unsigned long t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(qint64 t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(quint64 t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(float t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(double t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(const char* t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(const QString & t) { QDebug::operator<<(t.toLocal8Bit().constData()); return *this; }
- inline QmlInfo &operator<<(const QStringRef & t) { return operator<<(t.toString()); }
- inline QmlInfo &operator<<(const QLatin1String &t) { QDebug::operator<<(t.latin1()); return *this; }
- inline QmlInfo &operator<<(const QByteArray & t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(const void * t) { QDebug::operator<<(t); return *this; }
- inline QmlInfo &operator<<(QTextStreamFunction f) { QDebug::operator<<(f); return *this; }
- inline QmlInfo &operator<<(QTextStreamManipulator m) { QDebug::operator<<(m); return *this; }
-};
-
-Q_DECLARATIVE_EXPORT inline QmlInfo qmlInfo(const QObject *me)
-{
- return QmlInfo(me);
-}
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMLINFO_H
diff --git a/src/declarative/qml/qmllist.cpp b/src/declarative/qml/qmllist.cpp
deleted file mode 100644
index 4cd2120..0000000
--- a/src/declarative/qml/qmllist.cpp
+++ /dev/null
@@ -1,312 +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$
-**
-****************************************************************************/
-
-#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/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
deleted file mode 100644
index 7c273dc..0000000
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ /dev/null
@@ -1,1230 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 "qmlmetaproperty.h"
-#include "qmlmetaproperty_p.h"
-
-#include "qmlcompositetypedata_p.h"
-#include "qml.h"
-#include "qmlbinding.h"
-#include "qmlcontext.h"
-#include "qmlcontext_p.h"
-#include "qmlboundsignal_p.h"
-#include "qmlengine.h"
-#include "qmlengine_p.h"
-#include "qmldeclarativedata_p.h"
-#include "qmlstringconverters_p.h"
-#include "qmllist_p.h"
-
-#include <QStringList>
-#include <QtCore/qdebug.h>
-
-#include <math.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QmlMetaProperty
- \brief The QmlMetaProperty class abstracts accessing QML properties.
- \internal
- */
-
-/*!
- Create an invalid QmlMetaProperty.
-*/
-QmlMetaProperty::QmlMetaProperty()
-: d(new QmlMetaPropertyPrivate)
-{
- d->q = this;
-}
-
-/*! \internal */
-QmlMetaProperty::~QmlMetaProperty()
-{
- delete d; d = 0;
-}
-
-/*!
- Creates a QmlMetaProperty for the default property of \a obj. If there is no
- default property, an invalid QmlMetaProperty will be created.
- */
-QmlMetaProperty::QmlMetaProperty(QObject *obj)
-: d(new QmlMetaPropertyPrivate)
-{
- d->q = this;
- d->initDefault(obj);
-}
-
-/*!
- \internal
- Creates a QmlMetaProperty for the default property of \a obj. If there is no
- default property, an invalid QmlMetaProperty will be created.
- */
-QmlMetaProperty::QmlMetaProperty(QObject *obj, QmlContext *ctxt)
-: d(new QmlMetaPropertyPrivate)
-{
- d->q = this;
- d->context = ctxt;
- d->initDefault(obj);
-}
-
-/*!
- Initialize from the default property of \a obj
-*/
-void QmlMetaPropertyPrivate::initDefault(QObject *obj)
-{
- if (!obj)
- return;
-
- QMetaProperty p = QmlMetaType::defaultProperty(obj);
- core.load(p);
- if (core.isValid()) {
- isDefaultProperty = true;
- object = obj;
- }
-}
-
-/*!
- Creates a QmlMetaProperty for the property \a name of \a obj.
- */
-QmlMetaProperty::QmlMetaProperty(QObject *obj, const QString &name)
-: d(new QmlMetaPropertyPrivate)
-{
- d->q = this;
- d->initProperty(obj, name);
- if (!isValid()) d->object = 0;
-}
-
-/*!
- \internal
- Creates a QmlMetaProperty for the property \a name of \a obj.
- */
-QmlMetaProperty::QmlMetaProperty(QObject *obj, const QString &name, QmlContext *ctxt)
-: d(new QmlMetaPropertyPrivate)
-{
- d->q = this;
- d->context = ctxt;
- d->initProperty(obj, name);
- if (!isValid()) { d->object = 0; d->context = 0; }
-}
-
-void QmlMetaPropertyPrivate::initProperty(QObject *obj, const QString &name)
-{
- QmlEnginePrivate *enginePrivate = 0;
- if (context && context->engine())
- enginePrivate = QmlEnginePrivate::get(context->engine());
-
- object = obj;
-
- if (name.isEmpty() || !obj)
- return;
-
- if (enginePrivate && name.at(0).isUpper()) {
- // Attached property
- // ### What about qualified types?
- QmlTypeNameCache *tnCache = QmlContextPrivate::get(context)->imports;
- if (tnCache) {
- QmlTypeNameCache::Data *d = tnCache->data(name);
- if (d && d->type && d->type->attachedPropertiesFunction()) {
- attachedFunc = d->type->index();
- }
- }
- return;
-
- } else if (name.count() >= 3 &&
- name.at(0) == QChar(QLatin1Char('o')) &&
- name.at(1) == QChar(QLatin1Char('n')) &&
- name.at(2).isUpper()) {
- // Signal
- QString signalName = name.mid(2);
- signalName[0] = signalName.at(0).toLower();
-
- QMetaMethod method = findSignal(obj, signalName);
- if (method.signature()) {
- core.load(method);
- return;
- }
- }
-
- // Property
- QmlPropertyCache::Data local;
- QmlPropertyCache::Data *property =
- QmlPropertyCache::property(context?context->engine():0, obj, name, local);
- if (property && !(property->flags & QmlPropertyCache::Data::IsFunction))
- core = *property;
-}
-
-/*!
- Create a copy of \a other.
-*/
-QmlMetaProperty::QmlMetaProperty(const QmlMetaProperty &other)
-: d(new QmlMetaPropertyPrivate(*other.d))
-{
- d->q = this;
-}
-
-/*!
- \enum QmlMetaProperty::PropertyCategory
-
- This enum specifies a category of QML property.
-
- \value Unknown The category is unknown. This will never be returned from propertyCategory()
- \value InvalidProperty The property is invalid.
- \value Bindable The property is a QmlBinding.
- \value List The property is a QList pointer
- \value Object The property is a QObject derived type pointer
- \value Normal The property is none of the above.
- */
-
-/*!
- \enum QmlMetaProperty::Type
-
- This enum specifies a type of QML property.
-
- \value Invalid The property is invalid.
- \value Property The property is a regular Qt property.
- \value SignalProperty The property is a signal property.
- \value Default The property is the default property.
- \value Attached The property is an attached property.
-*/
-
-/*!
- Returns the property category.
-*/
-QmlMetaProperty::PropertyCategory QmlMetaProperty::propertyCategory() const
-{
- return d->propertyCategory();
-}
-
-QmlMetaProperty::PropertyCategory
-QmlMetaPropertyPrivate::propertyCategory() const
-{
- uint type = q->type();
-
- if (type & QmlMetaProperty::ValueTypeProperty) {
- return QmlMetaProperty::Normal;
- } else if (type & QmlMetaProperty::Attached) {
- return QmlMetaProperty::Object;
- } else if (type & QmlMetaProperty::Property) {
- int type = propertyType();
- if (type == QVariant::Invalid)
- return QmlMetaProperty::InvalidProperty;
- else if ((uint)type < QVariant::UserType)
- return QmlMetaProperty::Normal;
- else if (type == qMetaTypeId<QmlBinding *>())
- return QmlMetaProperty::Bindable;
- else if (core.flags & QmlPropertyCache::Data::IsQObjectDerived)
- return QmlMetaProperty::Object;
- else if (core.flags & QmlPropertyCache::Data::IsQList)
- return QmlMetaProperty::List;
- else
- return QmlMetaProperty::Normal;
- } else {
- return QmlMetaProperty::InvalidProperty;
- }
-}
-
-/*!
- Returns the type name of the property, or 0 if the property has no type
- name.
-*/
-const char *QmlMetaProperty::propertyTypeName() const
-{
- if (type() & ValueTypeProperty) {
-
- QmlEnginePrivate *ep = QmlEnginePrivate::get(d->context);
- QmlValueType *valueType = 0;
- if (ep) valueType = ep->valueTypes[d->core.propType];
- else valueType = QmlValueTypeFactory::valueType(d->core.propType);
- Q_ASSERT(valueType);
-
- const char *rv = valueType->metaObject()->property(d->valueType.valueTypeCoreIdx).typeName();
-
- if (!ep) delete valueType;
-
- return rv;
- } else if (d->object && type() & Property && d->core.isValid()) {
- return d->object->metaObject()->property(d->core.coreIndex).typeName();
- } else {
- return 0;
- }
-}
-
-/*!
- Returns true if \a other and this QmlMetaProperty represent the same
- property.
-*/
-bool QmlMetaProperty::operator==(const QmlMetaProperty &other) const
-{
- // category is intentially omitted here as it is generated
- // from the other members
- return d->object == other.d->object &&
- d->core == other.d->core &&
- d->valueType == other.d->valueType &&
- d->attachedFunc == other.d->attachedFunc;
-}
-
-/*!
- Returns the QVariant type of the property, or QVariant::Invalid if the
- property has no QVariant type.
-*/
-int QmlMetaProperty::propertyType() const
-{
- return d->propertyType();
-}
-
-int QmlMetaPropertyPrivate::propertyType() const
-{
- uint type = q->type();
- if (type & QmlMetaProperty::ValueTypeProperty) {
- return valueType.valueTypePropType;
- } else if (type & QmlMetaProperty::Attached) {
- return qMetaTypeId<QObject *>();
- } else if (type & QmlMetaProperty::Property) {
- if (core.propType == (int)QVariant::LastType)
- return qMetaTypeId<QVariant>();
- else
- return core.propType;
- } else {
- return QVariant::Invalid;
- }
-}
-
-/*!
- Returns the type of the property.
-*/
-QmlMetaProperty::Type QmlMetaProperty::type() const
-{
- if (d->core.flags & QmlPropertyCache::Data::IsFunction)
- return SignalProperty;
- else if (d->attachedFunc != -1)
- return Attached;
- else if (d->valueType.valueTypeCoreIdx != -1)
- return (Type)(Property | ValueTypeProperty);
- else if (d->core.isValid())
- return (Type)(Property | ((d->isDefaultProperty)?Default:0));
- else
- return Invalid;
-}
-
-/*!
- Returns true if this QmlMetaProperty represents a regular Qt property.
-*/
-bool QmlMetaProperty::isProperty() const
-{
- return type() & Property;
-}
-
-/*!
- Returns true if this QmlMetaProperty represents a default property.
-*/
-bool QmlMetaProperty::isDefault() const
-{
- return type() & Default;
-}
-
-/*!
- Returns the QmlMetaProperty's QObject.
-*/
-QObject *QmlMetaProperty::object() const
-{
- return d->object;
-}
-
-/*!
- Assign \a other to this QmlMetaProperty.
-*/
-QmlMetaProperty &QmlMetaProperty::operator=(const QmlMetaProperty &other)
-{
- d->context = other.d->context;
- d->object = other.d->object;
-
- d->isDefaultProperty = other.d->isDefaultProperty;
- d->core = other.d->core;
-
- d->valueType = other.d->valueType;
-
- d->attachedFunc = other.d->attachedFunc;
- return *this;
-}
-
-/*!
- Returns true if the property is writable, otherwise false.
-*/
-bool QmlMetaProperty::isWritable() const
-{
- QmlMetaProperty::PropertyCategory category = propertyCategory();
-
- if (!d->object)
- return false;
- if (category == List)
- return true;
- else if (type() & SignalProperty)
- return false;
- else if (d->core.isValid() && d->object)
- return d->core.flags & QmlPropertyCache::Data::IsWritable;
- else
- return false;
-}
-
-/*!
- Returns true if the property is designable, otherwise false.
-*/
-bool QmlMetaProperty::isDesignable() const
-{
- if (type() & Property && d->core.isValid() && d->object)
- return d->object->metaObject()->property(d->core.coreIndex).isDesignable();
- else
- return false;
-}
-
-/*!
- Returns true if the property is resettable, otherwise false.
-*/
-bool QmlMetaProperty::isResettable() const
-{
- if (type() & Property && d->core.isValid() && d->object)
- return d->core.flags & QmlPropertyCache::Data::IsResettable;
- else
- return false;
-}
-
-/*!
- Returns true if the QmlMetaProperty refers to a valid property, otherwise
- false.
-*/
-bool QmlMetaProperty::isValid() const
-{
- return type() != Invalid;
-}
-
-/*!
- Return the name of this QML property.
-*/
-QString QmlMetaProperty::name() const
-{
- if (!d->isNameCached) {
- // ###
- if (!d->object) {
- } else if (type() & ValueTypeProperty) {
- QString rv = d->core.name(d->object) + QLatin1Char('.');
-
- QmlEnginePrivate *ep = d->context?QmlEnginePrivate::get(d->context->engine()):0;
- QmlValueType *valueType = 0;
- if (ep) valueType = ep->valueTypes[d->core.propType];
- else valueType = QmlValueTypeFactory::valueType(d->core.propType);
- Q_ASSERT(valueType);
-
- rv += QString::fromUtf8(valueType->metaObject()->property(d->valueType.valueTypeCoreIdx).name());
-
- if (!ep) delete valueType;
-
- d->nameCache = rv;
- } else if (type() & SignalProperty) {
- QString name = QLatin1String("on") + d->core.name(d->object);
- name[2] = name.at(2).toUpper();
- d->nameCache = name;
- } else {
- d->nameCache = d->core.name(d->object);
- }
- d->isNameCached = true;
- }
-
- return d->nameCache;
-}
-
-/*!
- Returns the \l{QMetaProperty} {Qt property} associated with
- this QML property.
- */
-QMetaProperty QmlMetaProperty::property() const
-{
- if (type() & Property && d->core.isValid() && d->object)
- return d->object->metaObject()->property(d->core.coreIndex);
- else
- return QMetaProperty();
-}
-
-/*!
- Return the QMetaMethod for this property if it is a SignalProperty,
- otherwise returns an invalid QMetaMethod.
-*/
-QMetaMethod QmlMetaProperty::method() const
-{
- if (type() & SignalProperty && d->object)
- return d->object->metaObject()->method(d->core.coreIndex);
- else
- return QMetaMethod();
-}
-
-
-/*!
- Returns the binding associated with this property, or 0 if no binding
- exists.
-*/
-QmlAbstractBinding *QmlMetaProperty::binding() const
-{
- if (!isProperty() || (type() & Attached) || !d->object)
- return 0;
-
- QmlDeclarativeData *data = QmlDeclarativeData::get(d->object);
- if (!data)
- return 0;
-
- if (!data->hasBindingBit(d->core.coreIndex))
- return 0;
-
- QmlAbstractBinding *binding = data->bindings;
- while (binding) {
- // ### This wont work for value types
- if (binding->propertyIndex() == d->core.coreIndex)
- return binding;
- binding = binding->m_nextBinding;
- }
- return 0;
-}
-
-/*!
- Set the binding associated with this property to \a newBinding. Returns
- the existing binding (if any), otherwise 0.
-
- \a newBinding will be enabled, and the returned binding (if any) will be
- disabled.
-
- Ownership of \a newBinding transfers to QML. Ownership of the return value
- is assumed by the caller.
-
- \a flags is passed through to the binding and is used for the initial update (when
- the binding sets the intial value, it will use these flags for the write).
-*/
-QmlAbstractBinding *
-QmlMetaProperty::setBinding(QmlAbstractBinding *newBinding, QmlMetaProperty::WriteFlags flags) const
-{
- if (!isProperty() || (type() & Attached) || !d->object) {
- if (newBinding)
- newBinding->destroy();
- return 0;
- }
-
- return d->setBinding(d->object, d->core, newBinding, flags);
-}
-
-QmlAbstractBinding *
-QmlMetaPropertyPrivate::setBinding(QObject *object, const QmlPropertyCache::Data &core,
- QmlAbstractBinding *newBinding, QmlMetaProperty::WriteFlags flags)
-{
- QmlDeclarativeData *data = QmlDeclarativeData::get(object, 0 != newBinding);
-
- if (data && data->hasBindingBit(core.coreIndex)) {
- QmlAbstractBinding *binding = data->bindings;
- while (binding) {
- // ### This wont work for value types
- if (binding->propertyIndex() == core.coreIndex) {
- binding->setEnabled(false);
-
- if (newBinding)
- newBinding->setEnabled(true, flags);
-
- return binding; // ### QmlAbstractBinding;
- }
-
- binding = binding->m_nextBinding;
- }
- }
-
- if (newBinding)
- newBinding->setEnabled(true, flags);
-
- return 0;
-}
-/*!
- Returns the expression associated with this signal property, or 0 if no
- signal expression exists.
-*/
-QmlExpression *QmlMetaProperty::signalExpression() const
-{
- if (!(type() & SignalProperty))
- return 0;
-
- const QObjectList &children = d->object->children();
-
- for (int ii = 0; ii < children.count(); ++ii) {
- QObject *child = children.at(ii);
-
- QmlBoundSignal *signal = QmlBoundSignal::cast(child);
- if (signal && signal->index() == coreIndex())
- return signal->expression();
- }
-
- return 0;
-}
-
-/*!
- Set the signal expression associated with this signal property to \a expr.
- Returns the existing signal expression (if any), otherwise 0.
-
- Ownership of \a expr transfers to QML. Ownership of the return value is
- assumed by the caller.
-*/
-QmlExpression *QmlMetaProperty::setSignalExpression(QmlExpression *expr) const
-{
- if (!(type() & SignalProperty)) {
- delete expr;
- return 0;
- }
-
- const QObjectList &children = d->object->children();
-
- for (int ii = 0; ii < children.count(); ++ii) {
- QObject *child = children.at(ii);
-
- QmlBoundSignal *signal = QmlBoundSignal::cast(child);
- if (signal && signal->index() == coreIndex())
- return signal->setExpression(expr);
- }
-
- if (expr) {
- QmlBoundSignal *signal = new QmlBoundSignal(d->object, method(), d->object);
- return signal->setExpression(expr);
- } else {
- return 0;
- }
-}
-
-QMetaMethod QmlMetaPropertyPrivate::findSignal(QObject *obj, const QString &name)
-{
- const QMetaObject *mo = obj->metaObject();
-
- int methods = mo->methodCount();
- for (int ii = methods - 1; ii >= 0; --ii) {
- QMetaMethod method = mo->method(ii);
- QString methodName = QString::fromUtf8(method.signature());
- int idx = methodName.indexOf(QLatin1Char('('));
- methodName = methodName.left(idx);
-
- if (methodName == name)
- return method;
- }
- return QMetaMethod();
-}
-
-QObject *QmlMetaPropertyPrivate::attachedObject() const
-{
- if (attachedFunc == -1)
- return 0;
- else
- return qmlAttachedPropertiesObjectById(attachedFunc, object);
-}
-
-/*!
- Returns the property value.
-*/
-QVariant QmlMetaProperty::read() const
-{
- if (!d->object)
- return QVariant();
-
- if (type() & SignalProperty) {
-
- return QVariant();
-
- } else if (type() & Property || type() & Attached) {
-
- return d->readValueProperty();
-
- }
- return QVariant();
-}
-
-QVariant QmlMetaPropertyPrivate::readValueProperty()
-{
- uint type = q->type();
- if (type & QmlMetaProperty::Attached) {
-
- return QVariant::fromValue(attachedObject());
-
- } else if(type & QmlMetaProperty::ValueTypeProperty) {
-
- QmlEnginePrivate *ep = QmlEnginePrivate::get(context);
- QmlValueType *valueType = 0;
- if (ep) valueType = ep->valueTypes[core.propType];
- else valueType = QmlValueTypeFactory::valueType(core.propType);
- Q_ASSERT(valueType);
-
- valueType->read(object, core.coreIndex);
-
- QVariant rv =
- valueType->metaObject()->property(this->valueType.valueTypeCoreIdx).read(valueType);
-
- 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());
-
- }
-}
-
-//###
-//writeEnumProperty MIRRORS the relelvant bit of QMetaProperty::write AND MUST BE KEPT IN SYNC!
-//###
-bool QmlMetaPropertyPrivate::writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object, const QVariant &value, int flags)
-{
- if (!object || !prop.isWritable())
- return false;
-
- QVariant v = value;
- if (prop.isEnumType()) {
- QMetaEnum menum = prop.enumerator();
- if (v.userType() == QVariant::String
-#ifdef QT3_SUPPORT
- || v.userType() == QVariant::CString
-#endif
- ) {
- if (prop.isFlagType())
- v = QVariant(menum.keysToValue(value.toByteArray()));
- else
- v = QVariant(menum.keyToValue(value.toByteArray()));
- } else if (v.userType() != QVariant::Int && v.userType() != QVariant::UInt) {
- int enumMetaTypeId = QMetaType::type(QByteArray(menum.scope()) + "::" + menum.name());
- if ((enumMetaTypeId == 0) || (v.userType() != enumMetaTypeId) || !v.constData())
- return false;
- v = QVariant(*reinterpret_cast<const int *>(v.constData()));
- }
- v.convert(QVariant::Int);
- }
-
- // the status variable is changed by qt_metacall to indicate what it did
- // this feature is currently only used by QtDBus and should not be depended
- // upon. Don't change it without looking into QDBusAbstractInterface first
- // -1 (unchanged): normal qt_metacall, result stored in argv[0]
- // changed: result stored directly in value, return the value of status
- int status = -1;
- void *argv[] = { v.data(), &v, &status, &flags };
- QMetaObject::metacall(object, QMetaObject::WriteProperty, idx, argv);
- return status;
-}
-
-bool QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value,
- QmlMetaProperty::WriteFlags flags)
-{
- // Remove any existing bindings on this property
- if (!(flags & QmlMetaProperty::DontRemoveBinding)) {
- QmlAbstractBinding *binding = q->setBinding(0);
- if (binding) binding->destroy();
- }
-
- bool rv = false;
- uint type = q->type();
- if (type & QmlMetaProperty::ValueTypeProperty) {
- QmlEnginePrivate *ep = QmlEnginePrivate::get(context);
-
- QmlValueType *writeBack = 0;
- if (ep) {
- writeBack = ep->valueTypes[core.propType];
- } else {
- writeBack = QmlValueTypeFactory::valueType(core.propType);
- }
-
- writeBack->read(object, core.coreIndex);
-
- QmlPropertyCache::Data data = core;
- data.coreIndex = valueType.valueTypeCoreIdx;
- data.propType = valueType.valueTypePropType;
- rv = write(writeBack, data, value, context, flags);
-
- writeBack->write(object, core.coreIndex, flags);
- if (!ep) delete writeBack;
-
- } else {
-
- rv = write(object, core, value, context, flags);
-
- }
-
- return rv;
-}
-
-bool QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data &property,
- const QVariant &value, QmlContext *context,
- QmlMetaProperty::WriteFlags flags)
-{
- int coreIdx = property.coreIndex;
- int status = -1; //for dbus
-
- if (property.flags & QmlPropertyCache::Data::IsEnumType) {
- QMetaProperty prop = object->metaObject()->property(property.coreIndex);
- QVariant v = value;
- // Enum values come through the script engine as doubles
- if (value.userType() == QVariant::Double) {
- double integral;
- double fractional = modf(value.toDouble(), &integral);
- if (qFuzzyIsNull(fractional))
- v.convert(QVariant::Int);
- }
- return writeEnumProperty(prop, coreIdx, object, v, flags);
- }
-
- int t = property.propType;
- int vt = value.userType();
-
- QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(context);
-
- if (t == QVariant::Url) {
-
- QUrl u;
- bool found = false;
- if (vt == QVariant::Url) {
- u = value.toUrl();
- found = true;
- } else if (vt == QVariant::ByteArray) {
- u = QUrl(QString::fromUtf8(value.toByteArray()));
- found = true;
- } else if (vt == QVariant::String) {
- u = QUrl(value.toString());
- found = true;
- }
-
- if (!found)
- return false;
-
- if (context && u.isRelative() && !u.isEmpty())
- u = context->resolvedUrl(u);
- int status = -1;
- void *argv[] = { &u, 0, &status, &flags };
- QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, argv);
-
- } else if (vt == t) {
-
- void *a[] = { (void *)value.constData(), 0, &status, &flags };
- QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
-
- } else if (qMetaTypeId<QVariant>() == t) {
-
- void *a[] = { (void *)&value, 0, &status, &flags };
- QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
-
- } else if (property.flags & QmlPropertyCache::Data::IsQObjectDerived) {
-
- const QMetaObject *valMo = rawMetaObjectForType(enginePriv, value.userType());
-
- if (!valMo)
- return false;
-
- QObject *o = *(QObject **)value.constData();
- const QMetaObject *propMo = rawMetaObjectForType(enginePriv, t);
-
- if (o) valMo = o->metaObject();
-
- if (canConvert(valMo, propMo)) {
- void *args[] = { &o, 0, &status, &flags };
- QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx,
- args);
- } else if (!o && canConvert(propMo, valMo)) {
- // In the case of a null QObject, we assign the null if there is
- // any change that the null variant type could be up or down cast to
- // the property type.
- void *args[] = { &o, 0, &status, &flags };
- QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx,
- args);
- } else {
- return false;
- }
-
- } else if (property.flags & QmlPropertyCache::Data::IsQList) {
-
- 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);
-
- for (int ii = 0; ii < list.count(); ++ii) {
- QObject *o = list.at(ii);
- if (!canConvert(o->metaObject(), listType))
- o = 0;
- prop.append(&prop, (void *)o);
- }
- } else {
- QObject *o = enginePriv?enginePriv->toQObject(value):QmlMetaType::toQObject(value);
- if (!canConvert(o->metaObject(), listType))
- o = 0;
- prop.append(&prop, (void *)o);
- }
-
- } else {
- Q_ASSERT(vt != t);
-
- QVariant v = value;
- if (v.convert((QVariant::Type)t)) {
- 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);
- if (!con)
- return false;
-
- QVariant v = con(value.toString());
- if (v.userType() == t) {
- void *a[] = { (void *)v.constData(), 0, &status, &flags};
- QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
- }
- } else if (vt == QVariant::String) {
- bool ok = false;
- QVariant v = QmlStringConverters::variantFromString(value.toString(), t, &ok);
- if (!ok)
- return false;
-
- void *a[] = { (void *)v.constData(), 0, &status, &flags};
- QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
- } else {
- return false;
- }
- }
-
- return true;
-}
-
-const QMetaObject *QmlMetaPropertyPrivate::rawMetaObjectForType(QmlEnginePrivate *engine, int userType)
-{
- if (engine) {
- return engine->rawMetaObjectForType(userType);
- } else {
- QmlType *type = QmlMetaType::qmlType(userType);
- return type?type->baseMetaObject():0;
- }
-}
-
-/*!
- Set the property value to \a value.
-*/
-bool QmlMetaProperty::write(const QVariant &value) const
-{
- return write(value, 0);
-}
-
-/*!
- Resets the property value.
-*/
-bool QmlMetaProperty::reset() const
-{
- if (isResettable()) {
- void *args[] = { 0 };
- QMetaObject::metacall(d->object, QMetaObject::ResetProperty, d->core.coreIndex, args);
- return true;
- } else {
- return false;
- }
-}
-
-bool QmlMetaProperty::write(const QVariant &value, QmlMetaProperty::WriteFlags flags) const
-{
- if (d->object && type() & Property && d->core.isValid() && isWritable())
- return d->writeValueProperty(value, flags);
- else
- return false;
-}
-
-/*!
- Returns true if the property has a change notifier signal, otherwise false.
-*/
-bool QmlMetaProperty::hasChangedNotifier() const
-{
- if (type() & Property && !(type() & Attached) && d->object) {
- return d->object->metaObject()->property(d->core.coreIndex).hasNotifySignal();
- }
- return false;
-}
-
-/*!
- Returns true if the property needs a change notifier signal for bindings
- to remain upto date, false otherwise.
-
- Some properties, such as attached properties or those whose value never
- changes, do not require a change notifier.
-*/
-bool QmlMetaProperty::needsChangedNotifier() const
-{
- return type() & Property && !(type() & Attached) &&
- !property().isConstant();
-}
-
-/*!
- Connects the property's change notifier signal to the
- specified \a method of the \a dest object and returns
- true. Returns false if this metaproperty does not
- represent a regular Qt property or if it has no
- change notifier signal, or if the \a dest object does
- not have the specified \a method.
-*/
-bool QmlMetaProperty::connectNotifier(QObject *dest, int method) const
-{
- if (!(type() & Property) || (type() & Attached) || !d->object)
- return false;
-
- QMetaProperty prop = d->object->metaObject()->property(d->core.coreIndex);
- if (prop.hasNotifySignal()) {
- return QMetaObject::connect(d->object, prop.notifySignalIndex(), dest, method, Qt::DirectConnection);
- } else {
- return false;
- }
-}
-
-/*!
- Connects the property's change notifier signal to the
- specified \a slot of the \a dest object and returns
- true. Returns false if this metaproperty does not
- represent a regular Qt property or if it has no
- change notifier signal, or if the \a dest object does
- not have the specified \a slot.
-*/
-bool QmlMetaProperty::connectNotifier(QObject *dest, const char *slot) const
-{
- if (!(type() & Property) || (type() & Attached) || !d->object)
- return false;
-
- QMetaProperty prop = d->object->metaObject()->property(d->core.coreIndex);
- if (prop.hasNotifySignal()) {
- QByteArray signal(QByteArray("2") + prop.notifySignal().signature());
- return QObject::connect(d->object, signal.constData(), dest, slot);
- } else {
- return false;
- }
-}
-
-/*!
- Return the Qt metaobject index of the property.
-*/
-int QmlMetaProperty::coreIndex() const
-{
- return d->core.coreIndex;
-}
-
-/*! \internal */
-int QmlMetaProperty::valueTypeCoreIndex() const
-{
- return d->valueType.valueTypeCoreIdx;
-}
-
-Q_GLOBAL_STATIC(QmlValueTypeFactory, qmlValueTypes);
-
-
-struct SerializedData {
- QmlMetaProperty::Type type;
- QmlPropertyCache::Data core;
-};
-
-struct ValueTypeSerializedData : public SerializedData {
- QmlPropertyCache::ValueTypeData valueType;
-};
-
-QByteArray QmlMetaPropertyPrivate::saveValueType(const QMetaObject *metaObject, int index,
- int subIndex, int subType)
-{
- ValueTypeSerializedData sd;
- sd.type = QmlMetaProperty::ValueTypeProperty;
- sd.core.load(metaObject->property(index));
- sd.valueType.valueTypeCoreIdx = subIndex;
- sd.valueType.valueTypePropType = subType;
-
- QByteArray rv((const char *)&sd, sizeof(sd));
- return rv;
-}
-
-QByteArray QmlMetaPropertyPrivate::saveProperty(const QMetaObject *metaObject, int index)
-{
- SerializedData sd;
- sd.type = QmlMetaProperty::Property;
- sd.core.load(metaObject->property(index));
-
- QByteArray rv((const char *)&sd, sizeof(sd));
- return rv;
-}
-
-QmlMetaProperty
-QmlMetaPropertyPrivate::restore(const QByteArray &data, QObject *object, QmlContext *ctxt)
-{
- QmlMetaProperty prop;
-
- if (data.isEmpty())
- return prop;
-
- prop.d->object = object;
- prop.d->context = ctxt;
-
- const SerializedData *sd = (const SerializedData *)data.constData();
- if (sd->type == QmlMetaProperty::Property) {
- prop.d->core = sd->core;
- } else if(sd->type == QmlMetaProperty::ValueTypeProperty) {
- const ValueTypeSerializedData *vt = (const ValueTypeSerializedData *)sd;
- prop.d->core = vt->core;
- prop.d->valueType = vt->valueType;
- }
-
- return prop;
-}
-
-/*!
- \internal
-
- Creates a QmlMetaProperty for the property \a name of \a obj. Unlike
- the QmlMetaProperty(QObject*, QString, QmlContext*) constructor, this static function
- will correctly handle dot properties, including value types and attached properties.
-*/
-QmlMetaProperty QmlMetaProperty::createProperty(QObject *obj,
- const QString &name,
- QmlContext *context)
-{
- QmlTypeNameCache *typeNameCache = context?QmlContextPrivate::get(context)->imports:0;
-
- QStringList path = name.split(QLatin1Char('.'));
- QObject *object = obj;
-
- for (int jj = 0; jj < path.count() - 1; ++jj) {
- const QString &pathName = path.at(jj);
-
- if (QmlTypeNameCache::Data *data = typeNameCache?typeNameCache->data(pathName):0) {
- if (data->type) {
- QmlAttachedPropertiesFunc func = data->type->attachedPropertiesFunction();
- if (!func)
- return QmlMetaProperty();
- object = qmlAttachedPropertiesObjectById(data->type->index(), object);
- if (!object)
- return QmlMetaProperty();
- continue;
- } else {
- Q_ASSERT(data->typeNamespace);
- ++jj;
- data = data->typeNamespace->data(path.at(jj));
- if (!data || !data->type)
- return QmlMetaProperty();
- QmlAttachedPropertiesFunc func = data->type->attachedPropertiesFunction();
- if (!func)
- return QmlMetaProperty();
- object = qmlAttachedPropertiesObjectById(data->type->index(), object);
- if (!object)
- return QmlMetaProperty();
- continue;
- }
- }
-
- QmlMetaProperty prop(object, pathName, context);
-
- if (jj == path.count() - 2 && prop.propertyType() < (int)QVariant::UserType &&
- qmlValueTypes()->valueTypes[prop.propertyType()]) {
- // We're now at a value type property. We can use a global valuetypes array as we
- // never actually use the objects, just look up their properties.
- QObject *typeObject =
- qmlValueTypes()->valueTypes[prop.propertyType()];
- int idx = typeObject->metaObject()->indexOfProperty(path.last().toUtf8().constData());
- if (idx == -1)
- return QmlMetaProperty();
- QMetaProperty vtProp = typeObject->metaObject()->property(idx);
-
- QmlMetaProperty p = prop;
- p.d->valueType.valueTypeCoreIdx = idx;
- p.d->valueType.valueTypePropType = vtProp.userType();
- return p;
- }
-
- QObject *objVal = QmlMetaType::toQObject(prop.read());
- if (!objVal)
- return QmlMetaProperty();
- object = objVal;
- }
-
- const QString &propName = path.last();
- QmlMetaProperty prop(object, propName, context);
- if (!prop.isValid())
- return QmlMetaProperty();
- else
- return prop;
-}
-
-/*!
- Returns true if lhs and rhs refer to the same metaobject data
-*/
-bool QmlMetaPropertyPrivate::equal(const QMetaObject *lhs, const QMetaObject *rhs)
-{
- return lhs == rhs || (1 && lhs && rhs && lhs->d.stringdata == rhs->d.stringdata);
-}
-
-/*!
- Returns true if from inherits to.
-*/
-bool QmlMetaPropertyPrivate::canConvert(const QMetaObject *from, const QMetaObject *to)
-{
- if (from && to == &QObject::staticMetaObject)
- return true;
-
- while (from) {
- if (equal(from, to))
- return true;
- from = from->superClass();
- }
-
- return false;
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlmetaproperty_p.h b/src/declarative/qml/qmlmetaproperty_p.h
deleted file mode 100644
index b99e5be..0000000
--- a/src/declarative/qml/qmlmetaproperty_p.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 QMLMETAPROPERTY_P_H
-#define QMLMETAPROPERTY_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 "qmlmetaproperty.h"
-
-#include "qmlpropertycache_p.h"
-#include "qmlguard_p.h"
-
-#include <private/qobject_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QmlContext;
-class QmlEnginePrivate;
-class QmlMetaPropertyPrivate
-{
-public:
- QmlMetaPropertyPrivate()
- : q(0), context(0), object(0), isDefaultProperty(false), isNameCached(false),
- attachedFunc(-1) {}
-
- QmlMetaPropertyPrivate(const QmlMetaPropertyPrivate &other)
- : q(0), context(other.context), object(other.object),
- isDefaultProperty(other.isDefaultProperty), isNameCached(other.isNameCached),
- core(other.core), nameCache(other.nameCache),
- valueType(other.valueType), attachedFunc(other.attachedFunc) {}
-
- QmlMetaProperty *q;
- QmlContext *context;
- QmlGuard<QObject> object;
-
- bool isDefaultProperty:1;
- bool isNameCached:1;
- QmlPropertyCache::Data core;
- QString nameCache;
-
- // Describes the "virtual" value-type sub-property.
- QmlPropertyCache::ValueTypeData valueType;
-
- // The attached property accessor
- int attachedFunc;
-
- void initProperty(QObject *obj, const QString &name);
- void initDefault(QObject *obj);
-
- QObject *attachedObject() const;
- QMetaMethod findSignal(QObject *, const QString &);
-
- int propertyType() const;
- QmlMetaProperty::PropertyCategory propertyCategory() const;
-
- QVariant readValueProperty();
- bool writeValueProperty(const QVariant &, QmlMetaProperty::WriteFlags);
-
- static const QMetaObject *rawMetaObjectForType(QmlEnginePrivate *, int);
- static bool writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object, const QVariant &value, int flags);
- static bool write(QObject *, const QmlPropertyCache::Data &, const QVariant &, QmlContext *,
- QmlMetaProperty::WriteFlags flags = 0);
- static QmlAbstractBinding *setBinding(QObject *, const QmlPropertyCache::Data &, QmlAbstractBinding *,
- QmlMetaProperty::WriteFlags flags = QmlMetaProperty::DontRemoveBinding);
-
- static QByteArray saveValueType(const QMetaObject *, int, int, int);
- static QByteArray saveProperty(const QMetaObject *, int);
- static QmlMetaProperty restore(const QByteArray &, QObject *, QmlContext * = 0);
-
- static bool equal(const QMetaObject *, const QMetaObject *);
- static bool canConvert(const QMetaObject *from, const QMetaObject *to);
-};
-
-QT_END_NAMESPACE
-
-#endif // QMLMETAPROPERTY_P_H
diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h
deleted file mode 100644
index 98d04c1..0000000
--- a/src/declarative/qml/qmlmetatype.h
+++ /dev/null
@@ -1,281 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 QMLMETATYPE_H
-#define QMLMETATYPE_H
-
-#include "qmlprivate.h"
-#include "qmlparserstatus.h"
-#include "qmlpropertyvaluesource.h"
-#include "qmlpropertyvalueinterceptor.h"
-#include "qmllist.h"
-
-#include <QtCore/qglobal.h>
-#include <QtCore/qvariant.h>
-#include <QtCore/qbitarray.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QmlType;
-class QmlCustomParser;
-class Q_DECLARATIVE_EXPORT QmlMetaType
-{
-public:
- static int registerType(const QmlPrivate::MetaTypeIds &, QObject *(*)(), const char *, int vmaj, int vmin, const char *qmlName, const QMetaObject *, QmlAttachedPropertiesFunc, const QMetaObject *, int pStatus, int object, int valueSource, int valueInterceptor, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *);
- static int registerInterface(const QmlPrivate::MetaTypeIds &, const char *);
-
- static bool copy(int type, void *data, const void *copy = 0);
-
- static QList<QByteArray> qmlTypeNames();
- static QList<QmlType*> qmlTypes();
-
- static QmlType *qmlType(const QByteArray &, int, int);
- static QmlType *qmlType(const QMetaObject *);
- static QmlType *qmlType(int);
-
- static QMetaProperty defaultProperty(const QMetaObject *);
- static QMetaProperty defaultProperty(QObject *);
- static QMetaMethod defaultMethod(const QMetaObject *);
- static QMetaMethod defaultMethod(QObject *);
-
- static bool isQObject(int);
- static QObject *toQObject(const QVariant &, bool *ok = 0);
-
- static int listType(int);
- static int attachedPropertiesFuncId(const QMetaObject *);
- static QmlAttachedPropertiesFunc attachedPropertiesFuncById(int);
-
- enum TypeCategory { Unknown, Object, List };
- static TypeCategory typeCategory(int);
-
- static bool isInterface(int);
- static const char *interfaceIId(int);
- static bool isList(int);
-
- typedef QVariant (*StringConverter)(const QString &);
- static void registerCustomStringConverter(int, StringConverter);
- static StringConverter customStringConverter(int);
-};
-
-class QmlTypePrivate;
-class Q_DECLARATIVE_EXPORT QmlType
-{
-public:
- QByteArray typeName() const;
- QByteArray qmlTypeName() const;
-
- int majorVersion() const;
- int minorVersion() const;
- bool availableInVersion(int vmajor, int vminor) const;
-
- QObject *create() const;
-
- QmlCustomParser *customParser() const;
-
- bool isInterface() const;
- int typeId() const;
- int qListTypeId() const;
-
- const QMetaObject *metaObject() const;
- const QMetaObject *baseMetaObject() const;
-
- QmlAttachedPropertiesFunc attachedPropertiesFunction() const;
- const QMetaObject *attachedPropertiesType() const;
-
- int parserStatusCast() const;
- QVariant fromObject(QObject *) const;
- const char *interfaceIId() const;
- int propertyValueSourceCast() const;
- int propertyValueInterceptorCast() const;
-
- int index() const;
-private:
- friend class QmlMetaType;
- friend class QmlTypePrivate;
- friend struct QmlMetaTypeData;
- 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;
-};
-
-template<typename T>
-int qmlRegisterType(const char *typeName)
-{
- QByteArray name(typeName);
- QmlPrivate::MetaTypeIds ids = {
- qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
- qRegisterMetaType<QmlListProperty<T> >(QByteArray("QmlListProperty<" + name + ">").constData()),
- };
-
- return QmlMetaType::registerType(ids, 0, 0, 0, 0, 0,
- &T::staticMetaObject,
- QmlPrivate::attachedPropertiesFunc<T>(),
- QmlPrivate::attachedPropertiesMetaObject<T>(),
- QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
- QmlPrivate::StaticCastSelector<T,QObject>::cast(),
- QmlPrivate::StaticCastSelector<T,QmlPropertyValueSource>::cast(),
- QmlPrivate::StaticCastSelector<T,QmlPropertyValueInterceptor>::cast(),
- 0, 0, 0);
-}
-
-template<typename T>
-int qmlRegisterType(const char *uri, int version_maj, int version_min, const char *qmlName, const char *typeName)
-{
- QByteArray name(typeName);
- QmlPrivate::MetaTypeIds ids = {
- qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
- qRegisterMetaType<QmlListProperty<T> >(QByteArray("QmlListProperty<" + name + ">").constData()),
- };
-
- return QmlMetaType::registerType(ids, QmlPrivate::create<T>,
- uri, version_maj, version_min, qmlName,
- &T::staticMetaObject,
- QmlPrivate::attachedPropertiesFunc<T>(),
- QmlPrivate::attachedPropertiesMetaObject<T>(),
- QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
- QmlPrivate::StaticCastSelector<T,QObject>::cast(),
- QmlPrivate::StaticCastSelector<T,QmlPropertyValueSource>::cast(),
- QmlPrivate::StaticCastSelector<T,QmlPropertyValueInterceptor>::cast(),
- 0, 0, 0);
-}
-
-template<typename T, typename E>
-int qmlRegisterExtendedType(const char *typeName)
-{
- QByteArray name(typeName);
- QmlPrivate::MetaTypeIds ids = {
- qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
- qRegisterMetaType<QmlListProperty<T> >(QByteArray("QmlListProperty<" + name + ">").constData()),
- };
-
- QmlAttachedPropertiesFunc attached =
- QmlPrivate::attachedPropertiesFunc<E>();
- const QMetaObject * attachedMo =
- QmlPrivate::attachedPropertiesMetaObject<E>();
- if (!attached) {
- attached = QmlPrivate::attachedPropertiesFunc<T>();
- attachedMo = QmlPrivate::attachedPropertiesMetaObject<T>();
- }
-
- return QmlMetaType::registerType(ids, 0, 0, 0, 0, 0,
- &T::staticMetaObject, attached, attachedMo,
- QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
- QmlPrivate::StaticCastSelector<T,QObject>::cast(),
- QmlPrivate::StaticCastSelector<T,QmlPropertyValueSource>::cast(),
- QmlPrivate::StaticCastSelector<T,QmlPropertyValueInterceptor>::cast(),
- &QmlPrivate::CreateParent<E>::create, &E::staticMetaObject, 0);
-}
-
-template<typename T, typename E>
-int qmlRegisterExtendedType(const char *uri, int version_maj, int version_min, const char *qmlName, const char *typeName)
-{
- QByteArray name(typeName);
- QmlPrivate::MetaTypeIds ids = {
- qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
- qRegisterMetaType<QmlListProperty<T> >(QByteArray("QmlListProperty<" + name + ">").constData()),
- };
-
- QmlAttachedPropertiesFunc attached =
- QmlPrivate::attachedPropertiesFunc<E>();
- const QMetaObject * attachedMo =
- QmlPrivate::attachedPropertiesMetaObject<E>();
- if (!attached) {
- attached = QmlPrivate::attachedPropertiesFunc<T>();
- attachedMo = QmlPrivate::attachedPropertiesMetaObject<T>();
- }
-
- return QmlMetaType::registerType(ids, QmlPrivate::create<T>,
- uri, version_maj, version_min, qmlName,
- &T::staticMetaObject,
- attached, attachedMo,
- QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
- QmlPrivate::StaticCastSelector<T,QObject>::cast(),
- QmlPrivate::StaticCastSelector<T,QmlPropertyValueSource>::cast(),
- QmlPrivate::StaticCastSelector<T,QmlPropertyValueInterceptor>::cast(),
- &QmlPrivate::CreateParent<E>::create,
- &E::staticMetaObject, 0);
-}
-
-template<typename T>
-int qmlRegisterInterface(const char *typeName)
-{
- QByteArray name(typeName);
- QmlPrivate::MetaTypeIds ids = {
- qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
- qRegisterMetaType<QmlListProperty<T> >(QByteArray("QmlListProperty<" + name + ">").constData()),
- };
-
- return QmlMetaType::registerInterface(ids, qobject_interface_iid<T *>());
-}
-
-template<typename T>
-int qmlRegisterCustomType(const char *uri, int version_maj, int version_min, const char *qmlName, const char *typeName, QmlCustomParser *parser)
-{
- QByteArray name(typeName);
- QmlPrivate::MetaTypeIds ids = {
- qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
- qRegisterMetaType<QmlListProperty<T> >(QByteArray("QmlListProperty<" + name + ">").constData()),
- };
-
- return QmlMetaType::registerType(ids, QmlPrivate::create<T>,
- uri, version_maj, version_min, qmlName,
- &T::staticMetaObject,
- QmlPrivate::attachedPropertiesFunc<T>(),
- QmlPrivate::attachedPropertiesMetaObject<T>(),
- QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
- QmlPrivate::StaticCastSelector<T,QObject>::cast(),
- QmlPrivate::StaticCastSelector<T,QmlPropertyValueSource>::cast(),
- QmlPrivate::StaticCastSelector<T,QmlPropertyValueInterceptor>::cast(),
- 0, 0, parser);
-}
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMLMETATYPE_H
-
diff --git a/src/declarative/qml/qmlmoduleplugin.cpp b/src/declarative/qml/qmlmoduleplugin.cpp
deleted file mode 100644
index 342074a..0000000
--- a/src/declarative/qml/qmlmoduleplugin.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 "qmlmoduleplugin.h"
-#include "qstringlist.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QmlModulePlugin
- \since 4.7
- \brief The QmlModulePlugin class provides an abstract base for custom QML module plugins.
- \reentrant
- \ingroup plugins
-
- The QML module plugin is a simple plugin interface that makes it
- easy to add custom QML modules that can be loaded dynamically
- into applications.
-
- Writing a QML module plugin is achieved by subclassing this base
- class, reimplementing the pure virtual function keys(), and
- exporting the class with the Q_EXPORT_PLUGIN2() macro. See \l{How
- to Create Qt Plugins} for details.
-
- The strings returned by keys() should be the list of URIs of modules
- that the plugin registers.
-
- The plugin should register QML types with qmlRegisterType() when the
- defineModule() method is called.
-
- See the example in \c{examples/declarative/plugins}.
-*/
-
-/*!
- Constructs a QML module plugin with the given \a parent. This is
- invoked automatically by the Q_EXPORT_PLUGIN2() macro.
-*/
-QmlModulePlugin::QmlModulePlugin(QObject *parent)
- : QObject(parent)
-{
-}
-
-/*!
- Destroys the QML module plugin.
-
- You never have to call this explicitly. Qt destroys a plugin
- automatically when it is no longer used.
-*/
-QmlModulePlugin::~QmlModulePlugin()
-{
-}
-
-/*!
- \fn void QmlModulePlugin::defineModule(const QString& uri)
-
- Subclasses must override this function to register types
- of the module \a uri, which will be one of the strings returned by keys().
-
- The plugin registers QML types with qmlRegisterType():
-
- \code
- qmlRegisterType<MyClass>("com.nokia.MyModule", 1, 0, "MyType", "MyClass");
- \endcode
-*/
-
-void QmlModulePlugin::defineModuleOnce(const QString& uri)
-{
- if (!defined.contains(uri)) {
- defined += uri;
- defineModule(uri);
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlmoduleplugin.h b/src/declarative/qml/qmlmoduleplugin.h
deleted file mode 100644
index b28f1ad..0000000
--- a/src/declarative/qml/qmlmoduleplugin.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 QMLMODULEPLUGIN_H
-#define QMLMODULEPLUGIN_H
-
-#include <QtCore/qplugin.h>
-#include <QtCore/qfactoryinterface.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qset.h>
-#include <QtCore/qbytearray.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-struct Q_DECLARATIVE_EXPORT QmlModuleFactoryInterface : public QFactoryInterface
-{
- virtual void defineModuleOnce(const QString& uri) = 0;
-};
-
-#define QmlModuleFactoryInterface_iid "com.nokia.Qt.QmlModuleFactoryInterface"
-
-Q_DECLARE_INTERFACE(QmlModuleFactoryInterface, QmlModuleFactoryInterface_iid)
-
-
-class Q_DECLARATIVE_EXPORT QmlModulePlugin : public QObject, public QmlModuleFactoryInterface
-{
- Q_OBJECT
- Q_INTERFACES(QmlModuleFactoryInterface:QFactoryInterface)
-public:
- explicit QmlModulePlugin(QObject *parent = 0);
- ~QmlModulePlugin();
-
- virtual void defineModule(const QString& uri) = 0;
-
-private:
- void defineModuleOnce(const QString& uri);
- QSet<QString> defined;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMLMODULEPLUGIN_H
diff --git a/src/declarative/qml/qmlvaluetype.cpp b/src/declarative/qml/qmlvaluetype.cpp
deleted file mode 100644
index 33c3e76..0000000
--- a/src/declarative/qml/qmlvaluetype.cpp
+++ /dev/null
@@ -1,636 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 "qmlvaluetype_p.h"
-
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-QmlValueTypeFactory::QmlValueTypeFactory()
-{
- // ### Optimize
- for (unsigned int ii = 0; ii < (QVariant::UserType - 1); ++ii)
- valueTypes[ii] = valueType(ii);
-}
-
-QmlValueTypeFactory::~QmlValueTypeFactory()
-{
- for (unsigned int ii = 0; ii < (QVariant::UserType - 1); ++ii)
- delete valueTypes[ii];
-}
-
-QmlValueType *QmlValueTypeFactory::valueType(int t)
-{
- switch (t) {
- case QVariant::Point:
- return new QmlPointValueType;
- case QVariant::PointF:
- return new QmlPointFValueType;
- case QVariant::Size:
- return new QmlSizeValueType;
- case QVariant::SizeF:
- return new QmlSizeFValueType;
- case QVariant::Rect:
- return new QmlRectValueType;
- case QVariant::RectF:
- return new QmlRectFValueType;
- case QVariant::Vector3D:
- return new QmlVector3DValueType;
- case QVariant::Font:
- return new QmlFontValueType;
- default:
- return 0;
- }
-}
-
-QmlValueType::QmlValueType(QObject *parent)
-: QObject(parent)
-{
-}
-
-QmlPointFValueType::QmlPointFValueType(QObject *parent)
-: QmlValueType(parent)
-{
-}
-
-void QmlPointFValueType::read(QObject *obj, int idx)
-{
- void *a[] = { &point, 0 };
- QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
-}
-
-void QmlPointFValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
-{
- int status = -1;
- void *a[] = { &point, 0, &status, &flags };
- QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
-}
-
-QVariant QmlPointFValueType::value()
-{
- return QVariant(point);
-}
-
-void QmlPointFValueType::setValue(QVariant value)
-{
- point = qvariant_cast<QPointF>(value);
-}
-
-qreal QmlPointFValueType::x() const
-{
- return point.x();
-}
-
-qreal QmlPointFValueType::y() const
-{
- return point.y();
-}
-
-void QmlPointFValueType::setX(qreal x)
-{
- point.setX(x);
-}
-
-void QmlPointFValueType::setY(qreal y)
-{
- point.setY(y);
-}
-
-QmlPointValueType::QmlPointValueType(QObject *parent)
-: QmlValueType(parent)
-{
-}
-
-void QmlPointValueType::read(QObject *obj, int idx)
-{
- void *a[] = { &point, 0 };
- QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
-}
-
-void QmlPointValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
-{
- int status = -1;
- void *a[] = { &point, 0, &status, &flags };
- QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
-}
-
-QVariant QmlPointValueType::value()
-{
- return QVariant(point);
-}
-
-void QmlPointValueType::setValue(QVariant value)
-{
- point = qvariant_cast<QPoint>(value);
-}
-
-int QmlPointValueType::x() const
-{
- return point.x();
-}
-
-int QmlPointValueType::y() const
-{
- return point.y();
-}
-
-void QmlPointValueType::setX(int x)
-{
- point.setX(x);
-}
-
-void QmlPointValueType::setY(int y)
-{
- point.setY(y);
-}
-
-QmlSizeFValueType::QmlSizeFValueType(QObject *parent)
-: QmlValueType(parent)
-{
-}
-
-void QmlSizeFValueType::read(QObject *obj, int idx)
-{
- void *a[] = { &size, 0 };
- QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
-}
-
-void QmlSizeFValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
-{
- int status = -1;
- void *a[] = { &size, 0, &status, &flags };
- QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
-}
-
-QVariant QmlSizeFValueType::value()
-{
- return QVariant(size);
-}
-
-void QmlSizeFValueType::setValue(QVariant value)
-{
- size = qvariant_cast<QSizeF>(value);
-}
-
-qreal QmlSizeFValueType::width() const
-{
- return size.width();
-}
-
-qreal QmlSizeFValueType::height() const
-{
- return size.height();
-}
-
-void QmlSizeFValueType::setWidth(qreal w)
-{
- size.setWidth(w);
-}
-
-void QmlSizeFValueType::setHeight(qreal h)
-{
- size.setHeight(h);
-}
-
-QmlSizeValueType::QmlSizeValueType(QObject *parent)
-: QmlValueType(parent)
-{
-}
-
-void QmlSizeValueType::read(QObject *obj, int idx)
-{
- void *a[] = { &size, 0 };
- QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
-}
-
-void QmlSizeValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
-{
- int status = -1;
- void *a[] = { &size, 0, &status, &flags };
- QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
-}
-
-QVariant QmlSizeValueType::value()
-{
- return QVariant(size);
-}
-
-void QmlSizeValueType::setValue(QVariant value)
-{
- size = qvariant_cast<QSize>(value);
-}
-
-int QmlSizeValueType::width() const
-{
- return size.width();
-}
-
-int QmlSizeValueType::height() const
-{
- return size.height();
-}
-
-void QmlSizeValueType::setWidth(int w)
-{
- size.setWidth(w);
-}
-
-void QmlSizeValueType::setHeight(int h)
-{
- size.setHeight(h);
-}
-
-QmlRectFValueType::QmlRectFValueType(QObject *parent)
-: QmlValueType(parent)
-{
-}
-
-void QmlRectFValueType::read(QObject *obj, int idx)
-{
- void *a[] = { &rect, 0 };
- QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
-}
-
-void QmlRectFValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
-{
- int status = -1;
- void *a[] = { &rect, 0, &status, &flags };
- QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
-}
-
-QVariant QmlRectFValueType::value()
-{
- return QVariant(rect);
-}
-
-void QmlRectFValueType::setValue(QVariant value)
-{
- rect = qvariant_cast<QRectF>(value);
-}
-
-qreal QmlRectFValueType::x() const
-{
- return rect.x();
-}
-
-qreal QmlRectFValueType::y() const
-{
- return rect.y();
-}
-
-void QmlRectFValueType::setX(qreal x)
-{
- rect.moveLeft(x);
-}
-
-void QmlRectFValueType::setY(qreal y)
-{
- rect.moveTop(y);
-}
-
-qreal QmlRectFValueType::width() const
-{
- return rect.width();
-}
-
-qreal QmlRectFValueType::height() const
-{
- return rect.height();
-}
-
-void QmlRectFValueType::setWidth(qreal w)
-{
- rect.setWidth(w);
-}
-
-void QmlRectFValueType::setHeight(qreal h)
-{
- rect.setHeight(h);
-}
-
-QmlRectValueType::QmlRectValueType(QObject *parent)
-: QmlValueType(parent)
-{
-}
-
-void QmlRectValueType::read(QObject *obj, int idx)
-{
- void *a[] = { &rect, 0 };
- QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
-}
-
-void QmlRectValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
-{
- int status = -1;
- void *a[] = { &rect, 0, &status, &flags };
- QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
-}
-
-QVariant QmlRectValueType::value()
-{
- return QVariant(rect);
-}
-
-void QmlRectValueType::setValue(QVariant value)
-{
- rect = qvariant_cast<QRect>(value);
-}
-
-int QmlRectValueType::x() const
-{
- return rect.x();
-}
-
-int QmlRectValueType::y() const
-{
- return rect.y();
-}
-
-void QmlRectValueType::setX(int x)
-{
- rect.moveLeft(x);
-}
-
-void QmlRectValueType::setY(int y)
-{
- rect.moveTop(y);
-}
-
-int QmlRectValueType::width() const
-{
- return rect.width();
-}
-
-int QmlRectValueType::height() const
-{
- return rect.height();
-}
-
-void QmlRectValueType::setWidth(int w)
-{
- rect.setWidth(w);
-}
-
-void QmlRectValueType::setHeight(int h)
-{
- rect.setHeight(h);
-}
-
-QmlVector3DValueType::QmlVector3DValueType(QObject *parent)
-: QmlValueType(parent)
-{
-}
-
-void QmlVector3DValueType::read(QObject *obj, int idx)
-{
- void *a[] = { &vector, 0 };
- QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
-}
-
-void QmlVector3DValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
-{
- int status = -1;
- void *a[] = { &vector, 0, &status, &flags };
- QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
-}
-
-QVariant QmlVector3DValueType::value()
-{
- return QVariant(vector);
-}
-
-void QmlVector3DValueType::setValue(QVariant value)
-{
- vector = qvariant_cast<QVector3D>(value);
-}
-
-qreal QmlVector3DValueType::x() const
-{
- return vector.x();
-}
-
-qreal QmlVector3DValueType::y() const
-{
- return vector.y();
-}
-
-qreal QmlVector3DValueType::z() const
-{
- return vector.z();
-}
-
-void QmlVector3DValueType::setX(qreal x)
-{
- vector.setX(x);
-}
-
-void QmlVector3DValueType::setY(qreal y)
-{
- vector.setY(y);
-}
-
-void QmlVector3DValueType::setZ(qreal z)
-{
- vector.setZ(z);
-}
-
-QmlFontValueType::QmlFontValueType(QObject *parent)
-: QmlValueType(parent), hasPixelSize(false)
-{
-}
-
-void QmlFontValueType::read(QObject *obj, int idx)
-{
- void *a[] = { &font, 0 };
- QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
-}
-
-void QmlFontValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
-{
- int status = -1;
- void *a[] = { &font, 0, &status, &flags };
- QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
-}
-
-QVariant QmlFontValueType::value()
-{
- return QVariant(font);
-}
-
-void QmlFontValueType::setValue(QVariant value)
-{
- font = qvariant_cast<QFont>(value);
-}
-
-
-QString QmlFontValueType::family() const
-{
- return font.family();
-}
-
-void QmlFontValueType::setFamily(const QString &family)
-{
- font.setFamily(family);
-}
-
-bool QmlFontValueType::bold() const
-{
- return font.bold();
-}
-
-void QmlFontValueType::setBold(bool b)
-{
- font.setBold(b);
-}
-
-QmlFontValueType::FontWeight QmlFontValueType::weight() const
-{
- return (QmlFontValueType::FontWeight)font.weight();
-}
-
-void QmlFontValueType::setWeight(QmlFontValueType::FontWeight w)
-{
- font.setWeight((QFont::Weight)w);
-}
-
-bool QmlFontValueType::italic() const
-{
- return font.italic();
-}
-
-void QmlFontValueType::setItalic(bool b)
-{
- font.setItalic(b);
-}
-
-bool QmlFontValueType::underline() const
-{
- return font.underline();
-}
-
-void QmlFontValueType::setUnderline(bool b)
-{
- font.setUnderline(b);
-}
-
-bool QmlFontValueType::overline() const
-{
- return font.overline();
-}
-
-void QmlFontValueType::setOverline(bool b)
-{
- font.setOverline(b);
-}
-
-bool QmlFontValueType::strikeout() const
-{
- return font.strikeOut();
-}
-
-void QmlFontValueType::setStrikeout(bool b)
-{
- font.setStrikeOut(b);
-}
-
-qreal QmlFontValueType::pointSize() const
-{
- return font.pointSizeF();
-}
-
-void QmlFontValueType::setPointSize(qreal size)
-{
- if (hasPixelSize) {
- qWarning() << "Both point size and pixel size set. Using pixel size.";
- return;
- }
-
- if (size >= 0.0)
- font.setPointSizeF(size);
-}
-
-int QmlFontValueType::pixelSize() const
-{
- return font.pixelSize();
-}
-
-void QmlFontValueType::setPixelSize(int size)
-{
- if (size >=0) {
- font.setPixelSize(size);
- hasPixelSize = true;
- } else {
- hasPixelSize = false;
- }
-}
-
-QmlFontValueType::Capitalization QmlFontValueType::capitalization() const
-{
- return (QmlFontValueType::Capitalization)font.capitalization();
-}
-
-void QmlFontValueType::setCapitalization(QmlFontValueType::Capitalization c)
-{
- font.setCapitalization((QFont::Capitalization)c);
-}
-
-qreal QmlFontValueType::letterSpacing() const
-{
- return font.letterSpacing();
-}
-
-void QmlFontValueType::setLetterSpacing(qreal size)
-{
- font.setLetterSpacing(QFont::PercentageSpacing, size);
-}
-
-qreal QmlFontValueType::wordSpacing() const
-{
- return font.wordSpacing();
-}
-
-void QmlFontValueType::setWordSpacing(qreal size)
-{
- font.setWordSpacing(size);
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/qml/rewriter/rewriter.cpp b/src/declarative/qml/rewriter/rewriter.cpp
index f848936..b458a8d 100644
--- a/src/declarative/qml/rewriter/rewriter.cpp
+++ b/src/declarative/qml/rewriter/rewriter.cpp
@@ -41,11 +41,11 @@
#include "rewriter_p.h"
-#include <qmljsast_p.h>
+#include <qdeclarativejsast_p.h>
QT_QML_BEGIN_NAMESPACE
-using namespace QmlJS;
+using namespace QDeclarativeJS;
void Rewriter::replace(const AST::SourceLocation &loc, const QString &text)
{ replace(loc.offset, loc.length, text); }
@@ -77,8 +77,8 @@ QString Rewriter::textAt(const AST::SourceLocation &loc) const
QString Rewriter::textAt(const AST::SourceLocation &firstLoc, const AST::SourceLocation &lastLoc) const
{ return _code.mid(firstLoc.offset, lastLoc.offset + lastLoc.length - firstLoc.offset); }
-void Rewriter::accept(QmlJS::AST::Node *node)
-{ QmlJS::AST::Node::acceptChild(node, this); }
+void Rewriter::accept(QDeclarativeJS::AST::Node *node)
+{ QDeclarativeJS::AST::Node::acceptChild(node, this); }
void Rewriter::moveTextBefore(const AST::SourceLocation &firstLoc,
const AST::SourceLocation &lastLoc,
diff --git a/src/declarative/qml/rewriter/rewriter_p.h b/src/declarative/qml/rewriter/rewriter_p.h
index 36e8df7..d1445d8 100644
--- a/src/declarative/qml/rewriter/rewriter_p.h
+++ b/src/declarative/qml/rewriter/rewriter_p.h
@@ -44,7 +44,7 @@
#include "textwriter_p.h"
-#include <qmljsastvisitor_p.h>
+#include <qdeclarativejsastvisitor_p.h>
#include <QtCore/QList>
#include <QtCore/QString>
@@ -52,7 +52,7 @@
QT_BEGIN_HEADER
QT_QML_BEGIN_NAMESPACE
-namespace QmlJS {
+namespace QDeclarativeJS {
////////////////////////////////////////////////////////////////////////////////
// Replacement
@@ -145,7 +145,7 @@ private:
QList<Replacement> _replacementList;
};
-} // end of namespace QmlJS
+} // end of namespace QDeclarativeJS
QT_QML_END_NAMESPACE
QT_END_HEADER
diff --git a/src/declarative/qml/rewriter/textwriter.cpp b/src/declarative/qml/rewriter/textwriter.cpp
index cd3f26a..e63d24c 100644
--- a/src/declarative/qml/rewriter/textwriter.cpp
+++ b/src/declarative/qml/rewriter/textwriter.cpp
@@ -43,7 +43,7 @@
QT_QML_BEGIN_NAMESPACE
-using namespace QmlJS;
+using namespace QDeclarativeJS;
TextWriter::TextWriter()
:string(0), cursor(0)
diff --git a/src/declarative/qml/rewriter/textwriter_p.h b/src/declarative/qml/rewriter/textwriter_p.h
index 43ef669..c712626 100644
--- a/src/declarative/qml/rewriter/textwriter_p.h
+++ b/src/declarative/qml/rewriter/textwriter_p.h
@@ -42,7 +42,7 @@
#ifndef TEXTWRITER_H
#define TEXTWRITER_H
-#include <qmljsglobal_p.h>
+#include <qdeclarativejsglobal_p.h>
#include <QtCore/QString>
#include <QtCore/QList>
@@ -51,7 +51,7 @@
QT_BEGIN_HEADER
QT_QML_BEGIN_NAMESPACE
-namespace QmlJS {
+namespace QDeclarativeJS {
class TextWriter
{
@@ -93,7 +93,7 @@ public:
};
-} // end of namespace QmlJS
+} // end of namespace QDeclarativeJS
QT_QML_END_NAMESPACE
QT_END_HEADER
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 1be95df..181ef0a 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -39,18 +39,20 @@
**
****************************************************************************/
-#include "qmlanimation_p.h"
-#include "qmlanimation_p_p.h"
+#include "qdeclarativeanimation_p.h"
+#include "qdeclarativeanimation_p_p.h"
-#include "qmlbehavior_p.h"
-#include "qmlstateoperations_p.h"
+#include "qdeclarativebehavior_p.h"
+#include "qdeclarativestateoperations_p.h"
-#include <qmlpropertyvaluesource.h>
-#include <qml.h>
-#include <qmlinfo.h>
-#include <qmlexpression.h>
-#include <qmlstringconverters_p.h>
-#include <qmlglobal_p.h>
+#include <qdeclarativepropertyvaluesource.h>
+#include <qdeclarative.h>
+#include <qdeclarativeinfo.h>
+#include <qdeclarativeexpression.h>
+#include <qdeclarativestringconverters_p.h>
+#include <qdeclarativeglobal_p.h>
+#include <qdeclarativemetatype_p.h>
+#include <qdeclarativeproperty_p.h>
#include <qvariant.h>
#include <qcolor.h>
@@ -61,88 +63,14 @@
#include <QtCore/qrect.h>
#include <QtCore/qpoint.h>
#include <QtCore/qsize.h>
+#include <QtCore/qmath.h>
#include <private/qvariantanimation_p.h>
QT_BEGIN_NAMESPACE
-static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
-{
- QEasingCurve easingCurve;
-
- QString normalizedCurve = curve;
- bool hasParams = curve.contains(QLatin1Char('('));
- QStringList props;
-
- if (hasParams) {
- QString easeName = curve.trimmed();
- if (!easeName.endsWith(QLatin1Char(')'))) {
- qmlInfo(obj) << QmlPropertyAnimation::tr("Unmatched parenthesis in easing function \"%1\"").arg(curve);
- return easingCurve;
- }
-
- int idx = easeName.indexOf(QLatin1Char('('));
- QString prop_str =
- easeName.mid(idx + 1, easeName.length() - 1 - idx - 1);
- normalizedCurve = easeName.left(idx);
- if (!normalizedCurve.startsWith(QLatin1String("ease"))) {
- qmlInfo(obj) << QmlPropertyAnimation::tr("Easing function \"%1\" must start with \"ease\"").arg(curve);
- return easingCurve;
- }
-
- props = prop_str.split(QLatin1Char(','));
- }
-
- if (normalizedCurve.startsWith(QLatin1String("ease")))
- normalizedCurve = normalizedCurve.mid(4);
-
- static int index = QEasingCurve::staticMetaObject.indexOfEnumerator("Type");
- static QMetaEnum me = QEasingCurve::staticMetaObject.enumerator(index);
-
- int value = me.keyToValue(normalizedCurve.toUtf8().constData());
- if (value < 0) {
- qmlInfo(obj) << QmlPropertyAnimation::tr("Unknown easing curve \"%1\"").arg(curve);
- return easingCurve;
- }
- easingCurve.setType((QEasingCurve::Type)value);
-
- if (hasParams) {
- foreach(const QString &str, props) {
- int sep = str.indexOf(QLatin1Char(':'));
-
- if (sep == -1) {
- qmlInfo(obj) << QmlPropertyAnimation::tr("Improperly specified parameter in easing function \"%1\"").arg(curve);
- continue;
- }
-
- QString propName = str.left(sep).trimmed();
- bool isOk;
- qreal propValue = str.mid(sep + 1).trimmed().toDouble(&isOk);
-
- if (propName.isEmpty() || !isOk) {
- qmlInfo(obj) << QmlPropertyAnimation::tr("Improperly specified parameter in easing function \"%1\"").arg(curve);
- continue;
- }
-
- if (propName == QLatin1String("amplitude")) {
- easingCurve.setAmplitude(propValue);
- } else if (propName == QLatin1String("period")) {
- easingCurve.setPeriod(propValue);
- } else if (propName == QLatin1String("overshoot")) {
- easingCurve.setOvershoot(propValue);
- } else {
- qmlInfo(obj) << QmlPropertyAnimation::tr("Unknown easing parameter \"%1\"").arg(propName);
- continue;
- }
- }
- }
- return easingCurve;
-}
-
-QML_DEFINE_NOCREATE_TYPE(QmlAbstractAnimation)
-
/*!
- \qmlclass Animation QmlAbstractAnimation
+ \qmlclass Animation QDeclarativeAbstractAnimation
\since 4.7
\brief The Animation element is the base of all QML animations.
@@ -153,20 +81,20 @@ QML_DEFINE_NOCREATE_TYPE(QmlAbstractAnimation)
*/
/*!
- \class QmlAbstractAnimation
+ \class QDeclarativeAbstractAnimation
\internal
*/
-QmlAbstractAnimation::QmlAbstractAnimation(QObject *parent)
-: QObject(*(new QmlAbstractAnimationPrivate), parent)
+QDeclarativeAbstractAnimation::QDeclarativeAbstractAnimation(QObject *parent)
+: QObject(*(new QDeclarativeAbstractAnimationPrivate), parent)
{
}
-QmlAbstractAnimation::~QmlAbstractAnimation()
+QDeclarativeAbstractAnimation::~QDeclarativeAbstractAnimation()
{
}
-QmlAbstractAnimation::QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObject *parent)
+QDeclarativeAbstractAnimation::QDeclarativeAbstractAnimation(QDeclarativeAbstractAnimationPrivate &dd, QObject *parent)
: QObject(dd, parent)
{
}
@@ -205,21 +133,21 @@ QmlAbstractAnimation::QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObj
By default, animations are not running. Though, when the animations are assigned to properties,
as property value sources, they are set to running by default.
*/
-bool QmlAbstractAnimation::isRunning() const
+bool QDeclarativeAbstractAnimation::isRunning() const
{
- Q_D(const QmlAbstractAnimation);
+ Q_D(const QDeclarativeAbstractAnimation);
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()
+void QDeclarativeAbstractAnimationPrivate::commence()
{
- Q_Q(QmlAbstractAnimation);
+ Q_Q(QDeclarativeAbstractAnimation);
- QmlStateActions actions;
- QmlMetaProperties properties;
- q->transition(actions, properties, QmlAbstractAnimation::Forward);
+ QDeclarativeStateActions actions;
+ QDeclarativeProperties properties;
+ q->transition(actions, properties, QDeclarativeAbstractAnimation::Forward);
q->qtAnimation()->start();
if (q->qtAnimation()->state() != QAbstractAnimation::Running) {
@@ -228,22 +156,22 @@ void QmlAbstractAnimationPrivate::commence()
}
}
-QmlMetaProperty QmlAbstractAnimationPrivate::createProperty(QObject *obj, const QString &str, QObject *infoObj)
+QDeclarativeProperty QDeclarativeAbstractAnimationPrivate::createProperty(QObject *obj, const QString &str, QObject *infoObj)
{
- QmlMetaProperty prop = QmlMetaProperty::createProperty(obj, str, qmlContext(infoObj));
+ QDeclarativeProperty prop(obj, str, qmlContext(infoObj));
if (!prop.isValid()) {
- qmlInfo(infoObj) << QmlAbstractAnimation::tr("Cannot animate non-existent property \"%1\"").arg(str);
- return QmlMetaProperty();
+ qmlInfo(infoObj) << QDeclarativeAbstractAnimation::tr("Cannot animate non-existent property \"%1\"").arg(str);
+ return QDeclarativeProperty();
} else if (!prop.isWritable()) {
- qmlInfo(infoObj) << QmlAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str);
- return QmlMetaProperty();
+ qmlInfo(infoObj) << QDeclarativeAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str);
+ return QDeclarativeProperty();
}
return prop;
}
-void QmlAbstractAnimation::setRunning(bool r)
+void QDeclarativeAbstractAnimation::setRunning(bool r)
{
- Q_D(QmlAbstractAnimation);
+ Q_D(QDeclarativeAbstractAnimation);
if (!d->componentComplete) {
d->running = r;
if (r == false)
@@ -255,7 +183,7 @@ void QmlAbstractAnimation::setRunning(bool r)
return;
if (d->group || d->disableUserControl) {
- qWarning("QmlAbstractAnimation: setRunning() cannot be used on non-root animation nodes");
+ qWarning("QDeclarativeAbstractAnimation: setRunning() cannot be used on non-root animation nodes");
return;
}
@@ -298,20 +226,20 @@ void QmlAbstractAnimation::setRunning(bool r)
By default, animations are not paused.
*/
-bool QmlAbstractAnimation::isPaused() const
+bool QDeclarativeAbstractAnimation::isPaused() const
{
- Q_D(const QmlAbstractAnimation);
+ Q_D(const QDeclarativeAbstractAnimation);
return d->paused;
}
-void QmlAbstractAnimation::setPaused(bool p)
+void QDeclarativeAbstractAnimation::setPaused(bool p)
{
- Q_D(QmlAbstractAnimation);
+ Q_D(QDeclarativeAbstractAnimation);
if (d->paused == p)
return;
if (d->group || d->disableUserControl) {
- qWarning("QmlAbstractAnimation: setPaused() cannot be used on non-root animation nodes");
+ qWarning("QDeclarativeAbstractAnimation: setPaused() cannot be used on non-root animation nodes");
return;
}
@@ -324,15 +252,15 @@ void QmlAbstractAnimation::setPaused(bool p)
emit pausedChanged(d->paused);
}
-void QmlAbstractAnimation::classBegin()
+void QDeclarativeAbstractAnimation::classBegin()
{
- Q_D(QmlAbstractAnimation);
+ Q_D(QDeclarativeAbstractAnimation);
d->componentComplete = false;
}
-void QmlAbstractAnimation::componentComplete()
+void QDeclarativeAbstractAnimation::componentComplete()
{
- Q_D(QmlAbstractAnimation);
+ Q_D(QDeclarativeAbstractAnimation);
d->componentComplete = true;
if (d->running) {
d->running = false;
@@ -354,15 +282,15 @@ void QmlAbstractAnimation::componentComplete()
By default, the alwaysRunToEnd property is not set.
*/
-bool QmlAbstractAnimation::alwaysRunToEnd() const
+bool QDeclarativeAbstractAnimation::alwaysRunToEnd() const
{
- Q_D(const QmlAbstractAnimation);
+ Q_D(const QDeclarativeAbstractAnimation);
return d->alwaysRunToEnd;
}
-void QmlAbstractAnimation::setAlwaysRunToEnd(bool f)
+void QDeclarativeAbstractAnimation::setAlwaysRunToEnd(bool f)
{
- Q_D(QmlAbstractAnimation);
+ Q_D(QDeclarativeAbstractAnimation);
if (d->alwaysRunToEnd == f)
return;
@@ -386,15 +314,15 @@ void QmlAbstractAnimation::setAlwaysRunToEnd(bool f)
}
\endcode
*/
-bool QmlAbstractAnimation::repeat() const
+bool QDeclarativeAbstractAnimation::repeat() const
{
- Q_D(const QmlAbstractAnimation);
+ Q_D(const QDeclarativeAbstractAnimation);
return d->repeat;
}
-void QmlAbstractAnimation::setRepeat(bool r)
+void QDeclarativeAbstractAnimation::setRepeat(bool r)
{
- Q_D(QmlAbstractAnimation);
+ Q_D(QDeclarativeAbstractAnimation);
if (r == d->repeat)
return;
@@ -404,37 +332,34 @@ void QmlAbstractAnimation::setRepeat(bool r)
emit repeatChanged(r);
}
-int QmlAbstractAnimation::currentTime()
+int QDeclarativeAbstractAnimation::currentTime()
{
return qtAnimation()->currentLoopTime();
}
-void QmlAbstractAnimation::setCurrentTime(int time)
+void QDeclarativeAbstractAnimation::setCurrentTime(int time)
{
qtAnimation()->setCurrentTime(time);
}
-QmlAnimationGroup *QmlAbstractAnimation::group() const
+QDeclarativeAnimationGroup *QDeclarativeAbstractAnimation::group() const
{
- Q_D(const QmlAbstractAnimation);
+ Q_D(const QDeclarativeAbstractAnimation);
return d->group;
}
-void QmlAbstractAnimation::setGroup(QmlAnimationGroup *g)
+void QDeclarativeAbstractAnimation::setGroup(QDeclarativeAnimationGroup *g)
{
- Q_D(QmlAbstractAnimation);
+ Q_D(QDeclarativeAbstractAnimation);
if (d->group == g)
return;
if (d->group)
- static_cast<QmlAnimationGroupPrivate *>(d->group->d_func())->animations.removeAll(this);
+ static_cast<QDeclarativeAnimationGroupPrivate *>(d->group->d_func())->animations.removeAll(this);
d->group = g;
- if (d->group && !static_cast<QmlAnimationGroupPrivate *>(d->group->d_func())->animations.contains(this))
- static_cast<QmlAnimationGroupPrivate *>(d->group->d_func())->animations.append(this);
-
- if (d->group)
- ((QAnimationGroup*)d->group->qtAnimation())->addAnimation(qtAnimation());
+ if (d->group && !static_cast<QDeclarativeAnimationGroupPrivate *>(d->group->d_func())->animations.contains(this))
+ static_cast<QDeclarativeAnimationGroupPrivate *>(d->group->d_func())->animations.append(this);
//if (g) //if removed from a group, then the group should no longer be the parent
setParent(g);
@@ -447,7 +372,7 @@ void QmlAbstractAnimation::setGroup(QmlAnimationGroup *g)
If the animation is already running, calling this method has no effect. The
\c running property will be true following a call to \c start().
*/
-void QmlAbstractAnimation::start()
+void QDeclarativeAbstractAnimation::start()
{
setRunning(true);
}
@@ -459,7 +384,7 @@ void QmlAbstractAnimation::start()
If the animation is already paused, calling this method has no effect. The
\c paused property will be true following a call to \c pause().
*/
-void QmlAbstractAnimation::pause()
+void QDeclarativeAbstractAnimation::pause()
{
setPaused(true);
}
@@ -471,7 +396,7 @@ void QmlAbstractAnimation::pause()
If the animation is not paused, calling this method has no effect. The
\c paused property will be false following a call to \c resume().
*/
-void QmlAbstractAnimation::resume()
+void QDeclarativeAbstractAnimation::resume()
{
setPaused(false);
}
@@ -496,7 +421,7 @@ void QmlAbstractAnimation::resume()
continue running until it completes and then stop. The \c running property
will still become false immediately.
*/
-void QmlAbstractAnimation::stop()
+void QDeclarativeAbstractAnimation::stop()
{
setRunning(false);
}
@@ -508,7 +433,7 @@ void QmlAbstractAnimation::stop()
This is a convenience method, and is equivalent to calling \c stop() and
then \c start().
*/
-void QmlAbstractAnimation::restart()
+void QDeclarativeAbstractAnimation::restart()
{
stop();
start();
@@ -532,16 +457,16 @@ void QmlAbstractAnimation::restart()
a value of 50, while calling \c complete() will set the \c x property to
100, exactly as though the animation had played the whole way through.
*/
-void QmlAbstractAnimation::complete()
+void QDeclarativeAbstractAnimation::complete()
{
if (isRunning()) {
qtAnimation()->setCurrentTime(qtAnimation()->duration());
}
}
-void QmlAbstractAnimation::setTarget(const QmlMetaProperty &p)
+void QDeclarativeAbstractAnimation::setTarget(const QDeclarativeProperty &p)
{
- Q_D(QmlAbstractAnimation);
+ Q_D(QDeclarativeAbstractAnimation);
d->defaultProperty = p;
if (!d->avoidPropertyValueSourceStart)
@@ -553,9 +478,9 @@ void QmlAbstractAnimation::setTarget(const QmlMetaProperty &p)
so this function allows us to do the same thing as setTarget without
that assumption
*/
-void QmlAbstractAnimation::setDefaultTarget(const QmlMetaProperty &p)
+void QDeclarativeAbstractAnimation::setDefaultTarget(const QDeclarativeProperty &p)
{
- Q_D(QmlAbstractAnimation);
+ Q_D(QDeclarativeAbstractAnimation);
d->defaultProperty = p;
}
@@ -564,14 +489,14 @@ void QmlAbstractAnimation::setDefaultTarget(const QmlMetaProperty &p)
because something else (like a Behavior) already has control
over the animation.
*/
-void QmlAbstractAnimation::setDisableUserControl()
+void QDeclarativeAbstractAnimation::setDisableUserControl()
{
- Q_D(QmlAbstractAnimation);
+ Q_D(QDeclarativeAbstractAnimation);
d->disableUserControl = true;
}
-void QmlAbstractAnimation::transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
+void QDeclarativeAbstractAnimation::transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
TransitionDirection direction)
{
Q_UNUSED(actions);
@@ -579,9 +504,9 @@ void QmlAbstractAnimation::transition(QmlStateActions &actions,
Q_UNUSED(direction);
}
-void QmlAbstractAnimation::timelineComplete()
+void QDeclarativeAbstractAnimation::timelineComplete()
{
- Q_D(QmlAbstractAnimation);
+ Q_D(QDeclarativeAbstractAnimation);
setRunning(false);
if (d->alwaysRunToEnd && d->repeat) {
qtAnimation()->setLoopCount(-1);
@@ -589,7 +514,7 @@ void QmlAbstractAnimation::timelineComplete()
}
/*!
- \qmlclass PauseAnimation QmlPauseAnimation
+ \qmlclass PauseAnimation QDeclarativePauseAnimation
\since 4.7
\inherits Animation
\brief The PauseAnimation element provides a pause for an animation.
@@ -608,26 +533,26 @@ void QmlAbstractAnimation::timelineComplete()
*/
/*!
\internal
- \class QmlPauseAnimation
+ \class QDeclarativePauseAnimation
*/
-QML_DEFINE_TYPE(Qt,4,6,PauseAnimation,QmlPauseAnimation)
-QmlPauseAnimation::QmlPauseAnimation(QObject *parent)
-: QmlAbstractAnimation(*(new QmlPauseAnimationPrivate), parent)
+
+QDeclarativePauseAnimation::QDeclarativePauseAnimation(QObject *parent)
+: QDeclarativeAbstractAnimation(*(new QDeclarativePauseAnimationPrivate), parent)
{
- Q_D(QmlPauseAnimation);
+ Q_D(QDeclarativePauseAnimation);
d->init();
}
-QmlPauseAnimation::~QmlPauseAnimation()
+QDeclarativePauseAnimation::~QDeclarativePauseAnimation()
{
}
-void QmlPauseAnimationPrivate::init()
+void QDeclarativePauseAnimationPrivate::init()
{
- Q_Q(QmlPauseAnimation);
+ Q_Q(QDeclarativePauseAnimation);
pa = new QPauseAnimation;
- QmlGraphics_setParent_noEvent(pa, q);
+ QDeclarativeGraphics_setParent_noEvent(pa, q);
}
/*!
@@ -636,34 +561,34 @@ void QmlPauseAnimationPrivate::init()
The default value is 250.
*/
-int QmlPauseAnimation::duration() const
+int QDeclarativePauseAnimation::duration() const
{
- Q_D(const QmlPauseAnimation);
+ Q_D(const QDeclarativePauseAnimation);
return d->pa->duration();
}
-void QmlPauseAnimation::setDuration(int duration)
+void QDeclarativePauseAnimation::setDuration(int duration)
{
if (duration < 0) {
qmlInfo(this) << tr("Cannot set a duration of < 0");
return;
}
- Q_D(QmlPauseAnimation);
+ Q_D(QDeclarativePauseAnimation);
if (d->pa->duration() == duration)
return;
d->pa->setDuration(duration);
emit durationChanged(duration);
}
-QAbstractAnimation *QmlPauseAnimation::qtAnimation()
+QAbstractAnimation *QDeclarativePauseAnimation::qtAnimation()
{
- Q_D(QmlPauseAnimation);
+ Q_D(QDeclarativePauseAnimation);
return d->pa;
}
/*!
- \qmlclass ColorAnimation QmlColorAnimation
+ \qmlclass ColorAnimation QDeclarativeColorAnimation
\since 4.7
\inherits PropertyAnimation
\brief The ColorAnimation element allows you to animate color changes.
@@ -678,19 +603,19 @@ QAbstractAnimation *QmlPauseAnimation::qtAnimation()
*/
/*!
\internal
- \class QmlColorAnimation
+ \class QDeclarativeColorAnimation
*/
-QmlColorAnimation::QmlColorAnimation(QObject *parent)
-: QmlPropertyAnimation(parent)
+QDeclarativeColorAnimation::QDeclarativeColorAnimation(QObject *parent)
+: QDeclarativePropertyAnimation(parent)
{
- Q_D(QmlPropertyAnimation);
+ Q_D(QDeclarativePropertyAnimation);
d->interpolatorType = QMetaType::QColor;
d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
d->defaultToInterpolatorType = true;
}
-QmlColorAnimation::~QmlColorAnimation()
+QDeclarativeColorAnimation::~QDeclarativeColorAnimation()
{
}
@@ -698,36 +623,36 @@ QmlColorAnimation::~QmlColorAnimation()
\qmlproperty color ColorAnimation::from
This property holds the starting color.
*/
-QColor QmlColorAnimation::from() const
+QColor QDeclarativeColorAnimation::from() const
{
- Q_D(const QmlPropertyAnimation);
+ Q_D(const QDeclarativePropertyAnimation);
return d->from.value<QColor>();
}
-void QmlColorAnimation::setFrom(const QColor &f)
+void QDeclarativeColorAnimation::setFrom(const QColor &f)
{
- QmlPropertyAnimation::setFrom(f);
+ QDeclarativePropertyAnimation::setFrom(f);
}
/*!
\qmlproperty color ColorAnimation::to
This property holds the ending color.
*/
-QColor QmlColorAnimation::to() const
+QColor QDeclarativeColorAnimation::to() const
{
- Q_D(const QmlPropertyAnimation);
+ Q_D(const QDeclarativePropertyAnimation);
return d->to.value<QColor>();
}
-void QmlColorAnimation::setTo(const QColor &t)
+void QDeclarativeColorAnimation::setTo(const QColor &t)
{
- QmlPropertyAnimation::setTo(t);
+ QDeclarativePropertyAnimation::setTo(t);
}
-QML_DEFINE_TYPE(Qt,4,6,ColorAnimation,QmlColorAnimation)
+
/*!
- \qmlclass ScriptAction QmlScriptAction
+ \qmlclass ScriptAction QDeclarativeScriptAction
\since 4.7
\inherits Animation
\brief The ScriptAction element allows scripts to be run during an animation.
@@ -735,39 +660,39 @@ QML_DEFINE_TYPE(Qt,4,6,ColorAnimation,QmlColorAnimation)
*/
/*!
\internal
- \class QmlScriptAction
+ \class QDeclarativeScriptAction
*/
-QmlScriptAction::QmlScriptAction(QObject *parent)
- :QmlAbstractAnimation(*(new QmlScriptActionPrivate), parent)
+QDeclarativeScriptAction::QDeclarativeScriptAction(QObject *parent)
+ :QDeclarativeAbstractAnimation(*(new QDeclarativeScriptActionPrivate), parent)
{
- Q_D(QmlScriptAction);
+ Q_D(QDeclarativeScriptAction);
d->init();
}
-QmlScriptAction::~QmlScriptAction()
+QDeclarativeScriptAction::~QDeclarativeScriptAction()
{
}
-void QmlScriptActionPrivate::init()
+void QDeclarativeScriptActionPrivate::init()
{
- Q_Q(QmlScriptAction);
+ Q_Q(QDeclarativeScriptAction);
rsa = new QActionAnimation(&proxy);
- QmlGraphics_setParent_noEvent(rsa, q);
+ QDeclarativeGraphics_setParent_noEvent(rsa, q);
}
/*!
\qmlproperty script ScriptAction::script
This property holds the script to run.
*/
-QmlScriptString QmlScriptAction::script() const
+QDeclarativeScriptString QDeclarativeScriptAction::script() const
{
- Q_D(const QmlScriptAction);
+ Q_D(const QDeclarativeScriptAction);
return d->script;
}
-void QmlScriptAction::setScript(const QmlScriptString &script)
+void QDeclarativeScriptAction::setScript(const QDeclarativeScriptString &script)
{
- Q_D(QmlScriptAction);
+ Q_D(QDeclarativeScriptAction);
d->script = script;
}
@@ -778,46 +703,45 @@ void QmlScriptAction::setScript(const QmlScriptString &script)
This property is only valid when ScriptAction is used as part of a transition.
If both script and stateChangeScriptName are set, stateChangeScriptName will be used.
*/
-QString QmlScriptAction::stateChangeScriptName() const
+QString QDeclarativeScriptAction::stateChangeScriptName() const
{
- Q_D(const QmlScriptAction);
+ Q_D(const QDeclarativeScriptAction);
return d->name;
}
-void QmlScriptAction::setStateChangeScriptName(const QString &name)
+void QDeclarativeScriptAction::setStateChangeScriptName(const QString &name)
{
- Q_D(QmlScriptAction);
+ Q_D(QDeclarativeScriptAction);
d->name = name;
}
-void QmlScriptActionPrivate::execute()
+void QDeclarativeScriptActionPrivate::execute()
{
- QmlScriptString scriptStr = hasRunScriptScript ? runScriptScript : script;
+ QDeclarativeScriptString scriptStr = hasRunScriptScript ? runScriptScript : script;
const QString &str = scriptStr.script();
if (!str.isEmpty()) {
- QmlExpression expr(scriptStr.context(), str, scriptStr.scopeObject());
- expr.setTrackChange(false);
+ QDeclarativeExpression expr(scriptStr.context(), str, scriptStr.scopeObject());
expr.value();
}
}
-void QmlScriptAction::transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
+void QDeclarativeScriptAction::transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
TransitionDirection direction)
{
- Q_D(QmlScriptAction);
+ Q_D(QDeclarativeScriptAction);
Q_UNUSED(modified);
Q_UNUSED(direction);
d->hasRunScriptScript = false;
for (int ii = 0; ii < actions.count(); ++ii) {
- QmlAction &action = actions[ii];
+ QDeclarativeAction &action = actions[ii];
if (action.event && action.event->typeName() == QLatin1String("StateChangeScript")
- && static_cast<QmlStateChangeScript*>(action.event)->name() == d->name) {
+ && static_cast<QDeclarativeStateChangeScript*>(action.event)->name() == d->name) {
//### how should we handle reverse direction?
- d->runScriptScript = static_cast<QmlStateChangeScript*>(action.event)->script();
+ d->runScriptScript = static_cast<QDeclarativeStateChangeScript*>(action.event)->script();
d->hasRunScriptScript = true;
action.actionDone = true;
break; //assumes names are unique
@@ -825,16 +749,16 @@ void QmlScriptAction::transition(QmlStateActions &actions,
}
}
-QAbstractAnimation *QmlScriptAction::qtAnimation()
+QAbstractAnimation *QDeclarativeScriptAction::qtAnimation()
{
- Q_D(QmlScriptAction);
+ Q_D(QDeclarativeScriptAction);
return d->rsa;
}
-QML_DEFINE_TYPE(Qt,4,6,ScriptAction,QmlScriptAction)
+
/*!
- \qmlclass PropertyAction QmlPropertyAction
+ \qmlclass PropertyAction QDeclarativePropertyAction
\since 4.7
\inherits Animation
\brief The PropertyAction element allows immediate property changes during animation.
@@ -854,24 +778,24 @@ QML_DEFINE_TYPE(Qt,4,6,ScriptAction,QmlScriptAction)
*/
/*!
\internal
- \class QmlPropertyAction
+ \class QDeclarativePropertyAction
*/
-QmlPropertyAction::QmlPropertyAction(QObject *parent)
-: QmlAbstractAnimation(*(new QmlPropertyActionPrivate), parent)
+QDeclarativePropertyAction::QDeclarativePropertyAction(QObject *parent)
+: QDeclarativeAbstractAnimation(*(new QDeclarativePropertyActionPrivate), parent)
{
- Q_D(QmlPropertyAction);
+ Q_D(QDeclarativePropertyAction);
d->init();
}
-QmlPropertyAction::~QmlPropertyAction()
+QDeclarativePropertyAction::~QDeclarativePropertyAction()
{
}
-void QmlPropertyActionPrivate::init()
+void QDeclarativePropertyActionPrivate::init()
{
- Q_Q(QmlPropertyAction);
+ Q_Q(QDeclarativePropertyAction);
spa = new QActionAnimation;
- QmlGraphics_setParent_noEvent(spa, q);
+ QDeclarativeGraphics_setParent_noEvent(spa, q);
}
/*!
@@ -882,30 +806,30 @@ void QmlPropertyActionPrivate::init()
is being used. Refer to the \l animation documentation for details.
*/
-QObject *QmlPropertyAction::target() const
+QObject *QDeclarativePropertyAction::target() const
{
- Q_D(const QmlPropertyAction);
+ Q_D(const QDeclarativePropertyAction);
return d->target;
}
-void QmlPropertyAction::setTarget(QObject *o)
+void QDeclarativePropertyAction::setTarget(QObject *o)
{
- Q_D(QmlPropertyAction);
+ Q_D(QDeclarativePropertyAction);
if (d->target == o)
return;
d->target = o;
emit targetChanged(d->target, d->propertyName);
}
-QString QmlPropertyAction::property() const
+QString QDeclarativePropertyAction::property() const
{
- Q_D(const QmlPropertyAction);
+ Q_D(const QDeclarativePropertyAction);
return d->propertyName;
}
-void QmlPropertyAction::setProperty(const QString &n)
+void QDeclarativePropertyAction::setProperty(const QString &n)
{
- Q_D(QmlPropertyAction);
+ Q_D(QDeclarativePropertyAction);
if (d->propertyName == n)
return;
d->propertyName = n;
@@ -927,25 +851,25 @@ void QmlPropertyAction::setProperty(const QString &n)
\sa exclude
*/
-QString QmlPropertyAction::properties() const
+QString QDeclarativePropertyAction::properties() const
{
- Q_D(const QmlPropertyAction);
+ Q_D(const QDeclarativePropertyAction);
return d->properties;
}
-void QmlPropertyAction::setProperties(const QString &p)
+void QDeclarativePropertyAction::setProperties(const QString &p)
{
- Q_D(QmlPropertyAction);
+ Q_D(QDeclarativePropertyAction);
if (d->properties == p)
return;
d->properties = p;
emit propertiesChanged(p);
}
-QmlListProperty<QObject> QmlPropertyAction::targets()
+QDeclarativeListProperty<QObject> QDeclarativePropertyAction::targets()
{
- Q_D(QmlPropertyAction);
- return QmlListProperty<QObject>(this, d->targets);
+ Q_D(QDeclarativePropertyAction);
+ return QDeclarativeListProperty<QObject>(this, d->targets);
}
/*!
@@ -953,10 +877,10 @@ QmlListProperty<QObject> QmlPropertyAction::targets()
This property holds the objects not to be affected by this animation.
\sa targets
*/
-QmlListProperty<QObject> QmlPropertyAction::exclude()
+QDeclarativeListProperty<QObject> QDeclarativePropertyAction::exclude()
{
- Q_D(QmlPropertyAction);
- return QmlListProperty<QObject>(this, d->exclude);
+ Q_D(QDeclarativePropertyAction);
+ return QDeclarativeListProperty<QObject>(this, d->exclude);
}
/*!
@@ -964,42 +888,42 @@ QmlListProperty<QObject> QmlPropertyAction::exclude()
This property holds the value to be set on the property.
If not set, then the value defined for the end state of the transition.
*/
-QVariant QmlPropertyAction::value() const
+QVariant QDeclarativePropertyAction::value() const
{
- Q_D(const QmlPropertyAction);
+ Q_D(const QDeclarativePropertyAction);
return d->value;
}
-void QmlPropertyAction::setValue(const QVariant &v)
+void QDeclarativePropertyAction::setValue(const QVariant &v)
{
- Q_D(QmlPropertyAction);
+ Q_D(QDeclarativePropertyAction);
if (d->value.isNull || d->value != v) {
d->value = v;
emit valueChanged(v);
}
}
-QAbstractAnimation *QmlPropertyAction::qtAnimation()
+QAbstractAnimation *QDeclarativePropertyAction::qtAnimation()
{
- Q_D(QmlPropertyAction);
+ Q_D(QDeclarativePropertyAction);
return d->spa;
}
-void QmlPropertyAction::transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
+void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
TransitionDirection direction)
{
- Q_D(QmlPropertyAction);
+ Q_D(QDeclarativePropertyAction);
Q_UNUSED(direction);
- struct QmlSetPropertyAnimationAction : public QAbstractAnimationAction
+ struct QDeclarativeSetPropertyAnimationAction : public QAbstractAnimationAction
{
- QmlStateActions actions;
+ QDeclarativeStateActions actions;
virtual void doAction()
{
for (int ii = 0; ii < actions.count(); ++ii) {
- const QmlAction &action = actions.at(ii);
- action.property.write(action.toValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
+ const QDeclarativeAction &action = actions.at(ii);
+ QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
}
}
};
@@ -1021,22 +945,22 @@ void QmlPropertyAction::transition(QmlStateActions &actions,
targets << d->defaultProperty.object();
}
- QmlSetPropertyAnimationAction *data = new QmlSetPropertyAnimationAction;
+ QDeclarativeSetPropertyAnimationAction *data = new QDeclarativeSetPropertyAnimationAction;
bool hasExplicit = false;
//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;
+ QDeclarativeAction 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());
+ QDeclarativePropertyAnimationPrivate::convertVariant(myAction.toValue, myAction.property.propertyType());
data->actions << myAction;
hasExplicit = true;
for (int ii = 0; ii < actions.count(); ++ii) {
- QmlAction &action = actions[ii];
+ QDeclarativeAction &action = actions[ii];
if (action.property.object() == myAction.property.object() &&
myAction.property.name() == action.property.name()) {
modified << action.property;
@@ -1050,7 +974,7 @@ void QmlPropertyAction::transition(QmlStateActions &actions,
if (!hasExplicit)
for (int ii = 0; ii < actions.count(); ++ii) {
- QmlAction &action = actions[ii];
+ QDeclarativeAction &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
@@ -1061,11 +985,11 @@ void QmlPropertyAction::transition(QmlStateActions &actions,
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;
+ QDeclarativeAction myAction = action;
if (d->value.isValid())
myAction.toValue = d->value;
- QmlPropertyAnimationPrivate::convertVariant(myAction.toValue, myAction.property.propertyType());
+ QDeclarativePropertyAnimationPrivate::convertVariant(myAction.toValue, myAction.property.propertyType());
modified << action.property;
data->actions << myAction;
@@ -1080,10 +1004,10 @@ void QmlPropertyAction::transition(QmlStateActions &actions,
}
}
-QML_DEFINE_TYPE(Qt,4,6,PropertyAction,QmlPropertyAction)
+
/*!
- \qmlclass ParentAction QmlParentAction
+ \qmlclass ParentAction QDeclarativeParentAction
\since 4.7
\inherits Animation
\brief The ParentAction element allows parent changes during animation.
@@ -1117,22 +1041,22 @@ QML_DEFINE_TYPE(Qt,4,6,PropertyAction,QmlPropertyAction)
The ParentAction is immediate - it is not animated in any way.
*/
-QmlParentAction::QmlParentAction(QObject *parent)
-: QmlAbstractAnimation(*(new QmlParentActionPrivate), parent)
+QDeclarativeParentAction::QDeclarativeParentAction(QObject *parent)
+: QDeclarativeAbstractAnimation(*(new QDeclarativeParentActionPrivate), parent)
{
- Q_D(QmlParentAction);
+ Q_D(QDeclarativeParentAction);
d->init();
}
-QmlParentAction::~QmlParentAction()
+QDeclarativeParentAction::~QDeclarativeParentAction()
{
}
-void QmlParentActionPrivate::init()
+void QDeclarativeParentActionPrivate::init()
{
- Q_Q(QmlParentAction);
+ Q_Q(QDeclarativeParentAction);
cpa = new QActionAnimation;
- QmlGraphics_setParent_noEvent(cpa, q);
+ QDeclarativeGraphics_setParent_noEvent(cpa, q);
}
/*!
@@ -1163,15 +1087,15 @@ void QmlParentActionPrivate::init()
\endqml
*/
-QmlGraphicsItem *QmlParentAction::object() const
+QDeclarativeItem *QDeclarativeParentAction::object() const
{
- Q_D(const QmlParentAction);
+ Q_D(const QDeclarativeParentAction);
return d->pcTarget;
}
-void QmlParentAction::setObject(QmlGraphicsItem *target)
+void QDeclarativeParentAction::setObject(QDeclarativeItem *target)
{
- Q_D(QmlParentAction);
+ Q_D(QDeclarativeParentAction);
d->pcTarget = target;
}
@@ -1180,52 +1104,52 @@ void QmlParentAction::setObject(QmlGraphicsItem *target)
The item to reparent to (i.e. the new parent).
*/
-QmlGraphicsItem *QmlParentAction::parent() const
+QDeclarativeItem *QDeclarativeParentAction::parent() const
{
- Q_D(const QmlParentAction);
+ Q_D(const QDeclarativeParentAction);
return d->pcParent;
}
-void QmlParentAction::setParent(QmlGraphicsItem *parent)
+void QDeclarativeParentAction::setParent(QDeclarativeItem *parent)
{
- Q_D(QmlParentAction);
+ Q_D(QDeclarativeParentAction);
d->pcParent = parent;
}
-void QmlParentActionPrivate::doAction()
+void QDeclarativeParentActionPrivate::doAction()
{
- QmlParentChange pc;
+ QDeclarativeParentChange pc;
pc.setObject(pcTarget);
pc.setParent(pcParent);
pc.execute();
}
-QAbstractAnimation *QmlParentAction::qtAnimation()
+QAbstractAnimation *QDeclarativeParentAction::qtAnimation()
{
- Q_D(QmlParentAction);
+ Q_D(QDeclarativeParentAction);
return d->cpa;
}
-void QmlParentAction::transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
+void QDeclarativeParentAction::transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
TransitionDirection direction)
{
- Q_D(QmlParentAction);
+ Q_D(QDeclarativeParentAction);
Q_UNUSED(modified);
Q_UNUSED(direction);
- struct QmlParentActionData : public QAbstractAnimationAction
+ struct QDeclarativeParentActionData : public QAbstractAnimationAction
{
- QmlParentActionData(): pc(0) {}
- ~QmlParentActionData() { delete pc; }
+ QDeclarativeParentActionData(): pc(0) {}
+ ~QDeclarativeParentActionData() { delete pc; }
- QmlStateActions actions;
+ QDeclarativeStateActions actions;
bool reverse;
- QmlParentChange *pc;
+ QDeclarativeParentChange *pc;
virtual void doAction()
{
for (int ii = 0; ii < actions.count(); ++ii) {
- const QmlAction &action = actions.at(ii);
+ const QDeclarativeAction &action = actions.at(ii);
if (reverse)
action.event->reverse();
else
@@ -1234,15 +1158,15 @@ void QmlParentAction::transition(QmlStateActions &actions,
}
};
- QmlParentActionData *data = new QmlParentActionData;
+ QDeclarativeParentActionData *data = new QDeclarativeParentActionData;
//### need to correctly handle modified/done
bool hasExplicit = false;
if (d->pcTarget && d->pcParent) {
data->reverse = false;
- QmlAction myAction;
- QmlParentChange *pc = new QmlParentChange;
+ QDeclarativeAction myAction;
+ QDeclarativeParentChange *pc = new QDeclarativeParentChange;
pc->setObject(d->pcTarget);
pc->setParent(d->pcParent);
myAction.event = pc;
@@ -1253,19 +1177,19 @@ void QmlParentAction::transition(QmlStateActions &actions,
if (!hasExplicit)
for (int ii = 0; ii < actions.count(); ++ii) {
- QmlAction &action = actions[ii];
+ QDeclarativeAction &action = actions[ii];
if (action.event && action.event->typeName() == QLatin1String("ParentChange")
- && (!d->pcTarget || static_cast<QmlParentChange*>(action.event)->object() == d->pcTarget)) {
- QmlAction myAction = action;
+ && (!d->pcTarget || static_cast<QDeclarativeParentChange*>(action.event)->object() == d->pcTarget)) {
+ QDeclarativeAction myAction = action;
data->reverse = action.reverseEvent;
//### this logic differs from PropertyAnimation
// (probably a result of modified vs. done)
if (d->pcParent) {
//### should we disallow this case?
- QmlParentChange *pc = new QmlParentChange;
+ QDeclarativeParentChange *pc = new QDeclarativeParentChange;
pc->setObject(d->pcTarget);
- pc->setParent(static_cast<QmlParentChange*>(action.event)->parent());
+ pc->setParent(static_cast<QDeclarativeParentChange*>(action.event)->parent());
myAction.event = pc;
data->pc = pc;
data->actions << myAction;
@@ -1284,10 +1208,10 @@ void QmlParentAction::transition(QmlStateActions &actions,
}
}
-QML_DEFINE_TYPE(Qt,4,6,ParentAction,QmlParentAction)
+
/*!
- \qmlclass NumberAnimation QmlNumberAnimation
+ \qmlclass NumberAnimation QDeclarativeNumberAnimation
\since 4.7
\inherits PropertyAnimation
\brief The NumberAnimation element allows you to animate changes in properties of type qreal.
@@ -1301,18 +1225,18 @@ QML_DEFINE_TYPE(Qt,4,6,ParentAction,QmlParentAction)
/*!
\internal
- \class QmlNumberAnimation
+ \class QDeclarativeNumberAnimation
*/
-QmlNumberAnimation::QmlNumberAnimation(QObject *parent)
-: QmlPropertyAnimation(parent)
+QDeclarativeNumberAnimation::QDeclarativeNumberAnimation(QObject *parent)
+: QDeclarativePropertyAnimation(parent)
{
- Q_D(QmlPropertyAnimation);
+ Q_D(QDeclarativePropertyAnimation);
d->interpolatorType = QMetaType::QReal;
d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
}
-QmlNumberAnimation::~QmlNumberAnimation()
+QDeclarativeNumberAnimation::~QDeclarativeNumberAnimation()
{
}
@@ -1321,15 +1245,15 @@ QmlNumberAnimation::~QmlNumberAnimation()
This property holds the starting value.
If not set, then the value defined in the start state of the transition.
*/
-qreal QmlNumberAnimation::from() const
+qreal QDeclarativeNumberAnimation::from() const
{
- Q_D(const QmlPropertyAnimation);
+ Q_D(const QDeclarativePropertyAnimation);
return d->from.toReal();
}
-void QmlNumberAnimation::setFrom(qreal f)
+void QDeclarativeNumberAnimation::setFrom(qreal f)
{
- QmlPropertyAnimation::setFrom(f);
+ QDeclarativePropertyAnimation::setFrom(f);
}
/*!
@@ -1337,21 +1261,21 @@ void QmlNumberAnimation::setFrom(qreal f)
This property holds the ending value.
If not set, then the value defined in the end state of the transition or Behavior.
*/
-qreal QmlNumberAnimation::to() const
+qreal QDeclarativeNumberAnimation::to() const
{
- Q_D(const QmlPropertyAnimation);
+ Q_D(const QDeclarativePropertyAnimation);
return d->to.toReal();
}
-void QmlNumberAnimation::setTo(qreal t)
+void QDeclarativeNumberAnimation::setTo(qreal t)
{
- QmlPropertyAnimation::setTo(t);
+ QDeclarativePropertyAnimation::setTo(t);
}
-QML_DEFINE_TYPE(Qt,4,6,NumberAnimation,QmlNumberAnimation)
+
/*!
- \qmlclass Vector3dAnimation QmlVector3dAnimation
+ \qmlclass Vector3dAnimation QDeclarativeVector3dAnimation
\since 4.7
\inherits PropertyAnimation
\brief The Vector3dAnimation element allows you to animate changes in properties of type QVector3d.
@@ -1359,19 +1283,19 @@ QML_DEFINE_TYPE(Qt,4,6,NumberAnimation,QmlNumberAnimation)
/*!
\internal
- \class QmlVector3dAnimation
+ \class QDeclarativeVector3dAnimation
*/
-QmlVector3dAnimation::QmlVector3dAnimation(QObject *parent)
-: QmlPropertyAnimation(parent)
+QDeclarativeVector3dAnimation::QDeclarativeVector3dAnimation(QObject *parent)
+: QDeclarativePropertyAnimation(parent)
{
- Q_D(QmlPropertyAnimation);
+ Q_D(QDeclarativePropertyAnimation);
d->interpolatorType = QMetaType::QVector3D;
d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
d->defaultToInterpolatorType = true;
}
-QmlVector3dAnimation::~QmlVector3dAnimation()
+QDeclarativeVector3dAnimation::~QDeclarativeVector3dAnimation()
{
}
@@ -1380,15 +1304,15 @@ QmlVector3dAnimation::~QmlVector3dAnimation()
This property holds the starting value.
If not set, then the value defined in the start state of the transition.
*/
-QVector3D QmlVector3dAnimation::from() const
+QVector3D QDeclarativeVector3dAnimation::from() const
{
- Q_D(const QmlPropertyAnimation);
+ Q_D(const QDeclarativePropertyAnimation);
return d->from.value<QVector3D>();
}
-void QmlVector3dAnimation::setFrom(QVector3D f)
+void QDeclarativeVector3dAnimation::setFrom(QVector3D f)
{
- QmlPropertyAnimation::setFrom(f);
+ QDeclarativePropertyAnimation::setFrom(f);
}
/*!
@@ -1396,21 +1320,21 @@ void QmlVector3dAnimation::setFrom(QVector3D f)
This property holds the ending value.
If not set, then the value defined in the end state of the transition or Behavior.
*/
-QVector3D QmlVector3dAnimation::to() const
+QVector3D QDeclarativeVector3dAnimation::to() const
{
- Q_D(const QmlPropertyAnimation);
+ Q_D(const QDeclarativePropertyAnimation);
return d->to.value<QVector3D>();
}
-void QmlVector3dAnimation::setTo(QVector3D t)
+void QDeclarativeVector3dAnimation::setTo(QVector3D t)
{
- QmlPropertyAnimation::setTo(t);
+ QDeclarativePropertyAnimation::setTo(t);
}
-QML_DEFINE_TYPE(Qt,4,6,Vector3dAnimation,QmlVector3dAnimation)
+
/*!
- \qmlclass RotationAnimation QmlRotationAnimation
+ \qmlclass RotationAnimation QDeclarativeRotationAnimation
\inherits PropertyAnimation
\brief The RotationAnimation element allows you to animate rotations.
@@ -1437,7 +1361,7 @@ QML_DEFINE_TYPE(Qt,4,6,Vector3dAnimation,QmlVector3dAnimation)
/*!
\internal
- \class QmlRotationAnimation
+ \class QDeclarativeRotationAnimation
*/
QVariant _q_interpolateShortestRotation(qreal &f, qreal &t, qreal progress)
@@ -1477,16 +1401,16 @@ QVariant _q_interpolateCounterclockwiseRotation(qreal &f, qreal &t, qreal progre
return QVariant(f + (newt - f) * progress);
}
-QmlRotationAnimation::QmlRotationAnimation(QObject *parent)
-: QmlPropertyAnimation(*(new QmlRotationAnimationPrivate), parent)
+QDeclarativeRotationAnimation::QDeclarativeRotationAnimation(QObject *parent)
+: QDeclarativePropertyAnimation(*(new QDeclarativeRotationAnimationPrivate), parent)
{
- Q_D(QmlRotationAnimation);
+ Q_D(QDeclarativeRotationAnimation);
d->interpolatorType = QMetaType::QReal;
d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&_q_interpolateShortestRotation);
d->defaultProperties = QLatin1String("rotation,angle");
}
-QmlRotationAnimation::~QmlRotationAnimation()
+QDeclarativeRotationAnimation::~QDeclarativeRotationAnimation()
{
}
@@ -1495,15 +1419,15 @@ QmlRotationAnimation::~QmlRotationAnimation()
This property holds the starting value.
If not set, then the value defined in the start state of the transition.
*/
-qreal QmlRotationAnimation::from() const
+qreal QDeclarativeRotationAnimation::from() const
{
- Q_D(const QmlRotationAnimation);
+ Q_D(const QDeclarativeRotationAnimation);
return d->from.toReal();
}
-void QmlRotationAnimation::setFrom(qreal f)
+void QDeclarativeRotationAnimation::setFrom(qreal f)
{
- QmlPropertyAnimation::setFrom(f);
+ QDeclarativePropertyAnimation::setFrom(f);
}
/*!
@@ -1511,15 +1435,15 @@ void QmlRotationAnimation::setFrom(qreal f)
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
+qreal QDeclarativeRotationAnimation::to() const
{
- Q_D(const QmlRotationAnimation);
+ Q_D(const QDeclarativeRotationAnimation);
return d->to.toReal();
}
-void QmlRotationAnimation::setTo(qreal t)
+void QDeclarativeRotationAnimation::setTo(qreal t)
{
- QmlPropertyAnimation::setTo(t);
+ QDeclarativePropertyAnimation::setTo(t);
}
/*!
@@ -1547,15 +1471,15 @@ void QmlRotationAnimation::setTo(qreal t)
The default direction is Shortest.
*/
-QmlRotationAnimation::RotationDirection QmlRotationAnimation::direction() const
+QDeclarativeRotationAnimation::RotationDirection QDeclarativeRotationAnimation::direction() const
{
- Q_D(const QmlRotationAnimation);
+ Q_D(const QDeclarativeRotationAnimation);
return d->direction;
}
-void QmlRotationAnimation::setDirection(QmlRotationAnimation::RotationDirection direction)
+void QDeclarativeRotationAnimation::setDirection(QDeclarativeRotationAnimation::RotationDirection direction)
{
- Q_D(QmlRotationAnimation);
+ Q_D(QDeclarativeRotationAnimation);
if (d->direction == direction)
return;
@@ -1578,25 +1502,31 @@ void QmlRotationAnimation::setDirection(QmlRotationAnimation::RotationDirection
emit directionChanged();
}
-QML_DEFINE_TYPE(Qt,4,6,RotationAnimation,QmlRotationAnimation)
-QmlAnimationGroup::QmlAnimationGroup(QObject *parent)
-: QmlAbstractAnimation(*(new QmlAnimationGroupPrivate), parent)
+
+QDeclarativeAnimationGroup::QDeclarativeAnimationGroup(QObject *parent)
+: QDeclarativeAbstractAnimation(*(new QDeclarativeAnimationGroupPrivate), parent)
+{
+}
+
+QDeclarativeAnimationGroup::QDeclarativeAnimationGroup(QDeclarativeAnimationGroupPrivate &dd, QObject *parent)
+ : QDeclarativeAbstractAnimation(dd, parent)
{
}
-void QmlAnimationGroupPrivate::append_animation(QmlListProperty<QmlAbstractAnimation> *list, QmlAbstractAnimation *a)
+void QDeclarativeAnimationGroupPrivate::append_animation(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list, QDeclarativeAbstractAnimation *a)
{
- QmlAnimationGroup *q = qobject_cast<QmlAnimationGroup *>(list->object);
+ QDeclarativeAnimationGroup *q = qobject_cast<QDeclarativeAnimationGroup *>(list->object);
if (q) {
q->d_func()->animations.append(a);
a->setGroup(q);
+ q->d_func()->ag->addAnimation(a->qtAnimation());
}
}
-void QmlAnimationGroupPrivate::clear_animation(QmlListProperty<QmlAbstractAnimation> *list)
+void QDeclarativeAnimationGroupPrivate::clear_animation(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list)
{
- QmlAnimationGroup *q = qobject_cast<QmlAnimationGroup *>(list->object);
+ QDeclarativeAnimationGroup *q = qobject_cast<QDeclarativeAnimationGroup *>(list->object);
if (q) {
for (int i = 0; i < q->d_func()->animations.count(); ++i)
q->d_func()->animations.at(i)->setGroup(0);
@@ -1604,21 +1534,21 @@ void QmlAnimationGroupPrivate::clear_animation(QmlListProperty<QmlAbstractAnimat
}
}
-QmlAnimationGroup::~QmlAnimationGroup()
+QDeclarativeAnimationGroup::~QDeclarativeAnimationGroup()
{
}
-QmlListProperty<QmlAbstractAnimation> QmlAnimationGroup::animations()
+QDeclarativeListProperty<QDeclarativeAbstractAnimation> QDeclarativeAnimationGroup::animations()
{
- Q_D(QmlAnimationGroup);
- QmlListProperty<QmlAbstractAnimation> list(this, d->animations);
- list.append = &QmlAnimationGroupPrivate::append_animation;
- list.clear = &QmlAnimationGroupPrivate::clear_animation;
+ Q_D(QDeclarativeAnimationGroup);
+ QDeclarativeListProperty<QDeclarativeAbstractAnimation> list(this, d->animations);
+ list.append = &QDeclarativeAnimationGroupPrivate::append_animation;
+ list.clear = &QDeclarativeAnimationGroupPrivate::clear_animation;
return list;
}
/*!
- \qmlclass SequentialAnimation QmlSequentialAnimation
+ \qmlclass SequentialAnimation QDeclarativeSequentialAnimation
\since 4.7
\inherits Animation
\brief The SequentialAnimation element allows you to run animations sequentially.
@@ -1638,28 +1568,28 @@ QmlListProperty<QmlAbstractAnimation> QmlAnimationGroup::animations()
\sa ParallelAnimation
*/
-QmlSequentialAnimation::QmlSequentialAnimation(QObject *parent) :
- QmlAnimationGroup(parent)
+QDeclarativeSequentialAnimation::QDeclarativeSequentialAnimation(QObject *parent) :
+ QDeclarativeAnimationGroup(parent)
{
- Q_D(QmlAnimationGroup);
+ Q_D(QDeclarativeAnimationGroup);
d->ag = new QSequentialAnimationGroup(this);
}
-QmlSequentialAnimation::~QmlSequentialAnimation()
+QDeclarativeSequentialAnimation::~QDeclarativeSequentialAnimation()
{
}
-QAbstractAnimation *QmlSequentialAnimation::qtAnimation()
+QAbstractAnimation *QDeclarativeSequentialAnimation::qtAnimation()
{
- Q_D(QmlAnimationGroup);
+ Q_D(QDeclarativeAnimationGroup);
return d->ag;
}
-void QmlSequentialAnimation::transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
+void QDeclarativeSequentialAnimation::transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
TransitionDirection direction)
{
- Q_D(QmlAnimationGroup);
+ Q_D(QDeclarativeAnimationGroup);
int inc = 1;
int from = 0;
@@ -1676,10 +1606,10 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions,
}
}
-QML_DEFINE_TYPE(Qt,4,6,SequentialAnimation,QmlSequentialAnimation)
+
/*!
- \qmlclass ParallelAnimation QmlParallelAnimation
+ \qmlclass ParallelAnimation QDeclarativeParallelAnimation
\since 4.7
\inherits Animation
\brief The ParallelAnimation element allows you to run animations in parallel.
@@ -1700,31 +1630,31 @@ QML_DEFINE_TYPE(Qt,4,6,SequentialAnimation,QmlSequentialAnimation)
*/
/*!
\internal
- \class QmlParallelAnimation
+ \class QDeclarativeParallelAnimation
*/
-QmlParallelAnimation::QmlParallelAnimation(QObject *parent) :
- QmlAnimationGroup(parent)
+QDeclarativeParallelAnimation::QDeclarativeParallelAnimation(QObject *parent) :
+ QDeclarativeAnimationGroup(parent)
{
- Q_D(QmlAnimationGroup);
+ Q_D(QDeclarativeAnimationGroup);
d->ag = new QParallelAnimationGroup(this);
}
-QmlParallelAnimation::~QmlParallelAnimation()
+QDeclarativeParallelAnimation::~QDeclarativeParallelAnimation()
{
}
-QAbstractAnimation *QmlParallelAnimation::qtAnimation()
+QAbstractAnimation *QDeclarativeParallelAnimation::qtAnimation()
{
- Q_D(QmlAnimationGroup);
+ Q_D(QDeclarativeAnimationGroup);
return d->ag;
}
-void QmlParallelAnimation::transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
+void QDeclarativeParallelAnimation::transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
TransitionDirection direction)
{
- Q_D(QmlAnimationGroup);
+ Q_D(QDeclarativeAnimationGroup);
bool valid = d->defaultProperty.isValid();
for (int ii = 0; ii < d->animations.count(); ++ii) {
if (valid)
@@ -1733,10 +1663,10 @@ void QmlParallelAnimation::transition(QmlStateActions &actions,
}
}
-QML_DEFINE_TYPE(Qt,4,6,ParallelAnimation,QmlParallelAnimation)
+
//convert a variant from string type to another animatable type
-void QmlPropertyAnimationPrivate::convertVariant(QVariant &variant, int type)
+void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int type)
{
if (variant.userType() != QVariant::String) {
variant.convert((QVariant::Type)type);
@@ -1745,40 +1675,40 @@ void QmlPropertyAnimationPrivate::convertVariant(QVariant &variant, int type)
switch (type) {
case QVariant::Rect: {
- variant.setValue(QmlStringConverters::rectFFromString(variant.toString()).toRect());
+ variant.setValue(QDeclarativeStringConverters::rectFFromString(variant.toString()).toRect());
break;
}
case QVariant::RectF: {
- variant.setValue(QmlStringConverters::rectFFromString(variant.toString()));
+ variant.setValue(QDeclarativeStringConverters::rectFFromString(variant.toString()));
break;
}
case QVariant::Point: {
- variant.setValue(QmlStringConverters::pointFFromString(variant.toString()).toPoint());
+ variant.setValue(QDeclarativeStringConverters::pointFFromString(variant.toString()).toPoint());
break;
}
case QVariant::PointF: {
- variant.setValue(QmlStringConverters::pointFFromString(variant.toString()));
+ variant.setValue(QDeclarativeStringConverters::pointFFromString(variant.toString()));
break;
}
case QVariant::Size: {
- variant.setValue(QmlStringConverters::sizeFFromString(variant.toString()).toSize());
+ variant.setValue(QDeclarativeStringConverters::sizeFFromString(variant.toString()).toSize());
break;
}
case QVariant::SizeF: {
- variant.setValue(QmlStringConverters::sizeFFromString(variant.toString()));
+ variant.setValue(QDeclarativeStringConverters::sizeFFromString(variant.toString()));
break;
}
case QVariant::Color: {
- variant.setValue(QmlStringConverters::colorFromString(variant.toString()));
+ variant.setValue(QDeclarativeStringConverters::colorFromString(variant.toString()));
break;
}
case QVariant::Vector3D: {
- variant.setValue(QmlStringConverters::vector3DFromString(variant.toString()));
+ variant.setValue(QDeclarativeStringConverters::vector3DFromString(variant.toString()));
break;
}
default:
if ((uint)type >= QVariant::UserType) {
- QmlMetaType::StringConverter converter = QmlMetaType::customStringConverter(type);
+ QDeclarativeMetaType::StringConverter converter = QDeclarativeMetaType::customStringConverter(type);
if (converter)
variant = converter(variant.toString());
} else
@@ -1788,7 +1718,7 @@ void QmlPropertyAnimationPrivate::convertVariant(QVariant &variant, int type)
}
/*!
- \qmlclass PropertyAnimation QmlPropertyAnimation
+ \qmlclass PropertyAnimation QDeclarativePropertyAnimation
\since 4.7
\inherits Animation
\brief The PropertyAnimation element allows you to animate property changes.
@@ -1845,29 +1775,29 @@ void QmlPropertyAnimationPrivate::convertVariant(QVariant &variant, int type)
as the \l{QML Animation} introduction.
*/
-QmlPropertyAnimation::QmlPropertyAnimation(QObject *parent)
-: QmlAbstractAnimation(*(new QmlPropertyAnimationPrivate), parent)
+QDeclarativePropertyAnimation::QDeclarativePropertyAnimation(QObject *parent)
+: QDeclarativeAbstractAnimation(*(new QDeclarativePropertyAnimationPrivate), parent)
{
- Q_D(QmlPropertyAnimation);
+ Q_D(QDeclarativePropertyAnimation);
d->init();
}
-QmlPropertyAnimation::QmlPropertyAnimation(QmlPropertyAnimationPrivate &dd, QObject *parent)
-: QmlAbstractAnimation(dd, parent)
+QDeclarativePropertyAnimation::QDeclarativePropertyAnimation(QDeclarativePropertyAnimationPrivate &dd, QObject *parent)
+: QDeclarativeAbstractAnimation(dd, parent)
{
- Q_D(QmlPropertyAnimation);
+ Q_D(QDeclarativePropertyAnimation);
d->init();
}
-QmlPropertyAnimation::~QmlPropertyAnimation()
+QDeclarativePropertyAnimation::~QDeclarativePropertyAnimation()
{
}
-void QmlPropertyAnimationPrivate::init()
+void QDeclarativePropertyAnimationPrivate::init()
{
- Q_Q(QmlPropertyAnimation);
- va = new QmlTimeLineValueAnimator;
- QmlGraphics_setParent_noEvent(va, q);
+ Q_Q(QDeclarativePropertyAnimation);
+ va = new QDeclarativeTimeLineValueAnimator;
+ QDeclarativeGraphics_setParent_noEvent(va, q);
}
/*!
@@ -1876,20 +1806,20 @@ void QmlPropertyAnimationPrivate::init()
The default value is 250.
*/
-int QmlPropertyAnimation::duration() const
+int QDeclarativePropertyAnimation::duration() const
{
- Q_D(const QmlPropertyAnimation);
+ Q_D(const QDeclarativePropertyAnimation);
return d->va->duration();
}
-void QmlPropertyAnimation::setDuration(int duration)
+void QDeclarativePropertyAnimation::setDuration(int duration)
{
if (duration < 0) {
qmlInfo(this) << tr("Cannot set a duration of < 0");
return;
}
- Q_D(QmlPropertyAnimation);
+ Q_D(QDeclarativePropertyAnimation);
if (d->va->duration() == duration)
return;
d->va->setDuration(duration);
@@ -1901,15 +1831,15 @@ void QmlPropertyAnimation::setDuration(int duration)
This property holds the starting value.
If not set, then the value defined in the start state of the transition.
*/
-QVariant QmlPropertyAnimation::from() const
+QVariant QDeclarativePropertyAnimation::from() const
{
- Q_D(const QmlPropertyAnimation);
+ Q_D(const QDeclarativePropertyAnimation);
return d->from;
}
-void QmlPropertyAnimation::setFrom(const QVariant &f)
+void QDeclarativePropertyAnimation::setFrom(const QVariant &f)
{
- Q_D(QmlPropertyAnimation);
+ Q_D(QDeclarativePropertyAnimation);
if (d->fromIsDefined && f == d->from)
return;
d->from = f;
@@ -1922,15 +1852,15 @@ void QmlPropertyAnimation::setFrom(const QVariant &f)
This property holds the ending value.
If not set, then the value defined in the end state of the transition or Behavior.
*/
-QVariant QmlPropertyAnimation::to() const
+QVariant QDeclarativePropertyAnimation::to() const
{
- Q_D(const QmlPropertyAnimation);
+ Q_D(const QDeclarativePropertyAnimation);
return d->to;
}
-void QmlPropertyAnimation::setTo(const QVariant &t)
+void QDeclarativePropertyAnimation::setTo(const QVariant &t)
{
- Q_D(QmlPropertyAnimation);
+ Q_D(QDeclarativePropertyAnimation);
if (d->toIsDefined && t == d->to)
return;
d->to = t;
@@ -1939,237 +1869,237 @@ void QmlPropertyAnimation::setTo(const QVariant &t)
}
/*!
- \qmlproperty string PropertyAnimation::easing
+ \qmlproperty QEasingCurve PropertyAnimation::easing
\brief the easing curve used for the transition.
Available values are:
\table
\row
- \o \c easeLinear
+ \o \c Linear
\o Easing curve for a linear (t) function: velocity is constant.
\o \inlineimage qeasingcurve-linear.png
\row
- \o \c easeInQuad
+ \o \c InQuad
\o Easing curve for a quadratic (t^2) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inquad.png
\row
- \o \c easeOutQuad
+ \o \c OutQuad
\o Easing curve for a quadratic (t^2) function: decelerating to zero velocity.
\o \inlineimage qeasingcurve-outquad.png
\row
- \o \c easeInOutQuad
+ \o \c InOutQuad
\o Easing curve for a quadratic (t^2) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutquad.png
\row
- \o \c easeOutInQuad
+ \o \c OutInQuad
\o Easing curve for a quadratic (t^2) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinquad.png
\row
- \o \c easeInCubic
+ \o \c InCubic
\o Easing curve for a cubic (t^3) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-incubic.png
\row
- \o \c easeOutCubic
+ \o \c OutCubic
\o Easing curve for a cubic (t^3) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outcubic.png
\row
- \o \c easeInOutCubic
+ \o \c InOutCubic
\o Easing curve for a cubic (t^3) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutcubic.png
\row
- \o \c easeOutInCubic
+ \o \c OutInCubic
\o Easing curve for a cubic (t^3) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outincubic.png
\row
- \o \c easeInQuart
+ \o \c InQuart
\o Easing curve for a quartic (t^4) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inquart.png
\row
- \o \c easeOutQuart
+ \o \c OutQuart
\o Easing curve for a cubic (t^4) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outquart.png
\row
- \o \c easeInOutQuart
+ \o \c InOutQuart
\o Easing curve for a cubic (t^4) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutquart.png
\row
- \o \c easeOutInQuart
+ \o \c OutInQuart
\o Easing curve for a cubic (t^4) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinquart.png
\row
- \o \c easeInQuint
+ \o \c InQuint
\o Easing curve for a quintic (t^5) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inquint.png
\row
- \o \c easeOutQuint
+ \o \c OutQuint
\o Easing curve for a cubic (t^5) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outquint.png
\row
- \o \c easeInOutQuint
+ \o \c InOutQuint
\o Easing curve for a cubic (t^5) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutquint.png
\row
- \o \c easeOutInQuint
+ \o \c OutInQuint
\o Easing curve for a cubic (t^5) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinquint.png
\row
- \o \c easeInSine
+ \o \c InSine
\o Easing curve for a sinusoidal (sin(t)) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-insine.png
\row
- \o \c easeOutSine
+ \o \c OutSine
\o Easing curve for a sinusoidal (sin(t)) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outsine.png
\row
- \o \c easeInOutSine
+ \o \c InOutSine
\o Easing curve for a sinusoidal (sin(t)) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutsine.png
\row
- \o \c easeOutInSine
+ \o \c OutInSine
\o Easing curve for a sinusoidal (sin(t)) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinsine.png
\row
- \o \c easeInExpo
+ \o \c InExpo
\o Easing curve for an exponential (2^t) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inexpo.png
\row
- \o \c easeOutExpo
+ \o \c OutExpo
\o Easing curve for an exponential (2^t) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outexpo.png
\row
- \o \c easeInOutExpo
+ \o \c InOutExpo
\o Easing curve for an exponential (2^t) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutexpo.png
\row
- \o \c easeOutInExpo
+ \o \c OutInExpo
\o Easing curve for an exponential (2^t) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinexpo.png
\row
- \o \c easeInCirc
+ \o \c InCirc
\o Easing curve for a circular (sqrt(1-t^2)) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-incirc.png
\row
- \o \c easeOutCirc
+ \o \c OutCirc
\o Easing curve for a circular (sqrt(1-t^2)) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outcirc.png
\row
- \o \c easeInOutCirc
+ \o \c InOutCirc
\o Easing curve for a circular (sqrt(1-t^2)) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutcirc.png
\row
- \o \c easeOutInCirc
+ \o \c OutInCirc
\o Easing curve for a circular (sqrt(1-t^2)) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outincirc.png
\row
- \o \c easeInElastic
+ \o \c InElastic
\o Easing curve for an elastic (exponentially decaying sine wave) function: accelerating from zero velocity.
\br The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter.
\o \inlineimage qeasingcurve-inelastic.png
\row
- \o \c easeOutElastic
+ \o \c OutElastic
\o Easing curve for an elastic (exponentially decaying sine wave) function: decelerating from zero velocity.
\br The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter.
\o \inlineimage qeasingcurve-outelastic.png
\row
- \o \c easeInOutElastic
+ \o \c InOutElastic
\o Easing curve for an elastic (exponentially decaying sine wave) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutelastic.png
\row
- \o \c easeOutInElastic
+ \o \c OutInElastic
\o Easing curve for an elastic (exponentially decaying sine wave) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinelastic.png
\row
- \o \c easeInBack
+ \o \c InBack
\o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inback.png
\row
- \o \c easeOutBack
+ \o \c OutBack
\o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing out: decelerating to zero velocity.
\o \inlineimage qeasingcurve-outback.png
\row
- \o \c easeInOutBack
+ \o \c InOutBack
\o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutback.png
\row
- \o \c easeOutInBack
+ \o \c OutInBack
\o Easing curve for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinback.png
\row
- \o \c easeInBounce
+ \o \c InBounce
\o Easing curve for a bounce (exponentially decaying parabolic bounce) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inbounce.png
\row
- \o \c easeOutBounce
+ \o \c OutBounce
\o Easing curve for a bounce (exponentially decaying parabolic bounce) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outbounce.png
\row
- \o \c easeInOutBounce
+ \o \c InOutBounce
\o Easing curve for a bounce (exponentially decaying parabolic bounce) function easing in/out: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutbounce.png
\row
- \o \c easeOutInBounce
+ \o \c OutInBounce
\o Easing curve for a bounce (exponentially decaying parabolic bounce) function easing out/in: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinbounce.png
\endtable
*/
-QString QmlPropertyAnimation::easing() const
+QEasingCurve QDeclarativePropertyAnimation::easing() const
{
- Q_D(const QmlPropertyAnimation);
+ Q_D(const QDeclarativePropertyAnimation);
return d->easing;
}
-void QmlPropertyAnimation::setEasing(const QString &e)
+void QDeclarativePropertyAnimation::setEasing(const QEasingCurve &e)
{
- Q_D(QmlPropertyAnimation);
+ Q_D(QDeclarativePropertyAnimation);
if (d->easing == e)
return;
d->easing = e;
- d->va->setEasingCurve(stringToCurve(d->easing, this));
+ d->va->setEasingCurve(d->easing);
emit easingChanged(e);
}
-QObject *QmlPropertyAnimation::target() const
+QObject *QDeclarativePropertyAnimation::target() const
{
- Q_D(const QmlPropertyAnimation);
+ Q_D(const QDeclarativePropertyAnimation);
return d->target;
}
-void QmlPropertyAnimation::setTarget(QObject *o)
+void QDeclarativePropertyAnimation::setTarget(QObject *o)
{
- Q_D(QmlPropertyAnimation);
+ Q_D(QDeclarativePropertyAnimation);
if (d->target == o)
return;
d->target = o;
emit targetChanged(d->target, d->propertyName);
}
-QString QmlPropertyAnimation::property() const
+QString QDeclarativePropertyAnimation::property() const
{
- Q_D(const QmlPropertyAnimation);
+ Q_D(const QDeclarativePropertyAnimation);
return d->propertyName;
}
-void QmlPropertyAnimation::setProperty(const QString &n)
+void QDeclarativePropertyAnimation::setProperty(const QString &n)
{
- Q_D(QmlPropertyAnimation);
+ Q_D(QDeclarativePropertyAnimation);
if (d->propertyName == n)
return;
d->propertyName = n;
emit targetChanged(d->target, d->propertyName);
}
-QString QmlPropertyAnimation::properties() const
+QString QDeclarativePropertyAnimation::properties() const
{
- Q_D(const QmlPropertyAnimation);
+ Q_D(const QDeclarativePropertyAnimation);
return d->properties;
}
-void QmlPropertyAnimation::setProperties(const QString &prop)
+void QDeclarativePropertyAnimation::setProperties(const QString &prop)
{
- Q_D(QmlPropertyAnimation);
+ Q_D(QDeclarativePropertyAnimation);
if (d->properties == prop)
return;
@@ -2259,10 +2189,10 @@ void QmlPropertyAnimation::setProperties(const QString &prop)
\sa exclude
*/
-QmlListProperty<QObject> QmlPropertyAnimation::targets()
+QDeclarativeListProperty<QObject> QDeclarativePropertyAnimation::targets()
{
- Q_D(QmlPropertyAnimation);
- return QmlListProperty<QObject>(this, d->targets);
+ Q_D(QDeclarativePropertyAnimation);
+ return QDeclarativeListProperty<QObject>(this, d->targets);
}
/*!
@@ -2270,21 +2200,21 @@ QmlListProperty<QObject> QmlPropertyAnimation::targets()
This property holds the items not to be affected by this animation.
\sa targets
*/
-QmlListProperty<QObject> QmlPropertyAnimation::exclude()
+QDeclarativeListProperty<QObject> QDeclarativePropertyAnimation::exclude()
{
- Q_D(QmlPropertyAnimation);
- return QmlListProperty<QObject>(this, d->exclude);
+ Q_D(QDeclarativePropertyAnimation);
+ return QDeclarativeListProperty<QObject>(this, d->exclude);
}
-QAbstractAnimation *QmlPropertyAnimation::qtAnimation()
+QAbstractAnimation *QDeclarativePropertyAnimation::qtAnimation()
{
- Q_D(QmlPropertyAnimation);
+ Q_D(QDeclarativePropertyAnimation);
return d->va;
}
-struct PropertyUpdater : public QmlTimeLineValue
+struct PropertyUpdater : public QDeclarativeTimeLineValue
{
- QmlStateActions actions;
+ QDeclarativeStateActions actions;
int interpolatorType; //for Number/ColorAnimation
int prevInterpolatorType; //for generic
QVariantAnimation::Interpolator interpolator;
@@ -2300,17 +2230,17 @@ struct PropertyUpdater : public QmlTimeLineValue
wasDeleted = &deleted;
if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1
v = 1 - v;
- QmlTimeLineValue::setValue(v);
+ QDeclarativeTimeLineValue::setValue(v);
for (int ii = 0; ii < actions.count(); ++ii) {
- QmlAction &action = actions[ii];
+ QDeclarativeAction &action = actions[ii];
if (v == 1.)
- action.property.write(action.toValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
else {
if (!fromSourced && !fromDefined) {
action.fromValue = action.property.read();
if (interpolatorType)
- QmlPropertyAnimationPrivate::convertVariant(action.fromValue, interpolatorType);
+ QDeclarativePropertyAnimationPrivate::convertVariant(action.fromValue, interpolatorType);
}
if (!interpolatorType) {
int propType = action.property.propertyType();
@@ -2320,7 +2250,7 @@ struct PropertyUpdater : public QmlTimeLineValue
}
}
if (interpolator)
- action.property.write(interpolator(action.fromValue.constData(), action.toValue.constData(), v), QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::write(action.property, interpolator(action.fromValue.constData(), action.toValue.constData(), v), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
}
if (deleted)
return;
@@ -2330,11 +2260,11 @@ struct PropertyUpdater : public QmlTimeLineValue
}
};
-void QmlPropertyAnimation::transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
+void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
TransitionDirection direction)
{
- Q_D(QmlPropertyAnimation);
+ Q_D(QDeclarativePropertyAnimation);
QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(','));
for (int ii = 0; ii < props.count(); ++ii)
@@ -2370,7 +2300,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
if (d->toIsDefined) {
for (int i = 0; i < props.count(); ++i) {
for (int j = 0; j < targets.count(); ++j) {
- QmlAction myAction;
+ QDeclarativeAction myAction;
myAction.property = d->createProperty(targets.at(j), props.at(i), this);
if (myAction.property.isValid()) {
if (d->fromIsDefined) {
@@ -2382,7 +2312,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
data->actions << myAction;
hasExplicit = true;
for (int ii = 0; ii < actions.count(); ++ii) {
- QmlAction &action = actions[ii];
+ QDeclarativeAction &action = actions[ii];
if (action.property.object() == myAction.property.object() &&
myAction.property.name() == action.property.name()) {
modified << action.property;
@@ -2396,7 +2326,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
if (!hasExplicit)
for (int ii = 0; ii < actions.count(); ++ii) {
- QmlAction &action = actions[ii];
+ QDeclarativeAction &action = actions[ii];
QObject *obj = action.property.object();
QString propertyName = action.property.name();
@@ -2408,7 +2338,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
(!d->exclude.contains(obj)) && (same || (!d->exclude.contains(sObj))) &&
(props.contains(propertyName) || (!same && props.contains(sPropertyName))
|| (useType && action.property.propertyType() == d->interpolatorType))) {
- QmlAction myAction = action;
+ QDeclarativeAction myAction = action;
if (d->fromIsDefined)
myAction.fromValue = d->from;
@@ -2440,6 +2370,241 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
}
}
-QML_DEFINE_TYPE(Qt,4,6,PropertyAnimation,QmlPropertyAnimation)
+QDeclarativeParentAnimation::QDeclarativeParentAnimation(QObject *parent)
+ : QDeclarativeAnimationGroup(*(new QDeclarativeParentAnimationPrivate), parent)
+{
+ Q_D(QDeclarativeParentAnimation);
+ d->topLevelGroup = new QSequentialAnimationGroup;
+ QDeclarativeGraphics_setParent_noEvent(d->topLevelGroup, this);
+
+ d->startAction = new QActionAnimation;
+ d->topLevelGroup->addAnimation(d->startAction);
+
+ d->ag = new QParallelAnimationGroup;
+ d->topLevelGroup->addAnimation(d->ag);
+
+ d->endAction = new QActionAnimation;
+ d->topLevelGroup->addAnimation(d->endAction);
+}
+
+QDeclarativeParentAnimation::~QDeclarativeParentAnimation()
+{
+}
+
+QDeclarativeItem *QDeclarativeParentAnimation::target() const
+{
+ Q_D(const QDeclarativeParentAnimation);
+ return d->target;
+}
+
+void QDeclarativeParentAnimation::setTarget(QDeclarativeItem *target)
+{
+ Q_D(QDeclarativeParentAnimation);
+ d->target = target;
+}
+
+QDeclarativeItem *QDeclarativeParentAnimation::newParent() const
+{
+ Q_D(const QDeclarativeParentAnimation);
+ return d->newParent;
+}
+
+void QDeclarativeParentAnimation::setNewParent(QDeclarativeItem *newParent)
+{
+ Q_D(QDeclarativeParentAnimation);
+ d->newParent = newParent;
+}
+
+QDeclarativeItem *QDeclarativeParentAnimation::via() const
+{
+ Q_D(const QDeclarativeParentAnimation);
+ return d->via;
+}
+
+void QDeclarativeParentAnimation::setVia(QDeclarativeItem *via)
+{
+ Q_D(QDeclarativeParentAnimation);
+ d->via = via;
+}
+
+//### mirrors same-named function in QDeclarativeItem
+QPointF QDeclarativeParentAnimationPrivate::computeTransformOrigin(QDeclarativeItem::TransformOrigin origin, qreal width, qreal height) const
+{
+ switch(origin) {
+ default:
+ case QDeclarativeItem::TopLeft:
+ return QPointF(0, 0);
+ case QDeclarativeItem::Top:
+ return QPointF(width / 2., 0);
+ case QDeclarativeItem::TopRight:
+ return QPointF(width, 0);
+ case QDeclarativeItem::Left:
+ return QPointF(0, height / 2.);
+ case QDeclarativeItem::Center:
+ return QPointF(width / 2., height / 2.);
+ case QDeclarativeItem::Right:
+ return QPointF(width, height / 2.);
+ case QDeclarativeItem::BottomLeft:
+ return QPointF(0, height);
+ case QDeclarativeItem::Bottom:
+ return QPointF(width / 2., height);
+ case QDeclarativeItem::BottomRight:
+ return QPointF(width, height);
+ }
+}
+
+void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
+ TransitionDirection direction)
+{
+ Q_D(QDeclarativeParentAnimation);
+
+ struct QDeclarativeParentActionData : public QAbstractAnimationAction
+ {
+ QDeclarativeParentActionData(): pc(0) {}
+ ~QDeclarativeParentActionData() { delete pc; }
+
+ QDeclarativeStateActions actions;
+ bool reverse;
+ QDeclarativeParentChange *pc;
+ virtual void doAction()
+ {
+ for (int ii = 0; ii < actions.count(); ++ii) {
+ const QDeclarativeAction &action = actions.at(ii);
+ if (reverse)
+ action.event->reverse();
+ else
+ action.event->execute();
+ }
+ }
+ };
+
+ QDeclarativeParentActionData *data = new QDeclarativeParentActionData;
+ QDeclarativeParentActionData *viaData = new QDeclarativeParentActionData;
+ for (int i = 0; i < actions.size(); ++i) {
+ QDeclarativeAction &action = actions[i];
+ if (action.event && action.event->typeName() == QLatin1String("ParentChange")
+ && (!d->target || static_cast<QDeclarativeParentChange*>(action.event)->object() == d->target)) {
+
+ QDeclarativeParentChange *pc = static_cast<QDeclarativeParentChange*>(action.event);
+ QDeclarativeAction myAction = action;
+ data->reverse = action.reverseEvent;
+ action.actionDone = true;
+ data->actions << myAction;
+
+ if (d->via) {
+ viaData->reverse = false;
+ QDeclarativeAction myAction;
+ QDeclarativeParentChange *vpc = new QDeclarativeParentChange;
+ vpc->setObject(pc->object());
+ vpc->setParent(d->via);
+ myAction.event = vpc;
+ viaData->pc = vpc;
+ viaData->actions << myAction;
+ QDeclarativeAction dummyAction;
+ QDeclarativeAction &xAction = pc->xIsSet() ? actions[++i] : dummyAction;
+ QDeclarativeAction &yAction = pc->yIsSet() ? actions[++i] : dummyAction;
+ QDeclarativeAction &sAction = pc->scaleIsSet() ? actions[++i] : dummyAction;
+ QDeclarativeAction &rAction = pc->rotationIsSet() ? actions[++i] : dummyAction;
+ bool forward = (direction == QDeclarativeAbstractAnimation::Forward);
+ QDeclarativeItem *target = pc->object();
+ QDeclarativeItem *targetParent = forward ? pc->parent() : pc->originalParent();
+
+ //### this mirrors the logic in QDeclarativeParentChange.
+ bool ok;
+ const QTransform &transform = targetParent->itemTransform(d->via, &ok);
+ if (transform.type() >= QTransform::TxShear || !ok) {
+ qmlInfo(this) << QDeclarativeParentAnimation::tr("Unable to preserve appearance under complex transform");
+ ok = false;
+ }
+
+ qreal scale = 1;
+ qreal rotation = 0;
+ if (ok && transform.type() != QTransform::TxRotate) {
+ if (transform.m11() == transform.m22())
+ scale = transform.m11();
+ else {
+ qmlInfo(this) << QDeclarativeParentAnimation::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(this) << QDeclarativeParentAnimation::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(this) << QDeclarativeParentAnimation::tr("Unable to preserve appearance under scale of 0");
+ ok = false;
+ }
+ }
+
+ const QPointF &point = transform.map(QPointF(xAction.toValue.toReal(),yAction.toValue.toReal()));
+ qreal x = point.x();
+ qreal y = point.y();
+ if (ok && target->transformOrigin() != QDeclarativeItem::TopLeft) {
+ qreal w = target->width();
+ qreal h = target->height();
+ if (pc->widthIsSet())
+ w = actions[++i].toValue.toReal();
+ if (pc->heightIsSet())
+ h = actions[++i].toValue.toReal();
+ const QPointF &transformOrigin
+ = d->computeTransformOrigin(target->transformOrigin(), w,h);
+ qreal tempxt = transformOrigin.x();
+ qreal tempyt = transformOrigin.y();
+ QTransform t;
+ t.translate(-tempxt, -tempyt);
+ t.rotate(rotation);
+ t.scale(scale, scale);
+ t.translate(tempxt, tempyt);
+ const QPointF &offset = t.map(QPointF(0,0));
+ x += offset.x();
+ y += offset.y();
+ }
+
+ if (ok) {
+ //qDebug() << x << y << rotation << scale;
+ xAction.toValue = x;
+ yAction.toValue = y;
+ sAction.toValue = sAction.toValue.toReal() * scale;
+ rAction.toValue = rAction.toValue.toReal() + rotation;
+ }
+ }
+ }
+ }
+
+ if (data->actions.count()) {
+ if (direction == QDeclarativeAbstractAnimation::Forward) {
+ d->startAction->setAnimAction(d->via ? viaData : data, QActionAnimation::DeleteWhenStopped);
+ d->endAction->setAnimAction(d->via ? data : 0, QActionAnimation::DeleteWhenStopped);
+ } else {
+ d->endAction->setAnimAction(d->via ? viaData : data, QActionAnimation::DeleteWhenStopped);
+ d->startAction->setAnimAction(d->via ? data : 0, QActionAnimation::DeleteWhenStopped);
+ }
+ } else {
+ delete data;
+ delete viaData;
+ }
+
+ //take care of any child animations
+ 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);
+ }
+
+}
+
+QAbstractAnimation *QDeclarativeParentAnimation::qtAnimation()
+{
+ Q_D(QDeclarativeParentAnimation);
+ return d->topLevelGroup;
+}
QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h
new file mode 100644
index 0000000..0f23f5c
--- /dev/null
+++ b/src/declarative/util/qdeclarativeanimation_p.h
@@ -0,0 +1,501 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVEANIMATION_H
+#define QDECLARATIVEANIMATION_H
+
+#include "qdeclarativetransition_p.h"
+#include "qdeclarativestate_p.h"
+#include <QtGui/qvector3d.h>
+
+#include <qdeclarativepropertyvaluesource.h>
+#include <qdeclarative.h>
+#include <qdeclarativescriptstring.h>
+
+#include <QtCore/qvariant.h>
+#include <QtCore/qeasingcurve.h>
+#include <QtCore/QAbstractAnimation>
+#include <QtGui/qcolor.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class QDeclarativeAbstractAnimationPrivate;
+class QDeclarativeAnimationGroup;
+class Q_AUTOTEST_EXPORT QDeclarativeAbstractAnimation : public QObject, public QDeclarativePropertyValueSource, public QDeclarativeParserStatus
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativeAbstractAnimation)
+
+ Q_INTERFACES(QDeclarativeParserStatus)
+ Q_INTERFACES(QDeclarativePropertyValueSource)
+ Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
+ Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged)
+ Q_PROPERTY(bool alwaysRunToEnd READ alwaysRunToEnd WRITE setAlwaysRunToEnd NOTIFY alwaysRunToEndChanged())
+ Q_PROPERTY(bool repeat READ repeat WRITE setRepeat NOTIFY repeatChanged)
+ Q_CLASSINFO("DefaultMethod", "start()")
+
+public:
+ QDeclarativeAbstractAnimation(QObject *parent=0);
+ virtual ~QDeclarativeAbstractAnimation();
+
+ bool isRunning() const;
+ void setRunning(bool);
+ bool isPaused() const;
+ void setPaused(bool);
+ bool alwaysRunToEnd() const;
+ void setAlwaysRunToEnd(bool);
+ bool repeat() const;
+ void setRepeat(bool);
+
+ int currentTime();
+ void setCurrentTime(int);
+
+ QDeclarativeAnimationGroup *group() const;
+ void setGroup(QDeclarativeAnimationGroup *);
+
+ void setDefaultTarget(const QDeclarativeProperty &);
+ void setDisableUserControl();
+
+ void classBegin();
+ void componentComplete();
+
+Q_SIGNALS:
+ void started();
+ void completed();
+ void runningChanged(bool);
+ void pausedChanged(bool);
+ void repeatChanged(bool);
+ void alwaysRunToEndChanged(bool);
+
+public Q_SLOTS:
+ void restart();
+ void start();
+ void pause();
+ void resume();
+ void stop();
+ void complete();
+
+protected:
+ QDeclarativeAbstractAnimation(QDeclarativeAbstractAnimationPrivate &dd, QObject *parent);
+
+public:
+ enum TransitionDirection { Forward, Backward };
+ virtual void transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
+ TransitionDirection direction);
+ virtual QAbstractAnimation *qtAnimation() = 0;
+
+private Q_SLOTS:
+ void timelineComplete();
+
+private:
+ virtual void setTarget(const QDeclarativeProperty &);
+};
+
+class QDeclarativePauseAnimationPrivate;
+class Q_AUTOTEST_EXPORT QDeclarativePauseAnimation : public QDeclarativeAbstractAnimation
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativePauseAnimation)
+
+ Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
+
+public:
+ QDeclarativePauseAnimation(QObject *parent=0);
+ virtual ~QDeclarativePauseAnimation();
+
+ int duration() const;
+ void setDuration(int);
+
+Q_SIGNALS:
+ void durationChanged(int);
+
+protected:
+ virtual QAbstractAnimation *qtAnimation();
+};
+
+class QDeclarativeScriptActionPrivate;
+class QDeclarativeScriptAction : public QDeclarativeAbstractAnimation
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativeScriptAction)
+
+ Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript)
+ Q_PROPERTY(QString stateChangeScriptName READ stateChangeScriptName WRITE setStateChangeScriptName)
+
+public:
+ QDeclarativeScriptAction(QObject *parent=0);
+ virtual ~QDeclarativeScriptAction();
+
+ QDeclarativeScriptString script() const;
+ void setScript(const QDeclarativeScriptString &);
+
+ QString stateChangeScriptName() const;
+ void setStateChangeScriptName(const QString &);
+
+protected:
+ virtual void transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
+ TransitionDirection direction);
+ virtual QAbstractAnimation *qtAnimation();
+};
+
+class QDeclarativePropertyActionPrivate;
+class QDeclarativePropertyAction : public QDeclarativeAbstractAnimation
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativePropertyAction)
+
+ Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
+ Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged)
+ Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QObject> targets READ targets)
+ Q_PROPERTY(QDeclarativeListProperty<QObject> exclude READ exclude)
+ Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
+
+public:
+ QDeclarativePropertyAction(QObject *parent=0);
+ virtual ~QDeclarativePropertyAction();
+
+ QObject *target() const;
+ void setTarget(QObject *);
+
+ QString property() const;
+ void setProperty(const QString &);
+
+ QString properties() const;
+ void setProperties(const QString &);
+
+ QDeclarativeListProperty<QObject> targets();
+ QDeclarativeListProperty<QObject> exclude();
+
+ QVariant value() const;
+ void setValue(const QVariant &);
+
+Q_SIGNALS:
+ void valueChanged(const QVariant &);
+ void propertiesChanged(const QString &);
+ void targetChanged(QObject *, const QString &);
+
+protected:
+ virtual void transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
+ TransitionDirection direction);
+ virtual QAbstractAnimation *qtAnimation();
+};
+
+class QDeclarativeItem;
+class QDeclarativeParentActionPrivate;
+class QDeclarativeParentAction : public QDeclarativeAbstractAnimation
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativeParentAction)
+
+ Q_PROPERTY(QDeclarativeItem *target READ object WRITE setObject)
+ Q_PROPERTY(QDeclarativeItem *parent READ parent WRITE setParent) //### newParent
+
+public:
+ QDeclarativeParentAction(QObject *parent=0);
+ virtual ~QDeclarativeParentAction();
+
+ QDeclarativeItem *object() const;
+ void setObject(QDeclarativeItem *);
+
+ QDeclarativeItem *parent() const;
+ void setParent(QDeclarativeItem *);
+
+protected:
+ virtual void transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
+ TransitionDirection direction);
+ virtual QAbstractAnimation *qtAnimation();
+};
+
+class QDeclarativePropertyAnimationPrivate;
+class Q_AUTOTEST_EXPORT QDeclarativePropertyAnimation : public QDeclarativeAbstractAnimation
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativePropertyAnimation)
+
+ Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
+ Q_PROPERTY(QVariant from READ from WRITE setFrom NOTIFY fromChanged)
+ Q_PROPERTY(QVariant to READ to WRITE setTo NOTIFY toChanged)
+ Q_PROPERTY(QEasingCurve 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 properties READ properties WRITE setProperties NOTIFY propertiesChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QObject> targets READ targets)
+ Q_PROPERTY(QDeclarativeListProperty<QObject> exclude READ exclude)
+
+public:
+ QDeclarativePropertyAnimation(QObject *parent=0);
+ virtual ~QDeclarativePropertyAnimation();
+
+ int duration() const;
+ void setDuration(int);
+
+ QVariant from() const;
+ void setFrom(const QVariant &);
+
+ QVariant to() const;
+ void setTo(const QVariant &);
+
+ QEasingCurve easing() const;
+ void setEasing(const QEasingCurve &);
+
+ QObject *target() const;
+ void setTarget(QObject *);
+
+ QString property() const;
+ void setProperty(const QString &);
+
+ QString properties() const;
+ void setProperties(const QString &);
+
+ QDeclarativeListProperty<QObject> targets();
+ QDeclarativeListProperty<QObject> exclude();
+
+protected:
+ QDeclarativePropertyAnimation(QDeclarativePropertyAnimationPrivate &dd, QObject *parent);
+ virtual void transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
+ TransitionDirection direction);
+ virtual QAbstractAnimation *qtAnimation();
+
+Q_SIGNALS:
+ void durationChanged(int);
+ void fromChanged(QVariant);
+ void toChanged(QVariant);
+ void easingChanged(const QEasingCurve &);
+ void propertiesChanged(const QString &);
+ void targetChanged(QObject *, const QString &);
+};
+
+class Q_AUTOTEST_EXPORT QDeclarativeColorAnimation : public QDeclarativePropertyAnimation
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativePropertyAnimation)
+ Q_PROPERTY(QColor from READ from WRITE setFrom NOTIFY fromChanged)
+ Q_PROPERTY(QColor to READ to WRITE setTo NOTIFY toChanged)
+
+public:
+ QDeclarativeColorAnimation(QObject *parent=0);
+ virtual ~QDeclarativeColorAnimation();
+
+ QColor from() const;
+ void setFrom(const QColor &);
+
+ QColor to() const;
+ void setTo(const QColor &);
+};
+
+class Q_AUTOTEST_EXPORT QDeclarativeNumberAnimation : public QDeclarativePropertyAnimation
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativePropertyAnimation)
+
+ Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged)
+ Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged)
+
+public:
+ QDeclarativeNumberAnimation(QObject *parent=0);
+ virtual ~QDeclarativeNumberAnimation();
+
+ qreal from() const;
+ void setFrom(qreal);
+
+ qreal to() const;
+ void setTo(qreal);
+};
+
+class Q_AUTOTEST_EXPORT QDeclarativeVector3dAnimation : public QDeclarativePropertyAnimation
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativePropertyAnimation)
+
+ Q_PROPERTY(QVector3D from READ from WRITE setFrom NOTIFY fromChanged)
+ Q_PROPERTY(QVector3D to READ to WRITE setTo NOTIFY toChanged)
+
+public:
+ QDeclarativeVector3dAnimation(QObject *parent=0);
+ virtual ~QDeclarativeVector3dAnimation();
+
+ QVector3D from() const;
+ void setFrom(QVector3D);
+
+ QVector3D to() const;
+ void setTo(QVector3D);
+};
+
+class QDeclarativeRotationAnimationPrivate;
+class Q_AUTOTEST_EXPORT QDeclarativeRotationAnimation : public QDeclarativePropertyAnimation
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativeRotationAnimation)
+ 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:
+ QDeclarativeRotationAnimation(QObject *parent=0);
+ virtual ~QDeclarativeRotationAnimation();
+
+ 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 QDeclarativeAnimationGroupPrivate;
+class QDeclarativeAnimationGroup : public QDeclarativeAbstractAnimation
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativeAnimationGroup)
+
+ Q_CLASSINFO("DefaultProperty", "animations")
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeAbstractAnimation> animations READ animations)
+
+public:
+ QDeclarativeAnimationGroup(QObject *parent);
+ virtual ~QDeclarativeAnimationGroup();
+
+ QDeclarativeListProperty<QDeclarativeAbstractAnimation> animations();
+ friend class QDeclarativeAbstractAnimation;
+
+protected:
+ QDeclarativeAnimationGroup(QDeclarativeAnimationGroupPrivate &dd, QObject *parent);
+};
+
+class QDeclarativeSequentialAnimation : public QDeclarativeAnimationGroup
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativeAnimationGroup)
+
+public:
+ QDeclarativeSequentialAnimation(QObject *parent=0);
+ virtual ~QDeclarativeSequentialAnimation();
+
+protected:
+ virtual void transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
+ TransitionDirection direction);
+ virtual QAbstractAnimation *qtAnimation();
+};
+
+class QDeclarativeParallelAnimation : public QDeclarativeAnimationGroup
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativeAnimationGroup)
+
+public:
+ QDeclarativeParallelAnimation(QObject *parent=0);
+ virtual ~QDeclarativeParallelAnimation();
+
+protected:
+ virtual void transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
+ TransitionDirection direction);
+ virtual QAbstractAnimation *qtAnimation();
+};
+
+class QDeclarativeParentAnimationPrivate;
+class QDeclarativeParentAnimation : public QDeclarativeAnimationGroup
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativeParentAnimation)
+
+ Q_PROPERTY(QDeclarativeItem *target READ target WRITE setTarget)
+ //Q_PROPERTY(QDeclarativeItem *newParent READ newParent WRITE setNewParent)
+ Q_PROPERTY(QDeclarativeItem *via READ via WRITE setVia)
+
+public:
+ QDeclarativeParentAnimation(QObject *parent=0);
+ virtual ~QDeclarativeParentAnimation();
+
+ QDeclarativeItem *target() const;
+ void setTarget(QDeclarativeItem *);
+
+ QDeclarativeItem *newParent() const;
+ void setNewParent(QDeclarativeItem *);
+
+ QDeclarativeItem *via() const;
+ void setVia(QDeclarativeItem *);
+
+protected:
+ virtual void transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
+ TransitionDirection direction);
+ virtual QAbstractAnimation *qtAnimation();
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QDeclarativeAbstractAnimation)
+QML_DECLARE_TYPE(QDeclarativePauseAnimation)
+QML_DECLARE_TYPE(QDeclarativeScriptAction)
+QML_DECLARE_TYPE(QDeclarativePropertyAction)
+QML_DECLARE_TYPE(QDeclarativeParentAction)
+QML_DECLARE_TYPE(QDeclarativePropertyAnimation)
+QML_DECLARE_TYPE(QDeclarativeColorAnimation)
+QML_DECLARE_TYPE(QDeclarativeNumberAnimation)
+QML_DECLARE_TYPE(QDeclarativeSequentialAnimation)
+QML_DECLARE_TYPE(QDeclarativeParallelAnimation)
+QML_DECLARE_TYPE(QDeclarativeVector3dAnimation)
+QML_DECLARE_TYPE(QDeclarativeRotationAnimation)
+QML_DECLARE_TYPE(QDeclarativeParentAnimation)
+
+QT_END_HEADER
+
+#endif // QDECLARATIVEANIMATION_H
diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h
index 056ce82..e582066 100644
--- a/src/declarative/util/qmlanimation_p_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLANIMATION_P_H
-#define QMLANIMATION_P_H
+#ifndef QDECLARATIVEANIMATION_P_H
+#define QDECLARATIVEANIMATION_P_H
//
// W A R N I N G
@@ -53,13 +53,14 @@
// We mean it.
//
-#include "qmlanimation_p.h"
+#include "qdeclarativeanimation_p.h"
-#include "qmlnullablevalue_p_p.h"
-#include "qmltimeline_p_p.h"
+#include "qdeclarativenullablevalue_p_p.h"
+#include "qdeclarativetimeline_p_p.h"
-#include <qml.h>
-#include <qmlcontext.h>
+#include <qdeclarative.h>
+#include <qdeclarativeitem.h>
+#include <qdeclarativecontext.h>
#include <QtCore/QPauseAnimation>
#include <QtCore/QVariantAnimation>
@@ -82,7 +83,7 @@ public:
//templated animation action
//allows us to specify an action that calls a function of a class.
-//(so that class doesn't have to inherit QmlAbstractAnimationAction)
+//(so that class doesn't have to inherit QDeclarativeAbstractAnimationAction)
template<class T, void (T::*method)()>
class QAnimationActionProxy : public QAbstractAnimationAction
{
@@ -104,6 +105,12 @@ public:
: QAbstractAnimation(parent), animAction(action), policy(KeepWhenStopped), running(false) {}
~QActionAnimation() { if (policy == DeleteWhenStopped) { delete animAction; animAction = 0; } }
virtual int duration() const { return 0; }
+ void clearAnimAction()
+ {
+ if (policy == DeleteWhenStopped)
+ delete animAction;
+ animAction = 0;
+ }
void setAnimAction(QAbstractAnimationAction *action, DeletionPolicy p)
{
if (state() == Running)
@@ -142,14 +149,14 @@ private:
bool running;
};
-//animates QmlTimeLineValue (assumes start and end values will be reals or compatible)
-class QmlTimeLineValueAnimator : public QVariantAnimation
+//animates QDeclarativeTimeLineValue (assumes start and end values will be reals or compatible)
+class QDeclarativeTimeLineValueAnimator : public QVariantAnimation
{
Q_OBJECT
public:
- QmlTimeLineValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {}
- ~QmlTimeLineValueAnimator() { if (policy == DeleteWhenStopped) { delete animValue; animValue = 0; } }
- void setAnimValue(QmlTimeLineValue *value, DeletionPolicy p)
+ QDeclarativeTimeLineValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {}
+ ~QDeclarativeTimeLineValueAnimator() { if (policy == DeleteWhenStopped) { delete animValue; animValue = 0; } }
+ void setAnimValue(QDeclarativeTimeLineValue *value, DeletionPolicy p)
{
if (state() == Running)
stop();
@@ -165,6 +172,9 @@ public:
protected:
virtual void updateCurrentValue(const QVariant &value)
{
+ if (state() == QAbstractAnimation::Stopped)
+ return;
+
if (animValue)
animValue->setValue(value.toReal());
}
@@ -183,7 +193,7 @@ protected:
}
private:
- QmlTimeLineValue *animValue;
+ QDeclarativeTimeLineValue *animValue;
bool *fromSourced;
DeletionPolicy policy;
};
@@ -203,11 +213,11 @@ private:
T *m_p;
};
-class QmlAbstractAnimationPrivate : public QObjectPrivate
+class QDeclarativeAbstractAnimationPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlAbstractAnimation)
+ Q_DECLARE_PUBLIC(QDeclarativeAbstractAnimation)
public:
- QmlAbstractAnimationPrivate()
+ QDeclarativeAbstractAnimationPrivate()
: running(false), paused(false), alwaysRunToEnd(false), repeat(false),
connectedTimeLine(false), componentComplete(true),
avoidPropertyValueSourceStart(false), disableUserControl(false), group(0) {}
@@ -223,52 +233,52 @@ public:
void commence();
- QmlMetaProperty defaultProperty;
+ QDeclarativeProperty defaultProperty;
- QmlAnimationGroup *group;
+ QDeclarativeAnimationGroup *group;
- static QmlMetaProperty createProperty(QObject *obj, const QString &str, QObject *infoObj);
+ static QDeclarativeProperty createProperty(QObject *obj, const QString &str, QObject *infoObj);
};
-class QmlPauseAnimationPrivate : public QmlAbstractAnimationPrivate
+class QDeclarativePauseAnimationPrivate : public QDeclarativeAbstractAnimationPrivate
{
- Q_DECLARE_PUBLIC(QmlPauseAnimation)
+ Q_DECLARE_PUBLIC(QDeclarativePauseAnimation)
public:
- QmlPauseAnimationPrivate()
- : QmlAbstractAnimationPrivate(), pa(0) {}
+ QDeclarativePauseAnimationPrivate()
+ : QDeclarativeAbstractAnimationPrivate(), pa(0) {}
void init();
QPauseAnimation *pa;
};
-class QmlScriptActionPrivate : public QmlAbstractAnimationPrivate
+class QDeclarativeScriptActionPrivate : public QDeclarativeAbstractAnimationPrivate
{
- Q_DECLARE_PUBLIC(QmlScriptAction)
+ Q_DECLARE_PUBLIC(QDeclarativeScriptAction)
public:
- QmlScriptActionPrivate()
- : QmlAbstractAnimationPrivate(), hasRunScriptScript(false), proxy(this), rsa(0) {}
+ QDeclarativeScriptActionPrivate()
+ : QDeclarativeAbstractAnimationPrivate(), hasRunScriptScript(false), proxy(this), rsa(0) {}
void init();
- QmlScriptString script;
+ QDeclarativeScriptString script;
QString name;
- QmlScriptString runScriptScript;
+ QDeclarativeScriptString runScriptScript;
bool hasRunScriptScript;
void execute();
- QAnimationActionProxy<QmlScriptActionPrivate,
- &QmlScriptActionPrivate::execute> proxy;
+ QAnimationActionProxy<QDeclarativeScriptActionPrivate,
+ &QDeclarativeScriptActionPrivate::execute> proxy;
QActionAnimation *rsa;
};
-class QmlPropertyActionPrivate : public QmlAbstractAnimationPrivate
+class QDeclarativePropertyActionPrivate : public QDeclarativeAbstractAnimationPrivate
{
- Q_DECLARE_PUBLIC(QmlPropertyAction)
+ Q_DECLARE_PUBLIC(QDeclarativePropertyAction)
public:
- QmlPropertyActionPrivate()
- : QmlAbstractAnimationPrivate(), target(0), spa(0) {}
+ QDeclarativePropertyActionPrivate()
+ : QDeclarativeAbstractAnimationPrivate(), target(0), spa(0) {}
void init();
@@ -278,48 +288,46 @@ public:
QList<QObject *> targets;
QList<QObject *> exclude;
- QmlNullableValue<QVariant> value;
+ QDeclarativeNullableValue<QVariant> value;
QActionAnimation *spa;
};
-class QmlParentActionPrivate : public QmlAbstractAnimationPrivate
+class QDeclarativeParentActionPrivate : public QDeclarativeAbstractAnimationPrivate
{
- Q_DECLARE_PUBLIC(QmlParentAction)
+ Q_DECLARE_PUBLIC(QDeclarativeParentAction)
public:
- QmlParentActionPrivate()
- : QmlAbstractAnimationPrivate(), pcTarget(0), pcParent(0) {}
+ QDeclarativeParentActionPrivate()
+ : QDeclarativeAbstractAnimationPrivate(), pcTarget(0), pcParent(0) {}
void init();
- QmlGraphicsItem *pcTarget;
- QmlGraphicsItem *pcParent;
+ QDeclarativeItem *pcTarget;
+ QDeclarativeItem *pcParent;
void doAction();
QActionAnimation *cpa;
};
-class QmlAnimationGroupPrivate : public QmlAbstractAnimationPrivate
+class QDeclarativeAnimationGroupPrivate : public QDeclarativeAbstractAnimationPrivate
{
- Q_DECLARE_PUBLIC(QmlAnimationGroup)
+ Q_DECLARE_PUBLIC(QDeclarativeAnimationGroup)
public:
- QmlAnimationGroupPrivate()
- : QmlAbstractAnimationPrivate(), ag(0) {}
-
- 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;
+ QDeclarativeAnimationGroupPrivate()
+ : QDeclarativeAbstractAnimationPrivate(), ag(0) {}
+
+ static void append_animation(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list, QDeclarativeAbstractAnimation *role);
+ static void clear_animation(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list);
+ QList<QDeclarativeAbstractAnimation *> animations;
QAnimationGroup *ag;
};
-class QmlPropertyAnimationPrivate : public QmlAbstractAnimationPrivate
+class QDeclarativePropertyAnimationPrivate : public QDeclarativeAbstractAnimationPrivate
{
- Q_DECLARE_PUBLIC(QmlPropertyAnimation)
+ Q_DECLARE_PUBLIC(QDeclarativePropertyAnimation)
public:
- QmlPropertyAnimationPrivate()
- : QmlAbstractAnimationPrivate(), target(0), fromSourced(false), fromIsDefined(false), toIsDefined(false),
+ QDeclarativePropertyAnimationPrivate()
+ : QDeclarativeAbstractAnimationPrivate(), target(0), fromSourced(false), fromIsDefined(false), toIsDefined(false),
rangeIsSet(false), defaultToInterpolatorType(0), interpolatorType(0), interpolator(0), va(0) {}
void init();
@@ -327,7 +335,7 @@ public:
QVariant from;
QVariant to;
- QString easing;
+ QEasingCurve easing;
QObject *target;
QString propertyName;
@@ -344,21 +352,40 @@ public:
int interpolatorType;
QVariantAnimation::Interpolator interpolator;
- QmlTimeLineValueAnimator *va;
+ QDeclarativeTimeLineValueAnimator *va;
static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress);
static void convertVariant(QVariant &variant, int type);
};
-class QmlRotationAnimationPrivate : public QmlPropertyAnimationPrivate
+class QDeclarativeRotationAnimationPrivate : public QDeclarativePropertyAnimationPrivate
{
- Q_DECLARE_PUBLIC(QmlRotationAnimation)
+ Q_DECLARE_PUBLIC(QDeclarativeRotationAnimation)
public:
- QmlRotationAnimationPrivate() : direction(QmlRotationAnimation::Shortest) {}
+ QDeclarativeRotationAnimationPrivate() : direction(QDeclarativeRotationAnimation::Shortest) {}
+
+ QDeclarativeRotationAnimation::RotationDirection direction;
+};
+
+class QDeclarativeParentAnimationPrivate : public QDeclarativeAnimationGroupPrivate
+{
+ Q_DECLARE_PUBLIC(QDeclarativeParentAnimation)
+public:
+ QDeclarativeParentAnimationPrivate()
+ : QDeclarativeAnimationGroupPrivate(), target(0), newParent(0),
+ via(0), topLevelGroup(0), startAction(0), endAction(0) {}
+
+ QDeclarativeItem *target;
+ QDeclarativeItem *newParent;
+ QDeclarativeItem *via;
+
+ QSequentialAnimationGroup *topLevelGroup;
+ QActionAnimation *startAction;
+ QActionAnimation *endAction;
- QmlRotationAnimation::RotationDirection direction;
+ QPointF computeTransformOrigin(QDeclarativeItem::TransformOrigin origin, qreal width, qreal height) const;
};
QT_END_NAMESPACE
-#endif // QMLANIMATION_P_H
+#endif // QDECLARATIVEANIMATION_P_H
diff --git a/src/declarative/util/qmlbehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp
index d65d8cd..e0189dc 100644
--- a/src/declarative/util/qmlbehavior.cpp
+++ b/src/declarative/util/qdeclarativebehavior.cpp
@@ -39,13 +39,14 @@
**
****************************************************************************/
-#include "qmlbehavior_p.h"
+#include "qdeclarativebehavior_p.h"
-#include "qmlanimation_p.h"
-#include "qmltransition_p.h"
+#include "qdeclarativeanimation_p.h"
+#include "qdeclarativetransition_p.h"
-#include <qmlcontext.h>
-#include <qmlinfo.h>
+#include <qdeclarativecontext.h>
+#include <qdeclarativeinfo.h>
+#include <qdeclarativeproperty_p.h>
#include <QtCore/qparallelanimationgroup.h>
@@ -53,25 +54,25 @@
QT_BEGIN_NAMESPACE
-QML_DEFINE_TYPE(Qt,4,6,Behavior,QmlBehavior)
-class QmlBehaviorPrivate : public QObjectPrivate
+
+class QDeclarativeBehaviorPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlBehavior)
+ Q_DECLARE_PUBLIC(QDeclarativeBehavior)
public:
- QmlBehaviorPrivate() : animation(0), enabled(true) {}
+ QDeclarativeBehaviorPrivate() : animation(0), enabled(true) {}
- QmlMetaProperty property;
+ QDeclarativeProperty property;
QVariant currentValue;
- QmlAbstractAnimation *animation;
+ QDeclarativeAbstractAnimation *animation;
bool enabled;
};
/*!
- \qmlclass Behavior QmlBehavior
+ \qmlclass Behavior QDeclarativeBehavior
\brief The Behavior element allows you to specify a default animation for a property change.
- Behaviors provide one way to specify \l{qmlanimation.html}{animations} in QML.
+ Behaviors provide one way to specify \l{qdeclarativeanimation.html}{animations} in QML.
In the example below, the rect will use a bounce easing curve over 200 millisecond for any changes to its y property:
\code
@@ -93,12 +94,12 @@ public:
*/
-QmlBehavior::QmlBehavior(QObject *parent)
- : QObject(*(new QmlBehaviorPrivate), parent)
+QDeclarativeBehavior::QDeclarativeBehavior(QObject *parent)
+ : QObject(*(new QDeclarativeBehaviorPrivate), parent)
{
}
-QmlBehavior::~QmlBehavior()
+QDeclarativeBehavior::~QDeclarativeBehavior()
{
}
@@ -109,15 +110,15 @@ QmlBehavior::~QmlBehavior()
The animation to use when the behavior is triggered.
*/
-QmlAbstractAnimation *QmlBehavior::animation()
+QDeclarativeAbstractAnimation *QDeclarativeBehavior::animation()
{
- Q_D(QmlBehavior);
+ Q_D(QDeclarativeBehavior);
return d->animation;
}
-void QmlBehavior::setAnimation(QmlAbstractAnimation *animation)
+void QDeclarativeBehavior::setAnimation(QDeclarativeAbstractAnimation *animation)
{
- Q_D(QmlBehavior);
+ Q_D(QDeclarativeBehavior);
if (d->animation) {
qmlInfo(this) << tr("Cannot change the animation assigned to a Behavior.");
return;
@@ -137,26 +138,26 @@ void QmlBehavior::setAnimation(QmlAbstractAnimation *animation)
By default a Behavior is enabled.
*/
-bool QmlBehavior::enabled() const
+bool QDeclarativeBehavior::enabled() const
{
- Q_D(const QmlBehavior);
+ Q_D(const QDeclarativeBehavior);
return d->enabled;
}
-void QmlBehavior::setEnabled(bool enabled)
+void QDeclarativeBehavior::setEnabled(bool enabled)
{
- Q_D(QmlBehavior);
+ Q_D(QDeclarativeBehavior);
if (d->enabled == enabled)
return;
d->enabled = enabled;
emit enabledChanged();
}
-void QmlBehavior::write(const QVariant &value)
+void QDeclarativeBehavior::write(const QVariant &value)
{
- Q_D(QmlBehavior);
+ Q_D(QDeclarativeBehavior);
if (!d->animation || !d->enabled) {
- d->property.write(value, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
return;
}
@@ -164,24 +165,24 @@ void QmlBehavior::write(const QVariant &value)
d->animation->qtAnimation()->stop();
- QmlStateOperation::ActionList actions;
- QmlAction action;
+ QDeclarativeStateOperation::ActionList actions;
+ QDeclarativeAction action;
action.property = d->property;
action.fromValue = d->currentValue;
action.toValue = value;
actions << action;
- QList<QmlMetaProperty> after;
+ QList<QDeclarativeProperty> after;
if (d->animation)
- d->animation->transition(actions, after, QmlAbstractAnimation::Forward);
+ d->animation->transition(actions, after, QDeclarativeAbstractAnimation::Forward);
d->animation->qtAnimation()->start();
if (!after.contains(d->property))
- d->property.write(value, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
}
-void QmlBehavior::setTarget(const QmlMetaProperty &property)
+void QDeclarativeBehavior::setTarget(const QDeclarativeProperty &property)
{
- Q_D(QmlBehavior);
+ Q_D(QDeclarativeBehavior);
d->property = property;
d->currentValue = property.read();
if (d->animation)
diff --git a/src/declarative/util/qmlbehavior_p.h b/src/declarative/util/qdeclarativebehavior_p.h
index ee9e862..a633b55 100644
--- a/src/declarative/util/qmlbehavior_p.h
+++ b/src/declarative/util/qdeclarativebehavior_p.h
@@ -39,14 +39,14 @@
**
****************************************************************************/
-#ifndef QMLBEHAVIOR_H
-#define QMLBEHAVIOR_H
+#ifndef QDECLARATIVEBEHAVIOR_H
+#define QDECLARATIVEBEHAVIOR_H
-#include "qmlstate_p.h"
+#include "qdeclarativestate_p.h"
-#include <qmlpropertyvaluesource.h>
-#include <qmlpropertyvalueinterceptor.h>
-#include <qml.h>
+#include <qdeclarativepropertyvaluesource.h>
+#include <qdeclarativepropertyvalueinterceptor.h>
+#include <qdeclarative.h>
QT_BEGIN_HEADER
@@ -54,27 +54,27 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlAbstractAnimation;
-class QmlBehaviorPrivate;
-class Q_DECLARATIVE_EXPORT QmlBehavior : public QObject, public QmlPropertyValueInterceptor
+class QDeclarativeAbstractAnimation;
+class QDeclarativeBehaviorPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeBehavior : public QObject, public QDeclarativePropertyValueInterceptor
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlBehavior)
+ Q_DECLARE_PRIVATE(QDeclarativeBehavior)
- Q_INTERFACES(QmlPropertyValueInterceptor)
+ Q_INTERFACES(QDeclarativePropertyValueInterceptor)
Q_CLASSINFO("DefaultProperty", "animation")
- Q_PROPERTY(QmlAbstractAnimation *animation READ animation WRITE setAnimation)
+ Q_PROPERTY(QDeclarativeAbstractAnimation *animation READ animation WRITE setAnimation)
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
public:
- QmlBehavior(QObject *parent=0);
- ~QmlBehavior();
+ QDeclarativeBehavior(QObject *parent=0);
+ ~QDeclarativeBehavior();
- virtual void setTarget(const QmlMetaProperty &);
+ virtual void setTarget(const QDeclarativeProperty &);
virtual void write(const QVariant &value);
- QmlAbstractAnimation *animation();
- void setAnimation(QmlAbstractAnimation *);
+ QDeclarativeAbstractAnimation *animation();
+ void setAnimation(QDeclarativeAbstractAnimation *);
bool enabled() const;
void setEnabled(bool enabled);
@@ -85,8 +85,8 @@ Q_SIGNALS:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlBehavior)
+QML_DECLARE_TYPE(QDeclarativeBehavior)
QT_END_HEADER
-#endif // QMLBEHAVIOR_H
+#endif // QDECLARATIVEBEHAVIOR_H
diff --git a/src/declarative/util/qmlbind.cpp b/src/declarative/util/qdeclarativebind.cpp
index 6743edd..e95a03e 100644
--- a/src/declarative/util/qmlbind.cpp
+++ b/src/declarative/util/qdeclarativebind.cpp
@@ -39,12 +39,13 @@
**
****************************************************************************/
-#include "qmlbind_p.h"
+#include "qdeclarativebind_p.h"
-#include "qmlnullablevalue_p_p.h"
+#include "qdeclarativenullablevalue_p_p.h"
-#include <qmlengine.h>
-#include <qmlcontext.h>
+#include <qdeclarativeengine.h>
+#include <qdeclarativecontext.h>
+#include <qdeclarativeproperty.h>
#include <QtCore/qfile.h>
#include <QtCore/qdebug.h>
@@ -56,21 +57,21 @@
QT_BEGIN_NAMESPACE
-class QmlBindPrivate : public QObjectPrivate
+class QDeclarativeBindPrivate : public QObjectPrivate
{
public:
- QmlBindPrivate() : when(true), componentComplete(false), obj(0) {}
+ QDeclarativeBindPrivate() : when(true), componentComplete(false), obj(0) {}
bool when : 1;
bool componentComplete : 1;
QObject *obj;
QString prop;
- QmlNullableValue<QVariant> value;
+ QDeclarativeNullableValue<QVariant> value;
};
-QML_DEFINE_TYPE(Qt,4,6,Binding,QmlBind)
+
/*!
- \qmlclass Binding QmlBind
+ \qmlclass Binding QDeclarativeBind
\since 4.7
\brief The Binding element allows arbitrary property bindings to be created.
@@ -94,34 +95,34 @@ QML_DEFINE_TYPE(Qt,4,6,Binding,QmlBind)
*/
/*!
\internal
- \class QmlBind
+ \class QDeclarativeBind
\ingroup group_utility
- \brief The QmlBind class allows arbitrary property bindings to be created.
+ \brief The QDeclarativeBind class allows arbitrary property bindings to be created.
Simple bindings are usually earier to do in-place rather than creating a
- QmlBind item. For that reason, QmlBind is usually used to transfer property information
+ QDeclarativeBind item. For that reason, QDeclarativeBind is usually used to transfer property information
from Qml to C++.
\sa cppqml
*/
-QmlBind::QmlBind(QObject *parent)
- : QObject(*(new QmlBindPrivate), parent)
+QDeclarativeBind::QDeclarativeBind(QObject *parent)
+ : QObject(*(new QDeclarativeBindPrivate), parent)
{
}
-QmlBind::~QmlBind()
+QDeclarativeBind::~QDeclarativeBind()
{
}
-bool QmlBind::when() const
+bool QDeclarativeBind::when() const
{
- Q_D(const QmlBind);
+ Q_D(const QDeclarativeBind);
return d->when;
}
-void QmlBind::setWhen(bool v)
+void QDeclarativeBind::setWhen(bool v)
{
- Q_D(QmlBind);
+ Q_D(QDeclarativeBind);
d->when = v;
eval();
}
@@ -131,15 +132,15 @@ void QmlBind::setWhen(bool v)
The object to be updated.
*/
-QObject *QmlBind::object()
+QObject *QDeclarativeBind::object()
{
- Q_D(const QmlBind);
+ Q_D(const QDeclarativeBind);
return d->obj;
}
-void QmlBind::setObject(QObject *obj)
+void QDeclarativeBind::setObject(QObject *obj)
{
- Q_D(QmlBind);
+ Q_D(QDeclarativeBind);
d->obj = obj;
eval();
}
@@ -149,15 +150,15 @@ void QmlBind::setObject(QObject *obj)
The property to be updated.
*/
-QString QmlBind::property() const
+QString QDeclarativeBind::property() const
{
- Q_D(const QmlBind);
+ Q_D(const QDeclarativeBind);
return d->prop;
}
-void QmlBind::setProperty(const QString &p)
+void QDeclarativeBind::setProperty(const QString &p)
{
- Q_D(QmlBind);
+ Q_D(QDeclarativeBind);
d->prop = p;
eval();
}
@@ -168,34 +169,34 @@ void QmlBind::setProperty(const QString &p)
The value to be set on the target object and property. This can be a
constant (which isn't very useful), or a bound expression.
*/
-QVariant QmlBind::value() const
+QVariant QDeclarativeBind::value() const
{
- Q_D(const QmlBind);
+ Q_D(const QDeclarativeBind);
return d->value.value;
}
-void QmlBind::setValue(const QVariant &v)
+void QDeclarativeBind::setValue(const QVariant &v)
{
- Q_D(QmlBind);
+ Q_D(QDeclarativeBind);
d->value.value = v;
d->value.isNull = false;
eval();
}
-void QmlBind::componentComplete()
+void QDeclarativeBind::componentComplete()
{
- Q_D(QmlBind);
+ Q_D(QDeclarativeBind);
d->componentComplete = true;
eval();
}
-void QmlBind::eval()
+void QDeclarativeBind::eval()
{
- Q_D(QmlBind);
+ Q_D(QDeclarativeBind);
if (!d->obj || d->value.isNull || !d->when || !d->componentComplete)
return;
- QmlMetaProperty prop(d->obj, d->prop);
+ QDeclarativeProperty prop(d->obj, d->prop);
prop.write(d->value.value);
}
diff --git a/src/declarative/util/qmlbind_p.h b/src/declarative/util/qdeclarativebind_p.h
index 6fdd2dc..f756e80 100644
--- a/src/declarative/util/qmlbind_p.h
+++ b/src/declarative/util/qdeclarativebind_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLBIND_H
-#define QMLBIND_H
+#ifndef QDECLARATIVEBIND_H
+#define QDECLARATIVEBIND_H
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtCore/qobject.h>
@@ -52,20 +52,20 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlBindPrivate;
-class Q_DECLARATIVE_EXPORT QmlBind : public QObject, public QmlParserStatus
+class QDeclarativeBindPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeBind : public QObject, public QDeclarativeParserStatus
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlBind)
- Q_INTERFACES(QmlParserStatus)
+ Q_DECLARE_PRIVATE(QDeclarativeBind)
+ Q_INTERFACES(QDeclarativeParserStatus)
Q_PROPERTY(QObject *target READ object WRITE setObject)
Q_PROPERTY(QString property READ property WRITE setProperty)
Q_PROPERTY(QVariant value READ value WRITE setValue)
Q_PROPERTY(bool when READ when WRITE setWhen)
public:
- QmlBind(QObject *parent=0);
- ~QmlBind();
+ QDeclarativeBind(QObject *parent=0);
+ ~QDeclarativeBind();
bool when() const;
void setWhen(bool);
@@ -88,7 +88,7 @@ private:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlBind)
+QML_DECLARE_TYPE(QDeclarativeBind)
QT_END_HEADER
diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp
new file mode 100644
index 0000000..0b9e3ab
--- /dev/null
+++ b/src/declarative/util/qdeclarativeconnections.cpp
@@ -0,0 +1,245 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 "qdeclarativeconnections_p.h"
+
+#include <qdeclarativeexpression.h>
+#include <qdeclarativeproperty_p.h>
+#include <qdeclarativeboundsignal_p.h>
+#include <qdeclarativecontext.h>
+#include <qdeclarativeinfo.h>
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qstringlist.h>
+
+#include <private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeConnectionsPrivate : public QObjectPrivate
+{
+public:
+ QDeclarativeConnectionsPrivate() : target(0), componentcomplete(false) {}
+
+ QList<QDeclarativeBoundSignal*> boundsignals;
+ QObject *target;
+
+ bool componentcomplete;
+
+ QByteArray data;
+};
+
+/*!
+ \qmlclass Connections QDeclarativeConnections
+ \since 4.7
+ \brief A Connections object describes generalized connections to signals.
+
+ When connecting to signals in QML, the usual way is to create an
+ "on<Signal>" handler that reacts when a signal is received, like this:
+
+ \qml
+ MouseArea {
+ onClicked: { foo(...) }
+ }
+ \endqml
+
+ However, in some cases, it is not possible to connect to a signal in this
+ way, such as:
+
+ \list
+ \i multiple connections to the same signal
+ \i connections outside the scope of the signal sender
+ \i connections to targets not defined in QML
+ \endlist
+
+ When any of these are needed, the Connections object can be used instead.
+
+ For example, the above code can be changed to use a Connections object,
+ like this:
+
+ \qml
+ MouseArea {
+ Connections {
+ onClicked: foo(...)
+ }
+ }
+ \endqml
+
+ More generally, the Connections object can be a child of some other object than
+ the sender of the signal:
+
+ \qml
+ MouseArea {
+ id: area
+ }
+ ...
+ Connections {
+ target: area
+ onClicked: foo(...)
+ }
+ \endqml
+*/
+
+/*!
+ \internal
+ \class QDeclarativeConnections
+ \brief The QDeclarativeConnections class describes generalized connections to signals.
+
+*/
+QDeclarativeConnections::QDeclarativeConnections(QObject *parent) :
+ QObject(*(new QDeclarativeConnectionsPrivate), parent)
+{
+}
+
+QDeclarativeConnections::~QDeclarativeConnections()
+{
+}
+
+/*!
+ \qmlproperty Object Connections::target
+ This property holds the object that sends the signal.
+
+ By default, the target is assumed to be the parent of the Connections.
+*/
+QObject *QDeclarativeConnections::target() const
+{
+ Q_D(const QDeclarativeConnections);
+ return d->target ? d->target : parent();
+}
+
+void QDeclarativeConnections::setTarget(QObject *obj)
+{
+ Q_D(QDeclarativeConnections);
+ if (d->target == obj)
+ return;
+ foreach (QDeclarativeBoundSignal *s, d->boundsignals)
+ delete s;
+ d->boundsignals.clear();
+ d->target = obj;
+ connectSignals();
+ emit targetChanged();
+}
+
+
+QByteArray
+QDeclarativeConnectionsParser::compile(const QList<QDeclarativeCustomParserProperty> &props)
+{
+ QByteArray rv;
+ QDataStream ds(&rv, QIODevice::WriteOnly);
+
+ for(int ii = 0; ii < props.count(); ++ii)
+ {
+ QString propName = QString::fromUtf8(props.at(ii).name());
+ if (!propName.startsWith(QLatin1String("on")) || !propName.at(2).isUpper()) {
+ error(props.at(ii), QDeclarativeConnections::tr("Cannot assign to non-existent property \"%1\"").arg(propName));
+ return QByteArray();
+ }
+
+ QList<QVariant> values = props.at(ii).assignedValues();
+
+ for (int i = 0; i < values.count(); ++i) {
+ const QVariant &value = values.at(i);
+
+ if (value.userType() == qMetaTypeId<QDeclarativeCustomParserNode>()) {
+ error(props.at(ii), QDeclarativeConnections::tr("Connections: nested objects not allowed"));
+ return QByteArray();
+ } else if (value.userType() == qMetaTypeId<QDeclarativeCustomParserProperty>()) {
+ error(props.at(ii), QDeclarativeConnections::tr("Connections: syntax error"));
+ return QByteArray();
+ } else {
+ QDeclarativeParser::Variant v = qvariant_cast<QDeclarativeParser::Variant>(value);
+ if (v.isScript()) {
+ ds << propName;
+ ds << v.asScript();
+ } else {
+ error(props.at(ii), QDeclarativeConnections::tr("Connections: script expected"));
+ return QByteArray();
+ }
+ }
+ }
+ }
+
+ return rv;
+}
+
+void QDeclarativeConnectionsParser::setCustomData(QObject *object,
+ const QByteArray &data)
+{
+ QDeclarativeConnectionsPrivate *p =
+ static_cast<QDeclarativeConnectionsPrivate *>(QObjectPrivate::get(object));
+ p->data = data;
+}
+
+
+void QDeclarativeConnections::connectSignals()
+{
+ Q_D(QDeclarativeConnections);
+ if (!d->componentcomplete)
+ return;
+
+ QDataStream ds(d->data);
+ while (!ds.atEnd()) {
+ QString propName;
+ ds >> propName;
+ QString script;
+ ds >> script;
+ QDeclarativeProperty prop(target(), propName);
+ if (!prop.isValid()) {
+ qmlInfo(this) << tr("Cannot assign to non-existent property \"%1\"").arg(propName);
+ } else if (prop.type() & QDeclarativeProperty::SignalProperty) {
+ QDeclarativeBoundSignal *signal =
+ new QDeclarativeBoundSignal(target(), prop.method(), this);
+ signal->setExpression(new QDeclarativeExpression(qmlContext(this), script, 0));
+ d->boundsignals += signal;
+ } else {
+ qmlInfo(this) << tr("Cannot assign to non-existent property \"%1\"").arg(propName);
+ }
+ }
+}
+
+void QDeclarativeConnections::componentComplete()
+{
+ Q_D(QDeclarativeConnections);
+ d->componentcomplete=true;
+ connectSignals();
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlconnection_p.h b/src/declarative/util/qdeclarativeconnections_p.h
index 2106cb0..3eacf12 100644
--- a/src/declarative/util/qmlconnection_p.h
+++ b/src/declarative/util/qdeclarativeconnections_p.h
@@ -39,11 +39,12 @@
**
****************************************************************************/
-#ifndef QMLCONNECTION_H
-#define QMLCONNECTION_H
+#ifndef QDECLARATIVECONNECTIONS_H
+#define QDECLARATIVECONNECTIONS_H
-#include <qml.h>
-#include <qmlscriptstring.h>
+#include <qdeclarative.h>
+#include <qdeclarativescriptstring.h>
+#include <private/qdeclarativecustomparser_p.h>
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
@@ -54,39 +55,43 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlBoundSignal;
-class QmlContext;
-class QmlConnectionPrivate;
-class Q_DECLARATIVE_EXPORT QmlConnection : public QObject, public QmlParserStatus
+class QDeclarativeBoundSignal;
+class QDeclarativeContext;
+class QDeclarativeConnectionsPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeConnections : public QObject, public QDeclarativeParserStatus
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlConnection)
+ Q_DECLARE_PRIVATE(QDeclarativeConnections)
- Q_INTERFACES(QmlParserStatus)
- Q_PROPERTY(QObject *sender READ signalSender WRITE setSignalSender)
- Q_PROPERTY(QmlScriptString script READ script WRITE setScript)
- Q_PROPERTY(QString signal READ signal WRITE setSignal)
+ Q_INTERFACES(QDeclarativeParserStatus)
+ Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
public:
- QmlConnection(QObject *parent=0);
- ~QmlConnection();
+ QDeclarativeConnections(QObject *parent=0);
+ ~QDeclarativeConnections();
- QObject *signalSender() const;
- void setSignalSender(QObject *);
- QmlScriptString script() const;
- void setScript(const QmlScriptString&);
- QString signal() const;
- void setSignal(const QString&);
+ QObject *target() const;
+ void setTarget(QObject *);
+
+Q_SIGNALS:
+ void targetChanged();
private:
- void disconnectIfValid();
- void connectIfValid();
+ void connectSignals();
void componentComplete();
};
+class QDeclarativeConnectionsParser : public QDeclarativeCustomParser
+{
+public:
+ virtual QByteArray compile(const QList<QDeclarativeCustomParserProperty> &);
+ virtual void setCustomData(QObject *, const QByteArray &);
+};
+
+
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlConnection)
+QML_DECLARE_TYPE(QDeclarativeConnections)
QT_END_HEADER
diff --git a/src/declarative/util/qmldatetimeformatter.cpp b/src/declarative/util/qdeclarativedatetimeformatter.cpp
index 4b8fb00..4087091 100644
--- a/src/declarative/util/qmldatetimeformatter.cpp
+++ b/src/declarative/util/qdeclarativedatetimeformatter.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmldatetimeformatter_p.h"
+#include "qdeclarativedatetimeformatter_p.h"
#include <QtCore/qlocale.h>
@@ -50,11 +50,11 @@ QT_BEGIN_NAMESPACE
//TODO: may need optimisation as the QDateTime member may not be needed?
// be able to set a locale?
-class QmlDateTimeFormatterPrivate : public QObjectPrivate
+class QDeclarativeDateTimeFormatterPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlDateTimeFormatter)
+ Q_DECLARE_PUBLIC(QDeclarativeDateTimeFormatter)
public:
- QmlDateTimeFormatterPrivate() : locale(QLocale::system()), longStyle(false), componentComplete(true) {}
+ QDeclarativeDateTimeFormatterPrivate() : locale(QLocale::system()), longStyle(false), componentComplete(true) {}
void updateText();
@@ -73,7 +73,7 @@ public:
};
/*!
- \qmlclass DateTimeFormatter QmlDateTimeFormatter
+ \qmlclass DateTimeFormatter QDeclarativeDateTimeFormatter
\since 4.7
\brief The DateTimeFormatter allows you to control the format of a date string.
@@ -88,17 +88,17 @@ public:
/*!
\internal
- \class QmlDateTimeFormatter
+ \class QDeclarativeDateTimeFormatter
\ingroup group_utility
- \brief The QmlDateTimeFormatter class allows you to format a date string.
+ \brief The QDeclarativeDateTimeFormatter class allows you to format a date string.
*/
-QmlDateTimeFormatter::QmlDateTimeFormatter(QObject *parent)
-: QObject(*(new QmlDateTimeFormatterPrivate), parent)
+QDeclarativeDateTimeFormatter::QDeclarativeDateTimeFormatter(QObject *parent)
+: QObject(*(new QDeclarativeDateTimeFormatterPrivate), parent)
{
}
-QmlDateTimeFormatter::~QmlDateTimeFormatter()
+QDeclarativeDateTimeFormatter::~QDeclarativeDateTimeFormatter()
{
}
@@ -128,21 +128,21 @@ QmlDateTimeFormatter::~QmlDateTimeFormatter()
Text { text: "2/19/09" }
\endcode
*/
-QString QmlDateTimeFormatter::dateTimeText() const
+QString QDeclarativeDateTimeFormatter::dateTimeText() const
{
- Q_D(const QmlDateTimeFormatter);
+ Q_D(const QDeclarativeDateTimeFormatter);
return d->dateTimeText;
}
-QString QmlDateTimeFormatter::dateText() const
+QString QDeclarativeDateTimeFormatter::dateText() const
{
- Q_D(const QmlDateTimeFormatter);
+ Q_D(const QDeclarativeDateTimeFormatter);
return d->dateText;
}
-QString QmlDateTimeFormatter::timeText() const
+QString QDeclarativeDateTimeFormatter::timeText() const
{
- Q_D(const QmlDateTimeFormatter);
+ Q_D(const QDeclarativeDateTimeFormatter);
return d->timeText;
}
@@ -171,21 +171,21 @@ QString QmlDateTimeFormatter::timeText() const
If no time is set, the dateTimeText will be just the time.
*/
-QDate QmlDateTimeFormatter::date() const
+QDate QDeclarativeDateTimeFormatter::date() const
{
- Q_D(const QmlDateTimeFormatter);
+ Q_D(const QDeclarativeDateTimeFormatter);
return d->date;
}
-QTime QmlDateTimeFormatter::time() const
+QTime QDeclarativeDateTimeFormatter::time() const
{
- Q_D(const QmlDateTimeFormatter);
+ Q_D(const QDeclarativeDateTimeFormatter);
return d->time;
}
-QDateTime QmlDateTimeFormatter::dateTime() const
+QDateTime QDeclarativeDateTimeFormatter::dateTime() const
{
- Q_D(const QmlDateTimeFormatter);
+ Q_D(const QDeclarativeDateTimeFormatter);
return d->dateTime;
}
@@ -218,21 +218,21 @@ QDateTime QmlDateTimeFormatter::dateTime() const
Assigning an empty string to a particular format will reset it.
*/
-QString QmlDateTimeFormatter::dateTimeFormat() const
+QString QDeclarativeDateTimeFormatter::dateTimeFormat() const
{
- Q_D(const QmlDateTimeFormatter);
+ Q_D(const QDeclarativeDateTimeFormatter);
return d->dateTimeFormat;
}
-QString QmlDateTimeFormatter::dateFormat() const
+QString QDeclarativeDateTimeFormatter::dateFormat() const
{
- Q_D(const QmlDateTimeFormatter);
+ Q_D(const QDeclarativeDateTimeFormatter);
return d->dateFormat;
}
-QString QmlDateTimeFormatter::timeFormat() const
+QString QDeclarativeDateTimeFormatter::timeFormat() const
{
- Q_D(const QmlDateTimeFormatter);
+ Q_D(const QDeclarativeDateTimeFormatter);
return d->timeFormat;
}
@@ -244,15 +244,15 @@ QString QmlDateTimeFormatter::timeFormat() const
This setting is off by default.
*/
-bool QmlDateTimeFormatter::longStyle() const
+bool QDeclarativeDateTimeFormatter::longStyle() const
{
- Q_D(const QmlDateTimeFormatter);
+ Q_D(const QDeclarativeDateTimeFormatter);
return d->longStyle;
}
-void QmlDateTimeFormatter::setDateTime(const QDateTime &dateTime)
+void QDeclarativeDateTimeFormatter::setDateTime(const QDateTime &dateTime)
{
- Q_D(QmlDateTimeFormatter);
+ Q_D(QDeclarativeDateTimeFormatter);
if (d->dateTime == dateTime)
return;
d->dateTime = dateTime;
@@ -261,9 +261,9 @@ void QmlDateTimeFormatter::setDateTime(const QDateTime &dateTime)
d->updateText();
}
-void QmlDateTimeFormatter::setTime(const QTime &time)
+void QDeclarativeDateTimeFormatter::setTime(const QTime &time)
{
- Q_D(QmlDateTimeFormatter);
+ Q_D(QDeclarativeDateTimeFormatter);
if (d->dateTime.time() == time)
return;
d->time = time;
@@ -271,9 +271,9 @@ void QmlDateTimeFormatter::setTime(const QTime &time)
d->updateText();
}
-void QmlDateTimeFormatter::setDate(const QDate &date)
+void QDeclarativeDateTimeFormatter::setDate(const QDate &date)
{
- Q_D(QmlDateTimeFormatter);
+ Q_D(QDeclarativeDateTimeFormatter);
if (d->dateTime.date() == date)
return;
d->date = date;
@@ -285,40 +285,40 @@ void QmlDateTimeFormatter::setDate(const QDate &date)
}
//DateTime formatting may be a combination of date and time?
-void QmlDateTimeFormatter::setDateTimeFormat(const QString &format)
+void QDeclarativeDateTimeFormatter::setDateTimeFormat(const QString &format)
{
- Q_D(QmlDateTimeFormatter);
+ Q_D(QDeclarativeDateTimeFormatter);
//no format checking
d->dateTimeFormat = format;
d->updateText();
}
-void QmlDateTimeFormatter::setDateFormat(const QString &format)
+void QDeclarativeDateTimeFormatter::setDateFormat(const QString &format)
{
- Q_D(QmlDateTimeFormatter);
+ Q_D(QDeclarativeDateTimeFormatter);
//no format checking
d->dateFormat = format;
d->updateText();
}
-void QmlDateTimeFormatter::setTimeFormat(const QString &format)
+void QDeclarativeDateTimeFormatter::setTimeFormat(const QString &format)
{
- Q_D(QmlDateTimeFormatter);
+ Q_D(QDeclarativeDateTimeFormatter);
//no format checking
d->timeFormat = format;
d->updateText();
}
-void QmlDateTimeFormatter::setLongStyle(bool longStyle)
+void QDeclarativeDateTimeFormatter::setLongStyle(bool longStyle)
{
- Q_D(QmlDateTimeFormatter);
+ Q_D(QDeclarativeDateTimeFormatter);
d->longStyle = longStyle;
d->updateText();
}
-void QmlDateTimeFormatterPrivate::updateText()
+void QDeclarativeDateTimeFormatterPrivate::updateText()
{
- Q_Q(QmlDateTimeFormatter);
+ Q_Q(QDeclarativeDateTimeFormatter);
if (!componentComplete)
return;
@@ -355,19 +355,19 @@ void QmlDateTimeFormatterPrivate::updateText()
emit q->textChanged();
}
-void QmlDateTimeFormatter::classBegin()
+void QDeclarativeDateTimeFormatter::classBegin()
{
- Q_D(QmlDateTimeFormatter);
+ Q_D(QDeclarativeDateTimeFormatter);
d->componentComplete = false;
}
-void QmlDateTimeFormatter::componentComplete()
+void QDeclarativeDateTimeFormatter::componentComplete()
{
- Q_D(QmlDateTimeFormatter);
+ Q_D(QDeclarativeDateTimeFormatter);
d->componentComplete = true;
d->updateText();
}
-QML_DEFINE_TYPE(Qt,4,6,DateTimeFormatter,QmlDateTimeFormatter)
+
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmldatetimeformatter_p.h b/src/declarative/util/qdeclarativedatetimeformatter_p.h
index 2cd80b9..da900be 100644
--- a/src/declarative/util/qmldatetimeformatter_p.h
+++ b/src/declarative/util/qdeclarativedatetimeformatter_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLDATETIMEFORMATTER_H
-#define QMLDATETIMEFORMATTER_H
+#ifndef QDECLARATIVEDATETIMEFORMATTER_H
+#define QDECLARATIVEDATETIMEFORMATTER_H
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtCore/qdatetime.h>
@@ -52,11 +52,11 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlDateTimeFormatterPrivate;
-class Q_DECLARATIVE_EXPORT QmlDateTimeFormatter : public QObject, public QmlParserStatus
+class QDeclarativeDateTimeFormatterPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeDateTimeFormatter : public QObject, public QDeclarativeParserStatus
{
Q_OBJECT
- Q_INTERFACES(QmlParserStatus)
+ Q_INTERFACES(QDeclarativeParserStatus)
Q_PROPERTY(QString dateText READ dateText NOTIFY textChanged)
Q_PROPERTY(QString timeText READ timeText NOTIFY textChanged)
@@ -69,8 +69,8 @@ class Q_DECLARATIVE_EXPORT QmlDateTimeFormatter : public QObject, public QmlPars
Q_PROPERTY(QString dateTimeFormat READ dateTimeFormat WRITE setDateTimeFormat)
Q_PROPERTY(bool longStyle READ longStyle WRITE setLongStyle)
public:
- QmlDateTimeFormatter(QObject *parent=0);
- ~QmlDateTimeFormatter();
+ QDeclarativeDateTimeFormatter(QObject *parent=0);
+ ~QDeclarativeDateTimeFormatter();
QString dateTimeText() const;
QString dateText() const;
@@ -104,13 +104,13 @@ Q_SIGNALS:
void textChanged();
private:
- Q_DISABLE_COPY(QmlDateTimeFormatter)
- Q_DECLARE_PRIVATE(QmlDateTimeFormatter)
+ Q_DISABLE_COPY(QDeclarativeDateTimeFormatter)
+ Q_DECLARE_PRIVATE(QDeclarativeDateTimeFormatter)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlDateTimeFormatter)
+QML_DECLARE_TYPE(QDeclarativeDateTimeFormatter)
QT_END_HEADER
diff --git a/src/declarative/util/qmleasefollow.cpp b/src/declarative/util/qdeclarativeeasefollow.cpp
index deb474a..232dc90 100644
--- a/src/declarative/util/qmleasefollow.cpp
+++ b/src/declarative/util/qdeclarativeeasefollow.cpp
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#include "qmleasefollow_p.h"
+#include "qdeclarativeeasefollow_p.h"
-#include "qmlanimation_p_p.h"
+#include "qdeclarativeanimation_p_p.h"
-#include <qmlmetaproperty.h>
+#include <qdeclarativeproperty.h>
#include <QtCore/qdebug.h>
@@ -51,15 +51,15 @@
QT_BEGIN_NAMESPACE
-QML_DEFINE_TYPE(Qt,4,6,EaseFollow,QmlEaseFollow);
-class QmlEaseFollowPrivate : public QObjectPrivate
+
+class QDeclarativeEaseFollowPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlEaseFollow)
+ Q_DECLARE_PUBLIC(QDeclarativeEaseFollow)
public:
- QmlEaseFollowPrivate()
+ QDeclarativeEaseFollowPrivate()
: source(0), velocity(200), duration(-1), maximumEasingTime(-1),
- reversingMode(QmlEaseFollow::Eased), initialVelocity(0),
+ reversingMode(QDeclarativeEaseFollow::Eased), initialVelocity(0),
initialValue(0), invert(false), enabled(true), trackVelocity(0), clockOffset(0),
lastTick(0), clock(this)
{}
@@ -68,7 +68,7 @@ public:
qreal velocity;
qreal duration;
qreal maximumEasingTime;
- QmlEaseFollow::ReversingMode reversingMode;
+ QDeclarativeEaseFollow::ReversingMode reversingMode;
qreal initialVelocity;
qreal initialValue;
@@ -77,14 +77,14 @@ public:
qreal trackVelocity;
- QmlMetaProperty target;
+ QDeclarativeProperty target;
int clockOffset;
int lastTick;
void tick(int);
void clockStart();
void clockStop();
- QTickAnimationProxy<QmlEaseFollowPrivate, &QmlEaseFollowPrivate::tick> clock;
+ QTickAnimationProxy<QDeclarativeEaseFollowPrivate, &QDeclarativeEaseFollowPrivate::tick> clock;
void restart();
@@ -101,7 +101,7 @@ public:
bool recalc();
};
-bool QmlEaseFollowPrivate::recalc()
+bool QDeclarativeEaseFollowPrivate::recalc()
{
qreal s = source - initialValue;
vi = initialVelocity;
@@ -179,7 +179,7 @@ bool QmlEaseFollowPrivate::recalc()
return true;
}
-void QmlEaseFollowPrivate::clockStart()
+void QDeclarativeEaseFollowPrivate::clockStart()
{
if (clock.state() == QAbstractAnimation::Running) {
clockOffset = lastTick;
@@ -191,14 +191,14 @@ void QmlEaseFollowPrivate::clockStart()
}
}
-void QmlEaseFollowPrivate::clockStop()
+void QDeclarativeEaseFollowPrivate::clockStop()
{
clockOffset = 0;
lastTick = 0;
clock.stop();
}
-void QmlEaseFollowPrivate::tick(int t)
+void QDeclarativeEaseFollowPrivate::tick(int t)
{
lastTick = t;
t -= clockOffset;
@@ -250,7 +250,7 @@ void QmlEaseFollowPrivate::tick(int t)
}
/*!
- \qmlclass EaseFollow QmlEaseFollow
+ \qmlclass EaseFollow QDeclarativeEaseFollow
\brief The EaseFollow element allows a property to smoothly track a value.
The EaseFollow smoothly animates a property's value to a set target value
@@ -310,12 +310,12 @@ Rectangle {
\sa SpringFollow
*/
-QmlEaseFollow::QmlEaseFollow(QObject *parent)
-: QObject(*(new QmlEaseFollowPrivate), parent)
+QDeclarativeEaseFollow::QDeclarativeEaseFollow(QObject *parent)
+: QObject(*(new QDeclarativeEaseFollowPrivate), parent)
{
}
-QmlEaseFollow::~QmlEaseFollow()
+QDeclarativeEaseFollow::~QDeclarativeEaseFollow()
{
}
@@ -325,9 +325,9 @@ QmlEaseFollow::~QmlEaseFollow()
Bind to a property in order to track its changes.
*/
-qreal QmlEaseFollow::sourceValue() const
+qreal QDeclarativeEaseFollow::sourceValue() const
{
- Q_D(const QmlEaseFollow);
+ Q_D(const QDeclarativeEaseFollow);
return d->source;
}
@@ -342,15 +342,15 @@ qreal QmlEaseFollow::sourceValue() const
begining with a velocity of 0. If the reversing mode is \c Sync, the
property is immediately set to the target value.
*/
-QmlEaseFollow::ReversingMode QmlEaseFollow::reversingMode() const
+QDeclarativeEaseFollow::ReversingMode QDeclarativeEaseFollow::reversingMode() const
{
- Q_D(const QmlEaseFollow);
+ Q_D(const QDeclarativeEaseFollow);
return d->reversingMode;
}
-void QmlEaseFollow::setReversingMode(ReversingMode m)
+void QDeclarativeEaseFollow::setReversingMode(ReversingMode m)
{
- Q_D(QmlEaseFollow);
+ Q_D(QDeclarativeEaseFollow);
if (d->reversingMode == m)
return;
@@ -358,7 +358,7 @@ void QmlEaseFollow::setReversingMode(ReversingMode m)
emit reversingModeChanged();
}
-void QmlEaseFollowPrivate::restart()
+void QDeclarativeEaseFollowPrivate::restart()
{
if (!enabled || velocity == 0) {
clockStop();
@@ -378,12 +378,12 @@ void QmlEaseFollowPrivate::restart()
if (hasReversed) {
switch (reversingMode) {
default:
- case QmlEaseFollow::Eased:
+ case QDeclarativeEaseFollow::Eased:
break;
- case QmlEaseFollow::Sync:
+ case QDeclarativeEaseFollow::Sync:
target.write(source);
return;
- case QmlEaseFollow::Immediate:
+ case QDeclarativeEaseFollow::Immediate:
initialVelocity = 0;
clockStop();
break;
@@ -403,9 +403,9 @@ void QmlEaseFollowPrivate::restart()
clockStart();
}
-void QmlEaseFollow::setSourceValue(qreal s)
+void QDeclarativeEaseFollow::setSourceValue(qreal s)
{
- Q_D(QmlEaseFollow);
+ Q_D(QDeclarativeEaseFollow);
if (d->clock.state() == QAbstractAnimation::Running && d->source == s)
return;
@@ -424,15 +424,15 @@ void QmlEaseFollow::setSourceValue(qreal s)
Setting this to -1 (the default) disables the duration value.
*/
-qreal QmlEaseFollow::duration() const
+qreal QDeclarativeEaseFollow::duration() const
{
- Q_D(const QmlEaseFollow);
+ Q_D(const QDeclarativeEaseFollow);
return d->duration;
}
-void QmlEaseFollow::setDuration(qreal v)
+void QDeclarativeEaseFollow::setDuration(qreal v)
{
- Q_D(QmlEaseFollow);
+ Q_D(QDeclarativeEaseFollow);
if (d->duration == v)
return;
@@ -445,9 +445,9 @@ void QmlEaseFollow::setDuration(qreal v)
emit durationChanged();
}
-qreal QmlEaseFollow::velocity() const
+qreal QDeclarativeEaseFollow::velocity() const
{
- Q_D(const QmlEaseFollow);
+ Q_D(const QDeclarativeEaseFollow);
return d->velocity;
}
@@ -460,9 +460,9 @@ qreal QmlEaseFollow::velocity() const
Setting this to -1 disables the velocity value.
*/
-void QmlEaseFollow::setVelocity(qreal v)
+void QDeclarativeEaseFollow::setVelocity(qreal v)
{
- Q_D(QmlEaseFollow);
+ Q_D(QDeclarativeEaseFollow);
if (d->velocity == v)
return;
@@ -479,15 +479,15 @@ void QmlEaseFollow::setVelocity(qreal v)
\qmlproperty bool EaseFollow::enabled
This property holds whether the target will track the source.
*/
-bool QmlEaseFollow::enabled() const
+bool QDeclarativeEaseFollow::enabled() const
{
- Q_D(const QmlEaseFollow);
+ Q_D(const QDeclarativeEaseFollow);
return d->enabled;
}
-void QmlEaseFollow::setEnabled(bool enabled)
+void QDeclarativeEaseFollow::setEnabled(bool enabled)
{
- Q_D(QmlEaseFollow);
+ Q_D(QDeclarativeEaseFollow);
if (d->enabled == enabled)
return;
@@ -500,9 +500,9 @@ void QmlEaseFollow::setEnabled(bool enabled)
emit enabledChanged();
}
-void QmlEaseFollow::setTarget(const QmlMetaProperty &t)
+void QDeclarativeEaseFollow::setTarget(const QDeclarativeProperty &t)
{
- Q_D(QmlEaseFollow);
+ Q_D(QDeclarativeEaseFollow);
d->target = t;
}
@@ -516,15 +516,15 @@ duration.
The default value is -1.
*/
-qreal QmlEaseFollow::maximumEasingTime() const
+qreal QDeclarativeEaseFollow::maximumEasingTime() const
{
- Q_D(const QmlEaseFollow);
+ Q_D(const QDeclarativeEaseFollow);
return d->maximumEasingTime;
}
-void QmlEaseFollow::setMaximumEasingTime(qreal v)
+void QDeclarativeEaseFollow::setMaximumEasingTime(qreal v)
{
- Q_D(QmlEaseFollow);
+ Q_D(QDeclarativeEaseFollow);
d->maximumEasingTime = v;
if (d->clock.state() == QAbstractAnimation::Running)
diff --git a/src/declarative/util/qmleasefollow_p.h b/src/declarative/util/qdeclarativeeasefollow_p.h
index dddf54f..83d1eff 100644
--- a/src/declarative/util/qmleasefollow_p.h
+++ b/src/declarative/util/qdeclarativeeasefollow_p.h
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#ifndef QMLEASEFOLLOW_H
-#define QMLEASEFOLLOW_H
+#ifndef QDECLARATIVEEASEFOLLOW_H
+#define QDECLARATIVEEASEFOLLOW_H
-#include <qml.h>
-#include <qmlpropertyvaluesource.h>
+#include <qdeclarative.h>
+#include <qdeclarativepropertyvaluesource.h>
#include <QtCore/qobject.h>
@@ -53,14 +53,14 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlMetaProperty;
-class QmlEaseFollowPrivate;
-class Q_DECLARATIVE_EXPORT QmlEaseFollow : public QObject,
- public QmlPropertyValueSource
+class QDeclarativeProperty;
+class QDeclarativeEaseFollowPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeEaseFollow : public QObject,
+ public QDeclarativePropertyValueSource
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlEaseFollow)
- Q_INTERFACES(QmlPropertyValueSource)
+ Q_DECLARE_PRIVATE(QDeclarativeEaseFollow)
+ Q_INTERFACES(QDeclarativePropertyValueSource)
Q_ENUMS(ReversingMode)
Q_PROPERTY(qreal source READ sourceValue WRITE setSourceValue NOTIFY sourceChanged)
@@ -73,8 +73,8 @@ class Q_DECLARATIVE_EXPORT QmlEaseFollow : public QObject,
public:
enum ReversingMode { Eased, Immediate, Sync };
- QmlEaseFollow(QObject *parent = 0);
- ~QmlEaseFollow();
+ QDeclarativeEaseFollow(QObject *parent = 0);
+ ~QDeclarativeEaseFollow();
ReversingMode reversingMode() const;
void setReversingMode(ReversingMode);
@@ -94,7 +94,7 @@ public:
qreal maximumEasingTime() const;
void setMaximumEasingTime(qreal);
- virtual void setTarget(const QmlMetaProperty &);
+ virtual void setTarget(const QDeclarativeProperty &);
Q_SIGNALS:
void sourceChanged();
@@ -107,8 +107,8 @@ Q_SIGNALS:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlEaseFollow);
+QML_DECLARE_TYPE(QDeclarativeEaseFollow);
QT_END_HEADER
-#endif // QMLEASEFOLLOW_H
+#endif // QDECLARATIVEEASEFOLLOW_H
diff --git a/src/declarative/util/qmlfontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp
index 4599b99..ac30384 100644
--- a/src/declarative/util/qmlfontloader.cpp
+++ b/src/declarative/util/qdeclarativefontloader.cpp
@@ -39,11 +39,12 @@
**
****************************************************************************/
-#include "qmlfontloader_p.h"
+#include "qdeclarativefontloader_p.h"
-#include <qmlcontext.h>
-#include <qmlengine.h>
+#include <qdeclarativecontext.h>
+#include <qdeclarativeengine.h>
+#include <QStringList>
#include <QUrl>
#include <QDebug>
#include <QNetworkRequest>
@@ -55,25 +56,25 @@
QT_BEGIN_NAMESPACE
-class QmlFontLoaderPrivate : public QObjectPrivate
+class QDeclarativeFontLoaderPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlFontLoader)
+ Q_DECLARE_PUBLIC(QDeclarativeFontLoader)
public:
- QmlFontLoaderPrivate() : reply(0), status(QmlFontLoader::Null) {}
+ QDeclarativeFontLoaderPrivate() : reply(0), status(QDeclarativeFontLoader::Null) {}
void addFontToDatabase(const QByteArray &);
QUrl url;
QString name;
QNetworkReply *reply;
- QmlFontLoader::Status status;
+ QDeclarativeFontLoader::Status status;
};
-QML_DEFINE_TYPE(Qt,4,6,FontLoader,QmlFontLoader)
+
/*!
- \qmlclass FontLoader QmlFontLoader
+ \qmlclass FontLoader QDeclarativeFontLoader
\ingroup group_utility
\brief This item allows using fonts by name or url.
@@ -86,12 +87,12 @@ QML_DEFINE_TYPE(Qt,4,6,FontLoader,QmlFontLoader)
Text { text: "Fancy font"; font.family: webFont.name }
\endqml
*/
-QmlFontLoader::QmlFontLoader(QObject *parent)
- : QObject(*(new QmlFontLoaderPrivate), parent)
+QDeclarativeFontLoader::QDeclarativeFontLoader(QObject *parent)
+ : QObject(*(new QDeclarativeFontLoaderPrivate), parent)
{
}
-QmlFontLoader::~QmlFontLoader()
+QDeclarativeFontLoader::~QDeclarativeFontLoader()
{
}
@@ -108,15 +109,15 @@ static QString toLocalFileOrQrc(const QUrl& url)
\qmlproperty url FontLoader::source
The url of the font to load.
*/
-QUrl QmlFontLoader::source() const
+QUrl QDeclarativeFontLoader::source() const
{
- Q_D(const QmlFontLoader);
+ Q_D(const QDeclarativeFontLoader);
return d->url;
}
-void QmlFontLoader::setSource(const QUrl &url)
+void QDeclarativeFontLoader::setSource(const QUrl &url)
{
- Q_D(QmlFontLoader);
+ Q_D(QDeclarativeFontLoader);
if (url == d->url)
return;
d->url = qmlContext(this)->resolvedUrl(url);
@@ -130,9 +131,9 @@ void QmlFontLoader::setSource(const QUrl &url)
if (id != -1) {
d->name = QFontDatabase::applicationFontFamilies(id).at(0);
emit nameChanged();
- d->status = QmlFontLoader::Ready;
+ d->status = QDeclarativeFontLoader::Ready;
} else {
- d->status = QmlFontLoader::Error;
+ d->status = QDeclarativeFontLoader::Error;
qWarning() << "Cannot load font:" << url;
}
emit statusChanged();
@@ -160,15 +161,15 @@ void QmlFontLoader::setSource(const QUrl &url)
Text { text: "Fancy font"; font.family: webFont.name }
\endqml
*/
-QString QmlFontLoader::name() const
+QString QDeclarativeFontLoader::name() const
{
- Q_D(const QmlFontLoader);
+ Q_D(const QDeclarativeFontLoader);
return d->name;
}
-void QmlFontLoader::setName(const QString &name)
+void QDeclarativeFontLoader::setName(const QString &name)
{
- Q_D(QmlFontLoader);
+ Q_D(QDeclarativeFontLoader);
if (d->name == name )
return;
d->name = name;
@@ -188,15 +189,15 @@ void QmlFontLoader::setName(const QString &name)
\o Error - an error occurred while loading the font
\endlist
*/
-QmlFontLoader::Status QmlFontLoader::status() const
+QDeclarativeFontLoader::Status QDeclarativeFontLoader::status() const
{
- Q_D(const QmlFontLoader);
+ Q_D(const QDeclarativeFontLoader);
return d->status;
}
-void QmlFontLoader::replyFinished()
+void QDeclarativeFontLoader::replyFinished()
{
- Q_D(QmlFontLoader);
+ Q_D(QDeclarativeFontLoader);
if (d->reply) {
if (!d->reply->error()) {
QByteArray ba = d->reply->readAll();
@@ -210,17 +211,17 @@ void QmlFontLoader::replyFinished()
}
}
-void QmlFontLoaderPrivate::addFontToDatabase(const QByteArray &ba)
+void QDeclarativeFontLoaderPrivate::addFontToDatabase(const QByteArray &ba)
{
- Q_Q(QmlFontLoader);
+ Q_Q(QDeclarativeFontLoader);
int id = QFontDatabase::addApplicationFontFromData(ba);
if (id != -1) {
name = QFontDatabase::applicationFontFamilies(id).at(0);
emit q->nameChanged();
- status = QmlFontLoader::Ready;
+ status = QDeclarativeFontLoader::Ready;
} else {
- status = QmlFontLoader::Error;
+ status = QDeclarativeFontLoader::Error;
qWarning() << "Cannot load font:" << url;
}
emit q->statusChanged();
diff --git a/src/declarative/util/qmlfontloader_p.h b/src/declarative/util/qdeclarativefontloader_p.h
index 3d27452..14335ab 100644
--- a/src/declarative/util/qmlfontloader_p.h
+++ b/src/declarative/util/qdeclarativefontloader_p.h
@@ -39,12 +39,13 @@
**
****************************************************************************/
-#ifndef QMLFONTLOADER_H
-#define QMLFONTLOADER_H
+#ifndef QDECLARATIVEFONTLOADER_H
+#define QDECLARATIVEFONTLOADER_H
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtCore/qobject.h>
+#include <QtCore/qurl.h>
QT_BEGIN_HEADER
@@ -52,11 +53,11 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlFontLoaderPrivate;
-class Q_DECLARATIVE_EXPORT QmlFontLoader : public QObject
+class QDeclarativeFontLoaderPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeFontLoader : public QObject
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlFontLoader)
+ Q_DECLARE_PRIVATE(QDeclarativeFontLoader)
Q_ENUMS(Status)
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
@@ -66,8 +67,8 @@ class Q_DECLARATIVE_EXPORT QmlFontLoader : public QObject
public:
enum Status { Null = 0, Ready, Loading, Error };
- QmlFontLoader(QObject *parent = 0);
- ~QmlFontLoader();
+ QDeclarativeFontLoader(QObject *parent = 0);
+ ~QDeclarativeFontLoader();
QUrl source() const;
void setSource(const QUrl &url);
@@ -87,9 +88,9 @@ Q_SIGNALS:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlFontLoader)
+QML_DECLARE_TYPE(QDeclarativeFontLoader)
QT_END_HEADER
-#endif // QMLFONTLOADER_H
+#endif // QDECLARATIVEFONTLOADER_H
diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qdeclarativelistaccessor.cpp
index abdb626..4e56909 100644
--- a/src/declarative/util/qmllistaccessor.cpp
+++ b/src/declarative/util/qdeclarativelistaccessor.cpp
@@ -39,37 +39,37 @@
**
****************************************************************************/
-#include "qmllistaccessor_p.h"
+#include "qdeclarativelistaccessor_p.h"
-#include <qmlmetatype.h>
+#include <qdeclarativemetatype_p.h>
-#include <QStringList>
+#include <QtCore/qstringlist.h>
#include <QtCore/qdebug.h>
// ### Remove me
-#include <qmlengine_p.h>
+#include <qdeclarativeengine_p.h>
QT_BEGIN_NAMESPACE
-QmlListAccessor::QmlListAccessor()
+QDeclarativeListAccessor::QDeclarativeListAccessor()
: m_type(Invalid)
{
}
-QmlListAccessor::~QmlListAccessor()
+QDeclarativeListAccessor::~QDeclarativeListAccessor()
{
}
-QVariant QmlListAccessor::list() const
+QVariant QDeclarativeListAccessor::list() const
{
return d;
}
-void QmlListAccessor::setList(const QVariant &v, QmlEngine *engine)
+void QDeclarativeListAccessor::setList(const QVariant &v, QDeclarativeEngine *engine)
{
d = v;
- QmlEnginePrivate *enginePrivate = engine?QmlEnginePrivate::get(engine):0;
+ QDeclarativeEnginePrivate *enginePrivate = engine?QDeclarativeEnginePrivate::get(engine):0;
if (!d.isValid()) {
m_type = Invalid;
@@ -79,19 +79,19 @@ void QmlListAccessor::setList(const QVariant &v, QmlEngine *engine)
m_type = VariantList;
} else if (d.canConvert(QVariant::Int)) {
m_type = Integer;
- } else if ((!enginePrivate && QmlMetaType::isQObject(d.userType())) ||
+ } else if ((!enginePrivate && QDeclarativeMetaType::isQObject(d.userType())) ||
(enginePrivate && enginePrivate->isQObject(d.userType()))) {
- QObject *data = enginePrivate?enginePrivate->toQObject(v):QmlMetaType::toQObject(v);
+ QObject *data = enginePrivate?enginePrivate->toQObject(v):QDeclarativeMetaType::toQObject(v);
d = QVariant::fromValue(data);
m_type = Instance;
- } else if (d.userType() == qMetaTypeId<QmlListReference>()) {
+ } else if (d.userType() == qMetaTypeId<QDeclarativeListReference>()) {
m_type = ListProperty;
} else {
m_type = Instance;
}
}
-int QmlListAccessor::count() const
+int QDeclarativeListAccessor::count() const
{
switch(m_type) {
case StringList:
@@ -99,7 +99,7 @@ int QmlListAccessor::count() const
case VariantList:
return qvariant_cast<QVariantList>(d).count();
case ListProperty:
- return ((QmlListReference *)d.constData())->count();
+ return ((QDeclarativeListReference *)d.constData())->count();
case Instance:
return 1;
case Integer:
@@ -110,7 +110,7 @@ int QmlListAccessor::count() const
}
}
-QVariant QmlListAccessor::at(int idx) const
+QVariant QDeclarativeListAccessor::at(int idx) const
{
Q_ASSERT(idx >= 0 && idx < count());
switch(m_type) {
@@ -119,7 +119,7 @@ QVariant QmlListAccessor::at(int idx) const
case VariantList:
return qvariant_cast<QVariantList>(d).at(idx);
case ListProperty:
- return QVariant::fromValue(((QmlListReference *)d.constData())->at(idx));
+ return QVariant::fromValue(((QDeclarativeListReference *)d.constData())->at(idx));
case Instance:
return d;
case Integer:
@@ -130,7 +130,7 @@ QVariant QmlListAccessor::at(int idx) const
}
}
-bool QmlListAccessor::isValid() const
+bool QDeclarativeListAccessor::isValid() const
{
return m_type != Invalid;
}
diff --git a/src/declarative/util/qmllistaccessor_p.h b/src/declarative/util/qdeclarativelistaccessor_p.h
index 611eebb..d8bb8af 100644
--- a/src/declarative/util/qmllistaccessor_p.h
+++ b/src/declarative/util/qdeclarativelistaccessor_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLLISTACCESSOR_H
-#define QMLLISTACCESSOR_H
+#ifndef QDECLARATIVELISTACCESSOR_H
+#define QDECLARATIVELISTACCESSOR_H
#include <QtCore/QVariant>
@@ -50,15 +50,15 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlEngine;
-class Q_DECLARATIVE_EXPORT QmlListAccessor
+class QDeclarativeEngine;
+class Q_DECLARATIVE_EXPORT QDeclarativeListAccessor
{
public:
- QmlListAccessor();
- ~QmlListAccessor();
+ QDeclarativeListAccessor();
+ ~QDeclarativeListAccessor();
QVariant list() const;
- void setList(const QVariant &, QmlEngine * = 0);
+ void setList(const QVariant &, QDeclarativeEngine * = 0);
bool isValid() const;
@@ -77,4 +77,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLLISTACCESSOR_H
+#endif // QDECLARATIVELISTACCESSOR_H
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 8fda3ae..e78e0e1 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -39,15 +39,15 @@
**
****************************************************************************/
-#include "qmllistmodel_p.h"
+#include "qdeclarativelistmodel_p.h"
-#include "qmlopenmetaobject_p.h"
+#include "qdeclarativeopenmetaobject_p.h"
-#include <qmlcustomparser_p.h>
-#include <qmlparser_p.h>
-#include <qmlengine_p.h>
-#include <qmlcontext.h>
-#include <qmlinfo.h>
+#include <qdeclarativecustomparser_p.h>
+#include <qdeclarativeparser_p.h>
+#include <qdeclarativeengine_p.h>
+#include <qdeclarativecontext.h>
+#include <qdeclarativeinfo.h>
#include <QtCore/qdebug.h>
#include <QtCore/qstack.h>
@@ -61,23 +61,15 @@ QT_BEGIN_NAMESPACE
#define DATA_ROLE_ID 1
#define DATA_ROLE_NAME "data"
-struct ListInstruction
+QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListModelData::instructions() const
{
- enum { Push, Pop, Value, Set } type;
- int dataIdx;
-};
-
-struct ListModelData
-{
- int dataOffset;
- int instrCount;
- ListInstruction *instructions() const { return (ListInstruction *)((char *)this + sizeof(ListModelData)); }
-};
+ return (QDeclarativeListModelParser::ListInstruction *)((char *)this + sizeof(ListModelData));
+}
static void dump(ModelNode *node, int ind);
/*!
- \qmlclass ListModel QmlListModel
+ \qmlclass ListModel QDeclarativeListModel
\brief The ListModel element defines a free-form list data source.
The ListModel is a simple hierarchy of elements containing data roles. The contents can
@@ -215,7 +207,7 @@ public:
}
private:
- QmlOpenMetaObject *_mo;
+ QDeclarativeOpenMetaObject *_mo;
};
struct ModelNode
@@ -226,17 +218,17 @@ struct ModelNode
QList<QVariant> values;
QHash<QString, ModelNode *> properties;
- QmlListModel *model(const QmlListModel *parent) {
+ QDeclarativeListModel *model(const QDeclarativeListModel *parent) {
if (!modelCache) {
- modelCache = new QmlListModel;
- QmlEngine::setContextForObject(modelCache,QmlEngine::contextForObject(parent));
+ modelCache = new QDeclarativeListModel;
+ QDeclarativeEngine::setContextForObject(modelCache,QDeclarativeEngine::contextForObject(parent));
modelCache->_root = this;
}
return modelCache;
}
- ModelObject *object(const QmlListModel *parent) {
+ ModelObject *object(const QDeclarativeListModel *parent) {
if (!objectCache) {
objectCache = new ModelObject();
QHash<QString, ModelNode *>::iterator it;
@@ -263,7 +255,7 @@ struct ModelNode
objectCache->setValue(prop.toUtf8(), val);
}
- QmlListModel *modelCache;
+ QDeclarativeListModel *modelCache;
ModelObject *objectCache;
bool isArray;
};
@@ -312,21 +304,21 @@ void ModelNode::setListValue(const QScriptValue& valuelist) {
ModelObject::ModelObject()
-: _mo(new QmlOpenMetaObject(this))
+: _mo(new QDeclarativeOpenMetaObject(this))
{
}
-QmlListModel::QmlListModel(QObject *parent)
+QDeclarativeListModel::QDeclarativeListModel(QObject *parent)
: QListModelInterface(parent), _rolesOk(false), _root(0)
{
}
-QmlListModel::~QmlListModel()
+QDeclarativeListModel::~QDeclarativeListModel()
{
delete _root;
}
-void QmlListModel::checkRoles() const
+void QDeclarativeListModel::checkRoles() const
{
if (_rolesOk || !_root)
return;
@@ -342,13 +334,13 @@ void QmlListModel::checkRoles() const
_rolesOk = true;
}
-void QmlListModel::addRole(const QString &role) const
+void QDeclarativeListModel::addRole(const QString &role) const
{
if (!roleStrings.contains(role))
roleStrings << role;
}
-QList<int> QmlListModel::roles() const
+QList<int> QDeclarativeListModel::roles() const
{
checkRoles();
QList<int> rv;
@@ -357,7 +349,7 @@ QList<int> QmlListModel::roles() const
return rv;
}
-QString QmlListModel::toString(int role) const
+QString QDeclarativeListModel::toString(int role) const
{
checkRoles();
if (role < roleStrings.count())
@@ -366,7 +358,7 @@ QString QmlListModel::toString(int role) const
return QString();
}
-QVariant QmlListModel::valueForNode(ModelNode *node) const
+QVariant QDeclarativeListModel::valueForNode(ModelNode *node) const
{
QObject *rv = 0;
@@ -401,7 +393,7 @@ QVariant QmlListModel::valueForNode(ModelNode *node) const
return QVariant();
}
-QHash<int,QVariant> QmlListModel::data(int index, const QList<int> &roles) const
+QHash<int,QVariant> QDeclarativeListModel::data(int index, const QList<int> &roles) const
{
checkRoles();
QHash<int, QVariant> rv;
@@ -426,7 +418,7 @@ QHash<int,QVariant> QmlListModel::data(int index, const QList<int> &roles) const
return rv;
}
-QVariant QmlListModel::data(int index, int role) const
+QVariant QDeclarativeListModel::data(int index, int role) const
{
checkRoles();
QVariant rv;
@@ -453,7 +445,7 @@ QVariant QmlListModel::data(int index, int role) const
\qmlproperty int ListModel::count
The number of data entries in the model.
*/
-int QmlListModel::count() const
+int QDeclarativeListModel::count() const
{
if (!_root) return 0;
return _root->values.count();
@@ -467,7 +459,7 @@ int QmlListModel::count() const
\sa append() remove()
*/
-void QmlListModel::clear()
+void QDeclarativeListModel::clear()
{
int cleared = count();
_rolesOk = false;
@@ -485,7 +477,7 @@ void QmlListModel::clear()
\sa clear()
*/
-void QmlListModel::remove(int index)
+void QDeclarativeListModel::remove(int index)
{
if (!_root || index < 0 || index >= _root->values.count()) {
qmlInfo(this) << tr("remove: index %1 out of range").arg(index);
@@ -515,7 +507,7 @@ void QmlListModel::remove(int index)
\sa set() append()
*/
-void QmlListModel::insert(int index, const QScriptValue& valuemap)
+void QDeclarativeListModel::insert(int index, const QScriptValue& valuemap)
{
if (!valuemap.isObject() || valuemap.isArray()) {
qmlInfo(this) << tr("insert: value is not an object");
@@ -551,7 +543,7 @@ void QmlListModel::insert(int index, const QScriptValue& valuemap)
\sa append()
*/
-void QmlListModel::move(int from, int to, int n)
+void QDeclarativeListModel::move(int from, int to, int n)
{
if (n==0 || from==to)
return;
@@ -602,7 +594,7 @@ void QmlListModel::move(int from, int to, int n)
\sa set() remove()
*/
-void QmlListModel::append(const QScriptValue& valuemap)
+void QDeclarativeListModel::append(const QScriptValue& valuemap)
{
if (!valuemap.isObject() || valuemap.isArray()) {
qmlInfo(this) << tr("append: value is not an object");
@@ -641,7 +633,7 @@ void QmlListModel::append(const QScriptValue& valuemap)
\sa append()
*/
-QScriptValue QmlListModel::get(int index) const
+QScriptValue QDeclarativeListModel::get(int index) const
{
if (index >= count() || index < 0) {
qmlInfo(this) << tr("get: index %1 out of range").arg(index);
@@ -651,12 +643,12 @@ QScriptValue QmlListModel::get(int index) const
ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(index));
if (!node)
return 0;
- QmlEngine *eng = qmlEngine(this);
+ QDeclarativeEngine *eng = qmlEngine(this);
if (!eng) {
- qWarning("Cannot call QmlListModel::get() without a QmlEngine");
+ qWarning("Cannot call QDeclarativeListModel::get() without a QDeclarativeEngine");
return 0;
}
- return QmlEnginePrivate::qmlScriptObject(node->object(this), eng);
+ return QDeclarativeEnginePrivate::qmlScriptObject(node->object(this), eng);
}
/*!
@@ -674,7 +666,7 @@ QScriptValue QmlListModel::get(int index) const
\sa append()
*/
-void QmlListModel::set(int index, const QScriptValue& valuemap)
+void QDeclarativeListModel::set(int index, const QScriptValue& valuemap)
{
if (!valuemap.isObject() || valuemap.isArray()) {
qmlInfo(this) << tr("set: value is not an object");
@@ -717,7 +709,7 @@ void QmlListModel::set(int index, const QScriptValue& valuemap)
\sa append()
*/
-void QmlListModel::setProperty(int index, const QString& property, const QVariant& value)
+void QDeclarativeListModel::setProperty(int index, const QString& property, const QVariant& value)
{
if ( !_root || index >= _root->values.count() || index < 0) {
qmlInfo(this) << tr("set: index %1 out of range").arg(index);
@@ -737,26 +729,15 @@ void QmlListModel::setProperty(int index, const QString& property, const QVarian
emit itemsChanged(index,1,roles);
}
-class QmlListModelParser : public QmlCustomParser
-{
-public:
- QByteArray compile(const QList<QmlCustomParserProperty> &);
- bool compileProperty(const QmlCustomParserProperty &prop, QList<ListInstruction> &instr, QByteArray &data);
- void setCustomData(QObject *, const QByteArray &);
-
-private:
- bool definesEmptyList(const QString &);
-};
-
-bool QmlListModelParser::compileProperty(const QmlCustomParserProperty &prop, QList<ListInstruction> &instr, QByteArray &data)
+bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParserProperty &prop, QList<ListInstruction> &instr, QByteArray &data)
{
QList<QVariant> values = prop.assignedValues();
for(int ii = 0; ii < values.count(); ++ii) {
const QVariant &value = values.at(ii);
- if(value.userType() == qMetaTypeId<QmlCustomParserNode>()) {
- QmlCustomParserNode node =
- qvariant_cast<QmlCustomParserNode>(value);
+ if(value.userType() == qMetaTypeId<QDeclarativeCustomParserNode>()) {
+ QDeclarativeCustomParserNode node =
+ qvariant_cast<QDeclarativeCustomParserNode>(value);
{
ListInstruction li;
@@ -765,15 +746,15 @@ bool QmlListModelParser::compileProperty(const QmlCustomParserProperty &prop, QL
instr << li;
}
- QList<QmlCustomParserProperty> props = node.properties();
+ QList<QDeclarativeCustomParserProperty> props = node.properties();
for(int jj = 0; jj < props.count(); ++jj) {
- const QmlCustomParserProperty &nodeProp = props.at(jj);
+ const QDeclarativeCustomParserProperty &nodeProp = props.at(jj);
if (nodeProp.name() == "") {
- error(nodeProp, QmlListModel::tr("ListElement: cannot use default property"));
+ error(nodeProp, QDeclarativeListModel::tr("ListElement: cannot use default property"));
return false;
}
if (nodeProp.name() == "id") {
- error(nodeProp, QmlListModel::tr("ListElement: cannot use reserved \"id\" property"));
+ error(nodeProp, QDeclarativeListModel::tr("ListElement: cannot use reserved \"id\" property"));
return false;
}
@@ -802,8 +783,8 @@ bool QmlListModelParser::compileProperty(const QmlCustomParserProperty &prop, QL
} else {
- QmlParser::Variant variant =
- qvariant_cast<QmlParser::Variant>(value);
+ QDeclarativeParser::Variant variant =
+ qvariant_cast<QDeclarativeParser::Variant>(value);
int ref = data.count();
@@ -817,9 +798,9 @@ bool QmlListModelParser::compileProperty(const QmlCustomParserProperty &prop, QL
d += char(variant.asBoolean());
} else if (variant.isScript()) {
if (definesEmptyList(variant.asScript())) {
- d[0] = 0; // QmlParser::Variant::Invalid - marks empty list
+ d[0] = 0; // QDeclarativeParser::Variant::Invalid - marks empty list
} else {
- error(prop, QmlListModel::tr("ListElement: cannot use script for property value"));
+ error(prop, QDeclarativeListModel::tr("ListElement: cannot use script for property value"));
return false;
}
}
@@ -836,15 +817,15 @@ bool QmlListModelParser::compileProperty(const QmlCustomParserProperty &prop, QL
return true;
}
-QByteArray QmlListModelParser::compile(const QList<QmlCustomParserProperty> &customProps)
+QByteArray QDeclarativeListModelParser::compile(const QList<QDeclarativeCustomParserProperty> &customProps)
{
QList<ListInstruction> instr;
QByteArray data;
for(int ii = 0; ii < customProps.count(); ++ii) {
- const QmlCustomParserProperty &prop = customProps.at(ii);
+ const QDeclarativeCustomParserProperty &prop = customProps.at(ii);
if(prop.name() != "") { // isn't default property
- error(prop, QmlListModel::tr("ListModel: undefined property '%1'").arg(QString::fromUtf8(prop.name())));
+ error(prop, QDeclarativeListModel::tr("ListModel: undefined property '%1'").arg(QString::fromUtf8(prop.name())));
return QByteArray();
}
@@ -871,9 +852,9 @@ QByteArray QmlListModelParser::compile(const QList<QmlCustomParserProperty> &cus
return rv;
}
-void QmlListModelParser::setCustomData(QObject *obj, const QByteArray &d)
+void QDeclarativeListModelParser::setCustomData(QObject *obj, const QByteArray &d)
{
- QmlListModel *rv = static_cast<QmlListModel *>(obj);
+ QDeclarativeListModel *rv = static_cast<QDeclarativeListModel *>(obj);
ModelNode *root = new ModelNode;
rv->_root = root;
@@ -907,17 +888,17 @@ void QmlListModelParser::setCustomData(QObject *obj, const QByteArray &d)
case ListInstruction::Value:
{
ModelNode *n = nodes.top();
- switch (QmlParser::Variant::Type(data[instr.dataIdx])) {
- case QmlParser::Variant::Invalid:
+ switch (QDeclarativeParser::Variant::Type(data[instr.dataIdx])) {
+ case QDeclarativeParser::Variant::Invalid:
n->isArray = true;
break;
- case QmlParser::Variant::Boolean:
+ case QDeclarativeParser::Variant::Boolean:
n->values.append(bool(data[1 + instr.dataIdx]));
break;
- case QmlParser::Variant::Number:
+ case QDeclarativeParser::Variant::Number:
n->values.append(QByteArray(data + 1 + instr.dataIdx).toDouble());
break;
- case QmlParser::Variant::String:
+ case QDeclarativeParser::Variant::String:
n->values.append(QString::fromUtf8(data + 1 + instr.dataIdx));
break;
default:
@@ -941,7 +922,7 @@ void QmlListModelParser::setCustomData(QObject *obj, const QByteArray &d)
}
}
-bool QmlListModelParser::definesEmptyList(const QString &s)
+bool QDeclarativeListModelParser::definesEmptyList(const QString &s)
{
if (s.startsWith(QLatin1Char('[')) && s.endsWith(QLatin1Char(']'))) {
for (int i=1; i<s.length()-1; i++) {
@@ -953,20 +934,12 @@ bool QmlListModelParser::definesEmptyList(const QString &s)
return false;
}
-QML_DEFINE_CUSTOM_TYPE(Qt, 4,6, ListModel, QmlListModel, QmlListModelParser)
-
/*!
\qmlclass ListElement
\brief The ListElement element defines a data item in a ListModel.
\sa ListModel
*/
-// ### FIXME
-class QmlListElement : public QObject
-{
-Q_OBJECT
-};
-QML_DEFINE_TYPE(Qt,4,6,ListElement,QmlListElement)
static void dump(ModelNode *node, int ind)
{
@@ -1007,6 +980,4 @@ ModelNode::~ModelNode()
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlListElement)
-
-#include <qmllistmodel.moc>
+#include <qdeclarativelistmodel.moc>
diff --git a/src/declarative/util/qmllistmodel_p.h b/src/declarative/util/qdeclarativelistmodel_p.h
index 4cf6746..251a31f 100644
--- a/src/declarative/util/qmllistmodel_p.h
+++ b/src/declarative/util/qdeclarativelistmodel_p.h
@@ -39,10 +39,11 @@
**
****************************************************************************/
-#ifndef QMLLISTMODEL_H
-#define QMLLISTMODEL_H
+#ifndef QDECLARATIVELISTMODEL_H
+#define QDECLARATIVELISTMODEL_H
-#include <qml.h>
+#include <qdeclarative.h>
+#include <private/qdeclarativecustomparser_p.h>
#include <QtCore/QObject>
#include <QtCore/QStringList>
@@ -59,14 +60,14 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
struct ModelNode;
-class Q_DECLARATIVE_EXPORT QmlListModel : public QListModelInterface
+class Q_DECLARATIVE_EXPORT QDeclarativeListModel : public QListModelInterface
{
Q_OBJECT
Q_PROPERTY(int count READ count NOTIFY countChanged)
public:
- QmlListModel(QObject *parent=0);
- ~QmlListModel();
+ QDeclarativeListModel(QObject *parent=0);
+ ~QDeclarativeListModel();
virtual QList<int> roles() const;
virtual QString toString(int role) const;
@@ -89,7 +90,7 @@ Q_SIGNALS:
private:
QVariant valueForNode(ModelNode *) const;
mutable QStringList roleStrings;
- friend class QmlListModelParser;
+ friend class QDeclarativeListModelParser;
friend struct ModelNode;
void checkRoles() const;
@@ -98,10 +99,41 @@ private:
ModelNode *_root;
};
+// ### FIXME
+class QDeclarativeListElement : public QObject
+{
+Q_OBJECT
+};
+
+class QDeclarativeListModelParser : public QDeclarativeCustomParser
+{
+public:
+ QByteArray compile(const QList<QDeclarativeCustomParserProperty> &);
+ void setCustomData(QObject *, const QByteArray &);
+
+private:
+ struct ListInstruction
+ {
+ enum { Push, Pop, Value, Set } type;
+ int dataIdx;
+ };
+ struct ListModelData
+ {
+ int dataOffset;
+ int instrCount;
+ ListInstruction *instructions() const;
+ };
+ bool compileProperty(const QDeclarativeCustomParserProperty &prop, QList<ListInstruction> &instr, QByteArray &data);
+
+ bool definesEmptyList(const QString &);
+};
+
+
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlListModel)
+QML_DECLARE_TYPE(QDeclarativeListModel)
+QML_DECLARE_TYPE(QDeclarativeListElement)
QT_END_HEADER
-#endif // QMLLISTMODEL_H
+#endif // QDECLARATIVELISTMODEL_H
diff --git a/src/declarative/util/qmlnullablevalue_p_p.h b/src/declarative/util/qdeclarativenullablevalue_p_p.h
index c426258..fc3f8af 100644
--- a/src/declarative/util/qmlnullablevalue_p_p.h
+++ b/src/declarative/util/qdeclarativenullablevalue_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLNULLABLEVALUE_P_H
-#define QMLNULLABLEVALUE_P_H
+#ifndef QDECLARATIVENULLABLEVALUE_P_H
+#define QDECLARATIVENULLABLEVALUE_P_H
//
// W A R N I N G
@@ -56,17 +56,17 @@
QT_BEGIN_NAMESPACE
template<typename T>
-struct QmlNullableValue
+struct QDeclarativeNullableValue
{
- QmlNullableValue()
+ QDeclarativeNullableValue()
: isNull(true), value(T()) {}
- QmlNullableValue(const QmlNullableValue<T> &o)
+ QDeclarativeNullableValue(const QDeclarativeNullableValue<T> &o)
: isNull(o.isNull), value(o.value) {}
- QmlNullableValue(const T &t)
+ QDeclarativeNullableValue(const T &t)
: isNull(false), value(t) {}
- QmlNullableValue<T> &operator=(const T &t)
+ QDeclarativeNullableValue<T> &operator=(const T &t)
{ isNull = false; value = t; return *this; }
- QmlNullableValue<T> &operator=(const QmlNullableValue<T> &o)
+ QDeclarativeNullableValue<T> &operator=(const QDeclarativeNullableValue<T> &o)
{ isNull = o.isNull; value = o.value; return *this; }
operator T() const { return value; }
@@ -78,4 +78,4 @@ struct QmlNullableValue
QT_END_NAMESPACE
-#endif // QMLNULLABLEVALUE_P_H
+#endif // QDECLARATIVENULLABLEVALUE_P_H
diff --git a/src/declarative/util/qmlnumberformatter.cpp b/src/declarative/util/qdeclarativenumberformatter.cpp
index 0845d0c..5d81958 100644
--- a/src/declarative/util/qmlnumberformatter.cpp
+++ b/src/declarative/util/qdeclarativenumberformatter.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmlnumberformatter_p.h"
+#include "qdeclarativenumberformatter_p.h"
#include <private/qobject_p.h>
@@ -50,11 +50,11 @@ QT_BEGIN_NAMESPACE
// this is a wrapper around qnumberformat (test integration)
// if number or format haven't been explictly set, text should be an empty string
-class QmlNumberFormatterPrivate : public QObjectPrivate
+class QDeclarativeNumberFormatterPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlNumberFormatter)
+ Q_DECLARE_PUBLIC(QDeclarativeNumberFormatter)
public:
- QmlNumberFormatterPrivate() : locale(QLocale::system()), number(0), componentComplete(true) {}
+ QDeclarativeNumberFormatterPrivate() : locale(QLocale::system()), number(0), componentComplete(true) {}
void updateText();
@@ -81,17 +81,17 @@ public:
*/
/*!
\internal
- \class QmlNumberFormatter
+ \class QDeclarativeNumberFormatter
\ingroup group_utility
- \brief The QmlNumberFormatter class allows you to format a number to a particular string format/locale specific number format.
+ \brief The QDeclarativeNumberFormatter class allows you to format a number to a particular string format/locale specific number format.
*/
-QmlNumberFormatter::QmlNumberFormatter(QObject *parent)
-: QObject(*(new QmlNumberFormatterPrivate), parent)
+QDeclarativeNumberFormatter::QDeclarativeNumberFormatter(QObject *parent)
+: QObject(*(new QDeclarativeNumberFormatterPrivate), parent)
{
}
-QmlNumberFormatter::~QmlNumberFormatter()
+QDeclarativeNumberFormatter::~QDeclarativeNumberFormatter()
{
}
@@ -103,9 +103,9 @@ QmlNumberFormatter::~QmlNumberFormatter()
If no format is specified the text will be empty.
*/
-QString QmlNumberFormatter::text() const
+QString QDeclarativeNumberFormatter::text() const
{
- Q_D(const QmlNumberFormatter);
+ Q_D(const QDeclarativeNumberFormatter);
return d->text;
}
@@ -115,9 +115,9 @@ QString QmlNumberFormatter::text() const
A single point precision number. (Doubles are not yet supported)
*/
-qreal QmlNumberFormatter::number() const
+qreal QDeclarativeNumberFormatter::number() const
{
- Q_D(const QmlNumberFormatter);
+ Q_D(const QDeclarativeNumberFormatter);
return d->number;
}
@@ -203,24 +203,24 @@ qreal QmlNumberFormatter::number() const
\endtable
*/
-QString QmlNumberFormatter::format() const
+QString QDeclarativeNumberFormatter::format() const
{
- Q_D(const QmlNumberFormatter);
+ Q_D(const QDeclarativeNumberFormatter);
return d->format;
}
-void QmlNumberFormatter::setNumber(const qreal &number)
+void QDeclarativeNumberFormatter::setNumber(const qreal &number)
{
- Q_D(QmlNumberFormatter);
+ Q_D(QDeclarativeNumberFormatter);
if (d->number == number)
return;
d->number = number;
d->updateText();
}
-void QmlNumberFormatter::setFormat(const QString &format)
+void QDeclarativeNumberFormatter::setFormat(const QString &format)
{
- Q_D(QmlNumberFormatter);
+ Q_D(QDeclarativeNumberFormatter);
//no format checking
if (format.isEmpty())
d->format = QString::null;
@@ -229,9 +229,9 @@ void QmlNumberFormatter::setFormat(const QString &format)
d->updateText();
}
-void QmlNumberFormatterPrivate::updateText()
+void QDeclarativeNumberFormatterPrivate::updateText()
{
- Q_Q(QmlNumberFormatter);
+ Q_Q(QDeclarativeNumberFormatter);
if (!componentComplete)
return;
@@ -244,18 +244,18 @@ void QmlNumberFormatterPrivate::updateText()
emit q->textChanged();
}
-void QmlNumberFormatter::classBegin()
+void QDeclarativeNumberFormatter::classBegin()
{
- Q_D(QmlNumberFormatter);
+ Q_D(QDeclarativeNumberFormatter);
d->componentComplete = false;
}
-void QmlNumberFormatter::componentComplete()
+void QDeclarativeNumberFormatter::componentComplete()
{
- Q_D(QmlNumberFormatter);
+ Q_D(QDeclarativeNumberFormatter);
d->componentComplete = true;
d->updateText();
}
-QML_DEFINE_TYPE(Qt,4,6,NumberFormatter,QmlNumberFormatter);
+
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlnumberformatter_p.h b/src/declarative/util/qdeclarativenumberformatter_p.h
index d08885b..3b8c7e1 100644
--- a/src/declarative/util/qmlnumberformatter_p.h
+++ b/src/declarative/util/qdeclarativenumberformatter_p.h
@@ -39,12 +39,12 @@
**
****************************************************************************/
-#ifndef QMLNUMBERFORMATTER_H
-#define QMLNUMBERFORMATTER_H
+#ifndef QDECLARATIVENUMBERFORMATTER_H
+#define QDECLARATIVENUMBERFORMATTER_H
#include "qnumberformat_p.h"
-#include <qml.h>
+#include <qdeclarative.h>
QT_BEGIN_HEADER
@@ -52,18 +52,18 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlNumberFormatterPrivate;
-class Q_DECLARATIVE_EXPORT QmlNumberFormatter : public QObject, public QmlParserStatus
+class QDeclarativeNumberFormatterPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeNumberFormatter : public QObject, public QDeclarativeParserStatus
{
Q_OBJECT
- Q_INTERFACES(QmlParserStatus)
+ Q_INTERFACES(QDeclarativeParserStatus)
Q_PROPERTY(QString text READ text NOTIFY textChanged)
Q_PROPERTY(QString format READ format WRITE setFormat)
Q_PROPERTY(qreal number READ number WRITE setNumber)
public:
- QmlNumberFormatter(QObject *parent=0);
- ~QmlNumberFormatter();
+ QDeclarativeNumberFormatter(QObject *parent=0);
+ ~QDeclarativeNumberFormatter();
QString text() const;
@@ -80,13 +80,13 @@ Q_SIGNALS:
void textChanged();
private:
- Q_DISABLE_COPY(QmlNumberFormatter)
- Q_DECLARE_PRIVATE(QmlNumberFormatter)
+ Q_DISABLE_COPY(QDeclarativeNumberFormatter)
+ Q_DECLARE_PRIVATE(QDeclarativeNumberFormatter)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlNumberFormatter)
+QML_DECLARE_TYPE(QDeclarativeNumberFormatter)
QT_END_HEADER
diff --git a/src/declarative/util/qmlopenmetaobject.cpp b/src/declarative/util/qdeclarativeopenmetaobject.cpp
index 0847c47..8c23354 100644
--- a/src/declarative/util/qmlopenmetaobject.cpp
+++ b/src/declarative/util/qdeclarativeopenmetaobject.cpp
@@ -39,19 +39,19 @@
**
****************************************************************************/
-#include "qmlopenmetaobject_p.h"
-#include "qmlpropertycache_p.h"
-#include "qmldeclarativedata_p.h"
+#include "qdeclarativeopenmetaobject_p.h"
+#include "qdeclarativepropertycache_p.h"
+#include "qdeclarativedeclarativedata_p.h"
#include <qmetaobjectbuilder_p.h>
#include <qdebug.h>
QT_BEGIN_NAMESPACE
-class QmlOpenMetaObjectTypePrivate
+class QDeclarativeOpenMetaObjectTypePrivate
{
public:
- QmlOpenMetaObjectTypePrivate() : mem(0), cache(0), engine(0) {}
+ QDeclarativeOpenMetaObjectTypePrivate() : mem(0), cache(0), engine(0) {}
void init(const QMetaObject *metaObj);
@@ -60,19 +60,19 @@ public:
QHash<QByteArray, int> names;
QMetaObjectBuilder mob;
QMetaObject *mem;
- QmlPropertyCache *cache;
- QmlEngine *engine;
- QSet<QmlOpenMetaObject*> referers;
+ QDeclarativePropertyCache *cache;
+ QDeclarativeEngine *engine;
+ QSet<QDeclarativeOpenMetaObject*> referers;
};
-QmlOpenMetaObjectType::QmlOpenMetaObjectType(const QMetaObject *base, QmlEngine *engine)
- : d(new QmlOpenMetaObjectTypePrivate)
+QDeclarativeOpenMetaObjectType::QDeclarativeOpenMetaObjectType(const QMetaObject *base, QDeclarativeEngine *engine)
+ : d(new QDeclarativeOpenMetaObjectTypePrivate)
{
d->engine = engine;
d->init(base);
}
-QmlOpenMetaObjectType::~QmlOpenMetaObjectType()
+QDeclarativeOpenMetaObjectType::~QDeclarativeOpenMetaObjectType()
{
if (d->mem)
qFree(d->mem);
@@ -82,17 +82,17 @@ QmlOpenMetaObjectType::~QmlOpenMetaObjectType()
}
-int QmlOpenMetaObjectType::propertyOffset() const
+int QDeclarativeOpenMetaObjectType::propertyOffset() const
{
return d->propertyOffset;
}
-int QmlOpenMetaObjectType::signalOffset() const
+int QDeclarativeOpenMetaObjectType::signalOffset() const
{
return d->signalOffset;
}
-int QmlOpenMetaObjectType::createProperty(const QByteArray &name)
+int QDeclarativeOpenMetaObjectType::createProperty(const QByteArray &name)
{
int id = d->mob.propertyCount();
d->mob.addSignal("__" + QByteArray::number(id) + "()");
@@ -102,9 +102,9 @@ int QmlOpenMetaObjectType::createProperty(const QByteArray &name)
qFree(d->mem);
d->mem = d->mob.toMetaObject();
d->names.insert(name, id);
- QSet<QmlOpenMetaObject*>::iterator it = d->referers.begin();
+ QSet<QDeclarativeOpenMetaObject*>::iterator it = d->referers.begin();
while (it != d->referers.end()) {
- QmlOpenMetaObject *omo = *it;
+ QDeclarativeOpenMetaObject *omo = *it;
*static_cast<QMetaObject *>(omo) = *d->mem;
if (d->cache)
d->cache->update(d->engine, omo);
@@ -114,13 +114,13 @@ int QmlOpenMetaObjectType::createProperty(const QByteArray &name)
return d->propertyOffset + id;
}
-void QmlOpenMetaObjectType::propertyCreated(int id, QMetaPropertyBuilder &builder)
+void QDeclarativeOpenMetaObjectType::propertyCreated(int id, QMetaPropertyBuilder &builder)
{
if (d->referers.count())
(*d->referers.begin())->propertyCreated(id, builder);
}
-void QmlOpenMetaObjectTypePrivate::init(const QMetaObject *metaObj)
+void QDeclarativeOpenMetaObjectTypePrivate::init(const QMetaObject *metaObj)
{
if (!mem) {
mob.setSuperClass(metaObj);
@@ -136,10 +136,10 @@ void QmlOpenMetaObjectTypePrivate::init(const QMetaObject *metaObj)
//----------------------------------------------------------------------------
-class QmlOpenMetaObjectPrivate
+class QDeclarativeOpenMetaObjectPrivate
{
public:
- QmlOpenMetaObjectPrivate(QmlOpenMetaObject *_q)
+ QDeclarativeOpenMetaObjectPrivate(QDeclarativeOpenMetaObject *_q)
: q(_q), parent(0), type(0), cacheProperties(false) {}
inline QVariant &getData(int idx) {
@@ -162,21 +162,21 @@ public:
}
bool autoCreate;
- QmlOpenMetaObject *q;
+ QDeclarativeOpenMetaObject *q;
QAbstractDynamicMetaObject *parent;
QList<QPair<QVariant, bool> > data;
QObject *object;
- QmlOpenMetaObjectType *type;
+ QDeclarativeOpenMetaObjectType *type;
bool cacheProperties;
};
-QmlOpenMetaObject::QmlOpenMetaObject(QObject *obj, bool automatic)
-: d(new QmlOpenMetaObjectPrivate(this))
+QDeclarativeOpenMetaObject::QDeclarativeOpenMetaObject(QObject *obj, bool automatic)
+: d(new QDeclarativeOpenMetaObjectPrivate(this))
{
d->autoCreate = automatic;
d->object = obj;
- d->type = new QmlOpenMetaObjectType(obj->metaObject(), 0);
+ d->type = new QDeclarativeOpenMetaObjectType(obj->metaObject(), 0);
d->type->d->referers.insert(this);
QObjectPrivate *op = QObjectPrivate::get(obj);
@@ -184,8 +184,8 @@ QmlOpenMetaObject::QmlOpenMetaObject(QObject *obj, bool automatic)
op->metaObject = this;
}
-QmlOpenMetaObject::QmlOpenMetaObject(QObject *obj, QmlOpenMetaObjectType *type, bool automatic)
-: d(new QmlOpenMetaObjectPrivate(this))
+QDeclarativeOpenMetaObject::QDeclarativeOpenMetaObject(QObject *obj, QDeclarativeOpenMetaObjectType *type, bool automatic)
+: d(new QDeclarativeOpenMetaObjectPrivate(this))
{
d->autoCreate = automatic;
d->object = obj;
@@ -199,7 +199,7 @@ QmlOpenMetaObject::QmlOpenMetaObject(QObject *obj, QmlOpenMetaObjectType *type,
op->metaObject = this;
}
-QmlOpenMetaObject::~QmlOpenMetaObject()
+QDeclarativeOpenMetaObject::~QDeclarativeOpenMetaObject()
{
if (d->parent)
delete d->parent;
@@ -208,12 +208,12 @@ QmlOpenMetaObject::~QmlOpenMetaObject()
delete d;
}
-QmlOpenMetaObjectType *QmlOpenMetaObject::type() const
+QDeclarativeOpenMetaObjectType *QDeclarativeOpenMetaObject::type() const
{
return d->type;
}
-int QmlOpenMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
+int QDeclarativeOpenMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
{
if (( c == QMetaObject::ReadProperty || c == QMetaObject::WriteProperty)
&& id >= d->type->d->propertyOffset) {
@@ -237,23 +237,23 @@ int QmlOpenMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
}
}
-QAbstractDynamicMetaObject *QmlOpenMetaObject::parent() const
+QAbstractDynamicMetaObject *QDeclarativeOpenMetaObject::parent() const
{
return d->parent;
}
-QVariant QmlOpenMetaObject::value(int id) const
+QVariant QDeclarativeOpenMetaObject::value(int id) const
{
return d->getData(id);
}
-void QmlOpenMetaObject::setValue(int id, const QVariant &value)
+void QDeclarativeOpenMetaObject::setValue(int id, const QVariant &value)
{
d->writeData(id, value);
activate(d->object, id + d->type->d->signalOffset, 0);
}
-QVariant QmlOpenMetaObject::value(const QByteArray &name) const
+QVariant QDeclarativeOpenMetaObject::value(const QByteArray &name) const
{
QHash<QByteArray, int>::ConstIterator iter = d->type->d->names.find(name);
if (iter == d->type->d->names.end())
@@ -262,7 +262,7 @@ QVariant QmlOpenMetaObject::value(const QByteArray &name) const
return d->getData(*iter);
}
-QVariant &QmlOpenMetaObject::operator[](const QByteArray &name)
+QVariant &QDeclarativeOpenMetaObject::operator[](const QByteArray &name)
{
QHash<QByteArray, int>::ConstIterator iter = d->type->d->names.find(name);
Q_ASSERT(iter != d->type->d->names.end());
@@ -270,7 +270,7 @@ QVariant &QmlOpenMetaObject::operator[](const QByteArray &name)
return d->getData(*iter);
}
-void QmlOpenMetaObject::setValue(const QByteArray &name, const QVariant &val)
+void QDeclarativeOpenMetaObject::setValue(const QByteArray &name, const QVariant &val)
{
QHash<QByteArray, int>::ConstIterator iter = d->type->d->names.find(name);
@@ -289,17 +289,17 @@ void QmlOpenMetaObject::setValue(const QByteArray &name, const QVariant &val)
activate(d->object, id + d->type->d->signalOffset, 0);
}
-void QmlOpenMetaObject::setCached(bool c)
+void QDeclarativeOpenMetaObject::setCached(bool c)
{
if (c == d->cacheProperties || !d->type->d->engine)
return;
d->cacheProperties = c;
- QmlDeclarativeData *qmldata = QmlDeclarativeData::get(d->object, true);
+ QDeclarativeDeclarativeData *qmldata = QDeclarativeDeclarativeData::get(d->object, true);
if (d->cacheProperties) {
if (!d->type->d->cache)
- d->type->d->cache = QmlPropertyCache::create(d->type->d->engine, this);
+ d->type->d->cache = QDeclarativePropertyCache::create(d->type->d->engine, this);
qmldata->propertyCache = d->type->d->cache;
d->type->d->cache->addref();
} else {
@@ -310,7 +310,7 @@ void QmlOpenMetaObject::setCached(bool c)
}
-int QmlOpenMetaObject::createProperty(const char *name, const char *)
+int QDeclarativeOpenMetaObject::createProperty(const char *name, const char *)
{
if (d->autoCreate)
return d->type->createProperty(name);
@@ -318,36 +318,36 @@ int QmlOpenMetaObject::createProperty(const char *name, const char *)
return -1;
}
-void QmlOpenMetaObject::propertyRead(int)
+void QDeclarativeOpenMetaObject::propertyRead(int)
{
}
-void QmlOpenMetaObject::propertyWrite(int)
+void QDeclarativeOpenMetaObject::propertyWrite(int)
{
}
-void QmlOpenMetaObject::propertyCreated(int, QMetaPropertyBuilder &)
+void QDeclarativeOpenMetaObject::propertyCreated(int, QMetaPropertyBuilder &)
{
}
-QVariant QmlOpenMetaObject::initialValue(int)
+QVariant QDeclarativeOpenMetaObject::initialValue(int)
{
return QVariant();
}
-int QmlOpenMetaObject::count() const
+int QDeclarativeOpenMetaObject::count() const
{
return d->type->d->names.count();
}
-QByteArray QmlOpenMetaObject::name(int idx) const
+QByteArray QDeclarativeOpenMetaObject::name(int idx) const
{
Q_ASSERT(idx >= 0 && idx < d->type->d->names.count());
return d->type->d->mob.property(idx).name();
}
-QObject *QmlOpenMetaObject::object() const
+QObject *QDeclarativeOpenMetaObject::object() const
{
return d->object;
}
diff --git a/src/declarative/util/qmlopenmetaobject_p.h b/src/declarative/util/qdeclarativeopenmetaobject_p.h
index 3f9450d..ec5ac17 100644
--- a/src/declarative/util/qmlopenmetaobject_p.h
+++ b/src/declarative/util/qdeclarativeopenmetaobject_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLOPENMETAOBJECT_H
-#define QMLOPENMETAOBJECT_H
+#ifndef QDECLARATIVEOPENMETAOBJECT_H
+#define QDECLARATIVEOPENMETAOBJECT_H
-#include <private/qmlrefcount_p.h>
+#include <private/qdeclarativerefcount_p.h>
#include <QtCore/QMetaObject>
#include <QtCore/QObject>
@@ -54,14 +54,14 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlEngine;
+class QDeclarativeEngine;
class QMetaPropertyBuilder;
-class QmlOpenMetaObjectTypePrivate;
-class Q_DECLARATIVE_EXPORT QmlOpenMetaObjectType : public QmlRefCount
+class QDeclarativeOpenMetaObjectTypePrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeOpenMetaObjectType : public QDeclarativeRefCount
{
public:
- QmlOpenMetaObjectType(const QMetaObject *base, QmlEngine *engine);
- ~QmlOpenMetaObjectType();
+ QDeclarativeOpenMetaObjectType(const QMetaObject *base, QDeclarativeEngine *engine);
+ ~QDeclarativeOpenMetaObjectType();
int createProperty(const QByteArray &name);
@@ -72,18 +72,18 @@ protected:
virtual void propertyCreated(int, QMetaPropertyBuilder &);
private:
- QmlOpenMetaObjectTypePrivate *d;
- friend class QmlOpenMetaObject;
- friend class QmlOpenMetaObjectPrivate;
+ QDeclarativeOpenMetaObjectTypePrivate *d;
+ friend class QDeclarativeOpenMetaObject;
+ friend class QDeclarativeOpenMetaObjectPrivate;
};
-class QmlOpenMetaObjectPrivate;
-class Q_DECLARATIVE_EXPORT QmlOpenMetaObject : public QAbstractDynamicMetaObject
+class QDeclarativeOpenMetaObjectPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeOpenMetaObject : public QAbstractDynamicMetaObject
{
public:
- QmlOpenMetaObject(QObject *, bool = true);
- QmlOpenMetaObject(QObject *, QmlOpenMetaObjectType *, bool = true);
- ~QmlOpenMetaObject();
+ QDeclarativeOpenMetaObject(QObject *, bool = true);
+ QDeclarativeOpenMetaObject(QObject *, QDeclarativeOpenMetaObjectType *, bool = true);
+ ~QDeclarativeOpenMetaObject();
QVariant value(const QByteArray &) const;
void setValue(const QByteArray &, const QVariant &);
@@ -101,7 +101,7 @@ public:
// longer automatically called for new properties.
void setCached(bool);
- QmlOpenMetaObjectType *type() const;
+ QDeclarativeOpenMetaObjectType *type() const;
protected:
virtual int metaCall(QMetaObject::Call _c, int _id, void **_a);
@@ -114,12 +114,12 @@ protected:
QAbstractDynamicMetaObject *parent() const;
private:
- QmlOpenMetaObjectPrivate *d;
- friend class QmlOpenMetaObjectType;
+ QDeclarativeOpenMetaObjectPrivate *d;
+ friend class QDeclarativeOpenMetaObjectType;
};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLOPENMETAOBJECT_H
+#endif // QDECLARATIVEOPENMETAOBJECT_H
diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qdeclarativepackage.cpp
index 82f776f..34ae466 100644
--- a/src/declarative/util/qmlpackage.cpp
+++ b/src/declarative/util/qdeclarativepackage.cpp
@@ -39,21 +39,48 @@
**
****************************************************************************/
-#include "qmlpackage_p.h"
+#include "qdeclarativepackage_p.h"
#include <private/qobject_p.h>
-#include "private/qmlguard_p.h"
+#include "private/qdeclarativeguard_p.h"
QT_BEGIN_NAMESPACE
-class QmlPackagePrivate : public QObjectPrivate
+/*!
+ \qmlclass Package QDeclarativePackage
+ \brief Package provides a collection of named items
+
+ The Package class is currently used in conjunction with
+ VisualDataModel to enable delegates with a shared context
+ to be provided to multiple views.
+
+ Any item within a Package may be assigned a name via the
+ \e {Package.name} attached property.
+
+ The example below creates a Package containing two named items;
+ \e list and \e grid. The third element in the package is parented to whichever
+ delegate it should appear in. This allows an item to move
+ between views.
+
+ \snippet examples/declarative/package/Delegate.qml 0
+
+ These named items are used as the delegates by the two views who
+ reference the special VisualDataModel.parts property to select
+ a model which provides the chosen delegate.
+
+ \snippet examples/declarative/package/view.qml 0
+
+*/
+
+
+class QDeclarativePackagePrivate : public QObjectPrivate
{
public:
- QmlPackagePrivate() {}
+ QDeclarativePackagePrivate() {}
- struct DataGuard : public QmlGuard<QObject>
+ struct DataGuard : public QDeclarativeGuard<QObject>
{
- DataGuard(QObject *obj, QList<DataGuard> *l) : list(l) { (QmlGuard<QObject>&)*this = obj; }
+ DataGuard(QObject *obj, QList<DataGuard> *l) : list(l) { (QDeclarativeGuard<QObject>&)*this = obj; }
QList<DataGuard> *list;
void objectDestroyed(QObject *) {
// we assume priv will always be destroyed after objectDestroyed calls
@@ -62,107 +89,91 @@ public:
};
QList<DataGuard> dataList;
- static void data_append(QmlListProperty<QObject> *prop, QObject *o) {
+ static void data_append(QDeclarativeListProperty<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) {
+ static void data_clear(QDeclarativeListProperty<QObject> *prop) {
QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data);
list->clear();
}
- static QObject *data_at(QmlListProperty<QObject> *prop, int index) {
+ static QObject *data_at(QDeclarativeListProperty<QObject> *prop, int index) {
QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data);
return list->at(index);
}
- static int data_count(QmlListProperty<QObject> *prop) {
+ static int data_count(QDeclarativeListProperty<QObject> *prop) {
QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data);
return list->count();
}
};
-class QmlPackageAttached : public QObject
-{
-Q_OBJECT
-Q_PROPERTY(QString name READ name WRITE setName)
-public:
- QmlPackageAttached(QObject *parent);
- virtual ~QmlPackageAttached();
-
- QString name() const;
- void setName(const QString &n);
-
- static QHash<QObject *, QmlPackageAttached *> attached;
-private:
- QString _name;
-};
-
-QHash<QObject *, QmlPackageAttached *> QmlPackageAttached::attached;
+QHash<QObject *, QDeclarativePackageAttached *> QDeclarativePackageAttached::attached;
-QmlPackageAttached::QmlPackageAttached(QObject *parent)
+QDeclarativePackageAttached::QDeclarativePackageAttached(QObject *parent)
: QObject(parent)
{
attached.insert(parent, this);
}
-QmlPackageAttached::~QmlPackageAttached()
+QDeclarativePackageAttached::~QDeclarativePackageAttached()
{
attached.remove(parent());
}
-QString QmlPackageAttached::name() const
+QString QDeclarativePackageAttached::name() const
{
return _name;
}
-void QmlPackageAttached::setName(const QString &n)
+void QDeclarativePackageAttached::setName(const QString &n)
{
_name = n;
}
-QmlPackage::QmlPackage(QObject *parent)
- : QObject(*(new QmlPackagePrivate), parent)
+QDeclarativePackage::QDeclarativePackage(QObject *parent)
+ : QObject(*(new QDeclarativePackagePrivate), parent)
{
}
-QmlPackage::~QmlPackage()
+QDeclarativePackage::~QDeclarativePackage()
{
- Q_D(QmlPackage);
+ Q_D(QDeclarativePackage);
for (int ii = 0; ii < d->dataList.count(); ++ii) {
QObject *obj = d->dataList.at(ii);
obj->setParent(this);
}
}
-QmlListProperty<QObject> QmlPackage::data()
+QDeclarativeListProperty<QObject> QDeclarativePackage::data()
{
- Q_D(QmlPackage);
- return QmlListProperty<QObject>(this, &d->dataList, QmlPackagePrivate::data_append,
- QmlPackagePrivate::data_count,
- QmlPackagePrivate::data_at,
- QmlPackagePrivate::data_clear);
+ Q_D(QDeclarativePackage);
+ return QDeclarativeListProperty<QObject>(this, &d->dataList, QDeclarativePackagePrivate::data_append,
+ QDeclarativePackagePrivate::data_count,
+ QDeclarativePackagePrivate::data_at,
+ QDeclarativePackagePrivate::data_clear);
}
-bool QmlPackage::hasPart(const QString &name)
+bool QDeclarativePackage::hasPart(const QString &name)
{
- Q_D(QmlPackage);
+ Q_D(QDeclarativePackage);
for (int ii = 0; ii < d->dataList.count(); ++ii) {
QObject *obj = d->dataList.at(ii);
- QmlPackageAttached *a = QmlPackageAttached::attached.value(obj);
+ QDeclarativePackageAttached *a = QDeclarativePackageAttached::attached.value(obj);
if (a && a->name() == name)
return true;
}
return false;
}
-QObject *QmlPackage::part(const QString &name)
+QObject *QDeclarativePackage::part(const QString &name)
{
- Q_D(QmlPackage);
+ Q_D(QDeclarativePackage);
if (name.isEmpty() && !d->dataList.isEmpty())
return d->dataList.at(0);
for (int ii = 0; ii < d->dataList.count(); ++ii) {
QObject *obj = d->dataList.at(ii);
- QmlPackageAttached *a = QmlPackageAttached::attached.value(obj);
+ QDeclarativePackageAttached *a = QDeclarativePackageAttached::attached.value(obj);
if (a && a->name() == name)
return obj;
}
@@ -173,13 +184,11 @@ QObject *QmlPackage::part(const QString &name)
return 0;
}
-QmlPackageAttached *QmlPackage::qmlAttachedProperties(QObject *o)
+QDeclarativePackageAttached *QDeclarativePackage::qmlAttachedProperties(QObject *o)
{
- return new QmlPackageAttached(o);
+ return new QDeclarativePackageAttached(o);
}
-QML_DEFINE_TYPE(Qt,4,6,Package,QmlPackage)
-QT_END_NAMESPACE
-#include <qmlpackage.moc>
+QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlpackage_p.h b/src/declarative/util/qdeclarativepackage_p.h
index 29b6bbe..87d9b80 100644
--- a/src/declarative/util/qmlpackage_p.h
+++ b/src/declarative/util/qdeclarativepackage_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLPACKAGE_H
-#define QMLPACKAGE_H
+#ifndef QDECLARATIVEPACKAGE_H
+#define QDECLARATIVEPACKAGE_H
-#include <qml.h>
+#include <qdeclarative.h>
QT_BEGIN_HEADER
@@ -56,33 +56,49 @@ QT_MODULE(Declarative)
*****************************************************************************
*****************************************************************************/
-class QmlPackagePrivate;
-class QmlPackageAttached;
-class QmlPackage : public QObject
+class QDeclarativePackagePrivate;
+class QDeclarativePackageAttached;
+class QDeclarativePackage : public QObject
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlPackage)
+ Q_DECLARE_PRIVATE(QDeclarativePackage)
Q_CLASSINFO("DefaultProperty", "data")
- Q_PROPERTY(QmlListProperty<QObject> data READ data SCRIPTABLE false)
+ Q_PROPERTY(QDeclarativeListProperty<QObject> data READ data SCRIPTABLE false)
public:
- QmlPackage(QObject *parent=0);
- virtual ~QmlPackage();
+ QDeclarativePackage(QObject *parent=0);
+ virtual ~QDeclarativePackage();
- QmlListProperty<QObject> data();
+ QDeclarativeListProperty<QObject> data();
QObject *part(const QString & = QString());
bool hasPart(const QString &);
- static QmlPackageAttached *qmlAttachedProperties(QObject *);
+ static QDeclarativePackageAttached *qmlAttachedProperties(QObject *);
+};
+
+class QDeclarativePackageAttached : public QObject
+{
+Q_OBJECT
+Q_PROPERTY(QString name READ name WRITE setName)
+public:
+ QDeclarativePackageAttached(QObject *parent);
+ virtual ~QDeclarativePackageAttached();
+
+ QString name() const;
+ void setName(const QString &n);
+
+ static QHash<QObject *, QDeclarativePackageAttached *> attached;
+private:
+ QString _name;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlPackage)
-QML_DECLARE_TYPEINFO(QmlPackage, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPE(QDeclarativePackage)
+QML_DECLARE_TYPEINFO(QDeclarativePackage, QML_HAS_ATTACHED_PROPERTIES)
QT_END_HEADER
-#endif // QMLPACKAGE_H
+#endif // QDECLARATIVEPACKAGE_H
diff --git a/src/declarative/util/qmlpixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp
index 2459651..cfb25dd 100644
--- a/src/declarative/util/qmlpixmapcache.cpp
+++ b/src/declarative/util/qdeclarativepixmapcache.cpp
@@ -39,15 +39,15 @@
**
****************************************************************************/
-#include "qmlpixmapcache_p.h"
-#include "qmlnetworkaccessmanagerfactory.h"
-#include "qmlimageprovider.h"
+#include "qdeclarativepixmapcache_p.h"
+#include "qdeclarativenetworkaccessmanagerfactory.h"
+#include "qdeclarativeimageprovider.h"
#include "qfxperf_p_p.h"
-#include <qmlengine.h>
-#include <private/qmlglobal_p.h>
-#include <private/qmlengine_p.h>
+#include <qdeclarativeengine.h>
+#include <private/qdeclarativeglobal_p.h>
+#include <private/qdeclarativeengine_p.h>
#include <QCoreApplication>
#include <QImageReader>
@@ -79,12 +79,20 @@ inline uint qHash(const QUrl &uri)
}
#endif
-class QmlImageReaderEvent : public QEvent
+static QString toLocalFileOrQrc(const QUrl& url)
+{
+ QString r = url.toLocalFile();
+ if (r.isEmpty() && url.scheme() == QLatin1String("qrc"))
+ r = QLatin1Char(':') + url.path();
+ return r;
+}
+
+class QDeclarativeImageReaderEvent : public QEvent
{
public:
enum ReadError { NoError, Loading, Decoding };
- QmlImageReaderEvent(QmlImageReaderEvent::ReadError err, const QString &errStr, const QImage &img)
+ QDeclarativeImageReaderEvent(QDeclarativeImageReaderEvent::ReadError err, const QString &errStr, const QImage &img)
: QEvent(QEvent::User), error(err), errorString(errStr), image(img) {}
ReadError error;
@@ -92,50 +100,50 @@ public:
QImage image;
};
-class QmlImageRequestHandler;
-class QmlImageReader : public QThread
+class QDeclarativeImageRequestHandler;
+class QDeclarativeImageReader : public QThread
{
Q_OBJECT
public:
- QmlImageReader(QmlEngine *eng);
- ~QmlImageReader();
+ QDeclarativeImageReader(QDeclarativeEngine *eng);
+ ~QDeclarativeImageReader();
- QmlPixmapReply *getImage(const QUrl &url);
- void cancel(QmlPixmapReply *rep);
+ QDeclarativePixmapReply *getImage(const QUrl &url);
+ void cancel(QDeclarativePixmapReply *rep);
- static QmlImageReader *instance(QmlEngine *engine);
+ static QDeclarativeImageReader *instance(QDeclarativeEngine *engine);
protected:
void run();
private:
- QList<QmlPixmapReply*> jobs;
- QList<QmlPixmapReply*> cancelled;
- QmlEngine *engine;
- QmlImageRequestHandler *handler;
+ QList<QDeclarativePixmapReply*> jobs;
+ QList<QDeclarativePixmapReply*> cancelled;
+ QDeclarativeEngine *engine;
+ QDeclarativeImageRequestHandler *handler;
QMutex mutex;
- static QHash<QmlEngine *,QmlImageReader*> readers;
+ static QHash<QDeclarativeEngine *,QDeclarativeImageReader*> readers;
static QMutex readerMutex;
- friend class QmlImageRequestHandler;
+ friend class QDeclarativeImageRequestHandler;
};
-QHash<QmlEngine *,QmlImageReader*> QmlImageReader::readers;
-QMutex QmlImageReader::readerMutex;
+QHash<QDeclarativeEngine *,QDeclarativeImageReader*> QDeclarativeImageReader::readers;
+QMutex QDeclarativeImageReader::readerMutex;
-class QmlImageRequestHandler : public QObject
+class QDeclarativeImageRequestHandler : public QObject
{
Q_OBJECT
public:
- QmlImageRequestHandler(QmlImageReader *read, QmlEngine *eng)
+ QDeclarativeImageRequestHandler(QDeclarativeImageReader *read, QDeclarativeEngine *eng)
: QObject(), accessManager(0), engine(eng), reader(read)
{
QCoreApplication::postEvent(this, new QEvent(QEvent::User));
}
- QmlPixmapReply *getImage(const QUrl &url);
- void cancel(QmlPixmapReply *reply);
+ QDeclarativePixmapReply *getImage(const QUrl &url);
+ void cancel(QDeclarativePixmapReply *reply);
protected:
bool event(QEvent *event);
@@ -146,19 +154,19 @@ private slots:
private:
QNetworkAccessManager *networkAccessManager() {
if (!accessManager)
- accessManager = QmlEnginePrivate::get(engine)->createNetworkAccessManager(this);
+ accessManager = QDeclarativeEnginePrivate::get(engine)->createNetworkAccessManager(this);
return accessManager;
}
- QHash<QNetworkReply*,QmlPixmapReply*> replies;
+ QHash<QNetworkReply*,QDeclarativePixmapReply*> replies;
QNetworkAccessManager *accessManager;
- QmlEngine *engine;
- QmlImageReader *reader;
+ QDeclarativeEngine *engine;
+ QDeclarativeImageReader *reader;
};
//===========================================================================
-bool QmlImageRequestHandler::event(QEvent *event)
+bool QDeclarativeImageRequestHandler::event(QEvent *event)
{
if (event->type() == QEvent::User) {
static int replyDownloadProgress = -1;
@@ -169,8 +177,8 @@ bool QmlImageRequestHandler::event(QEvent *event)
if (replyDownloadProgress == -1) {
replyDownloadProgress = QNetworkReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)");
replyFinished = QNetworkReply::staticMetaObject.indexOfSignal("finished()");
- downloadProgress = QmlPixmapReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)");
- thisNetworkRequestDone = QmlImageRequestHandler::staticMetaObject.indexOfSlot("networkRequestDone()");
+ downloadProgress = QDeclarativePixmapReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)");
+ thisNetworkRequestDone = QDeclarativeImageRequestHandler::staticMetaObject.indexOfSlot("networkRequestDone()");
}
while (1) {
@@ -178,7 +186,7 @@ bool QmlImageRequestHandler::event(QEvent *event)
if (reader->cancelled.count()) {
for (int i = 0; i < reader->cancelled.count(); ++i) {
- QmlPixmapReply *job = reader->cancelled.at(i);
+ QDeclarativePixmapReply *job = reader->cancelled.at(i);
// cancel any jobs already started
QNetworkReply *reply = replies.key(job, 0);
if (reply && reply->isRunning()) {
@@ -202,29 +210,52 @@ bool QmlImageRequestHandler::event(QEvent *event)
break;
}
- QmlPixmapReply *runningJob = reader->jobs.takeLast();
+ QDeclarativePixmapReply *runningJob = reader->jobs.takeLast();
QUrl url = runningJob->url();
reader->mutex.unlock();
// fetch
if (url.scheme() == QLatin1String("image")) {
- QImage image = QmlEnginePrivate::get(engine)->getImageFromProvider(url);
- QmlImageReaderEvent::ReadError errorCode = QmlImageReaderEvent::NoError;
+ // Use QmlImageProvider
+ QImage image = QDeclarativeEnginePrivate::get(engine)->getImageFromProvider(url);
+ QDeclarativeImageReaderEvent::ReadError errorCode = QDeclarativeImageReaderEvent::NoError;
QString errorStr;
if (image.isNull()) {
- errorCode = QmlImageReaderEvent::Loading;
+ errorCode = QDeclarativeImageReaderEvent::Loading;
errorStr = QLatin1String("Failed to get image from provider: ") + url.toString();
}
- QCoreApplication::postEvent(runningJob, new QmlImageReaderEvent(errorCode, errorStr, image));
+ QCoreApplication::postEvent(runningJob, new QDeclarativeImageReaderEvent(errorCode, errorStr, image));
} else {
- QNetworkRequest req(url);
- req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);
- QNetworkReply *reply = networkAccessManager()->get(req);
+ QString lf = toLocalFileOrQrc(url);
+ if (!lf.isEmpty()) {
+ // Image is local - load/decode immediately
+ QImage image;
+ QDeclarativeImageReaderEvent::ReadError errorCode = QDeclarativeImageReaderEvent::NoError;
+ QString errorStr;
+ QFile f(lf);
+ if (f.open(QIODevice::ReadOnly)) {
+ QImageReader imgio(&f);
+ if (!imgio.read(&image)) {
+ errorStr = QLatin1String("Error decoding: ") + url.toString()
+ + QLatin1String(" \"") + imgio.errorString() + QLatin1String("\"");
+ errorCode = QDeclarativeImageReaderEvent::Loading;
+ }
+ } else {
+ errorStr = QLatin1String("Cannot open: ") + url.toString();
+ errorCode = QDeclarativeImageReaderEvent::Loading;
+ }
+ QCoreApplication::postEvent(runningJob, new QDeclarativeImageReaderEvent(errorCode, errorStr, image));
+ } else {
+ // Network resource
+ QNetworkRequest req(url);
+ req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);
+ QNetworkReply *reply = networkAccessManager()->get(req);
- QMetaObject::connect(reply, replyDownloadProgress, runningJob, downloadProgress);
- QMetaObject::connect(reply, replyFinished, this, thisNetworkRequestDone);
+ QMetaObject::connect(reply, replyDownloadProgress, runningJob, downloadProgress);
+ QMetaObject::connect(reply, replyFinished, this, thisNetworkRequestDone);
- replies.insert(reply, runningJob);
+ replies.insert(reply, runningJob);
+ }
}
}
return true;
@@ -233,29 +264,29 @@ bool QmlImageRequestHandler::event(QEvent *event)
return QObject::event(event);
}
-void QmlImageRequestHandler::networkRequestDone()
+void QDeclarativeImageRequestHandler::networkRequestDone()
{
QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
- QmlPixmapReply *job = replies.take(reply);
+ QDeclarativePixmapReply *job = replies.take(reply);
if (job) {
QImage image;
- QmlImageReaderEvent::ReadError error;
+ QDeclarativeImageReaderEvent::ReadError error;
QString errorString;
if (reply->error()) {
- error = QmlImageReaderEvent::Loading;
+ error = QDeclarativeImageReaderEvent::Loading;
errorString = reply->errorString();
} else {
QImageReader imgio(reply);
if (imgio.read(&image)) {
- error = QmlImageReaderEvent::NoError;
+ error = QDeclarativeImageReaderEvent::NoError;
} else {
errorString = QLatin1String("Error decoding: ") + reply->url().toString()
+ QLatin1String(" \"") + imgio.errorString() + QLatin1String("\"");
- error = QmlImageReaderEvent::Decoding;
+ error = QDeclarativeImageReaderEvent::Decoding;
}
}
- // send completion event to the QmlPixmapReply
- QCoreApplication::postEvent(job, new QmlImageReaderEvent(error, errorString, image));
+ // send completion event to the QDeclarativePixmapReply
+ QCoreApplication::postEvent(job, new QDeclarativeImageReaderEvent(error, errorString, image));
}
// kick off event loop again if we have dropped below max request count
if (replies.count() == maxImageRequestCount)
@@ -265,13 +296,13 @@ void QmlImageRequestHandler::networkRequestDone()
//===========================================================================
-QmlImageReader::QmlImageReader(QmlEngine *eng)
+QDeclarativeImageReader::QDeclarativeImageReader(QDeclarativeEngine *eng)
: QThread(eng), engine(eng), handler(0)
{
start(QThread::LowPriority);
}
-QmlImageReader::~QmlImageReader()
+QDeclarativeImageReader::~QDeclarativeImageReader()
{
readerMutex.lock();
readers.remove(engine);
@@ -281,12 +312,12 @@ QmlImageReader::~QmlImageReader()
wait();
}
-QmlImageReader *QmlImageReader::instance(QmlEngine *engine)
+QDeclarativeImageReader *QDeclarativeImageReader::instance(QDeclarativeEngine *engine)
{
readerMutex.lock();
- QmlImageReader *reader = readers.value(engine);
+ QDeclarativeImageReader *reader = readers.value(engine);
if (!reader) {
- reader = new QmlImageReader(engine);
+ reader = new QDeclarativeImageReader(engine);
readers.insert(engine, reader);
}
readerMutex.unlock();
@@ -294,10 +325,10 @@ QmlImageReader *QmlImageReader::instance(QmlEngine *engine)
return reader;
}
-QmlPixmapReply *QmlImageReader::getImage(const QUrl &url)
+QDeclarativePixmapReply *QDeclarativeImageReader::getImage(const QUrl &url)
{
mutex.lock();
- QmlPixmapReply *reply = new QmlPixmapReply(this, url);
+ QDeclarativePixmapReply *reply = new QDeclarativePixmapReply(this, url);
reply->addRef();
reply->setLoading();
jobs.append(reply);
@@ -307,7 +338,7 @@ QmlPixmapReply *QmlImageReader::getImage(const QUrl &url)
return reply;
}
-void QmlImageReader::cancel(QmlPixmapReply *reply)
+void QDeclarativeImageReader::cancel(QDeclarativePixmapReply *reply)
{
mutex.lock();
if (reply->isLoading()) {
@@ -319,7 +350,7 @@ void QmlImageReader::cancel(QmlPixmapReply *reply)
mutex.unlock();
}
-void QmlImageReader::run()
+void QDeclarativeImageReader::run()
{
#if defined(Q_OS_LINUX) && defined(SCHED_IDLE)
struct sched_param param;
@@ -329,7 +360,7 @@ void QmlImageReader::run()
pthread_setschedparam(pthread_self(), SCHED_IDLE, &param);
#endif
- handler = new QmlImageRequestHandler(this, engine);
+ handler = new QDeclarativeImageRequestHandler(this, engine);
exec();
@@ -375,64 +406,56 @@ static bool readImage(QIODevice *dev, QPixmap *pixmap, QString &errorString)
/*!
\internal
- \class QmlPixmapCache
- \brief Enacapsultes a pixmap for QmlGraphics items.
+ \class QDeclarativePixmapCache
+ \brief Enacapsultes a pixmap for QDeclarativeGraphics items.
This class is NOT reentrant.
*/
-static QString toLocalFileOrQrc(const QUrl& url)
-{
- QString r = url.toLocalFile();
- if (r.isEmpty() && url.scheme() == QLatin1String("qrc"))
- r = QLatin1Char(':') + url.path();
- return r;
-}
+typedef QHash<QUrl, QDeclarativePixmapReply *> QDeclarativePixmapReplyHash;
+Q_GLOBAL_STATIC(QDeclarativePixmapReplyHash, qmlActivePixmapReplies);
-typedef QHash<QUrl, QmlPixmapReply *> QmlPixmapReplyHash;
-Q_GLOBAL_STATIC(QmlPixmapReplyHash, qmlActivePixmapReplies);
-
-class QmlPixmapReplyPrivate : public QObjectPrivate
+class QDeclarativePixmapReplyPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlPixmapReply)
+ Q_DECLARE_PUBLIC(QDeclarativePixmapReply)
public:
- QmlPixmapReplyPrivate(QmlImageReader *r, const QUrl &u)
- : QObjectPrivate(), refCount(1), url(u), status(QmlPixmapReply::Loading), loading(false), reader(r) {
+ QDeclarativePixmapReplyPrivate(QDeclarativeImageReader *r, const QUrl &u)
+ : QObjectPrivate(), refCount(1), url(u), status(QDeclarativePixmapReply::Loading), loading(false), reader(r) {
}
int refCount;
QUrl url;
QPixmap pixmap; // ensure reference to pixmap so QPixmapCache does not discard
- QmlPixmapReply::Status status;
+ QDeclarativePixmapReply::Status status;
bool loading;
- QmlImageReader *reader;
+ QDeclarativeImageReader *reader;
};
-QmlPixmapReply::QmlPixmapReply(QmlImageReader *reader, const QUrl &url)
- : QObject(*new QmlPixmapReplyPrivate(reader, url), 0)
+QDeclarativePixmapReply::QDeclarativePixmapReply(QDeclarativeImageReader *reader, const QUrl &url)
+ : QObject(*new QDeclarativePixmapReplyPrivate(reader, url), 0)
{
}
-QmlPixmapReply::~QmlPixmapReply()
+QDeclarativePixmapReply::~QDeclarativePixmapReply()
{
}
-const QUrl &QmlPixmapReply::url() const
+const QUrl &QDeclarativePixmapReply::url() const
{
- Q_D(const QmlPixmapReply);
+ Q_D(const QDeclarativePixmapReply);
return d->url;
}
-bool QmlPixmapReply::event(QEvent *event)
+bool QDeclarativePixmapReply::event(QEvent *event)
{
- Q_D(QmlPixmapReply);
+ Q_D(QDeclarativePixmapReply);
if (event->type() == QEvent::User) {
d->loading = false;
if (!release(true)) {
- QmlImageReaderEvent *de = static_cast<QmlImageReaderEvent*>(event);
- d->status = (de->error == QmlImageReaderEvent::NoError) ? Ready : Error;
+ QDeclarativeImageReaderEvent *de = static_cast<QDeclarativeImageReaderEvent*>(event);
+ d->status = (de->error == QDeclarativeImageReaderEvent::NoError) ? Ready : Error;
if (d->status == Ready)
d->pixmap = QPixmap::fromImage(de->image);
else
@@ -448,33 +471,33 @@ bool QmlPixmapReply::event(QEvent *event)
return QObject::event(event);
}
-QmlPixmapReply::Status QmlPixmapReply::status() const
+QDeclarativePixmapReply::Status QDeclarativePixmapReply::status() const
{
- Q_D(const QmlPixmapReply);
+ Q_D(const QDeclarativePixmapReply);
return d->status;
}
-bool QmlPixmapReply::isLoading() const
+bool QDeclarativePixmapReply::isLoading() const
{
- Q_D(const QmlPixmapReply);
+ Q_D(const QDeclarativePixmapReply);
return d->loading;
}
-void QmlPixmapReply::setLoading()
+void QDeclarativePixmapReply::setLoading()
{
- Q_D(QmlPixmapReply);
+ Q_D(QDeclarativePixmapReply);
d->loading = true;
}
-void QmlPixmapReply::addRef()
+void QDeclarativePixmapReply::addRef()
{
- Q_D(QmlPixmapReply);
+ Q_D(QDeclarativePixmapReply);
++d->refCount;
}
-bool QmlPixmapReply::release(bool defer)
+bool QDeclarativePixmapReply::release(bool defer)
{
- Q_D(QmlPixmapReply);
+ Q_D(QDeclarativePixmapReply);
Q_ASSERT(d->refCount > 0);
--d->refCount;
if (d->refCount == 0) {
@@ -500,42 +523,50 @@ bool QmlPixmapReply::release(bool defer)
Returns Ready, or Error if the image has been retrieved,
otherwise the current retrieval status.
+
+ If \a async is false the image will be loaded and decoded immediately;
+ otherwise the image will be loaded and decoded in a separate thread.
+
+ Note that images sourced from the network will always be loaded and
+ decoded asynchonously.
*/
-QmlPixmapReply::Status QmlPixmapCache::get(const QUrl& url, QPixmap *pixmap)
+QDeclarativePixmapReply::Status QDeclarativePixmapCache::get(const QUrl& url, QPixmap *pixmap, bool async)
{
- QmlPixmapReply::Status status = QmlPixmapReply::Unrequested;
+ QDeclarativePixmapReply::Status status = QDeclarativePixmapReply::Unrequested;
+ QByteArray key = url.toEncoded(QUrl::FormattingOption(0x100));
+ QString strKey = QString::fromLatin1(key.constData(), key.count());
#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML
- QString lf = toLocalFileOrQrc(url);
- if (!lf.isEmpty()) {
- status = QmlPixmapReply::Ready;
- if (!QPixmapCache::find(lf,pixmap)) {
- QFile f(lf);
- if (f.open(QIODevice::ReadOnly)) {
- QString errorString;
- if (!readImage(&f, pixmap, errorString)) {
- errorString = QLatin1String("Error decoding: ") + url.toString()
- + QLatin1String(" \"") + errorString + QLatin1String("\"");
- qWarning() << errorString;
+ if (!async) {
+ QString lf = toLocalFileOrQrc(url);
+ if (!lf.isEmpty()) {
+ status = QDeclarativePixmapReply::Ready;
+ if (!QPixmapCache::find(strKey,pixmap)) {
+ QFile f(lf);
+ if (f.open(QIODevice::ReadOnly)) {
+ QString errorString;
+ if (!readImage(&f, pixmap, errorString)) {
+ errorString = QLatin1String("Error decoding: ") + url.toString()
+ + QLatin1String(" \"") + errorString + QLatin1String("\"");
+ qWarning() << errorString;
+ *pixmap = QPixmap();
+ status = QDeclarativePixmapReply::Error;
+ }
+ } else {
+ qWarning() << "Cannot open" << url;
*pixmap = QPixmap();
- status = QmlPixmapReply::Error;
+ status = QDeclarativePixmapReply::Error;
}
- } else {
- qWarning() << "Cannot open" << url;
- *pixmap = QPixmap();
- status = QmlPixmapReply::Error;
+ if (status == QDeclarativePixmapReply::Ready)
+ QPixmapCache::insert(strKey, *pixmap);
}
- if (status == QmlPixmapReply::Ready)
- QPixmapCache::insert(lf, *pixmap);
+ return status;
}
- return status;
}
#endif
- QByteArray key = url.toEncoded(QUrl::FormattingOption(0x100));
- QString strKey = QString::fromLatin1(key.constData(), key.count());
- QmlPixmapReplyHash::Iterator iter = qmlActivePixmapReplies()->find(url);
- if (iter != qmlActivePixmapReplies()->end() && (*iter)->status() == QmlPixmapReply::Ready) {
+ QDeclarativePixmapReplyHash::Iterator iter = qmlActivePixmapReplies()->find(url);
+ if (iter != qmlActivePixmapReplies()->end() && (*iter)->status() == QDeclarativePixmapReply::Ready) {
// Must check this, since QPixmapCache::insert may have failed.
*pixmap = (*iter)->d_func()->pixmap;
status = (*iter)->status();
@@ -545,10 +576,10 @@ QmlPixmapReply::Status QmlPixmapCache::get(const QUrl& url, QPixmap *pixmap)
status = (*iter)->status();
(*iter)->release();
} else {
- status = pixmap->isNull() ? QmlPixmapReply::Error : QmlPixmapReply::Ready;
+ status = pixmap->isNull() ? QDeclarativePixmapReply::Error : QDeclarativePixmapReply::Ready;
}
} else if (iter != qmlActivePixmapReplies()->end()) {
- status = QmlPixmapReply::Loading;
+ status = QDeclarativePixmapReply::Loading;
}
return status;
@@ -557,18 +588,18 @@ QmlPixmapReply::Status QmlPixmapCache::get(const QUrl& url, QPixmap *pixmap)
/*!
Starts a network request to load \a url.
- Returns a QmlPixmapReply. Caller should connect to QmlPixmapReply::finished()
+ Returns a QDeclarativePixmapReply. Caller should connect to QDeclarativePixmapReply::finished()
and call get() when the image is available.
- The returned QmlPixmapReply will be deleted when all request() calls are
+ The returned QDeclarativePixmapReply will be deleted when all request() calls are
matched by a corresponding get() call.
*/
-QmlPixmapReply *QmlPixmapCache::request(QmlEngine *engine, const QUrl &url)
+QDeclarativePixmapReply *QDeclarativePixmapCache::request(QDeclarativeEngine *engine, const QUrl &url)
{
- QmlPixmapReplyHash::Iterator iter = qmlActivePixmapReplies()->find(url);
+ QDeclarativePixmapReplyHash::Iterator iter = qmlActivePixmapReplies()->find(url);
if (iter == qmlActivePixmapReplies()->end()) {
- QmlImageReader *reader = QmlImageReader::instance(engine);
- QmlPixmapReply *item = reader->getImage(url);
+ QDeclarativeImageReader *reader = QDeclarativeImageReader::instance(engine);
+ QDeclarativePixmapReply *item = reader->getImage(url);
iter = qmlActivePixmapReplies()->insert(url, item);
} else {
(*iter)->addRef();
@@ -582,16 +613,16 @@ QmlPixmapReply *QmlPixmapCache::request(QmlEngine *engine, const QUrl &url)
May also cancel loading (eg. if no other pending request).
- Any connections from the QmlPixmapReply returned by request() to \a obj will be
+ Any connections from the QDeclarativePixmapReply returned by request() to \a obj will be
disconnected.
*/
-void QmlPixmapCache::cancel(const QUrl& url, QObject *obj)
+void QDeclarativePixmapCache::cancel(const QUrl& url, QObject *obj)
{
- QmlPixmapReplyHash::Iterator iter = qmlActivePixmapReplies()->find(url);
+ QDeclarativePixmapReplyHash::Iterator iter = qmlActivePixmapReplies()->find(url);
if (iter == qmlActivePixmapReplies()->end())
return;
- QmlPixmapReply *reply = *iter;
+ QDeclarativePixmapReply *reply = *iter;
if (obj)
QObject::disconnect(reply, 0, obj, 0);
reply->release();
@@ -601,11 +632,11 @@ void QmlPixmapCache::cancel(const QUrl& url, QObject *obj)
This function is mainly for test verification. It returns the number of
requests that are still unfinished.
*/
-int QmlPixmapCache::pendingRequests()
+int QDeclarativePixmapCache::pendingRequests()
{
return qmlActivePixmapReplies()->count();
}
QT_END_NAMESPACE
-#include <qmlpixmapcache.moc>
+#include <qdeclarativepixmapcache.moc>
diff --git a/src/declarative/util/qmlpixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h
index 86908cc..b8949db 100644
--- a/src/declarative/util/qmlpixmapcache_p.h
+++ b/src/declarative/util/qdeclarativepixmapcache_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLPIXMAPCACHE_H
-#define QMLPIXMAPCACHE_H
+#ifndef QDECLARATIVEPIXMAPCACHE_H
+#define QDECLARATIVEPIXMAPCACHE_H
#include <QtCore/QString>
#include <QtGui/QPixmap>
@@ -51,16 +51,16 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlEngine;
+class QDeclarativeEngine;
class QNetworkReply;
-class QmlImageReader;
+class QDeclarativeImageReader;
-class QmlPixmapReplyPrivate;
-class Q_DECLARATIVE_EXPORT QmlPixmapReply : public QObject
+class QDeclarativePixmapReplyPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativePixmapReply : public QObject
{
Q_OBJECT
public:
- ~QmlPixmapReply();
+ ~QDeclarativePixmapReply();
enum Status { Ready, Error, Unrequested, Loading };
Status status() const;
@@ -81,19 +81,19 @@ private:
void setLoading();
private:
- QmlPixmapReply(QmlImageReader *reader, const QUrl &url);
- Q_DISABLE_COPY(QmlPixmapReply)
- Q_DECLARE_PRIVATE(QmlPixmapReply)
- friend class QmlImageRequestHandler;
- friend class QmlImageReader;
- friend class QmlPixmapCache;
+ QDeclarativePixmapReply(QDeclarativeImageReader *reader, const QUrl &url);
+ Q_DISABLE_COPY(QDeclarativePixmapReply)
+ Q_DECLARE_PRIVATE(QDeclarativePixmapReply)
+ friend class QDeclarativeImageRequestHandler;
+ friend class QDeclarativeImageReader;
+ friend class QDeclarativePixmapCache;
};
-class Q_DECLARATIVE_EXPORT QmlPixmapCache
+class Q_DECLARATIVE_EXPORT QDeclarativePixmapCache
{
public:
- static QmlPixmapReply::Status get(const QUrl& url, QPixmap *pixmap);
- static QmlPixmapReply *request(QmlEngine *, const QUrl& url);
+ static QDeclarativePixmapReply::Status get(const QUrl& url, QPixmap *pixmap, bool async=false);
+ static QDeclarativePixmapReply *request(QDeclarativeEngine *, const QUrl& url);
static void cancel(const QUrl& url, QObject *obj);
static int pendingRequests();
};
@@ -104,4 +104,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLPIXMAPCACHE_H
+#endif // QDECLARATIVEPIXMAPCACHE_H
diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp
index fba22f9..9c2b1e6 100644
--- a/src/declarative/util/qmlpropertychanges.cpp
+++ b/src/declarative/util/qdeclarativepropertychanges.cpp
@@ -39,17 +39,18 @@
**
****************************************************************************/
-#include "qmlpropertychanges_p.h"
+#include "qdeclarativepropertychanges_p.h"
-#include "qmlopenmetaobject_p.h"
+#include "qdeclarativeopenmetaobject_p.h"
-#include <qmlinfo.h>
-#include <qmlcustomparser_p.h>
-#include <qmlparser_p.h>
-#include <qmlexpression.h>
-#include <qmlbinding.h>
-#include <qmlcontext.h>
-#include <qmlguard_p.h>
+#include <qdeclarativeinfo.h>
+#include <qdeclarativecustomparser_p.h>
+#include <qdeclarativeparser_p.h>
+#include <qdeclarativeexpression.h>
+#include <qdeclarativebinding_p.h>
+#include <qdeclarativecontext.h>
+#include <qdeclarativeguard_p.h>
+#include <qdeclarativeproperty_p.h>
#include <QtCore/qdebug.h>
@@ -58,8 +59,8 @@
QT_BEGIN_NAMESPACE
/*!
- \qmlclass PropertyChanges QmlPropertyChanges
- \since 4.7
+ \qmlclass PropertyChanges QDeclarativePropertyChanges
+ \since 4.7
\brief The PropertyChanges element describes new property values for a state.
PropertyChanges provides a state change that modifies the properties of an item.
@@ -97,6 +98,33 @@ QT_BEGIN_NAMESPACE
}
\endqml
+ You can reset a property in a state change by assigning \c undefined. In the following
+ example we reset \c theText's width when we enter state1. This will give the text its
+ natural width (which is the whole string on one line).
+
+ \qml
+ import Qt 4.6
+
+ Rectangle {
+ width: 640
+ height: 480
+ Text {
+ id: theText
+ width: 50
+ wrap: true
+ text: "a text string that is longer than 50 pixels"
+ }
+
+ states: State {
+ name: "state1"
+ PropertyChanges {
+ target: theText
+ width: undefined
+ }
+ }
+ }
+ \endqml
+
Changes to an Item's parent or anchors should be done using the associated change elements
(ParentChange and AnchorChanges, respectively) rather than PropertyChanges.
@@ -105,8 +133,8 @@ QT_BEGIN_NAMESPACE
/*!
\internal
- \class QmlPropertyChanges
- \brief The QmlPropertyChanges class describes new property values for a state.
+ \class QDeclarativePropertyChanges
+ \brief The QDeclarativePropertyChanges class describes new property values for a state.
*/
/*!
@@ -114,30 +142,30 @@ QT_BEGIN_NAMESPACE
This property holds the object which contains the properties to be changed.
*/
-class QmlReplaceSignalHandler : public QmlActionEvent
+class QDeclarativeReplaceSignalHandler : public QDeclarativeActionEvent
{
public:
- QmlReplaceSignalHandler() : expression(0), reverseExpression(0),
+ QDeclarativeReplaceSignalHandler() : expression(0), reverseExpression(0),
rewindExpression(0), ownedExpression(0) {}
- ~QmlReplaceSignalHandler() {
+ ~QDeclarativeReplaceSignalHandler() {
delete ownedExpression;
}
virtual QString typeName() const { return QLatin1String("ReplaceSignalHandler"); }
- QmlMetaProperty property;
- QmlExpression *expression;
- QmlExpression *reverseExpression;
- QmlExpression *rewindExpression;
- QmlGuard<QmlExpression> ownedExpression;
+ QDeclarativeProperty property;
+ QDeclarativeExpression *expression;
+ QDeclarativeExpression *reverseExpression;
+ QDeclarativeExpression *rewindExpression;
+ QDeclarativeGuard<QDeclarativeExpression> ownedExpression;
virtual void execute() {
- ownedExpression = property.setSignalExpression(expression);
+ ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, expression);
}
virtual bool isReversable() { return true; }
virtual void reverse() {
- ownedExpression = property.setSignalExpression(reverseExpression);
+ ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, reverseExpression);
}
virtual void saveOriginals() {
@@ -146,27 +174,29 @@ public:
}
virtual void rewind() {
- ownedExpression = property.setSignalExpression(rewindExpression);
+ ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, rewindExpression);
+ }
+ virtual void saveCurrentValues() {
+ rewindExpression = QDeclarativePropertyPrivate::signalExpression(property);
}
- virtual void saveCurrentValues() { rewindExpression = property.signalExpression(); }
- virtual bool override(QmlActionEvent*other) {
+ virtual bool override(QDeclarativeActionEvent*other) {
if (other == this)
return true;
if (other->typeName() != typeName())
return false;
- if (static_cast<QmlReplaceSignalHandler*>(other)->property == property)
+ if (static_cast<QDeclarativeReplaceSignalHandler*>(other)->property == property)
return true;
return false;
}
};
-class QmlPropertyChangesPrivate : public QObjectPrivate
+class QDeclarativePropertyChangesPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlPropertyChanges)
+ Q_DECLARE_PUBLIC(QDeclarativePropertyChanges)
public:
- QmlPropertyChangesPrivate() : object(0), decoded(true), restore(true),
+ QDeclarativePropertyChangesPrivate() : object(0), decoded(true), restore(true),
isExplicit(false) {}
QObject *object;
@@ -179,25 +209,16 @@ public:
void decode();
QList<QPair<QByteArray, QVariant> > properties;
- QList<QPair<QByteArray, QmlExpression *> > expressions;
- QList<QmlReplaceSignalHandler*> signalReplacements;
+ QList<QPair<QByteArray, QDeclarativeExpression *> > expressions;
+ QList<QDeclarativeReplaceSignalHandler*> signalReplacements;
- QmlMetaProperty property(const QByteArray &);
-};
-
-class QmlPropertyChangesParser : public QmlCustomParser
-{
-public:
- void compileList(QList<QPair<QByteArray, QVariant> > &list, const QByteArray &pre, const QmlCustomParserProperty &prop);
-
- virtual QByteArray compile(const QList<QmlCustomParserProperty> &);
- virtual void setCustomData(QObject *, const QByteArray &);
+ QDeclarativeProperty property(const QByteArray &);
};
void
-QmlPropertyChangesParser::compileList(QList<QPair<QByteArray, QVariant> > &list,
+QDeclarativePropertyChangesParser::compileList(QList<QPair<QByteArray, QVariant> > &list,
const QByteArray &pre,
- const QmlCustomParserProperty &prop)
+ const QDeclarativeCustomParserProperty &prop)
{
QByteArray propName = pre + prop.name();
@@ -205,12 +226,12 @@ QmlPropertyChangesParser::compileList(QList<QPair<QByteArray, QVariant> > &list,
for (int ii = 0; ii < values.count(); ++ii) {
const QVariant &value = values.at(ii);
- if (value.userType() == qMetaTypeId<QmlCustomParserNode>()) {
+ if (value.userType() == qMetaTypeId<QDeclarativeCustomParserNode>()) {
continue;
- } else if(value.userType() == qMetaTypeId<QmlCustomParserProperty>()) {
+ } else if(value.userType() == qMetaTypeId<QDeclarativeCustomParserProperty>()) {
- QmlCustomParserProperty prop =
- qvariant_cast<QmlCustomParserProperty>(value);
+ QDeclarativeCustomParserProperty prop =
+ qvariant_cast<QDeclarativeCustomParserProperty>(value);
QByteArray pre = propName + '.';
compileList(list, pre, prop);
@@ -221,7 +242,7 @@ QmlPropertyChangesParser::compileList(QList<QPair<QByteArray, QVariant> > &list,
}
QByteArray
-QmlPropertyChangesParser::compile(const QList<QmlCustomParserProperty> &props)
+QDeclarativePropertyChangesParser::compile(const QList<QDeclarativeCustomParserProperty> &props)
{
QList<QPair<QByteArray, QVariant> > data;
for(int ii = 0; ii < props.count(); ++ii)
@@ -232,21 +253,21 @@ QmlPropertyChangesParser::compile(const QList<QmlCustomParserProperty> &props)
ds << data.count();
for(int ii = 0; ii < data.count(); ++ii) {
- QmlParser::Variant v = qvariant_cast<QmlParser::Variant>(data.at(ii).second);
+ QDeclarativeParser::Variant v = qvariant_cast<QDeclarativeParser::Variant>(data.at(ii).second);
QVariant var;
bool isScript = v.isScript();
switch(v.type()) {
- case QmlParser::Variant::Boolean:
+ case QDeclarativeParser::Variant::Boolean:
var = QVariant(v.asBoolean());
break;
- case QmlParser::Variant::Number:
+ case QDeclarativeParser::Variant::Number:
var = QVariant(v.asNumber());
break;
- case QmlParser::Variant::String:
+ case QDeclarativeParser::Variant::String:
var = QVariant(v.asString());
break;
- case QmlParser::Variant::Invalid:
- case QmlParser::Variant::Script:
+ case QDeclarativeParser::Variant::Invalid:
+ case QDeclarativeParser::Variant::Script:
var = QVariant(v.asScript());
break;
}
@@ -257,9 +278,9 @@ QmlPropertyChangesParser::compile(const QList<QmlCustomParserProperty> &props)
return rv;
}
-void QmlPropertyChangesPrivate::decode()
+void QDeclarativePropertyChangesPrivate::decode()
{
- Q_Q(QmlPropertyChanges);
+ Q_Q(QDeclarativePropertyChanges);
if (decoded)
return;
@@ -275,17 +296,15 @@ void QmlPropertyChangesPrivate::decode()
ds >> isScript;
ds >> data;
- QmlMetaProperty prop = property(name); //### better way to check for signal property?
- if (prop.type() & QmlMetaProperty::SignalProperty) {
- QmlExpression *expression = new QmlExpression(qmlContext(q), data.toString(), object);
- expression->setTrackChange(false);
- QmlReplaceSignalHandler *handler = new QmlReplaceSignalHandler;
+ QDeclarativeProperty prop = property(name); //### better way to check for signal property?
+ if (prop.type() & QDeclarativeProperty::SignalProperty) {
+ QDeclarativeExpression *expression = new QDeclarativeExpression(qmlContext(q), data.toString(), object);
+ QDeclarativeReplaceSignalHandler *handler = new QDeclarativeReplaceSignalHandler;
handler->property = prop;
handler->expression = expression;
signalReplacements << handler;
} else if (isScript) {
- QmlExpression *expression = new QmlExpression(qmlContext(q), data.toString(), object);
- expression->setTrackChange(false);
+ QDeclarativeExpression *expression = new QDeclarativeExpression(qmlContext(q), data.toString(), object);
expressions << qMakePair(name, expression);
} else {
properties << qMakePair(name, data);
@@ -296,38 +315,38 @@ void QmlPropertyChangesPrivate::decode()
data.clear();
}
-void QmlPropertyChangesParser::setCustomData(QObject *object,
+void QDeclarativePropertyChangesParser::setCustomData(QObject *object,
const QByteArray &data)
{
- QmlPropertyChangesPrivate *p =
- static_cast<QmlPropertyChangesPrivate *>(QObjectPrivate::get(object));
+ QDeclarativePropertyChangesPrivate *p =
+ static_cast<QDeclarativePropertyChangesPrivate *>(QObjectPrivate::get(object));
p->data = data;
p->decoded = false;
}
-QmlPropertyChanges::QmlPropertyChanges()
-: QmlStateOperation(*(new QmlPropertyChangesPrivate))
+QDeclarativePropertyChanges::QDeclarativePropertyChanges()
+: QDeclarativeStateOperation(*(new QDeclarativePropertyChangesPrivate))
{
}
-QmlPropertyChanges::~QmlPropertyChanges()
+QDeclarativePropertyChanges::~QDeclarativePropertyChanges()
{
- Q_D(QmlPropertyChanges);
+ Q_D(QDeclarativePropertyChanges);
for(int ii = 0; ii < d->expressions.count(); ++ii)
delete d->expressions.at(ii).second;
for(int ii = 0; ii < d->signalReplacements.count(); ++ii)
delete d->signalReplacements.at(ii);
}
-QObject *QmlPropertyChanges::object() const
+QObject *QDeclarativePropertyChanges::object() const
{
- Q_D(const QmlPropertyChanges);
+ Q_D(const QDeclarativePropertyChanges);
return d->object;
}
-void QmlPropertyChanges::setObject(QObject *o)
+void QDeclarativePropertyChanges::setObject(QObject *o)
{
- Q_D(QmlPropertyChanges);
+ Q_D(QDeclarativePropertyChanges);
d->object = o;
}
@@ -340,36 +359,36 @@ void QmlPropertyChanges::setObject(QObject *o)
By setting restoreEntryValues to false, you can create a temporary state
that has permanent effects on property values.
*/
-bool QmlPropertyChanges::restoreEntryValues() const
+bool QDeclarativePropertyChanges::restoreEntryValues() const
{
- Q_D(const QmlPropertyChanges);
+ Q_D(const QDeclarativePropertyChanges);
return d->restore;
}
-void QmlPropertyChanges::setRestoreEntryValues(bool v)
+void QDeclarativePropertyChanges::setRestoreEntryValues(bool v)
{
- Q_D(QmlPropertyChanges);
+ Q_D(QDeclarativePropertyChanges);
d->restore = v;
}
-QmlMetaProperty
-QmlPropertyChangesPrivate::property(const QByteArray &property)
+QDeclarativeProperty
+QDeclarativePropertyChangesPrivate::property(const QByteArray &property)
{
- Q_Q(QmlPropertyChanges);
- QmlMetaProperty prop = QmlMetaProperty::createProperty(object, QString::fromUtf8(property));
+ Q_Q(QDeclarativePropertyChanges);
+ QDeclarativeProperty prop(object, QString::fromUtf8(property));
if (!prop.isValid()) {
- 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));
- return QmlMetaProperty();
+ qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(property));
+ return QDeclarativeProperty();
+ } else if (!(prop.type() & QDeclarativeProperty::SignalProperty) && !prop.isWritable()) {
+ qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to read-only property \"%1\"").arg(QString::fromUtf8(property));
+ return QDeclarativeProperty();
}
return prop;
}
-QmlPropertyChanges::ActionList QmlPropertyChanges::actions()
+QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions()
{
- Q_D(QmlPropertyChanges);
+ Q_D(QDeclarativePropertyChanges);
d->decode();
@@ -379,7 +398,7 @@ QmlPropertyChanges::ActionList QmlPropertyChanges::actions()
QByteArray property = d->properties.at(ii).first;
- QmlAction a(d->object, QString::fromLatin1(property),
+ QDeclarativeAction a(d->object, QString::fromLatin1(property),
d->properties.at(ii).second);
if (a.property.isValid()) {
@@ -395,10 +414,10 @@ QmlPropertyChanges::ActionList QmlPropertyChanges::actions()
for (int ii = 0; ii < d->signalReplacements.count(); ++ii) {
- QmlReplaceSignalHandler *handler = d->signalReplacements.at(ii);
+ QDeclarativeReplaceSignalHandler *handler = d->signalReplacements.at(ii);
if (handler->property.isValid()) {
- QmlAction a;
+ QDeclarativeAction a;
a.event = handler;
list << a;
}
@@ -407,10 +426,10 @@ QmlPropertyChanges::ActionList QmlPropertyChanges::actions()
for (int ii = 0; ii < d->expressions.count(); ++ii) {
QByteArray property = d->expressions.at(ii).first;
- QmlMetaProperty prop = d->property(property);
+ QDeclarativeProperty prop = d->property(property);
if (prop.isValid()) {
- QmlAction a;
+ QDeclarativeAction a;
a.restore = restoreEntryValues();
a.property = prop;
a.fromValue = a.property.read();
@@ -420,7 +439,7 @@ QmlPropertyChanges::ActionList QmlPropertyChanges::actions()
if (d->isExplicit) {
a.toValue = d->expressions.at(ii).second->value();
} else {
- QmlBinding *newBinding = new QmlBinding(d->expressions.at(ii).second->expression(), object(), qmlContext(this));
+ QDeclarativeBinding *newBinding = new QDeclarativeBinding(d->expressions.at(ii).second->expression(), object(), qmlContext(this));
newBinding->setTarget(prop);
a.toBinding = newBinding;
a.deletableToBinding = true;
@@ -452,18 +471,16 @@ QmlPropertyChanges::ActionList QmlPropertyChanges::actions()
By default, explicit is false.
*/
-bool QmlPropertyChanges::isExplicit() const
+bool QDeclarativePropertyChanges::isExplicit() const
{
- Q_D(const QmlPropertyChanges);
+ Q_D(const QDeclarativePropertyChanges);
return d->isExplicit;
}
-void QmlPropertyChanges::setIsExplicit(bool e)
+void QDeclarativePropertyChanges::setIsExplicit(bool e)
{
- Q_D(QmlPropertyChanges);
+ Q_D(QDeclarativePropertyChanges);
d->isExplicit = e;
}
-QML_DEFINE_CUSTOM_TYPE(Qt, 4,6, PropertyChanges, QmlPropertyChanges, QmlPropertyChangesParser)
-
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlpropertychanges_p.h b/src/declarative/util/qdeclarativepropertychanges_p.h
index 19dcf9d..1274b0c 100644
--- a/src/declarative/util/qmlpropertychanges_p.h
+++ b/src/declarative/util/qdeclarativepropertychanges_p.h
@@ -39,10 +39,11 @@
**
****************************************************************************/
-#ifndef QMLPROPERTYCHANGES_H
-#define QMLPROPERTYCHANGES_H
+#ifndef QDECLARATIVEPROPERTYCHANGES_H
+#define QDECLARATIVEPROPERTYCHANGES_H
-#include "qmlstateoperations_p.h"
+#include "qdeclarativestateoperations_p.h"
+#include <private/qdeclarativecustomparser_p.h>
QT_BEGIN_HEADER
@@ -50,18 +51,18 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlPropertyChangesPrivate;
-class Q_DECLARATIVE_EXPORT QmlPropertyChanges : public QmlStateOperation
+class QDeclarativePropertyChangesPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativePropertyChanges : public QDeclarativeStateOperation
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlPropertyChanges)
+ Q_DECLARE_PRIVATE(QDeclarativePropertyChanges)
Q_PROPERTY(QObject *target READ object WRITE setObject)
Q_PROPERTY(bool restoreEntryValues READ restoreEntryValues WRITE setRestoreEntryValues)
Q_PROPERTY(bool explicit READ isExplicit WRITE setIsExplicit)
public:
- QmlPropertyChanges();
- ~QmlPropertyChanges();
+ QDeclarativePropertyChanges();
+ ~QDeclarativePropertyChanges();
QObject *object() const;
void setObject(QObject *);
@@ -75,10 +76,20 @@ public:
virtual ActionList actions();
};
+class QDeclarativePropertyChangesParser : public QDeclarativeCustomParser
+{
+public:
+ void compileList(QList<QPair<QByteArray, QVariant> > &list, const QByteArray &pre, const QDeclarativeCustomParserProperty &prop);
+
+ virtual QByteArray compile(const QList<QDeclarativeCustomParserProperty> &);
+ virtual void setCustomData(QObject *, const QByteArray &);
+};
+
+
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlPropertyChanges)
+QML_DECLARE_TYPE(QDeclarativePropertyChanges)
QT_END_HEADER
-#endif // QMLPROPERTYCHANGES_H
+#endif // QDECLARATIVEPROPERTYCHANGES_H
diff --git a/src/declarative/util/qmlpropertymap.cpp b/src/declarative/util/qdeclarativepropertymap.cpp
index 317896e..fcea515 100644
--- a/src/declarative/util/qmlpropertymap.cpp
+++ b/src/declarative/util/qdeclarativepropertymap.cpp
@@ -39,73 +39,73 @@
**
****************************************************************************/
-#include "qmlpropertymap.h"
+#include "qdeclarativepropertymap.h"
-#include "qmlopenmetaobject_p.h"
+#include "qdeclarativeopenmetaobject_p.h"
#include <QDebug>
QT_BEGIN_NAMESPACE
-//QmlPropertyMapMetaObject lets us listen for changes coming from QML
+//QDeclarativePropertyMapMetaObject lets us listen for changes coming from QML
//so we can emit the changed signal.
-class QmlPropertyMapMetaObject : public QmlOpenMetaObject
+class QDeclarativePropertyMapMetaObject : public QDeclarativeOpenMetaObject
{
public:
- QmlPropertyMapMetaObject(QmlPropertyMap *obj, QmlPropertyMapPrivate *objPriv);
+ QDeclarativePropertyMapMetaObject(QDeclarativePropertyMap *obj, QDeclarativePropertyMapPrivate *objPriv);
protected:
virtual void propertyWrite(int index);
private:
- QmlPropertyMap *map;
- QmlPropertyMapPrivate *priv;
+ QDeclarativePropertyMap *map;
+ QDeclarativePropertyMapPrivate *priv;
};
-class QmlPropertyMapPrivate : public QObjectPrivate
+class QDeclarativePropertyMapPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlPropertyMap)
+ Q_DECLARE_PUBLIC(QDeclarativePropertyMap)
public:
- QmlPropertyMapMetaObject *mo;
+ QDeclarativePropertyMapMetaObject *mo;
QStringList keys;
void emitChanged(const QString &key);
};
-void QmlPropertyMapPrivate::emitChanged(const QString &key)
+void QDeclarativePropertyMapPrivate::emitChanged(const QString &key)
{
- Q_Q(QmlPropertyMap);
+ Q_Q(QDeclarativePropertyMap);
emit q->valueChanged(key);
}
-QmlPropertyMapMetaObject::QmlPropertyMapMetaObject(QmlPropertyMap *obj, QmlPropertyMapPrivate *objPriv) : QmlOpenMetaObject(obj)
+QDeclarativePropertyMapMetaObject::QDeclarativePropertyMapMetaObject(QDeclarativePropertyMap *obj, QDeclarativePropertyMapPrivate *objPriv) : QDeclarativeOpenMetaObject(obj)
{
map = obj;
priv = objPriv;
}
-void QmlPropertyMapMetaObject::propertyWrite(int index)
+void QDeclarativePropertyMapMetaObject::propertyWrite(int index)
{
priv->emitChanged(QString::fromUtf8(name(index)));
}
/*!
- \class QmlPropertyMap
+ \class QDeclarativePropertyMap
\since 4.7
- \brief The QmlPropertyMap class allows you to set key-value pairs that can be used in bindings.
+ \brief The QDeclarativePropertyMap class allows you to set key-value pairs that can be used in bindings.
- QmlPropertyMap provides a convenient way to expose domain data to the UI layer.
+ QDeclarativePropertyMap provides a convenient way to expose domain data to the UI layer.
The following example shows how you might declare data in C++ and then
access it in QML.
Setup in C++:
\code
//create our data
- QmlPropertyMap ownerData;
+ QDeclarativePropertyMap ownerData;
ownerData.insert("name", QVariant(QString("John Smith")));
ownerData.insert("phone", QVariant(QString("555-5555")));
//expose it to the UI layer
- QmlContext *ctxt = view->bindContext();
+ QDeclarativeContext *ctxt = view->bindContext();
ctxt->setProperty("owner", &data);
\endcode
@@ -129,26 +129,26 @@ void QmlPropertyMapMetaObject::propertyWrite(int index)
/*!
Constructs a bindable map with parent object \a parent.
*/
-QmlPropertyMap::QmlPropertyMap(QObject *parent)
-: QObject(*(new QmlPropertyMapPrivate), parent)
+QDeclarativePropertyMap::QDeclarativePropertyMap(QObject *parent)
+: QObject(*(new QDeclarativePropertyMapPrivate), parent)
{
- Q_D(QmlPropertyMap);
- d->mo = new QmlPropertyMapMetaObject(this, d);
+ Q_D(QDeclarativePropertyMap);
+ d->mo = new QDeclarativePropertyMapMetaObject(this, d);
}
/*!
Destroys the bindable map.
*/
-QmlPropertyMap::~QmlPropertyMap()
+QDeclarativePropertyMap::~QDeclarativePropertyMap()
{
}
/*!
Clears the value (if any) associated with \a key.
*/
-void QmlPropertyMap::clear(const QString &key)
+void QDeclarativePropertyMap::clear(const QString &key)
{
- Q_D(QmlPropertyMap);
+ Q_D(QDeclarativePropertyMap);
d->mo->setValue(key.toUtf8(), QVariant());
}
@@ -158,9 +158,9 @@ void QmlPropertyMap::clear(const QString &key)
If no value has been set for this key (or if the value has been cleared),
an invalid QVariant is returned.
*/
-QVariant QmlPropertyMap::value(const QString &key) const
+QVariant QDeclarativePropertyMap::value(const QString &key) const
{
- Q_D(const QmlPropertyMap);
+ Q_D(const QDeclarativePropertyMap);
return d->mo->value(key.toUtf8());
}
@@ -169,9 +169,9 @@ QVariant QmlPropertyMap::value(const QString &key) const
If the key doesn't exist, it is automatically created.
*/
-void QmlPropertyMap::insert(const QString &key, const QVariant &value)
+void QDeclarativePropertyMap::insert(const QString &key, const QVariant &value)
{
- Q_D(QmlPropertyMap);
+ Q_D(QDeclarativePropertyMap);
if (!d->keys.contains(key))
d->keys.append(key);
d->mo->setValue(key.toUtf8(), value);
@@ -183,9 +183,9 @@ void QmlPropertyMap::insert(const QString &key, const QVariant &value)
Keys that have been cleared will still appear in this list, even though their
associated values are invalid QVariants.
*/
-QStringList QmlPropertyMap::keys() const
+QStringList QDeclarativePropertyMap::keys() const
{
- Q_D(const QmlPropertyMap);
+ Q_D(const QDeclarativePropertyMap);
return d->keys;
}
@@ -194,9 +194,9 @@ QStringList QmlPropertyMap::keys() const
Same as size().
*/
-int QmlPropertyMap::count() const
+int QDeclarativePropertyMap::count() const
{
- Q_D(const QmlPropertyMap);
+ Q_D(const QDeclarativePropertyMap);
return d->keys.count();
}
@@ -205,9 +205,9 @@ int QmlPropertyMap::count() const
\sa isEmpty(), count()
*/
-int QmlPropertyMap::size() const
+int QDeclarativePropertyMap::size() const
{
- Q_D(const QmlPropertyMap);
+ Q_D(const QDeclarativePropertyMap);
return d->keys.size();
}
@@ -217,9 +217,9 @@ int QmlPropertyMap::size() const
\sa size()
*/
-bool QmlPropertyMap::isEmpty() const
+bool QDeclarativePropertyMap::isEmpty() const
{
- Q_D(const QmlPropertyMap);
+ Q_D(const QDeclarativePropertyMap);
return d->keys.isEmpty();
}
@@ -228,9 +228,9 @@ bool QmlPropertyMap::isEmpty() const
\sa size()
*/
-bool QmlPropertyMap::contains(const QString &key) const
+bool QDeclarativePropertyMap::contains(const QString &key) const
{
- Q_D(const QmlPropertyMap);
+ Q_D(const QDeclarativePropertyMap);
return d->keys.contains(key);
}
@@ -244,10 +244,10 @@ bool QmlPropertyMap::contains(const QString &key) const
\sa insert(), value()
*/
-QVariant &QmlPropertyMap::operator[](const QString &key)
+QVariant &QDeclarativePropertyMap::operator[](const QString &key)
{
//### optimize
- Q_D(QmlPropertyMap);
+ Q_D(QDeclarativePropertyMap);
QByteArray utf8key = key.toUtf8();
if (!d->keys.contains(key)) {
d->keys.append(key);
@@ -262,13 +262,13 @@ QVariant &QmlPropertyMap::operator[](const QString &key)
Same as value().
*/
-const QVariant QmlPropertyMap::operator[](const QString &key) const
+const QVariant QDeclarativePropertyMap::operator[](const QString &key) const
{
return value(key);
}
/*!
- \fn void QmlPropertyMap::valueChanged(const QString &key)
+ \fn void QDeclarativePropertyMap::valueChanged(const QString &key)
This signal is emitted whenever one of the values in the map is changed. \a key
is the key corresponding to the value that was changed.
diff --git a/src/declarative/util/qmlpropertymap.h b/src/declarative/util/qdeclarativepropertymap.h
index a56ed0f..513089f 100644
--- a/src/declarative/util/qmlpropertymap.h
+++ b/src/declarative/util/qdeclarativepropertymap.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLPROPERTYMAP_H
-#define QMLPROPERTYMAP_H
+#ifndef QDECLARATIVEPROPERTYMAP_H
+#define QDECLARATIVEPROPERTYMAP_H
#include <QtCore/QObject>
#include <QtCore/QHash>
@@ -53,13 +53,13 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlPropertyMapPrivate;
-class Q_DECLARATIVE_EXPORT QmlPropertyMap : public QObject
+class QDeclarativePropertyMapPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativePropertyMap : public QObject
{
Q_OBJECT
public:
- QmlPropertyMap(QObject *parent = 0);
- virtual ~QmlPropertyMap();
+ QDeclarativePropertyMap(QObject *parent = 0);
+ virtual ~QDeclarativePropertyMap();
QVariant value(const QString &key) const;
void insert(const QString &key, const QVariant &value);
@@ -79,8 +79,8 @@ Q_SIGNALS:
void valueChanged(const QString &key);
private:
- Q_DECLARE_PRIVATE(QmlPropertyMap)
- Q_DISABLE_COPY(QmlPropertyMap)
+ Q_DECLARE_PRIVATE(QDeclarativePropertyMap)
+ Q_DISABLE_COPY(QDeclarativePropertyMap)
};
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlspringfollow.cpp b/src/declarative/util/qdeclarativespringfollow.cpp
index 6d4ecf2..012e6a0 100644
--- a/src/declarative/util/qmlspringfollow.cpp
+++ b/src/declarative/util/qdeclarativespringfollow.cpp
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#include "qmlspringfollow_p.h"
+#include "qdeclarativespringfollow_p.h"
-#include "qmlanimation_p_p.h"
+#include "qdeclarativeanimation_p_p.h"
#include <QtCore/qdebug.h>
@@ -52,18 +52,18 @@
QT_BEGIN_NAMESPACE
-QML_DEFINE_TYPE(Qt,4,6,SpringFollow,QmlSpringFollow)
-class QmlSpringFollowPrivate : public QObjectPrivate
+
+class QDeclarativeSpringFollowPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlSpringFollow)
+ Q_DECLARE_PUBLIC(QDeclarativeSpringFollow)
public:
- QmlSpringFollowPrivate()
+ QDeclarativeSpringFollowPrivate()
: currentValue(0), sourceValue(0), maxVelocity(0), lastTime(0)
, mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.01)
, modulus(0.0), useMass(false), haveModulus(false), enabled(true), mode(Track), clock(this) {}
- QmlMetaProperty property;
+ QDeclarativeProperty property;
qreal currentValue;
qreal sourceValue;
qreal maxVelocity;
@@ -92,12 +92,12 @@ public:
void start();
void stop();
- QTickAnimationProxy<QmlSpringFollowPrivate, &QmlSpringFollowPrivate::tick> clock;
+ QTickAnimationProxy<QDeclarativeSpringFollowPrivate, &QDeclarativeSpringFollowPrivate::tick> clock;
};
-void QmlSpringFollowPrivate::tick(int time)
+void QDeclarativeSpringFollowPrivate::tick(int time)
{
- Q_Q(QmlSpringFollow);
+ Q_Q(QDeclarativeSpringFollow);
int elapsed = time - lastTime;
if (!elapsed)
@@ -179,7 +179,7 @@ void QmlSpringFollowPrivate::tick(int time)
emit q->syncChanged();
}
-void QmlSpringFollowPrivate::updateMode()
+void QDeclarativeSpringFollowPrivate::updateMode()
{
if (spring == 0. && maxVelocity == 0.)
mode = Track;
@@ -189,13 +189,13 @@ void QmlSpringFollowPrivate::updateMode()
mode = Velocity;
}
-void QmlSpringFollowPrivate::start()
+void QDeclarativeSpringFollowPrivate::start()
{
if (!enabled)
return;
- Q_Q(QmlSpringFollow);
- if (mode == QmlSpringFollowPrivate::Track) {
+ Q_Q(QDeclarativeSpringFollow);
+ if (mode == QDeclarativeSpringFollowPrivate::Track) {
currentValue = sourceValue;
property.write(currentValue);
} else if (sourceValue != currentValue && clock.state() != QAbstractAnimation::Running) {
@@ -206,13 +206,13 @@ void QmlSpringFollowPrivate::start()
}
}
-void QmlSpringFollowPrivate::stop()
+void QDeclarativeSpringFollowPrivate::stop()
{
clock.stop();
}
/*!
- \qmlclass SpringFollow QmlSpringFollow
+ \qmlclass SpringFollow QDeclarativeSpringFollow
\brief The SpringFollow element allows a property to track a value.
In example below, \e rect2 will follow \e rect1 moving with a velocity of up to 200:
@@ -245,25 +245,25 @@ void QmlSpringFollowPrivate::stop()
\sa EaseFollow
*/
-QmlSpringFollow::QmlSpringFollow(QObject *parent)
-: QObject(*(new QmlSpringFollowPrivate),parent)
+QDeclarativeSpringFollow::QDeclarativeSpringFollow(QObject *parent)
+: QObject(*(new QDeclarativeSpringFollowPrivate),parent)
{
}
-QmlSpringFollow::~QmlSpringFollow()
+QDeclarativeSpringFollow::~QDeclarativeSpringFollow()
{
}
-void QmlSpringFollow::setTarget(const QmlMetaProperty &property)
+void QDeclarativeSpringFollow::setTarget(const QDeclarativeProperty &property)
{
- Q_D(QmlSpringFollow);
+ Q_D(QDeclarativeSpringFollow);
d->property = property;
d->currentValue = property.read().toReal();
}
-qreal QmlSpringFollow::sourceValue() const
+qreal QDeclarativeSpringFollow::sourceValue() const
{
- Q_D(const QmlSpringFollow);
+ Q_D(const QDeclarativeSpringFollow);
return d->sourceValue;
}
@@ -274,9 +274,9 @@ qreal QmlSpringFollow::sourceValue() const
Bind to a property in order to track its changes.
*/
-void QmlSpringFollow::setSourceValue(qreal value)
+void QDeclarativeSpringFollow::setSourceValue(qreal value)
{
- Q_D(QmlSpringFollow);
+ Q_D(QDeclarativeSpringFollow);
if (d->clock.state() == QAbstractAnimation::Running && d->sourceValue == value)
return;
@@ -289,15 +289,15 @@ void QmlSpringFollow::setSourceValue(qreal value)
This property holds the maximum velocity allowed when tracking the source.
*/
-qreal QmlSpringFollow::velocity() const
+qreal QDeclarativeSpringFollow::velocity() const
{
- Q_D(const QmlSpringFollow);
+ Q_D(const QDeclarativeSpringFollow);
return d->maxVelocity;
}
-void QmlSpringFollow::setVelocity(qreal velocity)
+void QDeclarativeSpringFollow::setVelocity(qreal velocity)
{
- Q_D(QmlSpringFollow);
+ Q_D(QDeclarativeSpringFollow);
d->maxVelocity = velocity;
d->velocityms = velocity / 1000.0;
d->updateMode();
@@ -313,15 +313,15 @@ void QmlSpringFollow::setVelocity(qreal velocity)
When a spring constant is set and the velocity property is greater than 0,
velocity limits the maximum speed.
*/
-qreal QmlSpringFollow::spring() const
+qreal QDeclarativeSpringFollow::spring() const
{
- Q_D(const QmlSpringFollow);
+ Q_D(const QDeclarativeSpringFollow);
return d->spring;
}
-void QmlSpringFollow::setSpring(qreal spring)
+void QDeclarativeSpringFollow::setSpring(qreal spring)
{
- Q_D(QmlSpringFollow);
+ Q_D(QDeclarativeSpringFollow);
d->spring = spring;
d->updateMode();
}
@@ -333,15 +333,15 @@ void QmlSpringFollow::setSpring(qreal spring)
The damping constant describes how quickly a sprung follower comes to rest.
Useful range is 0 - 1.0
*/
-qreal QmlSpringFollow::damping() const
+qreal QDeclarativeSpringFollow::damping() const
{
- Q_D(const QmlSpringFollow);
+ Q_D(const QDeclarativeSpringFollow);
return d->damping;
}
-void QmlSpringFollow::setDamping(qreal damping)
+void QDeclarativeSpringFollow::setDamping(qreal damping)
{
- Q_D(QmlSpringFollow);
+ Q_D(QDeclarativeSpringFollow);
if (damping > 1.)
damping = 1.;
@@ -359,15 +359,15 @@ void QmlSpringFollow::setDamping(qreal damping)
The default is 0.01. Tuning this value can provide small performance improvements.
*/
-qreal QmlSpringFollow::epsilon() const
+qreal QDeclarativeSpringFollow::epsilon() const
{
- Q_D(const QmlSpringFollow);
+ Q_D(const QDeclarativeSpringFollow);
return d->epsilon;
}
-void QmlSpringFollow::setEpsilon(qreal epsilon)
+void QDeclarativeSpringFollow::setEpsilon(qreal epsilon)
{
- Q_D(QmlSpringFollow);
+ Q_D(QDeclarativeSpringFollow);
d->epsilon = epsilon;
}
@@ -378,15 +378,15 @@ void QmlSpringFollow::setEpsilon(qreal epsilon)
Setting a \a modulus forces the target value to "wrap around" at the modulus.
For example, setting the modulus to 360 will cause a value of 370 to wrap around to 10.
*/
-qreal QmlSpringFollow::modulus() const
+qreal QDeclarativeSpringFollow::modulus() const
{
- Q_D(const QmlSpringFollow);
+ Q_D(const QDeclarativeSpringFollow);
return d->modulus;
}
-void QmlSpringFollow::setModulus(qreal modulus)
+void QDeclarativeSpringFollow::setModulus(qreal modulus)
{
- Q_D(QmlSpringFollow);
+ Q_D(QDeclarativeSpringFollow);
if (d->modulus != modulus) {
d->haveModulus = modulus != 0.0;
d->modulus = modulus;
@@ -401,15 +401,15 @@ void QmlSpringFollow::setModulus(qreal modulus)
mass is 1.0 by default. Setting a different mass changes the dynamics of
a \l spring follow.
*/
-qreal QmlSpringFollow::mass() const
+qreal QDeclarativeSpringFollow::mass() const
{
- Q_D(const QmlSpringFollow);
+ Q_D(const QDeclarativeSpringFollow);
return d->mass;
}
-void QmlSpringFollow::setMass(qreal mass)
+void QDeclarativeSpringFollow::setMass(qreal mass)
{
- Q_D(QmlSpringFollow);
+ Q_D(QDeclarativeSpringFollow);
if (d->mass != mass && mass > 0.0) {
d->useMass = mass != 1.0;
d->mass = mass;
@@ -426,15 +426,15 @@ void QmlSpringFollow::setMass(qreal mass)
\qmlproperty bool SpringFollow::enabled
This property holds whether the target will track the source.
*/
-bool QmlSpringFollow::enabled() const
+bool QDeclarativeSpringFollow::enabled() const
{
- Q_D(const QmlSpringFollow);
+ Q_D(const QDeclarativeSpringFollow);
return d->enabled;
}
-void QmlSpringFollow::setEnabled(bool enabled)
+void QDeclarativeSpringFollow::setEnabled(bool enabled)
{
- Q_D(QmlSpringFollow);
+ Q_D(QDeclarativeSpringFollow);
d->enabled = enabled;
if (enabled)
d->start();
@@ -449,15 +449,15 @@ void QmlSpringFollow::setEnabled(bool enabled)
If \l enabled is false then inSync will also be false.
*/
-bool QmlSpringFollow::inSync() const
+bool QDeclarativeSpringFollow::inSync() const
{
- Q_D(const QmlSpringFollow);
+ Q_D(const QDeclarativeSpringFollow);
return d->enabled && d->clock.state() != QAbstractAnimation::Running;
}
-qreal QmlSpringFollow::value() const
+qreal QDeclarativeSpringFollow::value() const
{
- Q_D(const QmlSpringFollow);
+ Q_D(const QDeclarativeSpringFollow);
return d->currentValue;
}
diff --git a/src/declarative/util/qmlspringfollow_p.h b/src/declarative/util/qdeclarativespringfollow_p.h
index 4a0ed1c..2ac0d82 100644
--- a/src/declarative/util/qmlspringfollow_p.h
+++ b/src/declarative/util/qdeclarativespringfollow_p.h
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#ifndef QMLSMOOTHFOLLOW_H
-#define QMLSMOOTHFOLLOW_H
+#ifndef QDECLARATIVESMOOTHFOLLOW_H
+#define QDECLARATIVESMOOTHFOLLOW_H
-#include <qmlpropertyvaluesource.h>
-#include <qml.h>
+#include <qdeclarativepropertyvaluesource.h>
+#include <qdeclarative.h>
QT_BEGIN_HEADER
@@ -51,13 +51,13 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlSpringFollowPrivate;
-class Q_DECLARATIVE_EXPORT QmlSpringFollow : public QObject,
- public QmlPropertyValueSource
+class QDeclarativeSpringFollowPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeSpringFollow : public QObject,
+ public QDeclarativePropertyValueSource
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlSpringFollow)
- Q_INTERFACES(QmlPropertyValueSource)
+ Q_DECLARE_PRIVATE(QDeclarativeSpringFollow)
+ Q_INTERFACES(QDeclarativePropertyValueSource)
Q_PROPERTY(qreal source READ sourceValue WRITE setSourceValue)
Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity)
@@ -71,10 +71,10 @@ class Q_DECLARATIVE_EXPORT QmlSpringFollow : public QObject,
Q_PROPERTY(bool inSync READ inSync NOTIFY syncChanged)
public:
- QmlSpringFollow(QObject *parent=0);
- ~QmlSpringFollow();
+ QDeclarativeSpringFollow(QObject *parent=0);
+ ~QDeclarativeSpringFollow();
- virtual void setTarget(const QmlMetaProperty &);
+ virtual void setTarget(const QDeclarativeProperty &);
qreal sourceValue() const;
void setSourceValue(qreal value);
@@ -105,8 +105,8 @@ Q_SIGNALS:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlSpringFollow)
+QML_DECLARE_TYPE(QDeclarativeSpringFollow)
QT_END_HEADER
-#endif // QMLSMOOTHFOLLOW_H
+#endif // QDECLARATIVESMOOTHFOLLOW_H
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qdeclarativestate.cpp
index c743e0b..1d70d33 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qdeclarativestate.cpp
@@ -39,17 +39,17 @@
**
****************************************************************************/
-#include "qmlstate_p_p.h"
-#include "qmlstate_p.h"
+#include "qdeclarativestate_p_p.h"
+#include "qdeclarativestate_p.h"
-#include "qmltransition_p.h"
-#include "qmlstategroup_p.h"
-#include "qmlstateoperations_p.h"
-#include "qmlanimation_p.h"
-#include "qmlanimation_p_p.h"
+#include "qdeclarativetransition_p.h"
+#include "qdeclarativestategroup_p.h"
+#include "qdeclarativestateoperations_p.h"
+#include "qdeclarativeanimation_p.h"
+#include "qdeclarativeanimation_p_p.h"
-#include <qmlbinding.h>
-#include <qmlglobal_p.h>
+#include <qdeclarativebinding_p.h>
+#include <qdeclarativeglobal_p.h>
#include <QtCore/qdebug.h>
@@ -57,64 +57,64 @@ QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG);
-QmlAction::QmlAction()
+QDeclarativeAction::QDeclarativeAction()
: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(0), toBinding(0), event(0),
specifiedObject(0)
{
}
-QmlAction::QmlAction(QObject *target, const QString &propertyName,
+QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyName,
const QVariant &value)
-: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), toValue(value), fromBinding(0),
- toBinding(0), event(0), specifiedObject(target),
- specifiedProperty(propertyName)
+: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false),
+ property(target, propertyName), toValue(value),
+ fromBinding(0), toBinding(0), event(0),
+ specifiedObject(target), specifiedProperty(propertyName)
{
- property = QmlMetaProperty::createProperty(target, propertyName);
if (property.isValid())
fromValue = property.read();
}
-QmlActionEvent::~QmlActionEvent()
+QDeclarativeActionEvent::~QDeclarativeActionEvent()
{
}
-QString QmlActionEvent::typeName() const
+QString QDeclarativeActionEvent::typeName() const
{
return QString();
}
-void QmlActionEvent::execute()
+void QDeclarativeActionEvent::execute()
{
}
-bool QmlActionEvent::isReversable()
+bool QDeclarativeActionEvent::isReversable()
{
return false;
}
-void QmlActionEvent::reverse()
+void QDeclarativeActionEvent::reverse()
{
}
-QList<QmlAction> QmlActionEvent::extraActions()
+QList<QDeclarativeAction> QDeclarativeActionEvent::extraActions()
{
- return QList<QmlAction>();
+ return QList<QDeclarativeAction>();
}
-bool QmlActionEvent::changesBindings()
+bool QDeclarativeActionEvent::changesBindings()
{
return false;
}
-void QmlActionEvent::clearForwardBindings()
+void QDeclarativeActionEvent::clearForwardBindings()
{
}
-void QmlActionEvent::clearReverseBindings()
+void QDeclarativeActionEvent::clearReverseBindings()
{
}
-bool QmlActionEvent::override(QmlActionEvent *other)
+bool QDeclarativeActionEvent::override(QDeclarativeActionEvent *other)
{
Q_UNUSED(other);
return false;
@@ -123,13 +123,13 @@ bool QmlActionEvent::override(QmlActionEvent *other)
/*!
\internal
*/
-QmlStateOperation::QmlStateOperation(QObjectPrivate &dd, QObject *parent)
+QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObject *parent)
: QObject(dd, parent)
{
}
/*!
- \qmlclass State QmlState
+ \qmlclass State QDeclarativeState
\since 4.7
\brief The State element defines configurations of objects and properties.
@@ -144,28 +144,28 @@ QmlStateOperation::QmlStateOperation(QObjectPrivate &dd, QObject *parent)
/*!
\internal
- \class QmlState
- \brief The QmlState class allows you to define configurations of objects and properties.
+ \class QDeclarativeState
+ \brief The QDeclarativeState class allows you to define configurations of objects and properties.
\ingroup group_states
- QmlState allows you to specify a state as a set of batched changes from the default
+ QDeclarativeState allows you to specify a state as a set of batched changes from the default
configuration.
\sa {states-transitions}{States and Transitions}
*/
-QML_DEFINE_TYPE(Qt,4,6,State,QmlState)
-QmlState::QmlState(QObject *parent)
-: QObject(*(new QmlStatePrivate), parent)
+
+QDeclarativeState::QDeclarativeState(QObject *parent)
+: QObject(*(new QDeclarativeStatePrivate), parent)
{
- Q_D(QmlState);
+ Q_D(QDeclarativeState);
d->transitionManager.setState(this);
}
-QmlState::~QmlState()
+QDeclarativeState::~QDeclarativeState()
{
- Q_D(QmlState);
+ Q_D(QDeclarativeState);
if (d->group)
d->group->removeState(this);
}
@@ -176,21 +176,21 @@ QmlState::~QmlState()
Each state should have a unique name.
*/
-QString QmlState::name() const
+QString QDeclarativeState::name() const
{
- Q_D(const QmlState);
+ Q_D(const QDeclarativeState);
return d->name;
}
-void QmlState::setName(const QString &n)
+void QDeclarativeState::setName(const QString &n)
{
- Q_D(QmlState);
+ Q_D(QDeclarativeState);
d->name = n;
}
-bool QmlState::isWhenKnown() const
+bool QDeclarativeState::isWhenKnown() const
{
- Q_D(const QmlState);
+ Q_D(const QDeclarativeState);
return d->when != 0;
}
@@ -201,15 +201,15 @@ bool QmlState::isWhenKnown() const
This should be set to an expression that evaluates to true when you want the state to
be applied.
*/
-QmlBinding *QmlState::when() const
+QDeclarativeBinding *QDeclarativeState::when() const
{
- Q_D(const QmlState);
+ Q_D(const QDeclarativeState);
return d->when;
}
-void QmlState::setWhen(QmlBinding *when)
+void QDeclarativeState::setWhen(QDeclarativeBinding *when)
{
- Q_D(QmlState);
+ Q_D(QDeclarativeState);
d->when = when;
if (d->group)
d->group->updateAutoState();
@@ -222,15 +222,15 @@ void QmlState::setWhen(QmlBinding *when)
The state being extended is treated as the base state in regards to
the changes specified by the extending state.
*/
-QString QmlState::extends() const
+QString QDeclarativeState::extends() const
{
- Q_D(const QmlState);
+ Q_D(const QDeclarativeState);
return d->extends;
}
-void QmlState::setExtends(const QString &extends)
+void QDeclarativeState::setExtends(const QString &extends)
{
- Q_D(QmlState);
+ Q_D(QDeclarativeState);
d->extends = extends;
}
@@ -243,36 +243,36 @@ void QmlState::setExtends(const QString &extends)
extends another state, then the changes are applied against the state being
extended.
*/
-QmlListProperty<QmlStateOperation> QmlState::changes()
+QDeclarativeListProperty<QDeclarativeStateOperation> QDeclarativeState::changes()
{
- Q_D(QmlState);
- return QmlListProperty<QmlStateOperation>(this, &d->operations, QmlStatePrivate::operations_append,
- QmlStatePrivate::operations_count, QmlStatePrivate::operations_at,
- QmlStatePrivate::operations_clear);
+ Q_D(QDeclarativeState);
+ return QDeclarativeListProperty<QDeclarativeStateOperation>(this, &d->operations, QDeclarativeStatePrivate::operations_append,
+ QDeclarativeStatePrivate::operations_count, QDeclarativeStatePrivate::operations_at,
+ QDeclarativeStatePrivate::operations_clear);
}
-int QmlState::operationCount() const
+int QDeclarativeState::operationCount() const
{
- Q_D(const QmlState);
+ Q_D(const QDeclarativeState);
return d->operations.count();
}
-QmlStateOperation *QmlState::operationAt(int index) const
+QDeclarativeStateOperation *QDeclarativeState::operationAt(int index) const
{
- Q_D(const QmlState);
+ Q_D(const QDeclarativeState);
return d->operations.at(index);
}
-QmlState &QmlState::operator<<(QmlStateOperation *op)
+QDeclarativeState &QDeclarativeState::operator<<(QDeclarativeStateOperation *op)
{
- Q_D(QmlState);
- d->operations.append(QmlStatePrivate::OperationGuard(op, &d->operations));
+ Q_D(QDeclarativeState);
+ d->operations.append(QDeclarativeStatePrivate::OperationGuard(op, &d->operations));
return *this;
}
-void QmlStatePrivate::complete()
+void QDeclarativeStatePrivate::complete()
{
- Q_Q(QmlState);
+ Q_Q(QDeclarativeState);
for (int ii = 0; ii < reverting.count(); ++ii) {
for (int jj = 0; jj < revertList.count(); ++jj) {
@@ -289,10 +289,10 @@ void QmlStatePrivate::complete()
// Generate a list of actions for this state. This includes coelescing state
// actions that this state "extends"
-QmlStateOperation::ActionList
-QmlStatePrivate::generateActionList(QmlStateGroup *group) const
+QDeclarativeStateOperation::ActionList
+QDeclarativeStatePrivate::generateActionList(QDeclarativeStateGroup *group) const
{
- QmlStateOperation::ActionList applyList;
+ QDeclarativeStateOperation::ActionList applyList;
if (inState)
return applyList;
@@ -300,49 +300,49 @@ QmlStatePrivate::generateActionList(QmlStateGroup *group) const
inState = true;
if (!extends.isEmpty()) {
- QList<QmlState *> states = group->states();
+ QList<QDeclarativeState *> states = group->states();
for (int ii = 0; ii < states.count(); ++ii)
if (states.at(ii)->name() == extends)
- applyList = static_cast<QmlStatePrivate*>(states.at(ii)->d_func())->generateActionList(group);
+ applyList = static_cast<QDeclarativeStatePrivate*>(states.at(ii)->d_func())->generateActionList(group);
}
- foreach(QmlStateOperation *op, operations)
+ foreach(QDeclarativeStateOperation *op, operations)
applyList << op->actions();
inState = false;
return applyList;
}
-QmlStateGroup *QmlState::stateGroup() const
+QDeclarativeStateGroup *QDeclarativeState::stateGroup() const
{
- Q_D(const QmlState);
+ Q_D(const QDeclarativeState);
return d->group;
}
-void QmlState::setStateGroup(QmlStateGroup *group)
+void QDeclarativeState::setStateGroup(QDeclarativeStateGroup *group)
{
- Q_D(QmlState);
+ Q_D(QDeclarativeState);
d->group = group;
}
-void QmlState::cancel()
+void QDeclarativeState::cancel()
{
- Q_D(QmlState);
+ Q_D(QDeclarativeState);
d->transitionManager.cancel();
}
-void QmlAction::deleteFromBinding()
+void QDeclarativeAction::deleteFromBinding()
{
if (fromBinding) {
- property.setBinding(0);
+ QDeclarativePropertyPrivate::setBinding(property, 0);
fromBinding->destroy();
fromBinding = 0;
}
}
-void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *revert)
+void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransition *trans, QDeclarativeState *revert)
{
- Q_D(QmlState);
+ Q_D(QDeclarativeState);
qmlExecuteDeferred(this);
@@ -353,20 +353,20 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
d->reverting.clear();
if (revert) {
- QmlStatePrivate *revertPrivate =
- static_cast<QmlStatePrivate*>(revert->d_func());
+ QDeclarativeStatePrivate *revertPrivate =
+ static_cast<QDeclarativeStatePrivate*>(revert->d_func());
d->revertList = revertPrivate->revertList;
revertPrivate->revertList.clear();
}
// List of actions caused by this state
- QmlStateOperation::ActionList applyList = d->generateActionList(group);
+ QDeclarativeStateOperation::ActionList applyList = d->generateActionList(group);
// List of actions that need to be reverted to roll back (just) this state
- QmlStatePrivate::SimpleActionList additionalReverts;
+ QDeclarativeStatePrivate::SimpleActionList additionalReverts;
// First add the reverse of all the applyList actions
for (int ii = 0; ii < applyList.count(); ++ii) {
- QmlAction &action = applyList[ii];
+ QDeclarativeAction &action = applyList[ii];
bool found = false;
@@ -375,7 +375,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
if (!action.event->isReversable())
continue;
for (jj = 0; jj < d->revertList.count(); ++jj) {
- QmlActionEvent *event = d->revertList.at(jj).event;
+ QDeclarativeActionEvent *event = d->revertList.at(jj).event;
if (event && event->typeName() == action.event->typeName()) {
if (action.event->override(event)) {
found = true;
@@ -388,7 +388,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
else if (action.event->isRewindable())
action.event->saveCurrentValues();
} else {
- action.fromBinding = action.property.binding();
+ action.fromBinding = QDeclarativePropertyPrivate::binding(action.property);
for (jj = 0; jj < d->revertList.count(); ++jj) {
if (d->revertList.at(jj).property == action.property) {
@@ -404,7 +404,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
} else {
// Only need to revert the applyList action if the previous
// state doesn't have a higher priority revert already
- QmlSimpleAction r(action);
+ QDeclarativeSimpleAction r(action);
additionalReverts << r;
}
} else if (d->revertList.at(jj).binding != action.fromBinding) {
@@ -417,11 +417,11 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
for (int ii = 0; ii < d->revertList.count(); ++ii) {
bool found = false;
if (d->revertList.at(ii).event) {
- QmlActionEvent *event = d->revertList.at(ii).event;
+ QDeclarativeActionEvent *event = d->revertList.at(ii).event;
if (!event->isReversable())
continue;
for (int jj = 0; !found && jj < applyList.count(); ++jj) {
- const QmlAction &action = applyList.at(jj);
+ const QDeclarativeAction &action = applyList.at(jj);
if (action.event && action.event->typeName() == event->typeName()) {
if (action.event->override(event))
found = true;
@@ -429,18 +429,19 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
}
} else {
for (int jj = 0; !found && jj < applyList.count(); ++jj) {
- const QmlAction &action = applyList.at(jj);
+ const QDeclarativeAction &action = applyList.at(jj);
if (action.property == d->revertList.at(ii).property)
found = true;
}
}
if (!found) {
QVariant cur = d->revertList.at(ii).property.read();
- QmlAbstractBinding *delBinding = d->revertList.at(ii).property.setBinding(0);
+ QDeclarativeAbstractBinding *delBinding =
+ QDeclarativePropertyPrivate::setBinding(d->revertList.at(ii).property, 0);
if (delBinding)
delBinding->destroy();
- QmlAction a;
+ QDeclarativeAction a;
a.property = d->revertList.at(ii).property;
a.fromValue = cur;
a.toValue = d->revertList.at(ii).value;
@@ -461,11 +462,11 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
// Output for debugging
if (stateChangeDebug()) {
- foreach(const QmlAction &action, applyList) {
+ foreach(const QDeclarativeAction &action, applyList) {
if (action.event)
- qWarning() << " QmlAction event:" << action.event->typeName();
+ qWarning() << " QDeclarativeAction event:" << action.event->typeName();
else
- qWarning() << " QmlAction:" << action.property.object()
+ qWarning() << " QDeclarativeAction:" << action.property.object()
<< action.property.name() << "From:" << action.fromValue
<< "To:" << action.toValue;
}
@@ -474,8 +475,7 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
d->transitionManager.transition(applyList, trans);
}
-QML_DEFINE_NOCREATE_TYPE(QmlStateOperation)
-QmlStateOperation::ActionList QmlStateOperation::actions()
+QDeclarativeStateOperation::ActionList QDeclarativeStateOperation::actions()
{
return ActionList();
}
diff --git a/src/declarative/util/qmlstate_p.h b/src/declarative/util/qdeclarativestate_p.h
index 2c92387..0c6e7a3 100644
--- a/src/declarative/util/qmlstate_p.h
+++ b/src/declarative/util/qdeclarativestate_p.h
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#ifndef QMLSTATE_H
-#define QMLSTATE_H
-
-#include <qml.h>
+#ifndef QDECLARATIVESTATE_H
+#define QDECLARATIVESTATE_H
+#include <qdeclarative.h>
+#include <qdeclarativeproperty.h>
#include <QtCore/qobject.h>
QT_BEGIN_HEADER
@@ -52,26 +52,28 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlActionEvent;
-class QmlBinding;
-class Q_DECLARATIVE_EXPORT QmlAction
+class QDeclarativeActionEvent;
+class QDeclarativeAbstractBinding;
+class QDeclarativeBinding;
+class QDeclarativeExpression;
+class Q_DECLARATIVE_EXPORT QDeclarativeAction
{
public:
- QmlAction();
- QmlAction(QObject *, const QString &, const QVariant &);
+ QDeclarativeAction();
+ QDeclarativeAction(QObject *, const QString &, const QVariant &);
bool restore:1;
bool actionDone:1;
bool reverseEvent:1;
bool deletableToBinding:1;
- QmlMetaProperty property;
+ QDeclarativeProperty property;
QVariant fromValue;
QVariant toValue;
- QmlAbstractBinding *fromBinding;
- QmlAbstractBinding *toBinding;
- QmlActionEvent *event;
+ QDeclarativeAbstractBinding *fromBinding;
+ QDeclarativeAbstractBinding *toBinding;
+ QDeclarativeActionEvent *event;
//strictly for matching
QObject *specifiedObject;
@@ -80,10 +82,10 @@ public:
void deleteFromBinding();
};
-class QmlActionEvent
+class QDeclarativeActionEvent
{
public:
- virtual ~QmlActionEvent();
+ virtual ~QDeclarativeActionEvent();
virtual QString typeName() const;
virtual void execute();
@@ -96,86 +98,86 @@ public:
virtual void saveCurrentValues() {}
//virtual bool hasExtraActions();
- virtual QList<QmlAction> extraActions();
+ virtual QList<QDeclarativeAction> extraActions();
virtual bool changesBindings();
virtual void clearForwardBindings();
virtual void clearReverseBindings();
- virtual bool override(QmlActionEvent*other);
+ virtual bool override(QDeclarativeActionEvent*other);
};
-//### rename to QmlStateChange?
-class QmlStateGroup;
-class Q_DECLARATIVE_EXPORT QmlStateOperation : public QObject
+//### rename to QDeclarativeStateChange?
+class QDeclarativeStateGroup;
+class Q_DECLARATIVE_EXPORT QDeclarativeStateOperation : public QObject
{
Q_OBJECT
public:
- QmlStateOperation(QObject *parent = 0)
+ QDeclarativeStateOperation(QObject *parent = 0)
: QObject(parent) {}
- typedef QList<QmlAction> ActionList;
+ typedef QList<QDeclarativeAction> ActionList;
virtual ActionList actions();
protected:
- QmlStateOperation(QObjectPrivate &dd, QObject *parent = 0);
+ QDeclarativeStateOperation(QObjectPrivate &dd, QObject *parent = 0);
};
-typedef QmlStateOperation::ActionList QmlStateActions;
+typedef QDeclarativeStateOperation::ActionList QDeclarativeStateActions;
-class QmlTransition;
-class QmlStatePrivate;
-class Q_DECLARATIVE_EXPORT QmlState : public QObject
+class QDeclarativeTransition;
+class QDeclarativeStatePrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeState : public QObject
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(QmlBinding *when READ when WRITE setWhen)
+ Q_PROPERTY(QDeclarativeBinding *when READ when WRITE setWhen)
Q_PROPERTY(QString extend READ extends WRITE setExtends)
- Q_PROPERTY(QmlListProperty<QmlStateOperation> changes READ changes)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeStateOperation> changes READ changes)
Q_CLASSINFO("DefaultProperty", "changes")
Q_CLASSINFO("DeferredPropertyNames", "changes")
public:
- QmlState(QObject *parent=0);
- virtual ~QmlState();
+ QDeclarativeState(QObject *parent=0);
+ virtual ~QDeclarativeState();
QString name() const;
void setName(const QString &);
- /*'when' is a QmlBinding to limit state changes oscillation
+ /*'when' is a QDeclarativeBinding to limit state changes oscillation
due to the unpredictable order of evaluation of bound expressions*/
bool isWhenKnown() const;
- QmlBinding *when() const;
- void setWhen(QmlBinding *);
+ QDeclarativeBinding *when() const;
+ void setWhen(QDeclarativeBinding *);
QString extends() const;
void setExtends(const QString &);
- QmlListProperty<QmlStateOperation> changes();
+ QDeclarativeListProperty<QDeclarativeStateOperation> changes();
int operationCount() const;
- QmlStateOperation *operationAt(int) const;
+ QDeclarativeStateOperation *operationAt(int) const;
- QmlState &operator<<(QmlStateOperation *);
+ QDeclarativeState &operator<<(QDeclarativeStateOperation *);
- void apply(QmlStateGroup *, QmlTransition *, QmlState *revert);
+ void apply(QDeclarativeStateGroup *, QDeclarativeTransition *, QDeclarativeState *revert);
void cancel();
- QmlStateGroup *stateGroup() const;
- void setStateGroup(QmlStateGroup *);
+ QDeclarativeStateGroup *stateGroup() const;
+ void setStateGroup(QDeclarativeStateGroup *);
Q_SIGNALS:
void completed();
private:
- Q_DECLARE_PRIVATE(QmlState)
- Q_DISABLE_COPY(QmlState)
+ Q_DECLARE_PRIVATE(QDeclarativeState)
+ Q_DISABLE_COPY(QDeclarativeState)
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlStateOperation)
-QML_DECLARE_TYPE(QmlState)
+QML_DECLARE_TYPE(QDeclarativeStateOperation)
+QML_DECLARE_TYPE(QDeclarativeState)
QT_END_HEADER
-#endif // QMLSTATE_H
+#endif // QDECLARATIVESTATE_H
diff --git a/src/declarative/util/qmlstate_p_p.h b/src/declarative/util/qdeclarativestate_p_p.h
index d138e4e..6f52219 100644
--- a/src/declarative/util/qmlstate_p_p.h
+++ b/src/declarative/util/qdeclarativestate_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLSTATE_P_H
-#define QMLSTATE_P_H
+#ifndef QDECLARATIVESTATE_P_H
+#define QDECLARATIVESTATE_P_H
//
// W A R N I N G
@@ -53,22 +53,23 @@
// We mean it.
//
-#include "qmlstate_p.h"
+#include "qdeclarativestate_p.h"
-#include "qmlanimation_p_p.h"
-#include "qmltransitionmanager_p_p.h"
+#include "qdeclarativeanimation_p_p.h"
+#include "qdeclarativetransitionmanager_p_p.h"
-#include <qmlguard_p.h>
+#include <qdeclarativeproperty_p.h>
+#include <qdeclarativeguard_p.h>
#include <private/qobject_p.h>
QT_BEGIN_NAMESPACE
-class QmlSimpleAction
+class QDeclarativeSimpleAction
{
public:
enum State { StartState, EndState };
- QmlSimpleAction(const QmlAction &a, State state = StartState)
+ QDeclarativeSimpleAction(const QDeclarativeAction &a, State state = StartState)
{
property = a.property;
specifiedObject = a.specifiedObject;
@@ -76,7 +77,7 @@ public:
event = a.event;
if (state == StartState) {
value = a.fromValue;
- binding = property.binding();
+ binding = QDeclarativePropertyPrivate::binding(property);
reverseEvent = true;
} else {
value = a.toValue;
@@ -85,68 +86,68 @@ public:
}
}
- QmlMetaProperty property;
+ QDeclarativeProperty property;
QVariant value;
- QmlAbstractBinding *binding;
+ QDeclarativeAbstractBinding *binding;
QObject *specifiedObject;
QString specifiedProperty;
- QmlActionEvent *event;
+ QDeclarativeActionEvent *event;
bool reverseEvent;
};
-class QmlStatePrivate : public QObjectPrivate
+class QDeclarativeStatePrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlState)
+ Q_DECLARE_PUBLIC(QDeclarativeState)
public:
- QmlStatePrivate()
+ QDeclarativeStatePrivate()
: when(0), inState(false), group(0) {}
- typedef QList<QmlSimpleAction> SimpleActionList;
+ typedef QList<QDeclarativeSimpleAction> SimpleActionList;
QString name;
- QmlBinding *when;
+ QDeclarativeBinding *when;
- struct OperationGuard : public QmlGuard<QmlStateOperation>
+ struct OperationGuard : public QDeclarativeGuard<QDeclarativeStateOperation>
{
- OperationGuard(QObject *obj, QList<OperationGuard> *l) : list(l) { (QmlGuard<QObject>&)*this = obj; }
+ OperationGuard(QObject *obj, QList<OperationGuard> *l) : list(l) { (QDeclarativeGuard<QObject>&)*this = obj; }
QList<OperationGuard> *list;
- void objectDestroyed(QmlStateOperation *) {
+ void objectDestroyed(QDeclarativeStateOperation *) {
// we assume priv will always be destroyed after objectDestroyed calls
list->removeOne(*this);
}
};
QList<OperationGuard> operations;
- static void operations_append(QmlListProperty<QmlStateOperation> *prop, QmlStateOperation *op) {
+ static void operations_append(QDeclarativeListProperty<QDeclarativeStateOperation> *prop, QDeclarativeStateOperation *op) {
QList<OperationGuard> *list = static_cast<QList<OperationGuard> *>(prop->data);
list->append(OperationGuard(op, list));
}
- static void operations_clear(QmlListProperty<QmlStateOperation> *prop) {
+ static void operations_clear(QDeclarativeListProperty<QDeclarativeStateOperation> *prop) {
QList<OperationGuard> *list = static_cast<QList<OperationGuard> *>(prop->data);
list->clear();
}
- static int operations_count(QmlListProperty<QmlStateOperation> *prop) {
+ static int operations_count(QDeclarativeListProperty<QDeclarativeStateOperation> *prop) {
QList<OperationGuard> *list = static_cast<QList<OperationGuard> *>(prop->data);
return list->count();
}
- static QmlStateOperation *operations_at(QmlListProperty<QmlStateOperation> *prop, int index) {
+ static QDeclarativeStateOperation *operations_at(QDeclarativeListProperty<QDeclarativeStateOperation> *prop, int index) {
QList<OperationGuard> *list = static_cast<QList<OperationGuard> *>(prop->data);
return list->at(index);
}
- QmlTransitionManager transitionManager;
+ QDeclarativeTransitionManager transitionManager;
SimpleActionList revertList;
- QList<QmlMetaProperty> reverting;
+ QList<QDeclarativeProperty> reverting;
QString extends;
mutable bool inState;
- QmlStateGroup *group;
+ QDeclarativeStateGroup *group;
- QmlStateOperation::ActionList generateActionList(QmlStateGroup *) const;
+ QDeclarativeStateOperation::ActionList generateActionList(QDeclarativeStateGroup *) const;
void complete();
};
QT_END_NAMESPACE
-#endif // QMLSTATE_P_H
+#endif // QDECLARATIVESTATE_P_H
diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp
index 4ad77c8..1a7c256 100644
--- a/src/declarative/util/qmlstategroup.cpp
+++ b/src/declarative/util/qdeclarativestategroup.cpp
@@ -39,13 +39,13 @@
**
****************************************************************************/
-#include "qmlstategroup_p.h"
+#include "qdeclarativestategroup_p.h"
-#include "qmltransition_p.h"
-#include "qmlstate_p_p.h"
+#include "qdeclarativetransition_p.h"
+#include "qdeclarativestate_p_p.h"
-#include <qmlbinding.h>
-#include <qmlglobal_p.h>
+#include <qdeclarativebinding_p.h>
+#include <qdeclarativeglobal_p.h>
#include <QtCore/qdebug.h>
@@ -55,35 +55,35 @@ QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG);
-class QmlStateGroupPrivate : public QObjectPrivate
+class QDeclarativeStateGroupPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlStateGroup)
+ Q_DECLARE_PUBLIC(QDeclarativeStateGroup)
public:
- QmlStateGroupPrivate(QmlStateGroup *p)
+ QDeclarativeStateGroupPrivate()
: nullState(0), componentComplete(true),
ignoreTrans(false), applyingState(false) {}
QString currentState;
- QmlState *nullState;
+ QDeclarativeState *nullState;
- 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);
+ static void append_state(QDeclarativeListProperty<QDeclarativeState> *list, QDeclarativeState *state);
+ static int count_state(QDeclarativeListProperty<QDeclarativeState> *list);
+ static QDeclarativeState *at_state(QDeclarativeListProperty<QDeclarativeState> *list, int index);
- QList<QmlState *> states;
- QList<QmlTransition *> transitions;
+ QList<QDeclarativeState *> states;
+ QList<QDeclarativeTransition *> transitions;
bool componentComplete;
bool ignoreTrans;
bool applyingState;
- QmlTransition *findTransition(const QString &from, const QString &to);
+ QDeclarativeTransition *findTransition(const QString &from, const QString &to);
void setCurrentStateInternal(const QString &state, bool = false);
bool updateAutoState();
};
/*!
- \qmlclass StateGroup QmlStateGroup
+ \qmlclass StateGroup QDeclarativeStateGroup
\brief The StateGroup element provides state support for non-Item elements.
Item (and all dervied elements) provides built in support for states and transitions
@@ -110,21 +110,21 @@ public:
\sa {qmlstate}{States} {state-transitions}{Transitions}
*/
-QmlStateGroup::QmlStateGroup(QObject *parent)
- : QObject(*(new QmlStateGroupPrivate(this)), parent)
+QDeclarativeStateGroup::QDeclarativeStateGroup(QObject *parent)
+ : QObject(*(new QDeclarativeStateGroupPrivate), parent)
{
}
-QmlStateGroup::~QmlStateGroup()
+QDeclarativeStateGroup::~QDeclarativeStateGroup()
{
- Q_D(const QmlStateGroup);
+ Q_D(const QDeclarativeStateGroup);
for (int i = 0; i < d->states.count(); ++i)
d->states.at(i)->setStateGroup(0);
}
-QList<QmlState *> QmlStateGroup::states() const
+QList<QDeclarativeState *> QDeclarativeStateGroup::states() const
{
- Q_D(const QmlStateGroup);
+ Q_D(const QDeclarativeStateGroup);
return d->states;
}
@@ -144,17 +144,17 @@ QList<QmlState *> QmlStateGroup::states() const
\sa {qmlstate}{States}
*/
-QmlListProperty<QmlState> QmlStateGroup::statesProperty()
+QDeclarativeListProperty<QDeclarativeState> QDeclarativeStateGroup::statesProperty()
{
- Q_D(QmlStateGroup);
- return QmlListProperty<QmlState>(this, &d->states, &QmlStateGroupPrivate::append_state,
- &QmlStateGroupPrivate::count_state,
- &QmlStateGroupPrivate::at_state);
+ Q_D(QDeclarativeStateGroup);
+ return QDeclarativeListProperty<QDeclarativeState>(this, &d->states, &QDeclarativeStateGroupPrivate::append_state,
+ &QDeclarativeStateGroupPrivate::count_state,
+ &QDeclarativeStateGroupPrivate::at_state);
}
-void QmlStateGroupPrivate::append_state(QmlListProperty<QmlState> *list, QmlState *state)
+void QDeclarativeStateGroupPrivate::append_state(QDeclarativeListProperty<QDeclarativeState> *list, QDeclarativeState *state)
{
- QmlStateGroup *_this = static_cast<QmlStateGroup *>(list->object);
+ QDeclarativeStateGroup *_this = static_cast<QDeclarativeStateGroup *>(list->object);
if (state) {
_this->d_func()->states.append(state);
state->setStateGroup(_this);
@@ -162,15 +162,15 @@ void QmlStateGroupPrivate::append_state(QmlListProperty<QmlState> *list, QmlStat
}
-int QmlStateGroupPrivate::count_state(QmlListProperty<QmlState> *list)
+int QDeclarativeStateGroupPrivate::count_state(QDeclarativeListProperty<QDeclarativeState> *list)
{
- QmlStateGroup *_this = static_cast<QmlStateGroup *>(list->object);
+ QDeclarativeStateGroup *_this = static_cast<QDeclarativeStateGroup *>(list->object);
return _this->d_func()->states.count();
}
-QmlState *QmlStateGroupPrivate::at_state(QmlListProperty<QmlState> *list, int index)
+QDeclarativeState *QDeclarativeStateGroupPrivate::at_state(QDeclarativeListProperty<QDeclarativeState> *list, int index)
{
- QmlStateGroup *_this = static_cast<QmlStateGroup *>(list->object);
+ QDeclarativeStateGroup *_this = static_cast<QDeclarativeStateGroup *>(list->object);
return _this->d_func()->states.at(index);
}
@@ -190,10 +190,10 @@ QmlState *QmlStateGroupPrivate::at_state(QmlListProperty<QmlState> *list, int in
\sa {state-transitions}{Transitions}
*/
-QmlListProperty<QmlTransition> QmlStateGroup::transitionsProperty()
+QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeStateGroup::transitionsProperty()
{
- Q_D(QmlStateGroup);
- return QmlListProperty<QmlTransition>(this, d->transitions);
+ Q_D(QDeclarativeStateGroup);
+ return QDeclarativeListProperty<QDeclarativeTransition>(this, d->transitions);
}
/*!
@@ -221,30 +221,30 @@ QmlListProperty<QmlTransition> QmlStateGroup::transitionsProperty()
\sa {qmlstates}{States}
*/
-QString QmlStateGroup::state() const
+QString QDeclarativeStateGroup::state() const
{
- Q_D(const QmlStateGroup);
+ Q_D(const QDeclarativeStateGroup);
return d->currentState;
}
-void QmlStateGroup::setState(const QString &state)
+void QDeclarativeStateGroup::setState(const QString &state)
{
- Q_D(QmlStateGroup);
+ Q_D(QDeclarativeStateGroup);
if (d->currentState == state)
return;
d->setCurrentStateInternal(state);
}
-void QmlStateGroup::classBegin()
+void QDeclarativeStateGroup::classBegin()
{
- Q_D(QmlStateGroup);
+ Q_D(QDeclarativeStateGroup);
d->componentComplete = false;
}
-void QmlStateGroup::componentComplete()
+void QDeclarativeStateGroup::componentComplete()
{
- Q_D(QmlStateGroup);
+ Q_D(QDeclarativeStateGroup);
d->componentComplete = true;
if (d->updateAutoState()) {
@@ -259,21 +259,21 @@ void QmlStateGroup::componentComplete()
/*!
Returns true if the state was changed, otherwise false.
*/
-bool QmlStateGroup::updateAutoState()
+bool QDeclarativeStateGroup::updateAutoState()
{
- Q_D(QmlStateGroup);
+ Q_D(QDeclarativeStateGroup);
return d->updateAutoState();
}
-bool QmlStateGroupPrivate::updateAutoState()
+bool QDeclarativeStateGroupPrivate::updateAutoState()
{
- Q_Q(QmlStateGroup);
+ Q_Q(QDeclarativeStateGroup);
if (!componentComplete)
return false;
bool revert = false;
for (int ii = 0; ii < states.count(); ++ii) {
- QmlState *state = states.at(ii);
+ QDeclarativeState *state = states.at(ii);
if (state->isWhenKnown()) {
if (!state->name().isEmpty()) {
if (state->when() && state->when()->value().toBool()) {
@@ -301,15 +301,15 @@ bool QmlStateGroupPrivate::updateAutoState()
}
}
-QmlTransition *QmlStateGroupPrivate::findTransition(const QString &from, const QString &to)
+QDeclarativeTransition *QDeclarativeStateGroupPrivate::findTransition(const QString &from, const QString &to)
{
- QmlTransition *highest = 0;
+ QDeclarativeTransition *highest = 0;
int score = 0;
bool reversed = false;
bool done = false;
for (int ii = 0; !done && ii < transitions.count(); ++ii) {
- QmlTransition *t = transitions.at(ii);
+ QDeclarativeTransition *t = transitions.at(ii);
for (int ii = 0; ii < 2; ++ii)
{
if (ii && (!t->reversible() ||
@@ -360,10 +360,10 @@ QmlTransition *QmlStateGroupPrivate::findTransition(const QString &from, const Q
return highest;
}
-void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state,
+void QDeclarativeStateGroupPrivate::setCurrentStateInternal(const QString &state,
bool ignoreTrans)
{
- Q_Q(QmlStateGroup);
+ Q_Q(QDeclarativeStateGroup);
if (!componentComplete) {
currentState = state;
return;
@@ -376,7 +376,7 @@ void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state,
applyingState = true;
- QmlTransition *transition = (ignoreTrans || ignoreTrans) ? 0 : findTransition(currentState, state);
+ QDeclarativeTransition *transition = (ignoreTrans || ignoreTrans) ? 0 : findTransition(currentState, state);
if (stateChangeDebug()) {
qWarning() << this << "Changing state. From" << currentState << ". To" << state;
if (transition)
@@ -384,7 +384,7 @@ void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state,
<< transition->toState();
}
- QmlState *oldState = 0;
+ QDeclarativeState *oldState = 0;
if (!currentState.isEmpty()) {
for (int ii = 0; ii < states.count(); ++ii) {
if (states.at(ii)->name() == currentState) {
@@ -397,7 +397,7 @@ void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state,
currentState = state;
emit q->stateChanged(currentState);
- QmlState *newState = 0;
+ QDeclarativeState *newState = 0;
for (int ii = 0; ii < states.count(); ++ii) {
if (states.at(ii)->name() == currentState) {
newState = states.at(ii);
@@ -406,7 +406,7 @@ void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state,
}
if (oldState == 0 || newState == 0) {
- if (!nullState) { nullState = new QmlState; QmlGraphics_setParent_noEvent(nullState, q); }
+ if (!nullState) { nullState = new QDeclarativeState; QDeclarativeGraphics_setParent_noEvent(nullState, q); }
if (!oldState) oldState = nullState;
if (!newState) newState = nullState;
}
@@ -414,14 +414,14 @@ void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state,
newState->apply(q, transition, oldState);
applyingState = false;
if (!transition)
- static_cast<QmlStatePrivate*>(QObjectPrivate::get(newState))->complete();
+ static_cast<QDeclarativeStatePrivate*>(QObjectPrivate::get(newState))->complete();
}
-QmlState *QmlStateGroup::findState(const QString &name) const
+QDeclarativeState *QDeclarativeStateGroup::findState(const QString &name) const
{
- Q_D(const QmlStateGroup);
+ Q_D(const QDeclarativeStateGroup);
for (int i = 0; i < d->states.count(); ++i) {
- QmlState *state = d->states.at(i);
+ QDeclarativeState *state = d->states.at(i);
if (state->name() == name)
return state;
}
@@ -429,12 +429,12 @@ QmlState *QmlStateGroup::findState(const QString &name) const
return 0;
}
-void QmlStateGroup::removeState(QmlState *state)
+void QDeclarativeStateGroup::removeState(QDeclarativeState *state)
{
- Q_D(QmlStateGroup);
+ Q_D(QDeclarativeStateGroup);
d->states.removeOne(state);
}
QT_END_NAMESPACE
-QML_DEFINE_TYPE(Qt,4,6,StateGroup,QmlStateGroup)
+
diff --git a/src/declarative/util/qmlstategroup_p.h b/src/declarative/util/qdeclarativestategroup_p.h
index d39ca03..9650199 100644
--- a/src/declarative/util/qmlstategroup_p.h
+++ b/src/declarative/util/qdeclarativestategroup_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLSTATEGROUP_H
-#define QMLSTATEGROUP_H
+#ifndef QDECLARATIVESTATEGROUP_H
+#define QDECLARATIVESTATEGROUP_H
-#include "qmlstate_p.h"
+#include "qdeclarativestate_p.h"
QT_BEGIN_HEADER
@@ -50,30 +50,30 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlStateGroupPrivate;
-class Q_DECLARATIVE_EXPORT QmlStateGroup : public QObject, public QmlParserStatus
+class QDeclarativeStateGroupPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeStateGroup : public QObject, public QDeclarativeParserStatus
{
Q_OBJECT
- Q_INTERFACES(QmlParserStatus)
- Q_DECLARE_PRIVATE(QmlStateGroup)
+ Q_INTERFACES(QDeclarativeParserStatus)
+ Q_DECLARE_PRIVATE(QDeclarativeStateGroup)
Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged)
- Q_PROPERTY(QmlListProperty<QmlState> states READ statesProperty DESIGNABLE false)
- Q_PROPERTY(QmlListProperty<QmlTransition> transitions READ transitionsProperty DESIGNABLE false)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeState> states READ statesProperty DESIGNABLE false)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeTransition> transitions READ transitionsProperty DESIGNABLE false)
public:
- QmlStateGroup(QObject * = 0);
- virtual ~QmlStateGroup();
+ QDeclarativeStateGroup(QObject * = 0);
+ virtual ~QDeclarativeStateGroup();
QString state() const;
void setState(const QString &);
- QmlListProperty<QmlState> statesProperty();
- QList<QmlState *> states() const;
+ QDeclarativeListProperty<QDeclarativeState> statesProperty();
+ QList<QDeclarativeState *> states() const;
- QmlListProperty<QmlTransition> transitionsProperty();
+ QDeclarativeListProperty<QDeclarativeTransition> transitionsProperty();
- QmlState *findState(const QString &name) const;
+ QDeclarativeState *findState(const QString &name) const;
virtual void classBegin();
virtual void componentComplete();
@@ -81,15 +81,15 @@ Q_SIGNALS:
void stateChanged(const QString &);
private:
- friend class QmlState;
+ friend class QDeclarativeState;
bool updateAutoState();
- void removeState(QmlState *state);
+ void removeState(QDeclarativeState *state);
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlStateGroup)
+QML_DECLARE_TYPE(QDeclarativeStateGroup)
QT_END_HEADER
-#endif // QMLSTATEGROUP_H
+#endif // QDECLARATIVESTATEGROUP_H
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
new file mode 100644
index 0000000..cea9ad7
--- /dev/null
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -0,0 +1,989 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 "qdeclarativestateoperations_p.h"
+
+#include <qdeclarative.h>
+#include <qdeclarativecontext.h>
+#include <qdeclarativeexpression.h>
+#include <qdeclarativeinfo.h>
+#include <qdeclarativeanchors_p_p.h>
+#include <qdeclarativeitem_p.h>
+#include <qdeclarativeguard_p.h>
+#include <qdeclarativenullablevalue_p_p.h>
+
+#include <QtCore/qdebug.h>
+#include <QtGui/qgraphicsitem.h>
+#include <QtCore/qmath.h>
+
+#include <private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeParentChangePrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QDeclarativeParentChange)
+public:
+ QDeclarativeParentChangePrivate() : target(0), parent(0), origParent(0), origStackBefore(0),
+ rewindParent(0), rewindStackBefore(0) {}
+
+ QDeclarativeItem *target;
+ QDeclarativeItem *parent;
+ QDeclarativeGuard<QDeclarativeItem> origParent;
+ QDeclarativeGuard<QDeclarativeItem> origStackBefore;
+ QDeclarativeItem *rewindParent;
+ QDeclarativeItem *rewindStackBefore;
+
+ QDeclarativeNullableValue<qreal> x;
+ QDeclarativeNullableValue<qreal> y;
+ QDeclarativeNullableValue<qreal> width;
+ QDeclarativeNullableValue<qreal> height;
+ QDeclarativeNullableValue<qreal> scale;
+ QDeclarativeNullableValue<qreal> rotation;
+
+ void doChange(QDeclarativeItem *targetParent, QDeclarativeItem *stackBefore = 0);
+};
+
+void QDeclarativeParentChangePrivate::doChange(QDeclarativeItem *targetParent, QDeclarativeItem *stackBefore)
+{
+ if (targetParent && target && target->parentItem()) {
+ //### for backwards direction, can we just restore original x, y, scale, rotation
+ Q_Q(QDeclarativeParentChange);
+ bool ok;
+ const QTransform &transform = target->parentItem()->itemTransform(targetParent, &ok);
+ if (transform.type() >= QTransform::TxShear || !ok) {
+ qmlInfo(q) << QDeclarativeParentChange::tr("Unable to preserve appearance under complex transform");
+ ok = false;
+ }
+
+ qreal scale = 1;
+ qreal rotation = 0;
+ if (ok && transform.type() != QTransform::TxRotate) {
+ if (transform.m11() == transform.m22())
+ scale = transform.m11();
+ else {
+ qmlInfo(q) << QDeclarativeParentChange::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) << QDeclarativeParentChange::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) << QDeclarativeParentChange::tr("Unable to preserve appearance under scale of 0");
+ ok = false;
+ }
+ }
+
+ const QPointF &point = transform.map(QPointF(target->x(),target->y()));
+ qreal x = point.x();
+ qreal y = point.y();
+ if (ok && target->transformOrigin() != QDeclarativeItem::TopLeft) {
+ qreal tempxt = target->transformOriginPoint().x();
+ qreal tempyt = target->transformOriginPoint().y();
+ QTransform t;
+ t.translate(-tempxt, -tempyt);
+ t.rotate(rotation);
+ t.scale(scale, scale);
+ t.translate(tempxt, tempyt);
+ const QPointF &offset = t.map(QPointF(0,0));
+ x += offset.x();
+ y += offset.y();
+ }
+
+ target->setParentItem(targetParent);
+ if (ok) {
+ //qDebug() << x << y << rotation << scale;
+ target->setX(x);
+ target->setY(y);
+ target->setRotation(target->rotation() + rotation);
+ target->setScale(target->scale() * scale);
+ }
+ } else if (target) {
+ target->setParentItem(targetParent);
+ }
+
+ //restore the original stack position.
+ //### if stackBefore has also been reparented this won't work
+ if (stackBefore)
+ target->stackBefore(stackBefore);
+}
+
+/*!
+ \preliminary
+ \qmlclass ParentChange QDeclarativeParentChange
+ \brief The ParentChange element allows you to reparent an Item in a state change.
+
+ ParentChange reparents an Item while preserving its visual appearance (position, rotation,
+ and scale) on screen. You can then specify a transition to move/rotate/scale the Item to
+ its final intended appearance.
+
+ ParentChange can only preserve visual appearance if no complex transforms are involved.
+ More specifically, it will not work if the transform property has been set for any
+ Items involved in the reparenting (defined as any Items in the common ancestor tree
+ for the original and new parent).
+
+ You can specify at which point in a transition you want a ParentChange to occur by
+ using a ParentAction.
+*/
+
+
+QDeclarativeParentChange::QDeclarativeParentChange(QObject *parent)
+ : QDeclarativeStateOperation(*(new QDeclarativeParentChangePrivate), parent)
+{
+}
+
+QDeclarativeParentChange::~QDeclarativeParentChange()
+{
+}
+
+qreal QDeclarativeParentChange::x() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->x.isNull ? qreal(0.) : d->x.value;
+}
+
+void QDeclarativeParentChange::setX(qreal x)
+{
+ Q_D(QDeclarativeParentChange);
+ d->x = x;
+}
+
+bool QDeclarativeParentChange::xIsSet() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->x.isValid();
+}
+
+qreal QDeclarativeParentChange::y() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->y.isNull ? qreal(0.) : d->y.value;
+}
+
+void QDeclarativeParentChange::setY(qreal y)
+{
+ Q_D(QDeclarativeParentChange);
+ d->y = y;
+}
+
+bool QDeclarativeParentChange::yIsSet() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->y.isValid();
+}
+
+qreal QDeclarativeParentChange::width() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->width.isNull ? qreal(0.) : d->width.value;
+}
+
+void QDeclarativeParentChange::setWidth(qreal width)
+{
+ Q_D(QDeclarativeParentChange);
+ d->width = width;
+}
+
+bool QDeclarativeParentChange::widthIsSet() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->width.isValid();
+}
+
+qreal QDeclarativeParentChange::height() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->height.isNull ? qreal(0.) : d->height.value;
+}
+
+void QDeclarativeParentChange::setHeight(qreal height)
+{
+ Q_D(QDeclarativeParentChange);
+ d->height = height;
+}
+
+bool QDeclarativeParentChange::heightIsSet() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->height.isValid();
+}
+
+qreal QDeclarativeParentChange::scale() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->scale.isNull ? qreal(1.) : d->scale.value;
+}
+
+void QDeclarativeParentChange::setScale(qreal scale)
+{
+ Q_D(QDeclarativeParentChange);
+ d->scale = scale;
+}
+
+bool QDeclarativeParentChange::scaleIsSet() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->scale.isValid();
+}
+
+qreal QDeclarativeParentChange::rotation() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->rotation.isNull ? qreal(0.) : d->rotation.value;
+}
+
+void QDeclarativeParentChange::setRotation(qreal rotation)
+{
+ Q_D(QDeclarativeParentChange);
+ d->rotation = rotation;
+}
+
+bool QDeclarativeParentChange::rotationIsSet() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->rotation.isValid();
+}
+
+QDeclarativeItem *QDeclarativeParentChange::originalParent() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->origParent;
+}
+
+/*!
+ \qmlproperty Item ParentChange::target
+ This property holds the item to be reparented
+*/
+
+QDeclarativeItem *QDeclarativeParentChange::object() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->target;
+}
+
+void QDeclarativeParentChange::setObject(QDeclarativeItem *target)
+{
+ Q_D(QDeclarativeParentChange);
+ d->target = target;
+}
+
+/*!
+ \qmlproperty Item ParentChange::parent
+ This property holds the parent for the item in this state
+*/
+
+QDeclarativeItem *QDeclarativeParentChange::parent() const
+{
+ Q_D(const QDeclarativeParentChange);
+ return d->parent;
+}
+
+void QDeclarativeParentChange::setParent(QDeclarativeItem *parent)
+{
+ Q_D(QDeclarativeParentChange);
+ d->parent = parent;
+}
+
+QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions()
+{
+ Q_D(QDeclarativeParentChange);
+ if (!d->target || !d->parent)
+ return ActionList();
+
+ ActionList actions;
+
+ QDeclarativeAction a;
+ a.event = this;
+ actions << a;
+
+ if (d->x.isValid()) {
+ QDeclarativeAction xa(d->target, QLatin1String("x"), x());
+ actions << xa;
+ }
+
+ if (d->y.isValid()) {
+ QDeclarativeAction ya(d->target, QLatin1String("y"), y());
+ actions << ya;
+ }
+
+ if (d->scale.isValid()) {
+ QDeclarativeAction sa(d->target, QLatin1String("scale"), scale());
+ actions << sa;
+ }
+
+ if (d->rotation.isValid()) {
+ QDeclarativeAction ra(d->target, QLatin1String("rotation"), rotation());
+ actions << ra;
+ }
+
+ if (d->width.isValid()) {
+ QDeclarativeAction wa(d->target, QLatin1String("width"), width());
+ actions << wa;
+ }
+
+ if (d->height.isValid()) {
+ QDeclarativeAction ha(d->target, QLatin1String("height"), height());
+ actions << ha;
+ }
+
+ return actions;
+}
+
+class AccessibleFxItem : public QDeclarativeItem
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeItem)
+public:
+ int siblingIndex() {
+ Q_D(QDeclarativeItem);
+ return d->siblingIndex;
+ }
+};
+
+void QDeclarativeParentChange::saveOriginals()
+{
+ Q_D(QDeclarativeParentChange);
+ saveCurrentValues();
+ d->origParent = d->rewindParent;
+ d->origStackBefore = d->rewindStackBefore;
+}
+
+void QDeclarativeParentChange::execute()
+{
+ Q_D(QDeclarativeParentChange);
+ d->doChange(d->parent);
+}
+
+bool QDeclarativeParentChange::isReversable()
+{
+ return true;
+}
+
+void QDeclarativeParentChange::reverse()
+{
+ Q_D(QDeclarativeParentChange);
+ d->doChange(d->origParent, d->origStackBefore);
+}
+
+QString QDeclarativeParentChange::typeName() const
+{
+ return QLatin1String("ParentChange");
+}
+
+bool QDeclarativeParentChange::override(QDeclarativeActionEvent*other)
+{
+ Q_D(QDeclarativeParentChange);
+ if (other->typeName() != QLatin1String("ParentChange"))
+ return false;
+ if (QDeclarativeParentChange *otherPC = static_cast<QDeclarativeParentChange*>(other))
+ return (d->target == otherPC->object());
+ return false;
+}
+
+void QDeclarativeParentChange::saveCurrentValues()
+{
+ Q_D(QDeclarativeParentChange);
+ if (!d->target) {
+ d->rewindParent = 0;
+ d->rewindStackBefore = 0;
+ return;
+ }
+
+ d->rewindParent = d->target->parentItem();
+
+ if (!d->rewindParent) {
+ d->rewindStackBefore = 0;
+ return;
+ }
+
+ //try to determine the item's original stack position so we can restore it
+ int siblingIndex = ((AccessibleFxItem*)d->target)->siblingIndex() + 1;
+ QList<QGraphicsItem*> children = d->rewindParent->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ QDeclarativeItem *child = qobject_cast<QDeclarativeItem*>(children.at(i));
+ if (!child)
+ continue;
+ if (((AccessibleFxItem*)child)->siblingIndex() == siblingIndex) {
+ d->rewindStackBefore = child;
+ break;
+ }
+ }
+}
+
+void QDeclarativeParentChange::rewind()
+{
+ Q_D(QDeclarativeParentChange);
+ d->doChange(d->rewindParent, d->rewindStackBefore);
+}
+
+class QDeclarativeStateChangeScriptPrivate : public QObjectPrivate
+{
+public:
+ QDeclarativeStateChangeScriptPrivate() {}
+
+ QDeclarativeScriptString script;
+ QString name;
+};
+
+/*!
+ \qmlclass StateChangeScript QDeclarativeStateChangeScript
+ \brief The StateChangeScript element allows you to run a script in a state.
+
+ The script specified will be run immediately when the state is made current.
+ Alternatively you can use a ScriptAction to specify at which point in the transition
+ you want the StateChangeScript to be run.
+*/
+
+QDeclarativeStateChangeScript::QDeclarativeStateChangeScript(QObject *parent)
+: QDeclarativeStateOperation(*(new QDeclarativeStateChangeScriptPrivate), parent)
+{
+}
+
+QDeclarativeStateChangeScript::~QDeclarativeStateChangeScript()
+{
+}
+
+/*!
+ \qmlproperty script StateChangeScript::script
+ This property holds the script to run when the state is current.
+*/
+QDeclarativeScriptString QDeclarativeStateChangeScript::script() const
+{
+ Q_D(const QDeclarativeStateChangeScript);
+ return d->script;
+}
+
+void QDeclarativeStateChangeScript::setScript(const QDeclarativeScriptString &s)
+{
+ Q_D(QDeclarativeStateChangeScript);
+ d->script = s;
+}
+
+/*!
+ \qmlproperty script StateChangeScript::script
+ This property holds the name of the script. This name can be used by a
+ ScriptAction to target a specific script.
+
+ \sa ScriptAction::stateChangeScriptName
+*/
+QString QDeclarativeStateChangeScript::name() const
+{
+ Q_D(const QDeclarativeStateChangeScript);
+ return d->name;
+}
+
+void QDeclarativeStateChangeScript::setName(const QString &n)
+{
+ Q_D(QDeclarativeStateChangeScript);
+ d->name = n;
+}
+
+void QDeclarativeStateChangeScript::execute()
+{
+ Q_D(QDeclarativeStateChangeScript);
+ const QString &script = d->script.script();
+ if (!script.isEmpty()) {
+ QDeclarativeExpression expr(d->script.context(), script, d->script.scopeObject());
+ expr.value();
+ }
+}
+
+QDeclarativeStateChangeScript::ActionList QDeclarativeStateChangeScript::actions()
+{
+ ActionList rv;
+ QDeclarativeAction a;
+ a.event = this;
+ rv << a;
+ return rv;
+}
+
+QString QDeclarativeStateChangeScript::typeName() const
+{
+ return QLatin1String("StateChangeScript");
+}
+
+/*!
+ \qmlclass AnchorChanges QDeclarativeAnchorChanges
+ \brief The AnchorChanges element allows you to change the anchors of an item in a state.
+
+ In the following example we change the top and bottom anchors of an item:
+ \snippet examples/declarative/anchors/anchor-changes.qml 0
+
+ AnchorChanges will 'inject' \c x, \c y, \c width, and \c height changes into the transition,
+ so you can animate them as you would normally changes to these properties:
+ \qml
+ //animate our anchor changes
+ NumberAnimation { targets: content; properties: "x,y,width,height" }
+ \endqml
+
+ For more information on anchors see \l {anchor-layout}{Anchor Layouts}.
+*/
+
+
+
+class QDeclarativeAnchorChangesPrivate : public QObjectPrivate
+{
+public:
+ QDeclarativeAnchorChangesPrivate() : target(0) {}
+
+ QString name;
+ QDeclarativeItem *target;
+ QString resetString;
+ QStringList resetList;
+ QDeclarativeAnchorLine left;
+ QDeclarativeAnchorLine right;
+ QDeclarativeAnchorLine horizontalCenter;
+ QDeclarativeAnchorLine top;
+ QDeclarativeAnchorLine bottom;
+ QDeclarativeAnchorLine verticalCenter;
+ QDeclarativeAnchorLine baseline;
+
+ QDeclarativeAnchorLine origLeft;
+ QDeclarativeAnchorLine origRight;
+ QDeclarativeAnchorLine origHCenter;
+ QDeclarativeAnchorLine origTop;
+ QDeclarativeAnchorLine origBottom;
+ QDeclarativeAnchorLine origVCenter;
+ QDeclarativeAnchorLine origBaseline;
+
+ QDeclarativeAnchorLine rewindLeft;
+ QDeclarativeAnchorLine rewindRight;
+ QDeclarativeAnchorLine rewindHCenter;
+ QDeclarativeAnchorLine rewindTop;
+ QDeclarativeAnchorLine rewindBottom;
+ QDeclarativeAnchorLine rewindVCenter;
+ QDeclarativeAnchorLine rewindBaseline;
+
+ qreal fromX;
+ qreal fromY;
+ qreal fromWidth;
+ qreal fromHeight;
+};
+
+/*!
+ \qmlproperty Item AnchorChanges::target
+ This property holds the Item whose anchors will change
+*/
+
+QDeclarativeAnchorChanges::QDeclarativeAnchorChanges(QObject *parent)
+ : QDeclarativeStateOperation(*(new QDeclarativeAnchorChangesPrivate), parent)
+{
+}
+
+QDeclarativeAnchorChanges::~QDeclarativeAnchorChanges()
+{
+}
+
+QDeclarativeAnchorChanges::ActionList QDeclarativeAnchorChanges::actions()
+{
+ QDeclarativeAction a;
+ a.event = this;
+ return ActionList() << a;
+}
+
+QDeclarativeItem *QDeclarativeAnchorChanges::object() const
+{
+ Q_D(const QDeclarativeAnchorChanges);
+ return d->target;
+}
+
+void QDeclarativeAnchorChanges::setObject(QDeclarativeItem *target)
+{
+ Q_D(QDeclarativeAnchorChanges);
+ d->target = target;
+}
+
+QString QDeclarativeAnchorChanges::reset() const
+{
+ Q_D(const QDeclarativeAnchorChanges);
+ return d->resetString;
+}
+
+void QDeclarativeAnchorChanges::setReset(const QString &reset)
+{
+ Q_D(QDeclarativeAnchorChanges);
+ d->resetString = reset;
+ d->resetList = d->resetString.split(QLatin1Char(','));
+ for (int i = 0; i < d->resetList.count(); ++i)
+ d->resetList[i] = d->resetList.at(i).trimmed();
+}
+
+/*!
+ \qmlproperty AnchorLine AnchorChanges::left
+ \qmlproperty AnchorLine AnchorChanges::right
+ \qmlproperty AnchorLine AnchorChanges::horizontalCenter
+ \qmlproperty AnchorLine AnchorChanges::top
+ \qmlproperty AnchorLine AnchorChanges::bottom
+ \qmlproperty AnchorLine AnchorChanges::verticalCenter
+ \qmlproperty AnchorLine AnchorChanges::baseline
+
+ These properties change the respective anchors of the item.
+*/
+
+QDeclarativeAnchorLine QDeclarativeAnchorChanges::left() const
+{
+ Q_D(const QDeclarativeAnchorChanges);
+ return d->left;
+}
+
+void QDeclarativeAnchorChanges::setLeft(const QDeclarativeAnchorLine &edge)
+{
+ Q_D(QDeclarativeAnchorChanges);
+ d->left = edge;
+}
+
+QDeclarativeAnchorLine QDeclarativeAnchorChanges::right() const
+{
+ Q_D(const QDeclarativeAnchorChanges);
+ return d->right;
+}
+
+void QDeclarativeAnchorChanges::setRight(const QDeclarativeAnchorLine &edge)
+{
+ Q_D(QDeclarativeAnchorChanges);
+ d->right = edge;
+}
+
+QDeclarativeAnchorLine QDeclarativeAnchorChanges::horizontalCenter() const
+{
+ Q_D(const QDeclarativeAnchorChanges);
+ return d->horizontalCenter;
+}
+
+void QDeclarativeAnchorChanges::setHorizontalCenter(const QDeclarativeAnchorLine &edge)
+{
+ Q_D(QDeclarativeAnchorChanges);
+ d->horizontalCenter = edge;
+}
+
+QDeclarativeAnchorLine QDeclarativeAnchorChanges::top() const
+{
+ Q_D(const QDeclarativeAnchorChanges);
+ return d->top;
+}
+
+void QDeclarativeAnchorChanges::setTop(const QDeclarativeAnchorLine &edge)
+{
+ Q_D(QDeclarativeAnchorChanges);
+ d->top = edge;
+}
+
+QDeclarativeAnchorLine QDeclarativeAnchorChanges::bottom() const
+{
+ Q_D(const QDeclarativeAnchorChanges);
+ return d->bottom;
+}
+
+void QDeclarativeAnchorChanges::setBottom(const QDeclarativeAnchorLine &edge)
+{
+ Q_D(QDeclarativeAnchorChanges);
+ d->bottom = edge;
+}
+
+QDeclarativeAnchorLine QDeclarativeAnchorChanges::verticalCenter() const
+{
+ Q_D(const QDeclarativeAnchorChanges);
+ return d->verticalCenter;
+}
+
+void QDeclarativeAnchorChanges::setVerticalCenter(const QDeclarativeAnchorLine &edge)
+{
+ Q_D(QDeclarativeAnchorChanges);
+ d->verticalCenter = edge;
+}
+
+QDeclarativeAnchorLine QDeclarativeAnchorChanges::baseline() const
+{
+ Q_D(const QDeclarativeAnchorChanges);
+ return d->baseline;
+}
+
+void QDeclarativeAnchorChanges::setBaseline(const QDeclarativeAnchorLine &edge)
+{
+ Q_D(QDeclarativeAnchorChanges);
+ d->baseline = edge;
+}
+
+void QDeclarativeAnchorChanges::execute()
+{
+ Q_D(QDeclarativeAnchorChanges);
+ if (!d->target)
+ return;
+
+ //set any anchors that have been specified
+ if (d->left.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setLeft(d->left);
+ if (d->right.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setRight(d->right);
+ if (d->horizontalCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setHorizontalCenter(d->horizontalCenter);
+ if (d->top.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setTop(d->top);
+ if (d->bottom.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setBottom(d->bottom);
+ if (d->verticalCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setVerticalCenter(d->verticalCenter);
+ if (d->baseline.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setBaseline(d->baseline);
+}
+
+bool QDeclarativeAnchorChanges::isReversable()
+{
+ return true;
+}
+
+void QDeclarativeAnchorChanges::reverse()
+{
+ Q_D(QDeclarativeAnchorChanges);
+ if (!d->target)
+ return;
+
+ //restore previous anchors
+ if (d->origLeft.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setLeft(d->origLeft);
+ if (d->origRight.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setRight(d->origRight);
+ if (d->origHCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setHorizontalCenter(d->origHCenter);
+ if (d->origTop.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setTop(d->origTop);
+ if (d->origBottom.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setBottom(d->origBottom);
+ if (d->origVCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setVerticalCenter(d->origVCenter);
+ if (d->origBaseline.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setBaseline(d->origBaseline);
+}
+
+QString QDeclarativeAnchorChanges::typeName() const
+{
+ return QLatin1String("AnchorChanges");
+}
+
+QList<QDeclarativeAction> QDeclarativeAnchorChanges::extraActions()
+{
+ Q_D(QDeclarativeAnchorChanges);
+ QList<QDeclarativeAction> extra;
+
+ //### try to be smarter about which ones we add.
+ // or short-circuit later on if they haven't actually changed.
+ // we shouldn't set explicit width if there wasn't one before.
+ if (d->target) {
+ QDeclarativeAction a;
+ a.fromValue = d->fromX;
+ a.property = QDeclarativeProperty(d->target, QLatin1String("x"));
+ extra << a;
+
+ a.fromValue = d->fromY;
+ a.property = QDeclarativeProperty(d->target, QLatin1String("y"));
+ extra << a;
+
+ a.fromValue = d->fromWidth;
+ a.property = QDeclarativeProperty(d->target, QLatin1String("width"));
+ extra << a;
+
+ a.fromValue = d->fromHeight;
+ a.property = QDeclarativeProperty(d->target, QLatin1String("height"));
+ extra << a;
+ }
+
+ return extra;
+}
+
+bool QDeclarativeAnchorChanges::changesBindings()
+{
+ return true;
+}
+
+void QDeclarativeAnchorChanges::saveOriginals()
+{
+ Q_D(QDeclarativeAnchorChanges);
+ d->origLeft = d->target->anchors()->left();
+ d->origRight = d->target->anchors()->right();
+ d->origHCenter = d->target->anchors()->horizontalCenter();
+ d->origTop = d->target->anchors()->top();
+ d->origBottom = d->target->anchors()->bottom();
+ d->origVCenter = d->target->anchors()->verticalCenter();
+ d->origBaseline = d->target->anchors()->baseline();
+
+ saveCurrentValues();
+}
+
+void QDeclarativeAnchorChanges::clearForwardBindings()
+{
+ Q_D(QDeclarativeAnchorChanges);
+ d->fromX = d->target->x();
+ d->fromY = d->target->y();
+ d->fromWidth = d->target->width();
+ d->fromHeight = d->target->height();
+
+ //reset any anchors that have been specified
+ if (d->resetList.contains(QLatin1String("left")))
+ d->target->anchors()->resetLeft();
+ if (d->resetList.contains(QLatin1String("right")))
+ d->target->anchors()->resetRight();
+ if (d->resetList.contains(QLatin1String("horizontalCenter")))
+ d->target->anchors()->resetHorizontalCenter();
+ if (d->resetList.contains(QLatin1String("top")))
+ d->target->anchors()->resetTop();
+ if (d->resetList.contains(QLatin1String("bottom")))
+ d->target->anchors()->resetBottom();
+ if (d->resetList.contains(QLatin1String("verticalCenter")))
+ d->target->anchors()->resetVerticalCenter();
+ if (d->resetList.contains(QLatin1String("baseline")))
+ d->target->anchors()->resetBaseline();
+
+ //reset any anchors that we'll be setting in the state
+ if (d->left.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetLeft();
+ if (d->right.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetRight();
+ if (d->horizontalCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetHorizontalCenter();
+ if (d->top.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetTop();
+ if (d->bottom.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetBottom();
+ if (d->verticalCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetVerticalCenter();
+ if (d->baseline.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetBaseline();
+}
+
+void QDeclarativeAnchorChanges::clearReverseBindings()
+{
+ Q_D(QDeclarativeAnchorChanges);
+ d->fromX = d->target->x();
+ d->fromY = d->target->y();
+ d->fromWidth = d->target->width();
+ d->fromHeight = d->target->height();
+
+ //reset any anchors that were set in the state
+ if (d->left.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetLeft();
+ if (d->right.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetRight();
+ if (d->horizontalCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetHorizontalCenter();
+ if (d->top.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetTop();
+ if (d->bottom.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetBottom();
+ if (d->verticalCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetVerticalCenter();
+ if (d->baseline.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetBaseline();
+
+ //reset any anchors that were set in the original state
+ if (d->origLeft.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetLeft();
+ if (d->origRight.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetRight();
+ if (d->origHCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetHorizontalCenter();
+ if (d->origTop.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetTop();
+ if (d->origBottom.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetBottom();
+ if (d->origVCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetVerticalCenter();
+ if (d->origBaseline.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->resetBaseline();
+}
+
+bool QDeclarativeAnchorChanges::override(QDeclarativeActionEvent*other)
+{
+ if (other->typeName() != QLatin1String("AnchorChanges"))
+ return false;
+ if (static_cast<QDeclarativeActionEvent*>(this) == other)
+ return true;
+ if (static_cast<QDeclarativeAnchorChanges*>(other)->object() == object())
+ return true;
+ return false;
+}
+
+void QDeclarativeAnchorChanges::rewind()
+{
+ Q_D(QDeclarativeAnchorChanges);
+ if (!d->target)
+ return;
+
+ //restore previous anchors
+ if (d->rewindLeft.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setLeft(d->rewindLeft);
+ if (d->rewindRight.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setRight(d->rewindRight);
+ if (d->rewindHCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setHorizontalCenter(d->rewindHCenter);
+ if (d->rewindTop.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setTop(d->rewindTop);
+ if (d->rewindBottom.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setBottom(d->rewindBottom);
+ if (d->rewindVCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setVerticalCenter(d->rewindVCenter);
+ if (d->rewindBaseline.anchorLine != QDeclarativeAnchorLine::Invalid)
+ d->target->anchors()->setBaseline(d->rewindBaseline);
+}
+
+void QDeclarativeAnchorChanges::saveCurrentValues()
+{
+ Q_D(QDeclarativeAnchorChanges);
+ d->rewindLeft = d->target->anchors()->left();
+ d->rewindRight = d->target->anchors()->right();
+ d->rewindHCenter = d->target->anchors()->horizontalCenter();
+ d->rewindTop = d->target->anchors()->top();
+ d->rewindBottom = d->target->anchors()->bottom();
+ d->rewindVCenter = d->target->anchors()->verticalCenter();
+ d->rewindBaseline = d->target->anchors()->baseline();
+}
+
+#include <qdeclarativestateoperations.moc>
+#include <moc_qdeclarativestateoperations_p.cpp>
+
+QT_END_NAMESPACE
+
diff --git a/src/declarative/util/qdeclarativestateoperations_p.h b/src/declarative/util/qdeclarativestateoperations_p.h
new file mode 100644
index 0000000..026a64d
--- /dev/null
+++ b/src/declarative/util/qdeclarativestateoperations_p.h
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVESTATEOPERATIONS_H
+#define QDECLARATIVESTATEOPERATIONS_H
+
+#include "qdeclarativestate_p.h"
+
+#include <qdeclarativeitem.h>
+#include "private/qdeclarativeanchors_p.h"
+#include <qdeclarativescriptstring.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class QDeclarativeParentChangePrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeParentChange : public QDeclarativeStateOperation, public QDeclarativeActionEvent
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativeParentChange)
+
+ Q_PROPERTY(QDeclarativeItem *target READ object WRITE setObject)
+ Q_PROPERTY(QDeclarativeItem *parent READ parent WRITE setParent)
+ Q_PROPERTY(qreal x READ x WRITE setX)
+ Q_PROPERTY(qreal y READ y WRITE setY)
+ Q_PROPERTY(qreal width READ width WRITE setWidth)
+ Q_PROPERTY(qreal height READ height WRITE setHeight)
+ Q_PROPERTY(qreal scale READ scale WRITE setScale)
+ Q_PROPERTY(qreal rotation READ rotation WRITE setRotation)
+public:
+ QDeclarativeParentChange(QObject *parent=0);
+ ~QDeclarativeParentChange();
+
+ QDeclarativeItem *object() const;
+ void setObject(QDeclarativeItem *);
+
+ QDeclarativeItem *parent() const;
+ void setParent(QDeclarativeItem *);
+
+ QDeclarativeItem *originalParent() const;
+
+ qreal x() const;
+ void setX(qreal x);
+ bool xIsSet() const;
+
+ qreal y() const;
+ void setY(qreal y);
+ bool yIsSet() const;
+
+ qreal width() const;
+ void setWidth(qreal width);
+ bool widthIsSet() const;
+
+ qreal height() const;
+ void setHeight(qreal height);
+ bool heightIsSet() const;
+
+ qreal scale() const;
+ void setScale(qreal scale);
+ bool scaleIsSet() const;
+
+ qreal rotation() const;
+ void setRotation(qreal rotation);
+ bool rotationIsSet() const;
+
+ virtual ActionList actions();
+
+ virtual void saveOriginals();
+ virtual void execute();
+ virtual bool isReversable();
+ virtual void reverse();
+ virtual QString typeName() const;
+ virtual bool override(QDeclarativeActionEvent*other);
+ virtual void rewind();
+ virtual void saveCurrentValues();
+};
+
+class QDeclarativeStateChangeScriptPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeStateChangeScript : public QDeclarativeStateOperation, public QDeclarativeActionEvent
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativeStateChangeScript)
+
+ Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript)
+ Q_PROPERTY(QString name READ name WRITE setName)
+
+public:
+ QDeclarativeStateChangeScript(QObject *parent=0);
+ ~QDeclarativeStateChangeScript();
+
+ virtual ActionList actions();
+
+ virtual QString typeName() const;
+
+ QDeclarativeScriptString script() const;
+ void setScript(const QDeclarativeScriptString &);
+
+ QString name() const;
+ void setName(const QString &);
+
+ virtual void execute();
+};
+
+class QDeclarativeAnchorChangesPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeAnchorChanges : public QDeclarativeStateOperation, public QDeclarativeActionEvent
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QDeclarativeAnchorChanges)
+
+ Q_PROPERTY(QDeclarativeItem *target READ object WRITE setObject)
+ Q_PROPERTY(QString reset READ reset WRITE setReset)
+ Q_PROPERTY(QDeclarativeAnchorLine left READ left WRITE setLeft)
+ Q_PROPERTY(QDeclarativeAnchorLine right READ right WRITE setRight)
+ Q_PROPERTY(QDeclarativeAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter)
+ Q_PROPERTY(QDeclarativeAnchorLine top READ top WRITE setTop)
+ Q_PROPERTY(QDeclarativeAnchorLine bottom READ bottom WRITE setBottom)
+ Q_PROPERTY(QDeclarativeAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter)
+ Q_PROPERTY(QDeclarativeAnchorLine baseline READ baseline WRITE setBaseline)
+
+public:
+ QDeclarativeAnchorChanges(QObject *parent=0);
+ ~QDeclarativeAnchorChanges();
+
+ virtual ActionList actions();
+
+ QDeclarativeItem *object() const;
+ void setObject(QDeclarativeItem *);
+
+ QString reset() const;
+ void setReset(const QString &);
+
+ QDeclarativeAnchorLine left() const;
+ void setLeft(const QDeclarativeAnchorLine &edge);
+
+ QDeclarativeAnchorLine right() const;
+ void setRight(const QDeclarativeAnchorLine &edge);
+
+ QDeclarativeAnchorLine horizontalCenter() const;
+ void setHorizontalCenter(const QDeclarativeAnchorLine &edge);
+
+ QDeclarativeAnchorLine top() const;
+ void setTop(const QDeclarativeAnchorLine &edge);
+
+ QDeclarativeAnchorLine bottom() const;
+ void setBottom(const QDeclarativeAnchorLine &edge);
+
+ QDeclarativeAnchorLine verticalCenter() const;
+ void setVerticalCenter(const QDeclarativeAnchorLine &edge);
+
+ QDeclarativeAnchorLine baseline() const;
+ void setBaseline(const QDeclarativeAnchorLine &edge);
+
+ virtual void execute();
+ virtual bool isReversable();
+ virtual void reverse();
+ virtual QString typeName() const;
+ virtual bool override(QDeclarativeActionEvent*other);
+ virtual QList<QDeclarativeAction> extraActions();
+ virtual bool changesBindings();
+ virtual void saveOriginals();
+ virtual void clearForwardBindings();
+ virtual void clearReverseBindings();
+ virtual void rewind();
+ virtual void saveCurrentValues();
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QDeclarativeParentChange)
+QML_DECLARE_TYPE(QDeclarativeStateChangeScript)
+QML_DECLARE_TYPE(QDeclarativeAnchorChanges)
+
+QT_END_HEADER
+
+#endif // QDECLARATIVESTATEOPERATIONS_H
diff --git a/src/declarative/util/qmlstyledtext.cpp b/src/declarative/util/qdeclarativestyledtext.cpp
index 1f31214..461de12 100644
--- a/src/declarative/util/qmlstyledtext.cpp
+++ b/src/declarative/util/qdeclarativestyledtext.cpp
@@ -45,10 +45,10 @@
#include <QTextLayout>
#include <QDebug>
#include <qmath.h>
-#include "qmlstyledtext_p.h"
+#include "qdeclarativestyledtext_p.h"
/*
- QmlStyledText supports few tags:
+ QDeclarativeStyledText supports few tags:
<b></b> - bold
<i></i> - italic
@@ -60,10 +60,10 @@
QT_BEGIN_NAMESPACE
-class QmlStyledTextPrivate
+class QDeclarativeStyledTextPrivate
{
public:
- QmlStyledTextPrivate(const QString &t, QTextLayout &l) : text(t), layout(l), baseFont(layout.font()) {}
+ QDeclarativeStyledTextPrivate(const QString &t, QTextLayout &l) : text(t), layout(l), baseFont(layout.font()) {}
void parse();
bool parseTag(const QChar *&ch, const QString &textIn, QString &textOut, QTextCharFormat &format);
@@ -91,31 +91,33 @@ public:
static const QChar ampersand;
};
-const QChar QmlStyledTextPrivate::lessThan(QLatin1Char('<'));
-const QChar QmlStyledTextPrivate::greaterThan(QLatin1Char('>'));
-const QChar QmlStyledTextPrivate::equals(QLatin1Char('='));
-const QChar QmlStyledTextPrivate::singleQuote(QLatin1Char('\''));
-const QChar QmlStyledTextPrivate::doubleQuote(QLatin1Char('\"'));
-const QChar QmlStyledTextPrivate::slash(QLatin1Char('/'));
-const QChar QmlStyledTextPrivate::ampersand(QLatin1Char('&'));
+const QChar QDeclarativeStyledTextPrivate::lessThan(QLatin1Char('<'));
+const QChar QDeclarativeStyledTextPrivate::greaterThan(QLatin1Char('>'));
+const QChar QDeclarativeStyledTextPrivate::equals(QLatin1Char('='));
+const QChar QDeclarativeStyledTextPrivate::singleQuote(QLatin1Char('\''));
+const QChar QDeclarativeStyledTextPrivate::doubleQuote(QLatin1Char('\"'));
+const QChar QDeclarativeStyledTextPrivate::slash(QLatin1Char('/'));
+const QChar QDeclarativeStyledTextPrivate::ampersand(QLatin1Char('&'));
-QmlStyledText::QmlStyledText(const QString &string, QTextLayout &layout)
-: d(new QmlStyledTextPrivate(string, layout))
+QDeclarativeStyledText::QDeclarativeStyledText(const QString &string, QTextLayout &layout)
+: d(new QDeclarativeStyledTextPrivate(string, layout))
{
}
-QmlStyledText::~QmlStyledText()
+QDeclarativeStyledText::~QDeclarativeStyledText()
{
delete d;
}
-void QmlStyledText::parse(const QString &string, QTextLayout &layout)
+void QDeclarativeStyledText::parse(const QString &string, QTextLayout &layout)
{
- QmlStyledText styledText(string, layout);
+ if (string.isEmpty())
+ return;
+ QDeclarativeStyledText styledText(string, layout);
styledText.d->parse();
}
-void QmlStyledTextPrivate::parse()
+void QDeclarativeStyledTextPrivate::parse()
{
QList<QTextLayout::FormatRange> ranges;
QStack<QTextCharFormat> formatStack;
@@ -142,8 +144,10 @@ void QmlStyledTextPrivate::parse()
++ch;
if (*ch == slash) {
++ch;
- if (parseCloseTag(ch, text))
- formatStack.pop();
+ if (parseCloseTag(ch, text)) {
+ if (formatStack.count())
+ formatStack.pop();
+ }
} else {
QTextCharFormat format;
if (formatStack.count())
@@ -164,7 +168,8 @@ void QmlStyledTextPrivate::parse()
} else {
++textLength;
}
- ++ch;
+ if (!ch->isNull())
+ ++ch;
}
if (textLength)
drawText.append(QStringRef(&text, textStart, textLength));
@@ -180,7 +185,7 @@ void QmlStyledTextPrivate::parse()
layout.setAdditionalFormats(ranges);
}
-bool QmlStyledTextPrivate::parseTag(const QChar *&ch, const QString &textIn, QString &textOut, QTextCharFormat &format)
+bool QDeclarativeStyledTextPrivate::parseTag(const QChar *&ch, const QString &textIn, QString &textOut, QTextCharFormat &format)
{
skipSpace(ch);
@@ -191,20 +196,15 @@ bool QmlStyledTextPrivate::parseTag(const QChar *&ch, const QString &textIn, QSt
QStringRef tag(&textIn, tagStart, tagLength);
const QChar char0 = tag.at(0);
if (char0 == QLatin1Char('b')) {
- if (tagLength == 1) {
+ if (tagLength == 1)
format.setFontWeight(QFont::Bold);
- return true;
- } else if (tagLength == 2 && tag.at(1) == QLatin1Char('r')) {
+ else if (tagLength == 2 && tag.at(1) == QLatin1Char('r'))
textOut.append(QChar(QChar::LineSeparator));
- return true;
- }
} else if (char0 == QLatin1Char('i')) {
- if (tagLength == 1) {
+ if (tagLength == 1)
format.setFontItalic(true);
- return true;
- }
}
- return false;
+ return true;
} else if (ch->isSpace()) {
// may have params.
QStringRef tag(&textIn, tagStart, tagLength);
@@ -221,7 +221,7 @@ bool QmlStyledTextPrivate::parseTag(const QChar *&ch, const QString &textIn, QSt
return false;
}
-bool QmlStyledTextPrivate::parseCloseTag(const QChar *&ch, const QString &textIn)
+bool QDeclarativeStyledTextPrivate::parseCloseTag(const QChar *&ch, const QString &textIn)
{
skipSpace(ch);
@@ -252,7 +252,7 @@ bool QmlStyledTextPrivate::parseCloseTag(const QChar *&ch, const QString &textIn
return false;
}
-void QmlStyledTextPrivate::parseEntity(const QChar *&ch, const QString &textIn, QString &textOut)
+void QDeclarativeStyledTextPrivate::parseEntity(const QChar *&ch, const QString &textIn, QString &textOut)
{
int entityStart = ch - textIn.constData();
int entityLength = 0;
@@ -272,7 +272,7 @@ void QmlStyledTextPrivate::parseEntity(const QChar *&ch, const QString &textIn,
}
}
-bool QmlStyledTextPrivate::parseFontAttributes(const QChar *&ch, const QString &textIn, QTextCharFormat &format)
+bool QDeclarativeStyledTextPrivate::parseFontAttributes(const QChar *&ch, const QString &textIn, QTextCharFormat &format)
{
bool valid = false;
QPair<QStringRef,QStringRef> attr;
@@ -296,7 +296,7 @@ bool QmlStyledTextPrivate::parseFontAttributes(const QChar *&ch, const QString &
return valid;
}
-QPair<QStringRef,QStringRef> QmlStyledTextPrivate::parseAttribute(const QChar *&ch, const QString &textIn)
+QPair<QStringRef,QStringRef> QDeclarativeStyledTextPrivate::parseAttribute(const QChar *&ch, const QString &textIn)
{
skipSpace(ch);
@@ -329,7 +329,7 @@ QPair<QStringRef,QStringRef> QmlStyledTextPrivate::parseAttribute(const QChar *&
return QPair<QStringRef,QStringRef>();
}
-QStringRef QmlStyledTextPrivate::parseValue(const QChar *&ch, const QString &textIn)
+QStringRef QDeclarativeStyledTextPrivate::parseValue(const QChar *&ch, const QString &textIn)
{
int valStart = ch - textIn.constData();
int valLength = 0;
diff --git a/src/declarative/util/qmlstyledtext_p.h b/src/declarative/util/qdeclarativestyledtext_p.h
index 4698279..8d2c42d 100644
--- a/src/declarative/util/qmlstyledtext_p.h
+++ b/src/declarative/util/qdeclarativestyledtext_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLSTYLEDTEXT_H
-#define QMLSTYLEDTEXT_H
+#ifndef QDECLARATIVESTYLEDTEXT_H
+#define QDECLARATIVESTYLEDTEXT_H
#include <QSizeF>
@@ -49,18 +49,19 @@ QT_BEGIN_NAMESPACE
class QPainter;
class QPointF;
class QString;
-class QmlStyledTextPrivate;
+class QDeclarativeStyledTextPrivate;
+class QTextLayout;
-class Q_DECLARATIVE_EXPORT QmlStyledText
+class Q_DECLARATIVE_EXPORT QDeclarativeStyledText
{
public:
static void parse(const QString &string, QTextLayout &layout);
private:
- QmlStyledText(const QString &string, QTextLayout &layout);
- ~QmlStyledText();
+ QDeclarativeStyledText(const QString &string, QTextLayout &layout);
+ ~QDeclarativeStyledText();
- QmlStyledTextPrivate *d;
+ QDeclarativeStyledTextPrivate *d;
};
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlsystempalette.cpp b/src/declarative/util/qdeclarativesystempalette.cpp
index cc4fb3e..1e00f22 100644
--- a/src/declarative/util/qmlsystempalette.cpp
+++ b/src/declarative/util/qdeclarativesystempalette.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmlsystempalette_p.h"
+#include "qdeclarativesystempalette_p.h"
#include <QApplication>
@@ -47,17 +47,17 @@
QT_BEGIN_NAMESPACE
-class QmlSystemPalettePrivate : public QObjectPrivate
+class QDeclarativeSystemPalettePrivate : public QObjectPrivate
{
public:
QPalette palette;
QPalette::ColorGroup group;
};
-QML_DEFINE_TYPE(Qt,4,6,SystemPalette,QmlSystemPalette)
+
/*!
- \qmlclass SystemPalette QmlSystemPalette
+ \qmlclass SystemPalette QDeclarativeSystemPalette
\ingroup group_utility
\brief The SystemPalette item gives access to the Qt palettes.
\sa QPalette
@@ -76,16 +76,16 @@ QML_DEFINE_TYPE(Qt,4,6,SystemPalette,QmlSystemPalette)
}
\endqml
*/
-QmlSystemPalette::QmlSystemPalette(QObject *parent)
- : QObject(*(new QmlSystemPalettePrivate), parent)
+QDeclarativeSystemPalette::QDeclarativeSystemPalette(QObject *parent)
+ : QObject(*(new QDeclarativeSystemPalettePrivate), parent)
{
- Q_D(QmlSystemPalette);
+ Q_D(QDeclarativeSystemPalette);
d->palette = QApplication::palette();
d->group = QPalette::Active;
qApp->installEventFilter(this);
}
-QmlSystemPalette::~QmlSystemPalette()
+QDeclarativeSystemPalette::~QDeclarativeSystemPalette()
{
}
@@ -95,9 +95,9 @@ QmlSystemPalette::~QmlSystemPalette()
\sa QPalette::ColorRole
*/
-QColor QmlSystemPalette::window() const
+QColor QDeclarativeSystemPalette::window() const
{
- Q_D(const QmlSystemPalette);
+ Q_D(const QDeclarativeSystemPalette);
return d->palette.color(d->group, QPalette::Window);
}
@@ -107,9 +107,9 @@ QColor QmlSystemPalette::window() const
\sa QPalette::ColorRole
*/
-QColor QmlSystemPalette::windowText() const
+QColor QDeclarativeSystemPalette::windowText() const
{
- Q_D(const QmlSystemPalette);
+ Q_D(const QDeclarativeSystemPalette);
return d->palette.color(d->group, QPalette::WindowText);
}
@@ -119,9 +119,9 @@ QColor QmlSystemPalette::windowText() const
\sa QPalette::ColorRole
*/
-QColor QmlSystemPalette::base() const
+QColor QDeclarativeSystemPalette::base() const
{
- Q_D(const QmlSystemPalette);
+ Q_D(const QDeclarativeSystemPalette);
return d->palette.color(d->group, QPalette::Base);
}
@@ -131,9 +131,9 @@ QColor QmlSystemPalette::base() const
\sa QPalette::ColorRole
*/
-QColor QmlSystemPalette::text() const
+QColor QDeclarativeSystemPalette::text() const
{
- Q_D(const QmlSystemPalette);
+ Q_D(const QDeclarativeSystemPalette);
return d->palette.color(d->group, QPalette::Text);
}
@@ -143,9 +143,9 @@ QColor QmlSystemPalette::text() const
\sa QPalette::ColorRole
*/
-QColor QmlSystemPalette::alternateBase() const
+QColor QDeclarativeSystemPalette::alternateBase() const
{
- Q_D(const QmlSystemPalette);
+ Q_D(const QDeclarativeSystemPalette);
return d->palette.color(d->group, QPalette::AlternateBase);
}
@@ -155,9 +155,9 @@ QColor QmlSystemPalette::alternateBase() const
\sa QPalette::ColorRole
*/
-QColor QmlSystemPalette::button() const
+QColor QDeclarativeSystemPalette::button() const
{
- Q_D(const QmlSystemPalette);
+ Q_D(const QDeclarativeSystemPalette);
return d->palette.color(d->group, QPalette::Button);
}
@@ -167,9 +167,9 @@ QColor QmlSystemPalette::button() const
\sa QPalette::ColorRole
*/
-QColor QmlSystemPalette::buttonText() const
+QColor QDeclarativeSystemPalette::buttonText() const
{
- Q_D(const QmlSystemPalette);
+ Q_D(const QDeclarativeSystemPalette);
return d->palette.color(d->group, QPalette::ButtonText);
}
@@ -179,9 +179,9 @@ QColor QmlSystemPalette::buttonText() const
\sa QPalette::ColorRole
*/
-QColor QmlSystemPalette::light() const
+QColor QDeclarativeSystemPalette::light() const
{
- Q_D(const QmlSystemPalette);
+ Q_D(const QDeclarativeSystemPalette);
return d->palette.color(d->group, QPalette::Light);
}
@@ -191,9 +191,9 @@ QColor QmlSystemPalette::light() const
\sa QPalette::ColorRole
*/
-QColor QmlSystemPalette::midlight() const
+QColor QDeclarativeSystemPalette::midlight() const
{
- Q_D(const QmlSystemPalette);
+ Q_D(const QDeclarativeSystemPalette);
return d->palette.color(d->group, QPalette::Midlight);
}
@@ -203,9 +203,9 @@ QColor QmlSystemPalette::midlight() const
\sa QPalette::ColorRole
*/
-QColor QmlSystemPalette::dark() const
+QColor QDeclarativeSystemPalette::dark() const
{
- Q_D(const QmlSystemPalette);
+ Q_D(const QDeclarativeSystemPalette);
return d->palette.color(d->group, QPalette::Dark);
}
@@ -215,9 +215,9 @@ QColor QmlSystemPalette::dark() const
\sa QPalette::ColorRole
*/
-QColor QmlSystemPalette::mid() const
+QColor QDeclarativeSystemPalette::mid() const
{
- Q_D(const QmlSystemPalette);
+ Q_D(const QDeclarativeSystemPalette);
return d->palette.color(d->group, QPalette::Mid);
}
@@ -227,9 +227,9 @@ QColor QmlSystemPalette::mid() const
\sa QPalette::ColorRole
*/
-QColor QmlSystemPalette::shadow() const
+QColor QDeclarativeSystemPalette::shadow() const
{
- Q_D(const QmlSystemPalette);
+ Q_D(const QDeclarativeSystemPalette);
return d->palette.color(d->group, QPalette::Shadow);
}
@@ -239,9 +239,9 @@ QColor QmlSystemPalette::shadow() const
\sa QPalette::ColorRole
*/
-QColor QmlSystemPalette::highlight() const
+QColor QDeclarativeSystemPalette::highlight() const
{
- Q_D(const QmlSystemPalette);
+ Q_D(const QDeclarativeSystemPalette);
return d->palette.color(d->group, QPalette::Highlight);
}
@@ -251,34 +251,34 @@ QColor QmlSystemPalette::highlight() const
\sa QPalette::ColorRole
*/
-QColor QmlSystemPalette::highlightedText() const
+QColor QDeclarativeSystemPalette::highlightedText() const
{
- Q_D(const QmlSystemPalette);
+ Q_D(const QDeclarativeSystemPalette);
return d->palette.color(d->group, QPalette::HighlightedText);
}
/*!
- \qmlproperty QmlSystemPalette::ColorGroup SystemPalette::colorGroup
+ \qmlproperty QDeclarativeSystemPalette::ColorGroup SystemPalette::colorGroup
The color group of the palette. It can be Active, Inactive or Disabled.
Active is the default.
\sa QPalette::ColorGroup
*/
-QmlSystemPalette::ColorGroup QmlSystemPalette::colorGroup() const
+QDeclarativeSystemPalette::ColorGroup QDeclarativeSystemPalette::colorGroup() const
{
- Q_D(const QmlSystemPalette);
- return (QmlSystemPalette::ColorGroup)d->group;
+ Q_D(const QDeclarativeSystemPalette);
+ return (QDeclarativeSystemPalette::ColorGroup)d->group;
}
-void QmlSystemPalette::setColorGroup(QmlSystemPalette::ColorGroup colorGroup)
+void QDeclarativeSystemPalette::setColorGroup(QDeclarativeSystemPalette::ColorGroup colorGroup)
{
- Q_D(QmlSystemPalette);
+ Q_D(QDeclarativeSystemPalette);
d->group = (QPalette::ColorGroup)colorGroup;
emit paletteChanged();
}
-bool QmlSystemPalette::eventFilter(QObject *watched, QEvent *event)
+bool QDeclarativeSystemPalette::eventFilter(QObject *watched, QEvent *event)
{
if (watched == qApp) {
if (event->type() == QEvent::ApplicationPaletteChange) {
@@ -289,9 +289,9 @@ bool QmlSystemPalette::eventFilter(QObject *watched, QEvent *event)
return QObject::eventFilter(watched, event);
}
-bool QmlSystemPalette::event(QEvent *event)
+bool QDeclarativeSystemPalette::event(QEvent *event)
{
- Q_D(QmlSystemPalette);
+ Q_D(QDeclarativeSystemPalette);
if (event->type() == QEvent::ApplicationPaletteChange) {
d->palette = QApplication::palette();
emit paletteChanged();
diff --git a/src/declarative/util/qmlsystempalette_p.h b/src/declarative/util/qdeclarativesystempalette_p.h
index e25bf7f..9fa6b08 100644
--- a/src/declarative/util/qmlsystempalette_p.h
+++ b/src/declarative/util/qdeclarativesystempalette_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLSYSTEMPALETTE_H
-#define QMLSYSTEMPALETTE_H
+#ifndef QDECLARATIVESYSTEMPALETTE_H
+#define QDECLARATIVESYSTEMPALETTE_H
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtCore/qobject.h>
#include <QPalette>
@@ -53,14 +53,14 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlSystemPalettePrivate;
-class Q_DECLARATIVE_EXPORT QmlSystemPalette : public QObject
+class QDeclarativeSystemPalettePrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeSystemPalette : public QObject
{
Q_OBJECT
Q_ENUMS(ColorGroup)
- Q_DECLARE_PRIVATE(QmlSystemPalette)
+ Q_DECLARE_PRIVATE(QDeclarativeSystemPalette)
- Q_PROPERTY(QmlSystemPalette::ColorGroup colorGroup READ colorGroup WRITE setColorGroup NOTIFY paletteChanged)
+ Q_PROPERTY(QDeclarativeSystemPalette::ColorGroup colorGroup READ colorGroup WRITE setColorGroup NOTIFY paletteChanged)
Q_PROPERTY(QColor window READ window NOTIFY paletteChanged)
Q_PROPERTY(QColor windowText READ windowText NOTIFY paletteChanged)
Q_PROPERTY(QColor base READ base NOTIFY paletteChanged)
@@ -77,8 +77,8 @@ class Q_DECLARATIVE_EXPORT QmlSystemPalette : public QObject
Q_PROPERTY(QColor highlightedText READ highlightedText NOTIFY paletteChanged)
public:
- QmlSystemPalette(QObject *parent=0);
- ~QmlSystemPalette();
+ QDeclarativeSystemPalette(QObject *parent=0);
+ ~QDeclarativeSystemPalette();
enum ColorGroup { Active = QPalette::Active, Inactive = QPalette::Inactive, Disabled = QPalette::Disabled };
@@ -101,8 +101,8 @@ public:
QColor highlight() const;
QColor highlightedText() const;
- QmlSystemPalette::ColorGroup colorGroup() const;
- void setColorGroup(QmlSystemPalette::ColorGroup);
+ QDeclarativeSystemPalette::ColorGroup colorGroup() const;
+ void setColorGroup(QDeclarativeSystemPalette::ColorGroup);
Q_SIGNALS:
void paletteChanged();
@@ -115,8 +115,8 @@ private:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlSystemPalette)
+QML_DECLARE_TYPE(QDeclarativeSystemPalette)
QT_END_HEADER
-#endif // QMLSYSTEMPALETTE_H
+#endif // QDECLARATIVESYSTEMPALETTE_H
diff --git a/src/declarative/util/qmltimeline.cpp b/src/declarative/util/qdeclarativetimeline.cpp
index 5c5df40..8e133b6 100644
--- a/src/declarative/util/qmltimeline.cpp
+++ b/src/declarative/util/qdeclarativetimeline.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmltimeline_p_p.h"
+#include "qdeclarativetimeline_p_p.h"
#include <QDebug>
#include <QMutex>
@@ -53,19 +53,19 @@
QT_BEGIN_NAMESPACE
struct Update {
- Update(QmlTimeLineValue *_g, qreal _v)
+ Update(QDeclarativeTimeLineValue *_g, qreal _v)
: g(_g), v(_v) {}
- Update(const QmlTimeLineCallback &_e)
+ Update(const QDeclarativeTimeLineCallback &_e)
: g(0), v(0), e(_e) {}
- QmlTimeLineValue *g;
+ QDeclarativeTimeLineValue *g;
qreal v;
- QmlTimeLineCallback e;
+ QDeclarativeTimeLineCallback e;
};
-struct QmlTimeLinePrivate
+struct QDeclarativeTimeLinePrivate
{
- QmlTimeLinePrivate(QmlTimeLine *);
+ QDeclarativeTimeLinePrivate(QDeclarativeTimeLine *);
struct Op {
enum Type {
@@ -79,7 +79,7 @@ struct QmlTimeLinePrivate
};
Op() {}
Op(Type t, int l, qreal v, qreal v2, int o,
- const QmlTimeLineCallback &ev = QmlTimeLineCallback(), const QEasingCurve &es = QEasingCurve())
+ const QDeclarativeTimeLineCallback &ev = QDeclarativeTimeLineCallback(), 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;
- QmlTimeLineCallback event;
+ QDeclarativeTimeLineCallback event;
QEasingCurve easing;
};
struct TimeLine
@@ -112,11 +112,11 @@ struct QmlTimeLinePrivate
int length;
int syncPoint;
- typedef QHash<QmlTimeLineObject *, TimeLine> Ops;
+ typedef QHash<QDeclarativeTimeLineObject *, TimeLine> Ops;
Ops ops;
- QmlTimeLine *q;
+ QDeclarativeTimeLine *q;
- void add(QmlTimeLineObject &, const Op &);
+ void add(QDeclarativeTimeLineObject &, const Op &);
qreal value(const Op &op, int time, qreal base, bool *) const;
int advance(int);
@@ -126,20 +126,20 @@ struct QmlTimeLinePrivate
int order;
- QmlTimeLine::SyncMode syncMode;
+ QDeclarativeTimeLine::SyncMode syncMode;
int syncAdj;
QList<QPair<int, Update> > *updateQueue;
};
-QmlTimeLinePrivate::QmlTimeLinePrivate(QmlTimeLine *parent)
-: length(0), syncPoint(0), q(parent), clockRunning(false), prevTime(0), order(0), syncMode(QmlTimeLine::LocalSync), syncAdj(0), updateQueue(0)
+QDeclarativeTimeLinePrivate::QDeclarativeTimeLinePrivate(QDeclarativeTimeLine *parent)
+: length(0), syncPoint(0), q(parent), clockRunning(false), prevTime(0), order(0), syncMode(QDeclarativeTimeLine::LocalSync), syncAdj(0), updateQueue(0)
{
}
-void QmlTimeLinePrivate::add(QmlTimeLineObject &g, const Op &o)
+void QDeclarativeTimeLinePrivate::add(QDeclarativeTimeLineObject &g, const Op &o)
{
if (g._t && g._t != q) {
- qWarning() << "QmlTimeLine: Cannot modify a QmlTimeLineValue owned by"
+ qWarning() << "QDeclarativeTimeLine: Cannot modify a QDeclarativeTimeLineValue owned by"
<< "another timeline.";
return;
}
@@ -169,14 +169,14 @@ void QmlTimeLinePrivate::add(QmlTimeLineObject &g, const Op &o)
prevTime = 0;
clockRunning = true;
- if (syncMode == QmlTimeLine::LocalSync) {
+ if (syncMode == QDeclarativeTimeLine::LocalSync) {
syncAdj = -1;
} else {
syncAdj = 0;
}
q->start();
/* q->tick(0);
- if (syncMode == QmlTimeLine::LocalSync) {
+ if (syncMode == QDeclarativeTimeLine::LocalSync) {
syncAdj = -1;
} else {
syncAdj = 0;
@@ -185,7 +185,7 @@ void QmlTimeLinePrivate::add(QmlTimeLineObject &g, const Op &o)
}
}
-qreal QmlTimeLinePrivate::value(const Op &op, int time, qreal base, bool *changed) const
+qreal QDeclarativeTimeLinePrivate::value(const Op &op, int time, qreal base, bool *changed) const
{
Q_ASSERT(time >= 0);
Q_ASSERT(time <= op.length);
@@ -254,28 +254,28 @@ qreal QmlTimeLinePrivate::value(const Op &op, int time, qreal base, bool *change
/*!
\internal
- \class QmlTimeLine
+ \class QDeclarativeTimeLine
\ingroup group_animation
- \brief The QmlTimeLine class provides a timeline for controlling animations.
+ \brief The QDeclarativeTimeLine class provides a timeline for controlling animations.
- QmlTimeLine is similar to QTimeLine except:
+ QDeclarativeTimeLine is similar to QTimeLine except:
\list
- \i It updates QmlTimeLineValue instances directly, rather than maintaining a single
+ \i It updates QDeclarativeTimeLineValue instances directly, rather than maintaining a single
current value.
For example, the following animates a simple value over 200 milliseconds:
\code
- QmlTimeLineValue v(<starting value>);
- QmlTimeLine tl;
+ QDeclarativeTimeLineValue v(<starting value>);
+ QDeclarativeTimeLine tl;
tl.move(v, 100., 200);
tl.start()
\endcode
If your program needs to know when values are changed, it can either
- connect to the QmlTimeLine's updated() signal, or inherit from QmlTimeLineValue
- and reimplement the QmlTimeLineValue::setValue() method.
+ connect to the QDeclarativeTimeLine's updated() signal, or inherit from QDeclarativeTimeLineValue
+ and reimplement the QDeclarativeTimeLineValue::setValue() method.
- \i Supports multiple QmlTimeLineValue, arbitrary start and end values and allows
+ \i Supports multiple QDeclarativeTimeLineValue, arbitrary start and end values and allows
animations to be strung together for more complex effects.
For example, the following animation moves the x and y coordinates of
@@ -284,10 +284,10 @@ qreal QmlTimeLinePrivate::value(const Op &op, int time, qreal base, bool *change
milliseconds:
\code
- QmlTimeLineValue x(<starting value>);
- QmlTimeLineValue y(<starting value>);
+ QDeclarativeTimeLineValue x(<starting value>);
+ QDeclarativeTimeLineValue y(<starting value>);
- QmlTimeLine tl;
+ QDeclarativeTimeLine tl;
tl.start();
tl.move(x, 100., 50);
@@ -295,12 +295,12 @@ qreal QmlTimeLinePrivate::value(const Op &op, int time, qreal base, bool *change
tl.move(y, 200., 50);
\endcode
- \i All QmlTimeLine instances share a single, synchronized clock.
+ \i All QDeclarativeTimeLine instances share a single, synchronized clock.
Actions scheduled within the same event loop tick are scheduled
synchronously against each other, regardless of the wall time between the
scheduling. Synchronized scheduling applies both to within the same
- QmlTimeLine and across separate QmlTimeLine's within the same process.
+ QDeclarativeTimeLine and across separate QDeclarativeTimeLine's within the same process.
\endlist
@@ -309,21 +309,21 @@ qreal QmlTimeLinePrivate::value(const Op &op, int time, qreal base, bool *change
/*!
- Construct a new QmlTimeLine with the specified \a parent.
+ Construct a new QDeclarativeTimeLine with the specified \a parent.
*/
-QmlTimeLine::QmlTimeLine(QObject *parent)
+QDeclarativeTimeLine::QDeclarativeTimeLine(QObject *parent)
: QAbstractAnimation(parent)
{
- d = new QmlTimeLinePrivate(this);
+ d = new QDeclarativeTimeLinePrivate(this);
}
/*!
Destroys the time line. Any inprogress animations are canceled, but not
completed.
*/
-QmlTimeLine::~QmlTimeLine()
+QDeclarativeTimeLine::~QDeclarativeTimeLine()
{
- for (QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
+ for (QDeclarativeTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
iter != d->ops.end();
++iter)
iter.key()->_t = 0;
@@ -332,13 +332,13 @@ QmlTimeLine::~QmlTimeLine()
}
/*!
- \enum QmlTimeLine::SyncMode
+ \enum QDeclarativeTimeLine::SyncMode
*/
/*!
Return the timeline's synchronization mode.
*/
-QmlTimeLine::SyncMode QmlTimeLine::syncMode() const
+QDeclarativeTimeLine::SyncMode QDeclarativeTimeLine::syncMode() const
{
return d->syncMode;
}
@@ -346,7 +346,7 @@ QmlTimeLine::SyncMode QmlTimeLine::syncMode() const
/*!
Set the timeline's synchronization mode to \a syncMode.
*/
-void QmlTimeLine::setSyncMode(SyncMode syncMode)
+void QDeclarativeTimeLine::setSyncMode(SyncMode syncMode)
{
d->syncMode = syncMode;
}
@@ -354,45 +354,45 @@ void QmlTimeLine::setSyncMode(SyncMode syncMode)
/*!
Pause \a obj for \a time milliseconds.
*/
-void QmlTimeLine::pause(QmlTimeLineObject &obj, int time)
+void QDeclarativeTimeLine::pause(QDeclarativeTimeLineObject &obj, int time)
{
if (time <= 0) return;
- QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Pause, time, 0., 0., d->order++);
+ QDeclarativeTimeLinePrivate::Op op(QDeclarativeTimeLinePrivate::Op::Pause, time, 0., 0., d->order++);
d->add(obj, op);
}
/*!
Execute the \a event.
*/
-void QmlTimeLine::callback(const QmlTimeLineCallback &callback)
+void QDeclarativeTimeLine::callback(const QDeclarativeTimeLineCallback &callback)
{
- QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Execute, 0, 0, 0., d->order++, callback);
+ QDeclarativeTimeLinePrivate::Op op(QDeclarativeTimeLinePrivate::Op::Execute, 0, 0, 0., d->order++, callback);
d->add(*callback.callbackObject(), op);
}
/*!
Set the \a value of \a timeLineValue.
*/
-void QmlTimeLine::set(QmlTimeLineValue &timeLineValue, qreal value)
+void QDeclarativeTimeLine::set(QDeclarativeTimeLineValue &timeLineValue, qreal value)
{
- QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Set, 0, value, 0., d->order++);
+ QDeclarativeTimeLinePrivate::Op op(QDeclarativeTimeLinePrivate::Op::Set, 0, value, 0., d->order++);
d->add(timeLineValue, op);
}
/*!
Decelerate \a timeLineValue from the starting \a velocity to zero at the
given \a acceleration rate. Although the \a acceleration is technically
- a deceleration, it should always be positive. The QmlTimeLine will ensure
+ a deceleration, it should always be positive. The QDeclarativeTimeLine will ensure
that the deceleration is in the opposite direction to the initial velocity.
*/
-int QmlTimeLine::accel(QmlTimeLineValue &timeLineValue, qreal velocity, qreal acceleration)
+int QDeclarativeTimeLine::accel(QDeclarativeTimeLineValue &timeLineValue, qreal velocity, qreal acceleration)
{
if ((velocity > 0.0f) == (acceleration > 0.0f))
acceleration = acceleration * -1.0f;
int time = static_cast<int>(-1000 * velocity / acceleration);
- QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Accel, time, velocity, acceleration, d->order++);
+ QDeclarativeTimeLinePrivate::Op op(QDeclarativeTimeLinePrivate::Op::Accel, time, velocity, acceleration, d->order++);
d->add(timeLineValue, op);
return time;
@@ -404,11 +404,11 @@ int QmlTimeLine::accel(QmlTimeLineValue &timeLineValue, qreal velocity, qreal ac
Decelerate \a timeLineValue from the starting \a velocity to zero at the
given \a acceleration rate over a maximum distance of maxDistance.
- If necessary, QmlTimeLine will reduce the acceleration to ensure that the
+ If necessary, QDeclarativeTimeLine will reduce the acceleration to ensure that the
entire operation does not require a move of more than \a maxDistance.
\a maxDistance should always be positive.
*/
-int QmlTimeLine::accel(QmlTimeLineValue &timeLineValue, qreal velocity, qreal acceleration, qreal maxDistance)
+int QDeclarativeTimeLine::accel(QDeclarativeTimeLineValue &timeLineValue, qreal velocity, qreal acceleration, qreal maxDistance)
{
Q_ASSERT(acceleration >= 0.0f && maxDistance >= 0.0f);
@@ -421,7 +421,7 @@ int QmlTimeLine::accel(QmlTimeLineValue &timeLineValue, qreal velocity, qreal ac
int time = static_cast<int>(-1000 * velocity / acceleration);
- QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Accel, time, velocity, acceleration, d->order++);
+ QDeclarativeTimeLinePrivate::Op op(QDeclarativeTimeLinePrivate::Op::Accel, time, velocity, acceleration, d->order++);
d->add(timeLineValue, op);
return time;
@@ -429,12 +429,12 @@ int QmlTimeLine::accel(QmlTimeLineValue &timeLineValue, qreal velocity, qreal ac
/*!
Decelerate \a timeLineValue from the starting \a velocity to zero over the given
- \a distance. This is like accel(), but the QmlTimeLine calculates the exact
+ \a distance. This is like accel(), but the QDeclarativeTimeLine calculates the exact
deceleration to use.
\a distance should be positive.
*/
-int QmlTimeLine::accelDistance(QmlTimeLineValue &timeLineValue, qreal velocity, qreal distance)
+int QDeclarativeTimeLine::accelDistance(QDeclarativeTimeLineValue &timeLineValue, qreal velocity, qreal distance)
{
if (distance == 0.0f || velocity == 0.0f)
return -1;
@@ -442,7 +442,7 @@ int QmlTimeLine::accelDistance(QmlTimeLineValue &timeLineValue, qreal velocity,
int time = static_cast<int>(1000 * (2.0f * distance) / velocity);
- QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::AccelDistance, time, velocity, distance, d->order++);
+ QDeclarativeTimeLinePrivate::Op op(QDeclarativeTimeLinePrivate::Op::AccelDistance, time, velocity, distance, d->order++);
d->add(timeLineValue, op);
return time;
@@ -452,10 +452,10 @@ int QmlTimeLine::accelDistance(QmlTimeLineValue &timeLineValue, qreal velocity,
Linearly change the \a timeLineValue from its current value to the given
\a destination value over \a time milliseconds.
*/
-void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, int time)
+void QDeclarativeTimeLine::move(QDeclarativeTimeLineValue &timeLineValue, qreal destination, int time)
{
if (time <= 0) return;
- QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Move, time, destination, 0.0f, d->order++);
+ QDeclarativeTimeLinePrivate::Op op(QDeclarativeTimeLinePrivate::Op::Move, time, destination, 0.0f, d->order++);
d->add(timeLineValue, op);
}
@@ -463,10 +463,10 @@ void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, int t
Change the \a timeLineValue from its current value to the given \a destination
value over \a time milliseconds using the \a easing curve.
*/
-void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, const QEasingCurve &easing, int time)
+void QDeclarativeTimeLine::move(QDeclarativeTimeLineValue &timeLineValue, qreal destination, const QEasingCurve &easing, int time)
{
if (time <= 0) return;
- QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::Move, time, destination, 0.0f, d->order++, QmlTimeLineCallback(), easing);
+ QDeclarativeTimeLinePrivate::Op op(QDeclarativeTimeLinePrivate::Op::Move, time, destination, 0.0f, d->order++, QDeclarativeTimeLineCallback(), easing);
d->add(timeLineValue, op);
}
@@ -474,10 +474,10 @@ void QmlTimeLine::move(QmlTimeLineValue &timeLineValue, qreal destination, const
Linearly change the \a timeLineValue from its current value by the \a change amount
over \a time milliseconds.
*/
-void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, int time)
+void QDeclarativeTimeLine::moveBy(QDeclarativeTimeLineValue &timeLineValue, qreal change, int time)
{
if (time <= 0) return;
- QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::MoveBy, time, change, 0.0f, d->order++);
+ QDeclarativeTimeLinePrivate::Op op(QDeclarativeTimeLinePrivate::Op::MoveBy, time, change, 0.0f, d->order++);
d->add(timeLineValue, op);
}
@@ -485,29 +485,29 @@ void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, int time
Change the \a timeLineValue from its current value by the \a change amount over
\a time milliseconds using the \a easing curve.
*/
-void QmlTimeLine::moveBy(QmlTimeLineValue &timeLineValue, qreal change, const QEasingCurve &easing, int time)
+void QDeclarativeTimeLine::moveBy(QDeclarativeTimeLineValue &timeLineValue, qreal change, const QEasingCurve &easing, int time)
{
if (time <= 0) return;
- QmlTimeLinePrivate::Op op(QmlTimeLinePrivate::Op::MoveBy, time, change, 0.0f, d->order++, QmlTimeLineCallback(), easing);
+ QDeclarativeTimeLinePrivate::Op op(QDeclarativeTimeLinePrivate::Op::MoveBy, time, change, 0.0f, d->order++, QDeclarativeTimeLineCallback(), easing);
d->add(timeLineValue, op);
}
/*!
Cancel (but don't complete) all scheduled actions for \a timeLineValue.
*/
-void QmlTimeLine::reset(QmlTimeLineValue &timeLineValue)
+void QDeclarativeTimeLine::reset(QDeclarativeTimeLineValue &timeLineValue)
{
if (!timeLineValue._t)
return;
if (timeLineValue._t != this) {
- qWarning() << "QmlTimeLine: Cannot reset a QmlTimeLineValue owned by another timeline.";
+ qWarning() << "QDeclarativeTimeLine: Cannot reset a QDeclarativeTimeLineValue owned by another timeline.";
return;
}
remove(&timeLineValue);
timeLineValue._t = 0;
}
-int QmlTimeLine::duration() const
+int QDeclarativeTimeLine::duration() const
{
return -1;
}
@@ -520,12 +520,12 @@ int QmlTimeLine::duration() const
all the currently scheduled actions on \a syncTo are complete. In
psuedo-code this is equivalent to:
\code
- QmlTimeLine::pause(timeLineValue, min(0, length_of(syncTo) - length_of(timeLineValue)))
+ QDeclarativeTimeLine::pause(timeLineValue, min(0, length_of(syncTo) - length_of(timeLineValue)))
\endcode
*/
-void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue, QmlTimeLineValue &syncTo)
+void QDeclarativeTimeLine::sync(QDeclarativeTimeLineValue &timeLineValue, QDeclarativeTimeLineValue &syncTo)
{
- QmlTimeLinePrivate::Ops::Iterator iter = d->ops.find(&syncTo);
+ QDeclarativeTimeLinePrivate::Ops::Iterator iter = d->ops.find(&syncTo);
if (iter == d->ops.end())
return;
int length = iter->length;
@@ -545,12 +545,12 @@ void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue, QmlTimeLineValue &syncTo
In psuedo-code, this is equivalent to:
\code
- QmlTimeLine::pause(timeLineValue, length_of(timeline) - length_of(timeLineValue))
+ QDeclarativeTimeLine::pause(timeLineValue, length_of(timeline) - length_of(timeLineValue))
\endcode
*/
-void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue)
+void QDeclarativeTimeLine::sync(QDeclarativeTimeLineValue &timeLineValue)
{
- QmlTimeLinePrivate::Ops::Iterator iter = d->ops.find(&timeLineValue);
+ QDeclarativeTimeLinePrivate::Ops::Iterator iter = d->ops.find(&timeLineValue);
if (iter == d->ops.end()) {
pause(timeLineValue, d->length);
} else {
@@ -567,7 +567,7 @@ void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue)
value1->setValue(0.);
value2->setValue(0.);
value3->setValue(0.);
- QmlTimeLine tl;
+ QDeclarativeTimeLine tl;
...
tl.move(value1, 10, 200);
tl.move(value2, 10, 100);
@@ -586,9 +586,9 @@ void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue)
\endtable
*/
-/*void QmlTimeLine::sync()
+/*void QDeclarativeTimeLine::sync()
{
- for (QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
+ for (QDeclarativeTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
iter != d->ops.end();
++iter)
pause(*iter.key(), d->length - iter->length);
@@ -600,7 +600,7 @@ void QmlTimeLine::sync(QmlTimeLineValue &timeLineValue)
Temporary hack.
*/
-void QmlTimeLine::setSyncPoint(int sp)
+void QDeclarativeTimeLine::setSyncPoint(int sp)
{
d->syncPoint = sp;
}
@@ -610,16 +610,16 @@ void QmlTimeLine::setSyncPoint(int sp)
Temporary hack.
*/
-int QmlTimeLine::syncPoint() const
+int QDeclarativeTimeLine::syncPoint() const
{
return d->syncPoint;
}
/*!
Returns true if the timeline is active. An active timeline is one where
- QmlTimeLineValue actions are still pending.
+ QDeclarativeTimeLineValue actions are still pending.
*/
-bool QmlTimeLine::isActive() const
+bool QDeclarativeTimeLine::isActive() const
{
return !d->ops.isEmpty();
}
@@ -627,8 +627,8 @@ bool QmlTimeLine::isActive() const
/*!
Completes the timeline. All queued actions are played to completion, and then discarded. For example,
\code
- QmlTimeLineValue v(0.);
- QmlTimeLine tl;
+ QDeclarativeTimeLineValue v(0.);
+ QDeclarativeTimeLine tl;
tl.move(v, 100., 1000.);
// 500 ms passes
// v.value() == 50.
@@ -636,16 +636,16 @@ bool QmlTimeLine::isActive() const
// v.value() == 100.
\endcode
*/
-void QmlTimeLine::complete()
+void QDeclarativeTimeLine::complete()
{
d->advance(d->length);
}
/*!
- Resets the timeline. All queued actions are discarded and QmlTimeLineValue's retain their current value. For example,
+ Resets the timeline. All queued actions are discarded and QDeclarativeTimeLineValue's retain their current value. For example,
\code
- QmlTimeLineValue v(0.);
- QmlTimeLine tl;
+ QDeclarativeTimeLineValue v(0.);
+ QDeclarativeTimeLine tl;
tl.move(v, 100., 1000.);
// 500 ms passes
// v.value() == 50.
@@ -653,9 +653,9 @@ void QmlTimeLine::complete()
// v.value() == 50.
\endcode
*/
-void QmlTimeLine::clear()
+void QDeclarativeTimeLine::clear()
{
- for (QmlTimeLinePrivate::Ops::ConstIterator iter = d->ops.begin(); iter != d->ops.end(); ++iter)
+ for (QDeclarativeTimeLinePrivate::Ops::ConstIterator iter = d->ops.begin(); iter != d->ops.end(); ++iter)
iter.key()->_t = 0;
d->ops.clear();
d->length = 0;
@@ -663,19 +663,19 @@ void QmlTimeLine::clear()
//XXX need stop here?
}
-int QmlTimeLine::time() const
+int QDeclarativeTimeLine::time() const
{
return d->prevTime;
}
/*!
- \fn void QmlTimeLine::updated()
+ \fn void QDeclarativeTimeLine::updated()
- Emitted each time the timeline modifies QmlTimeLineValues. Even if multiple
- QmlTimeLineValues are changed, this signal is only emitted once for each clock tick.
+ Emitted each time the timeline modifies QDeclarativeTimeLineValues. Even if multiple
+ QDeclarativeTimeLineValues are changed, this signal is only emitted once for each clock tick.
*/
-void QmlTimeLine::updateCurrentTime(int v)
+void QDeclarativeTimeLine::updateCurrentTime(int v)
{
if (d->syncAdj == -1)
d->syncAdj = v;
@@ -717,7 +717,7 @@ bool operator<(const QPair<int, Update> &lhs,
return lhs.first < rhs.first;
}
-int QmlTimeLinePrivate::advance(int t)
+int QDeclarativeTimeLinePrivate::advance(int t)
{
int pauseTime = -1;
@@ -744,7 +744,7 @@ int QmlTimeLinePrivate::advance(int t)
QList<QPair<int, Update> > updates;
for (Ops::Iterator iter = ops.begin(); iter != ops.end(); ) {
- QmlTimeLineValue *v = static_cast<QmlTimeLineValue *>(iter.key());
+ QDeclarativeTimeLineValue *v = static_cast<QDeclarativeTimeLineValue *>(iter.key());
TimeLine &tl = *iter;
Q_ASSERT(!tl.ops.isEmpty());
@@ -817,9 +817,9 @@ int QmlTimeLinePrivate::advance(int t)
return pauseTime;
}
-void QmlTimeLine::remove(QmlTimeLineObject *v)
+void QDeclarativeTimeLine::remove(QDeclarativeTimeLineObject *v)
{
- QmlTimeLinePrivate::Ops::Iterator iter = d->ops.find(v);
+ QDeclarativeTimeLinePrivate::Ops::Iterator iter = d->ops.find(v);
Q_ASSERT(iter != d->ops.end());
int len = iter->length;
@@ -827,7 +827,7 @@ void QmlTimeLine::remove(QmlTimeLineObject *v)
if (len == d->length) {
// We need to recalculate the length
d->length = 0;
- for (QmlTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
+ for (QDeclarativeTimeLinePrivate::Ops::Iterator iter = d->ops.begin();
iter != d->ops.end();
++iter) {
@@ -844,7 +844,7 @@ void QmlTimeLine::remove(QmlTimeLineObject *v)
d->prevTime = 0;
d->clockRunning = true;
- if (d->syncMode == QmlTimeLine::LocalSync) {
+ if (d->syncMode == QDeclarativeTimeLine::LocalSync) {
d->syncAdj = -1;
} else {
d->syncAdj = 0;
@@ -867,43 +867,43 @@ void QmlTimeLine::remove(QmlTimeLineObject *v)
/*!
\internal
- \class QmlTimeLineValue
+ \class QDeclarativeTimeLineValue
\ingroup group_animation
- \brief The QmlTimeLineValue class provides a value that can be modified by QmlTimeLine.
+ \brief The QDeclarativeTimeLineValue class provides a value that can be modified by QDeclarativeTimeLine.
*/
/*!
- \fn QmlTimeLineValue::QmlTimeLineValue(qreal value = 0)
+ \fn QDeclarativeTimeLineValue::QDeclarativeTimeLineValue(qreal value = 0)
- Construct a new QmlTimeLineValue with an initial \a value.
+ Construct a new QDeclarativeTimeLineValue with an initial \a value.
*/
/*!
- \fn qreal QmlTimeLineValue::value() const
+ \fn qreal QDeclarativeTimeLineValue::value() const
Return the current value.
*/
/*!
- \fn void QmlTimeLineValue::setValue(qreal value)
+ \fn void QDeclarativeTimeLineValue::setValue(qreal value)
Set the current \a value.
*/
/*!
- \fn QmlTimeLine *QmlTimeLineValue::timeLine() const
+ \fn QDeclarativeTimeLine *QDeclarativeTimeLineValue::timeLine() const
- If a QmlTimeLine is operating on this value, return a pointer to it,
+ If a QDeclarativeTimeLine is operating on this value, return a pointer to it,
otherwise return null.
*/
-QmlTimeLineObject::QmlTimeLineObject()
+QDeclarativeTimeLineObject::QDeclarativeTimeLineObject()
: _t(0)
{
}
-QmlTimeLineObject::~QmlTimeLineObject()
+QDeclarativeTimeLineObject::~QDeclarativeTimeLineObject()
{
if (_t) {
_t->remove(this);
@@ -911,22 +911,22 @@ QmlTimeLineObject::~QmlTimeLineObject()
}
}
-QmlTimeLineCallback::QmlTimeLineCallback()
+QDeclarativeTimeLineCallback::QDeclarativeTimeLineCallback()
: d0(0), d1(0), d2(0)
{
}
-QmlTimeLineCallback::QmlTimeLineCallback(QmlTimeLineObject *b, Callback f, void *d)
+QDeclarativeTimeLineCallback::QDeclarativeTimeLineCallback(QDeclarativeTimeLineObject *b, Callback f, void *d)
: d0(f), d1(d), d2(b)
{
}
-QmlTimeLineCallback::QmlTimeLineCallback(const QmlTimeLineCallback &o)
+QDeclarativeTimeLineCallback::QDeclarativeTimeLineCallback(const QDeclarativeTimeLineCallback &o)
: d0(o.d0), d1(o.d1), d2(o.d2)
{
}
-QmlTimeLineCallback &QmlTimeLineCallback::operator=(const QmlTimeLineCallback &o)
+QDeclarativeTimeLineCallback &QDeclarativeTimeLineCallback::operator=(const QDeclarativeTimeLineCallback &o)
{
d0 = o.d0;
d1 = o.d1;
@@ -934,7 +934,7 @@ QmlTimeLineCallback &QmlTimeLineCallback::operator=(const QmlTimeLineCallback &o
return *this;
}
-QmlTimeLineObject *QmlTimeLineCallback::callbackObject() const
+QDeclarativeTimeLineObject *QDeclarativeTimeLineCallback::callbackObject() const
{
return d2;
}
diff --git a/src/declarative/util/qmltimeline_p_p.h b/src/declarative/util/qdeclarativetimeline_p_p.h
index 076355d..c08c07c 100644
--- a/src/declarative/util/qmltimeline_p_p.h
+++ b/src/declarative/util/qdeclarativetimeline_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLTIMELINE_H
-#define QMLTIMELINE_H
+#ifndef QDECLARATIVETIMELINE_H
+#define QDECLARATIVETIMELINE_H
//
// W A R N I N G
@@ -59,42 +59,42 @@
QT_BEGIN_NAMESPACE
class QEasingCurve;
-class QmlTimeLineValue;
-class QmlTimeLineCallback;
-struct QmlTimeLinePrivate;
-class QmlTimeLineObject;
-class QmlTimeLine : public QAbstractAnimation
+class QDeclarativeTimeLineValue;
+class QDeclarativeTimeLineCallback;
+struct QDeclarativeTimeLinePrivate;
+class QDeclarativeTimeLineObject;
+class QDeclarativeTimeLine : public QAbstractAnimation
{
Q_OBJECT
public:
- QmlTimeLine(QObject *parent = 0);
- ~QmlTimeLine();
+ QDeclarativeTimeLine(QObject *parent = 0);
+ ~QDeclarativeTimeLine();
enum SyncMode { LocalSync, GlobalSync };
SyncMode syncMode() const;
void setSyncMode(SyncMode);
- void pause(QmlTimeLineObject &, int);
- void callback(const QmlTimeLineCallback &);
- void set(QmlTimeLineValue &, qreal);
+ void pause(QDeclarativeTimeLineObject &, int);
+ void callback(const QDeclarativeTimeLineCallback &);
+ void set(QDeclarativeTimeLineValue &, qreal);
- int accel(QmlTimeLineValue &, qreal velocity, qreal accel);
- int accel(QmlTimeLineValue &, qreal velocity, qreal accel, qreal maxDistance);
- int accelDistance(QmlTimeLineValue &, qreal velocity, qreal distance);
+ int accel(QDeclarativeTimeLineValue &, qreal velocity, qreal accel);
+ int accel(QDeclarativeTimeLineValue &, qreal velocity, qreal accel, qreal maxDistance);
+ int accelDistance(QDeclarativeTimeLineValue &, qreal velocity, qreal distance);
- void move(QmlTimeLineValue &, qreal destination, int time = 500);
- void move(QmlTimeLineValue &, qreal destination, const QEasingCurve &, int time = 500);
- void moveBy(QmlTimeLineValue &, qreal change, int time = 500);
- void moveBy(QmlTimeLineValue &, qreal change, const QEasingCurve &, int time = 500);
+ void move(QDeclarativeTimeLineValue &, qreal destination, int time = 500);
+ void move(QDeclarativeTimeLineValue &, qreal destination, const QEasingCurve &, int time = 500);
+ void moveBy(QDeclarativeTimeLineValue &, qreal change, int time = 500);
+ void moveBy(QDeclarativeTimeLineValue &, qreal change, const QEasingCurve &, int time = 500);
void sync();
void setSyncPoint(int);
int syncPoint() const;
- void sync(QmlTimeLineValue &);
- void sync(QmlTimeLineValue &, QmlTimeLineValue &);
+ void sync(QDeclarativeTimeLineValue &);
+ void sync(QDeclarativeTimeLineValue &, QDeclarativeTimeLineValue &);
- void reset(QmlTimeLineValue &);
+ void reset(QDeclarativeTimeLineValue &);
void complete();
void clear();
@@ -111,80 +111,80 @@ protected:
virtual void updateCurrentTime(int);
private:
- void remove(QmlTimeLineObject *);
- friend class QmlTimeLineObject;
- friend struct QmlTimeLinePrivate;
- QmlTimeLinePrivate *d;
+ void remove(QDeclarativeTimeLineObject *);
+ friend class QDeclarativeTimeLineObject;
+ friend struct QDeclarativeTimeLinePrivate;
+ QDeclarativeTimeLinePrivate *d;
};
-class QmlTimeLineObject
+class QDeclarativeTimeLineObject
{
public:
- QmlTimeLineObject();
- virtual ~QmlTimeLineObject();
+ QDeclarativeTimeLineObject();
+ virtual ~QDeclarativeTimeLineObject();
protected:
- friend class QmlTimeLine;
- friend struct QmlTimeLinePrivate;
- QmlTimeLine *_t;
+ friend class QDeclarativeTimeLine;
+ friend struct QDeclarativeTimeLinePrivate;
+ QDeclarativeTimeLine *_t;
};
-class QmlTimeLineValue : public QmlTimeLineObject
+class QDeclarativeTimeLineValue : public QDeclarativeTimeLineObject
{
public:
- QmlTimeLineValue(qreal v = 0.) : _v(v) {}
+ QDeclarativeTimeLineValue(qreal v = 0.) : _v(v) {}
virtual qreal value() const { return _v; }
virtual void setValue(qreal v) { _v = v; }
- QmlTimeLine *timeLine() const { return _t; }
+ QDeclarativeTimeLine *timeLine() const { return _t; }
operator qreal() const { return _v; }
- QmlTimeLineValue &operator=(qreal v) { setValue(v); return *this; }
+ QDeclarativeTimeLineValue &operator=(qreal v) { setValue(v); return *this; }
private:
- friend class QmlTimeLine;
- friend struct QmlTimeLinePrivate;
+ friend class QDeclarativeTimeLine;
+ friend struct QDeclarativeTimeLinePrivate;
qreal _v;
};
-class QmlTimeLineCallback
+class QDeclarativeTimeLineCallback
{
public:
typedef void (*Callback)(void *);
- QmlTimeLineCallback();
- QmlTimeLineCallback(QmlTimeLineObject *b, Callback, void * = 0);
- QmlTimeLineCallback(const QmlTimeLineCallback &o);
+ QDeclarativeTimeLineCallback();
+ QDeclarativeTimeLineCallback(QDeclarativeTimeLineObject *b, Callback, void * = 0);
+ QDeclarativeTimeLineCallback(const QDeclarativeTimeLineCallback &o);
- QmlTimeLineCallback &operator=(const QmlTimeLineCallback &o);
- QmlTimeLineObject *callbackObject() const;
+ QDeclarativeTimeLineCallback &operator=(const QDeclarativeTimeLineCallback &o);
+ QDeclarativeTimeLineObject *callbackObject() const;
private:
- friend class QmlTimeLinePrivate;
+ friend class QDeclarativeTimeLinePrivate;
Callback d0;
void *d1;
- QmlTimeLineObject *d2;
+ QDeclarativeTimeLineObject *d2;
};
template<class T>
-class QmlTimeLineValueProxy : public QmlTimeLineValue
+class QDeclarativeTimeLineValueProxy : public QDeclarativeTimeLineValue
{
public:
- QmlTimeLineValueProxy(T *cls, void (T::*func)(qreal), qreal v = 0.)
- : QmlTimeLineValue(v), _class(cls), _setFunctionReal(func), _setFunctionInt(0)
+ QDeclarativeTimeLineValueProxy(T *cls, void (T::*func)(qreal), qreal v = 0.)
+ : QDeclarativeTimeLineValue(v), _class(cls), _setFunctionReal(func), _setFunctionInt(0)
{
Q_ASSERT(_class);
}
- QmlTimeLineValueProxy(T *cls, void (T::*func)(int), qreal v = 0.)
- : QmlTimeLineValue(v), _class(cls), _setFunctionReal(0), _setFunctionInt(func)
+ QDeclarativeTimeLineValueProxy(T *cls, void (T::*func)(int), qreal v = 0.)
+ : QDeclarativeTimeLineValue(v), _class(cls), _setFunctionReal(0), _setFunctionInt(func)
{
Q_ASSERT(_class);
}
virtual void setValue(qreal v)
{
- QmlTimeLineValue::setValue(v);
+ QDeclarativeTimeLineValue::setValue(v);
if (_setFunctionReal) (_class->*_setFunctionReal)(v);
else if (_setFunctionInt) (_class->*_setFunctionInt)((int)v);
}
diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qdeclarativetimer.cpp
index d3a1a7c..89c461b 100644
--- a/src/declarative/util/qmltimer.cpp
+++ b/src/declarative/util/qdeclarativetimer.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmltimer_p.h"
+#include "qdeclarativetimer_p.h"
#include <QtCore/qcoreapplication.h>
#include <QtCore/qpauseanimation.h>
@@ -49,13 +49,13 @@
QT_BEGIN_NAMESPACE
-QML_DEFINE_TYPE(Qt,4,6,Timer,QmlTimer)
-class QmlTimerPrivate : public QObjectPrivate
+
+class QDeclarativeTimerPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlTimer)
+ Q_DECLARE_PUBLIC(QDeclarativeTimer)
public:
- QmlTimerPrivate()
+ QDeclarativeTimerPrivate()
: interval(1000), running(false), repeating(false), triggeredOnStart(false)
, classBegun(false), componentComplete(false), firstTick(true) {}
int interval;
@@ -69,7 +69,7 @@ public:
};
/*!
- \qmlclass Timer QmlTimer
+ \qmlclass Timer QDeclarativeTimer
\brief The Timer item triggers a handler at a specified interval.
A timer can be used to trigger an action either once, or repeatedly
@@ -88,8 +88,8 @@ public:
}
\endqml
- QmlTimer is synchronized with the animation timer. Since the animation
- timer is usually set to 60fps, the resolution of QmlTimer will be
+ QDeclarativeTimer is synchronized with the animation timer. Since the animation
+ timer is usually set to 60fps, the resolution of QDeclarativeTimer will be
at best 16ms.
If the Timer is running and one of its properties is changed, the
@@ -99,10 +99,10 @@ public:
1000ms later.
*/
-QmlTimer::QmlTimer(QObject *parent)
- : QObject(*(new QmlTimerPrivate), parent)
+QDeclarativeTimer::QDeclarativeTimer(QObject *parent)
+ : QObject(*(new QDeclarativeTimerPrivate), parent)
{
- Q_D(QmlTimer);
+ Q_D(QDeclarativeTimer);
connect(&d->pause, SIGNAL(currentLoopChanged(int)), this, SLOT(ticked()));
connect(&d->pause, SIGNAL(finished()), this, SLOT(finished()));
d->pause.setLoopCount(1);
@@ -116,18 +116,18 @@ QmlTimer::QmlTimer(QObject *parent)
The default interval is 1000 milliseconds.
*/
-void QmlTimer::setInterval(int interval)
+void QDeclarativeTimer::setInterval(int interval)
{
- Q_D(QmlTimer);
+ Q_D(QDeclarativeTimer);
if (interval != d->interval) {
d->interval = interval;
update();
}
}
-int QmlTimer::interval() const
+int QDeclarativeTimer::interval() const
{
- Q_D(const QmlTimer);
+ Q_D(const QDeclarativeTimer);
return d->interval;
}
@@ -142,15 +142,15 @@ int QmlTimer::interval() const
\sa repeat
*/
-bool QmlTimer::isRunning() const
+bool QDeclarativeTimer::isRunning() const
{
- Q_D(const QmlTimer);
+ Q_D(const QDeclarativeTimer);
return d->running;
}
-void QmlTimer::setRunning(bool running)
+void QDeclarativeTimer::setRunning(bool running)
{
- Q_D(QmlTimer);
+ Q_D(QDeclarativeTimer);
if (d->running != running) {
d->running = running;
d->firstTick = true;
@@ -170,15 +170,15 @@ void QmlTimer::setRunning(bool running)
\sa running
*/
-bool QmlTimer::isRepeating() const
+bool QDeclarativeTimer::isRepeating() const
{
- Q_D(const QmlTimer);
+ Q_D(const QDeclarativeTimer);
return d->repeating;
}
-void QmlTimer::setRepeating(bool repeating)
+void QDeclarativeTimer::setRepeating(bool repeating)
{
- Q_D(QmlTimer);
+ Q_D(QDeclarativeTimer);
if (repeating != d->repeating) {
d->repeating = repeating;
update();
@@ -202,15 +202,15 @@ void QmlTimer::setRepeating(bool repeating)
\sa running
*/
-bool QmlTimer::triggeredOnStart() const
+bool QDeclarativeTimer::triggeredOnStart() const
{
- Q_D(const QmlTimer);
+ Q_D(const QDeclarativeTimer);
return d->triggeredOnStart;
}
-void QmlTimer::setTriggeredOnStart(bool triggeredOnStart)
+void QDeclarativeTimer::setTriggeredOnStart(bool triggeredOnStart)
{
- Q_D(QmlTimer);
+ Q_D(QDeclarativeTimer);
if (d->triggeredOnStart != triggeredOnStart) {
d->triggeredOnStart = triggeredOnStart;
update();
@@ -224,7 +224,7 @@ void QmlTimer::setTriggeredOnStart(bool triggeredOnStart)
If the timer is already running, calling this method has no effect. The
\c running property will be true following a call to \c start().
*/
-void QmlTimer::start()
+void QDeclarativeTimer::start()
{
setRunning(true);
}
@@ -236,7 +236,7 @@ void QmlTimer::start()
If the timer is not running, calling this method has no effect. The
\c running property will be false following a call to \c stop().
*/
-void QmlTimer::stop()
+void QDeclarativeTimer::stop()
{
setRunning(false);
}
@@ -249,15 +249,15 @@ void QmlTimer::stop()
stopped, reset to initial state and started. The \c running property
will be true following a call to \c restart().
*/
-void QmlTimer::restart()
+void QDeclarativeTimer::restart()
{
setRunning(false);
setRunning(true);
}
-void QmlTimer::update()
+void QDeclarativeTimer::update()
{
- Q_D(QmlTimer);
+ Q_D(QDeclarativeTimer);
if (d->classBegun && !d->componentComplete)
return;
d->pause.stop();
@@ -273,15 +273,15 @@ void QmlTimer::update()
}
}
-void QmlTimer::classBegin()
+void QDeclarativeTimer::classBegin()
{
- Q_D(QmlTimer);
+ Q_D(QDeclarativeTimer);
d->classBegun = true;
}
-void QmlTimer::componentComplete()
+void QDeclarativeTimer::componentComplete()
{
- Q_D(QmlTimer);
+ Q_D(QDeclarativeTimer);
d->componentComplete = true;
update();
}
@@ -291,17 +291,17 @@ void QmlTimer::componentComplete()
This handler is called when the Timer is triggered.
*/
-void QmlTimer::ticked()
+void QDeclarativeTimer::ticked()
{
- Q_D(QmlTimer);
+ Q_D(QDeclarativeTimer);
if (d->running && (d->pause.currentTime() > 0 || (d->triggeredOnStart && d->firstTick)))
emit triggered();
d->firstTick = false;
}
-void QmlTimer::finished()
+void QDeclarativeTimer::finished()
{
- Q_D(QmlTimer);
+ Q_D(QDeclarativeTimer);
if (d->repeating || !d->running)
return;
emit triggered();
diff --git a/src/declarative/util/qmltimer_p.h b/src/declarative/util/qdeclarativetimer_p.h
index d1c5ee5..e063657 100644
--- a/src/declarative/util/qmltimer_p.h
+++ b/src/declarative/util/qdeclarativetimer_p.h
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMLTIMER_H
-#define QMLTIMER_H
+#ifndef QDECLARATIVETIMER_H
+#define QDECLARATIVETIMER_H
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtCore/qobject.h>
#include <QtCore/qabstractanimation.h>
@@ -53,19 +53,19 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlTimerPrivate;
-class Q_DECLARATIVE_EXPORT QmlTimer : public QObject, public QmlParserStatus
+class QDeclarativeTimerPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeTimer : public QObject, public QDeclarativeParserStatus
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlTimer)
- Q_INTERFACES(QmlParserStatus)
+ Q_DECLARE_PRIVATE(QDeclarativeTimer)
+ Q_INTERFACES(QDeclarativeParserStatus)
Q_PROPERTY(int interval READ interval WRITE setInterval)
Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
Q_PROPERTY(bool repeat READ isRepeating WRITE setRepeating)
Q_PROPERTY(bool triggeredOnStart READ triggeredOnStart WRITE setTriggeredOnStart)
public:
- QmlTimer(QObject *parent=0);
+ QDeclarativeTimer(QObject *parent=0);
void setInterval(int interval);
int interval() const;
@@ -102,7 +102,7 @@ private Q_SLOTS:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlTimer)
+QML_DECLARE_TYPE(QDeclarativeTimer)
QT_END_HEADER
diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qdeclarativetransition.cpp
index e2ce417..ac07b10 100644
--- a/src/declarative/util/qmltransition.cpp
+++ b/src/declarative/util/qdeclarativetransition.cpp
@@ -39,20 +39,20 @@
**
****************************************************************************/
-#include "qmlstate_p.h"
-#include "qmlstategroup_p.h"
-#include "qmlstate_p_p.h"
-#include "qmlstateoperations_p.h"
-#include "qmlanimation_p.h"
-#include "qmlanimation_p_p.h"
-#include "qmltransitionmanager_p_p.h"
+#include "qdeclarativestate_p.h"
+#include "qdeclarativestategroup_p.h"
+#include "qdeclarativestate_p_p.h"
+#include "qdeclarativestateoperations_p.h"
+#include "qdeclarativeanimation_p.h"
+#include "qdeclarativeanimation_p_p.h"
+#include "qdeclarativetransitionmanager_p_p.h"
#include <QParallelAnimationGroup>
QT_BEGIN_NAMESPACE
/*!
- \qmlclass Transition QmlTransition
+ \qmlclass Transition QDeclarativeTransition
\since 4.7
\brief The Transition element defines animated transitions that occur on state changes.
@@ -61,8 +61,8 @@ QT_BEGIN_NAMESPACE
/*!
\internal
- \class QmlTransition
- \brief The QmlTransition class allows you to define animated transitions that occur on state changes.
+ \class QDeclarativeTransition
+ \brief The QDeclarativeTransition class allows you to define animated transitions that occur on state changes.
\ingroup group_states
*/
@@ -74,16 +74,16 @@ class ParallelAnimationWrapper : public QParallelAnimationGroup
Q_OBJECT
public:
ParallelAnimationWrapper(QObject *parent = 0) : QParallelAnimationGroup(parent) {}
- QmlTransitionPrivate *trans;
+ QDeclarativeTransitionPrivate *trans;
protected:
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
};
-class QmlTransitionPrivate : public QObjectPrivate
+class QDeclarativeTransitionPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlTransition)
+ Q_DECLARE_PUBLIC(QDeclarativeTransition)
public:
- QmlTransitionPrivate()
+ QDeclarativeTransitionPrivate()
: fromState(QLatin1String("*")), toState(QLatin1String("*")),
reversed(false), reversible(false), endState(0)
{
@@ -95,19 +95,19 @@ public:
bool reversed;
bool reversible;
ParallelAnimationWrapper group;
- QmlTransitionManager *endState;
+ QDeclarativeTransitionManager *endState;
void complete()
{
endState->complete();
}
- static void append_animation(QmlListProperty<QmlAbstractAnimation> *list, QmlAbstractAnimation *a);
- QList<QmlAbstractAnimation *> animations;
+ static void append_animation(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list, QDeclarativeAbstractAnimation *a);
+ QList<QDeclarativeAbstractAnimation *> animations;
};
-void QmlTransitionPrivate::append_animation(QmlListProperty<QmlAbstractAnimation> *list, QmlAbstractAnimation *a)
+void QDeclarativeTransitionPrivate::append_animation(QDeclarativeListProperty<QDeclarativeAbstractAnimation> *list, QDeclarativeAbstractAnimation *a)
{
- QmlTransition *q = static_cast<QmlTransition *>(list->object);
+ QDeclarativeTransition *q = static_cast<QDeclarativeTransition *>(list->object);
q->d_func()->animations.append(a);
q->d_func()->group.addAnimation(a->qtAnimation());
a->setDisableUserControl();
@@ -125,43 +125,43 @@ void ParallelAnimationWrapper::updateState(QAbstractAnimation::State newState, Q
}
-QML_DEFINE_TYPE(Qt,4,6,Transition,QmlTransition)
-QmlTransition::QmlTransition(QObject *parent)
- : QObject(*(new QmlTransitionPrivate), parent)
+
+QDeclarativeTransition::QDeclarativeTransition(QObject *parent)
+ : QObject(*(new QDeclarativeTransitionPrivate), parent)
{
}
-QmlTransition::~QmlTransition()
+QDeclarativeTransition::~QDeclarativeTransition()
{
}
-void QmlTransition::stop()
+void QDeclarativeTransition::stop()
{
- Q_D(QmlTransition);
+ Q_D(QDeclarativeTransition);
d->group.stop();
}
-void QmlTransition::setReversed(bool r)
+void QDeclarativeTransition::setReversed(bool r)
{
- Q_D(QmlTransition);
+ Q_D(QDeclarativeTransition);
d->reversed = r;
}
-void QmlTransition::prepare(QmlStateOperation::ActionList &actions,
- QList<QmlMetaProperty> &after,
- QmlTransitionManager *endState)
+void QDeclarativeTransition::prepare(QDeclarativeStateOperation::ActionList &actions,
+ QList<QDeclarativeProperty> &after,
+ QDeclarativeTransitionManager *endState)
{
- Q_D(QmlTransition);
+ Q_D(QDeclarativeTransition);
qmlExecuteDeferred(this);
if (d->reversed) {
for (int ii = d->animations.count() - 1; ii >= 0; --ii) {
- d->animations.at(ii)->transition(actions, after, QmlAbstractAnimation::Backward);
+ d->animations.at(ii)->transition(actions, after, QDeclarativeAbstractAnimation::Backward);
}
} else {
for (int ii = 0; ii < d->animations.count(); ++ii) {
- d->animations.at(ii)->transition(actions, after, QmlAbstractAnimation::Forward);
+ d->animations.at(ii)->transition(actions, after, QDeclarativeAbstractAnimation::Forward);
}
}
@@ -186,15 +186,15 @@ void QmlTransition::prepare(QmlStateOperation::ActionList &actions,
}
\endcode
*/
-QString QmlTransition::fromState() const
+QString QDeclarativeTransition::fromState() const
{
- Q_D(const QmlTransition);
+ Q_D(const QDeclarativeTransition);
return d->fromState;
}
-void QmlTransition::setFromState(const QString &f)
+void QDeclarativeTransition::setFromState(const QString &f)
{
- Q_D(QmlTransition);
+ Q_D(QDeclarativeTransition);
d->fromState = f;
}
@@ -204,27 +204,27 @@ void QmlTransition::setFromState(const QString &f)
The default value is false.
*/
-bool QmlTransition::reversible() const
+bool QDeclarativeTransition::reversible() const
{
- Q_D(const QmlTransition);
+ Q_D(const QDeclarativeTransition);
return d->reversible;
}
-void QmlTransition::setReversible(bool r)
+void QDeclarativeTransition::setReversible(bool r)
{
- Q_D(QmlTransition);
+ Q_D(QDeclarativeTransition);
d->reversible = r;
}
-QString QmlTransition::toState() const
+QString QDeclarativeTransition::toState() const
{
- Q_D(const QmlTransition);
+ Q_D(const QDeclarativeTransition);
return d->toState;
}
-void QmlTransition::setToState(const QString &t)
+void QDeclarativeTransition::setToState(const QString &t)
{
- Q_D(QmlTransition);
+ Q_D(QDeclarativeTransition);
d->toState = t;
}
@@ -238,12 +238,12 @@ void QmlTransition::setToState(const QString &t)
and assign that to animations the animations property.
\default
*/
-QmlListProperty<QmlAbstractAnimation> QmlTransition::animations()
+QDeclarativeListProperty<QDeclarativeAbstractAnimation> QDeclarativeTransition::animations()
{
- Q_D(QmlTransition);
- return QmlListProperty<QmlAbstractAnimation>(this, &d->animations, QmlTransitionPrivate::append_animation);
+ Q_D(QDeclarativeTransition);
+ return QDeclarativeListProperty<QDeclarativeAbstractAnimation>(this, &d->animations, QDeclarativeTransitionPrivate::append_animation);
}
QT_END_NAMESPACE
-#include <qmltransition.moc>
+#include <qdeclarativetransition.moc>
diff --git a/src/declarative/util/qmltransition_p.h b/src/declarative/util/qdeclarativetransition_p.h
index ea02a33..861111a 100644
--- a/src/declarative/util/qmltransition_p.h
+++ b/src/declarative/util/qdeclarativetransition_p.h
@@ -39,12 +39,12 @@
**
****************************************************************************/
-#ifndef QMLTRANSITION_H
-#define QMLTRANSITION_H
+#ifndef QDECLARATIVETRANSITION_H
+#define QDECLARATIVETRANSITION_H
-#include "qmlstate_p.h"
+#include "qdeclarativestate_p.h"
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtCore/qobject.h>
@@ -54,24 +54,24 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlAbstractAnimation;
-class QmlTransitionPrivate;
-class QmlTransitionManager;
-class Q_DECLARATIVE_EXPORT QmlTransition : public QObject
+class QDeclarativeAbstractAnimation;
+class QDeclarativeTransitionPrivate;
+class QDeclarativeTransitionManager;
+class Q_DECLARATIVE_EXPORT QDeclarativeTransition : public QObject
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlTransition)
+ Q_DECLARE_PRIVATE(QDeclarativeTransition)
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(QmlListProperty<QmlAbstractAnimation> animations READ animations)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeAbstractAnimation> animations READ animations)
Q_CLASSINFO("DefaultProperty", "animations")
Q_CLASSINFO("DeferredPropertyNames", "animations")
public:
- QmlTransition(QObject *parent=0);
- ~QmlTransition();
+ QDeclarativeTransition(QObject *parent=0);
+ ~QDeclarativeTransition();
QString fromState() const;
void setFromState(const QString &);
@@ -82,11 +82,11 @@ public:
bool reversible() const;
void setReversible(bool);
- QmlListProperty<QmlAbstractAnimation> animations();
+ QDeclarativeListProperty<QDeclarativeAbstractAnimation> animations();
- void prepare(QmlStateOperation::ActionList &actions,
- QList<QmlMetaProperty> &after,
- QmlTransitionManager *end);
+ void prepare(QDeclarativeStateOperation::ActionList &actions,
+ QList<QDeclarativeProperty> &after,
+ QDeclarativeTransitionManager *end);
void setReversed(bool r);
void stop();
@@ -94,8 +94,8 @@ public:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlTransition)
+QML_DECLARE_TYPE(QDeclarativeTransition)
QT_END_HEADER
-#endif // QMLTRANSITION_H
+#endif // QDECLARATIVETRANSITION_H
diff --git a/src/declarative/util/qmltransitionmanager.cpp b/src/declarative/util/qdeclarativetransitionmanager.cpp
index f2a4d64..e1143fa 100644
--- a/src/declarative/util/qmltransitionmanager.cpp
+++ b/src/declarative/util/qdeclarativetransitionmanager.cpp
@@ -39,66 +39,67 @@
**
****************************************************************************/
-#include "qmltransitionmanager_p_p.h"
+#include "qdeclarativetransitionmanager_p_p.h"
-#include "qmlstate_p_p.h"
+#include "qdeclarativestate_p_p.h"
-#include <qmlbinding.h>
-#include <qmlglobal_p.h>
+#include <qdeclarativebinding_p.h>
+#include <qdeclarativeglobal_p.h>
+#include <qdeclarativeproperty_p.h>
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG);
-class QmlTransitionManagerPrivate
+class QDeclarativeTransitionManagerPrivate
{
public:
- QmlTransitionManagerPrivate()
+ QDeclarativeTransitionManagerPrivate()
: state(0), transition(0) {}
void applyBindings();
- typedef QList<QmlSimpleAction> SimpleActionList;
- QmlState *state;
- QmlTransition *transition;
- QmlStateOperation::ActionList bindingsList;
+ typedef QList<QDeclarativeSimpleAction> SimpleActionList;
+ QDeclarativeState *state;
+ QDeclarativeTransition *transition;
+ QDeclarativeStateOperation::ActionList bindingsList;
SimpleActionList completeList;
};
-QmlTransitionManager::QmlTransitionManager()
-: d(new QmlTransitionManagerPrivate)
+QDeclarativeTransitionManager::QDeclarativeTransitionManager()
+: d(new QDeclarativeTransitionManagerPrivate)
{
}
-void QmlTransitionManager::setState(QmlState *s)
+void QDeclarativeTransitionManager::setState(QDeclarativeState *s)
{
d->state = s;
}
-QmlTransitionManager::~QmlTransitionManager()
+QDeclarativeTransitionManager::~QDeclarativeTransitionManager()
{
delete d; d = 0;
}
-void QmlTransitionManager::complete()
+void QDeclarativeTransitionManager::complete()
{
d->applyBindings();
for (int ii = 0; ii < d->completeList.count(); ++ii) {
- const QmlMetaProperty &prop = d->completeList.at(ii).property;
+ const QDeclarativeProperty &prop = d->completeList.at(ii).property;
prop.write(d->completeList.at(ii).value);
}
d->completeList.clear();
if (d->state)
- static_cast<QmlStatePrivate*>(QObjectPrivate::get(d->state))->complete();
+ static_cast<QDeclarativeStatePrivate*>(QObjectPrivate::get(d->state))->complete();
}
-void QmlTransitionManagerPrivate::applyBindings()
+void QDeclarativeTransitionManagerPrivate::applyBindings()
{
- foreach(const QmlAction &action, bindingsList) {
+ foreach(const QDeclarativeAction &action, bindingsList) {
if (action.toBinding) {
- action.property.setBinding(action.toBinding);
+ QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding);
} else if (action.event) {
if (action.reverseEvent)
action.event->reverse();
@@ -111,18 +112,18 @@ void QmlTransitionManagerPrivate::applyBindings()
bindingsList.clear();
}
-void QmlTransitionManager::transition(const QList<QmlAction> &list,
- QmlTransition *transition)
+void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> &list,
+ QDeclarativeTransition *transition)
{
cancel();
- QmlStateOperation::ActionList applyList = list;
+ QDeclarativeStateOperation::ActionList applyList = list;
// Determine which actions are binding changes.
- foreach(const QmlAction &action, applyList) {
+ foreach(const QDeclarativeAction &action, applyList) {
if (action.toBinding)
d->bindingsList << action;
if (action.fromBinding)
- action.property.setBinding(0); // Disable current binding
+ QDeclarativePropertyPrivate::setBinding(action.property, 0); // Disable current binding
if (action.event && action.event->changesBindings()) { //### assume isReversable()?
d->bindingsList << action;
if (action.reverseEvent)
@@ -147,11 +148,11 @@ void QmlTransitionManager::transition(const QList<QmlAction> &list,
// Apply all the property and binding changes
for (int ii = 0; ii < applyList.size(); ++ii) {
- const QmlAction &action = applyList.at(ii);
+ const QDeclarativeAction &action = applyList.at(ii);
if (action.toBinding) {
- action.property.setBinding(action.toBinding, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
} else if (!action.event) {
- action.property.write(action.toValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
} else if (action.event->isReversable()) {
if (action.reverseEvent)
action.event->reverse();
@@ -163,17 +164,17 @@ void QmlTransitionManager::transition(const QList<QmlAction> &list,
// Read all the end values for binding changes
for (int ii = 0; ii < applyList.size(); ++ii) {
- QmlAction *action = &applyList[ii];
+ QDeclarativeAction *action = &applyList[ii];
if (action->event)
continue;
- const QmlMetaProperty &prop = action->property;
+ const QDeclarativeProperty &prop = action->property;
if (action->toBinding || !action->toValue.isValid()) { //### is this always right (used for exta actions)
action->toValue = prop.read();
}
}
// Revert back to the original values
- foreach(const QmlAction &action, applyList) {
+ foreach(const QDeclarativeAction &action, applyList) {
if (action.event) {
if (action.event->isReversable()) {
if (action.reverseEvent) { //reverse the reverse
@@ -190,20 +191,20 @@ void QmlTransitionManager::transition(const QList<QmlAction> &list,
}
if (action.toBinding)
- action.property.setBinding(0); // Make sure this is disabled during the transition
+ QDeclarativePropertyPrivate::setBinding(action.property, 0); // Make sure this is disabled during the transition
- action.property.write(action.fromValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::write(action.property, action.fromValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
}
}
if (transition) {
- QList<QmlMetaProperty> touched;
+ QList<QDeclarativeProperty> touched;
d->transition = transition;
d->transition->prepare(applyList, touched, this);
// Modify the action list to remove actions handled in the transition
for (int ii = 0; ii < applyList.count(); ++ii) {
- const QmlAction &action = applyList.at(ii);
+ const QDeclarativeAction &action = applyList.at(ii);
if (action.event) {
@@ -217,7 +218,7 @@ void QmlTransitionManager::transition(const QList<QmlAction> &list,
if (touched.contains(action.property)) {
if (action.toValue != action.fromValue)
d->completeList <<
- QmlSimpleAction(action, QmlSimpleAction::EndState);
+ QDeclarativeSimpleAction(action, QDeclarativeSimpleAction::EndState);
applyList.removeAt(ii);
--ii;
@@ -231,7 +232,7 @@ void QmlTransitionManager::transition(const QList<QmlAction> &list,
// be applied immediately. We skip applying bindings, as they are all
// applied at the end in applyBindings() to avoid any nastiness mid
// transition
- foreach(const QmlAction &action, applyList) {
+ foreach(const QDeclarativeAction &action, applyList) {
if (action.event && !action.event->changesBindings()) {
if (action.event->isReversable() && action.reverseEvent)
action.event->reverse();
@@ -242,7 +243,7 @@ void QmlTransitionManager::transition(const QList<QmlAction> &list,
}
}
if (stateChangeDebug()) {
- foreach(const QmlAction &action, applyList) {
+ foreach(const QDeclarativeAction &action, applyList) {
if (action.event)
qWarning() << " No transition for event:" << action.event->typeName();
else
@@ -255,7 +256,7 @@ void QmlTransitionManager::transition(const QList<QmlAction> &list,
d->applyBindings();
}
-void QmlTransitionManager::cancel()
+void QDeclarativeTransitionManager::cancel()
{
if (d->transition) {
// ### this could potentially trigger a complete in rare circumstances
@@ -264,9 +265,9 @@ void QmlTransitionManager::cancel()
}
for(int i = 0; i < d->bindingsList.count(); ++i) {
- QmlAction action = d->bindingsList[i];
+ QDeclarativeAction action = d->bindingsList[i];
if (action.toBinding && action.deletableToBinding) {
- action.property.setBinding(0);
+ QDeclarativePropertyPrivate::setBinding(action.property, 0);
action.toBinding->destroy();
action.toBinding = 0;
action.deletableToBinding = false;
diff --git a/src/declarative/util/qmltransitionmanager_p_p.h b/src/declarative/util/qdeclarativetransitionmanager_p_p.h
index 19ee706..d6e626e 100644
--- a/src/declarative/util/qmltransitionmanager_p_p.h
+++ b/src/declarative/util/qdeclarativetransitionmanager_p_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLTRANSITIONMANAGER_P_H
-#define QMLTRANSITIONMANAGER_P_H
+#ifndef QDECLARATIVETRANSITIONMANAGER_P_H
+#define QDECLARATIVETRANSITIONMANAGER_P_H
//
// W A R N I N G
@@ -53,33 +53,33 @@
// We mean it.
//
-#include "qmlstateoperations_p.h"
+#include "qdeclarativestateoperations_p.h"
QT_BEGIN_NAMESPACE
-class QmlStatePrivate;
-class QmlTransitionManagerPrivate;
-class QmlTransitionManager
+class QDeclarativeStatePrivate;
+class QDeclarativeTransitionManagerPrivate;
+class QDeclarativeTransitionManager
{
public:
- QmlTransitionManager();
- ~QmlTransitionManager();
+ QDeclarativeTransitionManager();
+ ~QDeclarativeTransitionManager();
- void transition(const QList<QmlAction> &, QmlTransition *transition);
+ void transition(const QList<QDeclarativeAction> &, QDeclarativeTransition *transition);
void cancel();
private:
- Q_DISABLE_COPY(QmlTransitionManager);
- QmlTransitionManagerPrivate *d;
+ Q_DISABLE_COPY(QDeclarativeTransitionManager);
+ QDeclarativeTransitionManagerPrivate *d;
void complete();
- void setState(QmlState *);
+ void setState(QDeclarativeState *);
- friend class QmlState;
- friend class QmlTransitionPrivate;
+ friend class QDeclarativeState;
+ friend class QDeclarativeTransitionPrivate;
};
QT_END_NAMESPACE
-#endif // QMLTRANSITIONMANAGER_P_H
+#endif // QDECLARATIVETRANSITIONMANAGER_P_H
diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp
new file mode 100644
index 0000000..2b8c7de
--- /dev/null
+++ b/src/declarative/util/qdeclarativeutilmodule.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** 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 "qdeclarativeutilmodule_p.h"
+#include "qfxperf_p_p.h"
+#include "qdeclarativeanimation_p.h"
+#include "qdeclarativeanimation_p_p.h"
+#include "qdeclarativebehavior_p.h"
+#include "qdeclarativebind_p.h"
+#include "qdeclarativeconnections_p.h"
+#include "qdeclarativedatetimeformatter_p.h"
+#include "qdeclarativeeasefollow_p.h"
+#include "qdeclarativefontloader_p.h"
+#include "qdeclarativelistaccessor_p.h"
+#include "qdeclarativelistmodel_p.h"
+#include "qdeclarativenullablevalue_p_p.h"
+#include "qdeclarativenumberformatter_p.h"
+#include "qdeclarativeopenmetaobject_p.h"
+#include "qdeclarativepackage_p.h"
+#include "qdeclarativepixmapcache_p.h"
+#include "qdeclarativepropertychanges_p.h"
+#include "qdeclarativepropertymap.h"
+#include "qdeclarativespringfollow_p.h"
+#include "qdeclarativestategroup_p.h"
+#include "qdeclarativestateoperations_p.h"
+#include "qdeclarativestate_p.h"
+#include "qdeclarativestate_p_p.h"
+#include "qdeclarativestyledtext_p.h"
+#include "qdeclarativesystempalette_p.h"
+#include "qdeclarativetimeline_p_p.h"
+#include "qdeclarativetimer_p.h"
+#include "qdeclarativetransitionmanager_p_p.h"
+#include "qdeclarativetransition_p.h"
+#include "qdeclarativeview.h"
+#include "qdeclarativexmllistmodel_p.h"
+#include "qnumberformat_p.h"
+#include "qperformancelog_p_p.h"
+
+void QDeclarativeUtilModule::defineModule()
+{
+ QML_REGISTER_TYPE(Qt,4,6,AnchorChanges,QDeclarativeAnchorChanges);
+ QML_REGISTER_TYPE(Qt,4,6,Behavior,QDeclarativeBehavior);
+ QML_REGISTER_TYPE(Qt,4,6,Binding,QDeclarativeBind);
+ QML_REGISTER_TYPE(Qt,4,6,ColorAnimation,QDeclarativeColorAnimation);
+ QML_REGISTER_TYPE(Qt,4,6,Connections,QDeclarativeConnections);
+ QML_REGISTER_TYPE(Qt,4,6,DateTimeFormatter,QDeclarativeDateTimeFormatter);
+ QML_REGISTER_TYPE(Qt,4,6,EaseFollow,QDeclarativeEaseFollow);;
+ QML_REGISTER_TYPE(Qt,4,6,FontLoader,QDeclarativeFontLoader);
+ QML_REGISTER_TYPE(Qt,4,6,ListElement,QDeclarativeListElement);
+ QML_REGISTER_TYPE(Qt,4,6,NumberAnimation,QDeclarativeNumberAnimation);
+ QML_REGISTER_TYPE(Qt,4,6,NumberFormatter,QDeclarativeNumberFormatter);;
+ QML_REGISTER_TYPE(Qt,4,6,Package,QDeclarativePackage);
+ QML_REGISTER_TYPE(Qt,4,6,ParallelAnimation,QDeclarativeParallelAnimation);
+ QML_REGISTER_TYPE(Qt,4,6,ParentAction,QDeclarativeParentAction);
+ QML_REGISTER_TYPE(Qt,4,6,ParentAnimation,QDeclarativeParentAnimation);
+ QML_REGISTER_TYPE(Qt,4,6,ParentChange,QDeclarativeParentChange);
+ QML_REGISTER_TYPE(Qt,4,6,PauseAnimation,QDeclarativePauseAnimation);
+ QML_REGISTER_TYPE(Qt,4,6,PropertyAction,QDeclarativePropertyAction);
+ QML_REGISTER_TYPE(Qt,4,6,PropertyAnimation,QDeclarativePropertyAnimation);
+ QML_REGISTER_TYPE(Qt,4,6,RotationAnimation,QDeclarativeRotationAnimation);
+ QML_REGISTER_TYPE(Qt,4,6,ScriptAction,QDeclarativeScriptAction);
+ QML_REGISTER_TYPE(Qt,4,6,SequentialAnimation,QDeclarativeSequentialAnimation);
+ QML_REGISTER_TYPE(Qt,4,6,SpringFollow,QDeclarativeSpringFollow);
+ QML_REGISTER_TYPE(Qt,4,6,StateChangeScript,QDeclarativeStateChangeScript);
+ QML_REGISTER_TYPE(Qt,4,6,StateGroup,QDeclarativeStateGroup);
+ QML_REGISTER_TYPE(Qt,4,6,State,QDeclarativeState);
+ QML_REGISTER_TYPE(Qt,4,6,SystemPalette,QDeclarativeSystemPalette);
+ QML_REGISTER_TYPE(Qt,4,6,Timer,QDeclarativeTimer);
+ QML_REGISTER_TYPE(Qt,4,6,Transition,QDeclarativeTransition);
+ QML_REGISTER_TYPE(Qt,4,6,Vector3dAnimation,QDeclarativeVector3dAnimation);
+#ifndef QT_NO_XMLPATTERNS
+ QML_REGISTER_TYPE(Qt,4,6,XmlListModel,QDeclarativeXmlListModel);
+ QML_REGISTER_TYPE(Qt,4,6,XmlRole,QDeclarativeXmlListModelRole);
+#endif
+
+ QML_REGISTER_NOCREATE_TYPE(QDeclarativeAnchors);
+ QML_REGISTER_NOCREATE_TYPE(QDeclarativeAbstractAnimation);
+ QML_REGISTER_NOCREATE_TYPE(QDeclarativeStateOperation);
+ QML_REGISTER_NOCREATE_TYPE(QNumberFormat);
+
+ QML_REGISTER_CUSTOM_TYPE(Qt, 4,6, ListModel, QDeclarativeListModel, QDeclarativeListModelParser);
+ QML_REGISTER_CUSTOM_TYPE(Qt, 4,6, PropertyChanges, QDeclarativePropertyChanges, QDeclarativePropertyChangesParser);
+ QML_REGISTER_CUSTOM_TYPE(Qt, 4,6, Connections, QDeclarativeConnections, QDeclarativeConnectionsParser);
+}
diff --git a/src/declarative/util/qdeclarativeutilmodule_p.h b/src/declarative/util/qdeclarativeutilmodule_p.h
new file mode 100644
index 0000000..602c8c5
--- /dev/null
+++ b/src/declarative/util/qdeclarativeutilmodule_p.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 QDECLARATIVEUTILMODULE_H
+#define QDECLARATIVEUTILMODULE_H
+
+#include <qdeclarative.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class QDeclarativeUtilModule
+{
+public:
+ static void defineModule();
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QDECLARATIVEUTILMODULE_H
diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qdeclarativeview.cpp
index 632e8e2..6fe5bf3 100644
--- a/src/declarative/util/qmlview.cpp
+++ b/src/declarative/util/qdeclarativeview.cpp
@@ -39,18 +39,18 @@
**
****************************************************************************/
-#include "qmlview.h"
+#include "qdeclarativeview.h"
#include "qperformancelog_p_p.h"
#include "qfxperf_p_p.h"
-#include <qml.h>
-#include <qmlgraphicsitem.h>
-#include <qmlengine.h>
-#include <qmlcontext.h>
-#include <qmldebug_p.h>
-#include <qmldebugservice_p.h>
-#include <qmlglobal_p.h>
+#include <qdeclarative.h>
+#include <qdeclarativeitem.h>
+#include <qdeclarativeengine.h>
+#include <qdeclarativecontext.h>
+#include <qdeclarativedebug_p.h>
+#include <qdeclarativedebugservice_p.h>
+#include <qdeclarativeglobal_p.h>
#include <qscriptvalueiterator.h>
#include <qdebug.h>
@@ -70,11 +70,11 @@ QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(frameRateDebug, QML_SHOW_FRAMERATE)
-class QmlViewDebugServer;
+class QDeclarativeViewDebugServer;
class FrameBreakAnimation : public QAbstractAnimation
{
public:
- FrameBreakAnimation(QmlViewDebugServer *s)
+ FrameBreakAnimation(QDeclarativeViewDebugServer *s)
: QAbstractAnimation((QObject*)s), server(s)
{
start();
@@ -84,13 +84,13 @@ public:
virtual void updateCurrentTime(int msecs);
private:
- QmlViewDebugServer *server;
+ QDeclarativeViewDebugServer *server;
};
-class QmlViewDebugServer : public QmlDebugService
+class QDeclarativeViewDebugServer : public QDeclarativeDebugService
{
public:
- QmlViewDebugServer(QObject *parent = 0) : QmlDebugService(QLatin1String("CanvasFrameRate"), parent), breaks(0)
+ QDeclarativeViewDebugServer(QObject *parent = 0) : QDeclarativeDebugService(QLatin1String("CanvasFrameRate"), parent), breaks(0)
{
timer.start();
new FrameBreakAnimation(this);
@@ -118,7 +118,7 @@ private:
int breaks;
};
-Q_GLOBAL_STATIC(QmlViewDebugServer, qfxViewDebugServer);
+Q_GLOBAL_STATIC(QDeclarativeViewDebugServer, qfxViewDebugServer);
void FrameBreakAnimation::updateCurrentTime(int msecs)
{
@@ -126,25 +126,27 @@ void FrameBreakAnimation::updateCurrentTime(int msecs)
server->frameBreak();
}
-class QmlViewPrivate
+class QDeclarativeViewPrivate
{
public:
- QmlViewPrivate(QmlView *view)
- : q(view), root(0), component(0), resizeMode(QmlView::SizeViewToRootObject) {}
+ QDeclarativeViewPrivate(QDeclarativeView *view)
+ : q(view), root(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject) {}
- QmlView *q;
+ void execute();
+
+ QDeclarativeView *q;
QGuard<QGraphicsObject> root;
- QGuard<QmlGraphicsItem> qmlRoot;
+ QGuard<QDeclarativeItem> qmlRoot;
QUrl source;
- QmlEngine engine;
- QmlComponent *component;
+ QDeclarativeEngine engine;
+ QDeclarativeComponent *component;
QBasicTimer resizetimer;
mutable QSize initialSize;
- QmlView::ResizeMode resizeMode;
+ QDeclarativeView::ResizeMode resizeMode;
QTime frameTimer;
void init();
@@ -152,22 +154,36 @@ public:
QGraphicsScene scene;
};
+void QDeclarativeViewPrivate::execute()
+{
+ delete root;
+ delete component;
+ component = new QDeclarativeComponent(&engine, source, q);
+
+ if (!component->isLoading()) {
+ q->continueExecute();
+ } else {
+ QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), q, SLOT(continueExecute()));
+ }
+}
+
+
/*!
- \class QmlView
+ \class QDeclarativeView
\since 4.7
- \brief The QmlView class provides a widget for displaying a Qt Declarative user interface.
+ \brief The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface.
- Any QGraphicsObject or QmlGraphicsItem
+ Any QGraphicsObject or QDeclarativeItem
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
+ QDeclarativeView 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:
+ QDeclarativeView performs the following functions:
\list
- \o Manages QmlComponent loading and object creation.
+ \o Manages QDeclarativeComponent loading and object creation.
\o Initializes QGraphicsView for optimal performance with QML:
\list
\o QGraphicsView::setOptimizationFlags(QGraphicsView::DontSavePainterState);
@@ -184,48 +200,58 @@ public:
Typical usage:
\code
...
- QmlView *view = new QmlView(this);
+ QDeclarativeView *view = new QDeclarativeView(this);
vbox->addWidget(view);
QUrl url(fileName);
view->setSource(url);
- ...
- view->execute();
- ...
view->show();
\endcode
- To receive errors related to loading and executing QML with QmlView,
- you can connect to the statusChanged() signal and monitor for QmlView::Error.
- The errors are available via QmlView::errors().
+ To receive errors related to loading and executing QML with QDeclarativeView,
+ you can connect to the statusChanged() signal and monitor for QDeclarativeView::Error.
+ The errors are available via QDeclarativeView::errors().
*/
-/*! \fn void QmlView::sceneResized(QSize size)
+/*! \fn void QDeclarativeView::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.
+/*! \fn void QDeclarativeView::statusChanged(QDeclarativeView::Status status)
+ This signal is emitted when the component's current \l{QDeclarativeView::Status} {status} changes.
*/
/*!
- \fn QmlView::QmlView(QWidget *parent)
+ \fn QDeclarativeView::QDeclarativeView(QWidget *parent)
- Constructs a QmlView with the given \a parent.
+ Constructs a QDeclarativeView with the given \a parent.
*/
-QmlView::QmlView(QWidget *parent)
-: QGraphicsView(parent), d(new QmlViewPrivate(this))
+QDeclarativeView::QDeclarativeView(QWidget *parent)
+: QGraphicsView(parent), d(new QDeclarativeViewPrivate(this))
{
setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
d->init();
}
-void QmlViewPrivate::init()
+/*!
+ \fn QDeclarativeView::QDeclarativeView(const QUrl &source, QWidget *parent)
+
+ Constructs a QDeclarativeView with the given QML \a source and \a parent.
+*/
+QDeclarativeView::QDeclarativeView(const QUrl &source, QWidget *parent)
+: QGraphicsView(parent), d(new QDeclarativeViewPrivate(this))
+{
+ setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
+ d->init();
+ setSource(source);
+}
+
+void QDeclarativeViewPrivate::init()
{
#ifdef Q_ENABLE_PERFORMANCE_LOG
{
- QmlPerfTimer<QmlPerf::FontDatabase> perf;
+ QDeclarativePerfTimer<QDeclarativePerf::FontDatabase> perf;
QFontDatabase database;
}
#endif
@@ -249,21 +275,20 @@ void QmlViewPrivate::init()
The destructor clears the view's \l {QGraphicsObject} {items} and
deletes the internal representation.
*/
-QmlView::~QmlView()
+QDeclarativeView::~QDeclarativeView()
{
delete d->root;
}
/*!
- Sets the source to the \a url.
-
- Call \l execute() to load the QML and instantiate the component.
-
- \sa execute()
+ Sets the source to the \a url, loads the QML component and instantiates it.
*/
-void QmlView::setSource(const QUrl& url)
+void QDeclarativeView::setSource(const QUrl& url)
{
- d->source = url;
+ if (url != d->source) {
+ d->source = url;
+ d->execute();
+ }
}
/*!
@@ -271,88 +296,71 @@ void QmlView::setSource(const QUrl& url)
\sa setSource()
*/
-QUrl QmlView::source() const
+QUrl QDeclarativeView::source() const
{
return d->source;
}
/*!
- Returns a pointer to the QmlEngine used for instantiating
+ Returns a pointer to the QDeclarativeEngine used for instantiating
QML Components.
*/
-QmlEngine* QmlView::engine()
+QDeclarativeEngine* QDeclarativeView::engine()
{
return &d->engine;
}
/*!
This function returns the root of the context hierarchy. Each QML
- component is instantiated in a QmlContext. QmlContext's are
+ component is instantiated in a QDeclarativeContext. QDeclarativeContext's are
essential for passing data to QML components. In QML, contexts are
arranged hierarchically and this hierarchy is managed by the
- QmlEngine.
+ QDeclarativeEngine.
*/
-QmlContext* QmlView::rootContext()
+QDeclarativeContext* QDeclarativeView::rootContext()
{
return d->engine.rootContext();
}
-/*!
- Loads and instantiates the QML component set by the \l setSource() method.
-
- \sa setSource()
-*/
-void QmlView::execute()
-{
- delete d->root;
- delete d->component;
- d->component = new QmlComponent(&d->engine, d->source, this);
-
- if (!d->component->isLoading()) {
- continueExecute();
- } else {
- connect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute()));
- }
-}
/*!
- \enum QmlView::Status
+ \enum QDeclarativeView::Status
- Specifies the loading status of the QmlView.
+ Specifies the loading status of the QDeclarativeView.
- \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 Null This QDeclarativeView has no source set.
+ \value Ready This QDeclarativeView has loaded and created the QML component.
+ \value Loading This QDeclarativeView 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}.
+ \property QDeclarativeView::status
+ The component's current \l{QDeclarativeView::Status} {status}.
*/
-QmlView::Status QmlView::status() const
+QDeclarativeView::Status QDeclarativeView::status() const
{
if (!d->component)
- return QmlView::Null;
+ return QDeclarativeView::Null;
- return QmlView::Status(d->component->status());
+ return QDeclarativeView::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
+QList<QDeclarativeError> QDeclarativeView::errors() const
{
if (d->component)
return d->component->errors();
- return QList<QmlError>();
+ return QList<QDeclarativeError>();
}
/*!
- \property QmlView::resizeMode
+ \property QDeclarativeView::resizeMode
\brief whether the view should resize the canvas contents
If this property is set to SizeViewToRootObject (the default), the view
@@ -368,7 +376,7 @@ QList<QmlError> QmlView::errors() const
\sa initialSize()
*/
-void QmlView::setResizeMode(ResizeMode mode)
+void QDeclarativeView::setResizeMode(ResizeMode mode)
{
if (d->resizeMode == mode)
return;
@@ -385,7 +393,7 @@ void QmlView::setResizeMode(ResizeMode mode)
}
}
-QmlView::ResizeMode QmlView::resizeMode() const
+QDeclarativeView::ResizeMode QDeclarativeView::resizeMode() const
{
return d->resizeMode;
}
@@ -393,14 +401,14 @@ QmlView::ResizeMode QmlView::resizeMode() const
/*!
\internal
*/
-void QmlView::continueExecute()
+void QDeclarativeView::continueExecute()
{
- disconnect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute()));
+ disconnect(d->component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(continueExecute()));
if (d->component->isError()) {
- QList<QmlError> errorList = d->component->errors();
- foreach (const QmlError &error, errorList) {
+ QList<QDeclarativeError> errorList = d->component->errors();
+ foreach (const QDeclarativeError &error, errorList) {
qWarning() << error;
}
emit statusChanged(status());
@@ -410,66 +418,72 @@ void QmlView::continueExecute()
QObject *obj = d->component->create();
if(d->component->isError()) {
- QList<QmlError> errorList = d->component->errors();
- foreach (const QmlError &error, errorList) {
+ QList<QDeclarativeError> errorList = d->component->errors();
+ foreach (const QDeclarativeError &error, errorList) {
qWarning() << error;
}
emit statusChanged(status());
return;
}
- if (obj) {
- if (QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem *>(obj)) {
-
- d->scene.addItem(item);
-
- 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->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->resizeMode == SizeRootObjectToView) {
- d->qmlRoot->setWidth(width());
- d->qmlRoot->setHeight(height());
- } else {
- QSize sz(d->qmlRoot->width(),d->qmlRoot->height());
- emit sceneResized(sz);
- resize(sz);
- }
- updateGeometry();
- } 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);
- if (!layout()) {
- setLayout(new QVBoxLayout);
- layout()->setContentsMargins(0, 0, 0, 0);
- } else if (layout()->count()) {
- // Hide the QGraphicsView in GV mode.
- QLayoutItem *item = layout()->itemAt(0);
- if (item->widget())
- item->widget()->hide();
- }
- layout()->addWidget(wid);
- emit sceneResized(wid->size());
+ setRootObject(obj);
+ emit statusChanged(status());
+}
+
+
+/*!
+ \internal
+*/
+void QDeclarativeView::setRootObject(QObject *obj)
+{
+ if (QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(obj)) {
+ d->scene.addItem(item);
+
+ 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->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->resizeMode == SizeRootObjectToView) {
+ d->qmlRoot->setWidth(width());
+ d->qmlRoot->setHeight(height());
+ } else {
+ QSize sz(d->qmlRoot->width(),d->qmlRoot->height());
+ emit sceneResized(sz);
+ resize(sz);
}
+ updateGeometry();
+ } else if (QGraphicsObject *item = qobject_cast<QGraphicsObject *>(obj)) {
+ d->scene.addItem(item);
+ qWarning() << "QDeclarativeView::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);
+ if (!layout()) {
+ setLayout(new QVBoxLayout);
+ layout()->setContentsMargins(0, 0, 0, 0);
+ } else if (layout()->count()) {
+ // Hide the QGraphicsView in GV mode.
+ QLayoutItem *item = layout()->itemAt(0);
+ if (item->widget())
+ item->widget()->hide();
+ }
+ layout()->addWidget(wid);
+ emit sceneResized(wid->size());
}
- emit statusChanged(status());
}
/*!
\internal
*/
-void QmlView::sizeChanged()
+void QDeclarativeView::sizeChanged()
{
// delay, so we catch both width and height changing.
d->resizetimer.start(0,this);
@@ -480,7 +494,7 @@ void QmlView::sizeChanged()
If the \l {QTimerEvent} {timer event} \a e is this
view's resize timer, sceneResized() is emitted.
*/
-void QmlView::timerEvent(QTimerEvent* e)
+void QDeclarativeView::timerEvent(QTimerEvent* e)
{
if (!e || e->timerId() == d->resizetimer.timerId()) {
if (d->qmlRoot) {
@@ -498,7 +512,7 @@ void QmlView::timerEvent(QTimerEvent* e)
\internal
The size hint is the size of the root item.
*/
-QSize QmlView::sizeHint() const
+QSize QDeclarativeView::sizeHint() const
{
if (d->qmlRoot) {
if (d->initialSize.width() <= 0)
@@ -512,7 +526,7 @@ QSize QmlView::sizeHint() const
/*!
Returns the view's root \l {QGraphicsObject} {item}.
*/
-QGraphicsObject *QmlView::rootObject() const
+QGraphicsObject *QDeclarativeView::rootObject() const
{
return d->root;
}
@@ -522,7 +536,7 @@ QGraphicsObject *QmlView::rootObject() const
This function handles the \l {QResizeEvent} {resize event}
\a e.
*/
-void QmlView::resizeEvent(QResizeEvent *e)
+void QDeclarativeView::resizeEvent(QResizeEvent *e)
{
if (d->resizeMode == SizeRootObjectToView && d->qmlRoot) {
d->qmlRoot->setWidth(width());
@@ -541,13 +555,13 @@ void QmlView::resizeEvent(QResizeEvent *e)
/*!
\internal
*/
-void QmlView::paintEvent(QPaintEvent *event)
+void QDeclarativeView::paintEvent(QPaintEvent *event)
{
int time = 0;
- if (frameRateDebug() || QmlViewDebugServer::isDebuggingEnabled())
+ if (frameRateDebug() || QDeclarativeViewDebugServer::isDebuggingEnabled())
time = d->frameTimer.restart();
QGraphicsView::paintEvent(event);
- if (QmlViewDebugServer::isDebuggingEnabled())
+ if (QDeclarativeViewDebugServer::isDebuggingEnabled())
qfxViewDebugServer()->addTiming(d->frameTimer.elapsed(), time);
if (frameRateDebug())
qDebug() << "paintEvent:" << d->frameTimer.elapsed() << "time since last frame:" << time;
diff --git a/src/declarative/util/qmlview.h b/src/declarative/util/qdeclarativeview.h
index 1d6ef1c..03d8db3 100644
--- a/src/declarative/util/qmlview.h
+++ b/src/declarative/util/qdeclarativeview.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLVIEW_H
-#define QMLVIEW_H
+#ifndef QDECLARATIVEVIEW_H
+#define QDECLARATIVEVIEW_H
#include <QtCore/qdatetime.h>
#include <QtGui/qgraphicssceneevent.h>
@@ -54,27 +54,27 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QGraphicsObject;
-class QmlEngine;
-class QmlContext;
-class QmlError;
+class QDeclarativeEngine;
+class QDeclarativeContext;
+class QDeclarativeError;
-class QmlViewPrivate;
-class Q_DECLARATIVE_EXPORT QmlView : public QGraphicsView
+class QDeclarativeViewPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeView : public QGraphicsView
{
Q_OBJECT
Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode)
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
public:
- explicit QmlView(QWidget *parent = 0);
- virtual ~QmlView();
+ explicit QDeclarativeView(QWidget *parent = 0);
+ QDeclarativeView(const QUrl &source, QWidget *parent = 0);
+ virtual ~QDeclarativeView();
QUrl source() const;
void setSource(const QUrl&);
- QmlEngine* engine();
- QmlContext* rootContext();
- void execute();
+ QDeclarativeEngine* engine();
+ QDeclarativeContext* rootContext();
QGraphicsObject *rootObject() const;
@@ -85,13 +85,13 @@ public:
enum Status { Null, Ready, Loading, Error };
Status status() const;
- QList<QmlError> errors() const;
+ QList<QDeclarativeError> errors() const;
QSize sizeHint() const;
Q_SIGNALS:
void sceneResized(QSize size); // ???
- void statusChanged(QmlView::Status);
+ void statusChanged(QDeclarativeView::Status);
private Q_SLOTS:
void continueExecute();
@@ -100,13 +100,15 @@ private Q_SLOTS:
protected:
virtual void resizeEvent(QResizeEvent *);
virtual void paintEvent(QPaintEvent *event);
- void timerEvent(QTimerEvent*);
+ virtual void timerEvent(QTimerEvent*);
+ virtual void setRootObject(QObject *obj);
- QmlViewPrivate *d;
+ friend class QDeclarativeViewPrivate;
+ QDeclarativeViewPrivate *d;
};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLVIEW_H
+#endif // QDECLARATIVEVIEW_H
diff --git a/src/declarative/util/qmlxmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index 58caf12..386df46 100644
--- a/src/declarative/util/qmlxmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -39,12 +39,13 @@
**
****************************************************************************/
-#include "qmlxmllistmodel_p.h"
+#include "qdeclarativexmllistmodel_p.h"
-#include <qmlcontext.h>
-#include <qmlengine.h>
+#include <qdeclarativecontext.h>
+#include <qdeclarativeengine.h>
#include <QDebug>
+#include <QStringList>
#include <QApplication>
#include <QThread>
#include <QMutex>
@@ -60,11 +61,13 @@
QT_BEGIN_NAMESPACE
-QML_DEFINE_TYPE(Qt,4,6,XmlRole,QmlXmlListModelRole)
-QML_DEFINE_TYPE(Qt,4,6,XmlListModel,QmlXmlListModel)
+
+
+
+typedef QPair<int, int> QDeclarativeXmlListRange;
/*!
- \qmlclass XmlRole QmlXmlListModelRole
+ \qmlclass XmlRole QDeclarativeXmlListModelRole
\since 4.7
\brief The XmlRole element allows you to specify a role for an XmlListModel.
*/
@@ -95,50 +98,26 @@ QML_DEFINE_TYPE(Qt,4,6,XmlListModel,QmlXmlListModel)
\endqml
*/
-class Q_DECLARATIVE_EXPORT QmlXmlListModelRole : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(QString query READ query WRITE setQuery)
-
-public:
- QmlXmlListModelRole() {}
- ~QmlXmlListModelRole() {}
-
- QString name() const { return m_name; }
- void setName(const QString &name) { m_name = name; }
-
- QString query() const { return m_query; }
- void setQuery(const QString &query)
- {
- if (query.startsWith(QLatin1Char('/'))) {
- qmlInfo(this) << tr("An XmlRole query must not start with '/'");
- return;
- }
- m_query = query;
- }
-
- bool isValid() {
- return !m_name.isEmpty() && !m_query.isEmpty();
- }
-
-private:
- QString m_name;
- QString m_query;
-};
-QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlXmlListModelRole)
-QT_BEGIN_NAMESPACE
+/*!
+ \qmlproperty bool XmlRole::isKey
+ Defines whether this is a key role.
+
+ Key roles are used to to determine whether a set of values should
+ be updated or added to the XML list model when XmlListModel::reload()
+ is called.
+
+ \sa XmlListModel
+*/
-class QmlXmlQuery : public QThread
+class QDeclarativeXmlQuery : public QThread
{
Q_OBJECT
public:
- QmlXmlQuery(QObject *parent=0)
+ QDeclarativeXmlQuery(QObject *parent=0)
: QThread(parent), m_quit(false), m_restart(false), m_abort(false), m_queryId(0) {
}
- ~QmlXmlQuery() {
+ ~QDeclarativeXmlQuery() {
m_mutex.lock();
m_quit = true;
m_condition.wakeOne();
@@ -152,9 +131,8 @@ public:
m_abort = true;
}
- int doQuery(QString query, QString namespaces, QByteArray data, QList<QmlXmlListModelRole *> *roleObjects) {
+ int doQuery(QString query, QString namespaces, QByteArray data, QList<QDeclarativeXmlListModelRole *> *roleObjects) {
QMutexLocker locker(&m_mutex);
- m_modelData.clear();
m_size = 0;
m_data = data;
m_query = QLatin1String("doc($src)") + query;
@@ -176,6 +154,16 @@ public:
return m_modelData;
}
+ QList<QDeclarativeXmlListRange> insertedItemRanges() {
+ QMutexLocker locker(&m_mutex);
+ return m_insertedItemRanges;
+ }
+
+ QList<QDeclarativeXmlListRange> removedItemRanges() {
+ QMutexLocker locker(&m_mutex);
+ return m_removedItemRanges;
+ }
+
Q_SIGNALS:
void queryCompleted(int queryId, int size);
@@ -185,13 +173,12 @@ protected:
m_mutex.lock();
int queryId = m_queryId;
doQueryJob();
- if (m_size > 0)
- doSubQueryJob();
+ doSubQueryJob();
m_data.clear(); // no longer needed
m_mutex.unlock();
m_mutex.lock();
- if (!m_abort && m_size > 0)
+ if (!m_abort)
emit queryCompleted(queryId, m_size);
if (!m_restart)
m_condition.wait(&m_mutex);
@@ -204,6 +191,8 @@ protected:
private:
void doQueryJob();
void doSubQueryJob();
+ void getValuesOfKeyRoles(QStringList *values, QXmlQuery *query) const;
+ void addIndexToRangeList(QList<QDeclarativeXmlListRange> *ranges, int index) const;
private:
QMutex m_mutex;
@@ -217,11 +206,14 @@ private:
QString m_prefix;
int m_size;
int m_queryId;
- const QList<QmlXmlListModelRole *> *m_roleObjects;
+ const QList<QDeclarativeXmlListModelRole *> *m_roleObjects;
QList<QList<QVariant> > m_modelData;
+ QStringList m_keysValues;
+ QList<QDeclarativeXmlListRange> m_insertedItemRanges;
+ QList<QDeclarativeXmlListRange> m_removedItemRanges;
};
-void QmlXmlQuery::doQueryJob()
+void QDeclarativeXmlQuery::doQueryJob()
{
QString r;
QXmlQuery query;
@@ -263,7 +255,41 @@ void QmlXmlQuery::doQueryJob()
m_size = count;
}
-void QmlXmlQuery::doSubQueryJob()
+void QDeclarativeXmlQuery::getValuesOfKeyRoles(QStringList *values, QXmlQuery *query) const
+{
+ QStringList keysQueries;
+ for (int i=0; i<m_roleObjects->count(); i++) {
+ if (m_roleObjects->at(i)->isKey())
+ keysQueries << m_roleObjects->at(i)->query();
+ }
+ QString keysQuery;
+ if (keysQueries.count() == 1)
+ keysQuery = m_prefix + keysQueries[0];
+ else if (keysQueries.count() > 1)
+ keysQuery = m_prefix + QLatin1String("concat(") + keysQueries.join(QLatin1String(",")) + QLatin1String(")");
+
+ if (!keysQuery.isEmpty()) {
+ query->setQuery(keysQuery);
+ QXmlResultItems resultItems;
+ query->evaluateTo(&resultItems);
+ QXmlItem item(resultItems.next());
+ while (!item.isNull()) {
+ values->append(item.toAtomicValue().toString());
+ item = resultItems.next();
+ }
+ }
+}
+
+void QDeclarativeXmlQuery::addIndexToRangeList(QList<QDeclarativeXmlListRange> *ranges, int index) const {
+ if (ranges->isEmpty())
+ ranges->append(qMakePair(index, 1));
+ else if (ranges->last().first + ranges->last().second == index)
+ ranges->last().second += 1;
+ else
+ ranges->append(qMakePair(index, 1));
+}
+
+void QDeclarativeXmlQuery::doSubQueryJob()
{
m_modelData.clear();
@@ -273,9 +299,38 @@ void QmlXmlQuery::doSubQueryJob()
QXmlQuery subquery;
subquery.bindVariable(QLatin1String("inputDocument"), &b);
+ QStringList keysValues;
+ getValuesOfKeyRoles(&keysValues, &subquery);
+
+ // See if any values of key roles have been inserted or removed.
+ m_insertedItemRanges.clear();
+ m_removedItemRanges.clear();
+ if (m_keysValues.isEmpty()) {
+ m_insertedItemRanges << qMakePair(0, m_size);
+ } else {
+ if (keysValues != m_keysValues) {
+ QStringList temp;
+ for (int i=0; i<m_keysValues.count(); i++) {
+ if (!keysValues.contains(m_keysValues[i]))
+ addIndexToRangeList(&m_removedItemRanges, i);
+ else
+ temp << m_keysValues[i];
+ }
+
+ for (int i=0; i<keysValues.count(); i++) {
+ if (temp.count() == i || keysValues[i] != temp[i]) {
+ temp.insert(i, keysValues[i]);
+ addIndexToRangeList(&m_insertedItemRanges, i);
+ }
+ }
+ }
+ }
+ m_keysValues = keysValues;
+
+ // Get the new values for each role.
//### we might be able to condense even further (query for everything in one go)
for (int i = 0; i < m_roleObjects->size(); ++i) {
- QmlXmlListModelRole *role = m_roleObjects->at(i);
+ QDeclarativeXmlListModelRole *role = m_roleObjects->at(i);
if (!role->isValid()) {
QList<QVariant> resultList;
for (int j = 0; j < m_size; ++j)
@@ -284,13 +339,13 @@ void QmlXmlQuery::doSubQueryJob()
continue;
}
subquery.setQuery(m_prefix + QLatin1String("(let $v := ") + role->query() + QLatin1String(" return if ($v) then ") + role->query() + QLatin1String(" else \"\")"));
- QXmlResultItems output3;
- subquery.evaluateTo(&output3);
- QXmlItem item(output3.next());
+ QXmlResultItems resultItems;
+ subquery.evaluateTo(&resultItems);
+ QXmlItem item(resultItems.next());
QList<QVariant> resultList;
while (!item.isNull()) {
resultList << item.toAtomicValue(); //### we used to trim strings
- item = output3.next();
+ item = resultItems.next();
}
//### should warn here if things have gone wrong.
while (resultList.count() < m_size)
@@ -303,7 +358,7 @@ void QmlXmlQuery::doSubQueryJob()
/*for (int j = 0; j < m_size; ++j) {
QList<QVariant> resultList;
for (int i = 0; i < m_roleObjects->size(); ++i) {
- QmlXmlListModelRole *role = m_roleObjects->at(i);
+ QDeclarativeXmlListModelRole *role = m_roleObjects->at(i);
subquery.setQuery(m_prefix.arg(j+1) + role->query());
if (role->isStringList()) {
QStringList data;
@@ -328,13 +383,13 @@ void QmlXmlQuery::doSubQueryJob()
}*/
}
-class QmlXmlListModelPrivate : public QObjectPrivate
+class QDeclarativeXmlListModelPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlXmlListModel)
+ Q_DECLARE_PUBLIC(QDeclarativeXmlListModel)
public:
- QmlXmlListModelPrivate()
+ QDeclarativeXmlListModelPrivate()
: isComponentComplete(true), size(-1), highestRole(Qt::UserRole)
- , reply(0), status(QmlXmlListModel::Null), progress(0.0)
+ , reply(0), status(QDeclarativeXmlListModel::Null), progress(0.0)
, queryId(-1), roleObjects() {}
bool isComponentComplete;
@@ -347,22 +402,22 @@ public:
QStringList roleNames;
int highestRole;
QNetworkReply *reply;
- QmlXmlListModel::Status status;
+ QDeclarativeXmlListModel::Status status;
qreal progress;
- QmlXmlQuery qmlXmlQuery;
+ QDeclarativeXmlQuery qmlXmlQuery;
int queryId;
- 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<QDeclarativeXmlListModelRole *> roleObjects;
+ static void append_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, QDeclarativeXmlListModelRole *role);
+ static void clear_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list);
+ static void removeAt_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, int i);
+ static void insert_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, int i, QDeclarativeXmlListModelRole *role);
QList<QList<QVariant> > data;
};
-void QmlXmlListModelPrivate::append_role(QmlListProperty<QmlXmlListModelRole> *list, QmlXmlListModelRole *role)
+void QDeclarativeXmlListModelPrivate::append_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, QDeclarativeXmlListModelRole *role)
{
- QmlXmlListModel *_this = qobject_cast<QmlXmlListModel *>(list->object);
+ QDeclarativeXmlListModel *_this = qobject_cast<QDeclarativeXmlListModel *>(list->object);
if (_this) {
int i = _this->d_func()->roleObjects.count();
_this->d_func()->roleObjects.append(role);
@@ -378,52 +433,67 @@ void QmlXmlListModelPrivate::append_role(QmlListProperty<QmlXmlListModelRole> *l
//### clear needs to invalidate any cached data (in data table) as well
// (and the model should emit the appropriate signals)
-void QmlXmlListModelPrivate::clear_role(QmlListProperty<QmlXmlListModelRole> *list)
+void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list)
{
- QmlXmlListModel *_this = static_cast<QmlXmlListModel *>(list->object);
+ QDeclarativeXmlListModel *_this = static_cast<QDeclarativeXmlListModel *>(list->object);
_this->d_func()->roles.clear();
_this->d_func()->roleNames.clear();
_this->d_func()->roleObjects.clear();
}
/*!
- \class QmlXmlListModel
+ \class QDeclarativeXmlListModel
\internal
*/
/*!
- \qmlclass XmlListModel QmlXmlListModel
+ \qmlclass XmlListModel QDeclarativeXmlListModel
\since 4.7
- \brief The XmlListModel element allows you to specify a model using XPath expressions.
+ \brief The XmlListModel element is used to specify a model using XPath expressions.
- XmlListModel allows you to construct a model from XML data that can then be used as a data source
- for the view classes (ListView, PathView, GridView) and any other classes that interact with model
- data (like Repeater).
+ XmlListModel is used to create a model from XML data that can be used as a data source
+ for the view classes (such as ListView, PathView, GridView) and other classes that interact with model
+ data (such as Repeater).
- The following is an example of a model containing news from a Yahoo RSS feed:
+ Here is an example of a model containing news from a Yahoo RSS feed:
\qml
XmlListModel {
id: feedModel
source: "http://rss.news.yahoo.com/rss/oceania"
query: "/rss/channel/item"
XmlRole { name: "title"; query: "title/string()" }
- XmlRole { name: "link"; query: "link/string()" }
+ XmlRole { name: "pubDate"; query: "pubDate/string()" }
XmlRole { name: "description"; query: "description/string()" }
}
\endqml
- \note The model is currently static, so the above is really just a snapshot of an RSS feed. To force a
- reload of the entire model, you can call the reload function.
+
+ You can also define certain roles as "keys" so that the model only adds data
+ that contains new values for these keys when reload() is called.
+
+ For example, if the roles above were defined like this:
+
+ \qml
+ XmlRole { name: "title"; query: "title/string()"; isKey: true }
+ XmlRole { name: "pubDate"; query: "pubDate/string()"; isKey: true }
+ \endqml
+
+ Then when reload() is called, the model will only add new items with a
+ "title" and "pubDate" value combination that is not already present in
+ the model.
+
+ This is useful to provide incremental updates and avoid repainting an
+ entire model in a view.
*/
-QmlXmlListModel::QmlXmlListModel(QObject *parent)
- : QListModelInterface(*(new QmlXmlListModelPrivate), parent)
+QDeclarativeXmlListModel::QDeclarativeXmlListModel(QObject *parent)
+ : QListModelInterface(*(new QDeclarativeXmlListModelPrivate), parent)
{
- Q_D(QmlXmlListModel);
+ Q_D(QDeclarativeXmlListModel);
connect(&d->qmlXmlQuery, SIGNAL(queryCompleted(int,int)),
this, SLOT(queryCompleted(int,int)));
}
-QmlXmlListModel::~QmlXmlListModel()
+QDeclarativeXmlListModel::~QDeclarativeXmlListModel()
{
}
@@ -432,18 +502,18 @@ QmlXmlListModel::~QmlXmlListModel()
The roles to make available for this model.
*/
-QmlListProperty<QmlXmlListModelRole> QmlXmlListModel::roleObjects()
+QDeclarativeListProperty<QDeclarativeXmlListModelRole> QDeclarativeXmlListModel::roleObjects()
{
- Q_D(QmlXmlListModel);
- QmlListProperty<QmlXmlListModelRole> list(this, d->roleObjects);
- list.append = &QmlXmlListModelPrivate::append_role;
- list.clear = &QmlXmlListModelPrivate::clear_role;
+ Q_D(QDeclarativeXmlListModel);
+ QDeclarativeListProperty<QDeclarativeXmlListModelRole> list(this, d->roleObjects);
+ list.append = &QDeclarativeXmlListModelPrivate::append_role;
+ list.clear = &QDeclarativeXmlListModelPrivate::clear_role;
return list;
}
-QHash<int,QVariant> QmlXmlListModel::data(int index, const QList<int> &roles) const
+QHash<int,QVariant> QDeclarativeXmlListModel::data(int index, const QList<int> &roles) const
{
- Q_D(const QmlXmlListModel);
+ Q_D(const QDeclarativeXmlListModel);
QHash<int, QVariant> rv;
for (int i = 0; i < roles.size(); ++i) {
int role = roles.at(i);
@@ -453,9 +523,9 @@ QHash<int,QVariant> QmlXmlListModel::data(int index, const QList<int> &roles) co
return rv;
}
-QVariant QmlXmlListModel::data(int index, int role) const
+QVariant QDeclarativeXmlListModel::data(int index, int role) const
{
- Q_D(const QmlXmlListModel);
+ Q_D(const QDeclarativeXmlListModel);
int roleIndex = d->roles.indexOf(role);
return (roleIndex == -1) ? QVariant() : d->data.at(roleIndex).at(index);
}
@@ -464,21 +534,21 @@ QVariant QmlXmlListModel::data(int index, int role) const
\qmlproperty int XmlListModel::count
The number of data entries in the model.
*/
-int QmlXmlListModel::count() const
+int QDeclarativeXmlListModel::count() const
{
- Q_D(const QmlXmlListModel);
+ Q_D(const QDeclarativeXmlListModel);
return d->size;
}
-QList<int> QmlXmlListModel::roles() const
+QList<int> QDeclarativeXmlListModel::roles() const
{
- Q_D(const QmlXmlListModel);
+ Q_D(const QDeclarativeXmlListModel);
return d->roles;
}
-QString QmlXmlListModel::toString(int role) const
+QString QDeclarativeXmlListModel::toString(int role) const
{
- Q_D(const QmlXmlListModel);
+ Q_D(const QDeclarativeXmlListModel);
int index = d->roles.indexOf(role);
if (index == -1)
return QString();
@@ -491,15 +561,15 @@ QString QmlXmlListModel::toString(int role) const
If both source and xml are set, xml will be used.
*/
-QUrl QmlXmlListModel::source() const
+QUrl QDeclarativeXmlListModel::source() const
{
- Q_D(const QmlXmlListModel);
+ Q_D(const QDeclarativeXmlListModel);
return d->src;
}
-void QmlXmlListModel::setSource(const QUrl &src)
+void QDeclarativeXmlListModel::setSource(const QUrl &src)
{
- Q_D(QmlXmlListModel);
+ Q_D(QDeclarativeXmlListModel);
if (d->src != src) {
d->src = src;
reload();
@@ -514,35 +584,35 @@ void QmlXmlListModel::setSource(const QUrl &src)
If both source and xml are set, xml will be used.
*/
-QString QmlXmlListModel::xml() const
+QString QDeclarativeXmlListModel::xml() const
{
- Q_D(const QmlXmlListModel);
+ Q_D(const QDeclarativeXmlListModel);
return d->xml;
}
-void QmlXmlListModel::setXml(const QString &xml)
+void QDeclarativeXmlListModel::setXml(const QString &xml)
{
- Q_D(QmlXmlListModel);
+ Q_D(QDeclarativeXmlListModel);
d->xml = xml;
reload();
}
/*!
- \qmlproperty url XmlListModel::query
+ \qmlproperty string XmlListModel::query
An absolute XPath query representing the base query for the model items. The query should start with
- a '/' or '//'.
+ '/' or '//'.
*/
-QString QmlXmlListModel::query() const
+QString QDeclarativeXmlListModel::query() const
{
- Q_D(const QmlXmlListModel);
+ Q_D(const QDeclarativeXmlListModel);
return d->query;
}
-void QmlXmlListModel::setQuery(const QString &query)
+void QDeclarativeXmlListModel::setQuery(const QString &query)
{
- Q_D(QmlXmlListModel);
+ Q_D(QDeclarativeXmlListModel);
if (!query.startsWith(QLatin1Char('/'))) {
- qmlInfo(this) << QCoreApplication::translate("QmlXmlRoleList", "An XmlListModel query must start with '/' or \"//\"");
+ qmlInfo(this) << QCoreApplication::translate("QDeclarativeXmlRoleList", "An XmlListModel query must start with '/' or \"//\"");
return;
}
@@ -556,15 +626,15 @@ void QmlXmlListModel::setQuery(const QString &query)
\qmlproperty string XmlListModel::namespaceDeclarations
A set of declarations for the namespaces used in the query.
*/
-QString QmlXmlListModel::namespaceDeclarations() const
+QString QDeclarativeXmlListModel::namespaceDeclarations() const
{
- Q_D(const QmlXmlListModel);
+ Q_D(const QDeclarativeXmlListModel);
return d->namespaces;
}
-void QmlXmlListModel::setNamespaceDeclarations(const QString &declarations)
+void QDeclarativeXmlListModel::setNamespaceDeclarations(const QString &declarations)
{
- Q_D(QmlXmlListModel);
+ Q_D(QDeclarativeXmlListModel);
if (d->namespaces != declarations) {
d->namespaces = declarations;
reload();
@@ -585,9 +655,9 @@ void QmlXmlListModel::setNamespaceDeclarations(const QString &declarations)
\sa progress
*/
-QmlXmlListModel::Status QmlXmlListModel::status() const
+QDeclarativeXmlListModel::Status QDeclarativeXmlListModel::status() const
{
- Q_D(const QmlXmlListModel);
+ Q_D(const QDeclarativeXmlListModel);
return d->status;
}
@@ -599,21 +669,21 @@ QmlXmlListModel::Status QmlXmlListModel::status() const
\sa status
*/
-qreal QmlXmlListModel::progress() const
+qreal QDeclarativeXmlListModel::progress() const
{
- Q_D(const QmlXmlListModel);
+ Q_D(const QDeclarativeXmlListModel);
return d->progress;
}
-void QmlXmlListModel::classBegin()
+void QDeclarativeXmlListModel::classBegin()
{
- Q_D(QmlXmlListModel);
+ Q_D(QDeclarativeXmlListModel);
d->isComponentComplete = false;
}
-void QmlXmlListModel::componentComplete()
+void QDeclarativeXmlListModel::componentComplete()
{
- Q_D(QmlXmlListModel);
+ Q_D(QDeclarativeXmlListModel);
d->isComponentComplete = true;
reload();
}
@@ -621,12 +691,17 @@ void QmlXmlListModel::componentComplete()
/*!
\qmlmethod XmlListModel::reload()
- Reloads the model. All the existing model data will be removed, and the model
- will be rebuilt from scratch.
+ Reloads the model.
+
+ If no key roles have been specified, all existing model
+ data is removed, and the model is rebuilt from scratch.
+
+ Otherwise, items are only added if the model does not already
+ contain items with matching key role values.
*/
-void QmlXmlListModel::reload()
+void QDeclarativeXmlListModel::reload()
{
- Q_D(QmlXmlListModel);
+ Q_D(QDeclarativeXmlListModel);
if (!d->isComponentComplete)
return;
@@ -634,12 +709,8 @@ void QmlXmlListModel::reload()
d->qmlXmlQuery.abort();
d->queryId = -1;
- //clear existing data
- int count = d->size;
- d->size = 0;
- d->data.clear();
- if (count > 0)
- emit itemsRemoved(0, count);
+ if (d->size < 0)
+ d->size = 0;
if (d->src.isEmpty() && d->xml.isEmpty())
return;
@@ -671,9 +742,9 @@ void QmlXmlListModel::reload()
this, SLOT(requestProgress(qint64,qint64)));
}
-void QmlXmlListModel::requestFinished()
+void QDeclarativeXmlListModel::requestFinished()
{
- Q_D(QmlXmlListModel);
+ Q_D(QDeclarativeXmlListModel);
if (d->reply->error() != QNetworkReply::NoError) {
disconnect(d->reply, 0, this, 0);
d->reply->deleteLater();
@@ -692,28 +763,35 @@ void QmlXmlListModel::requestFinished()
emit statusChanged(d->status);
}
-void QmlXmlListModel::requestProgress(qint64 received, qint64 total)
+void QDeclarativeXmlListModel::requestProgress(qint64 received, qint64 total)
{
- Q_D(QmlXmlListModel);
+ Q_D(QDeclarativeXmlListModel);
if (d->status == Loading && total > 0) {
d->progress = qreal(received)/total;
emit progressChanged(d->progress);
}
}
-void QmlXmlListModel::queryCompleted(int id, int size)
+void QDeclarativeXmlListModel::queryCompleted(int id, int size)
{
- Q_D(QmlXmlListModel);
+ Q_D(QDeclarativeXmlListModel);
if (id != d->queryId)
return;
+ bool sizeChanged = size != d->size;
d->size = size;
- if (size > 0) {
- d->data = d->qmlXmlQuery.modelData();
- emit itemsInserted(0, d->size);
+ d->data = d->qmlXmlQuery.modelData();
+
+ QList<QDeclarativeXmlListRange> removed = d->qmlXmlQuery.removedItemRanges();
+ for (int i=0; i<removed.count(); i++)
+ emit itemsRemoved(removed[i].first, removed[i].second);
+ QList<QDeclarativeXmlListRange> inserted = d->qmlXmlQuery.insertedItemRanges();
+ for (int i=0; i<inserted.count(); i++)
+ emit itemsInserted(inserted[i].first, inserted[i].second);
+
+ if (sizeChanged)
emit countChanged();
- }
}
QT_END_NAMESPACE
-#include <qmlxmllistmodel.moc>
+#include <qdeclarativexmllistmodel.moc>
diff --git a/src/declarative/util/qmlxmllistmodel_p.h b/src/declarative/util/qdeclarativexmllistmodel_p.h
index a6627e2..132a53c 100644
--- a/src/declarative/util/qmlxmllistmodel_p.h
+++ b/src/declarative/util/qdeclarativexmllistmodel_p.h
@@ -39,11 +39,13 @@
**
****************************************************************************/
-#ifndef QMLXMLLISTMODEL_H
-#define QMLXMLLISTMODEL_H
+#ifndef QDECLARATIVEXMLLISTMODEL_H
+#define QDECLARATIVEXMLLISTMODEL_H
-#include <qml.h>
-#include <qmlinfo.h>
+#include <qdeclarative.h>
+#include <qdeclarativeinfo.h>
+
+#include <QtCore/qurl.h>
#include "../3rdparty/qlistmodelinterface_p.h"
@@ -53,15 +55,15 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlContext;
+class QDeclarativeContext;
-class QmlXmlListModelRole;
+class QDeclarativeXmlListModelRole;
-class QmlXmlListModelPrivate;
-class Q_DECLARATIVE_EXPORT QmlXmlListModel : public QListModelInterface, public QmlParserStatus
+class QDeclarativeXmlListModelPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeXmlListModel : public QListModelInterface, public QDeclarativeParserStatus
{
Q_OBJECT
- Q_INTERFACES(QmlParserStatus)
+ Q_INTERFACES(QDeclarativeParserStatus)
Q_ENUMS(Status)
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
@@ -70,13 +72,13 @@ 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(QmlListProperty<QmlXmlListModelRole> roles READ roleObjects)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeXmlListModelRole> roles READ roleObjects)
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_CLASSINFO("DefaultProperty", "roles")
public:
- QmlXmlListModel(QObject *parent = 0);
- ~QmlXmlListModel();
+ QDeclarativeXmlListModel(QObject *parent = 0);
+ ~QDeclarativeXmlListModel();
virtual QHash<int,QVariant> data(int index, const QList<int> &roles = (QList<int>())) const;
virtual QVariant data(int index, int role) const;
@@ -84,7 +86,7 @@ public:
virtual QList<int> roles() const;
virtual QString toString(int role) const;
- QmlListProperty<QmlXmlListModelRole> roleObjects();
+ QDeclarativeListProperty<QDeclarativeXmlListModelRole> roleObjects();
QUrl source() const;
void setSource(const QUrl&);
@@ -123,14 +125,52 @@ private Q_SLOTS:
void queryCompleted(int,int);
private:
- Q_DECLARE_PRIVATE(QmlXmlListModel)
- Q_DISABLE_COPY(QmlXmlListModel)
+ Q_DECLARE_PRIVATE(QDeclarativeXmlListModel)
+ Q_DISABLE_COPY(QDeclarativeXmlListModel)
+};
+
+class Q_DECLARATIVE_EXPORT QDeclarativeXmlListModelRole : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(QString query READ query WRITE setQuery)
+ Q_PROPERTY(bool isKey READ isKey WRITE setIsKey)
+
+public:
+ QDeclarativeXmlListModelRole() : m_isKey(false) {}
+ ~QDeclarativeXmlListModelRole() {}
+
+ QString name() const { return m_name; }
+ void setName(const QString &name) { m_name = name; }
+
+ QString query() const { return m_query; }
+ void setQuery(const QString &query)
+ {
+ if (query.startsWith(QLatin1Char('/'))) {
+ qmlInfo(this) << tr("An XmlRole query must not start with '/'");
+ return;
+ }
+ m_query = query;
+ }
+
+ bool isKey() const { return m_isKey; }
+ void setIsKey(bool b) { m_isKey = b; }
+
+ bool isValid() {
+ return !m_name.isEmpty() && !m_query.isEmpty();
+ }
+
+private:
+ QString m_name;
+ QString m_query;
+ bool m_isKey;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlXmlListModel)
+QML_DECLARE_TYPE(QDeclarativeXmlListModel)
+QML_DECLARE_TYPE(QDeclarativeXmlListModelRole)
QT_END_HEADER
-#endif // QMLXMLLISTMODEL_H
+#endif // QDECLARATIVEXMLLISTMODEL_H
diff --git a/src/declarative/util/qfxperf.cpp b/src/declarative/util/qfxperf.cpp
index 8f5617c..5611c49 100644
--- a/src/declarative/util/qfxperf.cpp
+++ b/src/declarative/util/qfxperf.cpp
@@ -43,25 +43,25 @@
QT_BEGIN_NAMESPACE
-Q_DEFINE_PERFORMANCE_LOG(QmlPerf, "QmlGraphics") {
- Q_DEFINE_PERFORMANCE_METRIC(QmlParsing, "Compilation: QML Parsing")
+Q_DEFINE_PERFORMANCE_LOG(QDeclarativePerf, "QDeclarativeGraphics") {
+ Q_DEFINE_PERFORMANCE_METRIC(QDeclarativeParsing, "Compilation: QML Parsing")
Q_DEFINE_PERFORMANCE_METRIC(Compilation, " QML Compilation")
Q_DEFINE_PERFORMANCE_METRIC(VMEExecution, "Execution: QML VME Execution")
Q_DEFINE_PERFORMANCE_METRIC(BindInit, "BindValue Initialization")
Q_DEFINE_PERFORMANCE_METRIC(BindValue, "BindValue execution")
Q_DEFINE_PERFORMANCE_METRIC(BindValueSSE, "BindValue execution SSE")
Q_DEFINE_PERFORMANCE_METRIC(BindValueQt, "BindValue execution QtScript")
- Q_DEFINE_PERFORMANCE_METRIC(BindableValueUpdate, "QmlBinding::update")
+ Q_DEFINE_PERFORMANCE_METRIC(BindableValueUpdate, "QDeclarativeBinding::update")
Q_DEFINE_PERFORMANCE_METRIC(PixmapLoad, "Pixmap loading")
Q_DEFINE_PERFORMANCE_METRIC(FontDatabase, "Font database creation")
- Q_DEFINE_PERFORMANCE_METRIC(QmlGraphicsPathViewPathCache, "FX Items: QmlGraphicsPathView: Path cache")
- Q_DEFINE_PERFORMANCE_METRIC(CreateParticle, " QmlGraphicsParticles: Particle creation")
- Q_DEFINE_PERFORMANCE_METRIC(ItemComponentComplete, " QmlGraphicsItem::componentComplete")
- Q_DEFINE_PERFORMANCE_METRIC(ImageComponentComplete, " QmlGraphicsImage::componentComplete")
- Q_DEFINE_PERFORMANCE_METRIC(BaseLayoutComponentComplete, " QmlGraphicsBasePositioner::componentComplete")
- Q_DEFINE_PERFORMANCE_METRIC(TextComponentComplete, " QmlGraphicsText::componentComplete")
- Q_DEFINE_PERFORMANCE_METRIC(QmlGraphicsText_setText, " QmlGraphicsText::setText")
- Q_DEFINE_PERFORMANCE_METRIC(AddScript, "QmlScript::addScriptToEngine")
+ Q_DEFINE_PERFORMANCE_METRIC(QDeclarativePathViewPathCache, "FX Items: QDeclarativePathView: Path cache")
+ Q_DEFINE_PERFORMANCE_METRIC(CreateParticle, " QDeclarativeParticles: Particle creation")
+ Q_DEFINE_PERFORMANCE_METRIC(ItemComponentComplete, " QDeclarativeItem::componentComplete")
+ Q_DEFINE_PERFORMANCE_METRIC(ImageComponentComplete, " QDeclarativeImage::componentComplete")
+ Q_DEFINE_PERFORMANCE_METRIC(BaseLayoutComponentComplete, " QDeclarativeBasePositioner::componentComplete")
+ Q_DEFINE_PERFORMANCE_METRIC(TextComponentComplete, " QDeclarativeText::componentComplete")
+ Q_DEFINE_PERFORMANCE_METRIC(QDeclarativeText_setText, " QDeclarativeText::setText")
+ Q_DEFINE_PERFORMANCE_METRIC(AddScript, "QDeclarativeScript::addScriptToEngine")
}
QT_END_NAMESPACE
diff --git a/src/declarative/util/qfxperf_p_p.h b/src/declarative/util/qfxperf_p_p.h
index 106f761..8b65821 100644
--- a/src/declarative/util/qfxperf_p_p.h
+++ b/src/declarative/util/qfxperf_p_p.h
@@ -60,8 +60,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-Q_DECLARE_PERFORMANCE_LOG(QmlPerf) {
- Q_DECLARE_PERFORMANCE_METRIC(QmlParsing)
+Q_DECLARE_PERFORMANCE_LOG(QDeclarativePerf) {
+ Q_DECLARE_PERFORMANCE_METRIC(QDeclarativeParsing)
Q_DECLARE_PERFORMANCE_METRIC(Compilation)
Q_DECLARE_PERFORMANCE_METRIC(VMEExecution)
@@ -73,13 +73,13 @@ Q_DECLARE_PERFORMANCE_LOG(QmlPerf) {
Q_DECLARE_PERFORMANCE_METRIC(BindableValueUpdate)
Q_DECLARE_PERFORMANCE_METRIC(PixmapLoad)
Q_DECLARE_PERFORMANCE_METRIC(FontDatabase)
- Q_DECLARE_PERFORMANCE_METRIC(QmlGraphicsPathViewPathCache)
+ Q_DECLARE_PERFORMANCE_METRIC(QDeclarativePathViewPathCache)
Q_DECLARE_PERFORMANCE_METRIC(CreateParticle)
Q_DECLARE_PERFORMANCE_METRIC(ItemComponentComplete)
Q_DECLARE_PERFORMANCE_METRIC(ImageComponentComplete)
Q_DECLARE_PERFORMANCE_METRIC(BaseLayoutComponentComplete)
Q_DECLARE_PERFORMANCE_METRIC(TextComponentComplete)
- Q_DECLARE_PERFORMANCE_METRIC(QmlGraphicsText_setText)
+ Q_DECLARE_PERFORMANCE_METRIC(QDeclarativeText_setText)
Q_DECLARE_PERFORMANCE_METRIC(AddScript)
}
diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h
deleted file mode 100644
index 623ad8d..0000000
--- a/src/declarative/util/qmlanimation_p.h
+++ /dev/null
@@ -1,466 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 QMLANIMATION_H
-#define QMLANIMATION_H
-
-#include "qmltransition_p.h"
-#include "qmlstate_p.h"
-#include <QtGui/qvector3d.h>
-
-#include <qmlpropertyvaluesource.h>
-#include <qml.h>
-#include <qmlscriptstring.h>
-
-#include <QtCore/qvariant.h>
-#include <QtCore/QAbstractAnimation>
-#include <QtGui/qcolor.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QmlAbstractAnimationPrivate;
-class QmlAnimationGroup;
-class Q_AUTOTEST_EXPORT QmlAbstractAnimation : public QObject, public QmlPropertyValueSource, public QmlParserStatus
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlAbstractAnimation)
-
- Q_INTERFACES(QmlParserStatus)
- Q_INTERFACES(QmlPropertyValueSource)
- Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
- Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged)
- Q_PROPERTY(bool alwaysRunToEnd READ alwaysRunToEnd WRITE setAlwaysRunToEnd NOTIFY alwaysRunToEndChanged())
- Q_PROPERTY(bool repeat READ repeat WRITE setRepeat NOTIFY repeatChanged)
- Q_CLASSINFO("DefaultMethod", "start()")
-
-public:
- QmlAbstractAnimation(QObject *parent=0);
- virtual ~QmlAbstractAnimation();
-
- bool isRunning() const;
- void setRunning(bool);
- bool isPaused() const;
- void setPaused(bool);
- bool alwaysRunToEnd() const;
- void setAlwaysRunToEnd(bool);
- bool repeat() const;
- void setRepeat(bool);
-
- int currentTime();
- void setCurrentTime(int);
-
- QmlAnimationGroup *group() const;
- void setGroup(QmlAnimationGroup *);
-
- void setDefaultTarget(const QmlMetaProperty &);
- void setDisableUserControl();
-
- void classBegin();
- void componentComplete();
-
-Q_SIGNALS:
- void started();
- void completed();
- void runningChanged(bool);
- void pausedChanged(bool);
- void repeatChanged(bool);
- void alwaysRunToEndChanged(bool);
-
-public Q_SLOTS:
- void restart();
- void start();
- void pause();
- void resume();
- void stop();
- void complete();
-
-protected:
- QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObject *parent);
-
-public:
- enum TransitionDirection { Forward, Backward };
- virtual void transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
- TransitionDirection direction);
- virtual QAbstractAnimation *qtAnimation() = 0;
-
-private Q_SLOTS:
- void timelineComplete();
-
-private:
- virtual void setTarget(const QmlMetaProperty &);
-};
-
-class QmlPauseAnimationPrivate;
-class Q_AUTOTEST_EXPORT QmlPauseAnimation : public QmlAbstractAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlPauseAnimation)
-
- Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
-
-public:
- QmlPauseAnimation(QObject *parent=0);
- virtual ~QmlPauseAnimation();
-
- int duration() const;
- void setDuration(int);
-
-Q_SIGNALS:
- void durationChanged(int);
-
-protected:
- virtual QAbstractAnimation *qtAnimation();
-};
-
-class QmlScriptActionPrivate;
-class QmlScriptAction : public QmlAbstractAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlScriptAction)
-
- Q_PROPERTY(QmlScriptString script READ script WRITE setScript)
- Q_PROPERTY(QString stateChangeScriptName READ stateChangeScriptName WRITE setStateChangeScriptName)
-
-public:
- QmlScriptAction(QObject *parent=0);
- virtual ~QmlScriptAction();
-
- QmlScriptString script() const;
- void setScript(const QmlScriptString &);
-
- QString stateChangeScriptName() const;
- void setStateChangeScriptName(const QString &);
-
-protected:
- virtual void transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
- TransitionDirection direction);
- virtual QAbstractAnimation *qtAnimation();
-};
-
-class QmlPropertyActionPrivate;
-class QmlPropertyAction : public QmlAbstractAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlPropertyAction)
-
- Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
- Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged)
- 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)
-
-public:
- QmlPropertyAction(QObject *parent=0);
- virtual ~QmlPropertyAction();
-
- QObject *target() const;
- void setTarget(QObject *);
-
- QString property() const;
- void setProperty(const QString &);
-
- QString properties() const;
- void setProperties(const QString &);
-
- QmlListProperty<QObject> targets();
- QmlListProperty<QObject> exclude();
-
- QVariant value() const;
- void setValue(const QVariant &);
-
-Q_SIGNALS:
- void valueChanged(const QVariant &);
- void propertiesChanged(const QString &);
- void targetChanged(QObject *, const QString &);
-
-protected:
- virtual void transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
- TransitionDirection direction);
- virtual QAbstractAnimation *qtAnimation();
-};
-
-class QmlGraphicsItem;
-class QmlParentActionPrivate;
-class QmlParentAction : public QmlAbstractAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlParentAction)
-
- Q_PROPERTY(QmlGraphicsItem *target READ object WRITE setObject)
- Q_PROPERTY(QmlGraphicsItem *parent READ parent WRITE setParent) //### newParent
-
-public:
- QmlParentAction(QObject *parent=0);
- virtual ~QmlParentAction();
-
- QmlGraphicsItem *object() const;
- void setObject(QmlGraphicsItem *);
-
- QmlGraphicsItem *parent() const;
- void setParent(QmlGraphicsItem *);
-
-protected:
- virtual void transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
- TransitionDirection direction);
- virtual QAbstractAnimation *qtAnimation();
-};
-
-class QmlPropertyAnimationPrivate;
-class Q_AUTOTEST_EXPORT QmlPropertyAnimation : public QmlAbstractAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlPropertyAnimation)
-
- Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
- Q_PROPERTY(QVariant from READ from WRITE setFrom NOTIFY fromChanged)
- Q_PROPERTY(QVariant to READ to WRITE setTo NOTIFY toChanged)
- 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 properties READ properties WRITE setProperties NOTIFY propertiesChanged)
- Q_PROPERTY(QmlListProperty<QObject> targets READ targets)
- Q_PROPERTY(QmlListProperty<QObject> exclude READ exclude)
-
-public:
- QmlPropertyAnimation(QObject *parent=0);
- virtual ~QmlPropertyAnimation();
-
- int duration() const;
- void setDuration(int);
-
- QVariant from() const;
- void setFrom(const QVariant &);
-
- QVariant to() const;
- void setTo(const QVariant &);
-
- QString easing() const;
- void setEasing(const QString &);
-
- QObject *target() const;
- void setTarget(QObject *);
-
- QString property() const;
- void setProperty(const QString &);
-
- QString properties() const;
- void setProperties(const QString &);
-
- QmlListProperty<QObject> targets();
- QmlListProperty<QObject> exclude();
-
-protected:
- QmlPropertyAnimation(QmlPropertyAnimationPrivate &dd, QObject *parent);
- virtual void transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
- TransitionDirection direction);
- virtual QAbstractAnimation *qtAnimation();
-
-Q_SIGNALS:
- void durationChanged(int);
- void fromChanged(QVariant);
- void toChanged(QVariant);
- void easingChanged(const QString &);
- void propertiesChanged(const QString &);
- void targetChanged(QObject *, const QString &);
-};
-
-class Q_AUTOTEST_EXPORT QmlColorAnimation : public QmlPropertyAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlPropertyAnimation)
- Q_PROPERTY(QColor from READ from WRITE setFrom NOTIFY fromChanged)
- Q_PROPERTY(QColor to READ to WRITE setTo NOTIFY toChanged)
-
-public:
- QmlColorAnimation(QObject *parent=0);
- virtual ~QmlColorAnimation();
-
- QColor from() const;
- void setFrom(const QColor &);
-
- QColor to() const;
- void setTo(const QColor &);
-};
-
-class Q_AUTOTEST_EXPORT QmlNumberAnimation : public QmlPropertyAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlPropertyAnimation)
-
- Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged)
- Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged)
-
-public:
- QmlNumberAnimation(QObject *parent=0);
- virtual ~QmlNumberAnimation();
-
- qreal from() const;
- void setFrom(qreal);
-
- qreal to() const;
- void setTo(qreal);
-};
-
-class Q_AUTOTEST_EXPORT QmlVector3dAnimation : public QmlPropertyAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlPropertyAnimation)
-
- Q_PROPERTY(QVector3D from READ from WRITE setFrom NOTIFY fromChanged)
- Q_PROPERTY(QVector3D to READ to WRITE setTo NOTIFY toChanged)
-
-public:
- QmlVector3dAnimation(QObject *parent=0);
- virtual ~QmlVector3dAnimation();
-
- QVector3D from() const;
- void setFrom(QVector3D);
-
- QVector3D to() const;
- 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
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlAnimationGroup)
-
- Q_CLASSINFO("DefaultProperty", "animations")
- Q_PROPERTY(QmlListProperty<QmlAbstractAnimation> animations READ animations)
-
-public:
- QmlAnimationGroup(QObject *parent);
- virtual ~QmlAnimationGroup();
-
- QmlListProperty<QmlAbstractAnimation> animations();
- friend class QmlAbstractAnimation;
-};
-
-class QmlSequentialAnimation : public QmlAnimationGroup
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlAnimationGroup)
-
-public:
- QmlSequentialAnimation(QObject *parent=0);
- virtual ~QmlSequentialAnimation();
-
-protected:
- virtual void transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
- TransitionDirection direction);
- virtual QAbstractAnimation *qtAnimation();
-};
-
-class QmlParallelAnimation : public QmlAnimationGroup
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlAnimationGroup)
-
-public:
- QmlParallelAnimation(QObject *parent=0);
- virtual ~QmlParallelAnimation();
-
-protected:
- virtual void transition(QmlStateActions &actions,
- QmlMetaProperties &modified,
- TransitionDirection direction);
- virtual QAbstractAnimation *qtAnimation();
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QmlAbstractAnimation)
-QML_DECLARE_TYPE(QmlPauseAnimation)
-QML_DECLARE_TYPE(QmlScriptAction)
-QML_DECLARE_TYPE(QmlPropertyAction)
-QML_DECLARE_TYPE(QmlParentAction)
-QML_DECLARE_TYPE(QmlPropertyAnimation)
-QML_DECLARE_TYPE(QmlColorAnimation)
-QML_DECLARE_TYPE(QmlNumberAnimation)
-QML_DECLARE_TYPE(QmlSequentialAnimation)
-QML_DECLARE_TYPE(QmlParallelAnimation)
-QML_DECLARE_TYPE(QmlVector3dAnimation)
-QML_DECLARE_TYPE(QmlRotationAnimation)
-
-QT_END_HEADER
-
-#endif // QMLANIMATION_H
diff --git a/src/declarative/util/qmlconnection.cpp b/src/declarative/util/qmlconnection.cpp
deleted file mode 100644
index 204377c..0000000
--- a/src/declarative/util/qmlconnection.cpp
+++ /dev/null
@@ -1,288 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 "qmlconnection_p.h"
-
-#include <qmlexpression.h>
-#include <qmlboundsignal_p.h>
-#include <qmlcontext.h>
-
-#include <QtCore/qdebug.h>
-
-#include <private/qobject_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QmlConnectionPrivate : public QObjectPrivate
-{
-public:
- QmlConnectionPrivate() : boundsignal(0), signalSender(0), scriptset(false), componentcomplete(false) {}
-
- QmlBoundSignal *boundsignal;
- QObject *signalSender;
- QmlScriptString script;
- bool scriptset;
- QString signal;
- bool componentcomplete;
-};
-
-/*!
- \qmlclass Connection QmlConnection
- \since 4.7
- \brief A Connection object describes generalized connections to signals.
-
- When connecting to signals in QML, the usual way is to create an
- "on<Signal>" handler that reacts when a signal is received, like this:
-
- \qml
- MouseArea {
- onClicked: { foo(x+123,y+456) }
- }
- \endqml
-
- However, in some cases, it is not possible to connect to a signal in this
- way. For example, JavaScript-in-HTML style signal properties do not allow:
-
- \list
- \i connecting to signals with the same name but different parameters
- \i conformance checking that parameters are correctly named
- \i multiple connections to the same signal
- \i connections outside the scope of the signal sender
- \i signals in classes with coincidentally-named on<Signal> properties
- \endlist
-
- When any of these are needed, the Connection object can be used instead.
-
- For example, the above code can be changed to use a Connection object,
- like this:
-
- \qml
- MouseArea {
- Connection {
- signal: "clicked(x,y)"
- script: { foo(x+123,y+456) }
- }
- }
- \endqml
-
- More generally, the Connection object can be a child of some other object than
- the sender of the signal, and the script is the default attribute:
-
- \qml
- MouseArea {
- id: mr
- }
- ...
- Connection {
- sender: mr
- signal: "clicked(x,y)"
- script: { foo(x+123,y+456) }
- }
- \endqml
-*/
-
-/*!
- \internal
- \class QmlConnection
- \brief The QmlConnection class describes generalized connections to signals.
-
-*/
-QmlConnection::QmlConnection(QObject *parent) :
- QObject(*(new QmlConnectionPrivate), parent)
-{
-}
-
-QmlConnection::~QmlConnection()
-{
- Q_D(QmlConnection);
- delete d->boundsignal;
-}
-
-/*!
- \qmlproperty Object Connection::sender
- This property holds the object that sends the signal.
-
- By default, the sender is assumed to be the parent of the Connection.
-*/
-QObject *QmlConnection::signalSender() const
-{
- Q_D(const QmlConnection);
- return d->signalSender ? d->signalSender : parent();
-}
-
-void QmlConnection::setSignalSender(QObject *obj)
-{
- Q_D(QmlConnection);
- if (d->signalSender == obj)
- return;
- disconnectIfValid();
- d->signalSender = obj;
- connectIfValid();
-}
-
-void QmlConnection::connectIfValid()
-{
- Q_D(QmlConnection);
- if (!d->componentcomplete)
- return;
- // boundsignal must not exist
- if ((d->signalSender || parent()) && !d->signal.isEmpty() && d->scriptset) {
- // create
- // XXX scope?
- int sigIdx = -1;
- int lparen = d->signal.indexOf(QLatin1Char('('));
- QList<QByteArray> sigparams;
- if (lparen >= 0 && d->signal.length() > lparen+2) {
- QStringList l = d->signal.mid(lparen+1,d->signal.length()-lparen-2).split(QLatin1Char(','));
- foreach (const QString &s, l) {
- sigparams.append(s.trimmed().toUtf8());
- }
- }
- QString signalname = d->signal.left(lparen);
- QObject *sender = d->signalSender ? d->signalSender : parent();
- const QMetaObject *mo = sender->metaObject();
- int methods = mo->methodCount();
- for (int ii = 0; ii < methods; ++ii) {
- QMetaMethod method = mo->method(ii);
- QString methodName = QString::fromUtf8(method.signature());
- int idx = methodName.indexOf(QLatin1Char('('));
- methodName = methodName.left(idx);
- if (methodName == signalname && (lparen<0 || method.parameterNames() == sigparams)) {
- sigIdx = ii;
- break;
- }
- }
- if (sigIdx < 0) {
- // Cannot usefully warn, since could be in middle of
- // changing sender and signal.
- // XXX need state change transactions to do better
- return;
- }
-
- d->boundsignal = new QmlBoundSignal(qmlContext(this), d->script.script(), sender, mo->method(sigIdx), this);
- }
-}
-
-void QmlConnection::disconnectIfValid()
-{
- Q_D(QmlConnection);
- if (!d->componentcomplete)
- return;
- if ((d->signalSender || parent()) && !d->signal.isEmpty() && d->scriptset) {
- // boundsignal must exist
- // destroy
- delete d->boundsignal;
- d->boundsignal = 0;
- }
-}
-
-void QmlConnection::componentComplete()
-{
- Q_D(QmlConnection);
- d->componentcomplete=true;
- connectIfValid();
-}
-
-
-/*!
- \qmlproperty script Connection::script
- This property holds the JavaScript executed whenever the signal is sent.
-
- This is the default attribute of Connection.
-*/
-QmlScriptString QmlConnection::script() const
-{
- Q_D(const QmlConnection);
- return d->script;
-}
-
-void QmlConnection::setScript(const QmlScriptString& script)
-{
- Q_D(QmlConnection);
- if ((d->signalSender || parent()) && !d->signal.isEmpty()) {
- if (!d->scriptset) {
- // mustn't exist - create
- d->scriptset = true;
- d->script = script;
- connectIfValid();
- } else {
- // must exist - update
- d->script = script;
- d->boundsignal->expression()->setExpression(script.script());
- }
- } else {
- d->scriptset = true;
- d->script = script;
- }
-}
-
-/*!
- \qmlproperty string Connection::signal
- This property holds the signal from the sender to which the script is attached.
-
- The signal's formal parameter names must be given in parentheses:
-
- \qml
-Connection {
- signal: "clicked(x,y)"
- script: { ... }
-}
- \endqml
-*/
-QString QmlConnection::signal() const
-{
- Q_D(const QmlConnection);
- return d->signal;
-}
-
-void QmlConnection::setSignal(const QString& sig)
-{
- Q_D(QmlConnection);
- if (d->signal == sig)
- return;
- disconnectIfValid();
- d->signal = sig;
- connectIfValid();
-}
-
-QML_DEFINE_TYPE(Qt,4,6,Connection,QmlConnection)
-
-QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
deleted file mode 100644
index bd1f5f0..0000000
--- a/src/declarative/util/qmlstateoperations.cpp
+++ /dev/null
@@ -1,834 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 "qmlstateoperations_p.h"
-
-#include <qml.h>
-#include <qmlcontext.h>
-#include <qmlexpression.h>
-#include <qmlinfo.h>
-#include <qmlgraphicsanchors_p_p.h>
-#include <qmlgraphicsitem_p.h>
-#include <qmlguard_p.h>
-
-#include <QtCore/qdebug.h>
-#include <QtGui/qgraphicsitem.h>
-#include <QtCore/qmath.h>
-
-#include <private/qobject_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QmlParentChangePrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QmlParentChange)
-public:
- QmlParentChangePrivate() : target(0), parent(0), origParent(0), origStackBefore(0),
- rewindParent(0), rewindStackBefore(0) {}
-
- QmlGraphicsItem *target;
- QmlGraphicsItem *parent;
- QmlGuard<QmlGraphicsItem> origParent;
- QmlGuard<QmlGraphicsItem> origStackBefore;
- QmlGraphicsItem *rewindParent;
- QmlGraphicsItem *rewindStackBefore;
-
- void doChange(QmlGraphicsItem *targetParent, QmlGraphicsItem *stackBefore = 0);
-};
-
-void QmlParentChangePrivate::doChange(QmlGraphicsItem *targetParent, QmlGraphicsItem *stackBefore)
-{
- if (targetParent && target && target->parentItem()) {
- //### for backwards direction, can we just restore original x, y, scale, rotation
- Q_Q(QmlParentChange);
- bool ok;
- const QTransform &transform = target->itemTransform(targetParent, &ok);
- if (transform.type() >= QTransform::TxShear || !ok) {
- qmlInfo(q) << QmlParentChange::tr("Unable to preserve appearance under complex transform");
- ok = false;
- }
-
- qreal scale = 1;
- qreal rotation = 0;
- if (ok && transform.type() != QTransform::TxRotate) {
- if (transform.m11() == transform.m22())
- scale = transform.m11();
- else {
- 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) << 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) << QmlParentChange::tr("Unable to preserve appearance under scale of 0");
- ok = false;
- }
- }
-
- qreal xt = transform.dx();
- qreal yt = transform.dy();
- if (ok && target->transformOrigin() != QmlGraphicsItem::TopLeft) {
- qreal tempxt = target->transformOriginPoint().x();
- qreal tempyt = target->transformOriginPoint().y();
- QTransform t;
- t.translate(-tempxt, -tempyt);
- t.rotate(rotation);
- t.scale(scale, scale);
- t.translate(tempxt, tempyt);
- QPointF offset = t.map(QPointF(0,0));
- xt += offset.x();
- yt += offset.y();
- }
-
- target->setParentItem(targetParent);
- if (ok) {
- //qDebug() << xt << yt << rotation << scale;
- target->setX(xt);
- target->setY(yt);
- target->setRotation(rotation);
- target->setScale(scale);
- }
- } else if (target) {
- target->setParentItem(targetParent);
- }
-
- //restore the original stack position.
- //### if stackBefore has also been reparented this won't work
- if (stackBefore)
- target->stackBefore(stackBefore);
-}
-
-/*!
- \preliminary
- \qmlclass ParentChange QmlParentChange
- \brief The ParentChange element allows you to reparent an Item in a state change.
-
- ParentChange reparents an Item while preserving its visual appearance (position, rotation,
- and scale) on screen. You can then specify a transition to move/rotate/scale the Item to
- its final intended appearance.
-
- ParentChange can only preserve visual appearance if no complex transforms are involved.
- More specifically, it will not work if the transform property has been set for any
- Items involved in the reparenting (defined as any Items in the common ancestor tree
- for the original and new parent).
-
- You can specify at which point in a transition you want a ParentChange to occur by
- using a ParentAction.
-*/
-
-QML_DEFINE_TYPE(Qt,4,6,ParentChange,QmlParentChange)
-QmlParentChange::QmlParentChange(QObject *parent)
- : QmlStateOperation(*(new QmlParentChangePrivate), parent)
-{
-}
-
-QmlParentChange::~QmlParentChange()
-{
-}
-
-/*!
- \qmlproperty Item ParentChange::target
- This property holds the item to be reparented
-*/
-
-QmlGraphicsItem *QmlParentChange::object() const
-{
- Q_D(const QmlParentChange);
- return d->target;
-}
-
-void QmlParentChange::setObject(QmlGraphicsItem *target)
-{
- Q_D(QmlParentChange);
- d->target = target;
-}
-
-/*!
- \qmlproperty Item ParentChange::parent
- This property holds the parent for the item in this state
-*/
-
-QmlGraphicsItem *QmlParentChange::parent() const
-{
- Q_D(const QmlParentChange);
- return d->parent;
-}
-
-void QmlParentChange::setParent(QmlGraphicsItem *parent)
-{
- Q_D(QmlParentChange);
- d->parent = parent;
-}
-
-QmlStateOperation::ActionList QmlParentChange::actions()
-{
- Q_D(QmlParentChange);
- if (!d->target || !d->parent)
- return ActionList();
-
- QmlAction a;
- a.event = this;
-
- return ActionList() << a;
-}
-
-class AccessibleFxItem : public QmlGraphicsItem
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsItem)
-public:
- int siblingIndex() {
- Q_D(QmlGraphicsItem);
- return d->siblingIndex;
- }
-};
-
-void QmlParentChange::saveOriginals()
-{
- Q_D(QmlParentChange);
- saveCurrentValues();
- d->origParent = d->rewindParent;
- d->origStackBefore = d->rewindStackBefore;
-}
-
-void QmlParentChange::execute()
-{
- Q_D(QmlParentChange);
- d->doChange(d->parent);
-}
-
-bool QmlParentChange::isReversable()
-{
- return true;
-}
-
-void QmlParentChange::reverse()
-{
- Q_D(QmlParentChange);
- d->doChange(d->origParent, d->origStackBefore);
-}
-
-QString QmlParentChange::typeName() const
-{
- return QLatin1String("ParentChange");
-}
-
-bool QmlParentChange::override(QmlActionEvent*other)
-{
- Q_D(QmlParentChange);
- if (other->typeName() != QLatin1String("ParentChange"))
- return false;
- if (QmlParentChange *otherPC = static_cast<QmlParentChange*>(other))
- return (d->target == otherPC->object());
- return false;
-}
-
-void QmlParentChange::saveCurrentValues()
-{
- Q_D(QmlParentChange);
- if (!d->target) {
- d->rewindParent = 0;
- d->rewindStackBefore = 0;
- return;
- }
-
- d->rewindParent = d->target->parentItem();
-
- if (!d->rewindParent) {
- d->rewindStackBefore = 0;
- return;
- }
-
- //try to determine the item's original stack position so we can restore it
- int siblingIndex = ((AccessibleFxItem*)d->target)->siblingIndex() + 1;
- QList<QGraphicsItem*> children = d->rewindParent->childItems();
- for (int i = 0; i < children.count(); ++i) {
- QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem*>(children.at(i));
- if (!child)
- continue;
- if (((AccessibleFxItem*)child)->siblingIndex() == siblingIndex) {
- d->rewindStackBefore = child;
- break;
- }
- }
-}
-
-void QmlParentChange::rewind()
-{
- Q_D(QmlParentChange);
- d->doChange(d->rewindParent, d->rewindStackBefore);
-}
-
-class QmlStateChangeScriptPrivate : public QObjectPrivate
-{
-public:
- QmlStateChangeScriptPrivate() {}
-
- QmlScriptString script;
- QString name;
-};
-
-/*!
- \qmlclass StateChangeScript QmlStateChangeScript
- \brief The StateChangeScript element allows you to run a script in a state.
-
- The script specified will be run immediately when the state is made current.
- Alternatively you can use a ScriptAction to specify at which point in the transition
- you want the StateChangeScript to be run.
-*/
-QML_DEFINE_TYPE(Qt,4,6,StateChangeScript,QmlStateChangeScript)
-QmlStateChangeScript::QmlStateChangeScript(QObject *parent)
-: QmlStateOperation(*(new QmlStateChangeScriptPrivate), parent)
-{
-}
-
-QmlStateChangeScript::~QmlStateChangeScript()
-{
-}
-
-/*!
- \qmlproperty script StateChangeScript::script
- This property holds the script to run when the state is current.
-*/
-QmlScriptString QmlStateChangeScript::script() const
-{
- Q_D(const QmlStateChangeScript);
- return d->script;
-}
-
-void QmlStateChangeScript::setScript(const QmlScriptString &s)
-{
- Q_D(QmlStateChangeScript);
- d->script = s;
-}
-
-/*!
- \qmlproperty script StateChangeScript::script
- This property holds the name of the script. This name can be used by a
- ScriptAction to target a specific script.
-
- \sa ScriptAction::stateChangeScriptName
-*/
-QString QmlStateChangeScript::name() const
-{
- Q_D(const QmlStateChangeScript);
- return d->name;
-}
-
-void QmlStateChangeScript::setName(const QString &n)
-{
- Q_D(QmlStateChangeScript);
- d->name = n;
-}
-
-void QmlStateChangeScript::execute()
-{
- Q_D(QmlStateChangeScript);
- const QString &script = d->script.script();
- if (!script.isEmpty()) {
- QmlExpression expr(d->script.context(), script, d->script.scopeObject());
- expr.setTrackChange(false);
- expr.value();
- }
-}
-
-QmlStateChangeScript::ActionList QmlStateChangeScript::actions()
-{
- ActionList rv;
- QmlAction a;
- a.event = this;
- rv << a;
- return rv;
-}
-
-QString QmlStateChangeScript::typeName() const
-{
- return QLatin1String("StateChangeScript");
-}
-
-/*!
- \qmlclass AnchorChanges QmlAnchorChanges
- \brief The AnchorChanges element allows you to change the anchors of an item in a state.
-
- In the following example we change the top and bottom anchors of an item:
- \snippet examples/declarative/anchors/anchor-changes.qml 0
-
- AnchorChanges will 'inject' \c x, \c y, \c width, and \c height changes into the transition,
- so you can animate them as you would normally changes to these properties:
- \qml
- //animate our anchor changes
- NumberAnimation { targets: content; properties: "x,y,width,height" }
- \endqml
-
- For more information on anchors see \l {anchor-layout}{Anchor Layouts}.
-*/
-
-QML_DEFINE_TYPE(Qt,4,6,AnchorChanges,QmlAnchorChanges)
-
-class QmlAnchorChangesPrivate : public QObjectPrivate
-{
-public:
- QmlAnchorChangesPrivate() : target(0) {}
-
- QString name;
- QmlGraphicsItem *target;
- QString resetString;
- QStringList resetList;
- QmlGraphicsAnchorLine left;
- QmlGraphicsAnchorLine right;
- QmlGraphicsAnchorLine horizontalCenter;
- QmlGraphicsAnchorLine top;
- QmlGraphicsAnchorLine bottom;
- QmlGraphicsAnchorLine verticalCenter;
- QmlGraphicsAnchorLine baseline;
-
- QmlGraphicsAnchorLine origLeft;
- QmlGraphicsAnchorLine origRight;
- QmlGraphicsAnchorLine origHCenter;
- QmlGraphicsAnchorLine origTop;
- QmlGraphicsAnchorLine origBottom;
- QmlGraphicsAnchorLine origVCenter;
- QmlGraphicsAnchorLine origBaseline;
-
- QmlGraphicsAnchorLine rewindLeft;
- QmlGraphicsAnchorLine rewindRight;
- QmlGraphicsAnchorLine rewindHCenter;
- QmlGraphicsAnchorLine rewindTop;
- QmlGraphicsAnchorLine rewindBottom;
- QmlGraphicsAnchorLine rewindVCenter;
- QmlGraphicsAnchorLine rewindBaseline;
-
- qreal fromX;
- qreal fromY;
- qreal fromWidth;
- qreal fromHeight;
-};
-
-/*!
- \qmlproperty Item AnchorChanges::target
- This property holds the Item whose anchors will change
-*/
-
-QmlAnchorChanges::QmlAnchorChanges(QObject *parent)
- : QmlStateOperation(*(new QmlAnchorChangesPrivate), parent)
-{
-}
-
-QmlAnchorChanges::~QmlAnchorChanges()
-{
-}
-
-QmlAnchorChanges::ActionList QmlAnchorChanges::actions()
-{
- QmlAction a;
- a.event = this;
- return ActionList() << a;
-}
-
-QmlGraphicsItem *QmlAnchorChanges::object() const
-{
- Q_D(const QmlAnchorChanges);
- return d->target;
-}
-
-void QmlAnchorChanges::setObject(QmlGraphicsItem *target)
-{
- Q_D(QmlAnchorChanges);
- d->target = target;
-}
-
-QString QmlAnchorChanges::reset() const
-{
- Q_D(const QmlAnchorChanges);
- return d->resetString;
-}
-
-void QmlAnchorChanges::setReset(const QString &reset)
-{
- Q_D(QmlAnchorChanges);
- d->resetString = reset;
- d->resetList = d->resetString.split(QLatin1Char(','));
- for (int i = 0; i < d->resetList.count(); ++i)
- d->resetList[i] = d->resetList.at(i).trimmed();
-}
-
-/*!
- \qmlproperty AnchorLine AnchorChanges::left
- \qmlproperty AnchorLine AnchorChanges::right
- \qmlproperty AnchorLine AnchorChanges::horizontalCenter
- \qmlproperty AnchorLine AnchorChanges::top
- \qmlproperty AnchorLine AnchorChanges::bottom
- \qmlproperty AnchorLine AnchorChanges::verticalCenter
- \qmlproperty AnchorLine AnchorChanges::baseline
-
- These properties change the respective anchors of the item.
-*/
-
-QmlGraphicsAnchorLine QmlAnchorChanges::left() const
-{
- Q_D(const QmlAnchorChanges);
- return d->left;
-}
-
-void QmlAnchorChanges::setLeft(const QmlGraphicsAnchorLine &edge)
-{
- Q_D(QmlAnchorChanges);
- d->left = edge;
-}
-
-QmlGraphicsAnchorLine QmlAnchorChanges::right() const
-{
- Q_D(const QmlAnchorChanges);
- return d->right;
-}
-
-void QmlAnchorChanges::setRight(const QmlGraphicsAnchorLine &edge)
-{
- Q_D(QmlAnchorChanges);
- d->right = edge;
-}
-
-QmlGraphicsAnchorLine QmlAnchorChanges::horizontalCenter() const
-{
- Q_D(const QmlAnchorChanges);
- return d->horizontalCenter;
-}
-
-void QmlAnchorChanges::setHorizontalCenter(const QmlGraphicsAnchorLine &edge)
-{
- Q_D(QmlAnchorChanges);
- d->horizontalCenter = edge;
-}
-
-QmlGraphicsAnchorLine QmlAnchorChanges::top() const
-{
- Q_D(const QmlAnchorChanges);
- return d->top;
-}
-
-void QmlAnchorChanges::setTop(const QmlGraphicsAnchorLine &edge)
-{
- Q_D(QmlAnchorChanges);
- d->top = edge;
-}
-
-QmlGraphicsAnchorLine QmlAnchorChanges::bottom() const
-{
- Q_D(const QmlAnchorChanges);
- return d->bottom;
-}
-
-void QmlAnchorChanges::setBottom(const QmlGraphicsAnchorLine &edge)
-{
- Q_D(QmlAnchorChanges);
- d->bottom = edge;
-}
-
-QmlGraphicsAnchorLine QmlAnchorChanges::verticalCenter() const
-{
- Q_D(const QmlAnchorChanges);
- return d->verticalCenter;
-}
-
-void QmlAnchorChanges::setVerticalCenter(const QmlGraphicsAnchorLine &edge)
-{
- Q_D(QmlAnchorChanges);
- d->verticalCenter = edge;
-}
-
-QmlGraphicsAnchorLine QmlAnchorChanges::baseline() const
-{
- Q_D(const QmlAnchorChanges);
- return d->baseline;
-}
-
-void QmlAnchorChanges::setBaseline(const QmlGraphicsAnchorLine &edge)
-{
- Q_D(QmlAnchorChanges);
- d->baseline = edge;
-}
-
-void QmlAnchorChanges::execute()
-{
- Q_D(QmlAnchorChanges);
- if (!d->target)
- return;
-
- //set any anchors that have been specified
- if (d->left.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setLeft(d->left);
- if (d->right.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setRight(d->right);
- if (d->horizontalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setHorizontalCenter(d->horizontalCenter);
- if (d->top.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setTop(d->top);
- if (d->bottom.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setBottom(d->bottom);
- if (d->verticalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setVerticalCenter(d->verticalCenter);
- if (d->baseline.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setBaseline(d->baseline);
-}
-
-bool QmlAnchorChanges::isReversable()
-{
- return true;
-}
-
-void QmlAnchorChanges::reverse()
-{
- Q_D(QmlAnchorChanges);
- if (!d->target)
- return;
-
- //restore previous anchors
- if (d->origLeft.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setLeft(d->origLeft);
- if (d->origRight.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setRight(d->origRight);
- if (d->origHCenter.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setHorizontalCenter(d->origHCenter);
- if (d->origTop.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setTop(d->origTop);
- if (d->origBottom.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setBottom(d->origBottom);
- if (d->origVCenter.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setVerticalCenter(d->origVCenter);
- if (d->origBaseline.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setBaseline(d->origBaseline);
-}
-
-QString QmlAnchorChanges::typeName() const
-{
- return QLatin1String("AnchorChanges");
-}
-
-QList<QmlAction> QmlAnchorChanges::extraActions()
-{
- Q_D(QmlAnchorChanges);
- QList<QmlAction> extra;
-
- //### try to be smarter about which ones we add.
- // or short-circuit later on if they haven't actually changed.
- // we shouldn't set explicit width if there wasn't one before.
- if (d->target) {
- QmlAction a;
- a.fromValue = d->fromX;
- a.property = QmlMetaProperty(d->target, QLatin1String("x"));
- extra << a;
-
- a.fromValue = d->fromY;
- a.property = QmlMetaProperty(d->target, QLatin1String("y"));
- extra << a;
-
- a.fromValue = d->fromWidth;
- a.property = QmlMetaProperty(d->target, QLatin1String("width"));
- extra << a;
-
- a.fromValue = d->fromHeight;
- a.property = QmlMetaProperty(d->target, QLatin1String("height"));
- extra << a;
- }
-
- return extra;
-}
-
-bool QmlAnchorChanges::changesBindings()
-{
- return true;
-}
-
-void QmlAnchorChanges::saveOriginals()
-{
- Q_D(QmlAnchorChanges);
- d->origLeft = d->target->anchors()->left();
- d->origRight = d->target->anchors()->right();
- d->origHCenter = d->target->anchors()->horizontalCenter();
- d->origTop = d->target->anchors()->top();
- d->origBottom = d->target->anchors()->bottom();
- d->origVCenter = d->target->anchors()->verticalCenter();
- d->origBaseline = d->target->anchors()->baseline();
-
- saveCurrentValues();
-}
-
-void QmlAnchorChanges::clearForwardBindings()
-{
- Q_D(QmlAnchorChanges);
- d->fromX = d->target->x();
- d->fromY = d->target->y();
- d->fromWidth = d->target->width();
- d->fromHeight = d->target->height();
-
- //reset any anchors that have been specified
- if (d->resetList.contains(QLatin1String("left")))
- d->target->anchors()->resetLeft();
- if (d->resetList.contains(QLatin1String("right")))
- d->target->anchors()->resetRight();
- if (d->resetList.contains(QLatin1String("horizontalCenter")))
- d->target->anchors()->resetHorizontalCenter();
- if (d->resetList.contains(QLatin1String("top")))
- d->target->anchors()->resetTop();
- if (d->resetList.contains(QLatin1String("bottom")))
- d->target->anchors()->resetBottom();
- if (d->resetList.contains(QLatin1String("verticalCenter")))
- d->target->anchors()->resetVerticalCenter();
- if (d->resetList.contains(QLatin1String("baseline")))
- d->target->anchors()->resetBaseline();
-
- //reset any anchors that we'll be setting in the state
- if (d->left.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetLeft();
- if (d->right.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetRight();
- if (d->horizontalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetHorizontalCenter();
- if (d->top.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetTop();
- if (d->bottom.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetBottom();
- if (d->verticalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetVerticalCenter();
- if (d->baseline.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetBaseline();
-}
-
-void QmlAnchorChanges::clearReverseBindings()
-{
- Q_D(QmlAnchorChanges);
- d->fromX = d->target->x();
- d->fromY = d->target->y();
- d->fromWidth = d->target->width();
- d->fromHeight = d->target->height();
-
- //reset any anchors that were set in the state
- if (d->left.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetLeft();
- if (d->right.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetRight();
- if (d->horizontalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetHorizontalCenter();
- if (d->top.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetTop();
- if (d->bottom.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetBottom();
- if (d->verticalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetVerticalCenter();
- if (d->baseline.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetBaseline();
-
- //reset any anchors that were set in the original state
- if (d->origLeft.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetLeft();
- if (d->origRight.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetRight();
- if (d->origHCenter.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetHorizontalCenter();
- if (d->origTop.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetTop();
- if (d->origBottom.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetBottom();
- if (d->origVCenter.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetVerticalCenter();
- if (d->origBaseline.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->resetBaseline();
-}
-
-bool QmlAnchorChanges::override(QmlActionEvent*other)
-{
- if (other->typeName() != QLatin1String("AnchorChanges"))
- return false;
- if (static_cast<QmlActionEvent*>(this) == other)
- return true;
- if (static_cast<QmlAnchorChanges*>(other)->object() == object())
- return true;
- return false;
-}
-
-void QmlAnchorChanges::rewind()
-{
- Q_D(QmlAnchorChanges);
- if (!d->target)
- return;
-
- //restore previous anchors
- if (d->rewindLeft.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setLeft(d->rewindLeft);
- if (d->rewindRight.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setRight(d->rewindRight);
- if (d->rewindHCenter.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setHorizontalCenter(d->rewindHCenter);
- if (d->rewindTop.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setTop(d->rewindTop);
- if (d->rewindBottom.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setBottom(d->rewindBottom);
- if (d->rewindVCenter.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setVerticalCenter(d->rewindVCenter);
- if (d->rewindBaseline.anchorLine != QmlGraphicsAnchorLine::Invalid)
- d->target->anchors()->setBaseline(d->rewindBaseline);
-}
-
-void QmlAnchorChanges::saveCurrentValues()
-{
- Q_D(QmlAnchorChanges);
- d->rewindLeft = d->target->anchors()->left();
- d->rewindRight = d->target->anchors()->right();
- d->rewindHCenter = d->target->anchors()->horizontalCenter();
- d->rewindTop = d->target->anchors()->top();
- d->rewindBottom = d->target->anchors()->bottom();
- d->rewindVCenter = d->target->anchors()->verticalCenter();
- d->rewindBaseline = d->target->anchors()->baseline();
-}
-
-#include <qmlstateoperations.moc>
-#include <moc_qmlstateoperations_p.cpp>
-
-QT_END_NAMESPACE
-
diff --git a/src/declarative/util/qmlstateoperations_p.h b/src/declarative/util/qmlstateoperations_p.h
deleted file mode 100644
index dc1974b..0000000
--- a/src/declarative/util/qmlstateoperations_p.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 QMLSTATEOPERATIONS_H
-#define QMLSTATEOPERATIONS_H
-
-#include "qmlstate_p.h"
-
-#include <qmlgraphicsitem.h>
-#include "private/qmlgraphicsanchors_p.h"
-#include <qmlscriptstring.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QmlParentChangePrivate;
-class Q_DECLARATIVE_EXPORT QmlParentChange : public QmlStateOperation, public QmlActionEvent
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlParentChange)
-
- Q_PROPERTY(QmlGraphicsItem *target READ object WRITE setObject)
- Q_PROPERTY(QmlGraphicsItem *parent READ parent WRITE setParent)
-public:
- QmlParentChange(QObject *parent=0);
- ~QmlParentChange();
-
- QmlGraphicsItem *object() const;
- void setObject(QmlGraphicsItem *);
-
- QmlGraphicsItem *parent() const;
- void setParent(QmlGraphicsItem *);
-
- virtual ActionList actions();
-
- virtual void saveOriginals();
- virtual void execute();
- virtual bool isReversable();
- virtual void reverse();
- virtual QString typeName() const;
- virtual bool override(QmlActionEvent*other);
- virtual void rewind();
- virtual void saveCurrentValues();
-};
-
-class QmlStateChangeScriptPrivate;
-class Q_DECLARATIVE_EXPORT QmlStateChangeScript : public QmlStateOperation, public QmlActionEvent
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlStateChangeScript)
-
- Q_PROPERTY(QmlScriptString script READ script WRITE setScript)
- Q_PROPERTY(QString name READ name WRITE setName)
-
-public:
- QmlStateChangeScript(QObject *parent=0);
- ~QmlStateChangeScript();
-
- virtual ActionList actions();
-
- virtual QString typeName() const;
-
- QmlScriptString script() const;
- void setScript(const QmlScriptString &);
-
- QString name() const;
- void setName(const QString &);
-
- virtual void execute();
-};
-
-class QmlAnchorChangesPrivate;
-class Q_DECLARATIVE_EXPORT QmlAnchorChanges : public QmlStateOperation, public QmlActionEvent
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlAnchorChanges)
-
- Q_PROPERTY(QmlGraphicsItem *target READ object WRITE setObject)
- Q_PROPERTY(QString reset READ reset WRITE setReset)
- Q_PROPERTY(QmlGraphicsAnchorLine left READ left WRITE setLeft)
- Q_PROPERTY(QmlGraphicsAnchorLine right READ right WRITE setRight)
- Q_PROPERTY(QmlGraphicsAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter)
- Q_PROPERTY(QmlGraphicsAnchorLine top READ top WRITE setTop)
- Q_PROPERTY(QmlGraphicsAnchorLine bottom READ bottom WRITE setBottom)
- Q_PROPERTY(QmlGraphicsAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter)
- Q_PROPERTY(QmlGraphicsAnchorLine baseline READ baseline WRITE setBaseline)
-
-public:
- QmlAnchorChanges(QObject *parent=0);
- ~QmlAnchorChanges();
-
- virtual ActionList actions();
-
- QmlGraphicsItem *object() const;
- void setObject(QmlGraphicsItem *);
-
- QString reset() const;
- void setReset(const QString &);
-
- QmlGraphicsAnchorLine left() const;
- void setLeft(const QmlGraphicsAnchorLine &edge);
-
- QmlGraphicsAnchorLine right() const;
- void setRight(const QmlGraphicsAnchorLine &edge);
-
- QmlGraphicsAnchorLine horizontalCenter() const;
- void setHorizontalCenter(const QmlGraphicsAnchorLine &edge);
-
- QmlGraphicsAnchorLine top() const;
- void setTop(const QmlGraphicsAnchorLine &edge);
-
- QmlGraphicsAnchorLine bottom() const;
- void setBottom(const QmlGraphicsAnchorLine &edge);
-
- QmlGraphicsAnchorLine verticalCenter() const;
- void setVerticalCenter(const QmlGraphicsAnchorLine &edge);
-
- QmlGraphicsAnchorLine baseline() const;
- void setBaseline(const QmlGraphicsAnchorLine &edge);
-
- virtual void execute();
- virtual bool isReversable();
- virtual void reverse();
- virtual QString typeName() const;
- virtual bool override(QmlActionEvent*other);
- virtual QList<QmlAction> extraActions();
- virtual bool changesBindings();
- virtual void saveOriginals();
- virtual void clearForwardBindings();
- virtual void clearReverseBindings();
- virtual void rewind();
- virtual void saveCurrentValues();
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QmlParentChange)
-QML_DECLARE_TYPE(QmlStateChangeScript)
-QML_DECLARE_TYPE(QmlAnchorChanges)
-
-QT_END_HEADER
-
-#endif // QMLSTATEOPERATIONS_H
diff --git a/src/declarative/util/qnumberformat.cpp b/src/declarative/util/qnumberformat.cpp
index 42c12fe..81d0b90 100644
--- a/src/declarative/util/qnumberformat.cpp
+++ b/src/declarative/util/qnumberformat.cpp
@@ -40,11 +40,10 @@
****************************************************************************/
#include "qnumberformat_p.h"
+#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
-QML_DEFINE_NOCREATE_TYPE(QNumberFormat)
-
QNumberFormat::QNumberFormat(QObject *parent) : QObject(parent), _number(0), _type(Decimal),
_groupingSize(0)
{
diff --git a/src/declarative/util/qnumberformat_p.h b/src/declarative/util/qnumberformat_p.h
index 902dcde..ced4442 100644
--- a/src/declarative/util/qnumberformat_p.h
+++ b/src/declarative/util/qnumberformat_p.h
@@ -42,7 +42,7 @@
#ifndef NUMBERFORMAT_H
#define NUMBERFORMAT_H
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtCore/QLocale>
#include <QtCore/QTime>
diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri
index b6a5c90..198e9e5 100644
--- a/src/declarative/util/util.pri
+++ b/src/declarative/util/util.pri
@@ -1,72 +1,74 @@
INCLUDEPATH += $$PWD
SOURCES += \
- $$PWD/qmlview.cpp \
+ $$PWD/qdeclarativeutilmodule.cpp\
+ $$PWD/qdeclarativeview.cpp \
$$PWD/qfxperf.cpp \
$$PWD/qperformancelog.cpp \
- $$PWD/qmlconnection.cpp \
- $$PWD/qmlpackage.cpp \
- $$PWD/qmlanimation.cpp \
- $$PWD/qmlsystempalette.cpp \
- $$PWD/qmlspringfollow.cpp \
- $$PWD/qmleasefollow.cpp \
- $$PWD/qmlstate.cpp\
- $$PWD/qmltransitionmanager.cpp \
- $$PWD/qmlstateoperations.cpp \
- $$PWD/qmlpropertychanges.cpp \
- $$PWD/qmlstategroup.cpp \
- $$PWD/qmltransition.cpp \
- $$PWD/qmllistmodel.cpp\
- $$PWD/qmllistaccessor.cpp \
- $$PWD/qmlopenmetaobject.cpp \
- $$PWD/qmltimeline.cpp \
- $$PWD/qmltimer.cpp \
- $$PWD/qmlbind.cpp \
- $$PWD/qmlpropertymap.cpp \
- $$PWD/qmlpixmapcache.cpp \
+ $$PWD/qdeclarativeconnections.cpp \
+ $$PWD/qdeclarativepackage.cpp \
+ $$PWD/qdeclarativeanimation.cpp \
+ $$PWD/qdeclarativesystempalette.cpp \
+ $$PWD/qdeclarativespringfollow.cpp \
+ $$PWD/qdeclarativeeasefollow.cpp \
+ $$PWD/qdeclarativestate.cpp\
+ $$PWD/qdeclarativetransitionmanager.cpp \
+ $$PWD/qdeclarativestateoperations.cpp \
+ $$PWD/qdeclarativepropertychanges.cpp \
+ $$PWD/qdeclarativestategroup.cpp \
+ $$PWD/qdeclarativetransition.cpp \
+ $$PWD/qdeclarativelistmodel.cpp\
+ $$PWD/qdeclarativelistaccessor.cpp \
+ $$PWD/qdeclarativeopenmetaobject.cpp \
+ $$PWD/qdeclarativetimeline.cpp \
+ $$PWD/qdeclarativetimer.cpp \
+ $$PWD/qdeclarativebind.cpp \
+ $$PWD/qdeclarativepropertymap.cpp \
+ $$PWD/qdeclarativepixmapcache.cpp \
$$PWD/qnumberformat.cpp \
- $$PWD/qmlnumberformatter.cpp \
- $$PWD/qmldatetimeformatter.cpp \
- $$PWD/qmlbehavior.cpp \
- $$PWD/qmlfontloader.cpp \
- $$PWD/qmlstyledtext.cpp
+ $$PWD/qdeclarativenumberformatter.cpp \
+ $$PWD/qdeclarativedatetimeformatter.cpp \
+ $$PWD/qdeclarativebehavior.cpp \
+ $$PWD/qdeclarativefontloader.cpp \
+ $$PWD/qdeclarativestyledtext.cpp
HEADERS += \
- $$PWD/qmlview.h \
+ $$PWD/qdeclarativeutilmodule_p.h\
+ $$PWD/qdeclarativeview.h \
$$PWD/qfxperf_p_p.h \
$$PWD/qperformancelog_p_p.h \
- $$PWD/qmlconnection_p.h \
- $$PWD/qmlpackage_p.h \
- $$PWD/qmlanimation_p.h \
- $$PWD/qmlanimation_p_p.h \
- $$PWD/qmlsystempalette_p.h \
- $$PWD/qmlspringfollow_p.h \
- $$PWD/qmleasefollow_p.h \
- $$PWD/qmlstate_p.h\
- $$PWD/qmlstateoperations_p.h \
- $$PWD/qmlpropertychanges_p.h \
- $$PWD/qmlstate_p_p.h\
- $$PWD/qmltransitionmanager_p_p.h \
- $$PWD/qmlstategroup_p.h \
- $$PWD/qmltransition_p.h \
- $$PWD/qmllistmodel_p.h\
- $$PWD/qmllistaccessor_p.h \
- $$PWD/qmlopenmetaobject_p.h \
- $$PWD/qmlnullablevalue_p_p.h \
- $$PWD/qmltimeline_p_p.h \
- $$PWD/qmltimer_p.h \
- $$PWD/qmlbind_p.h \
- $$PWD/qmlpropertymap.h \
- $$PWD/qmlpixmapcache_p.h \
+ $$PWD/qdeclarativeconnections_p.h \
+ $$PWD/qdeclarativepackage_p.h \
+ $$PWD/qdeclarativeanimation_p.h \
+ $$PWD/qdeclarativeanimation_p_p.h \
+ $$PWD/qdeclarativesystempalette_p.h \
+ $$PWD/qdeclarativespringfollow_p.h \
+ $$PWD/qdeclarativeeasefollow_p.h \
+ $$PWD/qdeclarativestate_p.h\
+ $$PWD/qdeclarativestateoperations_p.h \
+ $$PWD/qdeclarativepropertychanges_p.h \
+ $$PWD/qdeclarativestate_p_p.h\
+ $$PWD/qdeclarativetransitionmanager_p_p.h \
+ $$PWD/qdeclarativestategroup_p.h \
+ $$PWD/qdeclarativetransition_p.h \
+ $$PWD/qdeclarativelistmodel_p.h\
+ $$PWD/qdeclarativelistaccessor_p.h \
+ $$PWD/qdeclarativeopenmetaobject_p.h \
+ $$PWD/qdeclarativenullablevalue_p_p.h \
+ $$PWD/qdeclarativetimeline_p_p.h \
+ $$PWD/qdeclarativetimer_p.h \
+ $$PWD/qdeclarativebind_p.h \
+ $$PWD/qdeclarativepropertymap.h \
+ $$PWD/qdeclarativepixmapcache_p.h \
$$PWD/qnumberformat_p.h \
- $$PWD/qmlnumberformatter_p.h \
- $$PWD/qmldatetimeformatter_p.h \
- $$PWD/qmlbehavior_p.h \
- $$PWD/qmlfontloader_p.h \
- $$PWD/qmlstyledtext_p.h
+ $$PWD/qdeclarativenumberformatter_p.h \
+ $$PWD/qdeclarativedatetimeformatter_p.h \
+ $$PWD/qdeclarativebehavior_p.h \
+ $$PWD/qdeclarativefontloader_p.h \
+ $$PWD/qdeclarativestyledtext_p.h
contains(QT_CONFIG, xmlpatterns) {
QT+=xmlpatterns
- SOURCES += $$PWD/qmlxmllistmodel.cpp
- HEADERS += $$PWD/qmlxmllistmodel_p.h
+ SOURCES += $$PWD/qdeclarativexmllistmodel.cpp
+ HEADERS += $$PWD/qdeclarativexmllistmodel_p.h
}
diff --git a/src/declarative/widgets/graphicslayouts.cpp b/src/declarative/widgets/graphicslayouts.cpp
deleted file mode 100644
index 62e941a..0000000
--- a/src/declarative/widgets/graphicslayouts.cpp
+++ /dev/null
@@ -1,319 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-** $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 "graphicslayouts_p.h"
-
-#include <QtGui/qgraphicswidget.h>
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-QML_DEFINE_INTERFACE(QGraphicsLayoutItem)
-QML_DEFINE_INTERFACE(QGraphicsLayout)
-
-QML_DEFINE_TYPE(Qt,4,6,QGraphicsLinearLayoutStretchItem,QGraphicsLinearLayoutStretchItemObject)
-QML_DEFINE_TYPE(Qt,4,6,QGraphicsLinearLayout,QGraphicsLinearLayoutObject)
-QML_DEFINE_TYPE(Qt,4,6,QGraphicsGridLayout,QGraphicsGridLayoutObject)
-
-class LinearLayoutAttached : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(int stretchFactor READ stretchFactor WRITE setStretchFactor NOTIFY stretchChanged)
- Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
-public:
- LinearLayoutAttached(QObject *parent)
- : QObject(parent), _stretch(1), _alignment(Qt::AlignCenter)
- {
- }
-
- int stretchFactor() const { return _stretch; }
- void setStretchFactor(int f)
- {
- if (_stretch == f)
- return;
-
- _stretch = f;
- emit stretchChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _stretch);
- }
-
- Qt::Alignment alignment() const { return _alignment; }
- void setAlignment(Qt::Alignment a)
- {
- if (_alignment == a)
- return;
-
- _alignment = a;
- emit alignmentChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _alignment);
- }
-
-Q_SIGNALS:
- void stretchChanged(QGraphicsLayoutItem*,int);
- void alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment);
-
-private:
- int _stretch;
- Qt::Alignment _alignment;
-};
-
-
-QGraphicsLinearLayoutStretchItemObject::QGraphicsLinearLayoutStretchItemObject(QObject *parent)
- : QObject(parent)
-{
-}
-
-QSizeF QGraphicsLinearLayoutStretchItemObject::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(which);
- Q_UNUSED(constraint);
- return QSizeF();
-}
-
-
-QGraphicsLinearLayoutObject::QGraphicsLinearLayoutObject(QObject *parent)
-: QObject(parent)
-{
-}
-
-QGraphicsLinearLayoutObject::~QGraphicsLinearLayoutObject()
-{
-}
-
-void QGraphicsLinearLayoutObject::insertLayoutItem(int index, QGraphicsLayoutItem *item)
-{
- insertItem(index, item);
-
- //connect attached properties
- if (LinearLayoutAttached *obj = attachedProperties.value(item)) {
- setStretchFactor(item, obj->stretchFactor());
- setAlignment(item, obj->alignment());
- QObject::connect(obj, SIGNAL(stretchChanged(QGraphicsLayoutItem*,int)),
- this, SLOT(updateStretch(QGraphicsLayoutItem*,int)));
- QObject::connect(obj, SIGNAL(alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment)),
- this, SLOT(updateAlignment(QGraphicsLayoutItem*,Qt::Alignment)));
- //### need to disconnect when widget is removed?
- }
-}
-
-//### is there a better way to do this?
-void QGraphicsLinearLayoutObject::clearChildren()
-{
- for (int i = 0; i < count(); ++i)
- removeAt(i);
-}
-
-void QGraphicsLinearLayoutObject::updateStretch(QGraphicsLayoutItem *item, int stretch)
-{
- QGraphicsLinearLayout::setStretchFactor(item, stretch);
-}
-
-void QGraphicsLinearLayoutObject::updateAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment)
-{
- QGraphicsLinearLayout::setAlignment(item, alignment);
-}
-
-QHash<QGraphicsLayoutItem*, LinearLayoutAttached*> QGraphicsLinearLayoutObject::attachedProperties;
-LinearLayoutAttached *QGraphicsLinearLayoutObject::qmlAttachedProperties(QObject *obj)
-{
- // ### This is not allowed - you must attach to any object
- if (!qobject_cast<QGraphicsLayoutItem*>(obj))
- return 0;
- LinearLayoutAttached *rv = new LinearLayoutAttached(obj);
- attachedProperties.insert(qobject_cast<QGraphicsLayoutItem*>(obj), rv);
- return rv;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////
-// QGraphicsGridLayout-related classes
-//////////////////////////////////////////////////////////////////////////////////////////////////////
-class GridLayoutAttached : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(int row READ row WRITE setRow)
- Q_PROPERTY(int column READ column WRITE setColumn)
- Q_PROPERTY(int rowSpan READ rowSpan WRITE setRowSpan)
- Q_PROPERTY(int columnSpan READ columnSpan WRITE setColumnSpan)
- Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
-public:
- GridLayoutAttached(QObject *parent)
- : QObject(parent), _row(-1), _column(-1), _rowspan(1), _colspan(1), _alignment(-1)
- {
- }
-
- int row() const { return _row; }
- void setRow(int r)
- {
- if (_row == r)
- return;
-
- _row = r;
- //emit rowChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _row);
- }
-
- int column() const { return _column; }
- void setColumn(int c)
- {
- if (_column == c)
- return;
-
- _column = c;
- //emit columnChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _column);
- }
-
- int rowSpan() const { return _rowspan; }
- void setRowSpan(int rs)
- {
- if (_rowspan == rs)
- return;
-
- _rowspan = rs;
- //emit rowSpanChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _rowSpan);
- }
-
- int columnSpan() const { return _colspan; }
- void setColumnSpan(int cs)
- {
- if (_colspan == cs)
- return;
-
- _colspan = cs;
- //emit columnSpanChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _columnSpan);
- }
-
- Qt::Alignment alignment() const { return _alignment; }
- void setAlignment(Qt::Alignment a)
- {
- if (_alignment == a)
- return;
-
- _alignment = a;
- //emit alignmentChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _alignment);
- }
-
-Q_SIGNALS:
- //void rowChanged(QGraphicsLayoutItem*,int);
- //void columnSpanChanged(QGraphicsLayoutItem*,int);
- //void rowSpanChanged(QGraphicsLayoutItem*,int);
- //void columnChanged(QGraphicsLayoutItem*,int);
- //void alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment);
-
-private:
- int _row;
- int _column;
- int _rowspan;
- int _colspan;
- Qt::Alignment _alignment;
-};
-
-
-QGraphicsGridLayoutObject::QGraphicsGridLayoutObject(QObject *parent)
-: QObject(parent)
-{
-}
-
-QGraphicsGridLayoutObject::~QGraphicsGridLayoutObject()
-{
-}
-
-void QGraphicsGridLayoutObject::addWidget(QGraphicsWidget *wid)
-{
- //use attached properties
- if (QObject *obj = attachedProperties.value(qobject_cast<QGraphicsLayoutItem*>(wid))) {
- int row = static_cast<GridLayoutAttached *>(obj)->row();
- int column = static_cast<GridLayoutAttached *>(obj)->column();
- int rowSpan = static_cast<GridLayoutAttached *>(obj)->rowSpan();
- int columnSpan = static_cast<GridLayoutAttached *>(obj)->columnSpan();
- if (row == -1 || column == -1) {
- qWarning() << "Must set row and column for an item in a grid layout";
- return;
- }
- addItem(wid, row, column, rowSpan, columnSpan);
- }
-}
-
-void QGraphicsGridLayoutObject::addLayoutItem(QGraphicsLayoutItem *item)
-{
- //use attached properties
- if (GridLayoutAttached *obj = attachedProperties.value(item)) {
- int row = obj->row();
- int column = obj->column();
- int rowSpan = obj->rowSpan();
- int columnSpan = obj->columnSpan();
- Qt::Alignment alignment = obj->alignment();
- if (row == -1 || column == -1) {
- qWarning() << "Must set row and column for an item in a grid layout";
- return;
- }
- addItem(item, row, column, rowSpan, columnSpan);
- if (alignment != -1)
- setAlignment(item,alignment);
- }
-}
-
-//### is there a better way to do this?
-void QGraphicsGridLayoutObject::clearChildren()
-{
- for (int i = 0; i < count(); ++i)
- removeAt(i);
-}
-
-qreal QGraphicsGridLayoutObject::spacing() const
-{
- if (verticalSpacing() == horizontalSpacing())
- return verticalSpacing();
- return -1; //###
-}
-
-QHash<QGraphicsLayoutItem*, GridLayoutAttached*> QGraphicsGridLayoutObject::attachedProperties;
-GridLayoutAttached *QGraphicsGridLayoutObject::qmlAttachedProperties(QObject *obj)
-{
- // ### This is not allowed - you must attach to any object
- if (!qobject_cast<QGraphicsLayoutItem*>(obj))
- return 0;
- GridLayoutAttached *rv = new GridLayoutAttached(obj);
- attachedProperties.insert(qobject_cast<QGraphicsLayoutItem*>(obj), rv);
- return rv;
-}
-
-QT_END_NAMESPACE
-
-#include <graphicslayouts.moc>
diff --git a/src/declarative/widgets/widgets.pri b/src/declarative/widgets/widgets.pri
deleted file mode 100644
index 4cae3ff..0000000
--- a/src/declarative/widgets/widgets.pri
+++ /dev/null
@@ -1,9 +0,0 @@
-INCLUDEPATH += $$PWD
-
-SOURCES += \
- $$PWD/graphicswidgets.cpp \
- $$PWD/graphicslayouts.cpp
-
-HEADERS += \
- $$PWD/graphicswidgets_p.h \
- $$PWD/graphicslayouts_p.h
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index b3ca3b5..4c4bfaf 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -156,8 +156,8 @@ public:
needSortChildren(0),
allChildrenDirty(0),
fullUpdatePending(0),
- flags(0),
dirtyChildrenBoundingRect(1),
+ flags(0),
paintedViewBoundingRectsNeedRepaint(0),
dirtySceneTransform(1),
geometryChanged(1),
@@ -474,11 +474,11 @@ public:
quint32 inSetPosHelper : 1;
quint32 needSortChildren : 1;
quint32 allChildrenDirty : 1;
+ quint32 fullUpdatePending : 1;
+ quint32 dirtyChildrenBoundingRect : 1;
// Packed 32 bits
- quint32 fullUpdatePending : 1;
quint32 flags : 17;
- quint32 dirtyChildrenBoundingRect : 1;
quint32 paintedViewBoundingRectsNeedRepaint : 1;
quint32 dirtySceneTransform : 1;
quint32 geometryChanged : 1;
@@ -492,10 +492,10 @@ public:
quint32 sceneTransformTranslateOnly : 1;
quint32 notifyBoundingRectChanged : 1;
quint32 notifyInvalidated : 1;
-
- // New 32 bits
quint32 mouseSetsFocus : 1;
quint32 explicitActivate : 1;
+
+ // New 32 bits
quint32 wantsActive : 1;
quint32 holesInSiblingIndex : 1;
quint32 sequentialOrdering : 1;
@@ -503,6 +503,7 @@ public:
quint32 scenePosDescendants : 1;
quint32 pendingPolish : 1;
quint32 mayHaveChildWithGraphicsEffect : 1;
+ quint32 padding : 25;
// Optional stacking order
int globalStackingOrder;
@@ -608,7 +609,7 @@ public:
return item->type() == QGraphicsPixmapItem::Type
&& !(item->flags() & QGraphicsItem::ItemIsSelectable)
&& item->d_ptr->children.size() == 0;
- //|| (item->d_ptr->isObject && qobject_cast<QmlGraphicsImage *>(q_func()));
+ //|| (item->d_ptr->isObject && qobject_cast<QDeclarativeImage *>(q_func()));
}
inline const QStyleOption *styleOption() const
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index aaae88e..40e1d2c 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -693,6 +693,18 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
--selectionChanging;
if (!selectionChanging && selectedItems.size() != oldSelectedItemsSize)
emit q->selectionChanged();
+
+ QHash<QGesture *, QGraphicsObject *>::iterator it;
+ for (it = gestureTargets.begin(); it != gestureTargets.end();) {
+ if (it.value() == item)
+ it = gestureTargets.erase(it);
+ else
+ ++it;
+ }
+ QGraphicsObject *dummy = static_cast<QGraphicsObject *>(item);
+ cachedTargetItems.removeOne(dummy);
+ cachedItemGestures.remove(dummy);
+ cachedAlreadyDeliveredGestures.remove(dummy);
}
/*!
@@ -5900,45 +5912,51 @@ void QGraphicsScenePrivate::leaveModal(QGraphicsItem *panel)
dispatchHoverEvent(&hoverEvent);
}
-void QGraphicsScenePrivate::getGestureTargets(const QSet<QGesture *> &gestures,
- QWidget *viewport,
- QMap<Qt::GestureType, QGesture *> *conflictedGestures,
- QList<QList<QGraphicsObject *> > *conflictedItems,
- QHash<QGesture *, QGraphicsObject *> *normalGestures)
+void QGraphicsScenePrivate::gestureTargetsAtHotSpots(const QSet<QGesture *> &gestures,
+ Qt::GestureFlag flag,
+ QHash<QGraphicsObject *, QSet<QGesture *> > *targets,
+ QSet<QGraphicsObject *> *itemsSet,
+ QSet<QGesture *> *normal,
+ QSet<QGesture *> *conflicts)
{
+ QSet<QGesture *> normalGestures; // that are not in conflicted state.
foreach (QGesture *gesture, gestures) {
- Qt::GestureType gestureType = gesture->gestureType();
- if (gesture->hasHotSpot()) {
- QPoint screenPos = gesture->hotSpot().toPoint();
- QList<QGraphicsItem *> items = itemsAtPosition(screenPos, QPointF(), viewport);
- QList<QGraphicsObject *> result;
- for (int j = 0; j < items.size(); ++j) {
- QGraphicsItem *item = items.at(j);
+ if (!gesture->hasHotSpot())
+ continue;
+ const Qt::GestureType gestureType = gesture->gestureType();
+ QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), gesture->d_func()->sceneHotSpot, 0);
+ for (int j = 0; j < items.size(); ++j) {
+ QGraphicsItem *item = items.at(j);
- // Check if the item is blocked by a modal panel and use it as
- // a target instead of this item.
- (void) item->isBlockedByModalPanel(&item);
+ // Check if the item is blocked by a modal panel and use it as
+ // a target instead of this item.
+ (void) item->isBlockedByModalPanel(&item);
- if (QGraphicsObject *itemobj = item->toGraphicsObject()) {
- QGraphicsItemPrivate *d = item->d_func();
- if (d->gestureContext.contains(gestureType)) {
- result.append(itemobj);
+ if (QGraphicsObject *itemobj = item->toGraphicsObject()) {
+ QGraphicsItemPrivate *d = item->QGraphicsItem::d_func();
+ QMap<Qt::GestureType, Qt::GestureFlags>::const_iterator it =
+ d->gestureContext.find(gestureType);
+ if (it != d->gestureContext.end() && (!flag || (it.value() & flag))) {
+ if (normalGestures.contains(gesture)) {
+ normalGestures.remove(gesture);
+ if (conflicts)
+ conflicts->insert(gesture);
+ } else {
+ normalGestures.insert(gesture);
}
+ if (targets)
+ (*targets)[itemobj].insert(gesture);
+ if (itemsSet)
+ (*itemsSet).insert(itemobj);
}
- // Don't propagate through panels.
- if (item->isPanel())
- break;
- }
- DEBUG() << "QGraphicsScenePrivate::getGestureTargets:"
- << gesture << result;
- if (result.size() == 1) {
- normalGestures->insert(gesture, result.first());
- } else if (!result.isEmpty()) {
- conflictedGestures->insert(gestureType, gesture);
- conflictedItems->append(result);
}
+ // Don't propagate through panels.
+ if (item->isPanel())
+ break;
}
}
+ if (normal)
+ *normal = normalGestures;
}
void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
@@ -5946,266 +5964,215 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
QWidget *viewport = event->widget();
if (!viewport)
return;
+ QGraphicsView *graphicsView = qobject_cast<QGraphicsView *>(viewport->parent());
+ if (!graphicsView)
+ return;
+
QList<QGesture *> allGestures = event->gestures();
DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
<< "Delivering gestures:" << allGestures;
- typedef QHash<QGraphicsObject *, QList<QGesture *> > GesturesPerItem;
- GesturesPerItem gesturesPerItem;
-
- // gestures that are only supposed to propagate to parent items.
- QSet<QGesture *> parentPropagatedGestures;
-
QSet<QGesture *> startedGestures;
+ QPoint delta = graphicsView->mapFromGlobal(QPoint());
+ QTransform toScene = QTransform::fromTranslate(delta.x(), delta.y())
+ * graphicsView->viewportTransform().inverted();
foreach (QGesture *gesture, allGestures) {
+ // cache scene coordinates of the hot spot
+ if (gesture->hasHotSpot()) {
+ gesture->d_func()->sceneHotSpot = toScene.map(gesture->hotSpot());
+ } else {
+ gesture->d_func()->sceneHotSpot = QPointF();
+ }
+
QGraphicsObject *target = gestureTargets.value(gesture, 0);
if (!target) {
// when we are not in started mode but don't have a target
// then the only one interested in gesture is the view/scene
if (gesture->state() == Qt::GestureStarted)
startedGestures.insert(gesture);
- } else {
- gesturesPerItem[target].append(gesture);
- Qt::GestureFlags flags =
- target->QGraphicsItem::d_func()->gestureContext.value(gesture->gestureType());
- if (flags & Qt::IgnoredGesturesPropagateToParent)
- parentPropagatedGestures.insert(gesture);
}
}
- QMap<Qt::GestureType, QGesture *> conflictedGestures;
- QList<QList<QGraphicsObject *> > conflictedItems;
- QHash<QGesture *, QGraphicsObject *> normalGestures;
- getGestureTargets(startedGestures, viewport, &conflictedGestures, &conflictedItems,
- &normalGestures);
- DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "Conflicting gestures:" << conflictedGestures.values() << conflictedItems;
- Q_ASSERT((conflictedGestures.isEmpty() && conflictedItems.isEmpty()) ||
- (!conflictedGestures.isEmpty() && !conflictedItems.isEmpty()));
-
- // gestures that were sent as override events, but no one accepted them
- QHash<QGesture *, QGraphicsObject *> ignoredConflictedGestures;
-
- // deliver conflicted gestures as override events first
- while (!conflictedGestures.isEmpty() && !conflictedItems.isEmpty()) {
- // get the topmost item to deliver the override event
- Q_ASSERT(!conflictedItems.isEmpty());
- Q_ASSERT(!conflictedItems.first().isEmpty());
- QGraphicsObject *topmost = conflictedItems.first().first();
- for (int i = 1; i < conflictedItems.size(); ++i) {
- QGraphicsObject *item = conflictedItems.at(i).first();
- if (qt_closestItemFirst(item, topmost)) {
- topmost = item;
- }
- }
- // get a list of gestures to send to the item
- QList<Qt::GestureType> grabbedGestures =
- topmost->QGraphicsItem::d_func()->gestureContext.keys();
- QList<QGesture *> gestures;
- for (int i = 0; i < grabbedGestures.size(); ++i) {
- if (QGesture *g = conflictedGestures.value(grabbedGestures.at(i), 0)) {
- gestures.append(g);
- if (!ignoredConflictedGestures.contains(g))
- ignoredConflictedGestures.insert(g, topmost);
- }
- }
-
- // send gesture override to the topmost item
- QGestureEvent ev(gestures);
- ev.t = QEvent::GestureOverride;
- ev.setWidget(event->widget());
- // mark event and individual gestures as ignored
- ev.ignore();
- foreach(QGesture *g, gestures)
- ev.setAccepted(g, false);
+ if (!startedGestures.isEmpty()) {
+ QSet<QGesture *> normalGestures; // that have just one target
+ QSet<QGesture *> conflictedGestures; // that have multiple possible targets
+ gestureTargetsAtHotSpots(startedGestures, Qt::GestureFlag(0), &cachedItemGestures, 0,
+ &normalGestures, &conflictedGestures);
+ cachedTargetItems = cachedItemGestures.keys();
+ qSort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst);
DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "delivering override to"
- << topmost << gestures;
- sendEvent(topmost, &ev);
- // mark all accepted gestures to deliver them as normal gesture events
- foreach (QGesture *g, gestures) {
- if (ev.isAccepted() || ev.isAccepted(g)) {
- conflictedGestures.remove(g->gestureType());
- gestureTargets.remove(g);
- // add the gesture to the list of normal delivered gestures
- normalGestures.insert(g, topmost);
+ << "Conflicting gestures:" << conflictedGestures;
+
+ // deliver conflicted gestures as override events AND remember
+ // initial gesture targets
+ if (!conflictedGestures.isEmpty()) {
+ for (int i = 0; i < cachedTargetItems.size(); ++i) {
+ QWeakPointer<QGraphicsObject> item = cachedTargetItems.at(i);
+
+ // get gestures to deliver to the current item
+ QSet<QGesture *> gestures = conflictedGestures & cachedItemGestures.value(item.data());
+ if (gestures.isEmpty())
+ continue;
+
DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "override was accepted:"
- << g << topmost;
- ignoredConflictedGestures.remove(g);
+ << "delivering override to"
+ << item.data() << gestures;
+ // send gesture override
+ QGestureEvent ev(gestures.toList());
+ ev.t = QEvent::GestureOverride;
+ ev.setWidget(event->widget());
+ // mark event and individual gestures as ignored
+ ev.ignore();
+ foreach(QGesture *g, gestures)
+ ev.setAccepted(g, false);
+ sendEvent(item.data(), &ev);
+ // mark all accepted gestures to deliver them as normal gesture events
+ foreach (QGesture *g, gestures) {
+ if (ev.isAccepted() || ev.isAccepted(g)) {
+ conflictedGestures.remove(g);
+ // mark the item as a gesture target
+ if (item)
+ gestureTargets.insert(g, item.data());
+ DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
+ << "override was accepted:"
+ << g << item.data();
+ }
+ // remember the first item that received the override event
+ // as it most likely become a target if noone else accepts
+ // the override event
+ if (!gestureTargets.contains(g) && item)
+ gestureTargets.insert(g, item.data());
+
+ }
+ if (conflictedGestures.isEmpty())
+ break;
}
}
- // remove the item that we've already delivered from the list
- for (int i = 0; i < conflictedItems.size(); ) {
- QList<QGraphicsObject *> &items = conflictedItems[i];
- if (items.first() == topmost) {
- items.removeFirst();
- if (items.isEmpty()) {
- conflictedItems.removeAt(i);
- continue;
+ // remember the initial target item for each gesture that was not in
+ // the conflicted state.
+ if (!normalGestures.isEmpty()) {
+ for (int i = 0; i < cachedTargetItems.size() && !normalGestures.isEmpty(); ++i) {
+ QGraphicsObject *item = cachedTargetItems.at(i);
+
+ // get gestures to deliver to the current item
+ foreach (QGesture *g, cachedItemGestures.value(item)) {
+ if (!gestureTargets.contains(g)) {
+ gestureTargets.insert(g, item);
+ normalGestures.remove(g);
+ }
}
}
- ++i;
}
}
- // put back those started gestures that are not in the conflicted state
- // and remember their targets
- QHash<QGesture *, QGraphicsObject *>::const_iterator it = normalGestures.begin(),
- e = normalGestures.end();
- for (; it != e; ++it) {
- QGesture *g = it.key();
- QGraphicsObject *receiver = it.value();
- Q_ASSERT(!gestureTargets.contains(g));
- gestureTargets.insert(g, receiver);
- gesturesPerItem[receiver].append(g);
- Qt::GestureFlags flags =
- receiver->QGraphicsItem::d_func()->gestureContext.value(g->gestureType());
- if (flags & Qt::IgnoredGesturesPropagateToParent)
- parentPropagatedGestures.insert(g);
- }
- it = ignoredConflictedGestures.begin();
- e = ignoredConflictedGestures.end();
- for (; it != e; ++it) {
- QGesture *g = it.key();
- QGraphicsObject *receiver = it.value();
- Q_ASSERT(!gestureTargets.contains(g));
- gestureTargets.insert(g, receiver);
- gesturesPerItem[receiver].append(g);
- Qt::GestureFlags flags =
- receiver->QGraphicsItem::d_func()->gestureContext.value(g->gestureType());
- if (flags & Qt::IgnoredGesturesPropagateToParent)
- parentPropagatedGestures.insert(g);
- }
-
- DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "Started gestures:" << normalGestures.keys()
- << "All gestures:" << gesturesPerItem.values();
// deliver all gesture events
- QList<QGesture *> alreadyIgnoredGestures;
- QHash<QGraphicsObject *, QSet<QGesture *> > itemIgnoredGestures;
- QList<QGraphicsObject *> targetItems = gesturesPerItem.keys();
- qSort(targetItems.begin(), targetItems.end(), qt_closestItemFirst);
- for (int i = 0; i < targetItems.size(); ++i) {
- QGraphicsObject *item = targetItems.at(i);
- QList<QGesture *> gestures = gesturesPerItem.value(item);
- // remove gestures that were already delivered once and were ignored
- DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "already ignored gestures for item"
- << item << ":" << itemIgnoredGestures.value(item);
-
- if (itemIgnoredGestures.contains(item)) // don't deliver twice to the same item
- continue;
-
- QGraphicsItemPrivate *gid = item->QGraphicsItem::d_func();
- foreach(QGesture *g, alreadyIgnoredGestures) {
- QMap<Qt::GestureType, Qt::GestureFlags>::iterator contextit =
- gid->gestureContext.find(g->gestureType());
- bool deliver = false;
- if (contextit != gid->gestureContext.end()) {
- if (g->state() == Qt::GestureStarted) {
- deliver = true;
- } else {
- const Qt::GestureFlags flags = contextit.value();
- if (flags & Qt::ReceivePartialGestures) {
- QGraphicsObject *originalTarget = gestureTargets.value(g);
- Q_ASSERT(originalTarget);
- QGraphicsItemPrivate *otd = originalTarget->QGraphicsItem::d_func();
- const Qt::GestureFlags originalTargetFlags = otd->gestureContext.value(g->gestureType());
- if (originalTargetFlags & Qt::IgnoredGesturesPropagateToParent) {
- // only deliver to parents of the original target item
- deliver = item->isAncestorOf(originalTarget);
- } else {
- deliver = true;
- }
- }
- }
- }
- if (deliver)
- gestures += g;
+ QSet<QGesture *> undeliveredGestures;
+ QSet<QGesture *> parentPropagatedGestures;
+ foreach (QGesture *gesture, allGestures) {
+ if (QGraphicsObject *target = gestureTargets.value(gesture, 0)) {
+ cachedItemGestures[target].insert(gesture);
+ cachedTargetItems.append(target);
+ undeliveredGestures.insert(gesture);
+ QGraphicsItemPrivate *d = target->QGraphicsItem::d_func();
+ const Qt::GestureFlags flags = d->gestureContext.value(gesture->gestureType());
+ if (flags & Qt::IgnoredGesturesPropagateToParent)
+ parentPropagatedGestures.insert(gesture);
}
+ }
+ qSort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst);
+ for (int i = 0; i < cachedTargetItems.size(); ++i) {
+ QWeakPointer<QGraphicsObject> receiver = cachedTargetItems.at(i);
+ QSet<QGesture *> gestures =
+ undeliveredGestures & cachedItemGestures.value(receiver.data());
+ gestures -= cachedAlreadyDeliveredGestures.value(receiver.data());
+
if (gestures.isEmpty())
continue;
+
+ cachedAlreadyDeliveredGestures[receiver.data()] += gestures;
+ const bool isPanel = receiver.data()->isPanel();
+
DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
<< "delivering to"
- << item << gestures;
- QGestureEvent ev(gestures);
+ << receiver.data() << gestures;
+ QGestureEvent ev(gestures.toList());
ev.setWidget(event->widget());
- sendEvent(item, &ev);
+ sendEvent(receiver.data(), &ev);
QSet<QGesture *> ignoredGestures;
foreach (QGesture *g, gestures) {
if (!ev.isAccepted() && !ev.isAccepted(g)) {
- ignoredGestures.insert(g);
+ // if the gesture was ignored by its target, we will update the
+ // targetItems list with a possible target items (items that
+ // want to receive partial gestures).
+ // ### wont' work if the target was destroyed in the event
+ // we will just stop delivering it.
+ if (receiver && receiver.data() == gestureTargets.value(g, 0))
+ ignoredGestures.insert(g);
} else {
- if (g->state() == Qt::GestureStarted)
- gestureTargets[g] = item;
- }
- }
- if (!ignoredGestures.isEmpty()) {
- // get a list of items under the (current) hotspot of each ignored
- // gesture and start delivery again from the beginning
- DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "item has ignored the event, will propagate."
- << item << ignoredGestures;
- itemIgnoredGestures[item] += ignoredGestures;
- alreadyIgnoredGestures = ignoredGestures.toList();
-
- // remove gestures that are supposed to be propagated to
- // parent items only.
- QSet<QGesture *> parentGestures;
- for (QSet<QGesture *>::iterator it = ignoredGestures.begin();
- it != ignoredGestures.end();) {
- if (parentPropagatedGestures.contains(*it)) {
- parentGestures.insert(*it);
- it = ignoredGestures.erase(it);
- } else {
- ++it;
+ if (receiver && g->state() == Qt::GestureStarted) {
+ // someone accepted the propagated initial GestureStarted
+ // event, let it be the new target for all following events.
+ gestureTargets[g] = receiver.data();
}
+ undeliveredGestures.remove(g);
}
+ }
+ if (undeliveredGestures.isEmpty())
+ break;
- QSet<QGraphicsObject *> itemsSet = targetItems.toSet();
-
- foreach(QGesture *g, parentGestures) {
- // get the original target for the gesture
- QGraphicsItem *item = gestureTargets.value(g, 0);
- Q_ASSERT(item);
- const Qt::GestureType gestureType = g->gestureType();
- // iterate through parent items of the original gesture
- // target item and collect potential receivers
- do {
- if (QGraphicsObject *obj = item->toGraphicsObject()) {
- if (item->d_func()->gestureContext.contains(gestureType))
- itemsSet.insert(obj);
+ // ignoredGestures list is only filled when delivering to the gesture
+ // target item, so it is safe to assume item == target.
+ if (!ignoredGestures.isEmpty() && !isPanel) {
+ // look for new potential targets for gestures that were ignored
+ // and should be propagated.
+
+ QSet<QGraphicsObject *> targetsSet = cachedTargetItems.toSet();
+
+ if (receiver) {
+ // first if the gesture should be propagated to parents only
+ for (QSet<QGesture *>::iterator it = ignoredGestures.begin();
+ it != ignoredGestures.end();) {
+ if (parentPropagatedGestures.contains(*it)) {
+ QGesture *gesture = *it;
+ const Qt::GestureType gestureType = gesture->gestureType();
+ QGraphicsItem *item = receiver.data();
+ while (item) {
+ if (QGraphicsObject *obj = item->toGraphicsObject()) {
+ if (item->d_func()->gestureContext.contains(gestureType)) {
+ targetsSet.insert(obj);
+ cachedItemGestures[obj].insert(gesture);
+ }
+ }
+ if (item->isPanel())
+ break;
+ item = item->parentItem();
+ }
+
+ it = ignoredGestures.erase(it);
+ continue;
}
- if (item->isPanel())
- break;
- } while ((item = item->parentItem()));
+ ++it;
+ }
}
- QMap<Qt::GestureType, QGesture *> conflictedGestures;
- QList<QList<QGraphicsObject *> > itemsForConflictedGestures;
- QHash<QGesture *, QGraphicsObject *> normalGestures;
- getGestureTargets(ignoredGestures, viewport,
- &conflictedGestures, &itemsForConflictedGestures,
- &normalGestures);
- for (int k = 0; k < itemsForConflictedGestures.size(); ++k)
- itemsSet += itemsForConflictedGestures.at(k).toSet();
-
- targetItems = itemsSet.toList();
+ gestureTargetsAtHotSpots(ignoredGestures, Qt::ReceivePartialGestures,
+ &cachedItemGestures, &targetsSet, 0, 0);
- qSort(targetItems.begin(), targetItems.end(), qt_closestItemFirst);
+ cachedTargetItems = targetsSet.toList();
+ qSort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst);
DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
- << "new targets:" << targetItems;
+ << "new targets:" << cachedTargetItems;
i = -1; // start delivery again
continue;
}
}
+
foreach (QGesture *g, startedGestures) {
if (g->gestureCancelPolicy() == QGesture::CancelAllInContext) {
DEBUG() << "lets try to cancel some";
// find gestures in context in Qt::GestureStarted or Qt::GestureUpdated state and cancel them
- cancelGesturesForChildren(g, event->widget());
+ cancelGesturesForChildren(g);
}
}
@@ -6220,9 +6187,13 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
break;
}
}
+
+ cachedTargetItems.clear();
+ cachedItemGestures.clear();
+ cachedAlreadyDeliveredGestures.clear();
}
-void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original, QWidget *viewport)
+void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original)
{
Q_ASSERT(original);
QGraphicsItem *originalItem = gestureTargets.value(original);
@@ -6278,8 +6249,7 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original, QWidge
if (!g->hasHotSpot())
continue;
- QPoint screenPos = g->hotSpot().toPoint();
- QList<QGraphicsItem *> items = itemsAtPosition(screenPos, QPointF(), viewport);
+ QList<QGraphicsItem *> items = itemsAtPosition(QPoint(), g->d_func()->sceneHotSpot, 0);
for (int j = 0; j < items.size(); ++j) {
QGraphicsObject *item = items.at(j)->toGraphicsObject();
if (!item)
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index 04ffe0f..ca8b829 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -294,13 +294,18 @@ public:
bool allItemsIgnoreTouchEvents;
void enableTouchEventsOnViews();
+ QList<QGraphicsObject *> cachedTargetItems;
+ QHash<QGraphicsObject *, QSet<QGesture *> > cachedItemGestures;
+ QHash<QGraphicsObject *, QSet<QGesture *> > cachedAlreadyDeliveredGestures;
QHash<QGesture *, QGraphicsObject *> gestureTargets;
void gestureEventHandler(QGestureEvent *event);
- void getGestureTargets(const QSet<QGesture *> &gestures, QWidget *viewport,
- QMap<Qt::GestureType, QGesture *> *conflictedGestures,
- QList<QList<QGraphicsObject *> > *conflictedItems,
- QHash<QGesture *, QGraphicsObject *> *normalGestures);
- void cancelGesturesForChildren(QGesture *original, QWidget *viewport);
+ void gestureTargetsAtHotSpots(const QSet<QGesture *> &gestures,
+ Qt::GestureFlag flag,
+ QHash<QGraphicsObject *, QSet<QGesture *> > *targets,
+ QSet<QGraphicsObject *> *itemsSet = 0,
+ QSet<QGesture *> *normal = 0,
+ QSet<QGesture *> *conflicts = 0);
+ void cancelGesturesForChildren(QGesture *original);
void updateInputMethodSensitivityInViews();
diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp
index 1aeb524..029154b 100644
--- a/src/gui/image/qpaintengine_pic.cpp
+++ b/src/gui/image/qpaintengine_pic.cpp
@@ -486,8 +486,11 @@ void QPicturePaintEngine::drawTextItem(const QPointF &p , const QTextItem &ti)
qDebug() << " -> drawTextItem():" << p << ti.text();
#endif
+ const QTextItemInt &si = static_cast<const QTextItemInt &>(ti);
+ if (si.chars == 0)
+ QPaintEngine::drawTextItem(p, ti); // Draw as path
+
if (d->pic_d->formatMajor >= 9) {
- const QTextItemInt &si = static_cast<const QTextItemInt &>(ti);
int pos;
SERIALIZE_CMD(QPicturePrivate::PdcDrawTextItem);
QFont fnt = ti.font();
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index 1c26e51..5128b64 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -2221,7 +2221,8 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
return;
}
case QHeaderViewPrivate::MoveSection: {
- if (qAbs(pos - d->firstPos) >= QApplication::startDragDistance()) {
+ if (qAbs(pos - d->firstPos) >= QApplication::startDragDistance()
+ || !d->sectionIndicator->isHidden()) {
int indicatorCenter = (d->orientation == Qt::Horizontal
? d->sectionIndicator->width()
: d->sectionIndicator->height()) / 2;
@@ -2233,12 +2234,6 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
return;
d->target = d->logicalIndex(visual);
d->updateSectionIndicator(d->section, pos);
- } else {
- int visual = visualIndexAt(d->firstPos);
- if (visual == -1)
- return;
- d->target = d->logicalIndex(visual);
- d->updateSectionIndicator(d->section, d->firstPos);
}
return;
}
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index e73013c..c63a07b 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -563,7 +563,7 @@ QVector<QPair<int, QVector<int > > > QSortFilterProxyModelPrivate::proxy_interva
int proxy_item = 0;
int source_items_index = 0;
QVector<int> source_items_in_interval;
- bool compare = (orient == Qt::Vertical && source_sort_column >= 0);
+ bool compare = (orient == Qt::Vertical && source_sort_column >= 0 && dynamic_sortfilter);
while (source_items_index < source_items.size()) {
source_items_in_interval.clear();
int first_new_source_item = source_items.at(source_items_index);
@@ -1244,7 +1244,7 @@ void QSortFilterProxyModelPrivate::_q_sourceRowsInserted(
const QModelIndex &source_parent, int start, int end)
{
source_items_inserted(source_parent, start, end, Qt::Vertical);
- if (update_source_sort_column()) //previous call to update_source_sort_column may fail if the model has no column.
+ if (update_source_sort_column() && dynamic_sortfilter) //previous call to update_source_sort_column may fail if the model has no column.
sort(); // now it should succeed so we need to make sure to sort again
}
@@ -1281,8 +1281,8 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsInserted(
if (source_parent.isValid())
return; //we sort according to the root column only
if (source_sort_column == -1) {
- //we update the source_sort_column depending on the prox_sort_column
- if (update_source_sort_column())
+ //we update the source_sort_column depending on the proxy_sort_column
+ if (update_source_sort_column() && dynamic_sortfilter)
sort();
} else {
if (start <= source_sort_column)
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 706d2a8..37168eb 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -3770,10 +3770,15 @@ void QTreeViewPrivate::rowsRemoved(const QModelIndex &parent,
if (previousSibiling != -1 && after && model->rowCount(parent) == start)
viewItems[previousSibiling].hasMoreSiblings = false;
-
- updateChildCount(parentItem, -removedCount);
- if (parentItem != -1 && viewItems.at(parentItem).total == 0)
- viewItems[parentItem].hasChildren = false; //every children have been removed;
+ if (parentItem != -1) {
+ if (viewItems.at(parentItem).expanded) {
+ updateChildCount(parentItem, -removedCount);
+ if (viewItems.at(parentItem).total == 0)
+ viewItems[parentItem].hasChildren = false; //every children have been removed;
+ } else if (viewItems[parentItem].hasChildren && !hasVisibleChildren(parent)) {
+ viewItems[parentItem].hasChildren = false;
+ }
+ }
if (after) {
q->updateGeometries();
viewport->update();
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index c6e192b..3c2c743 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -2221,30 +2221,60 @@ void qt_init(QApplicationPrivate *priv, int,
int format;
unsigned long length, after;
uchar *data = 0;
+ int rc;
+
+ do {
+ if (!qgetenv("KDE_FULL_SESSION").isEmpty()) {
+ X11->desktopEnvironment = DE_KDE;
+ X11->desktopVersion = qgetenv("KDE_SESSION_VERSION").toInt();
+ break;
+ }
+
+ if (qgetenv("DESKTOP_SESSION") == "gnome") {
+ X11->desktopEnvironment = DE_GNOME;
+ break;
+ }
+
+ // GNOME_DESKTOP_SESSION_ID is deprecated for some reason, but still check it
+ if (!qgetenv("GNOME_DESKTOP_SESSION_ID").isEmpty()) {
+ X11->desktopEnvironment = DE_GNOME;
+ break;
+ }
+
+ rc = XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_DT_SAVE_MODE),
+ 0, 2, False, XA_STRING, &type, &format, &length,
+ &after, &data);
+ if (rc == Success && length) {
+ if (!strcmp(reinterpret_cast<char *>(data), "xfce4")) {
+ // Pretend that xfce4 is gnome, as it uses the same libraries.
+ // The detection above is stolen from xdg-open.
+ X11->desktopEnvironment = DE_GNOME;
+ break;
+ }
+
+ // We got the property but it wasn't xfce4. Free data before it gets overwritten.
+ XFree(data);
+ data = 0;
+ }
+
+ rc = XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING),
+ 0, 1, False, AnyPropertyType, &type, &format, &length,
+ &after, &data);
+ if (rc == Success && length) {
+ // DTWM is running, meaning most likely CDE is running...
+ X11->desktopEnvironment = DE_CDE;
+ break;
+ }
+
+ rc = XGetWindowProperty(X11->display, QX11Info::appRootWindow(),
+ ATOM(_SGI_DESKS_MANAGER), 0, 1, False, XA_WINDOW,
+ &type, &format, &length, &after, &data);
+ if (rc == Success && length) {
+ X11->desktopEnvironment = DE_4DWM;
+ break;
+ }
+ } while(0);
- if (!qgetenv("KDE_FULL_SESSION").isEmpty()) {
- X11->desktopEnvironment = DE_KDE;
- X11->desktopVersion = qgetenv("KDE_SESSION_VERSION").toInt();
- } else if (!qgetenv("GNOME_DESKTOP_SESSION_ID").isEmpty() // Deprecated for some reason.
- || qgetenv("DESKTOP_SESSION") == "gnome") { // De-facto-standardized by GNOME.
- X11->desktopEnvironment = DE_GNOME;
- } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_DT_SAVE_MODE),
- 0, 2, False, XA_STRING, &type, &format, &length,
- &after, &data) == Success
- && !strcmp(reinterpret_cast<char *>(data), "xfce4")) {
- // Pretend that xfce4 is gnome, as it uses the same libraries.
- // The detection above is stolen from xdg-open.
- X11->desktopEnvironment = DE_GNOME;
- } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING),
- 0, 1, False, AnyPropertyType, &type, &format, &length,
- &after, &data) == Success && length) {
- // DTWM is running, meaning most likely CDE is running...
- X11->desktopEnvironment = DE_CDE;
- } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_SGI_DESKS_MANAGER),
- 0, 1, False, XA_WINDOW, &type, &format, &length, &after, &data) == Success
- && length) {
- X11->desktopEnvironment = DE_4DWM;
- }
if (data)
XFree((char *)data);
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 455176e..6a16403 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -419,6 +419,8 @@ extern "C" {
- (BOOL)isOpaque;
{
+ if (!qwidgetprivate)
+ return [super isOpaque];
return qwidgetprivate->isOpaque;
}
@@ -450,7 +452,7 @@ extern "C" {
}
// Make sure the opengl context is updated on resize.
- if (qwidgetprivate->isGLWidget) {
+ if (qwidgetprivate && qwidgetprivate->isGLWidget) {
qwidgetprivate->needWindowChange = true;
QEvent event(QEvent::MacGLWindowChange);
qApp->sendEvent(qwidget, &event);
@@ -459,11 +461,15 @@ extern "C" {
- (void)drawRect:(NSRect)aRect
{
+ if (!qwidget)
+ return;
+
if (QApplicationPrivate::graphicsSystem() != 0) {
if (QWidgetBackingStore *bs = qwidgetprivate->maybeBackingStore()) {
// Drawing is handled on the window level
- // See qcocoasharedwindowmethods_mac_p.
- return;
+ // See qcocoasharedwindowmethods_mac_p.h
+ if (!qwidget->testAttribute(Qt::WA_PaintOnScreen))
+ return;
}
}
CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
@@ -551,12 +557,18 @@ extern "C" {
- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
{
+ if (!qwidget)
+ return NO;
+
Q_UNUSED(theEvent);
return !qwidget->testAttribute(Qt::WA_MacNoClickThrough);
}
- (NSView *)hitTest:(NSPoint)aPoint
{
+ if (!qwidget)
+ return [super hitTest:aPoint];
+
if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents))
return nil; // You cannot hit a transparent for mouse event widget.
return [super hitTest:aPoint];
@@ -564,6 +576,9 @@ extern "C" {
- (void)updateTrackingAreas
{
+ if (!qwidget)
+ return;
+
// [NSView addTrackingArea] is slow, so bail out early if we can:
if (NSIsEmptyRect([self visibleRect]))
return;
@@ -597,6 +612,9 @@ extern "C" {
- (void)mouseEntered:(NSEvent *)event
{
+ if (!qwidget)
+ return;
+
if (qwidgetprivate->data.in_destructor)
return;
QEvent enterEvent(QEvent::Enter);
@@ -619,6 +637,9 @@ extern "C" {
- (void)mouseExited:(NSEvent *)event
{
+ if (!qwidget)
+ return;
+
QEvent leaveEvent(QEvent::Leave);
NSPoint globalPoint = [[event window] convertBaseToScreen:[event locationInWindow]];
if (!qAppInstance()->activeModalWidget() || QApplicationPrivate::tryModalHelper(qwidget, 0)) {
@@ -637,6 +658,9 @@ extern "C" {
- (void)flagsChanged:(NSEvent *)theEvent
{
+ if (!qwidget)
+ return;
+
QWidget *widgetToGetKey = qwidget;
QWidget *popup = qAppInstance()->activePopupWidget();
@@ -648,6 +672,9 @@ extern "C" {
- (void)mouseMoved:(NSEvent *)theEvent
{
+ if (!qwidget)
+ return;
+
// We always enable mouse tracking for all QCocoaView-s. In cases where we have
// child views, we will receive mouseMoved for both parent & the child (if
// mouse is over the child). We need to ignore the parent mouseMoved in such
@@ -938,6 +965,8 @@ extern "C" {
- (void)frameDidChange:(NSNotification *)note
{
Q_UNUSED(note);
+ if (!qwidget)
+ return;
if (qwidget->isWindow())
return;
NSRect newFrame = [self frame];
@@ -961,7 +990,7 @@ extern "C" {
{
QMacCocoaAutoReleasePool pool;
[super setEnabled:flag];
- if (qwidget->isEnabled() != flag)
+ if (qwidget && qwidget->isEnabled() != flag)
qwidget->setEnabled(flag);
}
@@ -972,6 +1001,8 @@ extern "C" {
- (BOOL)acceptsFirstResponder
{
+ if (!qwidget)
+ return NO;
if (qwidget->isWindow())
return YES; // Always do it, so that windows can accept key press events.
return qwidget->focusPolicy() != Qt::NoFocus;
@@ -979,6 +1010,8 @@ extern "C" {
- (BOOL)resignFirstResponder
{
+ if (!qwidget)
+ return NO;
// Seems like the following test only triggers if this
// view is inside a QMacNativeWidget:
if (qwidget == QApplication::focusWidget())
@@ -1014,6 +1047,12 @@ extern "C" {
return qwidget;
}
+- (void) qt_clearQWidget
+{
+ qwidget = 0;
+ qwidgetprivate = 0;
+}
+
- (BOOL)qt_leftButtonIsRightButton
{
return leftButtonIsRightButton;
@@ -1067,9 +1106,11 @@ extern "C" {
- (void)viewWillMoveToWindow:(NSWindow *)window
{
+ if (qwidget == 0)
+ return;
+
if (qwidget->windowFlags() & Qt::MSWindowsOwnDC
&& (window != [self window])) { // OpenGL Widget
- // Create a stupid ClearDrawable Event
QEvent event(QEvent::MacGLClearDrawable);
qApp->sendEvent(qwidget, &event);
}
@@ -1077,6 +1118,9 @@ extern "C" {
- (void)viewDidMoveToWindow
{
+ if (qwidget == 0)
+ return;
+
if (qwidget->windowFlags() & Qt::MSWindowsOwnDC && [self window]) {
// call update paint event
qwidgetprivate->needWindowChange = true;
@@ -1272,6 +1316,9 @@ extern "C" {
- (NSArray*) validAttributesForMarkedText
{
+ if (qwidget == 0)
+ return nil;
+
if (!qwidget->testAttribute(Qt::WA_InputMethodEnabled))
return nil; // Not sure if that's correct, but it's saves a malloc.
diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h
index 4bb10c5..33aaa24 100644
--- a/src/gui/kernel/qcocoaview_mac_p.h
+++ b/src/gui/kernel/qcocoaview_mac_p.h
@@ -103,6 +103,7 @@ Q_GUI_EXPORT
- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation;
- (BOOL)isComposing;
- (QWidget *)qt_qwidget;
+- (void) qt_clearQWidget;
- (BOOL)qt_leftButtonIsRightButton;
- (void)qt_setLeftButtonIsRightButton:(BOOL)isSwapped;
+ (DnDParams*)currentMouseEvent;
diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h
index dee5592..649a310 100644
--- a/src/gui/kernel/qgesture_p.h
+++ b/src/gui/kernel/qgesture_p.h
@@ -69,13 +69,13 @@ public:
QGesturePrivate()
: gestureType(Qt::CustomGesture), state(Qt::NoGesture),
isHotSpotSet(false), gestureCancelPolicy(0)
-
{
}
Qt::GestureType gestureType;
Qt::GestureState state;
QPointF hotSpot;
+ QPointF sceneHotSpot;
uint isHotSpotSet : 1;
uint gestureCancelPolicy : 2;
};
diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp
index 8735d27..c88a9a7 100644
--- a/src/gui/kernel/qgesturerecognizer.cpp
+++ b/src/gui/kernel/qgesturerecognizer.cpp
@@ -181,6 +181,7 @@ void QGestureRecognizer::reset(QGesture *gesture)
QGesturePrivate *d = gesture->d_func();
d->state = Qt::NoGesture;
d->hotSpot = QPointF();
+ d->sceneHotSpot = QPointF();
d->isHotSpotSet = false;
}
}
diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp
index 578f32a..e555c5c 100644
--- a/src/gui/kernel/qkeymapper_win.cpp
+++ b/src/gui/kernel/qkeymapper_win.cpp
@@ -619,7 +619,7 @@ void QKeyMapperPrivate::clearMappings()
/* MAKELCID()'s first argument is a WORD, and GetKeyboardLayout()
* returns a DWORD. */
- LCID newLCID = MAKELCID((DWORD)GetKeyboardLayout(0), SORT_DEFAULT);
+ LCID newLCID = MAKELCID((quintptr)GetKeyboardLayout(0), SORT_DEFAULT);
// keyboardInputLocale = qt_localeFromLCID(newLCID);
bool bidi = false;
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index e9fdbda..9560952 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -369,6 +369,16 @@ QMacTabletHash *qt_mac_tablet_hash()
}
#ifdef QT_MAC_USE_COCOA
+
+// Clears the QWidget pointer that each QCocoaView holds.
+void qt_mac_clearCocoaViewQWidgetPointers(QWidget *widget)
+{
+ QCocoaView *cocoaView = reinterpret_cast<QCocoaView *>(qt_mac_nativeview_for(widget));
+ if (cocoaView && [cocoaView respondsToSelector:@selector(qt_qwidget)]) {
+ [cocoaView qt_clearQWidget];
+ }
+}
+
void qt_dispatchTabletProximityEvent(void * /*NSEvent * */ tabletEvent)
{
NSEvent *proximityEvent = static_cast<NSEvent *>(tabletEvent);
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index d433048..1e9b1d9 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -1468,6 +1468,15 @@ QWidget::~QWidget()
d->declarativeData = 0; // don't activate again in ~QObject
}
+#ifdef QT_MAC_USE_COCOA
+ // QCocoaView holds a pointer back to this widget. Clear it now
+ // to make sure it's not followed later on. The lifetime of the
+ // QCocoaView might exceed the lifetime of this widget in cases
+ // where Cocoa itself holds references to it.
+ extern void qt_mac_clearCocoaViewQWidgetPointers(QWidget *);
+ qt_mac_clearCocoaViewQWidgetPointers(this);
+#endif
+
if (!d->children.isEmpty())
d->deleteChildren();
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 070491d..891f4c2 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -46,6 +46,7 @@
#include <private/qdrawhelper_armv6_p.h>
#include <private/qdrawhelper_neon_p.h>
#include <private/qmath_p.h>
+#include <private/qsimd_p.h>
#include <qmath.h>
QT_BEGIN_NAMESPACE
@@ -3700,7 +3701,7 @@ template <>
Q_STATIC_TEMPLATE_SPECIALIZATION
inline quint32 alpha_4(const qargb8555 *src)
{
- Q_ASSERT((long(src) & 0x3) == 0);
+ Q_ASSERT((quintptr(src) & 0x3) == 0);
const quint8 *src8 = reinterpret_cast<const quint8*>(src);
return src8[0] << 24 | src8[3] << 16 | src8[6] << 8 | src8[9];
}
@@ -4026,8 +4027,8 @@ template <>
inline void interpolate_pixel_4(qargb8565 *dest, const qargb8565 *src,
quint32 alpha)
{
- Q_ASSERT((long(dest) & 0x3) == 0);
- Q_ASSERT((long(src) & 0x3) == 0);
+ Q_ASSERT((quintptr(dest) & 0x3) == 0);
+ Q_ASSERT((quintptr(src) & 0x3) == 0);
const quint32 a = eff_alpha_4(alpha, dest);
const quint32 ia = eff_ialpha_4(alpha, dest);
@@ -4122,8 +4123,8 @@ template <>
inline void interpolate_pixel_4(qargb8555 *dest, const qargb8555 *src,
quint32 alpha)
{
- Q_ASSERT((long(dest) & 0x3) == 0);
- Q_ASSERT((long(src) & 0x3) == 0);
+ Q_ASSERT((quintptr(dest) & 0x3) == 0);
+ Q_ASSERT((quintptr(src) & 0x3) == 0);
const quint32 a = eff_alpha_4(alpha, dest);
@@ -4218,8 +4219,8 @@ template <>
inline void interpolate_pixel_4(qrgb888 *dest, const qrgb888 *src,
quint32 alpha)
{
- Q_ASSERT((long(dest) & 0x3) == 0);
- Q_ASSERT((long(src) & 0x3) == 0);
+ Q_ASSERT((quintptr(dest) & 0x3) == 0);
+ Q_ASSERT((quintptr(src) & 0x3) == 0);
const quint32 a = eff_alpha_4(alpha, dest);
const quint32 ia = eff_ialpha_4(alpha, dest);
@@ -4291,8 +4292,8 @@ template <class DST, class SRC>
inline void interpolate_pixel_4(DST *dest, quint8 a,
const SRC *src, quint8 b)
{
- Q_ASSERT((long(dest) & 0x3) == 0);
- Q_ASSERT((long(src) & 0x3) == 0);
+ Q_ASSERT((quintptr(dest) & 0x3) == 0);
+ Q_ASSERT((quintptr(src) & 0x3) == 0);
dest[0] = dest[0].byte_mul(a) + DST(src[0]).byte_mul(b);
dest[1] = dest[1].byte_mul(a) + DST(src[1]).byte_mul(b);
@@ -4303,8 +4304,8 @@ inline void interpolate_pixel_4(DST *dest, quint8 a,
template <class DST, class SRC>
inline void blend_sourceOver_4(DST *dest, const SRC *src)
{
- Q_ASSERT((long(dest) & 0x3) == 0);
- Q_ASSERT((long(src) & 0x3) == 0);
+ Q_ASSERT((quintptr(dest) & 0x3) == 0);
+ Q_ASSERT((quintptr(src) & 0x3) == 0);
const quint32 a = alpha_4(src);
if (a == 0xffffffff) {
@@ -4319,8 +4320,8 @@ inline void blend_sourceOver_4(DST *dest, const SRC *src)
template <>
inline void blend_sourceOver_4(qargb8565 *dest, const qargb8565 *src)
{
- Q_ASSERT((long(dest) & 0x3) == 0);
- Q_ASSERT((long(src) & 0x3) == 0);
+ Q_ASSERT((quintptr(dest) & 0x3) == 0);
+ Q_ASSERT((quintptr(src) & 0x3) == 0);
const quint32 a = alpha_4(src);
if (a == 0xffffffff) {
@@ -4333,8 +4334,8 @@ inline void blend_sourceOver_4(qargb8565 *dest, const qargb8565 *src)
template <>
inline void blend_sourceOver_4(qargb8555 *dest, const qargb8555 *src)
{
- Q_ASSERT((long(dest) & 0x3) == 0);
- Q_ASSERT((long(src) & 0x3) == 0);
+ Q_ASSERT((quintptr(dest) & 0x3) == 0);
+ Q_ASSERT((quintptr(src) & 0x3) == 0);
const quint32 a = alpha_4(src);
if (a == 0xffffffff) {
@@ -4347,8 +4348,8 @@ inline void blend_sourceOver_4(qargb8555 *dest, const qargb8555 *src)
template <>
inline void blend_sourceOver_4(qargb6666 *dest, const qargb6666 *src)
{
- Q_ASSERT((long(dest) & 0x3) == 0);
- Q_ASSERT((long(src) & 0x3) == 0);
+ Q_ASSERT((quintptr(dest) & 0x3) == 0);
+ Q_ASSERT((quintptr(src) & 0x3) == 0);
const quint32 a = alpha_4(src);
if (a == 0xffffffff) {
@@ -7720,199 +7721,6 @@ static void qt_memfill16_setup(quint16 *dest, quint16 value, int count);
qt_memfill32_func qt_memfill32 = qt_memfill32_setup;
qt_memfill16_func qt_memfill16 = qt_memfill16_setup;
-enum CPUFeatures {
- None = 0,
- MMX = 0x1,
- MMXEXT = 0x2,
- MMX3DNOW = 0x4,
- MMX3DNOWEXT = 0x8,
- SSE = 0x10,
- SSE2 = 0x20,
- CMOV = 0x40,
- IWMMXT = 0x80,
- NEON = 0x100
-};
-
-static uint detectCPUFeatures()
-{
-#if defined (Q_OS_WINCE)
-#if defined (ARM)
- if (IsProcessorFeaturePresent(PF_ARM_INTEL_WMMX))
- return IWMMXT;
-#elif defined(_X86_)
- uint features = 0;
-#if defined QT_HAVE_MMX
- if (IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE))
- features |= MMX;
-#endif
-#if defined QT_HAVE_3DNOW
- if (IsProcessorFeaturePresent(PF_3DNOW_INSTRUCTIONS_AVAILABLE))
- features |= MMX3DNOW;
-#endif
- return features;
-#endif
- return 0;
-#elif defined(QT_HAVE_IWMMXT)
- // runtime detection only available when running as a previlegied process
- static const bool doIWMMXT = !qgetenv("QT_NO_IWMMXT").toInt();
- return doIWMMXT ? IWMMXT : 0;
-#elif defined(QT_HAVE_NEON)
- static const bool doNEON = !qgetenv("QT_NO_NEON").toInt();
- return doNEON ? NEON : 0;
-#else
- uint features = 0;
-#if defined(__x86_64__) || defined(Q_OS_WIN64)
- features = MMX|SSE|SSE2|CMOV;
-#elif defined(__ia64__)
- features = MMX|SSE|SSE2;
-#elif defined(__i386__) || defined(_M_IX86)
- unsigned int extended_result = 0;
- uint result = 0;
- /* see p. 118 of amd64 instruction set manual Vol3 */
-#if defined(Q_CC_GNU)
- asm ("push %%ebx\n"
- "pushf\n"
- "pop %%eax\n"
- "mov %%eax, %%ebx\n"
- "xor $0x00200000, %%eax\n"
- "push %%eax\n"
- "popf\n"
- "pushf\n"
- "pop %%eax\n"
- "xor %%edx, %%edx\n"
- "xor %%ebx, %%eax\n"
- "jz 1f\n"
-
- "mov $0x00000001, %%eax\n"
- "cpuid\n"
- "1:\n"
- "pop %%ebx\n"
- "mov %%edx, %0\n"
- : "=r" (result)
- :
- : "%eax", "%ecx", "%edx"
- );
-
- asm ("push %%ebx\n"
- "pushf\n"
- "pop %%eax\n"
- "mov %%eax, %%ebx\n"
- "xor $0x00200000, %%eax\n"
- "push %%eax\n"
- "popf\n"
- "pushf\n"
- "pop %%eax\n"
- "xor %%edx, %%edx\n"
- "xor %%ebx, %%eax\n"
- "jz 2f\n"
-
- "mov $0x80000000, %%eax\n"
- "cpuid\n"
- "cmp $0x80000000, %%eax\n"
- "jbe 2f\n"
- "mov $0x80000001, %%eax\n"
- "cpuid\n"
- "2:\n"
- "pop %%ebx\n"
- "mov %%edx, %0\n"
- : "=r" (extended_result)
- :
- : "%eax", "%ecx", "%edx"
- );
-#elif defined (Q_OS_WIN)
- _asm {
- push eax
- push ebx
- push ecx
- push edx
- pushfd
- pop eax
- mov ebx, eax
- xor eax, 00200000h
- push eax
- popfd
- pushfd
- pop eax
- mov edx, 0
- xor eax, ebx
- jz skip
-
- mov eax, 1
- cpuid
- mov result, edx
- skip:
- pop edx
- pop ecx
- pop ebx
- pop eax
- }
-
- _asm {
- push eax
- push ebx
- push ecx
- push edx
- pushfd
- pop eax
- mov ebx, eax
- xor eax, 00200000h
- push eax
- popfd
- pushfd
- pop eax
- mov edx, 0
- xor eax, ebx
- jz skip2
-
- mov eax, 80000000h
- cpuid
- cmp eax, 80000000h
- jbe skip2
- mov eax, 80000001h
- cpuid
- mov extended_result, edx
- skip2:
- pop edx
- pop ecx
- pop ebx
- pop eax
- }
-#endif
-
- // result now contains the standard feature bits
- if (result & (1u << 15))
- features |= CMOV;
- if (result & (1u << 23))
- features |= MMX;
- if (extended_result & (1u << 22))
- features |= MMXEXT;
- if (extended_result & (1u << 31))
- features |= MMX3DNOW;
- if (extended_result & (1u << 30))
- features |= MMX3DNOWEXT;
- if (result & (1u << 25))
- features |= SSE;
- if (result & (1u << 26))
- features |= SSE2;
-#endif // i386
-
- if (qgetenv("QT_NO_MMX").toInt())
- features ^= MMX;
- if (qgetenv("QT_NO_MMXEXT").toInt())
- features ^= MMXEXT;
- if (qgetenv("QT_NO_3DNOW").toInt())
- features ^= MMX3DNOW;
- if (qgetenv("QT_NO_3DNOWEXT").toInt())
- features ^= MMX3DNOWEXT;
- if (qgetenv("QT_NO_SSE").toInt())
- features ^= SSE;
- if (qgetenv("QT_NO_SSE2").toInt())
- features ^= SSE2;
-
- return features;
-#endif
-}
-
#if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6)
// Move these to qdrawhelper_arm.c when all
// functions are implemented using arm assembly.
@@ -8005,10 +7813,7 @@ static void qt_blend_color_argb_armv6(int count, const QSpan *spans, void *userD
void qInitDrawhelperAsm()
{
- static uint features = 0xffffffff;
- if (features != 0xffffffff)
- return;
- features = detectCPUFeatures();
+ const uint features = qDetectCPUFeatures();
qt_memfill32 = qt_memfill_template<quint32, quint32>;
qt_memfill16 = qt_memfill_quint16; //qt_memfill_template<quint16, quint16>;
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index cb0db4f..f5b17ea 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -67,15 +67,6 @@
#include "QtGui/qscreen_qws.h"
#endif
-// Disable MMX and SSE on Mac/PPC builds, or if the compiler
-// does not support -Xarch argument passing
-#if defined(QT_NO_MAC_XARCH) || (defined(Q_OS_DARWIN) && (defined(__ppc__) || defined(__ppc64__)))
-#undef QT_HAVE_SSE2
-#undef QT_HAVE_SSE
-#undef QT_HAVE_3DNOW
-#undef QT_HAVE_MMX
-#endif
-
QT_BEGIN_NAMESPACE
#if defined(Q_CC_MSVC) && _MSCVER <= 1300 && !defined(Q_CC_INTEL)
@@ -1649,7 +1640,7 @@ inline void qt_memconvert(qrgb666 *dest, const quint32 *src, int count)
return;
}
- const int align = (long(dest) & 3);
+ const int align = (quintptr(dest) & 3);
switch (align) {
case 1: *dest++ = qrgb666(*src++); --count;
case 2: *dest++ = qrgb666(*src++); --count;
diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp
index 5619a2e..d76c709 100644
--- a/src/gui/painting/qdrawutil.cpp
+++ b/src/gui/painting/qdrawutil.cpp
@@ -1081,7 +1081,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs,
according to the \a margins structure.
*/
-typedef QVarLengthArray<QDrawPixmaps::Data, 16> QDrawPixmapsDataArray;
+typedef QVarLengthArray<QPainter::Fragment, 16> QPixmapFragmentsArray;
/*!
\since 4.6
@@ -1102,12 +1102,12 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
const QPixmap &pixmap, const QRect &sourceRect,const QMargins &sourceMargins,
const QTileRules &rules, QDrawBorderPixmap::DrawingHints hints)
{
- QDrawPixmaps::Data d;
+ QPainter::Fragment d;
d.opacity = 1.0;
d.rotation = 0.0;
- QDrawPixmapsDataArray opaqueData;
- QDrawPixmapsDataArray translucentData;
+ QPixmapFragmentsArray opaqueData;
+ QPixmapFragmentsArray translucentData;
// source center
const int sourceCenterTop = sourceRect.top() + sourceMargins.top();
@@ -1182,44 +1182,56 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
// corners
if (targetMargins.top() > 0 && targetMargins.left() > 0 && sourceMargins.top() > 0 && sourceMargins.left() > 0) { // top left
- d.point.setX(0.5 * (xTarget[1] + xTarget[0]));
- d.point.setY(0.5 * (yTarget[1] + yTarget[0]));
- d.source = QRectF(sourceRect.left(), sourceRect.top(), sourceMargins.left(), sourceMargins.top());
- d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.source.width();
- d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.source.height();
+ d.x = (0.5 * (xTarget[1] + xTarget[0]));
+ d.y = (0.5 * (yTarget[1] + yTarget[0]));
+ d.sourceLeft = sourceRect.left();
+ d.sourceTop = sourceRect.top();
+ d.width = sourceMargins.left();
+ d.height = sourceMargins.top();
+ d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width;
+ d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height;
if (hints & QDrawBorderPixmap::OpaqueTopLeft)
opaqueData.append(d);
else
translucentData.append(d);
}
if (targetMargins.top() > 0 && targetMargins.right() > 0 && sourceMargins.top() > 0 && sourceMargins.right() > 0) { // top right
- d.point.setX(0.5 * (xTarget[columns] + xTarget[columns - 1]));
- d.point.setY(0.5 * (yTarget[1] + yTarget[0]));
- d.source = QRectF(sourceCenterRight, sourceRect.top(), sourceMargins.right(), sourceMargins.top());
- d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.source.width();
- d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.source.height();
+ d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1]));
+ d.y = (0.5 * (yTarget[1] + yTarget[0]));
+ d.sourceLeft = sourceCenterRight;
+ d.sourceTop = sourceRect.top();
+ d.width = sourceMargins.right();
+ d.height = sourceMargins.top();
+ d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width;
+ d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height;
if (hints & QDrawBorderPixmap::OpaqueTopRight)
opaqueData.append(d);
else
translucentData.append(d);
}
if (targetMargins.bottom() > 0 && targetMargins.left() > 0 && sourceMargins.bottom() > 0 && sourceMargins.left() > 0) { // bottom left
- d.point.setX(0.5 * (xTarget[1] + xTarget[0]));
- d.point.setY(0.5 * (yTarget[rows] + yTarget[rows - 1]));
- d.source = QRectF(sourceRect.left(), sourceCenterBottom, sourceMargins.left(), sourceMargins.bottom());
- d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.source.width();
- d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.source.height();
+ d.x = (0.5 * (xTarget[1] + xTarget[0]));
+ d.y =(0.5 * (yTarget[rows] + yTarget[rows - 1]));
+ d.sourceLeft = sourceRect.left();
+ d.sourceTop = sourceCenterBottom;
+ d.width = sourceMargins.left();
+ d.height = sourceMargins.bottom();
+ d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width;
+ d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height;
if (hints & QDrawBorderPixmap::OpaqueBottomLeft)
opaqueData.append(d);
else
translucentData.append(d);
}
if (targetMargins.bottom() > 0 && targetMargins.right() > 0 && sourceMargins.bottom() > 0 && sourceMargins.right() > 0) { // bottom right
- d.point.setX(0.5 * (xTarget[columns] + xTarget[columns - 1]));
- d.point.setY(0.5 * (yTarget[rows] + yTarget[rows - 1]));
- d.source = QRectF(sourceCenterRight, sourceCenterBottom, sourceMargins.right(), sourceMargins.bottom());
- d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.source.width();
- d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.source.height();
+ d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1]));
+ d.y = (0.5 * (yTarget[rows] + yTarget[rows - 1]));
+ d.sourceLeft = sourceCenterRight;
+ d.sourceTop = sourceCenterBottom;
+ d.width = sourceMargins.right();
+ d.height = sourceMargins.bottom();
+ d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width;
+ d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height;
if (hints & QDrawBorderPixmap::OpaqueBottomRight)
opaqueData.append(d);
else
@@ -1229,151 +1241,107 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
// horizontal edges
if (targetCenterWidth > 0 && sourceCenterWidth > 0) {
if (targetMargins.top() > 0 && sourceMargins.top() > 0) { // top
- QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueTop ? opaqueData : translucentData;
- d.source = QRectF(sourceCenterLeft, sourceRect.top(), sourceCenterWidth, sourceMargins.top());
- d.point.setY(0.5 * (yTarget[1] + yTarget[0]));
- d.scaleX = dx / d.source.width();
- d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.source.height();
+ QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueTop ? opaqueData : translucentData;
+ d.sourceLeft = sourceCenterLeft;
+ d.sourceTop = sourceRect.top();
+ d.width = sourceCenterWidth;
+ d.height = sourceMargins.top();
+ d.y = (0.5 * (yTarget[1] + yTarget[0]));
+ d.scaleX = dx / d.width;
+ d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height;
for (int i = 1; i < columns - 1; ++i) {
- d.point.setX(0.5 * (xTarget[i + 1] + xTarget[i]));
+ d.x = (0.5 * (xTarget[i + 1] + xTarget[i]));
data.append(d);
}
if (rules.horizontal == Qt::RepeatTile)
- data[data.size() - 1].source.setWidth((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX);
+ data[data.size() - 1].width = ((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX);
}
if (targetMargins.bottom() > 0 && sourceMargins.bottom() > 0) { // bottom
- QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueBottom ? opaqueData : translucentData;
- d.source = QRectF(sourceCenterLeft, sourceCenterBottom, sourceCenterWidth, sourceMargins.bottom());;
- d.point.setY(0.5 * (yTarget[rows] + yTarget[rows - 1]));
- d.scaleX = dx / d.source.width();
- d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.source.height();
+ QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueBottom ? opaqueData : translucentData;
+ d.sourceLeft = sourceCenterLeft;
+ d.sourceTop = sourceCenterBottom;
+ d.width = sourceCenterWidth;
+ d.height = sourceMargins.bottom();
+ d.y = (0.5 * (yTarget[rows] + yTarget[rows - 1]));
+ d.scaleX = dx / d.width;
+ d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height;
for (int i = 1; i < columns - 1; ++i) {
- d.point.setX(0.5 * (xTarget[i + 1] + xTarget[i]));
+ d.x = (0.5 * (xTarget[i + 1] + xTarget[i]));
data.append(d);
}
if (rules.horizontal == Qt::RepeatTile)
- data[data.size() - 1].source.setWidth((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX);
+ data[data.size() - 1].width = ((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX);
}
}
// vertical edges
if (targetCenterHeight > 0 && sourceCenterHeight > 0) {
if (targetMargins.left() > 0 && sourceMargins.left() > 0) { // left
- QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueLeft ? opaqueData : translucentData;
- d.source = QRectF(sourceRect.left(), sourceCenterTop, sourceMargins.left(), sourceCenterHeight);
- d.point.setX(0.5 * (xTarget[1] + xTarget[0]));
- d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.source.width();
- d.scaleY = dy / d.source.height();
+ QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueLeft ? opaqueData : translucentData;
+ d.sourceLeft = sourceRect.left();
+ d.sourceTop = sourceCenterTop;
+ d.width = sourceMargins.left();
+ d.height = sourceCenterHeight;
+ d.x = (0.5 * (xTarget[1] + xTarget[0]));
+ d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width;
+ d.scaleY = dy / d.height;
for (int i = 1; i < rows - 1; ++i) {
- d.point.setY(0.5 * (yTarget[i + 1] + yTarget[i]));
+ d.y = (0.5 * (yTarget[i + 1] + yTarget[i]));
data.append(d);
}
if (rules.vertical == Qt::RepeatTile)
- data[data.size() - 1].source.setHeight((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY);
+ data[data.size() - 1].height = ((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY);
}
if (targetMargins.right() > 0 && sourceMargins.right() > 0) { // right
- QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueRight ? opaqueData : translucentData;
- d.source = QRectF(sourceCenterRight, sourceCenterTop, sourceMargins.right(), sourceCenterHeight);
- d.point.setX(0.5 * (xTarget[columns] + xTarget[columns - 1]));
- d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.source.width();
- d.scaleY = dy / d.source.height();
+ QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueRight ? opaqueData : translucentData;
+ d.sourceLeft = sourceCenterRight;
+ d.sourceTop = sourceCenterTop;
+ d.width = sourceMargins.right();
+ d.height = sourceCenterHeight;
+ d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1]));
+ d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width;
+ d.scaleY = dy / d.height;
for (int i = 1; i < rows - 1; ++i) {
- d.point.setY(0.5 * (yTarget[i + 1] + yTarget[i]));
+ d.y = (0.5 * (yTarget[i + 1] + yTarget[i]));
data.append(d);
}
if (rules.vertical == Qt::RepeatTile)
- data[data.size() - 1].source.setHeight((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY);
+ data[data.size() - 1].height = ((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY);
}
}
// center
if (targetCenterWidth > 0 && targetCenterHeight > 0 && sourceCenterWidth > 0 && sourceCenterHeight > 0) {
- QDrawPixmapsDataArray &data = hints & QDrawBorderPixmap::OpaqueCenter ? opaqueData : translucentData;
- d.source = QRectF(sourceCenterLeft, sourceCenterTop, sourceCenterWidth, sourceCenterHeight);
- d.scaleX = dx / d.source.width();
- d.scaleY = dy / d.source.height();
+ QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueCenter ? opaqueData : translucentData;
+ d.sourceLeft = sourceCenterLeft;
+ d.sourceTop = sourceCenterTop;
+ d.width = sourceCenterWidth;
+ d.height = sourceCenterHeight;
+ d.scaleX = dx / d.width;
+ d.scaleY = dy / d.height;
qreal repeatWidth = (xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX;
qreal repeatHeight = (yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY;
for (int j = 1; j < rows - 1; ++j) {
- d.point.setY(0.5 * (yTarget[j + 1] + yTarget[j]));
+ d.y = (0.5 * (yTarget[j + 1] + yTarget[j]));
for (int i = 1; i < columns - 1; ++i) {
- d.point.setX(0.5 * (xTarget[i + 1] + xTarget[i]));
+ d.x = (0.5 * (xTarget[i + 1] + xTarget[i]));
data.append(d);
}
if (rules.horizontal == Qt::RepeatTile)
- data[data.size() - 1].source.setWidth(repeatWidth);
+ data[data.size() - 1].width = repeatWidth;
}
if (rules.vertical == Qt::RepeatTile) {
for (int i = 1; i < columns - 1; ++i)
- data[data.size() - i].source.setHeight(repeatHeight);
+ data[data.size() - i].height = repeatHeight;
}
}
if (opaqueData.size())
- qDrawPixmaps(painter, opaqueData.data(), opaqueData.size(), pixmap, QDrawPixmaps::OpaqueHint);
+ painter->drawPixmapFragments(opaqueData.data(), opaqueData.size(), pixmap, QPainter::OpaqueHint);
if (translucentData.size())
- qDrawPixmaps(painter, translucentData.data(), translucentData.size(), pixmap);
-}
-
-/*!
- \class QDrawPixmaps::Data
- \since 4.6
- \internal
-
- This structure is used with the qDrawPixmaps() function.
-
- QPointF point: Specifies the center of the target rectangle.
- QRectF source: Specifies the source rectangle in the pixmap passed into the qDrawPixmaps() call.
- qreal scaleX: Specifies the horizontal scale of the target rectangle.
- qreal scaleY: Specifies the vertical scale of the target rectangle.
- qreal rotation: Specifies the rotation of the target rectangle in degrees.
- The target rectangle is rotated after scaling.
- qreal opacity: Specifies the opacity of the rectangle.
-*/
-
-/*!
- \enum QDrawPixmaps::DrawingHint
- \internal
-*/
-
-/*!
- \internal
- \since 4.6
-
- This function is used to draw \a pixmap, or a sub-rectangle of \a pixmap, at multiple positions
- with different scale, rotation and opacity on \a painter. \a drawingData is an array of \a
- dataCount elements specifying the parameters used to draw each pixmap instance.
- This can be used for example to implement a particle system.
-*/
-void qDrawPixmaps(QPainter *painter, const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints)
-{
- QPaintEngine *engine = painter->paintEngine();
- if (!engine)
- return;
-
- if (engine->isExtended()) {
- static_cast<QPaintEngineEx *>(engine)->drawPixmaps(drawingData, dataCount, pixmap, hints);
- } else {
- qreal oldOpacity = painter->opacity();
- QTransform oldTransform = painter->transform();
-
- for (int i = 0; i < dataCount; ++i) {
- QTransform transform = oldTransform;
- transform.translate(drawingData[i].point.x(), drawingData[i].point.y());
- transform.rotate(drawingData[i].rotation);
- painter->setOpacity(oldOpacity * drawingData[i].opacity);
- painter->setTransform(transform);
-
- qreal w = drawingData[i].scaleX * drawingData[i].source.width();
- qreal h = drawingData[i].scaleY * drawingData[i].source.height();
- painter->drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, drawingData[i].source);
- }
-
- painter->setOpacity(oldOpacity);
- painter->setTransform(oldTransform);
- }
+ painter->drawPixmapFragments(translucentData.data(), translucentData.size(), pixmap);
}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qdrawutil.h b/src/gui/painting/qdrawutil.h
index 2801b2f..31e352f 100644
--- a/src/gui/painting/qdrawutil.h
+++ b/src/gui/painting/qdrawutil.h
@@ -188,31 +188,6 @@ inline void qDrawBorderPixmap(QPainter *painter,
qDrawBorderPixmap(painter, target, margins, pixmap, pixmap.rect(), margins);
}
-// For internal use only.
-namespace QDrawPixmaps
-{
- struct Data
- {
- QPointF point;
- QRectF source;
- qreal scaleX;
- qreal scaleY;
- qreal rotation;
- qreal opacity;
- };
-
- enum DrawingHint
- {
- OpaqueHint = 0x01
- };
-
- Q_DECLARE_FLAGS(DrawingHints, DrawingHint)
-}
-
-// This function is private and may change without notice. Do not use outside Qt!!!
-Q_GUI_EXPORT void qDrawPixmaps(QPainter *painter, const QDrawPixmaps::Data *drawingData,
- int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints = 0);
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 60265c5..a7c2a0b 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3213,6 +3213,9 @@ QRasterPaintEnginePrivate::getPenFunc(const QRectF &rect,
return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend;
}
+/*!
+ \reimp
+*/
void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
{
ensurePen();
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 4f2fffa..98762f0 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -893,7 +893,7 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount)
for (int i=0; i<count; ++i) {
pts[++oset] = points[i].x();
pts[++oset] = points[i].y();
- pts[++oset] = points[i].x() + 1/63;
+ pts[++oset] = points[i].x() + 1/63.;
pts[++oset] = points[i].y();
}
QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint);
@@ -970,23 +970,26 @@ void QPaintEngineEx::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, con
fill(path, brush);
}
-void QPaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints /*hints*/)
+void QPaintEngineEx::drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount,
+ const QPixmap &pixmap, QPainter::FragmentHints /*hints*/)
{
qreal oldOpacity = state()->opacity;
QTransform oldTransform = state()->matrix;
- for (int i = 0; i < dataCount; ++i) {
+ for (int i = 0; i < fragmentCount; ++i) {
QTransform transform = oldTransform;
- transform.translate(drawingData[i].point.x(), drawingData[i].point.y());
- transform.rotate(drawingData[i].rotation);
- state()->opacity = oldOpacity * drawingData[i].opacity;
+ transform.translate(fragments[i].x, fragments[i].y);
+ transform.rotate(fragments[i].rotation);
+ state()->opacity = oldOpacity * fragments[i].opacity;
state()->matrix = transform;
opacityChanged();
transformChanged();
- qreal w = drawingData[i].scaleX * drawingData[i].source.width();
- qreal h = drawingData[i].scaleY * drawingData[i].source.height();
- drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, drawingData[i].source);
+ qreal w = fragments[i].scaleX * fragments[i].width;
+ qreal h = fragments[i].scaleY * fragments[i].height;
+ QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop,
+ fragments[i].width, fragments[i].height);
+ drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect);
}
state()->opacity = oldOpacity;
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index 90c4f9f..2401b94 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -197,7 +197,7 @@ public:
virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
- virtual void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QFlags<QDrawPixmaps::DrawingHint> hints);
+ virtual void drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QFlags<QPainter::FragmentHint> hints);
virtual void updateState(const QPaintEngineState &state);
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 4f532c0..dc96c17 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5700,6 +5700,61 @@ void QPainter::drawImage(const QRectF &targetRect, const QImage &image, const QR
d->engine->drawImage(QRectF(x, y, w, h), image, QRectF(sx, sy, sw, sh), flags);
}
+
+void qt_draw_glyphs(QPainter *painter, const quint32 *glyphArray, const QPointF *positionArray,
+ int glyphCount)
+{
+ QPainterPrivate *painter_d = QPainterPrivate::get(painter);
+ painter_d->drawGlyphs(glyphArray, positionArray, glyphCount);
+}
+
+void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, const QPointF *positionArray,
+ int glyphCount)
+{
+ updateState(state);
+
+ QFontEngine *fontEngine = state->font.d->engineForScript(QUnicodeTables::Common);
+
+ QVarLengthArray<QFixedPoint, 128> positions;
+ for (int i=0; i<glyphCount; ++i) {
+ QFixedPoint fp = QFixedPoint::fromPointF(positionArray[i]);
+ positions.append(fp);
+ }
+
+ if (extended != 0) {
+ QStaticTextItem staticTextItem;
+ staticTextItem.color = state->pen.color();
+ staticTextItem.font = state->font;
+ staticTextItem.fontEngine = fontEngine;
+ staticTextItem.numGlyphs = glyphCount;
+ staticTextItem.glyphs = reinterpret_cast<glyph_t *>(const_cast<glyph_t *>(glyphArray));
+ staticTextItem.glyphPositions = positions.data();
+
+ extended->drawStaticTextItem(&staticTextItem);
+ } else {
+ QTextItemInt textItem;
+ textItem.f = &state->font;
+ textItem.fontEngine = fontEngine;
+
+ QVarLengthArray<QFixed, 128> advances(glyphCount);
+ QVarLengthArray<QGlyphJustification, 128> glyphJustifications(glyphCount);
+ QVarLengthArray<HB_GlyphAttributes, 128> glyphAttributes(glyphCount);
+ qMemSet(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(HB_GlyphAttributes));
+ qMemSet(advances.data(), 0, advances.size() * sizeof(QFixed));
+ qMemSet(glyphJustifications.data(), 0, glyphJustifications.size() * sizeof(QGlyphJustification));
+
+ textItem.glyphs.numGlyphs = glyphCount;
+ textItem.glyphs.glyphs = reinterpret_cast<HB_Glyph *>(const_cast<quint32 *>(glyphArray));
+ textItem.glyphs.offsets = positions.data();
+ textItem.glyphs.advances_x = advances.data();
+ textItem.glyphs.advances_y = advances.data();
+ textItem.glyphs.justifications = glyphJustifications.data();
+ textItem.glyphs.attributes = glyphAttributes.data();
+
+ engine->drawTextItem(QPointF(0, 0), textItem);
+ }
+}
+
/*!
\fn void QPainter::drawStaticText(const QPoint &position, const QStaticText &staticText)
@@ -8847,6 +8902,160 @@ QTransform QPainter::combinedTransform() const
return d->state->worldMatrix * d->viewTransform();
}
+/*!
+ \since 4.7
+
+ This function is used to draw \a pixmap, or a sub-rectangle of \a pixmap,
+ at multiple positions with different scale, rotation and opacity. \a
+ fragments is an array of \a fragmentCount elements specifying the
+ parameters used to draw each pixmap fragment. The \a hints
+ parameter can be used to pass in drawing hints.
+
+ This function is potentially faster than multiple calls to drawPixmap(),
+ since the backend can optimize state changes.
+
+ \sa QPainter::Fragment, QPainter::FragmentHint
+*/
+
+void QPainter::drawPixmapFragments(const Fragment *fragments, int fragmentCount,
+ const QPixmap &pixmap, FragmentHints hints)
+{
+ Q_D(QPainter);
+
+ if (!d->engine)
+ return;
+
+ if (d->engine->isExtended()) {
+ d->extended->drawPixmapFragments(fragments, fragmentCount, pixmap, hints);
+ } else {
+ qreal oldOpacity = opacity();
+ QTransform oldTransform = transform();
+
+ for (int i = 0; i < fragmentCount; ++i) {
+ QTransform transform = oldTransform;
+ transform.translate(fragments[i].x, fragments[i].y);
+ transform.rotate(fragments[i].rotation);
+ setOpacity(oldOpacity * fragments[i].opacity);
+ setTransform(transform);
+
+ qreal w = fragments[i].scaleX * fragments[i].width;
+ qreal h = fragments[i].scaleY * fragments[i].height;
+ QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop,
+ fragments[i].width, fragments[i].height);
+ drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect);
+ }
+
+ setOpacity(oldOpacity);
+ setTransform(oldTransform);
+ }
+}
+
+/*!
+ \since 4.7
+ \class QPainter::Fragment
+
+ \brief This class is used in conjunction with the
+ QPainter::drawPixmapFragments() function to specify how a pixmap, or
+ sub-rect of a pixmap, is drawn.
+
+ The \a sourceLeft, \a sourceTop, \a width and \a height variables are used
+ as a source rectangle within the pixmap passed into the
+ QPainter::drawPixmapFragments() function. The variables \a x, \a y, \a
+ width and \a height are used to calculate the target rectangle that is
+ drawn. \a x and \a y denotes the center of the target rectangle. The \a
+ width and \a heigth in the target rectangle is scaled by the \a scaleX and
+ \a scaleY values. The resulting target rectangle is then rotated \a
+ rotation degrees around the \a x, \a y center point.
+
+ \sa QPainter::drawPixmapFragments()
+*/
+
+/*!
+ \since 4.7
+
+ This is a convenience function that returns a QPainter::Fragment that is
+ initialized with the \a pos, \a sourceRect, \a scaleX, \a scaleY, \a
+ rotation, \a opacity parameters.
+*/
+
+QPainter::Fragment QPainter::Fragment::create(const QPointF &pos, const QRectF &sourceRect,
+ qreal scaleX, qreal scaleY, qreal rotation,
+ qreal opacity)
+{
+ Fragment fragment = {pos.x(), pos.y(), sourceRect.x(), sourceRect.y(), sourceRect.width(),
+ sourceRect.height(), scaleX, scaleY, rotation, opacity};
+ return fragment;
+}
+
+/*!
+ \variable QPainter::Fragment::x
+ \brief the x coordinate of center point in the target rectangle.
+*/
+
+/*!
+ \variable QPainter::Fragment::y
+ \brief the y coordinate of the center point in the target rectangle.
+*/
+
+/*!
+ \variable QPainter::Fragment::sourceLeft
+ \brief the left coordinate of the source rectangle.
+*/
+
+/*!
+ \variable QPainter::Fragment::sourceTop
+ \brief the top coordinate of the source rectangle.
+*/
+
+/*!
+ \variable QPainter::Fragment::width
+
+ \brief the width of the source rectangle and is used to calculate the width
+ of the target rectangle.
+*/
+
+/*!
+ \variable QPainter::Fragment::height
+
+ \brief the height of the source rectangle and is used to calculate the
+ height of the target rectangle.
+*/
+
+/*!
+ \variable QPainter::Fragment::scaleX
+ \brief the horizontal scale of the target rectangle.
+*/
+
+/*!
+ \variable QPainter::Fragment::scaleY
+ \brief the vertical scale of the target rectangle.
+*/
+
+/*!
+ \variable QPainter::Fragment::rotation
+
+ \brief the rotation of the target rectangle in degrees. The target
+ rectangle is rotated after it has been scaled.
+*/
+
+/*!
+ \variable QPainter::Fragment::opacity
+
+ \brief the opacity of the target rectangle, where 0.0 is fully transparent
+ and 1.0 is fully opaque.
+*/
+
+/*!
+ \since 4.7
+
+ \enum QPainter::FragmentHint
+
+ \value OpaqueHint Indicates that the pixmap fragments to be drawn are
+ opaque. Opaque fragments are potentially faster to draw.
+
+ \sa QPainter::drawPixmapFragments(), QPainter::Fragment
+*/
+
void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation)
{
p->draw_helper(path, operation);
diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h
index e9fd532..bcb0b50 100644
--- a/src/gui/painting/qpainter.h
+++ b/src/gui/painting/qpainter.h
@@ -99,6 +99,29 @@ public:
Q_DECLARE_FLAGS(RenderHints, RenderHint)
+ class Fragment {
+ public:
+ qreal x;
+ qreal y;
+ qreal sourceLeft;
+ qreal sourceTop;
+ qreal width;
+ qreal height;
+ qreal scaleX;
+ qreal scaleY;
+ qreal rotation;
+ qreal opacity;
+ static Fragment Q_GUI_EXPORT create(const QPointF &pos, const QRectF &sourceRect,
+ qreal scaleX = 1, qreal scaleY = 1,
+ qreal rotation = 0, qreal opacity = 1);
+ };
+
+ enum FragmentHint {
+ OpaqueHint = 0x01
+ };
+
+ Q_DECLARE_FLAGS(FragmentHints, FragmentHint)
+
QPainter();
explicit QPainter(QPaintDevice *);
~QPainter();
@@ -352,6 +375,9 @@ public:
inline void drawPixmap(const QRect &r, const QPixmap &pm);
inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm);
+ void drawPixmapFragments(const Fragment *fragments, int fragmentCount,
+ const QPixmap &pixmap, FragmentHints hints = 0);
+
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect,
Qt::ImageConversionFlags flags = Qt::AutoColor);
inline void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect,
diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h
index 02a91aa..9362dbe 100644
--- a/src/gui/painting/qpainter_p.h
+++ b/src/gui/painting/qpainter_p.h
@@ -228,6 +228,7 @@ public:
void draw_helper(const QPainterPath &path, DrawOperation operation = StrokeAndFillDraw);
void drawStretchedGradient(const QPainterPath &path, DrawOperation operation);
void drawOpaqueBackground(const QPainterPath &path, DrawOperation operation);
+ void drawGlyphs(const quint32 *glyphArray, const QPointF *positionArray, int glyphCount);
void updateMatrix();
void updateInvMatrix();
@@ -238,6 +239,11 @@ public:
void checkEmulation();
+ static QPainterPrivate *get(QPainter *painter)
+ {
+ return painter->d_ptr.data();
+ }
+
QTransform viewTransform() const;
static bool attachPainterPrivate(QPainter *q, QPaintDevice *pdev);
void detachPainterPrivate(QPainter *q);
@@ -252,6 +258,8 @@ public:
};
Q_GUI_EXPORT void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation);
+Q_GUI_EXPORT void qt_draw_glyphs(QPainter *painter, const quint32 *glyphArray,
+ const QPointF *positionArray, int glyphCount);
QString qt_generate_brush_key(const QBrush &brush);
diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp
index d029b1e..ea9dc5d 100644
--- a/src/gui/painting/qprintengine_win.cpp
+++ b/src/gui/painting/qprintengine_win.cpp
@@ -368,7 +368,8 @@ void QWin32PrintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem
}
// We only want to convert the glyphs to text if the entire string is compatible with ASCII
- bool convertToText = true;
+ // and if we actually have access to the chars.
+ bool convertToText = ti.chars != 0;
for (int i=0; i < ti.num_chars; ++i) {
if (ti.chars[i].unicode() >= 0x80) {
convertToText = false;
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 40ee31d..116b03e 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -3760,7 +3760,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QPalette np = tab->palette;
np.setColor(QPalette::WindowText, QColor(255, 255, 255, 75));
QRect nr = subElementRect(SE_TabBarTabText, opt, w);
- nr.moveTop(+1);
+ nr.moveTop(-1);
int alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextHideMnemonic;
proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled,
tab->text, QPalette::WindowText);
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index a2fff70..5adf237 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -291,6 +291,7 @@ private:
friend class QFontMetricsF;
friend class QFontInfo;
friend class QPainter;
+ friend class QPainterPrivate;
friend class QPSPrintEngineFont;
friend class QApplication;
friend class QWidget;
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index c000457..e5975d2 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -587,8 +587,9 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t)
{
QImage i = alphaMapForGlyph(glyph);
if (t.type() > QTransform::TxTranslate)
- i = i.transformed(t);
+ i = i.transformed(t).convertToFormat(QImage::Format_Indexed8);
Q_ASSERT(i.depth() <= 8); // To verify that transformed didn't change the format...
+
return i;
}
@@ -597,11 +598,14 @@ QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, int /* margin */, const Q
QImage alphaMask = alphaMapForGlyph(glyph, t);
QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32);
+ QVector<QRgb> colorTable = alphaMask.colorTable();
for (int y=0; y<alphaMask.height(); ++y) {
uint *dst = (uint *) rgbMask.scanLine(y);
uchar *src = (uchar *) alphaMask.scanLine(y);
- for (int x=0; x<alphaMask.width(); ++x)
- dst[x] = qRgb(src[x], src[x], src[x]);
+ for (int x=0; x<alphaMask.width(); ++x) {
+ int val = qAlpha(colorTable.at(src[x]));
+ dst[x] = qRgb(val, val, val);
+ }
}
return rgbMask;
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp
index 1a815d3..55e93bd 100644
--- a/src/gui/text/qfontengine_win.cpp
+++ b/src/gui/text/qfontengine_win.cpp
@@ -208,7 +208,7 @@ void QFontEngineWin::getCMap()
unitsPerEm = otm->otmEMSquare;
x_height = (int)otm->otmsXHeight;
loadKerningPairs(designToDevice);
- _faceId.filename = QString::fromWCharArray((wchar_t *)((char *)otm + (int)otm->otmpFullName)).toLatin1();
+ _faceId.filename = QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFullName)).toLatin1();
lineWidth = otm->otmsUnderscoreSize;
fsType = otm->otmfsType;
free(otm);
@@ -1006,8 +1006,8 @@ QFontEngine::Properties QFontEngineWin::properties() const
Properties p;
p.emSquare = unitsPerEm;
p.italicAngle = otm->otmItalicAngle;
- p.postscriptName = QString::fromWCharArray((wchar_t *)((char *)otm + (int)otm->otmpFamilyName)).toLatin1();
- p.postscriptName += QString::fromWCharArray((wchar_t *)((char *)otm + (int)otm->otmpStyleName)).toLatin1();
+ p.postscriptName = QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFamilyName)).toLatin1();
+ p.postscriptName += QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpStyleName)).toLatin1();
#ifndef QT_NO_PRINTER
p.postscriptName = QPdf::stripSpecialCharacters(p.postscriptName);
#endif
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index a7138b9..8fe4c47 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -350,15 +350,13 @@ QStaticTextPrivate::QStaticTextPrivate()
: items(0), itemCount(0), glyphPool(0), positionPool(0), needsClipRect(false),
useBackendOptimizations(false), textFormat(Qt::AutoText)
{
- ref = 1;
}
QStaticTextPrivate::QStaticTextPrivate(const QStaticTextPrivate &other)
: text(other.text), font(other.font), maximumSize(other.maximumSize), matrix(other.matrix),
items(0), itemCount(0), glyphPool(0), positionPool(0), needsClipRect(false),
- useBackendOptimizations(false), textFormat(other.textFormat)
+ useBackendOptimizations(other.useBackendOptimizations), textFormat(other.textFormat)
{
- ref = 1;
}
QStaticTextPrivate::~QStaticTextPrivate()
diff --git a/src/multimedia/base/qgraphicsvideoitem.cpp b/src/multimedia/base/qgraphicsvideoitem.cpp
index 21ba8c9..d5ca9e8 100644
--- a/src/multimedia/base/qgraphicsvideoitem.cpp
+++ b/src/multimedia/base/qgraphicsvideoitem.cpp
@@ -177,9 +177,10 @@ void QGraphicsVideoItemPrivate::_q_mediaObjectDestroyed()
/*!
\class QGraphicsVideoItem
-
\brief The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject.
+ \since 4.7
+
\ingroup multimedia
Attaching a QGraphicsVideoItem to a QMediaObject allows it to display
diff --git a/src/multimedia/base/qmediacontent.cpp b/src/multimedia/base/qmediacontent.cpp
index fd519c6..6f158d2 100644
--- a/src/multimedia/base/qmediacontent.cpp
+++ b/src/multimedia/base/qmediacontent.cpp
@@ -76,6 +76,7 @@ private:
\class QMediaContent
\preliminary
\brief The QMediaContent class provides access to the resources relating to a media content.
+ \since 4.7
\ingroup multimedia
diff --git a/src/multimedia/base/qmediacontrol.cpp b/src/multimedia/base/qmediacontrol.cpp
index c8bbfd4..b84c49e 100644
--- a/src/multimedia/base/qmediacontrol.cpp
+++ b/src/multimedia/base/qmediacontrol.cpp
@@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QMediaControl
\ingroup multimedia-serv
+ \since 4.7
\preliminary
\brief The QMediaControl class provides a base interface for media service controls.
diff --git a/src/multimedia/base/qmediaobject.cpp b/src/multimedia/base/qmediaobject.cpp
index b2b8c1b..0422718 100644
--- a/src/multimedia/base/qmediaobject.cpp
+++ b/src/multimedia/base/qmediaobject.cpp
@@ -67,6 +67,7 @@ void QMediaObjectPrivate::_q_notify()
\class QMediaObject
\preliminary
\brief The QMediaObject class provides a common base for multimedia objects.
+ \since 4.7
\ingroup multimedia
diff --git a/src/multimedia/base/qmediaplaylist.cpp b/src/multimedia/base/qmediaplaylist.cpp
index ab91fd7..b3f3dd3 100644
--- a/src/multimedia/base/qmediaplaylist.cpp
+++ b/src/multimedia/base/qmediaplaylist.cpp
@@ -66,6 +66,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, playlistIOLoader,
/*!
\class QMediaPlaylist
\ingroup multimedia
+ \since 4.7
\preliminary
\brief The QMediaPlaylist class provides a list of media content to play.
diff --git a/src/multimedia/base/qmediaplaylistcontrol.cpp b/src/multimedia/base/qmediaplaylistcontrol.cpp
index 2ae03ad..ba3d224 100644
--- a/src/multimedia/base/qmediaplaylistcontrol.cpp
+++ b/src/multimedia/base/qmediaplaylistcontrol.cpp
@@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QMediaPlaylistControl
\ingroup multimedia-serv
+ \since 4.7
\preliminary
\brief The QMediaPlaylistControl class provides access to the playlist functionality of a
diff --git a/src/multimedia/base/qmediaplaylistioplugin.cpp b/src/multimedia/base/qmediaplaylistioplugin.cpp
index 5f11e38..48fd721 100644
--- a/src/multimedia/base/qmediaplaylistioplugin.cpp
+++ b/src/multimedia/base/qmediaplaylistioplugin.cpp
@@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QMediaPlaylistReader
\preliminary
+ \since 4.7
\brief The QMediaPlaylistReader class provides an interface for reading a playlist file.
\sa QMediaPlaylistIOPlugin
@@ -83,6 +84,7 @@ QMediaPlaylistReader::~QMediaPlaylistReader()
/*!
\class QMediaPlaylistWriter
\preliminary
+ \since 4.7
\brief The QMediaPlaylistWriter class provides an interface for writing a playlist file.
\sa QMediaPlaylistIOPlugin
@@ -111,6 +113,7 @@ QMediaPlaylistWriter::~QMediaPlaylistWriter()
/*!
\class QMediaPlaylistIOPlugin
+ \since 4.7
\brief The QMediaPlaylistIOPlugin class provides an interface for media playlist I/O plug-ins.
*/
diff --git a/src/multimedia/base/qmediaplaylistnavigator.cpp b/src/multimedia/base/qmediaplaylistnavigator.cpp
index 3c22ea4..0c52c71 100644
--- a/src/multimedia/base/qmediaplaylistnavigator.cpp
+++ b/src/multimedia/base/qmediaplaylistnavigator.cpp
@@ -193,6 +193,7 @@ int QMediaPlaylistNavigatorPrivate::previousItemPos(int steps) const
/*!
\class QMediaPlaylistNavigator
\preliminary
+ \since 4.7
\brief The QMediaPlaylistNavigator class provides navigation for a media playlist.
\sa QMediaPlaylist, QMediaPlaylistProvider
diff --git a/src/multimedia/base/qmediaplaylistprovider.cpp b/src/multimedia/base/qmediaplaylistprovider.cpp
index 65105dc..942f155 100644
--- a/src/multimedia/base/qmediaplaylistprovider.cpp
+++ b/src/multimedia/base/qmediaplaylistprovider.cpp
@@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QMediaPlaylistProvider
\preliminary
+ \since 4.7
\brief The QMediaPlaylistProvider class provides an abstract list of media.
\sa QMediaPlaylist
diff --git a/src/multimedia/base/qmediaresource.cpp b/src/multimedia/base/qmediaresource.cpp
index 515e432..646d9a7 100644
--- a/src/multimedia/base/qmediaresource.cpp
+++ b/src/multimedia/base/qmediaresource.cpp
@@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QMediaResource
\preliminary
+ \since 4.7
\brief The QMediaResource class provides a description of a media resource.
\ingroup multimedia
diff --git a/src/multimedia/base/qmediaservice.cpp b/src/multimedia/base/qmediaservice.cpp
index e40688e..d9e980b 100644
--- a/src/multimedia/base/qmediaservice.cpp
+++ b/src/multimedia/base/qmediaservice.cpp
@@ -57,6 +57,7 @@ QT_MODULE(Multimedia)
service implementations.
\ingroup multimedia-serv
\preliminary
+ \since 4.7
Media services provide implementations of the functionality promised
by media objects, and allow multiple providers to implement a QMediaObject.
diff --git a/src/multimedia/base/qmediaserviceprovider.cpp b/src/multimedia/base/qmediaserviceprovider.cpp
index 02c9b29..eb6505c 100644
--- a/src/multimedia/base/qmediaserviceprovider.cpp
+++ b/src/multimedia/base/qmediaserviceprovider.cpp
@@ -82,6 +82,7 @@ public:
/*!
\class QMediaServiceProviderHint
\preliminary
+ \since 4.7
\brief The QMediaServiceProviderHint class describes what is required of a QMediaService.
\ingroup multimedia-serv
@@ -489,6 +490,7 @@ Q_GLOBAL_STATIC(QPluginServiceProvider, pluginProvider);
/*!
\class QMediaServiceProvider
\preliminary
+ \since 4.7
\brief The QMediaServiceProvider class provides an abstract allocator for media services.
*/
@@ -597,6 +599,7 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider()
/*!
\class QMediaServiceProviderPlugin
\preliminary
+ \since 4.7
\brief The QMediaServiceProviderPlugin class interface provides an interface for QMediaService
plug-ins.
@@ -630,6 +633,7 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider()
\class QMediaServiceSupportedFormatsInterface
\brief The QMediaServiceSupportedFormatsInterface class interface
identifies if a media service plug-in supports a media format.
+ \since 4.7
A QMediaServiceProviderPlugin may implement this interface.
*/
@@ -656,6 +660,7 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider()
\class QMediaServiceSupportedDevicesInterface
\brief The QMediaServiceSupportedDevicesInterface class interface
identifies the devices supported by a media service plug-in.
+ \since 4.7
A QMediaServiceProviderPlugin may implement this interface.
*/
@@ -682,6 +687,7 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider()
\class QMediaServiceFeaturesInterface
\brief The QMediaServiceFeaturesInterface class interface identifies
features supported by a media service plug-in.
+ \since 4.7
A QMediaServiceProviderPlugin may implement this interface.
*/
diff --git a/src/multimedia/base/qmediatimerange.cpp b/src/multimedia/base/qmediatimerange.cpp
index 0ca1948..e1cea7e 100644
--- a/src/multimedia/base/qmediatimerange.cpp
+++ b/src/multimedia/base/qmediatimerange.cpp
@@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE
\class QMediaTimeInterval
\brief The QMediaTimeInterval class represents a time interval with integer precision.
\ingroup multimedia
+ \since 4.7
An interval is specified by an inclusive start() and end() time.
These must be set in the constructor, as this is an immutable class.
@@ -308,6 +309,7 @@ void QMediaTimeRangePrivate::removeInterval(const QMediaTimeInterval &interval)
\brief The QMediaTimeRange class represents a set of zero or more disjoint
time intervals.
\ingroup multimedia
+ \since 4.7
\reentrant
diff --git a/src/multimedia/base/qmetadatacontrol.cpp b/src/multimedia/base/qmetadatacontrol.cpp
index 3ecbe8d..28a82ec 100644
--- a/src/multimedia/base/qmetadatacontrol.cpp
+++ b/src/multimedia/base/qmetadatacontrol.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QMetaDataControl
\ingroup multimedia-serv
-
+ \since 4.7
\preliminary
\brief The QMetaDataControl class provides access to the meta-data of a
QMediaService's media.
diff --git a/src/multimedia/base/qvideodevicecontrol.cpp b/src/multimedia/base/qvideodevicecontrol.cpp
index 21db500..c0fe9a8 100644
--- a/src/multimedia/base/qvideodevicecontrol.cpp
+++ b/src/multimedia/base/qvideodevicecontrol.cpp
@@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QVideoDeviceControl
\preliminary
+ \since 4.7
\brief The QVideoDeviceControl class provides an video device selector media control.
\ingroup multimedia-serv
diff --git a/src/multimedia/base/qvideooutputcontrol.cpp b/src/multimedia/base/qvideooutputcontrol.cpp
index a904385..58f1527 100644
--- a/src/multimedia/base/qvideooutputcontrol.cpp
+++ b/src/multimedia/base/qvideooutputcontrol.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QVideoOutputControl
\preliminary
-
+ \since 4.7
\brief The QVideoOutputControl class provides a means of selecting the
active video output control.
diff --git a/src/multimedia/base/qvideorenderercontrol.cpp b/src/multimedia/base/qvideorenderercontrol.cpp
index 4e7b3da..a34ef9b 100644
--- a/src/multimedia/base/qvideorenderercontrol.cpp
+++ b/src/multimedia/base/qvideorenderercontrol.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QVideoRendererControl
\preliminary
-
+ \since 4.7
\brief The QVideoRendererControl class provides a control for rendering
to a video surface.
diff --git a/src/multimedia/base/qvideowidget.cpp b/src/multimedia/base/qvideowidget.cpp
index 5df245e..aabfefc 100644
--- a/src/multimedia/base/qvideowidget.cpp
+++ b/src/multimedia/base/qvideowidget.cpp
@@ -488,7 +488,7 @@ void QVideoWidgetPrivate::_q_dimensionsChanged()
/*!
\class QVideoWidget
\preliminary
-
+ \since 4.7
\brief The QVideoWidget class provides a widget which presents video
produced by a media object.
\ingroup multimedia
diff --git a/src/multimedia/base/qvideowidgetcontrol.cpp b/src/multimedia/base/qvideowidgetcontrol.cpp
index bd7ce4e..c53c77b 100644
--- a/src/multimedia/base/qvideowidgetcontrol.cpp
+++ b/src/multimedia/base/qvideowidgetcontrol.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QVideoWidgetControl
\preliminary
-
+ \since 4.7
\brief The QVideoWidgetControl class provides a media control which
implements a video widget.
diff --git a/src/multimedia/base/qvideowindowcontrol.cpp b/src/multimedia/base/qvideowindowcontrol.cpp
index a23cb4b..da46823 100644
--- a/src/multimedia/base/qvideowindowcontrol.cpp
+++ b/src/multimedia/base/qvideowindowcontrol.cpp
@@ -47,6 +47,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QVideoWindowControl
\preliminary
+ \since 4.7
\ingroup multimedia-serv
\brief The QVideoWindowControl class provides a media control for rendering video to a window.
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp
index ca34993..27bff02 100644
--- a/src/multimedia/playback/qmediaplayer.cpp
+++ b/src/multimedia/playback/qmediaplayer.cpp
@@ -66,7 +66,7 @@ QT_MODULE(Multimedia)
\class QMediaPlayer
\brief The QMediaPlayer class allows the playing of a media source.
\ingroup multimedia
-
+ \since 4.7
\preliminary
The QMediaPlayer class is a high level media playback class. It can be used
diff --git a/src/multimedia/playback/qmediaplayercontrol.cpp b/src/multimedia/playback/qmediaplayercontrol.cpp
index 95ffade..2129098 100644
--- a/src/multimedia/playback/qmediaplayercontrol.cpp
+++ b/src/multimedia/playback/qmediaplayercontrol.cpp
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QMediaPlayerControl
\ingroup multimedia-serv
-
+ \since 4.7
\preliminary
\brief The QMediaPlayerControl class provides access to the media playing
functionality of a QMediaService.
diff --git a/src/multimedia/qml/multimediaqml.cpp b/src/multimedia/qml/multimediadeclarative.cpp
index be49915..7f5298f 100644
--- a/src/multimedia/qml/multimediaqml.cpp
+++ b/src/multimedia/qml/multimediadeclarative.cpp
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#include <QtMultimedia/multimediaqml.h>
+#include <QtMultimedia/multimediadeclarative.h>
#include <QtMultimedia/private/qsoundeffect_p.h>
-#include <QtMultimedia/private/qmlaudio_p.h>
-#include <QtMultimedia/private/qmlgraphicsvideo_p.h>
+#include <QtMultimedia/private/qdeclarativeaudio_p.h>
+#include <QtMultimedia/private/qdeclarativevideo_p.h>
QT_BEGIN_NAMESPACE
@@ -55,11 +55,13 @@ namespace QtMultimedia
\internal
*/
-void qRegisterQmlElements()
+void qRegisterDeclarativeElements(const char *uri)
{
- qmlRegisterType<QSoundEffect>("Qt.multimedia", 4, 7, "SoundEffect", "SoundEffect");
- qmlRegisterType<QmlAudio>("Qt.multimedia", 4, 7, "Audio", "Audio");
- qmlRegisterType<QmlGraphicsVideo>("Qt.multimedia", 4, 7, "Video", "Video");
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.multimedia"));
+
+ qmlRegisterType<QSoundEffect>(uri, 4, 7, "SoundEffect");
+ qmlRegisterType<QDeclarativeAudio>(uri, 4, 7, "Audio");
+ qmlRegisterType<QDeclarativeVideo>(uri, 4, 7, "Video");
}
}
diff --git a/src/multimedia/qml/multimediaqml.h b/src/multimedia/qml/multimediadeclarative.h
index 41274c8..29af65a 100644
--- a/src/multimedia/qml/multimediaqml.h
+++ b/src/multimedia/qml/multimediadeclarative.h
@@ -51,7 +51,7 @@ QT_MODULE(Multimedia)
namespace QtMultimedia
{
-extern void Q_MULTIMEDIA_EXPORT qRegisterQmlElements();
+extern void Q_MULTIMEDIA_EXPORT qRegisterDeclarativeElements(const char *uri);
}
QT_END_NAMESPACE
diff --git a/src/multimedia/qml/qmlaudio.cpp b/src/multimedia/qml/qdeclarativeaudio.cpp
index 89f045e..67df625 100644
--- a/src/multimedia/qml/qmlaudio.cpp
+++ b/src/multimedia/qml/qdeclarativeaudio.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmlaudio_p.h"
+#include "qdeclarativeaudio_p.h"
#include <QtMultimedia/qmediaplayercontrol.h>
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
/*!
- \qmlclass Audio QmlAudio
+ \qmlclass Audio QDeclarativeAudio
\brief The Audio element allows you to add audio playback to a scene.
\qml
@@ -59,11 +59,11 @@ QT_BEGIN_NAMESPACE
/*!
\internal
- \class QmlAudio
- \brief The QmlAudio class provides an audio item that you can add to a QmlView.
+ \class QDeclarativeAudio
+ \brief The QDeclarativeAudio class provides an audio item that you can add to a QDeclarativeView.
*/
-void QmlAudio::_q_error(int errorCode, const QString &errorString)
+void QDeclarativeAudio::_q_error(int errorCode, const QString &errorString)
{
m_error = QMediaPlayer::Error(errorCode);
m_errorString = errorString;
@@ -73,13 +73,13 @@ void QmlAudio::_q_error(int errorCode, const QString &errorString)
}
-QmlAudio::QmlAudio(QObject *parent)
+QDeclarativeAudio::QDeclarativeAudio(QObject *parent)
: QObject(parent)
{
setObject(this);
}
-QmlAudio::~QmlAudio()
+QDeclarativeAudio::~QDeclarativeAudio()
{
shutdown();
}
@@ -92,7 +92,7 @@ QmlAudio::~QmlAudio()
Sets the \l playing property to true, and the \l paused property to false.
*/
-void QmlAudio::play()
+void QDeclarativeAudio::play()
{
m_playerControl->play();
@@ -110,7 +110,7 @@ void QmlAudio::play()
Sets the \l playing and \l paused properties to true.
*/
-void QmlAudio::pause()
+void QDeclarativeAudio::pause()
{
m_playerControl->pause();
@@ -128,7 +128,7 @@ void QmlAudio::pause()
Sets the \l playing and \l paused properties to false.
*/
-void QmlAudio::stop()
+void QDeclarativeAudio::stop()
{
m_playerControl->stop();
@@ -202,7 +202,7 @@ void QmlAudio::stop()
\endlist
*/
-QmlAudio::Status QmlAudio::status() const
+QDeclarativeAudio::Status QDeclarativeAudio::status() const
{
return Status(m_status);
}
@@ -301,7 +301,7 @@ QmlAudio::Status QmlAudio::status() const
\endlist
*/
-QmlAudio::Error QmlAudio::error() const
+QDeclarativeAudio::Error QDeclarativeAudio::error() const
{
return Error(m_error);
}
@@ -321,6 +321,6 @@ QmlAudio::Error QmlAudio::error() const
QT_END_NAMESPACE
-#include "moc_qmlaudio_p.cpp"
+#include "moc_qdeclarativeaudio_p.cpp"
diff --git a/src/multimedia/qml/qmlaudio_p.h b/src/multimedia/qml/qdeclarativeaudio_p.h
index bb0d301..d1fb275 100644
--- a/src/multimedia/qml/qmlaudio_p.h
+++ b/src/multimedia/qml/qdeclarativeaudio_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLAUDIO_P_H
-#define QMLAUDIO_P_H
+#ifndef QDECLARATIVEAUDIO_P_H
+#define QDECLARATIVEAUDIO_P_H
//
// W A R N I N G
@@ -53,10 +53,10 @@
// We mean it.
//
-#include <QtMultimedia/private/qmlmediabase_p.h>
+#include <QtMultimedia/private/qdeclarativemediabase_p.h>
#include <QtCore/qbasictimer.h>
-#include <QtDeclarative/qmlgraphicsitem.h>
+#include <QtDeclarative/qdeclarativeitem.h>
QT_BEGIN_HEADER
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
class QTimerEvent;
-class Q_AUTOTEST_EXPORT QmlAudio : public QObject, public QmlMediaBase, public QmlParserStatus
+class Q_AUTOTEST_EXPORT QDeclarativeAudio : public QObject, public QDeclarativeMediaBase, public QDeclarativeParserStatus
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
@@ -83,7 +83,7 @@ class Q_AUTOTEST_EXPORT QmlAudio : public QObject, public QmlMediaBase, public Q
Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
Q_ENUMS(Status)
Q_ENUMS(Error)
- Q_INTERFACES(QmlParserStatus)
+ Q_INTERFACES(QDeclarativeParserStatus)
public:
enum Status
{
@@ -108,8 +108,8 @@ public:
ServiceMissing = QMediaPlayer::ServiceMissingError
};
- QmlAudio(QObject *parent = 0);
- ~QmlAudio();
+ QDeclarativeAudio(QObject *parent = 0);
+ ~QDeclarativeAudio();
Status status() const;
Error error() const;
@@ -150,23 +150,23 @@ Q_SIGNALS:
void playbackRateChanged();
void errorChanged();
- void error(QmlAudio::Error error, const QString &errorString);
+ void error(QDeclarativeAudio::Error error, const QString &errorString);
private Q_SLOTS:
void _q_error(int, const QString &);
private:
- Q_DISABLE_COPY(QmlAudio)
+ Q_DISABLE_COPY(QDeclarativeAudio)
Q_PRIVATE_SLOT(mediaBase(), void _q_stateChanged(QMediaPlayer::State))
Q_PRIVATE_SLOT(mediaBase(), void _q_mediaStatusChanged(QMediaPlayer::MediaStatus))
Q_PRIVATE_SLOT(mediaBase(), void _q_metaDataChanged())
- inline QmlMediaBase *mediaBase() { return this; }
+ inline QDeclarativeMediaBase *mediaBase() { return this; }
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QmlAudio))
+QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeAudio))
QT_END_HEADER
diff --git a/src/multimedia/qml/qmlmediabase.cpp b/src/multimedia/qml/qdeclarativemediabase.cpp
index 11b4337..e054cb2 100644
--- a/src/multimedia/qml/qmlmediabase.cpp
+++ b/src/multimedia/qml/qdeclarativemediabase.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "QtMultimedia/private/qmlmediabase_p.h"
+#include "QtMultimedia/private/qdeclarativemediabase_p.h"
#include <QtCore/qcoreevent.h>
#include <QtCore/qurl.h>
@@ -55,19 +55,19 @@
QT_BEGIN_NAMESPACE
-class QmlMediaBaseObject : public QMediaObject
+class QDeclarativeMediaBaseObject : public QMediaObject
{
public:
- QmlMediaBaseObject(QMediaService *service)
+ QDeclarativeMediaBaseObject(QMediaService *service)
: QMediaObject(0, service)
{
}
};
-class QmlMediaBasePlayerControl : public QMediaPlayerControl
+class QDeclarativeMediaBasePlayerControl : public QMediaPlayerControl
{
public:
- QmlMediaBasePlayerControl(QObject *parent)
+ QDeclarativeMediaBasePlayerControl(QObject *parent)
: QMediaPlayerControl(parent)
{
}
@@ -98,10 +98,10 @@ public:
void stop() {}
};
-class QmlMediaBaseAnimation : public QObject
+class QDeclarativeMediaBaseAnimation : public QObject
{
public:
- QmlMediaBaseAnimation(QmlMediaBase *media)
+ QDeclarativeMediaBaseAnimation(QDeclarativeMediaBase *media)
: m_media(media)
{
}
@@ -125,11 +125,11 @@ protected:
}
private:
- QmlMediaBase *m_media;
+ QDeclarativeMediaBase *m_media;
QBasicTimer m_timer;
};
-void QmlMediaBase::_q_stateChanged(QMediaPlayer::State state)
+void QDeclarativeMediaBase::_q_stateChanged(QMediaPlayer::State state)
{
if (state != m_state) {
QMediaPlayer::State oldState = m_state;
@@ -170,7 +170,7 @@ void QmlMediaBase::_q_stateChanged(QMediaPlayer::State state)
}
}
-void QmlMediaBase::_q_mediaStatusChanged(QMediaPlayer::MediaStatus status)
+void QDeclarativeMediaBase::_q_mediaStatusChanged(QMediaPlayer::MediaStatus status)
{
if (status != m_status) {
m_status = status;
@@ -207,12 +207,12 @@ void QmlMediaBase::_q_mediaStatusChanged(QMediaPlayer::MediaStatus status)
}
}
-void QmlMediaBase::_q_metaDataChanged()
+void QDeclarativeMediaBase::_q_metaDataChanged()
{
m_metaObject->metaDataChanged();
}
-QmlMediaBase::QmlMediaBase()
+QDeclarativeMediaBase::QDeclarativeMediaBase()
: m_mediaService(0)
, m_playerControl(0)
, m_mediaObject(0)
@@ -227,11 +227,11 @@ QmlMediaBase::QmlMediaBase()
{
}
-QmlMediaBase::~QmlMediaBase()
+QDeclarativeMediaBase::~QDeclarativeMediaBase()
{
}
-void QmlMediaBase::shutdown()
+void QDeclarativeMediaBase::shutdown()
{
delete m_metaObject;
delete m_mediaObject;
@@ -243,7 +243,7 @@ void QmlMediaBase::shutdown()
}
-void QmlMediaBase::setObject(QObject *object)
+void QDeclarativeMediaBase::setObject(QObject *object)
{
if ((m_mediaProvider = QMediaServiceProvider::defaultServiceProvider())) {
if ((m_mediaService = m_mediaProvider->requestService(Q_MEDIASERVICE_MEDIAPLAYER))) {
@@ -251,7 +251,7 @@ void QmlMediaBase::setObject(QObject *object)
m_mediaService->control(QMediaPlayerControl_iid));
m_metaDataControl = qobject_cast<QMetaDataControl *>(
m_mediaService->control(QMetaDataControl_iid));
- m_mediaObject = new QmlMediaBaseObject(m_mediaService);
+ m_mediaObject = new QDeclarativeMediaBaseObject(m_mediaService);
}
}
@@ -279,11 +279,11 @@ void QmlMediaBase::setObject(QObject *object)
QObject::connect(m_playerControl, SIGNAL(error(int,QString)),
object, SLOT(_q_error(int,QString)));
- m_animation = new QmlMediaBaseAnimation(this);
+ m_animation = new QDeclarativeMediaBaseAnimation(this);
} else {
m_error = QMediaPlayer::ServiceMissingError;
- m_playerControl = new QmlMediaBasePlayerControl(object);
+ m_playerControl = new QDeclarativeMediaBasePlayerControl(object);
}
if (m_metaDataControl) {
@@ -294,12 +294,12 @@ void QmlMediaBase::setObject(QObject *object)
}
}
-QUrl QmlMediaBase::source() const
+QUrl QDeclarativeMediaBase::source() const
{
return m_playerControl->media().canonicalUrl();
}
-void QmlMediaBase::setSource(const QUrl &url)
+void QDeclarativeMediaBase::setSource(const QUrl &url)
{
if (m_error != QMediaPlayer::ServiceMissingError && m_error != QMediaPlayer::NoError) {
m_error = QMediaPlayer::NoError;
@@ -311,12 +311,12 @@ void QmlMediaBase::setSource(const QUrl &url)
m_playerControl->setMedia(QMediaContent(url), 0);
}
-bool QmlMediaBase::isPlaying() const
+bool QDeclarativeMediaBase::isPlaying() const
{
return m_state != QMediaPlayer::StoppedState;
}
-void QmlMediaBase::setPlaying(bool playing)
+void QDeclarativeMediaBase::setPlaying(bool playing)
{
if (playing && m_state == QMediaPlayer::StoppedState) {
if (m_paused)
@@ -328,12 +328,12 @@ void QmlMediaBase::setPlaying(bool playing)
}
}
-bool QmlMediaBase::isPaused() const
+bool QDeclarativeMediaBase::isPaused() const
{
return m_paused;
}
-void QmlMediaBase::setPaused(bool paused)
+void QDeclarativeMediaBase::setPaused(bool paused)
{
if (m_paused != paused) {
if (paused && m_state == QMediaPlayer::PlayingState) {
@@ -348,63 +348,63 @@ void QmlMediaBase::setPaused(bool paused)
}
}
-int QmlMediaBase::duration() const
+int QDeclarativeMediaBase::duration() const
{
return m_playerControl->duration();
}
-int QmlMediaBase::position() const
+int QDeclarativeMediaBase::position() const
{
return m_playerControl->position();
}
-void QmlMediaBase::setPosition(int position)
+void QDeclarativeMediaBase::setPosition(int position)
{
m_playerControl->setPosition(position);
}
-qreal QmlMediaBase::volume() const
+qreal QDeclarativeMediaBase::volume() const
{
return qreal(m_playerControl->volume()) / 100;
}
-void QmlMediaBase::setVolume(qreal volume)
+void QDeclarativeMediaBase::setVolume(qreal volume)
{
m_playerControl->setVolume(qRound(volume * 100));
}
-bool QmlMediaBase::isMuted() const
+bool QDeclarativeMediaBase::isMuted() const
{
return m_playerControl->isMuted();
}
-void QmlMediaBase::setMuted(bool muted)
+void QDeclarativeMediaBase::setMuted(bool muted)
{
m_playerControl->setMuted(muted);
}
-qreal QmlMediaBase::bufferProgress() const
+qreal QDeclarativeMediaBase::bufferProgress() const
{
return qreal(m_playerControl->bufferStatus()) / 100;
}
-bool QmlMediaBase::isSeekable() const
+bool QDeclarativeMediaBase::isSeekable() const
{
return m_playerControl->isSeekable();
}
-qreal QmlMediaBase::playbackRate() const
+qreal QDeclarativeMediaBase::playbackRate() const
{
return m_playerControl->playbackRate();
}
-void QmlMediaBase::setPlaybackRate(qreal rate)
+void QDeclarativeMediaBase::setPlaybackRate(qreal rate)
{
m_playerControl->setPlaybackRate(rate);
}
-QString QmlMediaBase::errorString() const
+QString QDeclarativeMediaBase::errorString() const
{
return m_errorString;
}
diff --git a/src/multimedia/qml/qmlmediabase_p.h b/src/multimedia/qml/qdeclarativemediabase_p.h
index d6ad9b3..2fc48db 100644
--- a/src/multimedia/qml/qmlmediabase_p.h
+++ b/src/multimedia/qml/qdeclarativemediabase_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLMEDIABASE_P_H
-#define QMLMEDIABASE_P_H
+#ifndef QDECLARATIVEMEDIABASE_P_H
+#define QDECLARATIVEMEDIABASE_P_H
//
// W A R N I N G
@@ -65,13 +65,13 @@ class QMediaService;
class QMediaServiceProvider;
class QMetaDataControl;
class QMetaDataControlMetaObject;
-class QmlMediaBaseAnimation;
+class QDeclarativeMediaBaseAnimation;
-class Q_AUTOTEST_EXPORT QmlMediaBase
+class Q_AUTOTEST_EXPORT QDeclarativeMediaBase
{
public:
- QmlMediaBase();
- virtual ~QmlMediaBase();
+ QDeclarativeMediaBase();
+ virtual ~QDeclarativeMediaBase();
QUrl source() const;
void setSource(const QUrl &url);
@@ -150,7 +150,7 @@ protected:
QMediaServiceProvider *m_mediaProvider;
QMetaDataControl *m_metaDataControl;
QMetaDataControlMetaObject *m_metaObject;
- QmlMediaBaseAnimation *m_animation;
+ QDeclarativeMediaBaseAnimation *m_animation;
QMediaPlayer::State m_state;
QMediaPlayer::MediaStatus m_status;
@@ -158,7 +158,7 @@ protected:
bool m_paused;
QString m_errorString;
- friend class QmlMediaBaseAnimation;
+ friend class QDeclarativeMediaBaseAnimation;
};
QT_END_NAMESPACE
diff --git a/src/multimedia/qml/qmlgraphicsvideo.cpp b/src/multimedia/qml/qdeclarativevideo.cpp
index 7289f4d..d0e94f6 100644
--- a/src/multimedia/qml/qmlgraphicsvideo.cpp
+++ b/src/multimedia/qml/qdeclarativevideo.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qmlgraphicsvideo_p.h"
+#include "qdeclarativevideo_p.h"
#include <QtMultimedia/qmediaplayercontrol.h>
#include <QtMultimedia/qmediaservice.h>
@@ -51,13 +51,13 @@
QT_BEGIN_NAMESPACE
-void QmlGraphicsVideo::_q_nativeSizeChanged(const QSizeF &size)
+void QDeclarativeVideo::_q_nativeSizeChanged(const QSizeF &size)
{
setImplicitWidth(size.width());
setImplicitHeight(size.height());
}
-void QmlGraphicsVideo::_q_error(int errorCode, const QString &errorString)
+void QDeclarativeVideo::_q_error(int errorCode, const QString &errorString)
{
m_error = QMediaPlayer::Error(errorCode);
m_errorString = errorString;
@@ -68,7 +68,7 @@ void QmlGraphicsVideo::_q_error(int errorCode, const QString &errorString)
/*!
- \qmlclass Video QmlGraphicsVideo
+ \qmlclass Video QDeclarativeVideo
\brief The Video element allows you to add videos to a scene.
\inherits Item
@@ -87,12 +87,12 @@ void QmlGraphicsVideo::_q_error(int errorCode, const QString &errorString)
/*!
\internal
- \class QmlGraphicsVideo
- \brief The QmlGraphicsVideo class provides a video item that you can add to a QmlView.
+ \class QDeclarativeVideo
+ \brief The QDeclarativeVideo class provides a video item that you can add to a QDeclarativeView.
*/
-QmlGraphicsVideo::QmlGraphicsVideo(QmlGraphicsItem *parent)
- : QmlGraphicsItem(parent)
+QDeclarativeVideo::QDeclarativeVideo(QDeclarativeItem *parent)
+ : QDeclarativeItem(parent)
, m_graphicsItem(0)
{
@@ -112,7 +112,7 @@ QmlGraphicsVideo::QmlGraphicsVideo(QmlGraphicsItem *parent)
}
}
-QmlGraphicsVideo::~QmlGraphicsVideo()
+QDeclarativeVideo::~QDeclarativeVideo()
{
shutdown();
@@ -183,7 +183,7 @@ QmlGraphicsVideo::~QmlGraphicsVideo()
\endlist
*/
-QmlGraphicsVideo::Status QmlGraphicsVideo::status() const
+QDeclarativeVideo::Status QDeclarativeVideo::status() const
{
return Status(m_status);
}
@@ -250,7 +250,7 @@ QmlGraphicsVideo::Status QmlGraphicsVideo::status() const
This property holds whether the media contains audio.
*/
-bool QmlGraphicsVideo::hasAudio() const
+bool QDeclarativeVideo::hasAudio() const
{
return m_playerControl->isAudioAvailable();
}
@@ -261,7 +261,7 @@ bool QmlGraphicsVideo::hasAudio() const
This property holds whether the media contains video.
*/
-bool QmlGraphicsVideo::hasVideo() const
+bool QDeclarativeVideo::hasVideo() const
{
return m_playerControl->isVideoAvailable();
}
@@ -302,7 +302,7 @@ bool QmlGraphicsVideo::hasVideo() const
*/
-QmlGraphicsVideo::Error QmlGraphicsVideo::error() const
+QDeclarativeVideo::Error QDeclarativeVideo::error() const
{
return Error(m_error);
}
@@ -334,12 +334,12 @@ QmlGraphicsVideo::Error QmlGraphicsVideo::error() const
The default fill mode is PreserveAspectFit.
*/
-QmlGraphicsVideo::FillMode QmlGraphicsVideo::fillMode() const
+QDeclarativeVideo::FillMode QDeclarativeVideo::fillMode() const
{
return FillMode(m_graphicsItem->aspectRatioMode());
}
-void QmlGraphicsVideo::setFillMode(FillMode mode)
+void QDeclarativeVideo::setFillMode(FillMode mode)
{
m_graphicsItem->setAspectRatioMode(Qt::AspectRatioMode(mode));
}
@@ -352,7 +352,7 @@ void QmlGraphicsVideo::setFillMode(FillMode mode)
Sets the \l playing property to true, and the \l paused property to false.
*/
-void QmlGraphicsVideo::play()
+void QDeclarativeVideo::play()
{
m_playerControl->play();
@@ -370,7 +370,7 @@ void QmlGraphicsVideo::play()
Sets the \l playing and \l paused properties to true.
*/
-void QmlGraphicsVideo::pause()
+void QDeclarativeVideo::pause()
{
m_playerControl->pause();
@@ -388,7 +388,7 @@ void QmlGraphicsVideo::pause()
Sets the \l playing and \l paused properties to false.
*/
-void QmlGraphicsVideo::stop()
+void QDeclarativeVideo::stop()
{
m_playerControl->stop();
@@ -398,15 +398,15 @@ void QmlGraphicsVideo::stop()
}
}
-void QmlGraphicsVideo::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
+void QDeclarativeVideo::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
{
}
-void QmlGraphicsVideo::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+void QDeclarativeVideo::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
m_graphicsItem->setSize(newGeometry.size());
- QmlGraphicsItem::geometryChanged(newGeometry, oldGeometry);
+ QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
}
QT_END_NAMESPACE
@@ -941,4 +941,4 @@ QT_END_NAMESPACE
#endif
-#include "moc_qmlgraphicsvideo_p.cpp"
+#include "moc_qdeclarativevideo_p.cpp"
diff --git a/src/multimedia/qml/qmlgraphicsvideo_p.h b/src/multimedia/qml/qdeclarativevideo_p.h
index 26252e0..d5ebde1 100644
--- a/src/multimedia/qml/qmlgraphicsvideo_p.h
+++ b/src/multimedia/qml/qdeclarativevideo_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLGRAPHICSVIDEO_H
-#define QMLGRAPHICSVIDEO_H
+#ifndef QDECLARATIVEVIDEO_H
+#define QDECLARATIVEVIDEO_H
//
// W A R N I N G
@@ -53,12 +53,12 @@
// We mean it.
//
-#include <QtMultimedia/private/qmlmediabase_p.h>
+#include <QtMultimedia/private/qdeclarativemediabase_p.h>
#include <QtMultimedia/qgraphicsvideoitem.h>
#include <QtCore/qbasictimer.h>
-#include <QtDeclarative/qmlgraphicsitem.h>
+#include <QtDeclarative/qdeclarativeitem.h>
QT_BEGIN_HEADER
@@ -69,7 +69,7 @@ class QTimerEvent;
class QVideoSurfaceFormat;
-class Q_AUTOTEST_EXPORT QmlGraphicsVideo : public QmlGraphicsItem, public QmlMediaBase
+class Q_AUTOTEST_EXPORT QDeclarativeVideo : public QDeclarativeItem, public QDeclarativeMediaBase
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
@@ -122,8 +122,8 @@ public:
ServiceMissing = QMediaPlayer::ServiceMissingError
};
- QmlGraphicsVideo(QmlGraphicsItem *parent = 0);
- ~QmlGraphicsVideo();
+ QDeclarativeVideo(QDeclarativeItem *parent = 0);
+ ~QDeclarativeVideo();
bool hasAudio() const;
bool hasVideo() const;
@@ -174,7 +174,7 @@ Q_SIGNALS:
void playbackRateChanged();
void errorChanged();
- void error(QmlGraphicsVideo::Error error, const QString &errorString);
+ void error(QDeclarativeVideo::Error error, const QString &errorString);
protected:
void geometryChanged(const QRectF &geometry, const QRectF &);
@@ -184,7 +184,7 @@ private Q_SLOTS:
void _q_error(int, const QString &);
private:
- Q_DISABLE_COPY(QmlGraphicsVideo)
+ Q_DISABLE_COPY(QDeclarativeVideo)
QGraphicsVideoItem *m_graphicsItem;
@@ -192,12 +192,12 @@ private:
Q_PRIVATE_SLOT(mediaBase(), void _q_mediaStatusChanged(QMediaPlayer::MediaStatus))
Q_PRIVATE_SLOT(mediaBase(), void _q_metaDataChanged())
- inline QmlMediaBase *mediaBase() { return this; }
+ inline QDeclarativeMediaBase *mediaBase() { return this; }
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QmlGraphicsVideo))
+QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeVideo))
QT_END_HEADER
diff --git a/src/multimedia/qml/qml.pri b/src/multimedia/qml/qml.pri
index a7ca02e..d0ff71d 100644
--- a/src/multimedia/qml/qml.pri
+++ b/src/multimedia/qml/qml.pri
@@ -17,20 +17,20 @@ contains(QT_CONFIG, declarative) {
}
HEADERS += \
- $$PWD/multimediaqml.h \
+ $$PWD/multimediadeclarative.h \
$$PWD/qmetadatacontrolmetaobject_p.h \
- $$PWD/qmlaudio_p.h \
- $$PWD/qmlgraphicsvideo_p.h \
- $$PWD/qmlmediabase_p.h \
+ $$PWD/qdeclarativeaudio_p.h \
+ $$PWD/qdeclarativevideo_p.h \
+ $$PWD/qdeclarativemediabase_p.h \
$$PWD/qsoundeffect_p.h \
$$PWD/wavedecoder_p.h
SOURCES += \
- $$PWD/multimediaqml.cpp \
+ $$PWD/multimediadeclarative.cpp \
$$PWD/qmetadatacontrolmetaobject.cpp \
- $$PWD/qmlaudio.cpp \
- $$PWD/qmlgraphicsvideo.cpp \
- $$PWD/qmlmediabase.cpp \
+ $$PWD/qdeclarativeaudio.cpp \
+ $$PWD/qdeclarativevideo.cpp \
+ $$PWD/qdeclarativemediabase.cpp \
$$PWD/qsoundeffect.cpp \
$$PWD/wavedecoder_p.cpp
}
diff --git a/src/multimedia/qml/qsoundeffect_p.h b/src/multimedia/qml/qsoundeffect_p.h
index 4b440ec..51ebe52 100644
--- a/src/multimedia/qml/qsoundeffect_p.h
+++ b/src/multimedia/qml/qsoundeffect_p.h
@@ -56,7 +56,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qurl.h>
-#include <QtDeclarative/qml.h>
+#include <QtDeclarative/qdeclarative.h>
QT_BEGIN_HEADER
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index ea464d5..25ad5d7 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1309,7 +1309,6 @@ void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem)
? QFontEngineGlyphCache::Type(textItem->fontEngine->glyphFormat)
: d->glyphCacheType;
- // ### What about huge fonts? These are not passed through cache in drawTextItem().
d->drawCachedGlyphs(glyphType, textItem, true);
}
@@ -1642,21 +1641,23 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
s->matrix = old;
}
-void QGL2PaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints)
+void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::FragmentHints hints)
{
Q_D(QGL2PaintEngineEx);
// Use fallback for extended composition modes.
if (state()->composition_mode > QPainter::CompositionMode_Plus) {
- QPaintEngineEx::drawPixmaps(drawingData, dataCount, pixmap, hints);
+ QPaintEngineEx::drawPixmapFragments(fragments, fragmentCount, pixmap, hints);
return;
}
ensureActive();
- d->drawPixmaps(drawingData, dataCount, pixmap, hints);
+ d->drawPixmapFragments(fragments, fragmentCount, pixmap, hints);
}
-void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints)
+void QGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::Fragment *fragments,
+ int fragmentCount, const QPixmap &pixmap,
+ QPainter::FragmentHints hints)
{
GLfloat dx = 1.0f / pixmap.size().width();
GLfloat dy = 1.0f / pixmap.size().height();
@@ -1677,28 +1678,29 @@ void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData
bool allOpaque = true;
- for (int i = 0; i < dataCount; ++i) {
+ for (int i = 0; i < fragmentCount; ++i) {
qreal s = 0;
qreal c = 1;
- if (drawingData[i].rotation != 0) {
- s = qFastSin(drawingData[i].rotation * Q_PI / 180);
- c = qFastCos(drawingData[i].rotation * Q_PI / 180);
+ if (fragments[i].rotation != 0) {
+ s = qFastSin(fragments[i].rotation * Q_PI / 180);
+ c = qFastCos(fragments[i].rotation * Q_PI / 180);
}
- qreal right = 0.5 * drawingData[i].scaleX * drawingData[i].source.width();
- qreal bottom = 0.5 * drawingData[i].scaleY * drawingData[i].source.height();
+ qreal right = 0.5 * fragments[i].scaleX * fragments[i].width;
+ qreal bottom = 0.5 * fragments[i].scaleY * fragments[i].height;
QGLPoint bottomRight(right * c - bottom * s, right * s + bottom * c);
QGLPoint bottomLeft(-right * c - bottom * s, -right * s + bottom * c);
- vertexCoordinateArray.lineToArray(bottomRight.x + drawingData[i].point.x(), bottomRight.y + drawingData[i].point.y());
- vertexCoordinateArray.lineToArray(-bottomLeft.x + drawingData[i].point.x(), -bottomLeft.y + drawingData[i].point.y());
- vertexCoordinateArray.lineToArray(-bottomRight.x + drawingData[i].point.x(), -bottomRight.y + drawingData[i].point.y());
- vertexCoordinateArray.lineToArray(-bottomRight.x + drawingData[i].point.x(), -bottomRight.y + drawingData[i].point.y());
- vertexCoordinateArray.lineToArray(bottomLeft.x + drawingData[i].point.x(), bottomLeft.y + drawingData[i].point.y());
- vertexCoordinateArray.lineToArray(bottomRight.x + drawingData[i].point.x(), bottomRight.y + drawingData[i].point.y());
+ vertexCoordinateArray.lineToArray(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y);
+ vertexCoordinateArray.lineToArray(-bottomLeft.x + fragments[i].x, -bottomLeft.y + fragments[i].y);
+ vertexCoordinateArray.lineToArray(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y);
+ vertexCoordinateArray.lineToArray(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y);
+ vertexCoordinateArray.lineToArray(bottomLeft.x + fragments[i].x, bottomLeft.y + fragments[i].y);
+ vertexCoordinateArray.lineToArray(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y);
- QGLRect src(drawingData[i].source.left() * dx, drawingData[i].source.top() * dy,
- drawingData[i].source.right() * dx, drawingData[i].source.bottom() * dy);
+ QGLRect src(fragments[i].sourceLeft * dx, fragments[i].sourceTop * dy,
+ (fragments[i].sourceLeft + fragments[i].width) * dx,
+ (fragments[i].sourceTop + fragments[i].height) * dy);
textureCoordinateArray.lineToArray(src.right, src.bottom);
textureCoordinateArray.lineToArray(src.right, src.top);
@@ -1707,7 +1709,7 @@ void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData
textureCoordinateArray.lineToArray(src.left, src.bottom);
textureCoordinateArray.lineToArray(src.right, src.bottom);
- qreal opacity = drawingData[i].opacity * q->state()->opacity;
+ qreal opacity = fragments[i].opacity * q->state()->opacity;
opacityArray << opacity << opacity << opacity << opacity << opacity << opacity;
allOpaque &= (opacity >= 0.99f);
}
@@ -1720,21 +1722,22 @@ void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData
if (texture->options & QGLContext::InvertedYBindOption) {
// Flip texture y-coordinate.
QGLPoint *data = textureCoordinateArray.data();
- for (int i = 0; i < 6 * dataCount; ++i)
+ for (int i = 0; i < 6 * fragmentCount; ++i)
data[i].y = 1 - data[i].y;
}
transferMode(ImageArrayDrawingMode);
bool isBitmap = pixmap.isQBitmap();
- bool isOpaque = !isBitmap && (!pixmap.hasAlphaChannel() || (hints & QDrawPixmaps::OpaqueHint)) && allOpaque;
+ bool isOpaque = !isBitmap && (!pixmap.hasAlphaChannel() || (hints & QPainter::OpaqueHint)) && allOpaque;
updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE,
q->state()->renderHints & QPainter::SmoothPixmapTransform, texture->id);
// Setup for texture drawing
currentBrush = noBrush;
- shaderManager->setSrcPixelType(isBitmap ? QGLEngineShaderManager::PatternSrc : QGLEngineShaderManager::ImageSrc);
+ shaderManager->setSrcPixelType(isBitmap ? QGLEngineShaderManager::PatternSrc
+ : QGLEngineShaderManager::ImageSrc);
if (prepareForDraw(isOpaque))
shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT);
@@ -1743,7 +1746,7 @@ void QGL2PaintEngineExPrivate::drawPixmaps(const QDrawPixmaps::Data *drawingData
shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col);
}
- glDrawArrays(GL_TRIANGLES, 0, 6 * dataCount);
+ glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount);
}
bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index d4932be..5d3608b 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -125,7 +125,7 @@ public:
virtual void drawTexture(const QRectF &r, GLuint textureId, const QSize &size, const QRectF &sr);
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
- virtual void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints);
+ virtual void drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::FragmentHints hints);
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
Qt::ImageConversionFlags flags = Qt::AutoColor);
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem);
@@ -196,7 +196,7 @@ public:
void fill(const QVectorPath &path);
void stroke(const QVectorPath &path, const QPen &pen);
void drawTexture(const QGLRect& dest, const QGLRect& src, const QSize &textureSize, bool opaque, bool pattern = false);
- void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints);
+ void drawPixmapFragments(const QPainter::Fragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::FragmentHints hints);
void drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem,
bool includeMatrixInCache);
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index 62f0293..bc9f0c9 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -93,7 +93,7 @@ public:
VGFont font;
VGfloat scaleX;
VGfloat scaleY;
-
+
uint cachedGlyphsMask[256 / 32];
QSet<glyph_t> cachedGlyphs;
};
@@ -3035,9 +3035,8 @@ void QVGPaintEngine::drawTiledPixmap
// (i.e. no opacity), no rotation or scaling, and drawing the full
// pixmap rather than parts of the pixmap. Even having just one of
// these conditions will improve performance.
-void QVGPaintEngine::drawPixmaps
- (const QDrawPixmaps::Data *drawingData, int dataCount,
- const QPixmap &pixmap, QFlags<QDrawPixmaps::DrawingHint> hints)
+void QVGPaintEngine::drawPixmapFragments(const QPainter::Fragment *drawingData, int dataCount,
+ const QPixmap &pixmap, QFlags<QPainter::FragmentHint> hints)
{
#if !defined(QT_SHIVAVG)
Q_D(QVGPaintEngine);
@@ -3048,7 +3047,7 @@ void QVGPaintEngine::drawPixmaps
if (!pd)
return; // null QPixmap
if (pd->classId() != QPixmapData::OpenVGClass || !d->simpleTransform) {
- QPaintEngineEx::drawPixmaps(drawingData, dataCount, pixmap, hints);
+ QPaintEngineEx::drawPixmapFragments(drawingData, dataCount, pixmap, hints);
return;
}
@@ -3072,7 +3071,7 @@ void QVGPaintEngine::drawPixmaps
QVarLengthArray<QRect> cachedSources;
// Select the opacity paint object.
- if ((hints & QDrawPixmaps::OpaqueHint) != 0 && d->opacity == 1.0f) {
+ if ((hints & QPainter::OpaqueHint) != 0 && d->opacity == 1.0f) {
d->setImageMode(VG_DRAW_IMAGE_NORMAL);
} else {
hints = 0;
@@ -3084,12 +3083,13 @@ void QVGPaintEngine::drawPixmaps
for (int i = 0; i < dataCount; ++i) {
QTransform transform(d->imageTransform);
- transform.translate(drawingData[i].point.x(), drawingData[i].point.y());
+ transform.translate(drawingData[i].x, drawingData[i].y);
transform.rotate(drawingData[i].rotation);
VGImage child;
QSize imageSize = vgpd->size();
- QRectF sr = drawingData[i].source;
+ QRectF sr(drawingData[i].sourceLeft, drawingData[i].sourceTop,
+ drawingData[i].width, drawingData[i].height);
if (sr.topLeft().isNull() && sr.size() == imageSize) {
child = vgImg;
} else {
@@ -3118,7 +3118,7 @@ void QVGPaintEngine::drawPixmaps
transform.scale(scaleX, scaleY);
d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform);
- if ((hints & QDrawPixmaps::OpaqueHint) == 0) {
+ if ((hints & QPainter::OpaqueHint) == 0) {
qreal opacity = d->opacity * drawingData[i].opacity;
if (opacity != 1.0f) {
if (d->paintOpacity != opacity) {
@@ -3144,7 +3144,7 @@ void QVGPaintEngine::drawPixmaps
for (int i = 0; i < cachedImages.size(); ++i)
vgDestroyImage(cachedImages[i]);
#else
- QPaintEngineEx::drawPixmaps(drawingData, dataCount, pixmap, hints);
+ QPaintEngineEx::drawPixmapFragments(drawingData, dataCount, pixmap, hints);
#endif
}
@@ -3274,7 +3274,7 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
QPaintEngineEx::drawTextItem(p, textItem);
return;
}
-
+
// Get the glyphs and positions associated with the text item.
QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> glyphs;
@@ -3284,7 +3284,7 @@ void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
(ti.glyphs, matrix, ti.flags, glyphs, positions);
if (!drawCachedGlyphs(glyphs.size(), glyphs.data(), ti.font(), ti.fontEngine, p))
- QPaintEngineEx::drawTextItem(p, textItem);
+ QPaintEngineEx::drawTextItem(p, textItem);
#else
// OpenGL 1.0 does not have support for VGFont and glyphs,
// so fall back to the default Qt path stroking algorithm.
@@ -3312,7 +3312,7 @@ void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
glyphCache = new QVGFontGlyphCache();
if (glyphCache->font == VG_INVALID_HANDLE) {
qWarning("QVGPaintEngine::drawTextItem: OpenVG fonts are not supported by the OpenVG engine");
- delete glyphCache;
+ delete glyphCache;
return false;
}
glyphCache->setScaleFromText(font, fontEngine);
diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h
index 3f73fed..1203af5 100644
--- a/src/openvg/qpaintengine_vg_p.h
+++ b/src/openvg/qpaintengine_vg_p.h
@@ -137,7 +137,7 @@ public:
void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
- void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QFlags<QDrawPixmaps::DrawingHint> hints);
+ void drawPixmapFragments(const QPainter::Fragment *drawingData, int dataCount, const QPixmap &pixmap, QFlags<QPainter::FragmentHint> hints);
void drawTextItem(const QPointF &p, const QTextItem &textItem);
void drawStaticTextItem(QStaticTextItem *staticTextItem);
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index f654038..e6c871d 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -60,6 +60,7 @@
#include <sys/ioctl.h>
#include <net/if.h>
#include <net/if_arp.h>
+#include <unistd.h>
#endif
QT_BEGIN_NAMESPACE
@@ -126,14 +127,11 @@ static QString qGetInterfaceType(const QString &interface)
ifreq request;
strncpy(request.ifr_name, interface.toLocal8Bit().data(), sizeof(request.ifr_name));
- if (ioctl(sock, SIOCGIFHWADDR, &request) >= 0) {
- switch (request.ifr_hwaddr.sa_family) {
- case ARPHRD_ETHER:
- return QLatin1String("Ethernet");
- }
- }
-
+ int result = ioctl(sock, SIOCGIFHWADDR, &request);
close(sock);
+
+ if (result >= 0 && request.ifr_hwaddr.sa_family == ARPHRD_ETHER)
+ return QLatin1String("Ethernet");
#else
Q_UNUSED(interface);
#endif
diff --git a/src/plugins/bearer/symbian/symbian.pro b/src/plugins/bearer/symbian/symbian.pro
index 9fd1a74..9613def 100644
--- a/src/plugins/bearer/symbian/symbian.pro
+++ b/src/plugins/bearer/symbian/symbian.pro
@@ -21,6 +21,7 @@ exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) {
}
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+symbian-abld:INCLUDEPATH += $$QT_BUILD_TREE/include/QtNetwork/private
LIBS += -lcommdb \
-lapsettingshandlerui \
diff --git a/src/plugins/mediaservices/gstreamer/gstreamer.pro b/src/plugins/mediaservices/gstreamer/gstreamer.pro
index db0ee4e..22e3c16 100644
--- a/src/plugins/mediaservices/gstreamer/gstreamer.pro
+++ b/src/plugins/mediaservices/gstreamer/gstreamer.pro
@@ -8,16 +8,8 @@ unix:contains(QT_CONFIG, alsa) {
LIBS += -lasound
}
-LIBS += -lXv
-
-CONFIG += link_pkgconfig
-
-PKGCONFIG += \
- gstreamer-0.10 \
- gstreamer-base-0.10 \
- gstreamer-interfaces-0.10 \
- gstreamer-audio-0.10 \
- gstreamer-video-0.10
+QMAKE_CXXFLAGS += $$QT_CFLAGS_GSTREAMER
+LIBS += -lXv $$QT_LIBS_GSTREAMER -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstbase-0.10 -lgstaudio-0.10
# Input
HEADERS += \
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp b/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp
index 0a689d9..13a2454 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamermessage.cpp
@@ -48,7 +48,7 @@ static int wuchi = qRegisterMetaType<QGstreamerMessage>();
/*!
- \class QGstreamerMessage
+ \class gstreamer::QGstreamerMessage
\internal
*/
diff --git a/src/plugins/mediaservices/mediaservices.pro b/src/plugins/mediaservices/mediaservices.pro
index 0cef605..d84b276 100644
--- a/src/plugins/mediaservices/mediaservices.pro
+++ b/src/plugins/mediaservices/mediaservices.pro
@@ -5,16 +5,7 @@ contains(QT_CONFIG, mediaservice) {
mac: SUBDIRS += qt7
- unix:!mac:!symbian {
- TMP_GST_LIBS = \
- gstreamer-0.10 >= 0.10.19 \
- gstreamer-base-0.10 >= 0.10.19 \
- gstreamer-interfaces-0.10 >= 0.10.19 \
- gstreamer-audio-0.10 >= 0.10.19 \
- gstreamer-video-0.10 >= 0.10.19
-
- system(pkg-config --exists \'$${TMP_GST_LIBS}\' --print-errors): {
- SUBDIRS += gstreamer
- }
+ unix:!mac:!symbian:contains(QT_CONFIG, xvideo):contains(QT_CONFIG, gstreamer) {
+ SUBDIRS += gstreamer
}
}
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 73686bc..418fd81 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -12,6 +12,6 @@ embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers
symbian:SUBDIRS += s60
contains(QT_CONFIG, phonon): SUBDIRS *= phonon
contains(QT_CONFIG, multimedia): SUBDIRS *= audio mediaservices
-contains(QT_CONFIG, declarative): SUBDIRS *= qmlmodules
+contains(QT_CONFIG, declarative): SUBDIRS *= qdeclarativemodules
diff --git a/src/plugins/qmlmodules/multimedia/multimedia.cpp b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp
index d192ed8..8becbf3 100644
--- a/src/plugins/qmlmodules/multimedia/multimedia.cpp
+++ b/src/plugins/qdeclarativemodules/multimedia/multimedia.cpp
@@ -39,27 +39,19 @@
**
****************************************************************************/
-#include <QtDeclarative/qmlmoduleplugin.h>
-#include <QtDeclarative/qml.h>
-#include <QtMultimedia/multimediaqml.h>
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtDeclarative/qdeclarative.h>
+#include <QtMultimedia/multimediadeclarative.h>
QT_BEGIN_NAMESPACE
-class QMultimediaQmlModule : public QmlModulePlugin
+class QMultimediaQmlModule : public QDeclarativeExtensionPlugin
{
Q_OBJECT
public:
- QStringList keys() const
+ virtual void registerTypes(const char *uri)
{
- return QStringList() << QLatin1String("Qt.multimedia");
- }
-
- void defineModule(const QString& uri)
- {
- Q_UNUSED(uri)
- Q_ASSERT(uri == QLatin1String("Qt.multimedia"));
-
- QtMultimedia::qRegisterQmlElements();
+ QtMultimedia::qRegisterDeclarativeElements(uri);
}
};
diff --git a/src/plugins/qdeclarativemodules/multimedia/multimedia.pro b/src/plugins/qdeclarativemodules/multimedia/multimedia.pro
new file mode 100644
index 0000000..d8ad18e
--- /dev/null
+++ b/src/plugins/qdeclarativemodules/multimedia/multimedia.pro
@@ -0,0 +1,15 @@
+TARGET = multimedia
+include(../../qpluginbase.pri)
+
+QT += multimedia declarative
+
+SOURCES += multimedia.cpp
+
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/multimedia
+target.path = $$[QT_INSTALL_IMPORTS]/Qt/multimedia
+
+qmldir.files += $$QT_BUILD_TREE/imports/Qt/multimedia/qmldir
+qmldir.path += $$[QT_INSTALL_IMPORTS]/Qt/multimedia
+
+INSTALLS += target qmldir
+
diff --git a/src/plugins/qmlmodules/qmlmodules.pro b/src/plugins/qdeclarativemodules/qdeclarativemodules.pro
index b1dc0ef..0a6f444 100644
--- a/src/plugins/qmlmodules/qmlmodules.pro
+++ b/src/plugins/qdeclarativemodules/qdeclarativemodules.pro
@@ -1,4 +1,6 @@
TEMPLATE = subdirs
+SUBDIRS += widgets
+
contains(QT_CONFIG, multimedia): SUBDIRS += multimedia
diff --git a/src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp b/src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp
new file mode 100644
index 0000000..fc15ad2
--- /dev/null
+++ b/src/plugins/qdeclarativemodules/widgets/graphicslayouts.cpp
@@ -0,0 +1,260 @@
+/****************************************************************************
+**
+** 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.
+**
+** $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 "graphicslayouts_p.h"
+
+#include <QtGui/qgraphicswidget.h>
+#include <QtCore/qdebug.h>
+
+QT_BEGIN_NAMESPACE
+
+LinearLayoutAttached::LinearLayoutAttached(QObject *parent)
+: QObject(parent), _stretch(1), _alignment(Qt::AlignCenter)
+{
+}
+
+void LinearLayoutAttached::setStretchFactor(int f)
+{
+ if (_stretch == f)
+ return;
+
+ _stretch = f;
+ emit stretchChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _stretch);
+}
+
+void LinearLayoutAttached::setAlignment(Qt::Alignment a)
+{
+ if (_alignment == a)
+ return;
+
+ _alignment = a;
+ emit alignmentChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _alignment);
+}
+
+QGraphicsLinearLayoutStretchItemObject::QGraphicsLinearLayoutStretchItemObject(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QSizeF QGraphicsLinearLayoutStretchItemObject::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+Q_UNUSED(which);
+Q_UNUSED(constraint);
+return QSizeF();
+}
+
+
+QGraphicsLinearLayoutObject::QGraphicsLinearLayoutObject(QObject *parent)
+: QObject(parent)
+{
+}
+
+QGraphicsLinearLayoutObject::~QGraphicsLinearLayoutObject()
+{
+}
+
+void QGraphicsLinearLayoutObject::insertLayoutItem(int index, QGraphicsLayoutItem *item)
+{
+insertItem(index, item);
+
+//connect attached properties
+if (LinearLayoutAttached *obj = attachedProperties.value(item)) {
+ setStretchFactor(item, obj->stretchFactor());
+ setAlignment(item, obj->alignment());
+ QObject::connect(obj, SIGNAL(stretchChanged(QGraphicsLayoutItem*,int)),
+ this, SLOT(updateStretch(QGraphicsLayoutItem*,int)));
+ QObject::connect(obj, SIGNAL(alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment)),
+ this, SLOT(updateAlignment(QGraphicsLayoutItem*,Qt::Alignment)));
+ //### need to disconnect when widget is removed?
+}
+}
+
+//### is there a better way to do this?
+void QGraphicsLinearLayoutObject::clearChildren()
+{
+for (int i = 0; i < count(); ++i)
+ removeAt(i);
+}
+
+void QGraphicsLinearLayoutObject::updateStretch(QGraphicsLayoutItem *item, int stretch)
+{
+QGraphicsLinearLayout::setStretchFactor(item, stretch);
+}
+
+void QGraphicsLinearLayoutObject::updateAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment)
+{
+QGraphicsLinearLayout::setAlignment(item, alignment);
+}
+
+QHash<QGraphicsLayoutItem*, LinearLayoutAttached*> QGraphicsLinearLayoutObject::attachedProperties;
+LinearLayoutAttached *QGraphicsLinearLayoutObject::qmlAttachedProperties(QObject *obj)
+{
+// ### This is not allowed - you must attach to any object
+if (!qobject_cast<QGraphicsLayoutItem*>(obj))
+ return 0;
+LinearLayoutAttached *rv = new LinearLayoutAttached(obj);
+attachedProperties.insert(qobject_cast<QGraphicsLayoutItem*>(obj), rv);
+return rv;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////
+// QGraphicsGridLayout-related classes
+//////////////////////////////////////////////////////////////////////////////////////////////////////
+GridLayoutAttached::GridLayoutAttached(QObject *parent)
+: QObject(parent), _row(-1), _column(-1), _rowspan(1), _colspan(1), _alignment(-1)
+{
+}
+
+void GridLayoutAttached::setRow(int r)
+{
+ if (_row == r)
+ return;
+
+ _row = r;
+ //emit rowChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _row);
+}
+
+void GridLayoutAttached::setColumn(int c)
+{
+ if (_column == c)
+ return;
+
+ _column = c;
+ //emit columnChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _column);
+}
+
+void GridLayoutAttached::setRowSpan(int rs)
+{
+ if (_rowspan == rs)
+ return;
+
+ _rowspan = rs;
+ //emit rowSpanChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _rowSpan);
+}
+
+void GridLayoutAttached::setColumnSpan(int cs)
+{
+ if (_colspan == cs)
+ return;
+
+ _colspan = cs;
+ //emit columnSpanChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _columnSpan);
+}
+
+void GridLayoutAttached::setAlignment(Qt::Alignment a)
+{
+ if (_alignment == a)
+ return;
+
+ _alignment = a;
+ //emit alignmentChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _alignment);
+}
+
+QGraphicsGridLayoutObject::QGraphicsGridLayoutObject(QObject *parent)
+: QObject(parent)
+{
+}
+
+QGraphicsGridLayoutObject::~QGraphicsGridLayoutObject()
+{
+}
+
+void QGraphicsGridLayoutObject::addWidget(QGraphicsWidget *wid)
+{
+//use attached properties
+if (QObject *obj = attachedProperties.value(qobject_cast<QGraphicsLayoutItem*>(wid))) {
+ int row = static_cast<GridLayoutAttached *>(obj)->row();
+ int column = static_cast<GridLayoutAttached *>(obj)->column();
+ int rowSpan = static_cast<GridLayoutAttached *>(obj)->rowSpan();
+ int columnSpan = static_cast<GridLayoutAttached *>(obj)->columnSpan();
+ if (row == -1 || column == -1) {
+ qWarning() << "Must set row and column for an item in a grid layout";
+ return;
+ }
+ addItem(wid, row, column, rowSpan, columnSpan);
+}
+}
+
+void QGraphicsGridLayoutObject::addLayoutItem(QGraphicsLayoutItem *item)
+{
+//use attached properties
+if (GridLayoutAttached *obj = attachedProperties.value(item)) {
+ int row = obj->row();
+ int column = obj->column();
+ int rowSpan = obj->rowSpan();
+ int columnSpan = obj->columnSpan();
+ Qt::Alignment alignment = obj->alignment();
+ if (row == -1 || column == -1) {
+ qWarning() << "Must set row and column for an item in a grid layout";
+ return;
+ }
+ addItem(item, row, column, rowSpan, columnSpan);
+ if (alignment != -1)
+ setAlignment(item,alignment);
+}
+}
+
+//### is there a better way to do this?
+void QGraphicsGridLayoutObject::clearChildren()
+{
+for (int i = 0; i < count(); ++i)
+ removeAt(i);
+}
+
+qreal QGraphicsGridLayoutObject::spacing() const
+{
+if (verticalSpacing() == horizontalSpacing())
+ return verticalSpacing();
+return -1; //###
+}
+
+QHash<QGraphicsLayoutItem*, GridLayoutAttached*> QGraphicsGridLayoutObject::attachedProperties;
+GridLayoutAttached *QGraphicsGridLayoutObject::qmlAttachedProperties(QObject *obj)
+{
+// ### This is not allowed - you must attach to any object
+if (!qobject_cast<QGraphicsLayoutItem*>(obj))
+ return 0;
+GridLayoutAttached *rv = new GridLayoutAttached(obj);
+attachedProperties.insert(qobject_cast<QGraphicsLayoutItem*>(obj), rv);
+return rv;
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/widgets/graphicslayouts_p.h b/src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h
index 3076af1..f9b9ae8 100644
--- a/src/declarative/widgets/graphicslayouts_p.h
+++ b/src/plugins/qdeclarativemodules/widgets/graphicslayouts_p.h
@@ -69,7 +69,7 @@ class QGraphicsLinearLayoutObject : public QObject, public QGraphicsLinearLayout
Q_OBJECT
Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem)
- Q_PROPERTY(QmlListProperty<QGraphicsLayoutItem> children READ children)
+ Q_PROPERTY(QDeclarativeListProperty<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();
- QmlListProperty<QGraphicsLayoutItem> children() { return QmlListProperty<QGraphicsLayoutItem>(this, 0, children_append, children_count, children_at, children_clear); }
+ QDeclarativeListProperty<QGraphicsLayoutItem> children() { return QDeclarativeListProperty<QGraphicsLayoutItem>(this, 0, children_append, children_count, children_at, children_clear); }
static LinearLayoutAttached *qmlAttachedProperties(QObject *);
@@ -91,19 +91,19 @@ private:
void insertLayoutItem(int, QGraphicsLayoutItem *);
static QHash<QGraphicsLayoutItem*, LinearLayoutAttached*> attachedProperties;
- static void children_append(QmlListProperty<QGraphicsLayoutItem> *prop, QGraphicsLayoutItem *item) {
+ static void children_append(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, QGraphicsLayoutItem *item) {
static_cast<QGraphicsLinearLayoutObject*>(prop->object)->insertLayoutItem(-1, item);
}
- static void children_clear(QmlListProperty<QGraphicsLayoutItem> *prop) {
+ static void children_clear(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
static_cast<QGraphicsLinearLayoutObject*>(prop->object)->clearChildren();
}
- static int children_count(QmlListProperty<QGraphicsLayoutItem> *prop) {
+ static int children_count(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
return static_cast<QGraphicsLinearLayoutObject*>(prop->object)->count();
}
- static QGraphicsLayoutItem *children_at(QmlListProperty<QGraphicsLayoutItem> *prop, int index) {
+ static QGraphicsLayoutItem *children_at(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, int index) {
return static_cast<QGraphicsLinearLayoutObject*>(prop->object)->itemAt(index);
}
};
@@ -114,7 +114,7 @@ class QGraphicsGridLayoutObject : public QObject, public QGraphicsGridLayout
Q_OBJECT
Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem)
- Q_PROPERTY(QmlListProperty<QGraphicsLayoutItem> children READ children)
+ Q_PROPERTY(QDeclarativeListProperty<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)
@@ -123,7 +123,7 @@ public:
QGraphicsGridLayoutObject(QObject * = 0);
~QGraphicsGridLayoutObject();
- QmlListProperty<QGraphicsLayoutItem> children() { return QmlListProperty<QGraphicsLayoutItem>(this, 0, children_append, children_count, children_at, children_clear); }
+ QDeclarativeListProperty<QGraphicsLayoutItem> children() { return QDeclarativeListProperty<QGraphicsLayoutItem>(this, 0, children_append, children_count, children_at, children_clear); }
qreal spacing() const;
@@ -136,23 +136,81 @@ private:
void addLayoutItem(QGraphicsLayoutItem *);
static QHash<QGraphicsLayoutItem*, GridLayoutAttached*> attachedProperties;
- static void children_append(QmlListProperty<QGraphicsLayoutItem> *prop, QGraphicsLayoutItem *item) {
+ static void children_append(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, QGraphicsLayoutItem *item) {
static_cast<QGraphicsGridLayoutObject*>(prop->object)->addLayoutItem(item);
}
- static void children_clear(QmlListProperty<QGraphicsLayoutItem> *prop) {
+ static void children_clear(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
static_cast<QGraphicsGridLayoutObject*>(prop->object)->clearChildren();
}
- static int children_count(QmlListProperty<QGraphicsLayoutItem> *prop) {
+ static int children_count(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
return static_cast<QGraphicsGridLayoutObject*>(prop->object)->count();
}
- static QGraphicsLayoutItem *children_at(QmlListProperty<QGraphicsLayoutItem> *prop, int index) {
+ static QGraphicsLayoutItem *children_at(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, int index) {
return static_cast<QGraphicsGridLayoutObject*>(prop->object)->itemAt(index);
}
};
+class LinearLayoutAttached : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int stretchFactor READ stretchFactor WRITE setStretchFactor NOTIFY stretchChanged)
+ Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
+public:
+ LinearLayoutAttached(QObject *parent);
+
+ int stretchFactor() const { return _stretch; }
+ void setStretchFactor(int f);
+ Qt::Alignment alignment() const { return _alignment; }
+ void setAlignment(Qt::Alignment a);
+
+Q_SIGNALS:
+ void stretchChanged(QGraphicsLayoutItem*,int);
+ void alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment);
+
+private:
+ int _stretch;
+ Qt::Alignment _alignment;
+};
+
+class GridLayoutAttached : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int row READ row WRITE setRow)
+ Q_PROPERTY(int column READ column WRITE setColumn)
+ Q_PROPERTY(int rowSpan READ rowSpan WRITE setRowSpan)
+ Q_PROPERTY(int columnSpan READ columnSpan WRITE setColumnSpan)
+ Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
+public:
+ GridLayoutAttached(QObject *parent);
+
+ int row() const { return _row; }
+ void setRow(int r);
+
+ int column() const { return _column; }
+ void setColumn(int c);
+
+ int rowSpan() const { return _rowspan; }
+ void setRowSpan(int rs);
+
+ int columnSpan() const { return _colspan; }
+ void setColumnSpan(int cs);
+
+ Qt::Alignment alignment() const { return _alignment; }
+ void setAlignment(Qt::Alignment a);
+
+private:
+ int _row;
+ int _column;
+ int _rowspan;
+ int _colspan;
+ Qt::Alignment _alignment;
+};
+
QT_END_NAMESPACE
QML_DECLARE_INTERFACE(QGraphicsLayoutItem)
diff --git a/src/declarative/qml/qmlprivate.cpp b/src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp
index f85e280..062e516 100644
--- a/src/declarative/qml/qmlprivate.cpp
+++ b/src/plugins/qdeclarativemodules/widgets/graphicswidgets.cpp
@@ -38,11 +38,3 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
-#include "qmlprivate.h"
-
-QT_BEGIN_NAMESPACE
-
-QmlPrivate::InstanceType::InstanceType(int) {}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/widgets/graphicswidgets_p.h b/src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h
index 6255d2b..2c2b707 100644
--- a/src/declarative/widgets/graphicswidgets_p.h
+++ b/src/plugins/qdeclarativemodules/widgets/graphicswidgets_p.h
@@ -42,7 +42,7 @@
#ifndef GRAPHICSWIDGETS_H
#define GRAPHICSWIDGETS_H
-#include <qml.h>
+#include <qdeclarative.h>
#include <QtGui/QGraphicsScene>
#include <QtGui/QGraphicsView>
diff --git a/src/declarative/widgets/graphicswidgets.cpp b/src/plugins/qdeclarativemodules/widgets/widgets.cpp
index bb4dc74..ec21cc4 100644
--- a/src/declarative/widgets/graphicswidgets.cpp
+++ b/src/plugins/qdeclarativemodules/widgets/widgets.cpp
@@ -1,10 +1,10 @@
/****************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** 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.
+** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,6 +39,10 @@
**
****************************************************************************/
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtDeclarative/qdeclarative.h>
+
+#include "graphicslayouts_p.h"
#include "graphicswidgets_p.h"
QT_BEGIN_NAMESPACE
@@ -63,15 +67,15 @@ class QGraphicsSceneDeclarativeUI : public QObject
{
Q_OBJECT
- Q_PROPERTY(QmlListProperty<QObject> children READ children)
+ Q_PROPERTY(QDeclarativeListProperty<QObject> children READ children)
Q_CLASSINFO("DefaultProperty", "children")
public:
QGraphicsSceneDeclarativeUI(QObject *other) : QObject(other) {}
- QmlListProperty<QObject> children() { return QmlListProperty<QObject>(this->parent(), 0, children_append); }
+ QDeclarativeListProperty<QObject> children() { return QDeclarativeListProperty<QObject>(this->parent(), 0, children_append); }
private:
- static void children_append(QmlListProperty<QObject> *prop, QObject *o) {
+ static void children_append(QDeclarativeListProperty<QObject> *prop, QObject *o) {
if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o))
static_cast<QGraphicsScene *>(prop->object)->addItem(go);
}
@@ -81,13 +85,13 @@ class QGraphicsWidgetDeclarativeUI : public QObject
{
Q_OBJECT
- Q_PROPERTY(QmlListProperty<QGraphicsItem> children READ children)
+ Q_PROPERTY(QDeclarativeListProperty<QGraphicsItem> children READ children)
Q_PROPERTY(QGraphicsLayout *layout READ layout WRITE setLayout)
Q_CLASSINFO("DefaultProperty", "children")
public:
QGraphicsWidgetDeclarativeUI(QObject *other) : QObject(other) {}
- QmlListProperty<QGraphicsItem> children() { return QmlListProperty<QGraphicsItem>(this, 0, children_append); }
+ QDeclarativeListProperty<QGraphicsItem> children() { return QDeclarativeListProperty<QGraphicsItem>(this, 0, children_append); }
QGraphicsLayout *layout() const { return static_cast<QGraphicsWidget *>(parent())->layout(); }
void setLayout(QGraphicsLayout *lo)
@@ -101,17 +105,34 @@ private:
wid->setParentItem(static_cast<QGraphicsWidget *>(parent()));
}
- static void children_append(QmlListProperty<QGraphicsItem> *prop, QGraphicsItem *i) {
+ static void children_append(QDeclarativeListProperty<QGraphicsItem> *prop, QGraphicsItem *i) {
static_cast<QGraphicsWidgetDeclarativeUI*>(prop->object)->setItemParent(i);
}
};
-QML_DEFINE_EXTENDED_TYPE(Qt,4,6,QGraphicsView,QGraphicsView,QGraphicsViewDeclarativeUI)
-QML_DEFINE_EXTENDED_TYPE(Qt,4,6,QGraphicsScene,QGraphicsScene,QGraphicsSceneDeclarativeUI)
-QML_DEFINE_EXTENDED_TYPE(Qt,4,6,QGraphicsWidget,QGraphicsWidget,QGraphicsWidgetDeclarativeUI)
-
-QML_DEFINE_INTERFACE(QGraphicsItem)
+class QWidgetsQmlModule : public QDeclarativeExtensionPlugin
+{
+ Q_OBJECT
+public:
+ virtual void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.widgets"));
+
+ QML_REGISTER_INTERFACE(QGraphicsLayoutItem);
+ QML_REGISTER_INTERFACE(QGraphicsLayout);
+ qmlRegisterType<QGraphicsLinearLayoutStretchItemObject>(uri,4,6,"QGraphicsLinearLayoutStretchItem");
+ qmlRegisterType<QGraphicsLinearLayoutObject>(uri,4,6,"QGraphicsLinearLayout");
+ qmlRegisterType<QGraphicsGridLayoutObject>(uri,4,6,"QGraphicsGridLayout");
+ qmlRegisterExtendedType<QGraphicsView, QGraphicsViewDeclarativeUI>(uri,4,6,"QGraphicsView");
+ qmlRegisterExtendedType<QGraphicsScene,QGraphicsSceneDeclarativeUI>(uri,4,6,"QGraphicsScene");
+ qmlRegisterExtendedType<QGraphicsWidget,QGraphicsWidgetDeclarativeUI>(uri,4,6,"QGraphicsWidget");
+ QML_REGISTER_INTERFACE(QGraphicsItem);
+ }
+};
QT_END_NAMESPACE
-#include <graphicswidgets.moc>
+#include "widgets.moc"
+
+Q_EXPORT_PLUGIN2(qtwidgetsqmlmodule, QT_PREPEND_NAMESPACE(QWidgetsQmlModule));
+
diff --git a/src/plugins/qdeclarativemodules/widgets/widgets.pro b/src/plugins/qdeclarativemodules/widgets/widgets.pro
new file mode 100644
index 0000000..3ec38da
--- /dev/null
+++ b/src/plugins/qdeclarativemodules/widgets/widgets.pro
@@ -0,0 +1,20 @@
+TARGET = widgets
+include(../../qpluginbase.pri)
+
+QT += declarative
+
+SOURCES += \
+ graphicslayouts.cpp \
+ widgets.cpp
+
+HEADERS += \
+ graphicswidgets_p.h \
+ graphicslayouts_p.h
+
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/Qt/widgets
+target.path = $$[QT_INSTALL_IMPORTS]/Qt/widgets
+
+qmldir.files += $$QT_BUILD_TREE/imports/Qt/widgets/qmldir
+qmldir.path += $$[QT_INSTALL_IMPORTS]/Qt/widgets
+
+INSTALLS += target qmldir
diff --git a/src/plugins/qmlmodules/multimedia/multimedia.pro b/src/plugins/qmlmodules/multimedia/multimedia.pro
deleted file mode 100644
index f04cc14..0000000
--- a/src/plugins/qmlmodules/multimedia/multimedia.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TARGET = multimedia
-include(../../qpluginbase.pri)
-
-QT += multimedia declarative
-
-SOURCES += multimedia.cpp
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmlmodules
-target.path = $$[QT_INSTALL_PLUGINS]/plugins/qmlmodules
-INSTALLS += target
-
diff --git a/src/qbase.pri b/src/qbase.pri
index ef5d9e5..835ed0e 100644
--- a/src/qbase.pri
+++ b/src/qbase.pri
@@ -157,6 +157,7 @@ contains(QT_PRODUCT, OpenSource.*):DEFINES *= QT_OPENSOURCE
DEFINES *= QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARNINGS
contains(QT_CONFIG, qt3support):DEFINES *= QT3_SUPPORT
DEFINES *= QT_MOC_COMPAT #we don't need warnings from calling moc code in our generated code
+DEFINES *= QT_USE_FAST_OPERATOR_PLUS QT_USE_FAST_CONCATENATION
TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #do this towards the end
diff --git a/src/qt3support/text/q3richtext.cpp b/src/qt3support/text/q3richtext.cpp
index 21383bd..8614076 100644
--- a/src/qt3support/text/q3richtext.cpp
+++ b/src/qt3support/text/q3richtext.cpp
@@ -6667,7 +6667,7 @@ Q3TextImage::Q3TextImage(Q3TextDocument *p, const QMap<QString, QString> &attr,
imageName = attr[QLatin1String("source")];
if (!imageName.isEmpty()) {
- imgId = QString::fromLatin1("%1,%2,%3,%4").arg(imageName).arg(width).arg(height).arg((ulong)&factory);
+ imgId = QString::fromLatin1("%1,%2,%3,%4").arg(imageName).arg(width).arg(height).arg((quintptr)&factory);
if (!pixmap_map)
pixmap_map = new QMap<QString, QPixmapInt>;
if (pixmap_map->contains(imgId)) {
diff --git a/src/qt3support/text/q3textedit.cpp b/src/qt3support/text/q3textedit.cpp
index 7f51bea..d4f75ed 100644
--- a/src/qt3support/text/q3textedit.cpp
+++ b/src/qt3support/text/q3textedit.cpp
@@ -6238,7 +6238,7 @@ void Q3TextEdit::optimParseTags(QString * line, int lineNo, int indexOffset)
} else {
tmp = tagStack.isEmpty() ? 0 : tagStack.pop();
if (!tmp) {
- if (((QLatin1Char('/') + cur->tag) == tag->tag) ||
+ if ((QString(QLatin1Char('/') + cur->tag) == tag->tag) ||
(tag->tag == QLatin1String("/font") && cur->tag.left(4) == QLatin1String("font"))) {
// set up the left and parent of this tag
tag->leftTag = cur;
diff --git a/src/qt3support/text/q3textstream.cpp b/src/qt3support/text/q3textstream.cpp
index 41aab4d..8c86c7c 100644
--- a/src/qt3support/text/q3textstream.cpp
+++ b/src/qt3support/text/q3textstream.cpp
@@ -2084,7 +2084,7 @@ Q3TextStream &Q3TextStream::operator<<( void *ptr )
setf( hex, basefield );
setf( showbase );
unsetf( uppercase );
- output_int( I_LONG | I_UNSIGNED, (ulong)ptr, FALSE );
+ output_int( I_LONG | I_UNSIGNED, (quintptr)ptr, FALSE );
flags( f );
return *this;
}
diff --git a/src/qt3support/tools/q3gcache.cpp b/src/qt3support/tools/q3gcache.cpp
index a31f827..ada8330 100644
--- a/src/qt3support/tools/q3gcache.cpp
+++ b/src/qt3support/tools/q3gcache.cpp
@@ -226,7 +226,7 @@ public:
bool remove_ascii(Q3CacheItem *item)
{ return Q3GDict::remove_ascii((const char *)item->key,item); }
bool remove_int(Q3CacheItem *item)
- { return Q3GDict::remove_int((long)item->key,item);}
+ { return Q3GDict::remove_int((quintptr)item->key,item);}
void statistics() { Q3GDict::statistics(); }
@@ -426,7 +426,7 @@ bool Q3GCache::insert_other(const char *key, Q3PtrCollection::Item data,
if (keytype == AsciiKey)
dict->insert_ascii(key, ci);
else
- dict->insert_int((long)key, ci);
+ dict->insert_int((quintptr)key, ci);
tCost += cost;
return true;
}
@@ -486,7 +486,7 @@ Q3PtrCollection::Item Q3GCache::take_other(const char *key)
if (keytype == AsciiKey)
ci = dict->take_ascii(key);
else
- ci = dict->take_int((long)key);
+ ci = dict->take_int((quintptr)key);
Item d;
if (ci) {
d = ci->data;
@@ -563,7 +563,7 @@ Q3PtrCollection::Item Q3GCache::find_string(const QString &key, bool ref) const
Q3PtrCollection::Item Q3GCache::find_other(const char *key, bool ref) const
{
Q3CacheItem *ci = keytype == AsciiKey ? dict->find_ascii(key)
- : dict->find_int((long)key);
+ : dict->find_int((quintptr)key);
#if defined(QT_DEBUG)
lruList->finds++;
#endif
@@ -811,7 +811,7 @@ const char *Q3GCacheIterator::getKeyAscii() const
long Q3GCacheIterator::getKeyInt() const
{
Q3CacheItem *item = it->current();
- return item ? (long)item->key : 0;
+ return item ? (quintptr)item->key : 0;
}
/*!
diff --git a/src/qt3support/tools/q3gdict.cpp b/src/qt3support/tools/q3gdict.cpp
index a968407..e8144fe 100644
--- a/src/qt3support/tools/q3gdict.cpp
+++ b/src/qt3support/tools/q3gdict.cpp
@@ -437,7 +437,7 @@ Q3PtrCollection::Item Q3GDict::look_int(long key, Q3PtrCollection::Item d, int o
Q3PtrCollection::Item Q3GDict::look_ptr(void *key, Q3PtrCollection::Item d, int op)
{
Q3PtrBucket *n;
- int index = (int)((ulong)key % vlen); // simple hash
+ int index = (int)((quintptr)key % vlen); // simple hash
if (op == op_find) { // find
for (n=(Q3PtrBucket*)vec[index]; n;
n=(Q3PtrBucket*)n->getNext()) {
@@ -650,7 +650,7 @@ Q3PtrBucket *Q3GDict::unlink_ptr(void *key, Q3PtrCollection::Item d)
return 0;
Q3PtrBucket *n;
Q3PtrBucket *prev = 0;
- int index = (int)((ulong)key % vlen);
+ int index = (int)((quintptr)key % vlen);
for (n=(Q3PtrBucket *)vec[index]; n; n=(Q3PtrBucket *)n->getNext()) {
bool found = (n->getKey() == key);
if (found && d)
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index f69e537..79294fe 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -854,7 +854,7 @@ inline bool QScriptEnginePrivate::isQObject(JSC::JSValue value)
inline bool QScriptEnginePrivate::isQMetaObject(JSC::JSValue value)
{
#ifndef QT_NO_QOBJECT
- return JSC::asObject(value)->inherits(&QScript::QMetaObjectWrapperObject::info);
+ return isObject(value) && JSC::asObject(value)->inherits(&QScript::QMetaObjectWrapperObject::info);
#else
return false;
#endif
diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp
index b5c85e6..de2be89 100644
--- a/src/sql/drivers/oci/qsql_oci.cpp
+++ b/src/sql/drivers/oci/qsql_oci.cpp
@@ -56,6 +56,12 @@
#include <qvector.h>
#include <qdebug.h>
+// This is needed for oracle oci when compiling with mingw-w64 headers
+#if defined(__MINGW64_VERSION_MAJOR) && defined(_WIN64)
+#define _int64 __int64
+#endif
+
+
#include <oci.h>
#ifdef max
#undef max
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index fab3ab3..9f7d267 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
#define ODBC_CHECK_DRIVER
// newer platform SDKs use SQLLEN instead of SQLINTEGER
-#if defined(WIN32) && (_MSC_VER < 1300)
+#if defined(WIN32) && (_MSC_VER < 1300) && !defined(__MINGW64_VERSION_MAJOR)
# define QSQLLEN SQLINTEGER
# define QSQLULEN SQLUINTEGER
#else