30 QPainter *painter = context.
painter();
34 painter->setRenderHint( QPainter::Antialiasing,
true );
68 return QSizeF( 2 * settings.
boxContentSpace() + 2 * settings.
pen().width() + textWidth,
72 QString QgsNumericScaleBarRenderer::scaleText(
double scale )
const 74 return "1:" + QStringLiteral(
"%L1" ).arg( scale, 0,
'f', 0 );
QFont toQFont() const
Returns a QFont matching the relevant settings from this text format.
static double textWidthMM(const QFont &font, const QString &text)
Calculate a font width in millimeters for a text string, including workarounds for QT font rendering ...
QPen pen() const
Returns the pen used for drawing outlines in the scalebar.
Use antialiasing while drawing.
Alignment alignment() const
Returns the scalebar alignment.
HAlignment
Horizontal alignment.
Flags flags() const
Returns combination of flags used for rendering.
QSizeF calculateBoxSize(const QgsScaleBarSettings &settings, const QgsScaleBarRenderer::ScaleBarContext &scaleContext) const override
Calculates the required box size (in millimeters) for a scalebar using the specified settings and sca...
double scale
Scale denominator.
QSizeF size
Destination size for scalebar.
double boxContentSpace() const
Returns the spacing (margin) between the scalebar box and content in millimeters. ...
QgsTextFormat & textFormat()
Returns the text format used for drawing text in the scalebar.
static void drawText(const QRectF &rect, double rotation, HAlignment alignment, const QStringList &textLines, QgsRenderContext &context, const QgsTextFormat &format, bool drawAsOutlines=true)
Draws text within a rectangle using the specified settings.
void draw(QgsRenderContext &context, const QgsScaleBarSettings &settings, const QgsScaleBarRenderer::ScaleBarContext &scaleContext) const override
Draws the scalebar using the specified settings and scaleContext to a destination render context...
Contains information about the context of a rendering operation.
double convertToPainterUnits(double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale()) const
Converts a size from the specified units to painter units (pixels).
QPainter * painter()
Returns the destination QPainter for the render operation.
static double fontAscentMM(const QFont &font)
Calculates a font ascent in millimeters, including workarounds for QT font rendering issues...
The QgsScaleBarSettings class stores the appearance and layout settings for scalebar drawing with Qgs...
Contains parameters regarding scalebar calculations.