Skip to content

Commit a8b9723

Browse files
authoredDec 13, 2016
[FEATURE] allow customization of line spacing for legend item labels (#3632)
* [FEATURE] allow customization of line spacing for legend item labels * add test for legend line spacing and update control images
1 parent dc509f4 commit a8b9723

File tree

66 files changed

+96
-11
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+96
-11
lines changed
 

‎python/core/composer/qgscomposerlegend.sip

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@ class QgsComposerLegend : QgsComposerItem
121121
void setStyleMargin( QgsLegendStyle::Style s, double margin );
122122
void setStyleMargin( QgsLegendStyle::Style s, QgsLegendStyle::Side side, double margin );
123123

124+
/** Returns the spacing in-between lines in mm
125+
* @note added in 3.0
126+
* @see setLineSpacing
127+
*/
128+
double lineSpacing() const;
129+
/** Sets the spacing in-between multiple lines
130+
* @param spacing Double value to use as spacing in between multiple lines
131+
* @note added in 3.0
132+
* @see lineSpacing
133+
*/
134+
void setLineSpacing( double spacing );
135+
124136
double boxSpace() const;
125137
void setBoxSpace( double s );
126138

‎src/app/composer/qgscomposerlegendwidget.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ void QgsComposerLegendWidget::setGuiElements()
144144
mIconLabelSpaceSpinBox->setValue( mLegend->style( QgsLegendStyle::SymbolLabel ).margin( QgsLegendStyle::Left ) );
145145
mBoxSpaceSpinBox->setValue( mLegend->boxSpace() );
146146
mColumnSpaceSpinBox->setValue( mLegend->columnSpace() );
147+
mLineSpacingSpinBox->setValue( mLegend->lineSpacing() );
147148

148149
mRasterBorderGroupBox->setChecked( mLegend->drawRasterBorder() );
149150
mRasterBorderWidthSpinBox->setValue( mLegend->rasterBorderWidth() );
@@ -450,6 +451,17 @@ void QgsComposerLegendWidget::on_mColumnSpaceSpinBox_valueChanged( double d )
450451
}
451452
}
452453

454+
void QgsComposerLegendWidget::on_mLineSpacingSpinBox_valueChanged( double d )
455+
{
456+
if ( mLegend )
457+
{
458+
mLegend->beginCommand( tr( "Legend line space" ), QgsComposerMergeCommand::LegendLineSpacing );
459+
mLegend->setLineSpacing( d );
460+
mLegend->adjustBoxSize();
461+
mLegend->update();
462+
mLegend->endCommand();
463+
}
464+
}
453465

454466
static void _moveLegendNode( QgsLayerTreeLayer* nodeLayer, int legendNodeIndex, int offset )
455467
{

0 commit comments

Comments
 (0)
Please sign in to comment.