Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [BUG] Some styles does not work (background-color, background-image)

    QML and Qt Quick
    2
    7
    1150
    Loading More Posts
    • 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.
    • Q
      QtYury last edited by

      Works:
      @
      Label {
      text: "<span style="color: red">Del</span>"
      textFormat: Text.RichText
      }
      @

      Does not work:
      @
      Label {
      text: "<span style="background-color: red">Del</span>"
      textFormat: Text.RichText
      }
      @
      @
      Label {
      text: "<span style="background-image: some_url">Del</span>"
      textFormat: Text.RichText
      }
      @

      1 Reply Last reply Reply Quote 0
      • p3c0
        p3c0 Moderators last edited by

        Hi,

        This is a bug. See "QTBUG-34219":https://bugreports.qt-project.org/browse/QTBUG-34219

        157

        1 Reply Last reply Reply Quote 0
        • Q
          QtYury last edited by

          Thanks, p3c0! Are there any workarounds?

          1 Reply Last reply Reply Quote 0
          • p3c0
            p3c0 Moderators last edited by

            You could use a Rectangle and Image elements and place it behind the Text and setting width and height of those to that of Text element.

            157

            1 Reply Last reply Reply Quote 0
            • Q
              QtYury last edited by

              border-color and border-style don't work too
              @
              Label {
              text: "<span style="border-color:red; border-style:solid">Del</span>"
              textFormat: Text.RichText
              }
              @

              1 Reply Last reply Reply Quote 0
              • p3c0
                p3c0 Moderators last edited by

                Yes I think "many of these":https://qt-project.org/doc/qt-5/richtext-html-subset.html#css-properties may not be working.

                157

                1 Reply Last reply Reply Quote 0
                • Q
                  QtYury last edited by

                  Please vote for bug "QTBUG-34219":https://bugreports.qt-project.org/browse/QTBUG-34219. Thanks!

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post