Skip to content
Permalink
Browse files

enable (or disable) "feature action" tool after adding (or removing) …

…actions
  • Loading branch information
brushtyler committed Jan 11, 2012
1 parent acc1d55 commit 9ca05fee98dc8c0ed188c430f4720a7bb8cb9b50
Showing with 10 additions and 9 deletions.
  1. +10 −9 src/app/qgisapp.cpp
@@ -3300,15 +3300,12 @@ void QgisApp::doFeatureAction()

void QgisApp::updateDefaultFeatureAction( QAction *action )
{
foreach( QAction *a, mFeatureActionMenu->actions() )
{
a->setChecked( a == action );
}

QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( activeLayer() );
if ( !vlayer )
return;

mFeatureActionMenu->setActiveAction( action );

int index = mFeatureActionMenu->actions().indexOf( action );
vlayer->actions()->setDefaultAction( index );

@@ -3327,10 +3324,9 @@ void QgisApp::refreshFeatureActions()
for ( int i = 0; i < actions->size(); i++ )
{
QAction *action = mFeatureActionMenu->addAction( actions->at( i ).name() );
action->setCheckable( true );
if ( i == actions->defaultAction() )
{
action->setChecked( true );
mFeatureActionMenu->setActiveAction( action );
}
}
}
@@ -6123,6 +6119,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( layer );
QgsVectorDataProvider* dprovider = vlayer->dataProvider();
bool layerHasSelection = vlayer->selectedFeatureCount() != 0;
bool layerHasActions = vlayer->actions()->size() > 0;

mActionLocalHistogramStretch->setEnabled( false );
mActionFullHistogramStretch->setEnabled( false );
@@ -6138,7 +6135,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionLayerSaveAs->setEnabled( true );
mActionLayerSelectionSaveAs->setEnabled( true );
mActionCopyFeatures->setEnabled( layerHasSelection );
mActionFeatureAction->setEnabled( vlayer->actions()->size() > 0 );
mActionFeatureAction->setEnabled( layerHasActions );

if ( !vlayer->isEditable() && mMapCanvas->mapTool() && mMapCanvas->mapTool()->isEditTool() )
{
@@ -6979,7 +6976,11 @@ void QgisApp::showLayerProperties( QgsMapLayer *ml )
vlp = new QgsVectorLayerProperties( vlayer );
connect( vlp, SIGNAL( refreshLegend( QString, bool ) ), mMapLegend, SLOT( refreshLayerSymbology( QString, bool ) ) );
}
vlp->exec();

if ( vlp->exec() )
{
activateDeactivateLayerRelatedActions( ml );
}
delete vlp; // delete since dialog cannot be reused without updating code
}
else if ( ml->type() == QgsMapLayer::PluginLayer )

0 comments on commit 9ca05fe

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