add Qgs(Double)SpinBox to SIP

This commit is contained in:
Denis Rouzaud 2014-09-25 15:08:51 +02:00
parent 4c39896e85
commit 48cdd749eb
7 changed files with 48 additions and 6 deletions

View File

@ -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 );
};

View File

@ -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 );
};

View File

@ -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

View File

@ -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() );

View File

@ -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
@ -46,7 +46,6 @@ class GUI_EXPORT QgsDoubleSpinBox : public QDoubleSpinBox
void changed( const double &value );
private:
int spinButtonWidth() const;
int frameWidth() const;
bool mShowClearButton;

View File

@ -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() );

View File

@ -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
@ -46,7 +46,6 @@ class GUI_EXPORT QgsSpinBox : public QSpinBox
void changed( const int& value );
private:
int spinButtonWidth() const;
int frameWidth() const;
bool mShowClearButton;