1568_complete_fix.patch

Fix the remaining issue - Gabriele Monfardini, 2009-07-21 01:48 PM

Download (2.12 KB)

View differences:

src/app/legend/qgslegend.cpp (copia locale)
620 620
    return;
621 621
  }
622 622

  
623
  //if the current item is a legend layer: remove all layers of the current legendLayer
624
  QgsLegendLayer* ll = dynamic_cast<QgsLegendLayer*>( currentItem() );
625
  if ( ll )
623
  QgsLegendItem* li = dynamic_cast<QgsLegendItem*>( currentItem() );
624
  QgsLegendLayerFile* llf = 0;
625

  
626
  if ( li->type() == QgsLegendItem::LEGEND_SYMBOL_ITEM )
626 627
  {
628
    QgsLegendSymbologyItem* si = dynamic_cast<QgsLegendSymbologyItem*>( li );
629
    li = dynamic_cast<QgsLegendItem*>( si->parent() );
630
  }
631
  if ( li->type() == QgsLegendItem::LEGEND_LAYER_FILE_GROUP )
632
  {
633
    QgsLegendLayerFileGroup* llfg = dynamic_cast<QgsLegendLayerFileGroup*>( li );
634
    li = dynamic_cast<QgsLegendItem*>( llfg->parent() );
635
  }
636
  if ( li->type() == QgsLegendItem::LEGEND_LAYER )
637
  {
638
    QgsLegendLayer* ll = dynamic_cast<QgsLegendLayer*>( li );
627 639
    std::list<QgsMapLayer*> maplayers = ll->mapLayers();
628 640
    int layerCount = maplayers.size();
629 641

  
......
650 662
    adjustIconSize();
651 663
    return;
652 664
  }
653

  
654
  //if the current item is a legend layer file
655
  QgsLegendLayerFile* llf = dynamic_cast<QgsLegendLayerFile*>( currentItem() );
656
  if ( llf )
665
  else if ( li->type() == QgsLegendItem::LEGEND_LAYER_FILE )
657 666
  {
667
    llf = dynamic_cast<QgsLegendLayerFile*>( li );
658 668
    if ( llf->layer() )
659 669
    {
660 670
      //the map layer registry emits a signal an this will remove the legend layer
......
682 692
    return;
683 693
  }
684 694

  
695
  if ( li->type() == QgsLegendItem::LEGEND_LAYER_FILE_GROUP )
696
  {
697
    QgsLegendLayerFileGroup* llfg = dynamic_cast<QgsLegendLayerFileGroup*>( li );
698
    li = dynamic_cast<QgsLegendItem*>( llfg->parent() );
699
  }
700
  if ( li->type() == QgsLegendItem::LEGEND_SYMBOL_ITEM )
701
  {
702
    QgsLegendSymbologyItem* si = dynamic_cast<QgsLegendSymbologyItem*>( li );
703
    li = dynamic_cast<QgsLegendItem*>( si->parent() );
704
  }
685 705
  if ( li->type() == QgsLegendItem::LEGEND_LAYER_FILE )
686 706
  {
687 707
    llf = dynamic_cast<QgsLegendLayerFile*>( li );