PDA

View Full Version : Incorrect drawing of non cosmetic line



Amargedon
14th July 2009, 12:18
Before I used Qt 4.4.1 and used non cosmetic lines (QGraphicsLineItem) with a width of ~0.1. When zooming in the lines got bigger (scaled) and this is exactly what I want.

I am testing Qt 4.5.2 now and notice that this functionality is no more. Now a line width of 0.5 and higher is a non cosmetic line, if I set the line width to 0.4 the line doesn't get scaled (and so doesn't get bigger). I suspect some rounding (0.4 -> 0 (and 0 is cosmetic line), 0.5 -> 1 (which is a non cosmetic line))

Anyone of you have the same experience? Solutions?

wysota
15th July 2009, 00:03
Can you provide a minimal compilable example reproducing the problem?

Amargedon
16th July 2009, 07:41
I can, it is attatched to this message (tar.gz).

This testapplication uses a QGraphicsScene and QGraphicsView with three QGraphicsLineItems (red, green, blue color).

- The red line has a pen with width 0 and is working ok (the line stays 1 pixel when zooming in with the scrollwheel).
- The blue line has a pen with width 1 and is working ok (it gets larger when zooming in).
- The line with width 0.4 is not working ok. In Qt4.4.1 & Qt4.4.3 it is working ok (gets larger when zooming in) (both for QWidget and QGLWidget as viewport in QGraphicsView). In Qt4.5.0 it is still working for QWidget as viewport (line gets larger), but it doesn't work on a QGLWidget as viewport (line stays 1 pixel, the same as the red line).

Is looks that it is something with a QGLWidget as viewport in QGraphicsView, it think you see the same as I described above?

Thanks for looking at this :)

wysota
16th July 2009, 11:07
It could indeed be a bug. But I can understand it could also be a feature. The docs say that a pen of width 0 is cosmetic. 0.4 is closer to 0 than to 1, maybe that is intended. But I'd report it anyway.

Amargedon
16th July 2009, 14:53
It could indeed be a bug. But I can understand it could also be a feature. The docs say that a pen of width 0 is cosmetic. 0.4 is closer to 0 than to 1, maybe that is intended. But I'd report it anyway.
Could be, but why:
- did it work in previous versions?
- can I set a qreal (float) as linewidth if it is rounded? If it was a int I could understand of course, but not with a float.

I will report it, thanks for you're time.

Amargedon
16th July 2009, 18:50
Yesterday I already contacted Qt and sended the testapplication which I also placed above. I just received a email telling that the bug is fixed, so I will see next qt release and test it.