Bug report #9498
legend item vertical spacing (once again) broken for layers set to hidden
Status: | Closed | ||
---|---|---|---|
Priority: | Severe/Regression | ||
Assignee: | Radim Blazek | ||
Category: | Map Composer/Printing | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | fixed/implemented |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 18089 |
Description
A regression slipped into QGIS master with regards to composer legend item's vertical spacing of layers set to hidden. Prior to 2.0 launch, work was done to allow for proper vertical spacing of layers for a simple scenario: for the vertical spacing between a multi-item layer (i.e. categorized layer) and a single-item layer (i.e. single symbol layer) to be equal. It's now broken again under QGIS master.
I've attached a screenshot showing the problem as well as a simple project to test this out.
Assigning to Radim who did a great job fixing this before 2.0, apologies if the assignment is wrong :)
Associated revisions
[composer] fix vertical spacing of hidden layer title in legend items (fix #9498)
composer legend items space, better fixes #9498
History
#1 Updated by Mathieu Pellerin - nIRV almost 11 years ago
The fix here appears to be simple: when a layer title type is set to hidden, the vertical spacing value above the (first/unique) item symbol of that layer should only be symbol spacing.
#2 Updated by Mathieu Pellerin - nIRV almost 11 years ago
- Priority changed from Normal to Severe/Regression
Marking as blocker since it's a regression.
In 2.0, the user could do this:
- Empty layer title string, which would remove the layer title row within the legend item.
- Set the layer title type to group or subgroup, and have the group or subgroup spacing set to 0
In the latest QGIS master, it's now impossible to have an empty layer title string, preventing users from relying on the above-mentioned workaround.
#3 Updated by Mathieu Pellerin - nIRV almost 11 years ago
Radim, I think the problem might be located around line 837 of qgscomposerlegend.cpp and the commented out line 830:
//if ( currentLegendItem->style() != QgsComposerLegendStyle::Hidden )
Thoughts?
#4 Updated by Mathieu Pellerin - nIRV almost 11 years ago
- File spacing-ok-selection-not.png added
If I re-enable the if ( currentLegendItem->style() != QgsComposerLegendStyle::Hidden ) condition, the legend's vertical spacing of hidden layer title acts as (IMO) one would expect (see attached screenshot).
The zebra selection outline is however broken (as shown in same screenshot).
#5 Updated by Mathieu Pellerin - nIRV almost 11 years ago
- File proper_spacing_hidden_layer.patch added
Radim, I got something that seems to work OK, attaching the diff patch.
I've tested it using a bunch of layer item (group, subgroup, hidden) combinations, as well as multi-column, and all worked ok over here.
#6 Updated by Nathan Woodrow almost 11 years ago
- Status changed from Open to Closed
Fixed in changeset ef5ede169023e520bf6844c205b1fc8c06239329.
#7 Updated by Radim Blazek almost 11 years ago
I am not sure the fix is OK. Basically each row in legend is a nucleon, group of nucleons is atom. Layer item is a nucleon and it should really be added only if it is not hidden. The fix adds the title as nucleon but does not render it. I believe that it should not be added at all. I'll look at it once more.
#8 Updated by Radim Blazek almost 11 years ago
I have done better fix (fixing the real problem) in 7822abd.
Please test.
#9 Updated by Mathieu Pellerin - nIRV almost 11 years ago
- Resolution set to fixed/implemented
- % Done changed from 0 to 100
Radim, I've just compiled qgis with your commit in, and legend is acting like a charm, excellent. I think we can call this one fixed for good now :)