Skip to content

Commit dd957d9

Browse files
author
Sandro Santilli
committed
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
1 parent 7b6f28c commit dd957d9

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

src/app/qgisapp.cpp

-32
Original file line numberDiff line numberDiff line change
@@ -383,38 +383,6 @@ void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem &srs )
383383

384384
void QgisApp::layerTreeViewDoubleClicked( const QModelIndex& index )
385385
{
386-
// temporary solution for WMS legend
387-
if ( mLayerTreeView->layerTreeModel()->index2legendNode( index ) )
388-
{
389-
QModelIndex parent = mLayerTreeView->layerTreeModel()->parent( index );
390-
QgsLayerTreeNode* node = mLayerTreeView->layerTreeModel()->index2node( parent );
391-
if ( QgsLayerTree::isLayer( node ) )
392-
{
393-
QgsMapLayer* layer = QgsLayerTree::toLayer( node )->layer();
394-
QgsRasterLayer* rlayer = qobject_cast<QgsRasterLayer*>( layer );
395-
if ( rlayer && rlayer->providerType() == "wms" )
396-
{
397-
const QgsMapCanvas* canvas = mapCanvas();
398-
QgsRectangle visibleExtent = canvas->mapSettings().outputExtentToLayerExtent( rlayer, canvas->extent() ); // in layer projection
399-
QImage img = rlayer->dataProvider()->getLegendGraphic( mMapCanvas->scale(), false, &visibleExtent );
400-
401-
QFrame* popup = new QFrame();
402-
popup->setAttribute( Qt::WA_DeleteOnClose );
403-
popup->setFrameStyle( QFrame::Box | QFrame::Raised );
404-
popup->setLineWidth( 2 );
405-
popup->setAutoFillBackground( true );
406-
QVBoxLayout *layout = new QVBoxLayout;
407-
QLabel *label = new QLabel( popup );
408-
label->setPixmap( QPixmap::fromImage( img ) );
409-
layout->addWidget( label );
410-
popup->setLayout( layout );
411-
popup->move( mLayerTreeView->visualRect( index ).bottomLeft() );
412-
popup->show();
413-
return;
414-
}
415-
}
416-
}
417-
418386
QSettings settings;
419387
switch ( settings.value( "/qgis/legendDoubleClickAction", 0 ).toInt() )
420388
{

0 commit comments

Comments
 (0)