[Interest] Gradient Line

Igor Mironchik igor.mironchik at gmail.com
Fri Jan 10 10:16:23 CET 2014


Hi.

Is it possible to draw single line with gradient?

I've tried something like this:

QLinearGradientg(QPointF(0.0,0.0),QPointF(0.0,1.0));

g.setCoordinateMode(  QGradient::ObjectBoundingMode  );

g.setColorAt(  0.0,  QColor(  50,  50,  60  )  );

g.setColorAt(  0.5,  QColor(  140,  140,  150  )  );

g.setColorAt(  1.0,  QColor(  50,  50,  60  )  );

p->setPen(  QPen(  QBrush(  g  ),  1.0  )  );
p->drawLine(  1,  2,  1,  opt.rect.height()  -  2  );


But this draws line with average color of gradient: QColor( 105, 105, 115 )

-- 
Best Regards,
Igor Mironchik.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140110/6ad47224/attachment.html>


More information about the Interest mailing list