Throw an error message when trying to link nodes that are already linked.
This commit is contained in:
parent
a6e5f52e17
commit
ac9dc5638c
1 changed files with 10 additions and 0 deletions
|
@ -26,6 +26,8 @@
|
|||
#include "expression_node.h"
|
||||
#include "expression_link.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
ExpressionEditor::ExpressionEditor( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
|
@ -113,6 +115,14 @@ void ExpressionEditor::onLinkItems()
|
|||
ExpressionNode *from = static_cast< ExpressionNode* >( l[ 0 ] );
|
||||
ExpressionNode *to = static_cast< ExpressionNode* >( l[ 1 ] );
|
||||
|
||||
if( ( from->link() != NULL ) || ( to->link() != NULL ) )
|
||||
{
|
||||
QMessageBox::information( this,
|
||||
tr( "Failed to link nodes" ),
|
||||
tr( "Unfortunately those nodes are already linked." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
ExpressionLink *link = new ExpressionLink();
|
||||
link->link( from, to );
|
||||
|
||||
|
|
Loading…
Reference in a new issue