diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-02-24 02:42:00 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-02-24 02:42:00 (GMT) |
commit | 7c76abb0dc4204043bec9b6fa315f9753a7986ae (patch) | |
tree | cee303672cfd138790645e731f2d69472564d4b7 /src/declarative/graphicsitems | |
parent | 4066e60e859853cfe3240245ba05271e79839506 (diff) | |
download | Qt-7c76abb0dc4204043bec9b6fa315f9753a7986ae.zip Qt-7c76abb0dc4204043bec9b6fa315f9753a7986ae.tar.gz Qt-7c76abb0dc4204043bec9b6fa315f9753a7986ae.tar.bz2 |
Change class prefix to from QmlXXX to QDeclarativeXXX, QmlGraphicsXXX to QDeclarativeXXX.
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r-- | src/declarative/graphicsitems/graphicsitems.pri | 168 | ||||
-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) | 90 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeborderimage_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsborderimage_p.h) | 32 | ||||
-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) | 372 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeflickable_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsflickable_p.h) | 40 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeflickable_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsflickable_p_p.h) | 54 | ||||
-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) | 424 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativegridview_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsgridview_p.h) | 70 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeimage.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsimage.cpp) | 68 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeimage_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsimage_p.h) | 24 | ||||
-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) | 62 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeimagebase_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsimagebase_p.h) | 20 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsimagebase_p_p.h) | 16 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitem.cpp (renamed from src/declarative/graphicsitems/qmlgraphicsitem.cpp) | 648 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitem.h (renamed from src/declarative/graphicsitems/qmlgraphicsitem.h) | 110 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitem_p.h | 471 | ||||
-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.cpp | 161 | ||||
-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) | 654 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativelistview_p.h (renamed from src/declarative/graphicsitems/qmlgraphicslistview_p.h) | 92 | ||||
-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) | 170 | ||||
-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) | 330 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeparticles_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsparticles_p.h) | 78 | ||||
-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) | 262 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativepathview_p.h (renamed from src/declarative/graphicsitems/qmlgraphicspathview_p.h) | 44 | ||||
-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) | 200 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativepositioners_p.h (renamed from src/declarative/graphicsitems/qmlgraphicspositioners_p.h) | 76 | ||||
-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) | 94 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativerepeater_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsrepeater_p.h) | 28 | ||||
-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) | 198 | ||||
-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) | 462 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h (renamed from src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h) | 118 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativewebview.cpp (renamed from src/declarative/graphicsitems/qmlgraphicswebview.cpp) | 362 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativewebview_p.h (renamed from src/declarative/graphicsitems/qmlgraphicswebview_p.h) | 66 | ||||
-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.h | 471 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp | 161 |
87 files changed, 4812 insertions, 4812 deletions
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..1f26338 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,11 +158,11 @@ 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; } @@ -189,7 +189,7 @@ void QmlGraphicsBorderImage::setSource(const QUrl &url) if (!lf.isEmpty()) { QFile file(lf); file.open(QIODevice::ReadOnly); - setGridScaledImage(QmlGraphicsGridScaledImage(&file)); + setGridScaledImage(QDeclarativeGridScaledImage(&file)); } else #endif { @@ -199,9 +199,9 @@ void QmlGraphicsBorderImage::setSource(const QUrl &url) this, SLOT(sciRequestFinished())); } } 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); + 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)), @@ -253,9 +253,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 +271,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 +287,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 +303,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,9 +319,9 @@ 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); + 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)), @@ -344,16 +344,16 @@ void QmlGraphicsBorderImage::setGridScaledImage(const QmlGraphicsGridScaledImage } } -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); } else { d->pendingPixmapCache = false; - if (QmlPixmapCache::get(d->url, &d->pix) != QmlPixmapReply::Ready) + if (QDeclarativePixmapCache::get(d->url, &d->pix) != QDeclarativePixmapReply::Ready) d->status = Error; } setImplicitWidth(d->pix.width()); @@ -368,25 +368,25 @@ void QmlGraphicsBorderImage::requestFinished() 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 +395,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..db81fd8 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 }; @@ -85,19 +85,19 @@ Q_SIGNALS: void verticalTileModeChanged(); 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..9f19f53 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,22 +121,22 @@ 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) , 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())); @@ -148,9 +148,9 @@ void QmlGraphicsFlickablePrivate::init() QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(widthChange())); } -void QmlGraphicsFlickablePrivate::flickX(qreal velocity) +void QDeclarativeFlickablePrivate::flickX(qreal velocity) { - Q_Q(QmlGraphicsFlickable); + Q_Q(QDeclarativeFlickable); qreal maxDistance = -1; // -ve velocity means list is moving up if (velocity > 0) { @@ -174,7 +174,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,9 +186,9 @@ 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) { @@ -212,7 +212,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,9 +224,9 @@ void QmlGraphicsFlickablePrivate::flickY(qreal velocity) } } -void QmlGraphicsFlickablePrivate::fixupX() +void QDeclarativeFlickablePrivate::fixupX() { - Q_Q(QmlGraphicsFlickable); + Q_Q(QDeclarativeFlickable); if (!q->xflick() || _moveX.timeLine()) return; @@ -253,19 +253,19 @@ 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; @@ -292,9 +292,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 +335,7 @@ void QmlGraphicsFlickablePrivate::updateBeginningEnd() } /*! - \qmlclass Flickable QmlGraphicsFlickable + \qmlclass Flickable QDeclarativeFlickable \brief The Flickable item provides a surface that can be "flicked". \inherits Item @@ -410,21 +410,21 @@ 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() { } @@ -436,15 +436,15 @@ QmlGraphicsFlickable::~QmlGraphicsFlickable() corner of the Flickable. For example, if you flick an image up 100 pixels, \c yPosition will be 100. */ -qreal QmlGraphicsFlickable::viewportX() const +qreal QDeclarativeFlickable::viewportX() const { - Q_D(const QmlGraphicsFlickable); + Q_D(const QDeclarativeFlickable); return -d->_moveX.value(); } -void QmlGraphicsFlickable::setViewportX(qreal pos) +void QDeclarativeFlickable::setViewportX(qreal pos) { - Q_D(QmlGraphicsFlickable); + Q_D(QDeclarativeFlickable); pos = qRound(pos); d->timeline.reset(d->_moveX); d->vTime = d->timeline.time(); @@ -454,15 +454,15 @@ void QmlGraphicsFlickable::setViewportX(qreal pos) } } -qreal QmlGraphicsFlickable::viewportY() const +qreal QDeclarativeFlickable::viewportY() const { - Q_D(const QmlGraphicsFlickable); + Q_D(const QDeclarativeFlickable); return -d->_moveY.value(); } -void QmlGraphicsFlickable::setViewportY(qreal pos) +void QDeclarativeFlickable::setViewportY(qreal pos) { - Q_D(QmlGraphicsFlickable); + Q_D(QDeclarativeFlickable); pos = qRound(pos); d->timeline.reset(d->_moveY); d->vTime = d->timeline.time(); @@ -481,15 +481,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) { @@ -513,15 +513,15 @@ void QmlGraphicsFlickable::setInteractive(bool interactive) 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 +534,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; } @@ -592,22 +592,22 @@ QmlGraphicsFlickableVisibleArea *QmlGraphicsFlickable::visibleArea() \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 +618,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 +638,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 +665,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 +692,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 +721,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 +760,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 +817,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 +849,7 @@ void QmlGraphicsFlickablePrivate::captureDelayedPress(QGraphicsSceneMouseEvent * delayedPressTimer.start(pressDelay, q); } -void QmlGraphicsFlickablePrivate::clearDelayedPress() +void QDeclarativeFlickablePrivate::clearDelayedPress() { if (delayedPressEvent) { delayedPressTimer.stop(); @@ -858,23 +858,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 +883,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,32 +937,32 @@ 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(); } @@ -976,15 +976,15 @@ QmlListProperty<QmlGraphicsItem> QmlGraphicsFlickable::flickableChildren() 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; @@ -1005,15 +1005,15 @@ void QmlGraphicsFlickable::setOverShoot(bool o) } \endcode */ -qreal QmlGraphicsFlickable::viewportWidth() const +qreal QDeclarativeFlickable::viewportWidth() const { - Q_D(const QmlGraphicsFlickable); + Q_D(const QDeclarativeFlickable); return d->vWidth; } -void QmlGraphicsFlickable::setViewportWidth(qreal w) +void QDeclarativeFlickable::setViewportWidth(qreal w) { - Q_D(QmlGraphicsFlickable); + Q_D(QDeclarativeFlickable); if (d->vWidth == w) return; d->vWidth = w; @@ -1028,9 +1028,9 @@ void QmlGraphicsFlickable::setViewportWidth(qreal w) d->updateBeginningEnd(); } -void QmlGraphicsFlickable::widthChange() +void QDeclarativeFlickable::widthChange() { - Q_D(QmlGraphicsFlickable); + Q_D(QDeclarativeFlickable); if (d->vWidth < 0) { d->viewport->setWidth(width()); emit viewportWidthChanged(); @@ -1038,9 +1038,9 @@ void QmlGraphicsFlickable::widthChange() d->updateBeginningEnd(); } -void QmlGraphicsFlickable::heightChange() +void QDeclarativeFlickable::heightChange() { - Q_D(QmlGraphicsFlickable); + Q_D(QDeclarativeFlickable); if (d->vHeight < 0) { d->viewport->setHeight(height()); emit viewportHeightChanged(); @@ -1048,15 +1048,15 @@ void QmlGraphicsFlickable::heightChange() d->updateBeginningEnd(); } -qreal QmlGraphicsFlickable::viewportHeight() const +qreal QDeclarativeFlickable::viewportHeight() const { - Q_D(const QmlGraphicsFlickable); + Q_D(const QDeclarativeFlickable); return d->vHeight; } -void QmlGraphicsFlickable::setViewportHeight(qreal h) +void QDeclarativeFlickable::setViewportHeight(qreal h) { - Q_D(QmlGraphicsFlickable); + Q_D(QDeclarativeFlickable); if (d->vHeight == h) return; d->vHeight = h; @@ -1071,48 +1071,48 @@ void QmlGraphicsFlickable::setViewportHeight(qreal h) 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 +1147,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 +1162,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 +1176,7 @@ bool QmlGraphicsFlickable::sceneEventFilter(QGraphicsItem *i, QEvent *e) break; } - return QmlGraphicsItem::sceneEventFilter(i, e); + return QDeclarativeItem::sceneEventFilter(i, e); } /*! @@ -1185,15 +1185,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 +1206,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 +1227,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,30 +1244,30 @@ 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 +qreal QDeclarativeFlickable::reportedVelocitySmoothing() const { - Q_D(const QmlGraphicsFlickable); + Q_D(const QDeclarativeFlickable); return d->reportedVelocitySmoothing; } -void QmlGraphicsFlickable::setReportedVelocitySmoothing(qreal reportedVelocitySmoothing) +void QDeclarativeFlickable::setReportedVelocitySmoothing(qreal reportedVelocitySmoothing) { - Q_D(QmlGraphicsFlickable); + Q_D(QDeclarativeFlickable); Q_ASSERT(reportedVelocitySmoothing >= 0); if (reportedVelocitySmoothing == d->reportedVelocitySmoothing) return; @@ -1281,15 +1281,15 @@ void QmlGraphicsFlickable::setReportedVelocitySmoothing(qreal reportedVelocitySm 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 +1297,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 +1314,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..19fb2a9 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,9 +50,9 @@ 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 @@ -80,20 +80,20 @@ 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); @@ -136,7 +136,7 @@ public: bool isAtYEnd() const; bool isAtYBeginning() const; - QmlGraphicsItem *viewport(); + QDeclarativeItem *viewport(); enum FlickDirection { AutoFlickDirection=0x00, HorizontalFlick=0x01, VerticalFlick=0x02, HorizontalAndVerticalFlick=0x03 }; FlickDirection flickDirection() const; @@ -173,7 +173,7 @@ protected: void wheelEvent(QGraphicsSceneWheelEvent *event); void timerEvent(QTimerEvent *event); - QmlGraphicsFlickableVisibleArea *visibleArea(); + QDeclarativeFlickableVisibleArea *visibleArea(); protected Q_SLOTS: virtual void ticked(); @@ -197,17 +197,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..dc3a8a2 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); @@ -86,10 +86,10 @@ public: void setRoundedViewportY(qreal y); 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 +127,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 +162,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 +175,7 @@ signals: void pageChanged(); private: - QmlGraphicsFlickable *flickable; + QDeclarativeFlickable *flickable; qreal m_xPosition; qreal m_widthRatio; qreal m_yPosition; @@ -184,6 +184,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 ab87c03..aae5571 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->viewportY() : q->viewportX(); } void setPosition(qreal pos) { - Q_Q(QmlGraphicsGridView); - if (flow == QmlGraphicsGridView::LeftToRight) + Q_Q(QDeclarativeGridView); + if (flow == QDeclarativeGridView::LeftToRight) q->setViewportY(pos); else q->setViewportX(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 @@ -326,9 +326,9 @@ FxGridItem *QmlGraphicsGridViewPrivate::createItem(int modelIndex) } -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,7 +457,7 @@ void QmlGraphicsGridViewPrivate::refill(qreal from, qreal to, bool doBuffer) deferredRelease = true; } if (changed) { - if (flow == QmlGraphicsGridView::LeftToRight) + if (flow == QDeclarativeGridView::LeftToRight) q->setViewportHeight(endPosition() - startPosition()); else q->setViewportWidth(endPosition() - startPosition()); @@ -467,30 +467,30 @@ void QmlGraphicsGridViewPrivate::refill(qreal from, qreal to, bool doBuffer) 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) + if (flow == QDeclarativeGridView::LeftToRight) q->setViewportHeight(endPosition() - startPosition()); else q->setViewportWidth(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,7 +515,7 @@ void QmlGraphicsGridViewPrivate::layout(bool removed) q->refill(); updateHighlight(); moveReason = Other; - if (flow == QmlGraphicsGridView::LeftToRight) { + if (flow == QDeclarativeGridView::LeftToRight) { q->setViewportHeight(endPosition() - startPosition()); fixupY(); } else { @@ -525,19 +525,19 @@ void QmlGraphicsGridViewPrivate::layout(bool removed) 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(QDeclarativeMetaProperty(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(QDeclarativeMetaProperty(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,27 @@ 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(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 +802,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 +814,15 @@ 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(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); + connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); emit countChanged(); } } @@ -840,32 +840,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 +879,17 @@ 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 (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 +897,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 +916,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 +928,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 +949,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); @@ -984,15 +984,15 @@ void QmlGraphicsGridView::setHighlight(QmlComponent *highlight) } \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 +1012,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); + setFlickDirection(QDeclarativeFlickable::VerticalFlick); } else { setViewportHeight(-1); - setFlickDirection(QmlGraphicsFlickable::HorizontalFlick); + setFlickDirection(QDeclarativeFlickable::HorizontalFlick); } d->clear(); d->updateGrid(); @@ -1044,15 +1044,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 +1064,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 +1088,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 +1105,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 +1122,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 +1174,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 +1194,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 +1224,7 @@ void QmlGraphicsGridView::keyPressEvent(QKeyEvent *event) return; } } - d->moveReason = QmlGraphicsGridViewPrivate::Other; + d->moveReason = QDeclarativeGridViewPrivate::Other; event->ignore(); } @@ -1235,10 +1235,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 +1258,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 +1281,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 +1304,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 +1320,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 +1349,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 +1361,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 +1387,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 +1496,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 +1565,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 +1590,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 +1686,14 @@ void QmlGraphicsGridView::itemsMoved(int from, int to, int count) d->layout(removedBeforeVisible); } -void QmlGraphicsGridView::createdItem(int index, QmlGraphicsItem *item) +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 +1701,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..b36c4aa 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(); @@ -145,8 +145,8 @@ private Q_SLOTS: void itemsRemoved(int index, int count); void itemsMoved(int from, int to, int count); 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 +154,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 +185,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 +204,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..33b38e0 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,27 +121,27 @@ 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())); } -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) +void QDeclarativeImage::setSource(const QUrl &url) { - QmlGraphicsImageBase::setSource(url); + QDeclarativeImageBase::setSource(url); updatePaintedGeometry(); } @@ -154,28 +154,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 +198,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 +215,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,9 +263,9 @@ 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()); @@ -286,9 +286,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 +300,9 @@ 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 *) +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..5b365e7 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; @@ -84,19 +84,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..18053d3 100644 --- a/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -39,57 +39,57 @@ ** ****************************************************************************/ -#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 +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; } @@ -110,9 +110,9 @@ void QmlGraphicsImageBase::setSource(const QUrl &url) 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); + if (status != QDeclarativePixmapReply::Ready && status != QDeclarativePixmapReply::Error) { + QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(this), d->url); d->pendingPixmapCache = true; static int replyDownloadProgress = -1; @@ -121,13 +121,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 +136,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()); @@ -157,13 +157,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) != QDeclarativePixmapReply::Ready) d->status = Error; setImplicitWidth(d->pix.width()); setImplicitHeight(d->pix.height()); @@ -178,9 +178,9 @@ void QmlGraphicsImageBase::requestFinished() 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); diff --git a/src/declarative/graphicsitems/qmlgraphicsimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h index e8bda4c..47be139 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) @@ -59,7 +59,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsImageBase : public QmlGraphicsItem Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) public: - ~QmlGraphicsImageBase(); + ~QDeclarativeImageBase(); enum Status { Null, Ready, Loading, Error }; Status status() const; qreal progress() const; @@ -74,19 +74,19 @@ Q_SIGNALS: void pixmapChanged(); protected: - QmlGraphicsImageBase(QmlGraphicsImageBasePrivate &dd, QmlGraphicsItem *parent); + 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..d540e40 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,27 +53,27 @@ // 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) { } QPixmap pix; - QmlGraphicsImageBase::Status status; + QDeclarativeImageBase::Status status; QUrl url; qreal progress; bool pendingPixmapCache; diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index fce4e36..5dd44fa 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. @@ -1176,130 +1176,130 @@ QmlGraphicsKeysAttached *QmlGraphicsKeysAttached::qmlAttachedProperties(QObject */ /*! - \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(); @@ -1334,12 +1334,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 +1347,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 +1355,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 +1390,12 @@ QmlGraphicsItem *QmlGraphicsItem::parentItem() const */ /*! - \property QmlGraphicsItem::children + \property QDeclarativeItem::children \internal */ /*! - \property QmlGraphicsItem::resources + \property QDeclarativeItem::resources \internal */ @@ -1408,34 +1408,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 +1444,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 +1486,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 +1506,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 +1552,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 +1606,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 +1711,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 +1732,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 +1755,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 +1765,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 +1775,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 +1791,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 +1846,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 +1966,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 +1975,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 +1994,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 +2116,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 +2140,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 +2154,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 +2194,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 +2222,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 +2265,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 +2301,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 +2316,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 +2330,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 +2350,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 +2368,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 +2386,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 +2400,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 +2461,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 +2475,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 +2484,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 +2499,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 +2524,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 +2544,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 +2562,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 +2574,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 +2584,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; @@ -2610,9 +2610,9 @@ void QmlGraphicsItem::setWidth(qreal w) QRectF(x(), y(), oldWidth, height())); } -void QmlGraphicsItem::resetWidth() +void QDeclarativeItem::resetWidth() { - Q_D(QmlGraphicsItem); + Q_D(QDeclarativeItem); d->widthValid = false; setImplicitWidth(implicitWidth()); } @@ -2620,9 +2620,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 +2630,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; @@ -2650,21 +2650,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; @@ -2682,9 +2682,9 @@ void QmlGraphicsItem::setHeight(qreal h) QRectF(x(), y(), width(), oldHeight)); } -void QmlGraphicsItem::resetHeight() +void QDeclarativeItem::resetHeight() { - Q_D(QmlGraphicsItem); + Q_D(QDeclarativeItem); d->heightValid = false; setImplicitHeight(implicitHeight()); } @@ -2692,9 +2692,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 +2702,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; @@ -2722,9 +2722,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 +2737,7 @@ bool QmlGraphicsItem::heightValid() const */ /*! \internal */ -bool QmlGraphicsItem::wantsFocus() const +bool QDeclarativeItem::wantsFocus() const { return focusItem() != 0; } @@ -2751,13 +2751,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 +2769,7 @@ void QmlGraphicsItem::setFocus(bool focus) \reimp \internal */ -void QmlGraphicsItem::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) +void QDeclarativeItem::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) { } @@ -2777,15 +2777,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 +2796,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 +2810,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 +2823,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 +2835,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..d471749 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->viewportY() : q->viewportX(); } void setPosition(qreal pos) { - Q_Q(QmlGraphicsListView); - if (orient == QmlGraphicsListView::Vertical) + Q_Q(QDeclarativeListView); + if (orient == QDeclarativeListView::Vertical) q->setViewportY(pos); else q->setViewportX(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_Q(QDeclarativeListView); + if (orient == QDeclarativeListView::Vertical) { q->setViewportHeight(endPosition() - startPosition() + 1); } else { q->setViewportWidth(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(QDeclarativeMetaProperty(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(QDeclarativeMetaProperty(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,7 +1068,7 @@ 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); @@ -1078,7 +1078,7 @@ void QmlGraphicsListViewPrivate::fixupY() _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); @@ -1092,15 +1092,15 @@ void QmlGraphicsListViewPrivate::fixupY() } } } 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)); } - 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); } - 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 @@ -1200,7 +1200,7 @@ void QmlGraphicsListViewPrivate::flickX(qreal velocity) } 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)); } - 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); } - 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 @@ -1298,7 +1298,7 @@ void QmlGraphicsListViewPrivate::flickY(qreal velocity) } 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,27 @@ 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(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 +1492,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 +1504,15 @@ 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(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); + connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); emit countChanged(); } } @@ -1530,34 +1530,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 +1571,17 @@ 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 (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 +1589,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 +1608,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 +1620,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 +1645,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 +1680,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 +1732,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 +1776,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,18 +1803,18 @@ 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) { + if (d->orient == QDeclarativeListView::Vertical) { setViewportWidth(-1); setFlickDirection(VerticalFlick); } else { @@ -1835,15 +1835,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 +1855,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 +1898,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 +1910,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 +1928,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 +1945,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 +1977,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 +2013,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 +2036,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 +2071,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 +2087,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 +2117,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 +2137,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 +2154,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 +2175,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 +2193,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 +2214,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 +2231,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 +2249,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 +2280,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 +2293,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 +2353,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 +2480,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 +2563,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 +2581,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 +2591,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 +2682,35 @@ void QmlGraphicsListView::itemsMoved(int from, int to, int count) d->layout(); } -void QmlGraphicsListView::createdItem(int index, QmlGraphicsItem *item) +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..1b6276e 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(); @@ -222,21 +222,21 @@ private Q_SLOTS: void itemsRemoved(int index, int count); void itemsMoved(int from, int to, int count); 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 +286,7 @@ Q_SIGNALS: void remove(); public: - QmlGraphicsListView *m_view; + QDeclarativeListView *m_view; bool m_isCurrent; mutable QString m_section; QString m_prevSection; @@ -296,9 +296,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..ab6be1c 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 MouseRegion QDeclarativeMouseRegion \since 4.7 \brief The MouseArea item enables simple mouse handling. \inherits Item @@ -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() { } @@ -305,15 +305,15 @@ QmlGraphicsMouseArea::~QmlGraphicsMouseArea() 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); } } @@ -572,9 +572,9 @@ void QmlGraphicsMouseArea::timerEvent(QTimerEvent *event) \warning This property is not updated if the region moves under the mouse: \e containsMouse will not change. In addition, if hoverEnabled is false, containsMouse will only be valid when the mouse is pressed. */ -bool QmlGraphicsMouseArea::hovered() const +bool QDeclarativeMouseArea::hovered() const { - Q_D(const QmlGraphicsMouseArea); + Q_D(const QDeclarativeMouseArea); return d->hovered; } @@ -582,15 +582,15 @@ bool QmlGraphicsMouseArea::hovered() const \qmlproperty bool MouseArea::pressed This property holds whether the mouse region 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(); @@ -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 93127bc..3c07798 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,9 +184,9 @@ 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. */ /*! @@ -201,21 +201,21 @@ void QmlGraphicsParticleMotionLinear::advance(QmlGraphicsParticle &p, int interv */ /*! - \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::setXAttractor(qreal x) +void QDeclarativeParticleMotionGravity::setXAttractor(qreal x) { if (qFuzzyCompare(x, _xAttr)) return; @@ -223,7 +223,7 @@ void QmlGraphicsParticleMotionGravity::setXAttractor(qreal x) emit xattractorChanged(); } -void QmlGraphicsParticleMotionGravity::setYAttractor(qreal y) +void QDeclarativeParticleMotionGravity::setYAttractor(qreal y) { if (qFuzzyCompare(y, _yAttr)) return; @@ -231,7 +231,7 @@ void QmlGraphicsParticleMotionGravity::setYAttractor(qreal y) emit yattractorChanged(); } -void QmlGraphicsParticleMotionGravity::setAcceleration(qreal accel) +void QDeclarativeParticleMotionGravity::setAcceleration(qreal accel) { qreal scaledAccel = accel/1000000.0; if (qFuzzyCompare(scaledAccel, _accel)) @@ -240,7 +240,7 @@ void QmlGraphicsParticleMotionGravity::setAcceleration(qreal accel) emit accelerationChanged(); } -void QmlGraphicsParticleMotionGravity::advance(QmlGraphicsParticle &p, int interval) +void QDeclarativeParticleMotionGravity::advance(QDeclarativeParticle &p, int interval) { qreal xdiff = p.x - _xAttr; qreal ydiff = p.y - _yAttr; @@ -295,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 qreal QmlGraphicsParticleMotionWander::xvariance - \qmlproperty qreal QmlGraphicsParticleMotionWander::yvariance + \qmlproperty qreal QDeclarativeParticleMotionWander::xvariance + \qmlproperty qreal QDeclarativeParticleMotionWander::yvariance These properties set the amount to wander in the x and y directions. */ /*! - \qmlproperty qreal 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.) { @@ -343,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; @@ -357,13 +357,13 @@ void QmlGraphicsParticleMotionWander::created(QmlGraphicsParticle &p) } } -void QmlGraphicsParticleMotionWander::destroy(QmlGraphicsParticle &p) +void QDeclarativeParticleMotionWander::destroy(QDeclarativeParticle &p) { if (p.data) delete (Data*)p.data; } -void QmlGraphicsParticleMotionWander::setXVariance(qreal var) +void QDeclarativeParticleMotionWander::setXVariance(qreal var) { qreal scaledVar = var / 1000.0; if (qFuzzyCompare(scaledVar, _xvariance)) @@ -372,7 +372,7 @@ void QmlGraphicsParticleMotionWander::setXVariance(qreal var) emit xvarianceChanged(); } -void QmlGraphicsParticleMotionWander::setYVariance(qreal var) +void QDeclarativeParticleMotionWander::setYVariance(qreal var) { qreal scaledVar = var / 1000.0; if (qFuzzyCompare(scaledVar, _yvariance)) @@ -381,7 +381,7 @@ void QmlGraphicsParticleMotionWander::setYVariance(qreal var) emit yvarianceChanged(); } -void QmlGraphicsParticleMotionWander::setPace(qreal pace) +void QDeclarativeParticleMotionWander::setPace(qreal pace) { qreal scaledPace = pace / 1000.0; if (qFuzzyCompare(scaledPace, _pace)) @@ -391,11 +391,11 @@ void QmlGraphicsParticleMotionWander::setPace(qreal pace) } //--------------------------------------------------------------------------- -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; @@ -409,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.) @@ -426,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; @@ -457,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 { @@ -552,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; @@ -566,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; @@ -583,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; } @@ -676,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); } /*! @@ -701,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()) { @@ -738,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 { @@ -768,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; @@ -814,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; @@ -860,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; @@ -901,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; @@ -924,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 @@ -939,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; @@ -965,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; @@ -986,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; @@ -1026,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; @@ -1048,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 @@ -1063,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; @@ -1101,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; @@ -1123,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 @@ -1138,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; @@ -1168,24 +1168,24 @@ 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; @@ -1209,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; @@ -1225,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) @@ -1246,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; @@ -1267,7 +1267,7 @@ void QmlGraphicsParticlesPainter::paint(QPainter *p, const QStyleOptionGraphicsI 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); + const QDeclarativeParticle &particle = d->particles.at(i); pixmapData[i].point = QPointF(particle.x - myX + halfPWidth, particle.y - myY + halfPHeight); pixmapData[i].opacity = particle.opacity; @@ -1280,10 +1280,10 @@ void QmlGraphicsParticlesPainter::paint(QPainter *p, const QStyleOptionGraphicsI qDrawPixmaps(p, 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 8e66335..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,30 +50,30 @@ 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 @@ -81,8 +81,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsParticleMotionGravity : public QmlGraphics 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.0), _yAttr(0.0), _accel(0.00005) {} + QDeclarativeParticleMotionGravity(QObject *parent=0) + : QDeclarativeParticleMotion(parent), _xAttr(0.0), _yAttr(0.0), _accel(0.00005) {} qreal xAttractor() const { return _xAttr; } void setXAttractor(qreal x); @@ -93,7 +93,7 @@ public: 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(); @@ -106,16 +106,16 @@ private: 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; @@ -144,14 +144,14 @@ Q_SIGNALS: 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 @@ -167,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 NOTIFY motionChanged) + 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 &); @@ -210,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 *); @@ -241,17 +241,17 @@ 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..b9e38ef 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,21 @@ 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(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 +216,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 +225,16 @@ 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(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); } d->firstIndex = 0; d->pathOffset = 0; @@ -246,9 +246,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 +258,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 +276,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 +304,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 +333,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 +354,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 +379,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 +407,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 +446,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 +472,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 +489,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 +501,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 +525,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 +535,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 +568,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 +579,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 +598,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 +623,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 +646,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 +659,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 +705,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 +721,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 +745,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 +775,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); + QDeclarativeItem* p = d->items.takeAt(modelIndex); d->model->release(p); } d->snapToCurrent(); @@ -812,28 +812,28 @@ void QmlGraphicsPathView::itemsRemoved(int modelIndex, int count) d->moveOffset.setValue(targetOffset); } -void QmlGraphicsPathView::createdItem(int index, QmlGraphicsItem *item) +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 +872,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 +887,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 +904,7 @@ void QmlGraphicsPathViewPrivate::fixOffset() } } -void QmlGraphicsPathViewPrivate::snapToCurrent() +void QDeclarativePathViewPrivate::snapToCurrent() { if (!model || model->count() <= 0) return; @@ -944,7 +944,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 +963,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 +976,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..d351a4e 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,20 @@ 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 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 fb71495..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,30 +129,30 @@ 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; @@ -160,35 +160,35 @@ void QmlGraphicsBasePositioner::setAdd(QmlTransition *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); @@ -198,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; @@ -213,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; @@ -254,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); @@ -296,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 @@ -403,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; @@ -435,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 @@ -519,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; @@ -547,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 @@ -642,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; @@ -672,7 +672,7 @@ QmlGraphicsGrid::QmlGraphicsGrid(QmlGraphicsItem *parent) : many rows some rows will be of zero width. */ -void QmlGraphicsGrid::setColumns(const int columns) +void QDeclarativeGrid::setColumns(const int columns) { if (columns == _columns) return; @@ -681,7 +681,7 @@ void QmlGraphicsGrid::setColumns(const int columns) emit columnsChanged(); } -void QmlGraphicsGrid::setRows(const int rows) +void QDeclarativeGrid::setRows(const int rows) { if (rows == _rows) return; @@ -690,7 +690,7 @@ void QmlGraphicsGrid::setRows(const int rows) emit rowsChanged(); } -void QmlGraphicsGrid::doPositioning() +void QDeclarativeGrid::doPositioning() { int c=_columns,r=_rows;//Actual number of rows/columns int numVisible = positionedItems.count(); @@ -752,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 @@ -797,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) { } @@ -827,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(); @@ -843,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 2f905e5..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,31 +55,31 @@ 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 NOTIFY moveChanged) - Q_PROPERTY(QmlTransition *add READ add WRITE setAdd NOTIFY addChanged) + 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(); @@ -95,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; }; @@ -107,39 +107,39 @@ 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 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); @@ -157,16 +157,16 @@ protected Q_SLOTS: 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 }; @@ -180,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..ca57d3c 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; @@ -167,15 +167,15 @@ void QmlGraphicsRepeater::setModel(const QVariant &model) 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(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,10 +183,10 @@ 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) { @@ -194,8 +194,8 @@ void QmlGraphicsRepeater::setModel(const QVariant &model) 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(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); + connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); */ regenerate(); emit countChanged(); @@ -210,29 +210,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 +244,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 +256,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 +276,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 +291,9 @@ void QmlGraphicsRepeater::clear() /*! \internal */ -void QmlGraphicsRepeater::regenerate() +void QDeclarativeRepeater::regenerate() { - Q_D(QmlGraphicsRepeater); + Q_D(QDeclarativeRepeater); clear(); @@ -301,7 +301,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 +310,17 @@ 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(); } diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater_p.h b/src/declarative/graphicsitems/qdeclarativerepeater_p.h index 2324916..f58d1b6 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; @@ -90,14 +90,14 @@ private Q_SLOTS: void itemsMoved(int,int,int); 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..307b674 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(); @@ -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 <TextEdit>. + A QDeclarativeTextEdit object can be instantiated in Qml using the tag \c <TextEdit>. */ /*! - 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 97e4a97..bfe8db9 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,97 +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); + 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() { @@ -254,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) { @@ -334,44 +334,44 @@ public: } 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; @@ -384,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()) @@ -398,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() || qstrcmp(name,"modelData")==0)) - return QmlOpenMetaObject::createProperty(name, type); + 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 } @@ -471,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(); @@ -484,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(); @@ -502,60 +502,60 @@ 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; } @@ -563,7 +563,7 @@ QmlGraphicsVisualDataModelData *QmlGraphicsVisualDataModelPrivate::data(QObject //--------------------------------------------------------------------------- /*! - \qmlclass VisualDataModel QmlGraphicsVisualDataModel + \qmlclass VisualDataModel QDeclarativeVisualDataModel \brief The VisualDataModel encapsulates a model and delegate A VisualDataModel encapsulates a model and the delegate that will @@ -595,19 +595,19 @@ QmlGraphicsVisualDataModelData *QmlGraphicsVisualDataModelPrivate::data(QObject \endcode */ -QmlGraphicsVisualDataModel::QmlGraphicsVisualDataModel() -: QmlGraphicsVisualModel(*(new QmlGraphicsVisualDataModelPrivate(0))) +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) @@ -628,15 +628,15 @@ QmlGraphicsVisualDataModel::~QmlGraphicsVisualDataModel() \sa {qmlmodels}{Data Models} */ -QVariant QmlGraphicsVisualDataModel::model() const +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; @@ -667,10 +667,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; } @@ -680,7 +680,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))) { @@ -708,22 +708,22 @@ void QmlGraphicsVisualDataModel::setModel(const QVariant &model) 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()); @@ -741,17 +741,17 @@ void QmlGraphicsVisualDataModel::setModel(const QVariant &model) Here is an example delegate: \snippet doc/src/snippets/declarative/listview/listview.qml 0 */ -QmlComponent *QmlGraphicsVisualDataModel::delegate() const +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) { @@ -781,7 +781,7 @@ void QmlGraphicsVisualDataModel::setDelegate(QmlComponent *delegate) { Q_OBJECT public: - MyModel(QmlContext *ctxt) : QDirModel(), context(ctxt) { + MyModel(QDeclarativeContext *ctxt) : QDirModel(), context(ctxt) { QHash<int,QByteArray> roles = roleNames(); roles.insert(FilePathRole, "path"); setRoleNames(roles); @@ -794,14 +794,14 @@ void QmlGraphicsVisualDataModel::setDelegate(QmlComponent *delegate) context->setContextProperty("myRoot", QVariant::fromValue(root)); } - QmlContext *context; + QDeclarativeContext *context; }; int main(int argc, char ** argv) { QApplication app(argc, argv); - QmlView view; + QDeclarativeView view; MyModel model(view.rootContext()); @@ -839,15 +839,15 @@ void QmlGraphicsVisualDataModel::setDelegate(QmlComponent *delegate) \endcode */ -QModelIndex QmlGraphicsVisualDataModel::rootIndex() const +QModelIndex QDeclarativeVisualDataModel::rootIndex() const { - Q_D(const QmlGraphicsVisualDataModel); + Q_D(const QDeclarativeVisualDataModel); return d->m_root; } -void QmlGraphicsVisualDataModel::setRootIndex(const QModelIndex &root) +void QDeclarativeVisualDataModel::setRootIndex(const QModelIndex &root) { - Q_D(QmlGraphicsVisualDataModel); + Q_D(QDeclarativeVisualDataModel); if (d->m_root != root) { int oldCount = d->modelCount(); d->m_root = root; @@ -862,27 +862,27 @@ void QmlGraphicsVisualDataModel::setRootIndex(const QModelIndex &root) } } -QString QmlGraphicsVisualDataModel::part() const +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); @@ -891,9 +891,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); @@ -901,9 +901,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; @@ -913,7 +913,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); @@ -927,17 +927,17 @@ QmlGraphicsVisualDataModel::ReleaseFlags QmlGraphicsVisualDataModel::release(Qml return stat; } -QObject *QmlGraphicsVisualDataModel::parts() +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); @@ -945,10 +945,10 @@ QmlGraphicsItem *QmlGraphicsVisualDataModel::item(int index, const QByteArray &v 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); @@ -958,7 +958,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; @@ -966,27 +966,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; @@ -995,9 +995,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); @@ -1011,13 +1011,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 }; @@ -1041,9 +1041,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); @@ -1053,18 +1053,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); + 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); + QDeclarativeExpression e(ctxt, expression, objectContext); value = e.value(); delete data; delete ctxt; @@ -1073,22 +1073,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); @@ -1106,22 +1106,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; @@ -1133,25 +1133,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; @@ -1163,39 +1163,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; @@ -1206,19 +1206,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()) { @@ -1230,27 +1230,27 @@ 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_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 7dc41a8..76c8994 100644 --- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#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> @@ -60,107 +60,107 @@ 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 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); @@ -170,20 +170,20 @@ public: 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: @@ -195,21 +195,21 @@ 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_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()); } @@ -222,10 +222,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; @@ -237,17 +237,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 92ec4c4..61b5b56 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,24 @@ 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); setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::LeftButton); @@ -184,30 +184,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 +219,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 +236,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 +264,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 +291,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 +327,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 +347,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 +369,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 +410,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,41 +446,41 @@ 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; @@ -492,14 +492,14 @@ void QmlGraphicsWebView::setRenderingEnabled(bool enabled) } -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()) { @@ -522,7 +522,7 @@ QMouseEvent *QmlGraphicsWebView::sceneMouseEventToMouseEvent(QGraphicsSceneMouse return me; } -QMouseEvent *QmlGraphicsWebView::sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *e) +QMouseEvent *QDeclarativeWebView::sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *e) { QEvent::Type t = QEvent::MouseMove; @@ -539,7 +539,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()); @@ -561,9 +561,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(); @@ -590,24 +590,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); @@ -636,13 +636,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); @@ -660,15 +660,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(); @@ -676,9 +676,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()) { @@ -703,10 +703,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); @@ -719,24 +719,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); @@ -748,7 +748,7 @@ bool QmlGraphicsWebView::sceneEvent(QEvent *event) } } } - return QmlGraphicsPaintedItem::sceneEvent(event); + return QDeclarativePaintedItem::sceneEvent(event); } @@ -756,7 +756,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); } @@ -765,7 +765,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); } @@ -774,7 +774,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); } @@ -783,7 +783,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); } @@ -794,7 +794,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(); } @@ -805,7 +805,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)); } @@ -815,9 +815,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; @@ -830,7 +830,7 @@ void QmlGraphicsWebView::setZoomFactor(qreal factor) emit zoomFactorChanged(); } -qreal QmlGraphicsWebView::zoomFactor() const +qreal QDeclarativeWebView::zoomFactor() const { return page()->mainFrame()->zoomFactor(); } @@ -841,32 +841,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. @@ -927,16 +927,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) { @@ -993,14 +993,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(); } @@ -1017,9 +1017,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())); @@ -1033,9 +1033,9 @@ void QmlGraphicsWebView::setHtml(const QString &html, const QUrl &baseUrl) 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())); @@ -1050,19 +1050,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) @@ -1070,17 +1070,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 { @@ -1114,15 +1114,15 @@ 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); + Q_D(QDeclarativeWebView); if (newWindow == d->newWindowComponent) return; d->newWindowComponent = newWindow; @@ -1137,15 +1137,15 @@ 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); + Q_D(QDeclarativeWebView); if (parent == d->newWindowParent) return; if (d->newWindowParent && parent) { @@ -1164,7 +1164,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(); @@ -1180,26 +1180,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) @@ -1207,13 +1207,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) @@ -1221,7 +1221,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) @@ -1253,17 +1253,17 @@ public: } return dsp; } - QWidget_Dummy_Plugin(const QUrl& url, QmlGraphicsWebView *view, const QStringList ¶mNames, const QStringList ¶mValues) : + QWidget_Dummy_Plugin(const QUrl& url, QDeclarativeWebView *view, const QStringList ¶mNames, const QStringList ¶mValues) : 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(); } @@ -1276,7 +1276,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) { @@ -1305,26 +1305,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 ¶mNames, const QStringList ¶mValues) +QObject *QDeclarativeWebPage::createPlugin(const QString &, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues) { 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; @@ -1332,4 +1332,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 ca63be9..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 ¶mNames, const QStringList ¶mValues); 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 @@ -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 NOTIFY newWindowComponentChanged) - Q_PROPERTY(QmlGraphicsItem* newWindowParent READ newWindowParent WRITE setNewWindowParent NOTIFY newWindowParentChanged) + 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 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(); @@ -239,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) { } @@ -278,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 121026e..0000000 --- a/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp +++ /dev/null @@ -1,161 +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" - -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 -} |