Skip to content
Permalink
Browse files

Moved QgsLayerTreeModelLegendNode (+derived classes) to a new file

  • Loading branch information
wonder-sk committed Sep 1, 2014
1 parent 6891aae commit 89941f6b0a3a6ea2186d15a8816cb1abcb8c24b8
@@ -168,6 +168,7 @@
%Include layertree/qgslayertreegroup.sip
%Include layertree/qgslayertreelayer.sip
%Include layertree/qgslayertreemodel.sip
%Include layertree/qgslayertreemodellegendnode.sip
%Include layertree/qgslayertreenode.sip
%Include layertree/qgslayertreeregistrybridge.sip
%Include layertree/qgslayertreeutils.sip
@@ -0,0 +1,74 @@

/**
* The QgsLegendRendererItem class is abstract interface for legend items
* returned from QgsMapLayerLegend implementation.
*
* The objects are used in QgsLayerTreeModel. Custom implementations may offer additional interactivity
* and customized look.
*
* @note added in 2.6
*/
class QgsLayerTreeModelLegendNode : QObject
{
%TypeHeaderCode
#include <qgslayertreemodellegendnode.h>
%End

public:

/** Return pointer to the parent layer node */
QgsLayerTreeLayer* parent() const;

/** Return item flags associated with the item. Default implementation returns Qt::ItemIsEnabled. */
virtual Qt::ItemFlags flags() const;

/** Return data associated with the item. Must be implemented in derived class. */
virtual QVariant data( int role ) const = 0;

/** Set some data associated with the item. Default implementation does nothing and returns false. */
virtual bool setData( const QVariant& value, int role );

protected:
/** Construct the node with pointer to its parent layer node */
explicit QgsLayerTreeModelLegendNode( QgsLayerTreeLayer* nodeL );
};



/**
* Implementation of legend node interface for displaying preview of vector symbols and their labels
* and allowing interaction with the symbol / renderer.
*
* @note added in 2.6
*/
/*
class QgsSymbolV2LegendNode : QgsLayerTreeModelLegendNode
{
%TypeHeaderCode
#include <qgslayertreemodellegendnode.h>
%End
public:
QgsSymbolV2LegendNode( QgsLayerTreeLayer* nodeLayer, const QgsLegendSymbolItemV2& item );

virtual Qt::ItemFlags flags() const;
virtual QVariant data( int role ) const;
virtual bool setData( const QVariant& value, int role );
};*/


/**
* Implementation of legend node interface for displaying arbitrary label with icon.
*
* @note added in 2.6
*/
class QgsSimpleLegendNode : QgsLayerTreeModelLegendNode
{
%TypeHeaderCode
#include <qgslayertreemodellegendnode.h>
%End
public:
QgsSimpleLegendNode( QgsLayerTreeLayer* nodeLayer, const QString& label, const QIcon& icon = QIcon() );

virtual QVariant data( int role ) const;
};

@@ -1,78 +1,4 @@

/**
* The QgsLegendRendererItem class is abstract interface for legend items
* returned from QgsMapLayerLegend implementation.
*
* The objects are used in QgsLayerTreeModel. Custom implementations may offer additional interactivity
* and customized look.
*
* @note added in 2.6
*/
class QgsLayerTreeModelLegendNode : QObject
{
%TypeHeaderCode
#include <qgsmaplayerlegend.h>
%End

public:

/** Return pointer to the parent layer node */
QgsLayerTreeLayer* parent() const;

/** Return item flags associated with the item. Default implementation returns Qt::ItemIsEnabled. */
virtual Qt::ItemFlags flags() const;

/** Return data associated with the item. Must be implemented in derived class. */
virtual QVariant data( int role ) const = 0;

/** Set some data associated with the item. Default implementation does nothing and returns false. */
virtual bool setData( const QVariant& value, int role );

protected:
/** Construct the node with pointer to its parent layer node */
explicit QgsLayerTreeModelLegendNode( QgsLayerTreeLayer* nodeL );
};



/**
* Implementation of legend node interface for displaying preview of vector symbols and their labels
* and allowing interaction with the symbol / renderer.
*
* @note added in 2.6
*/
/*
class QgsSymbolV2LegendNode : QgsLayerTreeModelLegendNode
{
%TypeHeaderCode
#include <qgsmaplayerlegend.h>
%End
public:
QgsSymbolV2LegendNode( QgsLayerTreeLayer* nodeLayer, const QgsLegendSymbolItemV2& item );

virtual Qt::ItemFlags flags() const;
virtual QVariant data( int role ) const;
virtual bool setData( const QVariant& value, int role );
};*/


/**
* Implementation of legend node interface for displaying arbitrary label with icon.
*
* @note added in 2.6
*/
class QgsSimpleLegendNode : QgsLayerTreeModelLegendNode
{
%TypeHeaderCode
#include <qgsmaplayerlegend.h>
%End
public:
QgsSimpleLegendNode( QgsLayerTreeLayer* nodeLayer, const QString& label, const QIcon& icon = QIcon() );

virtual QVariant data( int role ) const;
};


/**
* The QgsMapLayerLegend class is abstract interface for implementations
* of legends for one map layer.
@@ -98,9 +24,6 @@ class QgsMapLayerLegend : QObject

// TODO: support for layer tree view delegates

// TODO: support for legend renderer


//! Create new legend implementation for vector layer
static QgsMapLayerLegend* defaultVectorLegend( QgsVectorLayer* vl ) /Factory/;

@@ -49,6 +49,7 @@ SET(QGIS_CORE_SRCS
layertree/qgslayertreegroup.cpp
layertree/qgslayertreelayer.cpp
layertree/qgslayertreemodel.cpp
layertree/qgslayertreemodellegendnode.cpp
layertree/qgslayertreenode.cpp
layertree/qgslayertreeregistrybridge.cpp
layertree/qgslayertreeutils.cpp
@@ -409,6 +410,7 @@ SET(QGIS_CORE_MOC_HDRS
layertree/qgslayertreegroup.h
layertree/qgslayertreelayer.h
layertree/qgslayertreemodel.h
layertree/qgslayertreemodellegendnode.h
layertree/qgslayertreenode.h
layertree/qgslayertreeregistrybridge.h
)
@@ -639,6 +641,7 @@ SET(QGIS_CORE_HDRS
layertree/qgslayertreegroup.h
layertree/qgslayertreelayer.h
layertree/qgslayertreemodel.h
layertree/qgslayertreemodellegendnode.h
layertree/qgslayertreenode.h
layertree/qgslayertreeregistrybridge.h
layertree/qgslayertreeutils.h
@@ -16,6 +16,7 @@
#include "qgslayertreemodel.h"

#include "qgslayertree.h"
#include "qgslayertreemodellegendnode.h"

#include <QMimeData>
#include <QTextStream>

0 comments on commit 89941f6

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