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

The property font-size in Button does not work #2194

Closed
Zhou-Pixel opened this issue Feb 7, 2023 · 6 comments
Closed

The property font-size in Button does not work #2194

Zhou-Pixel opened this issue Feb 7, 2023 · 6 comments

Comments

@Zhou-Pixel
Copy link

code:

//hello.slint

import { Button } from "std-widgets.slint";
export component Example inherits Window {
    preferred-width: 800px;
    preferred-height: 480px;
    GridLayout {  
        Button {
            property <int> counter: 3;
            clicked => { self.counter += 3 }
            text: "testtest";
            font-size: 100px;//does not work
        }
        Text {  
            text: "hello";
            font-size: 80px;//works
        }
    }

}

# //main.rs

//main.rs

slint::include_modules!();
fn main() {
    Example::new().run();
}

Application:

image

env: linux, x11, kernel6.1.9

Both Qt5.15.8 and winit have the same problem

@ogoffart
Copy link
Member

ogoffart commented Feb 7, 2023

Thanks for reporting an issue.

This property was an internal property at some point but it was not documented and was exported by mistake.
It will not be present in future version.

There have been some request before to be able to customize a bit widgets such as background color, or, in this case, the font-size. (eg: #1232)
But our customization here is lacking: either the widgets looks exactly like the style, or you have to write a custom button yourself as a component that can have a different look.

May I ask what's the use case to increase the font of a button? Is it because you would like every button to have bigger fonts? Or is it just to emphasis a single Button?

@Zhou-Pixel
Copy link
Author

The default font size is too small for me and I think a bigger font would make it clearer for the user

@tronical
Copy link
Member

tronical commented Feb 7, 2023

Perhaps you could change the default font size for all text elements using the default-font-size property on the Window element?

@Zhou-Pixel
Copy link
Author

Perhaps you could change the default font size for all text elements using the default-font-size property on the Window element?

It seems setting default-font-size for the window will affect other controls and I think it is necessary to set the font of each control individually as a gui framework, such as Qt

@ogoffart
Copy link
Member

I think it is necessary to set the font of each control individually as a gui framework, such as Qt

I agree that we should have our standard widget more themable.
But the thing is that they are meant to be native, and you can't always change the appearence of native widgets.
Right now, if you want customizable widgets, you can re-implement the widgets as custom widgets. https://docs.rs/slint/latest/slint/docs/recipes/index.html#custom-widgets

@ogoffart
Copy link
Member

The Button no longer expose this property in any style.

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

No branches or pull requests

3 participants