Skip to content

Commit 5fefaaa

Browse files
hungerogoffart
authored andcommitted
Make code compatible with slint 1.0
1 parent d0e521e commit 5fefaaa

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ rust-version = "1.68" # Because of the allocator
99

1010

1111
[dependencies]
12-
slint = { version = "0.3.4", default-features = false, features = ["compat-0-3-0"] }
12+
slint = { version = "1.0.0", default-features = false, features = ["compat-1-0"] }
1313

1414
# for the rp-pico, replace by the hal for your crate
1515
rp-pico = { version = "0.5", optional = true }
@@ -25,7 +25,7 @@ embedded-hal = {version = "0.2.7", optional = true }
2525
fugit = { version = "0.3.6", optional = true }
2626

2727
[build-dependencies]
28-
slint-build = { version = "0.3.4" }
28+
slint-build = { version = "1.0.0" }
2929

3030

3131
[features]

src/main.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extern crate alloc;
66
slint::include_modules!();
77

88
fn create_slint_app() -> AppWindow {
9-
let ui = AppWindow::new();
9+
let ui = AppWindow::new().expect("Failed to load UI");
1010

1111
let ui_handle = ui.as_weak();
1212
ui.on_request_increase_value(move || {
@@ -17,8 +17,8 @@ fn create_slint_app() -> AppWindow {
1717
}
1818

1919
#[cfg(feature = "simulator")]
20-
fn main() {
21-
create_slint_app().run();
20+
fn main() -> Result<(), slint::PlatformError> {
21+
create_slint_app().run()
2222
}
2323

2424
#[cfg(not(feature = "simulator"))]
@@ -93,21 +93,21 @@ fn main() -> ! {
9393
.unwrap();
9494

9595
// -------- Setup the Slint backend --------
96-
let window = slint::platform::software_renderer::MinimalSoftwareWindow::new();
96+
let window = slint::platform::software_renderer::MinimalSoftwareWindow::new(Default::default());
9797
slint::platform::set_platform(alloc::boxed::Box::new(MyPlatform {
9898
window: window.clone(),
9999
timer,
100100
}))
101101
.unwrap();
102102

103103
struct MyPlatform {
104-
window: alloc::rc::Rc<slint::platform::software_renderer::MinimalSoftwareWindow<1>>,
104+
window: alloc::rc::Rc<slint::platform::software_renderer::MinimalSoftwareWindow>,
105105
timer: hal::Timer,
106106
}
107107

108108
impl slint::platform::Platform for MyPlatform {
109-
fn create_window_adapter(&self) -> alloc::rc::Rc<dyn slint::platform::WindowAdapter> {
110-
self.window.clone()
109+
fn create_window_adapter(&self) -> Result<alloc::rc::Rc<dyn slint::platform::WindowAdapter>, slint::PlatformError> {
110+
Ok(self.window.clone())
111111
}
112112
fn duration_since_start(&self) -> core::time::Duration {
113113
core::time::Duration::from_micros(self.timer.get_counter())

0 commit comments

Comments
 (0)