Convert almost all core connects to new style

Just a handful remain which for various reasons cannot
be converted
This commit is contained in:
Nyall Dawson 2017-03-22 10:02:41 +10:00
parent b7d2b9fd72
commit a8e8eec95d
30 changed files with 151 additions and 142 deletions

View File

@ -624,20 +624,20 @@ void QgsComposerLegend::setComposerMap( const QgsComposerMap *map )
{
if ( mComposerMap )
{
disconnect( mComposerMap, SIGNAL( destroyed( QObject * ) ), this, SLOT( invalidateCurrentMap() ) );
disconnect( mComposerMap, SIGNAL( itemChanged() ), this, SLOT( updateFilterByMap() ) );
disconnect( mComposerMap, SIGNAL( extentChanged() ), this, SLOT( updateFilterByMap() ) );
disconnect( mComposerMap, SIGNAL( layerStyleOverridesChanged() ), this, SLOT( mapLayerStyleOverridesChanged() ) );
disconnect( mComposerMap, &QObject::destroyed, this, &QgsComposerLegend::invalidateCurrentMap );
disconnect( mComposerMap, &QgsComposerObject::itemChanged, this, &QgsComposerLegend::updateFilterByMapAndRedraw );
disconnect( mComposerMap, &QgsComposerMap::extentChanged, this, &QgsComposerLegend::updateFilterByMapAndRedraw );
disconnect( mComposerMap, &QgsComposerMap::layerStyleOverridesChanged, this, &QgsComposerLegend::mapLayerStyleOverridesChanged );
}
mComposerMap = map;
if ( map )
{
QObject::connect( map, SIGNAL( destroyed( QObject * ) ), this, SLOT( invalidateCurrentMap() ) );
QObject::connect( map, SIGNAL( itemChanged() ), this, SLOT( updateFilterByMap() ) );
QObject::connect( map, SIGNAL( extentChanged() ), this, SLOT( updateFilterByMap() ) );
QObject::connect( map, SIGNAL( layerStyleOverridesChanged() ), this, SLOT( mapLayerStyleOverridesChanged() ) );
connect( map, &QObject::destroyed, this, &QgsComposerLegend::invalidateCurrentMap );
connect( map, &QgsComposerObject::itemChanged, this, &QgsComposerLegend::updateFilterByMapAndRedraw );
connect( map, &QgsComposerMap::extentChanged, this, &QgsComposerLegend::updateFilterByMapAndRedraw );
connect( map, &QgsComposerMap::layerStyleOverridesChanged, this, &QgsComposerLegend::mapLayerStyleOverridesChanged );
}
updateItem();
@ -684,6 +684,11 @@ void QgsComposerLegend::refreshDataDefinedProperty( const QgsComposerObject::Dat
QgsComposerObject::refreshDataDefinedProperty( property, context );
}
void QgsComposerLegend::updateFilterByMapAndRedraw()
{
updateFilterByMap( true );
}
void QgsComposerLegend::mapLayerStyleOverridesChanged()
{
if ( !mComposerMap )

View File

@ -288,6 +288,9 @@ class CORE_EXPORT QgsComposerLegend : public QgsComposerItem
private slots:
void updateFilterByMapAndRedraw();
void updateFilterByMap( bool redraw = true );
//! update legend in case style of associated map has changed

View File

@ -721,7 +721,7 @@ bool QextSerialPort::open(OpenMode mode)
if (queryMode() == QextSerialPort::EventDriven) {
readNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this);
connect(readNotifier, SIGNAL(activated(int)), this, SIGNAL(readyRead()));
connect(readNotifier, &QSocketNotifier::activated, this, [=] { emit readyRead(); } );
}
} else {
qDebug() << "could not open file:" << strerror(errno);

View File

@ -88,10 +88,10 @@ class QextSerialRegistrationWidget : public QWidget
\b Example
\code
QextSerialEnumerator* enumerator = new QextSerialEnumerator();
connect(enumerator, SIGNAL(deviceDiscovered(const QextPortInfo &)),
myClass, SLOT(onDeviceDiscovered(const QextPortInfo &)));
connect(enumerator, SIGNAL(deviceRemoved(const QextPortInfo &)),
myClass, SLOT(onDeviceRemoved(const QextPortInfo &)));
connect(enumerator, &QextSerialEnumerator::deviceDiscovered,
myClass, &MyObject::onDeviceDiscovered);
connect(enumerator, &QextSerialEnumerator::deviceRemoved,
myClass, &MyObject::onDeviceRemoved);
\endcode
\section Credits

View File

@ -150,7 +150,7 @@ to use, since you never have to worry about checking for new data.
\b Example
\code
QextSerialPort* port = new QextSerialPort("COM1", QextSerialPort::EventDriven);
connect(port, SIGNAL(readyRead()), myClass, SLOT(onDataAvailable()));
connect(port, &QextSerialPort::readyRead, myClass, &MyObject::onDataAvailable);
port->open();
void MyClass::onDataAvailable() {

View File

@ -32,7 +32,7 @@
QgsGPSConnection::QgsGPSConnection( QIODevice *dev ): QObject( nullptr ), mSource( dev ), mStatus( NotConnected )
{
clearLastGPSInformation();
QObject::connect( dev, SIGNAL( readyRead() ), this, SLOT( parseData() ) );
QObject::connect( dev, &QIODevice::readyRead, this, &QgsGPSConnection::parseData );
}
QgsGPSConnection::~QgsGPSConnection()

View File

@ -183,8 +183,8 @@ void QgsGPSDetector::advance()
}
}
connect( mConn, SIGNAL( stateChanged( const QgsGPSInformation & ) ), this, SLOT( detected( const QgsGPSInformation & ) ) );
connect( mConn, SIGNAL( destroyed( QObject * ) ), this, SLOT( connDestroyed( QObject * ) ) );
connect( mConn, &QgsGPSConnection::stateChanged, this, static_cast < void ( QgsGPSDetector::* )( const QgsGPSInformation & ) >( &QgsGPSDetector::detected ) );
connect( mConn, &QObject::destroyed, this, &QgsGPSDetector::connDestroyed );
// leave 2s to pickup a valid string
QTimer::singleShot( 2000, this, SLOT( advance() ) );

View File

@ -171,10 +171,10 @@ void QgsQtLocationConnection::startGPS()
locationDataSource->setUpdateInterval( 1000 );
// Whenever the location data source signals that the current
// position is updated, the positionUpdated function is called.
QObject::connect( locationDataSource,
SIGNAL( positionUpdated( QGeoPositionInfo ) ),
QObject::connect( locationDataSource.data(),
&QGeoPositionInfoSource::positionUpdated,
this,
SLOT( positionUpdated( QGeoPositionInfo ) ) );
&QgsQtLocationConnection::positionUpdated );
// Start listening for position updates
locationDataSource->startUpdates();
}
@ -204,22 +204,18 @@ void QgsQtLocationConnection::startSatelliteMonitor()
// Whenever the satellite info source signals that the number of
// satellites in use is updated, the satellitesInUseUpdated function
// is called
QObject::connect( satelliteInfoSource,
SIGNAL( satellitesInUseUpdated(
const QList<QGeoSatelliteInfo> & ) ),
QObject::connect( satelliteInfoSource.data(),
&QGeoSatelliteInfoSource::satellitesInUseUpdated,
this,
SLOT( satellitesInUseUpdated(
const QList<QGeoSatelliteInfo> & ) ) );
&QgsQtLocationConnection::satellitesInUseUpdated );
// Whenever the satellite info source signals that the number of
// satellites in view is updated, the satellitesInViewUpdated function
// is called
QObject::connect( satelliteInfoSource,
SIGNAL( satellitesInViewUpdated(
const QList<QGeoSatelliteInfo> & ) ),
QObject::connect( satelliteInfoSource.data(),
&QGeoSatelliteInfoSource::satellitesInViewUpdated,
this,
SLOT( satellitesInViewUpdated(
const QList<QGeoSatelliteInfo> & ) ) );
&QgsQtLocationConnection::satellitesInViewUpdated );
// Start listening for satellite updates
satelliteInfoSource->startUpdates();

View File

@ -866,9 +866,10 @@ void QgsLayerTreeModel::connectToLayer( QgsLayerTreeLayer *nodeLayer )
// using unique connection because there may be temporarily more nodes for a layer than just one
// which would create multiple connections, however disconnect() would disconnect all multiple connections
// even if we wanted to disconnect just one connection in each call.
connect( layer, SIGNAL( editingStarted() ), this, SLOT( layerNeedsUpdate() ), Qt::UniqueConnection );
connect( layer, SIGNAL( editingStopped() ), this, SLOT( layerNeedsUpdate() ), Qt::UniqueConnection );
connect( layer, SIGNAL( layerModified() ), this, SLOT( layerNeedsUpdate() ), Qt::UniqueConnection );
QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( layer );
connect( vl, &QgsVectorLayer::editingStarted, this, &QgsLayerTreeModel::layerNeedsUpdate, Qt::UniqueConnection );
connect( vl, &QgsVectorLayer::editingStopped, this, &QgsLayerTreeModel::layerNeedsUpdate, Qt::UniqueConnection );
connect( vl, &QgsVectorLayer::layerModified, this, &QgsLayerTreeModel::layerNeedsUpdate, Qt::UniqueConnection );
}
}

View File

@ -603,9 +603,9 @@ QImage QgsWmsLegendNode::getLegendGraphic() const
mFetcher.reset( prov->getLegendGraphicFetcher( ms ) );
if ( mFetcher )
{
connect( mFetcher.get(), SIGNAL( finish( const QImage & ) ), this, SLOT( getLegendGraphicFinished( const QImage & ) ) );
connect( mFetcher.get(), SIGNAL( error( const QString & ) ), this, SLOT( getLegendGraphicErrored( const QString & ) ) );
connect( mFetcher.get(), SIGNAL( progress( qint64, qint64 ) ), this, SLOT( getLegendGraphicProgress( qint64, qint64 ) ) );
connect( mFetcher.get(), &QgsImageFetcher::finish, this, &QgsWmsLegendNode::getLegendGraphicFinished );
connect( mFetcher.get(), &QgsImageFetcher::error, this, &QgsWmsLegendNode::getLegendGraphicErrored );
connect( mFetcher.get(), &QgsImageFetcher::progress, this, &QgsWmsLegendNode::getLegendGraphicProgress );
mFetcher->start();
} // else QgsDebugMsg("XXX No legend supported?");

View File

@ -207,17 +207,18 @@ void QgsLayerTreeNode::insertChildrenPrivate( int index, QList<QgsLayerTreeNode
emit willAddChildren( this, index, indexTo );
for ( int i = 0; i < nodes.count(); ++i )
{
mChildren.insert( index + i, nodes[i] );
QgsLayerTreeNode *node = nodes.at( i );
mChildren.insert( index + i, node );
// forward the signal towards the root
connect( nodes[i], SIGNAL( willAddChildren( QgsLayerTreeNode *, int, int ) ), this, SIGNAL( willAddChildren( QgsLayerTreeNode *, int, int ) ) );
connect( nodes[i], SIGNAL( addedChildren( QgsLayerTreeNode *, int, int ) ), this, SIGNAL( addedChildren( QgsLayerTreeNode *, int, int ) ) );
connect( nodes[i], SIGNAL( willRemoveChildren( QgsLayerTreeNode *, int, int ) ), this, SIGNAL( willRemoveChildren( QgsLayerTreeNode *, int, int ) ) );
connect( nodes[i], SIGNAL( removedChildren( QgsLayerTreeNode *, int, int ) ), this, SIGNAL( removedChildren( QgsLayerTreeNode *, int, int ) ) );
connect( nodes[i], SIGNAL( customPropertyChanged( QgsLayerTreeNode *, QString ) ), this, SIGNAL( customPropertyChanged( QgsLayerTreeNode *, QString ) ) );
connect( nodes[i], &QgsLayerTreeNode::visibilityChanged, this, &QgsLayerTreeNode::visibilityChanged );
connect( nodes[i], SIGNAL( expandedChanged( QgsLayerTreeNode *, bool ) ), this, SIGNAL( expandedChanged( QgsLayerTreeNode *, bool ) ) );
connect( nodes[i], SIGNAL( nameChanged( QgsLayerTreeNode *, QString ) ), this, SIGNAL( nameChanged( QgsLayerTreeNode *, QString ) ) );
connect( node, &QgsLayerTreeNode::willAddChildren, this, &QgsLayerTreeNode::willAddChildren );
connect( node, &QgsLayerTreeNode::addedChildren, this, &QgsLayerTreeNode::addedChildren );
connect( node, &QgsLayerTreeNode::willRemoveChildren, this, &QgsLayerTreeNode::willRemoveChildren );
connect( node, &QgsLayerTreeNode::removedChildren, this, &QgsLayerTreeNode::removedChildren );
connect( node, &QgsLayerTreeNode::customPropertyChanged, this, &QgsLayerTreeNode::customPropertyChanged );
connect( node, &QgsLayerTreeNode::visibilityChanged, this, &QgsLayerTreeNode::visibilityChanged );
connect( node, &QgsLayerTreeNode::expandedChanged, this, &QgsLayerTreeNode::expandedChanged );
connect( node, &QgsLayerTreeNode::nameChanged, this, &QgsLayerTreeNode::nameChanged );
}
emit addedChildren( this, index, indexTo );
}

View File

@ -46,8 +46,8 @@ QgsBrowserModel::QgsBrowserModel( QObject *parent )
, mFavorites( nullptr )
, mProjectHome( nullptr )
{
connect( QgsProject::instance(), SIGNAL( readProject( const QDomDocument & ) ), this, SLOT( updateProjectHome() ) );
connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ), this, SLOT( updateProjectHome() ) );
connect( QgsProject::instance(), &QgsProject::readProject, this, &QgsBrowserModel::updateProjectHome );
connect( QgsProject::instance(), &QgsProject::writeProject, this, &QgsBrowserModel::updateProjectHome );
addRootItems();
}
@ -413,18 +413,18 @@ void QgsBrowserModel::itemStateChanged( QgsDataItem *item, QgsDataItem::State ol
}
void QgsBrowserModel::connectItem( QgsDataItem *item )
{
connect( item, SIGNAL( beginInsertItems( QgsDataItem *, int, int ) ),
this, SLOT( beginInsertItems( QgsDataItem *, int, int ) ) );
connect( item, SIGNAL( endInsertItems() ),
this, SLOT( endInsertItems() ) );
connect( item, SIGNAL( beginRemoveItems( QgsDataItem *, int, int ) ),
this, SLOT( beginRemoveItems( QgsDataItem *, int, int ) ) );
connect( item, SIGNAL( endRemoveItems() ),
this, SLOT( endRemoveItems() ) );
connect( item, SIGNAL( dataChanged( QgsDataItem * ) ),
this, SLOT( itemDataChanged( QgsDataItem * ) ) );
connect( item, SIGNAL( stateChanged( QgsDataItem *, QgsDataItem::State ) ),
this, SLOT( itemStateChanged( QgsDataItem *, QgsDataItem::State ) ) );
connect( item, &QgsDataItem::beginInsertItems,
this, &QgsBrowserModel::beginInsertItems );
connect( item, &QgsDataItem::endInsertItems,
this, &QgsBrowserModel::endInsertItems );
connect( item, &QgsDataItem::beginRemoveItems,
this, &QgsBrowserModel::beginRemoveItems );
connect( item, &QgsDataItem::endRemoveItems,
this, &QgsBrowserModel::endRemoveItems );
connect( item, &QgsDataItem::dataChanged,
this, &QgsBrowserModel::itemDataChanged );
connect( item, &QgsDataItem::stateChanged,
this, &QgsBrowserModel::itemStateChanged );
}
QStringList QgsBrowserModel::mimeTypes() const

View File

@ -58,9 +58,9 @@ QProcess *QgsContextHelp::start()
QProcess *process = new QProcess;
// Delete this object if the process terminates
connect( process, SIGNAL( finished( int, QProcess::ExitStatus ) ), SLOT( processExited() ) );
connect( process, static_cast < void ( QProcess::* )( int ) >( &QProcess::finished ), this, [ = ] { processExited(); } );
connect( process, SIGNAL( error( QProcess::ProcessError ) ), this, SLOT( error( QProcess::ProcessError ) ) );
connect( process, static_cast < void ( QProcess::* )( QProcess::ProcessError ) >( &QProcess::error ), this, &QgsContextHelp::error );
#ifdef Q_OS_WIN
if ( QgsApplication::isRunningFromBuildDir() )

View File

@ -406,7 +406,7 @@ void QgsDataItem::setParent( QgsDataItem *parent )
connect( this, &QgsDataItem::beginInsertItems, parent, &QgsDataItem::beginInsertItems );
connect( this, &QgsDataItem::endInsertItems, parent, &QgsDataItem::endInsertItems );
connect( this, &QgsDataItem::beginRemoveItems, parent, &QgsDataItem::beginRemoveItems );
connect( this, SIGNAL( endRemoveItems() ), parent, SIGNAL( endRemoveItems() ) );
connect( this, &QgsDataItem::endRemoveItems, parent, &QgsDataItem::endRemoveItems );
connect( this, &QgsDataItem::dataChanged, parent, &QgsDataItem::dataChanged );
connect( this, &QgsDataItem::stateChanged, parent, &QgsDataItem::stateChanged );
}

View File

@ -354,7 +354,7 @@ void QgsGeometryValidator::addError( const QgsGeometry::Error &e )
void QgsGeometryValidator::validateGeometry( const QgsGeometry *g, QList<QgsGeometry::Error> &errors )
{
QgsGeometryValidator *gv = new QgsGeometryValidator( g, &errors );
connect( gv, SIGNAL( errorFound( QgsGeometry::Error ) ), gv, SLOT( addError( QgsGeometry::Error ) ) );
connect( gv, &QgsGeometryValidator::errorFound, gv, &QgsGeometryValidator::addError );
gv->run();
gv->wait();
}

View File

@ -93,8 +93,8 @@ int QgsGml::getFeatures( const QString &uri, QgsWkbTypes::Type *wkbType, QgsRect
}
}
connect( reply, SIGNAL( finished() ), this, SLOT( setFinished() ) );
connect( reply, SIGNAL( downloadProgress( qint64, qint64 ) ), this, SLOT( handleProgressEvent( qint64, qint64 ) ) );
connect( reply, &QNetworkReply::finished, this, &QgsGml::setFinished );
connect( reply, &QNetworkReply::downloadProgress, this, &QgsGml::handleProgressEvent );
//find out if there is a QGIS main window. If yes, display a progress dialog
QProgressDialog *progressDialog = nullptr;
@ -112,9 +112,9 @@ int QgsGml::getFeatures( const QString &uri, QgsWkbTypes::Type *wkbType, QgsRect
{
progressDialog = new QProgressDialog( tr( "Loading GML data\n%1" ).arg( mTypeName ), tr( "Abort" ), 0, 0, mainWindow );
progressDialog->setWindowModality( Qt::ApplicationModal );
connect( this, SIGNAL( dataReadProgress( int ) ), progressDialog, SLOT( setValue( int ) ) );
connect( this, SIGNAL( totalStepsUpdate( int ) ), progressDialog, SLOT( setMaximum( int ) ) );
connect( progressDialog, SIGNAL( canceled() ), this, SLOT( setFinished() ) );
connect( this, &QgsGml::dataReadProgress, progressDialog, &QProgressDialog::setValue );
connect( this, &QgsGml::totalStepsUpdate, progressDialog, &QProgressDialog::setMaximum );
connect( progressDialog, &QProgressDialog::canceled, this, &QgsGml::setFinished );
progressDialog->show();
}

View File

@ -179,7 +179,7 @@ void QgsMapLayerLegendUtils::applyLayerNodeProperties( QgsLayerTreeLayer *nodeLa
QgsDefaultVectorLayerLegend::QgsDefaultVectorLayerLegend( QgsVectorLayer *vl )
: mLayer( vl )
{
connect( mLayer, SIGNAL( rendererChanged() ), this, SIGNAL( itemsChanged() ) );
connect( mLayer, &QgsMapLayer::rendererChanged, this, &QgsMapLayerLegend::itemsChanged );
}
QList<QgsLayerTreeModelLegendNode *> QgsDefaultVectorLayerLegend::createLayerTreeModelLegendNodes( QgsLayerTreeLayer *nodeLayer )
@ -229,7 +229,7 @@ QList<QgsLayerTreeModelLegendNode *> QgsDefaultVectorLayerLegend::createLayerTre
QgsDefaultRasterLayerLegend::QgsDefaultRasterLayerLegend( QgsRasterLayer *rl )
: mLayer( rl )
{
connect( mLayer, SIGNAL( rendererChanged() ), this, SIGNAL( itemsChanged() ) );
connect( mLayer, &QgsMapLayer::rendererChanged, this, &QgsMapLayerLegend::itemsChanged );
}
QList<QgsLayerTreeModelLegendNode *> QgsDefaultRasterLayerLegend::createLayerTreeModelLegendNodes( QgsLayerTreeLayer *nodeLayer )

View File

@ -29,7 +29,7 @@ QgsMapLayerModel::QgsMapLayerModel( const QList<QgsMapLayer *> &layers, QObject
, mAllowEmpty( false )
, mShowCrs( false )
{
connect( QgsProject::instance(), SIGNAL( layersWillBeRemoved( QStringList ) ), this, SLOT( removeLayers( QStringList ) ) );
connect( QgsProject::instance(), static_cast < void ( QgsProject::* )( const QStringList & ) >( &QgsProject::layersWillBeRemoved ), this, &QgsMapLayerModel::removeLayers );
addLayers( layers );
}
@ -40,8 +40,8 @@ QgsMapLayerModel::QgsMapLayerModel( QObject *parent )
, mAllowEmpty( false )
, mShowCrs( false )
{
connect( QgsProject::instance(), SIGNAL( layersAdded( QList<QgsMapLayer *> ) ), this, SLOT( addLayers( QList<QgsMapLayer *> ) ) );
connect( QgsProject::instance(), SIGNAL( layersWillBeRemoved( QStringList ) ), this, SLOT( removeLayers( QStringList ) ) );
connect( QgsProject::instance(), &QgsProject::layersAdded, this, &QgsMapLayerModel::addLayers );
connect( QgsProject::instance(), static_cast < void ( QgsProject::* )( const QStringList & ) >( &QgsProject::layersWillBeRemoved ), this, &QgsMapLayerModel::removeLayers );
addLayers( QgsProject::instance()->mapLayers().values() );
}

View File

@ -66,7 +66,7 @@ void QgsMapRendererSequentialJob::start()
mInternalJob = new QgsMapRendererCustomPainterJob( mSettings, mPainter );
mInternalJob->setCache( mCache );
connect( mInternalJob, SIGNAL( finished() ), SLOT( internalFinished() ) );
connect( mInternalJob, &QgsMapRendererJob::finished, this, &QgsMapRendererSequentialJob::internalFinished );
mInternalJob->start();
}

View File

@ -47,8 +47,8 @@ void QgsMessageLog::emitMessage( const QString &message, const QString &tag, Qgs
QgsMessageLogConsole::QgsMessageLogConsole()
: QObject( QgsApplication::messageLog() )
{
connect( QgsApplication::messageLog(), SIGNAL( messageReceived( QString, QString, QgsMessageLog::MessageLevel ) ),
this, SLOT( logMessage( QString, QString, QgsMessageLog::MessageLevel ) ) );
connect( QgsApplication::messageLog(), static_cast < void ( QgsMessageLog::* )( const QString &, const QString &, QgsMessageLog::MessageLevel ) >( &QgsMessageLog::messageReceived ),
this, &QgsMessageLogConsole::logMessage );
}
void QgsMessageLogConsole::logMessage( const QString &message, const QString &tag, QgsMessageLog::MessageLevel level )

View File

@ -33,6 +33,7 @@
#include <QTimer>
#include <QNetworkReply>
#include <QThreadStorage>
#include <QAuthenticator>
#ifndef QT_NO_SSL
#include <QSslConfiguration>
@ -214,13 +215,13 @@ QNetworkReply *QgsNetworkAccessManager::createRequest( QNetworkAccessManager::Op
// uploadProgress.
QTimer *timer = new QTimer( reply );
timer->setObjectName( QStringLiteral( "timeoutTimer" ) );
connect( timer, SIGNAL( timeout() ), this, SLOT( abortRequest() ) );
connect( timer, &QTimer::timeout, this, &QgsNetworkAccessManager::abortRequest );
timer->setSingleShot( true );
timer->start( s.value( QStringLiteral( "/qgis/networkAndProxy/networkTimeout" ), "60000" ).toInt() );
connect( reply, SIGNAL( downloadProgress( qint64, qint64 ) ), timer, SLOT( start() ) );
connect( reply, SIGNAL( uploadProgress( qint64, qint64 ) ), timer, SLOT( start() ) );
connect( reply, SIGNAL( finished( ) ), timer, SLOT( stop( ) ) );
connect( reply, &QNetworkReply::downloadProgress, timer, [timer] { timer->start(); } );
connect( reply, &QNetworkReply::uploadProgress, timer, [timer] { timer->start(); } );
connect( reply, &QNetworkReply::finished, timer, &QTimer::stop );
QgsDebugMsgLevel( QString( "Created [reply:%1]" ).arg( ( qint64 ) reply, 0, 16 ), 3 );
return reply;
@ -291,20 +292,20 @@ void QgsNetworkAccessManager::setupDefaultProxyAndCache()
if ( sMainNAM != this )
{
connect( this, SIGNAL( authenticationRequired( QNetworkReply *, QAuthenticator * ) ),
sMainNAM, SIGNAL( authenticationRequired( QNetworkReply *, QAuthenticator * ) ),
connect( this, &QNetworkAccessManager::authenticationRequired,
sMainNAM, &QNetworkAccessManager::authenticationRequired,
Qt::BlockingQueuedConnection );
connect( this, SIGNAL( proxyAuthenticationRequired( const QNetworkProxy &, QAuthenticator * ) ),
sMainNAM, SIGNAL( proxyAuthenticationRequired( const QNetworkProxy &, QAuthenticator * ) ),
connect( this, &QNetworkAccessManager::proxyAuthenticationRequired,
sMainNAM, &QNetworkAccessManager::proxyAuthenticationRequired,
Qt::BlockingQueuedConnection );
connect( this, SIGNAL( requestTimedOut( QNetworkReply * ) ),
sMainNAM, SIGNAL( requestTimedOut( QNetworkReply * ) ) );
connect( this, &QgsNetworkAccessManager::requestTimedOut,
sMainNAM, &QgsNetworkAccessManager::requestTimedOut );
#ifndef QT_NO_SSL
connect( this, SIGNAL( sslErrors( QNetworkReply *, const QList<QSslError> & ) ),
sMainNAM, SIGNAL( sslErrors( QNetworkReply *, const QList<QSslError> & ) ),
connect( this, &QNetworkAccessManager::sslErrors,
sMainNAM, &QNetworkAccessManager::sslErrors,
Qt::BlockingQueuedConnection );
#endif
}

View File

@ -59,7 +59,7 @@ void QgsNetworkContentFetcher::fetchContent( const QUrl &url )
}
mReply = QgsNetworkAccessManager::instance()->get( request );
connect( mReply, SIGNAL( finished() ), this, SLOT( contentLoaded() ) );
connect( mReply, &QNetworkReply::finished, this, [ = ] { contentLoaded(); } );
}
QNetworkReply *QgsNetworkContentFetcher::reply()

View File

@ -59,7 +59,7 @@ extern "C"
QgsOfflineEditing::QgsOfflineEditing()
{
connect( QgsProject::instance(), SIGNAL( layerWasAdded( QgsMapLayer * ) ), this, SLOT( layerAdded( QgsMapLayer * ) ) );
connect( QgsProject::instance(), &QgsProject::layerWasAdded, this, &QgsOfflineEditing::layerAdded );
}
/**
@ -1372,17 +1372,18 @@ void QgsOfflineEditing::startListenFeatureChanges()
// enable logging, check if editBuffer is not null
if ( vLayer->editBuffer() )
{
connect( vLayer->editBuffer(), SIGNAL( committedAttributesAdded( const QString &, const QList<QgsField> & ) ),
this, SLOT( committedAttributesAdded( const QString &, const QList<QgsField> & ) ) );
connect( vLayer->editBuffer(), SIGNAL( committedAttributeValuesChanges( const QString &, const QgsChangedAttributesMap & ) ),
this, SLOT( committedAttributeValuesChanges( const QString &, const QgsChangedAttributesMap & ) ) );
connect( vLayer->editBuffer(), SIGNAL( committedGeometriesChanges( const QString &, const QgsGeometryMap & ) ),
this, SLOT( committedGeometriesChanges( const QString &, const QgsGeometryMap & ) ) );
QgsVectorLayerEditBuffer *editBuffer = vLayer->editBuffer();
connect( editBuffer, &QgsVectorLayerEditBuffer::committedAttributesAdded,
this, &QgsOfflineEditing::committedAttributesAdded );
connect( editBuffer, &QgsVectorLayerEditBuffer::committedAttributeValuesChanges,
this, &QgsOfflineEditing::committedAttributeValuesChanges );
connect( editBuffer, &QgsVectorLayerEditBuffer::committedGeometriesChanges,
this, &QgsOfflineEditing::committedGeometriesChanges );
}
connect( vLayer, SIGNAL( committedFeaturesAdded( const QString &, const QgsFeatureList & ) ),
this, SLOT( committedFeaturesAdded( const QString &, const QgsFeatureList & ) ) );
connect( vLayer, SIGNAL( committedFeaturesRemoved( const QString &, const QgsFeatureIds & ) ),
this, SLOT( committedFeaturesRemoved( const QString &, const QgsFeatureIds & ) ) );
connect( vLayer, &QgsVectorLayer::committedFeaturesAdded,
this, &QgsOfflineEditing::committedFeaturesAdded );
connect( vLayer, &QgsVectorLayer::committedFeaturesRemoved,
this, &QgsOfflineEditing::committedFeaturesRemoved );
}
void QgsOfflineEditing::stopListenFeatureChanges()
@ -1391,17 +1392,18 @@ void QgsOfflineEditing::stopListenFeatureChanges()
// disable logging, check if editBuffer is not null
if ( vLayer->editBuffer() )
{
disconnect( vLayer->editBuffer(), SIGNAL( committedAttributesAdded( const QString &, const QList<QgsField> & ) ),
this, SLOT( committedAttributesAdded( const QString &, const QList<QgsField> & ) ) );
disconnect( vLayer->editBuffer(), SIGNAL( committedAttributeValuesChanges( const QString &, const QgsChangedAttributesMap & ) ),
this, SLOT( committedAttributeValuesChanges( const QString &, const QgsChangedAttributesMap & ) ) );
disconnect( vLayer->editBuffer(), SIGNAL( committedGeometriesChanges( const QString &, const QgsGeometryMap & ) ),
this, SLOT( committedGeometriesChanges( const QString &, const QgsGeometryMap & ) ) );
QgsVectorLayerEditBuffer *editBuffer = vLayer->editBuffer();
disconnect( editBuffer, &QgsVectorLayerEditBuffer::committedAttributesAdded,
this, &QgsOfflineEditing::committedAttributesAdded );
disconnect( editBuffer, &QgsVectorLayerEditBuffer::committedAttributeValuesChanges,
this, &QgsOfflineEditing::committedAttributeValuesChanges );
disconnect( editBuffer, &QgsVectorLayerEditBuffer::committedGeometriesChanges,
this, &QgsOfflineEditing::committedGeometriesChanges );
}
disconnect( vLayer, SIGNAL( committedFeaturesAdded( const QString &, const QgsFeatureList & ) ),
this, SLOT( committedFeaturesAdded( const QString &, const QgsFeatureList & ) ) );
disconnect( vLayer, SIGNAL( committedFeaturesRemoved( const QString &, const QgsFeatureIds & ) ),
this, SLOT( committedFeaturesRemoved( const QString &, const QgsFeatureIds & ) ) );
disconnect( vLayer, &QgsVectorLayer::committedFeaturesAdded,
this, &QgsOfflineEditing::committedFeaturesAdded );
disconnect( vLayer, &QgsVectorLayer::committedFeaturesRemoved,
this, &QgsOfflineEditing::committedFeaturesRemoved );
}
void QgsOfflineEditing::layerAdded( QgsMapLayer *layer )
@ -1410,8 +1412,8 @@ void QgsOfflineEditing::layerAdded( QgsMapLayer *layer )
if ( layer->customProperty( CUSTOM_PROPERTY_IS_OFFLINE_EDITABLE, false ).toBool() )
{
QgsVectorLayer *vLayer = qobject_cast<QgsVectorLayer *>( layer );
connect( vLayer, SIGNAL( editingStarted() ), this, SLOT( startListenFeatureChanges() ) );
connect( vLayer, SIGNAL( editingStopped() ), this, SLOT( stopListenFeatureChanges() ) );
connect( vLayer, &QgsVectorLayer::editingStarted, this, &QgsOfflineEditing::startListenFeatureChanges );
connect( vLayer, &QgsVectorLayer::editingStopped, this, &QgsOfflineEditing::stopListenFeatureChanges );
}
}

View File

@ -629,9 +629,9 @@ QgsPointLocator::QgsPointLocator( QgsVectorLayer *layer, const QgsCoordinateRefe
mStorage = StorageManager::createNewMemoryStorageManager();
connect( mLayer, SIGNAL( featureAdded( QgsFeatureId ) ), this, SLOT( onFeatureAdded( QgsFeatureId ) ) );
connect( mLayer, SIGNAL( featureDeleted( QgsFeatureId ) ), this, SLOT( onFeatureDeleted( QgsFeatureId ) ) );
connect( mLayer, SIGNAL( geometryChanged( QgsFeatureId, const QgsGeometry & ) ), this, SLOT( onGeometryChanged( QgsFeatureId, const QgsGeometry & ) ) );
connect( mLayer, &QgsVectorLayer::featureAdded, this, &QgsPointLocator::onFeatureAdded );
connect( mLayer, &QgsVectorLayer::featureDeleted, this, &QgsPointLocator::onFeatureDeleted );
connect( mLayer, &QgsVectorLayer::geometryChanged, this, &QgsPointLocator::onGeometryChanged );
connect( mLayer, &QgsVectorLayer::dataChanged, this, &QgsPointLocator::destroyIndex );
}

View File

@ -339,9 +339,9 @@ QgsProject::QgsProject( QObject *parent )
// whenever layers are added to or removed from the registry,
// layer tree will be updated
mLayerTreeRegistryBridge = new QgsLayerTreeRegistryBridge( mRootGroup, this, this );
connect( this, SIGNAL( layersAdded( QList<QgsMapLayer *> ) ), this, SLOT( onMapLayersAdded( QList<QgsMapLayer *> ) ) );
connect( this, SIGNAL( layersRemoved( QStringList ) ), this, SLOT( cleanTransactionGroups() ) );
connect( this, SIGNAL( layersWillBeRemoved( QList<QgsMapLayer *> ) ), this, SLOT( onMapLayersRemoved( QList<QgsMapLayer *> ) ) );
connect( this, &QgsProject::layersAdded, this, &QgsProject::onMapLayersAdded );
connect( this, &QgsProject::layersRemoved, this, [ = ] { cleanTransactionGroups(); } );
connect( this, static_cast < void ( QgsProject::* )( const QList<QgsMapLayer *> & ) >( &QgsProject::layersWillBeRemoved ), this, &QgsProject::onMapLayersRemoved );
}
@ -1130,7 +1130,7 @@ void QgsProject::onMapLayersAdded( const QList<QgsMapLayer *> &layers )
if ( tgChanged )
emit transactionGroupsChanged();
connect( layer, SIGNAL( configChanged() ), this, SLOT( setDirty() ) );
connect( layer, &QgsMapLayer::configChanged, this, [ = ] { setDirty(); } );
// check if we have to update connections for layers with dependencies
for ( QMap<QString, QgsMapLayer *>::iterator it = existingMaps.begin(); it != existingMaps.end(); it++ )
@ -2128,7 +2128,7 @@ QList<QgsMapLayer *> QgsProject::addMapLayers(
{
myLayer->setParent( this );
}
connect( myLayer, SIGNAL( destroyed( QObject * ) ), this, SLOT( onMapLayerDeleted( QObject * ) ) );
connect( myLayer, &QObject::destroyed, this, &QgsProject::onMapLayerDeleted );
emit layerWasAdded( myLayer );
}
}

View File

@ -25,9 +25,9 @@ QgsRelationManager::QgsRelationManager( QgsProject *project )
: QObject( project )
, mProject( project )
{
connect( project, SIGNAL( readProject( const QDomDocument & ) ), SLOT( readProject( const QDomDocument & ) ) );
connect( project, SIGNAL( writeProject( QDomDocument & ) ), SLOT( writeProject( QDomDocument & ) ) );
connect( project, SIGNAL( layersRemoved( QStringList ) ), this, SLOT( layersRemoved( QStringList ) ) );
connect( project, &QgsProject::readProject, this, &QgsRelationManager::readProject );
connect( project, &QgsProject::writeProject, this, &QgsRelationManager::writeProject );
connect( project, &QgsProject::layersRemoved, this, &QgsRelationManager::layersRemoved );
}
void QgsRelationManager::setRelations( const QList<QgsRelation> &relations )

View File

@ -40,13 +40,13 @@ QgsRunProcess::QgsRunProcess( const QString &action, bool capture )
if ( capture )
{
connect( mProcess, SIGNAL( error( QProcess::ProcessError ) ), this, SLOT( processError( QProcess::ProcessError ) ) );
connect( mProcess, SIGNAL( readyReadStandardOutput() ), this, SLOT( stdoutAvailable() ) );
connect( mProcess, SIGNAL( readyReadStandardError() ), this, SLOT( stderrAvailable() ) );
connect( mProcess, static_cast < void ( QProcess::* )( QProcess::ProcessError ) >( &QProcess::error ), this, &QgsRunProcess::processError );
connect( mProcess, &QProcess::readyReadStandardOutput, this, &QgsRunProcess::stdoutAvailable );
connect( mProcess, &QProcess::readyReadStandardError, this, &QgsRunProcess::stderrAvailable );
// We only care if the process has finished if we are capturing
// the output from the process, hence this connect() call is
// inside the capture if() statement.
connect( mProcess, SIGNAL( finished( int, QProcess::ExitStatus ) ), this, SLOT( processExit( int, QProcess::ExitStatus ) ) );
connect( mProcess, static_cast < void ( QProcess::* )( int, QProcess::ExitStatus ) >( &QProcess::finished ), this, &QgsRunProcess::processExit );
// Use QgsMessageOutput for displaying output to user
// It will delete itself when the dialog box is closed.
@ -59,7 +59,7 @@ QgsRunProcess::QgsRunProcess( const QString &action, bool capture )
QObject *mOutputObj = dynamic_cast<QObject *>( mOutput );
if ( mOutputObj )
{
connect( mOutputObj, SIGNAL( destroyed() ), this, SLOT( dialogGone() ) );
connect( mOutputObj, &QObject::destroyed, this, &QgsRunProcess::dialogGone );
}
// start the process!
@ -141,10 +141,10 @@ void QgsRunProcess::dialogGone()
mOutput = nullptr;
disconnect( mProcess, SIGNAL( error( QProcess::ProcessError ) ), this, SLOT( processError( QProcess::ProcessError ) ) );
disconnect( mProcess, SIGNAL( readyReadStandardOutput() ), this, SLOT( stdoutAvailable() ) );
disconnect( mProcess, SIGNAL( readyReadStandardError() ), this, SLOT( stderrAvailable() ) );
disconnect( mProcess, SIGNAL( finished( int, QProcess::ExitStatus ) ), this, SLOT( processExit( int, QProcess::ExitStatus ) ) );
disconnect( mProcess, static_cast < void ( QProcess::* )( QProcess::ProcessError ) >( &QProcess::error ), this, &QgsRunProcess::processError );
disconnect( mProcess, &QProcess::readyReadStandardOutput, this, &QgsRunProcess::stdoutAvailable );
disconnect( mProcess, &QProcess::readyReadStandardError, this, &QgsRunProcess::stderrAvailable );
disconnect( mProcess, static_cast < void ( QProcess::* )( int, QProcess::ExitStatus ) >( &QProcess::finished ), this, &QgsRunProcess::processExit );
die();
}

View File

@ -583,20 +583,20 @@ void QgsTracer::setLayers( const QList<QgsVectorLayer *> &layers )
Q_FOREACH ( QgsVectorLayer *layer, mLayers )
{
disconnect( layer, SIGNAL( featureAdded( QgsFeatureId ) ), this, SLOT( onFeatureAdded( QgsFeatureId ) ) );
disconnect( layer, SIGNAL( featureDeleted( QgsFeatureId ) ), this, SLOT( onFeatureDeleted( QgsFeatureId ) ) );
disconnect( layer, SIGNAL( geometryChanged( QgsFeatureId, const QgsGeometry & ) ), this, SLOT( onGeometryChanged( QgsFeatureId, const QgsGeometry & ) ) );
disconnect( layer, SIGNAL( destroyed( QObject * ) ), this, SLOT( onLayerDestroyed( QObject * ) ) );
disconnect( layer, &QgsVectorLayer::featureAdded, this, &QgsTracer::onFeatureAdded );
disconnect( layer, &QgsVectorLayer::featureDeleted, this, &QgsTracer::onFeatureDeleted );
disconnect( layer, &QgsVectorLayer::geometryChanged, this, &QgsTracer::onGeometryChanged );
disconnect( layer, &QObject::destroyed, this, &QgsTracer::onLayerDestroyed );
}
mLayers = layers;
Q_FOREACH ( QgsVectorLayer *layer, mLayers )
{
connect( layer, SIGNAL( featureAdded( QgsFeatureId ) ), this, SLOT( onFeatureAdded( QgsFeatureId ) ) );
connect( layer, SIGNAL( featureDeleted( QgsFeatureId ) ), this, SLOT( onFeatureDeleted( QgsFeatureId ) ) );
connect( layer, SIGNAL( geometryChanged( QgsFeatureId, const QgsGeometry & ) ), this, SLOT( onGeometryChanged( QgsFeatureId, const QgsGeometry & ) ) );
connect( layer, SIGNAL( destroyed( QObject * ) ), this, SLOT( onLayerDestroyed( QObject * ) ) );
connect( layer, &QgsVectorLayer::featureAdded, this, &QgsTracer::onFeatureAdded );
connect( layer, &QgsVectorLayer::featureDeleted, this, &QgsTracer::onFeatureDeleted );
connect( layer, &QgsVectorLayer::geometryChanged, this, &QgsTracer::onGeometryChanged );
connect( layer, &QObject::destroyed, this, &QgsTracer::onLayerDestroyed );
}
invalidateGraph();

View File

@ -110,7 +110,7 @@ bool QgsTransaction::addLayer( QgsVectorLayer *layer )
}
connect( this, &QgsTransaction::afterRollback, layer->dataProvider(), &QgsVectorDataProvider::dataChanged );
connect( QgsProject::instance(), SIGNAL( layersWillBeRemoved( QStringList ) ), this, SLOT( onLayersDeleted( QStringList ) ) );
connect( QgsProject::instance(), static_cast < void ( QgsProject::* )( const QStringList & ) >( &QgsProject::layersWillBeRemoved ), this, &QgsTransaction::onLayersDeleted );
mLayers.insert( layer );
if ( mTransactionActive )

View File

@ -160,7 +160,7 @@ void TestQgis::signalBlocker()
{
std::unique_ptr< QCheckBox > checkbox( new QCheckBox() );
QSignalSpy spy( checkbox.get(), SIGNAL( toggled( bool ) ) );
QSignalSpy spy( checkbox.get(), &QCheckBox::toggled );
//first check that signals are not blocked
QVERIFY( !checkbox->signalsBlocked() );