Bug report #1447

gaps in lines for outline width < 0.26

Added by Maciej Sieczka - over 15 years ago. Updated almost 15 years ago.

Assignee:nobody -
Category:Map Canvas
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.

width02_gaps.png - gaps at 0.2 width (25.4 KB) Maciej Sieczka -, 2008-12-07 12:24 PM

width026_no_gaps.png - no gaps at width 0.26 (25.5 KB) Maciej Sieczka -, 2008-12-07 12:25 PM

patch_for_1447.txt Magnifier - to fix setting default line width (3.12 KB) Steven Mizuno, 2008-12-28 07:30 PM


#1 Updated by Steven Mizuno over 15 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.

#2 Updated by Maciej Sieczka - over 15 years ago

Tim has set a default 0.26 workaround for most occurences of line width in the source code, but not for all.


- "unique value" still forces 0.10,
- "graduated symbol" renders at 0.26 BUT claims it uses 0.00.

#3 Updated by Steven Mizuno over 15 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:


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.

#4 Updated by Jürgen Fischer over 15 years ago

patch applied in

#5 Updated by Giovanni Manghi almost 15 years ago

If the patch has been applied, is possible to close this ticket or there are still issues?

#6 Updated by Giovanni Manghi almost 15 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

As the patch seems to have been applied and for lack of feedback I close this ticket. Reopen if necessary.

Also available in: Atom PDF