X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpBaseQtApplication%2FBlock.cxx;h=5ee8f08776a639c1c3b8ea217207a9926a8b0465;hb=211cd32b53b9739923f6c5135a704ce1852deca1;hp=36b579fb0eb208405a20470fbddc1b02658afdf3;hpb=1f5c3516bf4240bcdd91979ac303298ef1f75fc3;p=cpPlugins.git diff --git a/lib/cpBaseQtApplication/Block.cxx b/lib/cpBaseQtApplication/Block.cxx index 36b579f..5ee8f08 100644 --- a/lib/cpBaseQtApplication/Block.cxx +++ b/lib/cpBaseQtApplication/Block.cxx @@ -13,6 +13,7 @@ #include #include #include +#include // ------------------------------------------------------------------------- cpBaseQtApplication::Block:: @@ -296,14 +297,27 @@ contextMenuEvent( QGraphicsSceneContextMenuEvent* evt ) QMenu menu; QAction* configureAction = menu.addAction( "Configure" ); QAction* updateAction = menu.addAction( "Update" ); - QAction* selectedAction = menu.exec( evt->screenPos( ) ); + auto widget = + dynamic_cast< cpPlugins::BaseObjects::Widget* >( + this->m_Filter.GetPointer( ) + ); + QAction* enableAction = NULL; + if( widget != NULL ) + enableAction = + menu.addAction( ( widget->GetEnabled( ) )? "Disable": "Enable" ); + QAction* selectedAction = menu.exec( evt->screenPos( ) ); if( selectedAction == configureAction ) { auto dlg = this->m_Filter->CreateQDialog( ); if( dlg != NULL ) dlg->exec( ); } + else if( selectedAction == enableAction ) + { + if( widget != NULL ) + widget->SetEnabled( !( widget->GetEnabled( ) ) ); + } else if( selectedAction == updateAction ) this->m_Editor->updateFilter( this->namePort( ).toStdString( ) ); }