+ fixes #0001849: Enable Spin Boxes support for Pad, Fillet and Chamfer

This commit is contained in:
wmayer 2014-12-11 18:25:30 +01:00
parent 5665302521
commit 7801fbef3a
9 changed files with 27 additions and 28 deletions

View File

@ -519,13 +519,15 @@ void PrefQuantitySpinBox::contextMenuEvent(QContextMenuEvent *event)
// look what the user has choosen
if (saveAction == saveValueAction) {
pushToSavedValues();
pushToSavedValues(this->text());
}
else {
int i=0;
for (std::vector<QAction *>::const_iterator it = actions.begin();it!=actions.end();++it,i++) {
if (*it == saveAction)
if (*it == saveAction) {
lineEdit()->setText(values[i]);
break;
}
}
}
@ -595,10 +597,7 @@ void PrefQuantitySpinBox::pushToSavedValues(const QString &valueq)
{
Q_D(PrefQuantitySpinBox);
std::string value;
if (valueq.isEmpty())
value = this->text().toUtf8().constData();
else
value = valueq.toUtf8().constData();
value = valueq.toUtf8().constData();
if (d->handle.isValid()) {
for (int i = d->saveSize -1 ; i>=0 ;i--) {

View File

@ -304,11 +304,11 @@ public:
/// set the param group path where the widget writes and reads the default values
void setParamGrpPath(const QByteArray& name);
/// push a new value to the history, if no string given the actual text of the input field is used.
void pushToHistory(const QString &value = QString());
void pushToHistory(const QString& value = QString());
/// get the history of the field, newest first
std::vector<QString> getHistory() const;
/// push a new value to the history, if no string given the actual text of the input field is used.
void pushToSavedValues(const QString &value = QString());
void pushToSavedValues(const QString& value);
/// get the history of the field, newest first
std::vector<QString> getSavedValues() const;
//@}
@ -317,7 +317,7 @@ protected:
virtual void contextMenuEvent(QContextMenuEvent * event);
private:
PrefQuantitySpinBoxPrivate * const d_ptr;
QScopedPointer<PrefQuantitySpinBoxPrivate> d_ptr;
Q_DISABLE_COPY(PrefQuantitySpinBox)
Q_DECLARE_PRIVATE(PrefQuantitySpinBox)
};

View File

@ -128,7 +128,7 @@ Q_SIGNALS:
void parseError(const QString& errorText);
private:
QuantitySpinBoxPrivate * const d_ptr;
QScopedPointer<QuantitySpinBoxPrivate> d_ptr;
Q_DISABLE_COPY(QuantitySpinBox)
Q_DECLARE_PRIVATE(QuantitySpinBox)
};

View File

@ -287,7 +287,7 @@ void TaskPadParameters::onModeChanged(int index)
case 0:
pcPad->Type.setValue("Length");
// Avoid error message
if (ui->lengthEdit->getQuantity().getValue() < Precision::Confusion())
if (ui->lengthEdit->value().getValue() < Precision::Confusion())
ui->lengthEdit->setValue(5.0);
break;
case 1: pcPad->Type.setValue("UpToLast"); break;
@ -371,7 +371,7 @@ void TaskPadParameters::onUpdateView(bool on)
double TaskPadParameters::getLength(void) const
{
return ui->lengthEdit->getQuantity().getValue();
return ui->lengthEdit->value().getValue();
}
bool TaskPadParameters::getReversed(void) const
@ -386,7 +386,7 @@ bool TaskPadParameters::getMidplane(void) const
double TaskPadParameters::getLength2(void) const
{
return ui->lengthEdit2->getQuantity().getValue();
return ui->lengthEdit2->value().getValue();
}
int TaskPadParameters::getMode(void) const

View File

@ -44,7 +44,7 @@
</widget>
</item>
<item>
<widget class="Gui::InputField" name="lengthEdit">
<widget class="Gui::PrefQuantitySpinBox" name="lengthEdit">
<property name="minimum">
<double>0.000000000000000</double>
</property>
@ -88,7 +88,7 @@
</widget>
</item>
<item>
<widget class="Gui::InputField" name="lengthEdit2">
<widget class="Gui::PrefQuantitySpinBox" name="lengthEdit2">
<property name="minimum">
<double>0.000000000000000</double>
</property>
@ -141,9 +141,9 @@
<resources/>
<customwidgets>
<customwidget>
<class>Gui::InputField</class>
<extends>QLineEdit</extends>
<header>Gui/InputField.h</header>
<class>Gui::PrefQuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<connections/>

View File

@ -1578,7 +1578,7 @@ void CmdSketcherConstrainRadius::activated(int iMsg)
ui_Datum.labelEdit->selectNumber();
if (dlg.exec() == QDialog::Accepted) {
Base::Quantity newQuant = ui_Datum.labelEdit->getQuantity();
Base::Quantity newQuant = ui_Datum.labelEdit->value();
double newRadius = newQuant.getValue();
try {

View File

@ -130,7 +130,7 @@ void EditDatumDialog::exec(bool atCursor)
dlg.setGeometry(QCursor::pos().x() - dlg.geometry().width() / 2, QCursor::pos().y(), dlg.geometry().width(), dlg.geometry().height());
if (dlg.exec()) {
Base::Quantity newQuant = ui_ins_datum.labelEdit->getQuantity();
Base::Quantity newQuant = ui_ins_datum.labelEdit->value();
if (newQuant.isQuantity()) {
// save the value for the history
ui_ins_datum.labelEdit->pushToHistory();

View File

@ -27,7 +27,7 @@
</widget>
</item>
<item>
<widget class="Gui::InputField" name="labelEdit"/>
<widget class="Gui::PrefQuantitySpinBox" name="labelEdit"/>
</item>
</layout>
</item>
@ -46,9 +46,9 @@
<resources/>
<customwidgets>
<customwidget>
<class>Gui::InputField</class>
<extends>QLineEdit</extends>
<header>Gui/InputField.h</header>
<class>Gui::PrefQuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>

View File

@ -34,7 +34,7 @@
</widget>
</item>
<item>
<widget class="Gui::InputField" name="gridSize">
<widget class="Gui::PrefQuantitySpinBox" name="gridSize">
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
@ -85,9 +85,9 @@
<resources/>
<customwidgets>
<customwidget>
<class>Gui::InputField</class>
<extends>QLineEdit</extends>
<header>Gui/InputField.h</header>
<class>Gui::PrefQuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>