Skip to content
Permalink
Browse files

Fix clazy connect-3arg-lambda warnings

Always use 4 arg overload with a lambda, to avoid lambda
execution when context object is deleted.
  • Loading branch information
nyalldawson committed Sep 25, 2017
1 parent 1a32f08 commit a7470b364f29ed9857e997d93d8a8f70e99ab626
@@ -1831,7 +1831,7 @@ void QgisApp::createActions()
connect( mActionAddOgrLayer, &QAction::triggered, this, [ = ] { dataSourceManager( QStringLiteral( "ogr" ) ); } );
connect( mActionAddRasterLayer, &QAction::triggered, this, [ = ] { dataSourceManager( QStringLiteral( "gdal" ) ); } );
connect( mActionAddPgLayer, &QAction::triggered, this, [ = ] { dataSourceManager( QStringLiteral( "postgres" ) ); } );
connect( mActionAddSpatiaLiteLayer, &QAction::triggered, [ = ] { dataSourceManager( QStringLiteral( "spatialite" ) ); } );
connect( mActionAddSpatiaLiteLayer, &QAction::triggered, this, [ = ] { dataSourceManager( QStringLiteral( "spatialite" ) ); } );
connect( mActionAddMssqlLayer, &QAction::triggered, this, [ = ] { dataSourceManager( QStringLiteral( "mssql" ) ); } );
connect( mActionAddDb2Layer, &QAction::triggered, this, [ = ] { dataSourceManager( QStringLiteral( "DB2" ) ); } );
connect( mActionAddOracleLayer, &QAction::triggered, this, [ = ] { dataSourceManager( QStringLiteral( "oracle" ) ); } );
@@ -5257,7 +5257,7 @@ bool QgisApp::addProject( const QString &projectFile )
0,
mInfoBar );

connect( btnEnableMacros, &QToolButton::clicked, [this, macroMsg]
connect( btnEnableMacros, &QToolButton::clicked, this, [this, macroMsg]
{
enableProjectMacros();
mInfoBar->popWidget( macroMsg );
@@ -8223,7 +8223,7 @@ void QgisApp::canvasRefreshStarted()
mRenderProgressBarTimer.setSingleShot( true );
mRenderProgressBarTimer.setInterval( 500 );
disconnect( mRenderProgressBarTimerConnection );
mRenderProgressBarTimerConnection = connect( &mRenderProgressBarTimer, &QTimer::timeout, [ = ]()
mRenderProgressBarTimerConnection = connect( &mRenderProgressBarTimer, &QTimer::timeout, this, [ = ]()
{
showProgress( -1, 0 );
}
@@ -118,7 +118,7 @@ QgsMapSaveDialog::QgsMapSaveDialog( QWidget *parent, QgsMapCanvas *mapCanvas, co
connect( button, &QPushButton::clicked, this, &QgsMapSaveDialog::copyToClipboard );
}

connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsMapSaveDialog::accepted );
connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsMapSaveDialog::onAccepted );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsMapSaveDialog::showHelp );
}

@@ -349,7 +349,7 @@ void QgsMapSaveDialog::copyToClipboard()
mapRendererTask->addDecorations( mDecorations );
}

connect( mapRendererTask, &QgsMapRendererTask::renderingComplete, [ = ]
connect( mapRendererTask, &QgsMapRendererTask::renderingComplete, this, [ = ]
{
QApplication::clipboard()->setImage( *img, QClipboard::Clipboard );
QApplication::restoreOverrideCursor();
@@ -359,7 +359,7 @@ void QgsMapSaveDialog::copyToClipboard()
delete img;
setEnabled( true );
} );
connect( mapRendererTask, &QgsMapRendererTask::errorOccurred, [ = ]( int )
connect( mapRendererTask, &QgsMapRendererTask::errorOccurred, this, [ = ]( int )
{
QApplication::restoreOverrideCursor();
QgisApp::instance()->messageBar()->pushWarning( tr( "Save as PDF" ), tr( "Could not copy the map to clipboard" ) );
@@ -76,7 +76,7 @@ QgsPalettedRendererWidget::QgsPalettedRendererWidget( QgsRasterLayer *layer, con
mTreeView->setSelectionBehavior( QAbstractItemView::SelectRows );
mTreeView->setDefaultDropAction( Qt::MoveAction );

connect( mTreeView, &QTreeView::customContextMenuRequested, [ = ]( const QPoint & ) { mContextMenu->exec( QCursor::pos() ); }
connect( mTreeView, &QTreeView::customContextMenuRequested, this, [ = ]( const QPoint & ) { mContextMenu->exec( QCursor::pos() ); }
);

btnColorRamp->setShowRandomColorRamp( true );
@@ -55,7 +55,7 @@ QgsSingleBandPseudoColorRendererWidget::QgsSingleBandPseudoColorRendererWidget(
mColormapTreeWidget->setColumnWidth( ColorColumn, 50 );
mColormapTreeWidget->setContextMenuPolicy( Qt::CustomContextMenu );
mColormapTreeWidget->setSelectionMode( QAbstractItemView::ExtendedSelection );
connect( mColormapTreeWidget, &QTreeView::customContextMenuRequested, [ = ]( const QPoint & ) { contextMenu->exec( QCursor::pos() ); }
connect( mColormapTreeWidget, &QTreeView::customContextMenuRequested, this, [ = ]( const QPoint & ) { contextMenu->exec( QCursor::pos() ); }
);

QString defaultPalette = settings.value( QStringLiteral( "Raster/defaultPalette" ), "" ).toString();
@@ -1047,7 +1047,7 @@ void QgsCategorizedSymbolRendererWidget::dataDefinedSizeLegend()
QgsDataDefinedSizeLegendWidget *panel = createDataDefinedSizeLegendWidget( s, mRenderer->dataDefinedSizeLegend() );
if ( panel )
{
connect( panel, &QgsPanelWidget::widgetChanged, [ = ]
connect( panel, &QgsPanelWidget::widgetChanged, this, [ = ]
{
mRenderer->setDataDefinedSizeLegend( panel->dataDefinedSizeLegend() );
emit widgetChanged();
@@ -110,7 +110,7 @@ QgsDataDefinedSizeLegendWidget::QgsDataDefinedSizeLegendWidget( const QgsDataDef
mPreviewModel->setLegendMapViewData( canvas->mapUnitsPerPixel(), canvas->mapSettings().outputDpi(), canvas->scale() );
viewLayerTree->setModel( mPreviewModel );

connect( cboAlignSymbols, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), [ = ] { emit widgetChanged(); } );
connect( cboAlignSymbols, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, [ = ] { emit widgetChanged(); } );
connect( radDisabled, &QRadioButton::clicked, this, &QgsPanelWidget::widgetChanged );
connect( radSeparated, &QRadioButton::clicked, this, &QgsPanelWidget::widgetChanged );
connect( radCollapsed, &QRadioButton::clicked, this, &QgsPanelWidget::widgetChanged );
@@ -1179,7 +1179,7 @@ void QgsGraduatedSymbolRendererWidget::dataDefinedSizeLegend()
QgsDataDefinedSizeLegendWidget *panel = createDataDefinedSizeLegendWidget( s, mRenderer->dataDefinedSizeLegend() );
if ( panel )
{
connect( panel, &QgsPanelWidget::widgetChanged, [ = ]
connect( panel, &QgsPanelWidget::widgetChanged, this, [ = ]
{
mRenderer->setDataDefinedSizeLegend( panel->dataDefinedSizeLegend() );
emit widgetChanged();
@@ -122,7 +122,7 @@ void QgsSingleSymbolRendererWidget::dataDefinedSizeLegend()
QgsDataDefinedSizeLegendWidget *panel = createDataDefinedSizeLegendWidget( s, mRenderer->dataDefinedSizeLegend() );
if ( panel )
{
connect( panel, &QgsPanelWidget::widgetChanged, [ = ]
connect( panel, &QgsPanelWidget::widgetChanged, this, [ = ]
{
mRenderer->setDataDefinedSizeLegend( panel->dataDefinedSizeLegend() );
emit widgetChanged();
@@ -69,15 +69,15 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle *style, QWidget *parent )

connect( listItems, &QAbstractItemView::doubleClicked, this, &QgsStyleManagerDialog::editItem );

connect( btnAddItem, &QPushButton::clicked, [ = ]( bool ) { addItem(); }
connect( btnAddItem, &QPushButton::clicked, this, [ = ]( bool ) { addItem(); }
);
connect( btnEditItem, &QPushButton::clicked, [ = ]( bool ) { editItem(); }
connect( btnEditItem, &QPushButton::clicked, this, [ = ]( bool ) { editItem(); }
);
connect( actnEditItem, &QAction::triggered, [ = ]( bool ) { editItem(); }
connect( actnEditItem, &QAction::triggered, this, [ = ]( bool ) { editItem(); }
);
connect( btnRemoveItem, &QPushButton::clicked, [ = ]( bool ) { removeItem(); }
connect( btnRemoveItem, &QPushButton::clicked, this, [ = ]( bool ) { removeItem(); }
);
connect( actnRemoveItem, &QAction::triggered, [ = ]( bool ) { removeItem(); }
connect( actnRemoveItem, &QAction::triggered, this, [ = ]( bool ) { removeItem(); }
);

QMenu *shareMenu = new QMenu( tr( "Share menu" ), this );
@@ -178,10 +178,10 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle *style, QWidget *parent )
mGroupTreeContextMenu = new QMenu( this );
connect( actnEditSmartGroup, &QAction::triggered, this, &QgsStyleManagerDialog::editSmartgroupAction );
mGroupTreeContextMenu->addAction( actnEditSmartGroup );
connect( actnAddTag, &QAction::triggered, [ = ]( bool ) { addTag(); }
connect( actnAddTag, &QAction::triggered, this, [ = ]( bool ) { addTag(); }
);
mGroupTreeContextMenu->addAction( actnAddTag );
connect( actnAddSmartgroup, &QAction::triggered, [ = ]( bool ) { addSmartgroup(); }
connect( actnAddSmartgroup, &QAction::triggered, this, [ = ]( bool ) { addSmartgroup(); }
);
mGroupTreeContextMenu->addAction( actnAddSmartgroup );
connect( actnRemoveGroup, &QAction::triggered, this, &QgsStyleManagerDialog::removeGroup );
@@ -60,7 +60,7 @@ QList<QAction *> QgsAfsRootItem::actions( QWidget *parent )
QWidget *QgsAfsRootItem::paramWidget()
{
QgsAfsSourceSelect *select = new QgsAfsSourceSelect( 0, 0, QgsProviderRegistry::WidgetMode::Manager );
connect( select, &QgsArcGisServiceSourceSelect::connectionsChanged, this, &QgsAfsRootItem::connectionsChanged );
connect( select, &QgsArcGisServiceSourceSelect::connectionsChanged, this, &QgsAfsRootItem::onConnectionsChanged );
return select;
}

0 comments on commit a7470b3

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