Paragraph indent in qml

Viewed 36

I need a way a to adopt property text-indent in my qml code. QML Docs says it's supported, but didn't explain how to use it. I'm trying to run something like that (I tried more variants but failed):

    Text{
    width: parent.width
    wrapMode: Text.WordWrap
    textFormat: Text.StyledText
    text: "<text-indent='50px'>Hellow world"
    }

But it doesn't work. Qml sees text-indent in code (or it just see "<>") and doesn't show it in the text label, but still didn't activate it. Maybe this is kinda extra but the same question I can ask about all of tags which I can see in the documentation.

1 Answers

you should change your text format to Text.RichText and also use HTML tag and correct CSS style and CSS rules.

Please See textFormat Doc

Text.RichText supports a larger subset of HTML 4, as described on the Supported HTML Subset page

   Text{
        width: parent.width
       wrapMode: Text.WordWrap
       textFormat: Text.RichText
       text:"<p style=\"text-indent:50px;\">Hello World</p>"
       }

The output:

enter image description here

Related