21 : mTitle( QObject::tr(
"Legend" ) )
22 , mFontColor( QColor( 0, 0, 0 ) )
24 , mWmsLegendSize( 50, 25 )
25 , mRasterStrokeColor( Qt::black )
46 list = stringToSplt.split(
wrapChar() );
50 #define FONT_WORKAROUND_SCALE 10 //scale factor for upscaling fontsize and downscaling painter 58 p->setFont( textFont );
60 p->scale( scaleFactor, scaleFactor );
66 void QgsLegendSettings::drawText( QPainter *p,
const QRectF &rect,
const QString &text,
const QFont &font, Qt::AlignmentFlag halignment, Qt::AlignmentFlag valignment,
int flags )
const 74 p->setFont( textFont );
76 p->scale( scaleFactor, scaleFactor );
77 p->drawText( scaledRect, halignment | valignment | flags, text );
84 QFont scaledFont = font;
86 scaledFont.setPixelSize( pixelSize );
92 return ( pointSize * 0.3527 );
98 QFontMetricsF fontMetrics( metricsFont );
105 QFontMetricsF fontMetrics( metricsFont );
112 QFontMetricsF fontMetrics( metricsFont );
119 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 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.
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...