aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--examples/quick/demos/photosurface/main.cpp8
-rw-r--r--examples/quick/embeddedinwidgets/main.cpp3
-rw-r--r--examples/quick/quickwidgets/quickwidget/main.cpp3
-rw-r--r--examples/quick/rendercontrol/window_multithreaded.cpp8
-rw-r--r--examples/quick/rendercontrol/window_singlethreaded.cpp8
-rw-r--r--examples/quick/scenegraph/sgengine/window.cpp2
-rw-r--r--examples/quick/scenegraph/textureinthread/main.cpp2
-rw-r--r--examples/quick/shared/Label.qml46
-rw-r--r--examples/quick/shared/quick_shared.qrc1
-rw-r--r--examples/quick/shared/shared.qrc1
-rw-r--r--examples/quick/window/AllScreens.qml75
-rw-r--r--examples/quick/window/CurrentScreen.qml (renamed from examples/quick/window/ScreenInfo.qml)36
-rw-r--r--examples/quick/window/Splash.qml2
-rw-r--r--examples/quick/window/doc/src/window.qdoc2
-rw-r--r--examples/quick/window/main.cpp3
-rw-r--r--examples/quick/window/window.qml23
-rw-r--r--examples/quick/window/window.qrc3
-rw-r--r--src/imports/folderlistmodel/fileinfothread_p.h2
-rw-r--r--src/imports/folderlistmodel/fileproperty_p.h20
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.h12
-rw-r--r--src/imports/layouts/qquickgridlayoutengine_p.h6
-rw-r--r--src/imports/layouts/qquicklinearlayout_p.h4
-rw-r--r--src/imports/localstorage/plugin.cpp2
-rw-r--r--src/imports/settings/qqmlsettings_p.h6
-rw-r--r--src/imports/statemachine/state.h4
-rw-r--r--src/imports/statemachine/statemachine.h4
-rw-r--r--src/imports/statemachine/timeouttransition.h4
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp4
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel_p.h14
-rw-r--r--src/particles/qquickage_p.h3
-rw-r--r--src/particles/qquickangledirection.cpp2
-rw-r--r--src/particles/qquickangledirection_p.h2
-rw-r--r--src/particles/qquickcumulativedirection.cpp2
-rw-r--r--src/particles/qquickcumulativedirection_p.h2
-rw-r--r--src/particles/qquickcustomaffector_p.h5
-rw-r--r--src/particles/qquickcustomparticle_p.h14
-rw-r--r--src/particles/qquickdirection.cpp2
-rw-r--r--src/particles/qquickdirection_p.h2
-rw-r--r--src/particles/qquickellipseextruder_p.h4
-rw-r--r--src/particles/qquickfriction_p.h2
-rw-r--r--src/particles/qquickgravity_p.h3
-rw-r--r--src/particles/qquickgroupgoal_p.h2
-rw-r--r--src/particles/qquickimageparticle_p.h12
-rw-r--r--src/particles/qquickitemparticle_p.h10
-rw-r--r--src/particles/qquicklineextruder_p.h6
-rw-r--r--src/particles/qquickmaskextruder_p.h4
-rw-r--r--src/particles/qquickparticleaffector.cpp2
-rw-r--r--src/particles/qquickparticleaffector_p.h4
-rw-r--r--src/particles/qquickparticleemitter_p.h2
-rw-r--r--src/particles/qquickparticlegroup_p.h4
-rw-r--r--src/particles/qquickparticlepainter_p.h4
-rw-r--r--src/particles/qquickparticlesystem_p.h6
-rw-r--r--src/particles/qquickpointattractor_p.h3
-rw-r--r--src/particles/qquickpointdirection.cpp2
-rw-r--r--src/particles/qquickpointdirection_p.h2
-rw-r--r--src/particles/qquickrectangleextruder_p.h4
-rw-r--r--src/particles/qquickspritegoal_p.h3
-rw-r--r--src/particles/qquicktargetdirection.cpp2
-rw-r--r--src/particles/qquicktargetdirection_p.h2
-rw-r--r--src/particles/qquicktrailemitter_p.h4
-rw-r--r--src/particles/qquickturbulence_p.h6
-rw-r--r--src/particles/qquickv4particledata.cpp2
-rw-r--r--src/particles/qquickv4particledata_p.h2
-rw-r--r--src/particles/qquickwander_p.h3
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp14
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp39
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp16
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp4
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h14
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp33
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp23
-rw-r--r--src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp10
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp4
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp51
-rw-r--r--src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp12
-rw-r--r--src/qml/animations/qanimationgroupjob_p.h2
-rw-r--r--src/qml/animations/qparallelanimationgroupjob_p.h12
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp22
-rw-r--r--src/qml/compiler/qqmlirbuilder_p.h40
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp10
-rw-r--r--src/qml/compiler/qv4codegen_p.h228
-rw-r--r--src/qml/compiler/qv4compiler.cpp4
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp6
-rw-r--r--src/qml/compiler/qv4isel_moth_p.h123
-rw-r--r--src/qml/compiler/qv4ssa.cpp120
-rw-r--r--src/qml/compiler/qv4ssa_p.h15
-rw-r--r--src/qml/debugger/qqmldebugconnector.cpp8
-rw-r--r--src/qml/doc/src/javascript/dynamicobjectcreation.qdoc2
-rw-r--r--src/qml/jit/qv4isel_masm.cpp21
-rw-r--r--src/qml/jit/qv4isel_masm_p.h3
-rw-r--r--src/qml/jit/qv4regalloc.cpp124
-rw-r--r--src/qml/jsruntime/jsruntime.pri2
-rw-r--r--src/qml/jsruntime/qv4engine.cpp4
-rw-r--r--src/qml/jsruntime/qv4executableallocator.cpp2
-rw-r--r--src/qml/jsruntime/qv4numberobject.cpp24
-rw-r--r--src/qml/jsruntime/qv4profiling.cpp2
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp14
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp2
-rw-r--r--src/qml/jsruntime/qv4script.cpp6
-rw-r--r--src/qml/jsruntime/qv4util_p.h6
-rw-r--r--src/qml/jsruntime/qv4variantobject.cpp7
-rw-r--r--src/qml/parser/qqmljsast_p.h554
-rw-r--r--src/qml/qml/ftw/qqmlthread.cpp6
-rw-r--r--src/qml/qml/ftw/qqmlthread_p.h24
-rw-r--r--src/qml/qml/qqmlapplicationengine.cpp17
-rw-r--r--src/qml/qml/qqmlapplicationengine.h6
-rw-r--r--src/qml/qml/qqmlbinding.cpp2
-rw-r--r--src/qml/qml/qqmlbinding_p.h4
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp2
-rw-r--r--src/qml/qml/qqmlboundsignal_p.h4
-rw-r--r--src/qml/qml/qqmlcomponent.cpp8
-rw-r--r--src/qml/qml/qqmlcomponent_p.h4
-rw-r--r--src/qml/qml/qqmlcontext_p.h4
-rw-r--r--src/qml/qml/qqmlengine.cpp18
-rw-r--r--src/qml/qml/qqmlengine.h2
-rw-r--r--src/qml/qml/qqmlexpression.cpp2
-rw-r--r--src/qml/qml/qqmlexpression_p.h4
-rw-r--r--src/qml/qml/qqmlextensionplugin.h2
-rw-r--r--src/qml/qml/qqmlfileselector_p.h2
-rw-r--r--src/qml/qml/qqmlimport.cpp65
-rw-r--r--src/qml/qml/qqmlincubator.cpp2
-rw-r--r--src/qml/qml/qqmljavascriptexpression_p.h2
-rw-r--r--src/qml/qml/qqmlmetatype.cpp4
-rw-r--r--src/qml/qml/qqmlnotifier_p.h12
-rw-r--r--src/qml/qml/qqmlopenmetaobject_p.h4
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp8
-rw-r--r--src/qml/qml/qqmlpropertycache_p.h6
-rw-r--r--src/qml/qml/qqmlproxymetaobject_p.h4
-rw-r--r--src/qml/qml/qqmltypeloader.cpp19
-rw-r--r--src/qml/qml/qqmltypeloader_p.h32
-rw-r--r--src/qml/qml/qqmlvaluetype_p.h6
-rw-r--r--src/qml/qml/qqmlvaluetypeproxybinding_p.h4
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper.cpp4
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper_p.h2
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp34
-rw-r--r--src/qml/qml/qqmlvmemetaobject_p.h36
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp9
-rw-r--r--src/qml/types/qqmlbind_p.h6
-rw-r--r--src/qml/types/qqmlconnections.cpp2
-rw-r--r--src/qml/types/qqmlconnections_p.h8
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp18
-rw-r--r--src/qml/types/qqmldelegatemodel_p.h24
-rw-r--r--src/qml/types/qqmldelegatemodel_p_p.h34
-rw-r--r--src/qml/types/qqmlinstantiator.cpp6
-rw-r--r--src/qml/types/qqmlinstantiator_p.h6
-rw-r--r--src/qml/types/qqmllistmodel.cpp61
-rw-r--r--src/qml/types/qqmllistmodel_p.h12
-rw-r--r--src/qml/types/qqmllistmodel_p_p.h20
-rw-r--r--src/qml/types/qqmllistmodelworkeragent_p.h2
-rw-r--r--src/qml/types/qqmlobjectmodel.cpp2
-rw-r--r--src/qml/types/qqmlobjectmodel_p.h16
-rw-r--r--src/qml/types/qqmltimer.cpp4
-rw-r--r--src/qml/types/qqmltimer_p.h6
-rw-r--r--src/qml/types/qquickworkerscript.cpp4
-rw-r--r--src/qml/types/qquickworkerscript_p.h12
-rw-r--r--src/qml/util/qqmladaptormodel.cpp4
-rw-r--r--src/qml/util/qqmlchangeset.cpp12
-rw-r--r--src/qml/util/qqmllistcompositor.cpp4
-rw-r--r--src/qml/util/qqmlpropertymap.cpp8
-rw-r--r--src/qmltest/quicktestevent.cpp4
-rw-r--r--src/qmltest/quicktestresult.cpp2
-rw-r--r--src/quick/accessible/qaccessiblequickitem.cpp4
-rw-r--r--src/quick/accessible/qaccessiblequickview_p.h20
-rw-r--r--src/quick/designer/qqmldesignermetaobject_p.h2
-rw-r--r--src/quick/designer/qquickdesignerwindowmanager_p.h22
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp40
-rw-r--r--src/quick/items/context2d/qquickcanvasitem_p.h2
-rw-r--r--src/quick/items/context2d/qquickcontext2d_p.h18
-rw-r--r--src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h4
-rw-r--r--src/quick/items/context2d/qquickcontext2dtexture_p.h16
-rw-r--r--src/quick/items/context2d/qquickcontext2dtile_p.h8
-rw-r--r--src/quick/items/qquickaccessibleattached_p.h2
-rw-r--r--src/quick/items/qquickanchors.cpp4
-rw-r--r--src/quick/items/qquickanchors_p_p.h4
-rw-r--r--src/quick/items/qquickdrag_p.h2
-rw-r--r--src/quick/items/qquickdroparea.cpp2
-rw-r--r--src/quick/items/qquickdroparea_p.h2
-rw-r--r--src/quick/items/qquickevents.cpp2
-rw-r--r--src/quick/items/qquickflickable.cpp10
-rw-r--r--src/quick/items/qquickflickable_p.h2
-rw-r--r--src/quick/items/qquickflickable_p_p.h6
-rw-r--r--src/quick/items/qquickflipable.cpp2
-rw-r--r--src/quick/items/qquickflipable_p.h2
-rw-r--r--src/quick/items/qquickgenericshadereffect.cpp4
-rw-r--r--src/quick/items/qquickimage.cpp2
-rw-r--r--src/quick/items/qquickitem.cpp6
-rw-r--r--src/quick/items/qquickitem_p.h4
-rw-r--r--src/quick/items/qquickitemanimation_p_p.h4
-rw-r--r--src/quick/items/qquickitemgrabresult.cpp17
-rw-r--r--src/quick/items/qquickitemgrabresult.h7
-rw-r--r--src/quick/items/qquickitemview.cpp56
-rw-r--r--src/quick/items/qquickitemview_p.h2
-rw-r--r--src/quick/items/qquickitemview_p_p.h4
-rw-r--r--src/quick/items/qquickitemviewtransition.cpp2
-rw-r--r--src/quick/items/qquickitemviewtransition_p.h2
-rw-r--r--src/quick/items/qquicklistview_p.h2
-rw-r--r--src/quick/items/qquickloader_p_p.h2
-rw-r--r--src/quick/items/qquickopenglshadereffect.cpp16
-rw-r--r--src/quick/items/qquickopenglshadereffectnode.cpp6
-rw-r--r--src/quick/items/qquickpainteditem.cpp2
-rw-r--r--src/quick/items/qquickpathview.cpp86
-rw-r--r--src/quick/items/qquickpathview_p.h6
-rw-r--r--src/quick/items/qquickpathview_p_p.h2
-rw-r--r--src/quick/items/qquickscreen.cpp195
-rw-r--r--src/quick/items/qquickscreen_p.h48
-rw-r--r--src/quick/items/qquickshadereffectmesh.cpp17
-rw-r--r--src/quick/items/qquickshadereffectmesh_p.h2
-rw-r--r--src/quick/items/qquickshadereffectsource.cpp2
-rw-r--r--src/quick/items/qquickspriteengine.cpp4
-rw-r--r--src/quick/items/qquickspriteengine_p.h10
-rw-r--r--src/quick/items/qquickstateoperations.cpp8
-rw-r--r--src/quick/items/qquickstateoperations_p.h4
-rw-r--r--src/quick/items/qquicktextcontrol.cpp4
-rw-r--r--src/quick/items/qquicktextcontrol_p.h6
-rw-r--r--src/quick/items/qquicktextdocument.cpp2
-rw-r--r--src/quick/items/qquicktextdocument_p.h8
-rw-r--r--src/quick/items/qquicktextinput.cpp47
-rw-r--r--src/quick/items/qquickwindow.cpp28
-rw-r--r--src/quick/items/qquickwindow_p.h4
-rw-r--r--src/quick/items/qquickwindowmodule.cpp25
-rw-r--r--src/quick/items/qquickwindowmodule_p.h5
-rw-r--r--src/quick/qtquick2.cpp26
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation.cpp2
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h2
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.h2
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer_p.h6
-rw-r--r--src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp14
-rw-r--r--src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h10
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp6
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture_p.h16
-rw-r--r--src/quick/scenegraph/util/qsgdefaultpainternode_p.h30
-rw-r--r--src/quick/scenegraph/util/qsgdepthstencilbuffer_p.h2
-rw-r--r--src/quick/scenegraph/util/qsgflatcolormaterial.h6
-rw-r--r--src/quick/scenegraph/util/qsgshadersourcebuilder.cpp11
-rw-r--r--src/quick/scenegraph/util/qsgsimplematerial.h4
-rw-r--r--src/quick/scenegraph/util/qsgtexture_p.h10
-rw-r--r--src/quick/scenegraph/util/qsgtexturematerial.h10
-rw-r--r--src/quick/scenegraph/util/qsgtexturematerial_p.h10
-rw-r--r--src/quick/scenegraph/util/qsgvertexcolormaterial.h6
-rw-r--r--src/quick/util/qquickanimation.cpp4
-rw-r--r--src/quick/util/qquickanimation_p.h32
-rw-r--r--src/quick/util/qquickanimation_p_p.h30
-rw-r--r--src/quick/util/qquickanimationcontroller.cpp4
-rw-r--r--src/quick/util/qquickanimationcontroller_p.h4
-rw-r--r--src/quick/util/qquickanimator_p.h28
-rw-r--r--src/quick/util/qquickanimatorcontroller_p.h4
-rw-r--r--src/quick/util/qquickapplication.cpp34
-rw-r--r--src/quick/util/qquickapplication_p.h9
-rw-r--r--src/quick/util/qquickbehavior.cpp2
-rw-r--r--src/quick/util/qquickbehavior_p.h4
-rw-r--r--src/quick/util/qquickimageprovider.h4
-rw-r--r--src/quick/util/qquickpath_p.h16
-rw-r--r--src/quick/util/qquickpixmapcache.cpp4
-rw-r--r--src/quick/util/qquickpixmapcache_p.h8
-rw-r--r--src/quick/util/qquickpropertychanges.cpp20
-rw-r--r--src/quick/util/qquickpropertychanges_p.h6
-rw-r--r--src/quick/util/qquicksmoothedanimation_p.h8
-rw-r--r--src/quick/util/qquicksmoothedanimation_p_p.h8
-rw-r--r--src/quick/util/qquickspringanimation.cpp8
-rw-r--r--src/quick/util/qquickspringanimation_p.h4
-rw-r--r--src/quick/util/qquickstatechangescript_p.h6
-rw-r--r--src/quick/util/qquickstategroup_p.h4
-rw-r--r--src/quick/util/qquickstyledtext.cpp3
-rw-r--r--src/quick/util/qquicktimeline_p_p.h8
-rw-r--r--src/quick/util/qquicktransition.cpp4
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp15
-rw-r--r--tests/auto/qmltest/events/tst_events.qml16
-rw-r--r--tests/auto/quick/drawingmodes/data/DrawingModes.qml14
-rw-r--r--tests/auto/quick/drawingmodes/drawingmodes.pro17
-rw-r--r--tests/auto/quick/drawingmodes/tst_drawingmodes.cpp340
-rw-r--r--tests/auto/quick/qquickscreen/data/screen.qml14
-rw-r--r--tests/auto/quick/qquickscreen/tst_qquickscreen.cpp40
-rw-r--r--tests/auto/quick/qquickwindow/data/windowWithScreen.qml10
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp19
-rw-r--r--tests/auto/quick/quick.pro1
-rw-r--r--tools/qml/main.cpp2
-rw-r--r--tools/qmleasing/mainwindow.cpp3
-rw-r--r--tools/qmleasing/splineeditor.cpp4
-rw-r--r--tools/qmlimportscanner/main.cpp12
-rw-r--r--tools/qmljs/qmljs.cpp8
-rw-r--r--tools/qmllint/main.cpp9
-rw-r--r--tools/qmlplugindump/main.cpp50
-rw-r--r--tools/qmlprofiler/qmlprofilerdata.cpp10
284 files changed, 2689 insertions, 1829 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 556f554e5e..f03d05c7ac 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,4 +1,4 @@
load(qt_build_config)
CONFIG += warning_clean
-MODULE_VERSION = 5.8.0
+MODULE_VERSION = 5.9.0
diff --git a/examples/quick/demos/photosurface/main.cpp b/examples/quick/demos/photosurface/main.cpp
index 9456694032..b9d093df40 100644
--- a/examples/quick/demos/photosurface/main.cpp
+++ b/examples/quick/demos/photosurface/main.cpp
@@ -59,9 +59,11 @@ static QStringList imageNameFilters()
{
QStringList result;
QMimeDatabase mimeDatabase;
- foreach (const QByteArray &m, QImageReader::supportedMimeTypes()) {
- foreach (const QString &suffix, mimeDatabase.mimeTypeForName(m).suffixes())
- result.append(QStringLiteral("*.") + suffix);
+ const auto supportedMimeTypes = QImageReader::supportedMimeTypes();
+ for (const QByteArray &m : supportedMimeTypes) {
+ const auto suffixes = mimeDatabase.mimeTypeForName(m).suffixes();
+ for (const QString &suffix : suffixes)
+ result.append(QLatin1String("*.") + suffix);
}
return result;
}
diff --git a/examples/quick/embeddedinwidgets/main.cpp b/examples/quick/embeddedinwidgets/main.cpp
index 96b0df7e13..91147772ba 100644
--- a/examples/quick/embeddedinwidgets/main.cpp
+++ b/examples/quick/embeddedinwidgets/main.cpp
@@ -103,7 +103,8 @@ void MainWindow::quickViewStatusChanged(QQuickView::Status status)
{
if (status == QQuickView::Error) {
QStringList errors;
- foreach (const QQmlError &error, m_quickView->errors())
+ const auto viewErrors = m_quickView->errors();
+ for (const QQmlError &error : viewErrors)
errors.append(error.toString());
statusBar()->showMessage(errors.join(QStringLiteral(", ")));
}
diff --git a/examples/quick/quickwidgets/quickwidget/main.cpp b/examples/quick/quickwidgets/quickwidget/main.cpp
index 6bb6722e02..7cb35d7bcd 100644
--- a/examples/quick/quickwidgets/quickwidget/main.cpp
+++ b/examples/quick/quickwidgets/quickwidget/main.cpp
@@ -133,7 +133,8 @@ void MainWindow::quickWidgetStatusChanged(QQuickWidget::Status status)
{
if (status == QQuickWidget::Error) {
QStringList errors;
- foreach (const QQmlError &error, m_quickWidget->errors())
+ const auto widgetErrors = m_quickWidget->errors();
+ for (const QQmlError &error : widgetErrors)
errors.append(error.toString());
statusBar()->showMessage(errors.join(QStringLiteral(", ")));
}
diff --git a/examples/quick/rendercontrol/window_multithreaded.cpp b/examples/quick/rendercontrol/window_multithreaded.cpp
index 4df3488ab3..013ee7c208 100644
--- a/examples/quick/rendercontrol/window_multithreaded.cpp
+++ b/examples/quick/rendercontrol/window_multithreaded.cpp
@@ -356,16 +356,16 @@ void WindowMultiThreaded::run()
disconnect(m_qmlComponent, &QQmlComponent::statusChanged, this, &WindowMultiThreaded::run);
if (m_qmlComponent->isError()) {
- QList<QQmlError> errorList = m_qmlComponent->errors();
- foreach (const QQmlError &error, errorList)
+ const QList<QQmlError> errorList = m_qmlComponent->errors();
+ for (const QQmlError &error : errorList)
qWarning() << error.url() << error.line() << error;
return;
}
QObject *rootObject = m_qmlComponent->create();
if (m_qmlComponent->isError()) {
- QList<QQmlError> errorList = m_qmlComponent->errors();
- foreach (const QQmlError &error, errorList)
+ const QList<QQmlError> errorList = m_qmlComponent->errors();
+ for (const QQmlError &error : errorList)
qWarning() << error.url() << error.line() << error;
return;
}
diff --git a/examples/quick/rendercontrol/window_singlethreaded.cpp b/examples/quick/rendercontrol/window_singlethreaded.cpp
index 45f2635ca4..ef8f2fed43 100644
--- a/examples/quick/rendercontrol/window_singlethreaded.cpp
+++ b/examples/quick/rendercontrol/window_singlethreaded.cpp
@@ -209,16 +209,16 @@ void WindowSingleThreaded::run()
disconnect(m_qmlComponent, &QQmlComponent::statusChanged, this, &WindowSingleThreaded::run);
if (m_qmlComponent->isError()) {
- QList<QQmlError> errorList = m_qmlComponent->errors();
- foreach (const QQmlError &error, errorList)
+ const QList<QQmlError> errorList = m_qmlComponent->errors();
+ for (const QQmlError &error : errorList)
qWarning() << error.url() << error.line() << error;
return;
}
QObject *rootObject = m_qmlComponent->create();
if (m_qmlComponent->isError()) {
- QList<QQmlError> errorList = m_qmlComponent->errors();
- foreach (const QQmlError &error, errorList)
+ const QList<QQmlError> errorList = m_qmlComponent->errors();
+ for (const QQmlError &error : errorList)
qWarning() << error.url() << error.line() << error;
return;
}
diff --git a/examples/quick/scenegraph/sgengine/window.cpp b/examples/quick/scenegraph/sgengine/window.cpp
index 2e4a70d2af..759bbf1fcd 100644
--- a/examples/quick/scenegraph/sgengine/window.cpp
+++ b/examples/quick/scenegraph/sgengine/window.cpp
@@ -187,7 +187,7 @@ void Window::update()
void Window::sync()
{
QList<QSharedPointer<Item> > validItems;
- foreach (QSharedPointer<Item> item, m_items) {
+ for (QSharedPointer<Item> item : qAsConst(m_items)) {
if (!item->isDone()) {
validItems.append(item);
item->sync();
diff --git a/examples/quick/scenegraph/textureinthread/main.cpp b/examples/quick/scenegraph/textureinthread/main.cpp
index 22550cd22b..61d1c5e6dc 100644
--- a/examples/quick/scenegraph/textureinthread/main.cpp
+++ b/examples/quick/scenegraph/textureinthread/main.cpp
@@ -82,7 +82,7 @@ int main(int argc, char **argv)
// As the render threads make use of our QGuiApplication object
// to clean up gracefully, wait for them to finish before
// QGuiApp is taken off the heap.
- foreach (QThread *t, ThreadRenderer::threads) {
+ for (QThread *t : qAsConst(ThreadRenderer::threads)) {
t->wait();
delete t;
}
diff --git a/examples/quick/shared/Label.qml b/examples/quick/shared/Label.qml
new file mode 100644
index 0000000000..ea4bef5415
--- /dev/null
+++ b/examples/quick/shared/Label.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Text {
+ SystemPalette { id: palette }
+ color: palette.text
+}
diff --git a/examples/quick/shared/quick_shared.qrc b/examples/quick/shared/quick_shared.qrc
index ea7e0fdd89..21f393a64d 100644
--- a/examples/quick/shared/quick_shared.qrc
+++ b/examples/quick/shared/quick_shared.qrc
@@ -4,6 +4,7 @@
<file>SimpleLauncherDelegate.qml</file>
<file>Button.qml</file>
<file>CheckBox.qml</file>
+ <file>Label.qml</file>
<file>TextField.qml</file>
<file>images/back.png</file>
<file>images/next.png</file>
diff --git a/examples/quick/shared/shared.qrc b/examples/quick/shared/shared.qrc
index 7e0c66c34b..89b3ff757e 100644
--- a/examples/quick/shared/shared.qrc
+++ b/examples/quick/shared/shared.qrc
@@ -6,6 +6,7 @@
<file>Slider.qml</file>
<file>images/slider_handle.png</file>
<file>CheckBox.qml</file>
+ <file>Label.qml</file>
<file>TabSet.qml</file>
<file>TextField.qml</file>
<file>images/back.png</file>
diff --git a/examples/quick/window/AllScreens.qml b/examples/quick/window/AllScreens.qml
new file mode 100644
index 0000000000..83a6c5f958
--- /dev/null
+++ b/examples/quick/window/AllScreens.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+import QtQuick.Window 2.3
+import "../shared" as Shared
+
+Column {
+ id: root
+ spacing: 8
+
+ Shared.Label {
+ text: "Total number of screens: " + screenInfo.count
+ font.bold: true
+ }
+
+ Flow {
+ spacing: 12
+ width: parent.width
+
+ Repeater {
+ id: screenInfo
+ model: Qt.application.screens
+ Shared.Label {
+ lineHeight: 1.5
+ text: name + "\n" + virtualX + ", " + virtualY + " " + modelData.width + "x" + modelData.height
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ var screens = Qt.application.screens;
+ for (var i = 0; i < screens.length; ++i)
+ console.log("screen " + screens[i].name + " has geometry " +
+ screens[i].virtualX + ", " + screens[i].virtualY + " " +
+ screens[i].width + "x" + screens[i].height)
+ }
+}
diff --git a/examples/quick/window/ScreenInfo.qml b/examples/quick/window/CurrentScreen.qml
index ee0a31c794..c65baab1f4 100644
--- a/examples/quick/window/ScreenInfo.qml
+++ b/examples/quick/window/CurrentScreen.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -40,6 +40,7 @@
import QtQuick 2.3
import QtQuick.Window 2.1
+import "../shared" as Shared
Item {
id: root
@@ -70,32 +71,35 @@ Item {
y: spacing
//! [screen]
- Text {
+ Shared.Label {
text: "Screen \"" + Screen.name + "\":"
font.bold: true
}
Item { width: 1; height: 1 } // spacer
- Text { text: "dimensions" }
- Text { text: Screen.width + "x" + Screen.height }
+ Shared.Label { text: "dimensions" }
+ Shared.Label { text: Screen.width + "x" + Screen.height }
- Text { text: "pixel density" }
- Text { text: Screen.pixelDensity.toFixed(2) + " dots/mm (" + (Screen.pixelDensity * 25.4).toFixed(2) + " dots/inch)" }
+ Shared.Label { text: "pixel density" }
+ Shared.Label { text: Screen.pixelDensity.toFixed(2) + " dots/mm (" + (Screen.pixelDensity * 25.4).toFixed(2) + " dots/inch)" }
- Text { text: "logical pixel density" }
- Text { text: Screen.logicalPixelDensity.toFixed(2) + " dots/mm (" + (Screen.logicalPixelDensity * 25.4).toFixed(2) + " dots/inch)" }
+ Shared.Label { text: "logical pixel density" }
+ Shared.Label { text: Screen.logicalPixelDensity.toFixed(2) + " dots/mm (" + (Screen.logicalPixelDensity * 25.4).toFixed(2) + " dots/inch)" }
- Text { text: "device pixel ratio" }
- Text { text: Screen.devicePixelRatio.toFixed(2) }
+ Shared.Label { text: "device pixel ratio" }
+ Shared.Label { text: Screen.devicePixelRatio.toFixed(2) }
- Text { text: "available virtual desktop" }
- Text { text: Screen.desktopAvailableWidth + "x" + Screen.desktopAvailableHeight }
+ Shared.Label { text: "available virtual desktop" }
+ Shared.Label { text: Screen.desktopAvailableWidth + "x" + Screen.desktopAvailableHeight }
- Text { text: "orientation" }
- Text { text: orientationToString(Screen.orientation) + " (" + Screen.orientation + ")" }
+ Shared.Label { text: "position in virtual desktop" }
+ Shared.Label { text: Screen.virtualX + ", " + Screen.virtualY }
- Text { text: "primary orientation" }
- Text { text: orientationToString(Screen.primaryOrientation) + " (" + Screen.primaryOrientation + ")" }
+ Shared.Label { text: "orientation" }
+ Shared.Label { text: orientationToString(Screen.orientation) + " (" + Screen.orientation + ")" }
+
+ Shared.Label { text: "primary orientation" }
+ Shared.Label { text: orientationToString(Screen.primaryOrientation) + " (" + Screen.primaryOrientation + ")" }
//! [screen]
}
}
diff --git a/examples/quick/window/Splash.qml b/examples/quick/window/Splash.qml
index 083c3babc8..3baf207992 100644
--- a/examples/quick/window/Splash.qml
+++ b/examples/quick/window/Splash.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
diff --git a/examples/quick/window/doc/src/window.qdoc b/examples/quick/window/doc/src/window.qdoc
index 5cd51beceb..2028b31383 100644
--- a/examples/quick/window/doc/src/window.qdoc
+++ b/examples/quick/window/doc/src/window.qdoc
@@ -73,7 +73,7 @@
\l Screen has several properties which are generally useful to
applications which need to rotate some content when the screen orientation
changes, to position windows on the screen or to convert real units to
- logical pixel units. ScreenInfo.qml (which is displayed inline in
+ logical pixel units. CurrentScreen.qml (which is displayed inline in
window.qml, or can be run by itself with qmlscene) simply displays the
property values, while the splash screen uses them to center the window on
the screen.
diff --git a/examples/quick/window/main.cpp b/examples/quick/window/main.cpp
index bacf52af15..ee8855cbc8 100644
--- a/examples/quick/window/main.cpp
+++ b/examples/quick/window/main.cpp
@@ -49,7 +49,8 @@
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
- foreach (QScreen * screen, QGuiApplication::screens())
+ const auto screens = QGuiApplication::screens();
+ for (QScreen *screen : screens)
screen->setOrientationUpdateMask(Qt::LandscapeOrientation | Qt::PortraitOrientation |
Qt::InvertedLandscapeOrientation | Qt::InvertedPortraitOrientation);
QQmlEngine engine;
diff --git a/examples/quick/window/window.qml b/examples/quick/window/window.qml
index d50bce61b3..d27ab3d0a3 100644
--- a/examples/quick/window/window.qml
+++ b/examples/quick/window/window.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Window 2.1
+import QtQuick.Window 2.3
import "../shared" as Shared
QtObject {
@@ -47,7 +47,7 @@ QtObject {
property SystemPalette palette: SystemPalette { }
property var controlWindow: Window {
- width: visibilityLabel.implicitWidth * 1.2
+ width: col.implicitWidth + defaultSpacing * 2
height: col.implicitHeight + defaultSpacing * 2
color: palette.window
title: "Control Window"
@@ -57,7 +57,7 @@ QtObject {
anchors.margins: defaultSpacing
spacing: defaultSpacing
property real cellWidth: col.width / 3 - spacing
- Text { text: "Control the second window:" }
+ Shared.Label { text: "Control the second window:" }
Grid {
id: grid
columns: 3
@@ -121,18 +121,23 @@ QtObject {
}
return "unknown";
}
- Text {
+ Shared.Label {
id: visibilityLabel
text: "second window is " + (testWindow.visible ? "visible" : "invisible") +
" and has visibility " + parent.visibilityToString(testWindow.visibility)
}
Rectangle {
- id: horizontalRule
- color: "black"
+ color: palette.text
width: parent.width
height: 1
}
- ScreenInfo { }
+ CurrentScreen { }
+ Rectangle {
+ color: palette.text
+ width: parent.width
+ height: 1
+ }
+ AllScreens { width: parent.width }
}
}
@@ -145,7 +150,7 @@ QtObject {
Rectangle {
anchors.fill: parent
anchors.margins: defaultSpacing
- Text {
+ Shared.Label {
anchors.centerIn: parent
text: "Second Window"
}
diff --git a/examples/quick/window/window.qrc b/examples/quick/window/window.qrc
index dc211bdaaf..89d1de1b1f 100644
--- a/examples/quick/window/window.qrc
+++ b/examples/quick/window/window.qrc
@@ -2,6 +2,7 @@
<qresource prefix="/window">
<file>window.qml</file>
<file>Splash.qml</file>
- <file>ScreenInfo.qml</file>
+ <file>CurrentScreen.qml</file>
+ <file>AllScreens.qml</file>
</qresource>
</RCC>
diff --git a/src/imports/folderlistmodel/fileinfothread_p.h b/src/imports/folderlistmodel/fileinfothread_p.h
index 8a154f264e..56058fd6be 100644
--- a/src/imports/folderlistmodel/fileinfothread_p.h
+++ b/src/imports/folderlistmodel/fileinfothread_p.h
@@ -94,7 +94,7 @@ public Q_SLOTS:
#endif
protected:
- void run();
+ void run() override;
void getFileInfos(const QString &path);
void findChangeRange(const QList<FileProperty> &list, int &fromIndex, int &toIndex);
diff --git a/src/imports/folderlistmodel/fileproperty_p.h b/src/imports/folderlistmodel/fileproperty_p.h
index f385cdfdb4..48be4a3d85 100644
--- a/src/imports/folderlistmodel/fileproperty_p.h
+++ b/src/imports/folderlistmodel/fileproperty_p.h
@@ -57,17 +57,17 @@
class FileProperty
{
public:
- FileProperty(const QFileInfo &info)
+ FileProperty(const QFileInfo &info) :
+ mFileName(info.fileName()),
+ mFilePath(info.filePath()),
+ mBaseName(info.baseName()),
+ mSuffix(info.completeSuffix()),
+ mSize(info.size()),
+ mIsDir(info.isDir()),
+ mIsFile(info.isFile()),
+ mLastModified(info.lastModified()),
+ mLastRead(info.lastRead())
{
- mFileName = info.fileName();
- mFilePath = info.filePath();
- mBaseName = info.baseName();
- mSize = info.size();
- mSuffix = info.completeSuffix();
- mIsDir = info.isDir();
- mIsFile = info.isFile();
- mLastModified = info.lastModified();
- mLastRead = info.lastRead();
}
~FileProperty()
{}
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.h b/src/imports/folderlistmodel/qquickfolderlistmodel.h
index aae6df452d..dee73dff3e 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.h
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.h
@@ -94,10 +94,10 @@ public:
FileUrlRole = Qt::UserRole + 9
};
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- virtual QHash<int, QByteArray> roleNames() const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ QHash<int, QByteArray> roleNames() const override;
//![abslistmodel]
//![count]
@@ -144,8 +144,8 @@ public:
Q_INVOKABLE int indexOf(const QUrl &file) const;
//![parserstatus]
- virtual void classBegin();
- virtual void componentComplete();
+ void classBegin() override;
+ void componentComplete() override;
//![parserstatus]
int roleFromString(const QString &roleName) const;
diff --git a/src/imports/layouts/qquickgridlayoutengine_p.h b/src/imports/layouts/qquickgridlayoutengine_p.h
index 86f56a5af4..2810e2e5d0 100644
--- a/src/imports/layouts/qquickgridlayoutengine_p.h
+++ b/src/imports/layouts/qquickgridlayoutengine_p.h
@@ -67,7 +67,7 @@ public:
: QGridLayoutItem(row, column, rowSpan, columnSpan, alignment), m_item(item), sizeHintCacheDirty(true), useFallbackToWidthOrHeight(true) {}
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const override
{
Q_UNUSED(constraint); // Quick Layouts does not support constraint atm
return effectiveSizeHints()[which];
@@ -99,12 +99,12 @@ public:
sizeHintCacheDirty = true;
}
- QLayoutPolicy::Policy sizePolicy(Qt::Orientation orientation) const
+ QLayoutPolicy::Policy sizePolicy(Qt::Orientation orientation) const override
{
return QQuickLayout::effectiveSizePolicy_helper(m_item, orientation, attachedLayoutObject(m_item, false));
}
- void setGeometry(const QRectF &rect)
+ void setGeometry(const QRectF &rect) override
{
QQuickLayoutAttached *info = attachedLayoutObject(m_item, false);
const QRectF r = info ? rect.marginsRemoved(info->qMargins()) : rect;
diff --git a/src/imports/layouts/qquicklinearlayout_p.h b/src/imports/layouts/qquicklinearlayout_p.h
index 86404f8d79..ca8b867824 100644
--- a/src/imports/layouts/qquicklinearlayout_p.h
+++ b/src/imports/layouts/qquicklinearlayout_p.h
@@ -158,7 +158,7 @@ public:
Flow flow() const;
void setFlow(Flow flow);
- void insertLayoutItems();
+ void insertLayoutItems() override;
signals:
void columnSpacingChanged();
@@ -200,7 +200,7 @@ public:
qreal spacing() const;
void setSpacing(qreal spacing);
- void insertLayoutItems();
+ void insertLayoutItems() override;
signals:
void spacingChanged();
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index bf70fd1050..b8fd307215 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -794,7 +794,7 @@ public:
}
void registerTypes(const char *uri) Q_DECL_OVERRIDE
{
- Q_ASSERT(QLatin1String(uri) == "QtQuick.LocalStorage");
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.LocalStorage"));
qmlRegisterSingletonType<QQuickLocalStorage>(uri, 2, 0, "LocalStorage", module_api_factory);
}
};
diff --git a/src/imports/settings/qqmlsettings_p.h b/src/imports/settings/qqmlsettings_p.h
index 0ed55579dd..ce942d7564 100644
--- a/src/imports/settings/qqmlsettings_p.h
+++ b/src/imports/settings/qqmlsettings_p.h
@@ -74,10 +74,10 @@ public:
void setCategory(const QString &category);
protected:
- void timerEvent(QTimerEvent *event);
+ void timerEvent(QTimerEvent *event) override;
- void classBegin();
- void componentComplete();
+ void classBegin() override;
+ void componentComplete() override;
private:
Q_DISABLE_COPY(QQmlSettings)
diff --git a/src/imports/statemachine/state.h b/src/imports/statemachine/state.h
index 73e4ecda6b..8e8cefab19 100644
--- a/src/imports/statemachine/state.h
+++ b/src/imports/statemachine/state.h
@@ -58,8 +58,8 @@ class State : public QState, public QQmlParserStatus
public:
explicit State(QState *parent = 0);
- void classBegin() {}
- void componentComplete();
+ void classBegin() override {}
+ void componentComplete() override;
QQmlListProperty<QObject> children();
diff --git a/src/imports/statemachine/statemachine.h b/src/imports/statemachine/statemachine.h
index 59a810f387..cb0ab43f8b 100644
--- a/src/imports/statemachine/statemachine.h
+++ b/src/imports/statemachine/statemachine.h
@@ -62,8 +62,8 @@ class StateMachine : public QStateMachine, public QQmlParserStatus
public:
explicit StateMachine(QObject *parent = 0);
- void classBegin() {}
- void componentComplete();
+ void classBegin() override {}
+ void componentComplete() override;
QQmlListProperty<QObject> children();
bool isRunning() const;
diff --git a/src/imports/statemachine/timeouttransition.h b/src/imports/statemachine/timeouttransition.h
index 5d71e86bb4..0e5f5377e3 100644
--- a/src/imports/statemachine/timeouttransition.h
+++ b/src/imports/statemachine/timeouttransition.h
@@ -59,8 +59,8 @@ public:
int timeout() const;
void setTimeout(int timeout);
- void classBegin() {}
- void componentComplete();
+ void classBegin() override {}
+ void componentComplete() override;
Q_SIGNALS:
void timeoutChanged();
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
index 6e9e57a046..4306f477e9 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
@@ -176,7 +176,7 @@ public:
QQuickXmlQueryThreadObject(QQuickXmlQueryEngine *);
void processJobs();
- virtual bool event(QEvent *e);
+ bool event(QEvent *e) override;
private:
QQuickXmlQueryEngine *m_queryEngine;
@@ -202,7 +202,7 @@ signals:
void error(void*, const QString&);
protected:
- void run();
+ void run() override;
private:
void processQuery(XmlQueryJob *job);
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel_p.h b/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
index f0096a9125..3a4487a085 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
@@ -95,10 +95,10 @@ public:
QQuickXmlListModel(QObject *parent = 0);
~QQuickXmlListModel();
- QModelIndex index(int row, int column, const QModelIndex &parent) const;
- int rowCount(const QModelIndex &parent) const;
- QVariant data(const QModelIndex &index, int role) const;
- QHash<int, QByteArray> roleNames() const;
+ QModelIndex index(int row, int column, const QModelIndex &parent) const override;
+ int rowCount(const QModelIndex &parent) const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+ QHash<int, QByteArray> roleNames() const override;
int count() const;
@@ -124,8 +124,8 @@ public:
Q_INVOKABLE QString errorString() const;
- virtual void classBegin();
- virtual void componentComplete();
+ void classBegin() override;
+ void componentComplete() override;
Q_SIGNALS:
void statusChanged(QQuickXmlListModel::Status);
@@ -194,7 +194,7 @@ public:
Q_EMIT isKeyChanged();
}
- bool isValid() {
+ bool isValid() const {
return !m_name.isEmpty() && !m_query.isEmpty();
}
diff --git a/src/particles/qquickage_p.h b/src/particles/qquickage_p.h
index f6e277f8a7..5db6167dc1 100644
--- a/src/particles/qquickage_p.h
+++ b/src/particles/qquickage_p.h
@@ -74,7 +74,8 @@ public:
}
protected:
- virtual bool affectParticle(QQuickParticleData *d, qreal dt);
+ bool affectParticle(QQuickParticleData *d, qreal dt) override;
+
Q_SIGNALS:
void lifeLeftChanged(int arg);
void advancePositionChanged(bool arg);
diff --git a/src/particles/qquickangledirection.cpp b/src/particles/qquickangledirection.cpp
index 09aa047670..6f30e24a26 100644
--- a/src/particles/qquickangledirection.cpp
+++ b/src/particles/qquickangledirection.cpp
@@ -104,7 +104,7 @@ QQuickAngleDirection::QQuickAngleDirection(QObject *parent) :
}
-const QPointF QQuickAngleDirection::sample(const QPointF &from)
+QPointF QQuickAngleDirection::sample(const QPointF &from)
{
Q_UNUSED(from);
QPointF ret;
diff --git a/src/particles/qquickangledirection_p.h b/src/particles/qquickangledirection_p.h
index 3e981c5f9e..66290fb19e 100644
--- a/src/particles/qquickangledirection_p.h
+++ b/src/particles/qquickangledirection_p.h
@@ -62,7 +62,7 @@ class QQuickAngleDirection : public QQuickDirection
Q_PROPERTY(qreal magnitudeVariation READ magnitudeVariation WRITE setMagnitudeVariation NOTIFY magnitudeVariationChanged)
public:
explicit QQuickAngleDirection(QObject *parent = 0);
- const QPointF sample(const QPointF &from);
+ QPointF sample(const QPointF &from) override;
qreal angle() const
{
return m_angle;
diff --git a/src/particles/qquickcumulativedirection.cpp b/src/particles/qquickcumulativedirection.cpp
index b6b3e76f69..6fbd53df48 100644
--- a/src/particles/qquickcumulativedirection.cpp
+++ b/src/particles/qquickcumulativedirection.cpp
@@ -59,7 +59,7 @@ QQmlListProperty<QQuickDirection> QQuickCumulativeDirection::directions()
return QQmlListProperty<QQuickDirection>(this, m_directions);//TODO: Proper list property
}
-const QPointF QQuickCumulativeDirection::sample(const QPointF &from)
+QPointF QQuickCumulativeDirection::sample(const QPointF &from)
{
QPointF ret;
foreach (QQuickDirection* dir, m_directions)
diff --git a/src/particles/qquickcumulativedirection_p.h b/src/particles/qquickcumulativedirection_p.h
index 9af86bd39e..39f8ab8a24 100644
--- a/src/particles/qquickcumulativedirection_p.h
+++ b/src/particles/qquickcumulativedirection_p.h
@@ -62,7 +62,7 @@ class QQuickCumulativeDirection : public QQuickDirection
public:
explicit QQuickCumulativeDirection(QObject *parent = 0);
QQmlListProperty<QQuickDirection> directions();
- const QPointF sample(const QPointF &from);
+ QPointF sample(const QPointF &from) override;
private:
QList<QQuickDirection*> m_directions;
};
diff --git a/src/particles/qquickcustomaffector_p.h b/src/particles/qquickcustomaffector_p.h
index a383b196c2..c1745798c3 100644
--- a/src/particles/qquickcustomaffector_p.h
+++ b/src/particles/qquickcustomaffector_p.h
@@ -69,7 +69,7 @@ class QQuickCustomAffector : public QQuickParticleAffector
public:
explicit QQuickCustomAffector(QQuickItem *parent = 0);
- virtual void affectSystem(qreal dt);
+ void affectSystem(qreal dt) override;
QQuickDirection * position() const
{
@@ -153,7 +153,8 @@ public Q_SLOTS:
protected:
bool isAffectConnected();
- virtual bool affectParticle(QQuickParticleData *d, qreal dt);
+ bool affectParticle(QQuickParticleData *d, qreal dt) override;
+
private:
void affectProperties(const QList<QQuickParticleData*> particles, qreal dt);
QQuickDirection * m_position;
diff --git a/src/particles/qquickcustomparticle_p.h b/src/particles/qquickcustomparticle_p.h
index e9d68cbe5c..1d48786a41 100644
--- a/src/particles/qquickcustomparticle_p.h
+++ b/src/particles/qquickcustomparticle_p.h
@@ -84,18 +84,18 @@ Q_SIGNALS:
void vertexShaderChanged();
protected:
- virtual void initialize(int gIdx, int pIdx);
- virtual void commit(int gIdx, int pIdx);
+ void initialize(int gIdx, int pIdx) override;
+ void commit(int gIdx, int pIdx) override;
- QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
QQuickOpenGLShaderEffectNode *prepareNextFrame(QQuickOpenGLShaderEffectNode *rootNode);
- void reset();
+ void reset() override;
void resize(int oldCount, int newCount);
- virtual void componentComplete();
+ void componentComplete() override;
QQuickOpenGLShaderEffectNode *buildCustomNodes();
- void sceneGraphInvalidated();
- void itemChange(ItemChange change, const ItemChangeData &value);
+ void sceneGraphInvalidated() override;
+ void itemChange(ItemChange change, const ItemChangeData &value) override;
private Q_SLOTS:
void sourceDestroyed(QObject *object);
diff --git a/src/particles/qquickdirection.cpp b/src/particles/qquickdirection.cpp
index da1edfb3c3..fd94c8945c 100644
--- a/src/particles/qquickdirection.cpp
+++ b/src/particles/qquickdirection.cpp
@@ -56,7 +56,7 @@ QQuickDirection::QQuickDirection(QObject *parent) :
{
}
-const QPointF QQuickDirection::sample(const QPointF &from)
+QPointF QQuickDirection::sample(const QPointF &from)
{
Q_UNUSED(from);
return QPointF();
diff --git a/src/particles/qquickdirection_p.h b/src/particles/qquickdirection_p.h
index f7029488f7..10960f9920 100644
--- a/src/particles/qquickdirection_p.h
+++ b/src/particles/qquickdirection_p.h
@@ -62,7 +62,7 @@ class QQuickDirection : public QObject
public:
explicit QQuickDirection(QObject *parent = 0);
- virtual const QPointF sample(const QPointF &from);
+ virtual QPointF sample(const QPointF &from);
Q_SIGNALS:
public Q_SLOTS:
diff --git a/src/particles/qquickellipseextruder_p.h b/src/particles/qquickellipseextruder_p.h
index 1df7e32c83..0af7f4d94f 100644
--- a/src/particles/qquickellipseextruder_p.h
+++ b/src/particles/qquickellipseextruder_p.h
@@ -60,8 +60,8 @@ class QQuickEllipseExtruder : public QQuickParticleExtruder
Q_PROPERTY(bool fill READ fill WRITE setFill NOTIFY fillChanged)//###Use base class? If it's still box
public:
explicit QQuickEllipseExtruder(QObject *parent = 0);
- virtual QPointF extrude(const QRectF &);
- virtual bool contains(const QRectF &bounds, const QPointF &point);
+ QPointF extrude(const QRectF &) override;
+ bool contains(const QRectF &bounds, const QPointF &point) override;
bool fill() const
{
diff --git a/src/particles/qquickfriction_p.h b/src/particles/qquickfriction_p.h
index b67de631be..05ae7a38d5 100644
--- a/src/particles/qquickfriction_p.h
+++ b/src/particles/qquickfriction_p.h
@@ -73,7 +73,7 @@ public:
}
protected:
- virtual bool affectParticle(QQuickParticleData *d, qreal dt);
+ bool affectParticle(QQuickParticleData *d, qreal dt) override;
Q_SIGNALS:
diff --git a/src/particles/qquickgravity_p.h b/src/particles/qquickgravity_p.h
index 7c071c932d..d3a7f6665c 100644
--- a/src/particles/qquickgravity_p.h
+++ b/src/particles/qquickgravity_p.h
@@ -72,7 +72,8 @@ public:
return m_angle;
}
protected:
- virtual bool affectParticle(QQuickParticleData *d, qreal dt);
+ bool affectParticle(QQuickParticleData *d, qreal dt) override;
+
Q_SIGNALS:
void magnitudeChanged(qreal arg);
diff --git a/src/particles/qquickgroupgoal_p.h b/src/particles/qquickgroupgoal_p.h
index 0b935fc1d1..9a56ef5cce 100644
--- a/src/particles/qquickgroupgoal_p.h
+++ b/src/particles/qquickgroupgoal_p.h
@@ -75,7 +75,7 @@ public:
}
protected:
- virtual bool affectParticle(QQuickParticleData *d, qreal dt);
+ bool affectParticle(QQuickParticleData *d, qreal dt) override;
Q_SIGNALS:
diff --git a/src/particles/qquickimageparticle_p.h b/src/particles/qquickimageparticle_p.h
index 492ec23c07..95323c25a6 100644
--- a/src/particles/qquickimageparticle_p.h
+++ b/src/particles/qquickimageparticle_p.h
@@ -347,15 +347,15 @@ public Q_SLOTS:
void setEntryEffect(EntryEffect arg);
protected:
- void reset();
- virtual void initialize(int gIdx, int pIdx);
- virtual void commit(int gIdx, int pIdx);
+ void reset() override;
+ void initialize(int gIdx, int pIdx) override;
+ void commit(int gIdx, int pIdx) override;
- QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
void prepareNextFrame(QSGNode**);
void buildParticleNodes(QSGNode**);
- void sceneGraphInvalidated();
+ void sceneGraphInvalidated() override;
private Q_SLOTS:
void createEngine(); //### method invoked by sprite list changing (in engine.h) - pretty nasty
@@ -440,7 +440,7 @@ private:
}
template<class MaterialData>
- MaterialData* getState(QSGMaterial* m){
+ static MaterialData* getState(QSGMaterial* m) {
return static_cast<QSGSimpleMaterial<MaterialData> *>(m)->state();
}
EntryEffect m_entryEffect;
diff --git a/src/particles/qquickitemparticle_p.h b/src/particles/qquickitemparticle_p.h
index 0edd05dfc7..9e6c7deaea 100644
--- a/src/particles/qquickitemparticle_p.h
+++ b/src/particles/qquickitemparticle_p.h
@@ -70,7 +70,7 @@ public:
bool fade() const { return m_fade; }
- virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
static QQuickItemParticleAttached *qmlAttachedProperties(QObject *object);
QQmlComponent* delegate() const
@@ -100,9 +100,9 @@ public Q_SLOTS:
}
protected:
- virtual void reset();
- virtual void commit(int gIdx, int pIdx);
- virtual void initialize(int gIdx, int pIdx);
+ void reset() override;
+ void commit(int gIdx, int pIdx) override;
+ void initialize(int gIdx, int pIdx) override;
void prepareNextFrame();
private:
void processDeletables();
@@ -131,7 +131,7 @@ public:
QQuickItemParticleAttached(QObject* parent)
: QObject(parent), m_mp(0)
{;}
- QQuickItemParticle* particle() {return m_mp;}
+ QQuickItemParticle* particle() const { return m_mp; }
void detach(){Q_EMIT detached();}
void attach(){Q_EMIT attached();}
private:
diff --git a/src/particles/qquicklineextruder_p.h b/src/particles/qquicklineextruder_p.h
index 72d2300dce..306f3a1dd6 100644
--- a/src/particles/qquicklineextruder_p.h
+++ b/src/particles/qquicklineextruder_p.h
@@ -56,11 +56,11 @@ class QQuickLineExtruder : public QQuickParticleExtruder
{
Q_OBJECT
//Default is topleft to bottom right. Flipped makes it topright to bottom left
- Q_PROPERTY(bool mirrored READ mirrored WRITE setmirrored NOTIFY mirroredChanged)
+ Q_PROPERTY(bool mirrored READ mirrored WRITE setMirrored NOTIFY mirroredChanged)
public:
explicit QQuickLineExtruder(QObject *parent = 0);
- virtual QPointF extrude(const QRectF &);
+ QPointF extrude(const QRectF &) override;
bool mirrored() const
{
return m_mirrored;
@@ -72,7 +72,7 @@ Q_SIGNALS:
public Q_SLOTS:
- void setmirrored(bool arg)
+ void setMirrored(bool arg)
{
if (m_mirrored != arg) {
m_mirrored = arg;
diff --git a/src/particles/qquickmaskextruder_p.h b/src/particles/qquickmaskextruder_p.h
index 32ace521da..0fc0331db8 100644
--- a/src/particles/qquickmaskextruder_p.h
+++ b/src/particles/qquickmaskextruder_p.h
@@ -63,8 +63,8 @@ class QQuickMaskExtruder : public QQuickParticleExtruder
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
public:
explicit QQuickMaskExtruder(QObject *parent = 0);
- virtual QPointF extrude(const QRectF &);
- virtual bool contains(const QRectF &bounds, const QPointF &point);
+ QPointF extrude(const QRectF &) override;
+ bool contains(const QRectF &bounds, const QPointF &point) override;
QUrl source() const
{
diff --git a/src/particles/qquickparticleaffector.cpp b/src/particles/qquickparticleaffector.cpp
index 6ed0d9e14a..31bcfb82af 100644
--- a/src/particles/qquickparticleaffector.cpp
+++ b/src/particles/qquickparticleaffector.cpp
@@ -244,7 +244,7 @@ void QQuickParticleAffector::updateOffsets()
m_offset = m_system->mapFromItem(this, QPointF(0, 0));
}
-bool QQuickParticleAffector::isColliding(QQuickParticleData *d)
+bool QQuickParticleAffector::isColliding(QQuickParticleData *d) const
{
qreal myCurX = d->curX(m_system);
qreal myCurY = d->curY(m_system);
diff --git a/src/particles/qquickparticleaffector_p.h b/src/particles/qquickparticleaffector_p.h
index c42c0b4cba..5c9652bc32 100644
--- a/src/particles/qquickparticleaffector_p.h
+++ b/src/particles/qquickparticleaffector_p.h
@@ -185,7 +185,7 @@ protected:
bool activeGroup(int g);
bool shouldAffect(QQuickParticleData* datum);//Call to do the logic on whether it is affecting that datum
void postAffect(QQuickParticleData* datum);//Call to do the post-affect logic on particles which WERE affected(once off, needs reset, affected signal)
- virtual void componentComplete();
+ void componentComplete() override;
bool isAffectedConnected();
static const qreal simulationDelta;
static const qreal simulationCutoff;
@@ -200,7 +200,7 @@ private:
QStringList m_whenCollidingWith;
- bool isColliding(QQuickParticleData* d);
+ bool isColliding(QQuickParticleData* d) const;
};
QT_END_NAMESPACE
diff --git a/src/particles/qquickparticleemitter_p.h b/src/particles/qquickparticleemitter_p.h
index b3f96ae3e6..4f7e12da44 100644
--- a/src/particles/qquickparticleemitter_p.h
+++ b/src/particles/qquickparticleemitter_p.h
@@ -133,7 +133,7 @@ public:
qreal velocityFromMovement() const { return m_velocity_from_movement; }
void setVelocityFromMovement(qreal s);
- virtual void componentComplete();
+ void componentComplete() override;
Q_SIGNALS:
void emitParticles(QQmlV4Handle particles);
void particlesPerSecondChanged(qreal);
diff --git a/src/particles/qquickparticlegroup_p.h b/src/particles/qquickparticlegroup_p.h
index 25cc2130b1..0314234569 100644
--- a/src/particles/qquickparticlegroup_p.h
+++ b/src/particles/qquickparticlegroup_p.h
@@ -104,8 +104,8 @@ Q_SIGNALS:
void systemChanged(QQuickParticleSystem* arg);
protected:
- virtual void componentComplete();
- virtual void classBegin(){;}
+ void componentComplete() override;
+ void classBegin() override {}
private:
diff --git a/src/particles/qquickparticlepainter_p.h b/src/particles/qquickparticlepainter_p.h
index 064ce27fe8..ac14a18103 100644
--- a/src/particles/qquickparticlepainter_p.h
+++ b/src/particles/qquickparticlepainter_p.h
@@ -98,7 +98,7 @@ public:
return m_groupIds;
}
- void itemChange(ItemChange, const ItemChangeData &);
+ void itemChange(ItemChange, const ItemChangeData &) override;
Q_SIGNALS:
void countChanged();
@@ -123,7 +123,7 @@ protected:
*/
virtual void reset();
- virtual void componentComplete();
+ void componentComplete() override;
virtual void initialize(int gIdx, int pIdx){//Called from main thread
Q_UNUSED(gIdx);
Q_UNUSED(pIdx);
diff --git a/src/particles/qquickparticlesystem_p.h b/src/particles/qquickparticlesystem_p.h
index b57d55bd98..de39b436e2 100644
--- a/src/particles/qquickparticlesystem_p.h
+++ b/src/particles/qquickparticlesystem_p.h
@@ -389,7 +389,7 @@ public Q_SLOTS:
protected:
//This one only once per frame (effectively)
- void componentComplete();
+ void componentComplete() override;
private Q_SLOTS:
void emittersChanged();
@@ -477,12 +477,12 @@ public:
: QAbstractAnimation(static_cast<QObject*>(system)), m_system(system)
{ }
protected:
- virtual void updateCurrentTime( int t )
+ void updateCurrentTime(int t) override
{
m_system->updateCurrentTime(t);
}
- virtual int duration() const
+ int duration() const override
{
return -1;
}
diff --git a/src/particles/qquickpointattractor_p.h b/src/particles/qquickpointattractor_p.h
index 99fae300c6..47985b5e82 100644
--- a/src/particles/qquickpointattractor_p.h
+++ b/src/particles/qquickpointattractor_p.h
@@ -160,7 +160,8 @@ void setProportionalToDistance(Proportion arg)
}
protected:
- virtual bool affectParticle(QQuickParticleData *d, qreal dt);
+ bool affectParticle(QQuickParticleData *d, qreal dt) override;
+
private:
qreal m_strength;
qreal m_x;
diff --git a/src/particles/qquickpointdirection.cpp b/src/particles/qquickpointdirection.cpp
index dbd15148ba..9038ce0aa0 100644
--- a/src/particles/qquickpointdirection.cpp
+++ b/src/particles/qquickpointdirection.cpp
@@ -75,7 +75,7 @@ QQuickPointDirection::QQuickPointDirection(QObject *parent) :
{
}
-const QPointF QQuickPointDirection::sample(const QPointF &)
+QPointF QQuickPointDirection::sample(const QPointF &)
{
QPointF ret;
ret.setX(m_x - m_xVariation + rand() / float(RAND_MAX) * m_xVariation * 2);
diff --git a/src/particles/qquickpointdirection_p.h b/src/particles/qquickpointdirection_p.h
index b01dc7ea4e..a80be928ad 100644
--- a/src/particles/qquickpointdirection_p.h
+++ b/src/particles/qquickpointdirection_p.h
@@ -63,7 +63,7 @@ class QQuickPointDirection : public QQuickDirection
Q_PROPERTY(qreal yVariation READ yVariation WRITE setYVariation NOTIFY yVariationChanged)
public:
explicit QQuickPointDirection(QObject *parent = 0);
- virtual const QPointF sample(const QPointF &from);
+ QPointF sample(const QPointF &from) override;
qreal x() const
{
return m_x;
diff --git a/src/particles/qquickrectangleextruder_p.h b/src/particles/qquickrectangleextruder_p.h
index 001031c711..630cf3050d 100644
--- a/src/particles/qquickrectangleextruder_p.h
+++ b/src/particles/qquickrectangleextruder_p.h
@@ -62,8 +62,8 @@ class QQuickRectangleExtruder : public QQuickParticleExtruder
public:
explicit QQuickRectangleExtruder(QObject *parent = 0);
- virtual QPointF extrude(const QRectF &);
- virtual bool contains(const QRectF &bounds, const QPointF &point);
+ QPointF extrude(const QRectF &) override;
+ bool contains(const QRectF &bounds, const QPointF &point) override;
bool fill() const
{
return m_fill;
diff --git a/src/particles/qquickspritegoal_p.h b/src/particles/qquickspritegoal_p.h
index 7174fd2318..2b15d0b8bb 100644
--- a/src/particles/qquickspritegoal_p.h
+++ b/src/particles/qquickspritegoal_p.h
@@ -81,7 +81,8 @@ public:
}
protected:
- virtual bool affectParticle(QQuickParticleData *d, qreal dt);
+ bool affectParticle(QQuickParticleData *d, qreal dt) override;
+
Q_SIGNALS:
void goalStateChanged(const QString &arg);
diff --git a/src/particles/qquicktargetdirection.cpp b/src/particles/qquicktargetdirection.cpp
index f9bcfbc564..012c9a151b 100644
--- a/src/particles/qquicktargetdirection.cpp
+++ b/src/particles/qquicktargetdirection.cpp
@@ -94,7 +94,7 @@ QQuickTargetDirection::QQuickTargetDirection(QObject *parent) :
{
}
-const QPointF QQuickTargetDirection::sample(const QPointF &from)
+QPointF QQuickTargetDirection::sample(const QPointF &from)
{
//###This approach loses interpolating the last position of the target (like we could with the emitter) is it worthwhile?
QPointF ret;
diff --git a/src/particles/qquicktargetdirection_p.h b/src/particles/qquicktargetdirection_p.h
index 4de5867336..13e826743e 100644
--- a/src/particles/qquicktargetdirection_p.h
+++ b/src/particles/qquicktargetdirection_p.h
@@ -71,7 +71,7 @@ class QQuickTargetDirection : public QQuickDirection
public:
explicit QQuickTargetDirection(QObject *parent = 0);
- virtual const QPointF sample(const QPointF &from);
+ QPointF sample(const QPointF &from) override;
qreal targetX() const
{
diff --git a/src/particles/qquicktrailemitter_p.h b/src/particles/qquicktrailemitter_p.h
index b70f34999a..99464436ba 100644
--- a/src/particles/qquicktrailemitter_p.h
+++ b/src/particles/qquicktrailemitter_p.h
@@ -71,8 +71,8 @@ public:
};
Q_ENUM(EmitSize)
explicit QQuickTrailEmitter(QQuickItem *parent = 0);
- virtual void emitWindow(int timeStamp);
- virtual void reset();
+ void emitWindow(int timeStamp) override;
+ void reset() override;
int particlesPerParticlePerSecond() const
{
diff --git a/src/particles/qquickturbulence_p.h b/src/particles/qquickturbulence_p.h
index 7a6be1719e..e73f3ba153 100644
--- a/src/particles/qquickturbulence_p.h
+++ b/src/particles/qquickturbulence_p.h
@@ -65,7 +65,7 @@ class QQuickTurbulenceAffector : public QQuickParticleAffector
public:
explicit QQuickTurbulenceAffector(QQuickItem *parent = 0);
~QQuickTurbulenceAffector();
- virtual void affectSystem(qreal dt);
+ void affectSystem(qreal dt) override;
qreal strength() const
{
@@ -102,8 +102,8 @@ public Q_SLOTS:
}
protected:
- virtual void geometryChanged(const QRectF &newGeometry,
- const QRectF &oldGeometry);
+ void geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry) override;
private:
void ensureInit();
void mapUpdate();
diff --git a/src/particles/qquickv4particledata.cpp b/src/particles/qquickv4particledata.cpp
index bd43d45c38..967652f31a 100644
--- a/src/particles/qquickv4particledata.cpp
+++ b/src/particles/qquickv4particledata.cpp
@@ -525,7 +525,7 @@ QQuickV4ParticleData::~QQuickV4ParticleData()
{
}
-QQmlV4Handle QQuickV4ParticleData::v4Value()
+QQmlV4Handle QQuickV4ParticleData::v4Value() const
{
return QQmlV4Handle(m_v4Value.value());
}
diff --git a/src/particles/qquickv4particledata_p.h b/src/particles/qquickv4particledata_p.h
index 437491ff42..d73e3b644d 100644
--- a/src/particles/qquickv4particledata_p.h
+++ b/src/particles/qquickv4particledata_p.h
@@ -63,7 +63,7 @@ class QQuickV4ParticleData {
public:
QQuickV4ParticleData(QV8Engine*, QQuickParticleData*, QQuickParticleSystem *system);
~QQuickV4ParticleData();
- QQmlV4Handle v4Value();
+ QQmlV4Handle v4Value() const;
private:
QV4::PersistentValue m_v4Value;
};
diff --git a/src/particles/qquickwander_p.h b/src/particles/qquickwander_p.h
index 6461444cd1..0ad19d4d13 100644
--- a/src/particles/qquickwander_p.h
+++ b/src/particles/qquickwander_p.h
@@ -105,7 +105,8 @@ public:
}
protected:
- virtual bool affectParticle(QQuickParticleData *d, qreal dt);
+ bool affectParticle(QQuickParticleData *d, qreal dt) override;
+
Q_SIGNALS:
void xVarianceChanged(qreal arg);
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp
index f72b8a51f9..fe88d686fc 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp
@@ -289,10 +289,12 @@ void QQmlEngineDebugServiceImpl::buildObjectDump(QDataStream &message,
prop.value = expr->expression();
QObject *scope = expr->scopeObject();
if (scope) {
- QString methodName = QString::fromLatin1(QMetaObjectPrivate::signal(scope->metaObject(), signalHandler->signalIndex()).name());
- if (!methodName.isEmpty()) {
- prop.name = QLatin1String("on") + methodName[0].toUpper()
- + methodName.mid(1);
+ const QByteArray methodName = QMetaObjectPrivate::signal(scope->metaObject(),
+ signalHandler->signalIndex()).name();
+ const QLatin1String methodNameStr(methodName);
+ if (methodNameStr.size() != 0) {
+ prop.name = QLatin1String("on") + QChar(methodNameStr.at(0)).toUpper()
+ + methodNameStr.mid(1);
}
}
}
@@ -520,12 +522,12 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message)
ds >> file >> lineNumber >> columnNumber >> recurse >> dumpProperties;
- QList<QObject*> objects = objectForLocationInfo(file, lineNumber, columnNumber);
+ const QList<QObject*> objects = objectForLocationInfo(file, lineNumber, columnNumber);
rs << QByteArray("FETCH_OBJECTS_FOR_LOCATION_R") << queryId
<< objects.count();
- foreach (QObject *object, objects) {
+ for (QObject *object : objects) {
if (recurse)
prepareDeferredObjects(object);
buildObjectDump(rs, object, recurse, dumpProperties);
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp
index 5b96163b48..9c198a8afc 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp
@@ -287,7 +287,7 @@ void NativeDebugger::signalEmitted(const QString &signal)
//Normalize to Lower case.
QString signalName = signal.left(signal.indexOf(QLatin1Char('('))).toLower();
- foreach (const QString &signal, breakOnSignals) {
+ for (const QString &signal : qAsConst(breakOnSignals)) {
if (signal == signalName) {
// TODO: pause debugger
break;
@@ -340,16 +340,16 @@ void NativeDebugger::handleBacktrace(QJsonObject *response, const QJsonObject &a
if (heapFunctionObject) {
QJsonObject frame;
- frame[QStringLiteral("language")] = QStringLiteral("js");
- frame[QStringLiteral("context")] = encodeContext(executionContext);
+ frame.insert(QStringLiteral("language"), QStringLiteral("js"));
+ frame.insert(QStringLiteral("context"), encodeContext(executionContext));
if (QV4::Function *function = heapFunctionObject->function) {
if (QV4::Heap::String *functionName = function->name())
- frame[QStringLiteral("function")] = functionName->toQString();
- frame[QStringLiteral("file")] = function->sourceFile();
+ frame.insert(QStringLiteral("function"), functionName->toQString());
+ frame.insert(QStringLiteral("file"), function->sourceFile());
}
int line = executionContext->d()->lineNumber;
- frame[QStringLiteral("line")] = (line < 0 ? -line : line);
+ frame.insert(QStringLiteral("line"), (line < 0 ? -line : line));
frameArray.push_back(frame);
}
@@ -475,8 +475,8 @@ void NativeDebugger::handleVariables(QJsonObject *response, const QJsonObject &a
TRACE_PROTOCOL("Engine: " << engine);
Collector collector(engine);
- QJsonArray expanded = arguments.value(QLatin1String("expanded")).toArray();
- foreach (const QJsonValue &ex, expanded)
+ const QJsonArray expanded = arguments.value(QLatin1String("expanded")).toArray();
+ for (const QJsonValue &ex : expanded)
collector.m_expanded.append(ex.toString());
TRACE_PROTOCOL("Expanded: " << collector.m_expanded);
@@ -527,16 +527,16 @@ void NativeDebugger::handleExpressions(QJsonObject *response, const QJsonObject
TRACE_PROTOCOL("Engines: " << engine << m_engine);
Collector collector(engine);
- QJsonArray expanded = arguments.value(QLatin1String("expanded")).toArray();
- foreach (const QJsonValue &ex, expanded)
+ const QJsonArray expanded = arguments.value(QLatin1String("expanded")).toArray();
+ for (const QJsonValue &ex : expanded)
collector.m_expanded.append(ex.toString());
TRACE_PROTOCOL("Expanded: " << collector.m_expanded);
QJsonArray output;
QV4::Scope scope(engine);
- QJsonArray expressions = arguments.value(QLatin1String("expressions")).toArray();
- foreach (const QJsonValue &expr, expressions) {
+ const QJsonArray expressions = arguments.value(QLatin1String("expressions")).toArray();
+ for (const QJsonValue &expr : expressions) {
QString expression = expr.toObject().value(QLatin1String("expression")).toString();
QString name = expr.toObject().value(QLatin1String("name")).toString();
TRACE_PROTOCOL("Evaluate expression: " << expression);
@@ -548,15 +548,15 @@ void NativeDebugger::handleExpressions(QJsonObject *response, const QJsonObject
m_runningJob = false;
if (result->isUndefined()) {
QJsonObject dict;
- dict[QStringLiteral("name")] = name;
- dict[QStringLiteral("valueencoded")] = QStringLiteral("undefined");
+ dict.insert(QStringLiteral("name"), name);
+ dict.insert(QStringLiteral("valueencoded"), QStringLiteral("undefined"));
output.append(dict);
} else if (result.ptr && result.ptr->rawValue()) {
collector.collect(&output, QString(), name, *result);
} else {
QJsonObject dict;
- dict[QStringLiteral("name")] = name;
- dict[QStringLiteral("valueencoded")] = QStringLiteral("notaccessible");
+ dict.insert(QStringLiteral("name"), name);
+ dict.insert(QStringLiteral("valueencoded"), QStringLiteral("notaccessible"));
output.append(dict);
}
TRACE_PROTOCOL("EXCEPTION: " << engine->hasException);
@@ -748,7 +748,8 @@ void QQmlNativeDebugServiceImpl::engineAboutToBeRemoved(QJSEngine *engine)
TRACE_PROTOCOL("Removing engine" << engine);
if (engine) {
QV4::ExecutionEngine *executionEngine = QV8Engine::getV4(engine->handle());
- foreach (NativeDebugger *debugger, m_debuggers) {
+ const auto debuggersCopy = m_debuggers;
+ for (NativeDebugger *debugger : debuggersCopy) {
if (debugger->engine() == executionEngine)
m_debuggers.removeAll(debugger);
}
@@ -759,7 +760,7 @@ void QQmlNativeDebugServiceImpl::engineAboutToBeRemoved(QJSEngine *engine)
void QQmlNativeDebugServiceImpl::stateAboutToBeChanged(QQmlDebugService::State state)
{
if (state == Enabled) {
- foreach (NativeDebugger *debugger, m_debuggers) {
+ for (NativeDebugger *debugger : qAsConst(m_debuggers)) {
QV4::ExecutionEngine *engine = debugger->engine();
if (!engine->debugger())
engine->setDebugger(debugger);
@@ -783,7 +784,7 @@ void QQmlNativeDebugServiceImpl::messageReceived(const QByteArray &message)
} else if (cmd == QLatin1String("echo")) {
response.insert(QStringLiteral("result"), arguments);
} else {
- foreach (NativeDebugger *debugger, m_debuggers)
+ for (NativeDebugger *debugger : qAsConst(m_debuggers))
if (debugger)
debugger->handleCommand(&response, cmd, arguments);
}
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp
index 756b6b28be..773bc937f5 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp
@@ -52,7 +52,7 @@ QV4DebuggerAgent::QV4DebuggerAgent(QV4DebugServiceImpl *debugService)
QV4Debugger *QV4DebuggerAgent::pausedDebugger() const
{
- foreach (QV4Debugger *debugger, m_debuggers) {
+ for (QV4Debugger *debugger : m_debuggers) {
if (debugger->state() == QV4Debugger::Paused)
return debugger;
}
@@ -147,13 +147,13 @@ void QV4DebuggerAgent::pause(QV4Debugger *debugger) const
void QV4DebuggerAgent::pauseAll() const
{
- foreach (QV4Debugger *debugger, m_debuggers)
+ for (QV4Debugger *debugger : m_debuggers)
pause(debugger);
}
void QV4DebuggerAgent::resumeAll() const
{
- foreach (QV4Debugger *debugger, m_debuggers)
+ for (QV4Debugger *debugger : m_debuggers)
if (debugger->state() == QV4Debugger::Paused)
debugger->resume(QV4Debugger::FullThrottle);
}
@@ -161,7 +161,7 @@ void QV4DebuggerAgent::resumeAll() const
int QV4DebuggerAgent::addBreakPoint(const QString &fileName, int lineNumber, bool enabled, const QString &condition)
{
if (enabled)
- foreach (QV4Debugger *debugger, m_debuggers)
+ for (QV4Debugger *debugger : qAsConst(m_debuggers))
debugger->addBreakPoint(fileName, lineNumber, condition);
int id = m_breakPoints.size();
@@ -178,7 +178,7 @@ void QV4DebuggerAgent::removeBreakPoint(int id)
m_breakPoints.remove(id);
if (breakPoint.enabled)
- foreach (QV4Debugger *debugger, m_debuggers)
+ for (QV4Debugger *debugger : qAsConst(m_debuggers))
debugger->removeBreakPoint(breakPoint.fileName, breakPoint.lineNr);
}
@@ -195,7 +195,7 @@ void QV4DebuggerAgent::enableBreakPoint(int id, bool onoff)
return;
breakPoint.enabled = onoff;
- foreach (QV4Debugger *debugger, m_debuggers) {
+ for (QV4Debugger *debugger : qAsConst(m_debuggers)) {
if (onoff)
debugger->addBreakPoint(breakPoint.fileName, breakPoint.lineNr, breakPoint.condition);
else
@@ -218,14 +218,14 @@ void QV4DebuggerAgent::setBreakOnThrow(bool onoff)
{
if (onoff != m_breakOnThrow) {
m_breakOnThrow = onoff;
- foreach (QV4Debugger *debugger, m_debuggers)
+ for (QV4Debugger *debugger : qAsConst(m_debuggers))
debugger->setBreakOnThrow(onoff);
}
}
void QV4DebuggerAgent::clearAllPauseRequests()
{
- foreach (QV4Debugger *debugger, m_debuggers)
+ for (QV4Debugger *debugger : qAsConst(m_debuggers))
debugger->clearPauseRequest();
}
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
index a2d2fff72b..4e4048f6ad 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
@@ -205,7 +205,7 @@ void ValueLookupJob::run()
QQmlContextData::get(engine->qmlEngine()->rootContext()),
scopeObject.data()));
}
- foreach (const QJsonValue &handle, handles) {
+ for (const QJsonValue &handle : handles) {
QV4DataCollector::Ref ref = handle.toInt();
if (!collector->isValidRef(ref)) {
exception = QString::fromLatin1("Invalid Ref: %1").arg(ref);
@@ -258,7 +258,7 @@ GatherSourcesJob::GatherSourcesJob(QV4::ExecutionEngine *engine)
void GatherSourcesJob::run()
{
- foreach (QV4::CompiledData::CompilationUnit *unit, engine->compilationUnits) {
+ for (QV4::CompiledData::CompilationUnit *unit : qAsConst(engine->compilationUnits)) {
QString fileName = unit->fileName();
if (!fileName.isEmpty())
sources.append(fileName);
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h
index 721f42b7c2..aff2ea1b6c 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h
+++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.h
@@ -65,7 +65,7 @@ class JavaScriptJob : public QV4DebugJob
public:
JavaScriptJob(QV4::ExecutionEngine *engine, int frameNr, const QString &script);
- void run();
+ void run() override;
bool hasExeption() const;
protected:
@@ -90,7 +90,7 @@ class BacktraceJob: public CollectJob
int toFrame;
public:
BacktraceJob(QV4DataCollector *collector, int fromFrame, int toFrame);
- void run();
+ void run() override;
};
class FrameJob: public CollectJob
@@ -100,7 +100,7 @@ class FrameJob: public CollectJob
public:
FrameJob(QV4DataCollector *collector, int frameNr);
- void run();
+ void run() override;
bool wasSuccessful() const;
};
@@ -123,7 +123,7 @@ class ValueLookupJob: public CollectJob
public:
ValueLookupJob(const QJsonArray &handles, QV4DataCollector *collector);
- void run();
+ void run() override;
const QString &exceptionMessage() const;
};
@@ -137,7 +137,7 @@ class ExpressionEvalJob: public JavaScriptJob
public:
ExpressionEvalJob(QV4::ExecutionEngine *engine, int frameNr, const QString &expression,
QV4DataCollector *collector);
- virtual void handleResult(QV4::ScopedValue &value);
+ void handleResult(QV4::ScopedValue &value) override;
const QString &exceptionMessage() const;
const QJsonObject &returnValue() const;
const QJsonArray &refs() const;
@@ -150,7 +150,7 @@ class GatherSourcesJob: public QV4DebugJob
public:
GatherSourcesJob(QV4::ExecutionEngine *engine);
- void run();
+ void run() override;
const QStringList &result() const;
};
@@ -161,7 +161,7 @@ class EvalJob: public JavaScriptJob
public:
EvalJob(QV4::ExecutionEngine *engine, const QString &script);
- virtual void handleResult(QV4::ScopedValue &result);
+ void handleResult(QV4::ScopedValue &result) override;
bool resultAsBoolean() const;
};
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp
index 00c5c1ad77..de97b5437b 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp
@@ -152,7 +152,7 @@ class UnknownV8CommandHandler: public V8CommandHandler
public:
UnknownV8CommandHandler(): V8CommandHandler(QString()) {}
- virtual void handleRequest()
+ void handleRequest() override
{
QString msg = QLatin1String("unimplemented command \"")
+ req.value(QLatin1String("command")).toString()
@@ -167,7 +167,7 @@ class V8VersionRequest: public V8CommandHandler
public:
V8VersionRequest(): V8CommandHandler(QStringLiteral("version")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
addCommand();
addRequestSequence();
@@ -186,7 +186,7 @@ class V8SetBreakPointRequest: public V8CommandHandler
public:
V8SetBreakPointRequest(): V8CommandHandler(QStringLiteral("setbreakpoint")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
// decypher the payload:
QJsonObject args = req.value(QLatin1String("arguments")).toObject();
@@ -237,7 +237,7 @@ class V8ClearBreakPointRequest: public V8CommandHandler
public:
V8ClearBreakPointRequest(): V8CommandHandler(QStringLiteral("clearbreakpoint")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
// decypher the payload:
QJsonObject args = req.value(QLatin1String("arguments")).toObject();
@@ -270,7 +270,7 @@ class V8BacktraceRequest: public V8CommandHandler
public:
V8BacktraceRequest(): V8CommandHandler(QStringLiteral("backtrace")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
// decypher the payload:
@@ -303,7 +303,7 @@ class V8FrameRequest: public V8CommandHandler
public:
V8FrameRequest(): V8CommandHandler(QStringLiteral("frame")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
// decypher the payload:
QJsonObject arguments = req.value(QLatin1String("arguments")).toObject();
@@ -345,7 +345,7 @@ class V8ScopeRequest: public V8CommandHandler
public:
V8ScopeRequest(): V8CommandHandler(QStringLiteral("scope")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
// decypher the payload:
QJsonObject arguments = req.value(QLatin1String("arguments")).toObject();
@@ -390,7 +390,7 @@ class V8LookupRequest: public V8CommandHandler
public:
V8LookupRequest(): V8CommandHandler(QStringLiteral("lookup")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
// decypher the payload:
QJsonObject arguments = req.value(QLatin1String("arguments")).toObject();
@@ -430,7 +430,7 @@ class V8ContinueRequest: public V8CommandHandler
public:
V8ContinueRequest(): V8CommandHandler(QStringLiteral("continue")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
// decypher the payload:
QJsonObject arguments = req.value(QLatin1String("arguments")).toObject();
@@ -476,7 +476,7 @@ class V8DisconnectRequest: public V8CommandHandler
public:
V8DisconnectRequest(): V8CommandHandler(QStringLiteral("disconnect")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
debugService->debuggerAgent.removeAllBreakPoints();
debugService->debuggerAgent.resumeAll();
@@ -494,7 +494,7 @@ class V8SetExceptionBreakRequest: public V8CommandHandler
public:
V8SetExceptionBreakRequest(): V8CommandHandler(QStringLiteral("setexceptionbreak")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
bool wasEnabled = debugService->debuggerAgent.breakOnThrow();
@@ -534,7 +534,7 @@ class V8ScriptsRequest: public V8CommandHandler
public:
V8ScriptsRequest(): V8CommandHandler(QStringLiteral("scripts")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
//decypher the payload:
QJsonObject arguments = req.value(QLatin1String("arguments")).toObject();
@@ -558,7 +558,7 @@ public:
debugger->runInEngine(&job);
QJsonArray body;
- foreach (const QString &source, job.result()) {
+ for (const QString &source : job.result()) {
QJsonObject src;
src[QLatin1String("name")] = source;
src[QLatin1String("scriptType")] = 4;
@@ -606,7 +606,7 @@ class V8EvaluateRequest: public V8CommandHandler
public:
V8EvaluateRequest(): V8CommandHandler(QStringLiteral("evaluate")) {}
- virtual void handleRequest()
+ void handleRequest() override
{
QJsonObject arguments = req.value(QLatin1String("arguments")).toObject();
QString expression = arguments.value(QLatin1String("expression")).toString();
@@ -718,7 +718,8 @@ void QV4DebugServiceImpl::stateAboutToBeChanged(State state)
{
QMutexLocker lock(&m_configMutex);
if (state == Enabled) {
- foreach (QV4Debugger *debugger, debuggerAgent.debuggers()) {
+ const auto debuggers = debuggerAgent.debuggers();
+ for (QV4Debugger *debugger : debuggers) {
QV4::ExecutionEngine *ee = debugger->engine();
if (!ee->debugger())
ee->setDebugger(debugger);
@@ -737,7 +738,7 @@ void QV4DebugServiceImpl::signalEmitted(const QString &signal)
//Normalize to Lower case.
QString signalName = signal.left(signal.indexOf(QLatin1Char('('))).toLower();
- foreach (const QString &signal, breakOnSignals) {
+ for (const QString &signal : qAsConst(breakOnSignals)) {
if (signal == signalName) {
// TODO: pause debugger
break;
diff --git a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp
index 107d54c626..eb254ca1e0 100644
--- a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp
+++ b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp
@@ -92,7 +92,7 @@ void GlobalInspector::setSelectedItems(const QList<QQuickItem *> &items)
QList<QObject*> objectList;
objectList.reserve(items.count());
- foreach (QQuickItem *item, items)
+ for (QQuickItem *item : items)
objectList << item;
sendCurrentObjects(objectList);
@@ -113,7 +113,7 @@ void GlobalInspector::sendCurrentObjects(const QList<QObject*> &objects)
QList<int> debugIds;
debugIds.reserve(objects.count());
- foreach (QObject *object, objects)
+ for (QObject *object : objects)
debugIds << QQmlDebugService::idForObject(object);
ds << debugIds;
@@ -194,7 +194,7 @@ bool GlobalInspector::createQmlObject(int requestId, const QString &qml, QObject
return false;
QString imports;
- foreach (const QString &s, importList)
+ for (const QString &s : importList)
imports += s + QLatin1Char('\n');
ObjectCreator *objectCreator = new ObjectCreator(requestId, parentContext->engine(), parent);
@@ -223,7 +223,7 @@ void GlobalInspector::removeWindow(QQuickWindow *window)
void GlobalInspector::setParentWindow(QQuickWindow *window, QWindow *parentWindow)
{
- foreach (QmlJSDebugger::QQuickWindowInspector *inspector, m_windowInspectors) {
+ for (QmlJSDebugger::QQuickWindowInspector *inspector : qAsConst(m_windowInspectors)) {
if (inspector->quickWindow() == window)
inspector->setParentWindow(parentWindow);
}
@@ -234,7 +234,8 @@ bool GlobalInspector::syncSelectedItems(const QList<QQuickItem *> &items)
bool selectionChanged = false;
// Disconnect and remove items that are no longer selected
- foreach (const QPointer<QQuickItem> &item, m_selectedItems) {
+ const auto selectedItemsCopy = m_selectedItems;
+ for (const QPointer<QQuickItem> &item : selectedItemsCopy) {
if (!item) // Don't see how this can happen due to handling of destroyed()
continue;
if (items.contains(item))
@@ -247,14 +248,14 @@ bool GlobalInspector::syncSelectedItems(const QList<QQuickItem *> &items)
}
// Connect and add newly selected items
- foreach (QQuickItem *item, items) {
+ for (QQuickItem *item : items) {
if (m_selectedItems.contains(item))
continue;
selectionChanged = true;
connect(item, &QObject::destroyed, this, &GlobalInspector::removeFromSelectedItems);
m_selectedItems.append(item);
- foreach (QQuickWindowInspector *inspector, m_windowInspectors) {
+ for (QQuickWindowInspector *inspector : qAsConst(m_windowInspectors)) {
if (inspector->isEnabled() && inspector->quickWindow() == item->window()) {
m_highlightItems.insert(item, new SelectionHighlight(titleForItem(item), item,
inspector->overlay()));
@@ -314,12 +315,12 @@ void GlobalInspector::processMessage(const QByteArray &message)
ds >> requestId >> command;
if (command == ENABLE) {
- foreach (QQuickWindowInspector *inspector, m_windowInspectors)
+ for (QQuickWindowInspector *inspector : qAsConst(m_windowInspectors))
inspector->setEnabled(true);
success = !m_windowInspectors.isEmpty();
} else if (command == DISABLE) {
setSelectedItems(QList<QQuickItem*>());
- foreach (QQuickWindowInspector *inspector, m_windowInspectors)
+ for (QQuickWindowInspector *inspector : qAsConst(m_windowInspectors))
inspector->setEnabled(false);
success = !m_windowInspectors.isEmpty();
} else if (command == SELECT) {
@@ -327,7 +328,7 @@ void GlobalInspector::processMessage(const QByteArray &message)
ds >> debugIds;
QList<QQuickItem *> selectedObjects;
- foreach (int debugId, debugIds) {
+ for (int debugId : qAsConst(debugIds)) {
if (QQuickItem *obj =
qobject_cast<QQuickItem *>(QQmlDebugService::objectForId(debugId)))
selectedObjects << obj;
@@ -341,7 +342,7 @@ void GlobalInspector::processMessage(const QByteArray &message)
} else if (command == SHOW_APP_ON_TOP) {
bool showOnTop;
ds >> showOnTop;
- foreach (QmlJSDebugger::QQuickWindowInspector *inspector, m_windowInspectors)
+ for (QmlJSDebugger::QQuickWindowInspector *inspector : qAsConst(m_windowInspectors))
inspector->setShowAppOnTop(showOnTop);
success = !m_windowInspectors.isEmpty();
} else if (command == CREATE_OBJECT) {
diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp
index 3145601612..9eeb285951 100644
--- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp
+++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp
@@ -205,7 +205,7 @@ QQmlNativeDebugConnector::QQmlNativeDebugConnector()
QQmlNativeDebugConnector::~QQmlNativeDebugConnector()
{
- foreach (QQmlDebugService *service, m_services) {
+ for (QQmlDebugService *service : qAsConst(m_services)) {
service->stateAboutToBeChanged(QQmlDebugService::NotConnected);
service->setState(QQmlDebugService::NotConnected);
service->stateChanged(QQmlDebugService::NotConnected);
@@ -232,12 +232,12 @@ void QQmlNativeDebugConnector::addEngine(QJSEngine *engine)
Q_ASSERT(!m_engines.contains(engine));
TRACE_PROTOCOL("Add engine to connector:" << engine);
- foreach (QQmlDebugService *service, m_services)
+ for (QQmlDebugService *service : qAsConst(m_services))
service->engineAboutToBeAdded(engine);
announceObjectAvailability(QLatin1String("qmlengine"), engine, true);
- foreach (QQmlDebugService *service, m_services)
+ for (QQmlDebugService *service : qAsConst(m_services))
service->engineAdded(engine);
m_engines.append(engine);
@@ -248,12 +248,12 @@ void QQmlNativeDebugConnector::removeEngine(QJSEngine *engine)
Q_ASSERT(m_engines.contains(engine));
TRACE_PROTOCOL("Remove engine from connector:" << engine);
- foreach (QQmlDebugService *service, m_services)
+ for (QQmlDebugService *service : qAsConst(m_services))
service->engineAboutToBeRemoved(engine);
announceObjectAvailability(QLatin1String("qmlengine"), engine, false);
- foreach (QQmlDebugService *service, m_services)
+ for (QQmlDebugService *service : qAsConst(m_services))
service->engineRemoved(engine);
m_engines.removeOne(engine);
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp
index 6b653d5a54..0ed13d5105 100644
--- a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp
@@ -122,10 +122,10 @@ void QQmlEngineControlServiceImpl::stateChanged(State)
{
// We flush everything for any kind of state change, to avoid complicated timing issues.
QMutexLocker lock(&dataMutex);
- foreach (QJSEngine *engine, startingEngines)
+ for (QJSEngine *engine : qAsConst(startingEngines))
emit attachedToEngine(engine);
startingEngines.clear();
- foreach (QJSEngine *engine, stoppingEngines)
+ for (QJSEngine *engine : qAsConst(stoppingEngines))
emit detachedFromEngine(engine);
stoppingEngines.clear();
}
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
index dba2fd3cc3..c1f6f93ef1 100644
--- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
@@ -51,6 +51,8 @@
#include <QtCore/qthread.h>
#include <QtCore/qcoreapplication.h>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
Q_QML_DEBUG_PLUGIN_LOADER(QQmlAbstractProfilerAdapter)
@@ -92,16 +94,18 @@ void QQmlProfilerServiceImpl::dataReady(QQmlAbstractProfilerAdapter *profiler)
m_startTimes.insert(0, profiler);
if (dataComplete) {
QList<QJSEngine *> enginesToRelease;
- foreach (QJSEngine *engine, m_stoppingEngines) {
- foreach (QQmlAbstractProfilerAdapter *engineProfiler, m_engineProfilers.values(engine)) {
- if (m_startTimes.values().contains(engineProfiler)) {
+ for (QJSEngine *engine : qAsConst(m_stoppingEngines)) {
+ const auto range = qAsConst(m_engineProfilers).equal_range(engine);
+ const auto startTimesEnd = m_startTimes.cend();
+ for (auto it = range.first; it != range.second; ++it) {
+ if (std::find(m_startTimes.cbegin(), startTimesEnd, *it) != startTimesEnd) {
enginesToRelease.append(engine);
break;
}
}
}
sendMessages();
- foreach (QJSEngine *engine, enginesToRelease) {
+ for (QJSEngine *engine : qAsConst(enginesToRelease)) {
m_stoppingEngines.removeOne(engine);
emit detachedFromEngine(engine);
}
@@ -130,8 +134,9 @@ void QQmlProfilerServiceImpl::engineAdded(QJSEngine *engine)
"QML profilers have to be added from the engine thread");
QMutexLocker lock(&m_configMutex);
- foreach (QQmlAbstractProfilerAdapter *profiler, m_engineProfilers.values(engine))
- profiler->stopWaiting();
+ const auto range = qAsConst(m_engineProfilers).equal_range(engine);
+ for (auto it = range.first; it != range.second; ++it)
+ (*it)->stopWaiting();
}
void QQmlProfilerServiceImpl::engineAboutToBeRemoved(QJSEngine *engine)
@@ -141,7 +146,9 @@ void QQmlProfilerServiceImpl::engineAboutToBeRemoved(QJSEngine *engine)
QMutexLocker lock(&m_configMutex);
bool isRunning = false;
- foreach (QQmlAbstractProfilerAdapter *profiler, m_engineProfilers.values(engine)) {
+ const auto range = qAsConst(m_engineProfilers).equal_range(engine);
+ for (auto it = range.first; it != range.second; ++it) {
+ QQmlAbstractProfilerAdapter *profiler = *it;
if (profiler->isRunning())
isRunning = true;
profiler->startWaiting();
@@ -160,7 +167,9 @@ void QQmlProfilerServiceImpl::engineRemoved(QJSEngine *engine)
"QML profilers have to be removed from the engine thread");
QMutexLocker lock(&m_configMutex);
- foreach (QQmlAbstractProfilerAdapter *profiler, m_engineProfilers.values(engine)) {
+ const auto range = qAsConst(m_engineProfilers).equal_range(engine);
+ for (auto it = range.first; it != range.second; ++it) {
+ QQmlAbstractProfilerAdapter *profiler = *it;
removeProfilerFromStartTimes(profiler);
delete profiler;
}
@@ -183,7 +192,7 @@ void QQmlProfilerServiceImpl::addGlobalProfiler(QQmlAbstractProfilerAdapter *pro
// Global profilers are started whenever any engine profiler is started and stopped when
// all engine profilers are stopped.
quint64 features = 0;
- foreach (QQmlAbstractProfilerAdapter *engineProfiler, m_engineProfilers)
+ for (QQmlAbstractProfilerAdapter *engineProfiler : qAsConst(m_engineProfilers))
features |= engineProfiler->features();
if (features != 0)
@@ -231,7 +240,9 @@ void QQmlProfilerServiceImpl::startProfiling(QJSEngine *engine, quint64 features
d << m_timer.nsecsElapsed() << (int)Event << (int)StartTrace;
bool startedAny = false;
if (engine != 0) {
- foreach (QQmlAbstractProfilerAdapter *profiler, m_engineProfilers.values(engine)) {
+ const auto range = qAsConst(m_engineProfilers).equal_range(engine);
+ for (auto it = range.first; it != range.second; ++it) {
+ QQmlAbstractProfilerAdapter *profiler = *it;
if (!profiler->isRunning()) {
profiler->startProfiling(features);
startedAny = true;
@@ -249,12 +260,12 @@ void QQmlProfilerServiceImpl::startProfiling(QJSEngine *engine, quint64 features
startedAny = true;
}
}
- foreach (QJSEngine *profiledEngine, engines)
+ for (QJSEngine *profiledEngine : qAsConst(engines))
d << idForObject(profiledEngine);
}
if (startedAny) {
- foreach (QQmlAbstractProfilerAdapter *profiler, m_globalProfilers) {
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_globalProfilers)) {
if (!profiler->isRunning())
profiler->startProfiling(features);
}
@@ -294,7 +305,7 @@ void QQmlProfilerServiceImpl::stopProfiling(QJSEngine *engine)
if (stopping.isEmpty())
return;
- foreach (QQmlAbstractProfilerAdapter *profiler, m_globalProfilers) {
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_globalProfilers)) {
if (!profiler->isRunning())
continue;
m_startTimes.insert(-1, profiler);
@@ -308,10 +319,10 @@ void QQmlProfilerServiceImpl::stopProfiling(QJSEngine *engine)
emit stopFlushTimer();
m_waitingForStop = true;
- foreach (QQmlAbstractProfilerAdapter *profiler, reporting)
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(reporting))
profiler->reportData(m_useMessageTypes);
- foreach (QQmlAbstractProfilerAdapter *profiler, stopping)
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(stopping))
profiler->stopProfiling();
}
@@ -327,7 +338,7 @@ void QQmlProfilerServiceImpl::sendMessages()
traceEnd << m_timer.nsecsElapsed() << (int)Event << (int)EndTrace;
QSet<QJSEngine *> seen;
- foreach (QQmlAbstractProfilerAdapter *profiler, m_startTimes) {
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_startTimes)) {
for (QMultiHash<QJSEngine *, QQmlAbstractProfilerAdapter *>::iterator i(m_engineProfilers.begin());
i != m_engineProfilers.end(); ++i) {
if (i.value() == profiler && !seen.contains(i.key())) {
@@ -367,7 +378,7 @@ void QQmlProfilerServiceImpl::sendMessages()
emit messagesToClient(name(), messages);
// Restart flushing if any profilers are still running
- foreach (const QQmlAbstractProfilerAdapter *profiler, m_engineProfilers) {
+ for (const QQmlAbstractProfilerAdapter *profiler : qAsConst(m_engineProfilers)) {
if (profiler->isRunning()) {
emit startFlushTimer();
break;
@@ -438,21 +449,21 @@ void QQmlProfilerServiceImpl::flush()
QMutexLocker lock(&m_configMutex);
QList<QQmlAbstractProfilerAdapter *> reporting;
- foreach (QQmlAbstractProfilerAdapter *profiler, m_engineProfilers) {
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_engineProfilers)) {
if (profiler->isRunning()) {
m_startTimes.insert(-1, profiler);
reporting.append(profiler);
}
}
- foreach (QQmlAbstractProfilerAdapter *profiler, m_globalProfilers) {
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_globalProfilers)) {
if (profiler->isRunning()) {
m_startTimes.insert(-1, profiler);
reporting.append(profiler);
}
}
- foreach (QQmlAbstractProfilerAdapter *profiler, reporting)
+ for (QQmlAbstractProfilerAdapter *profiler : qAsConst(reporting))
profiler->reportData(m_useMessageTypes);
}
diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
index 96b3455790..f449989598 100644
--- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
+++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp
@@ -589,12 +589,12 @@ void QQmlDebugServerImpl::addEngine(QJSEngine *engine)
QMutexLocker locker(&m_helloMutex);
Q_ASSERT(!m_engineConditions.contains(engine));
- foreach (QQmlDebugService *service, m_plugins)
+ for (QQmlDebugService *service : qAsConst(m_plugins))
service->engineAboutToBeAdded(engine);
m_engineConditions[engine].waitForServices(&m_helloMutex, m_plugins.count());
- foreach (QQmlDebugService *service, m_plugins)
+ for (QQmlDebugService *service : qAsConst(m_plugins))
service->engineAdded(engine);
}
@@ -606,12 +606,12 @@ void QQmlDebugServerImpl::removeEngine(QJSEngine *engine)
QMutexLocker locker(&m_helloMutex);
Q_ASSERT(m_engineConditions.contains(engine));
- foreach (QQmlDebugService *service, m_plugins)
+ for (QQmlDebugService *service : qAsConst(m_plugins))
service->engineAboutToBeRemoved(engine);
m_engineConditions[engine].waitForServices(&m_helloMutex, m_plugins.count());
- foreach (QQmlDebugService *service, m_plugins)
+ for (QQmlDebugService *service : qAsConst(m_plugins))
service->engineRemoved(engine);
m_engineConditions.remove(engine);
@@ -703,11 +703,11 @@ void QQmlDebugServerImpl::sendMessages(const QString &name, const QList<QByteArr
if (m_clientSupportsMultiPackets) {
QQmlDebugPacket out;
out << name;
- foreach (const QByteArray &message, messages)
+ for (const QByteArray &message : messages)
out << message;
m_protocol->send(out.data());
} else {
- foreach (const QByteArray &message, messages)
+ for (const QByteArray &message : messages)
doSendMessage(name, message);
}
m_connection->flush();
diff --git a/src/qml/animations/qanimationgroupjob_p.h b/src/qml/animations/qanimationgroupjob_p.h
index 9bcd63127a..26965c0264 100644
--- a/src/qml/animations/qanimationgroupjob_p.h
+++ b/src/qml/animations/qanimationgroupjob_p.h
@@ -75,7 +75,7 @@ public:
//called by QAbstractAnimationJob
virtual void uncontrolledAnimationFinished(QAbstractAnimationJob *animation);
protected:
- void topLevelAnimationLoopChanged();
+ void topLevelAnimationLoopChanged() override;
virtual void animationInserted(QAbstractAnimationJob*) { }
virtual void animationRemoved(QAbstractAnimationJob*, QAbstractAnimationJob*, QAbstractAnimationJob*);
diff --git a/src/qml/animations/qparallelanimationgroupjob_p.h b/src/qml/animations/qparallelanimationgroupjob_p.h
index 3e914c3e76..358b95ce53 100644
--- a/src/qml/animations/qparallelanimationgroupjob_p.h
+++ b/src/qml/animations/qparallelanimationgroupjob_p.h
@@ -62,14 +62,14 @@ public:
QParallelAnimationGroupJob();
~QParallelAnimationGroupJob();
- int duration() const;
+ int duration() const override;
protected:
- void updateCurrentTime(int currentTime);
- void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState);
- void updateDirection(QAbstractAnimationJob::Direction direction);
- void uncontrolledAnimationFinished(QAbstractAnimationJob *animation);
- void debugAnimation(QDebug d) const;
+ void updateCurrentTime(int currentTime) override;
+ void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState) override;
+ void updateDirection(QAbstractAnimationJob::Direction direction) override;
+ void uncontrolledAnimationFinished(QAbstractAnimationJob *animation) override;
+ void debugAnimation(QDebug d) const override;
private:
bool shouldAnimationStart(QAbstractAnimationJob *animation, bool startIfAtEnd) const;
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp
index 31b964897f..89fa86c857 100644
--- a/src/qml/compiler/qqmlirbuilder.cpp
+++ b/src/qml/compiler/qqmlirbuilder.cpp
@@ -362,10 +362,11 @@ bool IRBuilder::generateFromQml(const QString &code, const QString &url, Documen
QQmlJS::Parser parser(&output->jsParserEngine);
- if (! parser.parse() || !parser.diagnosticMessages().isEmpty()) {
-
+ const bool parseResult = parser.parse();
+ const auto diagnosticMessages = parser.diagnosticMessages();
+ if (!parseResult || !diagnosticMessages.isEmpty()) {
// Extract errors from the parser
- foreach (const QQmlJS::DiagnosticMessage &m, parser.diagnosticMessages()) {
+ for (const QQmlJS::DiagnosticMessage &m : diagnosticMessages) {
if (m.isWarning()) {
qWarning("%s:%d : %s", qPrintable(url), m.loc.startLine, qPrintable(m.message));
@@ -1018,7 +1019,8 @@ void IRBuilder::setBindingValue(QV4::CompiledData::Binding *binding, QQmlJS::AST
CompiledFunctionOrExpression *expr = New<CompiledFunctionOrExpression>();
expr->node = statement;
- expr->nameIndex = registerString(QStringLiteral("expression for ") + stringAt(binding->propertyNameIndex));
+ expr->nameIndex = registerString(QLatin1String("expression for ")
+ + stringAt(binding->propertyNameIndex));
expr->disableAcceleratedLookups = false;
const int index = bindingsTarget()->functionsAndExpressions->append(expr);
binding->value.compiledScriptIndex = index;
@@ -1246,7 +1248,7 @@ bool IRBuilder::resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, O
// If it's a namespace, prepend the qualifier and we'll resolve it later to the correct type.
QString currentName = qualifiedIdElement->name.toString();
if (qualifiedIdElement->next) {
- foreach (const QV4::CompiledData::Import* import, _imports)
+ for (const QV4::CompiledData::Import* import : qAsConst(_imports))
if (import->qualifierIndex != emptyStringIndex
&& stringAt(import->qualifierIndex) == currentName) {
qualifiedIdElement = qualifiedIdElement->next;
@@ -1371,7 +1373,7 @@ QV4::CompiledData::Unit *QmlUnitGenerator::generate(Document &output, QQmlEngine
QHash<const Object*, quint32> objectOffsets;
int objectsSize = 0;
- foreach (Object *o, output.objects) {
+ for (Object *o : qAsConst(output.objects)) {
objectOffsets.insert(o, unitSize + importSize + objectOffsetTableSize + objectsSize);
objectsSize += QV4::CompiledData::Object::calculateSizeExcludingSignals(o->functionCount(), o->propertyCount(), o->aliasCount(), o->signalCount(), o->bindingCount(), o->namedObjectsInComponent.count);
@@ -1417,7 +1419,7 @@ QV4::CompiledData::Unit *QmlUnitGenerator::generate(Document &output, QQmlEngine
// write imports
char *importPtr = data + qmlUnit->offsetToImports;
- foreach (const QV4::CompiledData::Import *imp, output.imports) {
+ for (const QV4::CompiledData::Import *imp : qAsConst(output.imports)) {
QV4::CompiledData::Import *importToWrite = reinterpret_cast<QV4::CompiledData::Import*>(importPtr);
*importToWrite = *imp;
importPtr += sizeof(QV4::CompiledData::Import);
@@ -1522,7 +1524,7 @@ QV4::CompiledData::Unit *QmlUnitGenerator::generate(Document &output, QQmlEngine
}
// enable flag if we encountered pragma Singleton
- foreach (Pragma *p, output.pragmas) {
+ for (Pragma *p : qAsConst(output.pragmas)) {
if (p->type == Pragma::PragmaSingleton) {
qmlUnit->flags |= QV4::CompiledData::Unit::IsSingleton;
break;
@@ -1586,7 +1588,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil
ScanFunctions scan(this, sourceCode, GlobalCode);
scan.enterEnvironment(0, QmlBinding);
scan.enterQmlScope(qmlRoot, QStringLiteral("context scope"));
- foreach (const CompiledFunctionOrExpression &f, functions) {
+ for (const CompiledFunctionOrExpression &f : functions) {
Q_ASSERT(f.node != qmlRoot);
QQmlJS::AST::FunctionDeclaration *function = QQmlJS::AST::cast<QQmlJS::AST::FunctionDeclaration*>(f.node);
@@ -1921,7 +1923,7 @@ QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int
// with the correct QML context.
// Look for IDs first.
- foreach (const IdMapping &mapping, _idObjects)
+ for (const IdMapping &mapping : qAsConst(_idObjects))
if (name == mapping.name) {
if (_function->isQmlBinding)
_function->idObjectDependencies.insert(mapping.idIndex);
diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h
index cc16dc2104..95756845c3 100644
--- a/src/qml/compiler/qqmlirbuilder_p.h
+++ b/src/qml/compiler/qqmlirbuilder_p.h
@@ -453,9 +453,9 @@ struct Q_QML_PRIVATE_EXPORT ScriptDirectivesCollector : public QQmlJS::Directive
QList<const QV4::CompiledData::Import *> imports;
bool hasPragmaLibrary;
- virtual void pragmaLibrary();
- virtual void importFile(const QString &jsfile, const QString &module, int lineNumber, int column);
- virtual void importModule(const QString &uri, const QString &version, const QString &module, int lineNumber, int column);
+ void pragmaLibrary() override;
+ void importFile(const QString &jsfile, const QString &module, int lineNumber, int column) override;
+ void importModule(const QString &uri, const QString &version, const QString &module, int lineNumber, int column) override;
};
struct Q_QML_PRIVATE_EXPORT IRBuilder : public QQmlJS::AST::Visitor
@@ -470,21 +470,21 @@ public:
using QQmlJS::AST::Visitor::visit;
using QQmlJS::AST::Visitor::endVisit;
- virtual bool visit(QQmlJS::AST::UiArrayMemberList *ast);
- virtual bool visit(QQmlJS::AST::UiImport *ast);
- virtual bool visit(QQmlJS::AST::UiPragma *ast);
- virtual bool visit(QQmlJS::AST::UiHeaderItemList *ast);
- virtual bool visit(QQmlJS::AST::UiObjectInitializer *ast);
- virtual bool visit(QQmlJS::AST::UiObjectMemberList *ast);
- virtual bool visit(QQmlJS::AST::UiParameterList *ast);
- virtual bool visit(QQmlJS::AST::UiProgram *);
- virtual bool visit(QQmlJS::AST::UiQualifiedId *ast);
- virtual bool visit(QQmlJS::AST::UiArrayBinding *ast);
- virtual bool visit(QQmlJS::AST::UiObjectBinding *ast);
- virtual bool visit(QQmlJS::AST::UiObjectDefinition *ast);
- virtual bool visit(QQmlJS::AST::UiPublicMember *ast);
- virtual bool visit(QQmlJS::AST::UiScriptBinding *ast);
- virtual bool visit(QQmlJS::AST::UiSourceElement *ast);
+ bool visit(QQmlJS::AST::UiArrayMemberList *ast) override;
+ bool visit(QQmlJS::AST::UiImport *ast) override;
+ bool visit(QQmlJS::AST::UiPragma *ast) override;
+ bool visit(QQmlJS::AST::UiHeaderItemList *ast) override;
+ bool visit(QQmlJS::AST::UiObjectInitializer *ast) override;
+ bool visit(QQmlJS::AST::UiObjectMemberList *ast) override;
+ bool visit(QQmlJS::AST::UiParameterList *ast) override;
+ bool visit(QQmlJS::AST::UiProgram *) override;
+ bool visit(QQmlJS::AST::UiQualifiedId *ast) override;
+ bool visit(QQmlJS::AST::UiArrayBinding *ast) override;
+ bool visit(QQmlJS::AST::UiObjectBinding *ast) override;
+ bool visit(QQmlJS::AST::UiObjectDefinition *ast) override;
+ bool visit(QQmlJS::AST::UiPublicMember *ast) override;
+ bool visit(QQmlJS::AST::UiScriptBinding *ast) override;
+ bool visit(QQmlJS::AST::UiSourceElement *ast) override;
void accept(QQmlJS::AST::Node *node);
@@ -602,8 +602,8 @@ struct Q_QML_PRIVATE_EXPORT JSCodeGen : public QQmlJS::Codegen
QVector<int> generateJSCodeForFunctionsAndBindings(const QList<CompiledFunctionOrExpression> &functions);
protected:
- virtual void beginFunctionBodyHook();
- virtual QV4::IR::Expr *fallbackNameLookup(const QString &name, int line, int col);
+ void beginFunctionBodyHook() override;
+ QV4::IR::Expr *fallbackNameLookup(const QString &name, int line, int col) override;
private:
QQmlPropertyData *lookupQmlCompliantProperty(QQmlPropertyCache *cache, const QString &name, bool *propertyExistsButForceNameLookup = 0);
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index 2308e66609..5e05485b93 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -471,7 +471,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio
QQmlJS::MemoryPool *pool = compiler->memoryPool();
QQmlJS::AST::FormalParameterList *paramList = 0;
- foreach (const QString &param, parameters) {
+ for (const QString &param : qAsConst(parameters)) {
QStringRef paramNameRef = compiler->newStringRef(param);
if (paramList)
@@ -1348,9 +1348,9 @@ bool QQmlJSCodeGenerator::compileJavaScriptCodeInObjectsRecursively(int objectIn
functionsToCompile << *foe;
}
const QVector<int> runtimeFunctionIndices = v4CodeGen->generateJSCodeForFunctionsAndBindings(functionsToCompile);
- QList<QQmlError> jsErrors = v4CodeGen->qmlErrors();
+ const QList<QQmlError> jsErrors = v4CodeGen->qmlErrors();
if (!jsErrors.isEmpty()) {
- foreach (const QQmlError &e, jsErrors)
+ for (const QQmlError &e : jsErrors)
compiler->recordError(e);
return false;
}
@@ -1733,7 +1733,7 @@ void QQmlIRFunctionCleanser::clean()
module->functions = newFunctions;
- foreach (QV4::IR::Function *function, module->functions) {
+ for (QV4::IR::Function *function : qAsConst(module->functions)) {
for (QV4::IR::BasicBlock *block : function->basicBlocks()) {
for (QV4::IR::Stmt *s : block->statements()) {
visit(s);
@@ -1741,7 +1741,7 @@ void QQmlIRFunctionCleanser::clean()
}
}
- foreach (QmlIR::Object *obj, *compiler->qmlObjects()) {
+ for (QmlIR::Object *obj : qAsConst(*compiler->qmlObjects())) {
for (int i = 0; i < obj->runtimeFunctionIndices.count; ++i)
obj->runtimeFunctionIndices[i] = newFunctionIndices[obj->runtimeFunctionIndices.at(i)];
}
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index 59199183bd..742ee79648 100644
--- a/src/qml/compiler/qv4codegen_p.h
+++ b/src/qml/compiler/qv4codegen_p.h
@@ -331,103 +331,103 @@ protected:
virtual void beginFunctionBodyHook() {}
// nodes
- virtual bool visit(AST::ArgumentList *ast);
- virtual bool visit(AST::CaseBlock *ast);
- virtual bool visit(AST::CaseClause *ast);
- virtual bool visit(AST::CaseClauses *ast);
- virtual bool visit(AST::Catch *ast);
- virtual bool visit(AST::DefaultClause *ast);
- virtual bool visit(AST::ElementList *ast);
- virtual bool visit(AST::Elision *ast);
- virtual bool visit(AST::Finally *ast);
- virtual bool visit(AST::FormalParameterList *ast);
- virtual bool visit(AST::FunctionBody *ast);
- virtual bool visit(AST::Program *ast);
- virtual bool visit(AST::PropertyNameAndValue *ast);
- virtual bool visit(AST::PropertyAssignmentList *ast);
- virtual bool visit(AST::PropertyGetterSetter *ast);
- virtual bool visit(AST::SourceElements *ast);
- virtual bool visit(AST::StatementList *ast);
- virtual bool visit(AST::UiArrayMemberList *ast);
- virtual bool visit(AST::UiImport *ast);
- virtual bool visit(AST::UiHeaderItemList *ast);
- virtual bool visit(AST::UiPragma *ast);
- virtual bool visit(AST::UiObjectInitializer *ast);
- virtual bool visit(AST::UiObjectMemberList *ast);
- virtual bool visit(AST::UiParameterList *ast);
- virtual bool visit(AST::UiProgram *ast);
- virtual bool visit(AST::UiQualifiedId *ast);
- virtual bool visit(AST::UiQualifiedPragmaId *ast);
- virtual bool visit(AST::VariableDeclaration *ast);
- virtual bool visit(AST::VariableDeclarationList *ast);
+ bool visit(AST::ArgumentList *ast) override;
+ bool visit(AST::CaseBlock *ast) override;
+ bool visit(AST::CaseClause *ast) override;
+ bool visit(AST::CaseClauses *ast) override;
+ bool visit(AST::Catch *ast) override;
+ bool visit(AST::DefaultClause *ast) override;
+ bool visit(AST::ElementList *ast) override;
+ bool visit(AST::Elision *ast) override;
+ bool visit(AST::Finally *ast) override;
+ bool visit(AST::FormalParameterList *ast) override;
+ bool visit(AST::FunctionBody *ast) override;
+ bool visit(AST::Program *ast) override;
+ bool visit(AST::PropertyNameAndValue *ast) override;
+ bool visit(AST::PropertyAssignmentList *ast) override;
+ bool visit(AST::PropertyGetterSetter *ast) override;
+ bool visit(AST::SourceElements *ast) override;
+ bool visit(AST::StatementList *ast) override;
+ bool visit(AST::UiArrayMemberList *ast) override;
+ bool visit(AST::UiImport *ast) override;
+ bool visit(AST::UiHeaderItemList *ast) override;
+ bool visit(AST::UiPragma *ast) override;
+ bool visit(AST::UiObjectInitializer *ast) override;
+ bool visit(AST::UiObjectMemberList *ast) override;
+ bool visit(AST::UiParameterList *ast) override;
+ bool visit(AST::UiProgram *ast) override;
+ bool visit(AST::UiQualifiedId *ast) override;
+ bool visit(AST::UiQualifiedPragmaId *ast) override;
+ bool visit(AST::VariableDeclaration *ast) override;
+ bool visit(AST::VariableDeclarationList *ast) override;
// expressions
- virtual bool visit(AST::Expression *ast);
- virtual bool visit(AST::ArrayLiteral *ast);
- virtual bool visit(AST::ArrayMemberExpression *ast);
- virtual bool visit(AST::BinaryExpression *ast);
- virtual bool visit(AST::CallExpression *ast);
- virtual bool visit(AST::ConditionalExpression *ast);
- virtual bool visit(AST::DeleteExpression *ast);
- virtual bool visit(AST::FalseLiteral *ast);
- virtual bool visit(AST::FieldMemberExpression *ast);
- virtual bool visit(AST::FunctionExpression *ast);
- virtual bool visit(AST::IdentifierExpression *ast);
- virtual bool visit(AST::NestedExpression *ast);
- virtual bool visit(AST::NewExpression *ast);
- virtual bool visit(AST::NewMemberExpression *ast);
- virtual bool visit(AST::NotExpression *ast);
- virtual bool visit(AST::NullExpression *ast);
- virtual bool visit(AST::NumericLiteral *ast);
- virtual bool visit(AST::ObjectLiteral *ast);
- virtual bool visit(AST::PostDecrementExpression *ast);
- virtual bool visit(AST::PostIncrementExpression *ast);
- virtual bool visit(AST::PreDecrementExpression *ast);
- virtual bool visit(AST::PreIncrementExpression *ast);
- virtual bool visit(AST::RegExpLiteral *ast);
- virtual bool visit(AST::StringLiteral *ast);
- virtual bool visit(AST::ThisExpression *ast);
- virtual bool visit(AST::TildeExpression *ast);
- virtual bool visit(AST::TrueLiteral *ast);
- virtual bool visit(AST::TypeOfExpression *ast);
- virtual bool visit(AST::UnaryMinusExpression *ast);
- virtual bool visit(AST::UnaryPlusExpression *ast);
- virtual bool visit(AST::VoidExpression *ast);
- virtual bool visit(AST::FunctionDeclaration *ast);
+ bool visit(AST::Expression *ast) override;
+ bool visit(AST::ArrayLiteral *ast) override;
+ bool visit(AST::ArrayMemberExpression *ast) override;
+ bool visit(AST::BinaryExpression *ast) override;
+ bool visit(AST::CallExpression *ast) override;
+ bool visit(AST::ConditionalExpression *ast) override;
+ bool visit(AST::DeleteExpression *ast) override;
+ bool visit(AST::FalseLiteral *ast) override;
+ bool visit(AST::FieldMemberExpression *ast) override;
+ bool visit(AST::FunctionExpression *ast) override;
+ bool visit(AST::IdentifierExpression *ast) override;
+ bool visit(AST::NestedExpression *ast) override;
+ bool visit(AST::NewExpression *ast) override;
+ bool visit(AST::NewMemberExpression *ast) override;
+ bool visit(AST::NotExpression *ast) override;
+ bool visit(AST::NullExpression *ast) override;
+ bool visit(AST::NumericLiteral *ast) override;
+ bool visit(AST::ObjectLiteral *ast) override;
+ bool visit(AST::PostDecrementExpression *ast) override;
+ bool visit(AST::PostIncrementExpression *ast) override;
+ bool visit(AST::PreDecrementExpression *ast) override;
+ bool visit(AST::PreIncrementExpression *ast) override;
+ bool visit(AST::RegExpLiteral *ast) override;
+ bool visit(AST::StringLiteral *ast) override;
+ bool visit(AST::ThisExpression *ast) override;
+ bool visit(AST::TildeExpression *ast) override;
+ bool visit(AST::TrueLiteral *ast) override;
+ bool visit(AST::TypeOfExpression *ast) override;
+ bool visit(AST::UnaryMinusExpression *ast) override;
+ bool visit(AST::UnaryPlusExpression *ast) override;
+ bool visit(AST::VoidExpression *ast) override;
+ bool visit(AST::FunctionDeclaration *ast) override;
// source elements
- virtual bool visit(AST::FunctionSourceElement *ast);
- virtual bool visit(AST::StatementSourceElement *ast);
+ bool visit(AST::FunctionSourceElement *ast) override;
+ bool visit(AST::StatementSourceElement *ast) override;
// statements
- virtual bool visit(AST::Block *ast);
- virtual bool visit(AST::BreakStatement *ast);
- virtual bool visit(AST::ContinueStatement *ast);
- virtual bool visit(AST::DebuggerStatement *ast);
- virtual bool visit(AST::DoWhileStatement *ast);
- virtual bool visit(AST::EmptyStatement *ast);
- virtual bool visit(AST::ExpressionStatement *ast);
- virtual bool visit(AST::ForEachStatement *ast);
- virtual bool visit(AST::ForStatement *ast);
- virtual bool visit(AST::IfStatement *ast);
- virtual bool visit(AST::LabelledStatement *ast);
- virtual bool visit(AST::LocalForEachStatement *ast);
- virtual bool visit(AST::LocalForStatement *ast);
- virtual bool visit(AST::ReturnStatement *ast);
- virtual bool visit(AST::SwitchStatement *ast);
- virtual bool visit(AST::ThrowStatement *ast);
- virtual bool visit(AST::TryStatement *ast);
- virtual bool visit(AST::VariableStatement *ast);
- virtual bool visit(AST::WhileStatement *ast);
- virtual bool visit(AST::WithStatement *ast);
+ bool visit(AST::Block *ast) override;
+ bool visit(AST::BreakStatement *ast) override;
+ bool visit(AST::ContinueStatement *ast) override;
+ bool visit(AST::DebuggerStatement *ast) override;
+ bool visit(AST::DoWhileStatement *ast) override;
+ bool visit(AST::EmptyStatement *ast) override;
+ bool visit(AST::ExpressionStatement *ast) override;
+ bool visit(AST::ForEachStatement *ast) override;
+ bool visit(AST::ForStatement *ast) override;
+ bool visit(AST::IfStatement *ast) override;
+ bool visit(AST::LabelledStatement *ast) override;
+ bool visit(AST::LocalForEachStatement *ast) override;
+ bool visit(AST::LocalForStatement *ast) override;
+ bool visit(AST::ReturnStatement *ast) override;
+ bool visit(AST::SwitchStatement *ast) override;
+ bool visit(AST::ThrowStatement *ast) override;
+ bool visit(AST::TryStatement *ast) override;
+ bool visit(AST::VariableStatement *ast) override;
+ bool visit(AST::WhileStatement *ast) override;
+ bool visit(AST::WithStatement *ast) override;
// ui object members
- virtual bool visit(AST::UiArrayBinding *ast);
- virtual bool visit(AST::UiObjectBinding *ast);
- virtual bool visit(AST::UiObjectDefinition *ast);
- virtual bool visit(AST::UiPublicMember *ast);
- virtual bool visit(AST::UiScriptBinding *ast);
- virtual bool visit(AST::UiSourceElement *ast);
+ bool visit(AST::UiArrayBinding *ast) override;
+ bool visit(AST::UiObjectBinding *ast) override;
+ bool visit(AST::UiObjectDefinition *ast) override;
+ bool visit(AST::UiPublicMember *ast) override;
+ bool visit(AST::UiScriptBinding *ast) override;
+ bool visit(AST::UiSourceElement *ast) override;
bool throwSyntaxErrorOnEvalOrArgumentsInStrictMode(QV4::IR::Expr* expr, const AST::SourceLocation &loc);
virtual void throwSyntaxError(const AST::SourceLocation &loc, const QString &detail);
@@ -486,39 +486,39 @@ protected:
void checkName(const QStringRef &name, const AST::SourceLocation &loc);
void checkForArguments(AST::FormalParameterList *parameters);
- virtual bool visit(AST::Program *ast);
- virtual void endVisit(AST::Program *);
+ bool visit(AST::Program *ast) override;
+ void endVisit(AST::Program *) override;
- virtual bool visit(AST::CallExpression *ast);
- virtual bool visit(AST::NewMemberExpression *ast);
- virtual bool visit(AST::ArrayLiteral *ast);
- virtual bool visit(AST::VariableDeclaration *ast);
- virtual bool visit(AST::IdentifierExpression *ast);
- virtual bool visit(AST::ExpressionStatement *ast);
- virtual bool visit(AST::FunctionExpression *ast);
+ bool visit(AST::CallExpression *ast) override;
+ bool visit(AST::NewMemberExpression *ast) override;
+ bool visit(AST::ArrayLiteral *ast) override;
+ bool visit(AST::VariableDeclaration *ast) override;
+ bool visit(AST::IdentifierExpression *ast) override;
+ bool visit(AST::ExpressionStatement *ast) override;
+ bool visit(AST::FunctionExpression *ast) override;
void enterFunction(AST::FunctionExpression *ast, bool enterName, bool isExpression = true);
- virtual void endVisit(AST::FunctionExpression *);
+ void endVisit(AST::FunctionExpression *) override;
- virtual bool visit(AST::ObjectLiteral *ast);
+ bool visit(AST::ObjectLiteral *ast) override;
- virtual bool visit(AST::PropertyGetterSetter *ast);
- virtual void endVisit(AST::PropertyGetterSetter *);
+ bool visit(AST::PropertyGetterSetter *ast) override;
+ void endVisit(AST::PropertyGetterSetter *) override;
- virtual bool visit(AST::FunctionDeclaration *ast);
- virtual void endVisit(AST::FunctionDeclaration *);
+ bool visit(AST::FunctionDeclaration *ast) override;
+ void endVisit(AST::FunctionDeclaration *) override;
- virtual bool visit(AST::WithStatement *ast);
+ bool visit(AST::WithStatement *ast) override;
- virtual bool visit(AST::DoWhileStatement *ast);
- virtual bool visit(AST::ForStatement *ast);
- virtual bool visit(AST::LocalForStatement *ast);
- virtual bool visit(AST::ForEachStatement *ast);
- virtual bool visit(AST::LocalForEachStatement *ast);
- virtual bool visit(AST::ThisExpression *ast);
+ bool visit(AST::DoWhileStatement *ast) override;
+ bool visit(AST::ForStatement *ast) override;
+ bool visit(AST::LocalForStatement *ast) override;
+ bool visit(AST::ForEachStatement *ast) override;
+ bool visit(AST::LocalForEachStatement *ast) override;
+ bool visit(AST::ThisExpression *ast) override;
- virtual bool visit(AST::Block *ast);
+ bool visit(AST::Block *ast) override;
protected:
void enterFunction(AST::Node *ast, const QString &name, AST::FormalParameterList *formals, AST::FunctionBody *body, AST::FunctionExpression *expr, bool isExpression);
@@ -544,8 +544,8 @@ public:
, engine(engine)
{}
- virtual void throwSyntaxError(const AST::SourceLocation &loc, const QString &detail);
- virtual void throwReferenceError(const AST::SourceLocation &loc, const QString &detail);
+ void throwSyntaxError(const AST::SourceLocation &loc, const QString &detail) override;
+ void throwReferenceError(const AST::SourceLocation &loc, const QString &detail) override;
private:
QV4::ExecutionEngine *engine;
};
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index 43347d246a..729c56540d 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -211,7 +211,7 @@ int QV4::Compiler::JSUnitGenerator::registerJSClass(int count, IR::ExprList *arg
QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(GeneratorOption option)
{
registerString(irModule->fileName);
- foreach (QV4::IR::Function *f, irModule->functions) {
+ for (QV4::IR::Function *f : qAsConst(irModule->functions)) {
registerString(*f->name);
for (int i = 0; i < f->formals.size(); ++i)
registerString(*f->formals.at(i));
@@ -242,7 +242,7 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(GeneratorO
}
CompiledData::Lookup *lookupsToWrite = reinterpret_cast<CompiledData::Lookup*>(dataPtr + unit->offsetToLookupTable);
- foreach (const CompiledData::Lookup &l, lookups)
+ for (const CompiledData::Lookup &l : qAsConst(lookups))
*lookupsToWrite++ = l;
CompiledData::RegExp *regexpTable = reinterpret_cast<CompiledData::RegExp *>(dataPtr + unit->offsetToRegexpTable);
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index cd47f22205..5dd722bfc2 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -209,7 +209,7 @@ void InstructionSelection::run(int functionIndex)
ConvertTemps().toStackSlots(_function);
}
- QSet<IR::Jump *> removableJumps = opt.calculateOptionalJumps();
+ BitVector removableJumps = opt.calculateOptionalJumps();
qSwap(_removableJumps, removableJumps);
IR::Stmt *cs = 0;
@@ -292,7 +292,7 @@ QQmlRefPointer<QV4::CompiledData::CompilationUnit> InstructionSelection::backend
{
compilationUnit->codeRefs.resize(irModule->functions.size());
int i = 0;
- foreach (IR::Function *irFunction, irModule->functions)
+ for (IR::Function *irFunction : qAsConst(irModule->functions))
compilationUnit->codeRefs[i++] = codeRefs[irFunction];
QQmlRefPointer<QV4::CompiledData::CompilationUnit> result;
result.adopt(compilationUnit.take());
@@ -950,7 +950,7 @@ void InstructionSelection::visitJump(IR::Jump *s)
{
if (s->target == _nextBlock)
return;
- if (_removableJumps.contains(s))
+ if (_removableJumps.at(_block->index()))
return;
addDebugInstruction();
diff --git a/src/qml/compiler/qv4isel_moth_p.h b/src/qml/compiler/qv4isel_moth_p.h
index 74323a2912..afe5fe342e 100644
--- a/src/qml/compiler/qv4isel_moth_p.h
+++ b/src/qml/compiler/qv4isel_moth_p.h
@@ -54,6 +54,7 @@
#include <private/qv4global_p.h>
#include <private/qv4isel_p.h>
#include <private/qv4isel_util_p.h>
+#include <private/qv4util_p.h>
#include <private/qv4jsir_p.h>
#include <private/qv4value_p.h>
#include "qv4instr_moth_p.h"
@@ -85,68 +86,68 @@ public:
InstructionSelection(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator, EvalISelFactory *iselFactory);
~InstructionSelection();
- virtual void run(int functionIndex);
+ void run(int functionIndex) override;
protected:
- virtual QQmlRefPointer<CompiledData::CompilationUnit> backendCompileStep();
-
- virtual void visitJump(IR::Jump *);
- virtual void visitCJump(IR::CJump *);
- virtual void visitRet(IR::Ret *);
-
- virtual void callBuiltinInvalid(IR::Name *func, IR::ExprList *args, IR::Expr *result);
- virtual void callBuiltinTypeofQmlContextProperty(IR::Expr *base, IR::Member::MemberKind kind, int propertyIndex, IR::Expr *result);
- virtual void callBuiltinTypeofMember(IR::Expr *base, const QString &name, IR::Expr *result);
- virtual void callBuiltinTypeofSubscript(IR::Expr *base, IR::Expr *index, IR::Expr *result);
- virtual void callBuiltinTypeofName(const QString &name, IR::Expr *result);
- virtual void callBuiltinTypeofValue(IR::Expr *value, IR::Expr *result);
- virtual void callBuiltinDeleteMember(IR::Expr *base, const QString &name, IR::Expr *result);
- virtual void callBuiltinDeleteSubscript(IR::Expr *base, IR::Expr *index, IR::Expr *result);
- virtual void callBuiltinDeleteName(const QString &name, IR::Expr *result);
- virtual void callBuiltinDeleteValue(IR::Expr *result);
- virtual void callBuiltinThrow(IR::Expr *arg);
- virtual void callBuiltinReThrow();
- virtual void callBuiltinUnwindException(IR::Expr *);
- virtual void callBuiltinPushCatchScope(const QString &exceptionName);
- virtual void callBuiltinForeachIteratorObject(IR::Expr *arg, IR::Expr *result);
- virtual void callBuiltinForeachNextPropertyname(IR::Expr *arg, IR::Expr *result);
- virtual void callBuiltinPushWithScope(IR::Expr *arg);
- virtual void callBuiltinPopScope();
- virtual void callBuiltinDeclareVar(bool deletable, const QString &name);
- virtual void callBuiltinDefineArray(IR::Expr *result, IR::ExprList *args);
- virtual void callBuiltinDefineObjectLiteral(IR::Expr *result, int keyValuePairCount, IR::ExprList *keyValuePairs, IR::ExprList *arrayEntries, bool needSparseArray);
- virtual void callBuiltinSetupArgumentObject(IR::Expr *result);
- virtual void callBuiltinConvertThisToObject();
- virtual void callValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result);
- virtual void callQmlContextProperty(IR::Expr *base, IR::Member::MemberKind kind, int propertyIndex, IR::ExprList *args, IR::Expr *result);
- virtual void callProperty(IR::Expr *base, const QString &name, IR::ExprList *args, IR::Expr *result);
- virtual void callSubscript(IR::Expr *base, IR::Expr *index, IR::ExprList *args, IR::Expr *result);
- virtual void convertType(IR::Expr *source, IR::Expr *target);
- virtual void constructActivationProperty(IR::Name *func, IR::ExprList *args, IR::Expr *result);
- virtual void constructProperty(IR::Expr *base, const QString &name, IR::ExprList *args, IR::Expr *result);
- virtual void constructValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result);
- virtual void loadThisObject(IR::Expr *e);
- virtual void loadQmlContext(IR::Expr *e);
- virtual void loadQmlImportedScripts(IR::Expr *e);
- virtual void loadQmlSingleton(const QString &name, IR::Expr *e);
- virtual void loadConst(IR::Const *sourceConst, IR::Expr *e);
- virtual void loadString(const QString &str, IR::Expr *target);
- virtual void loadRegexp(IR::RegExp *sourceRegexp, IR::Expr *target);
- virtual void getActivationProperty(const IR::Name *name, IR::Expr *target);
- virtual void setActivationProperty(IR::Expr *source, const QString &targetName);
- virtual void initClosure(IR::Closure *closure, IR::Expr *target);
- virtual void getProperty(IR::Expr *base, const QString &name, IR::Expr *target);
- virtual void setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &targetName);
- virtual void setQmlContextProperty(IR::Expr *source, IR::Expr *targetBase, IR::Member::MemberKind kind, int propertyIndex);
- virtual void setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex);
- virtual void getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, int index, bool captureRequired, IR::Expr *target);
- virtual void getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, bool isSingleton, int attachedPropertiesId, IR::Expr *target);
- virtual void getElement(IR::Expr *base, IR::Expr *index, IR::Expr *target);
- virtual void setElement(IR::Expr *source, IR::Expr *targetBase, IR::Expr *targetIndex);
- virtual void copyValue(IR::Expr *source, IR::Expr *target);
- virtual void swapValues(IR::Expr *source, IR::Expr *target);
- virtual void unop(IR::AluOp oper, IR::Expr *source, IR::Expr *target);
- virtual void binop(IR::AluOp oper, IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *target);
+ QQmlRefPointer<CompiledData::CompilationUnit> backendCompileStep() override;
+
+ void visitJump(IR::Jump *) override;
+ void visitCJump(IR::CJump *) override;
+ void visitRet(IR::Ret *) override;
+
+ void callBuiltinInvalid(IR::Name *func, IR::ExprList *args, IR::Expr *result) override;
+ void callBuiltinTypeofQmlContextProperty(IR::Expr *base, IR::Member::MemberKind kind, int propertyIndex, IR::Expr *result) override;
+ void callBuiltinTypeofMember(IR::Expr *base, const QString &name, IR::Expr *result) override;
+ void callBuiltinTypeofSubscript(IR::Expr *base, IR::Expr *index, IR::Expr *result) override;
+ void callBuiltinTypeofName(const QString &name, IR::Expr *result) override;
+ void callBuiltinTypeofValue(IR::Expr *value, IR::Expr *result) override;
+ void callBuiltinDeleteMember(IR::Expr *base, const QString &name, IR::Expr *result) override;
+ void callBuiltinDeleteSubscript(IR::Expr *base, IR::Expr *index, IR::Expr *result) override;
+ void callBuiltinDeleteName(const QString &name, IR::Expr *result) override;
+ void callBuiltinDeleteValue(IR::Expr *result) override;
+ void callBuiltinThrow(IR::Expr *arg) override;
+ void callBuiltinReThrow() override;
+ void callBuiltinUnwindException(IR::Expr *) override;
+ void callBuiltinPushCatchScope(const QString &exceptionName) override;
+ void callBuiltinForeachIteratorObject(IR::Expr *arg, IR::Expr *result) override;
+ void callBuiltinForeachNextPropertyname(IR::Expr *arg, IR::Expr *result) override;
+ void callBuiltinPushWithScope(IR::Expr *arg) override;
+ void callBuiltinPopScope() override;
+ void callBuiltinDeclareVar(bool deletable, const QString &name) override;
+ void callBuiltinDefineArray(IR::Expr *result, IR::ExprList *args) override;
+ void callBuiltinDefineObjectLiteral(IR::Expr *result, int keyValuePairCount, IR::ExprList *keyValuePairs, IR::ExprList *arrayEntries, bool needSparseArray) override;
+ void callBuiltinSetupArgumentObject(IR::Expr *result) override;
+ void callBuiltinConvertThisToObject() override;
+ void callValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result) override;
+ void callQmlContextProperty(IR::Expr *base, IR::Member::MemberKind kind, int propertyIndex, IR::ExprList *args, IR::Expr *result) override;
+ void callProperty(IR::Expr *base, const QString &name, IR::ExprList *args, IR::Expr *result) override;
+ void callSubscript(IR::Expr *base, IR::Expr *index, IR::ExprList *args, IR::Expr *result) override;
+ void convertType(IR::Expr *source, IR::Expr *target) override;
+ void constructActivationProperty(IR::Name *func, IR::ExprList *args, IR::Expr *result) override;
+ void constructProperty(IR::Expr *base, const QString &name, IR::ExprList *args, IR::Expr *result) override;
+ void constructValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result) override;
+ void loadThisObject(IR::Expr *e) override;
+ void loadQmlContext(IR::Expr *e) override;
+ void loadQmlImportedScripts(IR::Expr *e) override;
+ void loadQmlSingleton(const QString &name, IR::Expr *e) override;
+ void loadConst(IR::Const *sourceConst, IR::Expr *e) override;
+ void loadString(const QString &str, IR::Expr *target) override;
+ void loadRegexp(IR::RegExp *sourceRegexp, IR::Expr *target) override;
+ void getActivationProperty(const IR::Name *name, IR::Expr *target) override;
+ void setActivationProperty(IR::Expr *source, const QString &targetName) override;
+ void initClosure(IR::Closure *closure, IR::Expr *target) override;
+ void getProperty(IR::Expr *base, const QString &name, IR::Expr *target) override;
+ void setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &targetName) override;
+ void setQmlContextProperty(IR::Expr *source, IR::Expr *targetBase, IR::Member::MemberKind kind, int propertyIndex) override;
+ void setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex) override;
+ void getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, int index, bool captureRequired, IR::Expr *target) override;
+ void getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, bool isSingleton, int attachedPropertiesId, IR::Expr *target) override;
+ void getElement(IR::Expr *base, IR::Expr *index, IR::Expr *target) override;
+ void setElement(IR::Expr *source, IR::Expr *targetBase, IR::Expr *targetIndex) override;
+ void copyValue(IR::Expr *source, IR::Expr *target) override;
+ void swapValues(IR::Expr *source, IR::Expr *target) override;
+ void unop(IR::AluOp oper, IR::Expr *source, IR::Expr *target) override;
+ void binop(IR::AluOp oper, IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *target) override;
private:
Param binopHelper(IR::AluOp oper, IR::Expr *leftSource, IR::Expr *rightSource, IR::Expr *target);
@@ -199,7 +200,7 @@ private:
uchar *_codeNext;
uchar *_codeEnd;
- QSet<IR::Jump *> _removableJumps;
+ BitVector _removableJumps;
IR::Stmt *_currentStatement;
QScopedPointer<CompilationUnit> compilationUnit;
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index e4eaeaa3f6..a98cf6d338 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -1123,7 +1123,7 @@ public:
{
QVector<UntypedTemp> res;
res.reserve(tempCount());
- foreach (const DefUse &du, _defUses)
+ for (const DefUse &du : _defUses)
if (du.isValid())
res.append(UntypedTemp(du.temp));
return res;
@@ -1150,7 +1150,7 @@ public:
{
Q_ASSERT(static_cast<unsigned>(variable.index) < _defUses.size());
QVector<Stmt *> &uses = _defUses[variable.index].uses;
- foreach (Stmt *stmt, newUses)
+ for (Stmt *stmt : newUses)
if (std::find(uses.begin(), uses.end(), stmt) == uses.end())
uses.push_back(stmt);
}
@@ -1226,7 +1226,7 @@ public:
QVector<Stmt*> removeDefUses(Stmt *s)
{
QVector<Stmt*> defStmts;
- foreach (const Temp &usedVar, usedVars(s)) {
+ for (const Temp &usedVar : usedVars(s)) {
if (Stmt *ds = defStmt(usedVar))
defStmts += ds;
removeUse(s, usedVar);
@@ -1247,7 +1247,7 @@ public:
buf.open(QIODevice::WriteOnly);
QTextStream qout(&buf);
qout << "Defines and uses:" << endl;
- foreach (const DefUse &du, _defUses) {
+ for (const DefUse &du : _defUses) {
if (!du.isValid())
continue;
qout << '%' << du.temp.index;
@@ -1255,14 +1255,14 @@ public:
<< ", statement: " << du.defStmt->id()
<< endl;
qout << " uses:";
- foreach (Stmt *s, du.uses)
+ for (Stmt *s : du.uses)
qout << ' ' << s->id();
qout << endl;
}
qout << "Uses per statement:" << endl;
for (size_t i = 0, ei = _usesPerStatement.size(); i != ei; ++i) {
qout << " " << i << ":";
- foreach (const Temp &t, _usesPerStatement[i])
+ for (const Temp &t : _usesPerStatement[i])
qout << ' ' << t.index;
qout << endl;
}
@@ -1633,7 +1633,7 @@ bool hasPhiOnlyUses(Phi *phi, const DefUses &defUses, QBitArray &collectedPhis)
{
collectedPhis.setBit(phi->id());
- foreach (Stmt *use, defUses.uses(*phi->targetTemp)) {
+ for (Stmt *use : defUses.uses(*phi->targetTemp)) {
Phi *dependentPhi = use->asPhi();
if (!dependentPhi)
return false; // there is a use by a non-phi node
@@ -1679,7 +1679,7 @@ void cleanupPhis(DefUses &defUses)
const Temp &targetVar = *phi->targetTemp;
defUses.defStmtBlock(targetVar)->removeStatement(phi);
- foreach (const Temp &usedVar, defUses.usedVars(phi))
+ for (const Temp &usedVar : defUses.usedVars(phi))
defUses.removeUse(phi, usedVar);
defUses.removeDef(targetVar);
}
@@ -1729,7 +1729,7 @@ public:
worklist.assign(worklist.size(), false);
worklistSize = 0;
- foreach (Stmt *s, stmts) {
+ for (Stmt *s : stmts) {
if (!s)
continue;
@@ -1802,7 +1802,7 @@ public:
StatementWorklist &operator+=(const QVector<Stmt *> &stmts)
{
- foreach (Stmt *s, stmts)
+ for (Stmt *s : stmts)
this->operator+=(s);
return *this;
@@ -2092,7 +2092,7 @@ public:
theTemp = temp;
if (Stmt *defStmt = defUses.defStmt(temp.temp))
visit(defStmt);
- foreach (Stmt *use, defUses.uses(temp.temp))
+ for (Stmt *use : defUses.uses(temp.temp))
visit(use);
}
@@ -2246,7 +2246,7 @@ private:
it = ty;
if (DebugTypeInference) {
- foreach (Stmt *s, _defUses.uses(*t)) {
+ for (Stmt *s : _defUses.uses(*t)) {
QBuffer buf;
buf.open(QIODevice::WriteOnly);
QTextStream qout(&buf);
@@ -2606,7 +2606,7 @@ public:
}
PropagateTempTypes propagator(_defUses);
- foreach (const UntypedTemp &t, knownOk) {
+ for (const UntypedTemp &t : qAsConst(knownOk)) {
propagator.run(t, SInt32Type);
if (Stmt *defStmt = _defUses.defStmt(t.temp)) {
if (Move *m = defStmt->asMove()) {
@@ -2630,7 +2630,7 @@ private:
if (uses.isEmpty())
return false;
- foreach (Stmt *use, uses) {
+ for (Stmt *use : uses) {
if (Move *m = use->asMove()) {
Temp *targetTemp = m->target->asTemp();
@@ -3165,7 +3165,8 @@ public:
std::vector<BasicBlock *> backedges;
backedges.reserve(4);
- foreach (BasicBlock *bb, dt.calculateDFNodeIterOrder()) {
+ const auto order = dt.calculateDFNodeIterOrder();
+ for (BasicBlock *bb : order) {
Q_ASSERT(!bb->isRemoved());
backedges.clear();
@@ -3188,12 +3189,12 @@ public:
if (!DebugLoopDetection)
return;
- foreach (LoopInfo *info, loopInfos) {
+ for (const LoopInfo *info : loopInfos) {
qDebug() << "Loop header:" << info->loopHeader->index()
<< "for loop" << quint64(info);
- foreach (BasicBlock *bb, info->loopBody)
+ for (BasicBlock *bb : info->loopBody)
qDebug() << " " << bb->index();
- foreach (LoopInfo *nested, info->nestedLoops)
+ for (LoopInfo *nested : info->nestedLoops)
qDebug() << " sub loop:" << quint64(nested);
qDebug() << " parent loop:" << quint64(info->parentLoop);
}
@@ -3277,15 +3278,15 @@ private:
findLoop(loopHeader)->loopBody.append(bb);
}
- foreach (LoopInfo *info, loopInfos) {
- if (BasicBlock *containingLoopHeader = info->loopHeader->containingGroup())
- findLoop(containingLoopHeader)->addNestedLoop(info);
+ for (int i = 0, size = loopInfos.size(); i < size; ++i) {
+ if (BasicBlock *containingLoopHeader = loopInfos.at(i)->loopHeader->containingGroup())
+ findLoop(containingLoopHeader)->addNestedLoop(loopInfos.at(i));
}
}
LoopInfo *findLoop(BasicBlock *loopHeader)
{
- foreach (LoopInfo *info, loopInfos) {
+ for (LoopInfo *info : qAsConst(loopInfos)) {
if (info->loopHeader == loopHeader)
return info;
}
@@ -3459,8 +3460,8 @@ public:
};
#ifndef QT_NO_DEBUG
-void checkCriticalEdges(QVector<BasicBlock *> basicBlocks) {
- foreach (BasicBlock *bb, basicBlocks) {
+void checkCriticalEdges(const QVector<BasicBlock *> &basicBlocks) {
+ for (BasicBlock *bb : basicBlocks) {
if (bb && bb->out.size() > 1) {
for (BasicBlock *bb2 : bb->out) {
if (bb2 && bb2->in.size() > 1) {
@@ -3594,7 +3595,7 @@ public:
newUses->reserve(uses.size());
// qout << " " << uses.size() << " uses:"<<endl;
- foreach (Stmt *use, uses) {
+ for (Stmt *use : uses) {
// qout<<" ";use->dump(qout);qout<<"\n";
visit(use);
// qout<<" -> ";use->dump(qout);qout<<"\n";
@@ -3752,7 +3753,7 @@ void unlink(BasicBlock *from, BasicBlock *to, IR::Function *func, DefUses &defUs
return;
to->in.remove(idx);
- foreach (Stmt *outStmt, to->statements()) {
+ for (Stmt *outStmt : to->statements()) {
if (!outStmt)
continue;
if (Phi *phi = outStmt->asPhi()) {
@@ -3770,7 +3771,7 @@ void unlink(BasicBlock *from, BasicBlock *to, IR::Function *func, DefUses &defUs
static bool isReachable(BasicBlock *bb, const DominatorTree &dt)
{
- foreach (BasicBlock *in, bb->in) {
+ for (BasicBlock *in : bb->in) {
if (in->isRemoved())
continue;
if (dt.dominates(bb, in)) // a back-edge, not interesting
@@ -3940,13 +3941,13 @@ void cfg2dot(IR::Function *f, const QVector<LoopDetection::LoopInfo *> &loops =
struct Util {
QTextStream &qout;
Util(QTextStream &qout): qout(qout) {}
- void genLoop(LoopDetection::LoopInfo *loop)
+ void genLoop(const LoopDetection::LoopInfo *loop)
{
qout << " subgraph \"cluster" << quint64(loop) << "\" {\n";
qout << " L" << loop->loopHeader->index() << ";\n";
- foreach (BasicBlock *bb, loop->loopBody)
+ for (BasicBlock *bb : loop->loopBody)
qout << " L" << bb->index() << ";\n";
- foreach (LoopDetection::LoopInfo *nested, loop->nestedLoops)
+ for (LoopDetection::LoopInfo *nested : loop->nestedLoops)
genLoop(nested);
qout << " }\n";
}
@@ -3957,7 +3958,7 @@ void cfg2dot(IR::Function *f, const QVector<LoopDetection::LoopInfo *> &loops =
else name = QStringLiteral("%1").arg((unsigned long long)f);
qout << "digraph \"" << name << "\" { ordering=out;\n";
- foreach (LoopDetection::LoopInfo *l, loops) {
+ for (LoopDetection::LoopInfo *l : loops) {
if (l->parentLoop == 0)
Util(qout).genLoop(l);
}
@@ -4463,7 +4464,8 @@ public:
qout << "Life ranges:" << endl;
qout << "Intervals:" << endl;
- foreach (const LifeTimeInterval *range, _sortedIntervals->intervals()) {
+ const auto intervals = _sortedIntervals->intervals();
+ for (const LifeTimeInterval *range : intervals) {
range->dump(qout);
qout << endl;
}
@@ -4723,7 +4725,7 @@ private:
clonedStmt = phi;
phi->targetTemp = clone(p->targetTemp);
- foreach (Expr *in, p->incoming)
+ for (Expr *in : p->incoming)
phi->incoming.append(clone(in));
block->appendStatement(phi);
} else {
@@ -4753,7 +4755,7 @@ public:
void run(const QVector<LoopDetection::LoopInfo *> &loops)
{
- foreach (LoopDetection::LoopInfo *loopInfo, loops)
+ for (LoopDetection::LoopInfo *loopInfo : loops)
peelLoop(loopInfo);
}
@@ -4857,7 +4859,7 @@ private:
// The original loop is now peeled off, and won't jump back to the loop header. Meaning, it
// is not a loop anymore, so unmark it.
loop->loopHeader->markAsGroupStart(false);
- foreach (BasicBlock *bb, loop->loopBody)
+ for (BasicBlock *bb : qAsConst(loop->loopBody))
bb->setContainingGroup(loop->loopHeader->containingGroup());
// calculate the idoms in a separate loop, because addBasicBlock in the previous loop will
@@ -4875,7 +4877,7 @@ private:
}
BasicBlockSet siblings(f);
- foreach (BasicBlock *bb, loopExits)
+ for (BasicBlock *bb : qAsConst(loopExits))
dt.collectSiblings(bb, siblings);
dt.recalculateIDoms(siblings, loop->loopHeader);
@@ -5518,14 +5520,30 @@ LifeTimeIntervals::Ptr Optimizer::lifeTimeIntervals() const
return lifeRanges.intervals();
}
-QSet<Jump *> Optimizer::calculateOptionalJumps()
+static int countPhis(BasicBlock *bb)
{
- QSet<Jump *> optional;
- QSet<BasicBlock *> reachableWithoutJump;
+ int count = 0;
+ for (Stmt *s : bb->statements()) {
+ if (s->isa<Phi>())
+ ++count;
+ else
+ break;
+ }
+ return count;
+}
+
+// Basic blocks can have only 1 terminator. This function returns a bit vector, where a 1 on a
+// certain index indicates that the terminator (jump) at the end of the basic block with that index
+// can be omitted.
+BitVector Optimizer::calculateOptionalJumps()
+{
const int maxSize = function->basicBlockCount();
- optional.reserve(maxSize);
- reachableWithoutJump.reserve(maxSize);
+ BitVector optional(maxSize, false);
+ if (maxSize < 2)
+ return optional;
+
+ BitVector reachableWithoutJump(maxSize, false);
for (int i = maxSize - 1; i >= 0; --i) {
BasicBlock *bb = function->basicBlock(i);
@@ -5533,17 +5551,17 @@ QSet<Jump *> Optimizer::calculateOptionalJumps()
continue;
if (Jump *jump = bb->statements().last()->asJump()) {
- if (reachableWithoutJump.contains(jump->target)) {
- if (bb->statements().size() > 1)
+ if (reachableWithoutJump.at(jump->target->index())) {
+ if (bb->statements().size() - countPhis(bb)> 1)
reachableWithoutJump.clear();
- optional.insert(jump);
- reachableWithoutJump.insert(bb);
+ optional.setBit(bb->index());
+ reachableWithoutJump.setBit(bb->index());
continue;
}
}
reachableWithoutJump.clear();
- reachableWithoutJump.insert(bb);
+ reachableWithoutJump.setBit(bb->index());
}
return optional;
@@ -5642,7 +5660,7 @@ QList<IR::Move *> MoveMapping::insertMoves(BasicBlock *bb, IR::Function *functio
newMoves.reserve(_moves.size());
int insertionPoint = atEnd ? bb->statements().size() - 1 : 0;
- foreach (const Move &m, _moves) {
+ for (const Move &m : _moves) {
IR::Move *move = function->NewStmt<IR::Move>();
move->init(clone(m.to, function), clone(m.from, function));
move->swap = m.needsSwap;
@@ -5661,7 +5679,7 @@ void MoveMapping::dump() const
QTextStream os(&buf);
IRPrinter printer(&os);
os << "Move mapping has " << _moves.size() << " moves..." << endl;
- foreach (const Move &m, _moves) {
+ for (const Move &m : _moves) {
os << "\t";
printer.print(m.to);
if (m.needsSwap)
@@ -5678,8 +5696,8 @@ void MoveMapping::dump() const
MoveMapping::Action MoveMapping::schedule(const Move &m, QList<Move> &todo, QList<Move> &delayed,
QList<Move> &output, QList<Move> &swaps) const
{
- Moves usages = sourceUsages(m.to, todo) + sourceUsages(m.to, delayed);
- foreach (const Move &dependency, usages) {
+ const Moves usages = sourceUsages(m.to, todo) + sourceUsages(m.to, delayed);
+ for (const Move &dependency : usages) {
if (!output.contains(dependency)) {
if (delayed.contains(dependency)) {
// We have a cycle! Break it by swapping instead of assigning.
@@ -5690,7 +5708,7 @@ MoveMapping::Action MoveMapping::schedule(const Move &m, QList<Move> &todo, QLis
QTextStream out(&buf);
IRPrinter printer(&out);
out<<"we have a cycle! temps:" << endl;
- foreach (const Move &m, delayed) {
+ for (const Move &m : qAsConst(delayed)) {
out<<"\t";
printer.print(m.to);
out<<" <- ";
diff --git a/src/qml/compiler/qv4ssa_p.h b/src/qml/compiler/qv4ssa_p.h
index 3a787f0347..db8b6edd1a 100644
--- a/src/qml/compiler/qv4ssa_p.h
+++ b/src/qml/compiler/qv4ssa_p.h
@@ -53,6 +53,7 @@
#include "qv4jsir_p.h"
#include "qv4isel_util_p.h"
+#include <private/qv4util_p.h>
#include <QtCore/QSharedPointer>
QT_BEGIN_NAMESPACE
@@ -246,7 +247,7 @@ public:
LifeTimeIntervals::Ptr lifeTimeIntervals() const;
- QSet<IR::Jump *> calculateOptionalJumps();
+ BitVector calculateOptionalJumps();
static void showMeTheCode(Function *function, const char *marker);
@@ -340,7 +341,7 @@ public:
}
protected:
- virtual int allocateFreeSlot()
+ int allocateFreeSlot() override
{
for (int i = 0, ei = _slotIsInUse.size(); i != ei; ++i) {
if (!_slotIsInUse[i]) {
@@ -357,7 +358,7 @@ protected:
return -1;
}
- virtual void process(IR::Stmt *s)
+ void process(IR::Stmt *s) override
{
// qDebug("L%d statement %d:", _currentBasicBlock->index, s->id);
@@ -411,8 +412,8 @@ protected:
}
}
moves.order();
- QList<IR::Move *> newMoves = moves.insertMoves(_currentBasicBlock, _function, true);
- foreach (IR::Move *move, newMoves)
+ const QList<IR::Move *> newMoves = moves.insertMoves(_currentBasicBlock, _function, true);
+ for (IR::Move *move : newMoves)
visit(move);
}
}
@@ -437,13 +438,13 @@ protected:
// qDebug() << "\t - force activating temp" << t.index << "on slot" << _stackSlotForTemp[t.index];
}
- virtual void visitPhi(IR::Phi *phi)
+ void visitPhi(IR::Phi *phi) override
{
Q_UNUSED(phi);
#if !defined(QT_NO_DEBUG)
Q_ASSERT(_stackSlotForTemp.contains(phi->targetTemp->index));
Q_ASSERT(_slotIsInUse[_stackSlotForTemp[phi->targetTemp->index]]);
- foreach (IR::Expr *e, phi->incoming) {
+ for (IR::Expr *e : phi->incoming) {
if (IR::Temp *t = e->asTemp())
Q_ASSERT(_stackSlotForTemp.contains(t->index));
}
diff --git a/src/qml/debugger/qqmldebugconnector.cpp b/src/qml/debugger/qqmldebugconnector.cpp
index 23440e7529..029df1e748 100644
--- a/src/qml/debugger/qqmldebugconnector.cpp
+++ b/src/qml/debugger/qqmldebugconnector.cpp
@@ -134,9 +134,11 @@ QQmlDebugConnector *QQmlDebugConnector::instance()
}
if (params->instance) {
- foreach (const QJsonObject &object, metaDataForQQmlDebugService()) {
- foreach (const QJsonValue &key, object.value(QLatin1String("MetaData")).toObject()
- .value(QLatin1String("Keys")).toArray()) {
+ const auto metaData = metaDataForQQmlDebugService();
+ for (const QJsonObject &object : metaData) {
+ const auto keys = object.value(QLatin1String("MetaData")).toObject()
+ .value(QLatin1String("Keys")).toArray();
+ for (const QJsonValue &key : keys) {
QString keyString = key.toString();
if (params->services.isEmpty() || params->services.contains(keyString))
loadQQmlDebugService(keyString);
diff --git a/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc b/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc
index acd7188db7..fffa783851 100644
--- a/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc
+++ b/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc
@@ -143,7 +143,7 @@ If the string of QML imports files using relative paths, the path should be
relative to the file in which the parent object (the second argument to the
method) is defined.
-\important When building static QML applications, which is enforced on platforms like iOS,
+\important When building static QML applications,
QML files are scanned to detect import dependencies. That way, all
necessary plugins and resources are resolved at compile time.
However, only explicit import statements are considered (those found at
diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp
index 71069d64a5..515b8aea4d 100644
--- a/src/qml/jit/qv4isel_masm.cpp
+++ b/src/qml/jit/qv4isel_masm.cpp
@@ -113,8 +113,7 @@ static void printDisassembledOutputWithCalls(QByteArray processedOutput, const Q
{
for (QHash<void*, const char*>::ConstIterator it = functions.begin(), end = functions.end();
it != end; ++it) {
- QByteArray ptrString = QByteArray::number(quintptr(it.key()), 16);
- ptrString.prepend("0x");
+ const QByteArray ptrString = "0x" + QByteArray::number(quintptr(it.key()), 16);
int idx = processedOutput.indexOf(ptrString);
if (idx < 0)
continue;
@@ -191,11 +190,8 @@ JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize)
WTF::setDataFile(new QIODevicePrintStream(&buf));
name = _function->name->toUtf8();
- if (name.isEmpty()) {
- name = QByteArray::number(quintptr(_function), 16);
- name.prepend("IR::Function(0x");
- name.append(')');
- }
+ if (name.isEmpty())
+ name = "IR::Function(0x" + QByteArray::number(quintptr(_function), 16) + ')';
codeRef = linkBuffer.finalizeCodeWithDisassembly("%s", name.data());
WTF::setDataFile(stderr);
@@ -232,11 +228,8 @@ JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize)
// this may have been pre-populated, if QV4_SHOW_ASM was on
if (name.isEmpty()) {
name = _function->name->toUtf8();
- if (name.isEmpty()) {
- name = QByteArray::number(quintptr(_function), 16);
- name.prepend("IR::Function(0x");
- name.append(')');
- }
+ if (name.isEmpty())
+ name = "IR::Function(0x" + QByteArray::number(quintptr(_function), 16) + ')';
}
fprintf(pmap, "%llx %x %.*s\n",
@@ -288,7 +281,7 @@ void InstructionSelection::run(int functionIndex)
IR::Optimizer::showMeTheCode(_function, "After stack slot allocation");
calculateRegistersToSave(Assembler::getRegisterInfo()); // FIXME: this saves all registers. We can probably do with a subset: those that are not used by the register allocator.
}
- QSet<IR::Jump *> removableJumps = opt.calculateOptionalJumps();
+ BitVector removableJumps = opt.calculateOptionalJumps();
qSwap(_removableJumps, removableJumps);
Assembler* oldAssembler = _as;
@@ -1389,7 +1382,7 @@ void InstructionSelection::constructValue(IR::Expr *value, IR::ExprList *args, I
void InstructionSelection::visitJump(IR::Jump *s)
{
- if (!_removableJumps.contains(s))
+ if (!_removableJumps.at(_block->index()))
_as->jumpToBlock(_block, s->target);
}
diff --git a/src/qml/jit/qv4isel_masm_p.h b/src/qml/jit/qv4isel_masm_p.h
index b6ddd3c1c9..5c693e0736 100644
--- a/src/qml/jit/qv4isel_masm_p.h
+++ b/src/qml/jit/qv4isel_masm_p.h
@@ -54,6 +54,7 @@
#include "private/qv4jsir_p.h"
#include "private/qv4isel_p.h"
#include "private/qv4isel_util_p.h"
+#include "private/qv4util_p.h"
#include "private/qv4value_p.h"
#include "private/qv4lookup_p.h"
@@ -272,7 +273,7 @@ private:
}
IR::BasicBlock *_block;
- QSet<IR::Jump *> _removableJumps;
+ BitVector _removableJumps;
Assembler* _as;
QScopedPointer<CompilationUnit> compilationUnit;
diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp
index 406b9096ea..63d542b5c8 100644
--- a/src/qml/jit/qv4regalloc.cpp
+++ b/src/qml/jit/qv4regalloc.cpp
@@ -272,32 +272,32 @@ public:
}
protected: // IRDecoder
- virtual void callBuiltinInvalid(IR::Name *, IR::ExprList *, IR::Expr *) {}
- virtual void callBuiltinTypeofQmlContextProperty(IR::Expr *, IR::Member::MemberKind, int, IR::Expr *) {}
- virtual void callBuiltinTypeofMember(IR::Expr *, const QString &, IR::Expr *) {}
- virtual void callBuiltinTypeofSubscript(IR::Expr *, IR::Expr *, IR::Expr *) {}
- virtual void callBuiltinTypeofName(const QString &, IR::Expr *) {}
- virtual void callBuiltinTypeofValue(IR::Expr *, IR::Expr *) {}
- virtual void callBuiltinDeleteMember(IR::Expr *, const QString &, IR::Expr *) {}
- virtual void callBuiltinDeleteSubscript(IR::Expr *, IR::Expr *, IR::Expr *) {}
- virtual void callBuiltinDeleteName(const QString &, IR::Expr *) {}
- virtual void callBuiltinDeleteValue(IR::Expr *) {}
- virtual void callBuiltinThrow(IR::Expr *) {}
- virtual void callBuiltinReThrow() {}
- virtual void callBuiltinUnwindException(IR::Expr *) {}
- virtual void callBuiltinPushCatchScope(const QString &) {};
- virtual void callBuiltinForeachIteratorObject(IR::Expr *, IR::Expr *) {}
+ void callBuiltinInvalid(IR::Name *, IR::ExprList *, IR::Expr *) override {}
+ void callBuiltinTypeofQmlContextProperty(IR::Expr *, IR::Member::MemberKind, int, IR::Expr *) override {}
+ void callBuiltinTypeofMember(IR::Expr *, const QString &, IR::Expr *) override {}
+ void callBuiltinTypeofSubscript(IR::Expr *, IR::Expr *, IR::Expr *) override {}
+ void callBuiltinTypeofName(const QString &, IR::Expr *) override {}
+ void callBuiltinTypeofValue(IR::Expr *, IR::Expr *) override {}
+ void callBuiltinDeleteMember(IR::Expr *, const QString &, IR::Expr *) override {}
+ void callBuiltinDeleteSubscript(IR::Expr *, IR::Expr *, IR::Expr *) override {}
+ void callBuiltinDeleteName(const QString &, IR::Expr *) override {}
+ void callBuiltinDeleteValue(IR::Expr *) override {}
+ void callBuiltinThrow(IR::Expr *) override {}
+ void callBuiltinReThrow() override {}
+ void callBuiltinUnwindException(IR::Expr *) override {}
+ void callBuiltinPushCatchScope(const QString &) override {};
+ void callBuiltinForeachIteratorObject(IR::Expr *, IR::Expr *) override {}
virtual void callBuiltinForeachNextProperty(IR::Temp *, IR::Temp *) {}
- virtual void callBuiltinForeachNextPropertyname(IR::Expr *, IR::Expr *) {}
- virtual void callBuiltinPushWithScope(IR::Expr *) {}
- virtual void callBuiltinPopScope() {}
- virtual void callBuiltinDeclareVar(bool , const QString &) {}
- virtual void callBuiltinDefineArray(IR::Expr *, IR::ExprList *) {}
- virtual void callBuiltinDefineObjectLiteral(IR::Expr *, int, IR::ExprList *, IR::ExprList *, bool) {}
- virtual void callBuiltinSetupArgumentObject(IR::Expr *) {}
- virtual void callBuiltinConvertThisToObject() {}
+ void callBuiltinForeachNextPropertyname(IR::Expr *, IR::Expr *) override {}
+ void callBuiltinPushWithScope(IR::Expr *) override {}
+ void callBuiltinPopScope() override {}
+ void callBuiltinDeclareVar(bool , const QString &) override {}
+ void callBuiltinDefineArray(IR::Expr *, IR::ExprList *) override {}
+ void callBuiltinDefineObjectLiteral(IR::Expr *, int, IR::ExprList *, IR::ExprList *, bool) override {}
+ void callBuiltinSetupArgumentObject(IR::Expr *) override {}
+ void callBuiltinConvertThisToObject() override {}
- virtual void callValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result)
+ void callValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result) override
{
addDef(result);
if (IR::Temp *tempValue = value->asTemp())
@@ -306,7 +306,8 @@ protected: // IRDecoder
addCall();
}
- virtual void callQmlContextProperty(IR::Expr *base, IR::Member::MemberKind /*kind*/, int propertyIndex, IR::ExprList *args, IR::Expr *result)
+ void callQmlContextProperty(IR::Expr *base, IR::Member::MemberKind /*kind*/, int propertyIndex,
+ IR::ExprList *args, IR::Expr *result) override
{
Q_UNUSED(propertyIndex)
@@ -316,8 +317,8 @@ protected: // IRDecoder
addCall();
}
- virtual void callProperty(IR::Expr *base, const QString &name, IR::ExprList *args,
- IR::Expr *result)
+ void callProperty(IR::Expr *base, const QString &name, IR::ExprList *args,
+ IR::Expr *result) override
{
Q_UNUSED(name)
@@ -327,8 +328,8 @@ protected: // IRDecoder
addCall();
}
- virtual void callSubscript(IR::Expr *base, IR::Expr *index, IR::ExprList *args,
- IR::Expr *result)
+ void callSubscript(IR::Expr *base, IR::Expr *index, IR::ExprList *args,
+ IR::Expr *result) override
{
addDef(result);
addUses(base->asTemp(), Use::CouldHaveRegister);
@@ -337,7 +338,7 @@ protected: // IRDecoder
addCall();
}
- virtual void convertType(IR::Expr *source, IR::Expr *target)
+ void convertType(IR::Expr *source, IR::Expr *target) override
{
addDef(target);
@@ -410,14 +411,14 @@ protected: // IRDecoder
addHint(target->asTemp(), sourceTemp);
}
- virtual void constructActivationProperty(IR::Name *, IR::ExprList *args, IR::Expr *result)
+ void constructActivationProperty(IR::Name *, IR::ExprList *args, IR::Expr *result) override
{
addDef(result);
addUses(args, Use::CouldHaveRegister);
addCall();
}
- virtual void constructProperty(IR::Expr *base, const QString &, IR::ExprList *args, IR::Expr *result)
+ void constructProperty(IR::Expr *base, const QString &, IR::ExprList *args, IR::Expr *result) override
{
addDef(result);
addUses(base, Use::CouldHaveRegister);
@@ -425,7 +426,7 @@ protected: // IRDecoder
addCall();
}
- virtual void constructValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result)
+ void constructValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result) override
{
addDef(result);
addUses(value, Use::CouldHaveRegister);
@@ -433,24 +434,24 @@ protected: // IRDecoder
addCall();
}
- virtual void loadThisObject(IR::Expr *temp)
+ void loadThisObject(IR::Expr *temp) override
{
addDef(temp);
}
- virtual void loadQmlContext(IR::Expr *temp)
+ void loadQmlContext(IR::Expr *temp) override
{
addDef(temp);
addCall();
}
- virtual void loadQmlImportedScripts(IR::Expr *temp)
+ void loadQmlImportedScripts(IR::Expr *temp) override
{
addDef(temp);
addCall();
}
- virtual void loadQmlSingleton(const QString &/*name*/, Expr *temp)
+ void loadQmlSingleton(const QString &/*name*/, Expr *temp) override
{
Q_UNUSED(temp);
@@ -458,21 +459,21 @@ protected: // IRDecoder
addCall();
}
- virtual void loadConst(IR::Const *sourceConst, Expr *targetTemp)
+ void loadConst(IR::Const *sourceConst, Expr *targetTemp) override
{
Q_UNUSED(sourceConst);
addDef(targetTemp);
}
- virtual void loadString(const QString &str, Expr *targetTemp)
+ void loadString(const QString &str, Expr *targetTemp) override
{
Q_UNUSED(str);
addDef(targetTemp);
}
- virtual void loadRegexp(IR::RegExp *sourceRegexp, Expr *targetTemp)
+ void loadRegexp(IR::RegExp *sourceRegexp, Expr *targetTemp) override
{
Q_UNUSED(sourceRegexp);
@@ -480,19 +481,19 @@ protected: // IRDecoder
addCall();
}
- virtual void getActivationProperty(const IR::Name *, Expr *temp)
+ void getActivationProperty(const IR::Name *, Expr *temp) override
{
addDef(temp);
addCall();
}
- virtual void setActivationProperty(IR::Expr *source, const QString &)
+ void setActivationProperty(IR::Expr *source, const QString &) override
{
addUses(source->asTemp(), Use::CouldHaveRegister);
addCall();
}
- virtual void initClosure(IR::Closure *closure, Expr *target)
+ void initClosure(IR::Closure *closure, Expr *target) override
{
Q_UNUSED(closure);
@@ -500,49 +501,52 @@ protected: // IRDecoder
addCall();
}
- virtual void getProperty(IR::Expr *base, const QString &, Expr *target)
+ void getProperty(IR::Expr *base, const QString &, Expr *target) override
{
addDef(target);
addUses(base->asTemp(), Use::CouldHaveRegister);
addCall();
}
- virtual void setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &)
+ void setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &) override
{
addUses(source->asTemp(), Use::CouldHaveRegister);
addUses(targetBase->asTemp(), Use::CouldHaveRegister);
addCall();
}
- virtual void setQmlContextProperty(IR::Expr *source, IR::Expr *targetBase, IR::Member::MemberKind /*kind*/, int /*propertyIndex*/)
+ void setQmlContextProperty(IR::Expr *source, IR::Expr *targetBase,
+ IR::Member::MemberKind /*kind*/, int /*propertyIndex*/) override
{
addUses(source->asTemp(), Use::CouldHaveRegister);
addUses(targetBase->asTemp(), Use::CouldHaveRegister);
addCall();
}
- virtual void setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int /*propertyIndex*/)
+ void setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int /*propertyIndex*/) override
{
addUses(source->asTemp(), Use::CouldHaveRegister);
addUses(targetBase->asTemp(), Use::CouldHaveRegister);
addCall();
}
- virtual void getQmlContextProperty(IR::Expr *base, IR::Member::MemberKind /*kind*/, int /*index*/, bool /*captureRequired*/, IR::Expr *target)
+ void getQmlContextProperty(IR::Expr *base, IR::Member::MemberKind /*kind*/, int /*index*/,
+ bool /*captureRequired*/, IR::Expr *target) override
{
addDef(target);
addUses(base->asTemp(), Use::CouldHaveRegister);
addCall();
}
- virtual void getQObjectProperty(IR::Expr *base, int /*propertyIndex*/, bool /*captureRequired*/, bool /*isSingleton*/, int /*attachedPropertiesId*/, IR::Expr *target)
+ void getQObjectProperty(IR::Expr *base, int /*propertyIndex*/, bool /*captureRequired*/,
+ bool /*isSingleton*/, int /*attachedPropertiesId*/, IR::Expr *target) override
{
addDef(target);
addUses(base->asTemp(), Use::CouldHaveRegister);
addCall();
}
- virtual void getElement(IR::Expr *base, IR::Expr *index, Expr *target)
+ void getElement(IR::Expr *base, IR::Expr *index, Expr *target) override
{
addDef(target);
addUses(base->asTemp(), Use::CouldHaveRegister);
@@ -550,7 +554,7 @@ protected: // IRDecoder
addCall();
}
- virtual void setElement(IR::Expr *source, IR::Expr *targetBase, IR::Expr *targetIndex)
+ void setElement(IR::Expr *source, IR::Expr *targetBase, IR::Expr *targetIndex) override
{
addUses(source->asTemp(), Use::CouldHaveRegister);
addUses(targetBase->asTemp(), Use::CouldHaveRegister);
@@ -558,7 +562,7 @@ protected: // IRDecoder
addCall();
}
- virtual void copyValue(Expr *source, Expr *target)
+ void copyValue(Expr *source, Expr *target) override
{
addDef(target);
Temp *sourceTemp = source->asTemp();
@@ -570,13 +574,13 @@ protected: // IRDecoder
addHint(targetTemp, sourceTemp);
}
- virtual void swapValues(Expr *, Expr *)
+ void swapValues(Expr *, Expr *) override
{
// Inserted by the register allocator, so it cannot occur here.
Q_UNREACHABLE();
}
- virtual void unop(AluOp oper, Expr *source, Expr *target)
+ void unop(AluOp oper, Expr *source, Expr *target) override
{
addDef(target);
@@ -612,7 +616,7 @@ protected: // IRDecoder
}
}
- virtual void binop(AluOp oper, Expr *leftSource, Expr *rightSource, Expr *target)
+ void binop(AluOp oper, Expr *leftSource, Expr *rightSource, Expr *target) override
{
bool needsCall = true;
@@ -675,8 +679,8 @@ protected: // IRDecoder
}
}
- virtual void visitJump(IR::Jump *) {}
- virtual void visitCJump(IR::CJump *s)
+ void visitJump(IR::Jump *) override {}
+ void visitCJump(IR::CJump *s) override
{
if (Temp *t = s->cond->asTemp()) {
#if 0 // TODO: change masm to generate code
@@ -696,10 +700,10 @@ protected: // IRDecoder
}
}
- virtual void visitRet(IR::Ret *s)
+ void visitRet(IR::Ret *s) override
{ addUses(s->expr->asTemp(), Use::CouldHaveRegister); }
- virtual void visitPhi(IR::Phi *s)
+ void visitPhi(IR::Phi *s) override
{
addDef(s->targetTemp, true);
for (int i = 0, ei = s->incoming.size(); i < ei; ++i) {
@@ -716,7 +720,7 @@ protected: // IRDecoder
}
protected:
- virtual void callBuiltin(IR::Call *c, IR::Expr *result)
+ void callBuiltin(IR::Call *c, IR::Expr *result) override
{
addDef(result);
addUses(c->base, Use::CouldHaveRegister);
diff --git a/src/qml/jsruntime/jsruntime.pri b/src/qml/jsruntime/jsruntime.pri
index dcc04cbd54..4343924436 100644
--- a/src/qml/jsruntime/jsruntime.pri
+++ b/src/qml/jsruntime/jsruntime.pri
@@ -82,7 +82,6 @@ HEADERS += \
$$PWD/qv4serialize_p.h \
$$PWD/qv4script_p.h \
$$PWD/qv4scopedvalue_p.h \
- $$PWD/qv4util_p.h \
$$PWD/qv4executableallocator_p.h \
$$PWD/qv4sequenceobject_p.h \
$$PWD/qv4include_p.h \
@@ -107,6 +106,7 @@ HEADERS += \
$$PWD/qv4runtimeapi_p.h \
$$PWD/qv4value_p.h \
$$PWD/qv4string_p.h \
+ $$PWD/qv4util_p.h \
$$PWD/qv4value_p.h
SOURCES += \
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index a9284f2e69..7265952f72 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -463,7 +463,7 @@ ExecutionEngine::~ExecutionEngine()
QSet<QV4::CompiledData::CompilationUnit*> remainingUnits;
qSwap(compilationUnits, remainingUnits);
- foreach (QV4::CompiledData::CompilationUnit *unit, remainingUnits)
+ for (QV4::CompiledData::CompilationUnit *unit : qAsConst(remainingUnits))
unit->unlink();
emptyClass->destroy();
@@ -1028,7 +1028,7 @@ ReturnedValue ExecutionEngine::throwURIError(const Value &msg)
ReturnedValue ExecutionEngine::throwUnimplemented(const QString &message)
{
Scope scope(this);
- ScopedValue v(scope, newString(QStringLiteral("Unimplemented ") + message));
+ ScopedValue v(scope, newString(QLatin1String("Unimplemented ") + message));
v = newErrorObject(v);
return throwError(v);
}
diff --git a/src/qml/jsruntime/qv4executableallocator.cpp b/src/qml/jsruntime/qv4executableallocator.cpp
index 6fe25f192d..64ac1267ce 100644
--- a/src/qml/jsruntime/qv4executableallocator.cpp
+++ b/src/qml/jsruntime/qv4executableallocator.cpp
@@ -147,7 +147,7 @@ ExecutableAllocator::ExecutableAllocator()
ExecutableAllocator::~ExecutableAllocator()
{
- foreach (ChunkOfPages *chunk, chunks) {
+ for (ChunkOfPages *chunk : qAsConst(chunks)) {
for (Allocation *allocation = chunk->firstAllocation; allocation; allocation = allocation->next)
if (!allocation->free)
allocation->invalidate();
diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp
index 1733df34ae..9b1f72bc17 100644
--- a/src/qml/jsruntime/qv4numberobject.cpp
+++ b/src/qml/jsruntime/qv4numberobject.cpp
@@ -63,7 +63,9 @@ NumberLocale::NumberLocale() : QLocale(QLocale::C),
// -128 means shortest string that can accurately represent the number.
defaultDoublePrecision(0xffffff80)
{
- setNumberOptions(QLocale::OmitGroupSeparator | QLocale::OmitLeadingZeroInExponent);
+ setNumberOptions(QLocale::OmitGroupSeparator |
+ QLocale::OmitLeadingZeroInExponent |
+ QLocale::IncludeTrailingZeroesAfterDot);
}
const NumberLocale *NumberLocale::instance()
@@ -291,24 +293,6 @@ ReturnedValue NumberPrototype::method_toPrecision(CallContext *ctx)
return ctx->engine()->throwRangeError(error);
}
- // TODO: Once we get a NumberOption to retain trailing zeroes, replace the code below with:
- // QString result = NumberLocale::instance()->toString(v->asDouble(), 'g', precision);
- QByteArray format = "%#." + QByteArray::number(precision) + "g";
- QString result = QString::asprintf(format.constData(), v->asDouble());
- if (result.endsWith(QLatin1Char('.'))) {
- // This is 'f' notation, not 'e'.
- result.chop(1);
- } else {
- int ePos = result.indexOf(QLatin1Char('e'));
- if (ePos != -1) {
- Q_ASSERT(ePos + 2 < result.length()); // always '+' or '-', and number, after 'e'
- Q_ASSERT(ePos > 0); // 'e' is not the first character
-
- if (result.at(ePos + 2) == QLatin1Char('0')) // Drop leading zeroes in exponent
- result = result.remove(ePos + 2, 1);
- if (result.at(ePos - 1) == QLatin1Char('.')) // Drop trailing dots before 'e'
- result = result.remove(ePos - 1, 1);
- }
- }
+ QString result = NumberLocale::instance()->toString(v->asDouble(), 'g', precision);
return scope.engine->newString(result)->asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4profiling.cpp b/src/qml/jsruntime/qv4profiling.cpp
index 349ec48e06..8862cbef8e 100644
--- a/src/qml/jsruntime/qv4profiling.cpp
+++ b/src/qml/jsruntime/qv4profiling.cpp
@@ -96,7 +96,7 @@ void Profiler::reportData(bool trackLocations)
FunctionLocationHash locations;
properties.reserve(m_data.size());
- foreach (const FunctionCall &call, m_data) {
+ for (const FunctionCall &call : qAsConst(m_data)) {
properties.append(call.properties());
Function *function = call.function();
SentMarker &marker = m_sentLocations[reinterpret_cast<quintptr>(function)];
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index d66b5364be..295b3413da 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -1313,9 +1313,8 @@ static QV4::ReturnedValue CallPrecise(const QQmlObjectOrGadget &object, const QQ
int returnType = object.methodReturnType(data, &unknownTypeError);
if (returnType == QMetaType::UnknownType) {
- QString typeName = QString::fromLatin1(unknownTypeError);
- QString error = QStringLiteral("Unknown method return type: %1").arg(typeName);
- return engine->throwError(error);
+ return engine->throwError(QLatin1String("Unknown method return type: ")
+ + QLatin1String(unknownTypeError));
}
if (data.hasArguments()) {
@@ -1330,9 +1329,8 @@ static QV4::ReturnedValue CallPrecise(const QQmlObjectOrGadget &object, const QQ
args = object.methodParameterTypes(data.coreIndex(), &storage, &unknownTypeError);
if (!args) {
- QString typeName = QString::fromLatin1(unknownTypeError);
- QString error = QStringLiteral("Unknown method parameter type: %1").arg(typeName);
- return engine->throwError(error);
+ return engine->throwError(QLatin1String("Unknown method parameter type: ")
+ + QLatin1String(unknownTypeError));
}
if (args[0] > callArgs->argc) {
@@ -1921,8 +1919,8 @@ ReturnedValue QMetaObjectWrapper::constructInternal(CallData * callData) const {
ExecutionEngine *v4 = engine();
const QMetaObject* mo = d()->metaObject;
if (d()->constructorCount == 0) {
- return v4->throwTypeError(QStringLiteral("%1 has no invokable constructor")
- .arg(QLatin1String(mo->className())));
+ return v4->throwTypeError(QLatin1String(mo->className())
+ + QLatin1String(" has no invokable constructor"));
}
Scope scope(v4);
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 0a71f0000a..fffa6b8009 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -176,7 +176,7 @@ struct RuntimeCounters::Data {
}
std::sort(lines.begin(), lines.end(), Line::less);
outs << lines.size() << " counters:" << endl;
- foreach (const Line &line, lines)
+ for (const Line &line : qAsConst(lines))
outs << qSetFieldWidth(10) << line.count << qSetFieldWidth(0)
<< " | " << line.func
<< " | " << pretty(line.tag1)
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index 787047806a..552171256f 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -158,7 +158,8 @@ void Script::parse()
const bool parsed = parser.parseProgram();
- foreach (const QQmlJS::DiagnosticMessage &m, parser.diagnosticMessages()) {
+ const auto diagnosticMessages = parser.diagnosticMessages();
+ for (const QQmlJS::DiagnosticMessage &m : diagnosticMessages) {
if (m.isError()) {
valueScope.engine->throwSyntaxError(m.message, sourceFile, m.loc.startLine, m.loc.startColumn);
return;
@@ -260,7 +261,8 @@ QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile(IR::Module
QList<QQmlError> errors;
- foreach (const QQmlJS::DiagnosticMessage &m, parser.diagnosticMessages()) {
+ const auto diagnosticMessages = parser.diagnosticMessages();
+ for (const QQmlJS::DiagnosticMessage &m : diagnosticMessages) {
if (m.isWarning()) {
qWarning("%s:%d : %s", qPrintable(url.toString()), m.loc.startLine, qPrintable(m.message));
continue;
diff --git a/src/qml/jsruntime/qv4util_p.h b/src/qml/jsruntime/qv4util_p.h
index 59c12c5e46..2669a3e4bf 100644
--- a/src/qml/jsruntime/qv4util_p.h
+++ b/src/qml/jsruntime/qv4util_p.h
@@ -90,6 +90,9 @@ public:
: bits(size, value)
{}
+ void clear()
+ { bits = std::vector<bool>(bits.size(), false); }
+
void reserve(int size)
{ bits.reserve(size); }
@@ -153,6 +156,9 @@ public:
: bits(size, value)
{}
+ void clear()
+ { bits = QBitArray(bits.size(), false); }
+
void reserve(int size)
{ Q_UNUSED(size); }
diff --git a/src/qml/jsruntime/qv4variantobject.cpp b/src/qml/jsruntime/qv4variantobject.cpp
index b26dd27913..455a7ccb65 100644
--- a/src/qml/jsruntime/qv4variantobject.cpp
+++ b/src/qml/jsruntime/qv4variantobject.cpp
@@ -141,8 +141,11 @@ QV4::ReturnedValue VariantPrototype::method_toString(CallContext *ctx)
if (!o)
return Encode::undefined();
QString result = o->d()->data().toString();
- if (result.isEmpty() && !o->d()->data().canConvert(QVariant::String))
- result = QStringLiteral("QVariant(%0)").arg(QString::fromLatin1(o->d()->data().typeName()));
+ if (result.isEmpty() && !o->d()->data().canConvert(QVariant::String)) {
+ result = QLatin1String("QVariant(")
+ + QLatin1String(o->d()->data().typeName())
+ + QLatin1Char(')');
+ }
return Encode(ctx->d()->engine->newString(result));
}
diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h
index 2ca4e883d6..846ea42571 100644
--- a/src/qml/parser/qqmljsast_p.h
+++ b/src/qml/parser/qqmljsast_p.h
@@ -273,12 +273,12 @@ public:
: expression(expression)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return lparenToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return rparenToken; }
// attributes
@@ -294,12 +294,12 @@ public:
ThisExpression() { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return thisToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return thisToken; }
// attributes
@@ -314,12 +314,12 @@ public:
IdentifierExpression(const QStringRef &n):
name (n) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return identifierToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return identifierToken; }
// attributes
@@ -334,12 +334,12 @@ public:
NullExpression() { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return nullToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return nullToken; }
// attributes
@@ -353,12 +353,12 @@ public:
TrueLiteral() { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return trueToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return trueToken; }
// attributes
@@ -372,12 +372,12 @@ public:
FalseLiteral() { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return falseToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return falseToken; }
// attributes
@@ -392,12 +392,12 @@ public:
NumericLiteral(double v):
value(v) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return literalToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return literalToken; }
// attributes:
@@ -413,12 +413,12 @@ public:
StringLiteral(const QStringRef &v):
value (v) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return literalToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return literalToken; }
// attributes:
@@ -434,12 +434,12 @@ public:
RegExpLiteral(const QStringRef &p, int f):
pattern (p), flags (f) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return literalToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return literalToken; }
// attributes:
@@ -465,12 +465,12 @@ public:
elements (elts), elision (e)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return lbracketToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return rbracketToken; }
// attributes
@@ -492,12 +492,12 @@ public:
ObjectLiteral(PropertyAssignmentList *plist):
properties (plist) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return lbraceToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return rbraceToken; }
// attributes
@@ -521,12 +521,12 @@ public:
previous->next = this;
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return commaToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return next ? next->lastSourceLocation() : commaToken; }
inline Elision *finish ()
@@ -565,16 +565,16 @@ public:
return front;
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{
if (elision)
return elision->firstSourceLocation();
return expression->firstSourceLocation();
}
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{
if (next)
return next->lastSourceLocation();
@@ -595,10 +595,10 @@ public:
PropertyName() { kind = K; }
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return propertyNameToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return propertyNameToken; }
virtual QString asString() const = 0;
@@ -642,12 +642,12 @@ public:
return front;
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return assignment->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return next ? next->lastSourceLocation() : assignment->lastSourceLocation(); }
// attributes
@@ -665,12 +665,12 @@ public:
: PropertyAssignment(n), value(v)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return name->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return value->lastSourceLocation(); }
// attributes
@@ -697,12 +697,12 @@ public:
: PropertyAssignment(n), type(Setter), formals(f), functionBody (b)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return getSetToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return rbraceToken; }
// attributes
@@ -724,9 +724,9 @@ public:
IdentifierPropertyName(const QStringRef &n):
id (n) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual QString asString() const { return id.toString(); }
+ QString asString() const override { return id.toString(); }
// attributes
QStringRef id;
@@ -740,9 +740,9 @@ public:
StringLiteralPropertyName(const QStringRef &n):
id (n) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual QString asString() const { return id.toString(); }
+ QString asString() const override { return id.toString(); }
// attributes
QStringRef id;
@@ -756,9 +756,9 @@ public:
NumericLiteralPropertyName(double n):
id (n) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual QString asString() const { return QString::number(id, 'g', 16); }
+ QString asString() const override { return QString::number(id, 'g', 16); }
// attributes
double id;
@@ -773,12 +773,12 @@ public:
base (b), expression (e)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return base->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return rbracketToken; }
// attributes
@@ -797,12 +797,12 @@ public:
base (b), name (n)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return base->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return identifierToken; }
// attributes
@@ -821,12 +821,12 @@ public:
base (b), arguments (a)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return newToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return rparenToken; }
// attributes
@@ -845,12 +845,12 @@ public:
NewExpression(ExpressionNode *e):
expression (e) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return newToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return expression->lastSourceLocation(); }
// attributes
@@ -867,12 +867,12 @@ public:
base (b), arguments (a)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return base->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return rparenToken; }
// attributes
@@ -899,12 +899,12 @@ public:
previous->next = this;
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return expression->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{
if (next)
return next->lastSourceLocation();
@@ -932,12 +932,12 @@ public:
PostIncrementExpression(ExpressionNode *b):
base (b) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return base->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return incrementToken; }
// attributes
@@ -953,12 +953,12 @@ public:
PostDecrementExpression(ExpressionNode *b):
base (b) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return base->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return decrementToken; }
// attributes
@@ -974,12 +974,12 @@ public:
DeleteExpression(ExpressionNode *e):
expression (e) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return deleteToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return expression->lastSourceLocation(); }
// attributes
@@ -995,12 +995,12 @@ public:
VoidExpression(ExpressionNode *e):
expression (e) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return voidToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return expression->lastSourceLocation(); }
// attributes
@@ -1016,12 +1016,12 @@ public:
TypeOfExpression(ExpressionNode *e):
expression (e) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return typeofToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return expression->lastSourceLocation(); }
// attributes
@@ -1037,12 +1037,12 @@ public:
PreIncrementExpression(ExpressionNode *e):
expression (e) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return incrementToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return expression->lastSourceLocation(); }
// attributes
@@ -1058,12 +1058,12 @@ public:
PreDecrementExpression(ExpressionNode *e):
expression (e) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return decrementToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return expression->lastSourceLocation(); }
// attributes
@@ -1079,12 +1079,12 @@ public:
UnaryPlusExpression(ExpressionNode *e):
expression (e) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return plusToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return expression->lastSourceLocation(); }
// attributes
@@ -1100,12 +1100,12 @@ public:
UnaryMinusExpression(ExpressionNode *e):
expression (e) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return minusToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return expression->lastSourceLocation(); }
// attributes
@@ -1121,12 +1121,12 @@ public:
TildeExpression(ExpressionNode *e):
expression (e) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return tildeToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return expression->lastSourceLocation(); }
// attributes
@@ -1142,12 +1142,12 @@ public:
NotExpression(ExpressionNode *e):
expression (e) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return notToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return expression->lastSourceLocation(); }
// attributes
@@ -1164,14 +1164,14 @@ public:
left (l), op (o), right (r)
{ kind = K; }
- virtual BinaryExpression *binaryExpressionCast();
+ BinaryExpression *binaryExpressionCast() override;
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return left->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return right->lastSourceLocation(); }
// attributes
@@ -1190,12 +1190,12 @@ public:
expression (e), ok (t), ko (f)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return expression->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return ko->lastSourceLocation(); }
// attributes
@@ -1214,12 +1214,12 @@ public:
Expression(ExpressionNode *l, ExpressionNode *r):
left (l), right (r) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return left->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return right->lastSourceLocation(); }
// attributes
@@ -1236,12 +1236,12 @@ public:
Block(StatementList *slist):
statements (slist) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return lbraceToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return rbraceToken; }
// attributes
@@ -1267,12 +1267,12 @@ public:
previous->next = this;
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return statement->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return next ? next->lastSourceLocation() : statement->lastSourceLocation(); }
inline StatementList *finish ()
@@ -1296,12 +1296,12 @@ public:
declarations (vlist)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return declarationKindToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return semicolonToken; }
// attributes
@@ -1319,12 +1319,12 @@ public:
name (n), expression (e), readOnly(false)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return identifierToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return expression ? expression->lastSourceLocation() : identifierToken; }
// attributes
@@ -1351,12 +1351,12 @@ public:
previous->next = this;
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return declaration->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{
if (next)
return next->lastSourceLocation();
@@ -1388,12 +1388,12 @@ public:
EmptyStatement() { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return semicolonToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return semicolonToken; }
// attributes
@@ -1408,12 +1408,12 @@ public:
ExpressionStatement(ExpressionNode *e):
expression (e) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return expression->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return semicolonToken; }
// attributes
@@ -1430,12 +1430,12 @@ public:
expression (e), ok (t), ko (f)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return ifToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{
if (ko)
return ko->lastSourceLocation();
@@ -1462,12 +1462,12 @@ public:
statement (stmt), expression (e)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return doToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return semicolonToken; }
// attributes
@@ -1489,12 +1489,12 @@ public:
expression (e), statement (stmt)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return whileToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return statement->lastSourceLocation(); }
// attributes
@@ -1514,12 +1514,12 @@ public:
initialiser (i), condition (c), expression (e), statement (stmt)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return forToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return statement->lastSourceLocation(); }
// attributes
@@ -1543,12 +1543,12 @@ public:
declarations (vlist), condition (c), expression (e), statement (stmt)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return forToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return statement->lastSourceLocation(); }
// attributes
@@ -1573,12 +1573,12 @@ public:
initialiser (i), expression (e), statement (stmt)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return forToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return statement->lastSourceLocation(); }
// attributes
@@ -1600,12 +1600,12 @@ public:
declaration (v), expression (e), statement (stmt)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return forToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return statement->lastSourceLocation(); }
// attributes
@@ -1627,12 +1627,12 @@ public:
ContinueStatement(const QStringRef &l = QStringRef()):
label (l) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return continueToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return semicolonToken; }
// attributes
@@ -1650,12 +1650,12 @@ public:
BreakStatement(const QStringRef &l):
label (l) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return breakToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return semicolonToken; }
// attributes
@@ -1673,12 +1673,12 @@ public:
ReturnStatement(ExpressionNode *e):
expression (e) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return returnToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return semicolonToken; }
// attributes
@@ -1696,12 +1696,12 @@ public:
expression (e), statement (stmt)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return withToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return statement->lastSourceLocation(); }
// attributes
@@ -1721,12 +1721,12 @@ public:
clauses (c), defaultClause (d), moreClauses (r)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return lbraceToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return rbraceToken; }
// attributes
@@ -1746,12 +1746,12 @@ public:
expression (e), block (b)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return switchToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return block->rbraceToken; }
// attributes
@@ -1771,12 +1771,12 @@ public:
expression (e), statements (slist)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return caseToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return statements ? statements->lastSourceLocation() : colonToken; }
// attributes
@@ -1803,12 +1803,12 @@ public:
previous->next = this;
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return clause->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return next ? next->lastSourceLocation() : clause->lastSourceLocation(); }
inline CaseClauses *finish ()
@@ -1832,12 +1832,12 @@ public:
statements (slist)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return defaultToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return statements ? statements->lastSourceLocation() : colonToken; }
// attributes
@@ -1855,12 +1855,12 @@ public:
label (l), statement (stmt)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return identifierToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return statement->lastSourceLocation(); }
// attributes
@@ -1878,12 +1878,12 @@ public:
ThrowStatement(ExpressionNode *e):
expression (e) { kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return throwToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return semicolonToken; }
// attributes
@@ -1901,12 +1901,12 @@ public:
name (n), statement (stmt)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return catchToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return statement->lastSourceLocation(); }
// attributes
@@ -1927,12 +1927,12 @@ public:
statement (stmt)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return finallyToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return statement ? statement->lastSourceLocation() : finallyToken; }
// attributes
@@ -1957,12 +1957,12 @@ public:
statement (stmt), catchExpression (c), finallyExpression (0)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return tryToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{
if (finallyExpression)
return finallyExpression->statement->rbraceToken;
@@ -1988,12 +1988,12 @@ public:
name (n), formals (f), body (b)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return functionToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return rbraceToken; }
// attributes
@@ -2017,7 +2017,7 @@ public:
FunctionExpression(n, f, b)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
};
class QML_PARSER_EXPORT FormalParameterList: public Node
@@ -2037,12 +2037,12 @@ public:
previous->next = this;
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return identifierToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return next ? next->lastSourceLocation() : identifierToken; }
inline FormalParameterList *finish ()
@@ -2085,12 +2085,12 @@ public:
previous->next = this;
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return element->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return next ? next->lastSourceLocation() : element->lastSourceLocation(); }
inline SourceElements *finish ()
@@ -2114,12 +2114,12 @@ public:
elements (elts)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return elements ? elements->firstSourceLocation() : SourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return elements ? elements->lastSourceLocation() : SourceLocation(); }
// attributes
@@ -2135,12 +2135,12 @@ public:
elements (elts)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return elements ? elements->firstSourceLocation() : SourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return elements ? elements->lastSourceLocation() : SourceLocation(); }
// attributes
@@ -2156,12 +2156,12 @@ public:
declaration (f)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return declaration->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return declaration->lastSourceLocation(); }
// attributes
@@ -2177,12 +2177,12 @@ public:
statement (stmt)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return statement->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return statement->lastSourceLocation(); }
// attributes
@@ -2197,12 +2197,12 @@ public:
DebuggerStatement()
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return debuggerToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return semicolonToken; }
// attributes
@@ -2234,12 +2234,12 @@ public:
return head;
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return identifierToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return next ? next->lastSourceLocation() : identifierToken; }
// attributes
@@ -2261,12 +2261,12 @@ public:
: importUri(uri)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return importToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return semicolonToken; }
// attributes
@@ -2284,10 +2284,10 @@ public:
class QML_PARSER_EXPORT UiObjectMember: public Node
{
public:
- virtual SourceLocation firstSourceLocation() const = 0;
- virtual SourceLocation lastSourceLocation() const = 0;
+ SourceLocation firstSourceLocation() const override = 0;
+ SourceLocation lastSourceLocation() const override = 0;
- virtual UiObjectMember *uiObjectMemberCast();
+ UiObjectMember *uiObjectMemberCast() override;
};
class QML_PARSER_EXPORT UiObjectMemberList: public Node
@@ -2307,12 +2307,12 @@ public:
previous->next = this;
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return member->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return next ? next->lastSourceLocation() : member->lastSourceLocation(); }
UiObjectMemberList *finish()
@@ -2351,12 +2351,12 @@ public:
return head;
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return identifierToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return next ? next->lastSourceLocation() : identifierToken; }
// attributes
@@ -2374,12 +2374,12 @@ public:
: pragmaType(type)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return pragmaToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return semicolonToken; }
// attributes
@@ -2424,12 +2424,12 @@ public:
return head;
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return headerItem->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return next ? next->lastSourceLocation() : headerItem->lastSourceLocation(); }
// attributes
@@ -2446,9 +2446,9 @@ public:
: headers(headers), members(members)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{
if (headers)
return headers->firstSourceLocation();
@@ -2457,7 +2457,7 @@ public:
return SourceLocation();
}
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{
if (members)
return members->lastSourceLocation();
@@ -2488,12 +2488,12 @@ public:
previous->next = this;
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return member->firstSourceLocation(); }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return next ? next->lastSourceLocation() : member->lastSourceLocation(); }
UiArrayMemberList *finish()
@@ -2518,12 +2518,12 @@ public:
: members(members)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return lbraceToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return rbraceToken; }
// attributes
@@ -2549,12 +2549,12 @@ public:
previous->next = this;
}
- virtual void accept0(Visitor *);
+ void accept0(Visitor *) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return propertyTypeToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return next ? next->lastSourceLocation() : identifierToken; }
inline UiParameterList *finish ()
@@ -2589,9 +2589,9 @@ public:
: type(Property), memberType(memberType), name(name), statement(statement), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{
if (defaultToken.isValid())
return defaultToken;
@@ -2601,7 +2601,7 @@ public:
return propertyToken;
}
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{
if (binding)
return binding->lastSourceLocation();
@@ -2641,12 +2641,12 @@ public:
: qualifiedTypeNameId(qualifiedTypeNameId), initializer(initializer)
{ kind = K; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return qualifiedTypeNameId->identifierToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return initializer->rbraceToken; }
// attributes
@@ -2663,7 +2663,7 @@ public:
: sourceElement(sourceElement)
{ kind = K; }
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{
if (FunctionDeclaration *funDecl = cast<FunctionDeclaration *>(sourceElement))
return funDecl->firstSourceLocation();
@@ -2673,7 +2673,7 @@ public:
return SourceLocation();
}
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{
if (FunctionDeclaration *funDecl = cast<FunctionDeclaration *>(sourceElement))
return funDecl->lastSourceLocation();
@@ -2683,7 +2683,7 @@ public:
return SourceLocation();
}
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
// attributes
@@ -2704,7 +2704,7 @@ public:
hasOnToken(false)
{ kind = K; }
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{
if (hasOnToken && qualifiedTypeNameId)
return qualifiedTypeNameId->identifierToken;
@@ -2712,10 +2712,10 @@ public:
return qualifiedId->identifierToken;
}
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return initializer->rbraceToken; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
// attributes
@@ -2737,13 +2737,13 @@ public:
statement(statement)
{ kind = K; }
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return qualifiedId->identifierToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return statement->lastSourceLocation(); }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
// attributes
UiQualifiedId *qualifiedId;
@@ -2762,13 +2762,13 @@ public:
members(members)
{ kind = K; }
- virtual SourceLocation firstSourceLocation() const
+ SourceLocation firstSourceLocation() const override
{ return qualifiedId->identifierToken; }
- virtual SourceLocation lastSourceLocation() const
+ SourceLocation lastSourceLocation() const override
{ return rbracketToken; }
- virtual void accept0(Visitor *visitor);
+ void accept0(Visitor *visitor) override;
// attributes
UiQualifiedId *qualifiedId;
diff --git a/src/qml/qml/ftw/qqmlthread.cpp b/src/qml/qml/ftw/qqmlthread.cpp
index 1523817c9e..ffa6e29290 100644
--- a/src/qml/qml/ftw/qqmlthread.cpp
+++ b/src/qml/qml/ftw/qqmlthread.cpp
@@ -55,7 +55,7 @@ public:
QQmlThreadPrivate(QQmlThread *);
QQmlThread *q;
- virtual void run();
+ void run() override;
inline void lock() { _mutex.lock(); }
inline void unlock() { _mutex.unlock(); }
@@ -81,12 +81,12 @@ public:
void threadEvent();
protected:
- virtual bool event(QEvent *);
+ bool event(QEvent *) override;
private:
struct MainObject : public QObject {
MainObject(QQmlThreadPrivate *p);
- virtual bool event(QEvent *e);
+ bool event(QEvent *e) override;
QQmlThreadPrivate *p;
};
MainObject m_mainObject;
diff --git a/src/qml/qml/ftw/qqmlthread_p.h b/src/qml/qml/ftw/qqmlthread_p.h
index 9f180b1f14..295235e255 100644
--- a/src/qml/qml/ftw/qqmlthread_p.h
+++ b/src/qml/qml/ftw/qqmlthread_p.h
@@ -142,7 +142,7 @@ void QQmlThread::callMethodInThread(void (O::*Member)())
struct I : public Message {
void (O::*Member)();
I(void (O::*Member)()) : Member(Member) {}
- virtual void call(QQmlThread *thread) {
+ void call(QQmlThread *thread) override {
O *me = static_cast<O *>(thread);
(me->*Member)();
}
@@ -157,7 +157,7 @@ void QQmlThread::callMethodInThread(void (O::*Member)(V), const T &arg)
void (O::*Member)(V);
T arg;
I(void (O::*Member)(V), const T &arg) : Member(Member), arg(arg) {}
- virtual void call(QQmlThread *thread) {
+ void call(QQmlThread *thread) override {
O *me = static_cast<O *>(thread);
(me->*Member)(arg);
}
@@ -173,7 +173,7 @@ void QQmlThread::callMethodInThread(void (O::*Member)(V, V2), const T &arg, cons
T arg;
T2 arg2;
I(void (O::*Member)(V, V2), const T &arg, const T2 &arg2) : Member(Member), arg(arg), arg2(arg2) {}
- virtual void call(QQmlThread *thread) {
+ void call(QQmlThread *thread) override {
O *me = static_cast<O *>(thread);
(me->*Member)(arg, arg2);
}
@@ -187,7 +187,7 @@ void QQmlThread::callMethodInMain(void (O::*Member)())
struct I : public Message {
void (O::*Member)();
I(void (O::*Member)()) : Member(Member) {}
- virtual void call(QQmlThread *thread) {
+ void call(QQmlThread *thread) override {
O *me = static_cast<O *>(thread);
(me->*Member)();
}
@@ -202,7 +202,7 @@ void QQmlThread::callMethodInMain(void (O::*Member)(V), const T &arg)
void (O::*Member)(V);
T arg;
I(void (O::*Member)(V), const T &arg) : Member(Member), arg(arg) {}
- virtual void call(QQmlThread *thread) {
+ void call(QQmlThread *thread) override {
O *me = static_cast<O *>(thread);
(me->*Member)(arg);
}
@@ -218,7 +218,7 @@ void QQmlThread::callMethodInMain(void (O::*Member)(V, V2), const T &arg, const
T arg;
T2 arg2;
I(void (O::*Member)(V, V2), const T &arg, const T2 &arg2) : Member(Member), arg(arg), arg2(arg2) {}
- virtual void call(QQmlThread *thread) {
+ void call(QQmlThread *thread) override {
O *me = static_cast<O *>(thread);
(me->*Member)(arg, arg2);
}
@@ -232,7 +232,7 @@ void QQmlThread::postMethodToThread(void (O::*Member)())
struct I : public Message {
void (O::*Member)();
I(void (O::*Member)()) : Member(Member) {}
- virtual void call(QQmlThread *thread) {
+ void call(QQmlThread *thread) override {
O *me = static_cast<O *>(thread);
(me->*Member)();
}
@@ -247,7 +247,7 @@ void QQmlThread::postMethodToThread(void (O::*Member)(V), const T &arg)
void (O::*Member)(V);
T arg;
I(void (O::*Member)(V), const T &arg) : Member(Member), arg(arg) {}
- virtual void call(QQmlThread *thread) {
+ void call(QQmlThread *thread) override {
O *me = static_cast<O *>(thread);
(me->*Member)(arg);
}
@@ -263,7 +263,7 @@ void QQmlThread::postMethodToThread(void (O::*Member)(V, V2), const T &arg, cons
T arg;
T2 arg2;
I(void (O::*Member)(V, V2), const T &arg, const T2 &arg2) : Member(Member), arg(arg), arg2(arg2) {}
- virtual void call(QQmlThread *thread) {
+ void call(QQmlThread *thread) override {
O *me = static_cast<O *>(thread);
(me->*Member)(arg, arg2);
}
@@ -277,7 +277,7 @@ void QQmlThread::postMethodToMain(void (O::*Member)())
struct I : public Message {
void (O::*Member)();
I(void (O::*Member)()) : Member(Member) {}
- virtual void call(QQmlThread *thread) {
+ void call(QQmlThread *thread) override {
O *me = static_cast<O *>(thread);
(me->*Member)();
}
@@ -292,7 +292,7 @@ void QQmlThread::postMethodToMain(void (O::*Member)(V), const T &arg)
void (O::*Member)(V);
T arg;
I(void (O::*Member)(V), const T &arg) : Member(Member), arg(arg) {}
- virtual void call(QQmlThread *thread) {
+ void call(QQmlThread *thread) override {
O *me = static_cast<O *>(thread);
(me->*Member)(arg);
}
@@ -308,7 +308,7 @@ void QQmlThread::postMethodToMain(void (O::*Member)(V, V2), const T &arg, const
T arg;
T2 arg2;
I(void (O::*Member)(V, V2), const T &arg, const T2 &arg2) : Member(Member), arg(arg), arg2(arg2) {}
- virtual void call(QQmlThread *thread) {
+ void call(QQmlThread *thread) override {
O *me = static_cast<O *>(thread);
(me->*Member)(arg, arg2);
}
diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp
index fef2da753b..1a912d53e6 100644
--- a/src/qml/qml/qqmlapplicationengine.cpp
+++ b/src/qml/qml/qqmlapplicationengine.cpp
@@ -287,14 +287,27 @@ void QQmlApplicationEngine::loadData(const QByteArray &data, const QUrl &url)
Returns a list of all the root objects instantiated by the
QQmlApplicationEngine. This will only contain objects loaded via load() or a
convenience constructor.
+
+ \note In Qt versions prior to 5.9, this function is marked as non-\c{const}.
*/
-QList<QObject *> QQmlApplicationEngine::rootObjects()
+QList<QObject *> QQmlApplicationEngine::rootObjects() const
{
- Q_D(QQmlApplicationEngine);
+ Q_D(const QQmlApplicationEngine);
return d->objects;
}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+/*!
+ \overload
+ \internal
+*/
+QList<QObject *> QQmlApplicationEngine::rootObjects()
+{
+ return qAsConst(*this).rootObjects();
+}
+#endif // < Qt 6
+
QT_END_NAMESPACE
#include "moc_qqmlapplicationengine.cpp"
diff --git a/src/qml/qml/qqmlapplicationengine.h b/src/qml/qml/qqmlapplicationengine.h
index ff7dce5f8b..e64d7495cd 100644
--- a/src/qml/qml/qqmlapplicationengine.h
+++ b/src/qml/qml/qqmlapplicationengine.h
@@ -58,7 +58,11 @@ public:
QQmlApplicationEngine(const QString &filePath, QObject *parent = Q_NULLPTR);
~QQmlApplicationEngine();
- QList<QObject*> rootObjects();
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ QList<QObject*> rootObjects(); // ### Qt 6: remove
+#endif
+ QList<QObject*> rootObjects() const;
+
public Q_SLOTS:
void load(const QUrl &url);
void load(const QString &filePath);
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 203bfec838..4fe76ddf29 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -449,7 +449,7 @@ QVariant QQmlBinding::evaluate()
return scope.engine->toVariant(scope.result, qMetaTypeId<QList<QObject*> >());
}
-QString QQmlBinding::expressionIdentifier()
+QString QQmlBinding::expressionIdentifier() const
{
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(context()->engine);
QV4::Scope scope(ep->v4engine());
diff --git a/src/qml/qml/qqmlbinding_p.h b/src/qml/qml/qqmlbinding_p.h
index 6d42a8ea8a..be23a96d01 100644
--- a/src/qml/qml/qqmlbinding_p.h
+++ b/src/qml/qml/qqmlbinding_p.h
@@ -98,8 +98,8 @@ public:
QVariant evaluate();
- QString expressionIdentifier() Q_DECL_OVERRIDE;
- void expressionChanged() Q_DECL_OVERRIDE;
+ QString expressionIdentifier() const override;
+ void expressionChanged() override;
protected:
virtual void doUpdate(const DeleteWatcher &watcher,
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index 4e63790290..dfb1b98ca0 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -146,7 +146,7 @@ QQmlBoundSignalExpression::~QQmlBoundSignalExpression()
{
}
-QString QQmlBoundSignalExpression::expressionIdentifier()
+QString QQmlBoundSignalExpression::expressionIdentifier() const
{
QQmlSourceLocation loc = sourceLocation();
return loc.sourceFile + QLatin1Char(':') + QString::number(loc.line);
diff --git a/src/qml/qml/qqmlboundsignal_p.h b/src/qml/qml/qqmlboundsignal_p.h
index 10c59b07c1..4356c6cbfa 100644
--- a/src/qml/qml/qqmlboundsignal_p.h
+++ b/src/qml/qml/qqmlboundsignal_p.h
@@ -79,8 +79,8 @@ public:
QQmlContextData *ctxt, QObject *scope, QV4::Function *runtimeFunction);
// inherited from QQmlJavaScriptExpression.
- virtual QString expressionIdentifier();
- virtual void expressionChanged();
+ QString expressionIdentifier() const override;
+ void expressionChanged() override;
// evaluation of a bound signal expression doesn't return any value
void evaluate(void **a);
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 8be5172cd4..6ebcd142fb 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -376,7 +376,7 @@ QQmlComponent::~QQmlComponent()
if (isError()) {
qWarning() << "This may have been caused by one of the following errors:";
- foreach (const QQmlError &error, d->state.errors)
+ for (const QQmlError &error : qAsConst(d->state.errors))
qWarning().nospace().noquote() << QLatin1String(" ") << error;
}
@@ -709,7 +709,7 @@ QString QQmlComponent::errorString() const
QString ret;
if(!isError())
return ret;
- foreach(const QQmlError &e, d->state.errors) {
+ for (const QQmlError &e : d->state.errors) {
ret += e.url().toString() + QLatin1Char(':') +
QString::number(e.line()) + QLatin1Char(' ') +
e.description() + QLatin1Char('\n');
@@ -1098,13 +1098,13 @@ public:
, incubatorObject(inc)
{}
- virtual void statusChanged(Status s) {
+ void statusChanged(Status s) override {
QV4::Scope scope(incubatorObject->internalClass->engine);
QV4::Scoped<QV4::QmlIncubatorObject> i(scope, incubatorObject);
i->statusChanged(s);
}
- virtual void setInitialState(QObject *o) {
+ void setInitialState(QObject *o) override {
QV4::Scope scope(incubatorObject->internalClass->engine);
QV4::Scoped<QV4::QmlIncubatorObject> i(scope, incubatorObject);
i->setInitialState(o);
diff --git a/src/qml/qml/qqmlcomponent_p.h b/src/qml/qml/qqmlcomponent_p.h
index 3a84e724da..d01a987acc 100644
--- a/src/qml/qml/qqmlcomponent_p.h
+++ b/src/qml/qml/qqmlcomponent_p.h
@@ -89,8 +89,8 @@ public:
static void setInitialProperties(QV4::ExecutionEngine *engine, QV4::QmlContext *qmlContext, const QV4::Value &o, const QV4::Value &v);
QQmlTypeData *typeData;
- virtual void typeDataReady(QQmlTypeData *);
- virtual void typeDataProgress(QQmlTypeData *, qreal);
+ void typeDataReady(QQmlTypeData *) override;
+ void typeDataProgress(QQmlTypeData *, qreal) override;
void fromTypeData(QQmlTypeData *data);
diff --git a/src/qml/qml/qqmlcontext_p.h b/src/qml/qml/qqmlcontext_p.h
index 62cd3d4877..162fbcc8f6 100644
--- a/src/qml/qml/qqmlcontext_p.h
+++ b/src/qml/qml/qqmlcontext_p.h
@@ -235,7 +235,7 @@ public:
inline QQmlGuardedContextData(QQmlContextData *);
inline ~QQmlGuardedContextData();
- inline QQmlContextData *contextData();
+ inline QQmlContextData *contextData() const;
inline void setContextData(QQmlContextData *);
inline bool isNull() const { return !m_contextData; }
@@ -285,7 +285,7 @@ void QQmlGuardedContextData::setContextData(QQmlContextData *contextData)
}
}
-QQmlContextData *QQmlGuardedContextData::contextData()
+QQmlContextData *QQmlGuardedContextData::contextData() const
{
return m_contextData;
}
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index c10aa0129c..c273330a0a 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -554,6 +554,18 @@ The following functions are also on the Qt object.
\li This read-only property can be used to determine whether or not the
platform supports multiple windows. Some embedded platforms do not support
multiple windows, for example.
+
+ \row
+ \li \c application.screens
+ \li An array containing the descriptions of all connected screens. The
+ elements of the array are objects with the same properties as the
+ \l{Screen} attached object. In practice the array corresponds to the screen
+ list returned by QGuiApplication::screens(). In addition to examining
+ properties like name, width, height, etc., the array elements can also be
+ assigned to the targetScreen property of Window items, thus serving as an
+ alternative to the C++ side's QWindow::setScreen(). This property has been
+ added in Qt 5.9.
+
\endtable
The object also has one signal, aboutToQuit(), which is the same as \l QCoreApplication::aboutToQuit().
@@ -570,6 +582,8 @@ The following functions are also on the Qt object.
\li application.layoutDirection
\li application.font
\endlist
+
+ \sa Screen, Window, Window.targetScreen
*/
/*!
@@ -1006,8 +1020,8 @@ QQmlEngine::~QQmlEngine()
// we do this here and not in the private dtor since otherwise a crash can
// occur (if we are the QObject parent of the QObject singleton instance)
// XXX TODO: performance -- store list of singleton types separately?
- QList<QQmlType*> singletonTypes = QQmlMetaType::qmlSingletonTypes();
- foreach (QQmlType *currType, singletonTypes)
+ const QList<QQmlType*> singletonTypes = QQmlMetaType::qmlSingletonTypes();
+ for (QQmlType *currType : singletonTypes)
currType->singletonInstanceInfo()->destroy(this);
delete d->rootContext;
diff --git a/src/qml/qml/qqmlengine.h b/src/qml/qml/qqmlengine.h
index 2c0c39d0b4..3102a20fac 100644
--- a/src/qml/qml/qqmlengine.h
+++ b/src/qml/qml/qqmlengine.h
@@ -151,7 +151,7 @@ public:
static ObjectOwnership objectOwnership(QObject *);
protected:
QQmlEngine(QQmlEnginePrivate &dd, QObject *p);
- virtual bool event(QEvent *);
+ bool event(QEvent *) override;
Q_SIGNALS:
void quit();
diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp
index 6afbd05e3e..01d4722ca6 100644
--- a/src/qml/qml/qqmlexpression.cpp
+++ b/src/qml/qml/qqmlexpression.cpp
@@ -434,7 +434,7 @@ void QQmlExpressionPrivate::expressionChanged()
emit q->valueChanged();
}
-QString QQmlExpressionPrivate::expressionIdentifier()
+QString QQmlExpressionPrivate::expressionIdentifier() const
{
return QLatin1Char('"') + expression + QLatin1Char('"');
}
diff --git a/src/qml/qml/qqmlexpression_p.h b/src/qml/qml/qqmlexpression_p.h
index 809a57b169..44342a957b 100644
--- a/src/qml/qml/qqmlexpression_p.h
+++ b/src/qml/qml/qqmlexpression_p.h
@@ -85,8 +85,8 @@ public:
bool expressionFunctionValid:1;
// Inherited from QQmlJavaScriptExpression
- virtual QString expressionIdentifier();
- virtual void expressionChanged();
+ QString expressionIdentifier() const override;
+ void expressionChanged() override;
QString expression;
diff --git a/src/qml/qml/qqmlextensionplugin.h b/src/qml/qml/qqmlextensionplugin.h
index de482d0352..934cf0f51a 100644
--- a/src/qml/qml/qqmlextensionplugin.h
+++ b/src/qml/qml/qqmlextensionplugin.h
@@ -64,7 +64,7 @@ public:
QUrl baseUrl() const;
virtual void registerTypes(const char *uri) = 0;
- virtual void initializeEngine(QQmlEngine *engine, const char *uri);
+ void initializeEngine(QQmlEngine *engine, const char *uri) override;
private:
Q_DISABLE_COPY(QQmlExtensionPlugin)
diff --git a/src/qml/qml/qqmlfileselector_p.h b/src/qml/qml/qqmlfileselector_p.h
index 57ef194c10..a7360f83d9 100644
--- a/src/qml/qml/qqmlfileselector_p.h
+++ b/src/qml/qml/qqmlfileselector_p.h
@@ -80,7 +80,7 @@ public:
QQmlFileSelectorInterceptor(QQmlFileSelectorPrivate* pd);
QQmlFileSelectorPrivate* d;
protected:
- virtual QUrl intercept(const QUrl &path, DataType type);
+ QUrl intercept(const QUrl &path, DataType type) override;
};
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 98e2f9eefd..4c5179dc75 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -229,7 +229,7 @@ public:
};
QList<Import *> imports;
- Import *findImport(const QString &uri);
+ Import *findImport(const QString &uri) const;
bool resolveType(QQmlTypeLoader *typeLoader, const QHashedStringRef& type,
int *vmajor, int *vminor, QQmlType** type_return,
@@ -453,7 +453,7 @@ QList<QQmlImports::ScriptReference> QQmlImports::resolvedScripts() const
for (int ii = set.imports.count() - 1; ii >= 0; --ii) {
const QQmlImportNamespace::Import *import = set.imports.at(ii);
- foreach (const QQmlDirParser::Script &script, import->qmlDirScripts) {
+ for (const QQmlDirParser::Script &script : import->qmlDirScripts) {
ScriptReference ref;
ref.nameSpace = script.nameSpace;
ref.location = QUrl(import->url).resolved(QUrl(script.fileName));
@@ -467,7 +467,7 @@ QList<QQmlImports::ScriptReference> QQmlImports::resolvedScripts() const
for (int ii = set.imports.count() - 1; ii >= 0; --ii) {
const QQmlImportNamespace::Import *import = set.imports.at(ii);
- foreach (const QQmlDirParser::Script &script, import->qmlDirScripts) {
+ for (const QQmlDirParser::Script &script : import->qmlDirScripts) {
ScriptReference ref;
ref.nameSpace = script.nameSpace;
ref.qualifier = set.prefix;
@@ -784,14 +784,13 @@ bool QQmlImportsPrivate::resolveType(const QHashedStringRef& type, int *vmajor,
return false;
}
-QQmlImportNamespace::Import *QQmlImportNamespace::findImport(const QString &uri)
+QQmlImportNamespace::Import *QQmlImportNamespace::findImport(const QString &uri) const
{
- for (QList<Import *>::iterator it = imports.begin(), end = imports.end(); it != end; ++it) {
- if ((*it)->uri == uri)
- return *it;
+ for (Import *import : imports) {
+ if (import->uri == uri)
+ return import;
}
-
- return 0;
+ return nullptr;
}
bool QQmlImportNamespace::resolveType(QQmlTypeLoader *typeLoader, const QHashedStringRef &type,
@@ -898,6 +897,21 @@ static QStringList versionUriList(const QString &uri, int vmaj, int vmin)
}
#ifndef QT_NO_LIBRARY
+static QVector<QStaticPlugin> makePlugins()
+{
+ QVector<QStaticPlugin> plugins;
+ // To avoid traversing all static plugins for all imports, we cut down
+ // the list the first time called to only contain QML plugins:
+ const auto staticPlugins = QPluginLoader::staticPlugins();
+ for (const QStaticPlugin &plugin : staticPlugins) {
+ if (plugin.metaData().value(QLatin1String("IID")).toString()
+ == QLatin1String(QQmlExtensionInterface_iid)) {
+ plugins.append(plugin);
+ }
+ }
+ return plugins;
+}
+
/*!
Get all static plugins that are QML plugins and has a meta data URI that matches with one of
\a versionUris, which is a list of all possible versioned URI combinations - see versionUriList()
@@ -906,17 +920,8 @@ static QStringList versionUriList(const QString &uri, int vmaj, int vmin)
bool QQmlImportsPrivate::populatePluginPairVector(QVector<StaticPluginPair> &result, const QString &uri, const QStringList &versionUris,
const QString &qmldirPath, QList<QQmlError> *errors)
{
- static QVector<QStaticPlugin> plugins;
- if (plugins.isEmpty()) {
- // To avoid traversing all static plugins for all imports, we cut down
- // the list the first time called to only contain QML plugins:
- foreach (const QStaticPlugin &plugin, QPluginLoader::staticPlugins()) {
- if (plugin.metaData().value(QLatin1String("IID")).toString() == QLatin1String(QQmlExtensionInterface_iid))
- plugins.append(plugin);
- }
- }
-
- foreach (const QStaticPlugin &plugin, plugins) {
+ static const QVector<QStaticPlugin> plugins = makePlugins();
+ for (const QStaticPlugin &plugin : plugins) {
// Since a module can list more than one plugin, we keep iterating even after we found a match.
if (QQmlExtensionPlugin *instance = qobject_cast<QQmlExtensionPlugin *>(plugin.instance())) {
const QJsonArray metaTagsUriList = plugin.metaData().value(QLatin1String("uri")).toArray();
@@ -931,7 +936,7 @@ bool QQmlImportsPrivate::populatePluginPairVector(QVector<StaticPluginPair> &res
return false;
}
// A plugin can be set up to handle multiple URIs, so go through the list:
- foreach (const QJsonValue &metaTagUri, metaTagsUriList) {
+ for (const QJsonValue &metaTagUri : metaTagsUriList) {
if (versionUris.contains(metaTagUri.toString())) {
result.append(qMakePair(plugin, metaTagsUriList));
break;
@@ -998,7 +1003,8 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath,
int staticPluginsFound = 0;
#if defined(QT_SHARED)
- foreach (const QQmlDirParser::Plugin &plugin, qmldir->plugins()) {
+ const auto qmldirPlugins = qmldir->plugins();
+ for (const QQmlDirParser::Plugin &plugin : qmldirPlugins) {
QString resolvedFilePath = database->resolvePlugin(typeLoader, qmldirPath, plugin.path, plugin.name);
if (!resolvedFilePath.isEmpty()) {
dynamicPluginsFound++;
@@ -1032,8 +1038,8 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath,
const QString basePath = QFileInfo(qmldirPath).absoluteFilePath();
for (const QString &versionUri : versionUris) {
- foreach (const StaticPluginPair &pair, pluginPairs) {
- foreach (const QJsonValue &metaTagUri, pair.second) {
+ for (const StaticPluginPair &pair : qAsConst(pluginPairs)) {
+ for (const QJsonValue &metaTagUri : pair.second) {
if (versionUri == metaTagUri.toString()) {
staticPluginsFound++;
QObject *instance = pair.first.instance();
@@ -1130,7 +1136,7 @@ QString QQmlImportsPrivate::resolvedUri(const QString &dir_arg, QQmlImportDataba
std::sort(paths.begin(), paths.end(), I::greaterThan); // Ensure subdirs preceed their parents.
QString stableRelativePath = dir;
- foreach(const QString &path, paths) {
+ for (const QString &path : qAsConst(paths)) {
if (dir.startsWith(path)) {
stableRelativePath = dir.mid(path.length()+1);
break;
@@ -1671,8 +1677,7 @@ QString QQmlImportDatabase::resolvePlugin(QQmlTypeLoader *typeLoader,
if (!qmldirPluginPathIsRelative)
searchPaths.prepend(qmldirPluginPath);
- foreach (const QString &pluginPath, searchPaths) {
-
+ for (const QString &pluginPath : qAsConst(searchPaths)) {
QString resolvedPath;
if (pluginPath == QLatin1String(".")) {
if (qmldirPluginPathIsRelative && !qmldirPluginPath.isEmpty() && qmldirPluginPath != QLatin1String("."))
@@ -1694,7 +1699,7 @@ QString QQmlImportDatabase::resolvePlugin(QQmlTypeLoader *typeLoader,
resolvedPath += Slash;
resolvedPath += prefix + baseName;
- foreach (const QString &suffix, suffixes) {
+ for (const QString &suffix : suffixes) {
const QString absolutePath = typeLoader->absoluteFilePath(resolvedPath + suffix);
if (!absolutePath.isEmpty())
return absolutePath;
@@ -1836,7 +1841,7 @@ QStringList QQmlImportDatabase::importPathList(PathType type) const
return fileImportPath;
QStringList list;
- foreach (const QString &path, fileImportPath) {
+ for (const QString &path : fileImportPath) {
bool localPath = isPathAbsolute(path) || QQmlFile::isLocalFile(path);
if (localPath == (type == Local))
list.append(path);
@@ -1930,7 +1935,7 @@ bool QQmlImportDatabase::registerPluginTypes(QObject *instance, const QString &b
if (!registrationFailures.isEmpty()) {
if (errors) {
- foreach (const QString &failure, registrationFailures) {
+ for (const QString &failure : qAsConst(registrationFailures)) {
QQmlError error;
error.setDescription(failure);
errors->prepend(error);
diff --git a/src/qml/qml/qqmlincubator.cpp b/src/qml/qml/qqmlincubator.cpp
index 0ce769aaea..963638ca34 100644
--- a/src/qml/qml/qqmlincubator.cpp
+++ b/src/qml/qml/qqmlincubator.cpp
@@ -206,7 +206,7 @@ public:
}
protected:
- virtual void timerEvent(QTimerEvent *) {
+ void timerEvent(QTimerEvent *) override {
incubateFor(5);
}
};
diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h
index 5f9cffb56d..a0735d91de 100644
--- a/src/qml/qml/qqmljavascriptexpression_p.h
+++ b/src/qml/qml/qqmljavascriptexpression_p.h
@@ -100,7 +100,7 @@ public:
QQmlJavaScriptExpression();
virtual ~QQmlJavaScriptExpression();
- virtual QString expressionIdentifier() = 0;
+ virtual QString expressionIdentifier() const = 0;
virtual void expressionChanged() = 0;
void evaluate(QV4::CallData *callData, bool *isUndefined, QV4::Scope &scope);
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index ce0f4b798a..08acb330b1 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -1444,11 +1444,11 @@ bool qmlProtectModule(const char *uri, int majVersion)
bool QQmlMetaType::namespaceContainsRegistrations(const QString &uri, int majorVersion)
{
- QQmlMetaTypeData *data = metaTypeData();
+ const QQmlMetaTypeData *data = metaTypeData();
// Has any type previously been installed to this namespace?
QHashedString nameSpace(uri);
- foreach (const QQmlType *type, data->types)
+ for (const QQmlType *type : data->types)
if (type->module() == nameSpace && type->majorVersion() == majorVersion)
return true;
diff --git a/src/qml/qml/qqmlnotifier_p.h b/src/qml/qml/qqmlnotifier_p.h
index eff9684558..4db0dd038a 100644
--- a/src/qml/qml/qqmlnotifier_p.h
+++ b/src/qml/qml/qqmlnotifier_p.h
@@ -94,9 +94,9 @@ public:
inline QQmlNotifierEndpoint(Callback callback);
inline ~QQmlNotifierEndpoint();
- inline bool isConnected();
- inline bool isConnected(QObject *source, int sourceSignal);
- inline bool isConnected(QQmlNotifier *);
+ inline bool isConnected() const;
+ inline bool isConnected(QObject *source, int sourceSignal) const;
+ inline bool isConnected(QQmlNotifier *) const;
void connect(QObject *source, int sourceSignal, QQmlEngine *engine);
inline void connect(QQmlNotifier *);
@@ -162,7 +162,7 @@ QQmlNotifierEndpoint::~QQmlNotifierEndpoint()
disconnect();
}
-bool QQmlNotifierEndpoint::isConnected()
+bool QQmlNotifierEndpoint::isConnected() const
{
return prev != 0;
}
@@ -171,13 +171,13 @@ bool QQmlNotifierEndpoint::isConnected()
\a sourceSignal MUST be in the signal index range (see QObjectPrivate::signalIndex()).
This is different from QMetaMethod::methodIndex().
*/
-bool QQmlNotifierEndpoint::isConnected(QObject *source, int sourceSignal)
+bool QQmlNotifierEndpoint::isConnected(QObject *source, int sourceSignal) const
{
return this->sourceSignal != -1 && senderAsObject() == source &&
this->sourceSignal == sourceSignal;
}
-bool QQmlNotifierEndpoint::isConnected(QQmlNotifier *notifier)
+bool QQmlNotifierEndpoint::isConnected(QQmlNotifier *notifier) const
{
return sourceSignal == -1 && senderAsNotifier() == notifier;
}
diff --git a/src/qml/qml/qqmlopenmetaobject_p.h b/src/qml/qml/qqmlopenmetaobject_p.h
index f1562131fc..183baec941 100644
--- a/src/qml/qml/qqmlopenmetaobject_p.h
+++ b/src/qml/qml/qqmlopenmetaobject_p.h
@@ -122,8 +122,8 @@ public:
void emitPropertyNotification(const QByteArray &propertyName);
protected:
- virtual int metaCall(QObject *o, QMetaObject::Call _c, int _id, void **_a);
- virtual int createProperty(const char *, const char *);
+ int metaCall(QObject *o, QMetaObject::Call _c, int _id, void **_a) override;
+ int createProperty(const char *, const char *) override;
virtual void propertyRead(int);
virtual void propertyWrite(int);
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index f75ab9e25b..672b36ea75 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -193,7 +193,7 @@ void QQmlPropertyData::load(const QMetaMethod &m)
if (m.parameterCount()) {
_flags.hasArguments = true;
- if ((m.parameterCount() == 1) && (m.parameterTypes().first() == "QQmlV4Function*")) {
+ if ((m.parameterCount() == 1) && (m.parameterTypes().constFirst() == "QQmlV4Function*")) {
_flags.isV4Function = true;
}
}
@@ -228,7 +228,7 @@ void QQmlPropertyData::lazyLoad(const QMetaMethod &m)
const int paramCount = m.parameterCount();
if (paramCount) {
_flags.hasArguments = true;
- if ((paramCount == 1) && (m.parameterTypes().first() == "QQmlV4Function*")) {
+ if ((paramCount == 1) && (m.parameterTypes().constFirst() == "QQmlV4Function*")) {
_flags.isV4Function = true;
}
}
@@ -269,8 +269,8 @@ QQmlPropertyCache::~QQmlPropertyCache()
QQmlPropertyCacheMethodArguments *args = argumentsCache;
while (args) {
QQmlPropertyCacheMethodArguments *next = args->next;
- if (args->signalParameterStringForJS) delete args->signalParameterStringForJS;
- if (args->names) delete args->names;
+ delete args->signalParameterStringForJS;
+ delete args->names;
free(args);
args = next;
}
diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h
index 18ae32ebf9..b820777973 100644
--- a/src/qml/qml/qqmlpropertycache_p.h
+++ b/src/qml/qml/qqmlpropertycache_p.h
@@ -439,8 +439,8 @@ public:
QByteArray checksum(bool *ok);
protected:
- virtual void destroy();
- virtual void clear();
+ void destroy() override;
+ void clear() override;
private:
friend class QQmlEnginePrivate;
@@ -472,7 +472,7 @@ private:
void updateRecur(const QMetaObject *);
template<typename K>
- QQmlPropertyData *findNamedProperty(const K &key)
+ QQmlPropertyData *findNamedProperty(const K &key) const
{
StringCache::mapped_type *it = stringCache.value(key);
return it ? it->second : 0;
diff --git a/src/qml/qml/qqmlproxymetaobject_p.h b/src/qml/qml/qqmlproxymetaobject_p.h
index 7083f88fa7..2b7a980361 100644
--- a/src/qml/qml/qqmlproxymetaobject_p.h
+++ b/src/qml/qml/qqmlproxymetaobject_p.h
@@ -74,10 +74,10 @@ public:
};
QQmlProxyMetaObject(QObject *, QList<ProxyData> *);
- virtual ~QQmlProxyMetaObject();
+ ~QQmlProxyMetaObject();
protected:
- virtual int metaCall(QObject *o, QMetaObject::Call _c, int _id, void **_a);
+ int metaCall(QObject *o, QMetaObject::Call _c, int _id, void **_a) override;
private:
QList<ProxyData> *metaObjects;
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 333ac430d3..3e599aed6c 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -166,7 +166,7 @@ public:
void initializeEngine(QQmlExtensionInterface *, const char *);
protected:
- virtual void shutdownThread();
+ void shutdownThread() override;
private:
void loadThread(QQmlDataBlob *b);
@@ -1364,7 +1364,8 @@ bool QQmlTypeLoader::Blob::updateQmldir(QQmlQmldirData *data, const QV4::Compile
// Does this library contain any qualified scripts?
QUrl libraryUrl(qmldirUrl);
const QmldirContent *qmldir = typeLoader()->qmldirContent(qmldirIdentifier);
- foreach (const QQmlDirParser::Script &script, qmldir->scripts()) {
+ const auto qmldirScripts = qmldir->scripts();
+ for (const QQmlDirParser::Script &script : qmldirScripts) {
QUrl scriptUrl = libraryUrl.resolved(QUrl(script.fileName));
QQmlScriptBlob *blob = typeLoader()->getScript(scriptUrl);
addDependency(blob);
@@ -1411,7 +1412,8 @@ bool QQmlTypeLoader::Blob::addImport(const QV4::CompiledData::Import *import, QL
// Does this library contain any qualified scripts?
QUrl libraryUrl(qmldirUrl);
const QmldirContent *qmldir = typeLoader()->qmldirContent(qmldirFilePath);
- foreach (const QQmlDirParser::Script &script, qmldir->scripts()) {
+ const auto qmldirScripts = qmldir->scripts();
+ for (const QQmlDirParser::Script &script : qmldirScripts) {
QUrl scriptUrl = libraryUrl.resolved(QUrl(script.fileName));
QQmlScriptBlob *blob = typeLoader()->getScript(scriptUrl);
addDependency(blob);
@@ -2381,7 +2383,7 @@ bool QQmlTypeData::loadFromSource()
if (!compiler.generateFromQml(code, finalUrlString(), m_document.data())) {
QList<QQmlError> errors;
errors.reserve(compiler.errors.count());
- foreach (const QQmlJS::DiagnosticMessage &msg, compiler.errors) {
+ for (const QQmlJS::DiagnosticMessage &msg : qAsConst(compiler.errors)) {
QQmlError e;
e.setUrl(finalUrl());
e.setLine(msg.loc.startLine);
@@ -2516,8 +2518,8 @@ void QQmlTypeData::compile(const QQmlRefPointer<QQmlTypeNameCache> &importCache,
void QQmlTypeData::resolveTypes()
{
// Add any imported scripts to our resolved set
- foreach (const QQmlImports::ScriptReference &script, m_importCache.resolvedScripts())
- {
+ const auto resolvedScripts = m_importCache.resolvedScripts();
+ for (const QQmlImports::ScriptReference &script : resolvedScripts) {
QQmlScriptBlob *blob = typeLoader()->getScript(script.location);
addDependency(blob);
@@ -2537,7 +2539,8 @@ void QQmlTypeData::resolveTypes()
}
// Lets handle resolved composite singleton types
- foreach (const QQmlImports::CompositeSingletonReference &csRef, m_importCache.resolvedCompositeSingletons()) {
+ const auto resolvedCompositeSingletons = m_importCache.resolvedCompositeSingletons();
+ for (const QQmlImports::CompositeSingletonReference &csRef : resolvedCompositeSingletons) {
TypeReference ref;
QString typeName;
if (!csRef.prefix.isEmpty()) {
@@ -2887,7 +2890,7 @@ QQmlScriptData *QQmlScriptBlob::scriptData() const
struct EmptyCompilationUnit : public QV4::CompiledData::CompilationUnit
{
- virtual void linkBackendToEngine(QV4::ExecutionEngine *) {}
+ void linkBackendToEngine(QV4::ExecutionEngine *) override {}
};
void QQmlScriptBlob::dataReceived(const Data &data)
diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h
index 53cf4234e1..ad5ab3124e 100644
--- a/src/qml/qml/qqmltypeloader_p.h
+++ b/src/qml/qml/qqmltypeloader_p.h
@@ -243,8 +243,8 @@ public:
virtual void scriptImported(QQmlScriptBlob *, const QV4::CompiledData::Location &, const QString &, const QString &) {}
- virtual void dependencyError(QQmlDataBlob *);
- virtual void dependencyComplete(QQmlDataBlob *);
+ void dependencyError(QQmlDataBlob *) override;
+ void dependencyComplete(QQmlDataBlob *) override;
protected:
virtual QString stringAt(int) const { return QString(); }
@@ -434,14 +434,14 @@ public:
void unregisterCallback(TypeDataCallback *);
protected:
- virtual void done();
- virtual void completed();
- virtual void dataReceived(const Data &);
- virtual void initializeFromCachedUnit(const QQmlPrivate::CachedQmlUnit *unit);
- virtual void allDependenciesDone();
- virtual void downloadProgressChanged(qreal);
+ void done() override;
+ void completed() override;
+ void dataReceived(const Data &) override;
+ void initializeFromCachedUnit(const QQmlPrivate::CachedQmlUnit *unit) override;
+ void allDependenciesDone() override;
+ void downloadProgressChanged(qreal) override;
- virtual QString stringAt(int index) const;
+ QString stringAt(int index) const override;
private:
bool tryLoadFromDiskCache();
@@ -458,7 +458,7 @@ private:
const QV4::CompiledData::ResolvedTypeReferenceMap &resolvedTypeCache);
bool resolveType(const QString &typeName, int &majorVersion, int &minorVersion, TypeReference &ref);
- virtual void scriptImported(QQmlScriptBlob *blob, const QV4::CompiledData::Location &location, const QString &qualifier, const QString &nameSpace);
+ void scriptImported(QQmlScriptBlob *blob, const QV4::CompiledData::Location &location, const QString &qualifier, const QString &nameSpace) override;
qint64 m_sourceTimeStamp = 0;
@@ -510,7 +510,7 @@ public:
QV4::ReturnedValue scriptValueForContext(QQmlContextData *parentCtxt);
protected:
- virtual void clear(); // From QQmlCleanup
+ void clear() override; // From QQmlCleanup
private:
friend class QQmlScriptBlob;
@@ -546,14 +546,14 @@ public:
QQmlScriptData *scriptData() const;
protected:
- virtual void dataReceived(const Data &);
- virtual void initializeFromCachedUnit(const QQmlPrivate::CachedQmlUnit *unit);
- virtual void done();
+ void dataReceived(const Data &) override;
+ void initializeFromCachedUnit(const QQmlPrivate::CachedQmlUnit *unit) override;
+ void done() override;
- virtual QString stringAt(int index) const;
+ QString stringAt(int index) const override;
private:
- virtual void scriptImported(QQmlScriptBlob *blob, const QV4::CompiledData::Location &location, const QString &qualifier, const QString &nameSpace);
+ void scriptImported(QQmlScriptBlob *blob, const QV4::CompiledData::Location &location, const QString &qualifier, const QString &nameSpace) override;
void initializeFromCompilationUnit(QV4::CompiledData::CompilationUnit *unit);
QList<ScriptReference> m_scripts;
diff --git a/src/qml/qml/qqmlvaluetype_p.h b/src/qml/qml/qqmlvaluetype_p.h
index 11e1dfdb00..0502a5d665 100644
--- a/src/qml/qml/qqmlvaluetype_p.h
+++ b/src/qml/qml/qqmlvaluetype_p.h
@@ -74,9 +74,9 @@ public:
void setValue(const QVariant &);
// ---- dynamic meta object data interface
- virtual QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *);
- virtual void objectDestroyed(QObject *);
- virtual int metaCall(QObject *obj, QMetaObject::Call type, int _id, void **argv);
+ QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *) override;
+ void objectDestroyed(QObject *) override;
+ int metaCall(QObject *obj, QMetaObject::Call type, int _id, void **argv) override;
// ----
private:
diff --git a/src/qml/qml/qqmlvaluetypeproxybinding_p.h b/src/qml/qml/qqmlvaluetypeproxybinding_p.h
index 9a487d6992..aa7abaa486 100644
--- a/src/qml/qml/qqmlvaluetypeproxybinding_p.h
+++ b/src/qml/qml/qqmlvaluetypeproxybinding_p.h
@@ -63,8 +63,8 @@ public:
QQmlAbstractBinding *binding(QQmlPropertyIndex targetPropertyIndex);
void removeBindings(quint32 mask);
- virtual void setEnabled(bool, QQmlPropertyData::WriteFlags);
- virtual bool isValueTypeProxy() const;
+ void setEnabled(bool, QQmlPropertyData::WriteFlags) override;
+ bool isValueTypeProxy() const override;
protected:
~QQmlValueTypeProxyBinding();
diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp
index b23bc033d1..43b9e4bd3b 100644
--- a/src/qml/qml/qqmlvaluetypewrapper.cpp
+++ b/src/qml/qml/qqmlvaluetypewrapper.cpp
@@ -275,9 +275,9 @@ void QQmlValueTypeWrapper::advanceIterator(Managed *m, ObjectIterator *it, Value
QV4::Object::advanceIterator(m, it, name, index, p, attributes);
}
-bool QQmlValueTypeWrapper::isEqual(const QVariant& value)
+bool QQmlValueTypeWrapper::isEqual(const QVariant& value) const
{
- if (QQmlValueTypeReference *ref = as<QQmlValueTypeReference>())
+ if (const QQmlValueTypeReference *ref = as<const QQmlValueTypeReference>())
if (!ref->readReferenceValue())
return false;
return (value == d()->toVariant());
diff --git a/src/qml/qml/qqmlvaluetypewrapper_p.h b/src/qml/qml/qqmlvaluetypewrapper_p.h
index b8ca5a16f4..fec54df770 100644
--- a/src/qml/qml/qqmlvaluetypewrapper_p.h
+++ b/src/qml/qml/qqmlvaluetypewrapper_p.h
@@ -101,7 +101,7 @@ public:
QVariant toVariant() const;
bool toGadget(void *data) const;
- bool isEqual(const QVariant& value);
+ bool isEqual(const QVariant& value) const;
int typeId() const;
bool write(QObject *target, int propertyIndex) const;
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index b08a0e5087..791870b831 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -343,7 +343,7 @@ QQmlVMEMetaObject::~QQmlVMEMetaObject()
qDeleteAll(varObjectGuards);
}
-QV4::MemberData *QQmlVMEMetaObject::propertyAndMethodStorageAsMemberData()
+QV4::MemberData *QQmlVMEMetaObject::propertyAndMethodStorageAsMemberData() const
{
if (propertyAndMethodStorage.isUndefined()) {
if (propertyAndMethodStorage.valueRef())
@@ -442,7 +442,7 @@ void QQmlVMEMetaObject::writeProperty(int id, QObject* v)
guard->setGuardedValue(v, this, id);
}
-int QQmlVMEMetaObject::readPropertyAsInt(int id)
+int QQmlVMEMetaObject::readPropertyAsInt(int id) const
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
if (!md)
@@ -455,7 +455,7 @@ int QQmlVMEMetaObject::readPropertyAsInt(int id)
return sv->integerValue();
}
-bool QQmlVMEMetaObject::readPropertyAsBool(int id)
+bool QQmlVMEMetaObject::readPropertyAsBool(int id) const
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
if (!md)
@@ -468,7 +468,7 @@ bool QQmlVMEMetaObject::readPropertyAsBool(int id)
return sv->booleanValue();
}
-double QQmlVMEMetaObject::readPropertyAsDouble(int id)
+double QQmlVMEMetaObject::readPropertyAsDouble(int id) const
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
if (!md)
@@ -481,7 +481,7 @@ double QQmlVMEMetaObject::readPropertyAsDouble(int id)
return sv->doubleValue();
}
-QString QQmlVMEMetaObject::readPropertyAsString(int id)
+QString QQmlVMEMetaObject::readPropertyAsString(int id) const
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
if (!md)
@@ -494,7 +494,7 @@ QString QQmlVMEMetaObject::readPropertyAsString(int id)
return sv->stringValue()->toQString();
}
-QUrl QQmlVMEMetaObject::readPropertyAsUrl(int id)
+QUrl QQmlVMEMetaObject::readPropertyAsUrl(int id) const
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
if (!md)
@@ -508,7 +508,7 @@ QUrl QQmlVMEMetaObject::readPropertyAsUrl(int id)
return v->d()->data().value<QUrl>();
}
-QDate QQmlVMEMetaObject::readPropertyAsDate(int id)
+QDate QQmlVMEMetaObject::readPropertyAsDate(int id) const
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
if (!md)
@@ -536,7 +536,7 @@ QDateTime QQmlVMEMetaObject::readPropertyAsDateTime(int id)
return v->d()->data().value<QDateTime>();
}
-QSizeF QQmlVMEMetaObject::readPropertyAsSizeF(int id)
+QSizeF QQmlVMEMetaObject::readPropertyAsSizeF(int id) const
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
if (!md)
@@ -550,7 +550,7 @@ QSizeF QQmlVMEMetaObject::readPropertyAsSizeF(int id)
return v->d()->data().value<QSizeF>();
}
-QPointF QQmlVMEMetaObject::readPropertyAsPointF(int id)
+QPointF QQmlVMEMetaObject::readPropertyAsPointF(int id) const
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
if (!md)
@@ -564,7 +564,7 @@ QPointF QQmlVMEMetaObject::readPropertyAsPointF(int id)
return v->d()->data().value<QPointF>();
}
-QObject* QQmlVMEMetaObject::readPropertyAsQObject(int id)
+QObject* QQmlVMEMetaObject::readPropertyAsQObject(int id) const
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
if (!md)
@@ -578,7 +578,7 @@ QObject* QQmlVMEMetaObject::readPropertyAsQObject(int id)
return wrapper->object();
}
-QList<QObject *> *QQmlVMEMetaObject::readPropertyAsList(int id)
+QList<QObject *> *QQmlVMEMetaObject::readPropertyAsList(int id) const
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
if (!md)
@@ -594,7 +594,7 @@ QList<QObject *> *QQmlVMEMetaObject::readPropertyAsList(int id)
return static_cast<QList<QObject *> *>(v->d()->data().data());
}
-QRectF QQmlVMEMetaObject::readPropertyAsRectF(int id)
+QRectF QQmlVMEMetaObject::readPropertyAsRectF(int id) const
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
if (!md)
@@ -976,7 +976,7 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void *
#pragma optimize("", on)
#endif
-QV4::ReturnedValue QQmlVMEMetaObject::method(int index)
+QV4::ReturnedValue QQmlVMEMetaObject::method(int index) const
{
if (!ctxt || !ctxt->isValid() || !compiledObject) {
qWarning("QQmlVMEMetaObject: Internal error - attempted to evaluate a function in an invalid context");
@@ -990,7 +990,7 @@ QV4::ReturnedValue QQmlVMEMetaObject::method(int index)
return (md->data() + index + compiledObject->nProperties)->asReturnedValue();
}
-QV4::ReturnedValue QQmlVMEMetaObject::readVarProperty(int id)
+QV4::ReturnedValue QQmlVMEMetaObject::readVarProperty(int id) const
{
Q_ASSERT(compiledObject && compiledObject->propertyTable()[id].type == QV4::CompiledData::Property::Var);
@@ -1000,7 +1000,7 @@ QV4::ReturnedValue QQmlVMEMetaObject::readVarProperty(int id)
return QV4::Primitive::undefinedValue().asReturnedValue();
}
-QVariant QQmlVMEMetaObject::readPropertyAsVariant(int id)
+QVariant QQmlVMEMetaObject::readPropertyAsVariant(int id) const
{
QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
if (md) {
@@ -1107,7 +1107,7 @@ void QQmlVMEMetaObject::writeProperty(int id, const QVariant &value)
}
}
-QV4::ReturnedValue QQmlVMEMetaObject::vmeMethod(int index)
+QV4::ReturnedValue QQmlVMEMetaObject::vmeMethod(int index) const
{
if (index < methodOffset()) {
Q_ASSERT(parentVMEMetaObject());
@@ -1139,7 +1139,7 @@ void QQmlVMEMetaObject::setVmeMethod(int index, const QV4::Value &function)
*(md->data() + methodIndex + compiledObject->nProperties) = function;
}
-QV4::ReturnedValue QQmlVMEMetaObject::vmeProperty(int index)
+QV4::ReturnedValue QQmlVMEMetaObject::vmeProperty(int index) const
{
if (index < propOffset()) {
Q_ASSERT(parentVMEMetaObject());
diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h
index 031bfdfb9b..9a13e0047d 100644
--- a/src/qml/qml/qqmlvmemetaobject_p.h
+++ b/src/qml/qml/qqmlvmemetaobject_p.h
@@ -148,9 +148,9 @@ public:
~QQmlVMEMetaObject();
bool aliasTarget(int index, QObject **target, int *coreIndex, int *valueTypeIndex) const;
- QV4::ReturnedValue vmeMethod(int index);
+ QV4::ReturnedValue vmeMethod(int index) const;
void setVmeMethod(int index, const QV4::Value &function);
- QV4::ReturnedValue vmeProperty(int index);
+ QV4::ReturnedValue vmeProperty(int index) const;
void setVMEProperty(int index, const QV4::Value &v);
void connectAliasSignal(int index, bool indexInSignalRange);
@@ -174,20 +174,20 @@ public:
QQmlVMEMetaObjectEndpoint *aliasEndpoints;
QV4::WeakValue propertyAndMethodStorage;
- QV4::MemberData *propertyAndMethodStorageAsMemberData();
-
- int readPropertyAsInt(int id);
- bool readPropertyAsBool(int id);
- double readPropertyAsDouble(int id);
- QString readPropertyAsString(int id);
- QSizeF readPropertyAsSizeF(int id);
- QPointF readPropertyAsPointF(int id);
- QUrl readPropertyAsUrl(int id);
- QDate readPropertyAsDate(int id);
+ QV4::MemberData *propertyAndMethodStorageAsMemberData() const;
+
+ int readPropertyAsInt(int id) const;
+ bool readPropertyAsBool(int id) const;
+ double readPropertyAsDouble(int id) const;
+ QString readPropertyAsString(int id) const;
+ QSizeF readPropertyAsSizeF(int id) const;
+ QPointF readPropertyAsPointF(int id) const;
+ QUrl readPropertyAsUrl(int id) const;
+ QDate readPropertyAsDate(int id) const;
QDateTime readPropertyAsDateTime(int id);
- QRectF readPropertyAsRectF(int id);
- QObject *readPropertyAsQObject(int id);
- QList<QObject *> *readPropertyAsList(int id);
+ QRectF readPropertyAsRectF(int id) const;
+ QObject *readPropertyAsQObject(int id) const;
+ QList<QObject *> *readPropertyAsList(int id) const;
void writeProperty(int id, int v);
void writeProperty(int id, bool v);
@@ -207,11 +207,11 @@ public:
void connectAlias(int aliasId);
- QV4::ReturnedValue method(int);
+ QV4::ReturnedValue method(int) const;
- QV4::ReturnedValue readVarProperty(int);
+ QV4::ReturnedValue readVarProperty(int) const;
void writeVarProperty(int, const QV4::Value &);
- QVariant readPropertyAsVariant(int);
+ QVariant readPropertyAsVariant(int) const;
void writeProperty(int, const QVariant &);
inline QQmlVMEMetaObject *parentVMEMetaObject() const;
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 10b1cbcfd4..b4be709b37 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -831,7 +831,8 @@ ReturnedValue Document::load(ExecutionEngine *v4, const QByteArray &data)
}
nodeStack.append(node);
- foreach (const QXmlStreamAttribute &a, reader.attributes()) {
+ const auto attributes = reader.attributes();
+ for (const QXmlStreamAttribute &a : attributes) {
NodeImpl *attr = new NodeImpl;
attr->document = document;
attr->type = NodeImpl::Attr;
@@ -1185,10 +1186,10 @@ QString QQmlXMLHttpRequest::headers() const
void QQmlXMLHttpRequest::fillHeadersList()
{
- QList<QByteArray> headerList = m_network->rawHeaderList();
+ const QList<QByteArray> headerList = m_network->rawHeaderList();
m_headersList.clear();
- foreach (const QByteArray &header, headerList) {
+ for (const QByteArray &header : headerList) {
HeaderPair pair (header.toLower(), m_network->rawHeader(header));
if (pair.first == "set-cookie" ||
pair.first == "set-cookie2")
@@ -1446,7 +1447,7 @@ void QQmlXMLHttpRequest::finished()
void QQmlXMLHttpRequest::readEncoding()
{
- foreach (const HeaderPair &header, m_headersList) {
+ for (const HeaderPair &header : qAsConst(m_headersList)) {
if (header.first == "content-type") {
int separatorIdx = header.second.indexOf(';');
if (separatorIdx == -1) {
diff --git a/src/qml/types/qqmlbind_p.h b/src/qml/types/qqmlbind_p.h
index 77939a40bc..c9dd14b58a 100644
--- a/src/qml/types/qqmlbind_p.h
+++ b/src/qml/types/qqmlbind_p.h
@@ -90,9 +90,9 @@ public:
void setDelayed(bool);
protected:
- virtual void setTarget(const QQmlProperty &);
- virtual void classBegin();
- virtual void componentComplete();
+ void setTarget(const QQmlProperty &) override;
+ void classBegin() override;
+ void componentComplete() override;
private:
void prepareEval();
diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp
index 84782114ac..1e9e0149dc 100644
--- a/src/qml/types/qqmlconnections.cpp
+++ b/src/qml/types/qqmlconnections.cpp
@@ -204,7 +204,7 @@ void QQmlConnections::setEnabled(bool enabled)
d->enabled = enabled;
- foreach (QQmlBoundSignal *s, d->boundsignals)
+ for (QQmlBoundSignal *s : qAsConst(d->boundsignals))
s->setEnabled(d->enabled);
emit enabledChanged();
diff --git a/src/qml/types/qqmlconnections_p.h b/src/qml/types/qqmlconnections_p.h
index d454affba8..580b6522de 100644
--- a/src/qml/types/qqmlconnections_p.h
+++ b/src/qml/types/qqmlconnections_p.h
@@ -91,15 +91,15 @@ Q_SIGNALS:
private:
void connectSignals();
- void classBegin();
- void componentComplete();
+ void classBegin() override;
+ void componentComplete() override;
};
class QQmlConnectionsParser : public QQmlCustomParser
{
public:
- virtual void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props);
- virtual void applyBindings(QObject *object, QV4::CompiledData::CompilationUnit *compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings);
+ void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props) override;
+ void applyBindings(QObject *object, QV4::CompiledData::CompilationUnit *compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) override;
};
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index 9b58ec35f8..c4fabbedcc 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -1126,7 +1126,7 @@ void QQmlDelegateModelPrivate::itemsChanged(const QVector<Compositor::Change> &c
QVarLengthArray<QVector<QQmlChangeSet::Change>, Compositor::MaximumGroupCount> translatedChanges(m_groupCount);
- foreach (const Compositor::Change &change, changes) {
+ for (const Compositor::Change &change : changes) {
for (int i = 1; i < m_groupCount; ++i) {
if (change.inGroup(i)) {
translatedChanges[i].append(QQmlChangeSet::Change(change.index[i], change.count));
@@ -1175,7 +1175,7 @@ void QQmlDelegateModelPrivate::itemsInserted(
for (int i = 1; i < m_groupCount; ++i)
inserted[i] = 0;
- foreach (const Compositor::Insert &insert, inserts) {
+ for (const Compositor::Insert &insert : inserts) {
for (; cacheIndex < insert.cacheIndex; ++cacheIndex)
incrementIndexes(m_cache.at(cacheIndex), m_groupCount, inserted);
@@ -1267,7 +1267,7 @@ void QQmlDelegateModelPrivate::itemsRemoved(
for (int i = 1; i < m_groupCount; ++i)
removed[i] = 0;
- foreach (const Compositor::Remove &remove, removes) {
+ for (const Compositor::Remove &remove : removes) {
for (; cacheIndex < remove.cacheIndex; ++cacheIndex)
incrementIndexes(m_cache.at(cacheIndex), m_groupCount, removed);
@@ -1638,7 +1638,7 @@ bool QQmlDelegateModelPrivate::insert(Compositor::insert_iterator &before, const
cacheItem->groups = groups | Compositor::UnresolvedFlag | Compositor::CacheFlag;
// Must be before the new object is inserted into the cache or its indexes will be adjusted too.
- itemsInserted(QVector<Compositor::Insert>() << Compositor::Insert(before, 1, cacheItem->groups & ~Compositor::CacheFlag));
+ itemsInserted(QVector<Compositor::Insert>(1, Compositor::Insert(before, 1, cacheItem->groups & ~Compositor::CacheFlag)));
before = m_compositor.insert(before, 0, 0, 1, cacheItem->groups);
m_cache.insert(before.cacheIndex, cacheItem);
@@ -1749,7 +1749,7 @@ void QQmlDelegateModelItemMetaType::initializePrototype()
int QQmlDelegateModelItemMetaType::parseGroups(const QStringList &groups) const
{
int groupFlags = 0;
- foreach (const QString &groupName, groups) {
+ for (const QString &groupName : groups) {
int index = groupNames.indexOf(groupName);
if (index != -1)
groupFlags |= 2 << index;
@@ -2728,12 +2728,12 @@ void QQmlDelegateModelGroup::resolve(QQmlV4Function *args)
from += 1;
model->itemsMoved(
- QVector<Compositor::Remove>() << Compositor::Remove(fromIt, 1, unresolvedFlags, 0),
- QVector<Compositor::Insert>() << Compositor::Insert(toIt, 1, unresolvedFlags, 0));
+ QVector<Compositor::Remove>(1, Compositor::Remove(fromIt, 1, unresolvedFlags, 0)),
+ QVector<Compositor::Insert>(1, Compositor::Insert(toIt, 1, unresolvedFlags, 0)));
model->itemsInserted(
- QVector<Compositor::Insert>() << Compositor::Insert(toIt, 1, (resolvedFlags & ~unresolvedFlags) | Compositor::CacheFlag));
+ QVector<Compositor::Insert>(1, Compositor::Insert(toIt, 1, (resolvedFlags & ~unresolvedFlags) | Compositor::CacheFlag)));
toIt.incrementIndexes(1, resolvedFlags | unresolvedFlags);
- model->itemsRemoved(QVector<Compositor::Remove>() << Compositor::Remove(toIt, 1, resolvedFlags));
+ model->itemsRemoved(QVector<Compositor::Remove>(1, Compositor::Remove(toIt, 1, resolvedFlags)));
model->m_compositor.setFlags(toGroup, to, 1, unresolvedFlags & ~Compositor::UnresolvedFlag);
model->m_compositor.clearFlags(fromGroup, from, 1, unresolvedFlags);
diff --git a/src/qml/types/qqmldelegatemodel_p.h b/src/qml/types/qqmldelegatemodel_p.h
index 2986ec7ce5..186144d107 100644
--- a/src/qml/types/qqmldelegatemodel_p.h
+++ b/src/qml/types/qqmldelegatemodel_p.h
@@ -90,10 +90,10 @@ class Q_QML_PRIVATE_EXPORT QQmlDelegateModel : public QQmlInstanceModel, public
public:
QQmlDelegateModel();
QQmlDelegateModel(QQmlContext *, QObject *parent=0);
- virtual ~QQmlDelegateModel();
+ ~QQmlDelegateModel();
- void classBegin();
- void componentComplete();
+ void classBegin() override;
+ void componentComplete() override;
QVariant model() const;
void setModel(const QVariant &);
@@ -107,15 +107,15 @@ public:
Q_INVOKABLE QVariant modelIndex(int idx) const;
Q_INVOKABLE QVariant parentModelIndex() const;
- int count() const;
- bool isValid() const { return delegate() != 0; }
- QObject *object(int index, bool asynchronous=false);
- ReleaseFlags release(QObject *object);
- void cancel(int index);
- virtual QString stringValue(int index, const QString &role);
- virtual void setWatchedRoles(const QList<QByteArray> &roles);
+ int count() const override;
+ bool isValid() const override { return delegate() != 0; }
+ QObject *object(int index, bool asynchronous = false) override;
+ ReleaseFlags release(QObject *object) override;
+ void cancel(int index) override;
+ QString stringValue(int index, const QString &role) override;
+ void setWatchedRoles(const QList<QByteArray> &roles) override;
- int indexOf(QObject *object, QObject *objectContext) const;
+ int indexOf(QObject *object, QObject *objectContext) const override;
QString filterGroup() const;
void setFilterGroup(const QString &group);
@@ -126,7 +126,7 @@ public:
QQmlListProperty<QQmlDelegateModelGroup> groups();
QObject *parts();
- bool event(QEvent *);
+ bool event(QEvent *) override;
static QQmlDelegateModelAttached *qmlAttachedProperties(QObject *obj);
diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h
index 6cb82fddfc..f4ffdf38aa 100644
--- a/src/qml/types/qqmldelegatemodel_p_p.h
+++ b/src/qml/types/qqmldelegatemodel_p_p.h
@@ -191,8 +191,8 @@ public:
, incubating(0)
, vdm(l) {}
- virtual void statusChanged(Status);
- virtual void setInitialState(QObject *);
+ void statusChanged(Status) override;
+ void setInitialState(QObject *) override;
QQmlDelegateModelItem *incubating;
QQmlDelegateModelPrivate *vdm;
@@ -354,21 +354,21 @@ public:
void updateFilterGroup();
void updateFilterGroup(Compositor::Group group, const QQmlChangeSet &changeSet);
- int count() const;
- bool isValid() const;
- QObject *object(int index, bool asynchronous=false);
- ReleaseFlags release(QObject *item);
- QString stringValue(int index, const QString &role);
+ int count() const override;
+ bool isValid() const override;
+ QObject *object(int index, bool asynchronous = false) override;
+ ReleaseFlags release(QObject *item) override;
+ QString stringValue(int index, const QString &role) override;
QList<QByteArray> watchedRoles() const { return m_watchedRoles; }
- void setWatchedRoles(const QList<QByteArray> &roles);
+ void setWatchedRoles(const QList<QByteArray> &roles) override;
- int indexOf(QObject *item, QObject *objectContext) const;
+ int indexOf(QObject *item, QObject *objectContext) const override;
- void emitModelUpdated(const QQmlChangeSet &changeSet, bool reset);
+ void emitModelUpdated(const QQmlChangeSet &changeSet, bool reset) override;
- void createdPackage(int index, QQuickPackage *package);
- void initPackage(int index, QQuickPackage *package);
- void destroyingPackage(QQuickPackage *package);
+ void createdPackage(int index, QQuickPackage *package) override;
+ void initPackage(int index, QQuickPackage *package) override;
+ void destroyingPackage(QQuickPackage *package) override;
Q_SIGNALS:
void filterGroupChanged();
@@ -391,8 +391,8 @@ public:
QQmlDelegateModelPartsMetaObject(QObject *parent)
: QQmlOpenMetaObject(parent) {}
- virtual void propertyCreated(int, QMetaPropertyBuilder &);
- virtual QVariant initialValue(int);
+ void propertyCreated(int, QMetaPropertyBuilder &) override;
+ QVariant initialValue(int) override;
};
class QQmlDelegateModelParts : public QObject
@@ -412,8 +412,8 @@ public:
QQmlDelegateModelItemMetaType *metaType, QMetaObject *metaObject);
~QQmlDelegateModelAttachedMetaObject();
- void objectDestroyed(QObject *);
- int metaCall(QObject *, QMetaObject::Call, int _id, void **);
+ void objectDestroyed(QObject *) override;
+ int metaCall(QObject *, QMetaObject::Call, int _id, void **) override;
private:
QQmlDelegateModelItemMetaType * const metaType;
diff --git a/src/qml/types/qqmlinstantiator.cpp b/src/qml/types/qqmlinstantiator.cpp
index 0cec39790d..2de5875deb 100644
--- a/src/qml/types/qqmlinstantiator.cpp
+++ b/src/qml/types/qqmlinstantiator.cpp
@@ -155,7 +155,8 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo
int difference = 0;
QHash<int, QVector<QPointer<QObject> > > moved;
- foreach (const QQmlChangeSet::Change &remove, changeSet.removes()) {
+ const QVector<QQmlChangeSet::Change> &removes = changeSet.removes();
+ for (const QQmlChangeSet::Change &remove : removes) {
int index = qMin(remove.index, objects.count());
int count = qMin(remove.index + remove.count, objects.count()) - index;
if (remove.isMove()) {
@@ -174,7 +175,8 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo
difference -= remove.count;
}
- foreach (const QQmlChangeSet::Change &insert, changeSet.inserts()) {
+ const QVector<QQmlChangeSet::Change> &inserts = changeSet.inserts();
+ for (const QQmlChangeSet::Change &insert : inserts) {
int index = qMin(insert.index, objects.count());
if (insert.isMove()) {
QVector<QPointer<QObject> > movedObjects = moved.value(insert.moveId);
diff --git a/src/qml/types/qqmlinstantiator_p.h b/src/qml/types/qqmlinstantiator_p.h
index dff69ee6b3..ee18daa48c 100644
--- a/src/qml/types/qqmlinstantiator_p.h
+++ b/src/qml/types/qqmlinstantiator_p.h
@@ -72,7 +72,7 @@ class Q_AUTOTEST_EXPORT QQmlInstantiator : public QObject, public QQmlParserStat
public:
QQmlInstantiator(QObject *parent = 0);
- virtual ~QQmlInstantiator();
+ ~QQmlInstantiator();
bool isActive() const;
void setActive(bool newVal);
@@ -92,8 +92,8 @@ public:
Q_INVOKABLE QObject *objectAt(int index) const;
- void classBegin();
- void componentComplete();
+ void classBegin() override;
+ void componentComplete() override;
Q_SIGNALS:
void modelChanged();
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index f7fdbf0d80..062f7a2a74 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -230,7 +230,7 @@ const ListLayout::Role *ListLayout::getRoleOrCreate(const QString &key, const QV
return &getRoleOrCreate(key, type);
}
-const ListLayout::Role *ListLayout::getExistingRole(const QString &key)
+const ListLayout::Role *ListLayout::getExistingRole(const QString &key) const
{
Role *r = 0;
QStringHash<Role *>::Node *node = roleHash.findNode(key);
@@ -239,7 +239,7 @@ const ListLayout::Role *ListLayout::getExistingRole(const QString &key)
return r;
}
-const ListLayout::Role *ListLayout::getExistingRole(QV4::String *key)
+const ListLayout::Role *ListLayout::getExistingRole(QV4::String *key) const
{
Role *r = 0;
QStringHash<Role *>::Node *node = roleHash.findNode(key);
@@ -600,11 +600,8 @@ int ListModel::setOrCreateProperty(int elementIndex, const QString &key, const Q
ModelNodeMetaObject *cache = e->objectCache();
- if (roleIndex != -1 && cache) {
- QVector<int> roles;
- roles << roleIndex;
- cache->updateValues(roles);
- }
+ if (roleIndex != -1 && cache)
+ cache->updateValues(QVector<int>(1, roleIndex));
}
}
@@ -1302,11 +1299,8 @@ void ModelNodeMetaObject::propertyWritten(int index)
QV4::ScopedValue v(scope, scope.engine->fromVariant(value));
int roleIndex = m_model->m_listModel->setExistingProperty(m_elementIndex, propName, v, scope.engine);
- if (roleIndex != -1) {
- QVector<int> roles;
- roles << roleIndex;
- m_model->emitItemsChanged(m_elementIndex, 1, roles);
- }
+ if (roleIndex != -1)
+ m_model->emitItemsChanged(m_elementIndex, 1, QVector<int>(1, roleIndex));
}
namespace QV4 {
@@ -1319,11 +1313,8 @@ void ModelObject::put(Managed *m, String *name, const Value &value)
const int elementIndex = that->d()->m_elementIndex;
const QString propName = name->toQString();
int roleIndex = that->d()->m_model->m_listModel->setExistingProperty(elementIndex, propName, value, eng);
- if (roleIndex != -1) {
- QVector<int> roles;
- roles << roleIndex;
- that->d()->m_model->emitItemsChanged(elementIndex, 1, roles);
- }
+ if (roleIndex != -1)
+ that->d()->m_model->emitItemsChanged(elementIndex, 1, QVector<int>(1, roleIndex));
ModelNodeMetaObject *mo = ModelNodeMetaObject::get(that->object());
if (mo->initialized())
@@ -1505,14 +1496,10 @@ void DynamicRoleModelNodeMetaObject::propertyWritten(int index)
}
int elementIndex = parentModel->m_modelObjects.indexOf(m_owner);
- int roleIndex = parentModel->m_roles.indexOf(QString::fromLatin1(name(index).constData()));
-
- if (elementIndex != -1 && roleIndex != -1) {
-
- QVector<int> roles;
- roles << roleIndex;
-
- parentModel->emitItemsChanged(elementIndex, 1, roles);
+ if (elementIndex != -1) {
+ int roleIndex = parentModel->m_roles.indexOf(QString::fromLatin1(name(index).constData()));
+ if (roleIndex != -1)
+ parentModel->emitItemsChanged(elementIndex, 1, QVector<int>(1, roleIndex));
}
}
@@ -1881,14 +1868,14 @@ bool QQmlListModel::setData(const QModelIndex &index, const QVariant &value, int
if (m_dynamicRoles) {
const QByteArray property = m_roles.at(role).toUtf8();
if (m_modelObjects[row]->setValue(property, value)) {
- emitItemsChanged(row, 1, QVector<int>() << role);
+ emitItemsChanged(row, 1, QVector<int>(1, role));
return true;
}
} else {
const ListLayout::Role &r = m_listModel->getExistingRole(role);
const int roleIndex = m_listModel->setOrCreateProperty(row, r.name, value);
if (roleIndex != -1) {
- emitItemsChanged(row, 1, QVector<int>() << role);
+ emitItemsChanged(row, 1, QVector<int>(1, role));
return true;
}
}
@@ -2356,20 +2343,12 @@ void QQmlListModel::setProperty(int index, const QString& property, const QVaria
roleIndex = m_roles.count();
m_roles.append(property);
}
- if (m_modelObjects[index]->setValue(property.toUtf8(), value)) {
- QVector<int> roles;
- roles << roleIndex;
- emitItemsChanged(index, 1, roles);
- }
+ if (m_modelObjects[index]->setValue(property.toUtf8(), value))
+ emitItemsChanged(index, 1, QVector<int>(1, roleIndex));
} else {
int roleIndex = m_listModel->setOrCreateProperty(index, property, value);
- if (roleIndex != -1) {
-
- QVector<int> roles;
- roles << roleIndex;
-
- emitItemsChanged(index, 1, roles);
- }
+ if (roleIndex != -1)
+ emitItemsChanged(index, 1, QVector<int>(1, roleIndex));
}
}
@@ -2498,7 +2477,7 @@ void QQmlListModelParser::verifyBindings(const QV4::CompiledData::Unit *qmlUnit,
{
listElementTypeName = QString(); // unknown
- foreach (const QV4::CompiledData::Binding *binding, bindings) {
+ for (const QV4::CompiledData::Binding *binding : bindings) {
QString propName = qmlUnit->stringAt(binding->propertyNameIndex);
if (!propName.isEmpty()) { // isn't default property
error(binding, QQmlListModel::tr("ListModel: undefined property '%1'").arg(propName));
@@ -2519,7 +2498,7 @@ void QQmlListModelParser::applyBindings(QObject *obj, QV4::CompiledData::Compila
bool setRoles = false;
- foreach (const QV4::CompiledData::Binding *binding, bindings) {
+ for (const QV4::CompiledData::Binding *binding : bindings) {
if (binding->type != QV4::CompiledData::Binding::Type_Object)
continue;
setRoles |= applyProperty(qmlUnit, binding, rv->m_listModel, /*outter element index*/-1);
diff --git a/src/qml/types/qqmllistmodel_p.h b/src/qml/types/qqmllistmodel_p.h
index 220b0e54b5..b750d30676 100644
--- a/src/qml/types/qqmllistmodel_p.h
+++ b/src/qml/types/qqmllistmodel_p.h
@@ -85,11 +85,11 @@ public:
QQmlListModel(QObject *parent=0);
~QQmlListModel();
- QModelIndex index(int row, int column, const QModelIndex &parent) const;
- int rowCount(const QModelIndex &parent) const;
- QVariant data(const QModelIndex &index, int role) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
- QHash<int,QByteArray> roleNames() const;
+ QModelIndex index(int row, int column, const QModelIndex &parent) const override;
+ int rowCount(const QModelIndex &parent) const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+ QHash<int,QByteArray> roleNames() const override;
QVariant data(int index, int role) const;
int count() const;
@@ -195,7 +195,7 @@ private:
// returns true if a role was set
bool applyProperty(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding, ListModel *model, int outterElementIndex);
- bool definesEmptyList(const QString &);
+ static bool definesEmptyList(const QString &);
QString listElementTypeName;
};
diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h
index 6e17b55e79..ddf77e52c0 100644
--- a/src/qml/types/qqmllistmodel_p_p.h
+++ b/src/qml/types/qqmllistmodel_p_p.h
@@ -71,8 +71,8 @@ public:
bool m_enabled;
protected:
- void propertyWrite(int index);
- void propertyWritten(int index);
+ void propertyWrite(int index) override;
+ void propertyWritten(int index) override;
private:
DynamicRoleModelNode *m_owner;
@@ -88,7 +88,7 @@ public:
void updateValues(const QVariantMap &object, QVector<int> &roles);
- QVariant getValue(const QString &name)
+ QVariant getValue(const QString &name) const
{
return m_meta->value(name.toUtf8());
}
@@ -124,7 +124,7 @@ public:
ModelNodeMetaObject(QObject *object, QQmlListModel *model, int elementIndex);
~ModelNodeMetaObject();
- virtual QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *object);
+ QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *object) override;
static ModelNodeMetaObject *get(QObject *obj);
@@ -138,7 +138,7 @@ public:
bool initialized() const { return m_initialized; }
protected:
- void propertyWritten(int index);
+ void propertyWritten(int index) override;
private:
using QQmlOpenMetaObject::setValue;
@@ -230,9 +230,9 @@ public:
const Role &getRoleOrCreate(QV4::String *key, Role::DataType type);
const Role &getRoleOrCreate(const QString &key, Role::DataType type);
- const Role &getExistingRole(int index) { return *roles.at(index); }
- const Role *getExistingRole(const QString &key);
- const Role *getExistingRole(QV4::String *key);
+ const Role &getExistingRole(int index) const { return *roles.at(index); }
+ const Role *getExistingRole(const QString &key) const;
+ const Role *getExistingRole(QV4::String *key) const;
int roleCount() const { return roles.count(); }
@@ -338,12 +338,12 @@ public:
return m_layout->roleCount();
}
- const ListLayout::Role &getExistingRole(int index)
+ const ListLayout::Role &getExistingRole(int index) const
{
return m_layout->getExistingRole(index);
}
- const ListLayout::Role *getExistingRole(QV4::String *key)
+ const ListLayout::Role *getExistingRole(QV4::String *key) const
{
return m_layout->getExistingRole(key);
}
diff --git a/src/qml/types/qqmllistmodelworkeragent_p.h b/src/qml/types/qqmllistmodelworkeragent_p.h
index 1a891c0f25..5a39651bf7 100644
--- a/src/qml/types/qqmllistmodelworkeragent_p.h
+++ b/src/qml/types/qqmllistmodelworkeragent_p.h
@@ -108,7 +108,7 @@ public:
void modelDestroyed();
protected:
- virtual bool event(QEvent *);
+ bool event(QEvent *) override;
private:
friend class QQuickWorkerScriptEnginePrivate;
diff --git a/src/qml/types/qqmlobjectmodel.cpp b/src/qml/types/qqmlobjectmodel.cpp
index 8c8005fb69..695043b592 100644
--- a/src/qml/types/qqmlobjectmodel.cpp
+++ b/src/qml/types/qqmlobjectmodel.cpp
@@ -154,7 +154,7 @@ public:
void clear() {
Q_Q(QQmlObjectModel);
- foreach (const Item &child, children)
+ for (const Item &child : qAsConst(children))
emit q->destroyingItem(child.item);
remove(0, children.count());
}
diff --git a/src/qml/types/qqmlobjectmodel_p.h b/src/qml/types/qqmlobjectmodel_p.h
index 97a56344d4..fc4c03874f 100644
--- a/src/qml/types/qqmlobjectmodel_p.h
+++ b/src/qml/types/qqmlobjectmodel_p.h
@@ -109,16 +109,16 @@ class Q_QML_PRIVATE_EXPORT QQmlObjectModel : public QQmlInstanceModel
public:
QQmlObjectModel(QObject *parent=0);
- virtual ~QQmlObjectModel() {}
+ ~QQmlObjectModel() {}
- virtual int count() const;
- virtual bool isValid() const;
- virtual QObject *object(int index, bool asynchronous=false);
- virtual ReleaseFlags release(QObject *object);
- virtual QString stringValue(int index, const QString &role);
- virtual void setWatchedRoles(const QList<QByteArray> &) {}
+ int count() const override;
+ bool isValid() const override;
+ QObject *object(int index, bool asynchronous = false) override;
+ ReleaseFlags release(QObject *object) override;
+ QString stringValue(int index, const QString &role) override;
+ void setWatchedRoles(const QList<QByteArray> &) override {}
- virtual int indexOf(QObject *object, QObject *objectContext) const;
+ int indexOf(QObject *object, QObject *objectContext) const override;
QQmlListProperty<QObject> children();
diff --git a/src/qml/types/qqmltimer.cpp b/src/qml/types/qqmltimer.cpp
index 889274b43e..7efdac4c22 100644
--- a/src/qml/types/qqmltimer.cpp
+++ b/src/qml/types/qqmltimer.cpp
@@ -60,8 +60,8 @@ public:
: interval(1000), running(false), repeating(false), triggeredOnStart(false)
, classBegun(false), componentComplete(false), firstTick(true), awaitingTick(false) {}
- virtual void animationFinished(QAbstractAnimationJob *);
- virtual void animationCurrentLoopChanged(QAbstractAnimationJob *) { maybeTick(); }
+ void animationFinished(QAbstractAnimationJob *) override;
+ void animationCurrentLoopChanged(QAbstractAnimationJob *) override { maybeTick(); }
void maybeTick() {
Q_Q(QQmlTimer);
diff --git a/src/qml/types/qqmltimer_p.h b/src/qml/types/qqmltimer_p.h
index 7ea2f098bf..7739dad2a6 100644
--- a/src/qml/types/qqmltimer_p.h
+++ b/src/qml/types/qqmltimer_p.h
@@ -87,10 +87,10 @@ public:
void setTriggeredOnStart(bool triggeredOnStart);
protected:
- void classBegin();
- void componentComplete();
+ void classBegin() override;
+ void componentComplete() override;
- bool event(QEvent *);
+ bool event(QEvent *) override;
public Q_SLOTS:
void start();
diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp
index 78e7776c9b..cdcc894da9 100644
--- a/src/qml/types/qquickworkerscript.cpp
+++ b/src/qml/types/qquickworkerscript.cpp
@@ -145,7 +145,7 @@ public:
void init();
#if QT_CONFIG(qml_network)
- virtual QNetworkAccessManager *networkAccessManager();
+ QNetworkAccessManager *networkAccessManager() override;
#endif
QQuickWorkerScriptEnginePrivate *p;
@@ -192,7 +192,7 @@ signals:
void stopThread();
protected:
- virtual bool event(QEvent *);
+ bool event(QEvent *) override;
private:
void processMessage(int, const QByteArray &);
diff --git a/src/qml/types/qquickworkerscript_p.h b/src/qml/types/qquickworkerscript_p.h
index de6f3dc324..dce3acc3e1 100644
--- a/src/qml/types/qquickworkerscript_p.h
+++ b/src/qml/types/qquickworkerscript_p.h
@@ -68,7 +68,7 @@ class QQuickWorkerScriptEngine : public QThread
Q_OBJECT
public:
QQuickWorkerScriptEngine(QQmlEngine *parent = 0);
- virtual ~QQuickWorkerScriptEngine();
+ ~QQuickWorkerScriptEngine();
int registerWorkerScript(QQuickWorkerScript *);
void removeWorkerScript(int);
@@ -76,7 +76,7 @@ public:
void sendMessage(int, const QByteArray &);
protected:
- virtual void run();
+ void run() override;
private:
QQuickWorkerScriptEnginePrivate *d;
@@ -92,7 +92,7 @@ class Q_AUTOTEST_EXPORT QQuickWorkerScript : public QObject, public QQmlParserSt
Q_INTERFACES(QQmlParserStatus)
public:
QQuickWorkerScript(QObject *parent = 0);
- virtual ~QQuickWorkerScript();
+ ~QQuickWorkerScript();
QUrl source() const;
void setSource(const QUrl &);
@@ -105,9 +105,9 @@ Q_SIGNALS:
void message(const QQmlV4Handle &messageObject);
protected:
- virtual void classBegin();
- virtual void componentComplete();
- virtual bool event(QEvent *);
+ void classBegin() override;
+ void componentComplete() override;
+ bool event(QEvent *) override;
private:
QQuickWorkerScriptEngine *engine();
diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp
index 5fc2444b7c..b9d312d41f 100644
--- a/src/qml/util/qqmladaptormodel.cpp
+++ b/src/qml/util/qqmladaptormodel.cpp
@@ -146,7 +146,7 @@ public:
bool changed = roles.isEmpty() && !watchedRoles.isEmpty();
if (!changed && !watchedRoles.isEmpty() && watchedRoleIds.isEmpty()) {
QList<int> roleIds;
- foreach (const QByteArray &r, watchedRoles) {
+ for (const QByteArray &r : watchedRoles) {
QHash<QByteArray, int>::const_iterator it = roleNames.find(r);
if (it != roleNames.end())
roleIds << it.value();
@@ -190,7 +190,7 @@ public:
VDMModelDelegateDataType *dataType = const_cast<VDMModelDelegateDataType *>(this);
dataType->watchedRoleIds.clear();
- foreach (const QByteArray &oldRole, oldRoles)
+ for (const QByteArray &oldRole : oldRoles)
dataType->watchedRoles.removeOne(oldRole);
dataType->watchedRoles += newRoles;
}
diff --git a/src/qml/util/qqmlchangeset.cpp b/src/qml/util/qqmlchangeset.cpp
index 088ac5e8c0..79e3332331 100644
--- a/src/qml/util/qqmlchangeset.cpp
+++ b/src/qml/util/qqmlchangeset.cpp
@@ -558,9 +558,15 @@ void QQmlChangeSet::change(QVector<Change> *changes)
QDebug operator <<(QDebug debug, const QQmlChangeSet &set)
{
debug.nospace() << "QQmlChangeSet(";
- foreach (const QQmlChangeSet::Change &remove, set.removes()) debug << remove;
- foreach (const QQmlChangeSet::Change &insert, set.inserts()) debug << insert;
- foreach (const QQmlChangeSet::Change &change, set.changes()) debug << change;
+ const QVector<QQmlChangeSet::Change> &removes = set.removes();
+ for (const QQmlChangeSet::Change &remove : removes)
+ debug << remove;
+ const QVector<QQmlChangeSet::Change> &inserts = set.inserts();
+ for (const QQmlChangeSet::Change &insert : inserts)
+ debug << insert;
+ const QVector<QQmlChangeSet::Change> &changes = set.changes();
+ for (const QQmlChangeSet::Change &change : changes)
+ debug << change;
return debug.nospace() << ')';
}
diff --git a/src/qml/util/qqmllistcompositor.cpp b/src/qml/util/qqmllistcompositor.cpp
index 4cfdf77b2a..05a4eaac39 100644
--- a/src/qml/util/qqmllistcompositor.cpp
+++ b/src/qml/util/qqmllistcompositor.cpp
@@ -964,7 +964,7 @@ void QQmlListCompositor::listItemsInserted(
it.incrementIndexes(it->count);
continue;
}
- foreach (const QQmlChangeSet::Change &insertion, insertions) {
+ for (const QQmlChangeSet::Change &insertion : insertions) {
int offset = insertion.index - it->index;
if ((offset > 0 && offset < it->count)
|| (offset == 0 && it->prepend())
@@ -1301,7 +1301,7 @@ void QQmlListCompositor::listItemsChanged(
} else if (!it->inGroup()) {
continue;
}
- foreach (const QQmlChangeSet::Change &change, changes) {
+ for (const QQmlChangeSet::Change &change : changes) {
const int offset = change.index - it->index;
if (offset + change.count > 0 && offset < it->count) {
const int changeOffset = qMax(0, offset);
diff --git a/src/qml/util/qqmlpropertymap.cpp b/src/qml/util/qqmlpropertymap.cpp
index 69d3fc25e1..6e6554f2c3 100644
--- a/src/qml/util/qqmlpropertymap.cpp
+++ b/src/qml/util/qqmlpropertymap.cpp
@@ -54,10 +54,10 @@ public:
QQmlPropertyMapMetaObject(QQmlPropertyMap *obj, QQmlPropertyMapPrivate *objPriv, const QMetaObject *staticMetaObject);
protected:
- virtual QVariant propertyWriteValue(int, const QVariant &);
- virtual void propertyWritten(int index);
- virtual void propertyCreated(int, QMetaPropertyBuilder &);
- virtual int createProperty(const char *, const char *);
+ QVariant propertyWriteValue(int, const QVariant &) override;
+ void propertyWritten(int index) override;
+ void propertyCreated(int, QMetaPropertyBuilder &) override;
+ int createProperty(const char *, const char *) override;
const QString &propertyName(int index);
diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp
index 679201732a..7a2ec30a5a 100644
--- a/src/qmltest/quicktestevent.cpp
+++ b/src/qmltest/quicktestevent.cpp
@@ -325,6 +325,10 @@ bool QuickTestEvent::mouseMove
QWindow *QuickTestEvent::eventWindow(QObject *item)
{
+ QWindow * window = qobject_cast<QWindow *>(item);
+ if (window)
+ return window;
+
QQuickItem *quickItem = qobject_cast<QQuickItem *>(item);
if (quickItem)
return quickItem->window();
diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp
index dd78b82dcb..02d925d37d 100644
--- a/src/qmltest/quicktestresult.cpp
+++ b/src/qmltest/quicktestresult.cpp
@@ -524,7 +524,7 @@ void QuickTestResult::stringify(QQmlV4Function *args)
if (result.isEmpty()) {
QString tmp = value->toQStringNoThrow();
if (value->as<QV4::ArrayObject>())
- result.append(QString::fromLatin1("[%1]").arg(tmp));
+ result += QLatin1Char('[') + tmp + QLatin1Char(']');
else
result.append(tmp);
}
diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp
index acea958e20..58eab508ad 100644
--- a/src/quick/accessible/qaccessiblequickitem.cpp
+++ b/src/quick/accessible/qaccessiblequickitem.cpp
@@ -273,8 +273,8 @@ void QAccessibleQuickItem::doAction(const QString &actionName)
return;
// Look for and call the accessible[actionName]Action() function on the item.
// This allows for overriding the default action handling.
- const QByteArray functionName = QByteArrayLiteral("accessible") + actionName.toLatin1() + QByteArrayLiteral("Action");
- if (object()->metaObject()->indexOfMethod(QByteArray(functionName + QByteArrayLiteral("()"))) != -1) {
+ const QByteArray functionName = "accessible" + actionName.toLatin1() + "Action";
+ if (object()->metaObject()->indexOfMethod(QByteArray(functionName + "()")) != -1) {
QMetaObject::invokeMethod(object(), functionName);
return;
}
diff --git a/src/quick/accessible/qaccessiblequickview_p.h b/src/quick/accessible/qaccessiblequickview_p.h
index 457e8b456b..e9c150ac22 100644
--- a/src/quick/accessible/qaccessiblequickview_p.h
+++ b/src/quick/accessible/qaccessiblequickview_p.h
@@ -63,20 +63,20 @@ class QAccessibleQuickWindow : public QAccessibleObject
public:
QAccessibleQuickWindow(QQuickWindow *object);
- QAccessibleInterface *parent() const;
- QAccessibleInterface *child(int index) const;
+ QAccessibleInterface *parent() const override;
+ QAccessibleInterface *child(int index) const override;
- QAccessible::Role role() const;
- QAccessible::State state() const;
- QRect rect() const;
+ QAccessible::Role role() const override;
+ QAccessible::State state() const override;
+ QRect rect() const override;
- int childCount() const;
- int indexOfChild(const QAccessibleInterface *iface) const;
- QString text(QAccessible::Text text) const;
- QAccessibleInterface *childAt(int x, int y) const;
+ int childCount() const override;
+ int indexOfChild(const QAccessibleInterface *iface) const override;
+ QString text(QAccessible::Text text) const override;
+ QAccessibleInterface *childAt(int x, int y) const override;
private:
- QQuickWindow *window() const { return static_cast<QQuickWindow*>(object()); }
+ QQuickWindow *window() const override { return static_cast<QQuickWindow*>(object()); }
QList<QQuickItem *> rootItems() const;
};
diff --git a/src/quick/designer/qqmldesignermetaobject_p.h b/src/quick/designer/qqmldesignermetaobject_p.h
index 01512f6af0..3c02c0d3f5 100644
--- a/src/quick/designer/qqmldesignermetaobject_p.h
+++ b/src/quick/designer/qqmldesignermetaobject_p.h
@@ -74,7 +74,7 @@ protected:
void createNewDynamicProperty(const QString &name);
int openMetaCall(QObject *o, QMetaObject::Call _c, int _id, void **_a);
- int metaCall(QObject *o, QMetaObject::Call _c, int _id, void **_a);
+ int metaCall(QObject *o, QMetaObject::Call _c, int _id, void **_a) override;
void notifyPropertyChange(int id);
void setValue(int id, const QVariant &value);
QVariant propertyWriteValue(int, const QVariant &);
diff --git a/src/quick/designer/qquickdesignerwindowmanager_p.h b/src/quick/designer/qquickdesignerwindowmanager_p.h
index a50f8aa49f..209d703d0a 100644
--- a/src/quick/designer/qquickdesignerwindowmanager_p.h
+++ b/src/quick/designer/qquickdesignerwindowmanager_p.h
@@ -75,24 +75,24 @@ class QQuickDesignerWindowManager : public QSGRenderLoop
public:
QQuickDesignerWindowManager();
- void show(QQuickWindow *window);
- void hide(QQuickWindow *window);
+ void show(QQuickWindow *window) override;
+ void hide(QQuickWindow *window) override;
- void windowDestroyed(QQuickWindow *window);
+ void windowDestroyed(QQuickWindow *window) override;
void makeOpenGLContext(QQuickWindow *window);
- void exposureChanged(QQuickWindow *window);
- QImage grab(QQuickWindow *window);
+ void exposureChanged(QQuickWindow *window) override;
+ QImage grab(QQuickWindow *window) override;
- void maybeUpdate(QQuickWindow *window);
- void update(QQuickWindow *window); // identical for this implementation.
+ void maybeUpdate(QQuickWindow *window) override;
+ void update(QQuickWindow *window) override; // identical for this implementation.
- void releaseResources(QQuickWindow *) { }
+ void releaseResources(QQuickWindow *) override { }
- QAnimationDriver *animationDriver() const { return 0; }
+ QAnimationDriver *animationDriver() const override { return nullptr; }
- QSGContext *sceneGraphContext() const;
- QSGRenderContext *createRenderContext(QSGContext *) const { return m_renderContext.data(); }
+ QSGContext *sceneGraphContext() const override;
+ QSGRenderContext *createRenderContext(QSGContext *) const override { return m_renderContext.data(); }
static void createOpenGLContext(QQuickWindow *window);
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index 3b2b125c63..368a2b78d1 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -1095,6 +1095,23 @@ QImage QQuickCanvasItem::toImage(const QRectF& rect) const
return QImage();
}
+static const char* mimeToType(const QString &mime)
+{
+ if (mime == QLatin1String("image/png"))
+ return "PNG";
+ else if (mime == QLatin1String("image/bmp"))
+ return "BMP";
+ else if (mime == QLatin1String("image/jpeg"))
+ return "JPEG";
+ else if (mime == QLatin1String("image/x-portable-pixmap"))
+ return "PPM";
+ else if (mime == QLatin1String("image/tiff"))
+ return "TIFF";
+ else if (mime == QLatin1String("image/xpm"))
+ return "XPM";
+ return nullptr;
+}
+
/*!
\qmlmethod string QtQuick::Canvas::toDataURL(string mimeType)
@@ -1112,27 +1129,14 @@ QString QQuickCanvasItem::toDataURL(const QString& mimeType) const
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
- QString mime = mimeType.toLower();
- QString type;
- if (mime == QLatin1String("image/png")) {
- type = QStringLiteral("PNG");
- } else if (mime == QLatin1String("image/bmp"))
- type = QStringLiteral("BMP");
- else if (mime == QLatin1String("image/jpeg"))
- type = QStringLiteral("JPEG");
- else if (mime == QLatin1String("image/x-portable-pixmap"))
- type = QStringLiteral("PPM");
- else if (mime == QLatin1String("image/tiff"))
- type = QStringLiteral("TIFF");
- else if (mime == QLatin1String("image/xpm"))
- type = QStringLiteral("XPM");
- else
+ const QString mime = mimeType.toLower();
+ const char* type = mimeToType(mime);
+ if (!type)
return QStringLiteral("data:,");
- image.save(&buffer, type.toLatin1());
+ image.save(&buffer, type);
buffer.close();
- QString dataUrl = QStringLiteral("data:%1;base64,%2");
- return dataUrl.arg(mime).arg(QLatin1String(ba.toBase64().constData()));
+ return QLatin1String("data:") + mime + QLatin1String(";base64,") + QLatin1String(ba.toBase64().constData());
}
return QStringLiteral("data:,");
}
diff --git a/src/quick/items/context2d/qquickcanvasitem_p.h b/src/quick/items/context2d/qquickcanvasitem_p.h
index 8196debef1..8af84d0e7c 100644
--- a/src/quick/items/context2d/qquickcanvasitem_p.h
+++ b/src/quick/items/context2d/qquickcanvasitem_p.h
@@ -195,7 +195,7 @@ private:
Q_INVOKABLE void delayedCreate();
bool createContext(const QString &contextType);
void initializeContext(QQuickCanvasContext *context, const QVariantMap &args = QVariantMap());
- QRect tiledRect(const QRectF &window, const QSize &tileSize);
+ static QRect tiledRect(const QRectF &window, const QSize &tileSize);
bool isPaintConnected();
};
diff --git a/src/quick/items/context2d/qquickcontext2d_p.h b/src/quick/items/context2d/qquickcontext2d_p.h
index e897263b6f..334bf08329 100644
--- a/src/quick/items/context2d/qquickcontext2d_p.h
+++ b/src/quick/items/context2d/qquickcontext2d_p.h
@@ -184,17 +184,17 @@ public:
QQuickContext2D(QObject *parent = 0);
~QQuickContext2D();
- QStringList contextNames() const;
- void init(QQuickCanvasItem *canvasItem, const QVariantMap &args);
- void prepare(const QSize& canvasSize, const QSize& tileSize, const QRect& canvasWindow, const QRect& dirtyRect, bool smooth, bool antialiasing);
- void flush();
+ QStringList contextNames() const override;
+ void init(QQuickCanvasItem *canvasItem, const QVariantMap &args) override;
+ void prepare(const QSize& canvasSize, const QSize& tileSize, const QRect& canvasWindow, const QRect& dirtyRect, bool smooth, bool antialiasing) override;
+ void flush() override;
void sync();
QThread *thread() const { return m_thread; }
QQuickContext2DTexture *texture() const;
- QImage toImage(const QRectF& bounds);
+ QImage toImage(const QRectF& bounds) override;
- QV4::ReturnedValue v4value() const;
- void setV4Engine(QV4::ExecutionEngine *eng);
+ QV4::ReturnedValue v4value() const override;
+ void setV4Engine(QV4::ExecutionEngine *eng) override;
QQuickCanvasItem* canvas() const { return m_canvas; }
QQuickContext2DCommandBuffer* buffer() const { return m_buffer; }
@@ -243,8 +243,8 @@ public:
QPainterPath createTextGlyphs(qreal x, qreal y, const QString& text);
QQmlRefPointer<QQuickCanvasPixmap> createPixmap(const QUrl& url);
- QOpenGLContext *glContext() { return m_glContext; }
- QSurface *surface() { return m_surface.data(); }
+ QOpenGLContext *glContext() const { return m_glContext; }
+ QSurface *surface() const { return m_surface.data(); }
void setGrabbedImage(const QImage& grab);
State state;
diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h b/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h
index 3663e49f10..2a1ac7304e 100644
--- a/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h
+++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h
@@ -71,7 +71,7 @@ public:
void reset();
void clear();
- inline int size() {return commands.size();}
+ inline int size() const { return commands.size(); }
inline bool isEmpty() const {return commands.isEmpty(); }
inline bool hasNext() const {return cmdIdx < commands.size(); }
inline QQuickContext2D::PaintCommand takeNextCommand() { return commands.at(cmdIdx++); }
@@ -249,7 +249,7 @@ public:
void replay(QPainter* painter, QQuickContext2D::State& state, const QVector2D &scaleFactor);
private:
- QPen makePen(const QQuickContext2D::State& state);
+ static QPen makePen(const QQuickContext2D::State& state);
void setPainterState(QPainter* painter, const QQuickContext2D::State& state, const QPen& pen);
int cmdIdx;
int intIdx;
diff --git a/src/quick/items/context2d/qquickcontext2dtexture_p.h b/src/quick/items/context2d/qquickcontext2dtexture_p.h
index 6a5d4e8b09..678e33826d 100644
--- a/src/quick/items/context2d/qquickcontext2dtexture_p.h
+++ b/src/quick/items/context2d/qquickcontext2dtexture_p.h
@@ -124,7 +124,7 @@ public:
// Called during sync() on the scene graph thread while GUI is blocked.
virtual QSGTexture *textureForNextFrame(QSGTexture *lastFrame, QQuickWindow *window) = 0;
- bool event(QEvent *e);
+ bool event(QEvent *e) override;
#ifndef QT_NO_OPENGL
void initializeOpenGL(QOpenGLContext *gl, QOffscreenSurface *s) {
m_gl = gl;
@@ -225,17 +225,17 @@ public:
QQuickContext2DImageTexture();
~QQuickContext2DImageTexture();
- virtual QQuickCanvasItem::RenderTarget renderTarget() const;
+ QQuickCanvasItem::RenderTarget renderTarget() const override;
- virtual QQuickContext2DTile* createTile() const;
- virtual QPaintDevice* beginPainting();
- virtual void endPainting();
- virtual void compositeTile(QQuickContext2DTile* tile);
+ QQuickContext2DTile* createTile() const override;
+ QPaintDevice* beginPainting() override;
+ void endPainting() override;
+ void compositeTile(QQuickContext2DTile* tile) override;
- virtual QSGTexture *textureForNextFrame(QSGTexture *lastFrame, QQuickWindow *window);
+ QSGTexture *textureForNextFrame(QSGTexture *lastFrame, QQuickWindow *window) override;
public Q_SLOTS:
- virtual void grabImage(const QRectF& region = QRectF());
+ void grabImage(const QRectF& region = QRectF()) override;
private:
QImage m_image;
diff --git a/src/quick/items/context2d/qquickcontext2dtile_p.h b/src/quick/items/context2d/qquickcontext2dtile_p.h
index 2f3fdeb54f..02238a882b 100644
--- a/src/quick/items/context2d/qquickcontext2dtile_p.h
+++ b/src/quick/items/context2d/qquickcontext2dtile_p.h
@@ -93,12 +93,12 @@ class QQuickContext2DFBOTile : public QQuickContext2DTile
public:
QQuickContext2DFBOTile();
~QQuickContext2DFBOTile();
- virtual void setRect(const QRect& r);
+ virtual void setRect(const QRect& r) override;
QOpenGLFramebufferObject* fbo() const {return m_fbo;}
- void drawFinished();
+ void drawFinished() override;
protected:
- void aboutToDraw();
+ void aboutToDraw() override;
private:
@@ -110,7 +110,7 @@ class QQuickContext2DImageTile : public QQuickContext2DTile
public:
QQuickContext2DImageTile();
~QQuickContext2DImageTile();
- void setRect(const QRect& r);
+ void setRect(const QRect& r) override;
const QImage& image() const {return m_image;}
private:
QImage m_image;
diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h
index 2c209ae664..7054d9d9c9 100644
--- a/src/quick/items/qquickaccessibleattached_p.h
+++ b/src/quick/items/qquickaccessibleattached_p.h
@@ -203,7 +203,7 @@ public:
return object;
}
- QAccessible::State state() { return m_state; }
+ QAccessible::State state() const { return m_state; }
bool ignored() const;
bool doAction(const QString &actionName);
void availableActions(QStringList *actions) const;
diff --git a/src/quick/items/qquickanchors.cpp b/src/quick/items/qquickanchors.cpp
index b6978e534e..a7a4a2b882 100644
--- a/src/quick/items/qquickanchors.cpp
+++ b/src/quick/items/qquickanchors.cpp
@@ -285,7 +285,7 @@ void QQuickAnchorsPrivate::clearItem(QQuickItem *item)
}
}
-QQuickGeometryChange QQuickAnchorsPrivate::calculateDependency(QQuickItem *controlItem)
+QQuickGeometryChange QQuickAnchorsPrivate::calculateDependency(QQuickItem *controlItem) const
{
QQuickGeometryChange dependency;
@@ -588,7 +588,7 @@ bool QQuickAnchorsPrivate::calcStretch(QQuickItem *edge1Item,
qreal offset1,
qreal offset2,
QQuickAnchors::Anchor line,
- qreal &stretch)
+ qreal &stretch) const
{
bool edge1IsParent = (edge1Item == readParentItem(item));
bool edge2IsParent = (edge2Item == readParentItem(item));
diff --git a/src/quick/items/qquickanchors_p_p.h b/src/quick/items/qquickanchors_p_p.h
index 3357e134bf..221b4ccb40 100644
--- a/src/quick/items/qquickanchors_p_p.h
+++ b/src/quick/items/qquickanchors_p_p.h
@@ -124,7 +124,7 @@ public:
void clearItem(QQuickItem *);
- QQuickGeometryChange calculateDependency(QQuickItem *);
+ QQuickGeometryChange calculateDependency(QQuickItem *) const;
void addDepend(QQuickItem *);
void remDepend(QQuickItem *);
bool isItemComplete() const;
@@ -150,7 +150,7 @@ public:
bool checkVAnchorValid(QQuickAnchorLine anchor) const;
bool calcStretch(QQuickItem *edge1Item, QQuickAnchors::Anchor edge1Line,
QQuickItem *edge2Item, QQuickAnchors::Anchor edge2Line,
- qreal offset1, qreal offset2, QQuickAnchors::Anchor line, qreal &stretch);
+ qreal offset1, qreal offset2, QQuickAnchors::Anchor line, qreal &stretch) const;
bool isMirrored() const;
void updateHorizontalAnchors();
diff --git a/src/quick/items/qquickdrag_p.h b/src/quick/items/qquickdrag_p.h
index 17721251d9..f9faca55e0 100644
--- a/src/quick/items/qquickdrag_p.h
+++ b/src/quick/items/qquickdrag_p.h
@@ -290,7 +290,7 @@ public:
Q_INVOKABLE int drop();
- bool event(QEvent *event);
+ bool event(QEvent *event) override;
public Q_SLOTS:
void start(QQmlV4Function *);
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp
index 8dcc13971e..70d76c99a1 100644
--- a/src/quick/items/qquickdroparea.cpp
+++ b/src/quick/items/qquickdroparea.cpp
@@ -513,7 +513,7 @@ void QQuickDropArea::dropEvent(QDropEvent *event)
easily be translated into a QByteArray. \a format should be one contained in the \l formats property.
*/
-QObject *QQuickDropEvent::source()
+QObject *QQuickDropEvent::source() const
{
if (const QQuickDragMimeData *dragMime = qobject_cast<const QQuickDragMimeData *>(event->mimeData()))
return dragMime->source();
diff --git a/src/quick/items/qquickdroparea_p.h b/src/quick/items/qquickdroparea_p.h
index d3b37979da..ecd4da4367 100644
--- a/src/quick/items/qquickdroparea_p.h
+++ b/src/quick/items/qquickdroparea_p.h
@@ -86,7 +86,7 @@ public:
qreal x() const { return event->pos().x(); }
qreal y() const { return event->pos().y(); }
- QObject *source();
+ QObject *source() const;
Qt::DropActions supportedActions() const { return event->possibleActions(); }
Qt::DropActions proposedAction() const { return event->proposedAction(); }
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index a5497f4627..2fad9f5a8d 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -945,7 +945,7 @@ Q_QUICK_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const QQuickEventPoint *eve
dbg << "QQuickEventPoint(valid:" << event->isValid() << " accepted:" << event->isAccepted()
<< " state:";
QtDebugUtils::formatQEnum(dbg, event->state());
- dbg << " scenePos:" << event->scenePos() << " id:" << event->pointId()
+ dbg << " scenePos:" << event->scenePos() << " id:" << hex << event->pointId() << dec
<< " timeHeld:" << event->timeHeld() << ')';
return dbg;
}
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 12b01b8aaf..26959ef584 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -277,7 +277,7 @@ void QQuickFlickablePrivate::init()
Returns the amount to overshoot by given a velocity.
Will be roughly in range 0 - size/4
*/
-qreal QQuickFlickablePrivate::overShootDistance(qreal size)
+qreal QQuickFlickablePrivate::overShootDistance(qreal size) const
{
if (maxVelocity <= 0)
return 0.0;
@@ -874,9 +874,9 @@ bool QQuickFlickable::isAtYBeginning() const
}
\endcode
*/
-QQuickItem *QQuickFlickable::contentItem()
+QQuickItem *QQuickFlickable::contentItem() const
{
- Q_D(QQuickFlickable);
+ Q_D(const QQuickFlickable);
return d->contentItem;
}
@@ -951,7 +951,7 @@ void QQuickFlickable::setPixelAligned(bool align)
}
}
-qint64 QQuickFlickablePrivate::computeCurrentTime(QInputEvent *event)
+qint64 QQuickFlickablePrivate::computeCurrentTime(QInputEvent *event) const
{
if (0 != event->timestamp())
return event->timestamp();
@@ -960,7 +960,7 @@ qint64 QQuickFlickablePrivate::computeCurrentTime(QInputEvent *event)
return timer.elapsed();
}
-qreal QQuickFlickablePrivate::devicePixelRatio()
+qreal QQuickFlickablePrivate::devicePixelRatio() const
{
return (window ? window->effectiveDevicePixelRatio() : qApp->devicePixelRatio());
}
diff --git a/src/quick/items/qquickflickable_p.h b/src/quick/items/qquickflickable_p.h
index 610bfd1427..2da4781f37 100644
--- a/src/quick/items/qquickflickable_p.h
+++ b/src/quick/items/qquickflickable_p.h
@@ -190,7 +190,7 @@ public:
bool isAtYEnd() const;
bool isAtYBeginning() const;
- QQuickItem *contentItem();
+ QQuickItem *contentItem() const;
enum FlickableDirection { AutoFlickDirection=0x0, HorizontalFlick=0x1, VerticalFlick=0x2, HorizontalAndVerticalFlick=0x3,
AutoFlickIfNeeded=0xc };
diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h
index ac1e39d829..0c3bc21071 100644
--- a/src/quick/items/qquickflickable_p_p.h
+++ b/src/quick/items/qquickflickable_p_p.h
@@ -192,7 +192,7 @@ public:
void setViewportX(qreal x);
void setViewportY(qreal y);
- qreal overShootDistance(qreal size);
+ qreal overShootDistance(qreal size) const;
void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &) Q_DECL_OVERRIDE;
@@ -260,8 +260,8 @@ public:
const QVector2D &deltas, bool overThreshold, bool momentum,
bool velocitySensitiveOverBounds, const QVector2D &velocity);
- qint64 computeCurrentTime(QInputEvent *event);
- qreal devicePixelRatio();
+ qint64 computeCurrentTime(QInputEvent *event) const;
+ qreal devicePixelRatio() const;
// flickableData property
static void data_append(QQmlListProperty<QObject> *, QObject *);
diff --git a/src/quick/items/qquickflipable.cpp b/src/quick/items/qquickflipable.cpp
index 342e6c07b8..6a6b6c00a9 100644
--- a/src/quick/items/qquickflipable.cpp
+++ b/src/quick/items/qquickflipable.cpp
@@ -143,7 +143,7 @@ QQuickFlipable::~QQuickFlipable()
The front and back sides of the flipable.
*/
-QQuickItem *QQuickFlipable::front()
+QQuickItem *QQuickFlipable::front() const
{
Q_D(const QQuickFlipable);
return d->front;
diff --git a/src/quick/items/qquickflipable_p.h b/src/quick/items/qquickflipable_p.h
index 17a74d1f7a..a76977d4ac 100644
--- a/src/quick/items/qquickflipable_p.h
+++ b/src/quick/items/qquickflipable_p.h
@@ -77,7 +77,7 @@ public:
QQuickFlipable(QQuickItem *parent=0);
~QQuickFlipable();
- QQuickItem *front();
+ QQuickItem *front() const;
void setFront(QQuickItem *);
QQuickItem *back();
diff --git a/src/quick/items/qquickgenericshadereffect.cpp b/src/quick/items/qquickgenericshadereffect.cpp
index 9714f39663..2f8d71fc11 100644
--- a/src/quick/items/qquickgenericshadereffect.cpp
+++ b/src/quick/items/qquickgenericshadereffect.cpp
@@ -510,9 +510,9 @@ void QQuickGenericShaderEffect::updateShaderVars(Shader shaderType)
QSGShaderEffectNode::VariableData &vd(m_shaders[shaderType].varData[i]);
const bool isSpecial = v.name.startsWith("qt_"); // special names not mapped to properties
if (isSpecial) {
- if (v.name == QByteArrayLiteral("qt_Opacity"))
+ if (v.name == "qt_Opacity")
vd.specialType = QSGShaderEffectNode::VariableData::Opacity;
- else if (v.name == QByteArrayLiteral("qt_Matrix"))
+ else if (v.name == "qt_Matrix")
vd.specialType = QSGShaderEffectNode::VariableData::Matrix;
else if (v.name.startsWith("qt_SubRect_"))
vd.specialType = QSGShaderEffectNode::VariableData::SubRect;
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp
index e36c070248..a53d068597 100644
--- a/src/quick/items/qquickimage.cpp
+++ b/src/quick/items/qquickimage.cpp
@@ -69,7 +69,7 @@ public:
emit textureChanged();
}
- QSGTexture *texture() const {
+ QSGTexture *texture() const override {
if (m_texture) {
m_texture->setFiltering(m_smooth ? QSGTexture::Linear : QSGTexture::Nearest);
m_texture->setMipmapFiltering(m_mipmap ? QSGTexture::Linear : QSGTexture::None);
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index e219e9b34e..cbe1bac5c9 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -774,7 +774,7 @@ const SigMap sigMap[] = {
{ 0, 0 }
};
-const QByteArray QQuickKeysAttached::keyToSignal(int key)
+QByteArray QQuickKeysAttached::keyToSignal(int key)
{
QByteArray keySignal;
if (key >= Qt::Key_0 && key <= Qt::Key_9) {
@@ -789,9 +789,9 @@ const QByteArray QQuickKeysAttached::keyToSignal(int key)
return keySignal;
}
-bool QQuickKeysAttached::isConnected(const char *signalName)
+bool QQuickKeysAttached::isConnected(const char *signalName) const
{
- Q_D(QQuickKeysAttached);
+ Q_D(const QQuickKeysAttached);
int signal_index = d->signalIndex(signalName);
return d->isSignalConnected(signal_index);
}
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index 4bff293657..7781c94f95 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -861,9 +861,9 @@ private:
void inputMethodEvent(QInputMethodEvent *, bool post) Q_DECL_OVERRIDE;
QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
#endif
- const QByteArray keyToSignal(int key);
+ static QByteArray keyToSignal(int key);
- bool isConnected(const char *signalName);
+ bool isConnected(const char *signalName) const;
};
Qt::MouseButtons QQuickItemPrivate::acceptedMouseButtons() const
diff --git a/src/quick/items/qquickitemanimation_p_p.h b/src/quick/items/qquickitemanimation_p_p.h
index 92dd84e4a9..2d075dfab3 100644
--- a/src/quick/items/qquickitemanimation_p_p.h
+++ b/src/quick/items/qquickitemanimation_p_p.h
@@ -97,7 +97,7 @@ public:
entryInterval(0), exitInterval(0) {}
~QQuickPathAnimationUpdater() {}
- void setValue(qreal v);
+ void setValue(qreal v) override;
QQuickPath *path;
@@ -133,7 +133,7 @@ public:
void clearTemplate() { animationTemplate = 0; }
- QQuickPathAnimationUpdater *pathUpdater() { return static_cast<QQuickPathAnimationUpdater*>(getAnimValue()); }
+ QQuickPathAnimationUpdater *pathUpdater() const { return static_cast<QQuickPathAnimationUpdater*>(getAnimValue()); }
private:
QQuickPathAnimationPrivate *animationTemplate;
};
diff --git a/src/quick/items/qquickitemgrabresult.cpp b/src/quick/items/qquickitemgrabresult.cpp
index 1b0e1f07f6..c6355ceed2 100644
--- a/src/quick/items/qquickitemgrabresult.cpp
+++ b/src/quick/items/qquickitemgrabresult.cpp
@@ -184,13 +184,26 @@ QQuickItemGrabResult::QQuickItemGrabResult(QObject *parent)
/*!
* Saves the grab result as an image to \a fileName. Returns true
* if successful; otherwise returns false.
+ *
+ * \note In Qt versions prior to 5.9, this function is marked as non-\c{const}.
*/
-bool QQuickItemGrabResult::saveToFile(const QString &fileName)
+bool QQuickItemGrabResult::saveToFile(const QString &fileName) const
{
- Q_D(QQuickItemGrabResult);
+ Q_D(const QQuickItemGrabResult);
return d->image.save(fileName);
}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+/*!
+ * \overload
+ * \internal
+ */
+bool QQuickItemGrabResult::saveToFile(const QString &fileName)
+{
+ return qAsConst(*this).saveToFile(fileName);
+}
+#endif // < Qt 6
+
QUrl QQuickItemGrabResult::url() const
{
Q_D(const QQuickItemGrabResult);
diff --git a/src/quick/items/qquickitemgrabresult.h b/src/quick/items/qquickitemgrabresult.h
index 42d71862de..30f8f0c2ef 100644
--- a/src/quick/items/qquickitemgrabresult.h
+++ b/src/quick/items/qquickitemgrabresult.h
@@ -64,10 +64,13 @@ public:
QImage image() const;
QUrl url() const;
- Q_INVOKABLE bool saveToFile(const QString &fileName);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ Q_INVOKABLE bool saveToFile(const QString &fileName); // ### Qt 6: remove
+#endif
+ Q_INVOKABLE bool saveToFile(const QString &fileName) const;
protected:
- bool event(QEvent *);
+ bool event(QEvent *) override;
Q_SIGNALS:
void ready();
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index e017d6564a..d02ed07de0 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -935,9 +935,11 @@ void QQuickItemViewPrivate::positionViewAtIndex(int index, int mode)
return;
applyPendingChanges();
- int idx = qMax(qMin(index, model->count()-1), 0);
+ const int modelCount = model->count();
+ int idx = qMax(qMin(index, modelCount - 1), 0);
- qreal pos = isContentFlowReversed() ? -position() - size() : position();
+ const auto viewSize = size();
+ qreal pos = isContentFlowReversed() ? -position() - viewSize : position();
FxViewItem *item = visibleItem(idx);
qreal maxExtent = calculatedMaxExtent();
if (!item) {
@@ -961,22 +963,22 @@ void QQuickItemViewPrivate::positionViewAtIndex(int index, int mode)
pos -= headerSize();
break;
case QQuickItemView::Center:
- pos = itemPos - (size() - item->size())/2;
+ pos = itemPos - (viewSize - item->size())/2;
break;
case QQuickItemView::End:
- pos = itemPos - size() + item->size();
- if (footer && (index >= model->count() || hasStickyFooter()))
+ pos = itemPos - viewSize + item->size();
+ if (footer && (index >= modelCount || hasStickyFooter()))
pos += footerSize();
break;
case QQuickItemView::Visible:
- if (itemPos > pos + size())
- pos = itemPos - size() + item->size();
+ if (itemPos > pos + viewSize)
+ pos = itemPos - viewSize + item->size();
else if (item->endPosition() <= pos)
pos = itemPos;
break;
case QQuickItemView::Contain:
- if (item->endPosition() >= pos + size())
- pos = itemPos - size() + item->size();
+ if (item->endPosition() >= pos + viewSize)
+ pos = itemPos - viewSize + item->size();
if (itemPos < pos)
pos = itemPos;
break;
@@ -1025,28 +1027,27 @@ void QQuickItemView::positionViewAtEnd()
d->positionViewAtIndex(d->model->count(), End);
}
-int QQuickItemView::indexAt(qreal x, qreal y) const
+static FxViewItem * fxViewItemAtPosition(const QList<FxViewItem *> &items, qreal x, qreal y)
{
- Q_D(const QQuickItemView);
- for (int i = 0; i < d->visibleItems.count(); ++i) {
- const FxViewItem *item = d->visibleItems.at(i);
+ for (FxViewItem *item : items) {
if (item->contains(x, y))
- return item->index;
+ return item;
}
+ return nullptr;
+}
- return -1;
+int QQuickItemView::indexAt(qreal x, qreal y) const
+{
+ Q_D(const QQuickItemView);
+ const FxViewItem *item = fxViewItemAtPosition(d->visibleItems, x, y);
+ return item ? item->index : -1;
}
QQuickItem *QQuickItemView::itemAt(qreal x, qreal y) const
{
Q_D(const QQuickItemView);
- for (int i = 0; i < d->visibleItems.count(); ++i) {
- const FxViewItem *item = d->visibleItems.at(i);
- if (item->contains(x, y))
- return item->item;
- }
-
- return 0;
+ const FxViewItem *item = fxViewItemAtPosition(d->visibleItems, x, y);
+ return item ? item->item : nullptr;
}
void QQuickItemView::forceLayout()
@@ -1787,10 +1788,11 @@ void QQuickItemViewPrivate::animationFinished(QAbstractAnimationJob *)
void QQuickItemViewPrivate::refill()
{
qreal s = qMax(size(), qreal(0.));
+ const auto pos = position();
if (isContentFlowReversed())
- refill(-position()-displayMarginBeginning-s, -position()+displayMarginEnd);
+ refill(-pos - displayMarginBeginning-s, -pos + displayMarginEnd);
else
- refill(position()-displayMarginBeginning, position()+displayMarginEnd+s);
+ refill(pos - displayMarginBeginning, pos + displayMarginEnd+s);
}
void QQuickItemViewPrivate::refill(qreal from, qreal to)
@@ -2428,14 +2430,14 @@ bool QQuickItemViewPrivate::releaseItem(FxViewItem *item)
return flags != QQmlInstanceModel::Referenced;
}
-QQuickItem *QQuickItemViewPrivate::createHighlightItem()
+QQuickItem *QQuickItemViewPrivate::createHighlightItem() const
{
return createComponentItem(highlightComponent, 0.0, true);
}
-QQuickItem *QQuickItemViewPrivate::createComponentItem(QQmlComponent *component, qreal zValue, bool createDefault)
+QQuickItem *QQuickItemViewPrivate::createComponentItem(QQmlComponent *component, qreal zValue, bool createDefault) const
{
- Q_Q(QQuickItemView);
+ Q_Q(const QQuickItemView);
QQuickItem *item = 0;
if (component) {
diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h
index c289ace408..3ac54ea3dc 100644
--- a/src/quick/items/qquickitemview_p.h
+++ b/src/quick/items/qquickitemview_p.h
@@ -316,7 +316,7 @@ public:
: QObject(parent), m_isCurrent(false), m_delayRemove(false) {}
~QQuickItemViewAttached() {}
- QQuickItemView *view() { return m_view; }
+ QQuickItemView *view() const { return m_view; }
void setView(QQuickItemView *view) {
if (view != m_view) {
m_view = view;
diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h
index 62851c9a89..a8e66301c1 100644
--- a/src/quick/items/qquickitemview_p_p.h
+++ b/src/quick/items/qquickitemview_p_p.h
@@ -209,8 +209,8 @@ public:
FxViewItem *createItem(int modelIndex, bool asynchronous = false);
virtual bool releaseItem(FxViewItem *item);
- QQuickItem *createHighlightItem();
- QQuickItem *createComponentItem(QQmlComponent *component, qreal zValue, bool createDefault = false);
+ QQuickItem *createHighlightItem() const;
+ QQuickItem *createComponentItem(QQmlComponent *component, qreal zValue, bool createDefault = false) const;
void updateCurrent(int modelIndex);
void updateTrackedItem();
diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp
index 6d2421c3df..83c451613e 100644
--- a/src/quick/items/qquickitemviewtransition.cpp
+++ b/src/quick/items/qquickitemviewtransition.cpp
@@ -246,7 +246,7 @@ void QQuickItemViewTransitioner::resetTargetLists()
moveTransitionTargets.clear();
}
-QQuickTransition *QQuickItemViewTransitioner::transitionObject(QQuickItemViewTransitioner::TransitionType type, bool asTarget)
+QQuickTransition *QQuickItemViewTransitioner::transitionObject(QQuickItemViewTransitioner::TransitionType type, bool asTarget) const
{
if (type == QQuickItemViewTransitioner::NoTransition)
return 0;
diff --git a/src/quick/items/qquickitemviewtransition_p.h b/src/quick/items/qquickitemviewtransition_p.h
index ff0e82ac7b..3d2f5361b1 100644
--- a/src/quick/items/qquickitemviewtransition_p.h
+++ b/src/quick/items/qquickitemviewtransition_p.h
@@ -97,7 +97,7 @@ public:
void addToTargetLists(QQuickItemViewTransitioner::TransitionType type, QQuickItemViewTransitionableItem *item, int index);
void resetTargetLists();
- QQuickTransition *transitionObject(QQuickItemViewTransitioner::TransitionType type, bool asTarget);
+ QQuickTransition *transitionObject(QQuickItemViewTransitioner::TransitionType type, bool asTarget) const;
const QList<int> &targetIndexes(QQuickItemViewTransitioner::TransitionType type) const;
const QList<QObject *> &targetItems(QQuickItemViewTransitioner::TransitionType type) const;
diff --git a/src/quick/items/qquicklistview_p.h b/src/quick/items/qquicklistview_p.h
index 8d0ad7f618..3a871e88e9 100644
--- a/src/quick/items/qquicklistview_p.h
+++ b/src/quick/items/qquicklistview_p.h
@@ -88,7 +88,7 @@ public:
enum LabelPositioning { InlineLabels = 0x01, CurrentLabelAtStart = 0x02, NextLabelAtEnd = 0x04 };
Q_ENUM(LabelPositioning)
- int labelPositioning() { return m_labelPositioning; }
+ int labelPositioning() const { return m_labelPositioning; }
void setLabelPositioning(int pos);
Q_SIGNALS:
diff --git a/src/quick/items/qquickloader_p_p.h b/src/quick/items/qquickloader_p_p.h
index fcccbfe4f5..a0a9ca0601 100644
--- a/src/quick/items/qquickloader_p_p.h
+++ b/src/quick/items/qquickloader_p_p.h
@@ -94,7 +94,7 @@ public:
void incubatorStateChanged(QQmlIncubator::Status status);
void setInitialState(QObject *o);
void disposeInitialPropertyValues();
- QUrl resolveSourceUrl(QQmlV4Function *args);
+ static QUrl resolveSourceUrl(QQmlV4Function *args);
QV4::ReturnedValue extractInitialPropertyValues(QQmlV4Function *args, QObject *loader, bool *error);
qreal getImplicitWidth() const Q_DECL_OVERRIDE;
diff --git a/src/quick/items/qquickopenglshadereffect.cpp b/src/quick/items/qquickopenglshadereffect.cpp
index b974641cca..42fcee3c0d 100644
--- a/src/quick/items/qquickopenglshadereffect.cpp
+++ b/src/quick/items/qquickopenglshadereffect.cpp
@@ -284,14 +284,14 @@ void QQuickOpenGLShaderEffectCommon::updateParseLog(bool ignoreAttributes)
parseLog.clear();
if (!ignoreAttributes) {
if (!attributes.contains(qtPositionAttributeName())) {
- parseLog += QLatin1String("Warning: Missing reference to \'");
- parseLog += QLatin1String(qtPositionAttributeName());
- parseLog += QLatin1String("\'.\n");
+ parseLog += QLatin1String("Warning: Missing reference to \'")
+ + QLatin1String(qtPositionAttributeName())
+ + QLatin1String("\'.\n");
}
if (!attributes.contains(qtTexCoordAttributeName())) {
- parseLog += QLatin1String("Warning: Missing reference to \'");
- parseLog += QLatin1String(qtTexCoordAttributeName());
- parseLog += QLatin1String("\'.\n");
+ parseLog += QLatin1String("Warning: Missing reference to \'")
+ + QLatin1String(qtTexCoordAttributeName())
+ + QLatin1String("\'.\n");
}
}
bool respectsMatrix = false;
@@ -918,9 +918,7 @@ QSGNode *QQuickOpenGLShaderEffect::handleUpdatePaintNode(QSGNode *oldNode, QQuic
if (!mesh->validateAttributes(m_common.attributes, &posIndex)) {
QString log = mesh->log();
if (!log.isNull()) {
- m_log = parseLog();
- m_log += QLatin1String("*** Mesh ***\n");
- m_log += log;
+ m_log = parseLog() + QLatin1String("*** Mesh ***\n") + log;
m_status = QQuickShaderEffect::Error;
emit m_item->logChanged();
emit m_item->statusChanged();
diff --git a/src/quick/items/qquickopenglshadereffectnode.cpp b/src/quick/items/qquickopenglshadereffectnode.cpp
index 02b76b2dbc..e01ecc59e3 100644
--- a/src/quick/items/qquickopenglshadereffectnode.cpp
+++ b/src/quick/items/qquickopenglshadereffectnode.cpp
@@ -261,13 +261,11 @@ void QQuickCustomMaterialShader::compile()
m_log.clear();
m_compiled = true;
if (!program()->addShaderFromSourceCode(QOpenGLShader::Vertex, vertexShader())) {
- m_log += QLatin1String("*** Vertex shader ***\n");
- m_log += program()->log();
+ m_log += QLatin1String("*** Vertex shader ***\n") + program()->log();
m_compiled = false;
}
if (!program()->addShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShader())) {
- m_log += QLatin1String("*** Fragment shader ***\n");
- m_log += program()->log();
+ m_log += QLatin1String("*** Fragment shader ***\n") + program()->log();
m_compiled = false;
}
diff --git a/src/quick/items/qquickpainteditem.cpp b/src/quick/items/qquickpainteditem.cpp
index 1ef8de753d..e565fceab8 100644
--- a/src/quick/items/qquickpainteditem.cpp
+++ b/src/quick/items/qquickpainteditem.cpp
@@ -53,7 +53,7 @@ class QQuickPaintedItemTextureProvider : public QSGTextureProvider
{
public:
QSGPainterNode *node;
- QSGTexture *texture() const { return node ? node->texture() : 0; }
+ QSGTexture *texture() const override { return node ? node->texture() : 0; }
void fireTextureChanged() { emit textureChanged(); }
};
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index e54ee66fe5..11881ae0ab 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -63,13 +63,7 @@ Q_DECLARE_LOGGING_CATEGORY(lcItemViewDelegateLifecycle)
const qreal MinimumFlickVelocity = 75.0;
-inline qreal qmlMod(qreal x, qreal y)
-{
- using std::fmod;
- return fmod(x, y);
-}
-
-static QQmlOpenMetaObjectType *qPathViewAttachedType = 0;
+static QQmlOpenMetaObjectType *qPathViewAttachedType = nullptr;
QQuickPathViewAttached::QQuickPathViewAttached(QObject *parent)
: QObject(parent), m_percent(-1), m_view(0), m_onPath(false), m_isCurrent(false)
@@ -96,7 +90,7 @@ void QQuickPathViewAttached::setValue(const QByteArray &name, const QVariant &va
}
QQuickPathViewPrivate::QQuickPathViewPrivate()
- : path(0), currentIndex(0), currentItemOffset(0.0), startPc(0)
+ : path(nullptr), currentIndex(0), currentItemOffset(0.0), startPc(0)
, offset(0.0), offsetAdj(0.0), mappedRange(1.0), mappedCache(0.0)
, stealMouse(false), ownModel(false), interactive(true), haveHighlightRange(true)
, autoHighlight(true), highlightUp(false), layoutScheduled(false)
@@ -106,7 +100,7 @@ QQuickPathViewPrivate::QQuickPathViewPrivate()
, moveOffset(this, &QQuickPathViewPrivate::setAdjustedOffset), flickDuration(0)
, pathItems(-1), requestedIndex(-1), cacheSize(0), requestedZ(0)
, moveReason(Other), movementDirection(QQuickPathView::Shortest), moveDirection(QQuickPathView::Shortest)
- , attType(0), highlightComponent(0), highlightItem(0)
+ , attType(nullptr), highlightComponent(nullptr), highlightItem(nullptr)
, moveHighlight(this, &QQuickPathViewPrivate::setHighlightPosition)
, highlightPosition(0)
, highlightRangeStart(0), highlightRangeEnd(0)
@@ -163,7 +157,7 @@ void QQuickPathView::createdItem(int index, QObject *object)
if (d->requestedIndex != index) {
qPathViewAttachedType = d->attachedType();
QQuickPathViewAttached *att = static_cast<QQuickPathViewAttached *>(qmlAttachedPropertiesObject<QQuickPathView>(item));
- qPathViewAttachedType = 0;
+ qPathViewAttachedType = nullptr;
if (att) {
att->m_view = this;
att->setOnPath(false);
@@ -186,7 +180,7 @@ void QQuickPathView::initItem(int index, QObject *object)
item->setParentItem(this);
qPathViewAttachedType = d->attachedType();
QQuickPathViewAttached *att = static_cast<QQuickPathViewAttached *>(qmlAttachedPropertiesObject<QQuickPathView>(item));
- qPathViewAttachedType = 0;
+ qPathViewAttachedType = nullptr;
if (att) {
att->m_view = this;
qreal percent = d->positionOfIndex(index);
@@ -215,7 +209,7 @@ void QQuickPathViewPrivate::releaseItem(QQuickItem *item)
att->setOnPath(false);
} else if (flags & QQmlInstanceModel::Destroyed) {
// but we still reference it
- item->setParentItem(0);
+ item->setParentItem(nullptr);
}
}
@@ -244,7 +238,7 @@ void QQuickPathViewPrivate::clear()
{
if (currentItem) {
releaseItem(currentItem);
- currentItem = 0;
+ currentItem = nullptr;
}
for (QQuickItem *p : qAsConst(items))
releaseItem(p);
@@ -280,13 +274,13 @@ qreal QQuickPathViewPrivate::positionOfIndex(qreal index) const
|| snapMode != QQuickPathView::NoSnap))
start = highlightRangeStart;
qreal globalPos = index + offset;
- globalPos = qmlMod(globalPos, qreal(modelCount)) / modelCount;
+ globalPos = std::fmod(globalPos, qreal(modelCount)) / modelCount;
if (pathItems != -1 && pathItems < modelCount) {
globalPos += start / mappedRange;
- globalPos = qmlMod(globalPos, 1.0);
+ globalPos = std::fmod(globalPos, qreal(1.0));
pos = globalPos * mappedRange;
} else {
- pos = qmlMod(globalPos + start, 1.0);
+ pos = std::fmod(globalPos + start, qreal(1.0));
}
}
@@ -315,13 +309,13 @@ void QQuickPathViewPrivate::createHighlight()
bool changed = false;
if (highlightItem) {
- highlightItem->setParentItem(0);
+ highlightItem->setParentItem(nullptr);
highlightItem->deleteLater();
- highlightItem = 0;
+ highlightItem = nullptr;
changed = true;
}
- QQuickItem *item = 0;
+ QQuickItem *item = nullptr;
if (highlightComponent) {
QQmlContext *creationContext = highlightComponent->creationContext();
QQmlContext *highlightContext = new QQmlContext(
@@ -397,7 +391,7 @@ void QQuickPathViewPrivate::setHighlightPosition(qreal pos)
qreal range = qreal(modelCount);
// calc normalized position of highlight relative to offset
- qreal relativeHighlight = qmlMod(pos + offset, range) / range;
+ qreal relativeHighlight = std::fmod(pos + offset, range) / range;
if (!highlightUp && relativeHighlight > end / mappedRange) {
qreal diff = 1.0 - relativeHighlight;
@@ -636,7 +630,7 @@ void QQuickPathView::setModel(const QVariant &m)
d->modelVariant = model;
QObject *object = qvariant_cast<QObject*>(model);
- QQmlInstanceModel *vim = 0;
+ QQmlInstanceModel *vim = nullptr;
if (object && (vim = qobject_cast<QQmlInstanceModel *>(object))) {
if (d->ownModel) {
delete d->model;
@@ -716,7 +710,7 @@ void QQuickPathView::setPath(QQuickPath *path)
d->clear();
if (d->attType) {
d->attType->release();
- d->attType = 0;
+ d->attType = nullptr;
}
d->regenerate();
}
@@ -755,7 +749,7 @@ void QQuickPathView::setCurrentIndex(int idx)
}
int oldCurrentIdx = d->currentIndex;
QQuickItem *oldCurrentItem = d->currentItem;
- d->currentItem = 0;
+ d->currentItem = nullptr;
d->moveReason = QQuickPathViewPrivate::SetIndex;
d->currentIndex = idx;
if (d->modelCount) {
@@ -836,7 +830,7 @@ void QQuickPathViewPrivate::setOffset(qreal o)
if (offset != o) {
if (isValid() && q->isComponentComplete()) {
qreal oldOffset = offset;
- offset = qmlMod(o, qreal(modelCount));
+ offset = std::fmod(o, qreal(modelCount));
if (offset < 0)
offset += qreal(modelCount);
qCDebug(lcItemViewDelegateLifecycle) << o << "was" << oldOffset << "now" << offset;
@@ -902,7 +896,7 @@ void QQuickPathView::setHighlight(QQmlComponent *highlight)
\sa highlight
*/
-QQuickItem *QQuickPathView::highlightItem()
+QQuickItem *QQuickPathView::highlightItem() const
{
Q_D(const QQuickPathView);
return d->highlightItem;
@@ -1237,7 +1231,7 @@ QQmlComponent *QQuickPathView::delegate() const
return dataModel->delegate();
}
- return 0;
+ return nullptr;
}
void QQuickPathView::setDelegate(QQmlComponent *delegate)
@@ -1468,7 +1462,7 @@ void QQuickPathView::positionViewAtIndex(int index, int mode)
// Small offset since the last point coincides with the first and
// this the only "end" position that gives the expected visual result.
qreal adj = sizeof(qreal) == sizeof(float) ? 0.00001f : 0.000000000001;
- endOffset = qmlMod(beginOffset + count, d->modelCount) - adj;
+ endOffset = std::fmod(beginOffset + count, qreal(d->modelCount)) - adj;
}
qreal offset = d->offset;
switch (mode) {
@@ -1489,8 +1483,8 @@ void QQuickPathView::positionViewAtIndex(int index, int mode)
case Contain:
if ((beginOffset < endOffset && (d->offset < beginOffset || d->offset > endOffset))
|| (d->offset < beginOffset && d->offset > endOffset)) {
- qreal diff1 = qmlMod(beginOffset - d->offset + d->modelCount, d->modelCount);
- qreal diff2 = qmlMod(d->offset - endOffset + d->modelCount, d->modelCount);
+ qreal diff1 = std::fmod(beginOffset - d->offset + d->modelCount, qreal(d->modelCount));
+ qreal diff2 = std::fmod(d->offset - endOffset + d->modelCount, qreal(d->modelCount));
if (diff1 < diff2)
offset = beginOffset;
else
@@ -1518,7 +1512,7 @@ int QQuickPathView::indexAt(qreal x, qreal y) const
{
Q_D(const QQuickPathView);
QQuickItem *item = itemAt(x, y);
- return item ? d->model->indexOf(item, 0) : -1;
+ return item ? d->model->indexOf(item, nullptr) : -1;
}
/*!
@@ -1533,7 +1527,7 @@ QQuickItem *QQuickPathView::itemAt(qreal x, qreal y) const
{
Q_D(const QQuickPathView);
if (!d->isValid())
- return 0;
+ return nullptr;
for (QQuickItem *item : d->items) {
QPointF p = item->mapFromItem(this, QPointF(x, y));
@@ -1541,7 +1535,7 @@ QQuickItem *QQuickPathView::itemAt(qreal x, qreal y) const
return item;
}
- return 0;
+ return nullptr;
}
QPointF QQuickPathViewPrivate::pointNear(const QPointF &point, qreal *nearPercent) const
@@ -1606,7 +1600,7 @@ qreal QQuickPathViewPrivate::calcVelocity() const
return velocity;
}
-qint64 QQuickPathViewPrivate::computeCurrentTime(QInputEvent *event)
+qint64 QQuickPathViewPrivate::computeCurrentTime(QInputEvent *event) const
{
if (0 != event->timestamp())
return event->timestamp();
@@ -1810,7 +1804,7 @@ bool QQuickPathView::sendMouseEvent(QMouseEvent *event)
QPointF localPos = mapFromScene(event->windowPos());
QQuickWindow *c = window();
- QQuickItem *grabber = c ? c->mouseGrabberItem() : 0;
+ QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr;
if (grabber == this && d->stealMouse) {
// we are already the grabber and we do want the mouse event to ourselves.
return true;
@@ -1836,7 +1830,7 @@ bool QQuickPathView::sendMouseEvent(QMouseEvent *event)
default:
break;
}
- grabber = c ? c->mouseGrabberItem() : 0;
+ grabber = c ? c->mouseGrabberItem() : nullptr;
if ((grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) || grabberDisabled) {
grabMouse();
}
@@ -1915,7 +1909,7 @@ void QQuickPathView::componentComplete()
if (d->model) {
d->modelCount = d->model->count();
if (d->modelCount && d->currentIndex != 0) // an initial value has been provided for currentIndex
- d->offset = qmlMod(d->modelCount - currentIndexRemainder(d->currentIndex, d->modelCount), d->modelCount);
+ d->offset = std::fmod(qreal(d->modelCount - currentIndexRemainder(d->currentIndex, d->modelCount)), qreal(d->modelCount));
}
d->createHighlight();
@@ -1951,7 +1945,7 @@ void QQuickPathView::refill()
QList<QQuickItem*>::iterator it = d->items.begin();
while (it != d->items.end()) {
QQuickItem *item = *it;
- int idx = d->model->indexOf(item, 0);
+ int idx = d->model->indexOf(item, nullptr);
qreal pos = d->positionOfIndex(idx);
if (lcItemViewDelegateLifecycle().isDebugEnabled()) {
QQuickText *text = qmlobject_cast<QQuickText*>(item);
@@ -1996,7 +1990,7 @@ void QQuickPathView::refill()
startPos = 2.0;
for (QQuickItem * item : qAsConst(d->items)) {
- int idx = d->model->indexOf(item, 0);
+ int idx = d->model->indexOf(item, nullptr);
qreal curPos = d->positionOfIndex(idx);
if (curPos > endPos) {
endPos = curPos;
@@ -2198,7 +2192,7 @@ void QQuickPathView::modelUpdated(const QQmlChangeSet &changeSet, bool reset)
if (QQuickPathViewAttached *att = d->attached(d->currentItem))
att->setIsCurrentItem(true);
d->releaseItem(d->currentItem);
- d->currentItem = 0;
+ d->currentItem = nullptr;
}
d->currentIndex = qMin(r.index, d->modelCount - r.count - 1);
currentChanged = true;
@@ -2231,7 +2225,7 @@ void QQuickPathView::modelUpdated(const QQmlChangeSet &changeSet, bool reset)
d->modelCount += i.count;
}
- d->offset = qmlMod(d->offset, d->modelCount);
+ d->offset = std::fmod(d->offset, qreal(d->modelCount));
if (d->offset < 0)
d->offset += d->modelCount;
if (d->currentIndex == -1)
@@ -2249,7 +2243,7 @@ void QQuickPathView::modelUpdated(const QQmlChangeSet &changeSet, bool reset)
d->tl.reset(d->moveOffset);
} else {
if (!d->flicking && !d->moving && d->haveHighlightRange && d->highlightRangeMode == QQuickPathView::StrictlyEnforceRange) {
- d->offset = qmlMod(d->modelCount - d->currentIndex, d->modelCount);
+ d->offset = std::fmod(qreal(d->modelCount - d->currentIndex), qreal(d->modelCount));
changedOffset = true;
}
d->updateMappedRange();
@@ -2295,10 +2289,10 @@ int QQuickPathViewPrivate::calcCurrentIndex()
{
int current = 0;
if (modelCount && model && items.count()) {
- offset = qmlMod(offset, modelCount);
+ offset = std::fmod(offset, qreal(modelCount));
if (offset < 0)
offset += modelCount;
- current = qRound(qAbs(qmlMod(modelCount - offset, modelCount)));
+ current = qRound(qAbs(std::fmod(modelCount - offset, qreal(modelCount))));
current = current % modelCount;
}
@@ -2312,7 +2306,7 @@ void QQuickPathViewPrivate::createCurrentItem()
bool inItems = false;
for (QQuickItem *item : qAsConst(items)) {
- if (model->indexOf(item, 0) == currentIndex) {
+ if (model->indexOf(item, nullptr) == currentIndex) {
inItems = true;
break;
}
@@ -2350,7 +2344,7 @@ void QQuickPathViewPrivate::updateCurrent()
}
int oldCurrentIndex = currentIndex;
currentIndex = idx;
- currentItem = 0;
+ currentItem = nullptr;
createCurrentItem();
if (oldCurrentIndex != currentIndex)
emit q->currentIndexChanged();
@@ -2383,7 +2377,7 @@ void QQuickPathViewPrivate::snapToIndex(int index, MovementReason reason)
if (!model || modelCount <= 0)
return;
- qreal targetOffset = qmlMod(modelCount - index, modelCount);
+ qreal targetOffset = std::fmod(qreal(modelCount - index), qreal(modelCount));
if (offset == targetOffset)
return;
diff --git a/src/quick/items/qquickpathview_p.h b/src/quick/items/qquickpathview_p.h
index a44d1be5c4..669ef60ef7 100644
--- a/src/quick/items/qquickpathview_p.h
+++ b/src/quick/items/qquickpathview_p.h
@@ -102,7 +102,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathView : public QQuickItem
Q_PROPERTY(int cacheItemCount READ cacheItemCount WRITE setCacheItemCount NOTIFY cacheItemCountChanged)
public:
- QQuickPathView(QQuickItem *parent=0);
+ QQuickPathView(QQuickItem *parent = nullptr);
virtual ~QQuickPathView();
QVariant model() const;
@@ -121,7 +121,7 @@ public:
QQmlComponent *highlight() const;
void setHighlight(QQmlComponent *highlight);
- QQuickItem *highlightItem();
+ QQuickItem *highlightItem() const;
enum HighlightRangeMode { NoHighlightRange, ApplyRange, StrictlyEnforceRange };
Q_ENUM(HighlightRangeMode)
@@ -259,7 +259,7 @@ public:
QQuickPathViewAttached(QObject *parent);
~QQuickPathViewAttached();
- QQuickPathView *view() { return m_view; }
+ QQuickPathView *view() const { return m_view; }
bool isCurrentItem() const { return m_isCurrent; }
void setIsCurrentItem(bool c) {
diff --git a/src/quick/items/qquickpathview_p_p.h b/src/quick/items/qquickpathview_p_p.h
index 64abe3d1dc..082f427f2c 100644
--- a/src/quick/items/qquickpathview_p_p.h
+++ b/src/quick/items/qquickpathview_p_p.h
@@ -129,7 +129,7 @@ public:
QPointF pointNear(const QPointF &point, qreal *nearPercent=0) const;
void addVelocitySample(qreal v);
qreal calcVelocity() const;
- qint64 computeCurrentTime(QInputEvent *event);
+ qint64 computeCurrentTime(QInputEvent *event) const;
void setDragging(bool d);
QQuickPath *path;
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index 5d01a2af9d..9347b55c70 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -207,100 +207,181 @@ QT_BEGIN_NAMESPACE
By default it is set to the value of the QScreen that the window uses.
*/
-QQuickScreenAttached::QQuickScreenAttached(QObject* attachee)
- : QObject(attachee)
- , m_screen(NULL)
- , m_window(NULL)
- , m_updateMask(0)
- , m_updateMaskSet(false)
+QQuickScreenInfo::QQuickScreenInfo(QObject *parent)
+ : QObject(parent),
+ m_screen(nullptr)
{
- m_attachee = qobject_cast<QQuickItem*>(attachee);
-
- if (m_attachee) {
- QQuickItemPrivate::get(m_attachee)->extra.value().screenAttached = this;
-
- if (m_attachee->window()) //It might not be assigned to a window yet
- windowChanged(m_attachee->window());
- } else {
- QQuickWindow *window = qobject_cast<QQuickWindow*>(attachee);
- if (window)
- windowChanged(window);
- }
-
- if (!m_screen)
- screenChanged(QGuiApplication::primaryScreen());
}
-QString QQuickScreenAttached::name() const
+QString QQuickScreenInfo::name() const
{
if (!m_screen)
return QString();
return m_screen->name();
}
-int QQuickScreenAttached::width() const
+int QQuickScreenInfo::width() const
{
if (!m_screen)
return 0;
return m_screen->size().width();
}
-int QQuickScreenAttached::height() const
+int QQuickScreenInfo::height() const
{
if (!m_screen)
return 0;
return m_screen->size().height();
}
-int QQuickScreenAttached::desktopAvailableWidth() const
+int QQuickScreenInfo::desktopAvailableWidth() const
{
if (!m_screen)
return 0;
return m_screen->availableVirtualSize().width();
}
-int QQuickScreenAttached::desktopAvailableHeight() const
+int QQuickScreenInfo::desktopAvailableHeight() const
{
if (!m_screen)
return 0;
return m_screen->availableVirtualSize().height();
}
-qreal QQuickScreenAttached::logicalPixelDensity() const
+qreal QQuickScreenInfo::logicalPixelDensity() const
{
if (!m_screen)
return 0.0;
return m_screen->logicalDotsPerInch() / 25.4;
}
-qreal QQuickScreenAttached::pixelDensity() const
+qreal QQuickScreenInfo::pixelDensity() const
{
if (!m_screen)
return 0.0;
return m_screen->physicalDotsPerInch() / 25.4;
}
-qreal QQuickScreenAttached::devicePixelRatio() const
+qreal QQuickScreenInfo::devicePixelRatio() const
{
if (!m_screen)
return 1.0;
return m_screen->devicePixelRatio();
}
-Qt::ScreenOrientation QQuickScreenAttached::primaryOrientation() const
+Qt::ScreenOrientation QQuickScreenInfo::primaryOrientation() const
{
if (!m_screen)
return Qt::PrimaryOrientation;
return m_screen->primaryOrientation();
}
-Qt::ScreenOrientation QQuickScreenAttached::orientation() const
+Qt::ScreenOrientation QQuickScreenInfo::orientation() const
{
if (!m_screen)
return Qt::PrimaryOrientation;
return m_screen->orientation();
}
+int QQuickScreenInfo::virtualX() const
+{
+ if (!m_screen)
+ return 0;
+ return m_screen->geometry().topLeft().x();
+}
+
+int QQuickScreenInfo::virtualY() const
+{
+ if (!m_screen)
+ return 0;
+ return m_screen->geometry().topLeft().y();
+}
+
+void QQuickScreenInfo::setWrappedScreen(QScreen *screen)
+{
+ if (screen == m_screen)
+ return;
+
+ QScreen *oldScreen = m_screen;
+ m_screen = screen;
+
+ if (oldScreen)
+ oldScreen->disconnect(this);
+
+ if (!screen) //Don't bother emitting signals, because the new values are garbage anyways
+ return;
+
+ if (!oldScreen || screen->geometry() != oldScreen->geometry()) {
+ emit virtualXChanged();
+ emit virtualYChanged();
+ }
+ if (!oldScreen || screen->size() != oldScreen->size()) {
+ emit widthChanged();
+ emit heightChanged();
+ }
+ if (!oldScreen || screen->name() != oldScreen->name())
+ emit nameChanged();
+ if (!oldScreen || screen->orientation() != oldScreen->orientation())
+ emit orientationChanged();
+ if (!oldScreen || screen->primaryOrientation() != oldScreen->primaryOrientation())
+ emit primaryOrientationChanged();
+ if (!oldScreen || screen->availableVirtualGeometry() != oldScreen->availableVirtualGeometry())
+ emit desktopGeometryChanged();
+ if (!oldScreen || screen->logicalDotsPerInch() != oldScreen->logicalDotsPerInch())
+ emit logicalPixelDensityChanged();
+ if (!oldScreen || screen->physicalDotsPerInch() != oldScreen->physicalDotsPerInch())
+ emit pixelDensityChanged();
+ if (!oldScreen || screen->devicePixelRatio() != oldScreen->devicePixelRatio())
+ emit devicePixelRatioChanged();
+
+ connect(screen, SIGNAL(geometryChanged(QRect)),
+ this, SIGNAL(widthChanged()));
+ connect(screen, SIGNAL(geometryChanged(QRect)),
+ this, SIGNAL(heightChanged()));
+ connect(screen, SIGNAL(geometryChanged(QRect)),
+ this, SIGNAL(virtualXChanged()));
+ connect(screen, SIGNAL(geometryChanged(QRect)),
+ this, SIGNAL(virtualYChanged()));
+ connect(screen, SIGNAL(orientationChanged(Qt::ScreenOrientation)),
+ this, SIGNAL(orientationChanged()));
+ connect(screen, SIGNAL(primaryOrientationChanged(Qt::ScreenOrientation)),
+ this, SIGNAL(primaryOrientationChanged()));
+ connect(screen, SIGNAL(virtualGeometryChanged(QRect)),
+ this, SIGNAL(desktopGeometryChanged()));
+ connect(screen, SIGNAL(logicalDotsPerInchChanged(qreal)),
+ this, SIGNAL(logicalPixelDensityChanged()));
+ connect(screen, SIGNAL(physicalDotsPerInchChanged(qreal)),
+ this, SIGNAL(pixelDensityChanged()));
+}
+
+QScreen *QQuickScreenInfo::wrappedScreen() const
+{
+ return m_screen;
+}
+
+QQuickScreenAttached::QQuickScreenAttached(QObject* attachee)
+ : QQuickScreenInfo(attachee)
+ , m_window(NULL)
+ , m_updateMask(0)
+ , m_updateMaskSet(false)
+{
+ m_attachee = qobject_cast<QQuickItem*>(attachee);
+
+ if (m_attachee) {
+ QQuickItemPrivate::get(m_attachee)->extra.value().screenAttached = this;
+
+ if (m_attachee->window()) //It might not be assigned to a window yet
+ windowChanged(m_attachee->window());
+ } else {
+ QQuickWindow *window = qobject_cast<QQuickWindow*>(attachee);
+ if (window)
+ windowChanged(window);
+ }
+
+ if (!m_screen)
+ screenChanged(QGuiApplication::primaryScreen());
+}
+
Qt::ScreenOrientations QQuickScreenAttached::orientationUpdateMask() const
{
return m_updateMask;
@@ -341,55 +422,15 @@ void QQuickScreenAttached::screenChanged(QScreen *screen)
{
//qDebug() << "QQuickScreenAttached::screenChanged" << (screen ? screen->name() : QString::fromLatin1("null"));
if (screen != m_screen) {
- QScreen* oldScreen = m_screen;
- m_screen = screen;
-
- if (oldScreen)
- oldScreen->disconnect(this);
-
- if (!screen)
- return; //Don't bother emitting signals, because the new values are garbage anyways
-
+ setWrappedScreen(screen);
+ if (!m_screen)
+ return;
if (m_updateMaskSet) {
- screen->setOrientationUpdateMask(m_updateMask);
- } else if (m_updateMask != screen->orientationUpdateMask()) {
- m_updateMask = screen->orientationUpdateMask();
+ m_screen->setOrientationUpdateMask(m_updateMask);
+ } else if (m_updateMask != m_screen->orientationUpdateMask()) {
+ m_updateMask = m_screen->orientationUpdateMask();
emit orientationUpdateMaskChanged();
}
-
- if (!oldScreen || screen->size() != oldScreen->size()) {
- emit widthChanged();
- emit heightChanged();
- }
- if (!oldScreen || screen->name() != oldScreen->name())
- emit nameChanged();
- if (!oldScreen || screen->orientation() != oldScreen->orientation())
- emit orientationChanged();
- if (!oldScreen || screen->primaryOrientation() != oldScreen->primaryOrientation())
- emit primaryOrientationChanged();
- if (!oldScreen || screen->availableVirtualGeometry() != oldScreen->availableVirtualGeometry())
- emit desktopGeometryChanged();
- if (!oldScreen || screen->logicalDotsPerInch() != oldScreen->logicalDotsPerInch())
- emit logicalPixelDensityChanged();
- if (!oldScreen || screen->physicalDotsPerInch() != oldScreen->physicalDotsPerInch())
- emit pixelDensityChanged();
- if (!oldScreen || screen->devicePixelRatio() != oldScreen->devicePixelRatio())
- emit devicePixelRatioChanged();
-
- connect(screen, SIGNAL(geometryChanged(QRect)),
- this, SIGNAL(widthChanged()));
- connect(screen, SIGNAL(geometryChanged(QRect)),
- this, SIGNAL(heightChanged()));
- connect(screen, SIGNAL(orientationChanged(Qt::ScreenOrientation)),
- this, SIGNAL(orientationChanged()));
- connect(screen, SIGNAL(primaryOrientationChanged(Qt::ScreenOrientation)),
- this, SIGNAL(primaryOrientationChanged()));
- connect(screen, SIGNAL(virtualGeometryChanged(QRect)),
- this, SIGNAL(desktopGeometryChanged()));
- connect(screen, SIGNAL(logicalDotsPerInchChanged(qreal)),
- this, SIGNAL(logicalPixelDensityChanged()));
- connect(screen, SIGNAL(physicalDotsPerInchChanged(qreal)),
- this, SIGNAL(pixelDensityChanged()));
}
}
diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h
index 06d9a06070..06efb3ab45 100644
--- a/src/quick/items/qquickscreen_p.h
+++ b/src/quick/items/qquickscreen_p.h
@@ -63,10 +63,10 @@ class QQuickItem;
class QQuickWindow;
class QScreen;
-class Q_AUTOTEST_EXPORT QQuickScreenAttached : public QObject
+
+class Q_AUTOTEST_EXPORT QQuickScreenInfo : public QObject
{
Q_OBJECT
-
Q_PROPERTY(QString name READ name NOTIFY nameChanged)
Q_PROPERTY(int width READ width NOTIFY widthChanged)
Q_PROPERTY(int height READ height NOTIFY heightChanged)
@@ -79,11 +79,12 @@ class Q_AUTOTEST_EXPORT QQuickScreenAttached : public QObject
Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation NOTIFY primaryOrientationChanged)
// TODO Qt 6 Remove this orientation -> incomplete device orientation -> better use OrientationSensor
Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged)
- Q_PROPERTY(Qt::ScreenOrientations orientationUpdateMask READ orientationUpdateMask
- WRITE setOrientationUpdateMask NOTIFY orientationUpdateMaskChanged)
+
+ Q_PROPERTY(int virtualX READ virtualX NOTIFY virtualXChanged REVISION 1)
+ Q_PROPERTY(int virtualY READ virtualY NOTIFY virtualYChanged REVISION 1)
public:
- QQuickScreenAttached(QObject* attachee);
+ QQuickScreenInfo(QObject *parent = nullptr);
QString name() const;
int width() const;
@@ -95,13 +96,11 @@ public:
qreal devicePixelRatio() const;
Qt::ScreenOrientation primaryOrientation() const;
Qt::ScreenOrientation orientation() const;
- Qt::ScreenOrientations orientationUpdateMask() const;
- void setOrientationUpdateMask(Qt::ScreenOrientations mask);
+ int virtualX() const;
+ int virtualY() const;
- //Treats int as Qt::ScreenOrientation, due to QTBUG-20639
- Q_INVOKABLE int angleBetween(int a, int b);
-
- void windowChanged(QQuickWindow*);
+ void setWrappedScreen(QScreen *screen);
+ QScreen *wrappedScreen() const;
Q_SIGNALS:
void nameChanged();
@@ -113,13 +112,37 @@ Q_SIGNALS:
void devicePixelRatioChanged();
void primaryOrientationChanged();
void orientationChanged();
+ Q_REVISION(1) void virtualXChanged();
+ Q_REVISION(1) void virtualYChanged();
+
+protected:
+ QPointer<QScreen> m_screen;
+};
+
+class Q_AUTOTEST_EXPORT QQuickScreenAttached : public QQuickScreenInfo
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt::ScreenOrientations orientationUpdateMask READ orientationUpdateMask
+ WRITE setOrientationUpdateMask NOTIFY orientationUpdateMaskChanged)
+
+public:
+ QQuickScreenAttached(QObject* attachee);
+
+ Qt::ScreenOrientations orientationUpdateMask() const;
+ void setOrientationUpdateMask(Qt::ScreenOrientations mask);
+
+ //Treats int as Qt::ScreenOrientation, due to QTBUG-20639
+ Q_INVOKABLE int angleBetween(int a, int b);
+
+ void windowChanged(QQuickWindow*);
+
+Q_SIGNALS:
void orientationUpdateMaskChanged();
protected Q_SLOTS:
void screenChanged(QScreen*);
private:
- QPointer<QScreen> m_screen;
QQuickWindow* m_window;
QQuickItem* m_attachee;
Qt::ScreenOrientations m_updateMask;
@@ -136,5 +159,6 @@ public:
QT_END_NAMESPACE
QML_DECLARE_TYPEINFO(QQuickScreen, QML_HAS_ATTACHED_PROPERTIES)
+QML_DECLARE_TYPE(QQuickScreenInfo)
#endif
diff --git a/src/quick/items/qquickshadereffectmesh.cpp b/src/quick/items/qquickshadereffectmesh.cpp
index b572feb5ee..d23b576d42 100644
--- a/src/quick/items/qquickshadereffectmesh.cpp
+++ b/src/quick/items/qquickshadereffectmesh.cpp
@@ -95,9 +95,8 @@ bool QQuickGridMesh::validateAttributes(const QVector<QByteArray> &attributes, i
return false;
case 1:
if (positionIndex != 0) {
- m_log = QLatin1String("Error: Missing \'");
- m_log += QLatin1String(qtPositionAttributeName());
- m_log += QLatin1String("\' attribute.\n");
+ m_log = QLatin1String("Error: Missing \'") + QLatin1String(qtPositionAttributeName())
+ + QLatin1String("\' attribute.\n");
return false;
}
break;
@@ -105,14 +104,12 @@ bool QQuickGridMesh::validateAttributes(const QVector<QByteArray> &attributes, i
if (positionIndex == -1 || texCoordIndex == -1) {
m_log.clear();
if (positionIndex == -1) {
- m_log = QLatin1String("Error: Missing \'");
- m_log += QLatin1String(qtPositionAttributeName());
- m_log += QLatin1String("\' attribute.\n");
+ m_log = QLatin1String("Error: Missing \'") + QLatin1String(qtPositionAttributeName())
+ + QLatin1String("\' attribute.\n");
}
if (texCoordIndex == -1) {
- m_log += QLatin1String("Error: Missing \'");
- m_log += QLatin1String(qtTexCoordAttributeName());
- m_log += QLatin1String("\' attribute.\n");
+ m_log += QLatin1String("Error: Missing \'") + QLatin1String(qtTexCoordAttributeName())
+ + QLatin1String("\' attribute.\n");
}
return false;
}
@@ -367,7 +364,7 @@ QSGGeometry *QQuickBorderImageMesh::updateGeometry(QSGGeometry *geometry, int at
}
\endqml
*/
-QQuickScaleGrid *QQuickBorderImageMesh::border()
+QQuickScaleGrid *QQuickBorderImageMesh::border() const
{
return m_border;
}
diff --git a/src/quick/items/qquickshadereffectmesh_p.h b/src/quick/items/qquickshadereffectmesh_p.h
index cbf33b795f..aa3112b5a5 100644
--- a/src/quick/items/qquickshadereffectmesh_p.h
+++ b/src/quick/items/qquickshadereffectmesh_p.h
@@ -127,7 +127,7 @@ public:
QSGGeometry *updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex,
const QRectF &srcRect, const QRectF &rect) override;
- QQuickScaleGrid *border();
+ QQuickScaleGrid *border() const;
enum TileMode { Stretch = Qt::StretchTile, Repeat = Qt::RepeatTile, Round = Qt::RoundTile };
Q_ENUM(TileMode)
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp
index a60a06f59a..1b37a746d3 100644
--- a/src/quick/items/qquickshadereffectsource.cpp
+++ b/src/quick/items/qquickshadereffectsource.cpp
@@ -64,7 +64,7 @@ public:
{
}
- QSGTexture *texture() const {
+ QSGTexture *texture() const override {
sourceTexture->setMipmapFiltering(mipmapFiltering);
sourceTexture->setFiltering(filtering);
sourceTexture->setHorizontalWrapMode(horizontalWrap);
diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp
index 10e0d51709..74b04a75ad 100644
--- a/src/quick/items/qquickspriteengine.cpp
+++ b/src/quick/items/qquickspriteengine.cpp
@@ -323,13 +323,13 @@ void QQuickStochasticEngine::setGoal(int state, int sprite, bool jump)
return;
}
-QQuickPixmap::Status QQuickSpriteEngine::status()//Composed status of all Sprites
+QQuickPixmap::Status QQuickSpriteEngine::status() const //Composed status of all Sprites
{
if (!m_startedImageAssembly)
return QQuickPixmap::Null;
int null, loading, ready;
null = loading = ready = 0;
- for (QQuickSprite* s : qAsConst(m_sprites)) {
+ for (QQuickSprite* s : m_sprites) {
switch (s->m_pix.status()) {
// ### Maybe add an error message here, because this null shouldn't be reached but when it does, the image fails without an error message.
case QQuickPixmap::Null : null++; break;
diff --git a/src/quick/items/qquickspriteengine_p.h b/src/quick/items/qquickspriteengine_p.h
index cf50cd2d84..89de9ce4f2 100644
--- a/src/quick/items/qquickspriteengine_p.h
+++ b/src/quick/items/qquickspriteengine_p.h
@@ -293,11 +293,11 @@ public:
void advance(int index=0) Q_DECL_OVERRIDE;
//Similar API to QQuickPixmap for async loading convenience
- bool isNull() { return status() == QQuickPixmap::Null; }
- bool isReady() { return status() == QQuickPixmap::Ready; }
- bool isLoading() { return status() == QQuickPixmap::Loading; }
- bool isError() { return status() == QQuickPixmap::Error; }
- QQuickPixmap::Status status();//Composed status of all Sprites
+ bool isNull() const { return status() == QQuickPixmap::Null; }
+ bool isReady() const { return status() == QQuickPixmap::Ready; }
+ bool isLoading() const { return status() == QQuickPixmap::Loading; }
+ bool isError() const { return status() == QQuickPixmap::Error; }
+ QQuickPixmap::Status status() const; //Composed status of all Sprites
void startAssemblingImage();
QImage assembledImage(int maxSize = 2048);
diff --git a/src/quick/items/qquickstateoperations.cpp b/src/quick/items/qquickstateoperations.cpp
index 7e485c675c..9cd3b6a5f5 100644
--- a/src/quick/items/qquickstateoperations.cpp
+++ b/src/quick/items/qquickstateoperations.cpp
@@ -899,9 +899,9 @@ QQuickAnchorChanges::ActionList QQuickAnchorChanges::actions()
return ActionList() << a;
}
-QQuickAnchorSet *QQuickAnchorChanges::anchors()
+QQuickAnchorSet *QQuickAnchorChanges::anchors() const
{
- Q_D(QQuickAnchorChanges);
+ Q_D(const QQuickAnchorChanges);
return d->anchorSet;
}
@@ -1134,9 +1134,9 @@ QQuickStateActionEvent::EventType QQuickAnchorChanges::type() const
return AnchorChanges;
}
-QList<QQuickStateAction> QQuickAnchorChanges::additionalActions()
+QList<QQuickStateAction> QQuickAnchorChanges::additionalActions() const
{
- Q_D(QQuickAnchorChanges);
+ Q_D(const QQuickAnchorChanges);
QList<QQuickStateAction> extra;
QQuickAnchors::Anchors combined = d->anchorSet->d_func()->usedAnchors | d->anchorSet->d_func()->resetAnchors;
diff --git a/src/quick/items/qquickstateoperations_p.h b/src/quick/items/qquickstateoperations_p.h
index 29dec218fa..48b4b23a76 100644
--- a/src/quick/items/qquickstateoperations_p.h
+++ b/src/quick/items/qquickstateoperations_p.h
@@ -192,7 +192,7 @@ public:
ActionList actions() Q_DECL_OVERRIDE;
- QQuickAnchorSet *anchors();
+ QQuickAnchorSet *anchors() const;
QQuickItem *object() const;
void setObject(QQuickItem *);
@@ -210,7 +210,7 @@ public:
void rewind() Q_DECL_OVERRIDE;
void saveCurrentValues() Q_DECL_OVERRIDE;
- QList<QQuickStateAction> additionalActions();
+ QList<QQuickStateAction> additionalActions() const;
void saveTargetValues() Q_DECL_OVERRIDE;
};
diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp
index ef7485a8e9..fe29249934 100644
--- a/src/quick/items/qquicktextcontrol.cpp
+++ b/src/quick/items/qquicktextcontrol.cpp
@@ -1664,8 +1664,8 @@ void QQuickTextControl::insertFromMimeData(const QMimeData *source)
#ifndef QT_NO_TEXTHTMLPARSER
if (source->hasFormat(QLatin1String("application/x-qrichtext")) && d->acceptRichText) {
// x-qrichtext is always UTF-8 (taken from Qt3 since we don't use it anymore).
- QString richtext = QString::fromUtf8(source->data(QLatin1String("application/x-qrichtext")));
- richtext.prepend(QLatin1String("<meta name=\"qrichtext\" content=\"1\" />"));
+ const QString richtext = QLatin1String("<meta name=\"qrichtext\" content=\"1\" />")
+ + QString::fromUtf8(source->data(QLatin1String("application/x-qrichtext")));
fragment = QTextDocumentFragment::fromHtml(richtext, d->doc);
hasData = true;
} else if (source->hasHtml() && d->acceptRichText) {
diff --git a/src/quick/items/qquicktextcontrol_p.h b/src/quick/items/qquicktextcontrol_p.h
index 602e457cb8..e06e3b8b29 100644
--- a/src/quick/items/qquicktextcontrol_p.h
+++ b/src/quick/items/qquicktextcontrol_p.h
@@ -193,9 +193,11 @@ class QQuickTextEditMimeData : public QMimeData
public:
inline QQuickTextEditMimeData(const QTextDocumentFragment &aFragment) : fragment(aFragment) {}
- virtual QStringList formats() const;
+ QStringList formats() const override;
+
protected:
- virtual QVariant retrieveData(const QString &mimeType, QVariant::Type type) const;
+ QVariant retrieveData(const QString &mimeType, QVariant::Type type) const override;
+
private:
void setup() const;
diff --git a/src/quick/items/qquicktextdocument.cpp b/src/quick/items/qquicktextdocument.cpp
index 1dc54eb107..287e07e980 100644
--- a/src/quick/items/qquicktextdocument.cpp
+++ b/src/quick/items/qquicktextdocument.cpp
@@ -179,7 +179,7 @@ void QQuickTextDocumentWithImageResources::drawObject(
{
}
-QImage QQuickTextDocumentWithImageResources::image(const QTextImageFormat &format)
+QImage QQuickTextDocumentWithImageResources::image(const QTextImageFormat &format) const
{
QVariant res = resource(QTextDocument::ImageResource, QUrl(format.name()));
return res.value<QImage>();
diff --git a/src/quick/items/qquicktextdocument_p.h b/src/quick/items/qquicktextdocument_p.h
index 3ffedb5b96..1218b12b89 100644
--- a/src/quick/items/qquicktextdocument_p.h
+++ b/src/quick/items/qquicktextdocument_p.h
@@ -75,10 +75,10 @@ public:
void setText(const QString &);
int resourcesLoading() const { return outstanding; }
- QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format);
- void drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format);
+ QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format) override;
+ void drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) override;
- QImage image(const QTextImageFormat &format);
+ QImage image(const QTextImageFormat &format) const;
public Q_SLOTS:
void clearResources();
@@ -87,7 +87,7 @@ Q_SIGNALS:
void imagesLoaded();
protected:
- QVariant loadResource(int type, const QUrl &name);
+ QVariant loadResource(int type, const QUrl &name) override;
QQuickPixmap *loadPixmap(QQmlContext *context, const QUrl &name);
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 6543a64624..4c9a1f8dfc 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -2843,7 +2843,7 @@ void QQuickTextInputPrivate::updateDisplayText(bool forceUpdate)
// drawing boxes when using fonts that don't have glyphs for such
// characters)
QChar* uc = str.data();
- for (int i = 0; i < (int)str.length(); ++i) {
+ for (int i = 0; i < str.length(); ++i) {
if ((uc[i].unicode() < 0x20 && uc[i] != QChar::Tabulation)
|| uc[i] == QChar::LineSeparator
|| uc[i] == QChar::ParagraphSeparator
@@ -3229,7 +3229,7 @@ void QQuickTextInputPrivate::setSelection(int start, int length)
commitPreedit();
#endif
- if (start < 0 || start > (int)m_text.length()){
+ if (start < 0 || start > m_text.length()) {
qWarning("QQuickTextInputPrivate::setSelection: Invalid start position");
return;
}
@@ -3238,7 +3238,7 @@ void QQuickTextInputPrivate::setSelection(int start, int length)
if (start == m_selstart && start + length == m_selend && m_cursor == m_selend)
return;
m_selstart = start;
- m_selend = qMin(start + length, (int)m_text.length());
+ m_selend = qMin(start + length, m_text.length());
m_cursor = m_selend;
} else if (length < 0){
if (start == m_selend && start + length == m_selstart && m_cursor == m_selstart)
@@ -3676,7 +3676,7 @@ void QQuickTextInputPrivate::internalInsert(const QString &s)
Q_ASSERT(!hasSelectedText()); // insert(), processInputMethodEvent() call removeSelectedText() first.
if (m_maskData) {
QString ms = maskString(m_cursor, s);
- for (int i = 0; i < (int) ms.length(); ++i) {
+ for (int i = 0; i < ms.length(); ++i) {
addCommand (Command(DeleteSelection, m_cursor + i, m_text.at(m_cursor + i), -1, -1));
addCommand(Command(Insert, m_cursor + i, ms.at(i), -1, -1));
}
@@ -3687,9 +3687,10 @@ void QQuickTextInputPrivate::internalInsert(const QString &s)
} else {
int remaining = m_maxLength - m_text.length();
if (remaining != 0) {
- m_text.insert(m_cursor, s.left(remaining));
- for (int i = 0; i < (int) s.leftRef(remaining).length(); ++i)
- addCommand(Command(Insert, m_cursor++, s.at(i), -1, -1));
+ const QStringRef remainingStr = s.leftRef(remaining);
+ m_text.insert(m_cursor, remainingStr);
+ for (auto e : remainingStr)
+ addCommand(Command(Insert, m_cursor++, e, -1, -1));
m_textDirty = true;
}
}
@@ -3708,7 +3709,7 @@ void QQuickTextInputPrivate::internalInsert(const QString &s)
*/
void QQuickTextInputPrivate::internalDelete(bool wasBackspace)
{
- if (m_cursor < (int) m_text.length()) {
+ if (m_cursor < m_text.length()) {
cancelPasswordEchoTimer();
Q_ASSERT(!hasSelectedText()); // del(), backspace() call removeSelectedText() first.
addCommand(Command((CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)),
@@ -3734,7 +3735,7 @@ void QQuickTextInputPrivate::internalDelete(bool wasBackspace)
*/
void QQuickTextInputPrivate::removeSelectedText()
{
- if (m_selstart < m_selend && m_selend <= (int) m_text.length()) {
+ if (m_selstart < m_selend && m_selend <= m_text.length()) {
cancelPasswordEchoTimer();
int i ;
if (m_selstart <= m_cursor && m_cursor < m_selend) {
@@ -4020,44 +4021,44 @@ QString QQuickTextInputPrivate::maskString(uint pos, const QString &str, bool cl
if (strIndex < str.length()) {
if (m_maskData[i].separator) {
s += m_maskData[i].maskChar;
- if (str[(int)strIndex] == m_maskData[i].maskChar)
+ if (str[strIndex] == m_maskData[i].maskChar)
strIndex++;
++i;
} else {
- if (isValidInput(str[(int)strIndex], m_maskData[i].maskChar)) {
+ if (isValidInput(str[strIndex], m_maskData[i].maskChar)) {
switch (m_maskData[i].caseMode) {
case MaskInputData::Upper:
- s += str[(int)strIndex].toUpper();
+ s += str[strIndex].toUpper();
break;
case MaskInputData::Lower:
- s += str[(int)strIndex].toLower();
+ s += str[strIndex].toLower();
break;
default:
- s += str[(int)strIndex];
+ s += str[strIndex];
}
++i;
} else {
// search for separator first
- int n = findInMask(i, true, true, str[(int)strIndex]);
+ int n = findInMask(i, true, true, str[strIndex]);
if (n != -1) {
- if (str.length() != 1 || i == 0 || (i > 0 && (!m_maskData[i-1].separator || m_maskData[i-1].maskChar != str[(int)strIndex]))) {
+ if (str.length() != 1 || i == 0 || (i > 0 && (!m_maskData[i-1].separator || m_maskData[i-1].maskChar != str[strIndex]))) {
s += fill.midRef(i, n-i+1);
i = n + 1; // update i to find + 1
}
} else {
// search for valid m_blank if not
- n = findInMask(i, true, false, str[(int)strIndex]);
+ n = findInMask(i, true, false, str[strIndex]);
if (n != -1) {
s += fill.midRef(i, n-i);
switch (m_maskData[n].caseMode) {
case MaskInputData::Upper:
- s += str[(int)strIndex].toUpper();
+ s += str[strIndex].toUpper();
break;
case MaskInputData::Lower:
- s += str[(int)strIndex].toLower();
+ s += str[strIndex].toLower();
break;
default:
- s += str[(int)strIndex];
+ s += str[strIndex];
}
i = n + 1; // updates i to find + 1
}
@@ -4108,7 +4109,7 @@ QString QQuickTextInputPrivate::stripString(const QString &str) const
return str;
QString s;
- int end = qMin(m_maxLength, (int)str.length());
+ int end = qMin(m_maxLength, str.length());
for (int i = 0; i < end; ++i) {
if (m_maskData[i].separator)
s += m_maskData[i].maskChar;
@@ -4198,7 +4199,7 @@ void QQuickTextInputPrivate::internalRedo()
if (!isRedoAvailable())
return;
internalDeselect();
- while (m_undoState < (int)m_history.size()) {
+ while (m_undoState < m_history.size()) {
Command& cmd = m_history[m_undoState++];
switch (cmd.type) {
case Insert:
@@ -4225,7 +4226,7 @@ void QQuickTextInputPrivate::internalRedo()
m_cursor = cmd.pos;
break;
}
- if (m_undoState < (int)m_history.size()) {
+ if (m_undoState < m_history.size()) {
Command& next = m_history[m_undoState];
if (next.type != cmd.type
&& cmd.type < RemoveSelection
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 0151a4e3ca..f81c939ec6 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1895,8 +1895,6 @@ void QQuickWindowPrivate::deliverDelayedTouchEvent()
deliverPointerEvent(pointerEventInstance(e.data()));
}
-static bool qquickwindow_no_touch_compression = qEnvironmentVariableIsSet("QML_NO_TOUCH_COMPRESSION");
-
bool QQuickWindowPrivate::compressTouchEvent(QTouchEvent *event)
{
Q_Q(QQuickWindow);
@@ -1973,6 +1971,8 @@ void QQuickWindowPrivate::handleTouchEvent(QTouchEvent *event)
qCDebug(DBG_TOUCH) << event;
+ static bool qquickwindow_no_touch_compression = qEnvironmentVariableIsSet("QML_NO_TOUCH_COMPRESSION");
+
if (qquickwindow_no_touch_compression || pointerEventRecursionGuard) {
deliverPointerEvent(pointerEventInstance(event));
return;
@@ -2100,7 +2100,7 @@ void QQuickWindowPrivate::flushFrameSynchronousEvents()
There is a unique instance per QQuickPointerDevice, which is determined
from \a event's device.
*/
-QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QEvent *event)
+QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QEvent *event) const
{
QQuickPointerDevice *dev = nullptr;
switch (event->type()) {
@@ -4171,6 +4171,28 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
+ \qmlproperty variant Window::targetScreen
+
+ Specifies the screen the window should be placed on. Equivalent to
+ QWindow::setScreen().
+
+ The value must be an element from the Qt.application.screens array.
+
+ By default the value is null which leads to using the primary screen.
+
+ \note To ensure that the window is associated with the desired screen right
+ upon the underlying native window's initial creation, make sure this
+ property is set as early as possible and that the setting of its value is
+ not deferred. This can be particularly important on embedded platforms
+ without a windowing system, where only one window per screen is allowed at a
+ time.
+
+ \since 5.9
+
+ \sa QWindow::setScreen(), QScreen, Qt.application
+ */
+
+/*!
\qmlproperty Item Window::activeFocusItem
\since 5.1
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index 3328eb65c4..3e146d5440 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -161,7 +161,7 @@ public:
void deliverDelayedTouchEvent();
// delivery of pointer events:
- QQuickPointerEvent *pointerEventInstance(QEvent *ev);
+ QQuickPointerEvent *pointerEventInstance(QEvent *ev) const;
void deliverPointerEvent(QQuickPointerEvent *);
void deliverTouchEvent(QQuickPointerTouchEvent *);
bool deliverTouchCancelEvent(QTouchEvent *);
@@ -198,7 +198,7 @@ public:
void setFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions = 0);
void clearFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions = 0);
static void notifyFocusChangesRecur(QQuickItem **item, int remaining);
- void clearFocusObject();
+ void clearFocusObject() override;
void updateFocusItemTransform();
diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp
index deb44ce34d..ea1fc2f106 100644
--- a/src/quick/items/qquickwindowmodule.cpp
+++ b/src/quick/items/qquickwindowmodule.cpp
@@ -59,6 +59,7 @@ public:
: complete(false)
, visible(false)
, visibility(QQuickWindow::AutomaticVisibility)
+ , targetScreen(nullptr)
{
}
@@ -66,6 +67,7 @@ public:
bool visible;
QQuickWindow::Visibility visibility;
QV4::PersistentValue rootItemMarker;
+ QObject *targetScreen;
};
QQuickWindowQmlImpl::QQuickWindowQmlImpl(QWindow *parent)
@@ -170,6 +172,26 @@ void QQuickWindowQmlImpl::setWindowVisibility()
}
}
+QObject *QQuickWindowQmlImpl::targetScreen() const
+{
+ Q_D(const QQuickWindowQmlImpl);
+ return d->targetScreen;
+}
+
+void QQuickWindowQmlImpl::setTargetScreen(QObject *screen)
+{
+ Q_D(QQuickWindowQmlImpl);
+ if (d->targetScreen != screen) {
+ d->targetScreen = screen;
+ emit targetScreenChanged();
+ QQuickScreenInfo *screenWrapper = qobject_cast<QQuickScreenInfo *>(screen);
+ if (screenWrapper)
+ setScreen(screenWrapper->wrappedScreen());
+ else
+ setScreen(nullptr);
+ }
+}
+
void QQuickWindowModule::defineModule()
{
const char uri[] = "QtQuick.Window";
@@ -181,7 +203,10 @@ void QQuickWindowModule::defineModule()
qmlRegisterRevision<QQuickWindow,2>(uri, 2, 2);
qmlRegisterType<QQuickWindowQmlImpl>(uri, 2, 1, "Window");
qmlRegisterType<QQuickWindowQmlImpl,1>(uri, 2, 2, "Window");
+ qmlRegisterType<QQuickWindowQmlImpl,2>(uri, 2, 3, "Window");
qmlRegisterUncreatableType<QQuickScreen>(uri, 2, 0, "Screen", QStringLiteral("Screen can only be used via the attached property."));
+ qmlRegisterUncreatableType<QQuickScreen,1>(uri, 2, 3, "Screen", QStringLiteral("Screen can only be used via the attached property."));
+ qmlRegisterUncreatableType<QQuickScreenInfo,2>(uri, 2, 3, "ScreenInfo", QStringLiteral("ScreenInfo can only be used via the attached property."));
}
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickwindowmodule_p.h b/src/quick/items/qquickwindowmodule_p.h
index 8a6bbac412..7ca29880ea 100644
--- a/src/quick/items/qquickwindowmodule_p.h
+++ b/src/quick/items/qquickwindowmodule_p.h
@@ -67,6 +67,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickWindowQmlImpl : public QQuickWindow, public Q
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged)
+ Q_PROPERTY(QObject *targetScreen READ targetScreen WRITE setTargetScreen NOTIFY targetScreenChanged REVISION 2)
public:
QQuickWindowQmlImpl(QWindow *parent = Q_NULLPTR);
@@ -74,11 +75,15 @@ public:
void setVisible(bool visible);
void setVisibility(Visibility visibility);
+ QObject *targetScreen() const;
+ void setTargetScreen(QObject *screen);
+
static QQuickWindowAttached *qmlAttachedProperties(QObject *object);
Q_SIGNALS:
void visibleChanged(bool arg);
void visibilityChanged(QWindow::Visibility visibility);
+ Q_REVISION(2) void targetScreenChanged();
protected:
void classBegin() Q_DECL_OVERRIDE;
diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp
index 9a50250ebb..4028c63da5 100644
--- a/src/quick/qtquick2.cpp
+++ b/src/quick/qtquick2.cpp
@@ -72,19 +72,19 @@ class QQmlQtQuick2DebugStatesDelegate : public QQmlDebugStatesDelegate
{
public:
QQmlQtQuick2DebugStatesDelegate();
- virtual ~QQmlQtQuick2DebugStatesDelegate();
- virtual void buildStatesList(bool cleanList, const QList<QPointer<QObject> > &instances);
- virtual void updateBinding(QQmlContext *context,
- const QQmlProperty &property,
- const QVariant &expression, bool isLiteralValue,
- const QString &fileName, int line, int column,
- bool *isBaseState);
- virtual bool setBindingForInvalidProperty(QObject *object,
- const QString &propertyName,
- const QVariant &expression,
- bool isLiteralValue);
- virtual void resetBindingForInvalidProperty(QObject *object,
- const QString &propertyName);
+ ~QQmlQtQuick2DebugStatesDelegate();
+ void buildStatesList(bool cleanList, const QList<QPointer<QObject> > &instances) override;
+ void updateBinding(QQmlContext *context,
+ const QQmlProperty &property,
+ const QVariant &expression, bool isLiteralValue,
+ const QString &fileName, int line, int column,
+ bool *isBaseState) override;
+ bool setBindingForInvalidProperty(QObject *object,
+ const QString &propertyName,
+ const QVariant &expression,
+ bool isLiteralValue) override;
+ void resetBindingForInvalidProperty(QObject *object,
+ const QString &propertyName) override;
private:
void buildStatesList(QObject *obj);
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation.cpp
index 8ad9b50b09..92c02b4966 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation.cpp
@@ -78,7 +78,7 @@ QSGRenderLoop *QSGSoftwareAdaptation::createWindowManager()
static bool envChecked = false;
if (!envChecked) {
envChecked = true;
- threaded = qgetenv("QSG_RENDER_LOOP") == QByteArrayLiteral("threaded");
+ threaded = qgetenv("QSG_RENDER_LOOP") == "threaded";
}
if (threaded)
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
index 01e517e65b..d5e94cea3e 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
@@ -499,7 +499,7 @@ public:
void updateRootTransforms(Node *n);
void updateRootTransforms(Node *n, Node *root, const QMatrix4x4 &combined);
- void updateStates(QSGNode *n);
+ void updateStates(QSGNode *n) override;
void visitNode(Node *n);
void registerWithParentRoot(QSGNode *subRoot, QSGNode *parentRoot);
diff --git a/src/quick/scenegraph/coreapi/qsgnode.h b/src/quick/scenegraph/coreapi/qsgnode.h
index f7ea6dbe23..1467f2233d 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.h
+++ b/src/quick/scenegraph/coreapi/qsgnode.h
@@ -325,7 +325,7 @@ public:
void setCombinedOpacity(qreal opacity);
qreal combinedOpacity() const { return m_combined_opacity; }
- bool isSubtreeBlocked() const;
+ bool isSubtreeBlocked() const override;
private:
qreal m_opacity;
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer_p.h b/src/quick/scenegraph/coreapi/qsgrenderer_p.h
index 94b78a85b4..3fb23fe3cd 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgrenderer_p.h
@@ -138,7 +138,7 @@ class QSGBindableFboId : public QSGBindable
{
public:
QSGBindableFboId(GLuint);
- virtual void bind() const;
+ void bind() const override;
private:
GLuint m_id;
};
@@ -160,8 +160,8 @@ public:
static void dump(QSGNode *n);
QSGNodeDumper() : m_indent(0) {}
- void visitNode(QSGNode *n);
- void visitChildren(QSGNode *n);
+ void visitNode(QSGNode *n) override;
+ void visitChildren(QSGNode *n) override;
private:
int m_indent;
diff --git a/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp b/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp
index 3a35632d5c..48ab1aa52f 100644
--- a/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp
+++ b/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp
@@ -193,13 +193,13 @@ QByteArray qsgShaderRewriter_insertZAttributes(const char *input, QSurfaceFormat
switch (profile) {
case QSurfaceFormat::NoProfile:
case QSurfaceFormat::CompatibilityProfile:
- result += QByteArrayLiteral("attribute highp float _qt_order;\n");
- result += QByteArrayLiteral("uniform highp float _qt_zRange;\n");
+ result += "attribute highp float _qt_order;\n"
+ "uniform highp float _qt_zRange;\n";
break;
case QSurfaceFormat::CoreProfile:
- result += QByteArrayLiteral("in float _qt_order;\n");
- result += QByteArrayLiteral("uniform float _qt_zRange;\n");
+ result += "in float _qt_order;\n"
+ "uniform float _qt_zRange;\n";
break;
}
@@ -214,9 +214,9 @@ QByteArray qsgShaderRewriter_insertZAttributes(const char *input, QSurfaceFormat
case Tokenizer::Token_CloseBrace:
braceDepth--;
if (braceDepth == 0) {
- result += QByteArray::fromRawData(voidPos, tok.pos - 1 - voidPos);
- result += QByteArrayLiteral(" gl_Position.z = (gl_Position.z * _qt_zRange + _qt_order) * gl_Position.w;\n");
- result += QByteArray(tok.pos - 1);
+ result += QByteArray::fromRawData(voidPos, tok.pos - 1 - voidPos)
+ + " gl_Position.z = (gl_Position.z * _qt_zRange + _qt_order) * gl_Position.w;\n"
+ + QByteArray(tok.pos - 1);
return result;
}
break;
diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
index eeea104e91..9ad99e5c54 100644
--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
+++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
@@ -116,9 +116,8 @@ private:
{
m_blitProgram = new QOpenGLShaderProgram;
{
- QString source;
- source.append(QLatin1String(qopenglslMainWithTexCoordsVertexShader));
- source.append(QLatin1String(qopenglslUntransformedPositionVertexShader));
+ const QString source = QLatin1String(qopenglslMainWithTexCoordsVertexShader)
+ + QLatin1String(qopenglslUntransformedPositionVertexShader);
QOpenGLShader *vertexShader = new QOpenGLShader(QOpenGLShader::Vertex, m_blitProgram);
vertexShader->compileSourceCode(source);
@@ -126,9 +125,8 @@ private:
m_blitProgram->addShader(vertexShader);
}
{
- QString source;
- source.append(QLatin1String(qopenglslMainFragmentShader));
- source.append(QLatin1String(qopenglslImageSrcFragmentShader));
+ const QString source = QLatin1String(qopenglslMainFragmentShader)
+ + QLatin1String(qopenglslImageSrcFragmentShader);
QOpenGLShader *fragmentShader = new QOpenGLShader(QOpenGLShader::Fragment, m_blitProgram);
fragmentShader->compileSourceCode(source);
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index df7bbe6ceb..9ddbe5aa1d 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -211,11 +211,11 @@ QSGRenderLoop *QSGRenderLoop::instance()
if (Q_UNLIKELY(qEnvironmentVariableIsSet("QSG_RENDER_LOOP"))) {
const QByteArray loopName = qgetenv("QSG_RENDER_LOOP");
- if (loopName == QByteArrayLiteral("windows"))
+ if (loopName == "windows")
loopType = WindowsRenderLoop;
- else if (loopName == QByteArrayLiteral("basic"))
+ else if (loopName == "basic")
loopType = BasicRenderLoop;
- else if (loopName == QByteArrayLiteral("threaded"))
+ else if (loopName == "threaded")
loopType = ThreadedRenderLoop;
}
diff --git a/src/quick/scenegraph/util/qsgatlastexture_p.h b/src/quick/scenegraph/util/qsgatlastexture_p.h
index cd24645fcf..3dee539547 100644
--- a/src/quick/scenegraph/util/qsgatlastexture_p.h
+++ b/src/quick/scenegraph/util/qsgatlastexture_p.h
@@ -131,26 +131,26 @@ public:
Texture(Atlas *atlas, const QRect &textureRect, const QImage &image);
~Texture();
- int textureId() const { return m_atlas->textureId(); }
- QSize textureSize() const { return atlasSubRectWithoutPadding().size(); }
+ int textureId() const override { return m_atlas->textureId(); }
+ QSize textureSize() const override { return atlasSubRectWithoutPadding().size(); }
void setHasAlphaChannel(bool alpha) { m_has_alpha = alpha; }
- bool hasAlphaChannel() const { return m_has_alpha; }
- bool hasMipmaps() const { return false; }
- bool isAtlasTexture() const { return true; }
+ bool hasAlphaChannel() const override { return m_has_alpha; }
+ bool hasMipmaps() const override { return false; }
+ bool isAtlasTexture() const override { return true; }
- QRectF normalizedTextureSubRect() const { return m_texture_coords_rect; }
+ QRectF normalizedTextureSubRect() const override { return m_texture_coords_rect; }
QRect atlasSubRect() const { return m_allocated_rect; }
QRect atlasSubRectWithoutPadding() const { return m_allocated_rect.adjusted(1, 1, -1, -1); }
bool isTexture() const { return true; }
- QSGTexture *removedFromAtlas() const;
+ QSGTexture *removedFromAtlas() const override;
void releaseImage() { m_image = QImage(); }
const QImage &image() const { return m_image; }
- void bind();
+ void bind() override;
private:
QRect m_allocated_rect;
diff --git a/src/quick/scenegraph/util/qsgdefaultpainternode_p.h b/src/quick/scenegraph/util/qsgdefaultpainternode_p.h
index 7488f7878d..084fc1e004 100644
--- a/src/quick/scenegraph/util/qsgdefaultpainternode_p.h
+++ b/src/quick/scenegraph/util/qsgdefaultpainternode_p.h
@@ -72,7 +72,7 @@ public:
void setDirtyRect(const QRect &rect) { m_dirty_rect = rect; }
- void bind();
+ void bind() override;
private:
QRect m_dirty_rect;
@@ -84,43 +84,43 @@ public:
QSGDefaultPainterNode(QQuickPaintedItem *item);
virtual ~QSGDefaultPainterNode();
- void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target);
+ void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target) override;
- void setSize(const QSize &size);
+ void setSize(const QSize &size) override;
QSize size() const { return m_size; }
- void setDirty(const QRect &dirtyRect = QRect());
+ void setDirty(const QRect &dirtyRect = QRect()) override;
- void setOpaquePainting(bool opaque);
+ void setOpaquePainting(bool opaque) override;
bool opaquePainting() const { return m_opaquePainting; }
- void setLinearFiltering(bool linearFiltering);
+ void setLinearFiltering(bool linearFiltering) override;
bool linearFiltering() const { return m_linear_filtering; }
- void setMipmapping(bool mipmapping);
+ void setMipmapping(bool mipmapping) override;
bool mipmapping() const { return m_mipmapping; }
- void setSmoothPainting(bool s);
+ void setSmoothPainting(bool s) override;
bool smoothPainting() const { return m_smoothPainting; }
- void setFillColor(const QColor &c);
+ void setFillColor(const QColor &c) override;
QColor fillColor() const { return m_fillColor; }
- void setContentsScale(qreal s);
+ void setContentsScale(qreal s) override;
qreal contentsScale() const { return m_contentsScale; }
- void setFastFBOResizing(bool fastResizing);
+ void setFastFBOResizing(bool fastResizing) override;
bool fastFBOResizing() const { return m_fastFBOResizing; }
- void setTextureSize(const QSize &textureSize);
+ void setTextureSize(const QSize &textureSize) override;
QSize textureSize() const { return m_textureSize; }
- QImage toImage() const;
- void update();
+ QImage toImage() const override;
+ void update() override;
void paint();
- QSGTexture *texture() const { return m_texture; }
+ QSGTexture *texture() const override { return m_texture; }
private:
void updateTexture();
diff --git a/src/quick/scenegraph/util/qsgdepthstencilbuffer_p.h b/src/quick/scenegraph/util/qsgdepthstencilbuffer_p.h
index c2d0590532..f7c6923021 100644
--- a/src/quick/scenegraph/util/qsgdepthstencilbuffer_p.h
+++ b/src/quick/scenegraph/util/qsgdepthstencilbuffer_p.h
@@ -119,7 +119,7 @@ public:
virtual ~QSGDefaultDepthStencilBuffer();
protected:
- virtual void free();
+ void free() override;
};
diff --git a/src/quick/scenegraph/util/qsgflatcolormaterial.h b/src/quick/scenegraph/util/qsgflatcolormaterial.h
index 7f292a2a9b..4829ac3279 100644
--- a/src/quick/scenegraph/util/qsgflatcolormaterial.h
+++ b/src/quick/scenegraph/util/qsgflatcolormaterial.h
@@ -49,13 +49,13 @@ class Q_QUICK_EXPORT QSGFlatColorMaterial : public QSGMaterial
{
public:
QSGFlatColorMaterial();
- virtual QSGMaterialType *type() const;
- virtual QSGMaterialShader *createShader() const;
+ QSGMaterialType *type() const override;
+ QSGMaterialShader *createShader() const override;
void setColor(const QColor &color);
const QColor &color() const { return m_color; }
- int compare(const QSGMaterial *other) const;
+ int compare(const QSGMaterial *other) const override;
private:
QColor m_color;
diff --git a/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp b/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp
index caa296451e..25af1997a8 100644
--- a/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp
+++ b/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp
@@ -310,13 +310,10 @@ void QSGShaderSourceBuilder::addDefinition(const QByteArray &definition)
const char *insertionPos = extensionPos ? extensionPos : (versionPos ? versionPos : input);
// Construct a new shader string, inserting the definition
- QByteArray newSource;
- newSource.reserve(m_source.size() + definition.size() + 9);
- newSource += QByteArray::fromRawData(input, insertionPos - input);
- newSource += QByteArrayLiteral("#define ") + definition + QByteArrayLiteral("\n");
- newSource += QByteArray::fromRawData(insertionPos, m_source.size() - (insertionPos - input));
-
- m_source = newSource;
+ QByteArray newSource = QByteArray::fromRawData(input, insertionPos - input)
+ + "#define " + definition + '\n'
+ + QByteArray::fromRawData(insertionPos, m_source.size() - (insertionPos - input));
+ m_source = std::move(newSource);
}
void QSGShaderSourceBuilder::removeVersion()
diff --git a/src/quick/scenegraph/util/qsgsimplematerial.h b/src/quick/scenegraph/util/qsgsimplematerial.h
index d07a68e850..01f98767fd 100644
--- a/src/quick/scenegraph/util/qsgsimplematerial.h
+++ b/src/quick/scenegraph/util/qsgsimplematerial.h
@@ -149,8 +149,8 @@ public:
{
}
- QSGMaterialShader *createShader() const { return m_func(); }
- QSGMaterialType *type() const { return &m_type; }
+ QSGMaterialShader *createShader() const override { return m_func(); }
+ QSGMaterialType *type() const override { return &m_type; }
State *state() { return &m_state; }
const State *state() const { return &m_state; }
diff --git a/src/quick/scenegraph/util/qsgtexture_p.h b/src/quick/scenegraph/util/qsgtexture_p.h
index a0d7eb41e3..e09cbdbef1 100644
--- a/src/quick/scenegraph/util/qsgtexture_p.h
+++ b/src/quick/scenegraph/util/qsgtexture_p.h
@@ -87,19 +87,19 @@ public:
bool ownsTexture() const { return m_owns_texture; }
void setTextureId(int id);
- int textureId() const;
+ int textureId() const override;
void setTextureSize(const QSize &size) { m_texture_size = size; }
- QSize textureSize() const { return m_texture_size; }
+ QSize textureSize() const override { return m_texture_size; }
void setHasAlphaChannel(bool alpha) { m_has_alpha = alpha; }
- bool hasAlphaChannel() const { return m_has_alpha; }
+ bool hasAlphaChannel() const override { return m_has_alpha; }
- bool hasMipmaps() const { return mipmapFiltering() != QSGTexture::None; }
+ bool hasMipmaps() const override { return mipmapFiltering() != QSGTexture::None; }
void setImage(const QImage &image);
const QImage &image() { return m_image; }
- virtual void bind();
+ void bind() override;
static QSGPlainTexture *fromImage(const QImage &image) {
QSGPlainTexture *t = new QSGPlainTexture();
diff --git a/src/quick/scenegraph/util/qsgtexturematerial.h b/src/quick/scenegraph/util/qsgtexturematerial.h
index 02b59108b3..dc87131773 100644
--- a/src/quick/scenegraph/util/qsgtexturematerial.h
+++ b/src/quick/scenegraph/util/qsgtexturematerial.h
@@ -50,9 +50,9 @@ class Q_QUICK_EXPORT QSGOpaqueTextureMaterial : public QSGMaterial
public:
QSGOpaqueTextureMaterial();
- virtual QSGMaterialType *type() const;
- virtual QSGMaterialShader *createShader() const;
- virtual int compare(const QSGMaterial *other) const;
+ QSGMaterialType *type() const override;
+ QSGMaterialShader *createShader() const override;
+ int compare(const QSGMaterial *other) const override;
void setTexture(QSGTexture *texture);
QSGTexture *texture() const { return m_texture; }
@@ -84,8 +84,8 @@ protected:
class Q_QUICK_EXPORT QSGTextureMaterial : public QSGOpaqueTextureMaterial
{
public:
- virtual QSGMaterialType *type() const;
- virtual QSGMaterialShader *createShader() const;
+ QSGMaterialType *type() const override;
+ QSGMaterialShader *createShader() const override;
};
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/util/qsgtexturematerial_p.h b/src/quick/scenegraph/util/qsgtexturematerial_p.h
index 75e5877a72..093d820801 100644
--- a/src/quick/scenegraph/util/qsgtexturematerial_p.h
+++ b/src/quick/scenegraph/util/qsgtexturematerial_p.h
@@ -61,13 +61,13 @@ class Q_QUICK_PRIVATE_EXPORT QSGOpaqueTextureMaterialShader : public QSGMaterial
public:
QSGOpaqueTextureMaterialShader();
- virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect);
- virtual char const *const *attributeNames() const;
+ void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override;
+ char const *const *attributeNames() const override;
static QSGMaterialType type;
protected:
- virtual void initialize();
+ void initialize() override;
int m_matrix_id;
};
@@ -77,8 +77,8 @@ class QSGTextureMaterialShader : public QSGOpaqueTextureMaterialShader
public:
QSGTextureMaterialShader();
- virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect);
- virtual void initialize();
+ void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override;
+ void initialize() override;
static QSGMaterialType type;
diff --git a/src/quick/scenegraph/util/qsgvertexcolormaterial.h b/src/quick/scenegraph/util/qsgvertexcolormaterial.h
index 68f32d8af0..65cb642d92 100644
--- a/src/quick/scenegraph/util/qsgvertexcolormaterial.h
+++ b/src/quick/scenegraph/util/qsgvertexcolormaterial.h
@@ -49,11 +49,11 @@ class Q_QUICK_EXPORT QSGVertexColorMaterial : public QSGMaterial
public:
QSGVertexColorMaterial();
- int compare(const QSGMaterial *other) const;
+ int compare(const QSGMaterial *other) const override;
protected:
- virtual QSGMaterialType *type() const;
- virtual QSGMaterialShader *createShader() const;
+ QSGMaterialType *type() const override;
+ QSGMaterialShader *createShader() const override;
};
QT_END_NAMESPACE
diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp
index 206b92eb81..9de474ac36 100644
--- a/src/quick/util/qquickanimation.cpp
+++ b/src/quick/util/qquickanimation.cpp
@@ -1198,14 +1198,14 @@ QAbstractAnimationJob* QQuickPropertyAction::transition(QQuickStateActions &acti
struct QQuickSetPropertyAnimationAction : public QAbstractAnimationAction
{
QQuickStateActions actions;
- virtual void doAction()
+ void doAction() override
{
for (int ii = 0; ii < actions.count(); ++ii) {
const QQuickStateAction &action = actions.at(ii);
QQmlPropertyPrivate::write(action.property, action.toValue, QQmlPropertyData::BypassInterceptor | QQmlPropertyData::DontRemoveBinding);
}
}
- virtual void debugAction(QDebug d, int indentLevel) const {
+ void debugAction(QDebug d, int indentLevel) const override {
QByteArray ind(indentLevel, ' ');
for (int ii = 0; ii < actions.count(); ++ii) {
const QQuickStateAction &action = actions.at(ii);
diff --git a/src/quick/util/qquickanimation_p.h b/src/quick/util/qquickanimation_p.h
index 145f2656d2..e27871dcaa 100644
--- a/src/quick/util/qquickanimation_p.h
+++ b/src/quick/util/qquickanimation_p.h
@@ -114,8 +114,8 @@ public:
void setDisableUserControl();
void setEnableUserControl();
bool userControlDisabled() const;
- void classBegin();
- void componentComplete();
+ void classBegin() override;
+ void componentComplete() override;
virtual ThreadingModel threadingModel() const;
@@ -150,7 +150,7 @@ public:
private Q_SLOTS:
void componentFinalized();
private:
- virtual void setTarget(const QQmlProperty &);
+ void setTarget(const QQmlProperty &) override;
void notifyRunningChanged(bool running);
friend class QQuickBehavior;
friend class QQuickBehaviorPrivate;
@@ -179,7 +179,7 @@ protected:
QAbstractAnimationJob* transition(QQuickStateActions &actions,
QQmlProperties &modified,
TransitionDirection direction,
- QObject *defaultTarget = 0);
+ QObject *defaultTarget = 0) override;
};
class QQuickScriptActionPrivate;
@@ -202,10 +202,10 @@ public:
void setStateChangeScriptName(const QString &);
protected:
- virtual QAbstractAnimationJob* transition(QQuickStateActions &actions,
+ QAbstractAnimationJob* transition(QQuickStateActions &actions,
QQmlProperties &modified,
TransitionDirection direction,
- QObject *defaultTarget = 0);
+ QObject *defaultTarget = 0) override;
};
class QQuickPropertyActionPrivate;
@@ -247,10 +247,10 @@ Q_SIGNALS:
void propertyChanged();
protected:
- virtual QAbstractAnimationJob* transition(QQuickStateActions &actions,
+ QAbstractAnimationJob* transition(QQuickStateActions &actions,
QQmlProperties &modified,
TransitionDirection direction,
- QObject *defaultTarget = 0);
+ QObject *defaultTarget = 0) override;
};
class QQuickPropertyAnimationPrivate;
@@ -303,10 +303,10 @@ protected:
QObject *defaultTarget = 0);
QQuickPropertyAnimation(QQuickPropertyAnimationPrivate &dd, QObject *parent);
- virtual QAbstractAnimationJob* transition(QQuickStateActions &actions,
+ QAbstractAnimationJob* transition(QQuickStateActions &actions,
QQmlProperties &modified,
TransitionDirection direction,
- QObject *defaultTarget = 0);
+ QObject *defaultTarget = 0) override;
Q_SIGNALS:
void durationChanged(int);
void fromChanged(const QVariant &);
@@ -438,11 +438,11 @@ public:
virtual ~QQuickSequentialAnimation();
protected:
- virtual ThreadingModel threadingModel() const;
- virtual QAbstractAnimationJob* transition(QQuickStateActions &actions,
+ ThreadingModel threadingModel() const override;
+ QAbstractAnimationJob* transition(QQuickStateActions &actions,
QQmlProperties &modified,
TransitionDirection direction,
- QObject *defaultTarget = 0);
+ QObject *defaultTarget = 0) override;
};
class Q_QUICK_PRIVATE_EXPORT QQuickParallelAnimation : public QQuickAnimationGroup
@@ -455,11 +455,11 @@ public:
virtual ~QQuickParallelAnimation();
protected:
- virtual ThreadingModel threadingModel() const;
- virtual QAbstractAnimationJob* transition(QQuickStateActions &actions,
+ ThreadingModel threadingModel() const override;
+ QAbstractAnimationJob* transition(QQuickStateActions &actions,
QQmlProperties &modified,
TransitionDirection direction,
- QObject *defaultTarget = 0);
+ QObject *defaultTarget = 0) override;
};
diff --git a/src/quick/util/qquickanimation_p_p.h b/src/quick/util/qquickanimation_p_p.h
index ea7bf62171..a7abc5a004 100644
--- a/src/quick/util/qquickanimation_p_p.h
+++ b/src/quick/util/qquickanimation_p_p.h
@@ -88,8 +88,8 @@ class QAnimationActionProxy : public QAbstractAnimationAction
{
public:
QAnimationActionProxy(T *instance) : m_instance(instance) {}
- virtual void doAction() { (m_instance->*method)(); }
- virtual void debugAction(QDebug d, int indentLevel) const { (m_instance->*debugMethod)(d, indentLevel); }
+ void doAction() override { (m_instance->*method)(); }
+ void debugAction(QDebug d, int indentLevel) const override { (m_instance->*debugMethod)(d, indentLevel); }
private:
T *m_instance;
};
@@ -104,13 +104,13 @@ public:
QActionAnimation(QAbstractAnimationAction *action);
~QActionAnimation();
- virtual int duration() const;
+ int duration() const override;
void setAnimAction(QAbstractAnimationAction *action);
protected:
- virtual void updateCurrentTime(int);
- virtual void updateState(State newState, State oldState);
- void debugAnimation(QDebug d) const;
+ void updateCurrentTime(int) override;
+ void updateState(State newState, State oldState) override;
+ void debugAnimation(QDebug d) const override;
private:
QAbstractAnimationAction *animAction;
@@ -137,16 +137,16 @@ public:
void setFromSourcedValue(bool *value) { fromSourced = value; }
- int duration() const { return m_duration; }
+ int duration() const override { return m_duration; }
void setDuration(int msecs) { m_duration = msecs; }
QEasingCurve easingCurve() const { return easing; }
void setEasingCurve(const QEasingCurve &curve) { easing = curve; }
protected:
- void updateCurrentTime(int currentTime);
- void topLevelAnimationLoopChanged();
- void debugAnimation(QDebug d) const;
+ void updateCurrentTime(int currentTime) override;
+ void topLevelAnimationLoopChanged() override;
+ void debugAnimation(QDebug d) const override;
private:
QQuickBulkValueUpdater *animValue;
@@ -162,9 +162,9 @@ class QTickAnimationProxy : public QAbstractAnimationJob
Q_DISABLE_COPY(QTickAnimationProxy)
public:
QTickAnimationProxy(T *instance) : QAbstractAnimationJob(), m_instance(instance) {}
- virtual int duration() const { return -1; }
+ int duration() const override { return -1; }
protected:
- virtual void updateCurrentTime(int msec) { (m_instance->*method)(msec); }
+ void updateCurrentTime(int msec) override { (m_instance->*method)(msec); }
private:
T *m_instance;
@@ -192,7 +192,7 @@ public:
int loopCount;
void commence();
- virtual void animationFinished(QAbstractAnimationJob *);
+ void animationFinished(QAbstractAnimationJob *) override;
QQmlProperty defaultProperty;
@@ -309,9 +309,9 @@ public:
QQuickAnimationPropertyUpdater() : interpolatorType(0), interpolator(0), prevInterpolatorType(0), reverse(false), fromSourced(false), fromDefined(false), wasDeleted(0) {}
~QQuickAnimationPropertyUpdater();
- void setValue(qreal v);
+ void setValue(qreal v) override;
- void debugUpdater(QDebug d, int indentLevel) const;
+ void debugUpdater(QDebug d, int indentLevel) const override;
QQuickStateActions actions;
int interpolatorType; //for Number/ColorAnimation
diff --git a/src/quick/util/qquickanimationcontroller.cpp b/src/quick/util/qquickanimationcontroller.cpp
index 8b6968ad98..4bc2d6319e 100644
--- a/src/quick/util/qquickanimationcontroller.cpp
+++ b/src/quick/util/qquickanimationcontroller.cpp
@@ -50,8 +50,8 @@ class QQuickAnimationControllerPrivate : public QObjectPrivate, QAnimationJobCha
public:
QQuickAnimationControllerPrivate()
: progress(0.0), animation(0), animationInstance(0), finalized(false) {}
- virtual void animationFinished(QAbstractAnimationJob *job);
- virtual void animationCurrentTimeChanged(QAbstractAnimationJob *job, int currentTime);
+ void animationFinished(QAbstractAnimationJob *job) override;
+ void animationCurrentTimeChanged(QAbstractAnimationJob *job, int currentTime) override;
qreal progress;
diff --git a/src/quick/util/qquickanimationcontroller_p.h b/src/quick/util/qquickanimationcontroller_p.h
index e37bb90a0a..43555ac1c1 100644
--- a/src/quick/util/qquickanimationcontroller_p.h
+++ b/src/quick/util/qquickanimationcontroller_p.h
@@ -78,8 +78,8 @@ public:
QQuickAbstractAnimation *animation() const;
void setAnimation(QQuickAbstractAnimation *animation);
- void classBegin();
- void componentComplete() {}
+ void classBegin() override;
+ void componentComplete() override {}
Q_SIGNALS:
void progressChanged();
void animationChanged();
diff --git a/src/quick/util/qquickanimator_p.h b/src/quick/util/qquickanimator_p.h
index 0fc900c5ac..92c66299dc 100644
--- a/src/quick/util/qquickanimator_p.h
+++ b/src/quick/util/qquickanimator_p.h
@@ -86,13 +86,13 @@ public:
void setFrom(qreal from);
protected:
- ThreadingModel threadingModel() const { return RenderThread; }
+ ThreadingModel threadingModel() const override { return RenderThread; }
virtual QQuickAnimatorJob *createJob() const = 0;
virtual QString propertyName() const = 0;
QAbstractAnimationJob *transition(QQuickStateActions &actions,
QQmlProperties &modified,
TransitionDirection,
- QObject *);
+ QObject *) override;
QQuickAnimator(QQuickAnimatorPrivate &dd, QObject *parent = 0);
QQuickAnimator(QObject *parent = 0);
@@ -112,8 +112,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickScaleAnimator : public QQuickAnimator
public:
QQuickScaleAnimator(QObject *parent = 0);
protected:
- QQuickAnimatorJob *createJob() const;
- QString propertyName() const { return QStringLiteral("scale"); }
+ QQuickAnimatorJob *createJob() const override;
+ QString propertyName() const override { return QStringLiteral("scale"); }
};
class Q_QUICK_PRIVATE_EXPORT QQuickXAnimator : public QQuickAnimator
@@ -122,8 +122,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickXAnimator : public QQuickAnimator
public:
QQuickXAnimator(QObject *parent = 0);
protected:
- QQuickAnimatorJob *createJob() const;
- QString propertyName() const{ return QStringLiteral("x"); }
+ QQuickAnimatorJob *createJob() const override;
+ QString propertyName() const override { return QStringLiteral("x"); }
};
class Q_QUICK_PRIVATE_EXPORT QQuickYAnimator : public QQuickAnimator
@@ -132,8 +132,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickYAnimator : public QQuickAnimator
public:
QQuickYAnimator(QObject *parent = 0);
protected:
- QQuickAnimatorJob *createJob() const;
- QString propertyName() const { return QStringLiteral("y"); }
+ QQuickAnimatorJob *createJob() const override;
+ QString propertyName() const override { return QStringLiteral("y"); }
};
class Q_QUICK_PRIVATE_EXPORT QQuickOpacityAnimator : public QQuickAnimator
@@ -142,8 +142,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickOpacityAnimator : public QQuickAnimator
public:
QQuickOpacityAnimator(QObject *parent = 0);
protected:
- QQuickAnimatorJob *createJob() const;
- QString propertyName() const { return QStringLiteral("opacity"); }
+ QQuickAnimatorJob *createJob() const override;
+ QString propertyName() const override { return QStringLiteral("opacity"); }
};
class QQuickRotationAnimatorPrivate;
@@ -166,8 +166,8 @@ Q_SIGNALS:
void directionChanged(RotationDirection dir);
protected:
- QQuickAnimatorJob *createJob() const;
- QString propertyName() const { return QStringLiteral("rotation"); }
+ QQuickAnimatorJob *createJob() const override;
+ QString propertyName() const override { return QStringLiteral("rotation"); }
};
#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl)
@@ -188,8 +188,8 @@ Q_SIGNALS:
void uniformChanged(const QString &);
protected:
- QQuickAnimatorJob *createJob() const;
- QString propertyName() const;
+ QQuickAnimatorJob *createJob() const override;
+ QString propertyName() const override;
};
#endif
diff --git a/src/quick/util/qquickanimatorcontroller_p.h b/src/quick/util/qquickanimatorcontroller_p.h
index 0a9902cc30..b63518abad 100644
--- a/src/quick/util/qquickanimatorcontroller_p.h
+++ b/src/quick/util/qquickanimatorcontroller_p.h
@@ -74,8 +74,8 @@ public:
void beforeNodeSync();
void afterNodeSync();
- void animationFinished(QAbstractAnimationJob *job);
- void animationStateChanged(QAbstractAnimationJob *job, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState);
+ void animationFinished(QAbstractAnimationJob *job) override;
+ void animationStateChanged(QAbstractAnimationJob *job, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState) override;
void requestSync();
diff --git a/src/quick/util/qquickapplication.cpp b/src/quick/util/qquickapplication.cpp
index 5c26b23ff7..ca4a5bfb56 100644
--- a/src/quick/util/qquickapplication.cpp
+++ b/src/quick/util/qquickapplication.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qquickapplication_p.h"
-
+#include <private/qquickscreen_p.h>
#include <private/qobject_p.h>
#include <private/qguiapplication_p.h>
#include <qpa/qplatformintegration.h>
@@ -63,6 +63,10 @@ QQuickApplication::QQuickApplication(QObject *parent)
this, SIGNAL(stateChanged(Qt::ApplicationState)));
connect(qApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)),
this, SIGNAL(activeChanged()));
+
+ connect(qApp, &QGuiApplication::screenAdded, this, &QQuickApplication::updateScreens);
+ connect(qApp, &QGuiApplication::screenRemoved, this, &QQuickApplication::updateScreens);
+ updateScreens();
}
}
@@ -95,4 +99,32 @@ QFont QQuickApplication::font() const
return QGuiApplication::font();
}
+int screens_count(QQmlListProperty<QQuickScreenInfo> *prop)
+{
+ return static_cast<QVector<QQuickScreenInfo *> *>(prop->data)->count();
+}
+
+QQuickScreenInfo *screens_at(QQmlListProperty<QQuickScreenInfo> *prop, int idx)
+{
+ return static_cast<QVector<QQuickScreenInfo *> *>(prop->data)->at(idx);
+}
+
+QQmlListProperty<QQuickScreenInfo> QQuickApplication::screens()
+{
+ return QQmlListProperty<QQuickScreenInfo>(this,
+ const_cast<QVector<QQuickScreenInfo *> *>(&m_screens), &screens_count, &screens_at);
+}
+
+void QQuickApplication::updateScreens()
+{
+ const QList<QScreen *> screenList = QGuiApplication::screens();
+ m_screens.resize(screenList.count());
+ for (int i = 0; i < screenList.count(); ++i) {
+ if (!m_screens[i])
+ m_screens[i] = new QQuickScreenInfo(this);
+ m_screens[i]->setWrappedScreen(screenList[i]);
+ }
+ emit screensChanged();
+}
+
QT_END_NAMESPACE
diff --git a/src/quick/util/qquickapplication_p.h b/src/quick/util/qquickapplication_p.h
index 091cb094ed..70381553b4 100644
--- a/src/quick/util/qquickapplication_p.h
+++ b/src/quick/util/qquickapplication_p.h
@@ -56,10 +56,10 @@
#include <qqml.h>
#include <QtQml/private/qqmlglobal_p.h>
#include <private/qtquickglobal_p.h>
+#include "../items/qquickscreen_p.h"
QT_BEGIN_NAMESPACE
-
class Q_AUTOTEST_EXPORT QQuickApplication : public QQmlApplication
{
Q_OBJECT
@@ -68,6 +68,7 @@ class Q_AUTOTEST_EXPORT QQuickApplication : public QQmlApplication
Q_PROPERTY(bool supportsMultipleWindows READ supportsMultipleWindows CONSTANT)
Q_PROPERTY(Qt::ApplicationState state READ state NOTIFY stateChanged)
Q_PROPERTY(QFont font READ font CONSTANT)
+ Q_PROPERTY(QQmlListProperty<QQuickScreenInfo> screens READ screens NOTIFY screensChanged)
public:
explicit QQuickApplication(QObject *parent = 0);
@@ -77,14 +78,20 @@ public:
bool supportsMultipleWindows() const;
Qt::ApplicationState state() const;
QFont font() const;
+ QQmlListProperty<QQuickScreenInfo> screens();
Q_SIGNALS:
void activeChanged();
void layoutDirectionChanged();
void stateChanged(Qt::ApplicationState state);
+ void screensChanged();
+
+private Q_SLOTS:
+ void updateScreens();
private:
Q_DISABLE_COPY(QQuickApplication)
+ QVector<QQuickScreenInfo *> m_screens;
};
QT_END_NAMESPACE
diff --git a/src/quick/util/qquickbehavior.cpp b/src/quick/util/qquickbehavior.cpp
index 1d3ee2c4be..9af1d41b29 100644
--- a/src/quick/util/qquickbehavior.cpp
+++ b/src/quick/util/qquickbehavior.cpp
@@ -60,7 +60,7 @@ public:
QQuickBehaviorPrivate() : animation(0), animationInstance(0), enabled(true), finalized(false)
, blockRunningChanged(false) {}
- virtual void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState);
+ void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState) override;
QQmlProperty property;
QVariant targetValue;
diff --git a/src/quick/util/qquickbehavior_p.h b/src/quick/util/qquickbehavior_p.h
index c3438d8c6d..b3fd2af400 100644
--- a/src/quick/util/qquickbehavior_p.h
+++ b/src/quick/util/qquickbehavior_p.h
@@ -75,8 +75,8 @@ public:
QQuickBehavior(QObject *parent=0);
~QQuickBehavior();
- virtual void setTarget(const QQmlProperty &);
- virtual void write(const QVariant &value);
+ void setTarget(const QQmlProperty &) override;
+ void write(const QVariant &value) override;
QQuickAbstractAnimation *animation();
void setAnimation(QQuickAbstractAnimation *);
diff --git a/src/quick/util/qquickimageprovider.h b/src/quick/util/qquickimageprovider.h
index d4719a7f5b..879c4d0fcc 100644
--- a/src/quick/util/qquickimageprovider.h
+++ b/src/quick/util/qquickimageprovider.h
@@ -90,8 +90,8 @@ public:
QQuickImageProvider(ImageType type, Flags flags = Flags());
virtual ~QQuickImageProvider();
- ImageType imageType() const;
- Flags flags() const;
+ ImageType imageType() const override;
+ Flags flags() const override;
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
virtual QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize, bool requestedAutoTransform);
diff --git a/src/quick/util/qquickpath_p.h b/src/quick/util/qquickpath_p.h
index 457f69d20f..06ad389b49 100644
--- a/src/quick/util/qquickpath_p.h
+++ b/src/quick/util/qquickpath_p.h
@@ -156,7 +156,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathLine : public QQuickCurve
public:
QQuickPathLine(QObject *parent=0) : QQuickCurve(parent) {}
- void addToPath(QPainterPath &path, const QQuickPathData &);
+ void addToPath(QPainterPath &path, const QQuickPathData &) override;
};
class Q_QUICK_PRIVATE_EXPORT QQuickPathQuad : public QQuickCurve
@@ -184,7 +184,7 @@ public:
void setRelativeControlY(qreal y);
bool hasRelativeControlY();
- void addToPath(QPainterPath &path, const QQuickPathData &);
+ void addToPath(QPainterPath &path, const QQuickPathData &) override;
Q_SIGNALS:
void controlXChanged();
@@ -242,7 +242,7 @@ public:
void setRelativeControl2Y(qreal y);
bool hasRelativeControl2Y();
- void addToPath(QPainterPath &path, const QQuickPathData &);
+ void addToPath(QPainterPath &path, const QQuickPathData &) override;
Q_SIGNALS:
void control1XChanged();
@@ -271,7 +271,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathCatmullRomCurve : public QQuickCurve
public:
QQuickPathCatmullRomCurve(QObject *parent=0) : QQuickCurve(parent) {}
- void addToPath(QPainterPath &path, const QQuickPathData &);
+ void addToPath(QPainterPath &path, const QQuickPathData &) override;
};
class Q_QUICK_PRIVATE_EXPORT QQuickPathArc : public QQuickCurve
@@ -301,7 +301,7 @@ public:
ArcDirection direction() const;
void setDirection(ArcDirection direction);
- void addToPath(QPainterPath &path, const QQuickPathData &);
+ void addToPath(QPainterPath &path, const QQuickPathData &) override;
Q_SIGNALS:
void radiusXChanged();
@@ -326,7 +326,7 @@ public:
QString path() const;
void setPath(const QString &path);
- void addToPath(QPainterPath &path, const QQuickPathData &);
+ void addToPath(QPainterPath &path, const QQuickPathData &) override;
Q_SIGNALS:
void pathChanged();
@@ -405,8 +405,8 @@ Q_SIGNALS:
void startYChanged();
protected:
- virtual void componentComplete();
- virtual void classBegin();
+ void componentComplete() override;
+ void classBegin() override;
void disconnectPathElements();
void connectPathElements();
void gatherAttributes();
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index 96b88636fe..7dffc09ba5 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -177,7 +177,7 @@ class QQuickPixmapReaderThreadObject : public QObject {
public:
QQuickPixmapReaderThreadObject(QQuickPixmapReader *);
void processJobs();
- virtual bool event(QEvent *e);
+ bool event(QEvent *e) override;
private slots:
void networkRequestDone();
void asyncResponseFinished();
@@ -891,7 +891,7 @@ public:
void purgeCache();
protected:
- virtual void timerEvent(QTimerEvent *);
+ void timerEvent(QTimerEvent *) override;
public:
QHash<QQuickPixmapKey, QQuickPixmapData *> m_cache;
diff --git a/src/quick/util/qquickpixmapcache_p.h b/src/quick/util/qquickpixmapcache_p.h
index f53e847e00..623c826815 100644
--- a/src/quick/util/qquickpixmapcache_p.h
+++ b/src/quick/util/qquickpixmapcache_p.h
@@ -77,10 +77,10 @@ class QQuickDefaultTextureFactory : public QQuickTextureFactory
Q_OBJECT
public:
QQuickDefaultTextureFactory(const QImage &i);
- QSGTexture *createTexture(QQuickWindow *window) const;
- QSize textureSize() const { return size; }
- int textureByteCount() const { return size.width() * size.height() * 4; }
- QImage image() const { return im; }
+ QSGTexture *createTexture(QQuickWindow *window) const override;
+ QSize textureSize() const override { return size; }
+ int textureByteCount() const override { return size.width() * size.height() * 4; }
+ QImage image() const override { return im; }
private:
QImage im;
diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp
index 37a910876e..4dfeb7cc4a 100644
--- a/src/quick/util/qquickpropertychanges.cpp
+++ b/src/quick/util/qquickpropertychanges.cpp
@@ -142,29 +142,29 @@ public:
QQuickReplaceSignalHandler() {}
~QQuickReplaceSignalHandler() {}
- virtual EventType type() const { return SignalHandler; }
+ EventType type() const override { return SignalHandler; }
QQmlProperty property;
QQmlBoundSignalExpressionPointer expression;
QQmlBoundSignalExpressionPointer reverseExpression;
QQmlBoundSignalExpressionPointer rewindExpression;
- virtual void execute() {
+ void execute() override {
QQmlPropertyPrivate::setSignalExpression(property, expression);
}
- virtual bool isReversable() { return true; }
- virtual void reverse() {
+ bool isReversable() override { return true; }
+ void reverse() override {
QQmlPropertyPrivate::setSignalExpression(property, reverseExpression);
}
- virtual void saveOriginals() {
+ void saveOriginals() override {
saveCurrentValues();
reverseExpression = rewindExpression;
}
- virtual bool needsCopy() { return true; }
- virtual void copyOriginals(QQuickStateActionEvent *other)
+ bool needsCopy() override { return true; }
+ void copyOriginals(QQuickStateActionEvent *other) override
{
QQuickReplaceSignalHandler *rsh = static_cast<QQuickReplaceSignalHandler*>(other);
saveCurrentValues();
@@ -173,14 +173,14 @@ public:
reverseExpression = rsh->reverseExpression;
}
- virtual void rewind() {
+ void rewind() override {
QQmlPropertyPrivate::setSignalExpression(property, rewindExpression);
}
- virtual void saveCurrentValues() {
+ void saveCurrentValues() override {
rewindExpression = QQmlPropertyPrivate::signalExpression(property);
}
- virtual bool override(QQuickStateActionEvent*other) {
+ bool override(QQuickStateActionEvent *other) override {
if (other == this)
return true;
if (other->type() != type())
diff --git a/src/quick/util/qquickpropertychanges_p.h b/src/quick/util/qquickpropertychanges_p.h
index 0537750338..35b37e84cb 100644
--- a/src/quick/util/qquickpropertychanges_p.h
+++ b/src/quick/util/qquickpropertychanges_p.h
@@ -78,7 +78,7 @@ public:
bool isExplicit() const;
void setIsExplicit(bool);
- virtual ActionList actions();
+ ActionList actions() override;
bool containsProperty(const QString &name) const;
bool containsValue(const QString &name) const;
@@ -103,8 +103,8 @@ public:
void verifyList(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding);
- virtual void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props);
- virtual void applyBindings(QObject *obj, QV4::CompiledData::CompilationUnit *compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings);
+ void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props) override;
+ void applyBindings(QObject *obj, QV4::CompiledData::CompilationUnit *compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) override;
};
diff --git a/src/quick/util/qquicksmoothedanimation_p.h b/src/quick/util/qquicksmoothedanimation_p.h
index d640985b39..2f0e3bc0d8 100644
--- a/src/quick/util/qquicksmoothedanimation_p.h
+++ b/src/quick/util/qquicksmoothedanimation_p.h
@@ -79,8 +79,8 @@ public:
ReversingMode reversingMode() const;
void setReversingMode(ReversingMode);
- virtual int duration() const;
- virtual void setDuration(int);
+ int duration() const override;
+ void setDuration(int) override;
qreal velocity() const;
void setVelocity(qreal);
@@ -88,10 +88,10 @@ public:
int maximumEasingTime() const;
void setMaximumEasingTime(int);
- virtual QAbstractAnimationJob* transition(QQuickStateActions &actions,
+ QAbstractAnimationJob* transition(QQuickStateActions &actions,
QQmlProperties &modified,
TransitionDirection direction,
- QObject *defaultTarget = 0);
+ QObject *defaultTarget = 0) override;
Q_SIGNALS:
void velocityChanged();
void reversingModeChanged();
diff --git a/src/quick/util/qquicksmoothedanimation_p_p.h b/src/quick/util/qquicksmoothedanimation_p_p.h
index 4a61599592..a415fdb55f 100644
--- a/src/quick/util/qquicksmoothedanimation_p_p.h
+++ b/src/quick/util/qquicksmoothedanimation_p_p.h
@@ -93,7 +93,7 @@ public:
QQmlProperty target;
- int duration() const;
+ int duration() const override;
void restart();
void init();
@@ -101,9 +101,9 @@ public:
void clearTemplate() { animationTemplate = 0; }
protected:
- virtual void updateCurrentTime(int);
- virtual void updateState(QAbstractAnimationJob::State, QAbstractAnimationJob::State);
- void debugAnimation(QDebug d) const;
+ void updateCurrentTime(int) override;
+ void updateState(QAbstractAnimationJob::State, QAbstractAnimationJob::State) override;
+ void debugAnimation(QDebug d) const override;
private:
qreal easeFollow(qreal);
diff --git a/src/quick/util/qquickspringanimation.cpp b/src/quick/util/qquickspringanimation.cpp
index 294122150a..a9940959a0 100644
--- a/src/quick/util/qquickspringanimation.cpp
+++ b/src/quick/util/qquickspringanimation.cpp
@@ -61,7 +61,7 @@ public:
QSpringAnimation(QQuickSpringAnimationPrivate * = 0);
~QSpringAnimation();
- int duration() const;
+ int duration() const override;
void restart();
void init();
@@ -97,9 +97,9 @@ public:
void clearTemplate() { animationTemplate = 0; }
protected:
- virtual void updateCurrentTime(int time);
- virtual void updateState(QAbstractAnimationJob::State, QAbstractAnimationJob::State);
- void debugAnimation(QDebug d) const;
+ void updateCurrentTime(int time) override;
+ void updateState(QAbstractAnimationJob::State, QAbstractAnimationJob::State) override;
+ void debugAnimation(QDebug d) const override;
private:
QQuickSpringAnimationPrivate *animationTemplate;
diff --git a/src/quick/util/qquickspringanimation_p.h b/src/quick/util/qquickspringanimation_p.h
index 141a2469d7..ffb2c41e6b 100644
--- a/src/quick/util/qquickspringanimation_p.h
+++ b/src/quick/util/qquickspringanimation_p.h
@@ -94,10 +94,10 @@ public:
qreal modulus() const;
void setModulus(qreal modulus);
- virtual QAbstractAnimationJob* transition(QQuickStateActions &actions,
+ QAbstractAnimationJob* transition(QQuickStateActions &actions,
QQmlProperties &modified,
TransitionDirection direction,
- QObject *defaultTarget = 0);
+ QObject *defaultTarget = 0) override;
Q_SIGNALS:
void modulusChanged();
diff --git a/src/quick/util/qquickstatechangescript_p.h b/src/quick/util/qquickstatechangescript_p.h
index 0c17b7c68c..a1315ae2ef 100644
--- a/src/quick/util/qquickstatechangescript_p.h
+++ b/src/quick/util/qquickstatechangescript_p.h
@@ -69,9 +69,9 @@ public:
QQuickStateChangeScript(QObject *parent=0);
~QQuickStateChangeScript();
- virtual ActionList actions();
+ ActionList actions() override;
- virtual EventType type() const;
+ EventType type() const override;
QQmlScriptString script() const;
void setScript(const QQmlScriptString &);
@@ -79,7 +79,7 @@ public:
QString name() const;
void setName(const QString &);
- virtual void execute();
+ void execute() override;
};
diff --git a/src/quick/util/qquickstategroup_p.h b/src/quick/util/qquickstategroup_p.h
index 78508ac166..eebe3a9e56 100644
--- a/src/quick/util/qquickstategroup_p.h
+++ b/src/quick/util/qquickstategroup_p.h
@@ -81,8 +81,8 @@ public:
QQuickState *findState(const QString &name) const;
void removeState(QQuickState *state);
- virtual void classBegin();
- virtual void componentComplete();
+ void classBegin() override;
+ void componentComplete() override;
Q_SIGNALS:
void stateChanged(const QString &);
diff --git a/src/quick/util/qquickstyledtext.cpp b/src/quick/util/qquickstyledtext.cpp
index 4139c87eda..ae8719341d 100644
--- a/src/quick/util/qquickstyledtext.cpp
+++ b/src/quick/util/qquickstyledtext.cpp
@@ -721,8 +721,7 @@ void QQuickStyledTextPrivate::parseImageAttributes(const QChar *&ch, const QStri
QString padding(qFloor(imgWidth / spaceWidth), QChar::Nbsp);
if (!trailingSpace)
textOut += QLatin1Char(' ');
- textOut += padding;
- textOut += QLatin1Char(' ');
+ textOut += padding + QLatin1Char(' ');
}
QPair<QStringRef,QStringRef> QQuickStyledTextPrivate::parseAttribute(const QChar *&ch, const QString &textIn)
diff --git a/src/quick/util/qquicktimeline_p_p.h b/src/quick/util/qquicktimeline_p_p.h
index 552f194b79..ae1087487b 100644
--- a/src/quick/util/qquicktimeline_p_p.h
+++ b/src/quick/util/qquicktimeline_p_p.h
@@ -100,14 +100,14 @@ public:
int time() const;
- virtual int duration() const;
+ int duration() const override;
Q_SIGNALS:
void updated();
void completed();
protected:
- virtual void updateCurrentTime(int);
- void debugAnimation(QDebug d) const;
+ void updateCurrentTime(int) override;
+ void debugAnimation(QDebug d) const override;
private:
void remove(QQuickTimeLineObject *);
@@ -181,7 +181,7 @@ public:
Q_ASSERT(_class);
}
- virtual void setValue(qreal v)
+ void setValue(qreal v) override
{
QQuickTimeLineValue::setValue(v);
if (_setFunctionReal) (_class->*_setFunctionReal)(v);
diff --git a/src/quick/util/qquicktransition.cpp b/src/quick/util/qquicktransition.cpp
index c8b5482c87..1d258d84bf 100644
--- a/src/quick/util/qquicktransition.cpp
+++ b/src/quick/util/qquicktransition.cpp
@@ -106,7 +106,7 @@ public:
QQuickTransitionManager *manager;
protected:
- virtual void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState);
+ void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState) override;
};
class QQuickTransitionPrivate : public QObjectPrivate, QAnimationJobChangeListener
@@ -134,7 +134,7 @@ public:
bool reversible;
bool enabled;
protected:
- virtual void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State, QAbstractAnimationJob::State);
+ void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State, QAbstractAnimationJob::State) override;
static void append_animation(QQmlListProperty<QQuickAbstractAnimation> *list, QQuickAbstractAnimation *a);
static int animation_count(QQmlListProperty<QQuickAbstractAnimation> *list);
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 479584af54..ec6245aa1c 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -2144,12 +2144,27 @@ void tst_QJSEngine::jsNumberClass()
QJSValue ret = eng.evaluate("new Number(123).toExponential()");
QVERIFY(ret.isString());
QCOMPARE(ret.toString(), QString::fromLatin1("1.23e+2"));
+ ret = eng.evaluate("new Number(123).toExponential(1)");
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("1.2e+2"));
+ ret = eng.evaluate("new Number(123).toExponential(2)");
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("1.23e+2"));
+ ret = eng.evaluate("new Number(123).toExponential(3)");
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("1.230e+2"));
}
QVERIFY(proto.property("toFixed").isCallable());
{
QJSValue ret = eng.evaluate("new Number(123).toFixed()");
QVERIFY(ret.isString());
QCOMPARE(ret.toString(), QString::fromLatin1("123"));
+ ret = eng.evaluate("new Number(123).toFixed(1)");
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("123.0"));
+ ret = eng.evaluate("new Number(123).toFixed(2)");
+ QVERIFY(ret.isString());
+ QCOMPARE(ret.toString(), QString::fromLatin1("123.00"));
}
QVERIFY(proto.property("toPrecision").isCallable());
{
diff --git a/tests/auto/qmltest/events/tst_events.qml b/tests/auto/qmltest/events/tst_events.qml
index e655c26c7d..d9868a316c 100644
--- a/tests/auto/qmltest/events/tst_events.qml
+++ b/tests/auto/qmltest/events/tst_events.qml
@@ -27,6 +27,7 @@
****************************************************************************/
import QtQuick 2.0
+import QtQuick.Window 2.0
import QtTest 1.1
Rectangle {
@@ -56,6 +57,16 @@ Rectangle {
signalName: "doubleClickSignalHelper"
}
+ Window {
+ id: sub
+ visible: true
+ property bool clicked: false
+ MouseArea {
+ anchors.fill: parent
+ onClicked: sub.clicked = true
+ }
+ }
+
MouseArea {
anchors.fill: parent
onClicked: {
@@ -89,6 +100,11 @@ Rectangle {
tryCompare(top, "mouseHasBeenClicked", true, 10000)
}
+ function test_mouse_click_subwindow() {
+ mouseClick(sub)
+ tryCompare(sub, "clicked", true, 10000)
+ }
+
function test_mouse_doubleclick() {
doubleClickSpy.clear()
mouseDoubleClickSequence(top, 25, 30)
diff --git a/tests/auto/quick/drawingmodes/data/DrawingModes.qml b/tests/auto/quick/drawingmodes/data/DrawingModes.qml
new file mode 100644
index 0000000000..4211f247f8
--- /dev/null
+++ b/tests/auto/quick/drawingmodes/data/DrawingModes.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+import Test 1.0
+
+Rectangle {
+ id: root
+
+ width: 200
+ height: 200
+ color: "black"
+
+ DrawingModeItem {
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/quick/drawingmodes/drawingmodes.pro b/tests/auto/quick/drawingmodes/drawingmodes.pro
new file mode 100644
index 0000000000..ff5383b501
--- /dev/null
+++ b/tests/auto/quick/drawingmodes/drawingmodes.pro
@@ -0,0 +1,17 @@
+CONFIG += testcase
+TARGET = tst_drawingmodes
+SOURCES += tst_drawingmodes.cpp
+
+macos:CONFIG -= app_bundle
+
+TESTDATA = data/*
+
+include(../../shared/util.pri)
+
+CONFIG += parallel_test
+QT += gui qml quick testlib
+
+OTHER_FILES += \
+ data/DrawingModes.qml
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp b/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp
new file mode 100644
index 0000000000..d4065e3d38
--- /dev/null
+++ b/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp
@@ -0,0 +1,340 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/qquickview.h>
+#include <QtQuick/qsgnode.h>
+#include <QtQuick/qsggeometry.h>
+#include <QtQuick/qsgflatcolormaterial.h>
+#include <QtGui/qscreen.h>
+#include <QtGui/qopenglcontext.h>
+
+#include "../../shared/util.h"
+
+class tst_drawingmodes : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_drawingmodes();
+
+ bool hasPixelAround(const QImage &fb, int centerX, int centerY);
+ QImage runTest(const QString &fileName)
+ {
+ QQuickView view(&outerWindow);
+ view.setResizeMode(QQuickView::SizeViewToRootObject);
+ view.setSource(testFileUrl(fileName));
+ view.setVisible(true);
+ QTest::qWaitForWindowExposed(&view);
+ return view.grabWindow();
+ }
+
+ //It is important for platforms that only are able to show fullscreen windows
+ //to have a container for the window that is painted on.
+ QQuickWindow outerWindow;
+ const QRgb black;
+ const QRgb red;
+
+private slots:
+ void points();
+ void lines();
+ void lineStrip();
+ void lineLoop();
+ void triangles();
+ void triangleStrip();
+ void triangleFan();
+};
+
+class DrawingModeItem : public QQuickItem
+{
+ Q_OBJECT
+public:
+ static GLenum drawingMode;
+
+ DrawingModeItem() : first(QSGGeometry::defaultAttributes_Point2D(), 5),
+ second(QSGGeometry::defaultAttributes_Point2D(), 5)
+ {
+ setFlag(ItemHasContents, true);
+ material.setColor(Qt::red);
+ }
+
+protected:
+ QSGGeometry first;
+ QSGGeometry second;
+ QSGFlatColorMaterial material;
+
+ virtual QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *)
+ {
+ if (!node) {
+ QRect bounds(0, 0, 200, 200);
+ first.setDrawingMode(drawingMode);
+ second.setDrawingMode(drawingMode);
+
+ QSGGeometry::Point2D *v = first.vertexDataAsPoint2D();
+ v[0].set(bounds.width() * 2 / 8, bounds.height() / 2);
+ v[1].set(bounds.width() / 8, bounds.height() / 4);
+ v[2].set(bounds.width() * 3 / 8, bounds.height() / 4);
+ v[3].set(bounds.width() * 3 / 8, bounds.height() * 3 / 4);
+ v[4].set(bounds.width() / 8, bounds.height() * 3 / 4);
+
+ v = second.vertexDataAsPoint2D();
+ v[0].set(bounds.width() * 6 / 8, bounds.height() / 2);
+ v[1].set(bounds.width() * 5 / 8, bounds.height() / 4);
+ v[2].set(bounds.width() * 7 / 8, bounds.height() / 4);
+ v[3].set(bounds.width() * 7 / 8, bounds.height() * 3 / 4);
+ v[4].set(bounds.width() * 5 / 8, bounds.height() * 3 / 4);
+
+ node = new QSGNode;
+ QSGGeometryNode *child = new QSGGeometryNode;
+ child->setGeometry(&first);
+ child->setMaterial(&material);
+ node->appendChildNode(child);
+ child = new QSGGeometryNode;
+ child->setGeometry(&second);
+ child->setMaterial(&material);
+ node->appendChildNode(child);
+ }
+ return node;
+ }
+};
+
+GLenum DrawingModeItem::drawingMode;
+
+bool tst_drawingmodes::hasPixelAround(const QImage &fb, int centerX, int centerY) {
+ for (int x = centerX - 2; x <= centerX + 2; ++x) {
+ for (int y = centerY - 2; y <= centerY + 2; ++y) {
+ if (fb.pixel(x, y) == red)
+ return true;
+ }
+ }
+ return false;
+}
+
+tst_drawingmodes::tst_drawingmodes() : black(qRgb(0, 0, 0)), red(qRgb(0xff, 0, 0))
+{
+ qmlRegisterType<DrawingModeItem>("Test", 1, 0, "DrawingModeItem");
+ outerWindow.showNormal();
+ outerWindow.setGeometry(0,0,400,400);
+}
+
+void tst_drawingmodes::points()
+{
+ DrawingModeItem::drawingMode = GL_POINTS;
+ if (QGuiApplication::primaryScreen()->depth() < 24)
+ QSKIP("This test does not work at display depths < 24");
+
+#ifdef Q_OS_WIN
+ if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES)
+ QSKIP("ANGLE cannot draw GL_POINTS.");
+#endif
+
+ QImage fb = runTest("DrawingModes.qml");
+
+ QVERIFY(hasPixelAround(fb, 50, 100));
+ QVERIFY(hasPixelAround(fb, 25, 50));
+ QVERIFY(hasPixelAround(fb, 75, 50));
+ QVERIFY(hasPixelAround(fb, 75, 150));
+ QVERIFY(hasPixelAround(fb, 25, 150));
+
+ QVERIFY(hasPixelAround(fb, 150, 100));
+ QVERIFY(hasPixelAround(fb, 125, 50));
+ QVERIFY(hasPixelAround(fb, 175, 50));
+ QVERIFY(hasPixelAround(fb, 175, 150));
+ QVERIFY(hasPixelAround(fb, 125, 150));
+
+ QVERIFY(!hasPixelAround(fb, 135, 70));
+ QVERIFY(!hasPixelAround(fb, 175, 100));
+ QVERIFY(!hasPixelAround(fb, 110, 140));
+ QVERIFY(!hasPixelAround(fb, 50, 50));
+ QVERIFY(!hasPixelAround(fb, 50, 150));
+ QVERIFY(!hasPixelAround(fb, 25, 100));
+ QVERIFY(!hasPixelAround(fb, 75, 100));
+ QVERIFY(!hasPixelAround(fb, 125, 100));
+ QVERIFY(!hasPixelAround(fb, 150, 50));
+ QVERIFY(!hasPixelAround(fb, 150, 150));
+ QVERIFY(!hasPixelAround(fb, 135, 130));
+ QVERIFY(!hasPixelAround(fb, 35, 130));
+}
+
+void tst_drawingmodes::lines()
+{
+ DrawingModeItem::drawingMode = GL_LINES;
+ if (QGuiApplication::primaryScreen()->depth() < 24)
+ QSKIP("This test does not work at display depths < 24");
+ QImage fb = runTest("DrawingModes.qml");
+
+ QCOMPARE(fb.width(), 200);
+ QCOMPARE(fb.height(), 200);
+
+ QVERIFY(hasPixelAround(fb, 135, 70));
+ QVERIFY(hasPixelAround(fb, 175, 100));
+ QVERIFY(!hasPixelAround(fb, 110, 140));
+ QVERIFY(!hasPixelAround(fb, 50, 50));
+ QVERIFY(!hasPixelAround(fb, 50, 150));
+
+ QVERIFY(hasPixelAround(fb, 35, 70));
+ QVERIFY(hasPixelAround(fb, 75, 100));
+ QVERIFY(!hasPixelAround(fb, 25, 100));
+ QVERIFY(!hasPixelAround(fb, 125, 100));
+ QVERIFY(!hasPixelAround(fb, 150, 50));
+ QVERIFY(!hasPixelAround(fb, 150, 150));
+ QVERIFY(!hasPixelAround(fb, 135, 130));
+ QVERIFY(!hasPixelAround(fb, 35, 130));
+}
+
+void tst_drawingmodes::lineStrip()
+{
+ DrawingModeItem::drawingMode = GL_LINE_STRIP;
+ if (QGuiApplication::primaryScreen()->depth() < 24)
+ QSKIP("This test does not work at display depths < 24");
+ QImage fb = runTest("DrawingModes.qml");
+
+ QCOMPARE(fb.width(), 200);
+ QCOMPARE(fb.height(), 200);
+
+ QVERIFY(hasPixelAround(fb, 135, 70));
+ QVERIFY(hasPixelAround(fb, 150, 50));
+ QVERIFY(hasPixelAround(fb, 175, 100));
+ QVERIFY(hasPixelAround(fb, 150, 150));
+
+ QVERIFY(hasPixelAround(fb, 35, 70));
+ QVERIFY(hasPixelAround(fb, 50, 50));
+ QVERIFY(hasPixelAround(fb, 75, 100));
+ QVERIFY(hasPixelAround(fb, 50, 150));
+
+ QVERIFY(!hasPixelAround(fb, 110, 140)); // bad line not there => line strip unbatched
+
+ QVERIFY(!hasPixelAround(fb, 25, 100));
+ QVERIFY(!hasPixelAround(fb, 125, 100));
+ QVERIFY(!hasPixelAround(fb, 135, 130));
+ QVERIFY(!hasPixelAround(fb, 35, 130));
+}
+
+void tst_drawingmodes::lineLoop()
+{
+ DrawingModeItem::drawingMode = GL_LINE_LOOP;
+ if (QGuiApplication::primaryScreen()->depth() < 24)
+ QSKIP("This test does not work at display depths < 24");
+ QImage fb = runTest("DrawingModes.qml");
+
+ QCOMPARE(fb.width(), 200);
+ QCOMPARE(fb.height(), 200);
+
+ QVERIFY(hasPixelAround(fb, 135, 70));
+ QVERIFY(hasPixelAround(fb, 135, 130));
+ QVERIFY(hasPixelAround(fb, 150, 50));
+ QVERIFY(hasPixelAround(fb, 175, 100));
+ QVERIFY(hasPixelAround(fb, 150, 150));
+
+ QVERIFY(hasPixelAround(fb, 35, 70));
+ QVERIFY(hasPixelAround(fb, 35, 130));
+ QVERIFY(hasPixelAround(fb, 50, 50));
+ QVERIFY(hasPixelAround(fb, 75, 100));
+ QVERIFY(hasPixelAround(fb, 50, 150));
+
+ QVERIFY(!hasPixelAround(fb, 110, 140)); // bad line not there => line loop unbatched
+
+ QVERIFY(!hasPixelAround(fb, 25, 100));
+ QVERIFY(!hasPixelAround(fb, 125, 100));
+}
+
+void tst_drawingmodes::triangles()
+{
+ DrawingModeItem::drawingMode = GL_TRIANGLES;
+ if (QGuiApplication::primaryScreen()->depth() < 24)
+ QSKIP("This test does not work at display depths < 24");
+ QImage fb = runTest("DrawingModes.qml");
+
+ QCOMPARE(fb.width(), 200);
+ QCOMPARE(fb.height(), 200);
+
+ QVERIFY(hasPixelAround(fb, 150, 75));
+ QVERIFY(!hasPixelAround(fb, 162, 100));
+ QVERIFY(!hasPixelAround(fb, 150, 125));
+ QVERIFY(!hasPixelAround(fb, 137, 100));
+
+ QVERIFY(!hasPixelAround(fb, 100, 125));
+
+ QVERIFY(hasPixelAround(fb, 50, 75));
+ QVERIFY(!hasPixelAround(fb, 62, 100));
+ QVERIFY(!hasPixelAround(fb, 50, 125));
+ QVERIFY(!hasPixelAround(fb, 37, 100));
+}
+
+
+void tst_drawingmodes::triangleStrip()
+{
+ DrawingModeItem::drawingMode = GL_TRIANGLE_STRIP;
+ if (QGuiApplication::primaryScreen()->depth() < 24)
+ QSKIP("This test does not work at display depths < 24");
+ QImage fb = runTest("DrawingModes.qml");
+
+ QCOMPARE(fb.width(), 200);
+ QCOMPARE(fb.height(), 200);
+
+ QVERIFY(hasPixelAround(fb, 150, 75));
+ QVERIFY(hasPixelAround(fb, 162, 100));
+ QVERIFY(hasPixelAround(fb, 150, 125));
+ QVERIFY(!hasPixelAround(fb, 137, 100));
+
+ QVERIFY(!hasPixelAround(fb, 100, 125)); // batching avoids extra triangle by duplicating vertices.
+
+ QVERIFY(hasPixelAround(fb, 50, 75));
+ QVERIFY(hasPixelAround(fb, 62, 100));
+ QVERIFY(hasPixelAround(fb, 50, 125));
+ QVERIFY(!hasPixelAround(fb, 37, 100));
+}
+
+void tst_drawingmodes::triangleFan()
+{
+ DrawingModeItem::drawingMode = GL_TRIANGLE_FAN;
+ if (QGuiApplication::primaryScreen()->depth() < 24)
+ QSKIP("This test does not work at display depths < 24");
+ QImage fb = runTest("DrawingModes.qml");
+
+ QCOMPARE(fb.width(), 200);
+ QCOMPARE(fb.height(), 200);
+
+ QVERIFY(hasPixelAround(fb, 150, 75));
+ QVERIFY(hasPixelAround(fb, 162, 100));
+ QVERIFY(hasPixelAround(fb, 150, 125));
+ QVERIFY(!hasPixelAround(fb, 137, 100));
+
+ QVERIFY(!hasPixelAround(fb, 100, 125)); // no extra triangle; triangle fan is not batched
+
+ QVERIFY(hasPixelAround(fb, 50, 75));
+ QVERIFY(hasPixelAround(fb, 62, 100));
+ QVERIFY(hasPixelAround(fb, 50, 125));
+ QVERIFY(!hasPixelAround(fb, 37, 100));
+}
+
+
+QTEST_MAIN(tst_drawingmodes)
+
+#include "tst_drawingmodes.moc"
diff --git a/tests/auto/quick/qquickscreen/data/screen.qml b/tests/auto/quick/qquickscreen/data/screen.qml
index c246b3cd83..cf60d0ae40 100644
--- a/tests/auto/quick/qquickscreen/data/screen.qml
+++ b/tests/auto/quick/qquickscreen/data/screen.qml
@@ -1,5 +1,5 @@
import QtQuick 2.0
-import QtQuick.Window 2.0 as Window
+import QtQuick.Window 2.3 as Window
Item {
width: 100
@@ -10,6 +10,18 @@ Item {
property int priOrientation: Window.Screen.primaryOrientation
property int updateMask: Window.Screen.orientationUpdateMask
property real devicePixelRatio: Window.Screen.devicePixelRatio
+ property int vx: Window.Screen.virtualX
+ property int vy: Window.Screen.virtualY
Window.Screen.orientationUpdateMask: Qt.LandscapeOrientation | Qt.InvertedLandscapeOrientation
+
+ property int screenCount: Qt.application.screens.length
+
+ property variant allScreens
+ Component.onCompleted: {
+ allScreens = [];
+ var s = Qt.application.screens;
+ for (var i = 0; i < s.length; ++i)
+ allScreens.push(s[i]);
+ }
}
diff --git a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp
index 92afdf6864..26b687a4a6 100644
--- a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp
+++ b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp
@@ -33,13 +33,15 @@
#include <QtQuick/QQuickView>
#include <QtGui/QScreen>
#include "../../shared/util.h"
-
+#include <QtQuick/private/qquickscreen_p.h>
+#include <QDebug>
class tst_qquickscreen : public QQmlDataTest
{
Q_OBJECT
private slots:
void basicProperties();
void screenOnStartup();
+ void fullScreenList();
};
void tst_qquickscreen::basicProperties()
@@ -62,6 +64,10 @@ void tst_qquickscreen::basicProperties()
QCOMPARE(int(screen->orientationUpdateMask()), root->property("updateMask").toInt());
QCOMPARE(screen->devicePixelRatio(), root->property("devicePixelRatio").toReal());
QVERIFY(screen->devicePixelRatio() >= 1.0);
+ QCOMPARE(screen->geometry().x(), root->property("vx").toInt());
+ QCOMPARE(screen->geometry().y(), root->property("vy").toInt());
+
+ QVERIFY(root->property("screenCount").toInt() == QGuiApplication::screens().count());
}
void tst_qquickscreen::screenOnStartup()
@@ -83,6 +89,38 @@ void tst_qquickscreen::screenOnStartup()
QCOMPARE(int(screen->orientationUpdateMask()), root->property("updateMask").toInt());
QCOMPARE(screen->devicePixelRatio(), root->property("devicePixelRatio").toReal());
QVERIFY(screen->devicePixelRatio() >= 1.0);
+ QCOMPARE(screen->geometry().x(), root->property("vx").toInt());
+ QCOMPARE(screen->geometry().y(), root->property("vy").toInt());
+}
+
+void tst_qquickscreen::fullScreenList()
+{
+ QQuickView view;
+ view.setSource(testFileUrl("screen.qml"));
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ QQuickItem* root = view.rootObject();
+ QVERIFY(root);
+
+ QJSValue screensArray = root->property("allScreens").value<QJSValue>();
+ QVERIFY(screensArray.isArray());
+ int length = screensArray.property("length").toInt();
+ const QList<QScreen *> screenList = QGuiApplication::screens();
+ QVERIFY(length == screenList.count());
+
+ for (int i = 0; i < length; ++i) {
+ QQuickScreenInfo *info = qobject_cast<QQuickScreenInfo *>(screensArray.property(i).toQObject());
+ QVERIFY(info != nullptr);
+ QCOMPARE(screenList[i]->name(), info->name());
+ QCOMPARE(screenList[i]->size().width(), info->width());
+ QCOMPARE(screenList[i]->size().height(), info->height());
+ QCOMPARE(screenList[i]->availableVirtualGeometry().width(), info->desktopAvailableWidth());
+ QCOMPARE(screenList[i]->availableVirtualGeometry().height(), info->desktopAvailableHeight());
+ QCOMPARE(screenList[i]->devicePixelRatio(), info->devicePixelRatio());
+ QCOMPARE(screenList[i]->geometry().x(), info->virtualX());
+ QCOMPARE(screenList[i]->geometry().y(), info->virtualY());
+ }
}
QTEST_MAIN(tst_qquickscreen)
diff --git a/tests/auto/quick/qquickwindow/data/windowWithScreen.qml b/tests/auto/quick/qquickwindow/data/windowWithScreen.qml
new file mode 100644
index 0000000000..fdc0be3388
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/windowWithScreen.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.0
+import QtQuick.Window 2.3 as Window
+
+Window.Window {
+ color: "#00FF00"
+ targetScreen: Qt.application.screens[0]
+ Item {
+ objectName: "item"
+ }
+}
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index acccac8eca..bfffa6f7f5 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -311,6 +311,7 @@ private slots:
void clearWindow();
void qmlCreation();
+ void qmlCreationWithScreen();
void clearColor();
void defaultState();
@@ -1122,6 +1123,24 @@ void tst_qquickwindow::qmlCreation()
QCOMPARE(item->window(), window);
}
+void tst_qquickwindow::qmlCreationWithScreen()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("windowWithScreen.qml"));
+ QObject *created = component.create();
+ QScopedPointer<QObject> cleanup(created);
+ QVERIFY(created);
+
+ QQuickWindow *window = qobject_cast<QQuickWindow*>(created);
+ QVERIFY(window);
+ QCOMPARE(window->color(), QColor(Qt::green));
+
+ QQuickItem *item = window->findChild<QQuickItem*>("item");
+ QVERIFY(item);
+ QCOMPARE(item->window(), window);
+}
+
void tst_qquickwindow::clearColor()
{
//::grab examines rendering to make sure it works visually
diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro
index c7ba4de86c..6e9998c061 100644
--- a/tests/auto/quick/quick.pro
+++ b/tests/auto/quick/quick.pro
@@ -6,6 +6,7 @@ PUBLICTESTS += \
qtConfig(opengl(es1|es2)?) {
PUBLICTESTS += \
+ drawingmodes \
rendernode
qtHaveModule(widgets): PUBLICTESTS += nodes
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index be62500858..fdfc66f3a6 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -463,7 +463,7 @@ int main(int argc, char *argv[])
QString dummyDir;
//Handle main arguments
- QStringList argList = app->arguments();
+ const QStringList argList = app->arguments();
for (int i = 1; i < argList.count(); i++) {
const QString &arg = argList[i];
if (arg == QLatin1String("-quiet"))
diff --git a/tools/qmleasing/mainwindow.cpp b/tools/qmleasing/mainwindow.cpp
index 5a5f651396..d36ab5fd75 100644
--- a/tools/qmleasing/mainwindow.cpp
+++ b/tools/qmleasing/mainwindow.cpp
@@ -73,7 +73,8 @@ MainWindow::MainWindow(QWidget *parent) :
quickView.rootContext()->setContextProperty(QLatin1String("spinBox"), ui_properties.spinBox);
- foreach (const QString &name, splineEditor->presetNames())
+ const auto presetNames = splineEditor->presetNames();
+ for (const QString &name : presetNames)
ui_properties.comboBox->addItem(name);
connect(ui_properties.comboBox, SIGNAL(currentIndexChanged(QString)), splineEditor, SLOT(setPreset(QString)));
diff --git a/tools/qmleasing/splineeditor.cpp b/tools/qmleasing/splineeditor.cpp
index 6fee013c62..d54a101b69 100644
--- a/tools/qmleasing/splineeditor.cpp
+++ b/tools/qmleasing/splineeditor.cpp
@@ -620,7 +620,7 @@ void SplineEditor::mouseMoveEvent(QMouseEvent *e)
if (indexIsRealPoint(m_activeControlPoint)) {
//move also the tangents
QPointF targetPoint = p;
- QPointF distance = targetPoint - m_controlPoints[m_activeControlPoint];
+ QPointF distance = targetPoint - m_controlPoints.at(m_activeControlPoint);
m_controlPoints[m_activeControlPoint] = targetPoint;
m_controlPoints[m_activeControlPoint - 1] += distance;
m_controlPoints[m_activeControlPoint + 1] += distance;
@@ -629,7 +629,7 @@ void SplineEditor::mouseMoveEvent(QMouseEvent *e)
m_controlPoints[m_activeControlPoint] = p;
} else {
QPointF targetPoint = p;
- QPointF distance = targetPoint - m_controlPoints[m_activeControlPoint];
+ QPointF distance = targetPoint - m_controlPoints.at(m_activeControlPoint);
m_controlPoints[m_activeControlPoint] = p;
if ((m_activeControlPoint > 1) && (m_activeControlPoint % 3) == 0) { //right control point
diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp
index f7f5a5e4e4..8f476649e9 100644
--- a/tools/qmlimportscanner/main.cpp
+++ b/tools/qmlimportscanner/main.cpp
@@ -145,7 +145,7 @@ QVariantMap pluginsForModulePath(const QString &modulePath) {
classnames += QString::fromUtf8(line.split(' ').at(1));
classnames += QLatin1Char(' ');
} else if (line.startsWith("depends")) {
- QList<QByteArray> dep = line.split(' ');
+ const QList<QByteArray> dep = line.split(' ');
if (dep.length() != 3)
std::cerr << "depends: expected 2 arguments: module identifier and version" << std::endl;
else
@@ -217,8 +217,8 @@ QVariantList findPathsForModuleImports(const QVariantList &imports)
QVariantList importsCopy(imports);
for (int i = 0; i < importsCopy.length(); ++i) {
- QVariantMap import = qvariant_cast<QVariantMap>(importsCopy[i]);
- if (import[typeLiteral()] == QLatin1String("module")) {
+ QVariantMap import = qvariant_cast<QVariantMap>(importsCopy.at(i));
+ if (import.value(typeLiteral()) == QLatin1String("module")) {
QString path = resolveImportPath(import.value(nameLiteral()).toString(), import.value(versionLiteral()).toString());
if (!path.isEmpty())
import[pathLiteral()] = path;
@@ -256,7 +256,8 @@ static QVariantList findQmlImportsInQmlCode(const QString &filePath, const QStri
if (!parser.parse() || !parser.diagnosticMessages().isEmpty()) {
// Extract errors from the parser
- foreach (const QQmlJS::DiagnosticMessage &m, parser.diagnosticMessages()) {
+ const auto diagnosticMessages = parser.diagnosticMessages();
+ for (const QQmlJS::DiagnosticMessage &m : diagnosticMessages) {
std::cerr << QDir::toNativeSeparators(filePath).toStdString() << ':'
<< m.loc.startLine << ':' << m.message.toStdString() << std::endl;
}
@@ -334,7 +335,8 @@ QVariantList findQmlImportsInJavascriptFile(const QString &filePath)
QQmlJS::Parser parser(&ee);
parser.parseProgram();
- foreach (const QQmlJS::DiagnosticMessage &m, parser.diagnosticMessages())
+ const auto diagnosticMessages = parser.diagnosticMessages();
+ for (const QQmlJS::DiagnosticMessage &m : diagnosticMessages)
if (m.isError())
return QVariantList();
diff --git a/tools/qmljs/qmljs.cpp b/tools/qmljs/qmljs.cpp
index b4ffc9be16..93276c1574 100644
--- a/tools/qmljs/qmljs.cpp
+++ b/tools/qmljs/qmljs.cpp
@@ -149,24 +149,24 @@ int main(int argc, char *argv[])
bool runAsQml = false;
if (!args.isEmpty()) {
- if (args.first() == QLatin1String("--jit")) {
+ if (args.constFirst() == QLatin1String("--jit")) {
mode = use_masm;
args.removeFirst();
}
#if QT_CONFIG(qml_interpreter)
- if (args.first() == QLatin1String("--interpret")) {
+ if (args.constFirst() == QLatin1String("--interpret")) {
mode = use_moth;
args.removeFirst();
}
#endif
- if (args.first() == QLatin1String("--qml")) {
+ if (args.constFirst() == QLatin1String("--qml")) {
runAsQml = true;
args.removeFirst();
}
- if (args.first() == QLatin1String("--help")) {
+ if (args.constFirst() == QLatin1String("--help")) {
std::cerr << "Usage: qmljs [|--jit|--interpret|--qml] file..." << std::endl;
return EXIT_SUCCESS;
}
diff --git a/tools/qmllint/main.cpp b/tools/qmllint/main.cpp
index 211427cc64..99a53110a8 100644
--- a/tools/qmllint/main.cpp
+++ b/tools/qmllint/main.cpp
@@ -59,7 +59,8 @@ static bool lint_file(const QString &filename, bool silent)
bool success = isJavaScript ? parser.parseProgram() : parser.parse();
if (!success && !silent) {
- foreach (const QQmlJS::DiagnosticMessage &m, parser.diagnosticMessages()) {
+ const auto diagnosticMessages = parser.diagnosticMessages();
+ for (const QQmlJS::DiagnosticMessage &m : diagnosticMessages) {
qWarning("%s:%d : %s", qPrintable(filename), m.loc.startLine, qPrintable(m.message));
}
}
@@ -82,15 +83,15 @@ int main(int argv, char *argc[])
parser.process(app);
- if (parser.positionalArguments().isEmpty()) {
+ const auto positionalArguments = parser.positionalArguments();
+ if (positionalArguments.isEmpty()) {
parser.showHelp(-1);
}
bool silent = parser.isSet(silentOption);
bool success = true;
- foreach (const QString &filename, parser.positionalArguments()) {
+ for (const QString &filename : positionalArguments)
success &= lint_file(filename, silent);
- }
return success ? 0 : -1;
}
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index ea54fee885..3294fa1e87 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -205,7 +205,8 @@ QByteArray convertToId(const QMetaObject *mo)
// Collect all metaobjects for types registered with qmlRegisterType() without parameters
void collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate *engine, QSet<const QMetaObject *>& metas ) {
- foreach (const QQmlType *ty, QQmlMetaType::qmlAllTypes()) {
+ const auto qmlAllTypes = QQmlMetaType::qmlAllTypes();
+ for (const QQmlType *ty : qmlAllTypes) {
if ( ! metas.contains(ty->metaObject()) ) {
if (!ty->isComposite()) {
collectReachableMetaObjects(engine, ty, &metas);
@@ -225,7 +226,8 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
metas.insert(FriendlyQObject::qtMeta());
QHash<QByteArray, QSet<QByteArray> > extensions;
- foreach (const QQmlType *ty, QQmlMetaType::qmlTypes()) {
+ const auto qmlTypes = QQmlMetaType::qmlTypes();
+ for (const QQmlType *ty : qmlTypes) {
if (!ty->isCreatable())
noncreatables.insert(ty->metaObject());
if (ty->isSingleton())
@@ -275,7 +277,7 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
if (creatable) {
// find even more QMetaObjects by instantiating QML types and running
// over the instances
- foreach (QQmlType *ty, QQmlMetaType::qmlTypes()) {
+ for (QQmlType *ty : qmlTypes) {
if (skip.contains(ty))
continue;
if (ty->isExtendedType())
@@ -766,7 +768,8 @@ static bool readDependenciesData(QString dependenciesFile, const QByteArray &fil
const QStringList requiredKeys = QStringList() << QStringLiteral("name")
<< QStringLiteral("type")
<< QStringLiteral("version");
- foreach (const QJsonValue &dep, doc.array()) {
+ const auto deps = doc.array();
+ for (const QJsonValue &dep : deps) {
if (dep.isObject()) {
QJsonObject obj = dep.toObject();
for (const QString &requiredKey : requiredKeys)
@@ -833,7 +836,8 @@ static bool getDependencies(const QQmlEngine &engine, const QString &pluginImpor
QStringList commandArgs = QStringList()
<< QLatin1String("-qmlFiles")
<< QLatin1String("-");
- foreach (const QString &path, engine.importPathList())
+ const auto importPathList = engine.importPathList();
+ for (const QString &path : importPathList)
commandArgs << QLatin1String("-importPath") << path;
QProcess importScanner;
@@ -877,20 +881,20 @@ bool compactDependencies(QStringList *dependencies)
if (dependencies->isEmpty())
return false;
dependencies->sort();
- QStringList oldDep = dependencies->first().split(QLatin1Char(' '));
+ QStringList oldDep = dependencies->constFirst().split(QLatin1Char(' '));
Q_ASSERT(oldDep.size() == 2);
int oldPos = 0;
for (int idep = 1; idep < dependencies->size(); ++idep) {
QString depStr = dependencies->at(idep);
const QStringList newDep = depStr.split(QLatin1Char(' '));
Q_ASSERT(newDep.size() == 2);
- if (newDep.first() != oldDep.first()) {
+ if (newDep.constFirst() != oldDep.constFirst()) {
if (++oldPos != idep)
dependencies->replace(oldPos, depStr);
oldDep = newDep;
} else {
- QStringList v1 = oldDep.last().split(QLatin1Char('.'));
- QStringList v2 = newDep.last().split(QLatin1Char('.'));
+ const QStringList v1 = oldDep.constLast().split(QLatin1Char('.'));
+ const QStringList v2 = newDep.constLast().split(QLatin1Char('.'));
Q_ASSERT(v1.size() == 2);
Q_ASSERT(v2.size() == 2);
bool ok;
@@ -899,9 +903,9 @@ bool compactDependencies(QStringList *dependencies)
int major2 = v2.first().toInt(&ok);
Q_ASSERT(ok);
if (major1 != major2) {
- std::cerr << "Found a dependency on " << qPrintable(oldDep.first())
- << " with two major versions:" << qPrintable(oldDep.last())
- << " and " << qPrintable(newDep.last())
+ std::cerr << "Found a dependency on " << qPrintable(oldDep.constFirst())
+ << " with two major versions:" << qPrintable(oldDep.constLast())
+ << " and " << qPrintable(newDep.constLast())
<< " which is unsupported, discarding smaller version" << std::endl;
if (major1 < major2)
dependencies->replace(oldPos, depStr);
@@ -1057,18 +1061,18 @@ int main(int argc, char *argv[])
std::cerr << "Incorrect number of positional arguments" << std::endl;
return EXIT_INVALIDARGUMENTS;
}
- pluginImportUri = positionalArgs[1];
+ pluginImportUri = positionalArgs.at(1);
pluginImportVersion = positionalArgs[2];
if (positionalArgs.size() >= 4)
- pluginImportPath = positionalArgs[3];
+ pluginImportPath = positionalArgs.at(3);
} else if (action == Path) {
if (positionalArgs.size() != 2 && positionalArgs.size() != 3) {
std::cerr << "Incorrect number of positional arguments" << std::endl;
return EXIT_INVALIDARGUMENTS;
}
- pluginImportPath = QDir::fromNativeSeparators(positionalArgs[1]);
+ pluginImportPath = QDir::fromNativeSeparators(positionalArgs.at(1));
if (positionalArgs.size() == 3)
- pluginImportVersion = positionalArgs[2];
+ pluginImportVersion = positionalArgs.at(2);
} else if (action == Builtins) {
if (positionalArgs.size() != 1) {
std::cerr << "Incorrect number of positional arguments" << std::endl;
@@ -1090,7 +1094,7 @@ int main(int argc, char *argv[])
QStringList mergeDependencies;
QString mergeComponents;
if (!mergeFile.isEmpty()) {
- QStringList merge = readQmlTypes(mergeFile);
+ const QStringList merge = readQmlTypes(mergeFile);
if (!merge.isEmpty()) {
QRegularExpression re("(\\w+\\.*\\w*\\s*\\d+\\.\\d+)");
QRegularExpressionMatchIterator i = re.globalMatch(merge[1]);
@@ -1132,8 +1136,9 @@ int main(int argc, char *argv[])
QQmlComponent c(&engine);
c.setData(code, QUrl::fromLocalFile(pluginImportPath + "/loaddependencies.qml"));
c.create();
- if (!c.errors().isEmpty()) {
- foreach (const QQmlError &error, c.errors())
+ const auto errors = c.errors();
+ if (!errors.isEmpty()) {
+ for (const QQmlError &error : errors)
std::cerr << qPrintable( error.toString() ) << std::endl;
return EXIT_IMPORTERROR;
}
@@ -1162,7 +1167,7 @@ int main(int argc, char *argv[])
}
} else if (pluginImportUri == QLatin1String("QtQml")) {
bool ok = false;
- const uint major = pluginImportVersion.split('.')[0].toUInt(&ok, 10);
+ const uint major = pluginImportVersion.splitRef('.').at(0).toUInt(&ok, 10);
if (!ok) {
std::cerr << "Malformed version string \""<< qPrintable(pluginImportVersion) << "\"."
<< std::endl;
@@ -1218,8 +1223,9 @@ int main(int argc, char *argv[])
c.setData(code, QUrl::fromLocalFile(pluginImportPath + "/typelist.qml"));
c.create();
- if (!c.errors().isEmpty()) {
- foreach (const QQmlError &error, c.errors())
+ const auto errors = c.errors();
+ if (!errors.isEmpty()) {
+ for (const QQmlError &error : errors)
std::cerr << qPrintable( error.toString() ) << std::endl;
return EXIT_IMPORTERROR;
}
diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp
index 048c92bb93..668cb3ce2d 100644
--- a/tools/qmlprofiler/qmlprofilerdata.cpp
+++ b/tools/qmlprofiler/qmlprofilerdata.cpp
@@ -403,23 +403,23 @@ void QmlProfilerData::computeQmlTime()
int level = minimumLevel;
for (int i = 0; i < d->startInstanceList.count(); i++) {
- qint64 st = d->startInstanceList[i].startTime;
+ qint64 st = d->startInstanceList.at(i).startTime;
- if (d->startInstanceList[i].data->rangeType == QQmlProfilerDefinitions::Painting) {
+ if (d->startInstanceList.at(i).data->rangeType == QQmlProfilerDefinitions::Painting) {
continue;
}
// general level
- if (endtimesPerLevel[level] > st) {
+ if (endtimesPerLevel.value(level) > st) {
level++;
} else {
while (level > minimumLevel && endtimesPerLevel[level-1] <= st)
level--;
}
- endtimesPerLevel[level] = st + d->startInstanceList[i].duration;
+ endtimesPerLevel[level] = st + d->startInstanceList.at(i).duration;
if (level == minimumLevel) {
- d->qmlMeasuredTime += d->startInstanceList[i].duration;
+ d->qmlMeasuredTime += d->startInstanceList.at(i).duration;
}
}
}