Skip to content

Commit

Permalink
[layout] Set default legend item title to an empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Sep 3, 2018
1 parent 9a400d7 commit 9af405c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/core/qgslegendsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#include <QPainter>

QgsLegendSettings::QgsLegendSettings()
: mTitle( QObject::tr( "Legend" ) )
, mFontColor( QColor( 0, 0, 0 ) )
: mFontColor( QColor( 0, 0, 0 ) )
, mSymbolSize( 7, 4 )
, mWmsLegendSize( 50, 25 )
, mRasterStrokeColor( Qt::black )
Expand Down
3 changes: 2 additions & 1 deletion tests/src/core/testqgslegendrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ static void _setStandardTestFont( QgsLegendSettings &settings, const QString &st
}
}

static void _renderLegend( const QString &testName, QgsLayerTreeModel *legendModel, const QgsLegendSettings &settings )
static void _renderLegend( const QString &testName, QgsLayerTreeModel *legendModel, QgsLegendSettings &settings )
{
settings.setTitle( QStringLiteral( "Legend" ) );
QgsLegendRenderer legendRenderer( legendModel, settings );
QSizeF size = legendRenderer.minimumSize();

Expand Down
1 change: 1 addition & 0 deletions tests/src/python/test_qgslayoutatlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ def legend_test(self):

# add a legend
legend = QgsLayoutItemLegend(self.layout)
legend.setTitle("Legend")
legend.attemptMove(QgsLayoutPoint(200, 100))
# sets the legend filter parameter
legend.setLinkedMap(self.atlas_map)
Expand Down
5 changes: 5 additions & 0 deletions tests/src/python/test_qgslayoutlegend.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def testInitialSizeSymbolMapUnits(self):
map.setExtent(point_layer.extent())

legend = QgsLayoutItemLegend(layout)
legend.setTitle("Legend")
legend.attemptSetSceneRect(QRectF(120, 20, 80, 80))
legend.setFrameEnabled(True)
legend.setFrameStrokeWidth(QgsLayoutMeasurement(2))
Expand Down Expand Up @@ -127,6 +128,7 @@ def testResizeWithMapContent(self):
map.setExtent(point_layer.extent())

legend = QgsLayoutItemLegend(layout)
legend.setTitle("Legend")
legend.attemptSetSceneRect(QRectF(120, 20, 80, 80))
legend.setFrameEnabled(True)
legend.setFrameStrokeWidth(QgsLayoutMeasurement(2))
Expand Down Expand Up @@ -166,6 +168,7 @@ def testResizeDisabled(self):
map.setExtent(point_layer.extent())

legend = QgsLayoutItemLegend(layout)
legend.setTitle("Legend")
legend.attemptSetSceneRect(QRectF(120, 20, 80, 80))
legend.setFrameEnabled(True)
legend.setFrameStrokeWidth(QgsLayoutMeasurement(2))
Expand Down Expand Up @@ -209,6 +212,7 @@ def testResizeDisabledCrop(self):
map.setExtent(point_layer.extent())

legend = QgsLayoutItemLegend(layout)
legend.setTitle("Legend")
legend.attemptSetSceneRect(QRectF(120, 20, 20, 20))
legend.setFrameEnabled(True)
legend.setFrameStrokeWidth(QgsLayoutMeasurement(2))
Expand Down Expand Up @@ -253,6 +257,7 @@ def testDataDefinedColumnCount(self):
layout.initializeDefaults()

legend = QgsLayoutItemLegend(layout)
legend.setTitle("Legend")
layout.addLayoutItem(legend)

legend.setColumnCount(2)
Expand Down

0 comments on commit 9af405c

Please sign in to comment.