diff options
Diffstat (limited to 'qml_plugin/src/launcher')
| -rw-r--r-- | qml_plugin/src/launcher/mathcalc.rs | 10 | ||||
| -rw-r--r-- | qml_plugin/src/launcher/smartcalc.rs | 11 |
2 files changed, 18 insertions, 3 deletions
diff --git a/qml_plugin/src/launcher/mathcalc.rs b/qml_plugin/src/launcher/mathcalc.rs index 626b970..4ac625d 100644 --- a/qml_plugin/src/launcher/mathcalc.rs +++ b/qml_plugin/src/launcher/mathcalc.rs @@ -34,6 +34,9 @@ mod qobject { #[qinvokable] fn reset_ctx(self: Pin<&mut MathCalc>); + + #[qinvokable] + fn reset_result(self: Pin<&mut MathCalc>); } impl cxx_qt::Threading for MathCalc {} @@ -95,7 +98,7 @@ impl qobject::MathCalc { fn reset(mut self: Pin<&mut Self>) { self.as_mut() - .set_result(QVariant::default()); + .reset_result(); self.reset_ctx(); } @@ -105,4 +108,9 @@ impl qobject::MathCalc { .ctx = Arc::new(Mutex::new(parser::Context::default().set_angle_unit(DEFAULT_ANGLE_UNIT))); } + + fn reset_result(mut self: Pin<&mut Self>) { + self.as_mut() + .set_result(QVariant::default()) + } } diff --git a/qml_plugin/src/launcher/smartcalc.rs b/qml_plugin/src/launcher/smartcalc.rs index eee975d..9e94f77 100644 --- a/qml_plugin/src/launcher/smartcalc.rs +++ b/qml_plugin/src/launcher/smartcalc.rs @@ -35,6 +35,9 @@ mod qobject { #[qinvokable] fn reset(self: Pin<&mut SmartCalc>); + + #[qinvokable] + fn reset_result(self: Pin<&mut SmartCalc>); } impl cxx_qt::Threading for SmartCalc {} @@ -128,10 +131,14 @@ impl qobject::SmartCalc { fn reset(mut self: Pin<&mut Self>) { self.as_mut() + .set_cached_query(QVariant::default()); + self.reset_result(); + } + + fn reset_result(mut self: Pin<&mut Self>) { + self.as_mut() .set_result(QVariant::default()); self.as_mut() .set_result_type(qobject::ResultType::Unset); - self.as_mut() - .set_cached_query(QVariant::default()); } } |
