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

preferred-... properties and Rust lib's Window::set_size() ineffective #6535

Open
Enyium opened this issue Oct 14, 2024 · 1 comment
Open
Labels
a:layouts Related to the layouting and positioning of the elements (mO,bT) bug Something isn't working

Comments

@Enyium
Copy link
Contributor

Enyium commented Oct 14, 2024

Consider this SlintPad demo (see comment):

import { Button } from "std-widgets.slint";

export component Demo {
    preferred-width: 500px;
    preferred-height: 500px;

    Button {
        // Commenting this property out, or making it an empty
        // string makes the component tiny and unresizable.
        text: "Foo";
    }
}

I got to this code by reducing my app drastically. My actual use case is calling Window::set_size() on the Rust side before app_window.show(), which stays ineffective just like when using the preferred-... properties. In contrast to this example, though, my app window behaves normal (displaying in preferred, i.e., minimal size, and being normally resizable); Window::set_size() is simply ineffective, preventing me to restore the size saved on last app termination.

Above example on Windows 10 with text property being set to "Foo":

okay.mp4

Same example with text property commented out:

not-okay.mp4
@hunger hunger added the need triaging Issue that the owner of the area still need to triage label Oct 14, 2024
@ogoffart ogoffart added bug Something isn't working a:layouts Related to the layouting and positioning of the elements (mO,bT) and removed need triaging Issue that the owner of the area still need to triage labels Oct 14, 2024
@ogoffart
Copy link
Member

indeed, there is a bug there. Looks like the compiler override the explicit preferred size with that of the content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:layouts Related to the layouting and positioning of the elements (mO,bT) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants