Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Label: <ul> indentation is first line only
Forum Updated to NodeBB v4.3 + New Features

Label: <ul> indentation is first line only

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 585 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SeDiS Offline
    SeDiS Offline
    SeDi
    wrote on last edited by SeDi
    #1

    When using an unordered list on a Label in QML, indentation is wrong after the first line (so: there's actually no indentation).

    *  Using A Label with <strong>RichText</strong> works
    *  It's a real fun to make an unordered List like this
    *  My problem occurs, when a <li> element is getting too long to fit into 
    the first line. When wordWrap kicks in, every subsequent line is unindented,
    like you can see here. 
    *  I would wish to have it be properly indented, just as in this example,
       where everything looks nice and tidy.
    

    I've seen somebody propose the use of -qt-list-indent (see subset), similar to this:

    <ul style="-qt-list-indent:5;">
    

    And I have found this in a forum post:

    <ul style=" -qt-list-indent: 1;">
    <li style=" -qt-block-indent:0; text-indent:0px;">foo</li>
    <li style=" -qt-block-indent:0; text-indent:0px;">foo</li>
    <li style=" -qt-block-indent:0; text-indent:0px;">foo</li>
    </ul>
    

    I am not too experienced with HTML, my mistake might be pretty basic. I've tried (multiple versions of) this

        Label {
            width: 200
            wrapMode: Text.WordWrap
            text: '<ul style="-qt-list-indent:5;"> \
                  <li> Using A Label with <strong>RichText</strong> works</li> \
                  <li> It\'s a real fun to make an unordered List like this</li> \
                  <li> My problem occurs, when a &#60;li&#62; element is getting too long to fit into \
                  the first line. When wordWrap kicks in, every subsequent line is unindented, \
                  like you can see here.</li> \
                  </ul>'
        }
    

    With the same result as above. No sign that QML might want to adhere to the command.
    Trying to set indentations to the list element themselves, like here:

            text: '<ul style="-qt-list-indent:5"> \
                  <li style="text-indent:5"> Using A Label with <strong>RichText</strong> works</li> \
                  <li style="text-indent:5"> It\'s a real fun to make an unordered List like this</li> \
                  <li style="text-indent:5"> My problem occurs, when a &#60;li&#62; element is getting too long to fit into \
                  the first line. When wordWrap kicks in, every subsequent line is unindented, \
                  like you can see here.</li> \
                  </ul>'
    

    killed the whole unordered list, the result being:

    Using A Label with RichText works It's a real 
    fun to make an unordered List like this My problem occurs, 
    when a li element is getting too long to fit into  the first line. 
    When wordWrap kicks in, every subsequent line is unindented,
    like you can see here. 
    

    Same result with -qt-block-indent or -qt-list-indent.

    How can I get <ul> to show proper indentation?

    M 1 Reply Last reply
    1
    • SeDiS SeDi

      When using an unordered list on a Label in QML, indentation is wrong after the first line (so: there's actually no indentation).

      *  Using A Label with <strong>RichText</strong> works
      *  It's a real fun to make an unordered List like this
      *  My problem occurs, when a <li> element is getting too long to fit into 
      the first line. When wordWrap kicks in, every subsequent line is unindented,
      like you can see here. 
      *  I would wish to have it be properly indented, just as in this example,
         where everything looks nice and tidy.
      

      I've seen somebody propose the use of -qt-list-indent (see subset), similar to this:

      <ul style="-qt-list-indent:5;">
      

      And I have found this in a forum post:

      <ul style=" -qt-list-indent: 1;">
      <li style=" -qt-block-indent:0; text-indent:0px;">foo</li>
      <li style=" -qt-block-indent:0; text-indent:0px;">foo</li>
      <li style=" -qt-block-indent:0; text-indent:0px;">foo</li>
      </ul>
      

      I am not too experienced with HTML, my mistake might be pretty basic. I've tried (multiple versions of) this

          Label {
              width: 200
              wrapMode: Text.WordWrap
              text: '<ul style="-qt-list-indent:5;"> \
                    <li> Using A Label with <strong>RichText</strong> works</li> \
                    <li> It\'s a real fun to make an unordered List like this</li> \
                    <li> My problem occurs, when a &#60;li&#62; element is getting too long to fit into \
                    the first line. When wordWrap kicks in, every subsequent line is unindented, \
                    like you can see here.</li> \
                    </ul>'
          }
      

      With the same result as above. No sign that QML might want to adhere to the command.
      Trying to set indentations to the list element themselves, like here:

              text: '<ul style="-qt-list-indent:5"> \
                    <li style="text-indent:5"> Using A Label with <strong>RichText</strong> works</li> \
                    <li style="text-indent:5"> It\'s a real fun to make an unordered List like this</li> \
                    <li style="text-indent:5"> My problem occurs, when a &#60;li&#62; element is getting too long to fit into \
                    the first line. When wordWrap kicks in, every subsequent line is unindented, \
                    like you can see here.</li> \
                    </ul>'
      

      killed the whole unordered list, the result being:

      Using A Label with RichText works It's a real 
      fun to make an unordered List like this My problem occurs, 
      when a li element is getting too long to fit into  the first line. 
      When wordWrap kicks in, every subsequent line is unindented,
      like you can see here. 
      

      Same result with -qt-block-indent or -qt-list-indent.

      How can I get <ul> to show proper indentation?

      M Offline
      M Offline
      Maximilian Sasserath
      wrote on last edited by
      #2

      @SeDi
      I know its quite late but I stumbled over your comment.
      If you set textFormat: Text.RichText it works fine.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved