24 switch ( mTickPosition )
27 return QStringLiteral(
"Line Ticks Up" );
29 return QStringLiteral(
"Line Ticks Down" );
31 return QStringLiteral(
"Line Ticks Middle" );
41 QPainter *painter = context.
painter();
51 painter->setRenderHint( QPainter::Antialiasing,
true );
53 QPen pen = settings.
pen();
55 painter->setPen( pen );
59 for (
int i = 0; i < positions.size(); ++i )
67 if ( !positions.isEmpty() )
70 double verticalPos = 0.0;
71 switch ( mTickPosition )
74 verticalPos = barTopPosition;
77 verticalPos = middlePosition;
80 verticalPos = bottomPosition;
85 verticalPos, lastTickPositionX, verticalPos ) );
QPen pen() const
Returns the pen used for drawing outlines in the scalebar.
Use antialiasing while drawing.
double segmentWidth
Width of each individual segment (in millimeters)
Flags flags() const
Return combination of flags used for rendering.
QFont font() const
Returns the font used for drawing text in the scalebar.
QString name() const override
Returns the unique name for this style.
double firstLabelXOffset(const QgsScaleBarSettings &settings) const
Returns the x-offset (in millimeters) used for the first label in the scalebar.
double height() const
Returns the scalebar height (in millimeters).
double boxContentSpace() const
Returns the spacing (margin) between the scalebar box and content in millimeters. ...
double labelBarSpace() const
Returns the spacing (in millimeters) between labels and the scalebar.
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...
void drawDefaultLabels(QgsRenderContext &context, const QgsScaleBarSettings &settings, const QgsScaleBarRenderer::ScaleBarContext &scaleContext) const
Draws default scalebar labels using the specified settings and scaleContext to a destination render c...
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).
QList< double > segmentPositions(const QgsScaleBarRenderer::ScaleBarContext &scaleContext, const QgsScaleBarSettings &settings) const
Returns a list of positions for each segment within the scalebar.
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...
Render ticks crossing line.
The QgsScaleBarSettings class stores the appearance and layout settings for scalebar drawing with Qgs...
Contains parameters regarding scalebar calculations.