Skip to content
Permalink
Browse files

Drop temporary solution for WMS legend (double-click in legend)

Now WMS legend is shown in layertree this isn't needed anymore.
See http://lists.osgeo.org/pipermail/qgis-developer/2014-December/036065.html
  • Loading branch information
Sandro Santilli
Sandro Santilli committed Jan 2, 2015
1 parent 7b6f28c commit dd957d97d38503b378952130451bc3c7a8f2c995
Showing with 0 additions and 32 deletions.
  1. +0 −32 src/app/qgisapp.cpp
@@ -383,38 +383,6 @@ void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem &srs )

void QgisApp::layerTreeViewDoubleClicked( const QModelIndex& index )
{
// temporary solution for WMS legend
if ( mLayerTreeView->layerTreeModel()->index2legendNode( index ) )
{
QModelIndex parent = mLayerTreeView->layerTreeModel()->parent( index );
QgsLayerTreeNode* node = mLayerTreeView->layerTreeModel()->index2node( parent );
if ( QgsLayerTree::isLayer( node ) )
{
QgsMapLayer* layer = QgsLayerTree::toLayer( node )->layer();
QgsRasterLayer* rlayer = qobject_cast<QgsRasterLayer*>( layer );
if ( rlayer && rlayer->providerType() == "wms" )
{
const QgsMapCanvas* canvas = mapCanvas();
QgsRectangle visibleExtent = canvas->mapSettings().outputExtentToLayerExtent( rlayer, canvas->extent() ); // in layer projection
QImage img = rlayer->dataProvider()->getLegendGraphic( mMapCanvas->scale(), false, &visibleExtent );

QFrame* popup = new QFrame();
popup->setAttribute( Qt::WA_DeleteOnClose );
popup->setFrameStyle( QFrame::Box | QFrame::Raised );
popup->setLineWidth( 2 );
popup->setAutoFillBackground( true );
QVBoxLayout *layout = new QVBoxLayout;
QLabel *label = new QLabel( popup );
label->setPixmap( QPixmap::fromImage( img ) );
layout->addWidget( label );
popup->setLayout( layout );
popup->move( mLayerTreeView->visualRect( index ).bottomLeft() );
popup->show();
return;
}
}
}

QSettings settings;
switch ( settings.value( "/qgis/legendDoubleClickAction", 0 ).toInt() )
{

0 comments on commit dd957d9

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