PartDesign: Replaced QuantitySpinBox by SpinBox for "occurrences" input field.
This commit is contained in:
parent
cbb4c52310
commit
9a0c58986f
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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>
|
||||
|
@ -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/>
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
# include <QTimer>
|
||||
#endif
|
||||
|
||||
#include <boost/math/special_functions/round.hpp>
|
||||
|
||||
#include "ui_TaskPolarPatternParameters.h"
|
||||
#include "TaskPolarPatternParameters.h"
|
||||
#include "TaskMultiTransformParameters.h"
|
||||
|
@ -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)));
|
||||
|
||||
|
@ -141,7 +139,7 @@ void TaskPolarPatternParameters::setupUI()
|
|||
|
||||
void TaskPolarPatternParameters::updateUI()
|
||||
{
|
||||
if (blockUpdate)
|
||||
if (blockUpdate)
|
||||
return;
|
||||
blockUpdate = true;
|
||||
|
||||
|
@ -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?
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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>
|
||||
|
@ -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/>
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
# include <QMessageBox>
|
||||
#endif
|
||||
|
||||
#include <boost/math/special_functions/round.hpp>
|
||||
|
||||
#include "ui_TaskScaledParameters.h"
|
||||
#include "TaskScaledParameters.h"
|
||||
#include "TaskMultiTransformParameters.h"
|
||||
|
@ -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)));
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
|
||||
private Q_SLOTS:
|
||||
void onFactor(const double f);
|
||||
void onOccurrences(const double n);
|
||||
void onOccurrences(const uint n);
|
||||
virtual void onUpdateView(bool);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -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>
|
||||
|
@ -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/>
|
||||
|
|
Loading…
Reference in New Issue
Block a user