[SOLVED]Vertical Gradient



  • 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!



  • Have you tried this:

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



  • Pfff..., so simple, thanks :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.