From 576875e9982270639d2ec450cfceb4e80f476dbe Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 14 Dec 2015 11:21:07 +1100 Subject: [PATCH] Followup 320c696 use clang-modernize to replace 0/NULL use with nullptr --- .../interpolation/CloughTocherInterpolator.cc | 2 +- .../interpolation/DualEdgeTriangulation.cc | 8 +- .../interpolation/DualEdgeTriangulation.h | 4 +- .../interpolation/LinTriangleInterpolator.h | 2 +- src/analysis/interpolation/Node.cc | 6 +- src/analysis/interpolation/Node.h | 2 +- .../interpolation/NormVecDecorator.cc | 2 +- src/analysis/interpolation/NormVecDecorator.h | 8 +- src/analysis/interpolation/ParametricLine.cc | 6 +- src/analysis/interpolation/ParametricLine.h | 2 +- src/analysis/interpolation/TriDecorator.cc | 6 +- src/analysis/interpolation/TriDecorator.h | 2 +- .../interpolation/qgsgridfilewriter.cpp | 6 +- .../interpolation/qgsinterpolator.cpp | 2 +- .../interpolation/qgstininterpolator.cpp | 14 +- src/analysis/network/qgsgraphanalyzer.cpp | 10 +- src/analysis/network/qgsgraphanalyzer.h | 2 +- src/analysis/network/qgsgraphbuilder.cpp | 4 +- .../network/qgslinevectorlayerdirector.cpp | 2 +- src/analysis/openstreetmap/qgsosmdatabase.cpp | 60 +-- src/analysis/openstreetmap/qgsosmdownload.cpp | 6 +- src/analysis/openstreetmap/qgsosmimport.cpp | 32 +- src/analysis/raster/qgsalignraster.cpp | 10 +- src/analysis/raster/qgsalignraster.h | 4 +- src/analysis/raster/qgsninecellfilter.cpp | 34 +- src/analysis/raster/qgsrastercalcnode.cpp | 24 +- src/analysis/raster/qgsrastercalculator.cpp | 14 +- src/analysis/raster/qgsrastercalculator.h | 2 +- src/analysis/raster/qgsrastermatrix.cpp | 6 +- src/analysis/raster/qgsrelief.cpp | 42 +-- src/analysis/vector/qgsgeometryanalyzer.cpp | 36 +- src/analysis/vector/qgsgeometryanalyzer.h | 14 +- src/analysis/vector/qgsoverlayanalyzer.cpp | 2 +- src/analysis/vector/qgsoverlayanalyzer.h | 2 +- src/analysis/vector/qgspointsample.cpp | 2 +- src/analysis/vector/qgstransectsample.cpp | 22 +- src/analysis/vector/qgszonalstatistics.cpp | 16 +- .../composer/qgsatlascompositionwidget.cpp | 4 +- .../composer/qgsattributeselectiondialog.cpp | 46 +-- .../composer/qgsattributeselectiondialog.h | 12 +- src/app/composer/qgscomposer.cpp | 64 ++-- src/app/composer/qgscomposerarrowwidget.cpp | 4 +- .../qgscomposerattributetablewidget.cpp | 2 +- src/app/composer/qgscomposerhtmlwidget.cpp | 12 +- .../qgscomposerimageexportoptionsdialog.h | 2 +- src/app/composer/qgscomposeritemwidget.cpp | 10 +- src/app/composer/qgscomposerlabelwidget.cpp | 2 +- .../composer/qgscomposerlegenditemdialog.cpp | 2 +- .../composer/qgscomposerlegenditemdialog.h | 2 +- .../qgscomposerlegendlayersdialog.cpp | 6 +- .../composer/qgscomposerlegendlayersdialog.h | 2 +- src/app/composer/qgscomposerlegendwidget.cpp | 12 +- src/app/composer/qgscomposermanager.cpp | 18 +- src/app/composer/qgscomposermanager.h | 4 +- src/app/composer/qgscomposermapwidget.cpp | 32 +- src/app/composer/qgscomposerpicturewidget.cpp | 4 +- .../composer/qgscomposerscalebarwidget.cpp | 2 +- src/app/composer/qgscomposershapewidget.cpp | 2 +- .../qgscomposertablebackgroundcolorsdialog.h | 2 +- src/app/composer/qgscomposertablewidget.cpp | 2 +- src/app/composer/qgscompositionwidget.cpp | 10 +- src/app/gps/qgsgpsinformationwidget.cpp | 36 +- src/app/gps/qgsgpsinformationwidget.h | 2 +- src/app/legend/qgsapplegendinterface.cpp | 4 +- src/app/legend/qgsapplegendinterface.h | 2 +- src/app/main.cpp | 10 +- src/app/nodetool/qgsmaptoolnodetool.cpp | 22 +- src/app/nodetool/qgsnodeeditor.h | 2 +- src/app/nodetool/qgsselectedfeature.cpp | 14 +- src/app/nodetool/qgsselectedfeature.h | 2 +- src/app/nodetool/qgsvertexentry.cpp | 4 +- src/app/ogr/qgsnewogrconnection.cpp | 2 +- src/app/ogr/qgsnewogrconnection.h | 2 +- src/app/ogr/qgsopenvectorlayerdialog.h | 2 +- src/app/ogr/qgsvectorlayersaveasdialog.cpp | 6 +- src/app/ogr/qgsvectorlayersaveasdialog.h | 4 +- src/app/openstreetmap/qgsosmdownloaddialog.h | 2 +- src/app/openstreetmap/qgsosmexportdialog.h | 2 +- src/app/openstreetmap/qgsosmimportdialog.h | 2 +- .../pluginmanager/qgspluginitemdelegate.cpp | 2 +- src/app/pluginmanager/qgspluginitemdelegate.h | 2 +- src/app/pluginmanager/qgspluginmanager.cpp | 4 +- src/app/pluginmanager/qgspluginmanager.h | 2 +- .../qgspluginsortfilterproxymodel.h | 2 +- src/app/qgisapp.cpp | 350 +++++++++--------- src/app/qgisapp.h | 106 +++--- src/app/qgisappinterface.cpp | 18 +- src/app/qgisappstylesheet.h | 2 +- src/app/qgsaddattrdialog.h | 4 +- src/app/qgsaddtaborgroup.h | 2 +- src/app/qgsalignrasterdialog.cpp | 2 +- src/app/qgsalignrasterdialog.h | 2 +- src/app/qgsannotationwidget.cpp | 6 +- src/app/qgsannotationwidget.h | 2 +- src/app/qgsapplayertreeviewmenuprovider.cpp | 4 +- src/app/qgsattributeactiondialog.h | 2 +- src/app/qgsattributetabledialog.cpp | 22 +- src/app/qgsattributetabledialog.h | 4 +- src/app/qgsbookmarks.h | 2 +- src/app/qgsbrowserdockwidget.cpp | 26 +- src/app/qgsbrowserdockwidget.h | 14 +- src/app/qgsclipboard.cpp | 2 +- src/app/qgsclipboard.h | 2 +- src/app/qgsconfigureshortcutsdialog.cpp | 10 +- src/app/qgsconfigureshortcutsdialog.h | 2 +- src/app/qgscustomization.cpp | 16 +- src/app/qgscustomization.h | 2 +- src/app/qgscustomprojectiondialog.cpp | 6 +- src/app/qgscustomprojectiondialog.h | 2 +- src/app/qgsdecorationcopyright.h | 2 +- src/app/qgsdecorationcopyrightdialog.h | 2 +- src/app/qgsdecorationgrid.cpp | 26 +- src/app/qgsdecorationgrid.h | 2 +- src/app/qgsdecorationgriddialog.cpp | 6 +- src/app/qgsdecorationgriddialog.h | 2 +- src/app/qgsdecorationitem.h | 2 +- src/app/qgsdecorationnortharrow.h | 2 +- src/app/qgsdecorationnortharrowdialog.h | 2 +- src/app/qgsdecorationscalebar.h | 2 +- src/app/qgsdecorationscalebardialog.h | 2 +- src/app/qgsdiagramproperties.cpp | 8 +- src/app/qgsdisplayangle.h | 2 +- src/app/qgsdxfexportdialog.cpp | 14 +- src/app/qgsdxfexportdialog.h | 6 +- src/app/qgsfeatureaction.cpp | 4 +- src/app/qgsfeatureaction.h | 4 +- src/app/qgsfieldcalculator.cpp | 8 +- src/app/qgsfieldsproperties.cpp | 24 +- src/app/qgsfieldsproperties.h | 6 +- src/app/qgsformannotationdialog.cpp | 6 +- src/app/qgsformannotationdialog.h | 2 +- src/app/qgsguivectorlayertools.cpp | 4 +- src/app/qgsguivectorlayertools.h | 2 +- src/app/qgshtmlannotationdialog.cpp | 6 +- src/app/qgshtmlannotationdialog.h | 2 +- src/app/qgsidentifyresultsdialog.cpp | 34 +- src/app/qgsidentifyresultsdialog.h | 8 +- src/app/qgsjoindialog.h | 2 +- src/app/qgslabeldialog.h | 2 +- src/app/qgslabelengineconfigdialog.h | 2 +- src/app/qgslabelinggui.cpp | 16 +- src/app/qgslabelingwidget.cpp | 6 +- src/app/qgslabelingwidget.h | 2 +- src/app/qgslabelpreview.h | 2 +- src/app/qgslabelpropertydialog.cpp | 4 +- src/app/qgslabelpropertydialog.h | 2 +- src/app/qgsloadstylefromdbdialog.h | 2 +- src/app/qgsmaplayerstyleguiutils.cpp | 4 +- src/app/qgsmaplayerstyleguiutils.h | 8 +- src/app/qgsmaptooladdcircularstring.cpp | 14 +- src/app/qgsmaptooladdfeature.cpp | 6 +- src/app/qgsmaptooladdpart.cpp | 2 +- src/app/qgsmaptooladdring.cpp | 2 +- src/app/qgsmaptoolannotation.cpp | 14 +- src/app/qgsmaptoolchangelabelproperties.cpp | 2 +- src/app/qgsmaptoolcircularstringradius.cpp | 6 +- src/app/qgsmaptooldeletepart.cpp | 8 +- src/app/qgsmaptooldeletering.cpp | 10 +- src/app/qgsmaptoolfillring.cpp | 2 +- src/app/qgsmaptoolformannotation.cpp | 2 +- src/app/qgsmaptoolhtmlannotation.cpp | 2 +- src/app/qgsmaptoollabel.cpp | 14 +- src/app/qgsmaptoolmeasureangle.cpp | 10 +- src/app/qgsmaptoolmovefeature.cpp | 8 +- src/app/qgsmaptooloffsetcurve.cpp | 34 +- src/app/qgsmaptoolpinlabels.cpp | 4 +- src/app/qgsmaptoolrotatefeature.cpp | 12 +- src/app/qgsmaptoolrotatefeature.h | 2 +- src/app/qgsmaptoolrotatelabel.cpp | 10 +- src/app/qgsmaptoolrotatepointsymbols.cpp | 8 +- src/app/qgsmaptoolselect.cpp | 2 +- src/app/qgsmaptoolselectfreehand.cpp | 10 +- src/app/qgsmaptoolselectpolygon.cpp | 8 +- src/app/qgsmaptoolselectradius.cpp | 8 +- src/app/qgsmaptoolselectrectangle.cpp | 8 +- src/app/qgsmaptoolselectutils.cpp | 6 +- src/app/qgsmaptoolshowhidelabels.cpp | 4 +- src/app/qgsmaptoolsimplify.cpp | 6 +- src/app/qgsmaptoolsimplify.h | 2 +- src/app/qgsmeasuredialog.h | 2 +- src/app/qgsmeasuretool.cpp | 2 +- src/app/qgsmergeattributesdialog.cpp | 14 +- src/app/qgsmergeattributesdialog.h | 2 +- src/app/qgsnewspatialitelayerdialog.cpp | 16 +- src/app/qgsnewspatialitelayerdialog.h | 2 +- src/app/qgsoptions.cpp | 22 +- src/app/qgsoptions.h | 2 +- src/app/qgspluginregistry.cpp | 8 +- src/app/qgspointrotationitem.cpp | 2 +- src/app/qgsprojectlayergroupdialog.cpp | 4 +- src/app/qgsprojectlayergroupdialog.h | 2 +- src/app/qgsprojectproperties.cpp | 14 +- src/app/qgsprojectproperties.h | 2 +- src/app/qgsrastercalcdialog.cpp | 8 +- src/app/qgsrastercalcdialog.h | 2 +- src/app/qgsrasterlayerproperties.cpp | 32 +- src/app/qgsrasterlayerproperties.h | 2 +- src/app/qgsrelationadddlg.h | 2 +- src/app/qgsrelationmanagerdialog.h | 2 +- src/app/qgsrulebasedlabelingwidget.cpp | 16 +- src/app/qgsrulebasedlabelingwidget.h | 6 +- src/app/qgssavestyletodbdialog.h | 2 +- src/app/qgssettingstree.cpp | 6 +- src/app/qgssettingstree.h | 2 +- src/app/qgsshortcutsmanager.cpp | 10 +- src/app/qgsshortcutsmanager.h | 2 +- src/app/qgssnappingdialog.cpp | 12 +- src/app/qgssnappingdialog.h | 2 +- src/app/qgsstatisticalsummarydockwidget.cpp | 6 +- src/app/qgsstatisticalsummarydockwidget.h | 2 +- src/app/qgsstatusbarcoordinateswidget.cpp | 4 +- src/app/qgssvgannotationdialog.cpp | 8 +- src/app/qgssvgannotationdialog.h | 2 +- src/app/qgstextannotationdialog.cpp | 4 +- src/app/qgstextannotationdialog.h | 2 +- src/app/qgstipgui.cpp | 2 +- src/app/qgsundowidget.cpp | 20 +- src/app/qgsvariantdelegate.cpp | 4 +- src/app/qgsvariantdelegate.h | 2 +- src/app/qgsvectorlayerproperties.cpp | 26 +- src/app/qgsvectorlayerproperties.h | 2 +- src/app/qgsversioninfo.h | 2 +- src/app/qgswelcomepage.h | 2 +- src/app/qgswelcomepageitemsmodel.cpp | 4 +- src/app/qgswelcomepageitemsmodel.h | 4 +- src/auth/basic/qgsauthbasicedit.h | 2 +- src/auth/identcert/qgsauthidentcertedit.h | 2 +- src/auth/identcert/qgsauthidentcertmethod.cpp | 4 +- src/auth/pkipaths/qgsauthpkipathsedit.h | 2 +- src/auth/pkipaths/qgsauthpkipathsmethod.cpp | 4 +- src/auth/pkipkcs12/qgsauthpkcs12edit.h | 2 +- src/auth/pkipkcs12/qgsauthpkcs12method.cpp | 4 +- src/browser/main.cpp | 4 +- src/browser/qgsbrowser.cpp | 20 +- src/browser/qgsbrowser.h | 2 +- src/core/auth/qgsauthcertutils.h | 2 +- src/core/auth/qgsauthcrypto.h | 4 +- src/core/auth/qgsauthmanager.cpp | 24 +- src/core/auth/qgsauthmanager.h | 6 +- src/core/auth/qgsauthmethod.h | 2 +- src/core/auth/qgsauthmethodregistry.cpp | 14 +- src/core/auth/qgsauthmethodregistry.h | 2 +- src/core/composer/qgsaddremoveitemcommand.h | 2 +- .../qgsaddremovemultiframecommand.cpp | 4 +- .../composer/qgsaddremovemultiframecommand.h | 2 +- src/core/composer/qgsatlascomposition.cpp | 14 +- src/core/composer/qgscomposerarrow.cpp | 6 +- .../composer/qgscomposerattributetable.cpp | 12 +- .../composer/qgscomposerattributetablemodel.h | 4 +- .../qgscomposerattributetablemodelv2.h | 4 +- .../composer/qgscomposerattributetablev2.cpp | 16 +- src/core/composer/qgscomposerframe.cpp | 4 +- src/core/composer/qgscomposerhtml.cpp | 14 +- src/core/composer/qgscomposerhtml.h | 4 +- src/core/composer/qgscomposeritem.cpp | 24 +- src/core/composer/qgscomposeritem.h | 4 +- src/core/composer/qgscomposeritemcommand.cpp | 4 +- src/core/composer/qgscomposeritemcommand.h | 2 +- src/core/composer/qgscomposeritemgroup.h | 2 +- src/core/composer/qgscomposerlabel.cpp | 10 +- src/core/composer/qgscomposerlegend.cpp | 18 +- src/core/composer/qgscomposerlegend.h | 2 +- src/core/composer/qgscomposerlegenditem.cpp | 12 +- src/core/composer/qgscomposermap.cpp | 26 +- src/core/composer/qgscomposermap.h | 8 +- src/core/composer/qgscomposermapgrid.cpp | 22 +- src/core/composer/qgscomposermapgrid.h | 14 +- src/core/composer/qgscomposermapitem.cpp | 6 +- src/core/composer/qgscomposermapoverview.cpp | 10 +- src/core/composer/qgscomposermodel.cpp | 6 +- src/core/composer/qgscomposermodel.h | 2 +- src/core/composer/qgscomposermousehandles.cpp | 32 +- src/core/composer/qgscomposermultiframe.cpp | 8 +- .../composer/qgscomposermultiframecommand.cpp | 2 +- .../composer/qgscomposermultiframecommand.h | 2 +- src/core/composer/qgscomposerobject.cpp | 8 +- src/core/composer/qgscomposerobject.h | 2 +- src/core/composer/qgscomposerpicture.cpp | 10 +- src/core/composer/qgscomposerpicture.h | 4 +- src/core/composer/qgscomposerscalebar.cpp | 10 +- src/core/composer/qgscomposershape.cpp | 6 +- src/core/composer/qgscomposertablev2.cpp | 4 +- src/core/composer/qgscomposerutils.cpp | 2 +- src/core/composer/qgscomposition.cpp | 80 ++-- src/core/composer/qgscomposition.h | 10 +- .../composer/qgsdoubleboxscalebarstyle.cpp | 2 +- src/core/composer/qgslegendmodel.cpp | 18 +- src/core/composer/qgslegendmodel.h | 4 +- src/core/composer/qgsnumericscalebarstyle.cpp | 2 +- src/core/composer/qgspaperitem.cpp | 10 +- src/core/composer/qgsscalebarstyle.cpp | 2 +- .../composer/qgssingleboxscalebarstyle.cpp | 2 +- src/core/composer/qgsticksscalebarstyle.cpp | 2 +- src/core/dxf/qgsdxfexport.cpp | 14 +- src/core/dxf/qgsdxfpaintdevice.cpp | 2 +- src/core/effects/qgseffectstack.cpp | 6 +- src/core/effects/qgsgloweffect.cpp | 8 +- src/core/effects/qgsimageoperation.cpp | 2 +- src/core/effects/qgsimageoperation.h | 2 +- src/core/effects/qgspainteffect.cpp | 30 +- src/core/effects/qgspainteffectregistry.cpp | 28 +- src/core/effects/qgspainteffectregistry.h | 8 +- src/core/geometry/qgscompoundcurvev2.cpp | 10 +- src/core/geometry/qgscurvepolygonv2.cpp | 16 +- src/core/geometry/qgscurvepolygonv2.h | 2 +- src/core/geometry/qgsgeometry.cpp | 130 +++---- src/core/geometry/qgsgeometry.h | 2 +- src/core/geometry/qgsgeometrycollectionv2.cpp | 4 +- src/core/geometry/qgsgeometryeditutils.cpp | 14 +- src/core/geometry/qgsgeometryengine.h | 58 +-- src/core/geometry/qgsgeometryfactory.cpp | 10 +- src/core/geometry/qgsgeos.cpp | 182 ++++----- src/core/geometry/qgsgeos.h | 68 ++-- src/core/geometry/qgspolygonv2.cpp | 2 +- .../qextserialport/posix_qextserialport.cpp | 4 +- src/core/gps/qgsgpsconnection.cpp | 4 +- src/core/gps/qgsgpsdetector.cpp | 8 +- src/core/layertree/qgslayertreegroup.cpp | 14 +- src/core/layertree/qgslayertreelayer.cpp | 12 +- src/core/layertree/qgslayertreemodel.cpp | 30 +- src/core/layertree/qgslayertreemodel.h | 2 +- .../layertree/qgslayertreemodellegendnode.cpp | 4 +- .../layertree/qgslayertreemodellegendnode.h | 12 +- src/core/layertree/qgslayertreenode.cpp | 10 +- .../layertree/qgslayertreeregistrybridge.h | 2 +- src/core/layertree/qgslayertreeutils.h | 2 +- src/core/pal/feature.cpp | 28 +- src/core/pal/feature.h | 4 +- src/core/pal/labelposition.cpp | 6 +- src/core/pal/layer.cpp | 14 +- src/core/pal/pal.cpp | 18 +- src/core/pal/palstat.cpp | 4 +- src/core/pal/pointset.cpp | 56 +-- src/core/pal/pointset.h | 2 +- src/core/pal/problem.cpp | 50 +-- src/core/pal/rtree.hpp | 14 +- src/core/pal/util.cpp | 4 +- src/core/pal/util.h | 4 +- src/core/qgis.cpp | 8 +- src/core/qgsapplication.cpp | 10 +- src/core/qgsapplication.h | 2 +- src/core/qgsattributeaction.cpp | 2 +- src/core/qgsattributeaction.h | 4 +- src/core/qgsbrowsermodel.cpp | 18 +- src/core/qgsbrowsermodel.h | 4 +- src/core/qgscolorschemeregistry.cpp | 4 +- src/core/qgsconditionalstyle.cpp | 4 +- src/core/qgsconnectionpool.h | 4 +- src/core/qgscontexthelp.cpp | 4 +- src/core/qgscoordinatereferencesystem.cpp | 72 ++-- src/core/qgscoordinatetransform.cpp | 30 +- src/core/qgscredentials.cpp | 2 +- src/core/qgsdatadefined.cpp | 2 +- src/core/qgsdatadefined_p.h | 4 +- src/core/qgsdataitem.cpp | 38 +- src/core/qgsdataitem.h | 4 +- src/core/qgsdatumtransformstore.cpp | 4 +- src/core/qgsdbfilterproxymodel.h | 2 +- src/core/qgsdiagramrendererv2.cpp | 14 +- src/core/qgsdistancearea.cpp | 8 +- src/core/qgsdistancearea.h | 2 +- src/core/qgseditformconfig.cpp | 2 +- src/core/qgseditformconfig.h | 4 +- src/core/qgsexpression.cpp | 8 +- src/core/qgsexpression.h | 16 +- src/core/qgsexpressioncontext.cpp | 12 +- src/core/qgsfeature_p.h | 2 +- src/core/qgsfeatureiterator.cpp | 8 +- src/core/qgsfeatureiterator.h | 2 +- src/core/qgsfeaturerequest.cpp | 16 +- src/core/qgsfontutils.cpp | 2 +- src/core/qgsfontutils.h | 2 +- src/core/qgsgeometryvalidator.cpp | 4 +- src/core/qgsgeometryvalidator.h | 2 +- src/core/qgsgml.cpp | 34 +- src/core/qgsgml.h | 4 +- src/core/qgsgmlschema.cpp | 6 +- src/core/qgshttptransaction.cpp | 10 +- src/core/qgshttptransaction.h | 2 +- src/core/qgslabel.cpp | 6 +- src/core/qgslabel.h | 2 +- src/core/qgslabelingenginev2.cpp | 16 +- src/core/qgslegendrenderer.cpp | 4 +- src/core/qgslegendrenderer.h | 12 +- src/core/qgslocalec.cpp | 2 +- src/core/qgslogger.h | 8 +- src/core/qgsmaplayer.cpp | 8 +- src/core/qgsmaplayer.h | 4 +- src/core/qgsmaplayerlegend.h | 2 +- src/core/qgsmaplayerregistry.cpp | 2 +- src/core/qgsmaplayerregistry.h | 2 +- src/core/qgsmaplayerstylemanager.cpp | 4 +- src/core/qgsmaprenderer.cpp | 20 +- src/core/qgsmaprenderer.h | 2 +- src/core/qgsmaprenderercustompainterjob.cpp | 20 +- src/core/qgsmaprendererjob.cpp | 20 +- src/core/qgsmaprendererparalleljob.cpp | 16 +- src/core/qgsmaprenderersequentialjob.cpp | 22 +- src/core/qgsmapsettings.cpp | 2 +- src/core/qgsmessagelog.cpp | 2 +- src/core/qgsnetworkaccessmanager.h | 4 +- src/core/qgsnetworkcontentfetcher.cpp | 8 +- src/core/qgsofflineediting.cpp | 62 ++-- src/core/qgsogcutils.cpp | 122 +++--- src/core/qgsogcutils.h | 2 +- src/core/qgspaintenginehack.cpp | 2 +- src/core/qgspalgeometry.h | 2 +- src/core/qgspallabeling.cpp | 88 ++--- src/core/qgspallabeling.h | 18 +- src/core/qgspluginlayerregistry.cpp | 14 +- src/core/qgspointlocator.cpp | 24 +- src/core/qgspointlocator.h | 14 +- src/core/qgsproject.cpp | 30 +- src/core/qgsproject.h | 10 +- src/core/qgsproviderregistry.cpp | 14 +- src/core/qgsproviderregistry.h | 2 +- src/core/qgspythonrunner.cpp | 4 +- src/core/qgsrectangle.h | 2 +- src/core/qgsrelation.cpp | 8 +- src/core/qgsrelationmanager.h | 4 +- src/core/qgsrenderchecker.cpp | 2 +- src/core/qgsrendercontext.cpp | 18 +- src/core/qgsrulebasedlabeling.cpp | 14 +- src/core/qgsrulebasedlabeling.h | 4 +- src/core/qgsrunprocess.cpp | 8 +- src/core/qgssimplifymethod.cpp | 2 +- src/core/qgssnappingutils.cpp | 10 +- src/core/qgssnappingutils.h | 8 +- src/core/qgsspatialindex.cpp | 14 +- src/core/qgssqlexpressioncompiler.h | 2 +- src/core/qgstolerance.cpp | 2 +- src/core/qgstransaction.cpp | 20 +- src/core/qgsvectordataprovider.h | 4 +- src/core/qgsvectorfilewriter.cpp | 50 +-- src/core/qgsvectorfilewriter.h | 18 +- src/core/qgsvectorlayer.cpp | 32 +- src/core/qgsvectorlayer.h | 8 +- src/core/qgsvectorlayercache.cpp | 12 +- src/core/qgsvectorlayercache.h | 2 +- src/core/qgsvectorlayerdiagramprovider.cpp | 22 +- src/core/qgsvectorlayerdiagramprovider.h | 4 +- src/core/qgsvectorlayereditbuffer.h | 2 +- src/core/qgsvectorlayereditutils.cpp | 4 +- src/core/qgsvectorlayereditutils.h | 4 +- src/core/qgsvectorlayerfeatureiterator.cpp | 8 +- src/core/qgsvectorlayerimport.cpp | 8 +- src/core/qgsvectorlayerimport.h | 10 +- src/core/qgsvectorlayerjoinbuffer.cpp | 4 +- src/core/qgsvectorlayerjoinbuffer.h | 2 +- src/core/qgsvectorlayerlabeling.cpp | 2 +- src/core/qgsvectorlayerlabelprovider.cpp | 10 +- src/core/qgsvectorlayerlabelprovider.h | 6 +- src/core/qgsvectorlayerrenderer.cpp | 20 +- src/core/qgsvectorlayerundocommand.cpp | 6 +- src/core/qgswebview.h | 2 +- .../raster/qgsbrightnesscontrastfilter.cpp | 2 +- src/core/raster/qgsbrightnesscontrastfilter.h | 2 +- src/core/raster/qgscontrastenhancement.cpp | 16 +- src/core/raster/qgshuesaturationfilter.cpp | 2 +- src/core/raster/qgshuesaturationfilter.h | 2 +- src/core/raster/qgsmultibandcolorrenderer.cpp | 22 +- src/core/raster/qgsmultibandcolorrenderer.h | 4 +- src/core/raster/qgspalettedrasterrenderer.cpp | 14 +- src/core/raster/qgsrasterblock.cpp | 56 +-- src/core/raster/qgsrasterdataprovider.cpp | 6 +- src/core/raster/qgsrasterdataprovider.h | 4 +- src/core/raster/qgsrasterdrawer.h | 2 +- src/core/raster/qgsrasterfilewriter.cpp | 28 +- src/core/raster/qgsrasterfilewriter.h | 6 +- src/core/raster/qgsrasterinterface.h | 2 +- src/core/raster/qgsrasteriterator.cpp | 6 +- src/core/raster/qgsrasterlayer.cpp | 16 +- src/core/raster/qgsrasterlayer.h | 2 +- src/core/raster/qgsrasterlayerrenderer.cpp | 4 +- src/core/raster/qgsrasternuller.cpp | 4 +- src/core/raster/qgsrasternuller.h | 2 +- src/core/raster/qgsrasterpipe.cpp | 2 +- src/core/raster/qgsrasterprojector.cpp | 30 +- src/core/raster/qgsrasterrenderer.cpp | 2 +- src/core/raster/qgsrasterrenderer.h | 2 +- src/core/raster/qgsrasterrendererregistry.cpp | 18 +- src/core/raster/qgsrasterresamplefilter.cpp | 6 +- src/core/raster/qgsrasterresamplefilter.h | 2 +- src/core/raster/qgsrastershader.cpp | 10 +- .../raster/qgssinglebandcolordatarenderer.cpp | 6 +- src/core/raster/qgssinglebandgrayrenderer.cpp | 10 +- .../qgssinglebandpseudocolorrenderer.cpp | 12 +- .../qgscategorizedsymbolrendererv2.cpp | 16 +- src/core/symbology-ng/qgscptcityarchive.cpp | 36 +- src/core/symbology-ng/qgscptcityarchive.h | 6 +- .../symbology-ng/qgsellipsesymbollayerv2.cpp | 4 +- .../symbology-ng/qgsellipsesymbollayerv2.h | 4 +- .../symbology-ng/qgsfillsymbollayerv2.cpp | 60 +-- src/core/symbology-ng/qgsfillsymbollayerv2.h | 2 +- .../qgsgeometrygeneratorsymbollayerv2.cpp | 8 +- .../qgsgraduatedsymbolrendererv2.cpp | 26 +- .../qgsgraduatedsymbolrendererv2.h | 2 +- src/core/symbology-ng/qgsheatmaprenderer.cpp | 8 +- .../qgsinvertedpolygonrenderer.cpp | 12 +- .../symbology-ng/qgsinvertedpolygonrenderer.h | 2 +- .../symbology-ng/qgslegendsymbolitemv2.cpp | 12 +- .../symbology-ng/qgslinesymbollayerv2.cpp | 20 +- .../symbology-ng/qgsmarkersymbollayerv2.cpp | 18 +- .../qgspointdisplacementrenderer.cpp | 14 +- src/core/symbology-ng/qgsrendererv2.cpp | 24 +- .../symbology-ng/qgsrendererv2registry.cpp | 2 +- src/core/symbology-ng/qgsrendererv2registry.h | 16 +- .../symbology-ng/qgsrulebasedrendererv2.cpp | 56 +-- .../symbology-ng/qgsrulebasedrendererv2.h | 8 +- .../qgssinglesymbolrendererv2.cpp | 18 +- src/core/symbology-ng/qgsstylev2.cpp | 68 ++-- src/core/symbology-ng/qgssvgcache.cpp | 38 +- src/core/symbology-ng/qgssvgcache.h | 2 +- src/core/symbology-ng/qgssymbollayerv2.cpp | 10 +- src/core/symbology-ng/qgssymbollayerv2.h | 6 +- .../symbology-ng/qgssymbollayerv2registry.cpp | 10 +- .../symbology-ng/qgssymbollayerv2registry.h | 16 +- .../symbology-ng/qgssymbollayerv2utils.cpp | 44 +-- src/core/symbology-ng/qgssymbollayerv2utils.h | 16 +- .../symbology-ng/qgssymbologyv2conversion.cpp | 10 +- src/core/symbology-ng/qgssymbolv2.cpp | 62 ++-- src/core/symbology-ng/qgssymbolv2.h | 10 +- .../qgsvectorfieldsymbollayer.cpp | 6 +- .../qgsattributetabledelegate.cpp | 10 +- .../qgsattributetabledelegate.h | 4 +- .../qgsattributetablefiltermodel.h | 2 +- .../attributetable/qgsattributetablemodel.h | 4 +- .../attributetable/qgsattributetableview.cpp | 24 +- .../attributetable/qgsattributetableview.h | 2 +- src/gui/attributetable/qgsdualview.cpp | 16 +- src/gui/attributetable/qgsdualview.h | 2 +- src/gui/attributetable/qgsfeaturelistmodel.h | 2 +- src/gui/attributetable/qgsfeaturelistview.cpp | 10 +- src/gui/attributetable/qgsfeaturelistview.h | 2 +- .../qgsfeaturelistviewdelegate.cpp | 4 +- .../qgsfeaturelistviewdelegate.h | 2 +- .../qgsfieldconditionalformatwidget.cpp | 12 +- .../qgsfieldconditionalformatwidget.h | 2 +- .../qgsgenericfeatureselectionmanager.h | 4 +- .../qgsvectorlayerselectionmanager.h | 2 +- src/gui/auth/qgsauthauthoritieseditor.cpp | 16 +- src/gui/auth/qgsauthauthoritieseditor.h | 6 +- src/gui/auth/qgsauthcertificateinfo.cpp | 28 +- src/gui/auth/qgsauthcertificateinfo.h | 6 +- src/gui/auth/qgsauthcertificatemanager.h | 4 +- src/gui/auth/qgsauthcerttrustpolicycombobox.h | 2 +- src/gui/auth/qgsauthconfigedit.cpp | 4 +- src/gui/auth/qgsauthconfigedit.h | 2 +- src/gui/auth/qgsauthconfigeditor.cpp | 20 +- src/gui/auth/qgsauthconfigeditor.h | 2 +- src/gui/auth/qgsauthconfigidedit.h | 2 +- src/gui/auth/qgsauthconfigselect.cpp | 8 +- src/gui/auth/qgsauthconfigselect.h | 4 +- src/gui/auth/qgsautheditorwidgets.cpp | 18 +- src/gui/auth/qgsautheditorwidgets.h | 4 +- src/gui/auth/qgsauthguiutils.h | 6 +- src/gui/auth/qgsauthidentitieseditor.cpp | 6 +- src/gui/auth/qgsauthidentitieseditor.h | 6 +- src/gui/auth/qgsauthimportcertdialog.cpp | 4 +- src/gui/auth/qgsauthimportcertdialog.h | 2 +- src/gui/auth/qgsauthimportidentitydialog.cpp | 4 +- src/gui/auth/qgsauthimportidentitydialog.h | 2 +- src/gui/auth/qgsauthmasterpassresetdialog.cpp | 4 +- src/gui/auth/qgsauthmasterpassresetdialog.h | 2 +- src/gui/auth/qgsauthmethodedit.h | 2 +- src/gui/auth/qgsauthserverseditor.cpp | 6 +- src/gui/auth/qgsauthserverseditor.h | 6 +- src/gui/auth/qgsauthsslconfigwidget.cpp | 26 +- src/gui/auth/qgsauthsslconfigwidget.h | 4 +- src/gui/auth/qgsauthsslerrorsdialog.h | 2 +- src/gui/auth/qgsauthsslimportdialog.cpp | 10 +- src/gui/auth/qgsauthsslimportdialog.h | 2 +- src/gui/auth/qgsauthtrustedcasdialog.cpp | 6 +- src/gui/auth/qgsauthtrustedcasdialog.h | 6 +- .../core/qgseditorwidgetregistry.cpp | 6 +- .../core/qgseditorwidgetregistry.h | 2 +- .../core/qgseditorwidgetwrapper.h | 2 +- .../core/qgssearchwidgetwrapper.cpp | 2 +- .../core/qgssearchwidgetwrapper.h | 2 +- src/gui/editorwidgets/core/qgswidgetwrapper.h | 2 +- src/gui/editorwidgets/qgscheckboxconfigdlg.h | 2 +- .../qgscheckboxwidgetwrapper.cpp | 4 +- .../editorwidgets/qgscheckboxwidgetwrapper.h | 2 +- .../qgsclassificationwidgetwrapper.cpp | 2 +- .../qgsclassificationwidgetwrapper.h | 2 +- .../editorwidgets/qgscolorwidgetwrapper.cpp | 2 +- src/gui/editorwidgets/qgscolorwidgetwrapper.h | 2 +- src/gui/editorwidgets/qgsdatetimeedit.h | 2 +- src/gui/editorwidgets/qgsdatetimeeditconfig.h | 2 +- .../editorwidgets/qgsdatetimeeditwrapper.cpp | 4 +- .../editorwidgets/qgsdatetimeeditwrapper.h | 2 +- .../qgsdefaultsearchwidgetwrapper.cpp | 6 +- .../qgsdefaultsearchwidgetwrapper.h | 2 +- src/gui/editorwidgets/qgsdoublespinbox.h | 2 +- .../qgsenumerationwidgetwrapper.cpp | 2 +- .../qgsenumerationwidgetwrapper.h | 2 +- .../qgsfilenamewidgetwrapper.cpp | 6 +- .../editorwidgets/qgsfilenamewidgetwrapper.h | 2 +- .../editorwidgets/qgshiddenwidgetwrapper.h | 2 +- src/gui/editorwidgets/qgsphotoconfigdlg.h | 2 +- .../editorwidgets/qgsphotowidgetfactory.cpp | 4 +- .../editorwidgets/qgsphotowidgetwrapper.cpp | 12 +- src/gui/editorwidgets/qgsphotowidgetwrapper.h | 2 +- .../editorwidgets/qgsrangewidgetwrapper.cpp | 14 +- src/gui/editorwidgets/qgsrangewidgetwrapper.h | 2 +- .../qgsrelationreferenceconfigdlg.cpp | 2 +- .../qgsrelationreferencewidget.cpp | 32 +- .../qgsrelationreferencewidgetwrapper.cpp | 2 +- .../qgsrelationreferencewidgetwrapper.h | 2 +- .../qgsrelationwidgetwrapper.cpp | 2 +- .../editorwidgets/qgsrelationwidgetwrapper.h | 2 +- src/gui/editorwidgets/qgsspinbox.h | 2 +- src/gui/editorwidgets/qgstexteditconfigdlg.h | 2 +- src/gui/editorwidgets/qgstexteditwrapper.cpp | 6 +- src/gui/editorwidgets/qgstexteditwrapper.h | 2 +- .../editorwidgets/qgsuniquevaluesconfigdlg.h | 2 +- .../qgsuniquevaluewidgetwrapper.cpp | 4 +- .../qgsuniquevaluewidgetwrapper.h | 2 +- .../editorwidgets/qgsuuidwidgetwrapper.cpp | 4 +- src/gui/editorwidgets/qgsuuidwidgetwrapper.h | 2 +- .../editorwidgets/qgsvaluemapconfigdlg.cpp | 4 +- .../qgsvaluemapsearchwidgetwrapper.cpp | 2 +- .../qgsvaluemapsearchwidgetwrapper.h | 2 +- .../qgsvaluemapwidgetwrapper.cpp | 2 +- .../editorwidgets/qgsvaluemapwidgetwrapper.h | 2 +- .../editorwidgets/qgsvaluerelationconfigdlg.h | 2 +- .../qgsvaluerelationsearchwidgetwrapper.cpp | 8 +- .../qgsvaluerelationsearchwidgetwrapper.h | 2 +- .../qgsvaluerelationwidgetwrapper.cpp | 10 +- .../qgsvaluerelationwidgetwrapper.h | 2 +- .../editorwidgets/qgswebviewwidgetfactory.cpp | 4 +- .../editorwidgets/qgswebviewwidgetwrapper.cpp | 6 +- .../editorwidgets/qgswebviewwidgetwrapper.h | 2 +- src/gui/effects/qgseffectdrawmodecombobox.h | 2 +- .../qgseffectstackpropertieswidget.cpp | 16 +- .../effects/qgseffectstackpropertieswidget.h | 6 +- .../qgspainteffectpropertieswidget.cpp | 8 +- .../effects/qgspainteffectpropertieswidget.h | 2 +- src/gui/effects/qgspainteffectwidget.cpp | 14 +- src/gui/effects/qgspainteffectwidget.h | 14 +- src/gui/layertree/qgscustomlayerorderwidget.h | 4 +- .../layertree/qgslayertreemapcanvasbridge.cpp | 4 +- .../layertree/qgslayertreemapcanvasbridge.h | 2 +- src/gui/layertree/qgslayertreeview.cpp | 8 +- src/gui/layertree/qgslayertreeview.h | 2 +- .../qgslayertreeviewdefaultactions.cpp | 6 +- .../qgslayertreeviewdefaultactions.h | 20 +- src/gui/qgisgui.cpp | 6 +- src/gui/qgisgui.h | 2 +- src/gui/qgsactionmenu.cpp | 6 +- src/gui/qgsactionmenu.h | 6 +- src/gui/qgsadvanceddigitizingdockwidget.cpp | 6 +- src/gui/qgsadvanceddigitizingdockwidget.h | 10 +- src/gui/qgsannotationitem.cpp | 2 +- src/gui/qgsattributedialog.cpp | 8 +- src/gui/qgsattributedialog.h | 4 +- src/gui/qgsattributeeditor.cpp | 2 +- src/gui/qgsattributeeditor.h | 2 +- src/gui/qgsattributeeditorcontext.h | 10 +- src/gui/qgsattributeform.cpp | 16 +- src/gui/qgsattributeform.h | 2 +- src/gui/qgsattributetypeloaddialog.cpp | 6 +- src/gui/qgsblendmodecombobox.h | 2 +- src/gui/qgsbrowsertreeview.h | 2 +- src/gui/qgsbusyindicatordialog.cpp | 2 +- src/gui/qgsbusyindicatordialog.h | 2 +- src/gui/qgscharacterselectdialog.h | 2 +- src/gui/qgscodeeditor.h | 2 +- src/gui/qgscodeeditorcss.h | 2 +- src/gui/qgscodeeditorhtml.h | 2 +- src/gui/qgscodeeditorpython.h | 2 +- src/gui/qgscodeeditorsql.h | 2 +- src/gui/qgscollapsiblegroupbox.cpp | 10 +- src/gui/qgscollapsiblegroupbox.h | 10 +- src/gui/qgscolorbutton.cpp | 10 +- src/gui/qgscolorbutton.h | 2 +- src/gui/qgscolorbuttonv2.cpp | 6 +- src/gui/qgscolorbuttonv2.h | 2 +- src/gui/qgscolordialog.cpp | 20 +- src/gui/qgscolordialog.h | 8 +- src/gui/qgscolorschemelist.h | 6 +- src/gui/qgscolorswatchgrid.h | 4 +- src/gui/qgscolorwidgets.cpp | 28 +- src/gui/qgscolorwidgets.h | 16 +- src/gui/qgscomposerruler.cpp | 8 +- src/gui/qgscomposerview.cpp | 34 +- src/gui/qgscomposerview.h | 2 +- src/gui/qgscredentialdialog.cpp | 2 +- src/gui/qgscredentialdialog.h | 2 +- src/gui/qgsdatadefinedbutton.cpp | 6 +- src/gui/qgsdatadefinedbutton.h | 10 +- src/gui/qgsdatumtransformdialog.h | 2 +- src/gui/qgsdetaileditemdelegate.h | 2 +- src/gui/qgsdetaileditemwidget.h | 2 +- src/gui/qgsdial.cpp | 2 +- src/gui/qgsdial.h | 2 +- src/gui/qgsdialog.cpp | 2 +- src/gui/qgsdialog.h | 2 +- src/gui/qgsencodingfiledialog.cpp | 4 +- src/gui/qgsencodingfiledialog.h | 2 +- src/gui/qgserrordialog.h | 4 +- src/gui/qgsexpressionbuilderdialog.h | 2 +- src/gui/qgsexpressionbuilderwidget.cpp | 6 +- src/gui/qgsexpressionhighlighter.h | 2 +- src/gui/qgsexpressionselectiondialog.h | 2 +- src/gui/qgsextentgroupbox.h | 2 +- src/gui/qgsfeatureselectiondlg.cpp | 2 +- src/gui/qgsfeatureselectiondlg.h | 2 +- src/gui/qgsfieldcombobox.h | 2 +- src/gui/qgsfieldexpressionwidget.cpp | 6 +- src/gui/qgsfieldexpressionwidget.h | 6 +- src/gui/qgsfieldmodel.cpp | 4 +- src/gui/qgsfieldmodel.h | 2 +- src/gui/qgsfieldproxymodel.h | 2 +- src/gui/qgsfieldvalidator.cpp | 2 +- src/gui/qgsfiledropedit.h | 2 +- src/gui/qgsfilterlineedit.h | 2 +- src/gui/qgsformannotationitem.cpp | 14 +- src/gui/qgsformannotationitem.h | 4 +- src/gui/qgsgenericprojectionselector.h | 2 +- src/gui/qgsgeometryrubberband.cpp | 2 +- src/gui/qgshighlight.cpp | 8 +- src/gui/qgshistogramwidget.cpp | 2 +- src/gui/qgshistogramwidget.h | 2 +- src/gui/qgshtmlannotationitem.cpp | 6 +- src/gui/qgshtmlannotationitem.h | 4 +- src/gui/qgsidentifymenu.cpp | 14 +- src/gui/qgsidentifymenu.h | 14 +- src/gui/qgslegendfilterbutton.cpp | 4 +- src/gui/qgslegendfilterbutton.h | 2 +- src/gui/qgslegendinterface.h | 2 +- src/gui/qgsludialog.h | 2 +- src/gui/qgsmanageconnectionsdialog.h | 2 +- src/gui/qgsmapcanvas.cpp | 62 ++-- src/gui/qgsmapcanvas.h | 10 +- src/gui/qgsmapcanvasitem.h | 2 +- src/gui/qgsmapcanvassnapper.cpp | 6 +- src/gui/qgsmapcanvassnappingutils.cpp | 4 +- src/gui/qgsmapcanvassnappingutils.h | 2 +- src/gui/qgsmaplayeractionregistry.cpp | 12 +- src/gui/qgsmaplayeractionregistry.h | 2 +- src/gui/qgsmaplayercombobox.cpp | 8 +- src/gui/qgsmaplayercombobox.h | 2 +- src/gui/qgsmaplayermodel.cpp | 2 +- src/gui/qgsmaplayermodel.h | 4 +- src/gui/qgsmaplayerproxymodel.h | 2 +- src/gui/qgsmapmouseevent.h | 2 +- src/gui/qgsmapoverviewcanvas.cpp | 4 +- src/gui/qgsmapoverviewcanvas.h | 2 +- src/gui/qgsmaptool.cpp | 6 +- src/gui/qgsmaptoolcapture.cpp | 22 +- src/gui/qgsmaptoolidentify.h | 2 +- src/gui/qgsmaptoolidentifyfeature.h | 2 +- src/gui/qgsmaptoolzoom.cpp | 8 +- src/gui/qgsmessagebar.cpp | 8 +- src/gui/qgsmessagebar.h | 8 +- src/gui/qgsmessagebaritem.cpp | 30 +- src/gui/qgsmessagebaritem.h | 8 +- src/gui/qgsmessagelogviewer.h | 2 +- src/gui/qgsmessageviewer.h | 2 +- src/gui/qgsnewhttpconnection.cpp | 2 +- src/gui/qgsnewhttpconnection.h | 2 +- src/gui/qgsnewmemorylayerdialog.cpp | 2 +- src/gui/qgsnewmemorylayerdialog.h | 4 +- src/gui/qgsnewnamedialog.cpp | 4 +- src/gui/qgsnewnamedialog.h | 2 +- src/gui/qgsnewvectorlayerdialog.cpp | 2 +- src/gui/qgsnewvectorlayerdialog.h | 4 +- src/gui/qgsoptionsdialogbase.cpp | 12 +- src/gui/qgsoptionsdialogbase.h | 2 +- src/gui/qgsowssourceselect.cpp | 4 +- src/gui/qgsowssourceselect.h | 2 +- src/gui/qgspixmaplabel.h | 2 +- src/gui/qgsprojectionselectionwidget.h | 2 +- src/gui/qgsprojectionselector.cpp | 28 +- src/gui/qgsprojectionselector.h | 6 +- src/gui/qgsquerybuilder.h | 2 +- src/gui/qgsrasterformatsaveoptionswidget.cpp | 4 +- src/gui/qgsrasterformatsaveoptionswidget.h | 4 +- src/gui/qgsrasterlayersaveasdialog.cpp | 4 +- src/gui/qgsrasterlayersaveasdialog.h | 2 +- src/gui/qgsrasterpyramidsoptionswidget.h | 2 +- src/gui/qgsrelationeditorwidget.cpp | 6 +- src/gui/qgsrelationeditorwidget.h | 2 +- src/gui/qgsrubberband.cpp | 6 +- src/gui/qgsscalecombobox.cpp | 2 +- src/gui/qgsscalecombobox.h | 4 +- src/gui/qgsscalerangewidget.cpp | 2 +- src/gui/qgsscalerangewidget.h | 2 +- src/gui/qgsscalevisibilitydialog.h | 2 +- src/gui/qgsscalewidget.cpp | 2 +- src/gui/qgsscalewidget.h | 4 +- src/gui/qgssearchquerybuilder.cpp | 12 +- src/gui/qgssearchquerybuilder.h | 2 +- src/gui/qgsslider.cpp | 2 +- src/gui/qgsslider.h | 4 +- src/gui/qgssublayersdialog.cpp | 2 +- src/gui/qgssublayersdialog.h | 2 +- src/gui/qgstextannotationitem.cpp | 2 +- src/gui/qgsunitselectionwidget.h | 4 +- src/gui/qgsuserinputdockwidget.cpp | 4 +- src/gui/qgsuserinputdockwidget.h | 2 +- src/gui/qgsvariableeditorwidget.cpp | 30 +- src/gui/qgsvariableeditorwidget.h | 6 +- src/gui/qgsvectorlayertools.h | 2 +- .../qgsmultibandcolorrendererwidget.cpp | 18 +- src/gui/raster/qgspalettedrendererwidget.cpp | 2 +- src/gui/raster/qgsrasterhistogramwidget.cpp | 36 +- src/gui/raster/qgsrasterhistogramwidget.h | 4 +- src/gui/raster/qgsrasterminmaxwidget.h | 2 +- .../qgssinglebandgrayrendererwidget.cpp | 6 +- ...qgssinglebandpseudocolorrendererwidget.cpp | 2 +- src/gui/symbology-ng/characterwidget.h | 2 +- src/gui/symbology-ng/qgsbrushstylecombobox.h | 2 +- .../qgscategorizedsymbolrendererv2widget.cpp | 16 +- .../qgscategorizedsymbolrendererv2widget.h | 6 +- src/gui/symbology-ng/qgscolorrampcombobox.cpp | 2 +- src/gui/symbology-ng/qgscolorrampcombobox.h | 2 +- .../qgscptcitycolorrampv2dialog.cpp | 10 +- .../qgscptcitycolorrampv2dialog.h | 2 +- src/gui/symbology-ng/qgsdashspacedialog.h | 2 +- .../symbology-ng/qgsdatadefinedsymboldialog.h | 2 +- .../qgsellipsesymbollayerv2widget.cpp | 2 +- .../qgsellipsesymbollayerv2widget.h | 2 +- .../qgsgraduatedhistogramwidget.cpp | 4 +- .../qgsgraduatedhistogramwidget.h | 2 +- .../qgsgraduatedsymbolrendererv2widget.cpp | 20 +- .../qgsgraduatedsymbolrendererv2widget.h | 6 +- .../symbology-ng/qgsheatmaprendererwidget.cpp | 8 +- .../qgsinvertedpolygonrendererwidget.cpp | 2 +- .../symbology-ng/qgslayerpropertieswidget.cpp | 12 +- .../symbology-ng/qgslayerpropertieswidget.h | 2 +- src/gui/symbology-ng/qgspenstylecombobox.h | 6 +- .../qgspointdisplacementrendererwidget.cpp | 8 +- .../qgsrendererv2propertiesdialog.cpp | 18 +- src/gui/symbology-ng/qgsrendererv2widget.cpp | 12 +- .../qgsrulebasedrendererv2widget.cpp | 20 +- .../qgsrulebasedrendererv2widget.h | 2 +- .../qgssinglesymbolrendererv2widget.cpp | 4 +- src/gui/symbology-ng/qgssizescalewidget.cpp | 14 +- .../symbology-ng/qgssmartgroupeditordialog.h | 4 +- .../qgsstylev2exportimportdialog.cpp | 16 +- .../qgsstylev2exportimportdialog.h | 2 +- .../qgsstylev2groupselectiondialog.h | 2 +- .../symbology-ng/qgsstylev2managerdialog.cpp | 10 +- .../symbology-ng/qgsstylev2managerdialog.h | 2 +- src/gui/symbology-ng/qgssvgselectorwidget.cpp | 2 +- src/gui/symbology-ng/qgssvgselectorwidget.h | 6 +- .../symbology-ng/qgssymbollayerv2widget.cpp | 40 +- src/gui/symbology-ng/qgssymbollayerv2widget.h | 30 +- .../symbology-ng/qgssymbollevelsv2dialog.h | 4 +- src/gui/symbology-ng/qgssymbolslistwidget.cpp | 10 +- src/gui/symbology-ng/qgssymbolslistwidget.h | 2 +- .../qgssymbolv2selectordialog.cpp | 44 +-- .../symbology-ng/qgssymbolv2selectordialog.h | 2 +- .../qgsvectorcolorbrewercolorrampv2dialog.h | 2 +- .../qgsvectorfieldsymbollayerwidget.cpp | 2 +- .../qgsvectorfieldsymbollayerwidget.h | 2 +- .../qgsvectorgradientcolorrampv2dialog.cpp | 6 +- .../qgsvectorgradientcolorrampv2dialog.h | 2 +- .../qgsvectorrandomcolorrampv2dialog.h | 2 +- src/helpviewer/main.cpp | 4 +- src/helpviewer/qgshelpviewer.h | 2 +- .../coordinate_capture/coordinatecapture.cpp | 18 +- .../coordinate_capture/coordinatecapturegui.h | 2 +- .../coordinatecapturemaptool.cpp | 2 +- src/plugins/dxf2shp_converter/builder.cpp | 16 +- .../dxf2shp_converter/dxf2shpconverter.cpp | 4 +- .../dxf2shp_converter/dxf2shpconvertergui.h | 2 +- .../dxf2shp_converter/dxflib/src/dl_dxf.cpp | 40 +- .../dxflib/src/dl_entities.h | 2 +- .../evisdatabaseconnection.cpp | 4 +- .../evisdatabaseconnectiongui.cpp | 14 +- .../evisdatabaseconnectiongui.h | 2 +- .../evisgenericeventbrowsergui.cpp | 38 +- .../eventbrowser/evisimagedisplaywidget.cpp | 2 +- .../eventbrowser/evisimagedisplaywidget.h | 2 +- src/plugins/evis/evis.cpp | 12 +- src/plugins/evis/idtool/eviseventidtool.cpp | 10 +- .../checks/qgsgeometryanglecheck.h | 2 +- .../checks/qgsgeometryareacheck.h | 2 +- .../checks/qgsgeometrycheck.cpp | 2 +- .../checks/qgsgeometrycheck.h | 2 +- .../checks/qgsgeometrycontainedcheck.h | 2 +- .../qgsgeometrydegeneratepolygoncheck.h | 2 +- .../checks/qgsgeometryduplicatecheck.h | 2 +- .../checks/qgsgeometryduplicatenodescheck.h | 2 +- .../checks/qgsgeometrygapcheck.cpp | 2 +- .../checks/qgsgeometrygapcheck.h | 2 +- .../checks/qgsgeometryholecheck.h | 2 +- .../checks/qgsgeometrymultipartcheck.h | 2 +- .../checks/qgsgeometryoverlapcheck.cpp | 6 +- .../checks/qgsgeometryoverlapcheck.h | 2 +- .../checks/qgsgeometrysegmentlengthcheck.h | 2 +- .../checks/qgsgeometryselfintersectioncheck.h | 2 +- .../checks/qgsgeometrytypecheck.cpp | 2 +- .../checks/qgsgeometrytypecheck.h | 2 +- .../geometry_checker/qgsgeometrychecker.cpp | 6 +- .../geometry_checker/qgsgeometrychecker.h | 2 +- .../qgsgeometrycheckerplugin.cpp | 8 +- .../qgsgeometrycheckfactory.cpp | 28 +- .../ui/qgsgeometrycheckerdialog.h | 2 +- .../ui/qgsgeometrycheckerfixsummarydialog.h | 2 +- .../ui/qgsgeometrycheckerresulttab.cpp | 4 +- .../ui/qgsgeometrycheckerresulttab.h | 4 +- .../ui/qgsgeometrycheckersetuptab.cpp | 8 +- .../ui/qgsgeometrycheckersetuptab.h | 2 +- .../ui/qgsgeometrycheckfixdialog.h | 2 +- .../geometry_checker/utils/qgsfeaturepool.cpp | 2 +- .../geometry_checker/utils/qgsfeaturepool.h | 2 +- .../geometry_checker/utils/qgsgeomutils.h | 2 +- .../geometry_snapper/qgsgeometrysnapper.cpp | 8 +- .../qgsgeometrysnapperdialog.cpp | 8 +- .../qgsgeometrysnapperplugin.cpp | 8 +- src/plugins/geometry_snapper/qgssnapindex.cpp | 12 +- src/plugins/geometry_snapper/qgssnapindex.h | 2 +- src/plugins/georeferencer/qgsgcplistmodel.cpp | 4 +- src/plugins/georeferencer/qgsgcplistmodel.h | 2 +- .../georeferencer/qgsgcplistwidget.cpp | 2 +- src/plugins/georeferencer/qgsgcplistwidget.h | 2 +- .../georeferencer/qgsgeorefconfigdialog.h | 2 +- .../georeferencer/qgsgeorefdatapoint.cpp | 8 +- .../georeferencer/qgsgeorefdelegates.h | 8 +- src/plugins/georeferencer/qgsgeorefplugin.cpp | 8 +- .../georeferencer/qgsgeorefplugingui.cpp | 28 +- .../georeferencer/qgsgeorefplugingui.h | 4 +- .../georeferencer/qgsgeoreftoolmovepoint.cpp | 2 +- .../georeferencer/qgsgeoreftransform.cpp | 28 +- src/plugins/georeferencer/qgsimagewarper.cpp | 6 +- .../georeferencer/qgsmapcoordsdialog.cpp | 4 +- .../georeferencer/qgsmapcoordsdialog.h | 2 +- .../georeferencer/qgsrasterchangecoords.cpp | 2 +- .../qgstransformsettingsdialog.h | 2 +- .../gps_importer/qgsgpsdevicedialog.cpp | 4 +- src/plugins/gps_importer/qgsgpsplugin.cpp | 30 +- src/plugins/heatmap/heatmap.cpp | 6 +- src/plugins/heatmap/heatmapgui.cpp | 8 +- .../interpolation/qgsinterpolationdialog.cpp | 10 +- .../interpolation/qgsinterpolationplugin.cpp | 4 +- .../qgstininterpolatordialog.cpp | 4 +- .../offline_editing_plugin.cpp | 8 +- .../offline_editing_plugin_gui.h | 4 +- .../offline_editing_progress_dialog.h | 2 +- .../oracle_raster/qgsoracle_plugin.cpp | 4 +- .../oracle_raster/qgsoracleconnect_ui.h | 2 +- .../oracle_raster/qgsselectgeoraster_ui.cpp | 6 +- .../oracle_raster/qgsselectgeoraster_ui.h | 2 +- .../qgsrasterterrainanalysisdialog.cpp | 24 +- .../qgsrasterterrainanalysisdialog.h | 2 +- .../qgsrasterterrainanalysisplugin.cpp | 4 +- src/plugins/roadgraph/exportdlg.cpp | 6 +- src/plugins/roadgraph/exportdlg.h | 2 +- .../roadgraph/linevectorlayersettings.cpp | 2 +- .../roadgraph/linevectorlayerwidget.cpp | 2 +- src/plugins/roadgraph/linevectorlayerwidget.h | 2 +- src/plugins/roadgraph/roadgraphplugin.cpp | 16 +- src/plugins/roadgraph/settingsdlg.h | 2 +- src/plugins/roadgraph/shortestpathwidget.cpp | 26 +- .../qgsgeometrycoordinatetransform.cpp | 4 +- src/plugins/spatialquery/qgsspatialquery.cpp | 8 +- .../spatialquery/qgsspatialquerydialog.cpp | 44 +-- .../spatialquery/qgsspatialquerydialog.h | 2 +- .../spatialquery/qgsspatialqueryplugin.cpp | 12 +- src/plugins/topology/checkDock.cpp | 16 +- src/plugins/topology/checkDock.h | 2 +- src/plugins/topology/dockModel.cpp | 2 +- src/plugins/topology/topol.cpp | 4 +- src/plugins/topology/topolError.h | 2 +- src/plugins/topology/topolTest.cpp | 4 +- src/plugins/topology/topolTest.h | 2 +- .../qgszonalstatisticsdialog.cpp | 8 +- .../qgszonalstatisticsplugin.cpp | 4 +- .../qgsdelimitedtextfeatureiterator.cpp | 20 +- .../delimitedtext/qgsdelimitedtextfile.cpp | 16 +- .../qgsdelimitedtextprovider.cpp | 30 +- .../delimitedtext/qgsdelimitedtextprovider.h | 2 +- src/providers/gdal/qgsgdaldataitems.cpp | 20 +- src/providers/gdal/qgsgdaldataitems.h | 2 +- src/providers/gdal/qgsgdalprovider.cpp | 80 ++-- src/providers/gdal/qgsgdalprovider.h | 2 +- src/providers/gdal/qgsgdalproviderbase.cpp | 2 +- src/providers/gpx/gpsdata.cpp | 12 +- src/providers/gpx/gpsdata.h | 2 +- src/providers/gpx/qgsgpxfeatureiterator.cpp | 6 +- src/providers/gpx/qgsgpxprovider.cpp | 16 +- .../memory/qgsmemoryfeatureiterator.cpp | 8 +- src/providers/memory/qgsmemoryprovider.cpp | 2 +- src/providers/mssql/qgsmssqldataitems.cpp | 20 +- .../mssql/qgsmssqlfeatureiterator.cpp | 6 +- .../mssql/qgsmssqlgeometryparser.cpp | 28 +- src/providers/mssql/qgsmssqlnewconnection.h | 2 +- src/providers/mssql/qgsmssqlprovider.h | 4 +- src/providers/mssql/qgsmssqlsourceselect.cpp | 6 +- src/providers/mssql/qgsmssqlsourceselect.h | 4 +- src/providers/ogr/qgsogrconnpool.cpp | 2 +- src/providers/ogr/qgsogrconnpool.h | 2 +- src/providers/ogr/qgsogrdataitems.cpp | 22 +- src/providers/ogr/qgsogrfeatureiterator.cpp | 20 +- src/providers/ogr/qgsogrprovider.cpp | 84 ++--- src/providers/ogr/qgsogrprovider.h | 4 +- src/providers/ows/qgsowsdataitems.cpp | 6 +- src/providers/ows/qgsowsprovider.h | 2 +- .../postgres/qgscolumntypethread.cpp | 6 +- src/providers/postgres/qgspgnewconnection.cpp | 2 +- src/providers/postgres/qgspgnewconnection.h | 2 +- src/providers/postgres/qgspgsourceselect.cpp | 8 +- src/providers/postgres/qgspgsourceselect.h | 4 +- src/providers/postgres/qgspgtablemodel.cpp | 2 +- src/providers/postgres/qgspostgresconn.cpp | 16 +- src/providers/postgres/qgspostgresconn.h | 2 +- .../postgres/qgspostgresdataitems.cpp | 62 ++-- .../postgres/qgspostgresfeatureiterator.cpp | 6 +- .../postgres/qgspostgresprovider.cpp | 20 +- src/providers/postgres/qgspostgresprovider.h | 8 +- .../postgres/qgspostgrestransaction.cpp | 6 +- .../spatialite/qgsspatialiteconnection.cpp | 62 ++-- .../spatialite/qgsspatialitedataitems.cpp | 20 +- .../qgsspatialitefeatureiterator.cpp | 22 +- .../spatialite/qgsspatialiteprovider.cpp | 222 +++++------ .../spatialite/qgsspatialiteprovider.h | 4 +- .../spatialite/qgsspatialitesourceselect.cpp | 4 +- src/providers/wcs/qgswcscapabilities.cpp | 8 +- src/providers/wcs/qgswcscapabilities.h | 8 +- src/providers/wcs/qgswcsdataitems.cpp | 8 +- src/providers/wcs/qgswcsprovider.cpp | 32 +- src/providers/wcs/qgswcsprovider.h | 2 +- src/providers/wcs/qgswcssourceselect.h | 2 +- src/providers/wfs/qgswfscapabilities.cpp | 4 +- src/providers/wfs/qgswfsdataitems.cpp | 12 +- src/providers/wfs/qgswfsfeatureiterator.cpp | 6 +- src/providers/wfs/qgswfsprovider.cpp | 6 +- src/providers/wfs/qgswfssourceselect.cpp | 12 +- src/providers/wfs/qgswfssourceselect.h | 2 +- src/providers/wms/qgstilescalewidget.h | 2 +- src/providers/wms/qgswmscapabilities.cpp | 14 +- src/providers/wms/qgswmscapabilities.h | 8 +- src/providers/wms/qgswmsdataitems.cpp | 10 +- src/providers/wms/qgswmsprovider.cpp | 70 ++-- src/providers/wms/qgswmsprovider.h | 4 +- src/providers/wms/qgswmssourceselect.cpp | 10 +- src/providers/wms/qgswmssourceselect.h | 2 +- src/providers/wms/qgswmtsdimensions.h | 2 +- src/python/qgspythonutilsimpl.cpp | 40 +- src/server/qgsaccesscontrolfilter.cpp | 6 +- src/server/qgscapabilitiescache.cpp | 2 +- src/server/qgsconfigcache.cpp | 16 +- src/server/qgsftptransaction.cpp | 2 +- src/server/qgshostedrdsbuilder.cpp | 6 +- src/server/qgshostedvdsbuilder.cpp | 8 +- src/server/qgshttprequesthandler.cpp | 8 +- src/server/qgsinterpolationlayerbuilder.cpp | 18 +- src/server/qgsmslayercache.cpp | 10 +- src/server/qgsowsserver.cpp | 2 +- src/server/qgsremotedatasourcebuilder.cpp | 16 +- src/server/qgsremoteowsbuilder.cpp | 42 +-- src/server/qgsrequesthandler.h | 2 +- src/server/qgssentdatasourcebuilder.cpp | 16 +- src/server/qgsserver.cpp | 34 +- src/server/qgsserverinterfaceimpl.cpp | 4 +- src/server/qgsserverlogger.cpp | 6 +- src/server/qgsserverprojectparser.cpp | 16 +- src/server/qgsserverstreamingdevice.cpp | 2 +- src/server/qgsserverstreamingdevice.h | 2 +- src/server/qgssldconfigparser.cpp | 42 +-- src/server/qgssoaprequesthandler.cpp | 2 +- src/server/qgswcsserver.cpp | 10 +- src/server/qgswfsserver.cpp | 10 +- src/server/qgswmsconfigparser.cpp | 2 +- src/server/qgswmsprojectparser.cpp | 10 +- src/server/qgswmsserver.cpp | 74 ++-- src/server/qgswmsserver.h | 6 +- 1071 files changed, 5127 insertions(+), 5127 deletions(-) diff --git a/src/analysis/interpolation/CloughTocherInterpolator.cc b/src/analysis/interpolation/CloughTocherInterpolator.cc index e527ca81965..db5092cdfda 100644 --- a/src/analysis/interpolation/CloughTocherInterpolator.cc +++ b/src/analysis/interpolation/CloughTocherInterpolator.cc @@ -20,7 +20,7 @@ #include CloughTocherInterpolator::CloughTocherInterpolator() - : mTIN( 0 ) + : mTIN( nullptr ) , mEdgeTolerance( 0.00001 ) , der1X( 0.0 ) , der1Y( 0.0 ) diff --git a/src/analysis/interpolation/DualEdgeTriangulation.cc b/src/analysis/interpolation/DualEdgeTriangulation.cc index 1aeed708e68..27f80fa703a 100644 --- a/src/analysis/interpolation/DualEdgeTriangulation.cc +++ b/src/analysis/interpolation/DualEdgeTriangulation.cc @@ -930,7 +930,7 @@ QList* DualEdgeTriangulation::getSurroundingTriangles( int pointno ) if ( firstedge == -1 )//an error occured { - return 0; + return nullptr; } QList* vlist = new QList();//create the value list on the heap @@ -3070,13 +3070,13 @@ QList* DualEdgeTriangulation::getPointsAroundEdge( double x, double y ) else { QgsDebugMsg( "warning: null pointer" ); - return 0; + return nullptr; } } else { QgsDebugMsg( "Edge number negative" ); - return 0; + return nullptr; } } @@ -3102,7 +3102,7 @@ bool DualEdgeTriangulation::saveAsShapefile( const QString& fileName ) const } } - QgsVectorFileWriter writer( shapeFileName, "Utf-8", fields, QGis::WKBLineString, 0 ); + QgsVectorFileWriter writer( shapeFileName, "Utf-8", fields, QGis::WKBLineString, nullptr ); if ( writer.hasError() != QgsVectorFileWriter::NoError ) { return false; diff --git a/src/analysis/interpolation/DualEdgeTriangulation.h b/src/analysis/interpolation/DualEdgeTriangulation.h index 59801519746..c9a6d799414 100644 --- a/src/analysis/interpolation/DualEdgeTriangulation.h +++ b/src/analysis/interpolation/DualEdgeTriangulation.h @@ -181,7 +181,7 @@ inline DualEdgeTriangulation::DualEdgeTriangulation() , xMin( 0 ) , yMax( 0 ) , yMin( 0 ) - , mTriangleInterpolator( 0 ) + , mTriangleInterpolator( nullptr ) , mForcedCrossBehaviour( Triangulation::DELETE_FIRST ) , mEdgeColor( 0, 255, 0 ) , mForcedEdgeColor( 0, 0, 255 ) @@ -202,7 +202,7 @@ inline DualEdgeTriangulation::DualEdgeTriangulation( int nop, Triangulation* dec , xMin( 0 ) , yMax( 0 ) , yMin( 0 ) - , mTriangleInterpolator( 0 ) + , mTriangleInterpolator( nullptr ) , mForcedCrossBehaviour( Triangulation::DELETE_FIRST ) , mEdgeColor( 0, 255, 0 ) , mForcedEdgeColor( 0, 0, 255 ) diff --git a/src/analysis/interpolation/LinTriangleInterpolator.h b/src/analysis/interpolation/LinTriangleInterpolator.h index d392d19e559..7171d649008 100644 --- a/src/analysis/interpolation/LinTriangleInterpolator.h +++ b/src/analysis/interpolation/LinTriangleInterpolator.h @@ -49,7 +49,7 @@ class ANALYSIS_EXPORT LinTriangleInterpolator : public TriangleInterpolator }; inline LinTriangleInterpolator::LinTriangleInterpolator() - : mTIN( 0 ) + : mTIN( nullptr ) { } diff --git a/src/analysis/interpolation/Node.cc b/src/analysis/interpolation/Node.cc index 96d674734b9..31f896281dc 100644 --- a/src/analysis/interpolation/Node.cc +++ b/src/analysis/interpolation/Node.cc @@ -25,7 +25,7 @@ Node::Node( const Node& n ) } else { - mPoint = 0; + mPoint = nullptr; } mNext = n.getNext(); @@ -39,7 +39,7 @@ Node& Node::operator=( const Node & n ) if ( n.getPoint() )//mPoint of n is not a null pointer { mPoint = new Point3D( n.getPoint()->getX(), n.getPoint()->getY(), n.getPoint()->getZ() ); - if ( mPoint == 0 )//no memory + if ( mPoint == nullptr )//no memory { mPoint = tmp; mNext = n.getNext(); @@ -49,7 +49,7 @@ Node& Node::operator=( const Node & n ) } else//mPoint of n is a null pointer { - mPoint = 0; + mPoint = nullptr; } if ( tmp ) diff --git a/src/analysis/interpolation/Node.h b/src/analysis/interpolation/Node.h index bf9332c3a20..174cb409999 100644 --- a/src/analysis/interpolation/Node.h +++ b/src/analysis/interpolation/Node.h @@ -42,7 +42,7 @@ class ANALYSIS_EXPORT Node void setPoint( Point3D* p ); }; -inline Node::Node() : mPoint( 0 ), mNext( 0 ) +inline Node::Node() : mPoint( nullptr ), mNext( nullptr ) { } diff --git a/src/analysis/interpolation/NormVecDecorator.cc b/src/analysis/interpolation/NormVecDecorator.cc index af274f68747..9764e45eda9 100644 --- a/src/analysis/interpolation/NormVecDecorator.cc +++ b/src/analysis/interpolation/NormVecDecorator.cc @@ -518,7 +518,7 @@ bool NormVecDecorator::estimateFirstDerivatives( QProgressDialog* d ) { d->setMinimum( 0 ); d->setMaximum( getNumberOfPoints() ); - d->setCancelButton( 0 ); //we cannot cancel derivative estimation + d->setCancelButton( nullptr ); //we cannot cancel derivative estimation d->show(); } diff --git a/src/analysis/interpolation/NormVecDecorator.h b/src/analysis/interpolation/NormVecDecorator.h index 50893fbf66f..9479f6e58b2 100644 --- a/src/analysis/interpolation/NormVecDecorator.h +++ b/src/analysis/interpolation/NormVecDecorator.h @@ -45,7 +45,7 @@ class ANALYSIS_EXPORT NormVecDecorator: public TriDecorator /** Estimates the first derivative a point. Return true in case of succes and false otherwise*/ bool estimateFirstDerivative( int pointno ); /** This method adds the functionality of estimating normals at the data points. Return true in the case of success and false otherwise*/ - bool estimateFirstDerivatives( QProgressDialog* d = 0 ); + bool estimateFirstDerivatives( QProgressDialog* d = nullptr ); /** Returns a pointer to the normal vector for the point with the number n*/ Vector3D* getNormal( int n ) const; /** Finds out, in which triangle a point with coordinates x and y is and assigns the triangle points to p1, p2, p3 and the estimated normals to v1, v2, v3. The vectors are normaly taken from 'mNormVec', exept if p1, p2 or p3 is a point on a breakline. In this case, the normal is calculated on-the-fly. Returns false, if something went wrong and true otherwise*/ @@ -78,12 +78,12 @@ class ANALYSIS_EXPORT NormVecDecorator: public TriDecorator void setState( int pointno, pointState s ); }; -inline NormVecDecorator::NormVecDecorator(): TriDecorator(), mInterpolator( 0 ), mNormVec( new QVector( mDefaultStorageForNormals ) ), mPointState( new QVector( mDefaultStorageForNormals ) ) +inline NormVecDecorator::NormVecDecorator(): TriDecorator(), mInterpolator( nullptr ), mNormVec( new QVector( mDefaultStorageForNormals ) ), mPointState( new QVector( mDefaultStorageForNormals ) ) { alreadyestimated = false; } -inline NormVecDecorator::NormVecDecorator( Triangulation* tin ): TriDecorator( tin ), mInterpolator( 0 ), mNormVec( new QVector( mDefaultStorageForNormals ) ), mPointState( new QVector( mDefaultStorageForNormals ) ) +inline NormVecDecorator::NormVecDecorator( Triangulation* tin ): TriDecorator( tin ), mInterpolator( nullptr ), mNormVec( new QVector( mDefaultStorageForNormals ) ), mPointState( new QVector( mDefaultStorageForNormals ) ) { alreadyestimated = false; } @@ -102,7 +102,7 @@ inline Vector3D* NormVecDecorator::getNormal( int n ) const else { QgsDebugMsg( "warning, null pointer" ); - return 0; + return nullptr; } } diff --git a/src/analysis/interpolation/ParametricLine.cc b/src/analysis/interpolation/ParametricLine.cc index 6f6200b25a4..d6957743ca9 100644 --- a/src/analysis/interpolation/ParametricLine.cc +++ b/src/analysis/interpolation/ParametricLine.cc @@ -47,7 +47,7 @@ void ParametricLine::calcPoint( float t, Point3D *p ) ParametricLine* ParametricLine::getParent() const { QgsDebugMsg( "warning, derive a class from ParametricLine" ); - return 0; + return nullptr; } void ParametricLine::remove( int i ) @@ -78,11 +78,11 @@ const Point3D* ParametricLine::getControlPoint( int number ) const { Q_UNUSED( number ); QgsDebugMsg( "warning, derive a class from ParametricLine" ); - return 0; + return nullptr; } const QVector* ParametricLine::getControlPoly() const { QgsDebugMsg( "warning, derive a class from ParametricLine" ); - return 0; + return nullptr; } diff --git a/src/analysis/interpolation/ParametricLine.h b/src/analysis/interpolation/ParametricLine.h index 00c3f35ba38..c764f380dcc 100644 --- a/src/analysis/interpolation/ParametricLine.h +++ b/src/analysis/interpolation/ParametricLine.h @@ -58,7 +58,7 @@ class ANALYSIS_EXPORT ParametricLine //-----------------------------------------constructors and destructor---------------------- -inline ParametricLine::ParametricLine() : mDegree( 0 ), mParent( 0 ), mControlPoly( 0 ) +inline ParametricLine::ParametricLine() : mDegree( 0 ), mParent( nullptr ), mControlPoly( nullptr ) { } diff --git a/src/analysis/interpolation/TriDecorator.cc b/src/analysis/interpolation/TriDecorator.cc index dcbe578ec60..a51ba661d1e 100644 --- a/src/analysis/interpolation/TriDecorator.cc +++ b/src/analysis/interpolation/TriDecorator.cc @@ -93,7 +93,7 @@ Point3D* TriDecorator::getPoint( unsigned int i ) const else { QgsDebugMsg( "warning, null pointer" ); - return 0; + return nullptr; } } @@ -162,7 +162,7 @@ QList* TriDecorator::getSurroundingTriangles( int pointno ) else { QgsDebugMsg( "warning, null pointer" ); - return 0; + return nullptr; } } @@ -342,6 +342,6 @@ QList* TriDecorator::getPointsAroundEdge( double x, double y ) else { QgsDebugMsg( "warning, null pointer" ); - return 0; + return nullptr; } } diff --git a/src/analysis/interpolation/TriDecorator.h b/src/analysis/interpolation/TriDecorator.h index c15e3fc3566..b688b00ea4f 100644 --- a/src/analysis/interpolation/TriDecorator.h +++ b/src/analysis/interpolation/TriDecorator.h @@ -59,7 +59,7 @@ class ANALYSIS_EXPORT TriDecorator : public Triangulation Triangulation* mTIN; }; -inline TriDecorator::TriDecorator(): mTIN( 0 ) +inline TriDecorator::TriDecorator(): mTIN( nullptr ) { } diff --git a/src/analysis/interpolation/qgsgridfilewriter.cpp b/src/analysis/interpolation/qgsgridfilewriter.cpp index a601bb63e60..430c464c14d 100644 --- a/src/analysis/interpolation/qgsgridfilewriter.cpp +++ b/src/analysis/interpolation/qgsgridfilewriter.cpp @@ -35,7 +35,7 @@ QgsGridFileWriter::QgsGridFileWriter( QgsInterpolator* i, const QString& outputP } QgsGridFileWriter::QgsGridFileWriter() - : mInterpolator( 0 ) + : mInterpolator( nullptr ) , mNumColumns( 0 ) , mNumRows( 0 ) , mCellSizeX( 0 ) @@ -72,10 +72,10 @@ int QgsGridFileWriter::writeFile( bool showProgressDialog ) double currentXValue; double interpolatedValue; - QProgressDialog* progressDialog = 0; + QProgressDialog* progressDialog = nullptr; if ( showProgressDialog ) { - progressDialog = new QProgressDialog( QObject::tr( "Interpolating..." ), QObject::tr( "Abort" ), 0, mNumRows, 0 ); + progressDialog = new QProgressDialog( QObject::tr( "Interpolating..." ), QObject::tr( "Abort" ), 0, mNumRows, nullptr ); progressDialog->setWindowModality( Qt::WindowModal ); } diff --git a/src/analysis/interpolation/qgsinterpolator.cpp b/src/analysis/interpolation/qgsinterpolator.cpp index df742ebf917..bbf2db447c3 100644 --- a/src/analysis/interpolation/qgsinterpolator.cpp +++ b/src/analysis/interpolation/qgsinterpolator.cpp @@ -54,7 +54,7 @@ int QgsInterpolator::cacheBaseData() for ( ; v_it != mLayerData.end(); ++v_it ) { - if ( v_it->vectorLayer == 0 ) + if ( v_it->vectorLayer == nullptr ) { continue; } diff --git a/src/analysis/interpolation/qgstininterpolator.cpp b/src/analysis/interpolation/qgstininterpolator.cpp index 05822cafcd0..5aedbf90314 100644 --- a/src/analysis/interpolation/qgstininterpolator.cpp +++ b/src/analysis/interpolation/qgstininterpolator.cpp @@ -29,8 +29,8 @@ QgsTINInterpolator::QgsTINInterpolator( const QList& inputData, TIN_INTERPOLATION interpolation, bool showProgressDialog ) : QgsInterpolator( inputData ) - , mTriangulation( 0 ) - , mTriangleInterpolator( 0 ) + , mTriangulation( nullptr ) + , mTriangleInterpolator( nullptr ) , mIsInitialized( false ) , mShowProgressDialog( showProgressDialog ) , mExportTriangulationToFile( false ) @@ -67,7 +67,7 @@ int QgsTINInterpolator::interpolatePoint( double x, double y, double& result ) void QgsTINInterpolator::initialize() { - DualEdgeTriangulation* theDualEdgeTriangulation = new DualEdgeTriangulation( 100000, 0 ); + DualEdgeTriangulation* theDualEdgeTriangulation = new DualEdgeTriangulation( 100000, nullptr ); if ( mInterpolation == CloughTocher ) { NormVecDecorator* dec = new NormVecDecorator(); @@ -94,10 +94,10 @@ void QgsTINInterpolator::initialize() } } - QProgressDialog* theProgressDialog = 0; + QProgressDialog* theProgressDialog = nullptr; if ( mShowProgressDialog ) { - theProgressDialog = new QProgressDialog( QObject::tr( "Building triangulation..." ), QObject::tr( "Abort" ), 0, nFeatures, 0 ); + theProgressDialog = new QProgressDialog( QObject::tr( "Building triangulation..." ), QObject::tr( "Abort" ), 0, nFeatures, nullptr ); theProgressDialog->setWindowModality( Qt::WindowModal ); } @@ -140,7 +140,7 @@ void QgsTINInterpolator::initialize() NormVecDecorator* dec = dynamic_cast( mTriangulation ); if ( dec ) { - QProgressDialog* progressDialog = 0; + QProgressDialog* progressDialog = nullptr; if ( mShowProgressDialog ) //show a progress dialog because it can take a long time... { progressDialog = new QProgressDialog(); @@ -203,7 +203,7 @@ int QgsTINInterpolator::insertData( QgsFeature* f, bool zCoord, int attr, InputT double x, y, z; QgsConstWkbPtr currentWkbPtr( g->asWkb() + 1 + sizeof( int ) ); //maybe a structure or break line - Line3D* line = 0; + Line3D* line = nullptr; QGis::WkbType wkbType = g->wkbType(); switch ( wkbType ) diff --git a/src/analysis/network/qgsgraphanalyzer.cpp b/src/analysis/network/qgsgraphanalyzer.cpp index 50db65121e4..a56dd50f634 100644 --- a/src/analysis/network/qgsgraphanalyzer.cpp +++ b/src/analysis/network/qgsgraphanalyzer.cpp @@ -28,8 +28,8 @@ void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int criterionNum, QVector* resultTree, QVector* resultCost ) { - QVector< double > * result = NULL; - if ( resultCost != NULL ) + QVector< double > * result = nullptr; + if ( resultCost != nullptr ) { result = resultCost; } @@ -42,7 +42,7 @@ void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int result->insert( result->begin(), source->vertexCount(), std::numeric_limits::infinity() ); ( *result )[ startPointIdx ] = 0.0; - if ( resultTree != NULL ) + if ( resultTree != nullptr ) { resultTree->clear(); resultTree->insert( resultTree->begin(), source->vertexCount(), -1 ); @@ -73,7 +73,7 @@ void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int if ( cost < ( *result )[ arc.inVertex()] ) { ( *result )[ arc.inVertex()] = cost; - if ( resultTree != NULL ) + if ( resultTree != nullptr ) { ( *resultTree )[ arc.inVertex()] = *arcIt; } @@ -81,7 +81,7 @@ void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int } } } - if ( resultCost == NULL ) + if ( resultCost == nullptr ) { delete result; } diff --git a/src/analysis/network/qgsgraphanalyzer.h b/src/analysis/network/qgsgraphanalyzer.h index 73374514723..347a6560ab6 100644 --- a/src/analysis/network/qgsgraphanalyzer.h +++ b/src/analysis/network/qgsgraphanalyzer.h @@ -39,7 +39,7 @@ class ANALYSIS_EXPORT QgsGraphAnalyzer * @param resultTree array represents the shortest path tree. resultTree[ vertexIndex ] == inboundingArcIndex if vertex reacheble and resultTree[ vertexIndex ] == -1 others. * @param resultCost array of cost paths */ - static void dijkstra( const QgsGraph* source, int startVertexIdx, int criterionNum, QVector* resultTree = NULL, QVector* resultCost = NULL ); + static void dijkstra( const QgsGraph* source, int startVertexIdx, int criterionNum, QVector* resultTree = nullptr, QVector* resultCost = nullptr ); /** * return shortest path tree with root-node in startVertexIdx diff --git a/src/analysis/network/qgsgraphbuilder.cpp b/src/analysis/network/qgsgraphbuilder.cpp index 1934da4fb6e..36151487bb0 100644 --- a/src/analysis/network/qgsgraphbuilder.cpp +++ b/src/analysis/network/qgsgraphbuilder.cpp @@ -29,7 +29,7 @@ QgsGraphBuilder::QgsGraphBuilder( const QgsCoordinateReferenceSystem& crs, bool QgsGraphBuilder::~QgsGraphBuilder() { - if ( mGraph != NULL ) + if ( mGraph != nullptr ) delete mGraph; } @@ -46,6 +46,6 @@ void QgsGraphBuilder::addArc( int pt1id, const QgsPoint&, int pt2id, const QgsPo QgsGraph* QgsGraphBuilder::graph() { QgsGraph* res = mGraph; - mGraph = NULL; + mGraph = nullptr; return res; } diff --git a/src/analysis/network/qgslinevectorlayerdirector.cpp b/src/analysis/network/qgslinevectorlayerdirector.cpp index 14dde0a0dfc..e5d8a2a06f3 100644 --- a/src/analysis/network/qgslinevectorlayerdirector.cpp +++ b/src/analysis/network/qgslinevectorlayerdirector.cpp @@ -130,7 +130,7 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c { QgsVectorLayer *vl = mVectorLayer; - if ( vl == NULL ) + if ( vl == nullptr ) return; int featureCount = ( int ) vl->featureCount() * 2; diff --git a/src/analysis/openstreetmap/qgsosmdatabase.cpp b/src/analysis/openstreetmap/qgsosmdatabase.cpp index 93bd742ddca..1bf2eb33d08 100644 --- a/src/analysis/openstreetmap/qgsosmdatabase.cpp +++ b/src/analysis/openstreetmap/qgsosmdatabase.cpp @@ -21,13 +21,13 @@ QgsOSMDatabase::QgsOSMDatabase( const QString& dbFileName ) : mDbFileName( dbFileName ) - , mDatabase( 0 ) - , mStmtNode( 0 ) - , mStmtNodeTags( 0 ) - , mStmtWay( 0 ) - , mStmtWayNode( 0 ) - , mStmtWayNodePoints( 0 ) - , mStmtWayTags( 0 ) + , mDatabase( nullptr ) + , mStmtNode( nullptr ) + , mStmtNodeTags( nullptr ) + , mStmtWay( nullptr ) + , mStmtWayNode( nullptr ) + , mStmtWayNodePoints( nullptr ) + , mStmtWayTags( nullptr ) { } @@ -39,14 +39,14 @@ QgsOSMDatabase::~QgsOSMDatabase() bool QgsOSMDatabase::isOpen() const { - return mDatabase != 0; + return mDatabase != nullptr; } bool QgsOSMDatabase::open() { // open database - int res = QgsSLConnect::sqlite3_open_v2( mDbFileName.toUtf8().data(), &mDatabase, SQLITE_OPEN_READWRITE, 0 ); + int res = QgsSLConnect::sqlite3_open_v2( mDbFileName.toUtf8().data(), &mDatabase, SQLITE_OPEN_READWRITE, nullptr ); if ( res != SQLITE_OK ) { mError = QString( "Failed to open database [%1]: %2" ).arg( res ).arg( mDbFileName ); @@ -69,7 +69,7 @@ void QgsOSMDatabase::deleteStatement( sqlite3_stmt*& stmt ) if ( stmt ) { sqlite3_finalize( stmt ); - stmt = 0; + stmt = nullptr; } } @@ -83,7 +83,7 @@ bool QgsOSMDatabase::close() deleteStatement( mStmtWayNodePoints ); deleteStatement( mStmtWayTags ); - Q_ASSERT( mStmtNode == 0 ); + Q_ASSERT( mStmtNode == nullptr ); // close database if ( QgsSLConnect::sqlite3_close( mDatabase ) != SQLITE_OK ) @@ -91,7 +91,7 @@ bool QgsOSMDatabase::close() //mError = ( char * ) "Closing SQLite3 database failed."; //return false; } - mDatabase = 0; + mDatabase = nullptr; return true; } @@ -99,7 +99,7 @@ bool QgsOSMDatabase::close() int QgsOSMDatabase::runCountStatement( const char* sql ) const { sqlite3_stmt* stmt; - int res = sqlite3_prepare_v2( mDatabase, sql, -1, &stmt, 0 ); + int res = sqlite3_prepare_v2( mDatabase, sql, -1, &stmt, nullptr ); if ( res != SQLITE_OK ) return -1; @@ -183,7 +183,7 @@ QList QgsOSMDatabase::usedTags( bool ways ) const QString sql = QString( "SELECT k, count(k) FROM %1_tags GROUP BY k" ).arg( ways ? "ways" : "nodes" ); sqlite3_stmt* stmt; - if ( sqlite3_prepare_v2( mDatabase, sql.toUtf8().data(), -1, &stmt, 0 ) != SQLITE_OK ) + if ( sqlite3_prepare_v2( mDatabase, sql.toUtf8().data(), -1, &stmt, nullptr ) != SQLITE_OK ) return pairs; while ( sqlite3_step( stmt ) == SQLITE_ROW ) @@ -278,7 +278,7 @@ bool QgsOSMDatabase::prepareStatements() for ( int i = 0; i < count; ++i ) { - if ( sqlite3_prepare_v2( mDatabase, sql[i], -1, sqlite[i], 0 ) != SQLITE_OK ) + if ( sqlite3_prepare_v2( mDatabase, sql[i], -1, sqlite[i], nullptr ) != SQLITE_OK ) { const char* errMsg = sqlite3_errmsg( mDatabase ); // does not require free mError = QString( "Error preparing SQL command:\n%1\nSQL:\n%2" ) @@ -309,7 +309,7 @@ bool QgsOSMDatabase::exportSpatiaLite( ExportType type, const QString& tableName // import data - int retX = sqlite3_exec( mDatabase, "BEGIN", NULL, NULL, 0 ); + int retX = sqlite3_exec( mDatabase, "BEGIN", nullptr, nullptr, nullptr ); Q_ASSERT( retX == SQLITE_OK ); Q_UNUSED( retX ); @@ -320,7 +320,7 @@ bool QgsOSMDatabase::exportSpatiaLite( ExportType type, const QString& tableName else Q_ASSERT( false && "Unknown export type" ); - int retY = sqlite3_exec( mDatabase, "COMMIT", NULL, NULL, 0 ); + int retY = sqlite3_exec( mDatabase, "COMMIT", nullptr, nullptr, nullptr ); Q_ASSERT( retY == SQLITE_OK ); Q_UNUSED( retY ); @@ -338,8 +338,8 @@ bool QgsOSMDatabase::createSpatialTable( const QString& tableName, const QString sqlCreateTable += QString( ", %1 TEXT" ).arg( quotedIdentifier( tagKeys[i] ) ); sqlCreateTable += ')'; - char *errMsg = NULL; - int ret = sqlite3_exec( mDatabase, sqlCreateTable.toUtf8().constData(), NULL, NULL, &errMsg ); + char *errMsg = nullptr; + int ret = sqlite3_exec( mDatabase, sqlCreateTable.toUtf8().constData(), nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { mError = "Unable to create table:\n" + QString::fromUtf8( errMsg ); @@ -350,7 +350,7 @@ bool QgsOSMDatabase::createSpatialTable( const QString& tableName, const QString QString sqlAddGeomColumn = QString( "SELECT AddGeometryColumn(%1, 'geometry', 4326, %2, 'XY')" ) .arg( quotedValue( tableName ), quotedValue( geometryType ) ); - ret = sqlite3_exec( mDatabase, sqlAddGeomColumn.toUtf8().constData(), NULL, NULL, &errMsg ); + ret = sqlite3_exec( mDatabase, sqlAddGeomColumn.toUtf8().constData(), nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { mError = "Unable to add geometry column:\n" + QString::fromUtf8( errMsg ); @@ -365,8 +365,8 @@ bool QgsOSMDatabase::createSpatialTable( const QString& tableName, const QString bool QgsOSMDatabase::createSpatialIndex( const QString& tableName ) { QString sqlSpatialIndex = QString( "SELECT CreateSpatialIndex(%1, 'geometry')" ).arg( quotedValue( tableName ) ); - char *errMsg = NULL; - int ret = sqlite3_exec( mDatabase, sqlSpatialIndex.toUtf8().constData(), NULL, NULL, &errMsg ); + char *errMsg = nullptr; + int ret = sqlite3_exec( mDatabase, sqlSpatialIndex.toUtf8().constData(), nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { mError = "Unable to create spatial index:\n" + QString::fromUtf8( errMsg ); @@ -385,7 +385,7 @@ void QgsOSMDatabase::exportSpatiaLiteNodes( const QString& tableName, const QStr sqlInsertPoint += QString( ",?" ); sqlInsertPoint += ", GeomFromWKB(?, 4326))"; sqlite3_stmt* stmtInsert; - if ( sqlite3_prepare_v2( mDatabase, sqlInsertPoint.toUtf8().constData(), -1, &stmtInsert, 0 ) != SQLITE_OK ) + if ( sqlite3_prepare_v2( mDatabase, sqlInsertPoint.toUtf8().constData(), -1, &stmtInsert, nullptr ) != SQLITE_OK ) { mError = "Prepare SELECT FROM nodes failed."; return; @@ -453,7 +453,7 @@ void QgsOSMDatabase::exportSpatiaLiteWays( bool closed, const QString& tableName sqlInsertLine += QString( ",?" ); sqlInsertLine += ", GeomFromWKB(?, 4326))"; sqlite3_stmt* stmtInsert; - if ( sqlite3_prepare_v2( mDatabase, sqlInsertLine.toUtf8().constData(), -1, &stmtInsert, 0 ) != SQLITE_OK ) + if ( sqlite3_prepare_v2( mDatabase, sqlInsertLine.toUtf8().constData(), -1, &stmtInsert, nullptr ) != SQLITE_OK ) { mError = "Prepare SELECT FROM ways failed."; return; @@ -547,10 +547,10 @@ QString QgsOSMDatabase::quotedValue( QString value ) QgsOSMNodeIterator::QgsOSMNodeIterator( sqlite3* handle ) - : mStmt( 0 ) + : mStmt( nullptr ) { const char* sql = "SELECT id,lon,lat FROM nodes"; - if ( sqlite3_prepare_v2( handle, sql, -1, &mStmt, 0 ) != SQLITE_OK ) + if ( sqlite3_prepare_v2( handle, sql, -1, &mStmt, nullptr ) != SQLITE_OK ) { qDebug( "OSMNodeIterator: error prepare" ); } @@ -585,7 +585,7 @@ void QgsOSMNodeIterator::close() if ( mStmt ) { sqlite3_finalize( mStmt ); - mStmt = 0; + mStmt = nullptr; } } @@ -593,10 +593,10 @@ void QgsOSMNodeIterator::close() QgsOSMWayIterator::QgsOSMWayIterator( sqlite3* handle ) - : mStmt( 0 ) + : mStmt( nullptr ) { const char* sql = "SELECT id FROM ways"; - if ( sqlite3_prepare_v2( handle, sql, -1, &mStmt, 0 ) != SQLITE_OK ) + if ( sqlite3_prepare_v2( handle, sql, -1, &mStmt, nullptr ) != SQLITE_OK ) { qDebug( "OSMWayIterator: error prepare" ); } @@ -629,6 +629,6 @@ void QgsOSMWayIterator::close() if ( mStmt ) { sqlite3_finalize( mStmt ); - mStmt = 0; + mStmt = nullptr; } } diff --git a/src/analysis/openstreetmap/qgsosmdownload.cpp b/src/analysis/openstreetmap/qgsosmdownload.cpp index c3d0b3d7228..adef53d5fc1 100644 --- a/src/analysis/openstreetmap/qgsosmdownload.cpp +++ b/src/analysis/openstreetmap/qgsosmdownload.cpp @@ -22,7 +22,7 @@ QString QgsOSMDownload::queryFromRect( const QgsRectangle& rect ) QgsOSMDownload::QgsOSMDownload() - : mServiceUrl( defaultServiceUrl() ), mReply( 0 ) + : mServiceUrl( defaultServiceUrl() ), mReply( nullptr ) { } @@ -32,7 +32,7 @@ QgsOSMDownload::~QgsOSMDownload() { mReply->abort(); mReply->deleteLater(); - mReply = 0; + mReply = nullptr; } } @@ -103,7 +103,7 @@ void QgsOSMDownload::onFinished() Q_ASSERT( mReply ); mReply->deleteLater(); - mReply = 0; + mReply = nullptr; mFile.close(); diff --git a/src/analysis/openstreetmap/qgsosmimport.cpp b/src/analysis/openstreetmap/qgsosmimport.cpp index 5b72eaafa5e..bfe9d633815 100644 --- a/src/analysis/openstreetmap/qgsosmimport.cpp +++ b/src/analysis/openstreetmap/qgsosmimport.cpp @@ -23,12 +23,12 @@ QgsOSMXmlImport::QgsOSMXmlImport( const QString& xmlFilename, const QString& dbFilename ) : mXmlFileName( xmlFilename ) , mDbFileName( dbFilename ) - , mDatabase( 0 ) - , mStmtInsertNode( 0 ) - , mStmtInsertNodeTag( 0 ) - , mStmtInsertWay( 0 ) - , mStmtInsertWayNode( 0 ) - , mStmtInsertWayTag( 0 ) + , mDatabase( nullptr ) + , mStmtInsertNode( nullptr ) + , mStmtInsertNodeTag( nullptr ) + , mStmtInsertWay( nullptr ) + , mStmtInsertWayNode( nullptr ) + , mStmtInsertWayTag( nullptr ) { } @@ -64,7 +64,7 @@ bool QgsOSMXmlImport::import() qDebug( "starting import" ); - int retX = sqlite3_exec( mDatabase, "BEGIN", NULL, NULL, 0 ); + int retX = sqlite3_exec( mDatabase, "BEGIN", nullptr, nullptr, nullptr ); Q_ASSERT( retX == SQLITE_OK ); Q_UNUSED( retX ); @@ -88,7 +88,7 @@ bool QgsOSMXmlImport::import() } } - int retY = sqlite3_exec( mDatabase, "COMMIT", NULL, NULL, 0 ); + int retY = sqlite3_exec( mDatabase, "COMMIT", nullptr, nullptr, nullptr ); Q_ASSERT( retY == SQLITE_OK ); Q_UNUSED( retY ); @@ -117,7 +117,7 @@ bool QgsOSMXmlImport::createIndexes() int count = sizeof( sqlIndexes ) / sizeof( const char* ); for ( int i = 0; i < count; ++i ) { - int ret = sqlite3_exec( mDatabase, sqlIndexes[i], 0, 0, 0 ); + int ret = sqlite3_exec( mDatabase, sqlIndexes[i], nullptr, nullptr, nullptr ); if ( ret != SQLITE_OK ) { mError = "Error creating indexes!"; @@ -133,11 +133,11 @@ bool QgsOSMXmlImport::createDatabase() { char **results; int rows, columns; - if ( QgsSLConnect::sqlite3_open_v2( mDbFileName.toUtf8().data(), &mDatabase, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0 ) != SQLITE_OK ) + if ( QgsSLConnect::sqlite3_open_v2( mDbFileName.toUtf8().data(), &mDatabase, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr ) != SQLITE_OK ) return false; bool above41 = false; - int ret = sqlite3_get_table( mDatabase, "select spatialite_version()", &results, &rows, &columns, NULL ); + int ret = sqlite3_get_table( mDatabase, "select spatialite_version()", &results, &rows, &columns, nullptr ); if ( ret == SQLITE_OK && rows == 1 && columns == 1 ) { QString version = QString::fromUtf8( results[1] ); @@ -166,7 +166,7 @@ bool QgsOSMXmlImport::createDatabase() for ( int i = 0; i < initCount; ++i ) { char* errMsg; - if ( sqlite3_exec( mDatabase, sqlInitStatements[i], 0, 0, &errMsg ) != SQLITE_OK ) + if ( sqlite3_exec( mDatabase, sqlInitStatements[i], nullptr, nullptr, &errMsg ) != SQLITE_OK ) { mError = QString( "Error executing SQL command:\n%1\nSQL:\n%2" ) .arg( QString::fromUtf8( errMsg ), QString::fromUtf8( sqlInitStatements[i] ) ); @@ -197,7 +197,7 @@ bool QgsOSMXmlImport::createDatabase() for ( int i = 0; i < insertCount; ++i ) { - if ( sqlite3_prepare_v2( mDatabase, sqlInsertStatements[i], -1, sqliteInsertStatements[i], 0 ) != SQLITE_OK ) + if ( sqlite3_prepare_v2( mDatabase, sqlInsertStatements[i], -1, sqliteInsertStatements[i], nullptr ) != SQLITE_OK ) { const char* errMsg = sqlite3_errmsg( mDatabase ); // does not require free mError = QString( "Error preparing SQL command:\n%1\nSQL:\n%2" ) @@ -216,7 +216,7 @@ void QgsOSMXmlImport::deleteStatement( sqlite3_stmt*& stmt ) if ( stmt ) { sqlite3_finalize( stmt ); - stmt = 0; + stmt = nullptr; } } @@ -232,10 +232,10 @@ bool QgsOSMXmlImport::closeDatabase() deleteStatement( mStmtInsertWayNode ); deleteStatement( mStmtInsertWayTag ); - Q_ASSERT( mStmtInsertNode == 0 ); + Q_ASSERT( mStmtInsertNode == nullptr ); QgsSLConnect::sqlite3_close( mDatabase ); - mDatabase = 0; + mDatabase = nullptr; return true; } diff --git a/src/analysis/raster/qgsalignraster.cpp b/src/analysis/raster/qgsalignraster.cpp index 65d03432836..8b08ed8f882 100644 --- a/src/analysis/raster/qgsalignraster.cpp +++ b/src/analysis/raster/qgsalignraster.cpp @@ -117,7 +117,7 @@ static CPLErr rescalePostWarpChunkProcessor( void* pKern, void* pArg ) QgsAlignRaster::QgsAlignRaster() - : mProgressHandler( 0 ) + : mProgressHandler( nullptr ) { // parameters mCellSizeX = mCellSizeY = 0; @@ -267,7 +267,7 @@ bool QgsAlignRaster::checkInputParameters() QSizeF cs; QgsRectangle extent; - if ( !suggestedWarpOutput( info, mCrsWkt, &cs, 0, &extent ) ) + if ( !suggestedWarpOutput( info, mCrsWkt, &cs, nullptr, &extent ) ) { mErrorMessage = QString( "Failed to get suggested warp output.\n\n" "File:\n%1\n\n" @@ -444,7 +444,7 @@ bool QgsAlignRaster::createAndWarp( const Item& raster ) // Create the output file. GDALDatasetH hDstDS; hDstDS = GDALCreate( hDriver, raster.outputFilename.toLocal8Bit().constData(), mXSize, mYSize, - bandCount, eDT, NULL ); + bandCount, eDT, nullptr ); if ( !hDstDS ) { GDALClose( hSrcDS ); @@ -458,7 +458,7 @@ bool QgsAlignRaster::createAndWarp( const Item& raster ) // Copy the color table, if required. GDALColorTableH hCT = GDALGetRasterColorTable( GDALGetRasterBand( hSrcDS, 1 ) ); - if ( hCT != NULL ) + if ( hCT != nullptr ) GDALSetRasterColorTable( GDALGetRasterBand( hDstDS, 1 ), hCT ); // ----------------------------------------------------------------------- @@ -522,7 +522,7 @@ bool QgsAlignRaster::suggestedWarpOutput( const QgsAlignRaster::RasterInfo& info // to destination georeferenced coordinates (not destination // pixel line). We do that by omitting the destination dataset // handle (setting it to NULL). - void* hTransformArg = GDALCreateGenImgProjTransformer( info.mDataset, info.mCrsWkt.toAscii().constData(), NULL, destWkt.toAscii().constData(), FALSE, 0, 1 ); + void* hTransformArg = GDALCreateGenImgProjTransformer( info.mDataset, info.mCrsWkt.toAscii().constData(), nullptr, destWkt.toAscii().constData(), FALSE, 0, 1 ); if ( !hTransformArg ) return false; diff --git a/src/analysis/raster/qgsalignraster.h b/src/analysis/raster/qgsalignraster.h index 39650a2335b..077fcb3e1d6 100644 --- a/src/analysis/raster/qgsalignraster.h +++ b/src/analysis/raster/qgsalignraster.h @@ -49,7 +49,7 @@ class ANALYSIS_EXPORT QgsAlignRaster ~RasterInfo(); //! Check whether the given path is a valid raster - bool isValid() const { return mDataset != 0; } + bool isValid() const { return mDataset != nullptr; } //! Return CRS in WKT format QString crs() const { return mCrsWkt; } @@ -218,7 +218,7 @@ class ANALYSIS_EXPORT QgsAlignRaster bool createAndWarp( const Item& raster ); //! Determine suggested output of raster warp to a different CRS. Returns true on success - static bool suggestedWarpOutput( const RasterInfo& info, const QString& destWkt, QSizeF* cellSize = 0, QPointF* gridOffset = 0, QgsRectangle* rect = 0 ); + static bool suggestedWarpOutput( const RasterInfo& info, const QString& destWkt, QSizeF* cellSize = nullptr, QPointF* gridOffset = nullptr, QgsRectangle* rect = nullptr ); protected: diff --git a/src/analysis/raster/qgsninecellfilter.cpp b/src/analysis/raster/qgsninecellfilter.cpp index ce85ef61eee..4627e0a24c2 100644 --- a/src/analysis/raster/qgsninecellfilter.cpp +++ b/src/analysis/raster/qgsninecellfilter.cpp @@ -60,36 +60,36 @@ int QgsNineCellFilter::processRaster( QProgressDialog* p ) //open input file int xSize, ySize; GDALDatasetH inputDataset = openInputFile( xSize, ySize ); - if ( inputDataset == NULL ) + if ( inputDataset == nullptr ) { return 1; //opening of input file failed } //output driver GDALDriverH outputDriver = openOutputDriver(); - if ( outputDriver == 0 ) + if ( outputDriver == nullptr ) { return 2; } GDALDatasetH outputDataset = openOutputFile( inputDataset, outputDriver ); - if ( outputDataset == NULL ) + if ( outputDataset == nullptr ) { return 3; //create operation on output file failed } //open first raster band for reading (operation is only for single band raster) GDALRasterBandH rasterBand = GDALGetRasterBand( inputDataset, 1 ); - if ( rasterBand == NULL ) + if ( rasterBand == nullptr ) { GDALClose( inputDataset ); GDALClose( outputDataset ); return 4; } - mInputNodataValue = GDALGetRasterNoDataValue( rasterBand, NULL ); + mInputNodataValue = GDALGetRasterNoDataValue( rasterBand, nullptr ); GDALRasterBandH outputRasterBand = GDALGetRasterBand( outputDataset, 1 ); - if ( outputRasterBand == NULL ) + if ( outputRasterBand == nullptr ) { GDALClose( inputDataset ); GDALClose( outputDataset ); @@ -97,7 +97,7 @@ int QgsNineCellFilter::processRaster( QProgressDialog* p ) } //try to set -9999 as nodata value GDALSetRasterNoDataValue( outputRasterBand, -9999 ); - mOutputNodataValue = GDALGetRasterNoDataValue( outputRasterBand, NULL ); + mOutputNodataValue = GDALGetRasterNoDataValue( outputRasterBand, nullptr ); if ( ySize < 3 ) //we require at least three rows (should be true for most datasets) { @@ -209,7 +209,7 @@ int QgsNineCellFilter::processRaster( QProgressDialog* p ) GDALDatasetH QgsNineCellFilter::openInputFile( int& nCellsX, int& nCellsY ) { GDALDatasetH inputDataset = GDALOpen( TO8F( mInputFile ), GA_ReadOnly ); - if ( inputDataset != NULL ) + if ( inputDataset != nullptr ) { nCellsX = GDALGetRasterXSize( inputDataset ); nCellsY = GDALGetRasterYSize( inputDataset ); @@ -218,7 +218,7 @@ GDALDatasetH QgsNineCellFilter::openInputFile( int& nCellsX, int& nCellsY ) if ( GDALGetRasterCount( inputDataset ) < 1 ) { GDALClose( inputDataset ); - return NULL; + return nullptr; } } return inputDataset; @@ -231,15 +231,15 @@ GDALDriverH QgsNineCellFilter::openOutputDriver() //open driver GDALDriverH outputDriver = GDALGetDriverByName( mOutputFormat.toLocal8Bit().data() ); - if ( outputDriver == NULL ) + if ( outputDriver == nullptr ) { return outputDriver; //return NULL, driver does not exist } - driverMetadata = GDALGetMetadata( outputDriver, NULL ); + driverMetadata = GDALGetMetadata( outputDriver, nullptr ); if ( !CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE, false ) ) { - return NULL; //driver exist, but it does not support the create operation + return nullptr; //driver exist, but it does not support the create operation } return outputDriver; @@ -247,18 +247,18 @@ GDALDriverH QgsNineCellFilter::openOutputDriver() GDALDatasetH QgsNineCellFilter::openOutputFile( GDALDatasetH inputDataset, GDALDriverH outputDriver ) { - if ( inputDataset == NULL ) + if ( inputDataset == nullptr ) { - return NULL; + return nullptr; } int xSize = GDALGetRasterXSize( inputDataset ); int ySize = GDALGetRasterYSize( inputDataset ); //open output file - char **papszOptions = NULL; + char **papszOptions = nullptr; GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), xSize, ySize, 1, GDT_Float32, papszOptions ); - if ( outputDataset == NULL ) + if ( outputDataset == nullptr ) { return outputDataset; } @@ -268,7 +268,7 @@ GDALDatasetH QgsNineCellFilter::openOutputFile( GDALDatasetH inputDataset, GDALD if ( GDALGetGeoTransform( inputDataset, geotransform ) != CE_None ) { GDALClose( outputDataset ); - return NULL; + return nullptr; } GDALSetGeoTransform( outputDataset, geotransform ); diff --git a/src/analysis/raster/qgsrastercalcnode.cpp b/src/analysis/raster/qgsrastercalcnode.cpp index 31708d14685..80f26b09992 100644 --- a/src/analysis/raster/qgsrastercalcnode.cpp +++ b/src/analysis/raster/qgsrastercalcnode.cpp @@ -18,28 +18,28 @@ QgsRasterCalcNode::QgsRasterCalcNode() : mType( tNumber ) - , mLeft( 0 ) - , mRight( 0 ) + , mLeft( nullptr ) + , mRight( nullptr ) , mNumber( 0 ) - , mMatrix( 0 ) + , mMatrix( nullptr ) , mOperator( opNONE ) { } QgsRasterCalcNode::QgsRasterCalcNode( double number ) : mType( tNumber ) - , mLeft( 0 ) - , mRight( 0 ) + , mLeft( nullptr ) + , mRight( nullptr ) , mNumber( number ) - , mMatrix( 0 ) + , mMatrix( nullptr ) , mOperator( opNONE ) { } QgsRasterCalcNode::QgsRasterCalcNode( QgsRasterMatrix* matrix ) : mType( tMatrix ) - , mLeft( 0 ) - , mRight( 0 ) + , mLeft( nullptr ) + , mRight( nullptr ) , mNumber( 0 ) , mMatrix( matrix ) , mOperator( opNONE ) @@ -52,18 +52,18 @@ QgsRasterCalcNode::QgsRasterCalcNode( Operator op, QgsRasterCalcNode* left, QgsR , mLeft( left ) , mRight( right ) , mNumber( 0 ) - , mMatrix( 0 ) + , mMatrix( nullptr ) , mOperator( op ) { } QgsRasterCalcNode::QgsRasterCalcNode( const QString& rasterName ) : mType( tRasterRef ) - , mLeft( 0 ) - , mRight( 0 ) + , mLeft( nullptr ) + , mRight( nullptr ) , mNumber( 0 ) , mRasterName( rasterName ) - , mMatrix( 0 ) + , mMatrix( nullptr ) , mOperator( opNONE ) { if ( mRasterName.startsWith( '"' ) && mRasterName.endsWith( '"' ) ) diff --git a/src/analysis/raster/qgsrastercalculator.cpp b/src/analysis/raster/qgsrastercalculator.cpp index 2c7a007344a..48e88f20beb 100644 --- a/src/analysis/raster/qgsrastercalculator.cpp +++ b/src/analysis/raster/qgsrastercalculator.cpp @@ -86,7 +86,7 @@ int QgsRasterCalculator::processCalculation( QProgressDialog* p ) return 2; } - QgsRasterBlock* block = 0; + QgsRasterBlock* block = nullptr; // if crs transform needed if ( it->raster->crs() != mOutputCrs ) { @@ -106,7 +106,7 @@ int QgsRasterCalculator::processCalculation( QProgressDialog* p ) //open output dataset for writing GDALDriverH outputDriver = openOutputDriver(); - if ( outputDriver == NULL ) + if ( outputDriver == nullptr ) { return 1; } @@ -194,15 +194,15 @@ GDALDriverH QgsRasterCalculator::openOutputDriver() //open driver GDALDriverH outputDriver = GDALGetDriverByName( mOutputFormat.toLocal8Bit().data() ); - if ( outputDriver == NULL ) + if ( outputDriver == nullptr ) { return outputDriver; //return NULL, driver does not exist } - driverMetadata = GDALGetMetadata( outputDriver, NULL ); + driverMetadata = GDALGetMetadata( outputDriver, nullptr ); if ( !CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE, false ) ) { - return NULL; //driver exist, but it does not support the create operation + return nullptr; //driver exist, but it does not support the create operation } return outputDriver; @@ -211,9 +211,9 @@ GDALDriverH QgsRasterCalculator::openOutputDriver() GDALDatasetH QgsRasterCalculator::openOutputFile( GDALDriverH outputDriver ) { //open output file - char **papszOptions = NULL; + char **papszOptions = nullptr; GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), mNumOutputColumns, mNumOutputRows, 1, GDT_Float32, papszOptions ); - if ( outputDataset == NULL ) + if ( outputDataset == nullptr ) { return outputDataset; } diff --git a/src/analysis/raster/qgsrastercalculator.h b/src/analysis/raster/qgsrastercalculator.h index f7256822843..ef460faad55 100644 --- a/src/analysis/raster/qgsrastercalculator.h +++ b/src/analysis/raster/qgsrastercalculator.h @@ -72,7 +72,7 @@ class ANALYSIS_EXPORT QgsRasterCalculator /** Starts the calculation and writes new raster @param p progress bar (or 0 if called from non-gui code) @return 0 in case of success*/ - int processCalculation( QProgressDialog* p = 0 ); + int processCalculation( QProgressDialog* p = nullptr ); private: //default constructor forbidden. We need formula, output file, output format and output raster resolution obligatory diff --git a/src/analysis/raster/qgsrastermatrix.cpp b/src/analysis/raster/qgsrastermatrix.cpp index b21a4a1d795..17dc4f575fd 100644 --- a/src/analysis/raster/qgsrastermatrix.cpp +++ b/src/analysis/raster/qgsrastermatrix.cpp @@ -22,7 +22,7 @@ QgsRasterMatrix::QgsRasterMatrix() : mColumns( 0 ) , mRows( 0 ) - , mData( 0 ) + , mData( nullptr ) , mNodataValue( -1 ) { } @@ -38,7 +38,7 @@ QgsRasterMatrix::QgsRasterMatrix( int nCols, int nRows, double* data, double nod QgsRasterMatrix::QgsRasterMatrix( const QgsRasterMatrix& m ) : mColumns( 0 ) , mRows( 0 ) - , mData( 0 ) + , mData( nullptr ) { operator=( m ); } @@ -72,7 +72,7 @@ void QgsRasterMatrix::setData( int cols, int rows, double* data, double nodataVa double* QgsRasterMatrix::takeData() { double* data = mData; - mData = 0; mColumns = 0; mRows = 0; + mData = nullptr; mColumns = 0; mRows = 0; return data; } diff --git a/src/analysis/raster/qgsrelief.cpp b/src/analysis/raster/qgsrelief.cpp index 5fb4138e8e9..12c2f113115 100644 --- a/src/analysis/raster/qgsrelief.cpp +++ b/src/analysis/raster/qgsrelief.cpp @@ -88,20 +88,20 @@ int QgsRelief::processRaster( QProgressDialog* p ) //open input file int xSize, ySize; GDALDatasetH inputDataset = openInputFile( xSize, ySize ); - if ( inputDataset == NULL ) + if ( inputDataset == nullptr ) { return 1; //opening of input file failed } //output driver GDALDriverH outputDriver = openOutputDriver(); - if ( outputDriver == 0 ) + if ( outputDriver == nullptr ) { return 2; } GDALDatasetH outputDataset = openOutputFile( inputDataset, outputDriver ); - if ( outputDataset == NULL ) + if ( outputDataset == nullptr ) { return 3; //create operation on output file failed } @@ -125,13 +125,13 @@ int QgsRelief::processRaster( QProgressDialog* p ) //open first raster band for reading (operation is only for single band raster) GDALRasterBandH rasterBand = GDALGetRasterBand( inputDataset, 1 ); - if ( rasterBand == NULL ) + if ( rasterBand == nullptr ) { GDALClose( inputDataset ); GDALClose( outputDataset ); return 4; } - mInputNodataValue = GDALGetRasterNoDataValue( rasterBand, NULL ); + mInputNodataValue = GDALGetRasterNoDataValue( rasterBand, nullptr ); mSlopeFilter->setInputNodataValue( mInputNodataValue ); mAspectFilter->setInputNodataValue( mInputNodataValue ); mHillshadeFilter285->setInputNodataValue( mInputNodataValue ); @@ -142,7 +142,7 @@ int QgsRelief::processRaster( QProgressDialog* p ) GDALRasterBandH outputGreenBand = GDALGetRasterBand( outputDataset, 2 ); GDALRasterBandH outputBlueBand = GDALGetRasterBand( outputDataset, 3 ); - if ( outputRedBand == NULL || outputGreenBand == NULL || outputBlueBand == NULL ) + if ( outputRedBand == nullptr || outputGreenBand == nullptr || outputBlueBand == nullptr ) { GDALClose( inputDataset ); GDALClose( outputDataset ); @@ -152,7 +152,7 @@ int QgsRelief::processRaster( QProgressDialog* p ) GDALSetRasterNoDataValue( outputRedBand, -9999 ); GDALSetRasterNoDataValue( outputGreenBand, -9999 ); GDALSetRasterNoDataValue( outputBlueBand, -9999 ); - mOutputNodataValue = GDALGetRasterNoDataValue( outputRedBand, NULL ); + mOutputNodataValue = GDALGetRasterNoDataValue( outputRedBand, nullptr ); mSlopeFilter->setOutputNodataValue( mOutputNodataValue ); mAspectFilter->setOutputNodataValue( mOutputNodataValue ); mHillshadeFilter285->setOutputNodataValue( mOutputNodataValue ); @@ -398,7 +398,7 @@ bool QgsRelief::setElevationColor( double elevation, int* red, int* green, int* GDALDatasetH QgsRelief::openInputFile( int& nCellsX, int& nCellsY ) { GDALDatasetH inputDataset = GDALOpen( TO8F( mInputFile ), GA_ReadOnly ); - if ( inputDataset != NULL ) + if ( inputDataset != nullptr ) { nCellsX = GDALGetRasterXSize( inputDataset ); nCellsY = GDALGetRasterYSize( inputDataset ); @@ -407,7 +407,7 @@ GDALDatasetH QgsRelief::openInputFile( int& nCellsX, int& nCellsY ) if ( GDALGetRasterCount( inputDataset ) < 1 ) { GDALClose( inputDataset ); - return NULL; + return nullptr; } } return inputDataset; @@ -420,15 +420,15 @@ GDALDriverH QgsRelief::openOutputDriver() //open driver GDALDriverH outputDriver = GDALGetDriverByName( mOutputFormat.toLocal8Bit().data() ); - if ( outputDriver == NULL ) + if ( outputDriver == nullptr ) { return outputDriver; //return NULL, driver does not exist } - driverMetadata = GDALGetMetadata( outputDriver, NULL ); + driverMetadata = GDALGetMetadata( outputDriver, nullptr ); if ( !CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE, false ) ) { - return NULL; //driver exist, but it does not support the create operation + return nullptr; //driver exist, but it does not support the create operation } return outputDriver; @@ -436,23 +436,23 @@ GDALDriverH QgsRelief::openOutputDriver() GDALDatasetH QgsRelief::openOutputFile( GDALDatasetH inputDataset, GDALDriverH outputDriver ) { - if ( inputDataset == NULL ) + if ( inputDataset == nullptr ) { - return NULL; + return nullptr; } int xSize = GDALGetRasterXSize( inputDataset ); int ySize = GDALGetRasterYSize( inputDataset ); //open output file - char **papszOptions = NULL; + char **papszOptions = nullptr; //use PACKBITS compression for tiffs by default papszOptions = CSLSetNameValue( papszOptions, "COMPRESS", "PACKBITS" ); //create three band raster (reg, green, blue) GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), xSize, ySize, 3, GDT_Byte, papszOptions ); - if ( outputDataset == NULL ) + if ( outputDataset == nullptr ) { return outputDataset; } @@ -462,7 +462,7 @@ GDALDatasetH QgsRelief::openOutputFile( GDALDatasetH inputDataset, GDALDriverH o if ( GDALGetGeoTransform( inputDataset, geotransform ) != CE_None ) { GDALClose( outputDataset ); - return NULL; + return nullptr; } GDALSetGeoTransform( outputDataset, geotransform ); @@ -489,14 +489,14 @@ bool QgsRelief::exportFrequencyDistributionToCsv( const QString& file ) { int nCellsX, nCellsY; GDALDatasetH inputDataset = openInputFile( nCellsX, nCellsY ); - if ( inputDataset == NULL ) + if ( inputDataset == nullptr ) { return false; } //open first raster band for reading (elevation raster is always single band) GDALRasterBandH elevationBand = GDALGetRasterBand( inputDataset, 1 ); - if ( elevationBand == NULL ) + if ( elevationBand == nullptr ) { GDALClose( inputDataset ); return false; @@ -572,14 +572,14 @@ QList< QgsRelief::ReliefColor > QgsRelief::calculateOptimizedReliefClasses() int nCellsX, nCellsY; GDALDatasetH inputDataset = openInputFile( nCellsX, nCellsY ); - if ( inputDataset == NULL ) + if ( inputDataset == nullptr ) { return resultList; } //open first raster band for reading (elevation raster is always single band) GDALRasterBandH elevationBand = GDALGetRasterBand( inputDataset, 1 ); - if ( elevationBand == NULL ) + if ( elevationBand == nullptr ) { GDALClose( inputDataset ); return resultList; diff --git a/src/analysis/vector/qgsgeometryanalyzer.cpp b/src/analysis/vector/qgsgeometryanalyzer.cpp index 8498e57a6f9..d7616db0ad9 100644 --- a/src/analysis/vector/qgsgeometryanalyzer.cpp +++ b/src/analysis/vector/qgsgeometryanalyzer.cpp @@ -128,7 +128,7 @@ void QgsGeometryAnalyzer::simplifyFeature( QgsFeature& f, QgsVectorFileWriter* v } const QgsGeometry* featureGeometry = f.constGeometry(); - QgsGeometry* tmpGeometry = 0; + QgsGeometry* tmpGeometry = nullptr; // simplify feature tmpGeometry = featureGeometry->simplify( tolerance ); @@ -245,7 +245,7 @@ void QgsGeometryAnalyzer::centroidFeature( QgsFeature& f, QgsVectorFileWriter* v } const QgsGeometry* featureGeometry = f.constGeometry(); - QgsGeometry* tmpGeometry = 0; + QgsGeometry* tmpGeometry = nullptr; tmpGeometry = featureGeometry->centroid(); @@ -391,7 +391,7 @@ bool QgsGeometryAnalyzer::convexHull( QgsVectorLayer* layer, const QString& shap QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), fields, outputType, &crs ); QgsFeature currentFeature; - QgsGeometry* dissolveGeometry = 0; //dissolve geometry + QgsGeometry* dissolveGeometry = nullptr; //dissolve geometry QMultiMap map; if ( onlySelectedFeatures ) @@ -552,8 +552,8 @@ void QgsGeometryAnalyzer::convexFeature( QgsFeature& f, int nProcessedFeatures, } const QgsGeometry* featureGeometry = f.constGeometry(); - QgsGeometry* tmpGeometry = 0; - QgsGeometry* convexGeometry = 0; + QgsGeometry* tmpGeometry = nullptr; + QgsGeometry* convexGeometry = nullptr; convexGeometry = featureGeometry->convexHull(); @@ -622,7 +622,7 @@ bool QgsGeometryAnalyzer::dissolve( QgsVectorLayer* layer, const QString& shapef } } - QgsGeometry *dissolveGeometry = 0; //dissolve geometry + QgsGeometry *dissolveGeometry = nullptr; //dissolve geometry QMultiMap::const_iterator jt = map.constBegin(); QgsFeature outputFeature; while ( jt != map.constEnd() ) @@ -750,7 +750,7 @@ bool QgsGeometryAnalyzer::buffer( QgsVectorLayer* layer, const QString& shapefil QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), layer->fields(), outputType, &crs ); QgsFeature currentFeature; - QgsGeometry *dissolveGeometry = 0; //dissolve geometry (if dissolve enabled) + QgsGeometry *dissolveGeometry = nullptr; //dissolve geometry (if dissolve enabled) //take only selection if ( onlySelectedFeatures ) @@ -843,8 +843,8 @@ void QgsGeometryAnalyzer::bufferFeature( QgsFeature& f, int nProcessedFeatures, double currentBufferDistance; const QgsGeometry* featureGeometry = f.constGeometry(); - QgsGeometry* tmpGeometry = 0; - QgsGeometry* bufferGeometry = 0; + QgsGeometry* tmpGeometry = nullptr; + QgsGeometry* bufferGeometry = nullptr; //create buffer if ( bufferDistanceField == -1 ) @@ -904,7 +904,7 @@ bool QgsGeometryAnalyzer::eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer* } //create output datasource or attributes in memory provider - QgsVectorFileWriter* fileWriter = 0; + QgsVectorFileWriter* fileWriter = nullptr; QgsFeatureList memoryProviderFeatures; if ( !memoryProvider ) { @@ -931,7 +931,7 @@ bool QgsGeometryAnalyzer::eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer* //iterate over eventLayer and write new features to output file or layer fit = eventLayer->getFeatures( QgsFeatureRequest().setFlags( QgsFeatureRequest::NoGeometry ) ); - QgsGeometry* lrsGeom = 0; + QgsGeometry* lrsGeom = nullptr; double measure1, measure2 = 0.0; int nEventFeatures = eventLayer->featureCount(); @@ -1128,7 +1128,7 @@ bool QgsGeometryAnalyzer::createOffsetGeometry( QgsGeometry* geom, QgsGeometry* { geomArray[i] = outputGeomList.at( i ); } - GEOSGeometry* collection = 0; + GEOSGeometry* collection = nullptr; if ( geom->type() == QGis::Point ) { collection = GEOSGeom_createCollection_r( geosctxt, GEOS_MULTIPOINT, geomArray, outputGeomList.size() ); @@ -1172,7 +1172,7 @@ QgsGeometry* QgsGeometryAnalyzer::locateBetweenMeasures( double fromMeasure, dou { if ( !lineGeom ) { - return 0; + return nullptr; } QgsMultiPolyline resultGeom; @@ -1187,7 +1187,7 @@ QgsGeometry* QgsGeometryAnalyzer::locateBetweenMeasures( double fromMeasure, dou if ( wkbType != QGis::WKBLineString25D && wkbType != QGis::WKBMultiLineString25D ) { - return 0; + return nullptr; } if ( wkbType == QGis::WKBLineString25D ) @@ -1207,7 +1207,7 @@ QgsGeometry* QgsGeometryAnalyzer::locateBetweenMeasures( double fromMeasure, dou if ( resultGeom.size() < 1 ) { - return 0; + return nullptr; } return QgsGeometry::fromMultiPolyline( resultGeom ); } @@ -1216,7 +1216,7 @@ QgsGeometry* QgsGeometryAnalyzer::locateAlongMeasure( double measure, const QgsG { if ( !lineGeom ) { - return 0; + return nullptr; } QgsMultiPoint resultGeom; @@ -1231,7 +1231,7 @@ QgsGeometry* QgsGeometryAnalyzer::locateAlongMeasure( double measure, const QgsG if ( wkbType != QGis::WKBLineString25D && wkbType != QGis::WKBMultiLineString25D ) { - return 0; + return nullptr; } if ( wkbType == QGis::WKBLineString25D ) @@ -1251,7 +1251,7 @@ QgsGeometry* QgsGeometryAnalyzer::locateAlongMeasure( double measure, const QgsG if ( resultGeom.size() < 1 ) { - return 0; + return nullptr; } return QgsGeometry::fromMultiPoint( resultGeom ); } diff --git a/src/analysis/vector/qgsgeometryanalyzer.h b/src/analysis/vector/qgsgeometryanalyzer.h index 46ecee2711e..99fea242cef 100644 --- a/src/analysis/vector/qgsgeometryanalyzer.h +++ b/src/analysis/vector/qgsgeometryanalyzer.h @@ -45,7 +45,7 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer @param p progress dialog (or 0 if no progress dialog is to be shown) */ bool simplify( QgsVectorLayer* layer, const QString& shapefileName, double tolerance, - bool onlySelectedFeatures = false, QProgressDialog* p = 0 ); + bool onlySelectedFeatures = false, QProgressDialog* p = nullptr ); /** Calculate the true centroids, or 'center of mass' for a vector layer and write it to a new shape file @@ -55,7 +55,7 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer @param p progress dialog (or 0 if no progress dialog is to be shown) */ bool centroids( QgsVectorLayer* layer, const QString& shapefileName, - bool onlySelectedFeatures = false, QProgressDialog* p = 0 ); + bool onlySelectedFeatures = false, QProgressDialog* p = nullptr ); /** Create a polygon based on the extent of all (selected) features and write it to a new shape file @param layer input vector layer @@ -63,7 +63,7 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer @param onlySelectedFeatures if true, only selected features are considered, else all the features @param p progress dialog (or 0 if no progress dialog is to be shown) */ - bool extent( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false, QProgressDialog* p = 0 ); + bool extent( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false, QProgressDialog* p = nullptr ); /** Create buffers for a vector layer and write it to a new shape file @param layer input vector layer @@ -75,7 +75,7 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer @param p progress dialog (or 0 if no progress dialog is to be shown) */ bool buffer( QgsVectorLayer* layer, const QString& shapefileName, double bufferDistance, - bool onlySelectedFeatures = false, bool dissolve = false, int bufferDistanceField = -1, QProgressDialog* p = 0 ); + bool onlySelectedFeatures = false, bool dissolve = false, int bufferDistanceField = -1, QProgressDialog* p = nullptr ); /** Create convex hull(s) of a vector layer and write it to a new shape file @param layer input vector layer @@ -86,7 +86,7 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer @param p progress dialog (or 0 if no progress dialog is to be shown) */ bool convexHull( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false, - int uniqueIdField = -1, QProgressDialog* p = 0 ); + int uniqueIdField = -1, QProgressDialog* p = nullptr ); /** Dissolve a vector layer and write it to a new shape file @param layer input vector layer @@ -97,7 +97,7 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer @param p progress dialog (or 0 if no progress dialog is to be shown) */ bool dissolve( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false, - int uniqueIdField = -1, QProgressDialog* p = 0 ); + int uniqueIdField = -1, QProgressDialog* p = nullptr ); /** Creates an event layer (multipoint or multiline) by locating features from a (non-spatial) event table along the features of a line layer. Note that currently (until QgsGeometry supports m-values) the z-coordinate of the line layer is used for linear referencing @@ -118,7 +118,7 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer */ bool eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer* eventLayer, int lineField, int eventField, QgsFeatureIds &unlocatedFeatureIds, const QString& outputLayer, const QString& outputFormat, int locationField1, int locationField2 = -1, int offsetField = -1, double offsetScale = 1.0, - bool forceSingleGeometry = false, QgsVectorDataProvider* memoryProvider = 0, QProgressDialog* p = 0 ); + bool forceSingleGeometry = false, QgsVectorDataProvider* memoryProvider = nullptr, QProgressDialog* p = nullptr ); /** Returns linear reference geometry as a multiline (or 0 if no match). Currently, the z-coordinates are considered to be the measures (no support for m-values in QGIS)*/ QgsGeometry* locateBetweenMeasures( double fromMeasure, double toMeasure, const QgsGeometry *lineGeom ); diff --git a/src/analysis/vector/qgsoverlayanalyzer.cpp b/src/analysis/vector/qgsoverlayanalyzer.cpp index 29ce4ed9386..4ec18c3fc40 100644 --- a/src/analysis/vector/qgsoverlayanalyzer.cpp +++ b/src/analysis/vector/qgsoverlayanalyzer.cpp @@ -148,7 +148,7 @@ void QgsOverlayAnalyzer::intersectFeature( QgsFeature& f, QgsVectorFileWriter* v } const QgsGeometry* featureGeometry = f.constGeometry(); - QgsGeometry* intersectGeometry = 0; + QgsGeometry* intersectGeometry = nullptr; QgsFeature overlayFeature; QList intersects; diff --git a/src/analysis/vector/qgsoverlayanalyzer.h b/src/analysis/vector/qgsoverlayanalyzer.h index 312c4a95341..68db0fb8684 100644 --- a/src/analysis/vector/qgsoverlayanalyzer.h +++ b/src/analysis/vector/qgsoverlayanalyzer.h @@ -46,7 +46,7 @@ class ANALYSIS_EXPORT QgsOverlayAnalyzer */ bool intersection( QgsVectorLayer* layerA, QgsVectorLayer* layerB, const QString& shapefileName, bool onlySelectedFeatures = false, - QProgressDialog* p = 0 ); + QProgressDialog* p = nullptr ); private: diff --git a/src/analysis/vector/qgspointsample.cpp b/src/analysis/vector/qgspointsample.cpp index 439cb6b8606..bda8edcd2a9 100644 --- a/src/analysis/vector/qgspointsample.cpp +++ b/src/analysis/vector/qgspointsample.cpp @@ -13,7 +13,7 @@ QgsPointSample::QgsPointSample( QgsVectorLayer* inputLayer, const QString& outpu } QgsPointSample::QgsPointSample() - : mInputLayer( NULL ) + : mInputLayer( nullptr ) , mNCreatedPoints( 0 ) { } diff --git a/src/analysis/vector/qgstransectsample.cpp b/src/analysis/vector/qgstransectsample.cpp index 8b616c6737a..7c324b7d96a 100644 --- a/src/analysis/vector/qgstransectsample.cpp +++ b/src/analysis/vector/qgstransectsample.cpp @@ -23,8 +23,8 @@ QgsTransectSample::QgsTransectSample( QgsVectorLayer* strataLayer, const QString } QgsTransectSample::QgsTransectSample() - : mStrataLayer( NULL ) - , mBaselineLayer( NULL ) + : mStrataLayer( nullptr ) + , mBaselineLayer( nullptr ) , mShareBaseline( false ) , mMinDistanceUnits( Meters ) , mMinTransectLength( 0.0 ) @@ -330,7 +330,7 @@ QgsGeometry* QgsTransectSample::findBaselineGeometry( const QVariant& strataId ) { if ( !mBaselineLayer ) { - return 0; + return nullptr; } QgsFeatureIterator baseLineIt = mBaselineLayer->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( QStringList( mBaselineStrataId ), mBaselineLayer->fields() ) ); @@ -345,7 +345,7 @@ QgsGeometry* QgsTransectSample::findBaselineGeometry( const QVariant& strataId ) Q_NOWARN_DEPRECATED_POP } } - return 0; + return nullptr; } bool QgsTransectSample::otherTransectWithinDistance( QgsGeometry* geom, double minDistLayerUnit, double minDistance, QgsSpatialIndex& sIndex, @@ -514,12 +514,12 @@ QgsGeometry* QgsTransectSample::closestMultilineElement( const QgsPoint& pt, Qgs if ( !multiLine || ( multiLine->wkbType() != QGis::WKBMultiLineString && multiLine->wkbType() != QGis::WKBMultiLineString25D ) ) { - return 0; + return nullptr; } double minDist = DBL_MAX; double currentDist = 0; - QgsGeometry* currentLine = 0; + QgsGeometry* currentLine = nullptr; QScopedPointer closestLine; QgsGeometry* pointGeom = QgsGeometry::fromPoint( pt ); @@ -548,7 +548,7 @@ QgsGeometry* QgsTransectSample::clipBufferLine( const QgsGeometry* stratumGeom, { if ( !stratumGeom || !clippedBaseline || clippedBaseline->wkbType() == QGis::WKBUnknown ) { - return 0; + return nullptr; } QgsGeometry* usedBaseline = clippedBaseline; @@ -558,7 +558,7 @@ QgsGeometry* QgsTransectSample::clipBufferLine( const QgsGeometry* stratumGeom, usedBaseline = clippedBaseline->simplify( mBaselineSimplificationTolerance ); if ( !usedBaseline ) { - return 0; + return nullptr; } //int verticesAfter = usedBaseline->asMultiPolyline().count(); @@ -582,8 +582,8 @@ QgsGeometry* QgsTransectSample::clipBufferLine( const QgsGeometry* stratumGeom, } //it is also possible that clipBaselineBuffer is a multipolygon - QgsGeometry* bufferLine = 0; //buffer line or multiline - QgsGeometry* bufferLineClipped = 0; + QgsGeometry* bufferLine = nullptr; //buffer line or multiline + QgsGeometry* bufferLineClipped = nullptr; QgsMultiPolyline mpl; if ( clipBaselineBuffer->isMultipart() ) { @@ -665,7 +665,7 @@ QgsGeometry* QgsTransectSample::clipBufferLine( const QgsGeometry* stratumGeom, { delete usedBaseline; } - return 0; //no solution found even with reduced tolerances + return nullptr; //no solution found even with reduced tolerances } double QgsTransectSample::bufferDistance( double minDistanceFromAttribute ) const diff --git a/src/analysis/vector/qgszonalstatistics.cpp b/src/analysis/vector/qgszonalstatistics.cpp index 3192f6dd3cc..bf7dcd1c9fa 100644 --- a/src/analysis/vector/qgszonalstatistics.cpp +++ b/src/analysis/vector/qgszonalstatistics.cpp @@ -44,7 +44,7 @@ QgsZonalStatistics::QgsZonalStatistics( QgsVectorLayer* polygonLayer, const QStr QgsZonalStatistics::QgsZonalStatistics() : mRasterBand( 0 ) - , mPolygonLayer( 0 ) + , mPolygonLayer( nullptr ) , mInputNodataValue( -1 ) , mStatistics( QgsZonalStatistics::All ) { @@ -72,7 +72,7 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p ) //open the raster layer and the raster band GDALAllRegister(); GDALDatasetH inputDataset = GDALOpen( TO8F( mRasterFilePath ), GA_ReadOnly ); - if ( inputDataset == NULL ) + if ( inputDataset == nullptr ) { return 3; } @@ -84,12 +84,12 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p ) } GDALRasterBandH rasterBand = GDALGetRasterBand( inputDataset, mRasterBand ); - if ( rasterBand == NULL ) + if ( rasterBand == nullptr ) { GDALClose( inputDataset ); return 5; } - mInputNodataValue = GDALGetRasterNoDataValue( rasterBand, NULL ); + mInputNodataValue = GDALGetRasterNoDataValue( rasterBand, nullptr ); //get geometry info about raster layer int nCellsXGDAL = GDALGetRasterXSize( inputDataset ); @@ -431,8 +431,8 @@ void QgsZonalStatistics::statisticsFromMiddlePointTest( void* band, const QgsGeo return; } - GEOSCoordSequence* cellCenterCoords = 0; - GEOSGeometry* currentCellCenter = 0; + GEOSCoordSequence* cellCenterCoords = nullptr; + GEOSGeometry* currentCellCenter = nullptr; for ( int i = 0; i < nCellsY; ++i ) { @@ -472,7 +472,7 @@ void QgsZonalStatistics::statisticsFromPreciseIntersection( void* band, const Qg double currentY = rasterBBox.yMaximum() - pixelOffsetY * cellSizeY - cellSizeY / 2; float* pixelData = ( float * ) CPLMalloc( sizeof( float ) ); - QgsGeometry* pixelRectGeometry = 0; + QgsGeometry* pixelRectGeometry = nullptr; double hCellSizeX = cellSizeX / 2.0; double hCellSizeY = cellSizeY / 2.0; @@ -504,7 +504,7 @@ void QgsZonalStatistics::statisticsFromPreciseIntersection( void* band, const Qg delete intersectGeometry; } delete pixelRectGeometry; - pixelRectGeometry = 0; + pixelRectGeometry = nullptr; } currentX += cellSizeX; } diff --git a/src/app/composer/qgsatlascompositionwidget.cpp b/src/app/composer/qgsatlascompositionwidget.cpp index 18d66db7c18..d0ea07783e3 100644 --- a/src/app/composer/qgsatlascompositionwidget.cpp +++ b/src/app/composer/qgsatlascompositionwidget.cpp @@ -95,7 +95,7 @@ void QgsAtlasCompositionWidget::changeCoverageLayer( QgsMapLayer *layer ) if ( !vl ) { - atlasMap->setCoverageLayer( 0 ); + atlasMap->setCoverageLayer( nullptr ); } else { @@ -227,7 +227,7 @@ void QgsAtlasCompositionWidget::updateAtlasFeatures() bool updated = atlasMap->updateFeatures(); if ( !updated ) { - QMessageBox::warning( 0, tr( "Atlas preview" ), + QMessageBox::warning( nullptr, tr( "Atlas preview" ), tr( "No matching atlas features found!" ), QMessageBox::Ok, QMessageBox::Ok ); diff --git a/src/app/composer/qgsattributeselectiondialog.cpp b/src/app/composer/qgsattributeselectiondialog.cpp index 76fc372ec85..0e4fdc5d1ab 100644 --- a/src/app/composer/qgsattributeselectiondialog.cpp +++ b/src/app/composer/qgsattributeselectiondialog.cpp @@ -273,18 +273,18 @@ QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( QgsComposerAttributeTa QWidget* parent, Qt::WindowFlags f ) : QDialog( parent, f ) , mComposerTable( table ) - , mComposerTableV1( NULL ) + , mComposerTableV1( nullptr ) , mVectorLayer( vLayer ) - , mColumnModel( NULL ) - , mColumnModelV1( NULL ) - , mSortedProxyModel( NULL ) - , mSortedProxyModelV1( NULL ) - , mAvailableSortProxyModel( NULL ) - , mAvailableSortProxyModelV1( NULL ) - , mColumnAlignmentDelegate( NULL ) - , mColumnSourceDelegate( NULL ) - , mColumnSortOrderDelegate( NULL ) - , mColumnWidthDelegate( NULL ) + , mColumnModel( nullptr ) + , mColumnModelV1( nullptr ) + , mSortedProxyModel( nullptr ) + , mSortedProxyModelV1( nullptr ) + , mAvailableSortProxyModel( nullptr ) + , mAvailableSortProxyModelV1( nullptr ) + , mColumnAlignmentDelegate( nullptr ) + , mColumnSourceDelegate( nullptr ) + , mColumnSortOrderDelegate( nullptr ) + , mColumnWidthDelegate( nullptr ) { setupUi( this ); @@ -327,19 +327,19 @@ QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( QgsComposerAttributeTa QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( QgsComposerAttributeTable *table, QgsVectorLayer *vLayer, QWidget *parent, Qt::WindowFlags f ) : QDialog( parent, f ) - , mComposerTable( NULL ) + , mComposerTable( nullptr ) , mComposerTableV1( table ) , mVectorLayer( vLayer ) - , mColumnModel( NULL ) - , mColumnModelV1( NULL ) - , mSortedProxyModel( NULL ) - , mSortedProxyModelV1( NULL ) - , mAvailableSortProxyModel( NULL ) - , mAvailableSortProxyModelV1( NULL ) - , mColumnAlignmentDelegate( NULL ) - , mColumnSourceDelegate( NULL ) - , mColumnSortOrderDelegate( NULL ) - , mColumnWidthDelegate( NULL ) + , mColumnModel( nullptr ) + , mColumnModelV1( nullptr ) + , mSortedProxyModel( nullptr ) + , mSortedProxyModelV1( nullptr ) + , mAvailableSortProxyModel( nullptr ) + , mAvailableSortProxyModelV1( nullptr ) + , mColumnAlignmentDelegate( nullptr ) + , mColumnSourceDelegate( nullptr ) + , mColumnSortOrderDelegate( nullptr ) + , mColumnWidthDelegate( nullptr ) { setupUi( this ); @@ -532,7 +532,7 @@ void QgsAttributeSelectionDialog::on_mRemoveSortColumnPushButton_clicked() int rowToRemove = selectedIndex.row(); //find corresponding column - QgsComposerTableColumn * column = 0; + QgsComposerTableColumn * column = nullptr; if ( mComposerTable ) { column = mSortedProxyModel->columnFromIndex( selectedIndex ); diff --git a/src/app/composer/qgsattributeselectiondialog.h b/src/app/composer/qgsattributeselectiondialog.h index 9ad3cf9f627..2f8874d73a8 100644 --- a/src/app/composer/qgsattributeselectiondialog.h +++ b/src/app/composer/qgsattributeselectiondialog.h @@ -44,7 +44,7 @@ class QgsComposerColumnAlignmentDelegate : public QItemDelegate Q_OBJECT public: - explicit QgsComposerColumnAlignmentDelegate( QObject *parent = 0 ); + explicit QgsComposerColumnAlignmentDelegate( QObject *parent = nullptr ); QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; void setEditorData( QWidget *editor, const QModelIndex &index ) const override; void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override; @@ -61,7 +61,7 @@ class QgsComposerColumnSourceDelegate : public QItemDelegate Q_OBJECT public: - QgsComposerColumnSourceDelegate( QgsVectorLayer* vlayer, QObject *parent = 0, const QgsComposerObject* composerObject = 0 ); + QgsComposerColumnSourceDelegate( QgsVectorLayer* vlayer, QObject *parent = nullptr, const QgsComposerObject* composerObject = nullptr ); QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; void setEditorData( QWidget *editor, const QModelIndex &index ) const override; void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override; @@ -81,7 +81,7 @@ class QgsComposerColumnWidthDelegate : public QItemDelegate Q_OBJECT public: - explicit QgsComposerColumnWidthDelegate( QObject *parent = 0 ); + explicit QgsComposerColumnWidthDelegate( QObject *parent = nullptr ); QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; void setEditorData( QWidget *editor, const QModelIndex &index ) const override; void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override; @@ -98,7 +98,7 @@ class QgsComposerColumnSortOrderDelegate : public QItemDelegate Q_OBJECT public: - explicit QgsComposerColumnSortOrderDelegate( QObject *parent = 0 ); + explicit QgsComposerColumnSortOrderDelegate( QObject *parent = nullptr ); QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; void setEditorData( QWidget *editor, const QModelIndex &index ) const override; void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override; @@ -114,10 +114,10 @@ class QgsAttributeSelectionDialog: public QDialog, private Ui::QgsAttributeSelec { Q_OBJECT public: - QgsAttributeSelectionDialog( QgsComposerAttributeTableV2* table, QgsVectorLayer* vLayer, QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsAttributeSelectionDialog( QgsComposerAttributeTableV2* table, QgsVectorLayer* vLayer, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); //todo - remove for QGIS 3.0 - QgsAttributeSelectionDialog( QgsComposerAttributeTable* table, QgsVectorLayer* vLayer, QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsAttributeSelectionDialog( QgsComposerAttributeTable* table, QgsVectorLayer* vLayer, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsAttributeSelectionDialog(); diff --git a/src/app/composer/qgscomposer.cpp b/src/app/composer/qgscomposer.cpp index b5a70ef2150..46af22ea8a5 100644 --- a/src/app/composer/qgscomposer.cpp +++ b/src/app/composer/qgscomposer.cpp @@ -107,10 +107,10 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title ) : QMainWindow() , mTitle( title ) , mQgis( qgis ) - , mPrinter( 0 ) + , mPrinter( nullptr ) , mSetPageOrientation( false ) - , mUndoView( 0 ) - , mAtlasFeatureAction( 0 ) + , mUndoView( nullptr ) + , mAtlasFeatureAction( nullptr ) { setupUi( this ); setWindowTitle( mTitle ); @@ -455,7 +455,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title ) mStatusZoomCombo = new QComboBox( mStatusBar ); mStatusZoomCombo->setEditable( true ); mStatusZoomCombo->setInsertPolicy( QComboBox::NoInsert ); - mStatusZoomCombo->setCompleter( 0 ); + mStatusZoomCombo->setCompleter( nullptr ); mStatusZoomCombo->setMinimumWidth( 100 ); //zoom combo box accepts decimals in the range 1-9999, with an optional decimal point and "%" sign QRegExp zoomRx( "\\s*\\d{1,4}(\\.\\d?)?\\s*%?" ); @@ -494,7 +494,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title ) mStatusBar->addWidget( mStatusAtlasLabel ); //create composer view and layout with rulers - mView = 0; + mView = nullptr; mViewLayout = new QGridLayout(); mViewLayout->setSpacing( 0 ); mViewLayout->setMargin( 0 ); @@ -951,7 +951,7 @@ void QgsComposer::showItemOptions( QgsComposerItem* item ) if ( !item ) { - mItemDock->setWidget( 0 ); + mItemDock->setWidget( nullptr ); return; } @@ -1052,7 +1052,7 @@ void QgsComposer::on_mActionAtlasPreview_triggered( bool checked ) if ( checked && !atlasMap->enabled() ) { //no atlas current enabled - QMessageBox::warning( 0, tr( "Enable atlas preview" ), + QMessageBox::warning( nullptr, tr( "Enable atlas preview" ), tr( "Atlas in not currently enabled for this composition!" ), QMessageBox::Ok, QMessageBox::Ok ); @@ -1079,7 +1079,7 @@ void QgsComposer::on_mActionAtlasPreview_triggered( bool checked ) if ( !previewEnabled ) { //something went wrong, eg, no matching features - QMessageBox::warning( 0, tr( "Enable atlas preview" ), + QMessageBox::warning( nullptr, tr( "Enable atlas preview" ), tr( "No matching atlas features found!" ), QMessageBox::Ok, QMessageBox::Ok ); @@ -1643,7 +1643,7 @@ void QgsComposer::exportCompositionAsPDF( QgsComposer::OutputMode mode ) { if ( atlasMap->filenamePattern().isEmpty() ) { - int res = QMessageBox::warning( 0, tr( "Empty filename pattern" ), + int res = QMessageBox::warning( nullptr, tr( "Empty filename pattern" ), tr( "The filename pattern is empty. A default one will be used." ), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok ); @@ -1667,7 +1667,7 @@ void QgsComposer::exportCompositionAsPDF( QgsComposer::OutputMode mode ) // test directory (if it exists and is writable) if ( !QDir( outputDir ).exists() || !QFileInfo( outputDir ).isWritable() ) { - QMessageBox::warning( 0, tr( "Unable to write into the directory" ), + QMessageBox::warning( nullptr, tr( "Unable to write into the directory" ), tr( "The given output directory is not writable. Cancelling." ), QMessageBox::Ok, QMessageBox::Ok ); @@ -1845,7 +1845,7 @@ void QgsComposer::printComposition( QgsComposer::OutputMode mode ) //set printer page orientation setPrinterPageOrientation(); - QPrintDialog printDialog( printer(), 0 ); + QPrintDialog printDialog( printer(), nullptr ); if ( printDialog.exec() != QDialog::Accepted ) { return; @@ -1965,7 +1965,7 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode ) if ( memuse > 200 ) // about 4500x4500 { - int answer = QMessageBox::warning( 0, tr( "Big image" ), + int answer = QMessageBox::warning( nullptr, tr( "Big image" ), tr( "To create image %1x%2 requires about %3 MB of memory. Proceed?" ) .arg( width ).arg( height ).arg( memuse ), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok ); @@ -2070,7 +2070,7 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode ) if ( image.isNull() ) { - QMessageBox::warning( 0, tr( "Memory Allocation Error" ), + QMessageBox::warning( nullptr, tr( "Memory Allocation Error" ), tr( "Trying to create image #%1( %2x%3 @ %4dpi ) " "may result in a memory overflow.\n" "Please try a lower resolution or a smaller papersize" ) @@ -2129,7 +2129,7 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode ) // else, it has an atlas to render, so a directory must first be selected if ( atlasMap->filenamePattern().isEmpty() ) { - int res = QMessageBox::warning( 0, tr( "Empty filename pattern" ), + int res = QMessageBox::warning( nullptr, tr( "Empty filename pattern" ), tr( "The filename pattern is empty. A default one will be used." ), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok ); @@ -2194,7 +2194,7 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode ) // test directory (if it exists and is writable) if ( !QDir( dir ).exists() || !QFileInfo( dir ).isWritable() ) { - QMessageBox::warning( 0, tr( "Unable to write into the directory" ), + QMessageBox::warning( nullptr, tr( "Unable to write into the directory" ), tr( "The given output directory is not writable. Cancelling." ), QMessageBox::Ok, QMessageBox::Ok ); @@ -2486,7 +2486,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode ) // If we have an Atlas if ( atlasMap->filenamePattern().isEmpty() ) { - int res = QMessageBox::warning( 0, tr( "Empty filename pattern" ), + int res = QMessageBox::warning( nullptr, tr( "Empty filename pattern" ), tr( "The filename pattern is empty. A default one will be used." ), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok ); @@ -2513,7 +2513,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode ) // test directory (if it exists and is writable) if ( !QDir( outputDir ).exists() || !QFileInfo( outputDir ).isWritable() ) { - QMessageBox::warning( 0, tr( "Unable to write into the directory" ), + QMessageBox::warning( nullptr, tr( "Unable to write into the directory" ), tr( "The given output directory is not writable. Cancelling." ), QMessageBox::Ok, QMessageBox::Ok ); @@ -2787,7 +2787,7 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode ) QString errorMsg; int errorLine; if ( ! doc.setContent( &svgBuffer, false, &errorMsg, &errorLine ) ) - QMessageBox::warning( 0, tr( "SVG error" ), tr( "There was an error in SVG output for SVG layer " ) + layerName + tr( " on page " ) + QString::number( i + 1 ) + '(' + errorMsg + ')' ); + QMessageBox::warning( nullptr, tr( "SVG error" ), tr( "There was an error in SVG output for SVG layer " ) + layerName + tr( " on page " ) + QString::number( i + 1 ) + '(' + errorMsg + ')' ); if ( 1 == svgLayerId ) { svg = QDomDocument( doc.doctype() ); @@ -2977,7 +2977,7 @@ void QgsComposer::on_mActionDuplicateComposer_triggered() dlg->close(); delete dlg; - dlg = 0; + dlg = nullptr; if ( !newComposer ) { @@ -3031,7 +3031,7 @@ void QgsComposer::on_mActionSaveAsTemplate_triggered() if ( templateFile.write( saveDocument.toByteArray() ) == -1 ) { - QMessageBox::warning( 0, tr( "Save error" ), tr( "Error, could not save file" ) ); + QMessageBox::warning( nullptr, tr( "Save error" ), tr( "Error, could not save file" ) ); } } @@ -3044,7 +3044,7 @@ void QgsComposer::loadTemplate( const bool newComposer ) { QSettings settings; QString openFileDir = settings.value( "UI/lastComposerTemplateDir", QDir::homePath() ).toString(); - QString openFileString = QFileDialog::getOpenFileName( 0, tr( "Load template" ), openFileDir, "*.qpt" ); + QString openFileString = QFileDialog::getOpenFileName( nullptr, tr( "Load template" ), openFileDir, "*.qpt" ); if ( openFileString.isEmpty() ) { @@ -3061,8 +3061,8 @@ void QgsComposer::loadTemplate( const bool newComposer ) return; } - QgsComposer* c = 0; - QgsComposition* comp = 0; + QgsComposer* c = nullptr; + QgsComposition* comp = nullptr; if ( newComposer ) { @@ -3096,12 +3096,12 @@ void QgsComposer::loadTemplate( const bool newComposer ) dlg->show(); c->setUpdatesEnabled( false ); - comp->loadFromTemplate( templateDoc, 0, false, newComposer ); + comp->loadFromTemplate( templateDoc, nullptr, false, newComposer ); c->setUpdatesEnabled( true ); dlg->close(); delete dlg; - dlg = 0; + dlg = nullptr; } } } @@ -3538,7 +3538,7 @@ void QgsComposer::readXML( const QDomElement& composerElem, const QDomDocument& if ( mComposition->generateWorldFile() ) { QDomElement compositionElem = compositionNodeList.at( 0 ).toElement(); - QgsComposerMap* worldFileMap = 0; + QgsComposerMap* worldFileMap = nullptr; QList maps = mComposition->composerMapItems(); for ( QList::const_iterator it = maps.begin(); it != maps.end(); ++it ) { @@ -3776,8 +3776,8 @@ void QgsComposer::setSelectionTool() bool QgsComposer::containsWMSLayer() const { QMap::const_iterator item_it = mItemWidgetMap.constBegin(); - QgsComposerItem* currentItem = 0; - QgsComposerMap* currentMap = 0; + QgsComposerItem* currentItem = nullptr; + QgsComposerMap* currentMap = nullptr; for ( ; item_it != mItemWidgetMap.constEnd(); ++item_it ) { @@ -3798,8 +3798,8 @@ bool QgsComposer::containsAdvancedEffects() const { // Check if composer contains any blend modes or flattened layers for transparency QMap::const_iterator item_it = mItemWidgetMap.constBegin(); - QgsComposerItem* currentItem = 0; - QgsComposerMap* currentMap = 0; + QgsComposerItem* currentItem = nullptr; + QgsComposerMap* currentMap = nullptr; for ( ; item_it != mItemWidgetMap.constEnd(); ++item_it ) { @@ -4085,7 +4085,7 @@ void QgsComposer::updateAtlasMapLayerAction( QgsVectorLayer *coverageLayer ) if ( mAtlasFeatureAction ) { delete mAtlasFeatureAction; - mAtlasFeatureAction = 0; + mAtlasFeatureAction = nullptr; } if ( coverageLayer ) @@ -4129,7 +4129,7 @@ void QgsComposer::updateAtlasMapLayerAction( bool atlasEnabled ) if ( mAtlasFeatureAction ) { delete mAtlasFeatureAction; - mAtlasFeatureAction = 0; + mAtlasFeatureAction = nullptr; } if ( atlasEnabled ) diff --git a/src/app/composer/qgscomposerarrowwidget.cpp b/src/app/composer/qgscomposerarrowwidget.cpp index 365e216ec9c..8d46cc06b06 100644 --- a/src/app/composer/qgscomposerarrowwidget.cpp +++ b/src/app/composer/qgscomposerarrowwidget.cpp @@ -25,7 +25,7 @@ #include #include -QgsComposerArrowWidget::QgsComposerArrowWidget( QgsComposerArrow* arrow ): QgsComposerItemBaseWidget( 0, arrow ), mArrow( arrow ) +QgsComposerArrowWidget::QgsComposerArrowWidget( QgsComposerArrow* arrow ): QgsComposerItemBaseWidget( nullptr, arrow ), mArrow( arrow ) { setupUi( this ); mRadioButtonGroup = new QButtonGroup( this ); @@ -310,7 +310,7 @@ void QgsComposerArrowWidget::on_mLineStyleButton_clicked() } QgsLineSymbolV2* newSymbol = mArrow->lineSymbol()->clone(); - QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), 0, this ); + QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), nullptr, this ); d.setExpressionContext( mArrow->createExpressionContext() ); if ( d.exec() == QDialog::Accepted ) diff --git a/src/app/composer/qgscomposerattributetablewidget.cpp b/src/app/composer/qgscomposerattributetablewidget.cpp index f71930554c4..1dcbabfde88 100644 --- a/src/app/composer/qgscomposerattributetablewidget.cpp +++ b/src/app/composer/qgscomposerattributetablewidget.cpp @@ -32,7 +32,7 @@ #include "qgscomposertablebackgroundcolorsdialog.h" QgsComposerAttributeTableWidget::QgsComposerAttributeTableWidget( QgsComposerAttributeTableV2* table, QgsComposerFrame* frame ) - : QgsComposerItemBaseWidget( 0, table ) + : QgsComposerItemBaseWidget( nullptr, table ) , mComposerTable( table ) , mFrame( frame ) { diff --git a/src/app/composer/qgscomposerhtmlwidget.cpp b/src/app/composer/qgscomposerhtmlwidget.cpp index 442f4e0a7c8..a1855538610 100644 --- a/src/app/composer/qgscomposerhtmlwidget.cpp +++ b/src/app/composer/qgscomposerhtmlwidget.cpp @@ -26,7 +26,7 @@ QgsComposerHtmlWidget::QgsComposerHtmlWidget( QgsComposerHtml* html, QgsComposerFrame* frame ) - : QgsComposerItemBaseWidget( 0, html ) + : QgsComposerItemBaseWidget( nullptr, html ) , mHtml( html ) , mFrame( frame ) { @@ -80,11 +80,11 @@ QgsComposerHtmlWidget::QgsComposerHtmlWidget( QgsComposerHtml* html, QgsComposer } QgsComposerHtmlWidget::QgsComposerHtmlWidget() - : QgsComposerItemBaseWidget( 0, 0 ) - , mHtml( NULL ) - , mFrame( NULL ) - , mHtmlEditor( NULL ) - , mStylesheetEditor( NULL ) + : QgsComposerItemBaseWidget( nullptr, nullptr ) + , mHtml( nullptr ) + , mFrame( nullptr ) + , mHtmlEditor( nullptr ) + , mStylesheetEditor( nullptr ) { } diff --git a/src/app/composer/qgscomposerimageexportoptionsdialog.h b/src/app/composer/qgscomposerimageexportoptionsdialog.h index 14ec94ff964..ede40c56d64 100644 --- a/src/app/composer/qgscomposerimageexportoptionsdialog.h +++ b/src/app/composer/qgscomposerimageexportoptionsdialog.h @@ -36,7 +36,7 @@ class QgsComposerImageExportOptionsDialog: public QDialog, private Ui::QgsCompos * @param parent parent widget * @param flags window flags */ - QgsComposerImageExportOptionsDialog( QWidget* parent = 0, Qt::WindowFlags flags = 0 ); + QgsComposerImageExportOptionsDialog( QWidget* parent = nullptr, Qt::WindowFlags flags = nullptr ); ~QgsComposerImageExportOptionsDialog(); diff --git a/src/app/composer/qgscomposeritemwidget.cpp b/src/app/composer/qgscomposeritemwidget.cpp index 19ff77c8312..f0f8a5cfad6 100644 --- a/src/app/composer/qgscomposeritemwidget.cpp +++ b/src/app/composer/qgscomposeritemwidget.cpp @@ -81,14 +81,14 @@ QgsAtlasComposition* QgsComposerItemBaseWidget::atlasComposition() const { if ( !mComposerObject ) { - return 0; + return nullptr; } QgsComposition* composition = mComposerObject->composition(); if ( !composition ) { - return 0; + return nullptr; } return &composition->atlasComposition(); @@ -103,7 +103,7 @@ QgsVectorLayer* QgsComposerItemBaseWidget::atlasCoverageLayer() const return atlasMap->coverageLayer(); } - return 0; + return nullptr; } @@ -185,8 +185,8 @@ QgsComposerItemWidget::QgsComposerItemWidget( QWidget* parent, QgsComposerItem* } QgsComposerItemWidget::QgsComposerItemWidget() - : QgsComposerItemBaseWidget( 0, 0 ) - , mItem( NULL ) + : QgsComposerItemBaseWidget( nullptr, nullptr ) + , mItem( nullptr ) , mFreezeXPosSpin( false ) , mFreezeYPosSpin( false ) , mFreezeWidthSpin( false ) diff --git a/src/app/composer/qgscomposerlabelwidget.cpp b/src/app/composer/qgscomposerlabelwidget.cpp index c9d6c192dc1..bb7cac4f5b1 100644 --- a/src/app/composer/qgscomposerlabelwidget.cpp +++ b/src/app/composer/qgscomposerlabelwidget.cpp @@ -25,7 +25,7 @@ #include #include -QgsComposerLabelWidget::QgsComposerLabelWidget( QgsComposerLabel* label ): QgsComposerItemBaseWidget( 0, label ), mComposerLabel( label ) +QgsComposerLabelWidget::QgsComposerLabelWidget( QgsComposerLabel* label ): QgsComposerItemBaseWidget( nullptr, label ), mComposerLabel( label ) { setupUi( this ); diff --git a/src/app/composer/qgscomposerlegenditemdialog.cpp b/src/app/composer/qgscomposerlegenditemdialog.cpp index 90f8cf90d32..26250f7a60f 100644 --- a/src/app/composer/qgscomposerlegenditemdialog.cpp +++ b/src/app/composer/qgscomposerlegenditemdialog.cpp @@ -28,7 +28,7 @@ QgsComposerLegendItemDialog::QgsComposerLegendItemDialog( const QStandardItem* i } } -QgsComposerLegendItemDialog::QgsComposerLegendItemDialog(): QDialog( 0 ) +QgsComposerLegendItemDialog::QgsComposerLegendItemDialog(): QDialog( nullptr ) { } diff --git a/src/app/composer/qgscomposerlegenditemdialog.h b/src/app/composer/qgscomposerlegenditemdialog.h index 2527f15ba68..575fcd27d9a 100644 --- a/src/app/composer/qgscomposerlegenditemdialog.h +++ b/src/app/composer/qgscomposerlegenditemdialog.h @@ -31,7 +31,7 @@ class QgsComposerLegendItemDialog: public QDialog, private Ui::QgsComposerLegend Q_OBJECT public: - QgsComposerLegendItemDialog( const QStandardItem* item, QWidget* parent = 0 ); + QgsComposerLegendItemDialog( const QStandardItem* item, QWidget* parent = nullptr ); ~QgsComposerLegendItemDialog(); /** Returns the item text inserted by user*/ diff --git a/src/app/composer/qgscomposerlegendlayersdialog.cpp b/src/app/composer/qgscomposerlegendlayersdialog.cpp index a5cca8a51e3..67e9301ae7a 100644 --- a/src/app/composer/qgscomposerlegendlayersdialog.cpp +++ b/src/app/composer/qgscomposerlegendlayersdialog.cpp @@ -28,7 +28,7 @@ QgsComposerLegendLayersDialog::QgsComposerLegendLayersDialog( QListcurrentItem(); if ( !item ) { - return 0; + return nullptr; } QMap::iterator it = mItemLayerMap.find( item ); - QgsMapLayer* c = 0; + QgsMapLayer* c = nullptr; c = it.value(); return c; } diff --git a/src/app/composer/qgscomposerlegendlayersdialog.h b/src/app/composer/qgscomposerlegendlayersdialog.h index a23a5fc6aee..eae796ef7fc 100644 --- a/src/app/composer/qgscomposerlegendlayersdialog.h +++ b/src/app/composer/qgscomposerlegendlayersdialog.h @@ -26,7 +26,7 @@ class QgsComposerLegendLayersDialog: public QDialog, private Ui::QgsComposerLege Q_OBJECT public: - QgsComposerLegendLayersDialog( QList layers, QWidget* parent = 0 ); + QgsComposerLegendLayersDialog( QList layers, QWidget* parent = nullptr ); ~QgsComposerLegendLayersDialog(); QgsMapLayer* selectedLayer(); diff --git a/src/app/composer/qgscomposerlegendwidget.cpp b/src/app/composer/qgscomposerlegendwidget.cpp index b51b3ac25db..4aaf7608740 100644 --- a/src/app/composer/qgscomposerlegendwidget.cpp +++ b/src/app/composer/qgscomposerlegendwidget.cpp @@ -44,7 +44,7 @@ QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend ) - : QgsComposerItemBaseWidget( 0, legend ) + : QgsComposerItemBaseWidget( nullptr, legend ) , mLegend( legend ) { setupUi( this ); @@ -88,7 +88,7 @@ QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend ) this, SLOT( selectedChanged( const QModelIndex &, const QModelIndex & ) ) ); } -QgsComposerLegendWidget::QgsComposerLegendWidget(): QgsComposerItemBaseWidget( 0, 0 ), mLegend( 0 ) +QgsComposerLegendWidget::QgsComposerLegendWidget(): QgsComposerItemBaseWidget( nullptr, nullptr ), mLegend( nullptr ) { setupUi( this ); } @@ -575,7 +575,7 @@ void QgsComposerLegendWidget::on_mMapComboBox_currentIndexChanged( int index ) int mapNr = itemData.toInt(); if ( mapNr < 0 ) { - mLegend->setComposerMap( 0 ); + mLegend->setComposerMap( nullptr ); } else { @@ -797,7 +797,7 @@ void QgsComposerLegendWidget::resetLayerNodeToDefaults() return; } - QgsLayerTreeLayer* nodeLayer = 0; + QgsLayerTreeLayer* nodeLayer = nullptr; if ( QgsLayerTreeNode* node = mItemTreeView->layerTreeModel()->index2node( currentIndex ) ) { if ( QgsLayerTree::isLayer( node ) ) @@ -1066,10 +1066,10 @@ QgsComposerLegendMenuProvider::QgsComposerLegendMenuProvider( QgsLayerTreeView* QMenu*QgsComposerLegendMenuProvider::createContextMenu() { if ( !mView->currentNode() ) - return 0; + return nullptr; if ( mWidget->legend()->autoUpdateModel() ) - return 0; // no editing allowed + return nullptr; // no editing allowed QMenu* menu = new QMenu(); diff --git a/src/app/composer/qgscomposermanager.cpp b/src/app/composer/qgscomposermanager.cpp index ac1d93c23c2..a3fafc52fa2 100644 --- a/src/app/composer/qgscomposermanager.cpp +++ b/src/app/composer/qgscomposermanager.cpp @@ -264,7 +264,7 @@ void QgsComposerManager::on_mAddButton_clicked() } } - QgsComposer* newComposer = 0; + QgsComposer* newComposer = nullptr; bool loadedOK = false; QString title; @@ -296,12 +296,12 @@ void QgsComposerManager::on_mAddButton_clicked() dlg->show(); newComposer->hide(); - loadedOK = newComposer->composition()->loadFromTemplate( templateDoc, 0, false ); + loadedOK = newComposer->composition()->loadFromTemplate( templateDoc, nullptr, false ); newComposer->activate(); dlg->close(); delete dlg; - dlg = 0; + dlg = nullptr; } } @@ -309,7 +309,7 @@ void QgsComposerManager::on_mAddButton_clicked() { newComposer->close(); QgisApp::instance()->deleteComposer( newComposer ); - newComposer = 0; + newComposer = nullptr; QMessageBox::warning( this, tr( "Template error" ), tr( "Error, could not load template file" ) ); } } @@ -435,7 +435,7 @@ void QgsComposerManager::show_clicked() QMap::const_iterator it = mItemComposerMap.find( item ); if ( it != mItemComposerMap.constEnd() ) { - QgsComposer* c = 0; + QgsComposer* c = nullptr; if ( it.value() ) //a normal composer { c = it.value(); @@ -464,7 +464,7 @@ void QgsComposerManager::duplicate_clicked() return; } - QgsComposer* currentComposer = 0; + QgsComposer* currentComposer = nullptr; QString currentTitle; QListWidgetItem* item = mComposerListWidget->selectedItems().at( 0 ); @@ -494,7 +494,7 @@ void QgsComposerManager::duplicate_clicked() dlg->close(); delete dlg; - dlg = 0; + dlg = nullptr; if ( newComposer ) { @@ -516,7 +516,7 @@ void QgsComposerManager::rename_clicked() } QString currentTitle; - QgsComposer* currentComposer = 0; + QgsComposer* currentComposer = nullptr; QListWidgetItem* item = mComposerListWidget->selectedItems().at( 0 ); QMap::iterator it = mItemComposerMap.find( item ); @@ -596,7 +596,7 @@ void QgsComposerNameDelegate::setModelData( QWidget *editor, QAbstractItemModel if ( changed && cNames.contains( value ) ) { //name exists! - QMessageBox::warning( 0, tr( "Rename composer" ), tr( "There is already a composer named \"%1\"" ).arg( value ) ); + QMessageBox::warning( nullptr, tr( "Rename composer" ), tr( "There is already a composer named \"%1\"" ).arg( value ) ); return; } diff --git a/src/app/composer/qgscomposermanager.h b/src/app/composer/qgscomposermanager.h index a07f7373e86..2bd9926ded1 100644 --- a/src/app/composer/qgscomposermanager.h +++ b/src/app/composer/qgscomposermanager.h @@ -30,7 +30,7 @@ class QgsComposerNameDelegate : public QItemDelegate Q_OBJECT public: - explicit QgsComposerNameDelegate( QObject *parent = 0 ); + explicit QgsComposerNameDelegate( QObject *parent = nullptr ); QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; @@ -49,7 +49,7 @@ class QgsComposerManager: public QDialog, private Ui::QgsComposerManagerBase { Q_OBJECT public: - QgsComposerManager( QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsComposerManager( QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsComposerManager(); void addTemplates( const QMap& templates ); diff --git a/src/app/composer/qgscomposermapwidget.cpp b/src/app/composer/qgscomposermapwidget.cpp index 5af443654a6..5cd653a7462 100644 --- a/src/app/composer/qgscomposermapwidget.cpp +++ b/src/app/composer/qgscomposermapwidget.cpp @@ -44,7 +44,7 @@ #include QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ) - : QgsComposerItemBaseWidget( 0, composerMap ) + : QgsComposerItemBaseWidget( nullptr, composerMap ) , mComposerMap( composerMap ) { setupUi( this ); @@ -1194,7 +1194,7 @@ void QgsComposerMapWidget::on_mAddGridPushButton_clicked() addGridListItem( grid->id(), grid->name() ); mGridListWidget->setCurrentRow( 0 ); - on_mGridListWidget_currentItemChanged( mGridListWidget->currentItem(), 0 ); + on_mGridListWidget_currentItemChanged( mGridListWidget->currentItem(), nullptr ); } void QgsComposerMapWidget::on_mRemoveGridPushButton_clicked() @@ -1256,13 +1256,13 @@ QgsComposerMapGrid* QgsComposerMapWidget::currentGrid() { if ( !mComposerMap ) { - return 0; + return nullptr; } QListWidgetItem* item = mGridListWidget->currentItem(); if ( !item ) { - return 0; + return nullptr; } return mComposerMap->grids()->grid( item->data( Qt::UserRole ).toString() ); @@ -1566,7 +1566,7 @@ void QgsComposerMapWidget::on_mGridLineStyleButton_clicked() } QgsLineSymbolV2* newSymbol = static_cast( grid->lineSymbol()->clone() ); - QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), 0, this ); + QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), nullptr, this ); if ( d.exec() == QDialog::Accepted ) { @@ -1591,7 +1591,7 @@ void QgsComposerMapWidget::on_mGridMarkerStyleButton_clicked() } QgsMarkerSymbolV2* newSymbol = static_cast( grid->markerSymbol()->clone() ); - QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), 0, this ); + QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), nullptr, this ); if ( d.exec() == QDialog::Accepted ) { @@ -2029,7 +2029,7 @@ void QgsComposerMapWidget::on_mAnnotationFormatButton_clicked() QScopedPointer< QgsExpressionContext> expressionContext( grid->createExpressionContext() ); - QgsExpressionBuilderDialog exprDlg( 0, grid->annotationExpression(), this, "generic", *expressionContext ); + QgsExpressionBuilderDialog exprDlg( nullptr, grid->annotationExpression(), this, "generic", *expressionContext ); exprDlg.setWindowTitle( tr( "Expression based annotation" ) ); if ( exprDlg.exec() == QDialog::Accepted ) @@ -2186,7 +2186,7 @@ void QgsComposerMapWidget::on_mCoordinatePrecisionSpinBox_valueChanged( int valu QListWidgetItem* QgsComposerMapWidget::addGridListItem( const QString& id, const QString& name ) { - QListWidgetItem* item = new QListWidgetItem( name, 0 ); + QListWidgetItem* item = new QListWidgetItem( name, nullptr ); item->setData( Qt::UserRole, id ); item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable ); mGridListWidget->insertItem( 0, item ); @@ -2225,11 +2225,11 @@ void QgsComposerMapWidget::loadGridEntries() if ( mGridListWidget->currentItem() ) { - on_mGridListWidget_currentItemChanged( mGridListWidget->currentItem(), 0 ); + on_mGridListWidget_currentItemChanged( mGridListWidget->currentItem(), nullptr ); } else { - on_mGridListWidget_currentItemChanged( 0, 0 ); + on_mGridListWidget_currentItemChanged( nullptr, nullptr ); } } @@ -2331,13 +2331,13 @@ QgsComposerMapOverview* QgsComposerMapWidget::currentOverview() { if ( !mComposerMap ) { - return 0; + return nullptr; } QListWidgetItem* item = mOverviewListWidget->currentItem(); if ( !item ) { - return 0; + return nullptr; } return mComposerMap->overviews()->overview( item->data( Qt::UserRole ).toString() ); @@ -2440,7 +2440,7 @@ void QgsComposerMapWidget::updateOverviewFrameSymbolMarker( const QgsComposerMap QListWidgetItem* QgsComposerMapWidget::addOverviewListItem( const QString& id, const QString& name ) { - QListWidgetItem* item = new QListWidgetItem( name, 0 ); + QListWidgetItem* item = new QListWidgetItem( name, nullptr ); item->setData( Qt::UserRole, id ); item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable ); mOverviewListWidget->insertItem( 0, item ); @@ -2479,11 +2479,11 @@ void QgsComposerMapWidget::loadOverviewEntries() if ( mOverviewListWidget->currentItem() ) { - on_mOverviewListWidget_currentItemChanged( mOverviewListWidget->currentItem(), 0 ); + on_mOverviewListWidget_currentItemChanged( mOverviewListWidget->currentItem(), nullptr ); } else { - on_mOverviewListWidget_currentItemChanged( 0, 0 ); + on_mOverviewListWidget_currentItemChanged( nullptr, nullptr ); } } @@ -2570,7 +2570,7 @@ void QgsComposerMapWidget::on_mOverviewFrameStyleButton_clicked() } QgsFillSymbolV2* newSymbol = static_cast( overview->frameSymbol()->clone() ); - QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), 0, this ); + QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), nullptr, this ); if ( d.exec() == QDialog::Accepted ) { diff --git a/src/app/composer/qgscomposerpicturewidget.cpp b/src/app/composer/qgscomposerpicturewidget.cpp index 46a8e2e576e..85fda3f4ab6 100644 --- a/src/app/composer/qgscomposerpicturewidget.cpp +++ b/src/app/composer/qgscomposerpicturewidget.cpp @@ -32,7 +32,7 @@ #include #include -QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture ): QgsComposerItemBaseWidget( 0, picture ), mPicture( picture ), mPreviewsLoaded( false ) +QgsComposerPictureWidget::QgsComposerPictureWidget( QgsComposerPicture* picture ): QgsComposerItemBaseWidget( nullptr, picture ), mPicture( picture ), mPreviewsLoaded( false ) { setupUi( this ); @@ -100,7 +100,7 @@ void QgsComposerPictureWidget::on_mPictureBrowseButton_clicked() QFileInfo fileInfo( filePath ); if ( !fileInfo.exists() || !fileInfo.isReadable() ) { - QMessageBox::critical( 0, "Invalid file", "Error, file does not exist or is not readable" ); + QMessageBox::critical( nullptr, "Invalid file", "Error, file does not exist or is not readable" ); return; } diff --git a/src/app/composer/qgscomposerscalebarwidget.cpp b/src/app/composer/qgscomposerscalebarwidget.cpp index 96d457220d7..ccc5391c0f3 100644 --- a/src/app/composer/qgscomposerscalebarwidget.cpp +++ b/src/app/composer/qgscomposerscalebarwidget.cpp @@ -23,7 +23,7 @@ #include #include -QgsComposerScaleBarWidget::QgsComposerScaleBarWidget( QgsComposerScaleBar* scaleBar ): QgsComposerItemBaseWidget( 0, scaleBar ), mComposerScaleBar( scaleBar ) +QgsComposerScaleBarWidget::QgsComposerScaleBarWidget( QgsComposerScaleBar* scaleBar ): QgsComposerItemBaseWidget( nullptr, scaleBar ), mComposerScaleBar( scaleBar ) { setupUi( this ); connectUpdateSignal(); diff --git a/src/app/composer/qgscomposershapewidget.cpp b/src/app/composer/qgscomposershapewidget.cpp index a5729ad45f0..1dd36484fb2 100644 --- a/src/app/composer/qgscomposershapewidget.cpp +++ b/src/app/composer/qgscomposershapewidget.cpp @@ -24,7 +24,7 @@ #include "qgssymbollayerv2utils.h" #include -QgsComposerShapeWidget::QgsComposerShapeWidget( QgsComposerShape* composerShape ): QgsComposerItemBaseWidget( 0, composerShape ), mComposerShape( composerShape ) +QgsComposerShapeWidget::QgsComposerShapeWidget( QgsComposerShape* composerShape ): QgsComposerItemBaseWidget( nullptr, composerShape ), mComposerShape( composerShape ) { setupUi( this ); diff --git a/src/app/composer/qgscomposertablebackgroundcolorsdialog.h b/src/app/composer/qgscomposertablebackgroundcolorsdialog.h index 4407c85800f..1e6c43df1d3 100644 --- a/src/app/composer/qgscomposertablebackgroundcolorsdialog.h +++ b/src/app/composer/qgscomposertablebackgroundcolorsdialog.h @@ -38,7 +38,7 @@ class QgsComposerTableBackgroundColorsDialog: public QDialog, private Ui::QgsCom * @param parent parent widget * @param flags window flags */ - QgsComposerTableBackgroundColorsDialog( QgsComposerTableV2* table, QWidget* parent = 0, Qt::WindowFlags flags = 0 ); + QgsComposerTableBackgroundColorsDialog( QgsComposerTableV2* table, QWidget* parent = nullptr, Qt::WindowFlags flags = nullptr ); ~QgsComposerTableBackgroundColorsDialog(); diff --git a/src/app/composer/qgscomposertablewidget.cpp b/src/app/composer/qgscomposertablewidget.cpp index 91f35e23631..1e8c4442d3c 100644 --- a/src/app/composer/qgscomposertablewidget.cpp +++ b/src/app/composer/qgscomposertablewidget.cpp @@ -26,7 +26,7 @@ #include "qgsexpressionbuilderdialog.h" #include "qgisgui.h" -QgsComposerTableWidget::QgsComposerTableWidget( QgsComposerAttributeTable* table ): QgsComposerItemBaseWidget( 0, table ), mComposerTable( table ) +QgsComposerTableWidget::QgsComposerTableWidget( QgsComposerAttributeTable* table ): QgsComposerItemBaseWidget( nullptr, table ), mComposerTable( table ) { setupUi( this ); //add widget for general composer item properties diff --git a/src/app/composer/qgscompositionwidget.cpp b/src/app/composer/qgscompositionwidget.cpp index 70c7c125a51..dbae1f60e02 100644 --- a/src/app/composer/qgscompositionwidget.cpp +++ b/src/app/composer/qgscompositionwidget.cpp @@ -142,7 +142,7 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c ) blockSignals( false ); } -QgsCompositionWidget::QgsCompositionWidget(): QWidget( 0 ), mComposition( 0 ) +QgsCompositionWidget::QgsCompositionWidget(): QWidget( nullptr ), mComposition( nullptr ) { setupUi( this ); } @@ -171,7 +171,7 @@ void QgsCompositionWidget::populateDataDefinedButtons() return; } - QgsVectorLayer* vl = 0; + QgsVectorLayer* vl = nullptr; QgsAtlasComposition* atlas = &mComposition->atlasComposition(); if ( atlas && atlas->enabled() ) @@ -570,7 +570,7 @@ void QgsCompositionWidget::on_mPageStyleButton_clicked() return; } - QgsVectorLayer* coverageLayer = 0; + QgsVectorLayer* coverageLayer = nullptr; // use the atlas coverage layer, if any if ( mComposition->atlasComposition().enabled() ) { @@ -704,7 +704,7 @@ void QgsCompositionWidget::onItemRemoved( QgsComposerItem* item ) } if ( mWorldFileMapComboBox->count() == 0 ) { - mComposition->setWorldFileMap( 0 ); + mComposition->setWorldFileMap( nullptr ); } } @@ -716,7 +716,7 @@ void QgsCompositionWidget::on_mWorldFileMapComboBox_currentIndexChanged( int ind } if ( index == -1 ) { - mComposition->setWorldFileMap( 0 ); + mComposition->setWorldFileMap( nullptr ); } else { diff --git a/src/app/gps/qgsgpsinformationwidget.cpp b/src/app/gps/qgsgpsinformationwidget.cpp index 08df226526d..06731d8bb5c 100644 --- a/src/app/gps/qgsgpsinformationwidget.cpp +++ b/src/app/gps/qgsgpsinformationwidget.cpp @@ -66,17 +66,17 @@ QgsGPSInformationWidget::QgsGPSInformationWidget( QgsMapCanvas * thepCanvas, QWidget * parent, Qt::WindowFlags f ) : QWidget( parent, f ) - , mNmea( 0 ) + , mNmea( nullptr ) , mpCanvas( thepCanvas ) { setupUi( this ); - mpLastLayer = 0; + mpLastLayer = nullptr; mLastGpsPosition = QgsPoint( 0.0, 0.0 ); - mpMapMarker = 0; - mpRubberBand = 0; + mpMapMarker = nullptr; + mpRubberBand = nullptr; populateDevices(); QWidget * mpHistogramWidget = mStackedWidget->widget( 1 ); #if (!WITH_QWTPOLAR) @@ -237,7 +237,7 @@ QgsGPSInformationWidget::QgsGPSInformationWidget( QgsMapCanvas * thepCanvas, QWi setStatusIndicator( NoData ); //SLM - added functionality - mLogFile = 0; + mLogFile = nullptr; connect( QgisApp::instance()->layerTreeView(), SIGNAL( currentLayerChanged( QgsMapLayer* ) ), this, SLOT( updateCloseFeatureButton( QgsMapLayer* ) ) ); @@ -429,7 +429,7 @@ void QgsGPSInformationWidget::connectGps() void QgsGPSInformationWidget::timedout() { mConnectButton->setChecked( false ); - mNmea = NULL; + mNmea = nullptr; mGPSPlainTextEdit->appendPlainText( tr( "Timed out!" ) ); showStatusBarMessage( tr( "Failed to connect to GPS device." ) ); } @@ -464,7 +464,7 @@ void QgsGPSInformationWidget::connected( QgsGPSConnection *conn ) else // error opening file { delete mLogFile; - mLogFile = 0; + mLogFile = nullptr; // need to indicate why - this just reports that an error occurred showStatusBarMessage( tr( "Error opening log file." ) ); @@ -479,16 +479,16 @@ void QgsGPSInformationWidget::disconnectGps() disconnect( mNmea, SIGNAL( nmeaSentenceReceived( const QString& ) ), this, SLOT( logNmeaSentence( const QString& ) ) ); mLogFile->close(); delete mLogFile; - mLogFile = 0; + mLogFile = nullptr; } QgsGPSConnectionRegistry::instance()->unregisterConnection( mNmea ); delete mNmea; - mNmea = NULL; + mNmea = nullptr; if ( mpMapMarker ) // marker should not be shown on GPS disconnected - not current position { delete mpMapMarker; - mpMapMarker = NULL; + mpMapMarker = nullptr; } mGPSPlainTextEdit->appendPlainText( tr( "Disconnected..." ) ); mConnectButton->setChecked( false ); @@ -736,7 +736,7 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in if ( mpMapMarker ) { delete mpMapMarker; - mpMapMarker = 0; + mpMapMarker = nullptr; } } // show marker } @@ -795,7 +795,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked() //lines: bail out if there are not at least two vertices if ( layerWKBType == QGis::WKBLineString && mCaptureList.size() < 2 ) { - QMessageBox::information( 0, tr( "Not enough vertices" ), + QMessageBox::information( nullptr, tr( "Not enough vertices" ), tr( "Cannot close a line feature until it has at least two vertices." ) ); return; } @@ -803,7 +803,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked() //polygons: bail out if there are not at least three vertices if ( layerWKBType == QGis::WKBPolygon && mCaptureList.size() < 3 ) { - QMessageBox::information( 0, tr( "Not enough vertices" ), + QMessageBox::information( nullptr, tr( "Not enough vertices" ), tr( "Cannot close a polygon feature until it has at least three vertices." ) ); return; } @@ -818,7 +818,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked() int size = 0; char end = QgsApplication::endian(); - unsigned char *wkb = NULL; + unsigned char *wkb = nullptr; int wkbtype = 0; QgsCoordinateTransform t( mWgs84CRS, vlayer->crs() ); @@ -952,14 +952,14 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked() else if ( avoidIntersectionsReturn == 2 ) { //bail out... - QMessageBox::critical( 0, tr( "Error" ), tr( "The feature could not be added because removing the polygon intersections would change the geometry type" ) ); + QMessageBox::critical( nullptr, tr( "Error" ), tr( "The feature could not be added because removing the polygon intersections would change the geometry type" ) ); delete f; connectGpsSlot(); return; } else if ( avoidIntersectionsReturn == 3 ) { - QMessageBox::critical( 0, tr( "Error" ), tr( "An error was reported during intersection removal" ) ); + QMessageBox::critical( nullptr, tr( "Error" ), tr( "An error was reported during intersection removal" ) ); delete f; connectGpsSlot(); return; @@ -968,7 +968,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked() // Should never get here, as preconditions should have removed any that aren't handled else // layerWKBType == QGis::WKBPolygon - unknown type { - QMessageBox::critical( 0, tr( "Error" ), tr( "Cannot add feature. " + QMessageBox::critical( nullptr, tr( "Error" ), tr( "Cannot add feature. " "Unknown WKB type. Choose a different layer and try again." ) ); connectGpsSlot(); delete f; @@ -992,7 +992,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked() vlayer->startEditing(); } delete mpRubberBand; - mpRubberBand = NULL; + mpRubberBand = nullptr; // delete the elements of mCaptureList mCaptureList.clear(); diff --git a/src/app/gps/qgsgpsinformationwidget.h b/src/app/gps/qgsgpsinformationwidget.h index 71a3102907e..aa408adac38 100644 --- a/src/app/gps/qgsgpsinformationwidget.h +++ b/src/app/gps/qgsgpsinformationwidget.h @@ -44,7 +44,7 @@ class QgsGPSInformationWidget: public QWidget, private Ui::QgsGPSInformationWidg { Q_OBJECT public: - QgsGPSInformationWidget( QgsMapCanvas * thepCanvas, QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsGPSInformationWidget( QgsMapCanvas * thepCanvas, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsGPSInformationWidget(); private slots: diff --git a/src/app/legend/qgsapplegendinterface.cpp b/src/app/legend/qgsapplegendinterface.cpp index ab6ad683627..c097e1758e2 100644 --- a/src/app/legend/qgsapplegendinterface.cpp +++ b/src/app/legend/qgsapplegendinterface.cpp @@ -122,7 +122,7 @@ static QgsLayerTreeGroup* _groupIndexToNode( int groupIndex, QgsLayerTreeGroup* } } - return 0; + return nullptr; } QgsLayerTreeGroup* QgsAppLegendInterface::groupIndexToNode( int itemIndex ) @@ -237,7 +237,7 @@ QList< GroupLayerInfo > QgsAppLegendInterface::groupLayerRelationship() bool QgsAppLegendInterface::groupExists( int groupIndex ) { - return groupIndexToNode( groupIndex ) != 0; + return groupIndexToNode( groupIndex ) != nullptr; } bool QgsAppLegendInterface::isGroupExpanded( int groupIndex ) diff --git a/src/app/legend/qgsapplegendinterface.h b/src/app/legend/qgsapplegendinterface.h index 51d1befdad5..20bf0175ff7 100644 --- a/src/app/legend/qgsapplegendinterface.h +++ b/src/app/legend/qgsapplegendinterface.h @@ -81,7 +81,7 @@ class QgsAppLegendInterface : public QgsLegendInterface public slots: //! Add a new group - int addGroup( const QString& name, bool expand = true, QTreeWidgetItem* parent = 0 ) override; + int addGroup( const QString& name, bool expand = true, QTreeWidgetItem* parent = nullptr ) override; //! Add a new group at a specified index int addGroup( const QString& name, bool expand, int groupIndex ) override; diff --git a/src/app/main.cpp b/src/app/main.cpp index 2af0265d0f7..b59f532ce8f 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -211,7 +211,7 @@ static void dumpBacktrace( unsigned int depth ) } close( fd[1] ); // close writing end - execl( "/usr/bin/c++filt", "c++filt", ( char * ) 0 ); + execl( "/usr/bin/c++filt", "c++filt", ( char * ) nullptr ); perror( "could not start c++filt" ); exit( 1 ); } @@ -456,7 +456,7 @@ int main( int argc, char *argv[] ) #endif // initialize random number seed - qsrand( time( NULL ) ); + qsrand( time( nullptr ) ); ///////////////////////////////////////////////////////////////// // Command line options 'behaviour' flag setup @@ -720,7 +720,7 @@ int main( int argc, char *argv[] ) ///////////////////////////////////////////////////////////////////// #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(ANDROID) - bool myUseGuiFlag = getenv( "DISPLAY" ) != 0; + bool myUseGuiFlag = getenv( "DISPLAY" ) != nullptr; #else bool myUseGuiFlag = true; #endif @@ -934,8 +934,8 @@ int main( int argc, char *argv[] ) } } - QTranslator qgistor( 0 ); - QTranslator qttor( 0 ); + QTranslator qgistor( nullptr ); + QTranslator qttor( nullptr ); if ( myTranslationCode != "C" ) { if ( qgistor.load( QString( "qgis_" ) + myTranslationCode, i18nPath ) ) diff --git a/src/app/nodetool/qgsmaptoolnodetool.cpp b/src/app/nodetool/qgsmaptoolnodetool.cpp index aedc5473567..14af2d24a3f 100644 --- a/src/app/nodetool/qgsmaptoolnodetool.cpp +++ b/src/app/nodetool/qgsmaptoolnodetool.cpp @@ -33,14 +33,14 @@ QgsMapToolNodeTool::QgsMapToolNodeTool( QgsMapCanvas* canvas ) : QgsMapToolEdit( canvas ) - , mSelectRubberBand( 0 ) - , mSelectedFeature( 0 ) - , mNodeEditor( 0 ) + , mSelectRubberBand( nullptr ) + , mSelectedFeature( nullptr ) + , mNodeEditor( nullptr ) , mMoving( true ) , mSelectAnother( false ) , mAnother( 0 ) - , mSelectionRubberBand( 0 ) - , mRect( 0 ) + , mSelectionRubberBand( nullptr ) + , mRect( nullptr ) , mIsPoint( false ) , mDeselectOnRelease( -1 ) { @@ -403,9 +403,9 @@ void QgsMapToolNodeTool::canvasReleaseEvent( QgsMapMouseEvent* e ) if ( mRect ) { delete mSelectionRubberBand; - mSelectionRubberBand = 0; + mSelectionRubberBand = nullptr; delete mRect; - mRect = 0; + mRect = nullptr; } if ( mPressCoordinates == e->pos() ) @@ -495,7 +495,7 @@ void QgsMapToolNodeTool::deactivate() { cleanTool(); - mSelectionRubberBand = 0; + mSelectionRubberBand = nullptr; mSelectAnother = false; mMoving = true; @@ -516,7 +516,7 @@ void QgsMapToolNodeTool::cleanTool( bool deleteSelectedFeature ) if ( mSelectRubberBand ) { delete mSelectRubberBand; - mSelectRubberBand = 0; + mSelectRubberBand = nullptr; } if ( mSelectedFeature ) @@ -531,13 +531,13 @@ void QgsMapToolNodeTool::cleanTool( bool deleteSelectedFeature ) if ( deleteSelectedFeature ) delete mSelectedFeature; - mSelectedFeature = 0; + mSelectedFeature = nullptr; } if ( mNodeEditor ) { delete mNodeEditor; - mNodeEditor = 0; + mNodeEditor = nullptr; } } diff --git a/src/app/nodetool/qgsnodeeditor.h b/src/app/nodetool/qgsnodeeditor.h index 1eb0c48d084..718e81bdb34 100644 --- a/src/app/nodetool/qgsnodeeditor.h +++ b/src/app/nodetool/qgsnodeeditor.h @@ -37,7 +37,7 @@ class QgsNodeEditorModel : public QAbstractTableModel QgsNodeEditorModel( QgsVectorLayer* layer, QgsSelectedFeature* selectedFeature, - QgsMapCanvas* canvas, QObject* parent = 0 ); + QgsMapCanvas* canvas, QObject* parent = nullptr ); virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const override; int columnCount( const QModelIndex &parent = QModelIndex() ) const override; diff --git a/src/app/nodetool/qgsselectedfeature.cpp b/src/app/nodetool/qgsselectedfeature.cpp index c16caeb8f67..1af5e3329d7 100644 --- a/src/app/nodetool/qgsselectedfeature.cpp +++ b/src/app/nodetool/qgsselectedfeature.cpp @@ -31,9 +31,9 @@ QgsSelectedFeature::QgsSelectedFeature( QgsFeatureId featureId, QgsVectorLayer *vlayer, QgsMapCanvas *canvas ) : mFeatureId( featureId ) - , mGeometry( 0 ) + , mGeometry( nullptr ) , mChangingGeometry( false ) - , mValidator( 0 ) + , mValidator( nullptr ) { QgsDebugCall; setSelectedFeature( featureId, vlayer, canvas ); @@ -55,7 +55,7 @@ QgsSelectedFeature::~QgsSelectedFeature() mValidator->stop(); mValidator->wait(); mValidator->deleteLater(); - mValidator = 0; + mValidator = nullptr; } delete mGeometry; @@ -93,7 +93,7 @@ void QgsSelectedFeature::setSelectedFeature( QgsFeatureId featureId, QgsVectorLa mCanvas = canvas; delete mGeometry; - mGeometry = 0; + mGeometry = nullptr; // signal changing of current layer connect( QgisApp::instance()->layerTreeView(), SIGNAL( currentLayerChanged( QgsMapLayer* ) ), this, SLOT( currentLayerChanged( QgsMapLayer* ) ) ); @@ -177,7 +177,7 @@ void QgsSelectedFeature::validateGeometry( QgsGeometry *g ) mValidator->stop(); mValidator->wait(); mValidator->deleteLater(); - mValidator = 0; + mValidator = nullptr; } mGeomErrors.clear(); @@ -319,7 +319,7 @@ void QgsSelectedFeature::moveSelectedVertexes( const QgsVector &v ) QMultiMap currentResultList; for ( int i = mVertexMap.size() - 1; i > -1 && nUpdates > 0; i-- ) { - QgsVertexEntry *entry = mVertexMap.value( i, 0 ); + QgsVertexEntry *entry = mVertexMap.value( i, nullptr ); if ( !entry || !entry->isSelected() ) continue; @@ -400,7 +400,7 @@ void QgsSelectedFeature::createVertexMap() if ( !mGeometry ) { QgsDebugMsg( "Loading feature" ); - updateGeometry( 0 ); + updateGeometry( nullptr ); } if ( !mGeometry ) diff --git a/src/app/nodetool/qgsselectedfeature.h b/src/app/nodetool/qgsselectedfeature.h index fc5878adf15..7952d00fe0b 100644 --- a/src/app/nodetool/qgsselectedfeature.h +++ b/src/app/nodetool/qgsselectedfeature.h @@ -194,7 +194,7 @@ class QgsSelectedFeature: public QObject /** * Validates the geometry */ - void validateGeometry( QgsGeometry *g = 0 ); + void validateGeometry( QgsGeometry *g = nullptr ); QgsFeatureId mFeatureId; QgsGeometry *mGeometry; diff --git a/src/app/nodetool/qgsvertexentry.cpp b/src/app/nodetool/qgsvertexentry.cpp index 6456d93e470..f634f124d83 100644 --- a/src/app/nodetool/qgsvertexentry.cpp +++ b/src/app/nodetool/qgsvertexentry.cpp @@ -23,7 +23,7 @@ QgsVertexEntry::QgsVertexEntry( QgsMapCanvas *canvas, QgsMapLayer *layer, const , mPenWidth( penWidth ) , mToolTip( tooltip ) , mType( type ) - , mMarker( 0 ) + , mMarker( nullptr ) , mCanvas( canvas ) , mLayer( layer ) { @@ -64,7 +64,7 @@ void QgsVertexEntry::placeMarker() else if ( mMarker ) { delete mMarker; - mMarker = 0; + mMarker = nullptr; } } diff --git a/src/app/ogr/qgsnewogrconnection.cpp b/src/app/ogr/qgsnewogrconnection.cpp index cddf0d4d9e1..52558726a5e 100644 --- a/src/app/ogr/qgsnewogrconnection.cpp +++ b/src/app/ogr/qgsnewogrconnection.cpp @@ -89,7 +89,7 @@ void QgsNewOgrConnection::testConnection() OGRSFDriverH pahDriver; CPLErrorReset(); poDS = OGROpen( TO8F( uri ), false, &pahDriver ); - if ( poDS == NULL ) + if ( poDS == nullptr ) { QMessageBox::information( this, tr( "Test connection" ), tr( "Connection failed - Check settings and try again.\n\nExtended error information:\n%1" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) ); } diff --git a/src/app/ogr/qgsnewogrconnection.h b/src/app/ogr/qgsnewogrconnection.h index 82e6925d5fb..100d829232b 100644 --- a/src/app/ogr/qgsnewogrconnection.h +++ b/src/app/ogr/qgsnewogrconnection.h @@ -31,7 +31,7 @@ class QgsNewOgrConnection : public QDialog, private Ui::QgsNewOgrConnectionBase public: //! Constructor - QgsNewOgrConnection( QWidget *parent = 0, const QString& connType = QString::null, const QString& connName = QString::null, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); + QgsNewOgrConnection( QWidget *parent = nullptr, const QString& connType = QString::null, const QString& connName = QString::null, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); //! Destructor ~QgsNewOgrConnection(); //! Tests the connection using the parameters supplied diff --git a/src/app/ogr/qgsopenvectorlayerdialog.h b/src/app/ogr/qgsopenvectorlayerdialog.h index 0a6473fd4b9..32d3251752d 100644 --- a/src/app/ogr/qgsopenvectorlayerdialog.h +++ b/src/app/ogr/qgsopenvectorlayerdialog.h @@ -32,7 +32,7 @@ class QgsOpenVectorLayerDialog : public QDialog, private Ui::QgsOpenVectorLayerD Q_OBJECT public: - QgsOpenVectorLayerDialog( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); + QgsOpenVectorLayerDialog( QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr ); ~QgsOpenVectorLayerDialog(); //! Opens a dialog to select a file datasource*/ QStringList openFile(); diff --git a/src/app/ogr/qgsvectorlayersaveasdialog.cpp b/src/app/ogr/qgsvectorlayersaveasdialog.cpp index 6a5bc6f74a4..c7ea407c847 100644 --- a/src/app/ogr/qgsvectorlayersaveasdialog.cpp +++ b/src/app/ogr/qgsvectorlayersaveasdialog.cpp @@ -119,7 +119,7 @@ QList > QgsVectorLayerSaveAsDialog::createControls( con { QgsVectorFileWriter::Option *option = it.value(); QLabel *label = new QLabel( it.key() ); - QWidget *control = 0; + QWidget *control = nullptr; switch ( option->type ) { case QgsVectorFileWriter::Int: @@ -170,7 +170,7 @@ QList > QgsVectorLayerSaveAsDialog::createControls( con } case QgsVectorFileWriter::Hidden: - control = 0; + control = nullptr; break; } @@ -293,7 +293,7 @@ void QgsVectorLayerSaveAsDialog::on_browseFilename_clicked() QSettings settings; QString dirName = leFilename->text().isEmpty() ? settings.value( "/UI/lastVectorFileFilterDir", QDir::homePath() ).toString() : leFilename->text(); QString filterString = QgsVectorFileWriter::filterForDriver( format() ); - QString outputFile = QFileDialog::getSaveFileName( 0, tr( "Save layer as..." ), dirName, filterString ); + QString outputFile = QFileDialog::getSaveFileName( nullptr, tr( "Save layer as..." ), dirName, filterString ); if ( !outputFile.isNull() ) { leFilename->setText( outputFile ); diff --git a/src/app/ogr/qgsvectorlayersaveasdialog.h b/src/app/ogr/qgsvectorlayersaveasdialog.h index a4c78c457a3..6dc8046c3e1 100644 --- a/src/app/ogr/qgsvectorlayersaveasdialog.h +++ b/src/app/ogr/qgsvectorlayersaveasdialog.h @@ -38,8 +38,8 @@ class QgsVectorLayerSaveAsDialog : public QDialog, private Ui::QgsVectorLayerSav AllOptions = ~0 }; - QgsVectorLayerSaveAsDialog( long srsid, QWidget* parent = 0, Qt::WindowFlags fl = 0 ); - QgsVectorLayerSaveAsDialog( long srsid, const QgsRectangle& layerExtent, bool layerHasSelectedFeatures, int options = AllOptions, QWidget* parent = 0, Qt::WindowFlags fl = 0 ); + QgsVectorLayerSaveAsDialog( long srsid, QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr ); + QgsVectorLayerSaveAsDialog( long srsid, const QgsRectangle& layerExtent, bool layerHasSelectedFeatures, int options = AllOptions, QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr ); ~QgsVectorLayerSaveAsDialog(); QString format() const; diff --git a/src/app/openstreetmap/qgsosmdownloaddialog.h b/src/app/openstreetmap/qgsosmdownloaddialog.h index b6b91087179..5de378c53fd 100644 --- a/src/app/openstreetmap/qgsosmdownloaddialog.h +++ b/src/app/openstreetmap/qgsosmdownloaddialog.h @@ -28,7 +28,7 @@ class QgsOSMDownloadDialog : public QDialog, private Ui::QgsOSMDownloadDialog { Q_OBJECT public: - explicit QgsOSMDownloadDialog( QWidget* parent = 0 ); + explicit QgsOSMDownloadDialog( QWidget* parent = nullptr ); ~QgsOSMDownloadDialog(); void setRect( const QgsRectangle& rect ); diff --git a/src/app/openstreetmap/qgsosmexportdialog.h b/src/app/openstreetmap/qgsosmexportdialog.h index ae137619178..93ab6521db5 100644 --- a/src/app/openstreetmap/qgsosmexportdialog.h +++ b/src/app/openstreetmap/qgsosmexportdialog.h @@ -28,7 +28,7 @@ class QgsOSMExportDialog : public QDialog, private Ui::QgsOSMExportDialog { Q_OBJECT public: - explicit QgsOSMExportDialog( QWidget *parent = 0 ); + explicit QgsOSMExportDialog( QWidget *parent = nullptr ); ~QgsOSMExportDialog(); protected: diff --git a/src/app/openstreetmap/qgsosmimportdialog.h b/src/app/openstreetmap/qgsosmimportdialog.h index 7e041e39b26..12c834e84c5 100644 --- a/src/app/openstreetmap/qgsosmimportdialog.h +++ b/src/app/openstreetmap/qgsosmimportdialog.h @@ -26,7 +26,7 @@ class QgsOSMImportDialog : public QDialog, private Ui::QgsOSMImportDialog { Q_OBJECT public: - explicit QgsOSMImportDialog( QWidget* parent = 0 ); + explicit QgsOSMImportDialog( QWidget* parent = nullptr ); ~QgsOSMImportDialog(); private slots: diff --git a/src/app/pluginmanager/qgspluginitemdelegate.cpp b/src/app/pluginmanager/qgspluginitemdelegate.cpp index 127c885c1cd..a44d88e71b4 100644 --- a/src/app/pluginmanager/qgspluginitemdelegate.cpp +++ b/src/app/pluginmanager/qgspluginitemdelegate.cpp @@ -45,7 +45,7 @@ void QgsPluginItemDelegate::paint( QPainter *painter, const QStyleOptionViewItem int pixelsHigh = QApplication::fontMetrics().height(); // Draw the background - style->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter, NULL ); + style->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter, nullptr ); // Draw the checkbox if ( index.flags() & Qt::ItemIsUserCheckable ) diff --git a/src/app/pluginmanager/qgspluginitemdelegate.h b/src/app/pluginmanager/qgspluginitemdelegate.h index db93497680c..112bdc97658 100644 --- a/src/app/pluginmanager/qgspluginitemdelegate.h +++ b/src/app/pluginmanager/qgspluginitemdelegate.h @@ -26,7 +26,7 @@ class QgsPluginItemDelegate : public QStyledItemDelegate { Q_OBJECT public: - explicit QgsPluginItemDelegate( QObject * parent = 0 ); + explicit QgsPluginItemDelegate( QObject * parent = nullptr ); QSize sizeHint( const QStyleOptionViewItem & theOption, const QModelIndex & theIndex ) const override; void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; }; diff --git a/src/app/pluginmanager/qgspluginmanager.cpp b/src/app/pluginmanager/qgspluginmanager.cpp index e207c727c08..54801b517e4 100644 --- a/src/app/pluginmanager/qgspluginmanager.cpp +++ b/src/app/pluginmanager/qgspluginmanager.cpp @@ -60,7 +60,7 @@ QgsPluginManager::QgsPluginManager( QWidget * parent, bool pluginsAreEnabled, Qt : QgsOptionsDialogBase( "PluginManager", parent, fl ) { // initialize pointer - mPythonUtils = NULL; + mPythonUtils = nullptr; setupUi( this ); @@ -912,7 +912,7 @@ const QMap * QgsPluginManager::pluginMetadata( const QString& { return &it.value(); } - return NULL; + return nullptr; } diff --git a/src/app/pluginmanager/qgspluginmanager.h b/src/app/pluginmanager/qgspluginmanager.h index 854f65a37b8..e351871f589 100644 --- a/src/app/pluginmanager/qgspluginmanager.h +++ b/src/app/pluginmanager/qgspluginmanager.h @@ -47,7 +47,7 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag Q_OBJECT public: //! Constructor; set pluginsAreEnabled to false in --noplugins mode - QgsPluginManager( QWidget *parent = 0, bool pluginsAreEnabled = true, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); + QgsPluginManager( QWidget *parent = nullptr, bool pluginsAreEnabled = true, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); //! Destructor ~QgsPluginManager(); diff --git a/src/app/pluginmanager/qgspluginsortfilterproxymodel.h b/src/app/pluginmanager/qgspluginsortfilterproxymodel.h index 59072f9dbe3..19c40130ccb 100644 --- a/src/app/pluginmanager/qgspluginsortfilterproxymodel.h +++ b/src/app/pluginmanager/qgspluginsortfilterproxymodel.h @@ -42,7 +42,7 @@ class QgsPluginSortFilterProxyModel : public QSortFilterProxyModel Q_OBJECT public: - explicit QgsPluginSortFilterProxyModel( QObject *parent = 0 ); + explicit QgsPluginSortFilterProxyModel( QObject *parent = nullptr ); //! (Re)configire the status filter void setAcceptedStatuses( const QStringList& statuses ); diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index dad2ac33af8..cb1602382f5 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -521,42 +521,42 @@ static bool cmpByText_( QAction* a, QAction* b ) } -QgisApp *QgisApp::smInstance = 0; +QgisApp *QgisApp::smInstance = nullptr; // constructor starts here QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, Qt::WindowFlags fl ) : QMainWindow( parent, fl ) - , mNonEditMapTool( 0 ) - , mScaleLabel( 0 ) - , mScaleEdit( 0 ) - , mScaleEditValidator( 0 ) - , mCoordsEdit( 0 ) - , mRotationLabel( 0 ) - , mRotationEdit( 0 ) - , mRotationEditValidator( 0 ) - , mProgressBar( 0 ) - , mRenderSuppressionCBox( 0 ) - , mOnTheFlyProjectionStatusLabel( 0 ) - , mOnTheFlyProjectionStatusButton( 0 ) - , mMessageButton( 0 ) - , mFeatureActionMenu( 0 ) - , mPopupMenu( 0 ) - , mDatabaseMenu( 0 ) - , mWebMenu( 0 ) - , mToolPopupOverviews( 0 ) - , mToolPopupDisplay( 0 ) - , mLayerTreeCanvasBridge( 0 ) + , mNonEditMapTool( nullptr ) + , mScaleLabel( nullptr ) + , mScaleEdit( nullptr ) + , mScaleEditValidator( nullptr ) + , mCoordsEdit( nullptr ) + , mRotationLabel( nullptr ) + , mRotationEdit( nullptr ) + , mRotationEditValidator( nullptr ) + , mProgressBar( nullptr ) + , mRenderSuppressionCBox( nullptr ) + , mOnTheFlyProjectionStatusLabel( nullptr ) + , mOnTheFlyProjectionStatusButton( nullptr ) + , mMessageButton( nullptr ) + , mFeatureActionMenu( nullptr ) + , mPopupMenu( nullptr ) + , mDatabaseMenu( nullptr ) + , mWebMenu( nullptr ) + , mToolPopupOverviews( nullptr ) + , mToolPopupDisplay( nullptr ) + , mLayerTreeCanvasBridge( nullptr ) , mSplash( splash ) - , mInternalClipboard( 0 ) + , mInternalClipboard( nullptr ) , mShowProjectionTab( false ) - , mPythonUtils( 0 ) - , mComposerManager( 0 ) - , mpTileScaleWidget( 0 ) - , mpGpsWidget( 0 ) - , mSnappingUtils( 0 ) + , mPythonUtils( nullptr ) + , mComposerManager( nullptr ) + , mpTileScaleWidget( nullptr ) + , mpGpsWidget( nullptr ) + , mSnappingUtils( nullptr ) , mProjectLastModified() - , mWelcomePage( 0 ) - , mCentralContainer( 0 ) + , mWelcomePage( nullptr ) + , mCentralContainer( nullptr ) { if ( smInstance ) { @@ -657,7 +657,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, mLayerTreeView->setObjectName( "theLayerTreeView" ); // "theLayerTreeView" used to find this canonical instance later // create undo widget - mUndoWidget = new QgsUndoWidget( NULL, mMapCanvas ); + mUndoWidget = new QgsUndoWidget( nullptr, mMapCanvas ); mUndoWidget->setObjectName( "Undo" ); // Advanced Digitizing dock @@ -743,7 +743,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, mpGpsDock->setWidget( mpGpsWidget ); mpGpsDock->hide(); - mLastMapToolMessage = 0; + mLastMapToolMessage = nullptr; mLogViewer = new QgsMessageLogViewer( statusBar(), this ); @@ -775,7 +775,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, addWindow( mWindowAction ); #endif - activateDeactivateLayerRelatedActions( NULL ); // after members were created + activateDeactivateLayerRelatedActions( nullptr ); // after members were created connect( QgsMapLayerActionRegistry::instance(), SIGNAL( changed() ), this, SLOT( refreshActionFeatureAction() ) ); @@ -839,7 +839,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, { // python is disabled so get rid of the action for python console delete mActionShowPythonDialog; - mActionShowPythonDialog = 0; + mActionShowPythonDialog = nullptr; } // Set icon size of toolbars @@ -921,7 +921,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, #else //remove mActionTouch button delete mActionTouch; - mActionTouch = 0; + mActionTouch = nullptr; #endif // supposedly all actions have been added, now register them to the shortcut manager @@ -948,83 +948,83 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, } // QgisApp ctor QgisApp::QgisApp() - : QMainWindow( 0, 0 ) - , mStyleSheetBuilder( 0 ) - , mActionPluginSeparator1( 0 ) - , mActionPluginSeparator2( 0 ) - , mActionRasterSeparator( 0 ) - , mMapToolGroup( 0 ) - , mPreviewGroup( 0 ) + : QMainWindow( nullptr, nullptr ) + , mStyleSheetBuilder( nullptr ) + , mActionPluginSeparator1( nullptr ) + , mActionPluginSeparator2( nullptr ) + , mActionRasterSeparator( nullptr ) + , mMapToolGroup( nullptr ) + , mPreviewGroup( nullptr ) #ifdef Q_OS_MAC , mWindowMenu( 0 ) #endif - , mPanelMenu( 0 ) - , mToolbarMenu( 0 ) - , mLayerTreeDock( 0 ) - , mLayerOrderDock( 0 ) - , mOverviewDock( 0 ) - , mpGpsDock( 0 ) - , mLogDock( 0 ) - , mNonEditMapTool( 0 ) - , mScaleLabel( 0 ) - , mScaleEdit( 0 ) - , mScaleEditValidator( 0 ) - , mCoordsEdit( 0 ) - , mRotationLabel( 0 ) - , mRotationEdit( 0 ) - , mRotationEditValidator( 0 ) - , mProgressBar( 0 ) - , mRenderSuppressionCBox( 0 ) - , mOnTheFlyProjectionStatusLabel( 0 ) - , mOnTheFlyProjectionStatusButton( 0 ) - , mMessageButton( 0 ) - , mFeatureActionMenu( 0 ) - , mPopupMenu( 0 ) - , mDatabaseMenu( 0 ) - , mWebMenu( 0 ) - , mToolPopupOverviews( 0 ) - , mToolPopupDisplay( 0 ) - , mMapCanvas( 0 ) - , mOverviewCanvas( 0 ) - , mLayerTreeView( 0 ) - , mLayerTreeCanvasBridge( 0 ) - , mMapLayerOrder( 0 ) - , mOverviewMapCursor( 0 ) - , mMapWindow( 0 ) - , mQgisInterface( 0 ) - , mSplash( 0 ) - , mInternalClipboard( 0 ) + , mPanelMenu( nullptr ) + , mToolbarMenu( nullptr ) + , mLayerTreeDock( nullptr ) + , mLayerOrderDock( nullptr ) + , mOverviewDock( nullptr ) + , mpGpsDock( nullptr ) + , mLogDock( nullptr ) + , mNonEditMapTool( nullptr ) + , mScaleLabel( nullptr ) + , mScaleEdit( nullptr ) + , mScaleEditValidator( nullptr ) + , mCoordsEdit( nullptr ) + , mRotationLabel( nullptr ) + , mRotationEdit( nullptr ) + , mRotationEditValidator( nullptr ) + , mProgressBar( nullptr ) + , mRenderSuppressionCBox( nullptr ) + , mOnTheFlyProjectionStatusLabel( nullptr ) + , mOnTheFlyProjectionStatusButton( nullptr ) + , mMessageButton( nullptr ) + , mFeatureActionMenu( nullptr ) + , mPopupMenu( nullptr ) + , mDatabaseMenu( nullptr ) + , mWebMenu( nullptr ) + , mToolPopupOverviews( nullptr ) + , mToolPopupDisplay( nullptr ) + , mMapCanvas( nullptr ) + , mOverviewCanvas( nullptr ) + , mLayerTreeView( nullptr ) + , mLayerTreeCanvasBridge( nullptr ) + , mMapLayerOrder( nullptr ) + , mOverviewMapCursor( nullptr ) + , mMapWindow( nullptr ) + , mQgisInterface( nullptr ) + , mSplash( nullptr ) + , mInternalClipboard( nullptr ) , mShowProjectionTab( false ) - , mpMapTipsTimer( 0 ) - , mpMaptip( 0 ) + , mpMapTipsTimer( nullptr ) + , mpMaptip( nullptr ) , mMapTipsVisible( false ) , mFullScreenMode( false ) , mPrevScreenModeMaximized( false ) , mSaveRollbackInProgress( false ) - , mPythonUtils( 0 ) - , mBrowserWidget( 0 ) - , mBrowserWidget2( 0 ) - , mAdvancedDigitizingDockWidget( 0 ) - , mStatisticalSummaryDockWidget( 0 ) - , mBookMarksDockWidget( 0 ) - , mSnappingDialog( 0 ) - , mPluginManager( 0 ) - , mComposerManager( 0 ) - , mpTileScaleWidget( 0 ) + , mPythonUtils( nullptr ) + , mBrowserWidget( nullptr ) + , mBrowserWidget2( nullptr ) + , mAdvancedDigitizingDockWidget( nullptr ) + , mStatisticalSummaryDockWidget( nullptr ) + , mBookMarksDockWidget( nullptr ) + , mSnappingDialog( nullptr ) + , mPluginManager( nullptr ) + , mComposerManager( nullptr ) + , mpTileScaleWidget( nullptr ) , mLastComposerId( 0 ) - , mpGpsWidget( 0 ) - , mLastMapToolMessage( 0 ) - , mLogViewer( 0 ) + , mpGpsWidget( nullptr ) + , mLastMapToolMessage( nullptr ) + , mLogViewer( nullptr ) , mTrustedMacros( false ) - , mMacrosWarn( 0 ) - , mUserInputDockWidget( 0 ) - , mVectorLayerTools( 0 ) - , mActionFilterLegend( 0 ) - , mLegendExpressionFilterButton( 0 ) - , mSnappingUtils( 0 ) + , mMacrosWarn( nullptr ) + , mUserInputDockWidget( nullptr ) + , mVectorLayerTools( nullptr ) + , mActionFilterLegend( nullptr ) + , mLegendExpressionFilterButton( nullptr ) + , mSnappingUtils( nullptr ) , mProjectLastModified() - , mWelcomePage( 0 ) - , mCentralContainer( 0 ) + , mWelcomePage( nullptr ) + , mCentralContainer( nullptr ) , mProjOpen( 0 ) { smInstance = this; @@ -1033,7 +1033,7 @@ QgisApp::QgisApp() mMapCanvas = new QgsMapCanvas(); mMapCanvas->freeze(); mLayerTreeView = new QgsLayerTreeView( this ); - mUndoWidget = new QgsUndoWidget( NULL, mMapCanvas ); + mUndoWidget = new QgsUndoWidget( nullptr, mMapCanvas ); mInfoBar = new QgsMessageBar( centralWidget() ); // More tests may need more members to be initialized } @@ -1104,7 +1104,7 @@ QgisApp::~QgisApp() removeAnnotationItems(); // cancel request for FileOpen events - QgsApplication::setFileOpenEventReceiver( 0 ); + QgsApplication::setFileOpenEventReceiver( nullptr ); QgsApplication::exitQgis(); @@ -1306,9 +1306,9 @@ void QgisApp::readSettings() void QgisApp::createActions() { - mActionPluginSeparator1 = NULL; // plugin list separator will be created when the first plugin is loaded - mActionPluginSeparator2 = NULL; // python separator will be created only if python is found - mActionRasterSeparator = NULL; // raster plugins list separator will be created when the first plugin is loaded + mActionPluginSeparator1 = nullptr; // plugin list separator will be created when the first plugin is loaded + mActionPluginSeparator2 = nullptr; // python separator will be created only if python is found + mActionRasterSeparator = nullptr; // raster plugins list separator will be created when the first plugin is loaded // Project Menu Items @@ -1540,7 +1540,7 @@ void QgisApp::createActions() #ifndef HAVE_ORACLE delete mActionAddOracleLayer; - mActionAddOracleLayer = 0; + mActionAddOracleLayer = nullptr; #endif } @@ -1699,7 +1699,7 @@ void QgisApp::createMenus() // Get platform for menu layout customization (Gnome, Kde, Mac, Win) QDialogButtonBox::ButtonLayout layout = - QDialogButtonBox::ButtonLayout( style()->styleHint( QStyle::SH_DialogButtonLayout, 0, this ) ); + QDialogButtonBox::ButtonLayout( style()->styleHint( QStyle::SH_DialogButtonLayout, nullptr, this ) ); // Project Menu @@ -2498,7 +2498,7 @@ void QgisApp::createCanvasTools() void QgisApp::createOverview() { // overview canvas - mOverviewCanvas = new QgsMapOverviewCanvas( NULL, mMapCanvas ); + mOverviewCanvas = new QgsMapOverviewCanvas( nullptr, mMapCanvas ); //set canvas color to default QSettings settings; @@ -3005,7 +3005,7 @@ void QgisApp::sponsors() void QgisApp::about() { - static QgsAbout *abt = NULL; + static QgsAbout *abt = nullptr; if ( !abt ) { QApplication::setOverrideCursor( Qt::WaitCursor ); @@ -3271,7 +3271,7 @@ bool QgisApp::askUserForZipItemLayers( QString path ) { bool ok = false; QVector childItems; - QgsZipItem *zipItem = 0; + QgsZipItem *zipItem = nullptr; QSettings settings; int promptLayers = settings.value( "/qgis/promptForRasterSublayers", 1 ).toInt(); @@ -3283,7 +3283,7 @@ bool QgisApp::askUserForZipItemLayers( QString path ) return false; } - zipItem = new QgsZipItem( 0, path, path ); + zipItem = new QgsZipItem( nullptr, path, path ); if ( ! zipItem ) return false; @@ -3469,7 +3469,7 @@ bool QgisApp::shouldAskUserForGDALSublayers( QgsRasterLayer *layer ) void QgisApp::loadGDALSublayers( const QString& uri, const QStringList& list ) { QString path, name; - QgsRasterLayer *subLayer = NULL; + QgsRasterLayer *subLayer = nullptr; //add layers in reverse order so they appear in the right order in the layer dock for ( int i = list.size() - 1; i >= 0 ; i-- ) @@ -4560,7 +4560,7 @@ void QgisApp::openProject( QAction *action ) { // possibly save any pending work before opening a different project QString debugme; - assert( action != NULL ); + assert( action != nullptr ); debugme = action->data().toString(); @@ -4710,7 +4710,7 @@ void QgisApp::showComposerManager() { if ( !mComposerManager ) { - mComposerManager = new QgsComposerManager( 0, Qt::Window ); + mComposerManager = new QgsComposerManager( nullptr, Qt::Window ); connect( mComposerManager, SIGNAL( finished( int ) ), this, SLOT( deleteComposerManager() ) ); } mComposerManager->show(); @@ -4720,7 +4720,7 @@ void QgisApp::showComposerManager() void QgisApp::deleteComposerManager() { mComposerManager->deleteLater(); - mComposerManager = 0; + mComposerManager = nullptr; } void QgisApp::disablePreviewMode() @@ -4779,7 +4779,7 @@ void QgisApp::updateFilterLegend() } else { - layerTreeView()->layerTreeModel()->setLegendFilterByMap( 0 ); + layerTreeView()->layerTreeModel()->setLegendFilterByMap( nullptr ); } } @@ -4789,7 +4789,7 @@ void QgisApp::saveMapAsImage() if ( myFileNameAndFilter.first != "" ) { //save the mapview to the selected file - mMapCanvas->saveAsImage( myFileNameAndFilter.first, NULL, myFileNameAndFilter.second ); + mMapCanvas->saveAsImage( myFileNameAndFilter.first, nullptr, myFileNameAndFilter.second ); statusBar()->showMessage( tr( "Saved map image to %1" ).arg( myFileNameAndFilter.first ) ); } @@ -5066,7 +5066,7 @@ void QgisApp::updateDefaultFeatureAction( QAction *action ) if ( vlayer->actions()->size() > 0 && index < vlayer->actions()->size() ) { vlayer->actions()->setDefaultAction( index ); - QgsMapLayerActionRegistry::instance()->setDefaultActionForLayer( vlayer, 0 ); + QgsMapLayerActionRegistry::instance()->setDefaultActionForLayer( vlayer, nullptr ); } else { @@ -5080,7 +5080,7 @@ void QgisApp::updateDefaultFeatureAction( QAction *action ) } else { - QgsMapLayerActionRegistry::instance()->setDefaultActionForLayer( vlayer, 0 ); + QgsMapLayerActionRegistry::instance()->setDefaultActionForLayer( vlayer, nullptr ); } } @@ -5367,7 +5367,7 @@ void QgisApp::saveAsRasterFile() fileWriter.setMaxTileHeight( d.maximumTileSizeY() ); } - QProgressDialog pd( 0, tr( "Abort..." ), 0, 0 ); + QProgressDialog pd( nullptr, tr( "Abort..." ), 0, 0 ); // Show the dialo immediately because cloning pipe can take some time (WCS) pd.setLabelText( tr( "Reading raster" ) ); pd.setWindowTitle( tr( "Saving raster" ) ); @@ -5377,7 +5377,7 @@ void QgisApp::saveAsRasterFile() // TODO: show error dialogs // TODO: this code should go somewhere else, but probably not into QgsRasterFileWriter // clone pipe/provider is not really necessary, ready for threads - QScopedPointer pipe( 0 ); + QScopedPointer pipe( nullptr ); if ( d.mode() == QgsRasterLayerSaveAsDialog::RawDataMode ) { @@ -5526,7 +5526,7 @@ void QgisApp::saveAsVectorFileGeneral( QgsVectorLayer* vlayer, bool symbologyOpt bool autoGeometryType = dialog->automaticGeometryType(); QgsWKBTypes::Type forcedGeometryType = dialog->geometryType(); - QgsCoordinateTransform* ct = 0; + QgsCoordinateTransform* ct = nullptr; destCRS = QgsCoordinateReferenceSystem( dialog->crs(), QgsCoordinateReferenceSystem::InternalCrsId ); if ( destCRS.isValid() && destCRS != vlayer->crs() ) @@ -5571,7 +5571,7 @@ void QgisApp::saveAsVectorFileGeneral( QgsVectorLayer* vlayer, bool symbologyOpt &newFilename, ( QgsVectorFileWriter::SymbologyExport )( dialog->symbologyExport() ), dialog->scaleDenominator(), - dialog->hasFilterExtent() ? &filterExtent : 0, + dialog->hasFilterExtent() ? &filterExtent : nullptr, autoGeometryType ? QgsWKBTypes::Unknown : forcedGeometryType, dialog->forceMulti(), dialog->includeZ() @@ -5594,7 +5594,7 @@ void QgisApp::saveAsVectorFileGeneral( QgsVectorLayer* vlayer, bool symbologyOpt } else { - QgsMessageViewer *m = new QgsMessageViewer( 0 ); + QgsMessageViewer *m = new QgsMessageViewer( nullptr ); m->setWindowTitle( tr( "Save error" ) ); m->setMessageAsPlainText( tr( "Export to vector file failed.\nError: %1" ).arg( errorMessage ) ); m->exec(); @@ -5751,14 +5751,14 @@ QgsGeometry* QgisApp::unionGeometries( const QgsVectorLayer* vl, QgsFeatureList& canceled = false; if ( !vl || featureList.size() < 2 ) { - return 0; + return nullptr; } QgsGeometry* unionGeom = featureList[0].geometry(); - QgsGeometry* backupPtr = 0; //pointer to delete intermediate results + QgsGeometry* backupPtr = nullptr; //pointer to delete intermediate results if ( !unionGeom ) { - return 0; + return nullptr; } QProgressDialog progress( tr( "Merging features..." ), tr( "Abort" ), 0, featureList.size(), this ); @@ -5773,7 +5773,7 @@ QgsGeometry* QgisApp::unionGeometries( const QgsVectorLayer* vl, QgsFeatureList& delete unionGeom; QApplication::restoreOverrideCursor(); canceled = true; - return 0; + return nullptr; } progress.setValue( i ); QgsGeometry* currentGeom = featureList[i].geometry(); @@ -5784,12 +5784,12 @@ QgsGeometry* QgisApp::unionGeometries( const QgsVectorLayer* vl, QgsFeatureList& if ( i > 1 ) //delete previous intermediate results { delete backupPtr; - backupPtr = 0; + backupPtr = nullptr; } if ( !unionGeom ) { QApplication::restoreOverrideCursor(); - return 0; + return nullptr; } } } @@ -5917,7 +5917,7 @@ void QgisApp::deleteComposer( QgsComposer* c ) QgsComposer* QgisApp::duplicateComposer( QgsComposer* currentComposer, QString title ) { - QgsComposer* newComposer = 0; + QgsComposer* newComposer = nullptr; // test that current composer template write is valid QDomDocument currentDoc; @@ -5945,10 +5945,10 @@ QgsComposer* QgisApp::duplicateComposer( QgsComposer* currentComposer, QString t // hiding composer until template is loaded is much faster, provide feedback to user newComposer->hide(); QApplication::setOverrideCursor( Qt::BusyCursor ); - if ( !newComposer->composition()->loadFromTemplate( currentDoc, 0, false ) ) + if ( !newComposer->composition()->loadFromTemplate( currentDoc, nullptr, false ) ) { deleteComposer( newComposer ); - newComposer = 0; + newComposer = nullptr; QgsDebugMsg( "Error, composer could not be duplicated" ); return newComposer; } @@ -6180,13 +6180,13 @@ void QgisApp::mergeAttributesOfSelectedFeatures() QgsVectorLayer* vl = qobject_cast( activeMapLayer ); if ( !vl ) { - QMessageBox::information( 0, tr( "Active layer is not vector" ), tr( "The merge features tool only works on vector layers. Please select a vector layer from the layer list" ) ); + QMessageBox::information( nullptr, tr( "Active layer is not vector" ), tr( "The merge features tool only works on vector layers. Please select a vector layer from the layer list" ) ); return; } if ( !vl->isEditable() ) { - QMessageBox::information( 0, tr( "Layer not editable" ), tr( "Merging features can only be done for layers in editing mode. To use the merge tool, go to Layer->Toggle editing" ) ); + QMessageBox::information( nullptr, tr( "Layer not editable" ), tr( "Merging features can only be done for layers in editing mode. To use the merge tool, go to Layer->Toggle editing" ) ); return; } @@ -6194,7 +6194,7 @@ void QgisApp::mergeAttributesOfSelectedFeatures() const QgsFeatureIds& featureIdSet = vl->selectedFeaturesIds(); if ( featureIdSet.size() < 2 ) { - QMessageBox::information( 0, tr( "Not enough features selected" ), tr( "The merge tool requires at least two selected features" ) ); + QMessageBox::information( nullptr, tr( "Not enough features selected" ), tr( "The merge tool requires at least two selected features" ) ); return; } @@ -6263,18 +6263,18 @@ void QgisApp::mergeSelectedFeatures() QgsMapLayer* activeMapLayer = activeLayer(); if ( !activeMapLayer ) { - QMessageBox::information( 0, tr( "No active layer" ), tr( "No active layer found. Please select a layer in the layer list" ) ); + QMessageBox::information( nullptr, tr( "No active layer" ), tr( "No active layer found. Please select a layer in the layer list" ) ); return; } QgsVectorLayer* vl = qobject_cast( activeMapLayer ); if ( !vl ) { - QMessageBox::information( 0, tr( "Active layer is not vector" ), tr( "The merge features tool only works on vector layers. Please select a vector layer from the layer list" ) ); + QMessageBox::information( nullptr, tr( "Active layer is not vector" ), tr( "The merge features tool only works on vector layers. Please select a vector layer from the layer list" ) ); return; } if ( !vl->isEditable() ) { - QMessageBox::information( 0, tr( "Layer not editable" ), tr( "Merging features can only be done for layers in editing mode. To use the merge tool, go to Layer->Toggle editing" ) ); + QMessageBox::information( nullptr, tr( "Layer not editable" ), tr( "Merging features can only be done for layers in editing mode. To use the merge tool, go to Layer->Toggle editing" ) ); return; } @@ -6289,7 +6289,7 @@ void QgisApp::mergeSelectedFeatures() const QgsFeatureIds& featureIdSet = vl->selectedFeaturesIds(); if ( featureIdSet.size() < 2 ) { - QMessageBox::information( 0, tr( "Not enough features selected" ), tr( "The merge tool requires at least two selected features" ) ); + QMessageBox::information( nullptr, tr( "Not enough features selected" ), tr( "The merge tool requires at least two selected features" ) ); return; } @@ -6302,7 +6302,7 @@ void QgisApp::mergeSelectedFeatures() { if ( !canceled ) { - QMessageBox::critical( 0, tr( "Merge failed" ), tr( "An error occured during the merge operation" ) ); + QMessageBox::critical( nullptr, tr( "Merge failed" ), tr( "An error occured during the merge operation" ) ); } return; } @@ -6310,7 +6310,7 @@ void QgisApp::mergeSelectedFeatures() //make a first geometry union and notify the user straight away if the union geometry type does not match the layer one if ( providerChecksTypeStrictly && unionGeom->wkbType() != vl->wkbType() ) { - QMessageBox::critical( 0, tr( "Union operation canceled" ), tr( "The union operation would result in a geometry type that is not compatible with the current layer and therefore is canceled" ) ); + QMessageBox::critical( nullptr, tr( "Union operation canceled" ), tr( "The union operation would result in a geometry type that is not compatible with the current layer and therefore is canceled" ) ); delete unionGeom; return; } @@ -6327,7 +6327,7 @@ void QgisApp::mergeSelectedFeatures() if ( featureIdsAfter.size() < 2 ) { - QMessageBox::information( 0, tr( "Not enough features selected" ), tr( "The merge tool requires at least two selected features" ) ); + QMessageBox::information( nullptr, tr( "Not enough features selected" ), tr( "The merge tool requires at least two selected features" ) ); delete unionGeom; return; } @@ -6343,14 +6343,14 @@ void QgisApp::mergeSelectedFeatures() { if ( !canceled ) { - QMessageBox::critical( 0, tr( "Merge failed" ), tr( "An error occured during the merge operation" ) ); + QMessageBox::critical( nullptr, tr( "Merge failed" ), tr( "An error occured during the merge operation" ) ); } return; } if ( providerChecksTypeStrictly && unionGeom->wkbType() != vl->wkbType() ) { - QMessageBox::critical( 0, "Union operation canceled", tr( "The union operation would result in a geometry type that is not compatible with the current layer and therefore is canceled" ) ); + QMessageBox::critical( nullptr, "Union operation canceled", tr( "The union operation would result in a geometry type that is not compatible with the current layer and therefore is canceled" ) ); delete unionGeom; return; } @@ -6689,7 +6689,7 @@ QgsVectorLayer *QgisApp::pasteAsNewMemoryVector( const QString & theLayerName ) tr( "Layer name" ), QLineEdit::Normal, defaultName, &ok ); if ( !ok ) - return 0; + return nullptr; if ( layerName.isEmpty() ) { @@ -6699,7 +6699,7 @@ QgsVectorLayer *QgisApp::pasteAsNewMemoryVector( const QString & theLayerName ) QgsVectorLayer *layer = pasteToNewMemoryVector(); if ( !layer ) - return 0; + return nullptr; layer->setLayerName( layerName ); @@ -6778,7 +6778,7 @@ QgsVectorLayer *QgisApp::pasteToNewMemoryVector() if ( !message.isEmpty() ) { QMessageBox::warning( this, tr( "Warning" ), message, QMessageBox::Ok ); - return 0; + return nullptr; } QgsVectorLayer *layer = new QgsVectorLayer( typeName, "pasted_features", "memory" ); @@ -6787,7 +6787,7 @@ QgsVectorLayer *QgisApp::pasteToNewMemoryVector() { delete layer; QMessageBox::warning( this, tr( "Warning" ), tr( "Cannot create new layer" ), QMessageBox::Ok ); - return 0; + return nullptr; } layer->startEditing(); @@ -6802,7 +6802,7 @@ QgsVectorLayer *QgisApp::pasteToNewMemoryVector() tr( "Cannot create field %1 (%2,%3)" ).arg( f.name(), f.typeName(), QVariant::typeToName( f.type() ) ), QMessageBox::Ok ); delete layer; - return 0; + return nullptr; } } @@ -6819,7 +6819,7 @@ QgsVectorLayer *QgisApp::pasteToNewMemoryVector() if ( QGis::singleType( wkbType ) != QGis::singleType( type ) ) { - feature.setGeometry( 0 ); + feature.setGeometry( nullptr ); } if ( QGis::isMultiType( wkbType ) && QGis::isSingleType( type ) ) @@ -6831,7 +6831,7 @@ QgsVectorLayer *QgisApp::pasteToNewMemoryVector() { QgsDebugMsg( "Cannot add features or commit changes" ); delete layer; - return 0; + return nullptr; } layer->removeSelection(); @@ -7038,7 +7038,7 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel ) if ( allowCancel ) buttons |= QMessageBox::Cancel; - switch ( QMessageBox::information( 0, + switch ( QMessageBox::information( nullptr, tr( "Stop editing" ), tr( "Do you want to save the changes to layer %1?" ).arg( vlayer->name() ), buttons ) ) @@ -7149,7 +7149,7 @@ void QgisApp::cancelEdits( QgsMapLayer *layer, bool leaveEditable, bool triggerR if ( !vlayer->rollBack( !leaveEditable ) ) { mSaveRollbackInProgress = false; - QMessageBox::information( 0, + QMessageBox::information( nullptr, tr( "Error" ), tr( "Could not %1 changes to layer %2\n\nErrors: %3\n" ) .arg( leaveEditable ? tr( "rollback" ) : tr( "cancel" ), @@ -7249,7 +7249,7 @@ void QgisApp::cancelAllEdits( bool verifyAction ) bool QgisApp::verifyEditsActionDialog( const QString& act, const QString& upon ) { bool res = false; - switch ( QMessageBox::information( 0, + switch ( QMessageBox::information( nullptr, tr( "Current edits" ), tr( "%1 current changes for %2 layer(s)?" ) .arg( act, @@ -7480,7 +7480,7 @@ void QgisApp::duplicateLayers( const QList& lyrList ) Q_FOREACH ( QgsMapLayer * selectedLyr, selectedLyrs ) { - dupLayer = 0; + dupLayer = nullptr; unSppType.clear(); layerDupName = selectedLyr->name() + ' ' + tr( "copy" ); @@ -7576,7 +7576,7 @@ void QgisApp::duplicateLayers( const QList& lyrList ) } } - dupLayer = 0; + dupLayer = nullptr; mMapCanvas->freeze( false ); @@ -8234,7 +8234,7 @@ void QgisApp::openURL( QString url, bool useQgisDocDirectory ) /** Get a pointer to the currently selected map layer */ QgsMapLayer *QgisApp::activeLayer() { - return mLayerTreeView ? mLayerTreeView->currentLayer() : 0; + return mLayerTreeView ? mLayerTreeView->currentLayer() : nullptr; } /** Set the current layer */ @@ -8303,7 +8303,7 @@ QgsVectorLayer* QgisApp::addVectorLayer( const QString& vectorLayerPath, const Q // The first layer loaded is not useful in that case. The user can select it in // the list if he wants to load it. delete layer; - layer = 0; + layer = nullptr; } else { @@ -8322,7 +8322,7 @@ QgsVectorLayer* QgisApp::addVectorLayer( const QString& vectorLayerPath, const Q delete layer; mMapCanvas->freeze( false ); - return NULL; + return nullptr; } // Only update the map if we frozen in this method @@ -8633,7 +8633,7 @@ void QgisApp::removePluginMenu( const QString& name, QAction* action ) if ( actions.indexOf( mActionPluginSeparator1 ) + 1 == end ) { mPluginMenu->removeAction( mActionPluginSeparator1 ); - mActionPluginSeparator1 = NULL; + mActionPluginSeparator1 = nullptr; } } @@ -8647,7 +8647,7 @@ QMenu* QgisApp::getDatabaseMenu( const QString& menuName ) QString dst = cleanedMenuName; dst.remove( QChar( '&' ) ); - QAction *before = NULL; + QAction *before = nullptr; QList actions = mDatabaseMenu->actions(); for ( int i = 0; i < actions.count(); i++ ) { @@ -8686,7 +8686,7 @@ QMenu* QgisApp::getRasterMenu( const QString& menuName ) cleanedMenuName.remove( QChar( '&' ) ); #endif - QAction *before = NULL; + QAction *before = nullptr; if ( !mActionRasterSeparator ) { // First plugin - create plugin list separator @@ -8739,7 +8739,7 @@ QMenu* QgisApp::getVectorMenu( const QString& menuName ) QString dst = cleanedMenuName; dst.remove( QChar( '&' ) ); - QAction *before = NULL; + QAction *before = nullptr; QList actions = mVectorMenu->actions(); for ( int i = 0; i < actions.count(); i++ ) { @@ -8780,7 +8780,7 @@ QMenu* QgisApp::getWebMenu( const QString& menuName ) QString dst = cleanedMenuName; dst.remove( QChar( '&' ) ); - QAction *before = NULL; + QAction *before = nullptr; QList actions = mWebMenu->actions(); for ( int i = 0; i < actions.count(); i++ ) { @@ -8830,7 +8830,7 @@ void QgisApp::addPluginToDatabaseMenu( const QString& name, QAction* action ) if ( mDatabaseMenu->actions().count() != 1 ) return; - QAction* before = NULL; + QAction* before = nullptr; QList actions = menuBar()->actions(); for ( int i = 0; i < actions.count(); i++ ) { @@ -8884,7 +8884,7 @@ void QgisApp::addPluginToWebMenu( const QString& name, QAction* action ) if ( mWebMenu->actions().count() != 1 ) return; - QAction* before = NULL; + QAction* before = nullptr; QList actions = menuBar()->actions(); for ( int i = 0; i < actions.count(); i++ ) { @@ -8956,7 +8956,7 @@ void QgisApp::removePluginRasterMenu( const QString& name, QAction* action ) if ( actions.indexOf( mActionRasterSeparator ) + 1 == actions.count() ) { mRasterMenu->removeAction( mActionRasterSeparator ); - mActionRasterSeparator = NULL; + mActionRasterSeparator = nullptr; } } @@ -9202,7 +9202,7 @@ void QgisApp::layersWereAdded( const QList& theLayers ) for ( int i = 0; i < theLayers.size(); ++i ) { QgsMapLayer * layer = theLayers.at( i ); - QgsDataProvider *provider = 0; + QgsDataProvider *provider = nullptr; QgsVectorLayer *vlayer = qobject_cast( layer ); if ( vlayer ) @@ -9420,7 +9420,7 @@ void QgisApp::legendLayerSelectionChanged( void ) mActionCancelEdits->setEnabled( QgsLayerTreeUtils::layersEditable( selectedLayers ) ); mLegendExpressionFilterButton->setEnabled( false ); - mLegendExpressionFilterButton->setVectorLayer( 0 ); + mLegendExpressionFilterButton->setVectorLayer( nullptr ); if ( selectedLayers.size() == 1 ) { QgsLayerTreeLayer* l = selectedLayers.front(); @@ -9840,7 +9840,7 @@ void QgisApp::refreshActionFeatureAction() { QgsMapLayer* layer = activeLayer(); - if ( layer == 0 || layer->type() != QgsMapLayer::VectorLayer ) + if ( layer == nullptr || layer->type() != QgsMapLayer::VectorLayer ) { return; } @@ -9934,7 +9934,7 @@ QgsRasterLayer* QgisApp::addRasterLayerPrivate( QgsDebugMsg( "Creating new raster layer using " + uri + " with baseName of " + baseName ); - QgsRasterLayer *layer = 0; + QgsRasterLayer *layer = nullptr; // XXX ya know QgsRasterLayer can snip out the basename on its own; // XXX why do we have to pass it in for it? // ET : we may not be getting "normal" files here, so we still need the baseName argument @@ -9968,7 +9968,7 @@ QgsRasterLayer* QgisApp::addRasterLayerPrivate( // The first layer loaded is not useful in that case. The user can select it in // the list if he wants to load it. delete layer; - layer = NULL; + layer = nullptr; } } else @@ -9996,7 +9996,7 @@ QgsRasterLayer* QgisApp::addRasterLayerPrivate( if ( layer ) { delete layer; - layer = NULL; + layer = nullptr; } } @@ -10149,7 +10149,7 @@ QgsPluginLayer* QgisApp::addPluginLayer( const QString& uri, const QString& base { QgsPluginLayer* layer = QgsPluginLayerRegistry::instance()->createLayer( providerKey, uri ); if ( !layer ) - return 0; + return nullptr; layer->setLayerName( baseName ); diff --git a/src/app/qgisapp.h b/src/app/qgisapp.h index 1ce78ffda37..6da89fb3af5 100644 --- a/src/app/qgisapp.h +++ b/src/app/qgisapp.h @@ -132,7 +132,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow Q_OBJECT public: //! Constructor - QgisApp( QSplashScreen *splash, bool restorePlugins = true, QWidget *parent = 0, Qt::WindowFlags fl = Qt::Window ); + QgisApp( QSplashScreen *splash, bool restorePlugins = true, QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::Window ); //! Constructor for unit tests QgisApp(); //! Destructor @@ -428,7 +428,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow QMenu *windowMenu() { return mWindowMenu; } #else QMenu *firstRightStandardMenu() { return mHelpMenu; } - QMenu *windowMenu() { return NULL; } + QMenu *windowMenu() { return nullptr; } #endif QMenu *printComposersMenu() {return mPrintComposersMenu;} QMenu *helpMenu() { return mHelpMenu; } @@ -576,19 +576,19 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow \param layerContainingSelection The layer that the selection will be taken from (defaults to the active layer on the legend) */ - void editCut( QgsMapLayer *layerContainingSelection = 0 ); + void editCut( QgsMapLayer *layerContainingSelection = nullptr ); //! copies selected features on the active layer to the clipboard /** \param layerContainingSelection The layer that the selection will be taken from (defaults to the active layer on the legend) */ - void editCopy( QgsMapLayer *layerContainingSelection = 0 ); + void editCopy( QgsMapLayer *layerContainingSelection = nullptr ); //! copies features on the clipboard to the active layer /** \param destinationLayer The layer that the clipboard will be pasted to (defaults to the active layer on the legend) */ - void editPaste( QgsMapLayer *destinationLayer = 0 ); + void editPaste( QgsMapLayer *destinationLayer = nullptr ); //! copies features on the clipboard to a new vector layer void pasteAsNewVector(); //! copies features on the clipboard to a new memory vector layer @@ -598,13 +598,13 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow \param sourceLayer The layer where the style will be taken from (defaults to the active layer on the legend) */ - void copyStyle( QgsMapLayer *sourceLayer = 0 ); + void copyStyle( QgsMapLayer *sourceLayer = nullptr ); //! pastes style on the clipboard to the active layer /** \param destinationLayer The layer that the clipboard will be pasted to (defaults to the active layer on the legend) */ - void pasteStyle( QgsMapLayer *destinationLayer = 0 ); + void pasteStyle( QgsMapLayer *destinationLayer = nullptr ); //! copies features to internal clipboard void copyFeatures( QgsFeatureStore & featureStore ); @@ -612,7 +612,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow void loadGDALSublayers( const QString& uri, const QStringList& list ); /** Deletes the selected attributes for the currently selected vector layer*/ - void deleteSelected( QgsMapLayer *layer = 0, QWidget *parent = 0, bool promptConfirmation = false ); + void deleteSelected( QgsMapLayer *layer = nullptr, QWidget *parent = nullptr, bool promptConfirmation = false ); //! project was written void writeProject( QDomDocument & ); @@ -662,7 +662,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow void updateProjectFromTemplates(); //! Opens the options dialog - void showOptionsDialog( QWidget *parent = 0, const QString& currentPage = QString() ); + void showOptionsDialog( QWidget *parent = nullptr, const QString& currentPage = QString() ); /** Refreshes the state of the layer actions toolbar action * @note added in 2.1 */ @@ -1354,7 +1354,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow /** Deletes all the composer objects and clears mPrintComposers*/ void deletePrintComposers(); - void saveAsVectorFileGeneral( QgsVectorLayer* vlayer = 0, bool symbologyOption = true ); + void saveAsVectorFileGeneral( QgsVectorLayer* vlayer = nullptr, bool symbologyOption = true ); /** Paste features from clipboard into a new memory layer. * If no features are in clipboard an empty layer is returned. @@ -1442,52 +1442,52 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow public: Tools() - : mZoomIn( 0 ) - , mZoomOut( 0 ) - , mPan( 0 ) + : mZoomIn( nullptr ) + , mZoomOut( nullptr ) + , mPan( nullptr ) #ifdef HAVE_TOUCH , mTouch( 0 ) #endif - , mIdentify( 0 ) - , mFeatureAction( 0 ) - , mMeasureDist( 0 ) - , mMeasureArea( 0 ) - , mMeasureAngle( 0 ) - , mAddFeature( 0 ) - , mCircularStringCurvePoint( 0 ) - , mCircularStringRadius( 0 ) - , mMoveFeature( 0 ) - , mOffsetCurve( 0 ) - , mReshapeFeatures( 0 ) - , mSplitFeatures( 0 ) - , mSplitParts( 0 ) - , mSelect( 0 ) - , mSelectFeatures( 0 ) - , mSelectPolygon( 0 ) - , mSelectFreehand( 0 ) - , mSelectRadius( 0 ) - , mVertexAdd( 0 ) - , mVertexMove( 0 ) - , mVertexDelete( 0 ) - , mAddRing( 0 ) - , mFillRing( 0 ) - , mAddPart( 0 ) - , mSimplifyFeature( 0 ) - , mDeleteRing( 0 ) - , mDeletePart( 0 ) - , mNodeTool( 0 ) - , mRotatePointSymbolsTool( 0 ) - , mAnnotation( 0 ) - , mFormAnnotation( 0 ) - , mHtmlAnnotation( 0 ) - , mSvgAnnotation( 0 ) - , mTextAnnotation( 0 ) - , mPinLabels( 0 ) - , mShowHideLabels( 0 ) - , mMoveLabel( 0 ) - , mRotateFeature( 0 ) - , mRotateLabel( 0 ) - , mChangeLabelProperties( 0 ) + , mIdentify( nullptr ) + , mFeatureAction( nullptr ) + , mMeasureDist( nullptr ) + , mMeasureArea( nullptr ) + , mMeasureAngle( nullptr ) + , mAddFeature( nullptr ) + , mCircularStringCurvePoint( nullptr ) + , mCircularStringRadius( nullptr ) + , mMoveFeature( nullptr ) + , mOffsetCurve( nullptr ) + , mReshapeFeatures( nullptr ) + , mSplitFeatures( nullptr ) + , mSplitParts( nullptr ) + , mSelect( nullptr ) + , mSelectFeatures( nullptr ) + , mSelectPolygon( nullptr ) + , mSelectFreehand( nullptr ) + , mSelectRadius( nullptr ) + , mVertexAdd( nullptr ) + , mVertexMove( nullptr ) + , mVertexDelete( nullptr ) + , mAddRing( nullptr ) + , mFillRing( nullptr ) + , mAddPart( nullptr ) + , mSimplifyFeature( nullptr ) + , mDeleteRing( nullptr ) + , mDeletePart( nullptr ) + , mNodeTool( nullptr ) + , mRotatePointSymbolsTool( nullptr ) + , mAnnotation( nullptr ) + , mFormAnnotation( nullptr ) + , mHtmlAnnotation( nullptr ) + , mSvgAnnotation( nullptr ) + , mTextAnnotation( nullptr ) + , mPinLabels( nullptr ) + , mShowHideLabels( nullptr ) + , mMoveLabel( nullptr ) + , mRotateFeature( nullptr ) + , mRotateLabel( nullptr ) + , mChangeLabelProperties( nullptr ) {} QgsMapTool *mZoomIn; diff --git a/src/app/qgisappinterface.cpp b/src/app/qgisappinterface.cpp index 86cf51e0a58..0b690ec25a5 100644 --- a/src/app/qgisappinterface.cpp +++ b/src/app/qgisappinterface.cpp @@ -47,7 +47,7 @@ QgisAppInterface::QgisAppInterface( QgisApp * _qgis ) : qgis( _qgis ) - , mTimer( NULL ) + , mTimer( nullptr ) , legendIface( _qgis->layerTreeView() ) , pluginManagerIface( _qgis->pluginManager() ) { @@ -363,18 +363,18 @@ QList QgisAppInterface::activeComposers() QgsComposerView* QgisAppInterface::createNewComposer( const QString& title ) { - QgsComposer* composerObj = 0; + QgsComposer* composerObj = nullptr; composerObj = qgis->createNewComposer( title ); if ( composerObj ) { return composerObj->view(); } - return 0; + return nullptr; } QgsComposerView* QgisAppInterface::duplicateComposer( QgsComposerView* composerView, const QString& title ) { - QgsComposer* composerObj = 0; + QgsComposer* composerObj = nullptr; composerObj = qobject_cast( composerView->composerWindow() ); if ( composerObj ) { @@ -384,14 +384,14 @@ QgsComposerView* QgisAppInterface::duplicateComposer( QgsComposerView* composerV return dupComposer->view(); } } - return 0; + return nullptr; } void QgisAppInterface::deleteComposer( QgsComposerView* composerView ) { composerView->composerWindow()->close(); - QgsComposer* composerObj = 0; + QgsComposer* composerObj = nullptr; composerObj = qobject_cast( composerView->composerWindow() ); if ( composerObj ) { @@ -452,7 +452,7 @@ QDialog* QgisAppInterface::showAttributeTable( QgsVectorLayer *l, const QString& dialog->show(); return dialog; } - return 0; + return nullptr; } void QgisAppInterface::addWindow( QAction *action ) @@ -580,7 +580,7 @@ QAction *QgisAppInterface::actionRollbackAllEdits() { return qgis->actionRollbac QAction *QgisAppInterface::actionCancelEdits() { return qgis->actionCancelEdits(); } QAction *QgisAppInterface::actionCancelAllEdits() { return qgis->actionCancelAllEdits(); } QAction *QgisAppInterface::actionLayerSaveAs() { return qgis->actionLayerSaveAs(); } -QAction *QgisAppInterface::actionLayerSelectionSaveAs() { return 0; } +QAction *QgisAppInterface::actionLayerSelectionSaveAs() { return nullptr; } QAction *QgisAppInterface::actionRemoveLayer() { return qgis->actionRemoveLayer(); } QAction *QgisAppInterface::actionDuplicateLayer() { return qgis->actionDuplicateLayer(); } QAction *QgisAppInterface::actionLayerProperties() { return qgis->actionLayerProperties(); } @@ -667,7 +667,7 @@ QgsAttributeDialog* QgisAppInterface::getFeatureForm( QgsVectorLayer *l, QgsFeat QgsAttributeEditorContext context; context.setDistanceArea( myDa ); context.setVectorLayerTools( qgis->vectorLayerTools() ); - QgsAttributeDialog *dialog = new QgsAttributeDialog( l, &feature, false, NULL, true, context ); + QgsAttributeDialog *dialog = new QgsAttributeDialog( l, &feature, false, nullptr, true, context ); if ( !feature.isValid() ) { dialog->setIsAddDialog( true ); diff --git a/src/app/qgisappstylesheet.h b/src/app/qgisappstylesheet.h index 71472d492b9..67f2418b23c 100644 --- a/src/app/qgisappstylesheet.h +++ b/src/app/qgisappstylesheet.h @@ -30,7 +30,7 @@ class APP_EXPORT QgisAppStyleSheet: public QObject Q_OBJECT public: - QgisAppStyleSheet( QObject * parent = 0 ); + QgisAppStyleSheet( QObject * parent = nullptr ); ~QgisAppStyleSheet(); /** Return changeable options built from settings and/or defaults */ diff --git a/src/app/qgsaddattrdialog.h b/src/app/qgsaddattrdialog.h index 2ce6ad4b06c..96802fb6d59 100644 --- a/src/app/qgsaddattrdialog.h +++ b/src/app/qgsaddattrdialog.h @@ -29,9 +29,9 @@ class APP_EXPORT QgsAddAttrDialog: public QDialog, private Ui::QgsAddAttrDialogB Q_OBJECT public: QgsAddAttrDialog( QgsVectorLayer *vlayer, - QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); + QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); QgsAddAttrDialog( const std::list& typelist, - QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); + QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); QgsField field() const; diff --git a/src/app/qgsaddtaborgroup.h b/src/app/qgsaddtaborgroup.h index fada507e9e6..19a14cb5a9c 100644 --- a/src/app/qgsaddtaborgroup.h +++ b/src/app/qgsaddtaborgroup.h @@ -33,7 +33,7 @@ class APP_EXPORT QgsAddTabOrGroup : public QDialog, private Ui::QgsAddTabOrGroup typedef QPair TabPair; public: - QgsAddTabOrGroup( QgsVectorLayer *lyr, const QList& tabList, QWidget *parent = 0 ); + QgsAddTabOrGroup( QgsVectorLayer *lyr, const QList& tabList, QWidget *parent = nullptr ); ~QgsAddTabOrGroup(); QString name(); diff --git a/src/app/qgsalignrasterdialog.cpp b/src/app/qgsalignrasterdialog.cpp index 1f499235073..de632bb8dae 100644 --- a/src/app/qgsalignrasterdialog.cpp +++ b/src/app/qgsalignrasterdialog.cpp @@ -27,7 +27,7 @@ static QgsMapLayer* _rasterLayer( const QString& filename ) if ( layer->type() == QgsMapLayer::RasterLayer && layer->source() == filename ) return layer; } - return 0; + return nullptr; } static QString _rasterLayerName( const QString& filename ) diff --git a/src/app/qgsalignrasterdialog.h b/src/app/qgsalignrasterdialog.h index 2184c4f6e96..d4664588c92 100644 --- a/src/app/qgsalignrasterdialog.h +++ b/src/app/qgsalignrasterdialog.h @@ -12,7 +12,7 @@ class QgsAlignRasterDialog : public QDialog, private Ui::QgsAlignRasterDialog { Q_OBJECT public: - explicit QgsAlignRasterDialog( QWidget *parent = 0 ); + explicit QgsAlignRasterDialog( QWidget *parent = nullptr ); ~QgsAlignRasterDialog(); signals: diff --git a/src/app/qgsannotationwidget.cpp b/src/app/qgsannotationwidget.cpp index bb5addb66a9..a1dce25c58e 100644 --- a/src/app/qgsannotationwidget.cpp +++ b/src/app/qgsannotationwidget.cpp @@ -24,7 +24,7 @@ #include -QgsAnnotationWidget::QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ): QWidget( parent, f ), mItem( item ), mMarkerSymbol( 0 ) +QgsAnnotationWidget::QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ): QWidget( parent, f ), mItem( item ), mMarkerSymbol( nullptr ) { setupUi( this ); @@ -79,7 +79,7 @@ void QgsAnnotationWidget::apply() mItem->setFrameColor( mFrameColorButton->color() ); mItem->setFrameBackgroundColor( mBackgroundColorButton->color() ); mItem->setMarkerSymbol( mMarkerSymbol ); - mMarkerSymbol = 0; //item takes ownership + mMarkerSymbol = nullptr; //item takes ownership mItem->update(); } } @@ -99,7 +99,7 @@ void QgsAnnotationWidget::on_mMapMarkerButton_clicked() return; } QgsMarkerSymbolV2* markerSymbol = mMarkerSymbol->clone(); - QgsSymbolV2SelectorDialog dlg( markerSymbol, QgsStyleV2::defaultStyle(), 0, this ); + QgsSymbolV2SelectorDialog dlg( markerSymbol, QgsStyleV2::defaultStyle(), nullptr, this ); if ( dlg.exec() == QDialog::Rejected ) { delete markerSymbol; diff --git a/src/app/qgsannotationwidget.h b/src/app/qgsannotationwidget.h index 6f04ae7de2a..1c0855d7d51 100644 --- a/src/app/qgsannotationwidget.h +++ b/src/app/qgsannotationwidget.h @@ -29,7 +29,7 @@ class APP_EXPORT QgsAnnotationWidget: public QWidget, private Ui::QgsAnnotationW { Q_OBJECT public: - QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsAnnotationWidget(); void apply(); diff --git a/src/app/qgsapplayertreeviewmenuprovider.cpp b/src/app/qgsapplayertreeviewmenuprovider.cpp index 9137ee04957..9609c4d02a0 100644 --- a/src/app/qgsapplayertreeviewmenuprovider.cpp +++ b/src/app/qgsapplayertreeviewmenuprovider.cpp @@ -357,8 +357,8 @@ void QgsAppLayerTreeViewMenuProvider::addCustomLayerActions( QMenu* menu, QgsMap // Mac doesn't have '&' keyboard shortcuts. menuName.remove( QChar( '&' ) ); #endif - QAction* before = 0; - QMenu* newMenu = 0; + QAction* before = nullptr; + QMenu* newMenu = nullptr; QString dst = menuName; dst.remove( QChar( '&' ) ); Q_FOREACH ( QMenu* menu, theMenus ) diff --git a/src/app/qgsattributeactiondialog.h b/src/app/qgsattributeactiondialog.h index 03419759090..5a0e7fcfb09 100644 --- a/src/app/qgsattributeactiondialog.h +++ b/src/app/qgsattributeactiondialog.h @@ -37,7 +37,7 @@ class APP_EXPORT QgsAttributeActionDialog: public QWidget, private Ui::QgsAttrib public: QgsAttributeActionDialog( QgsAttributeAction* actions, const QgsFields& fields, - QWidget* parent = 0 ); + QWidget* parent = nullptr ); ~QgsAttributeActionDialog() {} diff --git a/src/app/qgsattributetabledialog.cpp b/src/app/qgsattributetabledialog.cpp index 721efe6c123..e5e8adaed70 100644 --- a/src/app/qgsattributetabledialog.cpp +++ b/src/app/qgsattributetabledialog.cpp @@ -64,10 +64,10 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowFlags flags ) : QDialog( parent, flags ) - , mDock( 0 ) + , mDock( nullptr ) , mLayer( theLayer ) - , mRubberBand( 0 ) - , mCurrentSearchWidgetWrapper( 0 ) + , mRubberBand( nullptr ) + , mCurrentSearchWidgetWrapper( nullptr ) { setupUi( this ); @@ -275,7 +275,7 @@ void QgsAttributeTableDialog::closeEvent( QCloseEvent* event ) { QDialog::closeEvent( event ); - if ( mDock == NULL ) + if ( mDock == nullptr ) { QSettings settings; settings.setValue( "/Windows/BetterAttributeTable/geometry", saveGeometry() ); @@ -412,7 +412,7 @@ void QgsAttributeTableDialog::runFieldCalculation( QgsVectorLayer* layer, const if ( !calculationSuccess ) { - QMessageBox::critical( 0, tr( "Error" ), tr( "An error occured while evaluating the calculation string:\n%1" ).arg( error ) ); + QMessageBox::critical( nullptr, tr( "Error" ), tr( "An error occured while evaluating the calculation string:\n%1" ).arg( error ) ); mLayer->destroyEditCommand(); return; } @@ -424,7 +424,7 @@ void QgsAttributeTableDialog::replaceSearchWidget( QWidget* oldw, QWidget* neww { mFilterLayout->removeWidget( oldw ); oldw->setVisible( false ); - mFilterLayout->addWidget( neww, 0, 0, 0 ); + mFilterLayout->addWidget( neww, 0, 0, nullptr ); neww->setVisible( true ); } @@ -434,7 +434,7 @@ void QgsAttributeTableDialog::filterColumnChanged( QObject* filterAction ) mFilterButton->setPopupMode( QToolButton::InstantPopup ); // replace the search line edit with a search widget that is suited to the selected field // delete previous widget - if ( mCurrentSearchWidgetWrapper != 0 ) + if ( mCurrentSearchWidgetWrapper != nullptr ) { mCurrentSearchWidgetWrapper->widget()->setVisible( false ); delete mCurrentSearchWidgetWrapper; @@ -491,7 +491,7 @@ void QgsAttributeTableDialog::filterShowAll() mFilterButton->setDefaultAction( mActionShowAllFilter ); mFilterButton->setPopupMode( QToolButton::InstantPopup ); mFilterQuery->setVisible( false ); - if ( mCurrentSearchWidgetWrapper != 0 ) + if ( mCurrentSearchWidgetWrapper != nullptr ) { mCurrentSearchWidgetWrapper->widget()->setVisible( false ); } @@ -747,7 +747,7 @@ void QgsAttributeTableDialog::filterQueryChanged( const QString& query ) void QgsAttributeTableDialog::filterQueryAccepted() { if (( mFilterQuery->isVisible() && mFilterQuery->text().isEmpty() ) || - ( mCurrentSearchWidgetWrapper != 0 && mCurrentSearchWidgetWrapper->widget()->isVisible() + ( mCurrentSearchWidgetWrapper != nullptr && mCurrentSearchWidgetWrapper->widget()->isVisible() && mCurrentSearchWidgetWrapper->expression().isEmpty() ) ) { filterShowAll(); @@ -763,14 +763,14 @@ void QgsAttributeTableDialog::openConditionalStyles() void QgsAttributeTableDialog::setFilterExpression( const QString& filterString ) { - if ( mCurrentSearchWidgetWrapper == 0 || !mCurrentSearchWidgetWrapper->applyDirectly() ) + if ( mCurrentSearchWidgetWrapper == nullptr || !mCurrentSearchWidgetWrapper->applyDirectly() ) { mFilterQuery->setText( filterString ); mFilterButton->setDefaultAction( mActionAdvancedFilter ); mFilterButton->setPopupMode( QToolButton::MenuButtonPopup ); mFilterQuery->setVisible( true ); mApplyFilterButton->setVisible( true ); - if ( mCurrentSearchWidgetWrapper != 0 ) + if ( mCurrentSearchWidgetWrapper != nullptr ) { // replace search widget widget with the normal filter query line edit replaceSearchWidget( mCurrentSearchWidgetWrapper->widget(), mFilterQuery ); diff --git a/src/app/qgsattributetabledialog.h b/src/app/qgsattributetabledialog.h index 3743d14fd39..b33c3ebdbc5 100644 --- a/src/app/qgsattributetabledialog.h +++ b/src/app/qgsattributetabledialog.h @@ -53,7 +53,7 @@ class APP_EXPORT QgsAttributeTableDialog : public QDialog, private Ui::QgsAttrib * @param parent parent object * @param flags window flags */ - QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWidget *parent = 0, Qt::WindowFlags flags = Qt::Window ); + QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::Window ); ~QgsAttributeTableDialog(); /** @@ -227,7 +227,7 @@ class QgsAttributeTableDock : public QDockWidget Q_OBJECT public: - QgsAttributeTableDock( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 ); + QgsAttributeTableDock( const QString & title, QWidget * parent = nullptr, Qt::WindowFlags flags = nullptr ); virtual void closeEvent( QCloseEvent * ev ) override; }; diff --git a/src/app/qgsbookmarks.h b/src/app/qgsbookmarks.h index d82373888c3..5e242c3e102 100644 --- a/src/app/qgsbookmarks.h +++ b/src/app/qgsbookmarks.h @@ -27,7 +27,7 @@ class APP_EXPORT QgsBookmarks : public QDockWidget, private Ui::QgsBookmarksBase Q_OBJECT public: - QgsBookmarks( QWidget *parent = 0 ); + QgsBookmarks( QWidget *parent = nullptr ); ~QgsBookmarks(); public slots: diff --git a/src/app/qgsbrowserdockwidget.cpp b/src/app/qgsbrowserdockwidget.cpp index 977ba1609fd..7487482a730 100644 --- a/src/app/qgsbrowserdockwidget.cpp +++ b/src/app/qgsbrowserdockwidget.cpp @@ -76,7 +76,7 @@ void QgsBrowserPropertiesWidget::setWidget( QWidget* paramWidget ) QgsBrowserPropertiesWidget* QgsBrowserPropertiesWidget::createWidget( QgsDataItem* item, QWidget* parent ) { - QgsBrowserPropertiesWidget* propertiesWidget = 0; + QgsBrowserPropertiesWidget* propertiesWidget = nullptr; // In general, we would like to show all items' paramWidget, but top level items like // WMS etc. have currently too large widgets which do not fit well to browser properties widget if ( item->type() == QgsDataItem::Directory ) @@ -141,7 +141,7 @@ void QgsBrowserLayerProperties::setItem( QgsDataItem* item ) QgsDebugMsg( "creating raster layer" ); // should copy code from addLayer() to split uri ? QgsRasterLayer* layer = new QgsRasterLayer( layerItem->uri(), layerItem->uri(), layerItem->providerKey() ); - if ( layer != NULL ) + if ( layer != nullptr ) { if ( layer->isValid() ) { @@ -155,7 +155,7 @@ void QgsBrowserLayerProperties::setItem( QgsDataItem* item ) { QgsDebugMsg( "creating vector layer" ); QgsVectorLayer* layer = new QgsVectorLayer( layerItem->uri(), layerItem->name(), layerItem->providerKey() ); - if ( layer != NULL ) + if ( layer != nullptr ) { if ( layer->isValid() ) { @@ -217,7 +217,7 @@ void QgsBrowserLayerProperties::setCondensedMode( bool condensedMode ) QgsBrowserDirectoryProperties::QgsBrowserDirectoryProperties( QWidget* parent ) : QgsBrowserPropertiesWidget( parent ) - , mDirectoryWidget( 0 ) + , mDirectoryWidget( nullptr ) { setupUi( this ); @@ -238,7 +238,7 @@ void QgsBrowserDirectoryProperties::setItem( QgsDataItem* item ) QgsBrowserPropertiesDialog::QgsBrowserPropertiesDialog( const QString& settingsSection, QWidget* parent ) : QDialog( parent ) - , mPropertiesWidget( 0 ) + , mPropertiesWidget( nullptr ) , mSettingsSection( settingsSection ) { setupUi( this ); @@ -264,8 +264,8 @@ void QgsBrowserPropertiesDialog::setItem( QgsDataItem* item ) QgsBrowserDockWidget::QgsBrowserDockWidget( const QString& name, QWidget * parent ) : QDockWidget( parent ) - , mModel( 0 ) - , mProxyModel( 0 ) + , mModel( nullptr ) + , mProxyModel( nullptr ) , mPropertiesWidgetEnabled( false ) , mPropertiesWidgetHeight( 0 ) { @@ -511,7 +511,7 @@ void QgsBrowserDockWidget::refreshModel( const QModelIndex& index ) void QgsBrowserDockWidget::addLayer( QgsLayerItem *layerItem ) { - if ( layerItem == NULL ) + if ( layerItem == nullptr ) return; QString uri = QgisApp::instance()->crsAndFormatAdjustedLayerUri( layerItem->uri(), layerItem->supportedCRS(), layerItem->supportedFormats() ); @@ -541,20 +541,20 @@ void QgsBrowserDockWidget::addLayerAtIndex( const QModelIndex& index ) QgsDebugMsg( QString( "rowCount() = %1" ).arg( mModel->rowCount( mProxyModel->mapToSource( index ) ) ) ); QgsDataItem *item = mModel->dataItem( mProxyModel->mapToSource( index ) ); - if ( item != NULL && item->type() == QgsDataItem::Project ) + if ( item != nullptr && item->type() == QgsDataItem::Project ) { QgsProjectItem *projectItem = qobject_cast( item ); - if ( projectItem != NULL ) + if ( projectItem != nullptr ) { QApplication::setOverrideCursor( Qt::WaitCursor ); QgisApp::instance()->openFile( projectItem->path() ); QApplication::restoreOverrideCursor(); } } - if ( item != NULL && item->type() == QgsDataItem::Layer ) + if ( item != nullptr && item->type() == QgsDataItem::Layer ) { QgsLayerItem *layerItem = qobject_cast( item ); - if ( layerItem != NULL ) + if ( layerItem != nullptr ) { QApplication::setOverrideCursor( Qt::WaitCursor ); addLayer( layerItem ); @@ -808,7 +808,7 @@ void QgsDockBrowserTreeView::dragMoveEvent( QDragMoveEvent* e ) // QgsBrowserTreeFilterProxyModel::QgsBrowserTreeFilterProxyModel( QObject* parent ) - : QSortFilterProxyModel( parent ), mModel( 0 ) + : QSortFilterProxyModel( parent ), mModel( nullptr ) , mFilter( "" ), mPatternSyntax( "normal" ), mCaseSensitivity( Qt::CaseInsensitive ) { setDynamicSortFilter( true ); diff --git a/src/app/qgsbrowserdockwidget.h b/src/app/qgsbrowserdockwidget.h index be30ffd2dfa..04db99918e3 100644 --- a/src/app/qgsbrowserdockwidget.h +++ b/src/app/qgsbrowserdockwidget.h @@ -37,7 +37,7 @@ class QgsBrowserPropertiesWrapLabel : public QTextEdit { Q_OBJECT public: - QgsBrowserPropertiesWrapLabel( const QString& text, QWidget* parent = 0 ); + QgsBrowserPropertiesWrapLabel( const QString& text, QWidget* parent = nullptr ); private slots: void adjustHeight( const QSizeF& size ); @@ -47,8 +47,8 @@ class QgsBrowserPropertiesWidget : public QWidget { Q_OBJECT public: - explicit QgsBrowserPropertiesWidget( QWidget* parent = 0 ); - static QgsBrowserPropertiesWidget* createWidget( QgsDataItem* item, QWidget* parent = 0 ); + explicit QgsBrowserPropertiesWidget( QWidget* parent = nullptr ); + static QgsBrowserPropertiesWidget* createWidget( QgsDataItem* item, QWidget* parent = nullptr ); virtual void setItem( QgsDataItem* item ) { Q_UNUSED( item ) } /** Set content widget, usually item paramWidget. Takes ownership. */ virtual void setWidget( QWidget* widget ); @@ -65,7 +65,7 @@ class QgsBrowserLayerProperties : public QgsBrowserPropertiesWidget, private Ui: { Q_OBJECT public: - explicit QgsBrowserLayerProperties( QWidget* parent = 0 ); + explicit QgsBrowserLayerProperties( QWidget* parent = nullptr ); void setItem( QgsDataItem* item ) override; virtual void setCondensedMode( bool condensedMode ) override; @@ -78,7 +78,7 @@ class QgsBrowserDirectoryProperties : public QgsBrowserPropertiesWidget , privat { Q_OBJECT public: - explicit QgsBrowserDirectoryProperties( QWidget* parent = 0 ); + explicit QgsBrowserDirectoryProperties( QWidget* parent = nullptr ); void setItem( QgsDataItem* item ) override; private: @@ -90,7 +90,7 @@ class QgsBrowserPropertiesDialog : public QDialog , private Ui::QgsBrowserProper { Q_OBJECT public: - QgsBrowserPropertiesDialog( const QString& settingsSection, QWidget* parent = 0 ); + QgsBrowserPropertiesDialog( const QString& settingsSection, QWidget* parent = nullptr ); ~QgsBrowserPropertiesDialog(); void setItem( QgsDataItem* item ); @@ -104,7 +104,7 @@ class APP_EXPORT QgsBrowserDockWidget : public QDockWidget, private Ui::QgsBrows { Q_OBJECT public: - explicit QgsBrowserDockWidget( const QString& name, QWidget *parent = 0 ); + explicit QgsBrowserDockWidget( const QString& name, QWidget *parent = nullptr ); ~QgsBrowserDockWidget(); void addFavouriteDirectory( const QString& favDir ); diff --git a/src/app/qgsclipboard.cpp b/src/app/qgsclipboard.cpp index 20da58542f8..3fff0e5bea4 100644 --- a/src/app/qgsclipboard.cpp +++ b/src/app/qgsclipboard.cpp @@ -255,7 +255,7 @@ void QgsClipboard::setData( const QString& mimeType, const QByteArray& data, con void QgsClipboard::setData( const QString& mimeType, const QByteArray& data ) { - setData( mimeType, data, 0 ); + setData( mimeType, data, nullptr ); } bool QgsClipboard::hasFormat( const QString& mimeType ) diff --git a/src/app/qgsclipboard.h b/src/app/qgsclipboard.h index 804b95cfc97..ea747768c64 100644 --- a/src/app/qgsclipboard.h +++ b/src/app/qgsclipboard.h @@ -112,7 +112,7 @@ class APP_EXPORT QgsClipboard : public QObject /* * Stores a MimeData together with a text into the system clipboard */ - void setData( const QString& mimeType, const QByteArray& data, const QString* text = 0 ); + void setData( const QString& mimeType, const QByteArray& data, const QString* text = nullptr ); /* * Stores a MimeData together with a text into the system clipboard */ diff --git a/src/app/qgsconfigureshortcutsdialog.cpp b/src/app/qgsconfigureshortcutsdialog.cpp index cfa0219a1a9..89359095b83 100644 --- a/src/app/qgsconfigureshortcutsdialog.cpp +++ b/src/app/qgsconfigureshortcutsdialog.cpp @@ -94,7 +94,7 @@ void QgsConfigureShortcutsDialog::populateActions() treeActions->resizeColumnToContents( 0 ); treeActions->sortItems( 0, Qt::AscendingOrder ); - actionChanged( treeActions->currentItem(), NULL ); + actionChanged( treeActions->currentItem(), nullptr ); } void QgsConfigureShortcutsDialog::saveShortcuts() @@ -255,8 +255,8 @@ void QgsConfigureShortcutsDialog::setNoShortcut() QAction* QgsConfigureShortcutsDialog::currentAction() { - if ( treeActions->currentItem() == NULL ) - return NULL; + if ( treeActions->currentItem() == nullptr ) + return nullptr; QObject* action = treeActions->currentItem()->data( 0, Qt::UserRole ).value(); return qobject_cast( action ); @@ -397,7 +397,7 @@ void QgsConfigureShortcutsDialog::setCurrentActionShortcut( const QKeySequence& // first check whether this action is not taken already QAction* otherAction = QgsShortcutsManager::instance()->actionForShortcut( s ); - if ( otherAction != NULL ) + if ( otherAction != nullptr ) { QString otherActionText = otherAction->text(); otherActionText.remove( '&' ); // remove the accelerator @@ -422,5 +422,5 @@ void QgsConfigureShortcutsDialog::setCurrentActionShortcut( const QKeySequence& // update gui treeActions->currentItem()->setText( 1, s.toString() ); - actionChanged( treeActions->currentItem(), NULL ); + actionChanged( treeActions->currentItem(), nullptr ); } diff --git a/src/app/qgsconfigureshortcutsdialog.h b/src/app/qgsconfigureshortcutsdialog.h index f37386f27dd..c4b3bd7289e 100644 --- a/src/app/qgsconfigureshortcutsdialog.h +++ b/src/app/qgsconfigureshortcutsdialog.h @@ -25,7 +25,7 @@ class APP_EXPORT QgsConfigureShortcutsDialog : public QDialog, private Ui::QgsCo Q_OBJECT public: - QgsConfigureShortcutsDialog( QWidget* parent = NULL ); + QgsConfigureShortcutsDialog( QWidget* parent = nullptr ); ~QgsConfigureShortcutsDialog(); void populateActions(); diff --git a/src/app/qgscustomization.cpp b/src/app/qgscustomization.cpp index 4c72f3df1e6..fdbf96406dc 100644 --- a/src/app/qgscustomization.cpp +++ b/src/app/qgscustomization.cpp @@ -110,7 +110,7 @@ QTreeWidgetItem * QgsCustomizationDialog::item( const QString& thePath, QTreeWid } } QgsDebugMsg( "not found" ); - return 0; + return nullptr; } bool QgsCustomizationDialog::itemChecked( const QString& thePath ) @@ -314,19 +314,19 @@ QTreeWidgetItem * QgsCustomizationDialog::createTreeItemWidgets() QFile myFile( QgsApplication::pkgDataPath() + "/resources/customization.xml" ); if ( !myFile.open( QIODevice::ReadOnly ) ) { - return NULL; + return nullptr; } if ( !myDoc.setContent( &myFile ) ) { myFile.close(); - return NULL; + return nullptr; } myFile.close(); QDomElement myRoot = myDoc.documentElement(); if ( myRoot.tagName() != "qgiswidgets" ) { - return NULL; + return nullptr; } QTreeWidgetItem *myItem = readWidgetsXmlNode( myRoot ); // Do not translate "Widgets", currently it is also used as path @@ -615,10 +615,10 @@ void QgsCustomization::createTreeItemStatus() QStringList QgsCustomization::mInternalWidgets = QStringList() << "qt_tabwidget_stackedwidget" << "qt_tabwidget_tabbar"; -QgsCustomization *QgsCustomization::pinstance = 0; +QgsCustomization *QgsCustomization::pinstance = nullptr; QgsCustomization *QgsCustomization::instance() { - if ( pinstance == 0 ) + if ( pinstance == nullptr ) { pinstance = new QgsCustomization(); } @@ -626,9 +626,9 @@ QgsCustomization *QgsCustomization::instance() } QgsCustomization::QgsCustomization() - : pDialog( 0 ) + : pDialog( nullptr ) , mEnabled( false ) - , mSettings( NULL ) + , mSettings( nullptr ) , mStatusPath( "/Customization/status" ) { QgsDebugMsg( "Entered" ); diff --git a/src/app/qgscustomization.h b/src/app/qgscustomization.h index 4e5c35d7144..a50b640aa1c 100644 --- a/src/app/qgscustomization.h +++ b/src/app/qgscustomization.h @@ -38,7 +38,7 @@ class APP_EXPORT QgsCustomizationDialog : public QMainWindow, private Ui::QgsCus ~QgsCustomizationDialog(); // get item by path - QTreeWidgetItem *item( const QString& thePath, QTreeWidgetItem *theItem = 0 ); + QTreeWidgetItem *item( const QString& thePath, QTreeWidgetItem *theItem = nullptr ); // diff --git a/src/app/qgscustomprojectiondialog.cpp b/src/app/qgscustomprojectiondialog.cpp index 5527f1d3ca4..9c13255193d 100644 --- a/src/app/qgscustomprojectiondialog.cpp +++ b/src/app/qgscustomprojectiondialog.cpp @@ -89,7 +89,7 @@ void QgsCustomProjectionDialog::populateList() sqlite3_stmt *myPreparedStatement; int myResult; //check the db is available - myResult = sqlite3_open_v2( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL ); + myResult = sqlite3_open_v2( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, nullptr ); if ( myResult != SQLITE_OK ) { QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) ); @@ -463,7 +463,7 @@ void QgsCustomProjectionDialog::on_pbnCalculate_clicked() QgsDebugMsg( QString( "My proj: %1" ).arg( teParameters->toPlainText() ) ); - if ( myProj == NULL ) + if ( myProj == nullptr ) { QMessageBox::information( this, tr( "QGIS Custom Projection" ), tr( "This proj4 projection definition is not valid." ) ); @@ -490,7 +490,7 @@ void QgsCustomProjectionDialog::on_pbnCalculate_clicked() projPJ wgs84Proj = pj_init_plus( GEOPROJ4.toLocal8Bit().data() ); //defined in qgis.h - if ( wgs84Proj == NULL ) + if ( wgs84Proj == nullptr ) { QMessageBox::information( this, tr( "QGIS Custom Projection" ), tr( "Internal Error (source projection invalid?)" ) ); diff --git a/src/app/qgscustomprojectiondialog.h b/src/app/qgscustomprojectiondialog.h index 08f2988ebef..b4d9693810f 100644 --- a/src/app/qgscustomprojectiondialog.h +++ b/src/app/qgscustomprojectiondialog.h @@ -33,7 +33,7 @@ class APP_EXPORT QgsCustomProjectionDialog : public QDialog, private Ui::QgsCust { Q_OBJECT public: - QgsCustomProjectionDialog( QWidget *parent = 0, Qt::WindowFlags fl = 0 ); + QgsCustomProjectionDialog( QWidget *parent = nullptr, Qt::WindowFlags fl = nullptr ); ~QgsCustomProjectionDialog(); public slots: diff --git a/src/app/qgsdecorationcopyright.h b/src/app/qgsdecorationcopyright.h index f024df306e7..f11d586d250 100644 --- a/src/app/qgsdecorationcopyright.h +++ b/src/app/qgsdecorationcopyright.h @@ -35,7 +35,7 @@ class APP_EXPORT QgsDecorationCopyright : public QgsDecorationItem public: //! Constructor - QgsDecorationCopyright( QObject* parent = NULL ); + QgsDecorationCopyright( QObject* parent = nullptr ); //! Destructor virtual ~QgsDecorationCopyright(); diff --git a/src/app/qgsdecorationcopyrightdialog.h b/src/app/qgsdecorationcopyrightdialog.h index f509d6d3b52..7ca5c5ece2a 100644 --- a/src/app/qgsdecorationcopyrightdialog.h +++ b/src/app/qgsdecorationcopyrightdialog.h @@ -24,7 +24,7 @@ class APP_EXPORT QgsDecorationCopyrightDialog : public QDialog, private Ui::QgsD Q_OBJECT public: - QgsDecorationCopyrightDialog( QgsDecorationCopyright& deco, QWidget* parent = 0 ); + QgsDecorationCopyrightDialog( QgsDecorationCopyright& deco, QWidget* parent = nullptr ); ~QgsDecorationCopyrightDialog(); private slots: diff --git a/src/app/qgsdecorationgrid.cpp b/src/app/qgsdecorationgrid.cpp index d37ec25f042..bad08137f5e 100644 --- a/src/app/qgsdecorationgrid.cpp +++ b/src/app/qgsdecorationgrid.cpp @@ -59,8 +59,8 @@ QgsDecorationGrid::QgsDecorationGrid( QObject* parent ) { setName( "Grid" ); - mLineSymbol = 0; - mMarkerSymbol = 0; + mLineSymbol = nullptr; + mMarkerSymbol = nullptr; projectRead(); connect( QgisApp::instance()->mapCanvas(), SIGNAL( mapUnitsChanged() ), @@ -129,7 +129,7 @@ void QgsDecorationGrid::projectRead() QString xml; if ( mLineSymbol ) - setLineSymbol( 0 ); + setLineSymbol( nullptr ); xml = QgsProject::instance()->readEntry( mNameConfig, "/LineSymbol" ); if ( xml != "" ) { @@ -141,7 +141,7 @@ void QgsDecorationGrid::projectRead() mLineSymbol = new QgsLineSymbolV2(); if ( mMarkerSymbol ) - setMarkerSymbol( 0 ); + setMarkerSymbol( nullptr ); xml = QgsProject::instance()->readEntry( mNameConfig, "/MarkerSymbol" ); if ( xml != "" ) { @@ -234,7 +234,7 @@ void QgsDecorationGrid::render( QPainter * p ) QgsRenderContext context = QgsRenderContext::fromMapSettings( QgisApp::instance()->mapCanvas()->mapSettings() ); context.setPainter( p ); - mLineSymbol->startRender( context, 0 ); + mLineSymbol->startRender( context, nullptr ); for ( ; vIt != verticalLines.constEnd(); ++vIt ) { @@ -242,7 +242,7 @@ void QgsDecorationGrid::render( QPainter * p ) // need to convert QLineF to QPolygonF ... QVector poly; poly << vIt->second.p1() << vIt->second.p2(); - mLineSymbol->renderPolyline( QPolygonF( poly ), 0, context ); + mLineSymbol->renderPolyline( QPolygonF( poly ), nullptr, context ); } for ( ; hIt != horizontalLines.constEnd(); ++hIt ) @@ -251,7 +251,7 @@ void QgsDecorationGrid::render( QPainter * p ) // need to convert QLineF to QPolygonF ... QVector poly; poly << hIt->second.p1() << hIt->second.p2(); - mLineSymbol->renderPolyline( QPolygonF( poly ), 0, context ); + mLineSymbol->renderPolyline( QPolygonF( poly ), nullptr, context ); } mLineSymbol->stopRender( context ); @@ -312,7 +312,7 @@ void QgsDecorationGrid::render( QPainter * p ) QgsRenderContext context = QgsRenderContext::fromMapSettings( QgisApp::instance()->mapCanvas()->mapSettings() ); context.setPainter( p ); - mMarkerSymbol->startRender( context, 0 ); + mMarkerSymbol->startRender( context, nullptr ); QPointF intersectionPoint; for ( ; vIt != verticalLines.constEnd(); ++vIt ) @@ -323,7 +323,7 @@ void QgsDecorationGrid::render( QPainter * p ) { if ( hIt->second.intersect( vIt->second, &intersectionPoint ) == QLineF::BoundedIntersection ) { - mMarkerSymbol->renderPoint( intersectionPoint, 0, context ); + mMarkerSymbol->renderPoint( intersectionPoint, nullptr, context ); } } } @@ -819,18 +819,18 @@ bool QgsDecorationGrid::getIntervalFromCurrentLayer( double* values ) QgsMapLayer* layer = QgisApp::instance()->mapCanvas()->currentLayer(); if ( ! layer ) { - QMessageBox::warning( 0, tr( "Error" ), tr( "No active layer" ) ); + QMessageBox::warning( nullptr, tr( "Error" ), tr( "No active layer" ) ); return false; } if ( layer->type() != QgsMapLayer::RasterLayer ) { - QMessageBox::warning( 0, tr( "Error" ), tr( "Please select a raster layer" ) ); + QMessageBox::warning( nullptr, tr( "Error" ), tr( "Please select a raster layer" ) ); return false; } QgsRasterLayer* rlayer = dynamic_cast( layer ); if ( !rlayer || rlayer->width() == 0 || rlayer->height() == 0 ) { - QMessageBox::warning( 0, tr( "Error" ), tr( "Invalid raster layer" ) ); + QMessageBox::warning( nullptr, tr( "Error" ), tr( "Invalid raster layer" ) ); return false; } const QgsCoordinateReferenceSystem& layerCRS = layer->crs(); @@ -840,7 +840,7 @@ bool QgsDecorationGrid::getIntervalFromCurrentLayer( double* values ) // TODO calculate transformed values if necessary if ( layerCRS != mapCRS ) { - QMessageBox::warning( 0, tr( "Error" ), tr( "Layer CRS must be equal to project CRS" ) ); + QMessageBox::warning( nullptr, tr( "Error" ), tr( "Layer CRS must be equal to project CRS" ) ); return false; } diff --git a/src/app/qgsdecorationgrid.h b/src/app/qgsdecorationgrid.h index d34444596c7..f39174c551a 100644 --- a/src/app/qgsdecorationgrid.h +++ b/src/app/qgsdecorationgrid.h @@ -34,7 +34,7 @@ class APP_EXPORT QgsDecorationGrid: public QgsDecorationItem Q_OBJECT public: //! Constructor - QgsDecorationGrid( QObject* parent = NULL ); + QgsDecorationGrid( QObject* parent = nullptr ); //! Destructor virtual ~ QgsDecorationGrid(); diff --git a/src/app/qgsdecorationgriddialog.cpp b/src/app/qgsdecorationgriddialog.cpp index 3f39ec8a071..e255a3fabba 100644 --- a/src/app/qgsdecorationgriddialog.cpp +++ b/src/app/qgsdecorationgriddialog.cpp @@ -30,7 +30,7 @@ #include QgsDecorationGridDialog::QgsDecorationGridDialog( QgsDecorationGrid& deco, QWidget* parent ) - : QDialog( parent ), mDeco( deco ), mLineSymbol( 0 ), mMarkerSymbol( 0 ) + : QDialog( parent ), mDeco( deco ), mLineSymbol( nullptr ), mMarkerSymbol( nullptr ) { setupUi( this ); @@ -211,7 +211,7 @@ void QgsDecorationGridDialog::on_mLineSymbolButton_clicked() return; QgsLineSymbolV2* lineSymbol = mLineSymbol->clone(); - QgsSymbolV2SelectorDialog dlg( lineSymbol, QgsStyleV2::defaultStyle(), 0, this ); + QgsSymbolV2SelectorDialog dlg( lineSymbol, QgsStyleV2::defaultStyle(), nullptr, this ); if ( dlg.exec() == QDialog::Rejected ) { delete lineSymbol; @@ -234,7 +234,7 @@ void QgsDecorationGridDialog::on_mMarkerSymbolButton_clicked() return; QgsMarkerSymbolV2* markerSymbol = mMarkerSymbol->clone(); - QgsSymbolV2SelectorDialog dlg( markerSymbol, QgsStyleV2::defaultStyle(), 0, this ); + QgsSymbolV2SelectorDialog dlg( markerSymbol, QgsStyleV2::defaultStyle(), nullptr, this ); if ( dlg.exec() == QDialog::Rejected ) { delete markerSymbol; diff --git a/src/app/qgsdecorationgriddialog.h b/src/app/qgsdecorationgriddialog.h index 6cf8e97ea86..084353ed4c7 100644 --- a/src/app/qgsdecorationgriddialog.h +++ b/src/app/qgsdecorationgriddialog.h @@ -33,7 +33,7 @@ class APP_EXPORT QgsDecorationGridDialog : public QDialog, private Ui::QgsDecora Q_OBJECT public: - QgsDecorationGridDialog( QgsDecorationGrid& decoGrid, QWidget* parent = 0 ); + QgsDecorationGridDialog( QgsDecorationGrid& decoGrid, QWidget* parent = nullptr ); ~QgsDecorationGridDialog(); private slots: diff --git a/src/app/qgsdecorationitem.h b/src/app/qgsdecorationitem.h index 524c8026a33..ab0d6b4bdaf 100644 --- a/src/app/qgsdecorationitem.h +++ b/src/app/qgsdecorationitem.h @@ -28,7 +28,7 @@ class APP_EXPORT QgsDecorationItem: public QObject Q_OBJECT public: //! Constructor - QgsDecorationItem( QObject* parent = NULL ); + QgsDecorationItem( QObject* parent = nullptr ); //! Destructor virtual ~ QgsDecorationItem(); diff --git a/src/app/qgsdecorationnortharrow.h b/src/app/qgsdecorationnortharrow.h index 8fd17ed4514..671f5900e95 100644 --- a/src/app/qgsdecorationnortharrow.h +++ b/src/app/qgsdecorationnortharrow.h @@ -33,7 +33,7 @@ class APP_EXPORT QgsDecorationNorthArrow: public QgsDecorationItem public: //! Constructor - QgsDecorationNorthArrow( QObject* parent = NULL ); + QgsDecorationNorthArrow( QObject* parent = nullptr ); //! Destructor virtual ~QgsDecorationNorthArrow(); diff --git a/src/app/qgsdecorationnortharrowdialog.h b/src/app/qgsdecorationnortharrowdialog.h index 83a94365190..d39527baf39 100644 --- a/src/app/qgsdecorationnortharrowdialog.h +++ b/src/app/qgsdecorationnortharrowdialog.h @@ -21,7 +21,7 @@ class APP_EXPORT QgsDecorationNorthArrowDialog : public QDialog, private Ui::Qgs Q_OBJECT public: - QgsDecorationNorthArrowDialog( QgsDecorationNorthArrow& deco, QWidget* parent = 0 ); + QgsDecorationNorthArrowDialog( QgsDecorationNorthArrow& deco, QWidget* parent = nullptr ); ~QgsDecorationNorthArrowDialog(); private: diff --git a/src/app/qgsdecorationscalebar.h b/src/app/qgsdecorationscalebar.h index 1e302286764..c4f043f46dc 100644 --- a/src/app/qgsdecorationscalebar.h +++ b/src/app/qgsdecorationscalebar.h @@ -33,7 +33,7 @@ class APP_EXPORT QgsDecorationScaleBar: public QgsDecorationItem Q_OBJECT public: //! Constructor - QgsDecorationScaleBar( QObject* parent = NULL ); + QgsDecorationScaleBar( QObject* parent = nullptr ); //! Destructor virtual ~ QgsDecorationScaleBar(); diff --git a/src/app/qgsdecorationscalebardialog.h b/src/app/qgsdecorationscalebardialog.h index 35432091549..00c6617bbae 100644 --- a/src/app/qgsdecorationscalebardialog.h +++ b/src/app/qgsdecorationscalebardialog.h @@ -25,7 +25,7 @@ class APP_EXPORT QgsDecorationScaleBarDialog : public QDialog, private Ui::QgsDe Q_OBJECT public: - QgsDecorationScaleBarDialog( QgsDecorationScaleBar& deco, int units, QWidget* parent = 0 ); + QgsDecorationScaleBarDialog( QgsDecorationScaleBar& deco, int units, QWidget* parent = nullptr ); ~QgsDecorationScaleBarDialog(); private slots: diff --git a/src/app/qgsdiagramproperties.cpp b/src/app/qgsdiagramproperties.cpp index 62f6b013abd..9b745610b54 100644 --- a/src/app/qgsdiagramproperties.cpp +++ b/src/app/qgsdiagramproperties.cpp @@ -41,7 +41,7 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsExpressionContext expContext; expContext << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ) + << QgsExpressionContextUtils::atlasScope( nullptr ) << QgsExpressionContextUtils::mapSettingsScope( QgisApp::instance()->mapCanvas()->mapSettings() ); const QgsVectorLayer* layer = ( const QgsVectorLayer* ) context; @@ -584,7 +584,7 @@ void QgsDiagramProperties::on_mDiagramAttributesTreeWidget_itemDoubleClicked( QT { if ( column == 1 ) //change color { - QColor newColor = QgsColorDialogV2::getColor( item->background( 1 ).color(), 0 ); + QColor newColor = QgsColorDialogV2::getColor( item->background( 1 ).color(), nullptr ); if ( newColor.isValid() ) { item->setBackground( 1, QBrush( newColor ) ); @@ -602,7 +602,7 @@ void QgsDiagramProperties::apply() { bool diagramsEnabled = mEnableDiagramsCheckBox->isChecked(); - QgsDiagram* diagram = 0; + QgsDiagram* diagram = nullptr; int index = mDiagramTypeComboBox->currentIndex(); QString diagramType = mDiagramTypeComboBox->itemData( index ).toString(); @@ -800,7 +800,7 @@ void QgsDiagramProperties::showAddAttributeExpressionDialog() QgsExpressionContext context; context << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ) + << QgsExpressionContextUtils::atlasScope( nullptr ) << QgsExpressionContextUtils::mapSettingsScope( QgisApp::instance()->mapCanvas()->mapSettings() ) << QgsExpressionContextUtils::layerScope( mLayer ); diff --git a/src/app/qgsdisplayangle.h b/src/app/qgsdisplayangle.h index a1e39e721b6..db7ba80a064 100644 --- a/src/app/qgsdisplayangle.h +++ b/src/app/qgsdisplayangle.h @@ -25,7 +25,7 @@ class APP_EXPORT QgsDisplayAngle: public QDialog, private Ui::QgsDisplayAngleBas Q_OBJECT public: - QgsDisplayAngle( QgsMapToolMeasureAngle * tool = 0, Qt::WindowFlags f = 0 ); + QgsDisplayAngle( QgsMapToolMeasureAngle * tool = nullptr, Qt::WindowFlags f = nullptr ); ~QgsDisplayAngle(); /** Sets the measured angle value (in radians). The value is going to be converted to degrees / gon automatically if necessary*/ diff --git a/src/app/qgsdxfexportdialog.cpp b/src/app/qgsdxfexportdialog.cpp index c6e61f23bd6..b425a94df3c 100644 --- a/src/app/qgsdxfexportdialog.cpp +++ b/src/app/qgsdxfexportdialog.cpp @@ -44,11 +44,11 @@ QWidget *FieldSelectorDelegate::createEditor( QWidget *parent, const QStyleOptio const QgsVectorLayerAndAttributeModel *m = qobject_cast< const QgsVectorLayerAndAttributeModel *>( index.model() ); if ( !m ) - return 0; + return nullptr; QgsVectorLayer *vl = m->vectorLayer( index ); if ( !vl ) - return 0; + return nullptr; QgsFieldComboBox *w = new QgsFieldComboBox( parent ); @@ -123,7 +123,7 @@ QgsVectorLayer *QgsVectorLayerAndAttributeModel::vectorLayer( const QModelIndex { QgsLayerTreeNode *n = index2node( idx ); if ( !n || !QgsLayerTree::isLayer( n ) ) - return 0; + return nullptr; return dynamic_cast( QgsLayerTree::toLayer( n )->layer() ); } @@ -358,7 +358,7 @@ void QgsVectorLayerAndAttributeModel::applyVisibilityPreset( const QString &name void QgsVectorLayerAndAttributeModel::applyVisibility( QSet &visibleLayers, QgsLayerTreeNode *node ) { - QgsLayerTreeGroup *group = QgsLayerTree::isGroup( node ) ? QgsLayerTree::toGroup( node ) : 0; + QgsLayerTreeGroup *group = QgsLayerTree::isGroup( node ) ? QgsLayerTree::toGroup( node ) : nullptr; if ( !group ) return; @@ -428,7 +428,7 @@ QgsDxfExportDialog::QgsDxfExportDialog( QWidget *parent, Qt::WindowFlags f ) mTreeView->setItemDelegate( mFieldSelectorDelegate ); QgsLayerTreeModel *model = new QgsVectorLayerAndAttributeModel( mLayerTreeGroup, this ); - model->setFlags( 0 ); + model->setFlags( nullptr ); mTreeView->setModel( model ); mTreeView->resizeColumnToContents( 0 ); mTreeView->header()->show(); @@ -477,7 +477,7 @@ void QgsDxfExportDialog::on_mVisibilityPresets_currentIndexChanged( int index ) void QgsDxfExportDialog::cleanGroup( QgsLayerTreeNode *node ) { - QgsLayerTreeGroup *group = QgsLayerTree::isGroup( node ) ? QgsLayerTree::toGroup( node ) : 0; + QgsLayerTreeGroup *group = QgsLayerTree::isGroup( node ) ? QgsLayerTree::toGroup( node ) : nullptr; if ( !group ) return; @@ -553,7 +553,7 @@ void QgsDxfExportDialog::on_mFileSelectionButton_clicked() QSettings s; QString lastSavePath = s.value( "qgis/lastDxfDir", QDir::homePath() ).toString(); - QString filePath = QFileDialog::getSaveFileName( 0, tr( "Export as DXF" ), lastSavePath, tr( "DXF files *.dxf *.DXF" ) ); + QString filePath = QFileDialog::getSaveFileName( nullptr, tr( "Export as DXF" ), lastSavePath, tr( "DXF files *.dxf *.DXF" ) ); if ( !filePath.isEmpty() ) { mFileLineEdit->setText( filePath ); diff --git a/src/app/qgsdxfexportdialog.h b/src/app/qgsdxfexportdialog.h index 0feca7ac1d3..3ba6646b849 100644 --- a/src/app/qgsdxfexportdialog.h +++ b/src/app/qgsdxfexportdialog.h @@ -34,7 +34,7 @@ class FieldSelectorDelegate : public QItemDelegate { Q_OBJECT public: - explicit FieldSelectorDelegate( QObject *parent = 0 ); + explicit FieldSelectorDelegate( QObject *parent = nullptr ); QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; void setEditorData( QWidget *editor, const QModelIndex &index ) const override; @@ -45,7 +45,7 @@ class QgsVectorLayerAndAttributeModel : public QgsLayerTreeModel { Q_OBJECT public: - QgsVectorLayerAndAttributeModel( QgsLayerTreeGroup* rootNode, QObject *parent = 0 ); + QgsVectorLayerAndAttributeModel( QgsLayerTreeGroup* rootNode, QObject *parent = nullptr ); ~QgsVectorLayerAndAttributeModel(); int columnCount( const QModelIndex &parent = QModelIndex() ) const override; @@ -77,7 +77,7 @@ class QgsDxfExportDialog : public QDialog, private Ui::QgsDxfExportDialogBase { Q_OBJECT public: - QgsDxfExportDialog( QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsDxfExportDialog( QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsDxfExportDialog(); QList< QPair > layers() const; diff --git a/src/app/qgsfeatureaction.cpp b/src/app/qgsfeatureaction.cpp index a92a0e79974..25b5c98f3ec 100644 --- a/src/app/qgsfeatureaction.cpp +++ b/src/app/qgsfeatureaction.cpp @@ -60,7 +60,7 @@ QgsAttributeDialog *QgsFeatureAction::newDialog( bool cloneFeature ) context.setDistanceArea( myDa ); context.setVectorLayerTools( QgisApp::instance()->vectorLayerTools() ); - QgsAttributeDialog *dialog = new QgsAttributeDialog( mLayer, f, cloneFeature, NULL, true, context ); + QgsAttributeDialog *dialog = new QgsAttributeDialog( mLayer, f, cloneFeature, nullptr, true, context ); if ( mLayer->actions()->size() > 0 ) { @@ -201,7 +201,7 @@ bool QgsFeatureAction::addFeature( const QgsAttributeMap& defaultAttributes, boo { setParent( dialog ); // keep dialog until the dialog is closed and destructed dialog->show(); // will also delete the dialog on close (show() is overridden) - mFeature = 0; + mFeature = nullptr; return true; } diff --git a/src/app/qgsfeatureaction.h b/src/app/qgsfeatureaction.h index 771e31bb5a5..a0f2abcdcff 100644 --- a/src/app/qgsfeatureaction.h +++ b/src/app/qgsfeatureaction.h @@ -34,11 +34,11 @@ class APP_EXPORT QgsFeatureAction : public QAction Q_OBJECT public: - QgsFeatureAction( const QString &name, QgsFeature &f, QgsVectorLayer *vl, int action = -1, int defaultAttr = -1, QObject *parent = NULL ); + QgsFeatureAction( const QString &name, QgsFeature &f, QgsVectorLayer *vl, int action = -1, int defaultAttr = -1, QObject *parent = nullptr ); public slots: void execute(); - bool viewFeatureForm( QgsHighlight *h = 0 ); + bool viewFeatureForm( QgsHighlight *h = nullptr ); bool editFeature( bool showModal = true ); /** diff --git a/src/app/qgsfieldcalculator.cpp b/src/app/qgsfieldcalculator.cpp index b1c577349c8..d7e7073745e 100644 --- a/src/app/qgsfieldcalculator.cpp +++ b/src/app/qgsfieldcalculator.cpp @@ -170,7 +170,7 @@ void QgsFieldCalculator::accept() if ( !exp.prepare( &expContext ) ) { - QMessageBox::critical( 0, tr( "Evaluation error" ), exp.evalErrorString() ); + QMessageBox::critical( nullptr, tr( "Evaluation error" ), exp.evalErrorString() ); return; } @@ -219,7 +219,7 @@ void QgsFieldCalculator::accept() if ( !mVectorLayer->addAttribute( newField ) ) { QApplication::restoreOverrideCursor(); - QMessageBox::critical( 0, tr( "Provider error" ), tr( "Could not add the new field to the provider." ) ); + QMessageBox::critical( nullptr, tr( "Provider error" ), tr( "Could not add the new field to the provider." ) ); mVectorLayer->destroyEditCommand(); return; } @@ -241,7 +241,7 @@ void QgsFieldCalculator::accept() if ( ! exp.prepare( &expContext ) ) { QApplication::restoreOverrideCursor(); - QMessageBox::critical( 0, tr( "Evaluation error" ), exp.evalErrorString() ); + QMessageBox::critical( nullptr, tr( "Evaluation error" ), exp.evalErrorString() ); return; } } @@ -307,7 +307,7 @@ void QgsFieldCalculator::accept() if ( !calculationSuccess ) { - QMessageBox::critical( 0, tr( "Error" ), tr( "An error occured while evaluating the calculation string:\n%1" ).arg( error ) ); + QMessageBox::critical( nullptr, tr( "Error" ), tr( "An error occured while evaluating the calculation string:\n%1" ).arg( error ) ); mVectorLayer->destroyEditCommand(); return; } diff --git a/src/app/qgsfieldsproperties.cpp b/src/app/qgsfieldsproperties.cpp index 23102d54d14..9e4e9fbd49a 100644 --- a/src/app/qgsfieldsproperties.cpp +++ b/src/app/qgsfieldsproperties.cpp @@ -43,9 +43,9 @@ QgsFieldsProperties::QgsFieldsProperties( QgsVectorLayer *layer, QWidget* parent ) : QWidget( parent ) , mLayer( layer ) - , mDesignerTree( 0 ) - , mFieldsList( 0 ) - , mRelationsList( 0 ) + , mDesignerTree( nullptr ) + , mFieldsList( nullptr ) + , mRelationsList( nullptr ) { if ( !layer ) return; @@ -156,7 +156,7 @@ void QgsFieldsProperties::onAttributeSelectionChanged() QTreeWidgetItem *QgsFieldsProperties::loadAttributeEditorTreeItem( QgsAttributeEditorElement* const widgetDef, QTreeWidgetItem* parent ) { - QTreeWidgetItem* newWidget = 0; + QTreeWidgetItem* newWidget = nullptr; switch ( widgetDef->type() ) { case QgsAttributeEditorElement::AeTypeField: @@ -746,7 +746,7 @@ void QgsFieldsProperties::updateExpression() context << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope(); - QgsExpressionBuilderDialog dlg( mLayer, exp, 0, "generic", context ); + QgsExpressionBuilderDialog dlg( mLayer, exp, nullptr, "generic", context ); if ( dlg.exec() ) { @@ -808,7 +808,7 @@ QString QgsFieldsProperties::editTypeButtonText( QgsVectorLayer::EditType type ) QgsAttributeEditorElement* QgsFieldsProperties::createAttributeEditorWidget( QTreeWidgetItem* item, QObject *parent ) { - QgsAttributeEditorElement *widgetDef = 0; + QgsAttributeEditorElement *widgetDef = nullptr; DesignerTreeItemData itemData = item->data( 0, DesignerTreeRole ).value(); switch ( itemData.type() ) @@ -973,12 +973,12 @@ QgsFieldsProperties::FieldConfig::FieldConfig() : mEditable( true ) , mEditableEnabled( true ) , mLabelOnTop( false ) - , mButton( 0 ) + , mButton( nullptr ) { } QgsFieldsProperties::FieldConfig::FieldConfig( QgsVectorLayer* layer, int idx ) - : mButton( 0 ) + : mButton( nullptr ) { mEditable = !layer->editFormConfig()->readOnly( idx ); mEditableEnabled = layer->fields().fieldOrigin( idx ) != QgsFields::OriginJoin @@ -1001,12 +1001,12 @@ QStringList DragList::mimeTypes() const QMimeData* DragList::mimeData( const QList items ) const { if ( items.count() <= 0 ) - return 0; + return nullptr; QStringList types = mimeTypes(); if ( types.isEmpty() ) - return 0; + return nullptr; QMimeData* data = new QMimeData(); QString format = types.at( 0 ); @@ -1171,12 +1171,12 @@ QStringList DesignerTree::mimeTypes() const QMimeData* DesignerTree::mimeData( const QList items ) const { if ( items.count() <= 0 ) - return 0; + return nullptr; QStringList types = mimeTypes(); if ( types.isEmpty() ) - return 0; + return nullptr; QMimeData* data = new QMimeData(); QString format = types.at( 0 ); diff --git a/src/app/qgsfieldsproperties.h b/src/app/qgsfieldsproperties.h index fbb25a1e733..f752e73bd7a 100644 --- a/src/app/qgsfieldsproperties.h +++ b/src/app/qgsfieldsproperties.h @@ -91,7 +91,7 @@ class APP_EXPORT QgsFieldsProperties : public QWidget, private Ui_QgsFieldsPrope }; public: - QgsFieldsProperties( QgsVectorLayer *layer, QWidget* parent = 0 ); + QgsFieldsProperties( QgsVectorLayer *layer, QWidget* parent = nullptr ); ~QgsFieldsProperties(); @@ -225,7 +225,7 @@ class DragList : public QTableWidget Q_OBJECT public: - explicit DragList( QWidget* parent = 0 ) + explicit DragList( QWidget* parent = nullptr ) : QTableWidget( parent ) {} @@ -244,7 +244,7 @@ class DesignerTree : public QTreeWidget Q_OBJECT public: - explicit DesignerTree( QWidget* parent = 0 ) + explicit DesignerTree( QWidget* parent = nullptr ) : QTreeWidget( parent ) {} QTreeWidgetItem* addItem( QTreeWidgetItem* parent, QgsFieldsProperties::DesignerTreeItemData data ); diff --git a/src/app/qgsformannotationdialog.cpp b/src/app/qgsformannotationdialog.cpp index 4fea10c00e3..bc14b4c79c6 100644 --- a/src/app/qgsformannotationdialog.cpp +++ b/src/app/qgsformannotationdialog.cpp @@ -20,7 +20,7 @@ #include QgsFormAnnotationDialog::QgsFormAnnotationDialog( QgsFormAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ) - : QDialog( parent, f ), mItem( item ), mEmbeddedWidget( 0 ) + : QDialog( parent, f ), mItem( item ), mEmbeddedWidget( nullptr ) { setupUi( this ); mEmbeddedWidget = new QgsAnnotationWidget( mItem ); @@ -73,7 +73,7 @@ void QgsFormAnnotationDialog::on_mBrowseToolButton_clicked() { directory = fi.absolutePath(); } - QString filename = QFileDialog::getOpenFileName( 0, tr( "Qt designer file" ), directory, "*.ui" ); + QString filename = QFileDialog::getOpenFileName( nullptr, tr( "Qt designer file" ), directory, "*.ui" ); mFileLineEdit->setText( filename ); } @@ -85,6 +85,6 @@ void QgsFormAnnotationDialog::deleteItem() scene->removeItem( mItem ); } delete mItem; - mItem = 0; + mItem = nullptr; } diff --git a/src/app/qgsformannotationdialog.h b/src/app/qgsformannotationdialog.h index 0d121a89dca..13e0d8bca46 100644 --- a/src/app/qgsformannotationdialog.h +++ b/src/app/qgsformannotationdialog.h @@ -24,7 +24,7 @@ class APP_EXPORT QgsFormAnnotationDialog: public QDialog, private Ui::QgsFormAnn { Q_OBJECT public: - QgsFormAnnotationDialog( QgsFormAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsFormAnnotationDialog( QgsFormAnnotationItem* item, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsFormAnnotationDialog(); private: diff --git a/src/app/qgsguivectorlayertools.cpp b/src/app/qgsguivectorlayertools.cpp index d5f9afd6f5c..028f43ded61 100644 --- a/src/app/qgsguivectorlayertools.cpp +++ b/src/app/qgsguivectorlayertools.cpp @@ -29,7 +29,7 @@ QgsGuiVectorLayerTools::QgsGuiVectorLayerTools() - : QObject( NULL ) + : QObject( nullptr ) {} bool QgsGuiVectorLayerTools::addFeature( QgsVectorLayer* layer, const QgsAttributeMap& defaultValues, const QgsGeometry& defaultGeometry, QgsFeature* feat ) const @@ -106,7 +106,7 @@ bool QgsGuiVectorLayerTools::stopEditing( QgsVectorLayer* layer, bool allowCance if ( allowCancel ) buttons |= QMessageBox::Cancel; - switch ( QMessageBox::information( 0, + switch ( QMessageBox::information( nullptr, tr( "Stop editing" ), tr( "Do you want to save the changes to layer %1?" ).arg( layer->name() ), buttons ) ) diff --git a/src/app/qgsguivectorlayertools.h b/src/app/qgsguivectorlayertools.h index 4c6f0150821..da90b64b82d 100644 --- a/src/app/qgsguivectorlayertools.h +++ b/src/app/qgsguivectorlayertools.h @@ -39,7 +39,7 @@ class QgsGuiVectorLayerTools : public QObject, public QgsVectorLayerTools * * @return True in case of success, False if the operation failed/was aborted */ - bool addFeature( QgsVectorLayer *layer, const QgsAttributeMap& defaultValues, const QgsGeometry &defaultGeometry, QgsFeature* feat = 0 ) const override; + bool addFeature( QgsVectorLayer *layer, const QgsAttributeMap& defaultValues, const QgsGeometry &defaultGeometry, QgsFeature* feat = nullptr ) const override; /** * This should be called, whenever a vector layer should be switched to edit mode. If successful diff --git a/src/app/qgshtmlannotationdialog.cpp b/src/app/qgshtmlannotationdialog.cpp index 91af6ba2300..fbdd2f48638 100644 --- a/src/app/qgshtmlannotationdialog.cpp +++ b/src/app/qgshtmlannotationdialog.cpp @@ -20,7 +20,7 @@ #include QgsHtmlAnnotationDialog::QgsHtmlAnnotationDialog( QgsHtmlAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ) - : QDialog( parent, f ), mItem( item ), mEmbeddedWidget( 0 ) + : QDialog( parent, f ), mItem( item ), mEmbeddedWidget( nullptr ) { setupUi( this ); setWindowTitle( tr( "HTML annotation" ) ); @@ -78,7 +78,7 @@ void QgsHtmlAnnotationDialog::on_mBrowseToolButton_clicked() { directory = QDir::homePath(); } - QString filename = QFileDialog::getOpenFileName( 0, tr( "html" ), directory, "HTML (*.html *.htm);;All files (*.*)" ); + QString filename = QFileDialog::getOpenFileName( nullptr, tr( "html" ), directory, "HTML (*.html *.htm);;All files (*.*)" ); mFileLineEdit->setText( filename ); } @@ -90,6 +90,6 @@ void QgsHtmlAnnotationDialog::deleteItem() scene->removeItem( mItem ); } delete mItem; - mItem = 0; + mItem = nullptr; } diff --git a/src/app/qgshtmlannotationdialog.h b/src/app/qgshtmlannotationdialog.h index e702b39de07..1d3b28adcb9 100644 --- a/src/app/qgshtmlannotationdialog.h +++ b/src/app/qgshtmlannotationdialog.h @@ -24,7 +24,7 @@ class APP_EXPORT QgsHtmlAnnotationDialog: public QDialog, private Ui::QgsFormAnn { Q_OBJECT public: - QgsHtmlAnnotationDialog( QgsHtmlAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsHtmlAnnotationDialog( QgsHtmlAnnotationItem* item, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsHtmlAnnotationDialog(); private: diff --git a/src/app/qgsidentifyresultsdialog.cpp b/src/app/qgsidentifyresultsdialog.cpp index 6499c5fcf00..8ce3eef14d8 100644 --- a/src/app/qgsidentifyresultsdialog.cpp +++ b/src/app/qgsidentifyresultsdialog.cpp @@ -249,9 +249,9 @@ void QgsIdentifyResultsWebViewItem::loadFinished( bool ok ) QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidget *parent, Qt::WindowFlags f ) : QDialog( parent, f ) - , mActionPopup( 0 ) + , mActionPopup( nullptr ) , mCanvas( canvas ) - , mDock( NULL ) + , mDock( nullptr ) { setupUi( this ); @@ -366,7 +366,7 @@ QTreeWidgetItem *QgsIdentifyResultsDialog::layerItem( QObject *object ) return item; } - return 0; + return nullptr; } void QgsIdentifyResultsDialog::addFeature( const QgsMapToolIdentify::IdentifyResult& result ) @@ -385,7 +385,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat { QTreeWidgetItem *layItem = layerItem( vlayer ); - if ( layItem == 0 ) + if ( layItem == nullptr ) { layItem = new QTreeWidgetItem( QStringList() << vlayer->name() ); layItem->setData( 0, Qt::UserRole, QVariant::fromValue( qobject_cast( vlayer ) ) ); @@ -674,7 +674,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer, QgsRaster::IdentifyFormat currentFormat = QgsRasterDataProvider::identifyFormatFromName( layer->customProperty( "identify/format" ).toString() ); - if ( layItem == 0 ) + if ( layItem == nullptr ) { layItem = new QTreeWidgetItem( QStringList() << QString::number( lstResults->topLevelItemCount() ) << layer->name() ); layItem->setData( 0, Qt::UserRole, QVariant::fromValue( qobject_cast( layer ) ) ); @@ -933,7 +933,7 @@ void QgsIdentifyResultsDialog::contextMenuEvent( QContextMenuEvent* event ) QgsMapLayer *layer = vectorLayer( item ); QgsVectorLayer *vlayer = vectorLayer( item ); QgsRasterLayer *rlayer = rasterLayer( item ); - if ( vlayer == 0 && rlayer == 0 ) + if ( vlayer == nullptr && rlayer == nullptr ) { QgsDebugMsg( "Item does not belong to a layer." ); return; @@ -1191,9 +1191,9 @@ void QgsIdentifyResultsDialog::doMapLayerAction( QTreeWidgetItem *item, QgsMapLa QTreeWidgetItem *QgsIdentifyResultsDialog::featureItem( QTreeWidgetItem *item ) { if ( !item ) - return 0; + return nullptr; - QTreeWidgetItem *featItem = 0; + QTreeWidgetItem *featItem = nullptr; if ( item->parent() ) { if ( item->parent()->parent() ) @@ -1238,7 +1238,7 @@ QTreeWidgetItem *QgsIdentifyResultsDialog::featureItem( QTreeWidgetItem *item ) } if ( count != 1 ) - return 0; + return nullptr; } return featItem; @@ -1258,7 +1258,7 @@ QgsMapLayer *QgsIdentifyResultsDialog::layer( QTreeWidgetItem *item ) { item = layerItem( item ); if ( !item ) - return 0; + return nullptr; return qobject_cast( item->data( 0, Qt::UserRole ).value() ); } @@ -1266,7 +1266,7 @@ QgsVectorLayer *QgsIdentifyResultsDialog::vectorLayer( QTreeWidgetItem *item ) { item = layerItem( item ); if ( !item ) - return 0; + return nullptr; return qobject_cast( item->data( 0, Qt::UserRole ).value() ); } @@ -1274,7 +1274,7 @@ QgsRasterLayer *QgsIdentifyResultsDialog::rasterLayer( QTreeWidgetItem *item ) { item = layerItem( item ); if ( !item ) - return 0; + return nullptr; return qobject_cast( item->data( 0, Qt::UserRole ).value() ); } @@ -1282,7 +1282,7 @@ QTreeWidgetItem *QgsIdentifyResultsDialog::retrieveAttributes( QTreeWidgetItem * { QTreeWidgetItem *featItem = featureItem( item ); if ( !featItem ) - return 0; + return nullptr; idx = -1; @@ -1325,7 +1325,7 @@ void QgsIdentifyResultsDialog::handleCurrentItemChanged( QTreeWidgetItem *curren if ( !current ) { - emit selectedFeatureChanged( 0, 0 ); + emit selectedFeatureChanged( nullptr, 0 ); return; } @@ -1333,7 +1333,7 @@ void QgsIdentifyResultsDialog::handleCurrentItemChanged( QTreeWidgetItem *curren for ( int i = 0; i < current->childCount(); i++ ) { QgsIdentifyResultsWebViewItem *wv = dynamic_cast( current->child( i ) ); - if ( wv != 0 ) + if ( wv != nullptr ) { mActionPrint->setEnabled( true ); break; @@ -1505,7 +1505,7 @@ void QgsIdentifyResultsDialog::highlightFeature( QTreeWidgetItem *item ) if ( !featItem->feature().constGeometry() || featItem->feature().constGeometry()->wkbType() == QGis::WKBUnknown ) return; - QgsHighlight *highlight = 0; + QgsHighlight *highlight = nullptr; if ( vlayer ) { highlight = new QgsHighlight( mCanvas, featItem->feature(), vlayer ); @@ -1735,7 +1735,7 @@ void QgsIdentifyResultsDialog::printCurrentItem() return; // There should only be one HTML item / result - QgsIdentifyResultsWebViewItem *wv = 0; + QgsIdentifyResultsWebViewItem *wv = nullptr; for ( int i = 0; i < item->childCount() && !wv; i++ ) { wv = dynamic_cast( item->child( i ) ); diff --git a/src/app/qgsidentifyresultsdialog.h b/src/app/qgsidentifyresultsdialog.h index 8db3a0a0969..4fb3926fdd2 100644 --- a/src/app/qgsidentifyresultsdialog.h +++ b/src/app/qgsidentifyresultsdialog.h @@ -53,7 +53,7 @@ class APP_EXPORT QgsIdentifyResultsWebView : public QgsWebView { Q_OBJECT public: - QgsIdentifyResultsWebView( QWidget *parent = 0 ); + QgsIdentifyResultsWebView( QWidget *parent = nullptr ); QSize sizeHint() const override; public slots: void print( void ); @@ -81,7 +81,7 @@ class APP_EXPORT QgsIdentifyResultsWebViewItem: public QObject, public QTreeWidg Q_OBJECT public: - QgsIdentifyResultsWebViewItem( QTreeWidget *treeWidget = 0 ); + QgsIdentifyResultsWebViewItem( QTreeWidget *treeWidget = nullptr ); QgsIdentifyResultsWebView *webView() { return mWebView; } void setHtml( const QString &html ); /** @note added in 2.1 */ @@ -98,7 +98,7 @@ class APP_EXPORT QgsIdentifyPlotCurve { public: - QgsIdentifyPlotCurve() { mPlotCurve = 0; } + QgsIdentifyPlotCurve() { mPlotCurve = nullptr; } QgsIdentifyPlotCurve( const QMap &attributes, QwtPlot* plot, const QString &title = QString(), QColor color = QColor() ); ~QgsIdentifyPlotCurve(); @@ -115,7 +115,7 @@ class APP_EXPORT QgsIdentifyResultsDialog: public QDialog, private Ui::QgsIdenti //! Constructor - takes it own copy of the QgsAttributeAction so // that it is independent of whoever created it. - QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidget *parent = 0, Qt::WindowFlags f = 0 ); + QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidget *parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsIdentifyResultsDialog(); diff --git a/src/app/qgsjoindialog.h b/src/app/qgsjoindialog.h index e69f209b3d0..71f800d367b 100644 --- a/src/app/qgsjoindialog.h +++ b/src/app/qgsjoindialog.h @@ -27,7 +27,7 @@ class APP_EXPORT QgsJoinDialog: public QDialog, private Ui::QgsJoinDialogBase { Q_OBJECT public: - QgsJoinDialog( QgsVectorLayer* layer, QList alreadyJoinedLayers, QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsJoinDialog( QgsVectorLayer* layer, QList alreadyJoinedLayers, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsJoinDialog(); /** Configure the dialog for an existing join */ diff --git a/src/app/qgslabeldialog.h b/src/app/qgslabeldialog.h index 2c591ef0473..e3561b32454 100644 --- a/src/app/qgslabeldialog.h +++ b/src/app/qgslabeldialog.h @@ -28,7 +28,7 @@ class APP_EXPORT QgsLabelDialog: public QWidget, private Ui::QgsLabelDialogBase Q_OBJECT public: - QgsLabelDialog( QgsLabel *label, QWidget * parent = 0 ); + QgsLabelDialog( QgsLabel *label, QWidget * parent = nullptr ); ~QgsLabelDialog(); int itemNoForField( const QString& theFieldName, const QStringList& theFieldList ); diff --git a/src/app/qgslabelengineconfigdialog.h b/src/app/qgslabelengineconfigdialog.h index 9563d05fe81..79d42a047ba 100644 --- a/src/app/qgslabelengineconfigdialog.h +++ b/src/app/qgslabelengineconfigdialog.h @@ -24,7 +24,7 @@ class APP_EXPORT QgsLabelEngineConfigDialog : public QDialog, private Ui::QgsEng { Q_OBJECT public: - QgsLabelEngineConfigDialog( QWidget* parent = NULL ); + QgsLabelEngineConfigDialog( QWidget* parent = nullptr ); public slots: void onOK(); diff --git a/src/app/qgslabelinggui.cpp b/src/app/qgslabelinggui.cpp index 8de64980790..10275d13c34 100644 --- a/src/app/qgslabelinggui.cpp +++ b/src/app/qgslabelinggui.cpp @@ -43,7 +43,7 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsExpressionContext expContext; expContext << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ) + << QgsExpressionContextUtils::atlasScope( nullptr ) << QgsExpressionContextUtils::mapSettingsScope( QgisApp::instance()->mapCanvas()->mapSettings() ); const QgsVectorLayer* layer = ( const QgsVectorLayer* ) context; @@ -63,13 +63,13 @@ QgsLabelingGui::QgsLabelingGui( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, , mMapCanvas( mapCanvas ) , mSettings( layerSettings ) , mMode( NoLabels ) - , mCharDlg( 0 ) - , mQuadrantBtnGrp( 0 ) - , mDirectSymbBtnGrp( 0 ) - , mUpsidedownBtnGrp( 0 ) - , mPlacePointBtnGrp( 0 ) - , mPlaceLineBtnGrp( 0 ) - , mPlacePolygonBtnGrp( 0 ) + , mCharDlg( nullptr ) + , mQuadrantBtnGrp( nullptr ) + , mDirectSymbBtnGrp( nullptr ) + , mUpsidedownBtnGrp( nullptr ) + , mPlacePointBtnGrp( nullptr ) + , mPlaceLineBtnGrp( nullptr ) + , mPlacePolygonBtnGrp( nullptr ) , mPreviewSize( 24 ) , mMinPixelLimit( 0 ) , mLoadSvgParams( false ) diff --git a/src/app/qgslabelingwidget.cpp b/src/app/qgslabelingwidget.cpp index 7f115933e44..8c3fb5a5d8b 100644 --- a/src/app/qgslabelingwidget.cpp +++ b/src/app/qgslabelingwidget.cpp @@ -10,7 +10,7 @@ QgsLabelingWidget::QgsLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canva : QWidget( parent ) , mLayer( layer ) , mCanvas( canvas ) - , mWidget( 0 ) + , mWidget( nullptr ) { setupUi( this ); @@ -84,7 +84,7 @@ void QgsLabelingWidget::labelModeChanged( int index ) mStackedWidget->removeWidget( mWidget ); delete mWidget; - mWidget = 0; + mWidget = nullptr; if ( index == 3 ) { @@ -92,7 +92,7 @@ void QgsLabelingWidget::labelModeChanged( int index ) } else { - QgsLabelingGui* w = new QgsLabelingGui( mLayer, mCanvas, 0, this ); + QgsLabelingGui* w = new QgsLabelingGui( mLayer, mCanvas, nullptr, this ); w->setLabelMode(( QgsLabelingGui::LabelMode ) index ); w->init(); mWidget = w; diff --git a/src/app/qgslabelingwidget.h b/src/app/qgslabelingwidget.h index 7a45e412080..9344802b476 100644 --- a/src/app/qgslabelingwidget.h +++ b/src/app/qgslabelingwidget.h @@ -17,7 +17,7 @@ class QgsLabelingWidget : public QWidget, private Ui::QgsLabelingWidget { Q_OBJECT public: - QgsLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canvas, QWidget* parent = 0 ); + QgsLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canvas, QWidget* parent = nullptr ); public slots: //! save config to layer diff --git a/src/app/qgslabelpreview.h b/src/app/qgslabelpreview.h index 7b25ecdf6d3..8ecfd30eeb1 100644 --- a/src/app/qgslabelpreview.h +++ b/src/app/qgslabelpreview.h @@ -26,7 +26,7 @@ class APP_EXPORT QgsLabelPreview : public QLabel Q_OBJECT public: - QgsLabelPreview( QWidget* parent = NULL ); + QgsLabelPreview( QWidget* parent = nullptr ); void setTextColor( const QColor& color ); diff --git a/src/app/qgslabelpropertydialog.cpp b/src/app/qgslabelpropertydialog.cpp index b95a768b6a9..d902c25b961 100644 --- a/src/app/qgslabelpropertydialog.cpp +++ b/src/app/qgslabelpropertydialog.cpp @@ -148,7 +148,7 @@ void QgsLabelPropertyDialog::init( const QString& layerId, int featureId, const QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined* >::const_iterator it = layerSettings.dataDefinedProperties.constBegin(); for ( ; it != layerSettings.dataDefinedProperties.constEnd(); ++it ) { - mDataDefinedProperties.insert( it.key(), it.value() ? new QgsDataDefined( *it.value() ) : 0 ); + mDataDefinedProperties.insert( it.key(), it.value() ? new QgsDataDefined( *it.value() ) : nullptr ); } //set widget values from data defined results @@ -216,7 +216,7 @@ void QgsLabelPropertyDialog::setDataDefinedValues( const QgsPalLayerSettings &la QgsExpressionContext context; context << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ) + << QgsExpressionContextUtils::atlasScope( nullptr ) << QgsExpressionContextUtils::mapSettingsScope( QgisApp::instance()->mapCanvas()->mapSettings() ) << QgsExpressionContextUtils::layerScope( vlayer ); context.setFeature( mCurLabelFeat ); diff --git a/src/app/qgslabelpropertydialog.h b/src/app/qgslabelpropertydialog.h index 773984dedcf..fa2bd5c35c9 100644 --- a/src/app/qgslabelpropertydialog.h +++ b/src/app/qgslabelpropertydialog.h @@ -29,7 +29,7 @@ class APP_EXPORT QgsLabelPropertyDialog: public QDialog, private Ui::QgsLabelPro { Q_OBJECT public: - QgsLabelPropertyDialog( const QString& layerId, int featureId, const QFont& labelFont, const QString& labelText, QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsLabelPropertyDialog( const QString& layerId, int featureId, const QFont& labelFont, const QString& labelText, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsLabelPropertyDialog(); /** Returns properties changed by the user*/ diff --git a/src/app/qgsloadstylefromdbdialog.h b/src/app/qgsloadstylefromdbdialog.h index 37c38b3c6fc..fec17fc26d6 100644 --- a/src/app/qgsloadstylefromdbdialog.h +++ b/src/app/qgsloadstylefromdbdialog.h @@ -21,7 +21,7 @@ class APP_EXPORT QgsLoadStyleFromDBDialog : public QDialog, private Ui::QgsLoadS QString qmlStyle; Q_OBJECT public: - explicit QgsLoadStyleFromDBDialog( QWidget *parent = 0 ); + explicit QgsLoadStyleFromDBDialog( QWidget *parent = nullptr ); ~QgsLoadStyleFromDBDialog(); diff --git a/src/app/qgsmaplayerstyleguiutils.cpp b/src/app/qgsmaplayerstyleguiutils.cpp index 162e8b44c67..95802f36645 100644 --- a/src/app/qgsmaplayerstyleguiutils.cpp +++ b/src/app/qgsmaplayerstyleguiutils.cpp @@ -106,7 +106,7 @@ void QgsMapLayerStyleGuiUtils::addStyle() return; bool ok; - QString text = QInputDialog::getText( 0, tr( "New style" ), + QString text = QInputDialog::getText( nullptr, tr( "New style" ), tr( "Style name:" ), QLineEdit::Normal, "new style", &ok ); if ( !ok || text.isEmpty() ) @@ -173,7 +173,7 @@ void QgsMapLayerStyleGuiUtils::renameStyle() QString name = layer->styleManager()->currentStyle(); bool ok; - QString text = QInputDialog::getText( 0, tr( "Rename style" ), + QString text = QInputDialog::getText( nullptr, tr( "Rename style" ), tr( "Style name:" ), QLineEdit::Normal, name, &ok ); if ( !ok ) diff --git a/src/app/qgsmaplayerstyleguiutils.h b/src/app/qgsmaplayerstyleguiutils.h index fb5e62b7aa0..e9e8a8a683d 100644 --- a/src/app/qgsmaplayerstyleguiutils.h +++ b/src/app/qgsmaplayerstyleguiutils.h @@ -30,10 +30,10 @@ class QgsMapLayerStyleGuiUtils : public QObject public: static QgsMapLayerStyleGuiUtils* instance(); - QAction* actionAddStyle( QgsMapLayer* layer, QObject* parent = 0 ); - QAction* actionRemoveStyle( QgsMapLayer* layer, QObject* parent = 0 ); - QAction* actionRenameStyle( QgsMapLayer* layer, QObject* parent = 0 ); - QList actionsUseStyle( QgsMapLayer* layer, QObject* parent = 0 ); + QAction* actionAddStyle( QgsMapLayer* layer, QObject* parent = nullptr ); + QAction* actionRemoveStyle( QgsMapLayer* layer, QObject* parent = nullptr ); + QAction* actionRenameStyle( QgsMapLayer* layer, QObject* parent = nullptr ); + QList actionsUseStyle( QgsMapLayer* layer, QObject* parent = nullptr ); //! Add actions for the given map layer to the menu void addStyleManagerActions( QMenu* m, QgsMapLayer* layer ); diff --git a/src/app/qgsmaptooladdcircularstring.cpp b/src/app/qgsmaptooladdcircularstring.cpp index 64d9ac6d832..ab58da61a84 100644 --- a/src/app/qgsmaptooladdcircularstring.cpp +++ b/src/app/qgsmaptooladdcircularstring.cpp @@ -27,9 +27,9 @@ QgsMapToolAddCircularString::QgsMapToolAddCircularString( QgsMapToolCapture* parentTool, QgsMapCanvas* canvas, CaptureMode mode ) : QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), mode ) , mParentTool( parentTool ) - , mRubberBand( 0 ) + , mRubberBand( nullptr ) , mShowCenterPointRubberBand( false ) - , mCenterPointRubberBand( 0 ) + , mCenterPointRubberBand( nullptr ) { if ( mCanvas ) { @@ -39,10 +39,10 @@ QgsMapToolAddCircularString::QgsMapToolAddCircularString( QgsMapToolCapture* par QgsMapToolAddCircularString::QgsMapToolAddCircularString( QgsMapCanvas* canvas ) : QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget() ) - , mParentTool( 0 ) - , mRubberBand( 0 ) + , mParentTool( nullptr ) + , mRubberBand( nullptr ) , mShowCenterPointRubberBand( false ) - , mCenterPointRubberBand( 0 ) + , mCenterPointRubberBand( nullptr ) { if ( mCanvas ) { @@ -115,7 +115,7 @@ void QgsMapToolAddCircularString::deactivate() c->setPoints( mPoints ); mParentTool->addCurve( c ); mPoints.clear(); - delete mRubberBand; mRubberBand = 0; + delete mRubberBand; mRubberBand = nullptr; removeCenterPointRubberBand(); QgsMapToolCapture::deactivate(); } @@ -196,5 +196,5 @@ void QgsMapToolAddCircularString::updateCenterPointRubberBand( const QgsPointV2& void QgsMapToolAddCircularString::removeCenterPointRubberBand() { - delete mCenterPointRubberBand; mCenterPointRubberBand = 0; + delete mCenterPointRubberBand; mCenterPointRubberBand = nullptr; } diff --git a/src/app/qgsmaptooladdfeature.cpp b/src/app/qgsmaptooladdfeature.cpp index 900ec84ada7..ad7efbb75c5 100644 --- a/src/app/qgsmaptooladdfeature.cpp +++ b/src/app/qgsmaptooladdfeature.cpp @@ -129,7 +129,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e ) { QgsFeature f( vlayer->fields(), 0 ); - QgsGeometry *g = 0; + QgsGeometry *g = nullptr; if ( layerWKBType == QGis::WKBPoint || layerWKBType == QGis::WKBPoint25D ) { g = QgsGeometry::fromPoint( savePoint ); @@ -220,7 +220,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e ) bool hasCurvedSegments = captureCurve()->hasCurvedSegments(); bool providerSupportsCurvedSegments = vlayer->dataProvider()->capabilities() & QgsVectorDataProvider::CircularGeometries; - QgsCurveV2* curveToAdd = 0; + QgsCurveV2* curveToAdd = nullptr; if ( hasCurvedSegments && providerSupportsCurvedSegments ) { curveToAdd = captureCurve()->clone(); @@ -236,7 +236,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e ) } else { - QgsCurvePolygonV2* poly = 0; + QgsCurvePolygonV2* poly = nullptr; if ( hasCurvedSegments && providerSupportsCurvedSegments ) { poly = new QgsCurvePolygonV2(); diff --git a/src/app/qgsmaptooladdpart.cpp b/src/app/qgsmaptooladdpart.cpp index 2973986a4cd..2850e429c22 100644 --- a/src/app/qgsmaptooladdpart.cpp +++ b/src/app/qgsmaptooladdpart.cpp @@ -131,7 +131,7 @@ void QgsMapToolAddPart::cadCanvasReleaseEvent( QgsMapMouseEvent * e ) bool hasCurvedSegments = captureCurve()->hasCurvedSegments(); bool providerSupportsCurvedSegments = vlayer->dataProvider()->capabilities() & QgsVectorDataProvider::CircularGeometries; - QgsCurveV2* curveToAdd = 0; + QgsCurveV2* curveToAdd = nullptr; if ( hasCurvedSegments && providerSupportsCurvedSegments ) { curveToAdd = captureCurve()->clone(); diff --git a/src/app/qgsmaptooladdring.cpp b/src/app/qgsmaptooladdring.cpp index 0cd376d7884..46dd73df5c8 100644 --- a/src/app/qgsmaptooladdring.cpp +++ b/src/app/qgsmaptooladdring.cpp @@ -89,7 +89,7 @@ void QgsMapToolAddRing::cadCanvasReleaseEvent( QgsMapMouseEvent * e ) bool hasCurvedSegments = captureCurve()->hasCurvedSegments(); bool providerSupportsCurvedSegments = vlayer->dataProvider()->capabilities() & QgsVectorDataProvider::CircularGeometries; - QgsCurveV2* curveToAdd = 0; + QgsCurveV2* curveToAdd = nullptr; if ( hasCurvedSegments && providerSupportsCurvedSegments ) { curveToAdd = captureCurve()->clone(); diff --git a/src/app/qgsmaptoolannotation.cpp b/src/app/qgsmaptoolannotation.cpp index ec9b7f67673..079fb350528 100644 --- a/src/app/qgsmaptoolannotation.cpp +++ b/src/app/qgsmaptoolannotation.cpp @@ -45,14 +45,14 @@ QgsMapToolAnnotation::~QgsMapToolAnnotation() QgsAnnotationItem* QgsMapToolAnnotation::createItem( QMouseEvent *e ) { Q_UNUSED( e ); - return 0; + return nullptr; } QDialog* QgsMapToolAnnotation::createItemEditor( QgsAnnotationItem *item ) { if ( !item ) { - return 0; + return nullptr; } QgsTextAnnotationItem* tItem = dynamic_cast( item ); @@ -79,7 +79,7 @@ QDialog* QgsMapToolAnnotation::createItemEditor( QgsAnnotationItem *item ) return new QgsSvgAnnotationDialog( sItem ); } - return 0; + return nullptr; } void QgsMapToolAnnotation::canvasReleaseEvent( QgsMapMouseEvent* e ) @@ -258,7 +258,7 @@ QgsAnnotationItem* QgsMapToolAnnotation::itemAtPos( const QPointF& pos ) { if ( !mCanvas ) { - return 0; + return nullptr; } QList graphicItems = mCanvas->items( pos.toPoint() ); @@ -271,14 +271,14 @@ QgsAnnotationItem* QgsMapToolAnnotation::itemAtPos( const QPointF& pos ) return annotationItem; } } - return 0; + return nullptr; } QgsAnnotationItem* QgsMapToolAnnotation::selectedItem() { if ( !mCanvas || !mCanvas->scene() ) { - return 0; + return nullptr; } QList gItemList = mCanvas->scene()->selectedItems(); QList::iterator it = gItemList.begin(); @@ -290,7 +290,7 @@ QgsAnnotationItem* QgsMapToolAnnotation::selectedItem() return aItem; } } - return 0; + return nullptr; } QList QgsMapToolAnnotation::annotationItems() diff --git a/src/app/qgsmaptoolchangelabelproperties.cpp b/src/app/qgsmaptoolchangelabelproperties.cpp index 73b4a541da6..e8784511aaa 100644 --- a/src/app/qgsmaptoolchangelabelproperties.cpp +++ b/src/app/qgsmaptoolchangelabelproperties.cpp @@ -61,7 +61,7 @@ void QgsMapToolChangeLabelProperties::canvasReleaseEvent( QgsMapMouseEvent* e ) labeltext = mCurrentLabelPos.labelText; } - QgsLabelPropertyDialog d( mCurrentLabelPos.layerID, mCurrentLabelPos.featureId, mCurrentLabelPos.labelFont, labeltext, 0 ); + QgsLabelPropertyDialog d( mCurrentLabelPos.layerID, mCurrentLabelPos.featureId, mCurrentLabelPos.labelFont, labeltext, nullptr ); connect( &d, SIGNAL( applied() ), this, SLOT( dialogPropertiesApplied() ) ); if ( d.exec() == QDialog::Accepted ) diff --git a/src/app/qgsmaptoolcircularstringradius.cpp b/src/app/qgsmaptoolcircularstringradius.cpp index bd2b4e91221..148c3cfdccd 100644 --- a/src/app/qgsmaptoolcircularstringradius.cpp +++ b/src/app/qgsmaptoolcircularstringradius.cpp @@ -31,7 +31,7 @@ QgsMapToolCircularStringRadius::QgsMapToolCircularStringRadius( QgsMapToolCaptur mTemporaryEndPointY( 0.0 ), mRadiusMode( false ), mRadius( 0.0 ), - mRadiusSpinBox( 0 ) + mRadiusSpinBox( nullptr ) { } @@ -73,7 +73,7 @@ void QgsMapToolCircularStringRadius::cadCanvasReleaseEvent( QgsMapMouseEvent* e { if ( !mRadiusMode ) { - delete mRubberBand; mRubberBand = 0; + delete mRubberBand; mRubberBand = nullptr; mTemporaryEndPointX = mapPoint.x(); mTemporaryEndPointY = mapPoint.y(); mRadiusMode = true; @@ -164,7 +164,7 @@ void QgsMapToolCircularStringRadius::deleteRadiusSpinBox() return; } QgisApp::instance()->statusBar()->removeWidget( mRadiusSpinBox ); - delete mRadiusSpinBox; mRadiusSpinBox = 0; + delete mRadiusSpinBox; mRadiusSpinBox = nullptr; } void QgsMapToolCircularStringRadius::updateRadiusFromSpinBox( double radius ) diff --git a/src/app/qgsmaptooldeletepart.cpp b/src/app/qgsmaptooldeletepart.cpp index 489906939cd..623208f0ef4 100644 --- a/src/app/qgsmaptooldeletepart.cpp +++ b/src/app/qgsmaptooldeletepart.cpp @@ -27,8 +27,8 @@ QgsMapToolDeletePart::QgsMapToolDeletePart( QgsMapCanvas* canvas ) : QgsMapToolEdit( canvas ) - , vlayer( NULL ) - , mRubberBand( 0 ) + , vlayer( nullptr ) + , mRubberBand( nullptr ) , mPressedFid( 0 ) , mPressedPartNum( 0 ) { @@ -51,7 +51,7 @@ void QgsMapToolDeletePart::canvasPressEvent( QgsMapMouseEvent* e ) mPressedFid = -1; mPressedPartNum = -1; delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; QgsMapLayer* currentLayer = mCanvas->currentLayer(); if ( !currentLayer ) @@ -88,7 +88,7 @@ void QgsMapToolDeletePart::canvasReleaseEvent( QgsMapMouseEvent* e ) Q_UNUSED( e ); delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; if ( !vlayer || !vlayer->isEditable() ) { diff --git a/src/app/qgsmaptooldeletering.cpp b/src/app/qgsmaptooldeletering.cpp index a193c3f2560..a86756406c2 100644 --- a/src/app/qgsmaptooldeletering.cpp +++ b/src/app/qgsmaptooldeletering.cpp @@ -25,8 +25,8 @@ QgsMapToolDeleteRing::QgsMapToolDeleteRing( QgsMapCanvas* canvas ) : QgsMapToolEdit( canvas ) - , vlayer( 0 ) - , mRubberBand( 0 ) + , vlayer( nullptr ) + , mRubberBand( nullptr ) , mPressedFid( 0 ) , mPressedPartNum( 0 ) , mPressedRingNum( 0 ) @@ -48,7 +48,7 @@ void QgsMapToolDeleteRing::canvasMoveEvent( QgsMapMouseEvent* e ) void QgsMapToolDeleteRing::canvasPressEvent( QgsMapMouseEvent* e ) { delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; mPressedFid = -1; mPressedPartNum = -1; mPressedRingNum = -1; @@ -91,7 +91,7 @@ void QgsMapToolDeleteRing::canvasPressEvent( QgsMapMouseEvent* e ) } delete ringGeom; - ringGeom = 0; + ringGeom = nullptr; } void QgsMapToolDeleteRing::canvasReleaseEvent( QgsMapMouseEvent* e ) @@ -99,7 +99,7 @@ void QgsMapToolDeleteRing::canvasReleaseEvent( QgsMapMouseEvent* e ) Q_UNUSED( e ); delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; if ( mPressedFid == -1 ) return; diff --git a/src/app/qgsmaptoolfillring.cpp b/src/app/qgsmaptoolfillring.cpp index f6ac6f1abe6..eccd7ead575 100644 --- a/src/app/qgsmaptoolfillring.cpp +++ b/src/app/qgsmaptoolfillring.cpp @@ -156,7 +156,7 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent * e ) } else { - QgsAttributeDialog *dialog = new QgsAttributeDialog( vlayer, ft, false, NULL, true ); + QgsAttributeDialog *dialog = new QgsAttributeDialog( vlayer, ft, false, nullptr, true ); dialog->setIsAddDialog( true ); res = dialog->exec(); // will also add the feature } diff --git a/src/app/qgsmaptoolformannotation.cpp b/src/app/qgsmaptoolformannotation.cpp index dc860ae5936..aba26df99d9 100644 --- a/src/app/qgsmaptoolformannotation.cpp +++ b/src/app/qgsmaptoolformannotation.cpp @@ -35,7 +35,7 @@ QgsMapToolFormAnnotation::~QgsMapToolFormAnnotation() QgsAnnotationItem* QgsMapToolFormAnnotation::createItem( QMouseEvent* e ) { //try to associate the current vector layer and a feature to the form item - QgsVectorLayer* currentVectorLayer = 0; + QgsVectorLayer* currentVectorLayer = nullptr; if ( mCanvas ) { QgsMapLayer* mLayer = mCanvas->currentLayer(); diff --git a/src/app/qgsmaptoolhtmlannotation.cpp b/src/app/qgsmaptoolhtmlannotation.cpp index d890e36089a..1117caf329e 100644 --- a/src/app/qgsmaptoolhtmlannotation.cpp +++ b/src/app/qgsmaptoolhtmlannotation.cpp @@ -35,7 +35,7 @@ QgsMapToolHtmlAnnotation::~QgsMapToolHtmlAnnotation() QgsAnnotationItem* QgsMapToolHtmlAnnotation::createItem( QMouseEvent* e ) { //try to associate the current vector layer and a feature to the form item - QgsVectorLayer* currentVectorLayer = 0; + QgsVectorLayer* currentVectorLayer = nullptr; if ( mCanvas ) { QgsMapLayer* mLayer = mCanvas->currentLayer(); diff --git a/src/app/qgsmaptoollabel.cpp b/src/app/qgsmaptoollabel.cpp index c1cdc12efbd..7cb28647141 100644 --- a/src/app/qgsmaptoollabel.cpp +++ b/src/app/qgsmaptoollabel.cpp @@ -27,10 +27,10 @@ QgsMapToolLabel::QgsMapToolLabel( QgsMapCanvas* canvas ) : QgsMapTool( canvas ) - , mLabelRubberBand( 0 ) - , mFeatureRubberBand( 0 ) - , mFixPointRubberBand( 0 ) - , mCurrentLayer( 0 ) + , mLabelRubberBand( nullptr ) + , mFeatureRubberBand( nullptr ) + , mFixPointRubberBand( nullptr ) + , mCurrentLayer( nullptr ) { } @@ -118,9 +118,9 @@ void QgsMapToolLabel::createRubberBands() void QgsMapToolLabel::deleteRubberBands() { - delete mLabelRubberBand; mLabelRubberBand = 0; - delete mFeatureRubberBand; mFeatureRubberBand = 0; - delete mFixPointRubberBand; mFixPointRubberBand = 0; + delete mLabelRubberBand; mLabelRubberBand = nullptr; + delete mFeatureRubberBand; mFeatureRubberBand = nullptr; + delete mFixPointRubberBand; mFixPointRubberBand = nullptr; } QgsVectorLayer* QgsMapToolLabel::currentLayer() diff --git a/src/app/qgsmaptoolmeasureangle.cpp b/src/app/qgsmaptoolmeasureangle.cpp index 5b558b8c689..db30718aa70 100644 --- a/src/app/qgsmaptoolmeasureangle.cpp +++ b/src/app/qgsmaptoolmeasureangle.cpp @@ -28,8 +28,8 @@ QgsMapToolMeasureAngle::QgsMapToolMeasureAngle( QgsMapCanvas* canvas ) : QgsMapTool( canvas ) - , mRubberBand( 0 ) - , mResultDisplay( 0 ) + , mRubberBand( nullptr ) + , mResultDisplay( nullptr ) { mToolName = tr( "Measure angle" ); @@ -91,7 +91,7 @@ void QgsMapToolMeasureAngle::canvasReleaseEvent( QgsMapMouseEvent* e ) if ( mAnglePoints.size() < 1 ) { - if ( mResultDisplay == NULL ) + if ( mResultDisplay == nullptr ) { mResultDisplay = new QgsDisplayAngle( this, Qt::WindowStaysOnTopHint ); QObject::connect( mResultDisplay, SIGNAL( rejected() ), this, SLOT( stopMeasuring() ) ); @@ -111,9 +111,9 @@ void QgsMapToolMeasureAngle::canvasReleaseEvent( QgsMapMouseEvent* e ) void QgsMapToolMeasureAngle::stopMeasuring() { delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; delete mResultDisplay; - mResultDisplay = 0; + mResultDisplay = nullptr; mAnglePoints.clear(); } diff --git a/src/app/qgsmaptoolmovefeature.cpp b/src/app/qgsmaptoolmovefeature.cpp index 27d3fcfc7ad..76f0763168f 100644 --- a/src/app/qgsmaptoolmovefeature.cpp +++ b/src/app/qgsmaptoolmovefeature.cpp @@ -29,7 +29,7 @@ QgsMapToolMoveFeature::QgsMapToolMoveFeature( QgsMapCanvas* canvas ) : QgsMapToolEdit( canvas ) - , mRubberBand( 0 ) + , mRubberBand( nullptr ) { mToolName = tr( "Move feature" ); } @@ -55,7 +55,7 @@ void QgsMapToolMoveFeature::canvasMoveEvent( QgsMapMouseEvent* e ) void QgsMapToolMoveFeature::canvasPressEvent( QgsMapMouseEvent* e ) { delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; QgsVectorLayer* vlayer = currentVectorLayer(); if ( !vlayer ) @@ -165,7 +165,7 @@ void QgsMapToolMoveFeature::canvasReleaseEvent( QgsMapMouseEvent* e ) vlayer->translateFeature( id, dx, dy ); } delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; mCanvas->refresh(); vlayer->endEditCommand(); } @@ -175,7 +175,7 @@ void QgsMapToolMoveFeature::deactivate() { //delete rubber band delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; QgsMapTool::deactivate(); } diff --git a/src/app/qgsmaptooloffsetcurve.cpp b/src/app/qgsmaptooloffsetcurve.cpp index 925b2ddd5b7..082b0ed08ad 100644 --- a/src/app/qgsmaptooloffsetcurve.cpp +++ b/src/app/qgsmaptooloffsetcurve.cpp @@ -28,12 +28,12 @@ QgsMapToolOffsetCurve::QgsMapToolOffsetCurve( QgsMapCanvas* canvas ) : QgsMapToolEdit( canvas ) - , mRubberBand( 0 ) - , mOriginalGeometry( 0 ) + , mRubberBand( nullptr ) + , mOriginalGeometry( nullptr ) , mModifiedFeature( -1 ) , mGeometryModified( false ) - , mDistanceWidget( 0 ) - , mSnapVertexMarker( 0 ) + , mDistanceWidget( nullptr ) + , mSnapVertexMarker( nullptr ) , mForceCopy( false ) , mMultiPartGeometry( false ) { @@ -183,7 +183,7 @@ void QgsMapToolOffsetCurve::applyOffset() deleteRubberBandAndGeometry(); deleteDistanceWidget(); - delete mSnapVertexMarker; mSnapVertexMarker = 0; + delete mSnapVertexMarker; mSnapVertexMarker = nullptr; mForceCopy = false; mCanvas->refresh(); } @@ -196,7 +196,7 @@ void QgsMapToolOffsetCurve::placeOffsetCurveToValue() void QgsMapToolOffsetCurve::canvasMoveEvent( QgsMapMouseEvent* e ) { delete mSnapVertexMarker; - mSnapVertexMarker = 0; + mSnapVertexMarker = nullptr; if ( !mOriginalGeometry || !mRubberBand ) { @@ -258,7 +258,7 @@ QgsGeometry* QgsMapToolOffsetCurve::createOriginGeometry( QgsVectorLayer* vl, co { if ( !vl ) { - return 0; + return nullptr; } mMultiPartGeometry = false; @@ -350,15 +350,15 @@ void QgsMapToolOffsetCurve::deleteDistanceWidget() mDistanceWidget->releaseKeyboard(); mDistanceWidget->deleteLater(); } - mDistanceWidget = 0; + mDistanceWidget = nullptr; } void QgsMapToolOffsetCurve::deleteRubberBandAndGeometry() { delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; delete mOriginalGeometry; - mOriginalGeometry = 0; + mOriginalGeometry = nullptr; } void QgsMapToolOffsetCurve::setOffsetForRubberBand( double offset ) @@ -391,7 +391,7 @@ void QgsMapToolOffsetCurve::setOffsetForRubberBand( double offset ) { deleteRubberBandAndGeometry(); deleteDistanceWidget(); - delete mSnapVertexMarker; mSnapVertexMarker = 0; + delete mSnapVertexMarker; mSnapVertexMarker = nullptr; mForceCopy = false; mGeometryModified = false; deleteDistanceWidget(); @@ -414,7 +414,7 @@ QgsGeometry* QgsMapToolOffsetCurve::linestringFromPolygon( const QgsGeometry* fe { if ( !featureGeom ) { - return 0; + return nullptr; } QGis::WkbType geomType = featureGeom->wkbType(); @@ -433,7 +433,7 @@ QgsGeometry* QgsMapToolOffsetCurve::linestringFromPolygon( const QgsGeometry* fe } else { - return 0; + return nullptr; } QgsMultiPolygon::const_iterator multiPolyIt = multiPoly.constBegin(); @@ -451,7 +451,7 @@ QgsGeometry* QgsMapToolOffsetCurve::linestringFromPolygon( const QgsGeometry* fe } } - return 0; + return nullptr; } @@ -459,7 +459,7 @@ QgsGeometry* QgsMapToolOffsetCurve::convertToSingleLine( QgsGeometry* geom, int { if ( !geom ) { - return 0; + return nullptr; } isMulti = false; @@ -487,11 +487,11 @@ QgsGeometry* QgsMapToolOffsetCurve::convertToSingleLine( QgsGeometry* geom, int } } delete geom; - return 0; + return nullptr; } QgsGeometry* QgsMapToolOffsetCurve::convertToMultiLine( QgsGeometry* geom ) { Q_UNUSED( geom ); - return 0; + return nullptr; } diff --git a/src/app/qgsmaptoolpinlabels.cpp b/src/app/qgsmaptoolpinlabels.cpp index baa41009c97..a8cc22c838d 100644 --- a/src/app/qgsmaptoolpinlabels.cpp +++ b/src/app/qgsmaptoolpinlabels.cpp @@ -32,7 +32,7 @@ QgsMapToolPinLabels::QgsMapToolPinLabels( QgsMapCanvas* canvas ) : QgsMapToolLabel( canvas ) , mDragging( false ) , mShowPinned( false ) - , mRubberBand( 0 ) + , mRubberBand( nullptr ) { mToolName = tr( "Pin labels" ); @@ -107,7 +107,7 @@ void QgsMapToolPinLabels::canvasReleaseEvent( QgsMapMouseEvent* e ) mRubberBand->reset( QGis::Polygon ); delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; } mDragging = false; diff --git a/src/app/qgsmaptoolrotatefeature.cpp b/src/app/qgsmaptoolrotatefeature.cpp index 0318d87842a..c46236b75c9 100644 --- a/src/app/qgsmaptoolrotatefeature.cpp +++ b/src/app/qgsmaptoolrotatefeature.cpp @@ -130,12 +130,12 @@ void QgsAngleMagnetWidget::angleSpinBoxValueChanged( double angle ) QgsMapToolRotateFeature::QgsMapToolRotateFeature( QgsMapCanvas* canvas ) : QgsMapToolEdit( canvas ) - , mRubberBand( 0 ) + , mRubberBand( nullptr ) , mRotation( 0 ) , mRotationOffset( 0 ) - , mAnchorPoint( 0 ) + , mAnchorPoint( nullptr ) , mRotationActive( false ) - , mRotationWidget( 0 ) + , mRotationWidget( nullptr ) { } @@ -440,7 +440,7 @@ void QgsMapToolRotateFeature::activate() void QgsMapToolRotateFeature::deleteRubberband() { delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; } void QgsMapToolRotateFeature::deactivate() @@ -448,7 +448,7 @@ void QgsMapToolRotateFeature::deactivate() deleteRotationWidget(); mRotationActive = false; delete mAnchorPoint; - mAnchorPoint = 0; + mAnchorPoint = nullptr; mRotationOffset = 0; deleteRubberband(); QgsMapTool::deactivate(); @@ -480,7 +480,7 @@ void QgsMapToolRotateFeature::deleteRotationWidget() mRotationWidget->releaseKeyboard(); mRotationWidget->deleteLater(); } - mRotationWidget = 0; + mRotationWidget = nullptr; } diff --git a/src/app/qgsmaptoolrotatefeature.h b/src/app/qgsmaptoolrotatefeature.h index 38bdf6de7fe..3f65fd74562 100644 --- a/src/app/qgsmaptoolrotatefeature.h +++ b/src/app/qgsmaptoolrotatefeature.h @@ -33,7 +33,7 @@ class APP_EXPORT QgsAngleMagnetWidget : public QWidget public: - explicit QgsAngleMagnetWidget( const QString& label = QString(), QWidget *parent = 0 ); + explicit QgsAngleMagnetWidget( const QString& label = QString(), QWidget *parent = nullptr ); ~QgsAngleMagnetWidget(); diff --git a/src/app/qgsmaptoolrotatelabel.cpp b/src/app/qgsmaptoolrotatelabel.cpp index c3ee783eb31..50ebdf8233f 100644 --- a/src/app/qgsmaptoolrotatelabel.cpp +++ b/src/app/qgsmaptoolrotatelabel.cpp @@ -32,8 +32,8 @@ QgsMapToolRotateLabel::QgsMapToolRotateLabel( QgsMapCanvas* canvas ) , mStartRotation( 0.0 ) , mCurrentRotation( 0.0 ) , mCurrentMouseAzimuth( 0.0 ) - , mRotationItem( 0 ) - , mRotationPreviewBox( 0 ) + , mRotationItem( nullptr ) + , mRotationPreviewBox( nullptr ) , mCtrlPressed( false ) { } @@ -150,9 +150,9 @@ void QgsMapToolRotateLabel::canvasReleaseEvent( QgsMapMouseEvent* e ) deleteRubberBands(); delete mRotationItem; - mRotationItem = 0; + mRotationItem = nullptr; delete mRotationPreviewBox; - mRotationPreviewBox = 0; + mRotationPreviewBox = nullptr; QgsMapLayer* layer = QgsMapLayerRegistry::instance()->mapLayer( mCurrentLabelPos.layerID ); if ( !layer ) @@ -201,7 +201,7 @@ QgsRubberBand* QgsMapToolRotateLabel::createRotationPreviewBox() QVector< QgsPoint > boxPoints = mCurrentLabelPos.cornerPoints; if ( boxPoints.size() < 1 ) { - return 0; + return nullptr; } mRotationPreviewBox = new QgsRubberBand( mCanvas, QGis::Line ); diff --git a/src/app/qgsmaptoolrotatepointsymbols.cpp b/src/app/qgsmaptoolrotatepointsymbols.cpp index 94fe5a02c33..bb13c7d50c3 100644 --- a/src/app/qgsmaptoolrotatepointsymbols.cpp +++ b/src/app/qgsmaptoolrotatepointsymbols.cpp @@ -29,12 +29,12 @@ QgsMapToolRotatePointSymbols::QgsMapToolRotatePointSymbols( QgsMapCanvas* canvas ) : QgsMapToolEdit( canvas ), - mActiveLayer( 0 ), + mActiveLayer( nullptr ), mFeatureNumber( 0 ), mCurrentMouseAzimut( 0.0 ), mCurrentRotationFeature( 0.0 ), mRotating( false ), - mRotationItem( 0 ), + mRotationItem( nullptr ), mCtrlPressed( false ) { @@ -123,7 +123,7 @@ void QgsMapToolRotatePointSymbols::canvasPressEvent( QgsMapMouseEvent* e ) renderer->startRender( context, mActiveLayer->fields() ); //find all rotation fields used by renderer for feature - QgsMarkerSymbolV2* markerSymbol = 0; + QgsMarkerSymbolV2* markerSymbol = nullptr; if ( renderer->capabilities() & QgsFeatureRendererV2::MoreSymbolsPerFeature ) { //could be multiple symbols for this feature, so check them all @@ -265,7 +265,7 @@ void QgsMapToolRotatePointSymbols::canvasReleaseEvent( QgsMapMouseEvent* e ) } mRotating = false; delete mRotationItem; - mRotationItem = 0; + mRotationItem = nullptr; mCanvas->refresh(); } diff --git a/src/app/qgsmaptoolselect.cpp b/src/app/qgsmaptoolselect.cpp index d351c486edf..eff09d2e20e 100644 --- a/src/app/qgsmaptoolselect.cpp +++ b/src/app/qgsmaptoolselect.cpp @@ -40,7 +40,7 @@ QgsMapToolSelect::QgsMapToolSelect( QgsMapCanvas* canvas ) void QgsMapToolSelect::canvasReleaseEvent( QgsMapMouseEvent* e ) { QgsVectorLayer* vlayer = QgsMapToolSelectUtils::getCurrentVectorLayer( mCanvas ); - if ( vlayer == NULL ) + if ( vlayer == nullptr ) { return; } diff --git a/src/app/qgsmaptoolselectfreehand.cpp b/src/app/qgsmaptoolselectfreehand.cpp index 6978cd7dba9..2d645fae345 100644 --- a/src/app/qgsmaptoolselectfreehand.cpp +++ b/src/app/qgsmaptoolselectfreehand.cpp @@ -27,7 +27,7 @@ QgsMapToolSelectFreehand::QgsMapToolSelectFreehand( QgsMapCanvas* canvas ) : QgsMapTool( canvas ) , mDragging( false ) { - mRubberBand = 0; + mRubberBand = nullptr; mCursor = Qt::ArrowCursor; mFillColor = QColor( 254, 178, 76, 63 ); mBorderColour = QColor( 254, 58, 29, 100 ); @@ -44,7 +44,7 @@ void QgsMapToolSelectFreehand::canvasPressEvent( QgsMapMouseEvent* e ) { return; } - if ( mRubberBand == NULL ) + if ( mRubberBand == nullptr ) { mRubberBand = new QgsRubberBand( mCanvas, QGis::Polygon ); mRubberBand->setFillColor( mFillColor ); @@ -57,7 +57,7 @@ void QgsMapToolSelectFreehand::canvasPressEvent( QgsMapMouseEvent* e ) void QgsMapToolSelectFreehand::canvasMoveEvent( QgsMapMouseEvent* e ) { - if ( !mDragging || mRubberBand == NULL ) + if ( !mDragging || mRubberBand == nullptr ) { return; } @@ -67,7 +67,7 @@ void QgsMapToolSelectFreehand::canvasMoveEvent( QgsMapMouseEvent* e ) void QgsMapToolSelectFreehand::canvasReleaseEvent( QgsMapMouseEvent* e ) { - if ( mRubberBand == NULL ) + if ( mRubberBand == nullptr ) { return; } @@ -79,6 +79,6 @@ void QgsMapToolSelectFreehand::canvasReleaseEvent( QgsMapMouseEvent* e ) } mRubberBand->reset( QGis::Polygon ); delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; mDragging = false; } diff --git a/src/app/qgsmaptoolselectpolygon.cpp b/src/app/qgsmaptoolselectpolygon.cpp index 5c66cd8499b..5bc4e080745 100644 --- a/src/app/qgsmaptoolselectpolygon.cpp +++ b/src/app/qgsmaptoolselectpolygon.cpp @@ -26,7 +26,7 @@ email : jpalmer at linz dot govt dot nz QgsMapToolSelectPolygon::QgsMapToolSelectPolygon( QgsMapCanvas* canvas ) : QgsMapTool( canvas ) { - mRubberBand = 0; + mRubberBand = nullptr; mCursor = Qt::ArrowCursor; mFillColor = QColor( 254, 178, 76, 63 ); mBorderColour = QColor( 254, 58, 29, 100 ); @@ -39,7 +39,7 @@ QgsMapToolSelectPolygon::~QgsMapToolSelectPolygon() void QgsMapToolSelectPolygon::canvasPressEvent( QgsMapMouseEvent* e ) { - if ( mRubberBand == NULL ) + if ( mRubberBand == nullptr ) { mRubberBand = new QgsRubberBand( mCanvas, QGis::Polygon ); mRubberBand->setFillColor( mFillColor ); @@ -59,13 +59,13 @@ void QgsMapToolSelectPolygon::canvasPressEvent( QgsMapMouseEvent* e ) } mRubberBand->reset( QGis::Polygon ); delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; } } void QgsMapToolSelectPolygon::canvasMoveEvent( QgsMapMouseEvent* e ) { - if ( mRubberBand == NULL ) + if ( mRubberBand == nullptr ) { return; } diff --git a/src/app/qgsmaptoolselectradius.cpp b/src/app/qgsmaptoolselectradius.cpp index 63c131afbf8..dee4619c1f0 100644 --- a/src/app/qgsmaptoolselectradius.cpp +++ b/src/app/qgsmaptoolselectradius.cpp @@ -33,7 +33,7 @@ const int RADIUS_SEGMENTS = 40; QgsMapToolSelectRadius::QgsMapToolSelectRadius( QgsMapCanvas* canvas ) : QgsMapTool( canvas ), mDragging( false ) { - mRubberBand = 0; + mRubberBand = nullptr; mCursor = Qt::ArrowCursor; mFillColor = QColor( 254, 178, 76, 63 ); mBorderColour = QColor( 254, 58, 29, 100 ); @@ -62,7 +62,7 @@ void QgsMapToolSelectRadius::canvasMoveEvent( QgsMapMouseEvent* e ) } if ( !mDragging ) { - if ( mRubberBand == NULL ) + if ( mRubberBand == nullptr ) { mRubberBand = new QgsRubberBand( mCanvas, QGis::Polygon ); mRubberBand->setFillColor( mFillColor ); @@ -83,7 +83,7 @@ void QgsMapToolSelectRadius::canvasReleaseEvent( QgsMapMouseEvent* e ) } if ( !mDragging ) { - if ( mRubberBand == NULL ) + if ( mRubberBand == nullptr ) { mRubberBand = new QgsRubberBand( mCanvas, QGis::Polygon ); mRubberBand->setFillColor( mFillColor ); @@ -98,7 +98,7 @@ void QgsMapToolSelectRadius::canvasReleaseEvent( QgsMapMouseEvent* e ) delete radiusGeometry; mRubberBand->reset( QGis::Polygon ); delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; mDragging = false; } diff --git a/src/app/qgsmaptoolselectrectangle.cpp b/src/app/qgsmaptoolselectrectangle.cpp index 462a0439621..af8a2974c16 100644 --- a/src/app/qgsmaptoolselectrectangle.cpp +++ b/src/app/qgsmaptoolselectrectangle.cpp @@ -36,7 +36,7 @@ QgsMapToolSelectFeatures::QgsMapToolSelectFeatures( QgsMapCanvas* canvas ) mToolName = tr( "Select features" ); QPixmap mySelectQPixmap = QPixmap(( const char ** ) select_cursor ); mCursor = QCursor( mySelectQPixmap, 1, 1 ); - mRubberBand = 0; + mRubberBand = nullptr; mFillColor = QColor( 254, 178, 76, 63 ); mBorderColour = QColor( 254, 58, 29, 100 ); } @@ -71,10 +71,10 @@ void QgsMapToolSelectFeatures::canvasMoveEvent( QgsMapMouseEvent* e ) void QgsMapToolSelectFeatures::canvasReleaseEvent( QgsMapMouseEvent* e ) { QgsVectorLayer* vlayer = QgsMapToolSelectUtils::getCurrentVectorLayer( mCanvas ); - if ( vlayer == NULL ) + if ( vlayer == nullptr ) { delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; mDragging = false; return; } @@ -115,7 +115,7 @@ void QgsMapToolSelectFeatures::canvasReleaseEvent( QgsMapMouseEvent* e ) delete selectGeom; delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; } mDragging = false; diff --git a/src/app/qgsmaptoolselectutils.cpp b/src/app/qgsmaptoolselectutils.cpp index fb879909ba8..992ef6e80cf 100644 --- a/src/app/qgsmaptoolselectutils.cpp +++ b/src/app/qgsmaptoolselectutils.cpp @@ -33,9 +33,9 @@ email : jpalmer at linz dot govt dot nz QgsVectorLayer* QgsMapToolSelectUtils::getCurrentVectorLayer( QgsMapCanvas* canvas ) { - QgsVectorLayer* vlayer = NULL; + QgsVectorLayer* vlayer = nullptr; if ( !canvas->currentLayer() - || ( vlayer = qobject_cast( canvas->currentLayer() ) ) == NULL ) + || ( vlayer = qobject_cast( canvas->currentLayer() ) ) == nullptr ) { QgisApp::instance()->messageBar()->pushMessage( QObject::tr( "No active vector layer" ), @@ -97,7 +97,7 @@ void QgsMapToolSelectUtils::setSelectFeatures( QgsMapCanvas* canvas, return; } QgsVectorLayer* vlayer = QgsMapToolSelectUtils::getCurrentVectorLayer( canvas ); - if ( vlayer == NULL ) + if ( vlayer == nullptr ) { return; } diff --git a/src/app/qgsmaptoolshowhidelabels.cpp b/src/app/qgsmaptoolshowhidelabels.cpp index 15d2c013a3e..8eba2d057bd 100644 --- a/src/app/qgsmaptoolshowhidelabels.cpp +++ b/src/app/qgsmaptoolshowhidelabels.cpp @@ -32,7 +32,7 @@ QgsMapToolShowHideLabels::QgsMapToolShowHideLabels( QgsMapCanvas* canvas ) , mDragging( false ) { mToolName = tr( "Show/hide labels" ); - mRubberBand = 0; + mRubberBand = nullptr; } QgsMapToolShowHideLabels::~QgsMapToolShowHideLabels() @@ -96,7 +96,7 @@ void QgsMapToolShowHideLabels::canvasReleaseEvent( QgsMapMouseEvent* e ) mRubberBand->reset( QGis::Polygon ); delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; } mDragging = false; diff --git a/src/app/qgsmaptoolsimplify.cpp b/src/app/qgsmaptoolsimplify.cpp index bd944202f75..cb413c271ff 100644 --- a/src/app/qgsmaptoolsimplify.cpp +++ b/src/app/qgsmaptoolsimplify.cpp @@ -58,7 +58,7 @@ void QgsSimplifyDialog::enableOkButton( bool enabled ) QgsMapToolSimplify::QgsMapToolSimplify( QgsMapCanvas* canvas ) : QgsMapToolEdit( canvas ) - , mSelectionRubberBand( 0 ) + , mSelectionRubberBand( nullptr ) , mDragging( false ) , mOriginalVertexCount( 0 ) , mReducedVertexCount( 0 ) @@ -238,7 +238,7 @@ void QgsMapToolSimplify::canvasReleaseEvent( QgsMapMouseEvent* e ) return; delete mSelectionRubberBand; - mSelectionRubberBand = 0; + mSelectionRubberBand = nullptr; if ( mDragging && ( mSelectionRect.topLeft() != mSelectionRect.bottomRight() ) ) { @@ -337,7 +337,7 @@ void QgsMapToolSimplify::clearSelection() void QgsMapToolSimplify::deactivate() { delete mSelectionRubberBand; - mSelectionRubberBand = 0; + mSelectionRubberBand = nullptr; if ( mSimplifyDialog->isVisible() ) mSimplifyDialog->close(); diff --git a/src/app/qgsmaptoolsimplify.h b/src/app/qgsmaptoolsimplify.h index b1bc486468f..6fc48a78c57 100644 --- a/src/app/qgsmaptoolsimplify.h +++ b/src/app/qgsmaptoolsimplify.h @@ -33,7 +33,7 @@ class APP_EXPORT QgsSimplifyDialog : public QDialog, private Ui::SimplifyLineDia public: - QgsSimplifyDialog( QgsMapToolSimplify* tool, QWidget* parent = NULL ); + QgsSimplifyDialog( QgsMapToolSimplify* tool, QWidget* parent = nullptr ); void updateStatusText(); void enableOkButton( bool enabled ); diff --git a/src/app/qgsmeasuredialog.h b/src/app/qgsmeasuredialog.h index 045629312b2..906d1d99f2c 100644 --- a/src/app/qgsmeasuredialog.h +++ b/src/app/qgsmeasuredialog.h @@ -33,7 +33,7 @@ class APP_EXPORT QgsMeasureDialog : public QDialog, private Ui::QgsMeasureBase public: //! Constructor - QgsMeasureDialog( QgsMeasureTool* tool, Qt::WindowFlags f = 0 ); + QgsMeasureDialog( QgsMeasureTool* tool, Qt::WindowFlags f = nullptr ); //! Save position void saveWindowLocation( void ); diff --git a/src/app/qgsmeasuretool.cpp b/src/app/qgsmeasuretool.cpp index bee620c56c9..42c82ae8337 100644 --- a/src/app/qgsmeasuretool.cpp +++ b/src/app/qgsmeasuretool.cpp @@ -82,7 +82,7 @@ void QgsMeasureTool::activate() ( mCanvas->extent().height() > 360 || mCanvas->extent().width() > 720 ) ) { - QMessageBox::warning( NULL, tr( "Incorrect measure results" ), + QMessageBox::warning( nullptr, tr( "Incorrect measure results" ), tr( "

This map is defined with a geographic coordinate system " "(latitude/longitude) " "but the map extents suggests that it is actually a projected " diff --git a/src/app/qgsmergeattributesdialog.cpp b/src/app/qgsmergeattributesdialog.cpp index c018a6dbb1c..042d0723fc2 100644 --- a/src/app/qgsmergeattributesdialog.cpp +++ b/src/app/qgsmergeattributesdialog.cpp @@ -53,7 +53,7 @@ QgsMergeAttributesDialog::QgsMergeAttributesDialog( const QgsFeatureList &featur , mFeatureList( features ) , mVectorLayer( vl ) , mMapCanvas( canvas ) - , mSelectionRubberBand( 0 ) + , mSelectionRubberBand( nullptr ) { setupUi( this ); createTableWidgetContents(); @@ -77,9 +77,9 @@ QgsMergeAttributesDialog::QgsMergeAttributesDialog( const QgsFeatureList &featur QgsMergeAttributesDialog::QgsMergeAttributesDialog() : QDialog() - , mVectorLayer( NULL ) - , mMapCanvas( NULL ) - , mSelectionRubberBand( NULL ) + , mVectorLayer( nullptr ) + , mMapCanvas( nullptr ) + , mSelectionRubberBand( nullptr ) { setupUi( this ); @@ -148,7 +148,7 @@ void QgsMergeAttributesDialog::createTableWidgetContents() QTableWidgetItem* attributeValItem = new QTableWidgetItem( attrs.at( idx ).toString() ); attributeValItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable ); mTableWidget->setItem( i + 1, j, attributeValItem ); - mTableWidget->setCellWidget( i + 1, j, QgsAttributeEditor::createAttributeEditor( mTableWidget, NULL, mVectorLayer, idx, attrs.at( idx ) ) ); + mTableWidget->setCellWidget( i + 1, j, QgsAttributeEditor::createAttributeEditor( mTableWidget, nullptr, mVectorLayer, idx, attrs.at( idx ) ) ); } } @@ -226,7 +226,7 @@ void QgsMergeAttributesDialog::selectedRowChanged() if ( selectionList.isEmpty() ) { delete mSelectionRubberBand; - mSelectionRubberBand = 0; + mSelectionRubberBand = nullptr; return; } @@ -250,7 +250,7 @@ void QgsMergeAttributesDialog::selectedRowChanged() { //the merge result row was selected delete mSelectionRubberBand; - mSelectionRubberBand = 0; + mSelectionRubberBand = nullptr; return; } createRubberBandForFeature( featureIdToSelect ); diff --git a/src/app/qgsmergeattributesdialog.h b/src/app/qgsmergeattributesdialog.h index 05f94c70161..c215137f921 100644 --- a/src/app/qgsmergeattributesdialog.h +++ b/src/app/qgsmergeattributesdialog.h @@ -34,7 +34,7 @@ class APP_EXPORT QgsMergeAttributesDialog: public QDialog, private Ui::QgsMergeA { Q_OBJECT public: - QgsMergeAttributesDialog( const QgsFeatureList& features, QgsVectorLayer* vl, QgsMapCanvas* canvas, QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsMergeAttributesDialog( const QgsFeatureList& features, QgsVectorLayer* vl, QgsMapCanvas* canvas, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsMergeAttributesDialog(); QgsAttributes mergedAttributes() const; diff --git a/src/app/qgsnewspatialitelayerdialog.cpp b/src/app/qgsnewspatialitelayerdialog.cpp index 622fc94fb16..a4c555bb766 100644 --- a/src/app/qgsnewspatialitelayerdialog.cpp +++ b/src/app/qgsnewspatialitelayerdialog.cpp @@ -195,9 +195,9 @@ void QgsNewSpatialiteLayerDialog::on_pbnFindSRID_clicked() { // first get list of supported SRID from the selected Spatialite database // to build filter for projection selector - sqlite3 *db = 0; + sqlite3 *db = nullptr; bool status = true; - int rc = sqlite3_open_v2( mDatabaseComboBox->currentText().toUtf8(), &db, SQLITE_OPEN_READONLY, NULL ); + int rc = sqlite3_open_v2( mDatabaseComboBox->currentText().toUtf8(), &db, SQLITE_OPEN_READONLY, nullptr ); if ( rc != SQLITE_OK ) { QMessageBox::warning( this, tr( "SpatiaLite Database" ), tr( "Unable to open the database" ) ); @@ -224,7 +224,7 @@ void QgsNewSpatialiteLayerDialog::on_pbnFindSRID_clicked() else { // XXX query failed -- warn the user some how - QMessageBox::warning( 0, tr( "Error" ), tr( "Failed to load SRIDS: %1" ).arg( sqlite3_errmsg( db ) ) ); + QMessageBox::warning( nullptr, tr( "Error" ), tr( "Failed to load SRIDS: %1" ).arg( sqlite3_errmsg( db ) ) ); status = false; } // close the statement @@ -300,7 +300,7 @@ bool QgsNewSpatialiteLayerDialog::createDb() if ( !res ) { - QMessageBox::warning( 0, tr( "SpatiaLite Database" ), errCause ); + QMessageBox::warning( nullptr, tr( "SpatiaLite Database" ), errCause ); pbnFindSRID->setEnabled( false ); } } @@ -320,7 +320,7 @@ bool QgsNewSpatialiteLayerDialog::createDb() settings.setValue( "/SpatiaLite/connections/selected", fi.fileName() + tr( "@" ) + fi.canonicalFilePath() ); settings.setValue( key, fi.canonicalFilePath() ); - QMessageBox::information( 0, tr( "SpatiaLite Database" ), tr( "Registered new database!" ) ); + QMessageBox::information( nullptr, tr( "SpatiaLite Database" ), tr( "Registered new database!" ) ); } pbnFindSRID->setEnabled( true ); @@ -390,7 +390,7 @@ bool QgsNewSpatialiteLayerDialog::apply() else { char * errmsg; - rc = sqlite3_exec( db, sql.toUtf8(), NULL, NULL, &errmsg ); + rc = sqlite3_exec( db, sql.toUtf8(), nullptr, nullptr, &errmsg ); if ( rc != SQLITE_OK ) { QMessageBox::warning( this, @@ -401,7 +401,7 @@ bool QgsNewSpatialiteLayerDialog::apply() else { // create the geometry column and the spatial index - rc = sqlite3_exec( db, sqlAddGeom.toUtf8(), NULL, NULL, &errmsg ); + rc = sqlite3_exec( db, sqlAddGeom.toUtf8(), nullptr, nullptr, &errmsg ); if ( rc != SQLITE_OK ) { QMessageBox::warning( this, @@ -412,7 +412,7 @@ bool QgsNewSpatialiteLayerDialog::apply() else { // create the spatial index - rc = sqlite3_exec( db, sqlCreateIndex.toUtf8(), NULL, NULL, &errmsg ); + rc = sqlite3_exec( db, sqlCreateIndex.toUtf8(), nullptr, nullptr, &errmsg ); if ( rc != SQLITE_OK ) { QMessageBox::warning( this, diff --git a/src/app/qgsnewspatialitelayerdialog.h b/src/app/qgsnewspatialitelayerdialog.h index 9112ac86f5c..10727f4f6a0 100644 --- a/src/app/qgsnewspatialitelayerdialog.h +++ b/src/app/qgsnewspatialitelayerdialog.h @@ -34,7 +34,7 @@ class APP_EXPORT QgsNewSpatialiteLayerDialog: public QDialog, private Ui::QgsNew Q_OBJECT public: - QgsNewSpatialiteLayerDialog( QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); + QgsNewSpatialiteLayerDialog( QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); ~QgsNewSpatialiteLayerDialog(); protected slots: diff --git a/src/app/qgsoptions.cpp b/src/app/qgsoptions.cpp index 2214ad62758..21077637523 100644 --- a/src/app/qgsoptions.cpp +++ b/src/app/qgsoptions.cpp @@ -912,7 +912,7 @@ void QgsOptions::on_cbxProjectDefaultNew_toggled( bool checked ) QString fileName = QgsApplication::qgisSettingsDirPath() + QLatin1String( "project_default.qgs" ); if ( ! QFile::exists( fileName ) ) { - QMessageBox::information( 0, tr( "Save default project" ), tr( "You must set a default project" ) ); + QMessageBox::information( nullptr, tr( "Save default project" ), tr( "You must set a default project" ) ); cbxProjectDefaultNew->setChecked( false ); } } @@ -923,11 +923,11 @@ void QgsOptions::on_pbnProjectDefaultSetCurrent_clicked() QString fileName = QgsApplication::qgisSettingsDirPath() + QLatin1String( "project_default.qgs" ); if ( QgsProject::instance()->write( QFileInfo( fileName ) ) ) { - QMessageBox::information( 0, tr( "Save default project" ), tr( "Current project saved as default" ) ); + QMessageBox::information( nullptr, tr( "Save default project" ), tr( "Current project saved as default" ) ); } else { - QMessageBox::critical( 0, tr( "Save default project" ), tr( "Error saving current project as default" ) ); + QMessageBox::critical( nullptr, tr( "Save default project" ), tr( "Error saving current project as default" ) ); } } @@ -943,7 +943,7 @@ void QgsOptions::on_pbnProjectDefaultReset_clicked() void QgsOptions::on_pbnTemplateFolderBrowse_pressed() { - QString newDir = QFileDialog::getExistingDirectory( 0, tr( "Choose a directory to store project template files" ), + QString newDir = QFileDialog::getExistingDirectory( nullptr, tr( "Choose a directory to store project template files" ), leTemplateFolder->text() ); if ( ! newDir.isNull() ) { @@ -1498,7 +1498,7 @@ void QgsOptions::editGdalDriver( const QString& driverName ) if ( driverName.isEmpty() ) return; - QgsDialog dlg( this, 0, QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); + QgsDialog dlg( this, nullptr, QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); QVBoxLayout *layout = dlg.layout(); QString title = tr( "Create Options - %1 Driver" ).arg( driverName ); if ( driverName == "_pyramids" ) @@ -1815,17 +1815,17 @@ void QgsOptions::loadGdalDriverList() // get driver R/W flags, taken from GDALGeneralCmdLineProcessor() const char *pszRWFlag, *pszVirtualIO; - if ( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_CREATE, NULL ) ) + if ( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_CREATE, nullptr ) ) { myGdalWriteDrivers << myGdalDriverDescription; pszRWFlag = "rw+"; } else if ( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_CREATECOPY, - NULL ) ) + nullptr ) ) pszRWFlag = "rw"; else pszRWFlag = "ro"; - if ( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_VIRTUALIO, NULL ) ) + if ( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_VIRTUALIO, nullptr ) ) pszVirtualIO = "v"; else pszVirtualIO = ""; @@ -2108,7 +2108,7 @@ void QgsOptions::on_mButtonImportColors_clicked() QFileInfo fileInfo( filePath ); if ( !fileInfo.exists() || !fileInfo.isReadable() ) { - QMessageBox::critical( 0, tr( "Invalid file" ), tr( "Error, file does not exist or is not readable" ) ); + QMessageBox::critical( nullptr, tr( "Invalid file" ), tr( "Error, file does not exist or is not readable" ) ); return; } @@ -2117,7 +2117,7 @@ void QgsOptions::on_mButtonImportColors_clicked() bool importOk = mTreeCustomColors->importColorsFromGpl( file ); if ( !importOk ) { - QMessageBox::critical( 0, tr( "Invalid file" ), tr( "Error, no colors found in palette file" ) ); + QMessageBox::critical( nullptr, tr( "Invalid file" ), tr( "Error, no colors found in palette file" ) ); return; } } @@ -2146,7 +2146,7 @@ void QgsOptions::on_mButtonExportColors_clicked() bool exportOk = mTreeCustomColors->exportColorsToGpl( file ); if ( !exportOk ) { - QMessageBox::critical( 0, tr( "Error exporting" ), tr( "Error writing palette file" ) ); + QMessageBox::critical( nullptr, tr( "Error exporting" ), tr( "Error writing palette file" ) ); return; } } diff --git a/src/app/qgsoptions.h b/src/app/qgsoptions.h index 253e0aa11a3..1d773156be8 100644 --- a/src/app/qgsoptions.h +++ b/src/app/qgsoptions.h @@ -46,7 +46,7 @@ class APP_EXPORT QgsOptions : public QgsOptionsDialogBase, private Ui::QgsOption * @param name name for the widget * @param modal true for modal dialog */ - QgsOptions( QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); + QgsOptions( QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); //! Destructor ~QgsOptions(); diff --git a/src/app/qgspluginregistry.cpp b/src/app/qgspluginregistry.cpp index 0877af36cec..c193aa431fc 100644 --- a/src/app/qgspluginregistry.cpp +++ b/src/app/qgspluginregistry.cpp @@ -41,10 +41,10 @@ typedef QString category_t(); typedef int type_t(); -QgsPluginRegistry *QgsPluginRegistry::_instance = 0; +QgsPluginRegistry *QgsPluginRegistry::_instance = nullptr; QgsPluginRegistry *QgsPluginRegistry::instance() { - if ( _instance == 0 ) + if ( _instance == nullptr ) { _instance = new QgsPluginRegistry(); } @@ -52,7 +52,7 @@ QgsPluginRegistry *QgsPluginRegistry::instance() } QgsPluginRegistry::QgsPluginRegistry() - : mPythonUtils( NULL ), mQgisInterface( NULL ) + : mPythonUtils( nullptr ), mQgisInterface( nullptr ) { // constructor does nothing } @@ -100,7 +100,7 @@ QgisPlugin *QgsPluginRegistry::plugin( const QString& key ) { QMap::iterator it = mPlugins.find( key ); if ( it == mPlugins.end() ) - return NULL; + return nullptr; // note: not used by python plugins diff --git a/src/app/qgspointrotationitem.cpp b/src/app/qgspointrotationitem.cpp index fa7a89ffb88..5b3dd93d4c9 100644 --- a/src/app/qgspointrotationitem.cpp +++ b/src/app/qgspointrotationitem.cpp @@ -28,7 +28,7 @@ QgsPointRotationItem::QgsPointRotationItem( QgsMapCanvas* canvas ) } QgsPointRotationItem::QgsPointRotationItem() - : QgsMapCanvasItem( 0 ) + : QgsMapCanvasItem( nullptr ) , mOrientation( Clockwise ) , mRotation( 0.0 ) { diff --git a/src/app/qgsprojectlayergroupdialog.cpp b/src/app/qgsprojectlayergroupdialog.cpp index d70d1d2263e..9cd4cff3176 100644 --- a/src/app/qgsprojectlayergroupdialog.cpp +++ b/src/app/qgsprojectlayergroupdialog.cpp @@ -104,7 +104,7 @@ QString QgsProjectLayerGroupDialog::selectedProjectFile() const bool QgsProjectLayerGroupDialog::isValid() const { - return mTreeView->layerTreeModel() != 0; + return mTreeView->layerTreeModel() != nullptr; } void QgsProjectLayerGroupDialog::on_mBrowseFileToolButton_clicked() @@ -147,7 +147,7 @@ void QgsProjectLayerGroupDialog::changeProjectFile() //check we are not embedding from/to the same project if ( mProjectFileLineEdit->isVisible() && mProjectFileLineEdit->text() == QgsProject::instance()->fileName() ) { - QMessageBox::critical( 0, tr( "Recursive embedding not possible" ), tr( "It is not possible to embed layers / groups from the current project." ) ); + QMessageBox::critical( nullptr, tr( "Recursive embedding not possible" ), tr( "It is not possible to embed layers / groups from the current project." ) ); return; } diff --git a/src/app/qgsprojectlayergroupdialog.h b/src/app/qgsprojectlayergroupdialog.h index 29e27147c0f..b455af79cf1 100644 --- a/src/app/qgsprojectlayergroupdialog.h +++ b/src/app/qgsprojectlayergroupdialog.h @@ -28,7 +28,7 @@ class APP_EXPORT QgsProjectLayerGroupDialog: public QDialog, private Ui::QgsProj Q_OBJECT public: /** Constructor. If a project file is given, the groups/layers are displayed directly and the file selection hidden*/ - QgsProjectLayerGroupDialog( QWidget * parent = 0, const QString& projectFile = QString(), Qt::WindowFlags f = 0 ); + QgsProjectLayerGroupDialog( QWidget * parent = nullptr, const QString& projectFile = QString(), Qt::WindowFlags f = nullptr ); ~QgsProjectLayerGroupDialog(); QStringList selectedGroups() const; diff --git a/src/app/qgsprojectproperties.cpp b/src/app/qgsprojectproperties.cpp index 2607677b25b..9f1d3b9e073 100644 --- a/src/app/qgsprojectproperties.cpp +++ b/src/app/qgsprojectproperties.cpp @@ -192,7 +192,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa grpProjectScales->setChecked( QgsProject::instance()->readBoolEntry( "Scales", "/useProjectScales" ) ); - QgsMapLayer* currentLayer = 0; + QgsMapLayer* currentLayer = nullptr; QStringList noIdentifyLayerIdList = QgsProject::instance()->readListEntry( "Identify", "/disabledLayers" ); @@ -1448,7 +1448,7 @@ void QgsProjectProperties::populateStyles() { QString name = symbolNames[i]; QgsSymbolV2* symbol = mStyle->symbol( name ); - QComboBox* cbo = 0; + QComboBox* cbo = nullptr; switch ( symbol->type() ) { case QgsSymbolV2::Marker : @@ -1558,7 +1558,7 @@ void QgsProjectProperties::editSymbol( QComboBox* cbo ) } // let the user edit the symbol and update list when done - QgsSymbolV2SelectorDialog dlg( symbol, mStyle, 0, this ); + QgsSymbolV2SelectorDialog dlg( symbol, mStyle, nullptr, this ); if ( dlg.exec() == 0 ) { delete symbol; @@ -1605,7 +1605,7 @@ void QgsProjectProperties::populateEllipsoidList() mEllipsoidList.append( myItem ); //check the db is available - myResult = sqlite3_open_v2( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL ); + myResult = sqlite3_open_v2( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, nullptr ); if ( myResult ) { QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) ); @@ -1774,7 +1774,7 @@ void QgsProjectProperties::on_mButtonImportColors_clicked() QFileInfo fileInfo( filePath ); if ( !fileInfo.exists() || !fileInfo.isReadable() ) { - QMessageBox::critical( 0, tr( "Invalid file" ), tr( "Error, file does not exist or is not readable" ) ); + QMessageBox::critical( nullptr, tr( "Invalid file" ), tr( "Error, file does not exist or is not readable" ) ); return; } @@ -1783,7 +1783,7 @@ void QgsProjectProperties::on_mButtonImportColors_clicked() bool importOk = mTreeProjectColors->importColorsFromGpl( file ); if ( !importOk ) { - QMessageBox::critical( 0, tr( "Invalid file" ), tr( "Error, no colors found in palette file" ) ); + QMessageBox::critical( nullptr, tr( "Invalid file" ), tr( "Error, no colors found in palette file" ) ); return; } } @@ -1812,7 +1812,7 @@ void QgsProjectProperties::on_mButtonExportColors_clicked() bool exportOk = mTreeProjectColors->exportColorsToGpl( file ); if ( !exportOk ) { - QMessageBox::critical( 0, tr( "Error exporting" ), tr( "Error writing palette file" ) ); + QMessageBox::critical( nullptr, tr( "Error exporting" ), tr( "Error writing palette file" ) ); return; } } diff --git a/src/app/qgsprojectproperties.h b/src/app/qgsprojectproperties.h index 2334d262a77..0dea26ec990 100644 --- a/src/app/qgsprojectproperties.h +++ b/src/app/qgsprojectproperties.h @@ -39,7 +39,7 @@ class APP_EXPORT QgsProjectProperties : public QgsOptionsDialogBase, private Ui: public: //! Constructor - QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); + QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); //! Destructor ~QgsProjectProperties(); diff --git a/src/app/qgsrastercalcdialog.cpp b/src/app/qgsrastercalcdialog.cpp index ec8e597921d..7a9ed2b1946 100644 --- a/src/app/qgsrastercalcdialog.cpp +++ b/src/app/qgsrastercalcdialog.cpp @@ -164,7 +164,7 @@ void QgsRasterCalcDialog::insertAvailableOutputFormats() GDALDriverH driver = GDALGetDriver( i ); if ( driver ) { - char** driverMetadata = GDALGetMetadata( driver, NULL ); + char** driverMetadata = GDALGetMetadata( driver, nullptr ); if ( CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE, false ) ) { QString driverShortName = GDALGetDriverShortName( driver ); @@ -181,7 +181,7 @@ void QgsRasterCalcDialog::insertAvailableOutputFormats() //store the driver shortnames and the corresponding extensions //(just in case the user does not give an extension for the output file name) - QString driverExtension = GDALGetMetadataItem( driver, GDAL_DMD_EXTENSION, NULL ); + QString driverExtension = GDALGetMetadataItem( driver, GDAL_DMD_EXTENSION, nullptr ); mDriverExtensionMap.insert( driverShortName, driverExtension ); } } @@ -225,7 +225,7 @@ void QgsRasterCalcDialog::on_mButtonBox_accepted() void QgsRasterCalcDialog::on_mOutputLayerPushButton_clicked() { QSettings s; - QString saveFileName = QFileDialog::getSaveFileName( 0, tr( "Enter result file" ), s.value( "/RasterCalculator/lastOutputDir", QDir::homePath() ).toString() ); + QString saveFileName = QFileDialog::getSaveFileName( nullptr, tr( "Enter result file" ), s.value( "/RasterCalculator/lastOutputDir", QDir::homePath() ).toString() ); if ( !saveFileName.isNull() ) { mOutputLayerLineEdit->setText( saveFileName ); @@ -237,7 +237,7 @@ void QgsRasterCalcDialog::on_mCurrentLayerExtentButton_clicked() QListWidgetItem* currentLayerItem = mRasterBandsListWidget->currentItem(); if ( currentLayerItem ) { - QgsRasterLayer* rlayer = 0; + QgsRasterLayer* rlayer = nullptr; QList::const_iterator rasterIt = mAvailableRasterBands.constBegin(); for ( ; rasterIt != mAvailableRasterBands.constEnd(); ++rasterIt ) { diff --git a/src/app/qgsrastercalcdialog.h b/src/app/qgsrastercalcdialog.h index 4c09dd302a1..fbea3a3575b 100644 --- a/src/app/qgsrastercalcdialog.h +++ b/src/app/qgsrastercalcdialog.h @@ -26,7 +26,7 @@ class APP_EXPORT QgsRasterCalcDialog: public QDialog, private Ui::QgsRasterCalcD { Q_OBJECT public: - QgsRasterCalcDialog( QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsRasterCalcDialog( QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsRasterCalcDialog(); QString formulaString() const; diff --git a/src/app/qgsrasterlayerproperties.cpp b/src/app/qgsrasterlayerproperties.cpp index 693118a674d..deb70153dbd 100644 --- a/src/app/qgsrasterlayerproperties.cpp +++ b/src/app/qgsrasterlayerproperties.cpp @@ -77,11 +77,11 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv , mDefaultGreenBand( 0 ) , mDefaultBlueBand( 0 ) , mRasterLayer( qobject_cast( lyr ) ) - , mRendererWidget( 0 ) + , mRendererWidget( nullptr ) , mGradientHeight( 0.0 ) , mGradientWidth( 0.0 ) , mMapCanvas( theCanvas ) - , mHistogramWidget( NULL ) + , mHistogramWidget( nullptr ) { mGrayMinimumMaximumEstimated = true; mRGBMinimumMaximumEstimated = true; @@ -154,7 +154,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv pbnImportTransparentPixelValues->setIcon( QgsApplication::getThemeIcon( "/mActionFileOpen.svg" ) ); pbnExportTransparentPixelValues->setIcon( QgsApplication::getThemeIcon( "/mActionFileSave.svg" ) ); - mPixelSelectorTool = 0; + mPixelSelectorTool = nullptr; if ( mMapCanvas ) { mPixelSelectorTool = new QgsMapToolEmitPoint( theCanvas ); @@ -343,7 +343,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv } // create histogram widget - mHistogramWidget = NULL; + mHistogramWidget = nullptr; if ( mOptsPage_Histogram->isEnabled() ) { mHistogramWidget = new QgsRasterHistogramWidget( mRasterLayer, mOptsPage_Histogram ); @@ -589,21 +589,21 @@ void QgsRasterLayerProperties::sync() // TODO: Wouldn't it be better to just removeWidget() the tabs than delete them? [LS] if ( !( mRasterLayer->dataProvider()->capabilities() & QgsRasterDataProvider::BuildPyramids ) ) { - if ( mOptsPage_Pyramids != NULL ) + if ( mOptsPage_Pyramids != nullptr ) { delete mOptsPage_Pyramids; - mOptsPage_Pyramids = NULL; + mOptsPage_Pyramids = nullptr; } } if ( !( mRasterLayer->dataProvider()->capabilities() & QgsRasterDataProvider::Size ) ) { - if ( mOptsPage_Histogram != NULL ) + if ( mOptsPage_Histogram != nullptr ) { delete mOptsPage_Histogram; - mOptsPage_Histogram = NULL; + mOptsPage_Histogram = nullptr; delete mHistogramWidget; - mHistogramWidget = NULL; + mHistogramWidget = nullptr; } } @@ -890,7 +890,7 @@ void QgsRasterLayerProperties::apply() QgsRasterResampleFilter* resampleFilter = mRasterLayer->resampleFilter(); if ( resampleFilter ) { - QgsRasterResampler *zoomedInResampler = 0; + QgsRasterResampler *zoomedInResampler = nullptr; QString zoomedInResamplingMethod = mZoomedInResamplingComboBox->currentText(); if ( zoomedInResamplingMethod == tr( "Bilinear" ) ) { @@ -904,7 +904,7 @@ void QgsRasterLayerProperties::apply() resampleFilter->setZoomedInResampler( zoomedInResampler ); //raster resampling - QgsRasterResampler *zoomedOutResampler = 0; + QgsRasterResampler *zoomedOutResampler = nullptr; QString zoomedOutResamplingMethod = mZoomedOutResamplingComboBox->currentText(); if ( zoomedOutResamplingMethod == tr( "Average" ) ) { @@ -1155,7 +1155,7 @@ void QgsRasterLayerProperties::setTransparencyCell( int row, int column, double { // transparency // Who needs transparency as floating point? - lineEdit->setValidator( new QIntValidator( 0 ) ); + lineEdit->setValidator( new QIntValidator( nullptr ) ); lineEdit->setText( QString::number( static_cast( value ) ) ); } else @@ -1166,14 +1166,14 @@ void QgsRasterLayerProperties::setTransparencyCell( int row, int column, double { case QGis::Float32: case QGis::Float64: - lineEdit->setValidator( new QDoubleValidator( 0 ) ); + lineEdit->setValidator( new QDoubleValidator( nullptr ) ); if ( !qIsNaN( value ) ) { valueString = QgsRasterBlock::printValue( value ); } break; default: - lineEdit->setValidator( new QIntValidator( 0 ) ); + lineEdit->setValidator( new QIntValidator( nullptr ) ); if ( !qIsNaN( value ) ) { valueString = QString::number( static_cast( value ) ); @@ -1373,7 +1373,7 @@ void QgsRasterLayerProperties::setTransparencyToEdited( int row ) void QgsRasterLayerProperties::mOptionsStackedWidget_CurrentChanged( int indx ) { - if ( mHistogramWidget == 0 ) return; + if ( mHistogramWidget == nullptr ) return; if ( indx == 5 ) { @@ -1764,7 +1764,7 @@ void QgsRasterLayerProperties::on_mResetColorRenderingBtn_clicked() bool QgsRasterLayerProperties::rasterIsMultiBandColor() { - return mRasterLayer && dynamic_cast( mRasterLayer->renderer() ) != 0; + return mRasterLayer && dynamic_cast( mRasterLayer->renderer() ) != nullptr; } diff --git a/src/app/qgsrasterlayerproperties.h b/src/app/qgsrasterlayerproperties.h index 1cbdbcff739..0dd9b7495d0 100644 --- a/src/app/qgsrasterlayerproperties.h +++ b/src/app/qgsrasterlayerproperties.h @@ -46,7 +46,7 @@ class APP_EXPORT QgsRasterLayerProperties : public QgsOptionsDialogBase, private /** \brief Constructor * @param ml Map layer for which properties will be displayed */ - QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanvas* theCanvas, QWidget *parent = 0, Qt::WindowFlags = QgisGui::ModalDialogFlags ); + QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanvas* theCanvas, QWidget *parent = nullptr, Qt::WindowFlags = QgisGui::ModalDialogFlags ); /** \brief Destructor */ ~QgsRasterLayerProperties(); diff --git a/src/app/qgsrelationadddlg.h b/src/app/qgsrelationadddlg.h index d36626c8517..115226b7796 100644 --- a/src/app/qgsrelationadddlg.h +++ b/src/app/qgsrelationadddlg.h @@ -11,7 +11,7 @@ class APP_EXPORT QgsRelationAddDlg : public QDialog, private Ui::QgsRelationAddD Q_OBJECT public: - explicit QgsRelationAddDlg( QWidget *parent = 0 ); + explicit QgsRelationAddDlg( QWidget *parent = nullptr ); void addLayers( const QList& layers ); diff --git a/src/app/qgsrelationmanagerdialog.h b/src/app/qgsrelationmanagerdialog.h index d0df1e0faab..8032beaa811 100644 --- a/src/app/qgsrelationmanagerdialog.h +++ b/src/app/qgsrelationmanagerdialog.h @@ -29,7 +29,7 @@ class APP_EXPORT QgsRelationManagerDialog : public QWidget, private Ui::QgsRelat Q_OBJECT public: - explicit QgsRelationManagerDialog( QgsRelationManager* relationMgr, QWidget *parent = 0 ); + explicit QgsRelationManagerDialog( QgsRelationManager* relationMgr, QWidget *parent = nullptr ); ~QgsRelationManagerDialog(); void setLayers( const QList& ); diff --git a/src/app/qgsrulebasedlabelingwidget.cpp b/src/app/qgsrulebasedlabelingwidget.cpp index ef551bef074..8fd0828c522 100644 --- a/src/app/qgsrulebasedlabelingwidget.cpp +++ b/src/app/qgsrulebasedlabelingwidget.cpp @@ -14,8 +14,8 @@ QgsRuleBasedLabelingWidget::QgsRuleBasedLabelingWidget( QgsVectorLayer* layer, Q : QWidget( parent ) , mLayer( layer ) , mCanvas( canvas ) - , mRootRule( 0 ) - , mModel( 0 ) + , mRootRule( nullptr ) + , mModel( nullptr ) { setupUi( this ); @@ -50,7 +50,7 @@ QgsRuleBasedLabelingWidget::QgsRuleBasedLabelingWidget( QgsVectorLayer* layer, Q } else { - mRootRule = new QgsRuleBasedLabeling::Rule( 0 ); + mRootRule = new QgsRuleBasedLabeling::Rule( nullptr ); } mModel = new QgsRuleBasedLabelingModel( mRootRule ); @@ -159,7 +159,7 @@ QgsRuleBasedLabeling::Rule* QgsRuleBasedLabelingWidget::currentRule() QItemSelectionModel* sel = viewRules->selectionModel(); QModelIndex idx = sel->currentIndex(); if ( !idx.isValid() ) - return NULL; + return nullptr; return mModel->ruleForIndex( idx ); } @@ -525,7 +525,7 @@ void QgsRuleBasedLabelingModel::updateRule( const QModelIndex& parent, int row ) ///////// QgsLabelingRulePropsDialog::QgsLabelingRulePropsDialog( QgsRuleBasedLabeling::Rule* rule, QgsVectorLayer* layer, QWidget* parent, QgsMapCanvas* mapCanvas ) - : QDialog( parent ), mRule( rule ), mLayer( layer ), mLabelingGui( 0 ), mSettings( 0 ), mMapCanvas( mapCanvas ) + : QDialog( parent ), mRule( rule ), mLayer( layer ), mLabelingGui( nullptr ), mSettings( nullptr ), mMapCanvas( mapCanvas ) { setupUi( this ); #ifdef Q_OS_MAC @@ -597,7 +597,7 @@ void QgsLabelingRulePropsDialog::testFilter() QgsExpressionContext context; context << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ); + << QgsExpressionContextUtils::atlasScope( nullptr ); if ( mMapCanvas ) { context << QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() ) @@ -642,7 +642,7 @@ void QgsLabelingRulePropsDialog::buildExpression() QgsExpressionContext context; context << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ); + << QgsExpressionContextUtils::atlasScope( nullptr ); if ( mMapCanvas ) { context << QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() ) @@ -667,7 +667,7 @@ void QgsLabelingRulePropsDialog::accept() // caution: rule uses scale denom, scale widget uses true scales mRule->setScaleMinDenom( groupScale->isChecked() ? mScaleRangeWidget->minimumScaleDenom() : 0 ); mRule->setScaleMaxDenom( groupScale->isChecked() ? mScaleRangeWidget->maximumScaleDenom() : 0 ); - mRule->setSettings( groupSettings->isChecked() ? new QgsPalLayerSettings( mLabelingGui->layerSettings() ) : 0 ); + mRule->setSettings( groupSettings->isChecked() ? new QgsPalLayerSettings( mLabelingGui->layerSettings() ) : nullptr ); QDialog::accept(); } diff --git a/src/app/qgsrulebasedlabelingwidget.h b/src/app/qgsrulebasedlabelingwidget.h index 18d29d415e4..30bf75343f5 100644 --- a/src/app/qgsrulebasedlabelingwidget.h +++ b/src/app/qgsrulebasedlabelingwidget.h @@ -16,7 +16,7 @@ class APP_EXPORT QgsRuleBasedLabelingModel : public QAbstractItemModel Q_OBJECT public: - QgsRuleBasedLabelingModel( QgsRuleBasedLabeling::Rule* rootRule, QObject* parent = 0 ); + QgsRuleBasedLabelingModel( QgsRuleBasedLabeling::Rule* rootRule, QObject* parent = nullptr ); virtual Qt::ItemFlags flags( const QModelIndex &index ) const override; virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; @@ -63,7 +63,7 @@ class QgsRuleBasedLabelingWidget : public QWidget, private Ui::QgsRuleBasedLabel { Q_OBJECT public: - QgsRuleBasedLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canvas, QWidget* parent = 0 ); + QgsRuleBasedLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canvas, QWidget* parent = nullptr ); ~QgsRuleBasedLabelingWidget(); //! save config to layer @@ -106,7 +106,7 @@ class APP_EXPORT QgsLabelingRulePropsDialog : public QDialog, private Ui::QgsLab Q_OBJECT public: - QgsLabelingRulePropsDialog( QgsRuleBasedLabeling::Rule* rule, QgsVectorLayer* layer, QWidget* parent = 0, QgsMapCanvas* mapCanvas = 0 ); + QgsLabelingRulePropsDialog( QgsRuleBasedLabeling::Rule* rule, QgsVectorLayer* layer, QWidget* parent = nullptr, QgsMapCanvas* mapCanvas = nullptr ); ~QgsLabelingRulePropsDialog(); QgsRuleBasedLabeling::Rule* rule() { return mRule; } diff --git a/src/app/qgssavestyletodbdialog.h b/src/app/qgssavestyletodbdialog.h index 463a2a71c23..693cc1ec8b9 100644 --- a/src/app/qgssavestyletodbdialog.h +++ b/src/app/qgssavestyletodbdialog.h @@ -19,7 +19,7 @@ class APP_EXPORT QgsSaveStyleToDbDialog : public QDialog, private Ui::QgsSaveToD QString mUIFileContent; Q_OBJECT public: - explicit QgsSaveStyleToDbDialog( QWidget *parent = 0 ); + explicit QgsSaveStyleToDbDialog( QWidget *parent = nullptr ); ~QgsSaveStyleToDbDialog(); diff --git a/src/app/qgssettingstree.cpp b/src/app/qgssettingstree.cpp index 85d4968acd3..56b8f50c41e 100644 --- a/src/app/qgssettingstree.cpp +++ b/src/app/qgssettingstree.cpp @@ -61,7 +61,7 @@ QgsSettingsTree::QgsSettingsTree( QWidget *parent ) header()->resizeSection( 1, 100 ); header()->resizeSection( 2, 100 ); - settings = 0; + settings = nullptr; refreshTimer.setInterval( 2000 ); autoRefresh = false; @@ -154,7 +154,7 @@ void QgsSettingsTree::refresh() } } - updateChildItems( 0 ); + updateChildItems( nullptr ); connect( this, SIGNAL( itemChanged( QTreeWidgetItem*, int ) ), this, SLOT( updateSetting( QTreeWidgetItem* ) ) ); @@ -255,7 +255,7 @@ void QgsSettingsTree::updateChildItems( QTreeWidgetItem *parent ) QTreeWidgetItem *QgsSettingsTree::createItem( const QString &text, QTreeWidgetItem *parent, int index ) { - QTreeWidgetItem *after = 0; + QTreeWidgetItem *after = nullptr; if ( index != 0 ) after = childAt( parent, index - 1 ); diff --git a/src/app/qgssettingstree.h b/src/app/qgssettingstree.h index 50624e450db..266ebf99357 100644 --- a/src/app/qgssettingstree.h +++ b/src/app/qgssettingstree.h @@ -52,7 +52,7 @@ class QgsSettingsTree : public QTreeWidget Q_OBJECT public: - explicit QgsSettingsTree( QWidget *parent = 0 ); + explicit QgsSettingsTree( QWidget *parent = nullptr ); void setSettingsObject( QSettings *settings ); QSize sizeHint() const override; diff --git a/src/app/qgsshortcutsmanager.cpp b/src/app/qgsshortcutsmanager.cpp index 3f9093a34e6..d9ebf583dae 100644 --- a/src/app/qgsshortcutsmanager.cpp +++ b/src/app/qgsshortcutsmanager.cpp @@ -17,7 +17,7 @@ #include -QgsShortcutsManager* QgsShortcutsManager::mInstance = NULL; +QgsShortcutsManager* QgsShortcutsManager::mInstance = nullptr; QgsShortcutsManager::QgsShortcutsManager( QObject *parent ) : QObject( parent ) { @@ -25,7 +25,7 @@ QgsShortcutsManager::QgsShortcutsManager( QObject *parent ) : QObject( parent ) QgsShortcutsManager::~QgsShortcutsManager() { - mInstance = 0; + mInstance = nullptr; } QgsShortcutsManager* QgsShortcutsManager::instance( QObject *parent ) @@ -87,7 +87,7 @@ bool QgsShortcutsManager::setActionShortcut( QAction* action, const QString& sho QAction* QgsShortcutsManager::actionForShortcut( const QKeySequence& s ) { if ( s.isEmpty() ) - return NULL; + return nullptr; for ( ActionsHash::iterator it = mActions.begin(); it != mActions.end(); ++it ) { @@ -95,7 +95,7 @@ QAction* QgsShortcutsManager::actionForShortcut( const QKeySequence& s ) return it.key(); } - return NULL; + return nullptr; } QAction* QgsShortcutsManager::actionByName( const QString& name ) @@ -106,7 +106,7 @@ QAction* QgsShortcutsManager::actionByName( const QString& name ) return it.key(); } - return NULL; + return nullptr; } void QgsShortcutsManager::registerAllChildrenActions( QObject* object ) diff --git a/src/app/qgsshortcutsmanager.h b/src/app/qgsshortcutsmanager.h index fcf516d5e14..6bc938f38c5 100644 --- a/src/app/qgsshortcutsmanager.h +++ b/src/app/qgsshortcutsmanager.h @@ -30,7 +30,7 @@ class APP_EXPORT QgsShortcutsManager : public QObject public: //! return instance of the manager - static QgsShortcutsManager* instance( QObject *parent = NULL ); + static QgsShortcutsManager* instance( QObject *parent = nullptr ); //! register all actions which are children of the passed object void registerAllChildrenActions( QObject* object ); diff --git a/src/app/qgssnappingdialog.cpp b/src/app/qgssnappingdialog.cpp index 6c91efe4b13..352a9114a5e 100644 --- a/src/app/qgssnappingdialog.cpp +++ b/src/app/qgssnappingdialog.cpp @@ -35,7 +35,7 @@ QgsSnappingDialog::QgsSnappingDialog( QWidget* parent, QgsMapCanvas* canvas ) : QDialog( parent ) , mMapCanvas( canvas ) - , mDock( 0 ) + , mDock( nullptr ) { setupUi( this ); @@ -89,8 +89,8 @@ QgsSnappingDialog::QgsSnappingDialog( QWidget* parent, QgsMapCanvas* canvas ) } QgsSnappingDialog::QgsSnappingDialog() - : mMapCanvas( NULL ) - , mDock( NULL ) + : mMapCanvas( nullptr ) + , mDock( nullptr ) { } @@ -361,7 +361,7 @@ void QgsSnappingDialog::addLayer( QgsMapLayer *theMapLayer ) cbxUnits->setCurrentIndex( defaultSnappingUnit ); mLayerTreeWidget->setItemWidget( item, 4, cbxUnits ); - QCheckBox *cbxAvoidIntersection = 0; + QCheckBox *cbxAvoidIntersection = nullptr; if ( currentVectorLayer->geometryType() == QGis::Polygon ) { cbxAvoidIntersection = new QCheckBox( mLayerTreeWidget ); @@ -443,14 +443,14 @@ void QgsSnappingDialog::layersWillBeRemoved( const QStringList& thelayers ) { Q_FOREACH ( const QString& theLayerId, thelayers ) { - QTreeWidgetItem *item = 0; + QTreeWidgetItem *item = nullptr; for ( int i = 0; i < mLayerTreeWidget->topLevelItemCount(); ++i ) { item = mLayerTreeWidget->topLevelItem( i ); if ( item && item->data( 0, Qt::UserRole ).toString() == theLayerId ) break; - item = 0; + item = nullptr; } if ( item ) diff --git a/src/app/qgssnappingdialog.h b/src/app/qgssnappingdialog.h index 7bd4955d40d..a4adbd80222 100644 --- a/src/app/qgssnappingdialog.h +++ b/src/app/qgssnappingdialog.h @@ -107,7 +107,7 @@ class QgsSnappingDock : public QDockWidget Q_OBJECT public: - QgsSnappingDock( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 ); + QgsSnappingDock( const QString & title, QWidget * parent = nullptr, Qt::WindowFlags flags = nullptr ); virtual void closeEvent( QCloseEvent *e ) override; diff --git a/src/app/qgsstatisticalsummarydockwidget.cpp b/src/app/qgsstatisticalsummarydockwidget.cpp index ed3e01ba9c8..e2c7e97bc71 100644 --- a/src/app/qgsstatisticalsummarydockwidget.cpp +++ b/src/app/qgsstatisticalsummarydockwidget.cpp @@ -58,7 +58,7 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsStatisticalSummaryDockWidget::QgsStatisticalSummaryDockWidget( QWidget *parent ) : QDockWidget( parent ) - , mLayer( 0 ) + , mLayer( nullptr ) { setupUi( this ); @@ -126,7 +126,7 @@ void QgsStatisticalSummaryDockWidget::refreshStatistics() } QList< QgsStatisticalSummary::Statistic > statsToDisplay; - QgsStatisticalSummary::Statistics statsToCalc = 0; + QgsStatisticalSummary::Statistics statsToCalc = nullptr; Q_FOREACH ( QgsStatisticalSummary::Statistic stat, mDisplayStats ) { if ( mStatsActions.value( stat )->isChecked() ) @@ -235,7 +235,7 @@ void QgsStatisticalSummaryDockWidget::layersRemoved( const QStringList& layers ) if ( mLayer && layers.contains( mLayer->id() ) ) { disconnect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( layerSelectionChanged() ) ); - mLayer = 0; + mLayer = nullptr; } } diff --git a/src/app/qgsstatisticalsummarydockwidget.h b/src/app/qgsstatisticalsummarydockwidget.h index 38b7e402e21..5d1c537aeaa 100644 --- a/src/app/qgsstatisticalsummarydockwidget.h +++ b/src/app/qgsstatisticalsummarydockwidget.h @@ -35,7 +35,7 @@ class APP_EXPORT QgsStatisticalSummaryDockWidget : public QDockWidget, private U Q_OBJECT public: - QgsStatisticalSummaryDockWidget( QWidget *parent = 0 ); + QgsStatisticalSummaryDockWidget( QWidget *parent = nullptr ); ~QgsStatisticalSummaryDockWidget(); /** Returns the currently active layer for the widget diff --git a/src/app/qgsstatusbarcoordinateswidget.cpp b/src/app/qgsstatusbarcoordinateswidget.cpp index 609262afd49..a31191e7371 100644 --- a/src/app/qgsstatusbarcoordinateswidget.cpp +++ b/src/app/qgsstatusbarcoordinateswidget.cpp @@ -30,8 +30,8 @@ QgsStatusBarCoordinatesWidget::QgsStatusBarCoordinatesWidget( QWidget *parent ) : QWidget( parent ) - , mDizzyTimer( 0 ) - , mMapCanvas( 0 ) + , mDizzyTimer( nullptr ) + , mMapCanvas( nullptr ) , mMousePrecisionDecimalPlaces( 0 ) { // add a label to show current position diff --git a/src/app/qgssvgannotationdialog.cpp b/src/app/qgssvgannotationdialog.cpp index 7597765b8c0..93ba43c3899 100644 --- a/src/app/qgssvgannotationdialog.cpp +++ b/src/app/qgssvgannotationdialog.cpp @@ -23,7 +23,7 @@ #include QgsSvgAnnotationDialog::QgsSvgAnnotationDialog( QgsSvgAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ): - QDialog( parent, f ), mItem( item ), mEmbeddedWidget( 0 ) + QDialog( parent, f ), mItem( item ), mEmbeddedWidget( nullptr ) { setupUi( this ); setWindowTitle( tr( "SVG annotation" ) ); @@ -43,7 +43,7 @@ QgsSvgAnnotationDialog::QgsSvgAnnotationDialog( QgsSvgAnnotationItem* item, QWid mButtonBox->addButton( deleteButton, QDialogButtonBox::RejectRole ); } -QgsSvgAnnotationDialog::QgsSvgAnnotationDialog(): QDialog(), mItem( 0 ), mEmbeddedWidget( 0 ) +QgsSvgAnnotationDialog::QgsSvgAnnotationDialog(): QDialog(), mItem( nullptr ), mEmbeddedWidget( nullptr ) { } @@ -61,7 +61,7 @@ void QgsSvgAnnotationDialog::on_mBrowseToolButton_clicked() { directory = fi.absolutePath(); } - QString filename = QFileDialog::getOpenFileName( 0, tr( "Select SVG file" ), directory, tr( "SVG files" ) + " (*.svg)" ); + QString filename = QFileDialog::getOpenFileName( nullptr, tr( "Select SVG file" ), directory, tr( "SVG files" ) + " (*.svg)" ); mFileLineEdit->setText( filename ); } @@ -88,5 +88,5 @@ void QgsSvgAnnotationDialog::deleteItem() scene->removeItem( mItem ); } delete mItem; - mItem = 0; + mItem = nullptr; } diff --git a/src/app/qgssvgannotationdialog.h b/src/app/qgssvgannotationdialog.h index ef048cd9323..f11136a2979 100644 --- a/src/app/qgssvgannotationdialog.h +++ b/src/app/qgssvgannotationdialog.h @@ -27,7 +27,7 @@ class APP_EXPORT QgsSvgAnnotationDialog: public QDialog, private Ui::QgsFormAnno { Q_OBJECT public: - QgsSvgAnnotationDialog( QgsSvgAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsSvgAnnotationDialog( QgsSvgAnnotationItem* item, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsSvgAnnotationDialog(); private slots: diff --git a/src/app/qgstextannotationdialog.cpp b/src/app/qgstextannotationdialog.cpp index 1b683544405..1b6ed20f3b8 100644 --- a/src/app/qgstextannotationdialog.cpp +++ b/src/app/qgstextannotationdialog.cpp @@ -21,7 +21,7 @@ #include #include -QgsTextAnnotationDialog::QgsTextAnnotationDialog( QgsTextAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ): QDialog( parent, f ), mItem( item ), mTextDocument( 0 ) +QgsTextAnnotationDialog::QgsTextAnnotationDialog( QgsTextAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ): QDialog( parent, f ), mItem( item ), mTextDocument( nullptr ) { setupUi( this ); mEmbeddedWidget = new QgsAnnotationWidget( mItem ); @@ -139,6 +139,6 @@ void QgsTextAnnotationDialog::deleteItem() scene->removeItem( mItem ); } delete mItem; - mItem = 0; + mItem = nullptr; } diff --git a/src/app/qgstextannotationdialog.h b/src/app/qgstextannotationdialog.h index bf1e0c19729..26c8807df0d 100644 --- a/src/app/qgstextannotationdialog.h +++ b/src/app/qgstextannotationdialog.h @@ -27,7 +27,7 @@ class APP_EXPORT QgsTextAnnotationDialog: public QDialog, private Ui::QgsTextAnn { Q_OBJECT public: - QgsTextAnnotationDialog( QgsTextAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsTextAnnotationDialog( QgsTextAnnotationItem* item, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsTextAnnotationDialog(); private: diff --git a/src/app/qgstipgui.cpp b/src/app/qgstipgui.cpp index ab8b78bc1b6..c1d1f7cd0f2 100644 --- a/src/app/qgstipgui.cpp +++ b/src/app/qgstipgui.cpp @@ -28,7 +28,7 @@ QgsTipGui::QgsTipGui() : QDialog( NULL, Qt::WindowSystemMenuHint ) // Modeless dialog with close button only #else QgsTipGui::QgsTipGui() - : QDialog( NULL ) // Normal dialog in non Mac-OS + : QDialog( nullptr ) // Normal dialog in non Mac-OS #endif { setupUi( this ); diff --git a/src/app/qgsundowidget.cpp b/src/app/qgsundowidget.cpp index 851a0cb700e..762f603be07 100644 --- a/src/app/qgsundowidget.cpp +++ b/src/app/qgsundowidget.cpp @@ -37,7 +37,7 @@ QgsUndoWidget::QgsUndoWidget( QWidget * parent, QgsMapCanvas * mapCanvas ) mMapCanvas = mapCanvas; mUndoView = new QUndoView( dockWidgetContents ); gridLayout->addWidget( mUndoView, 0, 0, 1, 2 ); - mUndoStack = NULL; + mUndoStack = nullptr; mPreviousIndex = 0; mPreviousCount = 0; } @@ -45,7 +45,7 @@ QgsUndoWidget::QgsUndoWidget( QWidget * parent, QgsMapCanvas * mapCanvas ) void QgsUndoWidget::layerChanged( QgsMapLayer * layer ) { - if ( layer != NULL ) + if ( layer != nullptr ) { setUndoStack( layer->undoStack() ); } @@ -59,12 +59,12 @@ void QgsUndoWidget::layerChanged( QgsMapLayer * layer ) void QgsUndoWidget::destroyStack() { - if ( mUndoStack != NULL ) + if ( mUndoStack != nullptr ) { // do not clear undo stack here, just null pointer - mUndoStack = NULL; + mUndoStack = nullptr; } - if ( mUndoView != NULL ) + if ( mUndoView != nullptr ) { mUndoView->close(); delete mUndoView; @@ -141,11 +141,11 @@ void QgsUndoWidget::redo() void QgsUndoWidget::setUndoStack( QUndoStack* undoStack ) { - if ( mUndoView != NULL ) + if ( mUndoView != nullptr ) { mUndoView->close(); delete mUndoView; - mUndoView = NULL; + mUndoView = nullptr; } mUndoStack = undoStack; @@ -209,9 +209,9 @@ void QgsUndoWidget::setupUi( QDockWidget *UndoWidget ) void QgsUndoWidget::retranslateUi( QDockWidget *UndoWidget ) { - UndoWidget->setWindowTitle( QApplication::translate( "UndoWidget", "Undo/Redo Panel", 0, QApplication::UnicodeUTF8 ) ); - undoButton->setText( QApplication::translate( "UndoWidget", "Undo", 0, QApplication::UnicodeUTF8 ) ); - redoButton->setText( QApplication::translate( "UndoWidget", "Redo", 0, QApplication::UnicodeUTF8 ) ); + UndoWidget->setWindowTitle( QApplication::translate( "UndoWidget", "Undo/Redo Panel", nullptr, QApplication::UnicodeUTF8 ) ); + undoButton->setText( QApplication::translate( "UndoWidget", "Undo", nullptr, QApplication::UnicodeUTF8 ) ); + redoButton->setText( QApplication::translate( "UndoWidget", "Redo", nullptr, QApplication::UnicodeUTF8 ) ); Q_UNUSED( UndoWidget ); } diff --git a/src/app/qgsvariantdelegate.cpp b/src/app/qgsvariantdelegate.cpp index c7f6a8e5eb3..719fa0dd4d9 100644 --- a/src/app/qgsvariantdelegate.cpp +++ b/src/app/qgsvariantdelegate.cpp @@ -89,11 +89,11 @@ QWidget* QgsVariantDelegate::createEditor( QWidget* parent, { Q_UNUSED( option ) if ( index.column() != 2 ) - return 0; + return nullptr; QVariant originalValue = index.model()->data( index, Qt::UserRole ); if ( !isSupportedType( QgsVariantDelegate::type( originalValue ) ) ) - return 0; + return nullptr; QLineEdit* lineEdit = new QLineEdit( parent ); lineEdit->setFrame( false ); diff --git a/src/app/qgsvariantdelegate.h b/src/app/qgsvariantdelegate.h index 3c0a54506d4..b77221b5429 100644 --- a/src/app/qgsvariantdelegate.h +++ b/src/app/qgsvariantdelegate.h @@ -49,7 +49,7 @@ class QgsVariantDelegate : public QItemDelegate Q_OBJECT public: - explicit QgsVariantDelegate( QObject* parent = 0 ); + explicit QgsVariantDelegate( QObject* parent = nullptr ); void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const override; diff --git a/src/app/qgsvectorlayerproperties.cpp b/src/app/qgsvectorlayerproperties.cpp index c598c740045..d5ac0691dbf 100644 --- a/src/app/qgsvectorlayerproperties.cpp +++ b/src/app/qgsvectorlayerproperties.cpp @@ -77,14 +77,14 @@ QgsVectorLayerProperties::QgsVectorLayerProperties( , layer( lyr ) , mMetadataFilled( false ) , mOriginalSubsetSQL( lyr->subsetString() ) - , mSaveAsMenu( 0 ) - , mLoadStyleMenu( 0 ) - , mRendererDialog( 0 ) - , labelingDialog( 0 ) - , labelDialog( 0 ) - , actionDialog( 0 ) - , diagramPropertiesDialog( 0 ) - , mFieldsPropertiesDialog( 0 ) + , mSaveAsMenu( nullptr ) + , mLoadStyleMenu( nullptr ) + , mRendererDialog( nullptr ) + , labelingDialog( nullptr ) + , labelDialog( nullptr ) + , actionDialog( nullptr ) + , diagramPropertiesDialog( nullptr ) + , mFieldsPropertiesDialog( nullptr ) { setupUi( this ); // QgsOptionsDialogBase handles saving/restoring of geometry, splitter and current tab states, @@ -147,8 +147,8 @@ QgsVectorLayerProperties::QgsVectorLayerProperties( } else { - labelingDialog = 0; - labelDialog = 0; + labelingDialog = nullptr; + labelDialog = nullptr; mOptsPage_Labels->setEnabled( false ); // disable labeling item mOptsPage_LabelsOld->setEnabled( false ); // disable labeling (deprecated) item } @@ -349,7 +349,7 @@ void QgsVectorLayerProperties::insertExpression() QgsExpressionContext context; context << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ) + << QgsExpressionContextUtils::atlasScope( nullptr ) << QgsExpressionContextUtils::mapSettingsScope( QgisApp::instance()->mapCanvas()->mapSettings() ) << QgsExpressionContextUtils::layerScope( layer ); @@ -500,7 +500,7 @@ void QgsVectorLayerProperties::syncToLayer( void ) disconnect( labelDialog, SIGNAL( labelSourceSet() ), this, SLOT( setLabelCheckBox() ) ); } delete mOptsPage_LabelsOld; - mOptsPage_LabelsOld = 0; + mOptsPage_LabelsOld = nullptr; } } @@ -1241,7 +1241,7 @@ void QgsVectorLayerProperties::updateSymbologyPage() //find out the type of renderer in the vectorlayer, create a dialog with these settings and add it to the form delete mRendererDialog; - mRendererDialog = 0; + mRendererDialog = nullptr; if ( layer->rendererV2() ) { diff --git a/src/app/qgsvectorlayerproperties.h b/src/app/qgsvectorlayerproperties.h index fe3910ed79b..ff144e39bd0 100644 --- a/src/app/qgsvectorlayerproperties.h +++ b/src/app/qgsvectorlayerproperties.h @@ -54,7 +54,7 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private DB, }; - QgsVectorLayerProperties( QgsVectorLayer *lyr = 0, QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); + QgsVectorLayerProperties( QgsVectorLayer *lyr = nullptr, QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); ~QgsVectorLayerProperties(); /** Returns the display name entered in the dialog*/ QString displayName(); diff --git a/src/app/qgsversioninfo.h b/src/app/qgsversioninfo.h index eebca943452..8d1fa6070d4 100644 --- a/src/app/qgsversioninfo.h +++ b/src/app/qgsversioninfo.h @@ -23,7 +23,7 @@ class QgsVersionInfo : public QObject { Q_OBJECT public: - explicit QgsVersionInfo( QObject *parent = 0 ); + explicit QgsVersionInfo( QObject *parent = nullptr ); public slots: /** diff --git a/src/app/qgswelcomepage.h b/src/app/qgswelcomepage.h index d2351f7ea61..e70f39f57e9 100644 --- a/src/app/qgswelcomepage.h +++ b/src/app/qgswelcomepage.h @@ -28,7 +28,7 @@ class QgsWelcomePage : public QWidget Q_OBJECT public: - explicit QgsWelcomePage( QWidget* parent = 0 ); + explicit QgsWelcomePage( QWidget* parent = nullptr ); ~QgsWelcomePage(); diff --git a/src/app/qgswelcomepageitemsmodel.cpp b/src/app/qgswelcomepageitemsmodel.cpp index 67173051577..080dcd2d501 100644 --- a/src/app/qgswelcomepageitemsmodel.cpp +++ b/src/app/qgswelcomepageitemsmodel.cpp @@ -48,7 +48,7 @@ void QgsWelcomePageItemDelegate::paint( QPainter* painter, const QStyleOptionVie ctx.palette.setColor( QPalette::Text, optionV4.palette.color( QPalette::Active, QPalette::HighlightedText ) ); QStyle *style = QApplication::style(); - style->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter, NULL ); + style->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter, nullptr ); } else if ( option.state & QStyle::State_Enabled ) { @@ -56,7 +56,7 @@ void QgsWelcomePageItemDelegate::paint( QPainter* painter, const QStyleOptionVie ctx.palette.setColor( QPalette::Text, optionV4.palette.color( QPalette::Active, QPalette::Text ) ); QStyle *style = QApplication::style(); - style->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter, NULL ); + style->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter, nullptr ); } else { diff --git a/src/app/qgswelcomepageitemsmodel.h b/src/app/qgswelcomepageitemsmodel.h index 640e8fe6571..917edfa0c30 100644 --- a/src/app/qgswelcomepageitemsmodel.h +++ b/src/app/qgswelcomepageitemsmodel.h @@ -25,7 +25,7 @@ class QgsWelcomePageItemDelegate : public QStyledItemDelegate Q_OBJECT public: - explicit QgsWelcomePageItemDelegate( QObject * parent = 0 ); + explicit QgsWelcomePageItemDelegate( QObject * parent = nullptr ); void paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const override; QSize sizeHint( const QStyleOptionViewItem & option, const QModelIndex & index ) const override; }; @@ -51,7 +51,7 @@ class QgsWelcomePageItemsModel : public QAbstractListModel QString crs; }; - explicit QgsWelcomePageItemsModel( QObject* parent = 0 ); + explicit QgsWelcomePageItemsModel( QObject* parent = nullptr ); void setRecentProjects( const QList& recentProjects ); diff --git a/src/auth/basic/qgsauthbasicedit.h b/src/auth/basic/qgsauthbasicedit.h index 14522de0470..edbabd6830f 100644 --- a/src/auth/basic/qgsauthbasicedit.h +++ b/src/auth/basic/qgsauthbasicedit.h @@ -29,7 +29,7 @@ class QgsAuthBasicEdit : public QgsAuthMethodEdit, private Ui::QgsAuthBasicEdit Q_OBJECT public: - explicit QgsAuthBasicEdit( QWidget *parent = 0 ); + explicit QgsAuthBasicEdit( QWidget *parent = nullptr ); virtual ~QgsAuthBasicEdit(); bool validateConfig() override; diff --git a/src/auth/identcert/qgsauthidentcertedit.h b/src/auth/identcert/qgsauthidentcertedit.h index a69fae26f8c..c5bd00f989f 100644 --- a/src/auth/identcert/qgsauthidentcertedit.h +++ b/src/auth/identcert/qgsauthidentcertedit.h @@ -29,7 +29,7 @@ class QgsAuthIdentCertEdit : public QgsAuthMethodEdit, private Ui::QgsAuthIdentC Q_OBJECT public: - explicit QgsAuthIdentCertEdit( QWidget *parent = 0 ); + explicit QgsAuthIdentCertEdit( QWidget *parent = nullptr ); virtual ~QgsAuthIdentCertEdit(); bool validateConfig() override; diff --git a/src/auth/identcert/qgsauthidentcertmethod.cpp b/src/auth/identcert/qgsauthidentcertmethod.cpp index bf04dd312e9..cefae4cade6 100644 --- a/src/auth/identcert/qgsauthidentcertmethod.cpp +++ b/src/auth/identcert/qgsauthidentcertmethod.cpp @@ -122,7 +122,7 @@ void QgsAuthIdentCertMethod::updateMethodConfig( QgsAuthMethodConfig &mconfig ) QgsPkiConfigBundle *QgsAuthIdentCertMethod::getPkiConfigBundle( const QString &authcfg ) { - QgsPkiConfigBundle * bundle = 0; + QgsPkiConfigBundle * bundle = nullptr; // check if it is cached if ( mPkiConfigBundleCache.contains( authcfg ) ) @@ -184,7 +184,7 @@ void QgsAuthIdentCertMethod::removePkiConfigBundle( const QString &authcfg ) { QgsPkiConfigBundle * pkibundle = mPkiConfigBundleCache.take( authcfg ); delete pkibundle; - pkibundle = 0; + pkibundle = nullptr; QgsDebugMsg( QString( "Removed PKI bundle for authcfg: %1" ).arg( authcfg ) ); } } diff --git a/src/auth/pkipaths/qgsauthpkipathsedit.h b/src/auth/pkipaths/qgsauthpkipathsedit.h index a8b29f9b3de..532afde7abb 100644 --- a/src/auth/pkipaths/qgsauthpkipathsedit.h +++ b/src/auth/pkipaths/qgsauthpkipathsedit.h @@ -36,7 +36,7 @@ class QgsAuthPkiPathsEdit : public QgsAuthMethodEdit, private Ui::QgsAuthPkiPath Unknown }; - explicit QgsAuthPkiPathsEdit( QWidget *parent = 0 ); + explicit QgsAuthPkiPathsEdit( QWidget *parent = nullptr ); virtual ~QgsAuthPkiPathsEdit(); bool validateConfig() override; diff --git a/src/auth/pkipaths/qgsauthpkipathsmethod.cpp b/src/auth/pkipaths/qgsauthpkipathsmethod.cpp index 911fa7bca45..e6d57868fec 100644 --- a/src/auth/pkipaths/qgsauthpkipathsmethod.cpp +++ b/src/auth/pkipaths/qgsauthpkipathsmethod.cpp @@ -124,7 +124,7 @@ void QgsAuthPkiPathsMethod::updateMethodConfig( QgsAuthMethodConfig &mconfig ) QgsPkiConfigBundle *QgsAuthPkiPathsMethod::getPkiConfigBundle( const QString &authcfg ) { - QgsPkiConfigBundle * bundle = 0; + QgsPkiConfigBundle * bundle = nullptr; // check if it is cached if ( mPkiConfigBundleCache.contains( authcfg ) ) @@ -184,7 +184,7 @@ void QgsAuthPkiPathsMethod::removePkiConfigBundle( const QString &authcfg ) { QgsPkiConfigBundle * pkibundle = mPkiConfigBundleCache.take( authcfg ); delete pkibundle; - pkibundle = 0; + pkibundle = nullptr; QgsDebugMsg( QString( "Removed PKI bundle for authcfg: %1" ).arg( authcfg ) ); } } diff --git a/src/auth/pkipkcs12/qgsauthpkcs12edit.h b/src/auth/pkipkcs12/qgsauthpkcs12edit.h index dcc3e7ad168..cdc98685d0f 100644 --- a/src/auth/pkipkcs12/qgsauthpkcs12edit.h +++ b/src/auth/pkipkcs12/qgsauthpkcs12edit.h @@ -36,7 +36,7 @@ class QgsAuthPkcs12Edit : public QgsAuthMethodEdit, private Ui::QgsAuthPkcs12Edi Unknown }; - explicit QgsAuthPkcs12Edit( QWidget *parent = 0 ); + explicit QgsAuthPkcs12Edit( QWidget *parent = nullptr ); virtual ~QgsAuthPkcs12Edit(); bool validateConfig() override; diff --git a/src/auth/pkipkcs12/qgsauthpkcs12method.cpp b/src/auth/pkipkcs12/qgsauthpkcs12method.cpp index fa07132d12c..05ec1291167 100644 --- a/src/auth/pkipkcs12/qgsauthpkcs12method.cpp +++ b/src/auth/pkipkcs12/qgsauthpkcs12method.cpp @@ -123,7 +123,7 @@ void QgsAuthPkcs12Method::updateMethodConfig( QgsAuthMethodConfig &mconfig ) QgsPkiConfigBundle *QgsAuthPkcs12Method::getPkiConfigBundle( const QString &authcfg ) { - QgsPkiConfigBundle * bundle = 0; + QgsPkiConfigBundle * bundle = nullptr; // check if it is cached if ( mPkiConfigBundleCache.contains( authcfg ) ) @@ -191,7 +191,7 @@ void QgsAuthPkcs12Method::removePkiConfigBundle( const QString &authcfg ) { QgsPkiConfigBundle * pkibundle = mPkiConfigBundleCache.take( authcfg ); delete pkibundle; - pkibundle = 0; + pkibundle = nullptr; QgsDebugMsg( QString( "Removed PKI bundle for authcfg: %1" ).arg( authcfg ) ); } } diff --git a/src/browser/main.cpp b/src/browser/main.cpp index 6fcb897555e..fafc2d4c776 100644 --- a/src/browser/main.cpp +++ b/src/browser/main.cpp @@ -85,8 +85,8 @@ int main( int argc, char ** argv ) QString myUserLocale = settings.value( "locale/userLocale", "" ).toString(); QString myTranslationCode = !myLocaleOverrideFlag || myUserLocale.isEmpty() ? QLocale::system().name() : myUserLocale; - QTranslator qgistor( 0 ); - QTranslator qttor( 0 ); + QTranslator qgistor( nullptr ); + QTranslator qttor( nullptr ); if ( myTranslationCode != "C" ) { if ( qgistor.load( QString( "qgis_" ) + myTranslationCode, i18nPath ) ) diff --git a/src/browser/qgsbrowser.cpp b/src/browser/qgsbrowser.cpp index 10ff9733e51..65da5b53724 100644 --- a/src/browser/qgsbrowser.cpp +++ b/src/browser/qgsbrowser.cpp @@ -47,9 +47,9 @@ QgsBrowser::QgsBrowser( QWidget *parent, const Qt::WindowFlags& flags ) , mDirtyMetadata( true ) , mDirtyPreview( true ) , mDirtyAttributes( true ) - , mLayer( 0 ) - , mParamWidget( 0 ) - , mAttributeTableFilterModel( 0 ) + , mLayer( nullptr ) + , mParamWidget( nullptr ) + , mAttributeTableFilterModel( nullptr ) { setupUi( this ); @@ -131,7 +131,7 @@ void QgsBrowser::itemClicked( const QModelIndex& index ) mDirtyAttributes = true; // clear the previous stuff - setLayer( 0 ); + setLayer( nullptr ); QList nolayers; mapCanvas->setLayerSet( nolayers ); @@ -141,13 +141,13 @@ void QgsBrowser::itemClicked( const QModelIndex& index ) paramLayout->removeWidget( mParamWidget ); mParamWidget->hide(); delete mParamWidget; - mParamWidget = 0; + mParamWidget = nullptr; } // QgsMapLayerRegistry deletes the previous layer(s) for us // TODO: in future we could cache the layers in the registry QgsMapLayerRegistry::instance()->removeAllMapLayers(); - mLayer = 0; + mLayer = nullptr; // this should probably go to the model and only emit signal when a layer is clicked mParamWidget = item->paramWidget(); @@ -462,7 +462,7 @@ void QgsBrowser::updateCurrentTab() } else { - setLayer( 0 ); + setLayer( nullptr ); } mDirtyAttributes = false; } @@ -519,13 +519,13 @@ void QgsBrowser::refresh( const QModelIndex& index ) void QgsBrowser::setLayer( QgsVectorLayer* vLayer ) { - attributeTable->setModel( NULL ); + attributeTable->setModel( nullptr ); if ( mAttributeTableFilterModel ) { // Cleanup delete mAttributeTableFilterModel; - mAttributeTableFilterModel = NULL; + mAttributeTableFilterModel = nullptr; } if ( vLayer ) @@ -538,7 +538,7 @@ void QgsBrowser::setLayer( QgsVectorLayer* vLayer ) QgsAttributeTableModel *tableModel = new QgsAttributeTableModel( layerCache ); - mAttributeTableFilterModel = new QgsAttributeTableFilterModel( NULL, tableModel, this ); + mAttributeTableFilterModel = new QgsAttributeTableFilterModel( nullptr, tableModel, this ); // Let Qt do the garbage collection layerCache->setParent( tableModel ); diff --git a/src/browser/qgsbrowser.h b/src/browser/qgsbrowser.h index c912fb12a38..910eab188e7 100644 --- a/src/browser/qgsbrowser.h +++ b/src/browser/qgsbrowser.h @@ -30,7 +30,7 @@ class QgsBrowser : public QMainWindow, private Ui::QgsBrowserBase { Q_OBJECT public: - QgsBrowser( QWidget *parent = 0, const Qt::WindowFlags& flags = 0 ); + QgsBrowser( QWidget *parent = nullptr, const Qt::WindowFlags& flags = nullptr ); ~QgsBrowser(); // Expand to given path diff --git a/src/core/auth/qgsauthcertutils.h b/src/core/auth/qgsauthcertutils.h index de009cd7e37..e8c1005b95c 100644 --- a/src/core/auth/qgsauthcertutils.h +++ b/src/core/auth/qgsauthcertutils.h @@ -113,7 +113,7 @@ class CORE_EXPORT QgsAuthCertUtils */ static QSslKey keyFromFile( const QString &keypath, const QString &keypass = QString(), - QString *algtype = 0 ); + QString *algtype = nullptr ); /** Return list of concatenated certs from a PEM Base64 text block */ static QList certsFromString( const QString &pemtext ); diff --git a/src/core/auth/qgsauthcrypto.h b/src/core/auth/qgsauthcrypto.h index ea10436ab71..41c721df37d 100644 --- a/src/core/auth/qgsauthcrypto.h +++ b/src/core/auth/qgsauthcrypto.h @@ -41,13 +41,13 @@ class CORE_EXPORT QgsAuthCrypto static void passwordKeyHash( const QString &pass, QString *salt, QString *hash, - QString *cipheriv = 0 ); + QString *cipheriv = nullptr ); /** Verify existing master password hash to a re-generated one */ static bool verifyPasswordKeyHash( const QString& pass, const QString& salt, const QString& hash, - QString *hashderived = 0 ); + QString *hashderived = nullptr ); private: static QString encryptdecrypt( const QString& passstr, diff --git a/src/core/auth/qgsauthmanager.cpp b/src/core/auth/qgsauthmanager.cpp index c05f9cae679..bb800372f3f 100644 --- a/src/core/auth/qgsauthmanager.cpp +++ b/src/core/auth/qgsauthmanager.cpp @@ -46,7 +46,7 @@ #include "qgscredentials.h" #include "qgslogger.h" -QgsAuthManager *QgsAuthManager::smInstance = 0; +QgsAuthManager *QgsAuthManager::smInstance = nullptr; const QString QgsAuthManager::smAuthConfigTable = "auth_configs"; const QString QgsAuthManager::smAuthPassTable = "auth_pass"; @@ -898,12 +898,12 @@ void QgsAuthManager::updateConfigAuthMethods() QgsAuthMethod *QgsAuthManager::configAuthMethod( const QString &authcfg ) { if ( isDisabled() ) - return 0; + return nullptr; if ( !mConfigAuthMethods.contains( authcfg ) ) { QgsDebugMsg( QString( "No config auth method found in database for authcfg: %1" ).arg( authcfg ) ); - return 0; + return nullptr; } QString authMethodKey = mConfigAuthMethods.value( authcfg ); @@ -930,7 +930,7 @@ QgsAuthMethod *QgsAuthManager::authMethod( const QString &authMethodKey ) if ( !mAuthMethods.contains( authMethodKey ) ) { QgsDebugMsg( QString( "No auth method registered for auth method key: %1" ).arg( authMethodKey ) ); - return 0; + return nullptr; } return mAuthMethods.value( authMethodKey ); @@ -966,14 +966,14 @@ QWidget *QgsAuthManager::authMethodEditWidget( const QString &authMethodKey, QWi QgsAuthMethod::Expansions QgsAuthManager::supportedAuthMethodExpansions( const QString &authcfg ) { if ( isDisabled() ) - return QgsAuthMethod::Expansions( 0 ); + return QgsAuthMethod::Expansions( nullptr ); QgsAuthMethod* authmethod = configAuthMethod( authcfg ); if ( authmethod ) { return authmethod->supportedExpansions(); } - return QgsAuthMethod::Expansions( 0 ); + return QgsAuthMethod::Expansions( nullptr ); } bool QgsAuthManager::storeAuthenticationConfig( QgsAuthMethodConfig &mconfig ) @@ -2810,16 +2810,16 @@ QgsAuthManager::QgsAuthManager() : QObject() , mAuthInit( false ) , mAuthDbPath( QString() ) - , mQcaInitializer( 0 ) + , mQcaInitializer( nullptr ) , mMasterPass( QString() ) , mPassTries( 0 ) , mAuthDisabled( false ) - , mScheduledDbEraseTimer( 0 ) + , mScheduledDbEraseTimer( nullptr ) , mScheduledDbErase( false ) , mScheduledDbEraseRequestWait( 3 ) , mScheduledDbEraseRequestEmitted( false ) , mScheduledDbEraseRequestCount( 0 ) - , mMutex( 0 ) + , mMutex( nullptr ) , mIgnoredSslErrorsCache( QHash >() ) { mMutex = new QMutex( QMutex::Recursive ); @@ -2839,11 +2839,11 @@ QgsAuthManager::~QgsAuthManager() authConn.close(); } delete mMutex; - mMutex = 0; + mMutex = nullptr; delete mScheduledDbEraseTimer; - mScheduledDbEraseTimer = 0; + mScheduledDbEraseTimer = nullptr; delete mQcaInitializer; - mQcaInitializer = 0; + mQcaInitializer = nullptr; QSqlDatabase::removeDatabase( "authentication.configs" ); } diff --git a/src/core/auth/qgsauthmanager.h b/src/core/auth/qgsauthmanager.h index d65870dfe3f..517deb0753c 100644 --- a/src/core/auth/qgsauthmanager.h +++ b/src/core/auth/qgsauthmanager.h @@ -138,7 +138,7 @@ class CORE_EXPORT QgsAuthManager : public QObject * @param keepbackup Whether to keep the generated backup of current database * @param backuppath Where the backup is located, if kept */ - bool resetMasterPassword( const QString& newpass, const QString& oldpass, bool keepbackup, QString *backuppath = 0 ); + bool resetMasterPassword( const QString& newpass, const QString& oldpass, bool keepbackup, QString *backuppath = nullptr ); /** Whether there is a scheduled opitonal erase of authentication database */ bool scheduledAuthDbErase() { return mScheduledDbErase; } @@ -279,7 +279,7 @@ class CORE_EXPORT QgsAuthManager : public QObject * Close connection to current authentication database and back it up * @return Path to backup */ - bool backupAuthenticationDatabase( QString *backuppath = 0 ); + bool backupAuthenticationDatabase( QString *backuppath = nullptr ); /** * Erase all rows from all tables in authentication database @@ -287,7 +287,7 @@ class CORE_EXPORT QgsAuthManager : public QObject * @param backuppath Where the backup is locate * @return Whether operation succeeded */ - bool eraseAuthenticationDatabase( bool backup, QString *backuppath = 0 ); + bool eraseAuthenticationDatabase( bool backup, QString *backuppath = nullptr ); ////////////////// Auth Method calls /////////////////////// diff --git a/src/core/auth/qgsauthmethod.h b/src/core/auth/qgsauthmethod.h index 0e160b28288..3a88ed3e70a 100644 --- a/src/core/auth/qgsauthmethod.h +++ b/src/core/auth/qgsauthmethod.h @@ -145,7 +145,7 @@ class CORE_EXPORT QgsAuthMethod : public QObject * @note Non-public since this is an abstract base class */ explicit QgsAuthMethod() - : mExpansions( QgsAuthMethod::Expansions( 0 ) ) + : mExpansions( QgsAuthMethod::Expansions( nullptr ) ) , mDataProviders( QStringList() ) , mVersion( 0 ) {} diff --git a/src/core/auth/qgsauthmethodregistry.cpp b/src/core/auth/qgsauthmethodregistry.cpp index 1616060aea7..3828ac1c7f4 100644 --- a/src/core/auth/qgsauthmethodregistry.cpp +++ b/src/core/auth/qgsauthmethodregistry.cpp @@ -185,7 +185,7 @@ static QgsAuthMethodMetadata * findMetadata_( QgsAuthMethodRegistry::AuthMethods return i->second; } - return 0x0; + return nullptr; } // findMetadata_ @@ -289,14 +289,14 @@ QgsAuthMethod *QgsAuthMethodRegistry::authMethod( const QString &authMethodKey ) if ( !myLib.load() ) { QgsMessageLog::logMessage( QObject::tr( "Failed to load %1: %2" ).arg( lib, myLib.errorString() ) ); - return 0; + return nullptr; } classFactoryFunction_t *classFactory = ( classFactoryFunction_t * ) cast_to_fptr( myLib.resolve( "classFactory" ) ); if ( !classFactory ) { QgsDebugMsg( QString( "Failed to load %1: no classFactory method" ).arg( lib ) ); - return 0; + return nullptr; } QgsAuthMethod *authMethod = classFactory(); @@ -304,7 +304,7 @@ QgsAuthMethod *QgsAuthMethodRegistry::authMethod( const QString &authMethodKey ) { QgsMessageLog::logMessage( QObject::tr( "Unable to instantiate the auth method plugin %1" ).arg( lib ) ); myLib.unload(); - return 0; + return nullptr; } QgsDebugMsg( QString( "Instantiated the auth method plugin: %1" ).arg( authMethod->key() ) ); @@ -319,7 +319,7 @@ QWidget *QgsAuthMethodRegistry::editWidget( const QString &authMethodKey, QWidge ( editFactoryFunction_t * ) cast_to_fptr( function( authMethodKey, "editWidget" ) ); if ( !editFactory ) - return 0; + return nullptr; return editFactory( parent ); } @@ -357,7 +357,7 @@ void *QgsAuthMethodRegistry::function( QString const & authMethodKey, else { QgsDebugMsg( "Cannot load library: " + myLib.errorString() ); - return 0; + return nullptr; } } #endif @@ -375,7 +375,7 @@ QLibrary *QgsAuthMethodRegistry::authMethodLibrary( const QString &authMethodKey delete myLib; - return 0; + return nullptr; } QStringList QgsAuthMethodRegistry::authMethodList() const diff --git a/src/core/auth/qgsauthmethodregistry.h b/src/core/auth/qgsauthmethodregistry.h index 2dca49fc1ec..b432bd487cb 100644 --- a/src/core/auth/qgsauthmethodregistry.h +++ b/src/core/auth/qgsauthmethodregistry.h @@ -75,7 +75,7 @@ class CORE_EXPORT QgsAuthMethodRegistry * @param parent Parent widget * @param authMethodKey identificator of the auth method */ - QWidget *editWidget( const QString & authMethodKey, QWidget * parent = 0 ); + QWidget *editWidget( const QString & authMethodKey, QWidget * parent = nullptr ); #if QT_VERSION >= 0x050000 /** Get pointer to auth method function diff --git a/src/core/composer/qgsaddremoveitemcommand.h b/src/core/composer/qgsaddremoveitemcommand.h index d711bd96122..346ff8c60d9 100644 --- a/src/core/composer/qgsaddremoveitemcommand.h +++ b/src/core/composer/qgsaddremoveitemcommand.h @@ -35,7 +35,7 @@ class CORE_EXPORT QgsAddRemoveItemCommand: public QObject, public QUndoCommand Removed }; - QgsAddRemoveItemCommand( State s, QgsComposerItem* item, QgsComposition* c, const QString& text, QUndoCommand* parent = 0 ); + QgsAddRemoveItemCommand( State s, QgsComposerItem* item, QgsComposition* c, const QString& text, QUndoCommand* parent = nullptr ); ~QgsAddRemoveItemCommand(); void redo() override; diff --git a/src/core/composer/qgsaddremovemultiframecommand.cpp b/src/core/composer/qgsaddremovemultiframecommand.cpp index 3f9d7499cec..73458f31703 100644 --- a/src/core/composer/qgsaddremovemultiframecommand.cpp +++ b/src/core/composer/qgsaddremovemultiframecommand.cpp @@ -31,8 +31,8 @@ QgsAddRemoveMultiFrameCommand::QgsAddRemoveMultiFrameCommand( State s, QgsCompos } QgsAddRemoveMultiFrameCommand::QgsAddRemoveMultiFrameCommand() - : mMultiFrame( 0 ) - , mComposition( 0 ) + : mMultiFrame( nullptr ) + , mComposition( nullptr ) , mState( Added ) , mFirstRun( true ) { diff --git a/src/core/composer/qgsaddremovemultiframecommand.h b/src/core/composer/qgsaddremovemultiframecommand.h index 962ad231da8..c9835ced727 100644 --- a/src/core/composer/qgsaddremovemultiframecommand.h +++ b/src/core/composer/qgsaddremovemultiframecommand.h @@ -33,7 +33,7 @@ class CORE_EXPORT QgsAddRemoveMultiFrameCommand: public QUndoCommand Removed }; - QgsAddRemoveMultiFrameCommand( State s, QgsComposerMultiFrame* multiFrame, QgsComposition* c, const QString& text, QUndoCommand* parent = 0 ); + QgsAddRemoveMultiFrameCommand( State s, QgsComposerMultiFrame* multiFrame, QgsComposition* c, const QString& text, QUndoCommand* parent = nullptr ); ~QgsAddRemoveMultiFrameCommand(); void redo() override; void undo() override; diff --git a/src/core/composer/qgsatlascomposition.cpp b/src/core/composer/qgsatlascomposition.cpp index c5bee7cafd7..4382f1636e8 100644 --- a/src/core/composer/qgsatlascomposition.cpp +++ b/src/core/composer/qgsatlascomposition.cpp @@ -35,7 +35,7 @@ QgsAtlasComposition::QgsAtlasComposition( QgsComposition* composition ) , mEnabled( false ) , mHideCoverage( false ) , mFilenamePattern( "'output_'||@atlas_featurenumber" ) - , mCoverageLayer( 0 ) + , mCoverageLayer( nullptr ) , mSingleFile( false ) , mSortFeatures( false ) , mSortAscending( true ) @@ -76,7 +76,7 @@ void QgsAtlasComposition::removeLayers( const QStringList& layers ) if ( layerId == mCoverageLayer->id() ) { //current coverage layer removed - mCoverageLayer = 0; + mCoverageLayer = nullptr; setEnabled( false ); return; } @@ -118,7 +118,7 @@ QgsComposerMap* QgsAtlasComposition::composerMap() const } } - return 0; + return nullptr; } void QgsAtlasComposition::setComposerMap( QgsComposerMap* map ) @@ -227,7 +227,7 @@ int QgsAtlasComposition::updateFeatures() nameExpression.reset( new QgsExpression( mPageNameExpression ) ); if ( nameExpression->hasParserError() ) { - nameExpression.reset( 0 ); + nameExpression.reset( nullptr ); } nameExpression->prepare( &expressionContext ); } @@ -312,7 +312,7 @@ void QgsAtlasComposition::endRender() return; } - emit featureChanged( 0 ); + emit featureChanged( nullptr ); updateAtlasMaps(); @@ -688,7 +688,7 @@ void QgsAtlasComposition::readXML( const QDomElement& atlasElem, const QDomDocum } // look for stored layer name - mCoverageLayer = 0; + mCoverageLayer = nullptr; QMap layers = QgsMapLayerRegistry::instance()->mapLayers(); for ( QMap::const_iterator it = layers.begin(); it != layers.end(); ++it ) { @@ -738,7 +738,7 @@ void QgsAtlasComposition::readXMLMapSettings( const QDomElement &elem, const QDo Q_UNUSED( doc ); //look for stored composer map, to upgrade pre 2.1 projects int composerMapNo = elem.attribute( "composerMap", "-1" ).toInt(); - QgsComposerMap * composerMap = 0; + QgsComposerMap * composerMap = nullptr; if ( composerMapNo != -1 ) { QList maps; diff --git a/src/core/composer/qgscomposerarrow.cpp b/src/core/composer/qgscomposerarrow.cpp index 43bca83854e..70ffeef5dc0 100644 --- a/src/core/composer/qgscomposerarrow.cpp +++ b/src/core/composer/qgscomposerarrow.cpp @@ -36,7 +36,7 @@ QgsComposerArrow::QgsComposerArrow( QgsComposition* c ) , mArrowHeadOutlineColor( Qt::black ) , mArrowHeadFillColor( Qt::black ) , mBoundsBehaviour( 24 ) - , mLineSymbol( 0 ) + , mLineSymbol( nullptr ) { init(); } @@ -50,7 +50,7 @@ QgsComposerArrow::QgsComposerArrow( const QPointF& startPoint, const QPointF& st , mArrowHeadOutlineColor( Qt::black ) , mArrowHeadFillColor( Qt::black ) , mBoundsBehaviour( 24 ) - , mLineSymbol( 0 ) + , mLineSymbol( nullptr ) { mStartXIdx = mStopPoint.x() < mStartPoint.x(); mStartYIdx = mStopPoint.y() < mStartPoint.y(); @@ -196,7 +196,7 @@ void QgsComposerArrow::drawLine( QPainter *painter ) << QPointF( mStopPoint.x() - pos().x(), mStopPoint.y() - pos().y() ) * dotsPerMM; mLineSymbol->startRender( context ); - mLineSymbol->renderPolyline( line, 0, context ); + mLineSymbol->renderPolyline( line, nullptr, context ); mLineSymbol->stopRender( context ); painter->restore(); diff --git a/src/core/composer/qgscomposerattributetable.cpp b/src/core/composer/qgscomposerattributetable.cpp index e0324e958c3..2b4f70f00e1 100644 --- a/src/core/composer/qgscomposerattributetable.cpp +++ b/src/core/composer/qgscomposerattributetable.cpp @@ -93,8 +93,8 @@ bool QgsComposerAttributeTableCompare::operator()( const QgsAttributeMap& m1, co QgsComposerAttributeTable::QgsComposerAttributeTable( QgsComposition* composition ) : QgsComposerTable( composition ) - , mVectorLayer( 0 ) - , mComposerMap( 0 ) + , mVectorLayer( nullptr ) + , mComposerMap( nullptr ) , mMaximumNumberOfFeatures( 5 ) , mShowOnlyVisibleFeatures( false ) , mFilterFeatures( false ) @@ -482,7 +482,7 @@ void QgsComposerAttributeTable::removeLayer( const QString& layerId ) { if ( layerId == mVectorLayer->id() ) { - mVectorLayer = 0; + mVectorLayer = nullptr; //remove existing columns qDeleteAll( mColumns ); mColumns.clear(); @@ -609,7 +609,7 @@ bool QgsComposerAttributeTable::readXML( const QDomElement& itemElem, const QDom int composerMapId = itemElem.attribute( "composerMap", "-1" ).toInt(); if ( composerMapId == -1 ) { - mComposerMap = 0; + mComposerMap = nullptr; } if ( composition() ) @@ -618,7 +618,7 @@ bool QgsComposerAttributeTable::readXML( const QDomElement& itemElem, const QDom } else { - mComposerMap = 0; + mComposerMap = nullptr; } if ( mComposerMap ) @@ -631,7 +631,7 @@ bool QgsComposerAttributeTable::readXML( const QDomElement& itemElem, const QDom QString layerId = itemElem.attribute( "vectorLayer", "not_existing" ); if ( layerId == "not_existing" ) { - mVectorLayer = 0; + mVectorLayer = nullptr; } else { diff --git a/src/core/composer/qgscomposerattributetablemodel.h b/src/core/composer/qgscomposerattributetablemodel.h index 389860c2e60..a91fa03dfac 100644 --- a/src/core/composer/qgscomposerattributetablemodel.h +++ b/src/core/composer/qgscomposerattributetablemodel.h @@ -45,7 +45,7 @@ class CORE_EXPORT QgsComposerAttributeTableColumnModel: public QAbstractTableMod * @param composerTable QgsComposerAttributeTable the model is attached to * @param parent optional parent */ - QgsComposerAttributeTableColumnModel( QgsComposerAttributeTable *composerTable, QObject *parent = 0 ); + QgsComposerAttributeTableColumnModel( QgsComposerAttributeTable *composerTable, QObject *parent = nullptr ); virtual ~QgsComposerAttributeTableColumnModel(); virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const override; @@ -144,7 +144,7 @@ class CORE_EXPORT QgsComposerTableSortColumnsProxyModel: public QSortFilterProxy * @param filterType filter for columns, controls whether sorted or unsorted columns are shown * @param parent optional parent */ - QgsComposerTableSortColumnsProxyModel( QgsComposerAttributeTable *composerTable, ColumnFilterType filterType, QObject *parent = 0 ); + QgsComposerTableSortColumnsProxyModel( QgsComposerAttributeTable *composerTable, ColumnFilterType filterType, QObject *parent = nullptr ); virtual ~QgsComposerTableSortColumnsProxyModel(); diff --git a/src/core/composer/qgscomposerattributetablemodelv2.h b/src/core/composer/qgscomposerattributetablemodelv2.h index 575af6f1766..9a21c6ceb04 100644 --- a/src/core/composer/qgscomposerattributetablemodelv2.h +++ b/src/core/composer/qgscomposerattributetablemodelv2.h @@ -45,7 +45,7 @@ class CORE_EXPORT QgsComposerAttributeTableColumnModelV2: public QAbstractTableM * @param composerTable QgsComposerAttributeTable the model is attached to * @param parent optional parent */ - QgsComposerAttributeTableColumnModelV2( QgsComposerAttributeTableV2 *composerTable, QObject *parent = 0 ); + QgsComposerAttributeTableColumnModelV2( QgsComposerAttributeTableV2 *composerTable, QObject *parent = nullptr ); virtual ~QgsComposerAttributeTableColumnModelV2(); virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const override; @@ -144,7 +144,7 @@ class CORE_EXPORT QgsComposerTableSortColumnsProxyModelV2: public QSortFilterPro * @param filterType filter for columns, controls whether sorted or unsorted columns are shown * @param parent optional parent */ - QgsComposerTableSortColumnsProxyModelV2( QgsComposerAttributeTableV2 *composerTable, ColumnFilterType filterType, QObject *parent = 0 ); + QgsComposerTableSortColumnsProxyModelV2( QgsComposerAttributeTableV2 *composerTable, ColumnFilterType filterType, QObject *parent = nullptr ); virtual ~QgsComposerTableSortColumnsProxyModelV2(); diff --git a/src/core/composer/qgscomposerattributetablev2.cpp b/src/core/composer/qgscomposerattributetablev2.cpp index 299d49c23d3..fde1d83669f 100644 --- a/src/core/composer/qgscomposerattributetablev2.cpp +++ b/src/core/composer/qgscomposerattributetablev2.cpp @@ -100,9 +100,9 @@ bool QgsComposerAttributeTableCompareV2::operator()( const QgsComposerTableRow& QgsComposerAttributeTableV2::QgsComposerAttributeTableV2( QgsComposition* composition, bool createUndoCommands ) : QgsComposerTableV2( composition, createUndoCommands ) , mSource( LayerAttributes ) - , mVectorLayer( 0 ) - , mCurrentAtlasLayer( 0 ) - , mComposerMap( 0 ) + , mVectorLayer( nullptr ) + , mCurrentAtlasLayer( nullptr ) + , mComposerMap( nullptr ) , mMaximumNumberOfFeatures( 30 ) , mShowUniqueRowsOnly( false ) , mShowOnlyVisibleFeatures( false ) @@ -620,7 +620,7 @@ QgsVectorLayer *QgsComposerAttributeTableV2::sourceLayer() return relation.referencingLayer(); } } - return 0; + return nullptr; } void QgsComposerAttributeTableV2::removeLayer( const QString& layerId ) @@ -629,7 +629,7 @@ void QgsComposerAttributeTableV2::removeLayer( const QString& layerId ) { if ( layerId == mVectorLayer->id() ) { - mVectorLayer = 0; + mVectorLayer = nullptr; //remove existing columns qDeleteAll( mColumns ); mColumns.clear(); @@ -757,7 +757,7 @@ bool QgsComposerAttributeTableV2::readXML( const QDomElement& itemElem, const QD int composerMapId = itemElem.attribute( "composerMap", "-1" ).toInt(); if ( composerMapId == -1 ) { - mComposerMap = 0; + mComposerMap = nullptr; } if ( composition() ) @@ -766,7 +766,7 @@ bool QgsComposerAttributeTableV2::readXML( const QDomElement& itemElem, const QD } else { - mComposerMap = 0; + mComposerMap = nullptr; } if ( mComposerMap ) @@ -779,7 +779,7 @@ bool QgsComposerAttributeTableV2::readXML( const QDomElement& itemElem, const QD QString layerId = itemElem.attribute( "vectorLayer", "not_existing" ); if ( layerId == "not_existing" ) { - mVectorLayer = 0; + mVectorLayer = nullptr; } else { diff --git a/src/core/composer/qgscomposerframe.cpp b/src/core/composer/qgscomposerframe.cpp index c2d946a4bdf..35716b16f94 100644 --- a/src/core/composer/qgscomposerframe.cpp +++ b/src/core/composer/qgscomposerframe.cpp @@ -37,8 +37,8 @@ QgsComposerFrame::QgsComposerFrame( QgsComposition* c, QgsComposerMultiFrame* mf } QgsComposerFrame::QgsComposerFrame() - : QgsComposerItem( 0, 0, 0, 0, 0 ) - , mMultiFrame( 0 ) + : QgsComposerItem( 0, 0, 0, 0, nullptr ) + , mMultiFrame( nullptr ) , mHidePageIfEmpty( false ) , mHideBackgroundIfEmpty( false ) { diff --git a/src/core/composer/qgscomposerhtml.cpp b/src/core/composer/qgscomposerhtml.cpp index 73a1e104f1e..e2868361f85 100644 --- a/src/core/composer/qgscomposerhtml.cpp +++ b/src/core/composer/qgscomposerhtml.cpp @@ -37,17 +37,17 @@ QgsComposerHtml::QgsComposerHtml( QgsComposition* c, bool createUndoCommands ) : QgsComposerMultiFrame( c, createUndoCommands ) , mContentMode( QgsComposerHtml::Url ) - , mWebPage( 0 ) + , mWebPage( nullptr ) , mLoaded( false ) , mHtmlUnitsToMM( 1.0 ) - , mRenderedPage( 0 ) + , mRenderedPage( nullptr ) , mEvaluateExpressions( true ) , mUseSmartBreaks( true ) , mMaxBreakDistance( 10 ) - , mExpressionLayer( 0 ) - , mDistanceArea( 0 ) + , mExpressionLayer( nullptr ) + , mDistanceArea( nullptr ) , mEnableUserStylesheet( false ) - , mFetcher( 0 ) + , mFetcher( nullptr ) { mDistanceArea = new QgsDistanceArea(); mHtmlUnitsToMM = htmlUnitsToMM(); @@ -176,7 +176,7 @@ void QgsComposerHtml::loadHtml( const bool useCache, const QgsExpressionContext //evaluate expressions if ( mEvaluateExpressions ) { - loadedHtml = QgsExpression::replaceExpressionText( loadedHtml, evalContext, 0, mDistanceArea ); + loadedHtml = QgsExpression::replaceExpressionText( loadedHtml, evalContext, nullptr, mDistanceArea ); } mLoaded = false; @@ -544,7 +544,7 @@ void QgsComposerHtml::setExpressionContext( const QgsFeature &feature, QgsVector void QgsComposerHtml::refreshExpressionContext() { - QgsVectorLayer * vl = 0; + QgsVectorLayer * vl = nullptr; QgsFeature feature; if ( mComposition->atlasComposition().enabled() ) diff --git a/src/core/composer/qgscomposerhtml.h b/src/core/composer/qgscomposerhtml.h index 0fd91adefea..30e011185a9 100644 --- a/src/core/composer/qgscomposerhtml.h +++ b/src/core/composer/qgscomposerhtml.h @@ -214,13 +214,13 @@ class CORE_EXPORT QgsComposerHtml: public QgsComposerMultiFrame * @see setUrl * @see url */ - void loadHtml( const bool useCache = false, const QgsExpressionContext* context = 0 ); + void loadHtml( const bool useCache = false, const QgsExpressionContext* context = nullptr ); /** Recalculates the frame sizes for the current viewport dimensions*/ void recalculateFrameSizes() override; void refreshExpressionContext(); - virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext* context = 0 ) override; + virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext* context = nullptr ) override; private slots: void frameLoaded( bool ok = true ); diff --git a/src/core/composer/qgscomposeritem.cpp b/src/core/composer/qgscomposeritem.cpp index 42e195e0322..5b730de6db9 100644 --- a/src/core/composer/qgscomposeritem.cpp +++ b/src/core/composer/qgscomposeritem.cpp @@ -46,11 +46,11 @@ QgsComposerItem::QgsComposerItem( QgsComposition* composition, bool manageZValue ) : QgsComposerObject( composition ) - , QGraphicsRectItem( 0 ) + , QGraphicsRectItem( nullptr ) , mRemovedFromComposition( false ) - , mBoundingResizeRectangle( 0 ) - , mHAlignSnapItem( 0 ) - , mVAlignSnapItem( 0 ) + , mBoundingResizeRectangle( nullptr ) + , mHAlignSnapItem( nullptr ) + , mVAlignSnapItem( nullptr ) , mFrame( false ) , mBackground( true ) , mBackgroundColor( QColor( 255, 255, 255, 255 ) ) @@ -75,11 +75,11 @@ QgsComposerItem::QgsComposerItem( QgsComposition* composition, bool manageZValue QgsComposerItem::QgsComposerItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition, bool manageZValue ) : QgsComposerObject( composition ) - , QGraphicsRectItem( 0, 0, width, height, 0 ) + , QGraphicsRectItem( 0, 0, width, height, nullptr ) , mRemovedFromComposition( false ) - , mBoundingResizeRectangle( 0 ) - , mHAlignSnapItem( 0 ) - , mVAlignSnapItem( 0 ) + , mBoundingResizeRectangle( nullptr ) + , mHAlignSnapItem( nullptr ) + , mVAlignSnapItem( nullptr ) , mFrame( false ) , mBackground( true ) , mBackgroundColor( QColor( 255, 255, 255, 255 ) ) @@ -1301,7 +1301,7 @@ QGraphicsLineItem* QgsComposerItem::hAlignSnapItem() { if ( !mHAlignSnapItem ) { - mHAlignSnapItem = new QGraphicsLineItem( 0 ); + mHAlignSnapItem = new QGraphicsLineItem( nullptr ); mHAlignSnapItem->setPen( QPen( QColor( Qt::red ) ) ); scene()->addItem( mHAlignSnapItem ); mHAlignSnapItem->setZValue( 90 ); @@ -1313,7 +1313,7 @@ QGraphicsLineItem* QgsComposerItem::vAlignSnapItem() { if ( !mVAlignSnapItem ) { - mVAlignSnapItem = new QGraphicsLineItem( 0 ); + mVAlignSnapItem = new QGraphicsLineItem( nullptr ); mVAlignSnapItem->setPen( QPen( QColor( Qt::red ) ) ); scene()->addItem( mVAlignSnapItem ); mVAlignSnapItem->setZValue( 90 ); @@ -1327,7 +1327,7 @@ void QgsComposerItem::deleteHAlignSnapItem() { scene()->removeItem( mHAlignSnapItem ); delete mHAlignSnapItem; - mHAlignSnapItem = 0; + mHAlignSnapItem = nullptr; } } @@ -1337,7 +1337,7 @@ void QgsComposerItem::deleteVAlignSnapItem() { scene()->removeItem( mVAlignSnapItem ); delete mVAlignSnapItem; - mVAlignSnapItem = 0; + mVAlignSnapItem = nullptr; } } diff --git a/src/core/composer/qgscomposeritem.h b/src/core/composer/qgscomposeritem.h index 8dcb184c78f..ca0174562e8 100644 --- a/src/core/composer/qgscomposeritem.h +++ b/src/core/composer/qgscomposeritem.h @@ -610,7 +610,7 @@ class CORE_EXPORT QgsComposerItem: public QgsComposerObject, public QGraphicsRec * @param context expression context for evaluating data defined expressions * @note this method was added in version 2.5 */ - virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext* context = 0 ) override; + virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext* context = nullptr ) override; protected: /** True if item has been removed from the composition*/ @@ -779,7 +779,7 @@ class CORE_EXPORT QgsComposerItem: public QgsComposerObject, public QGraphicsRec * set and position mode has been accounted for * @note added in QGIS 2.5 */ - QRectF evalItemRect( const QRectF &newRect, const bool resizeOnly = false, const QgsExpressionContext* context = 0 ); + QRectF evalItemRect( const QRectF &newRect, const bool resizeOnly = false, const QgsExpressionContext* context = nullptr ); /** Returns whether the item should be drawn in the current context * @returns true if item should be drawn diff --git a/src/core/composer/qgscomposeritemcommand.cpp b/src/core/composer/qgscomposeritemcommand.cpp index d97b4471d05..22e759993f7 100644 --- a/src/core/composer/qgscomposeritemcommand.cpp +++ b/src/core/composer/qgscomposeritemcommand.cpp @@ -25,7 +25,7 @@ QgsComposerItemCommand::QgsComposerItemCommand( QgsComposerItem* item, const QString& text, QUndoCommand* parent ) : QUndoCommand( text, parent ) , mItem( item ) - , mMultiFrame( 0 ) + , mMultiFrame( nullptr ) , mFrameNumber( 0 ) , mFirstRun( true ) { @@ -65,7 +65,7 @@ bool QgsComposerItemCommand::containsChange() const QgsComposerItem* QgsComposerItemCommand::item() const { - QgsComposerItem* item = 0; + QgsComposerItem* item = nullptr; if ( mMultiFrame ) { //item is a frame, so it needs to be handled differently diff --git a/src/core/composer/qgscomposeritemcommand.h b/src/core/composer/qgscomposeritemcommand.h index bea9ddffdbb..66a05d09f78 100644 --- a/src/core/composer/qgscomposeritemcommand.h +++ b/src/core/composer/qgscomposeritemcommand.h @@ -28,7 +28,7 @@ class QgsComposerMultiFrame; class CORE_EXPORT QgsComposerItemCommand: public QUndoCommand { public: - QgsComposerItemCommand( QgsComposerItem* item, const QString& text, QUndoCommand* parent = 0 ); + QgsComposerItemCommand( QgsComposerItem* item, const QString& text, QUndoCommand* parent = nullptr ); virtual ~QgsComposerItemCommand(); /** Reverses the command*/ diff --git a/src/core/composer/qgscomposeritemgroup.h b/src/core/composer/qgscomposeritemgroup.h index e17dc3e9e98..b62fe1b8ffd 100644 --- a/src/core/composer/qgscomposeritemgroup.h +++ b/src/core/composer/qgscomposeritemgroup.h @@ -39,7 +39,7 @@ class CORE_EXPORT QgsComposerItemGroup: public QgsComposerItem /** Removes the items but does not delete them*/ void removeItems() override; /** Draw outline and ev. selection handles*/ - void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ) override; + void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override; /** Sets this items bound in scene coordinates such that 1 item size units corresponds to 1 scene size unit*/ void setSceneRect( const QRectF& rectangle ) override; diff --git a/src/core/composer/qgscomposerlabel.cpp b/src/core/composer/qgscomposerlabel.cpp index f2ff0c22890..a17ba48045c 100644 --- a/src/core/composer/qgscomposerlabel.cpp +++ b/src/core/composer/qgscomposerlabel.cpp @@ -49,8 +49,8 @@ QgsComposerLabel::QgsComposerLabel( QgsComposition *composition ) , mFontColor( QColor( 0, 0, 0 ) ) , mHAlignment( Qt::AlignLeft ) , mVAlignment( Qt::AlignTop ) - , mExpressionLayer( 0 ) - , mDistanceArea( 0 ) + , mExpressionLayer( nullptr ) + , mDistanceArea( nullptr ) { mDistanceArea = new QgsDistanceArea(); mHtmlUnitsToMM = htmlUnitsToMM(); @@ -233,7 +233,7 @@ void QgsComposerLabel::setHtmlState( int state ) void QgsComposerLabel::setExpressionContext( QgsFeature *feature, QgsVectorLayer* layer, const QMap& substitutions ) { - mExpressionFeature.reset( feature ? new QgsFeature( *feature ) : 0 ); + mExpressionFeature.reset( feature ? new QgsFeature( *feature ) : nullptr ); mExpressionLayer = layer; mSubstitutions = substitutions; @@ -264,13 +264,13 @@ void QgsComposerLabel::setSubstitutions( const QMap& substitu void QgsComposerLabel::refreshExpressionContext() { - mExpressionLayer = 0; + mExpressionLayer = nullptr; mExpressionFeature.reset(); if ( !mComposition ) return; - QgsVectorLayer* layer = 0; + QgsVectorLayer* layer = nullptr; if ( mComposition->atlasComposition().enabled() ) { layer = mComposition->atlasComposition().coverageLayer(); diff --git a/src/core/composer/qgscomposerlegend.cpp b/src/core/composer/qgscomposerlegend.cpp index 9ae7bd21439..b4d5225c4f4 100644 --- a/src/core/composer/qgscomposerlegend.cpp +++ b/src/core/composer/qgscomposerlegend.cpp @@ -36,8 +36,8 @@ QgsComposerLegend::QgsComposerLegend( QgsComposition* composition ) : QgsComposerItem( composition ) - , mCustomLayerTree( 0 ) - , mComposerMap( 0 ) + , mCustomLayerTree( nullptr ) + , mComposerMap( nullptr ) , mLegendFilterByMap( false ) , mFilterOutAtlas( false ) , mFilterAskedForUpdate( false ) @@ -58,10 +58,10 @@ QgsComposerLegend::QgsComposerLegend( QgsComposition* composition ) } QgsComposerLegend::QgsComposerLegend() - : QgsComposerItem( 0 ) - , mLegendModel2( 0 ) - , mCustomLayerTree( 0 ) - , mComposerMap( 0 ) + : QgsComposerItem( nullptr ) + , mLegendModel2( nullptr ) + , mCustomLayerTree( nullptr ) + , mComposerMap( nullptr ) , mLegendFilterByMap( false ) , mLegendFilterByExpression( false ) , mFilterOutAtlas( false ) @@ -196,7 +196,7 @@ void QgsComposerLegend::setAutoUpdateModel( bool autoUpdate ) if ( autoUpdate == autoUpdateModel() ) return; - setCustomLayerTree( autoUpdate ? 0 : QgsLayerTree::toGroup( QgsProject::instance()->layerTreeRoot()->clone() ) ); + setCustomLayerTree( autoUpdate ? nullptr : QgsLayerTree::toGroup( QgsProject::instance()->layerTreeRoot()->clone() ) ); adjustBoxSize(); updateItem(); } @@ -592,7 +592,7 @@ void QgsComposerLegend::setComposerMap( const QgsComposerMap* map ) void QgsComposerLegend::invalidateCurrentMap() { - setComposerMap( 0 ); + setComposerMap( nullptr ); } void QgsComposerLegend::mapLayerStyleOverridesChanged() @@ -659,7 +659,7 @@ void QgsComposerLegend::doUpdateFilterByMap() mLegendModel2->setLegendFilter( &ms, /* useExtent */ mInAtlas || mLegendFilterByMap, filterPolygon, /* useExpressions */ true ); } else - mLegendModel2->setLegendFilterByMap( 0 ); + mLegendModel2->setLegendFilterByMap( nullptr ); } void QgsComposerLegend::setLegendFilterOutAtlas( bool doFilter ) diff --git a/src/core/composer/qgscomposerlegend.h b/src/core/composer/qgscomposerlegend.h index d7ecc428335..2a4b9152e44 100644 --- a/src/core/composer/qgscomposerlegend.h +++ b/src/core/composer/qgscomposerlegend.h @@ -44,7 +44,7 @@ class CORE_EXPORT QgsLegendModelV2 : public QgsLayerTreeModel Q_OBJECT public: - QgsLegendModelV2( QgsLayerTreeGroup* rootNode, QObject *parent = 0 ); + QgsLegendModelV2( QgsLayerTreeGroup* rootNode, QObject *parent = nullptr ); QVariant data( const QModelIndex& index, int role ) const override; diff --git a/src/core/composer/qgscomposerlegenditem.cpp b/src/core/composer/qgscomposerlegenditem.cpp index 9e2d7bbb4c1..6445e061b78 100644 --- a/src/core/composer/qgscomposerlegenditem.cpp +++ b/src/core/composer/qgscomposerlegenditem.cpp @@ -50,7 +50,7 @@ QgsComposerLegendItem::~QgsComposerLegendItem() void QgsComposerLegendItem::writeXMLChildren( QDomElement& elem, QDomDocument& doc ) const { int numRows = rowCount(); - QgsComposerLegendItem* currentItem = 0; + QgsComposerLegendItem* currentItem = nullptr; for ( int i = 0; i < numRows; ++i ) { currentItem = dynamic_cast( child( i, 0 ) ); @@ -65,15 +65,15 @@ void QgsComposerLegendItem::writeXMLChildren( QDomElement& elem, QDomDocument& d ////////////////QgsComposerSymbolV2Item -QgsComposerSymbolV2Item::QgsComposerSymbolV2Item(): QgsComposerLegendItem( QgsComposerLegendStyle::Symbol ), mSymbolV2( 0 ) +QgsComposerSymbolV2Item::QgsComposerSymbolV2Item(): QgsComposerLegendItem( QgsComposerLegendStyle::Symbol ), mSymbolV2( nullptr ) { } -QgsComposerSymbolV2Item::QgsComposerSymbolV2Item( const QString& text ): QgsComposerLegendItem( text, QgsComposerLegendStyle::Symbol ), mSymbolV2( 0 ) +QgsComposerSymbolV2Item::QgsComposerSymbolV2Item( const QString& text ): QgsComposerLegendItem( text, QgsComposerLegendStyle::Symbol ), mSymbolV2( nullptr ) { } -QgsComposerSymbolV2Item::QgsComposerSymbolV2Item( const QIcon& icon, const QString& text ): QgsComposerLegendItem( icon, text, QgsComposerLegendStyle::Symbol ), mSymbolV2( 0 ) +QgsComposerSymbolV2Item::QgsComposerSymbolV2Item( const QIcon& icon, const QString& text ): QgsComposerLegendItem( icon, text, QgsComposerLegendStyle::Symbol ), mSymbolV2( nullptr ) { } @@ -251,7 +251,7 @@ void QgsComposerLayerItem::readXML( const QDomElement& itemElem, bool xServerAva QDomNodeList childList = itemElem.childNodes(); QDomNode currentNode; QDomElement currentElem; - QgsComposerLegendItem* currentChildItem = 0; + QgsComposerLegendItem* currentChildItem = nullptr; int nChildItems = childList.count(); for ( int i = 0; i < nChildItems; ++i ) @@ -361,7 +361,7 @@ void QgsComposerGroupItem::readXML( const QDomElement& itemElem, bool xServerAva QDomNodeList childList = itemElem.childNodes(); QDomNode currentNode; QDomElement currentElem; - QgsComposerLegendItem* currentChildItem = 0; + QgsComposerLegendItem* currentChildItem = nullptr; int nChildItems = childList.count(); for ( int i = 0; i < nChildItems; ++i ) diff --git a/src/core/composer/qgscomposermap.cpp b/src/core/composer/qgscomposermap.cpp index 0d2c976d09b..d7cc2083410 100644 --- a/src/core/composer/qgscomposermap.cpp +++ b/src/core/composer/qgscomposermap.cpp @@ -47,14 +47,14 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition, int x, int y, int width, int height ) : QgsComposerItem( x, y, width, height, composition ) - , mGridStack( 0 ) - , mOverviewStack( 0 ) + , mGridStack( nullptr ) + , mOverviewStack( nullptr ) , mMapRotation( 0 ) , mEvaluatedMapRotation( 0 ) , mKeepLayerSet( false ) , mKeepLayerStyles( false ) , mUpdatesEnabled( true ) - , mMapCanvas( 0 ) + , mMapCanvas( nullptr ) , mDrawCanvasItems( true ) , mAtlasDriven( false ) , mAtlasScalingMode( Auto ) @@ -92,14 +92,14 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition, int x, int y, int w QgsComposerMap::QgsComposerMap( QgsComposition *composition ) : QgsComposerItem( 0, 0, 10, 10, composition ) - , mGridStack( 0 ) - , mOverviewStack( 0 ) + , mGridStack( nullptr ) + , mOverviewStack( nullptr ) , mMapRotation( 0 ) , mEvaluatedMapRotation( 0 ) , mKeepLayerSet( false ) , mKeepLayerStyles( false ) , mUpdatesEnabled( true ) - , mMapCanvas( 0 ) + , mMapCanvas( nullptr ) , mDrawCanvasItems( true ) , mAtlasDriven( false ) , mAtlasScalingMode( Auto ) @@ -1145,7 +1145,7 @@ bool QgsComposerMap::containsWMSLayer() const QStringList layers = mComposition->mapSettings().layers(); QStringList::const_iterator layer_it = layers.constBegin(); - QgsMapLayer* currentLayer = 0; + QgsMapLayer* currentLayer = nullptr; for ( ; layer_it != layers.constEnd(); ++layer_it ) { @@ -1155,7 +1155,7 @@ bool QgsComposerMap::containsWMSLayer() const QgsRasterLayer* currentRasterLayer = qobject_cast( currentLayer ); if ( currentRasterLayer ) { - const QgsRasterDataProvider* rasterProvider = 0; + const QgsRasterDataProvider* rasterProvider = nullptr; if (( rasterProvider = currentRasterLayer->dataProvider() ) ) { if ( rasterProvider->name() == "wms" ) @@ -1190,7 +1190,7 @@ bool QgsComposerMap::containsAdvancedEffects() const QStringList layers = mComposition->mapSettings().layers(); QStringList::const_iterator layer_it = layers.constBegin(); - QgsMapLayer* currentLayer = 0; + QgsMapLayer* currentLayer = nullptr; for ( ; layer_it != layers.constEnd(); ++layer_it ) { @@ -1484,7 +1484,7 @@ bool QgsComposerMap::readXML( const QDomElement& itemElem, const QDomDocument& d mapGrid->setFrameFillColor2( QgsSymbolLayerV2Utils::decodeColor( gridElem.attribute( "frameFillColor2", "0,0,0,255" ) ) ); mapGrid->setBlendMode( QgsMapRenderer::getCompositionMode(( QgsMapRenderer::BlendMode ) itemElem.attribute( "gridBlendMode", "0" ).toUInt() ) ); QDomElement gridSymbolElem = gridElem.firstChildElement( "symbol" ); - QgsLineSymbolV2* lineSymbol = 0; + QgsLineSymbolV2* lineSymbol = nullptr; if ( gridSymbolElem.isNull() ) { //old project file, read penWidth /penColorRed, penColorGreen, penColorBlue @@ -1537,7 +1537,7 @@ bool QgsComposerMap::readXML( const QDomElement& itemElem, const QDomDocument& d mapOverview->setInverted( overviewFrameElem.attribute( "overviewInverted" ).compare( "true", Qt::CaseInsensitive ) == 0 ); mapOverview->setCentered( overviewFrameElem.attribute( "overviewCentered" ).compare( "true", Qt::CaseInsensitive ) == 0 ); - QgsFillSymbolV2* fillSymbol = 0; + QgsFillSymbolV2* fillSymbol = nullptr; QDomElement overviewFrameSymbolElem = overviewFrameElem.firstChildElement( "symbol" ); if ( !overviewFrameSymbolElem.isNull() ) { @@ -2333,7 +2333,7 @@ void QgsComposerMap::drawCanvasItems( QPainter* painter, const QStyleOptionGraph { return; } - QGraphicsItem* currentItem = 0; + QGraphicsItem* currentItem = nullptr; for ( int i = itemList.size() - 1; i >= 0; --i ) { @@ -2384,7 +2384,7 @@ void QgsComposerMap::drawCanvasItem( QGraphicsItem* item, QPainter* painter, con //a little trick to let the item know that the paint request comes from the composer item->setData( 1, "composer" ); - item->paint( painter, itemStyle, 0 ); + item->paint( painter, itemStyle, nullptr ); item->setData( 1, "" ); painter->restore(); } diff --git a/src/core/composer/qgscomposermap.h b/src/core/composer/qgscomposermap.h index f6887b1533b..5588b08b550 100644 --- a/src/core/composer/qgscomposermap.h +++ b/src/core/composer/qgscomposermap.h @@ -144,7 +144,7 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem @param dpi scene dpi @param forceWidthScale force wysiwyg line widths / marker sizes */ - void draw( QPainter *painter, const QgsRectangle& extent, const QSizeF& size, double dpi, double* forceWidthScale = 0 ); + void draw( QPainter *painter, const QgsRectangle& extent, const QSizeF& size, double dpi, double* forceWidthScale = nullptr ); /** \brief Reimplementation of QCanvasItem::paint - draw on canvas */ void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget ) override; @@ -819,7 +819,7 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem /** @deprecated use QgsComposerMapOverview::overviewExtentChanged instead*/ void overviewExtentChanged() {} - virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext* context = 0 ) override; + virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext* context = nullptr ) override; protected slots: @@ -922,7 +922,7 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem void updateToolTip(); /** Returns a list of the layers to render for this map item*/ - QStringList layersToRender( const QgsExpressionContext* context = 0 ) const; + QStringList layersToRender( const QgsExpressionContext* context = nullptr ) const; /** Returns current layer style overrides for this map item*/ QMap layerStyleOverridesToRender( const QgsExpressionContext& context ) const; @@ -959,7 +959,7 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem * @param context expression context for evaluating data defined map parameters * @note this method was added in version 2.5 */ - void refreshMapExtents( const QgsExpressionContext* context = 0 ); + void refreshMapExtents( const QgsExpressionContext* context = nullptr ); friend class QgsComposerMapOverview; //to access mXOffset, mYOffset friend class TestQgsComposerMap; diff --git a/src/core/composer/qgscomposermapgrid.cpp b/src/core/composer/qgscomposermapgrid.cpp index 11772fb8495..6bc74de177c 100644 --- a/src/core/composer/qgscomposermapgrid.cpp +++ b/src/core/composer/qgscomposermapgrid.cpp @@ -170,7 +170,7 @@ QgsComposerMapGrid::QgsComposerMapGrid( const QString& name, QgsComposerMap* map } QgsComposerMapGrid::QgsComposerMapGrid() - : QgsComposerMapItem( QString(), 0 ) + : QgsComposerMapItem( QString(), nullptr ) { init(); } @@ -213,8 +213,8 @@ void QgsComposerMapGrid::init() mRightFrameDivisions = QgsComposerMapGrid::ShowAll; mTopFrameDivisions = QgsComposerMapGrid::ShowAll; mBottomFrameDivisions = QgsComposerMapGrid::ShowAll; - mGridLineSymbol = 0; - mGridMarkerSymbol = 0; + mGridLineSymbol = nullptr; + mGridMarkerSymbol = nullptr; mGridUnit = MapUnit; mBlendMode = QPainter::CompositionMode_SourceOver; @@ -816,19 +816,19 @@ void QgsComposerMapGrid::drawGridFrame( QPainter* p, const QList< QPair< double, if ( testFrameSideFlag( QgsComposerMapGrid::FrameLeft ) ) { - drawGridFrameBorder( p, leftGridFrame, QgsComposerMapGrid::Left, extension ? &extension->left : 0 ); + drawGridFrameBorder( p, leftGridFrame, QgsComposerMapGrid::Left, extension ? &extension->left : nullptr ); } if ( testFrameSideFlag( QgsComposerMapGrid::FrameRight ) ) { - drawGridFrameBorder( p, rightGridFrame, QgsComposerMapGrid::Right, extension ? &extension->right : 0 ); + drawGridFrameBorder( p, rightGridFrame, QgsComposerMapGrid::Right, extension ? &extension->right : nullptr ); } if ( testFrameSideFlag( QgsComposerMapGrid::FrameTop ) ) { - drawGridFrameBorder( p, topGridFrame, QgsComposerMapGrid::Top, extension ? &extension->top : 0 ); + drawGridFrameBorder( p, topGridFrame, QgsComposerMapGrid::Top, extension ? &extension->top : nullptr ); } if ( testFrameSideFlag( QgsComposerMapGrid::FrameBottom ) ) { - drawGridFrameBorder( p, bottomGridFrame, QgsComposerMapGrid::Bottom, extension ? &extension->bottom : 0 ); + drawGridFrameBorder( p, bottomGridFrame, QgsComposerMapGrid::Bottom, extension ? &extension->bottom : nullptr ); } if ( p ) p->restore(); @@ -849,7 +849,7 @@ void QgsComposerMapGrid::drawGridLine( const QPolygonF& line, QgsRenderContext& } mGridLineSymbol->startRender( context ); - mGridLineSymbol->renderPolyline( line, 0, context ); + mGridLineSymbol->renderPolyline( line, nullptr, context ); mGridLineSymbol->stopRender( context ); } @@ -861,7 +861,7 @@ void QgsComposerMapGrid::drawGridMarker( const QPointF& point, QgsRenderContext& } mGridMarkerSymbol->startRender( context ); - mGridMarkerSymbol->renderPoint( point, 0, context ); + mGridMarkerSymbol->renderPoint( point, nullptr, context ); mGridMarkerSymbol->stopRender( context ); } @@ -2115,12 +2115,12 @@ void QgsComposerMapGrid::calculateMaxExtension( double& top, double& right, doub if ( mGridFrameStyle != QgsComposerMapGrid::NoFrame ) { - drawGridFrame( 0, horizontalLines, verticalLines, &extension ); + drawGridFrame( nullptr, horizontalLines, verticalLines, &extension ); } if ( mShowGridAnnotation ) { - drawCoordinateAnnotations( 0, horizontalLines, verticalLines, context.expressionContext(), &extension ); + drawCoordinateAnnotations( nullptr, horizontalLines, verticalLines, context.expressionContext(), &extension ); } top = extension.top; diff --git a/src/core/composer/qgscomposermapgrid.h b/src/core/composer/qgscomposermapgrid.h index 01a5c015723..fe54489cbb4 100644 --- a/src/core/composer/qgscomposermapgrid.h +++ b/src/core/composer/qgscomposermapgrid.h @@ -943,7 +943,7 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem /** Draws the map grid. If extension is specified, then no grid will be drawn and instead the maximum extension * for the grid outside of the map frame will be calculated. */ - void drawGridFrame( QPainter* p, const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines, GridExtension* extension = 0 ) const; + void drawGridFrame( QPainter* p, const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines, GridExtension* extension = nullptr ) const; /** Draw coordinates for mGridAnnotationType Coordinate @param p drawing painter @@ -953,12 +953,12 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem @param extension optional. If specified, nothing will be drawn and instead the maximum extension for the grid annotations will be stored in this variable. */ - void drawCoordinateAnnotations( QPainter* p, const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines, QgsExpressionContext& expressionContext, GridExtension* extension = 0 ) const; + void drawCoordinateAnnotations( QPainter* p, const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines, QgsExpressionContext& expressionContext, GridExtension* extension = nullptr ) const; /** Draw an annotation. If optional extension argument is specified, nothing will be drawn and instead * the extension of the annotation outside of the map frame will be stored in this variable. */ - void drawCoordinateAnnotation( QPainter* p, const QPointF& pos, QString annotationString, const AnnotationCoordinate coordinateType, GridExtension* extension = 0 ) const; + void drawCoordinateAnnotation( QPainter* p, const QPointF& pos, QString annotationString, const AnnotationCoordinate coordinateType, GridExtension* extension = nullptr ) const; /** Draws a single annotation * @param p drawing painter @@ -992,7 +992,7 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem /** Draw the grid frame's border. If optional extension argument is specified, nothing will be drawn and instead * the maximum extension of the frame border outside of the map frame will be stored in this variable. */ - void drawGridFrameBorder( QPainter* p, const QMap< double, double >& borderPos, BorderSide border, double* extension = 0 ) const; + void drawGridFrameBorder( QPainter* p, const QMap< double, double >& borderPos, BorderSide border, double* extension = nullptr ) const; /** Returns the item border of a point (in item coordinates) * @param p point @@ -1019,11 +1019,11 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem void drawGridMarker( const QPointF &point, QgsRenderContext &context ) const; - void drawGridFrameZebraBorder( QPainter *p, const QMap &borderPos, BorderSide border, double* extension = 0 ) const; + void drawGridFrameZebraBorder( QPainter *p, const QMap &borderPos, BorderSide border, double* extension = nullptr ) const; - void drawGridFrameTicks( QPainter *p, const QMap &borderPos, BorderSide border, double* extension = 0 ) const; + void drawGridFrameTicks( QPainter *p, const QMap &borderPos, BorderSide border, double* extension = nullptr ) const; - void drawGridFrameLineBorder( QPainter *p, BorderSide border, double* extension = 0 ) const; + void drawGridFrameLineBorder( QPainter *p, BorderSide border, double* extension = nullptr ) const; void calculateCRSTransformLines(); diff --git a/src/core/composer/qgscomposermapitem.cpp b/src/core/composer/qgscomposermapitem.cpp index 7ef201aeb7c..1b88c06a811 100644 --- a/src/core/composer/qgscomposermapitem.cpp +++ b/src/core/composer/qgscomposermapitem.cpp @@ -132,7 +132,7 @@ const QgsComposerMapItem *QgsComposerMapItemStack::constItem( const QString &ite } } - return 0; + return nullptr; } QgsComposerMapItem *QgsComposerMapItemStack::item( const QString &itemId ) const @@ -146,7 +146,7 @@ QgsComposerMapItem *QgsComposerMapItemStack::item( const QString &itemId ) const } } - return 0; + return nullptr; } QgsComposerMapItem *QgsComposerMapItemStack::item( const int index ) const @@ -156,7 +156,7 @@ QgsComposerMapItem *QgsComposerMapItemStack::item( const int index ) const return mItems.at( index ); } - return 0; + return nullptr; } QgsComposerMapItem &QgsComposerMapItemStack::operator[]( int idx ) diff --git a/src/core/composer/qgscomposermapoverview.cpp b/src/core/composer/qgscomposermapoverview.cpp index f441dbcafdf..e14e14668c8 100644 --- a/src/core/composer/qgscomposermapoverview.cpp +++ b/src/core/composer/qgscomposermapoverview.cpp @@ -26,7 +26,7 @@ QgsComposerMapOverview::QgsComposerMapOverview( const QString& name, QgsComposerMap* map ) : QgsComposerMapItem( name, map ) , mFrameMapId( -1 ) - , mFrameSymbol( 0 ) + , mFrameSymbol( nullptr ) , mBlendMode( QPainter::CompositionMode_SourceOver ) , mInverted( false ) , mCentered( false ) @@ -35,9 +35,9 @@ QgsComposerMapOverview::QgsComposerMapOverview( const QString& name, QgsComposer } QgsComposerMapOverview::QgsComposerMapOverview() - : QgsComposerMapItem( QString(), 0 ) + : QgsComposerMapItem( QString(), nullptr ) , mFrameMapId( -1 ) - , mFrameSymbol( 0 ) + , mFrameSymbol( nullptr ) , mBlendMode( QPainter::CompositionMode_SourceOver ) , mInverted( false ) , mCentered( false ) @@ -127,7 +127,7 @@ void QgsComposerMapOverview::draw( QPainter *painter ) if ( !mInverted ) { //Render the intersecting map extent - mFrameSymbol->renderPolygon( intersectPolygon, &rings, 0, context ); + mFrameSymbol->renderPolygon( intersectPolygon, &rings, nullptr, context ); } else { @@ -142,7 +142,7 @@ void QgsComposerMapOverview::draw( QPainter *painter ) //Intersecting extent is an inner ring for the shaded area rings.append( intersectPolygon ); - mFrameSymbol->renderPolygon( outerPolygon, &rings, 0, context ); + mFrameSymbol->renderPolygon( outerPolygon, &rings, nullptr, context ); } mFrameSymbol->stopRender( context ); diff --git a/src/core/composer/qgscomposermodel.cpp b/src/core/composer/qgscomposermodel.cpp index 75fb24af36f..7fd8f7dd01f 100644 --- a/src/core/composer/qgscomposermodel.cpp +++ b/src/core/composer/qgscomposermodel.cpp @@ -46,7 +46,7 @@ QgsComposerItem* QgsComposerModel::itemFromIndex( const QModelIndex &index ) con //try to return the QgsComposerItem corresponding to a QModelIndex if ( !index.isValid() ) { - return 0; + return nullptr; } QgsComposerItem * item = static_cast( index.internalPointer() ); @@ -881,7 +881,7 @@ QgsComposerItem* QgsComposerModel::getComposerItemAbove( QgsComposerItem* item ) it.previous(); } } - return 0; + return nullptr; } QgsComposerItem* QgsComposerModel::getComposerItemBelow( QgsComposerItem* item ) const @@ -900,7 +900,7 @@ QgsComposerItem* QgsComposerModel::getComposerItemBelow( QgsComposerItem* item ) it.next(); } } - return 0; + return nullptr; } QList* QgsComposerModel::zOrderList() diff --git a/src/core/composer/qgscomposermodel.h b/src/core/composer/qgscomposermodel.h index ec7f76a9d09..124f69b13b0 100644 --- a/src/core/composer/qgscomposermodel.h +++ b/src/core/composer/qgscomposermodel.h @@ -54,7 +54,7 @@ class CORE_EXPORT QgsComposerModel: public QAbstractItemModel * @param composition composition to attach to * @param parent parent object */ - explicit QgsComposerModel( QgsComposition* composition, QObject* parent = 0 ); + explicit QgsComposerModel( QgsComposition* composition, QObject* parent = nullptr ); ~QgsComposerModel(); diff --git a/src/core/composer/qgscomposermousehandles.cpp b/src/core/composer/qgscomposermousehandles.cpp index 6a722f9ca64..705fcfa79be 100644 --- a/src/core/composer/qgscomposermousehandles.cpp +++ b/src/core/composer/qgscomposermousehandles.cpp @@ -31,10 +31,10 @@ #include "qgsproject.h" QgsComposerMouseHandles::QgsComposerMouseHandles( QgsComposition *composition ) - : QObject( 0 ) - , QGraphicsRectItem( 0 ) + : QObject( nullptr ) + , QGraphicsRectItem( nullptr ) , mComposition( composition ) - , mGraphicsView( 0 ) + , mGraphicsView( nullptr ) , mCurrentMouseMoveAction( NoAction ) , mBeginHandleWidth( 0 ) , mBeginHandleHeight( 0 ) @@ -42,8 +42,8 @@ QgsComposerMouseHandles::QgsComposerMouseHandles( QgsComposition *composition ) , mResizeMoveY( 0 ) , mIsDragging( false ) , mIsResizing( false ) - , mHAlignSnapItem( 0 ) - , mVAlignSnapItem( 0 ) + , mHAlignSnapItem( nullptr ) + , mVAlignSnapItem( nullptr ) { //listen for selection changes, and update handles accordingly QObject::connect( mComposition, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) ); @@ -77,7 +77,7 @@ QGraphicsView* QgsComposerMouseHandles::graphicsView() } //no view attached to composition - return 0; + return nullptr; } void QgsComposerMouseHandles::paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget ) @@ -218,10 +218,10 @@ void QgsComposerMouseHandles::selectionChanged() } else { - QObject::disconnect( item, SIGNAL( sizeChanged() ), this, 0 ); - QObject::disconnect( item, SIGNAL( itemRotationChanged( double ) ), this, 0 ); - QObject::disconnect( item, SIGNAL( frameChanged() ), this, 0 ); - QObject::disconnect( item, SIGNAL( lockChanged() ), this, 0 ); + QObject::disconnect( item, SIGNAL( sizeChanged() ), this, nullptr ); + QObject::disconnect( item, SIGNAL( itemRotationChanged( double ) ), this, nullptr ); + QObject::disconnect( item, SIGNAL( frameChanged() ), this, nullptr ); + QObject::disconnect( item, SIGNAL( lockChanged() ), this, nullptr ); } } } @@ -1132,7 +1132,7 @@ QGraphicsLineItem* QgsComposerMouseHandles::hAlignSnapItem() { if ( !mHAlignSnapItem ) { - mHAlignSnapItem = new QGraphicsLineItem( 0 ); + mHAlignSnapItem = new QGraphicsLineItem( nullptr ); mHAlignSnapItem->setPen( QPen( QColor( Qt::red ) ) ); scene()->addItem( mHAlignSnapItem ); mHAlignSnapItem->setZValue( 90 ); @@ -1144,7 +1144,7 @@ QGraphicsLineItem* QgsComposerMouseHandles::vAlignSnapItem() { if ( !mVAlignSnapItem ) { - mVAlignSnapItem = new QGraphicsLineItem( 0 ); + mVAlignSnapItem = new QGraphicsLineItem( nullptr ); mVAlignSnapItem->setPen( QPen( QColor( Qt::red ) ) ); scene()->addItem( mVAlignSnapItem ); mVAlignSnapItem->setZValue( 90 ); @@ -1158,7 +1158,7 @@ void QgsComposerMouseHandles::deleteHAlignSnapItem() { scene()->removeItem( mHAlignSnapItem ); delete mHAlignSnapItem; - mHAlignSnapItem = 0; + mHAlignSnapItem = nullptr; } } @@ -1168,7 +1168,7 @@ void QgsComposerMouseHandles::deleteVAlignSnapItem() { scene()->removeItem( mVAlignSnapItem ); delete mVAlignSnapItem; - mVAlignSnapItem = 0; + mVAlignSnapItem = nullptr; } } @@ -1308,11 +1308,11 @@ void QgsComposerMouseHandles::collectAlignCoordinates( QMap< double, const QgsCo double y = ( *sIt )->line().y1(); if ( qgsDoubleNear( y, 0.0 ) ) { - alignCoordsX.insert( x, 0 ); + alignCoordsX.insert( x, nullptr ); } else { - alignCoordsY.insert( y, 0 ); + alignCoordsY.insert( y, nullptr ); } } } diff --git a/src/core/composer/qgscomposermultiframe.cpp b/src/core/composer/qgscomposermultiframe.cpp index db2373e02a1..2ba74e73cd3 100644 --- a/src/core/composer/qgscomposermultiframe.cpp +++ b/src/core/composer/qgscomposermultiframe.cpp @@ -29,7 +29,7 @@ QgsComposerMultiFrame::QgsComposerMultiFrame( QgsComposition* c, bool createUndo } QgsComposerMultiFrame::QgsComposerMultiFrame() - : QgsComposerObject( 0 ) + : QgsComposerObject( nullptr ) , mResizeMode( UseExistingFrames ) , mCreateUndoCommands( false ) , mIsRecalculatingSize( false ) @@ -84,7 +84,7 @@ void QgsComposerMultiFrame::recalculateFrameSizes() double currentY = 0; double currentHeight = 0; - QgsComposerFrame* currentItem = 0; + QgsComposerFrame* currentItem = nullptr; for ( int i = 0; i < mFrameItems.size(); ++i ) { @@ -201,7 +201,7 @@ QgsComposerFrame* QgsComposerMultiFrame::createNewFrame( QgsComposerFrame* curre { if ( !currentFrame ) { - return 0; + return nullptr; } QgsComposerFrame* newFrame = new QgsComposerFrame( mComposition, this, pos.x(), @@ -349,7 +349,7 @@ QgsComposerFrame* QgsComposerMultiFrame::frame( int i ) const { if ( i >= mFrameItems.size() ) { - return 0; + return nullptr; } return mFrameItems.at( i ); } diff --git a/src/core/composer/qgscomposermultiframecommand.cpp b/src/core/composer/qgscomposermultiframecommand.cpp index 21aeb22e55f..6df13cf904b 100644 --- a/src/core/composer/qgscomposermultiframecommand.cpp +++ b/src/core/composer/qgscomposermultiframecommand.cpp @@ -24,7 +24,7 @@ QgsComposerMultiFrameCommand::QgsComposerMultiFrameCommand( QgsComposerMultiFram { } -QgsComposerMultiFrameCommand::QgsComposerMultiFrameCommand(): QUndoCommand( "", 0 ), mMultiFrame( 0 ), mFirstRun( false ) +QgsComposerMultiFrameCommand::QgsComposerMultiFrameCommand(): QUndoCommand( "", nullptr ), mMultiFrame( nullptr ), mFirstRun( false ) { } diff --git a/src/core/composer/qgscomposermultiframecommand.h b/src/core/composer/qgscomposermultiframecommand.h index c268012f133..b7acd9afc02 100644 --- a/src/core/composer/qgscomposermultiframecommand.h +++ b/src/core/composer/qgscomposermultiframecommand.h @@ -26,7 +26,7 @@ class QgsComposerMultiFrame; class CORE_EXPORT QgsComposerMultiFrameCommand: public QUndoCommand { public: - QgsComposerMultiFrameCommand( QgsComposerMultiFrame* multiFrame, const QString& text, QUndoCommand* parent = 0 ); + QgsComposerMultiFrameCommand( QgsComposerMultiFrame* multiFrame, const QString& text, QUndoCommand* parent = nullptr ); ~QgsComposerMultiFrameCommand(); void undo() override; diff --git a/src/core/composer/qgscomposerobject.cpp b/src/core/composer/qgscomposerobject.cpp index c95133184ef..0c77f9816ea 100644 --- a/src/core/composer/qgscomposerobject.cpp +++ b/src/core/composer/qgscomposerobject.cpp @@ -29,7 +29,7 @@ #endif QgsComposerObject::QgsComposerObject( QgsComposition* composition ) - : QObject( 0 ) + : QObject( nullptr ) , mComposition( composition ) { @@ -96,7 +96,7 @@ QgsDataDefined *QgsComposerObject::dataDefinedProperty( const QgsComposerObject: if ( property == QgsComposerObject::AllProperties || property == QgsComposerObject::NoProperty ) { //bad property requested, don't return anything - return 0; + return nullptr; } //find corresponding QgsDataDefined and return it @@ -107,7 +107,7 @@ QgsDataDefined *QgsComposerObject::dataDefinedProperty( const QgsComposerObject: } //could not find matching QgsDataDefined - return 0; + return nullptr; } void QgsComposerObject::setDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property, const bool active, const bool useExpression, const QString &expression, const QString &field ) @@ -195,7 +195,7 @@ QStringList QgsComposerObject::customProperties() const QgsExpressionContext* QgsComposerObject::createExpressionContext() const { - QgsExpressionContext* context = 0; + QgsExpressionContext* context = nullptr; if ( mComposition ) { context = mComposition->createExpressionContext(); diff --git a/src/core/composer/qgscomposerobject.h b/src/core/composer/qgscomposerobject.h index 49e1ef0b498..641512ff07a 100644 --- a/src/core/composer/qgscomposerobject.h +++ b/src/core/composer/qgscomposerobject.h @@ -181,7 +181,7 @@ class CORE_EXPORT QgsComposerObject: public QObject * @param context expression context for evaluating data defined expressions * @note this method was added in version 2.5 */ - virtual void refreshDataDefinedProperty( const DataDefinedProperty property = AllProperties, const QgsExpressionContext* context = 0 ); + virtual void refreshDataDefinedProperty( const DataDefinedProperty property = AllProperties, const QgsExpressionContext* context = nullptr ); protected: diff --git a/src/core/composer/qgscomposerpicture.cpp b/src/core/composer/qgscomposerpicture.cpp index 543ba7fbbfb..ebae94092e6 100644 --- a/src/core/composer/qgscomposerpicture.cpp +++ b/src/core/composer/qgscomposerpicture.cpp @@ -41,7 +41,7 @@ QgsComposerPicture::QgsComposerPicture( QgsComposition *composition ) : QgsComposerItem( composition ) , mMode( Unknown ) , mPictureRotation( 0 ) - , mRotationMap( 0 ) + , mRotationMap( nullptr ) , mResizeMode( QgsComposerPicture::Zoom ) , mPictureAnchor( UpperLeft ) , mHasExpressionError( false ) @@ -50,10 +50,10 @@ QgsComposerPicture::QgsComposerPicture( QgsComposition *composition ) init(); } -QgsComposerPicture::QgsComposerPicture() : QgsComposerItem( 0 ), +QgsComposerPicture::QgsComposerPicture() : QgsComposerItem( nullptr ), mMode( Unknown ), mPictureRotation( 0 ), - mRotationMap( 0 ), + mRotationMap( nullptr ), mResizeMode( QgsComposerPicture::Zoom ), mPictureAnchor( UpperLeft ), mHasExpressionError( false ) @@ -631,7 +631,7 @@ void QgsComposerPicture::setRotationMap( int composerMapId ) if ( composerMapId == -1 ) //disable rotation from map { QObject::disconnect( mRotationMap, SIGNAL( mapRotationChanged( double ) ), this, SLOT( setPictureRotation( double ) ) ); - mRotationMap = 0; + mRotationMap = nullptr; } const QgsComposerMap* map = mComposition->getComposerMapById( composerMapId ); @@ -803,7 +803,7 @@ bool QgsComposerPicture::readXML( const QDomElement& itemElem, const QDomDocumen int rotationMapId = itemElem.attribute( "mapId", "-1" ).toInt(); if ( rotationMapId == -1 ) { - mRotationMap = 0; + mRotationMap = nullptr; } else if ( mComposition ) { diff --git a/src/core/composer/qgscomposerpicture.h b/src/core/composer/qgscomposerpicture.h index 794e67a7c79..d57bc3a2de2 100644 --- a/src/core/composer/qgscomposerpicture.h +++ b/src/core/composer/qgscomposerpicture.h @@ -272,7 +272,7 @@ class CORE_EXPORT QgsComposerPicture: public QgsComposerItem * @param context expression context for evaluating data defined picture sources * @note added in 2.3 */ - void refreshPicture( const QgsExpressionContext* context = 0 ); + void refreshPicture( const QgsExpressionContext* context = nullptr ); /** Prepares the picture's source expression after it is altered or the compositions * atlas coverage layer changes. @@ -286,7 +286,7 @@ class CORE_EXPORT QgsComposerPicture: public QgsComposerItem */ void recalculateSize(); - virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext *context = 0 ) override; + virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext *context = nullptr ) override; signals: /** Is emitted on picture rotation change*/ diff --git a/src/core/composer/qgscomposerscalebar.cpp b/src/core/composer/qgscomposerscalebar.cpp index 592815af133..c507d88d2a1 100644 --- a/src/core/composer/qgscomposerscalebar.cpp +++ b/src/core/composer/qgscomposerscalebar.cpp @@ -38,13 +38,13 @@ QgsComposerScaleBar::QgsComposerScaleBar( QgsComposition* composition ) : QgsComposerItem( composition ) - , mComposerMap( 0 ) + , mComposerMap( nullptr ) , mNumUnitsPerSegment( 0 ) , mSegmentSizeMode( SegmentSizeFixed ) , mMinBarWidth( 50 ) , mMaxBarWidth( 150 ) , mFontColor( QColor( 0, 0, 0 ) ) - , mStyle( 0 ) + , mStyle( nullptr ) , mSegmentMillimeters( 0.0 ) , mAlignment( Left ) , mUnits( MapUnits ) @@ -221,7 +221,7 @@ void QgsComposerScaleBar::invalidateCurrentMap() disconnect( mComposerMap, SIGNAL( extentChanged() ), this, SLOT( updateSegmentSize() ) ); disconnect( mComposerMap, SIGNAL( destroyed( QObject* ) ), this, SLOT( invalidateCurrentMap() ) ); - mComposerMap = 0; + mComposerMap = nullptr; } // nextNiceNumber(4573.23, d) = 5000 (d=1) -> 4600 (d=10) -> 4580 (d=100) -> 4574 (d=1000) -> etc @@ -589,7 +589,7 @@ void QgsComposerScaleBar::segmentPositions( QList >& posWi void QgsComposerScaleBar::setStyle( const QString& styleName ) { delete mStyle; - mStyle = 0; + mStyle = nullptr; //switch depending on style name if ( styleName == "Single Box" ) @@ -866,7 +866,7 @@ bool QgsComposerScaleBar::readXML( const QDomElement& itemElem, const QDomDocume //style delete mStyle; - mStyle = 0; + mStyle = nullptr; QString styleString = itemElem.attribute( "style", "" ); setStyle( tr( styleString.toLocal8Bit().data() ) ); diff --git a/src/core/composer/qgscomposershape.cpp b/src/core/composer/qgscomposershape.cpp index f05a3db1edd..370f40641f3 100644 --- a/src/core/composer/qgscomposershape.cpp +++ b/src/core/composer/qgscomposershape.cpp @@ -26,7 +26,7 @@ QgsComposerShape::QgsComposerShape( QgsComposition* composition ): QgsComposerIt mShape( Ellipse ), mCornerRadius( 0 ), mUseSymbolV2( false ), //default to not using SymbolV2 for shapes, to preserve 2.0 api - mShapeStyleSymbol( 0 ), + mShapeStyleSymbol( nullptr ), mMaxSymbolBleed( 0 ) { setFrameEnabled( true ); @@ -45,7 +45,7 @@ QgsComposerShape::QgsComposerShape( qreal x, qreal y, qreal width, qreal height, mShape( Ellipse ), mCornerRadius( 0 ), mUseSymbolV2( false ), //default to not using SymbolV2 for shapes, to preserve 2.0 api - mShapeStyleSymbol( 0 ), + mShapeStyleSymbol( nullptr ), mMaxSymbolBleed( 0 ) { setSceneRect( QRectF( x, y, width, height ) ); @@ -236,7 +236,7 @@ void QgsComposerShape::drawShapeUsingSymbol( QPainter* p ) } mShapeStyleSymbol->startRender( context ); - mShapeStyleSymbol->renderPolygon( shapePolygon, &rings, 0, context ); + mShapeStyleSymbol->renderPolygon( shapePolygon, &rings, nullptr, context ); mShapeStyleSymbol->stopRender( context ); p->restore(); diff --git a/src/core/composer/qgscomposertablev2.cpp b/src/core/composer/qgscomposertablev2.cpp index 8f307025e7f..ea061f5f529 100644 --- a/src/core/composer/qgscomposertablev2.cpp +++ b/src/core/composer/qgscomposertablev2.cpp @@ -80,7 +80,7 @@ QgsComposerTableV2::QgsComposerTableV2( QgsComposition *composition, bool create } QgsComposerTableV2::QgsComposerTableV2() - : QgsComposerMultiFrame( 0, false ) + : QgsComposerMultiFrame( nullptr, false ) , mCellMargin( 1.0 ) , mEmptyTableMode( HeadersOnly ) , mShowEmptyRows( false ) @@ -818,7 +818,7 @@ void QgsComposerTableV2::setCellStyle( QgsComposerTableV2::CellStyleGroup group, const QgsComposerTableStyle* QgsComposerTableV2::cellStyle( QgsComposerTableV2::CellStyleGroup group ) const { if ( !mCellStyles.contains( group ) ) - return 0; + return nullptr; return mCellStyles.value( group ); } diff --git a/src/core/composer/qgscomposerutils.cpp b/src/core/composer/qgscomposerutils.cpp index 005711cd560..778f4f7463b 100644 --- a/src/core/composer/qgscomposerutils.cpp +++ b/src/core/composer/qgscomposerutils.cpp @@ -343,7 +343,7 @@ void QgsComposerUtils::readDataDefinedProperty( const QgsComposerObject::DataDef QMap< QgsComposerObject::DataDefinedProperty, QgsDataDefined* >::const_iterator it = dataDefinedProperties->constFind( property ); - QgsDataDefined* dd = 0; + QgsDataDefined* dd = nullptr; if ( it != dataDefinedProperties->constEnd() ) { dd = it.value(); diff --git a/src/core/composer/qgscomposition.cpp b/src/core/composer/qgscomposition.cpp index 1353e79bbb2..a98a95d1320 100644 --- a/src/core/composer/qgscomposition.cpp +++ b/src/core/composer/qgscomposition.cpp @@ -57,7 +57,7 @@ #include QgsComposition::QgsComposition( QgsMapRenderer* mapRenderer ) - : QGraphicsScene( 0 ) + : QGraphicsScene( nullptr ) , mMapRenderer( mapRenderer ) , mMapSettings( mapRenderer->mapSettings() ) , mAtlasComposition( this ) @@ -66,8 +66,8 @@ QgsComposition::QgsComposition( QgsMapRenderer* mapRenderer ) } QgsComposition::QgsComposition( const QgsMapSettings& mapSettings ) - : QGraphicsScene( 0 ) - , mMapRenderer( 0 ) + : QGraphicsScene( nullptr ) + , mMapRenderer( nullptr ) , mMapSettings( mapSettings ) , mAtlasComposition( this ) { @@ -81,10 +81,10 @@ void QgsComposition::init() mPageWidth = 297; mPageHeight = 210; mSpaceBetweenPages = 10; - mPageStyleSymbol = 0; + mPageStyleSymbol = nullptr; mPrintAsRaster = false; mGenerateWorldFile = false; - mWorldFileMap = 0; + mWorldFileMap = nullptr; mUseAdvancedEffects = true; mSnapToGrid = false; mGridVisible = false; @@ -97,12 +97,12 @@ void QgsComposition::init() mSmartGuides = true; mSnapTolerance = 0; mBoundingBoxesVisible = true; - mSelectionHandles = 0; - mActiveItemCommand = 0; - mActiveMultiFrameCommand = 0; + mSelectionHandles = nullptr; + mActiveItemCommand = nullptr; + mActiveMultiFrameCommand = nullptr; mAtlasMode = QgsComposition::AtlasOff; mPreventCursorChange = false; - mItemsModel = 0; + mItemsModel = nullptr; mUndoStack = new QUndoStack(); mResizeToContentsMarginTop = 0; @@ -648,7 +648,7 @@ void QgsComposition::setStatusMessage( const QString & message ) QgsComposerItem* QgsComposition::composerItemAt( const QPointF & position, const bool ignoreLocked ) const { - return composerItemAt( position, 0, ignoreLocked ); + return composerItemAt( position, nullptr, ignoreLocked ); } QgsComposerItem* QgsComposition::composerItemAt( const QPointF & position, const QgsComposerItem* belowItem, const bool ignoreLocked ) const @@ -681,7 +681,7 @@ QgsComposerItem* QgsComposition::composerItemAt( const QPointF & position, const } } } - return 0; + return nullptr; } int QgsComposition::pageNumberAt( const QPointF& position ) const @@ -746,7 +746,7 @@ const QgsComposerMap* QgsComposition::getComposerMapById( const int id ) const } } } - return 0; + return nullptr; } const QgsComposerHtml* QgsComposition::getComposerHtmlByItem( QgsComposerItem *item ) const @@ -765,7 +765,7 @@ const QgsComposerHtml* QgsComposition::getComposerHtmlByItem( QgsComposerItem *i return composerHtml; } } - return 0; + return nullptr; } const QgsComposerItem* QgsComposition::getComposerItemById( const QString& theId ) const @@ -783,7 +783,7 @@ const QgsComposerItem* QgsComposition::getComposerItemById( const QString& theId } } } - return 0; + return nullptr; } #if 0 @@ -839,7 +839,7 @@ const QgsComposerItem* QgsComposition::getComposerItemByUuid( const QString& the } } - return 0; + return nullptr; } void QgsComposition::setPrintResolution( const int dpi ) @@ -1141,7 +1141,7 @@ bool QgsComposition::loadFromTemplate( const QDomDocument& doc, QMap* mapsToRestore, bool addUndoCommands, QPointF* pos, bool pasteInPlace ) { - QPointF* pasteInPlacePt = 0; + QPointF* pasteInPlacePt = nullptr; //if we are adding items to a composition which already contains items, we need to make sure //these items are placed at the top of the composition and that zValues are not duplicated @@ -1192,7 +1192,7 @@ void QgsComposition::addItemsFromXML( const QDomElement& elem, const QDomDocumen int zOrderOffset = mItemsModel->zOrderListSize(); QPointF pasteShiftPos; - QgsComposerItem* lastPastedItem = 0; + QgsComposerItem* lastPastedItem = nullptr; if ( pos ) { //If we are placing items relative to a certain point, then calculate how much we need @@ -1528,7 +1528,7 @@ void QgsComposition::addItemsFromXML( const QDomElement& elem, const QDomDocumen } delete pasteInPlacePt; - pasteInPlacePt = 0; + pasteInPlacePt = nullptr; } @@ -1593,7 +1593,7 @@ QgsComposerItem* QgsComposition::getComposerItemBelow( QgsComposerItem* item ) c void QgsComposition::selectNextByZOrder( ZValueDirection direction ) { - QgsComposerItem* previousSelectedItem = 0; + QgsComposerItem* previousSelectedItem = nullptr; QList selectedItems = selectedComposerItems(); if ( !selectedItems.isEmpty() ) { @@ -1606,7 +1606,7 @@ void QgsComposition::selectNextByZOrder( ZValueDirection direction ) } //select item with target z value - QgsComposerItem* selectedItem = 0; + QgsComposerItem* selectedItem = nullptr; switch ( direction ) { case QgsComposition::ZValueBelow: @@ -1936,7 +1936,7 @@ QgsComposerItemGroup *QgsComposition::groupItems( QList items if ( items.size() < 2 ) { //not enough items for a group - return 0; + return nullptr; } QgsComposerItemGroup* itemGroup = new QgsComposerItemGroup( this ); @@ -1979,9 +1979,9 @@ void QgsComposition::updateZValues( const bool addUndoCommands ) { int counter = mItemsModel->zOrderListSize(); QList::const_iterator it = mItemsModel->zOrderList()->constBegin(); - QgsComposerItem* currentItem = 0; + QgsComposerItem* currentItem = nullptr; - QUndoCommand* parentCommand = 0; + QUndoCommand* parentCommand = nullptr; if ( addUndoCommands ) { parentCommand = new QUndoCommand( tr( "Item z-order changed" ) ); @@ -1991,7 +1991,7 @@ void QgsComposition::updateZValues( const bool addUndoCommands ) currentItem = *it; if ( currentItem ) { - QgsComposerItemCommand* subcommand = 0; + QgsComposerItemCommand* subcommand = nullptr; if ( addUndoCommands ) { subcommand = new QgsComposerItemCommand( *it, "", parentCommand ); @@ -2120,7 +2120,7 @@ QGraphicsLineItem* QgsComposition::nearestSnapLine( const bool horizontal, const QList< QPair< QgsComposerItem*, QgsComposerItem::ItemPositionMode> >& snappedItems ) const { double minSqrDist = DBL_MAX; - QGraphicsLineItem* item = 0; + QGraphicsLineItem* item = nullptr; double currentXCoord = 0; double currentYCoord = 0; double currentSqrDist = 0; @@ -2343,7 +2343,7 @@ void QgsComposition::beginCommand( QgsComposerItem* item, const QString& command delete mActiveItemCommand; if ( !item ) { - mActiveItemCommand = 0; + mActiveItemCommand = nullptr; return; } @@ -2372,14 +2372,14 @@ void QgsComposition::endCommand() { delete mActiveItemCommand; } - mActiveItemCommand = 0; + mActiveItemCommand = nullptr; } } void QgsComposition::cancelCommand() { delete mActiveItemCommand; - mActiveItemCommand = 0; + mActiveItemCommand = nullptr; } void QgsComposition::beginMultiFrameCommand( QgsComposerMultiFrame* multiFrame, const QString& text, const QgsComposerMultiFrameMergeCommand::Context c ) @@ -2388,7 +2388,7 @@ void QgsComposition::beginMultiFrameCommand( QgsComposerMultiFrame* multiFrame, if ( !multiFrame ) { - mActiveMultiFrameCommand = 0; + mActiveMultiFrameCommand = nullptr; return; } @@ -2417,14 +2417,14 @@ void QgsComposition::endMultiFrameCommand() { delete mActiveMultiFrameCommand; } - mActiveMultiFrameCommand = 0; + mActiveMultiFrameCommand = nullptr; } } void QgsComposition::cancelMultiFrameCommand() { delete mActiveMultiFrameCommand; - mActiveMultiFrameCommand = 0; + mActiveMultiFrameCommand = nullptr; } void QgsComposition::addMultiFrame( QgsComposerMultiFrame* multiFrame ) @@ -2582,7 +2582,7 @@ void QgsComposition::removeComposerItem( QgsComposerItem* item, const bool creat else { bool frameItem = ( item->type() == QgsComposerItem::ComposerFrame ); - QgsComposerMultiFrame* multiFrame = 0; + QgsComposerMultiFrame* multiFrame = nullptr; if ( createCommand ) { if ( frameItem ) //multiframe tracks item changes @@ -3015,7 +3015,7 @@ QGraphicsView *QgsComposition::graphicsView() const } //no view attached to composition - return 0; + return nullptr; } void QgsComposition::computeWorldFileParameters( double& a, double& b, double& c, double& d, double& e, double& f ) const @@ -3215,7 +3215,7 @@ QgsDataDefined *QgsComposition::dataDefinedProperty( const QgsComposerObject::Da if ( property == QgsComposerObject::AllProperties || property == QgsComposerObject::NoProperty ) { //invalid property - return 0; + return nullptr; } //find matching QgsDataDefined for property @@ -3226,7 +3226,7 @@ QgsDataDefined *QgsComposition::dataDefinedProperty( const QgsComposerObject::Da } //not found - return 0; + return nullptr; } void QgsComposition::setDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property, bool active, bool useExpression, const QString &expression, const QString &field ) @@ -3310,7 +3310,7 @@ bool QgsComposition::dataDefinedEvaluate( QgsComposerObject::DataDefinedProperty } //evaluate data defined property using current atlas context - QVariant result = dataDefinedValue( property, useFeature ? ¤tFeature : 0, layerFields, context, dataDefinedProperties ); + QVariant result = dataDefinedValue( property, useFeature ? ¤tFeature : nullptr, layerFields, context, dataDefinedProperties ); if ( result.isValid() ) { @@ -3334,7 +3334,7 @@ bool QgsComposition::dataDefinedActive( const QgsComposerObject::DataDefinedProp return false; } - QgsDataDefined* dd = 0; + QgsDataDefined* dd = nullptr; QMap< QgsComposerObject::DataDefinedProperty, QgsDataDefined* >::const_iterator it = dataDefinedProperties->find( property ); if ( it != dataDefinedProperties->constEnd() ) { @@ -3363,7 +3363,7 @@ QVariant QgsComposition::dataDefinedValue( QgsComposerObject::DataDefinedPropert return QVariant(); } - QgsDataDefined* dd = 0; + QgsDataDefined* dd = nullptr; QMap< QgsComposerObject::DataDefinedProperty, QgsDataDefined* >::const_iterator it = dataDefinedProperties->find( property ); if ( it != dataDefinedProperties->constEnd() ) { @@ -3451,7 +3451,7 @@ QgsExpressionContext* QgsComposition::createExpressionContext() const void QgsComposition::prepareAllDataDefinedExpressions() { QScopedPointer< QgsExpressionContext > context( createExpressionContext() ); - prepareDataDefinedExpression( 0, &mDataDefinedProperties, *context.data() ); + prepareDataDefinedExpression( nullptr, &mDataDefinedProperties, *context.data() ); } void QgsComposition::relativeResizeRect( QRectF& rectToResize, const QRectF& boundsBefore, const QRectF& boundsAfter ) diff --git a/src/core/composer/qgscomposition.h b/src/core/composer/qgscomposition.h index 61cceeb6c22..10999661159 100644 --- a/src/core/composer/qgscomposition.h +++ b/src/core/composer/qgscomposition.h @@ -487,7 +487,7 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene atlas properties from the template. Set to false to only add new items from the template, without overwriting the existing items or composition settings. */ - bool loadFromTemplate( const QDomDocument& doc, QMap* substitutionMap = 0, + bool loadFromTemplate( const QDomDocument& doc, QMap* substitutionMap = nullptr, bool addUndoCommands = false, const bool clearComposition = true ); /** Add items from XML representation to the graphics scene (for project file reading, pasting items from clipboard) @@ -499,8 +499,8 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene @param pasteInPlace whether the position should be kept but mapped to the page origin. (the page is the page under to the mouse cursor) @note parameters mapsToRestore, addUndoCommands pos and pasteInPlace not available in python bindings */ - void addItemsFromXML( const QDomElement& elem, const QDomDocument& doc, QMap< QgsComposerMap*, int >* mapsToRestore = 0, - bool addUndoCommands = false, QPointF* pos = 0, bool pasteInPlace = false ); + void addItemsFromXML( const QDomElement& elem, const QDomDocument& doc, QMap< QgsComposerMap*, int >* mapsToRestore = nullptr, + bool addUndoCommands = false, QPointF* pos = nullptr, bool pasteInPlace = false ); /** Adds item to z list. Usually called from constructor of QgsComposerItem*/ void addItemToZList( QgsComposerItem* item ); @@ -865,7 +865,7 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene * @param context expression context for evaluating data defined expressions * @note this method was added in version 2.5 */ - void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext* context = 0 ); + void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext* context = nullptr ); /** Creates an expression context relating to the compositions's current state. The context includes * scopes for global, project, composition and atlas properties. @@ -990,7 +990,7 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene /** Recalculates the page size using data defined page settings * @param context expression context for data defined page sizes */ - void refreshPageSize( const QgsExpressionContext* context = 0 ); + void refreshPageSize( const QgsExpressionContext* context = nullptr ); /** Evaluate a data defined property and return the calculated value * @returns true if data defined property could be successfully evaluated diff --git a/src/core/composer/qgsdoubleboxscalebarstyle.cpp b/src/core/composer/qgsdoubleboxscalebarstyle.cpp index 4f50fb2232e..2f820251410 100644 --- a/src/core/composer/qgsdoubleboxscalebarstyle.cpp +++ b/src/core/composer/qgsdoubleboxscalebarstyle.cpp @@ -25,7 +25,7 @@ QgsDoubleBoxScaleBarStyle::QgsDoubleBoxScaleBarStyle( const QgsComposerScaleBar* } -QgsDoubleBoxScaleBarStyle::QgsDoubleBoxScaleBarStyle(): QgsScaleBarStyle( 0 ) +QgsDoubleBoxScaleBarStyle::QgsDoubleBoxScaleBarStyle(): QgsScaleBarStyle( nullptr ) { } diff --git a/src/core/composer/qgslegendmodel.cpp b/src/core/composer/qgslegendmodel.cpp index b4311932446..b43c48b886d 100644 --- a/src/core/composer/qgslegendmodel.cpp +++ b/src/core/composer/qgslegendmodel.cpp @@ -80,8 +80,8 @@ void QgsLegendModel::setLayerSetAndGroups( const QStringList& layerIds, const QL { setLayerSet( layerIds ); - QStandardItem* currentItem = 0; - QStandardItem* currentGroupItem = 0; + QStandardItem* currentItem = nullptr; + QStandardItem* currentGroupItem = nullptr; int i = 0; QList< GroupLayerInfo >::const_iterator infoIt = groupInfo.constBegin(); @@ -132,7 +132,7 @@ void QgsLegendModel::setLayerSet( const QStringList& layerIds, double scaleDenom clear(); QStringList::const_iterator idIter = mLayerIds.constBegin(); - QgsMapLayer* currentLayer = 0; + QgsMapLayer* currentLayer = nullptr; for ( ; idIter != mLayerIds.constEnd(); ++idIter ) { @@ -629,8 +629,8 @@ bool QgsLegendModel::writeXML( QDomElement& composerLegendElem, QDomDocument& do QDomElement legendModelElem = doc.createElement( "Model" ); legendModelElem.setAttribute( "autoUpdate", mAutoUpdate ); int nTopLevelItems = invisibleRootItem()->rowCount(); - QStandardItem* currentItem = 0; - QgsComposerLegendItem* currentLegendItem = 0; + QStandardItem* currentItem = nullptr; + QgsComposerLegendItem* currentLegendItem = nullptr; for ( int i = 0; i < nTopLevelItems; ++i ) { @@ -673,7 +673,7 @@ bool QgsLegendModel::readXML( const QDomElement& legendModelElem, const QDomDocu } //toplevel items can be groups or layers - QgsComposerLegendItem* currentItem = 0; + QgsComposerLegendItem* currentItem = nullptr; if ( currentElem.tagName() == "LayerItem" ) { currentItem = new QgsComposerLayerItem(); @@ -730,7 +730,7 @@ Qt::ItemFlags QgsLegendModel::flags( const QModelIndex &index ) const if ( index.column() == 1 && item ) { // Style - QStandardItem* firstColumnItem = 0; + QStandardItem* firstColumnItem = nullptr; if ( item->parent() ) { firstColumnItem = item->parent()->child( index.row(), 0 ); @@ -823,7 +823,7 @@ bool QgsLegendModel::dropMimeData( const QMimeData *data, Qt::DropAction action, return false; } - QStandardItem* dropIntoItem = 0; + QStandardItem* dropIntoItem = nullptr; if ( parent.isValid() ) { dropIntoItem = itemFromIndex( parent ); @@ -848,7 +848,7 @@ bool QgsLegendModel::dropMimeData( const QMimeData *data, Qt::DropAction action, int nChildNodes = nodeList.size(); QDomElement currentElem; QString currentTagName; - QgsComposerLegendItem* currentItem = 0; + QgsComposerLegendItem* currentItem = nullptr; for ( int i = 0; i < nChildNodes; ++i ) { diff --git a/src/core/composer/qgslegendmodel.h b/src/core/composer/qgslegendmodel.h index ca2d7450bf1..234fdbcf345 100644 --- a/src/core/composer/qgslegendmodel.h +++ b/src/core/composer/qgslegendmodel.h @@ -68,7 +68,7 @@ class CORE_EXPORT QgsLegendModel : public QStandardItemModel @param parentItem parent item @returns a pointer to the added group */ - QStandardItem *addGroup( QString text = QString::null, int position = -1, QStandardItem* parentItem = 0 ); + QStandardItem *addGroup( QString text = QString::null, int position = -1, QStandardItem* parentItem = nullptr ); /** Tries to automatically update a model entry (e.g. a whole layer or only a single item)*/ void updateItem( QStandardItem* item ); @@ -105,7 +105,7 @@ class CORE_EXPORT QgsLegendModel : public QStandardItemModel public slots: void removeLayer( const QString& layerId ); - void addLayer( QgsMapLayer* theMapLayer, double scaleDenominator = -1, const QString& rule = "", QStandardItem* parentItem = 0 ); + void addLayer( QgsMapLayer* theMapLayer, double scaleDenominator = -1, const QString& rule = "", QStandardItem* parentItem = nullptr ); private slots: void updateLayer(); diff --git a/src/core/composer/qgsnumericscalebarstyle.cpp b/src/core/composer/qgsnumericscalebarstyle.cpp index e2cc6e6667d..e6eef29a12f 100644 --- a/src/core/composer/qgsnumericscalebarstyle.cpp +++ b/src/core/composer/qgsnumericscalebarstyle.cpp @@ -26,7 +26,7 @@ QgsNumericScaleBarStyle::QgsNumericScaleBarStyle( QgsComposerScaleBar* bar ): Qg } -QgsNumericScaleBarStyle::QgsNumericScaleBarStyle(): QgsScaleBarStyle( 0 ), mLastScaleBarWidth( 0 ) +QgsNumericScaleBarStyle::QgsNumericScaleBarStyle(): QgsScaleBarStyle( nullptr ), mLastScaleBarWidth( 0 ) { } diff --git a/src/core/composer/qgspaperitem.cpp b/src/core/composer/qgspaperitem.cpp index 154a412a7be..89d41087672 100644 --- a/src/core/composer/qgspaperitem.cpp +++ b/src/core/composer/qgspaperitem.cpp @@ -123,19 +123,19 @@ void QgsPaperGrid::paint( QPainter* painter, const QStyleOptionGraphicsItem* ite //QgsPaperItem QgsPaperItem::QgsPaperItem( QgsComposition* c ): QgsComposerItem( c, false ), - mPageGrid( 0 ) + mPageGrid( nullptr ) { initialize(); } QgsPaperItem::QgsPaperItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition ): QgsComposerItem( x, y, width, height, composition, false ), - mPageGrid( 0 ), mPageMargin( 0 ) + mPageGrid( nullptr ), mPageMargin( 0 ) { initialize(); } -QgsPaperItem::QgsPaperItem(): QgsComposerItem( 0, false ), - mPageGrid( 0 ), mPageMargin( 0 ) +QgsPaperItem::QgsPaperItem(): QgsComposerItem( nullptr, false ), + mPageGrid( nullptr ), mPageMargin( 0 ) { initialize(); } @@ -197,7 +197,7 @@ void QgsPaperItem::paint( QPainter* painter, const QStyleOptionGraphicsItem* ite ( rect().width() - 2 * mPageMargin ) * dotsPerMM, ( rect().height() - 2 * mPageMargin ) * dotsPerMM ) ); QList rings; //empty list - mComposition->pageStyleSymbol()->renderPolygon( pagePolygon, &rings, 0, context ); + mComposition->pageStyleSymbol()->renderPolygon( pagePolygon, &rings, nullptr, context ); mComposition->pageStyleSymbol()->stopRender( context ); painter->restore(); } diff --git a/src/core/composer/qgsscalebarstyle.cpp b/src/core/composer/qgsscalebarstyle.cpp index df0d99804d0..7934fe08adf 100644 --- a/src/core/composer/qgsscalebarstyle.cpp +++ b/src/core/composer/qgsscalebarstyle.cpp @@ -25,7 +25,7 @@ QgsScaleBarStyle::QgsScaleBarStyle( const QgsComposerScaleBar* bar ): mScaleBar } -QgsScaleBarStyle::QgsScaleBarStyle(): mScaleBar( 0 ) +QgsScaleBarStyle::QgsScaleBarStyle(): mScaleBar( nullptr ) { } diff --git a/src/core/composer/qgssingleboxscalebarstyle.cpp b/src/core/composer/qgssingleboxscalebarstyle.cpp index 1d4d826cec9..a9bd11b0fef 100644 --- a/src/core/composer/qgssingleboxscalebarstyle.cpp +++ b/src/core/composer/qgssingleboxscalebarstyle.cpp @@ -25,7 +25,7 @@ QgsSingleBoxScaleBarStyle::QgsSingleBoxScaleBarStyle( const QgsComposerScaleBar* } -QgsSingleBoxScaleBarStyle::QgsSingleBoxScaleBarStyle(): QgsScaleBarStyle( 0 ) +QgsSingleBoxScaleBarStyle::QgsSingleBoxScaleBarStyle(): QgsScaleBarStyle( nullptr ) { } diff --git a/src/core/composer/qgsticksscalebarstyle.cpp b/src/core/composer/qgsticksscalebarstyle.cpp index cd6330ee5e8..9a654bbcc7a 100644 --- a/src/core/composer/qgsticksscalebarstyle.cpp +++ b/src/core/composer/qgsticksscalebarstyle.cpp @@ -24,7 +24,7 @@ QgsTicksScaleBarStyle::QgsTicksScaleBarStyle( const QgsComposerScaleBar* bar ): mTickPosition = TicksMiddle; } -QgsTicksScaleBarStyle::QgsTicksScaleBarStyle(): QgsScaleBarStyle( 0 ) +QgsTicksScaleBarStyle::QgsTicksScaleBarStyle(): QgsScaleBarStyle( nullptr ) { mTickPosition = TicksMiddle; } diff --git a/src/core/dxf/qgsdxfexport.cpp b/src/core/dxf/qgsdxfexport.cpp index 6e6ea0e1a1e..35d7aae3214 100644 --- a/src/core/dxf/qgsdxfexport.cpp +++ b/src/core/dxf/qgsdxfexport.cpp @@ -832,7 +832,7 @@ void QgsDxfExport::writeBlocks() continue; // if point symbol layer and no data defined properties: write block - QgsSymbolV2RenderContext ctx( ct, QgsSymbolV2::MapUnit, slIt->second->alpha(), false, slIt->second->renderHints(), 0 ); + QgsSymbolV2RenderContext ctx( ct, QgsSymbolV2::MapUnit, slIt->second->alpha(), false, slIt->second->renderHints(), nullptr ); ml->startRender( ctx ); // markers with data defined properties are inserted inline @@ -863,7 +863,7 @@ void QgsDxfExport::writeBlocks() writeGroup( 1, "" ); // maplayer 0 -> block receives layer from INSERT statement - ml->writeDxf( *this, mapUnitScaleFactor( mSymbologyScaleDenominator, ml->sizeUnit(), mMapUnits ), "0", &ctx, 0 ); + ml->writeDxf( *this, mapUnitScaleFactor( mSymbologyScaleDenominator, ml->sizeUnit(), mMapUnits ), "0", &ctx, nullptr ); writeGroup( 0, "ENDBLK" ); writeHandle(); @@ -924,7 +924,7 @@ void QgsDxfExport::writeEntities() continue; } - QgsSymbolV2RenderContext sctx( ctx, QgsSymbolV2::MM, 1.0, false, 0, 0 ); + QgsSymbolV2RenderContext sctx( ctx, QgsSymbolV2::MM, 1.0, false, 0, nullptr ); QgsFeatureRendererV2* renderer = vl->rendererV2(); if ( !renderer ) { @@ -945,7 +945,7 @@ void QgsDxfExport::writeEntities() if ( !lp->prepare( ctx, attributes ) ) { engine.removeProvider( lp ); - lp = 0; + lp = nullptr; } if ( mSymbologyExport == QgsDxfExport::SymbolLayerSymbology && @@ -973,7 +973,7 @@ void QgsDxfExport::writeEntities() sctx.setFeature( &fet ); if ( mSymbologyExport == NoSymbology ) { - addFeature( sctx, lName, 0, 0 ); // no symbology at all + addFeature( sctx, lName, nullptr, nullptr ); // no symbology at all } else { @@ -1040,7 +1040,7 @@ void QgsDxfExport::writeEntitiesSymbolLevels( QgsVectorLayer* layer ) ctx.expressionContext() << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() << QgsExpressionContextUtils::layerScope( layer ); - QgsSymbolV2RenderContext sctx( ctx, QgsSymbolV2::MM, 1.0, false, 0, 0 ); + QgsSymbolV2RenderContext sctx( ctx, QgsSymbolV2::MM, 1.0, false, 0, nullptr ); renderer->startRender( ctx, layer->fields() ); // get iterator @@ -1058,7 +1058,7 @@ void QgsDxfExport::writeEntitiesSymbolLevels( QgsVectorLayer* layer ) // fetch features QgsFeature fet; - QgsSymbolV2* featureSymbol = 0; + QgsSymbolV2* featureSymbol = nullptr; while ( fit.nextFeature( fet ) ) { ctx.expressionContext().setFeature( fet ); diff --git a/src/core/dxf/qgsdxfpaintdevice.cpp b/src/core/dxf/qgsdxfpaintdevice.cpp index ef2a3cb286e..1aacec70c76 100644 --- a/src/core/dxf/qgsdxfpaintdevice.cpp +++ b/src/core/dxf/qgsdxfpaintdevice.cpp @@ -17,7 +17,7 @@ #include "qgsdxfpaintdevice.h" -QgsDxfPaintDevice::QgsDxfPaintDevice( QgsDxfExport* dxf ): QPaintDevice(), mPaintEngine( 0 ) +QgsDxfPaintDevice::QgsDxfPaintDevice( QgsDxfExport* dxf ): QPaintDevice(), mPaintEngine( nullptr ) { mPaintEngine = new QgsDxfPaintEngine( this, dxf ); } diff --git a/src/core/effects/qgseffectstack.cpp b/src/core/effects/qgseffectstack.cpp index d4f6255f659..1ed6ae2d9e6 100644 --- a/src/core/effects/qgseffectstack.cpp +++ b/src/core/effects/qgseffectstack.cpp @@ -114,7 +114,7 @@ void QgsEffectStack::draw( QgsRenderContext &context ) } } delete sourcePic; - sourcePic = 0; + sourcePic = nullptr; context.setPainter( destPainter ); //then, we render all the results in the opposite order @@ -237,7 +237,7 @@ bool QgsEffectStack::changeEffect( const int index, QgsPaintEffect *effect ) QgsPaintEffect *QgsEffectStack::takeEffect( const int index ) { if ( index < 0 || index >= mEffectList.count() ) - return NULL; + return nullptr; return mEffectList.takeAt( index ); } @@ -255,6 +255,6 @@ QgsPaintEffect *QgsEffectStack::effect( int index ) const } else { - return NULL; + return nullptr; } } diff --git a/src/core/effects/qgsgloweffect.cpp b/src/core/effects/qgsgloweffect.cpp index 9cab6c8274f..8ac5156a27e 100644 --- a/src/core/effects/qgsgloweffect.cpp +++ b/src/core/effects/qgsgloweffect.cpp @@ -24,7 +24,7 @@ QgsGlowEffect::QgsGlowEffect() : QgsPaintEffect() , mSpread( 2.0 ) , mSpreadUnit( QgsSymbolV2::MM ) - , mRamp( NULL ) + , mRamp( nullptr ) , mBlurLevel( 3 ) , mTransparency( 0.5 ) , mColor( Qt::white ) @@ -39,7 +39,7 @@ QgsGlowEffect::QgsGlowEffect( const QgsGlowEffect &other ) , mSpread( other.spread() ) , mSpreadUnit( other.spreadUnit() ) , mSpreadMapUnitScale( other.spreadMapUnitScale() ) - , mRamp( NULL ) + , mRamp( nullptr ) , mBlurLevel( other.blurLevel() ) , mTransparency( other.transparency() ) , mColor( other.color() ) @@ -64,7 +64,7 @@ void QgsGlowEffect::draw( QgsRenderContext &context ) QImage im = sourceAsImage( context )->copy(); - QgsVectorColorRampV2* ramp = 0; + QgsVectorColorRampV2* ramp = nullptr; if ( mColorType == ColorRamp && mRamp ) { ramp = mRamp; @@ -192,7 +192,7 @@ QgsGlowEffect &QgsGlowEffect::operator=( const QgsGlowEffect & rhs ) delete mRamp; mSpread = rhs.spread(); - mRamp = rhs.ramp() ? rhs.ramp()->clone() : NULL; + mRamp = rhs.ramp() ? rhs.ramp()->clone() : nullptr; mBlurLevel = rhs.blurLevel(); mTransparency = rhs.transparency(); mColor = rhs.color(); diff --git a/src/core/effects/qgsimageoperation.cpp b/src/core/effects/qgsimageoperation.cpp index b4edc7e2f50..36922fb4c65 100644 --- a/src/core/effects/qgsimageoperation.cpp +++ b/src/core/effects/qgsimageoperation.cpp @@ -675,7 +675,7 @@ void QgsImageOperation::GaussianBlurOperation::operator()( QgsImageOperation::Im int sourceBpl = block.image->bytesPerLine(); unsigned char* outputLineRef = mDestImage->scanLine( block.beginLine ); - QRgb* destRef = 0; + QRgb* destRef = nullptr; if ( mDirection == ByRow ) { unsigned char* sourceFirstLine = block.image->scanLine( 0 ); diff --git a/src/core/effects/qgsimageoperation.h b/src/core/effects/qgsimageoperation.h index a4f55952c62..b32bf79d097 100644 --- a/src/core/effects/qgsimageoperation.h +++ b/src/core/effects/qgsimageoperation.h @@ -108,7 +108,7 @@ class CORE_EXPORT QgsImageOperation : shadeExterior( true ) , useMaxDistance( true ) , spread( 10.0 ) - , ramp( NULL ) + , ramp( nullptr ) { } /** Set to true to perform the distance transform on transparent pixels diff --git a/src/core/effects/qgspainteffect.cpp b/src/core/effects/qgspainteffect.cpp index 6a0136824f5..d7d615a5267 100644 --- a/src/core/effects/qgspainteffect.cpp +++ b/src/core/effects/qgspainteffect.cpp @@ -27,12 +27,12 @@ QgsPaintEffect::QgsPaintEffect() : mEnabled( true ) , mDrawMode( ModifyAndRender ) , requiresQPainterDpiFix( true ) - , mPicture( 0 ) - , mSourceImage( 0 ) + , mPicture( nullptr ) + , mSourceImage( nullptr ) , mOwnsImage( false ) - , mPrevPainter( 0 ) - , mEffectPainter( 0 ) - , mTempPicture( 0 ) + , mPrevPainter( nullptr ) + , mEffectPainter( nullptr ) + , mTempPicture( nullptr ) { } @@ -41,12 +41,12 @@ QgsPaintEffect::QgsPaintEffect( const QgsPaintEffect &other ) : mEnabled( other.enabled() ) , mDrawMode( other.drawMode() ) , requiresQPainterDpiFix( true ) - , mPicture( 0 ) - , mSourceImage( 0 ) + , mPicture( nullptr ) + , mSourceImage( nullptr ) , mOwnsImage( false ) - , mPrevPainter( 0 ) - , mEffectPainter( 0 ) - , mTempPicture( 0 ) + , mPrevPainter( nullptr ) + , mEffectPainter( nullptr ) + , mTempPicture( nullptr ) { } @@ -129,7 +129,7 @@ void QgsPaintEffect::render( QPicture &picture, QgsRenderContext &context ) //set source picture mPicture = &picture; delete mSourceImage; - mSourceImage = 0; + mSourceImage = nullptr; draw( context ); } @@ -156,18 +156,18 @@ void QgsPaintEffect::end( QgsRenderContext &context ) mEffectPainter->end(); delete mEffectPainter; - mEffectPainter = 0; + mEffectPainter = nullptr; //restore previous painter for context context.setPainter( mPrevPainter ); - mPrevPainter = 0; + mPrevPainter = nullptr; //draw using effect render( *mTempPicture, context ); //clean up delete mTempPicture; - mTempPicture = 0; + mTempPicture = nullptr; } void QgsPaintEffect::drawSource( QPainter &painter ) @@ -194,7 +194,7 @@ QImage* QgsPaintEffect::sourceAsImage( QgsRenderContext &context ) } if ( !mPicture ) - return 0; + return nullptr; //else create it //TODO - test with premultiplied image for speed diff --git a/src/core/effects/qgspainteffectregistry.cpp b/src/core/effects/qgspainteffectregistry.cpp index 7778a3e7d68..967bc323b93 100644 --- a/src/core/effects/qgspainteffectregistry.cpp +++ b/src/core/effects/qgspainteffectregistry.cpp @@ -32,23 +32,23 @@ QgsPaintEffectRegistry::QgsPaintEffectRegistry() { //init registry with known effects addEffectType( new QgsPaintEffectMetadata( "blur", QObject::tr( "Blur" ), - QgsBlurEffect::create, NULL ) ); + QgsBlurEffect::create, nullptr ) ); addEffectType( new QgsPaintEffectMetadata( "dropShadow", QObject::tr( "Drop Shadow" ), - QgsDropShadowEffect::create, NULL ) ); + QgsDropShadowEffect::create, nullptr ) ); addEffectType( new QgsPaintEffectMetadata( "innerShadow", QObject::tr( "Inner Shadow" ), - QgsInnerShadowEffect::create, NULL ) ); + QgsInnerShadowEffect::create, nullptr ) ); addEffectType( new QgsPaintEffectMetadata( "effectStack", QObject::tr( "Stack" ), - QgsEffectStack::create, NULL ) ); + QgsEffectStack::create, nullptr ) ); addEffectType( new QgsPaintEffectMetadata( "outerGlow", QObject::tr( "Outer Glow" ), - QgsOuterGlowEffect::create, NULL ) ); + QgsOuterGlowEffect::create, nullptr ) ); addEffectType( new QgsPaintEffectMetadata( "innerGlow", QObject::tr( "Inner Glow" ), - QgsInnerGlowEffect::create, NULL ) ); + QgsInnerGlowEffect::create, nullptr ) ); addEffectType( new QgsPaintEffectMetadata( "drawSource", QObject::tr( "Source" ), - QgsDrawSourceEffect::create, NULL ) ); + QgsDrawSourceEffect::create, nullptr ) ); addEffectType( new QgsPaintEffectMetadata( "transform", QObject::tr( "Transform" ), - QgsTransformEffect::create, NULL ) ); + QgsTransformEffect::create, nullptr ) ); addEffectType( new QgsPaintEffectMetadata( "color", QObject::tr( "Colorise" ), - QgsColorEffect::create, NULL ) ); + QgsColorEffect::create, nullptr ) ); } QgsPaintEffectRegistry::~QgsPaintEffectRegistry() @@ -71,12 +71,12 @@ QgsPaintEffectAbstractMetadata *QgsPaintEffectRegistry::effectMetadata( const QS if ( mMetadata.contains( name ) ) return mMetadata.value( name ); else - return NULL; + return nullptr; } bool QgsPaintEffectRegistry::addEffectType( QgsPaintEffectAbstractMetadata *metadata ) { - if ( metadata == NULL || mMetadata.contains( metadata->name() ) ) + if ( metadata == nullptr || mMetadata.contains( metadata->name() ) ) return false; mMetadata[metadata->name()] = metadata; @@ -86,7 +86,7 @@ bool QgsPaintEffectRegistry::addEffectType( QgsPaintEffectAbstractMetadata *meta QgsPaintEffect *QgsPaintEffectRegistry::createEffect( const QString &name, const QgsStringMap &properties ) const { if ( !mMetadata.contains( name ) ) - return NULL; + return nullptr; QgsPaintEffect* effect = mMetadata[name]->createPaintEffect( properties ); return effect; @@ -96,14 +96,14 @@ QgsPaintEffect *QgsPaintEffectRegistry::createEffect( const QDomElement &element { if ( element.isNull() ) { - return NULL; + return nullptr; } QString type = element.attribute( QString( "type" ) ); QgsPaintEffect* effect = instance()->createEffect( type ); if ( !effect ) - return NULL; + return nullptr; effect->readProperties( element ); return effect; diff --git a/src/core/effects/qgspainteffectregistry.h b/src/core/effects/qgspainteffectregistry.h index 7a23cc08f03..21932904ab4 100644 --- a/src/core/effects/qgspainteffectregistry.h +++ b/src/core/effects/qgspainteffectregistry.h @@ -67,7 +67,7 @@ class CORE_EXPORT QgsPaintEffectAbstractMetadata * if there's no GUI for the paint effect class. * @returns configuration widget */ - virtual QgsPaintEffectWidget* createWidget() { return NULL; } + virtual QgsPaintEffectWidget* createWidget() { return nullptr; } protected: QString mName; @@ -98,7 +98,7 @@ class CORE_EXPORT QgsPaintEffectMetadata : public QgsPaintEffectAbstractMetadata */ QgsPaintEffectMetadata( const QString& name, const QString& visibleName, QgsPaintEffectCreateFunc pfCreate, - QgsPaintEffectWidgetFunc pfWidget = NULL ) + QgsPaintEffectWidgetFunc pfWidget = nullptr ) : QgsPaintEffectAbstractMetadata( name, visibleName ) , mCreateFunc( pfCreate ) , mWidgetFunc( pfWidget ) @@ -130,14 +130,14 @@ class CORE_EXPORT QgsPaintEffectMetadata : public QgsPaintEffectAbstractMetadata * @note not available in python bindings * @see createWidget */ - virtual QgsPaintEffect* createPaintEffect( const QgsStringMap& map ) override { return mCreateFunc ? mCreateFunc( map ) : NULL; } + virtual QgsPaintEffect* createPaintEffect( const QgsStringMap& map ) override { return mCreateFunc ? mCreateFunc( map ) : nullptr; } /** Creates a new paint effect properties widget for the metadata's effect class * @returns effect properties widget * @note not available in python bindings * @see createWidget */ - virtual QgsPaintEffectWidget* createWidget() override { return mWidgetFunc ? mWidgetFunc() : NULL; } + virtual QgsPaintEffectWidget* createWidget() override { return mWidgetFunc ? mWidgetFunc() : nullptr; } protected: QgsPaintEffectCreateFunc mCreateFunc; diff --git a/src/core/geometry/qgscompoundcurvev2.cpp b/src/core/geometry/qgscompoundcurvev2.cpp index 6e1842e81a9..36f6c1ab611 100644 --- a/src/core/geometry/qgscompoundcurvev2.cpp +++ b/src/core/geometry/qgscompoundcurvev2.cpp @@ -102,7 +102,7 @@ bool QgsCompoundCurveV2::fromWkb( const unsigned char* wkb ) int nCurves; wkbPtr >> nCurves; - QgsCurveV2* currentCurve = 0; + QgsCurveV2* currentCurve = nullptr; int currentCurveSize = 0; for ( int i = 0; i < nCurves; ++i ) { @@ -348,7 +348,7 @@ QgsLineStringV2* QgsCompoundCurveV2::curveToLine() const { QList< QgsCurveV2* >::const_iterator curveIt = mCurves.constBegin(); QgsLineStringV2* line = new QgsLineStringV2(); - QgsLineStringV2* currentLine = 0; + QgsLineStringV2* currentLine = nullptr; for ( ; curveIt != mCurves.constEnd(); ++curveIt ) { currentLine = ( *curveIt )->curveToLine(); @@ -362,7 +362,7 @@ const QgsCurveV2* QgsCompoundCurveV2::curveAt( int i ) const { if ( i >= mCurves.size() ) { - return 0; + return nullptr; } return mCurves.at( i ); } @@ -399,13 +399,13 @@ void QgsCompoundCurveV2::addVertex( const QgsPointV2& pt ) } //is last curve QgsLineStringV2 - QgsCurveV2* lastCurve = 0; + QgsCurveV2* lastCurve = nullptr; if ( !mCurves.isEmpty() ) { lastCurve = mCurves.at( mCurves.size() - 1 ); } - QgsLineStringV2* line = 0; + QgsLineStringV2* line = nullptr; if ( !lastCurve || lastCurve->geometryType() != "LineString" ) { line = new QgsLineStringV2(); diff --git a/src/core/geometry/qgscurvepolygonv2.cpp b/src/core/geometry/qgscurvepolygonv2.cpp index 92a99a6ca22..15847647007 100644 --- a/src/core/geometry/qgscurvepolygonv2.cpp +++ b/src/core/geometry/qgscurvepolygonv2.cpp @@ -26,7 +26,7 @@ #include #include -QgsCurvePolygonV2::QgsCurvePolygonV2(): QgsSurfaceV2(), mExteriorRing( 0 ) +QgsCurvePolygonV2::QgsCurvePolygonV2(): QgsSurfaceV2(), mExteriorRing( nullptr ) { } @@ -36,7 +36,7 @@ QgsCurvePolygonV2::~QgsCurvePolygonV2() clear(); } -QgsCurvePolygonV2::QgsCurvePolygonV2( const QgsCurvePolygonV2& p ) : QgsSurfaceV2( p ), mExteriorRing( 0 ) +QgsCurvePolygonV2::QgsCurvePolygonV2( const QgsCurvePolygonV2& p ) : QgsSurfaceV2( p ), mExteriorRing( nullptr ) { if ( p.mExteriorRing ) { @@ -75,7 +75,7 @@ QgsCurvePolygonV2* QgsCurvePolygonV2::clone() const void QgsCurvePolygonV2::clear() { delete mExteriorRing; - mExteriorRing = 0; + mExteriorRing = nullptr; qDeleteAll( mInteriorRings ); mInteriorRings.clear(); mWkbType = QgsWKBTypes::Unknown; @@ -99,7 +99,7 @@ bool QgsCurvePolygonV2::fromWkb( const unsigned char* wkb ) int nRings; wkbPtr >> nRings; - QgsCurveV2* currentCurve = 0; + QgsCurveV2* currentCurve = nullptr; int currentCurveSize = 0; for ( int i = 0; i < nRings; ++i ) { @@ -236,7 +236,7 @@ unsigned char* QgsCurvePolygonV2::asWkb( int& binarySize ) const QgsWkbPtr wkb( geomPtr ); wkb << static_cast( QgsApplication::endian() ); wkb << static_cast( wkbType() ); - wkb << static_cast(( mExteriorRing != 0 ) + mInteriorRings.size() ); + wkb << static_cast(( mExteriorRing != nullptr ) + mInteriorRings.size() ); if ( mExteriorRing ) { int curveWkbLen = 0; @@ -415,7 +415,7 @@ QgsPolygonV2* QgsCurvePolygonV2::toPolygon() const { if ( !mExteriorRing ) { - return 0; + return nullptr; } QgsPolygonV2* poly = new QgsPolygonV2(); @@ -445,7 +445,7 @@ QgsCurveV2* QgsCurvePolygonV2::interiorRing( int i ) const { if ( i < 0 || i >= mInteriorRings.size() ) { - return 0; + return nullptr; } return mInteriorRings.at( i ); } @@ -692,7 +692,7 @@ bool QgsCurvePolygonV2::deleteVertex( const QgsVertexId& vId ) if ( vId.ring == 0 ) { delete mExteriorRing; - mExteriorRing = 0; + mExteriorRing = nullptr; if ( !mInteriorRings.isEmpty() ) { mExteriorRing = mInteriorRings.takeFirst(); diff --git a/src/core/geometry/qgscurvepolygonv2.h b/src/core/geometry/qgscurvepolygonv2.h index 841cfcf6dba..ae209b9b28b 100644 --- a/src/core/geometry/qgscurvepolygonv2.h +++ b/src/core/geometry/qgscurvepolygonv2.h @@ -99,7 +99,7 @@ class CORE_EXPORT QgsCurvePolygonV2: public QgsSurfaceV2 double vertexAngle( const QgsVertexId& vertex ) const override; virtual int vertexCount( int /*part*/ = 0, int ring = 0 ) const override; - virtual int ringCount( int /*part*/ = 0 ) const override { return ( mExteriorRing != 0 ) + mInteriorRings.size(); } + virtual int ringCount( int /*part*/ = 0 ) const override { return ( mExteriorRing != nullptr ) + mInteriorRings.size(); } virtual int partCount() const override { return ringCount() > 0 ? 1 : 0; } virtual QgsPointV2 vertexAt( const QgsVertexId& id ) const override; diff --git a/src/core/geometry/qgsgeometry.cpp b/src/core/geometry/qgsgeometry.cpp index 2d31e0b4b2d..9c96b3ea4e4 100644 --- a/src/core/geometry/qgsgeometry.cpp +++ b/src/core/geometry/qgsgeometry.cpp @@ -52,7 +52,7 @@ email : morb at ozemail dot com dot au struct QgsGeometryPrivate { - QgsGeometryPrivate(): ref( 1 ), geometry( 0 ), mWkb( 0 ), mWkbSize( 0 ), mGeos( 0 ) {} + QgsGeometryPrivate(): ref( 1 ), geometry( nullptr ), mWkb( nullptr ), mWkbSize( 0 ), mGeos( nullptr ) {} ~QgsGeometryPrivate() { delete geometry; delete[] mWkb; GEOSGeom_destroy_r( QgsGeos::getGEOSHandler(), mGeos ); } QAtomicInt ref; QgsAbstractGeometryV2* geometry; @@ -110,7 +110,7 @@ void QgsGeometry::detach( bool cloneGeom ) if ( d->ref > 1 ) { ( void )d->ref.deref(); - QgsAbstractGeometryV2* cGeom = 0; + QgsAbstractGeometryV2* cGeom = nullptr; if ( d->geometry && cloneGeom ) { @@ -125,12 +125,12 @@ void QgsGeometry::detach( bool cloneGeom ) void QgsGeometry::removeWkbGeos() { delete[] d->mWkb; - d->mWkb = 0; + d->mWkb = nullptr; d->mWkbSize = 0; if ( d->mGeos ) { GEOSGeom_destroy_r( QgsGeos::getGEOSHandler(), d->mGeos ); - d->mGeos = 0; + d->mGeos = nullptr; } } @@ -138,7 +138,7 @@ QgsAbstractGeometryV2* QgsGeometry::geometry() const { if ( !d ) { - return 0; + return nullptr; } return d->geometry; } @@ -149,7 +149,7 @@ void QgsGeometry::setGeometry( QgsAbstractGeometryV2* geometry ) if ( d->geometry ) { delete d->geometry; - d->geometry = 0; + d->geometry = nullptr; } removeWkbGeos(); @@ -166,7 +166,7 @@ QgsGeometry* QgsGeometry::fromWkt( const QString& wkt ) QgsAbstractGeometryV2* geom = QgsGeometryFactory::geomFromWkt( wkt ); if ( !geom ) { - return 0; + return nullptr; } return new QgsGeometry( geom ); } @@ -178,7 +178,7 @@ QgsGeometry* QgsGeometry::fromPoint( const QgsPoint& point ) { return new QgsGeometry( geom ); } - return 0; + return nullptr; } QgsGeometry* QgsGeometry::fromPolyline( const QgsPolyline& polyline ) @@ -188,7 +188,7 @@ QgsGeometry* QgsGeometry::fromPolyline( const QgsPolyline& polyline ) { return new QgsGeometry( geom ); } - return 0; + return nullptr; } QgsGeometry* QgsGeometry::fromPolygon( const QgsPolygon& polygon ) @@ -198,7 +198,7 @@ QgsGeometry* QgsGeometry::fromPolygon( const QgsPolygon& polygon ) { return new QgsGeometry( geom ); } - return 0; + return nullptr; } QgsGeometry* QgsGeometry::fromMultiPoint( const QgsMultiPoint& multipoint ) @@ -208,7 +208,7 @@ QgsGeometry* QgsGeometry::fromMultiPoint( const QgsMultiPoint& multipoint ) { return new QgsGeometry( geom ); } - return 0; + return nullptr; } QgsGeometry* QgsGeometry::fromMultiPolyline( const QgsMultiPolyline& multiline ) @@ -218,7 +218,7 @@ QgsGeometry* QgsGeometry::fromMultiPolyline( const QgsMultiPolyline& multiline ) { return new QgsGeometry( geom ); } - return 0; + return nullptr; } QgsGeometry* QgsGeometry::fromMultiPolygon( const QgsMultiPolygon& multipoly ) @@ -228,7 +228,7 @@ QgsGeometry* QgsGeometry::fromMultiPolygon( const QgsMultiPolygon& multipoly ) { return new QgsGeometry( geom ); } - return 0; + return nullptr; } QgsGeometry* QgsGeometry::fromRect( const QgsRectangle& rect ) @@ -270,7 +270,7 @@ const unsigned char *QgsGeometry::asWkb() const { if ( !d || !d->geometry ) { - return 0; + return nullptr; } if ( !d->mWkb ) @@ -298,7 +298,7 @@ const GEOSGeometry* QgsGeometry::asGeos( double precision ) const { if ( !d || !d->geometry ) { - return 0; + return nullptr; } if ( !d->mGeos ) @@ -453,7 +453,7 @@ bool QgsGeometry::deleteVertex( int atVertex ) detach( false ); delete d->geometry; removeWkbGeos(); - d->geometry = 0; + d->geometry = nullptr; return true; } @@ -591,7 +591,7 @@ int QgsGeometry::addRing( QgsCurveV2* ring ) int QgsGeometry::addPart( const QList &points, QGis::GeometryType geomType ) { - QgsAbstractGeometryV2* partGeom = 0; + QgsAbstractGeometryV2* partGeom = nullptr; if ( points.size() == 1 ) { partGeom = new QgsPointV2( points[0].x(), points[0].y() ); @@ -930,7 +930,7 @@ QgsGeometry* QgsGeometry::convertToType( QGis::GeometryType destType, bool destM return convertToPolygon( destMultipart ); default: - return 0; + return nullptr; } } @@ -1008,7 +1008,7 @@ QgsPolyline QgsGeometry::asPolyline() const } bool doSegmentation = ( d->geometry->geometryType() == "CompoundCurve" || d->geometry->geometryType() == "CircularString" ); - QgsLineStringV2* line = 0; + QgsLineStringV2* line = nullptr; if ( doSegmentation ) { QgsCurveV2* curve = dynamic_cast( d->geometry ); @@ -1048,7 +1048,7 @@ QgsPolygon QgsGeometry::asPolygon() const { bool doSegmentation = ( d->geometry->geometryType() == "CurvePolygon" ); - QgsPolygonV2* p = 0; + QgsPolygonV2* p = nullptr; if ( doSegmentation ) { QgsCurvePolygonV2* curvePoly = dynamic_cast( d->geometry ); @@ -1241,14 +1241,14 @@ QgsGeometry* QgsGeometry::buffer( double distance, int segments ) const { if ( !d || !d->geometry ) { - return 0; + return nullptr; } QgsGeos g( d->geometry ); QgsAbstractGeometryV2* geom = g.buffer( distance, segments ); if ( !geom ) { - return 0; + return nullptr; } return new QgsGeometry( geom ); } @@ -1257,14 +1257,14 @@ QgsGeometry* QgsGeometry::buffer( double distance, int segments, int endCapStyle { if ( !d || !d->geometry ) { - return 0; + return nullptr; } QgsGeos g( d->geometry ); QgsAbstractGeometryV2* geom = g.buffer( distance, segments, endCapStyle, joinStyle, mitreLimit ); if ( !geom ) { - return 0; + return nullptr; } return new QgsGeometry( geom ); } @@ -1273,14 +1273,14 @@ QgsGeometry* QgsGeometry::offsetCurve( double distance, int segments, int joinSt { if ( !d || !d->geometry ) { - return 0; + return nullptr; } QgsGeos geos( d->geometry ); QgsAbstractGeometryV2* offsetGeom = geos.offsetCurve( distance, segments, joinStyle, mitreLimit ); if ( !offsetGeom ) { - return 0; + return nullptr; } return new QgsGeometry( offsetGeom ); } @@ -1289,14 +1289,14 @@ QgsGeometry* QgsGeometry::simplify( double tolerance ) const { if ( !d || !d->geometry ) { - return 0; + return nullptr; } QgsGeos geos( d->geometry ); QgsAbstractGeometryV2* simplifiedGeom = geos.simplify( tolerance ); if ( !simplifiedGeom ) { - return 0; + return nullptr; } return new QgsGeometry( simplifiedGeom ); } @@ -1305,7 +1305,7 @@ QgsGeometry* QgsGeometry::centroid() const { if ( !d || !d->geometry ) { - return 0; + return nullptr; } QgsGeos geos( d->geometry ); @@ -1313,7 +1313,7 @@ QgsGeometry* QgsGeometry::centroid() const bool ok = geos.centroid( centroid ); if ( !ok ) { - return 0; + return nullptr; } return new QgsGeometry( centroid.clone() ); } @@ -1322,7 +1322,7 @@ QgsGeometry* QgsGeometry::pointOnSurface() const { if ( !d || !d->geometry ) { - return 0; + return nullptr; } QgsGeos geos( d->geometry ); @@ -1330,7 +1330,7 @@ QgsGeometry* QgsGeometry::pointOnSurface() const bool ok = geos.pointOnSurface( pt ); if ( !ok ) { - return 0; + return nullptr; } return new QgsGeometry( pt.clone() ); } @@ -1339,13 +1339,13 @@ QgsGeometry* QgsGeometry::convexHull() const { if ( !d || !d->geometry ) { - return 0; + return nullptr; } QgsGeos geos( d->geometry ); QgsAbstractGeometryV2* cHull = geos.convexHull(); if ( !cHull ) { - return 0; + return nullptr; } return new QgsGeometry( cHull ); } @@ -1354,13 +1354,13 @@ QgsGeometry* QgsGeometry::interpolate( double distance ) const { if ( !d || !d->geometry ) { - return 0; + return nullptr; } QgsGeos geos( d->geometry ); QgsAbstractGeometryV2* result = geos.interpolate( distance ); if ( !result ) { - return 0; + return nullptr; } return new QgsGeometry( result ); } @@ -1369,7 +1369,7 @@ QgsGeometry* QgsGeometry::intersection( const QgsGeometry* geometry ) const { if ( !d || !d->geometry || !geometry->d || !geometry->d->geometry ) { - return 0; + return nullptr; } QgsGeos geos( d->geometry ); @@ -1382,7 +1382,7 @@ QgsGeometry* QgsGeometry::combine( const QgsGeometry* geometry ) const { if ( !d || !d->geometry || !geometry->d || !geometry->d->geometry ) { - return 0; + return nullptr; } QgsGeos geos( d->geometry ); @@ -1390,7 +1390,7 @@ QgsGeometry* QgsGeometry::combine( const QgsGeometry* geometry ) const QgsAbstractGeometryV2* resultGeom = geos.combine( *( geometry->d->geometry ) ); if ( !resultGeom ) { - return 0; + return nullptr; } return new QgsGeometry( resultGeom ); } @@ -1399,7 +1399,7 @@ QgsGeometry* QgsGeometry::difference( const QgsGeometry* geometry ) const { if ( !d || !d->geometry || !geometry->d || !geometry->d->geometry ) { - return 0; + return nullptr; } QgsGeos geos( d->geometry ); @@ -1407,7 +1407,7 @@ QgsGeometry* QgsGeometry::difference( const QgsGeometry* geometry ) const QgsAbstractGeometryV2* resultGeom = geos.difference( *( geometry->d->geometry ) ); if ( !resultGeom ) { - return 0; + return nullptr; } return new QgsGeometry( resultGeom ); } @@ -1416,7 +1416,7 @@ QgsGeometry* QgsGeometry::symDifference( const QgsGeometry* geometry ) const { if ( !d || !d->geometry || !geometry->d || !geometry->d->geometry ) { - return 0; + return nullptr; } QgsGeos geos( d->geometry ); @@ -1424,7 +1424,7 @@ QgsGeometry* QgsGeometry::symDifference( const QgsGeometry* geometry ) const QgsAbstractGeometryV2* resultGeom = geos.symDifference( *( geometry->d->geometry ) ); if ( !resultGeom ) { - return 0; + return nullptr; } return new QgsGeometry( resultGeom ); } @@ -1511,7 +1511,7 @@ bool QgsGeometry::deletePart( int partNum ) if ( !isMultipart() && partNum < 1 ) { - setGeometry( 0 ); + setGeometry( nullptr ); return true; } @@ -1578,7 +1578,7 @@ bool QgsGeometry::isGeosEmpty() const QgsGeometry *QgsGeometry::unaryUnion( const QList &geometryList ) { - QgsGeos geos( 0 ); + QgsGeos geos( nullptr ); QList geomV2List; QList::const_iterator it = geometryList.constBegin(); @@ -2007,14 +2007,14 @@ QgsGeometry* QgsGeometry::convertToPoint( bool destMultipart ) const return fromPoint( multiPoint[0] ); } } - return 0; + return nullptr; } case QGis::Line: { // only possible if destination is multipart if ( !destMultipart ) - return 0; + return nullptr; // input geometry is multipart if ( isMultipart() ) @@ -2033,14 +2033,14 @@ QgsGeometry* QgsGeometry::convertToPoint( bool destMultipart ) const if ( !line.isEmpty() ) return fromMultiPoint( line ); } - return 0; + return nullptr; } case QGis::Polygon: { // can only transform if destination is multipoint if ( !destMultipart ) - return 0; + return nullptr; // input geometry is multipart: make a multipoint from multipolygon if ( isMultipart() ) @@ -2066,7 +2066,7 @@ QgsGeometry* QgsGeometry::convertToPoint( bool destMultipart ) const } default: - return 0; + return nullptr; } } @@ -2077,11 +2077,11 @@ QgsGeometry* QgsGeometry::convertToLine( bool destMultipart ) const case QGis::Point: { if ( !isMultipart() ) - return 0; + return nullptr; QgsMultiPoint multiPoint = asMultiPoint(); if ( multiPoint.count() < 2 ) - return 0; + return nullptr; if ( destMultipart ) return fromMultiPolyline( QgsMultiPolyline() << multiPoint ); @@ -2113,7 +2113,7 @@ QgsGeometry* QgsGeometry::convertToLine( bool destMultipart ) const if ( multiLine.count() == 1 ) return fromPolyline( multiLine[0] ); } - return 0; + return nullptr; } case QGis::Polygon: @@ -2169,11 +2169,11 @@ QgsGeometry* QgsGeometry::convertToLine( bool destMultipart ) const } } } - return 0; + return nullptr; } default: - return 0; + return nullptr; } } @@ -2184,11 +2184,11 @@ QgsGeometry* QgsGeometry::convertToPolygon( bool destMultipart ) const case QGis::Point: { if ( !isMultipart() ) - return 0; + return nullptr; QgsMultiPoint multiPoint = asMultiPoint(); if ( multiPoint.count() < 3 ) - return 0; + return nullptr; if ( multiPoint.last() != multiPoint.first() ) multiPoint << multiPoint.first(); @@ -2211,9 +2211,9 @@ QgsGeometry* QgsGeometry::convertToPolygon( bool destMultipart ) const { // do not create polygon for a 1 segment line if (( *multiLineIt ).count() < 3 ) - return 0; + return nullptr; if (( *multiLineIt ).count() == 3 && ( *multiLineIt ).first() == ( *multiLineIt ).last() ) - return 0; + return nullptr; // add closing node if (( *multiLineIt ).first() != ( *multiLineIt ).last() ) @@ -2241,9 +2241,9 @@ QgsGeometry* QgsGeometry::convertToPolygon( bool destMultipart ) const // do not create polygon for a 1 segment line if ( line.count() < 3 ) - return 0; + return nullptr; if ( line.count() == 3 && line.first() == line.last() ) - return 0; + return nullptr; // add closing node if ( line.first() != line.last() ) @@ -2259,7 +2259,7 @@ QgsGeometry* QgsGeometry::convertToPolygon( bool destMultipart ) const return fromPolygon( QgsPolygon() << line ); } } - return 0; + return nullptr; } case QGis::Polygon: @@ -2288,11 +2288,11 @@ QgsGeometry* QgsGeometry::convertToPolygon( bool destMultipart ) const return fromPolygon( multiPolygon[0] ); } } - return 0; + return nullptr; } default: - return 0; + return nullptr; } } @@ -2314,7 +2314,7 @@ QDataStream& operator>>( QDataStream& in, QgsGeometry& geometry ) in >> byteArray; if ( byteArray.isEmpty() ) { - geometry.setGeometry( 0 ); + geometry.setGeometry( nullptr ); return in; } diff --git a/src/core/geometry/qgsgeometry.h b/src/core/geometry/qgsgeometry.h index 29db6c7ea62..0d05a989efb 100644 --- a/src/core/geometry/qgsgeometry.h +++ b/src/core/geometry/qgsgeometry.h @@ -300,7 +300,7 @@ class CORE_EXPORT QgsGeometry * @param epsilon epsilon for segment snapping (added in 1.8) * @return The squared cartesian distance is also returned in sqrDist, negative number on error */ - double closestSegmentWithContext( const QgsPoint& point, QgsPoint& minDistPoint, int& afterVertex, double* leftOf = 0, double epsilon = DEFAULT_SEGMENT_EPSILON ) const; + double closestSegmentWithContext( const QgsPoint& point, QgsPoint& minDistPoint, int& afterVertex, double* leftOf = nullptr, double epsilon = DEFAULT_SEGMENT_EPSILON ) const; /** Adds a new ring to this geometry. This makes only sense for polygon and multipolygons. @return 0 in case of success (ring added), 1 problem with geometry type, 2 ring not closed, diff --git a/src/core/geometry/qgsgeometrycollectionv2.cpp b/src/core/geometry/qgsgeometrycollectionv2.cpp index 6ea820b125e..5566297dd7e 100644 --- a/src/core/geometry/qgsgeometrycollectionv2.cpp +++ b/src/core/geometry/qgsgeometrycollectionv2.cpp @@ -84,7 +84,7 @@ const QgsAbstractGeometryV2* QgsGeometryCollectionV2::geometryN( int n ) const { if ( n >= mGeometries.size() ) { - return 0; + return nullptr; } return mGeometries.at( n ); } @@ -93,7 +93,7 @@ QgsAbstractGeometryV2* QgsGeometryCollectionV2::geometryN( int n ) { if ( n < 0 || n >= mGeometries.size() ) { - return 0; + return nullptr; } return mGeometries.at( n ); } diff --git a/src/core/geometry/qgsgeometryeditutils.cpp b/src/core/geometry/qgsgeometryeditutils.cpp index 14cd7790a54..4175e32a040 100644 --- a/src/core/geometry/qgsgeometryeditutils.cpp +++ b/src/core/geometry/qgsgeometryeditutils.cpp @@ -120,7 +120,7 @@ int QgsGeometryEditUtils::addPart( QgsAbstractGeometryV2* geom, QgsAbstractGeome QgsCurveV2* curve = dynamic_cast( part ); if ( curve && curve->isClosed() && curve->numPoints() >= 4 ) { - QgsCurvePolygonV2 *poly = 0; + QgsCurvePolygonV2 *poly = nullptr; if ( curve->geometryType() == "LineString" ) { poly = new QgsPolygonV2(); @@ -221,7 +221,7 @@ QgsAbstractGeometryV2* QgsGeometryEditUtils::avoidIntersections( const QgsAbstra QScopedPointer geomEngine( QgsGeometry::createGeometryEngine( &geom ) ); if ( geomEngine.isNull() ) { - return 0; + return nullptr; } QgsWKBTypes::Type geomTypeBeforeModification = geom.wkbType(); @@ -229,19 +229,19 @@ QgsAbstractGeometryV2* QgsGeometryEditUtils::avoidIntersections( const QgsAbstra //check if g has polygon type if ( QgsWKBTypes::geometryType( geomTypeBeforeModification ) != QgsWKBTypes::PolygonGeometry ) { - return 0; + return nullptr; } //read avoid intersections list from project properties bool listReadOk; QStringList avoidIntersectionsList = QgsProject::instance()->readListEntry( "Digitizing", "/AvoidIntersectionsList", QStringList(), &listReadOk ); if ( !listReadOk ) - return 0; //no intersections stored in project does not mean error + return nullptr; //no intersections stored in project does not mean error QList< const QgsAbstractGeometryV2* > nearGeometries; //go through list, convert each layer to vector layer and call QgsVectorLayer::removePolygonIntersections for each - QgsVectorLayer* currentLayer = 0; + QgsVectorLayer* currentLayer = nullptr; QStringList::const_iterator aIt = avoidIntersectionsList.constBegin(); for ( ; aIt != avoidIntersectionsList.constEnd(); ++aIt ) { @@ -272,7 +272,7 @@ QgsAbstractGeometryV2* QgsGeometryEditUtils::avoidIntersections( const QgsAbstra if ( nearGeometries.isEmpty() ) { - return 0; + return nullptr; } @@ -280,7 +280,7 @@ QgsAbstractGeometryV2* QgsGeometryEditUtils::avoidIntersections( const QgsAbstra qDeleteAll( nearGeometries ); if ( !combinedGeometries ) { - return 0; + return nullptr; } QgsAbstractGeometryV2* diffGeom = geomEngine.data()->difference( *combinedGeometries ); diff --git a/src/core/geometry/qgsgeometryengine.h b/src/core/geometry/qgsgeometryengine.h index 53d15c54ab2..c866352f9a6 100644 --- a/src/core/geometry/qgsgeometryengine.h +++ b/src/core/geometry/qgsgeometryengine.h @@ -38,27 +38,27 @@ class CORE_EXPORT QgsGeometryEngine virtual void geometryChanged() = 0; virtual void prepareGeometry() = 0; - virtual QgsAbstractGeometryV2* intersection( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0; - virtual QgsAbstractGeometryV2* difference( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0; - virtual QgsAbstractGeometryV2* combine( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0; - virtual QgsAbstractGeometryV2* combine( const QList< const QgsAbstractGeometryV2* >&, QString* errorMsg = 0 ) const = 0; - virtual QgsAbstractGeometryV2* symDifference( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0; - virtual QgsAbstractGeometryV2* buffer( double distance, int segments, QString* errorMsg = 0 ) const = 0; - virtual QgsAbstractGeometryV2* buffer( double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit, QString* errorMsg = 0 ) const = 0; - virtual QgsAbstractGeometryV2* simplify( double tolerance, QString* errorMsg = 0 ) const = 0; - virtual QgsAbstractGeometryV2* interpolate( double distance, QString* errorMsg = 0 ) const = 0; - virtual QgsAbstractGeometryV2* envelope( QString* errorMsg = 0 ) const = 0; - virtual bool centroid( QgsPointV2& pt, QString* errorMsg = 0 ) const = 0; - virtual bool pointOnSurface( QgsPointV2& pt, QString* errorMsg = 0 ) const = 0; - virtual QgsAbstractGeometryV2* convexHull( QString* errorMsg = 0 ) const = 0; - virtual double distance( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0; - virtual bool intersects( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0; - virtual bool touches( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0; - virtual bool crosses( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0; - virtual bool within( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0; - virtual bool overlaps( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0; - virtual bool contains( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0; - virtual bool disjoint( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0; + virtual QgsAbstractGeometryV2* intersection( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0; + virtual QgsAbstractGeometryV2* difference( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0; + virtual QgsAbstractGeometryV2* combine( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0; + virtual QgsAbstractGeometryV2* combine( const QList< const QgsAbstractGeometryV2* >&, QString* errorMsg = nullptr ) const = 0; + virtual QgsAbstractGeometryV2* symDifference( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0; + virtual QgsAbstractGeometryV2* buffer( double distance, int segments, QString* errorMsg = nullptr ) const = 0; + virtual QgsAbstractGeometryV2* buffer( double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit, QString* errorMsg = nullptr ) const = 0; + virtual QgsAbstractGeometryV2* simplify( double tolerance, QString* errorMsg = nullptr ) const = 0; + virtual QgsAbstractGeometryV2* interpolate( double distance, QString* errorMsg = nullptr ) const = 0; + virtual QgsAbstractGeometryV2* envelope( QString* errorMsg = nullptr ) const = 0; + virtual bool centroid( QgsPointV2& pt, QString* errorMsg = nullptr ) const = 0; + virtual bool pointOnSurface( QgsPointV2& pt, QString* errorMsg = nullptr ) const = 0; + virtual QgsAbstractGeometryV2* convexHull( QString* errorMsg = nullptr ) const = 0; + virtual double distance( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0; + virtual bool intersects( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0; + virtual bool touches( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0; + virtual bool crosses( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0; + virtual bool within( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0; + virtual bool overlaps( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0; + virtual bool contains( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0; + virtual bool disjoint( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0; /** Returns the Dimensional Extended 9 Intersection Model (DE-9IM) representation of the * relationship between the geometries. @@ -67,7 +67,7 @@ class CORE_EXPORT QgsGeometryEngine * @returns DE-9IM string for relationship, or an empty string if an error occurred * @note added in QGIS 2.12 */ - virtual QString relate( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0; + virtual QString relate( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0; /** Tests whether two geometries are related by a specified Dimensional Extended 9 Intersection Model (DE-9IM) * pattern. @@ -77,18 +77,18 @@ class CORE_EXPORT QgsGeometryEngine * @returns true if geometry relationship matches with pattern * @note added in QGIS 2.14 */ - virtual bool relatePattern( const QgsAbstractGeometryV2& geom, const QString& pattern, QString* errorMsg = 0 ) const = 0; + virtual bool relatePattern( const QgsAbstractGeometryV2& geom, const QString& pattern, QString* errorMsg = nullptr ) const = 0; - virtual double area( QString* errorMsg = 0 ) const = 0; - virtual double length( QString* errorMsg = 0 ) const = 0; - virtual bool isValid( QString* errorMsg = 0 ) const = 0; - virtual bool isEqual( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const = 0; + virtual double area( QString* errorMsg = nullptr ) const = 0; + virtual double length( QString* errorMsg = nullptr ) const = 0; + virtual bool isValid( QString* errorMsg = nullptr ) const = 0; + virtual bool isEqual( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const = 0; virtual bool isEmpty( QString* errorMsg ) const = 0; virtual int splitGeometry( const QgsLineStringV2& splitLine, QList& newGeometries, bool topological, - QList &topologyTestPoints, QString* errorMsg = 0 ) const + QList &topologyTestPoints, QString* errorMsg = nullptr ) const { Q_UNUSED( splitLine ); Q_UNUSED( newGeometries ); @@ -98,7 +98,7 @@ class CORE_EXPORT QgsGeometryEngine return 2; } - virtual QgsAbstractGeometryV2* offsetCurve( double distance, int segments, int joinStyle, double mitreLimit, QString* errorMsg = 0 ) const = 0; + virtual QgsAbstractGeometryV2* offsetCurve( double distance, int segments, int joinStyle, double mitreLimit, QString* errorMsg = nullptr ) const = 0; protected: const QgsAbstractGeometryV2* mGeometry; diff --git a/src/core/geometry/qgsgeometryfactory.cpp b/src/core/geometry/qgsgeometryfactory.cpp index 1abdfb6aaca..89f663681db 100644 --- a/src/core/geometry/qgsgeometryfactory.cpp +++ b/src/core/geometry/qgsgeometryfactory.cpp @@ -33,13 +33,13 @@ QgsAbstractGeometryV2* QgsGeometryFactory::geomFromWkb( const unsigned char* wkb { if ( !wkb ) { - return 0; + return nullptr; } //find out type (bytes 2-5) int type; memcpy( &type, wkb + 1, sizeof( int ) ); - QgsAbstractGeometryV2* geom = 0; + QgsAbstractGeometryV2* geom = nullptr; geom = geomFromWkbType( QgsWKBTypes::Type( type ) ); @@ -52,7 +52,7 @@ QgsAbstractGeometryV2* QgsGeometryFactory::geomFromWkb( const unsigned char* wkb QgsAbstractGeometryV2* QgsGeometryFactory::geomFromWkt( const QString& text ) { - QgsAbstractGeometryV2* geom = 0; + QgsAbstractGeometryV2* geom = nullptr; if ( text.startsWith( "Point", Qt::CaseInsensitive ) ) { geom = new QgsPointV2(); @@ -106,7 +106,7 @@ QgsAbstractGeometryV2* QgsGeometryFactory::geomFromWkt( const QString& text ) { if ( !geom->fromWkt( text ) ) { - delete geom; return 0; + delete geom; return nullptr; } } return geom; @@ -236,6 +236,6 @@ QgsAbstractGeometryV2* QgsGeometryFactory::geomFromWkbType( QgsWKBTypes::Type t case QgsWKBTypes::GeometryCollection: return new QgsGeometryCollectionV2(); default: - return 0; + return nullptr; } } diff --git a/src/core/geometry/qgsgeos.cpp b/src/core/geometry/qgsgeos.cpp index bc63905f58f..fb2a95d057d 100644 --- a/src/core/geometry/qgsgeos.cpp +++ b/src/core/geometry/qgsgeos.cpp @@ -110,10 +110,10 @@ static GEOSInit geosinit; class GEOSGeomScopedPtr { public: - explicit GEOSGeomScopedPtr( GEOSGeometry* geom = 0 ) : mGeom( geom ) {} + explicit GEOSGeomScopedPtr( GEOSGeometry* geom = nullptr ) : mGeom( geom ) {} ~GEOSGeomScopedPtr() { GEOSGeom_destroy_r( geosinit.ctxt, mGeom ); } GEOSGeometry* get() const { return mGeom; } - operator bool() const { return mGeom != 0; } + operator bool() const { return mGeom != nullptr; } void reset( GEOSGeometry* geom ) { GEOSGeom_destroy_r( geosinit.ctxt, mGeom ); @@ -125,7 +125,7 @@ class GEOSGeomScopedPtr }; QgsGeos::QgsGeos( const QgsAbstractGeometryV2* geometry, double precision ) - : QgsGeometryEngine( geometry ), mGeos( 0 ), mGeosPrepared( 0 ), mPrecision( precision ) + : QgsGeometryEngine( geometry ), mGeos( nullptr ), mGeosPrepared( nullptr ), mPrecision( precision ) { cacheGeos(); } @@ -133,24 +133,24 @@ QgsGeos::QgsGeos( const QgsAbstractGeometryV2* geometry, double precision ) QgsGeos::~QgsGeos() { GEOSGeom_destroy_r( geosinit.ctxt, mGeos ); - mGeos = 0; + mGeos = nullptr; GEOSPreparedGeom_destroy_r( geosinit.ctxt, mGeosPrepared ); - mGeosPrepared = 0; + mGeosPrepared = nullptr; } void QgsGeos::geometryChanged() { GEOSGeom_destroy_r( geosinit.ctxt, mGeos ); - mGeos = 0; + mGeos = nullptr; GEOSPreparedGeom_destroy_r( geosinit.ctxt, mGeosPrepared ); - mGeosPrepared = 0; + mGeosPrepared = nullptr; cacheGeos(); } void QgsGeos::prepareGeometry() { GEOSPreparedGeom_destroy_r( geosinit.ctxt, mGeosPrepared ); - mGeosPrepared = 0; + mGeosPrepared = nullptr; if ( mGeos ) { mGeosPrepared = GEOSPrepare_r( geosinit.ctxt, mGeos ); @@ -192,14 +192,14 @@ QgsAbstractGeometryV2* QgsGeos::combine( const QList< const QgsAbstractGeometryV geosGeometries[i] = asGeos( geomList.at( i ), mPrecision ); } - GEOSGeometry* geomUnion = 0; + GEOSGeometry* geomUnion = nullptr; try { GEOSGeometry* geomCollection = createGeosCollection( GEOS_GEOMETRYCOLLECTION, geosGeometries ); geomUnion = GEOSUnaryUnion_r( geosinit.ctxt, geomCollection ); GEOSGeom_destroy_r( geosinit.ctxt, geomCollection ); } - CATCH_GEOS_WITH_ERRMSG( 0 ) + CATCH_GEOS_WITH_ERRMSG( nullptr ) QgsAbstractGeometryV2* result = fromGeos( geomUnion ); GEOSGeom_destroy_r( geosinit.ctxt, geomUnion ); @@ -395,7 +395,7 @@ int QgsGeos::splitGeometry( const QgsLineStringV2& splitLine, return 1; newGeometries.clear(); - GEOSGeometry* splitLineGeos = 0; + GEOSGeometry* splitLineGeos = nullptr; try { @@ -512,7 +512,7 @@ GEOSGeometry* QgsGeos::linePointDifference( GEOSGeometry* GEOSsplitPoint ) const { int type = GEOSGeomTypeId_r( geosinit.ctxt, mGeos ); - QgsMultiCurveV2* multiCurve = 0; + QgsMultiCurveV2* multiCurve = nullptr; if ( type == GEOS_MULTILINESTRING ) { multiCurve = dynamic_cast( mGeometry->clone() ); @@ -524,12 +524,12 @@ GEOSGeometry* QgsGeos::linePointDifference( GEOSGeometry* GEOSsplitPoint ) const } else { - return 0; + return nullptr; } if ( !multiCurve ) { - return 0; + return nullptr; } @@ -537,7 +537,7 @@ GEOSGeometry* QgsGeos::linePointDifference( GEOSGeometry* GEOSsplitPoint ) const QgsPointV2* splitPoint = dynamic_cast( splitGeom ); if ( !splitPoint ) { - delete splitGeom; return 0; + delete splitGeom; return nullptr; } QgsMultiCurveV2 lines; @@ -662,7 +662,7 @@ int QgsGeos::splitPolygonGeometry( GEOSGeometry* splitLine, QList testedGeometries; - GEOSGeometry *intersectGeometry = 0; + GEOSGeometry *intersectGeometry = nullptr; //ratio intersect geometry / geometry. This should be close to 1 //if the polygon belongs to the input geometry @@ -731,9 +731,9 @@ int QgsGeos::splitPolygonGeometry( GEOSGeometry* splitLine, QList& splitResult GEOSGeometry* QgsGeos::createGeosCollection( int typeId, const QVector& geoms ) { - int nNullGeoms = geoms.count( 0 ); + int nNullGeoms = geoms.count( nullptr ); int nNotNullGeoms = geoms.size() - nNullGeoms; GEOSGeometry **geomarr = new GEOSGeometry*[ nNotNullGeoms ]; if ( !geomarr ) { - return 0; + return nullptr; } int i = 0; @@ -834,7 +834,7 @@ GEOSGeometry* QgsGeos::createGeosCollection( int typeId, const QVector( geom ); if ( !c ) { - return 0; + return nullptr; } QVector< GEOSGeometry* > geomVector( c->numGeometries() ); @@ -1102,20 +1102,20 @@ GEOSGeometry* QgsGeos::asGeos( const QgsAbstractGeometryV2* geom, double precisi return createGeosCollection( geosType, geomVector ); } - return 0; + return nullptr; } QgsAbstractGeometryV2* QgsGeos::overlay( const QgsAbstractGeometryV2& geom, Overlay op, QString* errorMsg ) const { if ( !mGeos ) { - return 0; + return nullptr; } GEOSGeomScopedPtr geosGeom( asGeos( &geom, mPrecision ) ); if ( !geosGeom ) { - return 0; + return nullptr; } try @@ -1150,7 +1150,7 @@ QgsAbstractGeometryV2* QgsGeos::overlay( const QgsAbstractGeometryV2& geom, Over opGeom.reset( GEOSSymDifference_r( geosinit.ctxt, mGeos, geosGeom.get() ) ); break; default: //unknown op - return 0; + return nullptr; } QgsAbstractGeometryV2* opResult = fromGeos( opGeom.get() ); return opResult; @@ -1161,7 +1161,7 @@ QgsAbstractGeometryV2* QgsGeos::overlay( const QgsAbstractGeometryV2& geom, Over { *errorMsg = e.what(); } - return 0; + return nullptr; } } @@ -1255,7 +1255,7 @@ QgsAbstractGeometryV2* QgsGeos::buffer( double distance, int segments, QString* { if ( !mGeos ) { - return 0; + return nullptr; } GEOSGeomScopedPtr geos; @@ -1263,7 +1263,7 @@ QgsAbstractGeometryV2* QgsGeos::buffer( double distance, int segments, QString* { geos.reset( GEOSBuffer_r( geosinit.ctxt, mGeos, distance, segments ) ); } - CATCH_GEOS_WITH_ERRMSG( 0 ); + CATCH_GEOS_WITH_ERRMSG( nullptr ); return fromGeos( geos.get() ); } @@ -1271,7 +1271,7 @@ QgsAbstractGeometryV2 *QgsGeos::buffer( double distance, int segments, int endCa { if ( !mGeos ) { - return 0; + return nullptr; } #if defined(GEOS_VERSION_MAJOR) && defined(GEOS_VERSION_MINOR) && \ @@ -1282,7 +1282,7 @@ QgsAbstractGeometryV2 *QgsGeos::buffer( double distance, int segments, int endCa { geos.reset( GEOSBufferWithStyle_r( geosinit.ctxt, mGeos, distance, segments, endCapStyle, joinStyle, mitreLimit ) ); } - CATCH_GEOS_WITH_ERRMSG( 0 ); + CATCH_GEOS_WITH_ERRMSG( nullptr ); return fromGeos( geos.get() ); #else return 0; @@ -1293,14 +1293,14 @@ QgsAbstractGeometryV2* QgsGeos::simplify( double tolerance, QString* errorMsg ) { if ( !mGeos ) { - return 0; + return nullptr; } GEOSGeomScopedPtr geos; try { geos.reset( GEOSTopologyPreserveSimplify_r( geosinit.ctxt, mGeos, tolerance ) ); } - CATCH_GEOS_WITH_ERRMSG( 0 ); + CATCH_GEOS_WITH_ERRMSG( nullptr ); return fromGeos( geos.get() ); } @@ -1308,14 +1308,14 @@ QgsAbstractGeometryV2* QgsGeos::interpolate( double distance, QString* errorMsg { if ( !mGeos ) { - return 0; + return nullptr; } GEOSGeomScopedPtr geos; try { geos.reset( GEOSInterpolate_r( geosinit.ctxt, mGeos, distance ) ); } - CATCH_GEOS_WITH_ERRMSG( 0 ); + CATCH_GEOS_WITH_ERRMSG( nullptr ); return fromGeos( geos.get() ); } @@ -1349,14 +1349,14 @@ QgsAbstractGeometryV2* QgsGeos::envelope( QString* errorMsg ) const { if ( !mGeos ) { - return 0; + return nullptr; } GEOSGeomScopedPtr geos; try { geos.reset( GEOSEnvelope_r( geosinit.ctxt, mGeos ) ); } - CATCH_GEOS_WITH_ERRMSG( 0 ); + CATCH_GEOS_WITH_ERRMSG( nullptr ); return fromGeos( geos.get() ); } @@ -1393,7 +1393,7 @@ QgsAbstractGeometryV2* QgsGeos::convexHull( QString* errorMsg ) const { if ( !mGeos ) { - return 0; + return nullptr; } try @@ -1403,7 +1403,7 @@ QgsAbstractGeometryV2* QgsGeos::convexHull( QString* errorMsg ) const GEOSGeom_destroy_r( geosinit.ctxt, cHull ); return cHullGeom; } - CATCH_GEOS_WITH_ERRMSG( 0 ); + CATCH_GEOS_WITH_ERRMSG( nullptr ); } bool QgsGeos::isValid( QString* errorMsg ) const @@ -1467,7 +1467,7 @@ GEOSCoordSequence* QgsGeos::createCoordinateSequence( const QgsCurveV2* curve, d if ( !line ) { - return 0; + return nullptr; } bool hasZ = line->is3D(); @@ -1483,14 +1483,14 @@ GEOSCoordSequence* QgsGeos::createCoordinateSequence( const QgsCurveV2* curve, d } int numPoints = line->numPoints(); - GEOSCoordSequence* coordSeq = 0; + GEOSCoordSequence* coordSeq = nullptr; try { coordSeq = GEOSCoordSeq_create_r( geosinit.ctxt, numPoints, coordDims ); if ( !coordSeq ) { QgsMessageLog::logMessage( QObject::tr( "Could not create coordinate sequence for %1 points in %2 dimensions" ).arg( numPoints ).arg( coordDims ), QObject::tr( "GEOS" ) ); - return 0; + return nullptr; } if ( precision > 0. ) { @@ -1527,7 +1527,7 @@ GEOSCoordSequence* QgsGeos::createCoordinateSequence( const QgsCurveV2* curve, d } } } - CATCH_GEOS( 0 ) + CATCH_GEOS( nullptr ) if ( segmentize ) { @@ -1540,9 +1540,9 @@ GEOSGeometry* QgsGeos::createGeosPoint( const QgsAbstractGeometryV2* point, int { const QgsPointV2* pt = dynamic_cast( point ); if ( !pt ) - return 0; + return nullptr; - GEOSGeometry* geosPoint = 0; + GEOSGeometry* geosPoint = nullptr; try { @@ -1550,7 +1550,7 @@ GEOSGeometry* QgsGeos::createGeosPoint( const QgsAbstractGeometryV2* point, int if ( !coordSeq ) { QgsMessageLog::logMessage( QObject::tr( "Could not create coordinate sequence for point with %1 dimensions" ).arg( coordDims ), QObject::tr( "GEOS" ) ); - return 0; + return nullptr; } if ( precision > 0. ) { @@ -1578,7 +1578,7 @@ GEOSGeometry* QgsGeos::createGeosPoint( const QgsAbstractGeometryV2* point, int #endif geosPoint = GEOSGeom_createPoint_r( geosinit.ctxt, coordSeq ); } - CATCH_GEOS( 0 ) + CATCH_GEOS( nullptr ) return geosPoint; } @@ -1586,18 +1586,18 @@ GEOSGeometry* QgsGeos::createGeosLinestring( const QgsAbstractGeometryV2* curve { const QgsCurveV2* c = dynamic_cast( curve ); if ( !c ) - return 0; + return nullptr; GEOSCoordSequence* coordSeq = createCoordinateSequence( c, precision ); if ( !coordSeq ) - return 0; + return nullptr; - GEOSGeometry* geosGeom = 0; + GEOSGeometry* geosGeom = nullptr; try { geosGeom = GEOSGeom_createLineString_r( geosinit.ctxt, coordSeq ); } - CATCH_GEOS( 0 ) + CATCH_GEOS( nullptr ) return geosGeom; } @@ -1605,22 +1605,22 @@ GEOSGeometry* QgsGeos::createGeosPolygon( const QgsAbstractGeometryV2* poly , do { const QgsCurvePolygonV2* polygon = dynamic_cast( poly ); if ( !polygon ) - return 0; + return nullptr; const QgsCurveV2* exteriorRing = polygon->exteriorRing(); if ( !exteriorRing ) { - return 0; + return nullptr; } - GEOSGeometry* geosPolygon = 0; + GEOSGeometry* geosPolygon = nullptr; try { GEOSGeometry* exteriorRingGeos = GEOSGeom_createLinearRing_r( geosinit.ctxt, createCoordinateSequence( exteriorRing, precision ) ); int nHoles = polygon->numInteriorRings(); - GEOSGeometry** holes = 0; + GEOSGeometry** holes = nullptr; if ( nHoles > 0 ) { holes = new GEOSGeometry*[ nHoles ]; @@ -1634,7 +1634,7 @@ GEOSGeometry* QgsGeos::createGeosPolygon( const QgsAbstractGeometryV2* poly , do geosPolygon = GEOSGeom_createPolygon_r( geosinit.ctxt, exteriorRingGeos, holes, nHoles ); delete[] holes; } - CATCH_GEOS( 0 ) + CATCH_GEOS( nullptr ) return geosPolygon; } @@ -1642,14 +1642,14 @@ GEOSGeometry* QgsGeos::createGeosPolygon( const QgsAbstractGeometryV2* poly , do QgsAbstractGeometryV2* QgsGeos::offsetCurve( double distance, int segments, int joinStyle, double mitreLimit, QString* errorMsg ) const { if ( !mGeos ) - return 0; + return nullptr; - GEOSGeometry* offset = 0; + GEOSGeometry* offset = nullptr; try { offset = GEOSOffsetCurve_r( geosinit.ctxt, mGeos, distance, segments, joinStyle, mitreLimit ); } - CATCH_GEOS_WITH_ERRMSG( 0 ) + CATCH_GEOS_WITH_ERRMSG( nullptr ) QgsAbstractGeometryV2* offsetGeom = fromGeos( offset ); GEOSGeom_destroy_r( geosinit.ctxt, offset ); return offsetGeom; @@ -1660,7 +1660,7 @@ QgsAbstractGeometryV2* QgsGeos::reshapeGeometry( const QgsLineStringV2& reshapeW if ( !mGeos || reshapeWithLine.numPoints() < 2 || mGeometry->dimension() == 0 ) { if ( errorCode ) { *errorCode = 1; } - return 0; + return nullptr; } GEOSGeometry* reshapeLineGeos = createGeosLinestring( &reshapeWithLine, mPrecision ); @@ -1671,7 +1671,7 @@ QgsAbstractGeometryV2* QgsGeos::reshapeGeometry( const QgsLineStringV2& reshapeW { if ( errorCode ) { *errorCode = 1; } GEOSGeom_destroy_r( geosinit.ctxt, reshapeLineGeos ); - return 0; + return nullptr; } bool isMultiGeom = false; @@ -1706,7 +1706,7 @@ QgsAbstractGeometryV2* QgsGeos::reshapeGeometry( const QgsLineStringV2& reshapeW //call reshape for each geometry part and replace mGeos with new geometry if reshape took place bool reshapeTookPlace = false; - GEOSGeometry* currentReshapeGeometry = 0; + GEOSGeometry* currentReshapeGeometry = nullptr; GEOSGeometry** newGeoms = new GEOSGeometry*[numGeoms]; for ( int i = 0; i < numGeoms; ++i ) @@ -1728,7 +1728,7 @@ QgsAbstractGeometryV2* QgsGeos::reshapeGeometry( const QgsLineStringV2& reshapeW } GEOSGeom_destroy_r( geosinit.ctxt, reshapeLineGeos ); - GEOSGeometry* newMultiGeom = 0; + GEOSGeometry* newMultiGeom = nullptr; if ( isLine ) { newMultiGeom = GEOSGeom_createCollection_r( geosinit.ctxt, GEOS_MULTILINESTRING, newGeoms, numGeoms ); @@ -1742,7 +1742,7 @@ QgsAbstractGeometryV2* QgsGeos::reshapeGeometry( const QgsLineStringV2& reshapeW if ( !newMultiGeom ) { if ( errorCode ) { *errorCode = 3; } - return 0; + return nullptr; } if ( reshapeTookPlace ) @@ -1756,17 +1756,17 @@ QgsAbstractGeometryV2* QgsGeos::reshapeGeometry( const QgsLineStringV2& reshapeW { GEOSGeom_destroy_r( geosinit.ctxt, newMultiGeom ); if ( errorCode ) { *errorCode = 1; } - return 0; + return nullptr; } } - CATCH_GEOS_WITH_ERRMSG( 0 ) + CATCH_GEOS_WITH_ERRMSG( nullptr ) } } GEOSGeometry* QgsGeos::reshapeLine( const GEOSGeometry* line, const GEOSGeometry* reshapeLineGeos , double precision ) { if ( !line || !reshapeLineGeos ) - return 0; + return nullptr; bool atLeastTwoIntersections = false; @@ -1788,19 +1788,19 @@ GEOSGeometry* QgsGeos::reshapeLine( const GEOSGeometry* line, const GEOSGeometry } if ( !atLeastTwoIntersections ) - return 0; + return nullptr; //begin and end point of original line const GEOSCoordSequence* lineCoordSeq = GEOSGeom_getCoordSeq_r( geosinit.ctxt, line ); if ( !lineCoordSeq ) - return 0; + return nullptr; unsigned int lineCoordSeqSize; if ( GEOSCoordSeq_getSize_r( geosinit.ctxt, lineCoordSeq, &lineCoordSeqSize ) == 0 ) - return 0; + return nullptr; if ( lineCoordSeqSize < 2 ) - return 0; + return nullptr; //first and last vertex of line double x1, y1, x2, y2; @@ -1824,7 +1824,7 @@ GEOSGeometry* QgsGeos::reshapeLine( const GEOSGeometry* line, const GEOSGeometry { GEOSGeom_destroy_r( geosinit.ctxt, beginLineVertex ); GEOSGeom_destroy_r( geosinit.ctxt, endLineVertex ); - return 0; + return nullptr; } //and merge them together @@ -1834,7 +1834,7 @@ GEOSGeometry* QgsGeos::reshapeLine( const GEOSGeometry* line, const GEOSGeometry { GEOSGeom_destroy_r( geosinit.ctxt, beginLineVertex ); GEOSGeom_destroy_r( geosinit.ctxt, endLineVertex ); - return 0; + return nullptr; } int numMergedLines = GEOSGetNumGeometries_r( geosinit.ctxt, mergedLines ); @@ -1845,7 +1845,7 @@ GEOSGeometry* QgsGeos::reshapeLine( const GEOSGeometry* line, const GEOSGeometry if ( numMergedLines == 1 ) //reshape line is from begin to endpoint. So we keep the reshapeline return GEOSGeom_clone_r( geosinit.ctxt, reshapeLineGeos ); else - return 0; + return nullptr; } QList resultLineParts; //collection with the line segments that will be contained in result @@ -1930,8 +1930,8 @@ GEOSGeometry* QgsGeos::reshapeLine( const GEOSGeometry* line, const GEOSGeometry //add the longest segment from the probable list for rings (only used for polygon rings) if ( isRing && !probableParts.isEmpty() ) { - GEOSGeometry* maxGeom = 0; //the longest geometry in the probabla list - GEOSGeometry* currentGeom = 0; + GEOSGeometry* maxGeom = nullptr; //the longest geometry in the probabla list + GEOSGeometry* currentGeom = nullptr; double maxLength = -std::numeric_limits::max(); double currentLength = 0; for ( int i = 0; i < probableParts.size(); ++i ) @@ -1956,9 +1956,9 @@ GEOSGeometry* QgsGeos::reshapeLine( const GEOSGeometry* line, const GEOSGeometry GEOSGeom_destroy_r( geosinit.ctxt, endLineVertex ); GEOSGeom_destroy_r( geosinit.ctxt, mergedLines ); - GEOSGeometry* result = 0; + GEOSGeometry* result = nullptr; if ( resultLineParts.size() < 1 ) - return 0; + return nullptr; if ( resultLineParts.size() == 1 ) //the whole result was reshaped { @@ -1985,7 +1985,7 @@ GEOSGeometry* QgsGeos::reshapeLine( const GEOSGeometry* line, const GEOSGeometry if ( GEOSGeomTypeId_r( geosinit.ctxt, result ) != GEOS_LINESTRING ) { GEOSGeom_destroy_r( geosinit.ctxt, result ); - return 0; + return nullptr; } return result; @@ -1996,11 +1996,11 @@ GEOSGeometry* QgsGeos::reshapePolygon( const GEOSGeometry* polygon, const GEOSGe //go through outer shell and all inner rings and check if there is exactly one intersection of a ring and the reshape line int nIntersections = 0; int lastIntersectingRing = -2; - const GEOSGeometry* lastIntersectingGeom = 0; + const GEOSGeometry* lastIntersectingGeom = nullptr; int nRings = GEOSGetNumInteriorRings_r( geosinit.ctxt, polygon ); if ( nRings < 0 ) - return 0; + return nullptr; //does outer ring intersect? const GEOSGeometry* outerRing = GEOSGetExteriorRing_r( geosinit.ctxt, polygon ); @@ -2036,7 +2036,7 @@ GEOSGeometry* QgsGeos::reshapePolygon( const GEOSGeometry* polygon, const GEOSGe if ( nIntersections != 1 ) //reshape line is only allowed to intersect one ring { delete [] innerRings; - return 0; + return nullptr; } //we have one intersecting ring, let's try to reshape it @@ -2044,11 +2044,11 @@ GEOSGeometry* QgsGeos::reshapePolygon( const GEOSGeometry* polygon, const GEOSGe if ( !reshapeResult ) { delete [] innerRings; - return 0; + return nullptr; } //if reshaping took place, we need to reassemble the polygon and its rings - GEOSGeometry* newRing = 0; + GEOSGeometry* newRing = nullptr; const GEOSCoordSequence* reshapeSequence = GEOSGeom_getCoordSeq_r( geosinit.ctxt, reshapeResult ); GEOSCoordSequence* newCoordSequence = GEOSCoordSeq_clone_r( geosinit.ctxt, reshapeSequence ); @@ -2058,10 +2058,10 @@ GEOSGeometry* QgsGeos::reshapePolygon( const GEOSGeometry* polygon, const GEOSGe if ( !newRing ) { delete [] innerRings; - return 0; + return nullptr; } - GEOSGeometry* newOuterRing = 0; + GEOSGeometry* newOuterRing = nullptr; if ( lastIntersectingRing == -1 ) newOuterRing = newRing; else @@ -2071,10 +2071,10 @@ GEOSGeometry* QgsGeos::reshapePolygon( const GEOSGeometry* polygon, const GEOSGe QList ringList; if ( nRings > 0 ) { - GEOSGeometry* outerRingPoly = GEOSGeom_createPolygon_r( geosinit.ctxt, GEOSGeom_clone_r( geosinit.ctxt, newOuterRing ), 0, 0 ); + GEOSGeometry* outerRingPoly = GEOSGeom_createPolygon_r( geosinit.ctxt, GEOSGeom_clone_r( geosinit.ctxt, newOuterRing ), nullptr, 0 ); if ( outerRingPoly ) { - GEOSGeometry* currentRing = 0; + GEOSGeometry* currentRing = nullptr; for ( int i = 0; i < nRings; ++i ) { if ( lastIntersectingRing == i ) diff --git a/src/core/geometry/qgsgeos.h b/src/core/geometry/qgsgeos.h index 13ed863b0c2..1ef5635540e 100644 --- a/src/core/geometry/qgsgeos.h +++ b/src/core/geometry/qgsgeos.h @@ -41,34 +41,34 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine void geometryChanged() override; void prepareGeometry() override; - QgsAbstractGeometryV2* intersection( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const override; - QgsAbstractGeometryV2* difference( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const override; - QgsAbstractGeometryV2* combine( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const override; - QgsAbstractGeometryV2* combine( const QList&, QString* errorMsg = 0 ) const override; - QgsAbstractGeometryV2* symDifference( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const override; - QgsAbstractGeometryV2* buffer( double distance, int segments, QString* errorMsg = 0 ) const override; - QgsAbstractGeometryV2* buffer( double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit, QString* errorMsg = 0 ) const override; - QgsAbstractGeometryV2* simplify( double tolerance, QString* errorMsg = 0 ) const override; - QgsAbstractGeometryV2* interpolate( double distance, QString* errorMsg = 0 ) const override; - QgsAbstractGeometryV2* envelope( QString* errorMsg = 0 ) const override; - bool centroid( QgsPointV2& pt, QString* errorMsg = 0 ) const override; - bool pointOnSurface( QgsPointV2& pt, QString* errorMsg = 0 ) const override; - QgsAbstractGeometryV2* convexHull( QString* errorMsg = 0 ) const override; - double distance( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const override; - bool intersects( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const override; - bool touches( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const override; - bool crosses( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const override; - bool within( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const override; - bool overlaps( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const override; - bool contains( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const override; - bool disjoint( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const override; - QString relate( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const override; - bool relatePattern( const QgsAbstractGeometryV2& geom, const QString& pattern, QString* errorMsg = 0 ) const override; - double area( QString* errorMsg = 0 ) const override; - double length( QString* errorMsg = 0 ) const override; - bool isValid( QString* errorMsg = 0 ) const override; - bool isEqual( const QgsAbstractGeometryV2& geom, QString* errorMsg = 0 ) const override; - bool isEmpty( QString* errorMsg = 0 ) const override; + QgsAbstractGeometryV2* intersection( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const override; + QgsAbstractGeometryV2* difference( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const override; + QgsAbstractGeometryV2* combine( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const override; + QgsAbstractGeometryV2* combine( const QList&, QString* errorMsg = nullptr ) const override; + QgsAbstractGeometryV2* symDifference( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const override; + QgsAbstractGeometryV2* buffer( double distance, int segments, QString* errorMsg = nullptr ) const override; + QgsAbstractGeometryV2* buffer( double distance, int segments, int endCapStyle, int joinStyle, double mitreLimit, QString* errorMsg = nullptr ) const override; + QgsAbstractGeometryV2* simplify( double tolerance, QString* errorMsg = nullptr ) const override; + QgsAbstractGeometryV2* interpolate( double distance, QString* errorMsg = nullptr ) const override; + QgsAbstractGeometryV2* envelope( QString* errorMsg = nullptr ) const override; + bool centroid( QgsPointV2& pt, QString* errorMsg = nullptr ) const override; + bool pointOnSurface( QgsPointV2& pt, QString* errorMsg = nullptr ) const override; + QgsAbstractGeometryV2* convexHull( QString* errorMsg = nullptr ) const override; + double distance( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const override; + bool intersects( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const override; + bool touches( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const override; + bool crosses( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const override; + bool within( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const override; + bool overlaps( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const override; + bool contains( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const override; + bool disjoint( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const override; + QString relate( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const override; + bool relatePattern( const QgsAbstractGeometryV2& geom, const QString& pattern, QString* errorMsg = nullptr ) const override; + double area( QString* errorMsg = nullptr ) const override; + double length( QString* errorMsg = nullptr ) const override; + bool isValid( QString* errorMsg = nullptr ) const override; + bool isEqual( const QgsAbstractGeometryV2& geom, QString* errorMsg = nullptr ) const override; + bool isEmpty( QString* errorMsg = nullptr ) const override; /** Splits this geometry according to a given line. @param splitLine the line that splits the geometry @@ -81,10 +81,10 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine QList& newGeometries, bool topological, QList &topologyTestPoints, - QString* errorMsg = 0 ) const override; + QString* errorMsg = nullptr ) const override; - QgsAbstractGeometryV2* offsetCurve( double distance, int segments, int joinStyle, double mitreLimit, QString* errorMsg = 0 ) const override; - QgsAbstractGeometryV2* reshapeGeometry( const QgsLineStringV2& reshapeWithLine, int* errorCode, QString* errorMsg = 0 ) const; + QgsAbstractGeometryV2* offsetCurve( double distance, int segments, int joinStyle, double mitreLimit, QString* errorMsg = nullptr ) const override; + QgsAbstractGeometryV2* reshapeGeometry( const QgsLineStringV2& reshapeWithLine, int* errorCode, QString* errorMsg = nullptr ) const; /** Create a geometry from a GEOSGeometry * @param geos GEOSGeometry. Ownership is NOT transferred. @@ -122,8 +122,8 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine //geos util functions void cacheGeos() const; - QgsAbstractGeometryV2* overlay( const QgsAbstractGeometryV2& geom, Overlay op, QString* errorMsg = 0 ) const; - bool relation( const QgsAbstractGeometryV2& geom, Relation r, QString* errorMsg = 0 ) const; + QgsAbstractGeometryV2* overlay( const QgsAbstractGeometryV2& geom, Overlay op, QString* errorMsg = nullptr ) const; + bool relation( const QgsAbstractGeometryV2& geom, Relation r, QString* errorMsg = nullptr ) const; static GEOSCoordSequence* createCoordinateSequence( const QgsCurveV2* curve , double precision ); static QgsLineStringV2* sequenceToLinestring( const GEOSGeometry* geos, bool hasZ, bool hasM ); static int numberOfGeometries( GEOSGeometry* g ); @@ -139,7 +139,7 @@ class CORE_EXPORT QgsGeos: public QgsGeometryEngine static GEOSGeometry* createGeosPolygon( const QgsAbstractGeometryV2* poly, double precision ); //utils for geometry split - int topologicalTestPointsSplit( const GEOSGeometry* splitLine, QList& testPoints, QString* errorMsg = 0 ) const; + int topologicalTestPointsSplit( const GEOSGeometry* splitLine, QList& testPoints, QString* errorMsg = nullptr ) const; GEOSGeometry* linePointDifference( GEOSGeometry* GEOSsplitPoint ) const; int splitLinearGeometry( GEOSGeometry* splitLine, QList& newGeometries ) const; int splitPolygonGeometry( GEOSGeometry* splitLine, QList& newGeometries ) const; diff --git a/src/core/geometry/qgspolygonv2.cpp b/src/core/geometry/qgspolygonv2.cpp index d2848ad79bd..4a77a9ee80e 100644 --- a/src/core/geometry/qgspolygonv2.cpp +++ b/src/core/geometry/qgspolygonv2.cpp @@ -95,7 +95,7 @@ unsigned char* QgsPolygonV2::asWkb( int& binarySize ) const QgsWkbPtr wkb( geomPtr ); wkb << static_cast( QgsApplication::endian() ); wkb << static_cast( wkbType() ); - wkb << static_cast(( mExteriorRing != 0 ) + mInteriorRings.size() ); + wkb << static_cast(( mExteriorRing != nullptr ) + mInteriorRings.size() ); if ( mExteriorRing ) { QList pts; diff --git a/src/core/gps/qextserialport/posix_qextserialport.cpp b/src/core/gps/qextserialport/posix_qextserialport.cpp index a4bd82ac7fd..feec05952a9 100644 --- a/src/core/gps/qextserialport/posix_qextserialport.cpp +++ b/src/core/gps/qextserialport/posix_qextserialport.cpp @@ -14,7 +14,7 @@ void QextSerialPort::platformSpecificInit() { fd = 0; - readNotifier = 0; + readNotifier = nullptr; } /*! @@ -750,7 +750,7 @@ void QextSerialPort::close() ::close(fd); if(readNotifier) { delete readNotifier; - readNotifier = 0; + readNotifier = nullptr; } } } diff --git a/src/core/gps/qgsgpsconnection.cpp b/src/core/gps/qgsgpsconnection.cpp index affe193fb0c..08d1249ca85 100644 --- a/src/core/gps/qgsgpsconnection.cpp +++ b/src/core/gps/qgsgpsconnection.cpp @@ -29,7 +29,7 @@ #include "qgsnmeaconnection.h" #include "qgslogger.h" -QgsGPSConnection::QgsGPSConnection( QIODevice* dev ): QObject( 0 ), mSource( dev ), mStatus( NotConnected ) +QgsGPSConnection::QgsGPSConnection( QIODevice* dev ): QObject( nullptr ), mSource( dev ), mStatus( NotConnected ) { clearLastGPSInformation(); QObject::connect( dev, SIGNAL( readyRead() ), this, SLOT( parseData() ) ); @@ -73,7 +73,7 @@ void QgsGPSConnection::cleanupSource() mSource->close(); } delete mSource; - mSource = 0; + mSource = nullptr; } void QgsGPSConnection::setSource( QIODevice* source ) diff --git a/src/core/gps/qgsgpsdetector.cpp b/src/core/gps/qgsgpsdetector.cpp index 192bf2d674f..eca9d4fa2f6 100644 --- a/src/core/gps/qgsgpsdetector.cpp +++ b/src/core/gps/qgsgpsdetector.cpp @@ -97,7 +97,7 @@ QList< QPair > QgsGPSDetector::availablePorts() QgsGPSDetector::QgsGPSDetector( const QString& portName ) { - mConn = 0; + mConn = nullptr; mBaudList << BAUD4800 << BAUD9600 << BAUD38400 << BAUD57600 << BAUD115200; //add 57600 for SXBlueII GPS unit if ( portName.isEmpty() ) @@ -126,7 +126,7 @@ void QgsGPSDetector::advance() delete mConn; } - mConn = 0; + mConn = nullptr; while ( !mConn ) { @@ -203,7 +203,7 @@ void QgsGPSDetector::detected( const QgsGPSInformation& info ) { // signal detection QgsGPSConnection *conn = mConn; - mConn = 0; + mConn = nullptr; emit detected( conn ); deleteLater(); } @@ -213,6 +213,6 @@ void QgsGPSDetector::connDestroyed( QObject *obj ) { if ( obj == mConn ) { - mConn = 0; + mConn = nullptr; } } diff --git a/src/core/layertree/qgslayertreegroup.cpp b/src/core/layertree/qgslayertreegroup.cpp index 466d03ffa63..aaa1ddf8adb 100644 --- a/src/core/layertree/qgslayertreegroup.cpp +++ b/src/core/layertree/qgslayertreegroup.cpp @@ -64,7 +64,7 @@ QgsLayerTreeGroup* QgsLayerTreeGroup::addGroup( const QString &name ) QgsLayerTreeLayer*QgsLayerTreeGroup::insertLayer( int index, QgsMapLayer* layer ) { if ( !layer || QgsMapLayerRegistry::instance()->mapLayer( layer->id() ) != layer ) - return 0; + return nullptr; QgsLayerTreeLayer* ll = new QgsLayerTreeLayer( layer ); insertChildNode( index, ll ); @@ -74,7 +74,7 @@ QgsLayerTreeLayer*QgsLayerTreeGroup::insertLayer( int index, QgsMapLayer* layer QgsLayerTreeLayer* QgsLayerTreeGroup::addLayer( QgsMapLayer* layer ) { if ( !layer || QgsMapLayerRegistry::instance()->mapLayer( layer->id() ) != layer ) - return 0; + return nullptr; QgsLayerTreeLayer* ll = new QgsLayerTreeLayer( layer ); addChildNode( ll ); @@ -90,7 +90,7 @@ void QgsLayerTreeGroup::insertChildNode( int index, QgsLayerTreeNode* node ) void QgsLayerTreeGroup::insertChildNodes( int index, const QList& nodes ) { - QgsLayerTreeNode* meChild = 0; + QgsLayerTreeNode* meChild = nullptr; if ( mMutuallyExclusive && mMutuallyExclusiveChildIndex >= 0 && mMutuallyExclusiveChildIndex < mChildren.count() ) meChild = mChildren[mMutuallyExclusiveChildIndex]; @@ -148,7 +148,7 @@ void QgsLayerTreeGroup::removeLayer( QgsMapLayer* layer ) void QgsLayerTreeGroup::removeChildren( int from, int count ) { - QgsLayerTreeNode* meChild = 0; + QgsLayerTreeNode* meChild = nullptr; if ( mMutuallyExclusive && mMutuallyExclusiveChildIndex >= 0 && mMutuallyExclusiveChildIndex < mChildren.count() ) meChild = mChildren[mMutuallyExclusiveChildIndex]; @@ -204,7 +204,7 @@ QgsLayerTreeLayer *QgsLayerTreeGroup::findLayer( const QString& layerId ) const return res; } } - return 0; + return nullptr; } QList QgsLayerTreeGroup::findLayers() const @@ -237,13 +237,13 @@ QgsLayerTreeGroup* QgsLayerTreeGroup::findGroup( const QString& name ) } } } - return 0; + return nullptr; } QgsLayerTreeGroup* QgsLayerTreeGroup::readXML( QDomElement& element ) { if ( element.tagName() != "layer-tree-group" ) - return 0; + return nullptr; QString name = element.attribute( "name" ); bool isExpanded = ( element.attribute( "expanded", "1" ) == "1" ); diff --git a/src/core/layertree/qgslayertreelayer.cpp b/src/core/layertree/qgslayertreelayer.cpp index 58908c5823a..73f9e5bfc5f 100644 --- a/src/core/layertree/qgslayertreelayer.cpp +++ b/src/core/layertree/qgslayertreelayer.cpp @@ -23,7 +23,7 @@ QgsLayerTreeLayer::QgsLayerTreeLayer( QgsMapLayer *layer ) : QgsLayerTreeNode( NodeLayer ) , mLayerId( layer->id() ) - , mLayer( 0 ) + , mLayer( nullptr ) , mVisible( Qt::Checked ) { Q_ASSERT( QgsMapLayerRegistry::instance()->mapLayer( mLayerId ) == layer ); @@ -34,7 +34,7 @@ QgsLayerTreeLayer::QgsLayerTreeLayer( const QString& layerId, const QString& nam : QgsLayerTreeNode( NodeLayer ) , mLayerId( layerId ) , mLayerName( name ) - , mLayer( 0 ) + , mLayer( nullptr ) , mVisible( Qt::Checked ) { attachToLayer(); @@ -44,7 +44,7 @@ QgsLayerTreeLayer::QgsLayerTreeLayer( const QgsLayerTreeLayer& other ) : QgsLayerTreeNode( other ) , mLayerId( other.mLayerId ) , mLayerName( other.mLayerName ) - , mLayer( 0 ) + , mLayer( nullptr ) , mVisible( other.mVisible ) { attachToLayer(); @@ -96,14 +96,14 @@ void QgsLayerTreeLayer::setVisible( Qt::CheckState state ) QgsLayerTreeLayer* QgsLayerTreeLayer::readXML( QDomElement& element ) { if ( element.tagName() != "layer-tree-layer" ) - return 0; + return nullptr; QString layerID = element.attribute( "id" ); QString layerName = element.attribute( "name" ); Qt::CheckState checked = QgsLayerTreeUtils::checkStateFromXml( element.attribute( "checked" ) ); bool isExpanded = ( element.attribute( "expanded", "1" ) == "1" ); - QgsLayerTreeLayer* nodeLayer = 0; + QgsLayerTreeLayer* nodeLayer = nullptr; QgsMapLayer* layer = QgsMapLayerRegistry::instance()->mapLayer( layerID ); @@ -167,6 +167,6 @@ void QgsLayerTreeLayer::registryLayersWillBeRemoved( const QStringList& layerIds disconnect( QgsMapLayerRegistry::instance(), SIGNAL( layersWillBeRemoved( QStringList ) ), this, SLOT( registryLayersWillBeRemoved( QStringList ) ) ); connect( QgsMapLayerRegistry::instance(), SIGNAL( layersAdded( QList ) ), this, SLOT( registryLayersAdded( QList ) ) ); - mLayer = 0; + mLayer = nullptr; } } diff --git a/src/core/layertree/qgslayertreemodel.cpp b/src/core/layertree/qgslayertreemodel.cpp index fe6899c1454..66a606a8caa 100644 --- a/src/core/layertree/qgslayertreemodel.cpp +++ b/src/core/layertree/qgslayertreemodel.cpp @@ -288,7 +288,7 @@ Qt::ItemFlags QgsLayerTreeModel::flags( const QModelIndex& index ) const { if ( !index.isValid() ) { - Qt::ItemFlags rootFlags = 0; + Qt::ItemFlags rootFlags = nullptr; if ( testFlag( AllowNodeReorder ) ) rootFlags |= Qt::ItemIsDropEnabled; return rootFlags; @@ -444,13 +444,13 @@ QList QgsLayerTreeModel::indexes2nodes( const QModelIndexList bool QgsLayerTreeModel::isIndexSymbologyNode( const QModelIndex& index ) const { - return index2legendNode( index ) != 0; + return index2legendNode( index ) != nullptr; } QgsLayerTreeLayer* QgsLayerTreeModel::layerNodeForSymbologyNode( const QModelIndex& index ) const { QgsLayerTreeModelLegendNode* symNode = index2legendNode( index ); - return symNode ? symNode->layerNode() : 0; + return symNode ? symNode->layerNode() : nullptr; } QgsLayerTreeGroup*QgsLayerTreeModel::rootGroup() const @@ -837,7 +837,7 @@ static int _numLayerCount( QgsLayerTreeGroup* group, const QString& layerId ) void QgsLayerTreeModel::disconnectFromLayer( QgsLayerTreeLayer* nodeLayer ) { - disconnect( nodeLayer, 0, this, 0 ); // disconnect from delayed load of layer + disconnect( nodeLayer, nullptr, this, nullptr ); // disconnect from delayed load of layer if ( !nodeLayer->layer() ) return; // we were never connected @@ -850,7 +850,7 @@ void QgsLayerTreeModel::disconnectFromLayer( QgsLayerTreeLayer* nodeLayer ) if ( _numLayerCount( mRootNode, nodeLayer->layerId() ) == 1 ) { // last instance of the layer in the tree: disconnect from all signals from layer! - disconnect( nodeLayer->layer(), 0, this, 0 ); + disconnect( nodeLayer->layer(), nullptr, this, nullptr ); } } @@ -893,7 +893,7 @@ void QgsLayerTreeModel::connectToRootNode() void QgsLayerTreeModel::disconnectFromRootNode() { - disconnect( mRootNode, 0, this, 0 ); + disconnect( mRootNode, nullptr, this, nullptr ); disconnectFromLayers( mRootNode ); } @@ -935,7 +935,7 @@ QMimeData* QgsLayerTreeModel::mimeData( const QModelIndexList& indexes ) const QList nodesFinal = indexes2nodes( sortedIndexes, true ); if ( nodesFinal.isEmpty() ) - return 0; + return nullptr; QMimeData *mimeData = new QMimeData(); @@ -1138,13 +1138,13 @@ void QgsLayerTreeModel::addLegendToLayer( QgsLayerTreeLayer* nodeL ) LayerLegendData data; data.originalNodes = lstNew; data.activeNodes = filteredLstNew; - data.tree = 0; + data.tree = nullptr; // maybe the legend nodes form a tree - try to create a tree structure from the list if ( testFlag( ShowLegendAsTree ) ) tryBuildLegendTree( data ); - int count = data.tree ? data.tree->children[0].count() : filteredLstNew.count(); + int count = data.tree ? data.tree->children[nullptr].count() : filteredLstNew.count(); if ( ! isEmbedded ) beginInsertRows( node2index( nodeL ), 0, count - 1 ); @@ -1178,7 +1178,7 @@ void QgsLayerTreeModel::tryBuildLegendTree( LayerLegendData& data ) // make mapping from rules to nodes and do some sanity checks QHash rule2node; - rule2node[QString()] = 0; + rule2node[QString()] = nullptr; Q_FOREACH ( QgsLayerTreeModelLegendNode* n, data.activeNodes ) { QString ruleKey = n->data( QgsLayerTreeModelLegendNode::RuleKeyRole ).toString(); @@ -1194,7 +1194,7 @@ void QgsLayerTreeModel::tryBuildLegendTree( LayerLegendData& data ) Q_FOREACH ( QgsLayerTreeModelLegendNode* n, data.activeNodes ) { QString parentRuleKey = n->data( QgsLayerTreeModelLegendNode::ParentRuleKeyRole ).toString(); - QgsLayerTreeModelLegendNode* parent = rule2node.value( parentRuleKey, 0 ); + QgsLayerTreeModelLegendNode* parent = rule2node.value( parentRuleKey, nullptr ); data.tree->parents[n] = parent; data.tree->children[parent] << n; } @@ -1221,7 +1221,7 @@ QModelIndex QgsLayerTreeModel::legendNode2index( QgsLayerTreeModelLegendNode* le else { QModelIndex parentIndex = node2index( legendNode->layerNode() ); - int row = data.tree->children[0].indexOf( legendNode ); + int row = data.tree->children[nullptr].indexOf( legendNode ); return index( row, 0, parentIndex ); } } @@ -1255,7 +1255,7 @@ int QgsLayerTreeModel::legendRootRowCount( QgsLayerTreeLayer* nL ) const const LayerLegendData& data = mLegend[nL]; if ( data.tree ) - return data.tree->children[0].count(); + return data.tree->children[nullptr].count(); return data.activeNodes.count(); } @@ -1266,7 +1266,7 @@ QModelIndex QgsLayerTreeModel::legendRootIndex( int row, int column, QgsLayerTre Q_ASSERT( mLegend.contains( nL ) ); const LayerLegendData& data = mLegend[nL]; if ( data.tree ) - return createIndex( row, column, static_cast( data.tree->children[0].at( row ) ) ); + return createIndex( row, column, static_cast( data.tree->children[nullptr].at( row ) ) ); return createIndex( row, column, static_cast( data.activeNodes.at( row ) ) ); } @@ -1354,7 +1354,7 @@ QgsLayerTreeModelLegendNode* QgsLayerTreeModel::findLegendNode( const QString& l } } - return 0; + return nullptr; } void QgsLayerTreeModel::legendInvalidateMapBasedData() diff --git a/src/core/layertree/qgslayertreemodel.h b/src/core/layertree/qgslayertreemodel.h index bd8bcb0495e..a307af7e67f 100644 --- a/src/core/layertree/qgslayertreemodel.h +++ b/src/core/layertree/qgslayertreemodel.h @@ -52,7 +52,7 @@ class CORE_EXPORT QgsLayerTreeModel : public QAbstractItemModel public: //! Construct a new tree model with given layer tree (root node must not be null pointer). //! The root node is not transferred by the model. - explicit QgsLayerTreeModel( QgsLayerTreeGroup* rootNode, QObject *parent = 0 ); + explicit QgsLayerTreeModel( QgsLayerTreeGroup* rootNode, QObject *parent = nullptr ); ~QgsLayerTreeModel(); // Implementation of virtual functions from QAbstractItemModel diff --git a/src/core/layertree/qgslayertreemodellegendnode.cpp b/src/core/layertree/qgslayertreemodellegendnode.cpp index f01769f354d..5d334b0f0c0 100644 --- a/src/core/layertree/qgslayertreemodellegendnode.cpp +++ b/src/core/layertree/qgslayertreemodellegendnode.cpp @@ -233,7 +233,7 @@ QgsRenderContext * QgsSymbolV2LegendNode::createTemporaryRenderContext() const context->setScaleFactor( dpi / 25.4 ); context->setRendererScale( scale ); context->setMapToPixel( QgsMapToPixel( mupp ) ); - return validData ? context.take() : 0; + return validData ? context.take() : nullptr; } void QgsSymbolV2LegendNode::checkAll( bool state ) @@ -357,7 +357,7 @@ QSizeF QgsSymbolV2LegendNode::drawSymbol( const QgsLegendSettings& settings, Ite context.setRendererScale( settings.mapScale() ); context.setMapToPixel( QgsMapToPixel( 1 / ( settings.mmPerMapUnit() * context.scaleFactor() ) ) ); context.setForceVectorOutput( true ); - context.setPainter( ctx ? ctx->painter : 0 ); + context.setPainter( ctx ? ctx->painter : nullptr ); //Consider symbol size for point markers double height = settings.symbolSize().height(); diff --git a/src/core/layertree/qgslayertreemodellegendnode.h b/src/core/layertree/qgslayertreemodellegendnode.h index 951618d7a6f..2e89ccfbfa8 100644 --- a/src/core/layertree/qgslayertreemodellegendnode.h +++ b/src/core/layertree/qgslayertreemodellegendnode.h @@ -127,7 +127,7 @@ class CORE_EXPORT QgsLayerTreeModelLegendNode : public QObject protected: /** Construct the node with pointer to its parent layer node */ - explicit QgsLayerTreeModelLegendNode( QgsLayerTreeLayer* nodeL, QObject* parent = 0 ); + explicit QgsLayerTreeModelLegendNode( QgsLayerTreeLayer* nodeL, QObject* parent = nullptr ); protected: QgsLayerTreeLayer* mLayerNode; @@ -148,7 +148,7 @@ class CORE_EXPORT QgsSymbolV2LegendNode : public QgsLayerTreeModelLegendNode Q_OBJECT public: - QgsSymbolV2LegendNode( QgsLayerTreeLayer* nodeLayer, const QgsLegendSymbolItemV2& item, QObject* parent = 0 ); + QgsSymbolV2LegendNode( QgsLayerTreeLayer* nodeLayer, const QgsLegendSymbolItemV2& item, QObject* parent = nullptr ); ~QgsSymbolV2LegendNode(); virtual Qt::ItemFlags flags() const override; @@ -236,7 +236,7 @@ class CORE_EXPORT QgsSimpleLegendNode : public QgsLayerTreeModelLegendNode Q_OBJECT public: - QgsSimpleLegendNode( QgsLayerTreeLayer* nodeLayer, const QString& label, const QIcon& icon = QIcon(), QObject* parent = 0, const QString& key = QString() ); + QgsSimpleLegendNode( QgsLayerTreeLayer* nodeLayer, const QString& label, const QIcon& icon = QIcon(), QObject* parent = nullptr, const QString& key = QString() ); virtual QVariant data( int role ) const override; @@ -258,7 +258,7 @@ class CORE_EXPORT QgsImageLegendNode : public QgsLayerTreeModelLegendNode Q_OBJECT public: - QgsImageLegendNode( QgsLayerTreeLayer* nodeLayer, const QImage& img, QObject* parent = 0 ); + QgsImageLegendNode( QgsLayerTreeLayer* nodeLayer, const QImage& img, QObject* parent = nullptr ); virtual QVariant data( int role ) const override; @@ -278,7 +278,7 @@ class CORE_EXPORT QgsRasterSymbolLegendNode : public QgsLayerTreeModelLegendNode Q_OBJECT public: - QgsRasterSymbolLegendNode( QgsLayerTreeLayer* nodeLayer, const QColor& color, const QString& label, QObject* parent = 0 ); + QgsRasterSymbolLegendNode( QgsLayerTreeLayer* nodeLayer, const QColor& color, const QString& label, QObject* parent = nullptr ); virtual QVariant data( int role ) const override; @@ -301,7 +301,7 @@ class CORE_EXPORT QgsWMSLegendNode : public QgsLayerTreeModelLegendNode Q_OBJECT public: - QgsWMSLegendNode( QgsLayerTreeLayer* nodeLayer, QObject* parent = 0 ); + QgsWMSLegendNode( QgsLayerTreeLayer* nodeLayer, QObject* parent = nullptr ); virtual QVariant data( int role ) const override; diff --git a/src/core/layertree/qgslayertreenode.cpp b/src/core/layertree/qgslayertreenode.cpp index 3114c900b94..fdd03d50db4 100644 --- a/src/core/layertree/qgslayertreenode.cpp +++ b/src/core/layertree/qgslayertreenode.cpp @@ -24,7 +24,7 @@ QgsLayerTreeNode::QgsLayerTreeNode( QgsLayerTreeNode::NodeType t ) : mNodeType( t ) - , mParent( 0 ) + , mParent( nullptr ) , mExpanded( true ) { } @@ -32,7 +32,7 @@ QgsLayerTreeNode::QgsLayerTreeNode( QgsLayerTreeNode::NodeType t ) QgsLayerTreeNode::QgsLayerTreeNode( const QgsLayerTreeNode& other ) : QObject() , mNodeType( other.mNodeType ) - , mParent( 0 ) + , mParent( nullptr ) , mExpanded( other.mExpanded ) , mProperties( other.mProperties ) { @@ -49,7 +49,7 @@ QgsLayerTreeNode::~QgsLayerTreeNode() QgsLayerTreeNode* QgsLayerTreeNode::readXML( QDomElement& element ) { - QgsLayerTreeNode* node = 0; + QgsLayerTreeNode* node = nullptr; if ( element.tagName() == "layer-tree-group" ) node = QgsLayerTreeGroup::readXML( element ); else if ( element.tagName() == "layer-tree-layer" ) @@ -115,7 +115,7 @@ void QgsLayerTreeNode::insertChildrenPrivate( int index, QListmParent == 0 ); + Q_ASSERT( node->mParent == nullptr ); node->mParent = this; } @@ -152,7 +152,7 @@ void QgsLayerTreeNode::removeChildrenPrivate( int from, int count, bool destroy while ( --count >= 0 ) { QgsLayerTreeNode *node = mChildren.takeAt( from ); - node->mParent = 0; + node->mParent = nullptr; if ( destroy ) delete node; } diff --git a/src/core/layertree/qgslayertreeregistrybridge.h b/src/core/layertree/qgslayertreeregistrybridge.h index 00b8afa7209..eea6b9357a4 100644 --- a/src/core/layertree/qgslayertreeregistrybridge.h +++ b/src/core/layertree/qgslayertreeregistrybridge.h @@ -40,7 +40,7 @@ class CORE_EXPORT QgsLayerTreeRegistryBridge : public QObject { Q_OBJECT public: - explicit QgsLayerTreeRegistryBridge( QgsLayerTreeGroup* root, QObject *parent = 0 ); + explicit QgsLayerTreeRegistryBridge( QgsLayerTreeGroup* root, QObject *parent = nullptr ); void setEnabled( bool enabled ) { mEnabled = enabled; } bool isEnabled() const { return mEnabled; } diff --git a/src/core/layertree/qgslayertreeutils.h b/src/core/layertree/qgslayertreeutils.h index cb9c5dca516..978fb88751c 100644 --- a/src/core/layertree/qgslayertreeutils.h +++ b/src/core/layertree/qgslayertreeutils.h @@ -69,7 +69,7 @@ class CORE_EXPORT QgsLayerTreeUtils //! Set the expression filter of a legend layer static void setLegendFilterByExpression( QgsLayerTreeLayer& layer, const QString& expr, bool enabled = true ); //! Return the expression filter of a legend layer - static QString legendFilterByExpression( const QgsLayerTreeLayer& layer, bool* enabled = 0 ); + static QString legendFilterByExpression( const QgsLayerTreeLayer& layer, bool* enabled = nullptr ); //! Test if one of the layers in a group has an expression filter static bool hasLegendFilterExpression( const QgsLayerTreeGroup& group ); }; diff --git a/src/core/pal/feature.cpp b/src/core/pal/feature.cpp index c2f5d800ef0..0d1b290a17e 100644 --- a/src/core/pal/feature.cpp +++ b/src/core/pal/feature.cpp @@ -66,7 +66,7 @@ namespace pal extractCoords( geom ); - holeOf = NULL; + holeOf = nullptr; for ( int i = 0; i < mHoles.count(); i++ ) { mHoles.at( i )->holeOf = this; @@ -111,7 +111,7 @@ namespace pal { const GEOSGeometry* interior = GEOSGetInteriorRingN_r( geosctxt, geom, i ); FeaturePart* hole = new FeaturePart( mLF, interior ); - hole->holeOf = NULL; + hole->holeOf = nullptr; // possibly not needed. it's not done for the exterior ring, so I'm not sure // why it's just done here... reorderPolygon( hole->nbPoints, hole->x, hole->y ); @@ -676,7 +676,7 @@ namespace pal if ( index <= 1 && distance < 0 ) // We've gone off the start, fail out { - return NULL; + return nullptr; } // Same thing, checking if we go off the end @@ -687,7 +687,7 @@ namespace pal } if ( index >= path_positions->nbPoints ) { - return NULL; + return nullptr; } LabelInfo* li = mLF->curvedLabelInfo(); @@ -710,11 +710,11 @@ namespace pal if ( segment_length == 0 ) { // Not allowed to place across on 0 length segments or discontinuities - return NULL; + return nullptr; } - LabelPosition* slp = NULL; - LabelPosition* slp_tmp = NULL; + LabelPosition* slp = nullptr; + LabelPosition* slp_tmp = nullptr; // current_placement = placement_result() double angle = atan2( -dy, dx ); @@ -736,7 +736,7 @@ namespace pal { // Not allowed to place across on 0 length segments or discontinuities delete slp; - return NULL; + return nullptr; } double start_x = old_x + dx * distance / segment_length; @@ -765,7 +765,7 @@ namespace pal if ( index >= path_positions->nbPoints ) // Bail out if we run off the end of the shape { delete slp; - return NULL; + return nullptr; } new_x = path_positions->x[index]; new_y = path_positions->y[index]; @@ -802,7 +802,7 @@ namespace pal && angle_delta < li->max_char_angle_outside*( M_PI / 180 ) ) ) { delete slp; - return NULL; + return nullptr; } double render_angle = angle; @@ -825,7 +825,7 @@ namespace pal //std::cerr << "adding part: " << render_x << " " << render_y << std::endl; LabelPosition* tmp = new LabelPosition( 0, render_x /*- xBase*/, render_y /*- yBase*/, ci.width, string_height, -render_angle, 0.0001, this ); tmp->setPartId( orientation > 0 ? i : li->char_num - i - 1 ); - if ( slp == NULL ) + if ( slp == nullptr ) slp = tmp; else slp_tmp->setNextPart( tmp ); @@ -857,7 +857,7 @@ namespace pal { // Otherwise we have failed to find a placement delete slp; - return NULL; + return nullptr; } } @@ -876,7 +876,7 @@ namespace pal LabelInfo* li = mLF->curvedLabelInfo(); // label info must be present - if ( li == NULL || li->char_num == 0 ) + if ( li == nullptr || li->char_num == 0 ) return 0; // distance calculation @@ -1025,7 +1025,7 @@ namespace pal QLinkedList shapes_toProcess; QLinkedList shapes_final; - mapShape->parent = NULL; + mapShape->parent = nullptr; shapes_toProcess.append( mapShape ); diff --git a/src/core/pal/feature.h b/src/core/pal/feature.h index 8d966046df2..168c356cf37 100644 --- a/src/core/pal/feature.h +++ b/src/core/pal/feature.h @@ -108,7 +108,7 @@ namespace pal * @param mapShape optional geometry of source polygon * @returns the number of generated candidates */ - int setPositionForPoint( double x, double y, QList &lPos, double angle, PointSet *mapShape = 0 ); + int setPositionForPoint( double x, double y, QList &lPos, double angle, PointSet *mapShape = nullptr ); /** Generate one candidate over or offset the specified point. * @param x x coordinate of the point @@ -118,7 +118,7 @@ namespace pal * @param mapShape optional geometry of source polygon * @returns the number of generated candidates (always 1) */ - int setPositionOverPoint( double x, double y, QList &lPos, double angle, PointSet *mapShape = 0 ); + int setPositionOverPoint( double x, double y, QList &lPos, double angle, PointSet *mapShape = nullptr ); /** Generate candidates for line feature. * @param lPos pointer to an array of candidates, will be filled by generated candidates diff --git a/src/core/pal/labelposition.cpp b/src/core/pal/labelposition.cpp index 2783e8c40c5..c8970019ce0 100644 --- a/src/core/pal/labelposition.cpp +++ b/src/core/pal/labelposition.cpp @@ -58,7 +58,7 @@ namespace pal , alpha( alpha ) , w( w ) , h( h ) - , nextPart( NULL ) + , nextPart( nullptr ) , partId( -1 ) , reversed( isReversed ) , upsideDown( false ) @@ -182,7 +182,7 @@ namespace pal if ( other.nextPart ) nextPart = new LabelPosition( *other.nextPart ); else - nextPart = NULL; + nextPart = nullptr; partId = other.partId; upsideDown = other.upsideDown; reversed = other.reversed; @@ -258,7 +258,7 @@ namespace pal if ( this->probFeat == lp->probFeat ) // bugfix #1 return false; // always overlaping itself ! - if ( nextPart == NULL && lp->nextPart == NULL ) + if ( nextPart == nullptr && lp->nextPart == nullptr ) return isInConflictSinglePart( lp ); else return isInConflictMultiPart( lp ); diff --git a/src/core/pal/layer.cpp b/src/core/pal/layer.cpp index 4762317015d..899160ad156 100644 --- a/src/core/pal/layer.cpp +++ b/src/core/pal/layer.cpp @@ -56,7 +56,7 @@ namespace pal , mCentroidInside( false ) , mFitInPolygon( false ) , mArrangement( arrangement ) - , mArrangementFlags( 0 ) + , mArrangementFlags( nullptr ) , mMode( LabelPerFeature ) , mMergeLines( false ) , mUpsidedownLabels( Upright ) @@ -121,11 +121,11 @@ namespace pal bool addedFeature = false; double geom_size = -1, biggest_size = -1; - FeaturePart* biggest_part = NULL; + FeaturePart* biggest_part = nullptr; // break the (possibly multi-part) geometry into simple geometries QLinkedList* simpleGeometries = unmulti( lf->geometry() ); - if ( simpleGeometries == NULL ) // unmulti() failed? + if ( simpleGeometries == nullptr ) // unmulti() failed? { mMutex.unlock(); throw InternalException::UnknownGeometry(); @@ -185,7 +185,7 @@ namespace pal else { addObstaclePart( fpart ); - fpart = 0; + fpart = nullptr; } } @@ -227,7 +227,7 @@ namespace pal { //do the same for the obstacle geometry simpleGeometries = unmulti( lf->obstacleGeometry() ); - if ( simpleGeometries == NULL ) // unmulti() failed? + if ( simpleGeometries == nullptr ) // unmulti() failed? { mMutex.unlock(); throw InternalException::UnknownGeometry(); @@ -277,7 +277,7 @@ namespace pal mMutex.unlock(); // if using only biggest parts... - if (( mMode == LabelPerFeature || lf->hasFixedPosition() ) && biggest_part != NULL ) + if (( mMode == LabelPerFeature || lf->hasFixedPosition() ) && biggest_part != nullptr ) { addFeaturePart( biggest_part, lf->labelText() ); addedFeature = true; @@ -351,7 +351,7 @@ namespace pal ++p; } - return NULL; // no connected part found... + return nullptr; // no connected part found... } void Layer::joinConnectedFeatures() diff --git a/src/core/pal/pal.cpp b/src/core/pal/pal.cpp index 77df522d48d..872aae6e786 100644 --- a/src/core/pal/pal.cpp +++ b/src/core/pal/pal.cpp @@ -64,8 +64,8 @@ namespace pal // do not init and exit GEOS - we do it inside QGIS //initGEOS( geosNotice, geosError ); - fnIsCancelled = 0; - fnIsCancelledContext = 0; + fnIsCancelled = nullptr; + fnIsCancelledContext = nullptr; ejChainDeg = 50; tenure = 10; @@ -97,7 +97,7 @@ namespace pal return; mMutex.lock(); - if ( QgsAbstractLabelProvider* key = mLayers.key( layer, 0 ) ) + if ( QgsAbstractLabelProvider* key = mLayers.key( layer, nullptr ) ) { mLayers.remove( key ); delete layer; @@ -172,7 +172,7 @@ namespace pal // valid features are added to fFeats Feats *ft = new Feats(); ft->feature = ft_ptr; - ft->shape = NULL; + ft->shape = nullptr; ft->lPos = lPos; ft->priority = ft_ptr->calculatePriority(); context->fFeats->append( ft ); @@ -332,7 +332,7 @@ namespace pal delete fFeats; delete prob; delete obstacles; - return NULL; + return nullptr; } prob->nbft = fFeats->size(); @@ -367,7 +367,7 @@ namespace pal delete fFeats; delete prob; delete obstacles; - return 0; + return nullptr; } int idlp = 0; @@ -432,7 +432,7 @@ namespace pal delete fFeats; delete prob; delete obstacles; - return 0; + return nullptr; } feat = fFeats->takeFirst(); @@ -505,7 +505,7 @@ namespace pal t.start(); // First, extract the problem - if (( prob = extract( bbox[0], bbox[1], bbox[2], bbox[3] ) ) == NULL ) + if (( prob = extract( bbox[0], bbox[1], bbox[2], bbox[3] ) ) == nullptr ) { // nothing to be done => return an empty result set if ( stats ) @@ -585,7 +585,7 @@ namespace pal std::list* Pal::solveProblem( Problem* prob, bool displayAll ) { - if ( prob == NULL ) + if ( prob == nullptr ) return new std::list(); prob->reduce(); diff --git a/src/core/pal/palstat.cpp b/src/core/pal/palstat.cpp index 35068389eac..8da8c72c63a 100644 --- a/src/core/pal/palstat.cpp +++ b/src/core/pal/palstat.cpp @@ -38,8 +38,8 @@ namespace pal nbLayers = 0; nbObjects = 0; nbLabelledObjects = 0; - layersNbObjects = NULL; - layersNbLabelledObjects = NULL; + layersNbObjects = nullptr; + layersNbLabelledObjects = nullptr; } PalStat::~PalStat() diff --git a/src/core/pal/pointset.cpp b/src/core/pal/pointset.cpp index 21501af026e..7110002e174 100644 --- a/src/core/pal/pointset.cpp +++ b/src/core/pal/pointset.cpp @@ -46,34 +46,34 @@ namespace pal { PointSet::PointSet() - : mGeos( 0 ) + : mGeos( nullptr ) , mOwnsGeom( false ) - , holeOf( NULL ) - , parent( NULL ) + , holeOf( nullptr ) + , parent( nullptr ) , xmin( DBL_MAX ) , xmax( -DBL_MAX ) , ymin( DBL_MAX ) , ymax( -DBL_MAX ) - , mPreparedGeom( 0 ) + , mPreparedGeom( nullptr ) { nbPoints = cHullSize = 0; - x = NULL; - y = NULL; - cHull = NULL; + x = nullptr; + y = nullptr; + cHull = nullptr; type = -1; } PointSet::PointSet( int nbPoints, double *x, double *y ) - : mGeos( 0 ) + : mGeos( nullptr ) , mOwnsGeom( false ) , cHullSize( 0 ) - , holeOf( NULL ) - , parent( NULL ) + , holeOf( nullptr ) + , parent( nullptr ) , xmin( DBL_MAX ) , xmax( -DBL_MAX ) , ymin( DBL_MAX ) , ymax( -DBL_MAX ) - , mPreparedGeom( 0 ) + , mPreparedGeom( nullptr ) { this->nbPoints = nbPoints; this->x = new double[nbPoints]; @@ -86,17 +86,17 @@ namespace pal this->y[i] = y[i]; } type = GEOS_POLYGON; - cHull = NULL; + cHull = nullptr; } PointSet::PointSet( double aX, double aY ) - : mGeos( 0 ) + : mGeos( nullptr ) , mOwnsGeom( false ) , xmin( aX ) , xmax( aY ) , ymin( aX ) , ymax( aY ) - , mPreparedGeom( 0 ) + , mPreparedGeom( nullptr ) { nbPoints = cHullSize = 1; x = new double[1]; @@ -104,22 +104,22 @@ namespace pal x[0] = aX; y[0] = aY; - cHull = NULL; - parent = NULL; - holeOf = NULL; + cHull = nullptr; + parent = nullptr; + holeOf = nullptr; type = GEOS_POINT; } PointSet::PointSet( const PointSet &ps ) - : mGeos( 0 ) + : mGeos( nullptr ) , mOwnsGeom( false ) - , parent( 0 ) + , parent( nullptr ) , xmin( ps.xmin ) , xmax( ps.xmax ) , ymin( ps.ymin ) , ymax( ps.ymax ) - , mPreparedGeom( 0 ) + , mPreparedGeom( nullptr ) { int i; @@ -140,7 +140,7 @@ namespace pal } else { - cHull = NULL; + cHull = nullptr; cHullSize = 0; } @@ -182,7 +182,7 @@ namespace pal switch ( type ) { case GEOS_POLYGON: - mGeos = GEOSGeom_createPolygon_r( geosctxt, GEOSGeom_createLinearRing_r( geosctxt, coord ), 0, 0 ); + mGeos = GEOSGeom_createPolygon_r( geosctxt, GEOSGeom_createLinearRing_r( geosctxt, coord ), nullptr, 0 ); break; case GEOS_LINESTRING: @@ -216,8 +216,8 @@ namespace pal GEOSGeom_destroy_r( geosctxt, mGeos ); GEOSPreparedGeom_destroy_r( geosctxt, mPreparedGeom ); mOwnsGeom = false; - mGeos = 0; - mPreparedGeom = 0; + mGeos = nullptr; + mPreparedGeom = nullptr; } PointSet::~PointSet() @@ -227,7 +227,7 @@ namespace pal if ( mGeos && mOwnsGeom ) { GEOSGeom_destroy_r( geosctxt, mGeos ); - mGeos = NULL; + mGeos = nullptr; } GEOSPreparedGeom_destroy_r( geosctxt, mPreparedGeom ); @@ -241,8 +241,8 @@ namespace pal { delete[] x; delete[] y; - x = NULL; - y = NULL; + x = nullptr; + y = nullptr; } PointSet* PointSet::extractShape( int nbPtSh, int imin, int imax, int fps, int fpe, double fptx, double fpty ) @@ -908,7 +908,7 @@ namespace pal GEOSGeometry* geosPt = GEOSGeom_createPoint_r( geosctxt, coord ); int type = GEOSGeomTypeId_r( geosctxt, mGeos ); - const GEOSGeometry* extRing = 0; + const GEOSGeometry* extRing = nullptr; if ( type != GEOS_POLYGON ) { extRing = mGeos; diff --git a/src/core/pal/pointset.h b/src/core/pal/pointset.h index 39326be06d5..b69e1db62eb 100644 --- a/src/core/pal/pointset.h +++ b/src/core/pal/pointset.h @@ -108,7 +108,7 @@ namespace pal * @param ry pointer to y coorinates of the nearest point (can be NULL) * @returns minimum distance */ - double minDistanceToPoint( double px, double py, double *rx = 0, double *ry = 0 ) const; + double minDistanceToPoint( double px, double py, double *rx = nullptr, double *ry = nullptr ) const; void getCentroid( double &px, double &py, bool forceInside = false ) const; diff --git a/src/core/pal/problem.cpp b/src/core/pal/problem.cpp index 40faa067ea1..6a0f94f1ed3 100644 --- a/src/core/pal/problem.cpp +++ b/src/core/pal/problem.cpp @@ -66,24 +66,24 @@ namespace pal , all_nblp( 0 ) , nbft( 0 ) , displayAll( false ) - , labelPositionCost( NULL ) - , nbOlap( NULL ) - , featStartId( NULL ) - , featNbLp( NULL ) - , inactiveCost( NULL ) - , sol( NULL ) + , labelPositionCost( nullptr ) + , nbOlap( nullptr ) + , featStartId( nullptr ) + , featNbLp( nullptr ) + , inactiveCost( nullptr ) + , sol( nullptr ) , nbActive( 0 ) , nbOverlap( 0.0 ) - , pal( NULL ) + , pal( nullptr ) { bbox[0] = 0; bbox[1] = 0; bbox[2] = 0; bbox[3] = 0; - featWrap = NULL; + featWrap = nullptr; candidates = new RTree(); candidates_sol = new RTree(); - candidates_subsol = NULL; + candidates_subsol = nullptr; } Problem::~Problem() @@ -265,7 +265,7 @@ namespace pal FalpContext *context = new FalpContext(); - context->candidates = NULL; + context->candidates = nullptr; context->list = list; double amin[2]; double amax[2]; @@ -387,7 +387,7 @@ namespace pal { int nbOverlap; int start_p; - LabelPosition* retainedLabel = NULL; + LabelPosition* retainedLabel = nullptr; int p; for ( i = 0; i < nbft; i++ ) // forearch hidden feature @@ -451,7 +451,7 @@ namespace pal clock_t search_time; #endif - SubPart *current = NULL; + SubPart *current = nullptr; #if _VERBOSE_ int subPartTotalSize = 0; @@ -513,7 +513,7 @@ namespace pal if ( i == seed && ok[seed] ) { - current = NULL; // everything is OK :-) + current = nullptr; // everything is OK :-) break; } else @@ -1311,7 +1311,7 @@ namespace pal std::cout << " Conflictual..." << std::endl; #endif int feat, rfeat; - bool sub = ctx->featWrap != NULL; + bool sub = ctx->featWrap != nullptr; feat = lp->getProblemFeatureId(); if ( sub ) @@ -1382,7 +1382,7 @@ namespace pal int next_seed; int retainedLabel; - Chain *retainedChain = NULL; + Chain *retainedChain = nullptr; int max_degree = pal->ejChainDeg; @@ -1403,7 +1403,7 @@ namespace pal context.borderSize = borderSize; context.tmpsol = tmpsol; context.inactiveCost = inactiveCost; - context.feat = NULL; + context.feat = nullptr; context.currentChain = currentChain; context.conflicts = conflicts; context.delta_tmp = &delta_tmp; @@ -1678,7 +1678,7 @@ namespace pal int next_seed; int retainedLabel; - Chain *retainedChain = NULL; + Chain *retainedChain = nullptr; int max_degree = pal->ejChainDeg; @@ -1695,11 +1695,11 @@ namespace pal double amax[2]; ChainContext context; - context.featWrap = NULL; + context.featWrap = nullptr; context.borderSize = 0; context.tmpsol = tmpsol; context.inactiveCost = inactiveCost; - context.feat = NULL; + context.feat = nullptr; context.currentChain = currentChain; context.conflicts = conflicts; context.delta_tmp = &delta_tmp; @@ -1985,7 +1985,7 @@ namespace pal int *tabu_list = new int[subSize]; - Chain *current_chain = NULL; + Chain *current_chain = nullptr; //int itC; @@ -2134,8 +2134,8 @@ namespace pal int *tabu_list = new int[subSize]; - Chain *retainedChain = NULL; - Chain *current_chain = NULL; + Chain *retainedChain = nullptr; + Chain *current_chain = nullptr; int itC; @@ -2199,7 +2199,7 @@ namespace pal #endif while ( it < stop_it ) { - retainedChain = NULL; + retainedChain = nullptr; #ifdef _DEBUG_FULL_ std::cout << std::endl << std::endl << candidateListSize << std::endl; @@ -2481,11 +2481,11 @@ namespace pal NokContext context; context.ok = ok; - context.wrap = NULL; + context.wrap = nullptr; Chain *retainedChain; - featWrap = NULL; + featWrap = nullptr; for ( i = 0; i < nbft; i++ ) { diff --git a/src/core/pal/rtree.hpp b/src/core/pal/rtree.hpp index b597f903ddd..1987490835c 100644 --- a/src/core/pal/rtree.hpp +++ b/src/core/pal/rtree.hpp @@ -370,7 +370,7 @@ namespace pal RTFileStream() { - m_file = NULL; + m_file = nullptr; } ~RTFileStream() @@ -409,7 +409,7 @@ namespace pal if ( m_file ) { fclose( m_file ); - m_file = NULL; + m_file = nullptr; } } @@ -952,10 +952,10 @@ namespace pal newRoot->m_level = ( *a_root )->m_level + 1; branch.m_rect = NodeCover( *a_root ); branch.m_child = *a_root; - AddBranch( &branch, newRoot, NULL ); + AddBranch( &branch, newRoot, nullptr ); branch.m_rect = NodeCover( newNode ); branch.m_child = newNode; - AddBranch( &branch, newRoot, NULL ); + AddBranch( &branch, newRoot, nullptr ); *a_root = newRoot; return true; } @@ -1322,11 +1322,11 @@ namespace pal if ( a_parVars->m_partition[index] == 0 ) { - AddBranch( &a_parVars->m_branchBuf[index], a_nodeA, NULL ); + AddBranch( &a_parVars->m_branchBuf[index], a_nodeA, nullptr ); } else if ( a_parVars->m_partition[index] == 1 ) { - AddBranch( &a_parVars->m_branchBuf[index], a_nodeB, NULL ); + AddBranch( &a_parVars->m_branchBuf[index], a_nodeB, nullptr ); } } } @@ -1416,7 +1416,7 @@ namespace pal ASSERT( *a_root ); Node* tempNode; - ListNode* reInsertList = NULL; + ListNode* reInsertList = nullptr; if ( !RemoveRectRec( a_rect, a_id, *a_root, &reInsertList ) ) { diff --git a/src/core/pal/util.cpp b/src/core/pal/util.cpp index 3a2faaddad2..90cc2e7c7ce 100644 --- a/src/core/pal/util.cpp +++ b/src/core/pal/util.cpp @@ -66,7 +66,7 @@ namespace pal unsigned int n = ( unsigned int ) N, i = n / 2, parent, child; - void *t = NULL; + void *t = nullptr; for ( ;; ) { @@ -144,7 +144,7 @@ namespace pal default: delete final_queue; delete queue; - return NULL; + return nullptr; } } delete queue; diff --git a/src/core/pal/util.h b/src/core/pal/util.h index c97c0455f74..c6a8c0a62fb 100644 --- a/src/core/pal/util.h +++ b/src/core/pal/util.h @@ -52,8 +52,8 @@ namespace pal { public: Feats() - : feature( 0 ) - , shape( 0 ) + : feature( nullptr ) + , shape( nullptr ) , priority( 0 ) {} diff --git a/src/core/qgis.cpp b/src/core/qgis.cpp index f253dd85ce5..5b69f2c182c 100644 --- a/src/core/qgis.cpp +++ b/src/core/qgis.cpp @@ -255,10 +255,10 @@ void *qgsMalloc( size_t size ) if ( size == 0 || long( size ) < 0 ) { QgsDebugMsg( QString( "Negative or zero size %1." ).arg( size ) ); - return NULL; + return nullptr; } void *p = malloc( size ); - if ( p == NULL ) + if ( p == nullptr ) { QgsDebugMsg( QString( "Allocation of %1 bytes failed." ).arg( size ) ); } @@ -270,10 +270,10 @@ void *qgsCalloc( size_t nmemb, size_t size ) if ( nmemb == 0 || long( nmemb ) < 0 || size == 0 || long( size ) < 0 ) { QgsDebugMsg( QString( "Negative or zero nmemb %1 or size %2." ).arg( nmemb ).arg( size ) ); - return NULL; + return nullptr; } void *p = qgsMalloc( nmemb * size ); - if ( p != NULL ) + if ( p != nullptr ) { memset( p, 0, nmemb * size ); } diff --git a/src/core/qgsapplication.cpp b/src/core/qgsapplication.cpp index 317339da005..f9b2c8c6e91 100644 --- a/src/core/qgsapplication.cpp +++ b/src/core/qgsapplication.cpp @@ -768,7 +768,7 @@ void QgsApplication::exitQgis() //Ensure that all remaining deleteLater QObjects are actually deleted before we exit. //This isn't strictly necessary (since we're exiting anyway) but doing so prevents a lot of //LeakSanitiser noise which hides real issues - QgsApplication::sendPostedEvents( 0, QEvent::DeferredDelete ); + QgsApplication::sendPostedEvents( nullptr, QEvent::DeferredDelete ); //delete all registered functions from expression engine (see above comment) QgsExpression::cleanRegisteredFunctions(); @@ -1159,7 +1159,7 @@ bool QgsApplication::createDB( QString *errorMessage ) } char *errmsg; - int res = sqlite3_exec( db, "SELECT epsg FROM tbl_srs LIMIT 0", 0, 0, &errmsg ); + int res = sqlite3_exec( db, "SELECT epsg FROM tbl_srs LIMIT 0", nullptr, nullptr, &errmsg ); if ( res == SQLITE_OK ) { // epsg column exists => need migration @@ -1178,7 +1178,7 @@ bool QgsApplication::createDB( QString *errorMessage ) "deprecated boolean);" "CREATE INDEX idx_srsauthid on tbl_srs(auth_name,auth_id);" "INSERT INTO tbl_srs(srs_id,description,projection_acronym,ellipsoid_acronym,parameters,srid,auth_name,auth_id,is_geo,deprecated) SELECT srs_id,description,projection_acronym,ellipsoid_acronym,parameters,srid,'','',is_geo,0 FROM tbl_srs_bak;" - "DROP TABLE tbl_srs_bak", 0, 0, &errmsg ) != SQLITE_OK + "DROP TABLE tbl_srs_bak", nullptr, nullptr, &errmsg ) != SQLITE_OK ) { if ( errorMessage ) @@ -1195,7 +1195,7 @@ bool QgsApplication::createDB( QString *errorMessage ) sqlite3_free( errmsg ); } - if ( sqlite3_exec( db, "DROP VIEW vw_srs", 0, 0, &errmsg ) != SQLITE_OK ) + if ( sqlite3_exec( db, "DROP VIEW vw_srs", nullptr, nullptr, &errmsg ) != SQLITE_OK ) { QgsDebugMsg( QString( "vw_srs didn't exists in private qgis.db: %1" ).arg( errmsg ) ); } @@ -1213,7 +1213,7 @@ bool QgsApplication::createDB( QString *errorMessage ) ",a.deprecated AS deprecated" " FROM tbl_srs a" " LEFT OUTER JOIN tbl_projection b ON a.projection_acronym=b.acronym" - " ORDER BY coalesce(b.name,a.projection_acronym),a.description", 0, 0, &errmsg ) != SQLITE_OK + " ORDER BY coalesce(b.name,a.projection_acronym),a.description", nullptr, nullptr, &errmsg ) != SQLITE_OK ) { if ( errorMessage ) diff --git a/src/core/qgsapplication.h b/src/core/qgsapplication.h index 8ecd0d82141..d65cae1c914 100644 --- a/src/core/qgsapplication.h +++ b/src/core/qgsapplication.h @@ -224,7 +224,7 @@ class CORE_EXPORT QgsApplication : public QApplication static void initQgis(); //! initialise qgis.db - static bool createDB( QString* errorMessage = 0 ); + static bool createDB( QString* errorMessage = nullptr ); //! Create the users theme folder static bool createThemeFolder( ); diff --git a/src/core/qgsattributeaction.cpp b/src/core/qgsattributeaction.cpp index e616ce0f7cf..6e79599b905 100644 --- a/src/core/qgsattributeaction.cpp +++ b/src/core/qgsattributeaction.cpp @@ -289,7 +289,7 @@ bool QgsAttributeAction::readXML( const QDomNode& layer_node ) return true; } -void ( *QgsAttributeAction::smPythonExecute )( const QString & ) = 0; +void ( *QgsAttributeAction::smPythonExecute )( const QString & ) = nullptr; void QgsAttributeAction::setPythonExecute( void ( *runPython )( const QString & ) ) { diff --git a/src/core/qgsattributeaction.h b/src/core/qgsattributeaction.h index 10a38622ee7..739b771c103 100644 --- a/src/core/qgsattributeaction.h +++ b/src/core/qgsattributeaction.h @@ -174,7 +174,7 @@ class CORE_EXPORT QgsAttributeAction */ QString expandAction( const QString& action, QgsFeature &feat, - const QMap *substitutionMap = 0 ); + const QMap *substitutionMap = nullptr ); //! Writes the actions out in XML format @@ -202,7 +202,7 @@ class CORE_EXPORT QgsAttributeAction static void ( *smPythonExecute )( const QString & ); void runAction( const QgsAction &action, - void ( *executePython )( const QString & ) = 0 ); + void ( *executePython )( const QString & ) = nullptr ); int mDefaultAction; diff --git a/src/core/qgsbrowsermodel.cpp b/src/core/qgsbrowsermodel.cpp index 71abba2c042..ccd32f64df4 100644 --- a/src/core/qgsbrowsermodel.cpp +++ b/src/core/qgsbrowsermodel.cpp @@ -49,8 +49,8 @@ static bool cmpByDataItemName_( QgsDataItem* a, QgsDataItem* b ) QgsBrowserModel::QgsBrowserModel( QObject *parent ) : QAbstractItemModel( parent ) - , mFavourites( 0 ) - , mProjectHome( 0 ) + , mFavourites( nullptr ) + , mProjectHome( nullptr ) { connect( QgsProject::instance(), SIGNAL( readProject( const QDomDocument & ) ), this, SLOT( updateProjectHome() ) ); connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ), this, SLOT( updateProjectHome() ) ); @@ -78,7 +78,7 @@ void QgsBrowserModel::updateProjectHome() endRemoveRows(); } delete mProjectHome; - mProjectHome = home.isNull() ? 0 : new QgsDirectoryItem( NULL, tr( "Project home" ), home, "project:" + home ); + mProjectHome = home.isNull() ? nullptr : new QgsDirectoryItem( nullptr, tr( "Project home" ), home, "project:" + home ); if ( mProjectHome ) { connectItem( mProjectHome ); @@ -94,7 +94,7 @@ void QgsBrowserModel::addRootItems() updateProjectHome(); // give the home directory a prominent second place - QgsDirectoryItem *item = new QgsDirectoryItem( NULL, tr( "Home" ), QDir::homePath(), "home:" + QDir::homePath() ); + QgsDirectoryItem *item = new QgsDirectoryItem( nullptr, tr( "Home" ), QDir::homePath(), "home:" + QDir::homePath() ); QStyle *style = QApplication::style(); QIcon homeIcon( style->standardPixmap( QStyle::SP_DirHomeIcon ) ); item->setIcon( homeIcon ); @@ -102,7 +102,7 @@ void QgsBrowserModel::addRootItems() mRootItems << item; // add favourite directories - mFavourites = new QgsFavouritesItem( NULL, tr( "Favourites" ) ); + mFavourites = new QgsFavouritesItem( nullptr, tr( "Favourites" ) ); if ( mFavourites ) { connectItem( mFavourites ); @@ -117,7 +117,7 @@ void QgsBrowserModel::addRootItems() if ( QgsDirectoryItem::hiddenPath( path ) ) continue; - QgsDirectoryItem *item = new QgsDirectoryItem( NULL, path, path ); + QgsDirectoryItem *item = new QgsDirectoryItem( nullptr, path, path ); connectItem( item ); mRootItems << item; @@ -142,7 +142,7 @@ void QgsBrowserModel::addRootItems() continue; } - QgsDataItem *item = pr->createDataItem( "", NULL ); // empty path -> top level + QgsDataItem *item = pr->createDataItem( "", nullptr ); // empty path -> top level if ( item ) { QgsDebugMsg( "Add new top level item : " + item->name() ); @@ -181,7 +181,7 @@ void QgsBrowserModel::removeRootItems() Qt::ItemFlags QgsBrowserModel::flags( const QModelIndex & index ) const { if ( !index.isValid() ) - return 0; + return nullptr; Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable; @@ -339,7 +339,7 @@ QModelIndex QgsBrowserModel::index( int row, int column, const QModelIndex &pare { QgsDataItem *p = dataItem( parent ); const QVector &items = p ? p->children() : mRootItems; - QgsDataItem *item = items.value( row, 0 ); + QgsDataItem *item = items.value( row, nullptr ); return item ? createIndex( row, column, item ) : QModelIndex(); } diff --git a/src/core/qgsbrowsermodel.h b/src/core/qgsbrowsermodel.h index 8e97dcbbe7b..e45913612a2 100644 --- a/src/core/qgsbrowsermodel.h +++ b/src/core/qgsbrowsermodel.h @@ -46,7 +46,7 @@ class CORE_EXPORT QgsBrowserModel : public QAbstractItemModel Q_OBJECT public: - explicit QgsBrowserModel( QObject *parent = 0 ); + explicit QgsBrowserModel( QObject *parent = nullptr ); ~QgsBrowserModel(); enum ItemDataRole @@ -80,7 +80,7 @@ class CORE_EXPORT QgsBrowserModel : public QAbstractItemModel /** Returns the index of the item in the model specified by the given row, column and parent index. */ virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const override; - QModelIndex findItem( QgsDataItem *item, QgsDataItem *parent = 0 ) const; + QModelIndex findItem( QgsDataItem *item, QgsDataItem *parent = nullptr ) const; /** Returns the parent of the model item with the given index. * If the item has no parent, an invalid QModelIndex is returned. diff --git a/src/core/qgscolorschemeregistry.cpp b/src/core/qgscolorschemeregistry.cpp index dc42da867da..c23f8890e8e 100644 --- a/src/core/qgscolorschemeregistry.cpp +++ b/src/core/qgscolorschemeregistry.cpp @@ -24,10 +24,10 @@ // // Static calls to enforce singleton behaviour // -QgsColorSchemeRegistry *QgsColorSchemeRegistry::mInstance = 0; +QgsColorSchemeRegistry *QgsColorSchemeRegistry::mInstance = nullptr; QgsColorSchemeRegistry *QgsColorSchemeRegistry::instance() { - if ( mInstance == 0 ) + if ( mInstance == nullptr ) { mInstance = new QgsColorSchemeRegistry(); diff --git a/src/core/qgsconditionalstyle.cpp b/src/core/qgsconditionalstyle.cpp index bcd42309402..52cf47da9f3 100644 --- a/src/core/qgsconditionalstyle.cpp +++ b/src/core/qgsconditionalstyle.cpp @@ -104,14 +104,14 @@ bool QgsConditionalLayerStyles::readXml( const QDomNode &node ) QgsConditionalStyle::QgsConditionalStyle() : mValid( false ) - , mSymbol( 0 ) + , mSymbol( nullptr ) , mBackColor( QColor( 0, 0, 0, 0 ) ) , mTextColor( QColor( 0, 0, 0, 0 ) ) {} QgsConditionalStyle::QgsConditionalStyle( const QString& rule ) : mValid( false ) - , mSymbol( 0 ) + , mSymbol( nullptr ) , mBackColor( QColor( 0, 0, 0, 0 ) ) , mTextColor( QColor( 0, 0, 0, 0 ) ) { diff --git a/src/core/qgsconnectionpool.h b/src/core/qgsconnectionpool.h index 698bcb928cb..30424c4f625 100644 --- a/src/core/qgsconnectionpool.h +++ b/src/core/qgsconnectionpool.h @@ -65,7 +65,7 @@ class QgsConnectionPoolGroup QgsConnectionPoolGroup( const QString& ci ) : connInfo( ci ) , sem( CONN_POOL_MAX_CONCURRENT_CONNS ) - , expirationTimer( 0 ) + , expirationTimer( nullptr ) { } @@ -114,7 +114,7 @@ class QgsConnectionPoolGroup { // we didn't get connection for some reason, so release the lock sem.release(); - return 0; + return nullptr; } connMutex.lock(); diff --git a/src/core/qgscontexthelp.cpp b/src/core/qgscontexthelp.cpp index dbf4c98ea8b..cc2a94ed15a 100644 --- a/src/core/qgscontexthelp.cpp +++ b/src/core/qgscontexthelp.cpp @@ -27,7 +27,7 @@ #include "qgslogger.h" -QgsContextHelp *QgsContextHelp::gContextHelp = 0; // Singleton instance +QgsContextHelp *QgsContextHelp::gContextHelp = nullptr; // Singleton instance void QgsContextHelp::run( const QString& context ) { @@ -103,5 +103,5 @@ void QgsContextHelp::processExited() { // Delete this object if the process terminates delete gContextHelp; - gContextHelp = NULL; + gContextHelp = nullptr; } diff --git a/src/core/qgscoordinatereferencesystem.cpp b/src/core/qgscoordinatereferencesystem.cpp index bc89277399b..1a26bb26917 100644 --- a/src/core/qgscoordinatereferencesystem.cpp +++ b/src/core/qgscoordinatereferencesystem.cpp @@ -45,7 +45,7 @@ #include #include -CUSTOM_CRS_VALIDATION QgsCoordinateReferenceSystem::mCustomSrsValidation = NULL; +CUSTOM_CRS_VALIDATION QgsCoordinateReferenceSystem::mCustomSrsValidation = nullptr; //-------------------------- @@ -58,7 +58,7 @@ QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem() , mValidationHint( "" ) , mAxisInverted( false ) { - mCRS = OSRNewSpatialReference( NULL ); + mCRS = OSRNewSpatialReference( nullptr ); } QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( const QString& theDefinition ) @@ -70,7 +70,7 @@ QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( const QString& theDe , mValidationHint( "" ) , mAxisInverted( false ) { - mCRS = OSRNewSpatialReference( NULL ); + mCRS = OSRNewSpatialReference( nullptr ); createFromString( theDefinition ); } @@ -84,7 +84,7 @@ QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( const long theId, Cr , mValidationHint( "" ) , mAxisInverted( false ) { - mCRS = OSRNewSpatialReference( NULL ); + mCRS = OSRNewSpatialReference( nullptr ); createFromId( theId, theType ); } @@ -161,8 +161,8 @@ bool QgsCoordinateReferenceSystem::createFromString( const QString &theDefinitio bool QgsCoordinateReferenceSystem::createFromUserInput( const QString &theDefinition ) { QString theWkt; - char *wkt = NULL; - OGRSpatialReferenceH crs = OSRNewSpatialReference( NULL ); + char *wkt = nullptr; + OGRSpatialReferenceH crs = OSRNewSpatialReference( nullptr ); // make sure towgs84 parameter is loaded if using an ESRI definition and gdal >= 1.9 #if GDAL_VERSION_NUM >= 1900 @@ -257,7 +257,7 @@ bool QgsCoordinateReferenceSystem::createFromOgcWmsCrs( QString theCrs ) QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( const QgsCoordinateReferenceSystem &srs ) { - mCRS = OSRNewSpatialReference( NULL ); + mCRS = OSRNewSpatialReference( nullptr ); *this = srs; } @@ -383,7 +383,7 @@ bool QgsCoordinateReferenceSystem::loadFromDb( const QString& db, const QString& else if ( mAuthId.startsWith( "EPSG:", Qt::CaseInsensitive ) ) { OSRDestroySpatialReference( mCRS ); - mCRS = OSRNewSpatialReference( NULL ); + mCRS = OSRNewSpatialReference( nullptr ); mIsValidFlag = OSRSetFromUserInput( mCRS, mAuthId.toLower().toAscii() ) == OGRERR_NONE; setMapUnits(); } @@ -412,7 +412,7 @@ bool QgsCoordinateReferenceSystem::axisInverted() const // If axis orientation is unknown, try again with OSRImportFromEPSGA for EPSG crs if ( orientation == OAO_Other && mAuthId.startsWith( "EPSG:", Qt::CaseInsensitive ) ) { - OGRSpatialReferenceH crs = OSRNewSpatialReference( NULL ); + OGRSpatialReferenceH crs = OSRNewSpatialReference( nullptr ); if ( OSRImportFromEPSGA( crs, mAuthId.mid( 5 ).toInt() ) == OGRERR_NONE ) { @@ -458,8 +458,8 @@ bool QgsCoordinateReferenceSystem::createFromWkt( const QString &theWkt ) if ( OSRAutoIdentifyEPSG( mCRS ) == OGRERR_NONE ) { QString authid = QString( "%1:%2" ) - .arg( OSRGetAuthorityName( mCRS, NULL ), - OSRGetAuthorityCode( mCRS, NULL ) ); + .arg( OSRGetAuthorityName( mCRS, nullptr ), + OSRGetAuthorityCode( mCRS, nullptr ) ); QgsDebugMsg( "authid recognized as " + authid ); return createFromOgcWmsCrs( authid ); } @@ -469,7 +469,7 @@ bool QgsCoordinateReferenceSystem::createFromWkt( const QString &theWkt ) //myOgrSpatialRef.morphFromESRI(); // create the proj4 structs needed for transforming - char *proj4src = NULL; + char *proj4src = nullptr; OSRExportToProj4( mCRS, &proj4src ); //now that we have the proj4string, delegate to createFromProj4 so @@ -879,7 +879,7 @@ QString QgsCoordinateReferenceSystem::toProj4() const if ( mProj4.isEmpty() ) { - char *proj4src = NULL; + char *proj4src = nullptr; OSRExportToProj4( mCRS, &proj4src ); mProj4 = proj4src; CPLFree( proj4src ); @@ -925,7 +925,7 @@ void QgsCoordinateReferenceSystem::setProj4String( const QString& theProj4String QgsLocaleNumC l; OSRDestroySpatialReference( mCRS ); - mCRS = OSRNewSpatialReference( NULL ); + mCRS = OSRNewSpatialReference( nullptr ); mIsValidFlag = OSRImportFromProj4( mCRS, theProj4String.trimmed().toLatin1().constData() ) == OGRERR_NONE; mWkt.clear(); setMapUnits(); @@ -1347,7 +1347,7 @@ QString QgsCoordinateReferenceSystem::proj4FromSrsId( const int theSrsId ) if ( !myFileInfo.exists() ) //its unlikely that this condition will ever be reached { QgsDebugMsg( "users qgis.db not found" ); - return NULL; + return nullptr; } } else //must be a system projection then @@ -1390,7 +1390,7 @@ int QgsCoordinateReferenceSystem::openDb( const QString& path, sqlite3 **db, boo { QgsDebugMsgLevel( "path = " + path, 3 ); int myResult = readonly - ? sqlite3_open_v2( path.toUtf8().data(), db, SQLITE_OPEN_READONLY, NULL ) + ? sqlite3_open_v2( path.toUtf8().data(), db, SQLITE_OPEN_READONLY, nullptr ) : sqlite3_open( path.toUtf8().data(), db ); if ( myResult != SQLITE_OK ) @@ -1541,7 +1541,7 @@ long QgsCoordinateReferenceSystem::getRecordCount() int myResult; long myRecordCount = 0; //check the db is available - myResult = sqlite3_open_v2( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL ); + myResult = sqlite3_open_v2( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, nullptr ); if ( myResult != SQLITE_OK ) { QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) ); @@ -1622,7 +1622,7 @@ bool QgsCoordinateReferenceSystem::loadWkts( QHash &wkts, const ch bool QgsCoordinateReferenceSystem::loadIDs( QHash &wkts ) { - OGRSpatialReferenceH crs = OSRNewSpatialReference( NULL ); + OGRSpatialReferenceH crs = OSRNewSpatialReference( nullptr ); Q_FOREACH ( const QString& csv, QStringList() << "gcs.csv" << "pcs.csv" << "vertcs.csv" << "compdcs.csv" << "geoccs.csv" ) { @@ -1666,7 +1666,7 @@ bool QgsCoordinateReferenceSystem::loadIDs( QHash &wkts ) continue; } - char *wkt = 0; + char *wkt = nullptr; if ( OSRExportToWkt( crs, &wkt ) != OGRERR_NONE ) { qWarning( "EPSG %d: not exported to WKT", epsg ); @@ -1705,22 +1705,22 @@ int QgsCoordinateReferenceSystem::syncDb() return -1; } - if ( sqlite3_exec( database, "BEGIN TRANSACTION", 0, 0, 0 ) != SQLITE_OK ) + if ( sqlite3_exec( database, "BEGIN TRANSACTION", nullptr, nullptr, nullptr ) != SQLITE_OK ) { qCritical( "Could not begin transaction: %s [%s]\n", QgsApplication::srsDbFilePath().toLocal8Bit().constData(), sqlite3_errmsg( database ) ); return -1; } // fix up database, if not done already // - if ( sqlite3_exec( database, "alter table tbl_srs add noupdate boolean", 0, 0, 0 ) == SQLITE_OK ) - ( void )sqlite3_exec( database, "update tbl_srs set noupdate=(auth_name='EPSG' and auth_id in (5513,5514,5221,2065,102067,4156,4818))", 0, 0, 0 ); + if ( sqlite3_exec( database, "alter table tbl_srs add noupdate boolean", nullptr, nullptr, nullptr ) == SQLITE_OK ) + ( void )sqlite3_exec( database, "update tbl_srs set noupdate=(auth_name='EPSG' and auth_id in (5513,5514,5221,2065,102067,4156,4818))", nullptr, 0, 0 ); - ( void )sqlite3_exec( database, "UPDATE tbl_srs SET srid=141001 WHERE srid=41001 AND auth_name='OSGEO' AND auth_id='41001'", 0, 0, 0 ); + ( void )sqlite3_exec( database, "UPDATE tbl_srs SET srid=141001 WHERE srid=41001 AND auth_name='OSGEO' AND auth_id='41001'", nullptr, 0, 0 ); - OGRSpatialReferenceH crs = OSRNewSpatialReference( NULL ); + OGRSpatialReferenceH crs = OSRNewSpatialReference( nullptr ); const char *tail; sqlite3_stmt *select; - char *errMsg = NULL; + char *errMsg = nullptr; QString proj4; QString sql; @@ -1771,10 +1771,10 @@ int QgsCoordinateReferenceSystem::syncDb() { if ( proj4 != srsProj4 ) { - errMsg = NULL; + errMsg = nullptr; sql = QString( "UPDATE tbl_srs SET parameters=%1 WHERE auth_name='EPSG' AND auth_id=%2" ).arg( quotedValue( proj4 ) ).arg( it.key() ); - if ( sqlite3_exec( database, sql.toUtf8(), 0, 0, &errMsg ) != SQLITE_OK ) + if ( sqlite3_exec( database, sql.toUtf8(), nullptr, nullptr, &errMsg ) != SQLITE_OK ) { qCritical( "Could not execute: %s [%s/%s]\n", sql.toLocal8Bit().constData(), @@ -1817,8 +1817,8 @@ int QgsCoordinateReferenceSystem::syncDb() .arg( it.key() ) .arg( OSRIsGeographic( crs ) ); - errMsg = NULL; - if ( sqlite3_exec( database, sql.toUtf8(), 0, 0, &errMsg ) == SQLITE_OK ) + errMsg = nullptr; + if ( sqlite3_exec( database, sql.toUtf8(), nullptr, nullptr, &errMsg ) == SQLITE_OK ) { inserted++; } @@ -1845,7 +1845,7 @@ int QgsCoordinateReferenceSystem::syncDb() } sql += ") AND NOT noupdate"; - if ( sqlite3_exec( database, sql.toUtf8(), 0, 0, 0 ) == SQLITE_OK ) + if ( sqlite3_exec( database, sql.toUtf8(), nullptr, nullptr, nullptr ) == SQLITE_OK ) { deleted = sqlite3_changes( database ); } @@ -1897,7 +1897,7 @@ int QgsCoordinateReferenceSystem::syncDb() quotedValue( auth_name ), quotedValue( auth_id ) ); - if ( sqlite3_exec( database, sql.toUtf8(), 0, 0, &errMsg ) == SQLITE_OK ) + if ( sqlite3_exec( database, sql.toUtf8(), nullptr, nullptr, &errMsg ) == SQLITE_OK ) { updated++; QgsDebugMsgLevel( QString( "SQL: %1\n OLD:%2\n NEW:%3" ).arg( sql, params, proj4 ), 3 ); @@ -1936,7 +1936,7 @@ int QgsCoordinateReferenceSystem::syncDb() OSRDestroySpatialReference( crs ); - if ( sqlite3_exec( database, "COMMIT", 0, 0, 0 ) != SQLITE_OK ) + if ( sqlite3_exec( database, "COMMIT", nullptr, nullptr, nullptr ) != SQLITE_OK ) { qCritical( "Could not commit transaction: %s [%s]\n", QgsApplication::srsDbFilePath().toLocal8Bit().constData(), sqlite3_errmsg( database ) ); return -1; @@ -2067,7 +2067,7 @@ bool QgsCoordinateReferenceSystem::syncDatumTransform( const QString& dbPath ) return false; } - if ( sqlite3_exec( db, "BEGIN TRANSACTION", 0, 0, 0 ) != SQLITE_OK ) + if ( sqlite3_exec( db, "BEGIN TRANSACTION", nullptr, nullptr, nullptr ) != SQLITE_OK ) { qCritical( "Could not begin transaction: %s [%s]\n", QgsApplication::srsDbFilePath().toLocal8Bit().constData(), sqlite3_errmsg( db ) ); sqlite3_close( db ); @@ -2111,7 +2111,7 @@ bool QgsCoordinateReferenceSystem::syncDatumTransform( const QString& dbPath ) sqlite3_stmt *stmt; QString cOpCode; QString sql = QString( "SELECT coord_op_code FROM tbl_datum_transform WHERE coord_op_code=%1" ).arg( v[ idxid ] ); - int prepareRes = sqlite3_prepare( db, sql.toAscii(), sql.size(), &stmt, NULL ); + int prepareRes = sqlite3_prepare( db, sql.toAscii(), sql.size(), &stmt, nullptr ); if ( prepareRes != SQLITE_OK ) continue; @@ -2127,14 +2127,14 @@ bool QgsCoordinateReferenceSystem::syncDatumTransform( const QString& dbPath ) sql = sql.arg( v[i] ); } - if ( sqlite3_exec( db, sql.toUtf8(), 0, 0, 0 ) != SQLITE_OK ) + if ( sqlite3_exec( db, sql.toUtf8(), nullptr, nullptr, nullptr ) != SQLITE_OK ) { qCritical( "SQL: %s", sql.toUtf8().constData() ); qCritical( "Error: %s", sqlite3_errmsg( db ) ); } } - if ( sqlite3_exec( db, "COMMIT", 0, 0, 0 ) != SQLITE_OK ) + if ( sqlite3_exec( db, "COMMIT", nullptr, nullptr, nullptr ) != SQLITE_OK ) { qCritical( "Could not commit transaction: %s [%s]\n", QgsApplication::srsDbFilePath().toLocal8Bit().constData(), sqlite3_errmsg( db ) ); return false; diff --git a/src/core/qgscoordinatetransform.cpp b/src/core/qgscoordinatetransform.cpp index 4348d97cc3e..67b8c2c2ed1 100644 --- a/src/core/qgscoordinatetransform.cpp +++ b/src/core/qgscoordinatetransform.cpp @@ -41,8 +41,8 @@ QgsCoordinateTransform::QgsCoordinateTransform() : QObject() , mShortCircuit( false ) , mInitialisedFlag( false ) - , mSourceProjection( 0 ) - , mDestinationProjection( 0 ) + , mSourceProjection( nullptr ) + , mDestinationProjection( nullptr ) , mSourceDatumTransform( -1 ) , mDestinationDatumTransform( -1 ) { @@ -53,8 +53,8 @@ QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSyst : QObject() , mShortCircuit( false ) , mInitialisedFlag( false ) - , mSourceProjection( 0 ) - , mDestinationProjection( 0 ) + , mSourceProjection( nullptr ) + , mDestinationProjection( nullptr ) , mSourceDatumTransform( -1 ) , mDestinationDatumTransform( -1 ) { @@ -69,8 +69,8 @@ QgsCoordinateTransform::QgsCoordinateTransform( long theSourceSrsId, long theDes , mInitialisedFlag( false ) , mSourceCRS( theSourceSrsId, QgsCoordinateReferenceSystem::InternalCrsId ) , mDestCRS( theDestSrsId, QgsCoordinateReferenceSystem::InternalCrsId ) - , mSourceProjection( 0 ) - , mDestinationProjection( 0 ) + , mSourceProjection( nullptr ) + , mDestinationProjection( nullptr ) , mSourceDatumTransform( -1 ) , mDestinationDatumTransform( -1 ) { @@ -80,8 +80,8 @@ QgsCoordinateTransform::QgsCoordinateTransform( long theSourceSrsId, long theDes QgsCoordinateTransform::QgsCoordinateTransform( const QString& theSourceCRS, const QString& theDestCRS ) : QObject() , mInitialisedFlag( false ) - , mSourceProjection( 0 ) - , mDestinationProjection( 0 ) + , mSourceProjection( nullptr ) + , mDestinationProjection( nullptr ) , mSourceDatumTransform( -1 ) , mDestinationDatumTransform( -1 ) { @@ -100,8 +100,8 @@ QgsCoordinateTransform::QgsCoordinateTransform( long theSourceSrid, QgsCoordinateReferenceSystem::CrsType theSourceCRSType ) : QObject() , mInitialisedFlag( false ) - , mSourceProjection( 0 ) - , mDestinationProjection( 0 ) + , mSourceProjection( nullptr ) + , mDestinationProjection( nullptr ) , mSourceDatumTransform( -1 ) , mDestinationDatumTransform( -1 ) { @@ -679,8 +679,8 @@ void QgsCoordinateTransform::transformCoords( const int& numPoints, double *x, d } else { - Q_ASSERT( mSourceProjection != 0 ); - Q_ASSERT( mDestinationProjection != 0 ); + Q_ASSERT( mSourceProjection != nullptr ); + Q_ASSERT( mDestinationProjection != nullptr ); projResult = pj_transform( mSourceProjection, mDestinationProjection, numPoints, 0, x, y, z ); } @@ -912,7 +912,7 @@ void QgsCoordinateTransform::searchDatumTransform( const QString& sql, QList< in } sqlite3_stmt* stmt; - int prepareRes = sqlite3_prepare( db, sql.toAscii(), sql.size(), &stmt, NULL ); + int prepareRes = sqlite3_prepare( db, sql.toAscii(), sql.size(), &stmt, nullptr ); if ( prepareRes != SQLITE_OK ) { sqlite3_finalize( stmt ); sqlite3_close( db ); @@ -942,7 +942,7 @@ QString QgsCoordinateTransform::datumTransformString( int datumTransform ) sqlite3_stmt* stmt; QString sql = QString( "SELECT coord_op_method_code,p1,p2,p3,p4,p5,p6,p7 FROM tbl_datum_transform WHERE coord_op_code=%1" ).arg( datumTransform ); - int prepareRes = sqlite3_prepare( db, sql.toAscii(), sql.size(), &stmt, NULL ); + int prepareRes = sqlite3_prepare( db, sql.toAscii(), sql.size(), &stmt, nullptr ); if ( prepareRes != SQLITE_OK ) { sqlite3_finalize( stmt ); sqlite3_close( db ); @@ -994,7 +994,7 @@ bool QgsCoordinateTransform::datumTransformCrsInfo( int datumTransform, int& eps sqlite3_stmt* stmt; QString sql = QString( "SELECT epsg_nr,source_crs_code,target_crs_code,remarks,scope,preferred,deprecated FROM tbl_datum_transform WHERE coord_op_code=%1" ).arg( datumTransform ); - int prepareRes = sqlite3_prepare( db, sql.toAscii(), sql.size(), &stmt, NULL ); + int prepareRes = sqlite3_prepare( db, sql.toAscii(), sql.size(), &stmt, nullptr ); if ( prepareRes != SQLITE_OK ) { sqlite3_finalize( stmt ); sqlite3_close( db ); diff --git a/src/core/qgscredentials.cpp b/src/core/qgscredentials.cpp index 3fcc297b520..72d2f8a755d 100644 --- a/src/core/qgscredentials.cpp +++ b/src/core/qgscredentials.cpp @@ -18,7 +18,7 @@ #include -QgsCredentials *QgsCredentials::smInstance = 0; +QgsCredentials *QgsCredentials::smInstance = nullptr; void QgsCredentials::setInstance( QgsCredentials *theInstance ) { diff --git a/src/core/qgsdatadefined.cpp b/src/core/qgsdatadefined.cpp index 84494f1c5b8..b94186cb5cd 100644 --- a/src/core/qgsdatadefined.cpp +++ b/src/core/qgsdatadefined.cpp @@ -56,7 +56,7 @@ QgsDataDefined* QgsDataDefined::fromMap( const QgsStringMap &map, const QString if ( !map.contains( QString( "%1expression" ).arg( prefix ) ) ) { //requires at least the expression value - return 0; + return nullptr; } bool active = ( map.value( QString( "%1active" ).arg( prefix ), "1" ) != QLatin1String( "0" ) ); diff --git a/src/core/qgsdatadefined_p.h b/src/core/qgsdatadefined_p.h index 5a06763ae0b..14d661b3d0e 100644 --- a/src/core/qgsdatadefined_p.h +++ b/src/core/qgsdatadefined_p.h @@ -40,7 +40,7 @@ class QgsDataDefinedPrivate : public QSharedData bool useExpression = false, const QString& expressionString = QString(), const QString& field = QString() ) - : expression( 0 ) + : expression( nullptr ) , active( active ) , useExpression( useExpression ) , expressionString( expressionString ) @@ -51,7 +51,7 @@ class QgsDataDefinedPrivate : public QSharedData QgsDataDefinedPrivate( const QgsDataDefinedPrivate& other ) : QSharedData( other ) - , expression( 0 ) + , expression( nullptr ) , active( other.active ) , useExpression( other.useExpression ) , expressionString( other.expressionString ) diff --git a/src/core/qgsdataitem.cpp b/src/core/qgsdataitem.cpp index 7cb5bbccb17..549ac7827a4 100644 --- a/src/core/qgsdataitem.cpp +++ b/src/core/qgsdataitem.cpp @@ -46,7 +46,7 @@ QgsAnimatedIcon::QgsAnimatedIcon( const QString & iconPath ) : QObject() , mCount( 0 ) - , mMovie( 0 ) + , mMovie( nullptr ) { // QApplication as parent to ensure that it is deleted before QApplication mMovie = new QMovie( QApplication::instance() ); @@ -204,7 +204,7 @@ const QIcon &QgsZipItem::iconZip() QMap QgsDataItem::mIconMap = QMap(); -QgsAnimatedIcon * QgsDataItem::mPopulatingIcon = 0; +QgsAnimatedIcon * QgsDataItem::mPopulatingIcon = nullptr; QgsDataItem::QgsDataItem( QgsDataItem::Type type, QgsDataItem* parent, const QString& name, const QString& path ) // Do not pass parent to QObject, Qt would delete this when parent is deleted @@ -217,7 +217,7 @@ QgsDataItem::QgsDataItem( QgsDataItem::Type type, QgsDataItem* parent, const QSt , mName( name ) , mPath( path ) , mDeferredDelete( false ) - , mFutureWatcher( 0 ) + , mFutureWatcher( nullptr ) { } @@ -251,7 +251,7 @@ QString QgsDataItem::pathComponent( const QString &string ) void QgsDataItem::deleteLater() { QgsDebugMsg( "path = " + path() ); - setParent( 0 ); // also disconnects parent + setParent( nullptr ); // also disconnects parent Q_FOREACH ( QgsDataItem *child, mChildren ) { if ( !child ) // should not happen @@ -290,7 +290,7 @@ void QgsDataItem::moveToThread( QThread * targetThread ) if ( !child ) // should not happen continue; QgsDebugMsg( "moveToThread child " + child->path() ); - child->QObject::setParent( 0 ); // to be sure + child->QObject::setParent( nullptr ); // to be sure child->moveToThread( targetThread ); } QObject::moveToThread( targetThread ); @@ -527,7 +527,7 @@ void QgsDataItem::setParent( QgsDataItem* parent ) { if ( mParent ) { - disconnect( this, 0, mParent, 0 ); + disconnect( this, nullptr, mParent, nullptr ); } if ( parent ) { @@ -600,7 +600,7 @@ QgsDataItem * QgsDataItem::removeChildItem( QgsDataItem * child ) emit beginRemoveItems( this, i, i ); mChildren.remove( i ); emit endRemoveItems(); - child->setParent( 0 ); + child->setParent( nullptr ); return child; } @@ -741,7 +741,7 @@ Q_NOWARN_DEPRECATED_POP QgsDirectoryItem::QgsDirectoryItem( QgsDataItem* parent, const QString& name, const QString& path ) : QgsDataCollectionItem( parent, name, path ) , mDirPath( path ) - , mFileSystemWatcher( 0 ) + , mFileSystemWatcher( nullptr ) , mRefreshLater( false ) { mType = Directory; @@ -751,7 +751,7 @@ QgsDirectoryItem::QgsDirectoryItem( QgsDataItem* parent, const QString& name, co QgsDirectoryItem::QgsDirectoryItem( QgsDataItem* parent, const QString& name, const QString& dirPath, const QString& path ) : QgsDataCollectionItem( parent, name, path ) , mDirPath( dirPath ) - , mFileSystemWatcher( 0 ) + , mFileSystemWatcher( nullptr ) , mRefreshLater( false ) { mType = Directory; @@ -872,7 +872,7 @@ void QgsDirectoryItem::setState( State state ) if ( mFileSystemWatcher ) { delete mFileSystemWatcher; - mFileSystemWatcher = 0; + mFileSystemWatcher = nullptr; } } } @@ -1251,9 +1251,9 @@ QgsZipItem::~QgsZipItem() char **VSIReadDirRecursive1( const char *pszPath ) { // CPLStringList oFiles = NULL; - char **papszOFiles = NULL; - char **papszFiles1 = NULL; - char **papszFiles2 = NULL; + char **papszOFiles = nullptr; + char **papszFiles1 = nullptr; + char **papszFiles2 = nullptr; VSIStatBufL psStatBuf; CPLString osTemp1, osTemp2; int i, j; @@ -1262,7 +1262,7 @@ char **VSIReadDirRecursive1( const char *pszPath ) // get listing papszFiles1 = VSIReadDir( pszPath ); if ( ! papszFiles1 ) - return NULL; + return nullptr; // get files and directories inside listing nCount1 = CSLCount( papszFiles1 ); @@ -1398,18 +1398,18 @@ QgsDataItem* QgsZipItem::itemFromPath( QgsDataItem* parent, const QString& fileP QStringList zipFileList; QFileInfo fileInfo( filePath ); QString vsiPrefix = QgsZipItem::vsiPrefix( filePath ); - QgsZipItem * zipItem = 0; + QgsZipItem * zipItem = nullptr; bool populated = false; QgsDebugMsgLevel( QString( "path = %1 name= %2 scanZipSetting= %3 vsiPrefix= %4" ).arg( path, name, scanZipSetting, vsiPrefix ), 3 ); // don't scan if scanZipBrowser == no if ( scanZipSetting == "no" ) - return 0; + return nullptr; // don't scan if this file is not a /vsizip/ or /vsitar/ item if (( vsiPrefix != "/vsizip/" && vsiPrefix != "/vsitar/" ) ) - return 0; + return nullptr; zipItem = new QgsZipItem( parent, name, filePath, path ); @@ -1471,7 +1471,7 @@ QgsDataItem* QgsZipItem::itemFromPath( QgsDataItem* parent, const QString& fileP dataItem_t *dataItem = mDataItemPtr[i]; if ( dataItem ) { - QgsDataItem *item = 0; + QgsDataItem *item = nullptr; // try first with normal path (Passthru) // this is to simplify .qml handling, and without this some tests will fail // (e.g. testZipItemVectorTransparency(), second test) @@ -1487,7 +1487,7 @@ QgsDataItem* QgsZipItem::itemFromPath( QgsDataItem* parent, const QString& fileP } } - return 0; + return nullptr; } const QStringList &QgsZipItem::getZipFileList() diff --git a/src/core/qgsdataitem.h b/src/core/qgsdataitem.h index 86b921394c3..1509d497d79 100644 --- a/src/core/qgsdataitem.h +++ b/src/core/qgsdataitem.h @@ -132,7 +132,7 @@ class CORE_EXPORT QgsDataItem : public QObject virtual bool equal( const QgsDataItem *other ); - virtual QWidget *paramWidget() { return 0; } + virtual QWidget *paramWidget() { return nullptr; } // list of actions provided by this item - usually used for popup menu on right-click virtual QList actions() { return QList(); } @@ -466,7 +466,7 @@ class CORE_EXPORT QgsDirectoryParamWidget : public QTreeWidget Q_OBJECT public: - QgsDirectoryParamWidget( const QString& path, QWidget* parent = NULL ); + QgsDirectoryParamWidget( const QString& path, QWidget* parent = nullptr ); protected: void mousePressEvent( QMouseEvent* event ) override; diff --git a/src/core/qgsdatumtransformstore.cpp b/src/core/qgsdatumtransformstore.cpp index bea73471846..07dd96d4e1b 100644 --- a/src/core/qgsdatumtransformstore.cpp +++ b/src/core/qgsdatumtransformstore.cpp @@ -53,14 +53,14 @@ bool QgsDatumTransformStore::hasEntryForLayer( QgsMapLayer* layer ) const const QgsCoordinateTransform* QgsDatumTransformStore::transformation( QgsMapLayer* layer ) const { if ( !layer ) - return 0; + return nullptr; QString srcAuthId = layer->crs().authid(); QString dstAuthId = mDestCRS.authid(); if ( srcAuthId == dstAuthId ) { - return 0; + return nullptr; } QHash< QString, Entry >::const_iterator ctIt = mEntries.find( layer->id() ); diff --git a/src/core/qgsdbfilterproxymodel.h b/src/core/qgsdbfilterproxymodel.h index ec239fd9fff..c60565dfdfa 100644 --- a/src/core/qgsdbfilterproxymodel.h +++ b/src/core/qgsdbfilterproxymodel.h @@ -27,7 +27,7 @@ class CORE_EXPORT QgsDbFilterProxyModel: public QSortFilterProxyModel Q_OBJECT public: - QgsDbFilterProxyModel( QObject* parent = 0 ); + QgsDbFilterProxyModel( QObject* parent = nullptr ); ~QgsDbFilterProxyModel(); /** Calls QSortFilterProxyModel::setFilterWildcard and triggers update*/ void _setFilterWildcard( const QString& pattern ); diff --git a/src/core/qgsdiagramrendererv2.cpp b/src/core/qgsdiagramrendererv2.cpp index c8fd8ec786c..c655e3ef795 100644 --- a/src/core/qgsdiagramrendererv2.cpp +++ b/src/core/qgsdiagramrendererv2.cpp @@ -30,9 +30,9 @@ QgsDiagramLayerSettings::QgsDiagramLayerSettings() , priority( 5 ) , obstacle( false ) , dist( 0.0 ) - , renderer( 0 ) - , ct( 0 ) - , xform( 0 ) + , renderer( nullptr ) + , ct( nullptr ) + , xform( nullptr ) , xPosColumn( -1 ) , yPosColumn( -1 ) , showAll( true ) @@ -295,7 +295,7 @@ void QgsDiagramSettings::writeXML( QDomElement& rendererElem, QDomDocument& doc, } QgsDiagramRendererV2::QgsDiagramRendererV2() - : mDiagram( 0 ) + : mDiagram( nullptr ) { } @@ -311,7 +311,7 @@ void QgsDiagramRendererV2::setDiagram( QgsDiagram* d ) } QgsDiagramRendererV2::QgsDiagramRendererV2( const QgsDiagramRendererV2& other ) - : mDiagram( other.mDiagram ? other.mDiagram->clone() : 0 ) + : mDiagram( other.mDiagram ? other.mDiagram->clone() : nullptr ) { } @@ -392,7 +392,7 @@ void QgsDiagramRendererV2::_readXML( const QDomElement& elem, const QgsVectorLay } else { - mDiagram = 0; + mDiagram = nullptr; } } @@ -553,7 +553,7 @@ QList< QgsLayerTreeModelLegendNode* > QgsDiagramSettings::legendItems( QgsLayerT { QPixmap pix( 16, 16 ); pix.fill( categoryColors[i] ); - list << new QgsSimpleLegendNode( nodeLayer, categoryLabels[i], QIcon( pix ), 0, QString( "diagram_%1" ).arg( QString::number( i ) ) ); + list << new QgsSimpleLegendNode( nodeLayer, categoryLabels[i], QIcon( pix ), nullptr, QString( "diagram_%1" ).arg( QString::number( i ) ) ); } return list; } diff --git a/src/core/qgsdistancearea.cpp b/src/core/qgsdistancearea.cpp index 6b71f7583ea..11097f6bdad 100644 --- a/src/core/qgsdistancearea.cpp +++ b/src/core/qgsdistancearea.cpp @@ -56,7 +56,7 @@ QgsDistanceArea::QgsDistanceArea() //! Copy constructor QgsDistanceArea::QgsDistanceArea( const QgsDistanceArea & origDA ) - : mCoordTransform( 0 ) + : mCoordTransform( nullptr ) { _copy( origDA ); } @@ -158,7 +158,7 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid ) // Continue with PROJ.4 list of ellipsoids. //check the db is available - myResult = sqlite3_open_v2( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL ); + myResult = sqlite3_open_v2( QgsApplication::srsDbFilePath().toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, nullptr ); if ( myResult ) { QgsMessageLog::logMessage( QObject::tr( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) ); @@ -534,7 +534,7 @@ const unsigned char *QgsDistanceArea::measurePolygon( const unsigned char* featu if ( !feature ) { QgsDebugMsg( "no feature to measure" ); - return 0; + return nullptr; } QgsConstWkbPtr wkbPtr( feature + 1 + sizeof( int ) ); @@ -546,7 +546,7 @@ const unsigned char *QgsDistanceArea::measurePolygon( const unsigned char* featu if ( numRings == 0 ) { QgsDebugMsg( "no rings to measure" ); - return 0; + return nullptr; } // Set pointer to the first ring diff --git a/src/core/qgsdistancearea.h b/src/core/qgsdistancearea.h index c35ec8044d3..7cabbbac243 100644 --- a/src/core/qgsdistancearea.h +++ b/src/core/qgsdistancearea.h @@ -161,7 +161,7 @@ class CORE_EXPORT QgsDistanceArea @return distance in meters */ double computeDistanceBearing( const QgsPoint& p1, const QgsPoint& p2, - double* course1 = NULL, double* course2 = NULL ) const; + double* course1 = nullptr, double* course2 = nullptr ) const; //! uses flat / planimetric / Euclidean distance double computeDistanceFlat( const QgsPoint& p1, const QgsPoint& p2 ) const; diff --git a/src/core/qgseditformconfig.cpp b/src/core/qgseditformconfig.cpp index e454b7d8530..7141b69c2f8 100644 --- a/src/core/qgseditformconfig.cpp +++ b/src/core/qgseditformconfig.cpp @@ -326,7 +326,7 @@ void QgsEditFormConfig::writeXml( QDomNode& node ) const QgsAttributeEditorElement* QgsEditFormConfig::attributeEditorElementFromDomElement( QDomElement &elem, QObject* parent ) { - QgsAttributeEditorElement* newElement = NULL; + QgsAttributeEditorElement* newElement = nullptr; if ( elem.tagName() == "attributeEditorContainer" ) { diff --git a/src/core/qgseditformconfig.h b/src/core/qgseditformconfig.h index 4c6a2a62ff3..626c5b582e3 100644 --- a/src/core/qgseditformconfig.h +++ b/src/core/qgseditformconfig.h @@ -52,7 +52,7 @@ class CORE_EXPORT QgsAttributeEditorElement : public QObject * @param name * @param parent */ - QgsAttributeEditorElement( AttributeEditorType type, const QString& name, QObject *parent = NULL ) + QgsAttributeEditorElement( AttributeEditorType type, const QString& name, QObject *parent = nullptr ) : QObject( parent ), mType( type ), mName( name ) {} //! Destructor @@ -578,7 +578,7 @@ class CORE_EXPORT QgsEditFormConfig : public QObject /** * Create a new edit form config. Normally invoked by QgsVectorLayer */ - explicit QgsEditFormConfig( QObject* parent = 0 ); + explicit QgsEditFormConfig( QObject* parent = nullptr ); private: diff --git a/src/core/qgsexpression.cpp b/src/core/qgsexpression.cpp index 5686f535ca7..94b59f83903 100644 --- a/src/core/qgsexpression.cpp +++ b/src/core/qgsexpression.cpp @@ -364,7 +364,7 @@ static QgsExpression::Node* getNode( const QVariant& value, QgsExpression* paren return value.value(); parent->setEvalErrorString( "Cannot convert to Node" ); - return 0; + return nullptr; } // this handles also NULL values @@ -2944,7 +2944,7 @@ QList QgsExpression::specialColumns() { //check for special column group name QString group = gmSpecialColumnGroups.value( it.key(), "Record" ); - defs << new StaticFunction( it.key(), 0, ( FcnEvalContext )0, group ); + defs << new StaticFunction( it.key(), 0, ( FcnEvalContext )nullptr, group ); } return defs; } @@ -3021,7 +3021,7 @@ QgsExpression::QgsExpression( const QString& expr ) : mRowNumber( 0 ) , mScale( 0 ) , mExp( expr ) - , mCalc( 0 ) + , mCalc( nullptr ) { mRootNode = ::parseExpression( expr, mParserErrorString ); @@ -3156,7 +3156,7 @@ QVariant QgsExpression::evaluate() return QVariant(); } - return mRootNode->eval( this, ( QgsExpressionContext* )0 ); + return mRootNode->eval( this, ( QgsExpressionContext* )nullptr ); } QVariant QgsExpression::evaluate( const QgsExpressionContext *context ) diff --git a/src/core/qgsexpression.h b/src/core/qgsexpression.h index ea45b5f89a2..c2220d63504 100644 --- a/src/core/qgsexpression.h +++ b/src/core/qgsexpression.h @@ -257,8 +257,8 @@ class CORE_EXPORT QgsExpression */ Q_DECL_DEPRECATED static QString replaceExpressionText( const QString &action, const QgsFeature *feat, QgsVectorLayer *layer, - const QMap *substitutionMap = 0, - const QgsDistanceArea* distanceArea = 0 + const QMap *substitutionMap = nullptr, + const QgsDistanceArea* distanceArea = nullptr ); /** This function replaces each expression between [% and %] @@ -273,8 +273,8 @@ class CORE_EXPORT QgsExpression @note added in QGIS 2.12 */ static QString replaceExpressionText( const QString &action, const QgsExpressionContext* context, - const QMap *substitutionMap = 0, - const QgsDistanceArea* distanceArea = 0 + const QMap *substitutionMap = nullptr, + const QgsDistanceArea* distanceArea = nullptr ); /** Attempts to evaluate a text string as an expression to a resultant double @@ -467,7 +467,7 @@ class CORE_EXPORT QgsExpression bool handlesNull = false ) : Function( fnname, params, group, helpText, usesGeometry, referencedColumns, lazyEval, handlesNull ) , mFnc( fcn ) - , mContextFnc( 0 ) + , mContextFnc( nullptr ) , mAliases( aliases ) {} @@ -486,7 +486,7 @@ class CORE_EXPORT QgsExpression const QStringList& aliases = QStringList(), bool handlesNull = false ) : Function( fnname, params, group, helpText, usesGeometry, referencedColumns, lazyEval, handlesNull ) - , mFnc( 0 ) + , mFnc( nullptr ) , mContextFnc( fcn ) , mAliases( aliases ) {} @@ -903,7 +903,7 @@ class CORE_EXPORT QgsExpression class CORE_EXPORT NodeCondition : public Node { public: - NodeCondition( WhenThenList* conditions, Node* elseExp = NULL ) : mConditions( *conditions ), mElseExp( elseExp ) { delete conditions; } + NodeCondition( WhenThenList* conditions, Node* elseExp = nullptr ) : mConditions( *conditions ), mElseExp( elseExp ) { delete conditions; } ~NodeCondition() { delete mElseExp; qDeleteAll( mConditions ); } virtual NodeType nodeType() const override { return ntCondition; } @@ -964,7 +964,7 @@ class CORE_EXPORT QgsExpression /** * Used by QgsOgcUtils to create an empty */ - QgsExpression() : mRootNode( 0 ), mRowNumber( 0 ), mScale( 0.0 ), mCalc( 0 ) {} + QgsExpression() : mRootNode( nullptr ), mRowNumber( 0 ), mScale( 0.0 ), mCalc( nullptr ) {} void initGeomCalculator(); diff --git a/src/core/qgsexpressioncontext.cpp b/src/core/qgsexpressioncontext.cpp index d46f7a13896..026f04582a7 100644 --- a/src/core/qgsexpressioncontext.cpp +++ b/src/core/qgsexpressioncontext.cpp @@ -170,7 +170,7 @@ bool QgsExpressionContextScope::hasFunction( const QString& name ) const QgsExpression::Function* QgsExpressionContextScope::function( const QString& name ) const { - return mFunctions.contains( name ) ? mFunctions.value( name ) : 0; + return mFunctions.contains( name ) ? mFunctions.value( name ) : nullptr; } QStringList QgsExpressionContextScope::functionNames() const @@ -261,7 +261,7 @@ const QgsExpressionContextScope* QgsExpressionContext::activeScopeForVariable( c if (( *it )->hasVariable( name ) ) return ( *it ); } - return 0; + return nullptr; } QgsExpressionContextScope* QgsExpressionContext::activeScopeForVariable( const QString& name ) @@ -274,13 +274,13 @@ QgsExpressionContextScope* QgsExpressionContext::activeScopeForVariable( const Q if (( *it )->hasVariable( name ) ) return ( *it ); } - return 0; + return nullptr; } QgsExpressionContextScope* QgsExpressionContext::scope( int index ) { if ( index < 0 || index >= mStack.count() ) - return 0; + return nullptr; return mStack[index]; } @@ -288,7 +288,7 @@ QgsExpressionContextScope* QgsExpressionContext::scope( int index ) QgsExpressionContextScope *QgsExpressionContext::lastScope() { if ( mStack.count() < 1 ) - return 0; + return nullptr; return mStack.last(); } @@ -369,7 +369,7 @@ QgsExpression::Function *QgsExpressionContext::function( const QString &name ) c if (( *it )->hasFunction( name ) ) return ( *it )->function( name ); } - return 0; + return nullptr; } int QgsExpressionContext::scopeCount() const diff --git a/src/core/qgsfeature_p.h b/src/core/qgsfeature_p.h index 868805de548..9c2dfb6e2e9 100644 --- a/src/core/qgsfeature_p.h +++ b/src/core/qgsfeature_p.h @@ -43,7 +43,7 @@ class QgsFeaturePrivate : public QSharedData explicit QgsFeaturePrivate( QgsFeatureId id ) : fid( id ) - , geometry( 0 ) + , geometry( nullptr ) , ownsGeometry( false ) , valid( false ) { diff --git a/src/core/qgsfeatureiterator.cpp b/src/core/qgsfeatureiterator.cpp index 73098de776f..8488cea1713 100644 --- a/src/core/qgsfeatureiterator.cpp +++ b/src/core/qgsfeatureiterator.cpp @@ -23,7 +23,7 @@ QgsAbstractFeatureIterator::QgsAbstractFeatureIterator( const QgsFeatureRequest& , mClosed( false ) , refs( 0 ) , mFetchedCount( 0 ) - , mGeometrySimplifier( NULL ) + , mGeometrySimplifier( nullptr ) , mLocalSimplification( false ) { } @@ -31,7 +31,7 @@ QgsAbstractFeatureIterator::QgsAbstractFeatureIterator( const QgsFeatureRequest& QgsAbstractFeatureIterator::~QgsAbstractFeatureIterator() { delete mGeometrySimplifier; - mGeometrySimplifier = NULL; + mGeometrySimplifier = nullptr; } bool QgsAbstractFeatureIterator::nextFeature( QgsFeature& f ) @@ -117,13 +117,13 @@ bool QgsAbstractFeatureIterator::prepareSimplification( const QgsSimplifyMethod& mLocalSimplification = false; delete mGeometrySimplifier; - mGeometrySimplifier = NULL; + mGeometrySimplifier = nullptr; // setup the simplification of geometries to fetch if ( !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) && simplifyMethod.methodType() != QgsSimplifyMethod::NoSimplification && ( simplifyMethod.forceLocalOptimization() || !providerCanSimplify( simplifyMethod.methodType() ) ) ) { mGeometrySimplifier = QgsSimplifyMethod::createGeometrySimplifier( simplifyMethod ); - mLocalSimplification = mGeometrySimplifier != NULL; + mLocalSimplification = mGeometrySimplifier != nullptr; return mLocalSimplification; } return false; diff --git a/src/core/qgsfeatureiterator.h b/src/core/qgsfeatureiterator.h index a5e7779ee51..a74489a9b3a 100644 --- a/src/core/qgsfeatureiterator.h +++ b/src/core/qgsfeatureiterator.h @@ -170,7 +170,7 @@ class CORE_EXPORT QgsFeatureIterator //////// inline QgsFeatureIterator::QgsFeatureIterator() - : mIter( NULL ) + : mIter( nullptr ) { } diff --git a/src/core/qgsfeaturerequest.cpp b/src/core/qgsfeaturerequest.cpp index bbc412dd7a9..1a732498ee2 100644 --- a/src/core/qgsfeaturerequest.cpp +++ b/src/core/qgsfeaturerequest.cpp @@ -25,8 +25,8 @@ const QString QgsFeatureRequest::AllAttributes = QString( "#!allattributes!#" ); QgsFeatureRequest::QgsFeatureRequest() : mFilter( FilterNone ) , mFilterFid( -1 ) - , mFilterExpression( 0 ) - , mFlags( 0 ) + , mFilterExpression( nullptr ) + , mFlags( nullptr ) , mLimit( -1 ) { } @@ -34,8 +34,8 @@ QgsFeatureRequest::QgsFeatureRequest() QgsFeatureRequest::QgsFeatureRequest( QgsFeatureId fid ) : mFilter( FilterFid ) , mFilterFid( fid ) - , mFilterExpression( 0 ) - , mFlags( 0 ) + , mFilterExpression( nullptr ) + , mFlags( nullptr ) , mLimit( -1 ) { } @@ -44,8 +44,8 @@ QgsFeatureRequest::QgsFeatureRequest( const QgsRectangle& rect ) : mFilter( FilterRect ) , mFilterRect( rect ) , mFilterFid( -1 ) - , mFilterExpression( 0 ) - , mFlags( 0 ) + , mFilterExpression( nullptr ) + , mFlags( nullptr ) , mLimit( -1 ) { } @@ -55,7 +55,7 @@ QgsFeatureRequest::QgsFeatureRequest( const QgsExpression& expr, const QgsExpres , mFilterFid( -1 ) , mFilterExpression( new QgsExpression( expr.expression() ) ) , mExpressionContext( context ) - , mFlags( 0 ) + , mFlags( nullptr ) , mLimit( -1 ) { } @@ -78,7 +78,7 @@ QgsFeatureRequest& QgsFeatureRequest::operator=( const QgsFeatureRequest & rh ) } else { - mFilterExpression = 0; + mFilterExpression = nullptr; } mExpressionContext = rh.mExpressionContext; mAttrs = rh.mAttrs; diff --git a/src/core/qgsfontutils.cpp b/src/core/qgsfontutils.cpp index 32d74cb61c2..85f58e3c6f9 100644 --- a/src/core/qgsfontutils.cpp +++ b/src/core/qgsfontutils.cpp @@ -378,7 +378,7 @@ QString QgsFontUtils::translateNamedStyle( const QString& namedStyle ) QStringList words = namedStyle.split( ' ', QString::SkipEmptyParts ); for ( int i = 0, n = words.length(); i < n; ++i ) { - words[i] = QCoreApplication::translate( "QFontDatabase", words[i].toUtf8(), 0, QCoreApplication::UnicodeUTF8 ); + words[i] = QCoreApplication::translate( "QFontDatabase", words[i].toUtf8(), nullptr, QCoreApplication::UnicodeUTF8 ); } return words.join( " " ); } diff --git a/src/core/qgsfontutils.h b/src/core/qgsfontutils.h index f36e8ee242c..fe292e9eafe 100644 --- a/src/core/qgsfontutils.h +++ b/src/core/qgsfontutils.h @@ -49,7 +49,7 @@ class CORE_EXPORT QgsFontUtils * @param match Whether the family [foundry] returned by system is a match * @returns Whether family was found on system */ - static bool fontFamilyMatchOnSystem( const QString& family, QString* chosen = 0, bool* match = 0 ); + static bool fontFamilyMatchOnSystem( const QString& family, QString* chosen = nullptr, bool* match = nullptr ); /** Updates font with named style and retain all font properties * @param f The font to update diff --git a/src/core/qgsgeometryvalidator.cpp b/src/core/qgsgeometryvalidator.cpp index 41f7135813c..0a0d86f911a 100644 --- a/src/core/qgsgeometryvalidator.cpp +++ b/src/core/qgsgeometryvalidator.cpp @@ -201,7 +201,7 @@ void QgsGeometryValidator::run() QSettings settings; if ( settings.value( "/qgis/digitizing/validate_geometries", 1 ).toInt() == 2 ) { - char *r = 0; + char *r = nullptr; const GEOSGeometry *g0 = mG.asGeos(); GEOSContextHandle_t handle = QgsGeometry::getGEOSHandler(); if ( !g0 ) @@ -210,7 +210,7 @@ void QgsGeometryValidator::run() } else { - GEOSGeometry *g1 = 0; + GEOSGeometry *g1 = nullptr; if ( GEOSisValidDetail_r( handle, g0, GEOSVALID_ALLOW_SELFTOUCHING_RING_FORMING_HOLE, &r, &g1 ) != 1 ) { if ( g1 ) diff --git a/src/core/qgsgeometryvalidator.h b/src/core/qgsgeometryvalidator.h index cf5cfc925a8..1db2e7c0a08 100644 --- a/src/core/qgsgeometryvalidator.h +++ b/src/core/qgsgeometryvalidator.h @@ -25,7 +25,7 @@ class CORE_EXPORT QgsGeometryValidator : public QThread public: //! Constructor - QgsGeometryValidator( const QgsGeometry *g, QList *errors = 0 ); + QgsGeometryValidator( const QgsGeometry *g, QList *errors = nullptr ); ~QgsGeometryValidator(); void run() override; diff --git a/src/core/qgsgml.cpp b/src/core/qgsgml.cpp index 5f5aee8ac07..9876c8d7795 100644 --- a/src/core/qgsgml.cpp +++ b/src/core/qgsgml.cpp @@ -41,11 +41,11 @@ QgsGml::QgsGml( : QObject() , mTypeName( typeName ) , mGeometryAttribute( geometryAttribute ) - , mWkbType( NULL ) + , mWkbType( nullptr ) , mFinished( false ) - , mCurrentFeature( 0 ) + , mCurrentFeature( nullptr ) , mFeatureCount( 0 ) - , mCurrentWKB( NULL ) + , mCurrentWKB( nullptr ) , mCurrentWKBSize( 0 ) , mDimension( 2 ) , mCoorMode( QgsGml::coordinate ) @@ -75,7 +75,7 @@ int QgsGml::getFeatures( const QString& uri, QGis::WkbType* wkbType, QgsRectangl mUri = uri; mWkbType = wkbType; - XML_Parser p = XML_ParserCreateNS( NULL, NS_SEPARATOR ); + XML_Parser p = XML_ParserCreateNS( nullptr, NS_SEPARATOR ); XML_SetUserData( p, this ); XML_SetElementHandler( p, QgsGml::start, QgsGml::end ); XML_SetCharacterDataHandler( p, QgsGml::chars ); @@ -106,8 +106,8 @@ int QgsGml::getFeatures( const QString& uri, QGis::WkbType* wkbType, QgsRectangl connect( reply, SIGNAL( downloadProgress( qint64, qint64 ) ), this, SLOT( handleProgressEvent( qint64, qint64 ) ) ); //find out if there is a QGIS main window. If yes, display a progress dialog - QProgressDialog* progressDialog = 0; - QWidget* mainWindow = 0; + QProgressDialog* progressDialog = nullptr; + QWidget* mainWindow = nullptr; QWidgetList topLevelWidgets = qApp->topLevelWidgets(); for ( QWidgetList::iterator it = topLevelWidgets.begin(); it != topLevelWidgets.end(); ++it ) { @@ -188,7 +188,7 @@ int QgsGml::getFeatures( const QByteArray &data, QGis::WkbType* wkbType, QgsRect mWkbType = wkbType; mExtent.setMinimal(); - XML_Parser p = XML_ParserCreateNS( NULL, NS_SEPARATOR ); + XML_Parser p = XML_ParserCreateNS( nullptr, NS_SEPARATOR ); XML_SetUserData( p, this ); XML_SetElementHandler( p, QgsGml::start, QgsGml::end ); XML_SetCharacterDataHandler( p, QgsGml::chars ); @@ -384,7 +384,7 @@ void QgsGml::endElement( const XML_Char* el ) QgsGeometry *g = new QgsGeometry(); g->fromWkb( mCurrentWKB, mCurrentWKBSize ); mCurrentFeature->setGeometry( g ); - mCurrentWKB = 0; + mCurrentWKB = nullptr; } else if ( !mCurrentExtent.isEmpty() ) { @@ -392,7 +392,7 @@ void QgsGml::endElement( const XML_Char* el ) } else { - mCurrentFeature->setGeometry( 0 ); + mCurrentFeature->setGeometry( nullptr ); } mCurrentFeature->setValid( true ); @@ -401,7 +401,7 @@ void QgsGml::endElement( const XML_Char* el ) { mIdMap.insert( mCurrentFeature->id(), mCurrentFeatureId ); } - mCurrentFeature = 0; + mCurrentFeature = nullptr; ++mFeatureCount; mParseModeStack.pop(); } @@ -431,7 +431,7 @@ void QgsGml::endElement( const XML_Char* el ) } else //multipoint, add WKB as fragment { - unsigned char* wkb = 0; + unsigned char* wkb = nullptr; int wkbSize = 0; QList wkbList; QList wkbSizeList; @@ -474,7 +474,7 @@ void QgsGml::endElement( const XML_Char* el ) } else //multiline, add WKB as fragment { - unsigned char* wkb = 0; + unsigned char* wkb = nullptr; int wkbSize = 0; QList wkbList; QList wkbSizeList; @@ -501,7 +501,7 @@ void QgsGml::endElement( const XML_Char* el ) { //error } - unsigned char* wkb = 0; + unsigned char* wkb = nullptr; int wkbSize = 0; if ( getRingWKB( &wkb, &wkbSize, pointList ) != 0 ) { @@ -595,7 +595,7 @@ void QgsGml::setAttribute( const QString& name, const QString& value ) int QgsGml::readEpsgFromAttribute( int& epsgNr, const XML_Char** attr ) const { int i = 0; - while ( attr[i] != NULL ) + while ( attr[i] != nullptr ) { if ( strcmp( attr[i], "srsName" ) == 0 ) { @@ -626,7 +626,7 @@ int QgsGml::readEpsgFromAttribute( int& epsgNr, const XML_Char** attr ) const QString QgsGml::readAttribute( const QString& attributeName, const XML_Char** attr ) const { int i = 0; - while ( attr[i] != NULL ) + while ( attr[i] != nullptr ) { if ( attributeName.compare( attr[i] ) == 0 ) { @@ -980,8 +980,8 @@ void QgsGml::calculateExtentFromFeatures() return; } - QgsFeature* currentFeature = 0; - const QgsGeometry* currentGeometry = 0; + QgsFeature* currentFeature = nullptr; + const QgsGeometry* currentGeometry = nullptr; bool bboxInitialised = false; //gets true once bbox has been set to the first geometry for ( int i = 0; i < mFeatures.size(); ++i ) diff --git a/src/core/qgsgml.h b/src/core/qgsgml.h index 79b6a8bd314..fb51ac59fe9 100644 --- a/src/core/qgsgml.h +++ b/src/core/qgsgml.h @@ -62,7 +62,7 @@ class CORE_EXPORT QgsGml : public QObject */ int getFeatures( const QString& uri, QGis::WkbType* wkbType, - QgsRectangle* extent = 0, + QgsRectangle* extent = nullptr, const QString& userName = QString(), const QString& password = QString(), const QString& authcfg = QString() ); @@ -70,7 +70,7 @@ class CORE_EXPORT QgsGml : public QObject /** Read from GML data. Constructor uri param is ignored * Supports only UTF-8, UTF-16, ISO-8859-1, ISO-8859-1 XML encodings. */ - int getFeatures( const QByteArray &data, QGis::WkbType* wkbType, QgsRectangle* extent = 0 ); + int getFeatures( const QByteArray &data, QGis::WkbType* wkbType, QgsRectangle* extent = nullptr ); /** Get parsed features for given type name */ QMap featuresMap() const { return mFeatures; } diff --git a/src/core/qgsgmlschema.cpp b/src/core/qgsgmlschema.cpp index 9c220ea7147..5d7ebe64f2a 100644 --- a/src/core/qgsgmlschema.cpp +++ b/src/core/qgsgmlschema.cpp @@ -59,7 +59,7 @@ int QgsGmlFeatureClass::fieldIndex( const QString & name ) // --------------------------- QgsGmlSchema ------------------------------- QgsGmlSchema::QgsGmlSchema() : QObject() - , mCurrentFeature( NULL ) + , mCurrentFeature( nullptr ) , mFeatureCount( 0 ) , mLevel( 0 ) , mSkipLevel( std::numeric_limits::max() ) @@ -77,7 +77,7 @@ QgsGmlSchema::~QgsGmlSchema() QString QgsGmlSchema::readAttribute( const QString& attributeName, const XML_Char** attr ) const { int i = 0; - while ( attr[i] != NULL ) + while ( attr[i] != nullptr ) { if ( attributeName.compare( attr[i] ) == 0 ) { @@ -337,7 +337,7 @@ bool QgsGmlSchema::guessSchema( const QByteArray &data ) QgsDebugMsg( "Entered" ); mLevel = 0; mSkipLevel = std::numeric_limits::max(); - XML_Parser p = XML_ParserCreateNS( NULL, NS_SEPARATOR ); + XML_Parser p = XML_ParserCreateNS( nullptr, NS_SEPARATOR ); XML_SetUserData( p, this ); XML_SetElementHandler( p, QgsGmlSchema::start, QgsGmlSchema::end ); XML_SetCharacterDataHandler( p, QgsGmlSchema::chars ); diff --git a/src/core/qgshttptransaction.cpp b/src/core/qgshttptransaction.cpp index 4fc32082f2f..71180ecac17 100644 --- a/src/core/qgshttptransaction.cpp +++ b/src/core/qgshttptransaction.cpp @@ -43,13 +43,13 @@ QgsHttpTransaction::QgsHttpTransaction( const QString& uri, QNetworkProxy::ProxyType proxyType, const QString& userName, const QString& password ) - : http( NULL ) + : http( nullptr ) , httpid( 0 ) , httpactive( false ) , httpurl( uri ) , httphost( proxyHost ) , httpredirections( 0 ) - , mWatchdogTimer( NULL ) + , mWatchdogTimer( nullptr ) { Q_UNUSED( proxyPort ); Q_UNUSED( proxyUser ); @@ -62,11 +62,11 @@ QgsHttpTransaction::QgsHttpTransaction( const QString& uri, } QgsHttpTransaction::QgsHttpTransaction() - : http( NULL ) + : http( nullptr ) , httpid( 0 ) , httpactive( false ) , httpredirections( 0 ) - , mWatchdogTimer( NULL ) + , mWatchdogTimer( nullptr ) { QSettings s; mNetworkTimeoutMsec = s.value( "/qgis/networkAndProxy/networkTimeout", "20000" ).toInt(); @@ -216,7 +216,7 @@ bool QgsHttpTransaction::getSynchronously( QByteArray &respondedContent, int red #endif delete http; - http = 0; + http = nullptr; // Did we get an error? If so, bail early if ( !mError.isEmpty() ) diff --git a/src/core/qgshttptransaction.h b/src/core/qgshttptransaction.h index a58e6a16ea1..8eb82aa440a 100644 --- a/src/core/qgshttptransaction.h +++ b/src/core/qgshttptransaction.h @@ -71,7 +71,7 @@ class CORE_EXPORT QgsHttpTransaction : public QObject @return true in case of success */ - bool getSynchronously( QByteArray &respondedContent, int redirections = 0, const QByteArray* postData = 0 ); + bool getSynchronously( QByteArray &respondedContent, int redirections = 0, const QByteArray* postData = nullptr ); QString responseContentType(); diff --git a/src/core/qgslabel.cpp b/src/core/qgslabel.cpp index 14ff01ed3f6..5e46302daa6 100644 --- a/src/core/qgslabel.cpp +++ b/src/core/qgslabel.cpp @@ -567,10 +567,10 @@ const unsigned char* QgsLabel::labelPoint( labelpoint& point, const unsigned cha Q_ASSERT( sizeof( QGis::WkbType ) == 4 ); Q_ASSERT( sizeof( double ) == 8 ); - if ( geom == NULL ) + if ( geom == nullptr ) { QgsDebugMsg( "empty wkb" ); - return NULL; + return nullptr; } QGis::WkbType wkbType; @@ -699,7 +699,7 @@ const unsigned char* QgsLabel::labelPoint( labelpoint& point, const unsigned cha // To get here is a bug because our caller should be filtering // on wkb type. QgsDebugMsg( "unsupported wkb type" ); - return NULL; + return nullptr; } return geom; diff --git a/src/core/qgslabel.h b/src/core/qgslabel.h index 845b566535e..94419888b34 100644 --- a/src/core/qgslabel.h +++ b/src/core/qgslabel.h @@ -96,7 +96,7 @@ class CORE_EXPORT QgsLabel * \param selected feature is selected * \param classAttributes attributes to create the label from */ - void renderLabel( QgsRenderContext &renderContext, QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes = 0 ); + void renderLabel( QgsRenderContext &renderContext, QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes = nullptr ); /** Reads the renderer configuration from an XML file @param node the Dom node to read diff --git a/src/core/qgslabelingenginev2.cpp b/src/core/qgslabelingenginev2.cpp index 430871cf408..9e793de4e8b 100644 --- a/src/core/qgslabelingenginev2.cpp +++ b/src/core/qgslabelingenginev2.cpp @@ -39,7 +39,7 @@ QgsLabelingEngineV2::QgsLabelingEngineV2() , mCandPoint( 8 ) , mCandLine( 8 ) , mCandPolygon( 8 ) - , mResults( 0 ) + , mResults( nullptr ) { mResults = new QgsLabelingResults; } @@ -304,7 +304,7 @@ void QgsLabelingEngineV2::run( QgsRenderContext& context ) QgsLabelingResults* QgsLabelingEngineV2::takeResults() { QgsLabelingResults* res = mResults; - mResults = 0; + mResults = nullptr; return res; } @@ -318,7 +318,7 @@ void QgsLabelingEngineV2::readSettingsFromProject() mCandLine = prj->readNumEntry( "PAL", "/CandidatesLine", 8, &saved ); mCandPolygon = prj->readNumEntry( "PAL", "/CandidatesPolygon", 8, &saved ); - mFlags = 0; + mFlags = nullptr; if ( prj->readBoolEntry( "PAL", "/ShowingCandidates", false, &saved ) ) mFlags |= DrawCandidates; if ( prj->readBoolEntry( "PAL", "/DrawRectOnly", false, &saved ) ) mFlags |= DrawLabelRectOnly; if ( prj->readBoolEntry( "PAL", "/ShowingShadowRects", false, &saved ) ) mFlags |= DrawShadowRects; @@ -349,10 +349,10 @@ void QgsLabelingEngineV2::writeSettingsToProject() QgsLabelFeature::QgsLabelFeature( QgsFeatureId id, GEOSGeometry* geometry, const QSizeF& size ) - : mLayer( 0 ) + : mLayer( nullptr ) , mId( id ) , mGeometry( geometry ) - , mObstacleGeometry( 0 ) + , mObstacleGeometry( nullptr ) , mSize( size ) , mPriority( -1 ) , mHasFixedPosition( false ) @@ -364,7 +364,7 @@ QgsLabelFeature::QgsLabelFeature( QgsFeatureId id, GEOSGeometry* geometry, const , mAlwaysShow( false ) , mIsObstacle( false ) , mObstacleFactor( 1 ) - , mInfo( 0 ) + , mInfo( nullptr ) { } @@ -389,12 +389,12 @@ void QgsLabelFeature::setObstacleGeometry( GEOSGeometry* obstacleGeom ) QgsAbstractLabelProvider*QgsLabelFeature::provider() const { - return mLayer ? mLayer->provider() : 0; + return mLayer ? mLayer->provider() : nullptr; } QgsAbstractLabelProvider::QgsAbstractLabelProvider() - : mEngine( 0 ) + : mEngine( nullptr ) , mFlags( DrawLabels ) , mPlacement( QgsPalLayerSettings::AroundPoint ) , mLinePlacementFlags( 0 ) diff --git a/src/core/qgslegendrenderer.cpp b/src/core/qgslegendrenderer.cpp index 077be10c3b5..63e4d153a35 100644 --- a/src/core/qgslegendrenderer.cpp +++ b/src/core/qgslegendrenderer.cpp @@ -37,7 +37,7 @@ QgsLegendRenderer::QgsLegendRenderer( QgsLayerTreeModel* legendModel, const QgsL QSizeF QgsLegendRenderer::minimumSize() { - return paintAndDetermineSize( 0 ); + return paintAndDetermineSize( nullptr ); } void QgsLegendRenderer::drawLegend( QPainter* painter ) @@ -500,7 +500,7 @@ QgsLegendRenderer::Nucleon QgsLegendRenderer::drawSymbolItem( QgsLayerTreeModelL ctx.point = point; ctx.labelXOffset = labelXOffset; - QgsLayerTreeModelLegendNode::ItemMetrics im = symbolItem->draw( mSettings, painter ? &ctx : 0 ); + QgsLayerTreeModelLegendNode::ItemMetrics im = symbolItem->draw( mSettings, painter ? &ctx : nullptr ); Nucleon nucleon; nucleon.item = symbolItem; diff --git a/src/core/qgslegendrenderer.h b/src/core/qgslegendrenderer.h index 0df96fdd3dd..f9894591ded 100644 --- a/src/core/qgslegendrenderer.h +++ b/src/core/qgslegendrenderer.h @@ -73,7 +73,7 @@ class CORE_EXPORT QgsLegendRenderer class Nucleon { public: - Nucleon() : item( 0 ), labelXOffset( 0.0 ) {} + Nucleon() : item( nullptr ), labelXOffset( 0.0 ) {} QObject* item; // Symbol size size without any space around for symbol item QSizeF symbolSize; @@ -115,24 +115,24 @@ class CORE_EXPORT QgsLegendRenderer /** Draws title in the legend using the title font and the specified alignment * If no painter is specified, function returns the required width/height to draw the title. */ - QSizeF drawTitle( QPainter* painter = 0, QPointF point = QPointF(), Qt::AlignmentFlag halignment = Qt::AlignLeft, double legendWidth = 0 ); + QSizeF drawTitle( QPainter* painter = nullptr, QPointF point = QPointF(), Qt::AlignmentFlag halignment = Qt::AlignLeft, double legendWidth = 0 ); double spaceAboveAtom( const Atom& atom ); /** Draw atom and return its actual size, the atom is drawn with the space above it * so that first atoms in column are all aligned to the same line regardles their * style top space */ - QSizeF drawAtom( const Atom& atom, QPainter* painter = 0, QPointF point = QPointF() ); + QSizeF drawAtom( const Atom& atom, QPainter* painter = nullptr, QPointF point = QPointF() ); - Nucleon drawSymbolItem( QgsLayerTreeModelLegendNode* symbolItem, QPainter* painter = 0, QPointF point = QPointF(), double labelXOffset = 0 ); + Nucleon drawSymbolItem( QgsLayerTreeModelLegendNode* symbolItem, QPainter* painter = nullptr, QPointF point = QPointF(), double labelXOffset = 0 ); /** Draws a layer item */ - QSizeF drawLayerTitle( QgsLayerTreeLayer* nodeLayer, QPainter* painter = 0, QPointF point = QPointF() ); + QSizeF drawLayerTitle( QgsLayerTreeLayer* nodeLayer, QPainter* painter = nullptr, QPointF point = QPointF() ); /** Draws a group item. * Returns list of sizes of layers and groups including this group. */ - QSizeF drawGroupTitle( QgsLayerTreeGroup* nodeGroup, QPainter* painter = 0, QPointF point = QPointF() ); + QSizeF drawGroupTitle( QgsLayerTreeGroup* nodeGroup, QPainter* painter = nullptr, QPointF point = QPointF() ); QgsComposerLegendStyle::Style nodeLegendStyle( QgsLayerTreeNode* node ); diff --git a/src/core/qgslocalec.cpp b/src/core/qgslocalec.cpp index 25263d3bdac..3176335c4de 100644 --- a/src/core/qgslocalec.cpp +++ b/src/core/qgslocalec.cpp @@ -26,7 +26,7 @@ QgsLocaleNumC::QgsLocaleNumC() { sLocaleLock.lock(); - mOldlocale = setlocale( LC_NUMERIC, NULL ); + mOldlocale = setlocale( LC_NUMERIC, nullptr ); if ( mOldlocale ) mOldlocale = qstrdup( mOldlocale ); diff --git a/src/core/qgslogger.h b/src/core/qgslogger.h index 6128f45b784..0cb33277e58 100644 --- a/src/core/qgslogger.h +++ b/src/core/qgslogger.h @@ -60,18 +60,18 @@ class CORE_EXPORT QgsLogger @param file file name where the message comes from @param function function where the message comes from @param line place in file where the message comes from*/ - static void debug( const QString& msg, int debuglevel = 1, const char* file = NULL, const char* function = NULL, int line = -1 ); + static void debug( const QString& msg, int debuglevel = 1, const char* file = nullptr, const char* function = nullptr, int line = -1 ); /** Similar to the previous method, but prints a variable int-value pair*/ - static void debug( const QString& var, int val, int debuglevel = 1, const char* file = NULL, const char* function = NULL, int line = -1 ); + static void debug( const QString& var, int val, int debuglevel = 1, const char* file = nullptr, const char* function = nullptr, int line = -1 ); /** Similar to the previous method, but prints a variable double-value pair*/ // @note not available in python bindings - static void debug( const QString& var, double val, int debuglevel = 1, const char* file = NULL, const char* function = NULL, int line = -1 ); + static void debug( const QString& var, double val, int debuglevel = 1, const char* file = nullptr, const char* function = nullptr, int line = -1 ); /** Prints out a variable/value pair for types with overloaded operator<<*/ // @note not available in python bindings - template static void debug( const QString& var, T val, const char* file = 0, const char* function = 0, + template static void debug( const QString& var, T val, const char* file = nullptr, const char* function = nullptr, int line = -1, int debuglevel = 1 ) { std::ostringstream os; diff --git a/src/core/qgsmaplayer.cpp b/src/core/qgsmaplayer.cpp index 56946d5eb35..d70691e746d 100644 --- a/src/core/qgsmaplayer.cpp +++ b/src/core/qgsmaplayer.cpp @@ -57,7 +57,7 @@ QgsMapLayer::QgsMapLayer( QgsMapLayer::LayerType type, , mID( "" ) , mLayerType( type ) , mBlendMode( QPainter::CompositionMode_SourceOver ) // Default to normal blending - , mLegend( 0 ) + , mLegend( nullptr ) , mStyleManager( new QgsMapLayerStyleManager( this ) ) { mCRS = new QgsCoordinateReferenceSystem(); @@ -383,7 +383,7 @@ bool QgsMapLayer::readLayerXML( const QDomElement& layerElement ) // Do not validate any projections in children, they will be overwritten anyway. // No need to ask the user for a projections when it is overwritten, is there? savedValidation = QgsCoordinateReferenceSystem::customSrsValidation(); - QgsCoordinateReferenceSystem::setCustomSrsValidation( NULL ); + QgsCoordinateReferenceSystem::setCustomSrsValidation( nullptr ); // now let the children grab what they need from the Dom node. layerError = !readXml( layerElement ); @@ -777,7 +777,7 @@ QList QgsMapLayer::fromLayerDefinition( QDomDocument& document ) QString type = layerElem.attribute( "type" ); QgsDebugMsg( type ); - QgsMapLayer *layer = 0; + QgsMapLayer *layer = nullptr; if ( type == "vector" ) { @@ -1061,7 +1061,7 @@ bool QgsMapLayer::loadNamedStyleFromDb( const QString &db, const QString &theURI if ( db.isEmpty() || !QFile( db ).exists() ) return false; - myResult = sqlite3_open_v2( db.toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, NULL ); + myResult = sqlite3_open_v2( db.toUtf8().data(), &myDatabase, SQLITE_OPEN_READONLY, nullptr ); if ( myResult != SQLITE_OK ) { return false; diff --git a/src/core/qgsmaplayer.h b/src/core/qgsmaplayer.h index 9019f1986e3..924c59245b7 100644 --- a/src/core/qgsmaplayer.h +++ b/src/core/qgsmaplayer.h @@ -131,7 +131,7 @@ class CORE_EXPORT QgsMapLayer : public QObject /** Return new instance of QgsMapLayerRenderer that will be used for rendering of given context * @note added in 2.4 */ - virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) { Q_UNUSED( rendererContext ); return 0; } + virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rendererContext ) { Q_UNUSED( rendererContext ); return nullptr; } /** This is the method that does the actual work of * drawing the layer onto a paint device. @@ -380,7 +380,7 @@ class CORE_EXPORT QgsMapLayer : public QObject QString legendUrlFormat() const { return mLegendUrlFormat; } /** @deprecated since 2.4 - returns NULL */ - Q_DECL_DEPRECATED QImage *cacheImage() { return 0; } + Q_DECL_DEPRECATED QImage *cacheImage() { return nullptr; } /** @deprecated since 2.4 - caches listen to repaintRequested() signal to invalidate the cached image */ Q_DECL_DEPRECATED void setCacheImage( QImage * ); /** @deprecated since 2.4 - does nothing */ diff --git a/src/core/qgsmaplayerlegend.h b/src/core/qgsmaplayerlegend.h index b2bba58ad45..22f2abef6df 100644 --- a/src/core/qgsmaplayerlegend.h +++ b/src/core/qgsmaplayerlegend.h @@ -35,7 +35,7 @@ class CORE_EXPORT QgsMapLayerLegend : public QObject { Q_OBJECT public: - explicit QgsMapLayerLegend( QObject *parent = 0 ); + explicit QgsMapLayerLegend( QObject *parent = nullptr ); // TODO: type, load/save settings diff --git a/src/core/qgsmaplayerregistry.cpp b/src/core/qgsmaplayerregistry.cpp index 9704b8dc51f..6a9cbe0ea14 100644 --- a/src/core/qgsmaplayerregistry.cpp +++ b/src/core/qgsmaplayerregistry.cpp @@ -109,7 +109,7 @@ QgsMapLayerRegistry::addMapLayer( QgsMapLayer* theMapLayer, { QList addedLayers; addedLayers = addMapLayers( QList() << theMapLayer, addToLegend, takeOwnership ); - return addedLayers.isEmpty() ? 0 : addedLayers[0]; + return addedLayers.isEmpty() ? nullptr : addedLayers[0]; } diff --git a/src/core/qgsmaplayerregistry.h b/src/core/qgsmaplayerregistry.h index 9b81e82f26d..ad6d7fd04e4 100644 --- a/src/core/qgsmaplayerregistry.h +++ b/src/core/qgsmaplayerregistry.h @@ -285,7 +285,7 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject private: //! private singleton constructor - QgsMapLayerRegistry( QObject * parent = 0 ); + QgsMapLayerRegistry( QObject * parent = nullptr ); QMap mMapLayers; QSet mOwnedLayers; diff --git a/src/core/qgsmaplayerstylemanager.cpp b/src/core/qgsmaplayerstylemanager.cpp index 727b34adc3f..715de4ccd89 100644 --- a/src/core/qgsmaplayerstylemanager.cpp +++ b/src/core/qgsmaplayerstylemanager.cpp @@ -23,7 +23,7 @@ QgsMapLayerStyleManager::QgsMapLayerStyleManager( QgsMapLayer* layer ) : mLayer( layer ) - , mOverriddenOriginalStyle( 0 ) + , mOverriddenOriginalStyle( nullptr ) { reset(); } @@ -199,7 +199,7 @@ bool QgsMapLayerStyleManager::restoreOverrideStyle() mLayer->blockSignals( false ); delete mOverriddenOriginalStyle; - mOverriddenOriginalStyle = 0; + mOverriddenOriginalStyle = nullptr; return true; } diff --git a/src/core/qgsmaprenderer.cpp b/src/core/qgsmaprenderer.cpp index 9409748f348..f4855a56e76 100644 --- a/src/core/qgsmaprenderer.cpp +++ b/src/core/qgsmaprenderer.cpp @@ -59,7 +59,7 @@ QgsMapRenderer::QgsMapRenderer() mOutputUnits = QgsMapRenderer::Millimeters; - mLabelingEngine = NULL; + mLabelingEngine = nullptr; } QgsMapRenderer::~QgsMapRenderer() @@ -285,7 +285,7 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale ) mRenderContext.setDrawEditingInformation( !mOverview ); mRenderContext.setPainter( painter ); - mRenderContext.setCoordinateTransform( 0 ); + mRenderContext.setCoordinateTransform( nullptr ); //this flag is only for stopping during the current rendering progress, //so must be false at every new render operation mRenderContext.setRenderingStopped( false ); @@ -354,7 +354,7 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale ) // cache painter QPainter * mypContextPainter = mRenderContext.painter(); // Flattened image for drawing when a blending mode is set - QImage * mypFlattenedImage = 0; + QImage * mypFlattenedImage = nullptr; QString layerId = li.previous(); @@ -419,7 +419,7 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale ) } else { - ct = NULL; + ct = nullptr; } mRenderContext.setCoordinateTransform( ct ); @@ -545,7 +545,7 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale ) mypContextPainter->drawImage( 0, 0, *( mypFlattenedImage ) ); mypContextPainter->restore(); delete mypFlattenedImage; - mypFlattenedImage = 0; + mypFlattenedImage = nullptr; } disconnect( ml, SIGNAL( drawingProgress( int, int ) ), this, SLOT( onDrawingProgress( int, int ) ) ); @@ -596,7 +596,7 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale ) } else { - ct = NULL; + ct = nullptr; } mRenderContext.setCoordinateTransform( ct ); @@ -619,7 +619,7 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale ) { // set correct extent mRenderContext.setExtent( mExtent ); - mRenderContext.setCoordinateTransform( NULL ); + mRenderContext.setCoordinateTransform( nullptr ); mLabelingEngine->drawLabeling( mRenderContext ); mLabelingEngine->exit(); @@ -944,7 +944,7 @@ void QgsMapRenderer::updateFullExtent() while ( it != mLayerSet.end() ) { QgsMapLayer * lyr = registry->mapLayer( *it ); - if ( lyr == NULL ) + if ( lyr == nullptr ) { QgsDebugMsg( QString( "WARNING: layer '%1' not found in map layer registry!" ).arg( *it ) ); } @@ -1095,12 +1095,12 @@ const QgsCoordinateTransform *QgsMapRenderer::transformation( const QgsMapLayer { if ( !layer || !mDestCRS ) { - return 0; + return nullptr; } if ( layer->crs().authid() == mDestCRS->authid() ) { - return 0; + return nullptr; } QHash< QString, QgsLayerCoordinateTransform >::const_iterator ctIt = mLayerCoordinateTransformInfo.find( layer->id() ); diff --git a/src/core/qgsmaprenderer.h b/src/core/qgsmaprenderer.h index e9d4e3d5404..f4bad709ee2 100644 --- a/src/core/qgsmaprenderer.h +++ b/src/core/qgsmaprenderer.h @@ -182,7 +182,7 @@ class CORE_EXPORT QgsMapRenderer : public QObject //! starts rendering //! @param painter painter to render to //! @param forceWidthScale Force a specific scale factor for line widths and marker sizes. Automatically calculated from output device DPI if 0 - void render( QPainter* painter, double* forceWidthScale = 0 ); + void render( QPainter* painter, double* forceWidthScale = nullptr ); //! sets extent and checks whether suitable (returns false if not) bool setExtent( const QgsRectangle& extent ); diff --git a/src/core/qgsmaprenderercustompainterjob.cpp b/src/core/qgsmaprenderercustompainterjob.cpp index a870c5eda41..3d38fa9c2f7 100644 --- a/src/core/qgsmaprenderercustompainterjob.cpp +++ b/src/core/qgsmaprenderercustompainterjob.cpp @@ -28,8 +28,8 @@ QgsMapRendererCustomPainterJob::QgsMapRendererCustomPainterJob( const QgsMapSettings& settings, QPainter* painter ) : QgsMapRendererJob( settings ) , mPainter( painter ) - , mLabelingEngine( 0 ) - , mLabelingEngineV2( 0 ) + , mLabelingEngine( nullptr ) + , mLabelingEngineV2( nullptr ) , mActive( false ) , mRenderSynchronously( false ) { @@ -43,10 +43,10 @@ QgsMapRendererCustomPainterJob::~QgsMapRendererCustomPainterJob() //cancel(); delete mLabelingEngine; - mLabelingEngine = 0; + mLabelingEngine = nullptr; delete mLabelingEngineV2; - mLabelingEngineV2 = 0; + mLabelingEngineV2 = nullptr; } void QgsMapRendererCustomPainterJob::start() @@ -77,10 +77,10 @@ void QgsMapRendererCustomPainterJob::start() Q_ASSERT_X( thePaintDevice->logicalDpiX() == mSettings.outputDpi(), "Job::startRender()", errMsg.toAscii().data() ); delete mLabelingEngine; - mLabelingEngine = 0; + mLabelingEngine = nullptr; delete mLabelingEngineV2; - mLabelingEngineV2 = 0; + mLabelingEngineV2 = nullptr; if ( mSettings.testFlag( QgsMapSettings::DrawLabeling ) ) { @@ -173,7 +173,7 @@ QgsLabelingResults* QgsMapRendererCustomPainterJob::takeLabelingResults() else if ( mLabelingEngineV2 ) return mLabelingEngineV2->takeResults(); else - return 0; + return nullptr; } @@ -291,7 +291,7 @@ void QgsMapRendererJob::drawLabeling( const QgsMapSettings& settings, QgsRenderC { // set correct extent renderContext.setExtent( settings.visibleExtent() ); - renderContext.setCoordinateTransform( NULL ); + renderContext.setCoordinateTransform( nullptr ); labelingEngine2->run( renderContext ); } @@ -324,7 +324,7 @@ void QgsMapRendererJob::drawOldLabeling( const QgsMapSettings& settings, QgsRend if ( ml->hasScaleBasedVisibility() && ( settings.scale() < ml->minimumScale() || settings.scale() > ml->maximumScale() ) ) continue; - const QgsCoordinateTransform* ct = 0; + const QgsCoordinateTransform* ct = nullptr; QgsRectangle r1 = settings.visibleExtent(), r2; if ( settings.hasCrsTransformEnabled() ) @@ -348,7 +348,7 @@ void QgsMapRendererJob::drawNewLabeling( const QgsMapSettings& settings, QgsRend { // set correct extent renderContext.setExtent( settings.visibleExtent() ); - renderContext.setCoordinateTransform( NULL ); + renderContext.setCoordinateTransform( nullptr ); labelingEngine->drawLabeling( renderContext ); labelingEngine->exit(); diff --git a/src/core/qgsmaprendererjob.cpp b/src/core/qgsmaprendererjob.cpp index 842d88d8bc3..40baf2c126b 100644 --- a/src/core/qgsmaprendererjob.cpp +++ b/src/core/qgsmaprendererjob.cpp @@ -35,7 +35,7 @@ QgsMapRendererJob::QgsMapRendererJob( const QgsMapSettings& settings ) : mSettings( settings ) - , mCache( 0 ) + , mCache( nullptr ) , mRenderingTime( 0 ) { } @@ -214,7 +214,7 @@ LayerRenderJobs QgsMapRendererJob::prepareJobs( QPainter* painter, QgsPalLabelin } QgsRectangle r1 = mSettings.visibleExtent(), r2; - const QgsCoordinateTransform* ct = 0; + const QgsCoordinateTransform* ct = nullptr; if ( mSettings.hasCrsTransformEnabled() ) { @@ -243,7 +243,7 @@ LayerRenderJobs QgsMapRendererJob::prepareJobs( QPainter* painter, QgsPalLabelin layerJobs.append( LayerRenderJob() ); LayerRenderJob& job = layerJobs.last(); job.cached = false; - job.img = 0; + job.img = nullptr; job.blendMode = ml->blendMode(); job.layerId = ml->id(); @@ -259,8 +259,8 @@ LayerRenderJobs QgsMapRendererJob::prepareJobs( QPainter* painter, QgsPalLabelin { job.cached = true; job.img = new QImage( mCache->cacheImage( ml->id() ) ); - job.renderer = 0; - job.context.setPainter( 0 ); + job.renderer = nullptr; + job.context.setPainter( nullptr ); continue; } @@ -270,7 +270,7 @@ LayerRenderJobs QgsMapRendererJob::prepareJobs( QPainter* painter, QgsPalLabelin if ( mCache || !painter || needTemporaryImage( ml ) ) { // Flattened image for drawing when a blending mode is set - QImage * mypFlattenedImage = 0; + QImage * mypFlattenedImage = nullptr; mypFlattenedImage = new QImage( mSettings.outputSize().width(), mSettings.outputSize().height(), mSettings.outputImageFormat() ); @@ -320,7 +320,7 @@ void QgsMapRendererJob::cleanupJobs( LayerRenderJobs& jobs ) if ( job.img ) { delete job.context.painter(); - job.context.setPainter( 0 ); + job.context.setPainter( nullptr ); if ( mCache && !job.cached && !job.context.renderingStopped() ) { @@ -329,7 +329,7 @@ void QgsMapRendererJob::cleanupJobs( LayerRenderJobs& jobs ) } delete job.img; - job.img = 0; + job.img = nullptr; } if ( job.renderer ) @@ -338,7 +338,7 @@ void QgsMapRendererJob::cleanupJobs( LayerRenderJobs& jobs ) mErrors.append( Error( job.renderer->layerID(), message ) ); delete job.renderer; - job.renderer = 0; + job.renderer = nullptr; } } @@ -361,7 +361,7 @@ QImage QgsMapRendererJob::composeImage( const QgsMapSettings& settings, const La painter.setCompositionMode( job.blendMode ); - Q_ASSERT( job.img != 0 ); + Q_ASSERT( job.img != nullptr ); painter.drawImage( 0, 0, *job.img ); } diff --git a/src/core/qgsmaprendererparalleljob.cpp b/src/core/qgsmaprendererparalleljob.cpp index 14d23e333f6..7ba75c40b4f 100644 --- a/src/core/qgsmaprendererparalleljob.cpp +++ b/src/core/qgsmaprendererparalleljob.cpp @@ -27,8 +27,8 @@ QgsMapRendererParallelJob::QgsMapRendererParallelJob( const QgsMapSettings& settings ) : QgsMapRendererQImageJob( settings ) , mStatus( Idle ) - , mLabelingEngine( 0 ) - , mLabelingEngineV2( 0 ) + , mLabelingEngine( nullptr ) + , mLabelingEngineV2( nullptr ) { } @@ -40,10 +40,10 @@ QgsMapRendererParallelJob::~QgsMapRendererParallelJob() } delete mLabelingEngine; - mLabelingEngine = 0; + mLabelingEngine = nullptr; delete mLabelingEngineV2; - mLabelingEngineV2 = 0; + mLabelingEngineV2 = nullptr; } void QgsMapRendererParallelJob::start() @@ -56,10 +56,10 @@ void QgsMapRendererParallelJob::start() mStatus = RenderingLayers; delete mLabelingEngine; - mLabelingEngine = 0; + mLabelingEngine = nullptr; delete mLabelingEngineV2; - mLabelingEngineV2 = 0; + mLabelingEngineV2 = nullptr; if ( mSettings.testFlag( QgsMapSettings::DrawLabeling ) ) { @@ -74,7 +74,7 @@ void QgsMapRendererParallelJob::start() #endif } - mLayerJobs = prepareJobs( 0, mLabelingEngine, mLabelingEngineV2 ); + mLayerJobs = prepareJobs( nullptr, mLabelingEngine, mLabelingEngineV2 ); QgsDebugMsg( QString( "QThreadPool max thread count is %1" ).arg( QThreadPool::globalInstance()->maxThreadCount() ) ); @@ -168,7 +168,7 @@ QgsLabelingResults* QgsMapRendererParallelJob::takeLabelingResults() else if ( mLabelingEngineV2 ) return mLabelingEngineV2->takeResults(); else - return 0; + return nullptr; } QImage QgsMapRendererParallelJob::renderedImage() diff --git a/src/core/qgsmaprenderersequentialjob.cpp b/src/core/qgsmaprenderersequentialjob.cpp index e2d9f40ec5e..c56246f9a0b 100644 --- a/src/core/qgsmaprenderersequentialjob.cpp +++ b/src/core/qgsmaprenderersequentialjob.cpp @@ -22,9 +22,9 @@ QgsMapRendererSequentialJob::QgsMapRendererSequentialJob( const QgsMapSettings& settings ) : QgsMapRendererQImageJob( settings ) - , mInternalJob( 0 ) - , mPainter( 0 ) - , mLabelingResults( 0 ) + , mInternalJob( nullptr ) + , mPainter( nullptr ) + , mLabelingResults( nullptr ) { QgsDebugMsg( "SEQUENTIAL construct" ); @@ -43,10 +43,10 @@ QgsMapRendererSequentialJob::~QgsMapRendererSequentialJob() cancel(); } - Q_ASSERT( mInternalJob == 0 && mPainter == 0 ); + Q_ASSERT( mInternalJob == nullptr && mPainter == nullptr ); delete mLabelingResults; - mLabelingResults = 0; + mLabelingResults = nullptr; } @@ -61,7 +61,7 @@ void QgsMapRendererSequentialJob::start() QgsDebugMsg( "SEQUENTIAL START" ); - Q_ASSERT( mInternalJob == 0 && mPainter == 0 ); + Q_ASSERT( mInternalJob == nullptr && mPainter == nullptr ); mPainter = new QPainter( &mImage ); @@ -82,7 +82,7 @@ void QgsMapRendererSequentialJob::cancel() QgsDebugMsg( "sequential - cancel internal" ); mInternalJob->cancel(); - Q_ASSERT( mInternalJob == 0 && mPainter == 0 ); + Q_ASSERT( mInternalJob == nullptr && mPainter == nullptr ); } void QgsMapRendererSequentialJob::waitForFinished() @@ -95,13 +95,13 @@ void QgsMapRendererSequentialJob::waitForFinished() bool QgsMapRendererSequentialJob::isActive() const { - return mInternalJob != 0; + return mInternalJob != nullptr; } QgsLabelingResults* QgsMapRendererSequentialJob::takeLabelingResults() { QgsLabelingResults* tmp = mLabelingResults; - mLabelingResults = 0; + mLabelingResults = nullptr; return tmp; } @@ -122,7 +122,7 @@ void QgsMapRendererSequentialJob::internalFinished() mPainter->end(); delete mPainter; - mPainter = 0; + mPainter = nullptr; mLabelingResults = mInternalJob->takeLabelingResults(); @@ -131,7 +131,7 @@ void QgsMapRendererSequentialJob::internalFinished() // now we are in a slot called from mInternalJob - do not delete it immediately // so the class is still valid when the execution returns to the class mInternalJob->deleteLater(); - mInternalJob = 0; + mInternalJob = nullptr; mRenderingTime = mRenderingStart.elapsed(); diff --git a/src/core/qgsmapsettings.cpp b/src/core/qgsmapsettings.cpp index 189deea4317..92784250e99 100644 --- a/src/core/qgsmapsettings.cpp +++ b/src/core/qgsmapsettings.cpp @@ -510,7 +510,7 @@ QgsRectangle QgsMapSettings::fullExtent() const while ( it != mLayers.end() ) { QgsMapLayer * lyr = registry->mapLayer( *it ); - if ( lyr == NULL ) + if ( lyr == nullptr ) { QgsDebugMsg( QString( "WARNING: layer '%1' not found in map layer registry!" ).arg( *it ) ); } diff --git a/src/core/qgsmessagelog.cpp b/src/core/qgsmessagelog.cpp index a6e0e827d70..4e37c619d5b 100644 --- a/src/core/qgsmessagelog.cpp +++ b/src/core/qgsmessagelog.cpp @@ -21,7 +21,7 @@ class QgsMessageLogConsole; -QgsMessageLog *QgsMessageLog::sInstance = 0; +QgsMessageLog *QgsMessageLog::sInstance = nullptr; QgsMessageLog::QgsMessageLog() : QObject() diff --git a/src/core/qgsnetworkaccessmanager.h b/src/core/qgsnetworkaccessmanager.h index d00cc723180..262b2644eba 100644 --- a/src/core/qgsnetworkaccessmanager.h +++ b/src/core/qgsnetworkaccessmanager.h @@ -50,7 +50,7 @@ class CORE_EXPORT QgsNetworkAccessManager : public QNetworkAccessManager // and creates that instance on the first call. static QgsNetworkAccessManager* instance(); - QgsNetworkAccessManager( QObject *parent = 0 ); + QgsNetworkAccessManager( QObject *parent = nullptr ); //! destructor ~QgsNetworkAccessManager(); @@ -112,7 +112,7 @@ class CORE_EXPORT QgsNetworkAccessManager : public QNetworkAccessManager void abortRequest(); protected: - virtual QNetworkReply *createRequest( QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0 ) override; + virtual QNetworkReply *createRequest( QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *outgoingData = nullptr ) override; private: QList mProxyFactories; diff --git a/src/core/qgsnetworkcontentfetcher.cpp b/src/core/qgsnetworkcontentfetcher.cpp index cb702e58c07..9d0eab2f474 100644 --- a/src/core/qgsnetworkcontentfetcher.cpp +++ b/src/core/qgsnetworkcontentfetcher.cpp @@ -24,7 +24,7 @@ #include QgsNetworkContentFetcher::QgsNetworkContentFetcher() - : mReply( 0 ) + : mReply( nullptr ) , mContentLoaded( false ) { @@ -56,7 +56,7 @@ void QgsNetworkContentFetcher::fetchContent( const QUrl& url ) //cancel any in progress requests mReply->abort(); mReply->deleteLater(); - mReply = 0; + mReply = nullptr; } mReply = QgsNetworkAccessManager::instance()->get( request ); @@ -67,7 +67,7 @@ QNetworkReply *QgsNetworkContentFetcher::reply() { if ( !mContentLoaded ) { - return 0; + return nullptr; } return mReply; @@ -94,7 +94,7 @@ QTextCodec* QgsNetworkContentFetcher::codecForHtml( QByteArray& array ) const //so test for that ourselves //basic check - QTextCodec* codec = QTextCodec::codecForUtfText( array, 0 ); + QTextCodec* codec = QTextCodec::codecForUtfText( array, nullptr ); if ( codec ) { return codec; diff --git a/src/core/qgsofflineediting.cpp b/src/core/qgsofflineediting.cpp index a70935411fa..e3d753b0da1 100644 --- a/src/core/qgsofflineediting.cpp +++ b/src/core/qgsofflineediting.cpp @@ -196,7 +196,7 @@ void QgsOfflineEditing::synchronize() { // open logging db sqlite3* db = openLoggingDb(); - if ( db == NULL ) + if ( db == nullptr ) { return; } @@ -314,7 +314,7 @@ void QgsOfflineEditing::initializeSpatialMetadata( sqlite3 *sqlite_handle ) // checking if this DB is really empty char **results; int rows, columns; - int ret = sqlite3_get_table( sqlite_handle, "select count(*) from sqlite_master", &results, &rows, &columns, NULL ); + int ret = sqlite3_get_table( sqlite_handle, "select count(*) from sqlite_master", &results, &rows, &columns, nullptr ); if ( ret != SQLITE_OK ) return; int count = 0; @@ -330,7 +330,7 @@ void QgsOfflineEditing::initializeSpatialMetadata( sqlite3 *sqlite_handle ) return; bool above41 = false; - ret = sqlite3_get_table( sqlite_handle, "select spatialite_version()", &results, &rows, &columns, NULL ); + ret = sqlite3_get_table( sqlite_handle, "select spatialite_version()", &results, &rows, &columns, nullptr ); if ( ret == SQLITE_OK && rows == 1 && columns == 1 ) { QString version = QString::fromUtf8( results[1] ); @@ -345,8 +345,8 @@ void QgsOfflineEditing::initializeSpatialMetadata( sqlite3 *sqlite_handle ) sqlite3_free_table( results ); // all right, it's empty: proceding to initialize - char *errMsg = 0; - ret = sqlite3_exec( sqlite_handle, above41 ? "SELECT InitSpatialMetadata(1)" : "SELECT InitSpatialMetadata()", NULL, NULL, &errMsg ); + char *errMsg = nullptr; + ret = sqlite3_exec( sqlite_handle, above41 ? "SELECT InitSpatialMetadata(1)" : "SELECT InitSpatialMetadata()", nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { @@ -363,7 +363,7 @@ bool QgsOfflineEditing::createSpatialiteDB( const QString& offlineDbPath ) { int ret; sqlite3 *sqlite_handle; - char *errMsg = NULL; + char *errMsg = nullptr; QFile newDb( offlineDbPath ); if ( newDb.exists() ) { @@ -380,7 +380,7 @@ bool QgsOfflineEditing::createSpatialiteDB( const QString& offlineDbPath ) // creating/opening the new database QString dbPath = newDb.fileName(); - ret = QgsSLConnect::sqlite3_open_v2( dbPath.toUtf8().constData(), &sqlite_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL ); + ret = QgsSLConnect::sqlite3_open_v2( dbPath.toUtf8().constData(), &sqlite_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr ); if ( ret ) { // an error occurred @@ -391,7 +391,7 @@ bool QgsOfflineEditing::createSpatialiteDB( const QString& offlineDbPath ) return false; } // activating Foreign Key constraints - ret = sqlite3_exec( sqlite_handle, "PRAGMA foreign_keys = 1", NULL, 0, &errMsg ); + ret = sqlite3_exec( sqlite_handle, "PRAGMA foreign_keys = 1", nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { showWarning( tr( "Unable to activate FOREIGN_KEY constraints" ) ); @@ -455,9 +455,9 @@ void QgsOfflineEditing::createLoggingTables( sqlite3* db ) QgsVectorLayer* QgsOfflineEditing::copyVectorLayer( QgsVectorLayer* layer, sqlite3* db, const QString& offlineDbPath ) { - if ( layer == 0 ) + if ( layer == nullptr ) { - return 0; + return nullptr; } QString tableName = layer->id(); @@ -666,7 +666,7 @@ QgsVectorLayer* QgsOfflineEditing::copyVectorLayer( QgsVectorLayer* layer, sqlit } return newLayer; } - return 0; + return nullptr; } void QgsOfflineEditing::applyAttributesAdded( QgsVectorLayer* remoteLayer, sqlite3* db, int layerId, int commitNo ) @@ -903,7 +903,7 @@ void QgsOfflineEditing::showWarning( const QString& message ) sqlite3* QgsOfflineEditing::openLoggingDb() { - sqlite3* db = NULL; + sqlite3* db = nullptr; QString dbPath = QgsProject::instance()->readEntry( PROJECT_ENTRY_SCOPE_OFFLINE, PROJECT_ENTRY_KEY_OFFLINE_DB_PATH ); if ( !dbPath.isEmpty() ) { @@ -912,7 +912,7 @@ sqlite3* QgsOfflineEditing::openLoggingDb() { showWarning( tr( "Could not open the spatialite logging database" ) ); sqlite3_close( db ); - db = NULL; + db = nullptr; } } return db; @@ -982,7 +982,7 @@ bool QgsOfflineEditing::isAddedFeature( sqlite3* db, int layerId, QgsFeatureId f int QgsOfflineEditing::sqlExec( sqlite3* db, const QString& sql ) { char * errmsg; - int rc = sqlite3_exec( db, sql.toUtf8(), NULL, NULL, &errmsg ); + int rc = sqlite3_exec( db, sql.toUtf8(), nullptr, nullptr, &errmsg ); if ( rc != SQLITE_OK ) { showWarning( errmsg ); @@ -992,8 +992,8 @@ int QgsOfflineEditing::sqlExec( sqlite3* db, const QString& sql ) int QgsOfflineEditing::sqlQueryInt( sqlite3* db, const QString& sql, int defaultValue ) { - sqlite3_stmt* stmt = NULL; - if ( sqlite3_prepare_v2( db, sql.toUtf8().constData(), -1, &stmt, NULL ) != SQLITE_OK ) + sqlite3_stmt* stmt = nullptr; + if ( sqlite3_prepare_v2( db, sql.toUtf8().constData(), -1, &stmt, nullptr ) != SQLITE_OK ) { showWarning( sqlite3_errmsg( db ) ); return defaultValue; @@ -1014,8 +1014,8 @@ QList QgsOfflineEditing::sqlQueryInts( sqlite3* db, const QString& sql ) { QList values; - sqlite3_stmt* stmt = NULL; - if ( sqlite3_prepare_v2( db, sql.toUtf8().constData(), -1, &stmt, NULL ) != SQLITE_OK ) + sqlite3_stmt* stmt = nullptr; + if ( sqlite3_prepare_v2( db, sql.toUtf8().constData(), -1, &stmt, nullptr ) != SQLITE_OK ) { showWarning( sqlite3_errmsg( db ) ); return values; @@ -1037,8 +1037,8 @@ QList QgsOfflineEditing::sqlQueryAttributesAdded( sqlite3* db, const Q { QList values; - sqlite3_stmt* stmt = NULL; - if ( sqlite3_prepare_v2( db, sql.toUtf8().constData(), -1, &stmt, NULL ) != SQLITE_OK ) + sqlite3_stmt* stmt = nullptr; + if ( sqlite3_prepare_v2( db, sql.toUtf8().constData(), -1, &stmt, nullptr ) != SQLITE_OK ) { showWarning( sqlite3_errmsg( db ) ); return values; @@ -1066,8 +1066,8 @@ QgsFeatureIds QgsOfflineEditing::sqlQueryFeaturesRemoved( sqlite3* db, const QSt { QgsFeatureIds values; - sqlite3_stmt* stmt = NULL; - if ( sqlite3_prepare_v2( db, sql.toUtf8().constData(), -1, &stmt, NULL ) != SQLITE_OK ) + sqlite3_stmt* stmt = nullptr; + if ( sqlite3_prepare_v2( db, sql.toUtf8().constData(), -1, &stmt, nullptr ) != SQLITE_OK ) { showWarning( sqlite3_errmsg( db ) ); return values; @@ -1089,8 +1089,8 @@ QgsOfflineEditing::AttributeValueChanges QgsOfflineEditing::sqlQueryAttributeVal { AttributeValueChanges values; - sqlite3_stmt* stmt = NULL; - if ( sqlite3_prepare_v2( db, sql.toUtf8().constData(), -1, &stmt, NULL ) != SQLITE_OK ) + sqlite3_stmt* stmt = nullptr; + if ( sqlite3_prepare_v2( db, sql.toUtf8().constData(), -1, &stmt, nullptr ) != SQLITE_OK ) { showWarning( sqlite3_errmsg( db ) ); return values; @@ -1116,8 +1116,8 @@ QgsOfflineEditing::GeometryChanges QgsOfflineEditing::sqlQueryGeometryChanges( s { GeometryChanges values; - sqlite3_stmt* stmt = NULL; - if ( sqlite3_prepare_v2( db, sql.toUtf8().constData(), -1, &stmt, NULL ) != SQLITE_OK ) + sqlite3_stmt* stmt = nullptr; + if ( sqlite3_prepare_v2( db, sql.toUtf8().constData(), -1, &stmt, nullptr ) != SQLITE_OK ) { showWarning( sqlite3_errmsg( db ) ); return values; @@ -1141,7 +1141,7 @@ QgsOfflineEditing::GeometryChanges QgsOfflineEditing::sqlQueryGeometryChanges( s void QgsOfflineEditing::committedAttributesAdded( const QString& qgisLayerId, const QList& addedAttributes ) { sqlite3* db = openLoggingDb(); - if ( db == NULL ) + if ( db == nullptr ) { return; } @@ -1171,7 +1171,7 @@ void QgsOfflineEditing::committedAttributesAdded( const QString& qgisLayerId, co void QgsOfflineEditing::committedFeaturesAdded( const QString& qgisLayerId, const QgsFeatureList& addedFeatures ) { sqlite3* db = openLoggingDb(); - if ( db == NULL ) + if ( db == nullptr ) { return; } @@ -1200,7 +1200,7 @@ void QgsOfflineEditing::committedFeaturesAdded( const QString& qgisLayerId, cons void QgsOfflineEditing::committedFeaturesRemoved( const QString& qgisLayerId, const QgsFeatureIds& deletedFeatureIds ) { sqlite3* db = openLoggingDb(); - if ( db == NULL ) + if ( db == nullptr ) { return; } @@ -1231,7 +1231,7 @@ void QgsOfflineEditing::committedFeaturesRemoved( const QString& qgisLayerId, co void QgsOfflineEditing::committedAttributeValuesChanges( const QString& qgisLayerId, const QgsChangedAttributesMap& changedAttrsMap ) { sqlite3* db = openLoggingDb(); - if ( db == NULL ) + if ( db == nullptr ) { return; } @@ -1268,7 +1268,7 @@ void QgsOfflineEditing::committedAttributeValuesChanges( const QString& qgisLaye void QgsOfflineEditing::committedGeometriesChanges( const QString& qgisLayerId, const QgsGeometryMap& changedGeometries ) { sqlite3* db = openLoggingDb(); - if ( db == NULL ) + if ( db == nullptr ) { return; } diff --git a/src/core/qgsogcutils.cpp b/src/core/qgsogcutils.cpp index b6152f3c8fa..0d59bb27464 100644 --- a/src/core/qgsogcutils.cpp +++ b/src/core/qgsogcutils.cpp @@ -30,7 +30,7 @@ QgsGeometry* QgsOgcUtils::geometryFromGML( const QDomNode& geometryNode ) QDomNode geometryChild = geometryNode.firstChild(); if ( geometryChild.isNull() ) { - return 0; + return nullptr; } geometryTypeElement = geometryChild.toElement(); geomType = geometryTypeElement.tagName(); @@ -39,7 +39,7 @@ QgsGeometry* QgsOgcUtils::geometryFromGML( const QDomNode& geometryNode ) if ( !( geomType == "Point" || geomType == "LineString" || geomType == "Polygon" || geomType == "MultiPoint" || geomType == "MultiLineString" || geomType == "MultiPolygon" || geomType == "Box" || geomType == "Envelope" ) ) - return 0; + return nullptr; if ( geomType == "Point" ) { @@ -75,7 +75,7 @@ QgsGeometry* QgsOgcUtils::geometryFromGML( const QDomNode& geometryNode ) } else //unknown type { - return 0; + return nullptr; } } @@ -85,7 +85,7 @@ QgsGeometry* QgsOgcUtils::geometryFromGML( const QString& xmlString ) QString xml = QString( "%2" ).arg( GML_NAMESPACE, xmlString ); QDomDocument doc; if ( !doc.setContent( xml, true ) ) - return 0; + return nullptr; return geometryFromGML( doc.documentElement().firstChildElement() ); } @@ -101,7 +101,7 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLPoint( const QDomElement& geometryEleme QDomElement coordElement = coordList.at( 0 ).toElement(); if ( readGMLCoordinates( pointCoordinate, coordElement ) != 0 ) { - return 0; + return nullptr; } } else @@ -109,18 +109,18 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLPoint( const QDomElement& geometryEleme QDomNodeList posList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, "pos" ); if ( posList.size() < 1 ) { - return 0; + return nullptr; } QDomElement posElement = posList.at( 0 ).toElement(); if ( readGMLPositions( pointCoordinate, posElement ) != 0 ) { - return 0; + return nullptr; } } if ( pointCoordinate.size() < 1 ) { - return 0; + return nullptr; } QgsPolyline::const_iterator point_it = pointCoordinate.begin(); @@ -156,7 +156,7 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLLineString( const QDomElement& geometry QDomElement coordElement = coordList.at( 0 ).toElement(); if ( readGMLCoordinates( lineCoordinates, coordElement ) != 0 ) { - return 0; + return nullptr; } } else @@ -164,12 +164,12 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLLineString( const QDomElement& geometry QDomNodeList posList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, "posList" ); if ( posList.size() < 1 ) { - return 0; + return nullptr; } QDomElement posElement = posList.at( 0 ).toElement(); if ( readGMLPositions( lineCoordinates, posElement ) != 0 ) { - return 0; + return nullptr; } } @@ -220,11 +220,11 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLPolygon( const QDomElement& geometryEle QDomElement coordinatesElement = outerBoundaryList.at( 0 ).firstChild().firstChild().toElement(); if ( coordinatesElement.isNull() ) { - return 0; + return nullptr; } if ( readGMLCoordinates( exteriorPointList, coordinatesElement ) != 0 ) { - return 0; + return nullptr; } ringCoordinates.push_back( exteriorPointList ); @@ -236,11 +236,11 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLPolygon( const QDomElement& geometryEle coordinatesElement = innerBoundaryList.at( i ).firstChild().firstChild().toElement(); if ( coordinatesElement.isNull() ) { - return 0; + return nullptr; } if ( readGMLCoordinates( interiorPointList, coordinatesElement ) != 0 ) { - return 0; + return nullptr; } ringCoordinates.push_back( interiorPointList ); } @@ -251,16 +251,16 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLPolygon( const QDomElement& geometryEle QDomNodeList exteriorList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, "exterior" ); if ( exteriorList.size() < 1 ) //outer ring is necessary { - return 0; + return nullptr; } QDomElement posElement = exteriorList.at( 0 ).firstChild().firstChild().toElement(); if ( posElement.isNull() ) { - return 0; + return nullptr; } if ( readGMLPositions( exteriorPointList, posElement ) != 0 ) { - return 0; + return nullptr; } ringCoordinates.push_back( exteriorPointList ); @@ -272,11 +272,11 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLPolygon( const QDomElement& geometryEle QDomElement posElement = interiorList.at( i ).firstChild().firstChild().toElement(); if ( posElement.isNull() ) { - return 0; + return nullptr; } if ( readGMLPositions( interiorPointList, posElement ) != 0 ) { - return 0; + return nullptr; } ringCoordinates.push_back( interiorPointList ); } @@ -285,7 +285,7 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLPolygon( const QDomElement& geometryEle //calculate number of bytes to allocate int nrings = ringCoordinates.size(); if ( nrings < 1 ) - return 0; + return nullptr; int npoints = 0;//total number of points for ( QgsMultiPolyline::const_iterator it = ringCoordinates.begin(); it != ringCoordinates.end(); ++it ) @@ -341,7 +341,7 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiPoint( const QDomElement& geometry QDomNodeList pointMemberList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, "pointMember" ); if ( pointMemberList.size() < 1 ) { - return 0; + return nullptr; } QDomNodeList pointNodeList; // coordinates or pos element @@ -394,7 +394,7 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiPoint( const QDomElement& geometry int nPoints = pointList.size(); //number of points if ( nPoints < 1 ) - return 0; + return nullptr; //calculate the required wkb size int size = 1 + 2 * sizeof( int ) + pointList.size() * ( 2 * sizeof( double ) + 1 + sizeof( int ) ); @@ -456,7 +456,7 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiLineString( const QDomElement& geo QDomNodeList lineStringNodeList = lineStringMemberList.at( i ).toElement().elementsByTagNameNS( GML_NAMESPACE, "LineString" ); if ( lineStringNodeList.size() < 1 ) { - return 0; + return nullptr; } currentLineStringElement = lineStringNodeList.at( 0 ).toElement(); currentCoordList = currentLineStringElement.elementsByTagNameNS( GML_NAMESPACE, "coordinates" ); @@ -465,7 +465,7 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiLineString( const QDomElement& geo QgsPolyline currentPointList; if ( readGMLCoordinates( currentPointList, currentCoordList.at( 0 ).toElement() ) != 0 ) { - return 0; + return nullptr; } lineCoordinates.push_back( currentPointList ); } @@ -474,12 +474,12 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiLineString( const QDomElement& geo currentPosList = currentLineStringElement.elementsByTagNameNS( GML_NAMESPACE, "posList" ); if ( currentPosList.size() < 1 ) { - return 0; + return nullptr; } QgsPolyline currentPointList; if ( readGMLPositions( currentPointList, currentPosList.at( 0 ).toElement() ) != 0 ) { - return 0; + return nullptr; } lineCoordinates.push_back( currentPointList ); } @@ -499,22 +499,22 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiLineString( const QDomElement& geo QgsPolyline currentPointList; if ( readGMLCoordinates( currentPointList, currentCoordList.at( 0 ).toElement() ) != 0 ) { - return 0; + return nullptr; } lineCoordinates.push_back( currentPointList ); - return 0; + return nullptr; } else { currentPosList = currentLineStringElement.elementsByTagNameNS( GML_NAMESPACE, "posList" ); if ( currentPosList.size() < 1 ) { - return 0; + return nullptr; } QgsPolyline currentPointList; if ( readGMLPositions( currentPointList, currentPosList.at( 0 ).toElement() ) != 0 ) { - return 0; + return nullptr; } lineCoordinates.push_back( currentPointList ); } @@ -522,13 +522,13 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiLineString( const QDomElement& geo } else { - return 0; + return nullptr; } } int nLines = lineCoordinates.size(); if ( nLines < 1 ) - return 0; + return nullptr; //calculate the required wkb size int size = ( lineCoordinates.size() + 1 ) * ( 1 + 2 * sizeof( int ) ); @@ -720,7 +720,7 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiPolygon( const QDomElement& geomet int nPolygons = multiPolygonPoints.size(); if ( nPolygons < 1 ) - return 0; + return nullptr; int size = 1 + 2 * sizeof( int ); //calculate the wkb size @@ -1445,7 +1445,7 @@ QColor QgsOgcUtils::colorFromOgcFill( const QDomElement& fillElement ) QgsExpression* QgsOgcUtils::expressionFromOgcFilter( const QDomElement& element ) { if ( element.isNull() || !element.hasChildNodes() ) - return NULL; + return nullptr; QgsExpression *expr = new QgsExpression(); @@ -1540,7 +1540,7 @@ static bool isSpatialOperator( const QString& tagName ) QgsExpression::Node* QgsOgcUtils::nodeFromOgcFilter( QDomElement &element, QString &errorMessage ) { if ( element.isNull() ) - return NULL; + return nullptr; // check for binary operators if ( isBinaryOperator( element.tagName() ) ) @@ -1582,7 +1582,7 @@ QgsExpression::Node* QgsOgcUtils::nodeFromOgcFilter( QDomElement &element, QStri } errorMessage += QString( "unable to convert '%1' element to a valid expression: it is not supported yet or it has invalid arguments" ).arg( element.tagName() ); - return NULL; + return nullptr; } @@ -1590,14 +1590,14 @@ QgsExpression::Node* QgsOgcUtils::nodeFromOgcFilter( QDomElement &element, QStri QgsExpression::NodeBinaryOperator* QgsOgcUtils::nodeBinaryOperatorFromOgcFilter( QDomElement &element, QString &errorMessage ) { if ( element.isNull() ) - return NULL; + return nullptr; int op = binaryOperatorFromTagName( element.tagName() ); if ( op < 0 ) { if ( errorMessage.isEmpty() ) errorMessage = QString( "'%1' binary operator not supported." ).arg( element.tagName() ); - return NULL; + return nullptr; } QDomElement operandElem = element.firstChildElement(); @@ -1606,7 +1606,7 @@ QgsExpression::NodeBinaryOperator* QgsOgcUtils::nodeBinaryOperatorFromOgcFilter( { if ( errorMessage.isEmpty() ) errorMessage = QString( "invalid left operand for '%1' binary operator" ).arg( element.tagName() ); - return NULL; + return nullptr; } for ( operandElem = operandElem.nextSiblingElement(); !operandElem.isNull(); operandElem = operandElem.nextSiblingElement() ) @@ -1617,7 +1617,7 @@ QgsExpression::NodeBinaryOperator* QgsOgcUtils::nodeBinaryOperatorFromOgcFilter( if ( errorMessage.isEmpty() ) errorMessage = QString( "invalid right operand for '%1' binary operator" ).arg( element.tagName() ); delete expr; - return NULL; + return nullptr; } expr = new QgsExpression::NodeBinaryOperator(( QgsExpression::BinaryOperator ) op, expr, opRight ); @@ -1628,7 +1628,7 @@ QgsExpression::NodeBinaryOperator* QgsOgcUtils::nodeBinaryOperatorFromOgcFilter( if ( errorMessage.isEmpty() ) errorMessage = QString( "only one operand for '%1' binary operator" ).arg( element.tagName() ); delete expr; - return NULL; + return nullptr; } QgsExpression::NodeBinaryOperator *ret = dynamic_cast< QgsExpression::NodeBinaryOperator * >( expr ); @@ -1664,7 +1664,7 @@ QgsExpression::NodeFunction* QgsOgcUtils::nodeSpatialOperatorFromOgcFilter( QDom { errorMessage = "No OGC Geometry found"; delete gml2Args; - return NULL; + return nullptr; } QgsExpression::NodeList *opArgs = new QgsExpression::NodeList(); @@ -1678,7 +1678,7 @@ QgsExpression::NodeFunction* QgsOgcUtils::nodeSpatialOperatorFromOgcFilter( QDom QgsExpression::NodeUnaryOperator* QgsOgcUtils::nodeNotFromOgcFilter( QDomElement &element, QString &errorMessage ) { if ( element.tagName() != "Not" ) - return NULL; + return nullptr; QDomElement operandElem = element.firstChildElement(); QgsExpression::Node* operand = nodeFromOgcFilter( operandElem, errorMessage ); @@ -1686,7 +1686,7 @@ QgsExpression::NodeUnaryOperator* QgsOgcUtils::nodeNotFromOgcFilter( QDomElement { if ( errorMessage.isEmpty() ) errorMessage = QString( "invalid operand for '%1' unary operator" ).arg( element.tagName() ); - return NULL; + return nullptr; } return new QgsExpression::NodeUnaryOperator( QgsExpression::uoNot, operand ); @@ -1698,7 +1698,7 @@ QgsExpression::NodeFunction* QgsOgcUtils::nodeFunctionFromOgcFilter( QDomElement if ( element.isNull() || element.tagName() != "Function" ) { errorMessage = QString( "ogc:Function expected, got %1" ).arg( element.tagName() ); - return NULL; + return nullptr; } for ( int i = 0; i < QgsExpression::Functions().size(); i++ ) @@ -1717,7 +1717,7 @@ QgsExpression::NodeFunction* QgsOgcUtils::nodeFunctionFromOgcFilter( QDomElement if ( !op ) { delete args; - return NULL; + return nullptr; } args->append( op ); @@ -1727,7 +1727,7 @@ QgsExpression::NodeFunction* QgsOgcUtils::nodeFunctionFromOgcFilter( QDomElement return new QgsExpression::NodeFunction( i, args ); } - return NULL; + return nullptr; } @@ -1737,16 +1737,16 @@ QgsExpression::Node* QgsOgcUtils::nodeLiteralFromOgcFilter( QDomElement &element if ( element.isNull() || element.tagName() != "Literal" ) { errorMessage = QString( "ogc:Literal expected, got %1" ).arg( element.tagName() ); - return NULL; + return nullptr; } - QgsExpression::Node *root = 0; + QgsExpression::Node *root = nullptr; // the literal content can have more children (e.g. CDATA section, text, ...) QDomNode childNode = element.firstChild(); while ( !childNode.isNull() ) { - QgsExpression::Node* operand = 0; + QgsExpression::Node* operand = nullptr; if ( childNode.nodeType() == QDomNode::ElementNode ) { @@ -1759,7 +1759,7 @@ QgsExpression::Node* QgsOgcUtils::nodeLiteralFromOgcFilter( QDomElement &element delete root; errorMessage = QString( "'%1' is an invalid or not supported content for ogc:Literal" ).arg( operandElem.tagName() ); - return NULL; + return nullptr; } } else @@ -1795,7 +1795,7 @@ QgsExpression::Node* QgsOgcUtils::nodeLiteralFromOgcFilter( QDomElement &element if ( root ) return root; - return NULL; + return nullptr; } @@ -1804,7 +1804,7 @@ QgsExpression::NodeColumnRef* QgsOgcUtils::nodeColumnRefFromOgcFilter( QDomEleme if ( element.isNull() || element.tagName() != "PropertyName" ) { errorMessage = QString( "ogc:PropertyName expected, got %1" ).arg( element.tagName() ); - return NULL; + return nullptr; } return new QgsExpression::NodeColumnRef( element.firstChild().nodeValue() ); @@ -1814,8 +1814,8 @@ QgsExpression::NodeColumnRef* QgsOgcUtils::nodeColumnRefFromOgcFilter( QDomEleme QgsExpression::Node* QgsOgcUtils::nodeIsBetweenFromOgcFilter( QDomElement& element, QString& errorMessage ) { // encode a Range check - QgsExpression::Node *operand = 0, *lowerBound = 0; - QgsExpression::Node *operand2 = 0, *upperBound = 0; + QgsExpression::Node *operand = nullptr, *lowerBound = nullptr; + QgsExpression::Node *operand2 = nullptr, *upperBound = nullptr; QDomElement operandElem = element.firstChildElement(); while ( !operandElem.isNull() ) @@ -1857,7 +1857,7 @@ QgsExpression::Node* QgsOgcUtils::nodeIsBetweenFromOgcFilter( QDomElement& eleme delete upperBound; errorMessage = "missing some required sub-elements in ogc:PropertyIsBetween"; - return NULL; + return nullptr; } QgsExpression::Node *geOperator = new QgsExpression::NodeBinaryOperator( QgsExpression::boGE, operand, lowerBound ); @@ -1871,13 +1871,13 @@ QgsExpression::NodeBinaryOperator* QgsOgcUtils::nodePropertyIsNullFromOgcFilter( // convert ogc:PropertyIsNull to IS operator with NULL right operand if ( element.tagName() != "PropertyIsNull" ) { - return NULL; + return nullptr; } QDomElement operandElem = element.firstChildElement(); QgsExpression::Node* opLeft = nodeFromOgcFilter( operandElem, errorMessage ); if ( !opLeft ) - return NULL; + return nullptr; QgsExpression::Node* opRight = new QgsExpression::NodeLiteral( QVariant() ); return new QgsExpression::NodeBinaryOperator( QgsExpression::boIs, opLeft, opRight ); @@ -2151,7 +2151,7 @@ static QgsGeometry* geometryFromConstExpr( const QgsExpression::Node* node ) } } } - return 0; + return nullptr; } @@ -2194,7 +2194,7 @@ QDomElement QgsOgcUtils::expressionFunctionToOgcFilter( const QgsExpression::Nod QList argNodes = node->args()->list(); Q_ASSERT( argNodes.count() == 2 ); // binary spatial ops must have two args - QgsExpression::Node* otherNode = 0; + QgsExpression::Node* otherNode = nullptr; if ( isGeometryColumn( argNodes[0] ) ) otherNode = argNodes[1]; else if ( isGeometryColumn( argNodes[1] ) ) diff --git a/src/core/qgsogcutils.h b/src/core/qgsogcutils.h index 08c05085354..f133cc73b1a 100644 --- a/src/core/qgsogcutils.h +++ b/src/core/qgsogcutils.h @@ -78,7 +78,7 @@ class CORE_EXPORT QgsOgcUtils * @return valid \verbatim \endverbatim QDomElement on success, * otherwise null QDomElement */ - static QDomElement expressionToOgcFilter( const QgsExpression& exp, QDomDocument& doc, QString* errorMessage = 0 ); + static QDomElement expressionToOgcFilter( const QgsExpression& exp, QDomDocument& doc, QString* errorMessage = nullptr ); private: /** Static method that creates geometry from GML Point */ diff --git a/src/core/qgspaintenginehack.cpp b/src/core/qgspaintenginehack.cpp index 0c62612edcb..9ea9591aaef 100644 --- a/src/core/qgspaintenginehack.cpp +++ b/src/core/qgspaintenginehack.cpp @@ -20,7 +20,7 @@ // Hack to workaround Qt #5114 by disabling PatternTransform void QgsPaintEngineHack::fixFlags() { - gccaps = 0; + gccaps = nullptr; gccaps |= ( QPaintEngine::PrimitiveTransform // | QPaintEngine::PatternTransform | QPaintEngine::PixmapTransform diff --git a/src/core/qgspalgeometry.h b/src/core/qgspalgeometry.h index a0a2f4d51b9..5cf36af6908 100644 --- a/src/core/qgspalgeometry.h +++ b/src/core/qgspalgeometry.h @@ -18,7 +18,7 @@ class QgsTextLabelFeature : public QgsLabelFeature //! Construct text label feature QgsTextLabelFeature( QgsFeatureId id, GEOSGeometry* geometry, const QSizeF& size ) : QgsLabelFeature( id, geometry, size ) - , mFontMetrics( NULL ) + , mFontMetrics( nullptr ) { mDefinedFont = QFont(); } diff --git a/src/core/qgspallabeling.cpp b/src/core/qgspallabeling.cpp index 0aa92256b24..279f1bf974a 100644 --- a/src/core/qgspallabeling.cpp +++ b/src/core/qgspallabeling.cpp @@ -80,14 +80,14 @@ using namespace pal; QgsPalLayerSettings::QgsPalLayerSettings() : upsidedownLabels( Upright ) - , mCurFeat( 0 ) - , xform( NULL ) - , ct( NULL ) - , extentGeom( NULL ) + , mCurFeat( nullptr ) + , xform( nullptr ) + , ct( nullptr ) + , extentGeom( nullptr ) , mFeaturesToLabel( 0 ) , mFeatsSendingToPal( 0 ) , mFeatsRegPal( 0 ) - , expression( 0 ) + , expression( nullptr ) { enabled = false; drawLabels = true; @@ -321,16 +321,16 @@ QgsPalLayerSettings::QgsPalLayerSettings() } QgsPalLayerSettings::QgsPalLayerSettings( const QgsPalLayerSettings& s ) - : mCurFeat( NULL ) + : mCurFeat( nullptr ) , fieldIndex( 0 ) - , xform( NULL ) - , ct( NULL ) - , extentGeom( NULL ) + , xform( nullptr ) + , ct( nullptr ) + , extentGeom( nullptr ) , mFeaturesToLabel( 0 ) , mFeatsSendingToPal( 0 ) , mFeatsRegPal( 0 ) , showingShadowRects( false ) - , expression( NULL ) + , expression( nullptr ) { *this = s; } @@ -473,7 +473,7 @@ QgsPalLayerSettings& QgsPalLayerSettings::operator=( const QgsPalLayerSettings & QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined* >::const_iterator it = s.dataDefinedProperties.constBegin(); for ( ; it != s.dataDefinedProperties.constEnd(); ++it ) { - dataDefinedProperties.insert( it.key(), it.value() ? new QgsDataDefined( *it.value() ) : 0 ); + dataDefinedProperties.insert( it.key(), it.value() ? new QgsDataDefined( *it.value() ) : nullptr ); } mDataDefinedNames = s.mDataDefinedNames; @@ -507,7 +507,7 @@ QgsPalLayerSettings QgsPalLayerSettings::fromLayer( QgsVectorLayer* layer ) QgsExpression* QgsPalLayerSettings::getLabelExpression() { - if ( expression == NULL ) + if ( expression == nullptr ) { expression = new QgsExpression( fieldName ); } @@ -972,7 +972,7 @@ void QgsPalLayerSettings::readFromLayer( QgsVectorLayer* layer ) obstacleFactor = layer->customProperty( "labeling/obstacleFactor", QVariant( 1.0 ) ).toDouble(); obstacleType = ( ObstacleType )layer->customProperty( "labeling/obstacleType", QVariant( PolygonInterior ) ).toUInt(); - readDataDefinedPropertyMap( layer, 0, dataDefinedProperties ); + readDataDefinedPropertyMap( layer, nullptr, dataDefinedProperties ); } void QgsPalLayerSettings::writeToLayer( QgsVectorLayer* layer ) @@ -1125,7 +1125,7 @@ void QgsPalLayerSettings::writeToLayer( QgsVectorLayer* layer ) layer->setCustomProperty( "labeling/obstacleFactor", obstacleFactor ); layer->setCustomProperty( "labeling/obstacleType", ( unsigned int )obstacleType ); - writeDataDefinedPropertyMap( layer, 0, dataDefinedProperties ); + writeDataDefinedPropertyMap( layer, nullptr, dataDefinedProperties ); } @@ -1326,7 +1326,7 @@ void QgsPalLayerSettings::readXml( QDomElement& elem ) obstacleType = ( ObstacleType )renderingElem.attribute( "obstacleType", QString::number( PolygonInterior ) ).toUInt(); QDomElement ddElem = elem.firstChildElement( "data-defined" ); - readDataDefinedPropertyMap( 0, &ddElem, dataDefinedProperties ); + readDataDefinedPropertyMap( nullptr, &ddElem, dataDefinedProperties ); } @@ -1485,7 +1485,7 @@ QDomElement QgsPalLayerSettings::writeXml( QDomDocument& doc ) renderingElem.setAttribute( "obstacleType", ( unsigned int )obstacleType ); QDomElement ddElem = doc.createElement( "data-defined" ); - writeDataDefinedPropertyMap( 0, &ddElem, dataDefinedProperties ); + writeDataDefinedPropertyMap( nullptr, &ddElem, dataDefinedProperties ); QDomElement elem = doc.createElement( "settings" ); elem.appendChild( textStyleElem ); @@ -1539,7 +1539,7 @@ void QgsPalLayerSettings::removeAllDataDefinedProperties() for ( ; it != dataDefinedProperties.constEnd(); ++it ) { delete( it.value() ); - it.value() = 0; + it.value() = nullptr; } dataDefinedProperties.clear(); } @@ -1564,14 +1564,14 @@ QString QgsPalLayerSettings::updateDataDefinedString( const QString& value ) QgsDataDefined* QgsPalLayerSettings::dataDefinedProperty( DataDefinedProperties p ) { if ( dataDefinedProperties.isEmpty() ) - return 0; + return nullptr; QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined* >::const_iterator it = dataDefinedProperties.find( p ); if ( it != dataDefinedProperties.constEnd() ) { return it.value(); } - return 0; + return nullptr; } QMap QgsPalLayerSettings::dataDefinedMap( DataDefinedProperties p ) const @@ -1602,7 +1602,7 @@ QVariant QgsPalLayerSettings::dataDefinedValue( DataDefinedProperties p, QgsFeat } const QgsExpressionContext* ec = context ? context : scopedEc.data(); - QgsDataDefined* dd = 0; + QgsDataDefined* dd = nullptr; QMap< DataDefinedProperties, QgsDataDefined* >::const_iterator it = dataDefinedProperties.find( p ); if ( it != dataDefinedProperties.constEnd() ) { @@ -2241,12 +2241,12 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont doClip = true; } - const GEOSGeometry* geos_geom = 0; + const GEOSGeometry* geos_geom = nullptr; const QgsGeometry* preparedGeom = geom; QScopedPointer scopedPreparedGeom; - if ( QgsPalLabeling::geometryRequiresPreparation( geom, context, ct, doClip ? extentGeom : 0 ) ) + if ( QgsPalLabeling::geometryRequiresPreparation( geom, context, ct, doClip ? extentGeom : nullptr ) ) { - scopedPreparedGeom.reset( QgsPalLabeling::prepareGeometry( geom, context, ct, doClip ? extentGeom : 0 ) ); + scopedPreparedGeom.reset( QgsPalLabeling::prepareGeometry( geom, context, ct, doClip ? extentGeom : nullptr ) ); if ( !scopedPreparedGeom.data() ) return; preparedGeom = scopedPreparedGeom.data(); @@ -2256,13 +2256,13 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont { geos_geom = geom->asGeos(); } - const GEOSGeometry* geosObstacleGeom = 0; + const GEOSGeometry* geosObstacleGeom = nullptr; QScopedPointer scopedObstacleGeom; if ( isObstacle ) { - if ( obstacleGeometry && QgsPalLabeling::geometryRequiresPreparation( obstacleGeometry, context, ct, doClip ? extentGeom : 0 ) ) + if ( obstacleGeometry && QgsPalLabeling::geometryRequiresPreparation( obstacleGeometry, context, ct, doClip ? extentGeom : nullptr ) ) { - scopedObstacleGeom.reset( QgsPalLabeling::prepareGeometry( obstacleGeometry, context, ct, doClip ? extentGeom : 0 ) ); + scopedObstacleGeom.reset( QgsPalLabeling::prepareGeometry( obstacleGeometry, context, ct, doClip ? extentGeom : nullptr ) ); geosObstacleGeom = scopedObstacleGeom.data()->asGeos(); } else if ( obstacleGeometry ) @@ -2274,7 +2274,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont if ( minFeatureSize > 0 && !checkMinimumSizeMM( context, preparedGeom, minFeatureSize ) ) return; - if ( geos_geom == NULL ) + if ( geos_geom == nullptr ) return; // invalid geometry // likelihood exists label will be registered with PAL and may be drawn @@ -2311,7 +2311,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont { geos_geom_clone = GEOSGeom_clone_r( QgsGeometry::getGEOSHandler(), geos_geom ); } - GEOSGeometry* geosObstacleGeomClone = 0; + GEOSGeometry* geosObstacleGeomClone = nullptr; if ( geosObstacleGeom ) { geosObstacleGeomClone = GEOSGeom_clone_r( QgsGeometry::getGEOSHandler(), geosObstacleGeom ); @@ -2734,7 +2734,7 @@ void QgsPalLayerSettings::registerObstacleFeature( QgsFeature& f, QgsRenderConte mCurFeat = &f; - const QgsGeometry* geom = 0; + const QgsGeometry* geom = nullptr; if ( obstacleGeometry ) { geom = obstacleGeometry; @@ -2749,7 +2749,7 @@ void QgsPalLayerSettings::registerObstacleFeature( QgsFeature& f, QgsRenderConte return; } - const GEOSGeometry* geos_geom = 0; + const GEOSGeometry* geos_geom = nullptr; QScopedPointer scopedPreparedGeom; if ( QgsPalLabeling::geometryRequiresPreparation( geom, context, ct, extentGeom ) ) @@ -2764,7 +2764,7 @@ void QgsPalLayerSettings::registerObstacleFeature( QgsFeature& f, QgsRenderConte geos_geom = geom->asGeos(); } - if ( geos_geom == NULL ) + if ( geos_geom == nullptr ) return; // invalid geometry GEOSGeometry* geos_geom_clone; @@ -3633,7 +3633,7 @@ QgsPalLabeling::QgsPalLabeling() QgsPalLabeling::~QgsPalLabeling() { delete mEngine; - mEngine = 0; + mEngine = nullptr; } bool QgsPalLabeling::willUseLayer( QgsVectorLayer* layer ) @@ -3728,7 +3728,7 @@ int QgsPalLabeling::addDiagramLayer( QgsVectorLayer* layer, const QgsDiagramLaye void QgsPalLabeling::registerFeature( const QString& layerID, QgsFeature& f, QgsRenderContext &context, const QString& dxfLayer ) { Q_UNUSED( dxfLayer ); // now handled by QgsDxfLabelProvider - if ( QgsVectorLayerLabelProvider* provider = mLabelProviders.value( layerID, 0 ) ) + if ( QgsVectorLayerLabelProvider* provider = mLabelProviders.value( layerID, nullptr ) ) provider->registerFeature( f, context ); } @@ -3796,7 +3796,7 @@ QgsGeometry* QgsPalLabeling::prepareGeometry( const QgsGeometry* geometry, QgsRe { if ( !geometry ) { - return 0; + return nullptr; } //don't modify the feature's geometry so that geometry based expressions keep working @@ -3814,7 +3814,7 @@ QgsGeometry* QgsPalLabeling::prepareGeometry( const QgsGeometry* geometry, QgsRe { Q_UNUSED( cse ); QgsDebugMsgLevel( QString( "Ignoring feature due to transformation exception" ), 4 ); - return 0; + return nullptr; } } @@ -3834,19 +3834,19 @@ QgsGeometry* QgsPalLabeling::prepareGeometry( const QgsGeometry* geometry, QgsRe { Q_UNUSED( cse ); QgsDebugMsgLevel( QString( "Ignoring feature due to transformation exception" ), 4 ); - return 0; + return nullptr; } } if ( geom->rotate( m2p.mapRotation(), center ) ) { QgsDebugMsg( QString( "Error rotating geometry" ).arg( geom->exportToWkt() ) ); - return 0; + return nullptr; } } if ( !geom->asGeos() ) - return 0; // there is something really wrong with the geometry + return nullptr; // there is something really wrong with the geometry // fix invalid polygons if ( geom->type() == QGis::Polygon && !geom->isGeosValid() ) @@ -3854,7 +3854,7 @@ QgsGeometry* QgsPalLabeling::prepareGeometry( const QgsGeometry* geometry, QgsRe QgsGeometry* bufferGeom = geom->buffer( 0, 0 ); if ( !bufferGeom ) { - return 0; + return nullptr; } geom = bufferGeom; clonedGeometry.reset( geom ); @@ -3865,7 +3865,7 @@ QgsGeometry* QgsPalLabeling::prepareGeometry( const QgsGeometry* geometry, QgsRe QgsGeometry* clipGeom = geom->intersection( clipGeometry ); // creates new geometry if ( !clipGeom ) { - return 0; + return nullptr; } geom = clipGeom; clonedGeometry.reset( geom ); @@ -3914,7 +3914,7 @@ bool QgsPalLabeling::checkMinimumSizeMM( const QgsRenderContext& context, const void QgsPalLabeling::registerDiagramFeature( const QString& layerID, QgsFeature& feat, QgsRenderContext &context ) { - if ( QgsVectorLayerDiagramProvider* provider = mDiagramProviders.value( layerID, 0 ) ) + if ( QgsVectorLayerDiagramProvider* provider = mDiagramProviders.value( layerID, nullptr ) ) provider->registerFeature( feat, context ); } @@ -4617,7 +4617,7 @@ void QgsPalLabeling::drawLabelBackground( QgsRenderContext& context, p->restore(); delete svgShdwM; - svgShdwM = 0; + svgShdwM = nullptr; } // draw the actual symbol @@ -4642,7 +4642,7 @@ void QgsPalLabeling::drawLabelBackground( QgsRenderContext& context, p->restore(); delete svgM; - svgM = 0; + svgM = nullptr; } else // Generated Shapes @@ -4965,7 +4965,7 @@ QgsLabelingResults::QgsLabelingResults() QgsLabelingResults::~QgsLabelingResults() { delete mLabelSearchTree; - mLabelSearchTree = NULL; + mLabelSearchTree = nullptr; } QList QgsLabelingResults::labelsAtPosition( const QgsPoint& p ) const diff --git a/src/core/qgspallabeling.h b/src/core/qgspallabeling.h index 5d799e4a8a7..386566692d7 100644 --- a/src/core/qgspallabeling.h +++ b/src/core/qgspallabeling.h @@ -471,7 +471,7 @@ class CORE_EXPORT QgsPalLayerSettings double rasterCompressFactor; //pixel resolution scale factor // called from register feature hook - void calculateLabelSize( const QFontMetricsF* fm, QString text, double& labelX, double& labelY, QgsFeature* f = 0, QgsRenderContext* context = 0 ); + void calculateLabelSize( const QFontMetricsF* fm, QString text, double& labelX, double& labelY, QgsFeature* f = nullptr, QgsRenderContext* context = nullptr ); /** Register a feature for labelling. * @param f feature to label @@ -486,7 +486,7 @@ class CORE_EXPORT QgsPalLayerSettings * the feature's original geometry will be used as an obstacle for labels. Not available * in Python bindings. */ - void registerFeature( QgsFeature& f, QgsRenderContext& context, const QString& dxfLayer, QgsLabelFeature** labelFeature = 0, QgsGeometry* obstacleGeometry = 0 ); + void registerFeature( QgsFeature& f, QgsRenderContext& context, const QString& dxfLayer, QgsLabelFeature** labelFeature = nullptr, QgsGeometry* obstacleGeometry = nullptr ); void readFromLayer( QgsVectorLayer* layer ); void writeToLayer( QgsVectorLayer* layer ); @@ -535,13 +535,13 @@ class CORE_EXPORT QgsPalLayerSettings * @note not available in python bindings */ QVariant dataDefinedValue( QgsPalLayerSettings::DataDefinedProperties p, QgsFeature& f, const QgsFields& fields, - const QgsExpressionContext* context = 0 ) const; + const QgsExpressionContext* context = nullptr ) const; /** Get data defined property value from expression string or attribute field name * @returns true/false whether result is null or invalid * @note not available in python bindings */ - bool dataDefinedEvaluate( QgsPalLayerSettings::DataDefinedProperties p, QVariant& exprVal, QgsExpressionContext* context = 0, const QVariant& originalValue = QVariant() ) const; + bool dataDefinedEvaluate( QgsPalLayerSettings::DataDefinedProperties p, QVariant& exprVal, QgsExpressionContext* context = nullptr, const QVariant& originalValue = QVariant() ) const; /** Whether data definition is active */ @@ -654,7 +654,7 @@ class CORE_EXPORT QgsPalLayerSettings /** Registers a feature as an obstacle only (no label rendered) */ - void registerObstacleFeature( QgsFeature &f, QgsRenderContext &context, const QString& dxfLayer, QgsLabelFeature** obstacleFeature, QgsGeometry* obstacleGeometry = 0 ); + void registerObstacleFeature( QgsFeature &f, QgsRenderContext &context, const QString& dxfLayer, QgsLabelFeature** obstacleFeature, QgsGeometry* obstacleGeometry = nullptr ); QMap dataDefinedValues; QgsExpression* expression; @@ -690,7 +690,7 @@ class CORE_EXPORT QgsLabelComponent , mUseCenter( false ) , mSize( QgsPoint() ) , mOffset( QgsPoint() ) - , mPicture( 0 ) + , mPicture( nullptr ) , mPictureBuffer( 0.0 ) , mDpiRatio( 1.0 ) {} @@ -913,7 +913,7 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface virtual QgsPalLabeling* clone() override; //! @note not available in python bindings - static void drawLabelCandidateRect( pal::LabelPosition* lp, QPainter* painter, const QgsMapToPixel* xform, QList* candidates = 0 ); + static void drawLabelCandidateRect( pal::LabelPosition* lp, QPainter* painter, const QgsMapToPixel* xform, QList* candidates = nullptr ); static void drawLabelBuffer( QgsRenderContext& context, const QgsLabelComponent &component, @@ -944,7 +944,7 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface * @returns prepared geometry, the caller takes ownership * @note added in QGIS 2.9 */ - static QgsGeometry* prepareGeometry( const QgsGeometry *geometry, QgsRenderContext &context, const QgsCoordinateTransform *ct, QgsGeometry *clipGeometry = 0 ); + static QgsGeometry* prepareGeometry( const QgsGeometry *geometry, QgsRenderContext &context, const QgsCoordinateTransform *ct, QgsGeometry *clipGeometry = nullptr ); /** Checks whether a geometry requires preparation before registration with PAL * @param geometry geometry to prepare @@ -954,7 +954,7 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface * @returns true if geometry requires preparation * @note added in QGIS 2.9 */ - static bool geometryRequiresPreparation( const QgsGeometry *geometry, QgsRenderContext &context, const QgsCoordinateTransform *ct, QgsGeometry *clipGeometry = 0 ); + static bool geometryRequiresPreparation( const QgsGeometry *geometry, QgsRenderContext &context, const QgsCoordinateTransform *ct, QgsGeometry *clipGeometry = nullptr ); /** Splits a text string to a list of separate lines, using a specified wrap character. * The text string will be split on either newline characters or the wrap character. diff --git a/src/core/qgspluginlayerregistry.cpp b/src/core/qgspluginlayerregistry.cpp index 61c139d93d8..0eefe1e6f67 100644 --- a/src/core/qgspluginlayerregistry.cpp +++ b/src/core/qgspluginlayerregistry.cpp @@ -37,13 +37,13 @@ QString QgsPluginLayerType::name() QgsPluginLayer* QgsPluginLayerType::createLayer() { - return NULL; + return nullptr; } QgsPluginLayer* QgsPluginLayerType::createLayer( const QString& uri ) { Q_UNUSED( uri ); - return NULL; + return nullptr; } bool QgsPluginLayerType::showLayerProperties( QgsPluginLayer *layer ) @@ -55,10 +55,10 @@ bool QgsPluginLayerType::showLayerProperties( QgsPluginLayer *layer ) //============================================================================= /** Static calls to enforce singleton behaviour */ -QgsPluginLayerRegistry* QgsPluginLayerRegistry::_instance = NULL; +QgsPluginLayerRegistry* QgsPluginLayerRegistry::_instance = nullptr; QgsPluginLayerRegistry* QgsPluginLayerRegistry::instance() { - if ( _instance == NULL ) + if ( _instance == nullptr ) { _instance = new QgsPluginLayerRegistry(); } @@ -87,7 +87,7 @@ QStringList QgsPluginLayerRegistry::pluginLayerTypes() bool QgsPluginLayerRegistry::addPluginLayerType( QgsPluginLayerType* type ) { - if ( type == NULL ) + if ( type == nullptr ) return false; if ( mPluginLayerTypes.contains( type->name() ) ) return false; @@ -123,7 +123,7 @@ bool QgsPluginLayerRegistry::removePluginLayerType( const QString& typeName ) QgsPluginLayerType* QgsPluginLayerRegistry::pluginLayerType( const QString& typeName ) { - return mPluginLayerTypes.value( typeName, NULL ); + return mPluginLayerTypes.value( typeName, nullptr ); } @@ -133,7 +133,7 @@ QgsPluginLayer* QgsPluginLayerRegistry::createLayer( const QString& typeName, co if ( !type ) { QgsDebugMsg( "Unknown plugin layer type: " + typeName ); - return NULL; + return nullptr; } if ( !uri.isEmpty() ) diff --git a/src/core/qgspointlocator.cpp b/src/core/qgspointlocator.cpp index 22001e7e708..d047cb9745a 100644 --- a/src/core/qgspointlocator.cpp +++ b/src/core/qgspointlocator.cpp @@ -82,7 +82,7 @@ class QgsPointLocator_Stream : public IDataStream class QgsPointLocator_VisitorNearestVertex : public IVisitor { public: - QgsPointLocator_VisitorNearestVertex( QgsPointLocator* pl, QgsPointLocator::Match& m, const QgsPoint& srcPoint, QgsPointLocator::MatchFilter* filter = 0 ) + QgsPointLocator_VisitorNearestVertex( QgsPointLocator* pl, QgsPointLocator::Match& m, const QgsPoint& srcPoint, QgsPointLocator::MatchFilter* filter = nullptr ) : mLocator( pl ), mBest( m ), mSrcPoint( srcPoint ), mFilter( filter ) {} void visitNode( const INode& n ) override { Q_UNUSED( n ); } @@ -120,7 +120,7 @@ class QgsPointLocator_VisitorNearestVertex : public IVisitor class QgsPointLocator_VisitorNearestEdge : public IVisitor { public: - QgsPointLocator_VisitorNearestEdge( QgsPointLocator* pl, QgsPointLocator::Match& m, const QgsPoint& srcPoint, QgsPointLocator::MatchFilter* filter = 0 ) + QgsPointLocator_VisitorNearestEdge( QgsPointLocator* pl, QgsPointLocator::Match& m, const QgsPoint& srcPoint, QgsPointLocator::MatchFilter* filter = nullptr ) : mLocator( pl ), mBest( m ), mSrcPoint( srcPoint ), mFilter( filter ) {} void visitNode( const INode& n ) override { Q_UNUSED( n ); } @@ -132,7 +132,7 @@ class QgsPointLocator_VisitorNearestEdge : public IVisitor QgsGeometry* geom = mLocator->mGeoms.value( id ); QgsPoint pt; int afterVertex; - double sqrDist = geom->closestSegmentWithContext( mSrcPoint, pt, afterVertex, 0, POINT_LOC_EPSILON ); + double sqrDist = geom->closestSegmentWithContext( mSrcPoint, pt, afterVertex, nullptr, POINT_LOC_EPSILON ); if ( sqrDist < 0 ) return; @@ -492,7 +492,7 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry* geom, co class QgsPointLocator_VisitorEdgesInRect : public IVisitor { public: - QgsPointLocator_VisitorEdgesInRect( QgsPointLocator* pl, QgsPointLocator::MatchList& lst, const QgsRectangle& srcRect, QgsPointLocator::MatchFilter* filter = 0 ) + QgsPointLocator_VisitorEdgesInRect( QgsPointLocator* pl, QgsPointLocator::MatchList& lst, const QgsRectangle& srcRect, QgsPointLocator::MatchFilter* filter = nullptr ) : mLocator( pl ), mList( lst ), mSrcRect( srcRect ), mFilter( filter ) {} void visitNode( const INode& n ) override { Q_UNUSED( n ); } @@ -572,12 +572,12 @@ class QgsPointLocator_DumpTree : public SpatialIndex::IQueryStrategy QgsPointLocator::QgsPointLocator( QgsVectorLayer* layer, const QgsCoordinateReferenceSystem* destCRS, const QgsRectangle* extent ) - : mStorage( 0 ) - , mRTree( 0 ) + : mStorage( nullptr ) + , mRTree( nullptr ) , mIsEmptyLayer( false ) - , mTransform( 0 ) + , mTransform( nullptr ) , mLayer( layer ) - , mExtent( 0 ) + , mExtent( nullptr ) { if ( destCRS ) { @@ -613,7 +613,7 @@ bool QgsPointLocator::init( int maxFeaturesToIndex ) bool QgsPointLocator::hasIndex() const { - return mRTree != 0 || mIsEmptyLayer; + return mRTree != nullptr || mIsEmptyLayer; } @@ -669,7 +669,7 @@ bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex ) } SpatialIndex::Region r( rect2region( f.constGeometry()->boundingBox() ) ); - dataList << new RTree::Data( 0, 0, r, f.id() ); + dataList << new RTree::Data( 0, nullptr, r, f.id() ); if ( mGeoms.contains( f.id() ) ) delete mGeoms.take( f.id() ); @@ -708,7 +708,7 @@ bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex ) void QgsPointLocator::destroyIndex() { delete mRTree; - mRTree = 0; + mRTree = nullptr; mIsEmptyLayer = false; @@ -750,7 +750,7 @@ void QgsPointLocator::onFeatureAdded( QgsFeatureId fid ) if ( !bbox.isNull() ) { SpatialIndex::Region r( rect2region( bbox ) ); - mRTree->insertData( 0, 0, r, f.id() ); + mRTree->insertData( 0, nullptr, r, f.id() ); if ( mGeoms.contains( f.id() ) ) delete mGeoms.take( f.id() ); diff --git a/src/core/qgspointlocator.h b/src/core/qgspointlocator.h index 16a137481b6..de1f7003a63 100644 --- a/src/core/qgspointlocator.h +++ b/src/core/qgspointlocator.h @@ -53,7 +53,7 @@ class CORE_EXPORT QgsPointLocator : public QObject * @arg destCRS if not null, will do the searches on data reprojected to the given CRS * @arg extent if not null, will index only a subset of the layer */ - explicit QgsPointLocator( QgsVectorLayer* layer, const QgsCoordinateReferenceSystem* destCRS = 0, const QgsRectangle* extent = 0 ); + explicit QgsPointLocator( QgsVectorLayer* layer, const QgsCoordinateReferenceSystem* destCRS = nullptr, const QgsRectangle* extent = nullptr ); ~QgsPointLocator(); @@ -80,9 +80,9 @@ class CORE_EXPORT QgsPointLocator : public QObject struct Match { //! consruct invalid match - Match() : mType( Invalid ), mDist( 0 ), mPoint(), mLayer( 0 ), mFid( 0 ), mVertexIndex( 0 ) {} + Match() : mType( Invalid ), mDist( 0 ), mPoint(), mLayer( nullptr ), mFid( 0 ), mVertexIndex( 0 ) {} - Match( Type t, QgsVectorLayer* vl, QgsFeatureId fid, double dist, const QgsPoint& pt, int vertexIndex = 0, QgsPoint* edgePoints = 0 ) + Match( Type t, QgsVectorLayer* vl, QgsFeatureId fid, double dist, const QgsPoint& pt, int vertexIndex = 0, QgsPoint* edgePoints = nullptr ) : mType( t ), mDist( dist ), mPoint( pt ), mLayer( vl ), mFid( fid ), mVertexIndex( vertexIndex ) { if ( edgePoints ) @@ -147,15 +147,15 @@ class CORE_EXPORT QgsPointLocator : public QObject //! Find nearest vertex to the specified point - up to distance specified by tolerance //! Optional filter may discard unwanted matches. - Match nearestVertex( const QgsPoint& point, double tolerance, MatchFilter* filter = 0 ); + Match nearestVertex( const QgsPoint& point, double tolerance, MatchFilter* filter = nullptr ); //! Find nearest edges to the specified point - up to distance specified by tolerance //! Optional filter may discard unwanted matches. - Match nearestEdge( const QgsPoint& point, double tolerance, MatchFilter* filter = 0 ); + Match nearestEdge( const QgsPoint& point, double tolerance, MatchFilter* filter = nullptr ); //! Find edges within a specified recangle //! Optional filter may discard unwanted matches. - MatchList edgesInRect( const QgsRectangle& rect, MatchFilter* filter = 0 ); + MatchList edgesInRect( const QgsRectangle& rect, MatchFilter* filter = nullptr ); //! Override of edgesInRect that construct rectangle from a center point and tolerance - MatchList edgesInRect( const QgsPoint& point, double tolerance, MatchFilter* filter = 0 ); + MatchList edgesInRect( const QgsPoint& point, double tolerance, MatchFilter* filter = nullptr ); // point-in-polygon query diff --git a/src/core/qgsproject.cpp b/src/core/qgsproject.cpp index 67a12157624..b94dd8eefa6 100644 --- a/src/core/qgsproject.cpp +++ b/src/core/qgsproject.cpp @@ -48,7 +48,7 @@ #include // canonical project instance -QgsProject *QgsProject::theProject_ = 0; +QgsProject *QgsProject::theProject_ = nullptr; /** Take the given scope and key and convert them to a string list of key @@ -150,23 +150,23 @@ QgsProperty *findKey_( QString const &scope, else { // QgsPropertyValue not Key, so return null - return 0; + return nullptr; } } else { // if the next key down isn't found // then the overall key sequence doesn't exist - return 0; + return nullptr; } } else { - return 0; + return nullptr; } } - return 0; + return nullptr; } // findKey_ @@ -225,7 +225,7 @@ QgsProperty *addKey_( QString const &scope, } else // QgsPropertyValue not Key, so return null { - return 0; + return nullptr; } } else // the next subkey doesn't exist, so add it @@ -239,11 +239,11 @@ QgsProperty *addKey_( QString const &scope, } else { - return 0; + return nullptr; } } - return 0; + return nullptr; } // addKey_ @@ -256,8 +256,8 @@ void removeKey_( QString const &scope, { QgsPropertyKey *currentProperty = &rootProperty; - QgsProperty *nextProperty = 0; // link to next property down hiearchy - QgsPropertyKey *previousQgsPropertyKey = 0; // link to previous property up hiearchy + QgsProperty *nextProperty = nullptr; // link to next property down hiearchy + QgsPropertyKey *previousQgsPropertyKey = nullptr; // link to previous property up hiearchy QStringList keySequence = makeKeyTokens_( scope, key ); @@ -724,7 +724,7 @@ bool QgsProject::addLayer( const QDomElement &layerElem, QList &broken { QString type = layerElem.attribute( "type" ); QgsDebugMsg( "Layer type is " + type ); - QgsMapLayer *mapLayer = 0; + QgsMapLayer *mapLayer = nullptr; if ( type == "vector" ) { @@ -1777,13 +1777,13 @@ QgsLayerTreeGroup *QgsProject::createEmbeddedGroup( const QString &groupName, co QFile projectFile( projectFilePath ); if ( !projectFile.open( QIODevice::ReadOnly ) ) { - return 0; + return nullptr; } QDomDocument projectDocument; if ( !projectDocument.setContent( &projectFile ) ) { - return 0; + return nullptr; } // store identify disabled layers of the embedded project @@ -1815,13 +1815,13 @@ QgsLayerTreeGroup *QgsProject::createEmbeddedGroup( const QString &groupName, co { // embedded groups cannot be embedded again delete root; - return 0; + return nullptr; } // clone the group sub-tree (it is used already in a tree, we cannot just tear it off) QgsLayerTreeGroup *newGroup = QgsLayerTree::toGroup( group->clone() ); delete root; - root = 0; + root = nullptr; newGroup->setCustomProperty( "embedded", 1 ); newGroup->setCustomProperty( "embedded_project", projectFilePath ); diff --git a/src/core/qgsproject.h b/src/core/qgsproject.h index 02273ce1f93..5f42c641f1c 100644 --- a/src/core/qgsproject.h +++ b/src/core/qgsproject.h @@ -216,12 +216,12 @@ class CORE_EXPORT QgsProject : public QObject */ //@{ - QStringList readListEntry( const QString & scope, const QString & key, const QStringList& def = QStringList(), bool *ok = 0 ) const; + QStringList readListEntry( const QString & scope, const QString & key, const QStringList& def = QStringList(), bool *ok = nullptr ) const; - QString readEntry( const QString & scope, const QString & key, const QString & def = QString::null, bool * ok = 0 ) const; - int readNumEntry( const QString & scope, const QString & key, int def = 0, bool * ok = 0 ) const; - double readDoubleEntry( const QString & scope, const QString & key, double def = 0, bool * ok = 0 ) const; - bool readBoolEntry( const QString & scope, const QString & key, bool def = false, bool * ok = 0 ) const; + QString readEntry( const QString & scope, const QString & key, const QString & def = QString::null, bool * ok = nullptr ) const; + int readNumEntry( const QString & scope, const QString & key, int def = 0, bool * ok = nullptr ) const; + double readDoubleEntry( const QString & scope, const QString & key, double def = 0, bool * ok = nullptr ) const; + bool readBoolEntry( const QString & scope, const QString & key, bool def = false, bool * ok = nullptr ) const; //@} diff --git a/src/core/qgsproviderregistry.cpp b/src/core/qgsproviderregistry.cpp index 7fca0136d5a..28eec11992c 100644 --- a/src/core/qgsproviderregistry.cpp +++ b/src/core/qgsproviderregistry.cpp @@ -262,7 +262,7 @@ QgsProviderMetadata * findMetadata_( QgsProviderRegistry::Providers const & meta return i->second; } - return 0x0; + return nullptr; } // findMetadata_ @@ -370,14 +370,14 @@ QgsDataProvider *QgsProviderRegistry::provider( QString const & providerKey, QSt if ( !myLib.load() ) { QgsMessageLog::logMessage( QObject::tr( "Failed to load %1: %2" ).arg( lib, myLib.errorString() ) ); - return 0; + return nullptr; } classFactoryFunction_t *classFactory = ( classFactoryFunction_t * ) cast_to_fptr( myLib.resolve( "classFactory" ) ); if ( !classFactory ) { QgsDebugMsg( QString( "Failed to load %1: no classFactory method" ).arg( lib ) ); - return 0; + return nullptr; } QgsDataProvider *dataProvider = classFactory( &dataSource ); @@ -385,7 +385,7 @@ QgsDataProvider *QgsProviderRegistry::provider( QString const & providerKey, QSt { QgsMessageLog::logMessage( QObject::tr( "Unable to instantiate the data provider plugin %1" ).arg( lib ) ); myLib.unload(); - return 0; + return nullptr; } QgsDebugMsg( QString( "Instantiated the data provider plugin: %1" ).arg( dataProvider->name() ) ); @@ -419,7 +419,7 @@ QWidget* QgsProviderRegistry::selectWidget( const QString & providerKey, ( selectFactoryFunction_t * ) cast_to_fptr( function( providerKey, "selectWidget" ) ); if ( !selectFactory ) - return 0; + return nullptr; return selectFactory( parent, fl ); } @@ -457,7 +457,7 @@ void *QgsProviderRegistry::function( QString const & providerKey, else { QgsDebugMsg( "Cannot load library: " + myLib.errorString() ); - return 0; + return nullptr; } } #endif @@ -475,7 +475,7 @@ QLibrary *QgsProviderRegistry::providerLibrary( QString const & providerKey ) co delete myLib; - return 0; + return nullptr; } void QgsProviderRegistry::registerGuis( QWidget *parent ) diff --git a/src/core/qgsproviderregistry.h b/src/core/qgsproviderregistry.h index fe275e52936..9b216c95f6f 100644 --- a/src/core/qgsproviderregistry.h +++ b/src/core/qgsproviderregistry.h @@ -80,7 +80,7 @@ class CORE_EXPORT QgsProviderRegistry int providerCapabilities( const QString& providerKey ) const; QWidget *selectWidget( const QString & providerKey, - QWidget * parent = 0, const Qt::WindowFlags& fl = 0 ); + QWidget * parent = nullptr, const Qt::WindowFlags& fl = nullptr ); #if QT_VERSION >= 0x050000 /** Get pointer to provider function diff --git a/src/core/qgspythonrunner.cpp b/src/core/qgspythonrunner.cpp index fd7bcaa2d0e..402ca8481f8 100644 --- a/src/core/qgspythonrunner.cpp +++ b/src/core/qgspythonrunner.cpp @@ -15,14 +15,14 @@ #include "qgspythonrunner.h" #include "qgslogger.h" -QgsPythonRunner* QgsPythonRunner::mInstance = NULL; +QgsPythonRunner* QgsPythonRunner::mInstance = nullptr; /////////////////////////// // static methods bool QgsPythonRunner::isValid() { - return mInstance != NULL; + return mInstance != nullptr; } bool QgsPythonRunner::run( const QString& command, const QString& messageOnError ) diff --git a/src/core/qgsrectangle.h b/src/core/qgsrectangle.h index 04da0d33bb3..6282928365b 100644 --- a/src/core/qgsrectangle.h +++ b/src/core/qgsrectangle.h @@ -79,7 +79,7 @@ class CORE_EXPORT QgsRectangle //! Center point of the rectangle QgsPoint center() const; //! Scale the rectangle around its center point - void scale( double scaleFactor, const QgsPoint *c = 0 ); + void scale( double scaleFactor, const QgsPoint *c = nullptr ); void scale( double scaleFactor, double centerX, double centerY ); //! Grow the rectangle by the specified amount void grow( double delta ); diff --git a/src/core/qgsrelation.cpp b/src/core/qgsrelation.cpp index 2c7c0f56fa2..c23c0a0d506 100644 --- a/src/core/qgsrelation.cpp +++ b/src/core/qgsrelation.cpp @@ -21,8 +21,8 @@ #include "qgsvectorlayer.h" QgsRelation::QgsRelation() - : mReferencingLayer( NULL ) - , mReferencedLayer( NULL ) + : mReferencingLayer( nullptr ) + , mReferencedLayer( nullptr ) , mValid( false ) { } @@ -48,7 +48,7 @@ QgsRelation QgsRelation::createFromXML( const QDomNode &node ) QgsMapLayer* referencingLayer = mapLayers[referencingLayerId]; QgsMapLayer* referencedLayer = mapLayers[referencedLayerId]; - if ( NULL == referencingLayer ) + if ( nullptr == referencingLayer ) { QgsLogger::warning( QApplication::translate( "QgsRelation", "Relation defined for layer '%1' which does not exist." ).arg( referencingLayerId ) ); } @@ -57,7 +57,7 @@ QgsRelation QgsRelation::createFromXML( const QDomNode &node ) QgsLogger::warning( QApplication::translate( "QgsRelation", "Relation defined for layer '%1' which is not of type VectorLayer." ).arg( referencingLayerId ) ); } - if ( NULL == referencedLayer ) + if ( nullptr == referencedLayer ) { QgsLogger::warning( QApplication::translate( "QgsRelation", "Relation defined for layer '%1' which does not exist." ).arg( referencedLayerId ) ); } diff --git a/src/core/qgsrelationmanager.h b/src/core/qgsrelationmanager.h index 6bdf4b0056e..1c77de53566 100644 --- a/src/core/qgsrelationmanager.h +++ b/src/core/qgsrelationmanager.h @@ -93,7 +93,7 @@ class CORE_EXPORT QgsRelationManager : public QObject * * @return A list of relations matching the given layer and fieldIdx. */ - QList referencingRelations( QgsVectorLayer *layer = 0, int fieldIdx = -2 ) const; + QList referencingRelations( QgsVectorLayer *layer = nullptr, int fieldIdx = -2 ) const; /** * Get all relations where this layer is the referenced part (i.e. the parent table with the primary key being referenced from another layer). @@ -102,7 +102,7 @@ class CORE_EXPORT QgsRelationManager : public QObject * * @return A list of relations where the specified layer is the referenced part. */ - QList referencedRelations( QgsVectorLayer *layer = 0 ) const; + QList referencedRelations( QgsVectorLayer *layer = nullptr ) const; signals: /** This signal is emitted when the relations were loaded after reading a project */ diff --git a/src/core/qgsrenderchecker.cpp b/src/core/qgsrenderchecker.cpp index bd51ef8b506..55ad0c9d826 100644 --- a/src/core/qgsrenderchecker.cpp +++ b/src/core/qgsrenderchecker.cpp @@ -409,7 +409,7 @@ bool QgsRenderChecker::compareImages( const QString& theTestName, { const QRgb* expectedScanline = ( const QRgb* )myExpectedImage.constScanLine( y ); const QRgb* resultScanline = ( const QRgb* )myResultImage.constScanLine( y ); - const QRgb* maskScanline = hasMask ? ( const QRgb* )maskImage->constScanLine( y ) : 0; + const QRgb* maskScanline = hasMask ? ( const QRgb* )maskImage->constScanLine( y ) : nullptr; QRgb* diffScanline = ( QRgb* )myDifferenceImage.scanLine( y ); for ( int x = 0; x < maxWidth; ++x ) diff --git a/src/core/qgsrendercontext.cpp b/src/core/qgsrendercontext.cpp index ed8bc531c4b..0a09ab80738 100644 --- a/src/core/qgsrendercontext.cpp +++ b/src/core/qgsrendercontext.cpp @@ -25,16 +25,16 @@ QgsRenderContext::QgsRenderContext() : mFlags( DrawEditingInfo | UseAdvancedEffects | DrawSelection | UseRenderingOptimization ) - , mPainter( 0 ) - , mCoordTransform( 0 ) + , mPainter( nullptr ) + , mCoordTransform( nullptr ) , mRenderingStopped( false ) , mScaleFactor( 1.0 ) , mRasterScaleFactor( 1.0 ) , mRendererScale( 1.0 ) - , mLabelingEngine( 0 ) - , mLabelingEngine2( 0 ) - , mGeometry( 0 ) - , mFeatureFilterProvider( 0 ) + , mLabelingEngine( nullptr ) + , mLabelingEngine2( nullptr ) + , mGeometry( nullptr ) + , mFeatureFilterProvider( nullptr ) { mVectorSimplifyMethod.setSimplifyHints( QgsVectorSimplifyMethod::NoSimplification ); } @@ -42,7 +42,7 @@ QgsRenderContext::QgsRenderContext() QgsRenderContext::~QgsRenderContext() { delete mFeatureFilterProvider; - mFeatureFilterProvider = 0; + mFeatureFilterProvider = nullptr; } void QgsRenderContext::setFlags( const QgsRenderContext::Flags& flags ) @@ -77,7 +77,7 @@ QgsRenderContext QgsRenderContext::fromMapSettings( const QgsMapSettings& mapSet ctx.setFlag( ForceVectorOutput, mapSettings.testFlag( QgsMapSettings::ForceVectorOutput ) ); ctx.setFlag( UseAdvancedEffects, mapSettings.testFlag( QgsMapSettings::UseAdvancedEffects ) ); ctx.setFlag( UseRenderingOptimization, mapSettings.testFlag( QgsMapSettings::UseRenderingOptimization ) ); - ctx.setCoordinateTransform( 0 ); + ctx.setCoordinateTransform( nullptr ); ctx.setSelectionColor( mapSettings.selectionColor() ); ctx.setFlag( DrawSelection, mapSettings.testFlag( QgsMapSettings::DrawSelection ) ); ctx.setFlag( DrawSymbolBounds, mapSettings.testFlag( QgsMapSettings::DrawSymbolBounds ) ); @@ -151,7 +151,7 @@ void QgsRenderContext::setUseRenderingOptimization( bool enabled ) void QgsRenderContext::setFeatureFilterProvider( const QgsFeatureFilterProvider* ffp ) { delete mFeatureFilterProvider; - mFeatureFilterProvider = 0; + mFeatureFilterProvider = nullptr; if ( ffp ) { diff --git a/src/core/qgsrulebasedlabeling.cpp b/src/core/qgsrulebasedlabeling.cpp index 8bd5d458605..36d6bd3b199 100644 --- a/src/core/qgsrulebasedlabeling.cpp +++ b/src/core/qgsrulebasedlabeling.cpp @@ -43,12 +43,12 @@ QList QgsRuleBasedLabelProvider::subProviders() //////////////////// QgsRuleBasedLabeling::Rule::Rule( QgsPalLayerSettings* settings, int scaleMinDenom, int scaleMaxDenom, const QString& filterExp, const QString& description, bool elseRule ) - : mParent( 0 ), mSettings( settings ) + : mParent( nullptr ), mSettings( settings ) , mScaleMinDenom( scaleMinDenom ), mScaleMaxDenom( scaleMaxDenom ) , mFilterExp( filterExp ), mDescription( description ) , mElseRule( elseRule ) , mIsActive( true ) - , mFilter( 0 ) + , mFilter( nullptr ) { initFilter(); } @@ -75,7 +75,7 @@ void QgsRuleBasedLabeling::Rule::initFilter() if ( mElseRule || mFilterExp.compare( "ELSE", Qt::CaseInsensitive ) == 0 ) { mElseRule = true; - mFilter = 0; + mFilter = nullptr; } else if ( !mFilterExp.isEmpty() ) { @@ -84,7 +84,7 @@ void QgsRuleBasedLabeling::Rule::initFilter() } else { - mFilter = 0; + mFilter = nullptr; } } @@ -123,7 +123,7 @@ void QgsRuleBasedLabeling::Rule::removeChildAt( int i ) QgsRuleBasedLabeling::Rule*QgsRuleBasedLabeling::Rule::clone() const { - QgsPalLayerSettings* s = mSettings ? new QgsPalLayerSettings( *mSettings ) : 0; + QgsPalLayerSettings* s = mSettings ? new QgsPalLayerSettings( *mSettings ) : nullptr; Rule* newrule = new Rule( s, mScaleMinDenom, mScaleMaxDenom, mFilterExp, mDescription ); newrule->setActive( mIsActive ); // clone children @@ -134,7 +134,7 @@ QgsRuleBasedLabeling::Rule*QgsRuleBasedLabeling::Rule::clone() const QgsRuleBasedLabeling::Rule*QgsRuleBasedLabeling::Rule::create( const QDomElement& ruleElem ) { - QgsPalLayerSettings* settings = 0; + QgsPalLayerSettings* settings = nullptr; QDomElement settingsElem = ruleElem.firstChildElement( "settings" ); if ( !settingsElem.isNull() ) { @@ -335,7 +335,7 @@ QgsRuleBasedLabeling*QgsRuleBasedLabeling::create( const QDomElement& element ) Rule* root = Rule::create( rulesElem ); if ( !root ) - return 0; + return nullptr; QgsRuleBasedLabeling* rl = new QgsRuleBasedLabeling( root ); return rl; diff --git a/src/core/qgsrulebasedlabeling.h b/src/core/qgsrulebasedlabeling.h index a2c7821d046..e1fbca8bad8 100644 --- a/src/core/qgsrulebasedlabeling.h +++ b/src/core/qgsrulebasedlabeling.h @@ -194,7 +194,7 @@ class CORE_EXPORT QgsRuleBasedLabeling : public QgsAbstractVectorLayerLabeling void prepare( const QgsRenderContext& context, QStringList& attributeNames, RuleToProviderMap& subProviders ); //! register individual features - RegisterResult registerFeature( QgsFeature& feature, QgsRenderContext& context, RuleToProviderMap& subProviders, QgsGeometry* obstacleGeometry = 0 ); + RegisterResult registerFeature( QgsFeature& feature, QgsRenderContext& context, RuleToProviderMap& subProviders, QgsGeometry* obstacleGeometry = nullptr ); protected: /** @@ -274,7 +274,7 @@ class CORE_EXPORT QgsRuleBasedLabelProvider : public QgsVectorLayerLabelProvider virtual bool prepare( const QgsRenderContext& context, QStringList& attributeNames ) override; - virtual void registerFeature( QgsFeature& feature, QgsRenderContext& context, QgsGeometry* obstacleGeometry = 0 ) override; + virtual void registerFeature( QgsFeature& feature, QgsRenderContext& context, QgsGeometry* obstacleGeometry = nullptr ) override; // new methods diff --git a/src/core/qgsrunprocess.cpp b/src/core/qgsrunprocess.cpp index 58758c00069..8fd1b38fe20 100644 --- a/src/core/qgsrunprocess.cpp +++ b/src/core/qgsrunprocess.cpp @@ -26,7 +26,7 @@ #include QgsRunProcess::QgsRunProcess( const QString& action, bool capture ) - : mProcess( NULL ), mOutput( NULL ) + : mProcess( nullptr ), mOutput( nullptr ) { // Make up a string from the command and arguments that we'll use // for display purposes @@ -67,7 +67,7 @@ QgsRunProcess::QgsRunProcess( const QString& action, bool capture ) { if ( ! mProcess->startDetached( action ) ) // let the program run by itself { - QMessageBox::critical( 0, tr( "Action" ), + QMessageBox::critical( nullptr, tr( "Action" ), tr( "Unable to run command\n%1" ).arg( action ), QMessageBox::Ok, Qt::NoButton ); } @@ -113,7 +113,7 @@ void QgsRunProcess::processExit( int, QProcess::ExitStatus ) // (unless it was never created in the first case, which is what the // test against 0 is for). - if ( mOutput != 0 ) + if ( mOutput != nullptr ) { mOutput->appendMessage( "" + tr( "Done" ) + "" ); } @@ -133,7 +133,7 @@ void QgsRunProcess::dialogGone() // class being called after it has been deleted (Qt seems not to be // disconnecting them itself) - mOutput = 0; + mOutput = nullptr; disconnect( mProcess, SIGNAL( error( QProcess::ProcessError ) ), this, SLOT( processError( QProcess::ProcessError ) ) ); disconnect( mProcess, SIGNAL( readyReadStandardOutput() ), this, SLOT( stdoutAvailable() ) ); diff --git a/src/core/qgssimplifymethod.cpp b/src/core/qgssimplifymethod.cpp index 17fe43ec3bc..a6f42fb8fab 100644 --- a/src/core/qgssimplifymethod.cpp +++ b/src/core/qgssimplifymethod.cpp @@ -73,6 +73,6 @@ QgsAbstractGeometrySimplifier* QgsSimplifyMethod::createGeometrySimplifier( cons else { QgsDebugMsg( QString( "Simplification method type (%1) is not recognised" ).arg( methodType ) ); - return NULL; + return nullptr; } } diff --git a/src/core/qgssnappingutils.cpp b/src/core/qgssnappingutils.cpp index 5deef02b734..b09b74a1c28 100644 --- a/src/core/qgssnappingutils.cpp +++ b/src/core/qgssnappingutils.cpp @@ -23,7 +23,7 @@ QgsSnappingUtils::QgsSnappingUtils( QObject* parent ) : QObject( parent ) - , mCurrentLayer( 0 ) + , mCurrentLayer( nullptr ) , mSnapToMapMode( SnapCurrentLayer ) , mStrategy( IndexHybrid ) , mDefaultType( QgsPointLocator::Vertex ) @@ -44,7 +44,7 @@ QgsSnappingUtils::~QgsSnappingUtils() QgsPointLocator* QgsSnappingUtils::locatorForLayer( QgsVectorLayer* vl ) { if ( !vl ) - return 0; + return nullptr; if ( !mLocators.contains( vl ) ) { @@ -167,7 +167,7 @@ static QgsPointLocator::Match _findClosestSegmentIntersection( const QgsPoint& p } } - return QgsPointLocator::Match( QgsPointLocator::Vertex, 0, 0, sqrt( minSqrDist ), minP ); + return QgsPointLocator::Match( QgsPointLocator::Vertex, nullptr, 0, sqrt( minSqrDist ), minP ); } @@ -274,7 +274,7 @@ QgsPointLocator::Match QgsSnappingUtils::snapToMap( const QgsPoint& pointMap, Qg else if ( mSnapToMapMode == SnapAllLayers ) { // data from project - double tolerance = QgsTolerance::toleranceInProjectUnits( mDefaultTolerance, 0, mMapSettings, mDefaultUnit ); + double tolerance = QgsTolerance::toleranceInProjectUnits( mDefaultTolerance, nullptr, mMapSettings, mDefaultUnit ); int type = mDefaultType; QList layers; @@ -387,7 +387,7 @@ void QgsSnappingUtils::defaultSettings( int& type, double& tolerance, QgsToleran const QgsCoordinateReferenceSystem* QgsSnappingUtils::destCRS() { - return mMapSettings.hasCrsTransformEnabled() ? &mMapSettings.destinationCrs() : 0; + return mMapSettings.hasCrsTransformEnabled() ? &mMapSettings.destinationCrs() : nullptr; } diff --git a/src/core/qgssnappingutils.h b/src/core/qgssnappingutils.h index 9f5a82aa0e5..34b76c1fb52 100644 --- a/src/core/qgssnappingutils.h +++ b/src/core/qgssnappingutils.h @@ -42,7 +42,7 @@ class CORE_EXPORT QgsSnappingUtils : public QObject { Q_OBJECT public: - QgsSnappingUtils( QObject* parent = 0 ); + QgsSnappingUtils( QObject* parent = nullptr ); ~QgsSnappingUtils(); // main actions @@ -51,11 +51,11 @@ class CORE_EXPORT QgsSnappingUtils : public QObject QgsPointLocator* locatorForLayer( QgsVectorLayer* vl ); /** Snap to map according to the current configuration (mode). Optional filter allows to discard unwanted matches. */ - QgsPointLocator::Match snapToMap( const QPoint& point, QgsPointLocator::MatchFilter* filter = 0 ); - QgsPointLocator::Match snapToMap( const QgsPoint& pointMap, QgsPointLocator::MatchFilter* filter = 0 ); + QgsPointLocator::Match snapToMap( const QPoint& point, QgsPointLocator::MatchFilter* filter = nullptr ); + QgsPointLocator::Match snapToMap( const QgsPoint& pointMap, QgsPointLocator::MatchFilter* filter = nullptr ); /** Snap to current layer */ - QgsPointLocator::Match snapToCurrentLayer( const QPoint& point, int type, QgsPointLocator::MatchFilter* filter = 0 ); + QgsPointLocator::Match snapToCurrentLayer( const QPoint& point, int type, QgsPointLocator::MatchFilter* filter = nullptr ); // environment setup diff --git a/src/core/qgsspatialindex.cpp b/src/core/qgsspatialindex.cpp index b8c18aa7d29..61cc30f7ce6 100644 --- a/src/core/qgsspatialindex.cpp +++ b/src/core/qgsspatialindex.cpp @@ -62,7 +62,7 @@ class QgsSpatialIndexCopyVisitor : public SpatialIndex::IVisitor { SpatialIndex::IShape* shape; d.getShape( &shape ); - mNewIndex->insertData( 0, 0, *shape, d.getIdentifier() ); + mNewIndex->insertData( 0, nullptr, *shape, d.getIdentifier() ); delete shape; } @@ -81,7 +81,7 @@ class QgsFeatureIteratorDataStream : public IDataStream //! constructor - needs to load all data to a vector for later access when bulk loading explicit QgsFeatureIteratorDataStream( const QgsFeatureIterator& fi ) : mFi( fi ) - , mNextData( 0 ) + , mNextData( nullptr ) { readNextEntry(); } @@ -95,13 +95,13 @@ class QgsFeatureIteratorDataStream : public IDataStream virtual IData* getNext() override { RTree::Data* ret = mNextData; - mNextData = 0; + mNextData = nullptr; readNextEntry(); return ret; } //! returns true if there are more items in the stream. - virtual bool hasNext() override { return mNextData != 0; } + virtual bool hasNext() override { return mNextData != nullptr; } //! returns the total number of entries available in the stream. virtual uint32_t size() override { Q_ASSERT( 0 && "not available" ); return 0; } @@ -119,7 +119,7 @@ class QgsFeatureIteratorDataStream : public IDataStream { if ( QgsSpatialIndex::featureInfo( f, r, id ) ) { - mNextData = new RTree::Data( 0, 0, r, id ); + mNextData = new RTree::Data( 0, nullptr, r, id ); return; } } @@ -165,7 +165,7 @@ class QgsSpatialIndexData : public QSharedData delete mStorage; } - void initTree( IDataStream* inputStream = 0 ) + void initTree( IDataStream* inputStream = nullptr ) { // for now only memory manager mStorage = StorageManager::createNewMemoryStorageManager(); @@ -257,7 +257,7 @@ bool QgsSpatialIndex::insertFeature( const QgsFeature& f ) // TODO: handle possible exceptions correctly try { - d->mRTree->insertData( 0, 0, r, FID_TO_NUMBER( id ) ); + d->mRTree->insertData( 0, nullptr, r, FID_TO_NUMBER( id ) ); return true; } catch ( Tools::Exception &e ) diff --git a/src/core/qgssqlexpressioncompiler.h b/src/core/qgssqlexpressioncompiler.h index 0bf07a4c2e2..e42a79517a5 100644 --- a/src/core/qgssqlexpressioncompiler.h +++ b/src/core/qgssqlexpressioncompiler.h @@ -56,7 +56,7 @@ class CORE_EXPORT QgsSqlExpressionCompiler * @param fields fields from provider * @param flags flags which control how expression is compiled */ - explicit QgsSqlExpressionCompiler( const QgsFields& fields, const Flags& flags = ( Flags )0 ); + explicit QgsSqlExpressionCompiler( const QgsFields& fields, const Flags& flags = ( Flags )nullptr ); virtual ~QgsSqlExpressionCompiler(); /** Compiles an expression and returns the result of the compilation. diff --git a/src/core/qgstolerance.cpp b/src/core/qgstolerance.cpp index 203fff41be5..9d863d9a826 100644 --- a/src/core/qgstolerance.cpp +++ b/src/core/qgstolerance.cpp @@ -79,7 +79,7 @@ double QgsTolerance::vertexSearchRadius( const QgsMapSettings& mapSettings ) UnitType units = ( QgsTolerance::UnitType ) settings.value( "/qgis/digitizing/search_radius_vertex_edit_unit", QgsTolerance::Pixels ).toInt(); if ( units == LayerUnits ) units = ProjectUnits; - return toleranceInProjectUnits( tolerance, 0, mapSettings, units ); + return toleranceInProjectUnits( tolerance, nullptr, mapSettings, units ); } double QgsTolerance::vertexSearchRadius( QgsMapLayer *layer, const QgsMapSettings &mapSettings ) diff --git a/src/core/qgstransaction.cpp b/src/core/qgstransaction.cpp index cb3c20c9b1c..fe6dcbd6819 100644 --- a/src/core/qgstransaction.cpp +++ b/src/core/qgstransaction.cpp @@ -32,13 +32,13 @@ QgsTransaction* QgsTransaction::create( const QString& connString, const QString QLibrary* lib = QgsProviderRegistry::instance()->providerLibrary( providerKey ); if ( !lib ) { - return 0; + return nullptr; } createTransaction_t* createTransaction = ( createTransaction_t* ) cast_to_fptr( lib->resolve( "createTransaction" ) ); if ( !createTransaction ) { - return 0; + return nullptr; } QgsTransaction* ts = createTransaction( connString ); @@ -52,13 +52,13 @@ QgsTransaction* QgsTransaction::create( const QStringList& layerIds ) { if ( layerIds.isEmpty() ) { - return 0; + return nullptr; } QgsVectorLayer* layer = qobject_cast( QgsMapLayerRegistry::instance()->mapLayer( layerIds.first() ) ); if ( !layer ) { - return 0; + return nullptr; } QString connStr = QgsDataSourceURI( layer->source() ).connectionInfo(); @@ -66,7 +66,7 @@ QgsTransaction* QgsTransaction::create( const QStringList& layerIds ) QgsTransaction* ts = QgsTransaction::create( connStr, providerKey ); if ( !ts ) { - return 0; + return nullptr; } Q_FOREACH ( const QString& layerId, layerIds ) @@ -74,7 +74,7 @@ QgsTransaction* QgsTransaction::create( const QStringList& layerIds ) if ( !ts->addLayer( layerId ) ) { delete ts; - return 0; + return nullptr; } } return ts; @@ -88,7 +88,7 @@ QgsTransaction::QgsTransaction( const QString& connString ) QgsTransaction::~QgsTransaction() { - setLayerTransactionIds( 0 ); + setLayerTransactionIds( nullptr ); } bool QgsTransaction::addLayer( const QString& layerId ) @@ -125,7 +125,7 @@ bool QgsTransaction::addLayer( QgsVectorLayer* layer ) return false; } - if ( layer->dataProvider()->transaction() != 0 ) + if ( layer->dataProvider()->transaction() != nullptr ) { return false; } @@ -182,7 +182,7 @@ bool QgsTransaction::commit( QString& errorMsg ) return false; } - setLayerTransactionIds( 0 ); + setLayerTransactionIds( nullptr ); mTransactionActive = false; return true; } @@ -207,7 +207,7 @@ bool QgsTransaction::rollback( QString& errorMsg ) return false; } - setLayerTransactionIds( 0 ); + setLayerTransactionIds( nullptr ); mTransactionActive = false; emit afterRollback(); diff --git a/src/core/qgsvectordataprovider.h b/src/core/qgsvectordataprovider.h index ccec6d4ffac..db53a7c6df6 100644 --- a/src/core/qgsvectordataprovider.h +++ b/src/core/qgsvectordataprovider.h @@ -130,7 +130,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider * @note added in 2.4 * @return new instance of QgsAbstractFeatureSource (caller is responsible for deleting it) */ - virtual QgsAbstractFeatureSource* featureSource() const { Q_ASSERT( 0 && "All providers must support featureSource()" ); return 0; } + virtual QgsAbstractFeatureSource* featureSource() const { Q_ASSERT( 0 && "All providers must support featureSource()" ); return nullptr; } /** * Returns the permanent storage type for this layer as a friendly name. @@ -369,7 +369,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider /** * Returns the transaction this data provider is included in, if any. */ - virtual QgsTransaction* transaction() const { return 0; } + virtual QgsTransaction* transaction() const { return nullptr; } /** * Forces a reload of the underlying datasource if the provider implements this diff --git a/src/core/qgsvectorfilewriter.cpp b/src/core/qgsvectorfilewriter.cpp index 3f4a7bbd7d4..22082309dc5 100644 --- a/src/core/qgsvectorfilewriter.cpp +++ b/src/core/qgsvectorfilewriter.cpp @@ -67,12 +67,12 @@ QgsVectorFileWriter::QgsVectorFileWriter( QString *newFilename, SymbologyExport symbologyExport ) - : mDS( NULL ) - , mLayer( NULL ) - , mOgrRef( NULL ) - , mGeom( NULL ) + : mDS( nullptr ) + , mLayer( nullptr ) + , mOgrRef( nullptr ) + , mGeom( nullptr ) , mError( NoError ) - , mCodec( 0 ) + , mCodec( nullptr ) , mWkbType( geometryType ) , mSymbologyExport( symbologyExport ) , mSymbologyScaleDenominator( 1.0 ) @@ -111,7 +111,7 @@ QgsVectorFileWriter::QgsVectorFileWriter( { layOptions.append( "SHPT=NULL" ); } - srs = 0; + srs = nullptr; } else { @@ -211,7 +211,7 @@ QgsVectorFileWriter::QgsVectorFileWriter( QFile::remove( vectorFileName ); } - char **options = NULL; + char **options = nullptr; if ( !dsOptions.isEmpty() ) { options = new char *[ dsOptions.size()+1 ]; @@ -219,7 +219,7 @@ QgsVectorFileWriter::QgsVectorFileWriter( { options[i] = CPLStrdup( dsOptions[i].toLocal8Bit().data() ); } - options[ dsOptions.size()] = NULL; + options[ dsOptions.size()] = nullptr; } // create the data source @@ -230,10 +230,10 @@ QgsVectorFileWriter::QgsVectorFileWriter( for ( int i = 0; i < dsOptions.size(); i++ ) CPLFree( options[i] ); delete [] options; - options = NULL; + options = nullptr; } - if ( mDS == NULL ) + if ( mDS == nullptr ) { mError = ErrCreateDataSource; mErrorMessage = QObject::tr( "creation of data source failed (OGR error:%1)" ) @@ -279,7 +279,7 @@ QgsVectorFileWriter::QgsVectorFileWriter( { options[i] = CPLStrdup( layOptions[i].toLocal8Bit().data() ); } - options[ layOptions.size()] = NULL; + options[ layOptions.size()] = nullptr; } // disable encoding conversion of OGR Shapefile layer @@ -292,13 +292,13 @@ QgsVectorFileWriter::QgsVectorFileWriter( for ( int i = 0; i < layOptions.size(); i++ ) CPLFree( options[i] ); delete [] options; - options = NULL; + options = nullptr; } QSettings settings; if ( !settings.value( "/qgis/ignoreShapeEncoding", true ).toBool() ) { - CPLSetConfigOption( "SHAPE_ENCODING", 0 ); + CPLSetConfigOption( "SHAPE_ENCODING", nullptr ); } if ( srs ) @@ -320,7 +320,7 @@ QgsVectorFileWriter::QgsVectorFileWriter( } } - if ( mLayer == NULL ) + if ( mLayer == nullptr ) { mErrorMessage = QObject::tr( "creation of layer failed (OGR error:%1)" ) .arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ); @@ -1715,7 +1715,7 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature ) attrValue.toString() ); QgsMessageLog::logMessage( mErrorMessage, QObject::tr( "OGR" ) ); mError = ErrFeatureWriteFailed; - return 0; + return nullptr; } } @@ -1733,7 +1733,7 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature ) if ( geom && geom->wkbType() != mWkbType ) { - OGRGeometryH mGeom2 = NULL; + OGRGeometryH mGeom2 = nullptr; // If requested WKB type is 25D and geometry WKB type is 3D, // we must force the use of 25D. @@ -1771,7 +1771,7 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature ) mError = ErrFeatureWriteFailed; QgsMessageLog::logMessage( mErrorMessage, QObject::tr( "OGR" ) ); OGR_F_Destroy( poFeature ); - return 0; + return nullptr; } OGRErr err = OGR_G_ImportFromWkb( mGeom2, const_cast( geom->asWkb() ), ( int ) geom->wkbSize() ); @@ -1782,7 +1782,7 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature ) mError = ErrFeatureWriteFailed; QgsMessageLog::logMessage( mErrorMessage, QObject::tr( "OGR" ) ); OGR_F_Destroy( poFeature ); - return 0; + return nullptr; } // pass ownership to geometry @@ -1798,7 +1798,7 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature ) mError = ErrFeatureWriteFailed; QgsMessageLog::logMessage( mErrorMessage, QObject::tr( "OGR" ) ); OGR_F_Destroy( poFeature ); - return 0; + return nullptr; } // set geometry (ownership is not passed to OGR) @@ -1862,7 +1862,7 @@ QgsVectorFileWriter::writeAsVectorFormat( QgsVectorLayer* layer, bool forceMulti, bool includeZ ) { - QgsCoordinateTransform* ct = 0; + QgsCoordinateTransform* ct = nullptr; if ( destCRS && layer ) { ct = new QgsCoordinateTransform( layer->crs(), *destCRS ); @@ -1898,7 +1898,7 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::writeAsVectorFormat( QgsVe } bool shallTransform = false; - const QgsCoordinateReferenceSystem* outputCRS = 0; + const QgsCoordinateReferenceSystem* outputCRS = nullptr; if ( ct ) { // This means we should transform @@ -2223,7 +2223,7 @@ QMap QgsVectorFileWriter::ogrDriverList() QString option = "SPATIALITE=YES"; char **options = new char *[2]; options[0] = CPLStrdup( option.toLocal8Bit().data() ); - options[1] = NULL; + options[1] = nullptr; OGRSFDriverH poDriver; QgsApplication::registerOgrDrivers(); poDriver = OGRGetDriverByName( drvName.toLocal8Bit().data() ); @@ -2570,7 +2570,7 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::exportFeaturesSymbolLevels //fetch features QgsFeature fet; - QgsSymbolV2* featureSymbol = 0; + QgsSymbolV2* featureSymbol = nullptr; while ( fit.nextFeature( fet ) ) { if ( ct ) @@ -2744,11 +2744,11 @@ QgsFeatureRendererV2* QgsVectorFileWriter::symbologyRenderer( QgsVectorLayer* vl { if ( mSymbologyExport == NoSymbology ) { - return 0; + return nullptr; } if ( !vl ) { - return 0; + return nullptr; } return vl->rendererV2(); diff --git a/src/core/qgsvectorfilewriter.h b/src/core/qgsvectorfilewriter.h index 5879333105d..390ba335e8a 100644 --- a/src/core/qgsvectorfilewriter.h +++ b/src/core/qgsvectorfilewriter.h @@ -186,14 +186,14 @@ class CORE_EXPORT QgsVectorFileWriter const QgsCoordinateReferenceSystem *destCRS, const QString& driverName = "ESRI Shapefile", bool onlySelected = false, - QString *errorMessage = 0, + QString *errorMessage = nullptr, const QStringList &datasourceOptions = QStringList(), const QStringList &layerOptions = QStringList(), bool skipAttributeCreation = false, - QString *newFilename = 0, + QString *newFilename = nullptr, SymbologyExport symbologyExport = NoSymbology, double symbologyScale = 1.0, - const QgsRectangle* filterExtent = 0, + const QgsRectangle* filterExtent = nullptr, QgsWKBTypes::Type overrideGeometryType = QgsWKBTypes::Unknown, bool forceMulti = false, bool includeZ = false @@ -226,14 +226,14 @@ class CORE_EXPORT QgsVectorFileWriter const QgsCoordinateTransform* ct, const QString& driverName = "ESRI Shapefile", bool onlySelected = false, - QString *errorMessage = 0, + QString *errorMessage = nullptr, const QStringList &datasourceOptions = QStringList(), const QStringList &layerOptions = QStringList(), bool skipAttributeCreation = false, - QString *newFilename = 0, + QString *newFilename = nullptr, SymbologyExport symbologyExport = NoSymbology, double symbologyScale = 1.0, - const QgsRectangle* filterExtent = 0, + const QgsRectangle* filterExtent = nullptr, QgsWKBTypes::Type overrideGeometryType = QgsWKBTypes::Unknown, bool forceMulti = false, bool includeZ = false @@ -248,7 +248,7 @@ class CORE_EXPORT QgsVectorFileWriter const QString& driverName = "ESRI Shapefile", const QStringList &datasourceOptions = QStringList(), const QStringList &layerOptions = QStringList(), - QString *newFilename = 0, + QString *newFilename = nullptr, SymbologyExport symbologyExport = NoSymbology ); @@ -277,7 +277,7 @@ class CORE_EXPORT QgsVectorFileWriter QString errorMessage(); /** Add feature to the currently opened shapefile */ - bool addFeature( QgsFeature& feature, QgsFeatureRendererV2* renderer = 0, QGis::UnitType outputUnit = QGis::Meters ); + bool addFeature( QgsFeature& feature, QgsFeatureRendererV2* renderer = nullptr, QGis::UnitType outputUnit = QGis::Meters ); //! @note not available in python bindings QMap attrIdxToOgrIdx() { return mAttrIdxToOgrIdx; } @@ -344,7 +344,7 @@ class CORE_EXPORT QgsVectorFileWriter bool writeFeature( OGRLayerH layer, OGRFeatureH feature ); /** Writes features considering symbol level order*/ - WriterError exportFeaturesSymbolLevels( QgsVectorLayer* layer, QgsFeatureIterator& fit, const QgsCoordinateTransform* ct, QString* errorMessage = 0 ); + WriterError exportFeaturesSymbolLevels( QgsVectorLayer* layer, QgsFeatureIterator& fit, const QgsCoordinateTransform* ct, QString* errorMessage = nullptr ); double mmScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, QGis::UnitType mapUnits ); double mapUnitScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, QGis::UnitType mapUnits ); diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp index 8bbcc3fd03a..baaacc3e1b1 100644 --- a/src/core/qgsvectorlayer.cpp +++ b/src/core/qgsvectorlayer.cpp @@ -125,13 +125,13 @@ QgsVectorLayer::QgsVectorLayer( const QString& vectorLayerPath, const QString& providerKey, bool loadDefaultStyleFlag ) : QgsMapLayer( VectorLayer, baseName, vectorLayerPath ) - , mDataProvider( NULL ) + , mDataProvider( nullptr ) , mProviderKey( providerKey ) , mReadOnly( false ) , mEditFormConfig( new QgsEditFormConfig( this ) ) , mWkbType( QGis::WKBUnknown ) - , mRendererV2( NULL ) - , mLabel( 0 ) + , mRendererV2( nullptr ) + , mLabel( nullptr ) , mLabelOn( false ) , mLabeling( new QgsVectorLayerSimpleLabeling ) , mLabelFontNotFoundNotified( false ) @@ -139,11 +139,11 @@ QgsVectorLayer::QgsVectorLayer( const QString& vectorLayerPath, , mLayerTransparency( 0 ) , mVertexMarkerOnlyForSelection( false ) , mCache( new QgsGeometryCache() ) - , mEditBuffer( 0 ) - , mJoinBuffer( 0 ) - , mExpressionFieldBuffer( 0 ) - , mDiagramRenderer( 0 ) - , mDiagramLayerSettings( 0 ) + , mEditBuffer( nullptr ) + , mJoinBuffer( nullptr ) + , mExpressionFieldBuffer( nullptr ) + , mDiagramRenderer( nullptr ) + , mDiagramLayerSettings( nullptr ) , mValidExtent( false ) , mLazyExtent( true ) , mSymbolFeatureCounted( false ) @@ -202,7 +202,7 @@ QString QgsVectorLayer::storageType() const { return mDataProvider->storageType(); } - return 0; + return nullptr; } @@ -212,7 +212,7 @@ QString QgsVectorLayer::capabilitiesString() const { return mDataProvider->capabilitiesString(); } - return 0; + return nullptr; } QString QgsVectorLayer::dataComment() const @@ -354,7 +354,7 @@ void QgsVectorLayer::drawLabels( QgsRenderContext& rendererContext ) if ( mRendererV2->willRenderFeature( fet, rendererContext ) ) { bool sel = mSelectedFeatureIds.contains( fet.id() ); - mLabel->renderLabel( rendererContext, fet, sel, 0 ); + mLabel->renderLabel( rendererContext, fet, sel, nullptr ); } featureCount++; } @@ -884,7 +884,7 @@ QString QgsVectorLayer::subsetString() if ( !mValid || !mDataProvider ) { QgsDebugMsg( "invoked with invalid layer or null mDataProvider" ); - return 0; + return nullptr; } return mDataProvider->subsetString(); } @@ -1738,7 +1738,7 @@ bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage } //diagram renderer and diagram layer settings - delete mDiagramRenderer; mDiagramRenderer = 0; + delete mDiagramRenderer; mDiagramRenderer = nullptr; QDomElement singleCatDiagramElem = node.firstChildElement( "SingleCategoryDiagramRenderer" ); if ( !singleCatDiagramElem.isNull() ) { @@ -2233,7 +2233,7 @@ bool QgsVectorLayer::commitChanges() if ( success ) { delete mEditBuffer; - mEditBuffer = 0; + mEditBuffer = nullptr; undoStack()->clear(); emit editingStopped(); } @@ -2283,7 +2283,7 @@ bool QgsVectorLayer::rollBack( bool deleteBuffer ) if ( deleteBuffer ) { delete mEditBuffer; - mEditBuffer = 0; + mEditBuffer = nullptr; undoStack()->clear(); } emit editingStopped(); @@ -2505,7 +2505,7 @@ void QgsVectorLayer::snapToGeometry( const QgsPoint& startPoint, { if ( geometryType() != QGis::Point ) // cannot snap to segment for points/multipoints { - sqrDistSegmentSnap = geom->closestSegmentWithContext( startPoint, snappedPoint, afterVertex, NULL, crs().geographicFlag() ? 1e-12 : 1e-8 ); + sqrDistSegmentSnap = geom->closestSegmentWithContext( startPoint, snappedPoint, afterVertex, nullptr, crs().geographicFlag() ? 1e-12 : 1e-8 ); if ( sqrDistSegmentSnap < sqrSnappingTolerance ) { diff --git a/src/core/qgsvectorlayer.h b/src/core/qgsvectorlayer.h index 9a06a8403c8..89715093334 100644 --- a/src/core/qgsvectorlayer.h +++ b/src/core/qgsvectorlayer.h @@ -908,7 +908,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer /** Deletes the selected features * @return true in case of success and false otherwise */ - bool deleteSelectedFeatures( int *deletedCount = 0 ); + bool deleteSelectedFeatures( int *deletedCount = nullptr ); /** Adds a ring to polygon/multipolygon features * @param ring ring to add @@ -921,7 +921,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer 4 ring crosses existing rings, 5 no feature found where ring can be inserted 6 layer not editable */ - int addRing( const QList& ring, QgsFeatureId* featureId = 0 ); + int addRing( const QList& ring, QgsFeatureId* featureId = nullptr ); /** Adds a ring to polygon/multipolygon features (takes ownership) * @param ring ring to add @@ -933,7 +933,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer 6 layer not editable @note available in python as addCurvedRing */ - int addRing( QgsCurveV2* ring, QgsFeatureId* featureId = 0 ); + int addRing( QgsCurveV2* ring, QgsFeatureId* featureId = nullptr ); /** Adds a new part polygon to a multipart feature @return @@ -1572,7 +1572,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer * @note added in QGIS 2.9 * @see getValues */ - QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int* nullCount = 0 ); + QList< double > getDoubleValues( const QString &fieldOrExpression, bool &ok, bool selectedOnly = false, int* nullCount = nullptr ); /** Set the blending mode used for rendering each feature */ void setFeatureBlendMode( const QPainter::CompositionMode &blendMode ); diff --git a/src/core/qgsvectorlayercache.cpp b/src/core/qgsvectorlayercache.cpp index a2a96607f72..1868f16c355 100644 --- a/src/core/qgsvectorlayercache.cpp +++ b/src/core/qgsvectorlayercache.cpp @@ -136,14 +136,14 @@ bool QgsVectorLayerCache::featureAtId( QgsFeatureId featureId, QgsFeature& featu { bool featureFound = false; - QgsCachedFeature* cachedFeature = NULL; + QgsCachedFeature* cachedFeature = nullptr; if ( !skipCache ) { cachedFeature = mCache[ featureId ]; } - if ( cachedFeature != NULL ) + if ( cachedFeature != nullptr ) { feature = QgsFeature( *cachedFeature->feature() ); featureFound = true; @@ -151,7 +151,7 @@ bool QgsVectorLayerCache::featureAtId( QgsFeatureId featureId, QgsFeature& featu else if ( mLayer->getFeatures( QgsFeatureRequest() .setFilterFid( featureId ) .setSubsetOfAttributes( mCachedAttributes ) - .setFlags( !mCacheGeometry ? QgsFeatureRequest::NoGeometry : QgsFeatureRequest::Flags( 0 ) ) ) + .setFlags( !mCacheGeometry ? QgsFeatureRequest::NoGeometry : QgsFeatureRequest::Flags( nullptr ) ) ) .nextFeature( feature ) ) { cacheFeature( feature ); @@ -195,7 +195,7 @@ void QgsVectorLayerCache::onAttributeValueChanged( QgsFeatureId fid, int field, { QgsCachedFeature* cachedFeat = mCache[ fid ]; - if ( NULL != cachedFeat ) + if ( nullptr != cachedFeat ) { cachedFeat->mFeature->setAttribute( field, value ); } @@ -248,7 +248,7 @@ void QgsVectorLayerCache::geometryChanged( QgsFeatureId fid, QgsGeometry& geom ) { QgsCachedFeature* cachedFeat = mCache[ fid ]; - if ( cachedFeat != NULL ) + if ( cachedFeat != nullptr ) { cachedFeat->mFeature->setGeometry( geom ); } @@ -257,7 +257,7 @@ void QgsVectorLayerCache::geometryChanged( QgsFeatureId fid, QgsGeometry& geom ) void QgsVectorLayerCache::layerDeleted() { emit cachedLayerDeleted(); - mLayer = NULL; + mLayer = nullptr; } void QgsVectorLayerCache::invalidate() diff --git a/src/core/qgsvectorlayercache.h b/src/core/qgsvectorlayercache.h index 4c328c6fb42..e5d1dbd2747 100644 --- a/src/core/qgsvectorlayercache.h +++ b/src/core/qgsvectorlayercache.h @@ -79,7 +79,7 @@ class CORE_EXPORT QgsVectorLayerCache : public QObject }; public: - QgsVectorLayerCache( QgsVectorLayer* layer, int cacheSize, QObject* parent = NULL ); + QgsVectorLayerCache( QgsVectorLayer* layer, int cacheSize, QObject* parent = nullptr ); ~QgsVectorLayerCache(); /** diff --git a/src/core/qgsvectorlayerdiagramprovider.cpp b/src/core/qgsvectorlayerdiagramprovider.cpp index 2f79c0df3f7..aa4beb45da8 100644 --- a/src/core/qgsvectorlayerdiagramprovider.cpp +++ b/src/core/qgsvectorlayerdiagramprovider.cpp @@ -50,7 +50,7 @@ QgsVectorLayerDiagramProvider::QgsVectorLayerDiagramProvider( QgsVectorLayer* la , mLayerId( layer->id() ) , mFields( layer->fields() ) , mLayerCrs( layer->crs() ) - , mSource( ownFeatureLoop ? new QgsVectorLayerFeatureSource( layer ) : 0 ) + , mSource( ownFeatureLoop ? new QgsVectorLayerFeatureSource( layer ) : nullptr ) , mOwnsSource( ownFeatureLoop ) { init(); @@ -159,7 +159,7 @@ bool QgsVectorLayerDiagramProvider::prepare( const QgsRenderContext& context, QS QgsDiagramLayerSettings& s2 = mSettings; const QgsMapSettings& mapSettings = mEngine->mapSettings(); - s2.ct = 0; + s2.ct = nullptr; if ( mapSettings.hasCrsTransformEnabled() ) { if ( context.coordinateTransform() ) @@ -194,7 +194,7 @@ bool QgsVectorLayerDiagramProvider::prepare( const QgsRenderContext& context, QS } const QgsLinearlyInterpolatedDiagramRenderer* linearlyInterpolatedDiagramRenderer = dynamic_cast( diagRenderer ); - if ( linearlyInterpolatedDiagramRenderer != NULL ) + if ( linearlyInterpolatedDiagramRenderer != nullptr ) { if ( linearlyInterpolatedDiagramRenderer->classificationAttributeIsExpression() ) { @@ -246,13 +246,13 @@ QgsLabelFeature* QgsVectorLayerDiagramProvider::registerDiagram( QgsFeature& fea double minScale = settingList.at( 0 ).minScaleDenominator; if ( minScale > 0 && context.rendererScale() < minScale ) { - return 0; + return nullptr; } double maxScale = settingList.at( 0 ).maxScaleDenominator; if ( maxScale > 0 && context.rendererScale() > maxScale ) { - return 0; + return nullptr; } } } @@ -266,13 +266,13 @@ QgsLabelFeature* QgsVectorLayerDiagramProvider::registerDiagram( QgsFeature& fea extentGeom->rotate( -mapSettings.rotation(), mapSettings.visibleExtent().center() ); } - const GEOSGeometry* geos_geom = 0; + const GEOSGeometry* geos_geom = nullptr; QScopedPointer preparedGeom; if ( QgsPalLabeling::geometryRequiresPreparation( geom, context, mSettings.ct, extentGeom.data() ) ) { preparedGeom.reset( QgsPalLabeling::prepareGeometry( geom, context, mSettings.ct, extentGeom.data() ) ); if ( !preparedGeom.data() ) - return 0; + return nullptr; geos_geom = preparedGeom.data()->asGeos(); } else @@ -280,13 +280,13 @@ QgsLabelFeature* QgsVectorLayerDiagramProvider::registerDiagram( QgsFeature& fea geos_geom = geom->asGeos(); } - if ( geos_geom == 0 ) + if ( geos_geom == nullptr ) { - return 0; // invalid geometry + return nullptr; // invalid geometry } GEOSGeometry* geomCopy = GEOSGeom_clone_r( QgsGeometry::getGEOSHandler(), geos_geom ); - const GEOSGeometry* geosObstacleGeom = 0; + const GEOSGeometry* geosObstacleGeom = nullptr; QScopedPointer scopedObstacleGeom; if ( mSettings.obstacle && obstacleGeometry && QgsPalLabeling::geometryRequiresPreparation( obstacleGeometry, context, mSettings.ct, extentGeom.data() ) ) { @@ -297,7 +297,7 @@ QgsLabelFeature* QgsVectorLayerDiagramProvider::registerDiagram( QgsFeature& fea { geosObstacleGeom = obstacleGeometry->asGeos(); } - GEOSGeometry* geosObstacleGeomClone = 0; + GEOSGeometry* geosObstacleGeomClone = nullptr; if ( geosObstacleGeom ) { geosObstacleGeomClone = GEOSGeom_clone_r( QgsGeometry::getGEOSHandler(), geosObstacleGeom ); diff --git a/src/core/qgsvectorlayerdiagramprovider.h b/src/core/qgsvectorlayerdiagramprovider.h index f03dae6ec3e..a79bc7e0c9d 100644 --- a/src/core/qgsvectorlayerdiagramprovider.h +++ b/src/core/qgsvectorlayerdiagramprovider.h @@ -96,13 +96,13 @@ class CORE_EXPORT QgsVectorLayerDiagramProvider : public QgsAbstractLabelProvide * the feature's original geometry will be used as an obstacle for labels. Ownership of obstacleGeometry * is transferred. */ - virtual void registerFeature( QgsFeature& feature, QgsRenderContext &context, QgsGeometry* obstacleGeometry = 0 ); + virtual void registerFeature( QgsFeature& feature, QgsRenderContext &context, QgsGeometry* obstacleGeometry = nullptr ); protected: //! initialization method - called from constructors void init(); //! helper method to register one diagram feautre - QgsLabelFeature* registerDiagram( QgsFeature& feat, QgsRenderContext& context, QgsGeometry* obstacleGeometry = 0 ); + QgsLabelFeature* registerDiagram( QgsFeature& feat, QgsRenderContext& context, QgsGeometry* obstacleGeometry = nullptr ); protected: diff --git a/src/core/qgsvectorlayereditbuffer.h b/src/core/qgsvectorlayereditbuffer.h index 5f8848f87b7..af507dfaa43 100644 --- a/src/core/qgsvectorlayereditbuffer.h +++ b/src/core/qgsvectorlayereditbuffer.h @@ -134,7 +134,7 @@ class CORE_EXPORT QgsVectorLayerEditBuffer : public QObject protected: - QgsVectorLayerEditBuffer() : L( NULL ) {} + QgsVectorLayerEditBuffer() : L( nullptr ) {} void updateFields( QgsFields& fields ); diff --git a/src/core/qgsvectorlayereditutils.cpp b/src/core/qgsvectorlayereditutils.cpp index 23cfc7907dc..22d13050781 100644 --- a/src/core/qgsvectorlayereditutils.cpp +++ b/src/core/qgsvectorlayereditutils.cpp @@ -106,7 +106,7 @@ bool QgsVectorLayerEditUtils::deleteVertex( QgsFeatureId atFeatureId, int atVert if ( geometry.geometry() && geometry.geometry()->nCoordinates() == 0 ) { //last vertex deleted, set geometry to null - geometry.setGeometry( 0 ); + geometry.setGeometry( nullptr ); } @@ -347,7 +347,7 @@ int QgsVectorLayerEditUtils::splitFeatures( const QList& splitLine, bo } QList newGeometries; QList topologyTestPoints; - QgsGeometry* newGeometry = 0; + QgsGeometry* newGeometry = nullptr; splitFunctionReturn = feat.geometry()->splitGeometry( splitLine, newGeometries, topologicalEditing, topologyTestPoints ); if ( splitFunctionReturn == 0 ) { diff --git a/src/core/qgsvectorlayereditutils.h b/src/core/qgsvectorlayereditutils.h index 6674253059b..a7dec7f4e36 100644 --- a/src/core/qgsvectorlayereditutils.h +++ b/src/core/qgsvectorlayereditutils.h @@ -65,7 +65,7 @@ class CORE_EXPORT QgsVectorLayerEditUtils 3 ring not valid, 4 ring crosses existing rings, 5 no feature found where ring can be inserted*/ - int addRing( const QList& ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = 0 ); + int addRing( const QList& ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = nullptr ); /** Adds a ring to polygon/multipolygon features * @param ring ring to add @@ -79,7 +79,7 @@ class CORE_EXPORT QgsVectorLayerEditUtils 3 ring not valid, 4 ring crosses existing rings, 5 no feature found where ring can be inserted*/ - int addRing( QgsCurveV2* ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = 0 ); + int addRing( QgsCurveV2* ring, const QgsFeatureIds& targetFeatureIds = QgsFeatureIds(), QgsFeatureId* modifiedFeatureId = nullptr ); /** Adds a new part polygon to a multipart feature @return diff --git a/src/core/qgsvectorlayerfeatureiterator.cpp b/src/core/qgsvectorlayerfeatureiterator.cpp index d7746733f18..782c9958eee 100644 --- a/src/core/qgsvectorlayerfeatureiterator.cpp +++ b/src/core/qgsvectorlayerfeatureiterator.cpp @@ -89,7 +89,7 @@ QgsFeatureIterator QgsVectorLayerFeatureSource::getFeatures( const QgsFeatureReq QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator( QgsVectorLayerFeatureSource* source, bool ownSource, const QgsFeatureRequest& request ) : QgsAbstractFeatureIteratorFromSource( source, ownSource, request ) , mFetchedFid( false ) - , mEditGeometrySimplifier( 0 ) + , mEditGeometrySimplifier( nullptr ) { prepareExpressions(); @@ -168,7 +168,7 @@ QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator( QgsVectorLayerFeat QgsVectorLayerFeatureIterator::~QgsVectorLayerFeatureIterator() { delete mEditGeometrySimplifier; - mEditGeometrySimplifier = NULL; + mEditGeometrySimplifier = nullptr; qDeleteAll( mExpressionFieldInfo ); @@ -602,13 +602,13 @@ void QgsVectorLayerFeatureIterator::addVirtualAttributes( QgsFeature& f ) bool QgsVectorLayerFeatureIterator::prepareSimplification( const QgsSimplifyMethod& simplifyMethod ) { delete mEditGeometrySimplifier; - mEditGeometrySimplifier = NULL; + mEditGeometrySimplifier = nullptr; // setup simplification for edited geometries to fetch if ( !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) && simplifyMethod.methodType() != QgsSimplifyMethod::NoSimplification && mSource->mCanBeSimplified ) { mEditGeometrySimplifier = QgsSimplifyMethod::createGeometrySimplifier( simplifyMethod ); - return mEditGeometrySimplifier != NULL; + return mEditGeometrySimplifier != nullptr; } return false; } diff --git a/src/core/qgsvectorlayerimport.cpp b/src/core/qgsvectorlayerimport.cpp index e414e538c10..f8645ad5ae4 100644 --- a/src/core/qgsvectorlayerimport.cpp +++ b/src/core/qgsvectorlayerimport.cpp @@ -55,7 +55,7 @@ QgsVectorLayerImport::QgsVectorLayerImport( const QString &uri, , mProgress( progress ) { - mProvider = NULL; + mProvider = nullptr; QgsProviderRegistry * pReg = QgsProviderRegistry::instance(); @@ -214,10 +214,10 @@ QgsVectorLayerImport::importLayer( QgsVectorLayer* layer, QProgressDialog *progress ) { const QgsCoordinateReferenceSystem* outputCRS; - QgsCoordinateTransform* ct = 0; + QgsCoordinateTransform* ct = nullptr; bool shallTransform = false; - if ( layer == NULL ) + if ( layer == nullptr ) { return ErrInvalidLayer; } @@ -322,7 +322,7 @@ QgsVectorLayerImport::importLayer( QgsVectorLayer* layer, } // Check for failure - if ( ct == NULL ) + if ( ct == nullptr ) { shallTransform = false; } diff --git a/src/core/qgsvectorlayerimport.h b/src/core/qgsvectorlayerimport.h index 4ea058d98dc..3aea4bf57c3 100644 --- a/src/core/qgsvectorlayerimport.h +++ b/src/core/qgsvectorlayerimport.h @@ -59,10 +59,10 @@ class CORE_EXPORT QgsVectorLayerImport const QString& providerKey, const QgsCoordinateReferenceSystem *destCRS, bool onlySelected = false, - QString *errorMessage = 0, + QString *errorMessage = nullptr, bool skipAttributeCreation = false, - QMap *options = 0, - QProgressDialog *progress = 0 + QMap *options = nullptr, + QProgressDialog *progress = nullptr ); /** Create a empty layer and add fields to it */ @@ -72,8 +72,8 @@ class CORE_EXPORT QgsVectorLayerImport QGis::WkbType geometryType, const QgsCoordinateReferenceSystem* crs, bool overwrite = false, - const QMap *options = 0, - QProgressDialog *progress = 0 + const QMap *options = nullptr, + QProgressDialog *progress = nullptr ); /** Checks whether there were any errors */ diff --git a/src/core/qgsvectorlayerjoinbuffer.cpp b/src/core/qgsvectorlayerjoinbuffer.cpp index 1e4d70c7cea..fec77be0e4a 100644 --- a/src/core/qgsvectorlayerjoinbuffer.cpp +++ b/src/core/qgsvectorlayerjoinbuffer.cpp @@ -369,14 +369,14 @@ int QgsVectorLayerJoinBuffer::joinedFieldsOffset( const QgsVectorJoinInfo* info, const QgsVectorJoinInfo* QgsVectorLayerJoinBuffer::joinForFieldIndex( int index, const QgsFields& fields, int& sourceFieldIndex ) const { if ( fields.fieldOrigin( index ) != QgsFields::OriginJoin ) - return 0; + return nullptr; int originIndex = fields.fieldOriginIndex( index ); int sourceJoinIndex = originIndex / 1000; sourceFieldIndex = originIndex % 1000; if ( sourceJoinIndex < 0 || sourceJoinIndex >= mVectorJoins.count() ) - return 0; + return nullptr; return &( mVectorJoins[sourceJoinIndex] ); } diff --git a/src/core/qgsvectorlayerjoinbuffer.h b/src/core/qgsvectorlayerjoinbuffer.h index 23d73c10c39..0c35f42324b 100644 --- a/src/core/qgsvectorlayerjoinbuffer.h +++ b/src/core/qgsvectorlayerjoinbuffer.h @@ -33,7 +33,7 @@ class CORE_EXPORT QgsVectorLayerJoinBuffer : public QObject { Q_OBJECT public: - QgsVectorLayerJoinBuffer( QgsVectorLayer* layer = 0 ); + QgsVectorLayerJoinBuffer( QgsVectorLayer* layer = nullptr ); ~QgsVectorLayerJoinBuffer(); /** Joins another vector layer to this layer diff --git a/src/core/qgsvectorlayerlabeling.cpp b/src/core/qgsvectorlayerlabeling.cpp index 733309a11e6..c5e4d500066 100644 --- a/src/core/qgsvectorlayerlabeling.cpp +++ b/src/core/qgsvectorlayerlabeling.cpp @@ -27,7 +27,7 @@ QgsVectorLayerLabelProvider* QgsVectorLayerSimpleLabeling::provider( QgsVectorLa if ( layer->customProperty( "labeling" ).toString() == QLatin1String( "pal" ) && layer->labelsEnabled() ) return new QgsVectorLayerLabelProvider( layer, false ); - return 0; + return nullptr; } QString QgsVectorLayerSimpleLabeling::type() const diff --git a/src/core/qgsvectorlayerlabelprovider.cpp b/src/core/qgsvectorlayerlabelprovider.cpp index 9ff26167c94..9177c966824 100644 --- a/src/core/qgsvectorlayerlabelprovider.cpp +++ b/src/core/qgsvectorlayerlabelprovider.cpp @@ -66,7 +66,7 @@ QgsVectorLayerLabelProvider::QgsVectorLayerLabelProvider( QgsVectorLayer* layer, } else { - mSource = 0; + mSource = nullptr; mOwnsSource = false; } @@ -228,7 +228,7 @@ bool QgsVectorLayerLabelProvider::prepare( const QgsRenderContext& context, QStr lyr.fieldIndex = mFields.fieldNameIndex( lyr.fieldName ); lyr.xform = &mapSettings.mapToPixel(); - lyr.ct = 0; + lyr.ct = nullptr; if ( mapSettings.hasCrsTransformEnabled() ) { if ( context.coordinateTransform() ) @@ -301,7 +301,7 @@ QList QgsVectorLayerLabelProvider::labelFeatures( QgsRenderCon void QgsVectorLayerLabelProvider::registerFeature( QgsFeature& feature, QgsRenderContext& context, QgsGeometry* obstacleGeometry ) { - QgsLabelFeature* label = 0; + QgsLabelFeature* label = nullptr; mSettings.registerFeature( feature, context, QString(), &label, obstacleGeometry ); if ( label ) mLabels << label; @@ -310,13 +310,13 @@ void QgsVectorLayerLabelProvider::registerFeature( QgsFeature& feature, QgsRende QgsGeometry* QgsVectorLayerLabelProvider::getPointObstacleGeometry( QgsFeature& fet, QgsRenderContext& context, QgsFeatureRendererV2* renderer ) { if ( !fet.constGeometry() || fet.constGeometry()->isEmpty() || fet.constGeometry()->type() != QGis::Point || !renderer ) - return 0; + return nullptr; //calculate bounds for symbols for feature QgsSymbolV2List symbols = renderer->originalSymbolsForFeature( fet, context ); bool isMultiPoint = fet.constGeometry()->geometry()->nCoordinates() > 1; - QgsAbstractGeometryV2* obstacleGeom = 0; + QgsAbstractGeometryV2* obstacleGeom = nullptr; if ( isMultiPoint ) obstacleGeom = new QgsMultiPolygonV2(); diff --git a/src/core/qgsvectorlayerlabelprovider.h b/src/core/qgsvectorlayerlabelprovider.h index 6358cb37b56..11400e3a2ae 100644 --- a/src/core/qgsvectorlayerlabelprovider.h +++ b/src/core/qgsvectorlayerlabelprovider.h @@ -33,7 +33,7 @@ class CORE_EXPORT QgsVectorLayerLabelProvider : public QgsAbstractLabelProvider public: //! Convenience constructor to initialize the provider from given vector layer - explicit QgsVectorLayerLabelProvider( QgsVectorLayer* layer, bool withFeatureLoop = true, const QgsPalLayerSettings* settings = 0, const QString& layerName = QString() ); + explicit QgsVectorLayerLabelProvider( QgsVectorLayer* layer, bool withFeatureLoop = true, const QgsPalLayerSettings* settings = nullptr, const QString& layerName = QString() ); //! Construct diagram provider with all the necessary configuration parameters QgsVectorLayerLabelProvider( const QgsPalLayerSettings& settings, @@ -42,7 +42,7 @@ class CORE_EXPORT QgsVectorLayerLabelProvider : public QgsAbstractLabelProvider const QgsCoordinateReferenceSystem& crs, QgsAbstractFeatureSource* source, bool ownsSource, - QgsFeatureRendererV2* renderer = 0 ); + QgsFeatureRendererV2* renderer = nullptr ); ~QgsVectorLayerLabelProvider(); @@ -71,7 +71,7 @@ class CORE_EXPORT QgsVectorLayerLabelProvider : public QgsAbstractLabelProvider * symbol, the obstacle geometry should represent the bounds of the offset symbol). If not set, * the feature's original geometry will be used as an obstacle for labels. */ - virtual void registerFeature( QgsFeature& feature, QgsRenderContext &context, QgsGeometry* obstacleGeometry = 0 ); + virtual void registerFeature( QgsFeature& feature, QgsRenderContext &context, QgsGeometry* obstacleGeometry = nullptr ); /** Returns the geometry for a point feature which should be used as an obstacle for labels. This * obstacle geometry will respect the dimensions and offsets of the symbol used to render the diff --git a/src/core/qgsvectorlayerrenderer.cpp b/src/core/qgsvectorlayerrenderer.cpp index e22ebfd0816..2a34acd231a 100644 --- a/src/core/qgsvectorlayerrenderer.cpp +++ b/src/core/qgsvectorlayerrenderer.cpp @@ -46,20 +46,20 @@ QgsVectorLayerRenderer::QgsVectorLayerRenderer( QgsVectorLayer* layer, QgsRender , mContext( context ) , mLayer( layer ) , mFields( layer->fields() ) - , mRendererV2( 0 ) - , mCache( 0 ) + , mRendererV2( nullptr ) + , mCache( nullptr ) , mLabeling( false ) , mDiagrams( false ) - , mLabelProvider( 0 ) - , mDiagramProvider( 0 ) + , mLabelProvider( nullptr ) + , mDiagramProvider( nullptr ) , mLayerTransparency( 0 ) { mSource = new QgsVectorLayerFeatureSource( layer ); - mRendererV2 = layer->rendererV2() ? layer->rendererV2()->clone() : 0; + mRendererV2 = layer->rendererV2() ? layer->rendererV2()->clone() : nullptr; mSelectedFeatureIds = layer->selectedFeaturesIds(); - mDrawVertexMarkers = ( layer->editBuffer() != 0 ); + mDrawVertexMarkers = ( layer->editBuffer() != nullptr ); mGeometryType = layer->geometryType(); @@ -352,14 +352,14 @@ void QgsVectorLayerRenderer::drawRendererV2( QgsFeatureIterator& fit ) } } - stopRendererV2( 0 ); + stopRendererV2( nullptr ); } void QgsVectorLayerRenderer::drawRendererV2Levels( QgsFeatureIterator& fit ) { QHash< QgsSymbolV2*, QList > features; // key = symbol, value = array of features - QgsSingleSymbolRendererV2* selRenderer = 0; + QgsSingleSymbolRendererV2* selRenderer = nullptr; if ( !mSelectedFeatureIds.isEmpty() ) { selRenderer = new QgsSingleSymbolRendererV2( QgsSymbolV2::defaultSymbol( mGeometryType ) ); @@ -525,7 +525,7 @@ void QgsVectorLayerRenderer::prepareLabeling( QgsVectorLayer* layer, QStringList if ( !mLabelProvider->prepare( mContext, attributeNames ) ) { engine2->removeProvider( mLabelProvider ); - mLabelProvider = 0; // deleted by engine + mLabelProvider = nullptr; // deleted by engine } } } @@ -581,7 +581,7 @@ void QgsVectorLayerRenderer::prepareDiagrams( QgsVectorLayer* layer, QStringList if ( !mDiagramProvider->prepare( mContext, attributeNames ) ) { engine2->removeProvider( mDiagramProvider ); - mDiagramProvider = 0; // deleted by engine + mDiagramProvider = nullptr; // deleted by engine } } } diff --git a/src/core/qgsvectorlayerundocommand.cpp b/src/core/qgsvectorlayerundocommand.cpp index a2743808edc..a56ad181fb6 100644 --- a/src/core/qgsvectorlayerundocommand.cpp +++ b/src/core/qgsvectorlayerundocommand.cpp @@ -119,14 +119,14 @@ QgsVectorLayerUndoCommandChangeGeometry::QgsVectorLayerUndoCommandChangeGeometry { QgsFeatureMap::const_iterator it = mBuffer->mAddedFeatures.find( mFid ); Q_ASSERT( it != mBuffer->mAddedFeatures.end() ); - mOldGeom = ( it.value().constGeometry() ? new QgsGeometry( *it.value().constGeometry() ) : 0 ); + mOldGeom = ( it.value().constGeometry() ? new QgsGeometry( *it.value().constGeometry() ) : nullptr ); } else { bool changedAlready = mBuffer->mChangedGeometries.contains( mFid ); QgsGeometry geom; bool cachedGeom = cache()->geometry( mFid, geom ); - mOldGeom = ( changedAlready && cachedGeom ) ? new QgsGeometry( geom ) : 0; + mOldGeom = ( changedAlready && cachedGeom ) ? new QgsGeometry( geom ) : nullptr; } mNewGeom = new QgsGeometry( *newGeom ); @@ -151,7 +151,7 @@ bool QgsVectorLayerUndoCommandChangeGeometry::mergeWith( const QUndoCommand *oth delete mNewGeom; mNewGeom = merge->mNewGeom; - merge->mNewGeom = 0; + merge->mNewGeom = nullptr; return true; } diff --git a/src/core/qgswebview.h b/src/core/qgswebview.h index fefc0f4100c..35b6a15316d 100644 --- a/src/core/qgswebview.h +++ b/src/core/qgswebview.h @@ -29,7 +29,7 @@ class CORE_EXPORT QgsWebView : public QWebView Q_OBJECT public: - explicit QgsWebView( QWidget* parent = 0 ) + explicit QgsWebView( QWidget* parent = nullptr ) : QWebView( parent ) { QDesktopWidget desktop; diff --git a/src/core/raster/qgsbrightnesscontrastfilter.cpp b/src/core/raster/qgsbrightnesscontrastfilter.cpp index a643328a41a..81c9b359828 100644 --- a/src/core/raster/qgsbrightnesscontrastfilter.cpp +++ b/src/core/raster/qgsbrightnesscontrastfilter.cpp @@ -36,7 +36,7 @@ QgsBrightnessContrastFilter::~QgsBrightnessContrastFilter() QgsBrightnessContrastFilter* QgsBrightnessContrastFilter::clone() const { QgsDebugMsg( "Entered" ); - QgsBrightnessContrastFilter * filter = new QgsBrightnessContrastFilter( 0 ); + QgsBrightnessContrastFilter * filter = new QgsBrightnessContrastFilter( nullptr ); filter->setBrightness( mBrightness ); filter->setContrast( mContrast ); return filter; diff --git a/src/core/raster/qgsbrightnesscontrastfilter.h b/src/core/raster/qgsbrightnesscontrastfilter.h index 3268d8f739a..e17be969673 100644 --- a/src/core/raster/qgsbrightnesscontrastfilter.h +++ b/src/core/raster/qgsbrightnesscontrastfilter.h @@ -29,7 +29,7 @@ class QDomElement; class CORE_EXPORT QgsBrightnessContrastFilter : public QgsRasterInterface { public: - QgsBrightnessContrastFilter( QgsRasterInterface *input = 0 ); + QgsBrightnessContrastFilter( QgsRasterInterface *input = nullptr ); ~QgsBrightnessContrastFilter(); QgsBrightnessContrastFilter* clone() const override; diff --git a/src/core/raster/qgscontrastenhancement.cpp b/src/core/raster/qgscontrastenhancement.cpp index 90b97d6da7b..466eb19e656 100644 --- a/src/core/raster/qgscontrastenhancement.cpp +++ b/src/core/raster/qgscontrastenhancement.cpp @@ -30,8 +30,8 @@ class originally created circa 2004 by T.Sutton, Gary E.Sherman, Steve Halasz QgsContrastEnhancement::QgsContrastEnhancement( QGis::DataType theDataType ) { - mLookupTable = 0; - mContrastEnhancementFunction = 0; + mLookupTable = nullptr; + mContrastEnhancementFunction = nullptr; mEnhancementDirty = false; mContrastEnhancementAlgorithm = NoEnhancement; mRasterDataType = theDataType; @@ -54,8 +54,8 @@ QgsContrastEnhancement::QgsContrastEnhancement( QGis::DataType theDataType ) QgsContrastEnhancement::QgsContrastEnhancement( const QgsContrastEnhancement& ce ) { - mLookupTable = 0; - mContrastEnhancementFunction = 0; + mLookupTable = nullptr; + mContrastEnhancementFunction = nullptr; mEnhancementDirty = true; mRasterDataType = ce.mRasterDataType; @@ -253,7 +253,7 @@ bool QgsContrastEnhancement::generateLookupTable() bool QgsContrastEnhancement::isValueInDisplayableRange( double theValue ) { - if ( 0 != mContrastEnhancementFunction ) + if ( nullptr != mContrastEnhancementFunction ) { return mContrastEnhancementFunction->isValueInDisplayableRange( theValue ); } @@ -315,7 +315,7 @@ void QgsContrastEnhancement::setContrastEnhancementFunction( QgsContrastEnhancem { QgsDebugMsg( "called" ); - if ( 0 != theFunction ) + if ( nullptr != theFunction ) { delete mContrastEnhancementFunction; mContrastEnhancementFunction = theFunction; @@ -343,7 +343,7 @@ void QgsContrastEnhancement::setMaximumValue( double theValue, bool generateTabl mMaximumValue = theValue; } - if ( 0 != mContrastEnhancementFunction ) + if ( nullptr != mContrastEnhancementFunction ) { mContrastEnhancementFunction->setMaximumValue( theValue ); } @@ -375,7 +375,7 @@ void QgsContrastEnhancement::setMinimumValue( double theValue, bool generateTabl mMinimumValue = theValue; } - if ( 0 != mContrastEnhancementFunction ) + if ( nullptr != mContrastEnhancementFunction ) { mContrastEnhancementFunction->setMinimumValue( theValue ); } diff --git a/src/core/raster/qgshuesaturationfilter.cpp b/src/core/raster/qgshuesaturationfilter.cpp index b5ace4b1976..f8815e00513 100644 --- a/src/core/raster/qgshuesaturationfilter.cpp +++ b/src/core/raster/qgshuesaturationfilter.cpp @@ -42,7 +42,7 @@ QgsHueSaturationFilter::~QgsHueSaturationFilter() QgsHueSaturationFilter* QgsHueSaturationFilter::clone() const { QgsDebugMsg( "Entered hue/saturation filter" ); - QgsHueSaturationFilter * filter = new QgsHueSaturationFilter( 0 ); + QgsHueSaturationFilter * filter = new QgsHueSaturationFilter( nullptr ); filter->setSaturation( mSaturation ); filter->setGrayscaleMode( mGrayscaleMode ); filter->setColorizeOn( mColorizeOn ); diff --git a/src/core/raster/qgshuesaturationfilter.h b/src/core/raster/qgshuesaturationfilter.h index cc51a1eb141..890b5ea3bba 100644 --- a/src/core/raster/qgshuesaturationfilter.h +++ b/src/core/raster/qgshuesaturationfilter.h @@ -39,7 +39,7 @@ class CORE_EXPORT QgsHueSaturationFilter : public QgsRasterInterface GrayscaleAverage }; - QgsHueSaturationFilter( QgsRasterInterface *input = 0 ); + QgsHueSaturationFilter( QgsRasterInterface *input = nullptr ); ~QgsHueSaturationFilter(); QgsHueSaturationFilter * clone() const override; diff --git a/src/core/raster/qgsmultibandcolorrenderer.cpp b/src/core/raster/qgsmultibandcolorrenderer.cpp index 13db41ce1b1..c2793ac356f 100644 --- a/src/core/raster/qgsmultibandcolorrenderer.cpp +++ b/src/core/raster/qgsmultibandcolorrenderer.cpp @@ -42,7 +42,7 @@ QgsMultiBandColorRenderer::~QgsMultiBandColorRenderer() QgsMultiBandColorRenderer* QgsMultiBandColorRenderer::clone() const { - QgsMultiBandColorRenderer * renderer = new QgsMultiBandColorRenderer( 0, mRedBand, mGreenBand, mBlueBand ); + QgsMultiBandColorRenderer * renderer = new QgsMultiBandColorRenderer( nullptr, mRedBand, mGreenBand, mBlueBand ); if ( mRedContrastEnhancement ) { renderer->setRedContrastEnhancement( new QgsContrastEnhancement( *mRedContrastEnhancement ) ); @@ -57,7 +57,7 @@ QgsMultiBandColorRenderer* QgsMultiBandColorRenderer::clone() const } renderer->setOpacity( mOpacity ); renderer->setAlphaBand( mAlphaBand ); - renderer->setRasterTransparency( mRasterTransparency ? new QgsRasterTransparency( *mRasterTransparency ) : 0 ); + renderer->setRasterTransparency( mRasterTransparency ? new QgsRasterTransparency( *mRasterTransparency ) : nullptr ); return renderer; } @@ -81,7 +81,7 @@ QgsRasterRenderer* QgsMultiBandColorRenderer::create( const QDomElement& elem, Q { if ( elem.isNull() ) { - return 0; + return nullptr; } //red band, green band, blue band @@ -90,7 +90,7 @@ QgsRasterRenderer* QgsMultiBandColorRenderer::create( const QDomElement& elem, Q int blueBand = elem.attribute( "blueBand", "-1" ).toInt(); //contrast enhancements - QgsContrastEnhancement* redContrastEnhancement = 0; + QgsContrastEnhancement* redContrastEnhancement = nullptr; QDomElement redContrastElem = elem.firstChildElement( "redContrastEnhancement" ); if ( !redContrastElem.isNull() ) { @@ -99,7 +99,7 @@ QgsRasterRenderer* QgsMultiBandColorRenderer::create( const QDomElement& elem, Q redContrastEnhancement->readXML( redContrastElem ); } - QgsContrastEnhancement* greenContrastEnhancement = 0; + QgsContrastEnhancement* greenContrastEnhancement = nullptr; QDomElement greenContrastElem = elem.firstChildElement( "greenContrastEnhancement" ); if ( !greenContrastElem.isNull() ) { @@ -108,7 +108,7 @@ QgsRasterRenderer* QgsMultiBandColorRenderer::create( const QDomElement& elem, Q greenContrastEnhancement->readXML( greenContrastElem ); } - QgsContrastEnhancement* blueContrastEnhancement = 0; + QgsContrastEnhancement* blueContrastEnhancement = nullptr; QDomElement blueContrastElem = elem.firstChildElement( "blueContrastEnhancement" ); if ( !blueContrastElem.isNull() ) { @@ -163,17 +163,17 @@ QgsRasterBlock* QgsMultiBandColorRenderer::block( int bandNo, QgsRectangle cons } QMap bandBlocks; - QgsRasterBlock* defaultPointer = 0; + QgsRasterBlock* defaultPointer = nullptr; QSet::const_iterator bandIt = bands.constBegin(); for ( ; bandIt != bands.constEnd(); ++bandIt ) { bandBlocks.insert( *bandIt, defaultPointer ); } - QgsRasterBlock* redBlock = 0; - QgsRasterBlock* greenBlock = 0; - QgsRasterBlock* blueBlock = 0; - QgsRasterBlock* alphaBlock = 0; + QgsRasterBlock* redBlock = nullptr; + QgsRasterBlock* greenBlock = nullptr; + QgsRasterBlock* blueBlock = nullptr; + QgsRasterBlock* alphaBlock = nullptr; bandIt = bands.constBegin(); for ( ; bandIt != bands.constEnd(); ++bandIt ) diff --git a/src/core/raster/qgsmultibandcolorrenderer.h b/src/core/raster/qgsmultibandcolorrenderer.h index bb5b9d0c750..50445e40b45 100644 --- a/src/core/raster/qgsmultibandcolorrenderer.h +++ b/src/core/raster/qgsmultibandcolorrenderer.h @@ -30,8 +30,8 @@ class CORE_EXPORT QgsMultiBandColorRenderer: public QgsRasterRenderer { public: QgsMultiBandColorRenderer( QgsRasterInterface* input, int redBand, int greenBand, int blueBand, - QgsContrastEnhancement* redEnhancement = 0, QgsContrastEnhancement* greenEnhancement = 0, - QgsContrastEnhancement* blueEnhancement = 0 ); + QgsContrastEnhancement* redEnhancement = nullptr, QgsContrastEnhancement* greenEnhancement = nullptr, + QgsContrastEnhancement* blueEnhancement = nullptr ); ~QgsMultiBandColorRenderer(); QgsMultiBandColorRenderer * clone() const override; diff --git a/src/core/raster/qgspalettedrasterrenderer.cpp b/src/core/raster/qgspalettedrasterrenderer.cpp index 28fc480148c..fc59ad2b5fb 100644 --- a/src/core/raster/qgspalettedrasterrenderer.cpp +++ b/src/core/raster/qgspalettedrasterrenderer.cpp @@ -48,10 +48,10 @@ QgsPalettedRasterRenderer::~QgsPalettedRasterRenderer() QgsPalettedRasterRenderer* QgsPalettedRasterRenderer::clone() const { - QgsPalettedRasterRenderer * renderer = new QgsPalettedRasterRenderer( 0, mBand, rgbArray(), mNColors ); + QgsPalettedRasterRenderer * renderer = new QgsPalettedRasterRenderer( nullptr, mBand, rgbArray(), mNColors ); renderer->setOpacity( mOpacity ); renderer->setAlphaBand( mAlphaBand ); - renderer->setRasterTransparency( mRasterTransparency ? new QgsRasterTransparency( *mRasterTransparency ) : 0 ); + renderer->setRasterTransparency( mRasterTransparency ? new QgsRasterTransparency( *mRasterTransparency ) : nullptr ); renderer->mLabels = mLabels; return renderer; } @@ -60,12 +60,12 @@ QgsRasterRenderer* QgsPalettedRasterRenderer::create( const QDomElement& elem, Q { if ( elem.isNull() ) { - return 0; + return nullptr; } int bandNumber = elem.attribute( "band", "-1" ).toInt(); int nColors = 0; - QRgb* colors = 0; + QRgb* colors = nullptr; QVector labels; QDomElement paletteElem = elem.firstChildElement( "colorPalette" ); @@ -119,7 +119,7 @@ QColor* QgsPalettedRasterRenderer::colors() const { if ( mNColors < 1 ) { - return 0; + return nullptr; } QColor* colorArray = new QColor[ mNColors ]; for ( int i = 0; i < mNColors; ++i ) @@ -133,7 +133,7 @@ QRgb* QgsPalettedRasterRenderer::rgbArray() const { if ( mNColors < 1 ) { - return 0; + return nullptr; } QRgb* rgbValues = new QRgb[mNColors]; for ( int i = 0; i < mNColors; ++i ) @@ -173,7 +173,7 @@ QgsRasterBlock * QgsPalettedRasterRenderer::block( int bandNo, QgsRectangle con //rendering is faster without considering user-defined transparency bool hasTransparency = usesTransparency(); - QgsRasterBlock *alphaBlock = 0; + QgsRasterBlock *alphaBlock = nullptr; if ( mAlphaBand > 0 && mAlphaBand != mBand ) { diff --git a/src/core/raster/qgsrasterblock.cpp b/src/core/raster/qgsrasterblock.cpp index ca5780b7f9d..b64f38842e6 100644 --- a/src/core/raster/qgsrasterblock.cpp +++ b/src/core/raster/qgsrasterblock.cpp @@ -34,9 +34,9 @@ QgsRasterBlock::QgsRasterBlock() , mHeight( 0 ) , mHasNoDataValue( false ) , mNoDataValue( std::numeric_limits::quiet_NaN() ) - , mData( 0 ) - , mImage( 0 ) - , mNoDataBitmap( 0 ) + , mData( nullptr ) + , mImage( nullptr ) + , mNoDataBitmap( nullptr ) , mNoDataBitmapWidth( 0 ) , mNoDataBitmapSize( 0 ) { @@ -50,9 +50,9 @@ QgsRasterBlock::QgsRasterBlock( QGis::DataType theDataType, int theWidth, int th , mHeight( theHeight ) , mHasNoDataValue( false ) , mNoDataValue( std::numeric_limits::quiet_NaN() ) - , mData( 0 ) - , mImage( 0 ) - , mNoDataBitmap( 0 ) + , mData( nullptr ) + , mImage( nullptr ) + , mNoDataBitmap( nullptr ) , mNoDataBitmapWidth( 0 ) , mNoDataBitmapSize( 0 ) { @@ -67,9 +67,9 @@ QgsRasterBlock::QgsRasterBlock( QGis::DataType theDataType, int theWidth, int th , mHeight( theHeight ) , mHasNoDataValue( true ) , mNoDataValue( theNoDataValue ) - , mData( 0 ) - , mImage( 0 ) - , mNoDataBitmap( 0 ) + , mData( nullptr ) + , mImage( nullptr ) + , mNoDataBitmap( nullptr ) , mNoDataBitmapWidth( 0 ) , mNoDataBitmapSize( 0 ) { @@ -101,11 +101,11 @@ bool QgsRasterBlock::reset( QGis::DataType theDataType, int theWidth, int theHei QgsDebugMsg( QString( "theWidth= %1 theHeight = %2 theDataType = %3 theNoDataValue = %4" ).arg( theWidth ).arg( theHeight ).arg( theDataType ).arg( theNoDataValue ) ); qgsFree( mData ); - mData = 0; + mData = nullptr; delete mImage; - mImage = 0; + mImage = nullptr; qgsFree( mNoDataBitmap ); - mNoDataBitmap = 0; + mNoDataBitmap = nullptr; mDataType = QGis::UnknownDataType; mTypeSize = 0; mWidth = 0; @@ -120,7 +120,7 @@ bool QgsRasterBlock::reset( QGis::DataType theDataType, int theWidth, int theHei qgssize tSize = typeSize( theDataType ); QgsDebugMsg( QString( "allocate %1 bytes" ).arg( tSize * theWidth * theHeight ) ); mData = qgsMalloc( tSize * theWidth * theHeight ); - if ( mData == 0 ) + if ( mData == nullptr ) { QgsDebugMsg( QString( "Couldn't allocate data memory of %1 bytes" ).arg( tSize * theWidth * theHeight ) ); return false; @@ -179,8 +179,8 @@ bool QgsRasterBlock::isEmpty() const { QgsDebugMsg( QString( "mWidth= %1 mHeight = %2 mDataType = %3 mData = %4 mImage = %5" ).arg( mWidth ).arg( mHeight ).arg( mDataType ).arg(( ulong )mData ).arg(( ulong )mImage ) ); if ( mWidth == 0 || mHeight == 0 || - ( typeIsNumeric( mDataType ) && mData == 0 ) || - ( typeIsColor( mDataType ) && mImage == 0 ) ) + ( typeIsNumeric( mDataType ) && mData == nullptr ) || + ( typeIsColor( mDataType ) && mImage == nullptr ) ) { return true; } @@ -273,7 +273,7 @@ QGis::DataType QgsRasterBlock::typeWithNoDataValue( QGis::DataType dataType, dou bool QgsRasterBlock::hasNoData() const { - return mHasNoDataValue || mNoDataBitmap != 0; + return mHasNoDataValue || mNoDataBitmap != nullptr; } bool QgsRasterBlock::isNoDataValue( double value, double noDataValue ) @@ -322,7 +322,7 @@ bool QgsRasterBlock::isNoData( qgssize index ) return isNoDataValue( value ); } // use no data bitmap - if ( mNoDataBitmap == 0 ) + if ( mNoDataBitmap == nullptr ) { // no data are not defined return false; @@ -402,7 +402,7 @@ bool QgsRasterBlock::setIsNoData( qgssize index ) } else { - if ( mNoDataBitmap == 0 ) + if ( mNoDataBitmap == nullptr ) { if ( !createNoDataBitmap() ) { @@ -447,7 +447,7 @@ bool QgsRasterBlock::setIsNoData() else { // use bitmap - if ( mNoDataBitmap == 0 ) + if ( mNoDataBitmap == nullptr ) { if ( !createNoDataBitmap() ) { @@ -529,7 +529,7 @@ bool QgsRasterBlock::setIsNoDataExcept( const QRect & theExceptRect ) else { // use bitmap - if ( mNoDataBitmap == 0 ) + if ( mNoDataBitmap == nullptr ) { if ( !createNoDataBitmap() ) { @@ -646,7 +646,7 @@ void QgsRasterBlock::setIsData( qgssize index ) return; } - if ( mNoDataBitmap == 0 ) + if ( mNoDataBitmap == nullptr ) { return; } @@ -666,7 +666,7 @@ char * QgsRasterBlock::bits( qgssize index ) if ( index >= ( qgssize )mWidth*mHeight ) { QgsDebugMsg( QString( "Index %1 out of range (%2 x %3)" ).arg( index ).arg( mWidth ).arg( mHeight ) ); - return 0; + return nullptr; } if ( mData ) { @@ -677,7 +677,7 @@ char * QgsRasterBlock::bits( qgssize index ) return ( char* )( mImage->bits() + index * 4 ); } - return 0; + return nullptr; } char * QgsRasterBlock::bits( int row, int column ) @@ -696,7 +696,7 @@ char * QgsRasterBlock::bits() return ( char* )( mImage->bits() ); } - return 0; + return nullptr; } bool QgsRasterBlock::convert( QGis::DataType destDataType ) @@ -708,7 +708,7 @@ bool QgsRasterBlock::convert( QGis::DataType destDataType ) { void *data = convert( mData, mDataType, destDataType, ( qgssize )mWidth * ( qgssize )mHeight ); - if ( data == 0 ) + if ( data == nullptr ) { QgsDebugMsg( "Cannot convert raster block" ); return false; @@ -779,9 +779,9 @@ QImage QgsRasterBlock::image() const bool QgsRasterBlock::setImage( const QImage * image ) { qgsFree( mData ); - mData = 0; + mData = nullptr; delete mImage; - mImage = 0; + mImage = nullptr; mImage = new QImage( *image ); mWidth = mImage->width(); mHeight = mImage->height(); @@ -899,7 +899,7 @@ bool QgsRasterBlock::createNoDataBitmap() mNoDataBitmapSize = ( qgssize )mNoDataBitmapWidth * mHeight; QgsDebugMsg( QString( "allocate %1 bytes" ).arg( mNoDataBitmapSize ) ); mNoDataBitmap = ( char* )qgsMalloc( mNoDataBitmapSize ); - if ( mNoDataBitmap == 0 ) + if ( mNoDataBitmap == nullptr ) { QgsDebugMsg( QString( "Couldn't allocate no data memory of %1 bytes" ).arg( mNoDataBitmapSize ) ); return false; diff --git a/src/core/raster/qgsrasterdataprovider.cpp b/src/core/raster/qgsrasterdataprovider.cpp index d4ba441d406..b47b2d8b2ee 100644 --- a/src/core/raster/qgsrasterdataprovider.cpp +++ b/src/core/raster/qgsrasterdataprovider.cpp @@ -216,14 +216,14 @@ QgsRasterBlock * QgsRasterDataProvider::block( int theBandNo, QgsRectangle cons } QgsRasterDataProvider::QgsRasterDataProvider() - : QgsRasterInterface( 0 ) + : QgsRasterInterface( nullptr ) , mDpi( -1 ) { } QgsRasterDataProvider::QgsRasterDataProvider( QString const & uri ) : QgsDataProvider( uri ) - , QgsRasterInterface( 0 ) + , QgsRasterInterface( nullptr ) , mDpi( -1 ) { } @@ -442,7 +442,7 @@ QgsRasterDataProvider* QgsRasterDataProvider::create( const QString &providerKey QgsDebugMsg( "Cannot resolve 'create' function in " + providerKey + " provider" ); // TODO: it would be good to return invalid QgsRasterDataProvider // with QgsError set, but QgsRasterDataProvider has pure virtual methods - return 0; + return nullptr; } return createFn( uri, format, nBands, type, width, height, geoTransform, crs, createOptions ); } diff --git a/src/core/raster/qgsrasterdataprovider.h b/src/core/raster/qgsrasterdataprovider.h index 8445111bf1d..96cf4b408e6 100644 --- a/src/core/raster/qgsrasterdataprovider.h +++ b/src/core/raster/qgsrasterdataprovider.h @@ -236,7 +236,7 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast * \param visibleExtent Visible extent for providers supporting contextual legends, in layer CRS * \note visibleExtent parameter added in 2.8 (no available in python bindings) */ - virtual QImage getLegendGraphic( double scale = 0, bool forceRefresh = false, const QgsRectangle * visibleExtent = 0 ) + virtual QImage getLegendGraphic( double scale = 0, bool forceRefresh = false, const QgsRectangle * visibleExtent = nullptr ) { Q_UNUSED( scale ); Q_UNUSED( forceRefresh ); @@ -260,7 +260,7 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast virtual QgsImageFetcher* getLegendGraphicFetcher( const QgsMapSettings* mapSettings ) { Q_UNUSED( mapSettings ); - return 0; + return nullptr; } /** \brief Create pyramid overviews */ diff --git a/src/core/raster/qgsrasterdrawer.h b/src/core/raster/qgsrasterdrawer.h index 27e695d40eb..797046a27a1 100644 --- a/src/core/raster/qgsrasterdrawer.h +++ b/src/core/raster/qgsrasterdrawer.h @@ -47,7 +47,7 @@ class CORE_EXPORT QgsRasterDrawer @param topLeftRow Top position relative to top border of viewport @param mapToPixel map to device coordinate transformation info (not available in python bindings) */ - void drawImage( QPainter* p, QgsRasterViewPort* viewPort, const QImage& img, int topLeftCol, int topLeftRow, const QgsMapToPixel* mapToPixel = 0 ) const; + void drawImage( QPainter* p, QgsRasterViewPort* viewPort, const QImage& img, int topLeftCol, int topLeftRow, const QgsMapToPixel* mapToPixel = nullptr ) const; private: QgsRasterIterator* mIterator; diff --git a/src/core/raster/qgsrasterfilewriter.cpp b/src/core/raster/qgsrasterfilewriter.cpp index 797ecdfaaca..32d06a98aa6 100644 --- a/src/core/raster/qgsrasterfilewriter.cpp +++ b/src/core/raster/qgsrasterfilewriter.cpp @@ -31,7 +31,7 @@ QgsRasterFileWriter::QgsRasterFileWriter( const QString& outputUrl ): mTiledMode( false ), mMaxTileWidth( 500 ), mMaxTileHeight( 500 ), mBuildPyramidsFlag( QgsRaster::PyramidsFlagNo ), mPyramidsFormat( QgsRaster::PyramidsGTiff ), - mProgressDialog( 0 ), mPipe( 0 ), mInput( 0 ) + mProgressDialog( nullptr ), mPipe( nullptr ), mInput( nullptr ) { } @@ -45,9 +45,9 @@ QgsRasterFileWriter::QgsRasterFileWriter() , mMaxTileHeight( 500 ) , mBuildPyramidsFlag( QgsRaster::PyramidsFlagNo ) , mPyramidsFormat( QgsRaster::PyramidsGTiff ) - , mProgressDialog( 0 ) - , mPipe( 0 ) - , mInput( 0 ) + , mProgressDialog( nullptr ) + , mPipe( nullptr ) + , mInput( nullptr ) { } @@ -119,12 +119,12 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeRaster( const QgsRast if ( mMode == Image ) { WriterError e = writeImageRaster( &iter, nCols, nRows, outputExtent, crs, progressDialog ); - mProgressDialog = 0; + mProgressDialog = nullptr; return e; } else { - mProgressDialog = 0; + mProgressDialog = nullptr; WriterError e = writeDataRaster( pipe, &iter, nCols, nRows, outputExtent, crs, progressDialog ); return e; } @@ -262,7 +262,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster( const Qgs } //create destProvider for whole dataset here - QgsRasterDataProvider* destProvider = 0; + QgsRasterDataProvider* destProvider = nullptr; double pixelSize; double geoTransform[6]; globalOutputParameters( outputExtent, nCols, nRows, geoTransform, pixelSize ); @@ -279,7 +279,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster( const Qgs { destProvider->remove(); delete destProvider; - destProvider = 0; + destProvider = nullptr; } else // VRT { @@ -339,7 +339,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster( for ( int i = 1; i <= nBands; ++i ) { iter->startRasterRead( i, nCols, nRows, outputExtent ); - blockList.push_back( 0 ); + blockList.push_back( nullptr ); if ( destProvider ) // no tiles { destProvider->setNoDataValue( i, destNoDataValueList.value( i - 1 ) ); @@ -419,7 +419,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster( blockList[i-1]->convert( destDataType ); destBlockList.push_back( blockList[i-1] ); } - blockList[i-1] = 0; + blockList[i-1] = nullptr; } if ( mTiledMode ) //write to file @@ -489,7 +489,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeImageRaster( QgsRaste int fileIndex = 0; //create destProvider for whole dataset here - QgsRasterDataProvider* destProvider = 0; + QgsRasterDataProvider* destProvider = nullptr; double pixelSize; double geoTransform[6]; globalOutputParameters( outputExtent, nCols, nRows, geoTransform, pixelSize ); @@ -509,7 +509,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeImageRaster( QgsRaste progressDialog->setLabelText( QObject::tr( "Reading raster part %1 of %2" ).arg( fileIndex + 1 ).arg( nParts ) ); } - QgsRasterBlock *inputBlock = 0; + QgsRasterBlock *inputBlock = nullptr; while ( iter->readNextRasterPart( 1, iterCols, iterRows, &inputBlock, iterLeft, iterTop ) ) { if ( !inputBlock ) @@ -758,7 +758,7 @@ void QgsRasterFileWriter::buildPyramids( const QString& filename ) title = QObject::tr( "Building pyramids failed." ); message = QObject::tr( "Building pyramid overviews is not supported on this type of raster." ); } - QMessageBox::warning( 0, title, message ); + QMessageBox::warning( nullptr, title, message ); QgsDebugMsg( res + " - " + message ); } delete destProvider; @@ -913,7 +913,7 @@ QgsRasterDataProvider* QgsRasterFileWriter::initOutput( int nCols, int nRows, co if ( mTiledMode ) { createVRT( nCols, nRows, crs, geoTransform, type, destHasNoDataValueList, destNoDataValueList ); - return 0; + return nullptr; } else { diff --git a/src/core/raster/qgsrasterfilewriter.h b/src/core/raster/qgsrasterfilewriter.h index 4bf9b0f03c2..2822362663e 100644 --- a/src/core/raster/qgsrasterfilewriter.h +++ b/src/core/raster/qgsrasterfilewriter.h @@ -59,7 +59,7 @@ class CORE_EXPORT QgsRasterFileWriter @param crs crs to reproject to @param p dialog to show progress in */ WriterError writeRaster( const QgsRasterPipe* pipe, int nCols, int nRows, QgsRectangle outputExtent, - const QgsCoordinateReferenceSystem& crs, QProgressDialog* p = 0 ); + const QgsCoordinateReferenceSystem& crs, QProgressDialog* p = nullptr ); void setOutputFormat( const QString& format ) { mOutputFormat = format; } QString outputFormat() const { return mOutputFormat; } @@ -97,7 +97,7 @@ class CORE_EXPORT QgsRasterFileWriter private: QgsRasterFileWriter(); //forbidden WriterError writeDataRaster( const QgsRasterPipe* pipe, QgsRasterIterator* iter, int nCols, int nRows, const QgsRectangle& outputExtent, - const QgsCoordinateReferenceSystem& crs, QProgressDialog* progressDialog = 0 ); + const QgsCoordinateReferenceSystem& crs, QProgressDialog* progressDialog = nullptr ); // Helper method used by previous one WriterError writeDataRaster( const QgsRasterPipe* pipe, @@ -112,7 +112,7 @@ class CORE_EXPORT QgsRasterFileWriter QProgressDialog* progressDialog ); WriterError writeImageRaster( QgsRasterIterator* iter, int nCols, int nRows, const QgsRectangle& outputExtent, - const QgsCoordinateReferenceSystem& crs, QProgressDialog* progressDialog = 0 ); + const QgsCoordinateReferenceSystem& crs, QProgressDialog* progressDialog = nullptr ); /** \brief Initialize vrt member variables * @param xSize width of vrt diff --git a/src/core/raster/qgsrasterinterface.h b/src/core/raster/qgsrasterinterface.h index 25a0633c49a..d6e0bed5626 100644 --- a/src/core/raster/qgsrasterinterface.h +++ b/src/core/raster/qgsrasterinterface.h @@ -52,7 +52,7 @@ class CORE_EXPORT QgsRasterInterface IdentifyFeature = 1 << 9, // WMS GML -> feature }; - QgsRasterInterface( QgsRasterInterface * input = 0 ); + QgsRasterInterface( QgsRasterInterface * input = nullptr ); virtual ~QgsRasterInterface(); diff --git a/src/core/raster/qgsrasteriterator.cpp b/src/core/raster/qgsrasteriterator.cpp index d70f0392310..dbe85cb1983 100644 --- a/src/core/raster/qgsrasteriterator.cpp +++ b/src/core/raster/qgsrasteriterator.cpp @@ -44,7 +44,7 @@ void QgsRasterIterator::startRasterRead( int bandNumber, int nCols, int nRows, c pInfo.nRows = nRows; pInfo.currentCol = 0; pInfo.currentRow = 0; - pInfo.prj = 0; + pInfo.prj = nullptr; mRasterPartInfos.insert( bandNumber, pInfo ); } @@ -54,7 +54,7 @@ bool QgsRasterIterator::readNextRasterPart( int bandNumber, int& topLeftCol, int& topLeftRow ) { QgsDebugMsg( "Entered" ); - *block = 0; + *block = nullptr; //get partinfo QMap::iterator partIt = mRasterPartInfos.find( bandNumber ); if ( partIt == mRasterPartInfos.end() ) @@ -72,7 +72,7 @@ bool QgsRasterIterator::readNextRasterPart( int bandNumber, //remove last data block delete pInfo.prj; - pInfo.prj = 0; + pInfo.prj = nullptr; //already at end if ( pInfo.currentCol == pInfo.nCols && pInfo.currentRow == pInfo.nRows ) diff --git a/src/core/raster/qgsrasterlayer.cpp b/src/core/raster/qgsrasterlayer.cpp index 7529dbd2fda..5c6208ad331 100644 --- a/src/core/raster/qgsrasterlayer.cpp +++ b/src/core/raster/qgsrasterlayer.cpp @@ -82,7 +82,7 @@ QgsRasterLayer::QgsRasterLayer() : QgsMapLayer( RasterLayer ) , QSTRING_NOT_SET( "Not Set" ) , TRSTRING_NOT_SET( tr( "Not Set" ) ) - , mDataProvider( 0 ) + , mDataProvider( nullptr ) { init(); mValid = false; @@ -95,7 +95,7 @@ QgsRasterLayer::QgsRasterLayer( : QgsMapLayer( RasterLayer, baseName, path ) , QSTRING_NOT_SET( "Not Set" ) , TRSTRING_NOT_SET( tr( "Not Set" ) ) - , mDataProvider( 0 ) + , mDataProvider( nullptr ) { QgsDebugMsg( "Entered" ); @@ -128,7 +128,7 @@ QgsRasterLayer::QgsRasterLayer( const QString & uri, // Constant that signals property not used. , QSTRING_NOT_SET( "Not Set" ) , TRSTRING_NOT_SET( tr( "Not Set" ) ) - , mDataProvider( 0 ) + , mDataProvider( nullptr ) , mProviderKey( providerKey ) { QgsDebugMsg( "Entered" ); @@ -637,7 +637,7 @@ void QgsRasterLayer::setDataProvider( QString const & provider ) mValid = false; // assume the layer is invalid until we determine otherwise mPipe.remove( mDataProvider ); // deletes if exists - mDataProvider = 0; + mDataProvider = nullptr; // XXX should I check for and possibly delete any pre-existing providers? // XXX How often will that scenario occur? @@ -853,7 +853,7 @@ void QgsRasterLayer::closeDataProvider() { mValid = false; mPipe.remove( mDataProvider ); - mDataProvider = 0; + mDataProvider = nullptr; } void QgsRasterLayer::setContrastEnhancement( QgsContrastEnhancement::ContrastEnhancementAlgorithm theAlgorithm, QgsRaster::ContrastEnhancementLimits theLimits, const QgsRectangle& theExtent, int theSampleSize, bool theGenerateLookupTableFlag ) @@ -866,8 +866,8 @@ void QgsRasterLayer::setContrastEnhancement( QgsContrastEnhancement::ContrastEnh QList myBands; QList myEnhancements; - QgsSingleBandGrayRenderer* myGrayRenderer = 0; - QgsMultiBandColorRenderer* myMultiBandRenderer = 0; + QgsSingleBandGrayRenderer* myGrayRenderer = nullptr; + QgsMultiBandColorRenderer* myMultiBandRenderer = nullptr; QString rendererType = mPipe.renderer()->type(); if ( rendererType == "singlebandgray" ) { @@ -922,7 +922,7 @@ void QgsRasterLayer::setContrastEnhancement( QgsContrastEnhancement::ContrastEnh } else { - myEnhancements.append( 0 ); + myEnhancements.append( nullptr ); } } diff --git a/src/core/raster/qgsrasterlayer.h b/src/core/raster/qgsrasterlayer.h index 132925716f0..dfcf2f9b0e6 100644 --- a/src/core/raster/qgsrasterlayer.h +++ b/src/core/raster/qgsrasterlayer.h @@ -275,7 +275,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer /** \brief This is an overloaded version of the draw() function that is called by both draw() and thumbnailAsPixmap */ void draw( QPainter * theQPainter, QgsRasterViewPort * myRasterViewPort, - const QgsMapToPixel* theQgsMapToPixel = 0 ); + const QgsMapToPixel* theQgsMapToPixel = nullptr ); /** Returns a list with classification items (Text and color) */ QgsLegendColorList legendSymbologyItems() const; diff --git a/src/core/raster/qgsrasterlayerrenderer.cpp b/src/core/raster/qgsrasterlayerrenderer.cpp index 83a4fc8a990..d498957e2c1 100644 --- a/src/core/raster/qgsrasterlayerrenderer.cpp +++ b/src/core/raster/qgsrasterlayerrenderer.cpp @@ -23,8 +23,8 @@ QgsRasterLayerRenderer::QgsRasterLayerRenderer( QgsRasterLayer* layer, QgsRenderContext& rendererContext ) : QgsMapLayerRenderer( layer->id() ) - , mRasterViewPort( 0 ) - , mPipe( 0 ) + , mRasterViewPort( nullptr ) + , mPipe( nullptr ) { mPainter = rendererContext.painter(); diff --git a/src/core/raster/qgsrasternuller.cpp b/src/core/raster/qgsrasternuller.cpp index b43b150360b..096371a539d 100644 --- a/src/core/raster/qgsrasternuller.cpp +++ b/src/core/raster/qgsrasternuller.cpp @@ -30,7 +30,7 @@ QgsRasterNuller::~QgsRasterNuller() QgsRasterNuller* QgsRasterNuller::clone() const { QgsDebugMsg( "Entered" ); - QgsRasterNuller * nuller = new QgsRasterNuller( 0 ); + QgsRasterNuller * nuller = new QgsRasterNuller( nullptr ); nuller->mNoData = mNoData; nuller->mOutputNoData = mOutputNoData; nuller->mHasOutputNoData = mHasOutputNoData; @@ -89,7 +89,7 @@ QgsRasterBlock * QgsRasterNuller::block( int bandNo, QgsRectangle const & exten return inputBlock; } - QgsRasterBlock *outputBlock = 0; + QgsRasterBlock *outputBlock = nullptr; if ( mHasOutputNoData.value( bandNo - 1 ) || inputBlock->hasNoDataValue() ) { diff --git a/src/core/raster/qgsrasternuller.h b/src/core/raster/qgsrasternuller.h index 6e535316404..d2f8e94a873 100644 --- a/src/core/raster/qgsrasternuller.h +++ b/src/core/raster/qgsrasternuller.h @@ -30,7 +30,7 @@ class CORE_EXPORT QgsRasterNuller : public QgsRasterInterface { public: - QgsRasterNuller( QgsRasterInterface* input = 0 ); + QgsRasterNuller( QgsRasterInterface* input = nullptr ); ~QgsRasterNuller(); struct NoData diff --git a/src/core/raster/qgsrasterpipe.cpp b/src/core/raster/qgsrasterpipe.cpp index e0db31ea54a..e6b89d106ce 100644 --- a/src/core/raster/qgsrasterpipe.cpp +++ b/src/core/raster/qgsrasterpipe.cpp @@ -222,7 +222,7 @@ QgsRasterInterface * QgsRasterPipe::interface( Role role ) const { return mInterfaces.value( mRoleMap.value( role ) ); } - return 0; + return nullptr; } QgsRasterDataProvider * QgsRasterPipe::provider() const diff --git a/src/core/raster/qgsrasterprojector.cpp b/src/core/raster/qgsrasterprojector.cpp index fb83354b48a..9f7aff6ccfb 100644 --- a/src/core/raster/qgsrasterprojector.cpp +++ b/src/core/raster/qgsrasterprojector.cpp @@ -31,7 +31,7 @@ QgsRasterProjector::QgsRasterProjector( int theDestRows, int theDestCols, double theMaxSrcXRes, double theMaxSrcYRes, const QgsRectangle& theExtent ) - : QgsRasterInterface( 0 ) + : QgsRasterInterface( nullptr ) , mSrcCRS( theSrcCRS ) , mDestCRS( theDestCRS ) , mSrcDatumTransform( theSrcDatumTransform ) @@ -39,7 +39,7 @@ QgsRasterProjector::QgsRasterProjector( , mDestExtent( theDestExtent ) , mExtent( theExtent ) , mDestRows( theDestRows ), mDestCols( theDestCols ) - , pHelperTop( 0 ), pHelperBottom( 0 ) + , pHelperTop( nullptr ), pHelperBottom( nullptr ) , mMaxSrcXRes( theMaxSrcXRes ), mMaxSrcYRes( theMaxSrcYRes ) , mPrecision( Approximate ) , mApproximate( true ) @@ -57,7 +57,7 @@ QgsRasterProjector::QgsRasterProjector( int theDestRows, int theDestCols, double theMaxSrcXRes, double theMaxSrcYRes, const QgsRectangle& theExtent ) - : QgsRasterInterface( 0 ) + : QgsRasterInterface( nullptr ) , mSrcCRS( theSrcCRS ) , mDestCRS( theDestCRS ) , mSrcDatumTransform( -1 ) @@ -65,7 +65,7 @@ QgsRasterProjector::QgsRasterProjector( , mDestExtent( theDestExtent ) , mExtent( theExtent ) , mDestRows( theDestRows ), mDestCols( theDestCols ) - , pHelperTop( 0 ), pHelperBottom( 0 ) + , pHelperTop( nullptr ), pHelperBottom( nullptr ) , mMaxSrcXRes( theMaxSrcXRes ), mMaxSrcYRes( theMaxSrcYRes ) , mPrecision( Approximate ) , mApproximate( false ) @@ -81,7 +81,7 @@ QgsRasterProjector::QgsRasterProjector( const QgsCoordinateReferenceSystem& theDestCRS, double theMaxSrcXRes, double theMaxSrcYRes, const QgsRectangle& theExtent ) - : QgsRasterInterface( 0 ) + : QgsRasterInterface( nullptr ) , mSrcCRS( theSrcCRS ) , mDestCRS( theDestCRS ) , mSrcDatumTransform( -1 ) @@ -97,7 +97,7 @@ QgsRasterProjector::QgsRasterProjector( , mSrcYRes( 0.0 ) , mDestRowsPerMatrixRow( 0.0 ) , mDestColsPerMatrixCol( 0.0 ) - , pHelperTop( 0 ), pHelperBottom( 0 ) + , pHelperTop( nullptr ), pHelperBottom( nullptr ) , mHelperTopRow( 0 ) , mCPCols( 0 ) , mCPRows( 0 ) @@ -111,7 +111,7 @@ QgsRasterProjector::QgsRasterProjector( } QgsRasterProjector::QgsRasterProjector() - : QgsRasterInterface( 0 ) + : QgsRasterInterface( nullptr ) , mSrcDatumTransform( -1 ) , mDestDatumTransform( -1 ) , mDestRows( 0 ) @@ -124,8 +124,8 @@ QgsRasterProjector::QgsRasterProjector() , mSrcYRes( 0.0 ) , mDestRowsPerMatrixRow( 0.0 ) , mDestColsPerMatrixCol( 0.0 ) - , pHelperTop( 0 ) - , pHelperBottom( 0 ) + , pHelperTop( nullptr ) + , pHelperBottom( nullptr ) , mHelperTopRow( 0 ) , mCPCols( 0 ) , mCPRows( 0 ) @@ -139,9 +139,9 @@ QgsRasterProjector::QgsRasterProjector() } QgsRasterProjector::QgsRasterProjector( const QgsRasterProjector &projector ) - : QgsRasterInterface( 0 ) - , pHelperTop( NULL ) - , pHelperBottom( NULL ) + : QgsRasterInterface( nullptr ) + , pHelperTop( nullptr ) + , pHelperBottom( nullptr ) , mHelperTopRow( 0 ) , mCPCols( 0 ) , mCPRows( 0 ) @@ -228,9 +228,9 @@ void QgsRasterProjector::calc() mCPMatrix.clear(); mCPLegalMatrix.clear(); delete[] pHelperTop; - pHelperTop = 0; + pHelperTop = nullptr; delete[] pHelperBottom; - pHelperBottom = 0; + pHelperBottom = nullptr; // Get max source resolution and extent if possible mMaxSrcXRes = 0; @@ -949,7 +949,7 @@ QgsRasterBlock * QgsRasterProjector::block( int bandNo, QgsRectangle const & ex // we cannot fill output block with no data because we use memcpy for data, not setValue(). bool doNoData = !QgsRasterBlock::typeIsNumeric( inputBlock->dataType() ) && inputBlock->hasNoData() && !inputBlock->hasNoDataValue(); - const QgsCoordinateTransform* inverseCt = 0; + const QgsCoordinateTransform* inverseCt = nullptr; if ( !mApproximate ) { inverseCt = QgsCoordinateTransformCache::instance()->transform( mDestCRS.authid(), mSrcCRS.authid(), mDestDatumTransform, mSrcDatumTransform ); diff --git a/src/core/raster/qgsrasterrenderer.cpp b/src/core/raster/qgsrasterrenderer.cpp index 49b2682531d..4f6e97392c0 100644 --- a/src/core/raster/qgsrasterrenderer.cpp +++ b/src/core/raster/qgsrasterrenderer.cpp @@ -31,7 +31,7 @@ const QRgb QgsRasterRenderer::NODATA_COLOR = qRgba( 0, 0, 0, 0 ); QgsRasterRenderer::QgsRasterRenderer( QgsRasterInterface* input, const QString& type ) : QgsRasterInterface( input ) - , mType( type ), mOpacity( 1.0 ), mRasterTransparency( 0 ) + , mType( type ), mOpacity( 1.0 ), mRasterTransparency( nullptr ) , mAlphaBand( -1 ) //, mInvertColor( false ) { } diff --git a/src/core/raster/qgsrasterrenderer.h b/src/core/raster/qgsrasterrenderer.h index 557ab1d2aeb..5a9cffa6b29 100644 --- a/src/core/raster/qgsrasterrenderer.h +++ b/src/core/raster/qgsrasterrenderer.h @@ -53,7 +53,7 @@ class CORE_EXPORT QgsRasterRenderer : public QgsRasterInterface static const QRgb NODATA_COLOR; - QgsRasterRenderer( QgsRasterInterface* input = 0, const QString& type = "" ); + QgsRasterRenderer( QgsRasterInterface* input = nullptr, const QString& type = "" ); virtual ~QgsRasterRenderer(); QgsRasterRenderer * clone() const override = 0; diff --git a/src/core/raster/qgsrasterrendererregistry.cpp b/src/core/raster/qgsrasterrendererregistry.cpp index 55c788fbfef..efd750d276e 100644 --- a/src/core/raster/qgsrasterrendererregistry.cpp +++ b/src/core/raster/qgsrasterrendererregistry.cpp @@ -31,7 +31,7 @@ QgsRasterRendererRegistryEntry::QgsRasterRendererRegistryEntry( const QString& t { } -QgsRasterRendererRegistryEntry::QgsRasterRendererRegistryEntry(): rendererCreateFunction( 0 ), widgetCreateFunction( 0 ) +QgsRasterRendererRegistryEntry::QgsRasterRendererRegistryEntry(): rendererCreateFunction( nullptr ), widgetCreateFunction( nullptr ) { } @@ -45,14 +45,14 @@ QgsRasterRendererRegistry::QgsRasterRendererRegistry() { // insert items in a particular order, which is returned in renderersList() insert( QgsRasterRendererRegistryEntry( "multibandcolor", QObject::tr( "Multiband color" ), - QgsMultiBandColorRenderer::create, 0 ) ); - insert( QgsRasterRendererRegistryEntry( "paletted", QObject::tr( "Paletted" ), QgsPalettedRasterRenderer::create, 0 ) ); + QgsMultiBandColorRenderer::create, nullptr ) ); + insert( QgsRasterRendererRegistryEntry( "paletted", QObject::tr( "Paletted" ), QgsPalettedRasterRenderer::create, nullptr ) ); insert( QgsRasterRendererRegistryEntry( "singlebandgray", QObject::tr( "Singleband gray" ), - QgsSingleBandGrayRenderer::create, 0 ) ); + QgsSingleBandGrayRenderer::create, nullptr ) ); insert( QgsRasterRendererRegistryEntry( "singlebandpseudocolor", QObject::tr( "Singleband pseudocolor" ), - QgsSingleBandPseudoColorRenderer::create, 0 ) ); + QgsSingleBandPseudoColorRenderer::create, nullptr ) ); insert( QgsRasterRendererRegistryEntry( "singlebandcolordata", QObject::tr( "Singleband color data" ), - QgsSingleBandColorDataRenderer::create, 0 ) ); + QgsSingleBandColorDataRenderer::create, nullptr ) ); } QgsRasterRendererRegistry::~QgsRasterRendererRegistry() @@ -106,11 +106,11 @@ QgsRasterRenderer* QgsRasterRendererRegistry::defaultRendererForDrawingStyle( co { if ( !provider || provider->bandCount() < 1 ) { - return 0; + return nullptr; } - QgsRasterRenderer* renderer = 0; + QgsRasterRenderer* renderer = nullptr; switch ( theDrawingStyle ) { case QgsRaster::PalettedColor: @@ -204,7 +204,7 @@ QgsRasterRenderer* QgsRasterRendererRegistry::defaultRendererForDrawingStyle( co break; } default: - return 0; + return nullptr; } QgsRasterTransparency* tr = new QgsRasterTransparency(); //renderer takes ownership diff --git a/src/core/raster/qgsrasterresamplefilter.cpp b/src/core/raster/qgsrasterresamplefilter.cpp index c29e650089a..11edd5ba8fe 100644 --- a/src/core/raster/qgsrasterresamplefilter.cpp +++ b/src/core/raster/qgsrasterresamplefilter.cpp @@ -34,8 +34,8 @@ QgsRasterResampleFilter::QgsRasterResampleFilter( QgsRasterInterface* input ) : QgsRasterInterface( input ) - , mZoomedInResampler( 0 ) - , mZoomedOutResampler( 0 ) + , mZoomedInResampler( nullptr ) + , mZoomedOutResampler( nullptr ) , mMaxOversampling( 2.0 ) { } @@ -49,7 +49,7 @@ QgsRasterResampleFilter::~QgsRasterResampleFilter() QgsRasterResampleFilter* QgsRasterResampleFilter::clone() const { QgsDebugMsg( "Entered" ); - QgsRasterResampleFilter * resampler = new QgsRasterResampleFilter( 0 ); + QgsRasterResampleFilter * resampler = new QgsRasterResampleFilter( nullptr ); if ( mZoomedInResampler ) { resampler->setZoomedInResampler( mZoomedInResampler->clone() ); diff --git a/src/core/raster/qgsrasterresamplefilter.h b/src/core/raster/qgsrasterresamplefilter.h index f911934a98c..b336109e461 100644 --- a/src/core/raster/qgsrasterresamplefilter.h +++ b/src/core/raster/qgsrasterresamplefilter.h @@ -31,7 +31,7 @@ class QDomElement; class CORE_EXPORT QgsRasterResampleFilter : public QgsRasterInterface { public: - QgsRasterResampleFilter( QgsRasterInterface *input = 0 ); + QgsRasterResampleFilter( QgsRasterInterface *input = nullptr ); ~QgsRasterResampleFilter(); QgsRasterResampleFilter * clone() const override; diff --git a/src/core/raster/qgsrastershader.cpp b/src/core/raster/qgsrastershader.cpp index cb708120104..da1419eb1b8 100644 --- a/src/core/raster/qgsrastershader.cpp +++ b/src/core/raster/qgsrastershader.cpp @@ -48,7 +48,7 @@ QgsRasterShader::~QgsRasterShader() */ bool QgsRasterShader::shade( double theValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue, int *theReturnAlpha ) { - if ( 0 != mRasterShaderFunction ) + if ( nullptr != mRasterShaderFunction ) { return mRasterShaderFunction->shade( theValue, theReturnRedValue, theReturnGreenValue, theReturnBlueValue, theReturnAlpha ); } @@ -71,7 +71,7 @@ bool QgsRasterShader::shade( double theValue, int* theReturnRedValue, int* theRe */ bool QgsRasterShader::shade( double theRedValue, double theGreenValue, double theBlueValue, double theAlphaValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue, int* theReturnAlphaValue ) { - if ( 0 != mRasterShaderFunction ) + if ( nullptr != mRasterShaderFunction ) { return mRasterShaderFunction->shade( theRedValue, theGreenValue, theBlueValue, theAlphaValue, theReturnRedValue, theReturnGreenValue, theReturnBlueValue, theReturnAlphaValue ); } @@ -91,7 +91,7 @@ void QgsRasterShader::setRasterShaderFunction( QgsRasterShaderFunction* theFunct if ( mRasterShaderFunction == theFunction ) return; - if ( 0 != theFunction ) + if ( nullptr != theFunction ) { delete mRasterShaderFunction; mRasterShaderFunction = theFunction; @@ -108,7 +108,7 @@ void QgsRasterShader::setMaximumValue( double theValue ) QgsDebugMsg( "Value = " + QString::number( theValue ) ); mMaximumValue = theValue; - if ( 0 != mRasterShaderFunction ) + if ( nullptr != mRasterShaderFunction ) { mRasterShaderFunction->setMaximumValue( theValue ); } @@ -124,7 +124,7 @@ void QgsRasterShader::setMinimumValue( double theValue ) QgsDebugMsg( "Value = " + QString::number( theValue ) ); mMinimumValue = theValue; - if ( 0 != mRasterShaderFunction ) + if ( nullptr != mRasterShaderFunction ) { mRasterShaderFunction->setMinimumValue( theValue ); } diff --git a/src/core/raster/qgssinglebandcolordatarenderer.cpp b/src/core/raster/qgssinglebandcolordatarenderer.cpp index da40042c618..3333821f247 100644 --- a/src/core/raster/qgssinglebandcolordatarenderer.cpp +++ b/src/core/raster/qgssinglebandcolordatarenderer.cpp @@ -34,10 +34,10 @@ QgsSingleBandColorDataRenderer::~QgsSingleBandColorDataRenderer() QgsSingleBandColorDataRenderer* QgsSingleBandColorDataRenderer::clone() const { - QgsSingleBandColorDataRenderer * renderer = new QgsSingleBandColorDataRenderer( 0, mBand ); + QgsSingleBandColorDataRenderer * renderer = new QgsSingleBandColorDataRenderer( nullptr, mBand ); renderer->setOpacity( mOpacity ); renderer->setAlphaBand( mAlphaBand ); - renderer->setRasterTransparency( mRasterTransparency ? new QgsRasterTransparency( *mRasterTransparency ) : 0 ); + renderer->setRasterTransparency( mRasterTransparency ? new QgsRasterTransparency( *mRasterTransparency ) : nullptr ); return renderer; } @@ -45,7 +45,7 @@ QgsRasterRenderer* QgsSingleBandColorDataRenderer::create( const QDomElement& el { if ( elem.isNull() ) { - return 0; + return nullptr; } int band = elem.attribute( "band", "-1" ).toInt(); diff --git a/src/core/raster/qgssinglebandgrayrenderer.cpp b/src/core/raster/qgssinglebandgrayrenderer.cpp index ca018e8db4e..a2bd887c9b0 100644 --- a/src/core/raster/qgssinglebandgrayrenderer.cpp +++ b/src/core/raster/qgssinglebandgrayrenderer.cpp @@ -23,7 +23,7 @@ #include QgsSingleBandGrayRenderer::QgsSingleBandGrayRenderer( QgsRasterInterface* input, int grayBand ): - QgsRasterRenderer( input, "singlebandgray" ), mGrayBand( grayBand ), mGradient( BlackToWhite ), mContrastEnhancement( 0 ) + QgsRasterRenderer( input, "singlebandgray" ), mGrayBand( grayBand ), mGradient( BlackToWhite ), mContrastEnhancement( nullptr ) { } @@ -34,10 +34,10 @@ QgsSingleBandGrayRenderer::~QgsSingleBandGrayRenderer() QgsSingleBandGrayRenderer* QgsSingleBandGrayRenderer::clone() const { - QgsSingleBandGrayRenderer * renderer = new QgsSingleBandGrayRenderer( 0, mGrayBand ); + QgsSingleBandGrayRenderer * renderer = new QgsSingleBandGrayRenderer( nullptr, mGrayBand ); renderer->setOpacity( mOpacity ); renderer->setAlphaBand( mAlphaBand ); - renderer->setRasterTransparency( mRasterTransparency ? new QgsRasterTransparency( *mRasterTransparency ) : 0 ); + renderer->setRasterTransparency( mRasterTransparency ? new QgsRasterTransparency( *mRasterTransparency ) : nullptr ); renderer->setGradient( mGradient ); if ( mContrastEnhancement ) { @@ -50,7 +50,7 @@ QgsRasterRenderer* QgsSingleBandGrayRenderer::create( const QDomElement& elem, Q { if ( elem.isNull() ) { - return 0; + return nullptr; } int grayBand = elem.attribute( "grayBand", "-1" ).toInt(); @@ -98,7 +98,7 @@ QgsRasterBlock* QgsSingleBandGrayRenderer::block( int bandNo, QgsRectangle cons return outputBlock; } - QgsRasterBlock *alphaBlock = 0; + QgsRasterBlock *alphaBlock = nullptr; if ( mAlphaBand > 0 && mGrayBand != mAlphaBand ) { diff --git a/src/core/raster/qgssinglebandpseudocolorrenderer.cpp b/src/core/raster/qgssinglebandpseudocolorrenderer.cpp index c41db65b0b5..9dc8f59237a 100644 --- a/src/core/raster/qgssinglebandpseudocolorrenderer.cpp +++ b/src/core/raster/qgssinglebandpseudocolorrenderer.cpp @@ -49,7 +49,7 @@ void QgsSingleBandPseudoColorRenderer::setBand( int bandNo ) QgsSingleBandPseudoColorRenderer* QgsSingleBandPseudoColorRenderer::clone() const { - QgsRasterShader *shader = 0; + QgsRasterShader *shader = nullptr; if ( mShader ) { @@ -68,11 +68,11 @@ QgsSingleBandPseudoColorRenderer* QgsSingleBandPseudoColorRenderer::clone() cons shader->setRasterShaderFunction( colorRampShader ); } } - QgsSingleBandPseudoColorRenderer * renderer = new QgsSingleBandPseudoColorRenderer( 0, mBand, shader ); + QgsSingleBandPseudoColorRenderer * renderer = new QgsSingleBandPseudoColorRenderer( nullptr, mBand, shader ); renderer->setOpacity( mOpacity ); renderer->setAlphaBand( mAlphaBand ); - renderer->setRasterTransparency( mRasterTransparency ? new QgsRasterTransparency( *mRasterTransparency ) : 0 ); + renderer->setRasterTransparency( mRasterTransparency ? new QgsRasterTransparency( *mRasterTransparency ) : nullptr ); return renderer; } @@ -87,11 +87,11 @@ QgsRasterRenderer* QgsSingleBandPseudoColorRenderer::create( const QDomElement& { if ( elem.isNull() ) { - return 0; + return nullptr; } int band = elem.attribute( "band", "-1" ).toInt(); - QgsRasterShader* shader = 0; + QgsRasterShader* shader = nullptr; QDomElement rasterShaderElem = elem.firstChildElement( "rastershader" ); if ( !rasterShaderElem.isNull() ) { @@ -132,7 +132,7 @@ QgsRasterBlock* QgsSingleBandPseudoColorRenderer::block( int bandNo, QgsRectangl //rendering is faster without considering user-defined transparency bool hasTransparency = usesTransparency(); - QgsRasterBlock *alphaBlock = 0; + QgsRasterBlock *alphaBlock = nullptr; if ( mAlphaBand > 0 && mAlphaBand != mBand ) { alphaBlock = mInput->block( mAlphaBand, extent, width, height ); diff --git a/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp b/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp index 9223e921a2d..dc6c9c21a4e 100644 --- a/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp +++ b/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp @@ -49,7 +49,7 @@ QgsRendererCategoryV2::QgsRendererCategoryV2( const QVariant& value, QgsSymbolV2 QgsRendererCategoryV2::QgsRendererCategoryV2( const QgsRendererCategoryV2& cat ) : mValue( cat.mValue ) - , mSymbol( cat.mSymbol.data() ? cat.mSymbol->clone() : NULL ) + , mSymbol( cat.mSymbol.data() ? cat.mSymbol->clone() : nullptr ) , mLabel( cat.mLabel ) , mRender( cat.mRender ) { @@ -158,7 +158,7 @@ QgsCategorizedSymbolRendererV2::QgsCategorizedSymbolRendererV2( const QString& a for ( int i = 0; i < mCategories.count(); ++i ) { QgsRendererCategoryV2& cat = mCategories[i]; - if ( cat.symbol() == NULL ) + if ( cat.symbol() == nullptr ) { QgsDebugMsg( "invalid symbol in a category! ignoring..." ); mCategories.removeAt( i-- ); @@ -196,7 +196,7 @@ QgsSymbolV2* QgsCategorizedSymbolRendererV2::symbolForValue( const QVariant& val { QgsDebugMsgLevel( "attribute value not found: " + value.toString(), 3 ); } - return NULL; + return nullptr; } return *it; @@ -206,7 +206,7 @@ QgsSymbolV2* QgsCategorizedSymbolRendererV2::symbolForFeature( QgsFeature& featu { QgsSymbolV2* symbol = originalSymbolForFeature( feature, context ); if ( !symbol ) - return 0; + return nullptr; if ( !mRotation.data() && !mSizeScale.data() ) return symbol; // no data-defined rotation/scaling - just return the symbol @@ -255,7 +255,7 @@ QgsSymbolV2* QgsCategorizedSymbolRendererV2::originalSymbolForFeature( QgsFeatur // find the right symbol for the category QgsSymbolV2 *symbol = symbolForValue( value ); if ( symbol == &sSkipRender ) - return 0; + return nullptr; if ( !symbol ) { @@ -602,11 +602,11 @@ QgsFeatureRendererV2* QgsCategorizedSymbolRendererV2::create( QDomElement& eleme { QDomElement symbolsElem = element.firstChildElement( "symbols" ); if ( symbolsElem.isNull() ) - return NULL; + return nullptr; QDomElement catsElem = element.firstChildElement( "categories" ); if ( catsElem.isNull() ) - return NULL; + return nullptr; QgsSymbolV2Map symbolMap = QgsSymbolLayerV2Utils::loadSymbols( symbolsElem ); QgsCategoryList cats; @@ -822,7 +822,7 @@ QgsLegendSymbolListV2 QgsCategorizedSymbolRendererV2::legendSymbolItemsV2() cons QgsScaleExpression exp( ddSize.expressionString() ); if ( exp.type() != QgsScaleExpression::Unknown ) { - QgsLegendSymbolItemV2 title( NULL, exp.baseExpression(), "" ); + QgsLegendSymbolItemV2 title( nullptr, exp.baseExpression(), "" ); lst << title; Q_FOREACH ( double v, QgsSymbolLayerV2Utils::prettyBreaks( exp.minValue(), exp.maxValue(), 4 ) ) { diff --git a/src/core/symbology-ng/qgscptcityarchive.cpp b/src/core/symbology-ng/qgscptcityarchive.cpp index 3e04da67b16..c3c2699d581 100644 --- a/src/core/symbology-ng/qgscptcityarchive.cpp +++ b/src/core/symbology-ng/qgscptcityarchive.cpp @@ -49,13 +49,13 @@ QgsCptCityArchive::QgsCptCityArchive( const QString& archiveName, const QString& QgsDebugMsg( "archiveName = " + archiveName + " baseDir = " + baseDir ); // make Author items - QgsCptCityDirectoryItem* dirItem = 0; + QgsCptCityDirectoryItem* dirItem = nullptr; Q_FOREACH ( const QString& path, QDir( mBaseDir ).entryList( QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name ) ) { if ( path == "selections" ) continue; QgsDebugMsg( "path= " + path ); - dirItem = new QgsCptCityDirectoryItem( NULL, QFileInfo( path ).baseName(), path ); + dirItem = new QgsCptCityDirectoryItem( nullptr, QFileInfo( path ).baseName(), path ); if ( dirItem->isValid() ) mRootItems << dirItem; else @@ -63,13 +63,13 @@ QgsCptCityArchive::QgsCptCityArchive( const QString& archiveName, const QString& } // make selection items - QgsCptCitySelectionItem* selItem = 0; + QgsCptCitySelectionItem* selItem = nullptr; QDir seldir( mBaseDir + '/' + "selections" ); QgsDebugMsg( "populating selection from " + seldir.path() ); Q_FOREACH ( const QString& selfile, seldir.entryList( QStringList( "*.xml" ), QDir::Files ) ) { QgsDebugMsg( "file= " + seldir.path() + '/' + selfile ); - selItem = new QgsCptCitySelectionItem( NULL, QFileInfo( selfile ).baseName(), + selItem = new QgsCptCitySelectionItem( nullptr, QFileInfo( selfile ).baseName(), seldir.dirName() + '/' + selfile ); //TODO remove item if there are no children (e.g. esri in qgis-sel) if ( selItem->isValid() ) @@ -80,10 +80,10 @@ QgsCptCityArchive::QgsCptCityArchive( const QString& archiveName, const QString& // make "All Ramps items" (which will contain all ramps without hierarchy) QgsCptCityAllRampsItem* allRampsItem; - allRampsItem = new QgsCptCityAllRampsItem( NULL, QObject::tr( "All Ramps" ), + allRampsItem = new QgsCptCityAllRampsItem( nullptr, QObject::tr( "All Ramps" ), mRootItems ); mRootItems.prepend( allRampsItem ); - allRampsItem = new QgsCptCityAllRampsItem( NULL, QObject::tr( "All Ramps" ), + allRampsItem = new QgsCptCityAllRampsItem( nullptr, QObject::tr( "All Ramps" ), mSelectionItems ); mSelectionItems.prepend( allRampsItem ); } @@ -418,7 +418,7 @@ QgsCptCityArchive* QgsCptCityArchive::defaultArchive() if ( QgsCptCityArchive::mArchiveRegistry.contains( mDefaultArchiveName ) ) return QgsCptCityArchive::mArchiveRegistry.value( mDefaultArchiveName ); else - return NULL; + return nullptr; } void QgsCptCityArchive::initArchive( const QString& archiveName, const QString& archiveBaseDir ) @@ -646,7 +646,7 @@ QgsCptCityDataItem * QgsCptCityDataItem::removeChildItem( QgsCptCityDataItem * c this, SLOT( emitBeginRemoveItems( QgsCptCityDataItem*, int, int ) ) ); disconnect( child, SIGNAL( endRemoveItems() ), this, SLOT( emitEndRemoveItems() ) ); - child->setParent( 0 ); + child->setParent( nullptr ); return child; } @@ -867,7 +867,7 @@ QVector< QgsCptCityDataItem* > QgsCptCityCollectionItem::childrenRamps( bool rec { QgsCptCityCollectionItem* collectionItem = dynamic_cast( childItem ); QgsCptCityColorRampItem* rampItem = dynamic_cast( childItem ); - QgsDebugMsgLevel( QString( "child path= %1 coll= %2 ramp = %3" ).arg( childItem->path() ).arg( collectionItem != 0 ).arg( rampItem != 0 ), 2 ); + QgsDebugMsgLevel( QString( "child path= %1 coll= %2 ramp = %3" ).arg( childItem->path() ).arg( collectionItem != nullptr ).arg( rampItem != nullptr ), 2 ); if ( collectionItem && recursive ) { collectionItem->populate(); @@ -1123,10 +1123,10 @@ QgsCptCityDataItem* QgsCptCityDirectoryItem::dataItem( QgsCptCityDataItem* paren if ( dirItem && ! dirItem->isValid() ) { delete dirItem; - return 0; + return nullptr; } if ( ! dirItem ) - return 0; + return nullptr; // fetch sub-dirs and ramps to know what to do with this item QStringList theDirEntries = dirItem->dirEntries(); @@ -1142,7 +1142,7 @@ QgsCptCityDataItem* QgsCptCityDirectoryItem::dataItem( QgsCptCityDataItem* paren if ( theRampsMap.isEmpty() ) { delete dirItem; - return 0; + return nullptr; } // if 1 ramp, return this child's item // so we don't have a directory with just 1 item (with many variants possibly) @@ -1155,7 +1155,7 @@ QgsCptCityDataItem* QgsCptCityDirectoryItem::dataItem( QgsCptCityDataItem* paren if ( ! rampItem->isValid() ) { delete rampItem; - return 0; + return nullptr; } return rampItem; } @@ -1183,7 +1183,7 @@ QVector QgsCptCitySelectionItem::createChildren() if ( ! mValid ) return QVector(); - QgsCptCityDataItem* item = 0; + QgsCptCityDataItem* item = nullptr; QVector children; QgsDebugMsg( "name= " + mName + " path= " + mPath ); @@ -1332,7 +1332,7 @@ QgsCptCityBrowserModel::QgsCptCityBrowserModel( QObject *parent, QgsCptCityArchive* archive, ViewType viewType ) : QAbstractItemModel( parent ), mArchive( archive ), mViewType( viewType ) { - Q_ASSERT( mArchive != NULL ); + Q_ASSERT( mArchive != nullptr ); QgsDebugMsg( "archiveName = " + archive->archiveName() + " viewType=" + ( int ) viewType ); // keep iconsize for now, but not effectively used mIconSize = QSize( 100, 15 ); @@ -1371,7 +1371,7 @@ void QgsCptCityBrowserModel::removeRootItems() Qt::ItemFlags QgsCptCityBrowserModel::flags( const QModelIndex & index ) const { if ( !index.isValid() ) - return 0; + return nullptr; Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable; @@ -1412,7 +1412,7 @@ QVariant QgsCptCityBrowserModel::data( const QModelIndex &index, int role ) cons return item->icon( mIconSize ); } else if ( role == Qt::FontRole && - ( dynamic_cast< QgsCptCityCollectionItem* >( item ) != 0 ) ) + ( dynamic_cast< QgsCptCityCollectionItem* >( item ) != nullptr ) ) { // collectionitems are larger and bold QFont font; @@ -1597,7 +1597,7 @@ QModelIndex QgsCptCityBrowserModel::index( int row, int column, const QModelInde { QgsCptCityDataItem *p = dataItem( parent ); const QVector &items = p ? p->children() : mRootItems; - QgsCptCityDataItem *item = items.value( row, 0 ); + QgsCptCityDataItem *item = items.value( row, nullptr ); return item ? createIndex( row, column, item ) : QModelIndex(); } diff --git a/src/core/symbology-ng/qgscptcityarchive.h b/src/core/symbology-ng/qgscptcityarchive.h index 1d3b8436f68..35375fd1b1b 100644 --- a/src/core/symbology-ng/qgscptcityarchive.h +++ b/src/core/symbology-ng/qgscptcityarchive.h @@ -128,7 +128,7 @@ class CORE_EXPORT QgsCptCityDataItem : public QObject virtual bool equal( const QgsCptCityDataItem *other ); - virtual QWidget *paramWidget() { return 0; } + virtual QWidget *paramWidget() { return nullptr; } // list of actions provided by this item - usually used for popup menu on right-click virtual QList actions() { return QList(); } @@ -312,7 +312,7 @@ class CORE_EXPORT QgsCptCityBrowserModel : public QAbstractItemModel List = 2 // not used anymore }; - QgsCptCityBrowserModel( QObject* parent = 0, + QgsCptCityBrowserModel( QObject* parent = nullptr, QgsCptCityArchive* archive = QgsCptCityArchive::defaultArchive(), ViewType Type = Authors ); ~QgsCptCityBrowserModel(); @@ -343,7 +343,7 @@ class CORE_EXPORT QgsCptCityBrowserModel : public QAbstractItemModel /** Returns the index of the item in the model specified by the given row, column and parent index. */ virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const override; - QModelIndex findItem( QgsCptCityDataItem *item, QgsCptCityDataItem *parent = 0 ) const; + QModelIndex findItem( QgsCptCityDataItem *item, QgsCptCityDataItem *parent = nullptr ) const; /** Returns the parent of the model item with the given index. * If the item has no parent, an invalid QModelIndex is returned. diff --git a/src/core/symbology-ng/qgsellipsesymbollayerv2.cpp b/src/core/symbology-ng/qgsellipsesymbollayerv2.cpp index abaa65e148c..972b606790b 100644 --- a/src/core/symbology-ng/qgsellipsesymbollayerv2.cpp +++ b/src/core/symbology-ng/qgsellipsesymbollayerv2.cpp @@ -420,7 +420,7 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::createFromSld( QDomElement &element ) QDomElement graphicElem = element.firstChildElement( "Graphic" ); if ( graphicElem.isNull() ) - return NULL; + return nullptr; QString name = "circle"; QColor fillColor, borderColor; @@ -441,7 +441,7 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::createFromSld( QDomElement &element ) } if ( !QgsSymbolLayerV2Utils::wellKnownMarkerFromSld( graphicElem, name, fillColor, borderColor, borderStyle, borderWidth, size ) ) - return NULL; + return nullptr; double angle = 0.0; QString angleFunc; diff --git a/src/core/symbology-ng/qgsellipsesymbollayerv2.h b/src/core/symbology-ng/qgsellipsesymbollayerv2.h index f4cbcbb9756..282892ff002 100644 --- a/src/core/symbology-ng/qgsellipsesymbollayerv2.h +++ b/src/core/symbology-ng/qgsellipsesymbollayerv2.h @@ -115,8 +115,8 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2 @param scaledHeight optional height @param f optional feature to render (0 if no data defined rendering) */ - void preparePath( const QString& symbolName, QgsSymbolV2RenderContext& context, double* scaledWidth = 0, double* scaledHeight = 0, const QgsFeature* f = 0 ); - QSizeF calculateSize( QgsSymbolV2RenderContext& context, double* scaledWidth = 0, double* scaledHeight = 0 ); + void preparePath( const QString& symbolName, QgsSymbolV2RenderContext& context, double* scaledWidth = nullptr, double* scaledHeight = nullptr, const QgsFeature* f = nullptr ); + QSizeF calculateSize( QgsSymbolV2RenderContext& context, double* scaledWidth = nullptr, double* scaledHeight = nullptr ); void calculateOffsetAndRotation( QgsSymbolV2RenderContext& context, double scaledWidth, double scaledHeight, bool& hasDataDefinedRotation, QPointF& offset, double& angle ) const; }; diff --git a/src/core/symbology-ng/qgsfillsymbollayerv2.cpp b/src/core/symbology-ng/qgsfillsymbollayerv2.cpp index ca55a167914..4b099604a75 100644 --- a/src/core/symbology-ng/qgsfillsymbollayerv2.cpp +++ b/src/core/symbology-ng/qgsfillsymbollayerv2.cpp @@ -450,7 +450,7 @@ QgsGradientFillSymbolLayerV2::QgsGradientFillSymbolLayerV2( const QColor& color, GradientColorType colorType, GradientType gradientType, GradientCoordinateMode coordinateMode, GradientSpread spread ) : mGradientColorType( colorType ) - , mGradientRamp( NULL ) + , mGradientRamp( nullptr ) , mGradientType( gradientType ) , mCoordinateMode( coordinateMode ) , mGradientSpread( spread ) @@ -941,8 +941,8 @@ QgsShapeburstFillSymbolLayerV2::QgsShapeburstFillSymbolLayerV2( const QColor& co mDistanceUnit( QgsSymbolV2::MM ), mColorType( colorType ), mColor2( color2 ), - mGradientRamp( NULL ), - mTwoColorGradientRamp( 0 ), + mGradientRamp( nullptr ), + mTwoColorGradientRamp( nullptr ), mIgnoreRings( false ), mOffsetUnit( QgsSymbolV2::MM ) { @@ -1223,7 +1223,7 @@ void QgsShapeburstFillSymbolLayerV2::renderPolygon( const QPolygonF& points, QLi imgPainter.setPen( QPen( Qt::black ) ); imgPainter.translate( -points.boundingRect().left() + sideBuffer, - points.boundingRect().top() + sideBuffer ); imgPainter.scale( context.renderContext().rasterScaleFactor(), context.renderContext().rasterScaleFactor() ); - _renderPolygon( &imgPainter, points, NULL, context ); + _renderPolygon( &imgPainter, points, nullptr, context ); } imgPainter.end(); @@ -1550,7 +1550,7 @@ QgsImageFillSymbolLayer::QgsImageFillSymbolLayer() : mNextAngle( 0.0 ) , mOutlineWidth( 0.0 ) , mOutlineWidthUnit( QgsSymbolV2::MM ) - , mOutline( 0 ) + , mOutline( nullptr ) { setSubSymbol( new QgsLineSymbolV2() ); } @@ -1613,7 +1613,7 @@ bool QgsImageFillSymbolLayer::setSubSymbol( QgsSymbolV2* symbol ) if ( !symbol ) //unset current outline { delete mOutline; - mOutline = 0; + mOutline = nullptr; return true; } @@ -1724,7 +1724,7 @@ QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer( const QString& svgFilePath, double mSvgOutlineColor = QColor( 0, 0, 0 ); mSvgOutlineWidth = 0.2; setDefaultSvgParams(); - mSvgPattern = 0; + mSvgPattern = nullptr; } QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer( const QByteArray& svgData, double width, double angle ): QgsImageFillSymbolLayer(), @@ -1741,7 +1741,7 @@ QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer( const QByteArray& svgData, double mSvgOutlineWidth = 0.2; setSubSymbol( new QgsLineSymbolV2() ); setDefaultSvgParams(); - mSvgPattern = 0; + mSvgPattern = nullptr; } QgsSVGFillSymbolLayer::~QgsSVGFillSymbolLayer() @@ -1817,7 +1817,7 @@ QgsSymbolLayerV2* QgsSVGFillSymbolLayer::create( const QgsStringMap& properties angle = properties["angle"].toDouble(); } - QgsSVGFillSymbolLayer* symbolLayer = 0; + QgsSVGFillSymbolLayer* symbolLayer = nullptr; if ( !svgFilePath.isEmpty() ) { symbolLayer = new QgsSVGFillSymbolLayer( svgFilePath, width, angle ); @@ -1915,7 +1915,7 @@ void QgsSVGFillSymbolLayer::applyPattern( QBrush& brush, const QString& svgFileP } delete mSvgPattern; - mSvgPattern = 0; + mSvgPattern = nullptr; double size = patternWidth * QgsSymbolLayerV2Utils::pixelSizeScaleFactor( context.renderContext(), patternWidthUnit, patternWidthMapUnitScale ); if (( int )size < 1.0 || 10000.0 < size ) @@ -2016,7 +2016,7 @@ QgsStringMap QgsSVGFillSymbolLayer::properties() const QgsSVGFillSymbolLayer* QgsSVGFillSymbolLayer::clone() const { - QgsSVGFillSymbolLayer* clonedLayer = 0; + QgsSVGFillSymbolLayer* clonedLayer = nullptr; if ( !mSvgFilePath.isEmpty() ) { clonedLayer = new QgsSVGFillSymbolLayer( mSvgFilePath, mPatternWidth, mAngle ); @@ -2113,21 +2113,21 @@ QgsSymbolLayerV2* QgsSVGFillSymbolLayer::createFromSld( QDomElement &element ) QDomElement fillElem = element.firstChildElement( "Fill" ); if ( fillElem.isNull() ) - return NULL; + return nullptr; QDomElement graphicFillElem = fillElem.firstChildElement( "GraphicFill" ); if ( graphicFillElem.isNull() ) - return NULL; + return nullptr; QDomElement graphicElem = graphicFillElem.firstChildElement( "Graphic" ); if ( graphicElem.isNull() ) - return NULL; + return nullptr; if ( !QgsSymbolLayerV2Utils::externalGraphicFromSld( graphicElem, path, mimeType, fillColor, size ) ) - return NULL; + return nullptr; if ( mimeType != "image/svg+xml" ) - return NULL; + return nullptr; QgsSymbolLayerV2Utils::lineFromSld( graphicElem, penStyle, borderColor, borderWidth ); @@ -2290,10 +2290,10 @@ QgsLinePatternFillSymbolLayer::QgsLinePatternFillSymbolLayer() , mLineAngle( 45.0 ) , mOffset( 0.0 ) , mOffsetUnit( QgsSymbolV2::MM ) - , mFillLineSymbol( 0 ) + , mFillLineSymbol( nullptr ) { setSubSymbol( new QgsLineSymbolV2() ); - QgsImageFillSymbolLayer::setSubSymbol( 0 ); //no outline + QgsImageFillSymbolLayer::setSubSymbol( nullptr ); //no outline } void QgsLinePatternFillSymbolLayer::setLineWidth( double w ) @@ -2945,21 +2945,21 @@ QgsSymbolLayerV2* QgsLinePatternFillSymbolLayer::createFromSld( QDomElement &ele QDomElement fillElem = element.firstChildElement( "Fill" ); if ( fillElem.isNull() ) - return NULL; + return nullptr; QDomElement graphicFillElem = fillElem.firstChildElement( "GraphicFill" ); if ( graphicFillElem.isNull() ) - return NULL; + return nullptr; QDomElement graphicElem = graphicFillElem.firstChildElement( "Graphic" ); if ( graphicElem.isNull() ) - return NULL; + return nullptr; if ( !QgsSymbolLayerV2Utils::wellKnownMarkerFromSld( graphicElem, name, fillColor, lineColor, lineStyle, lineWidth, size ) ) - return NULL; + return nullptr; if ( name != "horline" ) - return NULL; + return nullptr; double angle = 0.0; QString angleFunc; @@ -3004,7 +3004,7 @@ QgsSymbolLayerV2* QgsLinePatternFillSymbolLayer::createFromSld( QDomElement &ele //////////////////////// -QgsPointPatternFillSymbolLayer::QgsPointPatternFillSymbolLayer(): QgsImageFillSymbolLayer(), mMarkerSymbol( 0 ), mDistanceX( 15 ), +QgsPointPatternFillSymbolLayer::QgsPointPatternFillSymbolLayer(): QgsImageFillSymbolLayer(), mMarkerSymbol( nullptr ), mDistanceX( 15 ), mDistanceXUnit( QgsSymbolV2::MM ), mDistanceY( 15 ), mDistanceYUnit( QgsSymbolV2::MM ), mDisplacementX( 0 ), mDisplacementXUnit( QgsSymbolV2::MM ), mDisplacementY( 0 ), mDisplacementYUnit( QgsSymbolV2::MM ) { @@ -3013,7 +3013,7 @@ QgsPointPatternFillSymbolLayer::QgsPointPatternFillSymbolLayer(): QgsImageFillSy mDisplacementX = 0; mDisplacementY = 0; setSubSymbol( new QgsMarkerSymbolV2() ); - QgsImageFillSymbolLayer::setSubSymbol( 0 ); //no outline + QgsImageFillSymbolLayer::setSubSymbol( nullptr ); //no outline } QgsPointPatternFillSymbolLayer::~QgsPointPatternFillSymbolLayer() @@ -3291,7 +3291,7 @@ void QgsPointPatternFillSymbolLayer::toSld( QDomDocument &doc, QDomElement &elem QgsSymbolLayerV2* QgsPointPatternFillSymbolLayer::createFromSld( QDomElement &element ) { Q_UNUSED( element ); - return NULL; + return nullptr; } bool QgsPointPatternFillSymbolLayer::setSubSymbol( QgsSymbolV2* symbol ) @@ -3364,7 +3364,7 @@ QSet QgsPointPatternFillSymbolLayer::usedAttributes() const ////////////// -QgsCentroidFillSymbolLayerV2::QgsCentroidFillSymbolLayerV2(): mMarker( NULL ), mPointOnSurface( false ) +QgsCentroidFillSymbolLayerV2::QgsCentroidFillSymbolLayerV2(): mMarker( nullptr ), mPointOnSurface( false ) { setSubSymbol( new QgsMarkerSymbolV2() ); } @@ -3446,7 +3446,7 @@ QgsSymbolLayerV2* QgsCentroidFillSymbolLayerV2::createFromSld( QDomElement &elem QgsSymbolLayerV2 *l = QgsSymbolLayerV2Utils::createMarkerLayerFromSld( element ); if ( !l ) - return NULL; + return nullptr; QgsSymbolLayerV2List layers; layers.append( l ); @@ -3465,7 +3465,7 @@ QgsSymbolV2* QgsCentroidFillSymbolLayerV2::subSymbol() bool QgsCentroidFillSymbolLayerV2::setSubSymbol( QgsSymbolV2* symbol ) { - if ( symbol == NULL || symbol->type() != QgsSymbolV2::Marker ) + if ( symbol == nullptr || symbol->type() != QgsSymbolV2::Marker ) { delete symbol; return false; @@ -3533,7 +3533,7 @@ QgsRasterFillSymbolLayer::QgsRasterFillSymbolLayer( const QString &imageFilePath , mWidth( 0.0 ) , mWidthUnit( QgsSymbolV2::Pixel ) { - QgsImageFillSymbolLayer::setSubSymbol( 0 ); //disable sub symbol + QgsImageFillSymbolLayer::setSubSymbol( nullptr ); //disable sub symbol } QgsRasterFillSymbolLayer::~QgsRasterFillSymbolLayer() diff --git a/src/core/symbology-ng/qgsfillsymbollayerv2.h b/src/core/symbology-ng/qgsfillsymbollayerv2.h index 64b5a376fd4..c06dbf1cc11 100644 --- a/src/core/symbology-ng/qgsfillsymbollayerv2.h +++ b/src/core/symbology-ng/qgsfillsymbollayerv2.h @@ -618,7 +618,7 @@ class CORE_EXPORT QgsRasterFillSymbolLayer: public QgsImageFillSymbolLayer virtual double estimateMaxBleed() const override; //override QgsImageFillSymbolLayer's support for sub symbols - virtual QgsSymbolV2* subSymbol() override { return 0; } + virtual QgsSymbolV2* subSymbol() override { return nullptr; } virtual bool setSubSymbol( QgsSymbolV2* symbol ) override; /** Sets the path to the raster image used for the fill. diff --git a/src/core/symbology-ng/qgsgeometrygeneratorsymbollayerv2.cpp b/src/core/symbology-ng/qgsgeometrygeneratorsymbollayerv2.cpp index ef2d57a9308..a0635f322f0 100644 --- a/src/core/symbology-ng/qgsgeometrygeneratorsymbollayerv2.cpp +++ b/src/core/symbology-ng/qgsgeometrygeneratorsymbollayerv2.cpp @@ -51,10 +51,10 @@ QgsSymbolLayerV2* QgsGeometryGeneratorSymbolLayerV2::create( const QgsStringMap& QgsGeometryGeneratorSymbolLayerV2::QgsGeometryGeneratorSymbolLayerV2( const QString& expression ) : QgsSymbolLayerV2( QgsSymbolV2::Hybrid ) , mExpression( new QgsExpression( expression ) ) - , mFillSymbol( 0 ) - , mLineSymbol( 0 ) - , mMarkerSymbol( 0 ) - , mSymbol( 0 ) + , mFillSymbol( nullptr ) + , mLineSymbol( nullptr ) + , mMarkerSymbol( nullptr ) + , mSymbol( nullptr ) { } diff --git a/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp b/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp index a942c8b1464..6db27ad4b2b 100644 --- a/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp +++ b/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp @@ -39,7 +39,7 @@ QgsRendererRangeV2::QgsRendererRangeV2() : mLowerValue( 0 ) , mUpperValue( 0 ) - , mSymbol( 0 ) + , mSymbol( nullptr ) , mLabel() , mRender( true ) { @@ -57,7 +57,7 @@ QgsRendererRangeV2::QgsRendererRangeV2( double lowerValue, double upperValue, Qg QgsRendererRangeV2::QgsRendererRangeV2( const QgsRendererRangeV2& range ) : mLowerValue( range.mLowerValue ) , mUpperValue( range.mUpperValue ) - , mSymbol( range.mSymbol.data() ? range.mSymbol->clone() : NULL ) + , mSymbol( range.mSymbol.data() ? range.mSymbol->clone() : nullptr ) , mLabel( range.mLabel ) , mRender( range.mRender ) { @@ -310,18 +310,18 @@ QgsSymbolV2* QgsGraduatedSymbolRendererV2::symbolForValue( double value ) if ( it->renderState() || mCounting ) return it->symbol(); else - return NULL; + return nullptr; } } // the value is out of the range: return NULL instead of symbol - return NULL; + return nullptr; } QgsSymbolV2* QgsGraduatedSymbolRendererV2::symbolForFeature( QgsFeature& feature, QgsRenderContext &context ) { QgsSymbolV2* symbol = originalSymbolForFeature( feature, context ); - if ( symbol == NULL ) - return NULL; + if ( symbol == nullptr ) + return nullptr; if ( !mRotation.data() && !mSizeScale.data() ) return symbol; // no data-defined rotation/scaling - just return the symbol @@ -365,7 +365,7 @@ QgsSymbolV2* QgsGraduatedSymbolRendererV2::originalSymbolForFeature( QgsFeature& // Null values should not be categorized if ( value.isNull() ) - return NULL; + return nullptr; // find the right category return symbolForValue( value.toDouble() ); @@ -939,18 +939,18 @@ void QgsGraduatedSymbolRendererV2::updateClasses( QgsVectorLayer *vlayer, Mode m QgsSymbolV2* newSymbol = mSourceSymbol ? mSourceSymbol->clone() : QgsSymbolV2::defaultSymbol( vlayer->geometryType() ); addClass( QgsRendererRangeV2( lower, upper, newSymbol, label ) ); } - updateColorRamp( 0, mInvertedColorRamp ); + updateColorRamp( nullptr, mInvertedColorRamp ); } QgsFeatureRendererV2* QgsGraduatedSymbolRendererV2::create( QDomElement& element ) { QDomElement symbolsElem = element.firstChildElement( "symbols" ); if ( symbolsElem.isNull() ) - return NULL; + return nullptr; QDomElement rangesElem = element.firstChildElement( "ranges" ); if ( rangesElem.isNull() ) - return NULL; + return nullptr; QgsSymbolV2Map symbolMap = QgsSymbolLayerV2Utils::loadSymbols( symbolsElem ); QgsRangeList ranges; @@ -1209,7 +1209,7 @@ QgsLegendSymbolListV2 QgsGraduatedSymbolRendererV2::legendSymbolItemsV2() const QgsScaleExpression exp( ddSize.expressionString() ); if ( exp.type() != QgsScaleExpression::Unknown ) { - QgsLegendSymbolItemV2 title( NULL, exp.baseExpression(), "" ); + QgsLegendSymbolItemV2 title( nullptr, exp.baseExpression(), "" ); list << title; Q_FOREACH ( double v, QgsSymbolLayerV2Utils::prettyBreaks( exp.minValue(), exp.maxValue(), 4 ) ) { @@ -1298,7 +1298,7 @@ void QgsGraduatedSymbolRendererV2::setSymbolSizes( double minSize, double maxSiz { for ( int i = 0; i < mRanges.count(); i++ ) { - QScopedPointer symbol( mRanges[i].symbol() ? mRanges[i].symbol()->clone() : 0 ); + QScopedPointer symbol( mRanges[i].symbol() ? mRanges[i].symbol()->clone() : nullptr ); const double size = mRanges.count() > 1 ? minSize + i * ( maxSize - minSize ) / ( mRanges.count() - 1 ) : .5 * ( maxSize + minSize ); @@ -1323,7 +1323,7 @@ void QgsGraduatedSymbolRendererV2::updateColorRamp( QgsVectorColorRampV2 *ramp, { Q_FOREACH ( const QgsRendererRangeV2& range, mRanges ) { - QgsSymbolV2 *symbol = range.symbol() ? range.symbol()->clone() : 0; + QgsSymbolV2 *symbol = range.symbol() ? range.symbol()->clone() : nullptr; if ( symbol ) { double colorValue; diff --git a/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.h b/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.h index 507a96761c4..85ec3f0fa84 100644 --- a/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.h +++ b/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.h @@ -276,7 +276,7 @@ class CORE_EXPORT QgsGraduatedSymbolRendererV2 : public QgsFeatureRendererV2 * @param ramp color ramp. Ownership is transferred to the renderer * @param inverted set to true to invert ramp colors */ - void updateColorRamp( QgsVectorColorRampV2* ramp = 0, bool inverted = false ); + void updateColorRamp( QgsVectorColorRampV2* ramp = nullptr, bool inverted = false ); /** Update all the symbols but leave breaks and colors. */ void updateSymbols( QgsSymbolV2* sym ); diff --git a/src/core/symbology-ng/qgsheatmaprenderer.cpp b/src/core/symbology-ng/qgsheatmaprenderer.cpp index 570afe41853..f7b4fb4981c 100644 --- a/src/core/symbology-ng/qgsheatmaprenderer.cpp +++ b/src/core/symbology-ng/qgsheatmaprenderer.cpp @@ -39,7 +39,7 @@ QgsHeatmapRenderer::QgsHeatmapRenderer( ) , mRadiusSquared( 0 ) , mRadiusUnit( QgsSymbolV2::MM ) , mWeightAttrNum( -1 ) - , mGradientRamp( 0 ) + , mGradientRamp( nullptr ) , mInvertRamp( false ) , mExplicitMax( 0.0 ) , mRenderQuality( 3 ) @@ -142,7 +142,7 @@ bool QgsHeatmapRenderer::renderFeature( QgsFeature& feature, QgsRenderContext& c int height = context.painter()->device()->height() / mRenderQuality; //transform geometry if required - QgsGeometry* transformedGeom = 0; + QgsGeometry* transformedGeom = nullptr; const QgsCoordinateTransform* xform = context.coordinateTransform(); if ( xform ) { @@ -154,7 +154,7 @@ bool QgsHeatmapRenderer::renderFeature( QgsFeature& feature, QgsRenderContext& c QgsMultiPoint multiPoint = convertToMultipoint( transformedGeom ? transformedGeom : feature.constGeometry() ); delete transformedGeom; - transformedGeom = 0; + transformedGeom = nullptr; //loop through all points in multipoint for ( QgsMultiPoint::const_iterator pointIt = multiPoint.constBegin(); pointIt != multiPoint.constEnd(); ++pointIt ) @@ -371,7 +371,7 @@ QDomElement QgsHeatmapRenderer::save( QDomDocument& doc ) QgsSymbolV2* QgsHeatmapRenderer::symbolForFeature( QgsFeature& feature, QgsRenderContext& ) { Q_UNUSED( feature ); - return 0; + return nullptr; } QgsSymbolV2List QgsHeatmapRenderer::symbols( QgsRenderContext& ) diff --git a/src/core/symbology-ng/qgsinvertedpolygonrenderer.cpp b/src/core/symbology-ng/qgsinvertedpolygonrenderer.cpp index b0db862e38a..ba2cb5ba85b 100644 --- a/src/core/symbology-ng/qgsinvertedpolygonrenderer.cpp +++ b/src/core/symbology-ng/qgsinvertedpolygonrenderer.cpp @@ -55,7 +55,7 @@ void QgsInvertedPolygonRenderer::setEmbeddedRenderer( const QgsFeatureRendererV2 } else { - mSubRenderer.reset( 0 ); + mSubRenderer.reset( nullptr ); } } @@ -111,7 +111,7 @@ void QgsInvertedPolygonRenderer::startRender( QgsRenderContext& context, const Q if ( context.coordinateTransform() ) { // disable projection - mContext.setCoordinateTransform( 0 ); + mContext.setCoordinateTransform( nullptr ); // recompute extent so that polygon clipping is correct QRect v( context.painter()->viewport() ); mContext.setExtent( QgsRectangle( mtp.toMapCoordinates( v.topLeft() ), mtp.toMapCoordinates( v.bottomRight() ) ) ); @@ -337,7 +337,7 @@ QgsInvertedPolygonRenderer* QgsInvertedPolygonRenderer::clone() const QgsInvertedPolygonRenderer* newRenderer; if ( mSubRenderer.isNull() ) { - newRenderer = new QgsInvertedPolygonRenderer( 0 ); + newRenderer = new QgsInvertedPolygonRenderer( nullptr ); } else { @@ -386,7 +386,7 @@ QgsSymbolV2* QgsInvertedPolygonRenderer::symbolForFeature( QgsFeature& feature, { if ( !mSubRenderer ) { - return 0; + return nullptr; } return mSubRenderer->symbolForFeature( feature, context ); } @@ -394,7 +394,7 @@ QgsSymbolV2* QgsInvertedPolygonRenderer::symbolForFeature( QgsFeature& feature, QgsSymbolV2* QgsInvertedPolygonRenderer::originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context ) { if ( !mSubRenderer ) - return 0; + return nullptr; return mSubRenderer->originalSymbolForFeature( feat, context ); } @@ -482,6 +482,6 @@ QgsInvertedPolygonRenderer* QgsInvertedPolygonRenderer::convertFromRenderer( con { return new QgsInvertedPolygonRenderer( renderer->clone() ); } - return 0; + return nullptr; } diff --git a/src/core/symbology-ng/qgsinvertedpolygonrenderer.h b/src/core/symbology-ng/qgsinvertedpolygonrenderer.h index 5cd9f13b063..cc4d81eca09 100644 --- a/src/core/symbology-ng/qgsinvertedpolygonrenderer.h +++ b/src/core/symbology-ng/qgsinvertedpolygonrenderer.h @@ -44,7 +44,7 @@ class CORE_EXPORT QgsInvertedPolygonRenderer : public QgsFeatureRendererV2 /** Constructor * @param embeddedRenderer optional embeddedRenderer. If null, a default one will be assigned */ - QgsInvertedPolygonRenderer( const QgsFeatureRendererV2* embeddedRenderer = 0 ); + QgsInvertedPolygonRenderer( const QgsFeatureRendererV2* embeddedRenderer = nullptr ); virtual ~QgsInvertedPolygonRenderer(); /** Used to clone this feature renderer.*/ diff --git a/src/core/symbology-ng/qgslegendsymbolitemv2.cpp b/src/core/symbology-ng/qgslegendsymbolitemv2.cpp index b807d0f22e0..2e65ca8450c 100644 --- a/src/core/symbology-ng/qgslegendsymbolitemv2.cpp +++ b/src/core/symbology-ng/qgslegendsymbolitemv2.cpp @@ -18,9 +18,9 @@ #include "qgssymbolv2.h" QgsLegendSymbolItemV2::QgsLegendSymbolItemV2() - : mSymbol( 0 ) + : mSymbol( nullptr ) , mCheckable( false ) - , mOriginalSymbolPointer( 0 ) + , mOriginalSymbolPointer( nullptr ) , mScaleMinDenom( -1 ) , mScaleMaxDenom( -1 ) , mLevel( 0 ) @@ -28,7 +28,7 @@ QgsLegendSymbolItemV2::QgsLegendSymbolItemV2() } QgsLegendSymbolItemV2::QgsLegendSymbolItemV2( QgsSymbolV2* symbol, const QString& label, const QString& ruleKey, bool checkable, int scaleMinDenom, int scaleMaxDenom, int level, const QString& parentRuleKey ) - : mSymbol( symbol ? symbol->clone() : 0 ) + : mSymbol( symbol ? symbol->clone() : nullptr ) , mLabel( label ) , mKey( ruleKey ) , mCheckable( checkable ) @@ -41,8 +41,8 @@ QgsLegendSymbolItemV2::QgsLegendSymbolItemV2( QgsSymbolV2* symbol, const QString } QgsLegendSymbolItemV2::QgsLegendSymbolItemV2( const QgsLegendSymbolItemV2& other ) - : mSymbol( 0 ) - , mOriginalSymbolPointer( 0 ) + : mSymbol( nullptr ) + , mOriginalSymbolPointer( nullptr ) { *this = other; } @@ -86,6 +86,6 @@ bool QgsLegendSymbolItemV2::isScaleOK( double scale ) const void QgsLegendSymbolItemV2::setSymbol( QgsSymbolV2* s ) { delete mSymbol; - mSymbol = s ? s->clone() : 0; + mSymbol = s ? s->clone() : nullptr; mOriginalSymbolPointer = s; } diff --git a/src/core/symbology-ng/qgslinesymbollayerv2.cpp b/src/core/symbology-ng/qgslinesymbollayerv2.cpp index 3390115bdc5..c5a36617bce 100644 --- a/src/core/symbology-ng/qgslinesymbollayerv2.cpp +++ b/src/core/symbology-ng/qgslinesymbollayerv2.cpp @@ -252,7 +252,7 @@ void QgsSimpleLineSymbolLayerV2::renderPolygonOutline( const QPolygonF& points, QPainterPath clipPath; clipPath.addPolygon( points ); - if ( rings != NULL ) + if ( rings != nullptr ) { //add polygon rings QList::const_iterator it = rings->constBegin(); @@ -442,7 +442,7 @@ QgsSymbolLayerV2* QgsSimpleLineSymbolLayerV2::createFromSld( QDomElement &elemen QDomElement strokeElem = element.firstChildElement( "Stroke" ); if ( strokeElem.isNull() ) - return NULL; + return nullptr; Qt::PenStyle penStyle; QColor color; @@ -455,7 +455,7 @@ QgsSymbolLayerV2* QgsSimpleLineSymbolLayerV2::createFromSld( QDomElement &elemen color, width, &penJoinStyle, &penCapStyle, &customDashVector ) ) - return NULL; + return nullptr; double offset = 0.0; QDomElement perpOffsetElem = element.firstChildElement( "PerpendicularOffset" ); @@ -718,7 +718,7 @@ QgsMarkerLineSymbolLayerV2::QgsMarkerLineSymbolLayerV2( bool rotateMarker, doubl mRotateMarker = rotateMarker; mInterval = interval; mIntervalUnit = QgsSymbolV2::MM; - mMarker = NULL; + mMarker = nullptr; mPlacement = Interval; mOffsetAlongLine = 0; mOffsetAlongLineUnit = QgsSymbolV2::MM; @@ -888,7 +888,7 @@ void QgsMarkerLineSymbolLayerV2::renderPolyline( const QPolygonF& points, QgsSym } else { - context.renderContext().setGeometry( 0 ); //always use segmented geometry with offset + context.renderContext().setGeometry( nullptr ); //always use segmented geometry with offset QList mline = ::offsetLine( points, QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), offset, mOffsetUnit, mOffsetMapUnitScale ), context.feature() ? context.feature()->constGeometry()->type() : QGis::Line ); for ( int part = 0; part < mline.count(); ++part ) @@ -1343,7 +1343,7 @@ QgsSymbolV2* QgsMarkerLineSymbolLayerV2::subSymbol() bool QgsMarkerLineSymbolLayerV2::setSubSymbol( QgsSymbolV2* symbol ) { - if ( symbol == NULL || symbol->type() != QgsSymbolV2::Marker ) + if ( symbol == nullptr || symbol->type() != QgsSymbolV2::Marker ) { delete symbol; return false; @@ -1454,11 +1454,11 @@ QgsSymbolLayerV2* QgsMarkerLineSymbolLayerV2::createFromSld( QDomElement &elemen QDomElement strokeElem = element.firstChildElement( "Stroke" ); if ( strokeElem.isNull() ) - return NULL; + return nullptr; QDomElement graphicStrokeElem = strokeElem.firstChildElement( "GraphicStroke" ); if ( graphicStrokeElem.isNull() ) - return NULL; + return nullptr; // retrieve vendor options bool rotateMarker = true; @@ -1480,7 +1480,7 @@ QgsSymbolLayerV2* QgsMarkerLineSymbolLayerV2::createFromSld( QDomElement &elemen } } - QgsMarkerSymbolV2 *marker = 0; + QgsMarkerSymbolV2 *marker = nullptr; QgsSymbolLayerV2 *l = QgsSymbolLayerV2Utils::createMarkerLayerFromSld( graphicStrokeElem ); if ( l ) @@ -1491,7 +1491,7 @@ QgsSymbolLayerV2* QgsMarkerLineSymbolLayerV2::createFromSld( QDomElement &elemen } if ( !marker ) - return NULL; + return nullptr; double interval = 0.0; QDomElement gapElem = graphicStrokeElem.firstChildElement( "Gap" ); diff --git a/src/core/symbology-ng/qgsmarkersymbollayerv2.cpp b/src/core/symbology-ng/qgsmarkersymbollayerv2.cpp index a38dad3b351..04971d60133 100644 --- a/src/core/symbology-ng/qgsmarkersymbollayerv2.cpp +++ b/src/core/symbology-ng/qgsmarkersymbollayerv2.cpp @@ -785,7 +785,7 @@ QgsSymbolLayerV2* QgsSimpleMarkerSymbolLayerV2::createFromSld( QDomElement &elem QDomElement graphicElem = element.firstChildElement( "Graphic" ); if ( graphicElem.isNull() ) - return NULL; + return nullptr; QString name = "square"; QColor color, borderColor; @@ -793,7 +793,7 @@ QgsSymbolLayerV2* QgsSimpleMarkerSymbolLayerV2::createFromSld( QDomElement &elem Qt::PenStyle borderStyle; if ( !QgsSymbolLayerV2Utils::wellKnownMarkerFromSld( graphicElem, name, color, borderColor, borderStyle, borderWidth, size ) ) - return NULL; + return nullptr; double angle = 0.0; QString angleFunc; @@ -1619,17 +1619,17 @@ QgsSymbolLayerV2* QgsSvgMarkerSymbolLayerV2::createFromSld( QDomElement &element QDomElement graphicElem = element.firstChildElement( "Graphic" ); if ( graphicElem.isNull() ) - return NULL; + return nullptr; QString path, mimeType; QColor fillColor; double size; if ( !QgsSymbolLayerV2Utils::externalGraphicFromSld( graphicElem, path, mimeType, fillColor, size ) ) - return NULL; + return nullptr; if ( mimeType != "image/svg+xml" ) - return NULL; + return nullptr; double angle = 0.0; QString angleFunc; @@ -1870,7 +1870,7 @@ QRectF QgsSvgMarkerSymbolLayerV2::bounds( const QPointF& point, QgsSymbolV2Rende ////////// QgsFontMarkerSymbolLayerV2::QgsFontMarkerSymbolLayerV2( const QString& fontFamily, QChar chr, double pointSize, const QColor& color, double angle ) - : mFontMetrics( 0 ) + : mFontMetrics( nullptr ) , mChrWidth( 0 ) { mFontFamily = fontFamily; @@ -2201,7 +2201,7 @@ QgsSymbolLayerV2* QgsFontMarkerSymbolLayerV2::createFromSld( QDomElement &elemen QDomElement graphicElem = element.firstChildElement( "Graphic" ); if ( graphicElem.isNull() ) - return NULL; + return nullptr; QString name, format; QColor color; @@ -2209,10 +2209,10 @@ QgsSymbolLayerV2* QgsFontMarkerSymbolLayerV2::createFromSld( QDomElement &elemen int chr; if ( !QgsSymbolLayerV2Utils::externalMarkerFromSld( graphicElem, name, format, chr, color, size ) ) - return NULL; + return nullptr; if ( !name.startsWith( "ttf://" ) || format != "ttf" ) - return NULL; + return nullptr; QString fontFamily = name.mid( 6 ); diff --git a/src/core/symbology-ng/qgspointdisplacementrenderer.cpp b/src/core/symbology-ng/qgspointdisplacementrenderer.cpp index 3b4f2b8c72b..648fda42559 100644 --- a/src/core/symbology-ng/qgspointdisplacementrenderer.cpp +++ b/src/core/symbology-ng/qgspointdisplacementrenderer.cpp @@ -49,7 +49,7 @@ QgsPointDisplacementRenderer::QgsPointDisplacementRenderer( const QString& label , mCircleColor( QColor( 125, 125, 125 ) ) , mCircleRadiusAddition( 0 ) , mMaxLabelScaleDenominator( -1 ) - , mSpatialIndex( NULL ) + , mSpatialIndex( nullptr ) { mRenderer = QgsFeatureRendererV2::defaultRenderer( QGis::Point ); mCenterSymbol = new QgsMarkerSymbolV2(); //the symbol for the center of a displacement group @@ -255,7 +255,7 @@ QgsSymbolV2* QgsPointDisplacementRenderer::symbolForFeature( QgsFeature& feature { if ( !mRenderer ) { - return 0; + return nullptr; } return mRenderer->symbolForFeature( feature, context ); } @@ -263,7 +263,7 @@ QgsSymbolV2* QgsPointDisplacementRenderer::symbolForFeature( QgsFeature& feature QgsSymbolV2* QgsPointDisplacementRenderer::originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context ) { if ( !mRenderer ) - return 0; + return nullptr; return mRenderer->originalSymbolForFeature( feat, context ); } @@ -339,7 +339,7 @@ void QgsPointDisplacementRenderer::stopRender( QgsRenderContext& context ) mDisplacementGroups.clear(); mGroupIndex.clear(); delete mSpatialIndex; - mSpatialIndex = 0; + mSpatialIndex = nullptr; mSelectedFeatures.clear(); mRenderer->stopRender( context ); @@ -632,13 +632,13 @@ QgsSymbolV2* QgsPointDisplacementRenderer::firstSymbolForFeature( QgsFeatureRend { if ( !r ) { - return 0; + return nullptr; } QgsSymbolV2List symbolList = r->symbolsForFeature( f, context ); if ( symbolList.size() < 1 ) { - return 0; + return nullptr; } return symbolList.at( 0 ); @@ -660,5 +660,5 @@ QgsPointDisplacementRenderer* QgsPointDisplacementRenderer::convertFromRenderer( pointRenderer->setEmbeddedRenderer( renderer->clone() ); return pointRenderer; } - return 0; + return nullptr; } diff --git a/src/core/symbology-ng/qgsrendererv2.cpp b/src/core/symbology-ng/qgsrendererv2.cpp index d43e116ca25..1130c4e010e 100644 --- a/src/core/symbology-ng/qgsrendererv2.cpp +++ b/src/core/symbology-ng/qgsrendererv2.cpp @@ -216,7 +216,7 @@ QgsFeatureRendererV2::QgsFeatureRendererV2( const QString& type ) , mUsingSymbolLevels( false ) , mCurrentVertexMarkerType( QgsVectorLayer::Cross ) , mCurrentVertexMarkerSize( 3 ) - , mPaintEffect( 0 ) + , mPaintEffect( nullptr ) , mForceRaster( false ) { mPaintEffect = QgsPaintEffectRegistry::defaultStack(); @@ -269,7 +269,7 @@ void QgsFeatureRendererV2::startRender( QgsRenderContext& context, const QgsVect bool QgsFeatureRendererV2::renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer, bool selected, bool drawVertexMarker ) { QgsSymbolV2* symbol = symbolForFeature( feature, context ); - if ( symbol == NULL ) + if ( symbol == nullptr ) return false; renderFeatureWithSymbol( feature, symbol, context, layer, selected, drawVertexMarker ); @@ -308,14 +308,14 @@ QgsFeatureRendererV2* QgsFeatureRendererV2::load( QDomElement& element ) // ... if ( element.isNull() ) - return NULL; + return nullptr; // load renderer QString rendererType = element.attribute( "type" ); QgsRendererV2AbstractMetadata* m = QgsRendererV2Registry::instance()->rendererMetadata( rendererType ); - if ( m == NULL ) - return NULL; + if ( m == nullptr ) + return nullptr; QgsFeatureRendererV2* r = m->createRenderer( element ); if ( r ) @@ -349,7 +349,7 @@ QgsFeatureRendererV2* QgsFeatureRendererV2::loadSld( const QDomNode &node, QGis: { QDomElement element = node.toElement(); if ( element.isNull() ) - return NULL; + return nullptr; // get the UserStyle element QDomElement userStyleElem = element.firstChildElement( "UserStyle" ); @@ -357,7 +357,7 @@ QgsFeatureRendererV2* QgsFeatureRendererV2::loadSld( const QDomNode &node, QGis: { // UserStyle element not found, nothing will be rendered errorMessage = "Info: UserStyle element not found."; - return NULL; + return nullptr; } // get the FeatureTypeStyle element @@ -365,7 +365,7 @@ QgsFeatureRendererV2* QgsFeatureRendererV2::loadSld( const QDomNode &node, QGis: if ( featTypeStyleElem.isNull() ) { errorMessage = "Info: FeatureTypeStyle element not found."; - return NULL; + return nullptr; } // use the RuleRenderer when more rules are present or the rule @@ -424,10 +424,10 @@ QgsFeatureRendererV2* QgsFeatureRendererV2::loadSld( const QDomNode &node, QGis: // create the renderer and return it QgsRendererV2AbstractMetadata* m = QgsRendererV2Registry::instance()->rendererMetadata( rendererType ); - if ( m == NULL ) + if ( m == nullptr ) { errorMessage = QString( "Error: Unable to get metadata for '%1' renderer." ).arg( rendererType ); - return NULL; + return nullptr; } QgsFeatureRendererV2* r = m->createRendererFromSld( featTypeStyleElem, geomType ); @@ -512,13 +512,13 @@ void QgsFeatureRendererV2::setVertexMarkerAppearance( int type, int size ) bool QgsFeatureRendererV2::willRenderFeature( QgsFeature &feat ) { Q_NOWARN_DEPRECATED_PUSH - return symbolForFeature( feat ) != NULL; + return symbolForFeature( feat ) != nullptr; Q_NOWARN_DEPRECATED_POP } bool QgsFeatureRendererV2::willRenderFeature( QgsFeature &feat, QgsRenderContext &context ) { - return symbolForFeature( feat, context ) != NULL; + return symbolForFeature( feat, context ) != nullptr; } void QgsFeatureRendererV2::renderVertexMarker( const QPointF &pt, QgsRenderContext& context ) diff --git a/src/core/symbology-ng/qgsrendererv2registry.cpp b/src/core/symbology-ng/qgsrendererv2registry.cpp index ef4f83eacd4..d5c1ba4ea04 100644 --- a/src/core/symbology-ng/qgsrendererv2registry.cpp +++ b/src/core/symbology-ng/qgsrendererv2registry.cpp @@ -75,7 +75,7 @@ QgsRendererV2Registry* QgsRendererV2Registry::instance() bool QgsRendererV2Registry::addRenderer( QgsRendererV2AbstractMetadata* metadata ) { - if ( metadata == NULL || mRenderers.contains( metadata->name() ) ) + if ( metadata == nullptr || mRenderers.contains( metadata->name() ) ) return false; mRenderers[metadata->name()] = metadata; diff --git a/src/core/symbology-ng/qgsrendererv2registry.h b/src/core/symbology-ng/qgsrendererv2registry.h index 59bbe7f59ee..2495b793746 100644 --- a/src/core/symbology-ng/qgsrendererv2registry.h +++ b/src/core/symbology-ng/qgsrendererv2registry.h @@ -51,10 +51,10 @@ class CORE_EXPORT QgsRendererV2AbstractMetadata virtual QgsFeatureRendererV2* createRenderer( QDomElement& elem ) = 0; /** Return new instance of settings widget for the renderer. Returns NULL on error. */ virtual QgsRendererV2Widget* createRendererWidget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) - { Q_UNUSED( layer ); Q_UNUSED( style ); Q_UNUSED( renderer ); return NULL; } + { Q_UNUSED( layer ); Q_UNUSED( style ); Q_UNUSED( renderer ); return nullptr; } virtual QgsFeatureRendererV2* createRendererFromSld( QDomElement& elem, QGis::GeometryType geomType ) - { Q_UNUSED( elem ); Q_UNUSED( geomType ); return NULL; } + { Q_UNUSED( elem ); Q_UNUSED( geomType ); return nullptr; } protected: //! name used within QGIS for identification (the same what renderer's type() returns) @@ -83,11 +83,11 @@ class CORE_EXPORT QgsRendererV2Metadata : public QgsRendererV2AbstractMetadata const QString& visibleName, QgsRendererV2CreateFunc pfCreate, const QIcon& icon = QIcon(), - QgsRendererV2WidgetFunc pfWidget = NULL ) + QgsRendererV2WidgetFunc pfWidget = nullptr ) : QgsRendererV2AbstractMetadata( name, visibleName, icon ) , mCreateFunc( pfCreate ) , mWidgetFunc( pfWidget ) - , mCreateFromSldFunc( NULL ) + , mCreateFromSldFunc( nullptr ) {} //! @note not available in python bindings @@ -96,7 +96,7 @@ class CORE_EXPORT QgsRendererV2Metadata : public QgsRendererV2AbstractMetadata QgsRendererV2CreateFunc pfCreate, QgsRendererV2CreateFromSldFunc pfCreateFromSld, const QIcon& icon = QIcon(), - QgsRendererV2WidgetFunc pfWidget = NULL ) + QgsRendererV2WidgetFunc pfWidget = nullptr ) : QgsRendererV2AbstractMetadata( name, visibleName, icon ) , mCreateFunc( pfCreate ) , mWidgetFunc( pfWidget ) @@ -105,11 +105,11 @@ class CORE_EXPORT QgsRendererV2Metadata : public QgsRendererV2AbstractMetadata virtual ~QgsRendererV2Metadata(); - virtual QgsFeatureRendererV2* createRenderer( QDomElement& elem ) override { return mCreateFunc ? mCreateFunc( elem ) : NULL; } + virtual QgsFeatureRendererV2* createRenderer( QDomElement& elem ) override { return mCreateFunc ? mCreateFunc( elem ) : nullptr; } virtual QgsRendererV2Widget* createRendererWidget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) override - { return mWidgetFunc ? mWidgetFunc( layer, style, renderer ) : NULL; } + { return mWidgetFunc ? mWidgetFunc( layer, style, renderer ) : nullptr; } virtual QgsFeatureRendererV2* createRendererFromSld( QDomElement& elem, QGis::GeometryType geomType ) override - { return mCreateFromSldFunc ? mCreateFromSldFunc( elem, geomType ) : NULL; } + { return mCreateFromSldFunc ? mCreateFromSldFunc( elem, geomType ) : nullptr; } //! @note not available in python bindings QgsRendererV2CreateFunc createFunction() const { return mCreateFunc; } diff --git a/src/core/symbology-ng/qgsrulebasedrendererv2.cpp b/src/core/symbology-ng/qgsrulebasedrendererv2.cpp index a82c38f438f..9db000eb470 100644 --- a/src/core/symbology-ng/qgsrulebasedrendererv2.cpp +++ b/src/core/symbology-ng/qgsrulebasedrendererv2.cpp @@ -36,12 +36,12 @@ QgsRuleBasedRendererV2::Rule::Rule( QgsSymbolV2* symbol, int scaleMinDenom, int scaleMaxDenom, const QString& filterExp, const QString& label, const QString& description, bool elseRule ) - : mParent( NULL ), mSymbol( symbol ) + : mParent( nullptr ), mSymbol( symbol ) , mScaleMinDenom( scaleMinDenom ), mScaleMaxDenom( scaleMaxDenom ) , mFilterExp( filterExp ), mLabel( label ), mDescription( description ) , mElseRule( elseRule ) , mIsActive( true ) - , mFilter( NULL ) + , mFilter( nullptr ) { mRuleKey = QUuid::createUuid().toString(); initFilter(); @@ -60,7 +60,7 @@ void QgsRuleBasedRendererV2::Rule::initFilter() if ( mElseRule || mFilterExp.compare( "ELSE", Qt::CaseInsensitive ) == 0 ) { mElseRule = true; - mFilter = NULL; + mFilter = nullptr; } else if ( !mFilterExp.isEmpty() ) { @@ -69,7 +69,7 @@ void QgsRuleBasedRendererV2::Rule::initFilter() } else { - mFilter = NULL; + mFilter = nullptr; } } @@ -105,14 +105,14 @@ void QgsRuleBasedRendererV2::Rule::removeChildAt( int i ) void QgsRuleBasedRendererV2::Rule::takeChild( Rule* rule ) { mChildren.removeAll( rule ); - rule->mParent = NULL; + rule->mParent = nullptr; updateElseRules(); } QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2::Rule::takeChildAt( int i ) { Rule* rule = mChildren.takeAt( i ); - rule->mParent = NULL; + rule->mParent = nullptr; return rule; // updateElseRules(); } @@ -130,7 +130,7 @@ QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2::Rule::findRuleByKey( const if ( r ) return r; } - return 0; + return nullptr; } void QgsRuleBasedRendererV2::Rule::updateElseRules() @@ -259,7 +259,7 @@ bool QgsRuleBasedRendererV2::Rule::isScaleOK( double scale ) const QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2::Rule::clone() const { - QgsSymbolV2* sym = mSymbol ? mSymbol->clone() : NULL; + QgsSymbolV2* sym = mSymbol ? mSymbol->clone() : nullptr; Rule* newrule = new Rule( sym, mScaleMinDenom, mScaleMaxDenom, mFilterExp, mLabel, mDescription ); newrule->setActive( mIsActive ); // clone children @@ -628,7 +628,7 @@ void QgsRuleBasedRendererV2::Rule::stopRender( QgsRenderContext& context ) QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2::Rule::create( QDomElement& ruleElem, QgsSymbolV2Map& symbolMap ) { QString symbolIdx = ruleElem.attribute( "symbol" ); - QgsSymbolV2* symbol = NULL; + QgsSymbolV2* symbol = nullptr; if ( !symbolIdx.isEmpty() ) { if ( symbolMap.contains( symbolIdx ) ) @@ -677,7 +677,7 @@ QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2::Rule::createFromSld( QDomE if ( ruleElem.localName() != "Rule" ) { QgsDebugMsg( QString( "invalid element: Rule element expected, %1 found!" ).arg( ruleElem.tagName() ) ); - return NULL; + return nullptr; } QString label, description, filterExp; @@ -760,7 +760,7 @@ QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2::Rule::createFromSld( QDomE } // now create the symbol - QgsSymbolV2 *symbol = 0; + QgsSymbolV2 *symbol = nullptr; if ( !layers.isEmpty() ) { switch ( geomType ) @@ -779,7 +779,7 @@ QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2::Rule::createFromSld( QDomE default: QgsDebugMsg( QString( "invalid geometry type: found %1" ).arg( geomType ) ); - return NULL; + return nullptr; } } @@ -798,7 +798,7 @@ QgsRuleBasedRendererV2::QgsRuleBasedRendererV2( QgsRuleBasedRendererV2::Rule* ro QgsRuleBasedRendererV2::QgsRuleBasedRendererV2( QgsSymbolV2* defaultSymbol ) : QgsFeatureRendererV2( "RuleRenderer" ) { - mRootRule = new Rule( NULL ); // root has no symbol, no filter etc - just a container + mRootRule = new Rule( nullptr ); // root has no symbol, no filter etc - just a container mRootRule->appendChild( new Rule( defaultSymbol ) ); } @@ -811,7 +811,7 @@ QgsRuleBasedRendererV2::~QgsRuleBasedRendererV2() QgsSymbolV2* QgsRuleBasedRendererV2::symbolForFeature( QgsFeature& , QgsRenderContext& ) { // not used at all - return 0; + return nullptr; } bool QgsRuleBasedRendererV2::renderFeature( QgsFeature& feature, @@ -1015,15 +1015,15 @@ QgsFeatureRendererV2* QgsRuleBasedRendererV2::create( QDomElement& element ) // load symbols QDomElement symbolsElem = element.firstChildElement( "symbols" ); if ( symbolsElem.isNull() ) - return NULL; + return nullptr; QgsSymbolV2Map symbolMap = QgsSymbolLayerV2Utils::loadSymbols( symbolsElem ); QDomElement rulesElem = element.firstChildElement( "rules" ); Rule* root = Rule::create( rulesElem, symbolMap ); - if ( root == NULL ) - return NULL; + if ( root == nullptr ) + return nullptr; QgsRuleBasedRendererV2* r = new QgsRuleBasedRendererV2( root ); @@ -1036,7 +1036,7 @@ QgsFeatureRendererV2* QgsRuleBasedRendererV2::create( QDomElement& element ) QgsFeatureRendererV2* QgsRuleBasedRendererV2::createFromSld( QDomElement& element, QGis::GeometryType geomType ) { // retrieve child rules - Rule* root = 0; + Rule* root = nullptr; QDomElement ruleElem = element.firstChildElement( "Rule" ); while ( !ruleElem.isNull() ) @@ -1046,7 +1046,7 @@ QgsFeatureRendererV2* QgsRuleBasedRendererV2::createFromSld( QDomElement& elemen { // create the root rule if not done before if ( !root ) - root = new Rule( 0 ); + root = new Rule( nullptr ); root->appendChild( child ); } @@ -1057,7 +1057,7 @@ QgsFeatureRendererV2* QgsRuleBasedRendererV2::createFromSld( QDomElement& elemen if ( !root ) { // no valid rules was found - return NULL; + return nullptr; } // create and return the new renderer @@ -1180,7 +1180,7 @@ QgsRuleBasedRendererV2* QgsRuleBasedRendererV2::convertFromRenderer( const QgsFe { const QgsSingleSymbolRendererV2* singleSymbolRenderer = dynamic_cast( renderer ); if ( !singleSymbolRenderer ) - return 0; + return nullptr; QgsSymbolV2* origSymbol = singleSymbolRenderer->symbol()->clone(); convertToDataDefinedSymbology( origSymbol, singleSymbolRenderer->sizeScaleField() ); @@ -1191,9 +1191,9 @@ QgsRuleBasedRendererV2* QgsRuleBasedRendererV2::convertFromRenderer( const QgsFe { const QgsCategorizedSymbolRendererV2* categorizedRenderer = dynamic_cast( renderer ); if ( !categorizedRenderer ) - return 0; + return nullptr; - QgsRuleBasedRendererV2::Rule* rootrule = new QgsRuleBasedRendererV2::Rule( NULL ); + QgsRuleBasedRendererV2::Rule* rootrule = new QgsRuleBasedRendererV2::Rule( nullptr ); QString expression; QString value; @@ -1201,7 +1201,7 @@ QgsRuleBasedRendererV2* QgsRuleBasedRendererV2::convertFromRenderer( const QgsFe for ( int i = 0; i < categorizedRenderer->categories().size(); ++i ) { category = categorizedRenderer->categories().value( i ); - QgsRuleBasedRendererV2::Rule* rule = new QgsRuleBasedRendererV2::Rule( NULL ); + QgsRuleBasedRendererV2::Rule* rule = new QgsRuleBasedRendererV2::Rule( nullptr ); rule->setLabel( category.label() ); @@ -1246,16 +1246,16 @@ QgsRuleBasedRendererV2* QgsRuleBasedRendererV2::convertFromRenderer( const QgsFe const QgsGraduatedSymbolRendererV2* graduatedRenderer = dynamic_cast( renderer ); if ( !graduatedRenderer ) - return 0; + return nullptr; - QgsRuleBasedRendererV2::Rule* rootrule = new QgsRuleBasedRendererV2::Rule( NULL ); + QgsRuleBasedRendererV2::Rule* rootrule = new QgsRuleBasedRendererV2::Rule( nullptr ); QString expression; QgsRendererRangeV2 range; for ( int i = 0; i < graduatedRenderer->ranges().size();++i ) { range = graduatedRenderer->ranges().value( i ); - QgsRuleBasedRendererV2::Rule* rule = new QgsRuleBasedRendererV2::Rule( NULL ); + QgsRuleBasedRendererV2::Rule* rule = new QgsRuleBasedRendererV2::Rule( nullptr ); rule->setLabel( range.label() ); if ( i == 0 )//The lower boundary of the first range is included, while it is excluded for the others { @@ -1297,7 +1297,7 @@ QgsRuleBasedRendererV2* QgsRuleBasedRendererV2::convertFromRenderer( const QgsFe return convertFromRenderer( invertedPolygonRenderer->embeddedRenderer() ); } - return NULL; + return nullptr; } void QgsRuleBasedRendererV2::convertToDataDefinedSymbology( QgsSymbolV2* symbol, const QString& sizeScaleField, const QString& rotationField ) diff --git a/src/core/symbology-ng/qgsrulebasedrendererv2.h b/src/core/symbology-ng/qgsrulebasedrendererv2.h index f9540df45d1..0beb45dbfb5 100644 --- a/src/core/symbology-ng/qgsrulebasedrendererv2.h +++ b/src/core/symbology-ng/qgsrulebasedrendererv2.h @@ -126,7 +126,7 @@ class CORE_EXPORT QgsRuleBasedRendererV2 : public QgsFeatureRendererV2 * @param context The context in which the rendering happens * @return True if the feature shall be rendered */ - bool isFilterOK( QgsFeature& f, QgsRenderContext *context = 0 ) const; + bool isFilterOK( QgsFeature& f, QgsRenderContext *context = nullptr ) const; /** * Check if this rule applies for a given scale @@ -258,13 +258,13 @@ class CORE_EXPORT QgsRuleBasedRendererV2 : public QgsFeatureRendererV2 RenderResult renderFeature( FeatureToRender& featToRender, QgsRenderContext& context, RenderQueue& renderQueue ); //! only tell whether a feature will be rendered without actually rendering it - bool willRenderFeature( QgsFeature& feat, QgsRenderContext* context = 0 ); + bool willRenderFeature( QgsFeature& feat, QgsRenderContext* context = nullptr ); //! tell which symbols will be used to render the feature - QgsSymbolV2List symbolsForFeature( QgsFeature& feat, QgsRenderContext* context = 0 ); + QgsSymbolV2List symbolsForFeature( QgsFeature& feat, QgsRenderContext* context = nullptr ); //! tell which rules will be used to render the feature - RuleList rulesForFeature( QgsFeature& feat, QgsRenderContext* context = 0 ); + RuleList rulesForFeature( QgsFeature& feat, QgsRenderContext* context = nullptr ); /** * Stop a rendering process. Used to clean up the internal state of this rule diff --git a/src/core/symbology-ng/qgssinglesymbolrendererv2.cpp b/src/core/symbology-ng/qgssinglesymbolrendererv2.cpp index 078af84759b..0915c4e0219 100644 --- a/src/core/symbology-ng/qgssinglesymbolrendererv2.cpp +++ b/src/core/symbology-ng/qgssinglesymbolrendererv2.cpp @@ -237,12 +237,12 @@ QgsFeatureRendererV2* QgsSingleSymbolRendererV2::create( QDomElement& element ) { QDomElement symbolsElem = element.firstChildElement( "symbols" ); if ( symbolsElem.isNull() ) - return NULL; + return nullptr; QgsSymbolV2Map symbolMap = QgsSymbolLayerV2Utils::loadSymbols( symbolsElem ); if ( !symbolMap.contains( "0" ) ) - return NULL; + return nullptr; QgsSingleSymbolRendererV2* r = new QgsSingleSymbolRendererV2( symbolMap.take( "0" ) ); @@ -276,7 +276,7 @@ QgsFeatureRendererV2* QgsSingleSymbolRendererV2::createFromSld( QDomElement& ele if ( ruleElem.isNull() ) { QgsDebugMsg( "no Rule elements found!" ); - return NULL; + return nullptr; } QString label, description; @@ -328,7 +328,7 @@ QgsFeatureRendererV2* QgsSingleSymbolRendererV2::createFromSld( QDomElement& ele } if ( layers.isEmpty() ) - return NULL; + return nullptr; // now create the symbol QgsSymbolV2 *symbol; @@ -348,7 +348,7 @@ QgsFeatureRendererV2* QgsSingleSymbolRendererV2::createFromSld( QDomElement& ele default: QgsDebugMsg( QString( "invalid geometry type: found %1" ).arg( geomType ) ); - return NULL; + return nullptr; } // and finally return the new renderer @@ -416,11 +416,11 @@ QgsLegendSymbolListV2 QgsSingleSymbolRendererV2::legendSymbolItemsV2() const QgsScaleExpression scaleExp( sizeDD.expressionString() ); if ( scaleExp.type() != QgsScaleExpression::Unknown ) { - QgsLegendSymbolItemV2 title( NULL, scaleExp.baseExpression(), 0 ); + QgsLegendSymbolItemV2 title( nullptr, scaleExp.baseExpression(), nullptr ); lst << title; Q_FOREACH ( double v, QgsSymbolLayerV2Utils::prettyBreaks( scaleExp.minValue(), scaleExp.maxValue(), 4 ) ) { - QgsLegendSymbolItemV2 si( mSymbol.data(), QString::number( v ), 0 ); + QgsLegendSymbolItemV2 si( mSymbol.data(), QString::number( v ), nullptr ); QgsMarkerSymbolV2 * s = static_cast( si.symbol() ); s->setDataDefinedSize( 0 ); s->setSize( scaleExp.size( v ) ); @@ -431,7 +431,7 @@ QgsLegendSymbolListV2 QgsSingleSymbolRendererV2::legendSymbolItemsV2() const } } - lst << QgsLegendSymbolItemV2( mSymbol.data(), QString(), 0 ); + lst << QgsLegendSymbolItemV2( mSymbol.data(), QString(), nullptr ); return lst; } @@ -460,5 +460,5 @@ QgsSingleSymbolRendererV2* QgsSingleSymbolRendererV2::convertFromRenderer( const { return new QgsSingleSymbolRendererV2( symbols.at( 0 )->clone() ); } - return 0; + return nullptr; } diff --git a/src/core/symbology-ng/qgsstylev2.cpp b/src/core/symbology-ng/qgsstylev2.cpp index a4510ed78ea..f3d743da93b 100644 --- a/src/core/symbology-ng/qgsstylev2.cpp +++ b/src/core/symbology-ng/qgsstylev2.cpp @@ -35,12 +35,12 @@ #define STYLE_CURRENT_VERSION "1" -QgsStyleV2 *QgsStyleV2::mDefaultStyle = 0; +QgsStyleV2 *QgsStyleV2::mDefaultStyle = nullptr; QgsStyleV2::QgsStyleV2() : QObject() { - mCurrentDB = 0; + mCurrentDB = nullptr; } QgsStyleV2::~QgsStyleV2() @@ -166,7 +166,7 @@ bool QgsStyleV2::removeSymbol( const QString& name ) QgsSymbolV2* QgsStyleV2::symbol( const QString& name ) { const QgsSymbolV2 *symbol = symbolRef( name ); - return symbol ? symbol->clone() : 0; + return symbol ? symbol->clone() : nullptr; } const QgsSymbolV2 *QgsStyleV2::symbolRef( const QString& name ) const @@ -260,7 +260,7 @@ bool QgsStyleV2::removeColorRamp( const QString& name ) QgsVectorColorRampV2* QgsStyleV2::colorRamp( const QString& name ) { const QgsVectorColorRampV2 *ramp = colorRampRef( name ); - return ramp ? ramp->clone() : 0; + return ramp ? ramp->clone() : nullptr; } const QgsVectorColorRampV2* QgsStyleV2::colorRampRef( const QString& name ) const @@ -313,7 +313,7 @@ bool QgsStyleV2::load( const QString& filename ) query = sqlite3_mprintf( "SELECT * FROM symbol" ); sqlite3_stmt *ppStmt; - int nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); while ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) { QDomDocument doc; @@ -327,14 +327,14 @@ bool QgsStyleV2::load( const QString& filename ) QDomElement symElement = doc.documentElement(); QgsSymbolV2 *symbol = QgsSymbolLayerV2Utils::loadSymbol( symElement ); - if ( symbol != NULL ) + if ( symbol != nullptr ) mSymbols.insert( symbol_name, symbol ); } sqlite3_finalize( ppStmt ); query = sqlite3_mprintf( "SELECT * FROM colorramp" ); - nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); while ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) { QDomDocument doc; @@ -452,7 +452,7 @@ bool QgsStyleV2::renameColorRamp( const QString& oldName, const QString& newName int rampid = 0; sqlite3_stmt *ppStmt; char *query = sqlite3_mprintf( "SELECT id FROM colorramp WHERE name='%q'", oldName.toUtf8().constData() ); - int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); if ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) { rampid = sqlite3_column_int( ppStmt, 0 ); @@ -468,7 +468,7 @@ QStringList QgsStyleV2::groupNames() QStringList groupNames; sqlite3_stmt *ppStmt; const char *query = "SELECT * FROM symgroup"; - int nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); while ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) { groupNames << QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, SymgroupName ) ); @@ -486,7 +486,7 @@ QgsSymbolGroupMap QgsStyleV2::childGroupNames( const QString& parent ) return QgsSymbolGroupMap(); } - char *query = 0; + char *query = nullptr; int nError; sqlite3_stmt *ppStmt; @@ -498,7 +498,7 @@ QgsSymbolGroupMap QgsStyleV2::childGroupNames( const QString& parent ) else { char *subquery = sqlite3_mprintf( "SELECT * FROM symgroup WHERE name='%q'", parent.toUtf8().constData() ); - nError = sqlite3_prepare_v2( mCurrentDB, subquery, -1, &ppStmt, NULL ); + nError = sqlite3_prepare_v2( mCurrentDB, subquery, -1, &ppStmt, nullptr ); if ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) { query = sqlite3_mprintf( "SELECT * FROM symgroup WHERE parent=%d", sqlite3_column_int( ppStmt, SymgroupId ) ); @@ -512,7 +512,7 @@ QgsSymbolGroupMap QgsStyleV2::childGroupNames( const QString& parent ) QgsSymbolGroupMap groupNames; // Now run the query and retrieve the group names - nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); while ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) { QString group = QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, SymgroupName ) ); @@ -548,7 +548,7 @@ QStringList QgsStyleV2::symbolsOfGroup( StyleEntity type, int groupid ) } sqlite3_stmt *ppStmt; - int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); QStringList symbols; while ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) @@ -585,7 +585,7 @@ QStringList QgsStyleV2::symbolsWithTag( StyleEntity type, int tagid ) } sqlite3_stmt *ppStmt; - int nErr = sqlite3_prepare_v2( mCurrentDB, subquery, -1, &ppStmt, NULL ); + int nErr = sqlite3_prepare_v2( mCurrentDB, subquery, -1, &ppStmt, nullptr ); // get the symbol <-> tag connection from table 'tagmap' QStringList symbols; @@ -598,7 +598,7 @@ QStringList QgsStyleV2::symbolsWithTag( StyleEntity type, int tagid ) : sqlite3_mprintf( "SELECT name FROM colorramp WHERE id=%d", symbolId ); sqlite3_stmt *ppStmt2; - int sErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt2, NULL ); + int sErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt2, nullptr ); while ( sErr == SQLITE_OK && sqlite3_step( ppStmt2 ) == SQLITE_ROW ) { symbols << QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt2, 0 ) ); @@ -618,7 +618,7 @@ int QgsStyleV2::addGroup( const QString& groupName, int parentid ) char *query = sqlite3_mprintf( "INSERT INTO symgroup VALUES (NULL, '%q', %d)", groupName.toUtf8().constData(), parentid ); sqlite3_stmt *ppStmt; - int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); if ( nErr == SQLITE_OK ) ( void )sqlite3_step( ppStmt ); @@ -634,7 +634,7 @@ int QgsStyleV2::addTag( const QString& tagname ) sqlite3_stmt *ppStmt; char *query = sqlite3_mprintf( "INSERT INTO tag VALUES (NULL, '%q')", tagname.toUtf8().constData() ); - int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); if ( nErr == SQLITE_OK ) ( void )sqlite3_step( ppStmt ); sqlite3_finalize( ppStmt ); @@ -675,7 +675,7 @@ char* QgsStyleV2::getGroupRemoveQuery( int id ) char *query = sqlite3_mprintf( "SELECT parent FROM symgroup WHERE id=%d", id ); sqlite3_stmt *ppStmt; - int err = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int err = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); int parentid = 0; if ( err == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) @@ -724,8 +724,8 @@ bool QgsStyleV2::runEmptyQuery( char *query, bool freeQuery ) if ( !mCurrentDB ) return false; - char *zErr = 0; - int nErr = sqlite3_exec( mCurrentDB, query, NULL, NULL, &zErr ); + char *zErr = nullptr; + int nErr = sqlite3_exec( mCurrentDB, query, nullptr, nullptr, &zErr ); if ( freeQuery ) { @@ -774,7 +774,7 @@ QStringList QgsStyleV2::findSymbols( StyleEntity type, const QString& qword ) item.toUtf8().constData(), qword.toUtf8().constData() ); sqlite3_stmt *ppStmt; - int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); QStringList symbols; while ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) @@ -809,7 +809,7 @@ bool QgsStyleV2::tagSymbol( StyleEntity type, const QString& symbol, const QStri char *query = sqlite3_mprintf( "SELECT id FROM tag WHERE name='%q'", tag.toUtf8().constData() ); sqlite3_stmt *ppStmt; - int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); int tagid; if ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) @@ -828,8 +828,8 @@ bool QgsStyleV2::tagSymbol( StyleEntity type, const QString& symbol, const QStri ? sqlite3_mprintf( "INSERT INTO tagmap VALUES (%d,%d)", tagid, symbolid ) : sqlite3_mprintf( "INSERT INTO ctagmap VALUES (%d,%d)", tagid, symbolid ); - char *zErr = 0; - nErr = sqlite3_exec( mCurrentDB, query, NULL, NULL, &zErr ); + char *zErr = nullptr; + nErr = sqlite3_exec( mCurrentDB, query, nullptr, nullptr, &zErr ); if ( nErr ) { QgsDebugMsg( zErr ); @@ -851,7 +851,7 @@ bool QgsStyleV2::detagSymbol( StyleEntity type, const QString& symbol, const QSt ? sqlite3_mprintf( "SELECT id FROM symbol WHERE name='%q'", symbol.toUtf8().constData() ) : sqlite3_mprintf( "SELECT id FROM colorramp WHERE name='%q'", symbol.toUtf8().constData() ); sqlite3_stmt *ppStmt; - int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); int symbolid = 0; if ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) @@ -866,7 +866,7 @@ bool QgsStyleV2::detagSymbol( StyleEntity type, const QString& symbol, const QSt query = sqlite3_mprintf( "SELECT id FROM tag WHERE name='%q'", tag.toUtf8().constData() ); sqlite3_stmt *ppStmt2; - nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt2, NULL ); + nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt2, nullptr ); int tagid = 0; if ( nErr == SQLITE_OK && sqlite3_step( ppStmt2 ) == SQLITE_ROW ) @@ -910,7 +910,7 @@ QStringList QgsStyleV2::tagsOfSymbol( StyleEntity type, const QString& symbol ) : sqlite3_mprintf( "SELECT tag_id FROM ctagmap WHERE colorramp_id=%d", symbolid ); sqlite3_stmt *ppStmt; - int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); QStringList tagList; while ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) @@ -918,7 +918,7 @@ QStringList QgsStyleV2::tagsOfSymbol( StyleEntity type, const QString& symbol ) char *subquery = sqlite3_mprintf( "SELECT name FROM tag WHERE id=%d", sqlite3_column_int( ppStmt, 0 ) ); sqlite3_stmt *ppStmt2; - int pErr = sqlite3_prepare_v2( mCurrentDB, subquery, -1, &ppStmt2, NULL ); + int pErr = sqlite3_prepare_v2( mCurrentDB, subquery, -1, &ppStmt2, nullptr ); if ( pErr == SQLITE_OK && sqlite3_step( ppStmt2 ) == SQLITE_ROW ) { tagList << QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt2, 0 ) ); @@ -936,7 +936,7 @@ int QgsStyleV2::getId( const QString& table, const QString& name ) char *query = sqlite3_mprintf( "SELECT id FROM %q WHERE name='%q'", table.toUtf8().constData(), name.toUtf8().constData() ); sqlite3_stmt *ppStmt; - int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); int id = 0; if ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) @@ -1026,7 +1026,7 @@ QgsSymbolGroupMap QgsStyleV2::smartgroupsListMap() // Now run the query and retrieve the group names sqlite3_stmt *ppStmt; - int nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); QgsSymbolGroupMap groupNames; while ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) @@ -1052,7 +1052,7 @@ QStringList QgsStyleV2::smartgroupNames() // Now run the query and retrieve the group names sqlite3_stmt *ppStmt; - int nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); QStringList groups; while ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) @@ -1072,7 +1072,7 @@ QStringList QgsStyleV2::symbolsOfSmartgroup( StyleEntity type, int id ) char *query = sqlite3_mprintf( "SELECT xml FROM smartgroup WHERE id=%d", id ); sqlite3_stmt *ppStmt; - int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); if ( !( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) ) { sqlite3_finalize( ppStmt ); @@ -1192,7 +1192,7 @@ QgsSmartConditionMap QgsStyleV2::smartgroup( int id ) char *query = sqlite3_mprintf( "SELECT xml FROM smartgroup WHERE id=%d", id ); sqlite3_stmt *ppStmt; - int nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); if ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) { QDomDocument doc; @@ -1234,7 +1234,7 @@ QString QgsStyleV2::smartgroupOperator( int id ) char *query = sqlite3_mprintf( "SELECT xml FROM smartgroup WHERE id=%d", id ); sqlite3_stmt *ppStmt; - int nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL ); + int nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr ); if ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW ) { QDomDocument doc; diff --git a/src/core/symbology-ng/qgssvgcache.cpp b/src/core/symbology-ng/qgssvgcache.cpp index f12ee0caff3..d954643e30a 100644 --- a/src/core/symbology-ng/qgssvgcache.cpp +++ b/src/core/symbology-ng/qgssvgcache.cpp @@ -44,10 +44,10 @@ QgsSvgCacheEntry::QgsSvgCacheEntry() , rasterScaleFactor( 1.0 ) , fill( Qt::black ) , outline( Qt::black ) - , image( 0 ) - , picture( 0 ) - , nextEntry( 0 ) - , previousEntry( 0 ) + , image( nullptr ) + , picture( nullptr ) + , nextEntry( nullptr ) + , previousEntry( nullptr ) { } @@ -60,10 +60,10 @@ QgsSvgCacheEntry::QgsSvgCacheEntry( const QString& f, double s, double ow, doubl , rasterScaleFactor( rsf ) , fill( fi ) , outline( ou ) - , image( 0 ) - , picture( 0 ) - , nextEntry( 0 ) - , previousEntry( 0 ) + , image( nullptr ) + , picture( nullptr ) + , nextEntry( nullptr ) + , previousEntry( nullptr ) { } @@ -103,8 +103,8 @@ QgsSvgCache* QgsSvgCache::instance() QgsSvgCache::QgsSvgCache( QObject *parent ) : QObject( parent ) , mTotalSize( 0 ) - , mLeastRecentEntry( 0 ) - , mMostRecentEntry( 0 ) + , mLeastRecentEntry( nullptr ) + , mMostRecentEntry( nullptr ) { mMissingSvg = QString( "?" ).toAscii(); } @@ -145,7 +145,7 @@ const QImage& QgsSvgCache::svgAsImage( const QString& file, double size, const Q { fitsInCache = false; delete currentEntry->image; - currentEntry->image = 0; + currentEntry->image = nullptr; //currentEntry->image = new QImage( 0, 0 ); // instead cache picture @@ -218,13 +218,13 @@ QgsSvgCacheEntry* QgsSvgCache::insertSVG( const QString& file, double size, cons { mLeastRecentEntry = entry; mMostRecentEntry = entry; - entry->previousEntry = 0; - entry->nextEntry = 0; + entry->previousEntry = nullptr; + entry->nextEntry = nullptr; } else { entry->previousEntry = mMostRecentEntry; - entry->nextEntry = 0; + entry->nextEntry = nullptr; mMostRecentEntry->nextEntry = entry; mMostRecentEntry = entry; } @@ -428,7 +428,7 @@ QByteArray QgsSvgCache::getImageData( const QString &path ) const } // the url points to a remote resource, download it! - QNetworkReply *reply = 0; + QNetworkReply *reply = nullptr; // The following code blocks until the file is downloaded... // TODO: use signals to get reply finished notification, in this moment @@ -506,7 +506,7 @@ void QgsSvgCache::cacheImage( QgsSvgCacheEntry* entry ) } delete entry->image; - entry->image = 0; + entry->image = nullptr; QSvgRenderer r( entry->svgContent ); double hwRatio = 1.0; @@ -556,7 +556,7 @@ void QgsSvgCache::cachePicture( QgsSvgCacheEntry *entry, bool forceVectorOutput } delete entry->picture; - entry->picture = 0; + entry->picture = nullptr; //correct QPictures dpi correction QPicture* picture = new QPicture(); @@ -584,7 +584,7 @@ QgsSvgCacheEntry* QgsSvgCache::cacheEntry( const QString& file, double size, con double widthScaleFactor, double rasterScaleFactor ) { //search entries in mEntryLookup - QgsSvgCacheEntry* currentEntry = 0; + QgsSvgCacheEntry* currentEntry = nullptr; QList entries = mEntryLookup.values( file ); QList::iterator entryIt = entries.begin(); @@ -617,7 +617,7 @@ QgsSvgCacheEntry* QgsSvgCache::cacheEntry( const QString& file, double size, con { mMostRecentEntry->nextEntry = currentEntry; currentEntry->previousEntry = mMostRecentEntry; - currentEntry->nextEntry = 0; + currentEntry->nextEntry = nullptr; mMostRecentEntry = currentEntry; } } diff --git a/src/core/symbology-ng/qgssvgcache.h b/src/core/symbology-ng/qgssvgcache.h index c2cbb160b37..1a745de2355 100644 --- a/src/core/symbology-ng/qgssvgcache.h +++ b/src/core/symbology-ng/qgssvgcache.h @@ -197,7 +197,7 @@ class CORE_EXPORT QgsSvgCache : public QObject protected: //! protected constructor - QgsSvgCache( QObject * parent = 0 ); + QgsSvgCache( QObject * parent = nullptr ); /** Creates new cache entry and returns pointer to it * @param file Absolute or relative path to SVG file. If the path is relative the file is searched by QgsSymbolLayerV2Utils::symbolNameToPath() in SVG paths. diff --git a/src/core/symbology-ng/qgssymbollayerv2.cpp b/src/core/symbology-ng/qgssymbollayerv2.cpp index b17291e2b53..5554d73ecae 100644 --- a/src/core/symbology-ng/qgssymbollayerv2.cpp +++ b/src/core/symbology-ng/qgssymbollayerv2.cpp @@ -100,20 +100,20 @@ const QgsExpression* QgsSymbolLayerV2::dataDefinedProperty( const QString& prope QgsDataDefined *QgsSymbolLayerV2::getDataDefinedProperty( const QString &property ) const { if ( mDataDefinedProperties.isEmpty() ) - return 0; + return nullptr; QMap< QString, QgsDataDefined* >::const_iterator it = mDataDefinedProperties.find( property ); if ( it != mDataDefinedProperties.constEnd() ) { return it.value(); } - return 0; + return nullptr; } QgsExpression* QgsSymbolLayerV2::expression( const QString& property ) const { QgsDataDefined* dd = getDataDefinedProperty( property ); - return dd ? dd->expression() : 0; + return dd ? dd->expression() : nullptr; } QString QgsSymbolLayerV2::dataDefinedPropertyString( const QString& property ) const @@ -333,7 +333,7 @@ QgsSymbolLayerV2::QgsSymbolLayerV2( QgsSymbolV2::SymbolType type, bool locked ) : mType( type ) , mLocked( locked ) , mRenderingPass( 0 ) - , mPaintEffect( 0 ) + , mPaintEffect( nullptr ) { mPaintEffect = QgsPaintEffectRegistry::defaultStack(); mPaintEffect->setEnabled( false ); @@ -721,7 +721,7 @@ void QgsFillSymbolLayerV2::drawPreviewIcon( QgsSymbolV2RenderContext& context, Q { QPolygonF poly = QRectF( QPointF( 0, 0 ), QPointF( size.width(), size.height() ) ); startRender( context ); - renderPolygon( poly, NULL, context ); + renderPolygon( poly, nullptr, context ); stopRender( context ); } diff --git a/src/core/symbology-ng/qgssymbollayerv2.h b/src/core/symbology-ng/qgssymbollayerv2.h index ecbbc6ebe22..74ada4564e7 100644 --- a/src/core/symbology-ng/qgssymbollayerv2.h +++ b/src/core/symbology-ng/qgssymbollayerv2.h @@ -103,7 +103,7 @@ class CORE_EXPORT QgsSymbolLayerV2 virtual void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ) = 0; - virtual QgsSymbolV2* subSymbol() { return 0; } + virtual QgsSymbolV2* subSymbol() { return nullptr; } //! set layer's subsymbol. takes ownership of the passed symbol virtual bool setSubSymbol( QgsSymbolV2* symbol ) { delete symbol; return false; } @@ -220,7 +220,7 @@ class CORE_EXPORT QgsSymbolLayerV2 * @note added in QGIS 2.9 * @deprecated use variant which takes QgsSymbolV2RenderContext instead */ - Q_DECL_DEPRECATED virtual QVariant evaluateDataDefinedProperty( const QString& property, const QgsFeature* feature, const QVariant& defaultVal = QVariant(), bool *ok = 0 ) const; + Q_DECL_DEPRECATED virtual QVariant evaluateDataDefinedProperty( const QString& property, const QgsFeature* feature, const QVariant& defaultVal = QVariant(), bool *ok = nullptr ) const; /** Evaluates the matching data defined property and returns the calculated * value. Prior to evaluation the data defined property must be prepared @@ -235,7 +235,7 @@ class CORE_EXPORT QgsSymbolLayerV2 * @see getDataDefinedProperty * @note added in QGIS 2.12 */ - virtual QVariant evaluateDataDefinedProperty( const QString& property, const QgsSymbolV2RenderContext& context, const QVariant& defaultVal = QVariant(), bool *ok = 0 ) const; + virtual QVariant evaluateDataDefinedProperty( const QString& property, const QgsSymbolV2RenderContext& context, const QVariant& defaultVal = QVariant(), bool *ok = nullptr ) const; virtual bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, diff --git a/src/core/symbology-ng/qgssymbollayerv2registry.cpp b/src/core/symbology-ng/qgssymbollayerv2registry.cpp index ab38a322e4a..f450f423a36 100644 --- a/src/core/symbology-ng/qgssymbollayerv2registry.cpp +++ b/src/core/symbology-ng/qgssymbollayerv2registry.cpp @@ -73,7 +73,7 @@ QgsSymbolLayerV2Registry::~QgsSymbolLayerV2Registry() bool QgsSymbolLayerV2Registry::addSymbolLayerType( QgsSymbolLayerV2AbstractMetadata* metadata ) { - if ( metadata == NULL || mMetadata.contains( metadata->name() ) ) + if ( metadata == nullptr || mMetadata.contains( metadata->name() ) ) return false; mMetadata[metadata->name()] = metadata; @@ -106,17 +106,17 @@ QgsSymbolLayerV2* QgsSymbolLayerV2Registry::defaultSymbolLayer( QgsSymbolV2::Sym return QgsSimpleFillSymbolLayerV2::create(); case QgsSymbolV2::Hybrid: - return 0; + return nullptr; } - return 0; + return nullptr; } QgsSymbolLayerV2* QgsSymbolLayerV2Registry::createSymbolLayer( const QString& name, const QgsStringMap& properties ) const { if ( !mMetadata.contains( name ) ) - return NULL; + return nullptr; return mMetadata[name]->createSymbolLayer( properties ); } @@ -124,7 +124,7 @@ QgsSymbolLayerV2* QgsSymbolLayerV2Registry::createSymbolLayer( const QString& na QgsSymbolLayerV2* QgsSymbolLayerV2Registry::createSymbolLayerFromSld( const QString& name, QDomElement& element ) const { if ( !mMetadata.contains( name ) ) - return NULL; + return nullptr; return mMetadata[name]->createSymbolLayerFromSld( element ); } diff --git a/src/core/symbology-ng/qgssymbollayerv2registry.h b/src/core/symbology-ng/qgssymbollayerv2registry.h index 4037c356baa..3eb05833663 100644 --- a/src/core/symbology-ng/qgssymbollayerv2registry.h +++ b/src/core/symbology-ng/qgssymbollayerv2registry.h @@ -42,9 +42,9 @@ class CORE_EXPORT QgsSymbolLayerV2AbstractMetadata /** Create a symbol layer of this type given the map of properties. */ virtual QgsSymbolLayerV2* createSymbolLayer( const QgsStringMap& map ) = 0; /** Create widget for symbol layer of this type. Can return NULL if there's no GUI */ - virtual QgsSymbolLayerV2Widget* createSymbolLayerWidget( const QgsVectorLayer * ) { return NULL; } + virtual QgsSymbolLayerV2Widget* createSymbolLayerWidget( const QgsVectorLayer * ) { return nullptr; } /** Create a symbol layer of this type given the map of properties. */ - virtual QgsSymbolLayerV2* createSymbolLayerFromSld( QDomElement & ) { return NULL; } + virtual QgsSymbolLayerV2* createSymbolLayerFromSld( QDomElement & ) { return nullptr; } protected: @@ -67,11 +67,11 @@ class CORE_EXPORT QgsSymbolLayerV2Metadata : public QgsSymbolLayerV2AbstractMeta QgsSymbolLayerV2Metadata( const QString& name, const QString& visibleName, QgsSymbolV2::SymbolType type, QgsSymbolLayerV2CreateFunc pfCreate, - QgsSymbolLayerV2WidgetFunc pfWidget = NULL ) + QgsSymbolLayerV2WidgetFunc pfWidget = nullptr ) : QgsSymbolLayerV2AbstractMetadata( name, visibleName, type ) , mCreateFunc( pfCreate ) , mWidgetFunc( pfWidget ) - , mCreateFromSldFunc( NULL ) + , mCreateFromSldFunc( nullptr ) {} //! not available in python bindings @@ -79,7 +79,7 @@ class CORE_EXPORT QgsSymbolLayerV2Metadata : public QgsSymbolLayerV2AbstractMeta QgsSymbolV2::SymbolType type, QgsSymbolLayerV2CreateFunc pfCreate, QgsSymbolLayerV2CreateFromSldFunc pfCreateFromSld, - QgsSymbolLayerV2WidgetFunc pfWidget = NULL ) + QgsSymbolLayerV2WidgetFunc pfWidget = nullptr ) : QgsSymbolLayerV2AbstractMetadata( name, visibleName, type ) , mCreateFunc( pfCreate ) , mWidgetFunc( pfWidget ) @@ -96,9 +96,9 @@ class CORE_EXPORT QgsSymbolLayerV2Metadata : public QgsSymbolLayerV2AbstractMeta //! not available in python bindings void setWidgetFunction( QgsSymbolLayerV2WidgetFunc f ) { mWidgetFunc = f; } - virtual QgsSymbolLayerV2* createSymbolLayer( const QgsStringMap& map ) override { return mCreateFunc ? mCreateFunc( map ) : NULL; } - virtual QgsSymbolLayerV2Widget* createSymbolLayerWidget( const QgsVectorLayer* vl ) override { return mWidgetFunc ? mWidgetFunc( vl ) : NULL; } - virtual QgsSymbolLayerV2* createSymbolLayerFromSld( QDomElement& elem ) override { return mCreateFromSldFunc ? mCreateFromSldFunc( elem ) : NULL; } + virtual QgsSymbolLayerV2* createSymbolLayer( const QgsStringMap& map ) override { return mCreateFunc ? mCreateFunc( map ) : nullptr; } + virtual QgsSymbolLayerV2Widget* createSymbolLayerWidget( const QgsVectorLayer* vl ) override { return mWidgetFunc ? mWidgetFunc( vl ) : nullptr; } + virtual QgsSymbolLayerV2* createSymbolLayerFromSld( QDomElement& elem ) override { return mCreateFromSldFunc ? mCreateFromSldFunc( elem ) : nullptr; } protected: QgsSymbolLayerV2CreateFunc mCreateFunc; diff --git a/src/core/symbology-ng/qgssymbollayerv2utils.cpp b/src/core/symbology-ng/qgssymbollayerv2utils.cpp index 55c91f3bcae..b7031b6f2bf 100644 --- a/src/core/symbology-ng/qgssymbollayerv2utils.cpp +++ b/src/core/symbology-ng/qgssymbollayerv2utils.cpp @@ -581,7 +581,7 @@ QPicture QgsSymbolLayerV2Utils::symbolLayerPreviewPicture( QgsSymbolLayerV2* lay painter.setRenderHint( QPainter::Antialiasing ); QgsRenderContext renderContext = createRenderContext( &painter ); renderContext.setForceVectorOutput( true ); - QgsSymbolV2RenderContext symbolContext( renderContext, units, 1.0, false, 0, 0, 0, scale ); + QgsSymbolV2RenderContext symbolContext( renderContext, units, 1.0, false, 0, nullptr, nullptr, scale ); layer->drawPreviewIcon( symbolContext, size ); painter.end(); return picture; @@ -595,7 +595,7 @@ QIcon QgsSymbolLayerV2Utils::symbolLayerPreviewIcon( QgsSymbolLayerV2* layer, Qg painter.begin( &pixmap ); painter.setRenderHint( QPainter::Antialiasing ); QgsRenderContext renderContext = createRenderContext( &painter ); - QgsSymbolV2RenderContext symbolContext( renderContext, u, 1.0, false, 0, 0, 0, scale ); + QgsSymbolV2RenderContext symbolContext( renderContext, u, 1.0, false, 0, nullptr, nullptr, scale ); layer->drawPreviewIcon( symbolContext, size ); painter.end(); return QIcon( pixmap ); @@ -768,7 +768,7 @@ QList offsetLine( QPolygonF polyline, double dist, QGis::GeometryType { int quadSegments = 0; // we want mitre joins, not round joins double mitreLimit = 2.0; // the default value in GEOS (5.0) allows for fairly sharp endings - QgsGeometry* offsetGeom = 0; + QgsGeometry* offsetGeom = nullptr; if ( geometryType == QGis::Polygon ) offsetGeom = tempGeometry->buffer( -dist, quadSegments, GEOSBUF_CAP_FLAT, GEOSBUF_JOIN_MITRE, mitreLimit ); else @@ -905,7 +905,7 @@ QgsSymbolV2* QgsSymbolLayerV2Utils::loadSymbol( const QDomElement &element ) { QgsSymbolLayerV2* layer = loadSymbolLayer( e ); - if ( layer != NULL ) + if ( layer != nullptr ) { // Dealing with sub-symbols nested into a layer QDomElement s = e.firstChildElement( "symbol" ); @@ -928,12 +928,12 @@ QgsSymbolV2* QgsSymbolLayerV2Utils::loadSymbol( const QDomElement &element ) if ( layers.isEmpty() ) { QgsDebugMsg( "no layers for symbol" ); - return NULL; + return nullptr; } QString symbolType = element.attribute( "type" ); - QgsSymbolV2* symbol = 0; + QgsSymbolV2* symbol = nullptr; if ( symbolType == "line" ) symbol = new QgsLineSymbolV2( layers ); else if ( symbolType == "fill" ) @@ -943,7 +943,7 @@ QgsSymbolV2* QgsSymbolLayerV2Utils::loadSymbol( const QDomElement &element ) else { QgsDebugMsg( "unknown symbol type " + symbolType ); - return NULL; + return nullptr; } if ( element.hasAttribute( "outputUnit" ) ) @@ -990,7 +990,7 @@ QgsSymbolLayerV2* QgsSymbolLayerV2Utils::loadSymbolLayer( QDomElement& element ) else { QgsDebugMsg( "unknown class " + layerClass ); - return NULL; + return nullptr; } } @@ -1027,7 +1027,7 @@ QDomElement QgsSymbolLayerV2Utils::saveSymbol( const QString& name, QgsSymbolV2* if ( !QgsPaintEffectRegistry::isDefaultStack( layer->paintEffect() ) ) layer->paintEffect()->saveProperties( doc, layerEl ); - if ( layer->subSymbol() != NULL ) + if ( layer->subSymbol() != nullptr ) { QString subname = QString( "@%1@%2" ).arg( name ).arg( i ); QDomElement subEl = saveSymbol( subname, layer->subSymbol(), doc ); @@ -1058,7 +1058,7 @@ bool QgsSymbolLayerV2Utils::createSymbolLayerV2ListFromSld( QDomElement& element if ( element.isNull() ) return false; - QgsSymbolLayerV2 *l = 0; + QgsSymbolLayerV2 *l = nullptr; QString symbolizerName = element.localName(); @@ -1151,7 +1151,7 @@ bool QgsSymbolLayerV2Utils::createSymbolLayerV2ListFromSld( QDomElement& element } else { - QgsSymbolLayerV2 *l = 0; + QgsSymbolLayerV2 *l = nullptr; switch ( geomType ) { @@ -1205,10 +1205,10 @@ QgsSymbolLayerV2* QgsSymbolLayerV2Utils::createFillLayerFromSld( QDomElement &el if ( fillElem.isNull() ) { QgsDebugMsg( "Fill element not found" ); - return NULL; + return nullptr; } - QgsSymbolLayerV2 *l = 0; + QgsSymbolLayerV2 *l = nullptr; if ( needLinePatternFill( element ) ) l = QgsSymbolLayerV2Registry::instance()->createSymbolLayerFromSld( "LinePatternFill", element ); @@ -1228,10 +1228,10 @@ QgsSymbolLayerV2* QgsSymbolLayerV2Utils::createLineLayerFromSld( QDomElement &el if ( strokeElem.isNull() ) { QgsDebugMsg( "Stroke element not found" ); - return NULL; + return nullptr; } - QgsSymbolLayerV2 *l = 0; + QgsSymbolLayerV2 *l = nullptr; if ( needMarkerLine( element ) ) l = QgsSymbolLayerV2Registry::instance()->createSymbolLayerFromSld( "MarkerLine", element ); @@ -1247,10 +1247,10 @@ QgsSymbolLayerV2* QgsSymbolLayerV2Utils::createMarkerLayerFromSld( QDomElement & if ( graphicElem.isNull() ) { QgsDebugMsg( "Graphic element not found" ); - return NULL; + return nullptr; } - QgsSymbolLayerV2 *l = 0; + QgsSymbolLayerV2 *l = nullptr; if ( needFontMarker( element ) ) l = QgsSymbolLayerV2Registry::instance()->createSymbolLayerFromSld( "FontMarker", element ); @@ -1493,7 +1493,7 @@ bool QgsSymbolLayerV2Utils::convertPolygonSymbolizerToPointMarker( QDomElement & QVector customDashPattern; if ( lineFromSld( strokeElem, borderStyle, borderColor, borderWidth, - 0, 0, &customDashPattern, &dashOffset ) ) + nullptr, nullptr, &customDashPattern, &dashOffset ) ) validBorder = true; if ( validFill || validBorder ) @@ -1637,7 +1637,7 @@ bool QgsSymbolLayerV2Utils::convertPolygonSymbolizerToPointMarker( QDomElement & QDomElement markStrokeElem = graphicChildElem.firstChildElement( "Stroke" ); if ( lineFromSld( markStrokeElem, borderStyle, borderColor, borderWidth, - 0, 0, &customDashPattern, &dashOffset ) ) + nullptr, nullptr, &customDashPattern, &dashOffset ) ) validBorder = true; } @@ -2673,7 +2673,7 @@ QgsSymbolV2Map QgsSymbolLayerV2Utils::loadSymbols( QDomElement& element ) if ( e.tagName() == "symbol" ) { QgsSymbolV2* symbol = QgsSymbolLayerV2Utils::loadSymbol( e ); - if ( symbol != NULL ) + if ( symbol != nullptr ) symbols.insert( e.attribute( "name" ), symbol ); } else @@ -2781,7 +2781,7 @@ QgsVectorColorRampV2* QgsSymbolLayerV2Utils::loadColorRamp( QDomElement& element else { QgsDebugMsg( "unknown colorramp type " + rampType ); - return NULL; + return nullptr; } } @@ -3836,7 +3836,7 @@ bool QgsSymbolLayerV2Utils::pointInPolygon( const QPolygonF &points, const QPoin QgsExpression* QgsSymbolLayerV2Utils::fieldOrExpressionToExpression( const QString& fieldOrExpression ) { if ( fieldOrExpression.isEmpty() ) - return 0; + return nullptr; QgsExpression* expr = new QgsExpression( fieldOrExpression ); if ( !expr->hasParserError() ) diff --git a/src/core/symbology-ng/qgssymbollayerv2utils.h b/src/core/symbology-ng/qgssymbollayerv2utils.h index d9228db2cb3..ba4d515568e 100644 --- a/src/core/symbology-ng/qgssymbollayerv2utils.h +++ b/src/core/symbology-ng/qgssymbollayerv2utils.h @@ -119,7 +119,7 @@ class CORE_EXPORT QgsSymbolLayerV2Utils static void drawStippledBackground( QPainter* painter, QRect rect ); //! @note customContext parameter added in 2.6 - static QPixmap symbolPreviewPixmap( QgsSymbolV2* symbol, QSize size, QgsRenderContext* customContext = 0 ); + static QPixmap symbolPreviewPixmap( QgsSymbolV2* symbol, QSize size, QgsRenderContext* customContext = nullptr ); static QPixmap colorRampPreviewPixmap( QgsVectorColorRampV2* ramp, QSize size ); /** Returns the maximum estimated bleed for the symbol */ @@ -150,7 +150,7 @@ class CORE_EXPORT QgsSymbolLayerV2Utils { //could not cast delete tmpSymbol; - return NULL; + return nullptr; } } @@ -189,12 +189,12 @@ class CORE_EXPORT QgsSymbolLayerV2Utils //! @note not available in python bindings static void lineToSld( QDomDocument &doc, QDomElement &element, Qt::PenStyle penStyle, const QColor& color, double width = -1, - const Qt::PenJoinStyle *penJoinStyle = 0, const Qt::PenCapStyle *penCapStyle = 0, - const QVector *customDashPattern = 0, double dashOffset = 0.0 ); + const Qt::PenJoinStyle *penJoinStyle = nullptr, const Qt::PenCapStyle *penCapStyle = nullptr, + const QVector *customDashPattern = nullptr, double dashOffset = 0.0 ); static bool lineFromSld( QDomElement &element, Qt::PenStyle &penStyle, QColor &color, double &width, - Qt::PenJoinStyle *penJoinStyle = 0, Qt::PenCapStyle *penCapStyle = 0, - QVector *customDashPattern = 0, double *dashOffset = 0 ); + Qt::PenJoinStyle *penJoinStyle = nullptr, Qt::PenCapStyle *penCapStyle = nullptr, + QVector *customDashPattern = nullptr, double *dashOffset = nullptr ); static void externalGraphicToSld( QDomDocument &doc, QDomElement &element, const QString& path, const QString& mime, @@ -221,7 +221,7 @@ class CORE_EXPORT QgsSymbolLayerV2Utils double &borderWidth, double &size ); static void externalMarkerToSld( QDomDocument &doc, QDomElement &element, - const QString& path, const QString& format, int *markIndex = 0, + const QString& path, const QString& format, int *markIndex = nullptr, const QColor& color = QColor(), double size = -1 ); static bool externalMarkerFromSld( QDomElement &element, QString &path, QString &format, int &markIndex, @@ -236,7 +236,7 @@ class CORE_EXPORT QgsSymbolLayerV2Utils Qt::PenJoinStyle joinStyle = Qt::MiterJoin, Qt::PenCapStyle capStyle = Qt::FlatCap, double offset = 0.0, - const QVector* dashPattern = 0 ); + const QVector* dashPattern = nullptr ); /** Create ogr feature style string for brush @param fillColr fill color*/ static QString ogrFeatureStyleBrush( const QColor& fillColr ); diff --git a/src/core/symbology-ng/qgssymbologyv2conversion.cpp b/src/core/symbology-ng/qgssymbologyv2conversion.cpp index bd8da90755d..55fd14725ff 100644 --- a/src/core/symbology-ng/qgssymbologyv2conversion.cpp +++ b/src/core/symbology-ng/qgssymbologyv2conversion.cpp @@ -131,7 +131,7 @@ static QgsSymbolV2* readOldSymbol( const QDomNode& synode, QGis::GeometryType ge { case QGis::Point: { - QgsMarkerSymbolLayerV2* sl = NULL; + QgsMarkerSymbolLayerV2* sl = nullptr; double size = readMarkerSymbolSize( synode ); double angle = 0; // rotation only from classification field QString symbolName = readMarkerSymbolName( synode ); @@ -181,7 +181,7 @@ static QgsSymbolV2* readOldSymbol( const QDomNode& synode, QGis::GeometryType ge } default: - return NULL; + return nullptr; } } @@ -191,7 +191,7 @@ static QgsFeatureRendererV2* readOldSingleSymbolRenderer( const QDomNode& rnode, { QDomNode synode = rnode.namedItem( "symbol" ); if ( synode.isNull() ) - return 0; + return nullptr; QgsSymbolV2* sy2 = readOldSymbol( synode, geomType ); QgsSingleSymbolRendererV2* r = new QgsSingleSymbolRendererV2( sy2 ); @@ -297,14 +297,14 @@ QgsFeatureRendererV2* QgsSymbologyV2Conversion::readOldRenderer( const QDomNode& } else if ( !continuousnode.isNull() ) { - return 0; + return nullptr; } else if ( !uniquevaluenode.isNull() ) { return readOldUniqueValueRenderer( uniquevaluenode, geomType ); } - return 0; + return nullptr; } diff --git a/src/core/symbology-ng/qgssymbolv2.cpp b/src/core/symbology-ng/qgssymbolv2.cpp index bb1e11013fe..d617ad62ffe 100644 --- a/src/core/symbology-ng/qgssymbolv2.cpp +++ b/src/core/symbology-ng/qgssymbolv2.cpp @@ -86,13 +86,13 @@ QgsSymbolV2::QgsSymbolV2( SymbolType type, const QgsSymbolLayerV2List& layers ) , mAlpha( 1.0 ) , mRenderHints( 0 ) , mClipFeaturesToExtent( true ) - , mLayer( 0 ) + , mLayer( nullptr ) { // check they're all correct symbol layers for ( int i = 0; i < mLayers.count(); i++ ) { - if ( mLayers[i] == NULL ) + if ( mLayers[i] == nullptr ) { mLayers.removeAt( i-- ); } @@ -301,7 +301,7 @@ void QgsSymbolV2::setMapUnitScale( const QgsMapUnitScale &scale ) QgsSymbolV2* QgsSymbolV2::defaultSymbol( QGis::GeometryType geomType ) { - QgsSymbolV2* s = 0; + QgsSymbolV2* s = nullptr; // override global default if project has a default for this type QString defaultSymbol; @@ -329,7 +329,7 @@ QgsSymbolV2* QgsSymbolV2::defaultSymbol( QGis::GeometryType geomType ) case QGis::Point: s = new QgsMarkerSymbolV2(); break; case QGis::Line: s = new QgsLineSymbolV2(); break; case QGis::Polygon: s = new QgsFillSymbolV2(); break; - default: QgsDebugMsg( "unknown layer's geometry type" ); return NULL; + default: QgsDebugMsg( "unknown layer's geometry type" ); return nullptr; } } @@ -366,7 +366,7 @@ bool QgsSymbolV2::insertSymbolLayer( int index, QgsSymbolLayerV2* layer ) { if ( index < 0 || index > mLayers.count() ) // can be added also after the last index return false; - if ( layer == NULL || !layer->isCompatibleWithSymbol( this ) ) + if ( layer == nullptr || !layer->isCompatibleWithSymbol( this ) ) return false; mLayers.insert( index, layer ); @@ -376,7 +376,7 @@ bool QgsSymbolV2::insertSymbolLayer( int index, QgsSymbolLayerV2* layer ) bool QgsSymbolV2::appendSymbolLayer( QgsSymbolLayerV2* layer ) { - if ( layer == NULL || !layer->isCompatibleWithSymbol( this ) ) + if ( layer == nullptr || !layer->isCompatibleWithSymbol( this ) ) return false; mLayers.append( layer ); @@ -398,7 +398,7 @@ bool QgsSymbolV2::deleteSymbolLayer( int index ) QgsSymbolLayerV2* QgsSymbolV2::takeSymbolLayer( int index ) { if ( index < 0 || index >= mLayers.count() ) - return NULL; + return nullptr; return mLayers.takeAt( index ); } @@ -422,7 +422,7 @@ bool QgsSymbolV2::changeSymbolLayer( int index, QgsSymbolLayerV2* layer ) void QgsSymbolV2::startRender( QgsRenderContext& context, const QgsFields* fields ) { - QgsSymbolV2RenderContext symbolContext( context, outputUnit(), mAlpha, false, mRenderHints, 0, fields, mapUnitScale() ); + QgsSymbolV2RenderContext symbolContext( context, outputUnit(), mAlpha, false, mRenderHints, nullptr, fields, mapUnitScale() ); Q_FOREACH ( QgsSymbolLayerV2* layer, mLayers ) @@ -431,12 +431,12 @@ void QgsSymbolV2::startRender( QgsRenderContext& context, const QgsFields* field void QgsSymbolV2::stopRender( QgsRenderContext& context ) { - QgsSymbolV2RenderContext symbolContext( context, outputUnit(), mAlpha, false, mRenderHints, 0, 0, mapUnitScale() ); + QgsSymbolV2RenderContext symbolContext( context, outputUnit(), mAlpha, false, mRenderHints, nullptr, nullptr, mapUnitScale() ); Q_FOREACH ( QgsSymbolLayerV2* layer, mLayers ) layer->stopRender( symbolContext ); - mLayer = NULL; + mLayer = nullptr; } void QgsSymbolV2::setColor( const QColor& color ) @@ -463,7 +463,7 @@ void QgsSymbolV2::drawPreviewIcon( QPainter* painter, QSize size, QgsRenderConte { QgsRenderContext context = customContext ? *customContext : QgsSymbolLayerV2Utils::createRenderContext( painter ); context.setForceVectorOutput( true ); - QgsSymbolV2RenderContext symbolContext( context, outputUnit(), mAlpha, false, mRenderHints, 0, 0, mapUnitScale() ); + QgsSymbolV2RenderContext symbolContext( context, outputUnit(), mAlpha, false, mRenderHints, nullptr, nullptr, mapUnitScale() ); Q_FOREACH ( QgsSymbolLayerV2* layer, mLayers ) { @@ -478,7 +478,7 @@ void QgsSymbolV2::drawPreviewIcon( QPainter* painter, QSize size, QgsRenderConte // from QgsFillSymbolLayerV2::drawPreviewIcon() QPolygonF poly = QRectF( QPointF( 0, 0 ), QPointF( size.width() - 1, size.height() - 1 ) ); lsl->startRender( symbolContext ); - lsl->renderPolygonOutline( poly, NULL, symbolContext ); + lsl->renderPolygonOutline( poly, nullptr, symbolContext ); lsl->stopRender( symbolContext ); } } @@ -547,17 +547,17 @@ QImage QgsSymbolV2::bigSymbolPreviewImage( QgsExpressionContext* expressionConte { QPolygonF poly; poly << QPointF( 0, 50 ) << QPointF( 99, 50 ); - static_cast( this )->renderPolyline( poly, 0, context ); + static_cast( this )->renderPolyline( poly, nullptr, context ); } else if ( mType == QgsSymbolV2::Fill ) { QPolygonF polygon; polygon << QPointF( 20, 20 ) << QPointF( 80, 20 ) << QPointF( 80, 80 ) << QPointF( 20, 80 ) << QPointF( 20, 20 ); - static_cast( this )->renderPolygon( polygon, NULL, 0, context ); + static_cast( this )->renderPolygon( polygon, nullptr, nullptr, context ); } else // marker { - static_cast( this )->renderPoint( QPointF( 50, 50 ), 0, context ); + static_cast( this )->renderPoint( QPointF( 50, 50 ), nullptr, context ); } stopRender( context ); @@ -727,7 +727,7 @@ void QgsSymbolV2::renderFeature( const QgsFeature& feature, QgsRenderContext& co break; } _getPolygon( pts, holes, context, segmentizedGeometry->asWkb(), clipFeaturesToExtent() ); - static_cast( this )->renderPolygon( pts, ( !holes.isEmpty() ? &holes : NULL ), &feature, context, layer, selected ); + static_cast( this )->renderPolygon( pts, ( !holes.isEmpty() ? &holes : nullptr ), &feature, context, layer, selected ); } break; @@ -807,7 +807,7 @@ void QgsSymbolV2::renderFeature( const QgsFeature& feature, QgsRenderContext& co context.setGeometry( geomCollection->geometryN( i ) ); } ptr = _getPolygon( pts, holes, context, ptr, clipFeaturesToExtent() ); - static_cast( this )->renderPolygon( pts, ( !holes.isEmpty() ? &holes : NULL ), &feature, context, layer, selected ); + static_cast( this )->renderPolygon( pts, ( !holes.isEmpty() ? &holes : nullptr ), &feature, context, layer, selected ); } break; } @@ -896,8 +896,8 @@ QgsSymbolV2RenderContext& QgsSymbolV2RenderContext::operator=( const QgsSymbolV2 QgsMarkerSymbolV2* QgsMarkerSymbolV2::createSimple( const QgsStringMap& properties ) { QgsSymbolLayerV2* sl = QgsSimpleMarkerSymbolLayerV2::create( properties ); - if ( sl == NULL ) - return NULL; + if ( sl == nullptr ) + return nullptr; QgsSymbolLayerV2List layers; layers.append( sl ); @@ -907,8 +907,8 @@ QgsMarkerSymbolV2* QgsMarkerSymbolV2::createSimple( const QgsStringMap& properti QgsLineSymbolV2* QgsLineSymbolV2::createSimple( const QgsStringMap& properties ) { QgsSymbolLayerV2* sl = QgsSimpleLineSymbolLayerV2::create( properties ); - if ( sl == NULL ) - return NULL; + if ( sl == nullptr ) + return nullptr; QgsSymbolLayerV2List layers; layers.append( sl ); @@ -918,8 +918,8 @@ QgsLineSymbolV2* QgsLineSymbolV2::createSimple( const QgsStringMap& properties ) QgsFillSymbolV2* QgsFillSymbolV2::createSimple( const QgsStringMap& properties ) { QgsSymbolLayerV2* sl = QgsSimpleFillSymbolLayerV2::create( properties ); - if ( sl == NULL ) - return NULL; + if ( sl == nullptr ) + return nullptr; QgsSymbolLayerV2List layers; layers.append( sl ); @@ -1001,7 +1001,7 @@ void QgsMarkerSymbolV2::setDataDefinedAngle( const QgsDataDefined& dd ) QgsDataDefined QgsMarkerSymbolV2::dataDefinedAngle() const { const double symbolRotation = angle(); - QgsDataDefined* symbolDD = 0; + QgsDataDefined* symbolDD = nullptr; // find the base of the "en masse" pattern Q_FOREACH ( QgsSymbolLayerV2* layer, mLayers ) @@ -1122,7 +1122,7 @@ QgsDataDefined QgsMarkerSymbolV2::dataDefinedSize() const { const double symbolSize = size(); - QgsDataDefined* symbolDD = 0; + QgsDataDefined* symbolDD = nullptr; // find the base of the "en masse" pattern Q_FOREACH ( QgsSymbolLayerV2* layer, mLayers ) @@ -1223,7 +1223,7 @@ void QgsMarkerSymbolV2::renderPointUsingLayer( QgsMarkerSymbolLayerV2* layer, co void QgsMarkerSymbolV2::renderPoint( const QPointF& point, const QgsFeature* f, QgsRenderContext& context, int layerIdx, bool selected ) { - QgsSymbolV2RenderContext symbolContext( context, outputUnit(), mAlpha, selected, mRenderHints, f, 0, mapUnitScale() ); + QgsSymbolV2RenderContext symbolContext( context, outputUnit(), mAlpha, selected, mRenderHints, f, nullptr, mapUnitScale() ); if ( layerIdx != -1 ) { @@ -1255,7 +1255,7 @@ void QgsMarkerSymbolV2::renderPoint( const QPointF& point, const QgsFeature* f, QRectF QgsMarkerSymbolV2::bounds( const QPointF& point, QgsRenderContext& context ) const { - QgsSymbolV2RenderContext symbolContext( context, outputUnit(), mAlpha, false, mRenderHints, 0, 0, mapUnitScale() ); + QgsSymbolV2RenderContext symbolContext( context, outputUnit(), mAlpha, false, mRenderHints, nullptr, nullptr, mapUnitScale() ); QRectF bound; Q_FOREACH ( QgsSymbolLayerV2* layer, mLayers ) @@ -1374,7 +1374,7 @@ QgsDataDefined QgsLineSymbolV2::dataDefinedWidth() const { const double symbolWidth = width(); - QgsDataDefined* symbolDD = 0; + QgsDataDefined* symbolDD = nullptr; // find the base of the "en masse" pattern for ( QgsSymbolLayerV2List::const_iterator it = mLayers.begin(); it != mLayers.end(); ++it ) @@ -1427,7 +1427,7 @@ void QgsLineSymbolV2::renderPolyline( const QPolygonF& points, const QgsFeature* { //save old painter QPainter* renderPainter = context.painter(); - QgsSymbolV2RenderContext symbolContext( context, outputUnit(), mAlpha, selected, mRenderHints, f, 0, mapUnitScale() ); + QgsSymbolV2RenderContext symbolContext( context, outputUnit(), mAlpha, selected, mRenderHints, f, nullptr, mapUnitScale() ); if ( layerIdx != -1 ) { @@ -1504,7 +1504,7 @@ QgsFillSymbolV2::QgsFillSymbolV2( const QgsSymbolLayerV2List& layers ) void QgsFillSymbolV2::renderPolygon( const QPolygonF& points, QList* rings, const QgsFeature* f, QgsRenderContext& context, int layerIdx, bool selected ) { - QgsSymbolV2RenderContext symbolContext( context, outputUnit(), mAlpha, selected, mRenderHints, f, 0, mapUnitScale() ); + QgsSymbolV2RenderContext symbolContext( context, outputUnit(), mAlpha, selected, mRenderHints, f, nullptr, mapUnitScale() ); if ( layerIdx != -1 ) { @@ -1586,7 +1586,7 @@ QRectF QgsFillSymbolV2::polygonBounds( const QPolygonF& points, const QList* QgsFillSymbolV2::translateRings( const QList* rings, double dx, double dy ) const { if ( !rings ) - return 0; + return nullptr; QList* translatedRings = new QList; QList::const_iterator it = rings->constBegin(); diff --git a/src/core/symbology-ng/qgssymbolv2.h b/src/core/symbology-ng/qgssymbolv2.h index de3e52e17e5..f8dc3dfc207 100644 --- a/src/core/symbology-ng/qgssymbolv2.h +++ b/src/core/symbology-ng/qgssymbolv2.h @@ -155,7 +155,7 @@ class CORE_EXPORT QgsSymbolV2 //! delete layer at specified index and set a new one bool changeSymbolLayer( int index, QgsSymbolLayerV2 *layer ); - void startRender( QgsRenderContext& context, const QgsFields* fields = 0 ); + void startRender( QgsRenderContext& context, const QgsFields* fields = nullptr ); void stopRender( QgsRenderContext& context ); void setColor( const QColor& color ); @@ -164,19 +164,19 @@ class CORE_EXPORT QgsSymbolV2 //! Draw icon of the symbol that occupyies area given by size using the painter. //! Optionally custom context may be given in order to get rendering of symbols that use map units right. //! @note customContext parameter added in 2.6 - void drawPreviewIcon( QPainter* painter, QSize size, QgsRenderContext* customContext = 0 ); + void drawPreviewIcon( QPainter* painter, QSize size, QgsRenderContext* customContext = nullptr ); //! export symbol as image format. PNG and SVG supported void exportImage( const QString& path, const QString& format, const QSize& size ); //! Generate symbol as image - QImage asImage( QSize size, QgsRenderContext* customContext = 0 ); + QImage asImage( QSize size, QgsRenderContext* customContext = nullptr ); /** Returns a large (roughly 100x100 pixel) preview image for the symbol. * @param expressionContext optional expression context, for evaluation of * data defined symbol properties */ - QImage bigSymbolPreviewImage( QgsExpressionContext* expressionContext = 0 ); + QImage bigSymbolPreviewImage( QgsExpressionContext* expressionContext = nullptr ); QString dump() const; @@ -307,7 +307,7 @@ class CORE_EXPORT QgsSymbolV2 class CORE_EXPORT QgsSymbolV2RenderContext { public: - QgsSymbolV2RenderContext( QgsRenderContext& c, QgsSymbolV2::OutputUnit u, qreal alpha = 1.0, bool selected = false, int renderHints = 0, const QgsFeature* f = 0, const QgsFields* fields = 0, const QgsMapUnitScale& mapUnitScale = QgsMapUnitScale() ); + QgsSymbolV2RenderContext( QgsRenderContext& c, QgsSymbolV2::OutputUnit u, qreal alpha = 1.0, bool selected = false, int renderHints = 0, const QgsFeature* f = nullptr, const QgsFields* fields = nullptr, const QgsMapUnitScale& mapUnitScale = QgsMapUnitScale() ); ~QgsSymbolV2RenderContext(); QgsRenderContext& renderContext() { return mRenderContext; } diff --git a/src/core/symbology-ng/qgsvectorfieldsymbollayer.cpp b/src/core/symbology-ng/qgsvectorfieldsymbollayer.cpp index f8eaa771a49..42abae3d5fd 100644 --- a/src/core/symbology-ng/qgsvectorfieldsymbollayer.cpp +++ b/src/core/symbology-ng/qgsvectorfieldsymbollayer.cpp @@ -26,7 +26,7 @@ QgsVectorFieldSymbolLayer::QgsVectorFieldSymbolLayer() , mVectorFieldType( Cartesian ) , mAngleOrientation( ClockwiseFromNorth ) , mAngleUnits( Degrees ) - , mLineSymbol( 0 ) + , mLineSymbol( nullptr ) , mXIndex( -1 ) , mYIndex( -1 ) { @@ -157,7 +157,7 @@ void QgsVectorFieldSymbolLayer::renderPoint( const QPointF& point, QgsSymbolV2Re QPolygonF line; line << QPointF( 0, 50 ); line << QPointF( 100, 50 ); - mLineSymbol->renderPolyline( line, 0, context.renderContext() ); + mLineSymbol->renderPolyline( line, nullptr, context.renderContext() ); } double xComponent = 0; @@ -269,7 +269,7 @@ void QgsVectorFieldSymbolLayer::toSld( QDomDocument& doc, QDomElement &element, QgsSymbolLayerV2* QgsVectorFieldSymbolLayer::createFromSld( QDomElement &element ) { Q_UNUSED( element ); - return NULL; + return nullptr; } void QgsVectorFieldSymbolLayer::drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ) diff --git a/src/gui/attributetable/qgsattributetabledelegate.cpp b/src/gui/attributetable/qgsattributetabledelegate.cpp index 389f76c644a..ec76eb8477d 100644 --- a/src/gui/attributetable/qgsattributetabledelegate.cpp +++ b/src/gui/attributetable/qgsattributetabledelegate.cpp @@ -39,7 +39,7 @@ QgsVectorLayer* QgsAttributeTableDelegate::layer( const QAbstractItemModel *mode if ( fm ) return fm->layer(); - return 0; + return nullptr; } const QgsAttributeTableModel* QgsAttributeTableDelegate::masterModel( const QAbstractItemModel* model ) @@ -52,7 +52,7 @@ const QgsAttributeTableModel* QgsAttributeTableDelegate::masterModel( const QAbs if ( fm ) return fm->masterModel(); - return 0; + return nullptr; } QWidget *QgsAttributeTableDelegate::createEditor( @@ -63,14 +63,14 @@ QWidget *QgsAttributeTableDelegate::createEditor( Q_UNUSED( option ); QgsVectorLayer *vl = layer( index.model() ); if ( !vl ) - return NULL; + return nullptr; int fieldIdx = index.model()->data( index, QgsAttributeTableModel::FieldIndexRole ).toInt(); QString widgetType = vl->editFormConfig()->widgetType( fieldIdx ); QgsEditorWidgetConfig cfg = vl->editFormConfig()->widgetConfig( fieldIdx ); QgsAttributeEditorContext context( masterModel( index.model() )->editorContext(), QgsAttributeEditorContext::Popup ); - QgsEditorWidgetWrapper* eww = QgsEditorWidgetRegistry::instance()->create( widgetType, vl, fieldIdx, cfg, 0, parent, context ); + QgsEditorWidgetWrapper* eww = QgsEditorWidgetRegistry::instance()->create( widgetType, vl, fieldIdx, cfg, nullptr, parent, context ); QWidget* w = eww->widget(); w->setAutoFillBackground( true ); @@ -83,7 +83,7 @@ QWidget *QgsAttributeTableDelegate::createEditor( void QgsAttributeTableDelegate::setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const { QgsVectorLayer *vl = layer( model ); - if ( vl == NULL ) + if ( vl == nullptr ) return; int fieldIdx = model->data( index, QgsAttributeTableModel::FieldIndexRole ).toInt(); diff --git a/src/gui/attributetable/qgsattributetabledelegate.h b/src/gui/attributetable/qgsattributetabledelegate.h index 4b4afa036cb..ff41c1e5341 100644 --- a/src/gui/attributetable/qgsattributetabledelegate.h +++ b/src/gui/attributetable/qgsattributetabledelegate.h @@ -40,8 +40,8 @@ class GUI_EXPORT QgsAttributeTableDelegate : public QItemDelegate /** Constructor * @param parent parent object */ - QgsAttributeTableDelegate( QObject* parent = 0 ) : - QItemDelegate( parent ), mFeatureSelectionModel( NULL ) {} + QgsAttributeTableDelegate( QObject* parent = nullptr ) : + QItemDelegate( parent ), mFeatureSelectionModel( nullptr ) {} /** Used to create an editor for when the user tries to * change the contents of a cell */ diff --git a/src/gui/attributetable/qgsattributetablefiltermodel.h b/src/gui/attributetable/qgsattributetablefiltermodel.h index eeac031a7c9..33194a2b264 100644 --- a/src/gui/attributetable/qgsattributetablefiltermodel.h +++ b/src/gui/attributetable/qgsattributetablefiltermodel.h @@ -50,7 +50,7 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub * @param sourceModel The QgsAttributeTableModel to use as source (mostly referred to as master model) * @param canvas The mapCanvas. Used to identify the currently visible features. */ - QgsAttributeTableFilterModel( QgsMapCanvas* canvas, QgsAttributeTableModel* sourceModel, QObject* parent = 0 ); + QgsAttributeTableFilterModel( QgsMapCanvas* canvas, QgsAttributeTableModel* sourceModel, QObject* parent = nullptr ); /** * Set the attribute table model that backs this model diff --git a/src/gui/attributetable/qgsattributetablemodel.h b/src/gui/attributetable/qgsattributetablemodel.h index 055e0e98cf5..01a96be865d 100644 --- a/src/gui/attributetable/qgsattributetablemodel.h +++ b/src/gui/attributetable/qgsattributetablemodel.h @@ -62,7 +62,7 @@ class GUI_EXPORT QgsAttributeTableModel: public QAbstractTableModel * @param layerCache A layer cache to use as backend * @param parent The parent QObject (owner) */ - QgsAttributeTableModel( QgsVectorLayerCache *layerCache, QObject *parent = 0 ); + QgsAttributeTableModel( QgsVectorLayerCache *layerCache, QObject *parent = nullptr ); /** * Returns the number of rows @@ -160,7 +160,7 @@ class GUI_EXPORT QgsAttributeTableModel: public QAbstractTableModel /** * Returns the layer this model uses as backend. Retrieved from the layer cache. */ - inline QgsVectorLayer* layer() const { return mLayerCache ? mLayerCache->layer() : NULL; } + inline QgsVectorLayer* layer() const { return mLayerCache ? mLayerCache->layer() : nullptr; } /** * Returns the layer cache this model uses as backend. diff --git a/src/gui/attributetable/qgsattributetableview.cpp b/src/gui/attributetable/qgsattributetableview.cpp index befa87d0fe7..d7ec62a2cbf 100644 --- a/src/gui/attributetable/qgsattributetableview.cpp +++ b/src/gui/attributetable/qgsattributetableview.cpp @@ -32,13 +32,13 @@ QgsAttributeTableView::QgsAttributeTableView( QWidget *parent ) : QTableView( parent ) - , mMasterModel( NULL ) - , mFilterModel( NULL ) - , mFeatureSelectionModel( NULL ) - , mFeatureSelectionManager( NULL ) - , mModel( NULL ) - , mActionPopup( NULL ) - , mLayerCache( NULL ) + , mMasterModel( nullptr ) + , mFilterModel( nullptr ) + , mFeatureSelectionModel( nullptr ) + , mFeatureSelectionManager( nullptr ) + , mModel( nullptr ) + , mActionPopup( nullptr ) + , mLayerCache( nullptr ) , mRowSectionAnchor( 0 ) , mCtrlDragSelectionFlag( QItemSelectionModel::Select ) { @@ -104,7 +104,7 @@ void QgsAttributeTableView::setModel( QgsAttributeTableFilterModel* filterModel connect( mFilterModel, SIGNAL( destroyed() ), this, SLOT( modelDeleted() ) ); delete mFeatureSelectionModel; - mFeatureSelectionModel = 0; + mFeatureSelectionModel = nullptr; if ( filterModel ) { @@ -205,7 +205,7 @@ void QgsAttributeTableView::selectAll() void QgsAttributeTableView::contextMenuEvent( QContextMenuEvent* event ) { delete mActionPopup; - mActionPopup = 0; + mActionPopup = nullptr; QModelIndex idx = indexAt( event->pos() ); if ( !idx.isValid() ) @@ -242,9 +242,9 @@ void QgsAttributeTableView::_q_selectRow( int row ) void QgsAttributeTableView::modelDeleted() { - mFilterModel = 0; - mFeatureSelectionManager = 0; - mFeatureSelectionModel = 0; + mFilterModel = nullptr; + mFeatureSelectionManager = nullptr; + mFeatureSelectionModel = nullptr; } void QgsAttributeTableView::selectRow( int row, bool anchor ) diff --git a/src/gui/attributetable/qgsattributetableview.h b/src/gui/attributetable/qgsattributetableview.h index 028bdba7e94..a603fbda3e9 100644 --- a/src/gui/attributetable/qgsattributetableview.h +++ b/src/gui/attributetable/qgsattributetableview.h @@ -46,7 +46,7 @@ class GUI_EXPORT QgsAttributeTableView : public QTableView Q_OBJECT public: - QgsAttributeTableView( QWidget* parent = 0 ); + QgsAttributeTableView( QWidget* parent = nullptr ); virtual ~QgsAttributeTableView(); virtual void setModel( QgsAttributeTableFilterModel* filterModel ); diff --git a/src/gui/attributetable/qgsdualview.cpp b/src/gui/attributetable/qgsdualview.cpp index 61454764563..1b75f78bc1a 100644 --- a/src/gui/attributetable/qgsdualview.cpp +++ b/src/gui/attributetable/qgsdualview.cpp @@ -35,13 +35,13 @@ QgsDualView::QgsDualView( QWidget* parent ) : QStackedWidget( parent ) , mEditorContext() - , mMasterModel( 0 ) - , mFilterModel( 0 ) - , mFeatureListModel( 0 ) - , mAttributeForm( 0 ) - , mLayerCache( 0 ) - , mProgressDlg( 0 ) - , mFeatureSelectionManager( 0 ) + , mMasterModel( nullptr ) + , mFilterModel( nullptr ) + , mFeatureListModel( nullptr ) + , mAttributeForm( nullptr ) + , mLayerCache( nullptr ) + , mProgressDlg( nullptr ) + , mFeatureSelectionManager( nullptr ) { setupUi( this ); @@ -441,7 +441,7 @@ void QgsDualView::progress( int i, bool& cancel ) void QgsDualView::finished() { delete mProgressDlg; - mProgressDlg = 0; + mProgressDlg = nullptr; } /* diff --git a/src/gui/attributetable/qgsdualview.h b/src/gui/attributetable/qgsdualview.h index cb93206a3c4..fc74441e66e 100644 --- a/src/gui/attributetable/qgsdualview.h +++ b/src/gui/attributetable/qgsdualview.h @@ -68,7 +68,7 @@ class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBas * @brief Constructor * @param parent The parent widget */ - explicit QgsDualView( QWidget* parent = 0 ); + explicit QgsDualView( QWidget* parent = nullptr ); /** * Has to be called to initialize the dual view. diff --git a/src/gui/attributetable/qgsfeaturelistmodel.h b/src/gui/attributetable/qgsfeaturelistmodel.h index 20087b148c9..41f61a8ea20 100644 --- a/src/gui/attributetable/qgsfeaturelistmodel.h +++ b/src/gui/attributetable/qgsfeaturelistmodel.h @@ -38,7 +38,7 @@ class GUI_EXPORT QgsFeatureListModel : public QAbstractProxyModel, public QgsFea }; public: - explicit QgsFeatureListModel( QgsAttributeTableFilterModel *sourceModel, QObject* parent = 0 ); + explicit QgsFeatureListModel( QgsAttributeTableFilterModel *sourceModel, QObject* parent = nullptr ); virtual ~QgsFeatureListModel(); virtual void setSourceModel( QgsAttributeTableFilterModel* sourceModel ); diff --git a/src/gui/attributetable/qgsfeaturelistview.cpp b/src/gui/attributetable/qgsfeaturelistview.cpp index 76c03051f7e..5217529452e 100644 --- a/src/gui/attributetable/qgsfeaturelistview.cpp +++ b/src/gui/attributetable/qgsfeaturelistview.cpp @@ -35,11 +35,11 @@ QgsFeatureListView::QgsFeatureListView( QWidget *parent ) : QListView( parent ) - , mModel( 0 ) - , mCurrentEditSelectionModel( 0 ) - , mFeatureSelectionModel( 0 ) - , mFeatureSelectionManager( NULL ) - , mItemDelegate( 0 ) + , mModel( nullptr ) + , mCurrentEditSelectionModel( nullptr ) + , mFeatureSelectionModel( nullptr ) + , mFeatureSelectionManager( nullptr ) + , mItemDelegate( nullptr ) , mEditSelectionDrag( false ) , mRowAnchor( 0 ) { diff --git a/src/gui/attributetable/qgsfeaturelistview.h b/src/gui/attributetable/qgsfeaturelistview.h index cef3124aba3..3003f10ad3f 100644 --- a/src/gui/attributetable/qgsfeaturelistview.h +++ b/src/gui/attributetable/qgsfeaturelistview.h @@ -49,7 +49,7 @@ class GUI_EXPORT QgsFeatureListView : public QListView * * @param parent owner */ - explicit QgsFeatureListView( QWidget* parent = 0 ); + explicit QgsFeatureListView( QWidget* parent = nullptr ); /** * Destructor diff --git a/src/gui/attributetable/qgsfeaturelistviewdelegate.cpp b/src/gui/attributetable/qgsfeaturelistviewdelegate.cpp index 5d9b2f97f5c..769b91e0649 100644 --- a/src/gui/attributetable/qgsfeaturelistviewdelegate.cpp +++ b/src/gui/attributetable/qgsfeaturelistviewdelegate.cpp @@ -15,8 +15,8 @@ QgsFeatureListViewDelegate::QgsFeatureListViewDelegate( QgsFeatureListModel *listModel, QObject *parent ) : QItemDelegate( parent ) - , mFeatureSelectionModel( NULL ) - , mEditSelectionModel( NULL ) + , mFeatureSelectionModel( nullptr ) + , mEditSelectionModel( nullptr ) , mListModel( listModel ) , mCurrentFeatureEdited( false ) { diff --git a/src/gui/attributetable/qgsfeaturelistviewdelegate.h b/src/gui/attributetable/qgsfeaturelistviewdelegate.h index cc9067e5f19..64e205d8474 100644 --- a/src/gui/attributetable/qgsfeaturelistviewdelegate.h +++ b/src/gui/attributetable/qgsfeaturelistviewdelegate.h @@ -24,7 +24,7 @@ class GUI_EXPORT QgsFeatureListViewDelegate : public QItemDelegate SelectionElement }; - explicit QgsFeatureListViewDelegate( QgsFeatureListModel* listModel, QObject *parent = 0 ); + explicit QgsFeatureListViewDelegate( QgsFeatureListModel* listModel, QObject *parent = nullptr ); void setEditSelectionModel( QItemSelectionModel* editSelectionModel ); diff --git a/src/gui/attributetable/qgsfieldconditionalformatwidget.cpp b/src/gui/attributetable/qgsfieldconditionalformatwidget.cpp index 388e39f5f31..ffc158eac4c 100644 --- a/src/gui/attributetable/qgsfieldconditionalformatwidget.cpp +++ b/src/gui/attributetable/qgsfieldconditionalformatwidget.cpp @@ -8,10 +8,10 @@ QgsFieldConditionalFormatWidget::QgsFieldConditionalFormatWidget( QWidget *parent ) : QWidget( parent ) - , mLayer( 0 ) + , mLayer( nullptr ) , mEditIndex( 0 ) , mEditing( false ) - , mSymbol( 0 ) + , mSymbol( nullptr ) { setupUi( this ); mDeleteButton->hide(); @@ -47,7 +47,7 @@ void QgsFieldConditionalFormatWidget::updateIcon() { mSymbol = QgsSymbolV2::defaultSymbol( QGis::Point ); - QgsSymbolV2SelectorDialog dlg( mSymbol, QgsStyleV2::defaultStyle(), 0, this ); + QgsSymbolV2SelectorDialog dlg( mSymbol, QgsStyleV2::defaultStyle(), nullptr, this ); if ( !dlg.exec() ) { return; @@ -135,7 +135,7 @@ void QgsFieldConditionalFormatWidget::setFormattingFromStyle( const QgsCondition } else { - mSymbol = 0; + mSymbol = nullptr; } QFont font = style.font(); mFontBoldBtn->setChecked( font.bold() ); @@ -194,7 +194,7 @@ void QgsFieldConditionalFormatWidget::addNewRule() void QgsFieldConditionalFormatWidget::reset() { - mSymbol = 0; + mSymbol = nullptr; mNameEdit->clear(); mRuleEdit->clear(); if ( fieldRadio->isChecked() ) @@ -291,7 +291,7 @@ void QgsFieldConditionalFormatWidget::saveRule() } else { - style.setSymbol( 0 ); + style.setSymbol( nullptr ); } if ( mEditing ) { diff --git a/src/gui/attributetable/qgsfieldconditionalformatwidget.h b/src/gui/attributetable/qgsfieldconditionalformatwidget.h index 6b96401b47d..285844c110f 100644 --- a/src/gui/attributetable/qgsfieldconditionalformatwidget.h +++ b/src/gui/attributetable/qgsfieldconditionalformatwidget.h @@ -39,7 +39,7 @@ class GUI_EXPORT QgsFieldConditionalFormatWidget : public QWidget, private Ui::Q /** Constructor for QgsFieldConditionalFormatWidget. * @param parent parent widget */ - explicit QgsFieldConditionalFormatWidget( QWidget *parent = 0 ); + explicit QgsFieldConditionalFormatWidget( QWidget *parent = nullptr ); ~QgsFieldConditionalFormatWidget(); diff --git a/src/gui/attributetable/qgsgenericfeatureselectionmanager.h b/src/gui/attributetable/qgsgenericfeatureselectionmanager.h index 93ab701f136..308d9458ef7 100644 --- a/src/gui/attributetable/qgsgenericfeatureselectionmanager.h +++ b/src/gui/attributetable/qgsgenericfeatureselectionmanager.h @@ -29,8 +29,8 @@ class GUI_EXPORT QgsGenericFeatureSelectionManager : public QgsIFeatureSelection Q_OBJECT public: - explicit QgsGenericFeatureSelectionManager( QObject *parent = NULL ); - QgsGenericFeatureSelectionManager( const QgsFeatureIds& initialSelection, QObject *parent = NULL ); + explicit QgsGenericFeatureSelectionManager( QObject *parent = nullptr ); + QgsGenericFeatureSelectionManager( const QgsFeatureIds& initialSelection, QObject *parent = nullptr ); // QgsIFeatureSelection interface virtual int selectedFeatureCount() override; diff --git a/src/gui/attributetable/qgsvectorlayerselectionmanager.h b/src/gui/attributetable/qgsvectorlayerselectionmanager.h index 2406d9f6cbc..9b56c0306da 100644 --- a/src/gui/attributetable/qgsvectorlayerselectionmanager.h +++ b/src/gui/attributetable/qgsvectorlayerselectionmanager.h @@ -25,7 +25,7 @@ class GUI_EXPORT QgsVectorLayerSelectionManager : public QgsIFeatureSelectionMan Q_OBJECT public: - explicit QgsVectorLayerSelectionManager( QgsVectorLayer* layer, QObject *parent = 0 ); + explicit QgsVectorLayerSelectionManager( QgsVectorLayer* layer, QObject *parent = nullptr ); /** * The number of features that are selected in this layer * diff --git a/src/gui/auth/qgsauthauthoritieseditor.cpp b/src/gui/auth/qgsauthauthoritieseditor.cpp index 4c3da02f9f4..741cfb4dd49 100644 --- a/src/gui/auth/qgsauthauthoritieseditor.cpp +++ b/src/gui/auth/qgsauthauthoritieseditor.cpp @@ -41,16 +41,16 @@ QgsAuthAuthoritiesEditor::QgsAuthAuthoritiesEditor( QWidget *parent ) : QWidget( parent ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) - , mRootCaSecItem( 0 ) - , mFileCaSecItem( 0 ) - , mDbCaSecItem( 0 ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) + , mRootCaSecItem( nullptr ) + , mFileCaSecItem( nullptr ) + , mDbCaSecItem( nullptr ) , mDefaultTrustPolicy( QgsAuthCertUtils::DefaultTrust ) - , mUtilitiesMenu( 0 ) + , mUtilitiesMenu( nullptr ) , mDisabled( false ) - , mActionDefaultTrustPolicy( 0 ) - , mActionShowTrustedCAs( 0 ) + , mActionDefaultTrustPolicy( nullptr ) + , mActionShowTrustedCAs( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { diff --git a/src/gui/auth/qgsauthauthoritieseditor.h b/src/gui/auth/qgsauthauthoritieseditor.h index be7382d1069..92e95c2ed5f 100644 --- a/src/gui/auth/qgsauthauthoritieseditor.h +++ b/src/gui/auth/qgsauthauthoritieseditor.h @@ -39,7 +39,7 @@ class GUI_EXPORT QgsAuthAuthoritiesEditor : public QWidget, private Ui::QgsAuthA * Widget for viewing and editing certificate authorities directly in database * @param parent Parent widget */ - explicit QgsAuthAuthoritiesEditor( QWidget *parent = 0 ); + explicit QgsAuthAuthoritiesEditor( QWidget *parent = nullptr ); ~QgsAuthAuthoritiesEditor(); private slots: @@ -105,11 +105,11 @@ class GUI_EXPORT QgsAuthAuthoritiesEditor : public QWidget, private Ui::QgsAuthA void appendCertsToGroup( const QList& certs, QgsAuthAuthoritiesEditor::CaType catype, - QTreeWidgetItem *parent = 0 ); + QTreeWidgetItem *parent = nullptr ); void appendCertsToItem( const QList& certs, QgsAuthAuthoritiesEditor::CaType catype, - QTreeWidgetItem *parent = 0 ); + QTreeWidgetItem *parent = nullptr ); void updateCertTrustPolicyCache(); diff --git a/src/gui/auth/qgsauthcertificateinfo.cpp b/src/gui/auth/qgsauthcertificateinfo.cpp index c6dff2a660e..1c708c24200 100644 --- a/src/gui/auth/qgsauthcertificateinfo.cpp +++ b/src/gui/auth/qgsauthcertificateinfo.cpp @@ -59,16 +59,16 @@ QgsAuthCertInfo::QgsAuthCertInfo( const QSslCertificate& cert, , mTrustCacheRebuilt( false ) , mDefaultTrustPolicy( QgsAuthCertUtils::DefaultTrust ) , mCurrentTrustPolicy( QgsAuthCertUtils::DefaultTrust ) - , mSecGeneral( 0 ) - , mSecDetails( 0 ) - , mSecPemText( 0 ) - , mGrpSubj( 0 ) - , mGrpIssu( 0 ) - , mGrpCert( 0 ) - , mGrpPkey( 0 ) - , mGrpExts( 0 ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) + , mSecGeneral( nullptr ) + , mSecDetails( nullptr ) + , mSecPemText( nullptr ) + , mGrpSubj( nullptr ) + , mGrpIssu( nullptr ) + , mGrpCert( nullptr ) + , mGrpPkey( nullptr ) + , mGrpExts( nullptr ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { @@ -230,8 +230,8 @@ void QgsAuthCertInfo::setCertHierarchy() QListIterator it( mQCertChain ); it.toBack(); int i = mQCertChain.size(); - QTreeWidgetItem * item = 0; - QTreeWidgetItem * previtem = 0; + QTreeWidgetItem * item = nullptr; + QTreeWidgetItem * previtem = nullptr; while ( it.hasPrevious() ) { QSslCertificate cert( it.previous() ); @@ -851,7 +851,7 @@ void QgsAuthCertInfo::on_btnSaveTrust_clicked() QgsDebugMsg( "Could not set trust policy for certificate" ); } mCurrentTrustPolicy = newpolicy; - decorateCertTreeItem( mCurrentQCert, newpolicy, 0 ); + decorateCertTreeItem( mCurrentQCert, newpolicy, nullptr ); btnSaveTrust->setEnabled( false ); // rebuild trust cache @@ -921,7 +921,7 @@ QgsAuthCertInfoDialog::QgsAuthCertInfoDialog( const QSslCertificate& cert, QWidget *parent , const QList& connectionCAs ) : QDialog( parent ) - , mCertInfoWdgt( 0 ) + , mCertInfoWdgt( nullptr ) { setWindowTitle( tr( "Certificate Information" ) ); QVBoxLayout *layout = new QVBoxLayout( this ); diff --git a/src/gui/auth/qgsauthcertificateinfo.h b/src/gui/auth/qgsauthcertificateinfo.h index 2f012200dd5..9b725db62d1 100644 --- a/src/gui/auth/qgsauthcertificateinfo.h +++ b/src/gui/auth/qgsauthcertificateinfo.h @@ -40,7 +40,7 @@ class GUI_EXPORT QgsAuthCertInfo : public QWidget, private Ui::QgsAuthCertInfo public: explicit QgsAuthCertInfo( const QSslCertificate& cert, bool manageCertTrust = false, - QWidget *parent = 0, + QWidget *parent = nullptr, const QList& connectionCAs = QList() ); ~QgsAuthCertInfo(); @@ -59,7 +59,7 @@ class GUI_EXPORT QgsAuthCertInfo : public QWidget, private Ui::QgsAuthCertInfo void decorateCertTreeItem( const QSslCertificate& cert, QgsAuthCertUtils::CertTrustPolicy trustpolicy, - QTreeWidgetItem * item = 0 ); + QTreeWidgetItem * item = nullptr ); private: enum DetailsType @@ -151,7 +151,7 @@ class GUI_EXPORT QgsAuthCertInfoDialog : public QDialog */ explicit QgsAuthCertInfoDialog( const QSslCertificate& cert, bool manageCertTrust, - QWidget *parent = 0, + QWidget *parent = nullptr, const QList& connectionCAs = QList() ); ~QgsAuthCertInfoDialog(); diff --git a/src/gui/auth/qgsauthcertificatemanager.h b/src/gui/auth/qgsauthcertificatemanager.h index cdc084b1363..55b5994be0d 100644 --- a/src/gui/auth/qgsauthcertificatemanager.h +++ b/src/gui/auth/qgsauthcertificatemanager.h @@ -35,7 +35,7 @@ class GUI_EXPORT QgsAuthCertEditors : public QWidget, private Ui::QgsAuthCertMan * Construct a widget to contain various certificate editors * @param parent Parent widget */ - explicit QgsAuthCertEditors( QWidget *parent = 0 ); + explicit QgsAuthCertEditors( QWidget *parent = nullptr ); ~QgsAuthCertEditors(); }; @@ -55,7 +55,7 @@ class GUI_EXPORT QgsAuthCertManager : public QDialog * Construct a dialog wrapper for widget to manage available certificate editors * @param parent Parent widget */ - explicit QgsAuthCertManager( QWidget *parent = 0 ); + explicit QgsAuthCertManager( QWidget *parent = nullptr ); ~QgsAuthCertManager(); diff --git a/src/gui/auth/qgsauthcerttrustpolicycombobox.h b/src/gui/auth/qgsauthcerttrustpolicycombobox.h index 9aad6d36cbf..ff64c344328 100644 --- a/src/gui/auth/qgsauthcerttrustpolicycombobox.h +++ b/src/gui/auth/qgsauthcerttrustpolicycombobox.h @@ -35,7 +35,7 @@ class GUI_EXPORT QgsAuthCertTrustPolicyComboBox : public QComboBox * @param defaultpolicy Default trust policy */ explicit QgsAuthCertTrustPolicyComboBox( - QWidget *parent = 0, + QWidget *parent = nullptr, QgsAuthCertUtils::CertTrustPolicy policy = QgsAuthCertUtils::DefaultTrust, QgsAuthCertUtils::CertTrustPolicy defaultpolicy = QgsAuthCertUtils::DefaultTrust ); ~QgsAuthCertTrustPolicyComboBox(); diff --git a/src/gui/auth/qgsauthconfigedit.cpp b/src/gui/auth/qgsauthconfigedit.cpp index 954daa9cb65..b57278286f5 100644 --- a/src/gui/auth/qgsauthconfigedit.cpp +++ b/src/gui/auth/qgsauthconfigedit.cpp @@ -29,8 +29,8 @@ QgsAuthConfigEdit::QgsAuthConfigEdit( QWidget *parent , const QString& authcfg , : QDialog( parent ) , mAuthCfg( authcfg ) , mDataProvider( dataprovider ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) { bool disabled = QgsAuthManager::instance()->isDisabled(); bool idok = true; diff --git a/src/gui/auth/qgsauthconfigedit.h b/src/gui/auth/qgsauthconfigedit.h index 3426c457101..288b5b13c29 100644 --- a/src/gui/auth/qgsauthconfigedit.h +++ b/src/gui/auth/qgsauthconfigedit.h @@ -48,7 +48,7 @@ class GUI_EXPORT QgsAuthConfigEdit : public QDialog, private Ui::QgsAuthConfigEd * @param authcfg Authentication config id for a existing config in auth database * @param dataprovider The provider origin of the edit, to allow for customized code and filtering */ - explicit QgsAuthConfigEdit( QWidget *parent = 0, const QString& authcfg = QString(), + explicit QgsAuthConfigEdit( QWidget *parent = nullptr, const QString& authcfg = QString(), const QString &dataprovider = QString() ); ~QgsAuthConfigEdit(); diff --git a/src/gui/auth/qgsauthconfigeditor.cpp b/src/gui/auth/qgsauthconfigeditor.cpp index 714380488fc..d12acf8de30 100644 --- a/src/gui/auth/qgsauthconfigeditor.cpp +++ b/src/gui/auth/qgsauthconfigeditor.cpp @@ -29,17 +29,17 @@ QgsAuthConfigEditor::QgsAuthConfigEditor( QWidget *parent, bool showUtilities, bool relayMessages ) : QWidget( parent ) , mRelayMessages( relayMessages ) - , mConfigModel( 0 ) - , mAuthUtilitiesMenu( 0 ) - , mActionSetMasterPassword( 0 ) - , mActionClearCachedMasterPassword( 0 ) - , mActionResetMasterPassword( 0 ) - , mActionClearCachedAuthConfigs( 0 ) - , mActionRemoveAuthConfigs( 0 ) - , mActionEraseAuthDatabase( 0 ) + , mConfigModel( nullptr ) + , mAuthUtilitiesMenu( nullptr ) + , mActionSetMasterPassword( nullptr ) + , mActionClearCachedMasterPassword( nullptr ) + , mActionResetMasterPassword( nullptr ) + , mActionClearCachedAuthConfigs( nullptr ) + , mActionRemoveAuthConfigs( nullptr ) + , mActionEraseAuthDatabase( nullptr ) , mDisabled( false ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { diff --git a/src/gui/auth/qgsauthconfigeditor.h b/src/gui/auth/qgsauthconfigeditor.h index bc74e490a3f..c10510685c7 100644 --- a/src/gui/auth/qgsauthconfigeditor.h +++ b/src/gui/auth/qgsauthconfigeditor.h @@ -39,7 +39,7 @@ class GUI_EXPORT QgsAuthConfigEditor : public QWidget, private Ui::QgsAuthConfig * @param showUtilities Whether to show the widget's utilities button * @param relayMessages Whether to relay auth manager messages to internal message bar */ - explicit QgsAuthConfigEditor( QWidget *parent = 0, bool showUtilities = true, bool relayMessages = true ); + explicit QgsAuthConfigEditor( QWidget *parent = nullptr, bool showUtilities = true, bool relayMessages = true ); ~QgsAuthConfigEditor(); /** Hide the widget's title, e.g. when embedding */ diff --git a/src/gui/auth/qgsauthconfigidedit.h b/src/gui/auth/qgsauthconfigidedit.h index cfb7a3b29c7..1ecf0b8bbea 100644 --- a/src/gui/auth/qgsauthconfigidedit.h +++ b/src/gui/auth/qgsauthconfigidedit.h @@ -36,7 +36,7 @@ class GUI_EXPORT QgsAuthConfigIdEdit : public QWidget, private Ui::QgsAuthConfig * @param authcfg Authentication configuration ID * @param allowEmpty Whether to allow no ID to be set, even when editing, e.g. Add config functions */ - explicit QgsAuthConfigIdEdit( QWidget *parent = 0, const QString &authcfg = QString(), bool allowEmpty = true ); + explicit QgsAuthConfigIdEdit( QWidget *parent = nullptr, const QString &authcfg = QString(), bool allowEmpty = true ); ~QgsAuthConfigIdEdit(); /** The authentication configuration ID, if valid, otherwise null QString */ diff --git a/src/gui/auth/qgsauthconfigselect.cpp b/src/gui/auth/qgsauthconfigselect.cpp index 6193bb03be6..45472bc0633 100644 --- a/src/gui/auth/qgsauthconfigselect.cpp +++ b/src/gui/auth/qgsauthconfigselect.cpp @@ -34,8 +34,8 @@ QgsAuthConfigSelect::QgsAuthConfigSelect( QWidget *parent, const QString &datapr , mDataProvider( dataprovider ) , mConfigs( QgsAuthMethodConfigsMap() ) , mDisabled( false ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { @@ -257,8 +257,8 @@ QgsAuthConfigUriEdit::QgsAuthConfigUriEdit( QWidget *parent, const QString &data , mDataUri( QString() ) , mDataUriOrig( QString() ) , mDisabled( false ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { diff --git a/src/gui/auth/qgsauthconfigselect.h b/src/gui/auth/qgsauthconfigselect.h index 7cda02c3524..ff5de81cb96 100644 --- a/src/gui/auth/qgsauthconfigselect.h +++ b/src/gui/auth/qgsauthconfigselect.h @@ -37,7 +37,7 @@ class GUI_EXPORT QgsAuthConfigSelect : public QWidget, private Ui::QgsAuthConfig * @param parent Parent widget * @param dataprovider The key of the calling layer provider, if applicable */ - explicit QgsAuthConfigSelect( QWidget *parent = 0, const QString &dataprovider = QString() ); + explicit QgsAuthConfigSelect( QWidget *parent = nullptr, const QString &dataprovider = QString() ); ~QgsAuthConfigSelect(); /** Set the authentication config id for the resource */ @@ -112,7 +112,7 @@ class GUI_EXPORT QgsAuthConfigUriEdit : public QDialog, private Ui::QgsAuthConfi * @param datauri URI QString with of without an authcfg=ID string * @param dataprovider The key of the calling layer provider, if applicable */ - explicit QgsAuthConfigUriEdit( QWidget *parent = 0, + explicit QgsAuthConfigUriEdit( QWidget *parent = nullptr, const QString &datauri = QString(), const QString &dataprovider = QString() ); ~QgsAuthConfigUriEdit(); diff --git a/src/gui/auth/qgsautheditorwidgets.cpp b/src/gui/auth/qgsautheditorwidgets.cpp index 8eb589e660e..dd83fbc0397 100644 --- a/src/gui/auth/qgsautheditorwidgets.cpp +++ b/src/gui/auth/qgsautheditorwidgets.cpp @@ -30,8 +30,8 @@ QgsAuthMethodPlugins::QgsAuthMethodPlugins( QWidget *parent ) : QDialog( parent ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { @@ -104,13 +104,13 @@ void QgsAuthMethodPlugins::populateTable() QgsAuthEditorWidgets::QgsAuthEditorWidgets( QWidget *parent ) : QWidget( parent ) - , mAuthUtilitiesMenu( 0 ) - , mActionSetMasterPassword( 0 ) - , mActionClearCachedMasterPassword( 0 ) - , mActionResetMasterPassword( 0 ) - , mActionClearCachedAuthConfigs( 0 ) - , mActionRemoveAuthConfigs( 0 ) - , mActionEraseAuthDatabase( 0 ) + , mAuthUtilitiesMenu( nullptr ) + , mActionSetMasterPassword( nullptr ) + , mActionClearCachedMasterPassword( nullptr ) + , mActionResetMasterPassword( nullptr ) + , mActionClearCachedAuthConfigs( nullptr ) + , mActionRemoveAuthConfigs( nullptr ) + , mActionEraseAuthDatabase( nullptr ) { setupUi( this ); if ( !QgsAuthManager::instance()->isDisabled() ) diff --git a/src/gui/auth/qgsautheditorwidgets.h b/src/gui/auth/qgsautheditorwidgets.h index e1554eb5446..4fe1dd55155 100644 --- a/src/gui/auth/qgsautheditorwidgets.h +++ b/src/gui/auth/qgsautheditorwidgets.h @@ -33,7 +33,7 @@ class GUI_EXPORT QgsAuthMethodPlugins : public QDialog, private Ui::QgsAuthMetho * Construct a dialog for viewing available authentication method plugins * @param parent Parent widget */ - explicit QgsAuthMethodPlugins( QWidget *parent = 0 ); + explicit QgsAuthMethodPlugins( QWidget *parent = nullptr ); ~QgsAuthMethodPlugins(); @@ -60,7 +60,7 @@ class GUI_EXPORT QgsAuthEditorWidgets : public QWidget, private Ui::QgsAuthEdito * Construct a widget to contain various authentication editors * @param parent Parent widget */ - explicit QgsAuthEditorWidgets( QWidget *parent = 0 ); + explicit QgsAuthEditorWidgets( QWidget *parent = nullptr ); ~QgsAuthEditorWidgets(); diff --git a/src/gui/auth/qgsauthguiutils.h b/src/gui/auth/qgsauthguiutils.h index 4ae42516a52..abbffa8f334 100644 --- a/src/gui/auth/qgsauthguiutils.h +++ b/src/gui/auth/qgsauthguiutils.h @@ -62,16 +62,16 @@ class GUI_EXPORT QgsAuthGuiUtils static void clearCachedMasterPassword( QgsMessageBar *msgbar, int timeout = 0 ); /** Reset the cached master password, updating its hash in authentication database and reseting all existing configs to use it */ - static void resetMasterPassword( QgsMessageBar *msgbar, int timeout = 0, QWidget *parent = 0 ); + static void resetMasterPassword( QgsMessageBar *msgbar, int timeout = 0, QWidget *parent = nullptr ); /** Clear all cached authentication configs for session */ static void clearCachedAuthenticationConfigs( QgsMessageBar *msgbar, int timeout = 0 ); /** Remove all authentication configs */ - static void removeAuthenticationConfigs( QgsMessageBar *msgbar, int timeout = 0, QWidget *parent = 0 ); + static void removeAuthenticationConfigs( QgsMessageBar *msgbar, int timeout = 0, QWidget *parent = nullptr ); /** Completely clear out the authentication database (configs and master password) */ - static void eraseAuthenticationDatabase( QgsMessageBar *msgbar, int timeout = 0, QWidget *parent = 0 ); + static void eraseAuthenticationDatabase( QgsMessageBar *msgbar, int timeout = 0, QWidget *parent = nullptr ); /** Color a widget via a stylesheet if a file path is found or not */ static void fileFound( bool found, QWidget * widget ); diff --git a/src/gui/auth/qgsauthidentitieseditor.cpp b/src/gui/auth/qgsauthidentitieseditor.cpp index 61cceae4510..d56ea6273ef 100644 --- a/src/gui/auth/qgsauthidentitieseditor.cpp +++ b/src/gui/auth/qgsauthidentitieseditor.cpp @@ -33,9 +33,9 @@ QgsAuthIdentitiesEditor::QgsAuthIdentitiesEditor( QWidget *parent ) : QWidget( parent ) , mDisabled( false ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) - , mRootCertIdentItem( 0 ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) + , mRootCertIdentItem( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { diff --git a/src/gui/auth/qgsauthidentitieseditor.h b/src/gui/auth/qgsauthidentitieseditor.h index b58dfffd4a3..3ed92095859 100644 --- a/src/gui/auth/qgsauthidentitieseditor.h +++ b/src/gui/auth/qgsauthidentitieseditor.h @@ -37,7 +37,7 @@ class GUI_EXPORT QgsAuthIdentitiesEditor : public QWidget, private Ui::QgsAuthId * Widget for editing authentication configurations directly in database * @param parent Parent widget */ - explicit QgsAuthIdentitiesEditor( QWidget *parent = 0 ); + explicit QgsAuthIdentitiesEditor( QWidget *parent = nullptr ); ~QgsAuthIdentitiesEditor(); private slots: @@ -85,11 +85,11 @@ class GUI_EXPORT QgsAuthIdentitiesEditor : public QWidget, private Ui::QgsAuthId void appendIdentitiesToGroup( const QList& certs, QgsAuthIdentitiesEditor::IdentityType identype, - QTreeWidgetItem *parent = 0 ); + QTreeWidgetItem *parent = nullptr ); void appendIdentitiesToItem( const QList& certs, QgsAuthIdentitiesEditor::IdentityType identype, - QTreeWidgetItem *parent = 0 ); + QTreeWidgetItem *parent = nullptr ); QgsMessageBar * messageBar(); int messageTimeout(); diff --git a/src/gui/auth/qgsauthimportcertdialog.cpp b/src/gui/auth/qgsauthimportcertdialog.cpp index 5e5c8b58eb0..6386371fe8a 100644 --- a/src/gui/auth/qgsauthimportcertdialog.cpp +++ b/src/gui/auth/qgsauthimportcertdialog.cpp @@ -36,8 +36,8 @@ QgsAuthImportCertDialog::QgsAuthImportCertDialog( QWidget *parent , , mFilter( filter ) , mInput( input ) , mDisabled( false ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { diff --git a/src/gui/auth/qgsauthimportcertdialog.h b/src/gui/auth/qgsauthimportcertdialog.h index a8293163b35..48e7fba5d4f 100644 --- a/src/gui/auth/qgsauthimportcertdialog.h +++ b/src/gui/auth/qgsauthimportcertdialog.h @@ -54,7 +54,7 @@ class GUI_EXPORT QgsAuthImportCertDialog : public QDialog, private Ui::QgsAuthIm * @param filter Certificate type filter to apply to dialog * @param input Type of input(s) for certificates */ - explicit QgsAuthImportCertDialog( QWidget *parent = 0, + explicit QgsAuthImportCertDialog( QWidget *parent = nullptr, QgsAuthImportCertDialog::CertFilter filter = NoFilter, QgsAuthImportCertDialog::CertInput input = AllInputs ); ~QgsAuthImportCertDialog(); diff --git a/src/gui/auth/qgsauthimportidentitydialog.cpp b/src/gui/auth/qgsauthimportidentitydialog.cpp index 58b22358039..683aa4c40c6 100644 --- a/src/gui/auth/qgsauthimportidentitydialog.cpp +++ b/src/gui/auth/qgsauthimportidentitydialog.cpp @@ -55,8 +55,8 @@ QgsAuthImportIdentityDialog::QgsAuthImportIdentityDialog( QgsAuthImportIdentityD , mIdentityType( CertIdentity ) , mPkiBundle( QgsPkiBundle() ) , mDisabled( false ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { diff --git a/src/gui/auth/qgsauthimportidentitydialog.h b/src/gui/auth/qgsauthimportidentitydialog.h index f1f0ff59deb..da15ae573bd 100644 --- a/src/gui/auth/qgsauthimportidentitydialog.h +++ b/src/gui/auth/qgsauthimportidentitydialog.h @@ -60,7 +60,7 @@ class GUI_EXPORT QgsAuthImportIdentityDialog : public QDialog, private Ui::QgsAu * @param parent Parent widget */ explicit QgsAuthImportIdentityDialog( QgsAuthImportIdentityDialog::IdentityType identitytype, - QWidget *parent = 0 ); + QWidget *parent = nullptr ); ~QgsAuthImportIdentityDialog(); /** Get identity type */ diff --git a/src/gui/auth/qgsauthmasterpassresetdialog.cpp b/src/gui/auth/qgsauthmasterpassresetdialog.cpp index 61c644eb73a..ef38140b4b0 100644 --- a/src/gui/auth/qgsauthmasterpassresetdialog.cpp +++ b/src/gui/auth/qgsauthmasterpassresetdialog.cpp @@ -28,8 +28,8 @@ QgsMasterPasswordResetDialog::QgsMasterPasswordResetDialog( QWidget *parent ) : QDialog( parent ) , mPassCurOk( false ) , mPassNewOk( false ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { diff --git a/src/gui/auth/qgsauthmasterpassresetdialog.h b/src/gui/auth/qgsauthmasterpassresetdialog.h index d85ed165795..8df36980a99 100644 --- a/src/gui/auth/qgsauthmasterpassresetdialog.h +++ b/src/gui/auth/qgsauthmasterpassresetdialog.h @@ -35,7 +35,7 @@ class GUI_EXPORT QgsMasterPasswordResetDialog : public QDialog, private Ui::QgsM Q_OBJECT public: - explicit QgsMasterPasswordResetDialog( QWidget *parent = 0 ); + explicit QgsMasterPasswordResetDialog( QWidget *parent = nullptr ); ~QgsMasterPasswordResetDialog(); bool requestMasterPasswordReset( QString *newpass, QString *oldpass, bool *keepbackup ); diff --git a/src/gui/auth/qgsauthmethodedit.h b/src/gui/auth/qgsauthmethodedit.h index 347bc57d2b9..e621fa783ff 100644 --- a/src/gui/auth/qgsauthmethodedit.h +++ b/src/gui/auth/qgsauthmethodedit.h @@ -59,7 +59,7 @@ class GUI_EXPORT QgsAuthMethodEdit : public QWidget * @note Non-public since this is an abstract base class * @param parent Parent widget */ - explicit QgsAuthMethodEdit( QWidget *parent = 0 ) + explicit QgsAuthMethodEdit( QWidget *parent = nullptr ) : QWidget( parent ) {} diff --git a/src/gui/auth/qgsauthserverseditor.cpp b/src/gui/auth/qgsauthserverseditor.cpp index 6cba1b1bc00..e91bef5b4b2 100644 --- a/src/gui/auth/qgsauthserverseditor.cpp +++ b/src/gui/auth/qgsauthserverseditor.cpp @@ -31,9 +31,9 @@ QgsAuthServersEditor::QgsAuthServersEditor( QWidget *parent ) : QWidget( parent ) , mDisabled( false ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) - , mRootSslConfigItem( 0 ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) + , mRootSslConfigItem( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { diff --git a/src/gui/auth/qgsauthserverseditor.h b/src/gui/auth/qgsauthserverseditor.h index c8d611c8432..ed4dc6f1efd 100644 --- a/src/gui/auth/qgsauthserverseditor.h +++ b/src/gui/auth/qgsauthserverseditor.h @@ -36,7 +36,7 @@ class GUI_EXPORT QgsAuthServersEditor : public QWidget, private Ui::QgsAuthServe * Widget for editing authentication configurations directly in database * @param parent Parent Widget */ - explicit QgsAuthServersEditor( QWidget *parent = 0 ); + explicit QgsAuthServersEditor( QWidget *parent = nullptr ); ~QgsAuthServersEditor(); private slots: @@ -83,11 +83,11 @@ class GUI_EXPORT QgsAuthServersEditor : public QWidget, private Ui::QgsAuthServe void appendSslConfigsToGroup( const QList& configs, QgsAuthServersEditor::ConfigType conftype, - QTreeWidgetItem *parent = 0 ); + QTreeWidgetItem *parent = nullptr ); void appendSslConfigsToItem( const QList& configs, QgsAuthServersEditor::ConfigType conftype, - QTreeWidgetItem *parent = 0 ); + QTreeWidgetItem *parent = nullptr ); QgsMessageBar * messageBar(); int messageTimeout(); diff --git a/src/gui/auth/qgsauthsslconfigwidget.cpp b/src/gui/auth/qgsauthsslconfigwidget.cpp index 6cf799f3740..d56c32b2a57 100644 --- a/src/gui/auth/qgsauthsslconfigwidget.cpp +++ b/src/gui/auth/qgsauthsslconfigwidget.cpp @@ -43,19 +43,19 @@ QgsAuthSslConfigWidget::QgsAuthSslConfigWidget( QWidget *parent, const QString &hostport, const QList &connectionCAs ) : QWidget( parent ) - , mCert( 0 ) + , mCert( nullptr ) , mConnectionCAs( connectionCAs ) - , mProtocolItem( 0 ) - , mProtocolCmbBx( 0 ) - , mIgnoreErrorsItem( 0 ) - , mVerifyModeItem( 0 ) - , mVerifyPeerCmbBx( 0 ) - , mVerifyDepthItem( 0 ) - , mVerifyDepthSpnBx( 0 ) + , mProtocolItem( nullptr ) + , mProtocolCmbBx( nullptr ) + , mIgnoreErrorsItem( nullptr ) + , mVerifyModeItem( nullptr ) + , mVerifyPeerCmbBx( nullptr ) + , mVerifyDepthItem( nullptr ) + , mVerifyDepthSpnBx( nullptr ) , mCanSave( false ) , mDisabled( false ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { @@ -96,7 +96,7 @@ QGroupBox *QgsAuthSslConfigWidget::certificateGroupBox() { if ( mDisabled ) { - return 0; + return nullptr; } return grpbxCert; } @@ -105,7 +105,7 @@ QGroupBox *QgsAuthSslConfigWidget::sslConfigGroupBox() { if ( mDisabled ) { - return 0; + return nullptr; } return grpbxSslConfig; } @@ -599,7 +599,7 @@ void QgsAuthSslConfigWidget::on_btnCertInfo_clicked() QgsAuthSslConfigDialog::QgsAuthSslConfigDialog( QWidget *parent , const QSslCertificate& cert , const QString &hostport ) : QDialog( parent ) - , mSslConfigWdgt( 0 ) + , mSslConfigWdgt( nullptr ) { setWindowTitle( tr( "Custom Certificate Configuration" ) ); QVBoxLayout *layout = new QVBoxLayout( this ); diff --git a/src/gui/auth/qgsauthsslconfigwidget.h b/src/gui/auth/qgsauthsslconfigwidget.h index a98ae3fad4d..a287263c278 100644 --- a/src/gui/auth/qgsauthsslconfigwidget.h +++ b/src/gui/auth/qgsauthsslconfigwidget.h @@ -45,7 +45,7 @@ class GUI_EXPORT QgsAuthSslConfigWidget : public QWidget, private Ui::QgsAuthSsl * @param hostport Unique host:port to associate with the server certificate * @param connectionCAs List of trusted Certificate Authorities objects */ - explicit QgsAuthSslConfigWidget( QWidget *parent = 0, + explicit QgsAuthSslConfigWidget( QWidget *parent = nullptr, const QSslCertificate &cert = QSslCertificate(), const QString &hostport = QString(), const QList& connectionCAs = QList() ); @@ -194,7 +194,7 @@ class GUI_EXPORT QgsAuthSslConfigDialog : public QDialog * @param cert SSL server certificate object * @param hostport Unique host:port to associate with the server certificate */ - explicit QgsAuthSslConfigDialog( QWidget *parent = 0, + explicit QgsAuthSslConfigDialog( QWidget *parent = nullptr, const QSslCertificate& cert = QSslCertificate(), const QString &hostport = QString() ); ~QgsAuthSslConfigDialog(); diff --git a/src/gui/auth/qgsauthsslerrorsdialog.h b/src/gui/auth/qgsauthsslerrorsdialog.h index c14c755847a..efb91055c2e 100644 --- a/src/gui/auth/qgsauthsslerrorsdialog.h +++ b/src/gui/auth/qgsauthsslerrorsdialog.h @@ -42,7 +42,7 @@ class GUI_EXPORT QgsAuthSslErrorsDialog : public QDialog, private Ui::QgsAuthSsl */ QgsAuthSslErrorsDialog( QNetworkReply *reply, const QList& sslErrors, - QWidget *parent = 0 , + QWidget *parent = nullptr , const QString &digest = QString(), const QString &hostport = QString() ); ~QgsAuthSslErrorsDialog(); diff --git a/src/gui/auth/qgsauthsslimportdialog.cpp b/src/gui/auth/qgsauthsslimportdialog.cpp index 7d4130e9e38..636b5a7ca68 100644 --- a/src/gui/auth/qgsauthsslimportdialog.cpp +++ b/src/gui/auth/qgsauthsslimportdialog.cpp @@ -82,13 +82,13 @@ QgsAuthSslImportDialog::QgsAuthSslImportDialog( QWidget *parent ) : QDialog( parent ) - , mSocket( 0 ) + , mSocket( nullptr ) , mExecErrorsDialog( false ) - , mTimer( 0 ) + , mTimer( nullptr ) , mSslErrors( QList() ) , mTrustedCAs( QList() ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { @@ -302,7 +302,7 @@ void QgsAuthSslImportDialog::destroySocket() } mSocket->disconnectFromHost(); mSocket->deleteLater(); - mSocket = 0; + mSocket = nullptr; } void QgsAuthSslImportDialog::sslErrors( const QList &errors ) diff --git a/src/gui/auth/qgsauthsslimportdialog.h b/src/gui/auth/qgsauthsslimportdialog.h index b6b49d2d9c1..5f0f5c453d6 100644 --- a/src/gui/auth/qgsauthsslimportdialog.h +++ b/src/gui/auth/qgsauthsslimportdialog.h @@ -84,7 +84,7 @@ class GUI_EXPORT QgsAuthSslImportDialog : public QDialog, private Ui::QgsAuthSsl * Construct dialog for importing certificates * @param parent */ - QgsAuthSslImportDialog( QWidget *parent = 0 ); + QgsAuthSslImportDialog( QWidget *parent = nullptr ); ~QgsAuthSslImportDialog(); public slots: diff --git a/src/gui/auth/qgsauthtrustedcasdialog.cpp b/src/gui/auth/qgsauthtrustedcasdialog.cpp index a67f117b67d..a73338909df 100644 --- a/src/gui/auth/qgsauthtrustedcasdialog.cpp +++ b/src/gui/auth/qgsauthtrustedcasdialog.cpp @@ -32,9 +32,9 @@ QgsAuthTrustedCAsDialog::QgsAuthTrustedCAsDialog( QWidget *parent, : QDialog( parent ) , mTrustedCAs( trustedCAs ) , mDisabled( false ) - , mAuthNotifyLayout( 0 ) - , mAuthNotify( 0 ) - , mRootCaSecItem( 0 ) + , mAuthNotifyLayout( nullptr ) + , mAuthNotify( nullptr ) + , mRootCaSecItem( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { diff --git a/src/gui/auth/qgsauthtrustedcasdialog.h b/src/gui/auth/qgsauthtrustedcasdialog.h index 7e127215650..89ceef1f063 100644 --- a/src/gui/auth/qgsauthtrustedcasdialog.h +++ b/src/gui/auth/qgsauthtrustedcasdialog.h @@ -39,7 +39,7 @@ class GUI_EXPORT QgsAuthTrustedCAsDialog : public QDialog, private Ui::QgsAuthTr * @param parent Parent widget * @param trustedCAs List of trusted Certificate Authorities objects */ - explicit QgsAuthTrustedCAsDialog( QWidget *parent = 0, + explicit QgsAuthTrustedCAsDialog( QWidget *parent = nullptr, const QList& trustedCAs = QList() ); ~QgsAuthTrustedCAsDialog(); @@ -82,11 +82,11 @@ class GUI_EXPORT QgsAuthTrustedCAsDialog : public QDialog, private Ui::QgsAuthTr void appendCertsToGroup( const QList& certs, QgsAuthTrustedCAsDialog::CaType catype, - QTreeWidgetItem *parent = 0 ); + QTreeWidgetItem *parent = nullptr ); void appendCertsToItem( const QList& certs, QgsAuthTrustedCAsDialog::CaType catype, - QTreeWidgetItem *parent = 0 ); + QTreeWidgetItem *parent = nullptr ); QgsMessageBar * messageBar(); int messageTimeout(); diff --git a/src/gui/editorwidgets/core/qgseditorwidgetregistry.cpp b/src/gui/editorwidgets/core/qgseditorwidgetregistry.cpp index 841c113c519..c6f209e6f60 100644 --- a/src/gui/editorwidgets/core/qgseditorwidgetregistry.cpp +++ b/src/gui/editorwidgets/core/qgseditorwidgetregistry.cpp @@ -112,7 +112,7 @@ QgsEditorWidgetWrapper* QgsEditorWidgetRegistry::create( const QString& widgetId } } - return 0; + return nullptr; } QgsSearchWidgetWrapper* QgsEditorWidgetRegistry::createSearchWidget( const QString& widgetId, QgsVectorLayer* vl, int fieldIdx, const QgsEditorWidgetConfig& config, QWidget* parent, const QgsAttributeEditorContext &context ) @@ -131,7 +131,7 @@ QgsSearchWidgetWrapper* QgsEditorWidgetRegistry::createSearchWidget( const QStri return ww; } } - return 0; + return nullptr; } QgsEditorConfigWidget* QgsEditorWidgetRegistry::createConfigWidget( const QString& widgetId, QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) @@ -140,7 +140,7 @@ QgsEditorConfigWidget* QgsEditorWidgetRegistry::createConfigWidget( const QStrin { return mWidgetFactories[widgetId]->configWidget( vl, fieldIdx, parent ); } - return 0; + return nullptr; } QString QgsEditorWidgetRegistry::name( const QString& widgetId ) diff --git a/src/gui/editorwidgets/core/qgseditorwidgetregistry.h b/src/gui/editorwidgets/core/qgseditorwidgetregistry.h index 825d6163c1b..687d01be09b 100644 --- a/src/gui/editorwidgets/core/qgseditorwidgetregistry.h +++ b/src/gui/editorwidgets/core/qgseditorwidgetregistry.h @@ -52,7 +52,7 @@ class GUI_EXPORT QgsEditorWidgetRegistry : public QObject * @note Added in QGIS 2.8 * @note Not required for plugins, the QGIS application does that already */ - static void initEditors( QgsMapCanvas* mapCanvas = 0, QgsMessageBar* messageBar = 0 ); + static void initEditors( QgsMapCanvas* mapCanvas = nullptr, QgsMessageBar* messageBar = nullptr ); /** * Destructor diff --git a/src/gui/editorwidgets/core/qgseditorwidgetwrapper.h b/src/gui/editorwidgets/core/qgseditorwidgetwrapper.h index d1598061d73..2c403b1863e 100644 --- a/src/gui/editorwidgets/core/qgseditorwidgetwrapper.h +++ b/src/gui/editorwidgets/core/qgseditorwidgetwrapper.h @@ -50,7 +50,7 @@ class GUI_EXPORT QgsEditorWidgetWrapper : public QgsWidgetWrapper * @param editor An editor widget. Can be NULL if one should be autogenerated. * @param parent A parent widget for this widget wrapper and the created widget. */ - explicit QgsEditorWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsEditorWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = nullptr, QWidget* parent = nullptr ); /** * Will be used to access the widget's value. Read the value from the widget and diff --git a/src/gui/editorwidgets/core/qgssearchwidgetwrapper.cpp b/src/gui/editorwidgets/core/qgssearchwidgetwrapper.cpp index 74965e515ad..9d4a1841ffc 100644 --- a/src/gui/editorwidgets/core/qgssearchwidgetwrapper.cpp +++ b/src/gui/editorwidgets/core/qgssearchwidgetwrapper.cpp @@ -21,7 +21,7 @@ #include QgsSearchWidgetWrapper::QgsSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) - : QgsWidgetWrapper( vl, 0, parent ) + : QgsWidgetWrapper( vl, nullptr, parent ) , mExpression( QString() ) , mFieldIdx( fieldIdx ) { diff --git a/src/gui/editorwidgets/core/qgssearchwidgetwrapper.h b/src/gui/editorwidgets/core/qgssearchwidgetwrapper.h index 83d8ca72ef7..c9c46e4e05d 100644 --- a/src/gui/editorwidgets/core/qgssearchwidgetwrapper.h +++ b/src/gui/editorwidgets/core/qgssearchwidgetwrapper.h @@ -49,7 +49,7 @@ class GUI_EXPORT QgsSearchWidgetWrapper : public QgsWidgetWrapper * @param fieldIdx The field which will be controlled * @param parent A parent widget for this widget wrapper and the created widget. */ - explicit QgsSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent = 0 ); + explicit QgsSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent = nullptr ); /** * Will be used to access the widget's value. Read the value from the widget and diff --git a/src/gui/editorwidgets/core/qgswidgetwrapper.h b/src/gui/editorwidgets/core/qgswidgetwrapper.h index be920e83c15..e09605f7597 100644 --- a/src/gui/editorwidgets/core/qgswidgetwrapper.h +++ b/src/gui/editorwidgets/core/qgswidgetwrapper.h @@ -47,7 +47,7 @@ class GUI_EXPORT QgsWidgetWrapper : public QObject * @param editor An editor widget. Can be NULL if one should be autogenerated. * @param parent A parent widget for this widget wrapper and the created widget. */ - explicit QgsWidgetWrapper( QgsVectorLayer* vl, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsWidgetWrapper( QgsVectorLayer* vl, QWidget* editor = nullptr, QWidget* parent = nullptr ); /** * @brief Access the widget managed by this wrapper diff --git a/src/gui/editorwidgets/qgscheckboxconfigdlg.h b/src/gui/editorwidgets/qgscheckboxconfigdlg.h index a45fa0f7922..c7609412b06 100644 --- a/src/gui/editorwidgets/qgscheckboxconfigdlg.h +++ b/src/gui/editorwidgets/qgscheckboxconfigdlg.h @@ -28,7 +28,7 @@ class GUI_EXPORT QgsCheckBoxConfigDlg : public QgsEditorConfigWidget, private Ui Q_OBJECT public: - explicit QgsCheckBoxConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget *parent = 0 ); + explicit QgsCheckBoxConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget *parent = nullptr ); // QgsEditorConfigWidget interface public: diff --git a/src/gui/editorwidgets/qgscheckboxwidgetwrapper.cpp b/src/gui/editorwidgets/qgscheckboxwidgetwrapper.cpp index 289be91fed5..6dbe80d921f 100644 --- a/src/gui/editorwidgets/qgscheckboxwidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgscheckboxwidgetwrapper.cpp @@ -17,8 +17,8 @@ QgsCheckboxWidgetWrapper::QgsCheckboxWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mCheckBox( NULL ) - , mGroupBox( NULL ) + , mCheckBox( nullptr ) + , mGroupBox( nullptr ) { } diff --git a/src/gui/editorwidgets/qgscheckboxwidgetwrapper.h b/src/gui/editorwidgets/qgscheckboxwidgetwrapper.h index e2b04000a0d..84ee64d61d2 100644 --- a/src/gui/editorwidgets/qgscheckboxwidgetwrapper.h +++ b/src/gui/editorwidgets/qgscheckboxwidgetwrapper.h @@ -37,7 +37,7 @@ class GUI_EXPORT QgsCheckboxWidgetWrapper : public QgsEditorWidgetWrapper { Q_OBJECT public: - explicit QgsCheckboxWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsCheckboxWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = nullptr, QWidget* parent = nullptr ); // QgsEditorWidgetWrapper interface public: diff --git a/src/gui/editorwidgets/qgsclassificationwidgetwrapper.cpp b/src/gui/editorwidgets/qgsclassificationwidgetwrapper.cpp index d8392eaa57c..24c5804a2db 100644 --- a/src/gui/editorwidgets/qgsclassificationwidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsclassificationwidgetwrapper.cpp @@ -20,7 +20,7 @@ QgsClassificationWidgetWrapper::QgsClassificationWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mComboBox( NULL ) + , mComboBox( nullptr ) { } diff --git a/src/gui/editorwidgets/qgsclassificationwidgetwrapper.h b/src/gui/editorwidgets/qgsclassificationwidgetwrapper.h index 2673f27609e..a7fd956a3e4 100644 --- a/src/gui/editorwidgets/qgsclassificationwidgetwrapper.h +++ b/src/gui/editorwidgets/qgsclassificationwidgetwrapper.h @@ -28,7 +28,7 @@ class GUI_EXPORT QgsClassificationWidgetWrapper : public QgsEditorWidgetWrapper { Q_OBJECT public: - explicit QgsClassificationWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsClassificationWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = nullptr, QWidget* parent = nullptr ); // QgsEditorWidgetWrapper interface public: diff --git a/src/gui/editorwidgets/qgscolorwidgetwrapper.cpp b/src/gui/editorwidgets/qgscolorwidgetwrapper.cpp index 5e0708a7554..2aff246498f 100644 --- a/src/gui/editorwidgets/qgscolorwidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgscolorwidgetwrapper.cpp @@ -17,7 +17,7 @@ QgsColorWidgetWrapper::QgsColorWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mColorButton( NULL ) + , mColorButton( nullptr ) { } diff --git a/src/gui/editorwidgets/qgscolorwidgetwrapper.h b/src/gui/editorwidgets/qgscolorwidgetwrapper.h index c66b85aa3db..092d6296f3d 100644 --- a/src/gui/editorwidgets/qgscolorwidgetwrapper.h +++ b/src/gui/editorwidgets/qgscolorwidgetwrapper.h @@ -30,7 +30,7 @@ class GUI_EXPORT QgsColorWidgetWrapper : public QgsEditorWidgetWrapper { Q_OBJECT public: - explicit QgsColorWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsColorWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = nullptr, QWidget* parent = nullptr ); // QgsEditorWidgetWrapper interface public: diff --git a/src/gui/editorwidgets/qgsdatetimeedit.h b/src/gui/editorwidgets/qgsdatetimeedit.h index 0587531d8c2..0777fa18971 100644 --- a/src/gui/editorwidgets/qgsdatetimeedit.h +++ b/src/gui/editorwidgets/qgsdatetimeedit.h @@ -30,7 +30,7 @@ class GUI_EXPORT QgsDateTimeEdit : public QDateTimeEdit Q_PROPERTY( bool allowNull READ allowNull WRITE setAllowNull ) public: - explicit QgsDateTimeEdit( QWidget *parent = 0 ); + explicit QgsDateTimeEdit( QWidget *parent = nullptr ); //! determines if the widget allows setting null date/time. void setAllowNull( bool allowNull ); diff --git a/src/gui/editorwidgets/qgsdatetimeeditconfig.h b/src/gui/editorwidgets/qgsdatetimeeditconfig.h index 55ad21c17ad..0b0012c54f1 100644 --- a/src/gui/editorwidgets/qgsdatetimeeditconfig.h +++ b/src/gui/editorwidgets/qgsdatetimeeditconfig.h @@ -27,7 +27,7 @@ class GUI_EXPORT QgsDateTimeEditConfig : public QgsEditorConfigWidget, private U { Q_OBJECT public: - QgsDateTimeEditConfig( QgsVectorLayer* vl, int fieldIdx, QWidget* parent = 0 ); + QgsDateTimeEditConfig( QgsVectorLayer* vl, int fieldIdx, QWidget* parent = nullptr ); private slots: void updateDemoWidget(); diff --git a/src/gui/editorwidgets/qgsdatetimeeditwrapper.cpp b/src/gui/editorwidgets/qgsdatetimeeditwrapper.cpp index 946b8230a85..118886d9d90 100644 --- a/src/gui/editorwidgets/qgsdatetimeeditwrapper.cpp +++ b/src/gui/editorwidgets/qgsdatetimeeditwrapper.cpp @@ -27,8 +27,8 @@ QgsDateTimeEditWrapper::QgsDateTimeEditWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mQDateTimeEdit( NULL ) - , mQgsDateTimeEdit( NULL ) + , mQDateTimeEdit( nullptr ) + , mQgsDateTimeEdit( nullptr ) { } diff --git a/src/gui/editorwidgets/qgsdatetimeeditwrapper.h b/src/gui/editorwidgets/qgsdatetimeeditwrapper.h index 450e768fd99..66ffc21b41e 100644 --- a/src/gui/editorwidgets/qgsdatetimeeditwrapper.h +++ b/src/gui/editorwidgets/qgsdatetimeeditwrapper.h @@ -39,7 +39,7 @@ class GUI_EXPORT QgsDateTimeEditWrapper : public QgsEditorWidgetWrapper { Q_OBJECT public: - explicit QgsDateTimeEditWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent = 0 ); + explicit QgsDateTimeEditWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent = nullptr ); private slots: void dateTimeChanged( const QDateTime &dateTime ); diff --git a/src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.cpp b/src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.cpp index 4a7267b1e1d..4a506a21450 100644 --- a/src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.cpp @@ -23,9 +23,9 @@ QgsDefaultSearchWidgetWrapper::QgsDefaultSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) : QgsSearchWidgetWrapper( vl, fieldIdx, parent ) - , mLineEdit( NULL ) - , mCheckbox( NULL ) - , mContainer( NULL ) + , mLineEdit( nullptr ) + , mCheckbox( nullptr ) + , mContainer( nullptr ) , mCaseString( QString( "LIKE" ) ) { } diff --git a/src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.h b/src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.h index e47b1224563..8cbf4ea7549 100644 --- a/src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.h +++ b/src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.h @@ -30,7 +30,7 @@ class GUI_EXPORT QgsDefaultSearchWidgetWrapper : public QgsSearchWidgetWrapper { Q_OBJECT public: - explicit QgsDefaultSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent = 0 ); + explicit QgsDefaultSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent = nullptr ); // QgsSearchWidgetWrapper interface public: diff --git a/src/gui/editorwidgets/qgsdoublespinbox.h b/src/gui/editorwidgets/qgsdoublespinbox.h index a0149a01de8..c00b478076e 100644 --- a/src/gui/editorwidgets/qgsdoublespinbox.h +++ b/src/gui/editorwidgets/qgsdoublespinbox.h @@ -38,7 +38,7 @@ class GUI_EXPORT QgsDoubleSpinBox : public QDoubleSpinBox CustomValue }; - explicit QgsDoubleSpinBox( QWidget *parent = 0 ); + explicit QgsDoubleSpinBox( QWidget *parent = nullptr ); //! determines if the widget will show a clear button //! @note the clear button will set the widget to its minimum value diff --git a/src/gui/editorwidgets/qgsenumerationwidgetwrapper.cpp b/src/gui/editorwidgets/qgsenumerationwidgetwrapper.cpp index dca7140f50b..5de8563f0d9 100644 --- a/src/gui/editorwidgets/qgsenumerationwidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsenumerationwidgetwrapper.cpp @@ -20,7 +20,7 @@ QgsEnumerationWidgetWrapper::QgsEnumerationWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mComboBox( NULL ) + , mComboBox( nullptr ) { } diff --git a/src/gui/editorwidgets/qgsenumerationwidgetwrapper.h b/src/gui/editorwidgets/qgsenumerationwidgetwrapper.h index 45d23d01ab8..f1ea8a1e1f3 100644 --- a/src/gui/editorwidgets/qgsenumerationwidgetwrapper.h +++ b/src/gui/editorwidgets/qgsenumerationwidgetwrapper.h @@ -28,7 +28,7 @@ class GUI_EXPORT QgsEnumerationWidgetWrapper : public QgsEditorWidgetWrapper { Q_OBJECT public: - explicit QgsEnumerationWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsEnumerationWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = nullptr, QWidget* parent = nullptr ); // QgsEditorWidgetWrapper interface public: diff --git a/src/gui/editorwidgets/qgsfilenamewidgetwrapper.cpp b/src/gui/editorwidgets/qgsfilenamewidgetwrapper.cpp index 66748e1539e..fa51bb30081 100644 --- a/src/gui/editorwidgets/qgsfilenamewidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsfilenamewidgetwrapper.cpp @@ -24,9 +24,9 @@ QgsFileNameWidgetWrapper::QgsFileNameWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mLineEdit( NULL ) - , mPushButton( NULL ) - , mLabel( NULL ) + , mLineEdit( nullptr ) + , mPushButton( nullptr ) + , mLabel( nullptr ) { } diff --git a/src/gui/editorwidgets/qgsfilenamewidgetwrapper.h b/src/gui/editorwidgets/qgsfilenamewidgetwrapper.h index be767d3be23..b2e689c02ef 100644 --- a/src/gui/editorwidgets/qgsfilenamewidgetwrapper.h +++ b/src/gui/editorwidgets/qgsfilenamewidgetwrapper.h @@ -32,7 +32,7 @@ class GUI_EXPORT QgsFileNameWidgetWrapper : public QgsEditorWidgetWrapper { Q_OBJECT public: - explicit QgsFileNameWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsFileNameWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = nullptr, QWidget* parent = nullptr ); private slots: void selectFileName(); diff --git a/src/gui/editorwidgets/qgshiddenwidgetwrapper.h b/src/gui/editorwidgets/qgshiddenwidgetwrapper.h index 0858297f0b0..0c74756d7e4 100644 --- a/src/gui/editorwidgets/qgshiddenwidgetwrapper.h +++ b/src/gui/editorwidgets/qgshiddenwidgetwrapper.h @@ -27,7 +27,7 @@ class GUI_EXPORT QgsHiddenWidgetWrapper : public QgsEditorWidgetWrapper { Q_OBJECT public: - explicit QgsHiddenWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsHiddenWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = nullptr, QWidget* parent = nullptr ); // QgsEditorWidgetWrapper interface public: diff --git a/src/gui/editorwidgets/qgsphotoconfigdlg.h b/src/gui/editorwidgets/qgsphotoconfigdlg.h index 6a1d1c41163..59bd55f1fd6 100644 --- a/src/gui/editorwidgets/qgsphotoconfigdlg.h +++ b/src/gui/editorwidgets/qgsphotoconfigdlg.h @@ -29,7 +29,7 @@ class GUI_EXPORT QgsPhotoConfigDlg : public QgsEditorConfigWidget, private Ui::Q Q_OBJECT public: - explicit QgsPhotoConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget *parent = 0 ); + explicit QgsPhotoConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget *parent = nullptr ); // QgsEditorConfigWidget interface public: diff --git a/src/gui/editorwidgets/qgsphotowidgetfactory.cpp b/src/gui/editorwidgets/qgsphotowidgetfactory.cpp index b1357ef064b..29b55e671ae 100644 --- a/src/gui/editorwidgets/qgsphotowidgetfactory.cpp +++ b/src/gui/editorwidgets/qgsphotowidgetfactory.cpp @@ -41,8 +41,8 @@ QgsEditorWidgetConfig QgsPhotoWidgetFactory::readConfig( const QDomElement& conf QgsEditorWidgetConfig cfg; - cfg.insert( "Height", configElement.attribute( "Height", 0 ).toInt() ); - cfg.insert( "Width", configElement.attribute( "Width", 0 ).toInt() ); + cfg.insert( "Height", configElement.attribute( "Height", nullptr ).toInt() ); + cfg.insert( "Width", configElement.attribute( "Width", nullptr ).toInt() ); return cfg; } diff --git a/src/gui/editorwidgets/qgsphotowidgetwrapper.cpp b/src/gui/editorwidgets/qgsphotowidgetwrapper.cpp index 8a173420977..9d74e6e176d 100644 --- a/src/gui/editorwidgets/qgsphotowidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsphotowidgetwrapper.cpp @@ -25,13 +25,13 @@ QgsPhotoWidgetWrapper::QgsPhotoWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mPhotoLabel( 0 ) - , mPhotoPixmapLabel( 0 ) - , mLineEdit( 0 ) - , mButton( 0 ) + , mPhotoLabel( nullptr ) + , mPhotoPixmapLabel( nullptr ) + , mLineEdit( nullptr ) + , mButton( nullptr ) { #ifdef WITH_QTWEBKIT - mWebView = 0; + mWebView = nullptr; #endif } @@ -40,7 +40,7 @@ void QgsPhotoWidgetWrapper::selectFileName() if ( !mLineEdit ) return; - QString fileName = QFileDialog::getOpenFileName( 0, tr( "Select a picture" ), QFileInfo( mLineEdit->text() ).absolutePath() ); + QString fileName = QFileDialog::getOpenFileName( nullptr, tr( "Select a picture" ), QFileInfo( mLineEdit->text() ).absolutePath() ); if ( fileName.isNull() ) return; diff --git a/src/gui/editorwidgets/qgsphotowidgetwrapper.h b/src/gui/editorwidgets/qgsphotowidgetwrapper.h index 6223e08563c..cc4a1e89531 100644 --- a/src/gui/editorwidgets/qgsphotowidgetwrapper.h +++ b/src/gui/editorwidgets/qgsphotowidgetwrapper.h @@ -44,7 +44,7 @@ class GUI_EXPORT QgsPhotoWidgetWrapper : public QgsEditorWidgetWrapper { Q_OBJECT public: - explicit QgsPhotoWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsPhotoWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = nullptr, QWidget* parent = nullptr ); // QgsEditorWidgetWrapper interface public: diff --git a/src/gui/editorwidgets/qgsrangewidgetwrapper.cpp b/src/gui/editorwidgets/qgsrangewidgetwrapper.cpp index afc3aab24da..cf2f9367654 100644 --- a/src/gui/editorwidgets/qgsrangewidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsrangewidgetwrapper.cpp @@ -22,18 +22,18 @@ QgsRangeWidgetWrapper::QgsRangeWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mIntSpinBox( 0 ) - , mDoubleSpinBox( 0 ) - , mSlider( 0 ) - , mDial( 0 ) - , mQgsSlider( 0 ) - , mQgsDial( 0 ) + , mIntSpinBox( nullptr ) + , mDoubleSpinBox( nullptr ) + , mSlider( nullptr ) + , mDial( nullptr ) + , mQgsSlider( nullptr ) + , mQgsDial( nullptr ) { } QWidget* QgsRangeWidgetWrapper::createWidget( QWidget* parent ) { - QWidget* editor = 0; + QWidget* editor = nullptr; if ( config( "Style" ).toString() == "Dial" ) { diff --git a/src/gui/editorwidgets/qgsrangewidgetwrapper.h b/src/gui/editorwidgets/qgsrangewidgetwrapper.h index 7e58b88e67e..e6278b1ba21 100644 --- a/src/gui/editorwidgets/qgsrangewidgetwrapper.h +++ b/src/gui/editorwidgets/qgsrangewidgetwrapper.h @@ -41,7 +41,7 @@ class GUI_EXPORT QgsRangeWidgetWrapper : public QgsEditorWidgetWrapper { Q_OBJECT public: - explicit QgsRangeWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent = 0 ); + explicit QgsRangeWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent = nullptr ); // QgsEditorWidgetWrapper interface public: diff --git a/src/gui/editorwidgets/qgsrelationreferenceconfigdlg.cpp b/src/gui/editorwidgets/qgsrelationreferenceconfigdlg.cpp index 25c47f20313..68c14a0430d 100644 --- a/src/gui/editorwidgets/qgsrelationreferenceconfigdlg.cpp +++ b/src/gui/editorwidgets/qgsrelationreferenceconfigdlg.cpp @@ -37,7 +37,7 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsRelationReferenceConfigDlg::QgsRelationReferenceConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) : QgsEditorConfigWidget( vl, fieldIdx, parent ) - , mReferencedLayer( 0 ) + , mReferencedLayer( nullptr ) { setupUi( this ); diff --git a/src/gui/editorwidgets/qgsrelationreferencewidget.cpp b/src/gui/editorwidgets/qgsrelationreferencewidget.cpp index 332bb9dd97f..c6693e53230 100644 --- a/src/gui/editorwidgets/qgsrelationreferencewidget.cpp +++ b/src/gui/editorwidgets/qgsrelationreferencewidget.cpp @@ -56,23 +56,23 @@ bool orderByLessThan( const QgsRelationReferenceWidget::ValueRelationItem& p1 QgsRelationReferenceWidget::QgsRelationReferenceWidget( QWidget* parent ) : QWidget( parent ) , mEditorContext( QgsAttributeEditorContext() ) - , mCanvas( NULL ) - , mMessageBar( NULL ) + , mCanvas( nullptr ) + , mMessageBar( nullptr ) , mForeignKey( QVariant() ) , mReferencedFieldIdx( -1 ) , mReferencingFieldIdx( -1 ) , mAllowNull( true ) - , mHighlight( NULL ) - , mMapTool( NULL ) - , mMessageBarItem( NULL ) + , mHighlight( nullptr ) + , mMapTool( nullptr ) + , mMessageBarItem( nullptr ) , mRelationName( "" ) - , mReferencedAttributeForm( NULL ) - , mReferencedLayer( NULL ) - , mReferencingLayer( NULL ) - , mMasterModel( 0 ) - , mFilterModel( 0 ) - , mFeatureListModel( 0 ) - , mWindowWidget( NULL ) + , mReferencedAttributeForm( nullptr ) + , mReferencedLayer( nullptr ) + , mReferencingLayer( nullptr ) + , mMasterModel( nullptr ) + , mFilterModel( nullptr ) + , mFeatureListModel( nullptr ) + , mWindowWidget( nullptr ) , mShown( false ) , mIsEditable( true ) , mEmbedForm( false ) @@ -645,7 +645,7 @@ void QgsRelationReferenceWidget::deleteHighlight() mHighlight->hide(); delete mHighlight; } - mHighlight = NULL; + mHighlight = nullptr; } void QgsRelationReferenceWidget::mapIdentification() @@ -756,7 +756,7 @@ void QgsRelationReferenceWidget::mapToolDeactivated() { mMessageBar->popWidget( mMessageBarItem ); } - mMessageBarItem = NULL; + mMessageBarItem = nullptr; } void QgsRelationReferenceWidget::filterChanged() @@ -772,10 +772,10 @@ void QgsRelationReferenceWidget::filterChanged() if ( mChainFilters ) { - QComboBox* ccb = 0; + QComboBox* ccb = nullptr; Q_FOREACH ( QComboBox* cb, mFilterComboBoxes ) { - if ( ccb == 0 ) + if ( ccb == nullptr ) { if ( cb != scb ) continue; diff --git a/src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.cpp b/src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.cpp index 2c716e97c50..db9285fd420 100644 --- a/src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.cpp @@ -21,7 +21,7 @@ QgsRelationReferenceWidgetWrapper::QgsRelationReferenceWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QgsMapCanvas* canvas, QgsMessageBar* messageBar, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mWidget( NULL ) + , mWidget( nullptr ) , mCanvas( canvas ) , mMessageBar( messageBar ) { diff --git a/src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.h b/src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.h index fa80fb77638..3faf330195a 100644 --- a/src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.h +++ b/src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.h @@ -44,7 +44,7 @@ class GUI_EXPORT QgsRelationReferenceWidgetWrapper : public QgsEditorWidgetWrapp QWidget* editor, QgsMapCanvas* canvas, QgsMessageBar* messageBar, - QWidget* parent = 0 ); + QWidget* parent = nullptr ); virtual QWidget* createWidget( QWidget* parent ) override; virtual void initWidget( QWidget* editor ) override; diff --git a/src/gui/editorwidgets/qgsrelationwidgetwrapper.cpp b/src/gui/editorwidgets/qgsrelationwidgetwrapper.cpp index 1785d6adc0b..acf7e117028 100644 --- a/src/gui/editorwidgets/qgsrelationwidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsrelationwidgetwrapper.cpp @@ -24,7 +24,7 @@ QgsRelationWidgetWrapper::QgsRelationWidgetWrapper( QgsVectorLayer* vl, const QgsRelation& relation, QWidget* editor, QWidget* parent ) : QgsWidgetWrapper( vl, editor, parent ) , mRelation( relation ) - , mWidget( NULL ) + , mWidget( nullptr ) { } diff --git a/src/gui/editorwidgets/qgsrelationwidgetwrapper.h b/src/gui/editorwidgets/qgsrelationwidgetwrapper.h index eb0dd074306..b0952b5c084 100644 --- a/src/gui/editorwidgets/qgsrelationwidgetwrapper.h +++ b/src/gui/editorwidgets/qgsrelationwidgetwrapper.h @@ -29,7 +29,7 @@ class GUI_EXPORT QgsRelationWidgetWrapper : public QgsWidgetWrapper Q_OBJECT public: - explicit QgsRelationWidgetWrapper( QgsVectorLayer* vl, const QgsRelation& relation, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsRelationWidgetWrapper( QgsVectorLayer* vl, const QgsRelation& relation, QWidget* editor = nullptr, QWidget* parent = nullptr ); protected: QWidget* createWidget( QWidget* parent ) override; diff --git a/src/gui/editorwidgets/qgsspinbox.h b/src/gui/editorwidgets/qgsspinbox.h index a8167d3bb0f..c41211ea96f 100644 --- a/src/gui/editorwidgets/qgsspinbox.h +++ b/src/gui/editorwidgets/qgsspinbox.h @@ -37,7 +37,7 @@ class GUI_EXPORT QgsSpinBox : public QSpinBox CustomValue }; - explicit QgsSpinBox( QWidget *parent = 0 ); + explicit QgsSpinBox( QWidget *parent = nullptr ); //! determines if the widget will show a clear button //! @note the clear button will set the widget to its minimum value diff --git a/src/gui/editorwidgets/qgstexteditconfigdlg.h b/src/gui/editorwidgets/qgstexteditconfigdlg.h index 662f80e9fc0..cf9a2deeff7 100644 --- a/src/gui/editorwidgets/qgstexteditconfigdlg.h +++ b/src/gui/editorwidgets/qgstexteditconfigdlg.h @@ -29,7 +29,7 @@ class GUI_EXPORT QgsTextEditConfigDlg : public QgsEditorConfigWidget, private Ui Q_OBJECT public: - explicit QgsTextEditConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget *parent = 0 ); + explicit QgsTextEditConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget *parent = nullptr ); // QgsEditorConfigWidget interface public: diff --git a/src/gui/editorwidgets/qgstexteditwrapper.cpp b/src/gui/editorwidgets/qgstexteditwrapper.cpp index 4431dbe2232..eb00b86cd96 100644 --- a/src/gui/editorwidgets/qgstexteditwrapper.cpp +++ b/src/gui/editorwidgets/qgstexteditwrapper.cpp @@ -23,9 +23,9 @@ QgsTextEditWrapper::QgsTextEditWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mTextEdit( NULL ) - , mPlainTextEdit( NULL ) - , mLineEdit( NULL ) + , mTextEdit( nullptr ) + , mPlainTextEdit( nullptr ) + , mLineEdit( nullptr ) { } diff --git a/src/gui/editorwidgets/qgstexteditwrapper.h b/src/gui/editorwidgets/qgstexteditwrapper.h index 5165296acf0..7316c9b5bf9 100644 --- a/src/gui/editorwidgets/qgstexteditwrapper.h +++ b/src/gui/editorwidgets/qgstexteditwrapper.h @@ -37,7 +37,7 @@ class GUI_EXPORT QgsTextEditWrapper : public QgsEditorWidgetWrapper { Q_OBJECT public: - explicit QgsTextEditWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsTextEditWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = nullptr, QWidget* parent = nullptr ); // QgsEditorWidgetWrapper interface public: diff --git a/src/gui/editorwidgets/qgsuniquevaluesconfigdlg.h b/src/gui/editorwidgets/qgsuniquevaluesconfigdlg.h index 80010d31051..e93e61e7fbb 100644 --- a/src/gui/editorwidgets/qgsuniquevaluesconfigdlg.h +++ b/src/gui/editorwidgets/qgsuniquevaluesconfigdlg.h @@ -29,7 +29,7 @@ class GUI_EXPORT QgsUniqueValuesConfigDlg : public QgsEditorConfigWidget, privat Q_OBJECT public: - explicit QgsUniqueValuesConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget *parent = 0 ); + explicit QgsUniqueValuesConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget *parent = nullptr ); // QgsEditorConfigWidget interface public: diff --git a/src/gui/editorwidgets/qgsuniquevaluewidgetwrapper.cpp b/src/gui/editorwidgets/qgsuniquevaluewidgetwrapper.cpp index 411a6ecde25..1553d450a8b 100644 --- a/src/gui/editorwidgets/qgsuniquevaluewidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsuniquevaluewidgetwrapper.cpp @@ -23,8 +23,8 @@ QgsUniqueValuesWidgetWrapper::QgsUniqueValuesWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mComboBox( NULL ) - , mLineEdit( NULL ) + , mComboBox( nullptr ) + , mLineEdit( nullptr ) { } diff --git a/src/gui/editorwidgets/qgsuniquevaluewidgetwrapper.h b/src/gui/editorwidgets/qgsuniquevaluewidgetwrapper.h index 5aaec3909ae..5853fcc46f9 100644 --- a/src/gui/editorwidgets/qgsuniquevaluewidgetwrapper.h +++ b/src/gui/editorwidgets/qgsuniquevaluewidgetwrapper.h @@ -35,7 +35,7 @@ class GUI_EXPORT QgsUniqueValuesWidgetWrapper : public QgsEditorWidgetWrapper { Q_OBJECT public: - explicit QgsUniqueValuesWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsUniqueValuesWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = nullptr, QWidget* parent = nullptr ); // QgsEditorWidgetWrapper interface public: diff --git a/src/gui/editorwidgets/qgsuuidwidgetwrapper.cpp b/src/gui/editorwidgets/qgsuuidwidgetwrapper.cpp index 55ff56ac06b..658bb873afd 100644 --- a/src/gui/editorwidgets/qgsuuidwidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsuuidwidgetwrapper.cpp @@ -19,8 +19,8 @@ QgsUuidWidgetWrapper::QgsUuidWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mLabel( NULL ) - , mLineEdit( NULL ) + , mLabel( nullptr ) + , mLineEdit( nullptr ) { } diff --git a/src/gui/editorwidgets/qgsuuidwidgetwrapper.h b/src/gui/editorwidgets/qgsuuidwidgetwrapper.h index 7977203f8aa..4dc56cbcbbc 100644 --- a/src/gui/editorwidgets/qgsuuidwidgetwrapper.h +++ b/src/gui/editorwidgets/qgsuuidwidgetwrapper.h @@ -31,7 +31,7 @@ class GUI_EXPORT QgsUuidWidgetWrapper : public QgsEditorWidgetWrapper { Q_OBJECT public: - explicit QgsUuidWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsUuidWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = nullptr, QWidget* parent = nullptr ); // QgsEditorWidgetWrapper interface public: diff --git a/src/gui/editorwidgets/qgsvaluemapconfigdlg.cpp b/src/gui/editorwidgets/qgsvaluemapconfigdlg.cpp index 08e034cb3c6..8fc5f95e534 100644 --- a/src/gui/editorwidgets/qgsvaluemapconfigdlg.cpp +++ b/src/gui/editorwidgets/qgsvaluemapconfigdlg.cpp @@ -161,7 +161,7 @@ void QgsValueMapConfigDlg::loadFromLayerButtonPushed() void QgsValueMapConfigDlg::loadFromCSVButtonPushed() { - QString fileName = QFileDialog::getOpenFileName( 0, tr( "Select a file" ), QDir::homePath() ); + QString fileName = QFileDialog::getOpenFileName( nullptr, tr( "Select a file" ), QDir::homePath() ); if ( fileName.isNull() ) return; @@ -169,7 +169,7 @@ void QgsValueMapConfigDlg::loadFromCSVButtonPushed() if ( !f.open( QIODevice::ReadOnly ) ) { - QMessageBox::information( NULL, + QMessageBox::information( nullptr, tr( "Error" ), tr( "Could not open file %1\nError was:%2" ).arg( fileName, f.errorString() ), QMessageBox::Cancel ); diff --git a/src/gui/editorwidgets/qgsvaluemapsearchwidgetwrapper.cpp b/src/gui/editorwidgets/qgsvaluemapsearchwidgetwrapper.cpp index 61f0689684a..825935c7da4 100644 --- a/src/gui/editorwidgets/qgsvaluemapsearchwidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsvaluemapsearchwidgetwrapper.cpp @@ -24,7 +24,7 @@ QgsValueMapSearchWidgetWrapper::QgsValueMapSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) : QgsSearchWidgetWrapper( vl, fieldIdx, parent ), - mComboBox( NULL ) + mComboBox( nullptr ) { } diff --git a/src/gui/editorwidgets/qgsvaluemapsearchwidgetwrapper.h b/src/gui/editorwidgets/qgsvaluemapsearchwidgetwrapper.h index e60fcffa69c..2f9967095ad 100644 --- a/src/gui/editorwidgets/qgsvaluemapsearchwidgetwrapper.h +++ b/src/gui/editorwidgets/qgsvaluemapsearchwidgetwrapper.h @@ -29,7 +29,7 @@ class GUI_EXPORT QgsValueMapSearchWidgetWrapper : public QgsSearchWidgetWrapper { Q_OBJECT public: - explicit QgsValueMapSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent = 0 ); + explicit QgsValueMapSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent = nullptr ); bool applyDirectly() override; QString expression() override; bool valid() const override; diff --git a/src/gui/editorwidgets/qgsvaluemapwidgetwrapper.cpp b/src/gui/editorwidgets/qgsvaluemapwidgetwrapper.cpp index 6fe31ed59b1..fa5cbee770b 100644 --- a/src/gui/editorwidgets/qgsvaluemapwidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsvaluemapwidgetwrapper.cpp @@ -17,7 +17,7 @@ QgsValueMapWidgetWrapper::QgsValueMapWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mComboBox( NULL ) + , mComboBox( nullptr ) { } diff --git a/src/gui/editorwidgets/qgsvaluemapwidgetwrapper.h b/src/gui/editorwidgets/qgsvaluemapwidgetwrapper.h index c3276fb957c..60e86b1e07d 100644 --- a/src/gui/editorwidgets/qgsvaluemapwidgetwrapper.h +++ b/src/gui/editorwidgets/qgsvaluemapwidgetwrapper.h @@ -37,7 +37,7 @@ class GUI_EXPORT QgsValueMapWidgetWrapper : public QgsEditorWidgetWrapper { Q_OBJECT public: - explicit QgsValueMapWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsValueMapWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = nullptr, QWidget* parent = nullptr ); // QgsEditorWidgetWrapper interface public: diff --git a/src/gui/editorwidgets/qgsvaluerelationconfigdlg.h b/src/gui/editorwidgets/qgsvaluerelationconfigdlg.h index 943fa175bdb..4474254866b 100644 --- a/src/gui/editorwidgets/qgsvaluerelationconfigdlg.h +++ b/src/gui/editorwidgets/qgsvaluerelationconfigdlg.h @@ -29,7 +29,7 @@ class GUI_EXPORT QgsValueRelationConfigDlg : public QgsEditorConfigWidget, priva Q_OBJECT public: - explicit QgsValueRelationConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget *parent = 0 ); + explicit QgsValueRelationConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget *parent = nullptr ); public slots: void editExpression(); diff --git a/src/gui/editorwidgets/qgsvaluerelationsearchwidgetwrapper.cpp b/src/gui/editorwidgets/qgsvaluerelationsearchwidgetwrapper.cpp index 27f6ce72568..9b488cb6c78 100644 --- a/src/gui/editorwidgets/qgsvaluerelationsearchwidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsvaluerelationsearchwidgetwrapper.cpp @@ -27,10 +27,10 @@ QgsValueRelationSearchWidgetWrapper::QgsValueRelationSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) : QgsSearchWidgetWrapper( vl, fieldIdx, parent ) - , mComboBox( 0 ) - , mListWidget( 0 ) - , mLineEdit( 0 ) - , mLayer( 0 ) + , mComboBox( nullptr ) + , mListWidget( nullptr ) + , mLineEdit( nullptr ) + , mLayer( nullptr ) { } diff --git a/src/gui/editorwidgets/qgsvaluerelationsearchwidgetwrapper.h b/src/gui/editorwidgets/qgsvaluerelationsearchwidgetwrapper.h index 4729ed2c1a8..5c0dfcdbb00 100644 --- a/src/gui/editorwidgets/qgsvaluerelationsearchwidgetwrapper.h +++ b/src/gui/editorwidgets/qgsvaluerelationsearchwidgetwrapper.h @@ -40,7 +40,7 @@ class GUI_EXPORT QgsValueRelationSearchWidgetWrapper : public QgsSearchWidgetWra typedef QVector < ValueRelationItem > ValueRelationCache; public: - explicit QgsValueRelationSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent = 0 ); + explicit QgsValueRelationSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* parent = nullptr ); bool applyDirectly() override; QString expression() override; bool valid() const override; diff --git a/src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp b/src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp index 1edfb244992..813e8fbc51e 100644 --- a/src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp @@ -51,10 +51,10 @@ bool QgsValueRelationWidgetWrapper::orderByValueLessThan( const QgsValueRelation QgsValueRelationWidgetWrapper::QgsValueRelationWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mComboBox( 0 ) - , mListWidget( 0 ) - , mLineEdit( 0 ) - , mLayer( 0 ) + , mComboBox( nullptr ) + , mListWidget( nullptr ) + , mLineEdit( nullptr ) + , mLayer( nullptr ) { } @@ -222,7 +222,7 @@ QgsValueRelationWidgetWrapper::ValueRelationCache QgsValueRelationWidgetWrapper: << QgsExpressionContextUtils::projectScope() << QgsExpressionContextUtils::layerScope( layer ); - QgsExpression *e = 0; + QgsExpression *e = nullptr; if ( !config.value( "FilterExpression" ).toString().isEmpty() ) { e = new QgsExpression( config.value( "FilterExpression" ).toString() ); diff --git a/src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.h b/src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.h index 1f505a4689d..a509bbef9ad 100644 --- a/src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.h +++ b/src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.h @@ -53,7 +53,7 @@ class GUI_EXPORT QgsValueRelationWidgetWrapper : public QgsEditorWidgetWrapper typedef QVector < ValueRelationItem > ValueRelationCache; public: - explicit QgsValueRelationWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsValueRelationWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = nullptr, QWidget* parent = nullptr ); static bool orderByKeyLessThan( const QgsValueRelationWidgetWrapper::ValueRelationItem& p1 , const QgsValueRelationWidgetWrapper::ValueRelationItem& p2 ); static bool orderByValueLessThan( const QgsValueRelationWidgetWrapper::ValueRelationItem& p1 , diff --git a/src/gui/editorwidgets/qgswebviewwidgetfactory.cpp b/src/gui/editorwidgets/qgswebviewwidgetfactory.cpp index dfa4dc49fe3..80634362a25 100644 --- a/src/gui/editorwidgets/qgswebviewwidgetfactory.cpp +++ b/src/gui/editorwidgets/qgswebviewwidgetfactory.cpp @@ -41,8 +41,8 @@ QgsEditorWidgetConfig QgsWebViewWidgetFactory::readConfig( const QDomElement& co QgsEditorWidgetConfig cfg; - cfg.insert( "Height", configElement.attribute( "Height", 0 ).toInt() ); - cfg.insert( "Width", configElement.attribute( "Width", 0 ).toInt() ); + cfg.insert( "Height", configElement.attribute( "Height", nullptr ).toInt() ); + cfg.insert( "Width", configElement.attribute( "Width", nullptr ).toInt() ); return cfg; } diff --git a/src/gui/editorwidgets/qgswebviewwidgetwrapper.cpp b/src/gui/editorwidgets/qgswebviewwidgetwrapper.cpp index 5cff1d50543..89dc5bacac8 100644 --- a/src/gui/editorwidgets/qgswebviewwidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgswebviewwidgetwrapper.cpp @@ -25,9 +25,9 @@ QgsWebViewWidgetWrapper::QgsWebViewWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) : QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent ) - , mWebView( NULL ) - , mLineEdit( NULL ) - , mButton( NULL ) + , mWebView( nullptr ) + , mLineEdit( nullptr ) + , mButton( nullptr ) { } diff --git a/src/gui/editorwidgets/qgswebviewwidgetwrapper.h b/src/gui/editorwidgets/qgswebviewwidgetwrapper.h index 3b749778f78..79edfe76321 100644 --- a/src/gui/editorwidgets/qgswebviewwidgetwrapper.h +++ b/src/gui/editorwidgets/qgswebviewwidgetwrapper.h @@ -31,7 +31,7 @@ class GUI_EXPORT QgsWebViewWidgetWrapper : public QgsEditorWidgetWrapper { Q_OBJECT public: - explicit QgsWebViewWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent = 0 ); + explicit QgsWebViewWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = nullptr, QWidget* parent = nullptr ); // QgsEditorWidgetWrapper interface diff --git a/src/gui/effects/qgseffectdrawmodecombobox.h b/src/gui/effects/qgseffectdrawmodecombobox.h index 3c3a59bcabb..0f0e71b2735 100644 --- a/src/gui/effects/qgseffectdrawmodecombobox.h +++ b/src/gui/effects/qgseffectdrawmodecombobox.h @@ -32,7 +32,7 @@ class GUI_EXPORT QgsEffectDrawModeComboBox : public QComboBox public: - QgsEffectDrawModeComboBox( QWidget* parent = NULL ); + QgsEffectDrawModeComboBox( QWidget* parent = nullptr ); /** Returns the currently selected draw mode for the combo box * @returns current draw mode diff --git a/src/gui/effects/qgseffectstackpropertieswidget.cpp b/src/gui/effects/qgseffectstackpropertieswidget.cpp index 212bedcdb8d..24d32633b7f 100644 --- a/src/gui/effects/qgseffectstackpropertieswidget.cpp +++ b/src/gui/effects/qgseffectstackpropertieswidget.cpp @@ -96,7 +96,7 @@ class EffectItem : public QStandardItem QgsEffectStackPropertiesWidget::QgsEffectStackPropertiesWidget( QgsEffectStack *stack, QWidget *parent ) : QWidget( parent ) , mStack( stack ) - , mPreviewPicture( 0 ) + , mPreviewPicture( nullptr ) { // TODO @@ -104,7 +104,7 @@ QgsEffectStackPropertiesWidget::QgsEffectStackPropertiesWidget( QgsEffectStack * //setWindowModality( Qt::WindowModal ); #endif - mPresentWidget = NULL; + mPresentWidget = nullptr; setupUi( this ); @@ -226,7 +226,7 @@ EffectItem* QgsEffectStackPropertiesWidget::currentEffectItem() { QModelIndex idx = mEffectsList->currentIndex(); if ( !idx.isValid() ) - return NULL; + return nullptr; EffectItem *item = static_cast( mModel->itemFromIndex( idx ) ); return item; @@ -351,7 +351,7 @@ void QgsEffectStackPropertiesWidget::changeEffect( QgsPaintEffect* newEffect ) QgsEffectStackPropertiesDialog::QgsEffectStackPropertiesDialog( QgsEffectStack *stack, QWidget *parent, const Qt::WindowFlags& f ) : QgsDialog( parent, f, QDialogButtonBox::Ok | QDialogButtonBox::Cancel ) - , mPropertiesWidget( 0 ) + , mPropertiesWidget( nullptr ) { setWindowTitle( tr( "Effect Properties" ) ); mPropertiesWidget = new QgsEffectStackPropertiesWidget( stack, this ); @@ -379,9 +379,9 @@ void QgsEffectStackPropertiesDialog::setPreviewPicture( const QPicture &picture QgsEffectStackCompactWidget::QgsEffectStackCompactWidget( QWidget *parent , QgsPaintEffect *effect ) : QWidget( parent ) - , mEnabledCheckBox( 0 ) - , mButton( 0 ) - , mPreviewPicture( 0 ) + , mEnabledCheckBox( nullptr ) + , mButton( nullptr ) + , mPreviewPicture( nullptr ) { QHBoxLayout* layout = new QHBoxLayout(); layout->setContentsMargins( 0, 0, 0, 0 ); @@ -418,7 +418,7 @@ void QgsEffectStackCompactWidget::setPaintEffect( QgsPaintEffect *effect ) mEnabledCheckBox->setChecked( false ); mEnabledCheckBox->setEnabled( false ); mButton->setEnabled( false ); - mStack = 0; + mStack = nullptr; return; } diff --git a/src/gui/effects/qgseffectstackpropertieswidget.h b/src/gui/effects/qgseffectstackpropertieswidget.h index 1bcf933db81..8167ee45f66 100644 --- a/src/gui/effects/qgseffectstackpropertieswidget.h +++ b/src/gui/effects/qgseffectstackpropertieswidget.h @@ -49,7 +49,7 @@ class GUI_EXPORT QgsEffectStackPropertiesWidget : public QWidget, private Ui::Qg * @param stack QgsEffectStack to modify in the widget * @param parent parent widget */ - QgsEffectStackPropertiesWidget( QgsEffectStack* stack, QWidget* parent = 0 ); + QgsEffectStackPropertiesWidget( QgsEffectStack* stack, QWidget* parent = nullptr ); ~QgsEffectStackPropertiesWidget(); @@ -152,7 +152,7 @@ class GUI_EXPORT QgsEffectStackPropertiesDialog: public QgsDialog * @param parent parent widget * @param f window flags */ - QgsEffectStackPropertiesDialog( QgsEffectStack* stack, QWidget* parent = 0, const Qt::WindowFlags& f = 0 ); + QgsEffectStackPropertiesDialog( QgsEffectStack* stack, QWidget* parent = nullptr, const Qt::WindowFlags& f = nullptr ); ~QgsEffectStackPropertiesDialog(); /** Returns effect stack attached to the dialog @@ -195,7 +195,7 @@ class GUI_EXPORT QgsEffectStackCompactWidget: public QWidget * is not a QgsEffectStack, it will be automatically converted to an effect * stack consisting of the original effect */ - QgsEffectStackCompactWidget( QWidget* parent = 0, QgsPaintEffect* effect = 0 ); + QgsEffectStackCompactWidget( QWidget* parent = nullptr, QgsPaintEffect* effect = nullptr ); ~QgsEffectStackCompactWidget(); /** Sets paint effect attached to the widget diff --git a/src/gui/effects/qgspainteffectpropertieswidget.cpp b/src/gui/effects/qgspainteffectpropertieswidget.cpp index a74ec24d628..c3c1acfb0e1 100644 --- a/src/gui/effects/qgspainteffectpropertieswidget.cpp +++ b/src/gui/effects/qgspainteffectpropertieswidget.cpp @@ -32,13 +32,13 @@ static bool _initWidgetFunction( const QString& name, QgsPaintEffectWidgetFunc f QgsPaintEffectRegistry* registry = QgsPaintEffectRegistry::instance(); QgsPaintEffectAbstractMetadata* abstractMetadata = registry->effectMetadata( name ); - if ( abstractMetadata == NULL ) + if ( abstractMetadata == nullptr ) { QgsDebugMsg( QString( "Failed to find paint effect entry in registry: %1" ).arg( name ) ); return false; } QgsPaintEffectMetadata* metadata = dynamic_cast( abstractMetadata ); - if ( metadata == NULL ) + if ( metadata == nullptr ) { QgsDebugMsg( QString( "Failed to cast paint effect's metadata: " ) .arg( name ) ); return false; @@ -148,13 +148,13 @@ void QgsPaintEffectPropertiesWidget::effectTypeChanged() // get creation function for new effect from registry QgsPaintEffectRegistry* registry = QgsPaintEffectRegistry::instance(); QgsPaintEffectAbstractMetadata* am = registry->effectMetadata( newEffectType ); - if ( am == NULL ) // check whether the metadata is assigned + if ( am == nullptr ) // check whether the metadata is assigned return; // change effect to a new (with different type) // base new effect on existing effect's properties QgsPaintEffect* newEffect = am->createPaintEffect( effect->properties() ); - if ( newEffect == NULL ) + if ( newEffect == nullptr ) return; updateEffectWidget( newEffect ); diff --git a/src/gui/effects/qgspainteffectpropertieswidget.h b/src/gui/effects/qgspainteffectpropertieswidget.h index 99828014fae..0bc24ac0c5e 100644 --- a/src/gui/effects/qgspainteffectpropertieswidget.h +++ b/src/gui/effects/qgspainteffectpropertieswidget.h @@ -38,7 +38,7 @@ class GUI_EXPORT QgsPaintEffectPropertiesWidget : public QWidget, private Ui::Ef * @param effect QgsPaintEffect to modify in the widget * @param parent parent widget */ - QgsPaintEffectPropertiesWidget( QgsPaintEffect* effect, QWidget* parent = NULL ); + QgsPaintEffectPropertiesWidget( QgsPaintEffect* effect, QWidget* parent = nullptr ); public slots: diff --git a/src/gui/effects/qgspainteffectwidget.cpp b/src/gui/effects/qgspainteffectwidget.cpp index e9ad77f6b0e..676a4522cfd 100644 --- a/src/gui/effects/qgspainteffectwidget.cpp +++ b/src/gui/effects/qgspainteffectwidget.cpp @@ -31,7 +31,7 @@ QgsDrawSourceWidget::QgsDrawSourceWidget( QWidget *parent ) : QgsPaintEffectWidget( parent ) - , mEffect( NULL ) + , mEffect( nullptr ) { setupUi( this ); initGui(); @@ -119,7 +119,7 @@ void QgsDrawSourceWidget::on_mTransparencySlider_valueChanged( int value ) QgsBlurWidget::QgsBlurWidget( QWidget *parent ) : QgsPaintEffectWidget( parent ) - , mEffect( NULL ) + , mEffect( nullptr ) { setupUi( this ); @@ -246,7 +246,7 @@ void QgsBlurWidget::on_mTransparencySlider_valueChanged( int value ) QgsShadowEffectWidget::QgsShadowEffectWidget( QWidget *parent ) : QgsPaintEffectWidget( parent ) - , mEffect( NULL ) + , mEffect( nullptr ) { setupUi( this ); @@ -411,7 +411,7 @@ void QgsShadowEffectWidget::on_mShadowBlendCmbBx_currentIndexChanged( int index QgsGlowWidget::QgsGlowWidget( QWidget *parent ) : QgsPaintEffectWidget( parent ) - , mEffect( NULL ) + , mEffect( nullptr ) { setupUi( this ); @@ -595,7 +595,7 @@ void QgsGlowWidget::applyColorRamp() } QgsVectorColorRampV2* ramp = mRampComboBox->currentColorRamp(); - if ( ramp == NULL ) + if ( ramp == nullptr ) return; mEffect->setRamp( ramp ); @@ -608,7 +608,7 @@ void QgsGlowWidget::applyColorRamp() QgsTransformWidget::QgsTransformWidget( QWidget *parent ) : QgsPaintEffectWidget( parent ) - , mEffect( NULL ) + , mEffect( nullptr ) { setupUi( this ); @@ -785,7 +785,7 @@ void QgsTransformWidget::on_mRotationSpinBox_valueChanged( double value ) QgsColorEffectWidget::QgsColorEffectWidget( QWidget *parent ) : QgsPaintEffectWidget( parent ) - , mEffect( NULL ) + , mEffect( nullptr ) { setupUi( this ); diff --git a/src/gui/effects/qgspainteffectwidget.h b/src/gui/effects/qgspainteffectwidget.h index 015d5315e1d..820f1f1e132 100644 --- a/src/gui/effects/qgspainteffectwidget.h +++ b/src/gui/effects/qgspainteffectwidget.h @@ -39,7 +39,7 @@ class GUI_EXPORT QgsPaintEffectWidget : public QWidget Q_OBJECT public: - QgsPaintEffectWidget( QWidget* parent = NULL ) : QWidget( parent ) {} + QgsPaintEffectWidget( QWidget* parent = nullptr ) : QWidget( parent ) {} virtual ~QgsPaintEffectWidget() {} /** @@ -66,7 +66,7 @@ class GUI_EXPORT QgsDrawSourceWidget : public QgsPaintEffectWidget, private Ui:: Q_OBJECT public: - QgsDrawSourceWidget( QWidget* parent = NULL ); + QgsDrawSourceWidget( QWidget* parent = nullptr ); static QgsPaintEffectWidget* create() { return new QgsDrawSourceWidget(); } @@ -96,7 +96,7 @@ class GUI_EXPORT QgsBlurWidget : public QgsPaintEffectWidget, private Ui::Widget Q_OBJECT public: - QgsBlurWidget( QWidget* parent = NULL ); + QgsBlurWidget( QWidget* parent = nullptr ); static QgsPaintEffectWidget* create() { return new QgsBlurWidget(); } @@ -128,7 +128,7 @@ class GUI_EXPORT QgsShadowEffectWidget : public QgsPaintEffectWidget, private Ui Q_OBJECT public: - QgsShadowEffectWidget( QWidget* parent = NULL ); + QgsShadowEffectWidget( QWidget* parent = nullptr ); static QgsPaintEffectWidget* create() { return new QgsShadowEffectWidget(); } @@ -161,7 +161,7 @@ class GUI_EXPORT QgsGlowWidget : public QgsPaintEffectWidget, private Ui::Widget Q_OBJECT public: - QgsGlowWidget( QWidget* parent = NULL ); + QgsGlowWidget( QWidget* parent = nullptr ); static QgsPaintEffectWidget* create() { return new QgsGlowWidget(); } @@ -194,7 +194,7 @@ class GUI_EXPORT QgsTransformWidget : public QgsPaintEffectWidget, private Ui::W Q_OBJECT public: - QgsTransformWidget( QWidget* parent = NULL ); + QgsTransformWidget( QWidget* parent = nullptr ); static QgsPaintEffectWidget* create() { return new QgsTransformWidget(); } @@ -230,7 +230,7 @@ class GUI_EXPORT QgsColorEffectWidget : public QgsPaintEffectWidget, private Ui: Q_OBJECT public: - QgsColorEffectWidget( QWidget* parent = NULL ); + QgsColorEffectWidget( QWidget* parent = nullptr ); static QgsPaintEffectWidget* create() { return new QgsColorEffectWidget(); } diff --git a/src/gui/layertree/qgscustomlayerorderwidget.h b/src/gui/layertree/qgscustomlayerorderwidget.h index e74cd42cb0a..b89d705c69b 100644 --- a/src/gui/layertree/qgscustomlayerorderwidget.h +++ b/src/gui/layertree/qgscustomlayerorderwidget.h @@ -40,7 +40,7 @@ class GUI_EXPORT QgsCustomLayerOrderWidget : public QWidget { Q_OBJECT public: - explicit QgsCustomLayerOrderWidget( QgsLayerTreeMapCanvasBridge* bridge, QWidget *parent = 0 ); + explicit QgsCustomLayerOrderWidget( QgsLayerTreeMapCanvasBridge* bridge, QWidget *parent = nullptr ); signals: @@ -67,7 +67,7 @@ class CustomLayerOrderModel : public QAbstractListModel Q_OBJECT public: - CustomLayerOrderModel( QgsLayerTreeMapCanvasBridge* bridge, QObject* parent = 0 ); + CustomLayerOrderModel( QgsLayerTreeMapCanvasBridge* bridge, QObject* parent = nullptr ); int rowCount( const QModelIndex & ) const override; diff --git a/src/gui/layertree/qgslayertreemapcanvasbridge.cpp b/src/gui/layertree/qgslayertreemapcanvasbridge.cpp index 9f5c945f970..6ea44f29365 100644 --- a/src/gui/layertree/qgslayertreemapcanvasbridge.cpp +++ b/src/gui/layertree/qgslayertreemapcanvasbridge.cpp @@ -142,7 +142,7 @@ void QgsLayerTreeMapCanvasBridge::setCanvasLayers() { if ( layerNode->layer() && ( - qobject_cast( layerNode->layer() ) == 0 || + qobject_cast( layerNode->layer() ) == nullptr || qobject_cast( layerNode->layer() )->geometryType() != QGis::NoGeometry ) ) @@ -225,7 +225,7 @@ void QgsLayerTreeMapCanvasBridge::readProject( const QDomDocument& doc ) itemElem = itemElem.nextSiblingElement( "item" ); } - setHasCustomLayerOrder( customOrderElem.attribute( "enabled", 0 ).toInt() ); + setHasCustomLayerOrder( customOrderElem.attribute( "enabled", nullptr ).toInt() ); setCustomLayerOrder( order ); } } diff --git a/src/gui/layertree/qgslayertreemapcanvasbridge.h b/src/gui/layertree/qgslayertreemapcanvasbridge.h index df65132b734..99916e75529 100644 --- a/src/gui/layertree/qgslayertreemapcanvasbridge.h +++ b/src/gui/layertree/qgslayertreemapcanvasbridge.h @@ -46,7 +46,7 @@ class GUI_EXPORT QgsLayerTreeMapCanvasBridge : public QObject Q_OBJECT public: //! Constructor: does not take ownership of the layer tree nor canvas - QgsLayerTreeMapCanvasBridge( QgsLayerTreeGroup* root, QgsMapCanvas* canvas, QObject* parent = 0 ); + QgsLayerTreeMapCanvasBridge( QgsLayerTreeGroup* root, QgsMapCanvas* canvas, QObject* parent = nullptr ); void clear(); diff --git a/src/gui/layertree/qgslayertreeview.cpp b/src/gui/layertree/qgslayertreeview.cpp index e2e53ec4caf..17aece19481 100644 --- a/src/gui/layertree/qgslayertreeview.cpp +++ b/src/gui/layertree/qgslayertreeview.cpp @@ -26,8 +26,8 @@ QgsLayerTreeView::QgsLayerTreeView( QWidget *parent ) : QTreeView( parent ) - , mDefaultActions( 0 ) - , mMenuProvider( 0 ) + , mDefaultActions( nullptr ) + , mMenuProvider( nullptr ) { setHeaderHidden( true ); @@ -243,7 +243,7 @@ QgsMapLayer* QgsLayerTreeView::layerForIndex( const QModelIndex& index ) const return legendNode->layerNode()->layer(); } - return 0; + return nullptr; } QgsLayerTreeNode* QgsLayerTreeView::currentNode() const @@ -270,7 +270,7 @@ QgsLayerTreeGroup* QgsLayerTreeView::currentGroupNode() const return QgsLayerTree::toGroup( parent->parent() ); } - return 0; + return nullptr; } QgsLayerTreeModelLegendNode* QgsLayerTreeView::currentLegendNode() const diff --git a/src/gui/layertree/qgslayertreeview.h b/src/gui/layertree/qgslayertreeview.h index 5451319de62..bf3fe5f5ccb 100644 --- a/src/gui/layertree/qgslayertreeview.h +++ b/src/gui/layertree/qgslayertreeview.h @@ -46,7 +46,7 @@ class GUI_EXPORT QgsLayerTreeView : public QTreeView { Q_OBJECT public: - explicit QgsLayerTreeView( QWidget *parent = 0 ); + explicit QgsLayerTreeView( QWidget *parent = nullptr ); ~QgsLayerTreeView(); //! Overridden setModel() from base class. Only QgsLayerTreeModel is an acceptable model. diff --git a/src/gui/layertree/qgslayertreeviewdefaultactions.cpp b/src/gui/layertree/qgslayertreeviewdefaultactions.cpp index d9873eb0877..efa1eeb8792 100644 --- a/src/gui/layertree/qgslayertreeviewdefaultactions.cpp +++ b/src/gui/layertree/qgslayertreeviewdefaultactions.cpp @@ -49,7 +49,7 @@ QAction* QgsLayerTreeViewDefaultActions::actionShowInOverview( QObject* parent ) { QgsLayerTreeNode* node = mView->currentNode(); if ( !node ) - return 0; + return nullptr; QAction* a = new QAction( tr( "&Show in Overview" ), parent ); connect( a, SIGNAL( triggered() ), this, SLOT( showInOverview() ) ); @@ -69,7 +69,7 @@ QAction* QgsLayerTreeViewDefaultActions::actionShowFeatureCount( QObject* parent { QgsLayerTreeNode* node = mView->currentNode(); if ( !node ) - return 0; + return nullptr; QAction* a = new QAction( tr( "Show Feature Count" ), parent ); connect( a, SIGNAL( triggered() ), this, SLOT( showFeatureCount() ) ); @@ -114,7 +114,7 @@ QAction* QgsLayerTreeViewDefaultActions::actionMutuallyExclusiveGroup( QObject* { QgsLayerTreeNode* node = mView->currentNode(); if ( !node || !QgsLayerTree::isGroup( node ) ) - return 0; + return nullptr; QAction* a = new QAction( tr( "Mutually Exclusive Group" ), parent ); a->setCheckable( true ); diff --git a/src/gui/layertree/qgslayertreeviewdefaultactions.h b/src/gui/layertree/qgslayertreeviewdefaultactions.h index d1b1d82be58..dc88463ee5e 100644 --- a/src/gui/layertree/qgslayertreeviewdefaultactions.h +++ b/src/gui/layertree/qgslayertreeviewdefaultactions.h @@ -39,21 +39,21 @@ class GUI_EXPORT QgsLayerTreeViewDefaultActions : public QObject public: QgsLayerTreeViewDefaultActions( QgsLayerTreeView* view ); - QAction* actionAddGroup( QObject* parent = 0 ); - QAction* actionRemoveGroupOrLayer( QObject* parent = 0 ); - QAction* actionShowInOverview( QObject* parent = 0 ); - QAction* actionRenameGroupOrLayer( QObject* parent = 0 ); - QAction* actionShowFeatureCount( QObject* parent = 0 ); + QAction* actionAddGroup( QObject* parent = nullptr ); + QAction* actionRemoveGroupOrLayer( QObject* parent = nullptr ); + QAction* actionShowInOverview( QObject* parent = nullptr ); + QAction* actionRenameGroupOrLayer( QObject* parent = nullptr ); + QAction* actionShowFeatureCount( QObject* parent = nullptr ); - QAction* actionZoomToLayer( QgsMapCanvas* canvas, QObject* parent = 0 ); - QAction* actionZoomToGroup( QgsMapCanvas* canvas, QObject* parent = 0 ); + QAction* actionZoomToLayer( QgsMapCanvas* canvas, QObject* parent = nullptr ); + QAction* actionZoomToGroup( QgsMapCanvas* canvas, QObject* parent = nullptr ); // TODO: zoom to selected - QAction* actionMakeTopLevel( QObject* parent = 0 ); - QAction* actionGroupSelected( QObject* parent = 0 ); + QAction* actionMakeTopLevel( QObject* parent = nullptr ); + QAction* actionGroupSelected( QObject* parent = nullptr ); //! Action to enable/disable mutually exclusive flag of a group (only one child node may be checked) //! @note added in 2.12 - QAction* actionMutuallyExclusiveGroup( QObject* parent = 0 ); + QAction* actionMutuallyExclusiveGroup( QObject* parent = nullptr ); void zoomToLayer( QgsMapCanvas* canvas ); void zoomToGroup( QgsMapCanvas* canvas ); diff --git a/src/gui/qgisgui.cpp b/src/gui/qgisgui.cpp index a0cf862c527..a86910142fb 100644 --- a/src/gui/qgisgui.cpp +++ b/src/gui/qgisgui.cpp @@ -38,11 +38,11 @@ namespace QgisGui QgsDebugMsg( "Opening file dialog with filters: " + filters ); if ( !cancelAll ) { - selectedFiles = QFileDialog::getOpenFileNames( 0, title, lastUsedDir, filters, &lastUsedFilter ); + selectedFiles = QFileDialog::getOpenFileNames( nullptr, title, lastUsedDir, filters, &lastUsedFilter ); } else //we have to use non-native dialog to add cancel all button { - QgsEncodingFileDialog* openFileDialog = new QgsEncodingFileDialog( 0, title, lastUsedDir, filters, QString() ); + QgsEncodingFileDialog* openFileDialog = new QgsEncodingFileDialog( nullptr, title, lastUsedDir, filters, QString() ); // allow for selection of more than one file openFileDialog->setFileMode( QFileDialog::ExistingFiles ); @@ -197,7 +197,7 @@ namespace QgisGui // Native Mac dialog works only for Qt Carbon return QFontDialog::getFont( &ok, initial, 0, title, QFontDialog::DontUseNativeDialog ); #else - return QFontDialog::getFont( &ok, initial, 0, title ); + return QFontDialog::getFont( &ok, initial, nullptr, title ); #endif } diff --git a/src/gui/qgisgui.h b/src/gui/qgisgui.h index 39806b9862d..1f7fa955254 100644 --- a/src/gui/qgisgui.h +++ b/src/gui/qgisgui.h @@ -46,7 +46,7 @@ namespace QgisGui * Qt::WindowMaximizeButtonHint is included but will be ignored if * the dialog is a fixed size and does not have a size grip. */ - static const Qt::WindowFlags ModalDialogFlags = 0; + static const Qt::WindowFlags ModalDialogFlags = nullptr; /** Open files, preferring to have the default file selector be the diff --git a/src/gui/qgsactionmenu.cpp b/src/gui/qgsactionmenu.cpp index 5da97f4b940..4bce90dffd3 100644 --- a/src/gui/qgsactionmenu.cpp +++ b/src/gui/qgsactionmenu.cpp @@ -19,7 +19,7 @@ QgsActionMenu::QgsActionMenu( QgsVectorLayer* layer, const QgsFeature* feature, QWidget* parent ) : QMenu( parent ) , mLayer( layer ) - , mActions( 0 ) + , mActions( nullptr ) , mFeature( feature ) , mFeatureId( feature->id() ) , mOwnsFeature( false ) @@ -30,8 +30,8 @@ QgsActionMenu::QgsActionMenu( QgsVectorLayer* layer, const QgsFeature* feature, QgsActionMenu::QgsActionMenu( QgsVectorLayer* layer, const QgsFeatureId fid, QWidget* parent ) : QMenu( parent ) , mLayer( layer ) - , mActions( 0 ) - , mFeature( 0 ) + , mActions( nullptr ) + , mFeature( nullptr ) , mFeatureId( fid ) , mOwnsFeature( false ) { diff --git a/src/gui/qgsactionmenu.h b/src/gui/qgsactionmenu.h index 8451ea1e729..9acabb106f5 100644 --- a/src/gui/qgsactionmenu.h +++ b/src/gui/qgsactionmenu.h @@ -45,7 +45,7 @@ class GUI_EXPORT QgsActionMenu : public QMenu : actionType( Invalid ) , actionId( 0 ) , featureId( 0 ) - , mapLayer( NULL ) + , mapLayer( nullptr ) {} ActionData( int actionId, QgsFeatureId featureId, QgsMapLayer* mapLayer ) @@ -86,7 +86,7 @@ class GUI_EXPORT QgsActionMenu : public QMenu * for the lifetime of this object. * @param parent The usual QWidget parent. */ - explicit QgsActionMenu( QgsVectorLayer* layer, const QgsFeature* feature, QWidget* parent = 0 ); + explicit QgsActionMenu( QgsVectorLayer* layer, const QgsFeature* feature, QWidget* parent = nullptr ); /** * Constructs a new QgsActionMenu @@ -95,7 +95,7 @@ class GUI_EXPORT QgsActionMenu : public QMenu * @param fid The feature id of the feature for which this action will be run. * @param parent The usual QWidget parent. */ - explicit QgsActionMenu( QgsVectorLayer* layer, const QgsFeatureId fid, QWidget* parent = 0 ); + explicit QgsActionMenu( QgsVectorLayer* layer, const QgsFeatureId fid, QWidget* parent = nullptr ); /** * Destructor diff --git a/src/gui/qgsadvanceddigitizingdockwidget.cpp b/src/gui/qgsadvanceddigitizingdockwidget.cpp index a20700638ed..809f8f04cc1 100644 --- a/src/gui/qgsadvanceddigitizingdockwidget.cpp +++ b/src/gui/qgsadvanceddigitizingdockwidget.cpp @@ -96,7 +96,7 @@ QgsAdvancedDigitizingDockWidget::QgsAdvancedDigitizingDockWidget( QgsMapCanvas* , mCommonAngleConstraint( QSettings().value( "/Cad/CommonAngle", 90 ).toInt() ) , mSnappedToVertex( false ) , mSessionActive( false ) - , mErrorMessage( 0 ) + , mErrorMessage( nullptr ) { setupUi( this ); @@ -303,7 +303,7 @@ void QgsAdvancedDigitizingDockWidget::emit pointChanged() void QgsAdvancedDigitizingDockWidget::lockConstraint( bool activate /* default true */ ) { QObject* obj = sender(); - CadConstraint* constraint = NULL; + CadConstraint* constraint = nullptr; if ( obj == mAngleLineEdit || obj == mLockAngleButton ) { constraint = mAngleConstraint; @@ -381,7 +381,7 @@ void QgsAdvancedDigitizingDockWidget::lockAdditionalConstraint( AdditionalConstr void QgsAdvancedDigitizingDockWidget::updateCapacity( bool updateUIwithoutChange ) { - CadCapacities newCapacities = 0; + CadCapacities newCapacities = nullptr; // first point is the mouse point (it doesn't count) if ( mCadPointList.count() > 1 ) { diff --git a/src/gui/qgsadvanceddigitizingdockwidget.h b/src/gui/qgsadvanceddigitizingdockwidget.h index bb8a69e3c64..442d3399ee2 100644 --- a/src/gui/qgsadvanceddigitizingdockwidget.h +++ b/src/gui/qgsadvanceddigitizingdockwidget.h @@ -89,7 +89,7 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QDockWidget, private U HardLock }; - CadConstraint( QLineEdit* lineEdit, QToolButton* lockerButton, QToolButton* relativeButton = 0 ) + CadConstraint( QLineEdit* lineEdit, QToolButton* lockerButton, QToolButton* relativeButton = nullptr ) : mLineEdit( lineEdit ) , mLockerButton( lockerButton ) , mRelativeButton( relativeButton ) @@ -164,7 +164,7 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QDockWidget, private U * @param canvas The map canvas on which the widget operates * @param parent The parent */ - explicit QgsAdvancedDigitizingDockWidget( QgsMapCanvas* canvas, QWidget *parent = 0 ); + explicit QgsAdvancedDigitizingDockWidget( QgsMapCanvas* canvas, QWidget *parent = nullptr ); /** * Disables the CAD tools when hiding the dock @@ -243,21 +243,21 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QDockWidget, private U * Helper for the CAD point list. The CAD point list is the list of points * currently digitized. It contains both "normal" points and intermediate points (construction mode). */ - QgsPoint currentPoint( bool* exists = 0 ) const; + QgsPoint currentPoint( bool* exists = nullptr ) const; /** * The previous point. * Helper for the CAD point list. The CAD point list is the list of points * currently digitized. It contains both "normal" points and intermediate points (construction mode). */ - QgsPoint previousPoint( bool* exists = 0 ) const; + QgsPoint previousPoint( bool* exists = nullptr ) const; /** * The penultimate point. * Helper for the CAD point list. The CAD point list is the list of points * currently digitized. It contains both "normal" points and intermediate points (construction mode). */ - QgsPoint penultimatePoint( bool* exists = 0 ) const; + QgsPoint penultimatePoint( bool* exists = nullptr ) const; /** * The number of points in the CAD point helper list diff --git a/src/gui/qgsannotationitem.cpp b/src/gui/qgsannotationitem.cpp index e65b39383b4..4d2ecd01603 100644 --- a/src/gui/qgsannotationitem.cpp +++ b/src/gui/qgsannotationitem.cpp @@ -232,7 +232,7 @@ void QgsAnnotationItem::drawMarkerSymbol( QPainter* p ) if ( mMarkerSymbol ) { mMarkerSymbol->startRender( renderContext ); - mMarkerSymbol->renderPoint( QPointF( 0, 0 ), 0, renderContext ); + mMarkerSymbol->renderPoint( QPointF( 0, 0 ), nullptr, renderContext ); mMarkerSymbol->stopRender( renderContext ); } } diff --git a/src/gui/qgsattributedialog.cpp b/src/gui/qgsattributedialog.cpp index 9c3105a7caf..ee1b9cfa1d7 100644 --- a/src/gui/qgsattributedialog.cpp +++ b/src/gui/qgsattributedialog.cpp @@ -27,8 +27,8 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer* vl, QgsFeature* thepFeature, bool featureOwner, const QgsDistanceArea &myDa, QWidget* parent, bool showDialogButtons ) : QDialog( parent ) - , mHighlight( 0 ) - , mOwnedFeature( featureOwner ? thepFeature : 0 ) + , mHighlight( nullptr ) + , mOwnedFeature( featureOwner ? thepFeature : nullptr ) { QgsAttributeEditorContext context; context.setDistanceArea( myDa ); @@ -41,8 +41,8 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer* vl, QgsFeature* thepFeat QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer* vl, QgsFeature* thepFeature, bool featureOwner, QWidget* parent, bool showDialogButtons, const QgsAttributeEditorContext &context ) : QDialog( parent ) - , mHighlight( 0 ) - , mOwnedFeature( featureOwner ? thepFeature : 0 ) + , mHighlight( nullptr ) + , mOwnedFeature( featureOwner ? thepFeature : nullptr ) { init( vl, thepFeature, context ); diff --git a/src/gui/qgsattributedialog.h b/src/gui/qgsattributedialog.h index fec34469250..f58834f60ea 100644 --- a/src/gui/qgsattributedialog.h +++ b/src/gui/qgsattributedialog.h @@ -49,7 +49,7 @@ class GUI_EXPORT QgsAttributeDialog : public QDialog * * @deprecated */ - Q_DECL_DEPRECATED QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, const QgsDistanceArea& myDa, QWidget* parent = 0, bool showDialogButtons = true ); + Q_DECL_DEPRECATED QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, const QgsDistanceArea& myDa, QWidget* parent = nullptr, bool showDialogButtons = true ); /** * Create an attribute dialog for a given layer and feature @@ -62,7 +62,7 @@ class GUI_EXPORT QgsAttributeDialog : public QDialog * @param context The context in which this dialog is created * */ - QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, QWidget* parent = 0, bool showDialogButtons = true, const QgsAttributeEditorContext& context = QgsAttributeEditorContext() ); + QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, QWidget* parent = nullptr, bool showDialogButtons = true, const QgsAttributeEditorContext& context = QgsAttributeEditorContext() ); ~QgsAttributeDialog(); diff --git a/src/gui/qgsattributeeditor.cpp b/src/gui/qgsattributeeditor.cpp index 65014d3545c..10bc1a7293e 100644 --- a/src/gui/qgsattributeeditor.cpp +++ b/src/gui/qgsattributeeditor.cpp @@ -55,7 +55,7 @@ QWidget* QgsAttributeEditor::createAttributeEditor( QWidget* parent, QWidget* ed } else { - return 0; + return nullptr; } } diff --git a/src/gui/qgsattributeeditor.h b/src/gui/qgsattributeeditor.h index 436594291e0..019b006f69a 100644 --- a/src/gui/qgsattributeeditor.h +++ b/src/gui/qgsattributeeditor.h @@ -40,7 +40,7 @@ class GUI_EXPORT QgsAttributeEditor : public QObject Q_OBJECT public: - QgsAttributeEditor( QObject* parent, QgsVectorLayer* vl = 0, int idx = -1 ) + QgsAttributeEditor( QObject* parent, QgsVectorLayer* vl = nullptr, int idx = -1 ) : QObject( parent ) { Q_UNUSED( vl ) diff --git a/src/gui/qgsattributeeditorcontext.h b/src/gui/qgsattributeeditorcontext.h index 9516b7c5e45..d6b80b3f40a 100644 --- a/src/gui/qgsattributeeditorcontext.h +++ b/src/gui/qgsattributeeditorcontext.h @@ -51,16 +51,16 @@ class GUI_EXPORT QgsAttributeEditorContext }; QgsAttributeEditorContext() - : mParentContext( 0 ) - , mLayer( 0 ) - , mVectorLayerTools( 0 ) + : mParentContext( nullptr ) + , mLayer( nullptr ) + , mVectorLayerTools( nullptr ) , mRelationMode( Undefined ) , mFormMode( Embed ) {} QgsAttributeEditorContext( const QgsAttributeEditorContext& parentContext, FormMode formMode ) : mParentContext( &parentContext ) - , mLayer( 0 ) + , mLayer( nullptr ) , mVectorLayerTools( parentContext.mVectorLayerTools ) , mDistanceArea( parentContext.mDistanceArea ) , mRelationMode( Undefined ) @@ -71,7 +71,7 @@ class GUI_EXPORT QgsAttributeEditorContext QgsAttributeEditorContext( const QgsAttributeEditorContext& parentContext, const QgsRelation& relation, RelationMode relationMode, FormMode widgetMode ) : mParentContext( &parentContext ) - , mLayer( 0 ) + , mLayer( nullptr ) , mVectorLayerTools( parentContext.mVectorLayerTools ) , mDistanceArea( parentContext.mDistanceArea ) , mRelation( relation ) diff --git a/src/gui/qgsattributeform.cpp b/src/gui/qgsattributeform.cpp index 6e19267d971..e51c9c9a818 100644 --- a/src/gui/qgsattributeform.cpp +++ b/src/gui/qgsattributeform.cpp @@ -45,7 +45,7 @@ QgsAttributeForm::QgsAttributeForm( QgsVectorLayer* vl, const QgsFeature &featur : QWidget( parent ) , mLayer( vl ) , mContext( context ) - , mButtonBox( 0 ) + , mButtonBox( nullptr ) , mFormNr( sFormCounter++ ) , mIsSaving( false ) , mIsAddDialog( false ) @@ -387,7 +387,7 @@ void QgsAttributeForm::init() QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) ); // Cleanup of any previously shown widget, we start from scratch - QWidget* formWidget = 0; + QWidget* formWidget = nullptr; bool buttonBoxVisible = true; // Cleanup button box but preserve visibility @@ -395,7 +395,7 @@ void QgsAttributeForm::init() { buttonBoxVisible = mButtonBox->isVisible(); delete mButtonBox; - mButtonBox = 0; + mButtonBox = nullptr; } qDeleteAll( mWidgets ); @@ -504,7 +504,7 @@ void QgsAttributeForm::init() // This will also create the widget QWidget *l = new QLabel( fieldName ); - QgsEditorWidgetWrapper* eww = QgsEditorWidgetRegistry::instance()->create( widgetType, mLayer, idx, widgetConfig, 0, this, mContext ); + QgsEditorWidgetWrapper* eww = QgsEditorWidgetRegistry::instance()->create( widgetType, mLayer, idx, widgetConfig, nullptr, this, mContext ); QWidget *w = eww ? eww->widget() : new QLabel( QString( "

Failed to create widget with type '%1'

" ).arg( widgetType ) ); if ( w ) @@ -527,7 +527,7 @@ void QgsAttributeForm::init() Q_FOREACH ( const QgsRelation& rel, QgsProject::instance()->relationManager()->referencedRelations( mLayer ) ) { - QgsRelationWidgetWrapper* rww = new QgsRelationWidgetWrapper( mLayer, rel, 0, this ); + QgsRelationWidgetWrapper* rww = new QgsRelationWidgetWrapper( mLayer, rel, nullptr, this ); QgsEditorWidgetConfig cfg = mLayer->editFormConfig()->widgetConfig( rel.id() ); rww->setConfig( cfg ); rww->setContext( mContext ); @@ -685,7 +685,7 @@ void QgsAttributeForm::initPython() QWidget* QgsAttributeForm::createWidgetFromDef( const QgsAttributeEditorElement *widgetDef, QWidget *parent, QgsVectorLayer *vl, QgsAttributeEditorContext &context, QString &labelText, bool &labelOnTop ) { - QWidget *newWidget = 0; + QWidget *newWidget = nullptr; switch ( widgetDef->type() ) { @@ -701,7 +701,7 @@ QWidget* QgsAttributeForm::createWidgetFromDef( const QgsAttributeEditorElement const QString widgetType = mLayer->editFormConfig()->widgetType( fldIdx ); const QgsEditorWidgetConfig widgetConfig = mLayer->editFormConfig()->widgetConfig( fldIdx ); - QgsEditorWidgetWrapper* eww = QgsEditorWidgetRegistry::instance()->create( widgetType, mLayer, fldIdx, widgetConfig, 0, this, mContext ); + QgsEditorWidgetWrapper* eww = QgsEditorWidgetRegistry::instance()->create( widgetType, mLayer, fldIdx, widgetConfig, nullptr, this, mContext ); newWidget = eww->widget(); addWidgetWrapper( eww ); @@ -718,7 +718,7 @@ QWidget* QgsAttributeForm::createWidgetFromDef( const QgsAttributeEditorElement { const QgsAttributeEditorRelation* relDef = dynamic_cast( widgetDef ); - QgsRelationWidgetWrapper* rww = new QgsRelationWidgetWrapper( mLayer, relDef->relation(), 0, this ); + QgsRelationWidgetWrapper* rww = new QgsRelationWidgetWrapper( mLayer, relDef->relation(), nullptr, this ); QgsEditorWidgetConfig cfg = mLayer->editFormConfig()->widgetConfig( relDef->relation().id() ); rww->setConfig( cfg ); rww->setContext( context ); diff --git a/src/gui/qgsattributeform.h b/src/gui/qgsattributeform.h index 4f66197cdeb..40d84ae8029 100644 --- a/src/gui/qgsattributeform.h +++ b/src/gui/qgsattributeform.h @@ -31,7 +31,7 @@ class GUI_EXPORT QgsAttributeForm : public QWidget Q_OBJECT public: - explicit QgsAttributeForm( QgsVectorLayer* vl, const QgsFeature &feature = QgsFeature(), const QgsAttributeEditorContext& context = QgsAttributeEditorContext(), QWidget *parent = 0 ); + explicit QgsAttributeForm( QgsVectorLayer* vl, const QgsFeature &feature = QgsFeature(), const QgsAttributeEditorContext& context = QgsAttributeEditorContext(), QWidget *parent = nullptr ); ~QgsAttributeForm(); const QgsFeature& feature() { return mFeature; } diff --git a/src/gui/qgsattributetypeloaddialog.cpp b/src/gui/qgsattributetypeloaddialog.cpp index 3c6c242080d..77d510f4abf 100644 --- a/src/gui/qgsattributetypeloaddialog.cpp +++ b/src/gui/qgsattributetypeloaddialog.cpp @@ -89,7 +89,7 @@ void QgsAttributeTypeLoadDialog::fillComboBoxes( int layerIndex ) keyComboBox->clear(); valueComboBox->clear(); - QgsVectorLayer *vLayer = qobject_cast( layerIndex < 0 ? 0 : QgsMapLayerRegistry::instance()->mapLayer( layerComboBox->itemData( layerIndex ).toString() ) ); + QgsVectorLayer *vLayer = qobject_cast( layerIndex < 0 ? nullptr : QgsMapLayerRegistry::instance()->mapLayer( layerComboBox->itemData( layerIndex ).toString() ) ); if ( vLayer ) { QMap fieldMap = vLayer->dataProvider()->fieldNameMap(); @@ -101,8 +101,8 @@ void QgsAttributeTypeLoadDialog::fillComboBoxes( int layerIndex ) } } - keyComboBox->setEnabled( vLayer != 0 ); - valueComboBox->setEnabled( vLayer != 0 ); + keyComboBox->setEnabled( vLayer != nullptr ); + valueComboBox->setEnabled( vLayer != nullptr ); keyComboBox->setCurrentIndex( -1 ); valueComboBox->setCurrentIndex( -1 ); diff --git a/src/gui/qgsblendmodecombobox.h b/src/gui/qgsblendmodecombobox.h index 0635a6eecf2..e056303e03d 100644 --- a/src/gui/qgsblendmodecombobox.h +++ b/src/gui/qgsblendmodecombobox.h @@ -29,7 +29,7 @@ class GUI_EXPORT QgsBlendModeComboBox : public QComboBox { Q_OBJECT public: - QgsBlendModeComboBox( QWidget* parent = 0 ); + QgsBlendModeComboBox( QWidget* parent = nullptr ); virtual ~QgsBlendModeComboBox(); //! Function to read the selected blend mode as QPainter::CompositionMode diff --git a/src/gui/qgsbrowsertreeview.h b/src/gui/qgsbrowsertreeview.h index ae7c9fff3de..9e5debef639 100644 --- a/src/gui/qgsbrowsertreeview.h +++ b/src/gui/qgsbrowsertreeview.h @@ -30,7 +30,7 @@ class GUI_EXPORT QgsBrowserTreeView : public QTreeView { Q_OBJECT public: - QgsBrowserTreeView( QWidget *parent = 0 ); + QgsBrowserTreeView( QWidget *parent = nullptr ); ~QgsBrowserTreeView(); virtual void setModel( QAbstractItemModel* model ) override; diff --git a/src/gui/qgsbusyindicatordialog.cpp b/src/gui/qgsbusyindicatordialog.cpp index abf2a2df5a2..8d0b84cdcd6 100644 --- a/src/gui/qgsbusyindicatordialog.cpp +++ b/src/gui/qgsbusyindicatordialog.cpp @@ -23,7 +23,7 @@ #include QgsBusyIndicatorDialog::QgsBusyIndicatorDialog( const QString& message, QWidget* parent, const Qt::WindowFlags& fl ) - : QDialog( parent, fl ), mMessage( QString( message ) ), mMsgLabel( 0 ) + : QDialog( parent, fl ), mMessage( QString( message ) ), mMsgLabel( nullptr ) { setWindowTitle( tr( "QGIS" ) ); setLayout( new QVBoxLayout() ); diff --git a/src/gui/qgsbusyindicatordialog.h b/src/gui/qgsbusyindicatordialog.h index 822d8cedccd..496def4a2ee 100644 --- a/src/gui/qgsbusyindicatordialog.h +++ b/src/gui/qgsbusyindicatordialog.h @@ -38,7 +38,7 @@ class GUI_EXPORT QgsBusyIndicatorDialog : public QDialog * @param parent parent object (owner) * @param fl widget flags */ - QgsBusyIndicatorDialog( const QString& message = "", QWidget *parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); + QgsBusyIndicatorDialog( const QString& message = "", QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); ~QgsBusyIndicatorDialog(); QString message() const { return mMessage; } diff --git a/src/gui/qgscharacterselectdialog.h b/src/gui/qgscharacterselectdialog.h index 36cd722b5a9..b7cfa45f918 100644 --- a/src/gui/qgscharacterselectdialog.h +++ b/src/gui/qgscharacterselectdialog.h @@ -32,7 +32,7 @@ class GUI_EXPORT QgsCharacterSelectorDialog : public QDialog, private Ui::QgsCha Q_OBJECT public: - QgsCharacterSelectorDialog( QWidget* parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); + QgsCharacterSelectorDialog( QWidget* parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); ~QgsCharacterSelectorDialog(); public slots: diff --git a/src/gui/qgscodeeditor.h b/src/gui/qgscodeeditor.h index 4ab7d0abbb8..6e8daf17393 100644 --- a/src/gui/qgscodeeditor.h +++ b/src/gui/qgscodeeditor.h @@ -42,7 +42,7 @@ class GUI_EXPORT QgsCodeEditor : public QsciScintilla * @param margin False: Enable folding for code editor * @note added in 2.6 */ - QgsCodeEditor( QWidget *parent = 0, const QString& title = "", bool folding = false, bool margin = false ); + QgsCodeEditor( QWidget *parent = nullptr, const QString& title = "", bool folding = false, bool margin = false ); ~QgsCodeEditor(); /** Set the widget title diff --git a/src/gui/qgscodeeditorcss.h b/src/gui/qgscodeeditorcss.h index 0e90afe72a0..3f49ddef512 100644 --- a/src/gui/qgscodeeditorcss.h +++ b/src/gui/qgscodeeditorcss.h @@ -29,7 +29,7 @@ class GUI_EXPORT QgsCodeEditorCSS : public QgsCodeEditor Q_OBJECT public: - QgsCodeEditorCSS( QWidget *parent = 0 ); + QgsCodeEditorCSS( QWidget *parent = nullptr ); ~QgsCodeEditorCSS(); private: diff --git a/src/gui/qgscodeeditorhtml.h b/src/gui/qgscodeeditorhtml.h index 0d439503abb..a3f9a5f3b52 100644 --- a/src/gui/qgscodeeditorhtml.h +++ b/src/gui/qgscodeeditorhtml.h @@ -29,7 +29,7 @@ class GUI_EXPORT QgsCodeEditorHTML : public QgsCodeEditor Q_OBJECT public: - QgsCodeEditorHTML( QWidget *parent = 0 ); + QgsCodeEditorHTML( QWidget *parent = nullptr ); ~QgsCodeEditorHTML(); private: diff --git a/src/gui/qgscodeeditorpython.h b/src/gui/qgscodeeditorpython.h index 9284ed7d884..e5a89e40c01 100644 --- a/src/gui/qgscodeeditorpython.h +++ b/src/gui/qgscodeeditorpython.h @@ -36,7 +36,7 @@ class GUI_EXPORT QgsCodeEditorPython : public QgsCodeEditor * @param filenames The list of apis files to load for the python lexer * @note added in 2.6 */ - QgsCodeEditorPython( QWidget *parent = 0, const QList &filenames = QList() ); + QgsCodeEditorPython( QWidget *parent = nullptr, const QList &filenames = QList() ); ~QgsCodeEditorPython(); /** Load APIs from one or more files diff --git a/src/gui/qgscodeeditorsql.h b/src/gui/qgscodeeditorsql.h index 62e3a64c555..268a8834de1 100644 --- a/src/gui/qgscodeeditorsql.h +++ b/src/gui/qgscodeeditorsql.h @@ -29,7 +29,7 @@ class GUI_EXPORT QgsCodeEditorSQL : public QgsCodeEditor Q_OBJECT public: - QgsCodeEditorSQL( QWidget *parent = 0 ); + QgsCodeEditorSQL( QWidget *parent = nullptr ); ~QgsCodeEditorSQL(); private: diff --git a/src/gui/qgscollapsiblegroupbox.cpp b/src/gui/qgscollapsiblegroupbox.cpp index 00038592aba..dcde7dc8cdb 100644 --- a/src/gui/qgscollapsiblegroupbox.cpp +++ b/src/gui/qgscollapsiblegroupbox.cpp @@ -57,8 +57,8 @@ void QgsCollapsibleGroupBoxBasic::init() mInitFlatChecked = false; mScrollOnExpand = true; mShown = false; - mParentScrollArea = 0; - mSyncParent = 0; + mParentScrollArea = nullptr; + mSyncParent = nullptr; mSyncGroup = ""; mAltDown = false; mShiftDown = false; @@ -108,7 +108,7 @@ void QgsCollapsibleGroupBoxBasic::showEvent( QShowEvent * event ) if ( parent() && parent()->parent() ) mParentScrollArea = dynamic_cast( parent()->parent()->parent() ); else - mParentScrollArea = 0; + mParentScrollArea = nullptr; if ( mParentScrollArea ) { QgsDebugMsg( "found a QScrollArea parent: " + mParentScrollArea->objectName() ); @@ -262,7 +262,7 @@ void QgsCollapsibleGroupBoxBasic::toggleCollapsed() } else { - mSyncParent = 0; + mSyncParent = nullptr; } if ( mSyncParent ) @@ -500,7 +500,7 @@ QgsCollapsibleGroupBox::~QgsCollapsibleGroupBox() saveState(); if ( mDelSettings ) // local settings obj to delete delete mSettings; - mSettings = 0; // null the pointer (in case of outside settings obj) + mSettings = nullptr; // null the pointer (in case of outside settings obj) } void QgsCollapsibleGroupBox::setSettings( QSettings* settings ) diff --git a/src/gui/qgscollapsiblegroupbox.h b/src/gui/qgscollapsiblegroupbox.h index a2a151849d5..426be9e98fe 100644 --- a/src/gui/qgscollapsiblegroupbox.h +++ b/src/gui/qgscollapsiblegroupbox.h @@ -34,7 +34,7 @@ class GUI_EXPORT QgsGroupBoxCollapseButton : public QToolButton Q_OBJECT public: - QgsGroupBoxCollapseButton( QWidget *parent = 0 ) + QgsGroupBoxCollapseButton( QWidget *parent = nullptr ) : QToolButton( parent ), mAltDown( false ), mShiftDown( false ) {} ~QgsGroupBoxCollapseButton() {} @@ -91,8 +91,8 @@ class GUI_EXPORT QgsCollapsibleGroupBoxBasic : public QGroupBox Q_PROPERTY( bool scrollOnExpand READ scrollOnExpand WRITE setScrollOnExpand ) public: - QgsCollapsibleGroupBoxBasic( QWidget *parent = 0 ); - QgsCollapsibleGroupBoxBasic( const QString &title, QWidget *parent = 0 ); + QgsCollapsibleGroupBoxBasic( QWidget *parent = nullptr ); + QgsCollapsibleGroupBoxBasic( const QString &title, QWidget *parent = nullptr ); ~QgsCollapsibleGroupBoxBasic(); /** @@ -189,8 +189,8 @@ class GUI_EXPORT QgsCollapsibleGroupBox : public QgsCollapsibleGroupBoxBasic Q_PROPERTY( bool saveCheckedState READ saveCheckedState WRITE setSaveCheckedState ) public: - QgsCollapsibleGroupBox( QWidget *parent = 0, QSettings* settings = 0 ); - QgsCollapsibleGroupBox( const QString &title, QWidget *parent = 0, QSettings* settings = 0 ); + QgsCollapsibleGroupBox( QWidget *parent = nullptr, QSettings* settings = nullptr ); + QgsCollapsibleGroupBox( const QString &title, QWidget *parent = nullptr, QSettings* settings = nullptr ); ~QgsCollapsibleGroupBox(); // set custom QSettings pointer if group box was already created from QtDesigner promotion diff --git a/src/gui/qgscolorbutton.cpp b/src/gui/qgscolorbutton.cpp index 74928eef1df..61c2aa9bae6 100644 --- a/src/gui/qgscolorbutton.cpp +++ b/src/gui/qgscolorbutton.cpp @@ -70,7 +70,7 @@ QgsColorButton::QgsColorButton( QWidget *parent, const QString& cdt, const QColo , mColor( Qt::black ) , mColorDialogOptions( cdo ) , mAcceptLiveUpdates( true ) - , mTempPNG( NULL ) + , mTempPNG( nullptr ) , mColorSet( false ) , mPickingColor( false ) { @@ -126,7 +126,7 @@ void QgsColorButton::onButtonClicked() } else { - QgsColorDialogV2 dialog( this, 0, color() ); + QgsColorDialogV2 dialog( this, nullptr, color() ); dialog.setTitle( mColorDialogTitle ); dialog.setAllowAlpha( mColorDialogOptions & QColorDialog::ShowAlphaChannel ); @@ -338,16 +338,16 @@ void QgsColorButton::showContextMenu( QMouseEvent *event ) { QMenu colorContextMenu; - QAction* copyColorAction = new QAction( tr( "Copy color" ), 0 ); + QAction* copyColorAction = new QAction( tr( "Copy color" ), nullptr ); colorContextMenu.addAction( copyColorAction ); - QAction* pasteColorAction = new QAction( tr( "Paste color" ), 0 ); + QAction* pasteColorAction = new QAction( tr( "Paste color" ), nullptr ); pasteColorAction->setEnabled( false ); colorContextMenu.addAction( pasteColorAction ); #ifndef Q_OS_MAC //disabled for OSX, as it is impossible to grab the mouse under OSX //see note for QWidget::grabMouse() re OSX Cocoa //http://qt-project.org/doc/qt-4.8/qwidget.html#grabMouse - QAction* pickColorAction = new QAction( tr( "Pick color" ), 0 ); + QAction* pickColorAction = new QAction( tr( "Pick color" ), nullptr ); colorContextMenu.addSeparator(); colorContextMenu.addAction( pickColorAction ); #endif diff --git a/src/gui/qgscolorbutton.h b/src/gui/qgscolorbutton.h index e13d15047c9..e00c028e95a 100644 --- a/src/gui/qgscolorbutton.h +++ b/src/gui/qgscolorbutton.h @@ -46,7 +46,7 @@ class GUI_EXPORT QgsColorButton: public QPushButton * @param cdo Options for the color chooser dialog * @note changed in 1.9 */ - QgsColorButton( QWidget *parent = 0, const QString& cdt = "", const QColorDialog::ColorDialogOptions& cdo = 0 ); + QgsColorButton( QWidget *parent = nullptr, const QString& cdt = "", const QColorDialog::ColorDialogOptions& cdo = nullptr ); ~QgsColorButton(); /** diff --git a/src/gui/qgscolorbuttonv2.cpp b/src/gui/qgscolorbuttonv2.cpp index 1fedf815d45..635340e802b 100644 --- a/src/gui/qgscolorbuttonv2.cpp +++ b/src/gui/qgscolorbuttonv2.cpp @@ -50,7 +50,7 @@ QgsColorButtonV2::QgsColorButtonV2( QWidget *parent, const QString& cdt, QgsColo , mShowNoColorOption( false ) , mNoColorString( tr( "No color" ) ) , mPickingColor( false ) - , mMenu( 0 ) + , mMenu( nullptr ) { //if a color scheme registry was specified, use it, otherwise use the global instance @@ -124,7 +124,7 @@ void QgsColorButtonV2::showColorDialog() } else { - QgsColorDialogV2 dialog( this, 0, color() ); + QgsColorDialogV2 dialog( this, nullptr, color() ); dialog.setTitle( mColorDialogTitle ); dialog.setAllowAlpha( mAllowAlpha ); @@ -669,7 +669,7 @@ QString QgsColorButtonV2::colorDialogTitle() const void QgsColorButtonV2::setShowMenu( const bool showMenu ) { - setMenu( showMenu ? mMenu : 0 ); + setMenu( showMenu ? mMenu : nullptr ); setPopupMode( showMenu ? QToolButton::MenuButtonPopup : QToolButton::DelayedPopup ); //force recalculation of icon size mIconSize = QSize(); diff --git a/src/gui/qgscolorbuttonv2.h b/src/gui/qgscolorbuttonv2.h index cb7bd6c9ad6..833541f9d74 100644 --- a/src/gui/qgscolorbuttonv2.h +++ b/src/gui/qgscolorbuttonv2.h @@ -62,7 +62,7 @@ class GUI_EXPORT QgsColorButtonV2 : public QToolButton * @param registry a color scheme registry for color swatch grids to show in the drop down menu. If not * specified, the button will use the global color scheme registry */ - QgsColorButtonV2( QWidget *parent = 0, const QString& cdt = "", QgsColorSchemeRegistry* registry = 0 ); + QgsColorButtonV2( QWidget *parent = nullptr, const QString& cdt = "", QgsColorSchemeRegistry* registry = nullptr ); virtual ~QgsColorButtonV2(); diff --git a/src/gui/qgscolordialog.cpp b/src/gui/qgscolordialog.cpp index 5c7e4e1b0ed..7d8d4d8509e 100644 --- a/src/gui/qgscolordialog.cpp +++ b/src/gui/qgscolordialog.cpp @@ -56,7 +56,7 @@ QColor QgsColorDialog::getLiveColor( const QColor& initialColor, QObject* update returnColor = liveDialog->currentColor(); } delete liveDialog; - liveDialog = 0; + liveDialog = nullptr; return returnColor; } @@ -305,7 +305,7 @@ void QgsColorDialogV2::setAllowAlpha( const bool allowAlpha ) QColor QgsColorDialogV2::getLiveColor( const QColor &initialColor, QObject *updateObject, const char *updateSlot, QWidget *parent, const QString &title, const bool allowAlpha ) { QColor returnColor( initialColor ); - QgsColorDialogV2* liveDialog = new QgsColorDialogV2( parent, 0, initialColor ); + QgsColorDialogV2* liveDialog = new QgsColorDialogV2( parent, nullptr, initialColor ); liveDialog->setWindowTitle( title.isEmpty() ? tr( "Select Color" ) : title ); if ( !allowAlpha ) { @@ -320,7 +320,7 @@ QColor QgsColorDialogV2::getLiveColor( const QColor &initialColor, QObject *upda returnColor = liveDialog->color(); } delete liveDialog; - liveDialog = 0; + liveDialog = nullptr; return returnColor; } @@ -338,7 +338,7 @@ QColor QgsColorDialogV2::getColor( const QColor &initialColor, QWidget *parent, } else { - QgsColorDialogV2* dialog = new QgsColorDialogV2( parent, 0, initialColor ); + QgsColorDialogV2* dialog = new QgsColorDialogV2( parent, nullptr, initialColor ); dialog->setWindowTitle( dialogTitle ); dialog->setAllowAlpha( allowAlpha ); @@ -391,7 +391,7 @@ void QgsColorDialogV2::importColors() QFileInfo fileInfo( filePath ); if ( !fileInfo.exists() || !fileInfo.isReadable() ) { - QMessageBox::critical( 0, tr( "Invalid file" ), tr( "Error, file does not exist or is not readable" ) ); + QMessageBox::critical( nullptr, tr( "Invalid file" ), tr( "Error, file does not exist or is not readable" ) ); return; } @@ -400,7 +400,7 @@ void QgsColorDialogV2::importColors() bool importOk = mSchemeList->importColorsFromGpl( file ); if ( !importOk ) { - QMessageBox::critical( 0, tr( "Invalid file" ), tr( "Error, no colors found in palette file" ) ); + QMessageBox::critical( nullptr, tr( "Invalid file" ), tr( "Error, no colors found in palette file" ) ); return; } } @@ -433,7 +433,7 @@ void QgsColorDialogV2::importPalette() QFileInfo fileInfo( filePath ); if ( !fileInfo.exists() || !fileInfo.isReadable() ) { - QMessageBox::critical( 0, tr( "Invalid file" ), tr( "Error, file does not exist or is not readable" ) ); + QMessageBox::critical( nullptr, tr( "Invalid file" ), tr( "Error, file does not exist or is not readable" ) ); return; } @@ -446,14 +446,14 @@ void QgsColorDialogV2::importPalette() importedColors = QgsSymbolLayerV2Utils::importColorsFromGpl( file, ok, paletteName ); if ( !ok ) { - QMessageBox::critical( 0, tr( "Invalid file" ), tr( "Palette file is not readable" ) ); + QMessageBox::critical( nullptr, tr( "Invalid file" ), tr( "Palette file is not readable" ) ); return; } if ( importedColors.length() == 0 ) { //no imported colors - QMessageBox::critical( 0, tr( "Invalid file" ), tr( "No colors found in palette file" ) ); + QMessageBox::critical( nullptr, tr( "Invalid file" ), tr( "No colors found in palette file" ) ); return; } @@ -584,7 +584,7 @@ void QgsColorDialogV2::exportColors() bool exportOk = mSchemeList->exportColorsToGpl( file ); if ( !exportOk ) { - QMessageBox::critical( 0, tr( "Error exporting" ), tr( "Error writing palette file" ) ); + QMessageBox::critical( nullptr, tr( "Error exporting" ), tr( "Error writing palette file" ) ); return; } } diff --git a/src/gui/qgscolordialog.h b/src/gui/qgscolordialog.h index dec7ab52502..2702f7cfc0c 100644 --- a/src/gui/qgscolordialog.h +++ b/src/gui/qgscolordialog.h @@ -46,9 +46,9 @@ class GUI_EXPORT QgsColorDialog : public QObject * @return Selected color on accepted() or initialColor on rejected(). */ static QColor getLiveColor( const QColor& initialColor, QObject* updateObject, const char* updateSlot, - QWidget* parent = 0, + QWidget* parent = nullptr, const QString& title = "", - const QColorDialog::ColorDialogOptions& options = 0 ); + const QColorDialog::ColorDialogOptions& options = nullptr ); }; @@ -71,7 +71,7 @@ class GUI_EXPORT QgsColorDialogV2 : public QDialog, private Ui::QgsColorDialogBa * @param fl window flags * @param color initial color for dialog */ - QgsColorDialogV2( QWidget *parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags, + QgsColorDialogV2( QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags, const QColor& color = QColor() ); ~QgsColorDialogV2(); @@ -103,7 +103,7 @@ class GUI_EXPORT QgsColorDialogV2 : public QDialog, private Ui::QgsColorDialogBa * @see getColor */ static QColor getLiveColor( const QColor& initialColor, QObject* updateObject, const char* updateSlot, - QWidget* parent = 0, + QWidget* parent = nullptr, const QString& title = QString(), const bool allowAlpha = true ); diff --git a/src/gui/qgscolorschemelist.h b/src/gui/qgscolorschemelist.h index 2b90e5840c1..17853637783 100644 --- a/src/gui/qgscolorschemelist.h +++ b/src/gui/qgscolorschemelist.h @@ -34,7 +34,7 @@ class GUI_EXPORT QgsColorSwatchDelegate : public QAbstractItemDelegate Q_OBJECT public: - QgsColorSwatchDelegate( QWidget *parent = 0 ); + QgsColorSwatchDelegate( QWidget *parent = nullptr ); void paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const override; QSize sizeHint( const QStyleOptionViewItem & option, const QModelIndex & index ) const override; bool editorEvent( QEvent * event, QAbstractItemModel * model, const QStyleOptionViewItem & option, const QModelIndex & index ) override; @@ -67,7 +67,7 @@ class GUI_EXPORT QgsColorSchemeModel: public QAbstractItemModel * @param baseColor base color for color scheme * @param parent parent object */ - explicit QgsColorSchemeModel( QgsColorScheme* scheme, const QString &context = QString(), const QColor &baseColor = QColor(), QObject* parent = 0 ); + explicit QgsColorSchemeModel( QgsColorScheme* scheme, const QString &context = QString(), const QColor &baseColor = QColor(), QObject* parent = nullptr ); ~QgsColorSchemeModel(); @@ -155,7 +155,7 @@ class GUI_EXPORT QgsColorSchemeList: public QTreeView * @param context context string provided to color scheme * @param baseColor base color for color scheme */ - QgsColorSchemeList( QWidget *parent = 0, QgsColorScheme* scheme = 0, const QString &context = QString(), const QColor &baseColor = QColor() ); + QgsColorSchemeList( QWidget *parent = nullptr, QgsColorScheme* scheme = nullptr, const QString &context = QString(), const QColor &baseColor = QColor() ); virtual ~QgsColorSchemeList(); diff --git a/src/gui/qgscolorswatchgrid.h b/src/gui/qgscolorswatchgrid.h index db765785cd9..8fc5b15fb55 100644 --- a/src/gui/qgscolorswatchgrid.h +++ b/src/gui/qgscolorswatchgrid.h @@ -37,7 +37,7 @@ class GUI_EXPORT QgsColorSwatchGrid : public QWidget * @param context context string provided to color scheme * @param parent parent widget */ - QgsColorSwatchGrid( QgsColorScheme* scheme, const QString& context = QString(), QWidget *parent = 0 ); + QgsColorSwatchGrid( QgsColorScheme* scheme, const QString& context = QString(), QWidget *parent = nullptr ); virtual ~QgsColorSwatchGrid(); @@ -167,7 +167,7 @@ class GUI_EXPORT QgsColorSwatchGridAction: public QWidgetAction * @param context context string provided to color scheme * @param parent parent widget */ - QgsColorSwatchGridAction( QgsColorScheme* scheme, QMenu* menu = 0, const QString& context = QString(), QWidget *parent = 0 ); + QgsColorSwatchGridAction( QgsColorScheme* scheme, QMenu* menu = nullptr, const QString& context = QString(), QWidget *parent = nullptr ); virtual ~QgsColorSwatchGridAction(); diff --git a/src/gui/qgscolorwidgets.cpp b/src/gui/qgscolorwidgets.cpp index 95565e9ac7b..32a6a70c69d 100644 --- a/src/gui/qgscolorwidgets.cpp +++ b/src/gui/qgscolorwidgets.cpp @@ -372,9 +372,9 @@ QgsColorWheel::QgsColorWheel( QWidget *parent ) , mMargin( 4 ) , mWheelThickness( 18 ) , mClickedPart( QgsColorWheel::None ) - , mWheelImage( 0 ) - , mTriangleImage( 0 ) - , mWidgetImage( 0 ) + , mWheelImage( nullptr ) + , mTriangleImage( nullptr ) + , mWidgetImage( nullptr ) , mWheelDirty( true ) , mTriangleDirty( true ) { @@ -750,7 +750,7 @@ void QgsColorWheel::createTriangle() QgsColorBox::QgsColorBox( QWidget *parent, const ColorComponent component ) : QgsColorWidget( parent, component ) , mMargin( 2 ) - , mBoxImage( 0 ) + , mBoxImage( nullptr ) , mDirty( true ) { setFocusPolicy( Qt::StrongFocus ); @@ -1260,14 +1260,14 @@ void QgsColorRampWidget::setColorFromPoint( const QPointF &point ) QgsColorSliderWidget::QgsColorSliderWidget( QWidget *parent, const ColorComponent component ) : QgsColorWidget( parent, component ) - , mRampWidget( 0 ) - , mSpinBox( 0 ) + , mRampWidget( nullptr ) + , mSpinBox( nullptr ) { QHBoxLayout* hLayout = new QHBoxLayout(); hLayout->setMargin( 0 ); hLayout->setSpacing( 5 ); - mRampWidget = new QgsColorRampWidget( 0, component ); + mRampWidget = new QgsColorRampWidget( nullptr, component ); mRampWidget->setColor( mCurrentColor ); hLayout->addWidget( mRampWidget, 1 ); @@ -1393,15 +1393,15 @@ int QgsColorSliderWidget::convertDisplayToReal( const int displayValue ) const QgsColorTextWidget::QgsColorTextWidget( QWidget *parent ) : QgsColorWidget( parent ) - , mLineEdit( 0 ) - , mMenuButton( 0 ) + , mLineEdit( nullptr ) + , mMenuButton( nullptr ) , mFormat( QgsColorTextWidget::HexRgb ) { QHBoxLayout* hLayout = new QHBoxLayout(); hLayout->setMargin( 0 ); hLayout->setSpacing( 0 ); - mLineEdit = new QLineEdit( 0 ); + mLineEdit = new QLineEdit( nullptr ); hLayout->addWidget( mLineEdit ); mMenuButton = new QToolButton( mLineEdit ); @@ -1496,13 +1496,13 @@ void QgsColorTextWidget::showMenu() { QMenu colorContextMenu; - QAction* hexRgbAction = new QAction( tr( "#RRGGBB" ), 0 ); + QAction* hexRgbAction = new QAction( tr( "#RRGGBB" ), nullptr ); colorContextMenu.addAction( hexRgbAction ); - QAction* hexRgbaAction = new QAction( tr( "#RRGGBBAA" ), 0 ); + QAction* hexRgbaAction = new QAction( tr( "#RRGGBBAA" ), nullptr ); colorContextMenu.addAction( hexRgbaAction ); - QAction* rgbAction = new QAction( tr( "rgb( r, g, b )" ), 0 ); + QAction* rgbAction = new QAction( tr( "rgb( r, g, b )" ), nullptr ); colorContextMenu.addAction( rgbAction ); - QAction* rgbaAction = new QAction( tr( "rgba( r, g, b, a )" ), 0 ); + QAction* rgbaAction = new QAction( tr( "rgba( r, g, b, a )" ), nullptr ); colorContextMenu.addAction( rgbaAction ); QAction* selectedAction = colorContextMenu.exec( QCursor::pos() ); diff --git a/src/gui/qgscolorwidgets.h b/src/gui/qgscolorwidgets.h index 7c13ab50f21..0d7bf4bd24a 100644 --- a/src/gui/qgscolorwidgets.h +++ b/src/gui/qgscolorwidgets.h @@ -57,7 +57,7 @@ class GUI_EXPORT QgsColorWidget : public QWidget * @param parent parent QWidget for the widget * @param component color component the widget alters */ - QgsColorWidget( QWidget* parent = 0, const ColorComponent component = Multiple ); + QgsColorWidget( QWidget* parent = nullptr, const ColorComponent component = Multiple ); virtual ~QgsColorWidget(); @@ -201,7 +201,7 @@ class GUI_EXPORT QgsColorWidgetAction: public QWidgetAction * @param menu parent menu * @param parent parent widget */ - QgsColorWidgetAction( QgsColorWidget* colorWidget, QMenu* menu = 0, QWidget *parent = 0 ); + QgsColorWidgetAction( QgsColorWidget* colorWidget, QMenu* menu = nullptr, QWidget *parent = nullptr ); virtual ~QgsColorWidgetAction(); @@ -269,7 +269,7 @@ class GUI_EXPORT QgsColorWheel : public QgsColorWidget /** Constructs a new color wheel widget. * @param parent parent QWidget for the widget */ - QgsColorWheel( QWidget* parent = 0 ); + QgsColorWheel( QWidget* parent = nullptr ); virtual ~QgsColorWheel(); @@ -362,7 +362,7 @@ class GUI_EXPORT QgsColorBox : public QgsColorWidget * which vary along the horizontal and vertical axis are automatically assigned * based on this constant color component. */ - QgsColorBox( QWidget* parent = 0, const ColorComponent component = Value ); + QgsColorBox( QWidget* parent = nullptr, const ColorComponent component = Value ); virtual ~QgsColorBox(); @@ -455,7 +455,7 @@ class GUI_EXPORT QgsColorRampWidget : public QgsColorWidget * @param component color component which varies along the ramp * @param orientation orientation for widget */ - QgsColorRampWidget( QWidget* parent = 0, + QgsColorRampWidget( QWidget* parent = nullptr, const ColorComponent component = QgsColorWidget::Red, const Orientation orientation = QgsColorRampWidget::Horizontal ); @@ -559,7 +559,7 @@ class GUI_EXPORT QgsColorSliderWidget : public QgsColorWidget * @param parent parent QWidget for the widget * @param component color component which is controlled by the slider */ - QgsColorSliderWidget( QWidget* parent = 0, const ColorComponent component = QgsColorWidget::Red ); + QgsColorSliderWidget( QWidget* parent = nullptr, const ColorComponent component = QgsColorWidget::Red ); virtual ~QgsColorSliderWidget(); @@ -623,7 +623,7 @@ class GUI_EXPORT QgsColorTextWidget : public QgsColorWidget /** Construct a new color line edit widget. * @param parent parent QWidget for the widget */ - QgsColorTextWidget( QWidget* parent = 0 ); + QgsColorTextWidget( QWidget* parent = nullptr ); virtual ~QgsColorTextWidget(); @@ -683,7 +683,7 @@ class GUI_EXPORT QgsColorPreviewWidget : public QgsColorWidget /** Construct a new color preview widget. * @param parent parent QWidget for the widget */ - QgsColorPreviewWidget( QWidget* parent = 0 ); + QgsColorPreviewWidget( QWidget* parent = nullptr ); virtual ~QgsColorPreviewWidget(); diff --git a/src/gui/qgscomposerruler.cpp b/src/gui/qgscomposerruler.cpp index f2b87dff111..edc61eb3af2 100644 --- a/src/gui/qgscomposerruler.cpp +++ b/src/gui/qgscomposerruler.cpp @@ -12,10 +12,10 @@ const unsigned int COUNT_VALID_MAGNITUDES = 5; const int QgsComposerRuler::validScaleMultiples[] = {1, 2, 5}; const int QgsComposerRuler::validScaleMagnitudes[] = {1, 10, 100, 1000, 10000}; -QgsComposerRuler::QgsComposerRuler( QgsComposerRuler::Direction d ) : QWidget( 0 ), +QgsComposerRuler::QgsComposerRuler( QgsComposerRuler::Direction d ) : QWidget( nullptr ), mDirection( d ), - mComposition( 0 ), - mLineSnapItem( 0 ), + mComposition( nullptr ), + mLineSnapItem( nullptr ), mScaleMinPixelsWidth( 0 ) { setMouseTracking( true ); @@ -408,7 +408,7 @@ void QgsComposerRuler::mouseReleaseEvent( QMouseEvent* event ) mComposition->removeSnapLine( mLineSnapItem ); mSnappedItems.clear(); } - mLineSnapItem = 0; + mLineSnapItem = nullptr; } void QgsComposerRuler::mousePressEvent( QMouseEvent* event ) diff --git a/src/gui/qgscomposerview.cpp b/src/gui/qgscomposerview.cpp index 7bad77de918..0803ac8fc34 100644 --- a/src/gui/qgscomposerview.cpp +++ b/src/gui/qgscomposerview.cpp @@ -51,20 +51,20 @@ QgsComposerView::QgsComposerView( QWidget* parent, const char* name, const Qt::W : QGraphicsView( parent ) , mCurrentTool( Select ) , mPreviousTool( Select ) - , mRubberBandItem( 0 ) - , mRubberBandLineItem( 0 ) - , mMoveContentItem( 0 ) + , mRubberBandItem( nullptr ) + , mRubberBandLineItem( nullptr ) + , mMoveContentItem( nullptr ) , mMarqueeSelect( false ) , mMarqueeZoom( false ) , mTemporaryZoomStatus( QgsComposerView::Inactive ) , mPaintingEnabled( true ) - , mHorizontalRuler( 0 ) - , mVerticalRuler( 0 ) + , mHorizontalRuler( nullptr ) + , mVerticalRuler( nullptr ) , mToolPanning( false ) , mMousePanning( false ) , mKeyPanning( false ) , mMovingItemContent( false ) - , mPreviewEffect( 0 ) + , mPreviewEffect( nullptr ) { Q_UNUSED( f ); Q_UNUSED( name ); @@ -194,8 +194,8 @@ void QgsComposerView::mousePressEvent( QMouseEvent* e ) } } - QgsComposerItem* selectedItem = 0; - QgsComposerItem* previousSelectedItem = 0; + QgsComposerItem* selectedItem = nullptr; + QgsComposerItem* previousSelectedItem = nullptr; if ( e->modifiers() & Qt::ControlModifier ) { @@ -479,7 +479,7 @@ void QgsComposerView::removeRubberBand() { scene()->removeItem( mRubberBandItem ); delete mRubberBandItem; - mRubberBandItem = 0; + mRubberBandItem = nullptr; } } @@ -730,7 +730,7 @@ void QgsComposerView::mouseReleaseEvent( QMouseEvent* e ) composition()->beginCommand( mMoveContentItem, tr( "Move item content" ) ); mMoveContentItem->moveContent( -moveX, -moveY ); composition()->endCommand(); - mMoveContentItem = 0; + mMoveContentItem = nullptr; mMovingItemContent = false; } break; @@ -740,7 +740,7 @@ void QgsComposerView::mouseReleaseEvent( QMouseEvent* e ) { scene()->removeItem( mRubberBandLineItem ); delete mRubberBandLineItem; - mRubberBandLineItem = 0; + mRubberBandLineItem = nullptr; return; } else @@ -754,7 +754,7 @@ void QgsComposerView::mouseReleaseEvent( QMouseEvent* e ) scene()->removeItem( mRubberBandLineItem ); delete mRubberBandLineItem; - mRubberBandLineItem = 0; + mRubberBandLineItem = nullptr; emit actionFinished(); composition()->pushAddRemoveCommand( composerArrow, tr( "Arrow added" ) ); } @@ -1243,7 +1243,7 @@ void QgsComposerView::pasteItems( PasteMode mode ) pt = mapToScene( viewport()->rect().center() ); } bool pasteInPlace = ( mode == PasteModeInPlace ); - composition()->addItemsFromXML( docElem, doc, 0, true, &pt, pasteInPlace ); + composition()->addItemsFromXML( docElem, doc, nullptr, true, &pt, pasteInPlace ); } } } @@ -1775,7 +1775,7 @@ QgsComposition* QgsComposerView::composition() return c; } } - return 0; + return nullptr; } void QgsComposerView::groupItems() @@ -1821,7 +1821,7 @@ void QgsComposerView::ungroupItems() QMainWindow* QgsComposerView::composerWindow() { - QMainWindow* composerObject = 0; + QMainWindow* composerObject = nullptr; QObject* currentObject = parent(); if ( !currentObject ) { @@ -1831,12 +1831,12 @@ QMainWindow* QgsComposerView::composerWindow() while ( true ) { composerObject = qobject_cast( currentObject ); - if ( composerObject || currentObject->parent() == 0 ) + if ( composerObject || currentObject->parent() == nullptr ) { return composerObject; } currentObject = currentObject->parent(); } - return 0; + return nullptr; } diff --git a/src/gui/qgscomposerview.h b/src/gui/qgscomposerview.h index e433a57fc2b..cdf4c0eace5 100644 --- a/src/gui/qgscomposerview.h +++ b/src/gui/qgscomposerview.h @@ -91,7 +91,7 @@ class GUI_EXPORT QgsComposerView: public QGraphicsView ActiveUntilMouseRelease }; - QgsComposerView( QWidget* parent = 0, const char* name = 0, const Qt::WindowFlags& f = 0 ); + QgsComposerView( QWidget* parent = nullptr, const char* name = nullptr, const Qt::WindowFlags& f = nullptr ); /** Add an item group containing the selected items*/ void groupItems(); diff --git a/src/gui/qgscredentialdialog.cpp b/src/gui/qgscredentialdialog.cpp index 9db9a67ef62..0f4cbb88464 100644 --- a/src/gui/qgscredentialdialog.cpp +++ b/src/gui/qgscredentialdialog.cpp @@ -31,7 +31,7 @@ static QString invalidStyle_( const QString& selector = "QLineEdit" ) QgsCredentialDialog::QgsCredentialDialog( QWidget *parent, const Qt::WindowFlags& fl ) : QDialog( parent, fl ) - , mOkButton( 0 ) + , mOkButton( nullptr ) { setupUi( this ); setInstance( this ); diff --git a/src/gui/qgscredentialdialog.h b/src/gui/qgscredentialdialog.h index aa58ef6da6d..59477961ea3 100644 --- a/src/gui/qgscredentialdialog.h +++ b/src/gui/qgscredentialdialog.h @@ -32,7 +32,7 @@ class GUI_EXPORT QgsCredentialDialog : public QDialog, public QgsCredentials, pr { Q_OBJECT public: - QgsCredentialDialog( QWidget *parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); + QgsCredentialDialog( QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); ~QgsCredentialDialog(); signals: diff --git a/src/gui/qgsdatadefinedbutton.cpp b/src/gui/qgsdatadefinedbutton.cpp index cc2ba4c5353..daf88c35d9f 100644 --- a/src/gui/qgsdatadefinedbutton.cpp +++ b/src/gui/qgsdatadefinedbutton.cpp @@ -42,8 +42,8 @@ QgsDataDefinedButton::QgsDataDefinedButton( QWidget* parent, const DataTypes& datatypes, const QString& description ) : QToolButton( parent ) - , mExpressionContextCallback( 0 ) - , mExpressionContextCallbackContext( 0 ) + , mExpressionContextCallback( nullptr ) + , mExpressionContextCallbackContext( nullptr ) { // set up static icons if ( mIconDataDefine.isNull() ) @@ -86,7 +86,7 @@ QgsDataDefinedButton::QgsDataDefinedButton( QWidget* parent, mActionDescription = new QAction( tr( "Description..." ), this ); mActionExpDialog = new QAction( tr( "Edit..." ), this ); - mActionExpression = 0; + mActionExpression = nullptr; mActionPasteExpr = new QAction( tr( "Paste" ), this ); mActionCopyExpr = new QAction( tr( "Copy" ), this ); mActionClearExpr = new QAction( tr( "Clear" ), this ); diff --git a/src/gui/qgsdatadefinedbutton.h b/src/gui/qgsdatadefinedbutton.h index b1a46a3127e..282e2f803b9 100644 --- a/src/gui/qgsdatadefinedbutton.h +++ b/src/gui/qgsdatadefinedbutton.h @@ -39,7 +39,7 @@ class GUI_EXPORT QgsDataDefinedAssistant: public QDialog Q_OBJECT public: - QgsDataDefinedAssistant() : mMapCanvas( 0 ) {} + QgsDataDefinedAssistant() : mMapCanvas( nullptr ) {} virtual QgsDataDefined dataDefined() const = 0; @@ -91,9 +91,9 @@ class GUI_EXPORT QgsDataDefinedButton: public QToolButton * @param datatypes The expected data types to be compared against the variant type of the QgsField from data source and expression result * @param description The description of expected input data */ - QgsDataDefinedButton( QWidget* parent = 0, - const QgsVectorLayer* vl = 0, - const QgsDataDefined* datadefined = 0, + QgsDataDefinedButton( QWidget* parent = nullptr, + const QgsVectorLayer* vl = nullptr, + const QgsDataDefined* datadefined = nullptr, const QgsDataDefinedButton::DataTypes& datatypes = AnyType, const QString& description = QString() ); ~QgsDataDefinedButton(); @@ -107,7 +107,7 @@ class GUI_EXPORT QgsDataDefinedButton: public QToolButton * @param description The description of expected input data */ void init( const QgsVectorLayer* vl, - const QgsDataDefined* datadefined = 0, + const QgsDataDefined* datadefined = nullptr, const QgsDataDefinedButton::DataTypes& datatypes = AnyType, const QString& description = QString() ); diff --git a/src/gui/qgsdatumtransformdialog.h b/src/gui/qgsdatumtransformdialog.h index e8da81a9eb0..cc99d3019e5 100644 --- a/src/gui/qgsdatumtransformdialog.h +++ b/src/gui/qgsdatumtransformdialog.h @@ -24,7 +24,7 @@ class GUI_EXPORT QgsDatumTransformDialog: public QDialog, private Ui::QgsDatumTr { Q_OBJECT public: - QgsDatumTransformDialog( const QString& layerName, const QList< QList< int > >& dt, QWidget * parent = 0, const Qt::WindowFlags& f = 0 ); + QgsDatumTransformDialog( const QString& layerName, const QList< QList< int > >& dt, QWidget * parent = nullptr, const Qt::WindowFlags& f = nullptr ); ~QgsDatumTransformDialog(); //! @note added in 2.4 diff --git a/src/gui/qgsdetaileditemdelegate.h b/src/gui/qgsdetaileditemdelegate.h index 4e5de217c8f..1896371a75c 100644 --- a/src/gui/qgsdetaileditemdelegate.h +++ b/src/gui/qgsdetaileditemdelegate.h @@ -36,7 +36,7 @@ class GUI_EXPORT QgsDetailedItemDelegate : { Q_OBJECT public: - QgsDetailedItemDelegate( QObject * parent = 0 ); + QgsDetailedItemDelegate( QObject * parent = nullptr ); ~QgsDetailedItemDelegate(); /** Reimplement for parent class */ void paint( QPainter * thePainter, diff --git a/src/gui/qgsdetaileditemwidget.h b/src/gui/qgsdetaileditemwidget.h index 9ad2ffe5c62..8161a2996b1 100644 --- a/src/gui/qgsdetaileditemwidget.h +++ b/src/gui/qgsdetaileditemwidget.h @@ -29,7 +29,7 @@ class GUI_EXPORT QgsDetailedItemWidget : { Q_OBJECT public: - QgsDetailedItemWidget( QWidget * parent = 0 ); + QgsDetailedItemWidget( QWidget * parent = nullptr ); ~QgsDetailedItemWidget(); void setData( const QgsDetailedItemData& theData ); void setChecked( bool theFlag ); diff --git a/src/gui/qgsdial.cpp b/src/gui/qgsdial.cpp index a94517d52d8..9873dd8536f 100644 --- a/src/gui/qgsdial.cpp +++ b/src/gui/qgsdial.cpp @@ -35,7 +35,7 @@ void QgsDial::paintEvent( QPaintEvent *event ) QRect rect = geometry(); painter.setPen( QPen( palette().color( QPalette::WindowText ) ) ); painter.drawText( QRectF( 0, rect.height() * 0.65, rect.width(), rect.height() ), - Qt::AlignHCenter, variantValue().toString(), 0 ); + Qt::AlignHCenter, variantValue().toString(), nullptr ); painter.end(); } diff --git a/src/gui/qgsdial.h b/src/gui/qgsdial.h index b949942d844..7738dd68b7e 100644 --- a/src/gui/qgsdial.h +++ b/src/gui/qgsdial.h @@ -24,7 +24,7 @@ class GUI_EXPORT QgsDial : public QDial { Q_OBJECT public: - QgsDial( QWidget *parent = 0 ); + QgsDial( QWidget *parent = nullptr ); void setMinimum( const QVariant &min ); void setMaximum( const QVariant &max ); diff --git a/src/gui/qgsdialog.cpp b/src/gui/qgsdialog.cpp index 8f9f80c0a56..ed9e6404df3 100644 --- a/src/gui/qgsdialog.cpp +++ b/src/gui/qgsdialog.cpp @@ -28,7 +28,7 @@ QgsDialog::QgsDialog( QWidget *parent, const Qt::WindowFlags& fl, connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); // layout - QLayout *layout = 0; + QLayout *layout = nullptr; if ( orientation == Qt::Horizontal ) layout = new QVBoxLayout(); else diff --git a/src/gui/qgsdialog.h b/src/gui/qgsdialog.h index dbc96491450..c275b0c3c77 100644 --- a/src/gui/qgsdialog.h +++ b/src/gui/qgsdialog.h @@ -31,7 +31,7 @@ class GUI_EXPORT QgsDialog : public QDialog { Q_OBJECT public: - QgsDialog( QWidget *parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags, + QgsDialog( QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags, const QDialogButtonBox::StandardButtons& buttons = QDialogButtonBox::Close, Qt::Orientation orientation = Qt::Horizontal ); ~QgsDialog(); diff --git a/src/gui/qgsencodingfiledialog.cpp b/src/gui/qgsencodingfiledialog.cpp index 0b6074d33be..6a771122ecd 100644 --- a/src/gui/qgsencodingfiledialog.cpp +++ b/src/gui/qgsencodingfiledialog.cpp @@ -31,7 +31,7 @@ QgsEncodingFileDialog::QgsEncodingFileDialog( QWidget * parent, : QFileDialog( parent, caption, directory, filter ) { mCancelAll = false; - mCancelAllButton = 0; + mCancelAllButton = nullptr; mEncodingComboBox = new QComboBox( this ); QLabel* l = new QLabel( tr( "Encoding:" ), this ); layout()->addWidget( l ); @@ -90,7 +90,7 @@ void QgsEncodingFileDialog::addCancelAll() { if ( ! mCancelAllButton ) { - mCancelAllButton = new QPushButton( tr( "Cancel &All" ), NULL ); + mCancelAllButton = new QPushButton( tr( "Cancel &All" ), nullptr ); layout()->addWidget( mCancelAllButton ); // Ownership transfered, no need to delete later on connect( mCancelAllButton, SIGNAL( clicked() ), this, SLOT( pbnCancelAll_clicked() ) ); } diff --git a/src/gui/qgsencodingfiledialog.h b/src/gui/qgsencodingfiledialog.h index 0ee4758bf15..4b4342606c3 100644 --- a/src/gui/qgsencodingfiledialog.h +++ b/src/gui/qgsencodingfiledialog.h @@ -27,7 +27,7 @@ class GUI_EXPORT QgsEncodingFileDialog: public QFileDialog { Q_OBJECT public: - QgsEncodingFileDialog( QWidget * parent = 0, + QgsEncodingFileDialog( QWidget * parent = nullptr, const QString & caption = QString(), const QString & directory = QString(), const QString & filter = QString(), const QString & encoding = QString() ); ~QgsEncodingFileDialog(); diff --git a/src/gui/qgserrordialog.h b/src/gui/qgserrordialog.h index 9ab2fc3e1c2..87d365b1729 100644 --- a/src/gui/qgserrordialog.h +++ b/src/gui/qgserrordialog.h @@ -27,7 +27,7 @@ class GUI_EXPORT QgsErrorDialog: public QDialog, private Ui::QgsErrorDialogBase { Q_OBJECT public: - QgsErrorDialog( const QgsError & theError, const QString & theTitle, QWidget *parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); + QgsErrorDialog( const QgsError & theError, const QString & theTitle, QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); ~QgsErrorDialog(); /** Show dialog with error @@ -36,7 +36,7 @@ class GUI_EXPORT QgsErrorDialog: public QDialog, private Ui::QgsErrorDialogBase * @param parent parent object * @param fl widget flags */ - static void show( const QgsError & theError, const QString & theTitle, QWidget *parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); + static void show( const QgsError & theError, const QString & theTitle, QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); public slots: void on_mDetailPushButton_clicked(); diff --git a/src/gui/qgsexpressionbuilderdialog.h b/src/gui/qgsexpressionbuilderdialog.h index 70f094d9a5f..2cb99e8169f 100644 --- a/src/gui/qgsexpressionbuilderdialog.h +++ b/src/gui/qgsexpressionbuilderdialog.h @@ -28,7 +28,7 @@ class GUI_EXPORT QgsExpressionBuilderDialog : public QDialog, private Ui::QgsExp Q_OBJECT public: - QgsExpressionBuilderDialog( QgsVectorLayer* layer, const QString& startText = QString(), QWidget* parent = NULL, const QString& key = "generic", + QgsExpressionBuilderDialog( QgsVectorLayer* layer, const QString& startText = QString(), QWidget* parent = nullptr, const QString& key = "generic", const QgsExpressionContext& context = QgsExpressionContext() ); /** The builder widget that is used by the dialog */ diff --git a/src/gui/qgsexpressionbuilderwidget.cpp b/src/gui/qgsexpressionbuilderwidget.cpp index 9e5738018ec..5fca0d14074 100644 --- a/src/gui/qgsexpressionbuilderwidget.cpp +++ b/src/gui/qgsexpressionbuilderwidget.cpp @@ -37,8 +37,8 @@ QgsExpressionBuilderWidget::QgsExpressionBuilderWidget( QWidget *parent ) : QWidget( parent ) , mAutoSave( true ) - , mLayer( NULL ) - , highlighter( NULL ) + , mLayer( nullptr ) + , highlighter( nullptr ) , mExpressionValid( false ) { setupUi( this ); @@ -269,7 +269,7 @@ void QgsExpressionBuilderWidget::on_expressionTree_doubleClicked( const QModelIn { QModelIndex idx = mProxyModel->mapToSource( index ); QgsExpressionItem* item = dynamic_cast( mModel->itemFromIndex( idx ) ); - if ( item == 0 ) + if ( item == nullptr ) return; // Don't handle the double click it we are on a header node. diff --git a/src/gui/qgsexpressionhighlighter.h b/src/gui/qgsexpressionhighlighter.h index 29d06b91468..dc1bae30eff 100644 --- a/src/gui/qgsexpressionhighlighter.h +++ b/src/gui/qgsexpressionhighlighter.h @@ -30,7 +30,7 @@ class GUI_EXPORT QgsExpressionHighlighter : public QSyntaxHighlighter Q_OBJECT public: - QgsExpressionHighlighter( QTextDocument *parent = 0 ); + QgsExpressionHighlighter( QTextDocument *parent = nullptr ); void addFields( const QStringList& fieldList ); protected: diff --git a/src/gui/qgsexpressionselectiondialog.h b/src/gui/qgsexpressionselectiondialog.h index 57d211bc32b..855352e3d21 100644 --- a/src/gui/qgsexpressionselectiondialog.h +++ b/src/gui/qgsexpressionselectiondialog.h @@ -37,7 +37,7 @@ class GUI_EXPORT QgsExpressionSelectionDialog : public QDialog, private Ui::QgsE * @param startText A default expression text to be applied (Defaults to empty) * @param parent parent object (owner) */ - QgsExpressionSelectionDialog( QgsVectorLayer* layer, const QString& startText = QString(), QWidget* parent = 0 ); + QgsExpressionSelectionDialog( QgsVectorLayer* layer, const QString& startText = QString(), QWidget* parent = nullptr ); /** * The builder widget that is used by the dialog diff --git a/src/gui/qgsextentgroupbox.h b/src/gui/qgsextentgroupbox.h index 37e97c16a36..b8ca1331bca 100644 --- a/src/gui/qgsextentgroupbox.h +++ b/src/gui/qgsextentgroupbox.h @@ -26,7 +26,7 @@ class GUI_EXPORT QgsExtentGroupBox : public QgsCollapsibleGroupBox, private Ui:: Q_PROPERTY( QString titleBase READ titleBase WRITE setTitleBase ) public: - explicit QgsExtentGroupBox( QWidget* parent = 0 ); + explicit QgsExtentGroupBox( QWidget* parent = nullptr ); enum ExtentState { diff --git a/src/gui/qgsfeatureselectiondlg.cpp b/src/gui/qgsfeatureselectiondlg.cpp index fae29d4796e..023c7030874 100644 --- a/src/gui/qgsfeatureselectiondlg.cpp +++ b/src/gui/qgsfeatureselectiondlg.cpp @@ -32,7 +32,7 @@ QgsFeatureSelectionDlg::QgsFeatureSelectionDlg( QgsVectorLayer* vl, QgsAttribute mDualView->setFeatureSelectionManager( mFeatureSelection ); // TODO: Proper QgsDistanceArea, proper mapcanvas - mDualView->init( mVectorLayer, NULL, QgsFeatureRequest(), context ); + mDualView->init( mVectorLayer, nullptr, QgsFeatureRequest(), context ); } const QgsFeatureIds& QgsFeatureSelectionDlg::selectedFeatures() diff --git a/src/gui/qgsfeatureselectiondlg.h b/src/gui/qgsfeatureselectiondlg.h index 58d9e5c0a23..7ea35dfcf45 100644 --- a/src/gui/qgsfeatureselectiondlg.h +++ b/src/gui/qgsfeatureselectiondlg.h @@ -25,7 +25,7 @@ class GUI_EXPORT QgsFeatureSelectionDlg : public QDialog, private Ui::QgsFeature Q_OBJECT public: - explicit QgsFeatureSelectionDlg( QgsVectorLayer* vl, QgsAttributeEditorContext &context, QWidget *parent = 0 ); + explicit QgsFeatureSelectionDlg( QgsVectorLayer* vl, QgsAttributeEditorContext &context, QWidget *parent = nullptr ); /** * Get the selected features diff --git a/src/gui/qgsfieldcombobox.h b/src/gui/qgsfieldcombobox.h index 77c86f8c6df..fae5251205c 100644 --- a/src/gui/qgsfieldcombobox.h +++ b/src/gui/qgsfieldcombobox.h @@ -41,7 +41,7 @@ class GUI_EXPORT QgsFieldComboBox : public QComboBox * @brief QgsFieldComboBox creates a combo box to display the fields of a layer. * The layer can be either manually given or dynamically set by connecting the signal QgsMapLayerComboBox::layerChanged to the slot setLayer. */ - explicit QgsFieldComboBox( QWidget *parent = 0 ); + explicit QgsFieldComboBox( QWidget *parent = nullptr ); //! setFilters allows fitering according to the type of field void setFilters( const QgsFieldProxyModel::Filters& filters ); diff --git a/src/gui/qgsfieldexpressionwidget.cpp b/src/gui/qgsfieldexpressionwidget.cpp index d14be1abab9..04f0dec7a5a 100644 --- a/src/gui/qgsfieldexpressionwidget.cpp +++ b/src/gui/qgsfieldexpressionwidget.cpp @@ -25,9 +25,9 @@ QgsFieldExpressionWidget::QgsFieldExpressionWidget( QWidget *parent ) : QWidget( parent ) , mExpressionDialogTitle( tr( "Expression dialog" ) ) - , mDa( 0 ) - , mExpressionContextCallback( 0 ) - , mExpressionContextCallbackContext( 0 ) + , mDa( nullptr ) + , mExpressionContextCallback( nullptr ) + , mExpressionContextCallbackContext( nullptr ) { QHBoxLayout* layout = new QHBoxLayout( this ); layout->setContentsMargins( 0, 0, 0, 0 ); diff --git a/src/gui/qgsfieldexpressionwidget.h b/src/gui/qgsfieldexpressionwidget.h index 1ed0568038b..29da3693c11 100644 --- a/src/gui/qgsfieldexpressionwidget.h +++ b/src/gui/qgsfieldexpressionwidget.h @@ -48,7 +48,7 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget /** * @brief QgsFieldExpressionWidget creates a widget with a combo box to display the fields and expression and a button to open the expression dialog */ - explicit QgsFieldExpressionWidget( QWidget *parent = 0 ); + explicit QgsFieldExpressionWidget( QWidget *parent = nullptr ); //! define the title used in the expression dialog void setExpressionDialogTitle( const QString& title ); @@ -72,12 +72,12 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget * @param isExpression determines if the string returned is the name of a field or an expression * @param isValid determines if the expression (or field) returned is valid */ - QString currentField( bool *isExpression = 0, bool *isValid = 0 ) const; + QString currentField( bool *isExpression = nullptr, bool *isValid = nullptr ) const; /** * Return true if the current expression is valid */ - bool isValidExpression( QString *expressionError = 0 ) const; + bool isValidExpression( QString *expressionError = nullptr ) const; bool isExpression() const; /** diff --git a/src/gui/qgsfieldmodel.cpp b/src/gui/qgsfieldmodel.cpp index f78efb3f7bc..f0d62bb71b7 100644 --- a/src/gui/qgsfieldmodel.cpp +++ b/src/gui/qgsfieldmodel.cpp @@ -25,7 +25,7 @@ QgsFieldModel::QgsFieldModel( QObject *parent ) : QAbstractItemModel( parent ) - , mLayer( NULL ) + , mLayer( nullptr ) , mAllowExpression( false ) { } @@ -90,7 +90,7 @@ void QgsFieldModel::setLayer( QgsVectorLayer *layer ) void QgsFieldModel::layerDeleted() { - mLayer = 0; + mLayer = nullptr; updateModel(); } diff --git a/src/gui/qgsfieldmodel.h b/src/gui/qgsfieldmodel.h index 5b35fba4362..14b08d37892 100644 --- a/src/gui/qgsfieldmodel.h +++ b/src/gui/qgsfieldmodel.h @@ -45,7 +45,7 @@ class GUI_EXPORT QgsFieldModel : public QAbstractItemModel /** * @brief QgsFieldModel creates a model to display the fields of a given layer */ - explicit QgsFieldModel( QObject *parent = 0 ); + explicit QgsFieldModel( QObject *parent = nullptr ); //! return the index corresponding to a given fieldName QModelIndex indexFromName( const QString &fieldName ); diff --git a/src/gui/qgsfieldproxymodel.h b/src/gui/qgsfieldproxymodel.h index 28cdc2e5ef8..f8382f27ad2 100644 --- a/src/gui/qgsfieldproxymodel.h +++ b/src/gui/qgsfieldproxymodel.h @@ -46,7 +46,7 @@ class GUI_EXPORT QgsFieldProxyModel : public QSortFilterProxyModel * @brief QgsFieldProxModel creates a proxy model with a QgsFieldModel as source model. * It can be used to filter the fields based on their types. */ - explicit QgsFieldProxyModel( QObject *parent = 0 ); + explicit QgsFieldProxyModel( QObject *parent = nullptr ); //! sourceFieldModel returns the QgsFieldModel used in this QSortFilterProxyModel QgsFieldModel* sourceFieldModel() { return mModel; } diff --git a/src/gui/qgsfieldvalidator.cpp b/src/gui/qgsfieldvalidator.cpp index f3dc5f1d40d..a4d8b77c876 100644 --- a/src/gui/qgsfieldvalidator.cpp +++ b/src/gui/qgsfieldvalidator.cpp @@ -80,7 +80,7 @@ QgsFieldValidator::QgsFieldValidator( QObject *parent, const QgsField &field, co break; default: - mValidator = 0; + mValidator = nullptr; } QSettings settings; diff --git a/src/gui/qgsfiledropedit.h b/src/gui/qgsfiledropedit.h index d1cecb52c33..aca397ceba3 100644 --- a/src/gui/qgsfiledropedit.h +++ b/src/gui/qgsfiledropedit.h @@ -26,7 +26,7 @@ class GUI_EXPORT QgsFileDropEdit: public QLineEdit Q_OBJECT public: - QgsFileDropEdit( QWidget *parent = 0 ); + QgsFileDropEdit( QWidget *parent = nullptr ); virtual ~QgsFileDropEdit(); bool isDirOnly() const { return mDirOnly; } diff --git a/src/gui/qgsfilterlineedit.h b/src/gui/qgsfilterlineedit.h index 53b8ab81513..af993d21232 100644 --- a/src/gui/qgsfilterlineedit.h +++ b/src/gui/qgsfilterlineedit.h @@ -31,7 +31,7 @@ class GUI_EXPORT QgsFilterLineEdit : public QLineEdit Q_PROPERTY( QString nullValue READ nullValue WRITE setNullValue ) public: - QgsFilterLineEdit( QWidget* parent = 0, const QString& nullValue = QString::null ); + QgsFilterLineEdit( QWidget* parent = nullptr, const QString& nullValue = QString::null ); void setNullValue( const QString& nullValue ) { mNullValue = nullValue; } diff --git a/src/gui/qgsformannotationitem.cpp b/src/gui/qgsformannotationitem.cpp index ee2d8ae9cb0..234626ee78c 100644 --- a/src/gui/qgsformannotationitem.cpp +++ b/src/gui/qgsformannotationitem.cpp @@ -35,8 +35,8 @@ QgsFormAnnotationItem::QgsFormAnnotationItem( QgsMapCanvas* canvas, QgsVectorLayer* vlayer, bool hasFeature, int feature ) : QgsAnnotationItem( canvas ) - , mWidgetContainer( 0 ) - , mDesignerWidget( 0 ) + , mWidgetContainer( nullptr ) + , mDesignerWidget( nullptr ) , mVectorLayer( vlayer ) , mHasAssociatedFeature( hasFeature ) , mFeature( feature ) @@ -62,7 +62,7 @@ QgsFormAnnotationItem::~QgsFormAnnotationItem() void QgsFormAnnotationItem::setDesignerForm( const QString& uiFile ) { mDesignerForm = uiFile; - mWidgetContainer->setWidget( 0 ); + mWidgetContainer->setWidget( nullptr ); delete mDesignerWidget; mDesignerWidget = createDesignerWidget( uiFile ); if ( mDesignerWidget ) @@ -78,13 +78,13 @@ QWidget* QgsFormAnnotationItem::createDesignerWidget( const QString& filePath ) QFile file( filePath ); if ( !file.open( QFile::ReadOnly ) ) { - return 0; + return nullptr; } QUiLoader loader; QFileInfo fi( file ); loader.setWorkingDirectory( fi.dir() ); - QWidget* widget = loader.load( &file, 0 ); + QWidget* widget = loader.load( &file, nullptr ); file.close(); //get feature and set attribute information @@ -194,7 +194,7 @@ void QgsFormAnnotationItem::writeXML( QDomDocument& doc ) const void QgsFormAnnotationItem::readXML( const QDomDocument& doc, const QDomElement& itemElem ) { - mVectorLayer = 0; + mVectorLayer = nullptr; if ( itemElem.hasAttribute( "vectorLayer" ) ) { mVectorLayer = dynamic_cast( QgsMapLayerRegistry::instance()->mapLayer( itemElem.attribute( "vectorLayer", "" ) ) ); @@ -251,7 +251,7 @@ void QgsFormAnnotationItem::setFeatureForMapPosition() mFeature = currentFeatureId; //create new embedded widget - mWidgetContainer->setWidget( 0 ); + mWidgetContainer->setWidget( nullptr ); delete mDesignerWidget; mDesignerWidget = createDesignerWidget( mDesignerForm ); if ( mDesignerWidget ) diff --git a/src/gui/qgsformannotationitem.h b/src/gui/qgsformannotationitem.h index 62e60dcc85f..ee8d3757758 100644 --- a/src/gui/qgsformannotationitem.h +++ b/src/gui/qgsformannotationitem.h @@ -29,13 +29,13 @@ class GUI_EXPORT QgsFormAnnotationItem: public QObject, public QgsAnnotationItem { Q_OBJECT public: - QgsFormAnnotationItem( QgsMapCanvas* canvas, QgsVectorLayer* vlayer = 0, bool hasFeature = false, int feature = 0 ); + QgsFormAnnotationItem( QgsMapCanvas* canvas, QgsVectorLayer* vlayer = nullptr, bool hasFeature = false, int feature = 0 ); ~QgsFormAnnotationItem(); void paint( QPainter * painter ) override; //! paint function called by map canvas - void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ) override; + void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override; QSizeF minimumFrameSize() const override; /** Returns the optimal frame size*/ diff --git a/src/gui/qgsgenericprojectionselector.h b/src/gui/qgsgenericprojectionselector.h index 60527600713..bbac5264688 100644 --- a/src/gui/qgsgenericprojectionselector.h +++ b/src/gui/qgsgenericprojectionselector.h @@ -51,7 +51,7 @@ class GUI_EXPORT QgsGenericProjectionSelector : public QDialog, private Ui::QgsG /** * Constructor */ - QgsGenericProjectionSelector( QWidget *parent = 0, + QgsGenericProjectionSelector( QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); //! Destructor diff --git a/src/gui/qgsgeometryrubberband.cpp b/src/gui/qgsgeometryrubberband.cpp index 86d9312304e..c35f42a7949 100644 --- a/src/gui/qgsgeometryrubberband.cpp +++ b/src/gui/qgsgeometryrubberband.cpp @@ -22,7 +22,7 @@ #include QgsGeometryRubberBand::QgsGeometryRubberBand( QgsMapCanvas* mapCanvas, QGis::GeometryType geomType ): QgsMapCanvasItem( mapCanvas ), - mGeometry( 0 ), mIconSize( 5 ), mIconType( ICON_BOX ), mGeometryType( geomType ) + mGeometry( nullptr ), mIconSize( 5 ), mIconType( ICON_BOX ), mGeometryType( geomType ) { mPen = QPen( QColor( 255, 0, 0 ) ); mBrush = QBrush( QColor( 255, 0, 0 ) ); diff --git a/src/gui/qgshighlight.cpp b/src/gui/qgshighlight.cpp index 6c05fe2a4d9..f42c3282649 100644 --- a/src/gui/qgshighlight.cpp +++ b/src/gui/qgshighlight.cpp @@ -56,7 +56,7 @@ QgsHighlight::QgsHighlight( QgsMapCanvas* mapCanvas, const QgsGeometry *geom, Qg , mBuffer( 0 ) , mMinWidth( 0 ) { - mGeometry = geom ? new QgsGeometry( *geom ) : 0; + mGeometry = geom ? new QgsGeometry( *geom ) : nullptr; init(); } @@ -66,13 +66,13 @@ QgsHighlight::QgsHighlight( QgsMapCanvas* mapCanvas, const QgsGeometry *geom, Qg , mBuffer( 0 ) , mMinWidth( 0 ) { - mGeometry = geom ? new QgsGeometry( *geom ) : 0; + mGeometry = geom ? new QgsGeometry( *geom ) : nullptr; init(); } QgsHighlight::QgsHighlight( QgsMapCanvas* mapCanvas, const QgsFeature& feature, QgsVectorLayer *layer ) : QgsMapCanvasItem( mapCanvas ) - , mGeometry( 0 ) + , mGeometry( nullptr ) , mLayer( static_cast( layer ) ) , mFeature( feature ) , mBuffer( 0 ) @@ -127,7 +127,7 @@ void QgsHighlight::setFillColor( const QColor & fillColor ) QgsFeatureRendererV2 * QgsHighlight::getRenderer( QgsRenderContext & context, const QColor & color, const QColor & fillColor ) { - QgsFeatureRendererV2 *renderer = 0; + QgsFeatureRendererV2 *renderer = nullptr; QgsVectorLayer *layer = qobject_cast( mLayer ); if ( layer && layer->rendererV2() ) { diff --git a/src/gui/qgshistogramwidget.cpp b/src/gui/qgshistogramwidget.cpp index 422aad7fd44..ebdc3fb4846 100644 --- a/src/gui/qgshistogramwidget.cpp +++ b/src/gui/qgshistogramwidget.cpp @@ -220,7 +220,7 @@ void QgsHistogramWidget::drawHistogram() !mRanges.isEmpty() ? QBrush( mHistoColors.at( 0 ) ) : mBrush, !mRanges.isEmpty() ? Qt::NoPen : mPen ); #else - HistogramItem *plotHistogramItem = 0; + HistogramItem *plotHistogramItem = nullptr; plotHistogramItem = createHistoItem( !mRanges.isEmpty() > 0 ? mRanges.at( 0 ).label() : QString(), !mRanges.isEmpty() > 0 ? QBrush( mHistoColors.at( 0 ) ) : mBrush, !mRanges.isEmpty() > 0 ? Qt::NoPen : mPen ); diff --git a/src/gui/qgshistogramwidget.h b/src/gui/qgshistogramwidget.h index c09173dc70e..6906d28a08a 100644 --- a/src/gui/qgshistogramwidget.h +++ b/src/gui/qgshistogramwidget.h @@ -58,7 +58,7 @@ class GUI_EXPORT QgsHistogramWidget : public QWidget, private Ui::QgsHistogramWi * @param layer source vector layer * @param fieldOrExp field name or expression string */ - QgsHistogramWidget( QWidget *parent = 0, QgsVectorLayer* layer = 0, const QString& fieldOrExp = QString() ); + QgsHistogramWidget( QWidget *parent = nullptr, QgsVectorLayer* layer = nullptr, const QString& fieldOrExp = QString() ); ~QgsHistogramWidget(); diff --git a/src/gui/qgshtmlannotationitem.cpp b/src/gui/qgshtmlannotationitem.cpp index 06027ce9f91..7a8e02c437d 100644 --- a/src/gui/qgshtmlannotationitem.cpp +++ b/src/gui/qgshtmlannotationitem.cpp @@ -38,8 +38,8 @@ QgsHtmlAnnotationItem::QgsHtmlAnnotationItem( QgsMapCanvas* canvas, QgsVectorLayer* vlayer, bool hasFeature, int feature ) : QgsAnnotationItem( canvas ) - , mWidgetContainer( 0 ) - , mWebView( 0 ) + , mWidgetContainer( nullptr ) + , mWebView( nullptr ) , mVectorLayer( vlayer ) , mHasAssociatedFeature( hasFeature ) , mFeatureId( feature ) @@ -162,7 +162,7 @@ void QgsHtmlAnnotationItem::writeXML( QDomDocument& doc ) const void QgsHtmlAnnotationItem::readXML( const QDomDocument& doc, const QDomElement& itemElem ) { - mVectorLayer = 0; + mVectorLayer = nullptr; if ( itemElem.hasAttribute( "vectorLayer" ) ) { mVectorLayer = dynamic_cast( QgsMapLayerRegistry::instance()->mapLayer( itemElem.attribute( "vectorLayer", "" ) ) ); diff --git a/src/gui/qgshtmlannotationitem.h b/src/gui/qgshtmlannotationitem.h index d71221c907d..e1f0ebb9633 100644 --- a/src/gui/qgshtmlannotationitem.h +++ b/src/gui/qgshtmlannotationitem.h @@ -32,13 +32,13 @@ class GUI_EXPORT QgsHtmlAnnotationItem: public QObject, public QgsAnnotationItem { Q_OBJECT public: - QgsHtmlAnnotationItem( QgsMapCanvas* canvas, QgsVectorLayer* vlayer = 0, bool hasFeature = false, int feature = 0 ); + QgsHtmlAnnotationItem( QgsMapCanvas* canvas, QgsVectorLayer* vlayer = nullptr, bool hasFeature = false, int feature = 0 ); ~QgsHtmlAnnotationItem(); void paint( QPainter * painter ) override; //! paint function called by map canvas - void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ) override; + void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = nullptr ) override; QSizeF minimumFrameSize() const override; diff --git a/src/gui/qgsidentifymenu.cpp b/src/gui/qgsidentifymenu.cpp index 14e099657fe..607e4e77a87 100644 --- a/src/gui/qgsidentifymenu.cpp +++ b/src/gui/qgsidentifymenu.cpp @@ -129,7 +129,7 @@ QList QgsIdentifyMenu::exec( const QListsetData( QVariant::fromValue( ActionData( 0 ) ) ); + allAction->setData( QVariant::fromValue( ActionData( nullptr ) ) ); connect( allAction, SIGNAL( hovered() ), this, SLOT( handleMenuHover() ) ); addAction( allAction ); } @@ -163,7 +163,7 @@ void QgsIdentifyMenu::closeEvent( QCloseEvent* e ) void QgsIdentifyMenu::addRasterLayer( QgsMapLayer* layer ) { QAction* layerAction; - QMenu* layerMenu = 0; + QMenu* layerMenu = nullptr; QList separators = QList(); QList layerActions = mCustomActionRegistry.mapLayerActions( layer, QgsMapLayerAction::Layer ); @@ -225,8 +225,8 @@ void QgsIdentifyMenu::addRasterLayer( QgsMapLayer* layer ) void QgsIdentifyMenu::addVectorLayer( QgsVectorLayer* layer, const QList& results, bool singleLayer ) { - QAction* layerAction = 0; - QMenu* layerMenu = 0; + QAction* layerAction = nullptr; + QMenu* layerMenu = nullptr; // do not add actions with MultipleFeatures as target if only 1 feature is found for this layer // targets defines which actions will be shown @@ -341,9 +341,9 @@ void QgsIdentifyMenu::addVectorLayer( QgsVectorLayer* layer, const QList customFeatureActions = mCustomActionRegistry.mapLayerActions( layer, QgsMapLayerAction::SingleFeature ); if ( mShowFeatureActions ) diff --git a/src/gui/qgsidentifymenu.h b/src/gui/qgsidentifymenu.h index b3605fe530c..a3ee3515813 100644 --- a/src/gui/qgsidentifymenu.h +++ b/src/gui/qgsidentifymenu.h @@ -60,26 +60,26 @@ class GUI_EXPORT QgsIdentifyMenu : public QMenu : mIsValid( false ) , mAllResults( false ) , mIsExternalAction( false ) - , mLayer( NULL ) + , mLayer( nullptr ) , mFeatureId( 0 ) , mLevel( LayerLevel ) - , mMapLayerAction( NULL ) + , mMapLayerAction( nullptr ) {} - ActionData( QgsMapLayer* layer, QgsMapLayerAction* mapLayerAction = 0 ) + ActionData( QgsMapLayer* layer, QgsMapLayerAction* mapLayerAction = nullptr ) : mIsValid( true ) - , mAllResults( layer == 0 ) - , mIsExternalAction( mapLayerAction != 0 ) + , mAllResults( layer == nullptr ) + , mIsExternalAction( mapLayerAction != nullptr ) , mLayer( layer ) , mFeatureId( 0 ) , mLevel( LayerLevel ) , mMapLayerAction( mapLayerAction ) {} - ActionData( QgsMapLayer* layer, QgsFeatureId fid, QgsMapLayerAction* mapLayerAction = 0 ) + ActionData( QgsMapLayer* layer, QgsFeatureId fid, QgsMapLayerAction* mapLayerAction = nullptr ) : mIsValid( true ) , mAllResults( false ) - , mIsExternalAction( mapLayerAction != 0 ) + , mIsExternalAction( mapLayerAction != nullptr ) , mLayer( layer ) , mFeatureId( fid ) , mLevel( FeatureLevel ) diff --git a/src/gui/qgslegendfilterbutton.cpp b/src/gui/qgslegendfilterbutton.cpp index 30a2aa9a4b8..d2d388d3387 100644 --- a/src/gui/qgslegendfilterbutton.cpp +++ b/src/gui/qgslegendfilterbutton.cpp @@ -23,8 +23,8 @@ QgsLegendFilterButton::QgsLegendFilterButton( QWidget* parent ) : QToolButton( parent ) - , mMenu( 0 ) - , mLayer( 0 ) + , mMenu( nullptr ) + , mLayer( nullptr ) { mMenu = new QMenu( this ); mSetExpressionAction = new QAction( tr( "Edit filter expression" ), mMenu ); diff --git a/src/gui/qgslegendfilterbutton.h b/src/gui/qgslegendfilterbutton.h index 6032d6e15a0..e26f5a04e2a 100644 --- a/src/gui/qgslegendfilterbutton.h +++ b/src/gui/qgslegendfilterbutton.h @@ -36,7 +36,7 @@ class GUI_EXPORT QgsLegendFilterButton: public QToolButton * * @param parent The parent QWidget */ - QgsLegendFilterButton( QWidget* parent = 0 ); + QgsLegendFilterButton( QWidget* parent = nullptr ); ~QgsLegendFilterButton(); /** diff --git a/src/gui/qgslegendinterface.h b/src/gui/qgslegendinterface.h index 7ecfd9adf00..8edd75c7d5c 100644 --- a/src/gui/qgslegendinterface.h +++ b/src/gui/qgslegendinterface.h @@ -121,7 +121,7 @@ class GUI_EXPORT QgsLegendInterface : public QObject //! Add a new group //! a parent group can be given to nest the new group in it - virtual int addGroup( const QString& name, bool expand = true, QTreeWidgetItem* parent = 0 ) = 0; + virtual int addGroup( const QString& name, bool expand = true, QTreeWidgetItem* parent = nullptr ) = 0; //! Add a new group //! a parent group index has to be given to nest the new group in it diff --git a/src/gui/qgsludialog.h b/src/gui/qgsludialog.h index 8e0e3c0d808..16696c8eeca 100644 --- a/src/gui/qgsludialog.h +++ b/src/gui/qgsludialog.h @@ -26,7 +26,7 @@ class GUI_EXPORT QgsLUDialog: public QDialog, private Ui::QgsLUDialogBase { Q_OBJECT public: - QgsLUDialog( QWidget *parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); + QgsLUDialog( QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); ~QgsLUDialog(); QString lowerValue() const; void setLowerValue( const QString& val ); diff --git a/src/gui/qgsmanageconnectionsdialog.h b/src/gui/qgsmanageconnectionsdialog.h index 52912be9bc1..5571a05b1b0 100644 --- a/src/gui/qgsmanageconnectionsdialog.h +++ b/src/gui/qgsmanageconnectionsdialog.h @@ -46,7 +46,7 @@ class GUI_EXPORT QgsManageConnectionsDialog : public QDialog, private Ui::QgsMan // constructor // mode argument must be 0 for export and 1 for import // type argument must be 0 for WMS and 1 for PostGIS - QgsManageConnectionsDialog( QWidget *parent = NULL, Mode mode = Export, Type type = WMS, const QString& fileName = "" ); + QgsManageConnectionsDialog( QWidget *parent = nullptr, Mode mode = Export, Type type = WMS, const QString& fileName = "" ); public slots: void doExportImport(); diff --git a/src/gui/qgsmapcanvas.cpp b/src/gui/qgsmapcanvas.cpp index c1b7e767661..9b195638705 100644 --- a/src/gui/qgsmapcanvas.cpp +++ b/src/gui/qgsmapcanvas.cpp @@ -184,14 +184,14 @@ void QgsMapCanvasRendererSync::onLayersC2R() QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name ) : QGraphicsView( parent ) , mCanvasProperties( new CanvasProperties ) - , mJob( 0 ) + , mJob( nullptr ) , mJobCancelled( false ) - , mLabelingResults( 0 ) + , mLabelingResults( nullptr ) , mUseParallelRendering( false ) , mDrawRenderingStats( false ) - , mCache( 0 ) - , mPreviewEffect( 0 ) - , mSnappingUtils( 0 ) + , mCache( nullptr ) + , mPreviewEffect( nullptr ) + , mSnappingUtils( nullptr ) { setObjectName( name ); mScene = new QGraphicsScene(); @@ -199,10 +199,10 @@ QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name ) setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); mLastExtentIndex = -1; - mCurrentLayer = NULL; - mMapOverview = NULL; - mMapTool = NULL; - mLastNonZoomMapTool = NULL; + mCurrentLayer = nullptr; + mMapOverview = nullptr; + mMapTool = nullptr; + mLastNonZoomMapTool = nullptr; mFrozen = false; mRefreshScheduled = false; @@ -270,9 +270,9 @@ QgsMapCanvas::~QgsMapCanvas() if ( mMapTool ) { mMapTool->deactivate(); - mMapTool = NULL; + mMapTool = nullptr; } - mLastNonZoomMapTool = NULL; + mLastNonZoomMapTool = nullptr; // delete canvas items prior to deleteing the canvas // because they might try to update canvas when it's @@ -295,7 +295,7 @@ QgsMapCanvas::~QgsMapCanvas() if ( mJob ) { mJob->cancel(); - Q_ASSERT( mJob == 0 ); + Q_ASSERT( mJob == nullptr ); } delete mCache; @@ -334,7 +334,7 @@ QgsMapLayer* QgsMapCanvas::layer( int index ) if ( index >= 0 && index < ( int ) layers.size() ) return QgsMapLayerRegistry::instance()->mapLayer( layers[index] ); else - return NULL; + return nullptr; } @@ -364,7 +364,7 @@ bool QgsMapCanvas::isDirty() const bool QgsMapCanvas::isDrawing() { - return mJob != 0; + return mJob != nullptr; } // isDrawing @@ -567,13 +567,13 @@ void QgsMapCanvas::setCachingEnabled( bool enabled ) else { delete mCache; - mCache = 0; + mCache = nullptr; } } bool QgsMapCanvas::isCachingEnabled() const { - return mCache != 0; + return mCache != nullptr; } void QgsMapCanvas::clearCache() @@ -668,7 +668,7 @@ void QgsMapCanvas::refreshMap() mSettings.setExpressionContext( expressionContext ); // create the renderer job - Q_ASSERT( mJob == 0 ); + Q_ASSERT( mJob == nullptr ); mJobCancelled = false; if ( mUseParallelRendering ) mJob = new QgsMapRendererParallelJob( mSettings ); @@ -752,7 +752,7 @@ void QgsMapCanvas::rendererJobFinished() // now we are in a slot called from mJob - do not delete it immediately // so the class is still valid when the execution returns to the class mJob->deleteLater(); - mJob = 0; + mJob = nullptr; emit mapCanvasRefreshed(); } @@ -781,7 +781,7 @@ void QgsMapCanvas::stopRendering() QgsDebugMsg( "CANVAS stop rendering!" ); mJobCancelled = true; mJob->cancel(); - Q_ASSERT( mJob == 0 ); // no need to delete here: already deleted in finished() + Q_ASSERT( mJob == nullptr ); // no need to delete here: already deleted in finished() } } @@ -795,7 +795,7 @@ void QgsMapCanvas::saveAsImage( const QString& theFileName, QPixmap * theQPixmap // //check if the optional QPaintDevice was supplied // - if ( theQPixmap != NULL ) + if ( theQPixmap != nullptr ) { // render QPainter painter; @@ -1035,13 +1035,13 @@ bool QgsMapCanvas::hasCrsTransformEnabled() void QgsMapCanvas::zoomToSelected( QgsVectorLayer* layer ) { - if ( layer == NULL ) + if ( layer == nullptr ) { // use current layer by default layer = qobject_cast( mCurrentLayer ); } - if ( layer == NULL ) + if ( layer == nullptr ) { return; } @@ -1077,13 +1077,13 @@ void QgsMapCanvas::zoomToSelected( QgsVectorLayer* layer ) void QgsMapCanvas::panToSelected( QgsVectorLayer* layer ) { - if ( layer == NULL ) + if ( layer == nullptr ) { // use current layer by default layer = qobject_cast( mCurrentLayer ); } - if ( layer == NULL ) + if ( layer == nullptr ) { return; } @@ -1306,7 +1306,7 @@ void QgsMapCanvas::mouseReleaseEvent( QMouseEvent* e ) && ( !mLastNonZoomMapTool->isEditTool() || ( vlayer && vlayer->isEditable() ) ) ) { QgsMapTool* t = mLastNonZoomMapTool; - mLastNonZoomMapTool = NULL; + mLastNonZoomMapTool = nullptr; setMapTool( t ); } return; @@ -1506,7 +1506,7 @@ void QgsMapCanvas::setMapTool( QgsMapTool* tool ) } else { - mLastNonZoomMapTool = NULL; + mLastNonZoomMapTool = nullptr; } QgsMapTool* oldTool = mMapTool; @@ -1528,15 +1528,15 @@ void QgsMapCanvas::unsetMapTool( QgsMapTool* tool ) if ( mMapTool && mMapTool == tool ) { mMapTool->deactivate(); - mMapTool = NULL; - emit mapToolSet( NULL ); - emit mapToolSet( NULL, mMapTool ); + mMapTool = nullptr; + emit mapToolSet( nullptr ); + emit mapToolSet( nullptr, mMapTool ); setCursor( Qt::ArrowCursor ); } if ( mLastNonZoomMapTool && mLastNonZoomMapTool == tool ) { - mLastNonZoomMapTool = NULL; + mLastNonZoomMapTool = nullptr; } } @@ -1957,7 +1957,7 @@ void QgsMapCanvas::dragEnterEvent( QDragEnterEvent * e ) void QgsMapCanvas::mapToolDestroyed() { QgsDebugMsg( "maptool destroyed" ); - mMapTool = 0; + mMapTool = nullptr; } #ifdef HAVE_TOUCH diff --git a/src/gui/qgsmapcanvas.h b/src/gui/qgsmapcanvas.h index 12334fe0014..4634fdcaacc 100644 --- a/src/gui/qgsmapcanvas.h +++ b/src/gui/qgsmapcanvas.h @@ -113,7 +113,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView enum WheelAction { WheelZoom, WheelZoomAndRecenter, WheelZoomToMouseCursor, WheelNothing }; //! Constructor - QgsMapCanvas( QWidget * parent = 0, const char *name = 0 ); + QgsMapCanvas( QWidget * parent = nullptr, const char *name = nullptr ); //! Destructor ~QgsMapCanvas(); @@ -238,10 +238,10 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView /** Zoom to the extent of the selected features of current (vector) layer. @param layer optionally specify different than current layer */ - void zoomToSelected( QgsVectorLayer* layer = NULL ); + void zoomToSelected( QgsVectorLayer* layer = nullptr ); /** Pan to the selected features of current (vector) layer keeping same extent. */ - void panToSelected( QgsVectorLayer* layer = NULL ); + void panToSelected( QgsVectorLayer* layer = nullptr ); /** \brief Sets the map tool currently being used on the canvas */ void setMapTool( QgsMapTool* mapTool ); @@ -337,7 +337,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView //! Zoom with the factor supplied. Factor > 1 zooms out, interval (0,1) zooms in //! If point is given, re-center on it - void zoomByFactor( double scaleFactor, const QgsPoint *center = 0 ); + void zoomByFactor( double scaleFactor, const QgsPoint *center = nullptr ); //! Zooms in/out with a given center void zoomWithCenter( int x, int y, bool zoomIn ); @@ -443,7 +443,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView void selectionChangedSlot(); //! Save the convtents of the map canvas to disk as an image - void saveAsImage( const QString& theFileName, QPixmap * QPixmap = 0, const QString& = "PNG" ); + void saveAsImage( const QString& theFileName, QPixmap * QPixmap = nullptr, const QString& = "PNG" ); //! This slot is connected to the visibility change of one or more layers void layerStateChange(); diff --git a/src/gui/qgsmapcanvasitem.h b/src/gui/qgsmapcanvasitem.h index 6a1466c6dd4..5036092068c 100644 --- a/src/gui/qgsmapcanvasitem.h +++ b/src/gui/qgsmapcanvasitem.h @@ -42,7 +42,7 @@ class GUI_EXPORT QgsMapCanvasItem : public QGraphicsItem //! paint function called by map canvas virtual void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, - QWidget * widget = 0 ) override; + QWidget * widget = nullptr ) override; //! schedules map canvas for repaint void updateCanvas(); diff --git a/src/gui/qgsmapcanvassnapper.cpp b/src/gui/qgsmapcanvassnapper.cpp index 3fcbbd5e0ed..bee5c5bc0f9 100644 --- a/src/gui/qgsmapcanvassnapper.cpp +++ b/src/gui/qgsmapcanvassnapper.cpp @@ -28,7 +28,7 @@ QgsMapCanvasSnapper::QgsMapCanvasSnapper( QgsMapCanvas* canvas ) : mMapCanvas( canvas ) - , mSnapper( 0 ) + , mSnapper( nullptr ) { if ( !canvas ) return; @@ -36,7 +36,7 @@ QgsMapCanvasSnapper::QgsMapCanvasSnapper( QgsMapCanvas* canvas ) mSnapper = new QgsSnapper( canvas->mapSettings() ); } -QgsMapCanvasSnapper::QgsMapCanvasSnapper(): mMapCanvas( 0 ), mSnapper( 0 ) +QgsMapCanvasSnapper::QgsMapCanvasSnapper(): mMapCanvas( nullptr ), mSnapper( nullptr ) { } @@ -55,7 +55,7 @@ void QgsMapCanvasSnapper::setMapCanvas( QgsMapCanvas* canvas ) } else { - mSnapper = 0; + mSnapper = nullptr; } } diff --git a/src/gui/qgsmapcanvassnappingutils.cpp b/src/gui/qgsmapcanvassnappingutils.cpp index bb976ff5607..a85c9d9a731 100644 --- a/src/gui/qgsmapcanvassnappingutils.cpp +++ b/src/gui/qgsmapcanvassnappingutils.cpp @@ -9,7 +9,7 @@ QgsMapCanvasSnappingUtils::QgsMapCanvasSnappingUtils( QgsMapCanvas* canvas, QObject* parent ) : QgsSnappingUtils( parent ) , mCanvas( canvas ) - , mProgress( NULL ) + , mProgress( nullptr ) { connect( canvas, SIGNAL( extentsChanged() ), this, SLOT( canvasMapSettingsChanged() ) ); connect( canvas, SIGNAL( destinationCrsChanged() ), this, SLOT( canvasMapSettingsChanged() ) ); @@ -45,7 +45,7 @@ void QgsMapCanvasSnappingUtils::prepareIndexProgress( int index ) if ( index == mProgress->maximum() ) { delete mProgress; - mProgress = 0; + mProgress = nullptr; QApplication::restoreOverrideCursor(); } } diff --git a/src/gui/qgsmapcanvassnappingutils.h b/src/gui/qgsmapcanvassnappingutils.h index 8c52b6a94f9..4ca5a2bd2fc 100644 --- a/src/gui/qgsmapcanvassnappingutils.h +++ b/src/gui/qgsmapcanvassnappingutils.h @@ -15,7 +15,7 @@ class GUI_EXPORT QgsMapCanvasSnappingUtils : public QgsSnappingUtils { Q_OBJECT public: - QgsMapCanvasSnappingUtils( QgsMapCanvas* canvas, QObject* parent = 0 ); + QgsMapCanvasSnappingUtils( QgsMapCanvas* canvas, QObject* parent = nullptr ); protected: virtual void prepareIndexStarting( int count ) override; diff --git a/src/gui/qgsmaplayeractionregistry.cpp b/src/gui/qgsmaplayeractionregistry.cpp index 9e61bccccf4..0c69684c846 100644 --- a/src/gui/qgsmaplayeractionregistry.cpp +++ b/src/gui/qgsmaplayeractionregistry.cpp @@ -19,7 +19,7 @@ QgsMapLayerAction::QgsMapLayerAction( const QString& name, QObject* parent, const Targets& targets, const QIcon& icon ) : QAction( icon, name, parent ) , mSingleLayer( false ) - , mActionLayer( 0 ) + , mActionLayer( nullptr ) , mSpecificLayerType( false ) , mLayerType( QgsMapLayer::VectorLayer ) , mTargets( targets ) @@ -41,7 +41,7 @@ QgsMapLayerAction::QgsMapLayerAction( const QString& name, QObject* parent, QgsM QgsMapLayerAction::QgsMapLayerAction( const QString& name, QObject* parent, QgsMapLayer::LayerType layerType, const Targets& targets, const QIcon& icon ) : QAction( icon, name, parent ) , mSingleLayer( false ) - , mActionLayer( 0 ) + , mActionLayer( nullptr ) , mSpecificLayerType( true ) , mLayerType( layerType ) , mTargets( targets ) @@ -95,10 +95,10 @@ void QgsMapLayerAction::triggerForLayer( QgsMapLayer* layer ) // // Static calls to enforce singleton behaviour // -QgsMapLayerActionRegistry *QgsMapLayerActionRegistry::mInstance = 0; +QgsMapLayerActionRegistry *QgsMapLayerActionRegistry::mInstance = nullptr; QgsMapLayerActionRegistry *QgsMapLayerActionRegistry::instance() { - if ( mInstance == 0 ) + if ( mInstance == nullptr ) { mInstance = new QgsMapLayerActionRegistry(); } @@ -152,7 +152,7 @@ bool QgsMapLayerActionRegistry::removeMapLayerAction( QgsMapLayerAction* action { if ( defaultIt.value() == action ) { - defaultIt.value() = 0; + defaultIt.value() = nullptr; } } emit changed(); @@ -171,7 +171,7 @@ QgsMapLayerAction * QgsMapLayerActionRegistry::defaultActionForLayer( QgsMapLaye { if ( !mDefaultLayerActionMap.contains( layer ) ) { - return 0; + return nullptr; } return mDefaultLayerActionMap[ layer ]; diff --git a/src/gui/qgsmaplayeractionregistry.h b/src/gui/qgsmaplayeractionregistry.h index 31c3afa4c0e..7ff0dc400a1 100644 --- a/src/gui/qgsmaplayeractionregistry.h +++ b/src/gui/qgsmaplayeractionregistry.h @@ -129,7 +129,7 @@ class GUI_EXPORT QgsMapLayerActionRegistry : public QObject protected: //! protected constructor - QgsMapLayerActionRegistry( QObject * parent = 0 ); + QgsMapLayerActionRegistry( QObject * parent = nullptr ); QList< QgsMapLayerAction* > mMapLayerActionList; diff --git a/src/gui/qgsmaplayercombobox.cpp b/src/gui/qgsmaplayercombobox.cpp index 610d70a474a..220326ffb93 100644 --- a/src/gui/qgsmaplayercombobox.cpp +++ b/src/gui/qgsmaplayercombobox.cpp @@ -55,13 +55,13 @@ QgsMapLayer *QgsMapLayerComboBox::layer( int layerIndex ) const const QModelIndex proxyIndex = mProxyModel->index( layerIndex, 0 ); if ( !proxyIndex.isValid() ) { - return 0; + return nullptr; } const QModelIndex index = mProxyModel->mapToSource( proxyIndex ); if ( !index.isValid() ) { - return 0; + return nullptr; } QgsMapLayer* layer = static_cast( index.internalPointer() ); @@ -69,7 +69,7 @@ QgsMapLayer *QgsMapLayerComboBox::layer( int layerIndex ) const { return layer; } - return 0; + return nullptr; } void QgsMapLayerComboBox::indexChanged( int i ) @@ -88,7 +88,7 @@ void QgsMapLayerComboBox::rowsChanged() } else if ( count() == 0 ) { - emit layerChanged( 0 ); + emit layerChanged( nullptr ); } } diff --git a/src/gui/qgsmaplayercombobox.h b/src/gui/qgsmaplayercombobox.h index e357b9b5fb7..4822a4dfc68 100644 --- a/src/gui/qgsmaplayercombobox.h +++ b/src/gui/qgsmaplayercombobox.h @@ -38,7 +38,7 @@ class GUI_EXPORT QgsMapLayerComboBox : public QComboBox * @brief QgsMapLayerComboBox creates a combo box to dislpay the list of layers (currently in the registry). * The layers can be filtered and/or ordered. */ - explicit QgsMapLayerComboBox( QWidget *parent = 0 ); + explicit QgsMapLayerComboBox( QWidget *parent = nullptr ); //! setFilters allows fitering according to layer type and/or geometry type. void setFilters( const QgsMapLayerProxyModel::Filters& filters ) { mProxyModel->setFilters( filters ); } diff --git a/src/gui/qgsmaplayermodel.cpp b/src/gui/qgsmaplayermodel.cpp index 35f1d70313a..ba522ee0b0d 100644 --- a/src/gui/qgsmaplayermodel.cpp +++ b/src/gui/qgsmaplayermodel.cpp @@ -218,7 +218,7 @@ Qt::ItemFlags QgsMapLayerModel::flags( const QModelIndex &index ) const { if ( !index.isValid() ) { - return 0; + return nullptr; } Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable; diff --git a/src/gui/qgsmaplayermodel.h b/src/gui/qgsmaplayermodel.h index ee427bd1061..24b5efdd5b8 100644 --- a/src/gui/qgsmaplayermodel.h +++ b/src/gui/qgsmaplayermodel.h @@ -38,11 +38,11 @@ class GUI_EXPORT QgsMapLayerModel : public QAbstractItemModel /** * @brief QgsMapLayerModel creates a model to display layers in widgets. */ - explicit QgsMapLayerModel( QObject *parent = 0 ); + explicit QgsMapLayerModel( QObject *parent = nullptr ); /** * @brief QgsMapLayerModel creates a model to display a specific list of layers in a widget. */ - explicit QgsMapLayerModel( const QList& layers, QObject *parent = 0 ); + explicit QgsMapLayerModel( const QList& layers, QObject *parent = nullptr ); /** * @brief setItemsCheckable defines if layers should be selectable in the widget diff --git a/src/gui/qgsmaplayerproxymodel.h b/src/gui/qgsmaplayerproxymodel.h index 2b08257a520..0fe99fb0077 100644 --- a/src/gui/qgsmaplayerproxymodel.h +++ b/src/gui/qgsmaplayerproxymodel.h @@ -48,7 +48,7 @@ class GUI_EXPORT QgsMapLayerProxyModel : public QSortFilterProxyModel * @brief QgsMapLayerProxModel creates a proxy model with a QgsMapLayerModel as source model. * It can be used to filter the layers list in a widget. */ - explicit QgsMapLayerProxyModel( QObject *parent = 0 ); + explicit QgsMapLayerProxyModel( QObject *parent = nullptr ); /** * @brief layerModel returns the QgsMapLayerModel used in this QSortFilterProxyModel diff --git a/src/gui/qgsmapmouseevent.h b/src/gui/qgsmapmouseevent.h index 4dbeda0479f..154faf8ed0d 100644 --- a/src/gui/qgsmapmouseevent.h +++ b/src/gui/qgsmapmouseevent.h @@ -77,7 +77,7 @@ class GUI_EXPORT QgsMapMouseEvent : public QMouseEvent * @param snapped if given, determines if a segment has been snapped * @param allLayers if true, override snapping mode */ - QList snapSegment( SnappingMode snappingMode, bool* snapped = 0, bool allLayers = false ) const; + QList snapSegment( SnappingMode snappingMode, bool* snapped = nullptr, bool allLayers = false ) const; /** * Returns true if there is a snapped point cached. diff --git a/src/gui/qgsmapoverviewcanvas.cpp b/src/gui/qgsmapoverviewcanvas.cpp index cc52ec447a6..f68fe11d682 100644 --- a/src/gui/qgsmapoverviewcanvas.cpp +++ b/src/gui/qgsmapoverviewcanvas.cpp @@ -34,7 +34,7 @@ QgsMapOverviewCanvas::QgsMapOverviewCanvas( QWidget * parent, QgsMapCanvas* mapCanvas ) : QWidget( parent ) , mMapCanvas( mapCanvas ) - , mJob( 0 ) + , mJob( nullptr ) { setAutoFillBackground( true ); setObjectName( "theOverviewCanvas" ); @@ -194,7 +194,7 @@ void QgsMapOverviewCanvas::mapRenderingFinished() mPixmap = QPixmap::fromImage( mJob->renderedImage() ); delete mJob; - mJob = 0; + mJob = nullptr; // schedule repaint update(); diff --git a/src/gui/qgsmapoverviewcanvas.h b/src/gui/qgsmapoverviewcanvas.h index fd0f6b3a622..b6fc8af0146 100644 --- a/src/gui/qgsmapoverviewcanvas.h +++ b/src/gui/qgsmapoverviewcanvas.h @@ -41,7 +41,7 @@ class GUI_EXPORT QgsMapOverviewCanvas : public QWidget Q_OBJECT public: - QgsMapOverviewCanvas( QWidget * parent = 0, QgsMapCanvas* mapCanvas = NULL ); + QgsMapOverviewCanvas( QWidget * parent = nullptr, QgsMapCanvas* mapCanvas = nullptr ); ~QgsMapOverviewCanvas(); diff --git a/src/gui/qgsmaptool.cpp b/src/gui/qgsmaptool.cpp index ab633aea5ee..c61153e1c6d 100644 --- a/src/gui/qgsmaptool.cpp +++ b/src/gui/qgsmaptool.cpp @@ -26,8 +26,8 @@ QgsMapTool::QgsMapTool( QgsMapCanvas* canvas ) : QObject( canvas ) , mCanvas( canvas ) , mCursor( Qt::CrossCursor ) - , mAction( NULL ) - , mButton( NULL ) + , mAction( nullptr ) + , mButton( nullptr ) , mToolName( QString() ) { } @@ -118,7 +118,7 @@ void QgsMapTool::setAction( QAction* action ) void QgsMapTool::actionDestroyed() { if ( mAction == sender() ) - mAction = 0; + mAction = nullptr; } QAction* QgsMapTool::action() diff --git a/src/gui/qgsmaptoolcapture.cpp b/src/gui/qgsmaptoolcapture.cpp index 3792e4ef613..a94939fd41a 100644 --- a/src/gui/qgsmaptoolcapture.cpp +++ b/src/gui/qgsmaptoolcapture.cpp @@ -36,10 +36,10 @@ QgsMapToolCapture::QgsMapToolCapture( QgsMapCanvas* canvas, QgsAdvancedDigitizingDockWidget* cadDockWidget, CaptureMode mode ) : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget ) - , mRubberBand( 0 ) - , mTempRubberBand( 0 ) - , mValidator( 0 ) - , mSnappingMarker( 0 ) + , mRubberBand( nullptr ) + , mTempRubberBand( nullptr ) + , mValidator( nullptr ) + , mSnappingMarker( nullptr ) #ifdef Q_OS_WIN , mSkipNextContextMenuEvent( 0 ) #endif @@ -71,14 +71,14 @@ QgsMapToolCapture::~QgsMapToolCapture() if ( mValidator ) { mValidator->deleteLater(); - mValidator = 0; + mValidator = nullptr; } } void QgsMapToolCapture::deactivate() { delete mSnappingMarker; - mSnappingMarker = 0; + mSnappingMarker = nullptr; QgsMapToolAdvancedDigitizing::deactivate(); } @@ -132,7 +132,7 @@ void QgsMapToolCapture::cadCanvasMoveEvent( QgsMapMouseEvent * e ) if ( !snapped ) { delete mSnappingMarker; - mSnappingMarker = 0; + mSnappingMarker = nullptr; } else { @@ -352,13 +352,13 @@ void QgsMapToolCapture::stopCapturing() if ( mRubberBand ) { delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; } if ( mTempRubberBand ) { delete mTempRubberBand; - mTempRubberBand = 0; + mTempRubberBand = nullptr; } while ( !mGeomErrorMarkers.isEmpty() ) @@ -391,7 +391,7 @@ void QgsMapToolCapture::deleteTempRubberBand() if ( mTempRubberBand ) { delete mTempRubberBand; - mTempRubberBand = 0; + mTempRubberBand = nullptr; } } @@ -409,7 +409,7 @@ void QgsMapToolCapture::validateGeometry() if ( mValidator ) { mValidator->deleteLater(); - mValidator = 0; + mValidator = nullptr; } mValidationWarnings.clear(); diff --git a/src/gui/qgsmaptoolidentify.h b/src/gui/qgsmaptoolidentify.h index 03e1512ef66..cf5f316a230 100644 --- a/src/gui/qgsmaptoolidentify.h +++ b/src/gui/qgsmaptoolidentify.h @@ -67,7 +67,7 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool struct IdentifyResult { - IdentifyResult() : mLayer( NULL ) {} + IdentifyResult() : mLayer( nullptr ) {} IdentifyResult( QgsMapLayer * layer, const QgsFeature& feature, const QMap< QString, QString >& derivedAttributes ): mLayer( layer ), mFeature( feature ), mDerivedAttributes( derivedAttributes ) {} diff --git a/src/gui/qgsmaptoolidentifyfeature.h b/src/gui/qgsmaptoolidentifyfeature.h index 0bc465dcd22..b5f90fe8653 100644 --- a/src/gui/qgsmaptoolidentifyfeature.h +++ b/src/gui/qgsmaptoolidentifyfeature.h @@ -33,7 +33,7 @@ class GUI_EXPORT QgsMapToolIdentifyFeature : public QgsMapToolIdentify * @param canvas the map canvas * @param vl the vector layer. The map tool can be initialized without any layer and can be set afterward. */ - QgsMapToolIdentifyFeature( QgsMapCanvas* canvas, QgsVectorLayer* vl = 0 ); + QgsMapToolIdentifyFeature( QgsMapCanvas* canvas, QgsVectorLayer* vl = nullptr ); ~QgsMapToolIdentifyFeature(); diff --git a/src/gui/qgsmaptoolzoom.cpp b/src/gui/qgsmaptoolzoom.cpp index 13dcb17fc40..99e1aac8f64 100644 --- a/src/gui/qgsmaptoolzoom.cpp +++ b/src/gui/qgsmaptoolzoom.cpp @@ -31,7 +31,7 @@ QgsMapToolZoom::QgsMapToolZoom( QgsMapCanvas* canvas, bool zoomOut ) : QgsMapTool( canvas ) , mZoomOut( zoomOut ) , mDragging( false ) - , mRubberBand( 0 ) + , mRubberBand( nullptr ) { mToolName = tr( "Zoom" ); // set the cursor @@ -90,14 +90,14 @@ void QgsMapToolZoom::canvasReleaseEvent( QgsMapMouseEvent* e ) { mDragging = false; delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; } if ( mDragging ) { mDragging = false; delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; // store the rectangle mZoomRect.setRight( e->pos().x() ); @@ -131,7 +131,7 @@ void QgsMapToolZoom::canvasReleaseEvent( QgsMapMouseEvent* e ) void QgsMapToolZoom::deactivate() { delete mRubberBand; - mRubberBand = 0; + mRubberBand = nullptr; QgsMapTool::deactivate(); } diff --git a/src/gui/qgsmessagebar.cpp b/src/gui/qgsmessagebar.cpp index f62e860e397..295bc199d52 100644 --- a/src/gui/qgsmessagebar.cpp +++ b/src/gui/qgsmessagebar.cpp @@ -31,7 +31,7 @@ #include QgsMessageBar::QgsMessageBar( QWidget *parent ) - : QFrame( parent ), mCurrentItem( NULL ) + : QFrame( parent ), mCurrentItem( nullptr ) { QPalette pal = palette(); pal.setBrush( backgroundRole(), pal.window() ); @@ -135,7 +135,7 @@ void QgsMessageBar::popItem( QgsMessageBarItem *item ) mCurrentItem->hide(); disconnect( mCurrentItem, SIGNAL( styleChanged( QString ) ), this, SLOT( setStyleSheet( QString ) ) ); delete mCurrentItem; - mCurrentItem = 0; + mCurrentItem = nullptr; } if ( !mItems.isEmpty() ) @@ -230,7 +230,7 @@ void QgsMessageBar::showItem( QgsMessageBarItem *item ) { Q_ASSERT( item ); - if ( mCurrentItem != 0 ) + if ( mCurrentItem != nullptr ) disconnect( mCurrentItem, SIGNAL( styleChanged( QString ) ), this, SLOT( setStyleSheet( QString ) ) ); if ( item == mCurrentItem ) @@ -342,6 +342,6 @@ void QgsMessageBar::updateItemCount() mItemCount->setText( !mItems.isEmpty() ? tr( "%n more", "unread messages", mItems.count() ) : QString() ); // do not show the down arrow for opening menu with "close all" if there is just one message - mCloseBtn->setMenu( !mItems.isEmpty() ? mCloseMenu : 0 ); + mCloseBtn->setMenu( !mItems.isEmpty() ? mCloseMenu : nullptr ); mCloseBtn->setPopupMode( !mItems.isEmpty() ? QToolButton::MenuButtonPopup : QToolButton::DelayedPopup ); } diff --git a/src/gui/qgsmessagebar.h b/src/gui/qgsmessagebar.h index 0965f54e923..d88506aa0c8 100644 --- a/src/gui/qgsmessagebar.h +++ b/src/gui/qgsmessagebar.h @@ -52,7 +52,7 @@ class GUI_EXPORT QgsMessageBar: public QFrame SUCCESS = 3 }; - QgsMessageBar( QWidget *parent = 0 ); + QgsMessageBar( QWidget *parent = nullptr ); ~QgsMessageBar(); /** @@ -80,11 +80,11 @@ class GUI_EXPORT QgsMessageBar: public QFrame bool popWidget( QgsMessageBarItem *item ); //! make out a widget containing a message to be displayed on the bar - static QgsMessageBarItem* createMessage( const QString &text, QWidget *parent = 0 ); + static QgsMessageBarItem* createMessage( const QString &text, QWidget *parent = nullptr ); //! make out a widget containing title and message to be displayed on the bar - static QgsMessageBarItem* createMessage( const QString &title, const QString &text, QWidget *parent = 0 ); + static QgsMessageBarItem* createMessage( const QString &title, const QString &text, QWidget *parent = nullptr ); //! make out a widget containing title and message to be displayed on the bar - static QgsMessageBarItem* createMessage( QWidget *widget, QWidget *parent = 0 ); + static QgsMessageBarItem* createMessage( QWidget *widget, QWidget *parent = nullptr ); //! convenience method for pushing a message to the bar void pushMessage( const QString &text, MessageLevel level = INFO, int duration = 0 ) { return pushMessage( QString::null, text, level, duration ); } diff --git a/src/gui/qgsmessagebaritem.cpp b/src/gui/qgsmessagebaritem.cpp index a0380105a72..99e62a2883c 100644 --- a/src/gui/qgsmessagebaritem.cpp +++ b/src/gui/qgsmessagebaritem.cpp @@ -29,9 +29,9 @@ QgsMessageBarItem::QgsMessageBarItem( const QString &text, QgsMessageBar::Messag , mText( text ) , mLevel( level ) , mDuration( duration ) - , mWidget( 0 ) + , mWidget( nullptr ) , mUserIcon( QIcon() ) - , mLayout( 0 ) + , mLayout( nullptr ) { writeContent(); } @@ -42,9 +42,9 @@ QgsMessageBarItem::QgsMessageBarItem( const QString &title, const QString &text, , mText( text ) , mLevel( level ) , mDuration( duration ) - , mWidget( 0 ) + , mWidget( nullptr ) , mUserIcon( QIcon() ) - , mLayout( 0 ) + , mLayout( nullptr ) { writeContent(); } @@ -57,7 +57,7 @@ QgsMessageBarItem::QgsMessageBarItem( const QString &title, const QString &text, , mDuration( duration ) , mWidget( widget ) , mUserIcon( QIcon() ) - , mLayout( 0 ) + , mLayout( nullptr ) { writeContent(); } @@ -70,7 +70,7 @@ QgsMessageBarItem::QgsMessageBarItem( QWidget *widget, QgsMessageBar::MessageLev , mDuration( duration ) , mWidget( widget ) , mUserIcon( QIcon() ) - , mLayout( 0 ) + , mLayout( nullptr ) { writeContent(); } @@ -81,16 +81,16 @@ QgsMessageBarItem::~QgsMessageBarItem() void QgsMessageBarItem::writeContent() { - if ( mLayout == 0 ) + if ( mLayout == nullptr ) { mLayout = new QHBoxLayout( this ); mLayout->setContentsMargins( 0, 0, 0, 0 ); - mTextEdit = 0; - mLblIcon = 0; + mTextEdit = nullptr; + mLblIcon = nullptr; } // ICON - if ( mLblIcon == 0 ) + if ( mLblIcon == nullptr ) { mLblIcon = new QLabel( this ); mLayout->addWidget( mLblIcon ); @@ -124,15 +124,15 @@ void QgsMessageBarItem::writeContent() // TITLE AND TEXT if ( mTitle.isEmpty() && mText.isEmpty() ) { - if ( mTextEdit != 0 ) + if ( mTextEdit != nullptr ) { delete mTextEdit; - mTextEdit = 0; + mTextEdit = nullptr; } } else { - if ( mTextEdit == 0 ) + if ( mTextEdit == nullptr ) { mTextEdit = new QTextEdit( this ); mTextEdit->setObjectName( "textEdit" ); @@ -160,7 +160,7 @@ void QgsMessageBarItem::writeContent() } // WIDGET - if ( mWidget != 0 ) + if ( mWidget != nullptr ) { QLayoutItem *item = mLayout->itemAt( 2 ); if ( !item || item->widget() != mWidget ) @@ -217,7 +217,7 @@ QgsMessageBarItem *QgsMessageBarItem::setLevel( QgsMessageBar::MessageLevel leve QgsMessageBarItem *QgsMessageBarItem::setWidget( QWidget *widget ) { - if ( mWidget != 0 ) + if ( mWidget != nullptr ) { QLayoutItem *item; item = mLayout->itemAt( 2 ); diff --git a/src/gui/qgsmessagebaritem.h b/src/gui/qgsmessagebaritem.h index 5eee0b7d3f9..bd8569431c6 100644 --- a/src/gui/qgsmessagebaritem.h +++ b/src/gui/qgsmessagebaritem.h @@ -31,16 +31,16 @@ class GUI_EXPORT QgsMessageBarItem : public QWidget Q_OBJECT public: //! make out a widget containing a message to be displayed on the bar - QgsMessageBarItem( const QString &text, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent = 0 ); + QgsMessageBarItem( const QString &text, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent = nullptr ); //! make out a widget containing title and message to be displayed on the bar - QgsMessageBarItem( const QString &title, const QString &text, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent = 0 ); + QgsMessageBarItem( const QString &title, const QString &text, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent = nullptr ); //! make out a widget containing title, message and widget to be displayed on the bar - QgsMessageBarItem( const QString &title, const QString &text, QWidget *widget, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent = 0 ); + QgsMessageBarItem( const QString &title, const QString &text, QWidget *widget, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent = nullptr ); //! make out a widget containing a widget to be displayed on the bar - QgsMessageBarItem( QWidget *widget, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent = 0 ); + QgsMessageBarItem( QWidget *widget, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO, int duration = 0, QWidget *parent = nullptr ); ~QgsMessageBarItem(); diff --git a/src/gui/qgsmessagelogviewer.h b/src/gui/qgsmessagelogviewer.h index 4e7e8bfa5e1..3a780ebab7a 100644 --- a/src/gui/qgsmessagelogviewer.h +++ b/src/gui/qgsmessagelogviewer.h @@ -35,7 +35,7 @@ class GUI_EXPORT QgsMessageLogViewer: public QDialog, private Ui::QgsMessageLogV { Q_OBJECT public: - QgsMessageLogViewer( QStatusBar *statusBar = 0, QWidget *parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); + QgsMessageLogViewer( QStatusBar *statusBar = nullptr, QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); ~QgsMessageLogViewer(); public slots: diff --git a/src/gui/qgsmessageviewer.h b/src/gui/qgsmessageviewer.h index 4294c3cc021..a53e6e28ca5 100644 --- a/src/gui/qgsmessageviewer.h +++ b/src/gui/qgsmessageviewer.h @@ -31,7 +31,7 @@ class GUI_EXPORT QgsMessageViewer: public QDialog, public QgsMessageOutput, priv { Q_OBJECT public: - QgsMessageViewer( QWidget *parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags, bool deleteOnClose = true ); + QgsMessageViewer( QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags, bool deleteOnClose = true ); ~QgsMessageViewer(); virtual void setMessage( const QString& message, MessageType msgType ) override; diff --git a/src/gui/qgsnewhttpconnection.cpp b/src/gui/qgsnewhttpconnection.cpp index c6f83e4c353..755d50a0037 100644 --- a/src/gui/qgsnewhttpconnection.cpp +++ b/src/gui/qgsnewhttpconnection.cpp @@ -27,7 +27,7 @@ QgsNewHttpConnection::QgsNewHttpConnection( : QDialog( parent, fl ) , mBaseKey( baseKey ) , mOriginalConnName( connName ) - , mAuthConfigSelect( 0 ) + , mAuthConfigSelect( nullptr ) { setupUi( this ); diff --git a/src/gui/qgsnewhttpconnection.h b/src/gui/qgsnewhttpconnection.h index d2bc65ab889..197c0d04b88 100644 --- a/src/gui/qgsnewhttpconnection.h +++ b/src/gui/qgsnewhttpconnection.h @@ -31,7 +31,7 @@ class GUI_EXPORT QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpCo public: //! Constructor - QgsNewHttpConnection( QWidget *parent = 0, const QString& baseKey = "/Qgis/connections-wms/", const QString& connName = QString::null, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); + QgsNewHttpConnection( QWidget *parent = nullptr, const QString& baseKey = "/Qgis/connections-wms/", const QString& connName = QString::null, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); //! Destructor ~QgsNewHttpConnection(); public slots: diff --git a/src/gui/qgsnewmemorylayerdialog.cpp b/src/gui/qgsnewmemorylayerdialog.cpp index bcafb707af1..386bfa94887 100644 --- a/src/gui/qgsnewmemorylayerdialog.cpp +++ b/src/gui/qgsnewmemorylayerdialog.cpp @@ -34,7 +34,7 @@ QgsVectorLayer *QgsNewMemoryLayerDialog::runAndCreateLayer( QWidget *parent ) QgsNewMemoryLayerDialog dialog( parent ); if ( dialog.exec() == QDialog::Rejected ) { - return 0; + return nullptr; } QGis::WkbType geometrytype = dialog.selectedType(); diff --git a/src/gui/qgsnewmemorylayerdialog.h b/src/gui/qgsnewmemorylayerdialog.h index 384d071427f..c613037b203 100644 --- a/src/gui/qgsnewmemorylayerdialog.h +++ b/src/gui/qgsnewmemorylayerdialog.h @@ -33,9 +33,9 @@ class GUI_EXPORT QgsNewMemoryLayerDialog: public QDialog, private Ui::QgsNewMemo * @param parent parent widget * @returns new memory layer */ - static QgsVectorLayer* runAndCreateLayer( QWidget* parent = 0 ); + static QgsVectorLayer* runAndCreateLayer( QWidget* parent = nullptr ); - QgsNewMemoryLayerDialog( QWidget *parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); + QgsNewMemoryLayerDialog( QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); ~QgsNewMemoryLayerDialog(); /** Returns the selected geometry type*/ diff --git a/src/gui/qgsnewnamedialog.cpp b/src/gui/qgsnewnamedialog.cpp index ffee4fa838d..70a8d8c3a37 100644 --- a/src/gui/qgsnewnamedialog.cpp +++ b/src/gui/qgsnewnamedialog.cpp @@ -31,7 +31,7 @@ QgsNewNameDialog::QgsNewNameDialog( const QString& source, const QString& initia , mExiting( existing ) , mExtensions( extensions ) , mCaseSensitivity( cs ) - , mNamesLabel( 0 ) + , mNamesLabel( nullptr ) , mRegexp( regexp ) , mOverwriteEnabled( true ) { @@ -141,7 +141,7 @@ void QgsNewNameDialog::nameChanged() if ( !conflicts.isEmpty() ) { QString warning = !mConflictingNameWarning.isEmpty() ? mConflictingNameWarning - : tr( "%n Name(s) %1 exists", 0, conflicts.size() ).arg( conflicts.join( ", " ) ); + : tr( "%n Name(s) %1 exists", nullptr, conflicts.size() ).arg( conflicts.join( ", " ) ); mErrorLabel->setText( highlightText( warning ) ); if ( mOverwriteEnabled ) { diff --git a/src/gui/qgsnewnamedialog.h b/src/gui/qgsnewnamedialog.h index 460af8cac1e..d0cdbf62cf9 100644 --- a/src/gui/qgsnewnamedialog.h +++ b/src/gui/qgsnewnamedialog.h @@ -44,7 +44,7 @@ class GUI_EXPORT QgsNewNameDialog : public QgsDialog QgsNewNameDialog( const QString& source = QString::null, const QString& initial = QString::null, const QStringList& extensions = QStringList(), const QStringList& existing = QStringList(), const QRegExp& regexp = QRegExp(), Qt::CaseSensitivity cs = Qt::CaseSensitive, - QWidget *parent = 0, const Qt::WindowFlags& flags = QgisGui::ModalDialogFlags ); + QWidget *parent = nullptr, const Qt::WindowFlags& flags = QgisGui::ModalDialogFlags ); /** Sets the hint string for the dialog (the text shown above the name * input box). diff --git a/src/gui/qgsnewvectorlayerdialog.cpp b/src/gui/qgsnewvectorlayerdialog.cpp index 9fbc6a836f4..e84581558a6 100644 --- a/src/gui/qgsnewvectorlayerdialog.cpp +++ b/src/gui/qgsnewvectorlayerdialog.cpp @@ -246,7 +246,7 @@ QString QgsNewVectorLayerDialog::runAndCreateLayer( QWidget* parent, QString* pE QSettings settings; QString lastUsedDir = settings.value( "/UI/lastVectorFileFilterDir", QDir::homePath() ).toString(); QString filterString = QgsVectorFileWriter::filterForDriver( fileformat ); - QString fileName = QFileDialog::getSaveFileName( 0, tr( "Save layer as..." ), lastUsedDir, filterString ); + QString fileName = QFileDialog::getSaveFileName( nullptr, tr( "Save layer as..." ), lastUsedDir, filterString ); if ( fileName.isNull() ) { return ""; diff --git a/src/gui/qgsnewvectorlayerdialog.h b/src/gui/qgsnewvectorlayerdialog.h index b2b089255f3..1e5c2a9b9f1 100644 --- a/src/gui/qgsnewvectorlayerdialog.h +++ b/src/gui/qgsnewvectorlayerdialog.h @@ -31,9 +31,9 @@ class GUI_EXPORT QgsNewVectorLayerDialog: public QDialog, private Ui::QgsNewVect // run the dialog, create the layer. // @return fileName on success, empty string use aborted, QString::null if creation failed - static QString runAndCreateLayer( QWidget* parent = 0, QString* enc = 0 ); + static QString runAndCreateLayer( QWidget* parent = nullptr, QString* enc = nullptr ); - QgsNewVectorLayerDialog( QWidget *parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); + QgsNewVectorLayerDialog( QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); ~QgsNewVectorLayerDialog(); /** Returns the selected geometry type*/ QGis::WkbType selectedType() const; diff --git a/src/gui/qgsoptionsdialogbase.cpp b/src/gui/qgsoptionsdialogbase.cpp index ebe122f2159..84bb737cb9c 100644 --- a/src/gui/qgsoptionsdialogbase.cpp +++ b/src/gui/qgsoptionsdialogbase.cpp @@ -31,10 +31,10 @@ QgsOptionsDialogBase::QgsOptionsDialogBase( const QString& settingsKey, QWidget* : QDialog( parent, fl ) , mOptsKey( settingsKey ) , mInit( false ) - , mOptListWidget( NULL ) - , mOptStackedWidget( NULL ) - , mOptSplitter( NULL ) - , mOptButtonBox( NULL ) + , mOptListWidget( nullptr ) + , mOptStackedWidget( nullptr ) + , mOptSplitter( nullptr ) + , mOptButtonBox( nullptr ) , mDialogTitle( "" ) , mIconOnly( false ) , mSettings( settings ) @@ -56,7 +56,7 @@ QgsOptionsDialogBase::~QgsOptionsDialogBase() delete mSettings; } - mSettings = 0; // null the pointer (in case of outside settings obj) + mSettings = nullptr; // null the pointer (in case of outside settings obj) } void QgsOptionsDialogBase::initOptionsBase( bool restoreUi, const QString& title ) @@ -285,7 +285,7 @@ void QgsOptionsDialogBase::optionsStackedWidget_WidgetRemoved( int indx ) void QgsOptionsDialogBase::warnAboutMissingObjects() { - QMessageBox::warning( 0, tr( "Missing objects" ), + QMessageBox::warning( nullptr, tr( "Missing objects" ), tr( "Base options dialog could not be initialized.\n\n" "Missing some of the .ui template objects:\n" ) + " mOptionsListWidget,\n mOptionsStackedWidget,\n mOptionsSplitter", diff --git a/src/gui/qgsoptionsdialogbase.h b/src/gui/qgsoptionsdialogbase.h index 24e686451b9..e0e6e3560dd 100644 --- a/src/gui/qgsoptionsdialogbase.h +++ b/src/gui/qgsoptionsdialogbase.h @@ -56,7 +56,7 @@ class GUI_EXPORT QgsOptionsDialogBase : public QDialog * @param fl widget flags * @param settings custom QSettings pointer */ - QgsOptionsDialogBase( const QString& settingsKey, QWidget* parent = 0, const Qt::WindowFlags& fl = 0, QSettings* settings = 0 ); + QgsOptionsDialogBase( const QString& settingsKey, QWidget* parent = nullptr, const Qt::WindowFlags& fl = nullptr, QSettings* settings = nullptr ); ~QgsOptionsDialogBase(); /** Set up the base ui connections for vertical tabs. diff --git a/src/gui/qgsowssourceselect.cpp b/src/gui/qgsowssourceselect.cpp index 8b98cc89b02..d42a98e3e08 100644 --- a/src/gui/qgsowssourceselect.cpp +++ b/src/gui/qgsowssourceselect.cpp @@ -59,7 +59,7 @@ QgsOWSSourceSelect::QgsOWSSourceSelect( const QString& service, QWidget * parent , mService( service ) , mManagerMode( managerMode ) , mEmbeddedMode( embeddedMode ) - , mCurrentTileset( 0 ) + , mCurrentTileset( nullptr ) { setupUi( this ); @@ -479,7 +479,7 @@ void QgsOWSSourceSelect::on_mTilesetsTableWidget_itemClicked( QTableWidgetItem * } else { - mCurrentTileset = 0; + mCurrentTileset = nullptr; } mTilesetsTableWidget->blockSignals( false ); diff --git a/src/gui/qgsowssourceselect.h b/src/gui/qgsowssourceselect.h index 3e103d9541e..805213f87ce 100644 --- a/src/gui/qgsowssourceselect.h +++ b/src/gui/qgsowssourceselect.h @@ -59,7 +59,7 @@ class GUI_EXPORT QgsOWSSourceSelect : public QDialog, public Ui::QgsOWSSourceSel }; //! Constructor - QgsOWSSourceSelect( const QString& service, QWidget *parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false ); + QgsOWSSourceSelect( const QString& service, QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false ); //! Destructor ~QgsOWSSourceSelect(); diff --git a/src/gui/qgspixmaplabel.h b/src/gui/qgspixmaplabel.h index e2295b6108e..e5e800f1019 100644 --- a/src/gui/qgspixmaplabel.h +++ b/src/gui/qgspixmaplabel.h @@ -27,7 +27,7 @@ class QgsPixmapLabel : public QLabel Q_OBJECT public: - explicit QgsPixmapLabel( QWidget *parent = 0 ); + explicit QgsPixmapLabel( QWidget *parent = nullptr ); /** * Calculates the height for the given width. * diff --git a/src/gui/qgsprojectionselectionwidget.h b/src/gui/qgsprojectionselectionwidget.h index 67b52ee6f9a..32830c5966b 100644 --- a/src/gui/qgsprojectionselectionwidget.h +++ b/src/gui/qgsprojectionselectionwidget.h @@ -48,7 +48,7 @@ class GUI_EXPORT QgsProjectionSelectionWidget : public QWidget RecentCrs /*!< recently used CRS */ }; - explicit QgsProjectionSelectionWidget( QWidget *parent = 0 ); + explicit QgsProjectionSelectionWidget( QWidget *parent = nullptr ); /** Returns a pointer to the projection selector dialog used by the widget. * Can be used to modify how the projection selector dialog behaves. diff --git a/src/gui/qgsprojectionselector.cpp b/src/gui/qgsprojectionselector.cpp index 3a08c91c65a..95485f23bd5 100644 --- a/src/gui/qgsprojectionselector.cpp +++ b/src/gui/qgsprojectionselector.cpp @@ -28,9 +28,9 @@ QgsProjectionSelector::QgsProjectionSelector( QWidget* parent, const char *name, const Qt::WindowFlags& fl ) : QWidget( parent, fl ) - , mUserProjList( NULL ) - , mGeoList( NULL ) - , mProjList( NULL ) + , mUserProjList( nullptr ) + , mGeoList( nullptr ) + , mProjList( nullptr ) , mProjListDone( false ) , mUserProjListDone( false ) , mRecentProjListDone( false ) @@ -318,7 +318,7 @@ QString QgsProjectionSelector::selectedProj4String() QgsDebugMsg( "db = " + databaseFileName ); sqlite3 *database; - int rc = sqlite3_open_v2( databaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, NULL ); + int rc = sqlite3_open_v2( databaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, nullptr ); if ( rc ) { showDBMissingWarning( databaseFileName ); @@ -361,7 +361,7 @@ QString QgsProjectionSelector::getSelectedExpression( const QString& expression // not a top-level projection node QTreeWidgetItem *lvi = lstCoordinateSystems->currentItem(); if ( !lvi || lvi->text( QGIS_CRS_ID_COLUMN ).isEmpty() ) - return 0; + return nullptr; // // Determine if this is a user projection or a system on @@ -373,7 +373,7 @@ QString QgsProjectionSelector::getSelectedExpression( const QString& expression databaseFileName = QgsApplication::qgisUserDbFilePath(); if ( !QFileInfo( databaseFileName ).exists() ) { - return 0; + return nullptr; } } else @@ -387,11 +387,11 @@ QString QgsProjectionSelector::getSelectedExpression( const QString& expression // assuming that it will never be used anywhere else. Given the low overhead, // opening it each time seems to be a reasonable approach at this time. sqlite3 *database; - int rc = sqlite3_open_v2( databaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, NULL ); + int rc = sqlite3_open_v2( databaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, nullptr ); if ( rc ) { showDBMissingWarning( databaseFileName ); - return 0; + return nullptr; } // prepare the sql statement @@ -493,7 +493,7 @@ void QgsProjectionSelector::loadUserCrsList( QSet *crsFilter ) const char *tail; sqlite3_stmt *stmt; //check the db is available - int result = sqlite3_open_v2( databaseFileName.toUtf8().constData(), &database, SQLITE_OPEN_READONLY, NULL ); + int result = sqlite3_open_v2( databaseFileName.toUtf8().constData(), &database, SQLITE_OPEN_READONLY, nullptr ); if ( result ) { // XXX This will likely never happen since on open, sqlite creates the @@ -573,7 +573,7 @@ void QgsProjectionSelector::loadCrsList( QSet *crsFilter ) // open the database containing the spatial reference data sqlite3 *database; - int rc = sqlite3_open_v2( mSrsDatabaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, NULL ); + int rc = sqlite3_open_v2( mSrsDatabaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, nullptr ); if ( rc ) { // XXX This will likely never happen since on open, sqlite creates the @@ -598,7 +598,7 @@ void QgsProjectionSelector::loadCrsList( QSet *crsFilter ) // Cache some stuff to speed up creating of the list of projected // spatial reference systems QString previousSrsType( "" ); - QTreeWidgetItem* previousSrsTypeNode = 0; + QTreeWidgetItem* previousSrsTypeNode = nullptr; while ( sqlite3_step( stmt ) == SQLITE_ROW ) { @@ -854,7 +854,7 @@ long QgsProjectionSelector::getLargestCRSIDMatch( const QString& theSql ) QString databaseFileName = QgsApplication::qgisUserDbFilePath(); if ( QFileInfo( databaseFileName ).exists() ) //only bother trying to open if the file exists { - result = sqlite3_open_v2( databaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, NULL ); + result = sqlite3_open_v2( databaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, nullptr ); if ( result ) { // XXX This will likely never happen since on open, sqlite creates the @@ -880,7 +880,7 @@ long QgsProjectionSelector::getLargestCRSIDMatch( const QString& theSql ) else { //only bother looking in srs.db if it wasnt found above - result = sqlite3_open_v2( mSrsDatabaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, NULL ); + result = sqlite3_open_v2( mSrsDatabaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, nullptr ); if ( result ) { QgsDebugMsg( QString( "Can't open * user * database: %1" ).arg( sqlite3_errmsg( database ) ) ); @@ -910,7 +910,7 @@ QStringList QgsProjectionSelector::authorities() const char *tail; sqlite3_stmt *stmt; - int result = sqlite3_open_v2( mSrsDatabaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, NULL ); + int result = sqlite3_open_v2( mSrsDatabaseFileName.toUtf8().data(), &database, SQLITE_OPEN_READONLY, nullptr ); if ( result ) { QgsDebugMsg( QString( "Can't open * user * database: %1" ).arg( sqlite3_errmsg( database ) ) ); diff --git a/src/gui/qgsprojectionselector.h b/src/gui/qgsprojectionselector.h index e3ab3bc1656..10d62327d27 100644 --- a/src/gui/qgsprojectionselector.h +++ b/src/gui/qgsprojectionselector.h @@ -29,7 +29,7 @@ class GUI_EXPORT QgsProjectionSelector : public QWidget, private Ui::QgsProjecti { Q_OBJECT public: - QgsProjectionSelector( QWidget* parent, const char *name = "", const Qt::WindowFlags& fl = 0 ); + QgsProjectionSelector( QWidget* parent, const char *name = "", const Qt::WindowFlags& fl = nullptr ); ~QgsProjectionSelector(); @@ -42,7 +42,7 @@ class GUI_EXPORT QgsProjectionSelector : public QWidget, private Ui::QgsProjecti * * \todo Should this be public? */ - void loadUserCrsList( QSet *crsFilter = 0 ); + void loadUserCrsList( QSet *crsFilter = nullptr ); /** * \brief Populate the proj tree view with system projection names... @@ -53,7 +53,7 @@ class GUI_EXPORT QgsProjectionSelector : public QWidget, private Ui::QgsProjecti * * \todo Should this be public? */ - void loadCrsList( QSet *crsFilter = 0 ); + void loadCrsList( QSet *crsFilter = nullptr ); /*! * \brief Make the string safe for use in SQL statements. diff --git a/src/gui/qgsquerybuilder.h b/src/gui/qgsquerybuilder.h index 058869723e1..fa5bff216d2 100644 --- a/src/gui/qgsquerybuilder.h +++ b/src/gui/qgsquerybuilder.h @@ -47,7 +47,7 @@ class GUI_EXPORT QgsQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBa * @param parent Parent widget * @param fl dialog flags */ - QgsQueryBuilder( QgsVectorLayer *layer, QWidget *parent = 0, + QgsQueryBuilder( QgsVectorLayer *layer, QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); ~QgsQueryBuilder(); diff --git a/src/gui/qgsrasterformatsaveoptionswidget.cpp b/src/gui/qgsrasterformatsaveoptionswidget.cpp index 35c7fc41e7b..c2f10269332 100644 --- a/src/gui/qgsrasterformatsaveoptionswidget.cpp +++ b/src/gui/qgsrasterformatsaveoptionswidget.cpp @@ -33,7 +33,7 @@ QMap< QString, QStringList > QgsRasterFormatSaveOptionsWidget::mBuiltinProfiles; QgsRasterFormatSaveOptionsWidget::QgsRasterFormatSaveOptionsWidget( QWidget* parent, const QString& format, QgsRasterFormatSaveOptionsWidget::Type type, const QString& provider ) - : QWidget( parent ), mFormat( format ), mProvider( provider ), mRasterLayer( 0 ) + : QWidget( parent ), mFormat( format ), mProvider( provider ), mRasterLayer( nullptr ) , mRasterFileName( QString() ), mPyramids( false ) , mPyramidsFormat( QgsRaster::PyramidsGTiff ) @@ -582,7 +582,7 @@ bool QgsRasterFormatSaveOptionsWidget::eventFilter( QObject *obj, QEvent *event QMouseEvent *mouseEvent = static_cast( event ); if ( mouseEvent && ( mouseEvent->button() == Qt::RightButton ) ) { - QMenu* menu = 0; + QMenu* menu = nullptr; QString text; if ( mOptionsStackedWidget->currentIndex() == 0 ) text = tr( "Use simple interface" ); diff --git a/src/gui/qgsrasterformatsaveoptionswidget.h b/src/gui/qgsrasterformatsaveoptionswidget.h index 538ce6b9abc..ed9437a5789 100644 --- a/src/gui/qgsrasterformatsaveoptionswidget.h +++ b/src/gui/qgsrasterformatsaveoptionswidget.h @@ -43,7 +43,7 @@ class GUI_EXPORT QgsRasterFormatSaveOptionsWidget: public QWidget, ProfileLineEdit // Profile + LineEdit }; - QgsRasterFormatSaveOptionsWidget( QWidget* parent = 0, const QString& format = "GTiff", + QgsRasterFormatSaveOptionsWidget( QWidget* parent = nullptr, const QString& format = "GTiff", QgsRasterFormatSaveOptionsWidget::Type type = Default, const QString& provider = "gdal" ); ~QgsRasterFormatSaveOptionsWidget(); @@ -51,7 +51,7 @@ class GUI_EXPORT QgsRasterFormatSaveOptionsWidget: public QWidget, void setFormat( const QString& format ); void setProvider( const QString& provider ); void setRasterLayer( QgsRasterLayer* rasterLayer ) { mRasterLayer = rasterLayer; mRasterFileName = QString(); } - void setRasterFileName( const QString& file ) { mRasterLayer = 0; mRasterFileName = file; } + void setRasterFileName( const QString& file ) { mRasterLayer = nullptr; mRasterFileName = file; } QStringList options() const; void setType( QgsRasterFormatSaveOptionsWidget::Type type = Default ); void setPyramidsFormat( QgsRaster::RasterPyramidsFormat format ) diff --git a/src/gui/qgsrasterlayersaveasdialog.cpp b/src/gui/qgsrasterlayersaveasdialog.cpp index 153b24e31e0..cfa43018b23 100644 --- a/src/gui/qgsrasterlayersaveasdialog.cpp +++ b/src/gui/qgsrasterlayersaveasdialog.cpp @@ -550,14 +550,14 @@ void QgsRasterLayerSaveAsDialog::addNoDataRow( double min, double max ) { case QGis::Float32: case QGis::Float64: - lineEdit->setValidator( new QDoubleValidator( 0 ) ); + lineEdit->setValidator( new QDoubleValidator( nullptr ) ); if ( !qIsNaN( value ) ) { valueString = QgsRasterBlock::printValue( value ); } break; default: - lineEdit->setValidator( new QIntValidator( 0 ) ); + lineEdit->setValidator( new QIntValidator( nullptr ) ); if ( !qIsNaN( value ) ) { valueString = QString::number( static_cast( value ) ); diff --git a/src/gui/qgsrasterlayersaveasdialog.h b/src/gui/qgsrasterlayersaveasdialog.h index 82a58d68f7f..e4196629b39 100644 --- a/src/gui/qgsrasterlayersaveasdialog.h +++ b/src/gui/qgsrasterlayersaveasdialog.h @@ -48,7 +48,7 @@ class GUI_EXPORT QgsRasterLayerSaveAsDialog: public QDialog, private Ui::QgsRast QgsRasterLayerSaveAsDialog( QgsRasterLayer* rasterLayer, QgsRasterDataProvider* sourceProvider, const QgsRectangle& currentExtent, const QgsCoordinateReferenceSystem& layerCrs, const QgsCoordinateReferenceSystem& currentCrs, - QWidget* parent = 0, const Qt::WindowFlags& f = 0 ); + QWidget* parent = nullptr, const Qt::WindowFlags& f = nullptr ); ~QgsRasterLayerSaveAsDialog(); Mode mode() const; diff --git a/src/gui/qgsrasterpyramidsoptionswidget.h b/src/gui/qgsrasterpyramidsoptionswidget.h index f80ab5ba327..c4c9ebb8177 100644 --- a/src/gui/qgsrasterpyramidsoptionswidget.h +++ b/src/gui/qgsrasterpyramidsoptionswidget.h @@ -33,7 +33,7 @@ class GUI_EXPORT QgsRasterPyramidsOptionsWidget: public QWidget, public: - QgsRasterPyramidsOptionsWidget( QWidget* parent = 0, const QString& provider = "gdal" ); + QgsRasterPyramidsOptionsWidget( QWidget* parent = nullptr, const QString& provider = "gdal" ); ~QgsRasterPyramidsOptionsWidget(); QStringList configOptions() const { return mSaveOptionsWidget->options(); } diff --git a/src/gui/qgsrelationeditorwidget.cpp b/src/gui/qgsrelationeditorwidget.cpp index 0e33a75bf96..f2a10a500f1 100644 --- a/src/gui/qgsrelationeditorwidget.cpp +++ b/src/gui/qgsrelationeditorwidget.cpp @@ -167,7 +167,7 @@ void QgsRelationEditorWidget::setRelationFeature( const QgsRelation& relation, c { QgsFeatureRequest myRequest = mRelation.getRelatedFeaturesRequest( mFeature ); - mDualView->init( mRelation.referencingLayer(), 0, myRequest, mEditorContext ); + mDualView->init( mRelation.referencingLayer(), nullptr, myRequest, mEditorContext ); } } @@ -510,11 +510,11 @@ void QgsRelationEditorWidget::updateUi() nmRequest.setFilterExpression( filters.join( " OR " ) ); - mDualView->init( mNmRelation.referencedLayer(), 0, nmRequest, mEditorContext ); + mDualView->init( mNmRelation.referencedLayer(), nullptr, nmRequest, mEditorContext ); } else { - mDualView->init( mRelation.referencingLayer(), 0, myRequest, mEditorContext ); + mDualView->init( mRelation.referencingLayer(), nullptr, myRequest, mEditorContext ); } } } diff --git a/src/gui/qgsrelationeditorwidget.h b/src/gui/qgsrelationeditorwidget.h index 8ababddb0cf..2701b55b06d 100644 --- a/src/gui/qgsrelationeditorwidget.h +++ b/src/gui/qgsrelationeditorwidget.h @@ -40,7 +40,7 @@ class GUI_EXPORT QgsRelationEditorWidget : public QgsCollapsibleGroupBox /** * @param parent parent widget */ - QgsRelationEditorWidget( QWidget* parent = NULL ); + QgsRelationEditorWidget( QWidget* parent = nullptr ); //! Define the view mode for the dual view void setViewMode( QgsDualView::ViewMode mode ); diff --git a/src/gui/qgsrubberband.cpp b/src/gui/qgsrubberband.cpp index 89dcd53b73a..372be5e31a4 100644 --- a/src/gui/qgsrubberband.cpp +++ b/src/gui/qgsrubberband.cpp @@ -61,7 +61,7 @@ QgsRubberBand::QgsRubberBand( QgsMapCanvas* mapCanvas, bool isPolygon ) } QgsRubberBand::QgsRubberBand() - : QgsMapCanvasItem( 0 ) + : QgsMapCanvasItem( nullptr ) , mIconSize( 5 ) , mIconType( ICON_CIRCLE ) , mGeometryType( QGis::Polygon ) @@ -619,12 +619,12 @@ const QgsPoint *QgsRubberBand::getPoint( int i, int j ) const if ( i < mPoints.size() && j < mPoints[i].size() ) return &mPoints[i][j]; else - return 0; + return nullptr; } QgsGeometry *QgsRubberBand::asGeometry() { - QgsGeometry *geom = NULL; + QgsGeometry *geom = nullptr; switch ( mGeometryType ) { diff --git a/src/gui/qgsscalecombobox.cpp b/src/gui/qgsscalecombobox.cpp index 379dc702620..6c51da57bf4 100644 --- a/src/gui/qgsscalecombobox.cpp +++ b/src/gui/qgsscalecombobox.cpp @@ -30,7 +30,7 @@ QgsScaleComboBox::QgsScaleComboBox( QWidget* parent ) : QComboBox( parent ), mSc setEditable( true ); setInsertPolicy( QComboBox::NoInsert ); - setCompleter( 0 ); + setCompleter( nullptr ); connect( this, SIGNAL( activated( const QString & ) ), this, SLOT( fixupScale() ) ); connect( lineEdit(), SIGNAL( editingFinished() ), this, SLOT( fixupScale() ) ); fixupScale(); diff --git a/src/gui/qgsscalecombobox.h b/src/gui/qgsscalecombobox.h index b72aa641e68..b5c10a234eb 100644 --- a/src/gui/qgsscalecombobox.h +++ b/src/gui/qgsscalecombobox.h @@ -28,7 +28,7 @@ class GUI_EXPORT QgsScaleComboBox : public QComboBox { Q_OBJECT public: - QgsScaleComboBox( QWidget* parent = 0 ); + QgsScaleComboBox( QWidget* parent = nullptr ); virtual ~QgsScaleComboBox(); //! Function to read the selected scale as text @@ -45,7 +45,7 @@ class GUI_EXPORT QgsScaleComboBox : public QComboBox // be expected. static QString toString( double scale ); //! Helper function to convert a scale string to double - static double toDouble( const QString& scaleString, bool *ok = NULL ); + static double toDouble( const QString& scaleString, bool *ok = nullptr ); signals: //! Signal is emitted when *user* has finished editing/selecting a new scale. diff --git a/src/gui/qgsscalerangewidget.cpp b/src/gui/qgsscalerangewidget.cpp index 8350907aa12..857c214df48 100644 --- a/src/gui/qgsscalerangewidget.cpp +++ b/src/gui/qgsscalerangewidget.cpp @@ -20,7 +20,7 @@ QgsScaleRangeWidget::QgsScaleRangeWidget( QWidget *parent ) : QWidget( parent ) - , mCanvas( 0 ) + , mCanvas( nullptr ) { mLayout = new QGridLayout( this ); mLayout->setContentsMargins( 0, 0, 0, 0 ); diff --git a/src/gui/qgsscalerangewidget.h b/src/gui/qgsscalerangewidget.h index 40f47bde515..05f960b15a9 100644 --- a/src/gui/qgsscalerangewidget.h +++ b/src/gui/qgsscalerangewidget.h @@ -30,7 +30,7 @@ class GUI_EXPORT QgsScaleRangeWidget : public QWidget Q_OBJECT public: - explicit QgsScaleRangeWidget( QWidget *parent = 0 ); + explicit QgsScaleRangeWidget( QWidget *parent = nullptr ); ~QgsScaleRangeWidget(); //! set the map canvas which will be used for the current scale buttons diff --git a/src/gui/qgsscalevisibilitydialog.h b/src/gui/qgsscalevisibilitydialog.h index fc679a9209f..c59971aac65 100644 --- a/src/gui/qgsscalevisibilitydialog.h +++ b/src/gui/qgsscalevisibilitydialog.h @@ -26,7 +26,7 @@ class GUI_EXPORT QgsScaleVisibilityDialog : public QDialog Q_OBJECT public: - explicit QgsScaleVisibilityDialog( QWidget *parent = 0, const QString& title = QString(), QgsMapCanvas* mapCanvas = 0 ); + explicit QgsScaleVisibilityDialog( QWidget *parent = nullptr, const QString& title = QString(), QgsMapCanvas* mapCanvas = nullptr ); //! return if scale visibilty is enabled bool hasScaleVisibility(); diff --git a/src/gui/qgsscalewidget.cpp b/src/gui/qgsscalewidget.cpp index d2b3ea75471..de1f8fdbc73 100644 --- a/src/gui/qgsscalewidget.cpp +++ b/src/gui/qgsscalewidget.cpp @@ -21,7 +21,7 @@ QgsScaleWidget::QgsScaleWidget( QWidget *parent ) : QWidget( parent ) - , mCanvas( NULL ) + , mCanvas( nullptr ) , mShowCurrentScaleButton( false ) { QHBoxLayout* layout = new QHBoxLayout( this ); diff --git a/src/gui/qgsscalewidget.h b/src/gui/qgsscalewidget.h index 88340ebe0e5..eb7249a27e0 100644 --- a/src/gui/qgsscalewidget.h +++ b/src/gui/qgsscalewidget.h @@ -34,7 +34,7 @@ class GUI_EXPORT QgsScaleWidget : public QWidget Q_PROPERTY( bool showCurrentScaleButton READ showCurrentScaleButton WRITE setShowCurrentScaleButton ) public: - explicit QgsScaleWidget( QWidget *parent = 0 ); + explicit QgsScaleWidget( QWidget *parent = nullptr ); virtual ~QgsScaleWidget(); @@ -60,7 +60,7 @@ class GUI_EXPORT QgsScaleWidget : public QWidget // be expected. static QString toString( double scale ) { return QgsScaleComboBox::toString( scale ); } //! Helper function to convert a scale string to double - static double toDouble( const QString& scaleString, bool *ok = 0 ) { return QgsScaleComboBox::toDouble( scaleString, ok ); } + static double toDouble( const QString& scaleString, bool *ok = nullptr ) { return QgsScaleComboBox::toDouble( scaleString, ok ); } public slots: void updateScales( const QStringList &scales = QStringList() ) { return mScaleComboBox->updateScales( scales ); } diff --git a/src/gui/qgssearchquerybuilder.cpp b/src/gui/qgssearchquerybuilder.cpp index 3d4cd3ffe24..975a6aa6d63 100644 --- a/src/gui/qgssearchquerybuilder.cpp +++ b/src/gui/qgssearchquerybuilder.cpp @@ -367,7 +367,7 @@ void QgsSearchQueryBuilder::saveQuery() QSettings s; QString lastQueryFileDir = s.value( "/UI/lastQueryFileDir", QDir::homePath() ).toString(); //save as qqt (QGIS query file) - QString saveFileName = QFileDialog::getSaveFileName( 0, tr( "Save query to file" ), lastQueryFileDir, "*.qqf" ); + QString saveFileName = QFileDialog::getSaveFileName( nullptr, tr( "Save query to file" ), lastQueryFileDir, "*.qqf" ); if ( saveFileName.isNull() ) { return; @@ -381,7 +381,7 @@ void QgsSearchQueryBuilder::saveQuery() QFile saveFile( saveFileName ); if ( !saveFile.open( QIODevice::WriteOnly ) ) { - QMessageBox::critical( 0, tr( "Error" ), tr( "Could not open file for writing" ) ); + QMessageBox::critical( nullptr, tr( "Error" ), tr( "Could not open file for writing" ) ); return; } @@ -403,7 +403,7 @@ void QgsSearchQueryBuilder::loadQuery() QSettings s; QString lastQueryFileDir = s.value( "/UI/lastQueryFileDir", QDir::homePath() ).toString(); - QString queryFileName = QFileDialog::getOpenFileName( 0, tr( "Load query from file" ), lastQueryFileDir, tr( "Query files" ) + " (*.qqf);;" + tr( "All files" ) + " (*)" ); + QString queryFileName = QFileDialog::getOpenFileName( nullptr, tr( "Load query from file" ), lastQueryFileDir, tr( "Query files" ) + " (*.qqf);;" + tr( "All files" ) + " (*)" ); if ( queryFileName.isNull() ) { return; @@ -412,20 +412,20 @@ void QgsSearchQueryBuilder::loadQuery() QFile queryFile( queryFileName ); if ( !queryFile.open( QIODevice::ReadOnly ) ) { - QMessageBox::critical( 0, tr( "Error" ), tr( "Could not open file for reading" ) ); + QMessageBox::critical( nullptr, tr( "Error" ), tr( "Could not open file for reading" ) ); return; } QDomDocument queryDoc; if ( !queryDoc.setContent( &queryFile ) ) { - QMessageBox::critical( 0, tr( "Error" ), tr( "File is not a valid xml document" ) ); + QMessageBox::critical( nullptr, tr( "Error" ), tr( "File is not a valid xml document" ) ); return; } QDomElement queryElem = queryDoc.firstChildElement( "Query" ); if ( queryElem.isNull() ) { - QMessageBox::critical( 0, tr( "Error" ), tr( "File is not a valid query document" ) ); + QMessageBox::critical( nullptr, tr( "Error" ), tr( "File is not a valid query document" ) ); return; } diff --git a/src/gui/qgssearchquerybuilder.h b/src/gui/qgssearchquerybuilder.h index 3598c4237cb..26dded6833e 100644 --- a/src/gui/qgssearchquerybuilder.h +++ b/src/gui/qgssearchquerybuilder.h @@ -39,7 +39,7 @@ class GUI_EXPORT QgsSearchQueryBuilder : public QDialog, private Ui::QgsQueryBui public: //! Constructor - takes pointer to vector layer as a parameter - QgsSearchQueryBuilder( QgsVectorLayer* layer, QWidget *parent = 0, + QgsSearchQueryBuilder( QgsVectorLayer* layer, QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags ); ~QgsSearchQueryBuilder(); diff --git a/src/gui/qgsslider.cpp b/src/gui/qgsslider.cpp index 03f00500616..02815621a42 100644 --- a/src/gui/qgsslider.cpp +++ b/src/gui/qgsslider.cpp @@ -40,7 +40,7 @@ void QgsSlider::paintEvent( QPaintEvent *event ) QRect rect = geometry(); painter.setPen( QPen( palette().color( QPalette::WindowText ) ) ); painter.drawText( QRectF( 0, rect.height() * 0.5, rect.width(), rect.height() ), - Qt::AlignHCenter, variantValue().toString(), 0 ); + Qt::AlignHCenter, variantValue().toString(), nullptr ); painter.end(); } diff --git a/src/gui/qgsslider.h b/src/gui/qgsslider.h index c7e635f89f6..f46d85a6924 100644 --- a/src/gui/qgsslider.h +++ b/src/gui/qgsslider.h @@ -24,8 +24,8 @@ class GUI_EXPORT QgsSlider : public QSlider { Q_OBJECT public: - QgsSlider( QWidget *parent = 0 ); - QgsSlider( Qt::Orientation orientation, QWidget * parent = 0 ); + QgsSlider( QWidget *parent = nullptr ); + QgsSlider( Qt::Orientation orientation, QWidget * parent = nullptr ); void setMinimum( const QVariant &min ); void setMaximum( const QVariant &max ); diff --git a/src/gui/qgssublayersdialog.cpp b/src/gui/qgssublayersdialog.cpp index 3b08634391f..1e606623504 100644 --- a/src/gui/qgssublayersdialog.cpp +++ b/src/gui/qgssublayersdialog.cpp @@ -165,7 +165,7 @@ int QgsSublayersDialog::exec() // if we got here, disable override cursor, open dialog and return result // TODO add override cursor where it is missing (e.g. when opening via "Add Raster") QCursor cursor; - bool overrideCursor = ( QApplication::overrideCursor() != 0 ); + bool overrideCursor = ( QApplication::overrideCursor() != nullptr ); if ( overrideCursor ) { cursor = QCursor( * QApplication::overrideCursor() ); diff --git a/src/gui/qgssublayersdialog.h b/src/gui/qgssublayersdialog.h index 8339e96008d..6d043f261c0 100644 --- a/src/gui/qgssublayersdialog.h +++ b/src/gui/qgssublayersdialog.h @@ -33,7 +33,7 @@ class GUI_EXPORT QgsSublayersDialog : public QDialog, private Ui::QgsSublayersDi Vsifile }; - QgsSublayersDialog( ProviderType providerType, const QString& name, QWidget* parent = 0, const Qt::WindowFlags& fl = 0 ); + QgsSublayersDialog( ProviderType providerType, const QString& name, QWidget* parent = nullptr, const Qt::WindowFlags& fl = nullptr ); ~QgsSublayersDialog(); void populateLayerTable( const QStringList& theList, const QString& delim = ":" ); diff --git a/src/gui/qgstextannotationitem.cpp b/src/gui/qgstextannotationitem.cpp index 9d9c3c16b5c..b7edbcac95e 100644 --- a/src/gui/qgstextannotationitem.cpp +++ b/src/gui/qgstextannotationitem.cpp @@ -33,7 +33,7 @@ QTextDocument* QgsTextAnnotationItem::document() const { if ( !mDocument ) { - return 0; + return nullptr; } return mDocument->clone(); diff --git a/src/gui/qgsunitselectionwidget.h b/src/gui/qgsunitselectionwidget.h index 8b9cbd42be9..42fc5a2820c 100644 --- a/src/gui/qgsunitselectionwidget.h +++ b/src/gui/qgsunitselectionwidget.h @@ -31,7 +31,7 @@ class GUI_EXPORT QgsMapUnitScaleDialog : public QDialog, private Ui::QgsMapUnitS Q_OBJECT public: - QgsMapUnitScaleDialog( QWidget* parent = 0 ); + QgsMapUnitScaleDialog( QWidget* parent = nullptr ); /** Returns the map unit scale */ QgsMapUnitScale getMapUnitScale() const; @@ -62,7 +62,7 @@ class GUI_EXPORT QgsUnitSelectionWidget : public QWidget, private Ui::QgsUnitSel int mMapUnitIdx; public: - QgsUnitSelectionWidget( QWidget* parent = 0 ); + QgsUnitSelectionWidget( QWidget* parent = nullptr ); /** Sets the units which the user can choose from in the combobox. * @param units list of strings for custom units to display in the widget diff --git a/src/gui/qgsuserinputdockwidget.cpp b/src/gui/qgsuserinputdockwidget.cpp index f60ca6ff57d..06b6b3af7d8 100644 --- a/src/gui/qgsuserinputdockwidget.cpp +++ b/src/gui/qgsuserinputdockwidget.cpp @@ -22,7 +22,7 @@ QgsUserInputDockWidget::QgsUserInputDockWidget( QWidget *parent ) : QDockWidget( tr( "User Input Panel" ), parent ) , mLayoutHorizontal( true ) { - QWidget* w = new QWidget( 0 ); + QWidget* w = new QWidget( nullptr ); mLayout = new QBoxLayout( QBoxLayout::LeftToRight ); mLayout->setAlignment( Qt::AlignLeft | Qt::AlignTop ); w->setLayout( mLayout ); @@ -39,7 +39,7 @@ QgsUserInputDockWidget::~QgsUserInputDockWidget() void QgsUserInputDockWidget::addUserInputWidget( QWidget *widget ) { - QFrame* line = 0; + QFrame* line = nullptr; if ( mWidgetList.count() > 0 ) { line = new QFrame( this ); diff --git a/src/gui/qgsuserinputdockwidget.h b/src/gui/qgsuserinputdockwidget.h index 4dd065bf435..bc56d2352ca 100644 --- a/src/gui/qgsuserinputdockwidget.h +++ b/src/gui/qgsuserinputdockwidget.h @@ -35,7 +35,7 @@ class GUI_EXPORT QgsUserInputDockWidget : public QDockWidget { Q_OBJECT public: - QgsUserInputDockWidget( QWidget* parent = 0 ); + QgsUserInputDockWidget( QWidget* parent = nullptr ); ~QgsUserInputDockWidget(); //! add a widget to be displayed in the dock diff --git a/src/gui/qgsvariableeditorwidget.cpp b/src/gui/qgsvariableeditorwidget.cpp index 9e20fd838ab..f86703ea8da 100644 --- a/src/gui/qgsvariableeditorwidget.cpp +++ b/src/gui/qgsvariableeditorwidget.cpp @@ -35,7 +35,7 @@ QgsVariableEditorWidget::QgsVariableEditorWidget( QWidget *parent ) : QWidget( parent ) - , mContext( 0 ) + , mContext( nullptr ) , mEditableScopeIndex( -1 ) , mShown( false ) { @@ -127,7 +127,7 @@ QgsExpressionContextScope* QgsVariableEditorWidget::editableScope() const { if ( !mContext || mEditableScopeIndex < 0 || mEditableScopeIndex >= mContext->scopeCount() ) { - return 0; + return nullptr; } return mContext->scope( mEditableScopeIndex ); } @@ -251,9 +251,9 @@ QIcon QgsVariableEditorTree::mExpandIcon; QgsVariableEditorTree::QgsVariableEditorTree( QWidget *parent ) : QTreeWidget( parent ) - , mEditorDelegate( 0 ) + , mEditorDelegate( nullptr ) , mEditableScopeIndex( -1 ) - , mContext( 0 ) + , mContext( nullptr ) { // init icons if ( mExpandIcon.isNull() ) @@ -282,16 +282,16 @@ QgsVariableEditorTree::QgsVariableEditorTree( QWidget *parent ) QgsExpressionContextScope* QgsVariableEditorTree::scopeFromItem( QTreeWidgetItem *item ) const { if ( !item ) - return 0; + return nullptr; bool ok; int contextIndex = item->data( 0, ContextIndex ).toInt( &ok ); if ( !ok ) - return 0; + return nullptr; if ( !mContext ) { - return 0; + return nullptr; } else if ( mContext->scopeCount() > contextIndex ) { @@ -299,7 +299,7 @@ QgsExpressionContextScope* QgsVariableEditorTree::scopeFromItem( QTreeWidgetItem } else { - return 0; + return nullptr; } } @@ -307,7 +307,7 @@ QTreeWidgetItem* QgsVariableEditorTree::itemFromVariable( QgsExpressionContextSc { int contextIndex = mContext ? mContext->indexOfScope( scope ) : 0; if ( contextIndex < 0 ) - return 0; + return nullptr; return mVariableToItem.value( qMakePair( contextIndex, name ) ); } @@ -315,7 +315,7 @@ QgsExpressionContextScope* QgsVariableEditorTree::editableScope() { if ( !mContext || mEditableScopeIndex < 0 || mEditableScopeIndex >= mContext->scopeCount() ) { - return 0; + return nullptr; } return mContext->scope( mEditableScopeIndex ); @@ -359,7 +359,7 @@ void QgsVariableEditorTree::refreshScopeVariables( QgsExpressionContextScope* sc bool readOnly = scope->isReadOnly( name ); bool isActive = true; - QgsExpressionContextScope* activeScope = 0; + QgsExpressionContextScope* activeScope = nullptr; if ( mContext ) { activeScope = mContext->activeScopeForVariable( name ); @@ -670,22 +670,22 @@ QWidget* VariableEditorDelegate::createEditor( QWidget *parent, const QModelIndex &index ) const { if ( !mParentTree ) - return 0; + return nullptr; //no editing for top level items if ( !index.parent().isValid() ) - return 0; + return nullptr; QTreeWidgetItem *item = mParentTree->indexToItem( index ); QgsExpressionContextScope* scope = mParentTree->scopeFromItem( item ); if ( !item || !scope ) - return 0; + return nullptr; QString variableName = mParentTree->variableNameFromIndex( index ); //no editing inherited or read-only variables if ( scope != mParentTree->editableScope() || scope->isReadOnly( variableName ) ) - return 0; + return nullptr; QLineEdit *lineEdit = new QLineEdit( parent ); lineEdit->setText( index.column() == 0 ? variableName : mParentTree->editableScope()->variable( variableName ).toString() ); diff --git a/src/gui/qgsvariableeditorwidget.h b/src/gui/qgsvariableeditorwidget.h index 85c5565963f..0de991bab04 100644 --- a/src/gui/qgsvariableeditorwidget.h +++ b/src/gui/qgsvariableeditorwidget.h @@ -47,7 +47,7 @@ class GUI_EXPORT QgsVariableEditorWidget : public QWidget /** Constructor for QgsVariableEditorWidget. * @param parent parent widget */ - QgsVariableEditorWidget( QWidget *parent = 0 ); + QgsVariableEditorWidget( QWidget *parent = nullptr ); ~QgsVariableEditorWidget(); @@ -156,7 +156,7 @@ class QgsVariableEditorTree : public QTreeWidget RowBaseColor }; - explicit QgsVariableEditorTree( QWidget *parent = 0 ); + explicit QgsVariableEditorTree( QWidget *parent = nullptr ); QTreeWidgetItem *indexToItem( const QModelIndex &index ) const { return itemFromIndex( index ); } QModelIndex itemToIndex( QTreeWidgetItem* item ) const { return indexFromItem( item ); } @@ -207,7 +207,7 @@ class VariableEditorDelegate : public QItemDelegate Q_OBJECT public: - VariableEditorDelegate( QObject *parent = 0, QgsVariableEditorTree *tree = 0 ) + VariableEditorDelegate( QObject *parent = nullptr, QgsVariableEditorTree *tree = nullptr ) : QItemDelegate( parent ) , mParentTree( tree ) {} diff --git a/src/gui/qgsvectorlayertools.h b/src/gui/qgsvectorlayertools.h index f4b81ca6750..51f3547e86f 100644 --- a/src/gui/qgsvectorlayertools.h +++ b/src/gui/qgsvectorlayertools.h @@ -48,7 +48,7 @@ class GUI_EXPORT QgsVectorLayerTools * @param feature Updated feature after adding will be written back to this * @return True in case of success, False if the operation failed/was aborted */ - virtual bool addFeature( QgsVectorLayer* layer, const QgsAttributeMap& defaultValues = QgsAttributeMap(), const QgsGeometry& defaultGeometry = QgsGeometry(), QgsFeature* feature = 0 ) const = 0; + virtual bool addFeature( QgsVectorLayer* layer, const QgsAttributeMap& defaultValues = QgsAttributeMap(), const QgsGeometry& defaultGeometry = QgsGeometry(), QgsFeature* feature = nullptr ) const = 0; /** * This will be called, whenever a vector layer should be switched to edit mode. Check the providers diff --git a/src/gui/raster/qgsmultibandcolorrendererwidget.cpp b/src/gui/raster/qgsmultibandcolorrendererwidget.cpp index 5ef223adaa3..05d3bbf278d 100644 --- a/src/gui/raster/qgsmultibandcolorrendererwidget.cpp +++ b/src/gui/raster/qgsmultibandcolorrendererwidget.cpp @@ -21,7 +21,7 @@ QgsMultiBandColorRendererWidget::QgsMultiBandColorRendererWidget( QgsRasterLayer* layer, const QgsRectangle &extent ) : QgsRasterRendererWidget( layer, extent ) - , mMinMaxWidget( NULL ) + , mMinMaxWidget( nullptr ) { setupUi( this ); createValidators(); @@ -80,12 +80,12 @@ QgsRasterRenderer* QgsMultiBandColorRendererWidget::renderer() { if ( !mRasterLayer ) { - return 0; + return nullptr; } QgsRasterDataProvider* provider = mRasterLayer->dataProvider(); if ( !provider ) { - return 0; + return nullptr; } int redBand = mRedBandComboBox->itemData( mRedBandComboBox->currentIndex() ).toInt(); @@ -119,15 +119,15 @@ void QgsMultiBandColorRendererWidget::setCustomMinMaxValues( QgsMultiBandColorRe if ( mContrastEnhancementAlgorithmComboBox->itemData( mContrastEnhancementAlgorithmComboBox->currentIndex() ).toInt() == QgsContrastEnhancement::NoEnhancement ) { - r->setRedContrastEnhancement( 0 ); - r->setGreenContrastEnhancement( 0 ); - r->setBlueContrastEnhancement( 0 ); + r->setRedContrastEnhancement( nullptr ); + r->setGreenContrastEnhancement( nullptr ); + r->setBlueContrastEnhancement( nullptr ); return; } - QgsContrastEnhancement* redEnhancement = 0; - QgsContrastEnhancement* greenEnhancement = 0; - QgsContrastEnhancement* blueEnhancement = 0; + QgsContrastEnhancement* redEnhancement = nullptr; + QgsContrastEnhancement* greenEnhancement = nullptr; + QgsContrastEnhancement* blueEnhancement = nullptr; bool redMinOk, redMaxOk; double redMin = mRedMinLineEdit->text().toDouble( &redMinOk ); diff --git a/src/gui/raster/qgspalettedrendererwidget.cpp b/src/gui/raster/qgspalettedrendererwidget.cpp index 8244f11f6d3..d9a4ac0c2e6 100644 --- a/src/gui/raster/qgspalettedrendererwidget.cpp +++ b/src/gui/raster/qgspalettedrendererwidget.cpp @@ -73,7 +73,7 @@ void QgsPalettedRendererWidget::on_mTreeWidget_itemDoubleClicked( QTreeWidgetIte if ( column == 1 && item ) //change item color { item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable ); - QColor c = QgsColorDialogV2::getColor( item->background( column ).color(), 0 ); + QColor c = QgsColorDialogV2::getColor( item->background( column ).color(), nullptr ); if ( c.isValid() ) { item->setBackground( column, QBrush( c ) ); diff --git a/src/gui/raster/qgsrasterhistogramwidget.cpp b/src/gui/raster/qgsrasterhistogramwidget.cpp index 68139c57b76..5340a212c45 100644 --- a/src/gui/raster/qgsrasterhistogramwidget.cpp +++ b/src/gui/raster/qgsrasterhistogramwidget.cpp @@ -57,22 +57,22 @@ QgsRasterHistogramWidget::QgsRasterHistogramWidget( QgsRasterLayer* lyr, QWidget *parent ) : QWidget( parent ) , mRasterLayer( lyr ) - , mRendererWidget( 0 ) + , mRendererWidget( nullptr ) { setupUi( this ); mSaveAsImageButton->setIcon( QgsApplication::getThemeIcon( "/mActionFileSave.svg" ) ); - mRendererWidget = 0; + mRendererWidget = nullptr; mRendererName = "singlebandgray"; mHistoMin = 0; mHistoMax = 0; - mHistoPicker = NULL; - mHistoZoomer = NULL; - mHistoMarkerMin = NULL; - mHistoMarkerMax = NULL; + mHistoPicker = nullptr; + mHistoZoomer = nullptr; + mHistoMarkerMin = nullptr; + mHistoMarkerMax = nullptr; QSettings settings; mHistoShowMarkers = settings.value( "/Raster/histogram/showMarkers", false ).toBool(); @@ -380,7 +380,7 @@ void QgsRasterHistogramWidget::refreshHistogram() 1 + ( int )( 255.0 * qrand() / ( RAND_MAX + 1.0 ) ) ); } //randomise seed again - qsrand( time( NULL ) ); + qsrand( time( nullptr ) ); // assign colors to each band, depending on the current RGB/gray band selection // grayscale @@ -497,7 +497,7 @@ void QgsRasterHistogramWidget::refreshHistogram() myDrawLines = false; } - QwtPlotCurve * mypCurve = 0; + QwtPlotCurve * mypCurve = nullptr; if ( myDrawLines ) { mypCurve = new QwtPlotCurve( tr( "Band %1" ).arg( myIteratorInt ) ); @@ -518,7 +518,7 @@ void QgsRasterHistogramWidget::refreshHistogram() mypHisto->setBrush( QBrush( mHistoColors.at( myIteratorInt ) ) ); } #else - HistogramItem *mypHistoItem = 0; + HistogramItem *mypHistoItem = nullptr; if ( ! myDrawLines ) { mypHistoItem = new HistogramItem( tr( "Band %1" ).arg( myIteratorInt ) ); @@ -683,7 +683,7 @@ void QgsRasterHistogramWidget::refreshHistogram() void QgsRasterHistogramWidget::on_mSaveAsImageButton_clicked() { - if ( mpPlot == 0 ) + if ( mpPlot == nullptr ) { return; } @@ -742,7 +742,7 @@ bool QgsRasterHistogramWidget::histoSaveAsImage( const QString& theFilename, #endif // save pixmap to file - myPixmap.save( theFilename, 0, quality ); + myPixmap.save( theFilename, nullptr, quality ); // should do more error checking return true; @@ -760,12 +760,12 @@ void QgsRasterHistogramWidget::on_cboHistoBand_currentIndexChanged( int index ) // get the current index value, index can be -1 index = cboHistoBand->currentIndex(); - if ( mHistoPicker != NULL ) + if ( mHistoPicker != nullptr ) { mHistoPicker->setEnabled( false ); mHistoPicker->setRubberBandPen( QPen( mHistoColors.at( index + 1 ) ) ); } - if ( mHistoZoomer != NULL ) + if ( mHistoZoomer != nullptr ) mHistoZoomer->setEnabled( true ); btnHistoMin->setEnabled( true ); btnHistoMax->setEnabled( true ); @@ -1016,7 +1016,7 @@ void QgsRasterHistogramWidget::applyHistoMax() void QgsRasterHistogramWidget::on_btnHistoMin_toggled() { - if ( mpPlot != NULL && mHistoPicker != NULL ) + if ( mpPlot != nullptr && mHistoPicker != nullptr ) { if ( QApplication::overrideCursor() ) QApplication::restoreOverrideCursor(); @@ -1025,7 +1025,7 @@ void QgsRasterHistogramWidget::on_btnHistoMin_toggled() btnHistoMax->setChecked( false ); QApplication::setOverrideCursor( Qt::PointingHandCursor ); } - if ( mHistoZoomer != NULL ) + if ( mHistoZoomer != nullptr ) mHistoZoomer->setEnabled( ! btnHistoMin->isChecked() ); mHistoPicker->setEnabled( btnHistoMin->isChecked() ); } @@ -1034,7 +1034,7 @@ void QgsRasterHistogramWidget::on_btnHistoMin_toggled() void QgsRasterHistogramWidget::on_btnHistoMax_toggled() { - if ( mpPlot != NULL && mHistoPicker != NULL ) + if ( mpPlot != nullptr && mHistoPicker != nullptr ) { if ( QApplication::overrideCursor() ) QApplication::restoreOverrideCursor(); @@ -1043,7 +1043,7 @@ void QgsRasterHistogramWidget::on_btnHistoMax_toggled() btnHistoMin->setChecked( false ); QApplication::setOverrideCursor( Qt::PointingHandCursor ); } - if ( mHistoZoomer != NULL ) + if ( mHistoZoomer != nullptr ) mHistoZoomer->setEnabled( ! btnHistoMax->isChecked() ); mHistoPicker->setEnabled( btnHistoMax->isChecked() ); } @@ -1122,7 +1122,7 @@ void QgsRasterHistogramWidget::updateHistoMarkers() if ( leHistoMin->signalsBlocked() ) return; // todo error checking - if ( mpPlot == NULL || mHistoMarkerMin == NULL || mHistoMarkerMax == NULL ) + if ( mpPlot == nullptr || mHistoMarkerMin == nullptr || mHistoMarkerMax == nullptr ) return; int theBandNo = cboHistoBand->currentIndex() + 1; diff --git a/src/gui/raster/qgsrasterhistogramwidget.h b/src/gui/raster/qgsrasterhistogramwidget.h index 5496c6f9aec..ec5395459b9 100644 --- a/src/gui/raster/qgsrasterhistogramwidget.h +++ b/src/gui/raster/qgsrasterhistogramwidget.h @@ -39,14 +39,14 @@ class GUI_EXPORT QgsRasterHistogramWidget : public QWidget, private Ui::QgsRaste Q_OBJECT public: - QgsRasterHistogramWidget( QgsRasterLayer *lyr, QWidget *parent = 0 ); + QgsRasterHistogramWidget( QgsRasterLayer *lyr, QWidget *parent = nullptr ); ~QgsRasterHistogramWidget(); /** Save the histogram as an image to disk */ bool histoSaveAsImage( const QString& theFilename, int width = 600, int height = 600, int quality = -1 ); /** Set the renderer widget (or just its name if there is no widget) */ - void setRendererWidget( const QString& name, QgsRasterRendererWidget* rendererWidget = NULL ); + void setRendererWidget( const QString& name, QgsRasterRendererWidget* rendererWidget = nullptr ); /** Activate the histogram widget */ void setActive( bool theActiveFlag ); diff --git a/src/gui/raster/qgsrasterminmaxwidget.h b/src/gui/raster/qgsrasterminmaxwidget.h index c44e05f7c76..b1ba3d6fa8e 100644 --- a/src/gui/raster/qgsrasterminmaxwidget.h +++ b/src/gui/raster/qgsrasterminmaxwidget.h @@ -26,7 +26,7 @@ class GUI_EXPORT QgsRasterMinMaxWidget: public QWidget, private Ui::QgsRasterMin { Q_OBJECT public: - QgsRasterMinMaxWidget( QgsRasterLayer* theLayer, QWidget *parent = 0 ); + QgsRasterMinMaxWidget( QgsRasterLayer* theLayer, QWidget *parent = nullptr ); ~QgsRasterMinMaxWidget(); void setExtent( const QgsRectangle & theExtent ) { mExtent = theExtent; } diff --git a/src/gui/raster/qgssinglebandgrayrendererwidget.cpp b/src/gui/raster/qgssinglebandgrayrendererwidget.cpp index 72ba9a6f24f..dad3201fa5f 100644 --- a/src/gui/raster/qgssinglebandgrayrendererwidget.cpp +++ b/src/gui/raster/qgssinglebandgrayrendererwidget.cpp @@ -21,7 +21,7 @@ QgsSingleBandGrayRendererWidget::QgsSingleBandGrayRendererWidget( QgsRasterLayer* layer, const QgsRectangle &extent ) : QgsRasterRendererWidget( layer, extent ) - , mMinMaxWidget( NULL ) + , mMinMaxWidget( nullptr ) { setupUi( this ); @@ -75,12 +75,12 @@ QgsRasterRenderer* QgsSingleBandGrayRendererWidget::renderer() { if ( !mRasterLayer ) { - return 0; + return nullptr; } QgsRasterDataProvider* provider = mRasterLayer->dataProvider(); if ( !provider ) { - return 0; + return nullptr; } int band = mGrayBandComboBox->itemData( mGrayBandComboBox->currentIndex() ).toInt(); diff --git a/src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp b/src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp index 5760bcd7dc5..a09a12aa222 100644 --- a/src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp +++ b/src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp @@ -31,7 +31,7 @@ QgsSingleBandPseudoColorRendererWidget::QgsSingleBandPseudoColorRendererWidget( QgsRasterLayer* layer, const QgsRectangle &extent ) : QgsRasterRendererWidget( layer, extent ) - , mMinMaxWidget( NULL ) + , mMinMaxWidget( nullptr ) , mMinMaxOrigin( 0 ) { QSettings settings; diff --git a/src/gui/symbology-ng/characterwidget.h b/src/gui/symbology-ng/characterwidget.h index 11fcdaabb7e..ef4c44c1be0 100644 --- a/src/gui/symbology-ng/characterwidget.h +++ b/src/gui/symbology-ng/characterwidget.h @@ -64,7 +64,7 @@ class GUI_EXPORT CharacterWidget : public QWidget Q_OBJECT public: - CharacterWidget( QWidget *parent = 0 ); + CharacterWidget( QWidget *parent = nullptr ); QSize sizeHint() const override; int getColumns() const { return columns; } diff --git a/src/gui/symbology-ng/qgsbrushstylecombobox.h b/src/gui/symbology-ng/qgsbrushstylecombobox.h index ef8f05b5bba..07c7467a163 100644 --- a/src/gui/symbology-ng/qgsbrushstylecombobox.h +++ b/src/gui/symbology-ng/qgsbrushstylecombobox.h @@ -23,7 +23,7 @@ class GUI_EXPORT QgsBrushStyleComboBox : public QComboBox Q_OBJECT public: - QgsBrushStyleComboBox( QWidget* parent = NULL ); + QgsBrushStyleComboBox( QWidget* parent = nullptr ); Qt::BrushStyle brushStyle() const; diff --git a/src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp b/src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp index d239a75e96e..b81bd16ab86 100644 --- a/src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp +++ b/src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp @@ -44,7 +44,7 @@ //not part of public API QgsCategorizedSymbolRendererV2Model::QgsCategorizedSymbolRendererV2Model( QObject * parent ) : QAbstractItemModel( parent ) - , mRenderer( 0 ) + , mRenderer( nullptr ) , mMimeFormat( "application/x-qgscategorizedsymbolrendererv2model" ) { } @@ -54,7 +54,7 @@ void QgsCategorizedSymbolRendererV2Model::setRenderer( QgsCategorizedSymbolRende if ( mRenderer ) { beginRemoveRows( QModelIndex(), 0, mRenderer->categories().size() - 1 ); - mRenderer = 0; + mRenderer = nullptr; endRemoveRows(); } if ( renderer ) @@ -384,7 +384,7 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsExpressionContext expContext; expContext << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ); + << QgsExpressionContextUtils::atlasScope( nullptr ); if ( widget->mapCanvas() ) { @@ -404,8 +404,8 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsCategorizedSymbolRendererV2Widget::QgsCategorizedSymbolRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) : QgsRendererV2Widget( layer, style ) - , mRenderer( 0 ) - , mModel( 0 ) + , mRenderer( nullptr ) + , mModel( nullptr ) { // try to recognize the previous renderer @@ -665,7 +665,7 @@ static void _createCategories( QgsCategoryList& cats, QList& values, Q QgsVectorColorRampV2* QgsCategorizedSymbolRendererV2Widget::getColorRamp() { QgsVectorColorRampV2* ramp = cboCategorizedColorRamp->currentColorRamp(); - if ( ramp == NULL ) + if ( ramp == nullptr ) { if ( cboCategorizedColorRamp->count() == 0 ) QMessageBox::critical( this, tr( "Error" ), tr( "There are no available color ramps. You can add them in Style Manager." ) ); @@ -688,7 +688,7 @@ void QgsCategorizedSymbolRendererV2Widget::addCategories() QgsExpressionContext context; context << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ) + << QgsExpressionContextUtils::atlasScope( nullptr ) << QgsExpressionContextUtils::layerScope( mLayer ); expression->prepare( &context ); @@ -711,7 +711,7 @@ void QgsCategorizedSymbolRendererV2Widget::addCategories() // ask to abort if too many classes if ( unique_vals.size() >= 1000 ) { - int res = QMessageBox::warning( 0, tr( "High number of classes!" ), + int res = QMessageBox::warning( nullptr, tr( "High number of classes!" ), tr( "Classification would yield %1 entries which might not be expected. Continue?" ).arg( unique_vals.size() ), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel ); diff --git a/src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.h b/src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.h index 490c521d961..7cb6a062c53 100644 --- a/src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.h +++ b/src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.h @@ -32,7 +32,7 @@ class GUI_EXPORT QgsCategorizedSymbolRendererV2Model : public QAbstractItemModel { Q_OBJECT public: - QgsCategorizedSymbolRendererV2Model( QObject * parent = 0 ); + QgsCategorizedSymbolRendererV2Model( QObject * parent = nullptr ); Qt::ItemFlags flags( const QModelIndex & index ) const override; Qt::DropActions supportedDropActions() const override; QVariant data( const QModelIndex &index, int role ) const override; @@ -69,9 +69,9 @@ class QgsCategorizedSymbolRendererV2ViewStyle: public QProxyStyle Q_OBJECT public: - explicit QgsCategorizedSymbolRendererV2ViewStyle( QStyle* style = 0 ); + explicit QgsCategorizedSymbolRendererV2ViewStyle( QStyle* style = nullptr ); - void drawPrimitive( PrimitiveElement element, const QStyleOption * option, QPainter * painter, const QWidget * widget = 0 ) const override; + void drawPrimitive( PrimitiveElement element, const QStyleOption * option, QPainter * painter, const QWidget * widget = nullptr ) const override; }; ///@endcond diff --git a/src/gui/symbology-ng/qgscolorrampcombobox.cpp b/src/gui/symbology-ng/qgscolorrampcombobox.cpp index ed4ea0a15c1..67b7dddeaab 100644 --- a/src/gui/symbology-ng/qgscolorrampcombobox.cpp +++ b/src/gui/symbology-ng/qgscolorrampcombobox.cpp @@ -27,7 +27,7 @@ QSize QgsColorRampComboBox::rampIconSize( 50, 16 ); QgsColorRampComboBox::QgsColorRampComboBox( QWidget *parent ) : - QComboBox( parent ), mStyle( NULL ), mSourceColorRamp( NULL ), mShowGradientOnly( false ) + QComboBox( parent ), mStyle( nullptr ), mSourceColorRamp( nullptr ), mShowGradientOnly( false ) { } diff --git a/src/gui/symbology-ng/qgscolorrampcombobox.h b/src/gui/symbology-ng/qgscolorrampcombobox.h index 71e944eab29..166fb62d19f 100644 --- a/src/gui/symbology-ng/qgscolorrampcombobox.h +++ b/src/gui/symbology-ng/qgscolorrampcombobox.h @@ -24,7 +24,7 @@ class GUI_EXPORT QgsColorRampComboBox : public QComboBox { Q_OBJECT public: - explicit QgsColorRampComboBox( QWidget *parent = 0 ); + explicit QgsColorRampComboBox( QWidget *parent = nullptr ); ~QgsColorRampComboBox(); diff --git a/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp b/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp index 1b8518df6f8..7e42c676865 100644 --- a/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp +++ b/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp @@ -36,7 +36,7 @@ QgsCptCityColorRampV2Dialog::QgsCptCityColorRampV2Dialog( QgsCptCityColorRampV2* ramp, QWidget* parent ) : QDialog( parent ) - , mRamp( 0 ) + , mRamp( nullptr ) , mArchiveViewType( QgsCptCityBrowserModel::Selections ) { setupUi( this ); @@ -48,8 +48,8 @@ QgsCptCityColorRampV2Dialog::QgsCptCityColorRampV2Dialog( QgsCptCityColorRampV2* mSplitter->setSizes( QList() << 250 << 550 ); mSplitter->restoreState( settings.value( "/Windows/CptCityColorRampV2Dialog/splitter" ).toByteArray() ); - mModel = mAuthorsModel = mSelectionsModel = 0; //mListModel = 0; - mTreeFilter = 0; + mModel = mAuthorsModel = mSelectionsModel = nullptr; //mListModel = 0; + mTreeFilter = nullptr; QgsCptCityArchive::initDefaultArchive(); mArchive = QgsCptCityArchive::defaultArchive(); @@ -59,7 +59,7 @@ QgsCptCityColorRampV2Dialog::QgsCptCityColorRampV2Dialog( QgsCptCityColorRampV2* { // QgsDialog dlg( this ); // dlg.setWindowTitle( tr( "cpt-city gradient files not found" ) ); - QTextEdit *edit = new QTextEdit( 0 ); + QTextEdit *edit = new QTextEdit( nullptr ); edit->setReadOnly( true ); // not sure if we want this long string to be translated QString helpText = tr( "Error - cpt-city gradient files not found.\n\n" @@ -357,7 +357,7 @@ void QgsCptCityColorRampV2Dialog::on_pbtnLicenseDetails_pressed() descFile = mArchive->descFileName( path ); // prepare dialog - QgsDialog dlg( this, 0, QDialogButtonBox::Close ); + QgsDialog dlg( this, nullptr, QDialogButtonBox::Close ); QVBoxLayout *layout = dlg.layout(); dlg.setWindowTitle( title ); QTextEdit *textEdit = new QTextEdit( &dlg ); diff --git a/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.h b/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.h index 40a87173445..11f786c6c08 100644 --- a/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.h +++ b/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.h @@ -36,7 +36,7 @@ class GUI_EXPORT QgsCptCityColorRampV2Dialog : public QDialog, private Ui::QgsCp Q_OBJECT public: - QgsCptCityColorRampV2Dialog( QgsCptCityColorRampV2* ramp, QWidget* parent = NULL ); + QgsCptCityColorRampV2Dialog( QgsCptCityColorRampV2* ramp, QWidget* parent = nullptr ); ~QgsCptCityColorRampV2Dialog(); QString selectedName() const diff --git a/src/gui/symbology-ng/qgsdashspacedialog.h b/src/gui/symbology-ng/qgsdashspacedialog.h index c8552482aaf..e61c54ed645 100644 --- a/src/gui/symbology-ng/qgsdashspacedialog.h +++ b/src/gui/symbology-ng/qgsdashspacedialog.h @@ -23,7 +23,7 @@ class GUI_EXPORT QgsDashSpaceDialog: public QDialog, private Ui::QgsDashSpaceDia { Q_OBJECT public: - QgsDashSpaceDialog( const QVector& v, QWidget * parent = 0, const Qt::WindowFlags& f = 0 ); + QgsDashSpaceDialog( const QVector& v, QWidget * parent = nullptr, const Qt::WindowFlags& f = nullptr ); ~QgsDashSpaceDialog(); QVector dashDotVector() const; diff --git a/src/gui/symbology-ng/qgsdatadefinedsymboldialog.h b/src/gui/symbology-ng/qgsdatadefinedsymboldialog.h index 9ea99688682..17ee3ddfe63 100644 --- a/src/gui/symbology-ng/qgsdatadefinedsymboldialog.h +++ b/src/gui/symbology-ng/qgsdatadefinedsymboldialog.h @@ -28,7 +28,7 @@ class GUI_EXPORT QgsDataDefinedSymbolDialog: public QDialog, private Ui::QgsData }; //! @deprecated will be removed in QGIS 3.0 - Q_DECL_DEPRECATED QgsDataDefinedSymbolDialog( const QList< DataDefinedSymbolEntry >& entries, const QgsVectorLayer* vl, QWidget * parent = 0, const Qt::WindowFlags& f = 0 ); + Q_DECL_DEPRECATED QgsDataDefinedSymbolDialog( const QList< DataDefinedSymbolEntry >& entries, const QgsVectorLayer* vl, QWidget * parent = nullptr, const Qt::WindowFlags& f = nullptr ); ~QgsDataDefinedSymbolDialog(); //! @deprecated will be removed in QGIS 3.0 diff --git a/src/gui/symbology-ng/qgsellipsesymbollayerv2widget.cpp b/src/gui/symbology-ng/qgsellipsesymbollayerv2widget.cpp index f7d414e44d8..3a6aa68da64 100644 --- a/src/gui/symbology-ng/qgsellipsesymbollayerv2widget.cpp +++ b/src/gui/symbology-ng/qgsellipsesymbollayerv2widget.cpp @@ -21,7 +21,7 @@ QgsEllipseSymbolLayerV2Widget::QgsEllipseSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent ) : QgsSymbolLayerV2Widget( parent, vl ) - , mLayer( NULL ) + , mLayer( nullptr ) { setupUi( this ); diff --git a/src/gui/symbology-ng/qgsellipsesymbollayerv2widget.h b/src/gui/symbology-ng/qgsellipsesymbollayerv2widget.h index 459a2e12142..ad2c9b216cd 100644 --- a/src/gui/symbology-ng/qgsellipsesymbollayerv2widget.h +++ b/src/gui/symbology-ng/qgsellipsesymbollayerv2widget.h @@ -25,7 +25,7 @@ class GUI_EXPORT QgsEllipseSymbolLayerV2Widget: public QgsSymbolLayerV2Widget, p Q_OBJECT public: - QgsEllipseSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = 0 ); + QgsEllipseSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsEllipseSymbolLayerV2Widget( vl ); } diff --git a/src/gui/symbology-ng/qgsgraduatedhistogramwidget.cpp b/src/gui/symbology-ng/qgsgraduatedhistogramwidget.cpp index 3d96afe7ee4..0147b9912d4 100644 --- a/src/gui/symbology-ng/qgsgraduatedhistogramwidget.cpp +++ b/src/gui/symbology-ng/qgsgraduatedhistogramwidget.cpp @@ -46,8 +46,8 @@ QgsGraduatedHistogramWidget::QgsGraduatedHistogramWidget( QWidget *parent ) : QgsHistogramWidget( parent ) - , mRenderer( 0 ) - , mHistoPicker( 0 ) + , mRenderer( nullptr ) + , mHistoPicker( nullptr ) , mPressedValue( 0 ) { //clear x axis title to make more room for graph diff --git a/src/gui/symbology-ng/qgsgraduatedhistogramwidget.h b/src/gui/symbology-ng/qgsgraduatedhistogramwidget.h index 4d631b9216a..e8fc99074c5 100644 --- a/src/gui/symbology-ng/qgsgraduatedhistogramwidget.h +++ b/src/gui/symbology-ng/qgsgraduatedhistogramwidget.h @@ -39,7 +39,7 @@ class GUI_EXPORT QgsGraduatedHistogramWidget : public QgsHistogramWidget /** QgsGraduatedHistogramWidget constructor * @param parent parent widget */ - QgsGraduatedHistogramWidget( QWidget *parent = 0 ); + QgsGraduatedHistogramWidget( QWidget *parent = nullptr ); ~QgsGraduatedHistogramWidget(); /** Sets the QgsGraduatedSymbolRendererV2 renderer associated with the histogram. diff --git a/src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp b/src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp index b6cea4adf00..334556778ba 100644 --- a/src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp +++ b/src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp @@ -43,7 +43,7 @@ //not part of public API QgsGraduatedSymbolRendererV2Model::QgsGraduatedSymbolRendererV2Model( QObject * parent ) : QAbstractItemModel( parent ) - , mRenderer( 0 ) + , mRenderer( nullptr ) , mMimeFormat( "application/x-qgsgraduatedsymbolrendererv2model" ) { } @@ -53,7 +53,7 @@ void QgsGraduatedSymbolRendererV2Model::setRenderer( QgsGraduatedSymbolRendererV if ( mRenderer ) { beginRemoveRows( QModelIndex(), 0, mRenderer->ranges().size() - 1 ); - mRenderer = 0; + mRenderer = nullptr; endRemoveRows(); } if ( renderer ) @@ -392,7 +392,7 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsExpressionContext expContext; expContext << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ); + << QgsExpressionContextUtils::atlasScope( nullptr ); if ( widget->mapCanvas() ) { @@ -412,8 +412,8 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsGraduatedSymbolRendererV2Widget::QgsGraduatedSymbolRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) : QgsRendererV2Widget( layer, style ) - , mRenderer( 0 ) - , mModel( 0 ) + , mRenderer( nullptr ) + , mModel( nullptr ) { @@ -655,7 +655,7 @@ void QgsGraduatedSymbolRendererV2Widget::on_methodComboBox_currentIndexChanged( mRenderer->setGraduatedMethod( QgsGraduatedSymbolRendererV2::GraduatedColor ); QgsVectorColorRampV2* ramp = cboGraduatedColorRamp->currentColorRamp(); - if ( ramp == NULL ) + if ( ramp == nullptr ) { if ( cboGraduatedColorRamp->count() == 0 ) QMessageBox::critical( this, tr( "Error" ), tr( "There are no available color ramps. You can add them in Style Manager." ) ); @@ -726,7 +726,7 @@ void QgsGraduatedSymbolRendererV2Widget::classifyGraduated() { QgsVectorColorRampV2* ramp = cboGraduatedColorRamp->currentColorRamp(); - if ( ramp == NULL ) + if ( ramp == nullptr ) { if ( cboGraduatedColorRamp->count() == 0 ) QMessageBox::critical( this, tr( "Error" ), tr( "There are no available color ramps. You can add them in Style Manager." ) ); @@ -738,7 +738,7 @@ void QgsGraduatedSymbolRendererV2Widget::classifyGraduated() } else { - mRenderer->setSourceColorRamp( NULL ); + mRenderer->setSourceColorRamp( nullptr ); } QApplication::setOverrideCursor( Qt::WaitCursor ); @@ -757,7 +757,7 @@ void QgsGraduatedSymbolRendererV2Widget::classifyGraduated() void QgsGraduatedSymbolRendererV2Widget::reapplyColorRamp() { QgsVectorColorRampV2* ramp = cboGraduatedColorRamp->currentColorRamp(); - if ( ramp == NULL ) + if ( ramp == nullptr ) return; mRenderer->updateColorRamp( ramp, cbxInvertedColorRamp->isChecked() ); @@ -1086,7 +1086,7 @@ QgsSymbolV2* QgsGraduatedSymbolRendererV2Widget::findSymbolForRange( double lowe return it->symbol(); } } - return 0; + return nullptr; } void QgsGraduatedSymbolRendererV2Widget::refreshSymbolView() diff --git a/src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.h b/src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.h index eea70754be3..97b4eb4facd 100644 --- a/src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.h +++ b/src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.h @@ -30,7 +30,7 @@ class GUI_EXPORT QgsGraduatedSymbolRendererV2Model : public QAbstractItemModel { Q_OBJECT public: - QgsGraduatedSymbolRendererV2Model( QObject * parent = 0 ); + QgsGraduatedSymbolRendererV2Model( QObject * parent = nullptr ); Qt::ItemFlags flags( const QModelIndex & index ) const override; Qt::DropActions supportedDropActions() const override; QVariant data( const QModelIndex &index, int role ) const override; @@ -69,9 +69,9 @@ class QgsGraduatedSymbolRendererV2ViewStyle: public QProxyStyle Q_OBJECT public: - explicit QgsGraduatedSymbolRendererV2ViewStyle( QStyle* style = 0 ); + explicit QgsGraduatedSymbolRendererV2ViewStyle( QStyle* style = nullptr ); - void drawPrimitive( PrimitiveElement element, const QStyleOption * option, QPainter * painter, const QWidget * widget = 0 ) const override; + void drawPrimitive( PrimitiveElement element, const QStyleOption * option, QPainter * painter, const QWidget * widget = nullptr ) const override; }; ///@endcond diff --git a/src/gui/symbology-ng/qgsheatmaprendererwidget.cpp b/src/gui/symbology-ng/qgsheatmaprendererwidget.cpp index 5b02ca3128f..b7b1c1f9d9d 100644 --- a/src/gui/symbology-ng/qgsheatmaprendererwidget.cpp +++ b/src/gui/symbology-ng/qgsheatmaprendererwidget.cpp @@ -39,7 +39,7 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsExpressionContext expContext; expContext << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ); + << QgsExpressionContextUtils::atlasScope( nullptr ); if ( widget->mapCanvas() ) { @@ -59,7 +59,7 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsHeatmapRendererWidget::QgsHeatmapRendererWidget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) : QgsRendererV2Widget( layer, style ) - , mRenderer( NULL ) + , mRenderer( nullptr ) { if ( !layer ) { @@ -69,7 +69,7 @@ QgsHeatmapRendererWidget::QgsHeatmapRendererWidget( QgsVectorLayer* layer, QgsSt if ( layer->geometryType() != QGis::Point ) { //setup blank dialog - mRenderer = NULL; + mRenderer = nullptr; QGridLayout* layout = new QGridLayout( this ); QLabel* label = new QLabel( tr( "The heatmap renderer only applies to point and multipoint layers. \n" "'%1' is not a point layer and cannot be rendered as a heatmap." ) @@ -145,7 +145,7 @@ void QgsHeatmapRendererWidget::applyColorRamp() } QgsVectorColorRampV2* ramp = mRampComboBox->currentColorRamp(); - if ( ramp == NULL ) + if ( ramp == nullptr ) return; mRenderer->setColorRamp( ramp ); diff --git a/src/gui/symbology-ng/qgsinvertedpolygonrendererwidget.cpp b/src/gui/symbology-ng/qgsinvertedpolygonrendererwidget.cpp index 372f07c09c5..0248cab027a 100644 --- a/src/gui/symbology-ng/qgsinvertedpolygonrendererwidget.cpp +++ b/src/gui/symbology-ng/qgsinvertedpolygonrendererwidget.cpp @@ -41,7 +41,7 @@ QgsInvertedPolygonRendererWidget::QgsInvertedPolygonRendererWidget( QgsVectorLay layer->wkbType() != QGis::WKBMultiPolygon25D ) { //setup blank dialog - mRenderer.reset( 0 ); + mRenderer.reset( nullptr ); QGridLayout* layout = new QGridLayout( this ); QLabel* label = new QLabel( tr( "The inverted polygon renderer only applies to polygon and multipolygon layers. \n" "'%1' is not a polygon layer and then cannot be displayed" ) diff --git a/src/gui/symbology-ng/qgslayerpropertieswidget.cpp b/src/gui/symbology-ng/qgslayerpropertieswidget.cpp index 269ae11c217..11da340ecb1 100644 --- a/src/gui/symbology-ng/qgslayerpropertieswidget.cpp +++ b/src/gui/symbology-ng/qgslayerpropertieswidget.cpp @@ -37,13 +37,13 @@ static bool _initWidgetFunction( const QString& name, QgsSymbolLayerV2WidgetFunc QgsSymbolLayerV2Registry* reg = QgsSymbolLayerV2Registry::instance(); QgsSymbolLayerV2AbstractMetadata* abstractMetadata = reg->symbolLayerMetadata( name ); - if ( abstractMetadata == NULL ) + if ( abstractMetadata == nullptr ) { QgsDebugMsg( "Failed to find symbol layer's entry in registry: " + name ); return false; } QgsSymbolLayerV2Metadata* metadata = dynamic_cast( abstractMetadata ); - if ( metadata == NULL ) + if ( metadata == nullptr ) { QgsDebugMsg( "Failed to cast symbol layer's metadata: " + name ); return false; @@ -84,8 +84,8 @@ static void _initWidgetFunctions() QgsLayerPropertiesWidget::QgsLayerPropertiesWidget( QgsSymbolLayerV2* layer, const QgsSymbolV2* symbol, const QgsVectorLayer* vl, QWidget* parent ) : QWidget( parent ) - , mPresetExpressionContext( 0 ) - , mMapCanvas( 0 ) + , mPresetExpressionContext( nullptr ) + , mMapCanvas( nullptr ) { mLayer = layer; @@ -201,13 +201,13 @@ void QgsLayerPropertiesWidget::layerTypeChanged() // get creation function for new layer from registry QgsSymbolLayerV2Registry* pReg = QgsSymbolLayerV2Registry::instance(); QgsSymbolLayerV2AbstractMetadata* am = pReg->symbolLayerMetadata( newLayerType ); - if ( am == NULL ) // check whether the metadata is assigned + if ( am == nullptr ) // check whether the metadata is assigned return; // change layer to a new (with different type) // base new layer on existing layer's properties QgsSymbolLayerV2* newLayer = am->createSymbolLayer( layer->properties() ); - if ( newLayer == NULL ) + if ( newLayer == nullptr ) return; updateSymbolLayerWidget( newLayer ); diff --git a/src/gui/symbology-ng/qgslayerpropertieswidget.h b/src/gui/symbology-ng/qgslayerpropertieswidget.h index 360038fdde1..1884fae3592 100644 --- a/src/gui/symbology-ng/qgslayerpropertieswidget.h +++ b/src/gui/symbology-ng/qgslayerpropertieswidget.h @@ -35,7 +35,7 @@ class GUI_EXPORT QgsLayerPropertiesWidget : public QWidget, private Ui::LayerPro Q_OBJECT public: - QgsLayerPropertiesWidget( QgsSymbolLayerV2* layer, const QgsSymbolV2* symbol, const QgsVectorLayer* vl, QWidget* parent = NULL ); + QgsLayerPropertiesWidget( QgsSymbolLayerV2* layer, const QgsSymbolV2* symbol, const QgsVectorLayer* vl, QWidget* parent = nullptr ); /** Returns the expression context used for the widget, if set. This expression context is used for * evaluating data defined symbol properties and for populating based expression widgets in diff --git a/src/gui/symbology-ng/qgspenstylecombobox.h b/src/gui/symbology-ng/qgspenstylecombobox.h index 22dbf559439..86af8df03fc 100644 --- a/src/gui/symbology-ng/qgspenstylecombobox.h +++ b/src/gui/symbology-ng/qgspenstylecombobox.h @@ -23,7 +23,7 @@ class GUI_EXPORT QgsPenStyleComboBox : public QComboBox Q_OBJECT public: - QgsPenStyleComboBox( QWidget* parent = NULL ); + QgsPenStyleComboBox( QWidget* parent = nullptr ); Qt::PenStyle penStyle() const; @@ -39,7 +39,7 @@ class GUI_EXPORT QgsPenJoinStyleComboBox : public QComboBox Q_OBJECT public: - QgsPenJoinStyleComboBox( QWidget* parent = NULL ); + QgsPenJoinStyleComboBox( QWidget* parent = nullptr ); Qt::PenJoinStyle penJoinStyle() const; @@ -51,7 +51,7 @@ class GUI_EXPORT QgsPenCapStyleComboBox : public QComboBox Q_OBJECT public: - QgsPenCapStyleComboBox( QWidget* parent = NULL ); + QgsPenCapStyleComboBox( QWidget* parent = nullptr ); Qt::PenCapStyle penCapStyle() const; diff --git a/src/gui/symbology-ng/qgspointdisplacementrendererwidget.cpp b/src/gui/symbology-ng/qgspointdisplacementrendererwidget.cpp index 749bb2a9cd1..ae013083f0a 100644 --- a/src/gui/symbology-ng/qgspointdisplacementrendererwidget.cpp +++ b/src/gui/symbology-ng/qgspointdisplacementrendererwidget.cpp @@ -32,8 +32,8 @@ QgsRendererV2Widget* QgsPointDisplacementRendererWidget::create( QgsVectorLayer* QgsPointDisplacementRendererWidget::QgsPointDisplacementRendererWidget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) : QgsRendererV2Widget( layer, style ) - , mRenderer( NULL ) - , mEmbeddedRendererWidget( 0 ) + , mRenderer( nullptr ) + , mEmbeddedRendererWidget( nullptr ) { if ( !layer ) { @@ -44,7 +44,7 @@ QgsPointDisplacementRendererWidget::QgsPointDisplacementRendererWidget( QgsVecto if ( layer->wkbType() != QGis::WKBPoint && layer->wkbType() != QGis::WKBPoint25D ) { //setup blank dialog - mRenderer = 0; + mRenderer = nullptr; setupBlankUi( layer->name() ); return; } @@ -231,7 +231,7 @@ void QgsPointDisplacementRendererWidget::on_mRendererSettingsButton_clicked() layout->addWidget( mEmbeddedRendererWidget, 0, 0 ); layout->addWidget( buttonBox, 1, 0 ); d->exec(); - mEmbeddedRendererWidget->setParent( 0 ); + mEmbeddedRendererWidget->setParent( nullptr ); delete d; } } diff --git a/src/gui/symbology-ng/qgsrendererv2propertiesdialog.cpp b/src/gui/symbology-ng/qgsrendererv2propertiesdialog.cpp index fba145819d9..0cec276c24d 100644 --- a/src/gui/symbology-ng/qgsrendererv2propertiesdialog.cpp +++ b/src/gui/symbology-ng/qgsrendererv2propertiesdialog.cpp @@ -37,10 +37,10 @@ static bool _initRenderer( const QString& name, QgsRendererV2WidgetFunc f, const { QgsRendererV2Registry* reg = QgsRendererV2Registry::instance(); QgsRendererV2AbstractMetadata* am = reg->rendererMetadata( name ); - if ( am == NULL ) + if ( am == nullptr ) return false; QgsRendererV2Metadata* m = dynamic_cast( am ); - if ( m == NULL ) + if ( m == nullptr ) return false; m->setWidgetFunction( f ); @@ -76,9 +76,9 @@ static void _initRendererWidgetFunctions() QgsRendererV2PropertiesDialog::QgsRendererV2PropertiesDialog( QgsVectorLayer* layer, QgsStyleV2* style, bool embedded ) : mLayer( layer ) , mStyle( style ) - , mActiveWidget( NULL ) - , mPaintEffect( 0 ) - , mMapCanvas( 0 ) + , mActiveWidget( nullptr ) + , mPaintEffect( nullptr ) + , mMapCanvas( nullptr ) { setupUi( this ); @@ -186,16 +186,16 @@ void QgsRendererV2PropertiesDialog::rendererChanged() stackedWidget->removeWidget( mActiveWidget ); delete mActiveWidget; - mActiveWidget = NULL; + mActiveWidget = nullptr; } - QgsRendererV2Widget* w = NULL; + QgsRendererV2Widget* w = nullptr; QgsRendererV2AbstractMetadata* m = QgsRendererV2Registry::instance()->rendererMetadata( rendererName ); - if ( m != NULL ) + if ( m != nullptr ) w = m->createRendererWidget( mLayer, mStyle, oldRenderer ); delete oldRenderer; - if ( w != NULL ) + if ( w != nullptr ) { // instantiate the widget and set as active mActiveWidget = w; diff --git a/src/gui/symbology-ng/qgsrendererv2widget.cpp b/src/gui/symbology-ng/qgsrendererv2widget.cpp index f736ea91320..1d02ca74919 100644 --- a/src/gui/symbology-ng/qgsrendererv2widget.cpp +++ b/src/gui/symbology-ng/qgsrendererv2widget.cpp @@ -28,7 +28,7 @@ QgsRendererV2Widget::QgsRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* sty : QWidget() , mLayer( layer ) , mStyle( style ) - , mMapCanvas( 0 ) + , mMapCanvas( nullptr ) { contextMenu = new QMenu( tr( "Renderer Options" ), this ); @@ -327,7 +327,7 @@ void QgsRendererV2DataDefinedMenus::populateMenu( QMenu* menu, const QString& fi void QgsRendererV2DataDefinedMenus::rotationFieldSelected( QAction* a ) { - if ( a == NULL ) + if ( a == nullptr ) return; QString fldName = a->text(); @@ -354,7 +354,7 @@ void QgsRendererV2DataDefinedMenus::rotationFieldSelected( QAction* a ) void QgsRendererV2DataDefinedMenus::sizeScaleFieldSelected( QAction* a ) { - if ( a == NULL ) + if ( a == nullptr ) return; QString fldName = a->text(); @@ -381,7 +381,7 @@ void QgsRendererV2DataDefinedMenus::sizeScaleFieldSelected( QAction* a ) void QgsRendererV2DataDefinedMenus::scaleMethodSelected( QAction* a ) { - if ( a == NULL ) + if ( a == nullptr ) return; if ( a->text() == tr( "Scale area" ) ) @@ -406,7 +406,7 @@ void QgsRendererV2DataDefinedMenus::updateMenu( QActionGroup* actionGroup, QStri QgsDataDefinedValueDialog::QgsDataDefinedValueDialog( const QList& symbolList, QgsVectorLayer * layer, const QString & label ) : mSymbolList( symbolList ) , mLayer( layer ) - , mMapCanvas( 0 ) + , mMapCanvas( nullptr ) { setupUi( this ); setWindowFlags( Qt::WindowStaysOnTopHint ); @@ -438,7 +438,7 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsExpressionContext expContext; expContext << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ); + << QgsExpressionContextUtils::atlasScope( nullptr ); if ( widget->mapCanvas() ) { expContext << QgsExpressionContextUtils::mapSettingsScope( widget->mapCanvas()->mapSettings() ) diff --git a/src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp b/src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp index 8aee2e181f5..47cb107dfe2 100644 --- a/src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp +++ b/src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp @@ -46,7 +46,7 @@ QgsRendererV2Widget* QgsRuleBasedRendererV2Widget::create( QgsVectorLayer* layer QgsRuleBasedRendererV2Widget::QgsRuleBasedRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) : QgsRendererV2Widget( layer, style ) { - mRenderer = 0; + mRenderer = nullptr; // try to recognize the previous renderer // (null renderer means "no previous renderer") @@ -160,7 +160,7 @@ QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2Widget::currentRule() QItemSelectionModel* sel = viewRules->selectionModel(); QModelIndex idx = sel->currentIndex(); if ( !idx.isValid() ) - return NULL; + return nullptr; return mModel->ruleForIndex( idx ); } @@ -257,7 +257,7 @@ void QgsRuleBasedRendererV2Widget::refineRuleCategoriesGui( const QModelIndexLis QDialog dlg; dlg.setWindowTitle( tr( "Refine a rule to categories" ) ); QVBoxLayout* l = new QVBoxLayout(); - QgsCategorizedSymbolRendererV2Widget* w = new QgsCategorizedSymbolRendererV2Widget( mLayer, mStyle, NULL ); + QgsCategorizedSymbolRendererV2Widget* w = new QgsCategorizedSymbolRendererV2Widget( mLayer, mStyle, nullptr ); w->setMapCanvas( mMapCanvas ); l->addWidget( w ); QDialogButtonBox* bb = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); @@ -288,7 +288,7 @@ void QgsRuleBasedRendererV2Widget::refineRuleRangesGui( const QModelIndexList& i QDialog dlg; dlg.setWindowTitle( tr( "Refine a rule to ranges" ) ); QVBoxLayout* l = new QVBoxLayout(); - QgsGraduatedSymbolRendererV2Widget* w = new QgsGraduatedSymbolRendererV2Widget( mLayer, mStyle, NULL ); + QgsGraduatedSymbolRendererV2Widget* w = new QgsGraduatedSymbolRendererV2Widget( mLayer, mStyle, nullptr ); w->setMapCanvas( mMapCanvas ); l->addWidget( w ); QDialogButtonBox* bb = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); @@ -318,7 +318,7 @@ void QgsRuleBasedRendererV2Widget::refineRuleScalesGui( const QModelIndexList& i QgsRuleBasedRendererV2::Rule* initialRule = mModel->ruleForIndex( index ); // If any of the rules don't have a symbol let the user know and exit. - if ( initialRule->symbol() == NULL ) + if ( initialRule->symbol() == nullptr ) { QMessageBox::warning( this, tr( "Scale refinement" ), tr( "Parent rule %1 must have a symbol for this operation." ).arg( initialRule->label() ) ); return; @@ -512,7 +512,7 @@ void QgsRuleBasedRendererV2Widget::countFeatures() QgsExpressionContext context; context << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ); + << QgsExpressionContextUtils::atlasScope( nullptr ); if ( mMapCanvas ) { context << QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() ) @@ -590,7 +590,7 @@ void QgsRuleBasedRendererV2Widget::selectedRulesChanged() /////////// QgsRendererRulePropsDialog::QgsRendererRulePropsDialog( QgsRuleBasedRendererV2::Rule* rule, QgsVectorLayer* layer, QgsStyleV2* style, QWidget* parent , QgsMapCanvas* mapCanvas ) - : QDialog( parent ), mRule( rule ), mLayer( layer ), mSymbolSelector( NULL ), mSymbol( NULL ), mMapCanvas( mapCanvas ) + : QDialog( parent ), mRule( rule ), mLayer( layer ), mSymbolSelector( nullptr ), mSymbol( nullptr ), mMapCanvas( mapCanvas ) { setupUi( this ); #ifdef Q_OS_MAC @@ -653,7 +653,7 @@ void QgsRendererRulePropsDialog::buildExpression() QgsExpressionContext context; context << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ); + << QgsExpressionContextUtils::atlasScope( nullptr ); if ( mMapCanvas ) { context << QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() ) @@ -683,7 +683,7 @@ void QgsRendererRulePropsDialog::testFilter() QgsExpressionContext context; context << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ); + << QgsExpressionContextUtils::atlasScope( nullptr ); if ( mMapCanvas ) { context << QgsExpressionContextUtils::mapSettingsScope( mMapCanvas->mapSettings() ) @@ -731,7 +731,7 @@ void QgsRendererRulePropsDialog::accept() // caution: rule uses scale denom, scale widget uses true scales mRule->setScaleMinDenom( groupScale->isChecked() ? mScaleRangeWidget->minimumScaleDenom() : 0 ); mRule->setScaleMaxDenom( groupScale->isChecked() ? mScaleRangeWidget->maximumScaleDenom() : 0 ); - mRule->setSymbol( groupSymbol->isChecked() ? mSymbol->clone() : NULL ); + mRule->setSymbol( groupSymbol->isChecked() ? mSymbol->clone() : nullptr ); QDialog::accept(); } diff --git a/src/gui/symbology-ng/qgsrulebasedrendererv2widget.h b/src/gui/symbology-ng/qgsrulebasedrendererv2widget.h index 9849b2755e7..bdcbdf0f1e6 100644 --- a/src/gui/symbology-ng/qgsrulebasedrendererv2widget.h +++ b/src/gui/symbology-ng/qgsrulebasedrendererv2widget.h @@ -168,7 +168,7 @@ class GUI_EXPORT QgsRendererRulePropsDialog : public QDialog, private Ui::QgsRen Q_OBJECT public: - QgsRendererRulePropsDialog( QgsRuleBasedRendererV2::Rule* rule, QgsVectorLayer* layer, QgsStyleV2* style, QWidget* parent = 0, QgsMapCanvas* mapCanvas = 0 ); + QgsRendererRulePropsDialog( QgsRuleBasedRendererV2::Rule* rule, QgsVectorLayer* layer, QgsStyleV2* style, QWidget* parent = nullptr, QgsMapCanvas* mapCanvas = nullptr ); ~QgsRendererRulePropsDialog(); QgsRuleBasedRendererV2::Rule* rule() { return mRule; } diff --git a/src/gui/symbology-ng/qgssinglesymbolrendererv2widget.cpp b/src/gui/symbology-ng/qgssinglesymbolrendererv2widget.cpp index 15175c5ec22..88854505871 100644 --- a/src/gui/symbology-ng/qgssinglesymbolrendererv2widget.cpp +++ b/src/gui/symbology-ng/qgssinglesymbolrendererv2widget.cpp @@ -31,7 +31,7 @@ QgsRendererV2Widget* QgsSingleSymbolRendererV2Widget::create( QgsVectorLayer* la QgsSingleSymbolRendererV2Widget::QgsSingleSymbolRendererV2Widget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) : QgsRendererV2Widget( layer, style ) - , mRenderer( NULL ) + , mRenderer( nullptr ) { // try to recognize the previous renderer // (null renderer means "no previous renderer") @@ -51,7 +51,7 @@ QgsSingleSymbolRendererV2Widget::QgsSingleSymbolRendererV2Widget( QgsVectorLayer mSingleSymbol = mRenderer->symbol()->clone(); // setup ui - mSelector = new QgsSymbolV2SelectorDialog( mSingleSymbol, mStyle, mLayer, NULL, true ); + mSelector = new QgsSymbolV2SelectorDialog( mSingleSymbol, mStyle, mLayer, nullptr, true ); connect( mSelector, SIGNAL( symbolModified() ), this, SLOT( changeSingleSymbol() ) ); QVBoxLayout* layout = new QVBoxLayout; diff --git a/src/gui/symbology-ng/qgssizescalewidget.cpp b/src/gui/symbology-ng/qgssizescalewidget.cpp index ef9dcc83793..92f7ecbbfbb 100644 --- a/src/gui/symbology-ng/qgssizescalewidget.cpp +++ b/src/gui/symbology-ng/qgssizescalewidget.cpp @@ -102,7 +102,7 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsExpressionContext expContext; expContext << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ); + << QgsExpressionContextUtils::atlasScope( nullptr ); if ( widget->mapCanvas() ) { @@ -124,8 +124,8 @@ QgsSizeScaleWidget::QgsSizeScaleWidget( const QgsVectorLayer * layer, const QgsS : mSymbol( symbol ) // we just use the minimumValue and maximumValue from the layer, unfortunately they are // non const, so we get the layer from the registry instead - , mLayer( layer ? dynamic_cast( QgsMapLayerRegistry::instance()->mapLayer( layer->id() ) ) : 0 ) - , mMapCanvas( 0 ) + , mLayer( layer ? dynamic_cast( QgsMapLayerRegistry::instance()->mapLayer( layer->id() ) ) : nullptr ) + , mMapCanvas( nullptr ) { setupUi( this ); setWindowFlags( Qt::WindowStaysOnTopHint ); @@ -139,7 +139,7 @@ QgsSizeScaleWidget::QgsSizeScaleWidget( const QgsVectorLayer * layer, const QgsS } else { - mLayerTreeLayer = 0; + mLayerTreeLayer = nullptr; } treeView->setModel( &mPreviewList ); @@ -247,14 +247,14 @@ void QgsSizeScaleWidget::updatePreview() symbol->setDataDefinedSize( QgsDataDefined() ); symbol->setDataDefinedAngle( QgsDataDefined() ); // to avoid symbol not beeing drawn symbol->setSize( expr->size( breaks[i] ) ); - node.reset( new QgsSymbolV2LegendNode( mLayerTreeLayer, QgsLegendSymbolItemV2( symbol.data(), QString::number( i ), 0 ) ) ); + node.reset( new QgsSymbolV2LegendNode( mLayerTreeLayer, QgsLegendSymbolItemV2( symbol.data(), QString::number( i ), nullptr ) ) ); } else if ( dynamic_cast( mSymbol ) ) { QScopedPointer< QgsLineSymbolV2 > symbol( static_cast( mSymbol->clone() ) ); symbol->setDataDefinedWidth( QgsDataDefined() ); symbol->setWidth( expr->size( breaks[i] ) ); - node.reset( new QgsSymbolV2LegendNode( mLayerTreeLayer, QgsLegendSymbolItemV2( symbol.data(), QString::number( i ), 0 ) ) ); + node.reset( new QgsSymbolV2LegendNode( mLayerTreeLayer, QgsLegendSymbolItemV2( symbol.data(), QString::number( i ), nullptr ) ) ); } @@ -290,7 +290,7 @@ void QgsSizeScaleWidget::computeFromLayerTriggered() QgsExpressionContext context; context << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ) + << QgsExpressionContextUtils::atlasScope( nullptr ) << QgsExpressionContextUtils::layerScope( mLayer ); if ( ! expression.prepare( &context ) ) diff --git a/src/gui/symbology-ng/qgssmartgroupeditordialog.h b/src/gui/symbology-ng/qgssmartgroupeditordialog.h index ff28a408155..8e77799a079 100644 --- a/src/gui/symbology-ng/qgssmartgroupeditordialog.h +++ b/src/gui/symbology-ng/qgssmartgroupeditordialog.h @@ -23,7 +23,7 @@ class GUI_EXPORT QgsSmartGroupCondition : public QWidget, private Ui::QgsSmartGr Q_OBJECT public: - QgsSmartGroupCondition( int id, QWidget *parent = NULL ); + QgsSmartGroupCondition( int id, QWidget *parent = nullptr ); //! returns the constraint key QString constraint(); @@ -64,7 +64,7 @@ class GUI_EXPORT QgsSmartGroupEditorDialog : public QDialog, private Ui::QgsSmar Q_OBJECT public: - QgsSmartGroupEditorDialog( QgsStyleV2* style, QWidget* parent = NULL ); + QgsSmartGroupEditorDialog( QgsStyleV2* style, QWidget* parent = nullptr ); ~QgsSmartGroupEditorDialog(); //! returns the value from mNameLineEdit diff --git a/src/gui/symbology-ng/qgsstylev2exportimportdialog.cpp b/src/gui/symbology-ng/qgsstylev2exportimportdialog.cpp index 87936a2d52d..c79b1829266 100644 --- a/src/gui/symbology-ng/qgsstylev2exportimportdialog.cpp +++ b/src/gui/symbology-ng/qgsstylev2exportimportdialog.cpp @@ -55,11 +55,11 @@ QgsStyleV2ExportImportDialog::QgsStyleV2ExportImportDialog( QgsStyleV2* style, Q mTempStyle = new QgsStyleV2(); // TODO validate mFileName = ""; - mProgressDlg = NULL; - mGroupSelectionDlg = NULL; - mTempFile = NULL; + mProgressDlg = nullptr; + mGroupSelectionDlg = nullptr; + mTempFile = nullptr; mNetManager = new QNetworkAccessManager( this ); - mNetReply = NULL; + mNetReply = nullptr; if ( mDialogMode == Import ) { @@ -214,7 +214,7 @@ void QgsStyleV2ExportImportDialog::moveStyles( QModelIndexList* selection, QgsSt { QString symbolName; QgsSymbolV2* symbol; - QgsVectorColorRampV2 *ramp = 0; + QgsVectorColorRampV2 *ramp = nullptr; QModelIndex index; bool isSymbol = true; bool prompt = true; @@ -273,7 +273,7 @@ void QgsStyleV2ExportImportDialog::moveStyles( QModelIndexList* selection, QgsSt index = selection->at( i ); symbolName = index.model()->data( index, 0 ).toString(); symbol = src->symbol( symbolName ); - if ( symbol == NULL ) + if ( symbol == nullptr ) { isSymbol = false; ramp = src->colorRamp( symbolName ); @@ -533,7 +533,7 @@ void QgsStyleV2ExportImportDialog::downloadStyleXML( const QUrl& url ) if ( mProgressDlg ) { QProgressDialog *dummy = mProgressDlg; - mProgressDlg = NULL; + mProgressDlg = nullptr; delete dummy; } mProgressDlg = new QProgressDialog(); @@ -546,7 +546,7 @@ void QgsStyleV2ExportImportDialog::downloadStyleXML( const QUrl& url ) if ( mNetReply ) { QNetworkReply *dummyReply = mNetReply; - mNetReply = NULL; + mNetReply = nullptr; delete dummyReply; } mNetReply = mNetManager->get( QNetworkRequest( url ) ); diff --git a/src/gui/symbology-ng/qgsstylev2exportimportdialog.h b/src/gui/symbology-ng/qgsstylev2exportimportdialog.h index 016e09b9f84..2027dc2696c 100644 --- a/src/gui/symbology-ng/qgsstylev2exportimportdialog.h +++ b/src/gui/symbology-ng/qgsstylev2exportimportdialog.h @@ -44,7 +44,7 @@ class GUI_EXPORT QgsStyleV2ExportImportDialog : public QDialog, private Ui::QgsS // constructor // mode argument must be 0 for saving and 1 for loading - QgsStyleV2ExportImportDialog( QgsStyleV2* style, QWidget *parent = NULL, Mode mode = Export ); + QgsStyleV2ExportImportDialog( QgsStyleV2* style, QWidget *parent = nullptr, Mode mode = Export ); ~QgsStyleV2ExportImportDialog(); /** * @brief selectSymbols select symbols by name diff --git a/src/gui/symbology-ng/qgsstylev2groupselectiondialog.h b/src/gui/symbology-ng/qgsstylev2groupselectiondialog.h index 71526329993..a95687f3fd8 100644 --- a/src/gui/symbology-ng/qgsstylev2groupselectiondialog.h +++ b/src/gui/symbology-ng/qgsstylev2groupselectiondialog.h @@ -29,7 +29,7 @@ class GUI_EXPORT QgsStyleV2GroupSelectionDialog : public QDialog, private Ui::Sy Q_OBJECT public: - QgsStyleV2GroupSelectionDialog( QgsStyleV2* style, QWidget *parent = 0 ); + QgsStyleV2GroupSelectionDialog( QgsStyleV2* style, QWidget *parent = nullptr ); ~QgsStyleV2GroupSelectionDialog(); //! Set bold font for item void setBold( QStandardItem *item ); diff --git a/src/gui/symbology-ng/qgsstylev2managerdialog.cpp b/src/gui/symbology-ng/qgsstylev2managerdialog.cpp index c2e55af8e3e..09d19926af7 100644 --- a/src/gui/symbology-ng/qgsstylev2managerdialog.cpp +++ b/src/gui/symbology-ng/qgsstylev2managerdialog.cpp @@ -209,7 +209,7 @@ void QgsStyleV2ManagerDialog::on_tabItemType_currentChanged( int ) { disconnect( btnAddItem->menu(), SIGNAL( triggered( QAction* ) ), this, SLOT( addColorRamp( QAction* ) ) ); - btnAddItem->setMenu( 0 ); + btnAddItem->setMenu( nullptr ); } } @@ -358,7 +358,7 @@ bool QgsStyleV2ManagerDialog::addSymbol() // that, it is being called by Style Manager, so recursive calling // of style manager and symbol selector can be arrested // See also: editSymbol() - QgsSymbolV2SelectorDialog dlg( symbol, mStyle, NULL, this ); + QgsSymbolV2SelectorDialog dlg( symbol, mStyle, nullptr, this ); if ( dlg.exec() == 0 ) { delete symbol; @@ -428,7 +428,7 @@ QString QgsStyleV2ManagerDialog::addColorRampStatic( QWidget* parent, QgsStyleV2 QString name = tr( "new ramp" ); - QgsVectorColorRampV2 *ramp = NULL; + QgsVectorColorRampV2 *ramp = nullptr; if ( rampType == tr( "Gradient" ) ) { QgsVectorGradientColorRampV2* gradRamp = new QgsVectorGradientColorRampV2(); @@ -541,7 +541,7 @@ QString QgsStyleV2ManagerDialog::addColorRampStatic( QWidget* parent, QgsStyleV2 bool QgsStyleV2ManagerDialog::addColorRamp() { - return addColorRamp( 0 ); + return addColorRamp( nullptr ); } bool QgsStyleV2ManagerDialog::addColorRamp( QAction* action ) @@ -588,7 +588,7 @@ bool QgsStyleV2ManagerDialog::editSymbol() QgsSymbolV2* symbol = mStyle->symbol( symbolName ); // let the user edit the symbol and update list when done - QgsSymbolV2SelectorDialog dlg( symbol, mStyle, NULL, this ); + QgsSymbolV2SelectorDialog dlg( symbol, mStyle, nullptr, this ); if ( dlg.exec() == 0 ) { delete symbol; diff --git a/src/gui/symbology-ng/qgsstylev2managerdialog.h b/src/gui/symbology-ng/qgsstylev2managerdialog.h index 032f4be7e8d..be743b60cfe 100644 --- a/src/gui/symbology-ng/qgsstylev2managerdialog.h +++ b/src/gui/symbology-ng/qgsstylev2managerdialog.h @@ -31,7 +31,7 @@ class GUI_EXPORT QgsStyleV2ManagerDialog : public QDialog, private Ui::QgsStyleV Q_OBJECT public: - QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* parent = NULL ); + QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* parent = nullptr ); //! open add color ramp dialog, return color ramp's name if the ramp has been added static QString addColorRampStatic( QWidget* parent, QgsStyleV2* style, diff --git a/src/gui/symbology-ng/qgssvgselectorwidget.cpp b/src/gui/symbology-ng/qgssvgselectorwidget.cpp index 439bf6c4c9c..0afe0bc275c 100644 --- a/src/gui/symbology-ng/qgssvgselectorwidget.cpp +++ b/src/gui/symbology-ng/qgssvgselectorwidget.cpp @@ -269,7 +269,7 @@ void QgsSvgSelectorWidget::on_mFilePushButton_clicked() openDir = openDirFileInfo.path(); } - QString file = QFileDialog::getOpenFileName( 0, + QString file = QFileDialog::getOpenFileName( nullptr, tr( "Select SVG file" ), openDir, tr( "SVG files" ) + " (*.svg *.SVG)" ); diff --git a/src/gui/symbology-ng/qgssvgselectorwidget.h b/src/gui/symbology-ng/qgssvgselectorwidget.h index 7d91b59d34d..f102edddf76 100644 --- a/src/gui/symbology-ng/qgssvgselectorwidget.h +++ b/src/gui/symbology-ng/qgssvgselectorwidget.h @@ -70,10 +70,10 @@ class GUI_EXPORT QgsSvgSelectorWidget : public QWidget, private Ui::WidgetSvgSel Q_OBJECT public: - QgsSvgSelectorWidget( QWidget* parent = 0 ); + QgsSvgSelectorWidget( QWidget* parent = nullptr ); ~QgsSvgSelectorWidget(); - static QgsSvgSelectorWidget* create( QWidget* parent = 0 ) { return new QgsSvgSelectorWidget( parent ); } + static QgsSvgSelectorWidget* create( QWidget* parent = nullptr ) { return new QgsSvgSelectorWidget( parent ); } QString currentSvgPath() const; QString currentSvgPathToName() const; @@ -112,7 +112,7 @@ class GUI_EXPORT QgsSvgSelectorDialog : public QDialog { Q_OBJECT public: - QgsSvgSelectorDialog( QWidget* parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags, + QgsSvgSelectorDialog( QWidget* parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags, const QDialogButtonBox::StandardButtons& buttons = QDialogButtonBox::Close | QDialogButtonBox::Ok, Qt::Orientation orientation = Qt::Horizontal ); ~QgsSvgSelectorDialog(); diff --git a/src/gui/symbology-ng/qgssymbollayerv2widget.cpp b/src/gui/symbology-ng/qgssymbollayerv2widget.cpp index 98b318569d7..e9e3ab79660 100644 --- a/src/gui/symbology-ng/qgssymbollayerv2widget.cpp +++ b/src/gui/symbology-ng/qgssymbollayerv2widget.cpp @@ -59,7 +59,7 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsExpressionContext expContext; expContext << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ); + << QgsExpressionContextUtils::atlasScope( nullptr ); if ( widget->mapCanvas() ) { @@ -154,7 +154,7 @@ QString QgsSymbolLayerV2Widget::dataDefinedPropertyLabel( const QString &entryNa QgsSimpleLineSymbolLayerV2Widget::QgsSimpleLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent ) : QgsSymbolLayerV2Widget( parent, vl ) { - mLayer = NULL; + mLayer = nullptr; setupUi( this ); mPenWidthUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel ); @@ -399,7 +399,7 @@ void QgsSimpleLineSymbolLayerV2Widget::updatePatternIcon() QgsSimpleMarkerSymbolLayerV2Widget::QgsSimpleMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent ) : QgsSymbolLayerV2Widget( parent, vl ) { - mLayer = NULL; + mLayer = nullptr; setupUi( this ); mSizeUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel ); @@ -666,7 +666,7 @@ void QgsSimpleMarkerSymbolLayerV2Widget::updateAssistantSymbol() QgsSimpleFillSymbolLayerV2Widget::QgsSimpleFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent ) : QgsSymbolLayerV2Widget( parent, vl ) { - mLayer = NULL; + mLayer = nullptr; setupUi( this ); mBorderWidthUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel ); @@ -815,7 +815,7 @@ void QgsSimpleFillSymbolLayerV2Widget::on_mOffsetUnitWidget_changed() QgsGradientFillSymbolLayerV2Widget::QgsGradientFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent ) : QgsSymbolLayerV2Widget( parent, vl ) { - mLayer = NULL; + mLayer = nullptr; setupUi( this ); mOffsetUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel ); @@ -1028,7 +1028,7 @@ void QgsGradientFillSymbolLayerV2Widget::colorModeChanged() void QgsGradientFillSymbolLayerV2Widget::applyColorRamp() { QgsVectorColorRampV2* ramp = cboGradientColorRamp->currentColorRamp(); - if ( ramp == NULL ) + if ( ramp == nullptr ) return; mLayer->setColorRamp( ramp ); @@ -1146,7 +1146,7 @@ void QgsGradientFillSymbolLayerV2Widget::on_mOffsetUnitWidget_changed() QgsShapeburstFillSymbolLayerV2Widget::QgsShapeburstFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent ) : QgsSymbolLayerV2Widget( parent, vl ) { - mLayer = NULL; + mLayer = nullptr; setupUi( this ); mDistanceUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel ); @@ -1356,7 +1356,7 @@ void QgsShapeburstFillSymbolLayerV2Widget::on_mRadioUseWholeShape_toggled( bool void QgsShapeburstFillSymbolLayerV2Widget::applyColorRamp() { QgsVectorColorRampV2* ramp = cboGradientColorRamp->currentColorRamp(); - if ( ramp == NULL ) + if ( ramp == nullptr ) return; mLayer->setColorRamp( ramp ); @@ -1395,7 +1395,7 @@ void QgsShapeburstFillSymbolLayerV2Widget::on_mIgnoreRingsCheckBox_stateChanged( QgsMarkerLineSymbolLayerV2Widget::QgsMarkerLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent ) : QgsSymbolLayerV2Widget( parent, vl ) { - mLayer = NULL; + mLayer = nullptr; setupUi( this ); mIntervalUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel ); @@ -1559,7 +1559,7 @@ void QgsMarkerLineSymbolLayerV2Widget::on_mOffsetAlongLineUnitWidget_changed() QgsSvgMarkerSymbolLayerV2Widget::QgsSvgMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent ) : QgsSymbolLayerV2Widget( parent, vl ) { - mLayer = NULL; + mLayer = nullptr; setupUi( this ); mSizeUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel ); @@ -1814,7 +1814,7 @@ void QgsSvgMarkerSymbolLayerV2Widget::setOffset() void QgsSvgMarkerSymbolLayerV2Widget::on_mFileToolButton_clicked() { QSettings s; - QString file = QFileDialog::getOpenFileName( 0, + QString file = QFileDialog::getOpenFileName( nullptr, tr( "Select SVG file" ), s.value( "/UI/lastSVGMarkerDir", QDir::homePath() ).toString(), tr( "SVG files" ) + " (*.svg)" ); @@ -1942,7 +1942,7 @@ void QgsSvgMarkerSymbolLayerV2Widget::on_mVerticalAnchorComboBox_currentIndexCha QgsSVGFillSymbolLayerWidget::QgsSVGFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent ): QgsSymbolLayerV2Widget( parent, vl ) { - mLayer = 0; + mLayer = nullptr; setupUi( this ); mTextureWidthUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel ); mSvgOutlineWidthUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel ); @@ -2016,7 +2016,7 @@ QgsSymbolLayerV2* QgsSVGFillSymbolLayerWidget::symbolLayer() void QgsSVGFillSymbolLayerWidget::on_mBrowseToolButton_clicked() { - QString filePath = QFileDialog::getOpenFileName( 0, tr( "Select SVG texture file" ), QDir::homePath(), tr( "SVG file" ) + " (*.svg);;" + tr( "All files" ) + " (*.*)" ); + QString filePath = QFileDialog::getOpenFileName( nullptr, tr( "Select SVG texture file" ), QDir::homePath(), tr( "SVG file" ) + " (*.svg);;" + tr( "All files" ) + " (*.*)" ); if ( !filePath.isNull() ) { mSVGLineEdit->setText( filePath ); @@ -2220,7 +2220,7 @@ void QgsSVGFillSymbolLayerWidget::on_mSvgOutlineWidthUnitWidget_changed() ///////////// QgsLinePatternFillSymbolLayerWidget::QgsLinePatternFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent ): - QgsSymbolLayerV2Widget( parent, vl ), mLayer( 0 ) + QgsSymbolLayerV2Widget( parent, vl ), mLayer( nullptr ) { setupUi( this ); mDistanceUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel ); @@ -2319,7 +2319,7 @@ void QgsLinePatternFillSymbolLayerWidget::on_mOffsetUnitWidget_changed() ///////////// QgsPointPatternFillSymbolLayerWidget::QgsPointPatternFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent ): - QgsSymbolLayerV2Widget( parent, vl ), mLayer( 0 ) + QgsSymbolLayerV2Widget( parent, vl ), mLayer( nullptr ) { setupUi( this ); mHorizontalDistanceUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel ); @@ -2459,7 +2459,7 @@ void QgsPointPatternFillSymbolLayerWidget::on_mVerticalDisplacementUnitWidget_ch QgsFontMarkerSymbolLayerV2Widget::QgsFontMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent ) : QgsSymbolLayerV2Widget( parent, vl ) { - mLayer = NULL; + mLayer = nullptr; setupUi( this ); mSizeUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel ); @@ -2659,7 +2659,7 @@ void QgsFontMarkerSymbolLayerV2Widget::updateAssistantSymbol() QgsCentroidFillSymbolLayerV2Widget::QgsCentroidFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent ) : QgsSymbolLayerV2Widget( parent, vl ) { - mLayer = NULL; + mLayer = nullptr; setupUi( this ); } @@ -2694,7 +2694,7 @@ void QgsCentroidFillSymbolLayerV2Widget::on_mDrawInsideCheckBox_stateChanged( in QgsRasterFillSymbolLayerWidget::QgsRasterFillSymbolLayerWidget( const QgsVectorLayer *vl, QWidget *parent ) : QgsSymbolLayerV2Widget( parent, vl ) { - mLayer = 0; + mLayer = nullptr; setupUi( this ); mWidthUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::Pixel << QgsSymbolV2::MM << QgsSymbolV2::MapUnit ); @@ -2800,14 +2800,14 @@ void QgsRasterFillSymbolLayerWidget::on_mBrowseToolButton_clicked() } //show file dialog - QString filePath = QFileDialog::getOpenFileName( 0, tr( "Select image file" ), openDir ); + QString filePath = QFileDialog::getOpenFileName( nullptr, tr( "Select image file" ), openDir ); if ( !filePath.isNull() ) { //check if file exists QFileInfo fileInfo( filePath ); if ( !fileInfo.exists() || !fileInfo.isReadable() ) { - QMessageBox::critical( 0, "Invalid file", "Error, file does not exist or is not readable" ); + QMessageBox::critical( nullptr, "Invalid file", "Error, file does not exist or is not readable" ); return; } diff --git a/src/gui/symbology-ng/qgssymbollayerv2widget.h b/src/gui/symbology-ng/qgssymbollayerv2widget.h index 9fdce6ab280..e1786dca16d 100644 --- a/src/gui/symbology-ng/qgssymbollayerv2widget.h +++ b/src/gui/symbology-ng/qgssymbollayerv2widget.h @@ -31,7 +31,7 @@ class GUI_EXPORT QgsSymbolLayerV2Widget : public QWidget Q_OBJECT public: - QgsSymbolLayerV2Widget( QWidget* parent, const QgsVectorLayer* vl = 0 ) : QWidget( parent ), mVectorLayer( vl ), mPresetExpressionContext( 0 ), mMapCanvas( 0 ) {} + QgsSymbolLayerV2Widget( QWidget* parent, const QgsVectorLayer* vl = nullptr ) : QWidget( parent ), mVectorLayer( vl ), mPresetExpressionContext( nullptr ), mMapCanvas( nullptr ) {} virtual ~QgsSymbolLayerV2Widget() {} virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) = 0; @@ -122,7 +122,7 @@ class GUI_EXPORT QgsSimpleLineSymbolLayerV2Widget : public QgsSymbolLayerV2Widge Q_OBJECT public: - QgsSimpleLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL ); + QgsSimpleLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); ~QgsSimpleLineSymbolLayerV2Widget(); @@ -171,7 +171,7 @@ class GUI_EXPORT QgsSimpleMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2Wid Q_OBJECT public: - QgsSimpleMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL ); + QgsSimpleMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); ~QgsSimpleMarkerSymbolLayerV2Widget(); static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsSimpleMarkerSymbolLayerV2Widget( vl ); } @@ -218,7 +218,7 @@ class GUI_EXPORT QgsSimpleFillSymbolLayerV2Widget : public QgsSymbolLayerV2Widge Q_OBJECT public: - QgsSimpleFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL ); + QgsSimpleFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsSimpleFillSymbolLayerV2Widget( vl ); } @@ -252,7 +252,7 @@ class GUI_EXPORT QgsGradientFillSymbolLayerV2Widget : public QgsSymbolLayerV2Wid Q_OBJECT public: - QgsGradientFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL ); + QgsGradientFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsGradientFillSymbolLayerV2Widget( vl ); } @@ -288,7 +288,7 @@ class GUI_EXPORT QgsShapeburstFillSymbolLayerV2Widget : public QgsSymbolLayerV2W Q_OBJECT public: - QgsShapeburstFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL ); + QgsShapeburstFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsShapeburstFillSymbolLayerV2Widget( vl ); } @@ -324,7 +324,7 @@ class GUI_EXPORT QgsMarkerLineSymbolLayerV2Widget : public QgsSymbolLayerV2Widge Q_OBJECT public: - QgsMarkerLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL ); + QgsMarkerLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsMarkerLineSymbolLayerV2Widget( vl ); } @@ -360,7 +360,7 @@ class GUI_EXPORT QgsSvgMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2Widget Q_OBJECT public: - QgsSvgMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL ); + QgsSvgMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); ~QgsSvgMarkerSymbolLayerV2Widget(); static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsSvgMarkerSymbolLayerV2Widget( vl ); } @@ -417,7 +417,7 @@ class GUI_EXPORT QgsRasterFillSymbolLayerWidget : public QgsSymbolLayerV2Widget, Q_OBJECT public: - QgsRasterFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL ); + QgsRasterFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsRasterFillSymbolLayerWidget( vl ); } @@ -454,7 +454,7 @@ class GUI_EXPORT QgsSVGFillSymbolLayerWidget : public QgsSymbolLayerV2Widget, pr Q_OBJECT public: - QgsSVGFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL ); + QgsSVGFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsSVGFillSymbolLayerWidget( vl ); } @@ -499,7 +499,7 @@ class GUI_EXPORT QgsLinePatternFillSymbolLayerWidget : public QgsSymbolLayerV2Wi public: - QgsLinePatternFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL ); + QgsLinePatternFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsLinePatternFillSymbolLayerWidget( vl ); } virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override; @@ -527,7 +527,7 @@ class GUI_EXPORT QgsPointPatternFillSymbolLayerWidget: public QgsSymbolLayerV2Wi Q_OBJECT public: - QgsPointPatternFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL ); + QgsPointPatternFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsPointPatternFillSymbolLayerWidget( vl ); } virtual void setSymbolLayer( QgsSymbolLayerV2* layer ) override; @@ -559,7 +559,7 @@ class GUI_EXPORT QgsFontMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2Widge Q_OBJECT public: - QgsFontMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL ); + QgsFontMarkerSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); ~QgsFontMarkerSymbolLayerV2Widget(); @@ -607,7 +607,7 @@ class GUI_EXPORT QgsCentroidFillSymbolLayerV2Widget : public QgsSymbolLayerV2Wid Q_OBJECT public: - QgsCentroidFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = NULL ); + QgsCentroidFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsCentroidFillSymbolLayerV2Widget( vl ); } @@ -667,7 +667,7 @@ class GUI_EXPORT QgsGeometryGeneratorSymbolLayerWidget : public QgsSymbolLayerV2 Q_OBJECT public: - QgsGeometryGeneratorSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = 0 ); + QgsGeometryGeneratorSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); /** * Will be registered as factory diff --git a/src/gui/symbology-ng/qgssymbollevelsv2dialog.h b/src/gui/symbology-ng/qgssymbollevelsv2dialog.h index 51e8904c377..911bb39313f 100644 --- a/src/gui/symbology-ng/qgssymbollevelsv2dialog.h +++ b/src/gui/symbology-ng/qgssymbollevelsv2dialog.h @@ -29,7 +29,7 @@ class GUI_EXPORT QgsSymbolLevelsV2Dialog : public QDialog, private Ui::QgsSymbol Q_OBJECT public: // @note not available in python bindings - QgsSymbolLevelsV2Dialog( const QgsLegendSymbolList& list, bool usingSymbolLevels, QWidget* parent = NULL ); + QgsSymbolLevelsV2Dialog( const QgsLegendSymbolList& list, bool usingSymbolLevels, QWidget* parent = nullptr ); ~QgsSymbolLevelsV2Dialog(); @@ -64,7 +64,7 @@ class SpinBoxDelegate : public QItemDelegate Q_OBJECT public: - explicit SpinBoxDelegate( QObject *parent = 0 ) : QItemDelegate( parent ) {} + explicit SpinBoxDelegate( QObject *parent = nullptr ) : QItemDelegate( parent ) {} QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem & /*option*/, const QModelIndex &/*index*/ ) const override; diff --git a/src/gui/symbology-ng/qgssymbolslistwidget.cpp b/src/gui/symbology-ng/qgssymbolslistwidget.cpp index dce78d70a0a..df419e8ffad 100644 --- a/src/gui/symbology-ng/qgssymbolslistwidget.cpp +++ b/src/gui/symbology-ng/qgssymbolslistwidget.cpp @@ -44,11 +44,11 @@ QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* sty : QWidget( parent ) , mSymbol( symbol ) , mStyle( style ) - , mAdvancedMenu( 0 ) - , mClipFeaturesAction( 0 ) + , mAdvancedMenu( nullptr ) + , mClipFeaturesAction( nullptr ) , mLayer( layer ) - , mMapCanvas( 0 ) - , mPresetExpressionContext( 0 ) + , mMapCanvas( nullptr ) + , mPresetExpressionContext( nullptr ) { setupUi( this ); @@ -407,7 +407,7 @@ static QgsExpressionContext _getExpressionContext( const void* context ) QgsExpressionContext expContext; expContext << QgsExpressionContextUtils::globalScope() << QgsExpressionContextUtils::projectScope() - << QgsExpressionContextUtils::atlasScope( 0 ); + << QgsExpressionContextUtils::atlasScope( nullptr ); if ( widget->mapCanvas() ) { diff --git a/src/gui/symbology-ng/qgssymbolslistwidget.h b/src/gui/symbology-ng/qgssymbolslistwidget.h index d8dfc1258a1..5d93f81e4b3 100644 --- a/src/gui/symbology-ng/qgssymbolslistwidget.h +++ b/src/gui/symbology-ng/qgssymbolslistwidget.h @@ -30,7 +30,7 @@ class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListW Q_OBJECT public: - QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* style, QMenu* menu, QWidget* parent, const QgsVectorLayer * layer = 0 ); + QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* style, QMenu* menu, QWidget* parent, const QgsVectorLayer * layer = nullptr ); //! Destructor virtual ~QgsSymbolsListWidget(); diff --git a/src/gui/symbology-ng/qgssymbolv2selectordialog.cpp b/src/gui/symbology-ng/qgssymbolv2selectordialog.cpp index 5777a4a6504..d15153c7fb1 100644 --- a/src/gui/symbology-ng/qgssymbolv2selectordialog.cpp +++ b/src/gui/symbology-ng/qgssymbolv2selectordialog.cpp @@ -50,10 +50,10 @@ static const int SymbolLayerItemType = QStandardItem::UserType + 1; DataDefinedRestorer::DataDefinedRestorer( QgsSymbolV2* symbol, const QgsSymbolLayerV2* symbolLayer ) - : mMarker( NULL ) - , mMarkerSymbolLayer( NULL ) - , mLine( NULL ) - , mLineSymbolLayer( NULL ) + : mMarker( nullptr ) + , mMarkerSymbolLayer( nullptr ) + , mLine( nullptr ) + , mLineSymbolLayer( nullptr ) { if ( symbolLayer->type() == QgsSymbolV2::Marker && symbol->type() == QgsSymbolV2::Marker ) { @@ -64,7 +64,7 @@ DataDefinedRestorer::DataDefinedRestorer( QgsSymbolV2* symbol, const QgsSymbolLa mDDAngle = mMarker->dataDefinedAngle(); // check if restore is actually needed if ( mDDSize == QgsDataDefined() && mDDAngle == QgsDataDefined() ) - mMarker = NULL; + mMarker = nullptr; } else if ( symbolLayer->type() == QgsSymbolV2::Line && symbol->type() == QgsSymbolV2::Line ) { @@ -73,7 +73,7 @@ DataDefinedRestorer::DataDefinedRestorer( QgsSymbolV2* symbol, const QgsSymbolLa mDDWidth = mLine->dataDefinedWidth(); // check if restore is actually needed if ( mDDWidth == QgsDataDefined() ) - mLine = NULL; + mLine = nullptr; } save(); } @@ -132,7 +132,7 @@ class SymbolLayerItem : public QStandardItem { mLayer = layer; mIsLayer = true; - mSymbol = 0; + mSymbol = nullptr; updatePreview(); } @@ -140,7 +140,7 @@ class SymbolLayerItem : public QStandardItem { mSymbol = symbol; mIsLayer = false; - mLayer = 0; + mLayer = nullptr; updatePreview(); } @@ -181,9 +181,9 @@ class SymbolLayerItem : public QStandardItem { switch ( mSymbol->type() ) { - case QgsSymbolV2::Marker : return QCoreApplication::translate( "SymbolLayerItem", "Marker", 0, QCoreApplication::UnicodeUTF8 ); - case QgsSymbolV2::Fill : return QCoreApplication::translate( "SymbolLayerItem", "Fill", 0, QCoreApplication::UnicodeUTF8 ); - case QgsSymbolV2::Line : return QCoreApplication::translate( "SymbolLayerItem", "Line", 0, QCoreApplication::UnicodeUTF8 ); + case QgsSymbolV2::Marker : return QCoreApplication::translate( "SymbolLayerItem", "Marker", nullptr, QCoreApplication::UnicodeUTF8 ); + case QgsSymbolV2::Fill : return QCoreApplication::translate( "SymbolLayerItem", "Fill", nullptr, QCoreApplication::UnicodeUTF8 ); + case QgsSymbolV2::Line : return QCoreApplication::translate( "SymbolLayerItem", "Line", nullptr, QCoreApplication::UnicodeUTF8 ); default: return "Symbol"; } } @@ -207,16 +207,16 @@ class SymbolLayerItem : public QStandardItem QgsSymbolV2SelectorDialog::QgsSymbolV2SelectorDialog( QgsSymbolV2* symbol, QgsStyleV2* style, const QgsVectorLayer* vl, QWidget* parent, bool embedded ) : QDialog( parent ) - , mAdvancedMenu( NULL ) + , mAdvancedMenu( nullptr ) , mVectorLayer( vl ) - , mMapCanvas( 0 ) + , mMapCanvas( nullptr ) { #ifdef Q_OS_MAC setWindowModality( Qt::WindowModal ); #endif mStyle = style; mSymbol = symbol; - mPresentWidget = NULL; + mPresentWidget = nullptr; setupUi( this ); @@ -285,7 +285,7 @@ void QgsSymbolV2SelectorDialog::keyPressEvent( QKeyEvent * e ) QMenu* QgsSymbolV2SelectorDialog::advancedMenu() { - if ( mAdvancedMenu == NULL ) + if ( mAdvancedMenu == nullptr ) { mAdvancedMenu = new QMenu( this ); // Brute force method to activate the Advanced menu @@ -392,11 +392,11 @@ SymbolLayerItem* QgsSymbolV2SelectorDialog::currentLayerItem() { QModelIndex idx = layersTree->currentIndex(); if ( !idx.isValid() ) - return 0; + return nullptr; SymbolLayerItem *item = static_cast( model->itemFromIndex( idx ) ); if ( !item->isLayer() ) - return 0; + return nullptr; return item; } @@ -405,13 +405,13 @@ QgsSymbolLayerV2* QgsSymbolV2SelectorDialog::currentLayer() { QModelIndex idx = layersTree->currentIndex(); if ( !idx.isValid() ) - return NULL; + return nullptr; SymbolLayerItem *item = static_cast( model->itemFromIndex( idx ) ); if ( item->isLayer() ) return item->layer(); - return NULL; + return nullptr; } void QgsSymbolV2SelectorDialog::layerChanged() @@ -419,7 +419,7 @@ void QgsSymbolV2SelectorDialog::layerChanged() updateUi(); SymbolLayerItem *currentItem = static_cast( model->itemFromIndex( layersTree->currentIndex() ) ); - if ( currentItem == NULL ) + if ( currentItem == nullptr ) return; if ( currentItem->isLayer() ) @@ -454,7 +454,7 @@ void QgsSymbolV2SelectorDialog::layerChanged() void QgsSymbolV2SelectorDialog::symbolChanged() { SymbolLayerItem *currentItem = static_cast( model->itemFromIndex( layersTree->currentIndex() ) ); - if ( currentItem == NULL || currentItem->isLayer() ) + if ( currentItem == nullptr || currentItem->isLayer() ) return; // disconnect to avoid recreating widget disconnect( layersTree->selectionModel(), SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ), this, SLOT( layerChanged() ) ); @@ -582,7 +582,7 @@ void QgsSymbolV2SelectorDialog::moveLayerUp() void QgsSymbolV2SelectorDialog::moveLayerByOffset( int offset ) { SymbolLayerItem *item = currentLayerItem(); - if ( item == NULL ) + if ( item == nullptr ) return; int row = item->row(); diff --git a/src/gui/symbology-ng/qgssymbolv2selectordialog.h b/src/gui/symbology-ng/qgssymbolv2selectordialog.h index 2bc4819e33f..1220d3b8d40 100644 --- a/src/gui/symbology-ng/qgssymbolv2selectordialog.h +++ b/src/gui/symbology-ng/qgssymbolv2selectordialog.h @@ -76,7 +76,7 @@ class GUI_EXPORT QgsSymbolV2SelectorDialog : public QDialog, private Ui::QgsSymb Q_OBJECT public: - QgsSymbolV2SelectorDialog( QgsSymbolV2* symbol, QgsStyleV2* style, const QgsVectorLayer* vl, QWidget* parent = 0, bool embedded = false ); + QgsSymbolV2SelectorDialog( QgsSymbolV2* symbol, QgsStyleV2* style, const QgsVectorLayer* vl, QWidget* parent = nullptr, bool embedded = false ); ~QgsSymbolV2SelectorDialog(); //! return menu for "advanced" button - create it if doesn't exist and show the advanced button diff --git a/src/gui/symbology-ng/qgsvectorcolorbrewercolorrampv2dialog.h b/src/gui/symbology-ng/qgsvectorcolorbrewercolorrampv2dialog.h index f6f38cf56cf..4a76e824ff9 100644 --- a/src/gui/symbology-ng/qgsvectorcolorbrewercolorrampv2dialog.h +++ b/src/gui/symbology-ng/qgsvectorcolorbrewercolorrampv2dialog.h @@ -27,7 +27,7 @@ class GUI_EXPORT QgsVectorColorBrewerColorRampV2Dialog : public QDialog, private Q_OBJECT public: - QgsVectorColorBrewerColorRampV2Dialog( QgsVectorColorBrewerColorRampV2* ramp, QWidget* parent = NULL ); + QgsVectorColorBrewerColorRampV2Dialog( QgsVectorColorBrewerColorRampV2* ramp, QWidget* parent = nullptr ); public slots: void setSchemeName(); diff --git a/src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.cpp b/src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.cpp index 76ac6ffeed4..e37367a1712 100644 --- a/src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.cpp +++ b/src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.cpp @@ -16,7 +16,7 @@ #include "qgsvectorfieldsymbollayer.h" #include "qgsvectorlayer.h" -QgsVectorFieldSymbolLayerWidget::QgsVectorFieldSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent ): QgsSymbolLayerV2Widget( parent, vl ), mLayer( 0 ) +QgsVectorFieldSymbolLayerWidget::QgsVectorFieldSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent ): QgsSymbolLayerV2Widget( parent, vl ), mLayer( nullptr ) { setupUi( this ); diff --git a/src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.h b/src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.h index f92c5a2c4a9..f359babda8c 100644 --- a/src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.h +++ b/src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.h @@ -24,7 +24,7 @@ class GUI_EXPORT QgsVectorFieldSymbolLayerWidget: public QgsSymbolLayerV2Widget, { Q_OBJECT public: - QgsVectorFieldSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = 0 ); + QgsVectorFieldSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = nullptr ); ~QgsVectorFieldSymbolLayerWidget(); static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { return new QgsVectorFieldSymbolLayerWidget( vl ); } diff --git a/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp b/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp index 3eed0d084e6..343ab40d4d4 100644 --- a/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp +++ b/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp @@ -28,7 +28,7 @@ #include QgsVectorGradientColorRampV2Dialog::QgsVectorGradientColorRampV2Dialog( QgsVectorGradientColorRampV2* ramp, QWidget* parent ) - : QDialog( parent ), mRamp( ramp ), mCurrentItem( 0 ) + : QDialog( parent ), mRamp( ramp ), mCurrentItem( nullptr ) { setupUi( this ); #ifdef Q_OS_MAC @@ -91,7 +91,7 @@ void QgsVectorGradientColorRampV2Dialog::on_btnInformation_pressed() return; QgsDialog *dlg = new QgsDialog( this ); - QLabel *label = 0; + QLabel *label = nullptr; // information table QTableWidget *tableInfo = new QTableWidget( dlg ); @@ -295,7 +295,7 @@ void QgsVectorGradientColorRampV2Dialog::stopDoubleClicked( QTreeWidgetItem* ite item->data( 0, StopColorRole ).value(), this, SLOT( setItemStopColor( const QColor& ) ), this, tr( "Edit Stop Color" ), true ); } - mCurrentItem = 0; + mCurrentItem = nullptr; } else { diff --git a/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.h b/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.h index e0e9801c53f..41e4ed8f265 100644 --- a/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.h +++ b/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.h @@ -27,7 +27,7 @@ class GUI_EXPORT QgsVectorGradientColorRampV2Dialog : public QDialog, private Ui Q_OBJECT public: - QgsVectorGradientColorRampV2Dialog( QgsVectorGradientColorRampV2* ramp, QWidget* parent = NULL ); + QgsVectorGradientColorRampV2Dialog( QgsVectorGradientColorRampV2* ramp, QWidget* parent = nullptr ); public slots: void setColor1( const QColor& color ); diff --git a/src/gui/symbology-ng/qgsvectorrandomcolorrampv2dialog.h b/src/gui/symbology-ng/qgsvectorrandomcolorrampv2dialog.h index 1edfd142058..8506aef46ec 100644 --- a/src/gui/symbology-ng/qgsvectorrandomcolorrampv2dialog.h +++ b/src/gui/symbology-ng/qgsvectorrandomcolorrampv2dialog.h @@ -27,7 +27,7 @@ class GUI_EXPORT QgsVectorRandomColorRampV2Dialog : public QDialog, private Ui:: Q_OBJECT public: - QgsVectorRandomColorRampV2Dialog( QgsVectorRandomColorRampV2* ramp, QWidget* parent = NULL ); + QgsVectorRandomColorRampV2Dialog( QgsVectorRandomColorRampV2* ramp, QWidget* parent = nullptr ); public slots: void setCount( int val ); diff --git a/src/helpviewer/main.cpp b/src/helpviewer/main.cpp index 8f687f8e45f..9f6528b4390 100644 --- a/src/helpviewer/main.cpp +++ b/src/helpviewer/main.cpp @@ -70,7 +70,7 @@ int main( int argc, char ** argv ) /* Translation file for QGIS. */ - QTranslator qgistor( 0 ); + QTranslator qgistor( nullptr ); if ( qgistor.load( QString( "qgis_" ) + myTranslationCode, i18nPath ) ) { a.installTranslator( &qgistor ); @@ -81,7 +81,7 @@ int main( int argc, char ** argv ) * the About, Preferences and Quit items to the Mac Application menu. * These items must be translated identically in both qt_ and qgis_ files. */ - QTranslator qttor( 0 ); + QTranslator qttor( nullptr ); if ( qttor.load( QString( "qt_" ) + myTranslationCode, QLibraryInfo::location( QLibraryInfo::TranslationsPath ) ) ) { a.installTranslator( &qttor ); diff --git a/src/helpviewer/qgshelpviewer.h b/src/helpviewer/qgshelpviewer.h index 57501148114..2b4d390deda 100644 --- a/src/helpviewer/qgshelpviewer.h +++ b/src/helpviewer/qgshelpviewer.h @@ -44,7 +44,7 @@ class QgsHelpViewer : public QDialog, private Ui::QgsHelpViewerBase { Q_OBJECT public: - QgsHelpViewer( QWidget *parent = 0, const Qt::WindowFlags& = 0 ); + QgsHelpViewer( QWidget *parent = nullptr, const Qt::WindowFlags& = nullptr ); ~QgsHelpViewer(); public slots: void showHelp( const QString& ); diff --git a/src/plugins/coordinate_capture/coordinatecapture.cpp b/src/plugins/coordinate_capture/coordinatecapture.cpp index f2396e21b02..1db69b0618b 100644 --- a/src/plugins/coordinate_capture/coordinatecapture.cpp +++ b/src/plugins/coordinate_capture/coordinatecapture.cpp @@ -68,15 +68,15 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI; */ CoordinateCapture::CoordinateCapture( QgisInterface * theQgisInterface ) : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) - , mpMapTool( NULL ) - , mpTrackMouseButton( NULL ) - , mpCaptureButton( NULL ) - , mypUserCrsToolButton( NULL ) - , mypCRSLabel( NULL ) + , mpMapTool( nullptr ) + , mpTrackMouseButton( nullptr ) + , mpCaptureButton( nullptr ) + , mypUserCrsToolButton( nullptr ) + , mypCRSLabel( nullptr ) , mCanvasDisplayPrecision( 5 ) , mUserCrsDisplayPrecision( 5 ) , mQGisIface( theQgisInterface ) - , mQActionPointer( NULL ) + , mQActionPointer( nullptr ) { } @@ -272,11 +272,11 @@ void CoordinateCapture::unload() mQGisIface->removeVectorToolBarIcon( mQActionPointer ); mpMapTool->deactivate(); delete mpMapTool; - mpMapTool = 0; + mpMapTool = nullptr; delete mpDockWidget; - mpDockWidget = 0; + mpDockWidget = nullptr; delete mQActionPointer; - mQActionPointer = 0; + mQActionPointer = nullptr; } // Set icons to the current theme diff --git a/src/plugins/coordinate_capture/coordinatecapturegui.h b/src/plugins/coordinate_capture/coordinatecapturegui.h index 9a3e67abb6b..9989ef807af 100644 --- a/src/plugins/coordinate_capture/coordinatecapturegui.h +++ b/src/plugins/coordinate_capture/coordinatecapturegui.h @@ -23,7 +23,7 @@ class CoordinateCaptureGui : public QDialog Q_OBJECT public: - CoordinateCaptureGui( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); + CoordinateCaptureGui( QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr ); ~CoordinateCaptureGui(); private slots: diff --git a/src/plugins/coordinate_capture/coordinatecapturemaptool.cpp b/src/plugins/coordinate_capture/coordinatecapturemaptool.cpp index 3f282d9ca09..474c49aa48a 100644 --- a/src/plugins/coordinate_capture/coordinatecapturemaptool.cpp +++ b/src/plugins/coordinate_capture/coordinatecapturemaptool.cpp @@ -40,7 +40,7 @@ CoordinateCaptureMapTool::CoordinateCaptureMapTool( QgsMapCanvas* thepCanvas ) CoordinateCaptureMapTool::~CoordinateCaptureMapTool() { - if ( mpRubberBand != 0 ) + if ( mpRubberBand != nullptr ) delete mpRubberBand; } diff --git a/src/plugins/dxf2shp_converter/builder.cpp b/src/plugins/dxf2shp_converter/builder.cpp index 6c97e3cdd16..0dd42bf8bdf 100644 --- a/src/plugins/dxf2shp_converter/builder.cpp +++ b/src/plugins/dxf2shp_converter/builder.cpp @@ -83,7 +83,7 @@ void Builder::addPoint( const DL_PointData& data ) } double x = data.x, y = data.y, z = data.z; - shpObjects << SHPCreateObject( shapefileType, shpObjects.size(), 0, NULL, NULL, 1, &x, &y, &z, NULL ); + shpObjects << SHPCreateObject( shapefileType, shpObjects.size(), 0, nullptr, nullptr, 1, &x, &y, &z, nullptr ); } void Builder::addLine( const DL_LineData& data ) @@ -112,7 +112,7 @@ void Builder::addLine( const DL_LineData& data ) double yv[2] = { data.y1, data.y2 }; double zv[2] = { data.z1, data.z2 }; - shpObjects << SHPCreateObject( shapefileType, shpObjects.size(), 0, NULL, NULL, 2, xv, yv, zv, NULL ); + shpObjects << SHPCreateObject( shapefileType, shpObjects.size(), 0, nullptr, nullptr, 2, xv, yv, zv, nullptr ); } @@ -160,7 +160,7 @@ void Builder::addPolyline( const DL_PolylineData& data ) zv[i] = polyVertex[i].z; } - shpObjects << SHPCreateObject( shapefileType, shpObjects.size(), 0, NULL, NULL, dim, xv.data(), yv.data(), zv.data(), NULL ); + shpObjects << SHPCreateObject( shapefileType, shpObjects.size(), 0, nullptr, nullptr, dim, xv.data(), yv.data(), zv.data(), nullptr ); polyVertex.clear(); @@ -289,7 +289,7 @@ void Builder::addArc( const DL_ArcData& data ) } - shpObjects << SHPCreateObject( shapefileType, shpObjects.size(), 0, NULL, NULL, dim, xv.data(), yv.data(), zv.data(), NULL ); + shpObjects << SHPCreateObject( shapefileType, shpObjects.size(), 0, nullptr, nullptr, dim, xv.data(), yv.data(), zv.data(), nullptr ); arcPoints.clear(); } @@ -337,7 +337,7 @@ void Builder::addCircle( const DL_CircleData& data ) zv[i] = circlePoints[i].z; } - shpObjects << SHPCreateObject( shapefileType, shpObjects.size(), 0, NULL, NULL, dim, xv.data(), yv.data(), zv.data(), NULL ); + shpObjects << SHPCreateObject( shapefileType, shpObjects.size(), 0, nullptr, nullptr, dim, xv.data(), yv.data(), zv.data(), nullptr ); circlePoints.clear(); } @@ -395,7 +395,7 @@ void Builder::FinalizeAnyPolyline() zv[i] = polyVertex[i].z; } - shpObjects << SHPCreateObject( shapefileType, shpObjects.size(), 0, NULL, NULL, dim, xv.data(), yv.data(), zv.data(), NULL ); + shpObjects << SHPCreateObject( shapefileType, shpObjects.size(), 0, nullptr, nullptr, dim, xv.data(), yv.data(), zv.data(), nullptr ); polyVertex.clear(); QgsDebugMsg( QString( "Finalized adding of polyline shape %1" ).arg( shpObjects.size() - 1 ) ); @@ -477,7 +477,7 @@ void Builder::print_shpObjects() double x = textObjects[i].ipx; double y = textObjects[i].ipy; double z = textObjects[i].ipz; - psObject = SHPCreateObject( SHPT_POINT, i, 0, NULL, NULL, 1, &x, &y, &z, NULL ); + psObject = SHPCreateObject( SHPT_POINT, i, 0, nullptr, nullptr, 1, &x, &y, &z, nullptr ); SHPWriteObject( thSHP, -1, psObject ); @@ -537,7 +537,7 @@ void Builder::print_shpObjects() double &x = insertObjects[i].ipx; double &y = insertObjects[i].ipy; double &z = insertObjects[i].ipz; - psObject = SHPCreateObject( SHPT_POINT, i, 0, NULL, NULL, 1, &x, &y, &z, NULL ); + psObject = SHPCreateObject( SHPT_POINT, i, 0, nullptr, nullptr, 1, &x, &y, &z, nullptr ); SHPWriteObject( ihSHP, -1, psObject ); diff --git a/src/plugins/dxf2shp_converter/dxf2shpconverter.cpp b/src/plugins/dxf2shp_converter/dxf2shpconverter.cpp index 1890c9f3f8f..492bf1ca256 100644 --- a/src/plugins/dxf2shp_converter/dxf2shpconverter.cpp +++ b/src/plugins/dxf2shp_converter/dxf2shpconverter.cpp @@ -54,7 +54,7 @@ static const QString sPluginIcon = ":/dxf2shp_converter.png"; dxf2shpConverter::dxf2shpConverter( QgisInterface *theQgisInterface ) : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) , mQGisIface( theQgisInterface ) - , mQActionPointer( 0 ) + , mQActionPointer( nullptr ) {} dxf2shpConverter::~dxf2shpConverter() @@ -119,7 +119,7 @@ void dxf2shpConverter::unload() mQGisIface->removePluginVectorMenu( tr( "&Dxf2Shp" ), mQActionPointer ); mQGisIface->removeVectorToolBarIcon( mQActionPointer ); delete mQActionPointer; - mQActionPointer = 0; + mQActionPointer = nullptr; } void dxf2shpConverter::addMyLayer( const QString& myfname, const QString& mytitle ) diff --git a/src/plugins/dxf2shp_converter/dxf2shpconvertergui.h b/src/plugins/dxf2shp_converter/dxf2shpconvertergui.h index 6385f15638f..e20242b258f 100644 --- a/src/plugins/dxf2shp_converter/dxf2shpconvertergui.h +++ b/src/plugins/dxf2shp_converter/dxf2shpconvertergui.h @@ -26,7 +26,7 @@ class dxf2shpConverterGui: public QDialog, private Ui::dxf2shpConverterGui Q_OBJECT public: - dxf2shpConverterGui( QWidget *parent = 0, Qt::WindowFlags fl = 0 ); + dxf2shpConverterGui( QWidget *parent = nullptr, Qt::WindowFlags fl = nullptr ); ~dxf2shpConverterGui(); private: diff --git a/src/plugins/dxf2shp_converter/dxflib/src/dl_dxf.cpp b/src/plugins/dxf2shp_converter/dxflib/src/dl_dxf.cpp index 1c457f77a6d..c16a526d8a3 100644 --- a/src/plugins/dxf2shp_converter/dxflib/src/dl_dxf.cpp +++ b/src/plugins/dxf2shp_converter/dxflib/src/dl_dxf.cpp @@ -43,26 +43,26 @@ DL_Dxf::DL_Dxf() { version = DL_VERSION_2000; - vertices = NULL; + vertices = nullptr; maxVertices = 0; vertexIndex = 0; - knots = NULL; + knots = nullptr; maxKnots = 0; knotIndex = 0; - weights = NULL; + weights = nullptr; weightIndex = 0; - controlPoints = NULL; + controlPoints = nullptr; maxControlPoints = 0; controlPointIndex = 0; - fitPoints = NULL; + fitPoints = nullptr; maxFitPoints = 0; fitPointIndex = 0; - leaderVertices = NULL; + leaderVertices = nullptr; maxLeaderVertices = 0; leaderVertexIndex = 0; } @@ -73,22 +73,22 @@ DL_Dxf::DL_Dxf() { * Destructor. */ DL_Dxf::~DL_Dxf() { - if (vertices!=NULL) { + if (vertices!=nullptr) { delete[] vertices; } - if (knots!=NULL) { + if (knots!=nullptr) { delete[] knots; } - if (controlPoints!=NULL) { + if (controlPoints!=nullptr) { delete[] controlPoints; } - if (fitPoints!=NULL) { + if (fitPoints!=nullptr) { delete[] fitPoints; } - if (weights!=NULL) { + if (weights!=nullptr) { delete[] weights; } - if (leaderVertices!=NULL) { + if (leaderVertices!=nullptr) { delete[] leaderVertices; } } @@ -238,7 +238,7 @@ bool DL_Dxf::getStrippedLine(std::string& s, unsigned int size, FILE *fp) { line = fgets(wholeLine, size, fp); - if (line!=NULL && line[0] != '\0') { // Evaluates to fgets() retval + if (line!=nullptr && line[0] != '\0') { // Evaluates to fgets() retval // line == wholeLine at this point. // Both guaranteed to be NULL terminated. @@ -1416,7 +1416,7 @@ bool DL_Dxf::handleLWPolylineData(DL_CreationInterface* /*creationInterface*/) { if (groupCode==90) { maxVertices = toInt(groupValue); if (maxVertices>0) { - if (vertices!=NULL) { + if (vertices!=nullptr) { delete[] vertices; } vertices = new double[4*maxVertices]; @@ -1461,7 +1461,7 @@ bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/) { if (groupCode==72) { maxKnots = toInt(groupValue); if (maxKnots>0) { - if (knots!=NULL) { + if (knots!=nullptr) { delete[] knots; } knots = new double[maxKnots]; @@ -1477,10 +1477,10 @@ bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/) { else if (groupCode==73) { maxControlPoints = toInt(groupValue); if (maxControlPoints>0) { - if (controlPoints!=NULL) { + if (controlPoints!=nullptr) { delete[] controlPoints; } - if (weights!=NULL) { + if (weights!=nullptr) { delete[] weights; } controlPoints = new double[3*maxControlPoints]; @@ -1501,7 +1501,7 @@ bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/) { else if (groupCode==74) { maxFitPoints = toInt(groupValue); if (maxFitPoints>0) { - if (fitPoints!=NULL) { + if (fitPoints!=nullptr) { delete[] fitPoints; } fitPoints = new double[3*maxFitPoints]; @@ -1575,7 +1575,7 @@ bool DL_Dxf::handleLeaderData(DL_CreationInterface* /*creationInterface*/) { if (groupCode==76) { maxLeaderVertices = toInt(groupValue); if (maxLeaderVertices>0) { - if (leaderVertices!=NULL) { + if (leaderVertices!=nullptr) { delete[] leaderVertices; } leaderVertices = new double[3*maxLeaderVertices]; @@ -2272,7 +2272,7 @@ DL_WriterA* DL_Dxf::out(const char* file, DL_Codes::version version) { if (dw->openFailed()) { delete dw; delete[] f; - return NULL; + return nullptr; } else { delete[] f; return dw; diff --git a/src/plugins/dxf2shp_converter/dxflib/src/dl_entities.h b/src/plugins/dxf2shp_converter/dxflib/src/dl_entities.h index 317324c7a8e..a653df40a22 100644 --- a/src/plugins/dxf2shp_converter/dxflib/src/dl_entities.h +++ b/src/plugins/dxf2shp_converter/dxflib/src/dl_entities.h @@ -97,7 +97,7 @@ struct DXFLIB_EXPORT DL_LinetypeData { int flags, int numberOfDashes, double patternLength, - double* pattern = NULL + double* pattern = nullptr ) : name(name), description(description), diff --git a/src/plugins/evis/databaseconnection/evisdatabaseconnection.cpp b/src/plugins/evis/databaseconnection/evisdatabaseconnection.cpp index 7e1506f5b81..cc544d8f777 100644 --- a/src/plugins/evis/databaseconnection/evisdatabaseconnection.cpp +++ b/src/plugins/evis/databaseconnection/evisdatabaseconnection.cpp @@ -177,12 +177,12 @@ QSqlQuery* eVisDatabaseConnection::query( const QString& sqlStatement ) else { setLastError( mQuery.lastError().text() ); - return 0; + return nullptr; } } setLastError( "Database connection was not open." ); - return 0; + return nullptr; } /** diff --git a/src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.cpp b/src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.cpp index 54cdaed8c9d..c35ace7526f 100644 --- a/src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.cpp +++ b/src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.cpp @@ -58,7 +58,7 @@ eVisDatabaseConnectionGui::eVisDatabaseConnectionGui( QList* th //Initialize varaibles mQueryDefinitionMap = new QMap; - mDatabaseConnection = 0; + mDatabaseConnection = nullptr; //Create a new instance of the file selector mDatabaseLayerFieldSelector = new eVisDatabaseLayerFieldSelectionGui( this, fl ); @@ -129,18 +129,18 @@ void eVisDatabaseConnectionGui::drawNewVectorLayer( const QString& layerName, co void eVisDatabaseConnectionGui::on_buttonBox_accepted() { //Deallocate memory, basically a predescructor - if ( 0 != mDatabaseConnection ) + if ( nullptr != mDatabaseConnection ) { mDatabaseConnection->close(); delete( mDatabaseConnection ); } - if ( 0 != mDatabaseLayerFieldSelector ) + if ( nullptr != mDatabaseLayerFieldSelector ) { delete( mDatabaseLayerFieldSelector ); } - if ( 0 != mQueryDefinitionMap ) + if ( nullptr != mQueryDefinitionMap ) { mQueryDefinitionMap->clear(); delete mQueryDefinitionMap; @@ -273,7 +273,7 @@ void eVisDatabaseConnectionGui::on_pbtnConnect_clicked() } //If there is aready a database connection object, reset with the current parameters - if ( 0 != mDatabaseConnection ) + if ( nullptr != mDatabaseConnection ) { mDatabaseConnection->resetConnectionParameters( leDatabaseHost->text(), leDatabasePort->text().toInt(), leDatabaseName->text(), leDatabaseUsername->text(), leDatabasePassword->text(), myDatabaseType ); } @@ -467,11 +467,11 @@ void eVisDatabaseConnectionGui::on_pbtnRunQuery_clicked() if ( !teditSqlStatement->toPlainText().isEmpty() ) { //Verify that we have an active database connection - if ( 0 != mDatabaseConnection ) + if ( nullptr != mDatabaseConnection ) { //Execute query QSqlQuery* myResults = mDatabaseConnection->query( teditSqlStatement->toPlainText() ); - if ( 0 == myResults ) + if ( nullptr == myResults ) { teditConsole->append( tr( "Error: Query failed: %1" ).arg( mDatabaseConnection->lastError() ) ); } diff --git a/src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.h b/src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.h index 1bd98936445..b93db27e94f 100644 --- a/src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.h +++ b/src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.h @@ -50,7 +50,7 @@ class eVisDatabaseConnectionGui : public QDialog, private Ui::eVisDatabaseConnec public: /** \brief Constructor */ - eVisDatabaseConnectionGui( QList*, QWidget* parent = 0, Qt::WindowFlags fl = 0 ); + eVisDatabaseConnectionGui( QList*, QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr ); /** \brief Destructor */ ~eVisDatabaseConnectionGui(); diff --git a/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp b/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp index 05752a29d6b..d41058ec9e1 100644 --- a/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp +++ b/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp @@ -60,9 +60,9 @@ eVisGenericEventBrowserGui::eVisGenericEventBrowserGui( QWidget* parent, QgisInt mCurrentFeatureIndex = 0; mInterface = interface; - mDataProvider = 0; - mVectorLayer = 0; - mCanvas = 0; + mDataProvider = nullptr; + mVectorLayer = nullptr; + mCanvas = nullptr; mIgnoreEvent = false; @@ -89,9 +89,9 @@ eVisGenericEventBrowserGui::eVisGenericEventBrowserGui( QWidget* parent, QgsMapC setupUi( this ); mCurrentFeatureIndex = 0; - mInterface = 0; - mDataProvider = 0; - mVectorLayer = 0; + mInterface = nullptr; + mDataProvider = nullptr; + mVectorLayer = nullptr; mCanvas = canvas; mIgnoreEvent = false; @@ -117,14 +117,14 @@ eVisGenericEventBrowserGui::~eVisGenericEventBrowserGui() settings.setValue( "/eVis/browser-geometry", saveGeometry() ); //Clean up, disconnect the highlighting routine and refesh the canvase to clear highlighting symbol - if ( 0 != mCanvas ) + if ( nullptr != mCanvas ) { disconnect( mCanvas, SIGNAL( renderComplete( QPainter * ) ), this, SLOT( renderSymbol( QPainter * ) ) ); mCanvas->refresh(); } //On close, clear selected feature - if ( 0 != mVectorLayer ) + if ( nullptr != mVectorLayer ) { mVectorLayer->removeSelection(); } @@ -199,7 +199,7 @@ bool eVisGenericEventBrowserGui::initBrowser() pbtnDeleteFileType->setIcon( QIcon( QPixmap( myThemePath + "/mActionDeleteAttribute.png" ) ) ); //Check to for interface, not null when launched from plugin toolbar, otherwise expect map canvas - if ( 0 != mInterface ) + if ( nullptr != mInterface ) { //check for active layer if ( mInterface->activeLayer() ) @@ -223,7 +223,7 @@ bool eVisGenericEventBrowserGui::initBrowser() } } //check for map canvas, if map canvas is null, throw error - else if ( 0 != mCanvas ) + else if ( nullptr != mCanvas ) { //check for active layer if ( mCanvas->currentLayer() ) @@ -468,7 +468,7 @@ void eVisGenericEventBrowserGui::accept() while ( myIterator < tableFileTypeAssociations->rowCount() ) { myQSettings.setArrayIndex( myIndex ); - if ( 0 != tableFileTypeAssociations->item( myIterator, 0 ) && 0 != tableFileTypeAssociations->item( myIterator, 1 ) ) + if ( nullptr != tableFileTypeAssociations->item( myIterator, 0 ) && nullptr != tableFileTypeAssociations->item( myIterator, 1 ) ) { myQSettings.setValue( "extension", tableFileTypeAssociations->item( myIterator, 0 )->text() ); myQSettings.setValue( "application", tableFileTypeAssociations->item( myIterator, 1 )->text() ); @@ -540,7 +540,7 @@ void eVisGenericEventBrowserGui::displayImage() //get a copy of the feature QgsFeature* myFeature = featureAtId( mFeatureIds.at( mCurrentFeatureIndex ) ); - if ( 0 == myFeature ) + if ( nullptr == myFeature ) return; QgsPoint myPoint = myFeature->constGeometry()->asPoint(); @@ -570,7 +570,7 @@ QgsFeature* eVisGenericEventBrowserGui::featureAtId( QgsFeatureId id ) { if ( !mVectorLayer->getFeatures( QgsFeatureRequest().setFilterFid( id ) ).nextFeature( mFeature ) ) { - return 0; + return nullptr; } } @@ -588,7 +588,7 @@ void eVisGenericEventBrowserGui::loadRecord() QgsFeature* myFeature; myFeature = featureAtId( mFeatureIds.at( mCurrentFeatureIndex ) ); - if ( 0 == myFeature ) + if ( nullptr == myFeature ) return; QString myCompassBearingField = cboxCompassBearingField->currentText(); @@ -839,7 +839,7 @@ void eVisGenericEventBrowserGui::on_cboxEventImagePathField_currentIndexChanged( const QgsFields& myFields = mDataProvider->fields(); QgsFeature* myFeature = featureAtId( mFeatureIds.at( mCurrentFeatureIndex ) ); - if ( 0 == myFeature ) + if ( nullptr == myFeature ) return; QgsAttributes myAttrs = myFeature->attributes(); @@ -867,7 +867,7 @@ void eVisGenericEventBrowserGui::on_cboxCompassBearingField_currentIndexChanged( const QgsFields& myFields = mDataProvider->fields(); QgsFeature* myFeature = featureAtId( mFeatureIds.at( mCurrentFeatureIndex ) ); - if ( 0 == myFeature ) + if ( nullptr == myFeature ) return; QgsAttributes myAttrs = myFeature->attributes(); @@ -895,7 +895,7 @@ void eVisGenericEventBrowserGui::on_cboxCompassOffsetField_currentIndexChanged( const QgsFields& myFields = mDataProvider->fields(); QgsFeature* myFeature = featureAtId( mFeatureIds.at( mCurrentFeatureIndex ) ); - if ( 0 == myFeature ) + if ( nullptr == myFeature ) return; QgsAttributes myAttrs = myFeature->attributes(); @@ -1118,12 +1118,12 @@ void eVisGenericEventBrowserGui::on_tableFileTypeAssociations_cellDoubleClicked( void eVisGenericEventBrowserGui::renderSymbol( QPainter* thePainter ) { - if ( !mFeatureIds.isEmpty() && mVectorLayer != 0 ) + if ( !mFeatureIds.isEmpty() && mVectorLayer != nullptr ) { //Get a pointer to the current feature QgsFeature* myFeature = featureAtId( mFeatureIds.at( mCurrentFeatureIndex ) ); - if ( 0 == myFeature ) + if ( nullptr == myFeature ) return; QgsPoint myPoint = myFeature->constGeometry()->asPoint(); diff --git a/src/plugins/evis/eventbrowser/evisimagedisplaywidget.cpp b/src/plugins/evis/eventbrowser/evisimagedisplaywidget.cpp index 2262960a8e8..73a53ead28c 100644 --- a/src/plugins/evis/eventbrowser/evisimagedisplaywidget.cpp +++ b/src/plugins/evis/eventbrowser/evisimagedisplaywidget.cpp @@ -140,7 +140,7 @@ void eVisImageDisplayWidget::resizeEvent( QResizeEvent *event ) */ void eVisImageDisplayWidget::displayImage( const QString& path ) { - mImageLoaded = mImage->load( path, 0, Qt::AutoColor ); + mImageLoaded = mImage->load( path, nullptr, Qt::AutoColor ); setToolTip( path ); mCurrentZoomStep = 0; diff --git a/src/plugins/evis/eventbrowser/evisimagedisplaywidget.h b/src/plugins/evis/eventbrowser/evisimagedisplaywidget.h index 4cef355fead..c1f1bec646a 100644 --- a/src/plugins/evis/eventbrowser/evisimagedisplaywidget.h +++ b/src/plugins/evis/eventbrowser/evisimagedisplaywidget.h @@ -53,7 +53,7 @@ class eVisImageDisplayWidget : public QWidget public: /** \brief Constructor */ - eVisImageDisplayWidget( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); + eVisImageDisplayWidget( QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr ); /** \brief Destructor */ ~eVisImageDisplayWidget(); diff --git a/src/plugins/evis/evis.cpp b/src/plugins/evis/evis.cpp index 4a6a1a2af96..fb77bea0715 100644 --- a/src/plugins/evis/evis.cpp +++ b/src/plugins/evis/evis.cpp @@ -85,11 +85,11 @@ static const QString sIcon = ":/evis/eVisEventBrowser.png"; eVis::eVis( QgisInterface * theQgisInterface ) : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) , mQGisIface( theQgisInterface ) - , mDatabaseConnectionActionPointer( 0 ) - , mEventIdToolActionPointer( 0 ) - , mEventBrowserActionPointer( 0 ) + , mDatabaseConnectionActionPointer( nullptr ) + , mEventIdToolActionPointer( nullptr ) + , mEventBrowserActionPointer( nullptr ) { - mIdTool = 0; + mIdTool = nullptr; } eVis::~eVis() @@ -150,7 +150,7 @@ void eVis::launchDatabaseConnection() void eVis::launchEventIdTool() { - if ( 0 == mIdTool ) + if ( nullptr == mIdTool ) { mIdTool = new eVisEventIdTool( mQGisIface->mapCanvas() ); mIdTool->setAction( mEventIdToolActionPointer ); @@ -187,7 +187,7 @@ void eVis::unload() delete( mTemporaryFileList.takeLast() ); } - if ( 0 != mIdTool ) + if ( nullptr != mIdTool ) { delete mIdTool; } diff --git a/src/plugins/evis/idtool/eviseventidtool.cpp b/src/plugins/evis/idtool/eviseventidtool.cpp index c58aff92876..c9ed9a1e3ba 100644 --- a/src/plugins/evis/idtool/eviseventidtool.cpp +++ b/src/plugins/evis/idtool/eviseventidtool.cpp @@ -42,14 +42,14 @@ */ eVisEventIdTool::eVisEventIdTool( QgsMapCanvas* theCanvas ) : QgsMapTool( theCanvas ) - , mBrowser( NULL ) + , mBrowser( nullptr ) { //set cursor QPixmap myIdentifyQPixmap = QPixmap(( const char ** ) identify_cursor ); mCursor = QCursor( myIdentifyQPixmap, 1, 1 ); //set the current tool to this object - if ( 0 != mCanvas ) + if ( nullptr != mCanvas ) { mCanvas->setMapTool( this ); } @@ -61,7 +61,7 @@ eVisEventIdTool::eVisEventIdTool( QgsMapCanvas* theCanvas ) */ void eVisEventIdTool::canvasReleaseEvent( QgsMapMouseEvent* theMouseEvent ) { - if ( 0 == mCanvas || 0 == theMouseEvent ) + if ( nullptr == mCanvas || nullptr == theMouseEvent ) return; //Check to see if there is a layer selected @@ -90,7 +90,7 @@ void eVisEventIdTool::canvasReleaseEvent( QgsMapMouseEvent* theMouseEvent ) void eVisEventIdTool::select( const QgsPoint& thePoint ) { - if ( 0 == mCanvas ) + if ( nullptr == mCanvas ) return; QgsVectorLayer* myLayer = ( QgsVectorLayer* )mCanvas->currentLayer(); @@ -120,6 +120,6 @@ void eVisEventIdTool::select( const QgsPoint& thePoint ) myLayer->setSelectedFeatures( newSelectedFeatures ); //Launch a new event browser to view selected features - mBrowser = new eVisGenericEventBrowserGui( mCanvas, mCanvas, NULL ); + mBrowser = new eVisGenericEventBrowserGui( mCanvas, mCanvas, nullptr ); mBrowser->setAttribute( Qt::WA_DeleteOnClose ); } diff --git a/src/plugins/geometry_checker/checks/qgsgeometryanglecheck.h b/src/plugins/geometry_checker/checks/qgsgeometryanglecheck.h index 2ee1c55e555..a9c5bdc43ec 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryanglecheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometryanglecheck.h @@ -17,7 +17,7 @@ class QgsGeometryAngleCheck : public QgsGeometryCheck public: QgsGeometryAngleCheck( QgsFeaturePool* featurePool, double minAngle ) : QgsGeometryCheck( FeatureNodeCheck, featurePool ), mMinAngle( minAngle ) {} - void collectErrors( QList& errors, QStringList& messages, QAtomicInt* progressCounter = 0, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; + void collectErrors( QList& errors, QStringList& messages, QAtomicInt* progressCounter = nullptr, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; void fixError( QgsGeometryCheckError* error, int method, int mergeAttributeIndex, Changes& changes ) const override; const QStringList& getResolutionMethods() const override; QString errorDescription() const override { return tr( "Minimal angle" ); } diff --git a/src/plugins/geometry_checker/checks/qgsgeometryareacheck.h b/src/plugins/geometry_checker/checks/qgsgeometryareacheck.h index 0e467ec4289..b7196495b4a 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryareacheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometryareacheck.h @@ -19,7 +19,7 @@ class QgsGeometryAreaCheck : public QgsGeometryCheck public: QgsGeometryAreaCheck( QgsFeaturePool* featurePool, double threshold ) : QgsGeometryCheck( FeatureCheck, featurePool ), mThreshold( threshold ) {} - void collectErrors( QList& errors, QStringList& messages, QAtomicInt* progressCounter = 0, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; + void collectErrors( QList& errors, QStringList& messages, QAtomicInt* progressCounter = nullptr, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; void fixError( QgsGeometryCheckError* error, int method, int mergeAttributeIndex, Changes& changes ) const override; const QStringList& getResolutionMethods() const override; QString errorDescription() const override { return tr( "Minimal area" ); } diff --git a/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp index 07497c944ed..9dca7bae6c7 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp +++ b/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp @@ -71,7 +71,7 @@ QgsAbstractGeometryV2 *QgsGeometryCheckError::geometry() QgsFeature f; if ( mCheck->getFeaturePool()->get( featureId(), f ) && f.geometry() ) return f.geometry()->geometry()->clone(); - return 0; + return nullptr; } bool QgsGeometryCheckError::handleChanges( const QgsGeometryCheck::Changes& changes ) diff --git a/src/plugins/geometry_checker/checks/qgsgeometrycheck.h b/src/plugins/geometry_checker/checks/qgsgeometrycheck.h index 84d0db81bc5..51c32ffe37b 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrycheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometrycheck.h @@ -62,7 +62,7 @@ class QgsGeometryCheck : public QObject QgsGeometryCheck( CheckType checkType, QgsFeaturePool* featurePool ) : mCheckType( checkType ), mFeaturePool( featurePool ) {} virtual ~QgsGeometryCheck() {} - virtual void collectErrors( QList& errors, QStringList& messages, QAtomicInt* progressCounter = 0, const QgsFeatureIds& ids = QgsFeatureIds() ) const = 0; + virtual void collectErrors( QList& errors, QStringList& messages, QAtomicInt* progressCounter = nullptr, const QgsFeatureIds& ids = QgsFeatureIds() ) const = 0; virtual void fixError( QgsGeometryCheckError* error, int method, int mergeAttributeIndex, Changes& changes ) const = 0; virtual const QStringList& getResolutionMethods() const = 0; virtual QString errorDescription() const = 0; diff --git a/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.h b/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.h index a79dba19072..25614a6251a 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.h @@ -40,7 +40,7 @@ class QgsGeometryContainedCheck : public QgsGeometryCheck public: explicit QgsGeometryContainedCheck( QgsFeaturePool* featurePool ) : QgsGeometryCheck( FeatureCheck, featurePool ) {} - void collectErrors( QList& errors, QStringList& messages, QAtomicInt* progressCounter = 0, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; + void collectErrors( QList& errors, QStringList& messages, QAtomicInt* progressCounter = nullptr, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; void fixError( QgsGeometryCheckError* error, int method, int mergeAttributeIndex, Changes& changes ) const override; const QStringList& getResolutionMethods() const override; QString errorDescription() const override { return tr( "Within" ); } diff --git a/src/plugins/geometry_checker/checks/qgsgeometrydegeneratepolygoncheck.h b/src/plugins/geometry_checker/checks/qgsgeometrydegeneratepolygoncheck.h index f29fd5b6ed5..c27cc93e013 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrydegeneratepolygoncheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometrydegeneratepolygoncheck.h @@ -17,7 +17,7 @@ class QgsGeometryDegeneratePolygonCheck : public QgsGeometryCheck public: explicit QgsGeometryDegeneratePolygonCheck( QgsFeaturePool* featurePool ) : QgsGeometryCheck( FeatureNodeCheck, featurePool ) {} - void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = 0, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; + void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = nullptr, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; void fixError( QgsGeometryCheckError* error, int method, int mergeAttributeIndex, Changes& changes ) const override; const QStringList& getResolutionMethods() const override; QString errorDescription() const override { return tr( "Polygon with less than three nodes" ); } diff --git a/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.h b/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.h index 73c0b759e33..407a59b0fe9 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.h @@ -49,7 +49,7 @@ class QgsGeometryDuplicateCheck : public QgsGeometryCheck public: explicit QgsGeometryDuplicateCheck( QgsFeaturePool* featurePool ) : QgsGeometryCheck( FeatureCheck, featurePool ) {} - void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = 0, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; + void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = nullptr, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; void fixError( QgsGeometryCheckError* error, int method, int mergeAttributeIndex, Changes& changes ) const override; const QStringList& getResolutionMethods() const override; QString errorDescription() const override { return tr( "Duplicate" ); } diff --git a/src/plugins/geometry_checker/checks/qgsgeometryduplicatenodescheck.h b/src/plugins/geometry_checker/checks/qgsgeometryduplicatenodescheck.h index d42c57904ff..ad83581e350 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryduplicatenodescheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometryduplicatenodescheck.h @@ -17,7 +17,7 @@ class QgsGeometryDuplicateNodesCheck : public QgsGeometryCheck public: explicit QgsGeometryDuplicateNodesCheck( QgsFeaturePool* featurePool ) : QgsGeometryCheck( FeatureNodeCheck, featurePool ) {} - void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = 0, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; + void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = nullptr, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; void fixError( QgsGeometryCheckError* error, int method, int mergeAttributeIndex, Changes& changes ) const override; const QStringList& getResolutionMethods() const override; QString errorDescription() const override { return tr( "Duplicate node" ); } diff --git a/src/plugins/geometry_checker/checks/qgsgeometrygapcheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometrygapcheck.cpp index b3d84ea3397..4093cc39021 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrygapcheck.cpp +++ b/src/plugins/geometry_checker/checks/qgsgeometrygapcheck.cpp @@ -33,7 +33,7 @@ void QgsGeometryGapCheck::collectErrors( QList& errors, return; } - QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( 0, QgsGeometryCheckPrecision::tolerance() ); + QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( nullptr, QgsGeometryCheckPrecision::tolerance() ); // Create union of geometry QString errMsg; diff --git a/src/plugins/geometry_checker/checks/qgsgeometrygapcheck.h b/src/plugins/geometry_checker/checks/qgsgeometrygapcheck.h index 831a60fffb6..b029ae817e9 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrygapcheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometrygapcheck.h @@ -79,7 +79,7 @@ class QgsGeometryGapCheck : public QgsGeometryCheck public: QgsGeometryGapCheck( QgsFeaturePool* featurePool, double threshold ) : QgsGeometryCheck( LayerCheck, featurePool ), mThreshold( threshold ) {} - void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = 0, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; + void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = nullptr, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; void fixError( QgsGeometryCheckError* error, int method, int mergeAttributeIndex, Changes& changes ) const override; const QStringList& getResolutionMethods() const override; QString errorDescription() const override { return tr( "Gap" ); } diff --git a/src/plugins/geometry_checker/checks/qgsgeometryholecheck.h b/src/plugins/geometry_checker/checks/qgsgeometryholecheck.h index f9e566bf3e3..b673438870f 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryholecheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometryholecheck.h @@ -17,7 +17,7 @@ class QgsGeometryHoleCheck : public QgsGeometryCheck public: explicit QgsGeometryHoleCheck( QgsFeaturePool* featurePool ) : QgsGeometryCheck( FeatureCheck, featurePool ) {} - void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = 0, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; + void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = nullptr, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; void fixError( QgsGeometryCheckError* error, int method, int mergeAttributeIndex, Changes& changes ) const override; const QStringList& getResolutionMethods() const override; QString errorDescription() const override { return tr( "Polygon with hole" ); } diff --git a/src/plugins/geometry_checker/checks/qgsgeometrymultipartcheck.h b/src/plugins/geometry_checker/checks/qgsgeometrymultipartcheck.h index 2306feb28d5..7dd7d277ca1 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrymultipartcheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometrymultipartcheck.h @@ -17,7 +17,7 @@ class QgsGeometryMultipartCheck : public QgsGeometryCheck public: explicit QgsGeometryMultipartCheck( QgsFeaturePool* featurePool ) : QgsGeometryCheck( FeatureCheck, featurePool ) {} - void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = 0, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; + void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = nullptr, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; void fixError( QgsGeometryCheckError* error, int method, int mergeAttributeIndex, Changes& changes ) const override; const QStringList& getResolutionMethods() const override; QString errorDescription() const override { return tr( "Multipart object with only one feature" ); } diff --git a/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.cpp index 0e393057130..7b5ae7ebd9f 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.cpp +++ b/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.cpp @@ -97,7 +97,7 @@ void QgsGeometryOverlapCheck::fixError( QgsGeometryCheckError* error, int method } // Search which overlap part this error parametrizes (using fuzzy-matching of the area and centroid...) - QgsAbstractGeometryV2* interPart = 0; + QgsAbstractGeometryV2* interPart = nullptr; for ( int iPart = 0, nParts = interGeom->partCount(); iPart < nParts; ++iPart ) { QgsAbstractGeometryV2* part = QgsGeomUtils::getGeomPart( interGeom, iPart ); @@ -128,7 +128,7 @@ void QgsGeometryOverlapCheck::fixError( QgsGeometryCheckError* error, int method if ( !diff1 || diff1->isEmpty() ) { delete diff1; - diff1 = 0; + diff1 = nullptr; } else { @@ -140,7 +140,7 @@ void QgsGeometryOverlapCheck::fixError( QgsGeometryCheckError* error, int method if ( !diff2 || diff2->isEmpty() ) { delete diff2; - diff2 = 0; + diff2 = nullptr; } else { diff --git a/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.h b/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.h index 6d9a721a915..44f53c7b48e 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.h @@ -50,7 +50,7 @@ class QgsGeometryOverlapCheck : public QgsGeometryCheck public: QgsGeometryOverlapCheck( QgsFeaturePool* featurePool, double threshold ) : QgsGeometryCheck( FeatureCheck, featurePool ), mThreshold( threshold ) {} - void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = 0, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; + void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = nullptr, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; void fixError( QgsGeometryCheckError* error, int method, int mergeAttributeIndex, Changes& changes ) const override; const QStringList& getResolutionMethods() const override; QString errorDescription() const override { return tr( "Overlap" ); } diff --git a/src/plugins/geometry_checker/checks/qgsgeometrysegmentlengthcheck.h b/src/plugins/geometry_checker/checks/qgsgeometrysegmentlengthcheck.h index f14db56155e..6f7cd081355 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrysegmentlengthcheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometrysegmentlengthcheck.h @@ -17,7 +17,7 @@ class QgsGeometrySegmentLengthCheck : public QgsGeometryCheck public: QgsGeometrySegmentLengthCheck( QgsFeaturePool* featurePool, double minLength ) : QgsGeometryCheck( FeatureNodeCheck, featurePool ), mMinLength( minLength ) {} - void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = 0, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; + void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = nullptr, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; void fixError( QgsGeometryCheckError* error, int method, int mergeAttributeIndex, Changes& changes ) const override; const QStringList& getResolutionMethods() const override; QString errorDescription() const override { return tr( "Minimal segment length" ); } diff --git a/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.h b/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.h index e9f779b2e0a..84f9debcdbb 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.h @@ -42,7 +42,7 @@ class QgsGeometrySelfIntersectionCheck : public QgsGeometryCheck public: explicit QgsGeometrySelfIntersectionCheck( QgsFeaturePool* featurePool ) : QgsGeometryCheck( FeatureNodeCheck, featurePool ) {} - void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = 0, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; + void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = nullptr, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; void fixError( QgsGeometryCheckError* error, int method, int mergeAttributeIndex, Changes& changes ) const override; const QStringList& getResolutionMethods() const override; QString errorDescription() const override { return tr( "Self intersection" ); } diff --git a/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.cpp index 892b7e93b1b..4b09169af6a 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.cpp +++ b/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.cpp @@ -80,7 +80,7 @@ void QgsGeometryTypeCheck::fixError( QgsGeometryCheckError* error, int method, i // Check if corresponding multi type is allowed else if ( QgsWKBTypes::isSingleType( type ) && (( 1 << QgsWKBTypes::multiType( type ) ) & mAllowedTypes ) != 0 ) { - QgsGeometryCollectionV2* geomCollection = 0; + QgsGeometryCollectionV2* geomCollection = nullptr; switch ( QgsWKBTypes::multiType( type ) ) { case QgsWKBTypes::MultiPoint: diff --git a/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.h b/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.h index e53e122c880..0e0d960fee7 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.h +++ b/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.h @@ -41,7 +41,7 @@ class QgsGeometryTypeCheck : public QgsGeometryCheck public: QgsGeometryTypeCheck( QgsFeaturePool* featurePool, int allowedTypes ) : QgsGeometryCheck( FeatureCheck, featurePool ), mAllowedTypes( allowedTypes ) {} - void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = 0, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; + void collectErrors( QList& errors, QStringList &messages, QAtomicInt* progressCounter = nullptr, const QgsFeatureIds& ids = QgsFeatureIds() ) const override; void fixError( QgsGeometryCheckError* error, int method, int mergeAttributeIndex, Changes& changes ) const override; const QStringList& getResolutionMethods() const override; QString errorDescription() const override { return tr( "Geometry type" ); } diff --git a/src/plugins/geometry_checker/qgsgeometrychecker.cpp b/src/plugins/geometry_checker/qgsgeometrychecker.cpp index 5da5bfc64e7..1bd957fc4ca 100644 --- a/src/plugins/geometry_checker/qgsgeometrychecker.cpp +++ b/src/plugins/geometry_checker/qgsgeometrychecker.cpp @@ -145,11 +145,11 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError* error, int method ) { if ( check->getCheckType() == QgsGeometryCheck::LayerCheck ) { - check->collectErrors( recheckErrors, mMessages, 0, recheckAreaFeatures ); + check->collectErrors( recheckErrors, mMessages, nullptr, recheckAreaFeatures ); } else { - check->collectErrors( recheckErrors, mMessages, 0, recheckFeatures ); + check->collectErrors( recheckErrors, mMessages, nullptr, recheckFeatures ); } } @@ -183,7 +183,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError* error, int method ) } // Check if this error now matches one found when rechecking the feature/area - QgsGeometryCheckError* matchErr = 0; + QgsGeometryCheckError* matchErr = nullptr; int nMatch = 0; Q_FOREACH ( QgsGeometryCheckError* recheckErr, recheckErrors ) { diff --git a/src/plugins/geometry_checker/qgsgeometrychecker.h b/src/plugins/geometry_checker/qgsgeometrychecker.h index 0f3bd40a17b..cf4a532712a 100644 --- a/src/plugins/geometry_checker/qgsgeometrychecker.h +++ b/src/plugins/geometry_checker/qgsgeometrychecker.h @@ -36,7 +36,7 @@ class QgsGeometryChecker : public QObject public: QgsGeometryChecker( const QList& checks, QgsFeaturePool* featurePool ); ~QgsGeometryChecker(); - QFuture execute( int* totalSteps = 0 ); + QFuture execute( int* totalSteps = nullptr ); bool fixError( QgsGeometryCheckError *error, int method ); const QList getChecks() const { return mChecks; } const QStringList& getMessages() const { return mMessages; } diff --git a/src/plugins/geometry_checker/qgsgeometrycheckerplugin.cpp b/src/plugins/geometry_checker/qgsgeometrycheckerplugin.cpp index 16159621bfb..dfef10665e3 100644 --- a/src/plugins/geometry_checker/qgsgeometrycheckerplugin.cpp +++ b/src/plugins/geometry_checker/qgsgeometrycheckerplugin.cpp @@ -21,8 +21,8 @@ QgsGeometryCheckerPlugin::QgsGeometryCheckerPlugin( QgisInterface* iface ) : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) , mIface( iface ) - , mDialog( 0 ) - , mMenuAction( 0 ) + , mDialog( nullptr ) + , mMenuAction( nullptr ) { } @@ -39,9 +39,9 @@ void QgsGeometryCheckerPlugin::initGui() void QgsGeometryCheckerPlugin::unload() { delete mDialog; - mDialog = 0; + mDialog = nullptr; delete mMenuAction; - mMenuAction = 0; + mMenuAction = nullptr; mIface->removePluginVectorMenu( QApplication::translate( "QgsGeometryCheckerPlugin", "G&eometry Tools" ), mMenuAction ); } diff --git a/src/plugins/geometry_checker/qgsgeometrycheckfactory.cpp b/src/plugins/geometry_checker/qgsgeometrycheckfactory.cpp index 6ff547d3029..a3357d9db8c 100644 --- a/src/plugins/geometry_checker/qgsgeometrycheckfactory.cpp +++ b/src/plugins/geometry_checker/qgsgeometrycheckfactory.cpp @@ -50,7 +50,7 @@ template<> QgsGeometryCheck* QgsGeometryCheckFactoryT::cr } else { - return 0; + return nullptr; } } @@ -80,7 +80,7 @@ template<> QgsGeometryCheck* QgsGeometryCheckFactoryT::cre } else { - return 0; + return nullptr; } } @@ -108,7 +108,7 @@ template<> QgsGeometryCheck* QgsGeometryCheckFactoryT } else { - return 0; + return nullptr; } } @@ -136,7 +136,7 @@ template<> QgsGeometryCheck* QgsGeometryCheckFactoryT QgsGeometryCheck* QgsGeometryCheckFactoryT } else { - return 0; + return nullptr; } } @@ -192,7 +192,7 @@ template<> QgsGeometryCheck* QgsGeometryCheckFactoryT QgsGeometryCheck* QgsGeometryCheckFactoryT::crea } else { - return 0; + return nullptr; } } @@ -251,7 +251,7 @@ template<> QgsGeometryCheck* QgsGeometryCheckFactoryT::cre } else { - return 0; + return nullptr; } } @@ -278,7 +278,7 @@ template<> QgsGeometryCheck* QgsGeometryCheckFactoryT } else { - return 0; + return nullptr; } } @@ -309,7 +309,7 @@ template<> QgsGeometryCheck* QgsGeometryCheckFactoryT:: } else { - return 0; + return nullptr; } } @@ -340,7 +340,7 @@ template<> QgsGeometryCheck* QgsGeometryCheckFactoryT QgsGeometryCheck* QgsGeometryCheckFactoryT QgsGeometryCheck* QgsGeometryCheckFactoryT QgsGeometryCheck* QgsGeometryCheckFactoryT::cre } else { - return 0; + return nullptr; } } diff --git a/src/plugins/geometry_checker/ui/qgsgeometrycheckerdialog.h b/src/plugins/geometry_checker/ui/qgsgeometrycheckerdialog.h index c51f7218c54..08019747b52 100644 --- a/src/plugins/geometry_checker/ui/qgsgeometrycheckerdialog.h +++ b/src/plugins/geometry_checker/ui/qgsgeometrycheckerdialog.h @@ -30,7 +30,7 @@ class QgsGeometryCheckerDialog : public QDialog { Q_OBJECT public: - QgsGeometryCheckerDialog( QgisInterface* iface, QWidget* parent = 0 ); + QgsGeometryCheckerDialog( QgisInterface* iface, QWidget* parent = nullptr ); ~QgsGeometryCheckerDialog(); private: diff --git a/src/plugins/geometry_checker/ui/qgsgeometrycheckerfixsummarydialog.h b/src/plugins/geometry_checker/ui/qgsgeometrycheckerfixsummarydialog.h index 8ee5398fab5..702df7137b4 100644 --- a/src/plugins/geometry_checker/ui/qgsgeometrycheckerfixsummarydialog.h +++ b/src/plugins/geometry_checker/ui/qgsgeometrycheckerfixsummarydialog.h @@ -41,7 +41,7 @@ class QgsGeometryCheckerFixSummaryDialog : public QDialog } }; - QgsGeometryCheckerFixSummaryDialog( QgisInterface *iface, QgsVectorLayer *layer, const Statistics& stats, const QStringList& messages, QWidget* parent = 0 ); + QgsGeometryCheckerFixSummaryDialog( QgisInterface *iface, QgsVectorLayer *layer, const Statistics& stats, const QStringList& messages, QWidget* parent = nullptr ); signals: void errorSelected( QgsGeometryCheckError* error ); diff --git a/src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.cpp b/src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.cpp index 77509adf5e5..667dbff2644 100644 --- a/src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.cpp +++ b/src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.cpp @@ -44,7 +44,7 @@ QgsGeometryCheckerResultTab::QgsGeometryCheckerResultTab( QgisInterface* iface, mErrorCount = 0; mFixedCount = 0; mCloseable = true; - mAttribTableDialog = 0; + mAttribTableDialog = nullptr; for ( int i = 0, n = mFeaturePool->getLayer()->fields().count(); i < n; ++i ) { @@ -333,7 +333,7 @@ void QgsGeometryCheckerResultTab::highlightErrors( bool current ) { // QgsGeometry above takes ownership of geometry and deletes it when it goes out of scope delete geometry; - geometry = 0; + geometry = nullptr; } if ( ui.radioButtonError->isChecked() || current || error->status() == QgsGeometryCheckError::StatusFixed ) diff --git a/src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.h b/src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.h index 97d6f315931..25fae449b02 100644 --- a/src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.h +++ b/src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.h @@ -32,7 +32,7 @@ class QgsGeometryCheckerResultTab : public QWidget { Q_OBJECT public: - QgsGeometryCheckerResultTab( QgisInterface* iface, QgsGeometryChecker* checker, QgsFeaturePool *featurePool, QTabWidget *tabWidget, QWidget* parent = 0 ); + QgsGeometryCheckerResultTab( QgisInterface* iface, QgsGeometryChecker* checker, QgsFeaturePool *featurePool, QTabWidget *tabWidget, QWidget* parent = nullptr ); ~QgsGeometryCheckerResultTab(); void showCheckMessages(); bool isCloseable() const { return mCloseable; } @@ -71,7 +71,7 @@ class QgsGeometryCheckerResultTab : public QWidget void setDefaultResolutionMethods(); void storeDefaultResolutionMethod( int ) const; void checkRemovedLayer( const QStringList &ids ); - void clearAttribTableDialog() { mAttribTableDialog = 0; } + void clearAttribTableDialog() { mAttribTableDialog = nullptr; } }; #endif // QGS_GEOMETRY_CHECKER_RESULT_TAB_H diff --git a/src/plugins/geometry_checker/ui/qgsgeometrycheckersetuptab.cpp b/src/plugins/geometry_checker/ui/qgsgeometrycheckersetuptab.cpp index dcf50fd2f06..09588607928 100644 --- a/src/plugins/geometry_checker/ui/qgsgeometrycheckersetuptab.cpp +++ b/src/plugins/geometry_checker/ui/qgsgeometrycheckersetuptab.cpp @@ -106,7 +106,7 @@ QgsVectorLayer* QgsGeometryCheckerSetupTab::getSelectedLayer() int inputIdx = ui.comboBoxInputLayer->currentIndex(); if ( inputIdx < 0 ) { - return 0; + return nullptr; } QgsVectorLayer *layer = dynamic_cast( ui.comboBoxInputLayer->currentLayer() ); return layer; @@ -116,7 +116,7 @@ void QgsGeometryCheckerSetupTab::validateInput() { QgsVectorLayer* layer = getSelectedLayer(); int nApplicable = 0; - if ( layer != 0 ) + if ( layer != nullptr ) { Q_FOREACH ( const QgsGeometryCheckFactory* factory, QgsGeometryCheckFactoryRegistry::getCheckFactories() ) { @@ -124,7 +124,7 @@ void QgsGeometryCheckerSetupTab::validateInput() } } bool outputOk = ui.radioButtonOuputModifyInput->isChecked() || !ui.lineEditOutput->text().isEmpty(); - mRunButton->setEnabled( layer != 0 && nApplicable > 0 && outputOk ); + mRunButton->setEnabled( layer != nullptr && nApplicable > 0 && outputOk ); } void QgsGeometryCheckerSetupTab::selectOutputFile() @@ -170,7 +170,7 @@ void QgsGeometryCheckerSetupTab::runChecks() { /** Get selected layer **/ QgsVectorLayer* layer = getSelectedLayer(); - if ( layer == 0 ) + if ( layer == nullptr ) { return; } diff --git a/src/plugins/geometry_checker/ui/qgsgeometrycheckersetuptab.h b/src/plugins/geometry_checker/ui/qgsgeometrycheckersetuptab.h index 4dce4ab573f..a0fdabf2bf2 100644 --- a/src/plugins/geometry_checker/ui/qgsgeometrycheckersetuptab.h +++ b/src/plugins/geometry_checker/ui/qgsgeometrycheckersetuptab.h @@ -31,7 +31,7 @@ class QgsGeometryCheckerSetupTab : public QWidget { Q_OBJECT public: - QgsGeometryCheckerSetupTab( QgisInterface * iface, QWidget* parent = 0 ); + QgsGeometryCheckerSetupTab( QgisInterface * iface, QWidget* parent = nullptr ); ~QgsGeometryCheckerSetupTab(); signals: diff --git a/src/plugins/geometry_checker/ui/qgsgeometrycheckfixdialog.h b/src/plugins/geometry_checker/ui/qgsgeometrycheckfixdialog.h index cd03075ce27..d013b7102af 100644 --- a/src/plugins/geometry_checker/ui/qgsgeometrycheckfixdialog.h +++ b/src/plugins/geometry_checker/ui/qgsgeometrycheckfixdialog.h @@ -32,7 +32,7 @@ class QgsGeometryCheckerFixDialog : public QDialog { Q_OBJECT public: - QgsGeometryCheckerFixDialog( QgsGeometryChecker* checker, const QList& errors, QgisInterface *iface, QWidget* parent = 0 ); + QgsGeometryCheckerFixDialog( QgsGeometryChecker* checker, const QList& errors, QgisInterface *iface, QWidget* parent = nullptr ); signals: void currentErrorChanged( QgsGeometryCheckError* error ); diff --git a/src/plugins/geometry_checker/utils/qgsfeaturepool.cpp b/src/plugins/geometry_checker/utils/qgsfeaturepool.cpp index 829c286de28..59f6ed4af5d 100644 --- a/src/plugins/geometry_checker/utils/qgsfeaturepool.cpp +++ b/src/plugins/geometry_checker/utils/qgsfeaturepool.cpp @@ -52,7 +52,7 @@ bool QgsFeaturePool::get( const QgsFeatureId& id , QgsFeature& feature ) { QMutexLocker lock( &mLayerMutex ); QgsFeature* pfeature = mFeatureCache.object( id ); - if ( pfeature == 0 ) + if ( pfeature == nullptr ) { // Get new feature pfeature = new QgsFeature(); diff --git a/src/plugins/geometry_checker/utils/qgsfeaturepool.h b/src/plugins/geometry_checker/utils/qgsfeaturepool.h index 2e97bee62e4..3afb5302661 100644 --- a/src/plugins/geometry_checker/utils/qgsfeaturepool.h +++ b/src/plugins/geometry_checker/utils/qgsfeaturepool.h @@ -39,7 +39,7 @@ class QgsFeaturePool QgsVectorLayer* getLayer() const { return mLayer; } const QgsFeatureIds& getFeatureIds() const { return mFeatureIds; } bool getSelectedOnly() const { return mSelectedOnly; } - void clearLayer() { mLayer = 0; } + void clearLayer() { mLayer = nullptr; } private: struct MapEntry diff --git a/src/plugins/geometry_checker/utils/qgsgeomutils.h b/src/plugins/geometry_checker/utils/qgsgeomutils.h index f839a4d13d5..0046ad91c2c 100644 --- a/src/plugins/geometry_checker/utils/qgsgeomutils.h +++ b/src/plugins/geometry_checker/utils/qgsgeomutils.h @@ -37,7 +37,7 @@ namespace QgsGeomUtils * @param polyLine The polyline * @return The number of distinct points of the polyline */ - inline int polyLineSize( const QgsAbstractGeometryV2* geom, int iPart, int iRing, bool* isClosed = 0 ) + inline int polyLineSize( const QgsAbstractGeometryV2* geom, int iPart, int iRing, bool* isClosed = nullptr ) { int nVerts = geom->vertexCount( iPart, iRing ); QgsPointV2 front = geom->vertexAt( QgsVertexId( iPart, iRing, 0 ) ); diff --git a/src/plugins/geometry_snapper/qgsgeometrysnapper.cpp b/src/plugins/geometry_snapper/qgsgeometrysnapper.cpp index f99783e0c14..f998915f6fb 100644 --- a/src/plugins/geometry_snapper/qgsgeometrysnapper.cpp +++ b/src/plugins/geometry_snapper/qgsgeometrysnapper.cpp @@ -111,8 +111,8 @@ void QgsGeometrySnapper::processFeature( const QgsFeatureId &id ) for ( int iVert = 0, nVerts = polyLineSize( subjGeom, iPart, iRing ); iVert < nVerts; ++iVert ) { - QgsSnapIndex::PointSnapItem* snapPoint = 0; - QgsSnapIndex::SegmentSnapItem* snapSegment = 0; + QgsSnapIndex::PointSnapItem* snapPoint = nullptr; + QgsSnapIndex::SegmentSnapItem* snapSegment = nullptr; QgsVertexId vidx( iPart, iRing, iVert ); QgsPointV2 p = subjGeom->vertexAt( vidx ); if ( !refSnapIndex.getSnapItem( p, snapTolerance, &snapPoint, &snapSegment ) ) @@ -155,8 +155,8 @@ void QgsGeometrySnapper::processFeature( const QgsFeatureId &id ) for ( int iVert = 0, nVerts = polyLineSize( refGeom, iPart, iRing ); iVert < nVerts; ++iVert ) { - QgsSnapIndex::PointSnapItem* snapPoint = 0; - QgsSnapIndex::SegmentSnapItem* snapSegment = 0; + QgsSnapIndex::PointSnapItem* snapPoint = nullptr; + QgsSnapIndex::SegmentSnapItem* snapSegment = nullptr; QgsPointV2 point = refGeom->vertexAt( QgsVertexId( iPart, iRing, iVert ) ); if ( subjSnapIndex->getSnapItem( point, snapTolerance, &snapPoint, &snapSegment ) ) { diff --git a/src/plugins/geometry_snapper/qgsgeometrysnapperdialog.cpp b/src/plugins/geometry_snapper/qgsgeometrysnapperdialog.cpp index d7f6451cfa9..2a7bb06863b 100644 --- a/src/plugins/geometry_snapper/qgsgeometrysnapperdialog.cpp +++ b/src/plugins/geometry_snapper/qgsgeometrysnapperdialog.cpp @@ -114,7 +114,7 @@ QgsVectorLayer* QgsGeometrySnapperDialog::getInputLayer() int idx = comboBoxInputLayer->currentIndex(); if ( idx < 0 ) { - return 0; + return nullptr; } QString inputLayerId = comboBoxInputLayer->itemData( idx ).toString(); return static_cast( QgsMapLayerRegistry::instance()->mapLayer( inputLayerId ) ); @@ -125,7 +125,7 @@ QgsVectorLayer* QgsGeometrySnapperDialog::getReferenceLayer() int idx = comboBoxReferenceLayer->currentIndex(); if ( idx < 0 ) { - return 0; + return nullptr; } QString inputLayerId = comboBoxReferenceLayer->itemData( idx ).toString(); return static_cast( QgsMapLayerRegistry::instance()->mapLayer( inputLayerId ) ); @@ -136,7 +136,7 @@ void QgsGeometrySnapperDialog::validateInput() QgsVectorLayer* inLayer = getInputLayer(); QgsVectorLayer* refLayer = getReferenceLayer(); bool outputOk = radioButtonOuputModifyInput->isChecked() || !lineEditOutput->text().isEmpty(); - mRunButton->setEnabled( inLayer != 0 && refLayer != 0 && inLayer != refLayer && + mRunButton->setEnabled( inLayer != nullptr && refLayer != nullptr && inLayer != refLayer && refLayer->geometryType() == inLayer->geometryType() && outputOk ); } @@ -184,7 +184,7 @@ void QgsGeometrySnapperDialog::run() /** Get layers **/ QgsVectorLayer* layer = getInputLayer(); QgsVectorLayer* referenceLayer = getReferenceLayer(); - if ( layer == 0 || referenceLayer == 0 ) + if ( layer == nullptr || referenceLayer == nullptr ) { return; } diff --git a/src/plugins/geometry_snapper/qgsgeometrysnapperplugin.cpp b/src/plugins/geometry_snapper/qgsgeometrysnapperplugin.cpp index 7142c3b0df4..356e11f6df7 100644 --- a/src/plugins/geometry_snapper/qgsgeometrysnapperplugin.cpp +++ b/src/plugins/geometry_snapper/qgsgeometrysnapperplugin.cpp @@ -20,8 +20,8 @@ QgsGeometrySnapperPlugin::QgsGeometrySnapperPlugin( QgisInterface* iface ) : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) , mIface( iface ) - , mDialog( 0 ) - , mMenuAction( 0 ) + , mDialog( nullptr ) + , mMenuAction( nullptr ) { } @@ -36,9 +36,9 @@ void QgsGeometrySnapperPlugin::initGui() void QgsGeometrySnapperPlugin::unload() { delete mDialog; - mDialog = 0; + mDialog = nullptr; delete mMenuAction; - mMenuAction = 0; + mMenuAction = nullptr; mIface->removePluginVectorMenu( QApplication::translate( "QgsGeometrySnapperPlugin", "G&eometry Tools" ), mMenuAction ); } diff --git a/src/plugins/geometry_snapper/qgssnapindex.cpp b/src/plugins/geometry_snapper/qgssnapindex.cpp index 4066666ddc3..f103f9cc523 100644 --- a/src/plugins/geometry_snapper/qgssnapindex.cpp +++ b/src/plugins/geometry_snapper/qgssnapindex.cpp @@ -208,7 +208,7 @@ const QgsSnapIndex::Cell* QgsSnapIndex::GridRow::getCell( int col ) const { if ( col < mColStartIdx || col >= mColStartIdx + mCells.size() ) { - return 0; + return nullptr; } else { @@ -247,7 +247,7 @@ const QgsSnapIndex::Cell *QgsSnapIndex::getCell( int col, int row ) const { if ( row < mRowsStartIdx || row >= mRowsStartIdx + mGridRows.size() ) { - return 0; + return nullptr; } else { @@ -386,8 +386,8 @@ QgsSnapIndex::SnapItem* QgsSnapIndex::getSnapItem( const QgsPointV2& pos, double double minDistSegment = std::numeric_limits::max(); double minDistPoint = std::numeric_limits::max(); - QgsSnapIndex::SegmentSnapItem* snapSegment = 0; - QgsSnapIndex::PointSnapItem* snapPoint = 0; + QgsSnapIndex::SegmentSnapItem* snapSegment = nullptr; + QgsSnapIndex::PointSnapItem* snapPoint = nullptr; Q_FOREACH ( QgsSnapIndex::SnapItem* item, items ) { @@ -415,8 +415,8 @@ QgsSnapIndex::SnapItem* QgsSnapIndex::getSnapItem( const QgsPointV2& pos, double } } } - snapPoint = minDistPoint < tol * tol ? snapPoint : 0; - snapSegment = minDistSegment < tol * tol ? snapSegment : 0; + snapPoint = minDistPoint < tol * tol ? snapPoint : nullptr; + snapSegment = minDistSegment < tol * tol ? snapSegment : nullptr; if ( pSnapPoint ) *pSnapPoint = snapPoint; if ( pSnapSegment ) *pSnapSegment = snapSegment; return minDistPoint < minDistSegment ? static_cast( snapPoint ) : static_cast( snapSegment ); diff --git a/src/plugins/geometry_snapper/qgssnapindex.h b/src/plugins/geometry_snapper/qgssnapindex.h index f6829d260b2..5bef58dd0dc 100644 --- a/src/plugins/geometry_snapper/qgssnapindex.h +++ b/src/plugins/geometry_snapper/qgssnapindex.h @@ -70,7 +70,7 @@ class QgsSnapIndex ~QgsSnapIndex(); void addGeometry( const QgsAbstractGeometryV2 *geom ); QgsPointV2 getClosestSnapToPoint( const QgsPointV2& p, const QgsPointV2& q ); - SnapItem *getSnapItem( const QgsPointV2& pos, double tol, PointSnapItem **pSnapPoint = 0, SegmentSnapItem **pSnapSegment = 0 ) const; + SnapItem *getSnapItem( const QgsPointV2& pos, double tol, PointSnapItem **pSnapPoint = nullptr, SegmentSnapItem **pSnapSegment = nullptr ) const; private: typedef QList Cell; diff --git a/src/plugins/georeferencer/qgsgcplistmodel.cpp b/src/plugins/georeferencer/qgsgcplistmodel.cpp index a7f17257cd5..021fbf63859 100644 --- a/src/plugins/georeferencer/qgsgcplistmodel.cpp +++ b/src/plugins/georeferencer/qgsgcplistmodel.cpp @@ -52,8 +52,8 @@ class QgsStandardItem : public QStandardItem QgsGCPListModel::QgsGCPListModel( QObject *parent ) : QStandardItemModel( parent ) - , mGCPList( 0 ) - , mGeorefTransform( 0 ) + , mGCPList( nullptr ) + , mGeorefTransform( nullptr ) { // Use data provided by Qt::UserRole as sorting key (needed for numerical sorting). setSortRole( Qt::UserRole ); diff --git a/src/plugins/georeferencer/qgsgcplistmodel.h b/src/plugins/georeferencer/qgsgcplistmodel.h index 0d8b6d725ea..724b0464d12 100644 --- a/src/plugins/georeferencer/qgsgcplistmodel.h +++ b/src/plugins/georeferencer/qgsgcplistmodel.h @@ -28,7 +28,7 @@ class QgsGCPListModel : public QStandardItemModel Q_OBJECT public: - explicit QgsGCPListModel( QObject *parent = 0 ); + explicit QgsGCPListModel( QObject *parent = nullptr ); void setGCPList( QgsGCPList *theGCPList ); void setGeorefTransform( QgsGeorefTransform *theGeorefTransform ); diff --git a/src/plugins/georeferencer/qgsgcplistwidget.cpp b/src/plugins/georeferencer/qgsgcplistwidget.cpp index 947a5bfc7ed..8b30a800e83 100644 --- a/src/plugins/georeferencer/qgsgcplistwidget.cpp +++ b/src/plugins/georeferencer/qgsgcplistwidget.cpp @@ -27,7 +27,7 @@ QgsGCPListWidget::QgsGCPListWidget( QWidget *parent ) : QTableView( parent ) - , mGCPList( 0 ) + , mGCPList( nullptr ) , mGCPListModel( new QgsGCPListModel( this ) ) , mNonEditableDelegate( new QgsNonEditableDelegate( this ) ) , mDmsAndDdDelegate( new QgsDmsAndDdDelegate( this ) ) diff --git a/src/plugins/georeferencer/qgsgcplistwidget.h b/src/plugins/georeferencer/qgsgcplistwidget.h index b09100eded1..bf1c2284ba1 100644 --- a/src/plugins/georeferencer/qgsgcplistwidget.h +++ b/src/plugins/georeferencer/qgsgcplistwidget.h @@ -32,7 +32,7 @@ class QgsGCPListWidget : public QTableView { Q_OBJECT public: - explicit QgsGCPListWidget( QWidget *parent = 0 ); + explicit QgsGCPListWidget( QWidget *parent = nullptr ); void setGCPList( QgsGCPList *theGCPList ); void setGeorefTransform( QgsGeorefTransform *theGeorefTransform ); diff --git a/src/plugins/georeferencer/qgsgeorefconfigdialog.h b/src/plugins/georeferencer/qgsgeorefconfigdialog.h index bf19372041c..d756f9d0287 100644 --- a/src/plugins/georeferencer/qgsgeorefconfigdialog.h +++ b/src/plugins/georeferencer/qgsgeorefconfigdialog.h @@ -22,7 +22,7 @@ class QgsGeorefConfigDialog : public QDialog, private Ui::QgsGeorefConfigDialogB { Q_OBJECT public: - explicit QgsGeorefConfigDialog( QWidget *parent = 0 ); + explicit QgsGeorefConfigDialog( QWidget *parent = nullptr ); ~QgsGeorefConfigDialog(); protected: diff --git a/src/plugins/georeferencer/qgsgeorefdatapoint.cpp b/src/plugins/georeferencer/qgsgeorefdatapoint.cpp index 75b4df58eb3..326071bdf99 100644 --- a/src/plugins/georeferencer/qgsgeorefdatapoint.cpp +++ b/src/plugins/georeferencer/qgsgeorefdatapoint.cpp @@ -40,10 +40,10 @@ QgsGeorefDataPoint::QgsGeorefDataPoint( QgsMapCanvas* srcCanvas, QgsMapCanvas *d QgsGeorefDataPoint::QgsGeorefDataPoint( const QgsGeorefDataPoint &p ) : QObject() - , mSrcCanvas( NULL ) - , mDstCanvas( NULL ) - , mGCPSourceItem( NULL ) - , mGCPDestinationItem( NULL ) + , mSrcCanvas( nullptr ) + , mDstCanvas( nullptr ) + , mGCPSourceItem( nullptr ) + , mGCPDestinationItem( nullptr ) { Q_UNUSED( p ); // we share item representation on canvas between all points diff --git a/src/plugins/georeferencer/qgsgeorefdelegates.h b/src/plugins/georeferencer/qgsgeorefdelegates.h index c046c77eb04..9e10c3178ac 100644 --- a/src/plugins/georeferencer/qgsgeorefdelegates.h +++ b/src/plugins/georeferencer/qgsgeorefdelegates.h @@ -22,7 +22,7 @@ class QgsNonEditableDelegate : public QStyledItemDelegate Q_OBJECT public: - explicit QgsNonEditableDelegate( QWidget *parent = 0 ); + explicit QgsNonEditableDelegate( QWidget *parent = nullptr ); QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override @@ -30,7 +30,7 @@ class QgsNonEditableDelegate : public QStyledItemDelegate Q_UNUSED( parent ); Q_UNUSED( option ); Q_UNUSED( index ); - return 0; + return nullptr; } }; @@ -39,7 +39,7 @@ class QgsDmsAndDdDelegate : public QStyledItemDelegate Q_OBJECT public: - explicit QgsDmsAndDdDelegate( QWidget *parent = 0 ); + explicit QgsDmsAndDdDelegate( QWidget *parent = nullptr ); QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; @@ -60,7 +60,7 @@ class QgsCoordDelegate : public QStyledItemDelegate Q_OBJECT public: - explicit QgsCoordDelegate( QWidget *parent = 0 ); + explicit QgsCoordDelegate( QWidget *parent = nullptr ); QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override; diff --git a/src/plugins/georeferencer/qgsgeorefplugin.cpp b/src/plugins/georeferencer/qgsgeorefplugin.cpp index 3d35d3ebe59..dfcc72e6b32 100644 --- a/src/plugins/georeferencer/qgsgeorefplugin.cpp +++ b/src/plugins/georeferencer/qgsgeorefplugin.cpp @@ -81,8 +81,8 @@ static const QString sPluginIcon = ":/icons/default/mGeorefRun.png"; QgsGeorefPlugin::QgsGeorefPlugin( QgisInterface * theQgisInterface ) : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) , mQGisIface( theQgisInterface ) - , mActionRunGeoref( 0 ) - , mPluginGui( 0 ) + , mActionRunGeoref( nullptr ) + , mPluginGui( nullptr ) { } @@ -129,10 +129,10 @@ void QgsGeorefPlugin::unload() mQGisIface->removeRasterToolBarIcon( mActionRunGeoref ); delete mActionRunGeoref; - mActionRunGeoref = 0; + mActionRunGeoref = nullptr; delete mPluginGui; - mPluginGui = NULL; + mPluginGui = nullptr; } //! Set icons to the current theme diff --git a/src/plugins/georeferencer/qgsgeorefplugingui.cpp b/src/plugins/georeferencer/qgsgeorefplugingui.cpp index 962b34edd6c..bcbcc75f3c7 100644 --- a/src/plugins/georeferencer/qgsgeorefplugingui.cpp +++ b/src/plugins/georeferencer/qgsgeorefplugingui.cpp @@ -79,14 +79,14 @@ QgsGeorefPluginGui::QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget , mMousePrecisionDecimalPlaces( 0 ) , mTransformParam( QgsGeorefTransform::InvalidTransform ) , mIface( theQgisInterface ) - , mLayer( 0 ) + , mLayer( nullptr ) , mAgainAddRaster( false ) - , mMovingPoint( 0 ) - , mMovingPointQgis( 0 ) - , mMapCoordsDialog( 0 ) + , mMovingPoint( nullptr ) + , mMovingPointQgis( nullptr ) + , mMapCoordsDialog( nullptr ) , mUseZeroForTrans( false ) , mLoadInQgis( false ) - , mDock( 0 ) + , mDock( nullptr ) { setupUi( this ); @@ -135,9 +135,9 @@ void QgsGeorefPluginGui::dockThisWindow( bool dock ) show(); mIface->removeDockWidget( mDock ); - mDock->setWidget( 0 ); + mDock->setWidget( nullptr ); delete mDock; - mDock = 0; + mDock = nullptr; } if ( dock ) @@ -575,11 +575,11 @@ void QgsGeorefPluginGui::releasePoint( const QPoint &p ) // Get Map Sender if ( sender() == mToolMovePoint ) { - mMovingPoint = 0; + mMovingPoint = nullptr; } else { - mMovingPointQgis = 0; + mMovingPointQgis = nullptr; } } @@ -827,7 +827,7 @@ void QgsGeorefPluginGui::extentsChanged() } else { - mLayer = 0; + mLayer = nullptr; mAgainAddRaster = false; } } @@ -1011,7 +1011,7 @@ void QgsGeorefPluginGui::createMenus() { // Get platform for menu layout customization (Gnome, Kde, Mac, Win) QDialogButtonBox::ButtonLayout layout = - QDialogButtonBox::ButtonLayout( style()->styleHint( QStyle::SH_DialogButtonLayout, 0, this ) ); + QDialogButtonBox::ButtonLayout( style()->styleHint( QStyle::SH_DialogButtonLayout, nullptr, this ) ); mPanelMenu = new QMenu( tr( "Panels" ) ); mPanelMenu->setObjectName( "mPanelMenu" ); @@ -1120,7 +1120,7 @@ void QgsGeorefPluginGui::removeOldLayer() { QgsMapLayerRegistry::instance()->removeMapLayers( ( QStringList() << mLayer->id() ) ); - mLayer = NULL; + mLayer = nullptr; } mCanvas->refresh(); } @@ -1645,11 +1645,11 @@ bool QgsGeorefPluginGui::writePDFReportFile( const QString& fileName, const QgsG composerMap->setMapCanvas( mCanvas ); composition->addItem( composerMap ); - QgsComposerTextTableV2* parameterTable = 0; + QgsComposerTextTableV2* parameterTable = nullptr; double scaleX, scaleY, rotation; QgsPoint origin; - QgsComposerLabel* parameterLabel = 0; + QgsComposerLabel* parameterLabel = nullptr; //transformation that involves only scaling and rotation (linear or helmert) ? bool wldTransform = transform.getOriginScaleRotation( origin, scaleX, scaleY, rotation ); diff --git a/src/plugins/georeferencer/qgsgeorefplugingui.h b/src/plugins/georeferencer/qgsgeorefplugingui.h index 727723b0349..419f6d233e5 100644 --- a/src/plugins/georeferencer/qgsgeorefplugingui.h +++ b/src/plugins/georeferencer/qgsgeorefplugingui.h @@ -44,7 +44,7 @@ class QgsGeorefDockWidget : public QDockWidget { Q_OBJECT public: - QgsGeorefDockWidget( const QString & title, QWidget * parent = 0, Qt::WindowFlags flags = 0 ); + QgsGeorefDockWidget( const QString & title, QWidget * parent = nullptr, Qt::WindowFlags flags = nullptr ); }; class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBase @@ -52,7 +52,7 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas Q_OBJECT public: - QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget* parent = 0, Qt::WindowFlags fl = 0 ); + QgsGeorefPluginGui( QgisInterface* theQgisInterface, QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr ); ~QgsGeorefPluginGui(); protected: diff --git a/src/plugins/georeferencer/qgsgeoreftoolmovepoint.cpp b/src/plugins/georeferencer/qgsgeoreftoolmovepoint.cpp index 8d9a39bbed2..b6903053add 100644 --- a/src/plugins/georeferencer/qgsgeoreftoolmovepoint.cpp +++ b/src/plugins/georeferencer/qgsgeoreftoolmovepoint.cpp @@ -19,7 +19,7 @@ QgsGeorefToolMovePoint::QgsGeorefToolMovePoint( QgsMapCanvas *canvas ) : QgsMapTool( canvas ) - , mRubberBand( 0 ) + , mRubberBand( nullptr ) { } diff --git a/src/plugins/georeferencer/qgsgeoreftransform.cpp b/src/plugins/georeferencer/qgsgeoreftransform.cpp index 251218074eb..9344770dc50 100644 --- a/src/plugins/georeferencer/qgsgeoreftransform.cpp +++ b/src/plugins/georeferencer/qgsgeoreftransform.cpp @@ -139,21 +139,21 @@ class QgsProjectiveGeorefTransform : public QgsGeorefTransformInterface QgsGeorefTransform::QgsGeorefTransform( const QgsGeorefTransform &other ) { mTransformParametrisation = InvalidTransform; - mGeorefTransformImplementation = NULL; + mGeorefTransformImplementation = nullptr; selectTransformParametrisation( other.mTransformParametrisation ); } QgsGeorefTransform::QgsGeorefTransform( TransformParametrisation parametrisation ) { mTransformParametrisation = InvalidTransform; - mGeorefTransformImplementation = NULL; + mGeorefTransformImplementation = nullptr; selectTransformParametrisation( parametrisation ); } QgsGeorefTransform::QgsGeorefTransform() { mTransformParametrisation = InvalidTransform; - mGeorefTransformImplementation = NULL; + mGeorefTransformImplementation = nullptr; mParametersInitialized = false; } @@ -235,7 +235,7 @@ GDALTransformerFunc QgsGeorefTransform::GDALTransformer() const { if ( !mGeorefTransformImplementation ) { - return NULL; + return nullptr; } return mGeorefTransformImplementation->GDALTransformer(); } @@ -244,7 +244,7 @@ void* QgsGeorefTransform::GDALTransformerArgs() const { if ( !mGeorefTransformImplementation ) { - return NULL; + return nullptr; } return mGeorefTransformImplementation->GDALTransformerArgs(); } @@ -260,7 +260,7 @@ QgsGeorefTransformInterface *QgsGeorefTransform::createImplementation( Transform case PolynomialOrder3: return new QgsGDALGeorefTransform( false, 3 ); case ThinPlateSpline: return new QgsGDALGeorefTransform( true, 0 ); case Projective: return new QgsProjectiveGeorefTransform; - default: return NULL; + default: return nullptr; } } @@ -373,7 +373,7 @@ int QgsLinearGeorefTransform::linear_transform( void *pTransformerArg, int bDstT { Q_UNUSED( z ); LinearParameters* t = static_cast( pTransformerArg ); - if ( t == NULL ) + if ( t == nullptr ) { return false; } @@ -448,7 +448,7 @@ int QgsHelmertGeorefTransform::helmert_transform( void *pTransformerArg, int bDs { Q_UNUSED( z ); HelmertParameters* t = static_cast( pTransformerArg ); - if ( t == NULL ) + if ( t == nullptr ) { return false; } @@ -500,8 +500,8 @@ int QgsHelmertGeorefTransform::helmert_transform( void *pTransformerArg, int bDs QgsGDALGeorefTransform::QgsGDALGeorefTransform( bool useTPS, unsigned int polynomialOrder ) : mPolynomialOrder( qMin( 3u, polynomialOrder ) ), mIsTPSTransform( useTPS ) { - mGDALTransformer = NULL; - mGDALTransformerArgs = NULL; + mGDALTransformer = nullptr; + mGDALTransformerArgs = nullptr; } QgsGDALGeorefTransform::~QgsGDALGeorefTransform() @@ -521,7 +521,7 @@ bool QgsGDALGeorefTransform::updateParametersFromGCPs( const std::vector( pTransformerArg ); - if ( t == NULL ) + if ( t == nullptr ) { return false; } diff --git a/src/plugins/georeferencer/qgsimagewarper.cpp b/src/plugins/georeferencer/qgsimagewarper.cpp index 6ec70c54629..4148a251b79 100644 --- a/src/plugins/georeferencer/qgsimagewarper.cpp +++ b/src/plugins/georeferencer/qgsimagewarper.cpp @@ -82,7 +82,7 @@ bool QgsImageWarper::createDestinationDataset( const QString &outputName, GDALDa { return false; } - char **papszOptions = NULL; + char **papszOptions = nullptr; papszOptions = CSLSetNameValue( papszOptions, "COMPRESS", compression.toAscii() ); hDstDS = GDALCreate( driver, TO8F( outputName ), resX, resY, @@ -104,7 +104,7 @@ bool QgsImageWarper::createDestinationDataset( const QString &outputName, GDALDa OGRSpatialReference oTargetSRS; oTargetSRS.importFromProj4( crs.toProj4().toLatin1().data() ); - char *wkt = NULL; + char *wkt = nullptr; OGRErr err = oTargetSRS.exportToWkt( &wkt ); if ( err != CE_None || GDALSetProjection( hDstDS, wkt ) != CE_None ) { @@ -274,7 +274,7 @@ void *QgsImageWarper::addGeoToPixelTransform( GDALTransformerFunc GDALTransforme { // Error handling if inversion fails - although the inverse transform is not needed for warp operation delete chain; - return 0; + return nullptr; } return ( void* )chain; } diff --git a/src/plugins/georeferencer/qgsmapcoordsdialog.cpp b/src/plugins/georeferencer/qgsmapcoordsdialog.cpp index 52218efb879..fb55b6faf9b 100644 --- a/src/plugins/georeferencer/qgsmapcoordsdialog.cpp +++ b/src/plugins/georeferencer/qgsmapcoordsdialog.cpp @@ -23,7 +23,7 @@ QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas* qgisCanvas, const QgsPoint &pixelCoords, QWidget* parent ) : QDialog( parent, Qt::Dialog ) - , mPrevMapTool( NULL ) + , mPrevMapTool( nullptr ) , mQgisCanvas( qgisCanvas ) , mPixelCoords( pixelCoords ) { @@ -131,7 +131,7 @@ void QgsMapCoordsDialog::setToolEmitPoint( bool isEnable ) { parentWidget()->showMinimized(); - assert( parentWidget()->parentWidget() != 0 ); + assert( parentWidget()->parentWidget() != nullptr ); parentWidget()->parentWidget()->activateWindow(); parentWidget()->parentWidget()->raise(); diff --git a/src/plugins/georeferencer/qgsmapcoordsdialog.h b/src/plugins/georeferencer/qgsmapcoordsdialog.h index cfc80e31d20..e192a5dd262 100644 --- a/src/plugins/georeferencer/qgsmapcoordsdialog.h +++ b/src/plugins/georeferencer/qgsmapcoordsdialog.h @@ -46,7 +46,7 @@ class QgsMapCoordsDialog : public QDialog, private Ui::QgsMapCoordsDialogBase Q_OBJECT public: - QgsMapCoordsDialog( QgsMapCanvas *qgisCanvas, const QgsPoint &pixelCoords, QWidget *parent = 0 ); + QgsMapCoordsDialog( QgsMapCanvas *qgisCanvas, const QgsPoint &pixelCoords, QWidget *parent = nullptr ); ~QgsMapCoordsDialog(); private slots: diff --git a/src/plugins/georeferencer/qgsrasterchangecoords.cpp b/src/plugins/georeferencer/qgsrasterchangecoords.cpp index 6391beea68f..2f1fe22e48e 100644 --- a/src/plugins/georeferencer/qgsrasterchangecoords.cpp +++ b/src/plugins/georeferencer/qgsrasterchangecoords.cpp @@ -40,7 +40,7 @@ void QgsRasterChangeCoords::setRaster( const QString &fileRaster ) GDALAllRegister(); GDALDatasetH hDS = GDALOpen( TO8F( fileRaster ), GA_ReadOnly ); double adfGeoTransform[6]; - if ( GDALGetProjectionRef( hDS ) != NULL && GDALGetGeoTransform( hDS, adfGeoTransform ) == CE_None ) + if ( GDALGetProjectionRef( hDS ) != nullptr && GDALGetGeoTransform( hDS, adfGeoTransform ) == CE_None ) //if ( false ) { mHasCrs = true; diff --git a/src/plugins/georeferencer/qgstransformsettingsdialog.h b/src/plugins/georeferencer/qgstransformsettingsdialog.h index a5958d47963..69762df62f4 100644 --- a/src/plugins/georeferencer/qgstransformsettingsdialog.h +++ b/src/plugins/georeferencer/qgstransformsettingsdialog.h @@ -28,7 +28,7 @@ class QgsTransformSettingsDialog : public QDialog, private Ui::QgsTransformSetti public: QgsTransformSettingsDialog( const QString &raster, const QString &output, - int countGCPpoints, QWidget *parent = 0 ); + int countGCPpoints, QWidget *parent = nullptr ); ~QgsTransformSettingsDialog(); void getTransformSettings( QgsGeorefTransform::TransformParametrisation &tp, diff --git a/src/plugins/gps_importer/qgsgpsdevicedialog.cpp b/src/plugins/gps_importer/qgsgpsdevicedialog.cpp index 778ee5a6434..f6649b240e0 100644 --- a/src/plugins/gps_importer/qgsgpsdevicedialog.cpp +++ b/src/plugins/gps_importer/qgsgpsdevicedialog.cpp @@ -19,7 +19,7 @@ QgsGPSDeviceDialog::QgsGPSDeviceDialog( std::map < QString, QgsGPSDevice* > & devices ) - : QDialog( 0, QgisGui::ModalDialogFlags ) + : QDialog( nullptr, QgisGui::ModalDialogFlags ) , mDevices( devices ) { setupUi( this ); @@ -119,7 +119,7 @@ void QgsGPSDeviceDialog::slotUpdateDeviceList( const QString& selection ) } } - if ( lbDeviceList->currentItem() == NULL && lbDeviceList->count() > 0 ) + if ( lbDeviceList->currentItem() == nullptr && lbDeviceList->count() > 0 ) lbDeviceList->setCurrentRow( 0 ); // Update the display and reconnect the selection changed signal diff --git a/src/plugins/gps_importer/qgsgpsplugin.cpp b/src/plugins/gps_importer/qgsgpsplugin.cpp index 511e9548801..473b9d41c78 100644 --- a/src/plugins/gps_importer/qgsgpsplugin.cpp +++ b/src/plugins/gps_importer/qgsgpsplugin.cpp @@ -65,8 +65,8 @@ static const QString icon_ = ":/gps_importer.png"; QgsGPSPlugin::QgsGPSPlugin( QgisInterface * theQgisInterFace ) : QgisPlugin( name_, description_, category_, version_, type_ ) , mQGisInterface( theQgisInterFace ) - , mQActionPointer( 0 ) - , mCreateGPXAction( 0 ) + , mQActionPointer( nullptr ) + , mCreateGPXAction( nullptr ) { setupBabel(); } @@ -182,7 +182,7 @@ void QgsGPSPlugin::createGPX() std::ofstream ofs( fileName.toUtf8() ); if ( !ofs ) { - QMessageBox::warning( NULL, tr( "Could not create file" ), + QMessageBox::warning( nullptr, tr( "Could not create file" ), tr( "Unable to create a GPX file with the given name. " "Try again with another name or in another " "directory." ) ); @@ -218,7 +218,7 @@ void QgsGPSPlugin::unload() mQGisInterface->removePluginVectorMenu( tr( "&GPS" ), mQActionPointer ); mQGisInterface->removeVectorToolBarIcon( mQActionPointer ); delete mQActionPointer; - mQActionPointer = 0; + mQActionPointer = nullptr; } void QgsGPSPlugin::loadGPXFile( const QString& fileName, bool loadWaypoints, bool loadRoutes, @@ -228,7 +228,7 @@ void QgsGPSPlugin::loadGPXFile( const QString& fileName, bool loadWaypoints, boo QFileInfo fileInfo( fileName ); if ( !fileInfo.isReadable() ) { - QMessageBox::warning( NULL, tr( "GPX Loader" ), + QMessageBox::warning( nullptr, tr( "GPX Loader" ), tr( "Unable to read the selected file.\n" "Please reselect a valid file." ) ); return; @@ -273,7 +273,7 @@ void QgsGPSPlugin::importGPSFile( const QString& inputFileName, QgsBabelFormat* babelProcess.start( babelArgs.join( " " ) ); if ( !babelProcess.waitForStarted() ) { - QMessageBox::warning( NULL, tr( "Could not start process" ), + QMessageBox::warning( nullptr, tr( "Could not start process" ), tr( "Could not start GPSBabel!" ) ); return; } @@ -297,7 +297,7 @@ void QgsGPSPlugin::importGPSFile( const QString& inputFileName, QgsBabelFormat* QString errorMsg( tr( "Could not import data from %1!\n\n" ) .arg( inputFileName ) ); errorMsg += babelError; - QMessageBox::warning( NULL, tr( "Error importing data" ), errorMsg ); + QMessageBox::warning( nullptr, tr( "Error importing data" ), errorMsg ); return; } @@ -344,7 +344,7 @@ void QgsGPSPlugin::convertGPSFile( const QString& inputFileName, babelProcess.start( babelArgs.join( " " ) ); if ( !babelProcess.waitForStarted() ) { - QMessageBox::warning( NULL, tr( "Could not start process" ), + QMessageBox::warning( nullptr, tr( "Could not start process" ), tr( "Could not start GPSBabel!" ) ); return; } @@ -366,7 +366,7 @@ void QgsGPSPlugin::convertGPSFile( const QString& inputFileName, QString errorMsg( tr( "Could not convert data from %1!\n\n" ) .arg( inputFileName ) ); errorMsg += babelError; - QMessageBox::warning( NULL, tr( "Error converting data" ), errorMsg ); + QMessageBox::warning( nullptr, tr( "Error converting data" ), errorMsg ); return; } @@ -423,7 +423,7 @@ void QgsGPSPlugin::downloadFromGPS( const QString& device, const QString& port, port, outputFileName ); if ( babelArgs.isEmpty() ) { - QMessageBox::warning( NULL, tr( "Not supported" ), + QMessageBox::warning( nullptr, tr( "Not supported" ), tr( "This device does not support downloading of %1." ) .arg( features ) ); return; @@ -435,7 +435,7 @@ void QgsGPSPlugin::downloadFromGPS( const QString& device, const QString& port, babelProcess.start( babelArgs.join( " " ) ); if ( !babelProcess.waitForStarted() ) { - QMessageBox::warning( NULL, tr( "Could not start process" ), + QMessageBox::warning( nullptr, tr( "Could not start process" ), tr( "Could not start GPSBabel!" ) ); return; } @@ -456,7 +456,7 @@ void QgsGPSPlugin::downloadFromGPS( const QString& device, const QString& port, QString babelError( babelProcess.readAllStandardError() ); QString errorMsg( tr( "Could not download data from GPS!\n\n" ) ); errorMsg += babelError; - QMessageBox::warning( NULL, tr( "Error downloading data" ), errorMsg ); + QMessageBox::warning( nullptr, tr( "Error downloading data" ), errorMsg ); return; } @@ -513,7 +513,7 @@ void QgsGPSPlugin::uploadToGPS( QgsVectorLayer* gpxLayer, const QString& device, source.left( source.lastIndexOf( '?' ) ), port ); if ( babelArgs.isEmpty() ) { - QMessageBox::warning( NULL, tr( "Not supported" ), + QMessageBox::warning( nullptr, tr( "Not supported" ), tr( "This device does not support uploading of %1." ) .arg( features ) ); return; @@ -525,7 +525,7 @@ void QgsGPSPlugin::uploadToGPS( QgsVectorLayer* gpxLayer, const QString& device, babelProcess.start( babelArgs.join( " " ) ); if ( !babelProcess.waitForStarted() ) { - QMessageBox::warning( NULL, tr( "Could not start process" ), + QMessageBox::warning( nullptr, tr( "Could not start process" ), tr( "Could not start GPSBabel!" ) ); return; } @@ -546,7 +546,7 @@ void QgsGPSPlugin::uploadToGPS( QgsVectorLayer* gpxLayer, const QString& device, QString babelError( babelProcess.readAllStandardError() ); QString errorMsg( tr( "Error while uploading data to GPS!\n\n" ) ); errorMsg += babelError; - QMessageBox::warning( NULL, tr( "Error uploading data" ), errorMsg ); + QMessageBox::warning( nullptr, tr( "Error uploading data" ), errorMsg ); return; } diff --git a/src/plugins/heatmap/heatmap.cpp b/src/plugins/heatmap/heatmap.cpp index eb408c0f555..d6057afd801 100644 --- a/src/plugins/heatmap/heatmap.cpp +++ b/src/plugins/heatmap/heatmap.cpp @@ -70,7 +70,7 @@ Heatmap::Heatmap( QgisInterface * theQgisInterface ) : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) , mDecay( 1. ) , mQGisIface( theQgisInterface ) - , mQActionPointer( 0 ) + , mQActionPointer( nullptr ) { } @@ -146,14 +146,14 @@ void Heatmap::run() GDALDriver *myDriver; myDriver = GetGDALDriverManager()->GetDriverByName( d.outputFormat().toUtf8() ); - if ( myDriver == NULL ) + if ( myDriver == nullptr ) { mQGisIface->messageBar()->pushMessage( tr( "GDAL driver error" ), tr( "Cannot open the driver for the specified format" ), QgsMessageBar::WARNING, mQGisIface->messageTimeout() ); return; } double geoTransform[6] = { myBBox.xMinimum(), cellsize, 0, myBBox.yMinimum(), 0, cellsize }; - emptyDataset = myDriver->Create( d.outputFilename().toUtf8(), columns, rows, 1, GDT_Float32, NULL ); + emptyDataset = myDriver->Create( d.outputFilename().toUtf8(), columns, rows, 1, GDT_Float32, nullptr ); emptyDataset->SetGeoTransform( geoTransform ); // Set the projection on the raster destination to match the input layer emptyDataset->SetProjection( inputLayer->crs().toWkt().toLocal8Bit().data() ); diff --git a/src/plugins/heatmap/heatmapgui.cpp b/src/plugins/heatmap/heatmapgui.cpp index 934d77fe14f..726228504cc 100644 --- a/src/plugins/heatmap/heatmapgui.cpp +++ b/src/plugins/heatmap/heatmapgui.cpp @@ -87,7 +87,7 @@ HeatmapGui::HeatmapGui( QWidget* parent, Qt::WindowFlags fl, QMapGetMetadata(); // Only formats which allow creation of Float32 data types are valid if ( CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE, false ) && - QString( nthDriver->GetMetadataItem( GDAL_DMD_CREATIONDATATYPES, NULL ) ).contains( "Float32" ) ) + QString( nthDriver->GetMetadataItem( GDAL_DMD_CREATIONDATATYPES, nullptr ) ).contains( "Float32" ) ) { ++myIndex; QString myLongName = nthDriver->GetMetadataItem( GDAL_DMD_LONGNAME ); @@ -243,7 +243,7 @@ void HeatmapGui::on_mBrowseButton_clicked() QSettings s; QString lastDir = s.value( "/Heatmap/lastOutputDir", QDir::homePath() ).toString(); - QString outputFilename = QFileDialog::getSaveFileName( 0, tr( "Save Heatmap as:" ), lastDir ); + QString outputFilename = QFileDialog::getSaveFileName( nullptr, tr( "Save Heatmap as:" ), lastDir ); if ( !outputFilename.isEmpty() ) { mOutputRasterLineEdit->setText( outputFilename ); @@ -270,7 +270,7 @@ void HeatmapGui::on_mAdvancedGroupBox_toggled( bool enabled ) // if there are no layers point layers then show error dialog and toggle if ( mInputLayerCombo->count() == 0 ) { - QMessageBox::information( 0, tr( "No valid layers found!" ), tr( "Advanced options cannot be enabled." ) ); + QMessageBox::information( nullptr, tr( "No valid layers found!" ), tr( "Advanced options cannot be enabled." ) ); mAdvancedGroupBox->setChecked( false ); return; } @@ -578,7 +578,7 @@ QString HeatmapGui::outputFilename() const QFileInfo myFileInfo( outputFileName ); if ( outputFileName.isEmpty() || !myFileInfo.dir().exists() ) { - QMessageBox::information( 0, tr( "Invalid output filename" ), tr( "Please enter a valid output file path and name." ) ); + QMessageBox::information( nullptr, tr( "Invalid output filename" ), tr( "Please enter a valid output file path and name." ) ); return QString::null; } diff --git a/src/plugins/interpolation/qgsinterpolationdialog.cpp b/src/plugins/interpolation/qgsinterpolationdialog.cpp index bb0ae67dc4e..3fe3f592c8a 100644 --- a/src/plugins/interpolation/qgsinterpolationdialog.cpp +++ b/src/plugins/interpolation/qgsinterpolationdialog.cpp @@ -32,7 +32,7 @@ #include -QgsInterpolationDialog::QgsInterpolationDialog( QWidget* parent, QgisInterface* iface ): QDialog( parent ), mIface( iface ), mInterpolatorDialog( 0 ) +QgsInterpolationDialog::QgsInterpolationDialog( QWidget* parent, QgisInterface* iface ): QDialog( parent ), mIface( iface ), mInterpolatorDialog( nullptr ) { setupUi( this ); @@ -109,7 +109,7 @@ void QgsInterpolationDialog::on_buttonBox_accepted() //warn the user if there isn't any input layer if ( mLayersTreeWidget->topLevelItemCount() < 1 ) { - QMessageBox::information( 0, tr( "No input data for interpolation" ), tr( "Please add one or more input layers" ) ); + QMessageBox::information( nullptr, tr( "No input data for interpolation" ), tr( "Please add one or more input layers" ) ); return; } @@ -118,7 +118,7 @@ void QgsInterpolationDialog::on_buttonBox_accepted() QFileInfo theFileInfo( fileName ); if ( fileName.isEmpty() || !theFileInfo.dir().exists() ) { - QMessageBox::information( 0, tr( "Output file name invalid" ), tr( "Please enter a valid output file name" ) ); + QMessageBox::information( nullptr, tr( "Output file name invalid" ), tr( "Please enter a valid output file name" ) ); return; } @@ -308,7 +308,7 @@ void QgsInterpolationDialog::on_mOutputFileButton_clicked() QSettings s; QString lastOutputDir = s.value( "/Interpolation/lastOutputDir", QDir::homePath() ).toString(); - QString rasterFileName = QFileDialog::getSaveFileName( 0, tr( "Save interpolated raster as..." ), lastOutputDir ); + QString rasterFileName = QFileDialog::getSaveFileName( nullptr, tr( "Save interpolated raster as..." ), lastOutputDir ); if ( !rasterFileName.isEmpty() ) { mOutputFileLineEdit->setText( rasterFileName ); @@ -351,7 +351,7 @@ QgsVectorLayer* QgsInterpolationDialog::vectorLayerFromName( const QString& name } } - return 0; + return nullptr; } void QgsInterpolationDialog::on_mInterpolationMethodComboBox_currentIndexChanged( const QString &text ) diff --git a/src/plugins/interpolation/qgsinterpolationplugin.cpp b/src/plugins/interpolation/qgsinterpolationplugin.cpp index c70169075ed..162c0af16df 100644 --- a/src/plugins/interpolation/qgsinterpolationplugin.cpp +++ b/src/plugins/interpolation/qgsinterpolationplugin.cpp @@ -28,7 +28,7 @@ static const QString category_ = QObject::tr( "Raster" ); static const QString version_ = QObject::tr( "Version 0.001" ); static const QString icon_ = ":/raster-interpolate.png"; -QgsInterpolationPlugin::QgsInterpolationPlugin( QgisInterface* iface ): mIface( iface ), mInterpolationAction( 0 ) +QgsInterpolationPlugin::QgsInterpolationPlugin( QgisInterface* iface ): mIface( iface ), mInterpolationAction( nullptr ) { } @@ -42,7 +42,7 @@ void QgsInterpolationPlugin::initGui() { if ( mIface ) { - mInterpolationAction = new QAction( QIcon( ":/raster-interpolate.png" ), tr( "&Interpolation" ), 0 ); + mInterpolationAction = new QAction( QIcon( ":/raster-interpolate.png" ), tr( "&Interpolation" ), nullptr ); mInterpolationAction->setObjectName( "mInterpolationAction" ); QObject::connect( mInterpolationAction, SIGNAL( triggered() ), this, SLOT( showInterpolationDialog() ) ); mIface->addRasterToolBarIcon( mInterpolationAction ); diff --git a/src/plugins/interpolation/qgstininterpolatordialog.cpp b/src/plugins/interpolation/qgstininterpolatordialog.cpp index 5a622544b37..46adea81601 100644 --- a/src/plugins/interpolation/qgstininterpolatordialog.cpp +++ b/src/plugins/interpolation/qgstininterpolatordialog.cpp @@ -41,7 +41,7 @@ QgsTINInterpolatorDialog::~QgsTINInterpolatorDialog() QgsInterpolator* QgsTINInterpolatorDialog::createInterpolator() const { - QgsTINInterpolator* theInterpolator = 0; + QgsTINInterpolator* theInterpolator = nullptr; if ( mInterpolationComboBox->currentText() == tr( "Clough-Toucher (cubic)" ) ) { @@ -83,7 +83,7 @@ void QgsTINInterpolatorDialog::on_mTriangulationFileButton_clicked() QSettings s; //read last triangulation directory QString lastTriangulationDir = s.value( "/Interpolation/lastTriangulationDir", QDir::homePath() ).toString(); - QString filename = QFileDialog::getSaveFileName( 0, tr( "Save triangulation to file" ), lastTriangulationDir, "*shp" ); + QString filename = QFileDialog::getSaveFileName( nullptr, tr( "Save triangulation to file" ), lastTriangulationDir, "*shp" ); if ( !filename.isEmpty() ) { mTriangulationFileEdit->setText( filename ); diff --git a/src/plugins/offline_editing/offline_editing_plugin.cpp b/src/plugins/offline_editing/offline_editing_plugin.cpp index f13eaec614c..e9d125b5e5e 100644 --- a/src/plugins/offline_editing/offline_editing_plugin.cpp +++ b/src/plugins/offline_editing/offline_editing_plugin.cpp @@ -38,10 +38,10 @@ static const QString sPluginIcon = ":/offline_editing/offline_editing_copy.png"; QgsOfflineEditingPlugin::QgsOfflineEditingPlugin( QgisInterface* theQgisInterface ) : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) , mQGisIface( theQgisInterface ) - , mActionConvertProject( 0 ) - , mActionSynchronize( 0 ) - , mOfflineEditing( 0 ) - , mProgressDialog( 0 ) + , mActionConvertProject( nullptr ) + , mActionSynchronize( nullptr ) + , mOfflineEditing( nullptr ) + , mProgressDialog( nullptr ) { } diff --git a/src/plugins/offline_editing/offline_editing_plugin_gui.h b/src/plugins/offline_editing/offline_editing_plugin_gui.h index 240c13912bb..3bd8863df1e 100644 --- a/src/plugins/offline_editing/offline_editing_plugin_gui.h +++ b/src/plugins/offline_editing/offline_editing_plugin_gui.h @@ -29,7 +29,7 @@ class QgsSelectLayerTreeModel : public QgsLayerTreeModel { Q_OBJECT public: - QgsSelectLayerTreeModel( QgsLayerTreeGroup* rootNode, QObject *parent = 0 ); + QgsSelectLayerTreeModel( QgsLayerTreeGroup* rootNode, QObject *parent = nullptr ); ~QgsSelectLayerTreeModel(); QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; @@ -41,7 +41,7 @@ class QgsOfflineEditingPluginGui : public QDialog, private Ui::QgsOfflineEditing Q_OBJECT public: - QgsOfflineEditingPluginGui( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); + QgsOfflineEditingPluginGui( QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr ); virtual ~QgsOfflineEditingPluginGui(); QString offlineDataPath(); diff --git a/src/plugins/offline_editing/offline_editing_progress_dialog.h b/src/plugins/offline_editing/offline_editing_progress_dialog.h index d43fe68473d..ecdd064c267 100644 --- a/src/plugins/offline_editing/offline_editing_progress_dialog.h +++ b/src/plugins/offline_editing/offline_editing_progress_dialog.h @@ -27,7 +27,7 @@ class QgsOfflineEditingProgressDialog : public QDialog, private Ui::QgsOfflineEd Q_OBJECT public: - QgsOfflineEditingProgressDialog( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); + QgsOfflineEditingProgressDialog( QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr ); virtual ~QgsOfflineEditingProgressDialog(); void setTitle( const QString& title ); diff --git a/src/plugins/oracle_raster/qgsoracle_plugin.cpp b/src/plugins/oracle_raster/qgsoracle_plugin.cpp index 0b220aa4232..ad6a0fd79e4 100644 --- a/src/plugins/oracle_raster/qgsoracle_plugin.cpp +++ b/src/plugins/oracle_raster/qgsoracle_plugin.cpp @@ -39,7 +39,7 @@ static const QString sPluginIcon = ":/oracleplugin/oracleraster.svg"; QgsOraclePlugin::QgsOraclePlugin( QgisInterface * theQgisInterface ) : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) , mQGisIface( theQgisInterface ) - , mQActionPointer( NULL ) + , mQActionPointer( nullptr ) { } @@ -95,7 +95,7 @@ void QgsOraclePlugin::unload() mQGisIface->layerToolBar()->removeAction( mQActionPointer ); mQGisIface->removeAddLayerAction( mQActionPointer ); delete mQActionPointer; - mQActionPointer = 0; + mQActionPointer = nullptr; } diff --git a/src/plugins/oracle_raster/qgsoracleconnect_ui.h b/src/plugins/oracle_raster/qgsoracleconnect_ui.h index 52c0e406785..c94e6961183 100644 --- a/src/plugins/oracle_raster/qgsoracleconnect_ui.h +++ b/src/plugins/oracle_raster/qgsoracleconnect_ui.h @@ -27,7 +27,7 @@ class QgsOracleConnect : public QDialog, private Ui::OracleConnectGuiBase Q_OBJECT public: - QgsOracleConnect( QWidget* parent = 0, + QgsOracleConnect( QWidget* parent = nullptr, const QString& connName = QString::null, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); ~QgsOracleConnect(); diff --git a/src/plugins/oracle_raster/qgsselectgeoraster_ui.cpp b/src/plugins/oracle_raster/qgsselectgeoraster_ui.cpp index e62c80ee043..14958c50ac2 100644 --- a/src/plugins/oracle_raster/qgsselectgeoraster_ui.cpp +++ b/src/plugins/oracle_raster/qgsselectgeoraster_ui.cpp @@ -183,7 +183,7 @@ void QgsOracleSelectGeoraster::showSelection( const QString & line ) { QString identification = line; - GDALDatasetH hDS = NULL; + GDALDatasetH hDS = nullptr; GDALAccess eAccess = GA_ReadOnly; /* @@ -202,7 +202,7 @@ void QgsOracleSelectGeoraster::showSelection( const QString & line ) hDS = GDALOpenShared( TO8F( identification ), eAccess ); buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false ); - if ( hDS == NULL ) + if ( hDS == nullptr ) { QMessageBox::information( this, tr( "Open failed" ), @@ -216,7 +216,7 @@ void QgsOracleSelectGeoraster::showSelection( const QString & line ) * Get subdataset list */ - char **papszMetadata = NULL; + char **papszMetadata = nullptr; papszMetadata = GDALGetMetadata( hDS, "SUBDATASETS" ); int nSubDatasets = CSLCount( papszMetadata ); diff --git a/src/plugins/oracle_raster/qgsselectgeoraster_ui.h b/src/plugins/oracle_raster/qgsselectgeoraster_ui.h index 6a1ae2d00cb..2ed8ada876d 100644 --- a/src/plugins/oracle_raster/qgsselectgeoraster_ui.h +++ b/src/plugins/oracle_raster/qgsselectgeoraster_ui.h @@ -34,7 +34,7 @@ class QgsOracleSelectGeoraster : public QDialog, private Ui::SelectGeoRasterBase Q_OBJECT public: - QgsOracleSelectGeoraster( QWidget* parent, QgisInterface* iface, Qt::WindowFlags fl = 0 ); + QgsOracleSelectGeoraster( QWidget* parent, QgisInterface* iface, Qt::WindowFlags fl = nullptr ); ~QgsOracleSelectGeoraster(); private: diff --git a/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.cpp b/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.cpp index 1c26cacb652..94dec3ea30f 100644 --- a/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.cpp +++ b/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.cpp @@ -75,16 +75,16 @@ QgsRasterTerrainAnalysisDialog::QgsRasterTerrainAnalysisDialog( DisplayMode mode for ( int i = 0; i < nDrivers; ++i ) { GDALDriverH driver = GDALGetDriver( i ); - if ( driver != NULL ) + if ( driver != nullptr ) { - char** driverMetadata = GDALGetMetadata( driver, NULL ); + char** driverMetadata = GDALGetMetadata( driver, nullptr ); if ( CSLFetchBoolean( driverMetadata, GDAL_DCAP_CREATE, false ) ) { mOutputFormatComboBox->addItem( GDALGetDriverLongName( driver ), QVariant( GDALGetDriverShortName( driver ) ) ); //store the driver shortnames and the corresponding extensions //(just in case the user does not give an extension for the output file name) - QString driverExtension = GDALGetMetadataItem( driver, GDAL_DMD_EXTENSION, NULL ); + QString driverExtension = GDALGetMetadataItem( driver, GDAL_DMD_EXTENSION, nullptr ); mDriverExtensionMap.insert( QString( GDALGetDriverShortName( driver ) ), driverExtension ); } } @@ -212,7 +212,7 @@ void QgsRasterTerrainAnalysisDialog::on_mAutomaticColorButton_clicked() void QgsRasterTerrainAnalysisDialog::on_mExportToCsvButton_clicked() { - QString file = QFileDialog::getSaveFileName( 0, tr( "Export Frequency distribution as csv" ), QDir::homePath() ); + QString file = QFileDialog::getSaveFileName( nullptr, tr( "Export Frequency distribution as csv" ), QDir::homePath() ); if ( file.isEmpty() ) { return; @@ -225,7 +225,7 @@ void QgsRasterTerrainAnalysisDialog::on_mExportToCsvButton_clicked() void QgsRasterTerrainAnalysisDialog::on_mExportColorsButton_clicked() { qWarning( "Export colors clicked" ); - QString file = QFileDialog::getSaveFileName( 0, tr( "Export Colors and elevations as xml" ), QDir::homePath() ); + QString file = QFileDialog::getSaveFileName( nullptr, tr( "Export Colors and elevations as xml" ), QDir::homePath() ); if ( file.isEmpty() ) { return; @@ -259,7 +259,7 @@ void QgsRasterTerrainAnalysisDialog::on_mExportColorsButton_clicked() void QgsRasterTerrainAnalysisDialog::on_mImportColorsButton_clicked() { - QString file = QFileDialog::getOpenFileName( 0, tr( "Import Colors and elevations from xml" ), QDir::homePath() ); + QString file = QFileDialog::getOpenFileName( nullptr, tr( "Import Colors and elevations from xml" ), QDir::homePath() ); if ( file.isEmpty() ) { return; @@ -268,14 +268,14 @@ void QgsRasterTerrainAnalysisDialog::on_mImportColorsButton_clicked() QFile inputFile( file ); if ( !inputFile.open( QIODevice::ReadOnly ) ) { - QMessageBox::critical( 0, tr( "Error opening file" ), tr( "The relief color file could not be opened" ) ); + QMessageBox::critical( nullptr, tr( "Error opening file" ), tr( "The relief color file could not be opened" ) ); return; } QDomDocument doc; if ( !doc.setContent( &inputFile, false ) ) { - QMessageBox::critical( 0, tr( "Error parsing xml" ), tr( "The xml file could not be loaded" ) ); + QMessageBox::critical( nullptr, tr( "Error parsing xml" ), tr( "The xml file could not be loaded" ) ); return; } @@ -298,7 +298,7 @@ void QgsRasterTerrainAnalysisDialog::on_mOutputLayerToolButton_clicked() { QSettings s; QString lastDir = s.value( "/RasterTerrainAnalysis/lastOutputDir", QDir::homePath() ).toString(); - QString saveFileName = QFileDialog::getSaveFileName( 0, tr( "Enter result file" ), lastDir ); + QString saveFileName = QFileDialog::getSaveFileName( nullptr, tr( "Enter result file" ), lastDir ); if ( !saveFileName.isNull() ) { mOutputLayerLineEdit->setText( saveFileName ); @@ -377,7 +377,7 @@ void QgsRasterTerrainAnalysisDialog::on_mReliefClassTreeWidget_itemDoubleClicked if ( column == 0 ) { bool ok; - double d = QInputDialog::getDouble( 0, tr( "Enter lower elevation class bound" ), tr( "Elevation" ), item->text( 0 ).toDouble(), -2147483647, + double d = QInputDialog::getDouble( nullptr, tr( "Enter lower elevation class bound" ), tr( "Elevation" ), item->text( 0 ).toDouble(), -2147483647, 2147483647, 2, &ok ); if ( ok ) { @@ -387,7 +387,7 @@ void QgsRasterTerrainAnalysisDialog::on_mReliefClassTreeWidget_itemDoubleClicked else if ( column == 1 ) { bool ok; - double d = QInputDialog::getDouble( 0, tr( "Enter upper elevation class bound" ), tr( "Elevation" ), item->text( 1 ).toDouble(), -2147483647, + double d = QInputDialog::getDouble( nullptr, tr( "Enter upper elevation class bound" ), tr( "Elevation" ), item->text( 1 ).toDouble(), -2147483647, 2147483647, 2, &ok ); if ( ok ) { @@ -396,7 +396,7 @@ void QgsRasterTerrainAnalysisDialog::on_mReliefClassTreeWidget_itemDoubleClicked } else if ( column == 2 ) { - QColor c = QColorDialog::getColor( item->background( 2 ).color(), 0, tr( "Select color for relief class" ) ); + QColor c = QColorDialog::getColor( item->background( 2 ).color(), nullptr, tr( "Select color for relief class" ) ); if ( c.isValid() ) { item->setBackground( 2, QBrush( c ) ); diff --git a/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.h b/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.h index 5867c4f3f61..844a3386f65 100644 --- a/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.h +++ b/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.h @@ -30,7 +30,7 @@ class QgsRasterTerrainAnalysisDialog: public QDialog, private Ui::QgsRasterTerra ReliefInput }; - QgsRasterTerrainAnalysisDialog( DisplayMode mode = NoParameter, QWidget * parent = 0, Qt::WindowFlags f = 0 ); + QgsRasterTerrainAnalysisDialog( DisplayMode mode = NoParameter, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsRasterTerrainAnalysisDialog(); QList< QgsRelief::ReliefColor > reliefColors() const; diff --git a/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisplugin.cpp b/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisplugin.cpp index b8a217fd315..572ef3f6961 100644 --- a/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisplugin.cpp +++ b/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisplugin.cpp @@ -40,7 +40,7 @@ static const QString version_ = QObject::tr( "Version 0.1" ); static const QString icon_ = ":/raster/dem.png"; static const QString category_ = QObject::tr( "Raster" ); -QgsRasterTerrainAnalysisPlugin::QgsRasterTerrainAnalysisPlugin( QgisInterface* iface ): mIface( iface ), mTerrainAnalysisMenu( 0 ) +QgsRasterTerrainAnalysisPlugin::QgsRasterTerrainAnalysisPlugin( QgisInterface* iface ): mIface( iface ), mTerrainAnalysisMenu( nullptr ) { } @@ -69,7 +69,7 @@ void QgsRasterTerrainAnalysisPlugin::initGui() return; } - QMenu* rasterMenu = 0; + QMenu* rasterMenu = nullptr; QList menuBarActions = menuBar->actions(); QList::iterator menuActionIt = menuBarActions.begin(); for ( ; menuActionIt != menuBarActions.end(); ++menuActionIt ) diff --git a/src/plugins/roadgraph/exportdlg.cpp b/src/plugins/roadgraph/exportdlg.cpp index c25bf56663b..2431a576178 100644 --- a/src/plugins/roadgraph/exportdlg.cpp +++ b/src/plugins/roadgraph/exportdlg.cpp @@ -71,7 +71,7 @@ RgExportDlg::~RgExportDlg() QgsVectorLayer* RgExportDlg::mapLayer() const { - QgsVectorLayer* myLayer = NULL; + QgsVectorLayer* myLayer = nullptr; QString layerId = mcbLayers->itemData( mcbLayers->currentIndex() ).toString(); if ( layerId == "-1" ) @@ -80,8 +80,8 @@ QgsVectorLayer* RgExportDlg::mapLayer() const myLayer = new QgsVectorLayer( QString( "LineString?crs=epsg:4326&memoryid=%1" ).arg( QUuid::createUuid().toString() ), "shortest path", "memory" ); QgsVectorDataProvider *prov = myLayer->dataProvider(); - if ( prov == NULL ) - return NULL; + if ( prov == nullptr ) + return nullptr; QList attrList; attrList.append( QgsField( "length", QVariant::Double, "", 20, 8 ) ); diff --git a/src/plugins/roadgraph/exportdlg.h b/src/plugins/roadgraph/exportdlg.h index a2b7565d715..664a1cf70cc 100644 --- a/src/plugins/roadgraph/exportdlg.h +++ b/src/plugins/roadgraph/exportdlg.h @@ -36,7 +36,7 @@ class RgExportDlg : public QDialog { Q_OBJECT public: - RgExportDlg( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); + RgExportDlg( QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr ); ~RgExportDlg(); public: diff --git a/src/plugins/roadgraph/linevectorlayersettings.cpp b/src/plugins/roadgraph/linevectorlayersettings.cpp index 49736098031..2b71e3550c3 100644 --- a/src/plugins/roadgraph/linevectorlayersettings.cpp +++ b/src/plugins/roadgraph/linevectorlayersettings.cpp @@ -109,7 +109,7 @@ QWidget* RgLineVectorLayerSettings::getGui( QWidget *parent ) void RgLineVectorLayerSettings::setFromGui( QWidget *myGui ) { RgLineVectorLayerSettingsWidget* w = dynamic_cast( myGui ); - if ( w == NULL ) + if ( w == nullptr ) return; mFirstPointToLastPointDirectionVal = w->mleFirstPointToLastPointDirection->text(); diff --git a/src/plugins/roadgraph/linevectorlayerwidget.cpp b/src/plugins/roadgraph/linevectorlayerwidget.cpp index 30692fe1127..3db8774f3c1 100644 --- a/src/plugins/roadgraph/linevectorlayerwidget.cpp +++ b/src/plugins/roadgraph/linevectorlayerwidget.cpp @@ -190,7 +190,7 @@ QgsVectorLayer* RgLineVectorLayerSettingsWidget::selectedLayer() return vl; } - return NULL; + return nullptr; } // RgLineVectorLayerSettingsWidget::setlectedLayer() void RgLineVectorLayerSettingsWidget::on_mcbLayers_selectItem() diff --git a/src/plugins/roadgraph/linevectorlayerwidget.h b/src/plugins/roadgraph/linevectorlayerwidget.h index 5d8d8fe8b5f..ba149cee863 100644 --- a/src/plugins/roadgraph/linevectorlayerwidget.h +++ b/src/plugins/roadgraph/linevectorlayerwidget.h @@ -40,7 +40,7 @@ class RgLineVectorLayerSettingsWidget : public QWidget { Q_OBJECT public: - RgLineVectorLayerSettingsWidget( RgLineVectorLayerSettings *s, QWidget* parent = 0 ); + RgLineVectorLayerSettingsWidget( RgLineVectorLayerSettings *s, QWidget* parent = nullptr ); private slots: void on_mcbLayers_selectItem(); diff --git a/src/plugins/roadgraph/roadgraphplugin.cpp b/src/plugins/roadgraph/roadgraphplugin.cpp index f767e4d9503..8b5e4ba2ef0 100644 --- a/src/plugins/roadgraph/roadgraphplugin.cpp +++ b/src/plugins/roadgraph/roadgraphplugin.cpp @@ -77,8 +77,8 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI; RoadGraphPlugin::RoadGraphPlugin( QgisInterface * theQgisInterface ) : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) , mQGisIface( theQgisInterface ) - , mQSettingsAction( 0 ) - , mQShortestPathDock( 0 ) + , mQSettingsAction( nullptr ) + , mQShortestPathDock( nullptr ) { mSettings = new RgLineVectorLayerSettings(); mTimeUnitName = "h"; @@ -200,7 +200,7 @@ QgisInterface* RoadGraphPlugin::iface() const QgsGraphDirector* RoadGraphPlugin::director() const { QString layerId; - QgsVectorLayer *layer = NULL; + QgsVectorLayer *layer = nullptr; QMap< QString, QgsMapLayer* > mapLayers = QgsMapLayerRegistry::instance()->mapLayers(); QMap< QString, QgsMapLayer* >::const_iterator it; for ( it = mapLayers.begin(); it != mapLayers.end(); ++it ) @@ -210,14 +210,14 @@ const QgsGraphDirector* RoadGraphPlugin::director() const layer = dynamic_cast< QgsVectorLayer* >( it.value() ); break; } - if ( layer == NULL ) - return NULL; + if ( layer == nullptr ) + return nullptr; if ( layer->wkbType() == QGis::WKBLineString || layer->wkbType() == QGis::WKBMultiLineString ) { QgsVectorDataProvider *provider = layer->dataProvider(); - if ( provider == NULL ) - return NULL; + if ( provider == nullptr ) + return nullptr; SpeedUnit speedUnit = SpeedUnit::byName( mSettings->mSpeedUnitName ); QgsLineVectorLayerDirector * director = @@ -233,7 +233,7 @@ const QgsGraphDirector* RoadGraphPlugin::director() const mSettings->mDefaultSpeed, speedUnit.multipler() ) ); return director; } - return NULL; + return nullptr; } QString RoadGraphPlugin::timeUnitName() diff --git a/src/plugins/roadgraph/settingsdlg.h b/src/plugins/roadgraph/settingsdlg.h index f1265a978d9..8c363022085 100644 --- a/src/plugins/roadgraph/settingsdlg.h +++ b/src/plugins/roadgraph/settingsdlg.h @@ -37,7 +37,7 @@ class RgSettingsDlg : public QDialog { Q_OBJECT public: - RgSettingsDlg( RgSettings *settings, QWidget* parent = 0, Qt::WindowFlags fl = 0 ); + RgSettingsDlg( RgSettings *settings, QWidget* parent = nullptr, Qt::WindowFlags fl = nullptr ); ~RgSettingsDlg(); QString timeUnitName(); diff --git a/src/plugins/roadgraph/shortestpathwidget.cpp b/src/plugins/roadgraph/shortestpathwidget.cpp index 5c78c4cb761..ccc4fc8393b 100644 --- a/src/plugins/roadgraph/shortestpathwidget.cpp +++ b/src/plugins/roadgraph/shortestpathwidget.cpp @@ -64,8 +64,8 @@ RgShortestPathWidget::RgShortestPathWidget( QWidget* theParent, RoadGraphPlugin setWidget( myWidget ); QVBoxLayout *v = new QVBoxLayout( myWidget ); - QHBoxLayout *h = NULL; - QLabel *l = NULL; + QHBoxLayout *h = nullptr; + QLabel *l = nullptr; l = new QLabel( tr( "Start" ), myWidget ); v->addWidget( l ); @@ -237,7 +237,7 @@ QgsGraph* RgShortestPathWidget::getPath( QgsPoint& p1, QgsPoint& p2 ) if ( mFrontPointLineEdit->text().isNull() || mBackPointLineEdit->text().isNull() ) { QMessageBox::critical( this, tr( "Point not selected" ), tr( "First, select start and stop points." ) ); - return NULL; + return nullptr; } QgsGraphBuilder builder( @@ -246,10 +246,10 @@ QgsGraph* RgShortestPathWidget::getPath( QgsPoint& p1, QgsPoint& p2 ) mPlugin->topologyToleranceFactor() ); { const QgsGraphDirector *director = mPlugin->director(); - if ( director == NULL ) + if ( director == nullptr ) { QMessageBox::critical( this, tr( "Plugin isn't configured" ), tr( "Plugin isn't configured!" ) ); - return NULL; + return nullptr; } connect( director, SIGNAL( buildProgress( int, int ) ), mPlugin->iface()->mainWindow(), SLOT( showProgress( int, int ) ) ); connect( director, SIGNAL( buildMessage( QString ) ), mPlugin->iface()->mainWindow(), SLOT( showStatusMessage( QString ) ) ); @@ -270,12 +270,12 @@ QgsGraph* RgShortestPathWidget::getPath( QgsPoint& p1, QgsPoint& p2 ) if ( p1 == QgsPoint( 0.0, 0.0 ) ) { QMessageBox::critical( this, tr( "Tie point failed" ), tr( "Start point doesn't tie to the road!" ) ); - return NULL; + return nullptr; } if ( p2 == QgsPoint( 0.0, 0.0 ) ) { QMessageBox::critical( this, tr( "Tie point failed" ), tr( "Stop point doesn't tie to the road!" ) ); - return NULL; + return nullptr; } QgsGraph *graph = builder.graph(); @@ -291,7 +291,7 @@ QgsGraph* RgShortestPathWidget::getPath( QgsPoint& p1, QgsPoint& p2 ) ); delete graph; - return NULL; + return nullptr; } int criterionNum = 0; @@ -308,7 +308,7 @@ QgsGraph* RgShortestPathWidget::getPath( QgsPoint& p1, QgsPoint& p2 ) ); delete graph; - return NULL; + return nullptr; } @@ -319,7 +319,7 @@ QgsGraph* RgShortestPathWidget::getPath( QgsPoint& p1, QgsPoint& p2 ) { delete shortestpathTree; QMessageBox::critical( this, tr( "Path not found" ), tr( "Path not found" ) ); - return NULL; + return nullptr; } return shortestpathTree; } @@ -328,7 +328,7 @@ void RgShortestPathWidget::findingPath() { QgsPoint p1, p2; QgsGraph *path = getPath( p1, p2 ); - if ( path == NULL ) + if ( path == nullptr ) return; mrbPath->reset( QGis::Line ); @@ -391,12 +391,12 @@ void RgShortestPathWidget::exportPath() return; QgsVectorLayer *vl = dlg.mapLayer(); - if ( vl == NULL ) + if ( vl == nullptr ) return; QgsPoint p1, p2; QgsGraph *path = getPath( p1, p2 ); - if ( path == NULL ) + if ( path == nullptr ) return; QgsCoordinateTransform ct( mPlugin->iface()->mapCanvas()->mapSettings().destinationCrs(), diff --git a/src/plugins/spatialquery/qgsgeometrycoordinatetransform.cpp b/src/plugins/spatialquery/qgsgeometrycoordinatetransform.cpp index ef18ae60aae..f1a882a55ca 100644 --- a/src/plugins/spatialquery/qgsgeometrycoordinatetransform.cpp +++ b/src/plugins/spatialquery/qgsgeometrycoordinatetransform.cpp @@ -21,8 +21,8 @@ #include "qgscoordinatereferencesystem.h" QgsGeometryCoordinateTransform::QgsGeometryCoordinateTransform() - : mCoordTransform( NULL ) - , mFuncTransform( NULL ) + : mCoordTransform( nullptr ) + , mFuncTransform( nullptr ) { } diff --git a/src/plugins/spatialquery/qgsspatialquery.cpp b/src/plugins/spatialquery/qgsspatialquery.cpp index 8cbab3d294b..561258059e4 100644 --- a/src/plugins/spatialquery/qgsspatialquery.cpp +++ b/src/plugins/spatialquery/qgsspatialquery.cpp @@ -25,9 +25,9 @@ QgsSpatialQuery::QgsSpatialQuery( MngProgressBar *pb ) : mPb( pb ) - , mReaderFeaturesTarget( NULL ) - , mLayerTarget( NULL ) - , mLayerReference( NULL ) + , mReaderFeaturesTarget( nullptr ) + , mLayerTarget( nullptr ) + , mLayerReference( nullptr ) { mUseTargetSelection = mUseReferenceSelection = false; } // QgsSpatialQuery::QgsSpatialQuery(MngProgressBar *pb) @@ -179,7 +179,7 @@ bool QgsSpatialQuery::hasValidGeometry( QgsFeature &feature ) const QgsGeometry *geom = feature.constGeometry(); - if ( NULL == geom ) + if ( nullptr == geom ) { return false; } diff --git a/src/plugins/spatialquery/qgsspatialquerydialog.cpp b/src/plugins/spatialquery/qgsspatialquerydialog.cpp index a6da7eb068b..f52b1f342c2 100644 --- a/src/plugins/spatialquery/qgsspatialquerydialog.cpp +++ b/src/plugins/spatialquery/qgsspatialquerydialog.cpp @@ -39,7 +39,7 @@ QgsSpatialQueryDialog::QgsSpatialQueryDialog( QWidget* parent, QgisInterface* if QSettings settings; restoreGeometry( settings.value( "SpatialQuery/geometry" ).toByteArray() ); - mLayerReference = mLayerTarget = NULL; + mLayerReference = mLayerTarget = nullptr; mIface = iface; mRubberSelectId = new QgsRubberSelectId( iface->mapCanvas() ); @@ -65,8 +65,8 @@ bool QgsSpatialQueryDialog::hasPossibleQuery( QString &msg ) // Count the number of vector layer QMap layers = QgsMapLayerRegistry::instance()->mapLayers(); QMapIterator item( layers ); - QgsMapLayer * mapLayer = NULL; - QgsVectorLayer * lyr = NULL; + QgsMapLayer * mapLayer = nullptr; + QgsVectorLayer * lyr = nullptr; unsigned int totalVector = 0; while ( item.hasNext() ) { @@ -147,8 +147,8 @@ void QgsSpatialQueryDialog::setLayer( bool isTarget, int index ) void QgsSpatialQueryDialog::evaluateCheckBoxLayer( bool isTarget ) { - QgsVectorLayer* lyr = NULL; - QCheckBox* checkbox = NULL; + QgsVectorLayer* lyr = nullptr; + QCheckBox* checkbox = nullptr; if ( isTarget ) { lyr = mLayerTarget; @@ -305,8 +305,8 @@ bool QgsSpatialQueryDialog::addLayerSubset( const QString& name, const QString& QString QgsSpatialQueryDialog::getDescriptionLayerShow( bool isTarget ) { - QgsVectorLayer* lyr = NULL; - QCheckBox * checkBox = NULL; + QgsVectorLayer* lyr = nullptr; + QCheckBox * checkBox = nullptr; if ( isTarget ) { lyr = mLayerTarget; @@ -327,8 +327,8 @@ QString QgsSpatialQueryDialog::getDescriptionLayerShow( bool isTarget ) QString QgsSpatialQueryDialog::getDescriptionInvalidFeaturesShow( bool isTarget ) { - QgsVectorLayer* lyr = NULL; - QCheckBox* checkBox = NULL; + QgsVectorLayer* lyr = nullptr; + QCheckBox* checkBox = nullptr; int totalInvalid = 0; if ( isTarget ) { @@ -385,7 +385,7 @@ void QgsSpatialQueryDialog::reject() disconnectAll(); mRubberSelectId->reset(); - mLayerTarget = mLayerReference = NULL; + mLayerTarget = mLayerReference = nullptr; mFeatureResult.clear(); mFeatureInvalidTarget.clear(); mFeatureInvalidReference.clear(); @@ -476,7 +476,7 @@ void QgsSpatialQueryDialog::removeLayer( bool isTarget, QgsVectorLayer* lyr ) } if ( lyr == lyrThis ) { - lyrThis = NULL; + lyrThis = nullptr; if ( cmb->count() > 0 ) { cmb->setCurrentIndex( 0 ); @@ -534,8 +534,8 @@ void QgsSpatialQueryDialog::populateCbTargetLayer() QMap layers = QgsMapLayerRegistry::instance()->mapLayers(); QMapIterator item( layers ); - QgsMapLayer * mapLayer = NULL; - QgsVectorLayer * lyr = NULL; + QgsMapLayer * mapLayer = nullptr; + QgsVectorLayer * lyr = nullptr; QString layerId; while ( item.hasNext() ) { @@ -567,7 +567,7 @@ void QgsSpatialQueryDialog::populateCbReferenceLayer() QString itemText; QVariant itemData; QIcon itemIcon; - QgsVectorLayer * lyr = NULL; + QgsVectorLayer * lyr = nullptr; int idNew = 0; for ( int id = 0; id < cbTargetLayer->count(); id++ ) { @@ -660,7 +660,7 @@ void QgsSpatialQueryDialog::changeLwFeature( QgsVectorLayer* lyr, QgsFeatureId f void QgsSpatialQueryDialog::zoomFeature( QgsVectorLayer* lyr, QgsFeatureId fid ) { - static QgsVectorLayer* lyrCheck = NULL; + static QgsVectorLayer* lyrCheck = nullptr; static bool hasMsg = false; if ( ! lyrCheck || lyrCheck != lyr ) { @@ -734,12 +734,12 @@ void QgsSpatialQueryDialog::apply() { if ( ! mLayerReference ) { - QMessageBox::warning( 0, tr( "Missing reference layer" ), tr( "Select reference layer!" ), QMessageBox::Ok ); + QMessageBox::warning( nullptr, tr( "Missing reference layer" ), tr( "Select reference layer!" ), QMessageBox::Ok ); return; } if ( ! mLayerTarget ) { - QMessageBox::warning( 0, tr( "Missing target layer" ), tr( "Select target layer!" ), QMessageBox::Ok ); + QMessageBox::warning( nullptr, tr( "Missing target layer" ), tr( "Select target layer!" ), QMessageBox::Ok ); return; } @@ -795,7 +795,7 @@ void QgsSpatialQueryDialog::on_bbMain_clicked( QAbstractButton * button ) void QgsSpatialQueryDialog::on_pbCreateLayerItems_clicked() { TypeItems typeItem = ( TypeItems ) cbTypeItems->itemData( cbTypeItems->currentIndex() ).toInt(); - QgsFeatureIds *fids = 0; + QgsFeatureIds *fids = nullptr; switch ( typeItem ) { case itemsResult: @@ -899,7 +899,7 @@ void QgsSpatialQueryDialog::on_cbTypeItems_currentIndexChanged( int index ) QVariant qtypItem = cbTypeItems->itemData( index ); TypeItems typeItem = ( TypeItems ) qtypItem.toInt(); - QgsFeatureIds *setItems = 0; + QgsFeatureIds *setItems = nullptr; int totalFeat = mLayerTarget->featureCount(); switch ( typeItem ) { @@ -924,7 +924,7 @@ void QgsSpatialQueryDialog::on_cbTypeItems_currentIndexChanged( int index ) { // Populate lwFeatures QSetIterator item( *setItems ); - QListWidgetItem *lwItem = NULL; + QListWidgetItem *lwItem = nullptr; while ( item.hasNext() ) { lwItem = new QListWidgetItem( lwFeatures ); @@ -1053,10 +1053,10 @@ void QgsSpatialQueryDialog::signal_qgis_layerWillBeRemoved( const QString& idLay visibleResult( false ); } - mLayerReference = NULL; + mLayerReference = nullptr; if ( cbTargetLayer->count() < 1 ) { - mLayerTarget = NULL; + mLayerTarget = nullptr; } } else if ( mLayerTarget ) diff --git a/src/plugins/spatialquery/qgsspatialquerydialog.h b/src/plugins/spatialquery/qgsspatialquerydialog.h index 9781d7a75be..92df133eb13 100644 --- a/src/plugins/spatialquery/qgsspatialquerydialog.h +++ b/src/plugins/spatialquery/qgsspatialquerydialog.h @@ -39,7 +39,7 @@ class QgsSpatialQueryDialog : public QDialog, private Ui::QgsSpatialQueryDialogB * QGIS when it attempts to instantiate the plugin. * @param iface Pointer to the QgisInterface object. */ - QgsSpatialQueryDialog( QWidget *parent = 0, QgisInterface* iface = 0 ); + QgsSpatialQueryDialog( QWidget *parent = nullptr, QgisInterface* iface = nullptr ); //! Destructor ~QgsSpatialQueryDialog(); diff --git a/src/plugins/spatialquery/qgsspatialqueryplugin.cpp b/src/plugins/spatialquery/qgsspatialqueryplugin.cpp index 02e981fcd12..a98497dcfc8 100644 --- a/src/plugins/spatialquery/qgsspatialqueryplugin.cpp +++ b/src/plugins/spatialquery/qgsspatialqueryplugin.cpp @@ -55,9 +55,9 @@ static const QString icon_ = ":/icons/spatialquery.png"; */ QgsSpatialQueryPlugin::QgsSpatialQueryPlugin( QgisInterface* iface ) : QgisPlugin( name_, description_, category_, version_, type_ ) - , mDialog( 0 ) + , mDialog( nullptr ) , mIface( iface ) - , mSpatialQueryAction( 0 ) + , mSpatialQueryAction( nullptr ) { } @@ -97,9 +97,9 @@ void QgsSpatialQueryPlugin::unload() mIface->removePluginVectorMenu( tr( "&Spatial Query" ), mSpatialQueryAction ); delete mSpatialQueryAction; - mSpatialQueryAction = 0; + mSpatialQueryAction = nullptr; delete mDialog; - mDialog = NULL; + mDialog = nullptr; } void QgsSpatialQueryPlugin::run() @@ -121,7 +121,7 @@ void QgsSpatialQueryPlugin::run() if ( !mDialog->isVisible() ) { delete mDialog; - mDialog = NULL; + mDialog = nullptr; run(); } else @@ -157,7 +157,7 @@ QIcon QgsSpatialQueryPlugin::getThemeIcon( const QString &theName ) void QgsSpatialQueryPlugin::MsgDEBUG( QString sMSg ) { - QMessageBox::warning( 0, tr( "DEBUG" ), sMSg, QMessageBox::Ok ); + QMessageBox::warning( nullptr, tr( "DEBUG" ), sMSg, QMessageBox::Ok ); } diff --git a/src/plugins/topology/checkDock.cpp b/src/plugins/topology/checkDock.cpp index 3b8c009f28e..43b915a6a4d 100644 --- a/src/plugins/topology/checkDock.cpp +++ b/src/plugins/topology/checkDock.cpp @@ -75,9 +75,9 @@ checkDock::checkDock( QgisInterface* qIface, QWidget* parent ) mRBFeature2->setWidth( 5 ); mRBConflict->setWidth( 5 ); - mVMConflict = 0; - mVMFeature1 = 0; - mVMFeature2 = 0; + mVMConflict = nullptr; + mVMFeature1 = nullptr; + mVMFeature2 = nullptr; connect( actionConfigure, SIGNAL( triggered() ), this, SLOT( configure() ) ); connect( actionValidateAll, SIGNAL( triggered() ), this, SLOT( validateAll() ) ); @@ -111,17 +111,17 @@ void checkDock::clearVertexMarkers() if ( mVMConflict ) { delete mVMConflict; - mVMConflict = 0; + mVMConflict = nullptr; } if ( mVMFeature1 ) { delete mVMFeature1; - mVMFeature1 = 0; + mVMFeature1 = nullptr; } if ( mVMFeature2 ) { delete mVMFeature2; - mVMFeature2 = 0; + mVMFeature2 = nullptr; } } @@ -337,7 +337,7 @@ void checkDock::runTests( ValidateType type ) } QgsVectorLayer* layer1 = ( QgsVectorLayer* )mLayerRegistry->mapLayers()[layer1Str]; - QgsVectorLayer* layer2 = 0; + QgsVectorLayer* layer2 = nullptr; if (( QgsVectorLayer* )mLayerRegistry->mapLayers().contains( layer2Str ) ) layer2 = ( QgsVectorLayer* )mLayerRegistry->mapLayers()[layer2Str]; @@ -353,7 +353,7 @@ void checkDock::runTests( ValidateType type ) QList::Iterator it; - QgsRubberBand* rb = 0; + QgsRubberBand* rb = nullptr; for ( it = errors.begin(); it != errors.end(); ++it ) { TopolError* te = *it; diff --git a/src/plugins/topology/checkDock.h b/src/plugins/topology/checkDock.h index 9f842a4e3f6..e6457ddddbd 100644 --- a/src/plugins/topology/checkDock.h +++ b/src/plugins/topology/checkDock.h @@ -49,7 +49,7 @@ class checkDock : public QDockWidget, private Ui::checkDock * @param qIface pointer to QgisInterface instance that is passed to the rulesDialog * @param parent parent object */ - checkDock( QgisInterface* qIface, QWidget *parent = 0 ); + checkDock( QgisInterface* qIface, QWidget *parent = nullptr ); ~checkDock(); private slots: diff --git a/src/plugins/topology/dockModel.cpp b/src/plugins/topology/dockModel.cpp index c1b21883f4a..6c3b01d0fe7 100644 --- a/src/plugins/topology/dockModel.cpp +++ b/src/plugins/topology/dockModel.cpp @@ -18,7 +18,7 @@ #include "dockModel.h" #include "topolError.h" -DockModel::DockModel( ErrorList& theErrorList, QObject *parent = 0 ) : mErrorlist( theErrorList ) +DockModel::DockModel( ErrorList& theErrorList, QObject *parent = nullptr ) : mErrorlist( theErrorList ) { Q_UNUSED( parent ); mHeader << QObject::tr( "Error" ) << QObject::tr( "Layer" ) << QObject::tr( "Feature ID" ); diff --git a/src/plugins/topology/topol.cpp b/src/plugins/topology/topol.cpp index 32b25e07490..f4e8878990c 100644 --- a/src/plugins/topology/topol.cpp +++ b/src/plugins/topology/topol.cpp @@ -51,9 +51,9 @@ static const QString sPluginIcon = ":/topology/mActionTopologyChecker.svg"; Topol::Topol( QgisInterface * theQgisInterface ) : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) , mQGisIface( theQgisInterface ) - , mQActionPointer( 0 ) + , mQActionPointer( nullptr ) { - mDock = 0; + mDock = nullptr; } Topol::~Topol() diff --git a/src/plugins/topology/topolError.h b/src/plugins/topology/topolError.h index 55e71e0917b..d53b45e5cb1 100644 --- a/src/plugins/topology/topolError.h +++ b/src/plugins/topology/topolError.h @@ -30,7 +30,7 @@ class FeatureLayer { public: FeatureLayer() : - layer( 0 ), feature( QgsFeature() ) {} + layer( nullptr ), feature( QgsFeature() ) {} /** * Constructor * @param theLayer layer pointer diff --git a/src/plugins/topology/topolTest.cpp b/src/plugins/topology/topolTest.cpp index f678a29c994..f574d692951 100644 --- a/src/plugins/topology/topolTest.cpp +++ b/src/plugins/topology/topolTest.cpp @@ -663,7 +663,7 @@ ErrorList topolTest::checkGaps( double tolerance, QgsVectorLayer *layer1, QgsVec return errorList; } - GEOSGeometry* collection = 0; + GEOSGeometry* collection = nullptr; collection = GEOSGeom_createCollection_r( geosctxt, GEOS_MULTIPOLYGON, geomArray, geomList.size() ); @@ -1657,7 +1657,7 @@ QgsSpatialIndex* topolTest::createIndex( QgsVectorLayer* layer, const QgsRectang if ( testCancelled() ) { delete index; - return 0; + return nullptr; } if ( f.constGeometry() ) diff --git a/src/plugins/topology/topolTest.h b/src/plugins/topology/topolTest.h index b9dd94ab3dc..ec618e42d8c 100644 --- a/src/plugins/topology/topolTest.h +++ b/src/plugins/topology/topolTest.h @@ -59,7 +59,7 @@ class TopologyRule * Constructor * initializes the test to use both layers and not to use the tolerance */ - explicit TopologyRule( testFunction f0 = 0, + explicit TopologyRule( testFunction f0 = nullptr, bool useSecondLayer0 = true, bool useTolerance0 = false, bool useSpatialIndex0 = false, diff --git a/src/plugins/zonal_statistics/qgszonalstatisticsdialog.cpp b/src/plugins/zonal_statistics/qgszonalstatisticsdialog.cpp index b075a76e77d..e83008c3e18 100644 --- a/src/plugins/zonal_statistics/qgszonalstatisticsdialog.cpp +++ b/src/plugins/zonal_statistics/qgszonalstatisticsdialog.cpp @@ -91,7 +91,7 @@ QgsZonalStatisticsDialog::QgsZonalStatisticsDialog( QgisInterface* iface ): QDia mColumnPrefixLineEdit->setText( proposeAttributePrefix() ); } -QgsZonalStatisticsDialog::QgsZonalStatisticsDialog(): QDialog( 0 ), mIface( 0 ) +QgsZonalStatisticsDialog::QgsZonalStatisticsDialog(): QDialog( nullptr ), mIface( nullptr ) { setupUi( this ); @@ -143,7 +143,7 @@ QgsRasterLayer* QgsZonalStatisticsDialog::rasterLayer() const int index = mRasterLayerComboBox->currentIndex(); if ( index == -1 ) { - return 0; + return nullptr; } QString id = mRasterLayerComboBox->itemData( index ).toString(); QgsRasterLayer* layer = dynamic_cast( QgsMapLayerRegistry::instance()->mapLayer( id ) ); @@ -166,7 +166,7 @@ QgsVectorLayer* QgsZonalStatisticsDialog::polygonLayer() const int index = mPolygonLayerComboBox->currentIndex(); if ( index == -1 ) { - return 0; + return nullptr; } return dynamic_cast( QgsMapLayerRegistry::instance()->mapLayer( mPolygonLayerComboBox->itemData( index ).toString() ) ); } @@ -178,7 +178,7 @@ QString QgsZonalStatisticsDialog::attributePrefix() const QgsZonalStatistics::Statistics QgsZonalStatisticsDialog::selectedStats() const { - QgsZonalStatistics::Statistics stats = 0; + QgsZonalStatistics::Statistics stats = nullptr; for ( int i = 0; i < mStatsListWidget->count(); ++i ) { QListWidgetItem* item = mStatsListWidget->item( i ); diff --git a/src/plugins/zonal_statistics/qgszonalstatisticsplugin.cpp b/src/plugins/zonal_statistics/qgszonalstatisticsplugin.cpp index 0dd6819c5e5..2995eb94ae4 100644 --- a/src/plugins/zonal_statistics/qgszonalstatisticsplugin.cpp +++ b/src/plugins/zonal_statistics/qgszonalstatisticsplugin.cpp @@ -31,7 +31,7 @@ static const QString pluginIcon_ = ":/zonal_statistics/raster-stats.png"; QgsZonalStatisticsPlugin::QgsZonalStatisticsPlugin( QgisInterface* iface ) : mIface( iface ) - , mAction( 0 ) + , mAction( nullptr ) { } @@ -43,7 +43,7 @@ void QgsZonalStatisticsPlugin::initGui() { delete mAction; - mAction = new QAction( QIcon( ":/zonal_statistics/raster-stats.png" ), tr( "&Zonal statistics" ), 0 ); + mAction = new QAction( QIcon( ":/zonal_statistics/raster-stats.png" ), tr( "&Zonal statistics" ), nullptr ); mAction->setObjectName( "ZonalStatistics" ); QObject::connect( mAction, SIGNAL( triggered() ), this, SLOT( run() ) ); mIface->addRasterToolBarIcon( mAction ); diff --git a/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp b/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp index 432bddb7f91..8284c84409c 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp @@ -288,7 +288,7 @@ bool QgsDelimitedTextFeatureIterator::nextFeatureInternal( QgsFeature& feature ) while ( tokens.size() < mSource->mFieldCount ) tokens.append( QString::null ); - QgsGeometry *geom = 0; + QgsGeometry *geom = nullptr; // Load the geometry if required @@ -368,12 +368,12 @@ bool QgsDelimitedTextFeatureIterator::setNextFeatureId( qint64 fid ) QgsGeometry* QgsDelimitedTextFeatureIterator::loadGeometryWkt( const QStringList& tokens, bool &isNull ) { - QgsGeometry* geom = 0; + QgsGeometry* geom = nullptr; QString sWkt = tokens[mSource->mWktFieldIndex]; if ( sWkt.isEmpty() ) { isNull = true; - return 0; + return nullptr; } isNull = false; @@ -382,12 +382,12 @@ QgsGeometry* QgsDelimitedTextFeatureIterator::loadGeometryWkt( const QStringList if ( geom && geom->type() != mSource->mGeometryType ) { delete geom; - geom = 0; + geom = nullptr; } if ( geom && ! wantGeometry( geom ) ) { delete geom; - geom = 0; + geom = nullptr; } return geom; } @@ -399,7 +399,7 @@ QgsGeometry* QgsDelimitedTextFeatureIterator::loadGeometryXY( const QStringList& if ( sX.isEmpty() && sY.isEmpty() ) { isNull = true; - return 0; + return nullptr; } isNull = false; QgsPoint pt; @@ -409,7 +409,7 @@ QgsGeometry* QgsDelimitedTextFeatureIterator::loadGeometryXY( const QStringList& { return QgsGeometry::fromPoint( pt ); } - return 0; + return nullptr; } @@ -470,13 +470,13 @@ void QgsDelimitedTextFeatureIterator::fetchAttribute( QgsFeature& feature, int f QgsDelimitedTextFeatureSource::QgsDelimitedTextFeatureSource( const QgsDelimitedTextProvider* p ) : mGeomRep( p->mGeomRep ) - , mSubsetExpression( p->mSubsetExpression ? new QgsExpression( p->mSubsetExpression->expression() ) : 0 ) + , mSubsetExpression( p->mSubsetExpression ? new QgsExpression( p->mSubsetExpression->expression() ) : nullptr ) , mExtent( p->mExtent ) , mUseSpatialIndex( p->mUseSpatialIndex ) - , mSpatialIndex( p->mSpatialIndex ? new QgsSpatialIndex( *p->mSpatialIndex ) : 0 ) + , mSpatialIndex( p->mSpatialIndex ? new QgsSpatialIndex( *p->mSpatialIndex ) : nullptr ) , mUseSubsetIndex( p->mUseSubsetIndex ) , mSubsetIndex( p->mSubsetIndex ) - , mFile( 0 ) + , mFile( nullptr ) , mFields( p->attributeFields ) , mFieldCount( p->mFieldCount ) , mXFieldIndex( p->mXFieldIndex ) diff --git a/src/providers/delimitedtext/qgsdelimitedtextfile.cpp b/src/providers/delimitedtext/qgsdelimitedtextfile.cpp index 332d046ebd5..c83c3cbd754 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextfile.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextfile.cpp @@ -33,10 +33,10 @@ QgsDelimitedTextFile::QgsDelimitedTextFile( const QString& url ) : mFileName( QString() ), mEncoding( "UTF-8" ), - mFile( 0 ), - mStream( 0 ), + mFile( nullptr ), + mStream( nullptr ), mUseWatcher( true ), - mWatcher( 0 ), + mWatcher( nullptr ), mDefinitionValid( false ), mUseHeader( true ), mDiscardEmptyFields( false ), @@ -71,17 +71,17 @@ void QgsDelimitedTextFile::close() if ( mStream ) { delete mStream; - mStream = 0; + mStream = nullptr; } if ( mFile ) { delete mFile; - mFile = 0; + mFile = nullptr; } if ( mWatcher ) { delete mWatcher; - mWatcher = 0; + mWatcher = nullptr; } mLineNumber = -1; mRecordLineNumber = -1; @@ -100,7 +100,7 @@ bool QgsDelimitedTextFile::open() { QgsDebugMsg( "Data file " + mFileName + " could not be opened" ); delete mFile; - mFile = 0; + mFile = nullptr; } if ( mFile ) { @@ -118,7 +118,7 @@ bool QgsDelimitedTextFile::open() } } } - return mFile != 0; + return mFile != nullptr; } void QgsDelimitedTextFile::updateFile() diff --git a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp index 633756eff96..3c1df56e918 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp @@ -61,7 +61,7 @@ QgsDelimitedTextProvider::QgsDelimitedTextProvider( const QString& uri ) : QgsVectorDataProvider( uri ) , mLayerValid( false ) , mValid( false ) - , mFile( 0 ) + , mFile( nullptr ) , mGeomRep( GeomNone ) , mFieldCount( 0 ) , mXFieldIndex( -1 ) @@ -71,7 +71,7 @@ QgsDelimitedTextProvider::QgsDelimitedTextProvider( const QString& uri ) , mWktHasPrefix( false ) , mXyDms( false ) , mSubsetString( "" ) - , mSubsetExpression( 0 ) + , mSubsetExpression( nullptr ) , mBuildSubsetIndex( true ) , mUseSubsetIndex( false ) , mMaxInvalidLines( 50 ) @@ -81,7 +81,7 @@ QgsDelimitedTextProvider::QgsDelimitedTextProvider( const QString& uri ) , mWkbType( QGis::WKBNoGeometry ) , mGeometryType( QGis::UnknownGeometry ) , mBuildSpatialIndex( false ) - , mSpatialIndex( 0 ) + , mSpatialIndex( nullptr ) { // Add supported types to enable creating expression fields in field calculator @@ -179,18 +179,18 @@ QgsDelimitedTextProvider::~QgsDelimitedTextProvider() if ( mFile ) { delete mFile; - mFile = 0; + mFile = nullptr; } if ( mSubsetExpression ) { delete mSubsetExpression; - mSubsetExpression = 0; + mSubsetExpression = nullptr; } if ( mSpatialIndex ) { delete mSpatialIndex; - mSpatialIndex = 0; + mSpatialIndex = nullptr; } } @@ -295,7 +295,7 @@ void QgsDelimitedTextProvider::resetIndexes() mSubsetIndex.clear(); if ( mSpatialIndex ) delete mSpatialIndex; - mSpatialIndex = 0; + mSpatialIndex = nullptr; if ( mBuildSpatialIndex && mGeomRep != GeomNone ) mSpatialIndex = new QgsSpatialIndex(); } @@ -338,7 +338,7 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes ) // Initiallize indexes resetIndexes(); - bool buildSpatialIndex = buildIndexes && mSpatialIndex != 0; + bool buildSpatialIndex = buildIndexes && mSpatialIndex != nullptr; // No point building a subset index if there is no geometry, as all // records will be included. @@ -444,7 +444,7 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes ) // if compatible with the rest of file, add to the extents QString sWkt = parts[mWktFieldIndex]; - QgsGeometry *geom = 0; + QgsGeometry *geom = nullptr; if ( !mWktHasPrefix && sWkt.indexOf( WktPrefixRegexp ) >= 0 ) mWktHasPrefix = true; if ( !mWktHasZM && sWkt.indexOf( WktZMRegexp ) >= 0 ) @@ -481,7 +481,7 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes ) mSpatialIndex->insertFeature( f ); // Feature now has ownership of geometry, so set to null // here to avoid deleting twice. - geom = 0; + geom = nullptr; } } else @@ -723,7 +723,7 @@ void QgsDelimitedTextProvider::rescanFile() mRescanRequired = false; resetIndexes(); - bool buildSpatialIndex = mSpatialIndex != 0; + bool buildSpatialIndex = mSpatialIndex != nullptr; bool buildSubsetIndex = mBuildSubsetIndex && ( mSubsetExpression || mGeomRep != GeomNone ); // In case file has been rewritten check that it is still valid @@ -814,7 +814,7 @@ void QgsDelimitedTextProvider::rescanFile() QgsGeometry *QgsDelimitedTextProvider::geomFromWkt( QString &sWkt, bool wktHasPrefixRegexp, bool wktHasZM ) { - QgsGeometry *geom = 0; + QgsGeometry *geom = nullptr; try { if ( wktHasPrefixRegexp ) @@ -830,7 +830,7 @@ QgsGeometry *QgsDelimitedTextProvider::geomFromWkt( QString &sWkt, bool wktHasPr } catch ( ... ) { - geom = 0; + geom = nullptr; } return geom; } @@ -1000,7 +1000,7 @@ bool QgsDelimitedTextProvider::setSubsetString( const QString& subset, bool upda // If there is a new subset string then encode it.. - QgsExpression *expression = 0; + QgsExpression *expression = nullptr; if ( ! nonNullSubset.isEmpty() ) { @@ -1023,7 +1023,7 @@ bool QgsDelimitedTextProvider::setSubsetString( const QString& subset, bool upda { valid = false; delete expression; - expression = 0; + expression = nullptr; QString tag( "DelimitedText" ); QgsMessageLog::logMessage( tr( "Invalid subset string %1 for %2" ).arg( nonNullSubset, mFile->fileName() ), tag ); } diff --git a/src/providers/delimitedtext/qgsdelimitedtextprovider.h b/src/providers/delimitedtext/qgsdelimitedtextprovider.h index ea3940432b5..1434ec00a90 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextprovider.h +++ b/src/providers/delimitedtext/qgsdelimitedtextprovider.h @@ -209,7 +209,7 @@ class QgsDelimitedTextProvider : public QgsVectorDataProvider * @param message Pointer to a string to receive a status message * @return A list of field type strings, empty if not found or not valid */ - QStringList readCsvtFieldTypes( const QString& filename, QString *message = 0 ); + QStringList readCsvtFieldTypes( const QString& filename, QString *message = nullptr ); private slots: diff --git a/src/providers/gdal/qgsgdaldataitems.cpp b/src/providers/gdal/qgsgdaldataitems.cpp index d3a3f75ce22..c1905331a86 100644 --- a/src/providers/gdal/qgsgdaldataitems.cpp +++ b/src/providers/gdal/qgsgdaldataitems.cpp @@ -84,7 +84,7 @@ QVector QgsGdalLayerItem::createChildren() // get children from sublayers if ( !sublayers.isEmpty() ) { - QgsDataItem * childItem = NULL; + QgsDataItem * childItem = nullptr; QgsDebugMsg( QString( "got %1 sublayers" ).arg( sublayers.count() ) ); for ( int i = 0; i < sublayers.count(); i++ ) { @@ -139,7 +139,7 @@ QGISEXTERN int dataCapabilities() QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) { if ( thePath.isEmpty() ) - return 0; + return nullptr; QgsDebugMsgLevel( "thePath = " + thePath, 2 ); @@ -182,7 +182,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) // allow only normal files or VSIFILE items to continue if ( !info.isFile() && vsiPrefix == "" ) - return 0; + return nullptr; // get supported extensions if ( extensions.isEmpty() ) @@ -203,13 +203,13 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) // unless that extension is in the list (*.xml might be though) if ( thePath.endsWith( ".aux.xml", Qt::CaseInsensitive ) && !extensions.contains( "aux.xml" ) ) - return 0; + return nullptr; if ( thePath.endsWith( ".shp.xml", Qt::CaseInsensitive ) && !extensions.contains( "shp.xml" ) ) - return 0; + return nullptr; if ( thePath.endsWith( ".tif.xml", Qt::CaseInsensitive ) && !extensions.contains( "tif.xml" ) ) - return 0; + return nullptr; // Filter files by extension if ( !extensions.contains( suffix ) ) @@ -225,7 +225,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) } } if ( !matches ) - return 0; + return nullptr; } // fix vsifile path and name @@ -257,11 +257,11 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) // do not print errors, but write to debug CPLPushErrorHandler( CPLQuietErrorHandler ); CPLErrorReset(); - if ( ! GDALIdentifyDriver( TO8F( thePath ), 0 ) ) + if ( ! GDALIdentifyDriver( TO8F( thePath ), nullptr ) ) { QgsDebugMsgLevel( "Skipping VRT file because root is not a GDAL VRT", 2 ); CPLPopErrorHandler(); - return 0; + return nullptr; } CPLPopErrorHandler(); } @@ -284,7 +284,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) if ( ! hDS ) { QgsDebugMsg( QString( "GDALOpen error # %1 : %2 " ).arg( CPLGetLastErrorNo() ).arg( CPLGetLastErrorMsg() ) ); - return 0; + return nullptr; } QStringList sublayers = QgsGdalProvider::subLayers( hDS ); diff --git a/src/providers/gdal/qgsgdaldataitems.h b/src/providers/gdal/qgsgdaldataitems.h index 80fab830e5c..4f087baf41e 100644 --- a/src/providers/gdal/qgsgdaldataitems.h +++ b/src/providers/gdal/qgsgdaldataitems.h @@ -28,7 +28,7 @@ class QgsGdalLayerItem : public QgsLayerItem public: QgsGdalLayerItem( QgsDataItem* parent, QString name, QString path, QString uri, - QStringList *theSublayers = NULL ); + QStringList *theSublayers = nullptr ); ~QgsGdalLayerItem(); bool setCrs( QgsCoordinateReferenceSystem crs ) override; diff --git a/src/providers/gdal/qgsgdalprovider.cpp b/src/providers/gdal/qgsgdalprovider.cpp index 7397171ee54..9f527e29c3c 100644 --- a/src/providers/gdal/qgsgdalprovider.cpp +++ b/src/providers/gdal/qgsgdalprovider.cpp @@ -103,8 +103,8 @@ QgsGdalProvider::QgsGdalProvider( const QString &uri, QgsError error ) , mHeight( 0 ) , mXBlockSize( 0 ) , mYBlockSize( 0 ) - , mGdalBaseDataset( 0 ) - , mGdalDataset( 0 ) + , mGdalBaseDataset( nullptr ) + , mGdalDataset( nullptr ) , mGeoTransform() { setError( error ); @@ -120,8 +120,8 @@ QgsGdalProvider::QgsGdalProvider( const QString &uri, bool update ) , mHeight( 0 ) , mXBlockSize( 0 ) , mYBlockSize( 0 ) - , mGdalBaseDataset( 0 ) - , mGdalDataset( 0 ) + , mGdalBaseDataset( nullptr ) + , mGdalDataset( nullptr ) { QgsDebugMsg( "constructing with uri '" + uri + "'." ); @@ -137,7 +137,7 @@ QgsGdalProvider::QgsGdalProvider( const QString &uri, bool update ) return; } - mGdalDataset = 0; + mGdalDataset = nullptr; // Try to open using VSIFileHandler (see qgsogrprovider.cpp) QString vsiPrefix = QgsZipItem::vsiPrefix( uri ); @@ -175,15 +175,15 @@ QgsGdalProvider* QgsGdalProvider::clone() const bool QgsGdalProvider::crsFromWkt( const char *wkt ) { - OGRSpatialReferenceH hCRS = OSRNewSpatialReference( NULL ); + OGRSpatialReferenceH hCRS = OSRNewSpatialReference( nullptr ); if ( OSRImportFromWkt( hCRS, ( char ** ) &wkt ) == OGRERR_NONE ) { if ( OSRAutoIdentifyEPSG( hCRS ) == OGRERR_NONE ) { QString authid = QString( "%1:%2" ) - .arg( OSRGetAuthorityName( hCRS, NULL ), - OSRGetAuthorityCode( hCRS, NULL ) ); + .arg( OSRGetAuthorityName( hCRS, nullptr ), + OSRGetAuthorityCode( hCRS, nullptr ) ); QgsDebugMsg( "authid recognized as " + authid ); mCrs.createFromOgcWmsCrs( authid ); } @@ -195,7 +195,7 @@ bool QgsGdalProvider::crsFromWkt( const char *wkt ) QgsDebugMsg( pszProj4 ); OGRFree( pszProj4 ); - char *pszWkt = NULL; + char *pszWkt = nullptr; OSRExportToWkt( hCRS, &pszWkt ); QString myWktString = QString( pszWkt ); OGRFree( pszWkt ); @@ -234,10 +234,10 @@ void QgsGdalProvider::closeDataset() mValid = false; GDALDereferenceDataset( mGdalBaseDataset ); - mGdalBaseDataset = NULL; + mGdalBaseDataset = nullptr; GDALClose( mGdalDataset ); - mGdalDataset = NULL; + mGdalDataset = nullptr; } QString QgsGdalProvider::metadata() @@ -245,7 +245,7 @@ QString QgsGdalProvider::metadata() QString myMetadata; myMetadata += QString( GDALGetDescription( GDALGetDatasetDriver( mGdalDataset ) ) ); myMetadata += "
"; - myMetadata += QString( GDALGetMetadataItem( GDALGetDatasetDriver( mGdalDataset ), GDAL_DMD_LONGNAME, NULL ) ); + myMetadata += QString( GDALGetMetadataItem( GDALGetDatasetDriver( mGdalDataset ), GDAL_DMD_LONGNAME, nullptr ) ); // my added code (MColetti) @@ -257,7 +257,7 @@ QString QgsGdalProvider::metadata() myMetadata += "

\n"; - char ** GDALmetadata = GDALGetMetadata( mGdalDataset, NULL ); + char ** GDALmetadata = GDALGetMetadata( mGdalDataset, nullptr ); if ( GDALmetadata ) { @@ -273,7 +273,7 @@ QString QgsGdalProvider::metadata() { myMetadata += "

" + tr( "Band %1" ).arg( i ) + "

\n"; GDALRasterBandH gdalBand = GDALGetRasterBand( mGdalDataset, i ); - GDALmetadata = GDALGetMetadata( gdalBand, NULL ); + GDALmetadata = GDALGetMetadata( gdalBand, nullptr ); if ( GDALmetadata ) { @@ -896,7 +896,7 @@ QString QgsGdalProvider::generateBandName( int theBandNumber ) const #if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,10,0) if ( strcmp( GDALGetDriverShortName( GDALGetDatasetDriver( mGdalDataset ) ), "netCDF" ) == 0 ) { - char ** GDALmetadata = GDALGetMetadata( mGdalDataset, NULL ); + char ** GDALmetadata = GDALGetMetadata( mGdalDataset, nullptr ); if ( GDALmetadata ) { @@ -925,7 +925,7 @@ QString QgsGdalProvider::generateBandName( int theBandNumber ) const { QStringList bandNameValues; GDALRasterBandH gdalBand = GDALGetRasterBand( mGdalDataset, theBandNumber ); - GDALmetadata = GDALGetMetadata( gdalBand, NULL ); + GDALmetadata = GDALGetMetadata( gdalBand, nullptr ); if ( GDALmetadata ) { @@ -1216,7 +1216,7 @@ QStringList QgsGdalProvider::subLayers( GDALDatasetH dataset ) if ( metadata ) { - for ( int i = 0; metadata[i] != NULL; i++ ) + for ( int i = 0; metadata[i] != nullptr; i++ ) { QString layer = QString::fromUtf8( metadata[i] ); int pos = layer.indexOf( "_NAME=" ); @@ -1285,13 +1285,13 @@ bool QgsGdalProvider::hasHistogram( int theBandNo, &myBinCount, &myHistogramArray, false, NULL, NULL ); #else - int* myHistogramArray = 0; + int* myHistogramArray = nullptr; // TODO: GDALGetDefaultHistogram has no bIncludeOutOfRange and bApproxOK, // consider consequences CPLErr myError = GDALGetDefaultHistogram( myGdalBand, &myMinVal, &myMaxVal, &myBinCount, &myHistogramArray, false, - NULL, NULL ); + nullptr, nullptr ); #endif if ( myHistogramArray ) @@ -1543,7 +1543,7 @@ QString QgsGdalProvider::buildPyramids( const QList & theRaste // see https://trac.osgeo.org/qgis/ticket/1357 const char* pszGTiffCreationOptions = GDALGetMetadataItem( GDALGetDriverByName( "GTiff" ), GDAL_DMD_CREATIONOPTIONLIST, "" ); - if ( strstr( pszGTiffCreationOptions, "BIGTIFF" ) == NULL ) + if ( strstr( pszGTiffCreationOptions, "BIGTIFF" ) == nullptr ) { QString myCompressionType = QString( GDALGetMetadataItem( mGdalDataset, "COMPRESSION", "IMAGE_STRUCTURE" ) ); if ( "JPEG" == myCompressionType ) @@ -1591,7 +1591,7 @@ QString QgsGdalProvider::buildPyramids( const QList & theRaste QByteArray key = opt[0].toLocal8Bit(); QByteArray value = opt[1].toLocal8Bit(); // save previous value - myConfigOptionsOld[ opt[0] ] = QString( CPLGetConfigOption( key.data(), NULL ) ); + myConfigOptionsOld[ opt[0] ] = QString( CPLGetConfigOption( key.data(), nullptr ) ); // set temp. value CPLSetConfigOption( key.data(), value.data() ); QgsDebugMsg( QString( "set option %1=%2" ).arg( key.data(), value.data() ) ); @@ -1649,7 +1649,7 @@ QString QgsGdalProvider::buildPyramids( const QList & theRaste myProg.provider = this; myError = GDALBuildOverviews( mGdalBaseDataset, theMethod, myOverviewLevelsVector.size(), myOverviewLevelsVector.data(), - 0, NULL, + 0, nullptr, progressCallback, &myProg ); //this is the arg for the gdal progress callback if ( myError == CE_Failure || CPLGetLastErrorNo() == CPLE_NotSupported ) @@ -1719,7 +1719,7 @@ QString QgsGdalProvider::buildPyramids( const QList & theRaste } //emit drawingProgress( 0, 0 ); - return NULL; // returning null on success + return nullptr; // returning null on success } #if 0 @@ -1975,7 +1975,7 @@ void buildSupportedRasterFileFilterAndExtensions( QString & theFileFiltersString QStringList catchallFilter; // for Any file(*.*), but also for those // drivers with no specific file filter - GDALDriverH jp2Driver = NULL; // first JPEG2000 driver found + GDALDriverH jp2Driver = nullptr; // first JPEG2000 driver found QgsGdalProviderBase::registerGdalDrivers(); @@ -2023,7 +2023,7 @@ void buildSupportedRasterFileFilterAndExtensions( QString & theFileFiltersString myGdalDriverExtension = myGdalDriverLongName = ""; - myGdalDriverMetadata = GDALGetMetadata( myGdalDriver, NULL ); + myGdalDriverMetadata = GDALGetMetadata( myGdalDriver, nullptr ); // presumably we know we've run out of metadta if either the // address is 0, or the first character is null @@ -2219,7 +2219,7 @@ QGISEXTERN bool isValidRasterFileName( QString const & theFileNameQString, QStri { QStringList layers = QgsGdalProvider::subLayers( myDataset ); GDALClose( myDataset ); - myDataset = NULL; + myDataset = nullptr; if ( layers.isEmpty() ) { retErrMsg = QObject::tr( "This raster file has no bands and is invalid as a raster layer." ); @@ -2294,10 +2294,10 @@ bool QgsGdalProvider::hasStatistics( int theBandNo, double *pdfMean = &dfMean; double *pdfStdDev = &dfStdDev; - if ( !( theStats & QgsRasterBandStats::Min ) ) pdfMin = NULL; - if ( !( theStats & QgsRasterBandStats::Max ) ) pdfMax = NULL; - if ( !( theStats & QgsRasterBandStats::Mean ) ) pdfMean = NULL; - if ( !( theStats & QgsRasterBandStats::StdDev ) ) pdfStdDev = NULL; + if ( !( theStats & QgsRasterBandStats::Min ) ) pdfMin = nullptr; + if ( !( theStats & QgsRasterBandStats::Max ) ) pdfMax = nullptr; + if ( !( theStats & QgsRasterBandStats::Mean ) ) pdfMean = nullptr; + if ( !( theStats & QgsRasterBandStats::StdDev ) ) pdfStdDev = nullptr; // try to fetch the cached stats (bForce=FALSE) // Unfortunately GDALGetRasterStatistics() does not work as expected according to @@ -2498,10 +2498,10 @@ void QgsGdalProvider::initBaseDataset() QgsLogger::warning( "Creating Warped VRT." ); mGdalDataset = - GDALAutoCreateWarpedVRT( mGdalBaseDataset, NULL, NULL, - GRA_NearestNeighbour, 0.2, NULL ); + GDALAutoCreateWarpedVRT( mGdalBaseDataset, nullptr, nullptr, + GRA_NearestNeighbour, 0.2, nullptr ); - if ( mGdalDataset == NULL ) + if ( mGdalDataset == nullptr ) { QgsLogger::warning( "Warped VRT Creation failed." ); mGdalDataset = mGdalBaseDataset; @@ -2535,7 +2535,7 @@ void QgsGdalProvider::initBaseDataset() // check if this file has bands or subdatasets CPLErrorReset(); GDALRasterBandH myGDALBand = GDALGetRasterBand( mGdalDataset, 1 ); //just use the first band - if ( myGDALBand == NULL ) + if ( myGDALBand == nullptr ) { QString msg = QString::fromUtf8( CPLGetLastErrorMsg() ); @@ -2545,10 +2545,10 @@ void QgsGdalProvider::initBaseDataset() appendError( ERRMSG( tr( "Cannot get GDAL raster band: %1" ).arg( msg ) ) ); GDALDereferenceDataset( mGdalBaseDataset ); - mGdalBaseDataset = NULL; + mGdalBaseDataset = nullptr; GDALClose( mGdalDataset ); - mGdalDataset = NULL; + mGdalDataset = nullptr; return; } // if there are subdatasets, leave the dataset open for subsequent queries @@ -2710,7 +2710,7 @@ void QgsGdalProvider::initBaseDataset() char** papszFromStringList( const QStringList& list ) { - char **papszRetList = NULL; + char **papszRetList = nullptr; Q_FOREACH ( const QString& elem, list ) { papszRetList = CSLAddString( papszRetList, elem.toLocal8Bit().constData() ); @@ -2748,7 +2748,7 @@ QGISEXTERN QgsGdalProvider * create( char **papszOptions = papszFromStringList( createOptions ); GDALDatasetH dataset = GDALCreate( driver, TO8F( uri ), width, height, nBands, ( GDALDataType )type, papszOptions ); CSLDestroy( papszOptions ); - if ( dataset == NULL ) + if ( dataset == nullptr ) { QgsError error( QString( "Cannot create new dataset %1:\n%2" ).arg( uri, QString::fromUtf8( CPLGetLastErrorMsg() ) ), "GDAL provider" ); QgsDebugMsg( error.summary() ); @@ -2804,7 +2804,7 @@ bool QgsGdalProvider::remove() { GDALDriverH driver = GDALGetDatasetDriver( mGdalDataset ); GDALClose( mGdalDataset ); - mGdalDataset = 0; + mGdalDataset = nullptr; CPLErrorReset(); CPLErr err = GDALDeleteDataset( driver, TO8F( dataSourceUri() ) ); @@ -2847,7 +2847,7 @@ QGISEXTERN QString helpCreationOptionsFormat( QString format ) if ( myGdalDriver ) { // first report details and help page - char ** GDALmetadata = GDALGetMetadata( myGdalDriver, NULL ); + char ** GDALmetadata = GDALGetMetadata( myGdalDriver, nullptr ); message += "Format Details:\n"; message += QString( " Extension: %1\n" ).arg( CSLFetchNameValue( GDALmetadata, GDAL_DMD_EXTENSION ) ); message += QString( " Short Name: %1" ).arg( GDALGetDriverShortName( myGdalDriver ) ); diff --git a/src/providers/gdal/qgsgdalprovider.h b/src/providers/gdal/qgsgdalprovider.h index 17ac2da1ee9..53371286441 100644 --- a/src/providers/gdal/qgsgdalprovider.h +++ b/src/providers/gdal/qgsgdalprovider.h @@ -65,7 +65,7 @@ class QgsGdalProvider : public QgsRasterDataProvider, QgsGdalProviderBase * otherwise we contact the host directly. * */ - QgsGdalProvider( QString const & uri = 0, bool update = false ); + QgsGdalProvider( QString const & uri = nullptr, bool update = false ); /** Create invalid provider with error */ QgsGdalProvider( QString const & uri, QgsError error ); diff --git a/src/providers/gdal/qgsgdalproviderbase.cpp b/src/providers/gdal/qgsgdalproviderbase.cpp index 8728c5c2419..6717547db42 100644 --- a/src/providers/gdal/qgsgdalproviderbase.cpp +++ b/src/providers/gdal/qgsgdalproviderbase.cpp @@ -79,7 +79,7 @@ QList QgsGdalProviderBase::colorTable( GDALDa GDALPaletteInterp myPaletteInterpretation = GDALGetPaletteInterpretation( myGdalColorTable ); QgsDebugMsg( "Palette Interpretation: " + QString::number(( int )myPaletteInterpretation ) ); - const GDALColorEntry* myColorEntry = 0; + const GDALColorEntry* myColorEntry = nullptr; for ( int myIterator = 0; myIterator < myEntryCount; myIterator++ ) { myColorEntry = GDALGetColorEntry( myGdalColorTable, myIterator ); diff --git a/src/providers/gpx/gpsdata.cpp b/src/providers/gpx/gpsdata.cpp index 536718efce2..c740d5b3023 100644 --- a/src/providers/gpx/gpsdata.cpp +++ b/src/providers/gpx/gpsdata.cpp @@ -375,7 +375,7 @@ QgsGPSData* QgsGPSData::getData( const QString& fileName ) if ( !file.open( QIODevice::ReadOnly ) ) { QgsLogger::warning( QObject::tr( "Couldn't open the data source: %1" ).arg( fileName ) ); - return 0; + return nullptr; } QgsGPSData* data = new QgsGPSData; QgsDebugMsg( "Loading file " + fileName ); @@ -383,7 +383,7 @@ QgsGPSData* QgsGPSData::getData( const QString& fileName ) bool failed = false; // SAX parsing - XML_Parser p = XML_ParserCreate( NULL ); + XML_Parser p = XML_ParserCreate( nullptr ); XML_SetUserData( p, &handler ); XML_SetElementHandler( p, QgsGPXHandler::start, QgsGPXHandler::end ); XML_SetCharacterDataHandler( p, QgsGPXHandler::chars ); @@ -407,7 +407,7 @@ QgsGPSData* QgsGPSData::getData( const QString& fileName ) delete [] buffer; XML_ParserFree( p ); if ( failed ) - return 0; + return nullptr; data->setNoDataExtent(); @@ -464,7 +464,7 @@ bool QgsGPXHandler::startElement( const XML_Char* qName, const XML_Char** attr ) { parseModes.push( ParsingWaypoint ); mWpt = QgsWaypoint(); - for ( int i = 0; attr[2*i] != NULL; ++i ) + for ( int i = 0; attr[2*i] != nullptr; ++i ) { if ( !std::strcmp( attr[2*i], "lat" ) ) mWpt.lat = QString( attr[2*i+1] ).toDouble(); @@ -614,7 +614,7 @@ bool QgsGPXHandler::startElement( const XML_Char* qName, const XML_Char** attr ) if ( parseModes.top() == ParsingRoute ) { mRtept = QgsRoutepoint(); - for ( int i = 0; attr[2*i] != NULL; ++i ) + for ( int i = 0; attr[2*i] != nullptr; ++i ) { if ( !std::strcmp( attr[2*i], "lat" ) ) mRtept.lat = QString( attr[2*i+1] ).toDouble(); @@ -643,7 +643,7 @@ bool QgsGPXHandler::startElement( const XML_Char* qName, const XML_Char** attr ) if ( parseModes.top() == ParsingTrackSegment ) { mTrkpt = QgsTrackpoint(); - for ( int i = 0; attr[2*i] != NULL; ++i ) + for ( int i = 0; attr[2*i] != nullptr; ++i ) { if ( !std::strcmp( attr[2*i], "lat" ) ) mTrkpt.lat = QString( attr[2*i+1] ).toDouble(); diff --git a/src/providers/gpx/gpsdata.h b/src/providers/gpx/gpsdata.h index 6e4c37fcf37..e79cfacfa34 100644 --- a/src/providers/gpx/gpsdata.h +++ b/src/providers/gpx/gpsdata.h @@ -256,7 +256,7 @@ class QgsGPSData class QgsGPXHandler { public: - explicit QgsGPXHandler( QgsGPSData& data ) : mData( data ), mObj( NULL ), mString( NULL ), mDouble( NULL ), mInt( NULL ) { } + explicit QgsGPXHandler( QgsGPSData& data ) : mData( data ), mObj( nullptr ), mString( nullptr ), mDouble( nullptr ), mInt( nullptr ) { } /** This function is called when expat encounters a new start element in the XML stream. */ diff --git a/src/providers/gpx/qgsgpxfeatureiterator.cpp b/src/providers/gpx/qgsgpxfeatureiterator.cpp index 6c4889a08b9..32e285577f7 100644 --- a/src/providers/gpx/qgsgpxfeatureiterator.cpp +++ b/src/providers/gpx/qgsgpxfeatureiterator.cpp @@ -431,7 +431,7 @@ QgsGeometry* QgsGPXFeatureIterator::readTrackGeometry( const QgsTrack& trk ) // TODO: support multi line string for segments if ( trk.segments.isEmpty() ) - return 0; + return nullptr; // A track consists of several segments. Add all those segments into one. int totalPoints = 0; @@ -440,7 +440,7 @@ QgsGeometry* QgsGPXFeatureIterator::readTrackGeometry( const QgsTrack& trk ) totalPoints += trk.segments[i].points.size(); } if ( totalPoints == 0 ) - return 0; + return nullptr; //QgsDebugMsg( "GPX feature track total points: " + QString::number( totalPoints ) ); // some wkb voodoo @@ -448,7 +448,7 @@ QgsGeometry* QgsGPXFeatureIterator::readTrackGeometry( const QgsTrack& trk ) if ( !geo ) { QgsDebugMsg( "Too large track!!!" ); - return 0; + return nullptr; } std::memset( geo, 0, 9 + 16 * totalPoints ); geo[0] = QgsApplication::endian(); diff --git a/src/providers/gpx/qgsgpxprovider.cpp b/src/providers/gpx/qgsgpxprovider.cpp index 95bc11c7244..67ea1cb0b50 100644 --- a/src/providers/gpx/qgsgpxprovider.cpp +++ b/src/providers/gpx/qgsgpxprovider.cpp @@ -69,7 +69,7 @@ const QString GPX_DESCRIPTION = QObject::tr( "GPS eXchange format provider" ); QgsGPXProvider::QgsGPXProvider( const QString& uri ) : QgsVectorDataProvider( uri ) - , data( 0 ) + , data( nullptr ) , mFeatureType( WaypointType ) , mValid( false ) // assume that it won't work { @@ -102,7 +102,7 @@ QgsGPXProvider::QgsGPXProvider( const QString& uri ) // parse the file data = QgsGPSData::getData( mFileName ); - if ( data == 0 ) + if ( data == nullptr ) { return; } @@ -218,12 +218,12 @@ bool QgsGPXProvider::addFeature( QgsFeature& f ) const unsigned char* geo = f.constGeometry()->asWkb(); QGis::WkbType wkbType = f.constGeometry()->wkbType(); bool success = false; - QgsGPSObject* obj = NULL; + QgsGPSObject* obj = nullptr; QgsAttributes attrs = f.attributes(); QgsAttributeMap::const_iterator it; // is it a waypoint? - if ( mFeatureType == WaypointType && geo != NULL && wkbType == QGis::WKBPoint ) + if ( mFeatureType == WaypointType && geo != nullptr && wkbType == QGis::WKBPoint ) { // add geometry @@ -253,7 +253,7 @@ bool QgsGPXProvider::addFeature( QgsFeature& f ) } // is it a route? - if ( mFeatureType == RouteType && geo != NULL && wkbType == QGis::WKBLineString ) + if ( mFeatureType == RouteType && geo != nullptr && wkbType == QGis::WKBLineString ) { QgsRoute rte; @@ -300,7 +300,7 @@ bool QgsGPXProvider::addFeature( QgsFeature& f ) } // is it a track? - if ( mFeatureType == TrackType && geo != NULL && wkbType == QGis::WKBLineString ) + if ( mFeatureType == TrackType && geo != nullptr && wkbType == QGis::WKBLineString ) { QgsTrack trk; @@ -463,7 +463,7 @@ void QgsGPXProvider::changeAttributeValues( QgsGPSObject& obj, const QgsAttribut } // waypoint-specific attributes - if ( wpt != NULL ) + if ( wpt != nullptr ) { if ( indexToAttr[i] == SymAttr ) wpt->sym = v.toString(); @@ -477,7 +477,7 @@ void QgsGPXProvider::changeAttributeValues( QgsGPSObject& obj, const QgsAttribut } // route- and track-specific attributes - if ( ext != NULL ) + if ( ext != nullptr ) { if ( indexToAttr[i] == NumAttr ) { diff --git a/src/providers/memory/qgsmemoryfeatureiterator.cpp b/src/providers/memory/qgsmemoryfeatureiterator.cpp index b7878412e65..1dc7d3e44d0 100644 --- a/src/providers/memory/qgsmemoryfeatureiterator.cpp +++ b/src/providers/memory/qgsmemoryfeatureiterator.cpp @@ -24,8 +24,8 @@ QgsMemoryFeatureIterator::QgsMemoryFeatureIterator( QgsMemoryFeatureSource* source, bool ownSource, const QgsFeatureRequest& request ) : QgsAbstractFeatureIteratorFromSource( source, ownSource, request ) - , mSelectRectGeom( 0 ) - , mSubsetExpression( 0 ) + , mSelectRectGeom( nullptr ) + , mSubsetExpression( nullptr ) { if ( !mSource->mSubsetString.isEmpty() ) { @@ -204,7 +204,7 @@ bool QgsMemoryFeatureIterator::close() iteratorClosed(); delete mSelectRectGeom; - mSelectRectGeom = NULL; + mSelectRectGeom = nullptr; mClosed = true; return true; @@ -215,7 +215,7 @@ bool QgsMemoryFeatureIterator::close() QgsMemoryFeatureSource::QgsMemoryFeatureSource( const QgsMemoryProvider* p ) : mFields( p->mFields ) , mFeatures( p->mFeatures ) - , mSpatialIndex( p->mSpatialIndex ? new QgsSpatialIndex( *p->mSpatialIndex ) : 0 ) // just shallow copy + , mSpatialIndex( p->mSpatialIndex ? new QgsSpatialIndex( *p->mSpatialIndex ) : nullptr ) // just shallow copy , mSubsetString( p->mSubsetString ) { mExpressionContext << QgsExpressionContextUtils::globalScope() diff --git a/src/providers/memory/qgsmemoryprovider.cpp b/src/providers/memory/qgsmemoryprovider.cpp index ab77a084106..03f2bb3e7f3 100644 --- a/src/providers/memory/qgsmemoryprovider.cpp +++ b/src/providers/memory/qgsmemoryprovider.cpp @@ -32,7 +32,7 @@ static const QString TEXT_PROVIDER_DESCRIPTION = "Memory provider"; QgsMemoryProvider::QgsMemoryProvider( const QString& uri ) : QgsVectorDataProvider( uri ) - , mSpatialIndex( 0 ) + , mSpatialIndex( nullptr ) { // Initialize the geometry with the uri to support old style uri's // (ie, just 'point', 'line', 'polygon') diff --git a/src/providers/mssql/qgsmssqldataitems.cpp b/src/providers/mssql/qgsmssqldataitems.cpp index 60597fb1908..3b5c0165de8 100644 --- a/src/providers/mssql/qgsmssqldataitems.cpp +++ b/src/providers/mssql/qgsmssqldataitems.cpp @@ -115,7 +115,7 @@ QVector QgsMssqlConnectionItem::createChildren() QString connectionName = db.connectionName(); - QgsMssqlGeomColumnTypeThread *columnTypeThread = 0; + QgsMssqlGeomColumnTypeThread *columnTypeThread = nullptr; // build sql statement QString query( "select " ); @@ -176,7 +176,7 @@ QVector QgsMssqlConnectionItem::createChildren() QString type = layer.type; QString srid = layer.srid; - QgsMssqlSchemaItem* schemaItem = NULL; + QgsMssqlSchemaItem* schemaItem = nullptr; Q_FOREACH ( QgsDataItem *child, children ) { if ( child->name() == layer.schemaName ) @@ -237,7 +237,7 @@ QVector QgsMssqlConnectionItem::createChildren() void QgsMssqlConnectionItem::setLayerType( QgsMssqlLayerProperty layerProperty ) { - QgsMssqlSchemaItem *schemaItem = NULL; + QgsMssqlSchemaItem *schemaItem = nullptr; Q_FOREACH ( QgsDataItem *child, mChildren ) { @@ -322,7 +322,7 @@ void QgsMssqlConnectionItem::setAllowGeometrylessTables( bool allow ) void QgsMssqlConnectionItem::editConnection() { - QgsMssqlNewConnection nc( NULL, mName ); + QgsMssqlNewConnection nc( nullptr, mName ); if ( nc.exec() ) { // the parent should be updated @@ -389,11 +389,11 @@ bool QgsMssqlConnectionItem::handleDrop( const QMimeData * data, Qt::DropAction if ( hasError ) { - QMessageBox::warning( 0, tr( "Import to MSSQL database" ), tr( "Failed to import some layers!\n\n" ) + importResults.join( "\n" ) ); + QMessageBox::warning( nullptr, tr( "Import to MSSQL database" ), tr( "Failed to import some layers!\n\n" ) + importResults.join( "\n" ) ); } else { - QMessageBox::information( 0, tr( "Import to MSSQL database" ), tr( "Import was successful." ) ); + QMessageBox::information( nullptr, tr( "Import to MSSQL database" ), tr( "Import was successful." ) ); } if ( state() == Populated ) @@ -426,7 +426,7 @@ QgsMssqlLayerItem* QgsMssqlLayerItem::createClone() QString QgsMssqlLayerItem::createUri() { QString pkColName = !mLayerProperty.pkCols.isEmpty() ? mLayerProperty.pkCols.at( 0 ) : QString::null; - QgsMssqlConnectionItem *connItem = qobject_cast( parent() ? parent()->parent() : 0 ); + QgsMssqlConnectionItem *connItem = qobject_cast( parent() ? parent()->parent() : nullptr ); if ( !connItem ) { @@ -508,7 +508,7 @@ QgsMssqlLayerItem* QgsMssqlSchemaItem::addLayer( QgsMssqlLayerProperty layerProp } else { - return NULL; + return nullptr; } } @@ -559,7 +559,7 @@ QList QgsMssqlRootItem::actions() QWidget *QgsMssqlRootItem::paramWidget() { - QgsMssqlSourceSelect *select = new QgsMssqlSourceSelect( 0, 0, true, true ); + QgsMssqlSourceSelect *select = new QgsMssqlSourceSelect( nullptr, nullptr, true, true ); connect( select, SIGNAL( connectionsChanged() ), this, SLOT( connectionsChanged() ) ); return select; } @@ -571,7 +571,7 @@ void QgsMssqlRootItem::connectionsChanged() void QgsMssqlRootItem::newConnection() { - QgsMssqlNewConnection nc( NULL ); + QgsMssqlNewConnection nc( nullptr ); if ( nc.exec() ) { refresh(); diff --git a/src/providers/mssql/qgsmssqlfeatureiterator.cpp b/src/providers/mssql/qgsmssqlfeatureiterator.cpp index b3d223a16ed..72e77bb4f8b 100644 --- a/src/providers/mssql/qgsmssqlfeatureiterator.cpp +++ b/src/providers/mssql/qgsmssqlfeatureiterator.cpp @@ -31,7 +31,7 @@ QgsMssqlFeatureIterator::QgsMssqlFeatureIterator( QgsMssqlFeatureSource* source, , mExpressionCompiled( false ) { mClosed = false; - mQuery = NULL; + mQuery = nullptr; mParser.IsGeography = mSource->mIsGeography; @@ -297,7 +297,7 @@ bool QgsMssqlFeatureIterator::rewind() QString msg = mQuery->lastError().text(); QgsDebugMsg( msg ); delete mQuery; - mQuery = 0; + mQuery = nullptr; if ( mDatabase.isOpen() ) mDatabase.close(); @@ -329,7 +329,7 @@ bool QgsMssqlFeatureIterator::close() if ( mQuery ) { delete mQuery; - mQuery = 0; + mQuery = nullptr; } if ( mDatabase.isOpen() ) diff --git a/src/providers/mssql/qgsmssqlgeometryparser.cpp b/src/providers/mssql/qgsmssqlgeometryparser.cpp index a5128f60c39..fb664c42304 100644 --- a/src/providers/mssql/qgsmssqlgeometryparser.cpp +++ b/src/providers/mssql/qgsmssqlgeometryparser.cpp @@ -117,8 +117,8 @@ ShapeType (1 byte) /************************************************************************/ QgsMssqlGeometryParser::QgsMssqlGeometryParser() - : pszData( NULL ) - , pszWkb( NULL ) + : pszData( nullptr ) + , pszWkb( nullptr ) , nWkbLen( 0 ) , nWkbMaxLen( 100 ) , chByteOrder( QgsApplication::endian() ) @@ -475,7 +475,7 @@ unsigned char* QgsMssqlGeometryParser::ParseSqlGeometry( unsigned char* pszInput { QgsDebugMsg( "ParseSqlGeometry not enough data" ); DumpMemoryToLog( "Not enough data", pszInput, nLen ); - return NULL; + return nullptr; } pszData = pszInput; @@ -488,7 +488,7 @@ unsigned char* QgsMssqlGeometryParser::ParseSqlGeometry( unsigned char* pszInput { QgsDebugMsg( "ParseSqlGeometry corrupt data" ); DumpMemoryToLog( "Corrupt data", pszInput, nLen ); - return NULL; + return nullptr; } chProps = ReadByte( 5 ); @@ -517,7 +517,7 @@ unsigned char* QgsMssqlGeometryParser::ParseSqlGeometry( unsigned char* pszInput delete [] pszWkb; QgsDebugMsg( "ParseSqlGeometry not enough data" ); DumpMemoryToLog( "Not enough data", pszInput, nLen ); - return NULL; + return nullptr; } CopyPoint( 0 ); @@ -533,7 +533,7 @@ unsigned char* QgsMssqlGeometryParser::ParseSqlGeometry( unsigned char* pszInput delete [] pszWkb; QgsDebugMsg( "ParseSqlGeometry not enough data" ); DumpMemoryToLog( "Not enough data", pszInput, nLen ); - return NULL; + return nullptr; } // copy byte order @@ -560,7 +560,7 @@ unsigned char* QgsMssqlGeometryParser::ParseSqlGeometry( unsigned char* pszInput if ( nNumPoints <= 0 ) { delete [] pszWkb; - return NULL; + return nullptr; } // position of the point array @@ -574,7 +574,7 @@ unsigned char* QgsMssqlGeometryParser::ParseSqlGeometry( unsigned char* pszInput delete [] pszWkb; QgsDebugMsg( "ParseSqlGeometry not enough data" ); DumpMemoryToLog( "Not enough data", pszInput, nLen ); - return NULL; + return nullptr; } nNumFigures = ReadInt32( nFigurePos - 4 ); @@ -582,7 +582,7 @@ unsigned char* QgsMssqlGeometryParser::ParseSqlGeometry( unsigned char* pszInput if ( nNumFigures <= 0 ) { delete [] pszWkb; - return NULL; + return nullptr; } // position of the shapes @@ -593,7 +593,7 @@ unsigned char* QgsMssqlGeometryParser::ParseSqlGeometry( unsigned char* pszInput delete [] pszWkb; QgsDebugMsg( "ParseSqlGeometry not enough data" ); DumpMemoryToLog( "Not enough data", pszInput, nLen ); - return NULL; + return nullptr; } nNumShapes = ReadInt32( nShapePos - 4 ); @@ -603,13 +603,13 @@ unsigned char* QgsMssqlGeometryParser::ParseSqlGeometry( unsigned char* pszInput delete [] pszWkb; QgsDebugMsg( "ParseSqlGeometry not enough data" ); DumpMemoryToLog( "Not enough data", pszInput, nLen ); - return NULL; + return nullptr; } if ( nNumShapes <= 0 ) { delete [] pszWkb; - return NULL; + return nullptr; } // pick up the root shape @@ -618,7 +618,7 @@ unsigned char* QgsMssqlGeometryParser::ParseSqlGeometry( unsigned char* pszInput delete [] pszWkb; QgsDebugMsg( "ParseSqlGeometry corrupt data" ); DumpMemoryToLog( "Not enough data", pszInput, nLen ); - return NULL; + return nullptr; } // determine the shape type @@ -649,7 +649,7 @@ unsigned char* QgsMssqlGeometryParser::ParseSqlGeometry( unsigned char* pszInput delete [] pszWkb; QgsDebugMsg( "ParseSqlGeometry unsupported geometry type" ); DumpMemoryToLog( "Unsupported geometry type", pszInput, nLen ); - return NULL; + return nullptr; } } diff --git a/src/providers/mssql/qgsmssqlnewconnection.h b/src/providers/mssql/qgsmssqlnewconnection.h index 2fcdf3f5764..74dd35d2990 100644 --- a/src/providers/mssql/qgsmssqlnewconnection.h +++ b/src/providers/mssql/qgsmssqlnewconnection.h @@ -30,7 +30,7 @@ class QgsMssqlNewConnection : public QDialog, private Ui::QgsMssqlNewConnectionB Q_OBJECT public: //! Constructor - QgsMssqlNewConnection( QWidget *parent = 0, const QString& connName = QString::null, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); + QgsMssqlNewConnection( QWidget *parent = nullptr, const QString& connName = QString::null, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); //! Destructor ~QgsMssqlNewConnection(); diff --git a/src/providers/mssql/qgsmssqlprovider.h b/src/providers/mssql/qgsmssqlprovider.h index e19302bc999..83399b97131 100644 --- a/src/providers/mssql/qgsmssqlprovider.h +++ b/src/providers/mssql/qgsmssqlprovider.h @@ -234,8 +234,8 @@ class QgsMssqlProvider : public QgsVectorDataProvider const QgsCoordinateReferenceSystem *srs, bool overwrite, QMap *oldToNewAttrIdxMap, - QString *errorMessage = 0, - const QMap *options = 0 + QString *errorMessage = nullptr, + const QMap *options = nullptr ); virtual QgsCoordinateReferenceSystem crs() override; diff --git a/src/providers/mssql/qgsmssqlsourceselect.cpp b/src/providers/mssql/qgsmssqlsourceselect.cpp index 7cea0345ae2..d1062b5009c 100644 --- a/src/providers/mssql/qgsmssqlsourceselect.cpp +++ b/src/providers/mssql/qgsmssqlsourceselect.cpp @@ -89,7 +89,7 @@ QWidget *QgsMssqlSourceSelectDelegate::createEditor( QWidget *parent, const QSty return le; } - return 0; + return nullptr; } void QgsMssqlSourceSelectDelegate::setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const @@ -121,7 +121,7 @@ QgsMssqlSourceSelect::QgsMssqlSourceSelect( QWidget *parent, Qt::WindowFlags fl, : QDialog( parent, fl ) , mManagerMode( managerMode ) , mEmbeddedMode( embeddedMode ) - , mColumnTypeThread( NULL ) + , mColumnTypeThread( nullptr ) , mUseEstimatedMetadata( false ) { setupUi( this ); @@ -642,7 +642,7 @@ void QgsMssqlSourceSelect::finishList() void QgsMssqlSourceSelect::columnThreadFinished() { delete mColumnTypeThread; - mColumnTypeThread = 0; + mColumnTypeThread = nullptr; btnConnect->setText( tr( "Connect" ) ); finishList(); diff --git a/src/providers/mssql/qgsmssqlsourceselect.h b/src/providers/mssql/qgsmssqlsourceselect.h index 5359b60c0e5..95d8b82f2b5 100644 --- a/src/providers/mssql/qgsmssqlsourceselect.h +++ b/src/providers/mssql/qgsmssqlsourceselect.h @@ -39,7 +39,7 @@ class QgsMssqlSourceSelectDelegate : public QItemDelegate Q_OBJECT public: - explicit QgsMssqlSourceSelectDelegate( QObject *parent = NULL ) + explicit QgsMssqlSourceSelectDelegate( QObject *parent = nullptr ) : QItemDelegate( parent ) {} @@ -95,7 +95,7 @@ class QgsMssqlSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase static void deleteConnection( const QString& key ); //! Constructor - QgsMssqlSourceSelect( QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false ); + QgsMssqlSourceSelect( QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false ); //! Destructor ~QgsMssqlSourceSelect(); //! Populate the connection list combo box diff --git a/src/providers/ogr/qgsogrconnpool.cpp b/src/providers/ogr/qgsogrconnpool.cpp index 8db399be47b..46f99682a24 100644 --- a/src/providers/ogr/qgsogrconnpool.cpp +++ b/src/providers/ogr/qgsogrconnpool.cpp @@ -20,7 +20,7 @@ bool QgsOgrConnPool::sInstanceDestroyed = false; QgsOgrConnPool* QgsOgrConnPool::instance() { - return sInstanceDestroyed ? 0 : &sInstance; + return sInstanceDestroyed ? nullptr : &sInstance; } QgsOgrConnPool::QgsOgrConnPool() : QgsConnectionPool() diff --git a/src/providers/ogr/qgsogrconnpool.h b/src/providers/ogr/qgsogrconnpool.h index 15d76bb7b50..fc609e9da50 100644 --- a/src/providers/ogr/qgsogrconnpool.h +++ b/src/providers/ogr/qgsogrconnpool.h @@ -35,7 +35,7 @@ inline QString qgsConnectionPool_ConnectionToName( QgsOgrConn* c ) inline void qgsConnectionPool_ConnectionCreate( QString connInfo, QgsOgrConn*& c ) { c = new QgsOgrConn; - c->ds = OGROpen( connInfo.toUtf8().constData(), false, NULL ); + c->ds = OGROpen( connInfo.toUtf8().constData(), false, nullptr ); c->path = connInfo; c->valid = true; } diff --git a/src/providers/ogr/qgsogrdataitems.cpp b/src/providers/ogr/qgsogrdataitems.cpp index d48c17cdc65..33cf2844ba5 100644 --- a/src/providers/ogr/qgsogrdataitems.cpp +++ b/src/providers/ogr/qgsogrdataitems.cpp @@ -75,7 +75,7 @@ bool QgsOgrLayerItem::setCrs( QgsCoordinateReferenceSystem crs ) // save ordinary .prj file OGRSpatialReferenceH hSRS = OSRNewSpatialReference( wkt.toLocal8Bit().data() ); OSRMorphToESRI( hSRS ); // this is the important stuff for shapefile .prj - char* pszOutWkt = NULL; + char* pszOutWkt = nullptr; OSRExportToWkt( hSRS, &pszOutWkt ); QFile prjFile( layerName + ".prj" ); if ( prjFile.open( QIODevice::WriteOnly ) ) @@ -220,7 +220,7 @@ QGISEXTERN int dataCapabilities() QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) { if ( thePath.isEmpty() ) - return 0; + return nullptr; QgsDebugMsgLevel( "thePath: " + thePath, 2 ); @@ -263,7 +263,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) // allow only normal files or VSIFILE items to continue if ( !info.isFile() && vsiPrefix == "" ) - return 0; + return nullptr; QStringList myExtensions = fileExtensions(); @@ -272,13 +272,13 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) // unless that extension is in the list (*.xml might be though) if ( thePath.endsWith( ".aux.xml", Qt::CaseInsensitive ) && !myExtensions.contains( "aux.xml" ) ) - return 0; + return nullptr; if ( thePath.endsWith( ".shp.xml", Qt::CaseInsensitive ) && !myExtensions.contains( "shp.xml" ) ) - return 0; + return nullptr; if ( thePath.endsWith( ".tif.xml", Qt::CaseInsensitive ) && !myExtensions.contains( "tif.xml" ) ) - return 0; + return nullptr; // We have to filter by extensions, otherwise e.g. all Shapefile files are displayed // because OGR drive can open also .dbf, .shx. @@ -295,7 +295,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) } } if ( !matches ) - return 0; + return nullptr; } // .dbf should probably appear if .shp is not present @@ -303,7 +303,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) { QString pathShp = thePath.left( thePath.count() - 4 ) + ".shp"; if ( QFileInfo( pathShp ).exists() ) - return 0; + return nullptr; } // fix vsifile path and name @@ -343,7 +343,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) if ( ! hDataSource ) { QgsDebugMsgLevel( "Skipping VRT file because root is not a OGR VRT", 2 ); - return 0; + return nullptr; } OGR_DS_Destroy( hDataSource ); } @@ -367,7 +367,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) if ( ! hDataSource ) { QgsDebugMsg( QString( "OGROpen error # %1 : %2 " ).arg( CPLGetLastErrorNo() ).arg( CPLGetLastErrorMsg() ) ); - return 0; + return nullptr; } QString driverName = OGR_Dr_GetName( hDriver ); @@ -375,7 +375,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) int numLayers = OGR_DS_GetLayerCount( hDataSource ); - QgsDataItem* item = 0; + QgsDataItem* item = nullptr; if ( numLayers == 1 ) { diff --git a/src/providers/ogr/qgsogrfeatureiterator.cpp b/src/providers/ogr/qgsogrfeatureiterator.cpp index daa34b82d8c..b97a2d3efee 100644 --- a/src/providers/ogr/qgsogrfeatureiterator.cpp +++ b/src/providers/ogr/qgsogrfeatureiterator.cpp @@ -36,9 +36,9 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource* source, bool ownSource, const QgsFeatureRequest& request ) : QgsAbstractFeatureIteratorFromSource( source, ownSource, request ) - , ogrLayer( 0 ) + , ogrLayer( nullptr ) , mSubsetStringSet( false ) - , mGeometrySimplifier( NULL ) + , mGeometrySimplifier( nullptr ) , mExpressionCompiled( false ) { mFeatureFetched = false; @@ -81,7 +81,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource* source, bool } else { - OGR_L_SetSpatialFilter( ogrLayer, 0 ); + OGR_L_SetSpatialFilter( ogrLayer, nullptr ); } if ( request.filterType() == QgsFeatureRequest::FilterExpression @@ -102,12 +102,12 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource* source, bool } else { - OGR_L_SetAttributeFilter( ogrLayer, 0 ); + OGR_L_SetAttributeFilter( ogrLayer, nullptr ); } } else { - OGR_L_SetAttributeFilter( ogrLayer, 0 ); + OGR_L_SetAttributeFilter( ogrLayer, nullptr ); } //start with first feature @@ -117,7 +117,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource* source, bool QgsOgrFeatureIterator::~QgsOgrFeatureIterator() { delete mGeometrySimplifier; - mGeometrySimplifier = NULL; + mGeometrySimplifier = nullptr; close(); } @@ -125,7 +125,7 @@ QgsOgrFeatureIterator::~QgsOgrFeatureIterator() bool QgsOgrFeatureIterator::prepareSimplification( const QgsSimplifyMethod& simplifyMethod ) { delete mGeometrySimplifier; - mGeometrySimplifier = NULL; + mGeometrySimplifier = nullptr; // setup simplification of OGR-geometries fetched if ( !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) && simplifyMethod.methodType() != QgsSimplifyMethod::NoSimplification && !simplifyMethod.forceLocalOptimization() ) @@ -254,7 +254,7 @@ bool QgsOgrFeatureIterator::close() } QgsOgrConnPool::instance()->releaseConnection( mConn ); - mConn = 0; + mConn = nullptr; mClosed = true; return true; @@ -343,7 +343,7 @@ bool QgsOgrFeatureIterator::readFeature( OGRFeatureH fet, QgsFeature& feature ) } } else - feature.setGeometry( 0 ); + feature.setGeometry( nullptr ); if (( useIntersect && ( !feature.constGeometry() || !feature.constGeometry()->intersects( mRequest.filterRect() ) ) ) || ( geometryTypeFilter && ( !feature.constGeometry() || QgsOgrProvider::ogrWkbSingleFlatten(( OGRwkbGeometryType )feature.constGeometry()->wkbType() ) != mSource->mOgrGeometryTypeFilter ) ) ) @@ -355,7 +355,7 @@ bool QgsOgrFeatureIterator::readFeature( OGRFeatureH fet, QgsFeature& feature ) if ( !mFetchGeometry ) { - feature.setGeometry( 0 ); + feature.setGeometry( nullptr ); } // fetch attributes diff --git a/src/providers/ogr/qgsogrprovider.cpp b/src/providers/ogr/qgsogrprovider.cpp index 4813e8b052d..167e9d2c44c 100644 --- a/src/providers/ogr/qgsogrprovider.cpp +++ b/src/providers/ogr/qgsogrprovider.cpp @@ -135,7 +135,7 @@ bool QgsOgrProvider::convertField( QgsField &field, const QTextCodec &encoding ) void QgsOgrProvider::repack() { - if ( ogrDriverName != "ESRI Shapefile" || ogrOrigLayer == 0 ) + if ( ogrDriverName != "ESRI Shapefile" || ogrOrigLayer == nullptr ) return; QByteArray layerName = OGR_FD_GetName( OGR_L_GetLayerDefn( ogrOrigLayer ) ); @@ -143,7 +143,7 @@ void QgsOgrProvider::repack() // run REPACK on shape files QByteArray sql = QByteArray( "REPACK " ) + layerName; // don't quote the layer name as it works with spaces in the name and won't work if the name is quoted QgsDebugMsg( QString( "SQL: %1" ).arg( FROM8( sql ) ) ); - OGR_DS_ExecuteSQL( ogrDataSource, sql.constData(), NULL, NULL ); + OGR_DS_ExecuteSQL( ogrDataSource, sql.constData(), nullptr, nullptr ); if ( mFilePath.endsWith( ".shp", Qt::CaseInsensitive ) || mFilePath.endsWith( ".dbf", Qt::CaseInsensitive ) ) { @@ -153,9 +153,9 @@ void QgsOgrProvider::repack() QgsMessageLog::logMessage( tr( "Possible corruption after REPACK detected. %1 still exists. This may point to a permission or locking problem of the original DBF." ).arg( packedDbf ), tr( "OGR" ), QgsMessageLog::CRITICAL ); OGR_DS_Destroy( ogrDataSource ); - ogrLayer = ogrOrigLayer = 0; + ogrLayer = ogrOrigLayer = nullptr; - ogrDataSource = OGROpen( TO8F( mFilePath ), true, NULL ); + ogrDataSource = OGROpen( TO8F( mFilePath ), true, nullptr ); if ( ogrDataSource ) { if ( mLayerName.isNull() ) @@ -267,14 +267,14 @@ QgsVectorLayerImport::ImportError QgsOgrProvider::createEmptyLayer( QgsOgrProvider::QgsOgrProvider( QString const & uri ) : QgsVectorDataProvider( uri ) - , ogrDataSource( 0 ) - , extent_( 0 ) - , ogrLayer( 0 ) - , ogrOrigLayer( 0 ) + , ogrDataSource( nullptr ) + , extent_( nullptr ) + , ogrLayer( nullptr ) + , ogrOrigLayer( nullptr ) , mLayerIndex( 0 ) , mIsSubLayer( false ) , mOgrGeometryTypeFilter( wkbUnknown ) - , ogrDriver( 0 ) + , ogrDriver( nullptr ) , mValid( false ) , geomType( wkbUnknown ) , mFeaturesCounted( -1 ) @@ -284,7 +284,7 @@ QgsOgrProvider::QgsOgrProvider( QString const & uri ) QgsApplication::registerOgrDrivers(); QSettings settings; - CPLSetConfigOption( "SHAPE_ENCODING", settings.value( "/qgis/ignoreShapeEncoding", true ).toBool() ? "" : 0 ); + CPLSetConfigOption( "SHAPE_ENCODING", settings.value( "/qgis/ignoreShapeEncoding", true ).toBool() ? "" : nullptr ); // make connection to the data source @@ -473,12 +473,12 @@ QgsOgrProvider::~QgsOgrProvider() { OGR_DS_Destroy( ogrDataSource ); } - ogrDataSource = 0; + ogrDataSource = nullptr; if ( extent_ ) { free( extent_ ); - extent_ = 0; + extent_ = nullptr; } QgsOgrConnPool::unrefS( mFilePath ); @@ -561,7 +561,7 @@ bool QgsOgrProvider::setSubsetString( const QString& theSQL, bool updateFeatureC if ( extent_ ) { free( extent_ ); - extent_ = 0; + extent_ = nullptr; } emit dataChanged(); @@ -864,7 +864,7 @@ void QgsOgrUtils::setRelevantFields( OGRLayerH ogrLayer, int fieldCount, bool fe if ( !fetchGeometry ) ignoredFields.append( "OGR_GEOMETRY" ); ignoredFields.append( "OGR_STYLE" ); // not used by QGIS - ignoredFields.append( NULL ); + ignoredFields.append( nullptr ); OGR_L_SetIgnoredFields( ogrLayer, ignoredFields.data() ); } @@ -884,10 +884,10 @@ QgsFeatureIterator QgsOgrProvider::getFeatures( const QgsFeatureRequest& request unsigned char * QgsOgrProvider::getGeometryPointer( OGRFeatureH fet ) { OGRGeometryH geom = OGR_F_GetGeometryRef( fet ); - unsigned char *gPtr = 0; + unsigned char *gPtr = nullptr; if ( !geom ) - return 0; + return nullptr; // get the wkb representation gPtr = new unsigned char[OGR_G_WkbSize( geom )]; @@ -955,7 +955,7 @@ void QgsOgrProvider::updateExtents() if ( extent_ ) { free( extent_ ); - extent_ = 0; + extent_ = nullptr; } } @@ -1005,11 +1005,11 @@ bool QgsOgrProvider::addFeature( QgsFeature& f ) if ( f.constGeometry() && f.constGeometry()->wkbSize() > 0 ) { const unsigned char* wkb = f.constGeometry()->asWkb(); - OGRGeometryH geom = NULL; + OGRGeometryH geom = nullptr; if ( wkb ) { - if ( OGR_G_CreateFromWkb( const_cast( wkb ), NULL, &geom, f.constGeometry()->wkbSize() ) != OGRERR_NONE ) + if ( OGR_G_CreateFromWkb( const_cast( wkb ), nullptr, &geom, f.constGeometry()->wkbSize() ) != OGRERR_NONE ) { pushError( tr( "OGR error creating wkb for feature %1: %2" ).arg( f.id() ).arg( CPLGetLastErrorMsg() ) ); return false; @@ -1312,8 +1312,8 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap &attr_ bool QgsOgrProvider::changeGeometryValues( QgsGeometryMap & geometry_map ) { - OGRFeatureH theOGRFeature = 0; - OGRGeometryH theNewGeometry = 0; + OGRFeatureH theOGRFeature = nullptr; + OGRGeometryH theNewGeometry = nullptr; setRelevantFields( ogrLayer, true, attributeIndexes() ); @@ -1340,7 +1340,7 @@ bool QgsOgrProvider::changeGeometryValues( QgsGeometryMap & geometry_map ) { pushError( tr( "OGR error creating geometry for feature %1: %2" ).arg( it.key() ).arg( CPLGetLastErrorMsg() ) ); OGR_G_DestroyGeometry( theNewGeometry ); - theNewGeometry = 0; + theNewGeometry = nullptr; continue; } @@ -1355,7 +1355,7 @@ bool QgsOgrProvider::changeGeometryValues( QgsGeometryMap & geometry_map ) { pushError( tr( "OGR error setting geometry of feature %1: %2" ).arg( it.key() ).arg( CPLGetLastErrorMsg() ) ); OGR_G_DestroyGeometry( theNewGeometry ); - theNewGeometry = 0; + theNewGeometry = nullptr; continue; } @@ -1364,7 +1364,7 @@ bool QgsOgrProvider::changeGeometryValues( QgsGeometryMap & geometry_map ) { pushError( tr( "OGR error setting feature %1: %2" ).arg( it.key() ).arg( CPLGetLastErrorMsg() ) ); OGR_G_DestroyGeometry( theNewGeometry ); - theNewGeometry = 0; + theNewGeometry = nullptr; continue; } mShapefileMayBeCorrupted = true; @@ -1432,7 +1432,7 @@ bool QgsOgrProvider::deleteFeatures( const QgsFeatureIds & id ) if ( extent_ ) { free( extent_ ); - extent_ = 0; + extent_ = nullptr; } return returnvalue; @@ -2154,7 +2154,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri, const QString &encoding, QGis::WkbType vectortype, const QList< QPair > &attributes, - const QgsCoordinateReferenceSystem *srs = NULL ) + const QgsCoordinateReferenceSystem *srs = nullptr ) { QgsDebugMsg( QString( "Creating empty vector layer with format: %1" ).arg( format ) ); @@ -2198,7 +2198,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri, } OGRDataSourceH dataSource; - dataSource = OGR_Dr_CreateDataSource( driver, TO8F( uri ), NULL ); + dataSource = OGR_Dr_CreateDataSource( driver, TO8F( uri ), nullptr ); if ( !dataSource ) { QgsMessageLog::logMessage( QObject::tr( "Creating the data source %1 failed: %2" ).arg( uri, QString::fromUtf8( CPLGetLastErrorMsg() ) ), QObject::tr( "OGR" ) ); @@ -2206,7 +2206,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri, } //consider spatial reference system - OGRSpatialReferenceH reference = NULL; + OGRSpatialReferenceH reference = nullptr; QgsCoordinateReferenceSystem mySpatialRefSys; if ( srs ) @@ -2254,7 +2254,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri, } } - char **papszOptions = NULL; + char **papszOptions = nullptr; if ( driverName == "ESRI Shapefile" ) { papszOptions = CSLSetNameValue( papszOptions, "ENCODING", QgsVectorFileWriter::convertCodecNameForEncodingOption( encoding ).toLocal8Bit().data() ); @@ -2270,7 +2270,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri, QSettings settings; if ( !settings.value( "/qgis/ignoreShapeEncoding", true ).toBool() ) { - CPLSetConfigOption( "SHAPE_ENCODING", 0 ); + CPLSetConfigOption( "SHAPE_ENCODING", nullptr ); } if ( !layer ) @@ -2416,7 +2416,7 @@ QgsCoordinateReferenceSystem QgsOgrProvider::crs() QgsDebugMsg( pszProj4 ); OGRFree( pszProj4 ); - char *pszWkt = NULL; + char *pszWkt = nullptr; OSRExportToWkt( mySpatialRefSys, &pszWkt ); srs.createFromWkt( pszWkt ); @@ -2458,15 +2458,15 @@ void QgsOgrProvider::uniqueValues( int index, QList &uniqueValues, int sql += " ORDER BY " + mEncoding->fromUnicode( fld.name() ) + " ASC"; // quoting of fieldname produces a syntax error QgsDebugMsg( QString( "SQL: %1" ).arg( mEncoding->toUnicode( sql ) ) ); - OGRLayerH l = OGR_DS_ExecuteSQL( ogrDataSource, sql.constData(), NULL, "SQL" ); - if ( l == 0 ) + OGRLayerH l = OGR_DS_ExecuteSQL( ogrDataSource, sql.constData(), nullptr, "SQL" ); + if ( l == nullptr ) { QgsDebugMsg( "Failed to execute SQL" ); return QgsVectorDataProvider::uniqueValues( index, uniqueValues, limit ); } OGRFeatureH f; - while ( 0 != ( f = OGR_L_GetNextFeature( l ) ) ) + while ( nullptr != ( f = OGR_L_GetNextFeature( l ) ) ) { uniqueValues << ( OGR_F_IsFieldSet( f, 0 ) ? convertValue( fld.type(), mEncoding->toUnicode( OGR_F_GetFieldAsString( f, 0 ) ) ) : QVariant( fld.type() ) ); OGR_F_Destroy( f ); @@ -2496,15 +2496,15 @@ QVariant QgsOgrProvider::minimumValue( int index ) sql += " WHERE " + mEncoding->fromUnicode( mSubsetString ); } - OGRLayerH l = OGR_DS_ExecuteSQL( ogrDataSource, sql.constData(), NULL, "SQL" ); - if ( l == 0 ) + OGRLayerH l = OGR_DS_ExecuteSQL( ogrDataSource, sql.constData(), nullptr, "SQL" ); + if ( l == nullptr ) { QgsDebugMsg( QString( "Failed to execute SQL: %1" ).arg( mEncoding->toUnicode( sql ) ) ); return QgsVectorDataProvider::minimumValue( index ); } OGRFeatureH f = OGR_L_GetNextFeature( l ); - if ( f == 0 ) + if ( f == nullptr ) { OGR_DS_ReleaseResultSet( ogrDataSource, l ); return QVariant(); @@ -2535,15 +2535,15 @@ QVariant QgsOgrProvider::maximumValue( int index ) sql += " WHERE " + mEncoding->fromUnicode( mSubsetString ); } - OGRLayerH l = OGR_DS_ExecuteSQL( ogrDataSource, sql.constData(), NULL, "SQL" ); - if ( l == 0 ) + OGRLayerH l = OGR_DS_ExecuteSQL( ogrDataSource, sql.constData(), nullptr, "SQL" ); + if ( l == nullptr ) { QgsDebugMsg( QString( "Failed to execute SQL: %1" ).arg( mEncoding->toUnicode( sql ) ) ); return QgsVectorDataProvider::maximumValue( index ); } OGRFeatureH f = OGR_L_GetNextFeature( l ); - if ( f == 0 ) + if ( f == nullptr ) { OGR_DS_ReleaseResultSet( ogrDataSource, l ); return QVariant(); @@ -2653,7 +2653,7 @@ void QgsOgrProvider::recalculateFeatureCount() if ( filter ) { filter = OGR_G_Clone( filter ); - OGR_L_SetSpatialFilter( ogrLayer, 0 ); + OGR_L_SetSpatialFilter( ogrLayer, nullptr ); } // feature count returns number of features within current spatial filter @@ -2734,7 +2734,7 @@ OGRLayerH QgsOgrUtils::setSubsetString( OGRLayerH layer, OGRDataSourceH ds, QTex sql += " WHERE " + encoding->fromUnicode( subsetString ); QgsDebugMsg( QString( "SQL: %1" ).arg( encoding->toUnicode( sql ) ) ); - return OGR_DS_ExecuteSQL( ds, sql.constData(), NULL, NULL ); + return OGR_DS_ExecuteSQL( ds, sql.constData(), nullptr, nullptr ); } // --------------------------------------------------------------------------- diff --git a/src/providers/ogr/qgsogrprovider.h b/src/providers/ogr/qgsogrprovider.h index fbd2618cf9c..3782173ade0 100644 --- a/src/providers/ogr/qgsogrprovider.h +++ b/src/providers/ogr/qgsogrprovider.h @@ -57,8 +57,8 @@ class QgsOgrProvider : public QgsVectorDataProvider const QgsCoordinateReferenceSystem *srs, bool overwrite, QMap *oldToNewAttrIdxMap, - QString *errorMessage = 0, - const QMap *options = 0 + QString *errorMessage = nullptr, + const QMap *options = nullptr ); /** diff --git a/src/providers/ows/qgsowsdataitems.cpp b/src/providers/ows/qgsowsdataitems.cpp index 8494b181dd9..46ee30d317d 100644 --- a/src/providers/ows/qgsowsdataitems.cpp +++ b/src/providers/ows/qgsowsdataitems.cpp @@ -227,7 +227,7 @@ QWidget * QgsOWSRootItem::paramWidget() connect( select, SIGNAL( connectionsChanged() ), this, SLOT( connectionsChanged() ) ); return select; #endif - return 0; + return nullptr; } void QgsOWSRootItem::connectionsChanged() { @@ -263,7 +263,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) { return new QgsOWSRootItem( parentItem, "OWS", "ows:" ); } - return 0; + return nullptr; } //QGISEXTERN QgsOWSSourceSelect * selectWidget( QWidget * parent, Qt::WindowFlags fl ) @@ -272,5 +272,5 @@ QGISEXTERN QDialog * selectWidget( QWidget * parent, Qt::WindowFlags fl ) Q_UNUSED( parent ); Q_UNUSED( fl ); //return new QgsOWSSourceSelect( parent, fl ); - return 0; + return nullptr; } diff --git a/src/providers/ows/qgsowsprovider.h b/src/providers/ows/qgsowsprovider.h index 6fb4c4a42b8..e4aa428c8de 100644 --- a/src/providers/ows/qgsowsprovider.h +++ b/src/providers/ows/qgsowsprovider.h @@ -45,7 +45,7 @@ class QgsOwsProvider : public QgsDataProvider * otherwise we contact the host directly. * */ - explicit QgsOwsProvider( QString const & uri = 0 ); + explicit QgsOwsProvider( QString const & uri = nullptr ); //! Destructor ~QgsOwsProvider(); diff --git a/src/providers/postgres/qgscolumntypethread.cpp b/src/providers/postgres/qgscolumntypethread.cpp index f3d040ccd76..a82f76329b4 100644 --- a/src/providers/postgres/qgscolumntypethread.cpp +++ b/src/providers/postgres/qgscolumntypethread.cpp @@ -23,7 +23,7 @@ email : jef at norbit dot de QgsGeomColumnTypeThread::QgsGeomColumnTypeThread( QString name, bool useEstimatedMetaData, bool allowGeometrylessTables ) : QThread() - , mConn( 0 ) + , mConn( nullptr ) , mName( name ) , mUseEstimatedMetadata( useEstimatedMetaData ) , mAllowGeometrylessTables( allowGeometrylessTables ) @@ -64,7 +64,7 @@ void QgsGeomColumnTypeThread::run() layerProperties.isEmpty() ) { mConn->unref(); - mConn = 0; + mConn = nullptr; return; } @@ -110,5 +110,5 @@ void QgsGeomColumnTypeThread::run() emit progressMessage( tr( "Table retrieval finished." ) ); mConn->unref(); - mConn = 0; + mConn = nullptr; } diff --git a/src/providers/postgres/qgspgnewconnection.cpp b/src/providers/postgres/qgspgnewconnection.cpp index 0d6e0aa0826..6f58a0fcc49 100644 --- a/src/providers/postgres/qgspgnewconnection.cpp +++ b/src/providers/postgres/qgspgnewconnection.cpp @@ -27,7 +27,7 @@ QgsPgNewConnection::QgsPgNewConnection( QWidget *parent, const QString& connName, Qt::WindowFlags fl ) : QDialog( parent, fl ), mOriginalConnName( connName ) - , mAuthConfigSelect( 0 ) + , mAuthConfigSelect( nullptr ) { setupUi( this ); diff --git a/src/providers/postgres/qgspgnewconnection.h b/src/providers/postgres/qgspgnewconnection.h index 6c74e4e186b..8749a98fba2 100644 --- a/src/providers/postgres/qgspgnewconnection.h +++ b/src/providers/postgres/qgspgnewconnection.h @@ -30,7 +30,7 @@ class QgsPgNewConnection : public QDialog, private Ui::QgsPgNewConnectionBase Q_OBJECT public: //! Constructor - QgsPgNewConnection( QWidget *parent = 0, const QString& connName = QString::null, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); + QgsPgNewConnection( QWidget *parent = nullptr, const QString& connName = QString::null, Qt::WindowFlags fl = QgisGui::ModalDialogFlags ); //! Destructor ~QgsPgNewConnection(); //! Tests the connection using the parameters supplied diff --git a/src/providers/postgres/qgspgsourceselect.cpp b/src/providers/postgres/qgspgsourceselect.cpp index b058b5f9d31..a2d1280ddf8 100644 --- a/src/providers/postgres/qgspgsourceselect.cpp +++ b/src/providers/postgres/qgspgsourceselect.cpp @@ -45,7 +45,7 @@ QWidget *QgsPgSourceSelectDelegate::createEditor( QWidget *parent, const QStyleO QString tableName = index.sibling( index.row(), QgsPgTableModel::dbtmTable ).data( Qt::DisplayRole ).toString(); if ( tableName.isEmpty() ) - return 0; + return nullptr; if ( index.column() == QgsPgTableModel::dbtmSql ) { @@ -104,7 +104,7 @@ QWidget *QgsPgSourceSelectDelegate::createEditor( QWidget *parent, const QStyleO return le; } - return 0; + return nullptr; } void QgsPgSourceSelectDelegate::setEditorData( QWidget *editor, const QModelIndex &index ) const @@ -197,7 +197,7 @@ QgsPgSourceSelect::QgsPgSourceSelect( QWidget *parent, Qt::WindowFlags fl, bool : QDialog( parent, fl ) , mManagerMode( managerMode ) , mEmbeddedMode( embeddedMode ) - , mColumnTypeThread( 0 ) + , mColumnTypeThread( nullptr ) , mUseEstimatedMetadata( false ) { setupUi( this ); @@ -572,7 +572,7 @@ void QgsPgSourceSelect::finishList() void QgsPgSourceSelect::columnThreadFinished() { delete mColumnTypeThread; - mColumnTypeThread = 0; + mColumnTypeThread = nullptr; btnConnect->setText( tr( "Connect" ) ); finishList(); diff --git a/src/providers/postgres/qgspgsourceselect.h b/src/providers/postgres/qgspgsourceselect.h index ef5d2b98cd0..97b4e0085ff 100644 --- a/src/providers/postgres/qgspgsourceselect.h +++ b/src/providers/postgres/qgspgsourceselect.h @@ -40,7 +40,7 @@ class QgsPgSourceSelectDelegate : public QItemDelegate Q_OBJECT public: - explicit QgsPgSourceSelectDelegate( QObject *parent = NULL ) + explicit QgsPgSourceSelectDelegate( QObject *parent = nullptr ) : QItemDelegate( parent ) {} @@ -63,7 +63,7 @@ class QgsPgSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase public: //! Constructor - QgsPgSourceSelect( QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false ); + QgsPgSourceSelect( QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false ); //! Destructor ~QgsPgSourceSelect(); //! Populate the connection list combo box diff --git a/src/providers/postgres/qgspgtablemodel.cpp b/src/providers/postgres/qgspgtablemodel.cpp index 36442c133e0..b92a091407d 100644 --- a/src/providers/postgres/qgspgtablemodel.cpp +++ b/src/providers/postgres/qgspgtablemodel.cpp @@ -48,7 +48,7 @@ void QgsPgTableModel::addTableEntry( const QgsPostgresLayerProperty& layerProper QgsDebugMsg( layerProperty.toString() ); // is there already a root item with the given scheme Name? - QStandardItem *schemaItem = 0; + QStandardItem *schemaItem = nullptr; for ( int i = 0; i < layerProperty.size(); i++ ) { diff --git a/src/providers/postgres/qgspostgresconn.cpp b/src/providers/postgres/qgspostgresconn.cpp index 3b0925143cb..c3462c73d87 100644 --- a/src/providers/postgres/qgspostgresconn.cpp +++ b/src/providers/postgres/qgspostgresconn.cpp @@ -45,7 +45,7 @@ QgsPostgresResult::~QgsPostgresResult() { if ( mRes ) ::PQclear( mRes ); - mRes = 0; + mRes = nullptr; } QgsPostgresResult &QgsPostgresResult::operator=( PGresult * theRes ) @@ -161,7 +161,7 @@ QgsPostgresConn *QgsPostgresConn::connectDb( QString conninfo, bool readonly, bo if ( conn->mRef == 0 ) { delete conn; - return 0; + return nullptr; } if ( shared ) @@ -295,7 +295,7 @@ QgsPostgresConn::QgsPostgresConn( const QString& conninfo, bool readOnly, bool s QgsDebugMsg( "Topology support available!" ); } - PQsetNoticeProcessor( mConn, noticeProcessor, 0 ); + PQsetNoticeProcessor( mConn, noticeProcessor, nullptr ); } QgsPostgresConn::~QgsPostgresConn() @@ -303,7 +303,7 @@ QgsPostgresConn::~QgsPostgresConn() Q_ASSERT( mRef == 0 ); if ( mConn ) ::PQfinish( mConn ); - mConn = 0; + mConn = nullptr; } void QgsPostgresConn::unref() @@ -949,7 +949,7 @@ PGresult *QgsPostgresConn::PQexec( const QString& query, bool logError ) .arg( query ).arg( PQstatus() ).arg( PQerrorMessage() ) ); } - return 0; + return nullptr; } QgsDebugMsgLevel( QString( "Executing SQL: %1" ).arg( query ), 3 ); @@ -1096,12 +1096,12 @@ PGresult *QgsPostgresConn::PQexecPrepared( const QString& stmtName, const QStrin qparam << params[i].toUtf8(); if ( params[i].isNull() ) - param[i] = 0; + param[i] = nullptr; else param[i] = qparam[i]; } - PGresult *res = ::PQexecPrepared( mConn, stmtName.toUtf8(), params.size(), param, NULL, NULL, 0 ); + PGresult *res = ::PQexecPrepared( mConn, stmtName.toUtf8(), params.size(), param, nullptr, nullptr, 0 ); delete [] param; @@ -1112,7 +1112,7 @@ void QgsPostgresConn::PQfinish() { Q_ASSERT( mConn ); ::PQfinish( mConn ); - mConn = 0; + mConn = nullptr; } int QgsPostgresConn::PQstatus() diff --git a/src/providers/postgres/qgspostgresconn.h b/src/providers/postgres/qgspostgresconn.h index 6de88348741..151be2155e4 100644 --- a/src/providers/postgres/qgspostgresconn.h +++ b/src/providers/postgres/qgspostgresconn.h @@ -150,7 +150,7 @@ struct QgsPostgresLayerProperty class QgsPostgresResult { public: - explicit QgsPostgresResult( PGresult *theRes = 0 ) : mRes( theRes ) {} + explicit QgsPostgresResult( PGresult *theRes = nullptr ) : mRes( theRes ) {} ~QgsPostgresResult(); QgsPostgresResult &operator=( PGresult *theRes ); diff --git a/src/providers/postgres/qgspostgresdataitems.cpp b/src/providers/postgres/qgspostgresdataitems.cpp index ff898d91f7f..665c527548f 100644 --- a/src/providers/postgres/qgspostgresdataitems.cpp +++ b/src/providers/postgres/qgspostgresdataitems.cpp @@ -128,7 +128,7 @@ QList QgsPGConnectionItem::actions() void QgsPGConnectionItem::editConnection() { - QgsPgNewConnection nc( NULL, mName ); + QgsPgNewConnection nc( nullptr, mName ); if ( nc.exec() ) { // the parent should be updated @@ -139,7 +139,7 @@ void QgsPGConnectionItem::editConnection() void QgsPGConnectionItem::deleteConnection() { - if ( QMessageBox::question( 0, QObject::tr( "Delete Connection" ), + if ( QMessageBox::question( nullptr, QObject::tr( "Delete Connection" ), QObject::tr( "Are you sure you want to delete the connection to %1?" ).arg( mName ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes ) return; @@ -158,7 +158,7 @@ void QgsPGConnectionItem::refreshConnection() void QgsPGConnectionItem::createSchema() { - QString schemaName = QInputDialog::getText( 0, tr( "Create Schema" ), tr( "Schema name:" ) ); + QString schemaName = QInputDialog::getText( nullptr, tr( "Create Schema" ), tr( "Schema name:" ) ); if ( schemaName.isEmpty() ) return; @@ -166,7 +166,7 @@ void QgsPGConnectionItem::createSchema() QgsPostgresConn *conn = QgsPostgresConn::connectDb( uri.connectionInfo(), false ); if ( !conn ) { - QMessageBox::warning( 0, tr( "Create Schema" ), tr( "Unable to create schema." ) ); + QMessageBox::warning( nullptr, tr( "Create Schema" ), tr( "Unable to create schema." ) ); return; } @@ -176,7 +176,7 @@ void QgsPGConnectionItem::createSchema() QgsPostgresResult result( conn->PQexec( sql ) ); if ( result.PQresultStatus() != PGRES_COMMAND_OK ) { - QMessageBox::warning( 0, tr( "Create Schema" ), tr( "Unable to create schema %1\n%2" ).arg( schemaName, + QMessageBox::warning( nullptr, tr( "Create Schema" ), tr( "Unable to create schema %1\n%2" ).arg( schemaName, result.PQresultErrorMessage() ) ); conn->unref(); return; @@ -201,7 +201,7 @@ bool QgsPGConnectionItem::handleDrop( const QMimeData * data, QString toSchema ) qApp->setOverrideCursor( Qt::WaitCursor ); - QProgressDialog *progress = new QProgressDialog( tr( "Copying features..." ), tr( "Abort" ), 0, 0, 0 ); + QProgressDialog *progress = new QProgressDialog( tr( "Copying features..." ), tr( "Abort" ), 0, 0, nullptr ); progress->setWindowTitle( tr( "Import layer" ) ); progress->setWindowModality( Qt::WindowModal ); progress->show(); @@ -233,7 +233,7 @@ bool QgsPGConnectionItem::handleDrop( const QMimeData * data, QString toSchema ) QgsVectorLayerImport::ImportError err; QString importError; - err = QgsVectorLayerImport::importLayer( srcLayer, uri.uri(), "postgres", &srcLayer->crs(), false, &importError, false, 0, progress ); + err = QgsVectorLayerImport::importLayer( srcLayer, uri.uri(), "postgres", &srcLayer->crs(), false, &importError, false, nullptr, progress ); if ( err == QgsVectorLayerImport::NoError ) importResults.append( tr( "%1: OK!" ).arg( u.name ) ); else @@ -264,7 +264,7 @@ bool QgsPGConnectionItem::handleDrop( const QMimeData * data, QString toSchema ) } else { - QMessageBox::information( 0, tr( "Import to PostGIS database" ), tr( "Import was successful." ) ); + QMessageBox::information( nullptr, tr( "Import to PostGIS database" ), tr( "Import was successful." ) ); refresh(); } @@ -316,7 +316,7 @@ QList QgsPGLayerItem::actions() void QgsPGLayerItem::deleteLayer() { - if ( QMessageBox::question( 0, QObject::tr( "Delete Table" ), + if ( QMessageBox::question( nullptr, QObject::tr( "Delete Table" ), QObject::tr( "Are you sure you want to delete %1.%2?" ).arg( mLayerProperty.schemaName, mLayerProperty.tableName ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes ) return; @@ -325,11 +325,11 @@ void QgsPGLayerItem::deleteLayer() bool res = ::deleteLayer( mUri, errCause ); if ( !res ) { - QMessageBox::warning( 0, tr( "Delete Table" ), errCause ); + QMessageBox::warning( nullptr, tr( "Delete Table" ), errCause ); } else { - QMessageBox::information( 0, tr( "Delete Table" ), tr( "Table deleted successfully." ) ); + QMessageBox::information( nullptr, tr( "Delete Table" ), tr( "Table deleted successfully." ) ); if ( mParent ) mParent->refresh(); } @@ -359,7 +359,7 @@ void QgsPGLayerItem::renameLayer() QgsPostgresConn *conn = QgsPostgresConn::connectDb( dsUri.connectionInfo(), false ); if ( !conn ) { - QMessageBox::warning( 0, tr( "Rename %1" ).arg( typeName ), tr( "Unable to rename %1." ).arg( lowerTypeName ) ); + QMessageBox::warning( nullptr, tr( "Rename %1" ).arg( typeName ), tr( "Unable to rename %1." ).arg( lowerTypeName ) ); return; } @@ -378,7 +378,7 @@ void QgsPGLayerItem::renameLayer() QgsPostgresResult result( conn->PQexec( sql ) ); if ( result.PQresultStatus() != PGRES_COMMAND_OK ) { - QMessageBox::warning( 0, tr( "Rename %1" ).arg( typeName ), tr( "Unable to rename %1 %2\n%3" ).arg( lowerTypeName, mName, + QMessageBox::warning( nullptr, tr( "Rename %1" ).arg( typeName ), tr( "Unable to rename %1 %2\n%3" ).arg( lowerTypeName, mName, result.PQresultErrorMessage() ) ); conn->unref(); return; @@ -391,7 +391,7 @@ void QgsPGLayerItem::renameLayer() void QgsPGLayerItem::truncateTable() { - if ( QMessageBox::question( 0, QObject::tr( "Truncate Table" ), + if ( QMessageBox::question( nullptr, QObject::tr( "Truncate Table" ), QObject::tr( "Are you sure you want to truncate %1.%2?\n\nThis will delete all data within the table." ).arg( mLayerProperty.schemaName, mLayerProperty.tableName ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes ) return; @@ -400,7 +400,7 @@ void QgsPGLayerItem::truncateTable() QgsPostgresConn *conn = QgsPostgresConn::connectDb( dsUri.connectionInfo(), false ); if ( !conn ) { - QMessageBox::warning( 0, tr( "Truncate Table" ), tr( "Unable to truncate table." ) ); + QMessageBox::warning( nullptr, tr( "Truncate Table" ), tr( "Unable to truncate table." ) ); return; } @@ -418,20 +418,20 @@ void QgsPGLayerItem::truncateTable() QgsPostgresResult result( conn->PQexec( sql ) ); if ( result.PQresultStatus() != PGRES_COMMAND_OK ) { - QMessageBox::warning( 0, tr( "Truncate Table" ), tr( "Unable to truncate %1\n%2" ).arg( mName, + QMessageBox::warning( nullptr, tr( "Truncate Table" ), tr( "Unable to truncate %1\n%2" ).arg( mName, result.PQresultErrorMessage() ) ); conn->unref(); return; } conn->unref(); - QMessageBox::information( 0, tr( "Truncate Table" ), tr( "Table truncated successfully." ) ); + QMessageBox::information( nullptr, tr( "Truncate Table" ), tr( "Table truncated successfully." ) ); } QString QgsPGLayerItem::createUri() { QString pkColName = !mLayerProperty.pkCols.isEmpty() ? mLayerProperty.pkCols.at( 0 ) : QString::null; - QgsPGConnectionItem *connItem = qobject_cast( parent() ? parent()->parent() : 0 ); + QgsPGConnectionItem *connItem = qobject_cast( parent() ? parent()->parent() : nullptr ); if ( !connItem ) { @@ -549,7 +549,7 @@ void QgsPGSchemaItem::deleteSchema() QgsPostgresConn *conn = QgsPostgresConn::connectDb( uri.connectionInfo(), false ); if ( !conn ) { - QMessageBox::warning( 0, tr( "Delete Schema" ), tr( "Unable to delete schema." ) ); + QMessageBox::warning( nullptr, tr( "Delete Schema" ), tr( "Unable to delete schema." ) ); return; } @@ -557,7 +557,7 @@ void QgsPGSchemaItem::deleteSchema() QgsPostgresResult result( conn->PQexec( sql ) ); if ( result.PQresultStatus() != PGRES_TUPLES_OK ) { - QMessageBox::warning( 0, tr( "Delete Schema" ), tr( "Unable to delete schema." ) ); + QMessageBox::warning( nullptr, tr( "Delete Schema" ), tr( "Unable to delete schema." ) ); conn->unref(); return; } @@ -580,7 +580,7 @@ void QgsPGSchemaItem::deleteSchema() { objects += QString( "\n[%1 additional objects not listed]" ).arg( count - maxListed ); } - if ( QMessageBox::question( 0, QObject::tr( "Delete Schema" ), + if ( QMessageBox::question( nullptr, QObject::tr( "Delete Schema" ), QObject::tr( "Schema '%1' contains objects:\n\n%2\n\nAre you sure you want to delete the schema and all these objects?" ).arg( mName, objects ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes ) { @@ -590,7 +590,7 @@ void QgsPGSchemaItem::deleteSchema() } else { - if ( QMessageBox::question( 0, QObject::tr( "Delete Schema" ), + if ( QMessageBox::question( nullptr, QObject::tr( "Delete Schema" ), QObject::tr( "Are you sure you want to delete the schema '%1'?" ).arg( mName ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes ) return; @@ -600,11 +600,11 @@ void QgsPGSchemaItem::deleteSchema() bool res = ::deleteSchema( mName, uri, errCause, count > 0 ); if ( !res ) { - QMessageBox::warning( 0, tr( "Delete Schema" ), errCause ); + QMessageBox::warning( nullptr, tr( "Delete Schema" ), errCause ); } else { - QMessageBox::information( 0, tr( "Delete Schema" ), tr( "Schema deleted successfully." ) ); + QMessageBox::information( nullptr, tr( "Delete Schema" ), tr( "Schema deleted successfully." ) ); if ( mParent ) mParent->refresh(); } @@ -622,7 +622,7 @@ void QgsPGSchemaItem::renameSchema() QgsPostgresConn *conn = QgsPostgresConn::connectDb( uri.connectionInfo(), false ); if ( !conn ) { - QMessageBox::warning( 0, tr( "Rename Schema" ), tr( "Unable to rename schema." ) ); + QMessageBox::warning( nullptr, tr( "Rename Schema" ), tr( "Unable to rename schema." ) ); return; } @@ -633,14 +633,14 @@ void QgsPGSchemaItem::renameSchema() QgsPostgresResult result( conn->PQexec( sql ) ); if ( result.PQresultStatus() != PGRES_COMMAND_OK ) { - QMessageBox::warning( 0, tr( "Rename Schema" ), tr( "Unable to rename schema %1\n%2" ).arg( schemaName, + QMessageBox::warning( nullptr, tr( "Rename Schema" ), tr( "Unable to rename schema %1\n%2" ).arg( schemaName, result.PQresultErrorMessage() ) ); conn->unref(); return; } conn->unref(); - QMessageBox::information( 0, tr( "Rename Schema" ), tr( "Schema renamed successfully." ) ); + QMessageBox::information( nullptr, tr( "Rename Schema" ), tr( "Schema renamed successfully." ) ); if ( mParent ) mParent->refresh(); } @@ -670,7 +670,7 @@ QgsPGLayerItem *QgsPGSchemaItem::createLayer( QgsPostgresLayerProperty layerProp break; default: if ( !layerProperty.geometryColName.isEmpty() ) - return 0; + return nullptr; layerType = QgsLayerItem::TableLayer; tip = tr( "as geometryless table" ); @@ -726,7 +726,7 @@ QList QgsPGRootItem::actions() QWidget *QgsPGRootItem::paramWidget() { - QgsPgSourceSelect *select = new QgsPgSourceSelect( 0, 0, true, true ); + QgsPgSourceSelect *select = new QgsPgSourceSelect( nullptr, nullptr, true, true ); connect( select, SIGNAL( connectionsChanged() ), this, SLOT( connectionsChanged() ) ); return select; } @@ -738,14 +738,14 @@ void QgsPGRootItem::connectionsChanged() void QgsPGRootItem::newConnection() { - QgsPgNewConnection nc( NULL ); + QgsPgNewConnection nc( nullptr ); if ( nc.exec() ) { refresh(); } } -QMainWindow *QgsPGRootItem::sMainWindow = 0; +QMainWindow *QgsPGRootItem::sMainWindow = nullptr; QGISEXTERN void registerGui( QMainWindow *mainWindow ) { diff --git a/src/providers/postgres/qgspostgresfeatureiterator.cpp b/src/providers/postgres/qgspostgresfeatureiterator.cpp index 70c6cfc2ff5..e9cf6210a60 100644 --- a/src/providers/postgres/qgspostgresfeatureiterator.cpp +++ b/src/providers/postgres/qgspostgresfeatureiterator.cpp @@ -261,7 +261,7 @@ bool QgsPostgresFeatureIterator::close() { mConn->unlock(); } - mConn = 0; + mConn = nullptr; while ( !mFeatureQueue.empty() ) { @@ -585,7 +585,7 @@ bool QgsPostgresFeatureIterator::getFeature( QgsPostgresResult &queryResult, int } else { - feature.setGeometry( 0 ); + feature.setGeometry( nullptr ); } col++; @@ -693,7 +693,7 @@ QgsPostgresFeatureSource::QgsPostgresFeatureSource( const QgsPostgresProvider* p } else { - mTransactionConnection = 0; + mTransactionConnection = nullptr; } } diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp index c924a837053..eb5a1a6303e 100644 --- a/src/providers/postgres/qgspostgresprovider.cpp +++ b/src/providers/postgres/qgspostgresprovider.cpp @@ -54,9 +54,9 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri ) , mUseEstimatedMetadata( false ) , mSelectAtIdDisabled( false ) , mEnabledCapabilities( 0 ) - , mConnectionRO( 0 ) - , mConnectionRW( 0 ) - , mTransaction( 0 ) + , mConnectionRO( nullptr ) + , mConnectionRW( nullptr ) + , mTransaction( nullptr ) { QgsDebugMsg( QString( "URI: %1 " ).arg( uri ) ); @@ -269,13 +269,13 @@ void QgsPostgresProvider::disconnectDb() if ( mConnectionRO ) { mConnectionRO->unref(); - mConnectionRO = 0; + mConnectionRO = nullptr; } if ( mConnectionRW ) { mConnectionRW->unref(); - mConnectionRW = 0; + mConnectionRW = nullptr; } } @@ -1893,7 +1893,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist ) insert += values + ')'; QgsDebugMsg( QString( "prepare addfeatures: %1" ).arg( insert ) ); - QgsPostgresResult stmt( conn->PQprepare( "addfeatures", insert, fieldId.size() + offset - 1, NULL ) ); + QgsPostgresResult stmt( conn->PQprepare( "addfeatures", insert, fieldId.size() + offset - 1, nullptr ) ); if ( stmt.PQresultStatus() != PGRES_COMMAND_OK ) throw PGException( stmt ); @@ -2348,7 +2348,7 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map ) QgsDebugMsg( "getting old topogeometry id: " + getid ); - result = connectionRO()->PQprepare( "getid", getid, 1, NULL ); + result = connectionRO()->PQprepare( "getid", getid, 1, nullptr ); if ( result.PQresultStatus() != PGRES_COMMAND_OK ) { QgsDebugMsg( QString( "Exception thrown due to PQprepare of this query returning != PGRES_COMMAND_OK (%1 != expected %2): %3" ) @@ -2363,7 +2363,7 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map ) quotedIdentifier( mGeometryColumn ), pkParamWhereClause( 2 ) ); QgsDebugMsg( "TopoGeom swap: " + replace ); - result = conn->PQprepare( "replacetopogeom", replace, 2, NULL ); + result = conn->PQprepare( "replacetopogeom", replace, 2, nullptr ); if ( result.PQresultStatus() != PGRES_COMMAND_OK ) { QgsDebugMsg( QString( "Exception thrown due to PQprepare of this query returning != PGRES_COMMAND_OK (%1 != expected %2): %3" ) @@ -2383,7 +2383,7 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map ) QgsDebugMsg( "updating: " + update ); - result = conn->PQprepare( "updatefeatures", update, 2, NULL ); + result = conn->PQprepare( "updatefeatures", update, 2, nullptr ); if ( result.PQresultStatus() != PGRES_COMMAND_OK && result.PQresultStatus() != PGRES_TUPLES_OK ) { QgsDebugMsg( QString( "Exception thrown due to PQprepare of this query returning != PGRES_COMMAND_OK (%1 != expected %2): %3" ) @@ -3725,7 +3725,7 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS res = conn->PQexec( checkQuery ); if ( res.PQntuples() > 0 ) { - if ( QMessageBox::question( 0, QObject::tr( "Save style in database" ), + if ( QMessageBox::question( nullptr, QObject::tr( "Save style in database" ), QObject::tr( "A style named \"%1\" already exists in the database for this layer. Do you want to overwrite it?" ) .arg( styleName.isEmpty() ? dsUri.table() : styleName ), QMessageBox::Yes | QMessageBox::No ) == QMessageBox::No ) diff --git a/src/providers/postgres/qgspostgresprovider.h b/src/providers/postgres/qgspostgresprovider.h index 761edb8105b..585366b9879 100644 --- a/src/providers/postgres/qgspostgresprovider.h +++ b/src/providers/postgres/qgspostgresprovider.h @@ -61,8 +61,8 @@ class QgsPostgresProvider : public QgsVectorDataProvider const QgsCoordinateReferenceSystem *srs, bool overwrite, QMap *oldToNewAttrIdxMap, - QString *errorMessage = 0, - const QMap *options = 0 + QString *errorMessage = nullptr, + const QMap *options = nullptr ); /** @@ -320,7 +320,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider * @param offset specifies offset to use for the pk value parameter * @param alias specifies an optional alias given to the subject table */ - QString pkParamWhereClause( int offset, const char* alias = 0 ) const; + QString pkParamWhereClause( int offset, const char* alias = nullptr ) const; QString whereClause( QgsFeatureId featureId ) const; QString whereClause( QgsFeatureIds featureIds ) const; QString filterWhereClause() const; @@ -334,7 +334,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider bool loadFields(); /** Convert a QgsField to work with PG */ - static bool convertField( QgsField &field, const QMap *options = 0 ); + static bool convertField( QgsField &field, const QMap *options = nullptr ); /** Parses the enum_range of an attribute and inserts the possible values into a stringlist @param enumValues the stringlist where the values are appended diff --git a/src/providers/postgres/qgspostgrestransaction.cpp b/src/providers/postgres/qgspostgrestransaction.cpp index 4c5b94da8e8..4c2b612d18e 100644 --- a/src/providers/postgres/qgspostgrestransaction.cpp +++ b/src/providers/postgres/qgspostgrestransaction.cpp @@ -21,7 +21,7 @@ #include "qgis.h" QgsPostgresTransaction::QgsPostgresTransaction( const QString &connString ) - : QgsTransaction( connString ), mConn( 0 ) + : QgsTransaction( connString ), mConn( nullptr ) { } @@ -39,7 +39,7 @@ bool QgsPostgresTransaction::commitTransaction( QString &error ) if ( executeSql( "COMMIT TRANSACTION", error ) ) { mConn->unref(); - mConn = 0; + mConn = nullptr; return true; } return false; @@ -50,7 +50,7 @@ bool QgsPostgresTransaction::rollbackTransaction( QString &error ) if ( executeSql( "ROLLBACK TRANSACTION", error ) ) { mConn->unref(); - mConn = 0; + mConn = nullptr; return true; } return false; diff --git a/src/providers/spatialite/qgsspatialiteconnection.cpp b/src/providers/spatialite/qgsspatialiteconnection.cpp index ef1d8a7be7e..ee38b4de812 100644 --- a/src/providers/spatialite/qgsspatialiteconnection.cpp +++ b/src/providers/spatialite/qgsspatialiteconnection.cpp @@ -69,7 +69,7 @@ QgsSpatiaLiteConnection::Error QgsSpatiaLiteConnection::fetchTables( bool loadGe } sqlite3 *handle = openSpatiaLiteDb( fi.canonicalFilePath() ); - if ( handle == NULL ) + if ( handle == nullptr ) { return FailedToOpen; } @@ -120,12 +120,12 @@ bool QgsSpatiaLiteConnection::updateStatistics() } sqlite3* handle = openSpatiaLiteDb( fi.canonicalFilePath() ); - if ( handle == NULL ) + if ( handle == nullptr ) { return false; } - bool ret = update_layer_statistics( handle, NULL, NULL ); + bool ret = update_layer_statistics( handle, nullptr, nullptr ); closeSpatiaLiteDb( handle ); @@ -137,15 +137,15 @@ bool QgsSpatiaLiteConnection::updateStatistics() sqlite3 *QgsSpatiaLiteConnection::openSpatiaLiteDb( const QString& path ) { - sqlite3 *handle = NULL; + sqlite3 *handle = nullptr; int ret; // trying to open the SQLite DB - ret = QgsSLConnect::sqlite3_open_v2( path.toUtf8().constData(), &handle, SQLITE_OPEN_READWRITE, NULL ); + ret = QgsSLConnect::sqlite3_open_v2( path.toUtf8().constData(), &handle, SQLITE_OPEN_READWRITE, nullptr ); if ( ret ) { // failure mErrorMsg = sqlite3_errmsg( handle ); - return NULL; + return nullptr; } return handle; } @@ -181,7 +181,7 @@ int QgsSpatiaLiteConnection::checkHasMetadataTables( sqlite3* handle ) char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; // checking if table GEOMETRY_COLUMNS exists and has the expected layout ret = sqlite3_get_table( handle, "PRAGMA table_info(geometry_columns)", &results, &rows, &columns, &errMsg ); @@ -282,7 +282,7 @@ bool QgsSpatiaLiteConnection::getTableInfoAbstractInterface( sqlite3 * handle, b char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString sql; gaiaVectorLayersListPtr list; @@ -296,11 +296,11 @@ bool QgsSpatiaLiteConnection::getTableInfoAbstractInterface( sqlite3 * handle, b } // attempting to load the VectorLayersList - list = gaiaGetVectorLayersList( handle, NULL, NULL, GAIA_VECTORS_LIST_FAST ); - if ( list != NULL ) + list = gaiaGetVectorLayersList( handle, nullptr, nullptr, GAIA_VECTORS_LIST_FAST ); + if ( list != nullptr ) { gaiaVectorLayerPtr lyr = list->First; - while ( lyr != NULL ) + while ( lyr != nullptr ) { // populating the QGIS own Layers List if ( lyr->AuthInfos ) @@ -377,7 +377,7 @@ bool QgsSpatiaLiteConnection::getTableInfoAbstractInterface( sqlite3 * handle, b error: // unexpected IO error mErrorMsg = tr( "unknown error cause" ); - if ( errMsg != NULL ) + if ( errMsg != nullptr ) { mErrorMsg = errMsg; sqlite3_free( errMsg ); @@ -393,7 +393,7 @@ bool QgsSpatiaLiteConnection::getTableInfo( sqlite3 * handle, bool loadGeometryl char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString sql; // the following query return the tables containing a Geometry column @@ -481,7 +481,7 @@ bool QgsSpatiaLiteConnection::getTableInfo( sqlite3 * handle, bool loadGeometryl error: // unexpected IO error mErrorMsg = tr( "unknown error cause" ); - if ( errMsg != NULL ) + if ( errMsg != nullptr ) { mErrorMsg = errMsg; sqlite3_free( errMsg ); @@ -510,7 +510,7 @@ bool QgsSpatiaLiteConnection::checkGeometryColumnsAuth( sqlite3 * handle ) // checking the metadata tables QString sql = QString( "SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'geometry_columns_auth'" ); - ret = sqlite3_get_table( handle, sql.toUtf8().constData(), &results, &rows, &columns, NULL ); + ret = sqlite3_get_table( handle, sql.toUtf8().constData(), &results, &rows, &columns, nullptr ); if ( ret != SQLITE_OK ) return false; if ( rows < 1 ) @@ -519,7 +519,7 @@ bool QgsSpatiaLiteConnection::checkGeometryColumnsAuth( sqlite3 * handle ) { for ( i = 1; i <= rows; i++ ) { - if ( results[( i * columns ) + 0] != NULL ) + if ( results[( i * columns ) + 0] != nullptr ) { const char *name = results[( i * columns ) + 0]; if ( name ) @@ -544,7 +544,7 @@ bool QgsSpatiaLiteConnection::checkViewsGeometryColumns( sqlite3 * handle ) // checking the metadata tables QString sql = QString( "SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'views_geometry_columns'" ); - ret = sqlite3_get_table( handle, sql.toUtf8().constData(), &results, &rows, &columns, NULL ); + ret = sqlite3_get_table( handle, sql.toUtf8().constData(), &results, &rows, &columns, nullptr ); if ( ret != SQLITE_OK ) return false; if ( rows < 1 ) @@ -553,7 +553,7 @@ bool QgsSpatiaLiteConnection::checkViewsGeometryColumns( sqlite3 * handle ) { for ( i = 1; i <= rows; i++ ) { - if ( results[( i * columns ) + 0] != NULL ) + if ( results[( i * columns ) + 0] != nullptr ) { const char *name = results[( i * columns ) + 0]; if ( name ) @@ -577,7 +577,7 @@ bool QgsSpatiaLiteConnection::checkVirtsGeometryColumns( sqlite3 * handle ) // checking the metadata tables QString sql = QString( "SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'virts_geometry_columns'" ); - ret = sqlite3_get_table( handle, sql.toUtf8().constData(), &results, &rows, &columns, NULL ); + ret = sqlite3_get_table( handle, sql.toUtf8().constData(), &results, &rows, &columns, nullptr ); if ( ret != SQLITE_OK ) return false; if ( rows < 1 ) @@ -586,7 +586,7 @@ bool QgsSpatiaLiteConnection::checkVirtsGeometryColumns( sqlite3 * handle ) { for ( i = 1; i <= rows; i++ ) { - if ( results[( i * columns ) + 0] != NULL ) + if ( results[( i * columns ) + 0] != nullptr ) { const char *name = results[( i * columns ) + 0]; if ( name ) @@ -625,7 +625,7 @@ bool QgsSpatiaLiteConnection::isRasterlite1Datasource( sqlite3 * handle, const c // checking if the related "_RASTERS table exists sprintf( sql, "SELECT name FROM sqlite_master WHERE type = 'table' AND name = '%s'", table_raster ); - ret = sqlite3_get_table( handle, sql, &results, &rows, &columns, NULL ); + ret = sqlite3_get_table( handle, sql, &results, &rows, &columns, nullptr ); if ( ret != SQLITE_OK ) return false; if ( rows < 1 ) @@ -634,7 +634,7 @@ bool QgsSpatiaLiteConnection::isRasterlite1Datasource( sqlite3 * handle, const c { for ( i = 1; i <= rows; i++ ) { - if ( results[( i * columns ) + 0] != NULL ) + if ( results[( i * columns ) + 0] != nullptr ) { const char *name = results[( i * columns ) + 0]; if ( name ) @@ -653,7 +653,7 @@ bool QgsSpatiaLiteConnection::isDeclaredHidden( sqlite3 * handle, const QString& char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; bool isHidden = false; if ( !checkGeometryColumnsAuth( handle ) ) @@ -672,7 +672,7 @@ bool QgsSpatiaLiteConnection::isDeclaredHidden( sqlite3 * handle, const QString& { for ( i = 1; i <= rows; i++ ) { - if ( results[( i * columns ) + 0] != NULL ) + if ( results[( i * columns ) + 0] != nullptr ) { if ( atoi( results[( i * columns ) + 0] ) != 0 ) isHidden = true; @@ -712,7 +712,7 @@ bool QgsSqliteHandle::checkMetadata( sqlite3 *handle ) int rows; int columns; int spatial_type = 0; - ret = sqlite3_get_table( handle, "SELECT CheckSpatialMetadata()", &results, &rows, &columns, NULL ); + ret = sqlite3_get_table( handle, "SELECT CheckSpatialMetadata()", &results, &rows, &columns, nullptr ); if ( ret != SQLITE_OK ) goto skip; if ( rows < 1 ) @@ -743,13 +743,13 @@ QgsSqliteHandle* QgsSqliteHandle::openDb( const QString & dbPath, bool shared ) } QgsDebugMsg( QString( "New sqlite connection for " ) + dbPath ); - if ( QgsSLConnect::sqlite3_open_v2( dbPath.toUtf8().constData(), &sqlite_handle, shared ? SQLITE_OPEN_READWRITE : SQLITE_OPEN_READONLY | SQLITE_OPEN_NOMUTEX, NULL ) ) + if ( QgsSLConnect::sqlite3_open_v2( dbPath.toUtf8().constData(), &sqlite_handle, shared ? SQLITE_OPEN_READWRITE : SQLITE_OPEN_READONLY | SQLITE_OPEN_NOMUTEX, nullptr ) ) { // failure QgsDebugMsg( QString( "Failure while connecting to: %1\n%2" ) .arg( dbPath, QString::fromUtf8( sqlite3_errmsg( sqlite_handle ) ) ) ); - return NULL; + return nullptr; } // checking the DB for sanity @@ -758,10 +758,10 @@ QgsSqliteHandle* QgsSqliteHandle::openDb( const QString & dbPath, bool shared ) // failure QgsDebugMsg( QString( "Failure while connecting to: %1\n\ninvalid metadata tables" ).arg( dbPath ) ); QgsSLConnect::sqlite3_close( sqlite_handle ); - return NULL; + return nullptr; } // activating Foreign Key constraints - ( void )sqlite3_exec( sqlite_handle, "PRAGMA foreign_keys = 1", NULL, 0, NULL ); + ( void )sqlite3_exec( sqlite_handle, "PRAGMA foreign_keys = 1", nullptr, 0, NULL ); QgsDebugMsg( "Connection to the database was successful" ); @@ -797,7 +797,7 @@ void QgsSqliteHandle::closeDb( QgsSqliteHandle * &handle ) } } - handle = NULL; + handle = nullptr; } void QgsSqliteHandle::closeAll() @@ -817,7 +817,7 @@ void QgsSqliteHandle::sqliteClose() if ( sqlite_handle ) { QgsSLConnect::sqlite3_close( sqlite_handle ); - sqlite_handle = NULL; + sqlite_handle = nullptr; } } diff --git a/src/providers/spatialite/qgsspatialitedataitems.cpp b/src/providers/spatialite/qgsspatialitedataitems.cpp index 43a36534fb0..62b400926f6 100644 --- a/src/providers/spatialite/qgsspatialitedataitems.cpp +++ b/src/providers/spatialite/qgsspatialitedataitems.cpp @@ -48,7 +48,7 @@ QList QgsSLLayerItem::actions() void QgsSLLayerItem::deleteLayer() { - if ( QMessageBox::question( 0, QObject::tr( "Delete Object" ), + if ( QMessageBox::question( nullptr, QObject::tr( "Delete Object" ), QObject::tr( "Are you sure you want to delete %1?" ).arg( mName ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes ) return; @@ -58,11 +58,11 @@ void QgsSLLayerItem::deleteLayer() bool res = ::deleteLayer( uri.database(), uri.table(), errCause ); if ( !res ) { - QMessageBox::warning( 0, tr( "Delete Layer" ), errCause ); + QMessageBox::warning( nullptr, tr( "Delete Layer" ), errCause ); } else { - QMessageBox::information( 0, tr( "Delete Layer" ), tr( "Layer deleted successfully." ) ); + QMessageBox::information( nullptr, tr( "Delete Layer" ), tr( "Layer deleted successfully." ) ); mParent->refresh(); } } @@ -172,7 +172,7 @@ void QgsSLConnectionItem::editConnection() void QgsSLConnectionItem::deleteConnection() { - if ( QMessageBox::question( 0, QObject::tr( "Delete Connection" ), + if ( QMessageBox::question( nullptr, QObject::tr( "Delete Connection" ), QObject::tr( "Are you sure you want to delete the connection to %1?" ).arg( mName ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes ) return; @@ -244,7 +244,7 @@ bool QgsSLConnectionItem::handleDrop( const QMimeData * data, Qt::DropAction ) } else { - QMessageBox::information( 0, tr( "Import to SpatiaLite database" ), tr( "Import was successful." ) ); + QMessageBox::information( nullptr, tr( "Import to SpatiaLite database" ), tr( "Import was successful." ) ); refresh(); } @@ -294,7 +294,7 @@ QList QgsSLRootItem::actions() QWidget * QgsSLRootItem::paramWidget() { - QgsSpatiaLiteSourceSelect *select = new QgsSpatiaLiteSourceSelect( 0, 0, true ); + QgsSpatiaLiteSourceSelect *select = new QgsSpatiaLiteSourceSelect( nullptr, nullptr, true ); connect( select, SIGNAL( connectionsChanged() ), this, SLOT( connectionsChanged() ) ); return select; } @@ -306,7 +306,7 @@ void QgsSLRootItem::connectionsChanged() void QgsSLRootItem::newConnection() { - if ( QgsSpatiaLiteSourceSelect::newConnection( NULL ) ) + if ( QgsSpatiaLiteSourceSelect::newConnection( nullptr ) ) { refresh(); } @@ -319,7 +319,7 @@ void QgsSLRootItem::createDatabase() QSettings settings; QString lastUsedDir = settings.value( "/UI/lastSpatiaLiteDir", QDir::homePath() ).toString(); - QString filename = QFileDialog::getSaveFileName( 0, tr( "New SpatiaLite Database File" ), + QString filename = QFileDialog::getSaveFileName( nullptr, tr( "New SpatiaLite Database File" ), lastUsedDir, tr( "SpatiaLite" ) + " (*.sqlite *.db *.sqlite3 *.db3 *.s3db)" ); if ( filename.isEmpty() ) @@ -328,7 +328,7 @@ void QgsSLRootItem::createDatabase() QString errCause; if ( ::createDb( filename, errCause ) ) { - QMessageBox::information( 0, tr( "Create SpatiaLite database" ), tr( "The database has been created" ) ); + QMessageBox::information( nullptr, tr( "Create SpatiaLite database" ), tr( "The database has been created" ) ); // add connection settings.setValue( "/SpatiaLite/connections/" + QFileInfo( filename ).fileName() + "/sqlitepath", filename ); @@ -337,7 +337,7 @@ void QgsSLRootItem::createDatabase() } else { - QMessageBox::critical( 0, tr( "Create SpatiaLite database" ), tr( "Failed to create the database:\n" ) + errCause ); + QMessageBox::critical( nullptr, tr( "Create SpatiaLite database" ), tr( "Failed to create the database:\n" ) + errCause ); } } diff --git a/src/providers/spatialite/qgsspatialitefeatureiterator.cpp b/src/providers/spatialite/qgsspatialitefeatureiterator.cpp index 18b9dcbe197..c49b97defa1 100644 --- a/src/providers/spatialite/qgsspatialitefeatureiterator.cpp +++ b/src/providers/spatialite/qgsspatialitefeatureiterator.cpp @@ -26,7 +26,7 @@ QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeatureSource* source, bool ownSource, const QgsFeatureRequest& request ) : QgsAbstractFeatureIteratorFromSource( source, ownSource, request ) - , sqliteStatement( NULL ) + , sqliteStatement( nullptr ) , mExpressionCompiled( false ) { @@ -128,7 +128,7 @@ QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeature if ( !success ) { // some error occurred - sqliteStatement = NULL; + sqliteStatement = nullptr; close(); } } @@ -146,7 +146,7 @@ bool QgsSpatiaLiteFeatureIterator::fetchFeature( QgsFeature& feature ) feature.setValid( false ); - if ( sqliteStatement == NULL ) + if ( sqliteStatement == nullptr ) { QgsDebugMsg( "Invalid current SQLite statement" ); close(); @@ -156,7 +156,7 @@ bool QgsSpatiaLiteFeatureIterator::fetchFeature( QgsFeature& feature ) if ( !getFeature( sqliteStatement, feature ) ) { sqlite3_finalize( sqliteStatement ); - sqliteStatement = NULL; + sqliteStatement = nullptr; close(); return false; } @@ -200,11 +200,11 @@ bool QgsSpatiaLiteFeatureIterator::close() if ( sqliteStatement ) { sqlite3_finalize( sqliteStatement ); - sqliteStatement = NULL; + sqliteStatement = nullptr; } QgsSpatiaLiteConnPool::instance()->releaseConnection( mHandle ); - mHandle = 0; + mHandle = nullptr; mClosed = true; return true; @@ -255,7 +255,7 @@ bool QgsSpatiaLiteFeatureIterator::prepareStatement( const QString& whereClause, if ( limit >= 0 ) sql += QString( " LIMIT %1" ).arg( limit ); - if ( sqlite3_prepare_v2( mHandle->handle(), sql.toUtf8().constData(), -1, &sqliteStatement, NULL ) != SQLITE_OK ) + if ( sqlite3_prepare_v2( mHandle->handle(), sql.toUtf8().constData(), -1, &sqliteStatement, nullptr ) != SQLITE_OK ) { // some error occurred QgsMessageLog::logMessage( QObject::tr( "SQLite error: %2\nSQL: %1" ).arg( sql, sqlite3_errmsg( mHandle->handle() ) ), QObject::tr( "SpatiaLite" ) ); @@ -393,7 +393,7 @@ bool QgsSpatiaLiteFeatureIterator::getFeature( sqlite3_stmt *stmt, QgsFeature &f if ( !mFetchGeometry ) { // no geometry was required - feature.setGeometry( 0 ); + feature.setGeometry( nullptr ); } feature.initAttributes( mSource->mFields.count() ); @@ -481,7 +481,7 @@ void QgsSpatiaLiteFeatureIterator::getFeatureGeometry( sqlite3_stmt* stmt, int i { if ( sqlite3_column_type( stmt, ic ) == SQLITE_BLOB ) { - unsigned char *featureGeom = NULL; + unsigned char *featureGeom = nullptr; size_t geom_size = 0; const void *blob = sqlite3_column_blob( stmt, ic ); size_t blob_size = sqlite3_column_bytes( stmt, ic ); @@ -494,12 +494,12 @@ void QgsSpatiaLiteFeatureIterator::getFeatureGeometry( sqlite3_stmt* stmt, int i feature.setGeometry( g ); } else - feature.setGeometry( 0 ); + feature.setGeometry( nullptr ); } else { // NULL geometry - feature.setGeometry( 0 ); + feature.setGeometry( nullptr ); } } diff --git a/src/providers/spatialite/qgsspatialiteprovider.cpp b/src/providers/spatialite/qgsspatialiteprovider.cpp index 8c2cdd5ebe8..a4d3aac0466 100644 --- a/src/providers/spatialite/qgsspatialiteprovider.cpp +++ b/src/providers/spatialite/qgsspatialiteprovider.cpp @@ -125,8 +125,8 @@ QgsSpatiaLiteProvider::createEmptyLayer( // create the table { QgsSqliteHandle *handle; - sqlite3 *sqliteHandle = NULL; - char *errMsg = NULL; + sqlite3 *sqliteHandle = nullptr; + char *errMsg = nullptr; int toCommit = false; QString sql; @@ -193,7 +193,7 @@ QgsSpatiaLiteProvider::createEmptyLayer( try { - int ret = sqlite3_exec( sqliteHandle, "BEGIN", NULL, NULL, &errMsg ); + int ret = sqlite3_exec( sqliteHandle, "BEGIN", nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) throw SLException( errMsg ); @@ -205,14 +205,14 @@ QgsSpatiaLiteProvider::createEmptyLayer( sql = QString( "DROP TABLE IF EXISTS %1" ) .arg( quotedIdentifier( tableName ) ); - ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) throw SLException( errMsg ); sql = QString( "DELETE FROM geometry_columns WHERE upper(f_table_name) = upper(%1)" ) .arg( quotedValue( tableName ) ); - ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) throw SLException( errMsg ); } @@ -222,7 +222,7 @@ QgsSpatiaLiteProvider::createEmptyLayer( quotedIdentifier( primaryKey ), primaryKeyType ); - ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) throw SLException( errMsg ); @@ -288,7 +288,7 @@ QgsSpatiaLiteProvider::createEmptyLayer( .arg( QgsSpatiaLiteProvider::quotedValue( geometryType ) ) .arg( dim ); - ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) throw SLException( errMsg ); } @@ -297,7 +297,7 @@ QgsSpatiaLiteProvider::createEmptyLayer( geometryColumn = QString(); } - ret = sqlite3_exec( sqliteHandle, "COMMIT", NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, "COMMIT", nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) throw SLException( errMsg ); @@ -318,7 +318,7 @@ QgsSpatiaLiteProvider::createEmptyLayer( if ( toCommit ) { // ROLLBACK after some previous error - sqlite3_exec( sqliteHandle, "ROLLBACK", NULL, NULL, NULL ); + sqlite3_exec( sqliteHandle, "ROLLBACK", nullptr, nullptr, nullptr ); } QgsSqliteHandle::closeDb( handle ); @@ -418,7 +418,7 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri ) , mVShapeBased( false ) , mReadOnly( false ) , geomType( QGis::WKBUnknown ) - , sqliteHandle( NULL ) + , sqliteHandle( nullptr ) , mSrid( -1 ) , numberFeatures( 0 ) , spatialIndexRTree( false ) @@ -452,8 +452,8 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri ) #ifdef SPATIALITE_VERSION_GE_4_0_0 // only if libspatialite version is >= 4.0.0 - gaiaVectorLayersListPtr list = NULL; - gaiaVectorLayerPtr lyr = NULL; + gaiaVectorLayersListPtr list = nullptr; + gaiaVectorLayerPtr lyr = nullptr; bool specialCase = false; if ( mGeometryColumn.isEmpty() ) specialCase = true; // non-spatial table @@ -468,9 +468,9 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri ) mTableName.toUtf8().constData(), mGeometryColumn.toUtf8().constData(), GAIA_VECTORS_LIST_OPTIMISTIC ); - if ( list != NULL ) + if ( list != nullptr ) lyr = list->First; - if ( lyr == NULL ) + if ( lyr == nullptr ) ret = false; else { @@ -511,7 +511,7 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri ) alreadyDone = false; #ifdef SPATIALITE_VERSION_GE_4_0_0 - if ( lyr != NULL ) + if ( lyr != nullptr ) { // using the v.4.0 AbstractInterface if ( !getGeometryDetailsAbstractInterface( lyr ) ) // gets srid and geometry type @@ -559,7 +559,7 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri ) // load the columns list loadFields(); } - if ( sqliteHandle == NULL ) + if ( sqliteHandle == nullptr ) { QgsDebugMsg( "Invalid SpatiaLite layer" ); return; @@ -592,7 +592,7 @@ QgsAbstractFeatureSource* QgsSpatiaLiteProvider::featureSource() const // only if libspatialite version is >= 4.0.0 void QgsSpatiaLiteProvider::loadFieldsAbstractInterface( gaiaVectorLayerPtr lyr ) { - if ( lyr == NULL ) + if ( lyr == nullptr ) { return; } @@ -602,7 +602,7 @@ void QgsSpatiaLiteProvider::loadFieldsAbstractInterface( gaiaVectorLayerPtr lyr mPrimaryKeyAttrs.clear(); gaiaLayerAttributeFieldPtr fld = lyr->First; - if ( fld == NULL ) + if ( fld == nullptr ) { // defaulting to traditional loadFields() loadFields(); @@ -641,7 +641,7 @@ void QgsSpatiaLiteProvider::loadFieldsAbstractInterface( gaiaVectorLayerPtr lyr char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; int ret = sqlite3_get_table( sqliteHandle, sql.toUtf8().constData(), &results, &rows, &columns, &errMsg ); if ( ret == SQLITE_OK ) { @@ -670,7 +670,7 @@ QString QgsSpatiaLiteProvider::spatialiteVersion() char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString sql; sql = "SELECT spatialite_version()"; @@ -707,11 +707,11 @@ void QgsSpatiaLiteProvider::loadFields() { int ret; int i; - sqlite3_stmt *stmt = NULL; + sqlite3_stmt *stmt = nullptr; char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString pkName; int pkCount = 0; QString sql; @@ -779,7 +779,7 @@ void QgsSpatiaLiteProvider::loadFields() { sql = QString( "select * from %1 limit 1" ).arg( mQuery ); - if ( sqlite3_prepare_v2( sqliteHandle, sql.toUtf8().constData(), -1, &stmt, NULL ) != SQLITE_OK ) + if ( sqlite3_prepare_v2( sqliteHandle, sql.toUtf8().constData(), -1, &stmt, nullptr ) != SQLITE_OK ) { // some error occurred QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, sqlite3_errmsg( sqliteHandle ) ), tr( "SpatiaLite" ) ); @@ -802,7 +802,7 @@ void QgsSpatiaLiteProvider::loadFields() { QString name = QString::fromUtf8( sqlite3_column_name( stmt, i ) ); const char *type = sqlite3_column_decltype( stmt, i ); - if ( type == NULL ) + if ( type == nullptr ) type = "TEXT"; if ( name == mPrimaryKey ) @@ -854,7 +854,7 @@ void QgsSpatiaLiteProvider::loadFields() error: QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ? errMsg : tr( "unknown cause" ) ), tr( "SpatiaLite" ) ); // unexpected error - if ( errMsg != NULL ) + if ( errMsg != nullptr ) { sqlite3_free( errMsg ); } @@ -866,7 +866,7 @@ bool QgsSpatiaLiteProvider::hasTriggers() char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString sql; sql = QString( "SELECT * FROM sqlite_master WHERE type='trigger' AND tbl_name=%1" ) @@ -1251,7 +1251,7 @@ void QgsSpatiaLiteProvider::convertFromGeosWKB( const unsigned char *blob, int little_endian; int endian_arch = gaiaEndianArch(); - *wkb = NULL; + *wkb = nullptr; *geom_size = 0; if ( blob_size < 5 ) return; @@ -2435,7 +2435,7 @@ void QgsSpatiaLiteProvider::convertToGeosWKB( const unsigned char *blob, unsigned char *p_out; double coord; - *wkb = NULL; + *wkb = nullptr; *geom_size = 0; if ( blob_size < 5 ) return; @@ -3284,7 +3284,7 @@ QVariant QgsSpatiaLiteProvider::minimumValue( int index ) char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString minValue; QString sql; @@ -3305,7 +3305,7 @@ QVariant QgsSpatiaLiteProvider::minimumValue( int index ) { QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ? errMsg : tr( "unknown cause" ) ), tr( "SpatiaLite" ) ); // unexpected error - if ( errMsg != NULL ) + if ( errMsg != nullptr ) { sqlite3_free( errMsg ); } @@ -3350,7 +3350,7 @@ QVariant QgsSpatiaLiteProvider::maximumValue( int index ) char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString maxValue; QString sql; @@ -3371,7 +3371,7 @@ QVariant QgsSpatiaLiteProvider::maximumValue( int index ) { QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ? errMsg : tr( "unknown cause" ) ), tr( "SpatiaLite" ) ); // unexpected error - if ( errMsg != NULL ) + if ( errMsg != nullptr ) { sqlite3_free( errMsg ); } @@ -3412,7 +3412,7 @@ QVariant QgsSpatiaLiteProvider::maximumValue( int index ) // Returns the list of unique values of an attribute void QgsSpatiaLiteProvider::uniqueValues( int index, QList < QVariant > &uniqueValues, int limit ) { - sqlite3_stmt *stmt = NULL; + sqlite3_stmt *stmt = nullptr; QString sql; QString txt; @@ -3440,7 +3440,7 @@ void QgsSpatiaLiteProvider::uniqueValues( int index, QList < QVariant > &uniqueV } // SQLite prepared statement - if ( sqlite3_prepare_v2( sqliteHandle, sql.toUtf8().constData(), -1, &stmt, NULL ) != SQLITE_OK ) + if ( sqlite3_prepare_v2( sqliteHandle, sql.toUtf8().constData(), -1, &stmt, nullptr ) != SQLITE_OK ) { // some error occurred QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, sqlite3_errmsg( sqliteHandle ) ), tr( "SpatiaLite" ) ); @@ -3540,8 +3540,8 @@ QString QgsSpatiaLiteProvider::geomParam() const bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist ) { - sqlite3_stmt *stmt = NULL; - char *errMsg = NULL; + sqlite3_stmt *stmt = nullptr; + char *errMsg = nullptr; bool toCommit = false; QString sql; QString values; @@ -3552,7 +3552,7 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist ) return true; QgsAttributes attributevec = flist[0].attributes(); - ret = sqlite3_exec( sqliteHandle, "BEGIN", NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, "BEGIN", nullptr, nullptr, &errMsg ); if ( ret == SQLITE_OK ) { toCommit = true; @@ -3589,7 +3589,7 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist ) sql += ')'; // SQLite prepared statement - ret = sqlite3_prepare_v2( sqliteHandle, sql.toUtf8().constData(), -1, &stmt, NULL ); + ret = sqlite3_prepare_v2( sqliteHandle, sql.toUtf8().constData(), -1, &stmt, nullptr ); if ( ret == SQLITE_OK ) { for ( QgsFeatureList::iterator feature = flist.begin(); feature != flist.end(); ++feature ) @@ -3613,7 +3613,7 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist ) } else { - unsigned char *wkb = NULL; + unsigned char *wkb = nullptr; size_t wkb_size; convertFromGeosWKB( feature->constGeometry()->asWkb(), feature->constGeometry()->wkbSize(), @@ -3695,7 +3695,7 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist ) } if ( ret == SQLITE_DONE || ret == SQLITE_ROW ) { - ret = sqlite3_exec( sqliteHandle, "COMMIT", NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, "COMMIT", nullptr, nullptr, &errMsg ); } } // prepared statement } // BEGIN statement @@ -3711,7 +3711,7 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist ) if ( toCommit ) { // ROLLBACK after some previous error - ( void )sqlite3_exec( sqliteHandle, "ROLLBACK", NULL, NULL, NULL ); + ( void )sqlite3_exec( sqliteHandle, "ROLLBACK", nullptr, NULL, NULL ); } } @@ -3720,12 +3720,12 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist ) bool QgsSpatiaLiteProvider::deleteFeatures( const QgsFeatureIds &id ) { - sqlite3_stmt *stmt = NULL; - char *errMsg = NULL; + sqlite3_stmt *stmt = nullptr; + char *errMsg = nullptr; bool toCommit = false; QString sql; - int ret = sqlite3_exec( sqliteHandle, "BEGIN", NULL, NULL, &errMsg ); + int ret = sqlite3_exec( sqliteHandle, "BEGIN", nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { // some error occurred @@ -3736,7 +3736,7 @@ bool QgsSpatiaLiteProvider::deleteFeatures( const QgsFeatureIds &id ) sql = QString( "DELETE FROM %1 WHERE ROWID=?" ).arg( quotedIdentifier( mTableName ) ); // SQLite prepared statement - if ( sqlite3_prepare_v2( sqliteHandle, sql.toUtf8().constData(), -1, &stmt, NULL ) != SQLITE_OK ) + if ( sqlite3_prepare_v2( sqliteHandle, sql.toUtf8().constData(), -1, &stmt, nullptr ) != SQLITE_OK ) { // some error occurred pushError( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, sqlite3_errmsg( sqliteHandle ) ) ); @@ -3771,7 +3771,7 @@ bool QgsSpatiaLiteProvider::deleteFeatures( const QgsFeatureIds &id ) } sqlite3_finalize( stmt ); - ret = sqlite3_exec( sqliteHandle, "COMMIT", NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, "COMMIT", nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { // some error occurred @@ -3790,7 +3790,7 @@ abort: if ( toCommit ) { // ROLLBACK after some previous error - ( void )sqlite3_exec( sqliteHandle, "ROLLBACK", NULL, NULL, NULL ); + ( void )sqlite3_exec( sqliteHandle, "ROLLBACK", nullptr, NULL, NULL ); } return false; @@ -3798,14 +3798,14 @@ abort: bool QgsSpatiaLiteProvider::addAttributes( const QList &attributes ) { - char *errMsg = NULL; + char *errMsg = nullptr; bool toCommit = false; QString sql; if ( attributes.isEmpty() ) return true; - int ret = sqlite3_exec( sqliteHandle, "BEGIN", NULL, NULL, &errMsg ); + int ret = sqlite3_exec( sqliteHandle, "BEGIN", nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { // some error occurred @@ -3819,7 +3819,7 @@ bool QgsSpatiaLiteProvider::addAttributes( const QList &attributes ) .arg( mTableName, iter->name(), iter->typeName() ); - ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { // some error occurred @@ -3827,7 +3827,7 @@ bool QgsSpatiaLiteProvider::addAttributes( const QList &attributes ) } } - ret = sqlite3_exec( sqliteHandle, "COMMIT", NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, "COMMIT", nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { // some error occurred @@ -3837,7 +3837,7 @@ bool QgsSpatiaLiteProvider::addAttributes( const QList &attributes ) sql = QString( "UPDATE geometry_columns_statistics set last_verified = 0 WHERE f_table_name=\"%1\" AND f_geometry_column=\"%2\";" ) .arg( mTableName, mGeometryColumn ); - ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), nullptr, nullptr, &errMsg ); update_layer_statistics( sqliteHandle, mTableName.toUtf8().constData(), mGeometryColumn.toUtf8().constData() ); #elif SPATIALITE_VERSION_G_4_1_1 gaiaStatisticsInvalidate( sqliteHandle, tableName.toUtf8().constData(), mGeometryColumn.toUtf8().constData() ); @@ -3859,7 +3859,7 @@ abort: if ( toCommit ) { // ROLLBACK after some previous error - ( void )sqlite3_exec( sqliteHandle, "ROLLBACK", NULL, NULL, NULL ); + ( void )sqlite3_exec( sqliteHandle, "ROLLBACK", nullptr, NULL, NULL ); } return false; @@ -3867,14 +3867,14 @@ abort: bool QgsSpatiaLiteProvider::changeAttributeValues( const QgsChangedAttributesMap &attr_map ) { - char *errMsg = NULL; + char *errMsg = nullptr; bool toCommit = false; QString sql; if ( attr_map.isEmpty() ) return true; - int ret = sqlite3_exec( sqliteHandle, "BEGIN", NULL, NULL, &errMsg ); + int ret = sqlite3_exec( sqliteHandle, "BEGIN", nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { // some error occurred @@ -3938,7 +3938,7 @@ bool QgsSpatiaLiteProvider::changeAttributeValues( const QgsChangedAttributesMap } sql += QString( " WHERE ROWID=%1" ).arg( fid ); - ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { // some error occurred @@ -3946,7 +3946,7 @@ bool QgsSpatiaLiteProvider::changeAttributeValues( const QgsChangedAttributesMap } } - ret = sqlite3_exec( sqliteHandle, "COMMIT", NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, "COMMIT", nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { // some error occurred @@ -3965,7 +3965,7 @@ abort: if ( toCommit ) { // ROLLBACK after some previous error - ( void )sqlite3_exec( sqliteHandle, "ROLLBACK", NULL, NULL, NULL ); + ( void )sqlite3_exec( sqliteHandle, "ROLLBACK", nullptr, NULL, NULL ); } return false; @@ -3973,12 +3973,12 @@ abort: bool QgsSpatiaLiteProvider::changeGeometryValues( QgsGeometryMap & geometry_map ) { - sqlite3_stmt *stmt = NULL; - char *errMsg = NULL; + sqlite3_stmt *stmt = nullptr; + char *errMsg = nullptr; bool toCommit = false; QString sql; - int ret = sqlite3_exec( sqliteHandle, "BEGIN", NULL, NULL, &errMsg ); + int ret = sqlite3_exec( sqliteHandle, "BEGIN", nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { // some error occurred @@ -3993,7 +3993,7 @@ bool QgsSpatiaLiteProvider::changeGeometryValues( QgsGeometryMap & geometry_map .arg( mSrid ); // SQLite prepared statement - if ( sqlite3_prepare_v2( sqliteHandle, sql.toUtf8().constData(), -1, &stmt, NULL ) != SQLITE_OK ) + if ( sqlite3_prepare_v2( sqliteHandle, sql.toUtf8().constData(), -1, &stmt, nullptr ) != SQLITE_OK ) { // some error occurred QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, sqlite3_errmsg( sqliteHandle ) ), tr( "SpatiaLite" ) ); @@ -4007,7 +4007,7 @@ bool QgsSpatiaLiteProvider::changeGeometryValues( QgsGeometryMap & geometry_map sqlite3_clear_bindings( stmt ); // binding GEOMETRY to Prepared Statement - unsigned char *wkb = NULL; + unsigned char *wkb = nullptr; size_t wkb_size; convertFromGeosWKB( iter->asWkb(), iter->wkbSize(), &wkb, &wkb_size, nDims ); @@ -4033,7 +4033,7 @@ bool QgsSpatiaLiteProvider::changeGeometryValues( QgsGeometryMap & geometry_map } sqlite3_finalize( stmt ); - ret = sqlite3_exec( sqliteHandle, "COMMIT", NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, "COMMIT", nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { // some error occurred @@ -4051,7 +4051,7 @@ abort: if ( toCommit ) { // ROLLBACK after some previous error - sqlite3_exec( sqliteHandle, "ROLLBACK", NULL, NULL, NULL ); + sqlite3_exec( sqliteHandle, "ROLLBACK", nullptr, nullptr, nullptr ); } return false; @@ -4068,7 +4068,7 @@ void QgsSpatiaLiteProvider::closeDb() if ( handle ) { QgsSqliteHandle::closeDb( handle ); - handle = 0; + handle = nullptr; } } @@ -4091,7 +4091,7 @@ QString QgsSpatiaLiteProvider::quotedValue( QString value ) // only if libspatialite version is >= 4.0.0 bool QgsSpatiaLiteProvider::checkLayerTypeAbstractInterface( gaiaVectorLayerPtr lyr ) { - if ( lyr == NULL ) + if ( lyr == nullptr ) { return false; } @@ -4141,7 +4141,7 @@ bool QgsSpatiaLiteProvider::checkLayerType() char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; int count = 0; mTableBased = false; @@ -4178,7 +4178,7 @@ bool QgsSpatiaLiteProvider::checkLayerType() { QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ), tr( "SpatiaLite" ) ); sqlite3_free( errMsg ); - errMsg = 0; + errMsg = nullptr; } sqlite3_free_table( results ); } @@ -4216,7 +4216,7 @@ bool QgsSpatiaLiteProvider::checkLayerType() { QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ), tr( "SpatiaLite" ) ); sqlite3_free( errMsg ); - errMsg = 0; + errMsg = nullptr; } sqlite3_free_table( results ); } @@ -4248,7 +4248,7 @@ bool QgsSpatiaLiteProvider::checkLayerType() mReadOnly = false; for ( i = 1; i <= rows; i++ ) { - if ( results[( i * columns ) + 0] != NULL ) + if ( results[( i * columns ) + 0] != nullptr ) { if ( atoi( results[( i * columns ) + 0] ) != 0 ) mReadOnly = true; @@ -4260,7 +4260,7 @@ bool QgsSpatiaLiteProvider::checkLayerType() { QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ), tr( "SpatiaLite" ) ); sqlite3_free( errMsg ); - errMsg = 0; + errMsg = nullptr; } sqlite3_free_table( results ); @@ -4280,7 +4280,7 @@ bool QgsSpatiaLiteProvider::checkLayerType() { QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ), tr( "SpatiaLite" ) ); sqlite3_free( errMsg ); - errMsg = 0; + errMsg = nullptr; } sqlite3_free_table( results ); @@ -4300,7 +4300,7 @@ bool QgsSpatiaLiteProvider::checkLayerType() { QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ), tr( "SpatiaLite" ) ); sqlite3_free( errMsg ); - errMsg = 0; + errMsg = nullptr; } sqlite3_free_table( results ); } @@ -4318,7 +4318,7 @@ bool QgsSpatiaLiteProvider::checkLayerType() // only if libspatialite version is >= 4.0.0 bool QgsSpatiaLiteProvider::getGeometryDetailsAbstractInterface( gaiaVectorLayerPtr lyr ) { - if ( lyr == NULL ) + if ( lyr == nullptr ) { return false; } @@ -4389,7 +4389,7 @@ void QgsSpatiaLiteProvider::getViewSpatialIndexName() char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; // retrieving the Spatial Index name supporting this View (if any) spatialIndexRTree = false; @@ -4417,7 +4417,7 @@ void QgsSpatiaLiteProvider::getViewSpatialIndexName() error: // unexpected error - if ( errMsg != NULL ) + if ( errMsg != nullptr ) { QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ), tr( "SpatiaLite" ) ); sqlite3_free( errMsg ); @@ -4452,7 +4452,7 @@ bool QgsSpatiaLiteProvider::getTableGeometryDetails() char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; mIndexTable = mTableName; mIndexGeometry = mGeometryColumn; @@ -4537,7 +4537,7 @@ bool QgsSpatiaLiteProvider::getTableGeometryDetails() error: QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ? errMsg : tr( "unknown cause" ) ), tr( "SpatiaLite" ) ); // unexpected error - if ( errMsg != NULL ) + if ( errMsg != nullptr ) { sqlite3_free( errMsg ); } @@ -4551,7 +4551,7 @@ bool QgsSpatiaLiteProvider::getViewGeometryDetails() char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString sql = QString( "SELECT type, srid, spatial_index_enabled, f_table_name, f_geometry_column " " FROM views_geometry_columns" @@ -4619,7 +4619,7 @@ bool QgsSpatiaLiteProvider::getViewGeometryDetails() error: // unexpected error - if ( errMsg != NULL ) + if ( errMsg != nullptr ) { QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ), tr( "SpatiaLite" ) ); sqlite3_free( errMsg ); @@ -4634,7 +4634,7 @@ bool QgsSpatiaLiteProvider::getVShapeGeometryDetails() char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString sql = QString( "SELECT type, srid FROM virts_geometry_columns" " WHERE virt_name=%1 and virt_geometry=%2" ).arg( quotedValue( mTableName ), @@ -4689,7 +4689,7 @@ bool QgsSpatiaLiteProvider::getVShapeGeometryDetails() error: // unexpected error - if ( errMsg != NULL ) + if ( errMsg != nullptr ) { QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ), tr( "SpatiaLite" ) ); sqlite3_free( errMsg ); @@ -4704,7 +4704,7 @@ bool QgsSpatiaLiteProvider::getQueryGeometryDetails() char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString fType( "" ); QString xSrid( "" ); @@ -4805,7 +4805,7 @@ bool QgsSpatiaLiteProvider::getQueryGeometryDetails() error: // unexpected error - if ( errMsg != NULL ) + if ( errMsg != nullptr ) { QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ), tr( "SpatiaLite" ) ); sqlite3_free( errMsg ); @@ -4820,7 +4820,7 @@ bool QgsSpatiaLiteProvider::getSridDetails() char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString sql = QString( "SELECT auth_name||':'||auth_srid,proj4text FROM spatial_ref_sys WHERE srid=%1" ).arg( mSrid ); @@ -4843,7 +4843,7 @@ bool QgsSpatiaLiteProvider::getSridDetails() error: // unexpected error - if ( errMsg != NULL ) + if ( errMsg != nullptr ) { QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ), tr( "SpatiaLite" ) ); sqlite3_free( errMsg ); @@ -4855,7 +4855,7 @@ error: // only if libspatialite version is >= 4.0.0 bool QgsSpatiaLiteProvider::getTableSummaryAbstractInterface( gaiaVectorLayerPtr lyr ) { - if ( lyr == NULL ) + if ( lyr == nullptr ) { return false; } @@ -4883,7 +4883,7 @@ bool QgsSpatiaLiteProvider::getTableSummary() char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString sql = QString( "SELECT Count(*)%1 FROM %2" ) .arg( mGeometryColumn.isEmpty() ? "" : QString( ",Min(MbrMinX(%1)),Min(MbrMinY(%1)),Max(MbrMaxX(%1)),Max(MbrMaxY(%1))" ).arg( quotedIdentifier( mGeometryColumn ) ), @@ -4926,7 +4926,7 @@ bool QgsSpatiaLiteProvider::getTableSummary() error: // unexpected error - if ( errMsg != NULL ) + if ( errMsg != nullptr ) { QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql, errMsg ), tr( "SpatiaLite" ) ); sqlite3_free( errMsg ); @@ -5007,7 +5007,7 @@ static bool initializeSpatialMetadata( sqlite3 *sqlite_handle, QString& errCause // checking if this DB is really empty char **results; int rows, columns; - int ret = sqlite3_get_table( sqlite_handle, "select count(*) from sqlite_master", &results, &rows, &columns, NULL ); + int ret = sqlite3_get_table( sqlite_handle, "select count(*) from sqlite_master", &results, &rows, &columns, nullptr ); if ( ret != SQLITE_OK ) return false; @@ -5024,7 +5024,7 @@ static bool initializeSpatialMetadata( sqlite3 *sqlite_handle, QString& errCause return false; bool above41 = false; - ret = sqlite3_get_table( sqlite_handle, "select spatialite_version()", &results, &rows, &columns, NULL ); + ret = sqlite3_get_table( sqlite_handle, "select spatialite_version()", &results, &rows, &columns, nullptr ); if ( ret == SQLITE_OK && rows == 1 && columns == 1 ) { QString version = QString::fromUtf8( results[1] ); @@ -5039,8 +5039,8 @@ static bool initializeSpatialMetadata( sqlite3 *sqlite_handle, QString& errCause sqlite3_free_table( results ); // all right, it's empty: proceding to initialize - char *errMsg = 0; - ret = sqlite3_exec( sqlite_handle, above41 ? "SELECT InitSpatialMetadata(1)" : "SELECT InitSpatialMetadata()", NULL, NULL, &errMsg ); + char *errMsg = nullptr; + ret = sqlite3_exec( sqlite_handle, above41 ? "SELECT InitSpatialMetadata(1)" : "SELECT InitSpatialMetadata()", nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { errCause = QObject::tr( "Unable to initialize SpatialMetadata:\n" ); @@ -5065,7 +5065,7 @@ QGISEXTERN bool createDb( const QString& dbPath, QString& errCause ) // creating/opening the new database sqlite3 *sqlite_handle; - int ret = QgsSLConnect::sqlite3_open_v2( dbPath.toUtf8().constData(), &sqlite_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL ); + int ret = QgsSLConnect::sqlite3_open_v2( dbPath.toUtf8().constData(), &sqlite_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr ); if ( ret ) { // an error occurred @@ -5075,8 +5075,8 @@ QGISEXTERN bool createDb( const QString& dbPath, QString& errCause ) return false; } // activating Foreign Key constraints - char *errMsg = NULL; - ret = sqlite3_exec( sqlite_handle, "PRAGMA foreign_keys = 1", NULL, 0, &errMsg ); + char *errMsg = nullptr; + ret = sqlite3_exec( sqlite_handle, "PRAGMA foreign_keys = 1", nullptr, nullptr, &errMsg ); if ( ret != SQLITE_OK ) { errCause = QObject::tr( "Unable to activate FOREIGN_KEY constraints [%1]" ).arg( errMsg ); @@ -5144,7 +5144,7 @@ QGISEXTERN bool deleteLayer( const QString& dbPath, const QString& tableName, QS // TODO: remove spatial indexes? // run VACUUM to free unused space and compact the database - ret = sqlite3_exec( sqlite_handle, "VACUUM", NULL, NULL, NULL ); + ret = sqlite3_exec( sqlite_handle, "VACUUM", nullptr, nullptr, nullptr ); if ( ret != SQLITE_OK ) { QgsDebugMsg( "Failed to run VACUUM after deleting table on database " + dbPath ); @@ -5167,11 +5167,11 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS const QString& uiFileContent, bool useAsDefault, QString& errCause ) { QgsSqliteHandle *handle; - sqlite3 *sqliteHandle = NULL; + sqlite3 *sqliteHandle = nullptr; char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QgsDataSourceURI dsUri( uri ); QString sqlitePath = dsUri.database(); @@ -5227,7 +5227,7 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS ",ui text" ",update_time timestamp DEFAULT CURRENT_TIMESTAMP" ")" ); - ret = sqlite3_exec( sqliteHandle, createQuery.toUtf8().constData(), NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, createQuery.toUtf8().constData(), nullptr, nullptr, &errMsg ); if ( SQLITE_OK != ret ) { QgsSqliteHandle::closeDb( handle ); @@ -5287,7 +5287,7 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS if ( 0 != rows ) { sqlite3_free_table( results ); - if ( QMessageBox::question( 0, QObject::tr( "Save style in database" ), + if ( QMessageBox::question( nullptr, QObject::tr( "Save style in database" ), QObject::tr( "A style named \"%1\" already exists in the database for this layer. Do you want to overwrite it?" ) .arg( styleName.isEmpty() ? dsUri.table() : styleName ), QMessageBox::Yes | QMessageBox::No ) == QMessageBox::No ) @@ -5335,7 +5335,7 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS sql = QString( "BEGIN; %1; %2; COMMIT;" ).arg( removeDefaultSql, sql ); } - ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), NULL, NULL, &errMsg ); + ret = sqlite3_exec( sqliteHandle, sql.toUtf8().constData(), nullptr, nullptr, &errMsg ); if ( SQLITE_OK != ret ) { QgsSqliteHandle::closeDb( handle ); @@ -5344,7 +5344,7 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS return false; } - if ( NULL != errMsg ) + if ( nullptr != errMsg ) sqlite3_free( errMsg ); QgsSqliteHandle::closeDb( handle ); @@ -5355,11 +5355,11 @@ QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QS QGISEXTERN QString loadStyle( const QString& uri, QString& errCause ) { QgsSqliteHandle *handle; - sqlite3 *sqliteHandle = NULL; + sqlite3 *sqliteHandle = nullptr; char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString sql; QgsDataSourceURI dsUri( uri ); @@ -5410,11 +5410,11 @@ QGISEXTERN int listStyles( const QString &uri, QStringList &ids, QStringList &na QStringList &descriptions, QString& errCause ) { QgsSqliteHandle *handle; - sqlite3 *sqliteHandle = NULL; + sqlite3 *sqliteHandle = nullptr; char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString sql; QgsDataSourceURI dsUri( uri ); @@ -5423,7 +5423,7 @@ QGISEXTERN int listStyles( const QString &uri, QStringList &ids, QStringList &na // trying to open the SQLite DB handle = QgsSqliteHandle::openDb( sqlitePath ); - if ( NULL == handle ) + if ( nullptr == handle ) { QgsDebugMsg( "Connection to database failed. Save style aborted." ); errCause = QObject::tr( "Connection to database failed" ); @@ -5522,11 +5522,11 @@ QGISEXTERN int listStyles( const QString &uri, QStringList &ids, QStringList &na QGISEXTERN QString getStyleById( const QString& uri, QString styleId, QString& errCause ) { QgsSqliteHandle *handle; - sqlite3 *sqliteHandle = NULL; + sqlite3 *sqliteHandle = nullptr; char **results; int rows; int columns; - char *errMsg = NULL; + char *errMsg = nullptr; QString sql; QgsDataSourceURI dsUri( uri ); diff --git a/src/providers/spatialite/qgsspatialiteprovider.h b/src/providers/spatialite/qgsspatialiteprovider.h index 69adc49be76..8bf1281bcca 100644 --- a/src/providers/spatialite/qgsspatialiteprovider.h +++ b/src/providers/spatialite/qgsspatialiteprovider.h @@ -61,8 +61,8 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider const QgsCoordinateReferenceSystem *srs, bool overwrite, QMap *oldToNewAttrIdxMap, - QString *errorMessage = 0, - const QMap *options = 0 + QString *errorMessage = nullptr, + const QMap *options = nullptr ); /** diff --git a/src/providers/spatialite/qgsspatialitesourceselect.cpp b/src/providers/spatialite/qgsspatialitesourceselect.cpp index eed67fae270..94df5678688 100644 --- a/src/providers/spatialite/qgsspatialitesourceselect.cpp +++ b/src/providers/spatialite/qgsspatialitesourceselect.cpp @@ -295,7 +295,7 @@ bool QgsSpatiaLiteSourceSelect::newConnection( QWidget* parent ) while ( ! settings.value( baseKey + savedName + "/sqlitepath", "" ).toString().isEmpty() ) { bool ok; - savedName = QInputDialog::getText( NULL , tr( "Cannot add connection '%1'" ).arg( myName ) , + savedName = QInputDialog::getText( nullptr , tr( "Cannot add connection '%1'" ).arg( myName ) , tr( "A connection with the same name already exists,\nplease provide a new name:" ), QLineEdit::Normal, "", &ok ); if ( !ok || savedName.isEmpty() ) @@ -383,7 +383,7 @@ void QgsSpatiaLiteSourceSelect::addTables() QItemSelection selection = mTablesTreeView->selectionModel()->selection(); QModelIndexList selectedIndices = selection.indexes(); - QStandardItem *currentItem = 0; + QStandardItem *currentItem = nullptr; QModelIndexList::const_iterator selected_it = selectedIndices.constBegin(); for ( ; selected_it != selectedIndices.constEnd(); ++selected_it ) diff --git a/src/providers/wcs/qgswcscapabilities.cpp b/src/providers/wcs/qgswcscapabilities.cpp index 0c68e729856..5d6debe2098 100644 --- a/src/providers/wcs/qgswcscapabilities.cpp +++ b/src/providers/wcs/qgswcscapabilities.cpp @@ -65,7 +65,7 @@ QgsWcsCapabilities::QgsWcsCapabilities( QgsDataSourceURI const &theUri ) : mUri( theUri ) - , mCapabilitiesReply( NULL ) + , mCapabilitiesReply( nullptr ) , mCoverageCount( 0 ) , mCacheLoadControl( QNetworkRequest::PreferNetwork ) { @@ -78,7 +78,7 @@ QgsWcsCapabilities::QgsWcsCapabilities( QgsDataSourceURI const &theUri ) QgsWcsCapabilities::QgsWcsCapabilities() : mCapabilities() - , mCapabilitiesReply( NULL ) + , mCapabilitiesReply( nullptr ) , mCoverageCount( 0 ) , mCacheLoadControl( QNetworkRequest::PreferNetwork ) { @@ -416,7 +416,7 @@ void QgsWcsCapabilities::capabilitiesReplyFinished() } mCapabilitiesReply->deleteLater(); - mCapabilitiesReply = 0; + mCapabilitiesReply = nullptr; } void QgsWcsCapabilities::capabilitiesReplyProgress( qint64 bytesReceived, qint64 bytesTotal ) @@ -1231,7 +1231,7 @@ QgsWcsCoverageSummary* QgsWcsCapabilities::coverageSummary( QString const & theI } } } - return 0; + return nullptr; } QList QgsWcsCapabilities::coverages() diff --git a/src/providers/wcs/qgswcscapabilities.h b/src/providers/wcs/qgswcscapabilities.h index fb8f919a9aa..f7773442a38 100644 --- a/src/providers/wcs/qgswcscapabilities.h +++ b/src/providers/wcs/qgswcscapabilities.h @@ -221,10 +221,10 @@ class QgsWcsCapabilities : public QObject void parseUri(); //! Get coverage summary for identifier - QgsWcsCoverageSummary * coverageSummary( QString const & theIdentifier, QgsWcsCoverageSummary* parent = 0 ); + QgsWcsCoverageSummary * coverageSummary( QString const & theIdentifier, QgsWcsCoverageSummary* parent = nullptr ); // ! Get list of all sub coverages - QList coverageSummaries( QgsWcsCoverageSummary* parent = 0 ); + QList coverageSummaries( QgsWcsCoverageSummary* parent = nullptr ); void initCoverageSummary( QgsWcsCoverageSummary &coverageSummary ); @@ -261,12 +261,12 @@ class QgsWcsCapabilities : public QObject //! parse the WCS Layer XML element void parseCoverageOfferingBrief( QDomElement const &e, QgsWcsCoverageSummary &coverageSummary, - QgsWcsCoverageSummary *parent = 0 ); + QgsWcsCoverageSummary *parent = nullptr ); // ------------- 1.1 -------------------- //! parse the WCS Layer XML element void parseCoverageSummary( QDomElement const &e, QgsWcsCoverageSummary &coverageSummary, - QgsWcsCoverageSummary *parent = 0 ); + QgsWcsCoverageSummary *parent = nullptr ); //! Data source uri QgsDataSourceURI mUri; diff --git a/src/providers/wcs/qgswcsdataitems.cpp b/src/providers/wcs/qgswcsdataitems.cpp index 9e446f083f6..46a6897187f 100644 --- a/src/providers/wcs/qgswcsdataitems.cpp +++ b/src/providers/wcs/qgswcsdataitems.cpp @@ -100,7 +100,7 @@ QList QgsWCSConnectionItem::actions() void QgsWCSConnectionItem::editConnection() { - QgsNewHttpConnection nc( 0, "/Qgis/connections-wcs/", mName ); + QgsNewHttpConnection nc( nullptr, "/Qgis/connections-wcs/", mName ); if ( nc.exec() ) { @@ -255,7 +255,7 @@ QList QgsWCSRootItem::actions() QWidget * QgsWCSRootItem::paramWidget() { - QgsWCSSourceSelect *select = new QgsWCSSourceSelect( 0, 0, true, true ); + QgsWCSSourceSelect *select = new QgsWCSSourceSelect( nullptr, nullptr, true, true ); connect( select, SIGNAL( connectionsChanged() ), this, SLOT( connectionsChanged() ) ); return select; } @@ -267,7 +267,7 @@ void QgsWCSRootItem::connectionsChanged() void QgsWCSRootItem::newConnection() { - QgsNewHttpConnection nc( 0, "/Qgis/connections-wcs/" ); + QgsNewHttpConnection nc( nullptr, "/Qgis/connections-wcs/" ); if ( nc.exec() ) { @@ -306,7 +306,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) } } - return 0; + return nullptr; } QGISEXTERN QgsWCSSourceSelect * selectWidget( QWidget * parent, Qt::WindowFlags fl ) diff --git a/src/providers/wcs/qgswcsprovider.cpp b/src/providers/wcs/qgswcsprovider.cpp index 56e493623c9..5a8b2381b65 100644 --- a/src/providers/wcs/qgswcsprovider.cpp +++ b/src/providers/wcs/qgswcsprovider.cpp @@ -89,12 +89,12 @@ QgsWcsProvider::QgsWcsProvider( QString const &uri ) , mHasSize( false ) , mBandCount( 0 ) , mCoverageCrs() - , mCachedMemFile( 0 ) - , mCachedGdalDataset( 0 ) + , mCachedMemFile( nullptr ) + , mCachedGdalDataset( nullptr ) , mCachedViewExtent( 0 ) , mCachedViewWidth( 0 ) , mCachedViewHeight( 0 ) - , mCoordinateTransform( 0 ) + , mCoordinateTransform( nullptr ) , mExtentDirty( true ) , mGetFeatureInfoUrlBase( "" ) , mErrors( 0 ) @@ -459,7 +459,7 @@ QgsWcsProvider::~QgsWcsProvider() if ( mCoordinateTransform ) { delete mCoordinateTransform; - mCoordinateTransform = 0; + mCoordinateTransform = nullptr; } } @@ -498,7 +498,7 @@ void QgsWcsProvider::setCoverageCrs( QString const & crs ) if ( mCoordinateTransform ) { delete mCoordinateTransform; - mCoordinateTransform = 0; + mCoordinateTransform = nullptr; } mExtentDirty = true; @@ -897,14 +897,14 @@ void QgsWcsProvider::clearCache() { QgsDebugMsg( "Close mCachedGdalDataset" ); GDALClose( mCachedGdalDataset ); - mCachedGdalDataset = 0; + mCachedGdalDataset = nullptr; QgsDebugMsg( "Closed" ); } if ( mCachedMemFile ) { QgsDebugMsg( "Close mCachedMemFile" ); VSIFCloseL( mCachedMemFile ); - mCachedMemFile = 0; + mCachedMemFile = nullptr; QgsDebugMsg( "Closed" ); } QgsDebugMsg( "Clear mCachedData" ); @@ -1675,7 +1675,7 @@ QgsWcsDownloadHandler::QgsWcsDownloadHandler( const QUrl& url, QgsWcsAuthorizati : mNAM( new QgsNetworkAccessManager ) , mAuth( auth ) , mEventLoop( new QEventLoop ) - , mCacheReply( 0 ) + , mCacheReply( nullptr ) , mCachedData( cachedData ) , mWcsVersion( wcsVersion ) , mCachedError( cachedError ) @@ -1707,7 +1707,7 @@ void QgsWcsDownloadHandler::blockingDownload() { mEventLoop->exec( QEventLoop::ExcludeUserInputEvents ); - Q_ASSERT( mCacheReply == 0 ); + Q_ASSERT( mCacheReply == nullptr ); } void QgsWcsDownloadHandler::cacheReplyFinished() @@ -1747,7 +1747,7 @@ void QgsWcsDownloadHandler::cacheReplyFinished() mCacheReply->url().toString() ), tr( "WCS" ) ); mCacheReply->deleteLater(); - mCacheReply = 0; + mCacheReply = nullptr; finish(); return; @@ -1786,7 +1786,7 @@ void QgsWcsDownloadHandler::cacheReplyFinished() } mCacheReply->deleteLater(); - mCacheReply = 0; + mCacheReply = nullptr; finish(); return; @@ -1802,7 +1802,7 @@ void QgsWcsDownloadHandler::cacheReplyFinished() { QgsMessageLog::logMessage( tr( "Cannot parse multipart response: %1" ).arg( parser.error() ), tr( "WCS" ) ); mCacheReply->deleteLater(); - mCacheReply = 0; + mCacheReply = nullptr; finish(); return; @@ -1812,7 +1812,7 @@ void QgsWcsDownloadHandler::cacheReplyFinished() { QgsMessageLog::logMessage( tr( "Expected 2 parts, %1 received" ).arg( parser.parts() ), tr( "WCS" ) ); mCacheReply->deleteLater(); - mCacheReply = 0; + mCacheReply = nullptr; finish(); return; @@ -1847,7 +1847,7 @@ void QgsWcsDownloadHandler::cacheReplyFinished() } mCacheReply->deleteLater(); - mCacheReply = 0; + mCacheReply = nullptr; finish(); return; @@ -1877,7 +1877,7 @@ void QgsWcsDownloadHandler::cacheReplyFinished() } mCacheReply->deleteLater(); - mCacheReply = 0; + mCacheReply = nullptr; finish(); } @@ -1910,7 +1910,7 @@ void QgsWcsDownloadHandler::cacheReplyFinished() } mCacheReply->deleteLater(); - mCacheReply = 0; + mCacheReply = nullptr; finish(); } diff --git a/src/providers/wcs/qgswcsprovider.h b/src/providers/wcs/qgswcsprovider.h index 015f9c705cf..d59850dd646 100644 --- a/src/providers/wcs/qgswcsprovider.h +++ b/src/providers/wcs/qgswcsprovider.h @@ -102,7 +102,7 @@ class QgsWcsProvider : public QgsRasterDataProvider, QgsGdalProviderBase * otherwise we contact the host directly. * */ - explicit QgsWcsProvider( QString const & uri = 0 ); + explicit QgsWcsProvider( QString const & uri = nullptr ); //! Destructor virtual ~QgsWcsProvider(); diff --git a/src/providers/wcs/qgswcssourceselect.h b/src/providers/wcs/qgswcssourceselect.h index 93888a9e4b0..9e49db0fc21 100644 --- a/src/providers/wcs/qgswcssourceselect.h +++ b/src/providers/wcs/qgswcssourceselect.h @@ -53,7 +53,7 @@ class QgsWCSSourceSelect : public QgsOWSSourceSelect public: //! Constructor - QgsWCSSourceSelect( QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false ); + QgsWCSSourceSelect( QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false ); //! Destructor ~QgsWCSSourceSelect(); diff --git a/src/providers/wfs/qgswfscapabilities.cpp b/src/providers/wfs/qgswfscapabilities.cpp index 35810c469da..a3a248f1126 100644 --- a/src/providers/wfs/qgswfscapabilities.cpp +++ b/src/providers/wfs/qgswfscapabilities.cpp @@ -28,7 +28,7 @@ static const QString WFS_NAMESPACE = "http://www.opengis.net/wfs"; QgsWFSCapabilities::QgsWFSCapabilities( const QString& theUri ) - : mCapabilitiesReply( 0 ) + : mCapabilitiesReply( nullptr ) , mErrorCode( QgsWFSCapabilities::NoError ) { mUri.setEncodedUri( theUri ); @@ -189,7 +189,7 @@ void QgsWFSCapabilities::capabilitiesReplyFinished() { QNetworkReply *reply = mCapabilitiesReply; reply->deleteLater(); - mCapabilitiesReply = 0; + mCapabilitiesReply = nullptr; // handle network errors if ( reply->error() != QNetworkReply::NoError ) diff --git a/src/providers/wfs/qgswfsdataitems.cpp b/src/providers/wfs/qgswfsdataitems.cpp index 8d8ef0b0401..6543bffda17 100644 --- a/src/providers/wfs/qgswfsdataitems.cpp +++ b/src/providers/wfs/qgswfsdataitems.cpp @@ -41,7 +41,7 @@ QgsWFSLayerItem::~QgsWFSLayerItem() QgsWFSConnectionItem::QgsWFSConnectionItem( QgsDataItem* parent, QString name, QString path, QString uri ) : QgsDataCollectionItem( parent, name, path ) , mUri( uri ) - , mCapabilities( NULL ) + , mCapabilities( nullptr ) , mGotCapabilities( false ) { mIconName = "mIconWfs.svg"; @@ -87,7 +87,7 @@ QVector QgsWFSConnectionItem::createChildren() } mCapabilities->deleteLater(); - mCapabilities = NULL; + mCapabilities = nullptr; return layers; } @@ -114,7 +114,7 @@ QList QgsWFSConnectionItem::actions() void QgsWFSConnectionItem::editConnection() { - QgsNewHttpConnection nc( 0, "/Qgis/connections-wfs/", mName ); + QgsNewHttpConnection nc( nullptr, "/Qgis/connections-wfs/", mName ); nc.setWindowTitle( tr( "Modify WFS connection" ) ); if ( nc.exec() ) @@ -175,7 +175,7 @@ QList QgsWFSRootItem::actions() QWidget * QgsWFSRootItem::paramWidget() { - QgsWFSSourceSelect *select = new QgsWFSSourceSelect( 0, 0, true ); + QgsWFSSourceSelect *select = new QgsWFSSourceSelect( nullptr, nullptr, true ); connect( select, SIGNAL( connectionsChanged() ), this, SLOT( connectionsChanged() ) ); return select; } @@ -187,7 +187,7 @@ void QgsWFSRootItem::connectionsChanged() void QgsWFSRootItem::newConnection() { - QgsNewHttpConnection nc( 0, "/Qgis/connections-wfs/" ); + QgsNewHttpConnection nc( nullptr, "/Qgis/connections-wfs/" ); nc.setWindowTitle( tr( "Create a new WFS connection" ) ); if ( nc.exec() ) @@ -227,5 +227,5 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) } } - return 0; + return nullptr; } diff --git a/src/providers/wfs/qgswfsfeatureiterator.cpp b/src/providers/wfs/qgswfsfeatureiterator.cpp index 9e3aec2929f..22ca55d73fa 100644 --- a/src/providers/wfs/qgswfsfeatureiterator.cpp +++ b/src/providers/wfs/qgswfsfeatureiterator.cpp @@ -52,7 +52,7 @@ bool QgsWFSFeatureIterator::fetchFeature( QgsFeature& f ) return false; } - const QgsFeature *fet = 0; + const QgsFeature *fet = nullptr; for ( ;; ) { @@ -126,7 +126,7 @@ void QgsWFSFeatureIterator::copyFeature( const QgsFeature* f, QgsFeature& featur } else { - feature.setGeometry( 0 ); + feature.setGeometry( nullptr ); } //and the attributes @@ -153,7 +153,7 @@ QgsWFSFeatureSource::QgsWFSFeatureSource( const QgsWFSProvider* p ) : QObject(( QgsWFSProvider* ) p ) , mFields( p->mFields ) , mFeatures( p->mFeatures ) - , mSpatialIndex( p->mSpatialIndex ? new QgsSpatialIndex( *p->mSpatialIndex ) : 0 ) // just shallow copy + , mSpatialIndex( p->mSpatialIndex ? new QgsSpatialIndex( *p->mSpatialIndex ) : nullptr ) // just shallow copy { } diff --git a/src/providers/wfs/qgswfsprovider.cpp b/src/providers/wfs/qgswfsprovider.cpp index 83d5a1d726a..ae8b0ef7796 100644 --- a/src/providers/wfs/qgswfsprovider.cpp +++ b/src/providers/wfs/qgswfsprovider.cpp @@ -74,7 +74,7 @@ QgsWFSProvider::QgsWFSProvider( const QString& uri ) , mInitGro( false ) #endif { - mSpatialIndex = 0; + mSpatialIndex = nullptr; if ( uri.isEmpty() ) { mValid = false; @@ -691,7 +691,7 @@ int QgsWFSProvider::getFeatureGET( const QString& uri, const QString& geometryAt connect( &dataReader, SIGNAL( dataProgressAndSteps( int, int ) ), this, SLOT( handleWFSProgressMessage( int, int ) ) ); //also connect to statusChanged signal of qgisapp (if it exists) - QWidget* mainWindow = 0; + QWidget* mainWindow = nullptr; QWidgetList topLevelWidgets = qApp->topLevelWidgets(); for ( QWidgetList::iterator it = topLevelWidgets.begin(); it != topLevelWidgets.end(); ++it ) @@ -1205,7 +1205,7 @@ int QgsWFSProvider::getFeaturesFromGML2( const QDomElement& wfsCollectionElement QDomElement layerNameElem; QDomNode currentAttributeChild; QDomElement currentAttributeElement; - QgsFeature* f = 0; + QgsFeature* f = nullptr; mFeatureCount = 0; for ( int i = 0; i < featureTypeNodeList.size(); ++i ) diff --git a/src/providers/wfs/qgswfssourceselect.cpp b/src/providers/wfs/qgswfssourceselect.cpp index 1e53fbf47e0..882085a6873 100644 --- a/src/providers/wfs/qgswfssourceselect.cpp +++ b/src/providers/wfs/qgswfssourceselect.cpp @@ -40,7 +40,7 @@ QgsWFSSourceSelect::QgsWFSSourceSelect( QWidget* parent, Qt::WindowFlags fl, bool embeddedMode ) : QDialog( parent, fl ) - , mCapabilities( NULL ) + , mCapabilities( nullptr ) { setupUi( this ); @@ -207,7 +207,7 @@ void QgsWFSSourceSelect::capabilitiesReplyFinished() default: tr( "Error" ); break; } // handle errors - QMessageBox::critical( 0, title, mCapabilities->errorMessage() ); + QMessageBox::critical( nullptr, title, mCapabilities->errorMessage() ); mAddButton->setEnabled( false ); return; @@ -264,7 +264,7 @@ void QgsWFSSourceSelect::capabilitiesReplyFinished() } else { - QMessageBox::information( 0, tr( "No Layers" ), tr( "capabilities document contained no layers." ) ); + QMessageBox::information( nullptr, tr( "No Layers" ), tr( "capabilities document contained no layers." ) ); mAddButton->setEnabled( false ); mBuildQueryButton->setEnabled( false ); } @@ -272,7 +272,7 @@ void QgsWFSSourceSelect::capabilitiesReplyFinished() void QgsWFSSourceSelect::addEntryToServerList() { - QgsNewHttpConnection nc( 0, "/Qgis/connections-wfs/" ); + QgsNewHttpConnection nc( nullptr, "/Qgis/connections-wfs/" ); nc.setWindowTitle( tr( "Create a new WFS connection" ) ); if ( nc.exec() ) @@ -284,7 +284,7 @@ void QgsWFSSourceSelect::addEntryToServerList() void QgsWFSSourceSelect::modifyEntryOfServerList() { - QgsNewHttpConnection nc( 0, "/Qgis/connections-wfs/", cmbConnections->currentText() ); + QgsNewHttpConnection nc( nullptr, "/Qgis/connections-wfs/", cmbConnections->currentText() ); nc.setWindowTitle( tr( "Modify WFS connection" ) ); if ( nc.exec() ) @@ -443,7 +443,7 @@ void QgsWFSSourceSelect::buildQuery( const QModelIndex& index ) } //show expression builder - QgsExpressionBuilderDialog d( 0, filterIndex.data().toString() ); + QgsExpressionBuilderDialog d( nullptr, filterIndex.data().toString() ); //add available attributes to expression builder QgsExpressionBuilderWidget* w = d.expressionBuilder(); diff --git a/src/providers/wfs/qgswfssourceselect.h b/src/providers/wfs/qgswfssourceselect.h index 5c7f3f5809b..074d06e1825 100644 --- a/src/providers/wfs/qgswfssourceselect.h +++ b/src/providers/wfs/qgswfssourceselect.h @@ -33,7 +33,7 @@ class QgsWFSItemDelegate : public QItemDelegate Q_OBJECT public: - explicit QgsWFSItemDelegate( QObject *parent = 0 ) : QItemDelegate( parent ) { } + explicit QgsWFSItemDelegate( QObject *parent = nullptr ) : QItemDelegate( parent ) { } virtual QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const override; diff --git a/src/providers/wms/qgstilescalewidget.h b/src/providers/wms/qgstilescalewidget.h index 60404ed125e..101a8be85a0 100644 --- a/src/providers/wms/qgstilescalewidget.h +++ b/src/providers/wms/qgstilescalewidget.h @@ -38,7 +38,7 @@ class QgsTileScaleWidget : public QWidget, private Ui::QgsTileScaleWidget void scaleEnabled( bool ); private: - QgsTileScaleWidget( QgsMapCanvas *mapCanvas, QWidget *parent = 0, Qt::WindowFlags f = 0 ); + QgsTileScaleWidget( QgsMapCanvas *mapCanvas, QWidget *parent = nullptr, Qt::WindowFlags f = nullptr ); ~QgsTileScaleWidget(); QgsMapCanvas *mMapCanvas; diff --git a/src/providers/wms/qgswmscapabilities.cpp b/src/providers/wms/qgswmscapabilities.cpp index daa73aa83a6..9cd032e23bc 100644 --- a/src/providers/wms/qgswmscapabilities.cpp +++ b/src/providers/wms/qgswmscapabilities.cpp @@ -593,7 +593,7 @@ void QgsWmsCapabilities::parseCapability( QDomElement const & e, QgsWmsCapabilit QgsWmsDcpTypeProperty dcp; dcp.http.get.onlineResource.xlinkHref = href; - QgsWmsOperationType *ot = 0; + QgsWmsOperationType *ot = nullptr; if ( href.isNull() ) { QgsDebugMsg( QString( "http get missing from ows:Operation '%1'" ).arg( name ) ); @@ -1748,7 +1748,7 @@ void QgsWmsCapabilities::parseTheme( const QDomElement &e, QgsWmtsTheme &t ) } else { - t.subTheme = 0; + t.subTheme = nullptr; } t.layerRefs.clear(); @@ -1867,7 +1867,7 @@ int QgsWmsCapabilities::identifyCapabilities() const QgsWmsCapabilitiesDownload::QgsWmsCapabilitiesDownload( bool forceRefresh, QObject *parent ) : QObject( parent ) - , mCapabilitiesReply( 0 ) + , mCapabilitiesReply( nullptr ) , mIsAborted( false ) , mForceRefresh( forceRefresh ) { @@ -1878,7 +1878,7 @@ QgsWmsCapabilitiesDownload::QgsWmsCapabilitiesDownload( const QString& baseUrl, : QObject( parent ) , mBaseUrl( baseUrl ) , mAuth( auth ) - , mCapabilitiesReply( 0 ) + , mCapabilitiesReply( nullptr ) , mIsAborted( false ) , mForceRefresh( forceRefresh ) { @@ -1978,7 +1978,7 @@ void QgsWmsCapabilitiesDownload::abort() if ( mCapabilitiesReply ) { emit deleteReply( mCapabilitiesReply ); - mCapabilitiesReply = 0; + mCapabilitiesReply = nullptr; } } @@ -2025,7 +2025,7 @@ void QgsWmsCapabilitiesDownload::capabilitiesReplyFinished() request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true ); mCapabilitiesReply->deleteLater(); - mCapabilitiesReply = 0; + mCapabilitiesReply = nullptr; QgsDebugMsg( QString( "redirected getcapabilities: %1 forceRefresh=%2" ).arg( redirect.toString() ).arg( mForceRefresh ) ); //mCapabilitiesReply = QgsNetworkAccessManager::instance()->get( request ); @@ -2090,7 +2090,7 @@ void QgsWmsCapabilitiesDownload::capabilitiesReplyFinished() if ( mCapabilitiesReply ) { mCapabilitiesReply->deleteLater(); - mCapabilitiesReply = 0; + mCapabilitiesReply = nullptr; } emit downloadFinished(); diff --git a/src/providers/wms/qgswmscapabilities.h b/src/providers/wms/qgswmscapabilities.h index 56730160e75..7d5b52c2268 100644 --- a/src/providers/wms/qgswmscapabilities.h +++ b/src/providers/wms/qgswmscapabilities.h @@ -290,7 +290,7 @@ struct QgsWmtsTheme QgsWmtsTheme *subTheme; QStringList layerRefs; - QgsWmtsTheme() : subTheme( 0 ) {} + QgsWmtsTheme() : subTheme( nullptr ) {} ~QgsWmtsTheme() { delete subTheme; } }; @@ -600,7 +600,7 @@ class QgsWmsCapabilities void parseCapability( QDomElement const & e, QgsWmsCapabilityProperty& capabilityProperty ); void parseRequest( QDomElement const & e, QgsWmsRequestProperty& requestProperty ); void parseLegendUrl( QDomElement const &e, QgsWmsLegendUrlProperty &legendUrlProperty ); - void parseLayer( QDomElement const & e, QgsWmsLayerProperty& layerProperty, QgsWmsLayerProperty *parentProperty = 0 ); + void parseLayer( QDomElement const & e, QgsWmsLayerProperty& layerProperty, QgsWmsLayerProperty *parentProperty = nullptr ); void parseStyle( QDomElement const & e, QgsWmsStyleProperty& styleProperty ); void parseOperationType( QDomElement const & e, QgsWmsOperationType& operationType ); @@ -696,9 +696,9 @@ class QgsWmsCapabilitiesDownload : public QObject Q_OBJECT public: - explicit QgsWmsCapabilitiesDownload( bool forceRefresh, QObject* parent = 0 ); + explicit QgsWmsCapabilitiesDownload( bool forceRefresh, QObject* parent = nullptr ); - QgsWmsCapabilitiesDownload( const QString& baseUrl, const QgsWmsAuthorization& auth, bool forceRefresh, QObject* parent = 0 ); + QgsWmsCapabilitiesDownload( const QString& baseUrl, const QgsWmsAuthorization& auth, bool forceRefresh, QObject* parent = nullptr ); virtual ~QgsWmsCapabilitiesDownload(); diff --git a/src/providers/wms/qgswmsdataitems.cpp b/src/providers/wms/qgswmsdataitems.cpp index 55ded39c18e..1d334e1199a 100644 --- a/src/providers/wms/qgswmsdataitems.cpp +++ b/src/providers/wms/qgswmsdataitems.cpp @@ -27,7 +27,7 @@ QgsWMSConnectionItem::QgsWMSConnectionItem( QgsDataItem* parent, QString name, QString path, QString uri ) : QgsDataCollectionItem( parent, name, path ) , mUri( uri ) - , mCapabilitiesDownload( 0 ) + , mCapabilitiesDownload( nullptr ) { mIconName = "mIconConnect.png"; mCapabilitiesDownload = new QgsWmsCapabilitiesDownload( false ); @@ -196,7 +196,7 @@ QList QgsWMSConnectionItem::actions() void QgsWMSConnectionItem::editConnection() { - QgsNewHttpConnection nc( 0, "/Qgis/connections-wms/", mName ); + QgsNewHttpConnection nc( nullptr, "/Qgis/connections-wms/", mName ); if ( nc.exec() ) { @@ -375,7 +375,7 @@ QList QgsWMSRootItem::actions() QWidget * QgsWMSRootItem::paramWidget() { - QgsWMSSourceSelect *select = new QgsWMSSourceSelect( 0, 0, true, true ); + QgsWMSSourceSelect *select = new QgsWMSSourceSelect( nullptr, nullptr, true, true ); connect( select, SIGNAL( connectionsChanged() ), this, SLOT( connectionsChanged() ) ); return select; } @@ -387,7 +387,7 @@ void QgsWMSRootItem::connectionsChanged() void QgsWMSRootItem::newConnection() { - QgsNewHttpConnection nc( 0 ); + QgsNewHttpConnection nc( nullptr ); if ( nc.exec() ) { @@ -432,6 +432,6 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) } } - return 0; + return nullptr; } diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index bd987000e16..d78dfcc80c5 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -92,20 +92,20 @@ QMap QgsWmsStatistics::sData; QgsWmsProvider::QgsWmsProvider( QString const& uri, const QgsWmsCapabilities* capabilities ) : QgsRasterDataProvider( uri ) - , mHttpGetLegendGraphicResponse( 0 ) + , mHttpGetLegendGraphicResponse( nullptr ) , mGetLegendGraphicImage() , mGetLegendGraphicScale( 0.0 ) , mImageCrs( DEFAULT_LATLON_CRS ) - , mCachedImage( 0 ) - , mIdentifyReply( 0 ) + , mCachedImage( nullptr ) + , mIdentifyReply( nullptr ) , mCachedViewExtent( 0 ) , mCachedViewWidth( 0 ) , mCachedViewHeight( 0 ) - , mCoordinateTransform( NULL ) + , mCoordinateTransform( nullptr ) , mExtentDirty( true ) , mTileReqNo( 0 ) - , mTileLayer( 0 ) - , mTileMatrixSet( 0 ) + , mTileLayer( nullptr ) + , mTileMatrixSet( nullptr ) { QgsDebugMsg( "constructing with uri '" + uri + "'." ); @@ -187,13 +187,13 @@ QgsWmsProvider::~QgsWmsProvider() if ( mCachedImage ) { delete mCachedImage; - mCachedImage = 0; + mCachedImage = nullptr; } } QgsWmsProvider* QgsWmsProvider::clone() const { - QgsWmsProvider* provider = new QgsWmsProvider( dataSourceUri(), mCaps.isValid() ? &mCaps : 0 ); + QgsWmsProvider* provider = new QgsWmsProvider( dataSourceUri(), mCaps.isValid() ? &mCaps : nullptr ); provider->copyBaseSettings( *this ); return provider; } @@ -287,7 +287,7 @@ bool QgsWmsProvider::addLayers() mExtentDirty = true; if ( mSettings.mTiled ) - mTileLayer = 0; + mTileLayer = nullptr; QgsDebugMsg( "Exiting." ); @@ -422,12 +422,12 @@ bool QgsWmsProvider::setImageCrs( QString const & crs ) else { QgsDebugMsg( QString( "Expected tile matrix set '%1' not found." ).arg( mSettings.mTileMatrixSetId ) ); - mTileMatrixSet = 0; + mTileMatrixSet = nullptr; } setProperty( "resolutions", resolutions ); - if ( mTileLayer == 0 || mTileMatrixSet == 0 ) + if ( mTileLayer == nullptr || mTileMatrixSet == nullptr ) { appendError( ERR( tr( "Tile layer or tile matrix set not found" ) ) ); return false; @@ -472,7 +472,7 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, in if ( mCachedImage ) { delete mCachedImage; - mCachedImage = 0; + mCachedImage = nullptr; } @@ -568,7 +568,7 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, in double vres = viewExtent.width() / pixelWidth; double tres = vres; - const QgsWmtsTileMatrix *tm = 0; + const QgsWmtsTileMatrix *tm = nullptr; enum QgsTileMode tileMode; if ( mSettings.mTiled ) @@ -935,7 +935,7 @@ static const QgsWmsLayerProperty* _findNestedLayerProperty( const QString& layer return res; } - return 0; + return nullptr; } @@ -1173,7 +1173,7 @@ bool QgsWmsProvider::isValid() QString QgsWmsProvider::wmsVersion() { // TODO - return NULL; + return nullptr; } @@ -1944,7 +1944,7 @@ QString QgsWmsProvider::metadata() if ( mLayerExtent.yMaximum() > r.yMaximum() ) { metadata += QString( "%2\">%3" ) - .arg( tr( "%n missing row(s)", 0, ( int ) ceil(( mLayerExtent.yMaximum() - r.yMaximum() ) / th ) ), + .arg( tr( "%n missing row(s)", nullptr, ( int ) ceil(( mLayerExtent.yMaximum() - r.yMaximum() ) / th ) ), tr( "Layer's upper bound: %1" ).arg( mLayerExtent.yMaximum(), 0, 'f' ) ) .arg( r.yMaximum(), 0, 'f' ); } @@ -1957,7 +1957,7 @@ QString QgsWmsProvider::metadata() if ( mLayerExtent.xMinimum() < r.xMinimum() ) { metadata += QString( "%2\">%3" ) - .arg( tr( "%n missing column(s)", 0, ( int ) ceil(( r.xMinimum() - mLayerExtent.xMinimum() ) / tw ) ), + .arg( tr( "%n missing column(s)", nullptr, ( int ) ceil(( r.xMinimum() - mLayerExtent.xMinimum() ) / tw ) ), tr( "Layer's left bound: %1" ).arg( mLayerExtent.xMinimum(), 0, 'f' ) ) .arg( r.xMinimum(), 0, 'f' ); } @@ -1970,7 +1970,7 @@ QString QgsWmsProvider::metadata() if ( mLayerExtent.yMaximum() > r.yMaximum() ) { metadata += QString( "%2\">%3" ) - .arg( tr( "%n missing row(s)", 0, ( int ) ceil(( mLayerExtent.yMaximum() - r.yMaximum() ) / th ) ), + .arg( tr( "%n missing row(s)", nullptr, ( int ) ceil(( mLayerExtent.yMaximum() - r.yMaximum() ) / th ) ), tr( "Layer's lower bound: %1" ).arg( mLayerExtent.yMaximum(), 0, 'f' ) ) .arg( r.yMaximum(), 0, 'f' ); } @@ -1983,7 +1983,7 @@ QString QgsWmsProvider::metadata() if ( mLayerExtent.xMaximum() > r.xMaximum() ) { metadata += QString( "%2\">%3" ) - .arg( tr( "%n missing column(s)", 0, ( int ) ceil(( mLayerExtent.xMaximum() - r.xMaximum() ) / tw ) ), + .arg( tr( "%n missing column(s)", nullptr, ( int ) ceil(( mLayerExtent.xMaximum() - r.xMaximum() ) / tw ) ), tr( "Layer's right bound: %1" ).arg( mLayerExtent.xMaximum(), 0, 'f' ) ) .arg( r.xMaximum(), 0, 'f' ); } @@ -2238,7 +2238,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint & thePoint, Qgs double vres = theExtent.width() / theWidth; double tres = vres; - const QgsWmtsTileMatrix *tm = 0; + const QgsWmtsTileMatrix *tm = nullptr; Q_ASSERT( mTileMatrixSet ); Q_ASSERT( !mTileMatrixSet->tileMatrices.isEmpty() ); @@ -2591,7 +2591,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint & thePoint, Qgs QMap features = gml.featuresMap(); QgsCoordinateReferenceSystem featuresCrs = gml.crs(); QgsDebugMsg( QString( "%1 features read, crs: %2 %3" ).arg( features.size() ).arg( featuresCrs.authid(), featuresCrs.description() ) ); - QgsCoordinateTransform *coordinateTransform = 0; + QgsCoordinateTransform *coordinateTransform = nullptr; if ( featuresCrs.isValid() && featuresCrs != crs() ) { coordinateTransform = new QgsCoordinateTransform( featuresCrs, crs() ); @@ -2642,7 +2642,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint & thePoint, Qgs QScriptValue result = engine.evaluate( json ); QgsFeatureStoreList featureStoreList; - QgsCoordinateTransform *coordinateTransform = 0; + QgsCoordinateTransform *coordinateTransform = nullptr; try { @@ -2830,7 +2830,7 @@ void QgsWmsProvider::identifyReplyFinished() QMetaObject::invokeMethod( loop, "quit", Qt::QueuedConnection ); mIdentifyReply->deleteLater(); - mIdentifyReply = 0; + mIdentifyReply = nullptr; } @@ -2870,7 +2870,7 @@ QString QgsWmsProvider::description() const void QgsWmsProvider::reloadData() { delete mCachedImage; - mCachedImage = 0; + mCachedImage = nullptr; } @@ -3078,7 +3078,7 @@ QgsImageFetcher* QgsWmsProvider::getLegendGraphicFetcher( const QgsMapSettings* } QUrl url = getLegendGraphicFullURL( scale, mapExtent ); - if ( ! url.isValid() ) return 0; + if ( ! url.isValid() ) return nullptr; if ( mapExtent == mGetLegendGraphicExtent && scale == mGetLegendGraphicScale && @@ -3213,7 +3213,7 @@ void QgsWmsImageDownloadHandler::downloadBlocking() { mEventLoop->exec( QEventLoop::ExcludeUserInputEvents ); - Q_ASSERT( mCacheReply == 0 ); + Q_ASSERT( mCacheReply == nullptr ); } void QgsWmsImageDownloadHandler::cacheReplyFinished() @@ -3242,7 +3242,7 @@ void QgsWmsImageDownloadHandler::cacheReplyFinished() mCacheReply->url().toString() ), tr( "WMS" ) ); mCacheReply->deleteLater(); - mCacheReply = 0; + mCacheReply = nullptr; finish(); return; @@ -3282,14 +3282,14 @@ void QgsWmsImageDownloadHandler::cacheReplyFinished() } mCacheReply->deleteLater(); - mCacheReply = 0; + mCacheReply = nullptr; finish(); return; } mCacheReply->deleteLater(); - mCacheReply = 0; + mCacheReply = nullptr; finish(); } @@ -3308,7 +3308,7 @@ void QgsWmsImageDownloadHandler::cacheReplyFinished() } mCacheReply->deleteLater(); - mCacheReply = 0; + mCacheReply = nullptr; finish(); } @@ -3651,7 +3651,7 @@ void QgsWmsProvider::setSRSQueryItem( QUrl& url ) QgsWmsLegendDownloadHandler::QgsWmsLegendDownloadHandler( QgsNetworkAccessManager& networkAccessManager, const QgsWmsSettings& settings, const QUrl& url ) : mNetworkAccessManager( networkAccessManager ) , mSettings( settings ) - , mReply( 0 ) + , mReply( nullptr ) , mInitialUrl( url ) { } @@ -3664,7 +3664,7 @@ QgsWmsLegendDownloadHandler::~QgsWmsLegendDownloadHandler() QgsDebugMsg( "WMSLegendDownloader destroyed while still processing reply" ); mReply->deleteLater(); } - mReply = 0; + mReply = nullptr; } /* public */ @@ -3710,7 +3710,7 @@ QgsWmsLegendDownloadHandler::sendError( const QString& msg ) QgsDebugMsg( QString( "emitting error: %1" ).arg( msg ) ); Q_ASSERT( mReply ); mReply->deleteLater(); - mReply = 0; + mReply = nullptr; emit error( msg ); } @@ -3720,7 +3720,7 @@ QgsWmsLegendDownloadHandler::sendSuccess( const QImage& img ) QgsDebugMsg( QString( "emitting finish: %1x%2 image" ).arg( img.width() ).arg( img.height() ) ); Q_ASSERT( mReply ); mReply->deleteLater(); - mReply = 0; + mReply = nullptr; emit finish( img ); } @@ -3745,7 +3745,7 @@ QgsWmsLegendDownloadHandler::finished( ) if ( !redirect.isNull() ) { mReply->deleteLater(); - mReply = 0; + mReply = nullptr; startUrl( redirect.toUrl() ); return; } diff --git a/src/providers/wms/qgswmsprovider.h b/src/providers/wms/qgswmsprovider.h index cc32354ccf3..5ee95c7d56b 100644 --- a/src/providers/wms/qgswmsprovider.h +++ b/src/providers/wms/qgswmsprovider.h @@ -120,7 +120,7 @@ class QgsWmsProvider : public QgsRasterDataProvider * \param capabilities Optionally existing parsed capabilities for the given URI * */ - QgsWmsProvider( QString const & uri = 0, const QgsWmsCapabilities* capabilities = 0 ); + QgsWmsProvider( QString const & uri = nullptr, const QgsWmsCapabilities* capabilities = nullptr ); //! Destructor virtual ~QgsWmsProvider(); @@ -237,7 +237,7 @@ class QgsWmsProvider : public QgsRasterDataProvider * * \note visibleExtent parameter added in 2.8 */ - QImage getLegendGraphic( double scale = 0.0, bool forceRefresh = false, const QgsRectangle * visibleExtent = 0 ) override; + QImage getLegendGraphic( double scale = 0.0, bool forceRefresh = false, const QgsRectangle * visibleExtent = nullptr ) override; /** * \class Get an image downloader for the raster legend diff --git a/src/providers/wms/qgswmssourceselect.cpp b/src/providers/wms/qgswmssourceselect.cpp index 2a61e73478d..a405f98f82a 100644 --- a/src/providers/wms/qgswmssourceselect.cpp +++ b/src/providers/wms/qgswmssourceselect.cpp @@ -59,7 +59,7 @@ QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget * parent, Qt::WindowFlags fl, bo , mManagerMode( managerMode ) , mEmbeddedMode( embeddedMode ) , mDefaultCRS( GEO_EPSG_CRS_AUTHID ) - , mCurrentTileset( 0 ) + , mCurrentTileset( nullptr ) { setupUi( this ); @@ -513,7 +513,7 @@ void QgsWMSSourceSelect::addClicked() uri.setParam( "tileMatrixSet", item->data( Qt::UserRole + 3 ).toStringList() ); - const QgsWmtsTileLayer *layer = 0; + const QgsWmtsTileLayer *layer = nullptr; Q_FOREACH ( const QgsWmtsTileLayer &l, mTileLayers ) { @@ -665,8 +665,8 @@ void QgsWMSSourceSelect::applySelectionConstraints( QTreeWidgetItem *item ) return; } - QTreeWidgetItem *style = 0; - QTreeWidgetItem *firstNewStyle = 0; + QTreeWidgetItem *style = nullptr; + QTreeWidgetItem *firstNewStyle = nullptr; for ( int i = 0; i < item->childCount(); i++ ) { QTreeWidgetItem *child = item->child( i ); @@ -876,7 +876,7 @@ void QgsWMSSourceSelect::on_lstTilesets_itemClicked( QTableWidgetItem *item ) } else { - mCurrentTileset = 0; + mCurrentTileset = nullptr; } lstTilesets->blockSignals( false ); diff --git a/src/providers/wms/qgswmssourceselect.h b/src/providers/wms/qgswmssourceselect.h index 203696d4f61..4c298ca00ea 100644 --- a/src/providers/wms/qgswmssourceselect.h +++ b/src/providers/wms/qgswmssourceselect.h @@ -50,7 +50,7 @@ class QgsWMSSourceSelect : public QDialog, private Ui::QgsWMSSourceSelectBase public: //! Constructor - QgsWMSSourceSelect( QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false ); + QgsWMSSourceSelect( QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags, bool managerMode = false, bool embeddedMode = false ); //! Destructor ~QgsWMSSourceSelect(); diff --git a/src/providers/wms/qgswmtsdimensions.h b/src/providers/wms/qgswmtsdimensions.h index b401bb58a74..1f5371c0532 100644 --- a/src/providers/wms/qgswmtsdimensions.h +++ b/src/providers/wms/qgswmtsdimensions.h @@ -37,7 +37,7 @@ class QgsWmtsDimensions : public QDialog, private Ui::QgsWmtsDimensionsBase public: //! Constructor - QgsWmtsDimensions( const QgsWmtsTileLayer &layer, QWidget *parent = 0, Qt::WindowFlags fl = 0 ); + QgsWmtsDimensions( const QgsWmtsTileLayer &layer, QWidget *parent = nullptr, Qt::WindowFlags fl = nullptr ); //! Destructor ~QgsWmtsDimensions(); diff --git a/src/python/qgspythonutilsimpl.cpp b/src/python/qgspythonutilsimpl.cpp index 4f3497bf0ee..a07164e489f 100644 --- a/src/python/qgspythonutilsimpl.cpp +++ b/src/python/qgspythonutilsimpl.cpp @@ -43,8 +43,8 @@ PyThreadState* _mainState; QgsPythonUtilsImpl::QgsPythonUtilsImpl() { - mMainModule = NULL; - mMainDict = NULL; + mMainModule = nullptr; + mMainDict = nullptr; mPythonEnabled = false; } @@ -266,8 +266,8 @@ bool QgsPythonUtilsImpl::startServerPlugin( QString packageName ) void QgsPythonUtilsImpl::exitPython() { Py_Finalize(); - mMainModule = NULL; - mMainDict = NULL; + mMainModule = nullptr; + mMainDict = nullptr; mPythonEnabled = false; } @@ -300,7 +300,7 @@ bool QgsPythonUtilsImpl::runStringUnsafe( const QString& command, bool single ) // (non-unicode strings can be mangled) PyRun_String( command.toUtf8().data(), single ? Py_single_input : Py_file_input, mMainDict, mMainDict ); - bool res = ( PyErr_Occurred() == 0 ); + bool res = ( PyErr_Occurred() == nullptr ); // we are done calling python API, release global interpreter lock PyGILState_Release( gstate ); @@ -353,10 +353,10 @@ QString QgsPythonUtilsImpl::getTraceback() QString errMsg; QString result; - PyObject *modStringIO = NULL; - PyObject *modTB = NULL; - PyObject *obStringIO = NULL; - PyObject *obResult = NULL; + PyObject *modStringIO = nullptr; + PyObject *modTB = nullptr; + PyObject *obStringIO = nullptr; + PyObject *obResult = nullptr; PyObject *type, *value, *traceback; @@ -370,17 +370,17 @@ QString QgsPythonUtilsImpl::getTraceback() #endif modStringIO = PyImport_ImportModule( iomod ); - if ( modStringIO == NULL ) + if ( modStringIO == nullptr ) TRACEBACK_FETCH_ERROR( QString( "can't import %1" ).arg( iomod ) ); - obStringIO = PyObject_CallMethod( modStringIO, ( char* ) "StringIO", NULL ); + obStringIO = PyObject_CallMethod( modStringIO, ( char* ) "StringIO", nullptr ); /* Construct a cStringIO object */ - if ( obStringIO == NULL ) + if ( obStringIO == nullptr ) TRACEBACK_FETCH_ERROR( "cStringIO.StringIO() failed" ); modTB = PyImport_ImportModule( "traceback" ); - if ( modTB == NULL ) + if ( modTB == nullptr ) TRACEBACK_FETCH_ERROR( "can't import traceback" ); obResult = PyObject_CallMethod( modTB, ( char* ) "print_exception", @@ -390,12 +390,12 @@ QString QgsPythonUtilsImpl::getTraceback() Py_None, obStringIO ); - if ( obResult == NULL ) + if ( obResult == nullptr ) TRACEBACK_FETCH_ERROR( "traceback.print_exception() failed" ); Py_DECREF( obResult ); - obResult = PyObject_CallMethod( obStringIO, ( char* ) "getvalue", NULL ); - if ( obResult == NULL ) + obResult = PyObject_CallMethod( obStringIO, ( char* ) "getvalue", nullptr ); + if ( obResult == nullptr ) TRACEBACK_FETCH_ERROR( "getvalue() failed." ); /* And it should be a string all ready to go - duplicate it. */ @@ -435,7 +435,7 @@ done: QString QgsPythonUtilsImpl::getTypeAsString( PyObject* obj ) { if ( !obj ) - return 0; + return nullptr; #ifdef PYTHON2 if ( PyClass_Check( obj ) ) @@ -480,7 +480,7 @@ bool QgsPythonUtilsImpl::getError( QString& errorClassName, QString& errorText ) errorClassName = getTypeAsString( err_type ); // get exception's text - if ( err_value != NULL && err_value != Py_None ) + if ( err_value != nullptr && err_value != Py_None ) { errorText = PyObjectToQString( err_value ); } @@ -573,7 +573,7 @@ bool QgsPythonUtilsImpl::evalString( const QString& command, QString& result ) gstate = PyGILState_Ensure(); PyObject* res = PyRun_String( command.toUtf8().data(), Py_eval_input, mMainDict, mMainDict ); - bool success = ( res != NULL ); + bool success = ( res != nullptr ); // TODO: error handling @@ -620,7 +620,7 @@ QString QgsPythonUtilsImpl::homePluginsPath() QStringList QgsPythonUtilsImpl::extraPluginsPaths() { const char* cpaths = getenv( "QGIS_PLUGINPATH" ); - if ( cpaths == NULL ) + if ( cpaths == nullptr ) return QStringList(); QString paths = QString::fromLocal8Bit( cpaths ); diff --git a/src/server/qgsaccesscontrolfilter.cpp b/src/server/qgsaccesscontrolfilter.cpp index e0888b7528c..c3c83a1bb07 100644 --- a/src/server/qgsaccesscontrolfilter.cpp +++ b/src/server/qgsaccesscontrolfilter.cpp @@ -42,7 +42,7 @@ const QString QgsAccessControlFilter::layerFilterExpression( const QgsVectorLaye { QgsMessageLog::logMessage( "QgsAccessControlFilter plugin default layerFilterExpression called", "AccessControlFilter", QgsMessageLog::INFO ); Q_UNUSED( layer ); - return NULL; + return nullptr; } /** Return an additional layer subset string (typically SQL) filter */ @@ -50,7 +50,7 @@ const QString QgsAccessControlFilter::layerFilterSubsetString( const QgsVectorLa { QgsMessageLog::logMessage( "QgsAccessControlFilter plugin default layerFilterSQL called", "AccessControlFilter", QgsMessageLog::INFO ); Q_UNUSED( layer ); - return NULL; + return nullptr; } /** Return the layer permissions */ @@ -69,7 +69,7 @@ const QStringList* QgsAccessControlFilter::authorizedLayerAttributes( const QgsV Q_UNUSED( layer ); Q_UNUSED( attributes ); QgsMessageLog::logMessage( "QgsAccessControlFilter plugin default authorizedLayerAttributes called", "AccessControlFilter", QgsMessageLog::INFO ); - return NULL; + return nullptr; } /** Are we authorized to modify the feature */ diff --git a/src/server/qgscapabilitiescache.cpp b/src/server/qgscapabilitiescache.cpp index fb6020225c1..9fc08bf10da 100644 --- a/src/server/qgscapabilitiescache.cpp +++ b/src/server/qgscapabilitiescache.cpp @@ -38,7 +38,7 @@ const QDomDocument* QgsCapabilitiesCache::searchCapabilitiesDocument( const QStr } else { - return 0; + return nullptr; } } diff --git a/src/server/qgsconfigcache.cpp b/src/server/qgsconfigcache.cpp index c9272279463..aab9c4a66a4 100644 --- a/src/server/qgsconfigcache.cpp +++ b/src/server/qgsconfigcache.cpp @@ -28,7 +28,7 @@ QgsConfigCache* QgsConfigCache::instance() { - static QgsConfigCache *instance = 0; + static QgsConfigCache *instance = nullptr; if ( !instance ) instance = new QgsConfigCache(); @@ -50,7 +50,7 @@ QgsServerProjectParser* QgsConfigCache::serverConfiguration( const QString& file QDomDocument* doc = xmlDocument( filePath ); if ( !doc ) { - return 0; + return nullptr; } return new QgsServerProjectParser( doc, filePath ); } @@ -68,7 +68,7 @@ QgsWCSProjectParser *QgsConfigCache::wcsConfiguration( QDomDocument* doc = xmlDocument( filePath ); if ( !doc ) { - return 0; + return nullptr; } p = new QgsWCSProjectParser( filePath @@ -98,7 +98,7 @@ QgsWFSProjectParser *QgsConfigCache::wfsConfiguration( QDomDocument* doc = xmlDocument( filePath ); if ( !doc ) { - return 0; + return nullptr; } p = new QgsWFSProjectParser( filePath @@ -129,7 +129,7 @@ QgsWMSConfigParser *QgsConfigCache::wmsConfiguration( QDomDocument* doc = xmlDocument( filePath ); if ( !doc ) { - return 0; + return nullptr; } //sld or QGIS project file? @@ -164,13 +164,13 @@ QDomDocument* QgsConfigCache::xmlDocument( const QString& filePath ) if ( !configFile.exists() ) { QgsMessageLog::logMessage( "Error, configuration file '" + filePath + "' does not exist", "Server", QgsMessageLog::CRITICAL ); - return 0; + return nullptr; } if ( !configFile.open( QIODevice::ReadOnly ) ) { QgsMessageLog::logMessage( "Error, cannot open configuration file '" + filePath + "'", "Server", QgsMessageLog::CRITICAL ); - return 0; + return nullptr; } // first get cache @@ -186,7 +186,7 @@ QDomDocument* QgsConfigCache::xmlDocument( const QString& filePath ) QgsMessageLog::logMessage( "Error parsing file '" + filePath + QString( "': parse error %1 at row %2, column %3" ).arg( errorMsg ).arg( line ).arg( column ), "Server", QgsMessageLog::CRITICAL ); delete xmlDoc; - return 0; + return nullptr; } mXmlDocumentCache.insert( filePath, xmlDoc ); mFileSystemWatcher.addPath( filePath ); diff --git a/src/server/qgsftptransaction.cpp b/src/server/qgsftptransaction.cpp index 5c507c03fea..1de1bd2c0b5 100644 --- a/src/server/qgsftptransaction.cpp +++ b/src/server/qgsftptransaction.cpp @@ -19,7 +19,7 @@ #include #include -QgsFtpTransaction::QgsFtpTransaction(): mFtp( new QFtp( 0 ) ), mRequestFinished( false ), mErrorFlag( false ) +QgsFtpTransaction::QgsFtpTransaction(): mFtp( new QFtp( nullptr ) ), mRequestFinished( false ), mErrorFlag( false ) { } diff --git a/src/server/qgshostedrdsbuilder.cpp b/src/server/qgshostedrdsbuilder.cpp index ff3072b3f14..6a3f1817611 100644 --- a/src/server/qgshostedrdsbuilder.cpp +++ b/src/server/qgshostedrdsbuilder.cpp @@ -44,19 +44,19 @@ QgsMapLayer* QgsHostedRDSBuilder::createMapLayer( const QDomElement& elem, if ( elem.isNull() ) { - return 0; + return nullptr; } QString uri = elem.attribute( "uri", "not found" ); if ( uri == "not found" ) { QgsDebugMsg( "Uri not found" ); - return 0; + return nullptr; } else { QgsDebugMsg( "Trying to get hostedrds layer from cache with uri: " + uri ); - QgsRasterLayer* rl = 0; + QgsRasterLayer* rl = nullptr; if ( allowCaching ) { rl = dynamic_cast( QgsMSLayerCache::instance()->searchLayer( uri, layerName ) ); diff --git a/src/server/qgshostedvdsbuilder.cpp b/src/server/qgshostedvdsbuilder.cpp index 07ca7b6fc6d..0c6dbe3e244 100644 --- a/src/server/qgshostedvdsbuilder.cpp +++ b/src/server/qgshostedvdsbuilder.cpp @@ -41,7 +41,7 @@ QgsMapLayer* QgsHostedVDSBuilder::createMapLayer( const QDomElement& elem, Q_UNUSED( filesToRemove ); if ( elem.isNull() ) { - return 0; + return nullptr; } QString providerType = elem.attribute( "providerType", "not found" ); @@ -50,10 +50,10 @@ QgsMapLayer* QgsHostedVDSBuilder::createMapLayer( const QDomElement& elem, if ( providerType == "not found" || uri == "not found" ) { QgsDebugMsg( "error, provider type not found" ); - return 0; + return nullptr; } - QgsMapLayer* ml = 0; + QgsMapLayer* ml = nullptr; if ( allowCaching ) //take layer from cache if allowed { @@ -70,7 +70,7 @@ QgsMapLayer* QgsHostedVDSBuilder::createMapLayer( const QDomElement& elem, { QgsDebugMsg( "error, VectorLayer is 0 or invalid" ); delete ml; - return 0; + return nullptr; } if ( allowCaching ) diff --git a/src/server/qgshttprequesthandler.cpp b/src/server/qgshttprequesthandler.cpp index d26bb872aab..c6cf0a94234 100644 --- a/src/server/qgshttprequesthandler.cpp +++ b/src/server/qgshttprequesthandler.cpp @@ -36,7 +36,7 @@ QgsHttpRequestHandler::QgsHttpRequestHandler( const bool captureOutput /*= FALSE*/ ) : QgsRequestHandler( ) { - mException = 0; + mException = nullptr; mHeadersSent = FALSE; mCaptureOutput = captureOutput; } @@ -641,9 +641,9 @@ void QgsHttpRequestHandler::requestStringToParameterMap( const QString& request, QString QgsHttpRequestHandler::readPostBody() const { QgsMessageLog::logMessage( "QgsHttpRequestHandler::readPostBody" ); - char* lengthString = 0; + char* lengthString = nullptr; int length = 0; - char* input = 0; + char* input = nullptr; QString inputString; QString lengthQString; @@ -786,7 +786,7 @@ void QgsHttpRequestHandler::imageColors( QHash& colors, const QImage& int width = image.width(); int height = image.height(); - const QRgb* currentScanLine = 0; + const QRgb* currentScanLine = nullptr; QHash::iterator colorIt; for ( int i = 0; i < height; ++i ) { diff --git a/src/server/qgsinterpolationlayerbuilder.cpp b/src/server/qgsinterpolationlayerbuilder.cpp index d0c22049833..0b61513d538 100644 --- a/src/server/qgsinterpolationlayerbuilder.cpp +++ b/src/server/qgsinterpolationlayerbuilder.cpp @@ -33,7 +33,7 @@ QgsInterpolationLayerBuilder::QgsInterpolationLayerBuilder( QgsVectorLayer* vl ) } -QgsInterpolationLayerBuilder::QgsInterpolationLayerBuilder(): mVectorLayer( 0 ) +QgsInterpolationLayerBuilder::QgsInterpolationLayerBuilder(): mVectorLayer( nullptr ) { } @@ -53,14 +53,14 @@ QgsMapLayer* QgsInterpolationLayerBuilder::createMapLayer( const QDomElement &el Q_UNUSED( allowCaching ); if ( !mVectorLayer ) { - return 0; + return nullptr; } QDomNodeList interpolationList = elem.elementsByTagName( "Interpolation" ); if ( interpolationList.size() < 1 ) { QgsDebugMsg( "No Interpolation element found" ); - return 0; + return nullptr; } QDomElement interpolationElem = interpolationList.at( 0 ).toElement(); @@ -68,7 +68,7 @@ QgsMapLayer* QgsInterpolationLayerBuilder::createMapLayer( const QDomElement &el QDomNodeList tinList = interpolationElem.elementsByTagName( "TINMethod" ); QDomNodeList idwList = interpolationElem.elementsByTagName( "IDWMethod" ); - QgsInterpolator* theInterpolator = 0; + QgsInterpolator* theInterpolator = nullptr; QList layerDataList; QgsInterpolator::LayerData currentLayerData; currentLayerData.vectorLayer = mVectorLayer; @@ -86,12 +86,12 @@ QgsMapLayer* QgsInterpolationLayerBuilder::createMapLayer( const QDomElement &el QgsVectorDataProvider* provider = mVectorLayer->dataProvider(); if ( !provider ) { - return 0; + return nullptr; } int attributeIndex = provider->fieldNameIndex( attributeName ); if ( attributeIndex == -1 ) { - return 0; //attribute field not found + return nullptr; //attribute field not found } currentLayerData.interpolationAttribute = attributeIndex; } @@ -130,7 +130,7 @@ QgsMapLayer* QgsInterpolationLayerBuilder::createMapLayer( const QDomElement &el { QgsDebugMsg( "Reading of resolution failed" ); delete theInterpolator; - return 0; + return nullptr; } } @@ -140,7 +140,7 @@ QgsMapLayer* QgsInterpolationLayerBuilder::createMapLayer( const QDomElement &el QgsDebugMsg( "Opening temporary file failed" ); delete tmpFile; delete theInterpolator; - return 0; + return nullptr; } QgsRectangle extent = mVectorLayer->extent(); @@ -148,7 +148,7 @@ QgsMapLayer* QgsInterpolationLayerBuilder::createMapLayer( const QDomElement &el if ( gridWriter.writeFile( false ) != 0 ) { QgsDebugMsg( "Interpolation of raster failed" ); - return 0; + return nullptr; } filesToRemove.push_back( tmpFile ); //store raster in temporary file and remove after request diff --git a/src/server/qgsmslayercache.cpp b/src/server/qgsmslayercache.cpp index 3c913f17e33..a36a3cc95ac 100644 --- a/src/server/qgsmslayercache.cpp +++ b/src/server/qgsmslayercache.cpp @@ -67,8 +67,8 @@ void QgsMSLayerCache::insertLayer( const QString& url, const QString& layerName, QgsMSLayerCacheEntry newEntry; newEntry.layerPointer = layer; newEntry.url = url; - newEntry.creationTime = time( NULL ); - newEntry.lastUsedTime = time( NULL ); + newEntry.creationTime = time( nullptr ); + newEntry.lastUsedTime = time( nullptr ); newEntry.temporaryFiles = tempFiles; newEntry.configFile = configFile; @@ -96,7 +96,7 @@ QgsMapLayer* QgsMSLayerCache::searchLayer( const QString& url, const QString& la if ( !mEntries.contains( urlNamePair ) ) { QgsMessageLog::logMessage( "Layer '" + layerName + "' configFile: " + configFile + " not found in layer cache'", "Server", QgsMessageLog::INFO ); - return 0; + return nullptr; } else { @@ -106,13 +106,13 @@ QgsMapLayer* QgsMSLayerCache::searchLayer( const QString& url, const QString& la { if ( configFile.isEmpty() || layerIt->configFile == configFile ) { - layerIt->lastUsedTime = time( NULL ); + layerIt->lastUsedTime = time( nullptr ); QgsMessageLog::logMessage( "Layer '" + layerName + "' configFile: " + configFile + " found in layer cache", "Server", QgsMessageLog::INFO ); return layerIt->layerPointer; } } QgsMessageLog::logMessage( "Layer '" + layerName + "' configFile: " + configFile + " not found in layer cache'", "Server", QgsMessageLog::INFO ); - return 0; + return nullptr; } } diff --git a/src/server/qgsowsserver.cpp b/src/server/qgsowsserver.cpp index 6a950457ab3..909722ba9a9 100644 --- a/src/server/qgsowsserver.cpp +++ b/src/server/qgsowsserver.cpp @@ -31,7 +31,7 @@ void QgsOWSServer::applyAccessControlLayerFilters( QgsMapLayer* mapLayer, QMapsetSubsetString( "" ) ) { QString sql = mAccessControl->extraSubsetString( layer ); - if ( sql != NULL ) + if ( sql != nullptr ) { if ( !originalLayerFilters.contains( layer->id() ) ) { diff --git a/src/server/qgsremotedatasourcebuilder.cpp b/src/server/qgsremotedatasourcebuilder.cpp index 952c89c184a..d5a0fbc3acf 100644 --- a/src/server/qgsremotedatasourcebuilder.cpp +++ b/src/server/qgsremotedatasourcebuilder.cpp @@ -36,7 +36,7 @@ QgsRemoteDataSourceBuilder::~QgsRemoteDataSourceBuilder() QgsMapLayer* QgsRemoteDataSourceBuilder::createMapLayer( const QDomElement& elem, const QString& layerName, QList& filesToRemove, QList& layersToRemove, bool allowCaching ) const { QgsDebugMsg( "entering." ); - QgsMapLayer* theLayer = 0; + QgsMapLayer* theLayer = nullptr; if ( elem.tagName() == "RemoteRDS" ) { theLayer = rasterLayerFromRemoteRDS( elem, layerName, filesToRemove, layersToRemove, allowCaching ); @@ -47,7 +47,7 @@ QgsMapLayer* QgsRemoteDataSourceBuilder::createMapLayer( const QDomElement& elem } else { - return 0; + return nullptr; } return theLayer; } @@ -66,10 +66,10 @@ QgsRasterLayer* QgsRemoteDataSourceBuilder::rasterLayerFromRemoteRDS( const QDom QByteArray fileContents; QString uri = remoteRDSElem.text(); - QgsRasterLayer* rl = 0; + QgsRasterLayer* rl = nullptr; if ( loadData( uri, fileContents ) != 0 ) { - return 0; + return nullptr; } QTemporaryFile* tmpFile = new QTemporaryFile(); @@ -82,7 +82,7 @@ QgsRasterLayer* QgsRemoteDataSourceBuilder::rasterLayerFromRemoteRDS( const QDom { QgsDebugMsg( "Error, creation of temp file failed" ); delete tmpFile; - return 0; + return nullptr; } //create rasterlayer @@ -116,11 +116,11 @@ QgsVectorLayer* QgsRemoteDataSourceBuilder::vectorLayerFromRemoteVDS( const QDom QByteArray fileContents; QString uri = remoteVDSElem.text(); - QgsVectorLayer* vl = 0; + QgsVectorLayer* vl = nullptr; if ( loadData( uri, fileContents ) != 0 ) { - return 0; + return nullptr; } //store content into temporary file @@ -133,7 +133,7 @@ QgsVectorLayer* QgsRemoteDataSourceBuilder::vectorLayerFromRemoteVDS( const QDom else { delete tmpFile; - return 0; + return nullptr; } //create vector layer diff --git a/src/server/qgsremoteowsbuilder.cpp b/src/server/qgsremoteowsbuilder.cpp index 58c0436ee8b..af34c9564b4 100644 --- a/src/server/qgsremoteowsbuilder.cpp +++ b/src/server/qgsremoteowsbuilder.cpp @@ -51,7 +51,7 @@ QgsMapLayer* QgsRemoteOWSBuilder::createMapLayer( { if ( elem.isNull() ) { - return 0; + return nullptr; } //parse service element @@ -59,7 +59,7 @@ QgsMapLayer* QgsRemoteOWSBuilder::createMapLayer( if ( serviceNode.isNull() ) { QgsDebugMsg( "No node found, returning 0" ); - return 0; //service node is necessary + return nullptr; //service node is necessary } //parse OnlineResource element @@ -67,14 +67,14 @@ QgsMapLayer* QgsRemoteOWSBuilder::createMapLayer( if ( onlineResourceNode.isNull() ) { QgsDebugMsg( "No element, returning 0" ); - return 0; + return nullptr; } //get uri QDomElement onlineResourceElement = onlineResourceNode.toElement(); QString url = onlineResourceElement.attribute( "href" ); - QgsMapLayer* result = 0; + QgsMapLayer* result = nullptr; QString serviceName = serviceNode.toElement().text(); //append missing ? or & at the end of the url, but only for WFS and WMS @@ -145,7 +145,7 @@ QgsMapLayer* QgsRemoteOWSBuilder::createMapLayer( { delete result; } - return 0; + return nullptr; } return result; @@ -154,7 +154,7 @@ QgsMapLayer* QgsRemoteOWSBuilder::createMapLayer( QgsRasterLayer* QgsRemoteOWSBuilder::wmsLayerFromUrl( const QString& url, const QString& layerName, QList& layersToRemove, bool allowCaching ) const { QgsDebugMsg( "Entering" ); - QgsRasterLayer* result = 0; + QgsRasterLayer* result = nullptr; QString baseUrl, format, crs; QStringList layerList, styleList; @@ -171,7 +171,7 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wmsLayerFromUrl( const QString& url, const QStringList urlList = url.split( "?" ); if ( urlList.size() < 2 ) { - return 0; + return nullptr; } baseUrl = urlList.at( 0 ); QStringList paramList = urlList.at( 1 ).split( "&" ); @@ -216,7 +216,7 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wmsLayerFromUrl( const QString& url, const result = new QgsRasterLayer( uri.encodedUri(), "", QString( "wms" ) ); if ( !result->isValid() ) { - return 0; + return nullptr; } //insert into cache @@ -245,7 +245,7 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wcsLayerFromUrl( const QString &url, QString fileName = createTempFile(); if ( fileName.isEmpty() ) { - return 0; + return nullptr; } QFile tempFile( fileName ); @@ -254,7 +254,7 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wcsLayerFromUrl( const QString &url, if ( !tmpFile->open() ) { delete tmpFile; - return 0; + return nullptr; } filesToRemove.push_back( tmpFile ); //make sure the temporary file gets deleted after each request @@ -266,7 +266,7 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wcsLayerFromUrl( const QString &url, if ( serverSplit.size() < 2 ) { QgsDebugMsg( "error, no '?' contained in url" ); - return 0; + return nullptr; } QString serverUrl = serverSplit.at( 0 ); QString request = serverSplit.at( 1 ); @@ -288,7 +288,7 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wcsLayerFromUrl( const QString &url, if ( coverageName.isEmpty() ) { QgsDebugMsg( "coverage name is empty" ); - return 0; + return nullptr; } if ( format.isEmpty() ) @@ -307,7 +307,7 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wcsLayerFromUrl( const QString &url, if ( crs.isEmpty() ) { QgsDebugMsg( "No CRS or SRS parameter found for wcs layer, returning 0" ); - return 0; + return nullptr; } wcsRequest += "&CRS=" + crs; @@ -316,7 +316,7 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wcsLayerFromUrl( const QString &url, if ( width.isEmpty() ) { QgsDebugMsg( "No WIDTH parameter found for wcs layer, returning 0" ); - return 0; + return nullptr; } wcsRequest += "&WIDTH=" + width; @@ -325,7 +325,7 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wcsLayerFromUrl( const QString &url, if ( height.isEmpty() ) { QgsDebugMsg( "No HEIGHT parameter found for wcs layer, returning 0" ); - return 0; + return nullptr; } wcsRequest += "&HEIGHT=" + height; @@ -334,7 +334,7 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wcsLayerFromUrl( const QString &url, if ( bbox.isEmpty() ) { QgsDebugMsg( "No BBOX parameter found for wcs layer, returning 0" ); - return 0; + return nullptr; } wcsRequest += "&BBOX=" + bbox; @@ -345,7 +345,7 @@ QgsRasterLayer* QgsRemoteOWSBuilder::wcsLayerFromUrl( const QString &url, QByteArray result; if ( !httpTransaction.getSynchronously( result ) ) { - return 0; + return nullptr; } QDataStream tempFileStream( &tempFile ); @@ -367,7 +367,7 @@ QgsVectorLayer* QgsRemoteOWSBuilder::sosLayer( const QDomElement& remoteOWSElem, QDomElement parentElem = remoteOWSElem.parentNode().toElement(); if ( parentElem.isNull() ) { - return 0; + return nullptr; } @@ -390,7 +390,7 @@ QgsVectorLayer* QgsRemoteOWSBuilder::sosLayer( const QDomElement& remoteOWSElem, if ( requestRootElem.isNull() ) { - return 0; + return nullptr; } QDomDocument requestDoc; @@ -400,7 +400,7 @@ QgsVectorLayer* QgsRemoteOWSBuilder::sosLayer( const QDomElement& remoteOWSElem, QString providerUrl = "url=" + url + " method=" + method + " xml=" + requestDoc.toString(); //check if layer is already in cache - QgsVectorLayer* sosLayer = 0; + QgsVectorLayer* sosLayer = nullptr; if ( allowCaching ) { sosLayer = dynamic_cast( QgsMSLayerCache::instance()->searchLayer( providerUrl, layerName ) ); @@ -415,7 +415,7 @@ QgsVectorLayer* QgsRemoteOWSBuilder::sosLayer( const QDomElement& remoteOWSElem, if ( !sosLayer->isValid() ) { delete sosLayer; - return 0; + return nullptr; } else { diff --git a/src/server/qgsrequesthandler.h b/src/server/qgsrequesthandler.h index 8ac02a235cb..6946f16c5d9 100644 --- a/src/server/qgsrequesthandler.h +++ b/src/server/qgsrequesthandler.h @@ -52,7 +52,7 @@ class QgsRequestHandler QgsRequestHandler( ) : mHeadersSent( false ) - , mException( 0 ) + , mException( nullptr ) {} virtual ~QgsRequestHandler( ) {} /** Parses the input and creates a request neutral Parameter/Value map*/ diff --git a/src/server/qgssentdatasourcebuilder.cpp b/src/server/qgssentdatasourcebuilder.cpp index d2d81b56a8f..4bdd4c8e1bc 100644 --- a/src/server/qgssentdatasourcebuilder.cpp +++ b/src/server/qgssentdatasourcebuilder.cpp @@ -50,7 +50,7 @@ QgsMapLayer* QgsSentDataSourceBuilder::createMapLayer( const QDomElement& elem, { return vectorLayerFromSentVDS( elem, filesToRemove, layersToRemove ); } - return 0; + return nullptr; } QgsVectorLayer* QgsSentDataSourceBuilder::vectorLayerFromSentVDS( const QDomElement& sentVDSElem, QList& filesToRemove, QList& layersToRemove ) const @@ -67,14 +67,14 @@ QgsVectorLayer* QgsSentDataSourceBuilder::vectorLayerFromSentVDS( const QDomElem } else { - return 0; + return nullptr; } QgsVectorLayer* theVectorLayer = new QgsVectorLayer( tmpFile->fileName(), layerNameFromUri( tmpFile->fileName() ), "WFS" ); if ( !theVectorLayer || !theVectorLayer->isValid() ) { QgsDebugMsg( "invalid maplayer" ); - return 0; + return nullptr; } QgsDebugMsg( "returning maplayer" ); @@ -82,11 +82,11 @@ QgsVectorLayer* QgsSentDataSourceBuilder::vectorLayerFromSentVDS( const QDomElem if ( !theVectorLayer || !theVectorLayer->isValid() ) { - return 0; + return nullptr; } return theVectorLayer; } - return 0; + return nullptr; } QgsRasterLayer* QgsSentDataSourceBuilder::rasterLayerFromSentRDS( const QDomElement& sentRDSElem, QList& filesToRemove, QList& layersToRemove ) const @@ -95,7 +95,7 @@ QgsRasterLayer* QgsSentDataSourceBuilder::rasterLayerFromSentRDS( const QDomElem QString tempFilePath = createTempFile(); if ( tempFilePath.isEmpty() ) { - return 0; + return nullptr; } QFile tempFile( tempFilePath ); @@ -114,7 +114,7 @@ QgsRasterLayer* QgsSentDataSourceBuilder::rasterLayerFromSentRDS( const QDomElem else { delete tmpFile; - return 0; + return nullptr; } } @@ -128,7 +128,7 @@ QgsRasterLayer* QgsSentDataSourceBuilder::rasterLayerFromSentRDS( const QDomElem else { delete tmpFile; - return 0; + return nullptr; } } diff --git a/src/server/qgsserver.cpp b/src/server/qgsserver.cpp index 37052313c5b..43029ff787f 100644 --- a/src/server/qgsserver.cpp +++ b/src/server/qgsserver.cpp @@ -55,19 +55,19 @@ // Static initialisers, default values for fcgi server -QgsApplication* QgsServer::mQgsApplication = NULL; +QgsApplication* QgsServer::mQgsApplication = nullptr; bool QgsServer::mInitialised = false; QString QgsServer::mServerName( "qgis_server" ); bool QgsServer::mCaptureOutput = false; char* QgsServer::mArgv[1]; int QgsServer::mArgc = 1; QString QgsServer::mConfigFilePath; -QgsMapRenderer* QgsServer::mMapRenderer = NULL; +QgsMapRenderer* QgsServer::mMapRenderer = nullptr; QgsCapabilitiesCache* QgsServer::mCapabilitiesCache; #ifdef HAVE_SERVER_PYTHON_PLUGINS bool QgsServer::mInitPython = true; -QgsServerInterfaceImpl* QgsServer::mServerInterface = NULL; +QgsServerInterfaceImpl* QgsServer::mServerInterface = nullptr; #endif @@ -94,7 +94,7 @@ void QgsServer::setupNetworkAccessManager() { QSettings settings; QgsNetworkAccessManager *nam = QgsNetworkAccessManager::instance(); - QNetworkDiskCache *cache = new QNetworkDiskCache( 0 ); + QNetworkDiskCache *cache = new QNetworkDiskCache( nullptr ); QString cacheDirectory = settings.value( "cache/directory", QgsApplication::qgisSettingsDirPath() + "cache" ).toString(); qint64 cacheSize = settings.value( "cache/size", 50 * 1024 * 1024 ).toULongLong(); QgsMessageLog::logMessage( QString( "setCacheDirectory: %1" ).arg( cacheDirectory ), "Server", QgsMessageLog::INFO ); @@ -113,9 +113,9 @@ void QgsServer::setupNetworkAccessManager() */ QgsRequestHandler* QgsServer::createRequestHandler( const bool captureOutput /*= false*/ ) { - QgsRequestHandler* requestHandler = 0; + QgsRequestHandler* requestHandler = nullptr; char* requestMethod = getenv( "REQUEST_METHOD" ); - if ( requestMethod != NULL ) + if ( requestMethod != nullptr ) { if ( strcmp( requestMethod, "POST" ) == 0 ) { @@ -181,43 +181,43 @@ void QgsServer::printRequestParameters( const QMap< QString, QString>& parameter void QgsServer::printRequestInfos() { QgsMessageLog::logMessage( "********************new request***************", "Server", QgsMessageLog::INFO ); - if ( getenv( "REMOTE_ADDR" ) != NULL ) + if ( getenv( "REMOTE_ADDR" ) != nullptr ) { QgsMessageLog::logMessage( "remote ip: " + QString( getenv( "REMOTE_ADDR" ) ), "Server", QgsMessageLog::INFO ); } - if ( getenv( "REMOTE_HOST" ) != NULL ) + if ( getenv( "REMOTE_HOST" ) != nullptr ) { QgsMessageLog::logMessage( "remote ip: " + QString( getenv( "REMOTE_HOST" ) ), "Server", QgsMessageLog::INFO ); } - if ( getenv( "REMOTE_USER" ) != NULL ) + if ( getenv( "REMOTE_USER" ) != nullptr ) { QgsMessageLog::logMessage( "remote user: " + QString( getenv( "REMOTE_USER" ) ), "Server", QgsMessageLog::INFO ); } - if ( getenv( "REMOTE_IDENT" ) != NULL ) + if ( getenv( "REMOTE_IDENT" ) != nullptr ) { QgsMessageLog::logMessage( "REMOTE_IDENT: " + QString( getenv( "REMOTE_IDENT" ) ), "Server", QgsMessageLog::INFO ); } - if ( getenv( "CONTENT_TYPE" ) != NULL ) + if ( getenv( "CONTENT_TYPE" ) != nullptr ) { QgsMessageLog::logMessage( "CONTENT_TYPE: " + QString( getenv( "CONTENT_TYPE" ) ), "Server", QgsMessageLog::INFO ); } - if ( getenv( "AUTH_TYPE" ) != NULL ) + if ( getenv( "AUTH_TYPE" ) != nullptr ) { QgsMessageLog::logMessage( "AUTH_TYPE: " + QString( getenv( "AUTH_TYPE" ) ), "Server", QgsMessageLog::INFO ); } - if ( getenv( "HTTP_USER_AGENT" ) != NULL ) + if ( getenv( "HTTP_USER_AGENT" ) != nullptr ) { QgsMessageLog::logMessage( "HTTP_USER_AGENT: " + QString( getenv( "HTTP_USER_AGENT" ) ), "Server", QgsMessageLog::INFO ); } - if ( getenv( "HTTP_PROXY" ) != NULL ) + if ( getenv( "HTTP_PROXY" ) != nullptr ) { QgsMessageLog::logMessage( "HTTP_PROXY: " + QString( getenv( "HTTP_PROXY" ) ), "Server", QgsMessageLog::INFO ); } - if ( getenv( "HTTPS_PROXY" ) != NULL ) + if ( getenv( "HTTPS_PROXY" ) != nullptr ) { QgsMessageLog::logMessage( "HTTPS_PROXY: " + QString( getenv( "HTTPS_PROXY" ) ), "Server", QgsMessageLog::INFO ); } - if ( getenv( "NO_PROXY" ) != NULL ) + if ( getenv( "NO_PROXY" ) != nullptr ) { QgsMessageLog::logMessage( "NO_PROXY: " + QString( getenv( "NO_PROXY" ) ), "Server", QgsMessageLog::INFO ); } @@ -492,7 +492,7 @@ QPair QgsServer::handleRequest( const QString& queryStri // Copy the parameters map QMap parameterMap( theRequestHandler->parameterMap() ); #ifdef HAVE_SERVER_PYTHON_PLUGINS - const QgsAccessControl* accessControl = NULL; + const QgsAccessControl* accessControl = nullptr; accessControl = mServerInterface->accessControls(); #endif diff --git a/src/server/qgsserverinterfaceimpl.cpp b/src/server/qgsserverinterfaceimpl.cpp index 08979cca142..ff78bb9ba58 100644 --- a/src/server/qgsserverinterfaceimpl.cpp +++ b/src/server/qgsserverinterfaceimpl.cpp @@ -24,7 +24,7 @@ QgsServerInterfaceImpl::QgsServerInterfaceImpl( QgsCapabilitiesCache* capCache ) : mCapabilitiesCache( capCache ) { - mRequestHandler = NULL; + mRequestHandler = nullptr; mAccessControls = new QgsAccessControl(); } @@ -44,7 +44,7 @@ QgsServerInterfaceImpl::~QgsServerInterfaceImpl() void QgsServerInterfaceImpl::clearRequestHandler( ) { - mRequestHandler = NULL; + mRequestHandler = nullptr; } void QgsServerInterfaceImpl::setRequestHandler( QgsRequestHandler * requestHandler ) diff --git a/src/server/qgsserverlogger.cpp b/src/server/qgsserverlogger.cpp index 796320c015c..b2f67316a2c 100644 --- a/src/server/qgsserverlogger.cpp +++ b/src/server/qgsserverlogger.cpp @@ -23,18 +23,18 @@ #include -QgsServerLogger* QgsServerLogger::mInstance = 0; +QgsServerLogger* QgsServerLogger::mInstance = nullptr; QgsServerLogger* QgsServerLogger::instance() { - if ( mInstance == 0 ) + if ( mInstance == nullptr ) { mInstance = new QgsServerLogger(); } return mInstance; } -QgsServerLogger::QgsServerLogger(): mLogFile( 0 ) +QgsServerLogger::QgsServerLogger(): mLogFile( nullptr ) { //logfile QString filePath = getenv( "QGIS_SERVER_LOG_FILE" ); diff --git a/src/server/qgsserverprojectparser.cpp b/src/server/qgsserverprojectparser.cpp index bdb69928d24..d69dcbfd852 100644 --- a/src/server/qgsserverprojectparser.cpp +++ b/src/server/qgsserverprojectparser.cpp @@ -86,7 +86,7 @@ QgsServerProjectParser::QgsServerProjectParser( QDomDocument* xmlDoc, const QStr } QgsServerProjectParser::QgsServerProjectParser() - : mXMLDoc( 0 ) + : mXMLDoc( nullptr ) , mUseLayerIDs( false ) { } @@ -167,7 +167,7 @@ QgsMapLayer* QgsServerProjectParser::createLayerFromElement( const QDomElement& { if ( elem.isNull() || !mXMLDoc ) { - return 0; + return nullptr; } addJoinLayersForElement( elem ); @@ -227,7 +227,7 @@ QgsMapLayer* QgsServerProjectParser::createLayerFromElement( const QDomElement& } QString id = layerId( elem ); - QgsMapLayer* layer = 0; + QgsMapLayer* layer = nullptr; if ( useCache ) { layer = QgsMSLayerCache::instance()->searchLayer( absoluteUri, id, mProjectPath ); @@ -258,7 +258,7 @@ QgsMapLayer* QgsServerProjectParser::createLayerFromElement( const QDomElement& QgsServerProjectParser* otherConfig = QgsConfigCache::instance()->serverConfiguration( project ); if ( !otherConfig ) { - return 0; + return nullptr; } return otherConfig->mapLayerFromLayerId( elem.attribute( "id" ), useCache ); } @@ -299,7 +299,7 @@ QgsMapLayer* QgsServerProjectParser::mapLayerFromLayerId( const QString& lId, bo { return createLayerFromElement( layerIt.value(), useCache ); } - return 0; + return nullptr; } QString QgsServerProjectParser::layerIdFromLegendLayer( const QDomElement& legendLayer ) const @@ -1204,7 +1204,7 @@ QStringList QgsServerProjectParser::wfsLayerNames() const QMap layerMap; projectLayerMap( layerMap ); - QgsMapLayer* currentLayer = 0; + QgsMapLayer* currentLayer = nullptr; QStringList wfsIdList = wfsLayers(); QStringList::const_iterator wfsIdIt = wfsIdList.constBegin(); for ( ; wfsIdIt != wfsIdList.constEnd(); ++wfsIdIt ) @@ -1230,7 +1230,7 @@ QStringList QgsServerProjectParser::wcsLayerNames() const QMap layerMap; projectLayerMap( layerMap ); - QgsMapLayer* currentLayer = 0; + QgsMapLayer* currentLayer = nullptr; QStringList wcsIdList = wcsLayers(); QStringList::const_iterator wcsIdIt = wcsIdList.constBegin(); for ( ; wcsIdIt != wcsIdList.constEnd(); ++wcsIdIt ) @@ -1465,7 +1465,7 @@ void QgsServerProjectParser::addGetFeatureLayers( const QDomElement& layerElem ) while (( idx = rx.indexIn( str, idx ) ) != -1 ) { QString name = rx.cap( 1 ); - QgsMapLayer* ml = 0; + QgsMapLayer* ml = nullptr; QHash< QString, QDomElement >::const_iterator layerElemIt = mProjectLayerElementsById.find( name ); if ( layerElemIt != mProjectLayerElementsById.constEnd() ) { diff --git a/src/server/qgsserverstreamingdevice.cpp b/src/server/qgsserverstreamingdevice.cpp index 7cfc71d5360..8977927d062 100644 --- a/src/server/qgsserverstreamingdevice.cpp +++ b/src/server/qgsserverstreamingdevice.cpp @@ -20,7 +20,7 @@ QgsServerStreamingDevice::QgsServerStreamingDevice( const QString& formatName, Q { } -QgsServerStreamingDevice::QgsServerStreamingDevice(): QIODevice( 0 ), mRequestHandler( 0 ) +QgsServerStreamingDevice::QgsServerStreamingDevice(): QIODevice( nullptr ), mRequestHandler( nullptr ) { } diff --git a/src/server/qgsserverstreamingdevice.h b/src/server/qgsserverstreamingdevice.h index a6fb1a4183b..b7c46ca4529 100644 --- a/src/server/qgsserverstreamingdevice.h +++ b/src/server/qgsserverstreamingdevice.h @@ -25,7 +25,7 @@ class QgsServerStreamingDevice: public QIODevice Q_OBJECT public: - QgsServerStreamingDevice( const QString& formatName, QgsRequestHandler* rh, QObject* parent = 0 ); + QgsServerStreamingDevice( const QString& formatName, QgsRequestHandler* rh, QObject* parent = nullptr ); ~QgsServerStreamingDevice(); bool isSequential() const override { return false; } diff --git a/src/server/qgssldconfigparser.cpp b/src/server/qgssldconfigparser.cpp index 158078a6a3c..ba08c03f0fe 100644 --- a/src/server/qgssldconfigparser.cpp +++ b/src/server/qgssldconfigparser.cpp @@ -62,7 +62,7 @@ QgsSLDConfigParser::QgsSLDConfigParser( QDomDocument* doc, const QMap QgsSLDConfigParser::mapLayerFromStyle( const QString& lName, return resultList; } - QgsFeatureRendererV2* theRenderer = 0; + QgsFeatureRendererV2* theRenderer = nullptr; QgsRasterLayer* theRasterLayer = dynamic_cast( theMapLayer ); if ( theRasterLayer ) @@ -714,7 +714,7 @@ QgsComposition* QgsSLDConfigParser::createPrintComposition( const QString& compo { return mFallbackParser->createPrintComposition( composerTemplate, mapRenderer, parameterMap ); } - return 0; + return nullptr; } QgsComposition* QgsSLDConfigParser::initComposition( const QString& composerTemplate, QgsMapRenderer* mapRenderer, QList< QgsComposerMap*>& mapList, QList< QgsComposerLegend* >& legendList, QList< QgsComposerLabel* >& labelList, QList& htmlFrameList ) const @@ -723,7 +723,7 @@ QgsComposition* QgsSLDConfigParser::initComposition( const QString& composerTemp { return mFallbackParser->initComposition( composerTemplate, mapRenderer, mapList, legendList, labelList, htmlFrameList ); } - return 0; + return nullptr; } void QgsSLDConfigParser::printCapabilities( QDomElement& parentElement, QDomDocument& doc ) const @@ -846,7 +846,7 @@ QgsFeatureRendererV2* QgsSLDConfigParser::rendererFromUserStyle( const QDomEleme { if ( !vec || userStyleElement.isNull() ) { - return 0; + return nullptr; } QgsDebugMsg( "Entering" ); @@ -1320,20 +1320,20 @@ QgsVectorLayer* QgsSLDConfigParser::contourLayerFromRaster( const QDomElement& u if ( !rasterLayer ) { - return 0; + return nullptr; } //get element QDomNodeList contourNodeList = userStyleElem.elementsByTagName( "ContourSymbolizer" ); if ( contourNodeList.size() < 1 ) { - return 0; + return nullptr; } QDomElement contourSymbolizerElem = contourNodeList.item( 0 ).toElement(); if ( contourSymbolizerElem.isNull() ) { - return 0; + return nullptr; } double equidistance, minValue, maxValue, offset; @@ -1347,7 +1347,7 @@ QgsVectorLayer* QgsSLDConfigParser::contourLayerFromRaster( const QDomElement& u if ( equidistance <= 0.0 ) { - return 0; + return nullptr; } QTemporaryFile* tmpFile1 = new QTemporaryFile(); @@ -1399,14 +1399,14 @@ QgsVectorLayer* QgsSLDConfigParser::contourLayerFromRaster( const QDomElement& u int /* b3D = FALSE, */ bNoDataSet = FALSE, bIgnoreNoData = FALSE; hSrcDS = GDALOpen( TO8( rasterLayer->source() ), GA_ReadOnly ); - if ( hSrcDS == NULL ) + if ( hSrcDS == nullptr ) { delete [] adfFixedLevels; throw QgsMapServiceException( "LayerNotDefined", "Operation request is for a file not available on the server." ); } hBand = GDALGetRasterBand( hSrcDS, nBandIn ); - if ( hBand == NULL ) + if ( hBand == nullptr ) { CPLError( CE_Failure, CPLE_AppDefined, "Band %d does not exist on dataset.", @@ -1419,11 +1419,11 @@ QgsVectorLayer* QgsSLDConfigParser::contourLayerFromRaster( const QDomElement& u /* -------------------------------------------------------------------- */ /* Try to get a coordinate system from the raster. */ /* -------------------------------------------------------------------- */ - OGRSpatialReferenceH hSRS = NULL; + OGRSpatialReferenceH hSRS = nullptr; const char *pszWKT = GDALGetProjectionRef( hBand ); - if ( pszWKT != NULL && strlen( pszWKT ) != 0 ) + if ( pszWKT != nullptr && strlen( pszWKT ) != 0 ) hSRS = OSRNewSpatialReference( pszWKT ); /* -------------------------------------------------------------------- */ @@ -1435,15 +1435,15 @@ QgsVectorLayer* QgsSLDConfigParser::contourLayerFromRaster( const QDomElement& u OGRLayerH hLayer; int nElevField = -1; - if ( hDriver == NULL ) + if ( hDriver == nullptr ) { //fprintf( FCGI_stderr, "Unable to find format driver named 'ESRI Shapefile'.\n" ); delete [] adfFixedLevels; throw QgsMapServiceException( "LayerNotDefined", "Operation request is for a file not available on the server." ); } - hDS = OGR_Dr_CreateDataSource( hDriver, TO8( tmpFileName ), NULL ); - if ( hDS == NULL ) + hDS = OGR_Dr_CreateDataSource( hDriver, TO8( tmpFileName ), nullptr ); + if ( hDS == nullptr ) { delete [] adfFixedLevels; throw QgsMapServiceException( "LayerNotDefined", "Operation request cannot create data source." ); @@ -1451,8 +1451,8 @@ QgsVectorLayer* QgsSLDConfigParser::contourLayerFromRaster( const QDomElement& u hLayer = OGR_DS_CreateLayer( hDS, "contour", hSRS, /* b3D ? wkbLineString25D : */ wkbLineString, - NULL ); - if ( hLayer == NULL ) + nullptr ); + if ( hLayer == nullptr ) { delete [] adfFixedLevels; throw QgsMapServiceException( "LayerNotDefined", "Operation request could not create contour file." ); @@ -1480,7 +1480,7 @@ QgsVectorLayer* QgsSLDConfigParser::contourLayerFromRaster( const QDomElement& u nFixedLevelCount, adfFixedLevels, bNoDataSet, dfNoData, hLayer, 0, nElevField, - GDALTermProgress, NULL ); + GDALTermProgress, nullptr ); delete [] adfFixedLevels; @@ -1534,7 +1534,7 @@ QDomElement QgsSLDConfigParser::findUserLayerElement( const QString& layerName ) QgsMapLayer* QgsSLDConfigParser::mapLayerFromUserLayer( const QDomElement& userLayerElem, const QString& layerName, bool allowCaching ) const { QgsDebugMsg( "Entering." ); - QgsMSLayerBuilder* layerBuilder = 0; + QgsMSLayerBuilder* layerBuilder = nullptr; QDomElement builderRootElement; //hosted vector data? @@ -1595,7 +1595,7 @@ QgsMapLayer* QgsSLDConfigParser::mapLayerFromUserLayer( const QDomElement& userL if ( !layerBuilder ) { - return 0; + return nullptr; } QgsMapLayer* theMapLayer = layerBuilder->createMapLayer( builderRootElement, layerName, mFilesToRemove, mLayersToRemove, allowCaching ); diff --git a/src/server/qgssoaprequesthandler.cpp b/src/server/qgssoaprequesthandler.cpp index 6ea24d0bd82..c7c2c64edff 100644 --- a/src/server/qgssoaprequesthandler.cpp +++ b/src/server/qgssoaprequesthandler.cpp @@ -738,7 +738,7 @@ int QgsSOAPRequestHandler::setUrlToFile( QImage* img ) //create a random folder under /tmp with map.jpg/png in it //and return the link to the client - srand( time( NULL ) ); + srand( time( nullptr ) ); int randomNumber = rand(); QString folderName = QString::number( randomNumber ); if ( !QFile::exists( tmpDir.absolutePath() + "/mas_tmp" ) ) diff --git a/src/server/qgswcsserver.cpp b/src/server/qgswcsserver.cpp index 112a1bb6072..0de1cebb350 100644 --- a/src/server/qgswcsserver.cpp +++ b/src/server/qgswcsserver.cpp @@ -65,12 +65,12 @@ QgsWCSServer::QgsWCSServer() : QgsOWSServer( QString() , QMap() - , 0 + , nullptr #ifdef HAVE_SERVER_PYTHON_PLUGINS - , NULL + , nullptr #endif ) - , mConfigParser( 0 ) + , mConfigParser( nullptr ) { } @@ -434,13 +434,13 @@ QByteArray* QgsWCSServer::getCoverage() throw QgsMapServiceException( "RequestNotWellFormed", mErrors.join( ". " ) ); } delete pipe; - QByteArray* ba = 0; + QByteArray* ba = nullptr; ba = new QByteArray(); *ba = tempFile.readAll(); return ba; } - return 0; + return nullptr; } QString QgsWCSServer::serviceUrl() const diff --git a/src/server/qgswfsserver.cpp b/src/server/qgswfsserver.cpp index 50de0329307..4455eec19ce 100644 --- a/src/server/qgswfsserver.cpp +++ b/src/server/qgswfsserver.cpp @@ -91,13 +91,13 @@ QgsWFSServer::QgsWFSServer() : QgsOWSServer( QString() , QMap() - , 0 + , nullptr #ifdef HAVE_SERVER_PYTHON_PLUGINS - , NULL + , nullptr #endif ) , mWithGeom( true ) - , mConfigParser( 0 ) + , mConfigParser( nullptr ) { } @@ -402,7 +402,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format QStringList wfsLayersId = mConfigParser->wfsLayers(); QList layerList; - QgsMapLayer* currentLayer = 0; + QgsMapLayer* currentLayer = nullptr; QgsCoordinateReferenceSystem layerCrs; QgsRectangle searchRect( 0, 0, 0, 0 ); @@ -1461,7 +1461,7 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody ) QStringList wfsLayersId = mConfigParser ? mConfigParser->wfsLayers() : QStringList(); QList layerList; - QgsMapLayer* currentLayer = 0; + QgsMapLayer* currentLayer = nullptr; // Loop through the layer transaction elements docChildNodes = mDocElem.childNodes(); diff --git a/src/server/qgswmsconfigparser.cpp b/src/server/qgswmsconfigparser.cpp index dd16b2c1f54..7f91c019717 100644 --- a/src/server/qgswmsconfigparser.cpp +++ b/src/server/qgswmsconfigparser.cpp @@ -50,7 +50,7 @@ QgsComposition* QgsWMSConfigParser::createPrintComposition( const QString& compo QgsComposition* c = initComposition( composerTemplate, mapRenderer, composerMaps, composerLegends, composerLabels, composerHtmls ); if ( !c ) { - return 0; + return nullptr; } QString dpi = parameterMap.value( "DPI" ); diff --git a/src/server/qgswmsprojectparser.cpp b/src/server/qgswmsprojectparser.cpp index 0041553e3a1..2d1c91e280e 100644 --- a/src/server/qgswmsprojectparser.cpp +++ b/src/server/qgswmsprojectparser.cpp @@ -427,14 +427,14 @@ QgsComposition* QgsWMSProjectParser::initComposition( const QString& composerTem QDomElement compositionElem = composerElem.firstChildElement( "Composition" ); if ( compositionElem.isNull() ) { - return 0; + return nullptr; } QgsComposition* composition = new QgsComposition( mapRenderer->mapSettings() ); //set resolution, paper size from composer element attributes if ( !composition->readXML( compositionElem, *( mProjectParser->xmlDocument() ) ) ) { delete composition; - return 0; + return nullptr; } composition->addItemsFromXML( compositionElem, *( mProjectParser->xmlDocument() ) ); @@ -2065,18 +2065,18 @@ QgsLayerTreeGroup* QgsWMSProjectParser::projectLayerTreeGroup() const const QDomDocument* projectDoc = mProjectParser->xmlDocument(); if ( !projectDoc ) { - return 0; + return nullptr; } QDomElement qgisElem = projectDoc->documentElement(); if ( qgisElem.isNull() ) { - return 0; + return nullptr; } QDomElement layerTreeElem = qgisElem.firstChildElement( "layer-tree-group" ); if ( layerTreeElem.isNull() ) { - return 0; + return nullptr; } return QgsLayerTreeGroup::readXML( layerTreeElem ); } diff --git a/src/server/qgswmsserver.cpp b/src/server/qgswmsserver.cpp index 5fce2f55653..e8bd00b2d47 100644 --- a/src/server/qgswmsserver.cpp +++ b/src/server/qgswmsserver.cpp @@ -101,14 +101,14 @@ QgsWMSServer::QgsWMSServer() : QgsOWSServer( QString() , QMap() - , 0 + , nullptr #ifdef HAVE_SERVER_PYTHON_PLUGINS - , NULL + , nullptr #endif ) - , mMapRenderer( 0 ) + , mMapRenderer( nullptr ) , mCapabilitiesCache() - , mConfigParser( 0 ) + , mConfigParser( nullptr ) , mOwnsConfigParser( false ) , mDrawLegendLayerLabel( true ) , mDrawLegendItemLabel( true ) @@ -124,7 +124,7 @@ void QgsWMSServer::cleanupAfterRequest() if ( mOwnsConfigParser ) { delete mConfigParser; - mConfigParser = 0; + mConfigParser = nullptr; mOwnsConfigParser = false; } } @@ -222,7 +222,7 @@ void QgsWMSServer::executeRequest() } } - QImage* result = 0; + QImage* result = nullptr; try { result = getMap(); @@ -344,7 +344,7 @@ void QgsWMSServer::executeRequest() request.compare( "GetLegendGraphics", Qt::CaseInsensitive ) == 0 ) // GetLegendGraphics for compatibility with earlier QGIS versions { - QImage* result = 0; + QImage* result = nullptr; try { result = getLegendGraphics(); @@ -372,7 +372,7 @@ void QgsWMSServer::executeRequest() //GetPrint else if ( request.compare( "GetPrint", Qt::CaseInsensitive ) == 0 ) { - QByteArray* printOutput = 0; + QByteArray* printOutput = nullptr; try { printOutput = getPrint( mRequestHandler->format() ); @@ -655,7 +655,7 @@ static QgsLayerTreeModelLegendNode* _findLegendNodeForRule( QgsLayerTreeModel* l return legendNode; } } - return 0; + return nullptr; } @@ -686,7 +686,7 @@ QImage* QgsWMSServer::getLegendGraphics() { if ( !mConfigParser || !mMapRenderer ) { - return 0; + return nullptr; } if ( !mParameters.contains( "LAYER" ) && !mParameters.contains( "LAYERS" ) ) { @@ -718,12 +718,12 @@ QImage* QgsWMSServer::getLegendGraphics() if ( readLayersAndStyles( layersList, stylesList ) != 0 ) { QgsMessageLog::logMessage( "error reading layers and styles" ); - return 0; + return nullptr; } if ( layersList.size() < 1 ) { - return 0; + return nullptr; } //scale @@ -743,7 +743,7 @@ QImage* QgsWMSServer::getLegendGraphics() QStringList layerIds = layerSet( layersList, stylesList, dummyCRS, scaleDenominator ); if ( layerIds.size() < 1 ) { - return 0; + return nullptr; } //get icon size, spaces between legend items and font from config parser @@ -853,7 +853,7 @@ QImage* QgsWMSServer::getLegendGraphics() // find out DPI QImage* tmpImage = createImage( 1, 1 ); if ( !tmpImage ) - return 0; + return nullptr; qreal dpmm = tmpImage->dotsPerMeterX() / 1000.0; delete tmpImage; @@ -1231,7 +1231,7 @@ QByteArray* QgsWMSServer::getPrint( const QString& formatString ) QImage* theImage = initializeRendering( layersList, stylesList, layerIdList ); if ( !theImage ) { - return 0; + return nullptr; } delete theImage; @@ -1270,10 +1270,10 @@ QByteArray* QgsWMSServer::getPrint( const QString& formatString ) { restoreLayerFilters( originalLayerFilters ); clearFeatureSelections( selectedLayerIdList ); - return 0; + return nullptr; } - QByteArray* ba = 0; + QByteArray* ba = nullptr; c->setPlotStyle( QgsComposition::Print ); //SVG export without a running X-Server is a problem. See e.g. http://developer.qt.nokia.com/forums/viewthread/2038 @@ -1319,7 +1319,7 @@ QByteArray* QgsWMSServer::getPrint( const QString& formatString ) delete c; restoreLayerFilters( originalLayerFilters ); clearFeatureSelections( selectedLayerIdList ); - return 0; + return nullptr; } c->exportAsPDF( tempFile.fileName() ); @@ -1581,7 +1581,7 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result, const QString& version ) //Normally, I/J or X/Y are mandatory parameters. //However, in order to make attribute only queries via the FILTER parameter, it is allowed to skip them if the FILTER parameter is there - QgsRectangle* featuresRect = 0; + QgsRectangle* featuresRect = nullptr; QScopedPointer infoPoint; if ( i == -1 || j == -1 ) @@ -1658,7 +1658,7 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result, const QString& version ) renderContext.setMapToPixel( *( mMapRenderer->coordinateTransform() ) ); renderContext.setRendererScale( mMapRenderer->scale() ); renderContext.setScaleFactor( mMapRenderer->outputDpi() / 25.4 ); - renderContext.setPainter( 0 ); + renderContext.setPainter( nullptr ); } bool sia2045 = mConfigParser->featureInfoFormatSIA2045(); @@ -1667,7 +1667,7 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result, const QString& version ) QHash layerAliasMap = mConfigParser->featureInfoLayerAliasMap(); QList layerList; - QgsMapLayer* currentLayer = 0; + QgsMapLayer* currentLayer = nullptr; QStringList::const_iterator layerIt; for ( layerIt = queryLayerList.constBegin(); layerIt != queryLayerList.constEnd(); ++layerIt ) { @@ -1817,24 +1817,24 @@ QImage* QgsWMSServer::initializeRendering( QStringList& layersList, QStringList& if ( !mConfigParser ) { QgsMessageLog::logMessage( "Error: mSLDParser is 0" ); - return 0; + return nullptr; } if ( !mMapRenderer ) { QgsMessageLog::logMessage( "Error: mMapRenderer is 0" ); - return 0; + return nullptr; } if ( readLayersAndStyles( layersList, stylesList ) != 0 ) { QgsMessageLog::logMessage( "error reading layers and styles" ); - return 0; + return nullptr; } if ( initializeSLDParser( layersList, stylesList ) != 0 ) { - return 0; + return nullptr; } //pass external GML to the SLD parser. QString gml = mParameters.value( "GML" ); @@ -1857,13 +1857,13 @@ QImage* QgsWMSServer::initializeRendering( QStringList& layersList, QStringList& QImage* theImage = createImage(); if ( !theImage ) { - return 0; + return nullptr; } if ( configureMapRender( theImage ) != 0 ) { delete theImage; - return 0; + return nullptr; } //find out the current scale denominater and set it to the SLD parser @@ -1905,10 +1905,10 @@ QImage* QgsWMSServer::createImage( int width, int height ) const if ( width < 0 || height < 0 ) { - return 0; + return nullptr; } - QImage* theImage = 0; + QImage* theImage = nullptr; //is format jpeg? QString format = mParameters.value( "FORMAT" ); @@ -1933,7 +1933,7 @@ QImage* QgsWMSServer::createImage( int width, int height ) const if ( !theImage ) { - return 0; + return nullptr; } //apply DPI parameter if present. This is an extension of Qgis Mapserver compared to WMS 1.3. @@ -2159,7 +2159,7 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer, mAccessControl->filterFeatures( layer, fReq ); if ( ! searchRect.isEmpty() ) { - if ( fReq.filterExpression() != NULL ) + if ( fReq.filterExpression() != nullptr ) { fReq.setFilterExpression( QString( "intersects( $geometry , geomFromWKT( '%1' ) ) AND ( %2 )" ). arg( searchRect.asWktPolygon() ).arg( fReq.filterExpression()->expression() ) ); @@ -2390,7 +2390,7 @@ int QgsWMSServer::featureInfoFromRasterLayer( QgsRasterLayer* layer, int version = infoFormat.startsWith( "application/vnd.ogc.gml/3" ) ? 3 : 2; QString typeName = mConfigParser && mConfigParser->useLayerIDs() ? layer->id() : layer->name(); QDomElement elem = createFeatureGML( - &feature, 0, infoDocument, layerCrs, typeName, false, version, NULL ); + &feature, nullptr, infoDocument, layerCrs, typeName, false, version, nullptr ); layerElement.appendChild( elem ); } else @@ -2414,7 +2414,7 @@ QStringList QgsWMSServer::layerSet( const QStringList &layersList, QStringList layerKeys; QStringList::const_iterator llstIt; QStringList::const_iterator slstIt; - QgsMapLayer* theMapLayer = 0; + QgsMapLayer* theMapLayer = nullptr; QgsMessageLog::logMessage( QString( "Calculating layerset using %1 layers, %2 styles and CRS %3" ).arg( layersList.count() ).arg( stylesList.count() ).arg( destCRS.description() ) ); for ( llstIt = layersList.begin(), slstIt = stylesList.begin(); llstIt != layersList.end(); ++llstIt ) { @@ -2723,7 +2723,7 @@ QStringList QgsWMSServer::applyFeatureSelections( const QStringList& layerList ) //find layerId for layer name QString layerName = layerIdSplit.at( 0 ); - QgsVectorLayer* vLayer = 0; + QgsVectorLayer* vLayer = nullptr; Q_FOREACH ( QgsMapLayer *layer, QgsMapLayerRegistry::instance()->mapLayers() ) { @@ -2761,7 +2761,7 @@ void QgsWMSServer::clearFeatureSelections( const QStringList& layerIds ) const Q_FOREACH ( const QString& id, layerIds ) { - QgsVectorLayer *layer = qobject_cast< QgsVectorLayer * >( layerMap.value( id, 0 ) ); + QgsVectorLayer *layer = qobject_cast< QgsVectorLayer * >( layerMap.value( id, nullptr ) ); if ( !layer ) continue; @@ -3131,7 +3131,7 @@ QDomElement QgsWMSServer::createFeatureGML( QDomElement typeNameElement = doc.createElement( "qgs:" + typeName /*qgs:%TYPENAME%*/ ); typeNameElement.setAttribute( "fid", typeName + "." + QString::number( feat->id() ) ); - const QgsCoordinateTransform* transform = 0; + const QgsCoordinateTransform* transform = nullptr; if ( layer && layer->crs() != crs ) { transform = mMapRenderer->transformation( layer ); @@ -3225,7 +3225,7 @@ QDomElement QgsWMSServer::createFeatureGML( continue; } //skip attribute if it is excluded by access control - if ( attributes != NULL && !attributes->contains( attributeName ) ) + if ( attributes != nullptr && !attributes->contains( attributeName ) ) { continue; } diff --git a/src/server/qgswmsserver.h b/src/server/qgswmsserver.h index cc6ea414c33..55cef6e61cd 100644 --- a/src/server/qgswmsserver.h +++ b/src/server/qgswmsserver.h @@ -94,7 +94,7 @@ class QgsWMSServer: public QgsOWSServer /** Returns the map as an image (or a null pointer in case of error). The caller takes ownership of the image object). If an instance to existing hit test structure is passed, instead of rendering it will fill the structure with symbols that would be used for rendering */ - QImage* getMap( HitTest* hitTest = 0 ); + QImage* getMap( HitTest* hitTest = nullptr ); /** GetMap request with vector format output. This output is usually symbolized (difference to WFS GetFeature)*/ void getMapAsDxf(); /** Returns an SLD file with the style of the requested layer. Exception is raised in case of troubles :-)*/ @@ -160,7 +160,7 @@ class QgsWMSServer: public QgsOWSServer QgsRenderContext& renderContext, const QString& version, const QString& infoFormat, - QgsRectangle* featureBBox = 0 ) const; + QgsRectangle* featureBBox = nullptr ) const; /** Appends feature info xml for the layer to the layer element of the dom document*/ int featureInfoFromRasterLayer( QgsRasterLayer* layer, const QgsPoint* infoPoint, @@ -260,7 +260,7 @@ class QgsWMSServer: public QgsOWSServer const QString& typeName, bool withGeom, int version, - QStringList* attributes = NULL ) const; + QStringList* attributes = nullptr ) const; /** Replaces attribute value with ValueRelation or ValueRelation if defined. Otherwise returns the original value*/ static QString replaceValueMapAndRelation( QgsVectorLayer* vl, int idx, const QString& attributeVal );