Save expression.

This commit is contained in:
dfighter1985 2014-09-17 15:47:49 +02:00
parent ec657d4207
commit a96eb529e5
2 changed files with 16 additions and 0 deletions

View file

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

View file

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