Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow connecting signals with builders #1962

Open
pozix604 opened this issue Jan 15, 2025 · 1 comment
Open

Allow connecting signals with builders #1962

pozix604 opened this issue Jan 15, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@pozix604
Copy link

A major benefit of builders is to configure an object "in one go". It'd be nice to be able to set up signals for widgets using builders:

    let button = Button::builder()
        .label("Press me!")
        .clicked(|b| b.set_label("Hello World!"))
        .build();

instead of what we have to do now:

    let button = Button::builder()
        .label("Press me!")
        .build();

    button.connect_clicked(|button| {
        button.set_label("Hello World!");
    });

(from https://gtk-rs.org/gtk4-rs/stable/latest/book/widgets.html)

@pozix604 pozix604 added the enhancement New feature or request label Jan 15, 2025
@A6GibKm
Copy link
Contributor

A6GibKm commented Jan 17, 2025

The idea behind a builder is to construct an object, properties are interesting to set during object construction and some cannot be set afterwards. However signals are always after it has been created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants