X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2FcpPipelineEditor%2FQNEBlock.h;h=6b591ac726c15b8cae1016398d936289ff762bf6;hb=f4aeff15ebb41183d4b89f41b29ec26043848722;hp=516e871c71ca2b9dde5b5ac993665ce036567024;hpb=ef8b6e12859181d3faa8019ce7319c539c0f86ec;p=cpPlugins.git diff --git a/appli/cpPipelineEditor/QNEBlock.h b/appli/cpPipelineEditor/QNEBlock.h index 516e871..6b591ac 100644 --- a/appli/cpPipelineEditor/QNEBlock.h +++ b/appli/cpPipelineEditor/QNEBlock.h @@ -21,7 +21,8 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ #ifndef __PIPELINEEDITOR__QNEBLOCK__H__ #define __PIPELINEEDITOR__QNEBLOCK__H__ @@ -31,6 +32,10 @@ namespace PipelineEditor { class QNEPort; + class QNENamePort; + class QNETypePort; + class QNEInputPort; + class QNEOutputPort; class QNEBlock : public QGraphicsPathItem @@ -40,39 +45,59 @@ namespace PipelineEditor typedef QGraphicsPathItem Superclass; public: - enum { Type = QGraphicsItem::UserType + 3 }; + enum { Type = QGraphicsItem::UserType + 6 }; QNEBlock( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL ); virtual ~QNEBlock( ); - QNEPort* addPort( - const QString& name, bool isOutput, int flags = 0, int ptr = 0 - ); - void addInputPort( const QString& name ); - void addOutputPort( const QString& name ); - void addInputPorts( const QStringList& names ); - void addOutputPorts( const QStringList& names ); - void save( QDataStream& ds ); - void load( QDataStream& ds, QMap< quint64, QNEPort* >& portMap ); + void setNamePort( const QString& txt ); + void setTypePort( const QString& txt ); + void addInputPort( const QString& txt ); + void addOutputPort( const QString& txt ); + QVector< QNEPort* > ports( ); + + inline QNENamePort* namePort( ) + { return( this->m_NamePort ); } + inline QNETypePort* typePort( ) + { return( this->m_TypePort ); } + inline QVector< QNEInputPort* >& inputPorts( ) + { return( this->m_InputPorts ); } + inline QVector< QNEOutputPort* >& outputPorts( ) + { return( this->m_OutputPorts ); } + + inline const QNENamePort* namePort( ) const + { return( this->m_NamePort ); } + inline const QNETypePort* typePort( ) const + { return( this->m_TypePort ); } + inline const QVector< QNEInputPort* >& inputPorts( ) const + { return( this->m_InputPorts ); } + inline const QVector< QNEOutputPort* >& outputPorts( ) const + { return( this->m_OutputPorts ); } + + QNEBlock* clone( ); + inline int type( ) const + { return( this->Type ); } + void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget ); - QNEBlock* clone( ); - QVector< QNEPort* > ports( ); - - int type( ) const - { return( this->Type ); } - + protected: QVariant itemChange( GraphicsItemChange change, const QVariant& value ); + void _configPort( QNEPort* port ); private: int m_HorzMargin; int m_VertMargin; int m_Width; int m_Height; + + QNENamePort* m_NamePort; + QNETypePort* m_TypePort; + QVector< QNEInputPort* > m_InputPorts; + QVector< QNEOutputPort* > m_OutputPorts; }; } // ecapseman