Requests for QgsMapToolAddRegularPolygon

This commit is contained in:
lbartoletti 2017-10-09 13:01:49 +02:00
parent 8ea5fe7d05
commit d72eebd2ce
2 changed files with 3 additions and 3 deletions

View File

@ -22,6 +22,7 @@
#include "qgspoint.h" #include "qgspoint.h"
#include "qgisapp.h" #include "qgisapp.h"
#include "qgsstatusbar.h" #include "qgsstatusbar.h"
#include "qgsspinbox.h"
QgsMapToolAddRegularPolygon::QgsMapToolAddRegularPolygon( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode ) QgsMapToolAddRegularPolygon::QgsMapToolAddRegularPolygon( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode )
: QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), mode ) : QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), mode )
@ -38,7 +39,7 @@ QgsMapToolAddRegularPolygon::~QgsMapToolAddRegularPolygon()
void QgsMapToolAddRegularPolygon::createNumberSidesSpinBox() void QgsMapToolAddRegularPolygon::createNumberSidesSpinBox()
{ {
deleteNumberSidesSpinBox(); deleteNumberSidesSpinBox();
mNumberSidesSpinBox = std::unique_ptr<QSpinBox>( new QSpinBox() ); mNumberSidesSpinBox = std::unique_ptr<QgsSpinBox>( new QgsSpinBox() );
mNumberSidesSpinBox->setMaximum( 99999999 ); mNumberSidesSpinBox->setMaximum( 99999999 );
mNumberSidesSpinBox->setMinimum( 3 ); mNumberSidesSpinBox->setMinimum( 3 );
mNumberSidesSpinBox->setPrefix( tr( "Number of sides: " ) ); mNumberSidesSpinBox->setPrefix( tr( "Number of sides: " ) );
@ -51,7 +52,6 @@ void QgsMapToolAddRegularPolygon::deleteNumberSidesSpinBox()
{ {
if ( mNumberSidesSpinBox ) if ( mNumberSidesSpinBox )
{ {
QgisApp::instance()->statusBarIface()->removeWidget( mNumberSidesSpinBox.get() );
mNumberSidesSpinBox.reset( nullptr ); mNumberSidesSpinBox.reset( nullptr );
} }
} }

View File

@ -41,7 +41,7 @@ class QgsMapToolAddRegularPolygon: public QgsMapToolCapture
explicit QgsMapToolAddRegularPolygon( QgsMapCanvas *canvas ) = delete; //forbidden explicit QgsMapToolAddRegularPolygon( QgsMapCanvas *canvas ) = delete; //forbidden
std::unique_ptr<QSpinBox> mNumberSidesSpinBox; std::unique_ptr<QSpinBox> mNumberSidesSpinBox;
int mNumberSides; int mNumberSides = 6;
//! (re-)create the spin box to enter the number of sides //! (re-)create the spin box to enter the number of sides
void createNumberSidesSpinBox(); void createNumberSidesSpinBox();