sipify QgsScaleWidget

This commit is contained in:
Denis Rouzaud 2017-04-19 16:51:15 +02:00
parent dd6c7fdbc8
commit 36604196d7
3 changed files with 80 additions and 29 deletions

View File

@ -434,7 +434,6 @@ gui/qgsrubberband.sip
gui/qgsscalecombobox.sip
gui/qgsscalerangewidget.sip
gui/qgsscalevisibilitydialog.sip
gui/qgsscalewidget.sip
gui/qgsscrollarea.sip
gui/qgssearchquerybuilder.sip
gui/qgsshortcutsmanager.sip

View File

@ -1,57 +1,108 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsscalewidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
/** \ingroup gui
* A combobox which lets the user select map scale from predefined list
* and highlights nearest to current scale value
**/
class QgsScaleWidget : QWidget
{
%TypeHeaderCode
#include <qgsscalewidget.h>
%Docstring
A combobox which lets the user select map scale from predefined list
and highlights nearest to current scale value
*
%End
%TypeHeaderCode
#include "qgsscalewidget.h"
%End
public:
QgsScaleWidget( QWidget* parent /TransferThis/ = 0 );
~QgsScaleWidget();
explicit QgsScaleWidget( QWidget *parent /TransferThis/ = 0 );
//! 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
void setShowCurrentScaleButton( bool showCurrentScaleButton );
%Docstring
.. note::
the map canvas must be defined to show the button
%End
bool showCurrentScaleButton();
%Docstring
:rtype: bool
%End
//! set the map canvas associated to the current button
void setMapCanvas( QgsMapCanvas* canvas );
void setMapCanvas( QgsMapCanvas *canvas );
%Docstring
set the map canvas associated to the current button
%End
//! Function to read the selected scale as text
QString scaleString();
//! Function to set the selected scale from text
bool setScaleString( const QString& scaleTxt );
//! Function to read the selected scale as double
%Docstring
Function to read the selected scale as text
:rtype: str
%End
bool setScaleString( const QString &scaleTxt );
%Docstring
Function to set the selected scale from text
:rtype: bool
%End
double scale() const;
//! Function to set the selected scale from double
%Docstring
Function to read the selected scale as double
:rtype: float
%End
void setScale( double scale );
//! Function to read the min scale
%Docstring
Function to set the selected scale from double
%End
double minScale() const;
%Docstring
Function to read the min scale
:rtype: float
%End
//! Helper function to convert a double to scale string
// Performs rounding, so an exact representation is not to
// be expected.
static QString toString( double scale );
//! Helper function to convert a scale string to double
static double toDouble( const QString& scaleString, bool *ok = 0 );
%Docstring
be expected.
:rtype: str
%End
static double toDouble( const QString &scaleString, bool *ok = 0 );
%Docstring
Helper function to convert a scale string to double
:rtype: float
%End
public slots:
void updateScales( const QStringList &scales = QStringList() );
//! assign the current scale from the map canvas
void setScaleFromCanvas();
%Docstring
assign the current scale from the map canvas
%End
//! Function to set the min scale
void setMinScale( double scale );
%Docstring
Function to set the min scale
%End
signals:
//! Signal is emitted when *user* has finished editing/selecting a new scale.
void scaleChanged( double scale );
%Docstring
Signal is emitted when *user* has finished editing/selecting a new scale.
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsscalewidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -22,6 +22,7 @@
#include "qgsscalecombobox.h"
#include "qgis_gui.h"
#include "qgis.h"
class QgsMapCanvas;
@ -37,7 +38,7 @@ class GUI_EXPORT QgsScaleWidget : public QWidget
Q_PROPERTY( bool minScale READ minScale WRITE setMinScale )
public:
explicit QgsScaleWidget( QWidget *parent = nullptr );
explicit QgsScaleWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
//! 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