21 : mTitle( QObject::
tr(
"Legend" ) )
22 , mTitleAlignment( Qt::AlignLeft )
24 , mFontColor( QColor( 0, 0, 0 ) )
27 , mWmsLegendSize( 50, 25 )
31 , mSplitLayer( false )
32 , mEqualColumnWidth( false )
34 , mUseAdvancedEffects( true )
57 list = stringToSplt.split(
wrapChar() );
61 #define FONT_WORKAROUND_SCALE 10 //scale factor for upscaling fontsize and downscaling painter 69 p->setFont( textFont );
71 p->scale( scaleFactor, scaleFactor );
77 void QgsLegendSettings::drawText( QPainter* p,
const QRectF& rect,
const QString& text,
const QFont& font, Qt::AlignmentFlag halignment, Qt::AlignmentFlag valignment,
int flags )
const 85 p->setFont( textFont );
87 p->scale( scaleFactor, scaleFactor );
88 p->drawText( scaledRect, halignment | valignment | flags, text );
95 QFont scaledFont = font;
97 scaledFont.setPixelSize( pixelSize );
103 return ( pointSize * 0.3527 );
109 QFontMetricsF fontMetrics( metricsFont );
116 QFontMetricsF fontMetrics( metricsFont );
123 QFontMetricsF fontMetrics( metricsFont );
130 QFontMetricsF fontMetrics( metricsFont );
QStringList splitStringForWrapping(QString stringToSplt) const
Splits a string using the wrap char taking into account handling empty wrap char which means no wrapp...
QgsComposerLegendStyle & rstyle(QgsComposerLegendStyle::Style s)
Returns reference to modifiable style.
void setMargin(Side side, double margin)
double fontAscentMillimeters(const QFont &font) const
Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCAL...
double fontDescentMillimeters(const QFont &font) const
Returns the font descent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCA...
double fontHeightCharacterMM(const QFont &font, const QChar &c) const
Returns the font height of a character in millimeters.
#define FONT_WORKAROUND_SCALE
double pixelFontSize(double pointSize) const
Calculates font to from point size to pixel size.
QFont scaledFontPixelSize(const QFont &font) const
Returns a font where size is in pixel and font size is upscaled with FONT_WORKAROUND_SCALE.
void drawText(QPainter *p, double x, double y, const QString &text, const QFont &font) const
Draws Text.
double textWidthMillimeters(const QFont &font, const QString &text) const
Returns the font width in millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE...