Bug report #1447
gaps in lines for outline width < 0.26
|Affected QGIS version:||Regression?:||No|
|Operating System:||All||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Copied to github as #:||11507|
Current default 0.2 outline is not wide enough when neither "Fix problems..." nor "Make lines appear less jagged..." are set in rendering options - see the attached screendumps.
A minimum outline width at which the issue is gone in all cases that I checked is 0.26. Is this a feature or a bug? If a feature I think QGIS should default to 0.26 instead for a workaround.
#1 Updated by Steven Mizuno almost 12 years ago
I have found that the width setting to use depends on the operating system/Qt as the reported screen resolution typically is 96dpi, but might not be on some platforms. The value 0.26 is approximately the result of 25.4mm/96dpi (the size of one pixel). Also, as the width is increased the line will become solid, but with an increasing number of double pixels. This is normal Qt behavior.
I filed ticket #1238 to have more control because of this behavior.
There is a Qt special value of 0.0 which draws one pixel width regardless of the device. This is fine for use on screen, but is probably too thin for print.
I believe that any given fixed setting will not be satisfactory to many users. This is an argument for making the default width user settable.
#3 Updated by Steven Mizuno almost 12 years ago
I am providing a patch to fix problems getting the default outline width set in all symbol classifiers.
I noticed that there are several places in various symbology classes that have something like:
pen.setWidthF( DEFAULT_LINE_WIDTH )
but still some classifiers were not getting the setting.
I reasoned that the setting should be in the symbol class and the classifiers should pick up the setting as needed. So the question was: why is it necessary to be putting the default into the various classifiers? Also, why do some appear not to work?
Looking in the various classes having something to do with symbols and classification I found in QgsSymbol several instances of pen.setWidth() that should have been pen.setWidthF() to accept floating point values. The value would become 0 for the typical fractional value. Fixing these made it possible to get the default value from any symbol created instead of having to explicitly set DEFAULT_LINE_WIDTH in the various ...SymbolDialog classes. QgsGraduatedSymbolDialog also had the F missing in a pen.setWidth() statement.
The ...SymbolDialog classes are changed to retrieve the line width from the created symbols as necessary.
There is one situation in QgsContinuousColorSymbolDialog that needs DEFAULT_LINE_WIDTH as there is no symbol object to use. I did not change this as it was already set up this way.
I believe there are instances of setting default values for other parameters that should be retrieved from created symbol objects instead of explicitly setting them in the classifier dialogs, but I am leaving that for another day.