Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. background qlineargradient in stylesheet does not work
Qt 6.11 is out! See what's new in the release blog

background qlineargradient in stylesheet does not work

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 2.5k 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.
  • D Offline
    D Offline
    didje
    wrote on last edited by didje
    #1

    Hi,
    I have a .html page which contains a section where I want to have a gradient effect.
    Here is the css for that:
    #testStuff {
    font-family:Arial, Tahoma, Geneva, sans-serif;
    font-size:13px;
    font-weight:normal;
    color:black;
    background: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 cyan, stop:1 blue);
    }
    Later on I have the following:
    <div id="testStuff">Hello</div>

    In the resulting HTML, I do not see any background color for this - I see "Hello", with no background.
    So qlineargradient is not working as far as I can see.

    I am using qt 4.8.6.

    Is there something wrong in my syntax. How should I fix it ?

    Thanks for any help.

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      qlineargradient is part of qss, a css based language used for styling widgets. It's not meant to be used in HTML.
      Where do you display that HTML? In a QTextEdit? In a QWebView? If it's a QWebView then you need to use the standard css3: linear-gradient.

      1 Reply Last reply
      2
      • D Offline
        D Offline
        didje
        wrote on last edited by
        #3

        Thanks for your reply Chris.
        I display the HTML using QtAssistant. However, linear-gradient does not work when viewed that way unfortunately.

        raven-worxR 1 Reply Last reply
        0
        • D didje

          Thanks for your reply Chris.
          I display the HTML using QtAssistant. However, linear-gradient does not work when viewed that way unfortunately.

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @didje
          beside what Chris Kawa said, you are using an ID selector, but defined a CLASS in your HTML element.
          This rule wouldn't be applied anyway.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          D 1 Reply Last reply
          0
          • raven-worxR raven-worx

            @didje
            beside what Chris Kawa said, you are using an ID selector, but defined a CLASS in your HTML element.
            This rule wouldn't be applied anyway.

            D Offline
            D Offline
            didje
            wrote on last edited by
            #5

            Yes, I know, sorry my mistake in posting, but even when the rule is applied I have the same problem.

            raven-worxR 1 Reply Last reply
            0
            • D didje

              Yes, I know, sorry my mistake in posting, but even when the rule is applied I have the same problem.

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #6

              @didje said:

              Yes, I know, sorry my mistake in posting, but even when the rule is applied I have the same problem.

              Thats why i said "beside what Chris Kawa said"

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              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