X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPipelineEditor%2FPort.cxx;h=b0278eaecf1524078fc92462ed445170953c42e7;hb=ebbbc4c90ed0e4814d360686e8d4b6aab509914c;hp=ab478c298343960aa6bd064649c0fef71a5d4869;hpb=46f2cf7aa39bda8301b22fcfddd43daf0dc13770;p=cpPlugins.git diff --git a/lib/cpPipelineEditor/Port.cxx b/lib/cpPipelineEditor/Port.cxx index ab478c2..b0278ea 100644 --- a/lib/cpPipelineEditor/Port.cxx +++ b/lib/cpPipelineEditor/Port.cxx @@ -1,8 +1,14 @@ #include "Port.h" #include "Connection.h" +#include "Block.h" +#include "Editor.h" + +#include #include +#include #include +#include #include #include @@ -120,37 +126,6 @@ isConnected( Port* other ) return( false ); } -// ------------------------------------------------------------------------- -cpPipelineEditor::TypePort:: -TypePort( QGraphicsItem* parent, QGraphicsScene* scene ) - : Superclass( parent, scene ) -{ -} - -// ------------------------------------------------------------------------- -cpPipelineEditor::TypePort:: -~TypePort( ) -{ -} - -// ------------------------------------------------------------------------- -void cpPipelineEditor::TypePort:: -_updateLabels( ) -{ - QFont font( this->scene( )->font( ) ); - font.setItalic( true ); - this->m_Label->setFont( font ); - this->m_ExtendedLabel->setFont( font ); - this->setPath( QPainterPath( ) ); -} - -// ------------------------------------------------------------------------- -bool cpPipelineEditor::TypePort:: -isConnected( Port* other ) -{ - return( false ); -} - // ------------------------------------------------------------------------- cpPipelineEditor::InputPort:: InputPort( QGraphicsItem* parent, QGraphicsScene* scene ) @@ -292,4 +267,50 @@ itemChange( GraphicsItemChange change, const QVariant& value ) return( value ); } +// ------------------------------------------------------------------------- +void cpPipelineEditor::OutputPort:: +contextMenuEvent( QGraphicsSceneContextMenuEvent* evt ) +{ + if( this->m_Block == NULL ) + return; + + QMenu menu; + QAction* showAction = menu.addAction( "Show" ); + QAction* hideAction = menu.addAction( "Hide" ); + QAction* propertiesAction = menu.addAction( "Properties" ); + QAction* selectedAction = menu.exec( evt->screenPos( ) ); + + if( selectedAction == showAction ) + { + this->m_Block->editor( )->showOutputData( + this->m_Block->namePort( ).toStdString( ), + this->name( ).toStdString( ) + ); + } + else if( selectedAction == hideAction ) + { + this->m_Block->editor( )->hideOutputData( + this->m_Block->namePort( ).toStdString( ), + this->name( ).toStdString( ) + ); + } + else if( selectedAction == propertiesAction ) + { + auto filter = this->m_Block->filter( ); + auto name = this->name( ).toStdString( ); + if( filter != NULL ) + { + auto output = filter->GetOutput( name ); + if( output != NULL ) + { + auto dlg = output->CreateQtDialog( ); + dlg->exec( ); + + } // fi + + } // fi + + } // fi +} + // eof - $RCSfile$