Skip to content
Permalink
Browse files
Fix QObject::connect lambda without capturing this warnings on msvc
  • Loading branch information
nyalldawson committed Nov 4, 2021
1 parent 3a97d92 commit f85d6c6d27ab8f4e7bc4730237e503de05243816
Showing with 5 additions and 3 deletions.
  1. +2 −1 src/app/browser/qgsinbuiltdataitemproviders.cpp
  2. +3 −2 src/app/qgsapplayertreeviewmenuprovider.cpp
@@ -1414,8 +1414,9 @@ void QgsDatabaseItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu *
{
QAction *sqlAction = new QAction( QObject::tr( "Execute SQL…" ), menu );

QObject::connect( sqlAction, &QAction::triggered, item, [ item, context ]
QObject::connect( sqlAction, &QAction::triggered, item, [ item, context, this ]
{
( void )this;
std::unique_ptr<QgsAbstractDatabaseProviderConnection> conn2( item->databaseConnection() );
// This should never happen but let's play safe
if ( ! conn2 )
@@ -226,7 +226,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
{
const std::unique_ptr< QgsAbstractDatabaseProviderConnection> conn { QgsMapLayerUtils::databaseConnection( layer ) };
if ( conn )
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/dbmanager.svg" ) ), tr( "Update SQL Layer…" ), menu, [ layer ]
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/dbmanager.svg" ) ), tr( "Update SQL Layer…" ), menu, [ layer, this ]
{
std::unique_ptr< QgsAbstractDatabaseProviderConnection> conn2 { QgsMapLayerUtils::databaseConnection( layer ) };
if ( conn2 )
@@ -244,8 +244,9 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
queryResultWidget->layout()->setMargin( 0 );
dialog.layout()->addWidget( queryResultWidget );

connect( queryResultWidget, &QgsQueryResultWidget::createSqlVectorLayer, queryResultWidget, [queryResultWidget, layer ]( const QString &, const QString &, const QgsAbstractDatabaseProviderConnection::SqlVectorLayerOptions & options )
connect( queryResultWidget, &QgsQueryResultWidget::createSqlVectorLayer, queryResultWidget, [queryResultWidget, layer, this ]( const QString &, const QString &, const QgsAbstractDatabaseProviderConnection::SqlVectorLayerOptions & options )
{
( void )this;
std::unique_ptr< QgsAbstractDatabaseProviderConnection> conn3 { QgsMapLayerUtils::databaseConnection( layer ) };
if ( conn3 )
{

0 comments on commit f85d6c6

Please sign in to comment.