From 83859cdd82b9012e36dc7488984c5552dcb682e3 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 17 Sep 2014 15:47:49 +0200 Subject: [PATCH] Save expression. --HG-- branch : dfighter-tools --- .../src/plugins/gui_editor/expression_editor.cpp | 13 +++++++++++++ .../src/plugins/gui_editor/expression_editor.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/code/studio/src/plugins/gui_editor/expression_editor.cpp b/code/studio/src/plugins/gui_editor/expression_editor.cpp index a1c35e892..db77d18f6 100644 --- a/code/studio/src/plugins/gui_editor/expression_editor.cpp +++ b/code/studio/src/plugins/gui_editor/expression_editor.cpp @@ -132,6 +132,9 @@ void ExpressionEditor::contextMenuEvent( QContextMenuEvent *e ) { a = menu.addAction( "Build expression" ); connect( a, SIGNAL( triggered() ), this, SLOT( onBuildExpression() ) ); + + a = menu.addAction( "Save" ); + connect( a, SIGNAL( triggered() ), this, SLOT( onSave() ) ); } menu.exec( e->globalPos() ); @@ -315,6 +318,16 @@ void ExpressionEditor::onBuildExpression() tr( "The result is\n" ) + result ); } +void ExpressionEditor::onSave() +{ + if( m_pvt->m_root != NULL ) + { + m_result = m_pvt->m_root->build(); + } + + hide(); +} + void ExpressionEditor::addExpression( const ExpressionInfo *info ) { diff --git a/code/studio/src/plugins/gui_editor/expression_editor.h b/code/studio/src/plugins/gui_editor/expression_editor.h index 700813618..02db8e06b 100644 --- a/code/studio/src/plugins/gui_editor/expression_editor.h +++ b/code/studio/src/plugins/gui_editor/expression_editor.h @@ -35,6 +35,7 @@ public: ~ExpressionEditor(); void load(); + QString result() const{ return m_result; } protected: void contextMenuEvent( QContextMenuEvent *e ); @@ -49,6 +50,7 @@ private Q_SLOTS: void onChangeValue(); void onSetRoot(); void onBuildExpression(); + void onSave(); private: void addExpression( const ExpressionInfo *info ); @@ -61,6 +63,7 @@ private: int m_nodeCount; ExpressionEditorPvt *m_pvt; + QString m_result; }; #endif