Skip to content

Not able to get the width of window #1229

Answered by ogoffart
dilawar asked this question in Q&A
Discussion options

You must be logged in to vote

Only the property declared in the last element of the .slint are exposed.

The property of the window are actually not exposed.

We would like to extend the native window API so we can query that in native code (see #323 and #333 )

In the mean time, you can re-export the properties using something like

use slint;

slint::slint!{
    HelloWorld := Window {
        width: 100px;
        height: 100px;
        // ###### added these two lines to re-export the size
        property window_width <=> width;
        property window_height <=> height;
        Text {
            text: "hello world";
            color: green;
        }
    }
}

fn main() {
    let win = HelloWorld::new();
    //  ### …

Replies: 1 comment 1 reply

Comment options

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

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