Skip to content
Permalink
Browse files

Flip some connects to new style

  • Loading branch information
nyalldawson committed Nov 1, 2016
1 parent 70d7ce1 commit 47109d13b7d5c8f6e7e1299d18a2a5ce643883d4
@@ -603,13 +603,17 @@ QgsCptCityColorRampDialog {#qgis_api_break_3_0_QgsCptCityColorRampDialog}
and the new ramp can be retrieved after executing the dialog by calling ramp().
- Some internal methods which were previously public or protected were made private.

QgsCptCityDataItem {#qgis_api_break_3_0_QgsCptCityDataItem}
-----------------------

- emitBeginInsertItems, emitEndInsertItems, emitBeginRemoveItems and emitEndRemoveItems were removed. There
should be no need to call these slots manually.

QgsCptCitySelectionItem {#qgis_api_break_3_0_QgsCptCitySelectionItem}
-----------------------

- parseXML() has been renamed to parseXml()


QgsCRSCache {#qgis_api_break_3_0_QgsCRSCache}
-----------

@@ -129,12 +129,6 @@ class QgsCptCityDataItem : QObject

bool isValid();

public slots:
void emitBeginInsertItems( QgsCptCityDataItem* parent, int first, int last );
void emitEndInsertItems();
void emitBeginRemoveItems( QgsCptCityDataItem* parent, int first, int last );
void emitEndRemoveItems();

signals:
void beginInsertItems( QgsCptCityDataItem* parent, int first, int last );
void endInsertItems();
@@ -10249,7 +10249,7 @@ void QgisApp::layersWereAdded( const QList<QgsMapLayer *>& theLayers )
connect( rlayer, SIGNAL( drawingProgress( int, int ) ), this, SLOT( showProgress( int, int ) ) );

// connect up any request the raster may make to update the statusbar message
connect( rlayer, SIGNAL( statusChanged( QString ) ), this, SLOT( showStatusMessage( QString ) ) );
connect( rlayer, &QgsRasterLayer::statusChanged, this, &QgisApp::showStatusMessage );

provider = rlayer->dataProvider();
}
@@ -837,7 +837,7 @@ void QgsLayerTreeModel::connectToLayer( QgsLayerTreeLayer* nodeLayer )
}

QgsMapLayer* layer = nodeLayer->layer();
connect( layer, SIGNAL( legendChanged() ), this, SLOT( layerLegendChanged() ), Qt::UniqueConnection );
connect( layer, &QgsMapLayer::legendChanged, this, &QgsLayerTreeModel::layerLegendChanged, Qt::UniqueConnection );

if ( layer->type() == QgsMapLayer::VectorLayer )
{
@@ -1649,7 +1649,7 @@ void QgsMapLayer::setLegend( QgsMapLayerLegend* legend )
mLegend = legend;

if ( mLegend )
connect( mLegend, SIGNAL( itemsChanged() ), this, SIGNAL( legendChanged() ) );
connect( mLegend, &QgsMapLayerLegend::itemsChanged, this, &QgsMapLayer::legendChanged );

emit legendChanged();
}
@@ -53,8 +53,8 @@ bool QgsTransactionGroup::addLayer( QgsVectorLayer* layer )

mLayers.insert( layer );

connect( layer, SIGNAL( beforeEditingStarted() ), this, SLOT( onEditingStarted() ) );
connect( layer, SIGNAL( destroyed() ), this, SLOT( onLayerDeleted() ) );
connect( layer, &QgsVectorLayer::beforeEditingStarted, this, &QgsTransactionGroup::onEditingStarted );
connect( layer, &QgsVectorLayer::destroyed, this, &QgsTransactionGroup::onLayerDeleted );

return true;
}
@@ -88,8 +88,8 @@ void QgsTransactionGroup::onEditingStarted()
{
mTransaction->addLayer( layer );
layer->startEditing();
connect( layer, SIGNAL( beforeCommitChanges() ), this, SLOT( onCommitChanges() ) );
connect( layer, SIGNAL( beforeRollBack() ), this, SLOT( onRollback() ) );
connect( layer, &QgsVectorLayer::beforeCommitChanges, this, &QgsTransactionGroup::onCommitChanges );
connect( layer, &QgsVectorLayer::beforeRollBack, this, &QgsTransactionGroup::onRollback );
}
}

@@ -160,8 +160,8 @@ void QgsTransactionGroup::disableTransaction()

Q_FOREACH ( QgsVectorLayer* layer, mLayers )
{
disconnect( layer, SIGNAL( beforeCommitChanges() ), this, SLOT( onCommitChanges() ) );
disconnect( layer, SIGNAL( beforeRollBack() ), this, SLOT( onRollback() ) );
disconnect( layer, &QgsVectorLayer::beforeCommitChanges, this, &QgsTransactionGroup::onCommitChanges );
disconnect( layer, &QgsVectorLayer::beforeRollBack, this, &QgsTransactionGroup::onRollback );
}
}

@@ -157,7 +157,7 @@ QgsVectorLayer::QgsVectorLayer( const QString& vectorLayerPath,

connect( this, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SIGNAL( selectionChanged() ) );
connect( this, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SIGNAL( repaintRequested() ) );
connect( QgsProject::instance()->relationManager(), SIGNAL( relationsLoaded() ), this, SLOT( onRelationsLoaded() ) );
connect( QgsProject::instance()->relationManager(), &QgsRelationManager::relationsLoaded, this, &QgsVectorLayer::onRelationsLoaded );

// Default simplify drawing settings
QSettings settings;
@@ -1329,30 +1329,21 @@ bool QgsVectorLayer::startEditing()
mEditBuffer = new QgsVectorLayerEditBuffer( this );
}
// forward signals
connect( mEditBuffer, SIGNAL( layerModified() ), this, SLOT( invalidateSymbolCountedFlag() ) );
connect( mEditBuffer, SIGNAL( layerModified() ), this, SIGNAL( layerModified() ) ); // TODO[MD]: necessary?
connect( mEditBuffer, &QgsVectorLayerEditBuffer::layerModified, this, &QgsVectorLayer::invalidateSymbolCountedFlag );
connect( mEditBuffer, &QgsVectorLayerEditBuffer::layerModified, this, &QgsVectorLayer::layerModified ); // TODO[MD]: necessary?
//connect( mEditBuffer, SIGNAL( layerModified() ), this, SLOT( triggerRepaint() ) ); // TODO[MD]: works well?
connect( mEditBuffer, SIGNAL( featureAdded( QgsFeatureId ) ), this, SIGNAL( featureAdded( QgsFeatureId ) ) );
connect( mEditBuffer, SIGNAL( featureDeleted( QgsFeatureId ) ), this, SLOT( onFeatureDeleted( QgsFeatureId ) ) );
connect( mEditBuffer, SIGNAL( geometryChanged( QgsFeatureId, const QgsGeometry& ) ), this, SIGNAL( geometryChanged( QgsFeatureId, const QgsGeometry& ) ) );
connect( mEditBuffer, SIGNAL( attributeValueChanged( QgsFeatureId, int, QVariant ) ), this, SIGNAL( attributeValueChanged( QgsFeatureId, int, QVariant ) ) );
connect( mEditBuffer, SIGNAL( attributeAdded( int ) ), this, SIGNAL( attributeAdded( int ) ) );
connect( mEditBuffer, SIGNAL( attributeDeleted( int ) ), this, SIGNAL( attributeDeleted( int ) ) );

connect( mEditBuffer, SIGNAL( committedAttributesDeleted( const QString &, const QgsAttributeList & ) ),
this, SIGNAL( committedAttributesDeleted( const QString &, const QgsAttributeList & ) ) );

connect( mEditBuffer, SIGNAL( committedAttributesAdded( const QString &, const QList<QgsField> & ) ),
this, SIGNAL( committedAttributesAdded( const QString &, const QList<QgsField> & ) ) );

connect( mEditBuffer, SIGNAL( committedFeaturesAdded( QString, QgsFeatureList ) ), this, SIGNAL( committedFeaturesAdded( QString, QgsFeatureList ) ) );
connect( mEditBuffer, SIGNAL( committedFeaturesRemoved( QString, QgsFeatureIds ) ), this, SIGNAL( committedFeaturesRemoved( QString, QgsFeatureIds ) ) );

connect( mEditBuffer, SIGNAL( committedAttributeValuesChanges( const QString &, const QgsChangedAttributesMap & ) ),
this, SIGNAL( committedAttributeValuesChanges( const QString &, const QgsChangedAttributesMap & ) ) );

connect( mEditBuffer, SIGNAL( committedGeometriesChanges( const QString &, const QgsGeometryMap & ) ),
this, SIGNAL( committedGeometriesChanges( const QString &, const QgsGeometryMap & ) ) );
connect( mEditBuffer, &QgsVectorLayerEditBuffer::featureAdded, this, &QgsVectorLayer::featureAdded );
connect( mEditBuffer, &QgsVectorLayerEditBuffer::featureDeleted, this, &QgsVectorLayer::onFeatureDeleted );
connect( mEditBuffer, &QgsVectorLayerEditBuffer::geometryChanged, this, &QgsVectorLayer::geometryChanged );
connect( mEditBuffer, &QgsVectorLayerEditBuffer::attributeValueChanged, this, &QgsVectorLayer::attributeValueChanged );
connect( mEditBuffer, &QgsVectorLayerEditBuffer::attributeAdded, this, &QgsVectorLayer::attributeAdded );
connect( mEditBuffer, &QgsVectorLayerEditBuffer::attributeDeleted, this, &QgsVectorLayer::attributeDeleted );
connect( mEditBuffer, &QgsVectorLayerEditBuffer::committedAttributesDeleted, this, &QgsVectorLayer::committedAttributesDeleted );
connect( mEditBuffer, &QgsVectorLayerEditBuffer::committedAttributesAdded, this, &QgsVectorLayer::committedAttributesAdded );
connect( mEditBuffer, &QgsVectorLayerEditBuffer::committedFeaturesAdded, this, &QgsVectorLayer::committedFeaturesAdded );
connect( mEditBuffer, &QgsVectorLayerEditBuffer::committedFeaturesRemoved, this, &QgsVectorLayer::committedFeaturesRemoved );
connect( mEditBuffer, &QgsVectorLayerEditBuffer::committedAttributeValuesChanges, this, &QgsVectorLayer::committedAttributeValuesChanges );
connect( mEditBuffer, &QgsVectorLayerEditBuffer::committedGeometriesChanges, this, &QgsVectorLayer::committedGeometriesChanges );

updateFields();

@@ -1416,7 +1407,7 @@ bool QgsVectorLayer::readXml( const QDomNode& layer_node )
if ( !mJoinBuffer )
{
mJoinBuffer = new QgsVectorLayerJoinBuffer( this );
connect( mJoinBuffer, SIGNAL( joinedFieldsChanged() ), this, SLOT( onJoinedFieldsChanged() ) );
connect( mJoinBuffer, &QgsVectorLayerJoinBuffer::joinedFieldsChanged, this, &QgsVectorLayer::onJoinedFieldsChanged );
}
mJoinBuffer->readXml( layer_node );

@@ -1525,7 +1516,7 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )
return false;
}

connect( mDataProvider, SIGNAL( raiseError( QString ) ), this, SIGNAL( raiseError( QString ) ) );
connect( mDataProvider, &QgsVectorDataProvider::raiseError, this, &QgsVectorLayer::raiseError );

QgsDebugMsg( "Instantiated the data provider plugin" );

@@ -1537,13 +1528,13 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )
}

// TODO: Check if the provider has the capability to send fullExtentCalculated
connect( mDataProvider, SIGNAL( fullExtentCalculated() ), this, SLOT( updateExtents() ) );
connect( mDataProvider, &QgsVectorDataProvider::fullExtentCalculated, this, &QgsVectorLayer::updateExtents );

// get and store the feature type
mWkbType = mDataProvider->wkbType();

mJoinBuffer = new QgsVectorLayerJoinBuffer( this );
connect( mJoinBuffer, SIGNAL( joinedFieldsChanged() ), this, SLOT( onJoinedFieldsChanged() ) );
connect( mJoinBuffer, &QgsVectorLayerJoinBuffer::joinedFieldsChanged, this, &QgsVectorLayer::onJoinedFieldsChanged );
mExpressionFieldBuffer = new QgsExpressionFieldBuffer();
updateFields();

@@ -4165,11 +4156,11 @@ bool QgsVectorLayer::setDependencies( const QSet<QgsMapLayerDependency>& oDeps )
QgsVectorLayer* lyr = static_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( dep.layerId() ) );
if ( lyr == nullptr )
continue;
disconnect( lyr, SIGNAL( featureAdded( QgsFeatureId ) ), this, SIGNAL( dataChanged() ) );
disconnect( lyr, SIGNAL( featureDeleted( QgsFeatureId ) ), this, SIGNAL( dataChanged() ) );
disconnect( lyr, SIGNAL( geometryChanged( QgsFeatureId, const QgsGeometry& ) ), this, SIGNAL( dataChanged() ) );
disconnect( lyr, SIGNAL( dataChanged() ), this, SIGNAL( dataChanged() ) );
disconnect( lyr, SIGNAL( repaintRequested() ), this, SLOT( triggerRepaint() ) );
disconnect( lyr, &QgsVectorLayer::featureAdded, this, &QgsVectorLayer::dataChanged );
disconnect( lyr, &QgsVectorLayer::featureDeleted, this, &QgsVectorLayer::dataChanged );
disconnect( lyr, &QgsVectorLayer::geometryChanged, this, &QgsVectorLayer::dataChanged );
disconnect( lyr, &QgsVectorLayer::dataChanged, this, &QgsVectorLayer::dataChanged );
disconnect( lyr, &QgsVectorLayer::repaintRequested, this, &QgsVectorLayer::triggerRepaint );
}

// assign new dependencies
@@ -4185,11 +4176,11 @@ bool QgsVectorLayer::setDependencies( const QSet<QgsMapLayerDependency>& oDeps )
QgsVectorLayer* lyr = static_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( dep.layerId() ) );
if ( lyr == nullptr )
continue;
connect( lyr, SIGNAL( featureAdded( QgsFeatureId ) ), this, SIGNAL( dataChanged() ) );
connect( lyr, SIGNAL( featureDeleted( QgsFeatureId ) ), this, SIGNAL( dataChanged() ) );
connect( lyr, SIGNAL( geometryChanged( QgsFeatureId, const QgsGeometry& ) ), this, SIGNAL( dataChanged() ) );
connect( lyr, SIGNAL( dataChanged() ), this, SIGNAL( dataChanged() ) );
connect( lyr, SIGNAL( repaintRequested() ), this, SLOT( triggerRepaint() ) );
connect( lyr, &QgsVectorLayer::featureAdded, this, &QgsVectorLayer::dataChanged );
connect( lyr, &QgsVectorLayer::featureDeleted, this, &QgsVectorLayer::dataChanged );
connect( lyr, &QgsVectorLayer::geometryChanged, this, &QgsVectorLayer::dataChanged );
connect( lyr, &QgsVectorLayer::dataChanged, this, &QgsVectorLayer::dataChanged );
connect( lyr, &QgsVectorLayer::repaintRequested, this, &QgsVectorLayer::triggerRepaint );
}

// if new layers are present, emit a data change
@@ -26,18 +26,18 @@ QgsVectorLayerCache::QgsVectorLayerCache( QgsVectorLayer* layer, int cacheSize,
{
mCache.setMaxCost( cacheSize );

connect( mLayer, SIGNAL( featureDeleted( QgsFeatureId ) ), SLOT( featureDeleted( QgsFeatureId ) ) );
connect( mLayer, SIGNAL( featureAdded( QgsFeatureId ) ), SLOT( onFeatureAdded( QgsFeatureId ) ) );
connect( mLayer, SIGNAL( destroyed() ), SLOT( layerDeleted() ) );
connect( mLayer, &QgsVectorLayer::featureDeleted, this, &QgsVectorLayerCache::featureDeleted );
connect( mLayer, &QgsVectorLayer::featureAdded, this, &QgsVectorLayerCache::onFeatureAdded );
connect( mLayer, &QgsVectorLayer::destroyed, this, &QgsVectorLayerCache::layerDeleted );

setCacheGeometry( true );
setCacheSubsetOfAttributes( mLayer->attributeList() );
setCacheAddedAttributes( true );

connect( mLayer, SIGNAL( attributeDeleted( int ) ), SLOT( attributeDeleted( int ) ) );
connect( mLayer, SIGNAL( updatedFields() ), SLOT( invalidate() ) );
connect( mLayer, SIGNAL( dataChanged() ), SLOT( invalidate() ) );
connect( mLayer, SIGNAL( attributeValueChanged( QgsFeatureId, int, const QVariant& ) ), SLOT( onAttributeValueChanged( QgsFeatureId, int, const QVariant& ) ) );
connect( mLayer, &QgsVectorLayer::attributeDeleted, this, &QgsVectorLayerCache::attributeDeleted );
connect( mLayer, &QgsVectorLayer::updatedFields, this, &QgsVectorLayerCache::invalidate );
connect( mLayer, &QgsVectorLayer::dataChanged, this, &QgsVectorLayerCache::invalidate );
connect( mLayer, &QgsVectorLayer::attributeValueChanged, this, &QgsVectorLayerCache::onAttributeValueChanged );
}

QgsVectorLayerCache::~QgsVectorLayerCache()
@@ -61,11 +61,11 @@ void QgsVectorLayerCache::setCacheGeometry( bool cacheGeometry )
mCacheGeometry = cacheGeometry && mLayer->hasGeometryType();
if ( cacheGeometry )
{
connect( mLayer, SIGNAL( geometryChanged( QgsFeatureId, const QgsGeometry& ) ), SLOT( geometryChanged( QgsFeatureId, const QgsGeometry& ) ) );
connect( mLayer, &QgsVectorLayer::geometryChanged, this, &QgsVectorLayerCache::geometryChanged );
}
else
{
disconnect( mLayer, SIGNAL( geometryChanged( QgsFeatureId, const QgsGeometry& ) ), this, SLOT( geometryChanged( QgsFeatureId, const QgsGeometry& ) ) );
disconnect( mLayer, &QgsVectorLayer::geometryChanged, this, &QgsVectorLayerCache::geometryChanged );
}
}

@@ -124,11 +124,11 @@ void QgsVectorLayerCache::setCacheAddedAttributes( bool cacheAddedAttributes )
{
if ( cacheAddedAttributes )
{
connect( mLayer, SIGNAL( attributeAdded( int ) ), SLOT( attributeAdded( int ) ) );
connect( mLayer, &QgsVectorLayer::attributeAdded, this, &QgsVectorLayerCache::attributeAdded );
}
else
{
disconnect( mLayer, SIGNAL( attributeAdded( int ) ), this, SLOT( attributeAdded( int ) ) );
disconnect( mLayer, &QgsVectorLayer::attributeAdded, this, &QgsVectorLayerCache::attributeAdded );
}
}

@@ -37,7 +37,7 @@ template <class Key, class T> void mapToReversedLists( const QMap< Key, T >& map
QgsVectorLayerEditBuffer::QgsVectorLayerEditBuffer( QgsVectorLayer* layer )
: L( layer )
{
connect( L->undoStack(), SIGNAL( indexChanged( int ) ), this, SLOT( undoIndexChanged( int ) ) ); // TODO[MD]: queued?
connect( L->undoStack(), &QUndoStack::indexChanged, this, &QgsVectorLayerEditBuffer::undoIndexChanged ); // TODO[MD]: queued?
}

QgsVectorLayerEditBuffer::~QgsVectorLayerEditBuffer()
@@ -89,8 +89,8 @@ bool QgsVectorLayerJoinBuffer::addJoin( const QgsVectorJoinInfo& joinInfo )
// Unique connection makes sure we do not respond to one layer's update more times (in case of multiple join)
if ( QgsVectorLayer* vl = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( joinInfo.joinLayerId ) ) )
{
connect( vl, SIGNAL( updatedFields() ), this, SLOT( joinedLayerUpdatedFields() ), Qt::UniqueConnection );
connect( vl, SIGNAL( layerModified() ), this, SLOT( joinedLayerModified() ), Qt::UniqueConnection );
connect( vl, &QgsVectorLayer::updatedFields, this, &QgsVectorLayerJoinBuffer::joinedLayerUpdatedFields, Qt::UniqueConnection );
connect( vl, &QgsVectorLayer::layerModified, this, &QgsVectorLayerJoinBuffer::joinedLayerModified, Qt::UniqueConnection );
}

emit joinedFieldsChanged();
@@ -113,7 +113,7 @@ bool QgsVectorLayerJoinBuffer::removeJoin( const QString& joinLayerId )

if ( QgsVectorLayer* vl = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( joinLayerId ) ) )
{
disconnect( vl, SIGNAL( updatedFields() ), this, SLOT( joinedLayerUpdatedFields() ) );
disconnect( vl, &QgsVectorLayer::updatedFields, this, &QgsVectorLayerJoinBuffer::joinedLayerUpdatedFields );
}

emit joinedFieldsChanged();
@@ -273,8 +273,8 @@ void QgsVectorLayerJoinBuffer::createJoinCaches()
// make sure we are connected to the joined layer
if ( QgsVectorLayer* vl = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( joinIt->joinLayerId ) ) )
{
connect( vl, SIGNAL( updatedFields() ), this, SLOT( joinedLayerUpdatedFields() ), Qt::UniqueConnection );
connect( vl, SIGNAL( layerModified() ), this, SLOT( joinedLayerModified() ), Qt::UniqueConnection );
connect( vl, &QgsVectorLayer::updatedFields, this, &QgsVectorLayerJoinBuffer::joinedLayerUpdatedFields, Qt::UniqueConnection );
connect( vl, &QgsVectorLayer::layerModified, this, &QgsVectorLayerJoinBuffer::joinedLayerModified, Qt::UniqueConnection );
}
}
}
@@ -818,16 +818,10 @@ void QgsRasterLayer::setDataProvider( QString const & provider )
mLastModified = lastModified( mDataSource );

// Connect provider signals
connect(
mDataProvider, SIGNAL( progress( int, double, QString ) ),
this, SLOT( onProgress( int, double, QString ) )
);
connect( mDataProvider, &QgsRasterDataProvider::progress, this, &QgsRasterLayer::onProgress );

// Do a passthrough for the status bar text
connect(
mDataProvider, SIGNAL( statusChanged( QString ) ),
this, SIGNAL( statusChanged( QString ) )
);
connect( mDataProvider, &QgsRasterDataProvider::statusChanged, this, &QgsRasterLayer::statusChanged );

//mark the layer as valid
mValid = true;

2 comments on commit 47109d1

@NathanW2

This comment has been minimized.

Copy link
Member

@NathanW2 NathanW2 replied Nov 1, 2016

That new style is very nice.

@m-kuhn

This comment has been minimized.

Copy link
Member

@m-kuhn m-kuhn replied Nov 1, 2016

... and removing the emitSomeSignal() calls is also very welcome!

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