QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Public Types | Public Member Functions | List of all members
QgsScaleBarSettings Class Reference

The QgsScaleBarSettings class stores the appearance and layout settings for scalebar drawing with QgsScaleBarRenderer. More...

#include <qgsscalebarsettings.h>

Public Types

enum  Alignment { AlignLeft = 0, AlignMiddle, AlignRight }
 Scalebar alignment. More...
 
enum  SegmentSizeMode { SegmentSizeFixed = 0, SegmentSizeFitWidth = 1 }
 Modes for setting size for scale bar segments. More...
 

Public Member Functions

 QgsScaleBarSettings ()
 Constructor for QgsScaleBarSettings. More...
 
Alignment alignment () const
 Returns the scalebar alignment. More...
 
double boxContentSpace () const
 Returns the spacing (margin) between the scalebar box and content in millimeters. More...
 
QBrush brush () const
 Returns the primary brush used for filling the scalebar. More...
 
QBrush brush2 () const
 Returns the secondary brush for the scalebar. More...
 
QColor fillColor () const
 Returns the color used for fills in the scalebar. More...
 
QColor fillColor2 () const
 Returns the secondary color used for fills in the scalebar. More...
 
Q_DECL_DEPRECATED QFont font () const
 Returns the font used for drawing text in the scalebar. More...
 
Q_DECL_DEPRECATED QColor fontColor () const
 Returns the color used for drawing text in the scalebar. More...
 
double height () const
 Returns the scalebar height (in millimeters). More...
 
double labelBarSpace () const
 Returns the spacing (in millimeters) between labels and the scalebar. More...
 
Qt::PenCapStyle lineCapStyle () const
 Returns the cap style used for drawing lines in the scalebar. More...
 
QColor lineColor () const
 Returns the color used for lines in the scalebar. More...
 
Qt::PenJoinStyle lineJoinStyle () const
 Returns the join style used for drawing lines in the scalebar. More...
 
double lineWidth () const
 Returns the line width in millimeters for lines in the scalebar. More...
 
double mapUnitsPerScaleBarUnit () const
 Returns the number of map units per scale bar unit used by the scalebar. More...
 
double maximumBarWidth () const
 Returns the maximum width (in millimeters) for scale bar segments. More...
 
double minimumBarWidth () const
 Returns the minimum width (in millimeters) for scale bar segments. More...
 
int numberOfSegments () const
 Returns the number of segments included in the scalebar. More...
 
int numberOfSegmentsLeft () const
 Returns the number of segments included in the left part of the scalebar. More...
 
QPen pen () const
 Returns the pen used for drawing outlines in the scalebar. More...
 
SegmentSizeMode segmentSizeMode () const
 Returns the size mode for the scale bar segments. More...
 
void setAlignment (Alignment alignment)
 Sets the scalebar alignment. More...
 
void setBoxContentSpace (double space)
 Sets the space (margin) between the scalebar box and content in millimeters. More...
 
void setBrush (const QBrush &brush)
 Sets the primary brush used for filling the scalebar. More...
 
void setBrush2 (const QBrush &brush)
 Sets the secondary brush used for filling the scalebar. More...
 
void setFillColor (const QColor &color)
 Sets the color used for fills in the scalebar. More...
 
void setFillColor2 (const QColor &color)
 Sets the secondary color used for fills in the scalebar. More...
 
Q_DECL_DEPRECATED void setFont (const QFont &font)
 Sets the font used for drawing text in the scalebar. More...
 
Q_DECL_DEPRECATED void setFontColor (const QColor &color)
 Sets the color used for drawing text in the scalebar. More...
 
void setHeight (double height)
 Sets the scalebar height (in millimeters). More...
 
void setLabelBarSpace (double space)
 Sets the spacing (in millimeters) between labels and the scalebar. More...
 
void setLineCapStyle (Qt::PenCapStyle style)
 Sets the cap style used when drawing the lines in the scalebar. More...
 
void setLineColor (const QColor &color)
 Sets the color used for lines in the scalebar. More...
 
void setLineJoinStyle (Qt::PenJoinStyle style)
 Sets the join style used when drawing the lines in the scalebar. More...
 
void setLineWidth (double width)
 Sets the line width in millimeters for lines in the scalebar. More...
 
void setMapUnitsPerScaleBarUnit (double units)
 Sets the number of map units per scale bar unit used by the scalebar. More...
 
void setMaximumBarWidth (double width)
 Sets the maximum width (in millimeters) for scale bar segments. More...
 
void setMinimumBarWidth (double width)
 Sets the minimum width (in millimeters) for scale bar segments. More...
 
void setNumberOfSegments (int segments)
 Sets the number of segments included in the scalebar. More...
 
void setNumberOfSegmentsLeft (int segments)
 Sets the number of segments included in the left part of the scalebar. More...
 
void setPen (const QPen &pen)
 Sets the pen used for drawing outlines in the scalebar. More...
 
void setSegmentSizeMode (SegmentSizeMode mode)
 Sets the size mode for scale bar segments. More...
 
void setTextFormat (const QgsTextFormat &format)
 Sets the text format used for drawing text in the scalebar. More...
 
void setUnitLabel (const QString &label)
 Sets the label for units. More...
 
void setUnits (QgsUnitTypes::DistanceUnit units)
 Sets the distance units used by the scalebar. More...
 
void setUnitsPerSegment (double units)
 Sets the number of scalebar units per segment. More...
 
QgsTextFormattextFormat ()
 Returns the text format used for drawing text in the scalebar. More...
 
QgsTextFormat textFormat () const
 Returns the text format used for drawing text in the scalebar. More...
 
QString unitLabel () const
 Returns the label for units. More...
 
QgsUnitTypes::DistanceUnit units () const
 Returns the distance units used by the scalebar. More...
 
double unitsPerSegment () const
 Returns the number of scalebar units per segment. More...
 

Detailed Description

The QgsScaleBarSettings class stores the appearance and layout settings for scalebar drawing with QgsScaleBarRenderer.

Since
QGIS 3.0

Definition at line 36 of file qgsscalebarsettings.h.

Member Enumeration Documentation

Scalebar alignment.

Enumerator
AlignLeft 

Left aligned.

AlignMiddle 

Center aligned.

AlignRight 

Right aligned.

Definition at line 43 of file qgsscalebarsettings.h.

Modes for setting size for scale bar segments.

Enumerator
SegmentSizeFixed 

Scale bar segment size is fixed to a map unit.

SegmentSizeFitWidth 

Scale bar segment size is calculated to fit a size range.

Definition at line 53 of file qgsscalebarsettings.h.

Constructor & Destructor Documentation

QgsScaleBarSettings::QgsScaleBarSettings ( )
inline

Constructor for QgsScaleBarSettings.

Definition at line 62 of file qgsscalebarsettings.h.

Member Function Documentation

Alignment QgsScaleBarSettings::alignment ( ) const
inline

Returns the scalebar alignment.

See also
setAlignment()

Definition at line 409 of file qgsscalebarsettings.h.

double QgsScaleBarSettings::boxContentSpace ( ) const
inline

Returns the spacing (margin) between the scalebar box and content in millimeters.

See also
setBoxContentSpace()

Definition at line 397 of file qgsscalebarsettings.h.

QBrush QgsScaleBarSettings::brush ( ) const
inline

Returns the primary brush used for filling the scalebar.

See also
setBrush()
brush2()
pen()

Definition at line 347 of file qgsscalebarsettings.h.

QBrush QgsScaleBarSettings::brush2 ( ) const
inline

Returns the secondary brush for the scalebar.

This is used for alternating color style scalebars, such as single and double box styles.

See also
setBrush2()
brush()

Definition at line 361 of file qgsscalebarsettings.h.

QColor QgsScaleBarSettings::fillColor ( ) const
inline

Returns the color used for fills in the scalebar.

See also
setFillColor()
fillColor2()

Definition at line 281 of file qgsscalebarsettings.h.

QColor QgsScaleBarSettings::fillColor2 ( ) const
inline

Returns the secondary color used for fills in the scalebar.

See also
setFillColor2()
fillColor()

Definition at line 295 of file qgsscalebarsettings.h.

Q_DECL_DEPRECATED QFont QgsScaleBarSettings::font ( ) const
inline

Returns the font used for drawing text in the scalebar.

See also
setFont()
Deprecated:
use textFormat() instead

Definition at line 238 of file qgsscalebarsettings.h.

Q_DECL_DEPRECATED QColor QgsScaleBarSettings::fontColor ( ) const
inline

Returns the color used for drawing text in the scalebar.

See also
setFontColor()
font()
Deprecated:
use textFormat() instead

Definition at line 266 of file qgsscalebarsettings.h.

double QgsScaleBarSettings::height ( ) const
inline

Returns the scalebar height (in millimeters).

See also
setHeight()

Definition at line 373 of file qgsscalebarsettings.h.

double QgsScaleBarSettings::labelBarSpace ( ) const
inline

Returns the spacing (in millimeters) between labels and the scalebar.

See also
setLabelBarSpace()

Definition at line 385 of file qgsscalebarsettings.h.

Qt::PenCapStyle QgsScaleBarSettings::lineCapStyle ( ) const
inline

Returns the cap style used for drawing lines in the scalebar.

See also
setLineCapStyle()

Definition at line 433 of file qgsscalebarsettings.h.

QColor QgsScaleBarSettings::lineColor ( ) const
inline

Returns the color used for lines in the scalebar.

See also
setLineColor()

Definition at line 308 of file qgsscalebarsettings.h.

Qt::PenJoinStyle QgsScaleBarSettings::lineJoinStyle ( ) const
inline

Returns the join style used for drawing lines in the scalebar.

See also
setLineJoinStyle()

Definition at line 421 of file qgsscalebarsettings.h.

double QgsScaleBarSettings::lineWidth ( ) const
inline

Returns the line width in millimeters for lines in the scalebar.

See also
setLineWidth()

Definition at line 320 of file qgsscalebarsettings.h.

double QgsScaleBarSettings::mapUnitsPerScaleBarUnit ( ) const
inline

Returns the number of map units per scale bar unit used by the scalebar.

See also
setMapUnitsPerScaleBarUnit()

Definition at line 192 of file qgsscalebarsettings.h.

double QgsScaleBarSettings::maximumBarWidth ( ) const
inline

Returns the maximum width (in millimeters) for scale bar segments.

This property is only effective if the segmentSizeMode() is set to SegmentSizeFitWidth.

See also
segmentSizeMode()
setMaximumBarWidth()
minimumBarWidth()

Definition at line 164 of file qgsscalebarsettings.h.

double QgsScaleBarSettings::minimumBarWidth ( ) const
inline

Returns the minimum width (in millimeters) for scale bar segments.

This property is only effective if the segmentSizeMode() is set to SegmentSizeFitWidth.

See also
segmentSizeMode()
setMinimumBarWidth()
maximumBarWidth()

Definition at line 144 of file qgsscalebarsettings.h.

int QgsScaleBarSettings::numberOfSegments ( ) const
inline

Returns the number of segments included in the scalebar.

See also
setNumberOfSegments()
numberOfSegmentsLeft()

Definition at line 85 of file qgsscalebarsettings.h.

int QgsScaleBarSettings::numberOfSegmentsLeft ( ) const
inline

Returns the number of segments included in the left part of the scalebar.

See also
setNumberOfSegmentsLeft()
numberOfSegments()

Definition at line 99 of file qgsscalebarsettings.h.

QPen QgsScaleBarSettings::pen ( ) const
inline

Returns the pen used for drawing outlines in the scalebar.

See also
setPen()
brush()

Definition at line 333 of file qgsscalebarsettings.h.

SegmentSizeMode QgsScaleBarSettings::segmentSizeMode ( ) const
inline

Returns the size mode for the scale bar segments.

See also
setSegmentSizeMode()
minimumBarWidth()
maximumBarWidth()

Definition at line 126 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setAlignment ( Alignment  alignment)
inline

Sets the scalebar alignment.

See also
alignment()

Definition at line 415 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setBoxContentSpace ( double  space)
inline

Sets the space (margin) between the scalebar box and content in millimeters.

See also
boxContentSpace()

Definition at line 403 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setBrush ( const QBrush &  brush)
inline

Sets the primary brush used for filling the scalebar.

See also
brush()

Definition at line 353 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setBrush2 ( const QBrush &  brush)
inline

Sets the secondary brush used for filling the scalebar.

See also
brush()

Definition at line 367 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setFillColor ( const QColor &  color)
inline

Sets the color used for fills in the scalebar.

See also
fillColor()
setFillColor2()

Definition at line 288 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setFillColor2 ( const QColor &  color)
inline

Sets the secondary color used for fills in the scalebar.

See also
fillColor2()
setFillColor2()

Definition at line 302 of file qgsscalebarsettings.h.

Q_DECL_DEPRECATED void QgsScaleBarSettings::setFont ( const QFont &  font)
inline

Sets the font used for drawing text in the scalebar.

See also
font()
Deprecated:
use setTextFormat() instead

Definition at line 245 of file qgsscalebarsettings.h.

Q_DECL_DEPRECATED void QgsScaleBarSettings::setFontColor ( const QColor &  color)
inline

Sets the color used for drawing text in the scalebar.

See also
fontColor()
setFont()
Deprecated:
use textFormat() instead

Definition at line 274 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setHeight ( double  height)
inline

Sets the scalebar height (in millimeters).

See also
height()

Definition at line 379 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setLabelBarSpace ( double  space)
inline

Sets the spacing (in millimeters) between labels and the scalebar.

See also
labelBarSpace()

Definition at line 391 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setLineCapStyle ( Qt::PenCapStyle  style)
inline

Sets the cap style used when drawing the lines in the scalebar.

See also
lineCapStyle()

Definition at line 439 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setLineColor ( const QColor &  color)
inline

Sets the color used for lines in the scalebar.

See also
lineColor()

Definition at line 314 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setLineJoinStyle ( Qt::PenJoinStyle  style)
inline

Sets the join style used when drawing the lines in the scalebar.

See also
lineJoinStyle()

Definition at line 427 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setLineWidth ( double  width)
inline

Sets the line width in millimeters for lines in the scalebar.

See also
lineWidth()

Definition at line 326 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setMapUnitsPerScaleBarUnit ( double  units)
inline

Sets the number of map units per scale bar unit used by the scalebar.

See also
mapUnitsPerScaleBarUnit()

Definition at line 198 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setMaximumBarWidth ( double  width)
inline

Sets the maximum width (in millimeters) for scale bar segments.

This property is only effective if the segmentSizeMode() is set to SegmentSizeFitWidth.

See also
minimumBarWidth()
setMinimumBarWidth()
setSegmentSizeMode()

Definition at line 174 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setMinimumBarWidth ( double  width)
inline

Sets the minimum width (in millimeters) for scale bar segments.

This property is only effective if the segmentSizeMode() is set to SegmentSizeFitWidth.

See also
minimumBarWidth()
setMaximumBarWidth()
setSegmentSizeMode()

Definition at line 154 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setNumberOfSegments ( int  segments)
inline

Sets the number of segments included in the scalebar.

See also
numberOfSegments()
setNumberOfSegmentsLeft()

Definition at line 92 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setNumberOfSegmentsLeft ( int  segments)
inline

Sets the number of segments included in the left part of the scalebar.

See also
numberOfSegmentsLeft()
setNumberOfSegments()

Definition at line 106 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setPen ( const QPen &  pen)
inline

Sets the pen used for drawing outlines in the scalebar.

See also
pen()

Definition at line 339 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setSegmentSizeMode ( SegmentSizeMode  mode)
inline

Sets the size mode for scale bar segments.

See also
segmentSizeMode()
setMinimumBarWidth()
setMaximumBarWidth()

Definition at line 134 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setTextFormat ( const QgsTextFormat format)
inline

Sets the text format used for drawing text in the scalebar.

See also
textFormat()
Since
QGIS 3.2

Definition at line 231 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setUnitLabel ( const QString &  label)
inline

Sets the label for units.

See also
unitLabel()

Definition at line 210 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setUnits ( QgsUnitTypes::DistanceUnit  units)
inline

Sets the distance units used by the scalebar.

See also
units()

Definition at line 186 of file qgsscalebarsettings.h.

void QgsScaleBarSettings::setUnitsPerSegment ( double  units)
inline

Sets the number of scalebar units per segment.

See also
unitsPerSegment()

Definition at line 118 of file qgsscalebarsettings.h.

QgsTextFormat& QgsScaleBarSettings::textFormat ( )
inline

Returns the text format used for drawing text in the scalebar.

See also
setTextFormat()
Since
QGIS 3.2

Definition at line 217 of file qgsscalebarsettings.h.

QgsTextFormat QgsScaleBarSettings::textFormat ( ) const
inline

Returns the text format used for drawing text in the scalebar.

See also
setTextFormat()
Since
QGIS 3.2

Definition at line 224 of file qgsscalebarsettings.h.

QString QgsScaleBarSettings::unitLabel ( ) const
inline

Returns the label for units.

See also
setUnitLabel()

Definition at line 204 of file qgsscalebarsettings.h.

QgsUnitTypes::DistanceUnit QgsScaleBarSettings::units ( ) const
inline

Returns the distance units used by the scalebar.

See also
setUnits()

Definition at line 180 of file qgsscalebarsettings.h.

double QgsScaleBarSettings::unitsPerSegment ( ) const
inline

Returns the number of scalebar units per segment.

See also
setUnitsPerSegment()

Definition at line 112 of file qgsscalebarsettings.h.


The documentation for this class was generated from the following file: