Skip to content
Permalink
Browse files

Remove Q_FOREACH in favor of range-based for loops in the gui library

  • Loading branch information
m-kuhn committed Apr 7, 2019
1 parent 736e8cb commit 8c18c80ac11c74f79af9cef79b85317744f83a0b
Showing with 674 additions and 352 deletions.
  1. +2 −0 src/gui/CMakeLists.txt
  2. +4 −2 src/gui/attributetable/qgsattributetablefiltermodel.cpp
  3. +4 −2 src/gui/attributetable/qgsattributetablemodel.cpp
  4. +10 −7 src/gui/attributetable/qgsattributetableview.cpp
  5. +6 −3 src/gui/attributetable/qgsdualview.cpp
  6. +4 −2 src/gui/attributetable/qgsfeaturelistview.cpp
  7. +14 −7 src/gui/attributetable/qgsfeatureselectionmodel.cpp
  8. +4 −2 src/gui/attributetable/qgsfieldconditionalformatwidget.cpp
  9. +2 −1 src/gui/attributetable/qgsorganizetablecolumnsdialog.cpp
  10. +8 −4 src/gui/auth/qgsauthauthoritieseditor.cpp
  11. +8 −4 src/gui/auth/qgsauthcertificateinfo.cpp
  12. +2 −1 src/gui/auth/qgsauthconfigedit.cpp
  13. +4 −2 src/gui/auth/qgsauthidentitieseditor.cpp
  14. +4 −2 src/gui/auth/qgsauthimportcertdialog.cpp
  15. +2 −1 src/gui/auth/qgsauthimportidentitydialog.cpp
  16. +4 −2 src/gui/auth/qgsauthserverseditor.cpp
  17. +6 −3 src/gui/auth/qgsauthsslconfigwidget.cpp
  18. +2 −1 src/gui/auth/qgsauthsslerrorsdialog.cpp
  19. +2 −1 src/gui/auth/qgsauthsslimportdialog.cpp
  20. +4 −2 src/gui/auth/qgsauthtrustedcasdialog.cpp
  21. +2 −1 src/gui/editorwidgets/core/qgseditorconfigwidget.cpp
  22. +2 −1 src/gui/editorwidgets/qgsenumerationwidgetwrapper.cpp
  23. +8 −4 src/gui/editorwidgets/qgsrelationreferenceconfigdlg.cpp
  24. +10 −5 src/gui/editorwidgets/qgsrelationreferencewidget.cpp
  25. +20 −11 src/gui/editorwidgets/qgssearchwidgettoolbutton.cpp
  26. +2 −1 src/gui/editorwidgets/qgsuniquevaluewidgetwrapper.cpp
  27. +5 −3 src/gui/editorwidgets/qgsvaluerelationsearchwidgetwrapper.cpp
  28. +2 −1 src/gui/effects/qgspainteffectpropertieswidget.cpp
  29. +4 −2 src/gui/layertree/qgscustomlayerorderwidget.cpp
  30. +2 −1 src/gui/layertree/qgslayertreeembeddedconfigwidget.cpp
  31. +2 −1 src/gui/layertree/qgslayertreeembeddedwidgetregistry.cpp
  32. +12 −6 src/gui/layertree/qgslayertreeview.cpp
  33. +13 −8 src/gui/layertree/qgslayertreeviewdefaultactions.cpp
  34. +4 −2 src/gui/layout/qgslayoutruler.cpp
  35. +4 −2 src/gui/layout/qgslayoutunitscombobox.cpp
  36. +5 −3 src/gui/ogr/qgsvectorlayersaveasdialog.cpp
  37. +2 −1 src/gui/qgsactionmenu.cpp
  38. +2 −1 src/gui/qgsadvanceddigitizingdockwidget.cpp
  39. +30 −15 src/gui/qgsattributeform.cpp
  40. +4 −2 src/gui/qgsattributeformwidget.cpp
  41. +2 −1 src/gui/qgsattributetypeloaddialog.cpp
  42. +2 −1 src/gui/qgsbrowserdockwidget.cpp
  43. +6 −3 src/gui/qgsbrowsertreeview.cpp
  44. +4 −2 src/gui/qgscheckablecombobox.cpp
  45. +6 −3 src/gui/qgscollapsiblegroupbox.cpp
  46. +4 −2 src/gui/qgscolorbrewercolorrampdialog.cpp
  47. +12 −6 src/gui/qgscolorschemelist.cpp
  48. +2 −1 src/gui/qgscompoundcolorwidget.cpp
  49. +2 −1 src/gui/qgsconfigureshortcutsdialog.cpp
  50. +4 −2 src/gui/qgscurveeditorwidget.cpp
  51. +14 −7 src/gui/qgsexpressionbuilderwidget.cpp
  52. +6 −3 src/gui/qgsexpressionhighlighter.cpp
  53. +2 −1 src/gui/qgsfontbutton.cpp
  54. +4 −2 src/gui/qgsgradientcolorrampdialog.cpp
  55. +6 −3 src/gui/qgsgradientstopeditor.cpp
  56. +2 −1 src/gui/qgsguiutils.cpp
  57. +4 −2 src/gui/qgshelp.cpp
  58. +2 −1 src/gui/qgshighlight.cpp
  59. +2 −2 src/gui/qgshistogramwidget.cpp
  60. +20 −10 src/gui/qgsidentifymenu.cpp
  61. +6 −3 src/gui/qgsmapcanvas.cpp
  62. +10 −4 src/gui/qgsmapcanvastracer.cpp
  63. +2 −1 src/gui/qgsmaplayeractionregistry.cpp
  64. +4 −2 src/gui/qgsmapoverviewcanvas.cpp
  65. +6 −3 src/gui/qgsnewnamedialog.cpp
  66. +2 −1 src/gui/qgsoptionsdialogbase.cpp
  67. +2 −1 src/gui/qgsorderbydialog.cpp
  68. +2 −1 src/gui/qgsowssourceselect.cpp
  69. +2 −1 src/gui/qgspanelwidget.cpp
  70. +2 −1 src/gui/qgspanelwidgetstack.cpp
  71. +2 −1 src/gui/qgsprojectionselectiontreewidget.cpp
  72. +2 −1 src/gui/qgsprojectionselectionwidget.cpp
  73. +2 −1 src/gui/qgspropertyassistantwidget.cpp
  74. +12 −6 src/gui/qgspropertyoverridebutton.cpp
  75. +2 −1 src/gui/qgsquerybuilder.cpp
  76. +10 −5 src/gui/qgsrasterformatsaveoptionswidget.cpp
  77. +2 −1 src/gui/qgsrasterlayersaveasdialog.cpp
  78. +8 −5 src/gui/qgsrasterpyramidsoptionswidget.cpp
  79. +20 −10 src/gui/qgsrelationeditorwidget.cpp
  80. +2 −1 src/gui/qgsrubberband.cpp
  81. +4 −2 src/gui/qgsscrollarea.cpp
  82. +8 −4 src/gui/qgsshortcutsmanager.cpp
  83. +24 −12 src/gui/qgssqlcomposerdialog.cpp
  84. +2 −1 src/gui/qgssublayersdialog.cpp
  85. +2 −1 src/gui/qgssubstitutionlistwidget.cpp
  86. +4 −2 src/gui/qgstabwidget.cpp
  87. +2 −1 src/gui/qgstaskmanagerwidget.cpp
  88. +4 −2 src/gui/qgstextformatwidget.cpp
  89. +8 −4 src/gui/qgsvariableeditorwidget.cpp
  90. +6 −3 src/gui/raster/qgscolorrampshaderwidget.cpp
  91. +16 −8 src/gui/raster/qgspalettedrendererwidget.cpp
  92. +2 −1 src/gui/raster/qgsrasterhistogramwidget.cpp
  93. +2 −1 src/gui/raster/qgsrasterminmaxwidget.cpp
  94. +2 −1 src/gui/raster/qgsrendererrasterpropertieswidget.cpp
  95. +10 −5 src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp
  96. +2 −1 src/gui/symbology/qgscptcitycolorrampdialog.cpp
  97. +2 −1 src/gui/symbology/qgsdatadefinedsizelegendwidget.cpp
  98. +2 −1 src/gui/symbology/qgsellipsesymbollayerwidget.cpp
  99. +8 −4 src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp
  100. +2 −1 src/gui/symbology/qgsheatmaprendererwidget.cpp
  101. +6 −3 src/gui/symbology/qgslayerpropertieswidget.cpp
  102. +2 −1 src/gui/symbology/qgspointclusterrendererwidget.cpp
  103. +2 −1 src/gui/symbology/qgspointdisplacementrendererwidget.cpp
  104. +4 −2 src/gui/symbology/qgsrendererpropertiesdialog.cpp
  105. +26 −13 src/gui/symbology/qgsrendererwidget.cpp
  106. +32 −17 src/gui/symbology/qgsrulebasedrendererwidget.cpp
  107. +10 −5 src/gui/symbology/qgssmartgroupeditordialog.cpp
  108. +8 −4 src/gui/symbology/qgsstyleexportimportdialog.cpp
  109. +7 −5 src/gui/symbology/qgsstylegroupselectiondialog.cpp
  110. +8 −4 src/gui/symbology/qgssvgselectorwidget.cpp
  111. +8 −11 src/gui/symbology/qgssymbollayerwidget.cpp
  112. +2 −1 src/gui/symbology/qgssymbollevelsdialog.cpp
  113. +10 −5 src/gui/symbology/qgssymbolslistwidget.cpp
@@ -1064,6 +1064,8 @@ IF(ENABLE_MODELTEST)
TARGET_LINK_LIBRARIES(qgis_gui ${Qt5Test_LIBRARIES})
ENDIF(ENABLE_MODELTEST)

TARGET_COMPILE_DEFINITIONS(qgis_gui PRIVATE "-DQT_NO_FOREACH")

IF(WIN32)
ADD_DEFINITIONS(-DQWT_DLL)
ADD_DEFINITIONS(-DQSCINTILLA_DLL)
@@ -141,7 +141,8 @@ void QgsAttributeTableFilterModel::setAttributeTableConfig( const QgsAttributeTa
}

QVector<int> newColumnMapping;
Q_FOREACH ( const QgsAttributeTableConfig::ColumnConfig &columnConfig, mConfig.columns() )
const auto constColumns = mConfig.columns();
for ( const QgsAttributeTableConfig::ColumnConfig &columnConfig : constColumns )
{
// Hidden? Forget about this column
if ( columnConfig.hidden )
@@ -504,7 +505,8 @@ QModelIndex QgsAttributeTableFilterModel::fidToIndex( QgsFeatureId fid )
QModelIndexList QgsAttributeTableFilterModel::fidToIndexList( QgsFeatureId fid )
{
QModelIndexList indexes;
Q_FOREACH ( const QModelIndex &idx, masterModel()->idToIndexList( fid ) )
const auto constIdToIndexList = masterModel()->idToIndexList( fid );
for ( const QModelIndex &idx : constIdToIndexList )
{
indexes.append( mapFromMaster( idx ) );
}
@@ -105,7 +105,8 @@ void QgsAttributeTableModel::featuresDeleted( const QgsFeatureIds &fids )
{
QList<int> rows;

Q_FOREACH ( QgsFeatureId fid, fids )
const auto constFids = fids;
for ( QgsFeatureId fid : constFids )
{
QgsDebugMsgLevel( QStringLiteral( "(%2) fid: %1, size: %3" ).arg( fid ).arg( mFeatureRequest.filterType() ).arg( mIdRowMap.size() ), 4 );

@@ -122,7 +123,8 @@ void QgsAttributeTableModel::featuresDeleted( const QgsFeatureIds &fids )
int removedRows = 0;
bool reset = false;

Q_FOREACH ( int row, rows )
const auto constRows = rows;
for ( int row : constRows )
{
#if 0
qDebug() << "Row: " << row << ", begin " << beginRow << ", last " << lastRow << ", current " << currentRowCount << ", removed " << removedRows;
@@ -89,7 +89,8 @@ bool QgsAttributeTableView::eventFilter( QObject *object, QEvent *event )
void QgsAttributeTableView::setAttributeTableConfig( const QgsAttributeTableConfig &config )
{
int i = 0;
Q_FOREACH ( const QgsAttributeTableConfig::ColumnConfig &columnConfig, config.columns() )
const auto constColumns = config.columns();
for ( const QgsAttributeTableConfig::ColumnConfig &columnConfig : constColumns )
{
if ( columnConfig.hidden )
continue;
@@ -201,7 +202,8 @@ QWidget *QgsAttributeTableView::createActionWidget( QgsFeatureId fid )

// first add user created layer actions
QList<QgsAction> actions = mFilterModel->layer()->actions()->actions( QStringLiteral( "Feature" ) );
Q_FOREACH ( const QgsAction &action, actions )
const auto constActions = actions;
for ( const QgsAction &action : constActions )
{
if ( !mFilterModel->layer()->isEditable() && action.isEnabledOnlyWhenEditable() )
continue;
@@ -219,10 +221,9 @@ QWidget *QgsAttributeTableView::createActionWidget( QgsFeatureId fid )
defaultAction = act;
}

const auto mapLayerActions {QgsGui::mapLayerActionRegistry()->mapLayerActions( mFilterModel->layer(), QgsMapLayerAction::SingleFeature ) };
// next add any registered actions for this layer
Q_FOREACH ( QgsMapLayerAction *mapLayerAction,
QgsGui::mapLayerActionRegistry()->mapLayerActions( mFilterModel->layer(),
QgsMapLayerAction::SingleFeature ) )
for ( QgsMapLayerAction *mapLayerAction : mapLayerActions )
{
QAction *action = new QAction( mapLayerAction->icon(), mapLayerAction->text(), container );
action->setData( "map_layer_action" );
@@ -240,7 +241,8 @@ QWidget *QgsAttributeTableView::createActionWidget( QgsFeatureId fid )
if ( !defaultAction && !actionList.isEmpty() )
defaultAction = actionList.at( 0 );

Q_FOREACH ( QAction *act, actionList )
const auto constActionList = actionList;
for ( QAction *act : constActionList )
{
if ( attributeTableConfig.actionWidgetStyle() == QgsAttributeTableConfig::DropDown )
{
@@ -325,7 +327,8 @@ void QgsAttributeTableView::keyPressEvent( QKeyEvent *event )

void QgsAttributeTableView::repaintRequested( const QModelIndexList &indexes )
{
Q_FOREACH ( const QModelIndex &index, indexes )
const auto constIndexes = indexes;
for ( const QModelIndex &index : constIndexes )
{
update( index );
}
@@ -131,7 +131,8 @@ void QgsDualView::columnBoxInit()
mFeatureListPreviewButton->addAction( mActionExpressionPreview );
mFeatureListPreviewButton->addAction( mActionPreviewColumnsMenu );

Q_FOREACH ( const QgsField &field, fields )
const auto constFields = fields;
for ( const QgsField &field : constFields )
{
int fieldIndex = mLayer->fields().lookupField( field.name() );
if ( fieldIndex == -1 )
@@ -564,7 +565,8 @@ void QgsDualView::viewWillShowContextMenu( QMenu *menu, const QModelIndex &atInd
QAction *a = menu->addAction( tr( "Run Layer Action" ) );
a->setEnabled( false );

Q_FOREACH ( const QgsAction &action, actions )
const auto constActions = actions;
for ( const QgsAction &action : constActions )
{
if ( !action.runable() )
continue;
@@ -584,7 +586,8 @@ void QgsDualView::viewWillShowContextMenu( QMenu *menu, const QModelIndex &atInd
//add a separator between user defined and standard actions
menu->addSeparator();

Q_FOREACH ( QgsMapLayerAction *action, registeredActions )
const auto constRegisteredActions = registeredActions;
for ( QgsMapLayerAction *action : constRegisteredActions )
{
QgsAttributeTableMapLayerAction *a = new QgsAttributeTableMapLayerAction( action->text(), this, action, sourceIndex );
menu->addAction( action->text(), a, &QgsAttributeTableMapLayerAction::execute );
@@ -185,7 +185,8 @@ void QgsFeatureListView::setEditSelection( const QgsFeatureIds &fids )
{
QItemSelection selection;

Q_FOREACH ( QgsFeatureId fid, fids )
const auto constFids = fids;
for ( QgsFeatureId fid : constFids )
{
selection.append( QItemSelectionRange( mModel->mapToMaster( mModel->fidToIdx( fid ) ) ) );
}
@@ -213,7 +214,8 @@ void QgsFeatureListView::setEditSelection( const QModelIndex &index, QItemSelect

void QgsFeatureListView::repaintRequested( const QModelIndexList &indexes )
{
Q_FOREACH ( const QModelIndex &index, indexes )
const auto constIndexes = indexes;
for ( const QModelIndex &index : constIndexes )
{
update( index );
}
@@ -75,7 +75,8 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,

QgsDebugMsg( QStringLiteral( "Index count: %1" ).arg( selection.indexes().size() ) );

Q_FOREACH ( const QModelIndex &index, selection.indexes() )
const auto constIndexes = selection.indexes();
for ( const QModelIndex &index : constIndexes )
{
QgsFeatureId id = index.model()->data( index, QgsAttributeTableModel::FeatureIdRole ).toLongLong();

@@ -89,7 +90,8 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
if ( !mSyncEnabled )
{
mClearAndSelectBuffer = true;
Q_FOREACH ( QgsFeatureId id, ids )
const auto constIds = ids;
for ( QgsFeatureId id : constIds )
{
if ( !mDeselectedBuffer.remove( id ) )
{
@@ -106,7 +108,8 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
{
if ( !mSyncEnabled )
{
Q_FOREACH ( QgsFeatureId id, ids )
const auto constIds = ids;
for ( QgsFeatureId id : constIds )
{
if ( !mDeselectedBuffer.remove( id ) )
{
@@ -123,7 +126,8 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
{
if ( !mSyncEnabled )
{
Q_FOREACH ( QgsFeatureId id, ids )
const auto constIds = ids;
for ( QgsFeatureId id : constIds )
{
if ( !mSelectedBuffer.remove( id ) )
{
@@ -140,7 +144,8 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
connect( mFeatureSelectionManager, &QgsIFeatureSelectionManager::selectionChanged, this, &QgsFeatureSelectionModel::layerSelectionChanged );

QModelIndexList updatedIndexes;
Q_FOREACH ( const QModelIndex &idx, selection.indexes() )
const auto indexes = selection.indexes();
for ( const QModelIndex &idx : indexes )
{
updatedIndexes.append( expandIndexToRow( idx ) );
}
@@ -164,12 +169,14 @@ void QgsFeatureSelectionModel::layerSelectionChanged( const QgsFeatureIds &selec
else
{
QModelIndexList updatedIndexes;
Q_FOREACH ( QgsFeatureId fid, selected )
const auto constSelected = selected;
for ( QgsFeatureId fid : constSelected )
{
updatedIndexes.append( expandIndexToRow( mFeatureModel->fidToIndex( fid ) ) );
}

Q_FOREACH ( QgsFeatureId fid, deselected )
const auto constDeselected = deselected;
for ( QgsFeatureId fid : constDeselected )
{
updatedIndexes.append( expandIndexToRow( mFeatureModel->fidToIndex( fid ) ) );
}
@@ -202,7 +202,8 @@ void QgsFieldConditionalFormatWidget::setPresets( const QList<QgsConditionalStyl
{
mPresets.clear();
mPresetsModel->clear();
Q_FOREACH ( const QgsConditionalStyle &style, styles )
const auto constStyles = styles;
for ( const QgsConditionalStyle &style : constStyles )
{
if ( style.isValid() )
{
@@ -302,7 +303,8 @@ void QgsFieldConditionalFormatWidget::reloadStyles()
{
mModel->clear();

Q_FOREACH ( const QgsConditionalStyle &style, getStyles() )
const auto constGetStyles = getStyles();
for ( const QgsConditionalStyle &style : constGetStyles )
{
QStandardItem *item = new QStandardItem( style.displayText() );
item->setIcon( QIcon( style.renderPreview() ) );
@@ -58,7 +58,8 @@ QgsOrganizeTableColumnsDialog::QgsOrganizeTableColumnsDialog( const QgsVectorLay

mFieldsList->clear();

Q_FOREACH ( const QgsAttributeTableConfig::ColumnConfig &columnConfig, mConfig.columns() )
const auto constColumns = mConfig.columns();
for ( const QgsAttributeTableConfig::ColumnConfig &columnConfig : constColumns )
{
QListWidgetItem *item = nullptr;
if ( columnConfig.type == QgsAttributeTableConfig::Action )
@@ -160,7 +160,8 @@ void QgsAuthAuthoritiesEditor::refreshCaCertsView()

static void removeChildren_( QTreeWidgetItem *item )
{
Q_FOREACH ( QTreeWidgetItem *child, item->takeChildren() )
const auto constTakeChildren = item->takeChildren();
for ( QTreeWidgetItem *child : constTakeChildren )
{
delete child;
}
@@ -270,7 +271,8 @@ void QgsAuthAuthoritiesEditor::appendCertsToItem( const QList<QSslCertificate> &
QStringList untrustedids = mCertTrustCache.value( QgsAuthCertUtils::Untrusted );

// Columns: Common Name, Serial #, Expiry Date
Q_FOREACH ( const QSslCertificate &cert, certs )
const auto constCerts = certs;
for ( const QSslCertificate &cert : constCerts )
{
QString id( QgsAuthCertUtils::shaHexForCert( cert ) );

@@ -452,7 +454,8 @@ void QgsAuthAuthoritiesEditor::btnAddCa_clicked()

if ( dlg->certTrustPolicy() != QgsAuthCertUtils::DefaultTrust )
{
Q_FOREACH ( const QSslCertificate &cert, certs )
const auto constCerts = certs;
for ( const QSslCertificate &cert : constCerts )
{
if ( !QgsApplication::authManager()->storeCertTrustPolicy( cert, dlg->certTrustPolicy() ) )
{
@@ -688,7 +691,8 @@ void QgsAuthAuthoritiesEditor::btnCaFile_clicked()
if ( dlg->certTrustPolicy() != QgsAuthCertUtils::DefaultTrust )
{
QList<QSslCertificate> certs( QgsApplication::authManager()->extraFileCAs() );
Q_FOREACH ( const QSslCertificate &cert, certs )
const auto constCerts = certs;
for ( const QSslCertificate &cert : constCerts )
{
if ( !QgsApplication::authManager()->storeCertTrustPolicy( cert, dlg->certTrustPolicy() ) )
{
@@ -42,7 +42,8 @@ static void setItemBold_( QTreeWidgetItem *item )

static void removeChildren_( QTreeWidgetItem *item )
{
Q_FOREACH ( QTreeWidgetItem *child, item->takeChildren() )
const auto constTakeChildren = item->takeChildren();
for ( QTreeWidgetItem *child : constTakeChildren )
{
delete child;
}
@@ -144,7 +145,8 @@ bool QgsAuthCertInfo::populateQcaCertCollection()
}
if ( !mConnectionCAs.isEmpty() )
{
Q_FOREACH ( const QSslCertificate &cert, mConnectionCAs )
const auto constMConnectionCAs = mConnectionCAs;
for ( const QSslCertificate &cert : constMConnectionCAs )
{
QCA::ConvertResult res;
QCA::Certificate acert = QCA::Certificate::fromPEM( cert.toPem(), &res, QStringLiteral( "qca-ossl" ) );
@@ -201,7 +203,8 @@ bool QgsAuthCertInfo::populateCertChain()
}

// mirror chain to QSslCertificate
Q_FOREACH ( QCA::Certificate cert, mACertChain )
const auto constMACertChain = mACertChain;
for ( QCA::Certificate cert : constMACertChain )
{
QSslCertificate qcert;
if ( !cert.isNull() )
@@ -777,7 +780,8 @@ void QgsAuthCertInfo::populateInfoDetailsSection()
QStringList keyusage;
QStringList extkeyusage;
QList<QCA::ConstraintType> certconsts = mCurrentACert.constraints();
Q_FOREACH ( const QCA::ConstraintType &certconst, certconsts )
const auto constCertconsts = certconsts;
for ( const QCA::ConstraintType &certconst : constCertconsts )
{
if ( certconst.section() == QCA::ConstraintType::KeyUsage )
{
@@ -102,7 +102,8 @@ void QgsAuthConfigEdit::populateAuthMethods()

// sort by auth method description attribute, then populate
QMap<QString, QgsAuthMethod *> descmap;
Q_FOREACH ( const QString &authMethodKey, authMethodKeys )
const auto constAuthMethodKeys = authMethodKeys;
for ( const QString &authMethodKey : constAuthMethodKeys )
{
QgsAuthMethod *authmethod = QgsApplication::authManager()->authMethod( authMethodKey );
if ( !authmethod )
@@ -106,7 +106,8 @@ void QgsAuthIdentitiesEditor::setupIdentitiesTree()

static void removeChildren_( QTreeWidgetItem *item )
{
Q_FOREACH ( QTreeWidgetItem *child, item->takeChildren() )
const auto constTakeChildren = item->takeChildren();
for ( QTreeWidgetItem *child : constTakeChildren )
{
delete child;
}
@@ -193,7 +194,8 @@ void QgsAuthIdentitiesEditor::appendIdentitiesToItem( const QList<QSslCertificat
QBrush redb( QgsAuthGuiUtils::redColor() );

// Columns: Common Name, Serial #, Expiry Date
Q_FOREACH ( const QSslCertificate &cert, certs )
const auto constCerts = certs;
for ( const QSslCertificate &cert : constCerts )
{
QString id( QgsAuthCertUtils::shaHexForCert( cert ) );

@@ -168,7 +168,8 @@ void QgsAuthImportCertDialog::validateCertificates()

int certssize = certs.size();

Q_FOREACH ( const QSslCertificate &cert, certs )
const auto constCerts = certs;
for ( const QSslCertificate &cert : constCerts )
{
if ( QgsAuthCertUtils::certIsViable( cert ) )
++validcerts;
@@ -192,7 +193,8 @@ void QgsAuthImportCertDialog::validateCertificates()

if ( !nixcerts.isEmpty() )
{
Q_FOREACH ( const QSslCertificate &nixcert, nixcerts )
const auto constNixcerts = nixcerts;
for ( const QSslCertificate &nixcert : constNixcerts )
{
certs.removeOne( nixcert );
}
@@ -406,7 +406,8 @@ bool QgsAuthImportIdentityDialog::validatePkiPkcs12()
QList<QSslCertificate> ca_certs;
if ( cert_chain.size() > 1 )
{
Q_FOREACH ( const QCA::Certificate &ca_cert, cert_chain )
const auto constCert_chain = cert_chain;
for ( const QCA::Certificate &ca_cert : constCert_chain )
{
if ( ca_cert != cert_chain.primary() )
{

0 comments on commit 8c18c80

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