Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 committed Jan 2, 2015
1 parent 7b6f28c commit dd957d9
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions src/app/qgisapp.cpp
Expand Up @@ -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() )
{
Expand Down

0 comments on commit dd957d9

Please sign in to comment.