QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
24 : mFontColor( QColor( 0, 0, 0 ) )
26 , mWmsLegendSize( 50, 25 )
27 , mRasterStrokeColor( Qt::black )
55 return mUseAdvancedEffects;
60 mUseAdvancedEffects = use;
75 return 1 / ( mMmPerMapUnit * ( mDpi / 25.4 ) );
101 const QStringList lines = stringToSplit.split(
'\n' );
108 for (
const QString &line : lines )
110 res.append( line.split(
wrapChar() ) );
115 #define FONT_WORKAROUND_SCALE 10 //scale factor for upscaling fontsize and downscaling painter
123 p->setFont( textFont );
125 p->scale( scaleFactor, scaleFactor );
130 void QgsLegendSettings::drawText( QPainter *p,
const QRectF &rect,
const QString &text,
const QFont &font, Qt::AlignmentFlag halignment, Qt::AlignmentFlag valignment,
int flags )
const
138 p->setFont( textFont );
140 p->scale( scaleFactor, scaleFactor );
141 p->drawText( scaledRect, halignment | valignment | flags, text );
147 QFont scaledFont = font;
149 scaledFont.setPixelSize( pixelSize );
155 return ( pointSize * 0.3527 );
161 const QFontMetricsF fontMetrics( metricsFont );
168 const QFontMetricsF fontMetrics( metricsFont );
175 const QFontMetricsF fontMetrics( metricsFont );
182 const QFontMetricsF fontMetrics( metricsFont );
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QStringList splitStringForWrapping(const QString &stringToSplt) const
Splits a string using the wrap char taking into account handling empty wrap char which means no wrapp...
@ Symbol
Symbol icon (excluding label)
double pixelFontSize(double pointSize) const
Calculates font to from point size to pixel size.
Q_DECL_DEPRECATED bool useAdvancedEffects() const
double fontAscentMillimeters(const QFont &font) const
Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCAL...
Q_DECL_DEPRECATED double mmPerMapUnit() const
double textWidthMillimeters(const QFont &font, const QString &text) const
Returns the font width in millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE...
void drawText(QPainter *p, double x, double y, const QString &text, const QFont &font) const
Draws Text.
Q_DECL_DEPRECATED void setMapUnitsPerPixel(double mapUnitsPerPixel)
Sets the mmPerMapUnit calculated by mapUnitsPerPixel mostly taken from the map settings.
void setMargin(Side side, double margin)
Sets the margin (in mm) for the specified side of the component.
Q_DECL_DEPRECATED double mapScale() const
Returns the legend map scale.
Q_DECL_DEPRECATED void setMmPerMapUnit(double mmPerMapUnit)
@ SymbolLabel
Symbol label (excluding icon)
QFont & rfont()
Returns a modifiable reference to the component's font.
Q_DECL_DEPRECATED int dpi() const
void setIndent(double indent)
Sets the indent (in mm) of a group or subgroup.
QFont scaledFontPixelSize(const QFont &font) const
Returns a font where size is in pixel and font size is upscaled with FONT_WORKAROUND_SCALE.
#define FONT_WORKAROUND_SCALE
Scoped object for saving and restoring a QPainter object's state.
Q_DECL_DEPRECATED void setDpi(int dpi)
Q_DECL_DEPRECATED void setMapScale(double scale)
Sets the legend map 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
double fontHeightCharacterMM(const QFont &font, QChar c) const
Returns the font height of a character in millimeters.
Q_DECL_DEPRECATED void setUseAdvancedEffects(bool use)
QgsLegendStyle & rstyle(QgsLegendStyle::Style s)
Returns modifiable reference to the style for a legend component.
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...
@ Group
Legend group title.
@ Subgroup
Legend subgroup title.
Q_DECL_DEPRECATED double mapUnitsPerPixel() const
Returns the factor of map units per pixel for symbols with size given in map units calculated by dpi ...
QString wrapChar() const
Returns the string used as a wrapping character.
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...