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. How to get line with that style?
Forum Updated to NodeBB v4.3 + New Features

How to get line with that style?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 212 Views 2 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.
  • T Offline
    T Offline
    TomNow99
    wrote on last edited by
    #1

    Hi,

    I would like to create line, which has style like this:

    line.png

    So 2 colors: white and gray and special effect ( left side is more transparent than right side ).

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

      You could also use a widget with a stylesheet. Assuming the widget is 20px high something like this:

      widget->setStyleSheet(
         "border-top: 10px solid qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 rgba(200, 200, 200, 0), stop:1 rgba(200, 200, 200, 255));"
         "border-bottom: 10px solid qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 255, 255, 0), stop:1 rgba(255, 255, 255, 255));"
      );
      
      1 Reply Last reply
      3
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi
        You might be able to get that effect using QGradiant and QPainter but
        you could also just use a PNG with it predrawn and paint that.

        Do you need it in many sizes ?

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

          You could also use a widget with a stylesheet. Assuming the widget is 20px high something like this:

          widget->setStyleSheet(
             "border-top: 10px solid qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 rgba(200, 200, 200, 0), stop:1 rgba(200, 200, 200, 255));"
             "border-bottom: 10px solid qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 255, 255, 0), stop:1 rgba(255, 255, 255, 255));"
          );
          
          1 Reply Last reply
          3

          • Login

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