Re: [Development] New high-dpi QPen proposal (Was Re: Proposal: Make QPen non-cosmetic by default)

2012-10-18 Thread Sean Harmer
On Thursday 18 October 2012 09:59:45 Samuel Rødal wrote:
 In summary (or TL;DR), my new proposal would be to just make
 QPainter::NonCosmeticDefaultPen work as advertised, and have it be set
 by default when high-dpi mode is enabled. This way there would be
 minimal breakage of existing code. Thoughts?

Making this opt-in as you describe sounds a safer option from the perspective 
of application and middle-ware developers with existing code-bases. So +1 from 
me.

Sean
--
Dr Sean Harmer | sean.har...@kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] New high-dpi QPen proposal (Was Re: Proposal: Make QPen non-cosmetic by default)

2012-10-18 Thread Bache-Wiig Jens
 Maybe as a best effort we could introduce a different render hint, 
 asking QPainter to treat cosmetic pens as geometric, would be a better 
 solution for Morten's high-dpi use case. Then it would be opt-in instead 
 of opt-out, and no existing applications would be affected. Turning on 
 high-dpi mode could be documented to also set the render hint.
...
 In summary (or TL;DR), my new proposal would be to just make 
 QPainter::NonCosmeticDefaultPen work as advertised, and have it be set 
 by default when high-dpi mode is enabled. This way there would be 
 minimal breakage of existing code. Thoughts?


No I don't think this would work. That way we will get the obscure scalability 
issues that Uwe mentioned but it would only happen on retina capable computers 
so it can become even harder to discover.

The original proposal doesn't really have these problems though. We already set 
the render hint NonCosmeticPenByDefault on GraphicsView to avoid inconsistent 
scalability issues there and keep style code working when being scaled. 

I think we should extend this behavior to QPainter in general by only 
initialising QPen to 1 instead of 0. We keeping the explicit 0-pen working as 
before. In addition, we introduce a CosmeticPenByDefault render hint  that Qwt 
can set on its painter to make all pens cosmetic by default. (not just 0-pen) 
Though the Qt4PainterRenderHint could still explicitly give only 0 pen cosmetic 
properties.

This should have a very minimal impact on existing code, while at the same time 
addressing the fact that most code written with the implicit QPen constructor 
in mind, does not expect a cosmetic pen. Or the pen to change by simply setting 
a different width on it.

Jens
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] New high-dpi QPen proposal (Was Re: Proposal: Make QPen non-cosmetic by default)

2012-10-18 Thread Samuel Rødal
On 10/18/2012 11:08 AM, Bache-Wiig Jens wrote:
 Maybe as a best effort we could introduce a different render hint,
 asking QPainter to treat cosmetic pens as geometric, would be a better
 solution for Morten's high-dpi use case. Then it would be opt-in instead
 of opt-out, and no existing applications would be affected. Turning on
 high-dpi mode could be documented to also set the render hint.
 ...
 In summary (or TL;DR), my new proposal would be to just make
 QPainter::NonCosmeticDefaultPen work as advertised, and have it be set
 by default when high-dpi mode is enabled. This way there would be
 minimal breakage of existing code. Thoughts?


 No I don't think this would work. That way we will get the obscure 
 scalability issues that Uwe mentioned but it would only happen on retina 
 capable computers so it can become even harder to discover.

True, the fact that applications that are tested and working on 
non-retina suddenly break on retina will cause confusing behavior even 
for applications written from scratch with Qt 5. Assuming we have as a 
goal that applications should work in high-dpi mode without any testing 
or modifications being needed. Morten, is that the case?

 The original proposal doesn't really have these problems though. We already 
 set the render hint NonCosmeticPenByDefault on GraphicsView to avoid 
 inconsistent scalability issues there and keep style code working when being 
 scaled.

That's why I figured that setting it for high-dpi would make sense as 
well, but at least in the QGraphicsView case you wouldn't get any 
surprises since it's always set. Having a potentially breaking behavior 
depend on whether high-dpi is enabled or not might not be a good idea 
after all...

 I think we should extend this behavior to QPainter in general by only 
 initialising QPen to 1 instead of 0. We keeping the explicit 0-pen working as 
 before. In addition, we introduce a CosmeticPenByDefault render hint  that 
 Qwt can set on its painter to make all pens cosmetic by default. (not just 
 0-pen) Though the Qt4PainterRenderHint could still explicitly give only 0 pen 
 cosmetic properties.

I'm not sure Qwt actually _wants_ all pens to be cosmetic by default. 
For  0 width pens it must already have had explicit calls to 
setCosmetic(true), so it's really only the default-constructed QPens 
that would be an issue. So I don't see how CosmeticPenByDefault would be 
needed in addition to Qt4CompatiblePainting.

--
Samuel
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development