From 69f89d4c74afa81a0cb8e2cdf3f0d670e71fc551 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 13 Sep 2014 00:54:37 +0200 Subject: [PATCH] Throw an error message when trying to link nodes that are already linked. --- .../src/plugins/gui_editor/expression_editor.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/code/studio/src/plugins/gui_editor/expression_editor.cpp b/code/studio/src/plugins/gui_editor/expression_editor.cpp index 48f807696..d942623ba 100644 --- a/code/studio/src/plugins/gui_editor/expression_editor.cpp +++ b/code/studio/src/plugins/gui_editor/expression_editor.cpp @@ -26,6 +26,8 @@ #include "expression_node.h" #include "expression_link.h" +#include + 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 );