Skip to content
Permalink
Browse files
Updates to legend active layer
- Single click in blank, non-item space in legend unsets active layer (same behavior as clicking group)
- Underline active layer (helpful when active layer, and no selection or multiple selected layers)
  • Loading branch information
dakcarto committed Dec 31, 2012
1 parent d814e19 commit d85ed328ab01b15d079a8d1f28f76493ab56286a
Showing with 14 additions and 1 deletion.
  1. +13 −0 src/app/legend/qgslegend.cpp
  2. +1 −1 src/app/legend/qgslegend.h
@@ -183,6 +183,15 @@ void QgsLegend::handleCurrentItemChanged( QTreeWidgetItem* current, QTreeWidgetI
mMapCanvas->setCurrentLayer( layer );
}

blockSignals( true ); // or itemChanged() emitted
foreach ( QgsLegendLayer *ll, legendLayers() )
{
QFont itemFont = ll->font( 0 );
itemFont.setUnderline( ll->layer() == layer );
ll->setFont( 0, itemFont );
}
blockSignals( false );

emit currentLayerChanged( layer );
}

@@ -385,6 +394,10 @@ void QgsLegend::mousePressEvent( QMouseEvent * e )
{
mMousePressedFlag = true;
mDropTarget = itemAt( e->pos() );
if ( !mDropTarget )
{
setCurrentItem( 0 );
}
}
else if ( e->button() == Qt::RightButton )
{
@@ -465,7 +465,7 @@ class QgsLegend : public QTreeWidget
void collapseAll();
/** toogle update drawing order */
void toggleDrawingOrderUpdate();
void handleItemChange( QTreeWidgetItem* item, int row );
void handleItemChange( QTreeWidgetItem* item, int column );
void handleCloseEditor( QWidget * editor, QAbstractItemDelegate::EndEditHint hint );
/** delegates current layer to map canvas */
void handleCurrentItemChanged( QTreeWidgetItem* current, QTreeWidgetItem* previous );

0 comments on commit d85ed32

Please sign in to comment.