Qpainter drawing semi-transparent line, transparence changes when overlapping
-

I am creating a painting tool. And I would like to draw some semi-transparent lines, but the color changes when it overlaps.
Can someone tell me how to solve this problem?Thank you in advance!
-

I am creating a painting tool. And I would like to draw some semi-transparent lines, but the color changes when it overlaps.
Can someone tell me how to solve this problem?Thank you in advance!

This is the main part of my code. I want to use drawline in Qpainter to draw the semi-transparent line, but it does not give me the correct effect.