From 405954783576c56afcf98f3506f676cdced2fd92 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 17 Sep 2014 19:27:06 +0200 Subject: [PATCH] Added support for clearing the Expression Editor scene. --HG-- branch : dfighter-tools --- .../src/plugins/gui_editor/expression_editor.cpp | 12 ++++++++++++ .../src/plugins/gui_editor/expression_editor.h | 1 + 2 files changed, 13 insertions(+) diff --git a/code/studio/src/plugins/gui_editor/expression_editor.cpp b/code/studio/src/plugins/gui_editor/expression_editor.cpp index 5be3939fd..392bdca41 100644 --- a/code/studio/src/plugins/gui_editor/expression_editor.cpp +++ b/code/studio/src/plugins/gui_editor/expression_editor.cpp @@ -135,6 +135,9 @@ void ExpressionEditor::contextMenuEvent( QContextMenuEvent *e ) a = menu.addAction( "Save" ); connect( a, SIGNAL( triggered() ), this, SLOT( onSave() ) ); + + a = menu.addAction( "Clear" ); + connect( a, SIGNAL( triggered() ), this, SLOT( onClear() ) ); } menu.exec( e->globalPos() ); @@ -334,6 +337,15 @@ void ExpressionEditor::onSave() close(); } +void ExpressionEditor::onClear() +{ + m_scene->clear(); + m_pvt->m_root = NULL; + m_nodeCount = 0; + m_selectionCount = 0; + m_result = ""; +} + 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 ce13ff58e..92cc959bd 100644 --- a/code/studio/src/plugins/gui_editor/expression_editor.h +++ b/code/studio/src/plugins/gui_editor/expression_editor.h @@ -55,6 +55,7 @@ private Q_SLOTS: void onSetRoot(); void onBuildExpression(); void onSave(); + void onClear(); private: void addExpression( const ExpressionInfo *info );