Bug report #13078

Size of legend items

Added by Holger Naumann over 9 years ago. Updated about 9 years ago.

Status:Closed
Priority:Normal
Assignee:Vincent Mora
Category:Symbology
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:21146

Description

The legend looks ugly if i use map units in symbology.
It looks very good in < 2.10.

legende_1.8.2.png - Version 1.8.2 (253 KB) Holger Naumann, 2015-07-06 02:01 AM

legende_master.png - Master (210 KB) Holger Naumann, 2015-07-06 02:01 AM

map.png - Map layout Master (186 KB) Holger Naumann, 2015-07-06 02:01 AM

projekt.zip (40.5 KB) Holger Naumann, 2015-07-06 02:43 AM

punktsymbole.zip (161 KB) Holger Naumann, 2015-07-06 02:43 AM

style.zip (19.7 KB) Holger Naumann, 2015-07-06 02:43 AM

example.png - mix of mapunits and mm (199 KB) Holger Naumann, 2015-08-03 05:46 AM

Bildschirmfoto_von_»2015-08-24_13-01-43«.png - mapwindow and printcomposer (508 KB) Holger Naumann, 2015-08-24 04:15 AM


Related issues

Related to QGIS Application - Bug report #14172: QGIS freezes after canvas refresh when using graduated st... Closed 2016-01-26

Associated revisions

Revision 8776449a
Added by Vincent Mora over 9 years ago

Fix legend symbol size when using map units
fix #13078
The computation of icon sizes for legend symbols has been moved to
QgsLayerTreeModel::legendInvalidateMapBasedData() susch that icon size
is recomputed when zooming.

Revision 7d1a8d30
Added by Martin Dobias over 9 years ago

Merge pull request #2245 from vmora/issue13078

Fix legend symbol size when using map units (fix #13078)

History

#1 Updated by Nyall Dawson over 9 years ago

Can you share your project?

#2 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Open to Feedback

#3 Updated by Holger Naumann over 9 years ago

No problem.

#4 Updated by Nyall Dawson over 9 years ago

  • Assignee set to Vincent Mora

Vincent - looks related to your legend related changes, mind taking a look?

#5 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Feedback to Open

#6 Updated by Vincent Mora over 9 years ago

Nyall, it definitely looks like that, but I wasn't able to open the project when I tried (I think I forgot the symbols or something). I'm on a vacation at the moment, but I'll try and have a look asap.

Holger, what happens if you use mm instead of map units, does it look better, does the zoom level change anything ?

#7 Updated by Holger Naumann over 9 years ago

Hi Vincent,
if units are in mm, it is ok. But if one symbol is in mapunits, legend is broken.

#8 Updated by Vincent Mora over 9 years ago

Hi Holger,
Thanks for the update. The thing that seems to be broken seems to be the cropping of the symbol, the symbol size is right but the symbol takes way to much place. I'll have a look asap.

#9 Updated by Vincent Mora over 9 years ago

Nyall, I have a lead: when QgsSymbolV2LegendNode::minimumIconSize is called by QgsDefaultVectorLayerLegend::createLayerTreeModelLegendNodes, the model() is null, whereas it is not when QgsSymbolV2LegendNode::data() is called with decoration rôle.

For what I understand, it's a matter of setting the correct parent for the node in createLayerTreeModelLegendNodes. If you or Matthias could give me a hint, I'd be gratefull.

#10 Updated by Nyall Dawson over 9 years ago

Vmora - Martin will be the one to contact about this, he's got the most knowledge of how the legends work...

#11 Updated by Vincent Mora over 9 years ago

  • Pull Request or Patch supplied changed from No to Yes

The fix is here https://github.com/qgis/QGIS/pull/2245

Holger: thanks for the report.

Martin: thanks for the pointers.

#12 Updated by Martin Dobias over 9 years ago

  • Status changed from Open to Closed

#13 Updated by Holger Naumann about 9 years ago

Hi Vincent, the problem is solved in the mapwindow. But in print composer, the problem exist.

#14 Updated by Nyall Dawson about 9 years ago

Please note that the scaling of legend shapes in composer legends is intentional and is the same beahviour as previous versions. So that's not an issue.

However, it seems like the size of the legend isn't calculated correctly on composer load when the legend contains shape sizes in map units - the legend is set to a massive width & height. Forcing a refresh of the legend fixes the size.

#15 Updated by Nyall Dawson about 9 years ago

  • Status changed from Reopened to Closed

Actually - that's a unrelated issue. Closing this.

Also available in: Atom PDF