#include <QGraphicsSceneMoveEvent>\r
#include <QGraphicsSceneResizeEvent>\r
#include <QGraphicsSceneWheelEvent>\r
+#include <QInputDialog>\r
\r
#include "QNEPort.h"\r
#include "QNEConnection.h"\r
{\r
this->_CreateBlock(\r
dynamic_cast< TFilter* >( vIt->second.GetPointer( ) ),\r
- QPointF( )\r
+ QPointF( vIt->second->GetViewX( ), vIt->second->GetViewY( ) )\r
);\r
\r
} // rof\r
return( "" );\r
}\r
\r
+// -------------------------------------------------------------------------\r
+void PipelineEditor::QNodesEditor::\r
+synchronizeBlockPositions( )\r
+{\r
+ auto bIt = this->m_Graph->BeginVertices( );\r
+ auto fIt = this->m_Workspace->GetGraph( )->BeginVertices( );\r
+ while(\r
+ bIt != this->m_Graph->EndVertices( ) &&\r
+ fIt != this->m_Workspace->GetGraph( )->EndVertices( )\r
+ )\r
+ {\r
+ auto pos = bIt->second->scenePos( );\r
+ fIt->second->SetViewCoords( pos.x( ), pos.y( ) );\r
+ bIt++;\r
+ fIt++;\r
+\r
+ } // elihw\r
+}\r
+\r
// -------------------------------------------------------------------------\r
void PipelineEditor::QNodesEditor::\r
install( QGraphicsScene* s )\r
QNEBlock* b = new QNEBlock( 0, this->m_Scene );\r
b->setNamePort( f->GetName( ) );\r
b->setTypePort( f->GetClassName( ) );\r
- // TODO: b->setScenePos( pnt );\r
+ b->setPos( pnt );\r
\r
// Add input ports\r
std::set< std::string > inputs;\r
\r
if( block != NULL )\r
{\r
+ QString old_name = block->namePort( )->name( );\r
+ bool ok;\r
+ QString new_name =\r
+ QInputDialog::getText(\r
+ dynamic_cast< QWidget* >( this->parent( ) ),\r
+ "Change filter name",\r
+ "Filter name:",\r
+ QLineEdit::Normal,\r
+ old_name,\r
+ &ok\r
+ );\r
+ if( ok && !new_name.isEmpty( ) && old_name != new_name )\r
+ {\r
+ ok = this->m_Graph->RenameVertex(\r
+ old_name.toStdString( ),\r
+ new_name.toStdString( )\r
+ );\r
+ if( ok )\r
+ {\r
+ block->namePort( )->setName( new_name );\r
+ this->m_Workspace->GetGraph( )->RenameVertex(\r
+ old_name.toStdString( ),\r
+ new_name.toStdString( )\r
+ );\r
+\r
+ } // fi\r
+\r
+ } // fi\r
+\r
/* TODO\r
auto ports = block->ports( );\r
std::string name = "";\r