return( this->m_Editor );
}
+// -------------------------------------------------------------------------
+void cpPipelineEditor::Canvas::
+keyPressEvent( QKeyEvent* event )
+{
+ static const int del_key = 16777223;
+ if( event->key( ) == del_key )
+ {
+ auto _items = this->items( );
+ auto i = _items.begin( );
+ while( i != _items.end( ) )
+ {
+ if( ( *i )->isSelected( ) )
+ {
+ Block* b = dynamic_cast< Block* >( *i );
+ Connection* c = dynamic_cast< Connection* >( *i );
+ if( b != NULL )
+ {
+ if( this->m_Editor->deleteFilter( b->namePort( ).toStdString( ) ) )
+ delete b;
+ }
+ else if( c != NULL )
+ {
+ if(
+ this->m_Editor->deleteConnection(
+ c->port1( )->block( )->namePort( ).toStdString( ),
+ c->port2( )->block( )->namePort( ).toStdString( ),
+ c->port1( )->name( ).toStdString( ),
+ c->port2( )->name( ).toStdString( )
+ )
+ )
+ delete c;
+
+ } // fi
+ i = _items.end( );
+ }
+ else
+ i++;
+
+ } // elihw
+
+ } // fi
+}
+
// -------------------------------------------------------------------------
void cpPipelineEditor::Canvas::
wheelEvent( QWheelEvent* event )
protected:
/* TODO
- void keyPressEvent( QKeyEvent* event );
void timerEvent( QTimerEvent* event );
*/
+ void keyPressEvent( QKeyEvent* event );
void wheelEvent( QWheelEvent* event );
void dragEnterEvent( QDragEnterEvent* event );
return( "" );\r
}\r
\r
+// -------------------------------------------------------------------------\r
+bool cpPipelineEditor::Editor::\r
+deleteFilter( const std::string& name )\r
+{\r
+ std::cout << name << std::endl;\r
+#error delete filter\r
+ return( false );\r
+}\r
+\r
+// -------------------------------------------------------------------------\r
+bool cpPipelineEditor::Editor::\r
+deleteConnection(\r
+ const std::string& src, const std::string& des,\r
+ const std::string& in, const std::string& out\r
+ )\r
+{\r
+ std::cout\r
+ << src << " "\r
+ << des << " "\r
+ << in << " "\r
+ << out << std::endl;\r
+#error delete connection\r
+ return( false );\r
+}\r
+\r
// -------------------------------------------------------------------------\r
void cpPipelineEditor::Editor::\r
install( QGraphicsScene* s )\r
const std::string& filter,\r
const QPointF& pnt = QPointF( qreal( 0 ), qreal( 0 ) )\r
);\r
+ bool deleteFilter( const std::string& name );\r
+ bool deleteConnection(\r
+ const std::string& src, const std::string& des,\r
+ const std::string& in, const std::string& out\r
+ );\r
\r
void install( QGraphicsScene* s );\r
bool eventFilter( QObject* o, QEvent* e );\r