Bug 403041

Summary: Headings used as header items have insufficient padding by default
Product: [Frameworks and Libraries] frameworks-kirigami Reporter: Nate Graham <nate>
Component: generalAssignee: Marco Martin <notmart>
Status: RESOLVED NOT A BUG    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: Not decided   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Not enough padding

Description Nate Graham 2019-01-09 14:38:53 UTC
Created attachment 117357 [details]
Not enough padding

Kamoso has this code in main.qml:

        contentItem: Config {
            id: configView

            QQC2.ScrollBar.vertical: QQC2.ScrollBar {}

            header: Kirigami.Heading {
                level: 1
                color: Kirigami.Theme.textColor
                elide: Text.ElideRight
                text: i18n("Effects Gallery")
            }
        }


It results in the header text not having enough padding by default. See attachment.

It would be nice to solve this issue generically in Kirigami so every user of Headings inside header: properties wouldn't have to fix it themselves.
Comment 1 Marco Martin 2019-02-11 09:50:35 UTC
not valid: Heading is a text element, and exactly why you should never use a Label directly in an header, you should never use an heading as well.
in those cases, a kind of container should always be used. either an Abstract/BasicListItem in a ListView or any other kind of container regardless when in a kind of scrollview which isn't a ListView, even just
Control {
    Kirigami.Heading {
       text:"foo"
    }
}

would be more correct already, since it would give it unit based paddings coherent with everything else.

With QML is super easy to shoot yourself in the foot, and is designed that way, because the priority there is flexibility, with QWidget is harder to do things that look super wrong, exactly because it's more rigid and less capable, but there is nothing i can do to change the nature of QML (in fact all the places where i tried, like the automatic toolbar and completely premade complex components gave serious problems as people always found them too rigid, so is a direction i don't want to go anymore)

this can't (technically) and shouldn't (in principle) be fixed, but i'll add a warning about it in the apidocs.

(unrelated, that piece of qml also has other errors, like having a flickable with a scrollbar directly instead of a ScrollView, which will give it different behavior than anything else)