Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add Qgs(Double)SpinBox to SIP
  • Loading branch information
3nids committed Sep 25, 2014
1 parent 4c39896 commit 48cdd74
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 6 deletions.
21 changes: 21 additions & 0 deletions python/gui/editorwidgets/qgsdoublespinbox.sip
@@ -0,0 +1,21 @@
class QgsDoubleSpinBox : QDoubleSpinBox
{
%TypeHeaderCode
#include <qgsdoublespinbox.h>
%End

public:
explicit QgsDoubleSpinBox( QWidget *parent /TransferThis/ = 0 );

//! determines if the widget will show a clear button
//! @note the clear button will set the widget to its minimum value
void setShowClearButton( const bool showClearButton );
bool showClearButton() const;

//! Set the current value to the minimum
virtual void clear();

protected:
virtual void resizeEvent( QResizeEvent* event );
virtual void changeEvent( QEvent* event );
};
21 changes: 21 additions & 0 deletions python/gui/editorwidgets/qgsspinbox.sip
@@ -0,0 +1,21 @@
class QgsSpinBox : QSpinBox
{
%TypeHeaderCode
#include <qgsspinbox.h>
%End

public:
explicit QgsSpinBox( QWidget *parent /TransferThis/ = 0 );

//! determines if the widget will show a clear button
//! @note the clear button will set the widget to its minimum value
void setShowClearButton( const bool showClearButton );
bool showClearButton() const;

//! Set the current value to the minimum
virtual void clear();

protected:
virtual void resizeEvent( QResizeEvent* event );
virtual void changeEvent( QEvent* event );
};
2 changes: 2 additions & 0 deletions python/gui/gui.sip
Expand Up @@ -175,7 +175,9 @@
%Include editorwidgets/core/qgseditorwidgetfactory.sip
%Include editorwidgets/core/qgseditorwidgetregistry.sip
%Include editorwidgets/core/qgseditorwidgetwrapper.sip
%Include editorwidgets/qgsdoublespinbox.sip
%Include editorwidgets/qgsrelationreferencewidget.sip
%Include editorwidgets/qgsrelationreferencewidgetwrapper.sip
%Include editorwidgets/qgsspinbox.sip

%Include layertree/qgslayertreeview.sip
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsdoublespinbox.cpp
Expand Up @@ -43,7 +43,7 @@ QgsDoubleSpinBox::QgsDoubleSpinBox( QWidget *parent )
connect( this, SIGNAL( valueChanged( double ) ), this, SLOT( changed( double ) ) );
}

void QgsDoubleSpinBox::setShowClearButton( bool showClearButton )
void QgsDoubleSpinBox::setShowClearButton( const bool showClearButton )
{
mShowClearButton = showClearButton;
mClearButton->setVisible( mShowClearButton && isEnabled() && value() != minimum() );
Expand Down
3 changes: 1 addition & 2 deletions src/gui/editorwidgets/qgsdoublespinbox.h
Expand Up @@ -32,7 +32,7 @@ class GUI_EXPORT QgsDoubleSpinBox : public QDoubleSpinBox

//! determines if the widget will show a clear button
//! @note the clear button will set the widget to its minimum value
void setShowClearButton( bool showClearButton );
void setShowClearButton( const bool showClearButton );
bool showClearButton() const {return mShowClearButton;}

//! Set the current value to the minimum
Expand All @@ -46,7 +46,6 @@ class GUI_EXPORT QgsDoubleSpinBox : public QDoubleSpinBox
void changed( const double &value );

private:
int spinButtonWidth() const;
int frameWidth() const;

bool mShowClearButton;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsspinbox.cpp
Expand Up @@ -43,7 +43,7 @@ QgsSpinBox::QgsSpinBox( QWidget *parent )
connect( this, SIGNAL( valueChanged( int ) ), this, SLOT( changed( int ) ) );
}

void QgsSpinBox::setShowClearButton( bool showClearButton )
void QgsSpinBox::setShowClearButton( const bool showClearButton )
{
mShowClearButton = showClearButton;
mClearButton->setVisible( mShowClearButton && isEnabled() && value() != minimum() );
Expand Down
3 changes: 1 addition & 2 deletions src/gui/editorwidgets/qgsspinbox.h
Expand Up @@ -32,7 +32,7 @@ class GUI_EXPORT QgsSpinBox : public QSpinBox

//! determines if the widget will show a clear button
//! @note the clear button will set the widget to its minimum value
void setShowClearButton( bool showClearButton );
void setShowClearButton( const bool showClearButton );
bool showClearButton() const {return mShowClearButton;}

//! Set the current value to the minimum
Expand All @@ -46,7 +46,6 @@ class GUI_EXPORT QgsSpinBox : public QSpinBox
void changed( const int& value );

private:
int spinButtonWidth() const;
int frameWidth() const;

bool mShowClearButton;
Expand Down

0 comments on commit 48cdd74

Please sign in to comment.