PartDesign: Replaced QuantitySpinBox by SpinBox for "occurrences" input field.

This commit is contained in:
Eivind Kvedalen
2015-09-28 22:05:39 +02:00
committed by wmayer
parent 185a0916ef
commit 56c95964b8
9 changed files with 50 additions and 38 deletions

View File

@@ -28,8 +28,6 @@
# include <QTimer>
#endif
#include <boost/math/special_functions/round.hpp>
#include "ui_TaskLinearPatternParameters.h"
#include "TaskLinearPatternParameters.h"
#include "TaskMultiTransformParameters.h"
@@ -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)));
@@ -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();
@@ -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;
@@ -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();
@@ -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)
@@ -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();
}