feat: add search bar
This commit is contained in:
Generated
+1
@@ -4644,6 +4644,7 @@ dependencies = [
|
||||
"reqwest",
|
||||
"slint",
|
||||
"slint-build",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -6,6 +6,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
reqwest = "0.13.3"
|
||||
slint = "1.14.1"
|
||||
tokio = "1.52.1"
|
||||
|
||||
[build-dependencies]
|
||||
slint-build = "1.14.1"
|
||||
|
||||
+3
-7
@@ -6,15 +6,11 @@ mod rutracker;
|
||||
slint::include_modules!();
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
rutracker::main();
|
||||
let ui = AppWindow::new()?;
|
||||
|
||||
ui.on_request_increase_value({
|
||||
let ui_handle = ui.as_weak();
|
||||
move || {
|
||||
let ui = ui_handle.unwrap();
|
||||
ui.set_counter(ui.get_counter() + 1);
|
||||
}
|
||||
ui.on_request_text_input(|text| {
|
||||
let text = text.trim();
|
||||
println!("User input: {}", text);
|
||||
});
|
||||
|
||||
ui.run()?;
|
||||
|
||||
+18
-12
@@ -1,22 +1,28 @@
|
||||
import { Button, LineEdit, VerticalBox } from "std-widgets.slint";
|
||||
|
||||
export component AppWindow inherits Window {
|
||||
in-out property <int> counter: 42;
|
||||
callback request-increase-value();
|
||||
// in-out property <int> counter: 42;
|
||||
// callback request-increase-value();
|
||||
width: 200px;
|
||||
height: 60px;
|
||||
|
||||
in-out property <string> search-text: "";
|
||||
callback request-text-input(string);
|
||||
VerticalBox {
|
||||
Text {
|
||||
text: "Counter: \{root.counter}";
|
||||
}
|
||||
|
||||
LineEdit {
|
||||
placeholder-text: "Search for Software"
|
||||
placeholder-text: "Search for Software";
|
||||
accepted(text) => {
|
||||
// debug("Accepted: ", text);
|
||||
root.request-text-input(self.text);
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Increase value";
|
||||
clicked => {
|
||||
root.request-increase-value();
|
||||
}
|
||||
}
|
||||
// Button {
|
||||
// text: "Increase value";
|
||||
// clicked => {
|
||||
// root.request-increase-value();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user