mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Added unlinking support.
--HG-- branch : dfighter-tools
This commit is contained in:
parent
875cad3f72
commit
aa67011381
4 changed files with 22 additions and 1 deletions
|
@ -65,6 +65,9 @@ void ExpressionEditor::contextMenuEvent( QContextMenuEvent *e )
|
|||
a = menu.addAction( "Link" );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( onLinkItems() ) );
|
||||
}
|
||||
|
||||
a = menu.addAction( "Unlink" );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( onUnLinkItems() ) );
|
||||
}
|
||||
|
||||
menu.exec( e->globalPos() );
|
||||
|
@ -150,4 +153,18 @@ void ExpressionEditor::onLinkItems()
|
|||
m_scene->addItem( link );
|
||||
}
|
||||
|
||||
void ExpressionEditor::onUnLinkItems()
|
||||
{
|
||||
QList< QGraphicsItem* > l = m_scene->selectedItems();
|
||||
|
||||
for( int i = 0; i < l.count(); i++ )
|
||||
{
|
||||
ExpressionNode *node = dynamic_cast< ExpressionNode* >( l[ i ] );
|
||||
if( node == NULL )
|
||||
continue;
|
||||
|
||||
node->clearLinks();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ private Q_SLOTS:
|
|||
void onDeleteSelection();
|
||||
void onSelectionChanged();
|
||||
void onLinkItems();
|
||||
void onUnLinkItems();
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -58,6 +58,8 @@ void ExpressionLink::unlink()
|
|||
|
||||
m_from = NULL;
|
||||
m_to = NULL;
|
||||
|
||||
delete this;
|
||||
}
|
||||
|
||||
void ExpressionLink::nodeMoved()
|
||||
|
|
|
@ -47,13 +47,14 @@ public:
|
|||
|
||||
void getSlots( QList< SlotInfo > &l );
|
||||
|
||||
void clearLinks();
|
||||
|
||||
protected:
|
||||
void mouseMoveEvent( QGraphicsSceneMouseEvent *e );
|
||||
|
||||
private:
|
||||
void createSlots();
|
||||
void paintSlots( QPainter *painter );
|
||||
void clearLinks();
|
||||
|
||||
qreal m_w;
|
||||
qreal m_h;
|
||||
|
|
Loading…
Reference in a new issue