Skip to content
Permalink
Browse files

Replace foreach with Q_FOREACH

For:
- consistency
- to make it immediately clear that this is a Qt macro and that it
works slightly differently to c++ for loops
  • Loading branch information
nyalldawson committed Sep 9, 2015
1 parent 7c10760 commit f628ebd42360a22e10e1c101c734486e643cd8e5
Showing with 1,011 additions and 1,011 deletions.
  1. +2 −2 src/analysis/raster/qgsalignraster.cpp
  2. +8 −8 src/app/composer/qgscomposer.cpp
  3. +8 −8 src/app/composer/qgscomposerlegendwidget.cpp
  4. +1 −1 src/app/composer/qgscomposermanager.cpp
  5. +1 −1 src/app/composer/qgscomposermapwidget.cpp
  6. +5 −5 src/app/legend/qgsapplegendinterface.cpp
  7. +3 −3 src/app/main.cpp
  8. +5 −5 src/app/nodetool/qgsmaptoolnodetool.cpp
  9. +9 −9 src/app/nodetool/qgsnodeeditor.cpp
  10. +4 −4 src/app/nodetool/qgsselectedfeature.cpp
  11. +1 −1 src/app/pluginmanager/qgspluginmanager.cpp
  12. +50 −50 src/app/qgisapp.cpp
  13. +1 −1 src/app/qgsaddtaborgroup.cpp
  14. +3 −3 src/app/qgsalignrasterdialog.cpp
  15. +2 −2 src/app/qgsapplayertreeviewmenuprovider.cpp
  16. +2 −2 src/app/qgsattributetabledialog.cpp
  17. +3 −3 src/app/qgsbookmarks.cpp
  18. +4 −4 src/app/qgsbrowserdockwidget.cpp
  19. +1 −1 src/app/qgsclipboard.cpp
  20. +11 −11 src/app/qgscustomization.cpp
  21. +2 −2 src/app/qgsdiagramproperties.cpp
  22. +7 −7 src/app/qgsdxfexportdialog.cpp
  23. +2 −2 src/app/qgsfieldsproperties.cpp
  24. +2 −2 src/app/qgshandlebadlayers.cpp
  25. +6 −6 src/app/qgsidentifyresultsdialog.cpp
  26. +2 −2 src/app/qgslabelinggui.cpp
  27. +1 −1 src/app/qgslabelpropertydialog.cpp
  28. +2 −2 src/app/qgsmaplayerstyleguiutils.cpp
  29. +1 −1 src/app/qgsmaptoolfeatureaction.cpp
  30. +1 −1 src/app/qgsmaptoolmovefeature.cpp
  31. +1 −1 src/app/qgsmaptoolpinlabels.cpp
  32. +1 −1 src/app/qgsmaptoolrotatefeature.cpp
  33. +1 −1 src/app/qgsmaptoolrotatepointsymbols.cpp
  34. +1 −1 src/app/qgsmaptoolshowhidelabels.cpp
  35. +7 −7 src/app/qgsmaptoolsimplify.cpp
  36. +7 −7 src/app/qgsoptions.cpp
  37. +2 −2 src/app/qgspluginregistry.cpp
  38. +6 −6 src/app/qgsprojectlayergroupdialog.cpp
  39. +4 −4 src/app/qgsprojectproperties.cpp
  40. +2 −2 src/app/qgsrasterlayerproperties.cpp
  41. +1 −1 src/app/qgsshortcutsmanager.cpp
  42. +2 −2 src/app/qgssnappingdialog.cpp
  43. +3 −3 src/app/qgsstatisticalsummarydockwidget.cpp
  44. +2 −2 src/app/qgsvectorlayerproperties.cpp
  45. +9 −9 src/app/qgsvisibilitypresets.cpp
  46. +1 −1 src/browser/qgsbrowser.cpp
  47. +1 −1 src/core/composer/qgsatlascomposition.cpp
  48. +1 −1 src/core/composer/qgscomposerlegend.cpp
  49. +1 −1 src/core/composer/qgscomposermap.cpp
  50. +1 −1 src/core/composer/qgscomposermodel.cpp
  51. +1 −1 src/core/composer/qgslegendmodel.cpp
  52. +2 −2 src/core/diagram/qgshistogramdiagram.cpp
  53. +7 −7 src/core/dxf/qgsdxfexport.cpp
  54. +1 −1 src/core/effects/qgseffectstack.cpp
  55. +1 −1 src/core/effects/qgspainteffectregistry.cpp
  56. +7 −7 src/core/geometry/qgscompoundcurvev2.cpp
  57. +6 −6 src/core/geometry/qgscurvepolygonv2.cpp
  58. +8 −8 src/core/geometry/qgsgeometrycollectionv2.cpp
  59. +6 −6 src/core/geometry/qgsgeometryutils.cpp
  60. +3 −3 src/core/geometry/qgsmulticurvev2.cpp
  61. +3 −3 src/core/geometry/qgsmultilinestringv2.cpp
  62. +3 −3 src/core/geometry/qgsmultipointv2.cpp
  63. +3 −3 src/core/geometry/qgsmultipolygonv2.cpp
  64. +3 −3 src/core/geometry/qgsmultisurfacev2.cpp
  65. +2 −2 src/core/geometry/qgspolygonv2.cpp
  66. +1 −1 src/core/geometry/qgswkbtypes.cpp
  67. +1 −1 src/core/gps/qextserialport/qextserialenumerator.h
  68. +3 −3 src/core/gps/qgsgpsdetector.cpp
  69. +10 −10 src/core/layertree/qgslayertreegroup.cpp
  70. +1 −1 src/core/layertree/qgslayertreelayer.cpp
  71. +22 −22 src/core/layertree/qgslayertreemodel.cpp
  72. +2 −2 src/core/layertree/qgslayertreenode.cpp
  73. +3 −3 src/core/layertree/qgslayertreeregistrybridge.cpp
  74. +9 −9 src/core/layertree/qgslayertreeutils.cpp
  75. +6 −6 src/core/qgsapplication.cpp
  76. +6 −6 src/core/qgsbrowsermodel.cpp
  77. +1 −1 src/core/qgscolorscheme.cpp
  78. +6 −6 src/core/qgsconditionalstyle.cpp
  79. +4 −4 src/core/qgsconnectionpool.h
  80. +4 −4 src/core/qgscoordinatereferencesystem.cpp
  81. +19 −19 src/core/qgsdataitem.cpp
  82. +1 −1 src/core/qgsdataitemproviderregistry.cpp
  83. +4 −4 src/core/qgsdatasourceuri.cpp
  84. +1 −1 src/core/qgserror.cpp
  85. +17 −17 src/core/qgsexpression.cpp
  86. +3 −3 src/core/qgsexpression.h
  87. +4 −4 src/core/qgsexpressioncontext.cpp
  88. +1 −1 src/core/qgsfeaturerequest.cpp
  89. +1 −1 src/core/qgsfeaturestore.cpp
  90. +3 −3 src/core/qgsfontutils.cpp
  91. +2 −2 src/core/qgsgml.cpp
  92. +4 −4 src/core/qgsgmlschema.cpp
  93. +3 −3 src/core/qgslayerdefinition.cpp
  94. +5 −5 src/core/qgslegendrenderer.cpp
  95. +2 −2 src/core/qgsmaphittest.cpp
  96. +1 −1 src/core/qgsmaplayer.cpp
  97. +7 −7 src/core/qgsmaplayerlegend.cpp
  98. +2 −2 src/core/qgsmaplayerregistry.cpp
  99. +1 −1 src/core/qgsmaplayerstylemanager.cpp
  100. +1 −1 src/core/qgsmaprenderercache.cpp
  101. +1 −1 src/core/qgsmaprenderercustompainterjob.cpp
  102. +1 −1 src/core/qgsmaprendererjob.cpp
  103. +3 −3 src/core/qgsmimedatautils.cpp
  104. +2 −2 src/core/qgsnetworkaccessmanager.cpp
  105. +2 −2 src/core/qgsnetworkreplyparser.cpp
  106. +1 −1 src/core/qgsobjectcustomproperties.cpp
  107. +2 −2 src/core/qgsogcutils.cpp
  108. +3 −3 src/core/qgspallabeling.cpp
  109. +2 −2 src/core/qgspluginlayerregistry.cpp
  110. +1 −1 src/core/qgspointlocator.cpp
  111. +4 −4 src/core/qgsproject.cpp
  112. +1 −1 src/core/qgsproviderregistry.cpp
  113. +5 −5 src/core/qgsrelationmanager.cpp
  114. +14 −14 src/core/qgssnappingutils.cpp
  115. +2 −2 src/core/qgsstatisticalsummary.cpp
  116. +4 −4 src/core/qgstransaction.cpp
  117. +1 −1 src/core/qgsvectordataprovider.cpp
  118. +3 −3 src/core/qgsvectorfilewriter.cpp
  119. +6 −6 src/core/qgsvectorlayer.cpp
  120. +3 −3 src/core/qgsvectorlayercache.cpp
  121. +7 −7 src/core/qgsvectorlayereditbuffer.cpp
  122. +1 −1 src/core/qgsvectorlayereditpassthrough.cpp
  123. +1 −1 src/core/qgsvectorlayereditutils.cpp
  124. +1 −1 src/core/qgsvectorlayerimport.cpp
  125. +3 −3 src/core/qgsvectorlayerjoinbuffer.cpp
  126. +13 −13 src/core/qgsvisibilitypresetcollection.cpp
  127. +4 −4 src/core/raster/qgsrasterinterface.cpp
  128. +2 −2 src/core/raster/qgsrasterlayer.cpp
  129. +1 −1 src/core/raster/qgsrasterpipe.cpp
  130. +1 −1 src/core/raster/qgsrasterrange.cpp
  131. +6 −6 src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp
  132. +4 −4 src/core/symbology-ng/qgscolorbrewerpalette.h
  133. +20 −20 src/core/symbology-ng/qgscptcityarchive.cpp
  134. +1 −1 src/core/symbology-ng/qgsfillsymbollayerv2.cpp
  135. +6 −6 src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
  136. +4 −4 src/core/symbology-ng/qgsinvertedpolygonrenderer.cpp
  137. +1 −1 src/core/symbology-ng/qgslinesymbollayerv2.cpp
  138. +4 −4 src/core/symbology-ng/qgsrendererv2.cpp
  139. +1 −1 src/core/symbology-ng/qgsrendererv2registry.cpp
  140. +11 −11 src/core/symbology-ng/qgsrulebasedrendererv2.cpp
  141. +2 −2 src/core/symbology-ng/qgsrulebasedrendererv2.h
  142. +1 −1 src/core/symbology-ng/qgssinglesymbolrendererv2.cpp
  143. +8 −8 src/core/symbology-ng/qgsstylev2.cpp
  144. +1 −1 src/core/symbology-ng/qgssymbollayerv2.cpp
  145. +1 −1 src/core/symbology-ng/qgssymbollayerv2registry.cpp
  146. +5 −5 src/core/symbology-ng/qgssymbollayerv2utils.cpp
  147. +1 −1 src/core/symbology-ng/qgsvectorcolorrampv2.cpp
  148. +1 −1 src/gui/attributetable/qgsattributetablefiltermodel.cpp
  149. +1 −1 src/gui/attributetable/qgsattributetableview.cpp
  150. +1 −1 src/gui/attributetable/qgsdualview.cpp
  151. +2 −2 src/gui/attributetable/qgsfeaturelistview.cpp
  152. +7 −7 src/gui/attributetable/qgsfeatureselectionmodel.cpp
  153. +2 −2 src/gui/attributetable/qgsfieldconditionalformatwidget.cpp
  154. +1 −1 src/gui/editorwidgets/qgsrelationreferenceconfigdlg.cpp
  155. +1 −1 src/gui/effects/qgspainteffectpropertieswidget.cpp
  156. +1 −1 src/gui/layertree/qgscustomlayerorderwidget.cpp
  157. +9 −9 src/gui/layertree/qgslayertreemapcanvasbridge.cpp
  158. +4 −4 src/gui/layertree/qgslayertreeview.cpp
  159. +4 −4 src/gui/layertree/qgslayertreeviewdefaultactions.cpp
  160. +1 −1 src/gui/qgisgui.cpp
  161. +1 −1 src/gui/qgsattributetypeloaddialog.cpp
  162. +3 −3 src/gui/qgsbrowsertreeview.cpp
  163. +1 −1 src/gui/qgscollapsiblegroupbox.cpp
  164. +1 −1 src/gui/qgscolordialog.cpp
  165. +6 −6 src/gui/qgscolorschemelist.cpp
  166. +6 −6 src/gui/qgsexpressionbuilderwidget.cpp
  167. +3 −3 src/gui/qgsexpressionhighlighter.cpp
  168. +2 −2 src/gui/qgsexpressionselectiondialog.cpp
  169. +1 −1 src/gui/qgshighlight.cpp
  170. +2 −2 src/gui/qgshistogramwidget.cpp
  171. +4 −4 src/gui/qgsmapcanvas.cpp
  172. +4 −4 src/gui/qgsmaplayermodel.cpp
  173. +2 −2 src/gui/qgsmapoverviewcanvas.cpp
  174. +5 −5 src/gui/qgsmaptoolidentify.cpp
  175. +1 −1 src/gui/qgsmessagebar.cpp
  176. +3 −3 src/gui/qgsnewnamedialog.cpp
  177. +1 −1 src/gui/qgsowssourceselect.cpp
  178. +1 −1 src/gui/qgsprojectionselectionwidget.cpp
  179. +2 −2 src/gui/qgsprojectionselector.cpp
  180. +4 −4 src/gui/qgsrasterformatsaveoptionswidget.cpp
  181. +2 −2 src/gui/qgsrasterlayersaveasdialog.cpp
  182. +9 −9 src/gui/qgsrasterpyramidsoptionswidget.cpp
  183. +2 −2 src/gui/qgsrelationadddlg.cpp
  184. +1 −1 src/gui/qgssublayersdialog.cpp
  185. +3 −3 src/gui/qgsvariableeditorwidget.cpp
  186. +1 −1 src/gui/raster/qgsrasterhistogramwidget.cpp
  187. +1 −1 src/gui/raster/qgsrasterminmaxwidget.cpp
  188. +3 −3 src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp
  189. +1 −1 src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp
  190. +3 −3 src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
  191. +1 −1 src/gui/symbology-ng/qgsrendererv2propertiesdialog.cpp
  192. +3 −3 src/gui/symbology-ng/qgsrendererv2widget.cpp
  193. +15 −15 src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp
  194. +6 −6 src/gui/symbology-ng/qgssmartgroupeditordialog.cpp
  195. +1 −1 src/gui/symbology-ng/qgsstylev2exportimportdialog.cpp
  196. +11 −11 src/gui/symbology-ng/qgsstylev2managerdialog.cpp
  197. +1 −1 src/gui/symbology-ng/qgssvgselectorwidget.cpp
  198. +1 −1 src/gui/symbology-ng/qgssymbollayerv2widget.cpp
  199. +1 −1 src/gui/symbology-ng/qgssymbolslistwidget.cpp
  200. +2 −2 src/gui/symbology-ng/qgsvectorcolorbrewercolorrampv2dialog.cpp
  201. +2 −2 src/plugins/georeferencer/qgsgeorefplugingui.cpp
  202. +1 −1 src/plugins/georeferencer/qgstransformsettingsdialog.cpp
  203. +3 −3 src/plugins/offline_editing/offline_editing_plugin_gui.cpp
  204. +1 −1 src/providers/delimitedtext/qgsdelimitedtextfile.cpp
  205. +3 −3 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
  206. +1 −1 src/providers/gdal/qgsgdaldataitems.cpp
  207. +6 −6 src/providers/gdal/qgsgdalprovider.cpp
  208. +11 −11 src/providers/mssql/qgsmssqldataitems.cpp
  209. +1 −1 src/providers/mssql/qgsmssqlfeatureiterator.cpp
  210. +1 −1 src/providers/mssql/qgsmssqlprovider.cpp
  211. +10 −10 src/providers/mssql/qgsmssqlsourceselect.cpp
  212. +3 −3 src/providers/mssql/qgsmssqltablemodel.cpp
  213. +1 −1 src/providers/ogr/qgsogrdataitems.cpp
  214. +2 −2 src/providers/ogr/qgsogrprovider.cpp
  215. +7 −7 src/providers/ows/qgsowsdataitems.cpp
  216. +12 −12 src/providers/postgres/qgspgsourceselect.cpp
  217. +2 −2 src/providers/postgres/qgspgtablemodel.cpp
  218. +1 −1 src/providers/postgres/qgspostgresconn.cpp
  219. +2 −2 src/providers/postgres/qgspostgresconn.h
  220. +4 −4 src/providers/postgres/qgspostgresdataitems.cpp
  221. +4 −4 src/providers/postgres/qgspostgresfeatureiterator.cpp
  222. +6 −6 src/providers/postgres/qgspostgresprovider.cpp
  223. +3 −3 src/providers/spatialite/qgsspatialitedataitems.cpp
  224. +1 −1 src/providers/spatialite/qgsspatialitefeatureiterator.cpp
  225. +2 −2 src/providers/spatialite/qgsspatialitesourceselect.cpp
  226. +13 −13 src/providers/wcs/qgswcscapabilities.cpp
  227. +5 −5 src/providers/wcs/qgswcsdataitems.cpp
  228. +1 −1 src/providers/wcs/qgswcsprovider.cpp
  229. +1 −1 src/providers/wcs/qgswcssourceselect.cpp
  230. +2 −2 src/providers/wfs/qgswfsdataitems.cpp
  231. +2 −2 src/providers/wfs/qgswfssourceselect.cpp
  232. +1 −1 src/providers/wms/qgstilescalewidget.cpp
  233. +6 −6 src/providers/wms/qgswmscapabilities.cpp
  234. +9 −9 src/providers/wms/qgswmsdataitems.cpp
  235. +13 −13 src/providers/wms/qgswmsprovider.cpp
  236. +10 −10 src/providers/wms/qgswmssourceselect.cpp
  237. +2 −2 src/python/qgspythonutilsimpl.cpp
  238. +1 −1 src/server/qgsconfigparserutils.cpp
  239. +1 −1 src/server/qgshttprequesthandler.cpp
  240. +1 −1 src/server/qgsmslayerbuilder.cpp
  241. +2 −2 src/server/qgsmslayercache.cpp
  242. +4 −4 src/server/qgswcsprojectparser.cpp
  243. +5 −5 src/server/qgswfsprojectparser.cpp
  244. +4 −4 src/server/qgswfsserver.cpp
  245. +7 −7 src/server/qgswmsconfigparser.cpp
  246. +8 −8 src/server/qgswmsprojectparser.cpp
  247. +17 −17 src/server/qgswmsserver.cpp
  248. +1 −1 tests/bench/main.cpp
  249. +1 −1 tests/qt_modeltest/dynamictreemodel.cpp
  250. +1 −1 tests/src/app/testqgisappclipboard.cpp
  251. +1 −1 tests/src/core/testqgsdataitem.cpp
  252. +1 −1 tests/src/core/testqgsexpression.cpp
  253. +3 −3 tests/src/core/testqgsfeature.cpp
  254. +2 −2 tests/src/core/testqgslegendrenderer.cpp
  255. +1 −1 tests/src/core/testqgsrasterfilewriter.cpp
  256. +1 −1 tests/src/core/testqgsrasterlayer.cpp
  257. +1 −1 tests/src/core/testqgsrastersublayer.cpp
  258. +2 −2 tests/src/core/testqgsrulebasedrenderer.cpp
  259. +2 −2 tests/src/core/testqgsspatialindex.cpp
  260. +2 −2 tests/src/core/testqgsstylev2.cpp
  261. +1 −1 tests/src/core/testqgsvectorlayercache.cpp
  262. +15 −15 tests/src/core/testziplayer.cpp
  263. +1 −1 tests/src/gui/testprojectionissues.cpp
  264. +2 −2 tests/src/providers/testqgswcsprovider.cpp
  265. +19 −19 tests/src/providers/testqgswcspublicservers.cpp
@@ -366,7 +366,7 @@ bool QgsAlignRaster::run()

//dump();

foreach ( const Item& r, mRasters )
Q_FOREACH ( const Item& r, mRasters )
{
if ( !createAndWarp( r ) )
return false;
@@ -401,7 +401,7 @@ int QgsAlignRaster::suggestedReferenceLayer() const
QgsCoordinateReferenceSystem destCRS( "EPSG:4326" );
QString destWkt = destCRS.toWkt();

foreach ( const Item& raster, mRasters )
Q_FOREACH ( const Item& raster, mRasters )
{
if ( !suggestedWarpOutput( RasterInfo( raster.inputFilename ), destWkt, &cs ) )
return false;
@@ -561,7 +561,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
mPanelMenu->addAction( mItemsDock->toggleViewAction() );

QList<QDockWidget *> docks = findChildren<QDockWidget *>();
foreach ( QDockWidget* dock, docks )
Q_FOREACH ( QDockWidget* dock, docks )
{
dock->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable );
connect( dock, SIGNAL( visibilityChanged( bool ) ), this, SLOT( dockVisibilityChanged( bool ) ) );
@@ -729,7 +729,7 @@ void QgsComposer::setIconSizes( int size )

//Change all current icon sizes.
QList<QToolBar *> toolbars = findChildren<QToolBar *>();
foreach ( QToolBar * toolbar, toolbars )
Q_FOREACH ( QToolBar * toolbar, toolbars )
{
toolbar->setIconSize( QSize( size, size ) );
}
@@ -1384,14 +1384,14 @@ void QgsComposer::on_mActionHidePanels_triggered()
mPanelStatus.clear();
//record status of all docks

foreach ( QDockWidget* dock, docks )
Q_FOREACH ( QDockWidget* dock, docks )
{
mPanelStatus.insert( dock->windowTitle(), PanelStatus( dock->isVisible(), false ) );
dock->setVisible( false );
}

//record active dock tabs
foreach ( QTabBar* tabBar, tabBars )
Q_FOREACH ( QTabBar* tabBar, tabBars )
{
QString currentTabTitle = tabBar->tabText( tabBar->currentIndex() );
mPanelStatus[ currentTabTitle ].isActive = true;
@@ -1400,7 +1400,7 @@ void QgsComposer::on_mActionHidePanels_triggered()
else
{
//restore visibility of all docks
foreach ( QDockWidget* dock, docks )
Q_FOREACH ( QDockWidget* dock, docks )
{
if ( ! mPanelStatus.contains( dock->windowTitle() ) )
{
@@ -1411,7 +1411,7 @@ void QgsComposer::on_mActionHidePanels_triggered()
}

//restore previously active dock tabs
foreach ( QTabBar* tabBar, tabBars )
Q_FOREACH ( QTabBar* tabBar, tabBars )
{
//loop through all tabs in tab bar
for ( int i = 0; i < tabBar->count(); ++i )
@@ -3725,7 +3725,7 @@ void QgsComposer::populateHelpMenu()
void QgsComposer::populateWithOtherMenu( QMenu* thisMenu, QMenu* otherMenu )
{
thisMenu->clear();
foreach ( QAction* act, otherMenu->actions() )
Q_FOREACH ( QAction* act, otherMenu->actions() )
{
if ( act->menu() )
{
@@ -3741,7 +3741,7 @@ void QgsComposer::populateWithOtherMenu( QMenu* thisMenu, QMenu* otherMenu )
QMenu* QgsComposer::mirrorOtherMenu( QMenu* otherMenu )
{
QMenu* newMenu = new QMenu( otherMenu->title(), this );
foreach ( QAction* act, otherMenu->actions() )
Q_FOREACH ( QAction* act, otherMenu->actions() )
{
if ( act->menu() )
{
@@ -68,7 +68,7 @@ class QgsComposerLegendMenuProvider : public QObject, public QgsLayerTreeViewMen

QList<QgsComposerLegendStyle::Style> lst;
lst << QgsComposerLegendStyle::Hidden << QgsComposerLegendStyle::Group << QgsComposerLegendStyle::Subgroup;
foreach ( QgsComposerLegendStyle::Style style, lst )
Q_FOREACH ( QgsComposerLegendStyle::Style style, lst )
{
QAction* action = menu->addAction( QgsComposerLegendStyle::styleLabel( style ), mWidget, SLOT( setCurrentNodeStyleFromAction() ) );
action->setCheckable( true );
@@ -572,7 +572,7 @@ void QgsComposerLegendWidget::on_mCheckBoxAutoUpdate_stateChanged( int state )
QList<QWidget*> widgets;
widgets << mMoveDownToolButton << mMoveUpToolButton << mRemoveToolButton << mAddToolButton
<< mEditPushButton << mCountToolButton << mUpdateAllPushButton << mAddGroupToolButton;
foreach ( QWidget* w, widgets )
Q_FOREACH ( QWidget* w, widgets )
w->setEnabled( state != Qt::Checked );
}

@@ -661,26 +661,26 @@ void QgsComposerLegendWidget::on_mRemoveToolButton_clicked()
mLegend->beginCommand( "Legend item removed" );

QList<QPersistentModelIndex> indexes;
foreach ( const QModelIndex &index, selectionModel->selectedIndexes() )
Q_FOREACH ( const QModelIndex &index, selectionModel->selectedIndexes() )
indexes << index;

// first try to remove legend nodes
QHash<QgsLayerTreeLayer*, QList<int> > nodesWithRemoval;
foreach ( const QPersistentModelIndex& index, indexes )
Q_FOREACH ( const QPersistentModelIndex& index, indexes )
{
if ( QgsLayerTreeModelLegendNode* legendNode = mItemTreeView->layerTreeModel()->index2legendNode( index ) )
{
QgsLayerTreeLayer* nodeLayer = legendNode->layerNode();
nodesWithRemoval[nodeLayer].append( index.row() );
}
}
foreach ( QgsLayerTreeLayer* nodeLayer, nodesWithRemoval.keys() )
Q_FOREACH ( QgsLayerTreeLayer* nodeLayer, nodesWithRemoval.keys() )
{
QList<int> toDelete = nodesWithRemoval[nodeLayer];
qSort( toDelete.begin(), toDelete.end(), qGreater<int>() );
QList<int> order = QgsMapLayerLegendUtils::legendNodeOrder( nodeLayer );

foreach ( int i, toDelete )
Q_FOREACH ( int i, toDelete )
{
if ( i >= 0 && i < order.count() )
order.removeAt( i );
@@ -691,7 +691,7 @@ void QgsComposerLegendWidget::on_mRemoveToolButton_clicked()
}

// then remove layer tree nodes
foreach ( const QPersistentModelIndex& index, indexes )
Q_FOREACH ( const QPersistentModelIndex& index, indexes )
{
if ( index.isValid() && mItemTreeView->layerTreeModel()->index2node( index ) )
mLegend->modelV2()->removeRow( index.row(), index.parent() );
@@ -795,7 +795,7 @@ void QgsComposerLegendWidget::resetLayerNodeToDefaults()

mLegend->beginCommand( tr( "Legend updated" ) );

foreach ( const QString& key, nodeLayer->customProperties() )
Q_FOREACH ( const QString& key, nodeLayer->customProperties() )
{
if ( key.startsWith( "legend/" ) )
nodeLayer->removeCustomProperty( key );
@@ -528,7 +528,7 @@ void QgsComposerNameDelegate::setModelData( QWidget *editor, QAbstractItemModel

//check if name already exists
QStringList cNames;
foreach ( QgsComposer* c, QgisApp::instance()->printComposers() )
Q_FOREACH ( QgsComposer* c, QgisApp::instance()->printComposers() )
{
cNames << c->title();
}
@@ -298,7 +298,7 @@ void QgsComposerMapWidget::aboutToShowVisibilityPresetsMenu()
return;

menu->clear();
foreach ( const QString& presetName, QgsProject::instance()->visibilityPresetCollection()->presets() )
Q_FOREACH ( const QString& presetName, QgsProject::instance()->visibilityPresetCollection()->presets() )
{
QAction* a = menu->addAction( presetName, this, SLOT( visibilityPresetSelected() ) );
a->setCheckable( true );
@@ -107,7 +107,7 @@ void QgsAppLegendInterface::setGroupVisible( int groupIndex, bool visible )
static QgsLayerTreeGroup* _groupIndexToNode( int groupIndex, QgsLayerTreeGroup* parentGroup, int& currentIndex )
{
++currentIndex;
foreach ( QgsLayerTreeNode* child, parentGroup->children() )
Q_FOREACH ( QgsLayerTreeNode* child, parentGroup->children() )
{
if ( QgsLayerTree::isGroup( child ) )
{
@@ -132,7 +132,7 @@ QgsLayerTreeGroup* QgsAppLegendInterface::groupIndexToNode( int itemIndex )
static int _groupNodeToIndex( QgsLayerTreeGroup* group, QgsLayerTreeGroup* parentGroup, int& currentIndex )
{
++currentIndex;
foreach ( QgsLayerTreeNode* child, parentGroup->children() )
Q_FOREACH ( QgsLayerTreeNode* child, parentGroup->children() )
{
if ( QgsLayerTree::isGroup( child ) )
{
@@ -169,7 +169,7 @@ void QgsAppLegendInterface::setLayerExpanded( QgsMapLayer * ml, bool expand )

static void _collectGroups( QgsLayerTreeGroup* parentGroup, QStringList& list )
{
foreach ( QgsLayerTreeNode* child, parentGroup->children() )
Q_FOREACH ( QgsLayerTreeNode* child, parentGroup->children() )
{
if ( QgsLayerTree::isGroup( child ) )
{
@@ -206,7 +206,7 @@ QList< GroupLayerInfo > QgsAppLegendInterface::groupLayerRelationship()
else if ( QgsLayerTree::isGroup( currentNode ) )
{
QList<QString> layerList;
foreach ( QgsLayerTreeNode* gNode, QgsLayerTree::toGroup( currentNode )->children() )
Q_FOREACH ( QgsLayerTreeNode* gNode, QgsLayerTree::toGroup( currentNode )->children() )
{
if ( QgsLayerTree::isLayer( gNode ) )
{
@@ -273,7 +273,7 @@ QList<QgsMapLayer *> QgsAppLegendInterface::selectedLayers( bool inDrawOrder ) c
QList< QgsMapLayer * > QgsAppLegendInterface::layers() const
{
QList<QgsMapLayer*> lst;
foreach ( QgsLayerTreeLayer* node, mLayerTreeView->layerTreeModel()->rootGroup()->findLayers() )
Q_FOREACH ( QgsLayerTreeLayer* node, mLayerTreeView->layerTreeModel()->rootGroup()->findLayers() )
{
if ( node->layer() )
lst << node->layer();
@@ -827,7 +827,7 @@ APP_EXPORT int main( int argc, char *argv[] )
QStringList customVarsList = mySettings.value( "qgis/customEnvVars", "" ).toStringList();
if ( !customVarsList.isEmpty() )
{
foreach ( const QString &varStr, customVarsList )
Q_FOREACH ( const QString &varStr, customVarsList )
{
int pos = varStr.indexOf( QLatin1Char( '|' ) );
if ( pos == -1 )
@@ -1141,7 +1141,7 @@ APP_EXPORT int main( int argc, char *argv[] )
QList< QPair<QgsVectorLayer *, int > > layers;
if ( !dxfPreset.isEmpty() )
{
foreach ( const QString& layer, QgsProject::instance()->visibilityPresetCollection()->presetVisibleLayers( dxfPreset ) )
Q_FOREACH ( const QString& layer, QgsProject::instance()->visibilityPresetCollection()->presetVisibleLayers( dxfPreset ) )
{
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( QgsMapLayerRegistry::instance()->mapLayer( layer ) );
if ( !vl )
@@ -1152,7 +1152,7 @@ APP_EXPORT int main( int argc, char *argv[] )
}
else
{
foreach ( QgsMapLayer *ml, QgsMapLayerRegistry::instance()->mapLayers().values() )
Q_FOREACH ( QgsMapLayer *ml, QgsMapLayerRegistry::instance()->mapLayers().values() )
{
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( ml );
if ( !vl )
@@ -146,7 +146,7 @@ void QgsMapToolNodeTool::canvasMapMoveEvent( QgsMapMouseEvent* e )
rbGeom->transform( *mCanvas->mapSettings().layerTransform( vlayer ) );
rb->setGeometry( rbGeom );
mMoveRubberBands.insert( mSelectedFeature->featureId(), rb );
foreach ( const QgsVertexEntry* vertexEntry, mSelectedFeature->vertexMap() )
Q_FOREACH ( const QgsVertexEntry* vertexEntry, mSelectedFeature->vertexMap() )
{
if ( vertexEntry->isSelected() )
mMoveVertices[mSelectedFeature->featureId()].append( qMakePair( vertexEntry->vertexId(), toMapCoordinates( vlayer, vertexEntry->point() ) ) );
@@ -167,10 +167,10 @@ void QgsMapToolNodeTool::canvasMapMoveEvent( QgsMapMouseEvent* e )
double diffX = curPos.x() - origPos.x();
double diffY = curPos.y() - origPos.y();

foreach ( const QgsFeatureId& fid, mMoveRubberBands.keys() )
Q_FOREACH ( const QgsFeatureId& fid, mMoveRubberBands.keys() )
{
typedef QPair<QgsVertexId, QgsPointV2> MoveVertex;
foreach ( const MoveVertex& pair, mMoveVertices[fid] )
Q_FOREACH ( const MoveVertex& pair, mMoveVertices[fid] )
{
QgsPointV2 pos = pair.second;
pos.setX( pos.x() + diffX );
@@ -394,7 +394,7 @@ void QgsMapToolNodeTool::createTopologyRubberBands()
{
QgsVectorLayer* vlayer = mSelectedFeature->vlayer();

foreach ( const QgsVertexEntry* vertexEntry, mSelectedFeature->vertexMap() )
Q_FOREACH ( const QgsVertexEntry* vertexEntry, mSelectedFeature->vertexMap() )
{
if ( !vertexEntry->isSelected() )
{
@@ -404,7 +404,7 @@ void QgsMapToolNodeTool::createTopologyRubberBands()
// Snap vertex
QMultiMap<double, QgsSnappingResult> snapResults;
vlayer->snapWithContext( vertexEntry->pointV1(), ZERO_TOLERANCE, snapResults, QgsSnapper::SnapToVertex );
foreach ( const QgsSnappingResult& snapResult, snapResults.values() )
Q_FOREACH ( const QgsSnappingResult& snapResult, snapResults.values() )
{
// Get geometry of snapped feature
QgsFeatureId snapFeatureId = snapResult.snappedAtGeometry;
@@ -40,7 +40,7 @@ class CoordinateItemDelegate : public QStyledItemDelegate
QString displayText( const QVariant & value, const QLocale & locale ) const override
{
return locale.toString( value.toDouble(), 'f', 4 );
}
}

protected:

@@ -49,19 +49,19 @@ class CoordinateItemDelegate : public QStyledItemDelegate
QLineEdit* lineEdit = new QLineEdit( parent );
QDoubleValidator* validator = new QDoubleValidator();
if ( !index.data( MinRadiusRole ).isNull() )
validator->setBottom( index.data( MinRadiusRole ).toDouble() );
validator->setBottom( index.data( MinRadiusRole ).toDouble() );
lineEdit->setValidator( validator );
return lineEdit;
}

void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override
{
QLineEdit* lineEdit = qobject_cast<QLineEdit*>( editor );
if ( lineEdit->hasAcceptableInput() )
{
QStyledItemDelegate::setModelData( editor, model, index );
QLineEdit* lineEdit = qobject_cast<QLineEdit*>( editor );
if ( lineEdit->hasAcceptableInput() )
{
QStyledItemDelegate::setModelData( editor, model, index );
}
}
}
};


@@ -112,7 +112,7 @@ void QgsNodeEditor::rebuildTable()
mTableWidget->setRowCount( 0 );
int row = 0;
bool hasR = false;
foreach ( const QgsVertexEntry* entry, mSelectedFeature->vertexMap() )
Q_FOREACH ( const QgsVertexEntry* entry, mSelectedFeature->vertexMap() )
{
mTableWidget->insertRow( row );

@@ -231,7 +231,7 @@ void QgsNodeEditor::updateNodeSelection()
disconnect( mSelectedFeature, SIGNAL( selectionChanged() ), this, SLOT( updateTableSelection() ) );

mSelectedFeature->deselectAllVertexes();
foreach ( const QModelIndex& index, mTableWidget->selectionModel()->selectedRows() )
Q_FOREACH ( const QModelIndex& index, mTableWidget->selectionModel()->selectedRows() )
{
int nodeIdx = mTableWidget->item( index.row(), 0 )->data( Qt::DisplayRole ).toInt();
mSelectedFeature->selectVertex( nodeIdx );
@@ -232,7 +232,7 @@ void QgsSelectedFeature::validationFinished()
void QgsSelectedFeature::deleteSelectedVertexes()
{
int nSelected = 0;
foreach ( QgsVertexEntry *entry, mVertexMap )
Q_FOREACH ( QgsVertexEntry *entry, mVertexMap )
{
if ( entry->isSelected() )
nSelected++;
@@ -304,7 +304,7 @@ void QgsSelectedFeature::deleteSelectedVertexes()
void QgsSelectedFeature::moveSelectedVertexes( const QgsVector &v )
{
int nUpdates = 0;
foreach ( QgsVertexEntry *entry, mVertexMap )
Q_FOREACH ( QgsVertexEntry *entry, mVertexMap )
{
if ( entry->isSelected() )
nUpdates++;
@@ -377,7 +377,7 @@ void QgsSelectedFeature::replaceVertexMap()

void QgsSelectedFeature::deleteVertexMap()
{
foreach ( QgsVertexEntry *entry, mVertexMap )
Q_FOREACH ( QgsVertexEntry *entry, mVertexMap )
{
delete entry;
}
@@ -491,7 +491,7 @@ void QgsSelectedFeature::invertVertexSelection( int vertexNr )

void QgsSelectedFeature::updateVertexMarkersPosition()
{
foreach ( QgsVertexEntry* vertexEntry, mVertexMap )
Q_FOREACH ( QgsVertexEntry* vertexEntry, mVertexMap )
{
vertexEntry->placeMarker();
}
@@ -924,7 +924,7 @@ void QgsPluginManager::clearRepositoryList()
buttonRefreshRepos->setEnabled( false );
buttonEditRep->setEnabled( false );
buttonDeleteRep->setEnabled( false );
foreach ( QAction * action, treeRepositories->actions() )
Q_FOREACH ( QAction * action, treeRepositories->actions() )
{
treeRepositories->removeAction( action );
}

0 comments on commit f628ebd

Please sign in to comment.
You can’t perform that action at this time.