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

Samuel Rødal samuel.rodal at digia.com
Wed Oct 17 16:47:00 CEST 2012

On 10/15/2012 08:30 PM, Uwe Rathmann wrote:
> On Mon, 15 Oct 2012 07:32:52 +0000, Knoll Lars wrote:
>> to make it really logical would probably also require to
>> make 0 width pens invisible
> You are hitting the point: obviously setting a pen width of 0 enables a
> special mode and doesn't really set a pen width:
> - disabling the hardware accelerated path ( on systems that have one )
> - making the pen cosmetic
> - ... ?
> In opposite to Samuel I see this hardware accelerated mode as important -
> even so important that it should stay the default mode. And when this
> mode only works for cosmetic pens ( ? ) I strongly argue for not changing
> the default setting.
> IMO a clean API should offer all attributes explicitly - not hidden
> behind an invalid width of a pen. So after reading Samuels explanations I
> would see the proposal of Jens as an improvement for the API - but not
> enough to clean up the API.
> So when you really want to introduce an incompatibility like this now,
> please clean up the "pen width 0" API completely.

I tried implementing the 0 meaning invisible change in 
https://codereview.qt-project.org/#change,37280,patchset=2 but it as you 
can see just in Qt there were tons of places in the styles and widgets 
that explicitly created 0-width pens and thus broke.

Because of this we're backpedaling a bit and keeping the meaning of a 0 
pen width the same as it is today. We're only changing the default QPen 
constructor to be a 1 width non-cosmetic pen: 

Seems to me to be the best compromise to avoid completely breaking too 
much existing code.


More information about the Development mailing list