29 mTextFormat.setSize( 12.0 );
31 mTextFormat.setColor( QColor( 0, 0, 0 ) );
33 mNumericFormat = std::make_unique< QgsBasicNumericFormat >();
35 mLineSymbol = std::make_unique< QgsLineSymbol >();
36 mLineSymbol->setColor( QColor( 0, 0, 0 ) );
37 mLineSymbol->setWidth( 0.3 );
40 line->setPenJoinStyle( Qt::MiterJoin );
41 line->setPenCapStyle( Qt::SquareCap );
44 mDivisionLineSymbol.reset( mLineSymbol->clone() );
45 mSubdivisionLineSymbol.reset( mLineSymbol->clone() );
47 mFillSymbol = std::make_unique< QgsFillSymbol >();
48 mFillSymbol->setColor( QColor( 0, 0, 0 ) );
51 fill->setStrokeStyle( Qt::NoPen );
53 mAlternateFillSymbol = std::make_unique< QgsFillSymbol >();
54 mAlternateFillSymbol->setColor( QColor( 255, 255, 255 ) );
57 fill->setStrokeStyle( Qt::NoPen );
62 : mNumSegments( other.mNumSegments )
63 , mNumSegmentsLeft( other.mNumSegmentsLeft )
64 , mNumSubdivisions( other.mNumSubdivisions )
65 , mSubdivisionsHeight( other.mSubdivisionsHeight )
66 , mNumUnitsPerSegment( other.mNumUnitsPerSegment )
67 , mNumMapUnitsPerScaleBarUnit( other.mNumMapUnitsPerScaleBarUnit )
68 , mSegmentSizeMode( other.mSegmentSizeMode )
69 , mMinBarWidth( other.mMinBarWidth )
70 , mMaxBarWidth( other.mMaxBarWidth )
71 , mUnitLabeling( other.mUnitLabeling )
72 , mTextFormat( other.mTextFormat )
73 , mHeight( other.mHeight )
74 , mLineSymbol( other.mLineSymbol->clone() )
75 , mDivisionLineSymbol( other.mDivisionLineSymbol->clone() )
76 , mSubdivisionLineSymbol( other.mSubdivisionLineSymbol->clone() )
77 , mFillSymbol( other.mFillSymbol->clone() )
78 , mAlternateFillSymbol( other.mAlternateFillSymbol->clone() )
79 , mLabelBarSpace( other.mLabelBarSpace )
80 , mLabelVerticalPlacement( other.mLabelVerticalPlacement )
81 , mLabelHorizontalPlacement( other.mLabelHorizontalPlacement )
82 , mBoxContentSpace( other.mBoxContentSpace )
83 , mAlignment( other.mAlignment )
84 , mUnits( other.mUnits )
85 , mNumericFormat( other.mNumericFormat->clone() )
93 mNumSegments = other.mNumSegments;
94 mNumSegmentsLeft = other.mNumSegmentsLeft;
95 mNumSubdivisions = other.mNumSubdivisions;
96 mSubdivisionsHeight = other.mSubdivisionsHeight;
97 mNumUnitsPerSegment = other.mNumUnitsPerSegment;
98 mNumMapUnitsPerScaleBarUnit = other.mNumMapUnitsPerScaleBarUnit;
99 mSegmentSizeMode = other.mSegmentSizeMode;
100 mMinBarWidth = other.mMinBarWidth;
101 mMaxBarWidth = other.mMaxBarWidth;
102 mUnitLabeling = other.mUnitLabeling;
103 mTextFormat = other.mTextFormat;
104 mLineSymbol.reset( other.mLineSymbol->clone() );
105 mDivisionLineSymbol.reset( other.mDivisionLineSymbol->clone() );
106 mSubdivisionLineSymbol.reset( other.mSubdivisionLineSymbol->clone() );
107 mFillSymbol.reset( other.mFillSymbol->clone() );
108 mAlternateFillSymbol.reset( other.mAlternateFillSymbol->clone() );
109 mHeight = other.mHeight;
110 mLabelBarSpace = other.mLabelBarSpace;
111 mLabelVerticalPlacement = other.mLabelVerticalPlacement;
112 mLabelHorizontalPlacement = other.mLabelHorizontalPlacement;
113 mBoxContentSpace = other.mBoxContentSpace;
114 mAlignment = other.mAlignment;
115 mUnits = other.mUnits;
116 mNumericFormat.reset( other.mNumericFormat->clone() );
122 return mFillSymbol->color();
127 mFillSymbol->setColor( color );
132 return mAlternateFillSymbol->color();
137 mAlternateFillSymbol->setColor( color );
142 return mLineSymbol->color();
147 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
149 symbol->setColor( color );
155 return mLineSymbol->width();
160 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
162 symbol->setWidth( width );
169 QPen
pen( mLineSymbol->color() );
172 pen.setJoinStyle( line->penJoinStyle() );
173 pen.setCapStyle( line->penCapStyle() );
175 pen.setWidthF( mLineSymbol->width() );
181 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
183 symbol->setColor(
pen.color() );
184 symbol->setWidth(
pen.widthF() );
188 line->setPenJoinStyle(
pen.joinStyle() );
189 line->setPenCapStyle(
pen.capStyle() );
196 return mLineSymbol.get();
201 mLineSymbol.reset( symbol );
206 return mDivisionLineSymbol.get();
211 mDivisionLineSymbol.reset( symbol );
216 return mSubdivisionLineSymbol.get();
221 mSubdivisionLineSymbol.reset( symbol );
226 return mFillSymbol.get();
231 mFillSymbol.reset( symbol );
236 return mAlternateFillSymbol.get();
241 mAlternateFillSymbol.reset( symbol );
250 b.setStyle( fill->brushStyle() );
258 mFillSymbol->setColor(
brush.color() );
261 fill->setBrushStyle(
brush.style() );
268 b.setColor( mAlternateFillSymbol->color() );
271 b.setStyle( fill->brushStyle() );
279 mAlternateFillSymbol->setColor(
brush.color() );
282 fill->setBrushStyle(
brush.style() );
290 return line->penJoinStyle();
292 return Qt::MiterJoin;
297 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
301 line->setPenJoinStyle( style );
310 return line->penCapStyle();
317 for (
QgsLineSymbol *symbol : { mLineSymbol.get(), mDivisionLineSymbol.get(), mSubdivisionLineSymbol.get() } )
321 line->setPenCapStyle( style );
328 return mNumericFormat.get();
333 mNumericFormat.reset( format );
@ Millimeters
Millimeters.
@ Points
Points (e.g., for font sizes).
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A line symbol type, for rendering LineString and MultiLineString geometries.
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.
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).
Renders polygons using a single fill and stroke color.
A simple line symbol layer, which renders lines using a line in a variety of styles (e....
void setColor(const QColor &color) const
Sets the color for the symbol.