Skip to content

Access nested components from rust? #5794

Answered by FloVanGH
hellozyemlya asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

there are two ways. One is to use a binding on the window the other is to use a global:

Window binding

import { VerticalBox } from "std-widgets.slint";
import {MyTextComponent} from "child.slint";

export component AppWindow inherits Window {
    in property text-model <=> myteext.model;
    
    callback request-increase-value();
    VerticalBox {
        mytext := MyTextComponent {

        }
    }
}
let window = AppWindow::new().unwrap();

window.set_text_model(/* set your data here */);

window.run().unwrap();

global

import { VerticalBox } from "std-widgets.slint";
import {MyTextComponent} from "child.slint";

export global Adapter {
   in property <[{foo: string, col: color}]> te…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Enyium
Comment options

Comment options

You must be logged in to vote
1 reply
@hellozyemlya
Comment options

Answer selected by hellozyemlya
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants