Skip to content

Commit

Permalink
PartDesign: Replaced QuantitySpinBox by SpinBox for "occurrences" inp…
Browse files Browse the repository at this point in the history
…ut field.
  • Loading branch information
eivindkv authored and wwmayer committed Sep 30, 2015
1 parent cbb4c52 commit 9a0c589
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 38 deletions.
22 changes: 10 additions & 12 deletions src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp
Expand Up @@ -28,8 +28,6 @@
# include <QTimer>
#endif

#include <boost/math/special_functions/round.hpp>

#include "ui_TaskLinearPatternParameters.h"
#include "TaskLinearPatternParameters.h"
#include "TaskMultiTransformParameters.h"
Expand Down Expand Up @@ -109,8 +107,8 @@ void TaskLinearPatternParameters::setupUI()
this, SLOT(onCheckReverse(bool)));
connect(ui->spinLength, SIGNAL(valueChanged(double)),
this, SLOT(onLength(double)));
connect(ui->spinOccurrences, SIGNAL(valueChanged(double)),
this, SLOT(onOccurrences(double)));
connect(ui->spinOccurrences, SIGNAL(valueChanged(uint)),
this, SLOT(onOccurrences(uint)));
connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)),
this, SLOT(onUpdateView(bool)));

Expand Down Expand Up @@ -147,7 +145,7 @@ void TaskLinearPatternParameters::updateUI()
if (blockUpdate)
return;
blockUpdate = true;


PartDesign::LinearPattern* pcLinearPattern = static_cast<PartDesign::LinearPattern*>(getObject());

App::DocumentObject* directionFeature = pcLinearPattern->Direction.getValue();
Expand Down Expand Up @@ -180,7 +178,7 @@ void TaskLinearPatternParameters::updateUI()
undefined = true;
} else if (directionFeature != NULL && !directions.empty()) {
ui->comboDirection->addItem(QString::fromAscii(directions.front().c_str()));
ui->comboDirection->setCurrentIndex(maxcount);
ui->comboDirection->setCurrentIndex(maxcount);
}
} else {
undefined = true;
Expand Down Expand Up @@ -276,11 +274,11 @@ void TaskLinearPatternParameters::onLength(const double l) {
kickUpdateViewTimer();
}

void TaskLinearPatternParameters::onOccurrences(const double n) {
void TaskLinearPatternParameters::onOccurrences(const uint n) {
if (blockUpdate)
return;
PartDesign::LinearPattern* pcLinearPattern = static_cast<PartDesign::LinearPattern*>(getObject());
pcLinearPattern->Occurrences.setValue(boost::math::round(n));
pcLinearPattern->Occurrences.setValue(n);

exitSelectionMode();
kickUpdateViewTimer();
Expand Down Expand Up @@ -350,7 +348,7 @@ void TaskLinearPatternParameters::onUpdateView(bool on)
}

const std::string TaskLinearPatternParameters::getDirection(void) const
{
{
App::DocumentObject* pcSketch = getSketchObject();
int maxcount=2;
if (pcSketch)
Expand All @@ -370,19 +368,19 @@ const std::string TaskLinearPatternParameters::getDirection(void) const
return std::string("");
}

const bool TaskLinearPatternParameters::getReverse(void) const
const bool TaskLinearPatternParameters::getReverse(void) const
{
return ui->checkReverse->isChecked();
}

const double TaskLinearPatternParameters::getLength(void) const
const double TaskLinearPatternParameters::getLength(void) const
{
return ui->spinLength->value().getValue();
}

const unsigned TaskLinearPatternParameters::getOccurrences(void) const
{
return boost::math::round(ui->spinOccurrences->value().getValue());
return ui->spinOccurrences->value();
}


Expand Down
2 changes: 1 addition & 1 deletion src/Mod/PartDesign/Gui/TaskLinearPatternParameters.h
Expand Up @@ -64,7 +64,7 @@ private Q_SLOTS:
void onDirectionChanged(int num);
void onCheckReverse(const bool on);
void onLength(const double l);
void onOccurrences(const double n);
void onOccurrences(const uint n);
virtual void onUpdateView(bool);

protected:
Expand Down
8 changes: 7 additions & 1 deletion src/Mod/PartDesign/Gui/TaskLinearPatternParameters.ui
Expand Up @@ -96,7 +96,7 @@
</widget>
</item>
<item>
<widget class="Gui::QuantitySpinBox" name="spinOccurrences" native="true"/>
<widget class="Gui::UIntSpinBox" name="spinOccurrences" native="true"/>
</item>
</layout>
</item>
Expand Down Expand Up @@ -142,6 +142,12 @@
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::UIntSpinBox</class>
<extends>QWidget</extends>
<header location="global">Gui/SpinBox.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
Expand Down
24 changes: 11 additions & 13 deletions src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp
Expand Up @@ -28,8 +28,6 @@
# include <QTimer>
#endif

#include <boost/math/special_functions/round.hpp>

#include "ui_TaskPolarPatternParameters.h"
#include "TaskPolarPatternParameters.h"
#include "TaskMultiTransformParameters.h"
Expand Down Expand Up @@ -109,8 +107,8 @@ void TaskPolarPatternParameters::setupUI()
this, SLOT(onCheckReverse(bool)));
connect(ui->polarAngle, SIGNAL(valueChanged(double)),
this, SLOT(onAngle(double)));
connect(ui->spinOccurrences, SIGNAL(valueChanged(double)),
this, SLOT(onOccurrences(double)));
connect(ui->spinOccurrences, SIGNAL(valueChanged(uint)),
this, SLOT(onOccurrences(uint)));
connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)),
this, SLOT(onUpdateView(bool)));

Expand Down Expand Up @@ -141,7 +139,7 @@ void TaskPolarPatternParameters::setupUI()

void TaskPolarPatternParameters::updateUI()
{
if (blockUpdate)
if (blockUpdate)
return;
blockUpdate = true;

Expand All @@ -161,7 +159,7 @@ void TaskPolarPatternParameters::updateUI()
ui->comboAxis->setCurrentIndex(0);
else if (axisFeature != NULL && !axes.empty()) {
ui->comboAxis->addItem(QString::fromAscii(axes.front().c_str()));
ui->comboAxis->setCurrentIndex(1);
ui->comboAxis->setCurrentIndex(1);
}
} else {
// Error message?
Expand Down Expand Up @@ -234,7 +232,7 @@ void TaskPolarPatternParameters::onCheckReverse(const bool on) {
return;
PartDesign::PolarPattern* pcPolarPattern = static_cast<PartDesign::PolarPattern*>(getObject());
pcPolarPattern->Reversed.setValue(on);


exitSelectionMode();
kickUpdateViewTimer();
}
Expand All @@ -244,26 +242,26 @@ void TaskPolarPatternParameters::onAngle(const double a) {
return;
PartDesign::PolarPattern* pcPolarPattern = static_cast<PartDesign::PolarPattern*>(getObject());
pcPolarPattern->Angle.setValue(a);


exitSelectionMode();
kickUpdateViewTimer();
}

void TaskPolarPatternParameters::onOccurrences(const double n) {
void TaskPolarPatternParameters::onOccurrences(const uint n) {
if (blockUpdate)
return;
PartDesign::PolarPattern* pcPolarPattern = static_cast<PartDesign::PolarPattern*>(getObject());
pcPolarPattern->Occurrences.setValue(boost::math::round(n));
pcPolarPattern->Occurrences.setValue(n);

exitSelectionMode();
kickUpdateViewTimer();
}

void TaskPolarPatternParameters::onAxisChanged(int num) {
if (blockUpdate)
if (blockUpdate)
return;
PartDesign::PolarPattern* pcPolarPattern = static_cast<PartDesign::PolarPattern*>(getObject());


if (num == 0) {
pcPolarPattern->Axis.setValue(getSketchObject(), std::vector<std::string>(1,"N_Axis"));
exitSelectionMode();
Expand Down Expand Up @@ -328,7 +326,7 @@ const double TaskPolarPatternParameters::getAngle(void) const

const unsigned TaskPolarPatternParameters::getOccurrences(void) const
{
return boost::math::round(ui->spinOccurrences->value().getValue());
return ui->spinOccurrences->value();
}


Expand Down
2 changes: 1 addition & 1 deletion src/Mod/PartDesign/Gui/TaskPolarPatternParameters.h
Expand Up @@ -63,7 +63,7 @@ private Q_SLOTS:
void onAxisChanged(int num);
void onCheckReverse(const bool on);
void onAngle(const double a);
void onOccurrences(const double n);
void onOccurrences(const uint n);
virtual void onUpdateView(bool);

protected:
Expand Down
8 changes: 7 additions & 1 deletion src/Mod/PartDesign/Gui/TaskPolarPatternParameters.ui
Expand Up @@ -97,7 +97,7 @@
</widget>
</item>
<item>
<widget class="Gui::QuantitySpinBox" name="spinOccurrences" native="true"/>
<widget class="Gui::UIntSpinBox" name="spinOccurrences" native="true"/>
</item>
</layout>
</item>
Expand Down Expand Up @@ -143,6 +143,12 @@
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::UIntSpinBox</class>
<extends>QWidget</extends>
<header location="global">Gui/SpinBox.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
Expand Down
12 changes: 5 additions & 7 deletions src/Mod/PartDesign/Gui/TaskScaledParameters.cpp
Expand Up @@ -27,8 +27,6 @@
# include <QMessageBox>
#endif

#include <boost/math/special_functions/round.hpp>

#include "ui_TaskScaledParameters.h"
#include "TaskScaledParameters.h"
#include "TaskMultiTransformParameters.h"
Expand Down Expand Up @@ -94,8 +92,8 @@ void TaskScaledParameters::setupUI()
{
connect(ui->spinFactor, SIGNAL(valueChanged(double)),
this, SLOT(onFactor(double)));
connect(ui->spinOccurrences, SIGNAL(valueChanged(double)),
this, SLOT(onOccurrences(double)));
connect(ui->spinOccurrences, SIGNAL(valueChanged(uint)),
this, SLOT(onOccurrences(uint)));
connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)),
this, SLOT(onUpdateView(bool)));

Expand Down Expand Up @@ -157,12 +155,12 @@ void TaskScaledParameters::onFactor(const double f)
recomputeFeature();
}

void TaskScaledParameters::onOccurrences(const double n)
void TaskScaledParameters::onOccurrences(const uint n)
{
if (blockUpdate)
return;
PartDesign::Scaled* pcScaled = static_cast<PartDesign::Scaled*>(getObject());
pcScaled->Occurrences.setValue(boost::math::round(n));
pcScaled->Occurrences.setValue(n);
recomputeFeature();
}

Expand All @@ -185,7 +183,7 @@ const double TaskScaledParameters::getFactor(void) const

const unsigned TaskScaledParameters::getOccurrences(void) const
{
return boost::math::round(ui->spinOccurrences->value().getValue());
return ui->spinOccurrences->value();
}

TaskScaledParameters::~TaskScaledParameters()
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/PartDesign/Gui/TaskScaledParameters.h
Expand Up @@ -60,7 +60,7 @@ class TaskScaledParameters : public TaskTransformedParameters

private Q_SLOTS:
void onFactor(const double f);
void onOccurrences(const double n);
void onOccurrences(const uint n);
virtual void onUpdateView(bool);

protected:
Expand Down
8 changes: 7 additions & 1 deletion src/Mod/PartDesign/Gui/TaskScaledParameters.ui
Expand Up @@ -52,7 +52,7 @@
</widget>
</item>
<item>
<widget class="Gui::QuantitySpinBox" name="spinOccurrences" native="true"/>
<widget class="Gui::UIntSpinBox" name="spinOccurrences" native="true"/>
</item>
</layout>
</item>
Expand Down Expand Up @@ -98,6 +98,12 @@
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::UIntSpinBox</class>
<extends>QWidget</extends>
<header location="global">Gui/SpinBox.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
Expand Down

0 comments on commit 9a0c589

Please sign in to comment.