Drawing some lines in OnPaint function of widget is creating artifacts in viewport

I have downloaded the project linked above and converted it to 4.8 and I am getting the mentioned problems, same as in 4.7. I really hoped this would be fixed in 4.8, I don’t want to have to wait for 4.9 to get this working :frowning: