Skip to content

Commit

Permalink
Rename QgsLegendModelV2 to QgsLegendModel
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Dec 11, 2016
1 parent c783be1 commit 5565829
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions doc/api_break.dox
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Renamed Classes {#qgis_api_break_3_0_renamed_classes}
<tr><td>QgsGraduatedSymbolRendererV2ViewStyle<td>QgsGraduatedSymbolRendererViewStyle
<tr><td>QgsGraduatedSymbolRendererV2Widget<td>QgsGraduatedSymbolRendererWidget
<tr><td>QgsLabelingEngineV2<td>QgsLabelingEngine
<td><td>QgsLegendModelV2<td>QgsLegendModel
<tr><td>QgsLegendSymbolItemV2<td>QgsLegendSymbolItem
<tr><td>QgsLineStringV2<td>QgsLineString
<tr><td>QgsLineSymbolLayerV2<td>QgsLineSymbolLayer
Expand Down
6 changes: 3 additions & 3 deletions python/core/composer/qgscomposerlegend.sip
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
*
* @note added in 2.6
*/
class QgsLegendModelV2 : QgsLayerTreeModel
class QgsLegendModel : QgsLayerTreeModel
{
%TypeHeaderCode
#include <qgscomposerlegend.h>
%End

public:
QgsLegendModelV2( QgsLayerTreeGroup* rootNode, QObject *parent /TransferThis/ = 0 );
QgsLegendModel( QgsLayerTreeGroup* rootNode, QObject *parent /TransferThis/ = 0 );

QVariant data( const QModelIndex& index, int role ) const;

Expand Down Expand Up @@ -61,7 +61,7 @@ class QgsComposerLegend : QgsComposerItem
bool resizeToContents() const;

//! @note added in 2.6
QgsLegendModelV2* model();
QgsLegendModel* model();

//! @note added in 2.6
void setAutoUpdateModel( bool autoUpdate );
Expand Down
8 changes: 4 additions & 4 deletions src/core/composer/qgscomposerlegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ QgsComposerLegend::QgsComposerLegend( QgsComposition* composition )
, mForceResize( false )
, mSizeToContents( true )
{
mLegendModel = new QgsLegendModelV2( QgsProject::instance()->layerTreeRoot() );
mLegendModel = new QgsLegendModel( QgsProject::instance()->layerTreeRoot() );

connect( &composition->atlasComposition(), SIGNAL( renderEnded() ), this, SLOT( onAtlasEnded() ) );
connect( &composition->atlasComposition(), SIGNAL( featureChanged( QgsFeature* ) ), this, SLOT( onAtlasFeature( QgsFeature* ) ) );
Expand Down Expand Up @@ -737,14 +737,14 @@ void QgsComposerLegend::onAtlasEnded()
#include "qgslayertreemodellegendnode.h"
#include "qgsvectorlayer.h"

QgsLegendModelV2::QgsLegendModelV2( QgsLayerTreeGroup* rootNode, QObject* parent )
QgsLegendModel::QgsLegendModel( QgsLayerTreeGroup* rootNode, QObject* parent )
: QgsLayerTreeModel( rootNode, parent )
{
setFlag( QgsLayerTreeModel::AllowLegendChangeState, false );
setFlag( QgsLayerTreeModel::AllowNodeReorder, true );
}

QVariant QgsLegendModelV2::data( const QModelIndex& index, int role ) const
QVariant QgsLegendModel::data( const QModelIndex& index, int role ) const
{
// handle custom layer node labels
if ( QgsLayerTreeNode* node = index2node( index ) )
Expand All @@ -766,7 +766,7 @@ QVariant QgsLegendModelV2::data( const QModelIndex& index, int role ) const
return QgsLayerTreeModel::data( index, role );
}

Qt::ItemFlags QgsLegendModelV2::flags( const QModelIndex& index ) const
Qt::ItemFlags QgsLegendModel::flags( const QModelIndex& index ) const
{
// make the legend nodes selectable even if they are not by default
if ( index2legendNode( index ) )
Expand Down
8 changes: 4 additions & 4 deletions src/core/composer/qgscomposerlegend.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ class QgsLegendRenderer;
*
* @note added in 2.6
*/
class CORE_EXPORT QgsLegendModelV2 : public QgsLayerTreeModel
class CORE_EXPORT QgsLegendModel : public QgsLayerTreeModel
{
Q_OBJECT

public:
QgsLegendModelV2( QgsLayerTreeGroup* rootNode, QObject *parent = nullptr );
QgsLegendModel( QgsLayerTreeGroup* rootNode, QObject *parent = nullptr );

QVariant data( const QModelIndex& index, int role ) const override;

Expand Down Expand Up @@ -88,7 +88,7 @@ class CORE_EXPORT QgsComposerLegend : public QgsComposerItem
/**
* Returns the legend model
*/
QgsLegendModelV2* model() { return mLegendModel; }
QgsLegendModel* model() { return mLegendModel; }

//! @note added in 2.6
void setAutoUpdateModel( bool autoUpdate );
Expand Down Expand Up @@ -281,7 +281,7 @@ class CORE_EXPORT QgsComposerLegend : public QgsComposerItem
//! use new custom layer tree and update model. if new root is null pointer, will use project's tree
void setCustomLayerTree( QgsLayerTreeGroup* rootGroup );

QgsLegendModelV2* mLegendModel;
QgsLegendModel* mLegendModel;
QgsLayerTreeGroup* mCustomLayerTree;

QgsLegendSettings mSettings;
Expand Down
4 changes: 2 additions & 2 deletions src/server/qgswmsconfigparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ QgsComposition* QgsWmsConfigParser::createPrintComposition( const QString& compo
}

// get model and layer tree root of the legend
QgsLegendModelV2* model = currentLegend->model();
QgsLegendModel* model = currentLegend->model();
QStringList layerSet;
Q_FOREACH ( QgsMapLayer* layer, map->layers() )
layerSet << layer->id();
Expand Down Expand Up @@ -548,7 +548,7 @@ void QgsWmsConfigParser::removeHighlightLayers( const QStringList& layerIds )
}
}

void QgsWmsConfigParser::setLayerIdsToLegendModel( QgsLegendModelV2* model, const QStringList& layerSet, double scale )
void QgsWmsConfigParser::setLayerIdsToLegendModel( QgsLegendModel* model, const QStringList& layerSet, double scale )
{
if ( !model )
{
Expand Down
4 changes: 2 additions & 2 deletions src/server/qgswmsconfigparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class QgsComposerLegend;
class QgsComposerMap;
class QgsComposition;
class QgsMapLayer;
class QgsLegendModelV2;
class QgsLegendModel;


class SERVER_EXPORT QgsWmsConfigParser
Expand Down Expand Up @@ -161,7 +161,7 @@ class SERVER_EXPORT QgsWmsConfigParser
const QStringList& labelWeightSplit, const QStringList& labelFontSplit, const QStringList& labelBufferSizeSplit,
const QStringList& labelBufferColorSplit );

static void setLayerIdsToLegendModel( QgsLegendModelV2* model, const QStringList& layerIds, double scale );
static void setLayerIdsToLegendModel( QgsLegendModel* model, const QStringList& layerIds, double scale );
};

#endif // QGSWMSCONFIGPARSER_H
2 changes: 1 addition & 1 deletion src/server/qgswmsprojectparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ QgsComposition* QgsWmsProjectParser::initComposition( const QString& composerTem
QgsComposerLegend* legend = qobject_cast< QgsComposerLegend *>( *itemIt );
if ( legend )
{
QgsLegendModelV2* model = legend->model();
QgsLegendModel* model = legend->model();
#if 0
QgsLayerTreeGroup* root = model->rootGroup();
QStringList layerIds = root->findLayerIds();
Expand Down

0 comments on commit 5565829

Please sign in to comment.