slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.56k stars 604 forks source link

LineEdit callback not working #4044

Closed FriederHannenheim closed 11 months ago

FriederHannenheim commented 11 months ago

I have made the following project for demonstration purposes. When one types in the LineEdit the callback should be called and "line edit was edited" should be printed. However when I do cargo r and type in the LineEdit nothing happens.

# Cargo.toml
[package]
name = "slint-test"
version = "0.1.0"
edition = "2021"

[dependencies]
slint = { version = "1.3.0", default-features = false, features = ["backend-winit", "renderer-femtovg", "std", "compat-1-2", "renderer-software"] }
// src/main.rs
slint::slint! {
    import { LineEdit } from "std-widgets.slint";
    export component MainWindow inherits Window {
        callback edit <=> le.edited;
        le := LineEdit {

        }
    }
}

fn main() {
    let ui = MainWindow::new().unwrap();
    ui.on_edit(|_t| {
        println!("line edit was edited");
    });
    ui.run().unwrap();
}

My System

tronical commented 11 months ago

Thank you for the bug report. This was a regression that slipped into 1.3.1. It's fixed in #4028. You can either work around it by pinning to 1.3.0, or you could switch to git builds. We will release 1.3.2 very soon that includes the fix.

tronical commented 11 months ago

Duplicate of #4027