mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-30 12:50:53 +00:00
Save expression.
This commit is contained in:
parent
ec657d4207
commit
a96eb529e5
2 changed files with 16 additions and 0 deletions
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue