summaryrefslogtreecommitdiff
path: root/qml_plugin/src/launcher/smartcalc.rs
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2026-08-03 18:22:04 +0800
committerlittleblack111 <littleblack11111@gmail.com>2026-08-04 23:07:47 +0800
commit029ff8999a5d3c1613302b805228cd6927b4dddb (patch)
tree24b768bf3ed8aabad6ae3ff1d5322b60722fffef /qml_plugin/src/launcher/smartcalc.rs
parent345c9344a37740fd084bf310be6e56e483c86d5e (diff)
qml: reset component when current state broke via new input
Diffstat (limited to 'qml_plugin/src/launcher/smartcalc.rs')
-rw-r--r--qml_plugin/src/launcher/smartcalc.rs11
1 files changed, 9 insertions, 2 deletions
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());
}
}