23 : mFontColor( QColor( 0, 0, 0 ) )
25 , mWmsLegendSize( 50, 25 )
26 , mRasterStrokeColor( Qt::black )
42 return 1 / ( mMmPerMapUnit * ( mDpi / 25.4 ) );
47 mMmPerMapUnit = 1 / mapUnitsPerPixel / ( mDpi / 25.4 );
63 list = stringToSplt.split(
wrapChar() );
67 #define FONT_WORKAROUND_SCALE 10 //scale factor for upscaling fontsize and downscaling painter 75 p->setFont( textFont );
77 p->scale( scaleFactor, scaleFactor );
83 void QgsLegendSettings::drawText( QPainter *p,
const QRectF &rect,
const QString &text,
const QFont &font, Qt::AlignmentFlag halignment, Qt::AlignmentFlag valignment,
int flags )
const 91 p->setFont( textFont );
93 p->scale( scaleFactor, scaleFactor );
94 p->drawText( scaledRect, halignment | valignment | flags, text );
101 QFont scaledFont = font;
103 scaledFont.setPixelSize( pixelSize );
109 return ( pointSize * 0.3527 );
115 QFontMetricsF fontMetrics( metricsFont );
122 QFontMetricsF fontMetrics( metricsFont );
129 QFontMetricsF fontMetrics( metricsFont );
136 QFontMetricsF fontMetrics( metricsFont );
double pixelFontSize(double pointSize) const
Calculates font to from point size to pixel size.
void drawText(QPainter *p, double x, double y, const QString &text, const QFont &font) const
Draws Text.
double fontAscentMillimeters(const QFont &font) const
Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCAL...
QStringList evaluateItemText(const QString &text, const QgsExpressionContext &context) const
Splits a string using the wrap char taking into account handling empty wrap char which means no wrapp...
QStringList splitStringForWrapping(const QString &stringToSplt) const
Splits a string using the wrap char taking into account handling empty wrap char which means no wrapp...
void setMapUnitsPerPixel(double mapUnitsPerPixel)
Sets the mmPerMapUnit calculated by mapUnitsPerPixel mostly taken from the map settings.
double textWidthMillimeters(const QFont &font, const QString &text) const
Returns the font width in millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE...
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
QFont scaledFontPixelSize(const QFont &font) const
Returns a font where size is in pixel and font size is upscaled with FONT_WORKAROUND_SCALE.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Symbol icon (excluding label)
void setMargin(Side side, double margin)
Sets the margin (in mm) for the specified side of the component.
double fontHeightCharacterMM(const QFont &font, QChar c) const
Returns the font height of a character in millimeters.
QgsLegendStyle & rstyle(QgsLegendStyle::Style s)
Returns reference to modifiable style.
#define FONT_WORKAROUND_SCALE
QFont & rfont()
Returns a modifiable reference to the component's font.
Symbol label (excluding icon)
double mapUnitsPerPixel() const
Returns the factor of map units per pixel for symbols with size given in map units calculated by dpi ...
double fontDescentMillimeters(const QFont &font) const
Returns the font descent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCA...
static QString replaceExpressionText(const QString &action, const QgsExpressionContext *context, const QgsDistanceArea *distanceArea=nullptr)
This function replaces each expression between [% and %] in the string with the result of its evaluat...