Skip to content
Permalink
Browse files

[composer] Remove QgsComposerMap::storeCurrentLayerSet

This method was used to sync the canvas layers to a composer map.
The logic has been moved to app to avoid a dependancy between
compositions and the main map canvas
  • Loading branch information
nyalldawson committed Jan 16, 2017
1 parent f96364e commit 49411210b052d44f7fdb28e8e924bf88c31388e5
@@ -569,7 +569,7 @@ and should be accessed using QgsComposerMap::overview() or QgsComposerMap::overv
instead.
- atlasFixedScale() and setAtlasFixedScale() were removed. Use atlasScalingMode()
and setAtlasScalingMode() instead.

- storeCurrentLayerSet() was removed. Use setLayers() instead.

QgsComposerMapGrid {#qgis_api_break_3_0_QgsComposerMapGrid}
------------------
@@ -139,8 +139,6 @@ class QgsComposerMap : QgsComposerItem
QList<QgsMapLayer*> layers() const;
/** Setter for stored layer set that is used if mKeepLayerSet is true */
void setLayers( const QList<QgsMapLayer*> layers );
/** Stores the current layer set of the qgis mapcanvas in mLayerSet*/
void storeCurrentLayerSet();

/** Getter for flag that determines if current styles of layers should be overridden by previously stored styles. @note added in 2.8 */
bool keepLayerStyles() const;
@@ -828,7 +828,7 @@ void QgsComposerMapWidget::on_mKeepLayerListCheckBox_stateChanged( int state )

if ( state == Qt::Checked )
{
mComposerMap->storeCurrentLayerSet();
storeCurrentLayerSet();
mComposerMap->setKeepLayerSet( true );

// mutually exclusive with following a preset
@@ -1450,6 +1450,21 @@ void QgsComposerMapWidget::updateOverviewFrameSymbolMarker( const QgsComposerMap
}
}

void QgsComposerMapWidget::storeCurrentLayerSet()
{
if ( !mComposerMap )
return;

QList<QgsMapLayer*> layers = QgisApp::instance()->mapCanvas()->mapSettings().layers();
mComposerMap->setLayers( layers );

if ( mComposerMap->keepLayerStyles() )
{
// also store styles associated with the layers
mComposerMap->storeCurrentLayerStyles();
}
}

QListWidgetItem* QgsComposerMapWidget::addOverviewListItem( const QString& id, const QString& name )
{
QListWidgetItem* item = new QListWidgetItem( name, nullptr );
@@ -163,6 +163,9 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
void loadOverviewEntries();

void updateOverviewFrameSymbolMarker( const QgsComposerMapOverview* overview );

void storeCurrentLayerSet();

};

#endif
@@ -1561,17 +1561,6 @@ bool QgsComposerMap::readXml( const QDomElement& itemElem, const QDomDocument& d
return true;
}

void QgsComposerMap::storeCurrentLayerSet()
{
mLayers = _qgis_listRawToQPointer( mComposition->mapSettings().layers() );

if ( mKeepLayerStyles )
{
// also store styles associated with the layers
storeCurrentLayerStyles();
}
}

QList<QgsMapLayer*> QgsComposerMap::layers() const
{
return _qgis_listQPointerToRaw( mLayers );
@@ -178,8 +178,6 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
QList<QgsMapLayer*> layers() const;
//! Setter for stored layer set that is used if mKeepLayerSet is true
void setLayers( const QList<QgsMapLayer*> layers );
//! Stores the current layer set of the qgis mapcanvas in mLayerSet
void storeCurrentLayerSet();

//! Getter for flag that determines if current styles of layers should be overridden by previously stored styles. @note added in 2.8
bool keepLayerStyles() const { return mKeepLayerStyles; }

0 comments on commit 4941121

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