QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
|
A widget displaying a combobox allowing the user to choose between various display units, such as millimeters or map unit. More...
#include <qgsunitselectionwidget.h>
Signals | |
void | changed () |
Public Member Functions | |
QgsUnitSelectionWidget (QWidget *parent=nullptr) | |
Constructor for QgsUnitSelectionWidget. | |
QgsMapUnitScale | getMapUnitScale () const |
Returns the map unit scale. | |
int | getUnit () const |
Gets the selected unit index. | |
void | setMapCanvas (QgsMapCanvas *canvas) |
Sets the map canvas associated with the widget. | |
void | setMapUnitScale (const QgsMapUnitScale &scale) |
Sets the map unit scale. | |
void | setShowMapScaleButton (bool show) |
Sets whether the widget can show the map scale button when the Map Units option is selected. | |
void | setUnit (int unitIndex) |
Sets the selected unit index. | |
void | setUnit (Qgis::RenderUnit unit) |
Sets the selected unit. | |
void | setUnits (const QgsUnitTypes::RenderUnitList &units) |
Sets the units which the user can choose from in the combobox. | |
void | setUnits (const QStringList &units, int mapUnitIdx) |
Sets the units which the user can choose from in the combobox. | |
bool | showMapScaleButton () const |
Returns true if the widget can show the map scale button when the Map Units option is selected. | |
Qgis::RenderUnit | unit () const |
Returns the current predefined selected unit (if applicable). | |
A widget displaying a combobox allowing the user to choose between various display units, such as millimeters or map unit.
If the user chooses map units, a button appears allowing adjustment of minimum and maximum scaling.
Definition at line 165 of file qgsunitselectionwidget.h.
QgsUnitSelectionWidget::QgsUnitSelectionWidget | ( | QWidget * | parent = nullptr | ) |
Constructor for QgsUnitSelectionWidget.
parent | parent widget |
Definition at line 126 of file qgsunitselectionwidget.cpp.
|
signal |
|
inline |
Returns the map unit scale.
Definition at line 215 of file qgsunitselectionwidget.h.
|
inline |
Gets the selected unit index.
Definition at line 192 of file qgsunitselectionwidget.h.
void QgsUnitSelectionWidget::setMapCanvas | ( | QgsMapCanvas * | canvas | ) |
Sets the map canvas associated with the widget.
This allows the widget to retrieve the current map scale from the canvas.
canvas | map canvas |
Definition at line 219 of file qgsunitselectionwidget.cpp.
|
inline |
Sets the map unit scale.
Definition at line 218 of file qgsunitselectionwidget.h.
void QgsUnitSelectionWidget::setShowMapScaleButton | ( | bool | show | ) |
Sets whether the widget can show the map scale button when the Map Units option is selected.
Definition at line 274 of file qgsunitselectionwidget.cpp.
void QgsUnitSelectionWidget::setUnit | ( | int | unitIndex | ) |
Sets the selected unit index.
unitIndex | index of unit to set as current |
Definition at line 206 of file qgsunitselectionwidget.cpp.
void QgsUnitSelectionWidget::setUnit | ( | Qgis::RenderUnit | unit | ) |
Sets the selected unit.
unit | predefined unit to set as current |
Definition at line 213 of file qgsunitselectionwidget.cpp.
void QgsUnitSelectionWidget::setUnits | ( | const QgsUnitTypes::RenderUnitList & | units | ) |
Sets the units which the user can choose from in the combobox.
Clears any existing units.
units | list of valid units |
Definition at line 152 of file qgsunitselectionwidget.cpp.
void QgsUnitSelectionWidget::setUnits | ( | const QStringList & | units, |
int | mapUnitIdx | ||
) |
Sets the units which the user can choose from in the combobox.
units | list of strings for custom units to display in the widget |
mapUnitIdx | specifies which entry corresponds to the map units, or -1 if none |
Definition at line 144 of file qgsunitselectionwidget.cpp.
bool QgsUnitSelectionWidget::showMapScaleButton | ( | ) | const |
Returns true
if the widget can show the map scale button when the Map Units option is selected.
Definition at line 269 of file qgsunitselectionwidget.cpp.
Qgis::RenderUnit QgsUnitSelectionWidget::unit | ( | ) | const |
Returns the current predefined selected unit (if applicable).
Definition at line 192 of file qgsunitselectionwidget.cpp.