[Development] Proposal: Make QPen non-cosmetic by default

Uwe Rathmann Uwe.Rathmann at tigertal.de
Fri Oct 12 13:25:05 CEST 2012


On Fri, 12 Oct 2012 10:10:59 +0000, Bache-Wiig Jens wrote:

> True. There are certainly plenty of valid use cases out there and some
> of those would require a minor change in Qt5 if we go ahead with this
> change. 

Basically it is about if you want to have a pen width in model or paint 
device coordinates. Both use cases exist and IMHO none of them is more 
important than the other. 

> Most likely no more than setRenderHint(Qt::CosmeticDefaultPen,
> true).

As long as you don't eliminate this flag I agree for Qwt. 

But I would have to write a lot of documentation, that pens set from the 
application code will be handled in Qwt differently than the user is used 
from other parts of the application.

> In fact all non-0 values for pen
> width are non-cosmetic by default so making only the default constructor
> a special case with a cosmetic pen of size 1 is arbitrary and confusing
> regardless if you are using a cosmetic pen or not in your application.

Yes it is and I've seen several situations where this leaded to 
irritations - but this is how it is like many versions of Qt.

If it were about introducing a new API I would completely agree, but your 
suggestion breaks many applications doing graphics. And worst of all it 
is about introducing a type of bug QA departments usually never finds 
( not very likely than someone loads and zooms the exported PDF document 
in a PDF viewer ).

Uwe

By the way: in earlier versions of Qt ( didn't test it myself quite some 
time ) drawing with a pen width of 0 was faster than using a pen of 1 - 
even if it had the same result. In case of drawing a curve with many 
lines it was a significant effect. 

I never spent time on further explorations, but if it is still this way 
and the cosmetic attribute was the reason you might introduce a 
performance issues with changing the default setting as well.





More information about the Development mailing list