summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-05-19 10:45:52 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-05-19 10:45:52 +0200
commit9547ade2b9cd7c792d98bf06ca8de89c9e560396 (patch)
treeaa43069092eaaa2078c21c86347c28e3ac41c574 /src
parentfa608f9094591c146f9170ba485ea2e4d7827dca (diff)
parentcbb28a77cb295b74d47a5a1923357dd6557bea84 (diff)
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/webkit/.tag2
-rw-r--r--src/3rdparty/webkit/ChangeLog9
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/ChangeLog35
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h9
-rw-r--r--src/3rdparty/webkit/VERSION2
-rw-r--r--src/3rdparty/webkit/WebCore/ChangeLog305
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.gypi18
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.pri4
-rw-r--r--src/3rdparty/webkit/WebCore/WebCore.pro8
-rw-r--r--src/3rdparty/webkit/WebCore/css/StyleMedia.cpp (renamed from src/3rdparty/webkit/WebCore/css/Media.cpp)8
-rw-r--r--src/3rdparty/webkit/WebCore/css/StyleMedia.h (renamed from src/3rdparty/webkit/WebCore/css/Media.h)17
-rw-r--r--src/3rdparty/webkit/WebCore/css/StyleMedia.idl (renamed from src/3rdparty/webkit/WebCore/css/Media.idl)3
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp10
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h2
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSMedia.cpp201
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStyleMedia.cpp201
-rw-r--r--src/3rdparty/webkit/WebCore/generated/JSStyleMedia.h (renamed from src/3rdparty/webkit/WebCore/generated/JSMedia.h)30
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp10
-rw-r--r--src/3rdparty/webkit/WebCore/page/AbstractView.idl2
-rw-r--r--src/3rdparty/webkit/WebCore/page/DOMWindow.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/page/DOMWindow.h8
-rw-r--r--src/3rdparty/webkit/WebCore/page/DOMWindow.idl2
-rw-r--r--src/3rdparty/webkit/WebCore/page/EventHandler.cpp13
-rw-r--r--src/3rdparty/webkit/WebCore/page/FrameView.h2
-rw-r--r--src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp13
-rw-r--r--src/3rdparty/webkit/WebCore/page/SpatialNavigation.h5
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ScrollView.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/platform/ScrollView.h3
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp16
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp8
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp29
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.h11
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp13
-rw-r--r--src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.h1
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/TemporaryLinkStubsQt.cpp (renamed from src/3rdparty/webkit/WebCore/platform/qt/TemporaryLinkStubs.cpp)0
-rw-r--r--src/3rdparty/webkit/WebKit.pri2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp22
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp10
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp20
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp10
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebhistoryinterface.cpp23
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp45
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebkitversion.cpp66
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp216
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpluginfactory.cpp36
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp24
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp128
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog157
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp6
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc109
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp56
-rw-r--r--src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp8
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp40
-rw-r--r--src/corelib/animation/qabstractanimation.cpp3
-rw-r--r--src/corelib/io/qfilesystemwatcher_symbian.cpp63
-rw-r--r--src/corelib/io/qfilesystemwatcher_symbian_p.h6
-rw-r--r--src/corelib/io/qurl.cpp6
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp56
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp13
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h7
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp2
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian_p.h1
-rw-r--r--src/corelib/tools/qchar.cpp31
-rw-r--r--src/corelib/tools/qchar.h9
-rw-r--r--src/corelib/tools/qdatetime.cpp44
-rw-r--r--src/corelib/tools/qdatetime.h1
-rw-r--r--src/corelib/tools/qlocale.cpp12
-rw-r--r--src/corelib/tools/qlocale_p.h18
-rw-r--r--src/corelib/tools/qlocale_symbian.cpp53
-rw-r--r--src/corelib/tools/qmap.h20
-rw-r--r--src/dbus/qdbusinternalfilters.cpp2
-rw-r--r--src/dbus/qdbusxmlgenerator.cpp2
-rw-r--r--src/declarative/QmlChanges.txt19
-rw-r--r--src/declarative/declarative.pro4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanchors.cpp1
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp50
-rw-r--r--src/declarative/graphicsitems/qdeclarativeevents.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp253
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable_p.h35
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable_p_p.h10
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflipable.cpp17
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp117
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp224
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp575
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.h48
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem_p.h76
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp128
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp148
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader_p.h10
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader_p_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp68
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea_p.h8
-rw-r--r--src/declarative/graphicsitems/qdeclarativepainteditem.cpp31
-rw-r--r--src/declarative/graphicsitems/qdeclarativepainteditem_p.h5
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath.cpp35
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath_p.h1
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath_p_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp111
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview_p.h5
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners.cpp121
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners_p.h6
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners_p_p.h5
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp93
-rw-r--r--src/declarative/graphicsitems/qdeclarativerepeater.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp96
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp91
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit_p_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp142
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput_p_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp88
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h6
-rw-r--r--src/declarative/qml/qdeclarativebinding.cpp21
-rw-r--r--src/declarative/qml/qdeclarativebinding_p.h2
-rw-r--r--src/declarative/qml/qdeclarativecompiledbindings.cpp33
-rw-r--r--src/declarative/qml/qdeclarativecompiledbindings_p.h6
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp86
-rw-r--r--src/declarative/qml/qdeclarativecompiler_p.h4
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp112
-rw-r--r--src/declarative/qml/qdeclarativecomponent.h7
-rw-r--r--src/declarative/qml/qdeclarativecomponent_p.h3
-rw-r--r--src/declarative/qml/qdeclarativecompositetypedata_p.h2
-rw-r--r--src/declarative/qml/qdeclarativecompositetypemanager.cpp77
-rw-r--r--src/declarative/qml/qdeclarativecontext.cpp21
-rw-r--r--src/declarative/qml/qdeclarativecontext.h2
-rw-r--r--src/declarative/qml/qdeclarativecontext_p.h1
-rw-r--r--src/declarative/qml/qdeclarativecontextscriptclass.cpp46
-rw-r--r--src/declarative/qml/qdeclarativecontextscriptclass_p.h4
-rw-r--r--src/declarative/qml/qdeclarativedata_p.h10
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp946
-rw-r--r--src/declarative/qml/qdeclarativeengine_p.h109
-rw-r--r--src/declarative/qml/qdeclarativeexpression.cpp4
-rw-r--r--src/declarative/qml/qdeclarativeextensionplugin.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeglobalscriptclass.cpp20
-rw-r--r--src/declarative/qml/qdeclarativeglobalscriptclass_p.h1
-rw-r--r--src/declarative/qml/qdeclarativeguard_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeimport.cpp925
-rw-r--r--src/declarative/qml/qdeclarativeimport_p.h139
-rw-r--r--src/declarative/qml/qdeclarativeinclude.cpp316
-rw-r--r--src/declarative/qml/qdeclarativeinclude_p.h115
-rw-r--r--src/declarative/qml/qdeclarativeinfo.cpp3
-rw-r--r--src/declarative/qml/qdeclarativeinstruction.cpp3
-rw-r--r--src/declarative/qml/qdeclarativeinstruction_p.h1
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp13
-rw-r--r--src/declarative/qml/qdeclarativeparser_p.h3
-rw-r--r--src/declarative/qml/qdeclarativeparserstatus.cpp10
-rw-r--r--src/declarative/qml/qdeclarativeparserstatus.h4
-rw-r--r--src/declarative/qml/qdeclarativepropertycache.cpp31
-rw-r--r--src/declarative/qml/qdeclarativepropertycache_p.h1
-rw-r--r--src/declarative/qml/qdeclarativepropertyvaluesource.cpp3
-rw-r--r--src/declarative/qml/qdeclarativescriptparser.cpp75
-rw-r--r--src/declarative/qml/qdeclarativescriptstring.h2
-rw-r--r--src/declarative/qml/qdeclarativestringconverters_p.h2
-rw-r--r--src/declarative/qml/qdeclarativevaluetype.cpp220
-rw-r--r--src/declarative/qml/qdeclarativevaluetype_p.h147
-rw-r--r--src/declarative/qml/qdeclarativevme.cpp11
-rw-r--r--src/declarative/qml/qdeclarativevmemetaobject.cpp3
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript.cpp35
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript_p.h5
-rw-r--r--src/declarative/qml/qdeclarativexmlhttprequest.cpp27
-rw-r--r--src/declarative/qml/qml.pri4
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp154
-rw-r--r--src/declarative/util/qdeclarativeanimation_p.h1
-rw-r--r--src/declarative/util/qdeclarativebehavior.cpp23
-rw-r--r--src/declarative/util/qdeclarativebehavior_p.h3
-rw-r--r--src/declarative/util/qdeclarativebind.cpp9
-rw-r--r--src/declarative/util/qdeclarativebind_p.h1
-rw-r--r--src/declarative/util/qdeclarativeconnections.cpp50
-rw-r--r--src/declarative/util/qdeclarativeconnections_p.h5
-rw-r--r--src/declarative/util/qdeclarativefontloader.cpp9
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp38
-rw-r--r--src/declarative/util/qdeclarativelistmodelworkeragent_p.h2
-rw-r--r--src/declarative/util/qdeclarativeopenmetaobject.cpp2
-rw-r--r--src/declarative/util/qdeclarativepackage.cpp4
-rw-r--r--src/declarative/util/qdeclarativepixmapcache.cpp6
-rw-r--r--src/declarative/util/qdeclarativepropertychanges.cpp32
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation.cpp6
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation_p.h2
-rw-r--r--src/declarative/util/qdeclarativesmoothedfollow.cpp6
-rw-r--r--src/declarative/util/qdeclarativesmoothedfollow_p.h2
-rw-r--r--src/declarative/util/qdeclarativespringfollow.cpp2
-rw-r--r--src/declarative/util/qdeclarativestate.cpp4
-rw-r--r--src/declarative/util/qdeclarativestate_p.h1
-rw-r--r--src/declarative/util/qdeclarativestategroup.cpp10
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp105
-rw-r--r--src/declarative/util/qdeclarativestateoperations_p.h3
-rw-r--r--src/declarative/util/qdeclarativesystempalette.cpp1
-rw-r--r--src/declarative/util/qdeclarativetimeline.cpp15
-rw-r--r--src/declarative/util/qdeclarativetransition.cpp4
-rw-r--r--src/declarative/util/qdeclarativetransitionmanager_p_p.h2
-rw-r--r--src/declarative/util/qdeclarativeview.cpp61
-rw-r--r--src/declarative/util/qdeclarativeview.h3
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp99
-rw-r--r--src/gui/dialogs/qcolordialog_mac.mm20
-rw-r--r--src/gui/dialogs/qfiledialog_mac.mm32
-rw-r--r--src/gui/dialogs/qfileinfogatherer.cpp15
-rw-r--r--src/gui/dialogs/qfileinfogatherer_p.h3
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm16
-rw-r--r--src/gui/dialogs/qmessagebox.h2
-rw-r--r--src/gui/dialogs/qnspanelproxy_mac.mm24
-rw-r--r--src/gui/dialogs/qpagesetupdialog_mac.mm8
-rw-r--r--src/gui/dialogs/qprintdialog_mac.mm8
-rw-r--r--src/gui/dialogs/qwizard_win.cpp3
-rw-r--r--src/gui/egl/qegl_x11.cpp5
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp27
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp8
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp14
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.cpp9
-rw-r--r--src/gui/image/qicon.cpp25
-rw-r--r--src/gui/image/qpixmapcache.cpp43
-rw-r--r--src/gui/image/qpixmapcache.h10
-rw-r--r--src/gui/image/qpixmapcache_p.h2
-rw-r--r--src/gui/kernel/qapplication.cpp17
-rw-r--r--src/gui/kernel/qapplication_win.cpp2
-rw-r--r--src/gui/kernel/qcocoawindowdelegate_mac.mm21
-rw-r--r--src/gui/kernel/qdnd_qws.cpp4
-rw-r--r--src/gui/kernel/qdnd_x11.cpp6
-rw-r--r--src/gui/kernel/qgesturemanager.cpp33
-rw-r--r--src/gui/kernel/qgesturemanager_p.h2
-rw-r--r--src/gui/kernel/qsound_mac.mm6
-rw-r--r--src/gui/kernel/qt_mac_p.h2
-rw-r--r--src/gui/kernel/qwidget.cpp31
-rw-r--r--src/gui/kernel/qwidget_mac.mm30
-rw-r--r--src/gui/kernel/qwidget_p.h8
-rw-r--r--src/gui/kernel/qwidget_win.cpp7
-rw-r--r--src/gui/kernel/qwidget_wince.cpp4
-rw-r--r--src/gui/kernel/qwidget_x11.cpp2
-rw-r--r--src/gui/painting/qbezier.cpp228
-rw-r--r--src/gui/painting/qbezier_p.h7
-rw-r--r--src/gui/painting/qdatabuffer_p.h19
-rw-r--r--src/gui/painting/qdrawutil.cpp14
-rw-r--r--src/gui/painting/qoutlinemapper.cpp3
-rw-r--r--src/gui/painting/qoutlinemapper_p.h11
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp52
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h3
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp2
-rw-r--r--src/gui/painting/qpaintengineex.cpp5
-rw-r--r--src/gui/painting/qpathclipper.cpp23
-rw-r--r--src/gui/painting/qpathclipper_p.h7
-rw-r--r--src/gui/painting/qpolygonclipper_p.h3
-rw-r--r--src/gui/painting/qprintengine_pdf.cpp46
-rw-r--r--src/gui/painting/qprintengine_pdf_p.h1
-rw-r--r--src/gui/painting/qrasterizer.cpp8
-rw-r--r--src/gui/painting/qstroker.cpp23
-rw-r--r--src/gui/painting/qstroker_p.h18
-rw-r--r--src/gui/painting/qtransform.cpp9
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp6
-rw-r--r--src/gui/styles/qgtkpainter.cpp9
-rw-r--r--src/gui/styles/qgtkstyle.cpp45
-rw-r--r--src/gui/styles/qs60style_s60.cpp14
-rw-r--r--src/gui/styles/qstylehelper.cpp62
-rw-r--r--src/gui/styles/qstylehelper_p.h33
-rw-r--r--src/gui/styles/styles.pri7
-rw-r--r--src/gui/text/qtextdocument.cpp2
-rw-r--r--src/gui/util/qcompleter.cpp21
-rw-r--r--src/gui/util/qsystemtrayicon_mac.mm37
-rw-r--r--src/gui/widgets/qabstractslider.cpp8
-rw-r--r--src/gui/widgets/qcocoatoolbardelegate_mac.mm2
-rw-r--r--src/gui/widgets/qcocoatoolbardelegate_mac_p.h2
-rw-r--r--src/gui/widgets/qdockwidget.cpp5
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm2
-rw-r--r--src/imports/gestures/qdeclarativegesturearea.cpp2
-rw-r--r--src/imports/imports.pro2
-rw-r--r--src/imports/multimedia/qdeclarativeaudio.cpp7
-rw-r--r--src/imports/multimedia/qdeclarativeaudio_p.h1
-rw-r--r--src/imports/webkit/qdeclarativewebview.cpp277
-rw-r--r--src/imports/webkit/qdeclarativewebview_p.h32
-rw-r--r--src/imports/widgets/graphicslayouts.cpp366
-rw-r--r--src/imports/widgets/graphicslayouts_p.h303
-rw-r--r--src/imports/widgets/qmldir1
-rw-r--r--src/imports/widgets/widgets.cpp71
-rw-r--r--src/imports/widgets/widgets.pro30
-rw-r--r--src/multimedia/mediaservices/mediaservices.pro2
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp11
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h2
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp7
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp13
-rw-r--r--src/network/access/qhttpnetworkrequest_p.h4
-rw-r--r--src/network/access/qnetworkaccessbackend.cpp5
-rw-r--r--src/network/access/qnetworkaccessbackend_p.h1
-rw-r--r--src/network/access/qnetworkaccesshttpbackend.cpp13
-rw-r--r--src/network/access/qnetworkaccesshttpbackend_p.h1
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp27
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp8
-rw-r--r--src/network/access/qnetworkrequest.cpp52
-rw-r--r--src/network/access/qnetworkrequest.h7
-rw-r--r--src/network/kernel/qhostinfo.cpp29
-rw-r--r--src/network/kernel/qhostinfo_p.h4
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp3
-rw-r--r--src/network/socket/qtcpserver.cpp18
-rw-r--r--src/network/socket/qtcpserver.h1
-rw-r--r--src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h4
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h1
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp30
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qtriangulatingstroker.cpp5
-rw-r--r--src/opengl/gl2paintengineex/qtriangulatingstroker_p.h1
-rw-r--r--src/opengl/gl2paintengineex/qtriangulator.cpp12
-rw-r--r--src/opengl/qgl.cpp79
-rw-r--r--src/opengl/qgl.h1
-rw-r--r--src/opengl/qgl_egl.cpp20
-rw-r--r--src/opengl/qgl_p.h8
-rw-r--r--src/opengl/qglpaintdevice.cpp5
-rw-r--r--src/opengl/qpaintengine_opengl.cpp5
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp405
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.h15
-rw-r--r--src/plugins/bearer/symbian/symbian.pro1
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp248
-rw-r--r--src/plugins/bearer/symbian/symbianengine.h27
-rw-r--r--src/plugins/imageformats/gif/qgifhandler.cpp7
-rw-r--r--src/plugins/mediaservices/mediaservices.pro4
-rw-r--r--src/plugins/mediaservices/symbian/mediaplayer/s60audioplayersession.h2
-rw-r--r--src/plugins/mediaservices/symbian/mediaplayer/s60videoplayersession.h3
-rw-r--r--src/s60installs/bwins/QtCoreu.def2
-rw-r--r--src/s60installs/bwins/QtDeclarativeu.def71
-rw-r--r--src/s60installs/bwins/QtGuiu.def8
-rw-r--r--src/s60installs/eabi/QtCoreu.def2
-rw-r--r--src/s60installs/eabi/QtDeclarativeu.def88
-rw-r--r--src/s60installs/eabi/QtGuiu.def7
-rw-r--r--src/s60installs/s60installs.pro7
-rw-r--r--src/src.pro20
333 files changed, 8004 insertions, 4865 deletions
diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag
index 75fc5e7fa7..9d754a4cf6 100644
--- a/src/3rdparty/webkit/.tag
+++ b/src/3rdparty/webkit/.tag
@@ -1 +1 @@
-b4aa5e1ddc41edab895132aba3cc66d9d7129444
+3d774b9df1f963452b1cfe34f9fafad0d399372a
diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog
index 70eff7d4d1..a0cf2d0af2 100644
--- a/src/3rdparty/webkit/ChangeLog
+++ b/src/3rdparty/webkit/ChangeLog
@@ -1,3 +1,12 @@
+2010-05-12 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Detect debug mode consistently
+ https://bugs.webkit.org/show_bug.cgi?id=38863
+
+ * WebKit.pri:
+
2010-04-09 Simon Hausmann <simon.hausmann@nokia.com>
Unreviewed crash fix.
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
index 1439ae0db5..a3e6586c2a 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
@@ -1,12 +1,35 @@
-2010-05-02 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+2010-05-12 Laszlo Gombos <laszlo.1.gombos@nokia.com>
- Reviewed by Eric Seidel.
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Detect debug mode consistently
+ https://bugs.webkit.org/show_bug.cgi?id=38863
+
+ * JavaScriptCore.pri:
+ * JavaScriptCore.pro:
+ * jsc.pro:
+ * qt/api/QtScript.pro:
+
+2010-05-10 Laszlo Gombos <laszlo.1.gombos@nokia.com>
- [Qt] Enable JIT for QtWebKit on Symbian
- https://bugs.webkit.org/show_bug.cgi?id=38339
+ Reviewed by Darin Adler.
+
+ [Qt] Disable JIT support for mingw-w64
+ https://bugs.webkit.org/show_bug.cgi?id=38747
+
+ Disale JIT for mingw-w64 as it is reportedly
+ unstable.
+
+ Thanks for Vanboxem Rruben for the investigation.
+
+ * wtf/Platform.h:
+
+2010-05-06 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
- JIT on Symbian has been stable for quite some time, it
- is time to turn it on by default.
+ [Qt] Enable YARR_JIT for X86 Mac for QtWebKit
+ https://bugs.webkit.org/show_bug.cgi?id=38668
* wtf/Platform.h:
diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri
index b7f6665838..b3f74a9dd4 100644
--- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri
+++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri
@@ -1,6 +1,6 @@
# JavaScriptCore - Qt4 build info
VPATH += $$PWD
-CONFIG(debug, debug|release) {
+!CONFIG(release, debug|release) {
# Output in JavaScriptCore/<config>
JAVASCRIPTCORE_DESTDIR = debug
# Use a config-specific target to prevent parallel builds file clashes on Mac
diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
index 8e086b3713..22fcc91130 100644
--- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
+++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
@@ -21,7 +21,7 @@ CONFIG(QTDIR_build) {
# This line was extracted from qbase.pri instead of including the whole file
win32|mac:!macx-xcode:CONFIG += debug_and_release
} else {
- CONFIG(debug, debug|release) {
+ !CONFIG(release, debug|release) {
OBJECTS_DIR = obj/debug
} else { # Release
OBJECTS_DIR = obj/release
diff --git a/src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro b/src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro
index 88629c79f6..3c2691e06e 100644
--- a/src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro
+++ b/src/3rdparty/webkit/JavaScriptCore/qt/api/QtScript.pro
@@ -7,7 +7,7 @@ INCLUDEPATH += $$PWD
CONFIG += building-libs
isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = ../../generated
-CONFIG(debug, debug|release) {
+!CONFIG(release, debug|release) {
OBJECTS_DIR = obj/debug
} else { # Release
OBJECTS_DIR = obj/release
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
index c582905dbb..fac477e886 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
@@ -927,8 +927,6 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#elif CPU(X86) && OS(WINDOWS) && COMPILER(MINGW) && GCC_VERSION >= 40100
#define ENABLE_JIT 1
#define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
-#elif CPU(X86_64) && OS(WINDOWS) && COMPILER(MINGW64) && GCC_VERSION >= 40100
- #define ENABLE_JIT 1
#elif CPU(X86) && OS(WINDOWS) && COMPILER(MSVC)
#define ENABLE_JIT 1
#define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
@@ -939,8 +937,6 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#define ENABLE_JIT 1
#elif CPU(ARM_TRADITIONAL) && OS(LINUX)
#define ENABLE_JIT 1
-#elif CPU(ARM_TRADITIONAL) && OS(SYMBIAN) && COMPILER(RVCT)
- #define ENABLE_JIT 1
#endif
#endif /* PLATFORM(QT) */
@@ -1010,8 +1006,9 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
|| (CPU(X86) && OS(LINUX) && GCC_VERSION >= 40100) \
|| (CPU(X86_64) && OS(LINUX) && GCC_VERSION >= 40100) \
|| (CPU(ARM_TRADITIONAL) && OS(LINUX)) \
- || (CPU(ARM_TRADITIONAL) && OS(SYMBIAN) && COMPILER(RVCT)) \
- || (CPU(MIPS) && OS(LINUX))
+ || (CPU(MIPS) && OS(LINUX)) \
+ || (CPU(X86) && OS(DARWIN)) \
+ || (CPU(X86_64) && OS(DARWIN))
#define ENABLE_YARR 1
#define ENABLE_YARR_JIT 1
#endif
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index 98debf6eda..a440c0388e 100644
--- a/src/3rdparty/webkit/VERSION
+++ b/src/3rdparty/webkit/VERSION
@@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from
and has the sha1 checksum
- 07b60cf799680fcfb7785ee88e14f8030a5dbfa2
+ 5cf023650a8da206a8cf3130e9d4820b95e1bc7c
diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog
index 6617b6617b..93d00e4f01 100644
--- a/src/3rdparty/webkit/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/WebCore/ChangeLog
@@ -1,3 +1,308 @@
+2010-05-12 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Detect debug mode consistently
+ https://bugs.webkit.org/show_bug.cgi?id=38863
+
+ No new tests as there is no new functionality.
+
+ * WebCore.pro:
+
+2010-05-14 Andreas Kling <andreas.kling@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Ignore invalid values for various CanvasRenderingContext2D properties
+ (lineWidth, miterLimit, shadowOffsetX, shadowOffsetY and shadowBlur)
+
+ https://bugs.webkit.org/show_bug.cgi?id=38841
+
+ Test: fast/canvas/canvas-invalid-values.html
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::setLineWidth):
+ (WebCore::CanvasRenderingContext2D::setMiterLimit):
+ (WebCore::CanvasRenderingContext2D::setShadowOffsetX):
+ (WebCore::CanvasRenderingContext2D::setShadowOffsetY):
+ (WebCore::CanvasRenderingContext2D::setShadowBlur):
+
+2010-05-12 Noam Rosenthal <noam.rosenthal@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] GraphicsLayer: depth-test causes flicker in certain situations
+
+ This patch removes the simplistic 2D depth test as it leads to flickering side effects.
+ https://bugs.webkit.org/show_bug.cgi?id=38370
+
+ Tested by http://webkit.org/blog-files/3d-transforms/morphing-cubes.html
+
+ * platform/graphics/qt/GraphicsLayerQt.cpp:
+ (WebCore::GraphicsLayerQtImpl::updateTransform):
+
+2010-04-29 James Robinson <jamesr@chromium.org>
+
+ Reviewed by Simon Fraser.
+
+ Calls FrameView::scrollPositionChanged whenever a ScrollView is scrolled
+ https://bugs.webkit.org/show_bug.cgi?id=38286
+
+ When a ScrollView's scroll position is changed, we have to call
+ FrameView::scrollPositionChanged to generate repaint invalidation for
+ fixed position elements. This ends up getting called indirectly when
+ the ScrollView has a platformWidget through the port layer
+ (see WebHTMLView.mm's _frameOrBoundsChanged method for how the mac
+ port does it) but not when there is no platformWidget.
+
+ This is tested by the fast/repaint/fixed-* tests when run in pixel
+ mode.
+
+ Test: fast/repaint/fixed-move-after-keyboard-scroll.html
+
+ * page/FrameView.h:
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::valueChanged):
+ * platform/ScrollView.h:
+ (WebCore::ScrollView::scrollPositionChanged):
+
+2010-04-23 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Unreviewed build fix.
+
+ Change Media to StyleMedia
+
+ * DerivedSources.make:
+
+2010-04-22 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Laszlo Gombos.
+
+ Rename window.media to window.styleMedia
+ https://bugs.webkit.org/show_bug.cgi?id=36187
+
+ Rename the interface Media to StyleMedia as required by the
+ new CSSOM View spec.
+
+ * Android.derived.jscbindings.mk:
+ * Android.derived.v8bindings.mk:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pri:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/Media.cpp: Removed.
+ * css/Media.h: Removed.
+ * css/Media.idl: Removed.
+ * css/StyleMedia.cpp: Added.
+ (WebCore::StyleMedia::StyleMedia):
+ (WebCore::StyleMedia::type):
+ (WebCore::StyleMedia::matchMedium):
+ * css/StyleMedia.h: Added.
+ (WebCore::StyleMedia::create):
+ (WebCore::StyleMedia::disconnectFrame):
+ * css/StyleMedia.idl: Added.
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::styleMedia):
+ * page/DOMWindow.h:
+ (WebCore::DOMWindow::optionalMedia):
+ * page/DOMWindow.idl:
+
+2010-04-22 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Simon Fraser.
+
+ Rename window.media to window.styleMedia
+ https://bugs.webkit.org/show_bug.cgi?id=36187
+
+ It has been defined that the AbstractView media extension
+ defined in the CSSOM View spec should be renamed to styleMedia.
+ This patch does that and updates the current layout tests
+ making use of it.
+
+ * page/AbstractView.idl:
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::styleMedia):
+ * page/DOMWindow.h:
+ * page/DOMWindow.idl:
+
+2010-05-11 Benjamin Poulain <benjamin.poulain@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] fast/text/find-hidden-text.html
+ https://bugs.webkit.org/show_bug.cgi?id=32922
+
+ Use the real page step for populating the QStyleOption otherwhise
+ the size can be negative, which can break the QStyle used.
+
+ * platform/qt/ScrollbarThemeQt.cpp:
+ (WebCore::styleOptionSlider):
+
+2010-05-03 Antonio Gomes <tonikitoo@webkit.org>
+
+ Reviewed by Kenneth Christiansen.
+
+ Spatial Navigation: create a getter for the "fudgeFactor"
+ https://bugs.webkit.org/show_bug.cgi?id=38488
+
+ A couple of places in the Spatial Navigation code make use of a "fudge factor"
+ to improve precision by working around outline focus metrics and such. Patch adds
+ a helper method for unify getter operations of this value, instead of having it
+ declared locally in the various methods it is used.
+
+ No behaviour change.
+
+ * page/SpatialNavigation.cpp:
+ (WebCore::scrollIntoView):
+ (WebCore::deflateIfOverlapped):
+ * page/SpatialNavigation.h:
+ (WebCore::fudgeFactor):
+
+2010-05-10 Markus Goetz <Markus.Goetz@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Qt after 4.6.3 has its integrated DNS cache. Therefore some
+ code is not necessary anymore.
+
+ https://bugs.webkit.org/show_bug.cgi?id=38834
+
+ * platform/network/qt/DnsPrefetchHelper.h:
+ (WebCore::DnsPrefetchHelper::lookup):
+ (WebCore::DnsPrefetchHelper::lookedUp):
+
+2010-05-06 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Unreviewed, build fix WinCE for QtWebKit.
+
+ [Qt] Compilation with Plugins disabled is broken
+ https://bugs.webkit.org/show_bug.cgi?id=31407
+
+ Rename platform/qt/TemporaryLinkStubs.cpp to avoid name collition on
+ Windows.
+
+ Thanks for Ismail "cartman" Donmez for help.
+
+ No new tests, as there is no new functionality.
+
+ * WebCore.gypi:
+ * WebCore.pro:
+ * platform/qt/TemporaryLinkStubs.cpp: Removed.
+ * platform/qt/TemporaryLinkStubsQt.cpp: Copied from WebCore/platform/qt/TemporaryLinkStubs.cpp.
+
+2010-04-23 Qi Zhang <qi.2.zhang@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] LayoutTests/fast/canvas/pointInPath.html passed, actually it failed
+ https://bugs.webkit.org/show_bug.cgi?id=37276
+
+ QPainterPath::contains doesn't count the point on the bound.
+
+ * platform/graphics/qt/PathQt.cpp:
+ (WebCore::isPointOnPathBorder):
+ (WebCore::Path::contains):
+
+2010-05-07 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Fix rendering of -webkit-user-select: none
+
+ -webkit-user-select: none is implemented by filling
+ the area with an invalid default-constructed Color.
+ In most ports passing an invalid color down to the
+ graphics backend seems to produce transparent fills.
+
+ In Qt the behavior of painting with an invalid QColor
+ is undefined, and in practice it results in painting
+ black opaque areas.
+
+ One way to fix this would be to use Qt::transparent
+ when converting an undefined Color to a QColor, but
+ Qt does not have short circuits for fully transparent
+ painting, and we actually end up in slow code paths
+ due to the transparency. So, we're better of doing the
+ short circuit in WebKit.
+
+ https://bugs.webkit.org/show_bug.cgi?id=38523
+
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+
+2010-04-05 Robert Hogan <robert@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Fix infinite redirection loop in QNetworkReplyHandler
+
+ Put a maximum on consecutive redirections so we don't have to
+ worry about whether it's the same url or not.
+
+ Tolerate up to 10 consecutive redirections, anything beyond
+ that is considered a potentially infinite recursion in the
+ redirection requests. This is the same behaviour as Firefox.
+
+ https://bugs.webkit.org/show_bug.cgi?id=37097
+
+ * platform/network/qt/QNetworkReplyHandler.cpp:
+ (WebCore::QNetworkReplyHandler::QNetworkReplyHandler):
+ (WebCore::QNetworkReplyHandler::sendResponseIfNeeded):
+ * platform/network/qt/QNetworkReplyHandler.h:
+
+2010-04-05 Robert Hogan <robert@webkit.org>
+
+ Reviewed by Kenneth Rohde-Christiansen.
+
+ [Qt] Fix infinite redirection loop in QNetworkReplyHandler
+
+ Qt enters an infinite loop if a redirect response redirects to itself.
+
+ Fixes http/tests/xmlhttprequest/connection-error-sync.html
+
+ https://bugs.webkit.org/show_bug.cgi?id=37097
+
+ * platform/network/qt/QNetworkReplyHandler.cpp:
+ (WebCore::QNetworkReplyHandler::sendResponseIfNeeded):
+
+2010-05-07 Ben Murdoch <benm@google.com>
+
+ Reviewed by Darin Adler.
+
+ Potential crash in EventHandler::handleTouchEvent
+ https://bugs.webkit.org/show_bug.cgi?id=38646
+
+ Fix a ref counting bug that can cause a crash if the m_originatingouchPointTargets
+ hashmap holds the last ref to an EventTarget when the user lifts their finger.
+
+ This is very hard to reproduce in a consistent way and clearly a
+ simple logic error in the code, therefore no new tests.
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleTouchEvent): Don't let the RefPtr we get back from
+ the hasmap go out of scope so soon as it could delete the wrapped ptr if the
+ hashmap held the last ref (and we use the raw ptr that the RefPtr
+ wraps later in the WebCore::Touch constructor).
+
+2010-05-04 Ben Murdoch <benm@google.com>
+
+ Reviewed by Simon Hausmann.
+
+ Crash in handleTouchEvent: using dangling node ptrs in hashmap
+ https://bugs.webkit.org/show_bug.cgi?id=38514
+
+ When navigating away from a page, if you have your finger still
+ pressed and then lift it on the new page we see a crash if the
+ node got deleted as we still have a dangling pointer in the
+ m_originatingTouchPointTargets hashmap and try to use it as the
+ receiver to dispatch a touchend event.
+
+ Test: fast/events/touch/touch-stale-node-crash.html
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::clear): Clear the hashmap of touch targets.
+
2010-05-04 Luiz Agostini <luiz.agostini@openbossa.org>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/WebCore/WebCore.gypi b/src/3rdparty/webkit/WebCore/WebCore.gypi
index caa79f292b..1e92f1fa98 100644
--- a/src/3rdparty/webkit/WebCore/WebCore.gypi
+++ b/src/3rdparty/webkit/WebCore/WebCore.gypi
@@ -18,10 +18,10 @@
'css/CSSVariablesDeclaration.idl',
'css/CSSVariablesRule.idl',
'css/Counter.idl',
- 'css/Media.idl',
'css/MediaList.idl',
- 'css/RGBColor.idl',
'css/Rect.idl',
+ 'css/RGBColor.idl',
+ 'css/StyleMedia.idl',
'css/StyleSheet.idl',
'css/StyleSheetList.idl',
'css/WebKitCSSKeyframeRule.idl',
@@ -1003,33 +1003,33 @@
'css/FontValue.h',
'css/MediaFeatureNames.cpp',
'css/MediaFeatureNames.h',
- 'css/Media.cpp',
- 'css/Media.h',
'css/MediaList.cpp',
'css/MediaList.h',
'css/MediaQuery.cpp',
- 'css/MediaQuery.h',
'css/MediaQueryEvaluator.cpp',
'css/MediaQueryEvaluator.h',
'css/MediaQueryExp.cpp',
'css/MediaQueryExp.h',
+ 'css/MediaQuery.h',
'css/Pair.h',
'css/Rect.h',
'css/RGBColor.cpp',
'css/RGBColor.h',
- 'css/SVGCSSComputedStyleDeclaration.cpp',
- 'css/SVGCSSParser.cpp',
- 'css/SVGCSSStyleSelector.cpp',
'css/ShadowValue.cpp',
'css/ShadowValue.h',
'css/StyleBase.cpp',
'css/StyleBase.h',
'css/StyleList.cpp',
'css/StyleList.h',
+ 'css/StyleMedia.cpp',
+ 'css/StyleMedia.h',
'css/StyleSheet.cpp',
'css/StyleSheet.h',
'css/StyleSheetList.cpp',
'css/StyleSheetList.h',
+ 'css/SVGCSSComputedStyleDeclaration.cpp',
+ 'css/SVGCSSParser.cpp',
+ 'css/SVGCSSStyleSelector.cpp',
'css/WebKitCSSKeyframeRule.cpp',
'css/WebKitCSSKeyframeRule.h',
'css/WebKitCSSKeyframesRule.cpp',
@@ -2640,7 +2640,7 @@
'platform/qt/SharedBufferQt.cpp',
'platform/qt/SharedTimerQt.cpp',
'platform/qt/SoundQt.cpp',
- 'platform/qt/TemporaryLinkStubs.cpp',
+ 'platform/qt/TemporaryLinkStubsQt.cpp',
'platform/qt/WheelEventQt.cpp',
'platform/qt/WidgetQt.cpp',
'platform/sql/SQLValue.cpp',
diff --git a/src/3rdparty/webkit/WebCore/WebCore.pri b/src/3rdparty/webkit/WebCore/WebCore.pri
index ad514a222a..5f5987ffa6 100644
--- a/src/3rdparty/webkit/WebCore/WebCore.pri
+++ b/src/3rdparty/webkit/WebCore/WebCore.pri
@@ -227,10 +227,10 @@ IDL_BINDINGS += \
css/CSSValueList.idl \
css/CSSVariablesDeclaration.idl \
css/CSSVariablesRule.idl \
- css/Media.idl \
css/MediaList.idl \
- css/RGBColor.idl \
css/Rect.idl \
+ css/RGBColor.idl \
+ css/StyleMedia.idl \
css/StyleSheet.idl \
css/StyleSheetList.idl \
css/WebKitCSSKeyframeRule.idl \
diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro
index beeb5292c2..689c5ff884 100644
--- a/src/3rdparty/webkit/WebCore/WebCore.pro
+++ b/src/3rdparty/webkit/WebCore/WebCore.pro
@@ -59,7 +59,7 @@ CONFIG(standalone_package) {
isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = generated
isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = ../JavaScriptCore/generated
- CONFIG(debug, debug|release) {
+ !CONFIG(release, debug|release) {
OBJECTS_DIR = obj/debug
} else { # Release
OBJECTS_DIR = obj/release
@@ -431,7 +431,6 @@ SOURCES += \
css/FontFamilyValue.cpp \
css/FontValue.cpp \
css/MediaFeatureNames.cpp \
- css/Media.cpp \
css/MediaList.cpp \
css/MediaQuery.cpp \
css/MediaQueryEvaluator.cpp \
@@ -440,6 +439,7 @@ SOURCES += \
css/ShadowValue.cpp \
css/StyleBase.cpp \
css/StyleList.cpp \
+ css/StyleMedia.cpp \
css/StyleSheet.cpp \
css/StyleSheetList.cpp \
css/WebKitCSSKeyframeRule.cpp \
@@ -1145,7 +1145,6 @@ HEADERS += \
css/FontFamilyValue.h \
css/FontValue.h \
css/MediaFeatureNames.h \
- css/Media.h \
css/MediaList.h \
css/MediaQueryEvaluator.h \
css/MediaQueryExp.h \
@@ -1154,6 +1153,7 @@ HEADERS += \
css/ShadowValue.h \
css/StyleBase.h \
css/StyleList.h \
+ css/StyleMedia.h \
css/StyleSheet.h \
css/StyleSheetList.h \
css/WebKitCSSKeyframeRule.h \
@@ -2081,7 +2081,7 @@ SOURCES += \
platform/qt/SoundQt.cpp \
platform/qt/LoggingQt.cpp \
platform/text/qt/StringQt.cpp \
- platform/qt/TemporaryLinkStubs.cpp \
+ platform/qt/TemporaryLinkStubsQt.cpp \
platform/text/qt/TextBoundariesQt.cpp \
platform/text/qt/TextBreakIteratorQt.cpp \
platform/text/qt/TextCodecQt.cpp \
diff --git a/src/3rdparty/webkit/WebCore/css/Media.cpp b/src/3rdparty/webkit/WebCore/css/StyleMedia.cpp
index e238602c90..6cb662fcff 100644
--- a/src/3rdparty/webkit/WebCore/css/Media.cpp
+++ b/src/3rdparty/webkit/WebCore/css/StyleMedia.cpp
@@ -24,8 +24,8 @@
*/
#include "config.h"
+#include "StyleMedia.h"
-#include "Media.h"
#include "CSSStyleSelector.h"
#include "Frame.h"
#include "FrameView.h"
@@ -34,12 +34,12 @@
namespace WebCore {
-Media::Media(Frame* frame)
+StyleMedia::StyleMedia(Frame* frame)
: m_frame(frame)
{
}
-String Media::type() const
+String StyleMedia::type() const
{
FrameView* view = m_frame ? m_frame->view() : 0;
if (view)
@@ -48,7 +48,7 @@ String Media::type() const
return String();
}
-bool Media::matchMedium(const String& query) const
+bool StyleMedia::matchMedium(const String& query) const
{
if (!m_frame)
return false;
diff --git a/src/3rdparty/webkit/WebCore/css/Media.h b/src/3rdparty/webkit/WebCore/css/StyleMedia.h
index ee6961b368..761e6a3755 100644
--- a/src/3rdparty/webkit/WebCore/css/Media.h
+++ b/src/3rdparty/webkit/WebCore/css/StyleMedia.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,18 +24,18 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef Media_h
-#define Media_h
+#ifndef StyleMedia_h
+#define StyleMedia_h
#include "DOMWindow.h"
namespace WebCore {
-class Media : public RefCounted<Media> {
+class StyleMedia : public RefCounted<StyleMedia> {
public:
- static PassRefPtr<Media> create(Frame* frame)
+ static PassRefPtr<StyleMedia> create(Frame* frame)
{
- return adoptRef(new Media(frame));
+ return adoptRef(new StyleMedia(frame));
}
void disconnectFrame() { m_frame = 0; }
@@ -42,13 +43,13 @@ public:
String type() const;
bool matchMedium(const String&) const;
-
+
private:
- Media(Frame*);
+ StyleMedia(Frame*);
Frame* m_frame;
};
} // namespace
-#endif // Media_h
+#endif // StyleMedia_h
diff --git a/src/3rdparty/webkit/WebCore/css/Media.idl b/src/3rdparty/webkit/WebCore/css/StyleMedia.idl
index 1bf59007b8..7be35cc60f 100644
--- a/src/3rdparty/webkit/WebCore/css/Media.idl
+++ b/src/3rdparty/webkit/WebCore/css/StyleMedia.idl
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -24,7 +25,7 @@
*/
module view {
- interface Media {
+ interface StyleMedia {
readonly attribute DOMString type;
boolean matchMedium(in DOMString mediaquery);
};
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp
index 04238bcfd9..11dfd2e591 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp
+++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp
@@ -152,7 +152,6 @@
#include "JSHTMLVideoElement.h"
#include "JSImageData.h"
#include "JSKeyboardEvent.h"
-#include "JSMedia.h"
#include "JSMediaError.h"
#include "JSMediaList.h"
#include "JSMessageChannel.h"
@@ -299,6 +298,7 @@
#include "JSSharedWorker.h"
#include "JSStorage.h"
#include "JSStorageEvent.h"
+#include "JSStyleMedia.h"
#include "JSStyleSheet.h"
#include "JSStyleSheetList.h"
#include "JSText.h"
@@ -334,11 +334,11 @@
#include "JSXPathResult.h"
#include "JSXSLTProcessor.h"
#include "KURL.h"
-#include "Media.h"
#include "Navigator.h"
#include "RegisteredEventListener.h"
#include "Screen.h"
#include "Storage.h"
+#include "StyleMedia.h"
#include "WebKitPoint.h"
#include <runtime/Error.h>
#include <runtime/JSNumberCell.h>
@@ -395,7 +395,7 @@ static const HashTableValue JSDOMWindowTableValues[409] =
{ "parent", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMWindowParent), (intptr_t)setJSDOMWindowParent },
{ "top", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMWindowTop), (intptr_t)setJSDOMWindowTop },
{ "document", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMWindowDocument), (intptr_t)0 },
- { "media", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMWindowMedia), (intptr_t)0 },
+ { "styleMedia", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMWindowStyleMedia), (intptr_t)0 },
{ "devicePixelRatio", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMWindowDevicePixelRatio), (intptr_t)setJSDOMWindowDevicePixelRatio },
{ "applicationCache", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMWindowApplicationCache), (intptr_t)0 },
{ "sessionStorage", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMWindowSessionStorage), (intptr_t)0 },
@@ -1304,14 +1304,14 @@ JSValue jsDOMWindowDocument(ExecState* exec, JSValue slotBase, const Identifier&
return result;
}
-JSValue jsDOMWindowMedia(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue jsDOMWindowStyleMedia(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSDOMWindow* castedThis = static_cast<JSDOMWindow*>(asObject(slotBase));
if (!castedThis->allowsAccessFrom(exec))
return jsUndefined();
UNUSED_PARAM(exec);
DOMWindow* imp = static_cast<DOMWindow*>(castedThis->impl());
- JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->media()));
+ JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->styleMedia()));
return result;
}
diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h
index a6f325305c..7e50556deb 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h
@@ -231,7 +231,7 @@ void setJSDOMWindowParent(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsDOMWindowTop(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSDOMWindowTop(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsDOMWindowDocument(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
-JSC::JSValue jsDOMWindowMedia(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+JSC::JSValue jsDOMWindowStyleMedia(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
JSC::JSValue jsDOMWindowDevicePixelRatio(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSDOMWindowDevicePixelRatio(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsDOMWindowApplicationCache(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
diff --git a/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp b/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp
deleted file mode 100644
index 1579c2b8f1..0000000000
--- a/src/3rdparty/webkit/WebCore/generated/JSMedia.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- This file is part of the WebKit open source project.
- This file has been generated by generate-bindings.pl. DO NOT MODIFY!
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-#include "JSMedia.h"
-
-#include "KURL.h"
-#include "Media.h"
-#include <runtime/Error.h>
-#include <runtime/JSString.h>
-#include <wtf/GetPtr.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-ASSERT_CLASS_FITS_IN_CELL(JSMedia);
-
-/* Hash table */
-
-static const HashTableValue JSMediaTableValues[3] =
-{
- { "type", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaType), (intptr_t)0 },
- { "constructor", DontEnum|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaConstructor), (intptr_t)0 },
- { 0, 0, 0, 0 }
-};
-
-static JSC_CONST_HASHTABLE HashTable JSMediaTable =
-#if ENABLE(PERFECT_HASH_SIZE)
- { 3, JSMediaTableValues, 0 };
-#else
- { 4, 3, JSMediaTableValues, 0 };
-#endif
-
-/* Hash table for constructor */
-
-static const HashTableValue JSMediaConstructorTableValues[1] =
-{
- { 0, 0, 0, 0 }
-};
-
-static JSC_CONST_HASHTABLE HashTable JSMediaConstructorTable =
-#if ENABLE(PERFECT_HASH_SIZE)
- { 0, JSMediaConstructorTableValues, 0 };
-#else
- { 1, 0, JSMediaConstructorTableValues, 0 };
-#endif
-
-class JSMediaConstructor : public DOMConstructorObject {
-public:
- JSMediaConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
- : DOMConstructorObject(JSMediaConstructor::createStructure(globalObject->objectPrototype()), globalObject)
- {
- putDirect(exec->propertyNames().prototype, JSMediaPrototype::self(exec, globalObject), None);
- }
- virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
- virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
- virtual const ClassInfo* classInfo() const { return &s_info; }
- static const ClassInfo s_info;
-
- static PassRefPtr<Structure> createStructure(JSValue proto)
- {
- return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
- }
-
-protected:
- static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags;
-};
-
-const ClassInfo JSMediaConstructor::s_info = { "MediaConstructor", 0, &JSMediaConstructorTable, 0 };
-
-bool JSMediaConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
-{
- return getStaticValueSlot<JSMediaConstructor, DOMObject>(exec, &JSMediaConstructorTable, this, propertyName, slot);
-}
-
-bool JSMediaConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
-{
- return getStaticValueDescriptor<JSMediaConstructor, DOMObject>(exec, &JSMediaConstructorTable, this, propertyName, descriptor);
-}
-
-/* Hash table for prototype */
-
-static const HashTableValue JSMediaPrototypeTableValues[2] =
-{
- { "matchMedium", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsMediaPrototypeFunctionMatchMedium), (intptr_t)1 },
- { 0, 0, 0, 0 }
-};
-
-static JSC_CONST_HASHTABLE HashTable JSMediaPrototypeTable =
-#if ENABLE(PERFECT_HASH_SIZE)
- { 0, JSMediaPrototypeTableValues, 0 };
-#else
- { 2, 1, JSMediaPrototypeTableValues, 0 };
-#endif
-
-const ClassInfo JSMediaPrototype::s_info = { "MediaPrototype", 0, &JSMediaPrototypeTable, 0 };
-
-JSObject* JSMediaPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
-{
- return getDOMPrototype<JSMedia>(exec, globalObject);
-}
-
-bool JSMediaPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
-{
- return getStaticFunctionSlot<JSObject>(exec, &JSMediaPrototypeTable, this, propertyName, slot);
-}
-
-bool JSMediaPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
-{
- return getStaticFunctionDescriptor<JSObject>(exec, &JSMediaPrototypeTable, this, propertyName, descriptor);
-}
-
-const ClassInfo JSMedia::s_info = { "Media", 0, &JSMediaTable, 0 };
-
-JSMedia::JSMedia(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<Media> impl)
- : DOMObjectWithGlobalPointer(structure, globalObject)
- , m_impl(impl)
-{
-}
-
-JSMedia::~JSMedia()
-{
- forgetDOMObject(this, impl());
-}
-
-JSObject* JSMedia::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
-{
- return new (exec) JSMediaPrototype(JSMediaPrototype::createStructure(globalObject->objectPrototype()));
-}
-
-bool JSMedia::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
-{
- return getStaticValueSlot<JSMedia, Base>(exec, &JSMediaTable, this, propertyName, slot);
-}
-
-bool JSMedia::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
-{
- return getStaticValueDescriptor<JSMedia, Base>(exec, &JSMediaTable, this, propertyName, descriptor);
-}
-
-JSValue jsMediaType(ExecState* exec, JSValue slotBase, const Identifier&)
-{
- JSMedia* castedThis = static_cast<JSMedia*>(asObject(slotBase));
- UNUSED_PARAM(exec);
- Media* imp = static_cast<Media*>(castedThis->impl());
- JSValue result = jsString(exec, imp->type());
- return result;
-}
-
-JSValue jsMediaConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
-{
- JSMedia* domObject = static_cast<JSMedia*>(asObject(slotBase));
- return JSMedia::getConstructor(exec, domObject->globalObject());
-}
-JSValue JSMedia::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
-{
- return getDOMConstructor<JSMediaConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
-}
-
-JSValue JSC_HOST_CALL jsMediaPrototypeFunctionMatchMedium(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
-{
- UNUSED_PARAM(args);
- if (!thisValue.inherits(&JSMedia::s_info))
- return throwError(exec, TypeError);
- JSMedia* castedThisObj = static_cast<JSMedia*>(asObject(thisValue));
- Media* imp = static_cast<Media*>(castedThisObj->impl());
- const UString& mediaquery = args.at(0).toString(exec);
-
-
- JSC::JSValue result = jsBoolean(imp->matchMedium(mediaquery));
- return result;
-}
-
-JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Media* object)
-{
- return getDOMObjectWrapper<JSMedia>(exec, globalObject, object);
-}
-Media* toMedia(JSC::JSValue value)
-{
- return value.inherits(&JSMedia::s_info) ? static_cast<JSMedia*>(asObject(value))->impl() : 0;
-}
-
-}
diff --git a/src/3rdparty/webkit/WebCore/generated/JSStyleMedia.cpp b/src/3rdparty/webkit/WebCore/generated/JSStyleMedia.cpp
new file mode 100644
index 0000000000..b06bf09279
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/generated/JSStyleMedia.cpp
@@ -0,0 +1,201 @@
+/*
+ This file is part of the WebKit open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "JSStyleMedia.h"
+
+#include "KURL.h"
+#include "StyleMedia.h"
+#include <runtime/Error.h>
+#include <runtime/JSString.h>
+#include <wtf/GetPtr.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+ASSERT_CLASS_FITS_IN_CELL(JSStyleMedia);
+
+/* Hash table */
+
+static const HashTableValue JSStyleMediaTableValues[3] =
+{
+ { "type", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleMediaType), (intptr_t)0 },
+ { "constructor", DontEnum|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStyleMediaConstructor), (intptr_t)0 },
+ { 0, 0, 0, 0 }
+};
+
+static JSC_CONST_HASHTABLE HashTable JSStyleMediaTable =
+#if ENABLE(PERFECT_HASH_SIZE)
+ { 3, JSStyleMediaTableValues, 0 };
+#else
+ { 4, 3, JSStyleMediaTableValues, 0 };
+#endif
+
+/* Hash table for constructor */
+
+static const HashTableValue JSStyleMediaConstructorTableValues[1] =
+{
+ { 0, 0, 0, 0 }
+};
+
+static JSC_CONST_HASHTABLE HashTable JSStyleMediaConstructorTable =
+#if ENABLE(PERFECT_HASH_SIZE)
+ { 0, JSStyleMediaConstructorTableValues, 0 };
+#else
+ { 1, 0, JSStyleMediaConstructorTableValues, 0 };
+#endif
+
+class JSStyleMediaConstructor : public DOMConstructorObject {
+public:
+ JSStyleMediaConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
+ : DOMConstructorObject(JSStyleMediaConstructor::createStructure(globalObject->objectPrototype()), globalObject)
+ {
+ putDirect(exec->propertyNames().prototype, JSStyleMediaPrototype::self(exec, globalObject), None);
+ }
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+ virtual const ClassInfo* classInfo() const { return &s_info; }
+ static const ClassInfo s_info;
+
+ static PassRefPtr<Structure> createStructure(JSValue proto)
+ {
+ return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ }
+
+protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags;
+};
+
+const ClassInfo JSStyleMediaConstructor::s_info = { "StyleMediaConstructor", 0, &JSStyleMediaConstructorTable, 0 };
+
+bool JSStyleMediaConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticValueSlot<JSStyleMediaConstructor, DOMObject>(exec, &JSStyleMediaConstructorTable, this, propertyName, slot);
+}
+
+bool JSStyleMediaConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<JSStyleMediaConstructor, DOMObject>(exec, &JSStyleMediaConstructorTable, this, propertyName, descriptor);
+}
+
+/* Hash table for prototype */
+
+static const HashTableValue JSStyleMediaPrototypeTableValues[2] =
+{
+ { "matchMedium", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsStyleMediaPrototypeFunctionMatchMedium), (intptr_t)1 },
+ { 0, 0, 0, 0 }
+};
+
+static JSC_CONST_HASHTABLE HashTable JSStyleMediaPrototypeTable =
+#if ENABLE(PERFECT_HASH_SIZE)
+ { 0, JSStyleMediaPrototypeTableValues, 0 };
+#else
+ { 2, 1, JSStyleMediaPrototypeTableValues, 0 };
+#endif
+
+const ClassInfo JSStyleMediaPrototype::s_info = { "StyleMediaPrototype", 0, &JSStyleMediaPrototypeTable, 0 };
+
+JSObject* JSStyleMediaPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
+{
+ return getDOMPrototype<JSStyleMedia>(exec, globalObject);
+}
+
+bool JSStyleMediaPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticFunctionSlot<JSObject>(exec, &JSStyleMediaPrototypeTable, this, propertyName, slot);
+}
+
+bool JSStyleMediaPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticFunctionDescriptor<JSObject>(exec, &JSStyleMediaPrototypeTable, this, propertyName, descriptor);
+}
+
+const ClassInfo JSStyleMedia::s_info = { "StyleMedia", 0, &JSStyleMediaTable, 0 };
+
+JSStyleMedia::JSStyleMedia(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<StyleMedia> impl)
+ : DOMObjectWithGlobalPointer(structure, globalObject)
+ , m_impl(impl)
+{
+}
+
+JSStyleMedia::~JSStyleMedia()
+{
+ forgetDOMObject(this, impl());
+}
+
+JSObject* JSStyleMedia::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
+{
+ return new (exec) JSStyleMediaPrototype(JSStyleMediaPrototype::createStructure(globalObject->objectPrototype()));
+}
+
+bool JSStyleMedia::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ return getStaticValueSlot<JSStyleMedia, Base>(exec, &JSStyleMediaTable, this, propertyName, slot);
+}
+
+bool JSStyleMedia::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ return getStaticValueDescriptor<JSStyleMedia, Base>(exec, &JSStyleMediaTable, this, propertyName, descriptor);
+}
+
+JSValue jsStyleMediaType(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ JSStyleMedia* castedThis = static_cast<JSStyleMedia*>(asObject(slotBase));
+ UNUSED_PARAM(exec);
+ StyleMedia* imp = static_cast<StyleMedia*>(castedThis->impl());
+ JSValue result = jsString(exec, imp->type());
+ return result;
+}
+
+JSValue jsStyleMediaConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
+{
+ JSStyleMedia* domObject = static_cast<JSStyleMedia*>(asObject(slotBase));
+ return JSStyleMedia::getConstructor(exec, domObject->globalObject());
+}
+JSValue JSStyleMedia::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
+{
+ return getDOMConstructor<JSStyleMediaConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
+}
+
+JSValue JSC_HOST_CALL jsStyleMediaPrototypeFunctionMatchMedium(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
+{
+ UNUSED_PARAM(args);
+ if (!thisValue.inherits(&JSStyleMedia::s_info))
+ return throwError(exec, TypeError);
+ JSStyleMedia* castedThisObj = static_cast<JSStyleMedia*>(asObject(thisValue));
+ StyleMedia* imp = static_cast<StyleMedia*>(castedThisObj->impl());
+ const UString& mediaquery = args.at(0).toString(exec);
+
+
+ JSC::JSValue result = jsBoolean(imp->matchMedium(mediaquery));
+ return result;
+}
+
+JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, StyleMedia* object)
+{
+ return getDOMObjectWrapper<JSStyleMedia>(exec, globalObject, object);
+}
+StyleMedia* toStyleMedia(JSC::JSValue value)
+{
+ return value.inherits(&JSStyleMedia::s_info) ? static_cast<JSStyleMedia*>(asObject(value))->impl() : 0;
+}
+
+}
diff --git a/src/3rdparty/webkit/WebCore/generated/JSMedia.h b/src/3rdparty/webkit/WebCore/generated/JSStyleMedia.h
index 28515c9802..12601d54da 100644
--- a/src/3rdparty/webkit/WebCore/generated/JSMedia.h
+++ b/src/3rdparty/webkit/WebCore/generated/JSStyleMedia.h
@@ -18,8 +18,8 @@
Boston, MA 02110-1301, USA.
*/
-#ifndef JSMedia_h
-#define JSMedia_h
+#ifndef JSStyleMedia_h
+#define JSStyleMedia_h
#include "JSDOMBinding.h"
#include <runtime/JSGlobalObject.h>
@@ -27,13 +27,13 @@
namespace WebCore {
-class Media;
+class StyleMedia;
-class JSMedia : public DOMObjectWithGlobalPointer {
+class JSStyleMedia : public DOMObjectWithGlobalPointer {
typedef DOMObjectWithGlobalPointer Base;
public:
- JSMedia(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<Media>);
- virtual ~JSMedia();
+ JSStyleMedia(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<StyleMedia>);
+ virtual ~JSStyleMedia();
static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);
virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
@@ -46,18 +46,18 @@ public:
}
static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*);
- Media* impl() const { return m_impl.get(); }
+ StyleMedia* impl() const { return m_impl.get(); }
private:
- RefPtr<Media> m_impl;
+ RefPtr<StyleMedia> m_impl;
protected:
static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;
};
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, Media*);
-Media* toMedia(JSC::JSValue);
+JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, StyleMedia*);
+StyleMedia* toStyleMedia(JSC::JSValue);
-class JSMediaPrototype : public JSC::JSObject {
+class JSStyleMediaPrototype : public JSC::JSObject {
typedef JSC::JSObject Base;
public:
static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*);
@@ -69,18 +69,18 @@ public:
{
return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
}
- JSMediaPrototype(NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { }
+ JSStyleMediaPrototype(NonNullPassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { }
protected:
static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;
};
// Functions
-JSC::JSValue JSC_HOST_CALL jsMediaPrototypeFunctionMatchMedium(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
+JSC::JSValue JSC_HOST_CALL jsStyleMediaPrototypeFunctionMatchMedium(JSC::ExecState*, JSC::JSObject*, JSC::JSValue, const JSC::ArgList&);
// Attributes
-JSC::JSValue jsMediaType(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
-JSC::JSValue jsMediaConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+JSC::JSValue jsStyleMediaType(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+JSC::JSValue jsStyleMediaConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index 8add19cc94..823ab599e5 100644
--- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -209,7 +209,7 @@ float CanvasRenderingContext2D::lineWidth() const
void CanvasRenderingContext2D::setLineWidth(float width)
{
- if (!(width > 0))
+ if (!(isfinite(width) && width > 0))
return;
state().m_lineWidth = width;
GraphicsContext* c = drawingContext();
@@ -259,7 +259,7 @@ float CanvasRenderingContext2D::miterLimit() const
void CanvasRenderingContext2D::setMiterLimit(float limit)
{
- if (!(limit > 0))
+ if (!(isfinite(limit) && limit > 0))
return;
state().m_miterLimit = limit;
GraphicsContext* c = drawingContext();
@@ -275,6 +275,8 @@ float CanvasRenderingContext2D::shadowOffsetX() const
void CanvasRenderingContext2D::setShadowOffsetX(float x)
{
+ if (!isfinite(x))
+ return;
state().m_shadowOffset.setWidth(x);
applyShadow();
}
@@ -286,6 +288,8 @@ float CanvasRenderingContext2D::shadowOffsetY() const
void CanvasRenderingContext2D::setShadowOffsetY(float y)
{
+ if (!isfinite(y))
+ return;
state().m_shadowOffset.setHeight(y);
applyShadow();
}
@@ -297,6 +301,8 @@ float CanvasRenderingContext2D::shadowBlur() const
void CanvasRenderingContext2D::setShadowBlur(float blur)
{
+ if (!(isfinite(blur) && blur >= 0))
+ return;
state().m_shadowBlur = blur;
applyShadow();
}
diff --git a/src/3rdparty/webkit/WebCore/page/AbstractView.idl b/src/3rdparty/webkit/WebCore/page/AbstractView.idl
index 290bf4848a..e4ece0f575 100644
--- a/src/3rdparty/webkit/WebCore/page/AbstractView.idl
+++ b/src/3rdparty/webkit/WebCore/page/AbstractView.idl
@@ -32,7 +32,7 @@ module views {
OmitConstructor
] AbstractView {
readonly attribute Document document;
- readonly attribute Media media;
+ readonly attribute Media styleMedia;
};
}
diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp
index dd902005ef..8dcff5ca4f 100644
--- a/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp
+++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.cpp
@@ -57,7 +57,7 @@
#include "InspectorController.h"
#include "InspectorTimelineAgent.h"
#include "Location.h"
-#include "Media.h"
+#include "StyleMedia.h"
#include "MessageEvent.h"
#include "Navigator.h"
#include "NotificationCenter.h"
@@ -1112,10 +1112,10 @@ Document* DOMWindow::document() const
return m_frame->document();
}
-PassRefPtr<Media> DOMWindow::media() const
+PassRefPtr<StyleMedia> DOMWindow::styleMedia() const
{
if (!m_media)
- m_media = Media::create(m_frame);
+ m_media = StyleMedia::create(m_frame);
return m_media.get();
}
diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.h b/src/3rdparty/webkit/WebCore/page/DOMWindow.h
index a70713b201..cf9bc88d66 100644
--- a/src/3rdparty/webkit/WebCore/page/DOMWindow.h
+++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.h
@@ -56,7 +56,7 @@ namespace WebCore {
class IndexedDatabaseRequest;
class InspectorTimelineAgent;
class Location;
- class Media;
+ class StyleMedia;
class Navigator;
class Node;
class NotificationCenter;
@@ -187,7 +187,7 @@ namespace WebCore {
// DOM Level 2 AbstractView Interface
Document* document() const;
// CSSOM View Module
- PassRefPtr<Media> media() const;
+ PassRefPtr<StyleMedia> styleMedia() const;
// DOM Level 2 Style Interface
PassRefPtr<CSSStyleDeclaration> getComputedStyle(Element*, const String& pseudoElt) const;
@@ -353,7 +353,7 @@ namespace WebCore {
Console* optionalConsole() const { return m_console.get(); }
Navigator* optionalNavigator() const { return m_navigator.get(); }
Location* optionalLocation() const { return m_location.get(); }
- Media* optionalMedia() const { return m_media.get(); }
+ StyleMedia* optionalMedia() const { return m_media.get(); }
#if ENABLE(DOM_STORAGE)
Storage* optionalSessionStorage() const { return m_sessionStorage.get(); }
Storage* optionalLocalStorage() const { return m_localStorage.get(); }
@@ -390,7 +390,7 @@ namespace WebCore {
mutable RefPtr<Console> m_console;
mutable RefPtr<Navigator> m_navigator;
mutable RefPtr<Location> m_location;
- mutable RefPtr<Media> m_media;
+ mutable RefPtr<StyleMedia> m_media;
#if ENABLE(DOM_STORAGE)
mutable RefPtr<Storage> m_sessionStorage;
mutable RefPtr<Storage> m_localStorage;
diff --git a/src/3rdparty/webkit/WebCore/page/DOMWindow.idl b/src/3rdparty/webkit/WebCore/page/DOMWindow.idl
index 31e4d4fee8..33e49e83f7 100644
--- a/src/3rdparty/webkit/WebCore/page/DOMWindow.idl
+++ b/src/3rdparty/webkit/WebCore/page/DOMWindow.idl
@@ -141,7 +141,7 @@ module window {
readonly attribute Document document;
// CSSOM View Module
- readonly attribute Media media;
+ readonly attribute StyleMedia styleMedia;
// DOM Level 2 Style Interface
CSSStyleDeclaration getComputedStyle(in Element element,
diff --git a/src/3rdparty/webkit/WebCore/page/EventHandler.cpp b/src/3rdparty/webkit/WebCore/page/EventHandler.cpp
index 0a0e8c6458..46dd7ae981 100644
--- a/src/3rdparty/webkit/WebCore/page/EventHandler.cpp
+++ b/src/3rdparty/webkit/WebCore/page/EventHandler.cpp
@@ -230,6 +230,9 @@ void EventHandler::clear()
m_capturingMouseEventsNode = 0;
m_latchedWheelEventNode = 0;
m_previousWheelScrolledNode = 0;
+#if ENABLE(TOUCH_EVENTS)
+ m_originatingTouchPointTargets.clear();
+#endif
}
void EventHandler::selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults& result)
@@ -2714,21 +2717,21 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
// Increment the platform touch id by 1 to avoid storing a key of 0 in the hashmap.
unsigned touchPointTargetKey = point.id() + 1;
- EventTarget* touchTarget = 0;
+ RefPtr<EventTarget> touchTarget;
if (point.state() == PlatformTouchPoint::TouchPressed) {
m_originatingTouchPointTargets.set(touchPointTargetKey, target);
touchTarget = target;
} else if (point.state() == PlatformTouchPoint::TouchReleased || point.state() == PlatformTouchPoint::TouchCancelled) {
// The target should be the original target for this touch, so get it from the hashmap. As it's a release or cancel
// we also remove it from the map.
- touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKey).get();
+ touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKey);
} else
- touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey).get();
+ touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey);
- if (!touchTarget)
+ if (!touchTarget.get())
continue;
- RefPtr<Touch> touch = Touch::create(doc->frame(), touchTarget, point.id(),
+ RefPtr<Touch> touch = Touch::create(doc->frame(), touchTarget.get(), point.id(),
point.screenPos().x(), point.screenPos().y(),
adjustedPageX, adjustedPageY);
diff --git a/src/3rdparty/webkit/WebCore/page/FrameView.h b/src/3rdparty/webkit/WebCore/page/FrameView.h
index 7371d13643..7119975db3 100644
--- a/src/3rdparty/webkit/WebCore/page/FrameView.h
+++ b/src/3rdparty/webkit/WebCore/page/FrameView.h
@@ -139,7 +139,7 @@ public:
virtual void scrollRectIntoViewRecursively(const IntRect&);
virtual void setScrollPosition(const IntPoint&);
- void scrollPositionChanged();
+ virtual void scrollPositionChanged();
String mediaType() const;
void setMediaType(const String&);
diff --git a/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp b/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp
index 890eacd803..d7eaf25574 100644
--- a/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp
+++ b/src/3rdparty/webkit/WebCore/page/SpatialNavigation.cpp
@@ -477,9 +477,8 @@ void scrollIntoView(Element* element)
// it is preferable to inflate |element|'s bounding rect a bit before
// scrolling it for accurate reason.
// Element's scrollIntoView method does not provide this flexibility.
- static const int fudgeFactor = 2;
IntRect bounds = element->getRect();
- bounds.inflate(fudgeFactor);
+ bounds.inflate(fudgeFactor());
element->renderer()->enclosingLayer()->scrollRectToVisible(bounds);
}
@@ -497,14 +496,14 @@ static void deflateIfOverlapped(IntRect& a, IntRect& b)
if (!a.intersects(b) || a.contains(b) || b.contains(a))
return;
- static const int fudgeFactor = -2;
+ int deflateFactor = -fudgeFactor();
// Avoid negative width or height values.
- if ((a.width() + 2 * fudgeFactor > 0) && (a.height() + 2 * fudgeFactor > 0))
- a.inflate(fudgeFactor);
+ if ((a.width() + 2 * deflateFactor > 0) && (a.height() + 2 * deflateFactor > 0))
+ a.inflate(deflateFactor);
- if ((b.width() + 2 * fudgeFactor > 0) && (b.height() + 2 * fudgeFactor > 0))
- b.inflate(fudgeFactor);
+ if ((b.width() + 2 * deflateFactor > 0) && (b.height() + 2 * deflateFactor > 0))
+ b.inflate(deflateFactor);
}
static bool checkNegativeCoordsForNode(Node* node, const IntRect& curRect)
diff --git a/src/3rdparty/webkit/WebCore/page/SpatialNavigation.h b/src/3rdparty/webkit/WebCore/page/SpatialNavigation.h
index 90ff1cf0e6..309b095b13 100644
--- a/src/3rdparty/webkit/WebCore/page/SpatialNavigation.h
+++ b/src/3rdparty/webkit/WebCore/page/SpatialNavigation.h
@@ -40,6 +40,11 @@ inline long long maxDistance()
return numeric_limits<long long>::max();
}
+inline unsigned int fudgeFactor()
+{
+ return 2;
+}
+
// Spatially speaking, two given elements in a web page can be:
// 1) Fully aligned: There is a full intersection between the rects, either
// vertically or horizontally.
diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp b/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp
index 5c70effada..e50ab55ed8 100644
--- a/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp
@@ -292,6 +292,7 @@ void ScrollView::valueChanged(Scrollbar* scrollbar)
if (scrollbarsSuppressed())
return;
+ scrollPositionChanged();
scrollContents(scrollDelta);
}
diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollView.h b/src/3rdparty/webkit/WebCore/platform/ScrollView.h
index 9134ddfba5..118a3108dd 100644
--- a/src/3rdparty/webkit/WebCore/platform/ScrollView.h
+++ b/src/3rdparty/webkit/WebCore/platform/ScrollView.h
@@ -302,6 +302,9 @@ private:
// Called to update the scrollbars to accurately reflect the state of the view.
void updateScrollbars(const IntSize& desiredOffset);
+ // Called when the scroll position within this view changes. FrameView overrides this to generate repaint invalidations.
+ virtual void scrollPositionChanged() {}
+
void platformInit();
void platformDestroy();
void platformAddChild(Widget*);
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index edac268f85..0100b72f99 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -641,12 +641,12 @@ void GraphicsContext::fillRect(const FloatRect& rect)
}
}
-void GraphicsContext::fillRect(const FloatRect& rect, const Color& c, ColorSpace colorSpace)
+void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorSpace colorSpace)
{
- if (paintingDisabled())
+ if (paintingDisabled() || !color.isValid())
return;
- m_data->solidColor.setColor(c);
+ m_data->solidColor.setColor(color);
QPainter* p = m_data->p();
if (m_common->state.shadowColor.isValid())
drawBorderlessRectShadow(this, p, rect);
@@ -655,7 +655,7 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& c, ColorSpace
void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color, ColorSpace colorSpace)
{
- if (paintingDisabled() || !color.alpha())
+ if (paintingDisabled() || !color.isValid() || !color.alpha())
return;
Path path = Path::createRoundedRectangle(rect, topLeft, topRight, bottomLeft, bottomRight);
@@ -717,7 +717,7 @@ void GraphicsContext::drawFocusRing(const Vector<Path>& paths, int width, int of
*/
void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int /* width */, int /* offset */, const Color& color)
{
- if (paintingDisabled())
+ if (paintingDisabled() || !color.isValid())
return;
unsigned rectCount = rects.size();
@@ -1141,8 +1141,9 @@ void GraphicsContext::setURLForRect(const KURL&, const IntRect&)
void GraphicsContext::setPlatformStrokeColor(const Color& color, ColorSpace colorSpace)
{
- if (paintingDisabled())
+ if (paintingDisabled() || !color.isValid())
return;
+
QPainter* p = m_data->p();
QPen newPen(p->pen());
m_data->solidColor.setColor(color);
@@ -1172,8 +1173,9 @@ void GraphicsContext::setPlatformStrokeThickness(float thickness)
void GraphicsContext::setPlatformFillColor(const Color& color, ColorSpace colorSpace)
{
- if (paintingDisabled())
+ if (paintingDisabled() || !color.isValid())
return;
+
m_data->solidColor.setColor(color);
m_data->p()->setBrush(m_data->solidColor);
}
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
index 1c4c275e08..d9394e12e5 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
@@ -357,14 +357,6 @@ void GraphicsLayerQtImpl::updateTransform()
return;
}
- // Simplistic depth test - we stack the item behind its parent if its computed z is lower than the parent's computed z at the item's center point.
- if (parent) {
- const QPointF centerPointMappedToRoot = rootLayer()->mapFromItem(this, m_size.width() / 2, m_size.height() / 2);
- setFlag(ItemStacksBehindParent,
- m_transformRelativeToRootLayer.mapPoint(FloatPoint3D(centerPointMappedToRoot.x(), centerPointMappedToRoot.y(), 0)).z() <
- parent->m_transformRelativeToRootLayer.mapPoint(FloatPoint3D(centerPointMappedToRoot.x(), centerPointMappedToRoot.y(), 0)).z());
- }
-
// The item is front-facing or backface-visibility is on.
setVisible(true);
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp
index ee4af7fe01..4b0c21f6aa 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp
@@ -69,12 +69,41 @@ Path& Path::operator=(const Path& other)
return *this;
}
+// Check whether a point is on the border
+bool isPointOnPathBorder(const QPolygonF& border, const QPointF& p)
+{
+ QPointF p1 = border.at(0);
+ QPointF p2;
+
+ for (int i = 1; i < border.size(); ++i) {
+ p2 = border.at(i);
+ // (x1<=x<=x2||x1=>x>=x2) && (y1<=y<=y2||y1=>y>=y2) && (y2-y1)(x-x1) == (y-y1)(x2-x1)
+ // In which, (y2-y1)(x-x1) == (y-y1)(x2-x1) is from (y2-y1)/(x2-x1) == (y-y1)/(x-x1)
+ // it want to check the slope between p1 and p2 is same with slope between p and p1,
+ // if so then the three points lie on the same line.
+ // In which, (x1<=x<=x2||x1=>x>=x2) && (y1<=y<=y2||y1=>y>=y2) want to make sure p is
+ // between p1 and p2, not outside.
+ if (((p.x() <= p1.x() && p.x() >= p2.x()) || (p.x() >= p1.x() && p.x() <= p2.x()))
+ && ((p.y() <= p1.y() && p.y() >= p2.y()) || (p.y() >= p1.y() && p.y() <= p2.y()))
+ && (p2.y() - p1.y()) * (p.x() - p1.x()) == (p.y() - p1.y()) * (p2.x() - p1.x())) {
+ return true;
+ }
+ p1 = p2;
+ }
+ return false;
+}
+
bool Path::contains(const FloatPoint& point, WindRule rule) const
{
Qt::FillRule savedRule = m_path.fillRule();
const_cast<QPainterPath*>(&m_path)->setFillRule(rule == RULE_EVENODD ? Qt::OddEvenFill : Qt::WindingFill);
bool contains = m_path.contains(point);
+
+ if (!contains) {
+ // check whether the point is on the border
+ contains = isPointOnPathBorder(m_path.toFillPolygon(), point);
+ }
const_cast<QPainterPath*>(&m_path)->setFillRule(savedRule);
return contains;
diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.h b/src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.h
index 0d98fcb1ea..e3550251bb 100644
--- a/src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.h
+++ b/src/3rdparty/webkit/WebCore/platform/network/qt/DnsPrefetchHelper.h
@@ -42,6 +42,13 @@ namespace WebCore {
if (currentLookups >= 10)
return; // do not launch more than 10 lookups at the same time
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 3)
+ currentLookups++;
+ QHostInfo::lookupHost(hostname, this, SLOT(lookedUp(QHostInfo)));
+#else
+ // This code is only needed for Qt versions that do not have
+ // the small Qt DNS cache yet.
+
QTime* entryTime = lookupCache.object(hostname);
if (entryTime && entryTime->elapsed() > 300*1000) {
// delete knowledge about lookup if it is already 300 seconds old
@@ -54,6 +61,7 @@ namespace WebCore {
currentLookups++;
QHostInfo::lookupHost(hostname, this, SLOT(lookedUp(QHostInfo)));
}
+#endif
}
void lookedUp(const QHostInfo&)
@@ -61,11 +69,14 @@ namespace WebCore {
// we do not cache the result, we throw it away.
// we currently rely on the OS to cache the results. If it does not do that
// then at least the ISP nameserver did it.
+ // Since Qt 4.6.3, Qt also has a small DNS cache.
currentLookups--;
}
protected:
+#if QT_VERSION < QT_VERSION_CHECK(4, 6, 3)
QCache<QString, QTime> lookupCache; // 100 entries
+#endif
int currentLookups;
};
diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
index 403718fa74..abeb895689 100644
--- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
@@ -49,6 +49,7 @@
#define SIGNAL_CONN Qt::QueuedConnection
#endif
+static const int gMaxRecursionLimit = 10;
namespace WebCore {
@@ -139,6 +140,7 @@ QNetworkReplyHandler::QNetworkReplyHandler(ResourceHandle* handle, LoadMode load
, m_shouldFinish(false)
, m_shouldSendResponse(false)
, m_shouldForwardData(false)
+ , m_redirectionTries(gMaxRecursionLimit)
{
const ResourceRequest &r = m_resourceHandle->request();
@@ -336,9 +338,18 @@ void QNetworkReplyHandler::sendResponseIfNeeded()
QUrl redirection = m_reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
if (redirection.isValid()) {
+ QUrl newUrl = m_reply->url().resolved(redirection);
+
+ m_redirectionTries--;
+ if (m_redirectionTries == 0) { // 10 or more redirections to the same url is considered infinite recursion
+ ResourceError error(newUrl.host(), 400 /*bad request*/,
+ newUrl.toString(),
+ QCoreApplication::translate("QWebPage", "Redirection limit reached"));
+ client->didFail(m_resourceHandle, error);
+ return;
+ }
m_redirected = true;
- QUrl newUrl = m_reply->url().resolved(redirection);
ResourceRequest newRequest = m_resourceHandle->request();
newRequest.setURL(newUrl);
diff --git a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.h b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.h
index eb5ae3c80a..1abad4e79c 100644
--- a/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.h
+++ b/src/3rdparty/webkit/WebCore/platform/network/qt/QNetworkReplyHandler.h
@@ -82,6 +82,7 @@ private:
bool m_shouldFinish;
bool m_shouldSendResponse;
bool m_shouldForwardData;
+ int m_redirectionTries;
};
// Self destructing QIODevice for FormData
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp
index 04a2b1b0af..eb2d93489d 100644
--- a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp
@@ -114,7 +114,7 @@ static QStyleOptionSlider* styleOptionSlider(Scrollbar* scrollbar, QWidget* widg
opt.state |= QStyle::State_Horizontal;
opt.sliderValue = scrollbar->value();
opt.sliderPosition = opt.sliderValue;
- opt.pageStep = scrollbar->visibleSize();
+ opt.pageStep = scrollbar->pageStep();
opt.singleStep = scrollbar->lineStep();
opt.minimum = 0;
opt.maximum = qMax(0, scrollbar->maximum());
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/TemporaryLinkStubs.cpp b/src/3rdparty/webkit/WebCore/platform/qt/TemporaryLinkStubsQt.cpp
index 814f961516..814f961516 100644
--- a/src/3rdparty/webkit/WebCore/platform/qt/TemporaryLinkStubs.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/qt/TemporaryLinkStubsQt.cpp
diff --git a/src/3rdparty/webkit/WebKit.pri b/src/3rdparty/webkit/WebKit.pri
index e73703976d..a3ccd9dc1b 100644
--- a/src/3rdparty/webkit/WebKit.pri
+++ b/src/3rdparty/webkit/WebKit.pri
@@ -22,7 +22,7 @@ building-libs {
QMAKE_FRAMEWORKPATH = $$OUTPUT_DIR/lib $$QMAKE_FRAMEWORKPATH
} else {
win32-*|wince* {
- CONFIG(debug, debug|release):build_pass: QTWEBKITLIBNAME = $${QTWEBKITLIBNAME}d
+ !CONFIG(release, debug|release):build_pass: QTWEBKITLIBNAME = $${QTWEBKITLIBNAME}d
QTWEBKITLIBNAME = $${QTWEBKITLIBNAME}$${QT_MAJOR_VERSION}
win32-g++: LIBS += -l$$QTWEBKITLIBNAME
else: LIBS += $${QTWEBKITLIBNAME}.lib
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
index 0c13e43781..75a23d92a8 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp
@@ -82,7 +82,6 @@ public:
, page(0)
, resizesToContents(false)
#if USE(ACCELERATED_COMPOSITING)
- , rootGraphicsLayer(0)
, shouldSync(false)
#endif
{
@@ -158,7 +157,7 @@ public:
enum { RootGraphicsLayerZValue, OverlayZValue };
#if USE(ACCELERATED_COMPOSITING)
- QGraphicsItem* rootGraphicsLayer;
+ QWeakPointer<QGraphicsObject> rootGraphicsLayer;
// we need to sync the layers if we get a special call from the WebCore
// compositor telling us to do so. We'll get that call from ChromeClientQt
bool shouldSync;
@@ -171,12 +170,11 @@ public:
QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate()
{
#if USE(ACCELERATED_COMPOSITING)
- if (rootGraphicsLayer) {
- // we don't need to delete the root graphics layer
- // The lifecycle is managed in GraphicsLayerQt.cpp
- rootGraphicsLayer->setParentItem(0);
- q->scene()->removeItem(rootGraphicsLayer);
- }
+ if (!rootGraphicsLayer)
+ return;
+ // we don't need to delete the root graphics layer. The lifecycle is managed in GraphicsLayerQt.cpp.
+ rootGraphicsLayer.data()->setParentItem(0);
+ q->scene()->removeItem(rootGraphicsLayer.data());
#endif
}
@@ -204,12 +202,12 @@ void QGraphicsWebViewPrivate::createOrDeleteOverlay()
void QGraphicsWebViewPrivate::setRootGraphicsLayer(QGraphicsItem* layer)
{
if (rootGraphicsLayer) {
- rootGraphicsLayer->setParentItem(0);
- q->scene()->removeItem(rootGraphicsLayer);
+ rootGraphicsLayer.data()->setParentItem(0);
+ q->scene()->removeItem(rootGraphicsLayer.data());
QWebFramePrivate::core(q->page()->mainFrame())->view()->syncCompositingStateRecursive();
}
- rootGraphicsLayer = layer;
+ rootGraphicsLayer = layer ? layer->toGraphicsObject() : 0;
if (layer) {
layer->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
@@ -231,7 +229,7 @@ void QGraphicsWebViewPrivate::updateCompositingScrollPosition()
{
if (rootGraphicsLayer && q->page() && q->page()->mainFrame()) {
const QPoint scrollPosition = q->page()->mainFrame()->scrollPosition();
- rootGraphicsLayer->setPos(-scrollPosition);
+ rootGraphicsLayer.data()->setPos(-scrollPosition);
}
}
#endif
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp
index 4e8fd30bd7..ba039c7fca 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp
@@ -39,8 +39,10 @@ using namespace WebCore;
access on a local computer through JavaScript. QWebDatabase is the C++ interface to these
databases.
- To get access to all databases defined by a security origin, use QWebSecurityOrigin::databases().
- Each database has an internal name(), as well as a user-friendly name, provided by displayName().
+ Databases are grouped together in security origins. To get access to all databases defined by
+ a security origin, use QWebSecurityOrigin::databases(). Each database has an internal name(),
+ as well as a user-friendly name, provided by displayName(). These names are specified when
+ creating the database in the JavaScript code.
WebKit uses SQLite to create and access the local SQL databases. The location of the database
file in the local file system is returned by fileName(). You can access the database directly
@@ -49,7 +51,7 @@ using namespace WebCore;
For each database the web site can define an expectedSize(). The current size of the database
in bytes is returned by size().
- For more information refer to the \l{http://dev.w3.org/html5/webdatabase/}{HTML 5 Draft Standard}.
+ For more information refer to the \l{http://dev.w3.org/html5/webdatabase/}{HTML5 Web SQL Database Draft Standard}.
\sa QWebSecurityOrigin
*/
@@ -80,7 +82,7 @@ QString QWebDatabase::name() const
}
/*!
- Returns the name of the database as seen by the user.
+ Returns the name of the database in a format that is suitable for display to the user.
*/
QString QWebDatabase::displayName() const
{
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp
index 955206d1ac..69146a2f71 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp
@@ -84,13 +84,27 @@ public:
\snippet webkitsnippets/webelement/main.cpp Traversing with QWebElement
+ Individual elements can be inspected or changed using methods such as attribute()
+ or setAttribute(). For examle, to capture the user's input in a text field for later
+ use (auto-completion), a browser could do something like this:
+
+ \snippet webkitsnippets/webelement/main.cpp autocomplete1
+
+ When the same page is later revisited, the browser can fill in the text field automatically
+ by modifying the value attribute of the input element:
+
+ \snippet webkitsnippets/webelement/main.cpp autocomplete2
+
+ Another use case is to emulate a click event on an element. The following
+ code snippet demonstrates how to call the JavaScript DOM method click() of
+ a submit button:
+
+ \snippet webkitsnippets/webelement/main.cpp Calling a DOM element method
+
The underlying content of QWebElement is explicitly shared. Creating a copy
of a QWebElement does not create a copy of the content. Instead, both
instances point to the same element.
- The element's attributes can be read using attribute() and modified with
- setAttribute().
-
The contents of child elements can be converted to plain text with
toPlainText(); to XHTML using toInnerXml(). To include the element's tag in
the output, use toOuterXml().
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
index 394ea176d2..44cc3b5417 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
@@ -552,8 +552,10 @@ void QWebFramePrivate::renderRelativeCoords(GraphicsContext* context, QWebFrame:
can connect to the web page's \l{QWebPage::}{frameCreated()} signal
to be notified when a new frame is created.
- The hitTestContent() function can be used to programmatically examine the
- contents of a frame.
+ There are multiple ways to programmatically examine the contents of a frame.
+ The hitTestContent() function can be used to find elements by coordinate.
+ For access to the underlying DOM tree, there is documentElement(),
+ findAllElements() and findFirstElement().
A QWebFrame can be printed onto a QPrinter using the print() function.
This function is marked as a slot and can be conveniently connected to
@@ -781,6 +783,10 @@ static inline QUrl ensureAbsoluteUrl(const QUrl &url)
\property QWebFrame::url
\brief the url of the frame currently viewed
+ Setting this property clears the view and loads the URL.
+
+ By default, this property contains an empty, invalid URL.
+
\sa urlChanged()
*/
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistoryinterface.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistoryinterface.cpp
index 80567d1e02..61cf5af3f4 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebhistoryinterface.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebhistoryinterface.cpp
@@ -41,7 +41,7 @@ static void gCleanupInterface()
/*!
Sets a new default interface, \a defaultInterface, that will be used by all of WebKit
- for managing history.
+ to keep track of visited links.
If an interface without a parent has already been set, the old interface will be deleted.
When the application exists QWebHistoryInterface will automatically delete the
@@ -68,8 +68,9 @@ void QWebHistoryInterface::setDefaultInterface(QWebHistoryInterface* defaultInte
}
/*!
- Returns the default interface that will be used by WebKit. If no
- default interface has been set, QtWebkit will not track history.
+ Returns the default interface that will be used by WebKit. If no default interface has been set,
+ Webkit will not keep track of visited links and a null pointer will be returned.
+ \sa setDefaultInterface
*/
QWebHistoryInterface* QWebHistoryInterface::defaultInterface()
{
@@ -84,11 +85,15 @@ QWebHistoryInterface* QWebHistoryInterface::defaultInterface()
\inmodule QtWebKit
The QWebHistoryInterface is an interface that can be used to
- implement link history. It contains two pure virtual methods that
- are called by the WebKit engine. addHistoryEntry() is used to add
- pages that have been visited to the interface, while
- historyContains() is used to query whether this page has been
- visited by the user.
+ keep track of visited links. It contains two pure virtual methods that
+ are called by the WebKit engine: addHistoryEntry() is used to add
+ urls that have been visited to the interface, while
+ historyContains() is used to query whether the given url has been
+ visited by the user. By default the QWebHistoryInterface is not set, so WebKit does not keep
+ track of visited links.
+
+ \note The history tracked by QWebHistoryInterface is not specific to an instance of QWebPage
+ but applies to all pages.
*/
/*!
@@ -100,7 +105,7 @@ QWebHistoryInterface::QWebHistoryInterface(QObject* parent)
}
/*!
- Destructor. If this is currently the default interface it will be unset.
+ Destroys the interface. If this is currently the default interface it will be unset.
*/
QWebHistoryInterface::~QWebHistoryInterface()
{
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp
index c0e5277710..802ea98048 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebinspector.cpp
@@ -31,17 +31,23 @@
/*!
\class QWebInspector
\since 4.6
+ \inmodule QtWebKit
\brief The QWebInspector class allows the placement and control of a
QWebPage's inspector.
- The inspector allows you to see a page current hierarchy and loading
- statistics.
+ The inspector can display a page's hierarchy, its loading statistics and
+ the current state of its individual elements. It is mostly used by web
+ developers.
- The QWebPage to be inspected is determined with the setPage() method.
+ The QWebPage to be inspected must be specified using the setPage() method.
A typical use of QWebInspector follows:
\snippet webkitsnippets/qtwebkit_qwebinspector_snippet.cpp 0
+ A QWebInspector can be made visible either programmatically using
+ setVisible(), or by the user through the attached QWebPage's context
+ menu.
+
\note A QWebInspector will display a blank widget if either:
\list
\o page() is null
@@ -61,17 +67,16 @@
\section1 Inspector configuration persistence
The inspector allows the user to configure some options through its
- interface (e.g. the resource tracking "Always enable" option).
- These settings are persisted automatically by QtWebKit using QSettings.
-
- However since the QSettings object is instantiated using the empty
- constructor, QCoreApplication::setOrganizationName() and
- QCoreApplication::setApplicationName() must be called within your
- application to enable the persistence of these options.
+ user interface (e.g. the resource tracking "Always enable" option).
+ These settings will be persisted automatically by QtWebKit only if
+ your application previously called QCoreApplication::setOrganizationName()
+ and QCoreApplication::setApplicationName().
+ See QSettings's default constructor documentation for an explanation
+ of why this is necessary.
*/
/*!
- Constructs an empty QWebInspector with parent \a parent.
+ Constructs an unbound QWebInspector with \a parent as its parent.
*/
QWebInspector::QWebInspector(QWidget* parent)
: QWidget(parent)
@@ -89,16 +94,16 @@ QWebInspector::~QWebInspector()
}
/*!
- Sets the QWebPage to be inspected.
-
- There can only be one QWebInspector associated with a QWebPage
- and vices versa.
+ Bind this inspector to the QWebPage to be inspected.
- Calling with \a page as null will break the current association, if any.
-
- If \a page is already associated to another QWebInspector, the association
- will be replaced and the previous QWebInspector will have no page
- associated.
+ \bold {Notes:}
+ \list
+ \o There can only be one QWebInspector associated with a QWebPage
+ and vice versa.
+ \o Calling this method with a null \a page will break the current association, if any.
+ \o If \a page is already associated to another QWebInspector, the association
+ will be replaced and the previous QWebInspector will become unbound
+ \endlist
\sa page()
*/
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebkitversion.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebkitversion.cpp
index 062839fab0..181913ba32 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebkitversion.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebkitversion.cpp
@@ -22,11 +22,21 @@
#include <WebKitVersion.h>
/*!
-
+ \relates QWebPage
+ \since 4.6
Returns the version number of WebKit at run-time as a string (for
- example, "531.3"). This is the version of WebKit the application
- was compiled against.
+ example, "531.3").
+
+ This version is commonly used in WebKit based browsers as part
+ of the user agent string. Web servers and JavaScript might use
+ it to identify the presence of certain WebKit engine features
+ and behaviour.
+ The evolution of this version is bound to the releases of Apple's
+ Safari browser. For a version specific to the QtWebKit library,
+ see QTWEBKIT_VERSION
+
+ \sa QWebPage::userAgentForUrl()
*/
QString qWebKitVersion()
{
@@ -34,11 +44,13 @@ QString qWebKitVersion()
}
/*!
-
+ \relates QWebPage
+ \since 4.6
Returns the 'major' version number of WebKit at run-time as an integer
(for example, 531). This is the version of WebKit the application
was compiled against.
+ \sa qWebKitVersion()
*/
int qWebKitMajorVersion()
{
@@ -46,13 +58,57 @@ int qWebKitMajorVersion()
}
/*!
-
+ \relates QWebPage
+ \since 4.6
Returns the 'minor' version number of WebKit at run-time as an integer
(for example, 3). This is the version of WebKit the application
was compiled against.
+ \sa qWebKitVersion()
*/
int qWebKitMinorVersion()
{
return WEBKIT_MINOR_VERSION;
}
+
+/*!
+ \macro QTWEBKIT_VERSION
+ \relates QWebPage
+
+ This macro expands a numeric value of the form 0xMMNNPP (MM =
+ major, NN = minor, PP = patch) that specifies QtWebKit's version
+ number. For example, if you compile your application against QtWebKit
+ 2.1.2, the QTWEBKIT_VERSION macro will expand to 0x020102.
+
+ You can use QTWEBKIT_VERSION to use the latest QtWebKit API where
+ available.
+
+ \sa QT_VERSION
+*/
+
+/*!
+ \macro QTWEBKIT_VERSION_STR
+ \relates QWebPage
+
+ This macro expands to a string that specifies QtWebKit's version number
+ (for example, "2.1.2"). This is the version against which the
+ application is compiled.
+
+ \sa QTWEBKIT_VERSION
+*/
+
+/*!
+ \macro QTWEBKIT_VERSION_CHECK
+ \relates QWebPage
+
+ Turns the major, minor and patch numbers of a version into an
+ integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can
+ be compared with another similarly processed version id, for example
+ in a preprocessor statement:
+
+ \code
+ #if QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 1, 0)
+ // code to use API new in QtWebKit 2.1.0
+ #endif
+ \endcode
+*/
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index b8b50b780c..c5f508f561 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -119,15 +119,6 @@
using namespace WebCore;
-void QWEBKIT_EXPORT qt_wrt_setViewMode(QWebPage* page, const QString& mode)
-{
- QWebPagePrivate::priv(page)->viewMode = mode;
- WebCore::Frame* frame = QWebFramePrivate::core(page->mainFrame());
- WebCore::FrameView* view = frame->view();
- frame->document()->updateStyleSelector();
- view->forceLayout();
-}
-
void QWEBKIT_EXPORT qt_drt_overwritePluginDirectories()
{
PluginDatabase* db = PluginDatabase::installedPlugins(/* populate */ false);
@@ -1361,6 +1352,26 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev)
ev->accept();
}
+void QWebPagePrivate::dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent* event)
+{
+ if (event->propertyName() == "_q_viewMode") {
+ QString mode = q->property("_q_viewMode").toString();
+ if (mode != viewMode) {
+ viewMode = mode;
+ WebCore::Frame* frame = QWebFramePrivate::core(q->mainFrame());
+ WebCore::FrameView* view = frame->view();
+ frame->document()->updateStyleSelector();
+ view->forceLayout();
+ }
+ } else if (event->propertyName() == "_q_HTMLTokenizerChunkSize") {
+ int chunkSize = q->property("_q_HTMLTokenizerChunkSize").toInt();
+ q->handle()->page->setCustomHTMLTokenizerChunkSize(chunkSize);
+ } else if (event->propertyName() == "_q_HTMLTokenizerTimeDelay") {
+ double timeDelay = q->property("_q_HTMLTokenizerTimeDelay").toDouble();
+ q->handle()->page->setCustomHTMLTokenizerTimeDelay(timeDelay);
+ }
+}
+
void QWebPagePrivate::shortcutOverrideEvent(QKeyEvent* event)
{
WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();
@@ -1616,7 +1627,7 @@ InspectorController* QWebPagePrivate::inspectorController()
/*!
\enum QWebPage::FindFlag
- This enum describes the options available to QWebPage's findText() function. The options
+ This enum describes the options available to the findText() function. The options
can be OR-ed together from the following list:
\value FindBackward Searches backwards instead of forwards.
@@ -1637,6 +1648,8 @@ InspectorController* QWebPagePrivate::inspectorController()
\value DelegateExternalLinks When activating links that point to documents not stored on the
local filesystem or an equivalent - such as the Qt resource system - then linkClicked() is emitted.
\value DelegateAllLinks Whenever a link is activated the linkClicked() signal is emitted.
+
+ \sa QWebPage::linkDelegationPolicy
*/
/*!
@@ -1651,6 +1664,8 @@ InspectorController* QWebPagePrivate::inspectorController()
\value NavigationTypeReload The user activated the reload action.
\value NavigationTypeFormResubmitted An HTML form was submitted a second time.
\value NavigationTypeOther A navigation to another document using a method not listed above.
+
+ \sa acceptNavigationRequest()
*/
/*!
@@ -1660,7 +1675,7 @@ InspectorController* QWebPagePrivate::inspectorController()
Actions only have an effect when they are applicable. The availability of
actions can be be determined by checking \l{QAction::}{isEnabled()} on the
- action returned by \l{QWebPage::}{action()}.
+ action returned by action().
One method of enabling the text editing, cursor movement, and text selection actions
is by setting \l contentEditable to true.
@@ -1742,6 +1757,8 @@ InspectorController* QWebPagePrivate::inspectorController()
/*!
\enum QWebPage::WebWindowType
+ This enum describes the types of window that can be created by the createWindow() function.
+
\value WebBrowserWindow The window is a regular web browser window.
\value WebModalDialog The window acts as modal dialog.
*/
@@ -1758,11 +1775,13 @@ InspectorController* QWebPagePrivate::inspectorController()
to provide functionality like QWebView in a widget-less environment.
QWebPage's API is very similar to QWebView, as you are still provided with
- common functions like action() (known as \l{QWebView::}{pageAction()} in
- QWebView), triggerAction(), findText() and settings(). More QWebView-like
- functions can be found in the main frame of QWebPage, obtained via
- QWebPage::mainFrame(). For example, the load(), setUrl() and setHtml()
- unctions for QWebPage can be accessed using QWebFrame.
+ common functions like action() (known as
+ \l{QWebView::pageAction()}{pageAction}() in QWebView), triggerAction(),
+ findText() and settings(). More QWebView-like functions can be found in the
+ main frame of QWebPage, obtained via the mainFrame() function. For example,
+ the \l{QWebFrame::load()}{load}(), \l{QWebFrame::setUrl()}{setUrl}() and
+ \l{QWebFrame::setHtml()}{setHtml}() functions for QWebPage can be accessed
+ using QWebFrame.
The loadStarted() signal is emitted when the page begins to load.The
loadProgress() signal, on the other hand, is emitted whenever an element
@@ -1866,7 +1885,8 @@ QWebFrame *QWebPage::currentFrame() const
/*!
\since 4.6
- Returns the frame at the given point \a pos.
+ Returns the frame at the given point \a pos, or 0 if there is no frame at
+ that position.
\sa mainFrame(), currentFrame()
*/
@@ -1985,7 +2005,7 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg)
result should be written to \a result and true should be returned. If the prompt was not cancelled by the
user, the implementation should return true and the result string must not be null.
- The default implementation uses QInputDialog::getText.
+ The default implementation uses QInputDialog::getText().
*/
bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QString& defaultValue, QString* result)
{
@@ -2199,6 +2219,8 @@ QSize QWebPage::viewportSize() const
By default, for a newly-created Web page, this property contains a size with
zero width and height.
+
+ \sa QWebFrame::render(), preferredContentsSize
*/
void QWebPage::setViewportSize(const QSize &size) const
{
@@ -2227,11 +2249,12 @@ QSize QWebPage::preferredContentsSize() const
/*!
\property QWebPage::preferredContentsSize
\since 4.6
- \brief the size of the fixed layout
+ \brief the preferred size of the contents
- The size affects the layout of the page in the viewport. If set to a fixed size of
- 1024x768 for example then webkit will layout the page as if the viewport were that size
- rather than something different.
+ If this property is set to a valid size, it is used to lay out the page.
+ If it is not set (the default), the viewport size is used instead.
+
+ \sa viewportSize
*/
void QWebPage::setPreferredContentsSize(const QSize &size) const
{
@@ -2579,9 +2602,11 @@ QAction *QWebPage::action(WebAction action) const
/*!
\property QWebPage::modified
- \brief whether the page contains unsubmitted form data
+ \brief whether the page contains unsubmitted form data, or the contents have been changed.
By default, this property is false.
+
+ \sa contentsChanged(), contentEditable, undoStack()
*/
bool QWebPage::isModified() const
{
@@ -2597,6 +2622,8 @@ bool QWebPage::isModified() const
#ifndef QT_NO_UNDOSTACK
/*!
Returns a pointer to the undo stack used for editable content.
+
+ \sa modified
*/
QUndoStack *QWebPage::undoStack() const
{
@@ -2708,6 +2735,9 @@ bool QWebPage::event(QEvent *ev)
d->touchEvent(static_cast<QTouchEvent*>(ev));
break;
#endif
+ case QEvent::DynamicPropertyChange:
+ d->dynamicPropertyChangeEvent(static_cast<QDynamicPropertyChangeEvent*>(ev));
+ break;
default:
return QObject::event(ev);
}
@@ -2716,7 +2746,7 @@ bool QWebPage::event(QEvent *ev)
}
/*!
- Similar to QWidget::focusNextPrevChild it focuses the next focusable web element
+ Similar to QWidget::focusNextPrevChild() it focuses the next focusable web element
if \a next is true; otherwise the previous element is focused.
Returns true if it can find a new focusable element, or false if it can't.
@@ -2743,6 +2773,8 @@ bool QWebPage::focusNextPrevChild(bool next)
If this property is enabled the contents of the page can be edited by the user through a visible
cursor. If disabled (the default) only HTML elements in the web page with their
\c{contenteditable} attribute set are editable.
+
+ \sa modified, contentsChanged(), WebAction
*/
void QWebPage::setContentEditable(bool editable)
{
@@ -2912,17 +2944,21 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos)
as a result of the user clicking on a "file upload" button in a HTML form where multiple
file selection is allowed.
- \omitvalue ErrorPageExtension (introduced in Qt 4.6)
+ \value ErrorPageExtension Whether the web page can provide an error page when loading fails.
+ (introduced in Qt 4.6)
+
+ \sa ChooseMultipleFilesExtensionOption, ChooseMultipleFilesExtensionReturn, ErrorPageExtensionOption, ErrorPageExtensionReturn
*/
/*!
\enum QWebPage::ErrorDomain
\since 4.6
- \internal
- \value QtNetwork
- \value Http
- \value WebKit
+ This enum describes the domain of an ErrorPageExtensionOption object (i.e. the layer in which the error occurred).
+
+ \value QtNetwork The error occurred in the QtNetwork layer; the error code is of type QNetworkReply::NetworkError.
+ \value Http The error occurred in the HTTP layer; the error code is a HTTP status code (see QNetworkRequest::HttpStatusCodeAttribute).
+ \value WebKit The error is an internal WebKit error.
*/
/*!
@@ -2932,7 +2968,18 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos)
\inmodule QtWebKit
- \sa QWebPage::extension()
+ \sa QWebPage::extension() QWebPage::ExtensionReturn
+*/
+
+
+/*!
+ \class QWebPage::ExtensionReturn
+ \since 4.4
+ \brief The ExtensionReturn class provides an output result from a QWebPage's extension.
+
+ \inmodule QtWebKit
+
+ \sa QWebPage::extension() QWebPage::ExtensionOption
*/
/*!
@@ -2943,12 +2990,38 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos)
\inmodule QtWebKit
- The ErrorPageExtensionOption class holds the \a url for which an error occoured as well as
+ The ErrorPageExtensionOption class holds the \a url for which an error occurred as well as
the associated \a frame.
The error itself is reported by an error \a domain, the \a error code as well as \a errorString.
- \sa QWebPage::ErrorPageExtensionReturn
+ \sa QWebPage::extension() QWebPage::ErrorPageExtensionReturn
+*/
+
+/*!
+ \variable QWebPage::ErrorPageExtensionOption::url
+ \brief the url for which an error occurred
+*/
+
+/*!
+ \variable QWebPage::ErrorPageExtensionOption::frame
+ \brief the frame associated with the error
+*/
+
+/*!
+ \variable QWebPage::ErrorPageExtensionOption::domain
+ \brief the domain that reported the error
+*/
+
+/*!
+ \variable QWebPage::ErrorPageExtensionOption::error
+ \brief the error code. Interpretation of the value depends on the \a domain
+ \sa QWebPage::ErrorDomain
+*/
+
+/*!
+ \variable QWebPage::ErrorPageExtensionOption::errorString
+ \brief a string that describes the error
*/
/*!
@@ -2969,7 +3042,7 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos)
External objects such as stylesheets or images referenced in the HTML are located relative to
\a baseUrl.
- \sa QWebPage::ErrorPageExtensionOption, QString::toUtf8()
+ \sa QWebPage::extension() QWebPage::ErrorPageExtensionOption, QString::toUtf8()
*/
/*!
@@ -2978,6 +3051,29 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos)
Constructs a new error page object.
*/
+
+/*!
+ \variable QWebPage::ErrorPageExtensionReturn::contentType
+ \brief the error page's content type
+*/
+
+/*!
+ \variable QWebPage::ErrorPageExtensionReturn::encoding
+ \brief the error page encoding
+*/
+
+/*!
+ \variable QWebPage::ErrorPageExtensionReturn::baseUrl
+ \brief the base url
+
+ External objects such as stylesheets or images referenced in the HTML are located relative to this url.
+*/
+
+/*!
+ \variable QWebPage::ErrorPageExtensionReturn::content
+ \brief the HTML content of the error page
+*/
+
/*!
\class QWebPage::ChooseMultipleFilesExtensionOption
\since 4.5
@@ -2989,7 +3085,22 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos)
The ChooseMultipleFilesExtensionOption class holds the frame originating the request
and the suggested filenames which might be provided.
- \sa QWebPage::chooseFile(), QWebPage::ChooseMultipleFilesExtensionReturn
+ \sa QWebPage::extension() QWebPage::chooseFile(), QWebPage::ChooseMultipleFilesExtensionReturn
+*/
+
+/*!
+ \variable QWebPage::ChooseMultipleFilesExtensionOption::parentFrame
+ \brief The frame in which the request originated
+*/
+
+/*!
+ \variable QWebPage::ChooseMultipleFilesExtensionOption::suggestedFileNames
+ \brief The suggested filenames
+*/
+
+/*!
+ \variable QWebPage::ChooseMultipleFilesExtensionReturn::fileNames
+ \brief The selected filenames
*/
/*!
@@ -3003,14 +3114,17 @@ void QWebPage::updatePositionDependentActions(const QPoint &pos)
The ChooseMultipleFilesExtensionReturn class holds the filenames selected by the user
when the extension is invoked.
- \sa QWebPage::ChooseMultipleFilesExtensionOption
+ \sa QWebPage::extension() QWebPage::ChooseMultipleFilesExtensionOption
*/
/*!
This virtual function can be reimplemented in a QWebPage subclass to provide support for extensions. The \a option
argument is provided as input to the extension; the output results can be stored in \a output.
- The behavior of this function is determined by \a extension.
+ The behavior of this function is determined by \a extension. The \a option
+ and \a output values are typically casted to the corresponding types (for
+ example, ChooseMultipleFilesExtensionOption and
+ ChooseMultipleFilesExtensionReturn for ChooseMultipleFilesExtension).
You can call supportsExtension() to check if an extension is supported by the page.
@@ -3102,6 +3216,8 @@ QWebSettings *QWebPage::settings() const
A suggested filename may be provided in \a suggestedFile. The frame originating the
request is provided as \a parentFrame.
+
+ \sa ChooseMultipleFilesExtension
*/
QString QWebPage::chooseFile(QWebFrame *parentFrame, const QString& suggestedFile)
{
@@ -3355,6 +3471,15 @@ QString QWebPage::userAgentForUrl(const QUrl&) const
case QSysInfo::SV_9_4:
firstPartTemp += QString::fromLatin1("/9.4");
break;
+ case QSysInfo::SV_SF_2:
+ firstPartTemp += QString::fromLatin1("^2");
+ break;
+ case QSysInfo::SV_SF_3:
+ firstPartTemp += QString::fromLatin1("^3");
+ break;
+ case QSysInfo::SV_SF_4:
+ firstPartTemp += QString::fromLatin1("^4");
+ break;
default:
firstPartTemp += QString::fromLatin1("/Unknown");
}
@@ -3465,7 +3590,7 @@ quint64 QWebPage::totalBytes() const
/*!
Returns the number of bytes that were received from the network to render the current page.
- \sa totalBytes()
+ \sa totalBytes(), loadProgress()
*/
quint64 QWebPage::bytesReceived() const
{
@@ -3497,7 +3622,7 @@ quint64 QWebPage::bytesReceived() const
This signal is emitted when a load of the page is finished.
\a ok will indicate whether the load was successful or any error occurred.
- \sa loadStarted()
+ \sa loadStarted(), ErrorPageExtension
*/
/*!
@@ -3524,12 +3649,15 @@ quint64 QWebPage::bytesReceived() const
\fn void QWebPage::frameCreated(QWebFrame *frame)
This signal is emitted whenever the page creates a new \a frame.
+
+ \sa currentFrame()
*/
/*!
\fn void QWebPage::selectionChanged()
- This signal is emitted whenever the selection changes.
+ This signal is emitted whenever the selection changes, either interactively
+ or programmatically (e.g. by calling triggerAction() with a selection action).
\sa selectedText()
*/
@@ -3541,7 +3669,7 @@ quint64 QWebPage::bytesReceived() const
This signal is emitted whenever the text in form elements changes
as well as other editable content.
- \sa contentEditable, QWebFrame::toHtml(), QWebFrame::toPlainText()
+ \sa contentEditable, modified, QWebFrame::toHtml(), QWebFrame::toPlainText()
*/
/*!
@@ -3617,9 +3745,9 @@ quint64 QWebPage::bytesReceived() const
\fn void QWebPage::microFocusChanged()
This signal is emitted when for example the position of the cursor in an editable form
- element changes. It is used inform input methods about the new on-screen position where
- the user is able to enter text. This signal is usually connected to QWidget's updateMicroFocus()
- slot.
+ element changes. It is used to inform input methods about the new on-screen position where
+ the user is able to enter text. This signal is usually connected to the
+ QWidget::updateMicroFocus() slot.
*/
/*!
@@ -3660,6 +3788,8 @@ quint64 QWebPage::bytesReceived() const
This signal is emitted whenever the web site shown in \a frame is asking to store data
to the database \a databaseName and the quota allocated to that web site is exceeded.
+
+ \sa QWebDatabase
*/
/*!
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
index 0712d0cc39..5350cd908d 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
@@ -112,6 +112,8 @@ public:
void inputMethodEvent(QInputMethodEvent*);
+ void dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent*);
+
void shortcutOverrideEvent(QKeyEvent*);
void leaveEvent(QEvent*);
void handleClipboard(QEvent*, Qt::MouseButton);
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpluginfactory.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpluginfactory.cpp
index 8ff13b10d9..f715430526 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpluginfactory.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpluginfactory.cpp
@@ -23,25 +23,40 @@
/*!
\class QWebPluginFactory
\since 4.4
- \brief The QWebPluginFactory class creates plugins to be embedded into web
- pages.
+ \brief The QWebPluginFactory class is used to embed custom data types in web pages.
\inmodule QtWebKit
- QWebPluginFactory is a factory for creating plugins for QWebPage. A plugin
- factory can be installed on a QWebPage using QWebPage::setPluginFactory().
+ The HTML \c{<object>} tag is used to embed arbitrary content into a web page,
+ for example:
+
+ \code
+ <object type="application/x-pdf" data="http://qt.nokia.com/document.pdf" width="500" height="400"></object>
+ \endcode
+
+ QtWebkit will natively handle the most basic data types like \c{text/html} and
+ \c{image/jpeg}, but for any advanced or custom data types you will need to
+ provide a handler yourself.
+
+ QWebPluginFactory is a factory for creating plugins for QWebPage, where each
+ plugin provides support for one or more data types. A plugin factory can be
+ installed on a QWebPage using QWebPage::setPluginFactory().
\note The plugin factory is only used if plugins are enabled through QWebSettings.
- You can provide a QWebPluginFactory by implementing the plugins() and the
- create() method. For plugins() it is necessary to describe the plugins the
+ You provide a QWebPluginFactory by implementing the plugins() and the
+ create() methods. For plugins() it is necessary to describe the plugins the
factory can create, including a description and the supported MIME types.
The MIME types each plugin can handle should match the ones specified in
- in the HTML \c{<object>} tag.
+ in the HTML \c{<object>} tag of your content.
The create() method is called if the requested MIME type is supported. The
implementation has to return a new instance of the plugin requested for the
given MIME type and the specified URL.
+
+ The plugins themselves are subclasses of QObject, but currently only plugins
+ based on either QWidget or QGraphicsWidget are supported.
+
*/
@@ -183,6 +198,7 @@ void QWebPluginFactory::refreshPlugins()
/*!
\enum QWebPluginFactory::Extension
+ \internal
This enum describes the types of extensions that the plugin factory can support. Before using these extensions, you
should verify that the extension is supported by calling supportsExtension().
@@ -192,6 +208,7 @@ void QWebPluginFactory::refreshPlugins()
/*!
\class QWebPluginFactory::ExtensionOption
+ \internal
\since 4.4
\brief The ExtensionOption class provides an extended input argument to QWebPluginFactory's extension support.
@@ -202,6 +219,7 @@ void QWebPluginFactory::refreshPlugins()
/*!
\class QWebPluginFactory::ExtensionReturn
+ \internal
\since 4.4
\brief The ExtensionOption class provides an extended output argument to QWebPluginFactory's extension support.
@@ -214,6 +232,8 @@ void QWebPluginFactory::refreshPlugins()
This virtual function can be reimplemented in a QWebPluginFactory subclass to provide support for extensions. The \a option
argument is provided as input to the extension; the output results can be stored in \a output.
+ \internal
+
The behaviour of this function is determined by \a extension.
You can call supportsExtension() to check if an extension is supported by the factory.
@@ -233,6 +253,8 @@ bool QWebPluginFactory::extension(Extension extension, const ExtensionOption *op
/*!
This virtual function returns true if the plugin factory supports \a extension; otherwise false is returned.
+ \internal
+
\sa extension()
*/
bool QWebPluginFactory::supportsExtension(Extension extension) const
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp
index 6c26bd7ab4..7179eaa10c 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp
@@ -63,6 +63,16 @@ void QWEBKIT_EXPORT qt_drt_setDomainRelaxationForbiddenForURLScheme(bool forbidd
\c{http://www.malicious.com/evil.html} from accessing \c{http://www.example.com/}'s resources,
because they are of a different security origin.
+ By default local schemes like \c{file://} and \c{qrc://} are concidered to be in the same
+ security origin, and can access each other's resources. You can add additional local schemes
+ by using QWebSecurityOrigin::addLocalScheme(), or override the default same-origin behavior
+ by setting QWebSettings::LocalContentCanAccessFileUrls to \c{false}.
+
+ \note Local resources are by default restricted from accessing remote content, which
+ means your \c{file://} will not be able to access \c{http://domain.com/foo.html}. You
+ can relax this restriction by setting QWebSettings::LocalContentCanAccessRemoteUrls to
+ \c{true}.
+
Call QWebFrame::securityOrigin() to get the QWebSecurityOrigin for a frame in a
web page, and use host(), scheme() and port() to identify the security origin.
@@ -219,7 +229,11 @@ QList<QWebDatabase> QWebSecurityOrigin::databases() const
\since 4.6
Adds the given \a scheme to the list of schemes that are considered equivalent
- to the \c file: scheme. They are not subject to cross domain restrictions.
+ to the \c file: scheme.
+
+ Cross domain restrictions depend on the two web settings QWebSettings::LocalContentCanAccessFileUrls
+ and QWebSettings::LocalContentCanAccessFileUrls. By default all local schemes are concidered to be
+ in the same security origin, and local schemes can not access remote content.
*/
void QWebSecurityOrigin::addLocalScheme(const QString& scheme)
{
@@ -231,6 +245,9 @@ void QWebSecurityOrigin::addLocalScheme(const QString& scheme)
Removes the given \a scheme from the list of local schemes.
+ \note You can not remove the \c{file://} scheme from the list
+ of local schemes.
+
\sa addLocalScheme()
*/
void QWebSecurityOrigin::removeLocalScheme(const QString& scheme)
@@ -240,7 +257,10 @@ void QWebSecurityOrigin::removeLocalScheme(const QString& scheme)
/*!
\since 4.6
- Returns a list of all the schemes that were set by the application as local schemes,
+ Returns a list of all the schemes concidered to be local.
+
+ By default this is \c{file://} and \c{qrc://}.
+
\sa addLocalScheme(), removeLocalScheme()
*/
QStringList QWebSecurityOrigin::localSchemes()
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
index ae7f6a83a9..115f9fc27f 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
@@ -289,8 +289,8 @@ QWebSettings* QWebSettings::globalSettings()
function. The \l{QWebSettings::WebAttribute}{WebAttribute} enum further describes
each attribute.
- QWebSettings also configures global properties such as the Web page memory
- cache and the Web page icon database, local database storage and offline
+ QWebSettings also configures global properties such as the web page memory
+ cache, icon database, local database storage and offline
applications storage.
\section1 Enabling Plugins
@@ -299,8 +299,8 @@ QWebSettings* QWebSettings::globalSettings()
\l{QWebSettings::PluginsEnabled}{PluginsEnabled} attribute. For many applications,
this attribute is enabled for all pages by setting it on the
\l{globalSettings()}{global settings object}. QtWebKit will always ignore this setting
- \when processing Qt plugins. The decision to allow a Qt plugin is made by the client
- \in its reimplementation of QWebPage::createPlugin.
+ when processing Qt plugins. The decision to allow a Qt plugin is made by the client
+ in its reimplementation of QWebPage::createPlugin().
\section1 Web Application Support
@@ -339,7 +339,7 @@ QWebSettings* QWebSettings::globalSettings()
\value MinimumFontSize The hard minimum font size.
\value MinimumLogicalFontSize The minimum logical font size that is applied
- after zooming with QWebFrame's textSizeMultiplier().
+ when zooming out with QWebFrame::setTextSizeMultiplier().
\value DefaultFontSize The default font size for regular text.
\value DefaultFixedFontSize The default font size for fixed-pitch text.
*/
@@ -361,66 +361,74 @@ QWebSettings* QWebSettings::globalSettings()
This enum describes various attributes that are configurable through QWebSettings.
\value AutoLoadImages Specifies whether images are automatically loaded in
- web pages.
+ web pages. This is enabled by default.
\value DnsPrefetchEnabled Specifies whether QtWebkit will try to pre-fetch DNS entries to
- speed up browsing. This only works as a global attribute. Only for Qt 4.6 and later.
+ speed up browsing. This only works as a global attribute. Only for Qt 4.6 and later. This is disabled by default.
\value JavascriptEnabled Enables or disables the running of JavaScript
- programs.
+ programs. This is enabled by default
\value JavaEnabled Enables or disables Java applets.
Currently Java applets are not supported.
- \value PluginsEnabled Enables or disables plugins in Web pages. Qt plugins
- with a mimetype such as "application/x-qt-plugin" are not affected by this setting.
+ \value PluginsEnabled Enables or disables plugins in Web pages (e.g. using NPAPI). Qt plugins
+ with a mimetype such as "application/x-qt-plugin" are not affected by this setting. This is disabled by default.
\value PrivateBrowsingEnabled Private browsing prevents WebKit from
- recording visited pages in the history and storing web page icons.
+ recording visited pages in the history and storing web page icons. This is disabled by default.
\value JavascriptCanOpenWindows Specifies whether JavaScript programs
- can open new windows.
+ can open new windows. This is disabled by default.
\value JavascriptCanAccessClipboard Specifies whether JavaScript programs
- can read or write to the clipboard.
+ can read or write to the clipboard. This is disabled by default.
\value DeveloperExtrasEnabled Enables extra tools for Web developers.
Currently this enables the "Inspect" element in the context menu as
- well as the use of QWebInspector which controls the WebKit WebInspector
- for web site debugging.
+ well as the use of QWebInspector which controls the web inspector
+ for web site debugging. This is disabled by default.
\value SpatialNavigationEnabled Enables or disables the Spatial Navigation
feature, which consists in the ability to navigate between focusable
elements in a Web page, such as hyperlinks and form controls, by using
- Left, Right, Up and Down arrow keys. For example, if an user presses the
+ Left, Right, Up and Down arrow keys. For example, if a user presses the
Right key, heuristics determine whether there is an element he might be
- trying to reach towards the right, and if there are multiple elements,
- which element he probably wants.
+ trying to reach towards the right and which element he probably wants.
+ This is disabled by default.
\value LinksIncludedInFocusChain Specifies whether hyperlinks should be
- included in the keyboard focus chain.
- \value ZoomTextOnly Specifies whether the zoom factor on a frame applies to
- only the text or all content.
+ included in the keyboard focus chain. This is enabled by default.
+ \value ZoomTextOnly Specifies whether the zoom factor on a frame applies
+ only to the text or to all content. This is disabled by default.
\value PrintElementBackgrounds Specifies whether the background color and images
- are also drawn when the page is printed.
+ are also drawn when the page is printed. This is enabled by default.
\value OfflineStorageDatabaseEnabled Specifies whether support for the HTML 5
- offline storage feature is enabled or not. Disabled by default.
+ offline storage feature is enabled or not. This is disabled by default.
\value OfflineWebApplicationCacheEnabled Specifies whether support for the HTML 5
- web application cache feature is enabled or not. Disabled by default.
+ web application cache feature is enabled or not. This is disabled by default.
\value LocalStorageEnabled Specifies whether support for the HTML 5
- local storage feature is enabled or not. Disabled by default.
+ local storage feature is enabled or not. This is disabled by default.
\value LocalStorageDatabaseEnabled \e{This enum value is deprecated.} Use
QWebSettings::LocalStorageEnabled instead.
- \value LocalContentCanAccessRemoteUrls Specifies whether locally loaded documents are allowed to access remote urls.
- \value LocalContentCanAccessFileUrls Specifies whether locally loaded documents are allowed to access other local urls.
- \value XSSAuditorEnabled Specifies whether load requests should be monitored for cross-site scripting attempts.
+ \value LocalContentCanAccessRemoteUrls Specifies whether locally loaded documents are
+ allowed to access remote urls. This is disabled by default. For more information
+ about security origins and local vs. remote content see QWebSecurityOrigin.
+ \value LocalContentCanAccessFileUrls Specifies whether locally loaded documents are
+ allowed to access other local urls. This is enabled by default. For more information
+ about security origins and local vs. remote content see QWebSecurityOrigin.
+ \value XSSAuditingEnabled Specifies whether load requests should be monitored for cross-site
+ scripting attempts. Suspicious scripts will be blocked and reported in the inspector's
+ JavaScript console. Enabling this feature might have an impact on performance
+ and it is disabled by default.
\value AcceleratedCompositingEnabled This feature, when used in conjunction with
QGraphicsWebView, accelerates animations of web content. CSS animations of the transform and
opacity properties will be rendered by composing the cached content of the animated elements.
- This feature is enabled by default
+ This is enabled by default.
\value TiledBackingStoreEnabled This setting enables the tiled backing store feature
for a QGraphicsWebView. With the tiled backing store enabled, the web page contents in and around
the current visible area is speculatively cached to bitmap tiles. The tiles are automatically kept
in sync with the web page as it changes. Enabling tiling can significantly speed up painting heavy
operations like scrolling. Enabling the feature increases memory consumption. It does not work well
with contents using CSS fixed positioning (see also \l{QGraphicsWebView::}{resizesToContents} property).
- \l{QGraphicsWebView::}{tiledBackingStoreFrozen} property allows application to temporarily freeze the contents of the backing store.
+ \l{QGraphicsWebView::}{tiledBackingStoreFrozen} property allows application to temporarily
+ freeze the contents of the backing store. This is disabled by default.
\value FrameFlatteningEnabled With this setting each subframe is expanded to its contents.
On touch devices, it is desired to not have any scrollable sub parts of the page
as it results in a confusing user experience, with scrolling sometimes scrolling sub parts
and at other times scrolling the page itself. For this reason iframes and framesets are
barely usable on touch devices. This will flatten all the frames to become one scrollable page.
- Disabled by default.
+ This is disabled by default.
*/
/*!
@@ -525,7 +533,8 @@ void QWebSettings::resetFontSize(FontSize type)
with UTF-8 and Base64 encoded data, such as:
"data:text/css;charset=utf-8;base64,cCB7IGJhY2tncm91bmQtY29sb3I6IHJlZCB9Ow=="
- NOTE: In case the base 64 data is not valid the style will not be applied.
+
+ \note If the base64 data is not valid, the style will not be applied.
\sa userStyleSheetUrl()
*/
@@ -576,9 +585,11 @@ QString QWebSettings::defaultTextEncoding() const
Sets the path of the icon database to \a path. The icon database is used
to store "favicons" associated with web sites.
- \a path must point to an existing directory where the icons are stored.
+ \a path must point to an existing directory.
Setting an empty path disables the icon database.
+
+ \sa iconDatabasePath(), clearIconDatabase()
*/
void QWebSettings::setIconDatabasePath(const QString& path)
{
@@ -621,7 +632,7 @@ void QWebSettings::clearIconDatabase()
/*!
Returns the web site's icon for \a url.
- If the web site does not specify an icon, or the icon is not in the
+ If the web site does not specify an icon \bold OR if the icon is not in the
database, a null QIcon is returned.
\note The returned icon's size is arbitrary.
@@ -658,7 +669,7 @@ QWebPluginDatabase *QWebSettings::pluginDatabase()
Sets \a graphic to be drawn when QtWebKit needs to draw an image of the
given \a type.
- For example, when an image cannot be loaded the pixmap specified by
+ For example, when an image cannot be loaded, the pixmap specified by
\l{QWebSettings::WebGraphic}{MissingImageGraphic} is drawn instead.
\sa webGraphic()
@@ -676,9 +687,6 @@ void QWebSettings::setWebGraphic(WebGraphic type, const QPixmap& graphic)
Returns a previously set pixmap used to draw replacement graphics of the
specified \a type.
- For example, when an image cannot be loaded the pixmap specified by
- \l{QWebSettings::WebGraphic}{MissingImageGraphic} is drawn instead.
-
\sa setWebGraphic()
*/
QPixmap QWebSettings::webGraphic(WebGraphic type)
@@ -719,8 +727,7 @@ void QWebSettings::clearMemoryCaches()
Sets the maximum number of pages to hold in the memory page cache to \a pages.
The Page Cache allows for a nicer user experience when navigating forth or back
- to pages in the forward/back history, by pausing and resuming up to \a pages
- per page group.
+ to pages in the forward/back history, by pausing and resuming up to \a pages.
For more information about the feature, please refer to:
@@ -792,8 +799,8 @@ QString QWebSettings::fontFamily(FontFamily which) const
}
/*!
- Resets the actual font family to the default font family, specified by
- \a which.
+ Resets the actual font family specified by \a which to the one set
+ in the global QWebSettings instance.
This function has no effect on the global QWebSettings instance.
*/
@@ -835,7 +842,9 @@ bool QWebSettings::testAttribute(WebAttribute attr) const
/*!
\fn void QWebSettings::resetAttribute(WebAttribute attribute)
- Resets the setting of \a attribute.
+ Resets the setting of \a attribute to the value specified in the
+ global QWebSettings instance.
+
This function has no effect on the global QWebSettings instance.
\sa globalSettings()
@@ -851,12 +860,15 @@ void QWebSettings::resetAttribute(WebAttribute attr)
/*!
\since 4.5
- Sets the path for HTML5 offline storage to \a path.
+ Sets \a path as the save location for HTML5 client-side database storage data.
- \a path must point to an existing directory where the databases are stored.
+ \a path must point to an existing directory.
Setting an empty path disables the feature.
+ Support for client-side databases can enabled by setting the
+ \l{QWebSettings::OfflineStorageDatabaseEnabled}{OfflineStorageDatabaseEnabled} attribute.
+
\sa offlineStoragePath()
*/
void QWebSettings::setOfflineStoragePath(const QString& path)
@@ -869,7 +881,7 @@ void QWebSettings::setOfflineStoragePath(const QString& path)
/*!
\since 4.5
- Returns the path of the HTML5 offline storage or an empty string if the
+ Returns the path of the HTML5 client-side database storage or an empty string if the
feature is disabled.
\sa setOfflineStoragePath()
@@ -906,22 +918,24 @@ qint64 QWebSettings::offlineStorageDefaultQuota()
/*!
\since 4.6
- \relates QWebSettings
Sets the path for HTML5 offline web application cache storage to \a path.
An application cache acts like an HTTP cache in some sense. For documents
- that use the application cache via JavaScript, the loader mechinery will
+ that use the application cache via JavaScript, the loader engine will
first ask the application cache for the contents, before hitting the
network.
The feature is described in details at:
http://dev.w3.org/html5/spec/Overview.html#appcache
- \a path must point to an existing directory where the cache is stored.
+ \a path must point to an existing directory.
Setting an empty path disables the feature.
+ Support for offline web application cache storage can enabled by setting the
+ \l{QWebSettings::OfflineWebApplicationCacheEnabled}{OfflineWebApplicationCacheEnabled} attribute.
+
\sa offlineWebApplicationCachePath()
*/
void QWebSettings::setOfflineWebApplicationCachePath(const QString& path)
@@ -933,7 +947,6 @@ void QWebSettings::setOfflineWebApplicationCachePath(const QString& path)
/*!
\since 4.6
- \relates QWebSettings
Returns the path of the HTML5 offline web application cache storage
or an empty string if the feature is disabled.
@@ -980,7 +993,6 @@ qint64 QWebSettings::offlineWebApplicationCacheQuota()
/*!
\since 4.6
- \relates QWebSettings
Sets the path for HTML5 local storage to \a path.
@@ -1025,7 +1037,6 @@ QUrl QWebSettings::inspectorUrl() const
/*!
\since 4.6
- \relates QWebSettings
Returns the path for HTML5 local storage.
@@ -1038,13 +1049,14 @@ QString QWebSettings::localStoragePath() const
/*!
\since 4.6
- \relates QWebSettings
- Enables WebKit persistent data and sets the path to \a path.
- If the \a path is empty the path for persistent data is set to the
- user-specific data location specified by
- \l{QDesktopServices::DataLocation}{DataLocation}.
-
+ Enables WebKit data persistence and sets the path to \a path.
+ If \a path is empty, the user-specific data location specified by
+ \l{QDesktopServices::DataLocation}{DataLocation} will be used instead.
+
+ This method will simultaneously set and enable the iconDatabasePath(),
+ localStoragePath(), offlineStoragePath() and offlineWebApplicationCachePath().
+
\sa localStoragePath()
*/
void QWebSettings::enablePersistentStorage(const QString& path)
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h
index d2e536edd6..3592e2c1f5 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h
@@ -63,7 +63,7 @@ public:
OfflineStorageDatabaseEnabled,
OfflineWebApplicationCacheEnabled,
LocalStorageEnabled,
-#ifdef QT_DEPRECATED
+#if defined(QT_DEPRECATED) || defined(qdoc)
LocalStorageDatabaseEnabled = LocalStorageEnabled,
#endif
LocalContentCanAccessRemoteUrls,
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index 555b14d9a8..efc8f2784e 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,160 @@
+2010-05-14 Kent Hansen <kent.hansen@nokia.com>, Jocelyn Turcotte <jocelyn.turcotte@nokia.com>, Tor Arne Vestbø <tor.arne.vestbo@nokia.com>, Henry Haverinen <henry.haverinen@nokia.com>, Jedrzej Nowacki <jedrzej.nowacki@nokia.com>, Andreas Kling <andreas.kling@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Merge overhaul of the QtWebKit API documentation
+
+ Numerous improvements in wording, qdoc warning fixes and
+ clarifications, done in a team work effort.
+
+ No functional changes.
+
+ * Api/qwebdatabase.cpp:
+ * Api/qwebelement.cpp:
+ * Api/qwebframe.cpp:
+ * Api/qwebhistoryinterface.cpp:
+ * Api/qwebinspector.cpp:
+ * Api/qwebkitversion.cpp:
+ * Api/qwebpage.cpp:
+ * Api/qwebpluginfactory.cpp:
+ * Api/qwebsecurityorigin.cpp:
+ * Api/qwebsettings.cpp:
+ * Api/qwebsettings.h:
+ * docs/qtwebkit.qdoc:
+ * docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp:
+ (wrapInFunction):
+ * docs/webkitsnippets/webelement/main.cpp:
+ (findButtonAndClick):
+ (autocomplete1):
+ (autocomplete2):
+ (main):
+
+2010-05-14 Martin Smith <msmith@trolltech.com>
+
+ Reviewed by Simon Hausmann.
+
+ Documentation: Fix overview grouping.
+
+ * docs/qtwebkit.qdoc:
+
+2010-05-14 Benjamin Poulain <benjamin.poulain@nokia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [QT] Update the Symbian version for the user agent
+ https://bugs.webkit.org/show_bug.cgi?id=38389
+
+ Update the user agent for Symbian^2 to Symbian^4
+
+ * Api/qwebpage.cpp:
+ (QWebPage::userAgentForUrl):
+
+2010-05-11 Antonio Gomes <tonikitoo@webkit.org>
+
+ Reviewed by Kenneth Christiansen.
+
+ [Qt] emit initialLayoutCompleted signal from FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout
+ https://bugs.webkit.org/show_bug.cgi?id=38921
+
+ Emit initialLayoutCompleted signal from FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout
+ instead of FrameLoaderClientQt::dispatchDidFirstLayout , because the former ensures that a
+ visual content layed out on the frame.
+
+ It matches to QWebFrame::initialLayoutCompleted signal documentation at:
+
+ "... This is the first time you will see contents displayed on the frame ..."
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::dispatchDidFirstLayout):
+ (WebCore::FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout):
+
+2010-05-11 Kenneth Rohde Christiansen <kenneth@webkit.org>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] REGRESSION(r58497) tst_QGraphicsWebView::crashOnViewlessWebPages() is failing
+ https://bugs.webkit.org/show_bug.cgi?id=38655
+
+ Fix double free by moving the connect till after the resize.
+
+ The bug is causes by the fact that a resize of an empty page causes a
+ layout, thus deleting the qgraphicswebview before setHtml is called,
+ which then deletes it again, causing a double free.
+
+ * tests/qgraphicswebview/tst_qgraphicswebview.cpp:
+ (tst_QGraphicsWebView::crashOnViewlessWebPages):
+
+2010-05-11 Diego Gonzalez <diegohcg@webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] tst_QWebPage::inputMethods failing on Maemo5
+ https://bugs.webkit.org/show_bug.cgi?id=38685
+
+ Check if the SIP (Software Input Panel) is triggered, which normally
+ happens on mobile platforms, when a user input form receives a mouse click.
+
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::inputMethods):
+
+2010-05-09 Noam Rosenthal <noam.rosenthal@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Crash in QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate when animation were used
+ https://bugs.webkit.org/show_bug.cgi?id=38574
+
+ The fix uses a QWeakPointer for rootGraphicsLayer, protecting from a crash in case the layer is deleted before the QGraphicsWebView.
+
+ * Api/qgraphicswebview.cpp:
+ (QGraphicsWebViewPrivate::QGraphicsWebViewPrivate):
+ (QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate):
+ (QGraphicsWebViewPrivate::setRootGraphicsLayer):
+ (QGraphicsWebViewPrivate::updateCompositingScrollPosition):
+
+2010-05-03 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Expose HTMLTokenizer yielding parameters
+ https://bugs.webkit.org/show_bug.cgi?id=37023
+
+ Enables to set TimeDelay and ChunkSize for
+ HTMLTokenizer.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::dynamicPropertyChangeEvent):
+
+2010-05-04 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] QWebPage viewMode property
+ https://bugs.webkit.org/show_bug.cgi?id=38119
+
+ Rename the property from wrt_viewMode to _q_viewMode.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::dynamicPropertyChangeEvent):
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::viewModes):
+
+2010-04-28 Luiz Agostini <luiz.agostini@openbossa.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] QWebPage viewMode property
+ https://bugs.webkit.org/show_bug.cgi?id=38119
+
+ Replacing method qt_wrt_setViewMode by wrt_viewMode property.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::dynamicPropertyChangeEvent):
+ (QWebPage::event):
+ * Api/qwebpage_p.h:
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::wrt_viewModes):
+
2010-04-09 Tasuku Suzuki <tasuku.suzuki@nokia.com>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 4ad008bbfb..686bfccb60 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -414,13 +414,13 @@ void FrameLoaderClientQt::dispatchDidFinishLoad()
void FrameLoaderClientQt::dispatchDidFirstLayout()
{
- if (m_webFrame)
- emit m_webFrame->initialLayoutCompleted();
+ notImplemented();
}
void FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout()
{
- notImplemented();
+ if (m_webFrame)
+ emit m_webFrame->initialLayoutCompleted();
}
void FrameLoaderClientQt::dispatchShow()
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc
index 9e653e4dc5..c6dd550335 100644
--- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc
+++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc
@@ -5,63 +5,11 @@
\previouspage QtSvg
\nextpage QtXml
\ingroup modules
+ \ingroup technology-apis
+
\brief The QtWebKit module provides a web browser engine as well as
classes to render and interact with web content.
- To include the definitions of the module's classes, use the
- following directive:
-
- \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 1
-
- To link against the module, add this line to your \l qmake \c
- .pro file:
-
- \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 0
-
- \section1 License Information
-
- This is a snapshot of the Qt port of WebKit. The exact version information
- can be found in the \c{src/3rdparty/webkit/VERSION} file supplied with Qt.
-
- Qt Commercial Edition licensees that wish to distribute applications that
- use the QtWebKit module need to be aware of their obligations under the
- GNU Library General Public License (LGPL).
-
- Developers using the Open Source Edition can choose to redistribute
- the module under the appropriate version of the GNU LGPL.
-
- \legalese
- WebKit is licensed under the GNU Library General Public License.
- Individual contributor names and copyright dates can be found
- inline in the code.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
- \endlegalese
-*/
-
-/*!
- \page webintegration.html
- \title Integrating Web Content with QtWebKit
- \since 4.4
-
- \ingroup frameworks-technologies
-
- \keyword Browser
- \keyword Web Browser
-
QtWebKit provides a Web browser engine that makes it easy to embed content
from the World Wide Web into your Qt application. At the same time Web
content can be enhanced with native controls.
@@ -83,6 +31,20 @@
QtWebKit is based on the Open Source WebKit engine. More information about
WebKit itself can be found on the \l{WebKit Open Source Project} Web site.
+ \section1 Including In Your Project
+
+ To include the definitions of the module's classes, use the
+ following directive:
+
+ \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 1
+
+ To link against the module, add this line to your \l qmake \c
+ .pro file:
+
+ \snippet webkitsnippets/qtwebkit_build_snippet.qdoc 0
+
+ \section1 Notes
+
\note Building the QtWebKit module with debugging symbols is problematic
on many platforms due to the size of the WebKit engine. We recommend
building the module only in release mode for embedded platforms.
@@ -97,10 +59,6 @@
Embedded Linux systems. See the \l{Qt for Embedded Linux Requirements}
document for more information.
- Topics:
-
- \tableofcontents
-
\section1 Architecture
The easiest way to render content is through the QWebView class. As a
@@ -193,4 +151,39 @@
\o The system \c{/Library/Internet Plug-Ins} directory
\endlist
\endtable
+
+
+ \section1 License Information
+
+ This is a snapshot of the Qt port of WebKit. The exact version information
+ can be found in the \c{src/3rdparty/webkit/VERSION} file supplied with Qt.
+
+ Qt Commercial Edition licensees that wish to distribute applications that
+ use the QtWebKit module need to be aware of their obligations under the
+ GNU Library General Public License (LGPL).
+
+ Developers using the Open Source Edition can choose to redistribute
+ the module under the appropriate version of the GNU LGPL.
+
+ \legalese
+ WebKit is licensed under the GNU Library General Public License.
+ Individual contributor names and copyright dates can be found
+ inline in the code.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ \endlegalese
*/
+
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp
index a6b662096c..07f1d452a5 100644
--- a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp
@@ -9,8 +9,6 @@ void wrapInFunction()
QWebInspector *inspector = new QWebInspector;
inspector->setPage(page);
-
- connect(page, SIGNAL(webInspectorTriggered(QWebElement)), inspector, SLOT(show()));
//! [0]
}
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp
index 822b61c4cc..b1781a6f44 100644
--- a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp
@@ -36,6 +36,59 @@ static void traverse()
//! [Traversing with QWebElement]
}
+static void findButtonAndClick()
+{
+
+ frame->setHtml("<form name=\"myform\" action=\"submit_form.asp\" method=\"get\">"
+ "<input type=\"text\" name=\"myfield\">"
+ "<input type=\"submit\" value=\"Submit\">"
+ "</form>");
+
+//! [Calling a DOM element method]
+
+ QWebElement document = frame->documentElement();
+ /* Assume that the document has the following structure:
+
+ <form name="myform" action="submit_form.asp" method="get">
+ <input type="text" name="myfield">
+ <input type="submit" value="Submit">
+ </form>
+
+ */
+
+ QWebElement button = document.findFirst("input[type=submit]");
+ button.evaluateJavaScript("click()");
+
+//! [Calling a DOM element method]
+
+ }
+
+static void autocomplete1()
+{
+ QWebElement document = frame->documentElement();
+
+//! [autocomplete1]
+ QWebElement firstTextInput = document.findFirst("input[type=text]");
+ QString storedText = firstTextInput.attribute("value");
+//! [autocomplete1]
+
+}
+
+
+static void autocomplete2()
+{
+
+ QWebElement document = frame->documentElement();
+ QString storedText = "text";
+
+//! [autocomplete2]
+ QWebElement firstTextInput = document.findFirst("input[type=text]");
+ textInput.setAttribute("value", storedText);
+//! [autocomplete2]
+
+}
+
+
static void findAll()
{
//! [FindAll]
@@ -65,5 +118,8 @@ int main(int argc, char *argv[])
frame = view->page()->mainFrame();
traverse();
findAll();
+ findButtonAndClick();
+ autocomplete1();
+ autocomplete2();
return 0;
}
diff --git a/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def b/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def
index a450f9ea69..910ba8f6ee 100644
--- a/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def
+++ b/src/3rdparty/webkit/WebKit/qt/symbian/bwins/QtWebKitu.def
@@ -642,7 +642,7 @@ EXPORTS
?qt_drt_webinspector_executeScript@@YAXPAVQWebPage@@JABVQString@@@Z @ 641 NONAME ; void qt_drt_webinspector_executeScript(class QWebPage *, long, class QString const &)
?qt_drt_webinspector_show@@YAXPAVQWebPage@@@Z @ 642 NONAME ; void qt_drt_webinspector_show(class QWebPage *)
?qt_drt_workerThreadCount@@YAHXZ @ 643 NONAME ; int qt_drt_workerThreadCount(void)
- ?qt_wrt_setViewMode@@YAXPAVQWebPage@@ABVQString@@@Z @ 644 NONAME ; void qt_wrt_setViewMode(class QWebPage *, class QString const &)
+ ?qt_wrt_setViewMode@@YAXPAVQWebPage@@ABVQString@@@Z @ 644 NONAME ABSENT ; void qt_wrt_setViewMode(class QWebPage *, class QString const &)
?qtwebkit_webframe_scrollRecursively@@YAXPAVQWebFrame@@HHABVQPoint@@@Z @ 645 NONAME ; void qtwebkit_webframe_scrollRecursively(class QWebFrame *, int, int, class QPoint const &)
?resizesToContents@QGraphicsWebView@@QBE_NXZ @ 646 NONAME ; bool QGraphicsWebView::resizesToContents(void) const
?scrollToAnchor@QWebFrame@@QAEXABVQString@@@Z @ 647 NONAME ; void QWebFrame::scrollToAnchor(class QString const &)
diff --git a/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def b/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def
index 145fe0b567..ca462d0413 100644
--- a/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def
+++ b/src/3rdparty/webkit/WebKit/qt/symbian/eabi/QtWebKitu.def
@@ -716,7 +716,7 @@ EXPORTS
_ZN13QWebInspector10closeEventEP11QCloseEvent @ 715 NONAME
_ZN16QGraphicsWebView26setTiledBackingStoreFrozenEb @ 716 NONAME
_ZNK16QGraphicsWebView25isTiledBackingStoreFrozenEv @ 717 NONAME
- _Z18qt_wrt_setViewModeP8QWebPageRK7QString @ 718 NONAME
+ _Z18qt_wrt_setViewModeP8QWebPageRK7QString @ 718 NONAME ABSENT
_Z19qt_drt_setMediaTypeP9QWebFrameRK7QString @ 719 NONAME
_Z26qt_drt_enableCaretBrowsingP8QWebPageb @ 720 NONAME
_ZNK12QWebSettings12inspectorUrlEv @ 721 NONAME
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
index 14f5820daf..ebe847d86c 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp
@@ -84,16 +84,19 @@ void tst_QGraphicsWebView::crashOnViewlessWebPages()
WebPage* page = new WebPage;
webView->setPage(page);
page->webView = webView;
- connect(page->mainFrame(), SIGNAL(initialLayoutCompleted()), page, SLOT(aborting()));
-
scene.addItem(webView);
view.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
view.resize(600, 480);
webView->resize(view.geometry().size());
+
QCoreApplication::processEvents();
view.show();
+ // Resizing the page will resize and layout the empty "about:blank"
+ // page, so we first connect the signal afterward.
+ connect(page->mainFrame(), SIGNAL(initialLayoutCompleted()), page, SLOT(aborting()));
+
page->mainFrame()->setHtml(QString("data:text/html,"
"<frameset cols=\"25%,75%\">"
"<frame src=\"data:text/html,foo \">"
@@ -101,6 +104,7 @@ void tst_QGraphicsWebView::crashOnViewlessWebPages()
"</frameset>"));
QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool))));
+ delete page;
}
void tst_QGraphicsWebView::microFocusCoordinates()
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index f7eddd540d..12fb9b3903 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -26,6 +26,7 @@
#include <QLocale>
#include <QMenu>
#include <QPushButton>
+#include <QStyle>
#include <QtTest/QtTest>
#include <QTextCharFormat>
#include <qgraphicsscene.h>
@@ -110,6 +111,8 @@ private slots:
void userAgentApplicationName();
void userAgentLocaleChange();
+ void viewModes();
+
void crashTests_LazyInitializationOfMainFrame();
void screenshot_data();
@@ -357,6 +360,21 @@ void tst_QWebPage::userStyleSheet()
QCOMPARE(networkManager->requestedUrls.at(0), QUrl("http://does.not/exist.png"));
}
+void tst_QWebPage::viewModes()
+{
+ m_view->setHtml("<body></body>");
+ m_page->setProperty("_q_viewMode", "minimized");
+
+ QVariant empty = m_page->mainFrame()->evaluateJavaScript("window.styleMedia.matchMedium(\"(-webkit-view-mode)\")");
+ QVERIFY(empty.type() == QVariant::Bool && empty.toBool());
+
+ QVariant minimized = m_page->mainFrame()->evaluateJavaScript("window.styleMedia.matchMedium(\"(-webkit-view-mode: minimized)\")");
+ QVERIFY(minimized.type() == QVariant::Bool && minimized.toBool());
+
+ QVariant maximized = m_page->mainFrame()->evaluateJavaScript("window.styleMedia.matchMedium(\"(-webkit-view-mode: maximized)\")");
+ QVERIFY(maximized.type() == QVariant::Bool && !maximized.toBool());
+}
+
void tst_QWebPage::modified()
{
m_page->mainFrame()->setUrl(QUrl("data:text/html,<body>blub"));
@@ -1350,7 +1368,27 @@ void tst_QWebPage::inputMethods()
page->event(&evrel);
#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
- QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));
+ // This part of the test checks if the SIP (Software Input Panel) is triggered,
+ // which normally happens on mobile platforms, when a user input form receives
+ // a mouse click.
+ int inputPanel = 0;
+ if (viewType == "QWebView") {
+ if (QWebView* wv = qobject_cast<QWebView*>(view))
+ inputPanel = wv->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel);
+ } else if (viewType == "QGraphicsWebView") {
+ if (QGraphicsWebView* wv = qobject_cast<QGraphicsWebView*>(view))
+ inputPanel = wv->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel);
+ }
+
+ // For non-mobile platforms RequestSoftwareInputPanel event is not called
+ // because there is no SIP (Software Input Panel) triggered. In the case of a
+ // mobile platform, an input panel, e.g. virtual keyboard, is usually invoked
+ // and the RequestSoftwareInputPanel event is called. For these two situations
+ // this part of the test can verified as the checks below.
+ if (inputPanel)
+ QVERIFY(viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));
+ else
+ QVERIFY(!viewEventSpy.contains(QEvent::RequestSoftwareInputPanel));
#endif
viewEventSpy.clear();
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 01570ade81..04342e72f0 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -369,6 +369,9 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
if (state == newState)
return;
+ if (loopCount == 0)
+ return;
+
QAbstractAnimation::State oldState = state;
int oldCurrentTime = currentTime;
int oldCurrentLoop = currentLoop;
diff --git a/src/corelib/io/qfilesystemwatcher_symbian.cpp b/src/corelib/io/qfilesystemwatcher_symbian.cpp
index 69daae718a..6136742213 100644
--- a/src/corelib/io/qfilesystemwatcher_symbian.cpp
+++ b/src/corelib/io/qfilesystemwatcher_symbian.cpp
@@ -106,7 +106,7 @@ void QNotifyChangeEvent::DoCancel()
}
QSymbianFileSystemWatcherEngine::QSymbianFileSystemWatcherEngine() :
- errorCode(KErrNone), watcherStarted(false)
+ watcherStarted(false)
{
moveToThread(this);
}
@@ -122,11 +122,7 @@ QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths,
QMutexLocker locker(&mutex);
QStringList p = paths;
- if (!startWatcher()) {
- qWarning("Could not start QSymbianFileSystemWatcherEngine thread");
-
- return p;
- }
+ startWatcher();
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
@@ -150,18 +146,17 @@ QStringList QSymbianFileSystemWatcherEngine::addPaths(const QStringList &paths,
filePath += QChar(L'/');
}
- currentEvent = NULL;
+ currentAddEvent = NULL;
QMetaObject::invokeMethod(this,
"addNativeListener",
Qt::QueuedConnection,
Q_ARG(QString, filePath));
syncCondition.wait(&mutex);
+ if (currentAddEvent) {
+ currentAddEvent->isDir = isDir;
- if (currentEvent) {
- currentEvent->isDir = isDir;
-
- activeObjectToPath.insert(currentEvent, path);
+ activeObjectToPath.insert(currentAddEvent, path);
it.remove();
if (isDir)
@@ -185,10 +180,10 @@ QStringList QSymbianFileSystemWatcherEngine::removePaths(const QStringList &path
while (it.hasNext()) {
QString path = it.next();
- currentEvent = activeObjectToPath.key(path);
- if (!currentEvent)
+ currentRemoveEvent = activeObjectToPath.key(path);
+ if (!currentRemoveEvent)
continue;
- activeObjectToPath.remove(currentEvent);
+ activeObjectToPath.remove(currentRemoveEvent);
QMetaObject::invokeMethod(this,
"removeNativeListener",
@@ -202,9 +197,6 @@ QStringList QSymbianFileSystemWatcherEngine::removePaths(const QStringList &path
directories->removeAll(path);
}
- if (activeObjectToPath.size() == 0)
- stop();
-
return p;
}
@@ -228,44 +220,31 @@ void QSymbianFileSystemWatcherEngine::stop()
}
// This method must be called inside mutex
-bool QSymbianFileSystemWatcherEngine::startWatcher()
+void QSymbianFileSystemWatcherEngine::startWatcher()
{
- bool retval = true;
-
if (!watcherStarted) {
setStackSize(0x5000);
start();
syncCondition.wait(&mutex);
-
- if (errorCode != KErrNone) {
- retval = false;
- } else {
- watcherStarted = true;
- }
+ watcherStarted = true;
}
- return retval;
}
void QSymbianFileSystemWatcherEngine::run()
{
- // Initialize file session
-
mutex.lock();
syncCondition.wakeOne();
mutex.unlock();
- if (errorCode == KErrNone) {
- exec();
+ exec();
- foreach(QNotifyChangeEvent *e, activeObjectToPath.keys()) {
- e->Cancel();
- delete e;
- }
-
- activeObjectToPath.clear();
- watcherStarted = false;
+ foreach(QNotifyChangeEvent *e, activeObjectToPath.keys()) {
+ e->Cancel();
+ delete e;
}
+
+ activeObjectToPath.clear();
}
void QSymbianFileSystemWatcherEngine::addNativeListener(const QString &directoryPath)
@@ -273,16 +252,16 @@ void QSymbianFileSystemWatcherEngine::addNativeListener(const QString &directory
QMutexLocker locker(&mutex);
QString nativeDir(QDir::toNativeSeparators(directoryPath));
TPtrC ptr(qt_QString2TPtrC(nativeDir));
- currentEvent = new QNotifyChangeEvent(qt_s60GetRFs(), ptr, this, directoryPath.endsWith(QChar(L'/'), Qt::CaseSensitive));
+ currentAddEvent = new QNotifyChangeEvent(qt_s60GetRFs(), ptr, this, directoryPath.endsWith(QChar(L'/'), Qt::CaseSensitive));
syncCondition.wakeOne();
}
void QSymbianFileSystemWatcherEngine::removeNativeListener()
{
QMutexLocker locker(&mutex);
- currentEvent->Cancel();
- delete currentEvent;
- currentEvent = NULL;
+ currentRemoveEvent->Cancel();
+ delete currentRemoveEvent;
+ currentRemoveEvent = NULL;
syncCondition.wakeOne();
}
diff --git a/src/corelib/io/qfilesystemwatcher_symbian_p.h b/src/corelib/io/qfilesystemwatcher_symbian_p.h
index 7e3f0452ac..e687a4a020 100644
--- a/src/corelib/io/qfilesystemwatcher_symbian_p.h
+++ b/src/corelib/io/qfilesystemwatcher_symbian_p.h
@@ -113,14 +113,14 @@ private:
friend class QNotifyChangeEvent;
void emitPathChanged(QNotifyChangeEvent *e);
- bool startWatcher();
+ void startWatcher();
QHash<QNotifyChangeEvent*, QString> activeObjectToPath;
QMutex mutex;
QWaitCondition syncCondition;
- int errorCode;
bool watcherStarted;
- QNotifyChangeEvent *currentEvent;
+ QNotifyChangeEvent *currentAddEvent;
+ QNotifyChangeEvent *currentRemoveEvent;
};
#endif // QT_NO_FILESYSTEMWATCHER
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 4e580dd1a5..d4b8b5febb 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -5557,6 +5557,12 @@ QUrl QUrl::resolved(const QUrl &relative) const
removeDotsFromPath(&t.d->encodedPath);
t.d->path.clear();
+#if defined(QURL_DEBUG)
+ qDebug("QUrl(\"%s\").resolved(\"%s\") = \"%s\"",
+ toEncoded().constData(),
+ relative.toEncoded().constData(),
+ t.toEncoded().constData());
+#endif
return t;
}
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index b0503be623..3660a3c98c 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -2530,6 +2530,62 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star
condition is true, in which case you should abort your move
operation.
+ \table 80%
+ \row
+ \o \inlineimage modelview-move-rows-1.png Moving rows to another parent
+ \o Specify the first and last row numbers for the span of rows in
+ the source parent you want to move in the model. Also specify
+ the row in the destination parent to move the span to.
+
+ For example, as shown in the diagram, we move three rows from
+ row 2 to 4 in the source, so \a sourceFirst is 2 and \a sourceLast is 4.
+ We move those items to above row 2 in the destination, so \a destinationRow is 2.
+
+ \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 6
+
+ This moves the three rows rows 2, 3, and 4 in the source to become 2, 3 and 4 in
+ the destination. Other affected siblings are displaced accordingly.
+ \row
+ \o \inlineimage modelview-move-rows-2.png Moving rows to append to another parent
+ \o To append rows to another parent, move them to after the last row.
+
+ For example, as shown in the diagram, we move three rows to a
+ collection of 6 existing rows (ending in row 5), so \a destinationStart is 6:
+
+ \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 7
+
+ This moves the target rows to the end of the target parent as 6, 7 and 8.
+ \row
+ \o \inlineimage modelview-move-rows-3.png Moving rows in the same parent up
+ \o To move rows within the same parent, specify the row to move them to.
+
+ For example, as shown in the diagram, we move one item from row 2 to row 0,
+ so \a sourceFirst and \a sourceLast are 2 and \a destinationChild is 0.
+
+ \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 8
+
+ Note that other rows may be displaced accordingly. Note also that when moving
+ items within the same parent you should not attempt invalid or no-op moves. In
+ the above example, item 2 is at row 2 before the move, so it can not be moved
+ to row 2 (where it is already) or row 3 (no-op as row 3 means above row 3, where
+ it is already)
+
+ \row
+ \o \inlineimage modelview-move-rows-4.png Moving rows in the same parent down
+ \o To move rows within the same parent, specify the row to move them to.
+
+ For example, as shown in the diagram, we move one item from row 2 to row 4,
+ so \a sourceFirst and \a sourceLast are 2 and \a destinationChild is 4.
+
+ \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 9
+
+ Note that other rows may be displaced accordingly.
+ \endtable
+
+ \note This function emits the rowsAboutToBeInserted() signal which
+ connected views (or proxies) must handle before the data is inserted.
+ Otherwise, the views may end up in an invalid state.
+
\sa endMoveRows()
\since 4.6
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 609e6b33ff..4e6e6b92e3 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -63,6 +63,7 @@
#include <qvarlengtharray.h>
#include <private/qfactoryloader_p.h>
#include <private/qfunctions_p.h>
+#include <private/qlocale_p.h>
#ifdef Q_OS_SYMBIAN
# include <exception>
@@ -521,6 +522,9 @@ QCoreApplication::QCoreApplication(int &argc, char **argv)
QFactoryLoader::refreshAll();
#endif
+#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
+ d_func()->symbianInit();
+#endif
}
// ### move to QCoreApplicationPrivate constructor?
@@ -597,6 +601,15 @@ void QCoreApplication::init()
qt_startup_hook();
}
+#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
+void QCoreApplicationPrivate::symbianInit()
+{
+ if (!environmentChangeNotifier)
+ environmentChangeNotifier.reset(new QEnvironmentChangeNotifier);
+}
+#endif
+
+
/*!
Destroys the QCoreApplication object.
*/
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 77188d3601..e066137731 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -65,6 +65,9 @@ QT_BEGIN_NAMESPACE
typedef QList<QTranslator*> QTranslatorList;
+#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
+class QEnvironmentChangeNotifier;
+#endif
class QAbstractEventDispatcher;
class Q_CORE_EXPORT QCoreApplicationPrivate : public QObjectPrivate
@@ -113,6 +116,10 @@ public:
bool aboutToQuitEmitted;
QString cachedApplicationDirPath;
QString cachedApplicationFilePath;
+#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
+ QScopedPointer<QEnvironmentChangeNotifier> environmentChangeNotifier;
+ void symbianInit();
+#endif
static bool isTranslatorInstalled(QTranslator *translator);
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
index a6d486e8ba..687a6d9197 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -1105,3 +1105,5 @@ void CQtActiveScheduler::Error(TInt aError) const
}
QT_END_NAMESPACE
+
+#include "moc_qeventdispatcher_symbian_p.cpp"
diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h
index 05758cacd4..bc4275376c 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian_p.h
+++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h
@@ -221,6 +221,7 @@ public: // from CActiveScheduler
class Q_CORE_EXPORT QEventDispatcherSymbian : public QAbstractEventDispatcher
{
+ Q_OBJECT
Q_DECLARE_PRIVATE(QAbstractEventDispatcher)
public:
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index 67ea00d063..2f09b0e0e4 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -653,14 +653,41 @@ bool QChar::isSymbol() const
\fn bool QChar::isHighSurrogate() const
Returns true if the QChar is the high part of a utf16 surrogate
- (ie. if its code point is between 0xd800 and 0xdbff).
+ (ie. if its code point is between 0xd800 and 0xdbff, inclusive).
*/
/*!
\fn bool QChar::isLowSurrogate() const
Returns true if the QChar is the low part of a utf16 surrogate
- (ie. if its code point is between 0xdc00 and 0xdfff).
+ (ie. if its code point is between 0xdc00 and 0xdfff, inclusive).
+*/
+
+/*!
+ \fn static bool QChar::isHighSurrogate(uint ucs4)
+ \since 4.7
+
+ Returns true if the UCS-4-encoded character specified by \a ucs4
+ is the high part of a utf16 surrogate
+ (ie. if its code point is between 0xd800 and 0xdbff, inclusive).
+*/
+
+/*!
+ \fn static bool QChar::isLowSurrogate(uint ucs4)
+ \since 4.7
+
+ Returns true if the UCS-4-encoded character specified by \a ucs4
+ is the high part of a utf16 surrogate
+ (ie. if its code point is between 0xdc00 and 0xdfff, inclusive).
+*/
+
+/*!
+ \fn static bool QChar::requiresSurrogates(uint ucs4)
+ \since 4.7
+
+ Returns true if the UCS-4-encoded character specified by \a ucs4
+ can be splited to the high and low parts of a utf16 surrogate
+ (ie. if its code point is greater than or equals to 0x10000).
*/
/*!
diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h
index 1432c7f7d7..205f91166b 100644
--- a/src/corelib/tools/qchar.h
+++ b/src/corelib/tools/qchar.h
@@ -285,6 +285,15 @@ public:
inline void setCell(uchar cell);
inline void setRow(uchar row);
+ static inline bool isHighSurrogate(uint ucs4) {
+ return ((ucs4 & 0xfffffc00) == 0xd800);
+ }
+ static inline bool isLowSurrogate(uint ucs4) {
+ return ((ucs4 & 0xfffffc00) == 0xdc00);
+ }
+ static inline bool requiresSurrogates(uint ucs4) {
+ return (ucs4 >= 0x10000);
+ }
static inline uint surrogateToUcs4(ushort high, ushort low) {
return (uint(high)<<10) + low - 0x35fdc00;
}
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 9afcd804de..9f5d8c6bbe 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -1705,7 +1705,7 @@ int QTime::secsTo(const QTime &t) const
Note that the time will wrap if it passes midnight. See addSecs()
for an example.
- \sa addSecs(), msecsTo()
+ \sa addSecs(), msecsTo(), QDateTime::addMSecs()
*/
QTime QTime::addMSecs(int ms) const
@@ -1734,7 +1734,7 @@ QTime QTime::addMSecs(int ms) const
seconds in a day, the result is always between -86400000 and
86400000 ms.
- \sa secsTo(), addMSecs()
+ \sa secsTo(), addMSecs(), QDateTime::msecsTo()
*/
int QTime::msecsTo(const QTime &t) const
@@ -2042,10 +2042,11 @@ int QTime::elapsed() const
later.
You can increment (or decrement) a datetime by a given number of
- seconds using addSecs(), or days using addDays(). Similarly you can
- use addMonths() and addYears(). The daysTo() function returns the
- number of days between two datetimes, and secsTo() returns the
- number of seconds between two datetimes.
+ milliseconds using addMSecs(), seconds using addSecs(), or days
+ using addDays(). Similarly you can use addMonths() and addYears().
+ The daysTo() function returns the number of days between two datetimes,
+ secsTo() returns the number of seconds between two datetimes, and
+ msecsTo() returns the number of milliseconds between two datetimes.
QDateTime can store datetimes as \l{Qt::LocalTime}{local time} or
as \l{Qt::UTC}{UTC}. QDateTime::currentDateTime() returns a
@@ -2719,7 +2720,7 @@ QDateTime QDateTime::addSecs(int s) const
later than the datetime of this object (or earlier if \a msecs is
negative).
- \sa addSecs(), secsTo(), addDays(), addMonths(), addYears()
+ \sa addSecs(), msecsTo(), addDays(), addMonths(), addYears()
*/
QDateTime QDateTime::addMSecs(qint64 msecs) const
{
@@ -2731,7 +2732,7 @@ QDateTime QDateTime::addMSecs(qint64 msecs) const
datetime. If the \a other datetime is earlier than this datetime,
the value returned is negative.
- \sa addDays(), secsTo()
+ \sa addDays(), secsTo(), msecsTo()
*/
int QDateTime::daysTo(const QDateTime &other) const
@@ -2766,6 +2767,33 @@ int QDateTime::secsTo(const QDateTime &other) const
}
/*!
+ Returns the number of milliseconds from this datetime to the \a other
+ datetime. If the \a other datetime is earlier than this datetime,
+ the value returned is negative.
+
+ Before performing the comparison, the two datetimes are converted
+ to Qt::UTC to ensure that the result is correct if one of the two
+ datetimes has daylight saving time (DST) and the other doesn't.
+
+ \sa addMSecs(), daysTo(), QTime::msecsTo()
+*/
+
+qint64 QDateTime::msecsTo(const QDateTime &other) const
+{
+ QDate selfDate;
+ QDate otherDate;
+ QTime selfTime;
+ QTime otherTime;
+
+ d->getUTC(selfDate, selfTime);
+ other.d->getUTC(otherDate, otherTime);
+
+ return (static_cast<qint64>(selfDate.daysTo(otherDate)) * static_cast<qint64>(MSECS_PER_DAY))
+ + static_cast<qint64>(selfTime.msecsTo(otherTime));
+}
+
+
+/*!
\fn QDateTime QDateTime::toTimeSpec(Qt::TimeSpec specification) const
Returns a copy of this datetime configured to use the given time
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index f445f1c16c..2466aeb47d 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -251,6 +251,7 @@ public:
inline QDateTime toUTC() const { return toTimeSpec(Qt::UTC); }
int daysTo(const QDateTime &) const;
int secsTo(const QDateTime &) const;
+ qint64 msecsTo(const QDateTime &) const;
bool operator==(const QDateTime &other) const;
inline bool operator!=(const QDateTime &other) const { return !(*this == other); }
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index c3f67830ca..20c2e27d13 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -129,6 +129,11 @@ inline bool isascii(int c)
}
#endif
+#if defined(Q_OS_SYMBIAN)
+void qt_symbianUpdateSystemPrivate();
+void qt_symbianInitSystemLocale();
+#endif
+
/******************************************************************************
** Helpers for accessing Qt locale database
*/
@@ -1407,6 +1412,9 @@ static const QSystemLocale *systemLocale()
{
if (_systemLocale)
return _systemLocale;
+#if defined(Q_OS_SYMBIAN)
+ qt_symbianInitSystemLocale();
+#endif
return QSystemLocale_globalSystemLocale();
}
@@ -1417,6 +1425,10 @@ void QLocalePrivate::updateSystemPrivate()
system_lp = globalLocalePrivate();
*system_lp = *sys_locale->fallbackLocale().d();
+#if defined(Q_OS_SYMBIAN)
+ qt_symbianUpdateSystemPrivate();
+#endif
+
QVariant res = sys_locale->query(QSystemLocale::LanguageId, QVariant());
if (!res.isNull())
system_lp->m_language_id = res.toInt();
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index ecf79e9e2f..62057452d9 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -58,6 +58,10 @@
#include "qlocale.h"
+#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
+class CEnvironmentChangeNotifier;
+#endif
+
QT_BEGIN_NAMESPACE
struct Q_CORE_EXPORT QLocalePrivate
@@ -201,6 +205,20 @@ inline char QLocalePrivate::digitToCLocale(const QChar &in) const
return 0;
}
+#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
+class QEnvironmentChangeNotifier
+{
+public:
+ QEnvironmentChangeNotifier();
+ ~QEnvironmentChangeNotifier();
+
+ static TInt localeChanged(TAny *data);
+
+private:
+ CEnvironmentChangeNotifier *iChangeNotifier;
+};
+#endif
+
QT_END_NAMESPACE
#endif // QLOCALE_P_H
diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp
index 01f56cc20f..6e36dcd753 100644
--- a/src/corelib/tools/qlocale_symbian.cpp
+++ b/src/corelib/tools/qlocale_symbian.cpp
@@ -46,8 +46,14 @@
#include <QThread>
#include <e32std.h>
+#include <e32const.h>
+#include <e32base.h>
+#include <e32property.h>
+#include <bacntf.h>
#include "private/qcore_symbian_p.h"
-
+#include "private/qcoreapplication_p.h"
+#include "private/qlocale_p.h"
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -771,13 +777,18 @@ static QLocale::MeasurementSystem symbianMeasurementSystem()
return QLocale::MetricSystem;
}
-QLocale QSystemLocale::fallbackLocale() const
+void qt_symbianUpdateSystemPrivate()
{
// load system data before query calls
+ _s60Locale.LoadSystemSettings();
+}
+
+void qt_symbianInitSystemLocale()
+{
static QBasicAtomicInt initDone = Q_BASIC_ATOMIC_INITIALIZER(0);
+ if (initDone == 2)
+ return;
if (initDone.testAndSetRelaxed(0, 1)) {
- _s60Locale.LoadSystemSettings();
-
// Initialize platform version dependent function pointers
ptrTimeFormatL = reinterpret_cast<FormatFunc>
(qt_resolveS60PluginFunc(S60Plugin_TimeFormatL));
@@ -801,7 +812,10 @@ QLocale QSystemLocale::fallbackLocale() const
}
while(initDone != 2)
QThread::yieldCurrentThread();
+}
+QLocale QSystemLocale::fallbackLocale() const
+{
TLanguage lang = User::Language();
QString locale = QLatin1String(qt_symbianLocaleName(lang));
return QLocale(locale);
@@ -884,4 +898,35 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
return QVariant();
}
+#if !defined(QT_NO_SYSTEMLOCALE)
+QEnvironmentChangeNotifier::QEnvironmentChangeNotifier()
+{
+ // Create the change notifier and install the callback function
+ const TCallBack callback(&QEnvironmentChangeNotifier::localeChanged, this);
+ QT_TRAP_THROWING(iChangeNotifier = CEnvironmentChangeNotifier::NewL(CActive::EPriorityStandard, callback));
+ iChangeNotifier->Start();
+}
+
+TInt QEnvironmentChangeNotifier::localeChanged(TAny *data)
+{
+ QEnvironmentChangeNotifier *that = reinterpret_cast<QEnvironmentChangeNotifier *>(data);
+
+ TInt flag = that->iChangeNotifier->Change();
+ if (flag & EChangesLocale) {
+ static bool first = true;
+ if (!first) { // skip the first notification on app startup
+ QT_TRYCATCH_LEAVING(QLocalePrivate::updateSystemPrivate());
+ QT_TRYCATCH_LEAVING(QCoreApplication::postEvent(qApp, new QEvent(QEvent::LocaleChange)));
+ }
+ first = false;
+ }
+ return KErrNone;
+}
+
+QEnvironmentChangeNotifier::~QEnvironmentChangeNotifier()
+{
+ delete iChangeNotifier;
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index df0ae460c3..5696ba6c36 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -125,6 +125,10 @@ template <class Key, class T>
struct QMapNode {
Key key;
T value;
+
+private:
+ // never access these members through this structure.
+ // see below
QMapData::Node *backward;
QMapData::Node *forward[1];
};
@@ -134,6 +138,22 @@ struct QMapPayloadNode
{
Key key;
T value;
+
+private:
+ // QMap::e is a pointer to QMapData::Node, which matches the member
+ // below. However, the memory allocation node in QMapData::node_create
+ // allocates sizeof(QMapPayloNode) and incorrectly calculates the offset
+ // of 'backward' below. If the alignment of QMapPayloadNode is larger
+ // than the alignment of a pointer, the 'backward' member is aligned to
+ // the end of this structure, not to 'value' above, and will occupy the
+ // tail-padding area.
+ //
+ // e.g., on a 32-bit archictecture with Key = int and
+ // sizeof(T) = alignof(T) = 8
+ // 0 4 8 12 16 20 24 byte
+ // | key | PAD | value |backward| PAD | correct layout
+ // | key | PAD | value | |backward| how it's actually used
+ // |<----- value of QMap::payload() = 20 ----->|
QMapData::Node *backward;
};
diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp
index 8fc219a8d0..78abf94168 100644
--- a/src/dbus/qdbusinternalfilters.cpp
+++ b/src/dbus/qdbusinternalfilters.cpp
@@ -87,7 +87,7 @@ static const char propertiesInterfaceXml[] =
" <method name=\"GetAll\">\n"
" <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n"
" <arg name=\"values\" type=\"a{sv}\" direction=\"out\"/>\n"
- " <annotation name=\"com.trolltech.QtDBus.QtTypeName.Out0\" value=\"QVariantMap\"/>"
+ " <annotation name=\"com.trolltech.QtDBus.QtTypeName.Out0\" value=\"QVariantMap\"/>\n"
" </method>\n"
" </interface>\n";
diff --git a/src/dbus/qdbusxmlgenerator.cpp b/src/dbus/qdbusxmlgenerator.cpp
index 9c25d827fa..463ac73a82 100644
--- a/src/dbus/qdbusxmlgenerator.cpp
+++ b/src/dbus/qdbusxmlgenerator.cpp
@@ -160,7 +160,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
// do we need to describe this argument?
if (QDBusMetaType::signatureToType(typeName) == QVariant::Invalid)
xml += QString::fromLatin1(" <annotation name=\"com.trolltech.QtDBus.QtTypeName.Out0\" value=\"%1\"/>\n")
- .arg(typeNameToXml(mm.typeName()));
+ .arg(typeNameToXml(QVariant::typeToName(QVariant::Type(typeId))));
} else
continue;
}
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt
index 9c464676e0..ec8f508310 100644
--- a/src/declarative/QmlChanges.txt
+++ b/src/declarative/QmlChanges.txt
@@ -1,15 +1,30 @@
=============================================================================
The changes below are pre Qt 4.7.0 RC
-Flickable: overShoot is replaced by boundsBehavior enumeration.
+Flickable:
+ - overShoot is replaced by boundsBehavior enumeration
+ - flickingHorizontally and flickingVertically properties added
+ - movingHorizontally and movingVertically properties added
+ - flickDirection is renamed flickableDirection
+Component: isReady, isLoading, isError and isNull properties removed, use
+ status property instead
+QList<QObject*> models no longer provide properties in model object. The
+properties are now updated when the object changes. An object's property
+"foo" may now be accessed as "foo", modelData.foo" or model.modelData.foo"
+component.createObject has gained a mandatory "parent" argument
C++ API
-------
QDeclarativeExpression::value() has been renamed to
QDeclarativeExpression::evaluate()
+QML Launcher
+------------
+The standalone executable has been renamed to qml launcher. Runtime warnings
+can be now accessed via the menu (Debugging->Show Warnings).
+
=============================================================================
-The changes below are pre Qt 4.7.0 beta
+The changes below are pre Qt 4.7.0 beta 1
TextEdit: wrap property is replaced by wrapMode enumeration.
Text: wrap property is replaced by wrapMode enumeration.
diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro
index 4287e250ee..8037a16c4a 100644
--- a/src/declarative/declarative.pro
+++ b/src/declarative/declarative.pro
@@ -1,13 +1,13 @@
TARGET = QtDeclarative
QPRO_PWD = $$PWD
-QT = core gui xml script network
+QT = core gui script network
contains(QT_CONFIG, svg): QT += svg
contains(QT_CONFIG, opengl): QT += opengl
DEFINES += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtXml
+unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
exists("qdeclarative_enable_gcov") {
QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors
diff --git a/src/declarative/graphicsitems/qdeclarativeanchors.cpp b/src/declarative/graphicsitems/qdeclarativeanchors.cpp
index f15316bb72..ef07cbb39a 100644
--- a/src/declarative/graphicsitems/qdeclarativeanchors.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeanchors.cpp
@@ -128,7 +128,6 @@ static qreal adjustedPosition(QGraphicsObject *item, QDeclarativeAnchorLine::Anc
\internal
\class QDeclarativeAnchors
\since 4.7
- \ingroup group_layouts
\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.
diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
index 06f8363d54..229e15b774 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -57,9 +57,25 @@ QT_BEGIN_NAMESPACE
\inherits Item
\since 4.7
- \snippet snippets/declarative/border-image.qml 0
+ A BorderImage breaks an image into 9 sections, as shown below:
+
+ \image declarative-scalegrid.png
+
+ When the image is scaled:
+ \list
+ \i the corners (sections 1, 3, 7, and 9) are not scaled at all
+ \i sections 2 and 8 are scaled according to \l{BorderImage::horizontalTileMode}{horizontalTileMode}
+ \i sections 4 and 6 are scaled according to \l{BorderImage::verticalTileMode}{verticalTileMode}
+ \i the middle (section 5) is scaled according to both \l{BorderImage::horizontalTileMode}{horizontalTileMode} and \l{BorderImage::verticalTileMode}{verticalTileMode}
+ \endlist
+
+ Examples:
+ \snippet snippets/declarative/borderimage.qml 0
\image BorderImage.png
+
+ The \l{declarative/imageelements/borderimage}{BorderImage example} shows how a BorderImage can be used to simulate a shadow effect on a
+ rectangular item.
*/
/*!
@@ -86,10 +102,10 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage()
This property holds the status of image loading. It can be one of:
\list
- \o Null - no image has been set
- \o Ready - the image has been loaded
- \o Loading - the image is currently being loaded
- \o Error - an error occurred while loading the image
+ \o BorderImage.Null - no image has been set
+ \o BorderImage.Ready - the image has been loaded
+ \o BorderImage.Loading - the image is currently being loaded
+ \o BorderImage.Error - an error occurred while loading the image
\endlist
\sa progress
@@ -255,21 +271,17 @@ void QDeclarativeBorderImage::load()
\qmlproperty int BorderImage::border.top
\qmlproperty int BorderImage::border.bottom
- \target ImagexmlpropertiesscaleGrid
-
- The 4 border lines (2 horizontal and 2 vertical) break an image into 9 sections, as shown below:
+ The 4 border lines (2 horizontal and 2 vertical) break the image into 9 sections, as shown below:
\image declarative-scalegrid.png
- When the image is scaled:
- \list
- \i the corners (sections 1, 3, 7, and 9) are not scaled at all
- \i sections 2 and 8 are scaled according to \l{BorderImage::horizontalTileMode}{horizontalTileMode}
- \i sections 4 and 6 are scaled according to \l{BorderImage::verticalTileMode}{verticalTileMode}
- \i the middle (section 5) is scaled according to both \l{BorderImage::horizontalTileMode}{horizontalTileMode} and \l{BorderImage::verticalTileMode}{verticalTileMode}
- \endlist
+ Each border line (left, right, top, and bottom) specifies an offset in pixels from the respective side.
- Each border line (left, right, top, and bottom) specifies an offset from the respective side. For example, \c{border.bottom: 10} sets the bottom line 10 pixels up from the bottom of the image.
+ For example:
+ \qml
+ border.bottom: 10
+ \endqml
+ sets the bottom line 10 pixels up from the bottom of the image.
The border lines can also be specified using a
\l {BorderImage::source}{.sci file}.
@@ -288,9 +300,9 @@ QDeclarativeScaleGrid *QDeclarativeBorderImage::border()
This property describes how to repeat or stretch the middle parts of the border image.
\list
- \o Stretch - Scale the image to fit to the available area.
- \o Repeat - Tile the image until there is no more space. May crop the last image.
- \o Round - Like Repeat, but scales the images down to ensure that the last image is not cropped.
+ \o BorderImage.Stretch - Scale the image to fit to the available area.
+ \o BorderImage.Repeat - Tile the image until there is no more space. May crop the last image.
+ \o BorderImage.Round - Like Repeat, but scales the images down to ensure that the last image is not cropped.
\endlist
*/
QDeclarativeBorderImage::TileMode QDeclarativeBorderImage::horizontalTileMode() const
diff --git a/src/declarative/graphicsitems/qdeclarativeevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp
index 4425c97b16..81ec6e172b 100644
--- a/src/declarative/graphicsitems/qdeclarativeevents.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp
@@ -151,7 +151,7 @@ Item {
\list
\o Qt.LeftButton
\o Qt.RightButton
- \o Qt.MidButton
+ \o Qt.MiddleButton
\endlist
*/
@@ -174,7 +174,7 @@ Item {
\list
\o Qt.LeftButton
\o Qt.RightButton
- \o Qt.MidButton
+ \o Qt.MiddleButton
\endlist
*/
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index b4624436d4..3c0f5a2f5d 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -125,12 +125,14 @@ QDeclarativeFlickablePrivate::QDeclarativeFlickablePrivate()
: viewport(new QDeclarativeItem)
, hData(this, &QDeclarativeFlickablePrivate::setRoundedViewportX)
, vData(this, &QDeclarativeFlickablePrivate::setRoundedViewportY)
- , flicked(false), moving(false), stealMouse(false)
- , pressed(false)
+ , flickingHorizontally(false), flickingVertically(false)
+ , hMoved(false), vMoved(false)
+ , movingHorizontally(false), movingVertically(false)
+ , stealMouse(false), pressed(false)
, interactive(true), deceleration(500), maxVelocity(2000), reportedVelocitySmoothing(100)
, delayedPressEvent(0), delayedPressTarget(0), pressDelay(0), fixupDuration(600)
, vTime(0), visibleArea(0)
- , flickDirection(QDeclarativeFlickable::AutoFlickDirection)
+ , flickableDirection(QDeclarativeFlickable::AutoFlickDirection)
, boundsBehavior(QDeclarativeFlickable::DragAndOvershootBounds)
{
}
@@ -226,10 +228,19 @@ void QDeclarativeFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal
timeline.reset(data.move);
timeline.accel(data.move, v, deceleration, maxDistance);
timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this));
- if (!flicked) {
- flicked = true;
+ if (!flickingHorizontally && q->xflick()) {
+ flickingHorizontally = true;
emit q->flickingChanged();
- emit q->flickStarted();
+ emit q->flickingHorizontallyChanged();
+ if (!flickingVertically)
+ emit q->flickStarted();
+ }
+ if (!flickingVertically && q->yflick()) {
+ flickingVertically = true;
+ emit q->flickingChanged();
+ emit q->flickingVerticallyChanged();
+ if (!flickingHorizontally)
+ emit q->flickStarted();
}
} else {
timeline.reset(data.move);
@@ -274,7 +285,6 @@ void QDeclarativeFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal
q->viewportMoved();
}
}
- //emit flickingChanged();
} else if (data.move.value() < maxExtent) {
timeline.reset(data.move);
if (fixupDuration) {
@@ -285,11 +295,7 @@ void QDeclarativeFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal
data.move.setValue(maxExtent);
q->viewportMoved();
}
- //emit flickingChanged();
- } else {
- flicked = false;
}
-
vTime = timeline.time();
}
@@ -345,19 +351,21 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd()
\code
Flickable {
- width: 200; height: 200; contentWidth: image.width; contentHeight: image.height
- Image { id: image; source: "bigimage.png" }
+ width: 200; height: 200
+ contentWidth: image.width; contentHeight: image.height
+
+ Image { id: image; source: "bigImage.png" }
}
\endcode
\image flickable.gif
- \note Flickable does not automatically clip its contents. If
- it is not full-screen it is likely that \c clip should be set
- to true.
+ Flickable does not automatically clip its contents. If
+ it is not full-screen it is likely that \l {Item::clip}{clip} should be set
+ to \c true.
- \note Due to an implementation detail items placed inside a flickable cannot anchor to it by
- id, use 'parent' instead.
+ \note Due to an implementation detail, items placed inside a Flickable cannot anchor to it by
+ \c id. Use \c parent instead.
*/
/*!
@@ -400,18 +408,17 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd()
These properties describe the position and size of the currently viewed area.
The size is defined as the percentage of the full view currently visible,
scaled to 0.0 - 1.0. The page position is usually in the range 0.0 (beginning) to
- 1.0 minus size ratio (end), i.e. yPosition is in the range 0.0 to 1.0-heightRatio.
+ 1.0 minus size ratio (end), i.e. \c yPosition is in the range 0.0 to 1.0-\c heightRatio.
However, it is possible for the contents to be dragged outside of the normal
range, resulting in the page positions also being outside the normal range.
- These properties are typically used to draw a scrollbar, for example:
- \code
- Rectangle {
- opacity: 0.5; anchors.right: MyListView.right-2; width: 6
- y: MyListView.visibleArea.yPosition * MyListView.height
- height: MyListView.visibleArea.heightRatio * MyListView.height
- }
- \endcode
+ These properties are typically used to draw a scrollbar. For example:
+
+ \snippet doc/src/snippets/declarative/flickableScrollbar.qml 0
+ \dots 4
+ \snippet doc/src/snippets/declarative/flickableScrollbar.qml 1
+
+ \sa {declarative/ui-components/scrollbar}{scrollbar example}
*/
QDeclarativeFlickable::QDeclarativeFlickable(QDeclarativeItem *parent)
@@ -479,11 +486,12 @@ void QDeclarativeFlickable::setContentY(qreal pos)
/*!
\qmlproperty bool Flickable::interactive
- A user cannot drag or flick a Flickable that is not interactive.
+ This property holds whether the user can interact with the Flickable. A user
+ cannot drag or flick a Flickable that is not interactive.
This property is useful for temporarily disabling flicking. This allows
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.
+ freeze a flickable map while scrolling through a pop-up dialog that is a child of the Flickable.
*/
bool QDeclarativeFlickable::isInteractive() const
{
@@ -496,11 +504,14 @@ void QDeclarativeFlickable::setInteractive(bool interactive)
Q_D(QDeclarativeFlickable);
if (interactive != d->interactive) {
d->interactive = interactive;
- if (!interactive && d->flicked) {
+ if (!interactive && (d->flickingHorizontally || d->flickingVertically)) {
d->timeline.clear();
d->vTime = d->timeline.time();
- d->flicked = false;
+ d->flickingHorizontally = false;
+ d->flickingVertically = false;
emit flickingChanged();
+ emit flickingHorizontallyChanged();
+ emit flickingVerticallyChanged();
emit flickEnded();
}
emit interactiveChanged();
@@ -580,35 +591,47 @@ QDeclarativeFlickableVisibleArea *QDeclarativeFlickable::visibleArea()
}
/*!
- \qmlproperty enumeration Flickable::flickDirection
+ \qmlproperty enumeration Flickable::flickableDirection
This property determines which directions the view can be flicked.
\list
- \o AutoFlickDirection (default) - allows flicking vertically if the
+ \o Flickable.AutoFlickDirection (default) - allows flicking vertically if the
\e contentHeight is not equal to the \e height of the Flickable.
Allows flicking horizontally if the \e contentWidth is not equal
to the \e width of the Flickable.
- \o HorizontalFlick - allows flicking horizontally.
- \o VerticalFlick - allows flicking vertically.
- \o HorizontalAndVerticalFlick - allows flicking in both directions.
+ \o Flickable.HorizontalFlick - allows flicking horizontally.
+ \o Flickable.VerticalFlick - allows flicking vertically.
+ \o Flickable.HorizontalAndVerticalFlick - allows flicking in both directions.
\endlist
*/
-QDeclarativeFlickable::FlickDirection QDeclarativeFlickable::flickDirection() const
+QDeclarativeFlickable::FlickableDirection QDeclarativeFlickable::flickableDirection() const
{
Q_D(const QDeclarativeFlickable);
- return d->flickDirection;
+ return d->flickableDirection;
}
-void QDeclarativeFlickable::setFlickDirection(FlickDirection direction)
+void QDeclarativeFlickable::setFlickableDirection(FlickableDirection direction)
{
Q_D(QDeclarativeFlickable);
- if (direction != d->flickDirection) {
- d->flickDirection = direction;
- emit flickDirectionChanged();
+ if (direction != d->flickableDirection) {
+ d->flickableDirection = direction;
+ emit flickableDirectionChanged();
}
}
+QDeclarativeFlickable::FlickableDirection QDeclarativeFlickable::flickDirection() const
+{
+ qmlInfo(this) << "'flickDirection' is deprecated. Please use 'flickableDirection' instead.";
+ return flickableDirection();
+}
+
+void QDeclarativeFlickable::setFlickDirection(FlickableDirection direction)
+{
+ qmlInfo(this) << "'flickDirection' is deprecated. Please use 'flickableDirection' instead.";
+ setFlickableDirection(direction);
+}
+
void QDeclarativeFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event)
{
if (interactive && timeline.isActive() && (qAbs(hData.velocity) > 10 || qAbs(vData.velocity) > 10))
@@ -624,7 +647,8 @@ void QDeclarativeFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEven
pressPos = event->pos();
hData.pressPos = hData.move.value();
vData.pressPos = vData.move.value();
- flicked = false;
+ flickingHorizontally = false;
+ flickingVertically = false;
QDeclarativeItemPrivate::start(pressTime);
QDeclarativeItemPrivate::start(velocityTime);
}
@@ -636,7 +660,6 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent
return;
bool rejectY = false;
bool rejectX = false;
- bool moved = false;
if (q->yflick()) {
int dy = int(event->pos().y() - pressPos.y());
@@ -658,7 +681,7 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent
}
if (!rejectY && stealMouse) {
vData.move.setValue(qRound(newY));
- moved = true;
+ vMoved = true;
}
if (qAbs(dy) > QApplication::startDragDistance())
stealMouse = true;
@@ -685,7 +708,7 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent
}
if (!rejectX && stealMouse) {
hData.move.setValue(qRound(newX));
- moved = true;
+ hMoved = true;
}
if (qAbs(dx) > QApplication::startDragDistance())
@@ -715,7 +738,7 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent
if (rejectY) vData.velocity = 0;
if (rejectX) hData.velocity = 0;
- if (moved) {
+ if (hMoved || vMoved) {
q->movementStarting();
q->viewportMoved();
}
@@ -810,20 +833,24 @@ void QDeclarativeFlickable::wheelEvent(QGraphicsSceneWheelEvent *event)
d->vData.velocity = qMax(event->delta() - d->vData.smoothVelocity.value(), qreal(250.0));
else
d->vData.velocity = qMin(event->delta() - d->vData.smoothVelocity.value(), qreal(-250.0));
- d->flicked = false;
+ d->flickingVertically = false;
d->flickY(d->vData.velocity);
- if (d->flicked)
+ if (d->flickingVertically) {
+ d->vMoved = true;
movementStarting();
+ }
event->accept();
} else if (xflick()) {
if (event->delta() > 0)
d->hData.velocity = qMax(event->delta() - d->hData.smoothVelocity.value(), qreal(250.0));
else
d->hData.velocity = qMin(event->delta() - d->hData.smoothVelocity.value(), qreal(-250.0));
- d->flicked = false;
+ d->flickingHorizontally = false;
d->flickX(d->hData.velocity);
- if (d->flicked)
+ if (d->flickingHorizontally) {
+ d->hMoved = true;
movementStarting();
+ }
event->accept();
} else {
QDeclarativeItem::wheelEvent(event);
@@ -1026,14 +1053,14 @@ void QDeclarativeFlickable::setOverShoot(bool o)
This enables the feeling that the edges of the view are soft,
rather than a hard physical boundary.
- boundsBehavior can be one of:
+ The \c boundsBehavior can be one of:
\list
- \o \e StopAtBounds - the contents can not be dragged beyond the boundary
+ \o \e Flickable.StopAtBounds - the contents can not be dragged beyond the boundary
of the flickable, and flicks will not overshoot.
- \o \e DragOverBounds - the contents can be dragged beyond the boundary
+ \o \e Flickable.DragOverBounds - the contents can be dragged beyond the boundary
of the Flickable, but flicks will not overshoot.
- \o \e DragAndOvershootBounds (default) - the contents can be dragged
+ \o \e Flickable.DragAndOvershootBounds (default) - the contents can be dragged
beyond the boundary of the Flickable, and can overshoot the
boundary when flicked.
\endlist
@@ -1059,12 +1086,16 @@ void QDeclarativeFlickable::setBoundsBehavior(BoundsBehavior b)
\qmlproperty int Flickable::contentHeight
The dimensions of the content (the surface controlled by Flickable). Typically this
- should be set to the combined size of the items placed in the Flickable.
+ should be set to the combined size of the items placed in the Flickable. Note this
+ can be set automatically using \l {Item::childrenRect.width}{childrenRect.width}
+ and \l {Item::childrenRect.height}{childrenRect.height}. For example:
\code
Flickable {
- width: 320; height: 480; contentWidth: image.width; contentHeight: image.height
- Image { id: image; source: "bigimage.png" }
+ width: 320; height: 480
+ contentWidth: childrenRect.width; contentHeight: childrenRect.height
+
+ Image { id: image; source: "bigImage.png" }
}
\endcode
*/
@@ -1085,7 +1116,7 @@ void QDeclarativeFlickable::setContentWidth(qreal w)
else
d->viewport->setWidth(w);
// Make sure that we're entirely in view.
- if (!d->pressed) {
+ if (!d->pressed && !d->movingHorizontally && !d->movingVertically) {
int oldDuration = d->fixupDuration;
d->fixupDuration = 0;
d->fixupX();
@@ -1112,7 +1143,7 @@ void QDeclarativeFlickable::setContentHeight(qreal h)
else
d->viewport->setHeight(h);
// Make sure that we're entirely in view.
- if (!d->pressed) {
+ if (!d->pressed && !d->movingHorizontally && !d->movingVertically) {
int oldDuration = d->fixupDuration;
d->fixupDuration = 0;
d->fixupY();
@@ -1143,17 +1174,17 @@ qreal QDeclarativeFlickable::vHeight() const
bool QDeclarativeFlickable::xflick() const
{
Q_D(const QDeclarativeFlickable);
- if (d->flickDirection == QDeclarativeFlickable::AutoFlickDirection)
+ if (d->flickableDirection == QDeclarativeFlickable::AutoFlickDirection)
return vWidth() != width();
- return d->flickDirection & QDeclarativeFlickable::HorizontalFlick;
+ return d->flickableDirection & QDeclarativeFlickable::HorizontalFlick;
}
bool QDeclarativeFlickable::yflick() const
{
Q_D(const QDeclarativeFlickable);
- if (d->flickDirection == QDeclarativeFlickable::AutoFlickDirection)
+ if (d->flickableDirection == QDeclarativeFlickable::AutoFlickDirection)
return vHeight() != height();
- return d->flickDirection & QDeclarativeFlickable::VerticalFlick;
+ return d->flickableDirection & QDeclarativeFlickable::VerticalFlick;
}
bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event)
@@ -1275,16 +1306,30 @@ void QDeclarativeFlickable::setFlickDeceleration(qreal deceleration)
emit flickDecelerationChanged();
}
+bool QDeclarativeFlickable::isFlicking() const
+{
+ Q_D(const QDeclarativeFlickable);
+ return d->flickingHorizontally || d->flickingVertically;
+}
+
/*!
\qmlproperty bool Flickable::flicking
+ \qmlproperty bool Flickable::flickingHorizontally
+ \qmlproperty bool Flickable::flickingVertically
- This property holds whether the view is currently moving due to
- the user flicking the view.
+ These properties hold whether the view is currently moving horizontally
+ or vertically due to the user flicking the view.
*/
-bool QDeclarativeFlickable::isFlicking() const
+bool QDeclarativeFlickable::isFlickingHorizontally() const
+{
+ Q_D(const QDeclarativeFlickable);
+ return d->flickingHorizontally;
+}
+
+bool QDeclarativeFlickable::isFlickingVertically() const
{
Q_D(const QDeclarativeFlickable);
- return d->flicked;
+ return d->flickingVertically;
}
/*!
@@ -1313,40 +1358,84 @@ void QDeclarativeFlickable::setPressDelay(int delay)
emit pressDelayChanged();
}
+
+bool QDeclarativeFlickable::isMoving() const
+{
+ Q_D(const QDeclarativeFlickable);
+ return d->movingHorizontally || d->movingVertically;
+}
+
/*!
\qmlproperty bool Flickable::moving
+ \qmlproperty bool Flickable::movingHorizontally
+ \qmlproperty bool Flickable::movingVertically
- This property holds whether the view is currently moving due to
- the user either dragging or flicking the view.
+ These properties hold whether the view is currently moving horizontally
+ or vertically due to the user either dragging or flicking the view.
*/
-bool QDeclarativeFlickable::isMoving() const
+bool QDeclarativeFlickable::isMovingHorizontally() const
{
Q_D(const QDeclarativeFlickable);
- return d->moving;
+ return d->movingHorizontally;
+}
+
+bool QDeclarativeFlickable::isMovingVertically() const
+{
+ Q_D(const QDeclarativeFlickable);
+ return d->movingVertically;
}
void QDeclarativeFlickable::movementStarting()
{
Q_D(QDeclarativeFlickable);
- if (!d->moving) {
- d->moving = true;
+ if (d->hMoved && !d->movingHorizontally) {
+ d->movingHorizontally = true;
+ emit movingChanged();
+ emit movingHorizontallyChanged();
+ if (!d->movingVertically)
+ emit movementStarted();
+ }
+ else if (d->vMoved && !d->movingVertically) {
+ d->movingVertically = true;
emit movingChanged();
- emit movementStarted();
+ emit movingVerticallyChanged();
+ if (!d->movingHorizontally)
+ emit movementStarted();
}
}
void QDeclarativeFlickable::movementEnding()
{
Q_D(QDeclarativeFlickable);
- if (d->moving) {
- d->moving = false;
- emit movingChanged();
- emit movementEnded();
+ if (d->flickingHorizontally) {
+ d->flickingHorizontally = false;
+ emit flickingChanged();
+ emit flickingHorizontallyChanged();
+ if (!d->flickingVertically)
+ emit flickEnded();
}
- if (d->flicked) {
- d->flicked = false;
+ if (d->flickingVertically) {
+ d->flickingVertically = false;
emit flickingChanged();
- emit flickEnded();
+ emit flickingVerticallyChanged();
+ if (!d->flickingHorizontally)
+ emit flickEnded();
+ }
+ if (d->movingHorizontally) {
+ d->movingHorizontally = false;
+ d->hMoved = false;
+ emit movingChanged();
+ emit movingHorizontallyChanged();
+ if (!d->movingVertically)
+ emit movementEnded();
+ }
+ if (d->movingVertically) {
+ d->movingVertically = false;
+ d->vMoved = false;
+ emit movingChanged();
+ emit movingVerticallyChanged();
+ if (!d->movingHorizontally)
+ emit movementEnded();
}
d->hData.smoothVelocity.setValue(0);
d->vData.smoothVelocity.setValue(0);
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h
index f031a24d49..05887b82bd 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h
@@ -69,8 +69,13 @@ class Q_DECLARATIVE_EXPORT QDeclarativeFlickable : public QDeclarativeItem
Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity NOTIFY maximumFlickVelocityChanged)
Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged)
Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged)
+ Q_PROPERTY(bool movingHorizontally READ isMovingHorizontally NOTIFY movingHorizontallyChanged)
+ Q_PROPERTY(bool movingVertically READ isMovingVertically NOTIFY movingVerticallyChanged)
Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged)
- Q_PROPERTY(FlickDirection flickDirection READ flickDirection WRITE setFlickDirection NOTIFY flickDirectionChanged)
+ Q_PROPERTY(bool flickingHorizontally READ isFlickingHorizontally NOTIFY flickingHorizontallyChanged)
+ Q_PROPERTY(bool flickingVertically READ isFlickingVertically NOTIFY flickingVerticallyChanged)
+ Q_PROPERTY(FlickableDirection flickDirection READ flickDirection WRITE setFlickDirection NOTIFY flickableDirectionChanged) // deprecated
+ Q_PROPERTY(FlickableDirection flickableDirection READ flickableDirection WRITE setFlickableDirection NOTIFY flickableDirectionChanged)
Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged)
Q_PROPERTY(int pressDelay READ pressDelay WRITE setPressDelay NOTIFY pressDelayChanged)
@@ -86,7 +91,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeFlickable : public QDeclarativeItem
Q_PROPERTY(QDeclarativeListProperty<QGraphicsObject> flickableChildren READ flickableChildren)
Q_CLASSINFO("DefaultProperty", "flickableData")
- Q_ENUMS(FlickDirection)
+ Q_ENUMS(FlickableDirection)
Q_ENUMS(BoundsBehavior)
public:
@@ -116,7 +121,11 @@ public:
void setContentY(qreal pos);
bool isMoving() const;
+ bool isMovingHorizontally() const;
+ bool isMovingVertically() const;
bool isFlicking() const;
+ bool isFlickingHorizontally() const;
+ bool isFlickingVertically() const;
int pressDelay() const;
void setPressDelay(int delay);
@@ -140,9 +149,11 @@ public:
QDeclarativeItem *viewport();
- enum FlickDirection { AutoFlickDirection=0x00, HorizontalFlick=0x01, VerticalFlick=0x02, HorizontalAndVerticalFlick=0x03 };
- FlickDirection flickDirection() const;
- void setFlickDirection(FlickDirection);
+ enum FlickableDirection { AutoFlickDirection=0x00, HorizontalFlick=0x01, VerticalFlick=0x02, HorizontalAndVerticalFlick=0x03 };
+ FlickableDirection flickDirection() const; // deprecated
+ void setFlickDirection(FlickableDirection); // deprecated
+ FlickableDirection flickableDirection() const;
+ void setFlickableDirection(FlickableDirection);
Q_SIGNALS:
void contentWidthChanged();
@@ -150,22 +161,26 @@ Q_SIGNALS:
void contentXChanged();
void contentYChanged();
void movingChanged();
+ void movingHorizontallyChanged();
+ void movingVerticallyChanged();
void flickingChanged();
- void movementStarted();
- void movementEnded();
- void flickStarted();
- void flickEnded();
+ void flickingHorizontallyChanged();
+ void flickingVerticallyChanged();
void horizontalVelocityChanged();
void verticalVelocityChanged();
void isAtBoundaryChanged();
void pageChanged();
- void flickDirectionChanged();
+ void flickableDirectionChanged();
void interactiveChanged();
void overShootChanged();
void boundsBehaviorChanged();
void maximumFlickVelocityChanged();
void flickDecelerationChanged();
void pressDelayChanged();
+ void movementStarted();
+ void movementEnded();
+ void flickStarted();
+ void flickEnded();
protected:
virtual bool sceneEventFilter(QGraphicsItem *, QEvent *);
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
index 01cfb1805e..b467ed2306 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
@@ -131,8 +131,12 @@ public:
AxisData vData;
QDeclarativeTimeLine timeline;
- bool flicked : 1;
- bool moving : 1;
+ bool flickingHorizontally : 1;
+ bool flickingVertically : 1;
+ bool hMoved : 1;
+ bool vMoved : 1;
+ bool movingHorizontally : 1;
+ bool movingVertically : 1;
bool stealMouse : 1;
bool pressed : 1;
bool interactive : 1;
@@ -158,7 +162,7 @@ public:
int vTime;
QDeclarativeTimeLine velocityTimeline;
QDeclarativeFlickableVisibleArea *visibleArea;
- QDeclarativeFlickable::FlickDirection flickDirection;
+ QDeclarativeFlickable::FlickableDirection flickableDirection;
QDeclarativeFlickable::BoundsBehavior boundsBehavior;
void handleMousePressEvent(QGraphicsSceneMouseEvent *);
diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
index 57045f1db6..d926119317 100644
--- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
@@ -94,8 +94,6 @@ public:
\class QDeclarativeFlipable
\brief The Flipable item provides a surface that can be flipped.
- \ingroup group_widgets
-
Flipable is an item that can be visibly "flipped" between its front and
back sides.
*/
@@ -169,7 +167,7 @@ void QDeclarativeFlipable::retransformBack()
\qmlproperty enumeration Flipable::side
The side of the Flippable currently visible. Possible values are \c
- Front and \c Back.
+ Flippable.Front and \c Flippable.Back.
*/
QDeclarativeFlipable::Side QDeclarativeFlipable::side() const
{
@@ -192,12 +190,15 @@ void QDeclarativeFlipablePrivate::updateSceneTransformFromParent()
QPointF p2(1, 0);
QPointF p3(1, 1);
- p1 = sceneTransform.map(p1);
- p2 = sceneTransform.map(p2);
- p3 = sceneTransform.map(p3);
+ QPointF scenep1 = sceneTransform.map(p1);
+ QPointF scenep2 = sceneTransform.map(p2);
+ QPointF scenep3 = sceneTransform.map(p3);
+ p1 = q->mapToParent(p1);
+ p2 = q->mapToParent(p2);
+ p3 = q->mapToParent(p3);
- qreal cross = (p1.x() - p2.x()) * (p3.y() - p2.y()) -
- (p1.y() - p2.y()) * (p3.x() - p2.x());
+ qreal cross = (scenep1.x() - scenep2.x()) * (scenep3.y() - scenep2.y()) -
+ (scenep1.y() - scenep2.y()) * (scenep3.x() - scenep2.x());
wantBackYFlipped = p1.x() >= p2.x();
wantBackXFlipped = p2.y() >= p3.y();
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index f79a8532c1..e1874b8c19 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -108,7 +108,7 @@ public:
, highlightComponent(0), highlight(0), trackedItem(0)
, moveReason(Other), buffer(0), highlightXAnimator(0), highlightYAnimator(0)
, highlightMoveDuration(150)
- , bufferMode(NoBuffer), snapMode(QDeclarativeGridView::NoSnap)
+ , bufferMode(BufferBefore | BufferAfter), snapMode(QDeclarativeGridView::NoSnap)
, ownModel(false), wrap(false), autoHighlight(true)
, fixCurrentVisibility(false), lazyRelease(false), layoutScheduled(false)
, deferredRelease(false), haveHighlightRange(false) {}
@@ -331,7 +331,7 @@ public:
QSmoothedAnimation *highlightYAnimator;
int highlightMoveDuration;
enum BufferMode { NoBuffer = 0x00, BufferBefore = 0x01, BufferAfter = 0x02 };
- BufferMode bufferMode;
+ int bufferMode;
QDeclarativeGridView::SnapMode snapMode;
bool ownModel : 1;
@@ -349,7 +349,7 @@ void QDeclarativeGridViewPrivate::init()
Q_Q(QDeclarativeGridView);
QObject::connect(q, SIGNAL(movementEnded()), q, SLOT(animStopped()));
q->setFlag(QGraphicsItem::ItemIsFocusScope);
- q->setFlickDirection(QDeclarativeFlickable::VerticalFlick);
+ q->setFlickableDirection(QDeclarativeFlickable::VerticalFlick);
addItemChangeListener(this, Geometry);
}
@@ -378,9 +378,11 @@ FxGridItem *QDeclarativeGridViewPrivate::createItem(int modelIndex)
if (model->completePending()) {
// complete
listItem->item->setZValue(1);
+ listItem->item->setParentItem(q->viewport());
model->completeItem();
+ } else {
+ listItem->item->setParentItem(q->viewport());
}
- listItem->item->setParentItem(q->viewport());
unrequestedItems.remove(listItem->item);
}
requestedIndex = -1;
@@ -690,7 +692,7 @@ void QDeclarativeGridViewPrivate::updateHighlight()
{
if ((!currentItem && highlight) || (currentItem && !highlight))
createHighlight();
- if (currentItem && autoHighlight && highlight && !moving) {
+ if (currentItem && autoHighlight && highlight && !movingHorizontally && !movingVertically) {
// auto-update highlight
highlightXAnimator->to = currentItem->item->x();
highlightYAnimator->to = currentItem->item->y();
@@ -804,7 +806,8 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
Q_Q(QDeclarativeGridView);
moveReason = Mouse;
- if ((!haveHighlightRange || highlightRange != QDeclarativeGridView::StrictlyEnforceRange) && snapMode == QDeclarativeGridView::NoSnap) {
+ if ((!haveHighlightRange || highlightRange != QDeclarativeGridView::StrictlyEnforceRange)
+ && snapMode == QDeclarativeGridView::NoSnap) {
QDeclarativeFlickablePrivate::flick(data, minExtent, maxExtent, vSize, fixupCallback, velocity);
return;
}
@@ -855,10 +858,13 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
qreal adjDist = -data.flickTarget + data.move.value();
if (qAbs(adjDist) > qAbs(dist)) {
// Prevent painfully slow flicking - adjust velocity to suit flickDeceleration
- v2 = accel * 2.0f * qAbs(dist);
- v = qSqrt(v2);
- if (dist > 0)
- v = -v;
+ qreal adjv2 = accel * 2.0f * qAbs(adjDist);
+ if (adjv2 > v2) {
+ v2 = adjv2;
+ v = qSqrt(v2);
+ if (dist > 0)
+ v = -v;
+ }
}
dist = adjDist;
accel = v2 / (2.0f * qAbs(dist));
@@ -869,9 +875,18 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
timeline.reset(data.move);
timeline.accel(data.move, v, accel, maxDistance + overshootDist);
timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this));
- flicked = true;
- emit q->flickingChanged();
- emit q->flickStarted();
+ if (!flickingHorizontally && q->xflick()) {
+ flickingHorizontally = true;
+ emit q->flickingChanged();
+ emit q->flickingHorizontallyChanged();
+ emit q->flickStarted();
+ }
+ if (!flickingVertically && q->yflick()) {
+ flickingVertically = true;
+ emit q->flickingChanged();
+ emit q->flickingVerticallyChanged();
+ emit q->flickStarted();
+ }
} else {
timeline.reset(data.move);
fixup(data, minExtent, maxExtent);
@@ -905,6 +920,9 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
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.
+ Delegates are instantiated as needed and may be destroyed at any time.
+ State should \e never be stored in a delegate.
+
\bold Note that views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
to set \e {clip: true} in order to have the out of view items clipped
@@ -958,7 +976,7 @@ QDeclarativeGridView::~QDeclarativeGridView()
id: wrapper
GridView.onRemove: SequentialAnimation {
PropertyAction { target: wrapper; property: "GridView.delayRemove"; value: true }
- NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: "InOutQuad" }
+ NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: Easing.InOutQuad }
PropertyAction { target: wrapper; property: "GridView.delayRemove"; value: false }
}
}
@@ -1019,13 +1037,14 @@ void QDeclarativeGridView::setModel(const QVariant &model)
d->model = vim;
} else {
if (!d->ownModel) {
- d->model = new QDeclarativeVisualDataModel(qmlContext(this));
+ d->model = new QDeclarativeVisualDataModel(qmlContext(this), this);
d->ownModel = true;
}
if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model))
dataModel->setModel(model);
}
if (d->model) {
+ d->bufferMode = QDeclarativeGridViewPrivate::BufferBefore | QDeclarativeGridViewPrivate::BufferAfter;
if (isComponentComplete()) {
refill();
if (d->currentIndex >= d->model->count() || d->currentIndex < 0) {
@@ -1047,12 +1066,17 @@ void QDeclarativeGridView::setModel(const QVariant &model)
}
/*!
- \qmlproperty component GridView::delegate
+ \qmlproperty Component GridView::delegate
The delegate provides a template defining each item instantiated by the view.
The index is exposed as an accessible \c index property. Properties of the
model are also available depending upon the type of \l {qmlmodels}{Data Model}.
+ The number of elements in the delegate has a direct effect on the
+ flicking performance of the view. If at all possible, place functionality
+ that is not needed for the normal display of the delegate in a \l Loader which
+ can load additional elements when needed.
+
Note that the GridView will layout the items based on the size of the root item
in the delegate.
@@ -1160,7 +1184,7 @@ int QDeclarativeGridView::count() const
}
/*!
- \qmlproperty component GridView::highlight
+ \qmlproperty Component GridView::highlight
This property holds the component to use as the highlight.
An instance of the highlight component will be created for each view.
@@ -1271,17 +1295,17 @@ void QDeclarativeGridView::setHighlightMoveDuration(int duration)
highlight range. Furthermore, the behaviour of the current item index will occur
whether or not a highlight exists.
- If highlightRangeMode is set to \e ApplyRange the view will
+ If highlightRangeMode is set to \e GridView.ApplyRange the view will
attempt to maintain the highlight within the range, however
the highlight can move outside of the range at the ends of the list
or due to a mouse interaction.
- If highlightRangeMode is set to \e StrictlyEnforceRange the highlight will never
+ If highlightRangeMode is set to \e GridView.StrictlyEnforceRange the highlight will never
move outside of the range. This means that the current item will change
if a keyboard or mouse action would cause the highlight to move
outside of the range.
- The default value is \e NoHighlightRange.
+ The default value is \e GridView.NoHighlightRange.
Note that a valid range requires preferredHighlightEnd to be greater
than or equal to preferredHighlightBegin.
@@ -1339,10 +1363,10 @@ void QDeclarativeGridView::setHighlightRangeMode(HighlightRangeMode mode)
\qmlproperty enumeration GridView::flow
This property holds the flow of the grid.
- Possible values are \c LeftToRight (default) and \c TopToBottom.
+ Possible values are \c GridView.LeftToRight (default) and \c GridView.TopToBottom.
- If \a flow is \c LeftToRight, the view will scroll vertically.
- If \a flow is \c TopToBottom, the view will scroll horizontally.
+ If \a flow is \c GridView.LeftToRight, the view will scroll vertically.
+ If \a flow is \c GridView.TopToBottom, the view will scroll horizontally.
*/
QDeclarativeGridView::Flow QDeclarativeGridView::flow() const
{
@@ -1357,10 +1381,10 @@ void QDeclarativeGridView::setFlow(Flow flow)
d->flow = flow;
if (d->flow == LeftToRight) {
setContentWidth(-1);
- setFlickDirection(QDeclarativeFlickable::VerticalFlick);
+ setFlickableDirection(QDeclarativeFlickable::VerticalFlick);
} else {
setContentHeight(-1);
- setFlickDirection(QDeclarativeFlickable::HorizontalFlick);
+ setFlickableDirection(QDeclarativeFlickable::HorizontalFlick);
}
d->clear();
d->updateGrid();
@@ -1393,12 +1417,23 @@ void QDeclarativeGridView::setWrapEnabled(bool wrap)
}
/*!
- \qmlproperty int GridView::cacheBuffer
- This property holds the number of off-screen pixels to cache.
-
- This property determines the number of pixels above the top of the view
- 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.
+ \qmlproperty int GridView::cacheBuffer
+ This property determines whether delegates are retained outside the
+ visible area of the view.
+
+ If non-zero the view will keep as many delegates
+ instantiated as will fit within the buffer specified. For example,
+ if in a vertical view the delegate is 20 pixels high and \c cacheBuffer is
+ set to 40, then up to 2 delegates above and 2 delegates below the visible
+ area may be retained.
+
+ Note that cacheBuffer is not a pixel buffer - it only maintains additional
+ instantiated delegates.
+
+ Setting this value can make scrolling the list smoother at the expense
+ of additional memory usage. It is not a substitute for creating efficient
+ delegates; the fewer elements in a delegate, the faster a view may be
+ scrolled.
*/
int QDeclarativeGridView::cacheBuffer() const
{
@@ -1465,10 +1500,10 @@ void QDeclarativeGridView::setCellHeight(int cellHeight)
The allowed values are:
\list
- \o NoSnap (default) - the view will stop anywhere within the visible area.
- \o SnapToRow - the view will settle with a row (or column for TopToBottom flow)
+ \o GridView.NoSnap (default) - the view will stop anywhere within the visible area.
+ \o GridView.SnapToRow - the view will settle with a row (or column for TopToBottom flow)
aligned with the start of the view.
- \o SnapOneRow - the view will settle no more than one row (or column for TopToBottom flow)
+ \o GridView.SnapOneRow - the view will settle no more than one row (or column for TopToBottom flow)
away from the first visible row at the time the mouse button is released.
This mode is particularly useful for moving one page at a time.
\endlist
@@ -1505,7 +1540,7 @@ void QDeclarativeGridView::viewportMoved()
Q_D(QDeclarativeGridView);
QDeclarativeFlickable::viewportMoved();
d->lazyRelease = true;
- if (d->flicked) {
+ if (d->flickingHorizontally || d->flickingVertically) {
if (yflick()) {
if (d->vData.velocity > 0)
d->bufferMode = QDeclarativeGridViewPrivate::BufferBefore;
@@ -1521,7 +1556,7 @@ void QDeclarativeGridView::viewportMoved()
}
}
refill();
- if (isFlicking() || d->moving)
+ if (d->flickingHorizontally || d->flickingVertically || d->movingHorizontally || d->movingVertically)
d->moveReason = QDeclarativeGridViewPrivate::Mouse;
if (d->moveReason != QDeclarativeGridViewPrivate::SetIndex) {
if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange && d->highlight) {
@@ -1616,6 +1651,9 @@ qreal QDeclarativeGridView::maxXExtent() const
void QDeclarativeGridView::keyPressEvent(QKeyEvent *event)
{
Q_D(QDeclarativeGridView);
+ keyPressPreHandler(event);
+ if (event->isAccepted())
+ return;
if (d->model && d->model->count() && d->interactive) {
d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
int oldCurrent = currentIndex();
@@ -1641,10 +1679,8 @@ void QDeclarativeGridView::keyPressEvent(QKeyEvent *event)
}
}
d->moveReason = QDeclarativeGridViewPrivate::Other;
- QDeclarativeFlickable::keyPressEvent(event);
- if (event->isAccepted())
- return;
event->ignore();
+ QDeclarativeFlickable::keyPressEvent(event);
}
/*!
@@ -1860,7 +1896,8 @@ void QDeclarativeGridView::trackedPositionChanged()
Q_D(QDeclarativeGridView);
if (!d->trackedItem || !d->currentItem)
return;
- if (!isFlicking() && !d->moving && d->moveReason == QDeclarativeGridViewPrivate::SetIndex) {
+ if (!d->flickingHorizontally && !d->flickingVertically && !d->movingHorizontally && !d->movingVertically
+ && d->moveReason == QDeclarativeGridViewPrivate::SetIndex) {
const qreal trackedPos = d->trackedItem->rowPos();
const qreal viewPos = d->position();
if (d->haveHighlightRange) {
diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h
index c06879e7b8..2bf154c725 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h
@@ -82,6 +82,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeGridView : public QDeclarativeFlickable
Q_ENUMS(HighlightRangeMode)
Q_ENUMS(SnapMode)
+ Q_ENUMS(Flow)
+ Q_ENUMS(PositionMode)
Q_CLASSINFO("DefaultProperty", "data")
public:
@@ -120,7 +122,6 @@ public:
qreal preferredHighlightEnd() const;
void setPreferredHighlightEnd(qreal);
- Q_ENUMS(Flow)
enum Flow { LeftToRight, TopToBottom };
Flow flow() const;
void setFlow(Flow);
@@ -142,7 +143,6 @@ public:
void setSnapMode(SnapMode mode);
enum PositionMode { Beginning, Center, End, Visible, Contain };
- Q_ENUMS(PositionMode);
Q_INVOKABLE void positionViewAtIndex(int index, int mode);
Q_INVOKABLE int indexAt(int x, int y) const;
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index 247e348cb0..fe642e009b 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -54,68 +54,44 @@ QT_BEGIN_NAMESPACE
\brief The Image element allows you to add bitmaps to a scene.
\inherits Item
- The Image element supports untransformed, stretched and tiled.
+ An Image element displays a specified \l source image:
- For an explanation of stretching and tiling, see the fillMode property description.
-
- Examples:
\table
\row
- \o \image declarative-qtlogo1.png
- \o Untransformed
- \qml
- Image { source: "pics/qtlogo.png" }
- \endqml
- \row
- \o \image declarative-qtlogo2.png
- \o fillMode: Stretch (default)
- \qml
- Image {
- width: 160
- height: 160
- source: "pics/qtlogo.png"
- }
- \endqml
- \row
- \o \image declarative-qtlogo3.png
- \o fillMode: Tile
- \qml
- Image {
- fillMode: Image.Tile
- width: 160; height: 160
- source: "pics/qtlogo.png"
- }
- \endqml
- \row
- \o \image declarative-qtlogo6.png
- \o fillMode: TileVertically
- \qml
- Image {
- fillMode: Image.TileVertically
- width: 160; height: 160
- source: "pics/qtlogo.png"
- }
- \endqml
- \row
- \o \image declarative-qtlogo5.png
- \o fillMode: TileHorizontally
+ \o
+ \image declarative-qtlogo.png
+ \o
\qml
- Image {
- fillMode: Image.TileHorizontally
- width: 160; height: 160
- source: "pics/qtlogo.png"
- }
+ import Qt 4.7
+
+ Image { source: "qtlogo.png" }
\endqml
\endtable
- */
+
+ If a size is not specified explicitly, the Image element is sized to the loaded image.
+ Image elements can be stretched and tiled using the \l fillMode property.
+
+ If the image \l source is a network resource, the image is loaded asynchronous and the
+ \l progress and \l status properties are updated appropriately. Otherwise, if the image is
+ available locally, it is loaded immediately and the user interface is blocked until loading is
+ complete. (This is typically the correct behavior for user interface elements.)
+ For large local images, which do not need to be visible immediately, it may be preferable to
+ enable \l asynchronous loading. This loads the image in the background using a low priority thread.
+
+ Images are cached and shared internally, so if several Image elements have the same source
+ only one copy of the image will be loaded.
+
+ \bold Note: Images are often the greatest user of memory in QML user interfaces. It is recommended
+ that images which do not form part of the user interface have their
+ size bounded via the \l sourceSize property. This is especially important for content
+ that is loaded from external sources or provided by the user.
+*/
/*!
\internal
\class QDeclarativeImage Image
\brief The QDeclarativeImage class provides an image item that you can add to a QDeclarativeView.
- \ingroup group_coreitems
-
Example:
\qml
Image { source: "pics/star.png" }
@@ -181,15 +157,85 @@ void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap)
than the size of the item.
\list
- \o Stretch - the image is scaled to fit
- \o PreserveAspectFit - the image is scaled uniformly to fit without cropping
- \o PreserveAspectCrop - the image is scaled uniformly to fill, cropping if necessary
- \o Tile - the image is duplicated horizontally and vertically
- \o TileVertically - the image is stretched horizontally and tiled vertically
- \o TileHorizontally - the image is stretched vertically and tiled horizontally
+ \o Image.Stretch - the image is scaled to fit
+ \o Image.PreserveAspectFit - the image is scaled uniformly to fit without cropping
+ \o Image.PreserveAspectCrop - the image is scaled uniformly to fill, cropping if necessary
+ \o Image.Tile - the image is duplicated horizontally and vertically
+ \o Image.TileVertically - the image is stretched horizontally and tiled vertically
+ \o Image.TileHorizontally - the image is stretched vertically and tiled horizontally
\endlist
- \image declarative-image_fillMode.gif
+ \table
+
+ \row
+ \o \image declarative-qtlogo-stretch.png
+ \o Stretch (default)
+ \qml
+ Image {
+ width: 130; height: 100
+ smooth: true
+ source: "qtlogo.png"
+ }
+ \endqml
+
+ \row
+ \o \image declarative-qtlogo-preserveaspectfit.png
+ \o PreserveAspectFit
+ \qml
+ Image {
+ width: 130; height: 100
+ fillMode: Image.PreserveAspectFit
+ smooth: true
+ source: "qtlogo.png"
+ }
+ \endqml
+
+ \row
+ \o \image declarative-qtlogo-preserveaspectcrop.png
+ \o PreserveAspectCrop
+ \qml
+ Image {
+ width: 130; height: 100
+ fillMode: Image.PreserveAspectCrop
+ smooth: true
+ source: "qtlogo.png"
+ }
+ \endqml
+
+ \row
+ \o \image declarative-qtlogo-tile.png
+ \o Tile
+ \qml
+ Image {
+ width: 120; height: 120
+ fillMode: Image.Tile
+ source: "qtlogo.png"
+ }
+ \endqml
+
+ \row
+ \o \image declarative-qtlogo-tilevertically.png
+ \o TileVertically
+ \qml
+ Image {
+ width: 120; height: 120
+ fillMode: Image.TileVertically
+ source: "qtlogo.png"
+ }
+ \endqml
+
+ \row
+ \o \image declarative-qtlogo-tilehorizontally.png
+ \o TileHorizontally
+ \qml
+ Image {
+ width: 120; height: 120
+ fillMode: Image.TileHorizontally
+ source: "qtlogo.png"
+ }
+ \endqml
+
+ \endtable
*/
QDeclarativeImage::FillMode QDeclarativeImage::fillMode() const
{
@@ -225,10 +271,10 @@ qreal QDeclarativeImage::paintedHeight() const
This property holds the status of image loading. It can be one of:
\list
- \o Null - no image has been set
- \o Ready - the image has been loaded
- \o Loading - the image is currently being loaded
- \o Error - an error occurred while loading the image
+ \o Image.Null - no image has been set
+ \o Image.Ready - the image has been loaded
+ \o Image.Loading - the image is currently being loaded
+ \o Image.Error - an error occurred while loading the image
\endlist
Note that a change in the status property does not cause anything to happen
@@ -272,30 +318,54 @@ qreal QDeclarativeImage::paintedHeight() const
/*!
\qmlproperty QSize Image::sourceSize
- This properties is the size of the loaded image, in pixels.
-
- If you set this property explicitly, you can to control the storage
- used by a loaded image. The image will be scaled down if its intrinsic size
- is greater than this value.
-
- If only one dimension of the size is set (and the other left at 0), the
- unset dimension will be set in proportion to the set dimension to preserve
- the source image aspect ratio. The fillMode is independent of this.
-
- Unlike setting the width and height properties, which merely scale the painting
- of the image, this property affects the number of pixels stored.
+ This property holds the size of the loaded image, in pixels.
- \e{Changing this property dynamically will lead to the image source being reloaded,
- potentially even from the network if it is not in the disk cache.}
+ This is used to control the storage used by a loaded image. Unlike
+ the width and height properties, which scale the painting of the image, this property
+ affects the number of pixels stored.
+ If the image's actual size is larger than the sourceSize, the image is scaled down.
+ If only one dimension of the size is set to greater than 0, the
+ other dimension is set in proportion to preserve the source image's aspect ratio.
+ (The \l fillMode is independent of this.)
+
If the source is an instrinsically scalable image (eg. SVG), this property
- determines the size of the loaded image regardless of intrinsic size. You should
- avoid changing this property dynamically - rendering an SVG is \e slow compared
+ determines the size of the loaded image regardless of intrinsic size.
+ Avoid changing this property dynamically; rendering an SVG is \e slow compared
to an image.
If the source is a non-scalable image (eg. JPEG), the loaded image will
be no greater than this property specifies. For some formats (currently only JPEG),
the whole image will never actually be loaded into memory.
+
+ \note \e{Changing this property dynamically will lead to the image source being reloaded,
+ potentially even from the network if it is not in the disk cache.}
+
+ Here is an example that ensures the size of the image in memory is
+ no larger than 1024x1024 pixels, regardless of the size of the Image element.
+
+ \code
+ Image {
+ anchors.fill: parent
+ source: "images/reallyBigImage.jpg"
+ sourceSize.width: 1024
+ sourceSize.height: 1024
+ }
+ \endcode
+
+ The example below ensures the memory used by the image is no more than necessary
+ to display the image at the size of the Image element.
+ Of course if the Image element is resized a costly reload will be required, so
+ use this technique \e only when the Image size is fixed.
+
+ \code
+ Image {
+ anchors.fill: parent
+ source: "images/reallyBigImage.jpg"
+ sourceSize.width: width
+ sourceSize.height: height
+ }
+ \endcode
*/
void QDeclarativeImage::updatePaintedGeometry()
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 096e4bf982..95478844bd 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -219,46 +219,9 @@ QT_BEGIN_NAMESPACE
The angle to rotate, in degrees clockwise.
*/
-
-/*!
- \group group_animation
- \title Animation
-*/
-
-/*!
- \group group_coreitems
- \title Basic Items
-*/
-
-/*!
- \group group_layouts
- \title Layouts
-*/
-
-/*!
- \group group_states
- \title States and Transitions
-*/
-
-/*!
- \group group_utility
- \title Utility
-*/
-
-/*!
- \group group_views
- \title Views
-*/
-
-/*!
- \group group_widgets
- \title Widgets
-*/
-
/*!
\internal
\class QDeclarativeContents
- \ingroup group_utility
\brief The QDeclarativeContents class gives access to the height and width of an item's contents.
*/
@@ -267,62 +230,93 @@ QDeclarativeContents::QDeclarativeContents() : m_x(0), m_y(0), m_width(0), m_hei
{
}
+QDeclarativeContents::~QDeclarativeContents()
+{
+ QList<QGraphicsItem *> children = m_item->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ QDeclarativeItem *child = qobject_cast<QDeclarativeItem *>(children.at(i));
+ if(!child)//### Should this be ignoring non-QDeclarativeItem graphicsobjects?
+ continue;
+ QDeclarativeItemPrivate::get(child)->removeItemChangeListener(this, QDeclarativeItemPrivate::Geometry | QDeclarativeItemPrivate::Destroyed);
+ }
+}
+
QRectF QDeclarativeContents::rectF() const
{
return QRectF(m_x, m_y, m_width, m_height);
}
-//TODO: optimization: only check sender(), if there is one
-void QDeclarativeContents::calcHeight()
+void QDeclarativeContents::calcHeight(QDeclarativeItem *changed)
{
qreal oldy = m_y;
qreal oldheight = m_height;
- qreal top = FLT_MAX;
- qreal bottom = 0;
-
- QList<QGraphicsItem *> children = m_item->childItems();
- for (int i = 0; i < children.count(); ++i) {
- 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)
- bottom = y + child->height();
+ if (changed) {
+ qreal top = oldy;
+ qreal bottom = oldy + oldheight;
+ qreal y = changed->y();
+ if (y + changed->height() > bottom)
+ bottom = y + changed->height();
if (y < top)
top = y;
- }
- if (!children.isEmpty())
m_y = top;
- m_height = qMax(bottom - top, qreal(0.0));
+ m_height = bottom - top;
+ } else {
+ qreal top = FLT_MAX;
+ qreal bottom = 0;
+ QList<QGraphicsItem *> children = m_item->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ 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)
+ bottom = y + child->height();
+ if (y < top)
+ top = y;
+ }
+ if (!children.isEmpty())
+ m_y = top;
+ m_height = qMax(bottom - top, qreal(0.0));
+ }
if (m_height != oldheight || m_y != oldy)
emit rectChanged(rectF());
}
-//TODO: optimization: only check sender(), if there is one
-void QDeclarativeContents::calcWidth()
+void QDeclarativeContents::calcWidth(QDeclarativeItem *changed)
{
qreal oldx = m_x;
qreal oldwidth = m_width;
- qreal left = FLT_MAX;
- qreal right = 0;
-
- QList<QGraphicsItem *> children = m_item->childItems();
- for (int i = 0; i < children.count(); ++i) {
- 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)
- right = x + child->width();
+ if (changed) {
+ qreal left = oldx;
+ qreal right = oldx + oldwidth;
+ qreal x = changed->x();
+ if (x + changed->width() > right)
+ right = x + changed->width();
if (x < left)
left = x;
- }
- if (!children.isEmpty())
m_x = left;
- m_width = qMax(right - left, qreal(0.0));
+ m_width = right - left;
+ } else {
+ qreal left = FLT_MAX;
+ qreal right = 0;
+ QList<QGraphicsItem *> children = m_item->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ 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)
+ right = x + child->width();
+ if (x < left)
+ left = x;
+ }
+ if (!children.isEmpty())
+ m_x = left;
+ m_width = qMax(right - left, qreal(0.0));
+ }
if (m_width != oldwidth || m_x != oldx)
emit rectChanged(rectF());
@@ -331,25 +325,57 @@ void QDeclarativeContents::calcWidth()
void QDeclarativeContents::setItem(QDeclarativeItem *item)
{
m_item = item;
+ //### optimize
+ connect(this, SIGNAL(rectChanged(QRectF)), m_item, SIGNAL(childrenRectChanged(QRectF)));
QList<QGraphicsItem *> children = m_item->childItems();
for (int i = 0; i < children.count(); ++i) {
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()));
- connect(child, SIGNAL(widthChanged()), this, SLOT(calcWidth()));
- connect(child, SIGNAL(xChanged()), this, SLOT(calcWidth()));
- connect(this, SIGNAL(rectChanged(QRectF)), m_item, SIGNAL(childrenRectChanged(QRectF)));
+ QDeclarativeItemPrivate::get(child)->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry | QDeclarativeItemPrivate::Destroyed);
+ //###what about changes to visibility?
}
+ //### defer until componentComplete
+ calcHeight();
+ calcWidth();
+}
+
+void QDeclarativeContents::itemGeometryChanged(QDeclarativeItem *changed, const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ if (newGeometry.width() != oldGeometry.width())
+ calcWidth(changed);
+ if (newGeometry.height() != oldGeometry.height())
+ calcHeight(changed);
+}
+
+void QDeclarativeContents::itemDestroyed(QDeclarativeItem *item)
+{
+ if (item)
+ QDeclarativeItemPrivate::get(item)->removeItemChangeListener(this, QDeclarativeItemPrivate::Geometry | QDeclarativeItemPrivate::Destroyed);
+ calcWidth();
calcHeight();
+}
+
+void QDeclarativeContents::childRemoved(QDeclarativeItem *item)
+{
+ if (item)
+ QDeclarativeItemPrivate::get(item)->removeItemChangeListener(this, QDeclarativeItemPrivate::Geometry | QDeclarativeItemPrivate::Destroyed);
calcWidth();
+ calcHeight();
+}
+
+void QDeclarativeContents::childAdded(QDeclarativeItem *item)
+{
+ if (item)
+ QDeclarativeItemPrivate::get(item)->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry | QDeclarativeItemPrivate::Destroyed);
+ calcWidth(item);
+ calcHeight(item);
}
QDeclarativeItemKeyFilter::QDeclarativeItemKeyFilter(QDeclarativeItem *item)
-: m_next(0)
+: m_processPost(false), m_next(0)
{
QDeclarativeItemPrivate *p =
item?static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(item)):0;
@@ -363,19 +389,19 @@ QDeclarativeItemKeyFilter::~QDeclarativeItemKeyFilter()
{
}
-void QDeclarativeItemKeyFilter::keyPressed(QKeyEvent *event)
+void QDeclarativeItemKeyFilter::keyPressed(QKeyEvent *event, bool post)
{
- if (m_next) m_next->keyPressed(event);
+ if (m_next) m_next->keyPressed(event, post);
}
-void QDeclarativeItemKeyFilter::keyReleased(QKeyEvent *event)
+void QDeclarativeItemKeyFilter::keyReleased(QKeyEvent *event, bool post)
{
- if (m_next) m_next->keyReleased(event);
+ if (m_next) m_next->keyReleased(event, post);
}
-void QDeclarativeItemKeyFilter::inputMethodEvent(QInputMethodEvent *event)
+void QDeclarativeItemKeyFilter::inputMethodEvent(QInputMethodEvent *event, bool post)
{
- if (m_next) m_next->inputMethodEvent(event);
+ if (m_next) m_next->inputMethodEvent(event, post);
}
QVariant QDeclarativeItemKeyFilter::inputMethodQuery(Qt::InputMethodQuery query) const
@@ -437,14 +463,16 @@ void QDeclarativeItemKeyFilter::componentComplete()
}
\endcode
- KeyNavigation receives key events after the item it is attached to.
+ By default KeyNavigation receives key events after the item it is attached to.
If the item accepts an arrow key event, the KeyNavigation
- attached property will not receive an event for that key.
+ attached property will not receive an event for that key. Setting the
+ \l priority property to KeyNavigation.BeforeItem allows handling
+ of the key events before normal item processing.
If an item has been set for a direction and the KeyNavigation
attached property receives the corresponding
key press and release events, the events will be accepted by
- KeyNaviagtion and will not propagate any further.
+ KeyNavigation and will not propagate any further.
\sa {Keys}{Keys attached property}
*/
@@ -464,6 +492,7 @@ QDeclarativeKeyNavigationAttached::QDeclarativeKeyNavigationAttached(QObject *pa
: QObject(*(new QDeclarativeKeyNavigationAttachedPrivate), parent),
QDeclarativeItemKeyFilter(qobject_cast<QDeclarativeItem*>(parent))
{
+ m_processPost = true;
}
QDeclarativeKeyNavigationAttached *
@@ -550,12 +579,45 @@ void QDeclarativeKeyNavigationAttached::setBacktab(QDeclarativeItem *i)
emit changed();
}
-void QDeclarativeKeyNavigationAttached::keyPressed(QKeyEvent *event)
+/*!
+ \qmlproperty enumeration KeyNavigation::priority
+
+ This property determines whether the keys are processed before
+ or after the attached item's own key handling.
+
+ \list
+ \o KeyNavigation.BeforeItem - process the key events before normal
+ item key processing. If the event is accepted it will not
+ be passed on to the item.
+ \o KeyNavigation.AfterItem (default) - process the key events after normal item key
+ handling. If the item accepts the key event it will not be
+ handled by the KeyNavigation attached property handler.
+ \endlist
+*/
+QDeclarativeKeyNavigationAttached::Priority QDeclarativeKeyNavigationAttached::priority() const
+{
+ return m_processPost ? AfterItem : BeforeItem;
+}
+
+void QDeclarativeKeyNavigationAttached::setPriority(Priority order)
{
- Q_D(QDeclarativeKeyNavigationAttached);
+ bool processPost = order == AfterItem;
+ if (processPost != m_processPost) {
+ m_processPost = processPost;
+ emit priorityChanged();
+ }
+}
+void QDeclarativeKeyNavigationAttached::keyPressed(QKeyEvent *event, bool post)
+{
+ Q_D(QDeclarativeKeyNavigationAttached);
event->ignore();
+ if (post != m_processPost) {
+ QDeclarativeItemKeyFilter::keyPressed(event, post);
+ return;
+ }
+
switch(event->key()) {
case Qt::Key_Left:
if (d->left) {
@@ -597,15 +659,19 @@ void QDeclarativeKeyNavigationAttached::keyPressed(QKeyEvent *event)
break;
}
- if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyPressed(event);
+ if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyPressed(event, post);
}
-void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event)
+void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event, bool post)
{
Q_D(QDeclarativeKeyNavigationAttached);
-
event->ignore();
+ if (post != m_processPost) {
+ QDeclarativeItemKeyFilter::keyReleased(event, post);
+ return;
+ }
+
switch(event->key()) {
case Qt::Key_Left:
if (d->left) {
@@ -641,7 +707,7 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event)
break;
}
- if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyReleased(event);
+ if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyReleased(event, post);
}
/*!
@@ -683,6 +749,28 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event)
See \l {Qt::Key}{Qt.Key} for the list of keyboard codes.
+ If priority is Keys.BeforeItem (default) the order of key event processing is:
+
+ \list 1
+ \o Items specified in \c forwardTo
+ \o specific key handlers, e.g. onReturnPressed
+ \o onKeyPress, onKeyRelease handlers
+ \o Item specific key handling, e.g. TextInput key handling
+ \o parent item
+ \endlist
+
+ If priority is Keys.AfterItem the order of key event processing is:
+ \list 1
+ \o Item specific key handling, e.g. TextInput key handling
+ \o Items specified in \c forwardTo
+ \o specific key handlers, e.g. onReturnPressed
+ \o onKeyPress, onKeyRelease handlers
+ \o parent item
+ \endlist
+
+ If the event is accepted during any of the above steps, key
+ propagation stops.
+
\sa KeyEvent, {KeyNavigation}{KeyNavigation attached property}
*/
@@ -694,7 +782,23 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event)
*/
/*!
- \qmlproperty List<Object> Keys::forwardTo
+ \qmlproperty enumeration Keys::priority
+
+ This property determines whether the keys are processed before
+ or after the attached item's own key handling.
+
+ \list
+ \o Keys.BeforeItem (default) - process the key events before normal
+ item key processing. If the event is accepted it will not
+ be passed on to the item.
+ \o Keys.AfterItem - process the key events after normal item key
+ handling. If the item accepts the key event it will not be
+ handled by the Keys attached property handler.
+ \endlist
+*/
+
+/*!
+ \qmlproperty list<Object> Keys::forwardTo
This property provides a way to forward key presses, key releases, and keyboard input
coming from input methods to other items. This can be useful when you want
@@ -1013,6 +1117,7 @@ QDeclarativeKeysAttached::QDeclarativeKeysAttached(QObject *parent)
QDeclarativeItemKeyFilter(qobject_cast<QDeclarativeItem*>(parent))
{
Q_D(QDeclarativeKeysAttached);
+ m_processPost = false;
d->item = qobject_cast<QDeclarativeItem*>(parent);
}
@@ -1020,6 +1125,20 @@ QDeclarativeKeysAttached::~QDeclarativeKeysAttached()
{
}
+QDeclarativeKeysAttached::Priority QDeclarativeKeysAttached::priority() const
+{
+ return m_processPost ? AfterItem : BeforeItem;
+}
+
+void QDeclarativeKeysAttached::setPriority(Priority order)
+{
+ bool processPost = order == AfterItem;
+ if (processPost != m_processPost) {
+ m_processPost = processPost;
+ emit priorityChanged();
+ }
+}
+
void QDeclarativeKeysAttached::componentComplete()
{
Q_D(QDeclarativeKeysAttached);
@@ -1034,11 +1153,12 @@ void QDeclarativeKeysAttached::componentComplete()
}
}
-void QDeclarativeKeysAttached::keyPressed(QKeyEvent *event)
+void QDeclarativeKeysAttached::keyPressed(QKeyEvent *event, bool post)
{
Q_D(QDeclarativeKeysAttached);
- if (!d->enabled || d->inPress) {
+ if (post != m_processPost || !d->enabled || d->inPress) {
event->ignore();
+ QDeclarativeItemKeyFilter::keyPressed(event, post);
return;
}
@@ -1073,14 +1193,15 @@ void QDeclarativeKeysAttached::keyPressed(QKeyEvent *event)
emit pressed(&ke);
event->setAccepted(ke.isAccepted());
- if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyPressed(event);
+ if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyPressed(event, post);
}
-void QDeclarativeKeysAttached::keyReleased(QKeyEvent *event)
+void QDeclarativeKeysAttached::keyReleased(QKeyEvent *event, bool post)
{
Q_D(QDeclarativeKeysAttached);
- if (!d->enabled || d->inRelease) {
+ if (post != m_processPost || !d->enabled || d->inRelease) {
event->ignore();
+ QDeclarativeItemKeyFilter::keyReleased(event, post);
return;
}
@@ -1103,13 +1224,13 @@ void QDeclarativeKeysAttached::keyReleased(QKeyEvent *event)
emit released(&ke);
event->setAccepted(ke.isAccepted());
- if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyReleased(event);
+ if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyReleased(event, post);
}
-void QDeclarativeKeysAttached::inputMethodEvent(QInputMethodEvent *event)
+void QDeclarativeKeysAttached::inputMethodEvent(QInputMethodEvent *event, bool post)
{
Q_D(QDeclarativeKeysAttached);
- if (d->item && !d->inIM && d->item->scene()) {
+ if (post == m_processPost && d->item && !d->inIM && d->item->scene()) {
d->inIM = true;
for (int ii = 0; ii < d->targets.count(); ++ii) {
QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii));
@@ -1124,7 +1245,7 @@ void QDeclarativeKeysAttached::inputMethodEvent(QInputMethodEvent *event)
}
d->inIM = false;
}
- if (!event->isAccepted()) QDeclarativeItemKeyFilter::inputMethodEvent(event);
+ if (!event->isAccepted()) QDeclarativeItemKeyFilter::inputMethodEvent(event, post);
}
class QDeclarativeItemAccessor : public QGraphicsItem
@@ -1168,7 +1289,10 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec
width and height, \l {anchor-layout}{anchoring} and key handling.
You can subclass QDeclarativeItem to provide your own custom visual item that inherits
- these features.
+ these features. Note that, because it does not draw anything, QDeclarativeItem sets the
+ QGraphicsItem::ItemHasNoContents flag. If you subclass QDeclarativeItem to create a visual
+ item, you will need to unset this flag.
+
*/
/*!
@@ -1258,8 +1382,6 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec
changes. For many properties in Item or Item derivatives this can be used
to add a touch of imperative logic to your application (when absolutely
necessary).
-
- \ingroup group_coreitems
*/
/*!
@@ -1388,6 +1510,7 @@ QDeclarativeItem::~QDeclarativeItem()
delete d->_anchorLines; d->_anchorLines = 0;
delete d->_anchors; d->_anchors = 0;
delete d->_stateGroup; d->_stateGroup = 0;
+ delete d->_contents; d->_contents = 0;
}
/*!
@@ -1407,7 +1530,7 @@ QDeclarativeItem::~QDeclarativeItem()
}
\endqml
- The default transform origin is \c Center.
+ The default transform origin is \c Item.Center.
*/
/*!
@@ -1472,11 +1595,6 @@ QDeclarativeItem *QDeclarativeItem::parentItem() const
*/
/*!
- \property QDeclarativeItem::resources
- \internal
-*/
-
-/*!
Returns true if construction of the QML component is complete; otherwise
returns false.
@@ -1491,18 +1609,6 @@ bool QDeclarativeItem::isComponentComplete() const
return d->_componentComplete;
}
-/*!
- \property QDeclarativeItem::anchors
- \internal
-*/
-
-/*! \internal */
-QDeclarativeAnchors *QDeclarativeItem::anchors()
-{
- Q_D(QDeclarativeItem);
- return d->anchors();
-}
-
void QDeclarativeItemPrivate::data_append(QDeclarativeListProperty<QObject> *prop, QObject *o)
{
if (!o)
@@ -1624,29 +1730,23 @@ void QDeclarativeItemPrivate::parentProperty(QObject *o, void *rv, QDeclarativeN
specify it.
*/
-/*!
- \property QDeclarativeItem::data
- \internal
-*/
-
/*! \internal */
-QDeclarativeListProperty<QObject> QDeclarativeItem::data()
+QDeclarativeListProperty<QObject> QDeclarativeItemPrivate::data()
{
- return QDeclarativeListProperty<QObject>(this, 0, QDeclarativeItemPrivate::data_append);
+ return QDeclarativeListProperty<QObject>(q_func(), 0, QDeclarativeItemPrivate::data_append);
}
/*!
\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.
+ This property holds the (collective) position and size of the item's children.
*/
QRectF QDeclarativeItem::childrenRect()
{
Q_D(QDeclarativeItem);
if (!d->_contents) {
d->_contents = new QDeclarativeContents;
- QDeclarative_setParent_noEvent(d->_contents, this);
d->_contents->setItem(this);
}
return d->_contents->rectF();
@@ -1817,8 +1917,11 @@ void QDeclarativeItemPrivate::removeItemChangeListener(QDeclarativeItemChangeLis
void QDeclarativeItem::keyPressEvent(QKeyEvent *event)
{
Q_D(QDeclarativeItem);
+ keyPressPreHandler(event);
+ if (event->isAccepted())
+ return;
if (d->keyHandler)
- d->keyHandler->keyPressed(event);
+ d->keyHandler->keyPressed(event, true);
else
event->ignore();
}
@@ -1827,8 +1930,11 @@ void QDeclarativeItem::keyPressEvent(QKeyEvent *event)
void QDeclarativeItem::keyReleaseEvent(QKeyEvent *event)
{
Q_D(QDeclarativeItem);
+ keyReleasePreHandler(event);
+ if (event->isAccepted())
+ return;
if (d->keyHandler)
- d->keyHandler->keyReleased(event);
+ d->keyHandler->keyReleased(event, true);
else
event->ignore();
}
@@ -1837,8 +1943,11 @@ void QDeclarativeItem::keyReleaseEvent(QKeyEvent *event)
void QDeclarativeItem::inputMethodEvent(QInputMethodEvent *event)
{
Q_D(QDeclarativeItem);
+ inputMethodPreHandler(event);
+ if (event->isAccepted())
+ return;
if (d->keyHandler)
- d->keyHandler->inputMethodEvent(event);
+ d->keyHandler->inputMethodEvent(event, true);
else
event->ignore();
}
@@ -1857,99 +1966,93 @@ QVariant QDeclarativeItem::inputMethodQuery(Qt::InputMethodQuery query) const
return v;
}
-/*!
- \internal
-*/
-QDeclarativeAnchorLine QDeclarativeItem::left() const
+void QDeclarativeItem::keyPressPreHandler(QKeyEvent *event)
{
- Q_D(const QDeclarativeItem);
- return d->anchorLines()->left;
+ Q_D(QDeclarativeItem);
+ if (d->keyHandler && !d->doneEventPreHandler)
+ d->keyHandler->keyPressed(event, false);
+ else
+ event->ignore();
+ d->doneEventPreHandler = true;
}
-/*!
- \internal
-*/
-QDeclarativeAnchorLine QDeclarativeItem::right() const
+void QDeclarativeItem::keyReleasePreHandler(QKeyEvent *event)
{
- Q_D(const QDeclarativeItem);
- return d->anchorLines()->right;
+ Q_D(QDeclarativeItem);
+ if (d->keyHandler && !d->doneEventPreHandler)
+ d->keyHandler->keyReleased(event, false);
+ else
+ event->ignore();
+ d->doneEventPreHandler = true;
}
-/*!
- \internal
-*/
-QDeclarativeAnchorLine QDeclarativeItem::horizontalCenter() const
+void QDeclarativeItem::inputMethodPreHandler(QInputMethodEvent *event)
{
- Q_D(const QDeclarativeItem);
- return d->anchorLines()->hCenter;
+ Q_D(QDeclarativeItem);
+ if (d->keyHandler && !d->doneEventPreHandler)
+ d->keyHandler->inputMethodEvent(event, false);
+ else
+ event->ignore();
+ d->doneEventPreHandler = true;
}
+
/*!
\internal
*/
-QDeclarativeAnchorLine QDeclarativeItem::top() const
+QDeclarativeAnchorLine QDeclarativeItemPrivate::left() const
{
- Q_D(const QDeclarativeItem);
- return d->anchorLines()->top;
+ return anchorLines()->left;
}
/*!
\internal
*/
-QDeclarativeAnchorLine QDeclarativeItem::bottom() const
+QDeclarativeAnchorLine QDeclarativeItemPrivate::right() const
{
- Q_D(const QDeclarativeItem);
- return d->anchorLines()->bottom;
+ return anchorLines()->right;
}
/*!
\internal
*/
-QDeclarativeAnchorLine QDeclarativeItem::verticalCenter() const
+QDeclarativeAnchorLine QDeclarativeItemPrivate::horizontalCenter() const
{
- Q_D(const QDeclarativeItem);
- return d->anchorLines()->vCenter;
+ return anchorLines()->hCenter;
}
-
/*!
\internal
*/
-QDeclarativeAnchorLine QDeclarativeItem::baseline() const
+QDeclarativeAnchorLine QDeclarativeItemPrivate::top() const
{
- Q_D(const QDeclarativeItem);
- return d->anchorLines()->baseline;
+ return anchorLines()->top;
}
/*!
- \property QDeclarativeItem::top
- \internal
-*/
-
-/*!
- \property QDeclarativeItem::bottom
- \internal
-*/
-
-/*!
- \property QDeclarativeItem::left
- \internal
+ \internal
*/
+QDeclarativeAnchorLine QDeclarativeItemPrivate::bottom() const
+{
+ return anchorLines()->bottom;
+}
/*!
- \property QDeclarativeItem::right
- \internal
+ \internal
*/
+QDeclarativeAnchorLine QDeclarativeItemPrivate::verticalCenter() const
+{
+ return anchorLines()->vCenter;
+}
-/*!
- \property QDeclarativeItem::horizontalCenter
- \internal
-*/
/*!
- \property QDeclarativeItem::verticalCenter
- \internal
+ \internal
*/
+QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const
+{
+ return anchorLines()->baseline;
+}
/*!
\qmlproperty AnchorLine Item::top
@@ -2291,9 +2394,9 @@ void QDeclarativeItemPrivate::focusChanged(bool flag)
}
/*! \internal */
-QDeclarativeListProperty<QObject> QDeclarativeItem::resources()
+QDeclarativeListProperty<QObject> QDeclarativeItemPrivate::resources()
{
- return QDeclarativeListProperty<QObject>(this, 0, QDeclarativeItemPrivate::resources_append,
+ return QDeclarativeListProperty<QObject>(q_func(), 0, QDeclarativeItemPrivate::resources_append,
QDeclarativeItemPrivate::resources_count,
QDeclarativeItemPrivate::resources_at);
}
@@ -2315,15 +2418,10 @@ QDeclarativeListProperty<QObject> QDeclarativeItem::resources()
\sa {qmlstate}{States}
*/
-/*!
- \property QDeclarativeItem::states
- \internal
-*/
/*! \internal */
-QDeclarativeListProperty<QDeclarativeState> QDeclarativeItem::states()
+QDeclarativeListProperty<QDeclarativeState> QDeclarativeItemPrivate::states()
{
- Q_D(QDeclarativeItem);
- return d->states()->statesProperty();
+ return _states()->statesProperty();
}
/*!
@@ -2343,16 +2441,11 @@ QDeclarativeListProperty<QDeclarativeState> QDeclarativeItem::states()
\sa {state-transitions}{Transitions}
*/
-/*!
- \property QDeclarativeItem::transitions
- \internal
-*/
/*! \internal */
-QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItem::transitions()
+QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItemPrivate::transitions()
{
- Q_D(QDeclarativeItem);
- return d->states()->transitionsProperty();
+ return _states()->transitionsProperty();
}
/*
@@ -2426,20 +2519,18 @@ QDeclarativeListProperty<QDeclarativeTransition> QDeclarativeItem::transitions()
*/
/*! \internal */
-QString QDeclarativeItem::state() const
+QString QDeclarativeItemPrivate::state() const
{
- Q_D(const QDeclarativeItem);
- if (!d->_stateGroup)
+ if (!_stateGroup)
return QString();
else
- return d->_stateGroup->state();
+ return _stateGroup->state();
}
/*! \internal */
-void QDeclarativeItem::setState(const QString &state)
+void QDeclarativeItemPrivate::setState(const QString &state)
{
- Q_D(QDeclarativeItem);
- d->states()->setState(state);
+ _states()->setState(state);
}
/*!
@@ -2502,7 +2593,7 @@ void QDeclarativeItem::componentComplete()
d->keyHandler->componentComplete();
}
-QDeclarativeStateGroup *QDeclarativeItemPrivate::states()
+QDeclarativeStateGroup *QDeclarativeItemPrivate::_states()
{
Q_Q(QDeclarativeItem);
if (!_stateGroup) {
@@ -2618,6 +2709,16 @@ QVariant QDeclarativeItem::itemChange(GraphicsItemChange change,
}
}
break;
+ case ItemChildAddedChange:
+ if (d->_contents)
+ d->_contents->childAdded(qobject_cast<QDeclarativeItem*>(
+ value.value<QGraphicsItem*>()));
+ break;
+ case ItemChildRemovedChange:
+ if (d->_contents)
+ d->_contents->childRemoved(qobject_cast<QDeclarativeItem*>(
+ value.value<QGraphicsItem*>()));
+ break;
default:
break;
}
@@ -2723,29 +2824,48 @@ void QDeclarativeItem::setSmooth(bool smooth)
update();
}
+/*!
+ \internal
+ Return the width of the item
+*/
qreal QDeclarativeItem::width() const
{
Q_D(const QDeclarativeItem);
return d->width();
}
+/*!
+ \internal
+ Set the width of the item
+*/
void QDeclarativeItem::setWidth(qreal w)
{
Q_D(QDeclarativeItem);
d->setWidth(w);
}
+/*!
+ \internal
+ Reset the width of the item
+*/
void QDeclarativeItem::resetWidth()
{
Q_D(QDeclarativeItem);
d->resetWidth();
}
+/*!
+ \internal
+ Return the width of the item
+*/
qreal QDeclarativeItemPrivate::width() const
{
return mWidth;
}
+/*!
+ \internal
+*/
void QDeclarativeItemPrivate::setWidth(qreal w)
{
Q_Q(QDeclarativeItem);
@@ -2765,7 +2885,10 @@ void QDeclarativeItemPrivate::setWidth(qreal w)
QRectF(q->x(), q->y(), oldWidth, height()));
}
-void QDeclarativeItemPrivate ::resetWidth()
+/*!
+ \internal
+*/
+void QDeclarativeItemPrivate::resetWidth()
{
Q_Q(QDeclarativeItem);
widthValid = false;
@@ -2810,29 +2933,47 @@ bool QDeclarativeItem::widthValid() const
return d->widthValid;
}
+/*!
+ \internal
+ Return the height of the item
+*/
qreal QDeclarativeItem::height() const
{
Q_D(const QDeclarativeItem);
return d->height();
}
+/*!
+ \internal
+ Set the height of the item
+*/
void QDeclarativeItem::setHeight(qreal h)
{
Q_D(QDeclarativeItem);
d->setHeight(h);
}
+/*!
+ \internal
+ Reset the height of the item
+*/
void QDeclarativeItem::resetHeight()
{
Q_D(QDeclarativeItem);
d->resetHeight();
}
+/*!
+ \internal
+*/
qreal QDeclarativeItemPrivate::height() const
{
return mHeight;
}
+/*!
+ \internal
+*/
void QDeclarativeItemPrivate::setHeight(qreal h)
{
Q_Q(QDeclarativeItem);
@@ -2852,6 +2993,9 @@ void QDeclarativeItemPrivate::setHeight(qreal h)
QRectF(q->x(), q->y(), width(), oldHeight));
}
+/*!
+ \internal
+*/
void QDeclarativeItemPrivate::resetHeight()
{
Q_Q(QDeclarativeItem);
@@ -2956,7 +3100,6 @@ void QDeclarativeItem::setFocus(bool focus)
}
/*!
- \reimp
\internal
*/
void QDeclarativeItem::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
@@ -2964,11 +3107,21 @@ void QDeclarativeItem::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidg
}
/*!
- \reimp
\internal
*/
bool QDeclarativeItem::event(QEvent *ev)
{
+ Q_D(QDeclarativeItem);
+ switch (ev->type()) {
+ case QEvent::KeyPress:
+ case QEvent::KeyRelease:
+ case QEvent::InputMethod:
+ d->doneEventPreHandler = false;
+ break;
+ default:
+ break;
+ }
+
return QGraphicsObject::event(ev);
}
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.h b/src/declarative/graphicsitems/qdeclarativeitem.h
index da5a36e11e..29fd241c3d 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem.h
@@ -70,20 +70,20 @@ class Q_DECLARATIVE_EXPORT QDeclarativeItem : public QGraphicsObject, public QDe
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<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_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeListProperty<QObject> data READ data DESIGNABLE false)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeListProperty<QObject> resources READ resources DESIGNABLE false)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeListProperty<QDeclarativeState> states READ states DESIGNABLE false)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeListProperty<QDeclarativeTransition> transitions READ transitions DESIGNABLE false)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QString state READ state WRITE setState NOTIFY stateChanged)
Q_PROPERTY(QRectF childrenRect READ childrenRect NOTIFY childrenRectChanged DESIGNABLE false 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_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchorLine left READ left CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchorLine right READ right CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchorLine horizontalCenter READ horizontalCenter CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchorLine top READ top CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchorLine bottom READ bottom CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), QDeclarativeAnchorLine verticalCenter READ verticalCenter CONSTANT FINAL)
+ Q_PRIVATE_PROPERTY(QDeclarativeItem::d_func(), 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)
@@ -107,21 +107,11 @@ public:
QDeclarativeItem *parentItem() const;
void setParentItem(QDeclarativeItem *parent);
- QDeclarativeListProperty<QObject> data();
- QDeclarativeListProperty<QObject> resources();
-
- QDeclarativeAnchors *anchors();
QRectF childrenRect();
bool clip() const;
void setClip(bool);
- QDeclarativeListProperty<QDeclarativeState> states();
- QDeclarativeListProperty<QDeclarativeTransition> transitions();
-
- QString state() const;
- void setState(const QString &);
-
qreal baselineOffset() const;
void setBaselineOffset(qreal);
@@ -159,14 +149,6 @@ public:
Q_INVOKABLE QScriptValue mapToItem(const QScriptValue &item, qreal x, qreal y) const;
Q_INVOKABLE void forceFocus();
- QDeclarativeAnchorLine left() const;
- QDeclarativeAnchorLine right() const;
- QDeclarativeAnchorLine horizontalCenter() const;
- QDeclarativeAnchorLine top() const;
- QDeclarativeAnchorLine bottom() const;
- QDeclarativeAnchorLine verticalCenter() const;
- QDeclarativeAnchorLine baseline() const;
-
Q_SIGNALS:
void childrenChanged();
void childrenRectChanged(const QRectF &);
@@ -196,6 +178,10 @@ protected:
virtual void keyReleaseEvent(QKeyEvent *event);
virtual void inputMethodEvent(QInputMethodEvent *);
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
+ void keyPressPreHandler(QKeyEvent *);
+ void keyReleasePreHandler(QKeyEvent *);
+ void inputMethodPreHandler(QInputMethodEvent *);
+
virtual void geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry);
diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h
index 3f5bf1ae96..15b34f0470 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h
@@ -79,24 +79,32 @@ class QNetworkReply;
class QDeclarativeItemKeyFilter;
//### merge into private?
-class QDeclarativeContents : public QObject
+class QDeclarativeContents : public QObject, public QDeclarativeItemChangeListener
{
Q_OBJECT
public:
QDeclarativeContents();
+ ~QDeclarativeContents();
QRectF rectF() const;
void setItem(QDeclarativeItem *item);
-public Q_SLOTS:
- void calcHeight();
- void calcWidth();
+ void childRemoved(QDeclarativeItem *item);
+ void childAdded(QDeclarativeItem *item);
Q_SIGNALS:
void rectChanged(QRectF);
+protected:
+ void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
+ void itemDestroyed(QDeclarativeItem *item);
+ //void itemVisibilityChanged(QDeclarativeItem *item)
+
private:
+ void calcHeight(QDeclarativeItem *changed = 0);
+ void calcWidth(QDeclarativeItem *changed = 0);
+
QDeclarativeItem *m_item;
qreal m_x;
qreal m_y;
@@ -116,7 +124,7 @@ public:
_stateGroup(0), origin(QDeclarativeItem::Center),
widthValid(false), heightValid(false),
_componentComplete(true), _keepMouse(false),
- smooth(false), transformOriginDirty(true), keyHandler(0),
+ smooth(false), transformOriginDirty(true), doneEventPreHandler(false), keyHandler(0),
mWidth(0), mHeight(0), implicitWidth(0), implicitHeight(0)
{
QGraphicsItemPrivate::acceptedMouseButtons = 0;
@@ -150,6 +158,22 @@ public:
void setHeight(qreal);
void resetHeight();
+ QDeclarativeListProperty<QObject> data();
+ QDeclarativeListProperty<QObject> resources();
+
+ QDeclarativeListProperty<QDeclarativeState> states();
+ QDeclarativeListProperty<QDeclarativeTransition> transitions();
+
+ QString state() const;
+ void setState(const QString &);
+
+ QDeclarativeAnchorLine left() const;
+ QDeclarativeAnchorLine right() const;
+ QDeclarativeAnchorLine horizontalCenter() const;
+ QDeclarativeAnchorLine top() const;
+ QDeclarativeAnchorLine bottom() const;
+ QDeclarativeAnchorLine verticalCenter() const;
+ QDeclarativeAnchorLine baseline() const;
// data property
static void data_append(QDeclarativeListProperty<QObject> *, QObject *);
@@ -165,6 +189,11 @@ public:
static QGraphicsTransform *transform_at(QDeclarativeListProperty<QGraphicsTransform> *list, int);
static void transform_clear(QDeclarativeListProperty<QGraphicsTransform> *list);
+ static QDeclarativeItemPrivate* get(QDeclarativeItem *item)
+ {
+ return item->d_func();
+ }
+
// Accelerated property accessors
QDeclarativeNotifier parentNotifier;
static void parentProperty(QObject *o, void *rv, QDeclarativeNotifierEndpoint *e);
@@ -224,7 +253,7 @@ public:
void removeItemChangeListener(QDeclarativeItemChangeListener *, ChangeTypes types);
QPODVector<ChangeListener,4> changeListeners;
- QDeclarativeStateGroup *states();
+ QDeclarativeStateGroup *_states();
QDeclarativeStateGroup *_stateGroup;
QDeclarativeItem::TransformOrigin origin:4;
@@ -234,6 +263,7 @@ public:
bool _keepMouse:1;
bool smooth:1;
bool transformOriginDirty : 1;
+ bool doneEventPreHandler : 1;
QDeclarativeItemKeyFilter *keyHandler;
@@ -295,12 +325,14 @@ public:
QDeclarativeItemKeyFilter(QDeclarativeItem * = 0);
virtual ~QDeclarativeItemKeyFilter();
- virtual void keyPressed(QKeyEvent *event);
- virtual void keyReleased(QKeyEvent *event);
- virtual void inputMethodEvent(QInputMethodEvent *event);
+ virtual void keyPressed(QKeyEvent *event, bool post);
+ virtual void keyReleased(QKeyEvent *event, bool post);
+ virtual void inputMethodEvent(QInputMethodEvent *event, bool post);
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
virtual void componentComplete();
+ bool m_processPost;
+
private:
QDeclarativeItemKeyFilter *m_next;
};
@@ -330,6 +362,9 @@ class QDeclarativeKeyNavigationAttached : public QObject, public QDeclarativeIte
Q_PROPERTY(QDeclarativeItem *down READ down WRITE setDown NOTIFY changed)
Q_PROPERTY(QDeclarativeItem *tab READ tab WRITE setTab NOTIFY changed)
Q_PROPERTY(QDeclarativeItem *backtab READ backtab WRITE setBacktab NOTIFY changed)
+ Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
+
+ Q_ENUMS(Priority)
public:
QDeclarativeKeyNavigationAttached(QObject * = 0);
@@ -347,14 +382,19 @@ public:
QDeclarativeItem *backtab() const;
void setBacktab(QDeclarativeItem *);
+ enum Priority { BeforeItem, AfterItem };
+ Priority priority() const;
+ void setPriority(Priority);
+
static QDeclarativeKeyNavigationAttached *qmlAttachedProperties(QObject *);
Q_SIGNALS:
void changed();
+ void priorityChanged();
private:
- virtual void keyPressed(QKeyEvent *event);
- virtual void keyReleased(QKeyEvent *event);
+ virtual void keyPressed(QKeyEvent *event, bool post);
+ virtual void keyReleased(QKeyEvent *event, bool post);
};
class QDeclarativeKeysAttachedPrivate : public QObjectPrivate
@@ -394,6 +434,9 @@ class QDeclarativeKeysAttached : public QObject, public QDeclarativeItemKeyFilte
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
Q_PROPERTY(QDeclarativeListProperty<QDeclarativeItem> forwardTo READ forwardTo)
+ Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
+
+ Q_ENUMS(Priority)
public:
QDeclarativeKeysAttached(QObject *parent=0);
@@ -408,6 +451,10 @@ public:
}
}
+ enum Priority { BeforeItem, AfterItem};
+ Priority priority() const;
+ void setPriority(Priority);
+
QDeclarativeListProperty<QDeclarativeItem> forwardTo() {
Q_D(QDeclarativeKeysAttached);
return QDeclarativeListProperty<QDeclarativeItem>(this, d->targets);
@@ -419,6 +466,7 @@ public:
Q_SIGNALS:
void enabledChanged();
+ void priorityChanged();
void pressed(QDeclarativeKeyEvent *event);
void released(QDeclarativeKeyEvent *event);
void digit0Pressed(QDeclarativeKeyEvent *event);
@@ -463,9 +511,9 @@ Q_SIGNALS:
void volumeDownPressed(QDeclarativeKeyEvent *event);
private:
- virtual void keyPressed(QKeyEvent *event);
- virtual void keyReleased(QKeyEvent *event);
- virtual void inputMethodEvent(QInputMethodEvent *);
+ virtual void keyPressed(QKeyEvent *event, bool post);
+ virtual void keyReleased(QKeyEvent *event, bool post);
+ virtual void inputMethodEvent(QInputMethodEvent *, bool post);
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
const QByteArray keyToSignal(int key) {
diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
index 2945b6c3d0..7c55009153 100644
--- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
@@ -143,7 +143,9 @@ void QDeclarativeItemModule::defineModule()
qmlRegisterType<QAction>();
qmlRegisterType<QDeclarativePen>();
qmlRegisterType<QDeclarativeFlickableVisibleArea>();
+#ifndef QT_NO_GRAPHICSEFFECT
qmlRegisterType<QGraphicsEffect>();
+#endif
qmlRegisterUncreatableType<QDeclarativeKeyNavigationAttached>("Qt",4,7,"KeyNavigation",QDeclarativeKeyNavigationAttached::tr("KeyNavigation is only available via attached properties"));
qmlRegisterUncreatableType<QDeclarativeKeysAttached>("Qt",4,7,"Keys",QDeclarativeKeysAttached::tr("Keys is only available via attached properties"));
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index c88dab25cb..936f9b0262 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -48,6 +48,7 @@
#include <qdeclarativeexpression.h>
#include <qdeclarativeengine.h>
#include <qdeclarativeguard_p.h>
+#include <qdeclarativeinfo.h>
#include <qlistmodelinterface_p.h>
#include <qmath.h>
@@ -161,9 +162,9 @@ public:
, highlightResizeSpeed(400), highlightResizeDuration(-1), highlightRange(QDeclarativeListView::NoHighlightRange)
, snapMode(QDeclarativeListView::NoSnap), overshootDist(0.0)
, footerComponent(0), footer(0), headerComponent(0), header(0)
- , bufferMode(NoBuffer)
+ , bufferMode(BufferBefore | BufferAfter)
, ownModel(false), wrap(false), autoHighlight(true), haveHighlightRange(false)
- , correctFlick(true), inFlickCorrection(false), lazyRelease(false)
+ , correctFlick(false), inFlickCorrection(false), lazyRelease(false)
, deferredRelease(false), layoutScheduled(false), minExtentDirty(true), maxExtentDirty(true)
{}
@@ -525,7 +526,7 @@ void QDeclarativeListViewPrivate::init()
q->setFlag(QGraphicsItem::ItemIsFocusScope);
addItemChangeListener(this, Geometry);
QObject::connect(q, SIGNAL(movementEnded()), q, SLOT(animStopped()));
- q->setFlickDirection(QDeclarativeFlickable::VerticalFlick);
+ q->setFlickableDirection(QDeclarativeFlickable::VerticalFlick);
::memset(sectionCache, 0, sizeof(QDeclarativeItem*) * sectionCacheSize);
}
@@ -573,9 +574,11 @@ FxListItem *QDeclarativeListViewPrivate::createItem(int modelIndex)
if (model->completePending()) {
// complete
listItem->item->setZValue(1);
+ listItem->item->setParentItem(q->viewport());
model->completeItem();
+ } else {
+ listItem->item->setParentItem(q->viewport());
}
- listItem->item->setParentItem(q->viewport());
QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item));
itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
if (sectionCriteria && sectionCriteria->delegate()) {
@@ -648,7 +651,7 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
FxListItem *item = 0;
int pos = itemEnd + 1;
while (modelIndex < model->count() && pos <= fillTo) {
- //qDebug() << "refill: append item" << modelIndex << "pos" << pos;
+// qDebug() << "refill: append item" << modelIndex << "pos" << pos;
if (!(item = createItem(modelIndex)))
break;
item->setPosition(pos);
@@ -659,8 +662,8 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
if (doBuffer) // never buffer more than one item per frame
break;
}
- while (visibleIndex > 0 && visibleIndex <= model->count() && visiblePos > fillFrom) {
- //qDebug() << "refill: prepend item" << visibleIndex-1 << "current top pos" << visiblePos;
+ while (visibleIndex > 0 && visibleIndex <= model->count() && visiblePos-1 >= fillFrom) {
+// qDebug() << "refill: prepend item" << visibleIndex-1 << "current top pos" << visiblePos;
if (!(item = createItem(visibleIndex-1)))
break;
--visibleIndex;
@@ -676,7 +679,7 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
while (visibleItems.count() > 1 && (item = visibleItems.first()) && item->endPosition() < bufferFrom) {
if (item->attached->delayRemove())
break;
- //qDebug() << "refill: remove first" << visibleIndex << "top end pos" << item->endPosition();
+// qDebug() << "refill: remove first" << visibleIndex << "top end pos" << item->endPosition();
if (item->index != -1)
visibleIndex++;
visibleItems.removeFirst();
@@ -686,7 +689,7 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
while (visibleItems.count() > 1 && (item = visibleItems.last()) && item->position() > bufferTo) {
if (item->attached->delayRemove())
break;
- //qDebug() << "refill: remove last" << visibleIndex+visibleItems.count()-1;
+// qDebug() << "refill: remove last" << visibleIndex+visibleItems.count()-1 << item->position();
visibleItems.removeLast();
releaseItem(item);
changed = true;
@@ -866,7 +869,7 @@ void QDeclarativeListViewPrivate::updateHighlight()
{
if ((!currentItem && highlight) || (currentItem && !highlight))
createHighlight();
- if (currentItem && autoHighlight && highlight && !moving) {
+ if (currentItem && autoHighlight && highlight && !movingHorizontally && !movingVertically) {
// auto-update highlight
highlightPosAnimator->to = currentItem->position();
highlightSizeAnimator->to = currentItem->size();
@@ -1164,6 +1167,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
moveReason = Mouse;
if ((!haveHighlightRange || highlightRange != QDeclarativeListView::StrictlyEnforceRange) && snapMode == QDeclarativeListView::NoSnap) {
+ correctFlick = true;
QDeclarativeFlickablePrivate::flick(data, minExtent, maxExtent, vSize, fixupCallback, velocity);
return;
}
@@ -1205,7 +1209,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
else
v = maxVelocity;
}
- if (!flicked) {
+ if (!flickingHorizontally && !flickingVertically) {
// the initial flick - estimate boundary
qreal accel = deceleration;
qreal v2 = v * v;
@@ -1230,10 +1234,13 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
qreal adjDist = -data.flickTarget + data.move.value();
if (qAbs(adjDist) > qAbs(dist)) {
// Prevent painfully slow flicking - adjust velocity to suit flickDeceleration
- v2 = accel * 2.0f * qAbs(dist);
- v = qSqrt(v2);
- if (dist > 0)
- v = -v;
+ qreal adjv2 = accel * 2.0f * qAbs(adjDist);
+ if (adjv2 > v2) {
+ v2 = adjv2;
+ v = qSqrt(v2);
+ if (dist > 0)
+ v = -v;
+ }
}
dist = adjDist;
accel = v2 / (2.0f * qAbs(dist));
@@ -1250,9 +1257,18 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
timeline.reset(data.move);
timeline.accel(data.move, v, accel, maxDistance + overshootDist);
timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this));
- flicked = true;
- emit q->flickingChanged();
- emit q->flickStarted();
+ if (!flickingHorizontally && q->xflick()) {
+ flickingHorizontally = true;
+ emit q->flickingChanged();
+ emit q->flickingHorizontallyChanged();
+ emit q->flickStarted();
+ }
+ if (!flickingVertically && q->yflick()) {
+ flickingVertically = true;
+ emit q->flickingChanged();
+ emit q->flickingVerticallyChanged();
+ emit q->flickStarted();
+ }
correctFlick = true;
} else {
// reevaluate the target boundary.
@@ -1310,6 +1326,9 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
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.
+ Delegates are instantiated as needed and may be destroyed at any time.
+ State should \e never be stored in a delegate.
+
\bold Note that views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
to set \e {clip: true} in order to have the out of view items clipped
@@ -1388,7 +1407,7 @@ QDeclarativeListView::~QDeclarativeListView()
id: wrapper
ListView.onRemove: SequentialAnimation {
PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
- NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: "InOutQuad" }
+ NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: Easing.InOutQuad }
PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false }
}
}
@@ -1452,13 +1471,14 @@ void QDeclarativeListView::setModel(const QVariant &model)
d->model = vim;
} else {
if (!d->ownModel) {
- d->model = new QDeclarativeVisualDataModel(qmlContext(this));
+ d->model = new QDeclarativeVisualDataModel(qmlContext(this), this);
d->ownModel = true;
}
if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model))
dataModel->setModel(model);
}
if (d->model) {
+ d->bufferMode = QDeclarativeListViewPrivate::BufferBefore | QDeclarativeListViewPrivate::BufferAfter;
if (isComponentComplete()) {
refill();
if (d->currentIndex >= d->model->count() || d->currentIndex < 0) {
@@ -1480,12 +1500,17 @@ void QDeclarativeListView::setModel(const QVariant &model)
}
/*!
- \qmlproperty component ListView::delegate
+ \qmlproperty Component ListView::delegate
The delegate provides a template defining each item instantiated by the view.
The index is exposed as an accessible \c index property. Properties of the
model are also available depending upon the type of \l {qmlmodels}{Data Model}.
+ The number of elements in the delegate has a direct effect on the
+ flicking performance of the view. If at all possible, place functionality
+ that is not needed for the normal display of the delegate in a \l Loader which
+ can load additional elements when needed.
+
Note that the ListView will layout the items based on the size of the root item
in the delegate.
@@ -1595,7 +1620,7 @@ int QDeclarativeListView::count() const
}
/*!
- \qmlproperty component ListView::highlight
+ \qmlproperty Component ListView::highlight
This property holds the component to use as the highlight.
An instance of the highlight component will be created for each list.
@@ -1681,17 +1706,17 @@ void QDeclarativeListView::setHighlightFollowsCurrentItem(bool autoHighlight)
highlight range. Furthermore, the behaviour of the current item index will occur
whether or not a highlight exists.
- If highlightRangeMode is set to \e ApplyRange the view will
+ If highlightRangeMode is set to \e ListView.ApplyRange the view will
attempt to maintain the highlight within the range, however
the highlight can move outside of the range at the ends of the list
or due to a mouse interaction.
- If highlightRangeMode is set to \e StrictlyEnforceRange the highlight will never
+ If highlightRangeMode is set to \e ListView.StrictlyEnforceRange the highlight will never
move outside of the range. This means that the current item will change
if a keyboard or mouse action would cause the highlight to move
outside of the range.
- The default value is \e NoHighlightRange.
+ The default value is \e ListView.NoHighlightRange.
Note that a valid range requires preferredHighlightEnd to be greater
than or equal to preferredHighlightBegin.
@@ -1771,9 +1796,9 @@ void QDeclarativeListView::setSpacing(qreal spacing)
Possible values are \c Vertical (default) and \c Horizontal.
- Vertical Example:
+ ListView.Vertical Example:
\image trivialListView.png
- Horizontal Example:
+ ListView.Horizontal Example:
\image ListViewHorizontal.png
*/
QDeclarativeListView::Orientation QDeclarativeListView::orientation() const
@@ -1789,10 +1814,10 @@ void QDeclarativeListView::setOrientation(QDeclarativeListView::Orientation orie
d->orient = orientation;
if (d->orient == QDeclarativeListView::Vertical) {
setContentWidth(-1);
- setFlickDirection(VerticalFlick);
+ setFlickableDirection(VerticalFlick);
} else {
setContentHeight(-1);
- setFlickDirection(HorizontalFlick);
+ setFlickableDirection(HorizontalFlick);
}
d->clear();
d->setPosition(0);
@@ -1826,11 +1851,22 @@ void QDeclarativeListView::setWrapEnabled(bool wrap)
/*!
\qmlproperty int ListView::cacheBuffer
- This property holds the number of off-screen pixels to cache.
-
- This property determines the number of pixels above the top of the list
- 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.
+ This property determines whether delegates are retained outside the
+ visible area of the view.
+
+ If non-zero the view will keep as many delegates
+ instantiated as will fit within the buffer specified. For example,
+ if in a vertical view the delegate is 20 pixels high and \c cacheBuffer is
+ set to 40, then up to 2 delegates above and 2 delegates below the visible
+ area may be retained.
+
+ Note that cacheBuffer is not a pixel buffer - it only maintains additional
+ instantiated delegates.
+
+ Setting this value can make scrolling the list smoother at the expense
+ of additional memory usage. It is not a substitute for creating efficient
+ delegates; the fewer elements in a delegate, the faster a view may be
+ scrolled.
*/
int QDeclarativeListView::cacheBuffer() const
{
@@ -1872,7 +1908,7 @@ void QDeclarativeListView::setCacheBuffer(int b)
pet. The section expression is the size property. If \c ListView.section and
\c ListView.prevSection differ, the item will display a section header.
- \snippet examples/declarative/listview/sections.qml 0
+ \snippet examples/declarative/modelviews/listview/sections.qml 0
\image ListViewSections.png
*/
@@ -1987,17 +2023,17 @@ void QDeclarativeListView::setHighlightResizeDuration(int duration)
The allowed values are:
\list
- \o NoSnap (default) - the view will stop anywhere within the visible area.
- \o SnapToItem - the view will settle with an item aligned with the start of
+ \o ListView.NoSnap (default) - the view will stop anywhere within the visible area.
+ \o ListView.SnapToItem - the view will settle with an item aligned with the start of
the view.
- \o SnapOneItem - the view will settle no more than one item away from the first
+ \o ListView.SnapOneItem - the view will settle no more than one item away from the first
visible item at the time the mouse button is released. This mode is particularly
useful for moving one page at a time.
\endlist
snapMode does not affect the currentIndex. To update the
currentIndex as the list is moved set \e highlightRangeMode
- to \e StrictlyEnforceRange.
+ to \e ListView.StrictlyEnforceRange.
\sa highlightRangeMode
*/
@@ -2080,7 +2116,7 @@ void QDeclarativeListView::viewportMoved()
QDeclarativeFlickable::viewportMoved();
d->lazyRelease = true;
refill();
- if (isFlicking() || d->moving)
+ if (d->flickingHorizontally || d->flickingVertically || d->movingHorizontally || d->movingVertically)
d->moveReason = QDeclarativeListViewPrivate::Mouse;
if (d->moveReason != QDeclarativeListViewPrivate::SetIndex) {
if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange && d->highlight) {
@@ -2100,7 +2136,7 @@ void QDeclarativeListView::viewportMoved()
}
}
- if (d->flicked && d->correctFlick && !d->inFlickCorrection) {
+ if ((d->flickingHorizontally || d->flickingVertically) && d->correctFlick && !d->inFlickCorrection) {
d->inFlickCorrection = true;
// Near an end and it seems that the extent has changed?
// Recalculate the flick so that we don't end up in an odd position.
@@ -2227,6 +2263,9 @@ qreal QDeclarativeListView::maxXExtent() const
void QDeclarativeListView::keyPressEvent(QKeyEvent *event)
{
Q_D(QDeclarativeListView);
+ keyPressPreHandler(event);
+ if (event->isAccepted())
+ return;
if (d->model && d->model->count() && d->interactive) {
if ((d->orient == QDeclarativeListView::Horizontal && event->key() == Qt::Key_Left)
@@ -2251,10 +2290,8 @@ void QDeclarativeListView::keyPressEvent(QKeyEvent *event)
}
}
}
- QDeclarativeFlickable::keyPressEvent(event);
- if (event->isAccepted())
- return;
event->ignore();
+ QDeclarativeFlickable::keyPressEvent(event);
}
/*!
@@ -2420,7 +2457,8 @@ void QDeclarativeListView::trackedPositionChanged()
Q_D(QDeclarativeListView);
if (!d->trackedItem || !d->currentItem)
return;
- if (!isFlicking() && !d->moving && d->moveReason == QDeclarativeListViewPrivate::SetIndex) {
+ if (!d->flickingHorizontally && !d->flickingVertically && !d->movingHorizontally && !d->movingVertically
+ && d->moveReason == QDeclarativeListViewPrivate::SetIndex) {
const qreal trackedPos = qCeil(d->trackedItem->position());
const qreal viewPos = d->position();
if (d->haveHighlightRange) {
diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h
index 9c0b7dd43f..d6e80237cd 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h
@@ -124,6 +124,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeListView : public QDeclarativeFlickable
Q_ENUMS(HighlightRangeMode)
Q_ENUMS(Orientation)
Q_ENUMS(SnapMode)
+ Q_ENUMS(PositionMode)
Q_CLASSINFO("DefaultProperty", "data")
public:
@@ -200,7 +201,6 @@ public:
static QDeclarativeListViewAttached *qmlAttachedProperties(QObject *);
enum PositionMode { Beginning, Center, End, Visible, Contain };
- Q_ENUMS(PositionMode);
Q_INVOKABLE void positionViewAtIndex(int index, int mode);
Q_INVOKABLE int indexAt(int x, int y) const;
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index bdd2c877db..cbdfd87e4e 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -49,7 +49,6 @@ QT_BEGIN_NAMESPACE
QDeclarativeLoaderPrivate::QDeclarativeLoaderPrivate()
: item(0), component(0), ownComponent(false)
- , resizeMode(QDeclarativeLoader::SizeLoaderToItem)
{
}
@@ -59,9 +58,8 @@ QDeclarativeLoaderPrivate::~QDeclarativeLoaderPrivate()
void QDeclarativeLoaderPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, const QRectF &newGeometry, const QRectF &oldGeometry)
{
- if (resizeItem == item && resizeMode == QDeclarativeLoader::SizeLoaderToItem) {
- _q_updateSize();
- }
+ if (resizeItem == item)
+ _q_updateSize(false);
QDeclarativeItemChangeListener::itemGeometryChanged(resizeItem, newGeometry, oldGeometry);
}
@@ -76,11 +74,9 @@ void QDeclarativeLoaderPrivate::clear()
if (item) {
if (QDeclarativeItem *qmlItem = qobject_cast<QDeclarativeItem*>(item)) {
- if (resizeMode == QDeclarativeLoader::SizeLoaderToItem) {
- QDeclarativeItemPrivate *p =
+ QDeclarativeItemPrivate *p =
static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(qmlItem));
- p->removeItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
- }
+ p->removeItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
}
// We can't delete immediately because our item may have triggered
@@ -96,16 +92,12 @@ void QDeclarativeLoaderPrivate::initResize()
{
Q_Q(QDeclarativeLoader);
if (QDeclarativeItem *qmlItem = qobject_cast<QDeclarativeItem*>(item)) {
- if (resizeMode == QDeclarativeLoader::SizeLoaderToItem) {
- QDeclarativeItemPrivate *p =
+ QDeclarativeItemPrivate *p =
static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(qmlItem));
- p->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
- }
+ p->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
} else if (item && item->isWidget()) {
QGraphicsWidget *widget = static_cast<QGraphicsWidget*>(item);
- if (resizeMode == QDeclarativeLoader::SizeLoaderToItem) {
- widget->installEventFilter(q);
- }
+ widget->installEventFilter(q);
}
_q_updateSize();
}
@@ -329,6 +321,7 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
emit q->statusChanged();
emit q->progressChanged();
emit q->itemChanged();
+ emit q->loaded();
}
}
@@ -337,10 +330,10 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
This property holds the status of QML loading. It can be one of:
\list
- \o Null - no QML source has been set
- \o Ready - the QML source has been loaded
- \o Loading - the QML source is currently being loaded
- \o Error - an error occurred while loading the QML source
+ \o Loader.Null - no QML source has been set
+ \o Loader.Ready - the QML source has been loaded
+ \o Loader.Loading - the QML source is currently being loaded
+ \o Loader.Error - an error occurred while loading the QML source
\endlist
Note that a change in the status property does not cause anything to happen
@@ -349,10 +342,13 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
of the following ways:
\list
\o Create a state, so that a state change occurs, e.g. State{name: 'loaded'; when: loader.status = Loader.Ready;}
- \o Do something inside the onStatusChanged signal handler, e.g. Loader{id: loader; onStatusChanged: if(loader.status == Loader.Ready) console.log('Loaded');}
+ \o Do something inside the onLoaded signal handler, e.g. Loader{id: loader; onLoaded: console.log('Loaded');}
\o Bind to the status variable somewhere, e.g. Text{text: if(loader.status!=Loader.Ready){'Not Loaded';}else{'Loaded';}}
\endlist
\sa progress
+
+ Note that if the source is a local file, the status will initially be Ready (or Error). While
+ there will be no onStatusChanged signal in that case, the onLoaded will still be invoked.
*/
QDeclarativeLoader::Status QDeclarativeLoader::status() const
@@ -368,6 +364,21 @@ QDeclarativeLoader::Status QDeclarativeLoader::status() const
return d->source.isEmpty() ? Null : Error;
}
+void QDeclarativeLoader::componentComplete()
+{
+ if (status() == Ready)
+ emit loaded();
+}
+
+
+/*!
+ \qmlsignal Loader::onLoaded()
+
+ This handler is called when the \l status becomes Loader.Ready, or on successful
+ initial load.
+*/
+
+
/*!
\qmlproperty real Loader::progress
@@ -390,83 +401,29 @@ qreal QDeclarativeLoader::progress() const
return 0.0;
}
-/*!
- \qmlproperty enumeration Loader::resizeMode
-
- This property determines how the Loader or item are resized:
- \list
- \o NoResize - no item will be resized
- \o SizeLoaderToItem - the Loader will be sized to the size of the item, unless the size of the Loader has been otherwise specified.
- \o SizeItemToLoader - the item will be sized to the size of the Loader.
- \endlist
-
- Note that changing from SizeItemToLoader to SizeLoaderToItem
- after the component is loaded will not return the item or Loader
- to it's original size. This is due to the item size being adjusted
- to the Loader size, thereby losing the original size of the item.
- Future changes to the item's size will affect the loader, however.
-
- The default resizeMode is SizeLoaderToItem.
-*/
-QDeclarativeLoader::ResizeMode QDeclarativeLoader::resizeMode() const
-{
- Q_D(const QDeclarativeLoader);
- return d->resizeMode;
-}
-
-void QDeclarativeLoader::setResizeMode(ResizeMode mode)
-{
- Q_D(QDeclarativeLoader);
- if (mode == d->resizeMode)
- return;
-
- if (QDeclarativeItem *qmlItem = qobject_cast<QDeclarativeItem*>(d->item)) {
- if (d->resizeMode == SizeLoaderToItem) {
- QDeclarativeItemPrivate *p =
- static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(qmlItem));
- p->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry);
- }
- } else if (d->item && d->item->isWidget()) {
- if (d->resizeMode == SizeLoaderToItem)
- d->item->removeEventFilter(this);
- }
-
- d->resizeMode = mode;
- emit resizeModeChanged();
- d->initResize();
-}
-
-void QDeclarativeLoaderPrivate::_q_updateSize()
+void QDeclarativeLoaderPrivate::_q_updateSize(bool loaderGeometryChanged)
{
Q_Q(QDeclarativeLoader);
if (!item)
return;
if (QDeclarativeItem *qmlItem = qobject_cast<QDeclarativeItem*>(item)) {
- if (resizeMode == QDeclarativeLoader::SizeLoaderToItem) {
- q->setWidth(qmlItem->width());
- q->setHeight(qmlItem->height());
- } else if (resizeMode == QDeclarativeLoader::SizeItemToLoader) {
+ q->setImplicitWidth(qmlItem->width());
+ if (loaderGeometryChanged && q->widthValid())
qmlItem->setWidth(q->width());
+ q->setImplicitHeight(qmlItem->height());
+ if (loaderGeometryChanged && q->heightValid())
qmlItem->setHeight(q->height());
- }
} else if (item && item->isWidget()) {
QGraphicsWidget *widget = static_cast<QGraphicsWidget*>(item);
- if (resizeMode == QDeclarativeLoader::SizeLoaderToItem) {
- QSizeF newSize = widget->size();
- if (newSize.isValid()) {
- q->setWidth(newSize.width());
- q->setHeight(newSize.height());
- }
- } else if (resizeMode == QDeclarativeLoader::SizeItemToLoader) {
- QSizeF oldSize = widget->size();
- QSizeF newSize = oldSize;
- if (q->heightValid())
- newSize.setHeight(q->height());
- if (q->widthValid())
- newSize.setWidth(q->width());
- if (oldSize != newSize)
- widget->resize(newSize);
- }
+ QSizeF widgetSize = widget->size();
+ q->setImplicitWidth(widgetSize.width());
+ if (loaderGeometryChanged && q->widthValid())
+ widgetSize.setWidth(q->width());
+ q->setImplicitHeight(widgetSize.height());
+ if (loaderGeometryChanged && q->heightValid())
+ widgetSize.setHeight(q->height());
+ if (widget->size() != widgetSize)
+ widget->resize(widgetSize);
}
}
@@ -484,9 +441,7 @@ void QDeclarativeLoader::geometryChanged(const QRectF &newGeometry, const QRectF
{
Q_D(QDeclarativeLoader);
if (newGeometry != oldGeometry) {
- if (d->resizeMode == SizeItemToLoader) {
- d->_q_updateSize();
- }
+ d->_q_updateSize();
}
QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
}
@@ -496,10 +451,8 @@ QVariant QDeclarativeLoader::itemChange(GraphicsItemChange change, const QVarian
Q_D(QDeclarativeLoader);
if (change == ItemSceneHasChanged) {
if (d->item && d->item->isWidget()) {
- if (d->resizeMode == SizeLoaderToItem) {
- d->item->removeEventFilter(this);
- d->item->installEventFilter(this);
- }
+ d->item->removeEventFilter(this);
+ d->item->installEventFilter(this);
}
}
return QDeclarativeItem::itemChange(change, value);
@@ -509,9 +462,8 @@ bool QDeclarativeLoader::eventFilter(QObject *watched, QEvent *e)
{
Q_D(QDeclarativeLoader);
if (watched == d->item && e->type() == QEvent::GraphicsSceneResize) {
- if (d->item && d->item->isWidget() && d->resizeMode == SizeLoaderToItem) {
- d->_q_updateSize();
- }
+ if (d->item && d->item->isWidget())
+ d->_q_updateSize(false);
}
return QDeclarativeItem::eventFilter(watched, e);
}
diff --git a/src/declarative/graphicsitems/qdeclarativeloader_p.h b/src/declarative/graphicsitems/qdeclarativeloader_p.h
index e9fd8e9502..ec7ffe947c 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeloader_p.h
@@ -55,11 +55,9 @@ 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(QDeclarativeComponent *sourceComponent READ sourceComponent WRITE setSourceComponent RESET resetSourceComponent 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)
@@ -79,10 +77,6 @@ public:
Status status() const;
qreal progress() const;
- enum ResizeMode { NoResize, SizeLoaderToItem, SizeItemToLoader };
- ResizeMode resizeMode() const;
- void setResizeMode(ResizeMode mode);
-
QGraphicsObject *item() const;
Q_SIGNALS:
@@ -90,12 +84,14 @@ Q_SIGNALS:
void sourceChanged();
void statusChanged();
void progressChanged();
- void resizeModeChanged();
+ void loaded();
protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
bool eventFilter(QObject *watched, QEvent *e);
+ void componentComplete();
+
private:
Q_DISABLE_COPY(QDeclarativeLoader)
Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeLoader)
diff --git a/src/declarative/graphicsitems/qdeclarativeloader_p_p.h b/src/declarative/graphicsitems/qdeclarativeloader_p_p.h
index 49069f96ba..0d4c4d0f44 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeloader_p_p.h
@@ -77,10 +77,9 @@ public:
QGraphicsObject *item;
QDeclarativeComponent *component;
bool ownComponent : 1;
- QDeclarativeLoader::ResizeMode resizeMode;
void _q_sourceLoaded();
- void _q_updateSize();
+ void _q_updateSize(bool loaderGeometryChanged = true);
};
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index 126d041a70..1947c0026f 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -197,8 +197,8 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate()
This handler is called when the mouse enters the mouse area.
By default the onEntered handler is only called while a button is
- pressed. Setting hoverEnabled to true enables handling of
- onExited when no mouse button is pressed.
+ pressed. Setting hoverEnabled to true enables handling of
+ onEntered when no mouse button is pressed.
\sa hoverEnabled
*/
@@ -209,7 +209,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate()
This handler is called when the mouse exists the mouse area.
By default the onExited handler is only called while a button is
- pressed. Setting hoverEnabled to true enables handling of
+ pressed. Setting hoverEnabled to true enables handling of
onExited when no mouse button is pressed.
\sa hoverEnabled
@@ -288,12 +288,21 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate()
*/
/*!
+ \qmlsignal MouseArea::onCanceled()
+
+ This handler is called when the mouse events are canceled, either because the event was not accepted or
+ another element stole the mouse event handling. This signal is for advanced users, it's useful in case there
+ is more than one mouse areas handling input, or when there is a mouse area inside a flickable. In the latter
+ case, if you do some logic on pressed and then start dragging, the flickable will steal the mouse handling
+ from the mouse area. In these cases, to reset the logic when there is no mouse handling anymore, you should
+ use onCanceled, in addition to onReleased.
+*/
+
+/*!
\internal
\class QDeclarativeMouseArea
\brief The QDeclarativeMouseArea class provides a simple mouse handling abstraction for use within Qml.
- \ingroup group_coreitems
-
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.
@@ -365,7 +374,7 @@ void QDeclarativeMouseArea::setEnabled(bool a)
\list
\o Qt.LeftButton
\o Qt.RightButton
- \o Qt.MidButton
+ \o Qt.MiddleButton
\endlist
The code below displays "right" when the right mouse buttons is pressed:
@@ -564,10 +573,12 @@ bool QDeclarativeMouseArea::sceneEvent(QEvent *event)
// state
d->pressed = false;
setKeepMouseGrab(false);
- QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, false);
- emit released(&me);
+ emit canceled();
emit pressedChanged();
- setHovered(false);
+ if (d->hovered) {
+ d->hovered = false;
+ emit hoveredChanged();
+ }
}
}
return rv;
@@ -599,6 +610,23 @@ void QDeclarativeMouseArea::geometryChanged(const QRectF &newGeometry,
d->lastPos = mapFromScene(d->lastScenePos);
}
+/*! \internal */
+QVariant QDeclarativeMouseArea::itemChange(GraphicsItemChange change,
+ const QVariant &value)
+{
+ Q_D(QDeclarativeMouseArea);
+ switch (change) {
+ case ItemVisibleHasChanged:
+ if (acceptHoverEvents() && d->hovered != (isVisible() && isUnderMouse()))
+ setHovered(!d->hovered);
+ break;
+ default:
+ break;
+ }
+
+ return QDeclarativeItem::itemChange(change, value);
+}
+
/*!
\qmlproperty bool MouseArea::hoverEnabled
This property holds whether hover events are handled.
@@ -609,6 +637,22 @@ void QDeclarativeMouseArea::geometryChanged(const QRectF &newGeometry,
This property affects the containsMouse property and the onEntered, onExited and onPositionChanged signals.
*/
+bool QDeclarativeMouseArea::hoverEnabled() const
+{
+ return acceptHoverEvents();
+}
+
+void QDeclarativeMouseArea::setHoverEnabled(bool h)
+{
+ Q_D(QDeclarativeMouseArea);
+ if (h == acceptHoverEvents())
+ return;
+
+ setAcceptHoverEvents(h);
+ emit hoverEnabledChanged();
+ if (d->hovered != isUnderMouse())
+ setHovered(!d->hovered);
+}
/*!
\qmlproperty bool MouseArea::containsMouse
@@ -651,7 +695,7 @@ void QDeclarativeMouseArea::setHovered(bool h)
\list
\o Qt.LeftButton
\o Qt.RightButton
- \o Qt.MidButton
+ \o Qt.MiddleButton
\endlist
To accept more than one button the flags can be combined with the
@@ -715,7 +759,7 @@ QDeclarativeDrag *QDeclarativeMouseArea::drag()
/*!
\qmlproperty Item MouseArea::drag.target
\qmlproperty bool MouseArea::drag.active
- \qmlproperty Axis MouseArea::drag.axis
+ \qmlproperty enumeration MouseArea::drag.axis
\qmlproperty real MouseArea::drag.minimumX
\qmlproperty real MouseArea::drag.maximumX
\qmlproperty real MouseArea::drag.minimumY
@@ -726,7 +770,7 @@ QDeclarativeDrag *QDeclarativeMouseArea::drag()
\list
\i \c target specifies the item to drag.
\i \c active specifies if the target item is being currently dragged.
- \i \c axis specifies whether dragging can be done horizontally (XAxis), vertically (YAxis), or both (XandYAxis)
+ \i \c axis specifies whether dragging can be done horizontally (Drag.XAxis), vertically (Drag.YAxis), or both (Drag.XandYAxis)
\i the minimum and maximum properties limit how far the target can be dragged along the corresponding axes.
\endlist
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
index 4f7df6271c..df77ac6e78 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h
+++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
@@ -121,7 +121,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeMouseArea : public QDeclarativeItem
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
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(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged)
Q_PROPERTY(QDeclarativeDrag *drag READ drag CONSTANT) //### add flicking to QDeclarativeDrag or add a QDeclarativeFlick ???
public:
@@ -142,6 +142,9 @@ public:
Qt::MouseButtons acceptedButtons() const;
void setAcceptedButtons(Qt::MouseButtons buttons);
+ bool hoverEnabled() const;
+ void setHoverEnabled(bool h);
+
QDeclarativeDrag *drag();
Q_SIGNALS:
@@ -149,6 +152,7 @@ Q_SIGNALS:
void pressedChanged();
void enabledChanged();
void acceptedButtonsChanged();
+ void hoverEnabledChanged();
void positionChanged(QDeclarativeMouseEvent *mouse);
void mousePositionChanged(QDeclarativeMouseEvent *mouse);
@@ -159,6 +163,7 @@ Q_SIGNALS:
void doubleClicked(QDeclarativeMouseEvent *mouse);
void entered();
void exited();
+ void canceled();
protected:
void setHovered(bool);
@@ -176,6 +181,7 @@ protected:
virtual void geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry);
+ virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value);
private:
void handlePress();
diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
index f52636fbe9..c4f0b869c1 100644
--- a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp
@@ -59,8 +59,8 @@ QT_BEGIN_NAMESPACE
\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
- using a QPainter. The contents of the item are cached behind the scenes.
+ This is a convenience class for implementing items that cache their painting.
+ The contents of the item are cached behind the scenes.
The dirtyCache() function should be called if the contents change to
ensure the cache is refreshed the next time painting occurs.
@@ -184,7 +184,6 @@ void QDeclarativePaintedItem::setContentsScale(qreal scale)
QDeclarativePaintedItem::QDeclarativePaintedItem(QDeclarativeItem *parent)
: QDeclarativeItem(*(new QDeclarativePaintedItemPrivate), parent)
{
- init();
}
/*!
@@ -195,7 +194,6 @@ QDeclarativePaintedItem::QDeclarativePaintedItem(QDeclarativeItem *parent)
QDeclarativePaintedItem::QDeclarativePaintedItem(QDeclarativePaintedItemPrivate &dd, QDeclarativeItem *parent)
: QDeclarativeItem(dd, parent)
{
- init();
}
/*!
@@ -206,14 +204,23 @@ QDeclarativePaintedItem::~QDeclarativePaintedItem()
clearCache();
}
-/*!
- \internal
-*/
-void QDeclarativePaintedItem::init()
+void QDeclarativePaintedItem::geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry)
{
- connect(this,SIGNAL(widthChanged()),this,SLOT(clearCache()));
- connect(this,SIGNAL(heightChanged()),this,SLOT(clearCache()));
- connect(this,SIGNAL(visibleChanged()),this,SLOT(clearCache()));
+ if (newGeometry.width() != oldGeometry.width() ||
+ newGeometry.height() != oldGeometry.height())
+ clearCache();
+
+ QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
+}
+
+QVariant QDeclarativePaintedItem::itemChange(GraphicsItemChange change,
+ const QVariant &value)
+{
+ if (change == ItemVisibleHasChanged)
+ clearCache();
+
+ return QDeclarativeItem::itemChange(change, value);
}
void QDeclarativePaintedItem::setCacheFrozen(bool frozen)
@@ -226,7 +233,7 @@ void QDeclarativePaintedItem::setCacheFrozen(bool frozen)
}
/*!
- \reimp
+ \internal
*/
void QDeclarativePaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem_p.h b/src/declarative/graphicsitems/qdeclarativepainteditem_p.h
index cc616afffc..8d08ba28d9 100644
--- a/src/declarative/graphicsitems/qdeclarativepainteditem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepainteditem_p.h
@@ -87,6 +87,10 @@ protected:
QDeclarativePaintedItem(QDeclarativePaintedItemPrivate &dd, QDeclarativeItem *parent);
virtual void drawContents(QPainter *p, const QRect &) = 0;
+ virtual void geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry);
+ virtual QVariant itemChange(GraphicsItemChange change,
+ const QVariant &value);
void setCacheFrozen(bool);
@@ -100,7 +104,6 @@ protected Q_SLOTS:
void clearCache();
private:
- void init();
Q_DISABLE_COPY(QDeclarativePaintedItem)
Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativePaintedItem)
};
diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp
index e2042fc73b..2d08c7cb5b 100644
--- a/src/declarative/graphicsitems/qdeclarativepath.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepath.cpp
@@ -63,7 +63,6 @@ QT_BEGIN_NAMESPACE
/*!
\internal
\class QDeclarativePathElement
- \ingroup group_utility
*/
/*!
@@ -86,7 +85,6 @@ QT_BEGIN_NAMESPACE
/*!
\internal
\class QDeclarativePath
- \ingroup group_utility
\brief The QDeclarativePath class defines a path.
\sa QDeclarativePathView
*/
@@ -117,6 +115,7 @@ void QDeclarativePath::setStartX(qreal x)
return;
d->startX = x;
emit startXChanged();
+ processPath();
}
qreal QDeclarativePath::startY() const
@@ -132,6 +131,7 @@ void QDeclarativePath::setStartY(qreal y)
return;
d->startY = y;
emit startYChanged();
+ processPath();
}
/*!
@@ -220,6 +220,9 @@ void QDeclarativePath::processPath()
{
Q_D(QDeclarativePath);
+ if (!d->componentComplete)
+ return;
+
d->_pointCache.clear();
d->_attributePoints.clear();
d->_path = QPainterPath();
@@ -284,10 +287,18 @@ void QDeclarativePath::processPath()
emit changed();
}
+void QDeclarativePath::classBegin()
+{
+ Q_D(QDeclarativePath);
+ d->componentComplete = false;
+}
+
void QDeclarativePath::componentComplete()
{
Q_D(QDeclarativePath);
QSet<QString> attrs;
+ d->componentComplete = true;
+
// First gather up all the attributes
foreach (QDeclarativePathElement *pathElement, d->_pathElements) {
if (QDeclarativePathAttribute *attribute =
@@ -311,6 +322,17 @@ QPainterPath QDeclarativePath::path() const
QStringList QDeclarativePath::attributes() const
{
Q_D(const QDeclarativePath);
+ if (!d->componentComplete) {
+ QSet<QString> attrs;
+
+ // First gather up all the attributes
+ foreach (QDeclarativePathElement *pathElement, d->_pathElements) {
+ if (QDeclarativePathAttribute *attribute =
+ qobject_cast<QDeclarativePathAttribute *>(pathElement))
+ attrs.insert(attribute->name());
+ }
+ return attrs.toList();
+ }
return d->_attributes;
}
@@ -355,7 +377,9 @@ void QDeclarativePath::createPointCache() const
{
Q_D(const QDeclarativePath);
qreal pathLength = d->_path.length();
- const int points = int(pathLength*2);
+ // more points means less jitter between items as they move along the
+ // path, but takes longer to generate
+ const int points = int(pathLength*5);
const int lastElement = d->_path.elementCount() - 1;
d->_pointCache.resize(points+1);
@@ -500,7 +524,6 @@ void QDeclarativeCurve::setY(qreal y)
/*!
\internal
\class QDeclarativePathAttribute
- \ingroup group_utility
\brief The QDeclarativePathAttribute class allows to set the value of an attribute at a given position in the path.
\sa QDeclarativePath
@@ -573,7 +596,6 @@ void QDeclarativePathAttribute::setValue(qreal value)
/*!
\internal
\class QDeclarativePathLine
- \ingroup group_utility
\brief The QDeclarativePathLine class defines a straight line.
\sa QDeclarativePath
@@ -617,7 +639,6 @@ void QDeclarativePathLine::addToPath(QPainterPath &path)
/*!
\internal
\class QDeclarativePathQuad
- \ingroup group_utility
\brief The QDeclarativePathQuad class defines a quadratic Bezier curve with a control point.
\sa QDeclarativePath
@@ -705,7 +726,6 @@ void QDeclarativePathQuad::addToPath(QPainterPath &path)
/*!
\internal
\class QDeclarativePathCubic
- \ingroup group_utility
\brief The QDeclarativePathCubic class defines a cubic Bezier curve with two control points.
\sa QDeclarativePath
@@ -831,7 +851,6 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path)
/*!
\internal
\class QDeclarativePathPercent
- \ingroup group_utility
\brief The QDeclarativePathPercent class manipulates the way a path is interpreted.
QDeclarativePathPercent allows you to bunch up items (or spread out items) along various
diff --git a/src/declarative/graphicsitems/qdeclarativepath_p.h b/src/declarative/graphicsitems/qdeclarativepath_p.h
index d7cfca14ac..17a2ea3ee4 100644
--- a/src/declarative/graphicsitems/qdeclarativepath_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepath_p.h
@@ -224,6 +224,7 @@ Q_SIGNALS:
protected:
virtual void componentComplete();
+ virtual void classBegin();
private Q_SLOTS:
void processPath();
diff --git a/src/declarative/graphicsitems/qdeclarativepath_p_p.h b/src/declarative/graphicsitems/qdeclarativepath_p_p.h
index e82bcf5854..994090e19e 100644
--- a/src/declarative/graphicsitems/qdeclarativepath_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepath_p_p.h
@@ -65,7 +65,7 @@ class QDeclarativePathPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QDeclarativePath)
public:
- QDeclarativePathPrivate() : startX(0), startY(0), closed(false) { }
+ QDeclarativePathPrivate() : startX(0), startY(0), closed(false), componentComplete(true) { }
QPainterPath _path;
QList<QDeclarativePathElement*> _pathElements;
@@ -75,6 +75,7 @@ public:
int startX;
int startY;
bool closed;
+ bool componentComplete;
};
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index d0a3cd1584..207cc25b22 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -49,6 +49,7 @@
#include <qlistmodelinterface_p.h>
#include <QGraphicsSceneEvent>
+#include <qmath.h>
#include <math.h>
QT_BEGIN_NAMESPACE
@@ -98,9 +99,8 @@ QDeclarativeItem *QDeclarativePathViewPrivate::getItem(int modelIndex)
if (!attType) {
// pre-create one metatype to share with all attached objects
attType = new QDeclarativeOpenMetaObjectType(&QDeclarativePathViewAttached::staticMetaObject, qmlEngine(q));
- foreach(const QString &attr, path->attributes()) {
+ foreach(const QString &attr, path->attributes())
attType->createProperty(attr.toUtf8());
- }
}
qPathViewAttachedType = attType;
QDeclarativePathViewAttached *att = static_cast<QDeclarativePathViewAttached *>(qmlAttachedPropertiesObject<QDeclarativePathView>(item));
@@ -280,8 +280,8 @@ void QDeclarativePathViewPrivate::updateItem(QDeclarativeItem *item, qreal perce
att->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);
+ item->setX(qRound(pf.x() - item->width()*item->scale()/2));
+ item->setY(qRound(pf.y() - item->height()*item->scale()/2));
}
void QDeclarativePathViewPrivate::regenerate()
@@ -308,12 +308,16 @@ void QDeclarativePathViewPrivate::regenerate()
The model is typically provided by a QAbstractListModel "C++ model object", but can also be created directly in QML.
- The items are laid out along a path defined by a \l Path and may be flicked to scroll.
+ The \l delegate is instantiated for each item on the \l path.
+ The items may be flicked to move them along the path.
\snippet doc/src/snippets/declarative/pathview/pathview.qml 0
\image pathview.gif
+ Delegates are instantiated as needed and may be destroyed at any time.
+ State should \e never be stored in a delegate.
+
\bold Note that views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
to set \e {clip: true} in order to have the out of view items clipped
@@ -414,7 +418,7 @@ void QDeclarativePathView::setModel(const QVariant &model)
d->model = vim;
} else {
if (!d->ownModel) {
- d->model = new QDeclarativeVisualDataModel(qmlContext(this));
+ d->model = new QDeclarativeVisualDataModel(qmlContext(this), this);
d->ownModel = true;
}
if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model))
@@ -467,12 +471,14 @@ void QDeclarativePathView::setPath(QDeclarativePath *path)
disconnect(d->path, SIGNAL(changed()), this, SLOT(refill()));
d->path = path;
connect(d->path, SIGNAL(changed()), this, SLOT(refill()));
- d->clear();
- if (d->attType) {
- d->attType->release();
- d->attType = 0;
+ if (d->isValid() && isComponentComplete()) {
+ d->clear();
+ if (d->attType) {
+ d->attType->release();
+ d->attType = 0;
+ }
+ d->regenerate();
}
- d->regenerate();
emit pathChanged();
}
@@ -522,6 +528,33 @@ void QDeclarativePathView::setCurrentIndex(int idx)
}
/*!
+ \qmlmethod PathView::incrementCurrentIndex()
+
+ Increments the current index.
+*/
+void QDeclarativePathView::incrementCurrentIndex()
+{
+ setCurrentIndex(currentIndex()+1);
+}
+
+
+/*!
+ \qmlmethod PathView::decrementCurrentIndex()
+
+ Decrements the current index.
+*/
+void QDeclarativePathView::decrementCurrentIndex()
+{
+ Q_D(QDeclarativePathView);
+ if (d->model && d->model->count()) {
+ int idx = currentIndex()-1;
+ if (idx < 0)
+ idx = d->model->count() - 1;
+ setCurrentIndex(idx);
+ }
+}
+
+/*!
\qmlproperty real PathView::offset
The offset specifies how far along the path the items are from their initial positions.
@@ -557,7 +590,7 @@ void QDeclarativePathViewPrivate::setOffset(qreal o)
}
/*!
- \qmlproperty component PathView::highlight
+ \qmlproperty Component PathView::highlight
This property holds the component to use as the highlight.
An instance of the highlight component will be created for each view.
@@ -618,12 +651,12 @@ QDeclarativeItem *QDeclarativePathView::highlightItem()
These properties set the preferred range of the highlight (current item)
within the view. The preferred values must be in the range 0.0-1.0.
- If highlightRangeMode is set to \e ApplyRange the view will
+ If highlightRangeMode is set to \e PathView.ApplyRange the view will
attempt to maintain the highlight within the range, however
the highlight can move outside of the range at the ends of the path
or due to a mouse interaction.
- If highlightRangeMode is set to \e StrictlyEnforceRange the highlight will never
+ If highlightRangeMode is set to \e PathView.StrictlyEnforceRange the highlight will never
move outside of the range. This means that the current item will change
if a keyboard or mouse action would cause the highlight to move
outside of the range.
@@ -631,14 +664,14 @@ QDeclarativeItem *QDeclarativePathView::highlightItem()
Note that this is the correct way to influence where the
current item ends up when the view moves. For example, if you want the
currently selected item to be in the middle of the path, then set the
- highlight range to be 0.5,0.5 and highlightRangeMode to StrictlyEnforceRange.
+ highlight range to be 0.5,0.5 and highlightRangeMode to PathView.StrictlyEnforceRange.
Then, when the path scrolls,
the currently selected item will be the item at that position. This also applies to
when the currently selected item changes - it will scroll to within the preferred
highlight range. Furthermore, the behaviour of the current item index will occur
whether or not a highlight exists.
- The default value is \e StrictlyEnforceRange.
+ The default value is \e PathView.StrictlyEnforceRange.
Note that a valid range requires preferredHighlightEnd to be greater
than or equal to preferredHighlightBegin.
@@ -786,12 +819,17 @@ void QDeclarativePathView::setInteractive(bool interactive)
}
/*!
- \qmlproperty component PathView::delegate
+ \qmlproperty Component PathView::delegate
The delegate provides a template defining each item instantiated by the view.
The index is exposed as an accessible \c index property. Properties of the
model are also available depending upon the type of \l {qmlmodels}{Data Model}.
+ The number of elements in the delegate has a direct effect on the
+ flicking performance of the view when pathItemCount is specified. If at all possible, place functionality
+ that is not needed for the normal display of the delegate in a \l Loader which
+ can load additional elements when needed.
+
Note that the PathView will layout the items based on the size of the root
item in the delegate.
@@ -961,7 +999,12 @@ void QDeclarativePathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *)
else
dist = qRound(dist - d->offset) + d->offset;
// Calculate accel required to stop on item boundary
- accel = v2 / (2.0f * qAbs(dist));
+ if (dist <= 0.) {
+ dist = 0.;
+ accel = 0.;
+ } else {
+ accel = v2 / (2.0f * qAbs(dist));
+ }
}
d->moveOffset.setValue(d->offset);
d->tl.accel(d->moveOffset, velocity, accel, dist);
@@ -1046,7 +1089,11 @@ void QDeclarativePathView::componentComplete()
Q_D(QDeclarativePathView);
QDeclarativeItem::componentComplete();
d->createHighlight();
- d->regenerate();
+ // It is possible that a refill has already happended to to Path
+ // bindings being handled in the componentComplete(). If so
+ // don't do it again.
+ if (d->items.count() == 0)
+ d->regenerate();
d->updateHighlight();
}
@@ -1101,7 +1148,8 @@ void QDeclarativePathView::refill()
while ((pos > startPos || !d->items.count()) && d->items.count() < count) {
// qDebug() << "append" << idx;
QDeclarativeItem *item = d->getItem(idx);
- item->setZValue(idx+1);
+ if (d->model->completePending())
+ item->setZValue(idx+1);
if (d->currentIndex == idx) {
item->setFocus(true);
if (QDeclarativePathViewAttached *att = d->attached(item))
@@ -1114,7 +1162,8 @@ void QDeclarativePathView::refill()
d->firstIndex = idx;
d->items.append(item);
d->updateItem(item, pos);
- d->model->completeItem();
+ if (d->model->completePending())
+ d->model->completeItem();
++idx;
if (idx >= d->model->count())
idx = 0;
@@ -1128,7 +1177,8 @@ void QDeclarativePathView::refill()
while (pos >= 0.0 && pos < startPos) {
// qDebug() << "prepend" << idx;
QDeclarativeItem *item = d->getItem(idx);
- item->setZValue(idx+1);
+ if (d->model->completePending())
+ item->setZValue(idx+1);
if (d->currentIndex == idx) {
item->setFocus(true);
if (QDeclarativePathViewAttached *att = d->attached(item))
@@ -1139,7 +1189,8 @@ void QDeclarativePathView::refill()
}
d->items.prepend(item);
d->updateItem(item, pos);
- d->model->completeItem();
+ if (d->model->completePending())
+ d->model->completeItem();
d->firstIndex = idx;
idx = d->firstIndex - 1;
if (idx < 0)
@@ -1251,6 +1302,19 @@ void QDeclarativePathView::createdItem(int index, QDeclarativeItem *item)
{
Q_D(QDeclarativePathView);
if (d->requestedIndex != index) {
+ if (!d->attType) {
+ // pre-create one metatype to share with all attached objects
+ d->attType = new QDeclarativeOpenMetaObjectType(&QDeclarativePathViewAttached::staticMetaObject, qmlEngine(this));
+ foreach(const QString &attr, d->path->attributes())
+ d->attType->createProperty(attr.toUtf8());
+ }
+ qPathViewAttachedType = d->attType;
+ QDeclarativePathViewAttached *att = static_cast<QDeclarativePathViewAttached *>(qmlAttachedPropertiesObject<QDeclarativePathView>(item));
+ qPathViewAttachedType = 0;
+ if (att) {
+ att->m_view = this;
+ att->setOnPath(false);
+ }
item->setParentItem(this);
d->updateItem(item, index < d->firstIndex ? 0.0 : 1.0);
}
@@ -1276,6 +1340,7 @@ int QDeclarativePathViewPrivate::calcCurrentIndex()
if (offset < 0)
offset += model->count();
current = qRound(qAbs(qmlMod(model->count() - offset, model->count())));
+ current = current % model->count();
}
return current;
diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h
index 72405780ad..349a01c47c 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h
@@ -132,6 +132,10 @@ public:
static QDeclarativePathViewAttached *qmlAttachedProperties(QObject *);
+public Q_SLOTS:
+ void incrementCurrentIndex();
+ void decrementCurrentIndex();
+
Q_SIGNALS:
void currentIndexChanged();
void offsetChanged();
@@ -215,6 +219,7 @@ Q_SIGNALS:
private:
friend class QDeclarativePathViewPrivate;
+ friend class QDeclarativePathView;
QDeclarativePathView *m_view;
QDeclarativeOpenMetaObject *m_metaobject;
bool m_onPath : 1;
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
index 21c33e206c..8796e63819 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
@@ -46,6 +46,7 @@
#include <qdeclarativestate_p.h>
#include <qdeclarativestategroup_p.h>
#include <qdeclarativestateoperations_p.h>
+#include <qdeclarativeinfo.h>
#include <QtCore/qmath.h>
#include <QDebug>
@@ -75,7 +76,6 @@ void QDeclarativeBasePositionerPrivate::unwatchChanges(QDeclarativeItem* other)
/*!
\internal
\class QDeclarativeBasePositioner
- \ingroup group_layouts
\brief The QDeclarativeBasePositioner class provides a base for QDeclarativeGraphics layouts.
To create a QDeclarativeGraphics Positioner, simply subclass QDeclarativeBasePositioner and implement
@@ -165,6 +165,7 @@ void QDeclarativeBasePositioner::componentComplete()
QDeclarativeItem::componentComplete();
positionedItems.reserve(d->QGraphicsItemPrivate::children.count());
prePositioning();
+ reportConflictingAnchors();
}
QVariant QDeclarativeBasePositioner::itemChange(GraphicsItemChange change,
@@ -203,7 +204,11 @@ void QDeclarativeBasePositioner::prePositioning()
if (!isComponentComplete())
return;
+ if (d->doingPositioning)
+ return;
+
d->queuedPositioning = false;
+ d->doingPositioning = true;
//Need to order children by creation order modified by stacking order
QList<QGraphicsItem *> children = d->QGraphicsItemPrivate::children;
qSort(children.begin(), children.end(), d->insertionOrder);
@@ -241,6 +246,7 @@ void QDeclarativeBasePositioner::prePositioning()
doPositioning(&contentSize);
if(d->addTransition || d->moveTransition)
finishApplyTransitions();
+ d->doingPositioning = false;
//Set implicit size to the size of its children
setImplicitHeight(contentSize.height());
setImplicitWidth(contentSize.width());
@@ -329,7 +335,6 @@ Column {
\qml
Column {
spacing: 2
- remove: ...
add: ...
move: ...
...
@@ -339,7 +344,8 @@ Column {
Note that the positioner assumes that the x and y positions of its children
will not change. If you manually change the x or y properties in script, bind
- the x or y properties, or use anchors on a child of a positioner, then the
+ the x or y properties, use anchors on a child of a positioner, or have the
+ height of a child depend on the position of a child, then the
positioner may exhibit strange behaviour.
*/
@@ -377,7 +383,7 @@ Column {
move: Transition {
NumberAnimation {
properties: "y"
- easing.type: "OutBounce"
+ easing.type: Easing.OutBounce
}
}
}
@@ -403,7 +409,6 @@ Column {
\internal
\class QDeclarativeColumn
\brief The QDeclarativeColumn class lines up items vertically.
- \ingroup group_positioners
*/
QDeclarativeColumn::QDeclarativeColumn(QDeclarativeItem *parent)
: QDeclarativeBasePositioner(Vertical, parent)
@@ -436,6 +441,30 @@ void QDeclarativeColumn::doPositioning(QSizeF *contentSize)
contentSize->setHeight(voffset - spacing());
}
+void QDeclarativeColumn::reportConflictingAnchors()
+{
+ QDeclarativeBasePositionerPrivate *d = static_cast<QDeclarativeBasePositionerPrivate*>(QDeclarativeBasePositionerPrivate::get(this));
+ for (int ii = 0; ii < positionedItems.count(); ++ii) {
+ const PositionedItem &child = positionedItems.at(ii);
+ if (child.item) {
+ QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors;
+ if (anchors) {
+ QDeclarativeAnchors::Anchors usedAnchors = anchors->usedAnchors();
+ if (usedAnchors & QDeclarativeAnchors::TopAnchor ||
+ usedAnchors & QDeclarativeAnchors::BottomAnchor ||
+ usedAnchors & QDeclarativeAnchors::VCenterAnchor ||
+ anchors->fill() || anchors->centerIn()) {
+ d->anchorConflict = true;
+ break;
+ }
+ }
+ }
+ }
+ if (d->anchorConflict) {
+ qmlInfo(this) << "Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column";
+ }
+}
+
/*!
\qmlclass Row QDeclarativeRow
\since 4.7
@@ -464,7 +493,8 @@ Row {
Note that the positioner assumes that the x and y positions of its children
will not change. If you manually change the x or y properties in script, bind
- the x or y properties, or use anchors on a child of a positioner, then the
+ the x or y properties, use anchors on a child of a positioner, or have the
+ width of a child depend on the position of a child, then the
positioner may exhibit strange behaviour.
*/
@@ -523,7 +553,6 @@ Row {
\internal
\class QDeclarativeRow
\brief The QDeclarativeRow class lines up items horizontally.
- \ingroup group_positioners
*/
QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent)
: QDeclarativeBasePositioner(Horizontal, parent)
@@ -551,6 +580,28 @@ void QDeclarativeRow::doPositioning(QSizeF *contentSize)
contentSize->setWidth(hoffset - spacing());
}
+void QDeclarativeRow::reportConflictingAnchors()
+{
+ QDeclarativeBasePositionerPrivate *d = static_cast<QDeclarativeBasePositionerPrivate*>(QDeclarativeBasePositionerPrivate::get(this));
+ for (int ii = 0; ii < positionedItems.count(); ++ii) {
+ const PositionedItem &child = positionedItems.at(ii);
+ if (child.item) {
+ QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors;
+ if (anchors) {
+ QDeclarativeAnchors::Anchors usedAnchors = anchors->usedAnchors();
+ if (usedAnchors & QDeclarativeAnchors::LeftAnchor ||
+ usedAnchors & QDeclarativeAnchors::RightAnchor ||
+ usedAnchors & QDeclarativeAnchors::HCenterAnchor ||
+ anchors->fill() || anchors->centerIn()) {
+ d->anchorConflict = true;
+ break;
+ }
+ }
+ }
+ }
+ if (d->anchorConflict)
+ qmlInfo(this) << "Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row";
+}
/*!
\qmlclass Grid QDeclarativeGrid
@@ -595,7 +646,8 @@ Grid {
Note that the positioner assumes that the x and y positions of its children
will not change. If you manually change the x or y properties in script, bind
- the x or y properties, or use anchors on a child of a positioner, then the
+ the x or y properties, use anchors on a child of a positioner, or have the
+ width or height of a child depend on the position of a child, then the
positioner may exhibit strange behaviour.
*/
/*!
@@ -652,8 +704,6 @@ Grid {
\internal
\class QDeclarativeGrid
\brief The QDeclarativeGrid class lays out items in a grid.
- \ingroup group_layouts
-
*/
QDeclarativeGrid::QDeclarativeGrid(QDeclarativeItem *parent) :
QDeclarativeBasePositioner(Both, parent), m_rows(-1), m_columns(-1), m_flow(LeftToRight)
@@ -697,14 +747,14 @@ void QDeclarativeGrid::setRows(const int rows)
}
/*!
- \qmlproperty enumeration Flow::flow
+ \qmlproperty enumeration Grid::flow
This property holds the flow of the layout.
- Possible values are \c LeftToRight (default) and \c TopToBottom.
+ Possible values are \c Grid.LeftToRight (default) and \c Grid.TopToBottom.
- If \a flow is \c LeftToRight, the items are positioned next to
+ If \a flow is \c Grid.LeftToRight, the items are positioned next to
to each other from left to right, then wrapped to the next line.
- If \a flow is \c TopToBottom, the items are positioned next to each
+ If \a flow is \c Grid.TopToBottom, the items are positioned next to each
other from top to bottom, then wrapped to the next column.
*/
QDeclarativeGrid::Flow QDeclarativeGrid::flow() const
@@ -823,6 +873,22 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize)
}
}
+void QDeclarativeGrid::reportConflictingAnchors()
+{
+ QDeclarativeBasePositionerPrivate *d = static_cast<QDeclarativeBasePositionerPrivate*>(QDeclarativeBasePositionerPrivate::get(this));
+ for (int ii = 0; ii < positionedItems.count(); ++ii) {
+ const PositionedItem &child = positionedItems.at(ii);
+ if (child.item) {
+ QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors;
+ if (anchors && (anchors->usedAnchors() || anchors->fill() || anchors->centerIn())) {
+ d->anchorConflict = true;
+ break;
+ }
+ }
+ }
+ if (d->anchorConflict)
+ qmlInfo(this) << "Cannot specify anchors for items inside Grid";
+}
/*!
\qmlclass Flow QDeclarativeFlow
@@ -830,6 +896,11 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize)
\brief The Flow item lines up its children side by side, wrapping as necessary.
\inherits Item
+ Note that the positioner assumes that the x and y positions of its children
+ will not change. If you manually change the x or y properties in script, bind
+ the x or y properties, use anchors on a child of a positioner, or have the
+ width or height of a child depend on the position of a child, then the
+ positioner may exhibit strange behaviour.
*/
/*!
@@ -894,12 +965,12 @@ QDeclarativeFlow::QDeclarativeFlow(QDeclarativeItem *parent)
\qmlproperty enumeration Flow::flow
This property holds the flow of the layout.
- Possible values are \c LeftToRight (default) and \c TopToBottom.
+ Possible values are \c Flow.LeftToRight (default) and \c Flow.TopToBottom.
- If \a flow is \c LeftToRight, the items are positioned next to
+ If \a flow is \c Flow.LeftToRight, the items are positioned next to
to each other from left to right until the width of the Flow
is exceeded, then wrapped to the next line.
- If \a flow is \c TopToBottom, the items are positioned next to each
+ If \a flow is \c Flow.TopToBottom, the items are positioned next to each
other from top to bottom until the height of the Flow is exceeded,
then wrapped to the next column.
*/
@@ -966,5 +1037,21 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize)
}
}
+void QDeclarativeFlow::reportConflictingAnchors()
+{
+ Q_D(QDeclarativeFlow);
+ for (int ii = 0; ii < positionedItems.count(); ++ii) {
+ const PositionedItem &child = positionedItems.at(ii);
+ if (child.item) {
+ QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(child.item)->_anchors;
+ if (anchors && (anchors->usedAnchors() || anchors->fill() || anchors->centerIn())) {
+ d->anchorConflict = true;
+ break;
+ }
+ }
+ }
+ if (d->anchorConflict)
+ qmlInfo(this) << "Cannot specify anchors for items inside Flow";
+}
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
index b5fc979d51..787dcd39fc 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
@@ -94,6 +94,7 @@ protected Q_SLOTS:
protected:
virtual void doPositioning(QSizeF *contentSize)=0;
+ virtual void reportConflictingAnchors()=0;
struct PositionedItem {
PositionedItem(QDeclarativeItem *i) : item(i), isNew(false), isVisible(true) {}
bool operator==(const PositionedItem &other) const { return other.item == item; }
@@ -118,6 +119,7 @@ public:
QDeclarativeColumn(QDeclarativeItem *parent=0);
protected:
virtual void doPositioning(QSizeF *contentSize);
+ virtual void reportConflictingAnchors();
private:
Q_DISABLE_COPY(QDeclarativeColumn)
};
@@ -129,6 +131,7 @@ public:
QDeclarativeRow(QDeclarativeItem *parent=0);
protected:
virtual void doPositioning(QSizeF *contentSize);
+ virtual void reportConflictingAnchors();
private:
Q_DISABLE_COPY(QDeclarativeRow)
};
@@ -161,6 +164,7 @@ Q_SIGNALS:
protected:
virtual void doPositioning(QSizeF *contentSize);
+ virtual void reportConflictingAnchors();
private:
int m_rows;
@@ -187,7 +191,7 @@ Q_SIGNALS:
protected:
virtual void doPositioning(QSizeF *contentSize);
-
+ virtual void reportConflictingAnchors();
protected:
QDeclarativeFlow(QDeclarativeFlowPrivate &dd, QDeclarativeItem *parent);
private:
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
index 576f35b19a..04f0181edb 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
@@ -75,6 +75,7 @@ public:
QDeclarativeBasePositionerPrivate()
: spacing(0), type(QDeclarativeBasePositioner::None)
, moveTransition(0), addTransition(0), queuedPositioning(false)
+ , doingPositioning(false), anchorConflict(false)
{
}
@@ -95,7 +96,9 @@ public:
void watchChanges(QDeclarativeItem *other);
void unwatchChanges(QDeclarativeItem* other);
- bool queuedPositioning;
+ bool queuedPositioning : 1;
+ bool doingPositioning : 1;
+ bool anchorConflict : 1;
virtual void itemSiblingOrderChanged(QDeclarativeItem* other)
{
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index 0328f9163d..ccabbdee77 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -43,6 +43,7 @@
#include "private/qdeclarativerectangle_p_p.h"
#include <QPainter>
+#include <QStringBuilder>
#include <QtCore/qmath.h>
QT_BEGIN_NAMESPACE
@@ -155,8 +156,8 @@ void QDeclarativeGradient::doUpdate()
\brief The Rectangle item allows you to add rectangles to a scene.
\inherits Item
- A Rectangle is painted having a solid fill (color) and an optional border.
- You can also create rounded rectangles using the radius property.
+ A Rectangle is painted using a solid fill (color) and an optional border.
+ You can also create rounded rectangles using the \l radius property.
\qml
Rectangle {
@@ -223,14 +224,22 @@ QDeclarativePen *QDeclarativeRectangle::border()
\o \image declarative-rect_gradient.png
\o
\qml
- Rectangle { y: 0; width: 80; height: 80; color: "lightsteelblue" }
- Rectangle { y: 100; width: 80; height: 80
+ Rectangle {
+ y: 0; width: 80; height: 80
+ color: "lightsteelblue"
+ }
+
+ Rectangle {
+ y: 100; width: 80; height: 80
gradient: Gradient {
GradientStop { position: 0.0; color: "lightsteelblue" }
GradientStop { position: 1.0; color: "blue" }
}
}
- Rectangle { rotation: 90; y: 200; width: 80; height: 80
+
+ Rectangle {
+ y: 200; width: 80; height: 80
+ rotation: 90
gradient: Gradient {
GradientStop { position: 0.0; color: "lightsteelblue" }
GradientStop { position: 1.0; color: "blue" }
@@ -334,21 +343,29 @@ void QDeclarativeRectangle::generateRoundedRect()
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
- d->rectImage = QPixmap(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2);
- d->rectImage.fill(Qt::transparent);
- QPainter p(&(d->rectImage));
- p.setRenderHint(QPainter::Antialiasing);
- if (d->pen && d->pen->isValid()) {
- QPen pn(QColor(d->pen->color()), d->pen->width());
- p.setPen(pn);
- } else {
- p.setPen(Qt::NoPen);
+
+ QString key = QLatin1String("q_") % QString::number(pw) % d->color.name() % QString::number(d->color.alpha(), 16) % QLatin1Char('_') % QString::number(radius);
+ if (d->pen && d->pen->isValid())
+ key += d->pen->color().name() % QString::number(d->pen->color().alpha(), 16);
+
+ if (!QPixmapCache::find(key, &d->rectImage)) {
+ d->rectImage = QPixmap(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2);
+ d->rectImage.fill(Qt::transparent);
+ QPainter p(&(d->rectImage));
+ p.setRenderHint(QPainter::Antialiasing);
+ if (d->pen && d->pen->isValid()) {
+ QPen pn(QColor(d->pen->color()), d->pen->width());
+ p.setPen(pn);
+ } else {
+ p.setPen(Qt::NoPen);
+ }
+ p.setBrush(d->color);
+ if (pw%2)
+ p.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, d->rectImage.width()-(pw+1), d->rectImage.height()-(pw+1)), d->radius, d->radius);
+ else
+ p.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, d->rectImage.width()-pw, d->rectImage.height()-pw), d->radius, d->radius);
+ QPixmapCache::insert(key, d->rectImage);
}
- p.setBrush(d->color);
- if (pw%2)
- p.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, d->rectImage.width()-(pw+1), d->rectImage.height()-(pw+1)), d->radius, d->radius);
- else
- p.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, d->rectImage.width()-pw, d->rectImage.height()-pw), d->radius, d->radius);
}
}
@@ -357,22 +374,30 @@ void QDeclarativeRectangle::generateBorderedRect()
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);
- d->rectImage.fill(Qt::transparent);
- QPainter p(&(d->rectImage));
- p.setRenderHint(QPainter::Antialiasing);
- if (d->pen && d->pen->isValid()) {
- QPen pn(QColor(d->pen->color()), d->pen->width());
- pn.setJoinStyle(Qt::MiterJoin);
- p.setPen(pn);
- } else {
- p.setPen(Qt::NoPen);
+
+ QString key = QLatin1String("q_") % QString::number(pw) % d->color.name() % QString::number(d->color.alpha(), 16);
+ if (d->pen && d->pen->isValid())
+ key += d->pen->color().name() % QString::number(d->pen->color().alpha(), 16);
+
+ if (!QPixmapCache::find(key, &d->rectImage)) {
+ d->rectImage = QPixmap(pw*2 + 3, pw*2 + 3);
+ d->rectImage.fill(Qt::transparent);
+ QPainter p(&(d->rectImage));
+ p.setRenderHint(QPainter::Antialiasing);
+ if (d->pen && d->pen->isValid()) {
+ QPen pn(QColor(d->pen->color()), d->pen->width());
+ pn.setJoinStyle(Qt::MiterJoin);
+ p.setPen(pn);
+ } else {
+ p.setPen(Qt::NoPen);
+ }
+ p.setBrush(d->color);
+ if (pw%2)
+ p.drawRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, d->rectImage.width()-(pw+1), d->rectImage.height()-(pw+1)));
+ else
+ p.drawRect(QRectF(qreal(pw)/2, qreal(pw)/2, d->rectImage.width()-pw, d->rectImage.height()-pw));
+ QPixmapCache::insert(key, d->rectImage);
}
- p.setBrush(d->color);
- if (pw%2)
- p.drawRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, d->rectImage.width()-(pw+1), d->rectImage.height()-(pw+1)));
- else
- p.drawRect(QRectF(qreal(pw)/2, qreal(pw)/2, d->rectImage.width()-pw, d->rectImage.height()-pw));
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp
index d49bb02218..04076f826b 100644
--- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp
@@ -67,7 +67,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate()
\brief The Repeater item allows you to repeat an Item-based component using a model.
- The Repeater item is used when you want to create a large number of
+ The Repeater item is used to create a large number of
similar items. For each entry in the model, an item is instantiated
in a context seeded with data from the model. If the repeater will
be instantiating a large number of instances, it may be more efficient to
@@ -193,7 +193,7 @@ void QDeclarativeRepeater::setModel(const QVariant &model)
d->model = vim;
} else {
if (!d->ownModel) {
- d->model = new QDeclarativeVisualDataModel(qmlContext(this));
+ d->model = new QDeclarativeVisualDataModel(qmlContext(this), this);
d->ownModel = true;
}
if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model))
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 2b8da8e529..4e7e0fd991 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -116,7 +116,7 @@ QSet<QUrl> QTextDocumentWithImageResources::errors;
\brief The Text item allows you to add formatted text to a scene.
\inherits Item
- It can display both plain and rich text. For example:
+ A Text item can display both plain and rich text. For example:
\qml
Text { text: "Hello World!"; font.family: "Helvetica"; font.pointSize: 24; color: "red" }
@@ -132,8 +132,8 @@ QSet<QUrl> QTextDocumentWithImageResources::errors;
The \c elide property can alternatively be used to fit a single line of
plain text to a set width.
- Note that the \l{Supported HTML Subset} is limited, and that if IMG tags
- load remote images, the text reloads (see resourcesLoading).
+ Note that the \l{Supported HTML Subset} is limited. Also, if the text contains
+ HTML img tags that load remote images, the text is reloaded.
Text provides read-only text. For editable text, see \l TextEdit.
*/
@@ -142,7 +142,6 @@ QSet<QUrl> QTextDocumentWithImageResources::errors;
\internal
\class QDeclarativeText
\qmlclass Text
- \ingroup group_coreitems
\brief The QDeclarativeText class provides a formatted text item that you can add to a QDeclarativeView.
@@ -191,7 +190,7 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate()
/*!
\qmlproperty bool Text::font.bold
- Sets the font's weight to bold.
+ Sets whether the font weight is bold.
*/
/*!
@@ -201,11 +200,11 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate()
The weight can be one of:
\list
- \o Light
- \o Normal - the default
- \o DemiBold
- \o Bold
- \o Black
+ \o Font.Light
+ \o Font.Normal - the default
+ \o Font.DemiBold
+ \o Font.Bold
+ \o Font.Black
\endlist
\qml
@@ -216,25 +215,25 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate()
/*!
\qmlproperty bool Text::font.italic
- Sets the style of the text to italic.
+ Sets whether the font has an italic style.
*/
/*!
\qmlproperty bool Text::font.underline
- Set the style of the text to underline.
+ Sets whether the text is underlined.
*/
/*!
\qmlproperty bool Text::font.outline
- Set the style of the text to outline.
+ Sets whether the font has an outline style.
*/
/*!
\qmlproperty bool Text::font.strikeout
- Set the style of the text to strikeout.
+ Sets whether the font has a strikeout style.
*/
/*!
@@ -278,11 +277,11 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate()
Sets the capitalization for the text.
\list
- \o MixedCase - This is the normal text rendering option where no capitalization change is applied.
- \o AllUppercase - This alters the text to be rendered in all uppercase type.
- \o AllLowercase - This alters the text to be rendered in all lowercase type.
- \o SmallCaps - This alters the text to be rendered in small-caps type.
- \o Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
+ \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.
+ \o Font.AllUppercase - This alters the text to be rendered in all uppercase type.
+ \o Font.AllLowercase - This alters the text to be rendered in all lowercase type.
+ \o Font.SmallCaps - This alters the text to be rendered in small-caps type.
+ \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
\endlist
\qml
@@ -381,10 +380,10 @@ QColor QDeclarativeText::color() const
Supported text styles are:
\list
- \o Normal - the default
- \o Outline
- \o Raised
- \o Sunken
+ \o Text.Normal - the default
+ \o Text.Outline
+ \o Text.Raised
+ \o Text.Sunken
\endlist
\qml
@@ -452,9 +451,14 @@ QColor QDeclarativeText::styleColor() const
Sets the horizontal and vertical alignment of the text within the Text items
width and height. By default, the text is top-left aligned.
- The valid values for \c horizontalAlignment are \c AlignLeft, \c AlignRight and
- \c AlignHCenter. The valid values for \c verticalAlignment are \c AlignTop, \c AlignBottom
- and \c AlignVCenter.
+ The valid values for \c horizontalAlignment are \c Text.AlignLeft, \c Text.AlignRight and
+ \c Text.AlignHCenter. The valid values for \c verticalAlignment are \c Text.AlignTop, \c Text.AlignBottom
+ and \c Text.AlignVCenter.
+
+ Note that for a single line of text, the size of the text is the area of the text. In this common case,
+ all alignments are equivalent. If you want the text to be, say, centered in it parent, then you will
+ need to either modify the Item::anchors, or set horizontalAlignment to Text.AlignHCenter and bind the width to
+ that of the parent.
*/
QDeclarativeText::HAlignment QDeclarativeText::hAlign() const
{
@@ -495,16 +499,16 @@ void QDeclarativeText::setVAlign(VAlignment align)
wrap if an explicit width has been set. wrapMode can be one of:
\list
- \o NoWrap - no wrapping will be performed.
- \o WordWrap - wrapping is done on word boundaries. If the text cannot be
+ \o Text.NoWrap - no wrapping will be performed.
+ \o Text.WordWrap - wrapping is done on word boundaries. If the text cannot be
word-wrapped to the specified width it will be partially drawn outside of the item's bounds.
If this is undesirable then enable clipping on the item (Item::clip).
- \o WrapAnywhere - Text can be wrapped at any point on a line, even if it occurs in the middle of a word.
- \o WrapAtWordBoundaryOrAnywhere - If possible, wrapping occurs at a word boundary; otherwise it
+ \o Text.WrapAnywhere - Text can be wrapped at any point on a line, even if it occurs in the middle of a word.
+ \o Text.WrapAtWordBoundaryOrAnywhere - If possible, wrapping occurs at a word boundary; otherwise it
will occur at the appropriate point on the line, even in the middle of a word.
\endlist
- The default is NoWrap.
+ The default is Text.NoWrap.
*/
QDeclarativeText::WrapMode QDeclarativeText::wrapMode() const
{
@@ -531,13 +535,20 @@ void QDeclarativeText::setWrapMode(WrapMode mode)
The way the text property should be displayed.
- Supported text formats are \c AutoText, \c PlainText, \c RichText and \c StyledText
+ Supported text formats are:
+
+ \list
+ \o Text.AutoText
+ \o Text.PlainText
+ \o Text.RichText
+ \o Text.StyledText
+ \endlist
- The default is AutoText. If the text format is AutoText the text element
+ The default is Text.AutoText. If the text format is Text.AutoText the text element
will automatically determine whether the text should be treated as
rich text. This determination is made using Qt::mightBeRichText().
- StyledText is an optimized format supporting some basic text
+ Text.StyledText is an optimized format supporting some basic text
styling markup, in the style of html 3.2:
\code
@@ -548,7 +559,7 @@ void QDeclarativeText::setWrapMode(WrapMode mode)
&gt; &lt; &amp;
\endcode
- \c StyledText parser is strict, requiring tags to be correctly nested.
+ \c Text.StyledText parser is strict, requiring tags to be correctly nested.
\table
\row
@@ -616,13 +627,13 @@ void QDeclarativeText::setTextFormat(TextFormat format)
Eliding can be:
\list
- \o ElideNone - the default
- \o ElideLeft
- \o ElideMiddle
- \o ElideRight
+ \o Text.ElideNone - the default
+ \o Text.ElideLeft
+ \o Text.ElideMiddle
+ \o Text.ElideRight
\endlist
- If the text is a multi-length string, and the mode is not \c ElideNone,
+ If the text is a multi-length string, and the mode is not \c Text.ElideNone,
the first string that fits will be used, otherwise the last will be elided.
Multi-length strings are ordered from longest to shortest, separated by the
@@ -1069,8 +1080,9 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid
/*!
\qmlproperty bool Text::smooth
- Set this property if you want the text to be smoothly scaled or
- transformed. Smooth filtering gives better visual quality, but is slower. If
+ This property holds whether the text is smoothly scaled or transformed.
+
+ Smooth filtering gives better visual quality, but is slower. If
the item is displayed at its natural size, this property has no visual or
performance effect.
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 25eaef6949..45b79a768e 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -46,6 +46,8 @@
#include <private/qdeclarativeglobal_p.h>
#include <qdeclarativeinfo.h>
+#include <QtCore/qmath.h>
+
#include <QTextLayout>
#include <QTextLine>
#include <QTextDocument>
@@ -85,7 +87,6 @@ TextEdit {
\internal
\class QDeclarativeTextEdit
\qmlclass TextEdit
- \ingroup group_coreitems
\brief The QDeclarativeTextEdit class provides an editable formatted text item that you can add to a QDeclarativeView.
@@ -129,7 +130,7 @@ QString QDeclarativeTextEdit::text() const
/*!
\qmlproperty bool TextEdit::font.bold
- Sets the font's weight to bold.
+ Sets whether the font weight is bold.
*/
/*!
@@ -139,11 +140,11 @@ QString QDeclarativeTextEdit::text() const
The weight can be one of:
\list
- \o Light
- \o Normal - the default
- \o DemiBold
- \o Bold
- \o Black
+ \o Font.Light
+ \o Font.Normal - the default
+ \o Font.DemiBold
+ \o Font.Bold
+ \o Font.Black
\endlist
\qml
@@ -154,25 +155,25 @@ QString QDeclarativeTextEdit::text() const
/*!
\qmlproperty bool TextEdit::font.italic
- Sets the style of the text to italic.
+ Sets whether the font has an italic style.
*/
/*!
\qmlproperty bool TextEdit::font.underline
- Set the style of the text to underline.
+ Sets whether the text is underlined.
*/
/*!
\qmlproperty bool TextEdit::font.outline
- Set the style of the text to outline.
+ Sets whether the font has an outline style.
*/
/*!
\qmlproperty bool TextEdit::font.strikeout
- Set the style of the text to strikeout.
+ Sets whether the font has a strikeout style.
*/
/*!
@@ -216,11 +217,11 @@ QString QDeclarativeTextEdit::text() const
Sets the capitalization for the text.
\list
- \o MixedCase - This is the normal text rendering option where no capitalization change is applied.
- \o AllUppercase - This alters the text to be rendered in all uppercase type.
- \o AllLowercase - This alters the text to be rendered in all lowercase type.
- \o SmallCaps - This alters the text to be rendered in small-caps type.
- \o Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
+ \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.
+ \o Font.AllUppercase - This alters the text to be rendered in all uppercase type.
+ \o Font.AllLowercase - This alters the text to be rendered in all lowercase type.
+ \o Font.SmallCaps - This alters the text to be rendered in small-caps type.
+ \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
\endlist
\qml
@@ -255,9 +256,14 @@ void QDeclarativeTextEdit::setText(const QString &text)
The way the text property should be displayed.
- Supported text formats are \c AutoText, \c PlainText and \c RichText.
+ \list
+ \o TextEdit.AutoText
+ \o TextEdit.PlainText
+ \o TextEdit.RichText
+ \o TextEdit.StyledText
+ \endlist
- The default is AutoText. If the text format is AutoText the text edit
+ The default is TextEdit.AutoText. If the text format is TextEdit.AutoText the text edit
will automatically determine whether the text should be treated as
rich text. This determination is made using Qt::mightBeRichText().
@@ -424,9 +430,9 @@ void QDeclarativeTextEdit::setSelectedTextColor(const QColor &color)
Sets the horizontal and vertical alignment of the text within the TextEdit items
width and height. By default, the text is top-left aligned.
- The valid values for \c horizontalAlignment are \c AlignLeft, \c AlignRight and
- \c AlignHCenter. The valid values for \c verticalAlignment are \c AlignTop, \c AlignBottom
- and \c AlignVCenter.
+ The valid values for \c horizontalAlignment are \c TextEdit.AlignLeft, \c TextEdit.AlignRight and
+ \c TextEdit.AlignHCenter. The valid values for \c verticalAlignment are \c TextEdit.AlignTop, \c TextEdit.AlignBottom
+ and \c TextEdit.AlignVCenter.
*/
QDeclarativeTextEdit::HAlignment QDeclarativeTextEdit::hAlign() const
{
@@ -469,14 +475,14 @@ void QDeclarativeTextEdit::setVAlign(QDeclarativeTextEdit::VAlignment alignment)
The text will only wrap if an explicit width has been set.
\list
- \o NoWrap - no wrapping will be performed.
- \o WordWrap - wrapping is done on word boundaries.
- \o WrapAnywhere - Text can be wrapped at any point on a line, even if it occurs in the middle of a word.
- \o WrapAtWordBoundaryOrAnywhere - If possible, wrapping occurs at a word boundary; otherwise it
+ \o TextEdit.NoWrap - no wrapping will be performed.
+ \o TextEdit.WordWrap - wrapping is done on word boundaries.
+ \o TextEdit.WrapAnywhere - Text can be wrapped at any point on a line, even if it occurs in the middle of a word.
+ \o TextEdit.WrapAtWordBoundaryOrAnywhere - If possible, wrapping occurs at a word boundary; otherwise it
will occur at the appropriate point on the line, even in the middle of a word.
\endlist
- The default is NoWrap.
+ The default is TextEdit.NoWrap.
*/
QDeclarativeTextEdit::WrapMode QDeclarativeTextEdit::wrapMode() const
{
@@ -724,7 +730,7 @@ void QDeclarativeTextEdit::setPersistentSelection(bool on)
}
/*
- \qmlproperty number TextEdit::textMargin
+ \qmlproperty real TextEdit::textMargin
The margin, in pixels, around the text in the TextEdit.
*/
@@ -852,8 +858,9 @@ Handles the given key \a event.
void QDeclarativeTextEdit::keyPressEvent(QKeyEvent *event)
{
Q_D(QDeclarativeTextEdit);
- d->control->processEvent(event, QPointF(0, 0));
-
+ keyPressPreHandler(event);
+ if (!event->isAccepted())
+ d->control->processEvent(event, QPointF(0, 0));
if (!event->isAccepted())
QDeclarativePaintedItem::keyPressEvent(event);
}
@@ -865,7 +872,9 @@ Handles the given key \a event.
void QDeclarativeTextEdit::keyReleaseEvent(QKeyEvent *event)
{
Q_D(QDeclarativeTextEdit);
- d->control->processEvent(event, QPointF(0, 0));
+ keyReleasePreHandler(event);
+ if (!event->isAccepted())
+ d->control->processEvent(event, QPointF(0, 0));
if (!event->isAccepted())
QDeclarativePaintedItem::keyReleaseEvent(event);
}
@@ -893,17 +902,18 @@ Handles the given mouse \a event.
void QDeclarativeTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QDeclarativeTextEdit);
+ bool hadFocus = hasFocus();
if (d->focusOnPress){
QGraphicsItem *p = parentItem();//###Is there a better way to find my focus scope?
while(p) {
- if(p->flags() & QGraphicsItem::ItemIsFocusScope){
+ if (p->flags() & QGraphicsItem::ItemIsFocusScope)
p->setFocus();
- break;
- }
p = p->parentItem();
}
setFocus(true);
}
+ if (!hadFocus && hasFocus())
+ d->clickCausedFocus = true;
d->control->processEvent(event, QPointF(0, 0));
if (!event->isAccepted())
QDeclarativePaintedItem::mousePressEvent(event);
@@ -918,11 +928,12 @@ void QDeclarativeTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
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);
+ qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), d->clickCausedFocus);
+ d->clickCausedFocus = false;
d->control->processEvent(event, QPointF(0, 0));
if (!event->isAccepted())
- QDeclarativePaintedItem::mousePressEvent(event);
+ QDeclarativePaintedItem::mouseReleaseEvent(event);
}
/*!
@@ -946,7 +957,8 @@ void QDeclarativeTextEdit::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Q_D(QDeclarativeTextEdit);
d->control->processEvent(event, QPointF(0, 0));
if (!event->isAccepted())
- QDeclarativePaintedItem::mousePressEvent(event);
+ QDeclarativePaintedItem::mouseMoveEvent(event);
+ event->setAccepted(true);
}
/*!
@@ -991,8 +1003,9 @@ void QDeclarativeTextEdit::updateImgCache(const QRectF &r)
/*!
\qmlproperty bool TextEdit::smooth
- Set this property if you want the text to be smoothly scaled or
- transformed. Smooth filtering gives better visual quality, but is slower. If
+ This property holds whether the text is smoothly scaled or transformed.
+
+ Smooth filtering gives better visual quality, but is slower. If
the item is displayed at its natural size, this property has no visual or
performance effect.
@@ -1102,7 +1115,7 @@ void QDeclarativeTextEdit::updateSize()
setBaselineOffset(fm.ascent() + yoff + d->textMargin);
//### need to comfirm cost of always setting these
- int newWidth = (int)d->document->idealWidth();
+ int newWidth = qCeil(d->document->idealWidth());
d->document->setTextWidth(newWidth); // ### QTextDoc> Alignment will not work unless textWidth is set. Does Text need this line as well?
int cursorWidth = 1;
if(d->cursor)
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
index 8d4b6114a4..5e19c3d1bf 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
@@ -70,7 +70,7 @@ public:
QDeclarativeTextEditPrivate()
: color("black"), hAlign(QDeclarativeTextEdit::AlignLeft), vAlign(QDeclarativeTextEdit::AlignTop),
imgDirty(true), dirty(false), richText(false), cursorVisible(false), focusOnPress(true),
- persistentSelection(true), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0),
+ persistentSelection(true), clickCausedFocus(false), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0),
cursorComponent(0), cursor(0), format(QDeclarativeTextEdit::AutoText), document(0),
wrapMode(QDeclarativeTextEdit::NoWrap)
{
@@ -100,6 +100,7 @@ public:
bool cursorVisible : 1;
bool focusOnPress : 1;
bool persistentSelection : 1;
+ bool clickCausedFocus : 1;
qreal textMargin;
int lastSelectionStart;
int lastSelectionEnd;
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index b618183c95..8aa7e998fb 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -55,13 +55,16 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass TextInput QDeclarativeTextInput
\since 4.7
- The TextInput item allows you to add an editable line of text to a scene.
+ \brief The TextInput item allows you to add an editable line of text to a scene.
TextInput can only display a single line of text, and can only display
plain text. However it can provide addition input constraints on the text.
Input constraints include setting a QValidator, an input mask, or a
maximum input length.
+
+ On Mac OS X, the Up/Down key bindings for Home/End are explicitly disabled.
+ If you want such bindings (on any platform), you will need to construct them in QML.
*/
QDeclarativeTextInput::QDeclarativeTextInput(QDeclarativeItem* parent)
: QDeclarativePaintedItem(*(new QDeclarativeTextInputPrivate), parent)
@@ -108,7 +111,7 @@ void QDeclarativeTextInput::setText(const QString &s)
/*!
\qmlproperty bool TextInput::font.bold
- Sets the font's weight to bold.
+ Sets whether the font weight is bold.
*/
/*!
@@ -118,11 +121,11 @@ void QDeclarativeTextInput::setText(const QString &s)
The weight can be one of:
\list
- \o Light
- \o Normal - the default
- \o DemiBold
- \o Bold
- \o Black
+ \o Font.Light
+ \o Font.Normal - the default
+ \o Font.DemiBold
+ \o Font.Bold
+ \o Font.Black
\endlist
\qml
@@ -133,25 +136,25 @@ void QDeclarativeTextInput::setText(const QString &s)
/*!
\qmlproperty bool TextInput::font.italic
- Sets the style of the text to italic.
+ Sets whether the font has an italic style.
*/
/*!
\qmlproperty bool TextInput::font.underline
- Set the style of the text to underline.
+ Sets whether the text is underlined.
*/
/*!
\qmlproperty bool TextInput::font.outline
- Set the style of the text to outline.
+ Sets whether the font has an outline style.
*/
/*!
\qmlproperty bool TextInput::font.strikeout
- Set the style of the text to strikeout.
+ Sets whether the font has a strikeout style.
*/
/*!
@@ -195,11 +198,11 @@ void QDeclarativeTextInput::setText(const QString &s)
Sets the capitalization for the text.
\list
- \o MixedCase - This is the normal text rendering option where no capitalization change is applied.
- \o AllUppercase - This alters the text to be rendered in all uppercase type.
- \o AllLowercase - This alters the text to be rendered in all lowercase type.
- \o SmallCaps - This alters the text to be rendered in small-caps type.
- \o Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
+ \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.
+ \o Font.AllUppercase - This alters the text to be rendered in all uppercase type.
+ \o Font.AllLowercase - This alters the text to be rendered in all lowercase type.
+ \o Font.SmallCaps - This alters the text to be rendered in small-caps type.
+ \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
\endlist
\qml
@@ -308,8 +311,8 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color)
vertically. You can use anchors to align it however you want within
another item.
- The valid values for \c horizontalAlignment are \c AlignLeft, \c AlignRight and
- \c AlignHCenter.
+ The valid values for \c horizontalAlignment are \c TextInput.AlignLeft, \c TextInput.AlignRight and
+ \c TextInput.AlignHCenter.
*/
QDeclarativeTextInput::HAlignment QDeclarativeTextInput::hAlign() const
{
@@ -600,9 +603,9 @@ void QDeclarativeTextInput::setAutoScroll(bool b)
This property holds the notation of how a string can describe a number.
The values for this property are DoubleValidator.StandardNotation or DoubleValidator.ScientificNotation.
- If this property is set to ScientificNotation, the written number may have an exponent part(i.e. 1.5E-2).
+ If this property is set to DoubleValidator.ScientificNotation, the written number may have an exponent part(i.e. 1.5E-2).
- By default, this property is set to ScientificNotation.
+ By default, this property is set to DoubleValidator.ScientificNotation.
*/
/*!
@@ -706,14 +709,15 @@ bool QDeclarativeTextInput::hasAcceptableInput() const
}
/*!
- \qmlproperty TextInput.EchoMode TextInput::echoMode
+ \qmlproperty enumeration TextInput::echoMode
Specifies how the text should be displayed in the TextInput.
- The default is Normal, which displays the text as it is. Other values
- are Password, which displays asterixes instead of characters, NoEcho,
- which displays nothing, and PasswordEchoOnEdit, which displays all but the
- current character as asterixes.
-
+ \list
+ \o TextInput.Normal - Displays the text as it is. (Default)
+ \o TextInput.Password - Displays asterixes instead of characters.
+ \o TextInput.NoEcho - Displays nothing.
+ \o TextInput.PasswordEchoOnEdit - Displays all but the current character as asterixes.
+ \endlist
*/
QDeclarativeTextInput::EchoMode QDeclarativeTextInput::echoMode() const
{
@@ -827,8 +831,8 @@ void QDeclarativeTextInput::moveCursor()
d->cursorItem->setX(d->control->cursorToX() - d->hscroll);
}
-/*
- \qmlmethod int xToPosition(int x)
+/*!
+ \qmlmethod int TextInput::xToPosition(int x)
This function returns the character position at
x pixels from the left of the textInput. Position 0 is before the
@@ -859,10 +863,15 @@ void QDeclarativeTextInputPrivate::focusChanged(bool hasFocus)
void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev)
{
Q_D(QDeclarativeTextInput);
- if(((d->control->cursor() == 0 && ev->key() == Qt::Key_Left)
+ keyPressPreHandler(ev);
+ if (ev->isAccepted())
+ return;
+ if (((ev->key() == Qt::Key_Up || ev->key() == Qt::Key_Down) && ev->modifiers() == Qt::NoModifier) // Don't allow MacOSX up/down support, and we don't allow a completer.
+ || (((d->control->cursor() == 0 && ev->key() == Qt::Key_Left)
|| (d->control->cursor() == d->control->text().length()
&& ev->key() == Qt::Key_Right))
- && (d->lastSelectionStart == d->lastSelectionEnd)){
+ && (d->lastSelectionStart == d->lastSelectionEnd)))
+ {
//ignore when moving off the end
//unless there is a selection, because then moving will do something (deselect)
ev->ignore();
@@ -876,26 +885,30 @@ void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev)
void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QDeclarativeTextInput);
+ bool hadFocus = hasFocus();
if(d->focusOnPress){
QGraphicsItem *p = parentItem();//###Is there a better way to find my focus scope?
while(p) {
- if(p->flags() & QGraphicsItem::ItemIsFocusScope){
+ if (p->flags() & QGraphicsItem::ItemIsFocusScope)
p->setFocus();
- break;
- }
p = p->parentItem();
}
setFocus(true);
}
+ if (!hadFocus && hasFocus())
+ d->clickCausedFocus = true;
+
bool mark = event->modifiers() & Qt::ShiftModifier;
int cursor = d->xToPos(event->pos().x());
d->control->moveCursor(cursor, mark);
+ event->setAccepted(true);
}
void QDeclarativeTextInput::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QDeclarativeTextInput);
d->control->moveCursor(d->xToPos(event->pos().x()), true);
+ event->setAccepted(true);
}
/*!
@@ -907,8 +920,10 @@ void QDeclarativeTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
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);
+ qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), d->clickCausedFocus);
+ d->clickCausedFocus = false;
+ if (!event->isAccepted())
+ QDeclarativePaintedItem::mouseReleaseEvent(event);
}
bool QDeclarativeTextInput::event(QEvent* ev)
@@ -929,8 +944,8 @@ bool QDeclarativeTextInput::event(QEvent* ev)
updateSize();
}
if(!handled)
- return QDeclarativePaintedItem::event(ev);
- return true;
+ handled = QDeclarativePaintedItem::event(ev);
+ return handled;
}
void QDeclarativeTextInput::geometryChanged(const QRectF &newGeometry,
@@ -1012,6 +1027,8 @@ QVariant QDeclarativeTextInput::inputMethodQuery(Qt::InputMethodQuery property)
{
Q_D(const QDeclarativeTextInput);
switch(property) {
+ case Qt::ImMicroFocus:
+ return d->control->cursorRect();
case Qt::ImFont:
return font();
case Qt::ImCursorPosition:
@@ -1044,8 +1061,9 @@ void QDeclarativeTextInput::selectAll()
/*!
\qmlproperty bool TextInput::smooth
- Set this property if you want the text to be smoothly scaled or
- transformed. Smooth filtering gives better visual quality, but is slower. If
+ This property holds whether the text is smoothly scaled or transformed.
+
+ Smooth filtering gives better visual quality, but is slower. If
the item is displayed at its natural size, this property has no visual or
performance effect.
@@ -1054,15 +1072,15 @@ void QDeclarativeTextInput::selectAll()
filtering at the beginning of the animation and reenable it at the conclusion.
*/
-/*
+/*!
\qmlproperty string TextInput::passwordCharacter
This is the character displayed when echoMode is set to Password or
PasswordEchoOnEdit. By default it is an asterisk.
- Attempting to set this to more than one character will set it to
- the first character in the string. Attempting to set this to less
- than one character will fail.
+ If this property is set to a string with more than one character,
+ the first character is used. If the string is empty, the value
+ is ignored and the property is not set.
*/
QString QDeclarativeTextInput::passwordCharacter() const
{
@@ -1079,15 +1097,15 @@ void QDeclarativeTextInput::setPasswordCharacter(const QString &str)
d->control->setPasswordCharacter(str.constData()[0]);
}
-/*
+/*!
\qmlproperty string TextInput::displayText
- This is the actual text displayed in the TextInput. When
- echoMode is set to TextInput::Normal this will be exactly
- the same as the TextInput::text property. When echoMode
- is set to something else, this property will contain the text
- the user sees, while the text property will contain the
- entered text.
+ This is the text displayed in the TextInput.
+
+ If \l echoMode is set to TextInput::Normal, this holds the
+ same value as the TextInput::text property. Otherwise,
+ this property holds the text visible to the user, while
+ the \l text property holds the actual entered text.
*/
QString QDeclarativeTextInput::displayText() const
{
@@ -1095,29 +1113,33 @@ QString QDeclarativeTextInput::displayText() const
return d->control->displayText();
}
-/*
- \qmlmethod void moveCursorSelection(int pos)
+/*!
+ \qmlmethod void TextInput::moveCursorSelection(int position)
- This method allows you to move the cursor while modifying the selection accordingly.
- To simply move the cursor, set the cursorPosition property.
+ Moves the cursor to \a position and updates the selection accordingly.
+ (To only move the cursor, set the \l cursorPosition property.)
When this method is called it additionally sets either the
selectionStart or the selectionEnd (whichever was at the previous cursor position)
to the specified position. This allows you to easily extend and contract the selected
text range.
- Example: The sequence of calls
+ For example, take this sequence of calls:
+
+ \code
cursorPosition = 5
moveCursorSelection(9)
moveCursorSelection(7)
- would move the cursor to position 5, extend the selection end from 5 to 9
+ \endcode
+
+ This moves the cursor to position 5, extend the selection end from 5 to 9
and then retract the selection end from 9 to 7, leaving the text from position 5 to 7
selected (the 6th and 7th characters).
*/
-void QDeclarativeTextInput::moveCursorSelection(int pos)
+void QDeclarativeTextInput::moveCursorSelection(int position)
{
Q_D(QDeclarativeTextInput);
- d->control->moveCursor(pos, true);
+ d->control->moveCursor(position, true);
}
void QDeclarativeTextInputPrivate::init()
@@ -1222,9 +1244,7 @@ void QDeclarativeTextInput::updateSize(bool needsRedraw)
int cursorWidth = d->control->cursorWidth();
if(d->cursorItem)
cursorWidth = d->cursorItem->width();
- //### Is QFontMetrics too slow?
- QFontMetricsF fm(d->font);
- setImplicitWidth(fm.width(d->control->displayText())+cursorWidth);
+ setImplicitWidth(d->control->naturalTextWidth() + cursorWidth);
setContentsSize(QSize(width(), height()));//Repaints if changed
if(w==width() && h==height() && needsRedraw){
clearCache();
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
index 26cf78c025..99866b8ee1 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
@@ -72,7 +72,7 @@ public:
color((QRgb)0), style(QDeclarativeText::Normal),
styleColor((QRgb)0), hAlign(QDeclarativeTextInput::AlignLeft),
hscroll(0), oldScroll(0), focused(false), focusOnPress(true),
- cursorVisible(false), autoScroll(true)
+ cursorVisible(false), autoScroll(true), clickCausedFocus(false)
{
}
@@ -116,6 +116,7 @@ public:
bool focusOnPress;
bool cursorVisible;
bool autoScroll;
+ bool clickCausedFocus;
};
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index 43cafe3f5d..0e4217e097 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -44,6 +44,7 @@
#include "qdeclarativeitem.h"
#include <qdeclarativecontext.h>
+#include <qdeclarativecontext_p.h>
#include <qdeclarativeengine.h>
#include <qdeclarativeexpression.h>
#include <qdeclarativepackage_p.h>
@@ -55,6 +56,7 @@
#include <qdeclarativeguard_p.h>
#include <qdeclarativeglobal_p.h>
+#include <qgraphicsscene.h>
#include <qlistmodelinterface_p.h>
#include <qhash.h>
#include <qlist.h>
@@ -136,8 +138,8 @@ public:
}
\endcode
*/
-QDeclarativeVisualItemModel::QDeclarativeVisualItemModel()
- : QDeclarativeVisualModel(*(new QDeclarativeVisualItemModelPrivate))
+QDeclarativeVisualItemModel::QDeclarativeVisualItemModel(QObject *parent)
+ : QDeclarativeVisualModel(*(new QDeclarativeVisualItemModelPrivate), parent)
{
}
@@ -267,7 +269,8 @@ public:
}
if (m_roles.count() == 1)
m_roleNames.insert("modelData", m_roles.at(0));
- m_roleNames.insert("hasModelChildren", 0);
+ if (m_roles.count())
+ m_roleNames.insert("hasModelChildren", 0);
} else if (m_listAccessor) {
m_roleNames.insert("modelData", 0);
if (m_listAccessor->type() == QDeclarativeListAccessor::Instance) {
@@ -283,15 +286,19 @@ public:
}
}
+ QHash<int,int> roleToPropId;
void createMetaData() {
if (!m_metaDataCreated) {
ensureRoles();
- QHash<QByteArray, int>::const_iterator it = m_roleNames.begin();
- while (it != m_roleNames.end()) {
- m_delegateDataType->createProperty(it.key());
- ++it;
+ if (m_roleNames.count()) {
+ QHash<QByteArray, int>::const_iterator it = m_roleNames.begin();
+ while (it != m_roleNames.end()) {
+ int propId = m_delegateDataType->createProperty(it.key()) - m_delegateDataType->propertyOffset();
+ roleToPropId.insert(*it, propId);
+ ++it;
+ }
+ m_metaDataCreated = true;
}
- m_metaDataCreated = true;
}
}
@@ -381,7 +388,6 @@ public:
private:
friend class QDeclarativeVisualDataModelData;
- QHash<int,int> roleToProp;
};
class QDeclarativeVisualDataModelData : public QObject
@@ -398,6 +404,8 @@ public:
int propForRole(int) const;
void setValue(int, const QVariant &);
+ void ensureProperties();
+
Q_SIGNALS:
void indexChanged();
@@ -410,9 +418,11 @@ private:
int QDeclarativeVisualDataModelData::propForRole(int id) const
{
- QHash<int,int>::const_iterator it = m_meta->roleToProp.find(id);
- if (it != m_meta->roleToProp.end())
- return m_meta->roleToProp[id];
+ QDeclarativeVisualDataModelPrivate *model = QDeclarativeVisualDataModelPrivate::get(m_model);
+ QHash<int,int>::const_iterator it = model->roleToPropId.find(id);
+ if (it != model->roleToPropId.end())
+ return *it;
+
return -1;
}
@@ -436,8 +446,7 @@ int QDeclarativeVisualDataModelDataMetaObject::createProperty(const char *name,
if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) {
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))
+ if (qstrcmp(name,"modelData") == 0)
return QDeclarativeOpenMetaObject::createProperty(name, type);
}
}
@@ -469,12 +478,10 @@ QVariant QDeclarativeVisualDataModelDataMetaObject::initialValue(int propId)
model->ensureRoles();
QHash<QByteArray,int>::const_iterator it = model->m_roleNames.find(propName);
if (it != model->m_roleNames.end()) {
- roleToProp.insert(*it, propId);
QVariant value = model->m_listModelInterface->data(data->m_index, *it);
return value;
} else if (model->m_roles.count() == 1 && propName == "modelData") {
//for compatability with other lists, assign modelData if there is only a single role
- roleToProp.insert(model->m_roles.first(), propId);
QVariant value = model->m_listModelInterface->data(data->m_index, model->m_roles.first());
return value;
}
@@ -486,7 +493,6 @@ QVariant QDeclarativeVisualDataModelDataMetaObject::initialValue(int propId)
} else {
QHash<QByteArray,int>::const_iterator it = model->m_roleNames.find(propName);
if (it != model->m_roleNames.end()) {
- roleToProp.insert(*it, propId);
QModelIndex index = model->m_abstractItemModel->index(data->m_index, 0, model->m_root);
return model->m_abstractItemModel->data(index, *it);
}
@@ -501,18 +507,23 @@ QDeclarativeVisualDataModelData::QDeclarativeVisualDataModelData(int index,
: m_index(index), m_model(model),
m_meta(new QDeclarativeVisualDataModelDataMetaObject(this, QDeclarativeVisualDataModelPrivate::get(model)->m_delegateDataType))
{
- QDeclarativeVisualDataModelPrivate *modelPriv = QDeclarativeVisualDataModelPrivate::get(model);
- if (modelPriv->m_metaDataCacheable) {
- if (!modelPriv->m_metaDataCreated)
- modelPriv->createMetaData();
- m_meta->setCached(true);
- }
+ ensureProperties();
}
QDeclarativeVisualDataModelData::~QDeclarativeVisualDataModelData()
{
}
+void QDeclarativeVisualDataModelData::ensureProperties()
+{
+ QDeclarativeVisualDataModelPrivate *modelPriv = QDeclarativeVisualDataModelPrivate::get(m_model);
+ if (modelPriv->m_metaDataCacheable && !modelPriv->m_metaDataCreated) {
+ modelPriv->createMetaData();
+ if (modelPriv->m_metaDataCreated)
+ m_meta->setCached(true);
+ }
+}
+
int QDeclarativeVisualDataModelData::index() const
{
return m_index;
@@ -625,8 +636,8 @@ QDeclarativeVisualDataModel::QDeclarativeVisualDataModel()
{
}
-QDeclarativeVisualDataModel::QDeclarativeVisualDataModel(QDeclarativeContext *ctxt)
-: QDeclarativeVisualModel(*(new QDeclarativeVisualDataModelPrivate(ctxt)))
+QDeclarativeVisualDataModel::QDeclarativeVisualDataModel(QDeclarativeContext *ctxt, QObject *parent)
+: QDeclarativeVisualModel(*(new QDeclarativeVisualDataModelPrivate(ctxt)), parent)
{
}
@@ -759,7 +770,7 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model)
}
/*!
- \qmlproperty component VisualDataModel::delegate
+ \qmlproperty Component VisualDataModel::delegate
The delegate provides a template defining each item instantiated by a view.
The index is exposed as an accessible \c index property. Properties of the
@@ -963,13 +974,18 @@ QDeclarativeVisualDataModel::ReleaseFlags QDeclarativeVisualDataModel::release(Q
}
if (d->m_cache.releaseItem(obj)) {
+ // Remove any bindings to avoid warnings due to parent change.
+ QObjectPrivate *p = QObjectPrivate::get(obj);
+ Q_ASSERT(p->declarativeData);
+ QDeclarativeData *d = static_cast<QDeclarativeData*>(p->declarativeData);
+ if (d->ownContext && d->context)
+ d->context->clearExpressions();
+
if (inPackage) {
emit destroyingPackage(qobject_cast<QDeclarativePackage*>(obj));
} else {
- if (item->hasFocus())
- item->clearFocus();
- item->setOpacity(0.0);
- static_cast<QGraphicsItem*>(item)->setParentItem(0);
+ if (item->scene())
+ item->scene()->removeItem(item);
}
stat |= Destroyed;
obj->deleteLater();
@@ -1030,6 +1046,11 @@ QDeclarativeItem *QDeclarativeVisualDataModel::item(int index, const QByteArray
if (!ccontext) ccontext = qmlContext(this);
QDeclarativeContext *ctxt = new QDeclarativeContext(ccontext);
QDeclarativeVisualDataModelData *data = new QDeclarativeVisualDataModelData(index, this);
+ if ((!d->m_listModelInterface || !d->m_abstractItemModel) && d->m_listAccessor
+ && d->m_listAccessor->type() == QDeclarativeListAccessor::ListProperty) {
+ ctxt->setContextObject(d->m_listAccessor->at(index).value<QObject*>());
+ ctxt = new QDeclarativeContext(ctxt, ctxt);
+ }
ctxt->setContextProperty(QLatin1String("model"), data);
ctxt->setContextObject(data);
d->m_completePending = false;
@@ -1201,6 +1222,13 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count,
QModelIndex index = d->m_abstractItemModel->index(idx, 0, d->m_root);
data->setValue(propId, d->m_abstractItemModel->data(index, role));
}
+ } else {
+ QString roleName;
+ if (d->m_listModelInterface)
+ roleName = d->m_listModelInterface->toString(role);
+ else if (d->m_abstractItemModel)
+ roleName = d->m_abstractItemModel->roleNames().value(role);
+ qmlInfo(this) << "Changing role not present in item: " << roleName;
}
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h
index edfd387d50..0bdbbcf142 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h
@@ -72,7 +72,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeVisualModel : public QObject
Q_PROPERTY(int count READ count NOTIFY countChanged)
public:
- QDeclarativeVisualModel() {}
+ QDeclarativeVisualModel(QObject *parent=0) : QObject(parent) {}
virtual ~QDeclarativeVisualModel() {}
enum ReleaseFlag { Referenced = 0x01, Destroyed = 0x02 };
@@ -117,7 +117,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeVisualItemModel : public QDeclarativeVisu
Q_CLASSINFO("DefaultProperty", "children")
public:
- QDeclarativeVisualItemModel();
+ QDeclarativeVisualItemModel(QObject *parent=0);
virtual ~QDeclarativeVisualItemModel() {}
virtual int count() const;
@@ -156,7 +156,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeVisualDataModel : public QDeclarativeVisu
Q_CLASSINFO("DefaultProperty", "delegate")
public:
QDeclarativeVisualDataModel();
- QDeclarativeVisualDataModel(QDeclarativeContext *);
+ QDeclarativeVisualDataModel(QDeclarativeContext *, QObject *parent=0);
virtual ~QDeclarativeVisualDataModel();
QVariant model() const;
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp
index d44e7fbb09..2e905b90cb 100644
--- a/src/declarative/qml/qdeclarativebinding.cpp
+++ b/src/declarative/qml/qdeclarativebinding.cpp
@@ -193,7 +193,18 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags)
data->error.setColumn(-1);
data->error.setDescription(QLatin1String("Unable to assign [undefined] to ") + QLatin1String(QMetaType::typeName(data->property.propertyType())));
- } else if (data->property.object() &&
+ } else if (!scriptValue.isRegExp() && scriptValue.isFunction()) {
+
+ QUrl url = QUrl(data->url);
+ int line = data->line;
+ if (url.isEmpty()) url = QUrl(QLatin1String("<Unknown File>"));
+
+ data->error.setUrl(url);
+ data->error.setLine(line);
+ data->error.setColumn(-1);
+ data->error.setDescription(QLatin1String("Unable to assign a function to a property."));
+
+ } else if (data->property.object() &&
!QDeclarativePropertyPrivate::write(data->property, value, flags)) {
QUrl url = QUrl(data->url);
@@ -275,13 +286,15 @@ QDeclarativeAbstractBinding::QDeclarativeAbstractBinding()
QDeclarativeAbstractBinding::~QDeclarativeAbstractBinding()
{
- removeFromObject();
- if (m_mePtr)
- *m_mePtr = 0;
+ Q_ASSERT(m_prevBinding == 0);
+ Q_ASSERT(m_mePtr == 0);
}
void QDeclarativeAbstractBinding::destroy()
{
+ removeFromObject();
+ clear();
+
delete this;
}
diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h
index 2d3acf5cd4..598f09faa7 100644
--- a/src/declarative/qml/qdeclarativebinding_p.h
+++ b/src/declarative/qml/qdeclarativebinding_p.h
@@ -164,6 +164,6 @@ private:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QDeclarativeBinding*);
+Q_DECLARE_METATYPE(QDeclarativeBinding*)
#endif // QDECLARATIVEBINDING_P_H
diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp
index 6596aba972..f55d330387 100644
--- a/src/declarative/qml/qdeclarativecompiledbindings.cpp
+++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp
@@ -572,7 +572,7 @@ struct QDeclarativeBindingCompilerPrivate
QDeclarativeParser::Object *component;
QDeclarativeParser::Property *destination;
QHash<QString, QDeclarativeParser::Object *> ids;
- QDeclarativeEnginePrivate::Imports imports;
+ QDeclarativeImports imports;
QDeclarativeEnginePrivate *engine;
QString contextName() const { return QLatin1String("$$$SCOPE_") + QString::number((intptr_t)context, 16); }
@@ -1624,6 +1624,8 @@ bool QDeclarativeBindingCompilerPrivate::compile(QDeclarativeJS::AST::Node *node
return false;
int convertReg = acquireReg();
+ if (convertReg == -1)
+ return false;
if (destination->type == QMetaType::QReal) {
Instr convert;
@@ -1795,8 +1797,8 @@ bool QDeclarativeBindingCompilerPrivate::parseName(AST::Node *node, Result &type
if (nameParts.at(ii + 1).at(0).isUpper())
return false;
- QDeclarativeEnginePrivate::ImportedNamespace *ns = 0;
- if (!engine->resolveType(imports, name.toUtf8(), &attachType, 0, 0, 0, &ns))
+ QDeclarativeImportedNamespace *ns = 0;
+ if (!engine->importDatabase.resolveType(imports, name.toUtf8(), &attachType, 0, 0, 0, &ns))
return false;
if (ns || !attachType || !attachType->attachedPropertiesType())
return false;
@@ -2011,6 +2013,8 @@ bool QDeclarativeBindingCompilerPrivate::parseArith(QDeclarativeJS::AST::Node *n
AST::BinaryExpression *expression = static_cast<AST::BinaryExpression *>(node);
type.reg = acquireReg();
+ if (type.reg == -1)
+ return false;
Result lhs;
Result rhs;
@@ -2062,6 +2066,8 @@ bool QDeclarativeBindingCompilerPrivate::numberArith(Result &type, const Result
return false;
lhsTmp = acquireReg();
+ if (lhsTmp == -1)
+ return false;
Instr conv;
conv.common.type = Instr::ConvertGenericToReal;
@@ -2075,6 +2081,8 @@ bool QDeclarativeBindingCompilerPrivate::numberArith(Result &type, const Result
return false;
rhsTmp = acquireReg();
+ if (rhsTmp == -1)
+ return false;
Instr conv;
conv.common.type = Instr::ConvertGenericToReal;
@@ -2123,6 +2131,8 @@ bool QDeclarativeBindingCompilerPrivate::stringArith(Result &type, const Result
return false;
lhsTmp = acquireReg(Instr::CleanupString);
+ if (lhsTmp == -1)
+ return false;
Instr convert;
convert.common.type = Instr::ConvertGenericToString;
@@ -2136,6 +2146,8 @@ bool QDeclarativeBindingCompilerPrivate::stringArith(Result &type, const Result
return false;
rhsTmp = acquireReg(Instr::CleanupString);
+ if (rhsTmp == -1)
+ return false;
Instr convert;
convert.common.type = Instr::ConvertGenericToString;
@@ -2145,6 +2157,9 @@ bool QDeclarativeBindingCompilerPrivate::stringArith(Result &type, const Result
}
type.reg = acquireReg(Instr::CleanupString);
+ if (type.reg == -1)
+ return false;
+
type.type = QMetaType::QString;
Instr add;
@@ -2185,6 +2200,9 @@ bool QDeclarativeBindingCompilerPrivate::parseLogic(QDeclarativeJS::AST::Node *n
if (!parseExpression(expression->right, rhs)) return false;
type.reg = acquireReg();
+ if (type.reg == -1)
+ return false;
+
type.metaObject = 0;
type.type = QVariant::Bool;
@@ -2310,6 +2328,8 @@ bool QDeclarativeBindingCompilerPrivate::parseConstant(QDeclarativeJS::AST::Node
type.metaObject = 0;
type.type = -1;
type.reg = acquireReg();
+ if (type.reg == -1)
+ return false;
if (node->kind == AST::Node::Kind_TrueLiteral) {
type.type = QVariant::Bool;
@@ -2398,6 +2418,9 @@ bool QDeclarativeBindingCompilerPrivate::parseMethod(QDeclarativeJS::AST::Node *
releaseReg(r1.reg);
op.binaryop.output = acquireReg();
+ if (op.binaryop.output == -1)
+ return false;
+
op.binaryop.src1 = r0.reg;
op.binaryop.src2 = r1.reg;
bytecode << op;
@@ -2473,6 +2496,8 @@ bool QDeclarativeBindingCompilerPrivate::fetch(Result &rv, const QMetaObject *mo
if (rv.type == QMetaType::QString) {
int tmp = acquireReg();
+ if (tmp == -1)
+ return false;
Instr copy;
copy.common.type = Instr::Copy;
copy.copy.reg = tmp;
@@ -2549,6 +2574,8 @@ int QDeclarativeBindingCompilerPrivate::registerLiteralString(const QString &str
data += strdata;
int reg = acquireReg(Instr::CleanupString);
+ if (reg == -1)
+ return false;
Instr string;
string.common.type = Instr::String;
diff --git a/src/declarative/qml/qdeclarativecompiledbindings_p.h b/src/declarative/qml/qdeclarativecompiledbindings_p.h
index a17bc842a3..a9772ccadd 100644
--- a/src/declarative/qml/qdeclarativecompiledbindings_p.h
+++ b/src/declarative/qml/qdeclarativecompiledbindings_p.h
@@ -77,7 +77,7 @@ public:
QDeclarativeParser::Property *property;
QDeclarativeParser::Variant expression;
QHash<QString, QDeclarativeParser::Object *> ids;
- QDeclarativeEnginePrivate::Imports imports;
+ QDeclarativeImports imports;
};
// -1 on failure, otherwise the binding index to use
@@ -104,8 +104,8 @@ protected:
int qt_metacall(QMetaObject::Call, int, void **);
private:
- Q_DISABLE_COPY(QDeclarativeCompiledBindings);
- Q_DECLARE_PRIVATE(QDeclarativeCompiledBindings);
+ Q_DISABLE_COPY(QDeclarativeCompiledBindings)
+ Q_DECLARE_PRIVATE(QDeclarativeCompiledBindings)
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index 1727687c51..a43b9ac296 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -352,6 +352,10 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop,
instr.storeDouble.propertyIndex = prop.propertyIndex();
instr.storeDouble.value = n;
}
+ } else if(v->value.isBoolean()) {
+ instr.type = QDeclarativeInstruction::StoreVariantBool;
+ instr.storeBool.propertyIndex = prop.propertyIndex();
+ instr.storeBool.value = v->value.asBoolean();
} else {
instr.type = QDeclarativeInstruction::StoreVariant;
instr.storeString.propertyIndex = prop.propertyIndex();
@@ -607,6 +611,7 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine,
Q_ASSERT(root);
this->engine = engine;
+ this->enginePrivate = QDeclarativeEnginePrivate::get(engine);
this->unit = unit;
this->unitRoot = root;
compileTree(root);
@@ -624,6 +629,7 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine,
savedCompileStates.clear();
output = 0;
this->engine = 0;
+ this->enginePrivate = 0;
this->unit = 0;
this->unitRoot = 0;
@@ -688,14 +694,12 @@ void QDeclarativeCompiler::compileTree(Object *tree)
def.type = QDeclarativeInstruction::SetDefault;
output->bytecode << def;
- output->imports = unit->imports;
-
output->importCache = new QDeclarativeTypeNameCache(engine);
for (int ii = 0; ii < importedScriptIndexes.count(); ++ii)
output->importCache->add(importedScriptIndexes.at(ii), ii);
- output->imports.cache(output->importCache, engine);
+ unit->imports.cache(output->importCache, engine);
Q_ASSERT(tree->metatype);
@@ -706,7 +710,7 @@ void QDeclarativeCompiler::compileTree(Object *tree)
output->root = &output->rootData;
}
if (!tree->metadata.isEmpty())
- QDeclarativeEnginePrivate::get(engine)->registerCompositeType(output);
+ enginePrivate->registerCompositeType(output);
}
static bool ValuePtrLessThan(const Value *t1, const Value *t2)
@@ -938,19 +942,28 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj)
meta.storeMeta.propertyCache = output->propertyCaches.count();
// ### Surely the creation of this property cache could be more efficient
QDeclarativePropertyCache *propertyCache = 0;
- if (tr.component && QDeclarativeComponentPrivate::get(tr.component)->cc->rootPropertyCache) {
+ if (tr.component)
propertyCache = QDeclarativeComponentPrivate::get(tr.component)->cc->rootPropertyCache->copy();
- } else {
- propertyCache = QDeclarativePropertyCache::create(engine, obj->metaObject()->superClass());
- }
+ else
+ propertyCache = enginePrivate->cache(obj->metaObject()->superClass())->copy();
+
propertyCache->append(engine, obj->metaObject(), QDeclarativePropertyCache::Data::NoFlags,
QDeclarativePropertyCache::Data::IsVMEFunction);
+
if (obj == unitRoot) {
propertyCache->addref();
output->rootPropertyCache = propertyCache;
}
+
output->propertyCaches << propertyCache;
output->bytecode << meta;
+ } else if (obj == unitRoot) {
+ if (tr.component)
+ output->rootPropertyCache = QDeclarativeComponentPrivate::get(tr.component)->cc->rootPropertyCache;
+ else
+ output->rootPropertyCache = enginePrivate->cache(obj->metaObject());
+
+ output->rootPropertyCache->addref();
}
// Set the object id
@@ -1359,9 +1372,9 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop,
}
QDeclarativeType *type = 0;
- QDeclarativeEnginePrivate::ImportedNamespace *typeNamespace = 0;
- QDeclarativeEnginePrivate::get(engine)->resolveType(unit->imports, prop->name,
- &type, 0, 0, 0, &typeNamespace);
+ QDeclarativeImportedNamespace *typeNamespace = 0;
+ enginePrivate->importDatabase.resolveType(unit->imports, prop->name,
+ &type, 0, 0, 0, &typeNamespace);
if (typeNamespace) {
// ### We might need to indicate that this property is a namespace
@@ -1436,7 +1449,7 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop,
COMPILE_CHECK(buildGroupedProperty(prop, obj, ctxt));
- } else if (QDeclarativeEnginePrivate::get(engine)->isList(prop->type)) {
+ } else if (enginePrivate->isList(prop->type)) {
COMPILE_CHECK(buildListProperty(prop, obj, ctxt));
@@ -1453,11 +1466,10 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop,
return true;
}
-bool
-QDeclarativeCompiler::buildPropertyInNamespace(QDeclarativeEnginePrivate::ImportedNamespace *ns,
- QDeclarativeParser::Property *nsProp,
- QDeclarativeParser::Object *obj,
- const BindingContext &ctxt)
+bool QDeclarativeCompiler::buildPropertyInNamespace(QDeclarativeImportedNamespace *ns,
+ QDeclarativeParser::Property *nsProp,
+ QDeclarativeParser::Object *obj,
+ const BindingContext &ctxt)
{
if (!nsProp->value)
COMPILE_EXCEPTION(nsProp, tr("Invalid use of namespace"));
@@ -1470,8 +1482,7 @@ QDeclarativeCompiler::buildPropertyInNamespace(QDeclarativeEnginePrivate::Import
// Setup attached property data
QDeclarativeType *type = 0;
- QDeclarativeEnginePrivate::get(engine)->resolveTypeInNamespace(ns, prop->name,
- &type, 0, 0, 0);
+ enginePrivate->importDatabase.resolveTypeInNamespace(ns, prop->name, &type, 0, 0, 0);
if (!type || !type->attachedPropertiesType())
COMPILE_EXCEPTION(prop, tr("Non-existent attached object"));
@@ -1492,7 +1503,7 @@ QDeclarativeCompiler::buildPropertyInNamespace(QDeclarativeEnginePrivate::Import
void QDeclarativeCompiler::genValueProperty(QDeclarativeParser::Property *prop,
QDeclarativeParser::Object *obj)
{
- if (QDeclarativeEnginePrivate::get(engine)->isList(prop->type)) {
+ if (enginePrivate->isList(prop->type)) {
genListProperty(prop, obj);
} else {
genPropertyAssignment(prop, obj);
@@ -1502,7 +1513,7 @@ void QDeclarativeCompiler::genValueProperty(QDeclarativeParser::Property *prop,
void QDeclarativeCompiler::genListProperty(QDeclarativeParser::Property *prop,
QDeclarativeParser::Object *obj)
{
- int listType = QDeclarativeEnginePrivate::get(engine)->listType(prop->type);
+ int listType = enginePrivate->listType(prop->type);
QDeclarativeInstruction fetch;
fetch.type = QDeclarativeInstruction::FetchQList;
@@ -1756,8 +1767,7 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr
} else {
// Load the nested property's meta type
- prop->value->metatype =
- QDeclarativeEnginePrivate::get(engine)->metaObjectForType(prop->type);
+ prop->value->metatype = enginePrivate->metaObjectForType(prop->type);
if (!prop->value->metatype)
COMPILE_EXCEPTION(prop, tr("Invalid grouped property access"));
@@ -1836,13 +1846,13 @@ bool QDeclarativeCompiler::buildListProperty(QDeclarativeParser::Property *prop,
QDeclarativeParser::Object *obj,
const BindingContext &ctxt)
{
- Q_ASSERT(QDeclarativeEnginePrivate::get(engine)->isList(prop->type));
+ Q_ASSERT(enginePrivate->isList(prop->type));
int t = prop->type;
obj->addValueProperty(prop);
- int listType = QDeclarativeEnginePrivate::get(engine)->listType(t);
+ int listType = enginePrivate->listType(t);
bool listTypeIsInterface = QDeclarativeMetaType::isInterface(listType);
bool assignedBinding = false;
@@ -1957,8 +1967,7 @@ bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeParser::Pro
// We want to raw metaObject here as the raw metaobject is the
// actual property type before we applied any extensions that might
// effect the properties on the type, but don't effect assignability
- const QMetaObject *propertyMetaObject =
- QDeclarativeEnginePrivate::get(engine)->rawMetaObjectForType(prop->type);
+ const QMetaObject *propertyMetaObject = enginePrivate->rawMetaObjectForType(prop->type);
// Will be true if the assgned type inherits propertyMetaObject
bool isAssignable = false;
@@ -2100,8 +2109,8 @@ bool QDeclarativeCompiler::testQualifiedEnumAssignment(const QMetaProperty &prop
QString typeName = parts.at(0);
QDeclarativeType *type = 0;
- QDeclarativeEnginePrivate::get(engine)->resolveType(unit->imports, typeName.toUtf8(),
- &type, 0, 0, 0, 0);
+ enginePrivate->importDatabase.resolveType(unit->imports, typeName.toUtf8(),
+ &type, 0, 0, 0, 0);
if (!type || obj->typeName != type->qmlTypeName())
return true;
@@ -2128,7 +2137,7 @@ int QDeclarativeCompiler::evaluateEnum(const QByteArray& script) const
int dot = script.indexOf('.');
if (dot > 0) {
QDeclarativeType *type = 0;
- QDeclarativeEnginePrivate::get(engine)->resolveType(unit->imports, script.left(dot), &type, 0, 0, 0, 0);
+ enginePrivate->importDatabase.resolveType(unit->imports, script.left(dot), &type, 0, 0, 0, 0);
if (!type)
return -1;
const QMetaObject *mo = type->metaObject();
@@ -2282,13 +2291,12 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn
QByteArray customTypeName;
QDeclarativeType *qmltype = 0;
QUrl url;
- QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(engine);
- if (!priv->resolveType(unit->imports, p.customType, &qmltype,
- &url, 0, 0, 0))
+ if (!enginePrivate->importDatabase.resolveType(unit->imports, p.customType, &qmltype,
+ &url, 0, 0, 0))
COMPILE_EXCEPTION(&p, tr("Invalid property type"));
if (!qmltype) {
- QDeclarativeCompositeTypeData *tdata = priv->typeManager.get(url);
+ QDeclarativeCompositeTypeData *tdata = enginePrivate->typeManager.get(url);
Q_ASSERT(tdata);
Q_ASSERT(tdata->status == QDeclarativeCompositeTypeData::Complete);
@@ -2460,7 +2468,7 @@ bool QDeclarativeCompiler::checkValidId(QDeclarativeParser::Value *v, const QStr
}
- if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(val))
+ if (enginePrivate->globalClass->illegalNames().contains(val))
COMPILE_EXCEPTION(v, tr( "ID illegally masks global JavaScript property"));
return true;
@@ -2653,8 +2661,8 @@ int QDeclarativeCompiler::genValueTypeData(QDeclarativeParser::Property *valueTy
{
QByteArray data =
QDeclarativePropertyPrivate::saveValueType(prop->parent->metaObject(), prop->index,
- QDeclarativeEnginePrivate::get(engine)->valueTypes[prop->type]->metaObject(),
- valueTypeProp->index);
+ enginePrivate->valueTypes[prop->type]->metaObject(),
+ valueTypeProp->index);
// valueTypeProp->index, valueTypeProp->type);
return output->indexForByteArray(data);
@@ -2690,7 +2698,7 @@ bool QDeclarativeCompiler::completeComponentBuild()
expr.expression = binding.expression;
expr.imports = unit->imports;
- int index = bindingCompiler.compile(expr, QDeclarativeEnginePrivate::get(engine));
+ int index = bindingCompiler.compile(expr, enginePrivate);
if (index != -1) {
binding.dataType = BindingReference::Experimental;
binding.compiledIndex = index;
@@ -2798,7 +2806,7 @@ void QDeclarativeCompiler::dumpStats()
bool QDeclarativeCompiler::canCoerce(int to, QDeclarativeParser::Object *from)
{
const QMetaObject *toMo =
- QDeclarativeEnginePrivate::get(engine)->rawMetaObjectForType(to);
+ enginePrivate->rawMetaObjectForType(to);
const QMetaObject *fromMo = from->metaObject();
while (fromMo) {
diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h
index fefab7a42b..908c70398e 100644
--- a/src/declarative/qml/qdeclarativecompiler_p.h
+++ b/src/declarative/qml/qdeclarativecompiler_p.h
@@ -84,7 +84,6 @@ public:
QString name;
QUrl url;
- QDeclarativeEnginePrivate::Imports imports;
QDeclarativeTypeNameCache *importCache;
struct TypeReference
@@ -192,7 +191,7 @@ private:
const BindingContext &);
bool buildProperty(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj,
const BindingContext &);
- bool buildPropertyInNamespace(QDeclarativeEnginePrivate::ImportedNamespace *ns,
+ bool buildPropertyInNamespace(QDeclarativeImportedNamespace *ns,
QDeclarativeParser::Property *prop,
QDeclarativeParser::Object *obj,
const BindingContext &);
@@ -336,6 +335,7 @@ private:
QList<QDeclarativeError> exceptions;
QDeclarativeCompiledData *output;
QDeclarativeEngine *engine;
+ QDeclarativeEnginePrivate *enginePrivate;
QDeclarativeParser::Object *unitRoot;
QDeclarativeCompositeTypeData *unit;
};
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index d8bbb70e8c..e757675bff 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -59,11 +59,11 @@
#include <QFileInfo>
#include <QtCore/qdebug.h>
#include <QApplication>
+#include <QGraphicsObject>
QT_BEGIN_NAMESPACE
class QByteArray;
-int statusId = qRegisterMetaType<QDeclarativeComponent::Status>("QDeclarativeComponent::Status");
/*!
\class QDeclarativeComponent
@@ -242,10 +242,10 @@ QDeclarativeComponent::~QDeclarativeComponent()
\qmlproperty enumeration Component::status
This property holds the status of component loading. It can be one of:
\list
- \o Null - no data is available for the component
- \o Ready - the component has been loaded, and can be used to create instances.
- \o Loading - the component is currently being loaded
- \o Error - an error occurred while loading the component.
+ \o Component.Null - no data is available for the component
+ \o Component.Ready - the component has been loaded, and can be used to create instances.
+ \o Component.Loading - the component is currently being loaded
+ \o Component.Error - an error occurred while loading the component.
Calling errorsString() will provide a human-readable description of any errors.
\endlist
*/
@@ -269,19 +269,7 @@ QDeclarativeComponent::Status QDeclarativeComponent::status() const
}
/*!
- \qmlproperty bool Component::isNull
-
- Is true if the component is in the Null state, false otherwise.
-
- Equivalent to status == Component.Null.
-*/
-
-/*!
- \property QDeclarativeComponent::isNull
-
- Is true if the component is in the Null state, false otherwise.
-
- Equivalent to status() == QDeclarativeComponent::Null.
+ Returns true if status() == QDeclarativeComponent::Null.
*/
bool QDeclarativeComponent::isNull() const
{
@@ -289,19 +277,7 @@ bool QDeclarativeComponent::isNull() const
}
/*!
- \qmlproperty bool Component::isReady
-
- Is true if the component is in the Ready state, false otherwise.
-
- Equivalent to status == Component.Ready.
-*/
-
-/*!
- \property QDeclarativeComponent::isReady
-
- Is true if the component is in the Ready state, false otherwise.
-
- Equivalent to status() == QDeclarativeComponent::Ready.
+ Returns true if status() == QDeclarativeComponent::Ready.
*/
bool QDeclarativeComponent::isReady() const
{
@@ -309,21 +285,7 @@ bool QDeclarativeComponent::isReady() const
}
/*!
- \qmlproperty bool Component::isError
-
- Is true if the component is in the Error state, false otherwise.
-
- Equivalent to status == Component.Error.
-
- Calling errorsString() will provide a human-readable description of any errors.
-*/
-
-/*!
- \property QDeclarativeComponent::isError
-
- Is true if the component is in the Error state, false otherwise.
-
- Equivalent to status() == QDeclarativeComponent::Error.
+ Returns true if status() == QDeclarativeComponent::Error.
*/
bool QDeclarativeComponent::isError() const
{
@@ -331,19 +293,7 @@ bool QDeclarativeComponent::isError() const
}
/*!
- \qmlproperty bool Component::isLoading
-
- Is true if the component is in the Loading state, false otherwise.
-
- Equivalent to status == Component::Loading.
-*/
-
-/*!
- \property QDeclarativeComponent::isLoading
-
- Is true if the component is in the Loading state, false otherwise.
-
- Equivalent to status() == QDeclarativeComponent::Loading.
+ Returns true if status() == QDeclarativeComponent::Loading.
*/
bool QDeclarativeComponent::isLoading() const
{
@@ -421,7 +371,7 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, const Q
{
Q_D(QDeclarativeComponent);
d->engine = engine;
- loadUrl(QUrl::fromLocalFile(fileName));
+ loadUrl(d->engine->baseUrl().resolved(QUrl::fromLocalFile(fileName)));
}
/*!
@@ -595,17 +545,24 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q
}
/*!
- \qmlmethod object Component::createObject()
+ \qmlmethod object Component::createObject(parent)
Returns an object instance from this component, or null if object creation fails.
- The object will be created in the same context as the component was created in.
+ The object will be created in the same context as the one in which the component
+ was created.
+
+ Note that if the returned object is to be displayed, its \c parent must be set to
+ an existing item in a scene, or else the object will not be visible.
*/
/*!
\internal
A version of create which returns a scriptObject, for use in script
+
+ Sets graphics object parent because forgetting to do this is a frequent
+ and serious problem.
*/
-QScriptValue QDeclarativeComponent::createObject()
+QScriptValue QDeclarativeComponent::createObject(QObject* parent)
{
Q_D(QDeclarativeComponent);
QDeclarativeContext* ctxt = creationContext();
@@ -614,6 +571,20 @@ QScriptValue QDeclarativeComponent::createObject()
QObject* ret = create(ctxt);
if (!ret)
return QScriptValue(QScriptValue::NullValue);
+
+ QGraphicsObject* gobj = qobject_cast<QGraphicsObject*>(ret);
+ bool needParent = (gobj != 0);
+ if(parent){
+ ret->setParent(parent);
+ QGraphicsObject* gparent = qobject_cast<QGraphicsObject*>(parent);
+ if(gparent){
+ gobj->setParentItem(gparent);
+ needParent = false;
+ }
+ }
+ if(needParent)
+ qWarning("QDeclarativeComponent: Created graphical object was not placed in the graphics scene.");
+
QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(d->engine);
QDeclarativeData::get(ret, true)->setImplicitDestructible();
return priv->objectClass->newQObject(ret, QMetaType::QObjectStar);
@@ -754,6 +725,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *ctxt, QDe
state->bindValues = enginePriv->bindValues;
state->parserStatus = enginePriv->parserStatus;
+ state->finalizedParserStatus = enginePriv->finalizedParserStatus;
state->componentAttached = enginePriv->componentAttached;
if (state->componentAttached)
state->componentAttached->prev = &state->componentAttached;
@@ -761,6 +733,7 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *ctxt, QDe
enginePriv->componentAttached = 0;
enginePriv->bindValues.clear();
enginePriv->parserStatus.clear();
+ enginePriv->finalizedParserStatus.clear();
state->completePending = true;
enginePriv->inProgressCreations++;
}
@@ -785,6 +758,7 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi
state->bindValues = enginePriv->bindValues;
state->parserStatus = enginePriv->parserStatus;
+ state->finalizedParserStatus = enginePriv->finalizedParserStatus;
state->componentAttached = enginePriv->componentAttached;
if (state->componentAttached)
state->componentAttached->prev = &state->componentAttached;
@@ -792,6 +766,7 @@ void QDeclarativeComponentPrivate::beginDeferred(QDeclarativeEnginePrivate *engi
enginePriv->componentAttached = 0;
enginePriv->bindValues.clear();
enginePriv->parserStatus.clear();
+ enginePriv->finalizedParserStatus.clear();
state->completePending = true;
enginePriv->inProgressCreations++;
}
@@ -826,6 +801,16 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri
QDeclarativeEnginePrivate::clear(ps);
}
+ for (int ii = 0; ii < state->finalizedParserStatus.count(); ++ii) {
+ QPair<QDeclarativeGuard<QObject>, int> status = state->finalizedParserStatus.at(ii);
+ QObject *obj = status.first;
+ if (obj) {
+ void *args[] = { 0 };
+ QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod,
+ status.second, args);
+ }
+ }
+
while (state->componentAttached) {
QDeclarativeComponentAttached *a = state->componentAttached;
a->rem();
@@ -838,6 +823,7 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri
state->bindValues.clear();
state->parserStatus.clear();
+ state->finalizedParserStatus.clear();
state->completePending = false;
enginePriv->inProgressCreations--;
diff --git a/src/declarative/qml/qdeclarativecomponent.h b/src/declarative/qml/qdeclarativecomponent.h
index f3cfe3c306..688e233996 100644
--- a/src/declarative/qml/qdeclarativecomponent.h
+++ b/src/declarative/qml/qdeclarativecomponent.h
@@ -64,10 +64,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeComponent : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QDeclarativeComponent)
- Q_PROPERTY(bool isNull READ isNull NOTIFY statusChanged)
- Q_PROPERTY(bool isReady READ isReady NOTIFY statusChanged)
- Q_PROPERTY(bool isError READ isError NOTIFY statusChanged)
- Q_PROPERTY(bool isLoading READ isLoading NOTIFY statusChanged)
+
Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
Q_PROPERTY(QUrl url READ url CONSTANT)
@@ -112,7 +109,7 @@ Q_SIGNALS:
protected:
QDeclarativeComponent(QDeclarativeComponentPrivate &dd, QObject* parent);
- Q_INVOKABLE QScriptValue createObject();
+ Q_INVOKABLE QScriptValue createObject(QObject* parent);
private:
QDeclarativeComponent(QDeclarativeEngine *, QDeclarativeCompiledData *, int, int, QObject *parent);
diff --git a/src/declarative/qml/qdeclarativecomponent_p.h b/src/declarative/qml/qdeclarativecomponent_p.h
index 24e5386de9..2a7d633f0d 100644
--- a/src/declarative/qml/qdeclarativecomponent_p.h
+++ b/src/declarative/qml/qdeclarativecomponent_p.h
@@ -102,6 +102,7 @@ public:
ConstructionState() : componentAttached(0), completePending(false) {}
QList<QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> > bindValues;
QList<QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> > parserStatus;
+ QList<QPair<QDeclarativeGuard<QObject>, int> > finalizedParserStatus;
QDeclarativeComponentAttached *componentAttached;
QList<QDeclarativeError> errors;
bool completePending;
@@ -149,7 +150,7 @@ Q_SIGNALS:
void destruction();
private:
- friend class QDeclarativeContextData;;
+ friend class QDeclarativeContextData;
friend class QDeclarativeComponentPrivate;
};
diff --git a/src/declarative/qml/qdeclarativecompositetypedata_p.h b/src/declarative/qml/qdeclarativecompositetypedata_p.h
index 47cb3b3e8a..a0e4cc2865 100644
--- a/src/declarative/qml/qdeclarativecompositetypedata_p.h
+++ b/src/declarative/qml/qdeclarativecompositetypedata_p.h
@@ -83,7 +83,7 @@ public:
QList<QDeclarativeError> errors;
- QDeclarativeEnginePrivate::Imports imports;
+ QDeclarativeImports imports;
QList<QDeclarativeCompositeTypeData *> dependants;
diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp
index 0eb7e1be10..e4405f71ea 100644
--- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp
+++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp
@@ -338,7 +338,7 @@ void QDeclarativeCompositeTypeManager::resourceReplyFinished()
// WARNING, there is a copy of this function in qdeclarativeengine.cpp
static QString toLocalFileOrQrc(const QUrl& url)
{
- if (url.scheme() == QLatin1String("qrc")) {
+ if (url.scheme().compare(QLatin1String("qrc"), Qt::CaseInsensitive) == 0) {
if (url.authority().isEmpty())
return QLatin1Char(':') + url.path();
return QString();
@@ -360,7 +360,10 @@ void QDeclarativeCompositeTypeManager::loadResource(QDeclarativeCompositeTypeRes
} else {
resource->status = QDeclarativeCompositeTypeResource::Error;
}
+ } else if (url.scheme().isEmpty()) {
+ // We can't open this, so just declare as an error
+ resource->status = QDeclarativeCompositeTypeResource::Error;
} else {
QNetworkReply *reply =
@@ -382,27 +385,29 @@ void QDeclarativeCompositeTypeManager::loadSource(QDeclarativeCompositeTypeData
if (file.open(QFile::ReadOnly)) {
QByteArray data = file.readAll();
setData(unit, data, url);
- } else {
- QString errorDescription;
- // ### - Fill in error
- errorDescription = QLatin1String("File error for URL ") + url.toString();
- unit->status = QDeclarativeCompositeTypeData::Error;
- // ### FIXME
- QDeclarativeError error;
- error.setDescription(errorDescription);
- unit->errorType = QDeclarativeCompositeTypeData::AccessError;
- unit->errors << error;
- doComplete(unit);
+ return; // success
}
-
- } else {
+ } else if (!url.scheme().isEmpty()) {
QNetworkReply *reply =
engine->networkAccessManager()->get(QNetworkRequest(url));
QObject::connect(reply, SIGNAL(finished()),
this, SLOT(replyFinished()));
QObject::connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
this, SLOT(requestProgress(qint64,qint64)));
+ return; // waiting
}
+
+ // error happened
+ QString errorDescription;
+ // ### - Fill in error
+ errorDescription = QLatin1String("File error for URL ") + url.toString();
+ unit->status = QDeclarativeCompositeTypeData::Error;
+ // ### FIXME
+ QDeclarativeError error;
+ error.setDescription(errorDescription);
+ unit->errorType = QDeclarativeCompositeTypeData::AccessError;
+ unit->errors << error;
+ doComplete(unit);
}
void QDeclarativeCompositeTypeManager::requestProgress(qint64 received, qint64 total)
@@ -509,7 +514,9 @@ void QDeclarativeCompositeTypeManager::checkComplete(QDeclarativeCompositeTypeDa
unit->errors = u->errors;
doComplete(unit);
return;
- } else if (u->status == QDeclarativeCompositeTypeData::Waiting) {
+ } else if (u->status == QDeclarativeCompositeTypeData::Waiting
+ || u->status == QDeclarativeCompositeTypeData::WaitingResources)
+ {
waiting++;
}
}
@@ -525,16 +532,15 @@ void QDeclarativeCompositeTypeManager::checkComplete(QDeclarativeCompositeTypeDa
int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData *unit)
{
// not called until all resources are loaded (they include import URLs)
-
int waiting = 0;
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
+ QDeclarativeImportDatabase &importDatabase = ep->importDatabase;
- /*
- For local urls, add an implicit import "." as first (most overridden) lookup. This will also trigger
- the loading of the qmldir and the import of any native types from available plugins.
- */
+ // For local urls, add an implicit import "." as first (most overridden) lookup.
+ // This will also trigger the loading of the qmldir and the import of any native
+ // types from available plugins.
{
-
QDeclarativeDirComponents qmldircomponentsnetwork;
if (QDeclarativeCompositeTypeResource *resource
= resources.value(unit->imports.baseUrl().resolved(QUrl(QLatin1String("./qmldir"))))) {
@@ -544,14 +550,9 @@ int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData
qmldircomponentsnetwork = parser.components();
}
- QDeclarativeEnginePrivate::get(engine)->
- addToImport(&unit->imports,
- qmldircomponentsnetwork,
- QLatin1String("."),
- QString(),
- -1, -1,
- QDeclarativeScriptParser::Import::File,
- 0); // error ignored (just means no fallback)
+ importDatabase.addToImport(&unit->imports, qmldircomponentsnetwork, QLatin1String("."),
+ QString(), -1, -1, QDeclarativeScriptParser::Import::File,
+ 0); // error ignored (just means no fallback)
}
@@ -588,9 +589,8 @@ int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData
}
QString errorString;
- if (!QDeclarativeEnginePrivate::get(engine)->
- addToImport(&unit->imports, qmldircomponentsnetwork, imp.uri, imp.qualifier, vmaj, vmin, imp.type, &errorString))
- {
+ if (!importDatabase.addToImport(&unit->imports, qmldircomponentsnetwork, imp.uri, imp.qualifier,
+ vmaj, vmin, imp.type, &errorString)) {
QDeclarativeError error;
error.setUrl(unit->imports.baseUrl());
error.setDescription(errorString);
@@ -616,11 +616,10 @@ int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData
QUrl url;
int majorVersion;
int minorVersion;
- QDeclarativeEnginePrivate::ImportedNamespace *typeNamespace = 0;
+ QDeclarativeImportedNamespace *typeNamespace = 0;
QString errorString;
- if (!QDeclarativeEnginePrivate::get(engine)->resolveType(unit->imports, typeName, &ref.type, &url, &majorVersion, &minorVersion, &typeNamespace, &errorString)
- || typeNamespace)
- {
+ if (!importDatabase.resolveType(unit->imports, typeName, &ref.type, &url, &majorVersion, &minorVersion,
+ &typeNamespace, &errorString) || typeNamespace) {
// Known to not be a type:
// - known to be a namespace (Namespace {})
// - type with unknown namespace (UnknownNamespace.SomeType {})
@@ -724,8 +723,10 @@ void QDeclarativeCompositeTypeManager::compile(QDeclarativeCompositeTypeData *un
}
}
- QUrl importUrl = unit->imports.baseUrl().resolved(QUrl(QLatin1String("qmldir")));
- if (toLocalFileOrQrc(importUrl).isEmpty())
+ QUrl importUrl;
+ if (!unit->imports.baseUrl().scheme().isEmpty())
+ importUrl = unit->imports.baseUrl().resolved(QUrl(QLatin1String("qmldir")));
+ if (!importUrl.scheme().isEmpty() && toLocalFileOrQrc(importUrl).isEmpty())
resourceList.prepend(importUrl);
for (int ii = 0; ii < resourceList.count(); ++ii) {
diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp
index ae4223e37f..6a13f15a24 100644
--- a/src/declarative/qml/qdeclarativecontext.cpp
+++ b/src/declarative/qml/qdeclarativecontext.cpp
@@ -528,13 +528,8 @@ void QDeclarativeContextData::invalidate()
parent = 0;
}
-void QDeclarativeContextData::destroy()
+void QDeclarativeContextData::clearExpressions()
{
- if (linkedContext)
- linkedContext->destroy();
-
- if (engine) invalidate();
-
QDeclarativeAbstractExpression *expression = expressions;
while (expression) {
QDeclarativeAbstractExpression *nextExpression = expression->m_nextExpression;
@@ -546,6 +541,16 @@ void QDeclarativeContextData::destroy()
expression = nextExpression;
}
expressions = 0;
+}
+
+void QDeclarativeContextData::destroy()
+{
+ if (linkedContext)
+ linkedContext->destroy();
+
+ if (engine) invalidate();
+
+ clearExpressions();
while (contextObjects) {
QDeclarativeData *co = contextObjects;
@@ -654,7 +659,7 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object
if (iter == enginePriv->m_sharedScriptImports.end()) {
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine);
- scriptContext->pushScope(enginePriv->contextClass->newContext(0, 0));
+ scriptContext->pushScope(enginePriv->contextClass->newUrlContext(url));
scriptContext->pushScope(enginePriv->globalClass->globalObject());
QScriptValue scope = scriptEngine->newObject();
@@ -680,7 +685,7 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine);
- scriptContext->pushScope(enginePriv->contextClass->newContext(this, 0));
+ scriptContext->pushScope(enginePriv->contextClass->newUrlContext(this, 0, url));
scriptContext->pushScope(enginePriv->globalClass->globalObject());
QScriptValue scope = scriptEngine->newObject();
diff --git a/src/declarative/qml/qdeclarativecontext.h b/src/declarative/qml/qdeclarativecontext.h
index 548869c416..d87123a61c 100644
--- a/src/declarative/qml/qdeclarativecontext.h
+++ b/src/declarative/qml/qdeclarativecontext.h
@@ -107,7 +107,7 @@ private:
};
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QList<QObject*>);
+Q_DECLARE_METATYPE(QList<QObject*>)
QT_END_HEADER
diff --git a/src/declarative/qml/qdeclarativecontext_p.h b/src/declarative/qml/qdeclarativecontext_p.h
index c7fb0994d3..6b6cd0abcb 100644
--- a/src/declarative/qml/qdeclarativecontext_p.h
+++ b/src/declarative/qml/qdeclarativecontext_p.h
@@ -113,6 +113,7 @@ class QDeclarativeContextData
public:
QDeclarativeContextData();
QDeclarativeContextData(QDeclarativeContext *);
+ void clearExpressions();
void destroy();
void invalidate();
diff --git a/src/declarative/qml/qdeclarativecontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
index 1336a1afcb..1ebedbb0af 100644
--- a/src/declarative/qml/qdeclarativecontextscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
@@ -51,11 +51,13 @@ QT_BEGIN_NAMESPACE
struct ContextData : public QScriptDeclarativeClass::Object {
ContextData() : overrideObject(0), isSharedContext(true) {}
- ContextData(QDeclarativeContextData *c, QObject *o) : context(c), scopeObject(o), overrideObject(0), isSharedContext(false) {}
+ ContextData(QDeclarativeContextData *c, QObject *o)
+ : context(c), scopeObject(o), overrideObject(0), isSharedContext(false), isUrlContext(false) {}
QDeclarativeGuardedContextData context;
QDeclarativeGuard<QObject> scopeObject;
QObject *overrideObject;
- bool isSharedContext;
+ bool isSharedContext:1;
+ bool isUrlContext:1;
QDeclarativeContextData *getContext(QDeclarativeEngine *engine) {
if (isSharedContext) {
@@ -74,6 +76,18 @@ struct ContextData : public QScriptDeclarativeClass::Object {
}
};
+struct UrlContextData : public ContextData {
+ UrlContextData(QDeclarativeContextData *c, QObject *o, const QString &u)
+ : ContextData(c, o), url(u) {
+ isUrlContext = true;
+ }
+ UrlContextData(const QString &u)
+ : ContextData(0, 0), url(u) {
+ isUrlContext = true;
+ }
+ QString url;
+};
+
/*
The QDeclarativeContextScriptClass handles property access for a QDeclarativeContext
via QtScript.
@@ -95,6 +109,21 @@ QScriptValue QDeclarativeContextScriptClass::newContext(QDeclarativeContextData
return newObject(scriptEngine, this, new ContextData(context, scopeObject));
}
+QScriptValue QDeclarativeContextScriptClass::newUrlContext(QDeclarativeContextData *context, QObject *scopeObject,
+ const QString &url)
+{
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
+
+ return newObject(scriptEngine, this, new UrlContextData(context, scopeObject, url));
+}
+
+QScriptValue QDeclarativeContextScriptClass::newUrlContext(const QString &url)
+{
+ QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
+
+ return newObject(scriptEngine, this, new UrlContextData(url));
+}
+
QScriptValue QDeclarativeContextScriptClass::newSharedContext()
{
QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
@@ -111,6 +140,19 @@ QDeclarativeContextData *QDeclarativeContextScriptClass::contextFromValue(const
return data->getContext(engine);
}
+QUrl QDeclarativeContextScriptClass::urlFromValue(const QScriptValue &v)
+{
+ if (scriptClass(v) != this)
+ return QUrl();
+
+ ContextData *data = (ContextData *)object(v);
+ if (data->isUrlContext) {
+ return QUrl(static_cast<UrlContextData *>(data)->url);
+ } else {
+ return QUrl();
+ }
+}
+
QObject *QDeclarativeContextScriptClass::setOverrideObject(QScriptValue &v, QObject *override)
{
if (scriptClass(v) != this)
diff --git a/src/declarative/qml/qdeclarativecontextscriptclass_p.h b/src/declarative/qml/qdeclarativecontextscriptclass_p.h
index 1936d385f0..1215b009b9 100644
--- a/src/declarative/qml/qdeclarativecontextscriptclass_p.h
+++ b/src/declarative/qml/qdeclarativecontextscriptclass_p.h
@@ -68,9 +68,13 @@ public:
~QDeclarativeContextScriptClass();
QScriptValue newContext(QDeclarativeContextData *, QObject * = 0);
+ QScriptValue newUrlContext(QDeclarativeContextData *, QObject *, const QString &);
+ QScriptValue newUrlContext(const QString &);
QScriptValue newSharedContext();
QDeclarativeContextData *contextFromValue(const QScriptValue &);
+ QUrl urlFromValue(const QScriptValue &);
+
QObject *setOverrideObject(QScriptValue &, QObject *);
protected:
diff --git a/src/declarative/qml/qdeclarativedata_p.h b/src/declarative/qml/qdeclarativedata_p.h
index 4a56536918..e916273f10 100644
--- a/src/declarative/qml/qdeclarativedata_p.h
+++ b/src/declarative/qml/qdeclarativedata_p.h
@@ -152,11 +152,11 @@ public:
template<class T>
void QDeclarativeGuard<T>::addGuard()
{
- if (QObjectPrivate::get(o)->wasDeleted) {
- if (prev) remGuard();
+ Q_ASSERT(!prev);
+
+ if (QObjectPrivate::get(o)->wasDeleted)
return;
- }
-
+
QDeclarativeData *data = QDeclarativeData::get(o, true);
next = data->guards;
if (next) reinterpret_cast<QDeclarativeGuard<T> *>(next)->prev = &next;
@@ -167,6 +167,8 @@ void QDeclarativeGuard<T>::addGuard()
template<class T>
void QDeclarativeGuard<T>::remGuard()
{
+ Q_ASSERT(prev);
+
if (next) reinterpret_cast<QDeclarativeGuard<T> *>(next)->prev = prev;
*prev = next;
next = 0;
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 0ee6dfe2d6..79f8a1751d 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -67,6 +67,7 @@
#include "qdeclarativeextensioninterface.h"
#include "private/qdeclarativelist_p.h"
#include "private/qdeclarativetypenamecache_p.h"
+#include "private/qdeclarativeinclude_p.h"
#include <QtCore/qmetaobject.h>
#include <QScriptClass>
@@ -82,6 +83,7 @@
#include <QStack>
#include <QMap>
#include <QPluginLoader>
+#include <QtGui/qfontdatabase.h>
#include <QtCore/qlibraryinfo.h>
#include <QtCore/qthreadstorage.h>
#include <QtCore/qthread.h>
@@ -111,9 +113,6 @@ Q_DECLARE_METATYPE(QDeclarativeProperty)
QT_BEGIN_NAMESPACE
-DEFINE_BOOL_CONFIG_OPTION(qmlImportTrace, QML_IMPORT_TRACE)
-DEFINE_BOOL_CONFIG_OPTION(qmlCheckTypes, QML_CHECK_TYPES)
-
/*!
\qmlclass QtObject QObject
\since 4.7
@@ -158,7 +157,7 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e)
objectClass(0), valueTypeClass(0), globalClass(0), cleanup(0), erroredBindings(0),
inProgressCreations(0), scriptEngine(this), workerScriptEngine(0), componentAttached(0),
inBeginCreate(false), networkAccessManager(0), networkAccessManagerFactory(0),
- typeManager(e), uniqueId(1)
+ typeManager(e), importDatabase(e), uniqueId(1)
{
if (!qt_QmlQtModule_registered) {
qt_QmlQtModule_registered = true;
@@ -168,27 +167,6 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e)
QDeclarativeValueTypeFactory::registerValueTypes();
}
globalClass = new QDeclarativeGlobalScriptClass(&scriptEngine);
-
- // env import paths
- QByteArray envImportPath = qgetenv("QML_IMPORT_PATH");
- if (!envImportPath.isEmpty()) {
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
- QLatin1Char pathSep(';');
-#else
- QLatin1Char pathSep(':');
-#endif
- foreach (const QString &path, QString::fromLatin1(envImportPath).split(pathSep, QString::SkipEmptyParts)) {
- QString canonicalPath = QDir(path).canonicalPath();
- if (!canonicalPath.isEmpty() && !fileImportPath.contains(canonicalPath))
- fileImportPath.append(canonicalPath);
- }
- }
- QString builtinPath = QLibraryInfo::location(QLibraryInfo::ImportsPath);
- if (!builtinPath.isEmpty())
- fileImportPath += builtinPath;
-
- filePluginPath += QLatin1String(".");
-
}
QUrl QDeclarativeScriptEngine::resolvedUrl(QScriptContext *context, const QUrl& url)
@@ -227,6 +205,11 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr
// XXX used to add Qt.Sound class.
//types
+ if (mainthread)
+ qtObject.setProperty(QLatin1String("include"), newFunction(QDeclarativeInclude::include, 2));
+ else
+ qtObject.setProperty(QLatin1String("include"), newFunction(QDeclarativeInclude::worker_include, 2));
+
qtObject.setProperty(QLatin1String("isQtObject"), newFunction(QDeclarativeEnginePrivate::isQtObject, 1));
qtObject.setProperty(QLatin1String("rgba"), newFunction(QDeclarativeEnginePrivate::rgba, 4));
qtObject.setProperty(QLatin1String("hsla"), newFunction(QDeclarativeEnginePrivate::hsla, 4));
@@ -249,6 +232,7 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr
//misc methods
qtObject.setProperty(QLatin1String("openUrlExternally"),newFunction(QDeclarativeEnginePrivate::desktopOpenUrl, 1));
+ qtObject.setProperty(QLatin1String("fontFamilies"),newFunction(QDeclarativeEnginePrivate::fontFamilies, 0));
qtObject.setProperty(QLatin1String("md5"),newFunction(QDeclarativeEnginePrivate::md5, 1));
qtObject.setProperty(QLatin1String("btoa"),newFunction(QDeclarativeEnginePrivate::btoa, 1));
qtObject.setProperty(QLatin1String("atob"),newFunction(QDeclarativeEnginePrivate::atob, 1));
@@ -345,17 +329,17 @@ void QDeclarativeEnginePrivate::clear(SimpleList<QDeclarativeParserStatus> &pss)
}
Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer);
-typedef QMap<QString, QString> StringStringMap;
-Q_GLOBAL_STATIC(StringStringMap, qmlEnginePluginsWithRegisteredTypes); // stores the uri
-
void QDeclarativePrivate::qdeclarativeelement_destructor(QObject *o)
{
QObjectPrivate *p = QObjectPrivate::get(o);
- Q_ASSERT(p->declarativeData);
- QDeclarativeData *d = static_cast<QDeclarativeData*>(p->declarativeData);
- if (d->ownContext)
- d->context->destroy();
+ if (p->declarativeData) {
+ QDeclarativeData *d = static_cast<QDeclarativeData*>(p->declarativeData);
+ if (d->ownContext && d->context) {
+ d->context->destroy();
+ d->context = 0;
+ }
+ }
}
void QDeclarativeData::destroyed(QAbstractDeclarativeData *d, QObject *o)
@@ -374,6 +358,7 @@ void QDeclarativeEnginePrivate::init()
qRegisterMetaType<QVariant>("QVariant");
qRegisterMetaType<QDeclarativeScriptString>("QDeclarativeScriptString");
qRegisterMetaType<QScriptValue>("QScriptValue");
+ qRegisterMetaType<QDeclarativeComponent::Status>("QDeclarativeComponent::Status");
QDeclarativeData::init();
@@ -456,7 +441,11 @@ QDeclarativeEngine::~QDeclarativeEngine()
}
/*! \fn void QDeclarativeEngine::quit()
- This signal is emitted when the QDeclarativeEngine quits.
+ This signal is emitted when the QDeclarativeEngine quits.
+ */
+
+/*! \fn void QDeclarativeEngine::warnings(const QList<QDeclarativeError> &warnings)
+ This signal is emitted when \a warnings messages are generated by QML.
*/
/*!
@@ -573,9 +562,9 @@ QNetworkAccessManager *QDeclarativeEngine::networkAccessManager() const
This example creates a provider with id \e colors:
- \snippet examples/declarative/imageprovider/imageprovider.cpp 0
+ \snippet examples/declarative/cppextensions/imageprovider/imageprovider.cpp 0
- \snippet examples/declarative/imageprovider/imageprovider-example.qml 0
+ \snippet examples/declarative/cppextensions/imageprovider/imageprovider-example.qml 0
\sa removeImageProvider()
*/
@@ -892,14 +881,10 @@ void QDeclarativeData::destroyed(QObject *object)
if (ownContext && context)
context->destroy();
- QDeclarativeGuard<QObject> *guard = guards;
- while (guard) {
- QDeclarativeGuard<QObject> *g = guard;
- guard = guard->next;
- g->o = 0;
- g->prev = 0;
- g->next = 0;
- g->objectDestroyed(object);
+ while (guards) {
+ QDeclarativeGuard<QObject> *guard = guards;
+ *guard = (QObject *)0;
+ guard->objectDestroyed(object);
}
if (scriptValue)
@@ -986,7 +971,7 @@ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QS
Q_ASSERT(context);
if(ctxt->argumentCount() != 1) {
- return ctxt->throwError("Qt.createComponent(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.createComponent(): Invalid arguments"));
}else{
QString arg = ctxt->argument(0).toString();
if (arg.isEmpty())
@@ -1006,7 +991,7 @@ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QS
QDeclarativeEngine* activeEngine = activeEnginePriv->q_func();
if(ctxt->argumentCount() < 2 || ctxt->argumentCount() > 3)
- return ctxt->throwError("Qt.createQmlObject(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.createQmlObject(): Invalid arguments"));
QDeclarativeContextData* context = activeEnginePriv->getContext(ctxt);
Q_ASSERT(context);
@@ -1026,7 +1011,7 @@ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QS
QObject *parentArg = activeEnginePriv->objectClass->toQObject(ctxt->argument(1));
if(!parentArg)
- return ctxt->throwError("Qt.createQmlObject(): Missing parent object");
+ return ctxt->throwError(QLatin1String("Qt.createQmlObject(): Missing parent object"));
QDeclarativeComponent component(activeEngine);
component.setData(qml.toUtf8(), url);
@@ -1051,9 +1036,12 @@ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QS
}
if (!component.isReady())
- return ctxt->throwError("Qt.createQmlObject(): Component is not ready");
+ return ctxt->throwError(QLatin1String("Qt.createQmlObject(): Component is not ready"));
- QObject *obj = component.create(context->asQDeclarativeContext());
+ QObject *obj = component.beginCreate(context->asQDeclarativeContext());
+ if(obj)
+ QDeclarativeData::get(obj, true)->setImplicitDestructible();
+ component.completeCreate();
if(component.isError()) {
QList<QDeclarativeError> errors = component.errors();
@@ -1097,18 +1085,18 @@ QScriptValue QDeclarativeEnginePrivate::isQtObject(QScriptContext *ctxt, QScript
QScriptValue QDeclarativeEnginePrivate::vector(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 3)
- return ctxt->throwError("Qt.vector(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.vector(): Invalid arguments"));
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
qsreal z = ctxt->argument(2).toNumber();
- return engine->newVariant(qVariantFromValue(QVector3D(x, y, z)));
+ return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(qVariantFromValue(QVector3D(x, y, z)));
}
QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptEngine*engine)
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return ctxt->throwError("Qt.formatDate(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.formatDate(): Invalid arguments"));
QDate date = ctxt->argument(0).toDateTime().date();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1119,7 +1107,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptE
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
} else {
- return ctxt->throwError("Qt.formatDate(): Invalid date format");
+ return ctxt->throwError(QLatin1String("Qt.formatDate(): Invalid date format"));
}
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
@@ -1129,7 +1117,7 @@ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptE
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return ctxt->throwError("Qt.formatTime(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.formatTime(): Invalid arguments"));
QTime date = ctxt->argument(0).toDateTime().time();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1140,7 +1128,7 @@ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptE
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
} else {
- return ctxt->throwError("Qt.formatTime(): Invalid time format");
+ return ctxt->throwError(QLatin1String("Qt.formatTime(): Invalid time format"));
}
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
@@ -1150,7 +1138,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return ctxt->throwError("Qt.formatDateTime(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.formatDateTime(): Invalid arguments"));
QDateTime date = ctxt->argument(0).toDateTime();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1161,7 +1149,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
} else {
- return ctxt->throwError("Qt.formatDateTime(): Invalid datetime format");
+ return ctxt->throwError(QLatin1String("Qt.formatDateTime(): Invalid datetime format"));
}
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
@@ -1171,7 +1159,7 @@ QScriptValue QDeclarativeEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine
{
int argCount = ctxt->argumentCount();
if(argCount < 3 || argCount > 4)
- return ctxt->throwError("Qt.rgba(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.rgba(): Invalid arguments"));
qsreal r = ctxt->argument(0).toNumber();
qsreal g = ctxt->argument(1).toNumber();
qsreal b = ctxt->argument(2).toNumber();
@@ -1193,7 +1181,7 @@ QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine
{
int argCount = ctxt->argumentCount();
if(argCount < 3 || argCount > 4)
- return ctxt->throwError("Qt.hsla(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.hsla(): Invalid arguments"));
qsreal h = ctxt->argument(0).toNumber();
qsreal s = ctxt->argument(1).toNumber();
qsreal l = ctxt->argument(2).toNumber();
@@ -1214,7 +1202,7 @@ QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 4)
- return ctxt->throwError("Qt.rect(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.rect(): Invalid arguments"));
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
@@ -1224,31 +1212,31 @@ QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine
if (w < 0 || h < 0)
return engine->nullValue();
- return qScriptValueFromValue(engine, qVariantFromValue(QRectF(x, y, w, h)));
+ return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(qVariantFromValue(QRectF(x, y, w, h)));
}
QScriptValue QDeclarativeEnginePrivate::point(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return ctxt->throwError("Qt.point(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.point(): Invalid arguments"));
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
- return qScriptValueFromValue(engine, qVariantFromValue(QPointF(x, y)));
+ return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(qVariantFromValue(QPointF(x, y)));
}
QScriptValue QDeclarativeEnginePrivate::size(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return ctxt->throwError("Qt.size(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.size(): Invalid arguments"));
qsreal w = ctxt->argument(0).toNumber();
qsreal h = ctxt->argument(1).toNumber();
- return qScriptValueFromValue(engine, qVariantFromValue(QSizeF(w, h)));
+ return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(qVariantFromValue(QSizeF(w, h)));
}
QScriptValue QDeclarativeEnginePrivate::lighter(QScriptContext *ctxt, QScriptEngine *engine)
{
- if(ctxt->argumentCount() != 1)
- return ctxt->throwError("Qt.lighter(): Invalid arguments");
+ if(ctxt->argumentCount() != 1 && ctxt->argumentCount() != 2)
+ return ctxt->throwError(QLatin1String("Qt.lighter(): Invalid arguments"));
QVariant v = ctxt->argument(0).toVariant();
QColor color;
if (v.userType() == QVariant::Color)
@@ -1260,14 +1248,17 @@ QScriptValue QDeclarativeEnginePrivate::lighter(QScriptContext *ctxt, QScriptEng
return engine->nullValue();
} else
return engine->nullValue();
- color = color.lighter();
+ qsreal factor = 1.5;
+ if (ctxt->argumentCount() == 2)
+ factor = ctxt->argument(1).toNumber();
+ color = color.lighter(int(qRound(factor*100.)));
return qScriptValueFromValue(engine, qVariantFromValue(color));
}
QScriptValue QDeclarativeEnginePrivate::darker(QScriptContext *ctxt, QScriptEngine *engine)
{
- if(ctxt->argumentCount() != 1)
- return ctxt->throwError("Qt.darker(): Invalid arguments");
+ if(ctxt->argumentCount() != 1 && ctxt->argumentCount() != 2)
+ return ctxt->throwError(QLatin1String("Qt.darker(): Invalid arguments"));
QVariant v = ctxt->argument(0).toVariant();
QColor color;
if (v.userType() == QVariant::Color)
@@ -1279,7 +1270,10 @@ QScriptValue QDeclarativeEnginePrivate::darker(QScriptContext *ctxt, QScriptEngi
return engine->nullValue();
} else
return engine->nullValue();
- color = color.darker();
+ qsreal factor = 2.0;
+ if (ctxt->argumentCount() == 2)
+ factor = ctxt->argument(1).toNumber();
+ color = color.darker(int(qRound(factor*100.)));
return qScriptValueFromValue(engine, qVariantFromValue(color));
}
@@ -1294,10 +1288,20 @@ QScriptValue QDeclarativeEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QSc
return QScriptValue(e, ret);
}
+QScriptValue QDeclarativeEnginePrivate::fontFamilies(QScriptContext *ctxt, QScriptEngine *e)
+{
+ if(ctxt->argumentCount() != 0)
+ return ctxt->throwError(QLatin1String("Qt.fontFamilies(): Invalid arguments"));
+
+ QDeclarativeEnginePrivate *p = QDeclarativeEnginePrivate::get(e);
+ QFontDatabase database;
+ return p->scriptValueFromVariant(database.families());
+}
+
QScriptValue QDeclarativeEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine *)
{
if (ctxt->argumentCount() != 1)
- return ctxt->throwError("Qt.md5(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.md5(): Invalid arguments"));
QByteArray data = ctxt->argument(0).toString().toUtf8();
QByteArray result = QCryptographicHash::hash(data, QCryptographicHash::Md5);
@@ -1308,7 +1312,7 @@ QScriptValue QDeclarativeEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::btoa(QScriptContext *ctxt, QScriptEngine *)
{
if (ctxt->argumentCount() != 1)
- return ctxt->throwError("Qt.btoa(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.btoa(): Invalid arguments"));
QByteArray data = ctxt->argument(0).toString().toUtf8();
@@ -1318,7 +1322,7 @@ QScriptValue QDeclarativeEnginePrivate::btoa(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::atob(QScriptContext *ctxt, QScriptEngine *)
{
if (ctxt->argumentCount() != 1)
- return ctxt->throwError("Qt.atob(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.atob(): Invalid arguments"));
QByteArray data = ctxt->argument(0).toString().toUtf8();
@@ -1419,7 +1423,7 @@ QScriptValue QDeclarativeEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptE
QScriptValue QDeclarativeEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return ctxt->throwError("Qt.tint(): Invalid arguments");
+ return ctxt->throwError(QLatin1String("Qt.tint(): Invalid arguments"));
//get color
QVariant v = ctxt->argument(0).toVariant();
QColor color;
@@ -1522,516 +1526,6 @@ QVariant QDeclarativeEnginePrivate::scriptValueToVariant(const QScriptValue &val
return val.toVariant();
}
-// XXX this beyonds in QUrl::toLocalFile()
-// WARNING, there is a copy of this function in qdeclarativecompositetypemanager.cpp
-static QString toLocalFileOrQrc(const QUrl& url)
-{
- if (url.scheme() == QLatin1String("qrc")) {
- if (url.authority().isEmpty())
- return QLatin1Char(':') + url.path();
- return QString();
- }
- return url.toLocalFile();
-}
-
-/////////////////////////////////////////////////////////////
-struct QDeclarativeEnginePrivate::ImportedNamespace {
- QStringList uris;
- QStringList urls;
- QList<int> majversions;
- QList<int> minversions;
- QList<bool> isLibrary;
- QList<QDeclarativeDirComponents> qmlDirComponents;
-
-
- bool find_helper(int i, const QByteArray& type, int *vmajor, int *vminor,
- QDeclarativeType** type_return, QUrl* url_return,
- QUrl *base = 0, bool *typeRecursionDetected = 0)
- {
- int vmaj = majversions.at(i);
- int vmin = minversions.at(i);
-
- QByteArray qt = uris.at(i).toUtf8();
- qt += '/';
- qt += type;
-
- QDeclarativeType *t = QDeclarativeMetaType::qmlType(qt,vmaj,vmin);
- if (t) {
- if (vmajor) *vmajor = vmaj;
- if (vminor) *vminor = vmin;
- if (type_return)
- *type_return = t;
- return true;
- }
-
- QUrl url = QUrl(urls.at(i) + QLatin1Char('/') + QString::fromUtf8(type) + QLatin1String(".qml"));
- QDeclarativeDirComponents qmldircomponents = qmlDirComponents.at(i);
-
- bool typeWasDeclaredInQmldir = false;
- if (!qmldircomponents.isEmpty()) {
- const QString typeName = QString::fromUtf8(type);
- foreach (const QDeclarativeDirParser::Component &c, qmldircomponents) {
- if (c.typeName == typeName) {
- typeWasDeclaredInQmldir = true;
-
- // importing version -1 means import ALL versions
- if ((vmaj == -1) || (c.majorVersion < vmaj || (c.majorVersion == vmaj && vmin >= c.minorVersion))) {
- QUrl candidate = url.resolved(QUrl(c.fileName));
- if (c.internal && base) {
- if (base->resolved(QUrl(c.fileName)) != candidate)
- continue; // failed attempt to access an internal type
- }
- if (base && *base == candidate) {
- if (typeRecursionDetected)
- *typeRecursionDetected = true;
- continue; // no recursion
- }
- if (url_return)
- *url_return = candidate;
- return true;
- }
- }
- }
- }
-
- if (!typeWasDeclaredInQmldir && !isLibrary.at(i)) {
- // XXX search non-files too! (eg. zip files, see QT-524)
- QFileInfo f(toLocalFileOrQrc(url));
- if (f.exists()) {
- if (base && *base == url) { // no recursion
- if (typeRecursionDetected)
- *typeRecursionDetected = true;
- } else {
- if (url_return)
- *url_return = url;
- return true;
- }
- }
- }
- return false;
- }
-
- bool find(const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return,
- QUrl* url_return, QUrl *base = 0, QString *errorString = 0)
- {
- bool typeRecursionDetected = false;
- for (int i=0; i<urls.count(); ++i) {
- if (find_helper(i, type, vmajor, vminor, type_return, url_return, base, &typeRecursionDetected)) {
- if (qmlCheckTypes()) {
- // check for type clashes
- for (int j = i+1; j<urls.count(); ++j) {
- if (find_helper(j, type, vmajor, vminor, 0, 0, base)) {
- if (errorString) {
- QString u1 = urls.at(i);
- QString u2 = urls.at(j);
- if (base) {
- QString b = base->toString();
- int slash = b.lastIndexOf(QLatin1Char('/'));
- if (slash >= 0) {
- b = b.left(slash+1);
- QString l = b.left(slash);
- if (u1.startsWith(b))
- u1 = u1.mid(b.count());
- else if (u1 == l)
- u1 = QDeclarativeEngine::tr("local directory");
- if (u2.startsWith(b))
- u2 = u2.mid(b.count());
- else if (u2 == l)
- u2 = QDeclarativeEngine::tr("local directory");
- }
- }
-
- if (u1 != u2)
- *errorString
- = QDeclarativeEngine::tr("is ambiguous. Found in %1 and in %2")
- .arg(u1).arg(u2);
- else
- *errorString
- = QDeclarativeEngine::tr("is ambiguous. Found in %1 in version %2.%3 and %4.%5")
- .arg(u1)
- .arg(majversions.at(i)).arg(minversions.at(i))
- .arg(majversions.at(j)).arg(minversions.at(j));
- }
- return false;
- }
- }
- }
- return true;
- }
- }
- if (errorString) {
- if (typeRecursionDetected)
- *errorString = QDeclarativeEngine::tr("is instantiated recursively");
- else
- *errorString = QDeclarativeEngine::tr("is not a type");
- }
- return false;
- }
-};
-
-static bool greaterThan(const QString &s1, const QString &s2)
-{
- return s1 > s2;
-}
-
-class QDeclarativeImportsPrivate {
-public:
- QDeclarativeImportsPrivate() : ref(1)
- {
- }
-
- ~QDeclarativeImportsPrivate()
- {
- foreach (QDeclarativeEnginePrivate::ImportedNamespace* s, set.values())
- delete s;
- }
-
- QSet<QString> qmlDirFilesForWhichPluginsHaveBeenLoaded;
-
- bool importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine, QDeclarativeDirComponents* components, QString *errorString) {
- QFile file(absoluteFilePath);
- QString filecontent;
- if (file.open(QFile::ReadOnly)) {
- filecontent = QString::fromUtf8(file.readAll());
- if (qmlImportTrace())
- qDebug() << "QDeclarativeEngine::add: loaded" << absoluteFilePath;
- } else {
- if (errorString)
- *errorString = QDeclarativeEngine::tr("module \"%1\" definition \"%2\" not readable").arg(uri).arg(absoluteFilePath);
- return false;
- }
- QDir dir = QFileInfo(file).dir();
-
- QDeclarativeDirParser qmldirParser;
- qmldirParser.setSource(filecontent);
- qmldirParser.parse();
-
- if (! qmlDirFilesForWhichPluginsHaveBeenLoaded.contains(absoluteFilePath)) {
- qmlDirFilesForWhichPluginsHaveBeenLoaded.insert(absoluteFilePath);
-
-
- foreach (const QDeclarativeDirParser::Plugin &plugin, qmldirParser.plugins()) {
-
- QString resolvedFilePath =
- QDeclarativeEnginePrivate::get(engine)
- ->resolvePlugin(dir, plugin.path,
- plugin.name);
-
- if (!resolvedFilePath.isEmpty()) {
- if (!engine->importPlugin(resolvedFilePath, uri, errorString)) {
- if (errorString)
- *errorString = QDeclarativeEngine::tr("plugin cannot be loaded for module \"%1\": %2").arg(uri).arg(*errorString);
- return false;
- }
- } else {
- if (errorString)
- *errorString = QDeclarativeEngine::tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name);
- return false;
- }
- }
- }
-
- if (components)
- *components = qmldirParser.components();
-
- return true;
- }
-
- QString resolvedUri(const QString &dir_arg, QDeclarativeEngine *engine)
- {
- QString dir = dir_arg;
- if (dir.endsWith(QLatin1Char('/')) || dir.endsWith(QLatin1Char('\\')))
- dir.chop(1);
-
- QStringList paths = QDeclarativeEnginePrivate::get(engine)->fileImportPath;
- qSort(paths.begin(), paths.end(), greaterThan); // Ensure subdirs preceed their parents.
-
- QString stableRelativePath = dir;
- foreach( QString path, paths) {
- if (dir.startsWith(path)) {
- stableRelativePath = dir.mid(path.length()+1);
- break;
- }
- }
- stableRelativePath.replace(QLatin1Char('/'), QLatin1Char('.'));
- stableRelativePath.replace(QLatin1Char('\\'), QLatin1Char('.'));
- return stableRelativePath;
- }
-
-
-
-
- bool add(const QUrl& base, const QDeclarativeDirComponents &qmldircomponentsnetwork, const QString& uri_arg, const QString& prefix, int vmaj, int vmin, QDeclarativeScriptParser::Import::Type importType, QDeclarativeEngine *engine, QString *errorString)
- {
- QDeclarativeDirComponents qmldircomponents = qmldircomponentsnetwork;
- QString uri = uri_arg;
- QDeclarativeEnginePrivate::ImportedNamespace *s;
- if (prefix.isEmpty()) {
- s = &unqualifiedset;
- } else {
- s = set.value(prefix);
- if (!s)
- set.insert(prefix,(s=new QDeclarativeEnginePrivate::ImportedNamespace));
- }
-
-
-
- QString url = uri;
- if (importType == QDeclarativeScriptParser::Import::Library) {
- url.replace(QLatin1Char('.'), QLatin1Char('/'));
- bool found = false;
- QString dir;
-
-
- foreach (const QString &p,
- QDeclarativeEnginePrivate::get(engine)->fileImportPath) {
- dir = p+QLatin1Char('/')+url;
-
- QFileInfo fi(dir+QLatin1String("/qmldir"));
- const QString absoluteFilePath = fi.absoluteFilePath();
-
- if (fi.isFile()) {
- found = true;
-
- url = QUrl::fromLocalFile(fi.absolutePath()).toString();
- uri = resolvedUri(dir, engine);
- if (!importExtension(absoluteFilePath, uri, engine, &qmldircomponents, errorString))
- return false;
- break;
- }
- }
-
- if (!found) {
- found = QDeclarativeMetaType::isModule(uri.toUtf8(), vmaj, vmin);
- if (!found) {
- if (errorString) {
- bool anyversion = QDeclarativeMetaType::isModule(uri.toUtf8(), -1, -1);
- if (anyversion)
- *errorString = QDeclarativeEngine::tr("module \"%1\" version %2.%3 is not installed").arg(uri_arg).arg(vmaj).arg(vmin);
- else
- *errorString = QDeclarativeEngine::tr("module \"%1\" is not installed").arg(uri_arg);
- }
- return false;
- }
- }
- } else {
-
- if (importType == QDeclarativeScriptParser::Import::File && qmldircomponents.isEmpty()) {
- QUrl importUrl = base.resolved(QUrl(uri + QLatin1String("/qmldir")));
- QString localFileOrQrc = toLocalFileOrQrc(importUrl);
- if (!localFileOrQrc.isEmpty()) {
- QString dir = toLocalFileOrQrc(base.resolved(QUrl(uri)));
- if (dir.isEmpty() || !QDir().exists(dir)) {
- if (errorString)
- *errorString = QDeclarativeEngine::tr("\"%1\": no such directory").arg(uri_arg);
- return false; // local import dirs must exist
- }
- uri = resolvedUri(toLocalFileOrQrc(base.resolved(QUrl(uri))), engine);
- if (uri.endsWith(QLatin1Char('/')))
- uri.chop(1);
- if (QFile::exists(localFileOrQrc)) {
- if (!importExtension(localFileOrQrc,uri,engine,&qmldircomponents,errorString))
- return false;
- }
- } else {
- if (prefix.isEmpty()) {
- // directory must at least exist for valid import
- QString localFileOrQrc = toLocalFileOrQrc(base.resolved(QUrl(uri)));
- if (localFileOrQrc.isEmpty() || !QDir().exists(localFileOrQrc)) {
- if (errorString) {
- if (localFileOrQrc.isEmpty())
- *errorString = QDeclarativeEngine::tr("import \"%1\" has no qmldir and no namespace").arg(uri);
- else
- *errorString = QDeclarativeEngine::tr("\"%1\": no such directory").arg(uri);
- }
- return false;
- }
- }
- }
- }
-
- url = base.resolved(QUrl(url)).toString();
- if (url.endsWith(QLatin1Char('/')))
- url.chop(1);
- }
-
- if (vmaj > -1 && vmin > -1 && !qmldircomponents.isEmpty()) {
- QList<QDeclarativeDirParser::Component>::ConstIterator it = qmldircomponents.begin();
- for (; it != qmldircomponents.end(); ++it) {
- if (it->majorVersion > vmaj || (it->majorVersion == vmaj && it->minorVersion >= vmin))
- break;
- }
- if (it == qmldircomponents.end()) {
- *errorString = QDeclarativeEngine::tr("module \"%1\" version %2.%3 is not installed").arg(uri_arg).arg(vmaj).arg(vmin);
- return false;
- }
- }
-
- s->uris.prepend(uri);
- s->urls.prepend(url);
- s->majversions.prepend(vmaj);
- s->minversions.prepend(vmin);
- s->isLibrary.prepend(importType == QDeclarativeScriptParser::Import::Library);
- s->qmlDirComponents.prepend(qmldircomponents);
- return true;
- }
-
- bool find(const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return,
- QUrl* url_return, QString *errorString)
- {
- QDeclarativeEnginePrivate::ImportedNamespace *s = 0;
- int slash = type.indexOf('/');
- if (slash >= 0) {
- QString namespaceName = QString::fromUtf8(type.left(slash));
- s = set.value(namespaceName);
- if (!s) {
- if (errorString)
- *errorString = QDeclarativeEngine::tr("- %1 is not a namespace").arg(namespaceName);
- return false;
- }
- int nslash = type.indexOf('/',slash+1);
- if (nslash > 0) {
- if (errorString)
- *errorString = QDeclarativeEngine::tr("- nested namespaces not allowed");
- return false;
- }
- } else {
- s = &unqualifiedset;
- }
- QByteArray unqualifiedtype = slash < 0 ? type : type.mid(slash+1); // common-case opt (QString::mid works fine, but slower)
- if (s) {
- if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return, &base, errorString))
- return true;
- if (s->urls.count() == 1 && !s->isLibrary[0] && url_return && s != &unqualifiedset) {
- // qualified, and only 1 url
- *url_return = QUrl(s->urls[0]+QLatin1Char('/')).resolved(QUrl(QString::fromUtf8(unqualifiedtype) + QLatin1String(".qml")));
- return true;
- }
- }
-
- return false;
- }
-
- QDeclarativeEnginePrivate::ImportedNamespace *findNamespace(const QString& type)
- {
- return set.value(type);
- }
-
- QUrl base;
- int ref;
-
-private:
- friend struct QDeclarativeEnginePrivate::Imports;
- QDeclarativeEnginePrivate::ImportedNamespace unqualifiedset;
- QHash<QString,QDeclarativeEnginePrivate::ImportedNamespace* > set;
-};
-
-QDeclarativeEnginePrivate::Imports::Imports(const Imports &copy) :
- d(copy.d)
-{
- ++d->ref;
-}
-
-QDeclarativeEnginePrivate::Imports &QDeclarativeEnginePrivate::Imports::operator =(const Imports &copy)
-{
- ++copy.d->ref;
- if (--d->ref == 0)
- delete d;
- d = copy.d;
- return *this;
-}
-
-QDeclarativeEnginePrivate::Imports::Imports() :
- d(new QDeclarativeImportsPrivate)
-{
-}
-
-QDeclarativeEnginePrivate::Imports::~Imports()
-{
- if (--d->ref == 0)
- delete d;
-}
-
-static QDeclarativeTypeNameCache *cacheForNamespace(QDeclarativeEngine *engine, const QDeclarativeEnginePrivate::ImportedNamespace &set, QDeclarativeTypeNameCache *cache)
-{
- if (!cache)
- cache = new QDeclarativeTypeNameCache(engine);
-
- QList<QDeclarativeType *> types = QDeclarativeMetaType::qmlTypes();
-
- for (int ii = 0; ii < set.uris.count(); ++ii) {
- QByteArray base = set.uris.at(ii).toUtf8() + '/';
- int major = set.majversions.at(ii);
- int minor = set.minversions.at(ii);
-
- foreach (QDeclarativeType *type, types) {
- if (type->qmlTypeName().startsWith(base) &&
- type->qmlTypeName().lastIndexOf('/') == (base.length() - 1) &&
- type->availableInVersion(major,minor))
- {
- QString name = QString::fromUtf8(type->qmlTypeName().mid(base.length()));
-
- cache->add(name, type);
- }
- }
- }
-
- return cache;
-}
-
-void QDeclarativeEnginePrivate::Imports::cache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *engine) const
-{
- const QDeclarativeEnginePrivate::ImportedNamespace &set = d->unqualifiedset;
-
- for (QHash<QString,QDeclarativeEnginePrivate::ImportedNamespace* >::ConstIterator iter = d->set.begin();
- iter != d->set.end(); ++iter) {
-
- QDeclarativeTypeNameCache::Data *d = cache->data(iter.key());
- if (d) {
- if (!d->typeNamespace)
- cacheForNamespace(engine, *(*iter), d->typeNamespace);
- } else {
- QDeclarativeTypeNameCache *nc = cacheForNamespace(engine, *(*iter), 0);
- cache->add(iter.key(), nc);
- nc->release();
- }
- }
-
- cacheForNamespace(engine, set, cache);
-}
-
-/*
-QStringList QDeclarativeEnginePrivate::Imports::unqualifiedSet() const
-{
- QStringList rv;
-
- const QDeclarativeEnginePrivate::ImportedNamespace &set = d->unqualifiedset;
-
- for (int ii = 0; ii < set.urls.count(); ++ii) {
- if (set.isBuiltin.at(ii))
- rv << set.urls.at(ii);
- }
-
- return rv;
-}
-*/
-
-/*!
- Sets the base URL to be used for all relative file imports added.
-*/
-void QDeclarativeEnginePrivate::Imports::setBaseUrl(const QUrl& url)
-{
- d->base = url;
-}
-
-/*!
- Returns the base URL to be used for all relative file imports added.
-*/
-QUrl QDeclarativeEnginePrivate::Imports::baseUrl() const
-{
- return d->base;
-}
-
/*!
Adds \a path as a directory where the engine searches for
installed modules in a URL-based directory structure.
@@ -2042,19 +1536,10 @@ QUrl QDeclarativeEnginePrivate::Imports::baseUrl() const
*/
void QDeclarativeEngine::addImportPath(const QString& path)
{
- if (qmlImportTrace())
- qDebug() << "QDeclarativeEngine::addImportPath" << path;
Q_D(QDeclarativeEngine);
- QUrl url = QUrl(path);
- if (url.isRelative() || url.scheme() == QString::fromLocal8Bit("file")) {
- QDir dir = QDir(path);
- d->fileImportPath.prepend(dir.canonicalPath());
- } else {
- d->fileImportPath.prepend(path);
- }
+ d->importDatabase.addImportPath(path);
}
-
/*!
Returns the list of directories where the engine searches for
installed modules in a URL-based directory structure.
@@ -2073,11 +1558,11 @@ void QDeclarativeEngine::addImportPath(const QString& path)
QStringList QDeclarativeEngine::importPathList() const
{
Q_D(const QDeclarativeEngine);
- return d->fileImportPath;
+ return d->importDatabase.importPathList();
}
/*!
- Sets the list of directories where the engine searches for
+ Sets \a paths as the list of directories where the engine searches for
installed modules in a URL-based directory structure.
By default, the list contains the paths specified in the \c QML_IMPORT_PATH environment
@@ -2088,7 +1573,7 @@ QStringList QDeclarativeEngine::importPathList() const
void QDeclarativeEngine::setImportPathList(const QStringList &paths)
{
Q_D(QDeclarativeEngine);
- d->fileImportPath = paths;
+ d->importDatabase.setImportPathList(paths);
}
@@ -2105,16 +1590,8 @@ void QDeclarativeEngine::setImportPathList(const QStringList &paths)
*/
void QDeclarativeEngine::addPluginPath(const QString& path)
{
- if (qmlImportTrace())
- qDebug() << "QDeclarativeEngine::addPluginPath" << path;
Q_D(QDeclarativeEngine);
- QUrl url = QUrl(path);
- if (url.isRelative() || url.scheme() == QString::fromLocal8Bit("file")) {
- QDir dir = QDir(path);
- d->filePluginPath.prepend(dir.canonicalPath());
- } else {
- d->filePluginPath.prepend(path);
- }
+ d->importDatabase.addPluginPath(path);
}
@@ -2130,7 +1607,7 @@ void QDeclarativeEngine::addPluginPath(const QString& path)
QStringList QDeclarativeEngine::pluginPathList() const
{
Q_D(const QDeclarativeEngine);
- return d->filePluginPath;
+ return d->importDatabase.pluginPathList();
}
/*!
@@ -2146,7 +1623,7 @@ QStringList QDeclarativeEngine::pluginPathList() const
void QDeclarativeEngine::setPluginPathList(const QStringList &paths)
{
Q_D(QDeclarativeEngine);
- d->filePluginPath = paths;
+ d->importDatabase.setPluginPathList(paths);
}
@@ -2160,55 +1637,8 @@ void QDeclarativeEngine::setPluginPathList(const QStringList &paths)
*/
bool QDeclarativeEngine::importPlugin(const QString &filePath, const QString &uri, QString *errorString)
{
- if (qmlImportTrace())
- qDebug() << "QDeclarativeEngine::importPlugin" << uri << "from" << filePath;
- QFileInfo fileInfo(filePath);
- const QString absoluteFilePath = fileInfo.absoluteFilePath();
-
- QDeclarativeEnginePrivate *d = QDeclarativeEnginePrivate::get(this);
- bool engineInitialized = d->initializedPlugins.contains(absoluteFilePath);
- bool typesRegistered = qmlEnginePluginsWithRegisteredTypes()->contains(absoluteFilePath);
-
- if (typesRegistered) {
- Q_ASSERT_X(qmlEnginePluginsWithRegisteredTypes()->value(absoluteFilePath) == uri,
- "QDeclarativeEngine::importExtension",
- "Internal error: Plugin imported previously with different uri");
- }
-
- if (!engineInitialized || !typesRegistered) {
- QPluginLoader loader(absoluteFilePath);
-
- if (!loader.load()) {
- if (errorString)
- *errorString = loader.errorString();
- return false;
- }
-
- if (QDeclarativeExtensionInterface *iface = qobject_cast<QDeclarativeExtensionInterface *>(loader.instance())) {
-
- const QByteArray bytes = uri.toUtf8();
- const char *moduleId = bytes.constData();
- if (!typesRegistered) {
-
- // ### this code should probably be protected with a mutex.
- qmlEnginePluginsWithRegisteredTypes()->insert(absoluteFilePath, uri);
- iface->registerTypes(moduleId);
- }
- if (!engineInitialized) {
- // things on the engine (eg. adding new global objects) have to be done for every engine.
-
- // protect against double initialization
- d->initializedPlugins.insert(absoluteFilePath);
- iface->initializeEngine(this, moduleId);
- }
- } else {
- if (errorString)
- *errorString = loader.errorString();
- return false;
- }
- }
-
- return true;
+ Q_D(QDeclarativeEngine);
+ return d->importDatabase.importPlugin(filePath, uri, errorString);
}
/*!
@@ -2240,208 +1670,6 @@ QString QDeclarativeEngine::offlineStoragePath() const
return d->scriptEngine.offlineStoragePath;
}
-/*!
- \internal
-
- Returns the result of the merge of \a baseName with \a path, \a suffixes, and \a prefix.
- The \a prefix must contain the dot.
-
- \a qmldirPath is the location of the qmldir file.
- */
-QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, const QString &baseName,
- const QStringList &suffixes,
- const QString &prefix)
-{
- QStringList searchPaths = filePluginPath;
- bool qmldirPluginPathIsRelative = QDir::isRelativePath(qmldirPluginPath);
- if (!qmldirPluginPathIsRelative)
- searchPaths.prepend(qmldirPluginPath);
-
- foreach (const QString &pluginPath, searchPaths) {
-
- QString resolvedPath;
-
- if (pluginPath == QLatin1String(".")) {
- if (qmldirPluginPathIsRelative)
- resolvedPath = qmldirPath.absoluteFilePath(qmldirPluginPath);
- else
- resolvedPath = qmldirPath.absolutePath();
- } else {
- resolvedPath = pluginPath;
- }
-
- // hack for resources, should probably go away
- if (resolvedPath.startsWith(QLatin1Char(':')))
- resolvedPath = QCoreApplication::applicationDirPath();
-
- QDir dir(resolvedPath);
- foreach (const QString &suffix, suffixes) {
- QString pluginFileName = prefix;
-
- pluginFileName += baseName;
- pluginFileName += suffix;
-
- QFileInfo fileInfo(dir, pluginFileName);
-
- if (fileInfo.exists())
- return fileInfo.absoluteFilePath();
- }
- }
-
- if (qmlImportTrace())
- qDebug() << "QDeclarativeEngine::resolvePlugin: Could not resolve plugin" << baseName << "in" << qmldirPath.absolutePath();
- return QString();
-}
-
-/*!
- \internal
-
- Returns the result of the merge of \a baseName with \a dir and the platform suffix.
-
- \table
- \header \i Platform \i Valid suffixes
- \row \i Windows \i \c .dll
- \row \i Unix/Linux \i \c .so
- \row \i AIX \i \c .a
- \row \i HP-UX \i \c .sl, \c .so (HP-UXi)
- \row \i Mac OS X \i \c .dylib, \c .bundle, \c .so
- \row \i Symbian \i \c .dll
- \endtable
-
- Version number on unix are ignored.
-*/
-QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, const QString &baseName)
-{
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
- return resolvePlugin(qmldirPath, qmldirPluginPath, baseName,
- QStringList()
-# ifdef QT_DEBUG
- << QLatin1String("d.dll") // try a qmake-style debug build first
-# endif
- << QLatin1String(".dll"));
-#elif defined(Q_OS_SYMBIAN)
- return resolvePlugin(qmldirPath, qmldirPluginPath, baseName,
- QStringList()
- << QLatin1String(".dll")
- << QLatin1String(".qtplugin"));
-#else
-
-# if defined(Q_OS_DARWIN)
-
- return resolvePlugin(qmldirPath, qmldirPluginPath, baseName,
- QStringList()
-# ifdef QT_DEBUG
- << QLatin1String("_debug.dylib") // try a qmake-style debug build first
- << QLatin1String(".dylib")
-# else
- << QLatin1String(".dylib")
- << QLatin1String("_debug.dylib") // try a qmake-style debug build after
-# endif
- << QLatin1String(".so")
- << QLatin1String(".bundle"),
- QLatin1String("lib"));
-# else // Generic Unix
- QStringList validSuffixList;
-
-# if defined(Q_OS_HPUX)
-/*
- See "HP-UX Linker and Libraries User's Guide", section "Link-time Differences between PA-RISC and IPF":
- "In PA-RISC (PA-32 and PA-64) shared libraries are suffixed with .sl. In IPF (32-bit and 64-bit),
- the shared libraries are suffixed with .so. For compatibility, the IPF linker also supports the .sl suffix."
- */
- validSuffixList << QLatin1String(".sl");
-# if defined __ia64
- validSuffixList << QLatin1String(".so");
-# endif
-# elif defined(Q_OS_AIX)
- validSuffixList << QLatin1String(".a") << QLatin1String(".so");
-# elif defined(Q_OS_UNIX)
- validSuffixList << QLatin1String(".so");
-# endif
-
- // Examples of valid library names:
- // libfoo.so
-
- return resolvePlugin(qmldirPath, qmldirPluginPath, baseName, validSuffixList, QLatin1String("lib"));
-# endif
-
-#endif
-}
-
-/*!
- \internal
-
- Adds information to \a imports such that subsequent calls to resolveType()
- will resolve types qualified by \a prefix by considering types found at the given \a uri.
-
- The uri is either a directory (if importType is FileImport), or a URI resolved using paths
- added via addImportPath() (if importType is LibraryImport).
-
- The \a prefix may be empty, in which case the import location is considered for
- unqualified types.
-
- The base URL must already have been set with Import::setBaseUrl().
-*/
-bool QDeclarativeEnginePrivate::addToImport(Imports* imports, const QDeclarativeDirComponents &qmldircomponentsnetwork, const QString& uri, const QString& prefix, int vmaj, int vmin, QDeclarativeScriptParser::Import::Type importType, QString *errorString) const
-{
- QDeclarativeEngine *engine = QDeclarativeEnginePrivate::get(const_cast<QDeclarativeEnginePrivate *>(this));
- if (qmlImportTrace())
- qDebug().nospace() << "QDeclarativeEngine::addToImport " << imports << " " << uri << " " << vmaj << '.' << vmin << " " << (importType==QDeclarativeScriptParser::Import::Library? "Library" : "File") << " as " << prefix;
- bool ok = imports->d->add(imports->d->base,qmldircomponentsnetwork, uri,prefix,vmaj,vmin,importType, engine, errorString);
- return ok;
-}
-
-/*!
- \internal
-
- Using the given \a imports, the given (namespace qualified) \a type is resolved to either
- an ImportedNamespace stored at \a ns_return,
- a QDeclarativeType stored at \a type_return, or
- a component located at \a url_return.
-
- If any return pointer is 0, the corresponding search is not done.
-
- \sa addToImport()
-*/
-bool QDeclarativeEnginePrivate::resolveType(const Imports& imports, const QByteArray& type, QDeclarativeType** type_return, QUrl* url_return, int *vmaj, int *vmin, ImportedNamespace** ns_return, QString *errorString) const
-{
- ImportedNamespace* ns = imports.d->findNamespace(QString::fromUtf8(type));
- if (ns) {
- if (ns_return)
- *ns_return = ns;
- return true;
- }
- if (type_return || url_return) {
- if (imports.d->find(type,vmaj,vmin,type_return,url_return, errorString)) {
- if (qmlImportTrace()) {
- if (type_return && *type_return && url_return && !url_return->isEmpty())
- qDebug() << "QDeclarativeEngine::resolveType" << type << '=' << (*type_return)->typeName() << *url_return;
- if (type_return && *type_return)
- qDebug() << "QDeclarativeEngine::resolveType" << type << '=' << (*type_return)->typeName();
- if (url_return && !url_return->isEmpty())
- qDebug() << "QDeclarativeEngine::resolveType" << type << '=' << *url_return;
- }
- return true;
- }
- }
- return false;
-}
-
-/*!
- \internal
-
- Searching \e only in the namespace \a ns (previously returned in a call to
- resolveType(), \a type is found and returned to either
- a QDeclarativeType stored at \a type_return, or
- a component located at \a url_return.
-
- If either return pointer is 0, the corresponding search is not done.
-*/
-void QDeclarativeEnginePrivate::resolveTypeInNamespace(ImportedNamespace* ns, const QByteArray& type, QDeclarativeType** type_return, QUrl* url_return, int *vmaj, int *vmin ) const
-{
- ns->find(type,vmaj,vmin,type_return,url_return);
-}
-
static void voidptr_destructor(void *v)
{
void **ptr = (void **)v;
diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h
index 743275e3e5..0b1c17daef 100644
--- a/src/declarative/qml/qdeclarativeengine_p.h
+++ b/src/declarative/qml/qdeclarativeengine_p.h
@@ -57,6 +57,7 @@
#include "private/qdeclarativeclassfactory_p.h"
#include "private/qdeclarativecompositetypemanager_p.h"
+#include "private/qdeclarativeimport_p.h"
#include "private/qpodvector_p.h"
#include "qdeclarative.h"
#include "private/qdeclarativevaluetype_p.h"
@@ -90,6 +91,7 @@ class QDeclarativeEngine;
class QDeclarativeContextPrivate;
class QDeclarativeExpression;
class QDeclarativeContextScriptClass;
+class QDeclarativeImportDatabase;
class QDeclarativeObjectScriptClass;
class QDeclarativeTypeNameScriptClass;
class QDeclarativeValueTypeScriptClass;
@@ -164,7 +166,6 @@ public:
bool outputWarningsToStdErr;
- struct ImportedNamespace;
QDeclarativeContextScriptClass *contextClass;
QDeclarativeContextData *sharedContext;
QObject *sharedScope;
@@ -217,8 +218,13 @@ public:
QList<SimpleList<QDeclarativeAbstractBinding> > bindValues;
QList<SimpleList<QDeclarativeParserStatus> > parserStatus;
+ QList<QPair<QDeclarativeGuard<QObject>,int> > finalizedParserStatus;
QDeclarativeComponentAttached *componentAttached;
+ void registerFinalizedParserStatusObject(QObject *obj, int index) {
+ finalizedParserStatus.append(qMakePair(QDeclarativeGuard<QObject>(obj), index));
+ }
+
bool inBeginCreate;
QNetworkAccessManager *createNetworkAccessManager(QObject *parent) const;
@@ -232,8 +238,8 @@ public:
mutable QMutex mutex;
QDeclarativeCompositeTypeManager typeManager;
- QStringList fileImportPath;
- QStringList filePluginPath;
+ QDeclarativeImportDatabase importDatabase;
+
QString offlineStoragePath;
mutable quint32 uniqueId;
@@ -244,58 +250,8 @@ public:
QDeclarativeValueTypeFactory valueTypes;
QHash<const QMetaObject *, QDeclarativePropertyCache *> propertyCache;
- QDeclarativePropertyCache *cache(QObject *obj) {
- Q_Q(QDeclarativeEngine);
- if (!obj || QObjectPrivate::get(obj)->metaObject ||
- QObjectPrivate::get(obj)->wasDeleted) return 0;
- const QMetaObject *mo = obj->metaObject();
- QDeclarativePropertyCache *rv = propertyCache.value(mo);
- if (!rv) {
- rv = QDeclarativePropertyCache::create(q, mo);
- propertyCache.insert(mo, rv);
- }
- return rv;
- }
-
- // ### This whole class is embarrassing
- struct Imports {
- Imports();
- ~Imports();
- Imports(const Imports &copy);
- Imports &operator =(const Imports &copy);
-
- void setBaseUrl(const QUrl& url);
- QUrl baseUrl() const;
-
- void cache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *) const;
-
- private:
- friend class QDeclarativeEnginePrivate;
- QDeclarativeImportsPrivate *d;
- };
-
-
- QSet<QString> initializedPlugins;
-
- QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, const QString &baseName,
- const QStringList &suffixes,
- const QString &prefix = QString());
- QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, const QString &baseName);
-
-
- bool addToImport(Imports*, const QDeclarativeDirComponents &qmldircomponentsnetwork,
- const QString& uri, const QString& prefix, int vmaj, int vmin,
- QDeclarativeScriptParser::Import::Type importType,
- QString *errorString) const;
- bool resolveType(const Imports&, const QByteArray& type,
- QDeclarativeType** type_return, QUrl* url_return,
- int *version_major, int *version_minor,
- ImportedNamespace** ns_return,
- QString *errorString = 0) const;
- void resolveTypeInNamespace(ImportedNamespace*, const QByteArray& type,
- QDeclarativeType** type_return, QUrl* url_return,
- int *version_major, int *version_minor ) const;
-
+ inline QDeclarativePropertyCache *cache(QObject *obj);
+ inline QDeclarativePropertyCache *cache(const QMetaObject *);
void registerCompositeType(QDeclarativeCompiledData *);
@@ -339,6 +295,7 @@ public:
static QScriptValue tint(QScriptContext*, QScriptEngine*);
static QScriptValue desktopOpenUrl(QScriptContext*, QScriptEngine*);
+ static QScriptValue fontFamilies(QScriptContext*, QScriptEngine*);
static QScriptValue md5(QScriptContext*, QScriptEngine*);
static QScriptValue btoa(QScriptContext*, QScriptEngine*);
static QScriptValue atob(QScriptContext*, QScriptEngine*);
@@ -361,6 +318,48 @@ public:
static void defineModule();
};
+/*!
+Returns a QDeclarativePropertyCache for \a obj if one is available.
+
+If \a obj is null, being deleted or contains a dynamic meta object 0
+is returned.
+*/
+QDeclarativePropertyCache *QDeclarativeEnginePrivate::cache(QObject *obj)
+{
+ Q_Q(QDeclarativeEngine);
+ if (!obj || QObjectPrivate::get(obj)->metaObject || QObjectPrivate::get(obj)->wasDeleted)
+ return 0;
+
+ const QMetaObject *mo = obj->metaObject();
+ QDeclarativePropertyCache *rv = propertyCache.value(mo);
+ if (!rv) {
+ rv = new QDeclarativePropertyCache(q, mo);
+ propertyCache.insert(mo, rv);
+ }
+ return rv;
+}
+
+/*!
+Returns a QDeclarativePropertyCache for \a metaObject.
+
+As the cache is persisted for the life of the engine, \a metaObject must be
+a static "compile time" meta-object, or a meta-object that is otherwise known to
+exist for the lifetime of the QDeclarativeEngine.
+*/
+QDeclarativePropertyCache *QDeclarativeEnginePrivate::cache(const QMetaObject *metaObject)
+{
+ Q_Q(QDeclarativeEngine);
+ Q_ASSERT(metaObject);
+
+ QDeclarativePropertyCache *rv = propertyCache.value(metaObject);
+ if (!rv) {
+ rv = new QDeclarativePropertyCache(q, metaObject);
+ propertyCache.insert(metaObject, rv);
+ }
+
+ return rv;
+}
+
QT_END_NAMESPACE
#endif // QDECLARATIVEENGINE_P_H
diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp
index f561a7edc7..5ceb918341 100644
--- a/src/declarative/qml/qdeclarativeexpression.cpp
+++ b/src/declarative/qml/qdeclarativeexpression.cpp
@@ -57,10 +57,12 @@ QT_BEGIN_NAMESPACE
bool QDeclarativeDelayedError::addError(QDeclarativeEnginePrivate *e)
{
- if (!e || prevError) return false;
+ if (!e) return false;
if (e->inProgressCreations == 0) return false; // Not in construction
+ if (prevError) return true; // Already in error chain
+
prevError = &e->erroredBindings;
nextError = e->erroredBindings;
e->erroredBindings = this;
diff --git a/src/declarative/qml/qdeclarativeextensionplugin.cpp b/src/declarative/qml/qdeclarativeextensionplugin.cpp
index 2c15385337..c2e8300851 100644
--- a/src/declarative/qml/qdeclarativeextensionplugin.cpp
+++ b/src/declarative/qml/qdeclarativeextensionplugin.cpp
@@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE
See \l {Tutorial: Writing QML extensions with C++} for details on creating
QML extensions, including how to build a plugin with with QDeclarativeExtensionPlugin.
- For a simple overview, see the \l{declarative/plugins}{plugins} example.
+ For a simple overview, see the \l{declarative/cppextensions/plugins}{plugins} example.
Also see \l {How to Create Qt Plugins} for general Qt plugin documentation.
diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
index fc802b48b5..6e107fb685 100644
--- a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
@@ -53,19 +53,29 @@ QT_BEGIN_NAMESPACE
QDeclarativeGlobalScriptClass::QDeclarativeGlobalScriptClass(QScriptEngine *engine)
: QScriptClass(engine)
{
+ QString eval = QLatin1String("eval");
+
QScriptValue globalObject = engine->globalObject();
+
m_globalObject = engine->newObject();
+ QScriptValue newGlobalObject = engine->newObject();
QScriptValueIterator iter(globalObject);
+
while (iter.hasNext()) {
iter.next();
- m_globalObject.setProperty(iter.scriptName(), iter.value());
- m_illegalNames.insert(iter.name());
+
+ QString name = iter.name();
+
+ if (name != eval)
+ m_globalObject.setProperty(iter.scriptName(), iter.value());
+ newGlobalObject.setProperty(iter.scriptName(), iter.value());
+
+ m_illegalNames.insert(name);
}
- QScriptValue v = engine->newObject();
- v.setScriptClass(this);
- engine->setGlobalObject(v);
+ newGlobalObject.setScriptClass(this);
+ engine->setGlobalObject(newGlobalObject);
}
QScriptClass::QueryFlags
diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h
index 1b34aee203..7690eddbcb 100644
--- a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h
+++ b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h
@@ -76,6 +76,7 @@ public:
void explicitSetProperty(const QString &, const QScriptValue &);
const QScriptValue &globalObject() const { return m_globalObject; }
+
const QSet<QString> &illegalNames() const { return m_illegalNames; }
private:
diff --git a/src/declarative/qml/qdeclarativeguard_p.h b/src/declarative/qml/qdeclarativeguard_p.h
index be60ce4220..02fed0b021 100644
--- a/src/declarative/qml/qdeclarativeguard_p.h
+++ b/src/declarative/qml/qdeclarativeguard_p.h
@@ -97,7 +97,7 @@ private:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QDeclarativeGuard<QObject>);
+Q_DECLARE_METATYPE(QDeclarativeGuard<QObject>)
#include "private/qdeclarativedata_p.h"
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp
new file mode 100644
index 0000000000..576e04813f
--- /dev/null
+++ b/src/declarative/qml/qdeclarativeimport.cpp
@@ -0,0 +1,925 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdeclarativeimport_p.h"
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qpluginloader.h>
+#include <QtCore/qlibraryinfo.h>
+#include <QtDeclarative/qdeclarativeextensioninterface.h>
+#include <private/qdeclarativeglobal_p.h>
+#include <private/qdeclarativetypenamecache_p.h>
+
+QT_BEGIN_NAMESPACE
+
+DEFINE_BOOL_CONFIG_OPTION(qmlImportTrace, QML_IMPORT_TRACE)
+DEFINE_BOOL_CONFIG_OPTION(qmlCheckTypes, QML_CHECK_TYPES)
+
+static QString toLocalFileOrQrc(const QUrl& url)
+{
+ if (url.scheme().compare(QLatin1String("qrc"), Qt::CaseInsensitive) == 0) {
+ if (url.authority().isEmpty())
+ return QLatin1Char(':') + url.path();
+ return QString();
+ }
+ return url.toLocalFile();
+}
+
+static bool greaterThan(const QString &s1, const QString &s2)
+{
+ return s1 > s2;
+}
+
+typedef QMap<QString, QString> StringStringMap;
+Q_GLOBAL_STATIC(StringStringMap, qmlEnginePluginsWithRegisteredTypes); // stores the uri
+
+class QDeclarativeImportedNamespace
+{
+public:
+ QStringList uris;
+ QStringList urls;
+ QList<int> majversions;
+ QList<int> minversions;
+ QList<bool> isLibrary;
+ QList<QDeclarativeDirComponents> qmlDirComponents;
+
+
+ bool find_helper(int i, const QByteArray& type, int *vmajor, int *vminor,
+ QDeclarativeType** type_return, QUrl* url_return,
+ QUrl *base = 0, bool *typeRecursionDetected = 0);
+ bool find(const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return,
+ QUrl* url_return, QUrl *base = 0, QString *errorString = 0);
+};
+
+class QDeclarativeImportsPrivate {
+public:
+ QDeclarativeImportsPrivate();
+ ~QDeclarativeImportsPrivate();
+
+ bool importExtension(const QString &absoluteFilePath, const QString &uri,
+ QDeclarativeImportDatabase *database, QDeclarativeDirComponents* components,
+ QString *errorString);
+
+ QString resolvedUri(const QString &dir_arg, QDeclarativeImportDatabase *database);
+ bool add(const QDeclarativeDirComponents &qmldircomponentsnetwork,
+ const QString& uri_arg, const QString& prefix,
+ int vmaj, int vmin, QDeclarativeScriptParser::Import::Type importType,
+ QDeclarativeImportDatabase *database, QString *errorString);
+ bool find(const QByteArray& type, int *vmajor, int *vminor,
+ QDeclarativeType** type_return, QUrl* url_return, QString *errorString);
+
+ QDeclarativeImportedNamespace *findNamespace(const QString& type);
+
+ QUrl base;
+ int ref;
+
+ QSet<QString> qmlDirFilesForWhichPluginsHaveBeenLoaded;
+ QDeclarativeImportedNamespace unqualifiedset;
+ QHash<QString,QDeclarativeImportedNamespace* > set;
+};
+
+QDeclarativeImports::QDeclarativeImports(const QDeclarativeImports &copy)
+: d(copy.d)
+{
+ ++d->ref;
+}
+
+QDeclarativeImports &
+QDeclarativeImports::operator =(const QDeclarativeImports &copy)
+{
+ ++copy.d->ref;
+ if (--d->ref == 0)
+ delete d;
+ d = copy.d;
+ return *this;
+}
+
+QDeclarativeImports::QDeclarativeImports()
+: d(new QDeclarativeImportsPrivate)
+{
+}
+
+QDeclarativeImports::~QDeclarativeImports()
+{
+ if (--d->ref == 0)
+ delete d;
+}
+
+/*!
+ Sets the base URL to be used for all relative file imports added.
+*/
+void QDeclarativeImports::setBaseUrl(const QUrl& url)
+{
+ d->base = url;
+}
+
+/*!
+ Returns the base URL to be used for all relative file imports added.
+*/
+QUrl QDeclarativeImports::baseUrl() const
+{
+ return d->base;
+}
+
+static QDeclarativeTypeNameCache *
+cacheForNamespace(QDeclarativeEngine *engine, const QDeclarativeImportedNamespace &set,
+ QDeclarativeTypeNameCache *cache)
+{
+ if (!cache)
+ cache = new QDeclarativeTypeNameCache(engine);
+
+ QList<QDeclarativeType *> types = QDeclarativeMetaType::qmlTypes();
+
+ for (int ii = 0; ii < set.uris.count(); ++ii) {
+ QByteArray base = set.uris.at(ii).toUtf8() + '/';
+ int major = set.majversions.at(ii);
+ int minor = set.minversions.at(ii);
+
+ foreach (QDeclarativeType *type, types) {
+ if (type->qmlTypeName().startsWith(base) &&
+ type->qmlTypeName().lastIndexOf('/') == (base.length() - 1) &&
+ type->availableInVersion(major,minor))
+ {
+ QString name = QString::fromUtf8(type->qmlTypeName().mid(base.length()));
+
+ cache->add(name, type);
+ }
+ }
+ }
+
+ return cache;
+}
+
+void QDeclarativeImports::cache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *engine) const
+{
+ const QDeclarativeImportedNamespace &set = d->unqualifiedset;
+
+ for (QHash<QString,QDeclarativeImportedNamespace* >::ConstIterator iter = d->set.begin();
+ iter != d->set.end(); ++iter) {
+
+ QDeclarativeTypeNameCache::Data *d = cache->data(iter.key());
+ if (d) {
+ if (!d->typeNamespace)
+ cacheForNamespace(engine, *(*iter), d->typeNamespace);
+ } else {
+ QDeclarativeTypeNameCache *nc = cacheForNamespace(engine, *(*iter), 0);
+ cache->add(iter.key(), nc);
+ nc->release();
+ }
+ }
+
+ cacheForNamespace(engine, set, cache);
+}
+bool QDeclarativeImportedNamespace::find_helper(int i, const QByteArray& type, int *vmajor, int *vminor,
+ QDeclarativeType** type_return, QUrl* url_return,
+ QUrl *base, bool *typeRecursionDetected)
+{
+ int vmaj = majversions.at(i);
+ int vmin = minversions.at(i);
+
+ QByteArray qt = uris.at(i).toUtf8();
+ qt += '/';
+ qt += type;
+
+ QDeclarativeType *t = QDeclarativeMetaType::qmlType(qt,vmaj,vmin);
+ if (t) {
+ if (vmajor) *vmajor = vmaj;
+ if (vminor) *vminor = vmin;
+ if (type_return)
+ *type_return = t;
+ return true;
+ }
+
+ QUrl url = QUrl(urls.at(i) + QLatin1Char('/') + QString::fromUtf8(type) + QLatin1String(".qml"));
+ QDeclarativeDirComponents qmldircomponents = qmlDirComponents.at(i);
+
+ bool typeWasDeclaredInQmldir = false;
+ if (!qmldircomponents.isEmpty()) {
+ const QString typeName = QString::fromUtf8(type);
+ foreach (const QDeclarativeDirParser::Component &c, qmldircomponents) {
+ if (c.typeName == typeName) {
+ typeWasDeclaredInQmldir = true;
+
+ // importing version -1 means import ALL versions
+ if ((vmaj == -1) || (c.majorVersion < vmaj || (c.majorVersion == vmaj && vmin >= c.minorVersion))) {
+ QUrl candidate = url.resolved(QUrl(c.fileName));
+ if (c.internal && base) {
+ if (base->resolved(QUrl(c.fileName)) != candidate)
+ continue; // failed attempt to access an internal type
+ }
+ if (base && *base == candidate) {
+ if (typeRecursionDetected)
+ *typeRecursionDetected = true;
+ continue; // no recursion
+ }
+ if (url_return)
+ *url_return = candidate;
+ return true;
+ }
+ }
+ }
+ }
+
+ if (!typeWasDeclaredInQmldir && !isLibrary.at(i)) {
+ // XXX search non-files too! (eg. zip files, see QT-524)
+ QFileInfo f(toLocalFileOrQrc(url));
+ if (f.exists()) {
+ if (base && *base == url) { // no recursion
+ if (typeRecursionDetected)
+ *typeRecursionDetected = true;
+ } else {
+ if (url_return)
+ *url_return = url;
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+QDeclarativeImportsPrivate::QDeclarativeImportsPrivate()
+: ref(1)
+{
+}
+
+QDeclarativeImportsPrivate::~QDeclarativeImportsPrivate()
+{
+ foreach (QDeclarativeImportedNamespace* s, set.values())
+ delete s;
+}
+
+bool QDeclarativeImportsPrivate::importExtension(const QString &absoluteFilePath, const QString &uri,
+ QDeclarativeImportDatabase *database,
+ QDeclarativeDirComponents* components, QString *errorString)
+{
+ QFile file(absoluteFilePath);
+ QString filecontent;
+ if (file.open(QFile::ReadOnly)) {
+ filecontent = QString::fromUtf8(file.readAll());
+ if (qmlImportTrace())
+ qDebug() << "QDeclarativeImportDatabase::add: loaded" << absoluteFilePath;
+ } else {
+ if (errorString)
+ *errorString = QDeclarativeImportDatabase::tr("module \"%1\" definition \"%2\" not readable").arg(uri).arg(absoluteFilePath);
+ return false;
+ }
+ QDir dir = QFileInfo(file).dir();
+
+ QDeclarativeDirParser qmldirParser;
+ qmldirParser.setSource(filecontent);
+ qmldirParser.parse();
+
+ if (! qmlDirFilesForWhichPluginsHaveBeenLoaded.contains(absoluteFilePath)) {
+ qmlDirFilesForWhichPluginsHaveBeenLoaded.insert(absoluteFilePath);
+
+
+ foreach (const QDeclarativeDirParser::Plugin &plugin, qmldirParser.plugins()) {
+
+ QString resolvedFilePath = database->resolvePlugin(dir, plugin.path, plugin.name);
+
+ if (!resolvedFilePath.isEmpty()) {
+ if (!database->importPlugin(resolvedFilePath, uri, errorString)) {
+ if (errorString)
+ *errorString = QDeclarativeImportDatabase::tr("plugin cannot be loaded for module \"%1\": %2").arg(uri).arg(*errorString);
+ return false;
+ }
+ } else {
+ if (errorString)
+ *errorString = QDeclarativeImportDatabase::tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name);
+ return false;
+ }
+ }
+ }
+
+ if (components)
+ *components = qmldirParser.components();
+
+ return true;
+}
+
+QString QDeclarativeImportsPrivate::resolvedUri(const QString &dir_arg, QDeclarativeImportDatabase *database)
+{
+ QString dir = dir_arg;
+ if (dir.endsWith(QLatin1Char('/')) || dir.endsWith(QLatin1Char('\\')))
+ dir.chop(1);
+
+ QStringList paths = database->fileImportPath;
+ qSort(paths.begin(), paths.end(), greaterThan); // Ensure subdirs preceed their parents.
+
+ QString stableRelativePath = dir;
+ foreach( QString path, paths) {
+ if (dir.startsWith(path)) {
+ stableRelativePath = dir.mid(path.length()+1);
+ break;
+ }
+ }
+ stableRelativePath.replace(QLatin1Char('/'), QLatin1Char('.'));
+ stableRelativePath.replace(QLatin1Char('\\'), QLatin1Char('.'));
+ return stableRelativePath;
+}
+
+bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomponentsnetwork,
+ const QString& uri_arg, const QString& prefix, int vmaj, int vmin,
+ QDeclarativeScriptParser::Import::Type importType,
+ QDeclarativeImportDatabase *database, QString *errorString)
+{
+ QDeclarativeDirComponents qmldircomponents = qmldircomponentsnetwork;
+ QString uri = uri_arg;
+ QDeclarativeImportedNamespace *s;
+ if (prefix.isEmpty()) {
+ s = &unqualifiedset;
+ } else {
+ s = set.value(prefix);
+ if (!s)
+ set.insert(prefix,(s=new QDeclarativeImportedNamespace));
+ }
+
+ QString url = uri;
+ if (importType == QDeclarativeScriptParser::Import::Library) {
+ url.replace(QLatin1Char('.'), QLatin1Char('/'));
+ bool found = false;
+ QString dir;
+
+
+ foreach (const QString &p, database->fileImportPath) {
+ dir = p+QLatin1Char('/')+url;
+
+ QFileInfo fi(dir+QLatin1String("/qmldir"));
+ const QString absoluteFilePath = fi.absoluteFilePath();
+
+ if (fi.isFile()) {
+ found = true;
+
+ url = QUrl::fromLocalFile(fi.absolutePath()).toString();
+ uri = resolvedUri(dir, database);
+ if (!importExtension(absoluteFilePath, uri, database, &qmldircomponents, errorString))
+ return false;
+ break;
+ }
+ }
+
+ if (!found) {
+ found = QDeclarativeMetaType::isModule(uri.toUtf8(), vmaj, vmin);
+ if (!found) {
+ if (errorString) {
+ bool anyversion = QDeclarativeMetaType::isModule(uri.toUtf8(), -1, -1);
+ if (anyversion)
+ *errorString = QDeclarativeImportDatabase::tr("module \"%1\" version %2.%3 is not installed").arg(uri_arg).arg(vmaj).arg(vmin);
+ else
+ *errorString = QDeclarativeImportDatabase::tr("module \"%1\" is not installed").arg(uri_arg);
+ }
+ return false;
+ }
+ }
+ } else {
+
+ if (importType == QDeclarativeScriptParser::Import::File && qmldircomponents.isEmpty()) {
+ QUrl importUrl = base.resolved(QUrl(uri + QLatin1String("/qmldir")));
+ QString localFileOrQrc = toLocalFileOrQrc(importUrl);
+ if (!localFileOrQrc.isEmpty()) {
+ QString dir = toLocalFileOrQrc(base.resolved(QUrl(uri)));
+ if (dir.isEmpty() || !QDir().exists(dir)) {
+ if (errorString)
+ *errorString = QDeclarativeImportDatabase::tr("\"%1\": no such directory").arg(uri_arg);
+ return false; // local import dirs must exist
+ }
+ uri = resolvedUri(toLocalFileOrQrc(base.resolved(QUrl(uri))), database);
+ if (uri.endsWith(QLatin1Char('/')))
+ uri.chop(1);
+ if (QFile::exists(localFileOrQrc)) {
+ if (!importExtension(localFileOrQrc,uri,database,&qmldircomponents,errorString))
+ return false;
+ }
+ } else {
+ if (prefix.isEmpty()) {
+ // directory must at least exist for valid import
+ QString localFileOrQrc = toLocalFileOrQrc(base.resolved(QUrl(uri)));
+ if (localFileOrQrc.isEmpty() || !QDir().exists(localFileOrQrc)) {
+ if (errorString) {
+ if (localFileOrQrc.isEmpty())
+ *errorString = QDeclarativeImportDatabase::tr("import \"%1\" has no qmldir and no namespace").arg(uri);
+ else
+ *errorString = QDeclarativeImportDatabase::tr("\"%1\": no such directory").arg(uri);
+ }
+ return false;
+ }
+ }
+ }
+ }
+
+ url = base.resolved(QUrl(url)).toString();
+ if (url.endsWith(QLatin1Char('/')))
+ url.chop(1);
+ }
+
+ if (vmaj > -1 && vmin > -1 && !qmldircomponents.isEmpty()) {
+ QList<QDeclarativeDirParser::Component>::ConstIterator it = qmldircomponents.begin();
+ for (; it != qmldircomponents.end(); ++it) {
+ if (it->majorVersion > vmaj || (it->majorVersion == vmaj && it->minorVersion >= vmin))
+ break;
+ }
+ if (it == qmldircomponents.end()) {
+ *errorString = QDeclarativeImportDatabase::tr("module \"%1\" version %2.%3 is not installed").arg(uri_arg).arg(vmaj).arg(vmin);
+ return false;
+ }
+ }
+
+ s->uris.prepend(uri);
+ s->urls.prepend(url);
+ s->majversions.prepend(vmaj);
+ s->minversions.prepend(vmin);
+ s->isLibrary.prepend(importType == QDeclarativeScriptParser::Import::Library);
+ s->qmlDirComponents.prepend(qmldircomponents);
+ return true;
+}
+
+bool QDeclarativeImportsPrivate::find(const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return,
+ QUrl* url_return, QString *errorString)
+{
+ QDeclarativeImportedNamespace *s = 0;
+ int slash = type.indexOf('/');
+ if (slash >= 0) {
+ QString namespaceName = QString::fromUtf8(type.left(slash));
+ s = set.value(namespaceName);
+ if (!s) {
+ if (errorString)
+ *errorString = QDeclarativeImportDatabase::tr("- %1 is not a namespace").arg(namespaceName);
+ return false;
+ }
+ int nslash = type.indexOf('/',slash+1);
+ if (nslash > 0) {
+ if (errorString)
+ *errorString = QDeclarativeImportDatabase::tr("- nested namespaces not allowed");
+ return false;
+ }
+ } else {
+ s = &unqualifiedset;
+ }
+ QByteArray unqualifiedtype = slash < 0 ? type : type.mid(slash+1); // common-case opt (QString::mid works fine, but slower)
+ if (s) {
+ if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return, &base, errorString))
+ return true;
+ if (s->urls.count() == 1 && !s->isLibrary[0] && url_return && s != &unqualifiedset) {
+ // qualified, and only 1 url
+ *url_return = QUrl(s->urls[0]+QLatin1Char('/')).resolved(QUrl(QString::fromUtf8(unqualifiedtype) + QLatin1String(".qml")));
+ return true;
+ }
+ }
+
+ return false;
+}
+
+QDeclarativeImportedNamespace *QDeclarativeImportsPrivate::findNamespace(const QString& type)
+{
+ return set.value(type);
+}
+
+bool QDeclarativeImportedNamespace::find(const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return,
+ QUrl* url_return, QUrl *base, QString *errorString)
+{
+ bool typeRecursionDetected = false;
+ for (int i=0; i<urls.count(); ++i) {
+ if (find_helper(i, type, vmajor, vminor, type_return, url_return, base, &typeRecursionDetected)) {
+ if (qmlCheckTypes()) {
+ // check for type clashes
+ for (int j = i+1; j<urls.count(); ++j) {
+ if (find_helper(j, type, vmajor, vminor, 0, 0, base)) {
+ if (errorString) {
+ QString u1 = urls.at(i);
+ QString u2 = urls.at(j);
+ if (base) {
+ QString b = base->toString();
+ int slash = b.lastIndexOf(QLatin1Char('/'));
+ if (slash >= 0) {
+ b = b.left(slash+1);
+ QString l = b.left(slash);
+ if (u1.startsWith(b))
+ u1 = u1.mid(b.count());
+ else if (u1 == l)
+ u1 = QDeclarativeImportDatabase::tr("local directory");
+ if (u2.startsWith(b))
+ u2 = u2.mid(b.count());
+ else if (u2 == l)
+ u2 = QDeclarativeImportDatabase::tr("local directory");
+ }
+ }
+
+ if (u1 != u2)
+ *errorString
+ = QDeclarativeImportDatabase::tr("is ambiguous. Found in %1 and in %2")
+ .arg(u1).arg(u2);
+ else
+ *errorString
+ = QDeclarativeImportDatabase::tr("is ambiguous. Found in %1 in version %2.%3 and %4.%5")
+ .arg(u1)
+ .arg(majversions.at(i)).arg(minversions.at(i))
+ .arg(majversions.at(j)).arg(minversions.at(j));
+ }
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ }
+ if (errorString) {
+ if (typeRecursionDetected)
+ *errorString = QDeclarativeImportDatabase::tr("is instantiated recursively");
+ else
+ *errorString = QDeclarativeImportDatabase::tr("is not a type");
+ }
+ return false;
+}
+
+QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e)
+: engine(e)
+{
+ filePluginPath << QLatin1String(".");
+
+ QString builtinPath = QLibraryInfo::location(QLibraryInfo::ImportsPath);
+ if (!builtinPath.isEmpty())
+ addImportPath(builtinPath);
+
+ // env import paths
+ QByteArray envImportPath = qgetenv("QML_IMPORT_PATH");
+ if (!envImportPath.isEmpty()) {
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ QLatin1Char pathSep(';');
+#else
+ QLatin1Char pathSep(':');
+#endif
+ QStringList paths = QString::fromLatin1(envImportPath).split(pathSep, QString::SkipEmptyParts);
+ for (int ii = paths.count() - 1; ii >= 0; --ii)
+ addImportPath(paths.at(ii));
+ }
+}
+
+QDeclarativeImportDatabase::~QDeclarativeImportDatabase()
+{
+}
+
+/*!
+ \internal
+
+ Adds information to \a imports such that subsequent calls to resolveType()
+ will resolve types qualified by \a prefix by considering types found at the given \a uri.
+
+ The uri is either a directory (if importType is FileImport), or a URI resolved using paths
+ added via addImportPath() (if importType is LibraryImport).
+
+ The \a prefix may be empty, in which case the import location is considered for
+ unqualified types.
+
+ The base URL must already have been set with Import::setBaseUrl().
+*/
+bool QDeclarativeImportDatabase::addToImport(QDeclarativeImports* imports,
+ const QDeclarativeDirComponents &qmldircomponentsnetwork,
+ const QString& uri, const QString& prefix, int vmaj, int vmin,
+ QDeclarativeScriptParser::Import::Type importType,
+ QString *errorString)
+{
+ if (qmlImportTrace())
+ qDebug().nospace() << "QDeclarativeImportDatabase::addToImport " << imports << " " << uri << " "
+ << vmaj << '.' << vmin << " "
+ << (importType==QDeclarativeScriptParser::Import::Library? "Library" : "File")
+ << " as " << prefix;
+
+ bool ok = imports->d->add(qmldircomponentsnetwork, uri, prefix, vmaj, vmin, importType, this, errorString);
+ return ok;
+}
+
+/*!
+ \internal
+
+ Using the given \a imports, the given (namespace qualified) \a type is resolved to either
+ a QDeclarativeImportedNamespace stored at \a ns_return,
+ a QDeclarativeType stored at \a type_return, or
+ a component located at \a url_return.
+
+ If any return pointer is 0, the corresponding search is not done.
+
+ \sa addToImport()
+*/
+bool QDeclarativeImportDatabase::resolveType(const QDeclarativeImports& imports, const QByteArray& type,
+ QDeclarativeType** type_return, QUrl* url_return, int *vmaj, int *vmin,
+ QDeclarativeImportedNamespace** ns_return, QString *errorString) const
+{
+ QDeclarativeImportedNamespace* ns = imports.d->findNamespace(QString::fromUtf8(type));
+ if (ns) {
+ if (ns_return)
+ *ns_return = ns;
+ return true;
+ }
+ if (type_return || url_return) {
+ if (imports.d->find(type,vmaj,vmin,type_return,url_return, errorString)) {
+ if (qmlImportTrace()) {
+ if (type_return && *type_return && url_return && !url_return->isEmpty())
+ qDebug() << "QDeclarativeImportDatabase::resolveType" << type << '=' << (*type_return)->typeName() << *url_return;
+ if (type_return && *type_return)
+ qDebug() << "QDeclarativeImportDatabase::resolveType" << type << '=' << (*type_return)->typeName();
+ if (url_return && !url_return->isEmpty())
+ qDebug() << "QDeclarativeImportDatabase::resolveType" << type << '=' << *url_return;
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+/*!
+ \internal
+
+ Searching \e only in the namespace \a ns (previously returned in a call to
+ resolveType(), \a type is found and returned to either
+ a QDeclarativeType stored at \a type_return, or
+ a component located at \a url_return.
+
+ If either return pointer is 0, the corresponding search is not done.
+*/
+void QDeclarativeImportDatabase::resolveTypeInNamespace(QDeclarativeImportedNamespace* ns, const QByteArray& type,
+ QDeclarativeType** type_return, QUrl* url_return,
+ int *vmaj, int *vmin) const
+{
+ ns->find(type,vmaj,vmin,type_return,url_return);
+}
+
+/*!
+ \internal
+
+ Returns the result of the merge of \a baseName with \a path, \a suffixes, and \a prefix.
+ The \a prefix must contain the dot.
+
+ \a qmldirPath is the location of the qmldir file.
+ */
+QString QDeclarativeImportDatabase::resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath,
+ const QString &baseName, const QStringList &suffixes,
+ const QString &prefix)
+{
+ QStringList searchPaths = filePluginPath;
+ bool qmldirPluginPathIsRelative = QDir::isRelativePath(qmldirPluginPath);
+ if (!qmldirPluginPathIsRelative)
+ searchPaths.prepend(qmldirPluginPath);
+
+ foreach (const QString &pluginPath, searchPaths) {
+
+ QString resolvedPath;
+
+ if (pluginPath == QLatin1String(".")) {
+ if (qmldirPluginPathIsRelative)
+ resolvedPath = qmldirPath.absoluteFilePath(qmldirPluginPath);
+ else
+ resolvedPath = qmldirPath.absolutePath();
+ } else {
+ resolvedPath = pluginPath;
+ }
+
+ // hack for resources, should probably go away
+ if (resolvedPath.startsWith(QLatin1Char(':')))
+ resolvedPath = QCoreApplication::applicationDirPath();
+
+ QDir dir(resolvedPath);
+ foreach (const QString &suffix, suffixes) {
+ QString pluginFileName = prefix;
+
+ pluginFileName += baseName;
+ pluginFileName += suffix;
+
+ QFileInfo fileInfo(dir, pluginFileName);
+
+ if (fileInfo.exists())
+ return fileInfo.absoluteFilePath();
+ }
+ }
+
+ if (qmlImportTrace())
+ qDebug() << "QDeclarativeImportDatabase::resolvePlugin: Could not resolve plugin" << baseName
+ << "in" << qmldirPath.absolutePath();
+
+ return QString();
+}
+
+/*!
+ \internal
+
+ Returns the result of the merge of \a baseName with \a dir and the platform suffix.
+
+ \table
+ \header \i Platform \i Valid suffixes
+ \row \i Windows \i \c .dll
+ \row \i Unix/Linux \i \c .so
+ \row \i AIX \i \c .a
+ \row \i HP-UX \i \c .sl, \c .so (HP-UXi)
+ \row \i Mac OS X \i \c .dylib, \c .bundle, \c .so
+ \row \i Symbian \i \c .dll
+ \endtable
+
+ Version number on unix are ignored.
+*/
+QString QDeclarativeImportDatabase::resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath,
+ const QString &baseName)
+{
+#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
+ return resolvePlugin(qmldirPath, qmldirPluginPath, baseName,
+ QStringList()
+# ifdef QT_DEBUG
+ << QLatin1String("d.dll") // try a qmake-style debug build first
+# endif
+ << QLatin1String(".dll"));
+#elif defined(Q_OS_SYMBIAN)
+ return resolvePlugin(qmldirPath, qmldirPluginPath, baseName,
+ QStringList()
+ << QLatin1String(".dll")
+ << QLatin1String(".qtplugin"));
+#else
+
+# if defined(Q_OS_DARWIN)
+
+ return resolvePlugin(qmldirPath, qmldirPluginPath, baseName,
+ QStringList()
+# ifdef QT_DEBUG
+ << QLatin1String("_debug.dylib") // try a qmake-style debug build first
+ << QLatin1String(".dylib")
+# else
+ << QLatin1String(".dylib")
+ << QLatin1String("_debug.dylib") // try a qmake-style debug build after
+# endif
+ << QLatin1String(".so")
+ << QLatin1String(".bundle"),
+ QLatin1String("lib"));
+# else // Generic Unix
+ QStringList validSuffixList;
+
+# if defined(Q_OS_HPUX)
+/*
+ See "HP-UX Linker and Libraries User's Guide", section "Link-time Differences between PA-RISC and IPF":
+ "In PA-RISC (PA-32 and PA-64) shared libraries are suffixed with .sl. In IPF (32-bit and 64-bit),
+ the shared libraries are suffixed with .so. For compatibility, the IPF linker also supports the .sl suffix."
+ */
+ validSuffixList << QLatin1String(".sl");
+# if defined __ia64
+ validSuffixList << QLatin1String(".so");
+# endif
+# elif defined(Q_OS_AIX)
+ validSuffixList << QLatin1String(".a") << QLatin1String(".so");
+# elif defined(Q_OS_UNIX)
+ validSuffixList << QLatin1String(".so");
+# endif
+
+ // Examples of valid library names:
+ // libfoo.so
+
+ return resolvePlugin(qmldirPath, qmldirPluginPath, baseName, validSuffixList, QLatin1String("lib"));
+# endif
+
+#endif
+}
+
+QStringList QDeclarativeImportDatabase::pluginPathList() const
+{
+ return filePluginPath;
+}
+
+void QDeclarativeImportDatabase::setPluginPathList(const QStringList &paths)
+{
+ filePluginPath = paths;
+}
+
+void QDeclarativeImportDatabase::addPluginPath(const QString& path)
+{
+ if (qmlImportTrace())
+ qDebug() << "QDeclarativeImportDatabase::addPluginPath" << path;
+
+ QUrl url = QUrl(path);
+ if (url.isRelative() || url.scheme() == QString::fromLocal8Bit("file")) {
+ QDir dir = QDir(path);
+ filePluginPath.prepend(dir.canonicalPath());
+ } else {
+ filePluginPath.prepend(path);
+ }
+}
+
+void QDeclarativeImportDatabase::addImportPath(const QString& path)
+{
+ if (qmlImportTrace())
+ qDebug() << "QDeclarativeImportDatabase::addImportPath" << path;
+
+ QUrl url = QUrl(path);
+ QString cPath;
+
+ if (url.isRelative() || url.scheme() == QString::fromLocal8Bit("file")) {
+ QDir dir = QDir(path);
+ cPath = dir.canonicalPath();
+ } else {
+ cPath = path;
+ }
+
+ if (!fileImportPath.contains(cPath))
+ fileImportPath.prepend(cPath);
+}
+
+QStringList QDeclarativeImportDatabase::importPathList() const
+{
+ return fileImportPath;
+}
+
+void QDeclarativeImportDatabase::setImportPathList(const QStringList &paths)
+{
+ fileImportPath = paths;
+}
+
+
+bool QDeclarativeImportDatabase::importPlugin(const QString &filePath, const QString &uri, QString *errorString)
+{
+ if (qmlImportTrace())
+ qDebug() << "QDeclarativeImportDatabase::importPlugin" << uri << "from" << filePath;
+
+ QFileInfo fileInfo(filePath);
+ const QString absoluteFilePath = fileInfo.absoluteFilePath();
+
+ bool engineInitialized = initializedPlugins.contains(absoluteFilePath);
+ bool typesRegistered = qmlEnginePluginsWithRegisteredTypes()->contains(absoluteFilePath);
+
+ if (typesRegistered) {
+ Q_ASSERT_X(qmlEnginePluginsWithRegisteredTypes()->value(absoluteFilePath) == uri,
+ "QDeclarativeImportDatabase::importExtension",
+ "Internal error: Plugin imported previously with different uri");
+ }
+
+ if (!engineInitialized || !typesRegistered) {
+ QPluginLoader loader(absoluteFilePath);
+
+ if (!loader.load()) {
+ if (errorString)
+ *errorString = loader.errorString();
+ return false;
+ }
+
+ if (QDeclarativeExtensionInterface *iface = qobject_cast<QDeclarativeExtensionInterface *>(loader.instance())) {
+
+ const QByteArray bytes = uri.toUtf8();
+ const char *moduleId = bytes.constData();
+ if (!typesRegistered) {
+
+ // ### this code should probably be protected with a mutex.
+ qmlEnginePluginsWithRegisteredTypes()->insert(absoluteFilePath, uri);
+ iface->registerTypes(moduleId);
+ }
+ if (!engineInitialized) {
+ // things on the engine (eg. adding new global objects) have to be done for every engine.
+
+ // protect against double initialization
+ initializedPlugins.insert(absoluteFilePath);
+ iface->initializeEngine(engine, moduleId);
+ }
+ } else {
+ if (errorString)
+ *errorString = loader.errorString();
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeimport_p.h b/src/declarative/qml/qdeclarativeimport_p.h
new file mode 100644
index 0000000000..62b0517405
--- /dev/null
+++ b/src/declarative/qml/qdeclarativeimport_p.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** 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 QDECLARATIVEIMPORT_P_H
+#define QDECLARATIVEIMPORT_P_H
+
+#include <QtCore/qurl.h>
+#include <QtCore/qcoreapplication.h>
+#include <QtCore/qset.h>
+#include <private/qdeclarativedirparser_p.h>
+#include <private/qdeclarativescriptparser_p.h>
+#include <private/qdeclarativemetatype_p.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeTypeNameCache;
+class QDeclarativeEngine;
+class QDir;
+
+class QDeclarativeImportedNamespace;
+class QDeclarativeImportsPrivate;
+class QDeclarativeImports
+{
+public:
+ QDeclarativeImports();
+ QDeclarativeImports(const QDeclarativeImports &);
+ ~QDeclarativeImports();
+ QDeclarativeImports &operator=(const QDeclarativeImports &);
+
+ void setBaseUrl(const QUrl &url);
+ QUrl baseUrl() const;
+
+ void cache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *) const;
+private:
+ friend class QDeclarativeImportDatabase;
+ QDeclarativeImportsPrivate *d;
+};
+
+class QDeclarativeImportDatabase
+{
+ Q_DECLARE_TR_FUNCTIONS(QDeclarativeImportDatabase)
+public:
+ QDeclarativeImportDatabase(QDeclarativeEngine *);
+ ~QDeclarativeImportDatabase();
+
+ bool importPlugin(const QString &filePath, const QString &uri, QString *errorString);
+
+ QStringList importPathList() const;
+ void setImportPathList(const QStringList &paths);
+ void addImportPath(const QString& dir);
+
+ QStringList pluginPathList() const;
+ void setPluginPathList(const QStringList &paths);
+ void addPluginPath(const QString& path);
+
+
+ bool addToImport(QDeclarativeImports*, const QDeclarativeDirComponents &qmldircomponentsnetwork,
+ const QString& uri, const QString& prefix, int vmaj, int vmin,
+ QDeclarativeScriptParser::Import::Type importType,
+ QString *errorString);
+ bool resolveType(const QDeclarativeImports&, const QByteArray& type,
+ QDeclarativeType** type_return, QUrl* url_return,
+ int *version_major, int *version_minor,
+ QDeclarativeImportedNamespace** ns_return,
+ QString *errorString = 0) const;
+ void resolveTypeInNamespace(QDeclarativeImportedNamespace*, const QByteArray& type,
+ QDeclarativeType** type_return, QUrl* url_return,
+ int *version_major, int *version_minor ) const;
+
+
+private:
+ friend class QDeclarativeImportsPrivate;
+ QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath,
+ const QString &baseName, const QStringList &suffixes,
+ const QString &prefix = QString());
+ QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath,
+ const QString &baseName);
+
+
+ QStringList filePluginPath;
+ QStringList fileImportPath;
+
+ QSet<QString> initializedPlugins;
+ QDeclarativeEngine *engine;
+};
+
+QT_END_NAMESPACE
+
+#endif // QDECLARATIVEIMPORT_P_H
+
diff --git a/src/declarative/qml/qdeclarativeinclude.cpp b/src/declarative/qml/qdeclarativeinclude.cpp
new file mode 100644
index 0000000000..619264abe9
--- /dev/null
+++ b/src/declarative/qml/qdeclarativeinclude.cpp
@@ -0,0 +1,316 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdeclarativeinclude_p.h"
+
+#include <QtScript/qscriptengine.h>
+#include <QtNetwork/qnetworkrequest.h>
+#include <QtNetwork/qnetworkreply.h>
+#include <QtCore/qfile.h>
+
+#include <private/qdeclarativeengine_p.h>
+#include <private/qdeclarativeglobalscriptclass_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QDeclarativeInclude::QDeclarativeInclude(const QUrl &url,
+ QDeclarativeEngine *engine,
+ QScriptContext *ctxt)
+: QObject(engine), m_engine(engine), m_network(0), m_reply(0), m_url(url), m_redirectCount(0)
+{
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
+ m_context = ep->contextClass->contextFromValue(QScriptDeclarativeClass::scopeChainValue(ctxt, -3));
+
+ m_scope[0] = QScriptDeclarativeClass::scopeChainValue(ctxt, -4);
+ m_scope[1] = QScriptDeclarativeClass::scopeChainValue(ctxt, -5);
+
+ m_scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
+ m_network = QDeclarativeScriptEngine::get(m_scriptEngine)->networkAccessManager();
+
+ m_result = resultValue(m_scriptEngine);
+
+ QNetworkRequest request;
+ request.setUrl(url);
+
+ m_reply = m_network->get(request);
+ QObject::connect(m_reply, SIGNAL(finished()), this, SLOT(finished()));
+}
+
+QDeclarativeInclude::~QDeclarativeInclude()
+{
+ delete m_reply;
+}
+
+QScriptValue QDeclarativeInclude::resultValue(QScriptEngine *engine, Status status)
+{
+ QScriptValue result = engine->newObject();
+ result.setProperty(QLatin1String("OK"), QScriptValue(engine, Ok));
+ result.setProperty(QLatin1String("LOADING"), QScriptValue(engine, Loading));
+ result.setProperty(QLatin1String("NETWORK_ERROR"), QScriptValue(engine, NetworkError));
+ result.setProperty(QLatin1String("EXCEPTION"), QScriptValue(engine, Exception));
+
+ result.setProperty(QLatin1String("status"), QScriptValue(engine, status));
+ return result;
+}
+
+QScriptValue QDeclarativeInclude::result() const
+{
+ return m_result;
+}
+
+void QDeclarativeInclude::setCallback(const QScriptValue &c)
+{
+ m_callback = c;
+}
+
+QScriptValue QDeclarativeInclude::callback() const
+{
+ return m_callback;
+}
+
+#define INCLUDE_MAXIMUM_REDIRECT_RECURSION 15
+void QDeclarativeInclude::finished()
+{
+ m_redirectCount++;
+
+ if (m_redirectCount < INCLUDE_MAXIMUM_REDIRECT_RECURSION) {
+ QVariant redirect = m_reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
+ if (redirect.isValid()) {
+ m_url = m_url.resolved(redirect.toUrl());
+ delete m_reply;
+
+ QNetworkRequest request;
+ request.setUrl(m_url);
+
+ m_reply = m_network->get(request);
+ QObject::connect(m_reply, SIGNAL(finished()), this, SLOT(finished()));
+ return;
+ }
+ }
+
+ if (m_reply->error() == QNetworkReply::NoError) {
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(m_engine);
+
+ QByteArray data = m_reply->readAll();
+
+ QString code = QString::fromUtf8(data);
+
+ QString urlString = m_url.toString();
+ QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(m_scriptEngine);
+ scriptContext->pushScope(ep->contextClass->newUrlContext(m_context, 0, urlString));
+ scriptContext->pushScope(m_scope[0]);
+
+ scriptContext->pushScope(m_scope[1]);
+ scriptContext->setActivationObject(m_scope[1]);
+
+ m_scriptEngine->evaluate(code, urlString, 1);
+
+ m_scriptEngine->popContext();
+
+ if (m_scriptEngine->hasUncaughtException()) {
+ m_result.setProperty(QLatin1String("status"), QScriptValue(m_scriptEngine, Exception));
+ m_result.setProperty(QLatin1String("exception"), m_scriptEngine->uncaughtException());
+ m_scriptEngine->clearExceptions();
+ } else {
+ m_result.setProperty(QLatin1String("status"), QScriptValue(m_scriptEngine, Ok));
+ }
+ } else {
+ m_result.setProperty(QLatin1String("status"), QScriptValue(m_scriptEngine, NetworkError));
+ }
+
+ callback(m_scriptEngine, m_callback, m_result);
+
+ disconnect();
+ deleteLater();
+}
+
+void QDeclarativeInclude::callback(QScriptEngine *engine, QScriptValue &callback, QScriptValue &status)
+{
+ if (callback.isValid()) {
+ QScriptValue args = engine->newArray(1);
+ args.setProperty(0, status);
+ callback.call(QScriptValue(), args);
+ }
+}
+
+static QString toLocalFileOrQrc(const QUrl& url)
+{
+ if (url.scheme() == QLatin1String("qrc")) {
+ if (url.authority().isEmpty())
+ return QLatin1Char(':') + url.path();
+ return QString();
+ }
+ return url.toLocalFile();
+}
+
+QScriptValue QDeclarativeInclude::include(QScriptContext *ctxt, QScriptEngine *engine)
+{
+ if (ctxt->argumentCount() == 0)
+ return engine->undefinedValue();
+
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
+
+ QUrl contextUrl = ep->contextClass->urlFromValue(QScriptDeclarativeClass::scopeChainValue(ctxt, -3));
+ if (contextUrl.isEmpty())
+ return ctxt->throwError(QLatin1String("Qt.include(): Can only be called from JavaScript files"));
+
+ QString urlString = ctxt->argument(0).toString();
+ QUrl url(ctxt->argument(0).toString());
+ if (url.isRelative()) {
+ url = QUrl(contextUrl).resolved(url);
+ urlString = url.toString();
+ }
+
+ QString localFile = toLocalFileOrQrc(url);
+
+ QScriptValue func = ctxt->argument(1);
+ if (!func.isFunction())
+ func = QScriptValue();
+
+ QScriptValue result;
+ if (localFile.isEmpty()) {
+ QDeclarativeInclude *i =
+ new QDeclarativeInclude(url, QDeclarativeEnginePrivate::getEngine(engine), ctxt);
+
+ if (func.isValid())
+ i->setCallback(func);
+
+ result = i->result();
+ } else {
+
+ QFile f(localFile);
+ if (f.open(QIODevice::ReadOnly)) {
+ QByteArray data = f.readAll();
+ QString code = QString::fromUtf8(data);
+
+ QDeclarativeContextData *context =
+ ep->contextClass->contextFromValue(QScriptDeclarativeClass::scopeChainValue(ctxt, -3));
+
+ QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(engine);
+ scriptContext->pushScope(ep->contextClass->newUrlContext(context, 0, urlString));
+ scriptContext->pushScope(ep->globalClass->globalObject());
+ QScriptValue scope = QScriptDeclarativeClass::scopeChainValue(ctxt, -5);
+ scriptContext->pushScope(scope);
+ scriptContext->setActivationObject(scope);
+
+ engine->evaluate(code, urlString, 1);
+
+ engine->popContext();
+
+ if (engine->hasUncaughtException()) {
+ result = resultValue(engine, Exception);
+ result.setProperty(QLatin1String("exception"), engine->uncaughtException());
+ engine->clearExceptions();
+ } else {
+ result = resultValue(engine, Ok);
+ }
+ callback(engine, func, result);
+ } else {
+ result = resultValue(engine, NetworkError);
+ callback(engine, func, result);
+ }
+ }
+
+ return result;
+}
+
+QScriptValue QDeclarativeInclude::worker_include(QScriptContext *ctxt, QScriptEngine *engine)
+{
+ if (ctxt->argumentCount() == 0)
+ return engine->undefinedValue();
+
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
+
+ QString urlString = ctxt->argument(0).toString();
+ QUrl url(ctxt->argument(0).toString());
+ if (url.isRelative()) {
+ QString contextUrl = QScriptDeclarativeClass::scopeChainValue(ctxt, -3).data().toString();
+ Q_ASSERT(!contextUrl.isEmpty());
+
+ url = QUrl(contextUrl).resolved(url);
+ urlString = url.toString();
+ }
+
+ QString localFile = toLocalFileOrQrc(url);
+
+ QScriptValue func = ctxt->argument(1);
+ if (!func.isFunction())
+ func = QScriptValue();
+
+ QScriptValue result;
+ if (!localFile.isEmpty()) {
+
+ QFile f(localFile);
+ if (f.open(QIODevice::ReadOnly)) {
+ QByteArray data = f.readAll();
+ QString code = QString::fromUtf8(data);
+
+ QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(engine);
+ QScriptValue urlContext = engine->newObject();
+ urlContext.setData(QScriptValue(engine, urlString));
+ scriptContext->pushScope(urlContext);
+
+ QScriptValue scope = QScriptDeclarativeClass::scopeChainValue(ctxt, -4);
+ scriptContext->pushScope(scope);
+ scriptContext->setActivationObject(scope);
+
+ engine->evaluate(code, urlString, 1);
+
+ engine->popContext();
+
+ if (engine->hasUncaughtException()) {
+ result = resultValue(engine, Exception);
+ result.setProperty(QLatin1String("exception"), engine->uncaughtException());
+ engine->clearExceptions();
+ } else {
+ result = resultValue(engine, Ok);
+ }
+ callback(engine, func, result);
+ } else {
+ result = resultValue(engine, NetworkError);
+ callback(engine, func, result);
+ }
+ }
+
+ return result;
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeinclude_p.h b/src/declarative/qml/qdeclarativeinclude_p.h
new file mode 100644
index 0000000000..31243749db
--- /dev/null
+++ b/src/declarative/qml/qdeclarativeinclude_p.h
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** 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 QDECLARATIVEINCLUDE_P_H
+#define QDECLARATIVEINCLUDE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+#include <QtCore/qurl.h>
+#include <QtScript/qscriptvalue.h>
+
+#include <private/qdeclarativecontext_p.h>
+#include <private/qdeclarativeguard_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeEngine;
+class QScriptContext;
+class QScriptEngine;
+class QNetworkAccessManager;
+class QNetworkReply;
+class QDeclarativeInclude : public QObject
+{
+ Q_OBJECT
+public:
+ enum Status {
+ Ok = 0,
+ Loading = 1,
+ NetworkError = 2,
+ Exception = 3
+ };
+
+ QDeclarativeInclude(const QUrl &, QDeclarativeEngine *, QScriptContext *ctxt);
+ ~QDeclarativeInclude();
+
+ void setCallback(const QScriptValue &);
+ QScriptValue callback() const;
+
+ QScriptValue result() const;
+
+ static QScriptValue resultValue(QScriptEngine *, Status status = Loading);
+ static void callback(QScriptEngine *, QScriptValue &callback, QScriptValue &status);
+
+ static QScriptValue include(QScriptContext *ctxt, QScriptEngine *engine);
+ static QScriptValue worker_include(QScriptContext *ctxt, QScriptEngine *engine);
+
+public slots:
+ void finished();
+
+private:
+ QDeclarativeEngine *m_engine;
+ QScriptEngine *m_scriptEngine;
+ QNetworkAccessManager *m_network;
+ QDeclarativeGuard<QNetworkReply> m_reply;
+
+ QUrl m_url;
+ int m_redirectCount;
+ QScriptValue m_callback;
+ QScriptValue m_result;
+ QDeclarativeGuardedContextData m_context;
+ QScriptValue m_scope[2];
+};
+
+QT_END_NAMESPACE
+
+#endif // QDECLARATIVEINCLUDE_P_H
+
diff --git a/src/declarative/qml/qdeclarativeinfo.cpp b/src/declarative/qml/qdeclarativeinfo.cpp
index ffed14ee09..c980a2a6cd 100644
--- a/src/declarative/qml/qdeclarativeinfo.cpp
+++ b/src/declarative/qml/qdeclarativeinfo.cpp
@@ -78,8 +78,9 @@ QT_BEGIN_NAMESPACE
\endcode
*/
-struct QDeclarativeInfoPrivate
+class QDeclarativeInfoPrivate
{
+public:
QDeclarativeInfoPrivate() : ref (1), object(0) {}
int ref;
diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp
index 99f1cc8cdc..0236950b34 100644
--- a/src/declarative/qml/qdeclarativeinstruction.cpp
+++ b/src/declarative/qml/qdeclarativeinstruction.cpp
@@ -136,6 +136,9 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
case QDeclarativeInstruction::StoreVariantDouble:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value;
break;
+ case QDeclarativeInstruction::StoreVariantBool:
+ qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value;
+ break;
case QDeclarativeInstruction::StoreObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT\t\t" << instr->storeObject.propertyIndex;
break;
diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h
index c09b157f0f..dc5f2f8fd6 100644
--- a/src/declarative/qml/qdeclarativeinstruction_p.h
+++ b/src/declarative/qml/qdeclarativeinstruction_p.h
@@ -116,6 +116,7 @@ public:
StoreVariant, /* storeString */
StoreVariantInteger, /* storeInteger */
StoreVariantDouble, /* storeDouble */
+ StoreVariantBool, /* storeBool */
StoreObject, /* storeObject */
StoreVariantObject, /* storeObject */
StoreInterface, /* storeObject */
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index bb5c8b78df..8b64e0e77e 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -104,7 +104,8 @@ QScriptValue QDeclarativeObjectScriptClass::newQObject(QObject *object, int type
QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
if (!object)
- return newObject(scriptEngine, this, new ObjectData(object, type));
+ return scriptEngine->nullValue();
+// return newObject(scriptEngine, this, new ObjectData(object, type));
if (QObjectPrivate::get(object)->wasDeleted)
return scriptEngine->undefinedValue();
@@ -265,7 +266,7 @@ QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name)
void *args[] = { &rv, 0 };
QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args);
return Value(scriptEngine, rv);
- } else if (lastData->propType == QMetaType::Int) {
+ } else if (lastData->propType == QMetaType::Int || lastData->flags & QDeclarativePropertyCache::Data::IsEnumType) {
int rv = 0;
void *args[] = { &rv, 0 };
QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args);
@@ -368,6 +369,9 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj,
QString error = QLatin1String("Cannot assign [undefined] to ") +
QLatin1String(QMetaType::typeName(lastData->propType));
context->throwError(error);
+ } else if (!value.isRegExp() && value.isFunction()) {
+ QString error = QLatin1String("Cannot assign a function to a property.");
+ context->throwError(error);
} else {
QVariant v;
if (lastData->flags & QDeclarativePropertyCache::Data::IsQList)
@@ -441,7 +445,7 @@ QScriptValue QDeclarativeObjectScriptClass::destroy(QScriptContext *context, QSc
QDeclarativeData *ddata = QDeclarativeData::get(data->object, false);
if (!ddata || ddata->indestructible)
- return engine->currentContext()->throwError(QLatin1String("Invalid attempt to destroy() an indestructible object"));
+ return engine->currentContext()->throwError(QLatin1String("Invalid attempt to destroy() an indestructible object"));
QObject *obj = data->object;
int delay = 0;
@@ -772,7 +776,8 @@ QScriptDeclarativeClass::Value MetaCallArgument::toValue(QDeclarativeEngine *e)
return QScriptDeclarativeClass::Value(engine, *((QString *)&data));
} else if (type == QMetaType::QObjectStar) {
QObject *object = *((QObject **)&data);
- QDeclarativeData::get(object, true)->setImplicitDestructible();
+ if (object)
+ QDeclarativeData::get(object, true)->setImplicitDestructible();
QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(e);
return QScriptDeclarativeClass::Value(engine, priv->objectClass->newQObject(object));
} else if (type == qMetaTypeId<QList<QObject *> >()) {
diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h
index 0870cfb0d8..25777f5b23 100644
--- a/src/declarative/qml/qdeclarativeparser_p.h
+++ b/src/declarative/qml/qdeclarativeparser_p.h
@@ -188,9 +188,6 @@ namespace QDeclarativeParser
QList<int> lineNumbers;
QList<Pragmas> pragmas;
};
-#if 0
- QList<ScriptBlock> scripts;
-#endif
// The bytes to cast instances by to get to the QDeclarativeParserStatus
// interface. -1 indicates the type doesn't support this interface.
diff --git a/src/declarative/qml/qdeclarativeparserstatus.cpp b/src/declarative/qml/qdeclarativeparserstatus.cpp
index 978bfb4a5c..4c4e429d7b 100644
--- a/src/declarative/qml/qdeclarativeparserstatus.cpp
+++ b/src/declarative/qml/qdeclarativeparserstatus.cpp
@@ -91,19 +91,17 @@ QDeclarativeParserStatus::~QDeclarativeParserStatus()
}
/*!
+ \fn void QDeclarativeParserStatus::classBegin()
+
Invoked after class creation, but before any properties have been set.
*/
-void QDeclarativeParserStatus::classBegin()
-{
-}
/*!
+ \fn void QDeclarativeParserStatus::componentComplete()
+
Invoked after the root component that caused this instantiation has
completed construction. At this point all static values and binding values
have been assigned to the class.
*/
-void QDeclarativeParserStatus::componentComplete()
-{
-}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeparserstatus.h b/src/declarative/qml/qdeclarativeparserstatus.h
index 34528c11af..60d423e8b6 100644
--- a/src/declarative/qml/qdeclarativeparserstatus.h
+++ b/src/declarative/qml/qdeclarativeparserstatus.h
@@ -56,8 +56,8 @@ public:
QDeclarativeParserStatus();
virtual ~QDeclarativeParserStatus();
- virtual void classBegin();
- virtual void componentComplete();
+ virtual void classBegin()=0;
+ virtual void componentComplete()=0;
private:
friend class QDeclarativeVME;
diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp
index 888945b1f4..839d79f0f6 100644
--- a/src/declarative/qml/qdeclarativepropertycache.cpp
+++ b/src/declarative/qml/qdeclarativepropertycache.cpp
@@ -45,7 +45,7 @@
#include "private/qdeclarativebinding_p.h"
#include <QtCore/qdebug.h>
-Q_DECLARE_METATYPE(QScriptValue);
+Q_DECLARE_METATYPE(QScriptValue)
QT_BEGIN_NAMESPACE
@@ -106,9 +106,25 @@ void QDeclarativePropertyCache::Data::load(const QMetaMethod &m)
}
+/*!
+Creates a new empty QDeclarativePropertyCache.
+*/
QDeclarativePropertyCache::QDeclarativePropertyCache(QDeclarativeEngine *e)
: QDeclarativeCleanup(e), engine(e)
{
+ Q_ASSERT(engine);
+}
+
+/*!
+Creates a new QDeclarativePropertyCache of \a metaObject.
+*/
+QDeclarativePropertyCache::QDeclarativePropertyCache(QDeclarativeEngine *e, const QMetaObject *metaObject)
+: QDeclarativeCleanup(e), engine(e)
+{
+ Q_ASSERT(engine);
+ Q_ASSERT(metaObject);
+
+ update(engine, metaObject);
}
QDeclarativePropertyCache::~QDeclarativePropertyCache()
@@ -135,7 +151,7 @@ void QDeclarativePropertyCache::clear()
}
QDeclarativePropertyCache::Data QDeclarativePropertyCache::create(const QMetaObject *metaObject,
- const QString &property)
+ const QString &property)
{
Q_ASSERT(metaObject);
@@ -245,17 +261,6 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb
}
}
-// ### Optimize - check engine for the parent meta object etc.
-QDeclarativePropertyCache *QDeclarativePropertyCache::create(QDeclarativeEngine *engine, const QMetaObject *metaObject)
-{
- Q_ASSERT(engine);
- Q_ASSERT(metaObject);
-
- QDeclarativePropertyCache *cache = new QDeclarativePropertyCache(engine);
- cache->update(engine, metaObject);
- return cache;
-}
-
void QDeclarativePropertyCache::update(QDeclarativeEngine *engine, const QMetaObject *metaObject)
{
Q_ASSERT(engine);
diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h
index 6b64a96da7..b01e5cc182 100644
--- a/src/declarative/qml/qdeclarativepropertycache_p.h
+++ b/src/declarative/qml/qdeclarativepropertycache_p.h
@@ -69,6 +69,7 @@ class QDeclarativePropertyCache : public QDeclarativeRefCount, public QDeclarati
{
public:
QDeclarativePropertyCache(QDeclarativeEngine *);
+ QDeclarativePropertyCache(QDeclarativeEngine *, const QMetaObject *);
virtual ~QDeclarativePropertyCache();
struct Data {
diff --git a/src/declarative/qml/qdeclarativepropertyvaluesource.cpp b/src/declarative/qml/qdeclarativepropertyvaluesource.cpp
index a0ed78f663..039998fda0 100644
--- a/src/declarative/qml/qdeclarativepropertyvaluesource.cpp
+++ b/src/declarative/qml/qdeclarativepropertyvaluesource.cpp
@@ -60,6 +60,9 @@ QDeclarativePropertyValueSource::QDeclarativePropertyValueSource()
{
}
+/*!
+ Destroys the value source.
+*/
QDeclarativePropertyValueSource::~QDeclarativePropertyValueSource()
{
}
diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp
index 8b967339be..219d7593a1 100644
--- a/src/declarative/qml/qdeclarativescriptparser.cpp
+++ b/src/declarative/qml/qdeclarativescriptparser.cpp
@@ -104,17 +104,13 @@ public:
void operator()(const QString &code, AST::Node *node);
protected:
+
Object *defineObjectBinding(AST::UiQualifiedId *propertyName, bool onAssignment,
- AST::UiQualifiedId *objectTypeName,
+ const QString &objectType,
+ AST::SourceLocation typeLocation,
LocationSpan location,
AST::UiObjectInitializer *initializer = 0);
- Object *defineObjectBinding_helper(AST::UiQualifiedId *propertyName, bool onAssignment,
- const QString &objectType,
- AST::SourceLocation typeLocation,
- LocationSpan location,
- AST::UiObjectInitializer *initializer = 0);
-
QDeclarativeParser::Variant getVariant(AST::ExpressionNode *expr);
LocationSpan location(AST::SourceLocation start, AST::SourceLocation end);
@@ -240,12 +236,12 @@ QString ProcessAST::asString(AST::UiQualifiedId *node) const
}
Object *
-ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName,
- bool onAssignment,
- const QString &objectType,
- AST::SourceLocation typeLocation,
- LocationSpan location,
- AST::UiObjectInitializer *initializer)
+ProcessAST::defineObjectBinding(AST::UiQualifiedId *propertyName,
+ bool onAssignment,
+ const QString &objectType,
+ AST::SourceLocation typeLocation,
+ LocationSpan location,
+ AST::UiObjectInitializer *initializer)
{
int lastTypeDot = objectType.lastIndexOf(QLatin1Char('.'));
bool isType = !objectType.isEmpty() &&
@@ -355,41 +351,6 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName,
}
}
-Object *ProcessAST::defineObjectBinding(AST::UiQualifiedId *qualifiedId, bool onAssignment,
- AST::UiQualifiedId *objectTypeName,
- LocationSpan location,
- AST::UiObjectInitializer *initializer)
-{
- const QString objectType = asString(objectTypeName);
- const AST::SourceLocation typeLocation = objectTypeName->identifierToken;
-
- if (objectType == QLatin1String("Script")) {
-
- AST::UiObjectMemberList *it = initializer->members;
- for (; it; it = it->next) {
- AST::UiScriptBinding *scriptBinding = AST::cast<AST::UiScriptBinding *>(it->member);
- if (! scriptBinding)
- continue;
-
- QString propertyName = asString(scriptBinding->qualifiedId);
- if (propertyName == QLatin1String("source")) {
- if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(scriptBinding->statement)) {
- QDeclarativeParser::Variant string = getVariant(stmt->expression);
- if (string.isStringList()) {
- QStringList urls = string.asStringList();
- // We need to add this as a resource
- for (int ii = 0; ii < urls.count(); ++ii)
- _parser->_refUrls << QUrl(urls.at(ii));
- }
- }
- }
- }
-
- }
-
- return defineObjectBinding_helper(qualifiedId, onAssignment, objectType, typeLocation, location, initializer);
-}
-
LocationSpan ProcessAST::location(AST::UiQualifiedId *id)
{
return location(id->identifierToken, id->identifierToken);
@@ -664,10 +625,11 @@ bool ProcessAST::visit(AST::UiObjectDefinition *node)
LocationSpan l = location(node->firstSourceLocation(),
node->lastSourceLocation());
- defineObjectBinding(/*propertyName = */ 0, false,
- node->qualifiedTypeNameId,
- l,
- node->initializer);
+ const QString objectType = asString(node->qualifiedTypeNameId);
+ const AST::SourceLocation typeLocation = node->qualifiedTypeNameId->identifierToken;
+
+ defineObjectBinding(/*propertyName = */ 0, false, objectType,
+ typeLocation, l, node->initializer);
return false;
}
@@ -679,10 +641,11 @@ bool ProcessAST::visit(AST::UiObjectBinding *node)
LocationSpan l = location(node->qualifiedTypeNameId->identifierToken,
node->initializer->rbraceToken);
- defineObjectBinding(node->qualifiedId, node->hasOnToken,
- node->qualifiedTypeNameId,
- l,
- node->initializer);
+ const QString objectType = asString(node->qualifiedTypeNameId);
+ const AST::SourceLocation typeLocation = node->qualifiedTypeNameId->identifierToken;
+
+ defineObjectBinding(node->qualifiedId, node->hasOnToken, objectType,
+ typeLocation, l, node->initializer);
return false;
}
diff --git a/src/declarative/qml/qdeclarativescriptstring.h b/src/declarative/qml/qdeclarativescriptstring.h
index 43bef4460d..fc92a9bc18 100644
--- a/src/declarative/qml/qdeclarativescriptstring.h
+++ b/src/declarative/qml/qdeclarativescriptstring.h
@@ -79,7 +79,7 @@ private:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QDeclarativeScriptString);
+Q_DECLARE_METATYPE(QDeclarativeScriptString)
QT_END_HEADER
diff --git a/src/declarative/qml/qdeclarativestringconverters_p.h b/src/declarative/qml/qdeclarativestringconverters_p.h
index 7afdfd3113..97f72fcc5e 100644
--- a/src/declarative/qml/qdeclarativestringconverters_p.h
+++ b/src/declarative/qml/qdeclarativestringconverters_p.h
@@ -80,7 +80,7 @@ namespace QDeclarativeStringConverters
QSizeF Q_DECLARATIVE_EXPORT sizeFFromString(const QString &, bool *ok = 0);
QRectF Q_DECLARATIVE_EXPORT rectFFromString(const QString &, bool *ok = 0);
QVector3D Q_DECLARATIVE_EXPORT vector3DFromString(const QString &, bool *ok = 0);
-};
+}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp
index c6fe1613c4..dbc25bb8c2 100644
--- a/src/declarative/qml/qdeclarativevaluetype.cpp
+++ b/src/declarative/qml/qdeclarativevaluetype.cpp
@@ -116,8 +116,16 @@ QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t)
return new QDeclarativeRectValueType;
case QVariant::RectF:
return new QDeclarativeRectFValueType;
+ case QVariant::Vector2D:
+ return new QDeclarativeVector2DValueType;
case QVariant::Vector3D:
return new QDeclarativeVector3DValueType;
+ case QVariant::Vector4D:
+ return new QDeclarativeVector4DValueType;
+ case QVariant::Quaternion:
+ return new QDeclarativeQuaternionValueType;
+ case QVariant::Matrix4x4:
+ return new QDeclarativeMatrix4x4ValueType;
case QVariant::EasingCurve:
return new QDeclarativeEasingValueType;
case QVariant::Font:
@@ -460,6 +468,54 @@ void QDeclarativeRectValueType::setHeight(int h)
rect.setHeight(h);
}
+QDeclarativeVector2DValueType::QDeclarativeVector2DValueType(QObject *parent)
+: QDeclarativeValueType(parent)
+{
+}
+
+void QDeclarativeVector2DValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &vector, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QDeclarativeVector2DValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &vector, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QDeclarativeVector2DValueType::value()
+{
+ return QVariant(vector);
+}
+
+void QDeclarativeVector2DValueType::setValue(QVariant value)
+{
+ vector = qvariant_cast<QVector2D>(value);
+}
+
+qreal QDeclarativeVector2DValueType::x() const
+{
+ return vector.x();
+}
+
+qreal QDeclarativeVector2DValueType::y() const
+{
+ return vector.y();
+}
+
+void QDeclarativeVector2DValueType::setX(qreal x)
+{
+ vector.setX(x);
+}
+
+void QDeclarativeVector2DValueType::setY(qreal y)
+{
+ vector.setY(y);
+}
+
QDeclarativeVector3DValueType::QDeclarativeVector3DValueType(QObject *parent)
: QDeclarativeValueType(parent)
{
@@ -518,6 +574,170 @@ void QDeclarativeVector3DValueType::setZ(qreal z)
vector.setZ(z);
}
+QDeclarativeVector4DValueType::QDeclarativeVector4DValueType(QObject *parent)
+: QDeclarativeValueType(parent)
+{
+}
+
+void QDeclarativeVector4DValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &vector, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QDeclarativeVector4DValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &vector, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QDeclarativeVector4DValueType::value()
+{
+ return QVariant(vector);
+}
+
+void QDeclarativeVector4DValueType::setValue(QVariant value)
+{
+ vector = qvariant_cast<QVector4D>(value);
+}
+
+qreal QDeclarativeVector4DValueType::x() const
+{
+ return vector.x();
+}
+
+qreal QDeclarativeVector4DValueType::y() const
+{
+ return vector.y();
+}
+
+qreal QDeclarativeVector4DValueType::z() const
+{
+ return vector.z();
+}
+
+qreal QDeclarativeVector4DValueType::w() const
+{
+ return vector.w();
+}
+
+void QDeclarativeVector4DValueType::setX(qreal x)
+{
+ vector.setX(x);
+}
+
+void QDeclarativeVector4DValueType::setY(qreal y)
+{
+ vector.setY(y);
+}
+
+void QDeclarativeVector4DValueType::setZ(qreal z)
+{
+ vector.setZ(z);
+}
+
+void QDeclarativeVector4DValueType::setW(qreal w)
+{
+ vector.setW(w);
+}
+
+QDeclarativeQuaternionValueType::QDeclarativeQuaternionValueType(QObject *parent)
+: QDeclarativeValueType(parent)
+{
+}
+
+void QDeclarativeQuaternionValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &quaternion, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QDeclarativeQuaternionValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &quaternion, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QDeclarativeQuaternionValueType::value()
+{
+ return QVariant(quaternion);
+}
+
+void QDeclarativeQuaternionValueType::setValue(QVariant value)
+{
+ quaternion = qvariant_cast<QQuaternion>(value);
+}
+
+qreal QDeclarativeQuaternionValueType::scalar() const
+{
+ return quaternion.scalar();
+}
+
+qreal QDeclarativeQuaternionValueType::x() const
+{
+ return quaternion.x();
+}
+
+qreal QDeclarativeQuaternionValueType::y() const
+{
+ return quaternion.y();
+}
+
+qreal QDeclarativeQuaternionValueType::z() const
+{
+ return quaternion.z();
+}
+
+void QDeclarativeQuaternionValueType::setScalar(qreal scalar)
+{
+ quaternion.setScalar(scalar);
+}
+
+void QDeclarativeQuaternionValueType::setX(qreal x)
+{
+ quaternion.setX(x);
+}
+
+void QDeclarativeQuaternionValueType::setY(qreal y)
+{
+ quaternion.setY(y);
+}
+
+void QDeclarativeQuaternionValueType::setZ(qreal z)
+{
+ quaternion.setZ(z);
+}
+
+QDeclarativeMatrix4x4ValueType::QDeclarativeMatrix4x4ValueType(QObject *parent)
+: QDeclarativeValueType(parent)
+{
+}
+
+void QDeclarativeMatrix4x4ValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &matrix, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QDeclarativeMatrix4x4ValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &matrix, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QDeclarativeMatrix4x4ValueType::value()
+{
+ return QVariant(matrix);
+}
+
+void QDeclarativeMatrix4x4ValueType::setValue(QVariant value)
+{
+ matrix = qvariant_cast<QMatrix4x4>(value);
+}
+
QDeclarativeEasingValueType::QDeclarativeEasingValueType(QObject *parent)
: QDeclarativeValueType(parent)
{
diff --git a/src/declarative/qml/qdeclarativevaluetype_p.h b/src/declarative/qml/qdeclarativevaluetype_p.h
index d1833bbda0..476c73d768 100644
--- a/src/declarative/qml/qdeclarativevaluetype_p.h
+++ b/src/declarative/qml/qdeclarativevaluetype_p.h
@@ -60,7 +60,11 @@
#include <QtCore/qrect.h>
#include <QtCore/qeasingcurve.h>
#include <QtCore/qvariant.h>
+#include <QtGui/qvector2d.h>
#include <QtGui/qvector3d.h>
+#include <QtGui/qvector4d.h>
+#include <QtGui/qmatrix4x4.h>
+#include <QtGui/qquaternion.h>
#include <QtGui/qfont.h>
QT_BEGIN_NAMESPACE
@@ -241,6 +245,28 @@ private:
QRect rect;
};
+class Q_AUTOTEST_EXPORT QDeclarativeVector2DValueType : public QDeclarativeValueType
+{
+ Q_PROPERTY(qreal x READ x WRITE setX)
+ Q_PROPERTY(qreal y READ y WRITE setY)
+ Q_OBJECT
+public:
+ QDeclarativeVector2DValueType(QObject *parent = 0);
+
+ virtual void read(QObject *, int);
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
+ virtual QVariant value();
+ virtual void setValue(QVariant value);
+
+ qreal x() const;
+ qreal y() const;
+ void setX(qreal);
+ void setY(qreal);
+
+private:
+ QVector2D vector;
+};
+
class Q_AUTOTEST_EXPORT QDeclarativeVector3DValueType : public QDeclarativeValueType
{
Q_PROPERTY(qreal x READ x WRITE setX)
@@ -266,6 +292,127 @@ private:
QVector3D vector;
};
+class Q_AUTOTEST_EXPORT QDeclarativeVector4DValueType : public QDeclarativeValueType
+{
+ Q_PROPERTY(qreal x READ x WRITE setX)
+ Q_PROPERTY(qreal y READ y WRITE setY)
+ Q_PROPERTY(qreal z READ z WRITE setZ)
+ Q_PROPERTY(qreal w READ w WRITE setW)
+ Q_OBJECT
+public:
+ QDeclarativeVector4DValueType(QObject *parent = 0);
+
+ virtual void read(QObject *, int);
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
+ virtual QVariant value();
+ virtual void setValue(QVariant value);
+
+ qreal x() const;
+ qreal y() const;
+ qreal z() const;
+ qreal w() const;
+ void setX(qreal);
+ void setY(qreal);
+ void setZ(qreal);
+ void setW(qreal);
+
+private:
+ QVector4D vector;
+};
+
+class Q_AUTOTEST_EXPORT QDeclarativeQuaternionValueType : public QDeclarativeValueType
+{
+ Q_PROPERTY(qreal scalar READ scalar WRITE setScalar)
+ Q_PROPERTY(qreal x READ x WRITE setX)
+ Q_PROPERTY(qreal y READ y WRITE setY)
+ Q_PROPERTY(qreal z READ z WRITE setZ)
+ Q_OBJECT
+public:
+ QDeclarativeQuaternionValueType(QObject *parent = 0);
+
+ virtual void read(QObject *, int);
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
+ virtual QVariant value();
+ virtual void setValue(QVariant value);
+
+ qreal scalar() const;
+ qreal x() const;
+ qreal y() const;
+ qreal z() const;
+ void setScalar(qreal);
+ void setX(qreal);
+ void setY(qreal);
+ void setZ(qreal);
+
+private:
+ QQuaternion quaternion;
+};
+
+class Q_AUTOTEST_EXPORT QDeclarativeMatrix4x4ValueType : public QDeclarativeValueType
+{
+ Q_PROPERTY(qreal m11 READ m11 WRITE setM11)
+ Q_PROPERTY(qreal m12 READ m12 WRITE setM12)
+ Q_PROPERTY(qreal m13 READ m13 WRITE setM13)
+ Q_PROPERTY(qreal m14 READ m14 WRITE setM14)
+ Q_PROPERTY(qreal m21 READ m21 WRITE setM21)
+ Q_PROPERTY(qreal m22 READ m22 WRITE setM22)
+ Q_PROPERTY(qreal m23 READ m23 WRITE setM23)
+ Q_PROPERTY(qreal m24 READ m24 WRITE setM24)
+ Q_PROPERTY(qreal m31 READ m31 WRITE setM31)
+ Q_PROPERTY(qreal m32 READ m32 WRITE setM32)
+ Q_PROPERTY(qreal m33 READ m33 WRITE setM33)
+ Q_PROPERTY(qreal m34 READ m34 WRITE setM34)
+ Q_PROPERTY(qreal m41 READ m41 WRITE setM41)
+ Q_PROPERTY(qreal m42 READ m42 WRITE setM42)
+ Q_PROPERTY(qreal m43 READ m43 WRITE setM43)
+ Q_PROPERTY(qreal m44 READ m44 WRITE setM44)
+ Q_OBJECT
+public:
+ QDeclarativeMatrix4x4ValueType(QObject *parent = 0);
+
+ virtual void read(QObject *, int);
+ virtual void write(QObject *, int, QDeclarativePropertyPrivate::WriteFlags);
+ virtual QVariant value();
+ virtual void setValue(QVariant value);
+
+ qreal m11() const { return matrix(0, 0); }
+ qreal m12() const { return matrix(0, 1); }
+ qreal m13() const { return matrix(0, 2); }
+ qreal m14() const { return matrix(0, 3); }
+ qreal m21() const { return matrix(1, 0); }
+ qreal m22() const { return matrix(1, 1); }
+ qreal m23() const { return matrix(1, 2); }
+ qreal m24() const { return matrix(1, 3); }
+ qreal m31() const { return matrix(2, 0); }
+ qreal m32() const { return matrix(2, 1); }
+ qreal m33() const { return matrix(2, 2); }
+ qreal m34() const { return matrix(2, 3); }
+ qreal m41() const { return matrix(3, 0); }
+ qreal m42() const { return matrix(3, 1); }
+ qreal m43() const { return matrix(3, 2); }
+ qreal m44() const { return matrix(3, 3); }
+
+ void setM11(qreal value) { matrix(0, 0) = value; }
+ void setM12(qreal value) { matrix(0, 1) = value; }
+ void setM13(qreal value) { matrix(0, 2) = value; }
+ void setM14(qreal value) { matrix(0, 3) = value; }
+ void setM21(qreal value) { matrix(1, 0) = value; }
+ void setM22(qreal value) { matrix(1, 1) = value; }
+ void setM23(qreal value) { matrix(1, 2) = value; }
+ void setM24(qreal value) { matrix(1, 3) = value; }
+ void setM31(qreal value) { matrix(2, 0) = value; }
+ void setM32(qreal value) { matrix(2, 1) = value; }
+ void setM33(qreal value) { matrix(2, 2) = value; }
+ void setM34(qreal value) { matrix(2, 3) = value; }
+ void setM41(qreal value) { matrix(3, 0) = value; }
+ void setM42(qreal value) { matrix(3, 1) = value; }
+ void setM43(qreal value) { matrix(3, 2) = value; }
+ void setM44(qreal value) { matrix(3, 3) = value; }
+
+private:
+ QMatrix4x4 matrix;
+};
+
class Q_AUTOTEST_EXPORT QDeclarativeEasingValueType : public QDeclarativeValueType
{
Q_OBJECT
diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp
index 57bf726785..8ba79a664a 100644
--- a/src/declarative/qml/qdeclarativevme.cpp
+++ b/src/declarative/qml/qdeclarativevme.cpp
@@ -360,6 +360,16 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
}
break;
+ case QDeclarativeInstruction::StoreVariantBool:
+ {
+ QObject *target = stack.top();
+ QVariant v(instr.storeBool.value);
+ void *a[] = { &v, 0, &status, &flags };
+ QMetaObject::metacall(target, QMetaObject::WriteProperty,
+ instr.storeString.propertyIndex, a);
+ }
+ break;
+
case QDeclarativeInstruction::StoreString:
{
QObject *target = stack.top();
@@ -898,6 +908,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
QDeclarativeEnginePrivate::clear(bindValues);
QDeclarativeEnginePrivate::clear(parserStatus);
+ ep->finalizedParserStatus.clear();
return 0;
}
diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp
index 45f04a0fc5..13e9c26a5b 100644
--- a/src/declarative/qml/qdeclarativevmemetaobject.cpp
+++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp
@@ -106,8 +106,7 @@ QDeclarativeVMEVariant::~QDeclarativeVMEVariant()
void QDeclarativeVMEVariant::cleanup()
{
if (type == QVariant::Invalid) {
- } else if (type == QMetaType::QObjectStar ||
- type == QMetaType::Int ||
+ } else if (type == QMetaType::Int ||
type == QMetaType::Bool ||
type == QMetaType::Double) {
type = QVariant::Invalid;
diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp
index 138d979722..4b687a9fe5 100644
--- a/src/declarative/qml/qdeclarativeworkerscript.cpp
+++ b/src/declarative/qml/qdeclarativeworkerscript.cpp
@@ -289,7 +289,11 @@ void QDeclarativeWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url)
QScriptValue activation = getWorker(id);
- QScriptContext *ctxt = workerEngine->pushContext();
+ QScriptContext *ctxt = QScriptDeclarativeClass::pushCleanContext(workerEngine);
+ QScriptValue urlContext = workerEngine->newObject();
+ urlContext.setData(QScriptValue(workerEngine, fileName));
+ ctxt->pushScope(urlContext);
+ ctxt->pushScope(activation);
ctxt->setActivationObject(activation);
workerEngine->baseUrl = url;
@@ -538,7 +542,7 @@ void QDeclarativeWorkerScriptEngine::run()
by the \tt onMessage() handler of \tt myWorker.
*/
QDeclarativeWorkerScript::QDeclarativeWorkerScript(QObject *parent)
-: QObject(parent), m_engine(0), m_scriptId(-1)
+: QObject(parent), m_engine(0), m_scriptId(-1), m_componentComplete(true)
{
}
@@ -565,7 +569,7 @@ void QDeclarativeWorkerScript::setSource(const QUrl &source)
m_source = source;
- if (m_engine)
+ if (engine())
m_engine->executeUrl(m_scriptId, m_source);
emit sourceChanged();
@@ -580,7 +584,7 @@ void QDeclarativeWorkerScript::setSource(const QUrl &source)
*/
void QDeclarativeWorkerScript::sendMessage(const QScriptValue &message)
{
- if (!m_engine) {
+ if (!engine()) {
qWarning("QDeclarativeWorkerScript: Attempt to send message before WorkerScript establishment");
return;
}
@@ -588,13 +592,19 @@ void QDeclarativeWorkerScript::sendMessage(const QScriptValue &message)
m_engine->sendMessage(m_scriptId, QDeclarativeWorkerScriptEnginePrivate::scriptValueToVariant(message));
}
-void QDeclarativeWorkerScript::componentComplete()
+void QDeclarativeWorkerScript::classBegin()
{
- if (!m_engine) {
+ m_componentComplete = false;
+}
+
+QDeclarativeWorkerScriptEngine *QDeclarativeWorkerScript::engine()
+{
+ if (m_engine) return m_engine;
+ if (m_componentComplete) {
QDeclarativeEngine *engine = qmlEngine(this);
if (!engine) {
- qWarning("QDeclarativeWorkerScript: componentComplete() called without qmlEngine() set");
- return;
+ qWarning("QDeclarativeWorkerScript: engine() called without qmlEngine() set");
+ return 0;
}
m_engine = QDeclarativeEnginePrivate::get(engine)->getWorkerScriptEngine();
@@ -602,7 +612,16 @@ void QDeclarativeWorkerScript::componentComplete()
if (m_source.isValid())
m_engine->executeUrl(m_scriptId, m_source);
+
+ return m_engine;
}
+ return 0;
+}
+
+void QDeclarativeWorkerScript::componentComplete()
+{
+ m_componentComplete = true;
+ engine(); // Get it started now.
}
/*!
diff --git a/src/declarative/qml/qdeclarativeworkerscript_p.h b/src/declarative/qml/qdeclarativeworkerscript_p.h
index 6cce799f02..dc738119f1 100644
--- a/src/declarative/qml/qdeclarativeworkerscript_p.h
+++ b/src/declarative/qml/qdeclarativeworkerscript_p.h
@@ -108,18 +108,21 @@ signals:
void message(const QScriptValue &messageObject);
protected:
+ virtual void classBegin();
virtual void componentComplete();
virtual bool event(QEvent *);
private:
+ QDeclarativeWorkerScriptEngine *engine();
QDeclarativeWorkerScriptEngine *m_engine;
int m_scriptId;
QUrl m_source;
+ bool m_componentComplete;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QDeclarativeWorkerScript);
+QML_DECLARE_TYPE(QDeclarativeWorkerScript)
QT_END_HEADER
diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
index b7e18322eb..80510f83bd 100644
--- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp
+++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
@@ -46,6 +46,7 @@
#include "private/qdeclarativerefcount_p.h"
#include "private/qdeclarativeengine_p.h"
#include "private/qdeclarativeexpression_p.h"
+#include "qdeclarativeglobal_p.h"
#include <QtCore/qobject.h>
#include <QtScript/qscriptvalue.h>
@@ -94,6 +95,8 @@
QT_BEGIN_NAMESPACE
+DEFINE_BOOL_CONFIG_OPTION(xhrDump, QML_XHR_DUMP);
+
class DocumentImpl;
class NodeImpl
{
@@ -318,9 +321,9 @@ public:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(Node);
-Q_DECLARE_METATYPE(NodeList);
-Q_DECLARE_METATYPE(NamedNodeMap);
+Q_DECLARE_METATYPE(Node)
+Q_DECLARE_METATYPE(NodeList)
+Q_DECLARE_METATYPE(NamedNodeMap)
QT_BEGIN_NAMESPACE
@@ -1131,6 +1134,14 @@ void QDeclarativeXMLHttpRequest::requestFromUrl(const QUrl &url)
}
}
+ if (xhrDump()) {
+ qWarning().nospace() << "XMLHttpRequest: " << qPrintable(m_method) << " " << qPrintable(url.toString());
+ if (!m_data.isEmpty()) {
+ qWarning().nospace() << " "
+ << qPrintable(QString::fromUtf8(m_data));
+ }
+ }
+
if (m_method == QLatin1String("GET"))
m_network = networkAccessManager()->get(request);
else if (m_method == QLatin1String("HEAD"))
@@ -1264,6 +1275,16 @@ void QDeclarativeXMLHttpRequest::finished()
if (cbv.isError()) printError(cbv);
}
m_responseEntityBody.append(m_network->readAll());
+
+ if (xhrDump()) {
+ qWarning().nospace() << "XMLHttpRequest: RESPONSE " << qPrintable(m_url.toString());
+ if (!m_responseEntityBody.isEmpty()) {
+ qWarning().nospace() << " "
+ << qPrintable(QString::fromUtf8(m_responseEntityBody));
+ }
+ }
+
+
m_data.clear();
destroyNetwork();
if (m_state < Loading) {
diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri
index 3848593416..12f97943f8 100644
--- a/src/declarative/qml/qml.pri
+++ b/src/declarative/qml/qml.pri
@@ -9,6 +9,7 @@ SOURCES += \
$$PWD/qdeclarativeproperty.cpp \
$$PWD/qdeclarativecomponent.cpp \
$$PWD/qdeclarativecontext.cpp \
+ $$PWD/qdeclarativeinclude.cpp \
$$PWD/qdeclarativecustomparser.cpp \
$$PWD/qdeclarativepropertyvaluesource.cpp \
$$PWD/qdeclarativepropertyvalueinterceptor.cpp \
@@ -54,6 +55,7 @@ SOURCES += \
$$PWD/qdeclarativenetworkaccessmanagerfactory.cpp \
$$PWD/qdeclarativedirparser.cpp \
$$PWD/qdeclarativeextensionplugin.cpp \
+ $$PWD/qdeclarativeimport.cpp \
$$PWD/qdeclarativelist.cpp
HEADERS += \
@@ -91,6 +93,7 @@ HEADERS += \
$$PWD/qdeclarativeinfo.h \
$$PWD/qdeclarativeproperty_p.h \
$$PWD/qdeclarativecontext_p.h \
+ $$PWD/qdeclarativeinclude_p.h \
$$PWD/qdeclarativecompositetypedata_p.h \
$$PWD/qdeclarativecompositetypemanager_p.h \
$$PWD/qdeclarativelist.h \
@@ -128,6 +131,7 @@ HEADERS += \
$$PWD/qdeclarativenetworkaccessmanagerfactory.h \
$$PWD/qdeclarativedirparser_p.h \
$$PWD/qdeclarativeextensioninterface.h \
+ $$PWD/qdeclarativeimport_p.h \
$$PWD/qdeclarativeextensionplugin.h
QT += sql
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 4059522560..67440b6a0f 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -55,6 +55,7 @@
#include <qdeclarativemetatype_p.h>
#include <qdeclarativevaluetype_p.h>
#include <qdeclarativeproperty_p.h>
+#include <qdeclarativeengine_p.h>
#include <qvariant.h>
#include <qcolor.h>
@@ -178,6 +179,10 @@ void QDeclarativeAbstractAnimation::setRunning(bool r)
d->running = r;
if (r == false)
d->avoidPropertyValueSourceStart = true;
+ else {
+ QDeclarativeEnginePrivate *engPriv = QDeclarativeEnginePrivate::get(qmlEngine(this));
+ engPriv->registerFinalizedParserStatusObject(this, this->metaObject()->indexOfSlot("componentFinalized()"));
+ }
return;
}
@@ -268,6 +273,11 @@ void QDeclarativeAbstractAnimation::componentComplete()
{
Q_D(QDeclarativeAbstractAnimation);
d->componentComplete = true;
+}
+
+void QDeclarativeAbstractAnimation::componentFinalized()
+{
+ Q_D(QDeclarativeAbstractAnimation);
if (d->running) {
d->running = false;
setRunning(true);
@@ -745,7 +755,7 @@ void QDeclarativeScriptAction::setScript(const QDeclarativeScriptString &script)
}
/*!
- \qmlproperty QString ScriptAction::scriptName
+ \qmlproperty string ScriptAction::scriptName
This property holds the the name of the StateChangeScript to run.
This property is only valid when ScriptAction is used as part of a transition.
@@ -781,7 +791,7 @@ void QDeclarativeScriptActionPrivate::execute()
if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
expr.evaluate();
- if (expr.hasError())
+ if (expr.hasError())
qmlInfo(q) << expr.error();
}
}
@@ -834,7 +844,7 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation()
The PropertyAction is immediate -
the target property is not animated to the selected value in any way.
-
+
\sa QtDeclarative
*/
/*!
@@ -864,7 +874,7 @@ void QDeclarativePropertyActionPrivate::init()
This property holds an explicit target object to animate.
The exact effect of the \c target property depends on how the animation
- is being used. Refer to the \l animation documentation for details.
+ is being used. Refer to the \l {QML Animation} documentation for details.
*/
QObject *QDeclarativePropertyAction::target() const
@@ -1320,27 +1330,27 @@ void QDeclarativeRotationAnimation::setTo(qreal t)
/*!
\qmlproperty enumeration RotationAnimation::direction
The direction in which to rotate.
- Possible values are Numerical, Clockwise, Counterclockwise,
- or Shortest.
+
+ Possible values are:
\table
\row
- \o Numerical
+ \o RotationAnimation.Numerical
\o Rotate by linearly interpolating between the two numbers.
A rotation from 10 to 350 will rotate 340 degrees clockwise.
\row
- \o Clockwise
+ \o RotationAnimation.Clockwise
\o Rotate clockwise between the two values
\row
- \o Counterclockwise
+ \o RotationAnimation.Counterclockwise
\o Rotate counterclockwise between the two values
\row
- \o Shortest
+ \o RotationAnimation.Shortest
\o Rotate in the direction that produces the shortest animation path.
A rotation from 10 to 350 will rotate 20 degrees counterclockwise.
\endtable
- The default direction is Numerical.
+ The default direction is RotationAnimation.Numerical.
*/
QDeclarativeRotationAnimation::RotationDirection QDeclarativeRotationAnimation::direction() const
{
@@ -1605,7 +1615,7 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int
Animate any objects that have changed their x or y properties in the target state using
an InOutQuad easing curve:
\qml
- Transition { PropertyAnimation { properties: "x,y"; easing.type: "InOutQuad" } }
+ Transition { PropertyAnimation { properties: "x,y"; easing.type: Easing.InOutQuad } }
\endqml
\o In a Behavior
@@ -1754,189 +1764,189 @@ void QDeclarativePropertyAnimation::setTo(const QVariant &t)
Linear.
\qml
- PropertyAnimation { properties: "y"; easing.type: "InOutElastic"; easing.amplitude: 2.0; easing.period: 1.5 }
+ PropertyAnimation { properties: "y"; easing.type: Easing.InOutElastic; easing.amplitude: 2.0; easing.period: 1.5 }
\endqml
Available types are:
\table
\row
- \o \c Linear
+ \o \c Easing.Linear
\o Easing curve for a linear (t) function: velocity is constant.
\o \inlineimage qeasingcurve-linear.png
\row
- \o \c InQuad
+ \o \c Easing.InQuad
\o Easing curve for a quadratic (t^2) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inquad.png
\row
- \o \c OutQuad
+ \o \c Easing.OutQuad
\o Easing curve for a quadratic (t^2) function: decelerating to zero velocity.
\o \inlineimage qeasingcurve-outquad.png
\row
- \o \c InOutQuad
+ \o \c Easing.InOutQuad
\o Easing curve for a quadratic (t^2) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutquad.png
\row
- \o \c OutInQuad
+ \o \c Easing.OutInQuad
\o Easing curve for a quadratic (t^2) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinquad.png
\row
- \o \c InCubic
+ \o \c Easing.InCubic
\o Easing curve for a cubic (t^3) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-incubic.png
\row
- \o \c OutCubic
+ \o \c Easing.OutCubic
\o Easing curve for a cubic (t^3) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outcubic.png
\row
- \o \c InOutCubic
+ \o \c Easing.InOutCubic
\o Easing curve for a cubic (t^3) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutcubic.png
\row
- \o \c OutInCubic
+ \o \c Easing.OutInCubic
\o Easing curve for a cubic (t^3) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outincubic.png
\row
- \o \c InQuart
+ \o \c Easing.InQuart
\o Easing curve for a quartic (t^4) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inquart.png
\row
- \o \c OutQuart
+ \o \c Easing.OutQuart
\o Easing curve for a cubic (t^4) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outquart.png
\row
- \o \c InOutQuart
+ \o \c Easing.InOutQuart
\o Easing curve for a cubic (t^4) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutquart.png
\row
- \o \c OutInQuart
+ \o \c Easing.OutInQuart
\o Easing curve for a cubic (t^4) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinquart.png
\row
- \o \c InQuint
+ \o \c Easing.InQuint
\o Easing curve for a quintic (t^5) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inquint.png
\row
- \o \c OutQuint
+ \o \c Easing.OutQuint
\o Easing curve for a cubic (t^5) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outquint.png
\row
- \o \c InOutQuint
+ \o \c Easing.InOutQuint
\o Easing curve for a cubic (t^5) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutquint.png
\row
- \o \c OutInQuint
+ \o \c Easing.OutInQuint
\o Easing curve for a cubic (t^5) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinquint.png
\row
- \o \c InSine
+ \o \c Easing.InSine
\o Easing curve for a sinusoidal (sin(t)) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-insine.png
\row
- \o \c OutSine
+ \o \c Easing.OutSine
\o Easing curve for a sinusoidal (sin(t)) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outsine.png
\row
- \o \c InOutSine
+ \o \c Easing.InOutSine
\o Easing curve for a sinusoidal (sin(t)) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutsine.png
\row
- \o \c OutInSine
+ \o \c Easing.OutInSine
\o Easing curve for a sinusoidal (sin(t)) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinsine.png
\row
- \o \c InExpo
+ \o \c Easing.InExpo
\o Easing curve for an exponential (2^t) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inexpo.png
\row
- \o \c OutExpo
+ \o \c Easing.OutExpo
\o Easing curve for an exponential (2^t) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outexpo.png
\row
- \o \c InOutExpo
+ \o \c Easing.InOutExpo
\o Easing curve for an exponential (2^t) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutexpo.png
\row
- \o \c OutInExpo
+ \o \c Easing.OutInExpo
\o Easing curve for an exponential (2^t) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinexpo.png
\row
- \o \c InCirc
+ \o \c Easing.InCirc
\o Easing curve for a circular (sqrt(1-t^2)) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-incirc.png
\row
- \o \c OutCirc
+ \o \c Easing.OutCirc
\o Easing curve for a circular (sqrt(1-t^2)) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outcirc.png
\row
- \o \c InOutCirc
+ \o \c Easing.InOutCirc
\o Easing curve for a circular (sqrt(1-t^2)) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutcirc.png
\row
- \o \c OutInCirc
+ \o \c Easing.OutInCirc
\o Easing curve for a circular (sqrt(1-t^2)) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outincirc.png
\row
- \o \c InElastic
+ \o \c Easing.InElastic
\o Easing curve for an elastic (exponentially decaying sine wave) function: accelerating from zero velocity.
\br The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter.
\o \inlineimage qeasingcurve-inelastic.png
\row
- \o \c OutElastic
+ \o \c Easing.OutElastic
\o Easing curve for an elastic (exponentially decaying sine wave) function: decelerating from zero velocity.
\br The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter.
\o \inlineimage qeasingcurve-outelastic.png
\row
- \o \c InOutElastic
+ \o \c Easing.InOutElastic
\o Easing curve for an elastic (exponentially decaying sine wave) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutelastic.png
\row
- \o \c OutInElastic
+ \o \c Easing.OutInElastic
\o Easing curve for an elastic (exponentially decaying sine wave) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinelastic.png
\row
- \o \c InBack
+ \o \c Easing.InBack
\o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inback.png
\row
- \o \c OutBack
+ \o \c Easing.OutBack
\o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing out: decelerating to zero velocity.
\o \inlineimage qeasingcurve-outback.png
\row
- \o \c InOutBack
+ \o \c Easing.InOutBack
\o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutback.png
\row
- \o \c OutInBack
+ \o \c Easing.OutInBack
\o Easing curve for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinback.png
\row
- \o \c InBounce
+ \o \c Easing.InBounce
\o Easing curve for a bounce (exponentially decaying parabolic bounce) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inbounce.png
\row
- \o \c OutBounce
+ \o \c Easing.OutBounce
\o Easing curve for a bounce (exponentially decaying parabolic bounce) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outbounce.png
\row
- \o \c InOutBounce
+ \o \c Easing.InOutBounce
\o Easing curve for a bounce (exponentially decaying parabolic bounce) function easing in/out: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutbounce.png
\row
- \o \c OutInBounce
+ \o \c Easing.OutInBounce
\o Easing curve for a bounce (exponentially decaying parabolic bounce) function easing out/in: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinbounce.png
\endtable
- easing.amplitude is not applicable for all curve types. It is only applicable for bounce and elastic curves (curves of type
- QEasingCurve::InBounce, QEasingCurve::OutBounce, QEasingCurve::InOutBounce, QEasingCurve::OutInBounce, QEasingCurve::InElastic,
- QEasingCurve::OutElastic, QEasingCurve::InOutElastic or QEasingCurve::OutInElastic).
+ easing.amplitude is only applicable for bounce and elastic curves (curves of type
+ Easing.InBounce, Easing.OutBounce, Easing.InOutBounce, Easing.OutInBounce, Easing.InElastic,
+ Easing.OutElastic, Easing.InOutElastic or Easing.OutInElastic).
- easing.overshoot is not applicable for all curve types. It is only applicable if type is: QEasingCurve::InBack, QEasingCurve::OutBack,
- QEasingCurve::InOutBack or QEasingCurve::OutInBack.
+ easing.overshoot is only applicable if type is: Easing.InBack, Easing.OutBack,
+ Easing.InOutBack or Easing.OutInBack.
- easing.period is not applicable for all curve types. It is only applicable if type is: QEasingCurve::InElastic, QEasingCurve::OutElastic,
- QEasingCurve::InOutElastic or QEasingCurve::OutInElastic.
+ easing.period is only applicable if type is: Easing.InElastic, Easing.OutElastic,
+ Easing.InOutElastic or Easing.OutInElastic.
*/
QEasingCurve QDeclarativePropertyAnimation::easing() const
{
@@ -2337,7 +2347,7 @@ QDeclarativeParentAnimation::~QDeclarativeParentAnimation()
}
/*!
- \qmlproperty item ParentAnimation::target
+ \qmlproperty Item ParentAnimation::target
The item to reparent.
When used in a transition, if no target is specified all
@@ -2360,7 +2370,7 @@ void QDeclarativeParentAnimation::setTarget(QDeclarativeItem *target)
}
/*!
- \qmlproperty item ParentAnimation::newParent
+ \qmlproperty Item ParentAnimation::newParent
The new parent to animate to.
If not set, then the parent defined in the end state of the transition.
@@ -2382,7 +2392,7 @@ void QDeclarativeParentAnimation::setNewParent(QDeclarativeItem *newParent)
}
/*!
- \qmlproperty item ParentAnimation::via
+ \qmlproperty Item ParentAnimation::via
The item to reparent via. This provides a way to do an unclipped animation
when both the old parent and new parent are clipped
@@ -2526,13 +2536,13 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions,
viaData->pc << vpc;
viaData->actions << myAction;
QDeclarativeAction dummyAction;
- QDeclarativeAction &xAction = pc->xIsSet() ? actions[++i] : dummyAction;
- QDeclarativeAction &yAction = pc->yIsSet() ? actions[++i] : dummyAction;
- QDeclarativeAction &sAction = pc->scaleIsSet() ? actions[++i] : dummyAction;
- QDeclarativeAction &rAction = pc->rotationIsSet() ? actions[++i] : dummyAction;
+ QDeclarativeAction &xAction = pc->xIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
+ QDeclarativeAction &yAction = pc->yIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
+ QDeclarativeAction &sAction = pc->scaleIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
+ QDeclarativeAction &rAction = pc->rotationIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
bool forward = (direction == QDeclarativeAbstractAnimation::Forward);
QDeclarativeItem *target = pc->object();
- QDeclarativeItem *targetParent = forward ? pc->parent() : pc->originalParent();
+ QDeclarativeItem *targetParent = action.reverseEvent ? pc->originalParent() : pc->parent();
//### this mirrors the logic in QDeclarativeParentChange.
bool ok;
@@ -2573,9 +2583,9 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions,
if (ok && target->transformOrigin() != QDeclarativeItem::TopLeft) {
qreal w = target->width();
qreal h = target->height();
- if (pc->widthIsSet())
+ if (pc->widthIsSet() && i < actions.size() - 1)
w = actions[++i].toValue.toReal();
- if (pc->heightIsSet())
+ if (pc->heightIsSet() && i < actions.size() - 1)
h = actions[++i].toValue.toReal();
const QPointF &transformOrigin
= d->computeTransformOrigin(target->transformOrigin(), w,h);
@@ -2730,7 +2740,7 @@ void QDeclarativeAnchorAnimation::setDuration(int duration)
Linear.
\qml
- AnchorAnimation { easing.type: "InOutQuad" }
+ AnchorAnimation { easing.type: Easing.InOutQuad }
\endqml
See the \l{PropertyAnimation::easing.type} documentation for information
diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h
index 40c893cac0..e7cd8a8f63 100644
--- a/src/declarative/util/qdeclarativeanimation_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p.h
@@ -133,6 +133,7 @@ public:
private Q_SLOTS:
void timelineComplete();
+ void componentFinalized();
private:
virtual void setTarget(const QDeclarativeProperty &);
diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp
index 1089d31a54..90e0ca31da 100644
--- a/src/declarative/util/qdeclarativebehavior.cpp
+++ b/src/declarative/util/qdeclarativebehavior.cpp
@@ -48,6 +48,7 @@
#include <qdeclarativeinfo.h>
#include <qdeclarativeproperty_p.h>
#include <qdeclarativeguard_p.h>
+#include <qdeclarativeengine_p.h>
#include <private/qobject_p.h>
@@ -57,12 +58,14 @@ class QDeclarativeBehaviorPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QDeclarativeBehavior)
public:
- QDeclarativeBehaviorPrivate() : animation(0), enabled(true) {}
+ QDeclarativeBehaviorPrivate() : animation(0), enabled(true), finalized(false) {}
QDeclarativeProperty property;
QVariant currentValue;
+ QVariant targetValue;
QDeclarativeGuard<QDeclarativeAbstractAnimation> animation;
bool enabled;
+ bool finalized;
};
/*!
@@ -80,7 +83,7 @@ public:
y: 200 // initial value
Behavior on y {
NumberAnimation {
- easing.type: "OutBounce"
+ easing.type: Easing.OutBounce
easing.amplitude: 100
duration: 200
}
@@ -158,12 +161,17 @@ void QDeclarativeBehavior::write(const QVariant &value)
{
Q_D(QDeclarativeBehavior);
qmlExecuteDeferred(this);
- if (!d->animation || !d->enabled) {
+ if (!d->animation || !d->enabled || !d->finalized) {
QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
+ d->targetValue = value;
return;
}
+ if (value == d->targetValue)
+ return;
+
d->currentValue = d->property.read();
+ d->targetValue = value;
if (d->animation->qtAnimation()->duration() != -1)
d->animation->qtAnimation()->stop();
@@ -189,6 +197,15 @@ void QDeclarativeBehavior::setTarget(const QDeclarativeProperty &property)
d->currentValue = property.read();
if (d->animation)
d->animation->setDefaultTarget(property);
+
+ QDeclarativeEnginePrivate *engPriv = QDeclarativeEnginePrivate::get(qmlEngine(this));
+ engPriv->registerFinalizedParserStatusObject(this, this->metaObject()->indexOfSlot("componentFinalized()"));
+}
+
+void QDeclarativeBehavior::componentFinalized()
+{
+ Q_D(QDeclarativeBehavior);
+ d->finalized = true;
}
QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativebehavior_p.h b/src/declarative/util/qdeclarativebehavior_p.h
index e8a809faae..6c10eec06c 100644
--- a/src/declarative/util/qdeclarativebehavior_p.h
+++ b/src/declarative/util/qdeclarativebehavior_p.h
@@ -82,6 +82,9 @@ public:
Q_SIGNALS:
void enabledChanged();
+
+private Q_SLOTS:
+ void componentFinalized();
};
QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativebind.cpp b/src/declarative/util/qdeclarativebind.cpp
index 551662813f..5fab6318ba 100644
--- a/src/declarative/util/qdeclarativebind.cpp
+++ b/src/declarative/util/qdeclarativebind.cpp
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
class QDeclarativeBindPrivate : public QObjectPrivate
{
public:
- QDeclarativeBindPrivate() : when(true), componentComplete(false), obj(0) {}
+ QDeclarativeBindPrivate() : when(true), componentComplete(true), obj(0) {}
bool when : 1;
bool componentComplete : 1;
@@ -98,7 +98,6 @@ public:
/*!
\internal
\class QDeclarativeBind
- \ingroup group_utility
\brief The QDeclarativeBind class allows arbitrary property bindings to be created.
Simple bindings are usually earier to do in-place rather than creating a
@@ -198,6 +197,12 @@ void QDeclarativeBind::setValue(const QVariant &v)
eval();
}
+void QDeclarativeBind::classBegin()
+{
+ Q_D(QDeclarativeBind);
+ d->componentComplete = false;
+}
+
void QDeclarativeBind::componentComplete()
{
Q_D(QDeclarativeBind);
diff --git a/src/declarative/util/qdeclarativebind_p.h b/src/declarative/util/qdeclarativebind_p.h
index f756e802c1..f89c2eb374 100644
--- a/src/declarative/util/qdeclarativebind_p.h
+++ b/src/declarative/util/qdeclarativebind_p.h
@@ -80,6 +80,7 @@ public:
void setValue(const QVariant &);
protected:
+ virtual void classBegin();
virtual void componentComplete();
private:
diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp
index 20d878be6a..ffa160f67b 100644
--- a/src/declarative/util/qdeclarativeconnections.cpp
+++ b/src/declarative/util/qdeclarativeconnections.cpp
@@ -57,11 +57,13 @@ QT_BEGIN_NAMESPACE
class QDeclarativeConnectionsPrivate : public QObjectPrivate
{
public:
- QDeclarativeConnectionsPrivate() : target(0), componentcomplete(false) {}
+ QDeclarativeConnectionsPrivate() : target(0), targetSet(false), ignoreUnknownSignals(false), componentcomplete(true) {}
QList<QDeclarativeBoundSignal*> boundsignals;
QObject *target;
+ bool targetSet;
+ bool ignoreUnknownSignals;
bool componentcomplete;
QByteArray data;
@@ -139,17 +141,21 @@ QDeclarativeConnections::~QDeclarativeConnections()
\qmlproperty Object Connections::target
This property holds the object that sends the signal.
- By default, the target is assumed to be the parent of the Connections.
+ If not set at all, the target defaults to be the parent of the Connections.
+
+ If set to null, no connection is made and any signal handlers are ignored
+ until the target is not null.
*/
QObject *QDeclarativeConnections::target() const
{
Q_D(const QDeclarativeConnections);
- return d->target ? d->target : parent();
+ return d->targetSet ? d->target : parent();
}
void QDeclarativeConnections::setTarget(QObject *obj)
{
Q_D(QDeclarativeConnections);
+ d->targetSet = true; // even if setting to 0, it is *set*
if (d->target == obj)
return;
foreach (QDeclarativeBoundSignal *s, d->boundsignals) {
@@ -166,6 +172,29 @@ void QDeclarativeConnections::setTarget(QObject *obj)
emit targetChanged();
}
+/*!
+ \qmlproperty bool Connections::ignoreUnknownSignals
+
+ Normally, you will get a runtime error if you try to connect
+ to signals on an object which the object does not have.
+
+ By setting this flag to true, such errors are ignored. This is
+ useful if you intend to connect to different types of object, handling
+ a different set of signals for each.
+*/
+bool QDeclarativeConnections::ignoreUnknownSignals() const
+{
+ Q_D(const QDeclarativeConnections);
+ return d->ignoreUnknownSignals;
+}
+
+void QDeclarativeConnections::setIgnoreUnknownSignals(bool ignore)
+{
+ Q_D(QDeclarativeConnections);
+ d->ignoreUnknownSignals = ignore;
+}
+
+
QByteArray
QDeclarativeConnectionsParser::compile(const QList<QDeclarativeCustomParserProperty> &props)
@@ -220,7 +249,7 @@ void QDeclarativeConnectionsParser::setCustomData(QObject *object,
void QDeclarativeConnections::connectSignals()
{
Q_D(QDeclarativeConnections);
- if (!d->componentcomplete)
+ if (!d->componentcomplete || (d->targetSet && !target()))
return;
QDataStream ds(d->data);
@@ -230,19 +259,24 @@ void QDeclarativeConnections::connectSignals()
QString script;
ds >> script;
QDeclarativeProperty prop(target(), propName);
- if (!prop.isValid()) {
- qmlInfo(this) << tr("Cannot assign to non-existent property \"%1\"").arg(propName);
- } else if (prop.type() & QDeclarativeProperty::SignalProperty) {
+ if (prop.isValid() && (prop.type() & QDeclarativeProperty::SignalProperty)) {
QDeclarativeBoundSignal *signal =
new QDeclarativeBoundSignal(target(), prop.method(), this);
signal->setExpression(new QDeclarativeExpression(qmlContext(this), script, 0));
d->boundsignals += signal;
} else {
- qmlInfo(this) << tr("Cannot assign to non-existent property \"%1\"").arg(propName);
+ if (!d->ignoreUnknownSignals)
+ qmlInfo(this) << tr("Cannot assign to non-existent property \"%1\"").arg(propName);
}
}
}
+void QDeclarativeConnections::classBegin()
+{
+ Q_D(QDeclarativeConnections);
+ d->componentcomplete=false;
+}
+
void QDeclarativeConnections::componentComplete()
{
Q_D(QDeclarativeConnections);
diff --git a/src/declarative/util/qdeclarativeconnections_p.h b/src/declarative/util/qdeclarativeconnections_p.h
index 3eacf12cc4..a91416693d 100644
--- a/src/declarative/util/qdeclarativeconnections_p.h
+++ b/src/declarative/util/qdeclarativeconnections_p.h
@@ -65,6 +65,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeConnections : public QObject, public QDec
Q_INTERFACES(QDeclarativeParserStatus)
Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
+ Q_PROPERTY(bool ignoreUnknownSignals READ ignoreUnknownSignals WRITE setIgnoreUnknownSignals)
public:
QDeclarativeConnections(QObject *parent=0);
@@ -73,11 +74,15 @@ public:
QObject *target() const;
void setTarget(QObject *);
+ bool ignoreUnknownSignals() const;
+ void setIgnoreUnknownSignals(bool ignore);
+
Q_SIGNALS:
void targetChanged();
private:
void connectSignals();
+ void classBegin();
void componentComplete();
};
diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp
index 4115193d23..adfcd62c01 100644
--- a/src/declarative/util/qdeclarativefontloader.cpp
+++ b/src/declarative/util/qdeclarativefontloader.cpp
@@ -78,7 +78,6 @@ public:
/*!
\qmlclass FontLoader QDeclarativeFontLoader
\since 4.7
- \ingroup group_utility
\brief This item allows using fonts by name or url.
Example:
@@ -186,10 +185,10 @@ void QDeclarativeFontLoader::setName(const QString &name)
This property holds the status of font loading. It can be one of:
\list
- \o Null - no font has been set
- \o Ready - the font has been loaded
- \o Loading - the font is currently being loaded
- \o Error - an error occurred while loading the font
+ \o FontLoader.Null - no font has been set
+ \o FontLoader.Ready - the font has been loaded
+ \o FontLoader.Loading - the font is currently being loaded
+ \o FontLoader.Error - an error occurred while loading the font
\endlist
Note that a change in the status property does not cause anything to happen
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 3810256310..9a5c9dea33 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -207,11 +207,11 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM
Here is an example that uses WorkerScript to periodically append the
current time to a list model:
- \snippet examples/declarative/listmodel-threaded/timedisplay.qml 0
+ \snippet examples/declarative/threading/threadedlistmodel/timedisplay.qml 0
The included file, \tt dataloader.js, looks like this:
- \snippet examples/declarative/listmodel-threaded/dataloader.js 0
+ \snippet examples/declarative/threading/threadedlistmodel/dataloader.js 0
The application's \tt Timer object periodically sends a message to the
worker script by calling \tt WorkerScript::sendMessage(). When this message
@@ -537,11 +537,7 @@ void QDeclarativeListModel::append(const QScriptValue& valuemap)
*/
QScriptValue QDeclarativeListModel::get(int index) const
{
- if (index >= count() || index < 0) {
- qmlInfo(this) << tr("get: index %1 out of range").arg(index);
- return 0;
- }
-
+ // the internal flat/nested class checks for bad index
return m_flat ? m_flat->get(index) : m_nested->get(index);
}
@@ -591,7 +587,7 @@ void QDeclarativeListModel::set(int index, const QScriptValue& valuemap)
Changes the \a property of the item at \a index in the list model to \a value.
\code
- fruitModel.set(3, "cost", 5.95)
+ fruitModel.setProperty(3, "cost", 5.95)
\endcode
The \a index must be an element in the list.
@@ -930,13 +926,14 @@ bool FlatListModel::insert(int index, const QScriptValue &value)
QScriptValue FlatListModel::get(int index) const
{
- Q_ASSERT(index >= 0 && index < m_values.count());
-
QScriptEngine *scriptEngine = m_scriptEngine ? m_scriptEngine : QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(m_listModel));
- if (!scriptEngine)
+ if (!scriptEngine)
return 0;
+ if (index < 0 || index >= m_values.count())
+ return scriptEngine->undefinedValue();
+
QScriptValue rv = scriptEngine->newObject();
QHash<int, QVariant> row = m_values.at(index);
@@ -999,7 +996,8 @@ bool FlatListModel::addValue(const QScriptValue &value, QHash<int, QVariant> *ro
QScriptValueIterator it(value);
while (it.hasNext()) {
it.next();
- if (it.value().isObject()) {
+ QScriptValue value = it.value();
+ if (!value.isVariant() && !value.isRegExp() && !value.isDate() && value.isObject()) {
qmlInfo(m_listModel) << "Cannot add nested list values when modifying or after modification from a worker script";
return false;
}
@@ -1182,13 +1180,21 @@ bool NestedListModel::append(const QScriptValue& valuemap)
}
QScriptValue NestedListModel::get(int index) const
-{
- ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(index));
- if (!node)
- return 0;
+{
QDeclarativeEngine *eng = qmlEngine(m_listModel);
if (!eng)
return 0;
+
+ if (index < 0 || index >= count()) {
+ QScriptEngine *seng = QDeclarativeEnginePrivate::getScriptEngine(eng);
+ if (seng)
+ return seng->undefinedValue();
+ return 0;
+ }
+
+ ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(index));
+ if (!node)
+ return 0;
return QDeclarativeEnginePrivate::qmlScriptObject(node->object(this), eng);
}
diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent_p.h b/src/declarative/util/qdeclarativelistmodelworkeragent_p.h
index 53d30c28a1..1622144f6e 100644
--- a/src/declarative/util/qdeclarativelistmodelworkeragent_p.h
+++ b/src/declarative/util/qdeclarativelistmodelworkeragent_p.h
@@ -146,7 +146,7 @@ private:
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QDeclarativeListModelWorkerAgent::VariantRef);
+Q_DECLARE_METATYPE(QDeclarativeListModelWorkerAgent::VariantRef)
QT_END_HEADER
diff --git a/src/declarative/util/qdeclarativeopenmetaobject.cpp b/src/declarative/util/qdeclarativeopenmetaobject.cpp
index 0e5aaa673c..ba5d5340ec 100644
--- a/src/declarative/util/qdeclarativeopenmetaobject.cpp
+++ b/src/declarative/util/qdeclarativeopenmetaobject.cpp
@@ -305,7 +305,7 @@ void QDeclarativeOpenMetaObject::setCached(bool c)
QDeclarativeData *qmldata = QDeclarativeData::get(d->object, true);
if (d->cacheProperties) {
if (!d->type->d->cache)
- d->type->d->cache = QDeclarativePropertyCache::create(d->type->d->engine, this);
+ d->type->d->cache = new QDeclarativePropertyCache(d->type->d->engine, this);
qmldata->propertyCache = d->type->d->cache;
d->type->d->cache->addref();
} else {
diff --git a/src/declarative/util/qdeclarativepackage.cpp b/src/declarative/util/qdeclarativepackage.cpp
index 20e99078ad..9617b8672a 100644
--- a/src/declarative/util/qdeclarativepackage.cpp
+++ b/src/declarative/util/qdeclarativepackage.cpp
@@ -62,13 +62,13 @@ QT_BEGIN_NAMESPACE
delegate it should appear in. This allows an item to move
between views.
- \snippet examples/declarative/package/Delegate.qml 0
+ \snippet examples/declarative/modelviews/package/Delegate.qml 0
These named items are used as the delegates by the two views who
reference the special VisualDataModel.parts property to select
a model which provides the chosen delegate.
- \snippet examples/declarative/package/view.qml 0
+ \snippet examples/declarative/modelviews/package/view.qml 0
\sa QtDeclarative
*/
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp
index dbca326429..d9ce42c84d 100644
--- a/src/declarative/util/qdeclarativepixmapcache.cpp
+++ b/src/declarative/util/qdeclarativepixmapcache.cpp
@@ -55,6 +55,7 @@
#include <QFile>
#include <QThread>
#include <QMutex>
+#include <QBuffer>
#include <QWaitCondition>
#include <QtCore/qdebug.h>
#include <private/qobject_p.h>
@@ -342,7 +343,10 @@ void QDeclarativeImageRequestHandler::networkRequestDone()
errorString = reply->errorString();
} else {
QSize read_impsize;
- if (readImage(reply->url(), reply, &image, &errorString, &read_impsize, job->forcedWidth(), job->forcedHeight())) {
+ QByteArray all = reply->readAll();
+ QBuffer buff(&all);
+ buff.open(QIODevice::ReadOnly);
+ if (readImage(reply->url(), &buff, &image, &errorString, &read_impsize, job->forcedWidth(), job->forcedHeight())) {
qmlOriginalSizes()->insert(reply->url(), read_impsize);
error = QDeclarativeImageReaderEvent::NoError;
} else {
diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp
index 4b2d5a0658..12fef36de6 100644
--- a/src/declarative/util/qdeclarativepropertychanges.cpp
+++ b/src/declarative/util/qdeclarativepropertychanges.cpp
@@ -51,6 +51,7 @@
#include <qdeclarativecontext.h>
#include <qdeclarativeguard_p.h>
#include <qdeclarativeproperty_p.h>
+#include <qdeclarativecontext_p.h>
#include <QtCore/qdebug.h>
@@ -162,11 +163,15 @@ public:
virtual void execute(Reason) {
ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, expression);
+ if (ownedExpression == expression)
+ ownedExpression = 0;
}
virtual bool isReversable() { return true; }
virtual void reverse(Reason) {
ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, reverseExpression);
+ if (ownedExpression == reverseExpression)
+ ownedExpression = 0;
}
virtual void saveOriginals() {
@@ -174,11 +179,26 @@ public:
reverseExpression = rewindExpression;
}
+ /*virtual void copyOriginals(QDeclarativeActionEvent *other)
+ {
+ QDeclarativeReplaceSignalHandler *rsh = static_cast<QDeclarativeReplaceSignalHandler*>(other);
+ saveCurrentValues();
+ if (rsh == this)
+ return;
+ reverseExpression = rsh->reverseExpression;
+ if (rsh->ownedExpression == reverseExpression) {
+ ownedExpression = rsh->ownedExpression;
+ rsh->ownedExpression = 0;
+ }
+ }*/
+
virtual void rewind() {
ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, rewindExpression);
+ if (ownedExpression == rewindExpression)
+ ownedExpression = 0;
}
virtual void saveCurrentValues() {
- rewindExpression = QDeclarativePropertyPrivate::signalExpression(property);
+ rewindExpression = QDeclarativePropertyPrivate::signalExpression(property);
}
virtual bool override(QDeclarativeActionEvent*other) {
@@ -302,12 +322,18 @@ void QDeclarativePropertyChangesPrivate::decode()
QDeclarativeProperty prop = property(name); //### better way to check for signal property?
if (prop.type() & QDeclarativeProperty::SignalProperty) {
QDeclarativeExpression *expression = new QDeclarativeExpression(qmlContext(q), data.toString(), object);
+ QDeclarativeData *ddata = QDeclarativeData::get(q);
+ if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
+ expression->setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
QDeclarativeReplaceSignalHandler *handler = new QDeclarativeReplaceSignalHandler;
handler->property = prop;
handler->expression = expression;
signalReplacements << handler;
} else if (isScript) {
QDeclarativeExpression *expression = new QDeclarativeExpression(qmlContext(q), data.toString(), object);
+ QDeclarativeData *ddata = QDeclarativeData::get(q);
+ if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
+ expression->setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
expressions << qMakePair(name, expression);
} else {
properties << qMakePair(name, data);
@@ -437,9 +463,11 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions()
if (d->isExplicit) {
a.toValue = d->expressions.at(ii).second->evaluate();
} else {
+ QDeclarativeExpression *e = d->expressions.at(ii).second;
QDeclarativeBinding *newBinding =
- new QDeclarativeBinding(d->expressions.at(ii).second->expression(), object(), qmlContext(this));
+ new QDeclarativeBinding(e->expression(), object(), qmlContext(this));
newBinding->setTarget(prop);
+ newBinding->setSourceLocation(e->sourceFile(), e->lineNumber());
a.toBinding = newBinding;
a.deletableToBinding = true;
}
diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp
index 19a00eeb02..bd48ef0112 100644
--- a/src/declarative/util/qdeclarativesmoothedanimation.cpp
+++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp
@@ -388,10 +388,10 @@ void QDeclarativeSmoothedAnimation::transition(QDeclarativeStateActions &actions
Sets how the SmoothedAnimation behaves if an animation direction is reversed.
- If reversing mode is \c Eased, the animation will smoothly decelerate, and
- then reverse direction. If the reversing mode is \c Immediate, the
+ If reversing mode is \c SmoothedAnimation.Eased, the animation will smoothly decelerate, and
+ then reverse direction. If the reversing mode is \c SmoothedAnimation.Immediate, the
animation will immediately begin accelerating in the reverse direction,
- begining with a velocity of 0. If the reversing mode is \c Sync, the
+ begining with a velocity of 0. If the reversing mode is \c SmoothedAnimation.Sync, the
property is immediately set to the target value.
*/
QDeclarativeSmoothedAnimation::ReversingMode QDeclarativeSmoothedAnimation::reversingMode() const
diff --git a/src/declarative/util/qdeclarativesmoothedanimation_p.h b/src/declarative/util/qdeclarativesmoothedanimation_p.h
index 17aafa4365..f45d19fe69 100644
--- a/src/declarative/util/qdeclarativesmoothedanimation_p.h
+++ b/src/declarative/util/qdeclarativesmoothedanimation_p.h
@@ -96,7 +96,7 @@ Q_SIGNALS:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QDeclarativeSmoothedAnimation);
+QML_DECLARE_TYPE(QDeclarativeSmoothedAnimation)
QT_END_HEADER
diff --git a/src/declarative/util/qdeclarativesmoothedfollow.cpp b/src/declarative/util/qdeclarativesmoothedfollow.cpp
index 3ed92570c4..f70df9d924 100644
--- a/src/declarative/util/qdeclarativesmoothedfollow.cpp
+++ b/src/declarative/util/qdeclarativesmoothedfollow.cpp
@@ -143,10 +143,10 @@ QDeclarativeSmoothedFollowPrivate::QDeclarativeSmoothedFollowPrivate()
Sets how the SmoothedFollow behaves if an animation direction is reversed.
- If reversing mode is \c Eased, the animation will smoothly decelerate, and
- then reverse direction. If the reversing mode is \c Immediate, the
+ If reversing mode is \c SmoothedFollow.Eased, the animation will smoothly decelerate, and
+ then reverse direction. If the reversing mode is \c SmoothedFollow.Immediate, the
animation will immediately begin accelerating in the reverse direction,
- begining with a velocity of 0. If the reversing mode is \c Sync, the
+ begining with a velocity of 0. If the reversing mode is \c SmoothedFollow.Sync, the
property is immediately set to the target value.
*/
QDeclarativeSmoothedFollow::ReversingMode QDeclarativeSmoothedFollow::reversingMode() const
diff --git a/src/declarative/util/qdeclarativesmoothedfollow_p.h b/src/declarative/util/qdeclarativesmoothedfollow_p.h
index d8600525ae..6319192f68 100644
--- a/src/declarative/util/qdeclarativesmoothedfollow_p.h
+++ b/src/declarative/util/qdeclarativesmoothedfollow_p.h
@@ -106,7 +106,7 @@ Q_SIGNALS:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QDeclarativeSmoothedFollow);
+QML_DECLARE_TYPE(QDeclarativeSmoothedFollow)
QT_END_HEADER
diff --git a/src/declarative/util/qdeclarativespringfollow.cpp b/src/declarative/util/qdeclarativespringfollow.cpp
index 70077f3f12..aae66ac52a 100644
--- a/src/declarative/util/qdeclarativespringfollow.cpp
+++ b/src/declarative/util/qdeclarativespringfollow.cpp
@@ -227,7 +227,7 @@ void QDeclarativeSpringFollowPrivate::stop()
loops: Animation.Infinite
NumberAnimation {
to: 200
- easing.type: "OutBounce"
+ easing.type: Easing.OutBounce
easing.amplitude: 100
duration: 2000
}
diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp
index 861cbc8af6..b5f7900912 100644
--- a/src/declarative/util/qdeclarativestate.cpp
+++ b/src/declarative/util/qdeclarativestate.cpp
@@ -149,7 +149,6 @@ QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObje
\class QDeclarativeState
\brief The QDeclarativeState class allows you to define configurations of objects and properties.
- \ingroup group_states
QDeclarativeState allows you to specify a state as a set of batched changes from the default
configuration.
@@ -391,12 +390,13 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit
if (action.event->override(event)) {
found = true;
- if (action.event != d->revertList.at(jj).event) {
+ if (action.event != d->revertList.at(jj).event && action.event->needsCopy()) {
action.event->copyOriginals(d->revertList.at(jj).event);
QDeclarativeSimpleAction r(action);
additionalReverts << r;
d->revertList.removeAt(jj);
+ --jj;
} else if (action.event->isRewindable()) //###why needed?
action.event->saveCurrentValues();
diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h
index 0ba67b04a4..25715c601f 100644
--- a/src/declarative/util/qdeclarativestate_p.h
+++ b/src/declarative/util/qdeclarativestate_p.h
@@ -96,6 +96,7 @@ public:
virtual bool isReversable();
virtual void reverse(Reason reason = ActualChange);
virtual void saveOriginals() {}
+ virtual bool needsCopy() { return false; }
virtual void copyOriginals(QDeclarativeActionEvent *) {}
virtual bool isRewindable() { return isReversable(); }
diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp
index 5b514951b8..9b042d7a4c 100644
--- a/src/declarative/util/qdeclarativestategroup.cpp
+++ b/src/declarative/util/qdeclarativestategroup.cpp
@@ -47,6 +47,7 @@
#include <qdeclarativebinding_p.h>
#include <qdeclarativeglobal_p.h>
+#include <QtCore/qstringbuilder.h>
#include <QtCore/qdebug.h>
#include <private/qobject_p.h>
@@ -62,7 +63,7 @@ class QDeclarativeStateGroupPrivate : public QObjectPrivate
public:
QDeclarativeStateGroupPrivate()
: nullState(0), componentComplete(true),
- ignoreTrans(false), applyingState(false) {}
+ ignoreTrans(false), applyingState(false), unnamedCount(0) {}
QString currentState;
QDeclarativeState *nullState;
@@ -78,6 +79,7 @@ public:
bool componentComplete;
bool ignoreTrans;
bool applyingState;
+ int unnamedCount;
QDeclarativeTransition *findTransition(const QString &from, const QString &to);
void setCurrentStateInternal(const QString &state, bool = false);
@@ -259,6 +261,12 @@ void QDeclarativeStateGroup::componentComplete()
Q_D(QDeclarativeStateGroup);
d->componentComplete = true;
+ for (int ii = 0; ii < d->states.count(); ++ii) {
+ QDeclarativeState *state = d->states.at(ii);
+ if (state->name().isEmpty())
+ state->setName(QLatin1String("anonymousState") % QString::number(++d->unnamedCount));
+ }
+
if (d->updateAutoState()) {
return;
} else if (!d->currentState.isEmpty()) {
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 689f53cb71..0326f6d661 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -408,7 +408,7 @@ void QDeclarativeParentChange::saveOriginals()
d->origStackBefore = d->rewindStackBefore;
}
-void QDeclarativeParentChange::copyOriginals(QDeclarativeActionEvent *other)
+/*void QDeclarativeParentChange::copyOriginals(QDeclarativeActionEvent *other)
{
Q_D(QDeclarativeParentChange);
QDeclarativeParentChange *pc = static_cast<QDeclarativeParentChange*>(other);
@@ -417,7 +417,7 @@ void QDeclarativeParentChange::copyOriginals(QDeclarativeActionEvent *other)
d->origStackBefore = pc->d_func()->rewindStackBefore;
saveCurrentValues();
-}
+}*/
void QDeclarativeParentChange::execute(Reason)
{
@@ -1056,40 +1056,41 @@ void QDeclarativeAnchorChanges::execute(Reason reason)
if (!d->target)
return;
+ QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
//incorporate any needed "reverts"
if (d->applyOrigLeft) {
if (!d->origLeftBinding)
- d->target->anchors()->resetLeft();
+ targetPrivate->anchors()->resetLeft();
QDeclarativePropertyPrivate::setBinding(d->leftProp, d->origLeftBinding);
}
if (d->applyOrigRight) {
if (!d->origRightBinding)
- d->target->anchors()->resetRight();
+ targetPrivate->anchors()->resetRight();
QDeclarativePropertyPrivate::setBinding(d->rightProp, d->origRightBinding);
}
if (d->applyOrigHCenter) {
if (!d->origHCenterBinding)
- d->target->anchors()->resetHorizontalCenter();
+ targetPrivate->anchors()->resetHorizontalCenter();
QDeclarativePropertyPrivate::setBinding(d->hCenterProp, d->origHCenterBinding);
}
if (d->applyOrigTop) {
if (!d->origTopBinding)
- d->target->anchors()->resetTop();
+ targetPrivate->anchors()->resetTop();
QDeclarativePropertyPrivate::setBinding(d->topProp, d->origTopBinding);
}
if (d->applyOrigBottom) {
if (!d->origBottomBinding)
- d->target->anchors()->resetBottom();
+ targetPrivate->anchors()->resetBottom();
QDeclarativePropertyPrivate::setBinding(d->bottomProp, d->origBottomBinding);
}
if (d->applyOrigVCenter) {
if (!d->origVCenterBinding)
- d->target->anchors()->resetVerticalCenter();
+ targetPrivate->anchors()->resetVerticalCenter();
QDeclarativePropertyPrivate::setBinding(d->vCenterProp, d->origVCenterBinding);
}
if (d->applyOrigBaseline) {
if (!d->origBaselineBinding)
- d->target->anchors()->resetBaseline();
+ targetPrivate->anchors()->resetBaseline();
QDeclarativePropertyPrivate::setBinding(d->baselineProp, d->origBaselineBinding);
}
@@ -1105,31 +1106,31 @@ void QDeclarativeAnchorChanges::execute(Reason reason)
//reset any anchors that have been specified as "undefined"
if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::LeftAnchor) {
- d->target->anchors()->resetLeft();
+ targetPrivate->anchors()->resetLeft();
QDeclarativePropertyPrivate::setBinding(d->leftProp, 0);
}
if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::RightAnchor) {
- d->target->anchors()->resetRight();
+ targetPrivate->anchors()->resetRight();
QDeclarativePropertyPrivate::setBinding(d->rightProp, 0);
}
if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::HCenterAnchor) {
- d->target->anchors()->resetHorizontalCenter();
+ targetPrivate->anchors()->resetHorizontalCenter();
QDeclarativePropertyPrivate::setBinding(d->hCenterProp, 0);
}
if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::TopAnchor) {
- d->target->anchors()->resetTop();
+ targetPrivate->anchors()->resetTop();
QDeclarativePropertyPrivate::setBinding(d->topProp, 0);
}
if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::BottomAnchor) {
- d->target->anchors()->resetBottom();
+ targetPrivate->anchors()->resetBottom();
QDeclarativePropertyPrivate::setBinding(d->bottomProp, 0);
}
if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::VCenterAnchor) {
- d->target->anchors()->resetVerticalCenter();
+ targetPrivate->anchors()->resetVerticalCenter();
QDeclarativePropertyPrivate::setBinding(d->vCenterProp, 0);
}
if (d->anchorSet->d_func()->resetAnchors & QDeclarativeAnchors::BaselineAnchor) {
- d->target->anchors()->resetBaseline();
+ targetPrivate->anchors()->resetBaseline();
QDeclarativePropertyPrivate::setBinding(d->baselineProp, 0);
}
@@ -1161,51 +1162,52 @@ void QDeclarativeAnchorChanges::reverse(Reason reason)
if (!d->target)
return;
+ QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
//reset any anchors set by the state
if (d->leftBinding) {
- d->target->anchors()->resetLeft();
+ targetPrivate->anchors()->resetLeft();
QDeclarativePropertyPrivate::setBinding(d->leftBinding->property(), 0);
if (reason == ActualChange) {
d->leftBinding->destroy(); d->leftBinding = 0;
}
}
if (d->rightBinding) {
- d->target->anchors()->resetRight();
+ targetPrivate->anchors()->resetRight();
QDeclarativePropertyPrivate::setBinding(d->rightBinding->property(), 0);
if (reason == ActualChange) {
d->rightBinding->destroy(); d->rightBinding = 0;
}
}
if (d->hCenterBinding) {
- d->target->anchors()->resetHorizontalCenter();
+ targetPrivate->anchors()->resetHorizontalCenter();
QDeclarativePropertyPrivate::setBinding(d->hCenterBinding->property(), 0);
if (reason == ActualChange) {
d->hCenterBinding->destroy(); d->hCenterBinding = 0;
}
}
if (d->topBinding) {
- d->target->anchors()->resetTop();
+ targetPrivate->anchors()->resetTop();
QDeclarativePropertyPrivate::setBinding(d->topBinding->property(), 0);
if (reason == ActualChange) {
d->topBinding->destroy(); d->topBinding = 0;
}
}
if (d->bottomBinding) {
- d->target->anchors()->resetBottom();
+ targetPrivate->anchors()->resetBottom();
QDeclarativePropertyPrivate::setBinding(d->bottomBinding->property(), 0);
if (reason == ActualChange) {
d->bottomBinding->destroy(); d->bottomBinding = 0;
}
}
if (d->vCenterBinding) {
- d->target->anchors()->resetVerticalCenter();
+ targetPrivate->anchors()->resetVerticalCenter();
QDeclarativePropertyPrivate::setBinding(d->vCenterBinding->property(), 0);
if (reason == ActualChange) {
d->vCenterBinding->destroy(); d->vCenterBinding = 0;
}
}
if (d->baselineBinding) {
- d->target->anchors()->resetBaseline();
+ targetPrivate->anchors()->resetBaseline();
QDeclarativePropertyPrivate::setBinding(d->baselineBinding->property(), 0);
if (reason == ActualChange) {
d->baselineBinding->destroy(); d->baselineBinding = 0;
@@ -1239,24 +1241,28 @@ QList<QDeclarativeAction> QDeclarativeAnchorChanges::additionalActions()
Q_D(QDeclarativeAnchorChanges);
QList<QDeclarativeAction> extra;
+ QDeclarativeAnchors::Anchors combined = d->anchorSet->d_func()->usedAnchors | d->anchorSet->d_func()->resetAnchors;
+ bool hChange = combined & QDeclarativeAnchors::Horizontal_Mask;
+ bool vChange = combined & QDeclarativeAnchors::Vertical_Mask;
+
if (d->target) {
QDeclarativeAction a;
- if (d->fromX != d->toX) {
+ if (hChange && d->fromX != d->toX) {
a.property = QDeclarativeProperty(d->target, QLatin1String("x"));
a.toValue = d->toX;
extra << a;
}
- if (d->fromY != d->toY) {
+ if (vChange && d->fromY != d->toY) {
a.property = QDeclarativeProperty(d->target, QLatin1String("y"));
a.toValue = d->toY;
extra << a;
}
- if (d->fromWidth != d->toWidth) {
+ if (hChange && d->fromWidth != d->toWidth) {
a.property = QDeclarativeProperty(d->target, QLatin1String("width"));
a.toValue = d->toWidth;
extra << a;
}
- if (d->fromHeight != d->toHeight) {
+ if (vChange && d->fromHeight != d->toHeight) {
a.property = QDeclarativeProperty(d->target, QLatin1String("height"));
a.toValue = d->toHeight;
extra << a;
@@ -1335,37 +1341,38 @@ void QDeclarativeAnchorChanges::clearBindings()
d->fromWidth = d->target->width();
d->fromHeight = d->target->height();
+ QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
//reset any anchors with corresponding reverts
//reset any anchors that have been specified as "undefined"
//reset any anchors that we'll be setting in the state
QDeclarativeAnchors::Anchors combined = d->anchorSet->d_func()->resetAnchors |
d->anchorSet->d_func()->usedAnchors;
if (d->applyOrigLeft || (combined & QDeclarativeAnchors::LeftAnchor)) {
- d->target->anchors()->resetLeft();
+ targetPrivate->anchors()->resetLeft();
QDeclarativePropertyPrivate::setBinding(d->leftProp, 0);
}
if (d->applyOrigRight || (combined & QDeclarativeAnchors::RightAnchor)) {
- d->target->anchors()->resetRight();
+ targetPrivate->anchors()->resetRight();
QDeclarativePropertyPrivate::setBinding(d->rightProp, 0);
}
if (d->applyOrigHCenter || (combined & QDeclarativeAnchors::HCenterAnchor)) {
- d->target->anchors()->resetHorizontalCenter();
+ targetPrivate->anchors()->resetHorizontalCenter();
QDeclarativePropertyPrivate::setBinding(d->hCenterProp, 0);
}
if (d->applyOrigTop || (combined & QDeclarativeAnchors::TopAnchor)) {
- d->target->anchors()->resetTop();
+ targetPrivate->anchors()->resetTop();
QDeclarativePropertyPrivate::setBinding(d->topProp, 0);
}
if (d->applyOrigBottom || (combined & QDeclarativeAnchors::BottomAnchor)) {
- d->target->anchors()->resetBottom();
+ targetPrivate->anchors()->resetBottom();
QDeclarativePropertyPrivate::setBinding(d->bottomProp, 0);
}
if (d->applyOrigVCenter || (combined & QDeclarativeAnchors::VCenterAnchor)) {
- d->target->anchors()->resetVerticalCenter();
+ targetPrivate->anchors()->resetVerticalCenter();
QDeclarativePropertyPrivate::setBinding(d->vCenterProp, 0);
}
if (d->applyOrigBaseline || (combined & QDeclarativeAnchors::BaselineAnchor)) {
- d->target->anchors()->resetBaseline();
+ targetPrivate->anchors()->resetBaseline();
QDeclarativePropertyPrivate::setBinding(d->baselineProp, 0);
}
}
@@ -1387,21 +1394,22 @@ void QDeclarativeAnchorChanges::rewind()
if (!d->target)
return;
+ QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
//restore previous anchors
if (d->rewindLeft.anchorLine != QDeclarativeAnchorLine::Invalid)
- d->target->anchors()->setLeft(d->rewindLeft);
+ targetPrivate->anchors()->setLeft(d->rewindLeft);
if (d->rewindRight.anchorLine != QDeclarativeAnchorLine::Invalid)
- d->target->anchors()->setRight(d->rewindRight);
+ targetPrivate->anchors()->setRight(d->rewindRight);
if (d->rewindHCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
- d->target->anchors()->setHorizontalCenter(d->rewindHCenter);
+ targetPrivate->anchors()->setHorizontalCenter(d->rewindHCenter);
if (d->rewindTop.anchorLine != QDeclarativeAnchorLine::Invalid)
- d->target->anchors()->setTop(d->rewindTop);
+ targetPrivate->anchors()->setTop(d->rewindTop);
if (d->rewindBottom.anchorLine != QDeclarativeAnchorLine::Invalid)
- d->target->anchors()->setBottom(d->rewindBottom);
+ targetPrivate->anchors()->setBottom(d->rewindBottom);
if (d->rewindVCenter.anchorLine != QDeclarativeAnchorLine::Invalid)
- d->target->anchors()->setVerticalCenter(d->rewindVCenter);
+ targetPrivate->anchors()->setVerticalCenter(d->rewindVCenter);
if (d->rewindBaseline.anchorLine != QDeclarativeAnchorLine::Invalid)
- d->target->anchors()->setBaseline(d->rewindBaseline);
+ targetPrivate->anchors()->setBaseline(d->rewindBaseline);
d->target->setX(d->rewindX);
d->target->setY(d->rewindY);
@@ -1415,13 +1423,14 @@ void QDeclarativeAnchorChanges::saveCurrentValues()
if (!d->target)
return;
- d->rewindLeft = d->target->anchors()->left();
- d->rewindRight = d->target->anchors()->right();
- d->rewindHCenter = d->target->anchors()->horizontalCenter();
- d->rewindTop = d->target->anchors()->top();
- d->rewindBottom = d->target->anchors()->bottom();
- d->rewindVCenter = d->target->anchors()->verticalCenter();
- d->rewindBaseline = d->target->anchors()->baseline();
+ QDeclarativeItemPrivate *targetPrivate = QDeclarativeItemPrivate::get(d->target);
+ d->rewindLeft = targetPrivate->anchors()->left();
+ d->rewindRight = targetPrivate->anchors()->right();
+ d->rewindHCenter = targetPrivate->anchors()->horizontalCenter();
+ d->rewindTop = targetPrivate->anchors()->top();
+ d->rewindBottom = targetPrivate->anchors()->bottom();
+ d->rewindVCenter = targetPrivate->anchors()->verticalCenter();
+ d->rewindBaseline = targetPrivate->anchors()->baseline();
d->rewindX = d->target->x();
d->rewindY = d->target->y();
diff --git a/src/declarative/util/qdeclarativestateoperations_p.h b/src/declarative/util/qdeclarativestateoperations_p.h
index e22c1e2236..21a86f5deb 100644
--- a/src/declarative/util/qdeclarativestateoperations_p.h
+++ b/src/declarative/util/qdeclarativestateoperations_p.h
@@ -107,7 +107,7 @@ public:
virtual ActionList actions();
virtual void saveOriginals();
- virtual void copyOriginals(QDeclarativeActionEvent*);
+ //virtual void copyOriginals(QDeclarativeActionEvent*);
virtual void execute(Reason reason = ActualChange);
virtual bool isReversable();
virtual void reverse(Reason reason = ActualChange);
@@ -277,6 +277,7 @@ public:
virtual bool override(QDeclarativeActionEvent*other);
virtual bool changesBindings();
virtual void saveOriginals();
+ virtual bool needsCopy() { return true; }
virtual void copyOriginals(QDeclarativeActionEvent*);
virtual void clearBindings();
virtual void rewind();
diff --git a/src/declarative/util/qdeclarativesystempalette.cpp b/src/declarative/util/qdeclarativesystempalette.cpp
index 9bb3f69c7d..6c624467a8 100644
--- a/src/declarative/util/qdeclarativesystempalette.cpp
+++ b/src/declarative/util/qdeclarativesystempalette.cpp
@@ -59,7 +59,6 @@ public:
/*!
\qmlclass SystemPalette QDeclarativeSystemPalette
\since 4.7
- \ingroup group_utility
\brief The SystemPalette item gives access to the Qt palettes.
\sa QPalette
diff --git a/src/declarative/util/qdeclarativetimeline.cpp b/src/declarative/util/qdeclarativetimeline.cpp
index 656c62b895..0258b3ce63 100644
--- a/src/declarative/util/qdeclarativetimeline.cpp
+++ b/src/declarative/util/qdeclarativetimeline.cpp
@@ -255,7 +255,6 @@ qreal QDeclarativeTimeLinePrivate::value(const Op &op, int time, qreal base, boo
/*!
\internal
\class QDeclarativeTimeLine
- \ingroup group_animation
\brief The QDeclarativeTimeLine class provides a timeline for controlling animations.
QDeclarativeTimeLine is similar to QTimeLine except:
@@ -387,7 +386,10 @@ void QDeclarativeTimeLine::set(QDeclarativeTimeLineValue &timeLineValue, qreal v
*/
int QDeclarativeTimeLine::accel(QDeclarativeTimeLineValue &timeLineValue, qreal velocity, qreal acceleration)
{
- if ((velocity > 0.0f) == (acceleration > 0.0f))
+ if (acceleration == 0.0f)
+ return -1;
+
+ if ((velocity > 0.0f) == (acceleration > 0.0f))
acceleration = acceleration * -1.0f;
int time = static_cast<int>(-1000 * velocity / acceleration);
@@ -410,13 +412,16 @@ int QDeclarativeTimeLine::accel(QDeclarativeTimeLineValue &timeLineValue, qreal
*/
int QDeclarativeTimeLine::accel(QDeclarativeTimeLineValue &timeLineValue, qreal velocity, qreal acceleration, qreal maxDistance)
{
- Q_ASSERT(acceleration >= 0.0f && maxDistance >= 0.0f);
+ if (maxDistance == 0.0f || acceleration == 0.0f)
+ return -1;
+
+ Q_ASSERT(acceleration > 0.0f && maxDistance > 0.0f);
qreal maxAccel = (velocity * velocity) / (2.0f * maxDistance);
if (maxAccel > acceleration)
acceleration = maxAccel;
- if ((velocity > 0.0f) == (acceleration > 0.0f))
+ if ((velocity > 0.0f) == (acceleration > 0.0f))
acceleration = acceleration * -1.0f;
int time = static_cast<int>(-1000 * velocity / acceleration);
@@ -438,6 +443,7 @@ int QDeclarativeTimeLine::accelDistance(QDeclarativeTimeLineValue &timeLineValue
{
if (distance == 0.0f || velocity == 0.0f)
return -1;
+
Q_ASSERT((distance >= 0.0f) == (velocity >= 0.0f));
int time = static_cast<int>(1000 * (2.0f * distance) / velocity);
@@ -868,7 +874,6 @@ void QDeclarativeTimeLine::remove(QDeclarativeTimeLineObject *v)
/*!
\internal
\class QDeclarativeTimeLineValue
- \ingroup group_animation
\brief The QDeclarativeTimeLineValue class provides a value that can be modified by QDeclarativeTimeLine.
*/
diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp
index f2841567c6..ab8b116c06 100644
--- a/src/declarative/util/qdeclarativetransition.cpp
+++ b/src/declarative/util/qdeclarativetransition.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass Transition QDeclarativeTransition
- \since 4.7
+ \since 4.7
\brief The Transition element defines animated transitions that occur on state changes.
\sa {qmlstates}{States}, {state-transitions}{Transitions}, {QtDeclarative}
@@ -63,8 +63,6 @@ QT_BEGIN_NAMESPACE
\internal
\class QDeclarativeTransition
\brief The QDeclarativeTransition class allows you to define animated transitions that occur on state changes.
-
- \ingroup group_states
*/
//ParallelAnimationWrapper allows us to do a "callback" when the animation finishes, rather than connecting
diff --git a/src/declarative/util/qdeclarativetransitionmanager_p_p.h b/src/declarative/util/qdeclarativetransitionmanager_p_p.h
index 41313919fe..2e23898339 100644
--- a/src/declarative/util/qdeclarativetransitionmanager_p_p.h
+++ b/src/declarative/util/qdeclarativetransitionmanager_p_p.h
@@ -70,7 +70,7 @@ public:
void cancel();
private:
- Q_DISABLE_COPY(QDeclarativeTransitionManager);
+ Q_DISABLE_COPY(QDeclarativeTransitionManager)
QDeclarativeTransitionManagerPrivate *d;
void complete();
diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp
index 62d913c5b3..e68ef94dc7 100644
--- a/src/declarative/util/qdeclarativeview.cpp
+++ b/src/declarative/util/qdeclarativeview.cpp
@@ -128,19 +128,18 @@ void FrameBreakAnimation::updateCurrentTime(int msecs)
server->frameBreak();
}
-class QDeclarativeViewPrivate : public QDeclarativeItemChangeListener
+class QDeclarativeViewPrivate : public QGraphicsViewPrivate, public QDeclarativeItemChangeListener
{
+ Q_DECLARE_PUBLIC(QDeclarativeView)
public:
- QDeclarativeViewPrivate(QDeclarativeView *view)
- : q(view), root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject) {}
+ QDeclarativeViewPrivate()
+ : root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject) {}
~QDeclarativeViewPrivate() { delete root; }
void execute();
void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
void initResize();
void updateSize();
- inline QSize rootObjectSize();
-
- QDeclarativeView *q;
+ inline QSize rootObjectSize() const;
QDeclarativeGuard<QGraphicsObject> root;
QDeclarativeGuard<QDeclarativeItem> declarativeItemRoot;
@@ -162,6 +161,7 @@ public:
void QDeclarativeViewPrivate::execute()
{
+ Q_Q(QDeclarativeView);
if (root) {
delete root;
root = 0;
@@ -182,6 +182,7 @@ void QDeclarativeViewPrivate::execute()
void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, const QRectF &newGeometry, const QRectF &oldGeometry)
{
+ Q_Q(QDeclarativeView);
if (resizeItem == root && resizeMode == QDeclarativeView::SizeViewToRootObject) {
// wait for both width and height to be changed
resizetimer.start(0,q);
@@ -250,8 +251,9 @@ void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem,
Constructs a QDeclarativeView with the given \a parent.
*/
QDeclarativeView::QDeclarativeView(QWidget *parent)
-: QGraphicsView(parent), d(new QDeclarativeViewPrivate(this))
+ : QGraphicsView(*(new QDeclarativeViewPrivate), parent)
{
+ Q_D(QDeclarativeView);
setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
d->init();
}
@@ -262,8 +264,9 @@ QDeclarativeView::QDeclarativeView(QWidget *parent)
Constructs a QDeclarativeView with the given QML \a source and \a parent.
*/
QDeclarativeView::QDeclarativeView(const QUrl &source, QWidget *parent)
-: QGraphicsView(parent), d(new QDeclarativeViewPrivate(this))
+ : QGraphicsView(*(new QDeclarativeViewPrivate), parent)
{
+ Q_D(QDeclarativeView);
setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
d->init();
setSource(source);
@@ -271,6 +274,7 @@ QDeclarativeView::QDeclarativeView(const QUrl &source, QWidget *parent)
void QDeclarativeViewPrivate::init()
{
+ Q_Q(QDeclarativeView);
q->setScene(&scene);
q->setOptimizationFlags(QGraphicsView::DontSavePainterState);
@@ -288,12 +292,10 @@ void QDeclarativeViewPrivate::init()
}
/*!
- The destructor clears the view's \l {QGraphicsObject} {items} and
- deletes the internal representation.
+ Destroys the view.
*/
QDeclarativeView::~QDeclarativeView()
{
- delete d;
}
/*! \property QDeclarativeView::source
@@ -316,6 +318,7 @@ QDeclarativeView::~QDeclarativeView()
*/
void QDeclarativeView::setSource(const QUrl& url)
{
+ Q_D(QDeclarativeView);
d->source = url;
d->execute();
}
@@ -327,6 +330,7 @@ void QDeclarativeView::setSource(const QUrl& url)
*/
QUrl QDeclarativeView::source() const
{
+ Q_D(const QDeclarativeView);
return d->source;
}
@@ -336,6 +340,7 @@ QUrl QDeclarativeView::source() const
*/
QDeclarativeEngine* QDeclarativeView::engine()
{
+ Q_D(QDeclarativeView);
return &d->engine;
}
@@ -348,6 +353,7 @@ QDeclarativeEngine* QDeclarativeView::engine()
*/
QDeclarativeContext* QDeclarativeView::rootContext()
{
+ Q_D(QDeclarativeView);
return d->engine.rootContext();
}
@@ -376,6 +382,7 @@ QDeclarativeContext* QDeclarativeView::rootContext()
QDeclarativeView::Status QDeclarativeView::status() const
{
+ Q_D(const QDeclarativeView);
if (!d->component)
return QDeclarativeView::Null;
@@ -388,6 +395,7 @@ QDeclarativeView::Status QDeclarativeView::status() const
*/
QList<QDeclarativeError> QDeclarativeView::errors() const
{
+ Q_D(const QDeclarativeView);
if (d->component)
return d->component->errors();
return QList<QDeclarativeError>();
@@ -410,6 +418,7 @@ QList<QDeclarativeError> QDeclarativeView::errors() const
void QDeclarativeView::setResizeMode(ResizeMode mode)
{
+ Q_D(QDeclarativeView);
if (d->resizeMode == mode)
return;
@@ -433,6 +442,7 @@ void QDeclarativeView::setResizeMode(ResizeMode mode)
void QDeclarativeViewPrivate::initResize()
{
+ Q_Q(QDeclarativeView);
if (declarativeItemRoot) {
if (resizeMode == QDeclarativeView::SizeViewToRootObject) {
QDeclarativeItemPrivate *p =
@@ -449,6 +459,7 @@ void QDeclarativeViewPrivate::initResize()
void QDeclarativeViewPrivate::updateSize()
{
+ Q_Q(QDeclarativeView);
if (!root)
return;
if (declarativeItemRoot) {
@@ -479,15 +490,12 @@ void QDeclarativeViewPrivate::updateSize()
q->updateGeometry();
}
-QSize QDeclarativeViewPrivate::rootObjectSize()
+QSize QDeclarativeViewPrivate::rootObjectSize() const
{
QSize rootObjectSize(0,0);
int widthCandidate = -1;
int heightCandidate = -1;
- if (declarativeItemRoot) {
- widthCandidate = declarativeItemRoot->width();
- heightCandidate = declarativeItemRoot->height();
- } else if (root) {
+ if (root) {
QSizeF size = root->boundingRect().size();
widthCandidate = size.width();
heightCandidate = size.height();
@@ -503,6 +511,7 @@ QSize QDeclarativeViewPrivate::rootObjectSize()
QDeclarativeView::ResizeMode QDeclarativeView::resizeMode() const
{
+ Q_D(const QDeclarativeView);
return d->resizeMode;
}
@@ -511,7 +520,7 @@ QDeclarativeView::ResizeMode QDeclarativeView::resizeMode() const
*/
void QDeclarativeView::continueExecute()
{
-
+ Q_D(QDeclarativeView);
disconnect(d->component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(continueExecute()));
if (d->component->isError()) {
@@ -544,6 +553,7 @@ void QDeclarativeView::continueExecute()
*/
void QDeclarativeView::setRootObject(QObject *obj)
{
+ Q_D(QDeclarativeView);
if (d->root == obj)
return;
if (QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem *>(obj)) {
@@ -593,6 +603,7 @@ void QDeclarativeView::setRootObject(QObject *obj)
*/
void QDeclarativeView::timerEvent(QTimerEvent* e)
{
+ Q_D(QDeclarativeView);
if (!e || e->timerId() == d->resizetimer.timerId()) {
d->updateSize();
d->resizetimer.stop();
@@ -602,6 +613,7 @@ void QDeclarativeView::timerEvent(QTimerEvent* e)
/*! \reimp */
bool QDeclarativeView::eventFilter(QObject *watched, QEvent *e)
{
+ Q_D(QDeclarativeView);
if (watched == d->root && d->resizeMode == SizeViewToRootObject) {
if (d->graphicsWidgetRoot) {
if (e->type() == QEvent::GraphicsSceneResize) {
@@ -614,16 +626,16 @@ bool QDeclarativeView::eventFilter(QObject *watched, QEvent *e)
/*!
\internal
- Preferred size follows the root object in
- resize mode SizeViewToRootObject and
- the view in resize mode SizeRootObjectToView.
+ Preferred size follows the root object geometry.
*/
QSize QDeclarativeView::sizeHint() const
{
- if (d->resizeMode == SizeRootObjectToView) {
+ Q_D(const QDeclarativeView);
+ QSize rootObjectSize = d->rootObjectSize();
+ if (rootObjectSize.isEmpty()) {
return size();
- } else { // d->resizeMode == SizeViewToRootObject
- return d->rootObjectSize();
+ } else {
+ return rootObjectSize;
}
}
@@ -632,6 +644,7 @@ QSize QDeclarativeView::sizeHint() const
*/
QGraphicsObject *QDeclarativeView::rootObject() const
{
+ Q_D(const QDeclarativeView);
return d->root;
}
@@ -642,6 +655,7 @@ QGraphicsObject *QDeclarativeView::rootObject() const
*/
void QDeclarativeView::resizeEvent(QResizeEvent *e)
{
+ Q_D(QDeclarativeView);
if (d->resizeMode == SizeRootObjectToView) {
d->updateSize();
}
@@ -661,6 +675,7 @@ void QDeclarativeView::resizeEvent(QResizeEvent *e)
*/
void QDeclarativeView::paintEvent(QPaintEvent *event)
{
+ Q_D(QDeclarativeView);
int time = 0;
if (frameRateDebug() || QDeclarativeViewDebugServer::isDebuggingEnabled())
time = d->frameTimer.restart();
diff --git a/src/declarative/util/qdeclarativeview.h b/src/declarative/util/qdeclarativeview.h
index 3513c04e6c..e9cff32569 100644
--- a/src/declarative/util/qdeclarativeview.h
+++ b/src/declarative/util/qdeclarativeview.h
@@ -106,9 +106,8 @@ protected:
virtual bool eventFilter(QObject *watched, QEvent *e);
private:
- friend class QDeclarativeViewPrivate;
- QDeclarativeViewPrivate *d;
Q_DISABLE_COPY(QDeclarativeView)
+ Q_DECLARE_PRIVATE(QDeclarativeView)
};
QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index bdebadf57d..4a374a5a74 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -472,40 +472,71 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
\since 4.7
\brief The XmlListModel element is used to specify a model using XPath expressions.
- XmlListModel is used to create a model from XML data that can be used as a data source
+ XmlListModel is used to create a model from XML data. XmlListModel can be used as a data source
for the view classes (such as ListView, PathView, GridView) and other classes that interact with model
- data (such as Repeater).
+ data (such as \l Repeater).
+
+ For example, if there is a XML document at http://www.mysite.com/feed.xml like this:
+
+ \code
+ <?xml version="1.0" encoding="utf-8"?>
+ <rss version="2.0">
+ ...
+ <channel>
+ <item>
+ <title>Item A</title>
+ <pubDate>Sat, 07 Sep 2010 10:00:01 GMT</pubDate>
+ </item>
+ <item>
+ <title>Item B</title>
+ <pubDate>Sat, 07 Sep 2010 15:35:01 GMT</pubDate>
+ </item>
+ </channel>
+ </rss>
+ \endcode
+
+ Then it could be used to create the following model:
- Here is an example of a model containing news from a Yahoo RSS feed:
\qml
XmlListModel {
- id: feedModel
- source: "http://rss.news.yahoo.com/rss/oceania"
+ source: "http://www.mysite.com/feed.xml"
query: "/rss/channel/item"
XmlRole { name: "title"; query: "title/string()" }
XmlRole { name: "pubDate"; query: "pubDate/string()" }
- XmlRole { name: "description"; query: "description/string()" }
}
\endqml
- You can also define certain roles as "keys" so that the model only adds data
- that contains new values for these keys when reload() is called.
+ The \l {XmlListModel::query}{query} value of "/rss/channel/item" specifies that the XmlListModel should generate
+ a model item for each \c <item> in the XML document. The XmlRole objects define the
+ model item attributes; here, each model item will have \c title and \c pubDate
+ attributes that match the \c title and \c pubDate values of its corresponding \c <item>.
- For example, if the roles above were defined like this:
+
+ \section2 Using key XML roles
+
+ You can define certain roles as "keys" so that when reload() is called,
+ the model will only add and refresh data that contains new values for
+ these keys.
+
+ For example, if above role for "pubDate" was defined like this instead:
\qml
- XmlRole { name: "title"; query: "title/string()"; isKey: true }
XmlRole { name: "pubDate"; query: "pubDate/string()"; isKey: true }
\endqml
- Then when reload() is called, the model will only add new items with a
- "title" and "pubDate" value combination that is not already present in
- the model.
+ Then when reload() is called, the model will only add and reload
+ items with a "pubDate" value that is not already
+ present in the model.
- This is useful to provide incremental updates and avoid repainting an
- entire model in a view.
+ This is useful when displaying the contents of XML documents that
+ are incrementally updated (such as RSS feeds) to avoid repainting the
+ entire contents of a model in a view.
- \sa {QtDeclarative}
+ If multiple key roles are specified, the model only adds and reload items
+ with a combined value of all key roles that is not already present in
+ the model.
+
+ \sa {declarative/xml/xmldata}{XML data example}
*/
QDeclarativeXmlListModel::QDeclarativeXmlListModel(QObject *parent)
@@ -626,8 +657,8 @@ void QDeclarativeXmlListModel::setXml(const QString &xml)
/*!
\qmlproperty string XmlListModel::query
- An absolute XPath query representing the base query for the model items. The query should start with
- '/' or '//'.
+ An absolute XPath query representing the base query for creating model items
+ from this model's XmlRole objects. The query should start with '/' or '//'.
*/
QString QDeclarativeXmlListModel::query() const
{
@@ -652,7 +683,20 @@ void QDeclarativeXmlListModel::setQuery(const QString &query)
/*!
\qmlproperty string XmlListModel::namespaceDeclarations
- A set of declarations for the namespaces used in the query.
+ The namespace declarations to be used in the XPath queries.
+
+ The namespaces should be declared as in XQuery. For example, if a requested document
+ at http://mysite.com/feed.xml uses the namespace "http://www.w3.org/2005/Atom",
+ this can be declared as the default namespace:
+
+ \qml
+ XmlListModel {
+ source: "http://mysite.com/feed.xml"
+ query: "/feed/entry"
+ namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"
+ XmlRole { name: "title"; query: "title/string()" }
+ }
+ \endqml
*/
QString QDeclarativeXmlListModel::namespaceDeclarations() const
{
@@ -675,10 +719,10 @@ void QDeclarativeXmlListModel::setNamespaceDeclarations(const QString &declarati
Specifies the model loading status, which can be one of the following:
\list
- \o Null - No XML data has been set for this model.
- \o Ready - The XML data has been loaded into the model.
- \o Loading - The model is in the process of reading and loading XML data.
- \o Error - An error occurred while the model was loading.
+ \o XmlListModel.Null - No XML data has been set for this model.
+ \o XmlListModel.Ready - The XML data has been loaded into the model.
+ \o XmlListModel.Loading - The model is in the process of reading and loading XML data.
+ \o XmlListModel.Error - An error occurred while the model was loading.
\endlist
\sa progress
@@ -735,7 +779,7 @@ void QDeclarativeXmlListModel::componentComplete()
Otherwise, items are only added if the model does not already
contain items with matching key role values.
- \sa XmlRole::isKey
+ \sa {Using key XML roles}, XmlRole::isKey
*/
void QDeclarativeXmlListModel::reload()
{
@@ -752,8 +796,11 @@ void QDeclarativeXmlListModel::reload()
if (d->reply) {
d->reply->abort();
- d->reply->deleteLater();
- d->reply = 0;
+ if (d->reply) {
+ // abort will generally have already done this (and more)
+ d->reply->deleteLater();
+ d->reply = 0;
+ }
}
if (!d->xml.isEmpty()) {
diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm
index 8af0d2be32..82cfa24937 100644
--- a/src/gui/dialogs/qcolordialog_mac.mm
+++ b/src/gui/dialogs/qcolordialog_mac.mm
@@ -65,9 +65,9 @@ typedef float CGFloat; // Should only not be defined on 32-bit platforms
QT_USE_NAMESPACE
-@class QCocoaColorPanelDelegate;
+@class QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate);
-@interface QCocoaColorPanelDelegate : NSObject<NSWindowDelegate> {
+@interface QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) : NSObject<NSWindowDelegate> {
NSColorPanel *mColorPanel;
NSView *mStolenContentView;
NSButton *mOkButton;
@@ -99,7 +99,7 @@ QT_USE_NAMESPACE
- (void)setResultSet:(BOOL)result;
@end
-@implementation QCocoaColorPanelDelegate
+@implementation QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate)
- (id)initWithColorPanel:(NSColorPanel *)panel
stolenContentView:(NSView *)stolenContentView
okButton:(NSButton *)okButton
@@ -432,26 +432,26 @@ void QColorDialogPrivate::openCocoaColorPanel(const QColor &initial,
[colorPanel setDefaultButtonCell:[okButton cell]];
}
- delegate = [[QCocoaColorPanelDelegate alloc] initWithColorPanel:colorPanel
+ delegate = [[QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) alloc] initWithColorPanel:colorPanel
stolenContentView:stolenContentView
okButton:okButton
cancelButton:cancelButton
priv:this];
- [colorPanel setDelegate:static_cast<QCocoaColorPanelDelegate *>(delegate)];
+ [colorPanel setDelegate:static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate)];
}
[delegate setResultSet:false];
setCocoaPanelColor(initial);
- [static_cast<QCocoaColorPanelDelegate *>(delegate) showColorPanel];
+ [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) showColorPanel];
}
void QColorDialogPrivate::closeCocoaColorPanel()
{
- [static_cast<QCocoaColorPanelDelegate *>(delegate) onCancelClicked];
+ [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) onCancelClicked];
}
void QColorDialogPrivate::releaseCocoaColorPanelDelegate()
{
- [static_cast<QCocoaColorPanelDelegate *>(delegate) release];
+ [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) release];
}
void QColorDialogPrivate::mac_nativeDialogModalHelp()
@@ -471,13 +471,13 @@ void QColorDialogPrivate::mac_nativeDialogModalHelp()
void QColorDialogPrivate::_q_macRunNativeAppModalPanel()
{
- [static_cast<QCocoaColorPanelDelegate *>(delegate) exec];
+ [static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate) exec];
}
void QColorDialogPrivate::setCocoaPanelColor(const QColor &color)
{
QMacCocoaAutoReleasePool pool;
- QCocoaColorPanelDelegate *theDelegate = static_cast<QCocoaColorPanelDelegate *>(delegate);
+ QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *theDelegate = static_cast<QT_MANGLE_NAMESPACE(QCocoaColorPanelDelegate) *>(delegate);
NSColor *nsColor;
const QColor::Spec spec = color.spec();
if (spec == QColor::Cmyk) {
diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm
index 28acf241e1..b07b1ea847 100644
--- a/src/gui/dialogs/qfiledialog_mac.mm
+++ b/src/gui/dialogs/qfiledialog_mac.mm
@@ -82,9 +82,9 @@ QT_FORWARD_DECLARE_CLASS(QAction)
QT_FORWARD_DECLARE_CLASS(QFileInfo)
QT_USE_NAMESPACE
-@class QNSOpenSavePanelDelegate;
+@class QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate);
-@interface QNSOpenSavePanelDelegate : NSObject {
+@interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) : NSObject {
@public
NSOpenPanel *mOpenPanel;
NSSavePanel *mSavePanel;
@@ -123,7 +123,7 @@ QT_USE_NAMESPACE
@end
-@implementation QNSOpenSavePanelDelegate
+@implementation QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate)
- (id)initWithAcceptMode:(QT_PREPEND_NAMESPACE(QFileDialog::AcceptMode))acceptMode
title:(const QString &)title
@@ -554,7 +554,7 @@ void QFileDialogPrivate::setDirectory_sys(const QString &directory)
}
#else
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
[delegate->mSavePanel setDirectory:qt_mac_QStringToNSString(directory)];
#endif
}
@@ -565,7 +565,7 @@ QString QFileDialogPrivate::directory_sys() const
return mCurrentLocation;
#else
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
return qt_mac_NSStringToQString([delegate->mSavePanel directory]);
#endif
}
@@ -622,7 +622,7 @@ QStringList QFileDialogPrivate::selectedFiles_sys() const
}
#else
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
return [delegate selectedFiles];
#endif
}
@@ -633,7 +633,7 @@ void QFileDialogPrivate::setNameFilters_sys(const QStringList &filters)
Q_UNUSED(filters);
#else
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
bool hideDetails = q_func()->testOption(QFileDialog::HideNameFilterDetails);
[delegate setNameFilters:filters hideDetails:hideDetails];
#endif
@@ -645,7 +645,7 @@ void QFileDialogPrivate::setFilter_sys()
#else
Q_Q(QFileDialog);
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
*(delegate->mQDirFilter) = model->filter();
delegate->mFileMode = fileMode;
[delegate->mSavePanel setTitle:qt_mac_QStringToNSString(q->windowTitle())];
@@ -668,7 +668,7 @@ void QFileDialogPrivate::selectNameFilter_sys(const QString &filter)
NavCustomControl(mDialog, kNavCtlSelectCustomType, &navSpec);
#else
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
[delegate->mPopUpButton selectItemAtIndex:index];
[delegate filterChanged:nil];
#endif
@@ -681,7 +681,7 @@ QString QFileDialogPrivate::selectedNameFilter_sys() const
int index = filterInfo.currentSelection;
#else
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
int index = [delegate->mPopUpButton indexOfSelectedItem];
#endif
return index != -1 ? nameFilters.at(index) : QString();
@@ -696,7 +696,7 @@ void QFileDialogPrivate::deleteNativeDialog_sys()
mDialogStarted = false;
#else
QMacCocoaAutoReleasePool pool;
- [reinterpret_cast<QNSOpenSavePanelDelegate *>(mDelegate) release];
+ [reinterpret_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate) release];
mDelegate = 0;
#endif
nativeDialogInUse = false;
@@ -1034,7 +1034,7 @@ void QFileDialogPrivate::createNSOpenSavePanelDelegate()
bool selectDir = q->selectedFiles().isEmpty();
QString selection(selectDir ? q->directory().absolutePath() : q->selectedFiles().value(0));
- QNSOpenSavePanelDelegate *delegate = [[QNSOpenSavePanelDelegate alloc]
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) alloc]
initWithAcceptMode:acceptMode
title:q->windowTitle()
nameFilters:q->nameFilters()
@@ -1055,7 +1055,7 @@ bool QFileDialogPrivate::showCocoaFilePanel()
Q_Q(QFileDialog);
QMacCocoaAutoReleasePool pool;
createNSOpenSavePanelDelegate();
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
if (qt_mac_is_macsheet(q))
[delegate showWindowModalSheet:q->parentWidget()];
else
@@ -1071,7 +1071,7 @@ bool QFileDialogPrivate::hideCocoaFilePanel()
return false;
} else {
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
[delegate closePanel];
// Even when we hide it, we are still using a
// native dialog, so return true:
@@ -1104,7 +1104,7 @@ void QFileDialogPrivate::_q_macRunNativeAppModalPanel()
#else
Q_Q(QFileDialog);
QMacCocoaAutoReleasePool pool;
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
[delegate runApplicationModalPanel];
dialogResultCode_sys() == QDialog::Accepted ? q->accept() : q->reject();
#endif
@@ -1119,7 +1119,7 @@ QDialog::DialogCode QFileDialogPrivate::dialogResultCode_sys()
else
return QDialog::Accepted;
#else
- QNSOpenSavePanelDelegate *delegate = static_cast<QNSOpenSavePanelDelegate *>(mDelegate);
+ QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate);
return [delegate dialogResultCode];
#endif
}
diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp
index 3b279ae0f1..af0506fc34 100644
--- a/src/gui/dialogs/qfileinfogatherer.cpp
+++ b/src/gui/dialogs/qfileinfogatherer.cpp
@@ -55,7 +55,18 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_FILESYSTEMMODEL
-bool QFileInfoGatherer::fetchedRoot = false;
+#ifdef QT_BUILD_INTERNAL
+static bool fetchedRoot = false;
+Q_AUTOTEST_EXPORT void qt_test_resetFetchedRoot()
+{
+ fetchedRoot = false;
+}
+
+Q_AUTOTEST_EXPORT bool qt_test_isFetchedRoot()
+{
+ return fetchedRoot;
+}
+#endif
/*!
Creates thread
@@ -278,7 +289,7 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil
// List drives
if (path.isEmpty()) {
-#if defined Q_AUTOTEST_EXPORT
+#ifdef QT_BUILD_INTERNAL
fetchedRoot = true;
#endif
QFileInfoList infoList;
diff --git a/src/gui/dialogs/qfileinfogatherer_p.h b/src/gui/dialogs/qfileinfogatherer_p.h
index 5abcd94fe6..8681eb5b96 100644
--- a/src/gui/dialogs/qfileinfogatherer_p.h
+++ b/src/gui/dialogs/qfileinfogatherer_p.h
@@ -195,9 +195,6 @@ private:
uint userId;
uint groupId;
#endif
-public :
- //for testing purpose
- static bool fetchedRoot;
};
#endif // QT_NO_FILESYSTEMMODEL
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index 919790b733..bb8ef3fd42 100644
--- a/src/gui/dialogs/qfontdialog_mac.mm
+++ b/src/gui/dialogs/qfontdialog_mac.mm
@@ -82,7 +82,7 @@ const CGFloat DialogSideMargin = 9.0;
const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask;
-@class QCocoaFontPanelDelegate;
+@class QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate);
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
@@ -93,7 +93,7 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin
#endif
-@interface QCocoaFontPanelDelegate : NSObject <NSWindowDelegate> {
+@interface QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) : NSObject <NSWindowDelegate> {
NSFontPanel *mFontPanel;
NSView *mStolenContentView;
NSButton *mOkButton;
@@ -156,7 +156,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
return newFont;
}
-@implementation QCocoaFontPanelDelegate
+@implementation QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate)
- (id)initWithFontPanel:(NSFontPanel *)panel
stolenContentView:(NSView *)stolenContentView
okButton:(NSButton *)okButton
@@ -478,7 +478,7 @@ QT_BEGIN_NAMESPACE
void QFontDialogPrivate::closeCocoaFontPanel()
{
QMacCocoaAutoReleasePool pool;
- QCocoaFontPanelDelegate *theDelegate = static_cast<QCocoaFontPanelDelegate *>(delegate);
+ QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *theDelegate = static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate);
NSWindow *ourPanel = [theDelegate actualPanel];
[ourPanel close];
[theDelegate cleanUpAfterMyself];
@@ -519,7 +519,7 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font)
}
[mgr setSelectedFont:nsFont isMultiple:NO];
- [static_cast<QCocoaFontPanelDelegate *>(delegate) setQtFont:font];
+ [static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate) setQtFont:font];
}
void QFontDialogPrivate::createNSFontPanelDelegate()
@@ -584,7 +584,7 @@ void QFontDialogPrivate::createNSFontPanelDelegate()
}
// create the delegate and set it
- QCocoaFontPanelDelegate *del = [[QCocoaFontPanelDelegate alloc] initWithFontPanel:sharedFontPanel
+ QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = [[QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) alloc] initWithFontPanel:sharedFontPanel
stolenContentView:stolenContentView
okButton:okButton
cancelButton:cancelButton
@@ -637,7 +637,7 @@ void QFontDialogPrivate::mac_nativeDialogModalHelp()
void QFontDialogPrivate::_q_macRunNativeAppModalPanel()
{
createNSFontPanelDelegate();
- QCocoaFontPanelDelegate *del = static_cast<QCocoaFontPanelDelegate *>(delegate);
+ QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate);
[del runApplicationModalPanel];
}
@@ -649,7 +649,7 @@ bool QFontDialogPrivate::showCocoaFontPanel()
Q_Q(QFontDialog);
QMacCocoaAutoReleasePool pool;
createNSFontPanelDelegate();
- QCocoaFontPanelDelegate *del = static_cast<QCocoaFontPanelDelegate *>(delegate);
+ QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate);
if (qt_mac_is_macsheet(q))
[del showWindowModalSheet:q->parentWidget()];
else
diff --git a/src/gui/dialogs/qmessagebox.h b/src/gui/dialogs/qmessagebox.h
index bc6170d783..f1ff6ccfb4 100644
--- a/src/gui/dialogs/qmessagebox.h
+++ b/src/gui/dialogs/qmessagebox.h
@@ -354,7 +354,7 @@ if (!qApp){ \
QString s = QApplication::tr("Executable '%1' requires Qt "\
"%2, found Qt %3.").arg(qAppName()).arg(QString::fromLatin1(\
str)).arg(QString::fromLatin1(qVersion())); QMessageBox::critical(0, QApplication::tr(\
-"Incompatible Qt Library Error"), s, QMessageBox::Abort, 0); qFatal(s.toLatin1().data()); }}
+"Incompatible Qt Library Error"), s, QMessageBox::Abort, 0); qFatal("%s", s.toLatin1().data()); }}
#endif // QT_NO_MESSAGEBOX
diff --git a/src/gui/dialogs/qnspanelproxy_mac.mm b/src/gui/dialogs/qnspanelproxy_mac.mm
index 3229a4d258..0bd5c63f80 100644
--- a/src/gui/dialogs/qnspanelproxy_mac.mm
+++ b/src/gui/dialogs/qnspanelproxy_mac.mm
@@ -52,9 +52,9 @@ QT_END_NAMESPACE
QT_USE_NAMESPACE
-@class QNSPanelProxy;
+@class QT_MANGLE_NAMESPACE(QNSPanelProxy);
-@interface QNSPanelProxy : NSWindow {
+@interface QT_MANGLE_NAMESPACE(QNSPanelProxy) : NSWindow {
}
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle
backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation;
@@ -66,7 +66,7 @@ QT_USE_NAMESPACE
backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation screen:(NSScreen *)screen;
@end
-@implementation QNSPanelProxy
+@implementation QT_MANGLE_NAMESPACE(QNSPanelProxy)
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle
backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
{
@@ -108,15 +108,15 @@ QT_USE_NAMESPACE
}
@end
-@class QNSWindowProxy;
+@class QT_MANGLE_NAMESPACE(QNSWindowProxy);
-@interface QNSWindowProxy : NSWindow {
+@interface QT_MANGLE_NAMESPACE(QNSWindowProxy) : NSWindow {
}
- (void)setTitle:(NSString *)title;
- (void)qt_fakeSetTitle:(NSString *)title;
@end
-@implementation QNSWindowProxy
+@implementation QT_MANGLE_NAMESPACE(QNSWindowProxy)
- (void)setTitle:(NSString *)title
{
QCFString cftitle(currentWindow->windowTitle());
@@ -190,10 +190,10 @@ void macStartInterceptNSPanelCtor()
{
macStartIntercept(@selector(initWithContentRect:styleMask:backing:defer:),
@selector(qt_fakeInitWithContentRect:styleMask:backing:defer:),
- [NSPanel class], [QNSPanelProxy class]);
+ [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]);
macStartIntercept(@selector(initWithContentRect:styleMask:backing:defer:screen:),
@selector(qt_fakeInitWithContentRect:styleMask:backing:defer:screen:),
- [NSPanel class], [QNSPanelProxy class]);
+ [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]);
}
/*
@@ -203,10 +203,10 @@ void macStopInterceptNSPanelCtor()
{
macStopIntercept(@selector(initWithContentRect:styleMask:backing:defer:screen:),
@selector(qt_fakeInitWithContentRect:styleMask:backing:defer:screen:),
- [NSPanel class], [QNSPanelProxy class]);
+ [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]);
macStopIntercept(@selector(initWithContentRect:styleMask:backing:defer:),
@selector(qt_fakeInitWithContentRect:styleMask:backing:defer:),
- [NSPanel class], [QNSPanelProxy class]);
+ [NSPanel class], [QT_MANGLE_NAMESPACE(QNSPanelProxy) class]);
}
/*
@@ -217,7 +217,7 @@ void macStartInterceptWindowTitle(QWidget *window)
{
currentWindow = window;
macStartIntercept(@selector(setTitle:), @selector(qt_fakeSetTitle:),
- [NSWindow class], [QNSWindowProxy class]);
+ [NSWindow class], [QT_MANGLE_NAMESPACE(QNSWindowProxy) class]);
}
/*
@@ -227,7 +227,7 @@ void macStopInterceptWindowTitle()
{
currentWindow = 0;
macStopIntercept(@selector(setTitle:), @selector(qt_fakeSetTitle:),
- [NSWindow class], [QNSWindowProxy class]);
+ [NSWindow class], [QT_MANGLE_NAMESPACE(QNSWindowProxy) class]);
}
/*
diff --git a/src/gui/dialogs/qpagesetupdialog_mac.mm b/src/gui/dialogs/qpagesetupdialog_mac.mm
index cfcde0ffdc..0302be4d46 100644
--- a/src/gui/dialogs/qpagesetupdialog_mac.mm
+++ b/src/gui/dialogs/qpagesetupdialog_mac.mm
@@ -50,9 +50,9 @@
QT_USE_NAMESPACE
-@class QCocoaPageLayoutDelegate;
+@class QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate);
-@interface QCocoaPageLayoutDelegate : NSObject {
+@interface QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) : NSObject {
QMacPrintEnginePrivate *pe;
}
- (id)initWithMacPrintEngine:(QMacPrintEnginePrivate *)printEngine;
@@ -60,7 +60,7 @@ QT_USE_NAMESPACE
returnCode:(int)returnCode contextInfo:(void *)contextInfo;
@end
-@implementation QCocoaPageLayoutDelegate
+@implementation QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate)
- (id)initWithMacPrintEngine:(QMacPrintEnginePrivate *)printEngine;
{
self = [super init];
@@ -213,7 +213,7 @@ void QPageSetupDialogPrivate::openCocoaPageLayout(Qt::WindowModality modality)
pageLayout = [NSPageLayout pageLayout];
// Keep a copy to this since we plan on using it for a bit.
[pageLayout retain];
- QCocoaPageLayoutDelegate *delegate = [[QCocoaPageLayoutDelegate alloc] initWithMacPrintEngine:ep];
+ QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) alloc] initWithMacPrintEngine:ep];
if (modality == Qt::ApplicationModal) {
int rval = [pageLayout runModalWithPrintInfo:ep->printInfo];
diff --git a/src/gui/dialogs/qprintdialog_mac.mm b/src/gui/dialogs/qprintdialog_mac.mm
index 6a8d6a4191..84a72db75c 100644
--- a/src/gui/dialogs/qprintdialog_mac.mm
+++ b/src/gui/dialogs/qprintdialog_mac.mm
@@ -124,15 +124,15 @@ QT_USE_NAMESPACE
#ifdef QT_MAC_USE_COCOA
-@class QCocoaPrintPanelDelegate;
+@class QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate);
-@interface QCocoaPrintPanelDelegate : NSObject {
+@interface QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) : NSObject {
}
- (void)printPanelDidEnd:(NSPrintPanel *)printPanel
returnCode:(int)returnCode contextInfo:(void *)contextInfo;
@end
-@implementation QCocoaPrintPanelDelegate
+@implementation QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate)
- (void)printPanelDidEnd:(NSPrintPanel *)printPanel
returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
@@ -313,7 +313,7 @@ void QPrintDialogPrivate::openCocoaPrintPanel(Qt::WindowModality modality)
macStartInterceptWindowTitle(q);
printPanel = [NSPrintPanel printPanel];
- QCocoaPrintPanelDelegate *delegate = [[QCocoaPrintPanelDelegate alloc] init];
+ QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) alloc] init];
[printPanel setOptions:macOptions];
if (modality == Qt::ApplicationModal) {
diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp
index 1390b21261..e406cba159 100644
--- a/src/gui/dialogs/qwizard_win.cpp
+++ b/src/gui/dialogs/qwizard_win.cpp
@@ -237,7 +237,8 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
*/
QVistaHelper::QVistaHelper(QWizard *wizard)
- : pressed(false)
+ : QObject(wizard)
+ , pressed(false)
, wizard(wizard)
, backButton_(0)
{
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index cb8dcda713..969acc4c47 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -163,6 +163,11 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config)
int matchingCount = 0;
chosenVisualInfo = XGetVisualInfo(X11->display, VisualIDMask, &visualInfoTemplate, &matchingCount);
if (chosenVisualInfo) {
+ // Skip size checks if implementation supports non-matching visual
+ // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444).
+ if (QEgl::hasExtension("EGL_NV_post_convert_replication"))
+ return visualId;
+
int visualRedSize = countBits(chosenVisualInfo->red_mask);
int visualGreenSize = countBits(chosenVisualInfo->green_mask);
int visualBlueSize = countBits(chosenVisualInfo->blue_mask);
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 65edb2ada5..5e0d46fafb 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1090,6 +1090,10 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
if (newParent == parent)
return;
+ if (isWidget)
+ static_cast<QGraphicsWidgetPrivate *>(this)->fixFocusChainBeforeReparenting((newParent &&
+ newParent->isWidget()) ? static_cast<QGraphicsWidget *>(newParent) : 0,
+ scene);
if (scene) {
// Deliver the change to the index
if (scene->d_func()->indexMethod != QGraphicsScene::NoIndex)
@@ -1423,6 +1427,13 @@ QGraphicsItem::~QGraphicsItem()
d_ptr->inDestructor = 1;
d_ptr->removeExtraItemCache();
+ if (d_ptr->isObject && !d_ptr->gestureContext.isEmpty()) {
+ QGraphicsObject *o = static_cast<QGraphicsObject *>(this);
+ QGestureManager *manager = QGestureManager::instance();
+ foreach (Qt::GestureType type, d_ptr->gestureContext.keys())
+ manager->cleanupCachedGestures(o, type);
+ }
+
clearFocus();
// Update focus scope item ptr.
@@ -1796,9 +1807,6 @@ static void _q_qgraphicsItemSetFlag(QGraphicsItem *item, QGraphicsItem::Graphics
*/
void QGraphicsItem::setFlags(GraphicsItemFlags flags)
{
- if (isWindow())
- flags |= ItemIsPanel;
-
// Notify change and check for adjustment.
if (quint32(d_ptr->flags) == quint32(flags))
return;
@@ -7660,7 +7668,13 @@ void QGraphicsObject::ungrabGesture(Qt::GestureType gesture)
manager->cleanupCachedGestures(this, gesture);
}
}
+/*!
+ Updates the item's micro focus. This is slot for convenience.
+
+ \since 4.7
+ \sa QInputContext
+*/
void QGraphicsObject::updateMicroFocus()
{
QGraphicsItem::updateMicroFocus();
@@ -7969,6 +7983,13 @@ void QGraphicsItemPrivate::resetHeight()
*/
/*!
+ \property QGraphicsObject::effect
+ \brief the effect attached to this item
+
+ \sa QGraphicsItem::setGraphicsEffect(), QGraphicsItem::graphicsEffect()
+*/
+
+/*!
\class QAbstractGraphicsShapeItem
\brief The QAbstractGraphicsShapeItem class provides a common base for
all path items.
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index dfba7c914e..9b7cf121ac 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -690,6 +690,10 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
if (item == lastMouseGrabberItem)
lastMouseGrabberItem = 0;
+ // Reset the current drop item
+ if (item == dragDropItem)
+ dragDropItem = 0;
+
// Reenable selectionChanged() for individual items
--selectionChanging;
if (!selectionChanging && selectedItems.size() != oldSelectedItemsSize)
@@ -1316,10 +1320,10 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
setFocus = true;
break;
}
- if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable) && item->d_ptr->mouseSetsFocus)) {
+ if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable))) {
if (!item->isWidget() || ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus) {
setFocus = true;
- if (item != q->focusItem())
+ if (item != q->focusItem() && item->d_ptr->mouseSetsFocus)
q->setFocusItem(item, Qt::MouseFocusReason);
break;
}
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 0f951ef1fc..d2964ca66f 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -1875,8 +1875,6 @@ void QGraphicsView::centerOn(const QGraphicsItem *item)
void QGraphicsView::ensureVisible(const QRectF &rect, int xmargin, int ymargin)
{
Q_D(QGraphicsView);
- Q_UNUSED(xmargin);
- Q_UNUSED(ymargin);
qreal width = viewport()->width();
qreal height = viewport()->height();
QRectF viewRect = d->matrix.mapRect(rect);
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 06a44b76f4..478c0c3586 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -747,6 +747,17 @@ QSizeF QGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) c
}
/*!
+ \property QGraphicsWidget::layout
+ \brief The layout of the widget
+*/
+
+/*!
+ \fn void QGraphicsWidget::layoutChanged()
+ This signal gets emitted whenever the layout of the item changes
+ \internal
+*/
+
+/*!
Returns this widget's layout, or 0 if no layout is currently managing this
widget.
@@ -1094,9 +1105,6 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &
}
break;
case ItemParentChange: {
- QGraphicsItem *parent = qVariantValue<QGraphicsItem *>(value);
- d->fixFocusChainBeforeReparenting((parent && parent->isWidget()) ? static_cast<QGraphicsWidget *>(parent) : 0, scene());
-
// Deliver ParentAboutToChange.
QEvent event(QEvent::ParentAboutToChange);
QApplication::sendEvent(this, &event);
diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp
index 6e397b67ef..50b315a1fe 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.cpp
+++ b/src/gui/graphicsview/qgraphicswidget_p.cpp
@@ -71,14 +71,17 @@ void QGraphicsWidgetPrivate::init(QGraphicsItem *parentItem, Qt::WindowFlags wFl
adjustWindowFlags(&wFlags);
windowFlags = wFlags;
- q->setParentItem(parentItem);
+ if (parentItem)
+ setParentItemHelper(parentItem, 0, 0);
+
q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred, QSizePolicy::DefaultType));
q->setGraphicsItem(q);
resolveLayoutDirection();
q->unsetWindowFrameMargins();
- q->setFlag(QGraphicsItem::ItemUsesExtendedStyleOption);
- q->setFlag(QGraphicsItem::ItemSendsGeometryChanges);
+ flags |= QGraphicsItem::ItemUsesExtendedStyleOption | QGraphicsItem::ItemSendsGeometryChanges;
+ if (windowFlags & Qt::Window)
+ flags |= QGraphicsItem::ItemIsPanel;
}
qreal QGraphicsWidgetPrivate::titleBarHeight(const QStyleOptionTitleBar &options) const
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 891b1db22c..76966327a8 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -55,6 +55,7 @@
#include "qcache.h"
#include "qdebug.h"
#include "private/qguiplatformplugin_p.h"
+#include "private/qstylehelper_p.h"
#ifdef Q_WS_MAC
#include <private/qt_mac_p.h>
@@ -261,21 +262,17 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
actualSize.scale(size, Qt::KeepAspectRatio);
- QString key = QLatin1String("$qt_icon_")
- + QString::number(pm.cacheKey())
- + QString::number(pe->mode)
- + QString::number(QApplication::palette().cacheKey())
- + QLatin1Char('_')
- + QString::number(actualSize.width())
- + QLatin1Char('_')
- + QString::number(actualSize.height())
- + QLatin1Char('_');
-
+ QString key = QLatin1Literal("qt_")
+ % HexString<quint64>(pm.cacheKey())
+ % HexString<uint>(pe->mode)
+ % HexString<quint64>(QApplication::palette().cacheKey())
+ % HexString<uint>(actualSize.width())
+ % HexString<uint>(actualSize.height());
if (mode == QIcon::Active) {
- if (QPixmapCache::find(key + QString::number(mode), pm))
+ if (QPixmapCache::find(key % HexString<uint>(mode), pm))
return pm; // horray
- if (QPixmapCache::find(key + QString::number(QIcon::Normal), pm)) {
+ if (QPixmapCache::find(key % HexString<uint>(QIcon::Normal), pm)) {
QStyleOption opt(0);
opt.palette = QApplication::palette();
QPixmap active = QApplication::style()->generatedIconPixmap(QIcon::Active, pm, &opt);
@@ -284,7 +281,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
}
}
- if (!QPixmapCache::find(key + QString::number(mode), pm)) {
+ if (!QPixmapCache::find(key % HexString<uint>(mode), pm)) {
if (pm.size() != actualSize)
pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
if (pe->mode != mode && mode != QIcon::Normal) {
@@ -294,7 +291,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
if (!generated.isNull())
pm = generated;
}
- QPixmapCache::insert(key + QString::number(mode), pm);
+ QPixmapCache::insert(key % HexString<uint>(mode), pm);
}
return pm;
}
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 5fc605a861..7a6a73f436 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
+#define Q_TEST_QPIXMAPCACHE
#include "qpixmapcache.h"
#include "qobject.h"
#include "qdebug.h"
@@ -194,6 +195,9 @@ public:
static QPixmapCache::KeyData* getKeyData(QPixmapCache::Key *key);
+ QList< QPair<QString,QPixmap> > allPixmaps() const;
+ void flushDetachedPixmaps(bool nt);
+
private:
int *keyArray;
int theid;
@@ -235,10 +239,9 @@ QPMCache::~QPMCache()
When the last pixmap has been deleted from the cache, kill the
timer so Qt won't keep the CPU from going into sleep mode.
*/
-void QPMCache::timerEvent(QTimerEvent *)
+void QPMCache::flushDetachedPixmaps(bool nt)
{
int mc = maxCost();
- bool nt = totalCost() == ps;
setMaxCost(nt ? totalCost() * 3 / 4 : totalCost() -1);
setMaxCost(mc);
ps = totalCost();
@@ -252,6 +255,12 @@ void QPMCache::timerEvent(QTimerEvent *)
++it;
}
}
+}
+
+void QPMCache::timerEvent(QTimerEvent *)
+{
+ bool nt = totalCost() == ps;
+ flushDetachedPixmaps(nt);
if (!size()) {
killTimer(theid);
@@ -263,6 +272,7 @@ void QPMCache::timerEvent(QTimerEvent *)
}
}
+
QPixmap *QPMCache::object(const QString &key) const
{
QPixmapCache::Key cacheKey = cacheKeys.value(key);
@@ -422,6 +432,20 @@ QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key)
return key->d;
}
+QList< QPair<QString,QPixmap> > QPMCache::allPixmaps() const
+{
+ QList< QPair<QString,QPixmap> > r;
+ QHash<QString, QPixmapCache::Key>::const_iterator it = cacheKeys.begin();
+ while (it != cacheKeys.end()) {
+ QPixmap *ptr = QCache<QPixmapCache::Key, QPixmapCacheEntry>::object(it.value());
+ if (ptr)
+ r.append(QPair<QString,QPixmap>(it.key(),*ptr));
+ ++it;
+ }
+ return r;
+}
+
+
Q_GLOBAL_STATIC(QPMCache, pm_cache)
int Q_AUTOTEST_EXPORT q_QPixmapCache_keyHashSize()
@@ -633,4 +657,19 @@ void QPixmapCache::clear()
}
}
+void QPixmapCache::flushDetachedPixmaps()
+{
+ pm_cache()->flushDetachedPixmaps(true);
+}
+
+int QPixmapCache::totalUsed()
+{
+ return (pm_cache()->totalCost()+1023) / 1024;
+}
+
+QList< QPair<QString,QPixmap> > QPixmapCache::allPixmaps()
+{
+ return pm_cache()->allPixmaps();
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h
index 50a9369f81..e9c8c15ff0 100644
--- a/src/gui/image/qpixmapcache.h
+++ b/src/gui/image/qpixmapcache.h
@@ -44,6 +44,10 @@
#include <QtGui/qpixmap.h>
+#ifdef Q_TEST_QPIXMAPCACHE
+#include <QtCore/qpair.h>
+#endif
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -83,6 +87,12 @@ public:
static void remove(const QString &key);
static void remove(const Key &key);
static void clear();
+
+#ifdef Q_TEST_QPIXMAPCACHE
+ static void flushDetachedPixmaps();
+ static int totalUsed();
+ static QList< QPair<QString,QPixmap> > allPixmaps();
+#endif
};
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h
index 86a1b78005..825f27266a 100644
--- a/src/gui/image/qpixmapcache_p.h
+++ b/src/gui/image/qpixmapcache_p.h
@@ -95,6 +95,8 @@ public:
QPixmapCache::Key key;
};
+inline bool qIsDetached(QPixmapCacheEntry &t) { return t.isDetached(); }
+
QT_END_NAMESPACE
#endif // QPIXMAPCACHE_P_H
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index ec635d4905..7b62de1fe7 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -788,6 +788,10 @@ void QApplicationPrivate::construct(
qt_gui_eval_init(application_type);
#endif
+#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
+ symbianInit();
+#endif
+
#ifndef QT_NO_LIBRARY
if(load_testability) {
QLibrary testLib(QLatin1String("qttestability"));
@@ -2364,6 +2368,19 @@ bool QApplication::event(QEvent *e)
if (!(w->windowType() == Qt::Desktop))
postEvent(w, new QEvent(QEvent::LanguageChange));
}
+#ifndef Q_OS_WIN
+ } else if (e->type() == QEvent::LocaleChange) {
+ // on Windows the event propagation is taken care by the
+ // WM_SETTINGCHANGE event handler.
+ QWidgetList list = topLevelWidgets();
+ for (int i = 0; i < list.size(); ++i) {
+ QWidget *w = list.at(i);
+ if (!(w->windowType() == Qt::Desktop)) {
+ if (!w->testAttribute(Qt::WA_SetLocale))
+ w->d_func()->setLocale_helper(QLocale(), true);
+ }
+ }
+#endif
} else if (e->type() == QEvent::Timer) {
QTimerEvent *te = static_cast<QTimerEvent*>(e);
Q_ASSERT(te != 0);
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index fb2837ecf9..50b9759d14 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1936,6 +1936,8 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
QLocalePrivate::updateSystemPrivate();
if (!widget->testAttribute(Qt::WA_SetLocale))
widget->dptr()->setLocale_helper(QLocale(), true);
+ QEvent e(QEvent::LocaleChange);
+ QApplication::sendEvent(qApp, &e);
}
}
else if (msg.wParam == SPI_SETICONTITLELOGFONT) {
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm
index 24498f8cc0..2b9cf8517b 100644
--- a/src/gui/kernel/qcocoawindowdelegate_mac.mm
+++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm
@@ -202,6 +202,11 @@ static void cleanupCocoaWindowDelegate()
QWindowStateChangeEvent e(Qt::WindowStates(widgetData->window_state
& ~Qt::WindowMaximized));
qt_sendSpontaneousEvent(qwidget, &e);
+ } else {
+ widgetData->window_state = widgetData->window_state & ~Qt::WindowMaximized;
+ QWindowStateChangeEvent e(Qt::WindowStates(widgetData->window_state
+ | Qt::WindowMaximized));
+ qt_sendSpontaneousEvent(qwidget, &e);
}
NSRect rect = [[window contentView] frame];
const QSize newSize(rect.size.width, rect.size.height);
@@ -305,9 +310,19 @@ static void cleanupCocoaWindowDelegate()
Q_UNUSED(newFrame);
// saving the current window geometry before the window is maximized
QWidget *qwidget = m_windowHash->value(window);
- if (qwidget->isWindow() && !(qwidget->windowState() & Qt::WindowMaximized)) {
- QWidgetPrivate *widgetPrivate = qt_widget_private(qwidget);
- widgetPrivate->topData()->normalGeometry = qwidget->geometry();
+ QWidgetPrivate *widgetPrivate = qt_widget_private(qwidget);
+ if (qwidget->isWindow()) {
+ if(qwidget->windowState() & Qt::WindowMaximized) {
+ // Restoring
+ widgetPrivate->topData()->wasMaximized = false;
+ } else {
+ // Maximizing
+ widgetPrivate->topData()->normalGeometry = qwidget->geometry();
+ // If the window was maximized we need to update the coordinates since now it will start at 0,0.
+ // We do this in a special field that is only used when not restoring but manually resizing the window.
+ // Since the coordinates are fixed we just set a boolean flag.
+ widgetPrivate->topData()->wasMaximized = true;
+ }
}
return YES;
}
diff --git a/src/gui/kernel/qdnd_qws.cpp b/src/gui/kernel/qdnd_qws.cpp
index e47de00a18..7e5afc7a43 100644
--- a/src/gui/kernel/qdnd_qws.cpp
+++ b/src/gui/kernel/qdnd_qws.cpp
@@ -192,6 +192,10 @@ bool QDragManager::eventFilter(QObject *o, QEvent *e)
return false;
switch(e->type()) {
+ case QEvent::ShortcutOverride:
+ // prevent accelerators from firing while dragging
+ e->accept();
+ return true;
case QEvent::KeyPress:
case QEvent::KeyRelease:
diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp
index 0a05d8e625..2b123170cd 100644
--- a/src/gui/kernel/qdnd_x11.cpp
+++ b/src/gui/kernel/qdnd_x11.cpp
@@ -1299,6 +1299,12 @@ bool QDragManager::eventFilter(QObject * o, QEvent * e)
return true;
}
+ if (e->type() == QEvent::ShortcutOverride) {
+ // prevent accelerators from firing while dragging
+ e->accept();
+ return true;
+ }
+
if (e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease) {
QKeyEvent *ke = ((QKeyEvent*)e);
if (ke->key() == Qt::Key_Escape && e->type() == QEvent::KeyPress) {
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index aa6720e802..9495f4029b 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -132,20 +132,21 @@ void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type)
QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g);
if (list.contains(recognizer)) {
m_deletedRecognizers.insert(g, recognizer);
- m_gestureToRecognizer.remove(g);
}
}
- foreach (QGestureRecognizer *recognizer, list) {
- QList<QGesture *> obsoleteGestures;
- QMap<ObjectGesture, QList<QGesture *> >::Iterator iter = m_objectGestures.begin();
- while (iter != m_objectGestures.end()) {
- ObjectGesture objectGesture = iter.key();
- if (objectGesture.gesture == type)
- obsoleteGestures << iter.value();
- ++iter;
+ QMap<ObjectGesture, QList<QGesture *> >::const_iterator iter = m_objectGestures.begin();
+ while (iter != m_objectGestures.end()) {
+ ObjectGesture objectGesture = iter.key();
+ if (objectGesture.gesture == type) {
+ foreach (QGesture *g, iter.value()) {
+ if (QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g)) {
+ m_gestureToRecognizer.remove(g);
+ m_obsoleteGestures[recognizer].insert(g);
+ }
+ }
}
- m_obsoleteGestures.insert(recognizer, obsoleteGestures);
+ ++iter;
}
}
@@ -155,7 +156,14 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ
while (iter != m_objectGestures.end()) {
ObjectGesture objectGesture = iter.key();
if (objectGesture.gesture == type && target == objectGesture.object.data()) {
- qDeleteAll(iter.value());
+ QSet<QGesture *> gestures = iter.value().toSet();
+ for (QHash<QGestureRecognizer *, QSet<QGesture *> >::iterator
+ it = m_obsoleteGestures.begin(), e = m_obsoleteGestures.end(); it != e; ++it) {
+ it.value() -= gestures;
+ }
+ foreach (QGesture *g, gestures)
+ m_deletedRecognizers.remove(g);
+ qDeleteAll(gestures);
iter = m_objectGestures.erase(iter);
} else {
++iter;
@@ -177,6 +185,9 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
#ifndef QT_NO_GRAPHICSVIEW
} else {
Q_ASSERT(qobject_cast<QGraphicsObject *>(object));
+ QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(object);
+ if (graphicsObject->QGraphicsItem::d_func()->inDestructor)
+ return 0;
#endif
}
diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h
index a0ff83f91c..c105c9b6d0 100644
--- a/src/gui/kernel/qgesturemanager_p.h
+++ b/src/gui/kernel/qgesturemanager_p.h
@@ -127,7 +127,7 @@ private:
int m_lastCustomGestureId;
- QHash<QGestureRecognizer *, QList<QGesture *> > m_obsoleteGestures;
+ QHash<QGestureRecognizer *, QSet<QGesture *> > m_obsoleteGestures;
QHash<QGesture *, QGestureRecognizer *> m_deletedRecognizers;
void cleanupGesturesForRemovedRecognizer(QGesture *gesture);
diff --git a/src/gui/kernel/qsound_mac.mm b/src/gui/kernel/qsound_mac.mm
index 71fd663c62..2aff44d38d 100644
--- a/src/gui/kernel/qsound_mac.mm
+++ b/src/gui/kernel/qsound_mac.mm
@@ -88,14 +88,14 @@ QT_END_NAMESPACE
QT_USE_NAMESPACE
-@interface QMacSoundDelegate : NSObject<NSSoundDelegate> {
+@interface QT_MANGLE_NAMESPACE(QMacSoundDelegate) : NSObject<NSSoundDelegate> {
QSound *qSound; // may be null.
QAuServerMac* server;
}
-(id)initWithQSound:(QSound*)sound:(QAuServerMac*)server;
@end
-@implementation QMacSoundDelegate
+@implementation QT_MANGLE_NAMESPACE(QMacSoundDelegate)
-(id)initWithQSound:(QSound*)s:(QAuServerMac*)serv {
self = [super init];
if(self) {
@@ -172,7 +172,7 @@ NSSound *QAuServerMac::createNSSound(const QString &fileName, QSound *qSound)
{
NSString *nsFileName = const_cast<NSString *>(reinterpret_cast<const NSString *>(QCFString::toCFStringRef(fileName)));
NSSound * const nsSound = [[NSSound alloc] initWithContentsOfFile: nsFileName byReference:YES];
- QMacSoundDelegate * const delegate = [[QMacSoundDelegate alloc] initWithQSound:qSound:this];
+ QT_MANGLE_NAMESPACE(QMacSoundDelegate) * const delegate = [[QT_MANGLE_NAMESPACE(QMacSoundDelegate) alloc] initWithQSound:qSound:this];
[nsSound setDelegate:delegate];
[nsFileName release];
return nsSound;
diff --git a/src/gui/kernel/qt_mac_p.h b/src/gui/kernel/qt_mac_p.h
index 3341ce1688..ca9541a3af 100644
--- a/src/gui/kernel/qt_mac_p.h
+++ b/src/gui/kernel/qt_mac_p.h
@@ -57,7 +57,9 @@
#ifdef __OBJC__
#include <Cocoa/Cocoa.h>
+#ifdef QT_MAC_USE_COCOA
#include <objc/runtime.h>
+#endif // QT_MAC_USE_COCOA
#endif
#include <CoreServices/CoreServices.h>
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index c058280dbf..1f2cd8c692 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -1388,6 +1388,9 @@ QWidget::~QWidget()
qWarning("QWidget: %s (%s) deleted while being painted", className(), name());
#endif
+ foreach (Qt::GestureType type, d->gestureContext.keys())
+ ungrabGesture(type);
+
// force acceptDrops false before winId is destroyed.
d->registerDropSite(false);
@@ -1578,6 +1581,11 @@ void QWidgetPrivate::createTLExtra()
x->inTopLevelResize = false;
x->inRepaint = false;
x->embedded = 0;
+#ifdef Q_WS_MAC
+#ifdef QT_MAC_USE_COCOA
+ x->wasMaximized = false;
+#endif // QT_MAC_USE_COCOA
+#endif // Q_WS_MAC
createTLSysExtra();
#ifdef QWIDGET_EXTRA_DEBUG
static int count = 0;
@@ -6203,6 +6211,12 @@ void QWidget::setFocus(Qt::FocusReason reason)
QApplication::sendEvent(that->style(), &event);
}
if (!isHidden()) {
+#ifndef QT_NO_GRAPHICSVIEW
+ // Update proxy state
+ if (QWExtra *topData = window()->d_func()->extra)
+ if (topData->proxyWidget && topData->proxyWidget->hasFocus())
+ topData->proxyWidget->d_func()->updateProxyInputMethodAcceptanceFromWidget();
+#endif
// Send event to self
QFocusEvent event(QEvent::FocusIn, reason);
QPointer<QWidget> that = f;
@@ -6711,6 +6725,18 @@ void QWidget::setGeometry(const QRect &r)
*/
QByteArray QWidget::saveGeometry() const
{
+#ifdef QT_MAC_USE_COCOA
+ // We check if the window was maximized during this invocation. If so, we need to record the
+ // starting position as 0,0.
+ Q_D(const QWidget);
+ QRect newFramePosition = frameGeometry();
+ QRect newNormalPosition = normalGeometry();
+ if(d->topData()->wasMaximized && !(windowState() & Qt::WindowMaximized)) {
+ // Change the starting position
+ newFramePosition.moveTo(0, 0);
+ newNormalPosition.moveTo(0, 0);
+ }
+#endif // QT_MAC_USE_COCOA
QByteArray array;
QDataStream stream(&array, QIODevice::WriteOnly);
stream.setVersion(QDataStream::Qt_4_0);
@@ -6720,8 +6746,13 @@ QByteArray QWidget::saveGeometry() const
stream << magicNumber
<< majorVersion
<< minorVersion
+#ifdef QT_MAC_USE_COCOA
+ << newFramePosition
+ << newNormalPosition
+#else
<< frameGeometry()
<< normalGeometry()
+#endif // QT_MAC_USE_COCOA
<< qint32(QApplication::desktop()->screenNumber(this))
<< quint8(windowState() & Qt::WindowMaximized)
<< quint8(windowState() & Qt::WindowFullScreen);
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index e29b755f71..f12c956b8e 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3824,9 +3824,35 @@ void QWidgetPrivate::raise_sys()
#if QT_MAC_USE_COCOA
QMacCocoaAutoReleasePool pool;
if (isRealWindow()) {
- // Calling orderFront shows the window on Cocoa too.
+ // With the introduction of spaces it is not as simple as just raising the window.
+ // First we need to check if we are in the right space. If we are, then we just continue
+ // as usual. The problem comes when we are not in the active space. There are two main cases:
+ // 1. Our parent was moved to a new space. In this case we want the window to be raised
+ // in the same space as its parent.
+ // 2. We don't have a parent. For this case we will just raise the window and let Cocoa
+ // switch to the corresponding space.
+ // NOTICE: There are a lot of corner cases here. We are keeping this simple for now, if
+ // required we will introduce special handling for some of them.
if (!q->testAttribute(Qt::WA_DontShowOnScreen) && q->isVisible()) {
- [qt_mac_window_for(q) orderFront:qt_mac_window_for(q)];
+ OSWindowRef window = qt_mac_window_for(q);
+ // isOnActiveSpace is available only from 10.6 onwards, so we need to check if it is
+ // available before calling it.
+ if([window respondsToSelector:@selector(isOnActiveSpace)]) {
+ if(![window performSelector:@selector(isOnActiveSpace)]) {
+ QWidget *parentWidget = q->parentWidget();
+ if(parentWidget) {
+ OSWindowRef parentWindow = qt_mac_window_for(parentWidget);
+ if(parentWindow && [parentWindow isOnActiveSpace]) {
+ // The window was created in a different space. Therefore if we want
+ // to show it in the current space we need to recreate it in the new
+ // space.
+ recreateMacWindow();
+ window = qt_mac_window_for(q);
+ }
+ }
+ }
+ }
+ [window orderFront:window];
}
if (qt_mac_raise_process) { //we get to be the active process now
ProcessSerialNumber psn;
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index cad60b5ff9..3f494d8da7 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -170,6 +170,14 @@ struct QTLWExtra {
WindowGroupRef group;
IconRef windowIcon; // the current window icon, if set with setWindowIcon_sys.
quint32 savedWindowAttributesFromMaximized; // Saved attributes from when the calling updateMaximizeButton_sys()
+#ifdef QT_MAC_USE_COCOA
+ // This value is just to make sure we maximize and restore to the right location, yet we allow apps to be maximized and
+ // manually resized.
+ // The name is misleading, since this is set when maximizing the window. It is a hint to saveGeometry(..) to record the
+ // starting position as 0,0 instead of the normal starting position.
+ bool wasMaximized;
+#endif // QT_MAC_USE_COCOA
+
#elif defined(Q_WS_QWS) // <--------------------------------------------------------- QWS
#ifndef QT_NO_QWS_MANAGER
QWSManager *qwsManager;
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 7d647b79ee..5482da3b7c 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -123,9 +123,11 @@ static PtrWTClose ptrWTClose = 0;
static PtrWTInfo ptrWTInfo = 0;
static PtrWTQueueSizeGet ptrWTQueueSizeGet = 0;
static PtrWTQueueSizeSet ptrWTQueueSizeSet = 0;
+#ifndef QT_NO_TABLETEVENT
static void init_wintab_functions();
static void qt_tablet_init();
static void qt_tablet_cleanup();
+#endif // QT_NO_TABLETEVENT
extern HCTX qt_tablet_context;
extern bool qt_tablet_tilt_support;
@@ -136,6 +138,8 @@ QWidget* qt_get_tablet_widget()
}
extern bool qt_is_gui_used;
+
+#ifndef QT_NO_TABLETEVENT
static void init_wintab_functions()
{
#if defined(Q_OS_WINCE)
@@ -227,6 +231,7 @@ static void qt_tablet_cleanup()
delete qt_tablet_widget;
qt_tablet_widget = 0;
}
+#endif // QT_NO_TABLETEVENT
const QString qt_reg_winclass(QWidget *w); // defined in qapplication_win.cpp
@@ -512,8 +517,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
DestroyWindow(destroyw);
}
+#ifndef QT_NO_TABLETEVENT
if (q != qt_tablet_widget && QWidgetPrivate::mapper)
qt_tablet_init();
+#endif // QT_NO_TABLETEVENT
if (q->testAttribute(Qt::WA_DropSiteRegistered))
registerDropSite(true);
diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp
index 509847b6d8..fc1e52caf9 100644
--- a/src/gui/kernel/qwidget_wince.cpp
+++ b/src/gui/kernel/qwidget_wince.cpp
@@ -63,6 +63,7 @@ typedef BOOL (API *PtrWTGet)(HCTX, LPLOGCONTEXT);
typedef int (API *PtrWTQueueSizeGet)(HCTX);
typedef BOOL (API *PtrWTQueueSizeSet)(HCTX, int);
+#ifndef QT_NO_TABLETEVENT
static void qt_tablet_init_wce();
static void qt_tablet_cleanup_wce();
@@ -135,6 +136,7 @@ static void qt_tablet_cleanup_wce() {
delete qt_tablet_widget;
qt_tablet_widget = 0;
}
+#endif // QT_NO_TABLETEVENT
// The internal qWinRequestConfig, defined in qapplication_win.cpp, stores move,
@@ -358,8 +360,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
DestroyWindow(destroyw);
}
+#ifndef QT_NO_TABLETEVENT
if (q != qt_tablet_widget && QWidgetPrivate::mapper)
qt_tablet_init_wce();
+#endif // QT_NO_TABLETEVENT
if (q->testAttribute(Qt::WA_DropSiteRegistered))
registerDropSite(true);
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 37ac6bff10..43f510c3f6 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -3000,7 +3000,7 @@ Picture QX11Data::getSolidFill(int screen, const QColor &c)
return X11->solid_fills[i].picture;
}
// none found, replace one
- int i = rand() % 16;
+ int i = qrand() % 16;
if (X11->solid_fills[i].screen != screen && X11->solid_fills[i].picture) {
XRenderFreePicture (X11->display, X11->solid_fills[i].picture);
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp
index 7ff2a37a58..2a9b31a549 100644
--- a/src/gui/painting/qbezier.cpp
+++ b/src/gui/painting/qbezier.cpp
@@ -93,7 +93,7 @@ QBezier QBezier::fromPoints(const QPointF &p1, const QPointF &p2,
/*!
\internal
*/
-QPolygonF QBezier::toPolygon() const
+QPolygonF QBezier::toPolygon(qreal bezier_flattening_threshold) const
{
// flattening is done by splitting the bezier until we can replace the segment by a straight
// line. We split further until the control points are close enough to the line connecting the
@@ -108,7 +108,7 @@ QPolygonF QBezier::toPolygon() const
QPolygonF polygon;
polygon.append(QPointF(x1, y1));
- addToPolygon(&polygon);
+ addToPolygon(&polygon, bezier_flattening_threshold);
return polygon;
}
@@ -117,34 +117,6 @@ QBezier QBezier::mapBy(const QTransform &transform) const
return QBezier::fromPoints(transform.map(pt1()), transform.map(pt2()), transform.map(pt3()), transform.map(pt4()));
}
-//0.05 is really low, but required for scaled-up beziers...
-static const qreal flatness = 0.05;
-
-//based on "Fast, precise flattening of cubic Bezier path and offset curves"
-// by T. F. Hain, A. L. Ahmad, S. V. R. Racherla and D. D. Langan
-static inline void flattenBezierWithoutInflections(QBezier &bez,
- QPolygonF *&p)
-{
- QBezier left;
-
- while (1) {
- qreal dx = bez.x2 - bez.x1;
- qreal dy = bez.y2 - bez.y1;
-
- qreal normalized = qSqrt(dx * dx + dy * dy);
- if (qFuzzyIsNull(normalized))
- break;
-
- qreal d = qAbs(dx * (bez.y3 - bez.y2) - dy * (bez.x3 - bez.x2));
-
- qreal t = qSqrt(4. / 3. * normalized * flatness / d);
- if (t > 1 || qFuzzyIsNull(t - (qreal)1.))
- break;
- bez.parameterSplitLeft(t, &left);
- p->append(bez.pt1());
- }
-}
-
QBezier QBezier::getSubRange(qreal t0, qreal t1) const
{
QBezier result;
@@ -223,7 +195,7 @@ static inline bool findInflections(qreal a, qreal b, qreal c,
}
-void QBezier::addToPolygon(QPolygonF *polygon) const
+void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold) const
{
QBezier beziers[32];
beziers[0] = *this;
@@ -243,7 +215,7 @@ void QBezier::addToPolygon(QPolygonF *polygon) const
qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3);
l = 1.;
}
- if (d < flatness*l || b == beziers + 31) {
+ if (d < bezier_flattening_threshold*l || b == beziers + 31) {
// good enough, we pop it off and add the endpoint
polygon->append(QPointF(b->x4, b->y4));
--b;
@@ -255,55 +227,6 @@ void QBezier::addToPolygon(QPolygonF *polygon) const
}
}
-void QBezier::addToPolygonMixed(QPolygonF *polygon) const
-{
- qreal ax = -x1 + 3*x2 - 3*x3 + x4;
- qreal ay = -y1 + 3*y2 - 3*y3 + y4;
- qreal bx = 3*x1 - 6*x2 + 3*x3;
- qreal by = 3*y1 - 6*y2 + 3*y3;
- qreal cx = -3*x1 + 3*x2;
- qreal cy = -3*y1 + 2*y2;
- qreal a = 6 * (ay * bx - ax * by);
- qreal b = 6 * (ay * cx - ax * cy);
- qreal c = 2 * (by * cx - bx * cy);
-
- if ((qFuzzyIsNull(a) && qFuzzyIsNull(b)) ||
- (b * b - 4 * a *c) < 0) {
- QBezier bez(*this);
- flattenBezierWithoutInflections(bez, polygon);
- polygon->append(QPointF(x4, y4));
- } else {
- QBezier beziers[32];
- beziers[0] = *this;
- QBezier *b = beziers;
-
- while (b >= beziers) {
- // check if we can pop the top bezier curve from the stack
- qreal y4y1 = b->y4 - b->y1;
- qreal x4x1 = b->x4 - b->x1;
- qreal l = qAbs(x4x1) + qAbs(y4y1);
- qreal d;
- if (l > 1.) {
- d = qAbs( (x4x1)*(b->y1 - b->y2) - (y4y1)*(b->x1 - b->x2) )
- + qAbs( (x4x1)*(b->y1 - b->y3) - (y4y1)*(b->x1 - b->x3) );
- } else {
- d = qAbs(b->x1 - b->x2) + qAbs(b->y1 - b->y2) +
- qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3);
- l = 1.;
- }
- if (d < .5*l || b == beziers + 31) {
- // good enough, we pop it off and add the endpoint
- polygon->append(QPointF(b->x4, b->y4));
- --b;
- } else {
- // split, second half of the polygon goes lower into the stack
- b->split(b+1, b);
- ++b;
- }
- }
- }
-}
-
QRectF QBezier::bounds() const
{
qreal xmin = x1;
@@ -824,147 +747,4 @@ QBezier QBezier::bezierOnInterval(qreal t0, qreal t1) const
return result;
}
-
-static inline void bindInflectionPoint(const QBezier &bez, const qreal t,
- qreal *tMinus , qreal *tPlus)
-{
- if (t <= 0) {
- *tMinus = *tPlus = -1;
- return;
- } else if (t >= 1) {
- *tMinus = *tPlus = 2;
- return;
- }
-
- QBezier left, right;
- splitBezierAt(bez, t, &left, &right);
-
- qreal ax = -right.x1 + 3*right.x2 - 3*right.x3 + right.x4;
- qreal ay = -right.y1 + 3*right.y2 - 3*right.y3 + right.y4;
- qreal ex = 3 * (right.x2 - right.x3);
- qreal ey = 3 * (right.y2 - right.y3);
-
- qreal s4 = qAbs(6 * (ey * ax - ex * ay) / qSqrt(ex * ex + ey * ey)) + 0.00001f;
- qreal tf = qPow(qreal(9 * flatness / s4), qreal(1./3.));
- *tMinus = t - (1 - t) * tf;
- *tPlus = t + (1 - t) * tf;
-}
-
-void QBezier::addToPolygonIterative(QPolygonF *p) const
-{
- qreal t1, t2, tcusp;
- qreal t1min, t1plus, t2min, t2plus;
-
- qreal ax = -x1 + 3*x2 - 3*x3 + x4;
- qreal ay = -y1 + 3*y2 - 3*y3 + y4;
- qreal bx = 3*x1 - 6*x2 + 3*x3;
- qreal by = 3*y1 - 6*y2 + 3*y3;
- qreal cx = -3*x1 + 3*x2;
- qreal cy = -3*y1 + 2*y2;
-
- if (findInflections(6 * (ay * bx - ax * by),
- 6 * (ay * cx - ax * cy),
- 2 * (by * cx - bx * cy),
- &t1, &t2, &tcusp)) {
- bindInflectionPoint(*this, t1, &t1min, &t1plus);
- bindInflectionPoint(*this, t2, &t2min, &t2plus);
-
- QBezier tmpBez = *this;
- QBezier left, right, bez1, bez2, bez3;
- if (t1min > 0) {
- if (t1min >= 1) {
- flattenBezierWithoutInflections(tmpBez, p);
- } else {
- splitBezierAt(tmpBez, t1min, &left, &right);
- flattenBezierWithoutInflections(left, p);
- p->append(tmpBez.pointAt(t1min));
-
- if (t2min < t1plus) {
- if (tcusp < 1) {
- p->append(tmpBez.pointAt(tcusp));
- }
- if (t2plus < 1) {
- splitBezierAt(tmpBez, t2plus, &left, &right);
- flattenBezierWithoutInflections(right, p);
- }
- } else if (t1plus < 1) {
- if (t2min < 1) {
- splitBezierAt(tmpBez, t2min, &bez3, &right);
- splitBezierAt(bez3, t1plus, &left, &bez2);
-
- flattenBezierWithoutInflections(bez2, p);
- p->append(tmpBez.pointAt(t2min));
-
- if (t2plus < 1) {
- splitBezierAt(tmpBez, t2plus, &left, &bez2);
- flattenBezierWithoutInflections(bez2, p);
- }
- } else {
- splitBezierAt(tmpBez, t1plus, &left, &bez2);
- flattenBezierWithoutInflections(bez2, p);
- }
- }
- }
- } else if (t1plus > 0) {
- p->append(QPointF(x1, y1));
- if (t2min < t1plus) {
- if (tcusp < 1) {
- p->append(tmpBez.pointAt(tcusp));
- }
- if (t2plus < 1) {
- splitBezierAt(tmpBez, t2plus, &left, &bez2);
- flattenBezierWithoutInflections(bez2, p);
- }
- } else if (t1plus < 1) {
- if (t2min < 1) {
- splitBezierAt(tmpBez, t2min, &bez3, &right);
- splitBezierAt(bez3, t1plus, &left, &bez2);
-
- flattenBezierWithoutInflections(bez2, p);
-
- p->append(tmpBez.pointAt(t2min));
- if (t2plus < 1) {
- splitBezierAt(tmpBez, t2plus, &left, &bez2);
- flattenBezierWithoutInflections(bez2, p);
- }
- } else {
- splitBezierAt(tmpBez, t1plus, &left, &bez2);
- flattenBezierWithoutInflections(bez2, p);
- }
- }
- } else if (t2min > 0) {
- if (t2min < 1) {
- splitBezierAt(tmpBez, t2min, &bez1, &right);
- flattenBezierWithoutInflections(bez1, p);
- p->append(tmpBez.pointAt(t2min));
-
- if (t2plus < 1) {
- splitBezierAt(tmpBez, t2plus, &left, &bez2);
- flattenBezierWithoutInflections(bez2, p);
- }
- } else {
- //### in here we should check whether the area of the
- // triangle formed between pt1/pt2/pt3 is smaller
- // or equal to 0 and then do iterative flattening
- // if not we should fallback and do the recursive
- // flattening.
- flattenBezierWithoutInflections(tmpBez, p);
- }
- } else if (t2plus > 0) {
- p->append(QPointF(x1, y1));
- if (t2plus < 1) {
- splitBezierAt(tmpBez, t2plus, &left, &bez2);
- flattenBezierWithoutInflections(bez2, p);
- }
- } else {
- flattenBezierWithoutInflections(tmpBez, p);
- }
- } else {
- QBezier bez = *this;
- flattenBezierWithoutInflections(bez, p);
- }
-
- p->append(QPointF(x4, y4));
-}
-
QT_END_NAMESPACE
diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h
index 846635fbe0..18ec11666f 100644
--- a/src/gui/painting/qbezier_p.h
+++ b/src/gui/painting/qbezier_p.h
@@ -79,10 +79,9 @@ public:
inline QPointF derivedAt(qreal t) const;
inline QPointF secondDerivedAt(qreal t) const;
- QPolygonF toPolygon() const;
- void addToPolygon(QPolygonF *p) const;
- void addToPolygonIterative(QPolygonF *p) const;
- void addToPolygonMixed(QPolygonF *p) const;
+ QPolygonF toPolygon(qreal bezier_flattening_threshold = 0.5) const;
+ void addToPolygon(QPolygonF *p, qreal bezier_flattening_threshold = 0.5) const;
+
QRectF bounds() const;
qreal length(qreal error = 0.01) const;
void addIfClose(qreal *length, qreal error) const;
diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h
index bc5f1efcf7..8f8544f677 100644
--- a/src/gui/painting/qdatabuffer_p.h
+++ b/src/gui/painting/qdatabuffer_p.h
@@ -60,16 +60,20 @@ QT_BEGIN_NAMESPACE
template <typename Type> class QDataBuffer
{
public:
- QDataBuffer(int res = 64)
+ QDataBuffer(int res)
{
capacity = res;
- buffer = (Type*) qMalloc(capacity * sizeof(Type));
+ if (res)
+ buffer = (Type*) qMalloc(capacity * sizeof(Type));
+ else
+ buffer = 0;
siz = 0;
}
~QDataBuffer()
{
- qFree(buffer);
+ if (buffer)
+ qFree(buffer);
}
inline void reset() { siz = 0; }
@@ -104,6 +108,8 @@ public:
inline void reserve(int size) {
if (size > capacity) {
+ if (capacity == 0)
+ capacity = 1;
while (capacity < size)
capacity *= 2;
buffer = (Type*) qRealloc(buffer, capacity * sizeof(Type));
@@ -112,7 +118,12 @@ public:
inline void shrink(int size) {
capacity = size;
- buffer = (Type*) qRealloc(buffer, capacity * sizeof(Type));
+ if (size)
+ buffer = (Type*) qRealloc(buffer, capacity * sizeof(Type));
+ else {
+ qFree(buffer);
+ buffer = 0;
+ }
}
inline void swap(QDataBuffer<Type> &other) {
diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp
index a62f06bde9..ef9b18c9d8 100644
--- a/src/gui/painting/qdrawutil.cpp
+++ b/src/gui/painting/qdrawutil.cpp
@@ -1137,6 +1137,15 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
xTarget.resize(columns + 1);
yTarget.resize(rows + 1);
+ bool oldAA = painter->testRenderHint(QPainter::Antialiasing);
+ bool oldSmooth = painter->testRenderHint(QPainter::SmoothPixmapTransform);
+ if (painter->paintEngine()->type() != QPaintEngine::OpenGL
+ && painter->paintEngine()->type() != QPaintEngine::OpenGL2
+ && (oldSmooth || oldAA) && painter->combinedTransform().type() != QTransform::TxNone) {
+ painter->setRenderHint(QPainter::Antialiasing, false);
+ painter->setRenderHint(QPainter::SmoothPixmapTransform, false);
+ }
+
xTarget[0] = targetRect.left();
xTarget[1] = targetCenterLeft;
xTarget[columns - 1] = targetCenterRight;
@@ -1342,6 +1351,11 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
painter->drawPixmapFragments(opaqueData.data(), opaqueData.size(), pixmap, QPainter::OpaqueHint);
if (translucentData.size())
painter->drawPixmapFragments(translucentData.data(), translucentData.size(), pixmap);
+
+ if (oldAA)
+ painter->setRenderHint(QPainter::Antialiasing, true);
+ if (oldSmooth)
+ painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp
index ad0c2ebac4..1b01960334 100644
--- a/src/gui/painting/qoutlinemapper.cpp
+++ b/src/gui/painting/qoutlinemapper.cpp
@@ -154,7 +154,8 @@ QT_FT_Outline *QOutlineMapper::convertPath(const QVectorPath &path)
// ### We can kill this copying and just use the buffer straight...
m_elements.resize(count);
- memcpy(m_elements.data(), path.points(), count* sizeof(QPointF));
+ if (count)
+ memcpy(m_elements.data(), path.points(), count* sizeof(QPointF));
m_element_types.resize(0);
}
diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h
index d0ce1a9d3d..39b7593880 100644
--- a/src/gui/painting/qoutlinemapper_p.h
+++ b/src/gui/painting/qoutlinemapper_p.h
@@ -87,8 +87,15 @@ const int QT_RASTER_COORD_LIMIT = 32767;
class QOutlineMapper
{
public:
- QOutlineMapper()
- : m_round_coords(false)
+ QOutlineMapper() :
+ m_element_types(0),
+ m_elements(0),
+ m_elements_dev(0),
+ m_points(0),
+ m_tags(0),
+ m_contours(0),
+ m_polygon_dev(0),
+ m_round_coords(false)
{
}
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 9148ac23ab..6f395f6c57 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -251,6 +251,11 @@ static void qt_debug_path(const QPainterPath &path)
}
#endif
+QRasterPaintEnginePrivate::QRasterPaintEnginePrivate() :
+ QPaintEngineExPrivate(),
+ cachedLines(0)
+{
+}
/*!
@@ -336,17 +341,6 @@ void QRasterPaintEngine::init()
d->hdc = 0;
#endif
- d->rasterPoolSize = 8192;
- d->rasterPoolBase =
-#if defined(Q_WS_WIN64)
- // We make use of setjmp and longjmp in qgrayraster.c which requires
- // 16-byte alignment, hence we hardcode this requirement here..
- (unsigned char *) _aligned_malloc(d->rasterPoolSize, sizeof(void*) * 2);
-#else
- (unsigned char *) malloc(d->rasterPoolSize);
-#endif
- Q_CHECK_PTR(d->rasterPoolBase);
-
// The antialiasing raster.
d->grayRaster.reset(new QT_FT_Raster);
Q_CHECK_PTR(d->grayRaster.data());
@@ -354,8 +348,6 @@ void QRasterPaintEngine::init()
QT_THROW(std::bad_alloc()); // an error creating the raster is caused by a bad malloc
- qt_ft_grays_raster.raster_reset(*d->grayRaster.data(), d->rasterPoolBase, d->rasterPoolSize);
-
d->rasterizer.reset(new QRasterizer);
d->rasterBuffer.reset(new QRasterBuffer());
d->outlineMapper.reset(new QOutlineMapper);
@@ -437,12 +429,6 @@ QRasterPaintEngine::~QRasterPaintEngine()
{
Q_D(QRasterPaintEngine);
-#if defined(Q_WS_WIN64)
- _aligned_free(d->rasterPoolBase);
-#else
- free(d->rasterPoolBase);
-#endif
-
qt_ft_grays_raster.raster_done(*d->grayRaster.data());
}
@@ -4090,6 +4076,22 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
return;
}
+ const int rasterPoolInitialSize = 8192;
+ int rasterPoolSize = rasterPoolInitialSize;
+ unsigned char *rasterPoolBase;
+#if defined(Q_WS_WIN64)
+ rasterPoolBase =
+ // We make use of setjmp and longjmp in qgrayraster.c which requires
+ // 16-byte alignment, hence we hardcode this requirement here..
+ (unsigned char *) _aligned_malloc(rasterPoolSize, sizeof(void*) * 2);
+#else
+ unsigned char rasterPoolOnStack[rasterPoolInitialSize];
+ rasterPoolBase = rasterPoolOnStack;
+#endif
+ Q_CHECK_PTR(rasterPoolBase);
+
+ qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize);
+
void *data = userData;
QT_FT_BBox clip_box = { deviceRect.x(),
@@ -4122,13 +4124,14 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
int new_size = rasterPoolSize * 2;
if (new_size > 1024 * 1024) {
qWarning("QPainter: Rasterization of primitive failed");
- return;
+ break;
}
#if defined(Q_WS_WIN64)
_aligned_free(rasterPoolBase);
#else
- free(rasterPoolBase);
+ if (rasterPoolBase != rasterPoolOnStack) // initially on the stack
+ free(rasterPoolBase);
#endif
rasterPoolSize = new_size;
@@ -4149,6 +4152,13 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
done = true;
}
}
+
+#if defined(Q_WS_WIN64)
+ _aligned_free(rasterPoolBase);
+#else
+ if (rasterPoolBase != rasterPoolOnStack) // initially on the stack
+ free(rasterPoolBase);
+#endif
}
void QRasterPaintEnginePrivate::recalculateFastImages()
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index 55eb82ee50..1016f8d701 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -300,6 +300,7 @@ QRasterPaintEnginePrivate : public QPaintEngineExPrivate
{
Q_DECLARE_PUBLIC(QRasterPaintEngine)
public:
+ QRasterPaintEnginePrivate();
void rasterizeLine_dashed(QLineF line, qreal width,
int *dashIndex, qreal *dashOffset, bool *inDash);
@@ -354,8 +355,6 @@ public:
QScopedPointer<QDashStroker> dashStroker;
QScopedPointer<QT_FT_Raster> grayRaster;
- unsigned long rasterPoolSize;
- unsigned char *rasterPoolBase;
QDataBuffer<QLineF> cachedLines;
QSpanData image_filler;
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index da48fcb0b3..aef8b807ab 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -315,7 +315,7 @@ static Picture getPatternFill(int screen, const QBrush &b)
return X11->pattern_fills[i].picture;
}
// none found, replace one
- int i = rand() % 16;
+ int i = qrand() % 16;
if (X11->pattern_fills[i].screen != screen && X11->pattern_fills[i].picture) {
XRenderFreePicture (X11->display, X11->pattern_fills[i].picture);
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index a78cafb394..ff82d59b92 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -149,6 +149,7 @@ QDebug Q_GUI_EXPORT &operator<<(QDebug &s, const QVectorPath &path)
struct StrokeHandler {
+ StrokeHandler(int reserve) : pts(reserve), types(reserve) {}
QDataBuffer<qreal> pts;
QDataBuffer<QPainterPath::ElementType> types;
};
@@ -394,7 +395,7 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
return;
if (!d->strokeHandler) {
- d->strokeHandler = new StrokeHandler;
+ d->strokeHandler = new StrokeHandler(path.elementCount()+4);
d->stroker.setMoveToHook(qpaintengineex_moveTo);
d->stroker.setLineToHook(qpaintengineex_lineTo);
d->stroker.setCubicToHook(qpaintengineex_cubicTo);
@@ -460,6 +461,7 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
// change the current transform. Normal transformed,
// non-cosmetic pens will be transformed as part of fill
// later, so they are also covered here..
+ d->activeStroker->setCurveThresholdFromTransform(state()->matrix);
d->activeStroker->begin(d->strokeHandler);
if (types) {
while (points < lastPoint) {
@@ -517,6 +519,7 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
QPainterPath painterPath = state()->matrix.map(path.convertToPainterPath());
d->activeStroker->strokePath(painterPath, d->strokeHandler, QTransform());
} else {
+ d->activeStroker->setCurveThresholdFromTransform(state()->matrix);
d->activeStroker->begin(d->strokeHandler);
if (types) {
while (points < lastPoint) {
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index c910024679..78553c9b5c 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -278,7 +278,8 @@ private:
};
SegmentTree::SegmentTree(QPathSegments &segments)
- : m_segments(segments)
+ : m_segments(segments),
+ m_intersections(0)
{
m_bounds.x1 = qt_inf();
m_bounds.y1 = qt_inf();
@@ -806,7 +807,7 @@ void QWingedEdge::intersectAndAdd()
for (int i = 0; i < m_segments.points(); ++i)
addVertex(m_segments.pointAt(i));
- QDataBuffer<QPathSegments::Intersection> intersections;
+ QDataBuffer<QPathSegments::Intersection> intersections(m_segments.segments());
for (int i = 0; i < m_segments.segments(); ++i) {
intersections.reset();
@@ -857,11 +858,17 @@ void QWingedEdge::intersectAndAdd()
}
}
-QWingedEdge::QWingedEdge()
+QWingedEdge::QWingedEdge() :
+ m_edges(0),
+ m_vertices(0),
+ m_segments(0)
{
}
-QWingedEdge::QWingedEdge(const QPainterPath &subject, const QPainterPath &clip)
+QWingedEdge::QWingedEdge(const QPainterPath &subject, const QPainterPath &clip) :
+ m_edges(subject.length()),
+ m_vertices(subject.length()),
+ m_segments(subject.length())
{
m_segments.setPath(subject);
m_segments.addPath(clip);
@@ -1414,9 +1421,9 @@ bool QPathClipper::intersect()
else if (clipIsRect)
return subjectPath.intersects(r2);
- QPathSegments a;
+ QPathSegments a(subjectPath.length());
a.setPath(subjectPath);
- QPathSegments b;
+ QPathSegments b(clipPath.length());
b.setPath(clipPath);
QIntersectionFinder finder;
@@ -1459,9 +1466,9 @@ bool QPathClipper::contains()
if (clipIsRect)
return subjectPath.contains(r2);
- QPathSegments a;
+ QPathSegments a(subjectPath.length());
a.setPath(subjectPath);
- QPathSegments b;
+ QPathSegments b(clipPath.length());
b.setPath(clipPath);
QIntersectionFinder finder;
diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h
index 7962400d85..fab618d79e 100644
--- a/src/gui/painting/qpathclipper_p.h
+++ b/src/gui/painting/qpathclipper_p.h
@@ -199,7 +199,7 @@ public:
};
- QPathSegments();
+ QPathSegments(int reserve);
void setPath(const QPainterPath &path);
void addPath(const QPainterPath &path);
@@ -345,7 +345,10 @@ inline QPathVertex::operator QPointF() const
return QPointF(x, y);
}
-inline QPathSegments::QPathSegments()
+inline QPathSegments::QPathSegments(int reserve) :
+ m_points(reserve),
+ m_segments(reserve),
+ m_intersections(reserve)
{
}
diff --git a/src/gui/painting/qpolygonclipper_p.h b/src/gui/painting/qpolygonclipper_p.h
index 1b4cbb3031..cdaac1c97a 100644
--- a/src/gui/painting/qpolygonclipper_p.h
+++ b/src/gui/painting/qpolygonclipper_p.h
@@ -62,7 +62,8 @@ QT_BEGIN_NAMESPACE
template <typename InType, typename OutType, typename CastType> class QPolygonClipper
{
public:
- QPolygonClipper()
+ QPolygonClipper() :
+ buffer1(0), buffer2(0)
{
x1 = y1 = x2 = y2 = 0;
}
diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp
index b8bf15e66d..2955e398fa 100644
--- a/src/gui/painting/qprintengine_pdf.cpp
+++ b/src/gui/painting/qprintengine_pdf.cpp
@@ -931,29 +931,16 @@ void QPdfEnginePrivate::writeHeader()
void QPdfEnginePrivate::writeInfo()
{
info = addXrefEntry(-1);
-
- // The 'text string' type in PDF is encoded either as PDFDocEncoding, or
- // Unicode UTF-16 with a Unicode byte order mark as the first character
- // (0xfeff), with the high-order byte first.
- QByteArray array("<<\n/Title (\xfe\xff");
- const ushort *utf16Title = title.utf16();
- for (int i=0; i < title.size(); ++i) {
- array.append((*(utf16Title + i)) >> 8);
- array.append((*(utf16Title + i)) & 0xff);
- }
- array.append(")\n/Creator (\xfe\xff");
- const ushort *utf16Creator = creator.utf16();
- for (int i=0; i < creator.size(); ++i) {
- array.append((*(utf16Creator + i)) >> 8);
- array.append((*(utf16Creator + i)) & 0xff);
- }
- array.append(")\n/Producer (Qt " QT_VERSION_STR " (C) 2010 Nokia Corporation and/or its subsidiary(-ies))\n");
- write(array);
-
+ xprintf("<<\n/Title ");
+ printString(title);
+ xprintf("\n/Creator ");
+ printString(creator);
+ xprintf("\n/Producer ");
+ printString(QString::fromLatin1("Qt " QT_VERSION_STR " (C) 2010 Nokia Corporation and/or its subsidiary(-ies)"));
QDateTime now = QDateTime::currentDateTime().toUTC();
QTime t = now.time();
QDate d = now.date();
- xprintf("/CreationDate (D:%d%02d%02d%02d%02d%02d)\n",
+ xprintf("\n/CreationDate (D:%d%02d%02d%02d%02d%02d)\n",
d.year(),
d.month(),
d.day(),
@@ -1230,6 +1217,25 @@ int QPdfEnginePrivate::addXrefEntry(int object, bool printostr)
return object;
}
+void QPdfEnginePrivate::printString(const QString &string) {
+ // The 'text string' type in PDF is encoded either as PDFDocEncoding, or
+ // Unicode UTF-16 with a Unicode byte order mark as the first character
+ // (0xfeff), with the high-order byte first.
+ QByteArray array("(\xfe\xff");
+ const ushort *utf16 = string.utf16();
+
+ for (int i=0; i < string.size(); ++i) {
+ char part[2] = {char((*(utf16 + i)) >> 8), char((*(utf16 + i)) & 0xff)};
+ for(int j=0; j < 2; ++j) {
+ if (part[j] == '(' || part[j] == ')' || part[j] == '\\')
+ array.append('\\');
+ array.append(part[j]);
+ }
+ }
+ array.append(")");
+ write(array);
+}
+
QT_END_NAMESPACE
#endif // QT_NO_PRINTER
diff --git a/src/gui/painting/qprintengine_pdf_p.h b/src/gui/painting/qprintengine_pdf_p.h
index cb6c59ddb6..e0ca56fba1 100644
--- a/src/gui/painting/qprintengine_pdf_p.h
+++ b/src/gui/painting/qprintengine_pdf_p.h
@@ -170,6 +170,7 @@ private:
void writePage();
int addXrefEntry(int object, bool printostr = true);
+ void printString(const QString &string);
void xprintf(const char* fmt, ...);
inline void write(const QByteArray &data) {
stream->writeRawData(data.constData(), data.size());
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index 51d01c911b..f8f8afb088 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -198,9 +198,11 @@ public:
};
QScanConverter::QScanConverter()
- : m_alloc(0)
+ : m_lines(0)
+ , m_alloc(0)
, m_size(0)
, m_intersections(0)
+ , m_active(0)
{
}
@@ -310,6 +312,10 @@ struct QBoolToType
template <typename T>
void qScanConvert(QScanConverter &d, T allVertical)
{
+ if (!d.m_lines.size()) {
+ d.m_active.reset();
+ return;
+ }
qSort(d.m_lines.data(), d.m_lines.data() + d.m_lines.size(), QT_PREPEND_NAMESPACE(topOrder));
int line = 0;
for (int y = d.m_lines.first().top; y <= d.m_bottom; ++y) {
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index e43544cec2..eabbd8a602 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -120,8 +120,8 @@ private:
class QSubpathFlatIterator
{
public:
- QSubpathFlatIterator(const QDataBuffer<QStrokerOps::Element> *path)
- : m_path(path), m_pos(0), m_curve_index(-1) { }
+ QSubpathFlatIterator(const QDataBuffer<QStrokerOps::Element> *path, qreal threshold)
+ : m_path(path), m_pos(0), m_curve_index(-1), m_curve_threshold(threshold) { }
inline bool hasNext() const { return m_curve_index >= 0 || m_pos < m_path->size(); }
@@ -152,7 +152,7 @@ public:
QPointF(qt_fixed_to_real(m_path->at(m_pos+1).x),
qt_fixed_to_real(m_path->at(m_pos+1).y)),
QPointF(qt_fixed_to_real(m_path->at(m_pos+2).x),
- qt_fixed_to_real(m_path->at(m_pos+2).y))).toPolygon();
+ qt_fixed_to_real(m_path->at(m_pos+2).y))).toPolygon(m_curve_threshold);
m_curve_index = 1;
e.type = QPainterPath::LineToElement;
e.x = m_curve.at(0).x();
@@ -169,6 +169,7 @@ private:
int m_pos;
QPolygonF m_curve;
int m_curve_index;
+ qreal m_curve_threshold;
};
template <class Iterator> bool qt_stroke_side(Iterator *it, QStroker *stroker,
@@ -187,7 +188,12 @@ static inline qreal adapted_angle_on_x(const QLineF &line)
}
QStrokerOps::QStrokerOps()
- : m_customData(0), m_moveTo(0), m_lineTo(0), m_cubicTo(0)
+ : m_elements(0)
+ , m_curveThreshold(qt_real_to_fixed(0.25))
+ , m_customData(0)
+ , m_moveTo(0)
+ , m_lineTo(0)
+ , m_cubicTo(0)
{
}
@@ -195,7 +201,6 @@ QStrokerOps::~QStrokerOps()
{
}
-
/*!
Prepares the stroker. Call this function once before starting a
stroke by calling moveTo, lineTo or cubicTo.
@@ -238,6 +243,7 @@ void QStrokerOps::strokePath(const QPainterPath &path, void *customData, const Q
if (path.isEmpty())
return;
+ setCurveThresholdFromTransform(matrix);
begin(customData);
int count = path.elementCount();
if (matrix.isIdentity()) {
@@ -308,6 +314,8 @@ void QStrokerOps::strokePolygon(const QPointF *points, int pointCount, bool impl
{
if (!pointCount)
return;
+
+ setCurveThresholdFromTransform(matrix);
begin(data);
if (matrix.isIdentity()) {
moveTo(qt_real_to_fixed(points[0].x()), qt_real_to_fixed(points[0].y()));
@@ -348,6 +356,7 @@ void QStrokerOps::strokeEllipse(const QRectF &rect, void *data, const QTransform
}
}
+ setCurveThresholdFromTransform(matrix);
begin(data);
moveTo(qt_real_to_fixed(start.x()), qt_real_to_fixed(start.y()));
for (int i=0; i<12; i+=3) {
@@ -366,12 +375,10 @@ QStroker::QStroker()
{
m_strokeWidth = qt_real_to_fixed(1);
m_miterLimit = qt_real_to_fixed(2);
- m_curveThreshold = qt_real_to_fixed(0.25);
}
QStroker::~QStroker()
{
-
}
Qt::PenCapStyle QStroker::capForJoinMode(LineJoinMode mode)
@@ -1135,7 +1142,7 @@ void QDashStroker::processCurrentSubpath()
QPainterPath dashPath;
- QSubpathFlatIterator it(&m_elements);
+ QSubpathFlatIterator it(&m_elements, m_curveThreshold);
qfixed2d prev = it.next();
bool clipping = !m_clip_rect.isEmpty();
diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h
index 3e622a8932..d646135af1 100644
--- a/src/gui/painting/qstroker_p.h
+++ b/src/gui/painting/qstroker_p.h
@@ -124,6 +124,9 @@ typedef void (*qStrokerCubicToHook)(qfixed c1x, qfixed c1y,
qfixed ex, qfixed ey,
void *data);
+// qtransform.cpp
+Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale);
+
class Q_GUI_EXPORT QStrokerOps
{
public:
@@ -161,6 +164,16 @@ public:
QRectF clipRect() const { return m_clip_rect; }
void setClipRect(const QRectF &clip) { m_clip_rect = clip; }
+ void setCurveThresholdFromTransform(const QTransform &transform)
+ {
+ qreal scale;
+ qt_scaleForTransform(transform, &scale);
+ setCurveThreshold(scale == 0 ? qreal(0.5) : (qreal(0.5) / scale));
+ }
+
+ void setCurveThreshold(qfixed threshold) { m_curveThreshold = threshold; }
+ qfixed curveThreshold() const { return m_curveThreshold; }
+
protected:
inline void emitMoveTo(qfixed x, qfixed y);
inline void emitLineTo(qfixed x, qfixed y);
@@ -170,6 +183,7 @@ protected:
QDataBuffer<Element> m_elements;
QRectF m_clip_rect;
+ qfixed m_curveThreshold;
void *m_customData;
qStrokerMoveToHook m_moveTo;
@@ -208,9 +222,6 @@ public:
void setMiterLimit(qfixed length) { m_miterLimit = length; }
qfixed miterLimit() const { return m_miterLimit; }
- void setCurveThreshold(qfixed threshold) { m_curveThreshold = threshold; }
- qfixed curveThreshold() const { return m_curveThreshold; }
-
void joinPoints(qfixed x, qfixed y, const QLineF &nextLine, LineJoinMode join);
inline void emitMoveTo(qfixed x, qfixed y);
inline void emitLineTo(qfixed x, qfixed y);
@@ -227,7 +238,6 @@ protected:
qfixed m_strokeWidth;
qfixed m_miterLimit;
- qfixed m_curveThreshold;
LineJoinMode m_capStyle;
LineJoinMode m_joinStyle;
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 80b75202ac..aaa241f013 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -1545,12 +1545,19 @@ static inline bool lineTo_clipped(QPainterPath &path, const QTransform &transfor
return true;
}
+Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale);
static inline bool cubicTo_clipped(QPainterPath &path, const QTransform &transform, const QPointF &a, const QPointF &b, const QPointF &c, const QPointF &d, bool needsMoveTo)
{
// Convert projective xformed curves to line
// segments so they can be transformed more accurately
- QPolygonF segment = QBezier::fromPoints(a, b, c, d).toPolygon();
+
+ qreal scale;
+ qt_scaleForTransform(transform, &scale);
+
+ qreal curveThreshold = scale == 0 ? qreal(0.25) : (qreal(0.25) / scale);
+
+ QPolygonF segment = QBezier::fromPoints(a, b, c, d).toPolygon(curveThreshold);
for (int i = 0; i < segment.size() - 1; ++i)
if (lineTo_clipped(path, transform, segment.at(i), segment.at(i+1), needsMoveTo))
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 0f39b23ba9..d9f7df09ab 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -1397,7 +1397,6 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
dark.lighter(135), 60);
QColor highlight = option->palette.highlight().color();
- QColor highlightText = option->palette.highlightedText().color();
switch(element) {
case CE_RadioButton: //fall through
@@ -2723,7 +2722,6 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
{
// Fill title bar gradient
QColor titlebarColor = QColor(active ? highlight: palette.background().color());
- QColor titleBarGradientStop(active ? highlight.darker(150): palette.background().color().darker(120));
QLinearGradient gradient(option->rect.center().x(), option->rect.top(),
option->rect.center().x(), option->rect.bottom());
@@ -2986,7 +2984,6 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->fillRect(option->rect, option->palette.background());
- QRect rect = scrollBar->rect;
QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
@@ -3714,6 +3711,9 @@ int QCleanlooksStyle::pixelMetric(PixelMetric metric, const QStyleOption *option
{
int ret = -1;
switch (metric) {
+ case PM_ToolTipLabelFrameWidth:
+ ret = 2;
+ break;
case PM_ButtonDefaultIndicator:
ret = 0;
break;
diff --git a/src/gui/styles/qgtkpainter.cpp b/src/gui/styles/qgtkpainter.cpp
index 1f68f2f768..79c53e9dfa 100644
--- a/src/gui/styles/qgtkpainter.cpp
+++ b/src/gui/styles/qgtkpainter.cpp
@@ -47,6 +47,7 @@
// This class is primarily a wrapper around the gtk painter functions
// and takes care of converting all such calls into cached Qt pixmaps.
+#include <private/qstylehelper_p.h>
#include <QtGui/QWidget>
#include <QtGui/QStyleOption>
#include <QtGui/QPixmapCache>
@@ -155,8 +156,12 @@ static QString uniqueName(const QString &key, GtkStateType state, GtkShadowType
const QSize &size, GtkWidget *widget = 0)
{
// Note the widget arg should ideally use the widget path, though would compromise performance
- QString tmp = QString(QLS("%0-%1-%2-%3x%4-%5")).arg(key).arg(uint(state)).arg(shadow)
- .arg(size.width()).arg(size.height()).arg(quintptr(widget));
+ QString tmp = key
+ % HexString<uint>(state)
+ % HexString<uint>(shadow)
+ % HexString<uint>(size.width())
+ % HexString<uint>(size.height())
+ % HexString<quint64>(quint64(widget));
return tmp;
}
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index 9c61023a04..6c8d561d79 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -1163,7 +1163,6 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
if (const QStyleOptionTabBarBase *tbb
= qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) {
QRect tabRect = tbb->rect;
- QRegion region(tabRect);
painter->save();
painter->setPen(QPen(option->palette.dark().color().dark(110), 0));
switch (tbb->shape) {
@@ -1245,8 +1244,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
else
alphaCornerColor = mergedColors(option->palette.background().color(), darkOutline);
- QPalette palette = option->palette;
-
switch (control) {
case CC_TitleBar:
@@ -1333,11 +1330,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
bool isEnabled = (comboBox->state & State_Enabled);
bool focus = isEnabled && (comboBox->state & State_HasFocus);
- QColor buttonShadow = option->palette.dark().color();
GtkStateType state = gtkPainter.gtkState(option);
int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, comboBox, widget);
- QPixmap cache;
- QString pixmapName;
QStyleOptionComboBox comboBoxCopy = *comboBox;
comboBoxCopy.rect = option->rect;
@@ -1345,8 +1339,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QRect rect = option->rect;
QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
SC_ComboBoxArrow, widget);
- QRect editRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
- SC_ComboBoxEditField, widget);
GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ?
GTK_SHADOW_IN : GTK_SHADOW_OUT;
@@ -1414,9 +1406,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
else if (option->state & State_MouseOver && comboBox->activeSubControls & SC_ComboBoxArrow)
buttonState = GTK_STATE_PRELIGHT;
- QRect buttonrect = QRect(gtkToggleButton->allocation.x, gtkToggleButton->allocation.y,
- gtkToggleButton->allocation.width, gtkToggleButton->allocation.height);
-
Q_ASSERT(gtkToggleButton);
gtkCachedPainter.paintBox( gtkToggleButton, "button", arrowButtonRect, buttonState,
shadow, gtkToggleButton->style, buttonPath.toString() +
@@ -1436,8 +1425,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
if (focus)
GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
- QHashableLatin1Literal buttonPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton")
- : QHashableLatin1Literal("GtkComboBox.GtkToggleButton");
// Draw the separator between label and arrows
QHashableLatin1Literal vSeparatorPath = comboBox->editable
@@ -1643,6 +1630,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
style = scrollbarWidget->style;
gboolean trough_under_steppers = true;
gboolean trough_side_details = false;
+ gboolean activate_slider = false;
gboolean stepper_size = 14;
gint trough_border = 1;
if (!d->gtk_check_version(2, 10, 0)) {
@@ -1650,6 +1638,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
"trough-border", &trough_border,
"trough-side-details", &trough_side_details,
"trough-under-steppers", &trough_under_steppers,
+ "activate-slider", &activate_slider,
"stepper-size", &stepper_size, NULL);
}
if (trough_under_steppers) {
@@ -1695,6 +1684,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
if (!(option->state & State_Enabled))
state = GTK_STATE_INSENSITIVE;
+ else if (activate_slider &&
+ option->state & State_Sunken && (scrollBar->activeSubControls & SC_ScrollBarSlider))
+ state = GTK_STATE_ACTIVE;
else if (option->state & State_MouseOver && (scrollBar->activeSubControls & SC_ScrollBarSlider))
state = GTK_STATE_PRELIGHT;
@@ -1932,14 +1924,11 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
- QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
bool horizontal = slider->orientation == Qt::Horizontal;
bool ticksAbove = slider->tickPosition & QSlider::TicksAbove;
bool ticksBelow = slider->tickPosition & QSlider::TicksBelow;
- QColor activeHighlight = option->palette.color(QPalette::Normal, QPalette::Highlight);
- QPixmap cache;
QBrush oldBrush = painter->brush();
QPen oldPen = painter->pen();
@@ -1948,6 +1937,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QColor highlightAlpha(Qt::white);
highlightAlpha.setAlpha(80);
+ QGtkStylePrivate::gtk_widget_set_direction(hScaleWidget, slider->upsideDown ?
+ GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
GtkWidget *scaleWidget = horizontal ? hScaleWidget : vScaleWidget;
style = scaleWidget->style;
@@ -1981,11 +1972,21 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QRect lowerGroove = grooveRect;
if (horizontal) {
- upperGroove.setLeft(handle.center().x());
- lowerGroove.setRight(handle.center().x());
+ if (slider->upsideDown) {
+ lowerGroove.setLeft(handle.center().x());
+ upperGroove.setRight(handle.center().x());
+ } else {
+ upperGroove.setLeft(handle.center().x());
+ lowerGroove.setRight(handle.center().x());
+ }
} else {
- upperGroove.setBottom(handle.center().y());
- lowerGroove.setTop(handle.center().y());
+ if (!slider->upsideDown) {
+ lowerGroove.setBottom(handle.center().y());
+ upperGroove.setTop(handle.center().y());
+ } else {
+ upperGroove.setBottom(handle.center().y());
+ lowerGroove.setTop(handle.center().y());
+ }
}
gtkPainter.paintBox( scaleWidget, "trough-upper", upperGroove, state,
@@ -2543,7 +2544,6 @@ void QGtkStyle::drawControl(ControlElement element,
d->gtkWidget("GtkMenu.GtkMenuItem");
style = gtkPainter.getStyle(gtkMenuItem);
- QColor borderColor = option->palette.background().color().darker(160);
QColor shadow = option->palette.dark().color();
if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
@@ -2768,8 +2768,6 @@ void QGtkStyle::drawControl(ControlElement element,
// Arrow
if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
- QPoint buttonShift(pixelMetric(PM_ButtonShiftHorizontal, option, widget),
- proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget));
QFontMetrics fm(menuitem->font);
int arrow_size = fm.ascent() + fm.descent() - 2 * gtkMenuItem->style->ythickness;
@@ -3116,7 +3114,6 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple
case CC_ComboBox:
if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
// We employ the gtk widget to position arrows and separators for us
- QString comboBoxPath = box->editable ? QLS("GtkComboBoxEntry") : QLS("GtkComboBox");
GtkWidget *gtkCombo = box->editable ? d->gtkWidget("GtkComboBoxEntry")
: d->gtkWidget("GtkComboBox");
d->gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 55aa6b0f3c..46de9efbd4 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -50,17 +50,17 @@
#include "qapplication.h"
#include <w32std.h>
-#include <AknsConstants.h>
+#include <aknsconstants.h>
#include <aknconsts.h>
-#include <AknsItemID.h>
-#include <AknsUtils.h>
-#include <AknsDrawUtils.h>
-#include <AknsSkinInstance.h>
-#include <AknsBasicBackgroundControlContext.h>
+#include <aknsitemid.h>
+#include <aknsutils.h>
+#include <aknsdrawutils.h>
+#include <aknsskininstance.h>
+#include <aknsbasicbackgroundcontrolcontext.h>
#include <avkon.mbg>
#include <aknfontaccess.h>
#include <aknlayoutfont.h>
-#include <AknUtils.h>
+#include <aknutils.h>
#include <aknnavi.h>
#include <gulicon.h>
#include <aknbitmapanimation.h>
diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp
index 296c51c05a..d09d7fa5cb 100644
--- a/src/gui/styles/qstylehelper.cpp
+++ b/src/gui/styles/qstylehelper.cpp
@@ -58,67 +58,23 @@
QT_BEGIN_NAMESPACE
-// internal helper. Converts an integer value to an unique string token
-template <typename T>
-struct HexString
-{
- inline HexString(const T t)
- : val(t)
- {}
-
- inline void write(QChar *&dest) const
- {
- const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
- const char *c = reinterpret_cast<const char *>(&val);
- for (uint i = 0; i < sizeof(T); ++i) {
- *dest++ = hexChars[*c & 0xf];
- *dest++ = hexChars[(*c & 0xf0) >> 4];
- ++c;
- }
- }
-
- const T val;
-};
-
-// specialization to enable fast concatenating of our string tokens to a string
-template <typename T>
-struct QConcatenable<HexString<T> >
-{
- typedef HexString<T> type;
- enum { ExactSize = true };
- static int size(const HexString<T> &str) { return sizeof(str.val) * 2; }
- static inline void appendTo(const HexString<T> &str, QChar *&out) { str.write(out); }
-};
-
namespace QStyleHelper {
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
{
const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
-
- QString tmp = key
- % QLatin1Char('-')
- % HexString<uint>(option->state)
- % QLatin1Char('-')
- % HexString<uint>(option->direction)
- % QLatin1Char('-')
- % HexString<uint>(complexOption ? uint(complexOption->activeSubControls) : 0u)
- % QLatin1Char('-')
- % HexString<quint64>(option->palette.cacheKey())
- % QLatin1Char('-')
- % HexString<uint>(size.width())
- % QLatin1Char('x')
- % HexString<uint>(size.height());
+ QString tmp = key % HexString<uint>(option->state)
+ % HexString<uint>(option->direction)
+ % HexString<uint>(complexOption ? uint(complexOption->activeSubControls) : 0u)
+ % HexString<quint64>(option->palette.cacheKey())
+ % HexString<uint>(size.width())
+ % HexString<uint>(size.height());
#ifndef QT_NO_SPINBOX
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- tmp = tmp
- % QLatin1Char('-')
- % HexString<uint>(spinBox->buttonSymbols)
- % QLatin1Char('-')
- % HexString<uint>(spinBox->stepEnabled)
- % QLatin1Char('-')
- % QLatin1Char(spinBox->frame ? '1' : '0');
+ tmp = tmp % HexString<uint>(spinBox->buttonSymbols)
+ % HexString<uint>(spinBox->stepEnabled)
+ % QLatin1Char(spinBox->frame ? '1' : '0'); ;
}
#endif // QT_NO_SPINBOX
return tmp;
diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h
index 31cc4ed1dd..71fce55214 100644
--- a/src/gui/styles/qstylehelper_p.h
+++ b/src/gui/styles/qstylehelper_p.h
@@ -41,7 +41,9 @@
#include <QtCore/qglobal.h>
#include <QtCore/qpoint.h>
+#include <QtCore/qstring.h>
#include <QtGui/qpolygon.h>
+#include <QtCore/qstringbuilder.h>
#ifndef QSTYLEHELPER_P_H
#define QSTYLEHELPER_P_H
@@ -79,6 +81,37 @@ namespace QStyleHelper
int bottom = 0);
}
+// internal helper. Converts an integer value to an unique string token
+template <typename T>
+ struct HexString
+{
+ inline HexString(const T t)
+ : val(t)
+ {}
+
+ inline void write(QChar *&dest) const
+ {
+ const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+ const char *c = reinterpret_cast<const char *>(&val);
+ for (uint i = 0; i < sizeof(T); ++i) {
+ *dest++ = hexChars[*c & 0xf];
+ *dest++ = hexChars[(*c & 0xf0) >> 4];
+ ++c;
+ }
+ }
+ const T val;
+};
+
+// specialization to enable fast concatenating of our string tokens to a string
+template <typename T>
+ struct QConcatenable<HexString<T> >
+{
+ typedef HexString<T> type;
+ enum { ExactSize = true };
+ static int size(const HexString<T> &str) { return sizeof(str.val) * 2; }
+ static inline void appendTo(const HexString<T> &str, QChar *&out) { str.write(out); }
+};
+
QT_END_NAMESPACE
#endif // QSTYLEHELPER_P_H
diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri
index 5084442f16..f920032102 100644
--- a/src/gui/styles/styles.pri
+++ b/src/gui/styles/styles.pri
@@ -170,7 +170,12 @@ contains( styles, s60 ):contains(QT_CONFIG, s60) {
SOURCES += styles/qs60style.cpp
symbian {
SOURCES += styles/qs60style_s60.cpp
- LIBS += -lAknIcon -lAKNSKINS -lAKNSKINSRV -lFontUtils -legul -lbmpanim
+ LIBS += -legul -lbmpanim
+ contains(CONFIG, is_using_gnupoc) {
+ LIBS += -laknicon -laknskins -laknskinsrv -lfontutils
+ } else {
+ LIBS += -lAknIcon -lAKNSKINS -lAKNSKINSRV -lFontUtils
+ }
} else {
SOURCES += styles/qs60style_simulated.cpp
RESOURCES += styles/qstyle_s60_simulated.qrc
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index afba6784c7..c7a9756a3c 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1947,7 +1947,7 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name)
#endif
// handle data: URLs
- if (r.isNull() && name.scheme() == QLatin1String("data"))
+ if (r.isNull() && name.scheme().compare(QLatin1String("data"), Qt::CaseInsensitive) == 0)
r = qDecodeDataUrl(name).second;
// if resource was not loaded try to load it here
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp
index 8e7ec80d6e..05fe7446b6 100644
--- a/src/gui/util/qcompleter.cpp
+++ b/src/gui/util/qcompleter.cpp
@@ -873,7 +873,7 @@ void QCompleterPrivate::showPopup(const QRect& rect)
const QRect screen = QApplication::desktop()->availableGeometry(widget);
Qt::LayoutDirection dir = widget->layoutDirection();
QPoint pos;
- int rw, rh, w;
+ int rh, w;
int h = (popup->sizeHintForRow(0) * qMin(maxVisibleItems, popup->model()->rowCount()) + 3) + 3;
QScrollBar *hsb = popup->horizontalScrollBar();
if (hsb && hsb->isVisible())
@@ -881,21 +881,30 @@ void QCompleterPrivate::showPopup(const QRect& rect)
if (rect.isValid()) {
rh = rect.height();
- w = rw = rect.width();
+ w = rect.width();
pos = widget->mapToGlobal(dir == Qt::RightToLeft ? rect.bottomRight() : rect.bottomLeft());
} else {
rh = widget->height();
- rw = widget->width();
pos = widget->mapToGlobal(QPoint(0, widget->height() - 2));
w = widget->width();
}
- if ((pos.x() + rw) > (screen.x() + screen.width()))
+ if (w > screen.width())
+ w = screen.width();
+ if ((pos.x() + w) > (screen.x() + screen.width()))
pos.setX(screen.x() + screen.width() - w);
if (pos.x() < screen.x())
pos.setX(screen.x());
- if (((pos.y() + rh) > (screen.y() + screen.height())) && ((pos.y() - h - rh) >= 0))
- pos.setY(pos.y() - qMax(h, popup->minimumHeight()) - rh + 2);
+
+ int top = pos.y() - rh - screen.top() + 2;
+ int bottom = screen.bottom() - pos.y();
+ h = qMax(h, popup->minimumHeight());
+ if (h > bottom) {
+ h = qMin(qMax(top, bottom), h);
+
+ if (top > bottom)
+ pos.setY(pos.y() - h - rh + 2);
+ }
popup->setGeometry(pos.x(), pos.y(), w, h);
diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/gui/util/qsystemtrayicon_mac.mm
index d943c8ca0e..8aaaa0fb64 100644
--- a/src/gui/util/qsystemtrayicon_mac.mm
+++ b/src/gui/util/qsystemtrayicon_mac.mm
@@ -75,8 +75,6 @@
#define QT_MAC_SYSTEMTRAY_USE_GROWL
-@class QNSMenu;
-
#include <private/qt_cocoa_helpers_mac_p.h>
#include <private/qsystemtrayicon_p.h>
#include <qtemporaryfile.h>
@@ -98,13 +96,14 @@ QT_END_NAMESPACE
QT_USE_NAMESPACE
-@class QNSImageView;
+@class QT_MANGLE_NAMESPACE(QNSMenu);
+@class QT_MANGLE_NAMESPACE(QNSImageView);
-@interface QNSStatusItem : NSObject {
+@interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject {
NSStatusItem *item;
QSystemTrayIcon *icon;
QSystemTrayIconPrivate *iconPrivate;
- QNSImageView *imageCell;
+ QT_MANGLE_NAMESPACE(QNSImageView) *imageCell;
}
-(id)initWithIcon:(QSystemTrayIcon*)icon iconPrivate:(QSystemTrayIconPrivate *)iprivate;
-(void)dealloc;
@@ -115,11 +114,11 @@ QT_USE_NAMESPACE
- (void)doubleClickSelector:(id)sender;
@end
-@interface QNSImageView : NSImageView {
+@interface QT_MANGLE_NAMESPACE(QNSImageView) : NSImageView {
BOOL down;
- QNSStatusItem *parent;
+ QT_MANGLE_NAMESPACE(QNSStatusItem) *parent;
}
--(id)initWithParent:(QNSStatusItem*)myParent;
+-(id)initWithParent:(QT_MANGLE_NAMESPACE(QNSStatusItem)*)myParent;
-(QSystemTrayIcon*)icon;
-(void)menuTrackingDone:(NSNotification*)notification;
-(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton;
@@ -134,7 +133,7 @@ QT_USE_NAMESPACE
#endif
-@interface QNSMenu : NSMenu <NSMenuDelegate> {
+@interface QT_MANGLE_NAMESPACE(QNSMenu) : NSMenu <NSMenuDelegate> {
QMenu *qmenu;
}
-(QMenu*)menu;
@@ -148,14 +147,14 @@ class QSystemTrayIconSys
public:
QSystemTrayIconSys(QSystemTrayIcon *icon, QSystemTrayIconPrivate *d) {
QMacCocoaAutoReleasePool pool;
- item = [[QNSStatusItem alloc] initWithIcon:icon iconPrivate:d];
+ item = [[QT_MANGLE_NAMESPACE(QNSStatusItem) alloc] initWithIcon:icon iconPrivate:d];
}
~QSystemTrayIconSys() {
QMacCocoaAutoReleasePool pool;
[[[item item] view] setHidden: YES];
[item release];
}
- QNSStatusItem *item;
+ QT_MANGLE_NAMESPACE(QNSStatusItem) *item;
};
void QSystemTrayIconPrivate::install_sys()
@@ -299,8 +298,8 @@ QT_END_NAMESPACE
@implementation NSStatusItem (Qt)
@end
-@implementation QNSImageView
--(id)initWithParent:(QNSStatusItem*)myParent {
+@implementation QT_MANGLE_NAMESPACE(QNSImageView)
+-(id)initWithParent:(QT_MANGLE_NAMESPACE(QNSStatusItem)*)myParent {
self = [super init];
parent = myParent;
down = NO;
@@ -400,7 +399,7 @@ QT_END_NAMESPACE
}
@end
-@implementation QNSStatusItem
+@implementation QT_MANGLE_NAMESPACE(QNSStatusItem)
-(id)initWithIcon:(QSystemTrayIcon*)i iconPrivate:(QSystemTrayIconPrivate *)iPrivate
{
@@ -409,7 +408,7 @@ QT_END_NAMESPACE
icon = i;
iconPrivate = iPrivate;
item = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain];
- imageCell = [[QNSImageView alloc] initWithParent:self];
+ imageCell = [[QT_MANGLE_NAMESPACE(QNSImageView) alloc] initWithParent:self];
[item setView: imageCell];
}
return self;
@@ -453,7 +452,7 @@ QT_END_NAMESPACE
[[[self item] view] removeAllToolTips];
iconPrivate->updateToolTip_sys();
#endif
- NSMenu *m = [[QNSMenu alloc] initWithQMenu:icon->contextMenu()];
+ NSMenu *m = [[QT_MANGLE_NAMESPACE(QNSMenu) alloc] initWithQMenu:icon->contextMenu()];
[m setAutoenablesItems: NO];
[[NSNotificationCenter defaultCenter] addObserver:imageCell
selector:@selector(menuTrackingDone:)
@@ -481,7 +480,7 @@ private:
QSystemTrayIconQMenu();
};
-@implementation QNSMenu
+@implementation QT_MANGLE_NAMESPACE(QNSMenu)
-(id)initWithQMenu:(QMenu*)qm {
self = [super init];
if(self) {
@@ -494,7 +493,7 @@ private:
return qmenu;
}
-(void)menuNeedsUpdate:(NSMenu*)nsmenu {
- QNSMenu *menu = static_cast<QNSMenu *>(nsmenu);
+ QT_MANGLE_NAMESPACE(QNSMenu) *menu = static_cast<QT_MANGLE_NAMESPACE(QNSMenu) *>(nsmenu);
emit static_cast<QSystemTrayIconQMenu*>(menu->qmenu)->doAboutToShow();
for(int i = [menu numberOfItems]-1; i >= 0; --i)
[menu removeItemAtIndex:i];
@@ -539,7 +538,7 @@ private:
[nsimage release];
}
if(action->menu()) {
- QNSMenu *sub = [[QNSMenu alloc] initWithQMenu:action->menu()];
+ QT_MANGLE_NAMESPACE(QNSMenu) *sub = [[QT_MANGLE_NAMESPACE(QNSMenu) alloc] initWithQMenu:action->menu()];
[item setSubmenu:sub];
} else {
[item setAction:@selector(selectedAction:)];
diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp
index 6a01d681c0..f38bae76ca 100644
--- a/src/gui/widgets/qabstractslider.cpp
+++ b/src/gui/widgets/qabstractslider.cpp
@@ -219,8 +219,12 @@ QAbstractSliderPrivate::QAbstractSliderPrivate()
#ifdef QT_KEYPAD_NAVIGATION
, isAutoRepeating(false)
, repeatMultiplier(1)
-#endif
{
+ firstRepeat.invalidate();
+#else
+{
+#endif
+
}
QAbstractSliderPrivate::~QAbstractSliderPrivate()
@@ -787,7 +791,7 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
}
}
- else if (!d->firstRepeat.isValid()) {
+ else if (d->firstRepeat.isValid()) {
d->firstRepeat.invalidate();
d->repeatMultiplier = 1;
}
diff --git a/src/gui/widgets/qcocoatoolbardelegate_mac.mm b/src/gui/widgets/qcocoatoolbardelegate_mac.mm
index b2a0e0c687..e68ee7c9fe 100644
--- a/src/gui/widgets/qcocoatoolbardelegate_mac.mm
+++ b/src/gui/widgets/qcocoatoolbardelegate_mac.mm
@@ -58,7 +58,7 @@ QT_FORWARD_DECLARE_CLASS(QMainWindowLayout);
QT_FORWARD_DECLARE_CLASS(QToolBar);
QT_FORWARD_DECLARE_CLASS(QCFString);
-@implementation QCocoaToolBarDelegate
+@implementation QT_MANGLE_NAMESPACE(QCocoaToolBarDelegate)
- (id)initWithMainWindowLayout:(QMainWindowLayout *)layout
{
diff --git a/src/gui/widgets/qcocoatoolbardelegate_mac_p.h b/src/gui/widgets/qcocoatoolbardelegate_mac_p.h
index 8e3d06f5c3..b4af54f2ec 100644
--- a/src/gui/widgets/qcocoatoolbardelegate_mac_p.h
+++ b/src/gui/widgets/qcocoatoolbardelegate_mac_p.h
@@ -61,7 +61,7 @@ QT_END_NAMESPACE
@class NSToolbarItem;
-@interface QCocoaToolBarDelegate : NSObject {
+@interface QT_MANGLE_NAMESPACE(QCocoaToolBarDelegate) : NSObject {
QT_PREPEND_NAMESPACE(QMainWindowLayout) *mainWindowLayout;
NSToolbarItem *toolbarItem;
}
diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp
index ae007107c6..11f0a94eb4 100644
--- a/src/gui/widgets/qdockwidget.cpp
+++ b/src/gui/widgets/qdockwidget.cpp
@@ -1269,8 +1269,11 @@ void QDockWidget::setFloating(bool floating)
QRect r = d->undockedGeometry;
d->setWindowState(floating, false, floating ? r : QRect());
+
if (floating && r.isNull()) {
- setAttribute(Qt::WA_Moved, false); //we want it at the default position
+ if (x() < 0 || y() < 0) //may happen if we have been hidden
+ move(QPoint());
+ setAttribute(Qt::WA_Moved, false); //we want it at the default position
}
}
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index 95270572cf..b8cef93456 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -410,7 +410,7 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar
macToolbar = [[NSToolbar alloc] initWithIdentifier:(NSString *)kQMainWindowMacToolbarID];
[macToolbar setDisplayMode:NSToolbarDisplayModeIconOnly];
[macToolbar setSizeMode:NSToolbarSizeModeRegular];
- [macToolbar setDelegate:[[QCocoaToolBarDelegate alloc] initWithMainWindowLayout:this]];
+ [macToolbar setDelegate:[[QT_MANGLE_NAMESPACE(QCocoaToolBarDelegate) alloc] initWithMainWindowLayout:this]];
[window setToolbar:macToolbar];
[macToolbar release];
}
diff --git a/src/imports/gestures/qdeclarativegesturearea.cpp b/src/imports/gestures/qdeclarativegesturearea.cpp
index 615c6741b8..19afe0ce4d 100644
--- a/src/imports/gestures/qdeclarativegesturearea.cpp
+++ b/src/imports/gestures/qdeclarativegesturearea.cpp
@@ -259,7 +259,7 @@ bool QDeclarativeGestureAreaPrivate::gestureEvent(QGestureEvent *event)
bool accept = true;
for (Bindings::Iterator it = bindings.begin(); it != bindings.end(); ++it) {
if ((gesture = event->gesture(it.key()))) {
- it.value()->value();
+ it.value()->evaluate();
event->setAccepted(true); // XXX only if value returns true?
}
}
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index ecde0cc01e..a9d600e7e6 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -1,6 +1,6 @@
TEMPLATE = subdirs
-SUBDIRS += widgets particles
+SUBDIRS += particles gestures
contains(QT_CONFIG, webkit): SUBDIRS += webkit
contains(QT_CONFIG, mediaservices): SUBDIRS += multimedia
diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp
index a163b10f0e..234b6df250 100644
--- a/src/imports/multimedia/qdeclarativeaudio.cpp
+++ b/src/imports/multimedia/qdeclarativeaudio.cpp
@@ -330,9 +330,14 @@ QDeclarativeAudio::Error QDeclarativeAudio::error() const
return Error(m_error);
}
+void QDeclarativeAudio::classBegin()
+{
+}
+
void QDeclarativeAudio::componentComplete()
{
- setObject(this);
+ if (m_playerControl == 0)
+ setObject(this);
}
diff --git a/src/imports/multimedia/qdeclarativeaudio_p.h b/src/imports/multimedia/qdeclarativeaudio_p.h
index 24276ea87d..e960b9dd16 100644
--- a/src/imports/multimedia/qdeclarativeaudio_p.h
+++ b/src/imports/multimedia/qdeclarativeaudio_p.h
@@ -115,6 +115,7 @@ public:
Status status() const;
Error error() const;
+ void classBegin();
void componentComplete();
public Q_SLOTS:
diff --git a/src/imports/webkit/qdeclarativewebview.cpp b/src/imports/webkit/qdeclarativewebview.cpp
index 5db812cf95..36a25f6949 100644
--- a/src/imports/webkit/qdeclarativewebview.cpp
+++ b/src/imports/webkit/qdeclarativewebview.cpp
@@ -42,11 +42,9 @@
#include "qdeclarativewebview_p.h"
#include "qdeclarativewebview_p_p.h"
-#include <private/qdeclarativepainteditem_p_p.h>
-
#include <qdeclarative.h>
#include <qdeclarativeengine.h>
-#include <private/qdeclarativestate_p.h>
+#include <qdeclarativecontext.h>
#include <QDebug>
#include <QPen>
@@ -61,29 +59,29 @@
#include <QtWebKit/QWebFrame>
#include <QtWebKit/QWebElement>
#include <QtWebKit/QWebSettings>
-#include <private/qlistmodelinterface_p.h>
QT_BEGIN_NAMESPACE
static const int MAX_DOUBLECLICK_TIME=500; // XXX need better gesture system
-class QDeclarativeWebViewPrivate : public QDeclarativePaintedItemPrivate
+class QDeclarativeWebViewPrivate
{
- Q_DECLARE_PUBLIC(QDeclarativeWebView)
-
public:
- QDeclarativeWebViewPrivate()
- : QDeclarativePaintedItemPrivate(), page(0), preferredwidth(0), preferredheight(0),
+ QDeclarativeWebViewPrivate(QDeclarativeWebView* qq)
+ : q(qq), page(0), preferredwidth(0), preferredheight(0),
progress(1.0), status(QDeclarativeWebView::Null), pending(PendingNone),
newWindowComponent(0), newWindowParent(0),
pressTime(400),
rendering(true)
{
+ QObject::connect(q, SIGNAL(focusChanged(bool)), q, SLOT(propagateFocusToWebPage(bool)));
}
- void focusChanged(bool);
+
+ QDeclarativeWebView *q;
QUrl url; // page url might be different if it has not loaded yet
QWebPage *page;
+ QGraphicsWebView* view;
int preferredwidth, preferredheight;
qreal progress;
@@ -101,7 +99,6 @@ public:
QPoint pressPoint;
int pressTime; // milliseconds before it's a "hold"
-
static void windowObjects_append(QDeclarativeListProperty<QObject> *prop, QObject *o) {
static_cast<QDeclarativeWebViewPrivate *>(prop->data)->windowObjects.append(o);
static_cast<QDeclarativeWebViewPrivate *>(prop->data)->updateWindowObjects();
@@ -129,6 +126,9 @@ public:
dynamically adjust to a size appropriate for the content.
This width may be large for typical online web pages.
+ If the width or height is explictly set, the rendered website
+ will be clipped, not scaled, to fit into the set dimensions.
+
If the preferredWidth is set, the width will be this amount or larger,
usually laying out the web content to fit the preferredWidth.
@@ -137,8 +137,8 @@ public:
WebView {
url: "http://www.nokia.com"
- width: 490
- height: 400
+ preferredWidth: 490
+ preferredHeight: 400
scale: 0.5
smooth: false
smoothCache: true
@@ -169,34 +169,39 @@ public:
*/
QDeclarativeWebView::QDeclarativeWebView(QDeclarativeItem *parent)
- : QDeclarativePaintedItem(*(new QDeclarativeWebViewPrivate), parent)
+ : QDeclarativeItem(parent)
{
init();
}
QDeclarativeWebView::~QDeclarativeWebView()
{
- Q_D(QDeclarativeWebView);
delete d->page;
+ delete d;
}
void QDeclarativeWebView::init()
{
- Q_D(QDeclarativeWebView);
+ d = new QDeclarativeWebViewPrivate(this);
QWebSettings::enablePersistentStorage();
setAcceptHoverEvents(true);
setAcceptedMouseButtons(Qt::LeftButton);
- setFlag(QGraphicsItem::ItemHasNoContents, false);
+ setFlag(QGraphicsItem::ItemHasNoContents, true);
+ setClip(true);
d->page = 0;
+ d->view = new QGraphicsWebView(this);
+ d->view->setResizesToContents(true);
+ d->view->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
+ connect(d->view, SIGNAL(geometryChanged()), this, SLOT(updateDeclarativeWebViewSize()));
+ connect(d->view, SIGNAL(scaleChanged()), this, SIGNAL(contentsScaleChanged()));
}
void QDeclarativeWebView::componentComplete()
{
- QDeclarativePaintedItem::componentComplete();
- Q_D(QDeclarativeWebView);
+ QDeclarativeItem::componentComplete();
switch (d->pending) {
case QDeclarativeWebViewPrivate::PendingUrl:
setUrl(d->pending_url);
@@ -216,7 +221,6 @@ void QDeclarativeWebView::componentComplete()
QDeclarativeWebView::Status QDeclarativeWebView::status() const
{
- Q_D(const QDeclarativeWebView);
return d->status;
}
@@ -230,13 +234,11 @@ QDeclarativeWebView::Status QDeclarativeWebView::status() const
*/
qreal QDeclarativeWebView::progress() const
{
- Q_D(const QDeclarativeWebView);
return d->progress;
}
void QDeclarativeWebView::doLoadStarted()
{
- Q_D(QDeclarativeWebView);
if (!d->url.isEmpty()) {
d->status = Loading;
@@ -247,7 +249,6 @@ void QDeclarativeWebView::doLoadStarted()
void QDeclarativeWebView::doLoadProgress(int p)
{
- Q_D(QDeclarativeWebView);
if (d->progress == p/100.0)
return;
d->progress = p/100.0;
@@ -256,12 +257,7 @@ void QDeclarativeWebView::doLoadProgress(int p)
void QDeclarativeWebView::pageUrlChanged()
{
- Q_D(QDeclarativeWebView);
-
- page()->setViewportSize(QSize(
- d->preferredwidth>0 ? d->preferredwidth : width(),
- d->preferredheight>0 ? d->preferredheight : height()));
- expandToWebPage();
+ updateContentsSize();
if ((d->url.isEmpty() && page()->mainFrame()->url() != QUrl(QLatin1String("about:blank")))
|| (d->url != page()->mainFrame()->url() && !page()->mainFrame()->url().isEmpty()))
@@ -275,7 +271,6 @@ void QDeclarativeWebView::pageUrlChanged()
void QDeclarativeWebView::doLoadFinished(bool ok)
{
- Q_D(QDeclarativeWebView);
if (title().isEmpty())
pageUrlChanged(); // XXX bug 232556 - pages with no title never get urlChanged()
@@ -302,21 +297,17 @@ void QDeclarativeWebView::doLoadFinished(bool ok)
*/
QUrl QDeclarativeWebView::url() const
{
- Q_D(const QDeclarativeWebView);
return d->url;
}
void QDeclarativeWebView::setUrl(const QUrl &url)
{
- Q_D(QDeclarativeWebView);
if (url == d->url)
return;
if (isComponentComplete()) {
d->url = url;
- page()->setViewportSize(QSize(
- d->preferredwidth>0 ? d->preferredwidth : width(),
- d->preferredheight>0 ? d->preferredheight : height()));
+ updateContentsSize();
QUrl seturl = url;
if (seturl.isEmpty())
seturl = QUrl(QLatin1String("about:blank"));
@@ -338,16 +329,14 @@ void QDeclarativeWebView::setUrl(const QUrl &url)
*/
int QDeclarativeWebView::preferredWidth() const
{
- Q_D(const QDeclarativeWebView);
return d->preferredwidth;
}
void QDeclarativeWebView::setPreferredWidth(int iw)
{
- Q_D(QDeclarativeWebView);
if (d->preferredwidth == iw) return;
d->preferredwidth = iw;
- //expandToWebPage();
+ updateContentsSize();
emit preferredWidthChanged();
}
@@ -358,14 +347,14 @@ void QDeclarativeWebView::setPreferredWidth(int iw)
*/
int QDeclarativeWebView::preferredHeight() const
{
- Q_D(const QDeclarativeWebView);
return d->preferredheight;
}
+
void QDeclarativeWebView::setPreferredHeight(int ih)
{
- Q_D(QDeclarativeWebView);
if (d->preferredheight == ih) return;
d->preferredheight = ih;
+ updateContentsSize();
emit preferredHeightChanged();
}
@@ -383,82 +372,86 @@ QVariant QDeclarativeWebView::evaluateJavaScript(const QString &scriptSource)
return this->page()->mainFrame()->evaluateJavaScript(scriptSource);
}
-void QDeclarativeWebViewPrivate::focusChanged(bool hasFocus)
+void QDeclarativeWebView::propagateFocusToWebPage(bool hasFocus)
{
- Q_Q(QDeclarativeWebView);
QFocusEvent e(hasFocus ? QEvent::FocusIn : QEvent::FocusOut);
- q->page()->event(&e);
- QDeclarativeItemPrivate::focusChanged(hasFocus);
+ page()->event(&e);
}
-void QDeclarativeWebView::initialLayout()
+void QDeclarativeWebView::updateDeclarativeWebViewSize()
{
- // nothing useful to do at this point
+ QSizeF size = d->view->geometry().size() * contentsScale();
+ setImplicitWidth(size.width());
+ setImplicitHeight(size.height());
}
-void QDeclarativeWebView::noteContentsSizeChanged(const QSize&)
+void QDeclarativeWebView::initialLayout()
{
- expandToWebPage();
+ // nothing useful to do at this point
}
-void QDeclarativeWebView::expandToWebPage()
+void QDeclarativeWebView::updateContentsSize()
{
- Q_D(QDeclarativeWebView);
- QSize cs = page()->mainFrame()->contentsSize();
- if (cs.width() < d->preferredwidth)
- cs.setWidth(d->preferredwidth);
- if (cs.height() < d->preferredheight)
- cs.setHeight(d->preferredheight);
- if (widthValid())
- cs.setWidth(width());
- if (heightValid())
- cs.setHeight(height());
- if (cs != page()->viewportSize()) {
- page()->setViewportSize(cs);
- }
- if (cs != contentsSize())
- setContentsSize(cs);
+ if (d->page)
+ d->page->setPreferredContentsSize(QSize(
+ d->preferredwidth>0 ? d->preferredwidth : width(),
+ d->preferredheight>0 ? d->preferredheight : height()));
}
void QDeclarativeWebView::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
{
- if (newGeometry.size() != oldGeometry.size())
- expandToWebPage();
- QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry);
-}
-
-void QDeclarativeWebView::paintPage(const QRect& r)
-{
- dirtyCache(r);
- update();
+ if (newGeometry.size() != oldGeometry.size() && d->page) {
+ QSize cs = d->page->preferredContentsSize();
+ if (widthValid())
+ cs.setWidth(width());
+ if (heightValid())
+ cs.setHeight(height());
+ if (cs != d->page->preferredContentsSize())
+ d->page->setPreferredContentsSize(cs);
+ }
+ QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
}
/*!
\qmlproperty list<object> WebView::javaScriptWindowObjects
- This property is a list of object that are available from within
- the webview's JavaScript context.
+ A list of QML objects to expose to the web page.
+
+ Each object will be added as a property of the web frame's window object. The
+ property name is controlled by the value of \c WebView.windowObjectName
+ attached property.
+
+ Exposing QML objects to a web page allows JavaScript executing in the web
+ page itself to communicate with QML, by reading and writing properties and
+ by calling methods of the exposed QML objects.
- The \a object will be inserted as a child of the frame's window
- object, under the name given by the attached property \c WebView.windowObjectName.
+ This example shows how to call into a QML method using a window object.
\qml
WebView {
- javaScriptWindowObjects: Object {
- WebView.windowObjectName: "coordinates"
+ javaScriptWindowObjects: QtObject {
+ WebView.windowObjectName: "qml"
+
+ function qmlCall() {
+ console.log("This call is in QML!");
+ }
}
+
+ html: "<script>console.log(\"This is in WebKit!\"); window.qml.qmlCall();</script>"
}
\endqml
- Properties of the object will be exposed as JavaScript properties and slots as
- JavaScript methods.
+ The output of the example will be:
+ \code
+ This is in WebKit!
+ This call is in QML!
+ \endcode
- If Javascript is not enabled for this page, then this property does nothing.
+ If Javascript is not enabled for the page, then this property does nothing.
*/
QDeclarativeListProperty<QObject> QDeclarativeWebView::javaScriptWindowObjects()
{
- Q_D(QDeclarativeWebView);
return QDeclarativeListProperty<QObject>(this, d, &QDeclarativeWebViewPrivate::windowObjects_append);
}
@@ -469,8 +462,7 @@ QDeclarativeWebViewAttached *QDeclarativeWebView::qmlAttachedProperties(QObject
void QDeclarativeWebViewPrivate::updateWindowObjects()
{
- Q_Q(QDeclarativeWebView);
- if (!q->isComponentComplete() || !page)
+ if (!q->isComponentCompletePublic() || !page)
return;
for (int ii = 0; ii < windowObjects.count(); ++ii) {
@@ -484,29 +476,17 @@ void QDeclarativeWebViewPrivate::updateWindowObjects()
bool QDeclarativeWebView::renderingEnabled() const
{
- Q_D(const QDeclarativeWebView);
return d->rendering;
}
void QDeclarativeWebView::setRenderingEnabled(bool enabled)
{
- Q_D(QDeclarativeWebView);
if (d->rendering == enabled)
return;
d->rendering = enabled;
emit renderingEnabledChanged();
- setCacheFrozen(!enabled);
- if (enabled)
- clearCache();
-}
-
-
-void QDeclarativeWebView::drawContents(QPainter *p, const QRect &r)
-{
- Q_D(QDeclarativeWebView);
- if (d->rendering)
- page()->mainFrame()->render(p,r);
+ d->view->setTiledBackingStoreFrozen(!enabled);
}
QMouseEvent *QDeclarativeWebView::sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e)
@@ -541,7 +521,6 @@ QMouseEvent *QDeclarativeWebView::sceneHoverMoveEventToMouseEvent(QGraphicsScene
return me;
}
-
/*!
\qmlsignal WebView::onDoubleClick(clickx,clicky)
@@ -573,7 +552,6 @@ void QDeclarativeWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
*/
bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom)
{
- Q_D(QDeclarativeWebView);
if (contentsScale() >= maxzoom/zoomFactor())
return false;
qreal ozf = contentsScale();
@@ -602,13 +580,11 @@ bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom)
*/
int QDeclarativeWebView::pressGrabTime() const
{
- Q_D(const QDeclarativeWebView);
return d->pressTime;
}
void QDeclarativeWebView::setPressGrabTime(int ms)
{
- Q_D(QDeclarativeWebView);
if (d->pressTime == ms)
return;
d->pressTime = ms;
@@ -617,8 +593,6 @@ void QDeclarativeWebView::setPressGrabTime(int ms)
void QDeclarativeWebView::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QDeclarativeWebView);
-
setFocus (true);
QMouseEvent *me = sceneMouseEventToMouseEvent(event);
@@ -646,14 +620,12 @@ void QDeclarativeWebView::mousePressEvent(QGraphicsSceneMouseEvent *event)
);
delete me;
if (!event->isAccepted()) {
- QDeclarativePaintedItem::mousePressEvent(event);
+ QDeclarativeItem::mousePressEvent(event);
}
}
void QDeclarativeWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QDeclarativeWebView);
-
QMouseEvent *me = sceneMouseEventToMouseEvent(event);
page()->event(me);
d->pressTimer.stop();
@@ -670,7 +642,7 @@ void QDeclarativeWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
);
delete me;
if (!event->isAccepted()) {
- QDeclarativePaintedItem::mouseReleaseEvent(event);
+ QDeclarativeItem::mouseReleaseEvent(event);
}
setKeepMouseGrab(false);
ungrabMouse();
@@ -678,7 +650,6 @@ void QDeclarativeWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void QDeclarativeWebView::timerEvent(QTimerEvent *event)
{
- Q_D(QDeclarativeWebView);
if (event->timerId() == d->pressTimer.timerId()) {
d->pressTimer.stop();
grabMouse();
@@ -688,8 +659,6 @@ void QDeclarativeWebView::timerEvent(QTimerEvent *event)
void QDeclarativeWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
- Q_D(QDeclarativeWebView);
-
QMouseEvent *me = sceneMouseEventToMouseEvent(event);
if (d->pressTimer.isActive()) {
if ((me->pos() - d->pressPoint).manhattanLength() > QApplication::startDragDistance()) {
@@ -713,9 +682,9 @@ void QDeclarativeWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
delete me;
if (!event->isAccepted())
- QDeclarativePaintedItem::mouseMoveEvent(event);
-
+ QDeclarativeItem::mouseMoveEvent(event);
}
+
void QDeclarativeWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event)
{
QMouseEvent *me = sceneHoverMoveEventToMouseEvent(event);
@@ -729,21 +698,7 @@ void QDeclarativeWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event)
);
delete me;
if (!event->isAccepted())
- QDeclarativePaintedItem::hoverMoveEvent(event);
-}
-
-void QDeclarativeWebView::keyPressEvent(QKeyEvent* event)
-{
- page()->event(event);
- if (!event->isAccepted())
- QDeclarativePaintedItem::keyPressEvent(event);
-}
-
-void QDeclarativeWebView::keyReleaseEvent(QKeyEvent* event)
-{
- page()->event(event);
- if (!event->isAccepted())
- QDeclarativePaintedItem::keyReleaseEvent(event);
+ QDeclarativeItem::hoverMoveEvent(event);
}
bool QDeclarativeWebView::sceneEvent(QEvent *event)
@@ -758,7 +713,7 @@ bool QDeclarativeWebView::sceneEvent(QEvent *event)
}
}
}
- return QDeclarativePaintedItem::sceneEvent(event);
+ return QDeclarativeItem::sceneEvent(event);
}
@@ -827,15 +782,11 @@ QPixmap QDeclarativeWebView::icon() const
*/
void QDeclarativeWebView::setZoomFactor(qreal factor)
{
- Q_D(QDeclarativeWebView);
if (factor == page()->mainFrame()->zoomFactor())
return;
page()->mainFrame()->setZoomFactor(factor);
- page()->setViewportSize(QSize(
- d->preferredwidth>0 ? d->preferredwidth*factor : width()*factor,
- d->preferredheight>0 ? d->preferredheight*factor : height()*factor));
- expandToWebPage();
+ updateContentsSize();
emit zoomFactorChanged();
}
@@ -853,37 +804,27 @@ qreal QDeclarativeWebView::zoomFactor() const
*/
void QDeclarativeWebView::setStatusText(const QString& s)
{
- Q_D(QDeclarativeWebView);
d->statusText = s;
emit statusTextChanged();
}
void QDeclarativeWebView::windowObjectCleared()
{
- Q_D(QDeclarativeWebView);
d->updateWindowObjects();
}
QString QDeclarativeWebView::statusText() const
{
- Q_D(const QDeclarativeWebView);
return d->statusText;
}
QWebPage *QDeclarativeWebView::page() const
{
- Q_D(const QDeclarativeWebView);
if (!d->page) {
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.
- QPalette pal = QApplication::palette();
- pal.setBrush(QPalette::Base, QColor::fromRgbF(0, 0, 0, 0));
- wp->setPalette(pal);
-
wp->setNetworkAccessManager(qmlEngine(this)->networkAccessManager());
self->setPage(wp);
@@ -939,14 +880,12 @@ QWebPage *QDeclarativeWebView::page() const
*/
QDeclarativeWebSettings *QDeclarativeWebView::settingsObject() const
{
- Q_D(const QDeclarativeWebView);
d->settings.s = page()->settings();
return &d->settings;
}
void QDeclarativeWebView::setPage(QWebPage *page)
{
- Q_D(QDeclarativeWebView);
if (d->page == page)
return;
if (d->page) {
@@ -957,18 +896,15 @@ void QDeclarativeWebView::setPage(QWebPage *page)
}
}
d->page = page;
- d->page->setViewportSize(QSize(
- d->preferredwidth>0 ? d->preferredwidth : width(),
- d->preferredheight>0 ? d->preferredheight : height()));
+ updateContentsSize();
d->page->mainFrame()->setScrollBarPolicy(Qt::Horizontal,Qt::ScrollBarAlwaysOff);
d->page->mainFrame()->setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff);
- connect(d->page,SIGNAL(repaintRequested(QRect)),this,SLOT(paintPage(QRect)));
connect(d->page->mainFrame(),SIGNAL(urlChanged(QUrl)),this,SLOT(pageUrlChanged()));
connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(iconChanged()));
connect(d->page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged()));
- connect(d->page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(noteContentsSizeChanged(QSize)));
connect(d->page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout()));
+ connect(d->page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SIGNAL(contentsSizeChanged(QSize)));
connect(d->page,SIGNAL(loadStarted()),this,SLOT(doLoadStarted()));
connect(d->page,SIGNAL(loadProgress(int)),this,SLOT(doLoadProgress(int)));
@@ -976,6 +912,10 @@ void QDeclarativeWebView::setPage(QWebPage *page)
connect(d->page,SIGNAL(statusBarMessage(QString)),this,SLOT(setStatusText(QString)));
connect(d->page->mainFrame(),SIGNAL(javaScriptWindowObjectCleared()),this,SLOT(windowObjectCleared()));
+
+ d->page->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true);
+
+ d->view->setPage(page);
}
/*!
@@ -1030,10 +970,7 @@ QString QDeclarativeWebView::html() const
*/
void QDeclarativeWebView::setHtml(const QString &html, const QUrl &baseUrl)
{
- Q_D(QDeclarativeWebView);
- page()->setViewportSize(QSize(
- d->preferredwidth>0 ? d->preferredwidth : width(),
- d->preferredheight>0 ? d->preferredheight : height()));
+ updateContentsSize();
if (isComponentComplete())
page()->mainFrame()->setHtml(html, baseUrl);
else {
@@ -1046,10 +983,7 @@ void QDeclarativeWebView::setHtml(const QString &html, const QUrl &baseUrl)
void QDeclarativeWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl)
{
- Q_D(QDeclarativeWebView);
- page()->setViewportSize(QSize(
- d->preferredwidth>0 ? d->preferredwidth : width(),
- d->preferredheight>0 ? d->preferredheight : height()));
+ updateContentsSize();
if (isComponentComplete())
page()->mainFrame()->setContent(data,mimeType,qmlContext(this)->resolvedUrl(baseUrl));
@@ -1073,7 +1007,6 @@ QWebSettings *QDeclarativeWebView::settings() const
QDeclarativeWebView *QDeclarativeWebView::createWindow(QWebPage::WebWindowType type)
{
- Q_D(QDeclarativeWebView);
switch (type) {
case QWebPage::WebBrowserWindow: {
if (!d->newWindowComponent && d->newWindowParent)
@@ -1127,13 +1060,11 @@ QDeclarativeWebView *QDeclarativeWebView::createWindow(QWebPage::WebWindowType t
*/
QDeclarativeComponent *QDeclarativeWebView::newWindowComponent() const
{
- Q_D(const QDeclarativeWebView);
return d->newWindowComponent;
}
void QDeclarativeWebView::setNewWindowComponent(QDeclarativeComponent *newWindow)
{
- Q_D(QDeclarativeWebView);
if (newWindow == d->newWindowComponent)
return;
d->newWindowComponent = newWindow;
@@ -1150,13 +1081,11 @@ void QDeclarativeWebView::setNewWindowComponent(QDeclarativeComponent *newWindow
*/
QDeclarativeItem *QDeclarativeWebView::newWindowParent() const
{
- Q_D(const QDeclarativeWebView);
return d->newWindowParent;
}
void QDeclarativeWebView::setNewWindowParent(QDeclarativeItem *parent)
{
- Q_D(QDeclarativeWebView);
if (parent == d->newWindowParent)
return;
if (d->newWindowParent && parent) {
@@ -1169,6 +1098,25 @@ void QDeclarativeWebView::setNewWindowParent(QDeclarativeItem *parent)
emit newWindowParentChanged();
}
+QSize QDeclarativeWebView::contentsSize() const
+{
+ return d->page->mainFrame()->contentsSize() * contentsScale();
+}
+
+qreal QDeclarativeWebView::contentsScale() const
+{
+ return d->view->scale();
+}
+
+void QDeclarativeWebView::setContentsScale(qreal scale)
+{
+ if (scale == d->view->scale())
+ return;
+ d->view->setScale(scale);
+ updateDeclarativeWebViewSize();
+ emit contentsScaleChanged();
+}
+
/*!
Returns the area of the largest element at position (\a x,\a y) that is no larger
than \a maxwidth by \a maxheight pixels.
@@ -1265,3 +1213,4 @@ QWebPage *QDeclarativeWebPage::createWindow(WebWindowType type)
}
QT_END_NAMESPACE
+
diff --git a/src/imports/webkit/qdeclarativewebview_p.h b/src/imports/webkit/qdeclarativewebview_p.h
index 81581d83d5..87bd938044 100644
--- a/src/imports/webkit/qdeclarativewebview_p.h
+++ b/src/imports/webkit/qdeclarativewebview_p.h
@@ -42,12 +42,13 @@
#ifndef QDECLARATIVEWEBVIEW_H
#define QDECLARATIVEWEBVIEW_H
-#include <private/qdeclarativepainteditem_p.h>
+#include <qdeclarativeitem.h>
#include <QtGui/QAction>
#include <QtCore/QUrl>
#include <QtNetwork/qnetworkaccessmanager.h>
#include <QtWebKit/QWebPage>
+#include <QtWebKit/QGraphicsWebView>
QT_BEGIN_HEADER
@@ -61,6 +62,7 @@ class QDeclarativeWebSettings;
class QDeclarativeWebViewPrivate;
class QNetworkRequest;
class QDeclarativeWebView;
+class QDeclarativeWebViewPrivate;
class QDeclarativeWebPage : public QWebPage
{
@@ -85,7 +87,7 @@ class QDeclarativeWebViewAttached;
//### TODO: browser plugins
-class QDeclarativeWebView : public QDeclarativePaintedItem
+class QDeclarativeWebView : public QDeclarativeItem
{
Q_OBJECT
@@ -120,6 +122,9 @@ class QDeclarativeWebView : public QDeclarativePaintedItem
Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged)
+ Q_PROPERTY(QSize contentsSize READ contentsSize NOTIFY contentsSizeChanged)
+ Q_PROPERTY(qreal contentsScale READ contentsScale WRITE setContentsScale NOTIFY contentsScaleChanged)
+
public:
QDeclarativeWebView(QDeclarativeItem *parent=0);
~QDeclarativeWebView();
@@ -182,6 +187,13 @@ public:
QDeclarativeItem *newWindowParent() const;
void setNewWindowParent(QDeclarativeItem *newWindow);
+ bool isComponentCompletePublic() const { return isComponentComplete(); }
+
+ QSize contentsSize() const;
+
+ void setContentsScale(qreal scale);
+ qreal contentsScale() const;
+
Q_SIGNALS:
void preferredWidthChanged();
void preferredHeightChanged();
@@ -197,6 +209,8 @@ Q_SIGNALS:
void newWindowComponentChanged();
void newWindowParentChanged();
void renderingEnabledChanged();
+ void contentsSizeChanged(const QSize&);
+ void contentsScaleChanged();
void loadStarted();
void loadFinished();
@@ -212,38 +226,36 @@ public Q_SLOTS:
QVariant evaluateJavaScript(const QString&);
private Q_SLOTS:
- void expandToWebPage();
- void paintPage(const QRect&);
void doLoadStarted();
void doLoadProgress(int p);
void doLoadFinished(bool ok);
void setStatusText(const QString&);
void windowObjectCleared();
void pageUrlChanged();
- void noteContentsSizeChanged(const QSize&);
void initialLayout();
-protected:
- void drawContents(QPainter *, const QRect &);
+ void propagateFocusToWebPage(bool);
+ void updateDeclarativeWebViewSize();
+
+protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
void timerEvent(QTimerEvent *event);
void hoverMoveEvent (QGraphicsSceneHoverEvent * event);
- void keyPressEvent(QKeyEvent* event);
- void keyReleaseEvent(QKeyEvent* event);
virtual void geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry);
virtual bool sceneEvent(QEvent *event);
QDeclarativeWebView *createWindow(QWebPage::WebWindowType type);
private:
+ void updateContentsSize();
void init();
virtual void componentComplete();
Q_DISABLE_COPY(QDeclarativeWebView)
- Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeWebView)
+ QDeclarativeWebViewPrivate* d;
QMouseEvent *sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *);
QMouseEvent *sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *);
friend class QDeclarativeWebPage;
diff --git a/src/imports/widgets/graphicslayouts.cpp b/src/imports/widgets/graphicslayouts.cpp
deleted file mode 100644
index 25cf994b3f..0000000000
--- a/src/imports/widgets/graphicslayouts.cpp
+++ /dev/null
@@ -1,366 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "graphicslayouts_p.h"
-
-#include <QtGui/qgraphicswidget.h>
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-LinearLayoutAttached::LinearLayoutAttached(QObject *parent)
-: QObject(parent), _stretch(1), _alignment(Qt::AlignCenter), _spacing(0)
-{
-}
-
-void LinearLayoutAttached::setStretchFactor(int f)
-{
- if (_stretch == f)
- return;
-
- _stretch = f;
- emit stretchChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _stretch);
-}
-
-void LinearLayoutAttached::setSpacing(int s)
-{
- if (_spacing == s)
- return;
-
- _spacing = s;
- emit spacingChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _spacing);
-}
-
-void LinearLayoutAttached::setAlignment(Qt::Alignment a)
-{
- if (_alignment == a)
- return;
-
- _alignment = a;
- emit alignmentChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _alignment);
-}
-
-QGraphicsLinearLayoutStretchItemObject::QGraphicsLinearLayoutStretchItemObject(QObject *parent)
- : QObject(parent)
-{
-}
-
-QSizeF QGraphicsLinearLayoutStretchItemObject::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
-Q_UNUSED(which);
-Q_UNUSED(constraint);
-return QSizeF();
-}
-
-
-QGraphicsLinearLayoutObject::QGraphicsLinearLayoutObject(QObject *parent)
-: QObject(parent)
-{
-}
-
-QGraphicsLinearLayoutObject::~QGraphicsLinearLayoutObject()
-{
-}
-
-void QGraphicsLinearLayoutObject::insertLayoutItem(int index, QGraphicsLayoutItem *item)
-{
-insertItem(index, item);
-
-//connect attached properties
-if (LinearLayoutAttached *obj = attachedProperties.value(item)) {
- setStretchFactor(item, obj->stretchFactor());
- setAlignment(item, obj->alignment());
- updateSpacing(item, obj->spacing());
- QObject::connect(obj, SIGNAL(stretchChanged(QGraphicsLayoutItem*,int)),
- this, SLOT(updateStretch(QGraphicsLayoutItem*,int)));
- QObject::connect(obj, SIGNAL(alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment)),
- this, SLOT(updateAlignment(QGraphicsLayoutItem*,Qt::Alignment)));
- QObject::connect(obj, SIGNAL(spacingChanged(QGraphicsLayoutItem*,int)),
- this, SLOT(updateSpacing(QGraphicsLayoutItem*,int)));
- //### need to disconnect when widget is removed?
-}
-}
-
-//### is there a better way to do this?
-void QGraphicsLinearLayoutObject::clearChildren()
-{
-for (int i = 0; i < count(); ++i)
- removeAt(i);
-}
-
-qreal QGraphicsLinearLayoutObject::contentsMargin() const
-{
- qreal a,b,c,d;
- getContentsMargins(&a, &b, &c, &d);
- if(a==b && a==c && a==d)
- return a;
- return -1;
-}
-
-void QGraphicsLinearLayoutObject::setContentsMargin(qreal m)
-{
- setContentsMargins(m,m,m,m);
-}
-
-void QGraphicsLinearLayoutObject::updateStretch(QGraphicsLayoutItem *item, int stretch)
-{
-QGraphicsLinearLayout::setStretchFactor(item, stretch);
-}
-
-void QGraphicsLinearLayoutObject::updateSpacing(QGraphicsLayoutItem* item, int spacing)
-{
- for(int i=0; i < count(); i++){
- if(itemAt(i) == item){ //I do not see the reverse function, which is why we must loop over all items
- QGraphicsLinearLayout::setItemSpacing(i, spacing);
- return;
- }
- }
-}
-
-void QGraphicsLinearLayoutObject::updateAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment)
-{
-QGraphicsLinearLayout::setAlignment(item, alignment);
-}
-
-QHash<QGraphicsLayoutItem*, LinearLayoutAttached*> QGraphicsLinearLayoutObject::attachedProperties;
-LinearLayoutAttached *QGraphicsLinearLayoutObject::qmlAttachedProperties(QObject *obj)
-{
-// ### This is not allowed - you must attach to any object
-if (!qobject_cast<QGraphicsLayoutItem*>(obj))
- return 0;
-LinearLayoutAttached *rv = new LinearLayoutAttached(obj);
-attachedProperties.insert(qobject_cast<QGraphicsLayoutItem*>(obj), rv);
-return rv;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////
-// QGraphicsGridLayout-related classes
-//////////////////////////////////////////////////////////////////////////////////////////////////////
-GridLayoutAttached::GridLayoutAttached(QObject *parent)
-: QObject(parent), _row(-1), _column(-1), _rowspan(1), _colspan(1), _alignment(-1), _rowstretch(-1),
- _colstretch(-1), _rowspacing(-1), _colspacing(-1), _rowprefheight(-1), _rowmaxheight(-1), _rowminheight(-1),
- _rowfixheight(-1), _colprefwidth(-1), _colmaxwidth(-1), _colminwidth(-1), _colfixwidth(-1)
-{
-}
-
-void GridLayoutAttached::setRow(int r)
-{
- if (_row == r)
- return;
-
- _row = r;
- //emit rowChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _row);
-}
-
-void GridLayoutAttached::setColumn(int c)
-{
- if (_column == c)
- return;
-
- _column = c;
- //emit columnChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _column);
-}
-
-void GridLayoutAttached::setRowSpan(int rs)
-{
- if (_rowspan == rs)
- return;
-
- _rowspan = rs;
- //emit rowSpanChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _rowSpan);
-}
-
-void GridLayoutAttached::setColumnSpan(int cs)
-{
- if (_colspan == cs)
- return;
-
- _colspan = cs;
- //emit columnSpanChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _columnSpan);
-}
-
-void GridLayoutAttached::setAlignment(Qt::Alignment a)
-{
- if (_alignment == a)
- return;
-
- _alignment = a;
- emit alignmentChanged(reinterpret_cast<QGraphicsLayoutItem*>(parent()), _alignment);
-}
-
-void GridLayoutAttached::setRowStretchFactor(int f)
-{
- _rowstretch = f;
-}
-
-void GridLayoutAttached::setColumnStretchFactor(int f)
-{
- _colstretch = f;
-}
-
-void GridLayoutAttached::setRowSpacing(int s)
-{
- _rowspacing = s;
-}
-
-void GridLayoutAttached::setColumnSpacing(int s)
-{
- _colspacing = s;
-}
-
-
-QGraphicsGridLayoutObject::QGraphicsGridLayoutObject(QObject *parent)
-: QObject(parent)
-{
-}
-
-QGraphicsGridLayoutObject::~QGraphicsGridLayoutObject()
-{
-}
-
-void QGraphicsGridLayoutObject::addWidget(QGraphicsWidget *wid)
-{
-//use attached properties
-if (QObject *obj = attachedProperties.value(qobject_cast<QGraphicsLayoutItem*>(wid))) {
- int row = static_cast<GridLayoutAttached *>(obj)->row();
- int column = static_cast<GridLayoutAttached *>(obj)->column();
- int rowSpan = static_cast<GridLayoutAttached *>(obj)->rowSpan();
- int columnSpan = static_cast<GridLayoutAttached *>(obj)->columnSpan();
- if (row == -1 || column == -1) {
- qWarning() << "Must set row and column for an item in a grid layout";
- return;
- }
- addItem(wid, row, column, rowSpan, columnSpan);
-}
-}
-
-void QGraphicsGridLayoutObject::addLayoutItem(QGraphicsLayoutItem *item)
-{
-//use attached properties
-if (GridLayoutAttached *obj = attachedProperties.value(item)) {
- int row = obj->row();
- int column = obj->column();
- int rowSpan = obj->rowSpan();
- int columnSpan = obj->columnSpan();
- Qt::Alignment alignment = obj->alignment();
- if (row == -1 || column == -1) {
- qWarning() << "Must set row and column for an item in a grid layout";
- return;
- }
- if(obj->rowSpacing() != -1)
- setRowSpacing(row, obj->rowSpacing());
- if(obj->columnSpacing() != -1)
- setColumnSpacing(column, obj->columnSpacing());
- if(obj->rowStretchFactor() != -1)
- setRowStretchFactor(row, obj->rowStretchFactor());
- if(obj->columnStretchFactor() != -1)
- setColumnStretchFactor(column, obj->columnStretchFactor());
- if(obj->rowPreferredHeight() != -1)
- setRowPreferredHeight(row, obj->rowPreferredHeight());
- if(obj->rowMaximumHeight() != -1)
- setRowMaximumHeight(row, obj->rowMaximumHeight());
- if(obj->rowMinimumHeight() != -1)
- setRowMinimumHeight(row, obj->rowMinimumHeight());
- if(obj->rowFixedHeight() != -1)
- setRowFixedHeight(row, obj->rowFixedHeight());
- if(obj->columnPreferredWidth() != -1)
- setColumnPreferredWidth(row, obj->columnPreferredWidth());
- if(obj->columnMaximumWidth() != -1)
- setColumnMaximumWidth(row, obj->columnMaximumWidth());
- if(obj->columnMinimumWidth() != -1)
- setColumnMinimumWidth(row, obj->columnMinimumWidth());
- if(obj->columnFixedWidth() != -1)
- setColumnFixedWidth(row, obj->columnFixedWidth());
- addItem(item, row, column, rowSpan, columnSpan);
- if (alignment != -1)
- setAlignment(item,alignment);
- QObject::connect(obj, SIGNAL(alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment)),
- this, SLOT(updateAlignment(QGraphicsLayoutItem*,Qt::Alignment)));
- //### need to disconnect when widget is removed?
-}
-}
-
-//### is there a better way to do this?
-void QGraphicsGridLayoutObject::clearChildren()
-{
-for (int i = 0; i < count(); ++i)
- removeAt(i);
-}
-
-qreal QGraphicsGridLayoutObject::spacing() const
-{
-if (verticalSpacing() == horizontalSpacing())
- return verticalSpacing();
-return -1; //###
-}
-
-qreal QGraphicsGridLayoutObject::contentsMargin() const
-{
- qreal a,b,c,d;
- getContentsMargins(&a, &b, &c, &d);
- if(a==b && a==c && a==d)
- return a;
- return -1;
-}
-
-void QGraphicsGridLayoutObject::setContentsMargin(qreal m)
-{
- setContentsMargins(m,m,m,m);
-}
-
-
-void QGraphicsGridLayoutObject::updateAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment)
-{
-QGraphicsGridLayout::setAlignment(item, alignment);
-}
-
-QHash<QGraphicsLayoutItem*, GridLayoutAttached*> QGraphicsGridLayoutObject::attachedProperties;
-GridLayoutAttached *QGraphicsGridLayoutObject::qmlAttachedProperties(QObject *obj)
-{
-// ### This is not allowed - you must attach to any object
-if (!qobject_cast<QGraphicsLayoutItem*>(obj))
- return 0;
-GridLayoutAttached *rv = new GridLayoutAttached(obj);
-attachedProperties.insert(qobject_cast<QGraphicsLayoutItem*>(obj), rv);
-return rv;
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/widgets/graphicslayouts_p.h b/src/imports/widgets/graphicslayouts_p.h
deleted file mode 100644
index ea9c614bcf..0000000000
--- a/src/imports/widgets/graphicslayouts_p.h
+++ /dev/null
@@ -1,303 +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 GRAPHICSLAYOUTS_H
-#define GRAPHICSLAYOUTS_H
-
-#include <QtGui/QGraphicsLinearLayout>
-#include <QtGui/QGraphicsGridLayout>
-#include <qdeclarative.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QGraphicsLinearLayoutStretchItemObject : public QObject, public QGraphicsLayoutItem
-{
- Q_OBJECT
- Q_INTERFACES(QGraphicsLayoutItem)
-public:
- QGraphicsLinearLayoutStretchItemObject(QObject *parent = 0);
-
- virtual QSizeF sizeHint(Qt::SizeHint, const QSizeF &) const;
-};
-
-class LinearLayoutAttached;
-class QGraphicsLinearLayoutObject : public QObject, public QGraphicsLinearLayout
-{
- Q_OBJECT
- Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem)
-
- Q_PROPERTY(QDeclarativeListProperty<QGraphicsLayoutItem> children READ children)
- Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
- Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing)
- Q_PROPERTY(qreal contentsMargin READ contentsMargin WRITE setContentsMargin)
- Q_CLASSINFO("DefaultProperty", "children")
-public:
- QGraphicsLinearLayoutObject(QObject * = 0);
- ~QGraphicsLinearLayoutObject();
-
- QDeclarativeListProperty<QGraphicsLayoutItem> children() { return QDeclarativeListProperty<QGraphicsLayoutItem>(this, 0, children_append, children_count, children_at, children_clear); }
-
- static LinearLayoutAttached *qmlAttachedProperties(QObject *);
-
- qreal contentsMargin() const;
- void setContentsMargin(qreal);
-
-private Q_SLOTS:
- void updateStretch(QGraphicsLayoutItem*,int);
- void updateSpacing(QGraphicsLayoutItem*,int);
- void updateAlignment(QGraphicsLayoutItem*,Qt::Alignment);
-
-private:
- friend class LinearLayoutAttached;
- void clearChildren();
- void insertLayoutItem(int, QGraphicsLayoutItem *);
- static QHash<QGraphicsLayoutItem*, LinearLayoutAttached*> attachedProperties;
-
- static void children_append(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, QGraphicsLayoutItem *item) {
- static_cast<QGraphicsLinearLayoutObject*>(prop->object)->insertLayoutItem(-1, item);
- }
-
- static void children_clear(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
- static_cast<QGraphicsLinearLayoutObject*>(prop->object)->clearChildren();
- }
-
- static int children_count(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
- return static_cast<QGraphicsLinearLayoutObject*>(prop->object)->count();
- }
-
- static QGraphicsLayoutItem *children_at(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, int index) {
- return static_cast<QGraphicsLinearLayoutObject*>(prop->object)->itemAt(index);
- }
-};
-
-class GridLayoutAttached;
-class QGraphicsGridLayoutObject : public QObject, public QGraphicsGridLayout
-{
- Q_OBJECT
- Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem)
-
- Q_PROPERTY(QDeclarativeListProperty<QGraphicsLayoutItem> children READ children)
- Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing)
- Q_PROPERTY(qreal contentsMargin READ contentsMargin WRITE setContentsMargin)
- Q_PROPERTY(qreal verticalSpacing READ verticalSpacing WRITE setVerticalSpacing)
- Q_PROPERTY(qreal horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing)
- Q_CLASSINFO("DefaultProperty", "children")
-public:
- QGraphicsGridLayoutObject(QObject * = 0);
- ~QGraphicsGridLayoutObject();
-
- QDeclarativeListProperty<QGraphicsLayoutItem> children() { return QDeclarativeListProperty<QGraphicsLayoutItem>(this, 0, children_append, children_count, children_at, children_clear); }
-
- qreal spacing() const;
- qreal contentsMargin() const;
- void setContentsMargin(qreal);
-
- static GridLayoutAttached *qmlAttachedProperties(QObject *);
-
-private Q_SLOTS:
- void updateAlignment(QGraphicsLayoutItem*,Qt::Alignment);
-
-private:
- friend class GraphicsLayoutAttached;
- void addWidget(QGraphicsWidget *);
- void clearChildren();
- void addLayoutItem(QGraphicsLayoutItem *);
- static QHash<QGraphicsLayoutItem*, GridLayoutAttached*> attachedProperties;
-
- static void children_append(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, QGraphicsLayoutItem *item) {
- static_cast<QGraphicsGridLayoutObject*>(prop->object)->addLayoutItem(item);
- }
-
- static void children_clear(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
- static_cast<QGraphicsGridLayoutObject*>(prop->object)->clearChildren();
- }
-
- static int children_count(QDeclarativeListProperty<QGraphicsLayoutItem> *prop) {
- return static_cast<QGraphicsGridLayoutObject*>(prop->object)->count();
- }
-
- static QGraphicsLayoutItem *children_at(QDeclarativeListProperty<QGraphicsLayoutItem> *prop, int index) {
- return static_cast<QGraphicsGridLayoutObject*>(prop->object)->itemAt(index);
- }
-};
-
-class LinearLayoutAttached : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(int stretchFactor READ stretchFactor WRITE setStretchFactor NOTIFY stretchChanged)
- Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
- Q_PROPERTY(int spacing READ spacing WRITE setSpacing NOTIFY spacingChanged)
-public:
- LinearLayoutAttached(QObject *parent);
-
- int stretchFactor() const { return _stretch; }
- void setStretchFactor(int f);
- Qt::Alignment alignment() const { return _alignment; }
- void setAlignment(Qt::Alignment a);
- int spacing() const { return _spacing; }
- void setSpacing(int s);
-
-Q_SIGNALS:
- void stretchChanged(QGraphicsLayoutItem*,int);
- void alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment);
- void spacingChanged(QGraphicsLayoutItem*,int);
-
-private:
- int _stretch;
- Qt::Alignment _alignment;
- int _spacing;
-};
-
-class GridLayoutAttached : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(int row READ row WRITE setRow)
- Q_PROPERTY(int column READ column WRITE setColumn)
- Q_PROPERTY(int rowSpan READ rowSpan WRITE setRowSpan)
- Q_PROPERTY(int columnSpan READ columnSpan WRITE setColumnSpan)
- Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
- Q_PROPERTY(int rowStretchFactor READ rowStretchFactor WRITE setRowStretchFactor)
- Q_PROPERTY(int columnStretchFactor READ columnStretchFactor WRITE setColumnStretchFactor)
- Q_PROPERTY(int rowSpacing READ rowSpacing WRITE setRowSpacing)
- Q_PROPERTY(int columnSpacing READ columnSpacing WRITE setColumnSpacing)
- Q_PROPERTY(int rowPreferredHeight READ rowPreferredHeight WRITE setRowPreferredHeight)
- Q_PROPERTY(int rowMinimumHeight READ rowMinimumHeight WRITE setRowMinimumHeight)
- Q_PROPERTY(int rowMaximumHeight READ rowMaximumHeight WRITE setRowMaximumHeight)
- Q_PROPERTY(int rowFixedHeight READ rowFixedHeight WRITE setRowFixedHeight)
- Q_PROPERTY(int columnPreferredWidth READ columnPreferredWidth WRITE setColumnPreferredWidth)
- Q_PROPERTY(int columnMaximumWidth READ columnMaximumWidth WRITE setColumnMaximumWidth)
- Q_PROPERTY(int columnMinimumWidth READ columnMinimumWidth WRITE setColumnMinimumWidth)
- Q_PROPERTY(int columnFixedWidth READ columnFixedWidth WRITE setColumnFixedWidth)
-
-public:
- GridLayoutAttached(QObject *parent);
-
- int row() const { return _row; }
- void setRow(int r);
-
- int column() const { return _column; }
- void setColumn(int c);
-
- int rowSpan() const { return _rowspan; }
- void setRowSpan(int rs);
-
- int columnSpan() const { return _colspan; }
- void setColumnSpan(int cs);
-
- Qt::Alignment alignment() const { return _alignment; }
- void setAlignment(Qt::Alignment a);
-
- int rowStretchFactor() const { return _rowstretch; }
- void setRowStretchFactor(int f);
- int columnStretchFactor() const { return _colstretch; }
- void setColumnStretchFactor(int f);
-
- int rowSpacing() const { return _rowspacing; }
- void setRowSpacing(int s);
- int columnSpacing() const { return _colspacing; }
- void setColumnSpacing(int s);
-
- int rowPreferredHeight() const { return _rowprefheight; }
- void setRowPreferredHeight(int s) { _rowprefheight = s; }
-
- int rowMaximumHeight() const { return _rowmaxheight; }
- void setRowMaximumHeight(int s) { _rowmaxheight = s; }
-
- int rowMinimumHeight() const { return _rowminheight; }
- void setRowMinimumHeight(int s) { _rowminheight = s; }
-
- int rowFixedHeight() const { return _rowfixheight; }
- void setRowFixedHeight(int s) { _rowfixheight = s; }
-
- int columnPreferredWidth() const { return _colprefwidth; }
- void setColumnPreferredWidth(int s) { _colprefwidth = s; }
-
- int columnMaximumWidth() const { return _colmaxwidth; }
- void setColumnMaximumWidth(int s) { _colmaxwidth = s; }
-
- int columnMinimumWidth() const { return _colminwidth; }
- void setColumnMinimumWidth(int s) { _colminwidth = s; }
-
- int columnFixedWidth() const { return _colfixwidth; }
- void setColumnFixedWidth(int s) { _colfixwidth = s; }
-
-Q_SIGNALS:
- void alignmentChanged(QGraphicsLayoutItem*,Qt::Alignment);
-
-private:
- int _row;
- int _column;
- int _rowspan;
- int _colspan;
- Qt::Alignment _alignment;
- int _rowstretch;
- int _colstretch;
- int _rowspacing;
- int _colspacing;
- int _rowprefheight;
- int _rowmaxheight;
- int _rowminheight;
- int _rowfixheight;
- int _colprefwidth;
- int _colmaxwidth;
- int _colminwidth;
- int _colfixwidth;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_INTERFACE(QGraphicsLayoutItem)
-QML_DECLARE_INTERFACE(QGraphicsLayout)
-QML_DECLARE_TYPE(QGraphicsLinearLayoutStretchItemObject)
-QML_DECLARE_TYPE(QGraphicsLinearLayoutObject)
-QML_DECLARE_TYPEINFO(QGraphicsLinearLayoutObject, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(QGraphicsGridLayoutObject)
-QML_DECLARE_TYPEINFO(QGraphicsGridLayoutObject, QML_HAS_ATTACHED_PROPERTIES)
-
-QT_END_HEADER
-
-#endif // GRAPHICSLAYOUTS_H
diff --git a/src/imports/widgets/qmldir b/src/imports/widgets/qmldir
deleted file mode 100644
index 6f19878671..0000000000
--- a/src/imports/widgets/qmldir
+++ /dev/null
@@ -1 +0,0 @@
-plugin widgets
diff --git a/src/imports/widgets/widgets.cpp b/src/imports/widgets/widgets.cpp
deleted file mode 100644
index 20de1fe921..0000000000
--- a/src/imports/widgets/widgets.cpp
+++ /dev/null
@@ -1,71 +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 plugins 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 <QtDeclarative/qdeclarativeextensionplugin.h>
-#include <QtDeclarative/qdeclarative.h>
-#include <QGraphicsWidget>
-
-#include "graphicslayouts_p.h"
-#include <private/qdeclarativegraphicswidget_p.h>
-QT_BEGIN_NAMESPACE
-
-class QWidgetsQmlModule : public QDeclarativeExtensionPlugin
-{
- Q_OBJECT
-public:
- virtual void registerTypes(const char *uri)
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.widgets"));
-
- qmlRegisterInterface<QGraphicsLayoutItem>("QGraphicsLayoutItem");
- qmlRegisterInterface<QGraphicsLayout>("QGraphicsLayout");
- qmlRegisterType<QGraphicsLinearLayoutStretchItemObject>(uri,4,7,"QGraphicsLinearLayoutStretchItem");
- qmlRegisterType<QGraphicsLinearLayoutObject>(uri,4,7,"QGraphicsLinearLayout");
- qmlRegisterType<QGraphicsGridLayoutObject>(uri,4,7,"QGraphicsGridLayout");
- }
-};
-
-QT_END_NAMESPACE
-
-#include "widgets.moc"
-
-Q_EXPORT_PLUGIN2(qtwidgetsqmlmodule, QT_PREPEND_NAMESPACE(QWidgetsQmlModule));
-
diff --git a/src/imports/widgets/widgets.pro b/src/imports/widgets/widgets.pro
deleted file mode 100644
index 234ff1e0a7..0000000000
--- a/src/imports/widgets/widgets.pro
+++ /dev/null
@@ -1,30 +0,0 @@
-TARGET = widgets
-TARGETPATH = Qt/widgets
-include(../qimportbase.pri)
-
-QT += declarative
-
-SOURCES += \
- graphicslayouts.cpp \
- widgets.cpp
-
-HEADERS += \
- graphicslayouts_p.h
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH
-target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
-
-qmldir.files += $$PWD/qmldir
-qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
-
-symbian:{
- load(data_caging_paths)
- include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
-
- importFiles.sources = widgets.dll qmldir
- importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
-
- DEPLOYMENT = importFiles
-}
-
-INSTALLS += target qmldir
diff --git a/src/multimedia/mediaservices/mediaservices.pro b/src/multimedia/mediaservices/mediaservices.pro
index d5b0e4c3c1..8a065f4471 100644
--- a/src/multimedia/mediaservices/mediaservices.pro
+++ b/src/multimedia/mediaservices/mediaservices.pro
@@ -2,6 +2,8 @@ TARGET = QtMediaServices
QPRO_PWD = $$PWD
QT = core gui multimedia
+contains(QT_CONFIG, opengl): QT += opengl
+
DEFINES += QT_BUILD_MEDIASERVICES_LIB QT_NO_USING_NAMESPACE
unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtMultimedia
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 559124f42e..31c64f09ab 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -343,9 +343,16 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket
copyCredentials(i, auth, isProxy);
QMetaObject::invokeMethod(q, "_q_restartAuthPendingRequests", Qt::QueuedConnection);
}
+ } else if (priv->phase == QAuthenticatorPrivate::Start) {
+ // If the url's authenticator has a 'user' set we will end up here (phase is only set to 'Done' by
+ // parseHttpResponse above if 'user' is empty). So if credentials were supplied with the request,
+ // such as in the case of an XMLHttpRequest, this is our only opportunity to cache them.
+ emit q->cacheCredentials(reply->request(), auth, q);
}
- // changing values in QAuthenticator will reset the 'phase'
- if (priv->phase == QAuthenticatorPrivate::Done) {
+ // - Changing values in QAuthenticator will reset the 'phase'.
+ // - If withCredentials has been set to false (e.g. by QtWebKit for a cross-origin XMLHttpRequest) then
+ // we need to bail out if authentication is required.
+ if (priv->phase == QAuthenticatorPrivate::Done || !reply->request().withCredentials()) {
// authentication is cancelled, send the current contents to the user.
emit channels[i].reply->headerChanged();
emit channels[i].reply->readyRead();
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index b5bd300bbd..51666d613a 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -133,6 +133,8 @@ Q_SIGNALS:
#endif
void authenticationRequired(const QHttpNetworkRequest &request, QAuthenticator *authenticator,
const QHttpNetworkConnection *connection = 0);
+ void cacheCredentials(const QHttpNetworkRequest &request, QAuthenticator *authenticator,
+ const QHttpNetworkConnection *connection = 0);
void error(QNetworkReply::NetworkError errorCode, const QString &detail = QString());
private:
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 3b7bc9eb16..d24eb1fc6d 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -173,7 +173,7 @@ bool QHttpNetworkConnectionChannel::sendRequest()
pendingEncrypt = false;
// if the url contains authentication parameters, use the new ones
// both channels will use the new authentication parameters
- if (!request.url().userInfo().isEmpty()) {
+ if (!request.url().userInfo().isEmpty() && request.withCredentials()) {
QUrl url = request.url();
QAuthenticator &auth = authenticator;
if (url.userName() != auth.user()
@@ -187,7 +187,10 @@ bool QHttpNetworkConnectionChannel::sendRequest()
url.setUserInfo(QString());
request.setUrl(url);
}
- connection->d_func()->createAuthorization(socket, request);
+ // Will only be false if QtWebKit is performing a cross-origin XMLHttpRequest
+ // and withCredentials has not been set to true.
+ if (request.withCredentials())
+ connection->d_func()->createAuthorization(socket, request);
#ifndef QT_NO_NETWORKPROXY
QByteArray header = QHttpNetworkRequestPrivate::header(request,
(connection->d_func()->networkProxy.type() != QNetworkProxy::NoProxy));
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index 9eb2399b25..639025e7ff 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op,
QHttpNetworkRequest::Priority pri, const QUrl &newUrl)
: QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0),
- autoDecompress(false), pipeliningAllowed(false)
+ autoDecompress(false), pipeliningAllowed(false), withCredentials(true)
{
}
@@ -62,6 +62,7 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequest
autoDecompress = other.autoDecompress;
pipeliningAllowed = other.pipeliningAllowed;
customVerb = other.customVerb;
+ withCredentials = other.withCredentials;
}
QHttpNetworkRequestPrivate::~QHttpNetworkRequestPrivate()
@@ -274,6 +275,16 @@ void QHttpNetworkRequest::setPipeliningAllowed(bool b)
d->pipeliningAllowed = b;
}
+bool QHttpNetworkRequest::withCredentials() const
+{
+ return d->withCredentials;
+}
+
+void QHttpNetworkRequest::setWithCredentials(bool b)
+{
+ d->withCredentials = b;
+}
+
void QHttpNetworkRequest::setUploadByteDevice(QNonContiguousByteDevice *bd)
{
d->uploadByteDevice = bd;
diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h
index 1b35a84642..15cab73e8f 100644
--- a/src/network/access/qhttpnetworkrequest_p.h
+++ b/src/network/access/qhttpnetworkrequest_p.h
@@ -113,6 +113,9 @@ public:
bool isPipeliningAllowed() const;
void setPipeliningAllowed(bool b);
+ bool withCredentials() const;
+ void setWithCredentials(bool b);
+
void setUploadByteDevice(QNonContiguousByteDevice *bd);
QNonContiguousByteDevice* uploadByteDevice() const;
@@ -142,6 +145,7 @@ public:
mutable QNonContiguousByteDevice* uploadByteDevice;
bool autoDecompress;
bool pipeliningAllowed;
+ bool withCredentials;
};
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp
index f188bd569c..2a02c99ea7 100644
--- a/src/network/access/qnetworkaccessbackend.cpp
+++ b/src/network/access/qnetworkaccessbackend.cpp
@@ -327,6 +327,11 @@ void QNetworkAccessBackend::authenticationRequired(QAuthenticator *authenticator
manager->authenticationRequired(this, authenticator);
}
+void QNetworkAccessBackend::cacheCredentials(QAuthenticator *authenticator)
+{
+ manager->addCredentials(this->reply->url, authenticator);
+}
+
void QNetworkAccessBackend::metaDataChanged()
{
reply->metaDataChanged();
diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h
index 4ce37a6af3..4fe6de6669 100644
--- a/src/network/access/qnetworkaccessbackend_p.h
+++ b/src/network/access/qnetworkaccessbackend_p.h
@@ -188,6 +188,7 @@ protected slots:
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth);
#endif
void authenticationRequired(QAuthenticator *auth);
+ void cacheCredentials(QAuthenticator *auth);
void metaDataChanged();
void redirectionRequested(const QUrl &destination);
void sslErrors(const QList<QSslError> &errors);
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp
index 3154ed618c..a6c5c02bfb 100644
--- a/src/network/access/qnetworkaccesshttpbackend.cpp
+++ b/src/network/access/qnetworkaccesshttpbackend.cpp
@@ -346,6 +346,8 @@ void QNetworkAccessHttpBackend::setupConnection()
#endif
connect(http, SIGNAL(authenticationRequired(QHttpNetworkRequest,QAuthenticator*)),
SLOT(httpAuthenticationRequired(QHttpNetworkRequest,QAuthenticator*)));
+ connect(http, SIGNAL(cacheCredentials(QHttpNetworkRequest,QAuthenticator*)),
+ SLOT(httpCacheCredentials(QHttpNetworkRequest,QAuthenticator*)));
connect(http, SIGNAL(error(QNetworkReply::NetworkError,QString)),
SLOT(httpError(QNetworkReply::NetworkError,QString)));
#ifndef QT_NO_OPENSSL
@@ -578,6 +580,11 @@ void QNetworkAccessHttpBackend::postRequest()
if (request().attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool() == true)
httpRequest.setPipeliningAllowed(true);
+ if (static_cast<QNetworkRequest::LoadControl>
+ (request().attribute(QNetworkRequest::AuthenticationReuseAttribute,
+ QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual)
+ httpRequest.setWithCredentials(false);
+
httpReply = http->sendRequest(httpRequest);
httpReply->setParent(this);
#ifndef QT_NO_OPENSSL
@@ -861,6 +868,12 @@ void QNetworkAccessHttpBackend::httpAuthenticationRequired(const QHttpNetworkReq
authenticationRequired(auth);
}
+void QNetworkAccessHttpBackend::httpCacheCredentials(const QHttpNetworkRequest &,
+ QAuthenticator *auth)
+{
+ cacheCredentials(auth);
+}
+
void QNetworkAccessHttpBackend::httpError(QNetworkReply::NetworkError errorCode,
const QString &errorString)
{
diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h
index e5cc0ab281..254907fd0b 100644
--- a/src/network/access/qnetworkaccesshttpbackend_p.h
+++ b/src/network/access/qnetworkaccesshttpbackend_p.h
@@ -107,6 +107,7 @@ private slots:
void replyFinished();
void replyHeaderChanged();
void httpAuthenticationRequired(const QHttpNetworkRequest &request, QAuthenticator *auth);
+ void httpCacheCredentials(const QHttpNetworkRequest &request, QAuthenticator *auth);
void httpError(QNetworkReply::NetworkError error, const QString &errorString);
bool sendCacheContents(const QNetworkCacheMetaData &metaData);
void finished(); // override
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index feb9d999c0..1c7661d5c9 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -948,10 +948,15 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
// but the data that is outgoing is random-access
request.setHeader(QNetworkRequest::ContentLengthHeader, outgoingData->size());
}
- if (d->cookieJar) {
- QList<QNetworkCookie> cookies = d->cookieJar->cookiesForUrl(request.url());
- if (!cookies.isEmpty())
- request.setHeader(QNetworkRequest::CookieHeader, qVariantFromValue(cookies));
+
+ if (static_cast<QNetworkRequest::LoadControl>
+ (request.attribute(QNetworkRequest::CookieLoadControlAttribute,
+ QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Automatic) {
+ if (d->cookieJar) {
+ QList<QNetworkCookie> cookies = d->cookieJar->cookiesForUrl(request.url());
+ if (!cookies.isEmpty())
+ request.setHeader(QNetworkRequest::CookieHeader, qVariantFromValue(cookies));
+ }
}
// first step: create the reply
@@ -967,11 +972,15 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
priv->manager = this;
// second step: fetch cached credentials
- QNetworkAuthenticationCredential *cred = d->fetchCachedCredentials(url);
- if (cred) {
- url.setUserName(cred->user);
- url.setPassword(cred->password);
- priv->urlForLastAuthentication = url;
+ if (static_cast<QNetworkRequest::LoadControl>
+ (request.attribute(QNetworkRequest::AuthenticationReuseAttribute,
+ QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Automatic) {
+ QNetworkAuthenticationCredential *cred = d->fetchCachedCredentials(url);
+ if (cred) {
+ url.setUserName(cred->user);
+ url.setPassword(cred->password);
+ priv->urlForLastAuthentication = url;
+ }
}
// third step: find a backend
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 128d18f15a..31ee2a4b8f 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -673,8 +673,12 @@ void QNetworkReplyImplPrivate::error(QNetworkReplyImpl::NetworkError code, const
void QNetworkReplyImplPrivate::metaDataChanged()
{
Q_Q(QNetworkReplyImpl);
- // do we have cookies?
- if (cookedHeaders.contains(QNetworkRequest::SetCookieHeader) && !manager.isNull()) {
+ // 1. do we have cookies?
+ // 2. are we allowed to set them?
+ if (cookedHeaders.contains(QNetworkRequest::SetCookieHeader) && !manager.isNull()
+ && (static_cast<QNetworkRequest::LoadControl>
+ (request.attribute(QNetworkRequest::CookieSaveControlAttribute,
+ QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Automatic)) {
QList<QNetworkCookie> cookies =
qvariant_cast<QList<QNetworkCookie> >(cookedHeaders.value(QNetworkRequest::SetCookieHeader));
QNetworkCookieJar *jar = manager->cookieJar();
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 61c116def2..911eadcab0 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -190,6 +190,46 @@ QT_BEGIN_NAMESPACE
of other verbs than GET, POST, PUT and DELETE). This verb is set
when calling QNetworkAccessManager::sendCustomRequest().
+ \value CookieLoadControlAttribute
+ Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic)
+ Indicates whether to send 'Cookie' headers in the request.
+
+ This attribute is set to false by QtWebKit when creating a cross-origin
+ XMLHttpRequest where withCredentials has not been set explicitly to true by the
+ Javascript that created the request.
+
+ See http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information.
+
+ \since 4.7
+
+ \value CookieSaveControlAttribute
+ Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic)
+ Indicates whether to save 'Cookie' headers received from the server in reply
+ to the request.
+
+ This attribute is set to false by QtWebKit when creating a cross-origin
+ XMLHttpRequest where withCredentials has not been set explicitly to true by the
+ Javascript that created the request.
+
+ See http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information.
+
+ \since 4.7
+
+ \value AuthenticationReuseControlAttribute
+ Requests only, type: QVariant::Int (default: QNetworkRequest::Automatic)
+ Indicates whether to use cached authorization credentials in the request,
+ if available. If this is set to QNetworkRequest::Manual and the authentication
+ mechanism is 'Basic' or 'Digest', Qt will not send an an 'Authorization' HTTP
+ header with any cached credentials it may have for the request's URL.
+
+ This attribute is set to QNetworkRequest::Manual by QtWebKit when creating a cross-origin
+ XMLHttpRequest where withCredentials has not been set explicitly to true by the
+ Javascript that created the request.
+
+ See http://www.w3.org/TR/XMLHttpRequest2/#credentials-flag for more information.
+
+ \since 4.7
+
\value User
Special type. Additional information can be passed in
QVariants with types ranging from User to UserMax. The default
@@ -222,6 +262,18 @@ QT_BEGIN_NAMESPACE
if the item was not cached (i.e., off-line mode)
*/
+/*!
+ \enum QNetworkRequest::LoadControl
+ \since 4.7
+
+ Indicates if an aspect of the request's loading mechanism has been
+ manually overridden, e.g. by QtWebKit.
+
+ \value Automatic default value: indicates default behaviour.
+
+ \value Manual indicates behaviour has been manually overridden.
+*/
+
class QNetworkRequestPrivate: public QSharedData, public QNetworkHeadersPrivate
{
public:
diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h
index a0ef1a61ae..d2945c40e6 100644
--- a/src/network/access/qnetworkrequest.h
+++ b/src/network/access/qnetworkrequest.h
@@ -79,6 +79,9 @@ public:
HttpPipeliningAllowedAttribute,
HttpPipeliningWasUsedAttribute,
CustomVerbAttribute,
+ CookieLoadControlAttribute,
+ AuthenticationReuseAttribute,
+ CookieSaveControlAttribute,
User = 1000,
UserMax = 32767
@@ -89,6 +92,10 @@ public:
PreferCache,
AlwaysCache
};
+ enum LoadControl {
+ Automatic = 0,
+ Manual
+ };
enum Priority {
HighPriority = 1,
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp
index f287630e4b..28a6c846bc 100644
--- a/src/network/kernel/qhostinfo.cpp
+++ b/src/network/kernel/qhostinfo.cpp
@@ -471,6 +471,18 @@ void QHostInfoRunnable::run()
hostInfo.setLookupId(id);
resultEmitter.emitResultsReady(hostInfo);
+ // now also iterate through the postponed ones
+ QMutableListIterator<QHostInfoRunnable*> iterator(manager->postponedLookups);
+ while (iterator.hasNext()) {
+ QHostInfoRunnable* postponed = iterator.next();
+ if (toBeLookedUp == postponed->toBeLookedUp) {
+ // we can now emit
+ iterator.remove();
+ hostInfo.setLookupId(postponed->id);
+ postponed->resultEmitter.emitResultsReady(hostInfo);
+ }
+ }
+
manager->lookupFinished(this);
// thread goes back to QThreadPool
@@ -596,6 +608,23 @@ void QHostInfoLookupManager::abortLookup(int id)
return;
QMutexLocker locker(&this->mutex);
+
+ // is postponed? delete and return
+ for (int i = 0; i < postponedLookups.length(); i++) {
+ if (postponedLookups.at(i)->id == id) {
+ delete postponedLookups.takeAt(i);
+ return;
+ }
+ }
+
+ // is scheduled? delete and return
+ for (int i = 0; i < scheduledLookups.length(); i++) {
+ if (scheduledLookups.at(i)->id == id) {
+ delete scheduledLookups.takeAt(i);
+ return;
+ }
+ }
+
if (!abortedLookups.contains(id))
abortedLookups.append(id);
}
diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h
index e11766bf15..85d14c295b 100644
--- a/src/network/kernel/qhostinfo_p.h
+++ b/src/network/kernel/qhostinfo_p.h
@@ -84,7 +84,7 @@ public Q_SLOTS:
}
Q_SIGNALS:
- void resultsReady(const QHostInfo info);
+ void resultsReady(const QHostInfo &info);
};
// needs to be QObject because fromName calls tr()
@@ -173,6 +173,8 @@ public:
bool wasAborted(int id);
QHostInfoCache cache;
+
+ friend class QHostInfoRunnable;
protected:
QList<QHostInfoRunnable*> currentLookups; // in progress
QList<QHostInfoRunnable*> postponedLookups; // postponed because in progress for same host
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index d1553570af..70bb0da426 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -425,6 +425,9 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16
case EBADF:
case EFAULT:
case ENOTSOCK:
+#ifdef Q_OS_SYMBIAN
+ case EPIPE:
+#endif
socketState = QAbstractSocket::UnconnectedState;
default:
break;
diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp
index 932126d984..55f926d3f9 100644
--- a/src/network/socket/qtcpserver.cpp
+++ b/src/network/socket/qtcpserver.cpp
@@ -562,7 +562,7 @@ QTcpSocket *QTcpServer::nextPendingConnection()
to the other thread and create the QTcpSocket object there and
use its setSocketDescriptor() method.
- \sa newConnection(), nextPendingConnection()
+ \sa newConnection(), nextPendingConnection(), addPendingConnection()
*/
void QTcpServer::incomingConnection(int socketDescriptor)
{
@@ -572,6 +572,22 @@ void QTcpServer::incomingConnection(int socketDescriptor)
QTcpSocket *socket = new QTcpSocket(this);
socket->setSocketDescriptor(socketDescriptor);
+ addPendingConnection(socket);
+}
+
+/*!
+ This function is called by QTcpServer::incomingConnection()
+ to add a socket to the list of pending incoming connections.
+
+ \note Don't forget to call this member from reimplemented
+ incomingConnection() if you do not want to break the
+ Pending Connections mechanism.
+
+ \sa incomingConnection()
+ \since 4.7
+*/
+void QTcpServer::addPendingConnection(QTcpSocket* socket)
+{
d_func()->pendingConnections.append(socket);
}
diff --git a/src/network/socket/qtcpserver.h b/src/network/socket/qtcpserver.h
index 7aebffe725..b206678354 100644
--- a/src/network/socket/qtcpserver.h
+++ b/src/network/socket/qtcpserver.h
@@ -93,6 +93,7 @@ public:
protected:
virtual void incomingConnection(int handle);
+ void addPendingConnection(QTcpSocket* socket);
Q_SIGNALS:
void newConnection();
diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h
index adc69ee2ff..46029b9aea 100644
--- a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h
+++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h
@@ -100,8 +100,10 @@ class QGL2PEXVertexArray
{
public:
QGL2PEXVertexArray() :
+ vertexArray(0), vertexArrayStops(0),
maxX(-2e10), maxY(-2e10), minX(2e10), minY(2e10),
- boundingRectDirty(true) {}
+ boundingRectDirty(true)
+ { }
inline void addRect(const QRectF &rect)
{
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 6ba0c42ce8..0a046dc38d 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -177,6 +177,7 @@ public:
ctx(0),
useSystemClip(true),
elementIndicesVBOId(0),
+ opacityArray(0),
snapToPixelGrid(false),
addOffset(false),
nativePaintingActive(false),
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
index 452d37df43..410cf21321 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
@@ -57,21 +57,13 @@ QGLTextureGlyphCache::QGLTextureGlyphCache(QGLContext *context, QFontEngineGlyph
, ctx(context)
, m_width(0)
, m_height(0)
- , m_broken_fbo_readback(false)
{
// broken FBO readback is a bug in the SGX 1.3 and 1.4 drivers for the N900 where
// copying between FBO's is broken if the texture is either GL_ALPHA or POT. The
// workaround is to use a system-memory copy of the glyph cache for this device.
// Switching to NPOT and GL_RGBA would both cost a lot more graphics memory and
// be slower, so that is not desireable.
-#if defined QT_OPENGL_ES_2 && !defined(QT_NO_EGL)
- if (QByteArray((char*) glGetString(GL_RENDERER)).contains("SGX")) {
- QGLContextPrivate *ctxd = context->d_func();
- m_broken_fbo_readback = QByteArray((char *) eglQueryString(ctxd->eglContext->display(), EGL_VERSION)).contains("1.3");
- }
-#endif
-
- if (!m_broken_fbo_readback)
+ if (!ctx->d_ptr->workaround_brokenFBOReadBack)
glGenFramebuffers(1, &m_fbo);
connect(QGLSignalProxy::instance(), SIGNAL(aboutToDestroyContext(const QGLContext*)),
@@ -83,7 +75,7 @@ QGLTextureGlyphCache::~QGLTextureGlyphCache()
if (ctx) {
QGLShareContextScope scope(ctx);
- if (!m_broken_fbo_readback)
+ if (!ctx->d_ptr->workaround_brokenFBOReadBack)
glDeleteFramebuffers(1, &m_fbo);
if (m_width || m_height)
@@ -96,9 +88,15 @@ void QGLTextureGlyphCache::createTextureData(int width, int height)
// create in QImageTextureGlyphCache baseclass is meant to be called
// only to create the initial image and does not preserve the content,
// so we don't call when this function is called from resize.
- if (m_broken_fbo_readback && image().isNull())
+ if (ctx->d_ptr->workaround_brokenFBOReadBack && image().isNull())
QImageTextureGlyphCache::createTextureData(width, height);
+ // Make the lower glyph texture size 16 x 16.
+ if (width < 16)
+ width = 16;
+ if (height < 16)
+ height = 16;
+
glGenTextures(1, &m_texture);
glBindTexture(GL_TEXTURE_2D, m_texture);
@@ -123,10 +121,16 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height)
int oldWidth = m_width;
int oldHeight = m_height;
+ // Make the lower glyph texture size 16 x 16.
+ if (width < 16)
+ width = 16;
+ if (height < 16)
+ height = 16;
+
GLuint oldTexture = m_texture;
createTextureData(width, height);
- if (m_broken_fbo_readback) {
+ if (ctx->d_ptr->workaround_brokenFBOReadBack) {
QImageTextureGlyphCache::resizeTextureData(width, height);
Q_ASSERT(image().depth() == 8);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, oldWidth, oldHeight, GL_ALPHA, GL_UNSIGNED_BYTE, image().constBits());
@@ -209,7 +213,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height)
void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph)
{
- if (m_broken_fbo_readback) {
+ if (ctx->d_ptr->workaround_brokenFBOReadBack) {
QImageTextureGlyphCache::fillTexture(c, glyph);
glBindTexture(GL_TEXTURE_2D, m_texture);
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
index efb743502d..6bcd655526 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
@@ -115,8 +115,6 @@ private:
int m_height;
QGLShaderProgram *m_program;
-
- bool m_broken_fbo_readback;
};
QT_END_NAMESPACE
diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
index f677ce1839..9bc099df38 100644
--- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
+++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
@@ -481,7 +481,8 @@ static void qdashprocessor_cubicTo(qreal, qreal, qreal, qreal, qreal, qreal, voi
}
QDashedStrokeProcessor::QDashedStrokeProcessor()
- : m_dash_stroker(0), m_inv_scale(1)
+ : m_points(0), m_types(0),
+ m_dash_stroker(0), m_inv_scale(1)
{
m_dash_stroker.setMoveToHook(qdashprocessor_moveTo);
m_dash_stroker.setLineToHook(qdashprocessor_lineTo);
@@ -499,6 +500,8 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, c
m_points.reset();
m_types.reset();
+ m_points.reserve(path.elementCount());
+ m_types.reserve(path.elementCount());
qreal width = qpen_widthf(pen);
if (width == 0)
diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h
index 956d7cc839..ab27ed6480 100644
--- a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h
+++ b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h
@@ -54,6 +54,7 @@ QT_BEGIN_NAMESPACE
class QTriangulatingStroker
{
public:
+ QTriangulatingStroker() : m_vertices(0) {}
void process(const QVectorPath &path, const QPen &pen, const QRectF &clip);
inline int vertexCount() const { return m_vertices.size(); }
diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/opengl/gl2paintengineex/qtriangulator.cpp
index ce917ff582..df7cbc2f3f 100644
--- a/src/opengl/gl2paintengineex/qtriangulator.cpp
+++ b/src/opengl/gl2paintengineex/qtriangulator.cpp
@@ -510,6 +510,7 @@ template <class T>
class QMaxHeap
{
public:
+ QMaxHeap() : m_data(0) {}
inline int size() const {return m_data.size();}
inline bool empty() const {return m_data.isEmpty();}
inline bool isEmpty() const {return m_data.isEmpty();}
@@ -1299,7 +1300,8 @@ public:
class ComplexToSimple
{
public:
- inline ComplexToSimple(QTriangulator *parent) : m_parent(parent) { }
+ inline ComplexToSimple(QTriangulator *parent) : m_parent(parent),
+ m_edges(0), m_events(0), m_splits(0) { }
void decompose();
private:
struct Edge
@@ -1412,7 +1414,7 @@ public:
class SimpleToMonotone
{
public:
- inline SimpleToMonotone(QTriangulator *parent) : m_parent(parent) { }
+ inline SimpleToMonotone(QTriangulator *parent) : m_parent(parent), m_edges(0), m_upperVertex(0) { }
void decompose();
private:
enum VertexType {MergeVertex, EndVertex, RegularVertex, StartVertex, SplitVertex};
@@ -1486,7 +1488,7 @@ public:
int m_length;
};
- inline QTriangulator() { }
+ inline QTriangulator() : m_vertices(0) { }
// Call this only once.
void initialize(const qreal *polygon, int count, uint hint, const QTransform &matrix);
@@ -2709,7 +2711,7 @@ void QTriangulator::SimpleToMonotone::monotoneDecomposition()
return;
Q_ASSERT(!m_edgeList.root);
- QDataBuffer<QPair<int, int> > diagonals;
+ QDataBuffer<QPair<int, int> > diagonals(m_upperVertex.size());
int i = 0;
for (int index = 1; index < m_edges.size(); ++index) {
@@ -2853,7 +2855,7 @@ bool QTriangulator::SimpleToMonotone::CompareVertices::operator () (int i, int j
void QTriangulator::MonotoneToTriangles::decompose()
{
QVector<quint32> result;
- QDataBuffer<int> stack;
+ QDataBuffer<int> stack(m_parent->m_indices.size());
m_first = 0;
// Require at least three more indices.
while (m_first + 3 <= m_parent->m_indices.size()) {
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index cfacf26576..922a96cf96 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1612,6 +1612,9 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)
current_fbo = 0;
default_fbo = 0;
active_engine = 0;
+ workaround_needsFullClearOnEveryFrame = false;
+ workaround_brokenFBOReadBack = false;
+ workaroundsCached = false;
for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i)
vertexAttributeArraysEnabledState[i] = false;
}
@@ -1723,7 +1726,6 @@ QGLTextureCache::QGLTextureCache()
QGLTextureCache::~QGLTextureCache()
{
- Q_ASSERT(size() == 0);
QImagePixmapCleanupHooks::instance()->removePixmapDataModificationHook(cleanupTexturesForPixampData);
QImagePixmapCleanupHooks::instance()->removePixmapDataDestructionHook(cleanupBeforePixmapDestruction);
QImagePixmapCleanupHooks::instance()->removeImageHook(cleanupTexturesForCacheKey);
@@ -2773,23 +2775,27 @@ static void qDrawTextureRect(const QRectF &target, GLint textureWidth, GLint tex
/*!
\since 4.4
- Draws the given texture, \a textureId, to the given target rectangle,
- \a target, in OpenGL model space. The \a textureTarget should be a 2D
- texture target.
+ This function supports the following use cases:
+
+ \list
+ \i On OpenGL and OpenGL ES 1.x it draws the given texture, \a textureId,
+ to the given target rectangle, \a target, in OpenGL model space. The
+ \a textureTarget should be a 2D texture target.
+ \i On OpenGL and OpenGL ES 2.x, if a painter is active, not inside a
+ beginNativePainting / endNativePainting block, and uses the
+ engine with type QPaintEngine::OpenGL2, the function will draw the given
+ texture, \a textureId, to the given target rectangle, \a target,
+ respecting the current painter state. This will let you draw a texture
+ with the clip, transform, render hints, and composition mode set by the
+ painter. Note that the texture target needs to be GL_TEXTURE_2D for this
+ use case, and that this is the only supported use case under OpenGL ES 2.x.
+ \endlist
- \note This function is not supported under OpenGL/ES 2.0.
*/
void QGLContext::drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget)
{
-#ifndef QT_OPENGL_ES_2
-#ifdef QT_OPENGL_ES
- if (textureTarget != GL_TEXTURE_2D) {
- qWarning("QGLContext::drawTexture(): texture target must be GL_TEXTURE_2D on OpenGL ES");
- return;
- }
-#else
-
- if (d_ptr->active_engine &&
+#if !defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2)
+ if (d_ptr->active_engine &&
d_ptr->active_engine->type() == QPaintEngine::OpenGL2) {
QGL2PaintEngineEx *eng = static_cast<QGL2PaintEngineEx*>(d_ptr->active_engine);
if (!eng->isNativePaintingActive()) {
@@ -2799,7 +2805,15 @@ void QGLContext::drawTexture(const QRectF &target, GLuint textureId, GLenum text
return;
}
}
+#endif
+#ifndef QT_OPENGL_ES_2
+#ifdef QT_OPENGL_ES
+ if (textureTarget != GL_TEXTURE_2D) {
+ qWarning("QGLContext::drawTexture(): texture target must be GL_TEXTURE_2D on OpenGL ES");
+ return;
+ }
+#else
const bool wasEnabled = glIsEnabled(GL_TEXTURE_2D);
GLint oldTexture;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldTexture);
@@ -2821,7 +2835,7 @@ void QGLContext::drawTexture(const QRectF &target, GLuint textureId, GLenum text
Q_UNUSED(target);
Q_UNUSED(textureId);
Q_UNUSED(textureTarget);
- qWarning("drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget) not supported with OpenGL ES/2.0");
+ qWarning("drawTexture() with OpenGL ES 2.0 requires an active OpenGL2 paint engine");
#endif
}
@@ -2836,14 +2850,26 @@ void QGLContext::drawTexture(const QRectF &target, QMacCompatGLuint textureId, Q
/*!
\since 4.4
- Draws the given texture at the given \a point in OpenGL model
- space. The \a textureTarget should be a 2D texture target.
+ This function supports the following use cases:
+
+ \list
+ \i By default it draws the given texture, \a textureId,
+ at the given \a point in OpenGL model space. The
+ \a textureTarget should be a 2D texture target.
+ \i If a painter is active, not inside a
+ beginNativePainting / endNativePainting block, and uses the
+ engine with type QPaintEngine::OpenGL2, the function will draw the given
+ texture, \a textureId, at the given \a point,
+ respecting the current painter state. This will let you draw a texture
+ with the clip, transform, render hints, and composition mode set by the
+ painter. Note that the texture target needs to be GL_TEXTURE_2D for this
+ use case.
+ \endlist
- \note This function is not supported under OpenGL/ES.
+ \note This function is not supported under any version of OpenGL ES.
*/
void QGLContext::drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget)
{
- // this would be ok on OpenGL ES 2.0, but currently we don't have a define for that
#ifdef QT_OPENGL_ES
Q_UNUSED(point);
Q_UNUSED(textureId);
@@ -2864,7 +2890,7 @@ void QGLContext::drawTexture(const QPointF &point, GLuint textureId, GLenum text
glGetTexLevelParameteriv(textureTarget, 0, GL_TEXTURE_WIDTH, &textureWidth);
glGetTexLevelParameteriv(textureTarget, 0, GL_TEXTURE_HEIGHT, &textureHeight);
- if (d_ptr->active_engine &&
+ if (d_ptr->active_engine &&
d_ptr->active_engine->type() == QPaintEngine::OpenGL2) {
QGL2PaintEngineEx *eng = static_cast<QGL2PaintEngineEx*>(d_ptr->active_engine);
if (!eng->isNativePaintingActive()) {
@@ -4911,11 +4937,8 @@ void QGLWidget::deleteTexture(QMacCompatGLuint id)
/*!
\since 4.4
- Draws the given texture, \a textureId to the given target rectangle,
- \a target, in OpenGL model space. The \a textureTarget should be a 2D
- texture target.
-
- Equivalent to the corresponding QGLContext::drawTexture().
+ Calls the corresponding QGLContext::drawTexture() on
+ this widget's context.
*/
void QGLWidget::drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget)
{
@@ -4935,10 +4958,8 @@ void QGLWidget::drawTexture(const QRectF &target, QMacCompatGLuint textureId, QM
/*!
\since 4.4
- Draws the given texture, \a textureId, at the given \a point in OpenGL
- model space. The \a textureTarget should be a 2D texture target.
-
- Equivalent to the corresponding QGLContext::drawTexture().
+ Calls the corresponding QGLContext::drawTexture() on
+ this widget's context.
*/
void QGLWidget::drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget)
{
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index 92a064f7d8..f297009b9b 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -431,6 +431,7 @@ private:
friend class QGLFramebufferObjectPrivate;
friend class QGLFBOGLPaintDevice;
friend class QGLPaintDevice;
+ friend class QGLWidgetGLPaintDevice;
friend class QX11GLPixmapData;
friend class QX11GLSharedContexts;
private:
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index 0fbbbf9ef2..44e8ae9d29 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -185,8 +185,26 @@ void QGLContext::makeCurrent()
return;
}
- if (d->eglContext->makeCurrent(d->eglSurfaceForDevice()))
+ if (d->eglContext->makeCurrent(d->eglSurfaceForDevice())) {
QGLContextPrivate::setCurrentContext(this);
+ if (!d->workaroundsCached) {
+ d->workaroundsCached = true;
+ const char *renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
+ if (strstr(renderer, "SGX") || strstr(renderer, "MBX")) {
+ // PowerVR MBX/SGX chips needs to clear all buffers when starting to render
+ // a new frame, otherwise there will be a performance penalty to pay for
+ // each frame.
+ d->workaround_needsFullClearOnEveryFrame = true;
+
+ // Older PowerVR SGX drivers (like the one in the N900) have a
+ // bug which prevents glCopyTexSubImage2D() to work with a POT
+ // or GL_ALPHA texture bound to an FBO. The only way to
+ // identify that driver is to check the EGL version number for it.
+ if (strstr(eglQueryString(d->eglContext->display(), EGL_VERSION), "1.3"))
+ d->workaround_brokenFBOReadBack = true;
+ }
+ }
+ }
}
void QGLContext::doneCurrent()
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index f19e394d9f..d92f963a5b 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -345,7 +345,7 @@ public:
HDC hbitmap_hdc;
#endif
#ifndef QT_NO_EGL
- bool ownsEglContext;
+ uint ownsEglContext : 1;
QEglContext *eglContext;
EGLSurface eglSurface;
void destroyEglSurfaceForDevice();
@@ -382,6 +382,12 @@ public:
uint internal_context : 1;
uint version_flags_cached : 1;
uint extension_flags_cached : 1;
+
+ // workarounds for driver/hw bugs on different platforms
+ uint workaround_needsFullClearOnEveryFrame : 1;
+ uint workaround_brokenFBOReadBack : 1;
+ uint workaroundsCached : 1;
+
QPaintDevice *paintDevice;
QColor transpColor;
QGLContext *q_ptr;
diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp
index e874e85c38..e1dcbfde89 100644
--- a/src/opengl/qglpaintdevice.cpp
+++ b/src/opengl/qglpaintdevice.cpp
@@ -175,7 +175,10 @@ void QGLWidgetGLPaintDevice::beginPaint()
float alpha = c.alphaF();
glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha);
}
- glClear(GL_COLOR_BUFFER_BIT);
+ if (context()->d_func()->workaround_needsFullClearOnEveryFrame)
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ else
+ glClear(GL_COLOR_BUFFER_BIT);
}
}
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 306fd8bed9..08a50cb759 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -668,6 +668,7 @@ public:
, last_created_state(0)
, shader_ctx(0)
, grad_palette(0)
+ , tess_points(0)
, drawable_texture(0)
, ref_cleaner(this)
{}
@@ -1950,6 +1951,8 @@ void QOpenGLPaintEnginePrivate::pathToVertexArrays(const QPainterPath &path)
void QOpenGLPaintEnginePrivate::drawVertexArrays()
{
+ if (tess_points_stops.count() == 0)
+ return;
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_DOUBLE, 0, tess_points.data());
int previous_stop = 0;
@@ -3947,7 +3950,7 @@ void QOpenGLPaintEnginePrivate::strokeLines(const QPainterPath &path)
enableClipping();
}
-extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
+Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
void QOpenGLPaintEnginePrivate::strokePath(const QPainterPath &path, bool use_cache)
{
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index 1b9c8cc4fc..3cd18fb7cf 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -53,15 +53,17 @@
QT_BEGIN_NAMESPACE
QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine)
- : CActive(CActive::EPriorityStandard), engine(engine), ipConnectionNotifier(0),
- iError(QNetworkSession::UnknownSessionError),
- iALREnabled(0), iConnectInBackground(false)
+ : CActive(CActive::EPriorityUserInput), engine(engine),
+ ipConnectionNotifier(0), iHandleStateNotificationsFromManager(false),
+ iFirstSync(true), iStoppedByUser(false), iClosedByUser(false), iDeprecatedConnectionId(0),
+ iError(QNetworkSession::UnknownSessionError), iALREnabled(0), iConnectInBackground(false)
{
CActiveScheduler::Add(this);
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
iMobility = NULL;
#endif
+
TRAP_IGNORE(iConnectionMonitor.ConnectL());
}
@@ -90,18 +92,72 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl()
// Close global 'Open C' RConnection
setdefaultif(0);
-
- iConnectionMonitor.CancelNotifications();
+
iConnectionMonitor.Close();
}
+void QNetworkSessionPrivateImpl::configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, QNetworkSession::State newState)
+{
+ if (iHandleStateNotificationsFromManager) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "configurationStateChanged from manager for IAP : " << QString::number(accessPointId)
+ << "configurationStateChanged connMon ID : " << QString::number(connMonId)
+ << " : to a state: " << newState
+ << " whereas my current state is: " << state;
+#endif
+ if (connMonId == iDeprecatedConnectionId) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "however status update from manager ignored because it related to already closed connection.";
+#endif
+ return;
+ }
+ this->newState(newState, accessPointId);
+ }
+}
+
+void QNetworkSessionPrivateImpl::configurationRemoved(QNetworkConfigurationPrivatePointer config)
+{
+ if (!publicConfig.isValid())
+ return;
+
+ SymbianNetworkConfigurationPrivate *symbianConfig = toSymbianConfig(config);
+
+ symbianConfig->mutex.lock();
+ TUint32 configNumericId = symbianConfig->numericId;
+ symbianConfig->mutex.unlock();
+
+ symbianConfig = toSymbianConfig(privateConfiguration(publicConfig));
+
+ symbianConfig->mutex.lock();
+ TUint32 publicNumericId = symbianConfig->numericId;
+ symbianConfig->mutex.unlock();
+
+ if (configNumericId == publicNumericId) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "configurationRemoved IAP: " << QString::number(publicNumericId) << " : going to State: Invalid";
+#endif
+ this->newState(QNetworkSession::Invalid, publicNumericId);
+ }
+}
+
void QNetworkSessionPrivateImpl::syncStateWithInterface()
{
if (!publicConfig.isValid())
return;
- // Start monitoring changes in IAP states
- TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this));
+ if (iFirstSync && publicConfig.isValid()) {
+ QObject::connect(engine, SIGNAL(configurationStateChanged(TUint32, TUint32, QNetworkSession::State)),
+ this, SLOT(configurationStateChanged(TUint32, TUint32, QNetworkSession::State)));
+ // Listen to configuration removals, so that in case the configuration
+ // this session is based on is removed, session knows to enter Invalid -state.
+ QObject::connect(engine, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)),
+ this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer)));
+ }
+ // Start listening IAP state changes from QNetworkConfigurationManagerPrivate
+ iHandleStateNotificationsFromManager = true;
// Check open connections to see if there is already
// an open connection to selected IAP or SNAP
@@ -137,11 +193,8 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
}
if (state != QNetworkSession::Connected) {
- // There were no open connections to used IAP or SNAP
- if (iError == QNetworkSession::InvalidConfigurationError) {
- newState(QNetworkSession::Invalid);
- } else if ((publicConfig.state() & QNetworkConfiguration::Discovered) ==
- QNetworkConfiguration::Discovered) {
+ if ((publicConfig.state() & QNetworkConfiguration::Discovered) ==
+ QNetworkConfiguration::Discovered) {
newState(QNetworkSession::Disconnected);
} else {
newState(QNetworkSession::NotAvailable);
@@ -245,13 +298,18 @@ QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const
void QNetworkSessionPrivateImpl::open()
{
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "open() called, session state is: " << state << " and isOpen is: "
+ << isOpen;
+#endif
if (isOpen || (state == QNetworkSession::Connecting)) {
return;
}
-
- // Cancel notifications from RConnectionMonitor
+
+ // Stop handling IAP state change signals from QNetworkConfigurationManagerPrivate
// => RConnection::ProgressNotification will be used for IAP/SNAP monitoring
- iConnectionMonitor.CancelNotifications();
+ iHandleStateNotificationsFromManager = false;
// Configuration may have been invalidated after session creation by platform
// (e.g. configuration has been deleted).
@@ -259,19 +317,25 @@ void QNetworkSessionPrivateImpl::open()
newState(QNetworkSession::Invalid);
iError = QNetworkSession::InvalidConfigurationError;
emit QNetworkSessionPrivate::error(iError);
- syncStateWithInterface();
return;
}
- // If opening a (un)defined configuration, session emits error and enters
- // NotAvailable -state.
- if (publicConfig.state() == QNetworkConfiguration::Undefined ||
- publicConfig.state() == QNetworkConfiguration::Defined) {
+ // If opening a undefined configuration, session emits error and enters
+ // NotAvailable -state. Note that we will try ones in 'defined' state to avoid excessive
+ // need for WLAN scans (via updateConfigurations()), because user may have walked
+ // into a WLAN range, but periodic background scan has not occurred yet -->
+ // we don't want to force application to make frequent updateConfigurations() calls
+ // to be able to try if e.g. home WLAN is available.
+ if (publicConfig.state() == QNetworkConfiguration::Undefined) {
newState(QNetworkSession::NotAvailable);
iError = QNetworkSession::InvalidConfigurationError;
emit QNetworkSessionPrivate::error(iError);
return;
}
-
+ // Clear possible previous states
+ iStoppedByUser = false;
+ iClosedByUser = false;
+ iDeprecatedConnectionId = 0;
+
TInt error = iSocketServ.Connect();
if (error != KErrNone) {
// Could not open RSocketServ
@@ -446,16 +510,18 @@ TUint QNetworkSessionPrivateImpl::iapClientCount(TUint aIAPId) const
void QNetworkSessionPrivateImpl::close(bool allowSignals)
{
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "close() called, session state is: " << state << " and isOpen is : "
+ << isOpen;
+#endif
if (!isOpen) {
return;
}
-
- SymbianNetworkConfigurationPrivate *symbianConfig =
- toSymbianConfig(privateConfiguration(activeConfig));
-
- symbianConfig->mutex.lock();
- TUint activeIap = symbianConfig->numericId;
- symbianConfig->mutex.unlock();
+ // Mark this session as closed-by-user so that we are able to report
+ // distinguish between stop() and close() state transitions
+ // when reporting.
+ iClosedByUser = true;
isOpen = false;
activeConfig = QNetworkConfiguration();
@@ -469,8 +535,10 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
}
#endif
- if (ipConnectionNotifier) {
+ if (ipConnectionNotifier && !iHandleStateNotificationsFromManager) {
ipConnectionNotifier->StopNotifications();
+ // Start handling IAP state change signals from QNetworkConfigurationManagerPrivate
+ iHandleStateNotificationsFromManager = true;
}
iConnection.Close();
@@ -479,29 +547,31 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
// Close global 'Open C' RConnection
setdefaultif(0);
-#ifdef Q_CC_NOKIAX86
- if ((allowSignals && iapClientCount(activeIap) <= 0) ||
-#else
- if ((allowSignals && iapClientCount(activeIap) <= 1) ||
-#endif
- (publicConfig.type() == QNetworkConfiguration::UserChoice)) {
+ if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
newState(QNetworkSession::Closing);
+ newState(QNetworkSession::Disconnected);
}
- syncStateWithInterface();
if (allowSignals) {
- if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
- newState(QNetworkSession::Disconnected);
- }
emit closed();
}
}
void QNetworkSessionPrivateImpl::stop()
{
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "stop() called, session state is: " << state << " and isOpen is : "
+ << isOpen;
+#endif
if (!isOpen &&
publicConfig.isValid() &&
publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "since session is not open, using RConnectionMonitor to stop() the interface";
+#endif
+ iStoppedByUser = true;
// If the publicConfig is type of IAP, enumerate through connections at
// connection monitor. If publicConfig is active in that list, stop it.
// Otherwise there is nothing to stop. Note: because this QNetworkSession is not open,
@@ -515,7 +585,7 @@ void QNetworkSessionPrivateImpl::stop()
}
TUint numSubConnections; // Not used but needed by GetConnectionInfo i/f
TUint connectionId;
- for (TInt i = 1; i <= count; ++i) {
+ for (TUint i = 1; i <= count; ++i) {
// Get (connection monitor's assigned) connection ID
TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections);
if (ret == KErrNone) {
@@ -532,11 +602,25 @@ void QNetworkSessionPrivateImpl::stop()
ETrue);
}
}
+ // Enter disconnected state right away since the session is not even open.
+ // Symbian^3 connection monitor does not emit KLinkLayerClosed when
+ // connection is stopped via connection monitor.
+ newState(QNetworkSession::Disconnected);
}
} else if (isOpen) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "since session is open, using RConnection to stop() the interface";
+#endif
// Since we are open, use RConnection to stop the interface
isOpen = false;
+ iStoppedByUser = true;
newState(QNetworkSession::Closing);
+ if (ipConnectionNotifier) {
+ ipConnectionNotifier->StopNotifications();
+ // Start handling IAP state change signals from QNetworkConfigurationManagerPrivate
+ iHandleStateNotificationsFromManager = true;
+ }
iConnection.Stop(RConnection::EStopAuthoritative);
isOpen = true;
close(false);
@@ -654,6 +738,10 @@ void QNetworkSessionPrivateImpl::NewCarrierActive(TAccessPointInfo /*aNewAPInfo*
void QNetworkSessionPrivateImpl::Error(TInt /*aError*/)
{
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "roaming Error() occured";
+#endif
if (isOpen) {
isOpen = false;
activeConfig = QNetworkConfiguration();
@@ -671,6 +759,11 @@ void QNetworkSessionPrivateImpl::Error(TInt /*aError*/)
// changes immediately to Disconnected.
newState(QNetworkSession::Disconnected);
emit closed();
+ } else if (iStoppedByUser) {
+ // If the user of this session has called the stop() and
+ // configuration is based on internet SNAP, this needs to be
+ // done here because platform might roam.
+ newState(QNetworkSession::Disconnected);
}
}
#endif
@@ -947,7 +1040,7 @@ void QNetworkSessionPrivateImpl::RunL()
#endif
if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
serviceConfig = QNetworkConfigurationManager()
- .configurationFromIdentifier(symbianConfig->serviceNetworkPtr->id);
+ .configurationFromIdentifier(symbianConfig->id);
}
symbianConfig->mutex.unlock();
@@ -975,7 +1068,12 @@ void QNetworkSessionPrivateImpl::RunL()
isOpen = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
- iError = QNetworkSession::UnknownSessionError;
+ if (publicConfig.state() == QNetworkConfiguration::Undefined ||
+ publicConfig.state() == QNetworkConfiguration::Defined) {
+ iError = QNetworkSession::InvalidConfigurationError;
+ } else {
+ iError = QNetworkSession::UnknownSessionError;
+ }
emit QNetworkSessionPrivate::error(iError);
Cancel();
if (ipConnectionNotifier) {
@@ -991,8 +1089,16 @@ void QNetworkSessionPrivateImpl::DoCancel()
iConnection.Close();
}
+// Enters newState if feasible according to current state.
+// AccessPointId may be given as parameter. If it is zero, state-change is assumed to
+// concern this session's configuration. If non-zero, the configuration is looked up
+// and checked if it matches the configuration this session is based on.
bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint accessPointId)
{
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - "
+ << "NEW STATE, IAP ID : " << QString::number(accessPointId) << " , newState : " << QString::number(newState);
+#endif
// Make sure that activeConfig is always updated when SNAP is signaled to be
// connected.
if (isOpen && publicConfig.type() == QNetworkConfiguration::ServiceNetwork &&
@@ -1027,9 +1133,29 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
if (state == QNetworkSession::Roaming && newState == QNetworkSession::Connecting) {
return false;
}
+
+ // Make sure that Connected state is not reported when Connection is
+ // already Closing.
+ // Note: Stopping connection results sometimes KLinkLayerOpen
+ // to be reported first (just before KLinkLayerClosed).
+ if (state == QNetworkSession::Closing && newState == QNetworkSession::Connected) {
+ return false;
+ }
+
+ // Make sure that some lagging 'closing' state-changes do not overwrite
+ // if we are already disconnected or closed.
+ if (state == QNetworkSession::Disconnected && newState == QNetworkSession::Closing) {
+ return false;
+ }
bool emitSessionClosed = false;
- if (isOpen && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) {
+
+ // If we abruptly go down and user hasn't closed the session, we've been aborted.
+ // Note that session may be in 'closing' state and not in 'connected' state, because
+ // depending on platform the platform may report KConfigDaemonStartingDeregistration
+ // event before KLinkLayerClosed
+ if ((isOpen && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) ||
+ (isOpen && !iClosedByUser && newState == QNetworkSession::Disconnected)) {
// Active & Connected state should change directly to Disconnected state
// only when something forces connection to close (eg. when another
// application or session stops connection or when network drops
@@ -1043,14 +1169,17 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
- // Start monitoring changes in IAP states
- TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this));
+ // Start handling IAP state change signals from QNetworkConfigurationManagerPrivate
+ iHandleStateNotificationsFromManager = true;
emitSessionClosed = true; // Emit SessionClosed after state change has been reported
}
bool retVal = false;
if (accessPointId == 0) {
state = newState;
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed A to: " << state;
+#endif
emit stateChanged(state);
retVal = true;
} else {
@@ -1063,6 +1192,9 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
configLocker.unlock();
state = newState;
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed B to: " << state;
+#endif
emit stateChanged(state);
retVal = true;
}
@@ -1075,6 +1207,9 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
configLocker.unlock();
state = newState;
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed C to: " << state;
+#endif
emit stateChanged(state);
retVal = true;
}
@@ -1087,21 +1222,14 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
QMutexLocker configLocker(&symbianConfig->mutex);
if (symbianConfig->numericId == accessPointId) {
- if (newState == QNetworkSession::Connected) {
- // Make sure that when AccessPoint is reported to be Connected
- // also state of the related configuration changes to Active.
- symbianConfig->state = QNetworkConfiguration::Active;
- configLocker.unlock();
-
+ if (newState != QNetworkSession::Disconnected) {
state = newState;
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed D to: " << state;
+#endif
emit stateChanged(state);
retVal = true;
} else {
- if (newState == QNetworkSession::Disconnected) {
- // Make sure that when AccessPoint is reported to be disconnected
- // also state of the related configuration changes from Active to Defined.
- symbianConfig->state = QNetworkConfiguration::Defined;
- }
QNetworkConfiguration config = bestConfigFromSNAP(publicConfig);
if ((config.state() == QNetworkConfiguration::Defined) ||
(config.state() == QNetworkConfiguration::Discovered)) {
@@ -1109,8 +1237,21 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
configLocker.unlock();
state = newState;
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed E to: " << state;
+#endif
emit stateChanged(state);
retVal = true;
+ } else if (config.state() == QNetworkConfiguration::Active) {
+ // Connection to used IAP was closed, but there is another
+ // IAP that's active in used SNAP
+ // => Change state back to Connected
+ state = QNetworkSession::Connected;
+ emit stateChanged(state);
+ retVal = true;
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "===> EMIT State changed F to: " << state;
+#endif
}
}
}
@@ -1121,6 +1262,19 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
if (emitSessionClosed) {
emit closed();
}
+ if (state == QNetworkSession::Disconnected) {
+ // The connection has gone down, and processing of status updates must be
+ // stopped. Depending on platform, there may come 'connecting/connected' states
+ // considerably later (almost a second). Connection id is an increasing
+ // number, so this does not affect next _real_ 'conneting/connected' states.
+
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(publicConfig));
+
+ symbianConfig->mutex.lock();
+ iDeprecatedConnectionId = symbianConfig->connectionId;
+ symbianConfig->mutex.unlock();
+ }
return retVal;
}
@@ -1129,6 +1283,9 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne
TInt aError,
TUint accessPointId)
{
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - " << QString::number(accessPointId) << " , status : " << QString::number(aConnectionStatus);
+#endif
switch (aConnectionStatus)
{
// Connection unitialised
@@ -1167,6 +1324,7 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne
case KCsdGotLoginInfo:
break;
+ case KConfigDaemonStartingRegistration:
// Creating connection (e.g. GPRS activation)
case KCsdStartingConnect:
case KCsdFinishedConnect:
@@ -1193,6 +1351,7 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne
case KDataTransferTemporarilyBlocked:
break;
+ case KConfigDaemonStartingDeregistration:
// Hangup or GRPS deactivation
case KConnectionStartingClose:
newState(QNetworkSession::Closing,accessPointId);
@@ -1200,137 +1359,27 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne
// Connection closed
case KConnectionClosed:
- break;
-
case KLinkLayerClosed:
newState(QNetworkSession::Disconnected,accessPointId);
+ // Report manager about this to make sure this event
+ // is received by all interseted parties (mediated by
+ // manager because it does always receive all events from
+ // connection monitor).
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNS this : " << QString::number((uint)this) << " - " << "reporting disconnection to manager.";
+#endif
+ if (publicConfig.isValid()) {
+ engine->configurationStateChangeReport(toSymbianConfig(privateConfiguration(publicConfig))->numericId, QNetworkSession::Disconnected);
+ }
break;
-
// Unhandled state
default:
break;
}
}
-void QNetworkSessionPrivateImpl::EventL(const CConnMonEventBase& aEvent)
-{
- switch (aEvent.EventType())
- {
- case EConnMonConnectionStatusChange:
- {
- CConnMonConnectionStatusChange* realEvent;
- realEvent = (CConnMonConnectionStatusChange*) &aEvent;
-
- TUint connectionId = realEvent->ConnectionId();
- TInt connectionStatus = realEvent->ConnectionStatus();
-
- // Try to Find IAP Id using connection Id
- TUint apId = 0;
- if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
- QList<QNetworkConfiguration> subConfigurations = publicConfig.children();
- for (int i = 0; i < subConfigurations.count(); i++ ) {
- SymbianNetworkConfigurationPrivate *symbianConfig =
- toSymbianConfig(privateConfiguration(subConfigurations[i]));
-
- QMutexLocker configLocker(&symbianConfig->mutex);
-
- if (symbianConfig->connectionId == connectionId) {
- apId = symbianConfig->numericId;
- break;
- }
- }
- } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) {
- SymbianNetworkConfigurationPrivate *symbianConfig =
- toSymbianConfig(privateConfiguration(publicConfig));
-
- symbianConfig->mutex.lock();
- if (symbianConfig->connectionId == connectionId)
- apId = symbianConfig->numericId;
- symbianConfig->mutex.unlock();
- }
-
- if (apId > 0) {
- handleSymbianConnectionStatusChange(connectionStatus, KErrNone, apId);
- }
- }
- break;
-
- case EConnMonCreateConnection:
- {
- CConnMonCreateConnection* realEvent;
- realEvent = (CConnMonCreateConnection*) &aEvent;
- TUint apId;
- TUint connectionId = realEvent->ConnectionId();
- TRequestStatus status;
- iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status);
- User::WaitForRequest(status);
- if (status.Int() == KErrNone) {
- // Store connection id to related AccessPoint Configuration
- if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
- QList<QNetworkConfiguration> subConfigurations = publicConfig.children();
- for (int i = 0; i < subConfigurations.count(); i++ ) {
- SymbianNetworkConfigurationPrivate *symbianConfig =
- toSymbianConfig(privateConfiguration(subConfigurations[i]));
-
- QMutexLocker configLocker(&symbianConfig->mutex);
-
- if (symbianConfig->numericId == apId) {
- symbianConfig->connectionId = connectionId;
- break;
- }
- }
- } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) {
- SymbianNetworkConfigurationPrivate *symbianConfig =
- toSymbianConfig(privateConfiguration(publicConfig));
-
- symbianConfig->mutex.lock();
- if (symbianConfig->numericId == apId)
- symbianConfig->connectionId = connectionId;
- symbianConfig->mutex.unlock();
- }
- }
- }
- break;
-
- case EConnMonDeleteConnection:
- {
- CConnMonDeleteConnection* realEvent;
- realEvent = (CConnMonDeleteConnection*) &aEvent;
- TUint connectionId = realEvent->ConnectionId();
- // Remove connection id from related AccessPoint Configuration
- if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
- QList<QNetworkConfiguration> subConfigurations = publicConfig.children();
- for (int i = 0; i < subConfigurations.count(); i++ ) {
- SymbianNetworkConfigurationPrivate *symbianConfig =
- toSymbianConfig(privateConfiguration(subConfigurations[i]));
-
- QMutexLocker configLocker(&symbianConfig->mutex);
-
- if (symbianConfig->connectionId == connectionId) {
- symbianConfig->connectionId = 0;
- break;
- }
- }
- } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) {
- SymbianNetworkConfigurationPrivate *symbianConfig =
- toSymbianConfig(privateConfiguration(publicConfig));
-
- symbianConfig->mutex.lock();
- if (symbianConfig->connectionId == connectionId)
- symbianConfig->connectionId = 0;
- symbianConfig->mutex.unlock();
- }
- }
- break;
-
- default:
- // For unrecognized events
- break;
- }
-}
-
-ConnectionProgressNotifier::ConnectionProgressNotifier(QNetworkSessionPrivateImpl &owner, RConnection &connection)
- : CActive(CActive::EPriorityStandard), iOwner(owner), iConnection(connection)
+ConnectionProgressNotifier::ConnectionProgressNotifier(QNetworkSessionPrivateImpl& owner, RConnection& connection)
+ : CActive(CActive::EPriorityUserInput), iOwner(owner), iConnection(connection)
{
CActiveScheduler::Add(this);
}
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h
index 7116519719..9767293e52 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.h
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.h
@@ -75,9 +75,8 @@ class SymbianEngine;
class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive,
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
- public MMobilityProtocolResp,
+ public MMobilityProtocolResp
#endif
- public MConnectionMonitorObserver
{
Q_OBJECT
public:
@@ -130,8 +129,9 @@ protected: // From CActive
void RunL();
void DoCancel();
-private: // MConnectionMonitorObserver
- void EventL(const CConnMonEventBase& aEvent);
+private Q_SLOTS:
+ void configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, QNetworkSession::State newState);
+ void configurationRemoved(QNetworkConfigurationPrivatePointer config);
private:
TUint iapClientCount(TUint aIAPId) const;
@@ -157,6 +157,13 @@ private: // data
mutable RConnection iConnection;
mutable RConnectionMonitor iConnectionMonitor;
ConnectionProgressNotifier* ipConnectionNotifier;
+
+ bool iHandleStateNotificationsFromManager;
+ bool iFirstSync;
+ bool iStoppedByUser;
+ bool iClosedByUser;
+ TUint32 iDeprecatedConnectionId;
+
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
CActiveCommsMobilityApiExt* iMobility;
#endif
diff --git a/src/plugins/bearer/symbian/symbian.pro b/src/plugins/bearer/symbian/symbian.pro
index f915570d51..4f1e51cacc 100644
--- a/src/plugins/bearer/symbian/symbian.pro
+++ b/src/plugins/bearer/symbian/symbian.pro
@@ -11,6 +11,7 @@ SOURCES += symbianengine.cpp \
main.cpp
symbian {
+ TARGET.UID3=0x20021319
exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \
exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) {
message("Building with SNAP support")
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index 8e9675e6af..cea8b6755a 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -45,14 +45,14 @@
#include <commdb.h>
#include <cdbcols.h>
#include <d32dbms.h>
+#include <nifvar.h>
#include <QEventLoop>
#include <QTimer>
#include <QTime> // For randgen seeding
#include <QtCore> // For randgen seeding
-// #define QT_BEARERMGMT_CONFIGMGR_DEBUG
-#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
#include <QDebug>
#endif
@@ -73,7 +73,9 @@
QT_BEGIN_NAMESPACE
-static const int KValueThatWillBeAddedToSNAPId = 1000;
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+ static const int KValueThatWillBeAddedToSNAPId = 1000;
+#endif
static const int KUserChoiceIAPId = 0;
SymbianNetworkConfigurationPrivate::SymbianNetworkConfigurationPrivate()
@@ -657,26 +659,34 @@ void SymbianEngine::updateActiveAccessPoints()
iConnectionMonitor.GetConnectionCount(connectionCount, status);
User::WaitForRequest(status);
- // Go through all connections and set state of related IAPs to Active
+ // Go through all connections and set state of related IAPs to Active.
+ // Status needs to be checked carefully, because ConnMon lists also e.g.
+ // WLAN connections that are being currently tried --> we don't want to
+ // state these as active.
TUint connectionId;
TUint subConnectionCount;
TUint apId;
+ TInt connectionStatus;
if (status.Int() == KErrNone) {
for (TUint i = 1; i <= connectionCount; i++) {
iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount);
iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
User::WaitForRequest(status);
QString ident = QString::number(qHash(apId));
-
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
if (ptr) {
- online = true;
- inactiveConfigs.removeOne(ident);
+ iConnectionMonitor.GetIntAttribute(connectionId, subConnectionCount, KConnectionStatus, connectionStatus, status);
+ User::WaitForRequest(status);
+ if (connectionStatus == KLinkLayerOpen) {
+ online = true;
+ inactiveConfigs.removeOne(ident);
- toSymbianConfig(ptr)->connectionId = connectionId;
+ QMutexLocker configLocker(&ptr->mutex);
+ toSymbianConfig(ptr)->connectionId = connectionId;
- // Configuration is Active
- changeConfigurationStateTo(ptr, QNetworkConfiguration::Active);
+ // Configuration is Active
+ changeConfigurationStateTo(ptr, QNetworkConfiguration::Active);
+ }
}
}
}
@@ -733,12 +743,12 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn
}
}
- // Make sure that state of rest of the IAPs won't be Discovered or Active
+ // Make sure that state of rest of the IAPs won't be Active
foreach (const QString &iface, unavailableConfigs) {
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface);
if (ptr) {
// Configuration is Defined
- changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Defined);
+ changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered);
}
}
}
@@ -894,21 +904,22 @@ void SymbianEngine::RunL()
QMutexLocker locker(&mutex);
if (iIgnoringUpdates) {
-#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG
- qDebug("CommsDB event handling postponed (postpone-timer running because IAPs/SNAPs were updated very recently).");
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug("QNCM CommsDB event handling postponed (postpone-timer running because IAPs/SNAPs were updated very recently).");
#endif
return;
}
if (iStatus != KErrCancel) {
RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int());
+
switch (event) {
case RDbNotifier::EUnlock: /** All read locks have been removed. */
case RDbNotifier::ECommit: /** A transaction has been committed. */
case RDbNotifier::ERollback: /** A transaction has been rolled back */
case RDbNotifier::ERecover: /** The database has been recovered */
-#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG
- qDebug("CommsDB event (of type RDbNotifier::TEvent) received: %d", iStatus.Int());
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug("QNCM CommsDB event (of type RDbNotifier::TEvent) received: %d", iStatus.Int());
#endif
iIgnoringUpdates = true;
// Other events than ECommit get lower priority. In practice with those events,
@@ -957,73 +968,95 @@ void SymbianEngine::DoCancel()
ipCommsDB->CancelRequestNotification();
}
-
void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
{
QMutexLocker locker(&mutex);
switch (aEvent.EventType()) {
- case EConnMonCreateConnection:
+ case EConnMonConnectionStatusChange:
{
- CConnMonCreateConnection* realEvent;
- realEvent = (CConnMonCreateConnection*) &aEvent;
- TUint subConnectionCount = 0;
- TUint apId;
- TUint connectionId = realEvent->ConnectionId();
- TRequestStatus status;
- iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
- User::WaitForRequest(status);
- QString ident = QString::number(qHash(apId));
-
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
- if (ptr) {
- toSymbianConfig(ptr)->connectionId = connectionId;
- // Configuration is Active
- if (changeConfigurationStateTo(ptr, QNetworkConfiguration::Active))
- updateStatesToSnaps();
-
- if (!iOnline) {
- iOnline = true;
-
- locker.unlock();
- emit this->onlineStateChanged(iOnline);
- locker.relock();
+ CConnMonConnectionStatusChange* realEvent;
+ realEvent = (CConnMonConnectionStatusChange*) &aEvent;
+ TInt connectionStatus = realEvent->ConnectionStatus();
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNCM Connection status : " << QString::number(connectionStatus) << " , connection monitor Id : " << realEvent->ConnectionId();
+#endif
+ if (connectionStatus == KConfigDaemonStartingRegistration) {
+ TUint connectionId = realEvent->ConnectionId();
+ TUint subConnectionCount = 0;
+ TUint apId;
+ TRequestStatus status;
+ iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
+ User::WaitForRequest(status);
+ QString ident = QString::number(qHash(apId));
+ QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
+ if (ptr) {
+ QMutexLocker configLocker(&ptr->mutex);
+ toSymbianConfig(ptr)->connectionId = connectionId;
+ emit this->configurationStateChanged(toSymbianConfig(ptr)->numericId, connectionId, QNetworkSession::Connecting);
}
- }
- }
- break;
-
- case EConnMonDeleteConnection:
- {
- CConnMonDeleteConnection* realEvent;
- realEvent = (CConnMonDeleteConnection*) &aEvent;
- TUint connectionId = realEvent->ConnectionId();
-
- QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId);
- if (ptr) {
- toSymbianConfig(ptr)->connectionId = 0;
- // Configuration is either Defined or Discovered
- if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered))
- updateStatesToSnaps();
- }
-
- bool online = false;
- foreach (const QString &iface, accessPointConfigurations.keys()) {
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface);
- if (ptr->state == QNetworkConfiguration::Active) {
- online = true;
- break;
+ } else if (connectionStatus == KLinkLayerOpen) {
+ // Connection has been successfully opened
+ TUint connectionId = realEvent->ConnectionId();
+ TUint subConnectionCount = 0;
+ TUint apId;
+ TRequestStatus status;
+ iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
+ User::WaitForRequest(status);
+ QString ident = QString::number(qHash(apId));
+ QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
+ if (ptr) {
+ QMutexLocker configLocker(&ptr->mutex);
+ toSymbianConfig(ptr)->connectionId = connectionId;
+ // Configuration is Active
+ if (changeConfigurationStateTo(ptr, QNetworkConfiguration::Active)) {
+ updateStatesToSnaps();
+ }
+ emit this->configurationStateChanged(toSymbianConfig(ptr)->numericId, connectionId, QNetworkSession::Connected);
+ if (!iOnline) {
+ iOnline = true;
+ emit this->onlineStateChanged(iOnline);
+ }
}
- }
- if (iOnline != online) {
- iOnline = online;
+ } else if (connectionStatus == KConfigDaemonStartingDeregistration) {
+ TUint connectionId = realEvent->ConnectionId();
+ QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId);
+ if (ptr) {
+ QMutexLocker configLocker(&ptr->mutex);
+ emit this->configurationStateChanged(toSymbianConfig(ptr)->numericId, connectionId, QNetworkSession::Closing);
+ }
+ } else if (connectionStatus == KLinkLayerClosed ||
+ connectionStatus == KConnectionClosed) {
+ // Connection has been closed. Which of the above events is reported, depends on the Symbian
+ // platform.
+ TUint connectionId = realEvent->ConnectionId();
+ QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId);
+ if (ptr) {
+ // Configuration is either Defined or Discovered
+ if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) {
+ updateStatesToSnaps();
+ }
- locker.unlock();
- emit this->onlineStateChanged(iOnline);
- locker.relock();
+ QMutexLocker configLocker(&ptr->mutex);
+ emit this->configurationStateChanged(toSymbianConfig(ptr)->numericId, connectionId, QNetworkSession::Disconnected);
+ }
+
+ bool online = false;
+ foreach (const QString &iface, accessPointConfigurations.keys()) {
+ QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface);
+ QMutexLocker configLocker(&ptr->mutex);
+ if (ptr->state == QNetworkConfiguration::Active) {
+ online = true;
+ break;
+ }
+ }
+ if (iOnline != online) {
+ iOnline = online;
+ emit this->onlineStateChanged(iOnline);
+ }
}
}
- break;
+ break;
case EConnMonIapAvailabilityChange:
{
@@ -1051,21 +1084,78 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
}
break;
+ case EConnMonCreateConnection:
+ {
+ // This event is caught to keep connection monitor IDs up-to-date.
+ CConnMonCreateConnection* realEvent;
+ realEvent = (CConnMonCreateConnection*) &aEvent;
+ TUint subConnectionCount = 0;
+ TUint apId;
+ TUint connectionId = realEvent->ConnectionId();
+ TRequestStatus status;
+ iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status);
+ User::WaitForRequest(status);
+ QString ident = QString::number(qHash(apId));
+ QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
+ if (ptr) {
+ QMutexLocker configLocker(&ptr->mutex);
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNCM updating connection monitor ID : from, to, whose: " << toSymbianConfig(ptr)->connectionId << connectionId << ptr->name;
+#endif
+ toSymbianConfig(ptr)->connectionId = connectionId;
+ }
+ }
+ break;
default:
// For unrecognized events
break;
}
}
-// Waits for 1..4 seconds.
+// Sessions may use this function to report configuration state changes,
+// because on some Symbian platforms (especially Symbian^3) all state changes are not
+// reported by the RConnectionMonitor, in particular in relation to stop() call,
+// whereas they _are_ reported on RConnection progress notifier used by sessions --> centralize
+// this data here so that other sessions may benefit from it too (not all sessions necessarily have
+// RConnection progress notifiers available but they relay on having e.g. disconnected information from
+// manager). Currently only 'Disconnected' state is of interest because it has proven to be troublesome.
+void SymbianEngine::configurationStateChangeReport(TUint32 accessPointId, QNetworkSession::State newState)
+{
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNCM A session reported state change for IAP ID: " << accessPointId << " whose new state is: " << newState;
+#endif
+ switch (newState) {
+ case QNetworkSession::Disconnected:
+ {
+ QString ident = QString::number(qHash(accessPointId));
+ QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
+ if (ptr) {
+ // Configuration is either Defined or Discovered
+ if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) {
+ updateStatesToSnaps();
+ }
+
+ QMutexLocker configLocker(&ptr->mutex);
+ emit this->configurationStateChanged(toSymbianConfig(ptr)->numericId,
+ toSymbianConfig(ptr)->connectionId,
+ QNetworkSession::Disconnected);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+// Waits for 2..6 seconds.
void SymbianEngine::waitRandomTime()
{
- iTimeToWait = (qAbs(qrand()) % 5) * 1000;
- if (iTimeToWait < 1000) {
- iTimeToWait = 1000;
+ iTimeToWait = (qAbs(qrand()) % 7) * 1000;
+ if (iTimeToWait < 2000) {
+ iTimeToWait = 2000;
}
-#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG
- qDebug("QNetworkConfigurationManager waiting random time: %d ms", iTimeToWait);
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug("QNCM waiting random time: %d ms", iTimeToWait);
#endif
QTimer::singleShot(iTimeToWait, iIgnoreEventLoop, SLOT(quit()));
iIgnoreEventLoop->exec();
@@ -1076,11 +1166,11 @@ QNetworkConfigurationPrivatePointer SymbianEngine::dataByConnectionId(TUint aCon
QMutexLocker locker(&mutex);
QNetworkConfiguration item;
-
QHash<QString, QNetworkConfigurationPrivatePointer>::const_iterator i =
accessPointConfigurations.constBegin();
while (i != accessPointConfigurations.constEnd()) {
QNetworkConfigurationPrivatePointer ptr = i.value();
+ QMutexLocker configLocker(&ptr->mutex);
if (toSymbianConfig(ptr)->connectionId == aConnectionId)
return ptr;
diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h
index afb37dea8e..7d565db58e 100644
--- a/src/plugins/bearer/symbian/symbianengine.h
+++ b/src/plugins/bearer/symbian/symbianengine.h
@@ -52,6 +52,9 @@
#include <cmmanager.h>
#endif
+// Uncomment and compile QtBearer to gain detailed state tracing
+// #define QT_BEARERMGMT_SYMBIAN_DEBUG
+
class CCommsDatabase;
class QEventLoop;
@@ -90,7 +93,18 @@ public:
Bearer bearer;
+ // So called IAP id from the platform. Remains constant as long as the
+ // platform is aware of the configuration ie. it is stored in the databases
+ // --> does not depend on whether connections are currently open or not.
+ // In practice is the same for the lifetime of the QNetworkConfiguration.
TUint32 numericId;
+ // So called connection id, or connection monitor ID. A dynamic ID assigned
+ // by RConnectionMonitor whenever a new connection is opened. ConnectionID and
+ // numericId/IAP id have 1-to-1 mapping during the lifetime of the connection at
+ // connection monitor. Notably however it changes whenever a new connection to
+ // a given IAP is created. In a sense it is constant during the time the
+ // configuration remains between states Discovered..Active..Discovered, do not
+ // however relay on this.
TUint connectionId;
};
@@ -124,6 +138,9 @@ public:
Q_SIGNALS:
void onlineStateChanged(bool isOnline);
+ void configurationStateChanged(TUint32 accessPointId, TUint32 connMonId,
+ QNetworkSession::State newState);
+
public Q_SLOTS:
void updateConfigurations();
@@ -157,12 +174,17 @@ private:
void startMonitoringIAPData(TUint32 aIapId);
QNetworkConfigurationPrivatePointer dataByConnectionId(TUint aConnectionId);
-protected: // From CActive
+protected:
+ // From CActive
void RunL();
void DoCancel();
-private: // MConnectionMonitorObserver
+private:
+ // MConnectionMonitorObserver
void EventL(const CConnMonEventBase& aEvent);
+ // For QNetworkSessionPrivate to indicate about state changes
+ void configurationStateChangeReport(TUint32 accessPointId,
+ QNetworkSession::State newState);
private: // Data
bool iFirstUpdate;
@@ -181,6 +203,7 @@ private: // Data
friend class QNetworkSessionPrivate;
friend class AccessPointsAvailabilityScanner;
+ friend class QNetworkSessionPrivateImpl;
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
RCmManager iCmManager;
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
index 25d3dfa240..8abc2d1eea 100644
--- a/src/plugins/imageformats/gif/qgifhandler.cpp
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
@@ -1119,8 +1119,11 @@ bool QGifHandler::write(const QImage &image)
bool QGifHandler::supportsOption(ImageOption option) const
{
- return option == Size
- || option == Animation;
+ if (!device() || device()->isSequential())
+ return option == Animation;
+ else
+ return option == Size
+ || option == Animation;
}
QVariant QGifHandler::option(ImageOption option) const
diff --git a/src/plugins/mediaservices/mediaservices.pro b/src/plugins/mediaservices/mediaservices.pro
index 27f05bcb71..0f0b0219e0 100644
--- a/src/plugins/mediaservices/mediaservices.pro
+++ b/src/plugins/mediaservices/mediaservices.pro
@@ -9,5 +9,7 @@ contains(QT_CONFIG, media-backend) {
SUBDIRS += gstreamer
}
- symbian:SUBDIRS += symbian
+ symbian:contains(QT_CONFIG, audio-routing-available) {
+ SUBDIRS += symbian
+ }
}
diff --git a/src/plugins/mediaservices/symbian/mediaplayer/s60audioplayersession.h b/src/plugins/mediaservices/symbian/mediaplayer/s60audioplayersession.h
index d7259b9c5e..f25b72249f 100644
--- a/src/plugins/mediaservices/symbian/mediaplayer/s60audioplayersession.h
+++ b/src/plugins/mediaservices/symbian/mediaplayer/s60audioplayersession.h
@@ -49,7 +49,7 @@ typedef CMdaAudioPlayerUtility CAudioPlayer;
typedef MMdaAudioPlayerCallback MAudioPlayerObserver;
#ifndef HAS_NO_AUDIOROUTING
-#include <AudioOutput.h>
+#include <phonon/audiooutput.h>
#include <MAudioOutputObserver.h>
#endif
diff --git a/src/plugins/mediaservices/symbian/mediaplayer/s60videoplayersession.h b/src/plugins/mediaservices/symbian/mediaplayer/s60videoplayersession.h
index 52e311ab70..9aece61a1a 100644
--- a/src/plugins/mediaservices/symbian/mediaplayer/s60videoplayersession.h
+++ b/src/plugins/mediaservices/symbian/mediaplayer/s60videoplayersession.h
@@ -48,8 +48,7 @@
#include <QtGui/qwidget.h>
#include <qvideowidget.h>
-#include <AudioOutput.h>
-#include <MAudioOutputObserver.h>
+#include <phonon/audiooutput.h>
QT_BEGIN_NAMESPACE
diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def
index e309e25d99..13b8157c78 100644
--- a/src/s60installs/bwins/QtCoreu.def
+++ b/src/s60installs/bwins/QtCoreu.def
@@ -4463,4 +4463,6 @@ EXPORTS
?parentChanged@QAbstractDeclarativeData@@2P6AXPAV1@PAVQObject@@1@ZA @ 4462 NONAME ; void (*QAbstractDeclarativeData::parentChanged)(class QAbstractDeclarativeData *, class QObject *, class QObject *)
?destroyed@QAbstractDeclarativeData@@2P6AXPAV1@PAVQObject@@@ZA @ 4463 NONAME ; void (*QAbstractDeclarativeData::destroyed)(class QAbstractDeclarativeData *, class QObject *)
?selectThread@QEventDispatcherSymbian@@AAEAAVQSelectThread@@XZ @ 4464 NONAME ; class QSelectThread & QEventDispatcherSymbian::selectThread(void)
+ ?setRawData@QByteArray@@QAEAAV1@PBDI@Z @ 4465 NONAME ; class QByteArray & QByteArray::setRawData(char const *, unsigned int)
+ ?setRawData@QString@@QAEAAV1@PBVQChar@@H@Z @ 4466 NONAME ; class QString & QString::setRawData(class QChar const *, int)
diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def
index 5f05f08f7e..18372a4a79 100644
--- a/src/s60installs/bwins/QtDeclarativeu.def
+++ b/src/s60installs/bwins/QtDeclarativeu.def
@@ -581,7 +581,7 @@ EXPORTS
?advance@QDeclarativeParticleMotionWander@@UAEXAAVQDeclarativeParticle@@H@Z @ 580 NONAME ABSENT ; void QDeclarativeParticleMotionWander::advance(class QDeclarativeParticle &, int)
?alert@QDeclarativeWebView@@IAEXABVQString@@@Z @ 581 NONAME ABSENT ; void QDeclarativeWebView::alert(class QString const &)
?alternateBase@QDeclarativeSystemPalette@@QBE?AVQColor@@XZ @ 582 NONAME ; class QColor QDeclarativeSystemPalette::alternateBase(void) const
- ?anchors@QDeclarativeItem@@QAEPAVQDeclarativeAnchors@@XZ @ 583 NONAME ; class QDeclarativeAnchors * QDeclarativeItem::anchors(void)
+ ?anchors@QDeclarativeItem@@QAEPAVQDeclarativeAnchors@@XZ @ 583 NONAME ABSENT ; class QDeclarativeAnchors * QDeclarativeItem::anchors(void)
?angle@QDeclarativeParticles@@QBEMXZ @ 584 NONAME ABSENT ; float QDeclarativeParticles::angle(void) const
?angleChanged@QDeclarativeParticles@@IAEXXZ @ 585 NONAME ABSENT ; void QDeclarativeParticles::angleChanged(void)
?angleDeviation@QDeclarativeParticles@@QBEMXZ @ 586 NONAME ABSENT ; float QDeclarativeParticles::angleDeviation(void) const
@@ -647,7 +647,7 @@ EXPORTS
?buildObject@QDeclarativeCompiler@@AAE_NPAVObject@QDeclarativeParser@@ABUBindingContext@1@@Z @ 646 NONAME ; bool QDeclarativeCompiler::buildObject(class QDeclarativeParser::Object *, struct QDeclarativeCompiler::BindingContext const &)
?buildProperty@QDeclarativeCompiler@@AAE_NPAVProperty@QDeclarativeParser@@PAVObject@3@ABUBindingContext@1@@Z @ 647 NONAME ; bool QDeclarativeCompiler::buildProperty(class QDeclarativeParser::Property *, class QDeclarativeParser::Object *, struct QDeclarativeCompiler::BindingContext const &)
?buildPropertyAssignment@QDeclarativeCompiler@@AAE_NPAVProperty@QDeclarativeParser@@PAVObject@3@ABUBindingContext@1@@Z @ 648 NONAME ; bool QDeclarativeCompiler::buildPropertyAssignment(class QDeclarativeParser::Property *, class QDeclarativeParser::Object *, struct QDeclarativeCompiler::BindingContext const &)
- ?buildPropertyInNamespace@QDeclarativeCompiler@@AAE_NPAUImportedNamespace@QDeclarativeEnginePrivate@@PAVProperty@QDeclarativeParser@@PAVObject@5@ABUBindingContext@1@@Z @ 649 NONAME ; bool QDeclarativeCompiler::buildPropertyInNamespace(struct QDeclarativeEnginePrivate::ImportedNamespace *, class QDeclarativeParser::Property *, class QDeclarativeParser::Object *, struct QDeclarativeCompiler::BindingContext const &)
+ ?buildPropertyInNamespace@QDeclarativeCompiler@@AAE_NPAUImportedNamespace@QDeclarativeEnginePrivate@@PAVProperty@QDeclarativeParser@@PAVObject@5@ABUBindingContext@1@@Z @ 649 NONAME ABSENT ; bool QDeclarativeCompiler::buildPropertyInNamespace(struct QDeclarativeEnginePrivate::ImportedNamespace *, class QDeclarativeParser::Property *, class QDeclarativeParser::Object *, struct QDeclarativeCompiler::BindingContext const &)
?buildPropertyLiteralAssignment@QDeclarativeCompiler@@AAE_NPAVProperty@QDeclarativeParser@@PAVObject@3@PAVValue@3@ABUBindingContext@1@@Z @ 650 NONAME ; bool QDeclarativeCompiler::buildPropertyLiteralAssignment(class QDeclarativeParser::Property *, class QDeclarativeParser::Object *, class QDeclarativeParser::Value *, struct QDeclarativeCompiler::BindingContext const &)
?buildPropertyObjectAssignment@QDeclarativeCompiler@@AAE_NPAVProperty@QDeclarativeParser@@PAVObject@3@PAVValue@3@ABUBindingContext@1@@Z @ 651 NONAME ; bool QDeclarativeCompiler::buildPropertyObjectAssignment(class QDeclarativeParser::Property *, class QDeclarativeParser::Object *, class QDeclarativeParser::Value *, struct QDeclarativeCompiler::BindingContext const &)
?buildScript@QDeclarativeCompiler@@AAE_NPAVObject@QDeclarativeParser@@0@Z @ 652 NONAME ABSENT ; bool QDeclarativeCompiler::buildScript(class QDeclarativeParser::Object *, class QDeclarativeParser::Object *)
@@ -693,7 +693,7 @@ EXPORTS
?classBegin@QDeclarativeDateTimeFormatter@@UAEXXZ @ 692 NONAME ABSENT ; void QDeclarativeDateTimeFormatter::classBegin(void)
?classBegin@QDeclarativeItem@@MAEXXZ @ 693 NONAME ; void QDeclarativeItem::classBegin(void)
?classBegin@QDeclarativeNumberFormatter@@UAEXXZ @ 694 NONAME ABSENT ; void QDeclarativeNumberFormatter::classBegin(void)
- ?classBegin@QDeclarativeParserStatus@@UAEXXZ @ 695 NONAME ; void QDeclarativeParserStatus::classBegin(void)
+ ?classBegin@QDeclarativeParserStatus@@UAEXXZ @ 695 NONAME ABSENT ; void QDeclarativeParserStatus::classBegin(void)
?classBegin@QDeclarativeStateGroup@@UAEXXZ @ 696 NONAME ; void QDeclarativeStateGroup::classBegin(void)
?classBegin@QDeclarativeTimer@@MAEXXZ @ 697 NONAME ; void QDeclarativeTimer::classBegin(void)
?classBegin@QDeclarativeXmlListModel@@UAEXXZ @ 698 NONAME ; void QDeclarativeXmlListModel::classBegin(void)
@@ -754,7 +754,7 @@ EXPORTS
?componentComplete@QDeclarativeItem@@MAEXXZ @ 753 NONAME ; void QDeclarativeItem::componentComplete(void)
?componentComplete@QDeclarativeListView@@MAEXXZ @ 754 NONAME ; void QDeclarativeListView::componentComplete(void)
?componentComplete@QDeclarativeNumberFormatter@@UAEXXZ @ 755 NONAME ABSENT ; void QDeclarativeNumberFormatter::componentComplete(void)
- ?componentComplete@QDeclarativeParserStatus@@UAEXXZ @ 756 NONAME ; void QDeclarativeParserStatus::componentComplete(void)
+ ?componentComplete@QDeclarativeParserStatus@@UAEXXZ @ 756 NONAME ABSENT ; void QDeclarativeParserStatus::componentComplete(void)
?componentComplete@QDeclarativeParticles@@MAEXXZ @ 757 NONAME ABSENT ; void QDeclarativeParticles::componentComplete(void)
?componentComplete@QDeclarativePath@@MAEXXZ @ 758 NONAME ; void QDeclarativePath::componentComplete(void)
?componentComplete@QDeclarativePathView@@MAEXXZ @ 759 NONAME ; void QDeclarativePathView::componentComplete(void)
@@ -1369,7 +1369,7 @@ EXPORTS
?indexOfSignal@QMetaObjectBuilder@@QAEHABVQByteArray@@@Z @ 1368 NONAME ; int QMetaObjectBuilder::indexOfSignal(class QByteArray const &)
?indexOfSlot@QMetaObjectBuilder@@QAEHABVQByteArray@@@Z @ 1369 NONAME ; int QMetaObjectBuilder::indexOfSlot(class QByteArray const &)
?init@QDeclarativeContextPrivate@@QAEXXZ @ 1370 NONAME ABSENT ; void QDeclarativeContextPrivate::init(void)
- ?init@QDeclarativePaintedItem@@AAEXXZ @ 1371 NONAME ; void QDeclarativePaintedItem::init(void)
+ ?init@QDeclarativePaintedItem@@AAEXXZ @ 1371 NONAME ABSENT ; void QDeclarativePaintedItem::init(void)
?init@QDeclarativeWebView@@AAEXXZ @ 1372 NONAME ABSENT ; void QDeclarativeWebView::init(void)
?initialLayout@QDeclarativeWebView@@AAEXXZ @ 1373 NONAME ABSENT ; void QDeclarativeWebView::initialLayout(void)
?initialValue@QDeclarativeOpenMetaObject@@UAE?AVQVariant@@H@Z @ 1374 NONAME ; class QVariant QDeclarativeOpenMetaObject::initialValue(int)
@@ -2214,9 +2214,9 @@ EXPORTS
?resetVerticalCenter@QDeclarativeAnchors@@QAEXXZ @ 2213 NONAME ; void QDeclarativeAnchors::resetVerticalCenter(void)
?resetWidth@QDeclarativeItem@@QAEXXZ @ 2214 NONAME ; void QDeclarativeItem::resetWidth(void)
?resizeEvent@QDeclarativeView@@MAEXPAVQResizeEvent@@@Z @ 2215 NONAME ; void QDeclarativeView::resizeEvent(class QResizeEvent *)
- ?resizeMode@QDeclarativeLoader@@QBE?AW4ResizeMode@1@XZ @ 2216 NONAME ; enum QDeclarativeLoader::ResizeMode QDeclarativeLoader::resizeMode(void) const
+ ?resizeMode@QDeclarativeLoader@@QBE?AW4ResizeMode@1@XZ @ 2216 NONAME ABSENT ; enum QDeclarativeLoader::ResizeMode QDeclarativeLoader::resizeMode(void) const
?resizeMode@QDeclarativeView@@QBE?AW4ResizeMode@1@XZ @ 2217 NONAME ; enum QDeclarativeView::ResizeMode QDeclarativeView::resizeMode(void) const
- ?resizeModeChanged@QDeclarativeLoader@@IAEXXZ @ 2218 NONAME ; void QDeclarativeLoader::resizeModeChanged(void)
+ ?resizeModeChanged@QDeclarativeLoader@@IAEXXZ @ 2218 NONAME ABSENT ; void QDeclarativeLoader::resizeModeChanged(void)
?resolvedUrl@QDeclarativeContext@@QAE?AVQUrl@@ABV2@@Z @ 2219 NONAME ; class QUrl QDeclarativeContext::resolvedUrl(class QUrl const &)
?resources@QDeclarativeItem@@QAE?AU?$QDeclarativeListProperty@VQObject@@@@XZ @ 2220 NONAME ABSENT ; struct QDeclarativeListProperty<class QObject> QDeclarativeItem::resources(void)
?restart@QDeclarativeTimer@@QAEXXZ @ 2221 NONAME ; void QDeclarativeTimer::restart(void)
@@ -2542,7 +2542,7 @@ EXPORTS
?setRepeating@QDeclarativeTimer@@QAEX_N@Z @ 2541 NONAME ; void QDeclarativeTimer::setRepeating(bool)
?setReset@QDeclarativeAnchorChanges@@QAEXABVQString@@@Z @ 2542 NONAME ABSENT ; void QDeclarativeAnchorChanges::setReset(class QString const &)
?setResettable@QMetaPropertyBuilder@@QAEX_N@Z @ 2543 NONAME ; void QMetaPropertyBuilder::setResettable(bool)
- ?setResizeMode@QDeclarativeLoader@@QAEXW4ResizeMode@1@@Z @ 2544 NONAME ; void QDeclarativeLoader::setResizeMode(enum QDeclarativeLoader::ResizeMode)
+ ?setResizeMode@QDeclarativeLoader@@QAEXW4ResizeMode@1@@Z @ 2544 NONAME ABSENT ; void QDeclarativeLoader::setResizeMode(enum QDeclarativeLoader::ResizeMode)
?setResizeMode@QDeclarativeView@@QAEXW4ResizeMode@1@@Z @ 2545 NONAME ; void QDeclarativeView::setResizeMode(enum QDeclarativeView::ResizeMode)
?setRestoreEntryValues@QDeclarativePropertyChanges@@QAEX_N@Z @ 2546 NONAME ; void QDeclarativePropertyChanges::setRestoreEntryValues(bool)
?setReturnType@QMetaMethodBuilder@@QAEXABVQByteArray@@@Z @ 2547 NONAME ; void QMetaMethodBuilder::setReturnType(class QByteArray const &)
@@ -2595,7 +2595,7 @@ EXPORTS
?setStartY@QDeclarativePath@@QAEXM@Z @ 2594 NONAME ; void QDeclarativePath::setStartY(float)
?setState@QDeclarativeDebugQuery@@AAEXW4State@1@@Z @ 2595 NONAME ; void QDeclarativeDebugQuery::setState(enum QDeclarativeDebugQuery::State)
?setState@QDeclarativeDebugWatch@@AAEXW4State@1@@Z @ 2596 NONAME ; void QDeclarativeDebugWatch::setState(enum QDeclarativeDebugWatch::State)
- ?setState@QDeclarativeItem@@QAEXABVQString@@@Z @ 2597 NONAME ; void QDeclarativeItem::setState(class QString const &)
+ ?setState@QDeclarativeItem@@QAEXABVQString@@@Z @ 2597 NONAME ABSENT ; void QDeclarativeItem::setState(class QString const &)
?setState@QDeclarativeStateGroup@@QAEXABVQString@@@Z @ 2598 NONAME ; void QDeclarativeStateGroup::setState(class QString const &)
?setStateGroup@QDeclarativeState@@QAEXPAVQDeclarativeStateGroup@@@Z @ 2599 NONAME ; void QDeclarativeState::setStateGroup(class QDeclarativeStateGroup *)
?setStaticMetacallFunction@QMetaObjectBuilder@@QAEXP6AHW4Call@QMetaObject@@HPAPAX@Z@Z @ 2600 NONAME ; void QMetaObjectBuilder::setStaticMetacallFunction(int (*)(enum QMetaObject::Call, int, void * *))
@@ -2714,7 +2714,7 @@ EXPORTS
?startY@QDeclarativePath@@QBEMXZ @ 2713 NONAME ; float QDeclarativePath::startY(void) const
?state@QDeclarativeDebugQuery@@QBE?AW4State@1@XZ @ 2714 NONAME ; enum QDeclarativeDebugQuery::State QDeclarativeDebugQuery::state(void) const
?state@QDeclarativeDebugWatch@@QBE?AW4State@1@XZ @ 2715 NONAME ; enum QDeclarativeDebugWatch::State QDeclarativeDebugWatch::state(void) const
- ?state@QDeclarativeItem@@QBE?AVQString@@XZ @ 2716 NONAME ; class QString QDeclarativeItem::state(void) const
+ ?state@QDeclarativeItem@@QBE?AVQString@@XZ @ 2716 NONAME ABSENT ; class QString QDeclarativeItem::state(void) const
?state@QDeclarativeStateGroup@@QBE?AVQString@@XZ @ 2717 NONAME ; class QString QDeclarativeStateGroup::state(void) const
?stateChanged@QDeclarativeDebugQuery@@IAEXW4State@1@@Z @ 2718 NONAME ; void QDeclarativeDebugQuery::stateChanged(enum QDeclarativeDebugQuery::State)
?stateChanged@QDeclarativeDebugWatch@@IAEXW4State@1@@Z @ 2719 NONAME ; void QDeclarativeDebugWatch::stateChanged(enum QDeclarativeDebugWatch::State)
@@ -3576,7 +3576,7 @@ EXPORTS
?d_func@QDeclarativeSmoothedAnimation@@ABEPBVQDeclarativeSmoothedAnimationPrivate@@XZ @ 3575 NONAME ; class QDeclarativeSmoothedAnimationPrivate const * QDeclarativeSmoothedAnimation::d_func(void) const
?d_func@QDeclarativeTranslate@@AAEPAVQDeclarativeTranslatePrivate@@XZ @ 3576 NONAME ; class QDeclarativeTranslatePrivate * QDeclarativeTranslate::d_func(void)
?d_func@QDeclarativeTranslate@@ABEPBVQDeclarativeTranslatePrivate@@XZ @ 3577 NONAME ; class QDeclarativeTranslatePrivate const * QDeclarativeTranslate::d_func(void) const
- ?data@QDeclarativeItem@@QAE?AV?$QDeclarativeListProperty@VQObject@@@@XZ @ 3578 NONAME ; class QDeclarativeListProperty<class QObject> QDeclarativeItem::data(void)
+ ?data@QDeclarativeItem@@QAE?AV?$QDeclarativeListProperty@VQObject@@@@XZ @ 3578 NONAME ABSENT ; class QDeclarativeListProperty<class QObject> QDeclarativeItem::data(void)
?dataCleared@QDeclarativeXmlListModel@@AAEXXZ @ 3579 NONAME ; void QDeclarativeXmlListModel::dataCleared(void)
?data_append@QDeclarativeItemPrivate@@SAXPAV?$QDeclarativeListProperty@VQObject@@@@PAVQObject@@@Z @ 3580 NONAME ; void QDeclarativeItemPrivate::data_append(class QDeclarativeListProperty<class QObject> *, class QObject *)
?delegateChanged@QDeclarativeGridView@@IAEXXZ @ 3581 NONAME ; void QDeclarativeGridView::delegateChanged(void)
@@ -3707,7 +3707,7 @@ EXPORTS
?request@QDeclarativePixmapCache@@SAPAVQDeclarativePixmapReply@@PAVQDeclarativeEngine@@ABVQUrl@@HH@Z @ 3706 NONAME ; class QDeclarativePixmapReply * QDeclarativePixmapCache::request(class QDeclarativeEngine *, class QUrl const &, int, int)
?resetHeight@QDeclarativeItemPrivate@@UAEXXZ @ 3707 NONAME ; void QDeclarativeItemPrivate::resetHeight(void)
?resetWidth@QDeclarativeItemPrivate@@UAEXXZ @ 3708 NONAME ; void QDeclarativeItemPrivate::resetWidth(void)
- ?resources@QDeclarativeItem@@QAE?AV?$QDeclarativeListProperty@VQObject@@@@XZ @ 3709 NONAME ; class QDeclarativeListProperty<class QObject> QDeclarativeItem::resources(void)
+ ?resources@QDeclarativeItem@@QAE?AV?$QDeclarativeListProperty@VQObject@@@@XZ @ 3709 NONAME ABSENT ; class QDeclarativeListProperty<class QObject> QDeclarativeItem::resources(void)
?resources_append@QDeclarativeItemPrivate@@SAXPAV?$QDeclarativeListProperty@VQObject@@@@PAVQObject@@@Z @ 3710 NONAME ; void QDeclarativeItemPrivate::resources_append(class QDeclarativeListProperty<class QObject> *, class QObject *)
?resources_at@QDeclarativeItemPrivate@@SAPAVQObject@@PAV?$QDeclarativeListProperty@VQObject@@@@H@Z @ 3711 NONAME ; class QObject * QDeclarativeItemPrivate::resources_at(class QDeclarativeListProperty<class QObject> *, int)
?resources_count@QDeclarativeItemPrivate@@SAHPAV?$QDeclarativeListProperty@VQObject@@@@@Z @ 3712 NONAME ; int QDeclarativeItemPrivate::resources_count(class QDeclarativeListProperty<class QObject> *)
@@ -3771,8 +3771,8 @@ EXPORTS
?start@QDeclarativeItemPrivate@@SAXAAVQTime@@@Z @ 3770 NONAME ; void QDeclarativeItemPrivate::start(class QTime &)
?startXChanged@QDeclarativePath@@IAEXXZ @ 3771 NONAME ; void QDeclarativePath::startXChanged(void)
?startYChanged@QDeclarativePath@@IAEXXZ @ 3772 NONAME ; void QDeclarativePath::startYChanged(void)
- ?states@QDeclarativeItem@@QAE?AV?$QDeclarativeListProperty@VQDeclarativeState@@@@XZ @ 3773 NONAME ; class QDeclarativeListProperty<class QDeclarativeState> QDeclarativeItem::states(void)
- ?states@QDeclarativeItemPrivate@@QAEPAVQDeclarativeStateGroup@@XZ @ 3774 NONAME ; class QDeclarativeStateGroup * QDeclarativeItemPrivate::states(void)
+ ?states@QDeclarativeItem@@QAE?AV?$QDeclarativeListProperty@VQDeclarativeState@@@@XZ @ 3773 NONAME ABSENT ; class QDeclarativeListProperty<class QDeclarativeState> QDeclarativeItem::states(void)
+ ?states@QDeclarativeItemPrivate@@QAEPAVQDeclarativeStateGroup@@XZ @ 3774 NONAME ABSENT ; class QDeclarativeStateGroup * QDeclarativeItemPrivate::states(void)
?statesProperty@QDeclarativeStateGroup@@QAE?AV?$QDeclarativeListProperty@VQDeclarativeState@@@@XZ @ 3775 NONAME ; class QDeclarativeListProperty<class QDeclarativeState> QDeclarativeStateGroup::statesProperty(void)
?stops@QDeclarativeGradient@@QAE?AV?$QDeclarativeListProperty@VQDeclarativeGradientStop@@@@XZ @ 3776 NONAME ; class QDeclarativeListProperty<class QDeclarativeGradientStop> QDeclarativeGradient::stops(void)
?subFocusItemChange@QDeclarativeItemPrivate@@UAEXXZ @ 3777 NONAME ; void QDeclarativeItemPrivate::subFocusItemChange(void)
@@ -3799,7 +3799,7 @@ EXPORTS
?transform_clear@QDeclarativeItemPrivate@@SAXPAV?$QDeclarativeListProperty@VQGraphicsTransform@@@@@Z @ 3798 NONAME ; void QDeclarativeItemPrivate::transform_clear(class QDeclarativeListProperty<class QGraphicsTransform> *)
?transform_count@QDeclarativeItemPrivate@@SAHPAV?$QDeclarativeListProperty@VQGraphicsTransform@@@@@Z @ 3799 NONAME ; int QDeclarativeItemPrivate::transform_count(class QDeclarativeListProperty<class QGraphicsTransform> *)
?transition@QDeclarativeSmoothedAnimation@@UAEXAAV?$QList@VQDeclarativeAction@@@@AAV?$QList@VQDeclarativeProperty@@@@W4TransitionDirection@QDeclarativeAbstractAnimation@@@Z @ 3800 NONAME ; void QDeclarativeSmoothedAnimation::transition(class QList<class QDeclarativeAction> &, class QList<class QDeclarativeProperty> &, enum QDeclarativeAbstractAnimation::TransitionDirection)
- ?transitions@QDeclarativeItem@@QAE?AV?$QDeclarativeListProperty@VQDeclarativeTransition@@@@XZ @ 3801 NONAME ; class QDeclarativeListProperty<class QDeclarativeTransition> QDeclarativeItem::transitions(void)
+ ?transitions@QDeclarativeItem@@QAE?AV?$QDeclarativeListProperty@VQDeclarativeTransition@@@@XZ @ 3801 NONAME ABSENT ; class QDeclarativeListProperty<class QDeclarativeTransition> QDeclarativeItem::transitions(void)
?transitionsProperty@QDeclarativeStateGroup@@QAE?AV?$QDeclarativeListProperty@VQDeclarativeTransition@@@@XZ @ 3802 NONAME ; class QDeclarativeListProperty<class QDeclarativeTransition> QDeclarativeStateGroup::transitionsProperty(void)
?triggeredOnStartChanged@QDeclarativeTimer@@IAEXXZ @ 3803 NONAME ; void QDeclarativeTimer::triggeredOnStartChanged(void)
?type@Variant@QDeclarativeParser@@QBE?AW4Type@12@XZ @ 3804 NONAME ; enum QDeclarativeParser::Variant::Type QDeclarativeParser::Variant::type(void) const
@@ -3920,7 +3920,7 @@ EXPORTS
?execute@QDeclarativeParentChange@@UAEXW4Reason@QDeclarativeActionEvent@@@Z @ 3919 NONAME ; void QDeclarativeParentChange::execute(enum QDeclarativeActionEvent::Reason)
?resetSourceComponent@QDeclarativeLoader@@QAEXXZ @ 3920 NONAME ; void QDeclarativeLoader::resetSourceComponent(void)
?rootIndex@QDeclarativeVisualDataModel@@QBE?AVQVariant@@XZ @ 3921 NONAME ; class QVariant QDeclarativeVisualDataModel::rootIndex(void) const
- ?createObject@QDeclarativeComponent@@IAE?AVQScriptValue@@XZ @ 3922 NONAME ; class QScriptValue QDeclarativeComponent::createObject(void)
+ ?createObject@QDeclarativeComponent@@IAE?AVQScriptValue@@XZ @ 3922 NONAME ABSENT ; class QScriptValue QDeclarativeComponent::createObject(void)
?execute@QDeclarativeStateChangeScript@@UAEXW4Reason@QDeclarativeActionEvent@@@Z @ 3923 NONAME ; void QDeclarativeStateChangeScript::execute(enum QDeclarativeActionEvent::Reason)
?active@QDeclarativeDrag@@QBE_NXZ @ 3924 NONAME ; bool QDeclarativeDrag::active(void) const
?retransformBack@QDeclarativeFlipable@@AAEXXZ @ 3925 NONAME ; void QDeclarativeFlipable::retransformBack(void)
@@ -3955,4 +3955,43 @@ EXPORTS
?parentModelIndex@QDeclarativeVisualDataModel@@QBE?AVQVariant@@XZ @ 3954 NONAME ; class QVariant QDeclarativeVisualDataModel::parentModelIndex(void) const
?usedAnchors@QDeclarativeAnchors@@QBE?AV?$QFlags@W4Anchor@QDeclarativeAnchors@@@@XZ @ 3955 NONAME ; class QFlags<enum QDeclarativeAnchors::Anchor> QDeclarativeAnchors::usedAnchors(void) const
?eventFilter@QDeclarativeView@@MAE_NPAVQObject@@PAVQEvent@@@Z @ 3956 NONAME ; bool QDeclarativeView::eventFilter(class QObject *, class QEvent *)
+ ??0QDeclarativeInfo@@AAE@PAVQDeclarativeInfoPrivate@@@Z @ 3957 NONAME ; QDeclarativeInfo::QDeclarativeInfo(class QDeclarativeInfoPrivate *)
+ ?_states@QDeclarativeItemPrivate@@QAEPAVQDeclarativeStateGroup@@XZ @ 3958 NONAME ; class QDeclarativeStateGroup * QDeclarativeItemPrivate::_states(void)
+ ?baseline@QDeclarativeItemPrivate@@QBE?AVQDeclarativeAnchorLine@@XZ @ 3959 NONAME ; class QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline(void) const
+ ?bottom@QDeclarativeItemPrivate@@QBE?AVQDeclarativeAnchorLine@@XZ @ 3960 NONAME ; class QDeclarativeAnchorLine QDeclarativeItemPrivate::bottom(void) const
+ ?buildPropertyInNamespace@QDeclarativeCompiler@@AAE_NPAVQDeclarativeImportedNamespace@@PAVProperty@QDeclarativeParser@@PAVObject@4@ABUBindingContext@1@@Z @ 3961 NONAME ; bool QDeclarativeCompiler::buildPropertyInNamespace(class QDeclarativeImportedNamespace *, class QDeclarativeParser::Property *, class QDeclarativeParser::Object *, struct QDeclarativeCompiler::BindingContext const &)
+ ?canceled@QDeclarativeMouseArea@@IAEXXZ @ 3962 NONAME ; void QDeclarativeMouseArea::canceled(void)
+ ?classBegin@QDeclarativeBind@@MAEXXZ @ 3963 NONAME ; void QDeclarativeBind::classBegin(void)
+ ?classBegin@QDeclarativeConnections@@EAEXXZ @ 3964 NONAME ; void QDeclarativeConnections::classBegin(void)
+ ?classBegin@QDeclarativePath@@MAEXXZ @ 3965 NONAME ; void QDeclarativePath::classBegin(void)
+ ?classBegin@QDeclarativeWorkerScript@@MAEXXZ @ 3966 NONAME ; void QDeclarativeWorkerScript::classBegin(void)
+ ?completePending@QDeclarativeVisualDataModel@@UBE_NXZ @ 3967 NONAME ; bool QDeclarativeVisualDataModel::completePending(void) const
+ ?completePending@QDeclarativeVisualItemModel@@UBE_NXZ @ 3968 NONAME ; bool QDeclarativeVisualItemModel::completePending(void) const
+ ?componentFinalized@QDeclarativeBehavior@@AAEXXZ @ 3969 NONAME ; void QDeclarativeBehavior::componentFinalized(void)
+ ?createObject@QDeclarativeComponent@@IAE?AVQScriptValue@@PAVQObject@@@Z @ 3970 NONAME ; class QScriptValue QDeclarativeComponent::createObject(class QObject *)
+ ?data@QDeclarativeItemPrivate@@QAE?AV?$QDeclarativeListProperty@VQObject@@@@XZ @ 3971 NONAME ; class QDeclarativeListProperty<class QObject> QDeclarativeItemPrivate::data(void)
+ ?engine@QDeclarativeWorkerScript@@AAEPAVQDeclarativeWorkerScriptEngine@@XZ @ 3972 NONAME ; class QDeclarativeWorkerScriptEngine * QDeclarativeWorkerScript::engine(void)
+ ?geometryChanged@QDeclarativePaintedItem@@MAEXABVQRectF@@0@Z @ 3973 NONAME ; void QDeclarativePaintedItem::geometryChanged(class QRectF const &, class QRectF const &)
+ ?get@QDeclarativeItemPrivate@@SAPAV1@PAVQDeclarativeItem@@@Z @ 3974 NONAME ; class QDeclarativeItemPrivate * QDeclarativeItemPrivate::get(class QDeclarativeItem *)
+ ?horizontalCenter@QDeclarativeItemPrivate@@QBE?AVQDeclarativeAnchorLine@@XZ @ 3975 NONAME ; class QDeclarativeAnchorLine QDeclarativeItemPrivate::horizontalCenter(void) const
+ ?hoverEnabled@QDeclarativeMouseArea@@QBE_NXZ @ 3976 NONAME ; bool QDeclarativeMouseArea::hoverEnabled(void) const
+ ?hoverEnabledChanged@QDeclarativeMouseArea@@IAEXXZ @ 3977 NONAME ; void QDeclarativeMouseArea::hoverEnabledChanged(void)
+ ?ignoreUnknownSignals@QDeclarativeConnections@@QBE_NXZ @ 3978 NONAME ; bool QDeclarativeConnections::ignoreUnknownSignals(void) const
+ ?itemChange@QDeclarativeMouseArea@@MAE?AVQVariant@@W4GraphicsItemChange@QGraphicsItem@@ABV2@@Z @ 3979 NONAME ; class QVariant QDeclarativeMouseArea::itemChange(enum QGraphicsItem::GraphicsItemChange, class QVariant const &)
+ ?itemChange@QDeclarativePaintedItem@@MAE?AVQVariant@@W4GraphicsItemChange@QGraphicsItem@@ABV2@@Z @ 3980 NONAME ; class QVariant QDeclarativePaintedItem::itemChange(enum QGraphicsItem::GraphicsItemChange, class QVariant const &)
+ ?left@QDeclarativeItemPrivate@@QBE?AVQDeclarativeAnchorLine@@XZ @ 3981 NONAME ; class QDeclarativeAnchorLine QDeclarativeItemPrivate::left(void) const
+ ?reportConflictingAnchors@QDeclarativeColumn@@MAEXXZ @ 3982 NONAME ; void QDeclarativeColumn::reportConflictingAnchors(void)
+ ?reportConflictingAnchors@QDeclarativeFlow@@MAEXXZ @ 3983 NONAME ; void QDeclarativeFlow::reportConflictingAnchors(void)
+ ?reportConflictingAnchors@QDeclarativeGrid@@MAEXXZ @ 3984 NONAME ; void QDeclarativeGrid::reportConflictingAnchors(void)
+ ?reportConflictingAnchors@QDeclarativeRow@@MAEXXZ @ 3985 NONAME ; void QDeclarativeRow::reportConflictingAnchors(void)
+ ?resources@QDeclarativeItemPrivate@@QAE?AV?$QDeclarativeListProperty@VQObject@@@@XZ @ 3986 NONAME ; class QDeclarativeListProperty<class QObject> QDeclarativeItemPrivate::resources(void)
+ ?right@QDeclarativeItemPrivate@@QBE?AVQDeclarativeAnchorLine@@XZ @ 3987 NONAME ; class QDeclarativeAnchorLine QDeclarativeItemPrivate::right(void) const
+ ?setHoverEnabled@QDeclarativeMouseArea@@QAEX_N@Z @ 3988 NONAME ; void QDeclarativeMouseArea::setHoverEnabled(bool)
+ ?setIgnoreUnknownSignals@QDeclarativeConnections@@QAEX_N@Z @ 3989 NONAME ; void QDeclarativeConnections::setIgnoreUnknownSignals(bool)
+ ?setState@QDeclarativeItemPrivate@@QAEXABVQString@@@Z @ 3990 NONAME ; void QDeclarativeItemPrivate::setState(class QString const &)
+ ?state@QDeclarativeItemPrivate@@QBE?AVQString@@XZ @ 3991 NONAME ; class QString QDeclarativeItemPrivate::state(void) const
+ ?states@QDeclarativeItemPrivate@@QAE?AV?$QDeclarativeListProperty@VQDeclarativeState@@@@XZ @ 3992 NONAME ; class QDeclarativeListProperty<class QDeclarativeState> QDeclarativeItemPrivate::states(void)
+ ?top@QDeclarativeItemPrivate@@QBE?AVQDeclarativeAnchorLine@@XZ @ 3993 NONAME ; class QDeclarativeAnchorLine QDeclarativeItemPrivate::top(void) const
+ ?transitions@QDeclarativeItemPrivate@@QAE?AV?$QDeclarativeListProperty@VQDeclarativeTransition@@@@XZ @ 3994 NONAME ; class QDeclarativeListProperty<class QDeclarativeTransition> QDeclarativeItemPrivate::transitions(void)
+ ?verticalCenter@QDeclarativeItemPrivate@@QBE?AVQDeclarativeAnchorLine@@XZ @ 3995 NONAME ; class QDeclarativeAnchorLine QDeclarativeItemPrivate::verticalCenter(void) const
diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def
index c3a3a08f66..8ae3b9d3b0 100644
--- a/src/s60installs/bwins/QtGuiu.def
+++ b/src/s60installs/bwins/QtGuiu.def
@@ -2126,8 +2126,8 @@ EXPORTS
?addToGroup@QGraphicsItemGroup@@QAEXPAVQGraphicsItem@@@Z @ 2125 NONAME ; void QGraphicsItemGroup::addToGroup(class QGraphicsItem *)
?addToIndex@QGraphicsItem@@IAEXXZ @ 2126 NONAME ; void QGraphicsItem::addToIndex(void)
?addToPolygon@QBezier@@QBEXPAVQPolygonF@@@Z @ 2127 NONAME ; void QBezier::addToPolygon(class QPolygonF *) const
- ?addToPolygonIterative@QBezier@@QBEXPAVQPolygonF@@@Z @ 2128 NONAME ; void QBezier::addToPolygonIterative(class QPolygonF *) const
- ?addToPolygonMixed@QBezier@@QBEXPAVQPolygonF@@@Z @ 2129 NONAME ; void QBezier::addToPolygonMixed(class QPolygonF *) const
+ ?addToPolygonIterative@QBezier@@QBEXPAVQPolygonF@@@Z @ 2128 NONAME ABSENT ; void QBezier::addToPolygonIterative(class QPolygonF *) const
+ ?addToPolygonMixed@QBezier@@QBEXPAVQPolygonF@@@Z @ 2129 NONAME ABSENT ; void QBezier::addToPolygonMixed(class QPolygonF *) const
?addToolBar@QMainWindow@@QAEPAVQToolBar@@ABVQString@@@Z @ 2130 NONAME ; class QToolBar * QMainWindow::addToolBar(class QString const &)
?addToolBar@QMainWindow@@QAEXPAVQToolBar@@@Z @ 2131 NONAME ; void QMainWindow::addToolBar(class QToolBar *)
?addToolBar@QMainWindow@@QAEXW4ToolBarArea@Qt@@PAVQToolBar@@@Z @ 2132 NONAME ; void QMainWindow::addToolBar(enum Qt::ToolBarArea, class QToolBar *)
@@ -12717,7 +12717,7 @@ EXPORTS
?updateInputMethodSensitivity@QGraphicsViewPrivate@@QAEXXZ @ 12716 NONAME ; void QGraphicsViewPrivate::updateInputMethodSensitivity(void)
?updateLastCenterPoint@QGraphicsViewPrivate@@QAEXXZ @ 12717 NONAME ; void QGraphicsViewPrivate::updateLastCenterPoint(void)
?updateRect@QGraphicsViewPrivate@@QAE_NABVQRect@@@Z @ 12718 NONAME ; bool QGraphicsViewPrivate::updateRect(class QRect const &)
- ?updateRegion@QGraphicsViewPrivate@@QAE_NABVQRegion@@@Z @ 12719 NONAME ; bool QGraphicsViewPrivate::updateRegion(class QRegion const &)
+ ?updateRegion@QGraphicsViewPrivate@@QAE_NABVQRegion@@@Z @ 12719 NONAME ABSENT ; bool QGraphicsViewPrivate::updateRegion(class QRegion const &)
?updateScroll@QGraphicsViewPrivate@@QAEXXZ @ 12720 NONAME ; void QGraphicsViewPrivate::updateScroll(void)
?verticalScroll@QGraphicsViewPrivate@@QBE_JXZ @ 12721 NONAME ; long long QGraphicsViewPrivate::verticalScroll(void) const
?viewportEvent@QAbstractScrollAreaPrivate@@QAE_NPAVQEvent@@@Z @ 12722 NONAME ; bool QAbstractScrollAreaPrivate::viewportEvent(class QEvent *)
@@ -12798,4 +12798,6 @@ EXPORTS
?hasPartialUpdateSupport@QWindowSurface@@QBE_NXZ @ 12797 NONAME ; bool QWindowSurface::hasPartialUpdateSupport(void) const
?name@QIcon@@QBE?AVQString@@XZ @ 12798 NONAME ; class QString QIcon::name(void) const
?iconName@QIconEngineV2@@QAE?AVQString@@XZ @ 12799 NONAME ; class QString QIconEngineV2::iconName(void)
+ ?updateRectF@QGraphicsViewPrivate@@QAE_NABVQRectF@@@Z @ 12800 NONAME ; bool QGraphicsViewPrivate::updateRectF(class QRectF const &)
+ ?updateRegion@QGraphicsViewPrivate@@QAE_NABVQRectF@@ABVQTransform@@@Z @ 12801 NONAME ; bool QGraphicsViewPrivate::updateRegion(class QRectF const &, class QTransform const &)
diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def
index 92a40205fe..dc9431b37b 100644
--- a/src/s60installs/eabi/QtCoreu.def
+++ b/src/s60installs/eabi/QtCoreu.def
@@ -3698,4 +3698,6 @@ EXPORTS
_ZN24QAbstractDeclarativeData13parentChangedE @ 3697 NONAME DATA 4
_ZN24QAbstractDeclarativeData9destroyedE @ 3698 NONAME DATA 4
_ZN23QEventDispatcherSymbian12selectThreadEv @ 3699 NONAME
+ _ZN10QByteArray10setRawDataEPKcj @ 3700 NONAME
+ _ZN7QString10setRawDataEPK5QChari @ 3701 NONAME
diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def
index ad12166352..e1d8e96227 100644
--- a/src/s60installs/eabi/QtDeclarativeu.def
+++ b/src/s60installs/eabi/QtDeclarativeu.def
@@ -111,7 +111,7 @@ EXPORTS
_ZN16QDeclarativeItem11qt_metacallEN11QMetaObject4CallEiPPv @ 110 NONAME
_ZN16QDeclarativeItem11qt_metacastEPKc @ 111 NONAME
_ZN16QDeclarativeItem11resetHeightEv @ 112 NONAME
- _ZN16QDeclarativeItem11transitionsEv @ 113 NONAME
+ _ZN16QDeclarativeItem11transitionsEv @ 113 NONAME ABSENT
_ZN16QDeclarativeItem12childrenRectEv @ 114 NONAME
_ZN16QDeclarativeItem12focusChangedEb @ 115 NONAME
_ZN16QDeclarativeItem12stateChangedERK7QString @ 116 NONAME
@@ -135,17 +135,17 @@ EXPORTS
_ZN16QDeclarativeItem19getStaticMetaObjectEv @ 134 NONAME
_ZN16QDeclarativeItem21baselineOffsetChangedEf @ 135 NONAME
_ZN16QDeclarativeItem22transformOriginChangedENS_15TransformOriginE @ 136 NONAME
- _ZN16QDeclarativeItem4dataEv @ 137 NONAME
+ _ZN16QDeclarativeItem4dataEv @ 137 NONAME ABSENT
_ZN16QDeclarativeItem5eventEP6QEvent @ 138 NONAME
_ZN16QDeclarativeItem5paintEP8QPainterPK24QStyleOptionGraphicsItemP7QWidget @ 139 NONAME
- _ZN16QDeclarativeItem6statesEv @ 140 NONAME
- _ZN16QDeclarativeItem7anchorsEv @ 141 NONAME
+ _ZN16QDeclarativeItem6statesEv @ 140 NONAME ABSENT
+ _ZN16QDeclarativeItem7anchorsEv @ 141 NONAME ABSENT
_ZN16QDeclarativeItem7setClipEb @ 142 NONAME
_ZN16QDeclarativeItem7setSizeERK6QSizeF @ 143 NONAME
_ZN16QDeclarativeItem8setFocusEb @ 144 NONAME
- _ZN16QDeclarativeItem8setStateERK7QString @ 145 NONAME
+ _ZN16QDeclarativeItem8setStateERK7QString @ 145 NONAME ABSENT
_ZN16QDeclarativeItem8setWidthEf @ 146 NONAME
- _ZN16QDeclarativeItem9resourcesEv @ 147 NONAME
+ _ZN16QDeclarativeItem9resourcesEv @ 147 NONAME ABSENT
_ZN16QDeclarativeItem9setHeightEf @ 148 NONAME
_ZN16QDeclarativeItem9setSmoothEb @ 149 NONAME
_ZN16QDeclarativeItem9transformEv @ 150 NONAME
@@ -361,13 +361,13 @@ EXPORTS
_ZN18QDeclarativeLoader11itemChangedEv @ 360 NONAME
_ZN18QDeclarativeLoader11qt_metacallEN11QMetaObject4CallEiPPv @ 361 NONAME
_ZN18QDeclarativeLoader11qt_metacastEPKc @ 362 NONAME
- _ZN18QDeclarativeLoader13setResizeModeENS_10ResizeModeE @ 363 NONAME
+ _ZN18QDeclarativeLoader13setResizeModeENS_10ResizeModeE @ 363 NONAME ABSENT
_ZN18QDeclarativeLoader13sourceChangedEv @ 364 NONAME
_ZN18QDeclarativeLoader13statusChangedEv @ 365 NONAME
_ZN18QDeclarativeLoader15geometryChangedERK6QRectFS2_ @ 366 NONAME
_ZN18QDeclarativeLoader15progressChangedEv @ 367 NONAME
_ZN18QDeclarativeLoader16staticMetaObjectE @ 368 NONAME DATA 16
- _ZN18QDeclarativeLoader17resizeModeChangedEv @ 369 NONAME
+ _ZN18QDeclarativeLoader17resizeModeChangedEv @ 369 NONAME ABSENT
_ZN18QDeclarativeLoader18setSourceComponentEP21QDeclarativeComponent @ 370 NONAME
_ZN18QDeclarativeLoader19getStaticMetaObjectEv @ 371 NONAME
_ZN18QDeclarativeLoader9setSourceERK4QUrl @ 372 NONAME
@@ -586,7 +586,7 @@ EXPORTS
_ZN20QDeclarativeCompiler22completeComponentBuildEv @ 585 NONAME
_ZN20QDeclarativeCompiler22isAttachedPropertyNameERK10QByteArray @ 586 NONAME
_ZN20QDeclarativeCompiler23buildPropertyAssignmentEPN18QDeclarativeParser8PropertyEPNS0_6ObjectERKNS_14BindingContextE @ 587 NONAME
- _ZN20QDeclarativeCompiler24buildPropertyInNamespaceEPN25QDeclarativeEnginePrivate17ImportedNamespaceEPN18QDeclarativeParser8PropertyEPNS3_6ObjectERKNS_14BindingContextE @ 588 NONAME
+ _ZN20QDeclarativeCompiler24buildPropertyInNamespaceEPN25QDeclarativeEnginePrivate17ImportedNamespaceEPN18QDeclarativeParser8PropertyEPNS3_6ObjectERKNS_14BindingContextE @ 588 NONAME ABSENT
_ZN20QDeclarativeCompiler25buildPropertyOnAssignmentEPN18QDeclarativeParser8PropertyEPNS0_6ObjectES4_PNS0_5ValueERKNS_14BindingContextE @ 589 NONAME
_ZN20QDeclarativeCompiler25buildScriptStringPropertyEPN18QDeclarativeParser8PropertyEPNS0_6ObjectERKNS_14BindingContextE @ 590 NONAME
_ZN20QDeclarativeCompiler26mergeDynamicMetaPropertiesEPN18QDeclarativeParser6ObjectE @ 591 NONAME
@@ -969,7 +969,7 @@ EXPORTS
_ZN21QDeclarativeComponent11beginCreateEP19QDeclarativeContext @ 968 NONAME
_ZN21QDeclarativeComponent11qt_metacallEN11QMetaObject4CallEiPPv @ 969 NONAME
_ZN21QDeclarativeComponent11qt_metacastEPKc @ 970 NONAME
- _ZN21QDeclarativeComponent12createObjectEv @ 971 NONAME
+ _ZN21QDeclarativeComponent12createObjectEv @ 971 NONAME ABSENT
_ZN21QDeclarativeComponent13statusChangedENS_6StatusE @ 972 NONAME
_ZN21QDeclarativeComponent14completeCreateEv @ 973 NONAME
_ZN21QDeclarativeComponent15progressChangedEf @ 974 NONAME
@@ -1493,7 +1493,7 @@ EXPORTS
_ZN23QDeclarativePaintedItem19contentsSizeChangedEv @ 1492 NONAME
_ZN23QDeclarativePaintedItem19getStaticMetaObjectEv @ 1493 NONAME
_ZN23QDeclarativePaintedItem20contentsScaleChangedEv @ 1494 NONAME
- _ZN23QDeclarativePaintedItem4initEv @ 1495 NONAME
+ _ZN23QDeclarativePaintedItem4initEv @ 1495 NONAME ABSENT
_ZN23QDeclarativePaintedItem5paintEP8QPainterPK24QStyleOptionGraphicsItemP7QWidget @ 1496 NONAME
_ZN23QDeclarativePaintedItemC2EP16QDeclarativeItem @ 1497 NONAME
_ZN23QDeclarativePaintedItemC2ER30QDeclarativePaintedItemPrivateP16QDeclarativeItem @ 1498 NONAME
@@ -1624,9 +1624,9 @@ EXPORTS
_ZN24QDeclarativeParentChangeD0Ev @ 1623 NONAME
_ZN24QDeclarativeParentChangeD1Ev @ 1624 NONAME
_ZN24QDeclarativeParentChangeD2Ev @ 1625 NONAME
- _ZN24QDeclarativeParserStatus10classBeginEv @ 1626 NONAME
- _ZN24QDeclarativeParserStatus17componentCompleteEv @ 1627 NONAME
- _ZN24QDeclarativeParserStatusC1Ev @ 1628 NONAME
+ _ZN24QDeclarativeParserStatus10classBeginEv @ 1626 NONAME ABSENT
+ _ZN24QDeclarativeParserStatus17componentCompleteEv @ 1627 NONAME ABSENT
+ _ZN24QDeclarativeParserStatusC1Ev @ 1628 NONAME ABSENT
_ZN24QDeclarativeParserStatusC2Ev @ 1629 NONAME
_ZN24QDeclarativeParserStatusD0Ev @ 1630 NONAME
_ZN24QDeclarativeParserStatusD1Ev @ 1631 NONAME
@@ -2203,21 +2203,21 @@ EXPORTS
_ZNK16QDeclarativeItem13keepMouseGrabEv @ 2202 NONAME
_ZNK16QDeclarativeItem14baselineOffsetEv @ 2203 NONAME
_ZNK16QDeclarativeItem14implicitHeightEv @ 2204 NONAME
- _ZNK16QDeclarativeItem14verticalCenterEv @ 2205 NONAME
+ _ZNK16QDeclarativeItem14verticalCenterEv @ 2205 NONAME ABSENT
_ZNK16QDeclarativeItem15transformOriginEv @ 2206 NONAME
- _ZNK16QDeclarativeItem16horizontalCenterEv @ 2207 NONAME
+ _ZNK16QDeclarativeItem16horizontalCenterEv @ 2207 NONAME ABSENT
_ZNK16QDeclarativeItem16inputMethodQueryEN2Qt16InputMethodQueryE @ 2208 NONAME
_ZNK16QDeclarativeItem19isComponentCompleteEv @ 2209 NONAME
- _ZNK16QDeclarativeItem3topEv @ 2210 NONAME
+ _ZNK16QDeclarativeItem3topEv @ 2210 NONAME ABSENT
_ZNK16QDeclarativeItem4clipEv @ 2211 NONAME
- _ZNK16QDeclarativeItem4leftEv @ 2212 NONAME
- _ZNK16QDeclarativeItem5rightEv @ 2213 NONAME
- _ZNK16QDeclarativeItem5stateEv @ 2214 NONAME
+ _ZNK16QDeclarativeItem4leftEv @ 2212 NONAME ABSENT
+ _ZNK16QDeclarativeItem5rightEv @ 2213 NONAME ABSENT
+ _ZNK16QDeclarativeItem5stateEv @ 2214 NONAME ABSENT
_ZNK16QDeclarativeItem5widthEv @ 2215 NONAME
- _ZNK16QDeclarativeItem6bottomEv @ 2216 NONAME
+ _ZNK16QDeclarativeItem6bottomEv @ 2216 NONAME ABSENT
_ZNK16QDeclarativeItem6heightEv @ 2217 NONAME
_ZNK16QDeclarativeItem6smoothEv @ 2218 NONAME
- _ZNK16QDeclarativeItem8baselineEv @ 2219 NONAME
+ _ZNK16QDeclarativeItem8baselineEv @ 2219 NONAME ABSENT
_ZNK16QDeclarativeItem8hasFocusEv @ 2220 NONAME
_ZNK16QDeclarativeItem9mapToItemERK12QScriptValueff @ 2221 NONAME
_ZNK16QDeclarativePath10attributesEv @ 2222 NONAME
@@ -2310,7 +2310,7 @@ EXPORTS
_ZNK18QDeclarativeEngine27networkAccessManagerFactoryEv @ 2309 NONAME
_ZNK18QDeclarativeEngine7baseUrlEv @ 2310 NONAME
_ZNK18QDeclarativeLoader10metaObjectEv @ 2311 NONAME
- _ZNK18QDeclarativeLoader10resizeModeEv @ 2312 NONAME
+ _ZNK18QDeclarativeLoader10resizeModeEv @ 2312 NONAME ABSENT
_ZNK18QDeclarativeLoader15sourceComponentEv @ 2313 NONAME
_ZNK18QDeclarativeLoader4itemEv @ 2314 NONAME
_ZNK18QDeclarativeLoader6sourceEv @ 2315 NONAME
@@ -3536,4 +3536,46 @@ EXPORTS
_ZThn8_N25QDeclarativeAnchorChanges7executeEN23QDeclarativeActionEvent6ReasonE @ 3535 NONAME
_ZThn8_N25QDeclarativeAnchorChanges7reverseEN23QDeclarativeActionEvent6ReasonE @ 3536 NONAME
_ZThn8_N29QDeclarativeStateChangeScript7executeEN23QDeclarativeActionEvent6ReasonE @ 3537 NONAME
+ _ZN15QDeclarativeRow24reportConflictingAnchorsEv @ 3538 NONAME
+ _ZN16QDeclarativeBind10classBeginEv @ 3539 NONAME
+ _ZN16QDeclarativeFlow24reportConflictingAnchorsEv @ 3540 NONAME
+ _ZN16QDeclarativeGrid24reportConflictingAnchorsEv @ 3541 NONAME
+ _ZN16QDeclarativePath10classBeginEv @ 3542 NONAME
+ _ZN18QDeclarativeColumn24reportConflictingAnchorsEv @ 3543 NONAME
+ _ZN20QDeclarativeBehavior18componentFinalizedEv @ 3544 NONAME
+ _ZN20QDeclarativeCompiler24buildPropertyInNamespaceEP29QDeclarativeImportedNamespacePN18QDeclarativeParser8PropertyEPNS2_6ObjectERKNS_14BindingContextE @ 3545 NONAME
+ _ZN21QDeclarativeComponent12createObjectEP7QObject @ 3546 NONAME
+ _ZN21QDeclarativeMouseArea10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 3547 NONAME
+ _ZN21QDeclarativeMouseArea15setHoverEnabledEb @ 3548 NONAME
+ _ZN21QDeclarativeMouseArea19hoverEnabledChangedEv @ 3549 NONAME
+ _ZN21QDeclarativeMouseArea8canceledEv @ 3550 NONAME
+ _ZN23QDeclarativeConnections10classBeginEv @ 3551 NONAME
+ _ZN23QDeclarativeConnections23setIgnoreUnknownSignalsEb @ 3552 NONAME
+ _ZN23QDeclarativeItemPrivate11transitionsEv @ 3553 NONAME
+ _ZN23QDeclarativeItemPrivate4dataEv @ 3554 NONAME
+ _ZN23QDeclarativeItemPrivate7_statesEv @ 3555 NONAME
+ _ZN23QDeclarativeItemPrivate8setStateERK7QString @ 3556 NONAME
+ _ZN23QDeclarativeItemPrivate9resourcesEv @ 3557 NONAME
+ _ZN23QDeclarativePaintedItem10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 3558 NONAME
+ _ZN23QDeclarativePaintedItem15geometryChangedERK6QRectFS2_ @ 3559 NONAME
+ _ZN24QDeclarativeWorkerScript10classBeginEv @ 3560 NONAME
+ _ZN24QDeclarativeWorkerScript6engineEv @ 3561 NONAME
+ _ZNK21QDeclarativeMouseArea12hoverEnabledEv @ 3562 NONAME
+ _ZNK23QDeclarativeConnections20ignoreUnknownSignalsEv @ 3563 NONAME
+ _ZNK23QDeclarativeItemPrivate14verticalCenterEv @ 3564 NONAME
+ _ZNK23QDeclarativeItemPrivate16horizontalCenterEv @ 3565 NONAME
+ _ZNK23QDeclarativeItemPrivate3topEv @ 3566 NONAME
+ _ZNK23QDeclarativeItemPrivate4leftEv @ 3567 NONAME
+ _ZNK23QDeclarativeItemPrivate5rightEv @ 3568 NONAME
+ _ZNK23QDeclarativeItemPrivate5stateEv @ 3569 NONAME
+ _ZNK23QDeclarativeItemPrivate6bottomEv @ 3570 NONAME
+ _ZNK23QDeclarativeItemPrivate8baselineEv @ 3571 NONAME
+ _ZNK27QDeclarativeVisualDataModel15completePendingEv @ 3572 NONAME
+ _ZNK27QDeclarativeVisualItemModel15completePendingEv @ 3573 NONAME
+ _ZThn8_N16QDeclarativeBind10classBeginEv @ 3574 NONAME
+ _ZThn8_N16QDeclarativePath10classBeginEv @ 3575 NONAME
+ _ZThn8_N21QDeclarativeMouseArea10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 3576 NONAME
+ _ZThn8_N23QDeclarativeConnections10classBeginEv @ 3577 NONAME
+ _ZThn8_N23QDeclarativePaintedItem10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 3578 NONAME
+ _ZThn8_N24QDeclarativeWorkerScript10classBeginEv @ 3579 NONAME
diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def
index b1166c5236..02b74ee6e1 100644
--- a/src/s60installs/eabi/QtGuiu.def
+++ b/src/s60installs/eabi/QtGuiu.def
@@ -9901,9 +9901,9 @@ EXPORTS
_ZNK7QBezier10addIfCloseEPff @ 9900 NONAME
_ZNK7QBezier12addToPolygonEP9QPolygonF @ 9901 NONAME
_ZNK7QBezier16bezierOnIntervalEff @ 9902 NONAME
- _ZNK7QBezier17addToPolygonMixedEP9QPolygonF @ 9903 NONAME
+ _ZNK7QBezier17addToPolygonMixedEP9QPolygonF @ 9903 NONAME ABSENT
_ZNK7QBezier17stationaryYPointsERfS0_ @ 9904 NONAME
- _ZNK7QBezier21addToPolygonIterativeEP9QPolygonF @ 9905 NONAME
+ _ZNK7QBezier21addToPolygonIterativeEP9QPolygonF @ 9905 NONAME ABSENT
_ZNK7QBezier5tForYEfff @ 9906 NONAME
_ZNK7QBezier6boundsEv @ 9907 NONAME
_ZNK7QBezier6lengthEf @ 9908 NONAME
@@ -11849,7 +11849,7 @@ EXPORTS
_ZN19QApplicationPrivate15getPixmapCursorEN2Qt11CursorShapeE @ 11848 NONAME
_ZN20QGraphicsViewPrivate10centerViewEN13QGraphicsView14ViewportAnchorE @ 11849 NONAME
_ZN20QGraphicsViewPrivate10updateRectERK5QRect @ 11850 NONAME
- _ZN20QGraphicsViewPrivate12updateRegionERK7QRegion @ 11851 NONAME
+ _ZN20QGraphicsViewPrivate12updateRegionERK7QRegion @ 11851 NONAME ABSENT
_ZN20QGraphicsViewPrivate12updateScrollEv @ 11852 NONAME
_ZN20QGraphicsViewPrivate15storeMouseEventEP11QMouseEvent @ 11853 NONAME
_ZN20QGraphicsViewPrivate18storeDragDropEventEPK27QGraphicsSceneDragDropEvent @ 11854 NONAME
@@ -11998,4 +11998,5 @@ EXPORTS
_ZN14QWindowSurface23setPartialUpdateSupportEb @ 11997 NONAME
_ZNK14QWindowSurface23hasPartialUpdateSupportEv @ 11998 NONAME
_ZNK5QIcon4nameEv @ 11999 NONAME
+ _ZN20QGraphicsViewPrivate12updateRegionERK6QRectFRK10QTransform @ 12000 NONAME
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index dfd26948b3..97b22322e3 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -158,11 +158,12 @@ symbian: {
contains(QT_CONFIG, media-backend) {
qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtMediaServices$${QT_LIBINFIX}.dll
- mediaservices_plugins.path = c:$$QT_PLUGINS_BASE_DIR/mediaservices
- mediaservices_plugins.sources += $$QT_BUILD_TREE/plugins/mediaservices/qmmfengine$${QT_LIBINFIX}.dll
+ contains(QT_CONFIG, audio-routing-available) {
+ mediaservices_plugins.path = c:$$QT_PLUGINS_BASE_DIR/mediaservices
+ mediaservices_plugins.sources += $$QT_BUILD_TREE/plugins/mediaservices/qmmfengine$${QT_LIBINFIX}.dll
+ }
DEPLOYMENT += mediaservices_plugins
-
}
BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)"
diff --git a/src/src.pro b/src/src.pro
index 9c4831c5af..3ceeb9c79e 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -94,7 +94,7 @@ src_declarative.target = sub-declarative
src_xml.depends = src_corelib
src_xmlpatterns.depends = src_corelib src_network
src_dbus.depends = src_corelib src_xml
- src_svg.depends = src_xml src_gui
+ src_svg.depends = src_corelib src_gui
src_script.depends = src_corelib
src_scripttools.depends = src_script src_gui src_network
src_network.depends = src_corelib
@@ -110,15 +110,14 @@ src_declarative.target = sub-declarative
contains(QT_CONFIG, opengl):src_multimedia.depends += src_opengl
src_mediaservices.depends = src_multimedia
src_tools_activeqt.depends = src_tools_idc src_gui
- src_declarative.depends = src_xml src_gui src_script src_network src_svg
+ src_declarative.depends = src_gui src_script src_network
src_plugins.depends = src_gui src_sql src_svg src_multimedia
src_s60installs.depends = $$TOOLS_SUBDIRS $$SRC_SUBDIRS
src_imports.depends = src_gui src_declarative
contains(QT_CONFIG, webkit) {
- src_webkit.depends = src_gui src_sql src_network src_xml
+ src_webkit.depends = src_gui src_sql src_network
contains(QT_CONFIG, mediaservices):src_webkit.depends += src_mediaservices
contains(QT_CONFIG, xmlpatterns): src_webkit.depends += src_xmlpatterns
- contains(QT_CONFIG, declarative):src_declarative.depends += src_webkit
src_imports.depends += src_webkit
exists($$QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro): src_webkit.depends += src_javascriptcore
}
@@ -127,7 +126,18 @@ src_declarative.target = sub-declarative
src_plugins.depends += src_dbus
src_phonon.depends += src_dbus
}
- contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2): src_plugins.depends += src_opengl
+ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) {
+ src_plugins.depends += src_opengl
+ src_declarative.depends += src_opengl
+ src_webkit.depends += src_opengl
+ }
+ contains(QT_CONFIG, xmlpatterns) {
+ src_declarative.depends += src_xmlpatterns
+ src_webkit.depends += src_xmlpatterns
+ }
+ contains(QT_CONFIG, svg) {
+ src_declarative.depends += src_svg
+ }
}