From 1e91e006c4b40c5d17c75d036ed908b3aa09549e Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Tue, 16 Sep 2014 15:31:06 +0200 Subject: [PATCH] When changing the value of a node, change the size the node if needed. --- .../src/plugins/gui_editor/expression_editor.cpp | 1 - .../src/plugins/gui_editor/expression_node.cpp | 13 +++++++++++++ .../studio/src/plugins/gui_editor/expression_node.h | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/code/studio/src/plugins/gui_editor/expression_editor.cpp b/code/studio/src/plugins/gui_editor/expression_editor.cpp index 502c135e1..1a16762e7 100644 --- a/code/studio/src/plugins/gui_editor/expression_editor.cpp +++ b/code/studio/src/plugins/gui_editor/expression_editor.cpp @@ -271,7 +271,6 @@ void ExpressionEditor::onChangeValue() return; node->setValue( newValue ); - node->update(); } void ExpressionEditor::addExpression( const ExpressionInfo *info ) diff --git a/code/studio/src/plugins/gui_editor/expression_node.cpp b/code/studio/src/plugins/gui_editor/expression_node.cpp index 3a67a2d8d..d7a548dc4 100644 --- a/code/studio/src/plugins/gui_editor/expression_node.cpp +++ b/code/studio/src/plugins/gui_editor/expression_node.cpp @@ -257,6 +257,19 @@ void ExpressionNode::setSlotNames( const QList< QString > &l ) } } +void ExpressionNode::setValue( const QString &value ) +{ + m_value = value; + + int c = m_value.count(); + if( c < 15 ) + m_w = 100.0; + else + m_w = m_w + ( 100.0 / 15.0 ) * ( c - 15.0 ); + + update(); +} + void ExpressionNode::mouseMoveEvent( QGraphicsSceneMouseEvent *e ) { for( int i = 0; i < m_links.count(); i++ ) diff --git a/code/studio/src/plugins/gui_editor/expression_node.h b/code/studio/src/plugins/gui_editor/expression_node.h index 52d515bbb..f4b75ca1a 100644 --- a/code/studio/src/plugins/gui_editor/expression_node.h +++ b/code/studio/src/plugins/gui_editor/expression_node.h @@ -58,7 +58,7 @@ public: void setVariable( bool b ){ m_variable = b; } bool variable() const{ return m_variable; } - void setValue( const QString &value ){ m_value = value; } + void setValue( const QString &value ); QString getValue() const{ return m_value; } bool isValue() const{ return m_isValue; }