Added layerIsExpanded() to QgsLegendInterface

This commit is contained in:
olivier 2013-01-20 16:52:49 +00:00 committed by Juergen E. Fischer
parent e7c34ea9da
commit 85b684c962
6 changed files with 26 additions and 0 deletions

View File

@ -43,6 +43,10 @@ class QgsLegendInterface : QObject
//! @note added in 1.5 //! @note added in 1.5
virtual bool isGroupVisible( int groupIndex ) = 0; virtual bool isGroupVisible( int groupIndex ) = 0;
//! Check if a layer is expanded
//! @note added in 2.0
virtual bool isLayerExpanded( QgsMapLayer * ml ) = 0;
//! Check if a layer is visible //! Check if a layer is visible
//! @note added in 1.5 //! @note added in 1.5
virtual bool isLayerVisible( QgsMapLayer * ml ) = 0; virtual bool isLayerVisible( QgsMapLayer * ml ) = 0;

View File

@ -167,6 +167,11 @@ bool QgsAppLegendInterface::isGroupVisible( int groupIndex )
return ( Qt::Checked == getItem( groupIndex )->checkState( 0 ) ); return ( Qt::Checked == getItem( groupIndex )->checkState( 0 ) );
} }
bool QgsAppLegendInterface::isLayerExpanded( QgsMapLayer * ml )
{
return mLegend->layerIsExpanded( ml );
}
bool QgsAppLegendInterface::isLayerVisible( QgsMapLayer * ml ) bool QgsAppLegendInterface::isLayerVisible( QgsMapLayer * ml )
{ {
return ( Qt::Checked == mLegend->layerCheckState( ml ) ); return ( Qt::Checked == mLegend->layerCheckState( ml ) );

View File

@ -61,6 +61,9 @@ class QgsAppLegendInterface : public QgsLegendInterface
//! Check if a group is visible //! Check if a group is visible
bool isGroupVisible( int groupIndex ); bool isGroupVisible( int groupIndex );
//! Check if a layer is expanded
bool isLayerExpanded( QgsMapLayer * ml );
//! Check if a layer is visible //! Check if a layer is visible
bool isLayerVisible( QgsMapLayer * ml ); bool isLayerVisible( QgsMapLayer * ml );

View File

@ -831,6 +831,13 @@ Qt::CheckState QgsLegend::layerCheckState( QgsMapLayer * layer )
return ll ? ll->checkState( 0 ) : Qt::Unchecked; return ll ? ll->checkState( 0 ) : Qt::Unchecked;
} }
bool QgsLegend::layerIsExpanded( QgsMapLayer * layer )
{
QgsLegendLayer * ll = findLegendLayer( layer );
return ll->isExpanded();
}
QgsLegendGroup* QgsLegend::addEmbeddedGroup( const QString& groupName, const QString& projectFilePath, QgsLegendItem* parent ) QgsLegendGroup* QgsLegend::addEmbeddedGroup( const QString& groupName, const QString& projectFilePath, QgsLegendItem* parent )
{ {
mEmbeddedGroups.insert( groupName, projectFilePath ); mEmbeddedGroups.insert( groupName, projectFilePath );

View File

@ -221,6 +221,9 @@ class QgsLegend : public QTreeWidget
/**Returns a layers check state*/ /**Returns a layers check state*/
Qt::CheckState layerCheckState( QgsMapLayer * layer ); Qt::CheckState layerCheckState( QgsMapLayer * layer );
/**Returns a layers expanded state*/
bool layerIsExpanded( QgsMapLayer * layer );
/**Add group from other project file. Returns a pointer to the new group in case of success or 0 in case of error*/ /**Add group from other project file. Returns a pointer to the new group in case of success or 0 in case of error*/
QgsLegendGroup* addEmbeddedGroup( const QString& groupName, const QString& projectFilePath, QgsLegendItem* parent = 0 ); QgsLegendGroup* addEmbeddedGroup( const QString& groupName, const QString& projectFilePath, QgsLegendItem* parent = 0 );

View File

@ -75,6 +75,10 @@ class GUI_EXPORT QgsLegendInterface : public QObject
//! @note added in 1.5 //! @note added in 1.5
virtual bool isGroupVisible( int groupIndex ) = 0; virtual bool isGroupVisible( int groupIndex ) = 0;
//! Check if a layer is expanded
//! @note added in 2.0
virtual bool isLayerExpanded( QgsMapLayer * ml ) = 0;
//! Check if a layer is visible //! Check if a layer is visible
//! @note added in 1.5 //! @note added in 1.5
virtual bool isLayerVisible( QgsMapLayer * ml ) = 0; virtual bool isLayerVisible( QgsMapLayer * ml ) = 0;