Skip to content

Commit 427ea51

Browse files
committed
Deprecate some more methods
1 parent 16a64ed commit 427ea51

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

python/core/auto_generated/symbology/qgssymbol.sip.in

+6-1
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ class QgsSymbolRenderContext
514514
%End
515515
public:
516516

517+
517518
QgsSymbolRenderContext( QgsRenderContext &c, QgsUnitTypes::RenderUnit u, qreal opacity = 1.0, bool selected = false, QgsSymbol::RenderHints renderHints = 0, const QgsFeature *f = 0, const QgsFields &fields = QgsFields(), const QgsMapUnitScale &mapUnitScale = QgsMapUnitScale() );
518519
%Docstring
519520
Constructor for QgsSymbolRenderContext
@@ -682,7 +683,11 @@ Sets the part number of current geometry
682683
.. versionadded:: 2.16
683684
%End
684685

685-
double outputLineWidth( double width ) const;
686+
double outputLineWidth( double width ) const /Deprecated/;
687+
%Docstring
688+
689+
.. deprecated:: Use the size conversion methods in QgsRenderContext instead.
690+
%End
686691

687692
double outputPixelSize( double size ) const /Deprecated/;
688693
%Docstring

src/3d/chunks/qgschunkedentity_p.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class QgsChunkedEntity : public Qt3DCore::QEntity
133133
//! max. length for replacement queue
134134
int mMaxLoadedChunks = 512;
135135

136-
//! Entity that shows bounding boxes of active chunks (null if not enabled)
136+
//! Entity that shows bounding boxes of active chunks (NULLPTR if not enabled)
137137
QgsChunkBoundsEntity *mBboxesEntity = nullptr;
138138

139139
//! job that is currently being processed (asynchronously in a worker thread)

src/core/symbology/qgspointdisplacementrenderer.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ void QgsPointDisplacementRenderer::drawGroup( QPointF centerPoint, QgsRenderCont
100100
}
101101
else
102102
{
103-
context.painter()->drawRect( QRectF( centerPoint.x() - symbolContext.outputLineWidth( 1 ), centerPoint.y() - symbolContext.outputLineWidth( 1 ), symbolContext.outputLineWidth( 2 ), symbolContext.outputLineWidth( 2 ) ) );
103+
const double rectSize = symbolContext.renderContext().convertToPainterUnits( 1, QgsUnitTypes::RenderMillimeters );
104+
context.painter()->drawRect( QRectF( centerPoint.x() - rectSize, centerPoint.y() - rectSize, rectSize * 2, rectSize * 2 ) );
104105
}
105106
}
106107

@@ -247,7 +248,7 @@ void QgsPointDisplacementRenderer::calculateSymbolAndLabelPositions( QgsSymbolRe
247248
return;
248249
}
249250

250-
double circleAdditionPainterUnits = symbolContext.outputLineWidth( mCircleRadiusAddition );
251+
double circleAdditionPainterUnits = symbolContext.renderContext().convertToPainterUnits( mCircleRadiusAddition, QgsUnitTypes::RenderMillimeters );
251252

252253
switch ( mPlacement )
253254
{
@@ -355,7 +356,7 @@ void QgsPointDisplacementRenderer::drawGrid( int gridSizeUnits, QgsSymbolRenderC
355356
}
356357

357358
QPen gridPen( mCircleColor );
358-
gridPen.setWidthF( context.outputLineWidth( mCircleWidth ) );
359+
gridPen.setWidthF( context.renderContext().convertToPainterUnits( mCircleWidth, QgsUnitTypes::RenderMillimeters ) );
359360
p->setPen( gridPen );
360361

361362
for ( int i = 0; i < pointSymbolPositions.size(); ++i )
@@ -384,7 +385,7 @@ void QgsPointDisplacementRenderer::drawCircle( double radiusPainterUnits, QgsSym
384385

385386
//draw Circle
386387
QPen circlePen( mCircleColor );
387-
circlePen.setWidthF( context.outputLineWidth( mCircleWidth ) );
388+
circlePen.setWidthF( context.renderContext().convertToPainterUnits( mCircleWidth, QgsUnitTypes::RenderMillimeters ) );
388389
p->setPen( circlePen );
389390
p->drawArc( QRectF( centerPoint.x() - radiusPainterUnits, centerPoint.y() - radiusPainterUnits, 2 * radiusPainterUnits, 2 * radiusPainterUnits ), 0, 5760 );
390391
}

src/core/symbology/qgspointdistancerenderer.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,9 @@ void QgsPointDistanceRenderer::drawLabels( QPointF centerPoint, QgsSymbolRenderC
394394

395395
//scale font (for printing)
396396
QFont pixelSizeFont = mLabelFont;
397-
pixelSizeFont.setPixelSize( context.outputLineWidth( mLabelFont.pointSizeF() * 0.3527 ) );
397+
398+
const double fontSizeInPixels = context.renderContext().convertToPainterUnits( mLabelFont.pointSizeF(), QgsUnitTypes::RenderPoints );
399+
pixelSizeFont.setPixelSize( static_cast< int >( std::round( fontSizeInPixels ) ) );
398400
QFont scaledFont = pixelSizeFont;
399401
scaledFont.setPixelSize( pixelSizeFont.pixelSize() );
400402
p->setFont( scaledFont );

src/core/symbology/qgssymbol.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,8 @@ class CORE_EXPORT QgsSymbolRenderContext
550550
{
551551
public:
552552

553+
//TODO QGIS 4.0 - remove mapUnitScale
554+
553555
/**
554556
* Constructor for QgsSymbolRenderContext
555557
* \param c
@@ -701,7 +703,10 @@ class CORE_EXPORT QgsSymbolRenderContext
701703
*/
702704
void setGeometryPartNum( int num ) { mGeometryPartNum = num; }
703705

704-
double outputLineWidth( double width ) const;
706+
/**
707+
* \deprecated Use the size conversion methods in QgsRenderContext instead.
708+
*/
709+
Q_DECL_DEPRECATED double outputLineWidth( double width ) const SIP_DEPRECATED;
705710

706711
/**
707712
* \deprecated Use the size conversion methods in QgsRenderContext instead.

0 commit comments

Comments
 (0)