QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
16 #ifndef QGSLEGENDSETTINGS_H
17 #define QGSLEGENDSETTINGS_H
19 #include "qgis_core.h"
48 void setTitle(
const QString &t ) { mTitle = t; }
55 QString
title()
const {
return mTitle; }
212 QColor
layerFontColor()
const {
return mLayerFontColor.isValid() ? mLayerFontColor : fontColor() ;}
354 Q_DECL_DEPRECATED
void setMmPerMapUnit(
double mmPerMapUnit )
SIP_DEPRECATED;
364 Q_DECL_DEPRECATED
void setUseAdvancedEffects(
bool use )
SIP_DEPRECATED;
380 Q_DECL_DEPRECATED
void setMapScale(
double scale )
SIP_DEPRECATED;
394 Q_DECL_DEPRECATED
void setMapUnitsPerPixel(
double mapUnitsPerPixel )
SIP_DEPRECATED;
427 QStringList splitStringForWrapping( const QString &stringToSplt ) const;
433 void drawText( QPainter *p,
double x,
double y, const QString &text, const QFont &font ) const;
445 void drawText( QPainter *p, const QRectF &rect, const QString &text, const QFont &font, Qt::AlignmentFlag halignment = Qt::AlignLeft, Qt::AlignmentFlag valignment = Qt::AlignTop,
int flags = Qt::TextWordWrap ) const;
448 QFont scaledFontPixelSize( const QFont &font ) const;
451 double pixelFontSize(
double pointSize ) const;
454 double textWidthMillimeters( const QFont &font, const QString &text ) const;
457 double fontHeightCharacterMM( const QFont &font, QChar
c ) const;
460 double fontAscentMillimeters( const QFont &font ) const;
463 double fontDescentMillimeters( const QFont &font ) const;
470 Qt::AlignmentFlag mTitleAlignment = Qt::AlignLeft;
483 QSizeF mWmsLegendSize;
486 double mLineSpacing = 1;
489 double mColumnSpace = 2;
492 int mColumnCount = 1;
495 bool mSplitLayer = false;
498 bool mEqualColumnWidth = false;
500 bool mRasterSymbolStroke = true;
501 QColor mRasterStrokeColor;
502 double mRasterStrokeWidth = 0.0;
507 double mMmPerMapUnit = 1;
510 bool mUseAdvancedEffects = true;
513 double mMapScale = 1;
519 QColor mLayerFontColor;
522 Qt::AlignmentFlag mSymbolAlignment = Qt::AlignLeft;
527 #endif // QGSLEGENDSETTINGS_H
void setSymbolAlignment(Qt::AlignmentFlag alignment)
Sets the alignment for placement of legend symbols.
void setEqualColumnWidth(bool s)
Sets whether all columns should have equal widths.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Qt::AlignmentFlag symbolAlignment() const
Returns the alignment for placement of legend symbols.
QString title() const
Returns the title for the legend, which will be rendered above all legend items.
Style
Component of legends which can be styled.
void setTitleAlignment(Qt::AlignmentFlag alignment)
Sets the alignment of the legend title.
int columnCount() const
Returns the desired minimum number of columns to show in the legend.
QColor layerFontColor() const
Returns layer font color, defaults to fontColor()
void setSymbolSize(QSizeF s)
Sets the default symbol size (in millimeters) used for legend items.
void setSplitLayer(bool s)
Sets whether layer components can be split over multiple columns.
QgsLegendStyle style(QgsLegendStyle::Style s) const
Returns the style for a legend component.
void setBoxSpace(double s)
Sets the legend box space (in millimeters), which is the empty margin around the inside of the legend...
QColor rasterStrokeColor() const
Returns the stroke color for the stroke drawn around raster symbol items.
bool drawRasterStroke() const
Returns whether a stroke will be drawn around raster symbol items.
double rasterStrokeWidth() const
Returns the stroke width (in millimeters) for the stroke drawn around raster symbol items.
void setTitle(const QString &t)
Sets the title for the legend, which will be rendered above all legend items.
void setRasterStrokeWidth(double width)
Sets the stroke width for the stroke drawn around raster symbol items.
double boxSpace() const
Returns the legend box space (in millimeters), which is the empty margin around the inside of the leg...
void setColumnSpace(double s)
Sets the margin space between adjacent columns (in millimeters).
QSizeF wmsLegendSize() const
Returns the size (in millimeters) of WMS legend graphics shown in the legend.
The QgsLegendSettings class stores the appearance and layout settings for legend drawing with QgsLege...
Qt::AlignmentFlag titleAlignment() const
Returns the alignment of the legend title.
void setLineSpacing(double s)
Sets the line spacing to use between lines of legend text.
void setDrawRasterStroke(bool enabled)
Sets whether a stroke will be drawn around raster symbol items.
void setStyle(QgsLegendStyle::Style s, const QgsLegendStyle &style)
Sets the style for a legend component.
void setFontColor(const QColor &c)
Sets the font color used for legend items.
void setColumnCount(int c)
Sets the desired minimum number of columns to show in the legend.
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
bool splitLayer() const
Returns true if layer components can be split over multiple columns.
QSizeF symbolSize() const
Returns the default symbol size (in millimeters) used for legend items.
bool equalColumnWidth() const
Returns true if all columns should have equal widths.
void setLayerFontColor(const QColor &fontColor)
Sets layer font color to fontColor Overrides fontColor()
void setWmsLegendSize(QSizeF s)
Sets the desired size (in millimeters) of WMS legend graphics shown in the legend.
QColor fontColor() const
Returns the font color used for legend items.
double lineSpacing() const
Returns the line spacing to use between lines of legend text.
QgsLegendStyle & rstyle(QgsLegendStyle::Style s)
Returns modifiable reference to the style for a legend component.
void setRasterStrokeColor(const QColor &color)
Sets the stroke color for the stroke drawn around raster symbol items.
double columnSpace() const
Returns the margin space between adjacent columns (in millimeters).
void setWrapChar(const QString &t)
Sets a string to use as a wrapping character.
QString wrapChar() const
Returns the string used as a wrapping character.