29   , mPreferredWidth( 300 )
    30   , mWidth( mPreferredWidth )
    40   if ( mMapSettings == mapSettings )
    46     disconnect( mMapSettings, 
nullptr, 
this, 
nullptr );
    99   int digits = int( floor( log10( ( dist ) ) ) ); 
   100   double base = pow( 10, digits ); 
   101   double first_digit = dist / base; 
   103   if ( first_digit < 2 )
   105   else if ( first_digit < 5 )
   110   mDistance = int( round_digit * base );
   111   mWidth = int( mPreferredWidth * mDistance / dist );
 void visibleExtentChanged()
Returns the actual extent derived from requested extent that takes takes output image size into accou...
 
Encapsulating the common utilies for QgsQuick library. 
 
void extentChanged()
Geographical coordinates of the rectangle that should be rendered. 
 
void preferredWidthChanged()
Preferred width of scalebar in pixels. 
 
void setMapSettings(QgsQuickMapSettings *mapSettings)
Associated map settings. 
 
QString units() const
Units of distance (e.g. 
 
The QgsQuickMapSettings class encapsulates QgsMapSettings class to offer settings of configuration of...
 
void mapSettingsChanged()
Associated map settings. 
 
void outputDpiChanged()
Output DPI used for conversion between real world units (e.g. 
 
void mapUnitsPerPixelChanged()
Returns the distance in geographical coordinates that equals to one pixel in the map. 
 
int distance() const
Units of distance (e.g. 
 
void updateScaleBar()
recalculate width, distance and units. 
 
static Q_INVOKABLE QString toAbbreviatedString(QgsUnitTypes::DistanceUnit unit)
Returns a translated abbreviation representing a distance unit. 
 
Q_INVOKABLE double screenUnitsToMeters(QgsQuickMapSettings *mapSettings, int baseLengthPixels) const
Calculate the distance in meter representing baseLengthPixels pixels on the screen based on the curre...
 
void destinationCrsChanged()
CRS of destination coordinate reference system. 
 
QgsQuickMapSettings mapSettings
Associated map settings. 
 
void outputSizeChanged()
The size of the resulting map image. 
 
int width() const
Calculated width of scalebar in pixels representing distance + units. 
 
void scaleBarChanged()
width, distance and/or units changed 
 
QgsQuickScaleBarKit(QObject *parent=nullptr)
create new scale bar kit