Skip to content

Commit

Permalink
sipify QgsScaleWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Apr 20, 2017
1 parent dd6c7fd commit 3660419
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 29 deletions.
1 change: 0 additions & 1 deletion python/auto_sip.blacklist
Expand Up @@ -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
Expand Down
105 changes: 78 additions & 27 deletions python/gui/qgsscalewidget.sip
@@ -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 *
************************************************************************/
3 changes: 2 additions & 1 deletion src/gui/qgsscalewidget.h
Expand Up @@ -22,6 +22,7 @@

#include "qgsscalecombobox.h"
#include "qgis_gui.h"
#include "qgis.h"

class QgsMapCanvas;

Expand All @@ -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
Expand Down

0 comments on commit 3660419

Please sign in to comment.