QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Properties | List of all members
QgsScaleWidget Class Reference

A combobox which lets the user select map scale from predefined list and highlights nearest to current scale value. More...

#include <qgsscalewidget.h>

Public Slots

void setScaleFromCanvas ()
 assign the current scale from the map canvas
void updateScales (const QStringList &scales=QStringList())

Signals

void scaleChanged ()
 Signal is emitted when user has finished editing/selecting a new scale.

Public Member Functions

 QgsScaleWidget (QWidget *parent=0)
virtual ~QgsScaleWidget ()
double scale ()
 Function to read the selected scale as double.
QString scaleString ()
 Function to read the selected scale as text.
void setMapCanvas (QgsMapCanvas *canvas)
 set the map canvas associated to the current button
void setScale (double scale)
 Function to set the selected scale from double.
bool setScaleString (QString scaleTxt)
 Function to set the selected scale from text.
void setShowCurrentScaleButton (bool showCurrentScaleButton)
 shows a button to set the scale to the current scale of the map canvas next to the combobox
bool showCurrentScaleButton ()

Static Public Member Functions

static double toDouble (QString scaleString, bool *ok=0)
 Helper function to convert a scale string to double.
static QString toString (double scale)
 Helper function to convert a double to scale string.

Properties

bool showCurrentScaleButton

Detailed Description

A combobox which lets the user select map scale from predefined list and highlights nearest to current scale value.

Definition at line 31 of file qgsscalewidget.h.

Constructor & Destructor Documentation

QgsScaleWidget::QgsScaleWidget ( QWidget *  parent = 0)
explicit

Definition at line 22 of file qgsscalewidget.cpp.

QgsScaleWidget::~QgsScaleWidget ( )
virtual

Definition at line 44 of file qgsscalewidget.cpp.

Member Function Documentation

double QgsScaleWidget::scale ( )
inline

Function to read the selected scale as double.

Definition at line 54 of file qgsscalewidget.h.

void QgsScaleWidget::scaleChanged ( )
signal

Signal is emitted when user has finished editing/selecting a new scale.

QString QgsScaleWidget::scaleString ( )
inline

Function to read the selected scale as text.

Definition at line 50 of file qgsscalewidget.h.

void QgsScaleWidget::setMapCanvas ( QgsMapCanvas canvas)

set the map canvas associated to the current button

Definition at line 54 of file qgsscalewidget.cpp.

void QgsScaleWidget::setScale ( double  scale)
inline

Function to set the selected scale from double.

Definition at line 56 of file qgsscalewidget.h.

void QgsScaleWidget::setScaleFromCanvas ( )
slot

assign the current scale from the map canvas

Definition at line 60 of file qgsscalewidget.cpp.

bool QgsScaleWidget::setScaleString ( QString  scaleTxt)
inline

Function to set the selected scale from text.

Definition at line 52 of file qgsscalewidget.h.

void QgsScaleWidget::setShowCurrentScaleButton ( bool  showCurrentScaleButton)

shows a button to set the scale to the current scale of the map canvas next to the combobox

Note
the map canvas must be defined to show the button

Definition at line 48 of file qgsscalewidget.cpp.

bool QgsScaleWidget::showCurrentScaleButton ( )
inline

Definition at line 44 of file qgsscalewidget.h.

static double QgsScaleWidget::toDouble ( QString  scaleString,
bool *  ok = 0 
)
inlinestatic

Helper function to convert a scale string to double.

Definition at line 63 of file qgsscalewidget.h.

static QString QgsScaleWidget::toString ( double  scale)
inlinestatic

Helper function to convert a double to scale string.

Definition at line 61 of file qgsscalewidget.h.

void QgsScaleWidget::updateScales ( const QStringList &  scales = QStringList())
inlineslot

Definition at line 66 of file qgsscalewidget.h.

Property Documentation

bool QgsScaleWidget::showCurrentScaleButton
readwrite

Definition at line 34 of file qgsscalewidget.h.


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