Skip to content
Permalink
Browse files

[layout] Set default legend item title to an empty string

  • Loading branch information
nirvn committed Sep 3, 2018
1 parent 9a400d7 commit 9af405c9ae611593b1a84513c6c2398766db052c
@@ -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 )
@@ -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();

@@ -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)
@@ -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))
@@ -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))
@@ -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))
@@ -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))
@@ -253,6 +257,7 @@ def testDataDefinedColumnCount(self):
layout.initializeDefaults()

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

legend.setColumnCount(2)

0 comments on commit 9af405c

Please sign in to comment.
You can’t perform that action at this time.