A combobox which lets the user select map scale from predefined list and highlights nearest to current scale value.
More...
#include <qgsscalewidget.h>
|
static double | toDouble (const QString &scaleString, bool *ok=nullptr) |
| Helper function to convert a scale string to double. More...
|
|
static QString | toString (double scale) |
| Helper function to convert a scale double to scale string. More...
|
|
A combobox which lets the user select map scale from predefined list and highlights nearest to current scale value.
Definition at line 34 of file qgsscalewidget.h.
◆ QgsScaleWidget()
QgsScaleWidget::QgsScaleWidget |
( |
QWidget * |
parent = nullptr | ) |
|
|
explicit |
QgsScaleWidget creates a combobox which lets the user select map scale from predefined list and highlights nearest to current scale value.
Definition at line 28 of file qgsscalewidget.cpp.
◆ allowNull()
bool QgsScaleWidget::allowNull |
( |
| ) |
const |
◆ isNull()
bool QgsScaleWidget::isNull |
( |
| ) |
const |
◆ minScale()
double QgsScaleWidget::minScale |
( |
| ) |
const |
|
inline |
Returns the minimum scale, or 0 if no minimum scale set.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. Any scale lower than the minimum scale will automatically be converted to the minimum scale. Except for 0 which is always allowed.
Definition at line 102 of file qgsscalewidget.h.
◆ scale()
double QgsScaleWidget::scale |
( |
| ) |
const |
|
inline |
Returns the selected scale as a double.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
- See also
- setScale()
Definition at line 85 of file qgsscalewidget.h.
◆ scaleChanged
void QgsScaleWidget::scaleChanged |
( |
double |
scale | ) |
|
|
signal |
Emitted when user has finished editing/selecting a new scale.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
◆ scaleString()
QString QgsScaleWidget::scaleString |
( |
| ) |
const |
|
inline |
◆ setAllowNull()
void QgsScaleWidget::setAllowNull |
( |
bool |
allowNull | ) |
|
◆ setMapCanvas()
Set the map canvas associated to the current button.
Definition at line 60 of file qgsscalewidget.cpp.
◆ setMinScale
void QgsScaleWidget::setMinScale |
( |
double |
scale | ) |
|
|
inlineslot |
Set the minimum allowed scale.
Set to 0 to disable the minimum scale. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. Any scale lower than the minimum scale will automatically be converted to the minimum scale. Except for 0 which is always allowed.
Definition at line 166 of file qgsscalewidget.h.
◆ setNull
void QgsScaleWidget::setNull |
( |
| ) |
|
|
slot |
◆ setScale
void QgsScaleWidget::setScale |
( |
double |
scale | ) |
|
|
slot |
Set the selected scale from a double.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
- See also
- scale()
Definition at line 94 of file qgsscalewidget.cpp.
◆ setScaleFromCanvas
void QgsScaleWidget::setScaleFromCanvas |
( |
| ) |
|
|
slot |
◆ setScaleString()
bool QgsScaleWidget::setScaleString |
( |
const QString & |
string | ) |
|
|
inline |
◆ setShowCurrentScaleButton()
void QgsScaleWidget::setShowCurrentScaleButton |
( |
bool |
showCurrentScaleButton | ) |
|
◆ showCurrentScaleButton()
bool QgsScaleWidget::showCurrentScaleButton |
( |
| ) |
|
|
inline |
◆ toDouble()
static double QgsScaleWidget::toDouble |
( |
const QString & |
scaleString, |
|
|
bool * |
ok = nullptr |
|
) |
| |
|
inlinestatic |
Helper function to convert a scale string to double.
The returned value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. If specified, ok will be set to true
if the string was successfully interpreted as a scale.
- See also
- toString()
Definition at line 119 of file qgsscalewidget.h.
◆ toString()
static QString QgsScaleWidget::toString |
( |
double |
scale | ) |
|
|
inlinestatic |
Helper function to convert a scale double to scale string.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
The returned string will be rounded (e.g. 1:1000, not 1:1000.345).
- See also
- toDouble()
Definition at line 111 of file qgsscalewidget.h.
◆ updateScales
void QgsScaleWidget::updateScales |
( |
const QStringList & |
scales = QStringList() | ) |
|
|
inlineslot |
Sets the list of predefined scales to show in the combobox.
List elements are expected to be valid scale strings, such as "1:1000000".
Definition at line 152 of file qgsscalewidget.h.
◆ minScale
bool QgsScaleWidget::minScale |
|
readwrite |
◆ scale
bool QgsScaleWidget::scale |
|
readwrite |
◆ showCurrentScaleButton
bool QgsScaleWidget::showCurrentScaleButton |
|
readwrite |
The documentation for this class was generated from the following files: