Skip to content
Permalink
Browse files
Flip some connects to new style
  • Loading branch information
nyalldawson committed Mar 21, 2017
1 parent bd17999 commit 0710fb5da82eb45c501c517d7802262a89bed8d7
@@ -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() )
@@ -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()
@@ -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 )
@@ -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();
}
@@ -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();
@@ -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();
@@ -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;
@@ -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()
@@ -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();
@@ -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() );
@@ -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
@@ -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();

@@ -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 );
@@ -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;
@@ -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
@@ -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 )
@@ -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(); } );

}

@@ -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 );
@@ -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 );
@@ -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()
@@ -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;
@@ -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 );
}
}
}
@@ -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 );
@@ -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 );
}
}
}
@@ -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()
@@ -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;
}
@@ -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
@@ -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();

0 comments on commit 0710fb5

Please sign in to comment.