Skip to content
Permalink
Browse files

Q_FOREACH instead of non const iterator

  • Loading branch information
m-kuhn committed Jul 20, 2017
1 parent cd83c3c commit a62b02699d493648c349cc2d2906a55cb0afaa3a
Showing with 8 additions and 9 deletions.
  1. +4 −5 src/gui/attributetable/qgsdualview.cpp
  2. +4 −4 src/gui/qgsmaplayeractionregistry.cpp
@@ -474,7 +474,7 @@ void QgsDualView::viewWillShowContextMenu( QMenu *menu, const QModelIndex &atInd
continue;

QgsAttributeTableAction *a = new QgsAttributeTableAction( action.name(), this, action.id(), sourceIndex );
menu->addAction( action.name(), a, SLOT( execute() ) );
menu->addAction( action.name(), a, &QgsAttributeTableAction::execute );
}
}

@@ -485,11 +485,10 @@ void QgsDualView::viewWillShowContextMenu( QMenu *menu, const QModelIndex &atInd
//add a separator between user defined and standard actions
menu->addSeparator();

QList<QgsMapLayerAction *>::iterator actionIt;
for ( actionIt = registeredActions.begin(); actionIt != registeredActions.end(); ++actionIt )
Q_FOREACH ( QgsMapLayerAction *action, registeredActions )
{
QgsAttributeTableMapLayerAction *a = new QgsAttributeTableMapLayerAction( ( *actionIt )->text(), this, ( *actionIt ), sourceIndex );
menu->addAction( ( *actionIt )->text(), a, &QgsAttributeTableMapLayerAction::execute );
QgsAttributeTableMapLayerAction *a = new QgsAttributeTableMapLayerAction( action->text(), this, action, sourceIndex );
menu->addAction( action->text(), a, &QgsAttributeTableMapLayerAction::execute );
}
}

@@ -108,12 +108,12 @@ void QgsMapLayerActionRegistry::addMapLayerAction( QgsMapLayerAction *action )
QList< QgsMapLayerAction * > QgsMapLayerActionRegistry::mapLayerActions( QgsMapLayer *layer, QgsMapLayerAction::Targets targets )
{
QList< QgsMapLayerAction * > validActions;
QList<QgsMapLayerAction *>::iterator actionIt;
for ( actionIt = mMapLayerActionList.begin(); actionIt != mMapLayerActionList.end(); ++actionIt )

Q_FOREACH ( QgsMapLayerAction *action, mMapLayerActionList )
{
if ( ( *actionIt )->canRunUsingLayer( layer ) && ( targets & ( *actionIt )->targets() ) )
if ( action->canRunUsingLayer( layer ) && ( targets & action->targets() ) )
{
validActions.append( ( *actionIt ) );
validActions.append( action );
}
}
return validActions;

0 comments on commit a62b026

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