mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Followup c9251c, fix crash
This commit is contained in:
parent
3bdc77d3da
commit
bc30cdf41d
@ -156,7 +156,7 @@ class QgsSymbolLegendNode : QgsLayerTreeModelLegendNode
|
||||
* render context in advance and call this method instead of minimumIconSize().
|
||||
* @note added in QGIS 2.18
|
||||
*/
|
||||
QSize minimumIconSize( QgsRenderContext &context ) const;
|
||||
QSize minimumIconSize( QgsRenderContext* context ) const;
|
||||
|
||||
/** Returns the symbol used by the legend node.
|
||||
* @see setSymbol()
|
||||
|
@ -1497,7 +1497,7 @@ void QgsLayerTreeModel::invalidateLegendMapBasedData()
|
||||
QgsSymbolLegendNode* n = dynamic_cast<QgsSymbolLegendNode*>( legendNode );
|
||||
if ( n )
|
||||
{
|
||||
const QSize sz( n->minimumIconSize( *context ) );
|
||||
const QSize sz( n->minimumIconSize( context.data() ) );
|
||||
const QString parentKey( n->data( QgsLayerTreeModelLegendNode::ParentRuleKeyRole ).toString() );
|
||||
widthMax[parentKey] = qMax( sz.width(), widthMax.contains( parentKey ) ? widthMax[parentKey] : 0 );
|
||||
n->setIconSize( sz );
|
||||
|
@ -159,17 +159,17 @@ Qt::ItemFlags QgsSymbolLegendNode::flags() const
|
||||
QSize QgsSymbolLegendNode::minimumIconSize() const
|
||||
{
|
||||
QScopedPointer<QgsRenderContext> context( createTemporaryRenderContext() );
|
||||
return minimumIconSize( *context );
|
||||
return minimumIconSize( context.data() );
|
||||
}
|
||||
|
||||
QSize QgsSymbolLegendNode::minimumIconSize( QgsRenderContext& context ) const
|
||||
QSize QgsSymbolLegendNode::minimumIconSize( QgsRenderContext* context ) const
|
||||
{
|
||||
QSize minSz( 16, 16 );
|
||||
if ( mItem.symbol() && mItem.symbol()->type() == QgsSymbol::Marker )
|
||||
{
|
||||
minSz = QgsImageOperation::nonTransparentImageRect(
|
||||
QgsSymbolLayerUtils::symbolPreviewPixmap( mItem.symbol(), QSize( 512, 512 ),
|
||||
&context ).toImage(),
|
||||
context ).toImage(),
|
||||
minSz,
|
||||
true ).size();
|
||||
}
|
||||
@ -177,7 +177,7 @@ QSize QgsSymbolLegendNode::minimumIconSize( QgsRenderContext& context ) const
|
||||
{
|
||||
minSz = QgsImageOperation::nonTransparentImageRect(
|
||||
QgsSymbolLayerUtils::symbolPreviewPixmap( mItem.symbol(), QSize( minSz.width(), 512 ),
|
||||
&context ).toImage(),
|
||||
context ).toImage(),
|
||||
minSz,
|
||||
true ).size();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user