Skip to content

default-font-size doesn't propagate to PopupWindow children #8855

@elipsitz

Description

@elipsitz

Bug Description

I've created a PopupWindow within a Window that has a default-font-size set, but that property doesn't propagate to Text in the PopupWindow.

Instead, the text is a different, larger size. If I manually set the font-size property on the Text, however, it works.

See the image:

"Outer text" is in the Window, "Text 1" is in the PopupWindow, and "Text 2" is in the PopupWindow with an explicit size set.

"Text 1" has the wrong size.

Image

Reproducible Code (if applicable)

component MyPopup inherits PopupWindow {
    close-policy: no-auto-close;

    Rectangle {
        background: #FFF;
        border-color: black;
        border-width: 1px;
        x: (root.width - self.width) / 2;
        y: (root.height - self.height) / 2;
        width: 80px;
        height: 80px;

        Text {
            x: 20px;
            y: 20px;
            text: "Text 1";
        }

        Text {
            x: 20px;
            y: 40px;
            text: "Text 2";
            font-size: 8px;
        }
    }
}

export component MainWindow inherits Window {
    width: 240px;
    height: 160px;
    background: #E8E8E8;
    default-font-family: "pixelmix";
    default-font-size: 8px;

    Text {
        x: 10px;
        y: 10px;
        text: "Outer text";
    }

    popup-menu := MyPopup {
        x: 0;
        y: 0;
        width: root.width;
        height: root.height;
    }

    init => {
        popup-menu.show();
    }
}

Environment Details

  • Slint Version: 1.12.1 (previously worked in 1.9.1)
  • Platform/OS: Embedded
  • Programming Language: Rust
  • Backend/Renderer: Software

Product Impact

This is annoying, but I can work around it by manually setting the font size in all of my widgets.

It's especially a problem for the font I'm using, which is a pixel font that only works at one size.

Metadata

Metadata

Assignees

Labels

a:backend-qtThe Qt backend - including the qt style (mO,bS)a:textText rendering, fonts, Text input (mS,bF)

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions