29 mTextFormat.
setColor( QColor( 0, 0, 0 ) );
31 mNumericFormat = qgis::make_unique< QgsBasicNumericFormat >();
33 mLineSymbol = qgis::make_unique< QgsLineSymbol >();
34 mLineSymbol->setColor( QColor( 0, 0, 0 ) );
35 mLineSymbol->setWidth( 0.3 );
38 line->setPenJoinStyle( Qt::MiterJoin );
39 line->setPenCapStyle( Qt::SquareCap );
42 mDivisionLineSymbol.reset( mLineSymbol->clone() );
43 mSubdivisionLineSymbol.reset( mLineSymbol->clone() );
45 mFillSymbol = qgis::make_unique< QgsFillSymbol >();
46 mFillSymbol->setColor( QColor( 0, 0, 0 ) );
49 fill->setStrokeStyle( Qt::NoPen );
51 mAlternateFillSymbol = qgis::make_unique< QgsFillSymbol >();
52 mAlternateFillSymbol->setColor( QColor( 255, 255, 255 ) );
55 fill->setStrokeStyle( Qt::NoPen );
60 : mNumSegments( other.mNumSegments )
61 , mNumSegmentsLeft( other.mNumSegmentsLeft )
62 , mNumSubdivisions( other.mNumSubdivisions )
63 , mSubdivisionsHeight( other.mSubdivisionsHeight )
64 , mNumUnitsPerSegment( other.mNumUnitsPerSegment )
65 , mNumMapUnitsPerScaleBarUnit( other.mNumMapUnitsPerScaleBarUnit )
66 , mSegmentSizeMode( other.mSegmentSizeMode )
67 , mMinBarWidth( other.mMinBarWidth )
68 , mMaxBarWidth( other.mMaxBarWidth )
69 , mUnitLabeling( other.mUnitLabeling )
70 , mTextFormat( other.mTextFormat )
71 , mHeight( other.mHeight )
72 , mLineSymbol( other.mLineSymbol->clone() )
73 , mDivisionLineSymbol( other.mDivisionLineSymbol->clone() )
74 , mSubdivisionLineSymbol( other.mSubdivisionLineSymbol->clone() )
75 , mFillSymbol( other.mFillSymbol->clone() )
76 , mAlternateFillSymbol( other.mAlternateFillSymbol->clone() )
77 , mLabelBarSpace( other.mLabelBarSpace )
78 , mLabelVerticalPlacement( other.mLabelVerticalPlacement )
79 , mLabelHorizontalPlacement( other.mLabelHorizontalPlacement )
80 , mBoxContentSpace( other.mBoxContentSpace )
81 , mAlignment( other.mAlignment )
82 , mUnits( other.mUnits )
83 , mNumericFormat( other.mNumericFormat->clone() )
90 mNumSegments = other.mNumSegments;
91 mNumSegmentsLeft = other.mNumSegmentsLeft;
92 mNumSubdivisions = other.mNumSubdivisions;
93 mSubdivisionsHeight = other.mSubdivisionsHeight;
94 mNumUnitsPerSegment = other.mNumUnitsPerSegment;
95 mNumMapUnitsPerScaleBarUnit = other.mNumMapUnitsPerScaleBarUnit;
96 mSegmentSizeMode = other.mSegmentSizeMode;
97 mMinBarWidth = other.mMinBarWidth;
98 mMaxBarWidth = other.mMaxBarWidth;
99 mUnitLabeling = other.mUnitLabeling;
100 mTextFormat = other.mTextFormat;
101 mLineSymbol.reset( other.mLineSymbol->clone() );
102 mDivisionLineSymbol.reset( other.mDivisionLineSymbol->clone() );
103 mSubdivisionLineSymbol.reset( other.mSubdivisionLineSymbol->clone() );
104 mFillSymbol.reset( other.mFillSymbol->clone() );
105 mAlternateFillSymbol.reset( other.mAlternateFillSymbol->clone() );
106 mHeight = other.mHeight;
107 mLabelBarSpace = other.mLabelBarSpace;
108 mLabelVerticalPlacement = other.mLabelVerticalPlacement;
109 mLabelHorizontalPlacement = other.mLabelHorizontalPlacement;
110 mBoxContentSpace = other.mBoxContentSpace;
111 mAlignment = other.mAlignment;
112 mUnits = other.mUnits;
113 mNumericFormat.reset( other.mNumericFormat->clone() );
119 return mFillSymbol->color();
124 mFillSymbol->setColor( color );
129 return mAlternateFillSymbol->color();
134 mAlternateFillSymbol->setColor( color );
139 return mLineSymbol->color();
144 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
146 symbol->setColor( color );
152 return mLineSymbol->width();
157 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
159 symbol->setWidth( width );
166 QPen
pen( mLineSymbol->color() );
169 pen.setJoinStyle( line->penJoinStyle() );
170 pen.setCapStyle( line->penCapStyle() );
172 pen.setWidthF( mLineSymbol->width() );
178 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
180 symbol->setColor(
pen.color() );
181 symbol->setWidth(
pen.widthF() );
185 line->setPenJoinStyle(
pen.joinStyle() );
186 line->setPenCapStyle(
pen.capStyle() );
193 return mLineSymbol.get();
198 mLineSymbol.reset( symbol );
203 return mDivisionLineSymbol.get();
208 mDivisionLineSymbol.reset( symbol );
213 return mSubdivisionLineSymbol.get();
218 mSubdivisionLineSymbol.reset( symbol );
223 return mFillSymbol.get();
228 mFillSymbol.reset( symbol );
233 return mAlternateFillSymbol.get();
238 mAlternateFillSymbol.reset( symbol );
244 b.setColor( mFillSymbol->color() );
247 b.setStyle( fill->brushStyle() );
255 mFillSymbol->setColor(
brush.color() );
258 fill->setBrushStyle(
brush.style() );
265 b.setColor( mAlternateFillSymbol->color() );
268 b.setStyle( fill->brushStyle() );
276 mAlternateFillSymbol->setColor(
brush.color() );
279 fill->setBrushStyle(
brush.style() );
287 return line->penJoinStyle();
289 return Qt::MiterJoin;
294 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
298 line->setPenJoinStyle( style );
307 return line->penCapStyle();
314 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
318 line->setPenCapStyle( style );
325 return mNumericFormat.get();
330 mNumericFormat.reset( format );
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A line symbol type, for rendering LineString and MultiLineString geometries.
The QgsScaleBarSettings class stores the appearance and layout settings for scalebar drawing with Qgs...
void setSubdivisionLineSymbol(QgsLineSymbol *symbol)
Sets the line symbol used to render the scalebar subdivisions (only used for some scalebar types).
Q_DECL_DEPRECATED QColor fillColor() const
Returns the color used for fills in the scalebar.
QgsLineSymbol * lineSymbol() const
Returns the line symbol used to render the scalebar (only used for some scalebar types).
QgsLineSymbol * subdivisionLineSymbol() const
Returns the line symbol used to render the scalebar subdivisions (only used for some scalebar types).
Q_DECL_DEPRECATED QColor fillColor2() const
Returns the secondary color used for fills in the scalebar.
void setAlternateFillSymbol(QgsFillSymbol *symbol)
Sets the secondary fill symbol used to render the scalebar (only used for some scalebar types).
const QgsNumericFormat * numericFormat() const
Returns the numeric format used for numbers in the scalebar.
Q_DECL_DEPRECATED void setFillColor(const QColor &color)
Sets the color used for fills in the scalebar.
Q_DECL_DEPRECATED void setFillColor2(const QColor &color)
Sets the secondary color used for fills in the scalebar.
Q_DECL_DEPRECATED void setLineCapStyle(Qt::PenCapStyle style)
Sets the cap style used when drawing the lines in the scalebar.
void setFillSymbol(QgsFillSymbol *symbol)
Sets the primary fill symbol used to render the scalebar (only used for some scalebar types).
Q_DECL_DEPRECATED void setLineJoinStyle(Qt::PenJoinStyle style)
Sets the join style used when drawing the lines in the scalebar.
Q_DECL_DEPRECATED QPen pen() const
Returns the pen used for drawing outlines in the scalebar.
Q_DECL_DEPRECATED void setPen(const QPen &pen)
Sets the pen used for drawing outlines in the scalebar.
Q_DECL_DEPRECATED void setBrush(const QBrush &brush)
Sets the primary brush used for filling the scalebar.
Q_DECL_DEPRECATED void setBrush2(const QBrush &brush)
Sets the secondary brush used for filling the scalebar.
Q_DECL_DEPRECATED void setLineColor(const QColor &color)
Sets the color used for lines in the scalebar.
void setLineSymbol(QgsLineSymbol *symbol)
Sets the line symbol used to render the scalebar (only used for some scalebar types).
void setDivisionLineSymbol(QgsLineSymbol *symbol)
Sets the line symbol used to render the scalebar divisions (only used for some scalebar types).
Q_DECL_DEPRECATED void setLineWidth(double width)
Sets the line width in millimeters for lines in the scalebar.
QgsFillSymbol * alternateFillSymbol() const
Returns the secondary fill symbol used to render the scalebar (only used for some scalebar types).
QgsFillSymbol * fillSymbol() const
Returns the primary fill symbol used to render the scalebar (only used for some scalebar types).
Q_DECL_DEPRECATED double lineWidth() const
Returns the line width in millimeters for lines in the scalebar.
Q_DECL_DEPRECATED QBrush brush2() const
Returns the secondary brush for the scalebar.
void setNumericFormat(QgsNumericFormat *format)
Sets the numeric format used for numbers in the scalebar.
QgsScaleBarSettings()
Constructor for QgsScaleBarSettings.
Q_DECL_DEPRECATED QColor lineColor() const
Returns the color used for lines in the scalebar.
Q_DECL_DEPRECATED Qt::PenCapStyle lineCapStyle() const
Returns the cap style used for drawing lines in the scalebar.
QgsScaleBarSettings & operator=(const QgsScaleBarSettings &other)
Q_DECL_DEPRECATED Qt::PenJoinStyle lineJoinStyle() const
Returns the join style used for drawing lines in the scalebar.
Q_DECL_DEPRECATED QBrush brush() const
Returns the primary brush used for filling the scalebar.
QgsLineSymbol * divisionLineSymbol() const
Returns the line symbol used to render the scalebar divisions (only used for some scalebar types).
A simple line symbol layer, which renders lines using a line in a variety of styles (e....
void setColor(const QColor &color)
Sets the color that text will be rendered in.
void setSize(double size)
Sets the size for rendered text.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the size of rendered text.
@ RenderPoints
Points (e.g., for font sizes)
@ RenderMillimeters
Millimeters.