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. [SOLVED]Vertical Gradient

[SOLVED]Vertical Gradient

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 5.2k Views
  • 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.
  • S Offline
    S Offline
    Sorin
    wrote on 13 Jan 2011, 11:03 last edited by
    #1

    I'm trying to put a gradient( from top to bottom ) to a QGraphicsRectItem but I managed to add it only from left to right:

    @QLinearGradient gradient( 0, 0, rectWidth, rectHeight );
    gradient.setColorAt( 0.0, "#EBEBEB");
    gradient.setColorAt( 1.0, "#A3A3A3");
    rectItem->setBrush( gradient );@

    How to do it right? Thanks!

    There are only 10 types of people in the world: Those who understand binary, and those who don't

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on 13 Jan 2011, 11:15 last edited by
      #2

      Have you tried this:

      @
      QLinearGradient gradient( 0, 0, 0, rectHeight );
      gradient.setColorAt( 0.0, "#EBEBEB");
      gradient.setColorAt( 1.0, "#A3A3A3");
      rectItem->setBrush( gradient );
      @

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      1
      • S Offline
        S Offline
        Sorin
        wrote on 13 Jan 2011, 12:20 last edited by
        #3

        Pfff..., so simple, thanks :)

        There are only 10 types of people in the world: Those who understand binary, and those who don't

        1 Reply Last reply
        0

        3/3

        13 Jan 2011, 12:20

        • Login

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