23 : mFontColor( QColor( 0, 0, 0 ) )
25 , mWmsLegendSize( 50, 25 )
26 , mRasterStrokeColor( Qt::black )
53 list = stringToSplt.split(
wrapChar() );
57 #define FONT_WORKAROUND_SCALE 10 //scale factor for upscaling fontsize and downscaling painter 65 p->setFont( textFont );
67 p->scale( scaleFactor, scaleFactor );
73 void QgsLegendSettings::drawText( QPainter *p,
const QRectF &rect,
const QString &text,
const QFont &font, Qt::AlignmentFlag halignment, Qt::AlignmentFlag valignment,
int flags )
const 81 p->setFont( textFont );
83 p->scale( scaleFactor, scaleFactor );
84 p->drawText( scaledRect, halignment | valignment | flags, text );
91 QFont scaledFont = font;
93 scaledFont.setPixelSize( pixelSize );
99 return ( pointSize * 0.3527 );
105 QFontMetricsF fontMetrics( metricsFont );
112 QFontMetricsF fontMetrics( metricsFont );
119 QFontMetricsF fontMetrics( metricsFont );
126 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...
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...
void setMargin(Side side, double margin)
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()
Modifiable reference to font.
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...