Throw an error message when trying to link nodes that are already linked.

This commit is contained in:
dfighter1985 2014-09-13 00:54:37 +02:00
parent 4b7e1c95a6
commit 69f89d4c74

View file

@ -26,6 +26,8 @@
#include "expression_node.h" #include "expression_node.h"
#include "expression_link.h" #include "expression_link.h"
#include <QMessageBox>
ExpressionEditor::ExpressionEditor( QWidget *parent ) : ExpressionEditor::ExpressionEditor( QWidget *parent ) :
QWidget( parent ) QWidget( parent )
{ {
@ -113,6 +115,14 @@ void ExpressionEditor::onLinkItems()
ExpressionNode *from = static_cast< ExpressionNode* >( l[ 0 ] ); ExpressionNode *from = static_cast< ExpressionNode* >( l[ 0 ] );
ExpressionNode *to = static_cast< ExpressionNode* >( l[ 1 ] ); 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(); ExpressionLink *link = new ExpressionLink();
link->link( from, to ); link->link( from, to );