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

Uwe Rathmann Uwe.Rathmann at tigertal.de
Thu Oct 11 22:59:46 CEST 2012

On Thu, 11 Oct 2012 14:33:30 +0000, Verbruggen Erik wrote:

>> I have personally never seen an actual use case where a cosmetic pen
>> makes sense, but  I assume there are reasons for having i so anyone
>> creating an explicit QPen(Qt::black, 0.0) should get a 1.0 pixel thick
>> line regardless of scaling.

Think about a scatter plot with many points displayed as crosses. On a 
large zoom level you only see a cloud but when zooming in you can see 
each cross and its position in detail.

When the pen for the crosses would have been scaled you would end with 
huge fat symbols - each probably larger than the plot widget itself.

Or think about a grid ( or ticks on an axis ), where each line indicates 
a position according to scale. This line has to be one pixel regardless 
of the scaling.

> PDF/PS define it this way, and is used when writing that kind of output.

The important part with PDF and cosmetic pens is when you zoom in the 
generated document later in a PDF viewer. The cosmetic attribute used in 
the Qt application code decided if the line gets scaled in the viewer or 

Please note that when you change the default setting to non-cosmetic 
almost all applications using Qwt for generating PDF documents will be 
broken ( zooming itself is not a problem for Qwt as it is not implemented 
using painter transformations, but I know other packages doing it ). And 
as f.e curve pens are set in the application code I can't fix it with a 
new version of the Qwt library.

I bet you will cause similar issues with any type of application that 
implements zooming ( in the application itself or via PDF ).


More information about the Development mailing list