Skip to content

Commit f628ebd

Browse files
committedSep 9, 2015
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
1 parent 7c10760 commit f628ebd

File tree

265 files changed

+1011
-1011
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

265 files changed

+1011
-1011
lines changed
 

‎src/analysis/raster/qgsalignraster.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ bool QgsAlignRaster::run()
366366

367367
//dump();
368368

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

404-
foreach ( const Item& raster, mRasters )
404+
Q_FOREACH ( const Item& raster, mRasters )
405405
{
406406
if ( !suggestedWarpOutput( RasterInfo( raster.inputFilename ), destWkt, &cs ) )
407407
return false;

‎src/app/composer/qgscomposer.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
561561
mPanelMenu->addAction( mItemsDock->toggleViewAction() );
562562

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

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

1387-
foreach ( QDockWidget* dock, docks )
1387+
Q_FOREACH ( QDockWidget* dock, docks )
13881388
{
13891389
mPanelStatus.insert( dock->windowTitle(), PanelStatus( dock->isVisible(), false ) );
13901390
dock->setVisible( false );
13911391
}
13921392

13931393
//record active dock tabs
1394-
foreach ( QTabBar* tabBar, tabBars )
1394+
Q_FOREACH ( QTabBar* tabBar, tabBars )
13951395
{
13961396
QString currentTabTitle = tabBar->tabText( tabBar->currentIndex() );
13971397
mPanelStatus[ currentTabTitle ].isActive = true;
@@ -1400,7 +1400,7 @@ void QgsComposer::on_mActionHidePanels_triggered()
14001400
else
14011401
{
14021402
//restore visibility of all docks
1403-
foreach ( QDockWidget* dock, docks )
1403+
Q_FOREACH ( QDockWidget* dock, docks )
14041404
{
14051405
if ( ! mPanelStatus.contains( dock->windowTitle() ) )
14061406
{
@@ -1411,7 +1411,7 @@ void QgsComposer::on_mActionHidePanels_triggered()
14111411
}
14121412

14131413
//restore previously active dock tabs
1414-
foreach ( QTabBar* tabBar, tabBars )
1414+
Q_FOREACH ( QTabBar* tabBar, tabBars )
14151415
{
14161416
//loop through all tabs in tab bar
14171417
for ( int i = 0; i < tabBar->count(); ++i )
@@ -3725,7 +3725,7 @@ void QgsComposer::populateHelpMenu()
37253725
void QgsComposer::populateWithOtherMenu( QMenu* thisMenu, QMenu* otherMenu )
37263726
{
37273727
thisMenu->clear();
3728-
foreach ( QAction* act, otherMenu->actions() )
3728+
Q_FOREACH ( QAction* act, otherMenu->actions() )
37293729
{
37303730
if ( act->menu() )
37313731
{
@@ -3741,7 +3741,7 @@ void QgsComposer::populateWithOtherMenu( QMenu* thisMenu, QMenu* otherMenu )
37413741
QMenu* QgsComposer::mirrorOtherMenu( QMenu* otherMenu )
37423742
{
37433743
QMenu* newMenu = new QMenu( otherMenu->title(), this );
3744-
foreach ( QAction* act, otherMenu->actions() )
3744+
Q_FOREACH ( QAction* act, otherMenu->actions() )
37453745
{
37463746
if ( act->menu() )
37473747
{

0 commit comments

Comments
 (0)
Please sign in to comment.