Skip to content

Commit

Permalink
Flip some connects to new style
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 21, 2017
1 parent bd17999 commit 0710fb5
Show file tree
Hide file tree
Showing 20 changed files with 109 additions and 109 deletions.
6 changes: 3 additions & 3 deletions src/core/auth/qgsauthmanager.cpp
Expand Up @@ -734,7 +734,7 @@ void QgsAuthManager::setScheduledAuthDatabaseErase( bool scheduleErase )
if ( !mScheduledDbEraseTimer )
{
mScheduledDbEraseTimer = new QTimer( this );
connect( mScheduledDbEraseTimer, SIGNAL( timeout() ), this, SLOT( tryToStartDbErase() ) );
connect( mScheduledDbEraseTimer, &QTimer::timeout, this, &QgsAuthManager::tryToStartDbErase );
mScheduledDbEraseTimer->start( mScheduledDbEraseRequestWait * 1000 );
}
else if ( !mScheduledDbEraseTimer->isActive() )
Expand Down Expand Up @@ -2823,8 +2823,8 @@ QgsAuthManager::QgsAuthManager()
, mIgnoredSslErrorsCache( QHash<QString, QSet<QSslError::SslError> >() )
{
mMutex = new QMutex( QMutex::Recursive );
connect( this, SIGNAL( messageOut( const QString &, const QString &, QgsAuthManager::MessageLevel ) ),
this, SLOT( writeToConsole( const QString &, const QString &, QgsAuthManager::MessageLevel ) ) );
connect( this, &QgsAuthManager::messageOut,
this, &QgsAuthManager::writeToConsole );
}

QgsAuthManager::~QgsAuthManager()
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgsatlascomposition.cpp
Expand Up @@ -45,7 +45,7 @@ QgsAtlasComposition::QgsAtlasComposition( QgsComposition *composition )
{

//listen out for layer removal
connect( mComposition->project(), SIGNAL( layersWillBeRemoved( QStringList ) ), this, SLOT( removeLayers( QStringList ) ) );
connect( mComposition->project(), static_cast < void ( QgsProject::* )( const QStringList & ) >( &QgsProject::layersWillBeRemoved ), this, &QgsAtlasComposition::removeLayers );
}

void QgsAtlasComposition::setEnabled( bool enabled )
Expand Down
36 changes: 18 additions & 18 deletions src/core/composer/qgscomposerattributetablev2.cpp
Expand Up @@ -77,21 +77,21 @@ QgsComposerAttributeTableV2::QgsComposerAttributeTableV2( QgsComposition *compos
{
resetColumns();
//listen for modifications to layer and refresh table when they occur
connect( mVectorLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
connect( mVectorLayer, &QgsVectorLayer::layerModified, this, &QgsComposerTableV2::refreshAttributes );
}

if ( mComposition )
{
connect( mComposition->project(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( removeLayer( const QString & ) ) );
connect( mComposition->project(), static_cast < void ( QgsProject::* )( const QString & ) >( &QgsProject::layerWillBeRemoved ), this, &QgsComposerAttributeTableV2::removeLayer );

//refresh table attributes when composition is refreshed
connect( mComposition, &QgsComposition::refreshItemsTriggered, this, &QgsComposerTableV2::refreshAttributes );

//connect to atlas feature changes to update table rows
connect( &mComposition->atlasComposition(), SIGNAL( featureChanged( QgsFeature * ) ), this, SLOT( refreshAttributes() ) );
connect( &mComposition->atlasComposition(), &QgsAtlasComposition::featureChanged, this, &QgsComposerTableV2::refreshAttributes );

//atlas coverage layer change = regenerate columns
connect( &mComposition->atlasComposition(), SIGNAL( coverageLayerChanged( QgsVectorLayer * ) ), this, SLOT( atlasLayerChanged( QgsVectorLayer * ) ) );
connect( &mComposition->atlasComposition(), &QgsAtlasComposition::coverageLayerChanged, this, &QgsComposerAttributeTableV2::atlasLayerChanged );
}
refreshAttributes();
}
Expand All @@ -117,14 +117,14 @@ void QgsComposerAttributeTableV2::setVectorLayer( QgsVectorLayer *layer )
if ( prevLayer )
{
//disconnect from previous layer
disconnect( prevLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
disconnect( prevLayer, &QgsVectorLayer::layerModified, this, &QgsComposerTableV2::refreshAttributes );
}

//rebuild column list to match all columns from layer
resetColumns();

//listen for modifications to layer and refresh table when they occur
connect( mVectorLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
connect( mVectorLayer, &QgsVectorLayer::layerModified, this, &QgsComposerTableV2::refreshAttributes );
}

refreshAttributes();
Expand All @@ -149,14 +149,14 @@ void QgsComposerAttributeTableV2::setRelationId( const QString &relationId )
if ( prevLayer )
{
//disconnect from previous layer
disconnect( prevLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
disconnect( prevLayer, &QgsVectorLayer::layerModified, this, &QgsComposerTableV2::refreshAttributes );
}

//rebuild column list to match all columns from layer
resetColumns();

//listen for modifications to layer and refresh table when they occur
connect( newLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
connect( newLayer, &QgsVectorLayer::layerModified, this, &QgsComposerTableV2::refreshAttributes );
}

refreshAttributes();
Expand All @@ -175,7 +175,7 @@ void QgsComposerAttributeTableV2::atlasLayerChanged( QgsVectorLayer *layer )
if ( mCurrentAtlasLayer )
{
//disconnect from previous layer
disconnect( mCurrentAtlasLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
disconnect( mCurrentAtlasLayer, &QgsVectorLayer::layerModified, this, &QgsComposerTableV2::refreshAttributes );
}

mCurrentAtlasLayer = layer;
Expand All @@ -185,7 +185,7 @@ void QgsComposerAttributeTableV2::atlasLayerChanged( QgsVectorLayer *layer )
refreshAttributes();

//listen for modifications to layer and refresh table when they occur
connect( layer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
connect( layer, &QgsVectorLayer::layerModified, this, &QgsComposerTableV2::refreshAttributes );
}

void QgsComposerAttributeTableV2::resetColumns()
Expand Down Expand Up @@ -224,13 +224,13 @@ void QgsComposerAttributeTableV2::setComposerMap( const QgsComposerMap *map )
if ( mComposerMap )
{
//disconnect from previous map
disconnect( mComposerMap, SIGNAL( extentChanged() ), this, SLOT( refreshAttributes() ) );
disconnect( mComposerMap, &QgsComposerMap::extentChanged, this, &QgsComposerTableV2::refreshAttributes );
}
mComposerMap = map;
if ( mComposerMap )
{
//listen out for extent changes in linked map
connect( mComposerMap, SIGNAL( extentChanged() ), this, SLOT( refreshAttributes() ) );
connect( mComposerMap, &QgsComposerMap::extentChanged, this, &QgsComposerTableV2::refreshAttributes );
}
refreshAttributes();
emit changed();
Expand Down Expand Up @@ -684,7 +684,7 @@ bool QgsComposerAttributeTableV2::readXml( const QDomElement &itemElem, const QD
if ( prevLayer )
{
//disconnect from previous layer
disconnect( prevLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
disconnect( prevLayer, &QgsVectorLayer::layerModified, this, &QgsComposerTableV2::refreshAttributes );
}

mSource = QgsComposerAttributeTableV2::ContentSource( itemElem.attribute( QStringLiteral( "source" ), QStringLiteral( "0" ) ).toInt() );
Expand Down Expand Up @@ -722,7 +722,7 @@ bool QgsComposerAttributeTableV2::readXml( const QDomElement &itemElem, const QD
if ( mComposerMap )
{
//if we have found a valid map item, listen out to extent changes on it and refresh the table
connect( mComposerMap, SIGNAL( extentChanged() ), this, SLOT( refreshAttributes() ) );
connect( mComposerMap, &QgsComposerMap::extentChanged, this, &QgsComposerTableV2::refreshAttributes );
}

//vector layer
Expand All @@ -741,7 +741,7 @@ bool QgsComposerAttributeTableV2::readXml( const QDomElement &itemElem, const QD
}

//connect to new layer
connect( sourceLayer(), SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
connect( sourceLayer(), &QgsVectorLayer::layerModified, this, &QgsComposerTableV2::refreshAttributes );

refreshAttributes();

Expand All @@ -752,7 +752,7 @@ bool QgsComposerAttributeTableV2::readXml( const QDomElement &itemElem, const QD
void QgsComposerAttributeTableV2::addFrame( QgsComposerFrame *frame, bool recalcFrameSizes )
{
mFrameItems.push_back( frame );
connect( frame, SIGNAL( sizeChanged() ), this, SLOT( recalculateFrameSizes() ) );
connect( frame, &QgsComposerItem::sizeChanged, this, &QgsComposerTableV2::recalculateFrameSizes );
if ( mComposition )
{
mComposition->addComposerTableFrame( this, frame );
Expand Down Expand Up @@ -780,11 +780,11 @@ void QgsComposerAttributeTableV2::setSource( const QgsComposerAttributeTableV2::
//disconnect from previous layer
if ( prevLayer )
{
disconnect( prevLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
disconnect( prevLayer, &QgsVectorLayer::layerModified, this, &QgsComposerTableV2::refreshAttributes );
}

//connect to new layer
connect( newLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
connect( newLayer, &QgsVectorLayer::layerModified, this, &QgsComposerTableV2::refreshAttributes );
if ( mSource == QgsComposerAttributeTableV2::AtlasFeature )
{
mCurrentAtlasLayer = newLayer;
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposerframe.cpp
Expand Up @@ -28,7 +28,7 @@ QgsComposerFrame::QgsComposerFrame( QgsComposition *c, QgsComposerMultiFrame *mf
setBackgroundEnabled( false );

//repaint frame when multiframe content changes
connect( mf, SIGNAL( contentsChanged() ), this, SLOT( repaint() ) );
connect( mf, &QgsComposerMultiFrame::contentsChanged, this, &QgsComposerItem::repaint );
if ( mf )
{
//force recalculation of rect, so that multiframe specified sizes can be applied
Expand Down
10 changes: 5 additions & 5 deletions src/core/composer/qgscomposerhtml.cpp
Expand Up @@ -65,10 +65,10 @@ QgsComposerHtml::QgsComposerHtml( QgsComposition *c, bool createUndoCommands )
mWebPage->setPalette( palette );

mWebPage->setNetworkAccessManager( QgsNetworkAccessManager::instance() );
QObject::connect( mWebPage, SIGNAL( loadFinished( bool ) ), this, SLOT( frameLoaded( bool ) ) );
connect( mWebPage, &QWebPage::loadFinished, this, &QgsComposerHtml::frameLoaded );
if ( mComposition )
{
QObject::connect( mComposition, SIGNAL( itemRemoved( QgsComposerItem * ) ), this, SLOT( handleFrameRemoval( QgsComposerItem * ) ) );
connect( mComposition, &QgsComposition::itemRemoved, this, &QgsComposerMultiFrame::handleFrameRemoval );
}

if ( mComposition && mComposition->atlasMode() == QgsComposition::PreviewAtlas )
Expand All @@ -80,10 +80,10 @@ QgsComposerHtml::QgsComposerHtml( QgsComposition *c, bool createUndoCommands )

//connect to atlas feature changes
//to update the expression context
connect( &mComposition->atlasComposition(), SIGNAL( featureChanged( QgsFeature * ) ), this, SLOT( refreshExpressionContext() ) );
connect( &mComposition->atlasComposition(), &QgsAtlasComposition::featureChanged, this, &QgsComposerHtml::refreshExpressionContext );

mFetcher = new QgsNetworkContentFetcher();
connect( mFetcher, SIGNAL( finished() ), this, SLOT( frameLoaded() ) );
connect( mFetcher, &QgsNetworkContentFetcher::finished, this, [ = ] { frameLoaded(); } );

}

Expand Down Expand Up @@ -329,7 +329,7 @@ double QgsComposerHtml::htmlUnitsToMM()
void QgsComposerHtml::addFrame( QgsComposerFrame *frame, bool recalcFrameSizes )
{
mFrameItems.push_back( frame );
QObject::connect( frame, SIGNAL( sizeChanged() ), this, SLOT( recalculateFrameSizes() ) );
connect( frame, &QgsComposerItem::sizeChanged, this, &QgsComposerHtml::recalculateFrameSizes );
if ( mComposition )
{
mComposition->addComposerHtmlFrame( this, frame );
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposeritemgroup.cpp
Expand Up @@ -58,7 +58,7 @@ void QgsComposerItemGroup::addItem( QgsComposerItem *item )
return;
}

connect( item, SIGNAL( destroyed() ), this, SLOT( itemDestroyed() ) );
connect( item, &QObject::destroyed, this, &QgsComposerItemGroup::itemDestroyed );

mItems.insert( item );
item->setSelected( false );
Expand Down
6 changes: 3 additions & 3 deletions src/core/composer/qgscomposerlegend.cpp
Expand Up @@ -48,12 +48,12 @@ QgsComposerLegend::QgsComposerLegend( QgsComposition *composition )
{
mLegendModel = new QgsLegendModel( mComposition->project()->layerTreeRoot() );

connect( &composition->atlasComposition(), SIGNAL( renderEnded() ), this, SLOT( onAtlasEnded() ) );
connect( &composition->atlasComposition(), SIGNAL( featureChanged( QgsFeature * ) ), this, SLOT( onAtlasFeature( QgsFeature * ) ) );
connect( &composition->atlasComposition(), &QgsAtlasComposition::renderEnded, this, &QgsComposerLegend::onAtlasEnded );
connect( &composition->atlasComposition(), &QgsAtlasComposition::featureChanged, this, &QgsComposerLegend::onAtlasFeature );

// Connect to the main layertreeroot.
// It serves in "auto update mode" as a medium between the main app legend and this one
connect( mComposition->project()->layerTreeRoot(), SIGNAL( customPropertyChanged( QgsLayerTreeNode *, QString ) ), this, SLOT( nodeCustomPropertyChanged( QgsLayerTreeNode *, QString ) ) );
connect( mComposition->project()->layerTreeRoot(), &QgsLayerTreeNode::customPropertyChanged, this, &QgsComposerLegend::nodeCustomPropertyChanged );
}

QgsComposerLegend::QgsComposerLegend()
Expand Down
4 changes: 2 additions & 2 deletions src/core/composer/qgscomposermapoverview.cpp
Expand Up @@ -211,7 +211,7 @@ void QgsComposerMapOverview::setFrameMap( const int mapId )
const QgsComposerMap *map = mComposerMap->composition()->getComposerMapById( mFrameMapId );
if ( map )
{
QObject::disconnect( map, SIGNAL( extentChanged() ), this, SLOT( overviewExtentChanged() ) );
disconnect( map, &QgsComposerMap::extentChanged, this, &QgsComposerMapOverview::overviewExtentChanged );
}
}
mFrameMapId = mapId;
Expand All @@ -231,7 +231,7 @@ void QgsComposerMapOverview::connectSignals()
const QgsComposerMap *map = mComposerMap->composition()->getComposerMapById( mFrameMapId );
if ( map )
{
QObject::connect( map, SIGNAL( extentChanged() ), this, SLOT( overviewExtentChanged() ) );
connect( map, &QgsComposerMap::extentChanged, this, &QgsComposerMapOverview::overviewExtentChanged );
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/core/composer/qgscomposermousehandles.cpp
Expand Up @@ -46,7 +46,7 @@ QgsComposerMouseHandles::QgsComposerMouseHandles( QgsComposition *composition )
, mVAlignSnapItem( nullptr )
{
//listen for selection changes, and update handles accordingly
QObject::connect( mComposition, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) );
connect( mComposition, &QGraphicsScene::selectionChanged, this, &QgsComposerMouseHandles::selectionChanged );

//accept hover events, required for changing cursor to resize cursors
setAcceptHoverEvents( true );
Expand Down Expand Up @@ -211,17 +211,17 @@ void QgsComposerMouseHandles::selectionChanged()
{
if ( item->selected() )
{
QObject::connect( item, SIGNAL( sizeChanged() ), this, SLOT( selectedItemSizeChanged() ) );
QObject::connect( item, SIGNAL( itemRotationChanged( double ) ), this, SLOT( selectedItemRotationChanged() ) );
QObject::connect( item, SIGNAL( frameChanged() ), this, SLOT( selectedItemSizeChanged() ) );
QObject::connect( item, SIGNAL( lockChanged() ), this, SLOT( selectedItemSizeChanged() ) );
connect( item, &QgsComposerItem::sizeChanged, this, &QgsComposerMouseHandles::selectedItemSizeChanged );
connect( item, &QgsComposerItem::itemRotationChanged, this, &QgsComposerMouseHandles::selectedItemRotationChanged );
connect( item, &QgsComposerItem::frameChanged, this, &QgsComposerMouseHandles::selectedItemSizeChanged );
connect( item, &QgsComposerItem::lockChanged, this, &QgsComposerMouseHandles::selectedItemSizeChanged );
}
else
{
QObject::disconnect( item, SIGNAL( sizeChanged() ), this, nullptr );
QObject::disconnect( item, SIGNAL( itemRotationChanged( double ) ), this, nullptr );
QObject::disconnect( item, SIGNAL( frameChanged() ), this, nullptr );
QObject::disconnect( item, SIGNAL( lockChanged() ), this, nullptr );
disconnect( item, &QgsComposerItem::sizeChanged, this, &QgsComposerMouseHandles::selectedItemSizeChanged );
disconnect( item, &QgsComposerItem::itemRotationChanged, this, &QgsComposerMouseHandles::selectedItemRotationChanged );
disconnect( item, &QgsComposerItem::frameChanged, this, &QgsComposerMouseHandles::selectedItemSizeChanged );
disconnect( item, &QgsComposerItem::lockChanged, this, &QgsComposerMouseHandles::selectedItemSizeChanged );
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/core/composer/qgscomposermultiframe.cpp
Expand Up @@ -25,7 +25,7 @@ QgsComposerMultiFrame::QgsComposerMultiFrame( QgsComposition *c, bool createUndo
, mIsRecalculatingSize( false )
{
mComposition->addMultiFrame( this );
connect( mComposition, SIGNAL( nPagesChanged() ), this, SLOT( handlePageChange() ) );
connect( mComposition, &QgsComposition::nPagesChanged, this, &QgsComposerMultiFrame::handlePageChange );
}

QgsComposerMultiFrame::QgsComposerMultiFrame()
Expand Down Expand Up @@ -315,13 +315,13 @@ void QgsComposerMultiFrame::deleteFrames()
{
ResizeMode bkResizeMode = mResizeMode;
mResizeMode = UseExistingFrames;
QObject::disconnect( mComposition, SIGNAL( itemRemoved( QgsComposerItem * ) ), this, SLOT( handleFrameRemoval( QgsComposerItem * ) ) );
disconnect( mComposition, &QgsComposition::itemRemoved, this, &QgsComposerMultiFrame::handleFrameRemoval );
Q_FOREACH ( QgsComposerFrame *frame, mFrameItems )
{
mComposition->removeComposerItem( frame, false );
delete frame;
}
QObject::connect( mComposition, SIGNAL( itemRemoved( QgsComposerItem * ) ), this, SLOT( handleFrameRemoval( QgsComposerItem * ) ) );
connect( mComposition, &QgsComposition::itemRemoved, this, &QgsComposerMultiFrame::handleFrameRemoval );
mFrameItems.clear();
mResizeMode = bkResizeMode;
}
Expand Down
10 changes: 5 additions & 5 deletions src/core/composer/qgscomposermultiframe.h
Expand Up @@ -253,6 +253,11 @@ class CORE_EXPORT QgsComposerMultiFrame: public QgsComposerObject
*/
void recalculateFrameRects();

/** Called before a frame is going to be removed. Updates frame list and recalculates
* content of remaining frames.
*/
void handleFrameRemoval( QgsComposerItem *item );

signals:

/** Emitted when the properties of a multi frame have changed, and the GUI item widget
Expand All @@ -276,11 +281,6 @@ class CORE_EXPORT QgsComposerMultiFrame: public QgsComposerObject

protected slots:

/** Called before a frame is going to be removed. Updates frame list and recalculates
* content of remaining frames.
*/
void handleFrameRemoval( QgsComposerItem *item );

/** Adapts to changed number of composition pages if resize type is RepeatOnEveryPage.
*/
void handlePageChange();
Expand Down

0 comments on commit 0710fb5

Please sign in to comment.