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() ;}
390 Q_DECL_DEPRECATED
void setMmPerMapUnit(
double mmPerMapUnit )
SIP_DEPRECATED;
400 Q_DECL_DEPRECATED
void setUseAdvancedEffects(
bool use )
SIP_DEPRECATED;
416 Q_DECL_DEPRECATED
void setMapScale(
double scale )
SIP_DEPRECATED;
430 Q_DECL_DEPRECATED
void setMapUnitsPerPixel(
double mapUnitsPerPixel )
SIP_DEPRECATED;
463 QStringList splitStringForWrapping( const QString &stringToSplt ) const;
469 void drawText( QPainter *p,
double x,
double y, const QString &text, const QFont &font ) const;
481 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;
484 QFont scaledFontPixelSize( const QFont &font ) const;
487 double pixelFontSize(
double pointSize ) const;
490 double textWidthMillimeters( const QFont &font, const QString &text ) const;
493 double fontHeightCharacterMM( const QFont &font, QChar
c ) const;
496 double fontAscentMillimeters( const QFont &font ) const;
499 double fontDescentMillimeters( const QFont &font ) const;
506 Qt::AlignmentFlag mTitleAlignment = Qt::AlignLeft;
519 double mMaxSymbolSize = 0.0;
522 double mMinSymbolSize = 0.0;
525 QSizeF mWmsLegendSize;
528 double mLineSpacing = 1;
531 double mColumnSpace = 2;
534 int mColumnCount = 1;
537 bool mSplitLayer = false;
540 bool mEqualColumnWidth = false;
542 bool mRasterSymbolStroke = true;
543 QColor mRasterStrokeColor;
544 double mRasterStrokeWidth = 0.0;
549 double mMmPerMapUnit = 1;
552 bool mUseAdvancedEffects = true;
555 double mMapScale = 1;
561 QColor mLayerFontColor;
564 Qt::AlignmentFlag mSymbolAlignment = Qt::AlignLeft;
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
The QgsLegendSettings class stores the appearance and layout settings for legend drawing with QgsLege...
int columnCount() const
Returns the desired minimum number of columns to show in the legend.
void setSymbolAlignment(Qt::AlignmentFlag alignment)
Sets the alignment for placement of legend symbols.
QString wrapChar() const
Returns the string used as a wrapping character.
void setFontColor(const QColor &c)
Sets the font color used for legend items.
void setWrapChar(const QString &t)
Sets a string to use as a wrapping character.
void setRasterStrokeColor(const QColor &color)
Sets the stroke color for the stroke drawn around raster symbol items.
QColor layerFontColor() const
Returns layer font color, defaults to fontColor()
void setStyle(QgsLegendStyle::Style s, const QgsLegendStyle &style)
Sets the style for a legend component.
void setColumnSpace(double s)
Sets the margin space between adjacent columns (in millimeters).
QgsLegendStyle style(QgsLegendStyle::Style s) const
Returns the style for a legend component.
void setLayerFontColor(const QColor &fontColor)
Sets layer font color to fontColor Overrides fontColor()
void setTitle(const QString &t)
Sets the title for the legend, which will be rendered above all legend items.
bool drawRasterStroke() const
Returns whether a stroke will be drawn around raster symbol items.
void setDrawRasterStroke(bool enabled)
Sets whether a stroke will be drawn around raster symbol items.
QSizeF wmsLegendSize() const
Returns the size (in millimeters) of WMS legend graphics shown in the legend.
double minimumSymbolSize() const
Returns the minimum symbol size (in mm).
double rasterStrokeWidth() const
Returns the stroke width (in millimeters) for the stroke drawn around raster symbol items.
void setLineSpacing(double s)
Sets the line spacing to use between lines of legend text.
void setColumnCount(int c)
Sets the desired minimum number of columns to show in the legend.
void setTitleAlignment(Qt::AlignmentFlag alignment)
Sets the alignment of the legend title.
QgsLegendStyle & rstyle(QgsLegendStyle::Style s)
Returns modifiable reference to the style for a legend component.
Qt::AlignmentFlag titleAlignment() const
Returns the alignment of the legend title.
QSizeF symbolSize() const
Returns the default symbol size (in millimeters) used for legend items.
QColor fontColor() const
Returns the font color used for legend items.
double maximumSymbolSize() const
Returns the maximum symbol size (in mm).
QString title() const
Returns the title for the legend, which will be rendered above all legend items.
QColor rasterStrokeColor() const
Returns the stroke color for the stroke drawn around raster symbol items.
void setSplitLayer(bool s)
Sets whether layer components can be split over multiple columns.
double columnSpace() const
Returns the margin space between adjacent columns (in millimeters).
void setEqualColumnWidth(bool s)
Sets whether all columns should have equal widths.
void setBoxSpace(double s)
Sets the legend box space (in millimeters), which is the empty margin around the inside of the legend...
double boxSpace() const
Returns the legend box space (in millimeters), which is the empty margin around the inside of the leg...
void setMaximumSymbolSize(double size)
Set the maximum symbol size for symbol (in millimeters).
double lineSpacing() const
Returns the line spacing to use between lines of legend text.
bool splitLayer() const
Returns true if layer components can be split over multiple columns.
void setMinimumSymbolSize(double size)
Set the minimum symbol size for symbol (in millimeters).
void setRasterStrokeWidth(double width)
Sets the stroke width for the stroke drawn around raster symbol items.
Qt::AlignmentFlag symbolAlignment() const
Returns the alignment for placement of legend symbols.
bool equalColumnWidth() const
Returns true if all columns should have equal widths.
void setSymbolSize(QSizeF s)
Sets the default symbol size (in millimeters) used for legend items.
void setWmsLegendSize(QSizeF s)
Sets the desired size (in millimeters) of WMS legend graphics shown in the legend.
Contains detailed styling information relating to how a layout legend should be rendered.
Style
Component of legends which can be styled.
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