X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=appli%2FcpPipelineEditor%2FQNodesEditor.cxx;h=590f8df610c632c2b77b5369aed1916246b74a0a;hb=9c75dcecf566cc567583caf4687ce523a2af586d;hp=9669eea49704045325fb3dddb2dcdfa9f49b86fb;hpb=ef8b6e12859181d3faa8019ce7319c539c0f86ec;p=cpPlugins.git diff --git a/appli/cpPipelineEditor/QNodesEditor.cxx b/appli/cpPipelineEditor/QNodesEditor.cxx index 9669eea..590f8df 100644 --- a/appli/cpPipelineEditor/QNodesEditor.cxx +++ b/appli/cpPipelineEditor/QNodesEditor.cxx @@ -77,19 +77,19 @@ eventFilter( QObject* o, QEvent* e ) switch ( ( int ) e->type( ) ) { - case QEvent::GraphicsThis->M_SceneMousePress: + case QEvent::GraphicsSceneMousePress: { switch ( ( int ) me->button( ) ) { case Qt::LeftButton: { - QGraphicsItem* item = this->itemAt( me->this->m_ScenePos( ) ); + QGraphicsItem* item = this->itemAt( me->scenePos( ) ); if( item && item->type( ) == QNEPort::Type ) { this->m_Conn = new QNEConnection( 0, this->m_Scene ); this->m_Conn->setPort1( ( QNEPort* ) item ); - this->m_Conn->setPos1( item->this->m_ScenePos( ) ); - this->m_Conn->setPos2( me->this->m_ScenePos( ) ); + this->m_Conn->setPos1( item->scenePos( ) ); + this->m_Conn->setPos2( me->scenePos( ) ); this->m_Conn->updatePath( ); return( true ); @@ -105,7 +105,7 @@ eventFilter( QObject* o, QEvent* e ) } case Qt::RightButton: { - QGraphicsItem* item = itemAt( me->this->m_ScenePos( ) ); + QGraphicsItem* item = itemAt( me->scenePos( ) ); if( item && ( item->type( ) == QNEConnection::Type || item->type( ) == QNEBlock::Type ) ) delete item; // if( selBlock == ( QNEBlock* ) item ) @@ -114,29 +114,29 @@ eventFilter( QObject* o, QEvent* e ) } } } - case QEvent::GraphicsThis->M_SceneMouseMove: + case QEvent::GraphicsSceneMouseMove: { if( this->m_Conn ) { - this->m_Conn->setPos2( me->this->m_ScenePos( ) ); + this->m_Conn->setPos2( me->scenePos( ) ); this->m_Conn->updatePath( ); return( true ); } break; } - case QEvent::GraphicsThis->M_SceneMouseRelease: + case QEvent::GraphicsSceneMouseRelease: { if( this->m_Conn && me->button( ) == Qt::LeftButton ) { - QGraphicsItem* item = itemAt( me->this->m_ScenePos( ) ); + QGraphicsItem* item = itemAt( me->scenePos( ) ); if( item && item->type( ) == QNEPort::Type ) { QNEPort* port1 = this->m_Conn->port1( ); QNEPort* port2 = ( QNEPort* ) item; - if( port1->block( ) != port2->block( ) && port1->isOutput( ) != port2->isOutput( ) && !port1->isThis->M_Connected( port2 ) ) + if( port1->block( ) != port2->block( ) && port1->isOutput( ) != port2->isOutput( ) && !port1->isConnected( port2 ) ) { - this->m_Conn->setPos2( port2->this->m_ScenePos( ) ); + this->m_Conn->setPos2( port2->scenePos( ) ); this->m_Conn->setPort2( port2 ); this->m_Conn->updatePath( ); this->m_Conn = NULL; @@ -150,51 +150,8 @@ eventFilter( QObject* o, QEvent* e ) } break; } - } + } // hctiws return( this->Superclass::eventFilter( o, e ) ); } -// ------------------------------------------------------------------------- -void PipelineEditor::QNodesEditor:: -save( QDataStream& ds ) -{ - foreach( QGraphicsItem* item, this->m_Scene->items( ) ) - if( item->type( ) == QNEBlock::Type ) - { - ds << item->type( ); - ( ( QNEBlock* ) item )->save( ds ); - } - - foreach( QGraphicsItem* item, this->m_Scene->items( ) ) - if( item->type( ) == QNEConnection::Type ) - { - ds << item->type( ); - ( ( QNEConnection* ) item )->save( ds ); - } -} - -// ------------------------------------------------------------------------- -void PipelineEditor::QNodesEditor:: -load( QDataStream& ds ) -{ - this->m_Scene->clear( ); - - QMap portMap; - - while ( !ds.atEnd( ) ) - { - int type; - ds >> type; - if( type == QNEBlock::Type ) - { - QNEBlock* block = new QNEBlock( 0, this->m_Scene ); - block->load( ds, portMap ); - } else if( type == QNEConnection::Type ) - { - QNEConnection* this->m_Conn = new QNEConnection( 0, this->m_Scene ); - this->m_Conn->load( ds, portMap ); - } - } -} - // eof - $RCSfile$