Skip to content
Permalink
Browse files

Rename QgsLegendModelV2 to QgsLegendModel

  • Loading branch information
wonder-sk committed Dec 11, 2016
1 parent c783be1 commit 556582979a7f75b4dc397e350755c06a526aac78
@@ -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
@@ -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;

@@ -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 );
@@ -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* ) ) );
@@ -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 ) )
@@ -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 ) )
@@ -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;

@@ -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 );
@@ -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;
@@ -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();
@@ -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 )
{
@@ -26,7 +26,7 @@ class QgsComposerLegend;
class QgsComposerMap;
class QgsComposition;
class QgsMapLayer;
class QgsLegendModelV2;
class QgsLegendModel;


class SERVER_EXPORT QgsWmsConfigParser
@@ -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
@@ -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();

0 comments on commit 5565829

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