mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-27 01:06:19 +00:00
Save expression.
This commit is contained in:
parent
f3fbfdcb83
commit
814fedbc4a
2 changed files with 16 additions and 0 deletions
|
@ -132,6 +132,9 @@ void ExpressionEditor::contextMenuEvent( QContextMenuEvent *e )
|
||||||
{
|
{
|
||||||
a = menu.addAction( "Build expression" );
|
a = menu.addAction( "Build expression" );
|
||||||
connect( a, SIGNAL( triggered() ), this, SLOT( onBuildExpression() ) );
|
connect( a, SIGNAL( triggered() ), this, SLOT( onBuildExpression() ) );
|
||||||
|
|
||||||
|
a = menu.addAction( "Save" );
|
||||||
|
connect( a, SIGNAL( triggered() ), this, SLOT( onSave() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.exec( e->globalPos() );
|
menu.exec( e->globalPos() );
|
||||||
|
@ -315,6 +318,16 @@ void ExpressionEditor::onBuildExpression()
|
||||||
tr( "The result is\n" ) + result );
|
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 )
|
void ExpressionEditor::addExpression( const ExpressionInfo *info )
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,6 +35,7 @@ public:
|
||||||
~ExpressionEditor();
|
~ExpressionEditor();
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
|
QString result() const{ return m_result; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void contextMenuEvent( QContextMenuEvent *e );
|
void contextMenuEvent( QContextMenuEvent *e );
|
||||||
|
@ -49,6 +50,7 @@ private Q_SLOTS:
|
||||||
void onChangeValue();
|
void onChangeValue();
|
||||||
void onSetRoot();
|
void onSetRoot();
|
||||||
void onBuildExpression();
|
void onBuildExpression();
|
||||||
|
void onSave();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addExpression( const ExpressionInfo *info );
|
void addExpression( const ExpressionInfo *info );
|
||||||
|
@ -61,6 +63,7 @@ private:
|
||||||
int m_nodeCount;
|
int m_nodeCount;
|
||||||
|
|
||||||
ExpressionEditorPvt *m_pvt;
|
ExpressionEditorPvt *m_pvt;
|
||||||
|
QString m_result;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue