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

--HG--
branch : dfighter-tools
hg/feature/qt5
dfighter1985 10 years ago
parent d2c396bc84
commit af550acd62

@ -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 );

Loading…
Cancel
Save