Skip to content

Commit

Permalink
sipify QgsScaleCombobox
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry authored and 3nids committed Apr 30, 2017
1 parent 80c8875 commit e4d2f34
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 23 deletions.
1 change: 0 additions & 1 deletion python/auto_sip.blacklist
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ gui/qgsrasterlayersaveasdialog.sip
gui/qgsrasterpyramidsoptionswidget.sip
gui/qgsrelationeditorwidget.sip
gui/qgsrubberband.sip
gui/qgsscalecombobox.sip
gui/qgsscalerangewidget.sip
gui/qgsscalevisibilitydialog.sip
gui/qgsscrollarea.sip
Expand Down
87 changes: 66 additions & 21 deletions python/gui/qgsscalecombobox.sip
Original file line number Diff line number Diff line change
@@ -1,45 +1,90 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsscalecombobox.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




/** A combobox which lets the user select map scale from predefined list
* and highlights nearest to current scale value
*/
class QgsScaleComboBox : QComboBox
{
%TypeHeaderCode
#include <qgsscalecombobox.h>
%Docstring
A combobox which lets the user select map scale from predefined list
and highlights nearest to current scale value
*
%End

%TypeHeaderCode
#include "qgsscalecombobox.h"
%End
public:
QgsScaleComboBox( QWidget* parent /TransferThis/ = 0 );
~QgsScaleComboBox();
QgsScaleComboBox( QWidget *parent /TransferThis/ = 0 );

//! 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
: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

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

public slots:
void updateScales( const QStringList &scales = QStringList() );
//! Function to set the min scale

void setMinScale( double scale );
%Docstring
Set the minimum allowed scale.
Anything scale lower than the minimum scale will automatically
be converted to the minimum scale.
Except for 0 which is always allowed.
%End

protected:
void showPopup();
virtual void showPopup();


};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsscalecombobox.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
3 changes: 2 additions & 1 deletion src/gui/qgsscalecombobox.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define QGSSCALECOMBOBOX_H

#include <QComboBox>
#include "qgis.h";
#include "qgis_gui.h"

/** \ingroup gui
Expand All @@ -29,7 +30,7 @@ class GUI_EXPORT QgsScaleComboBox : public QComboBox
{
Q_OBJECT
public:
QgsScaleComboBox( QWidget *parent = nullptr );
QgsScaleComboBox( QWidget *parent SIP_TRANSFERTHIS = nullptr );

//! Function to read the selected scale as text
QString scaleString();
Expand Down

0 comments on commit e4d2f34

Please sign in to comment.