[Qt-interest] Line joints overlapping with semi-transparent colour

Ian Thomson Ian.Thomson at iongeo.com
Tue Mar 31 12:22:51 CEST 2009


Hi,

It looks like you are using individual lines to render each part. Try 
using a QPainterPath instead, that should give a consistent alpha across 
the line.

Cheers,
Ian.

Andrea Franceschini wrote:
> Hi everybody, I'm facing this problem:
> http://img24.imageshack.us/img24/7389/alphawrong.png
> I think it should be quite clear what's happening: I have a
> semi-transparent pen and I draw subsequent segments using
> QPainter::drawLine(). Obviously at the joints I have that overlapping
> which sums up alpha and results in what you see.
> 
> I have two solutions:
> 1. discard transparency: feasible but ugly;
> 2. use an opaque color which is a mix between a certain degree of pen
> colour and background colour: unfeasible because the background
> changes all the time and in the future I might be interested in
> showing background areas of different colours and even images.
> Moreover I'd like to see what's below the trace (in case there's some
> widget, for example).
> 
> Am I (as usual) missing some piece of the docs?
> 




More information about the Qt-interest-old mailing list