A combobox which lets the user select map scale from predefined list and highlights nearest to current scale value.
More...
#include <qgsscalecombobox.h>
|
static double | toDouble (const QString &string, 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 30 of file qgsscalecombobox.h.
◆ QgsScaleComboBox()
QgsScaleComboBox::QgsScaleComboBox |
( |
QWidget * |
parent = nullptr | ) |
|
◆ allowNull()
bool QgsScaleComboBox::allowNull |
( |
| ) |
const |
◆ isNull()
bool QgsScaleComboBox::isNull |
( |
| ) |
const |
◆ minScale()
double QgsScaleComboBox::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 77 of file qgsscalecombobox.h.
◆ scale()
double QgsScaleComboBox::scale |
( |
| ) |
const |
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 158 of file qgsscalecombobox.cpp.
◆ scaleChanged
void QgsScaleComboBox::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 QgsScaleComboBox::scaleString |
( |
| ) |
const |
◆ setAllowNull()
void QgsScaleComboBox::setAllowNull |
( |
bool |
allowNull | ) |
|
◆ setMinScale
void QgsScaleComboBox::setMinScale |
( |
double |
scale | ) |
|
|
slot |
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 275 of file qgsscalecombobox.cpp.
◆ setNull
void QgsScaleComboBox::setNull |
( |
| ) |
|
|
slot |
◆ setScale
void QgsScaleComboBox::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 168 of file qgsscalecombobox.cpp.
◆ setScaleString()
bool QgsScaleComboBox::setScaleString |
( |
const QString & |
string | ) |
|
◆ showPopup()
void QgsScaleComboBox::showPopup |
( |
| ) |
|
|
overrideprotected |
◆ toDouble()
double QgsScaleComboBox::toDouble |
( |
const QString & |
string, |
|
|
bool * |
ok = nullptr |
|
) |
| |
|
static |
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 223 of file qgsscalecombobox.cpp.
◆ toString()
QString QgsScaleComboBox::toString |
( |
double |
scale | ) |
|
|
static |
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 203 of file qgsscalecombobox.cpp.
◆ updateScales
void QgsScaleComboBox::updateScales |
( |
const QStringList & |
scales = QStringList() | ) |
|
|
slot |
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 40 of file qgsscalecombobox.cpp.
◆ minScale
double QgsScaleComboBox::minScale |
|
readwrite |
◆ scale
double QgsScaleComboBox::scale |
|
readwrite |
The documentation for this class was generated from the following files: