On 10/11/2012 10:58 AM, Bache-Wiig Jens wrote: > This issue came up while preparing some code to be High-dpi aware but it is > really a completely separate issue. > While I previously supported the idea that cosmetic pens should be two pixels > wide by default on HDPI screens, I think we should take it one step further > as the real issue is caused by the default values of QPen. > > QPen defaults to a pen width of 0, which might or might not be an intentional > behaviour. This is interpreted as a Cosmetic pen which will have 1 pixel > thickness regardless of the scale on the scene. Any code that simply does > painter->setPen(someColor) will have this behaviour. > > The only way to avoid it is to explicitly create a QPen(Qt::Black, 1.0). > Since normally there would be no difference between these behaviours, I > assume that the majority of code will simply ignore the pen with altogether. > Most existing styles certainly does this and mostly break with HDPI set > unless every pen is explicitly set to 1.0. > > 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. > > With this in mind, I would propose that we change the initialisation value of > QPen to be 1.0 for pen width by default in Qt5, and invert the name and > behaviour of the QPainter::NonCosmeticDefaultPen render hint. Most code > should not be affected by it and code that depends on this really needs > cosmetic pen should already be initialising their QPen explicitly.
A proposed patch for this: https://codereview.qt-project.org/#change,37280 The render hint QPainter::Qt4CompatiblePainting is introduced to keep the old QPen behavior as well as the fill rules from Qt 4 that were changed in https://codereview.qt-project.org/#change,36757 -- Samuel _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development