diff --git a/src/app/dialogs/tools/dialogdetail.cpp b/src/app/dialogs/tools/dialogdetail.cpp index 452419a4e..f4e210540 100644 --- a/src/app/dialogs/tools/dialogdetail.cpp +++ b/src/app/dialogs/tools/dialogdetail.cpp @@ -34,6 +34,7 @@ #include "../../geometry/vpointf.h" #include "../../geometry/vsplinepath.h" #include "../../container/vcontainer.h" +#include "../../xml/vdomdocument.h" //--------------------------------------------------------------------------------------------------------------------- /** @@ -46,6 +47,9 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent) { ui.setupUi(this); labelEditNamePoint = ui.labelEditNameDetail; + ui.labelUnit->setText( VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + ui.labelUnitX->setText(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); + ui.labelUnitY->setText(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); bOk = ui.buttonBox->button(QDialogButtonBox::Ok); SCASSERT(bOk != nullptr); @@ -61,9 +65,9 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent) CheckState(); connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogDetail::ObjectChanged); - connect(ui.spinBoxBiasX, static_cast(&QSpinBox::valueChanged), + connect(ui.doubleSpinBoxBiasX, static_cast(&QDoubleSpinBox::valueChanged), this, &DialogDetail::BiasXChanged); - connect(ui.spinBoxBiasY, static_cast(&QSpinBox::valueChanged), + connect(ui.doubleSpinBoxBiasY, static_cast(&QDoubleSpinBox::valueChanged), this, &DialogDetail::BiasYChanged); connect(ui.checkBoxSeams, &QCheckBox::clicked, this, &DialogDetail::ClickedSeams); connect(ui.checkBoxClosed, &QCheckBox::clicked, this, &DialogDetail::ClickedClosed); @@ -119,7 +123,7 @@ void DialogDetail::DialogAccepted() QListWidgetItem *item = ui.listWidget->item(i); details.append( qvariant_cast(item->data(Qt::UserRole))); } - details.setWidth(ui.spinBoxSeams->value()); + details.setWidth(ui.doubleSpinBoxSeams->value()); details.setName(ui.lineEditNameDetail->text()); details.setSeamAllowance(supplement); details.setClosed(closed); @@ -198,15 +202,15 @@ void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &t item->setData(Qt::UserRole, QVariant::fromValue(node)); ui.listWidget->addItem(item); ui.listWidget->setCurrentRow(ui.listWidget->count()-1); - disconnect(ui.spinBoxBiasX, static_cast(&QSpinBox::valueChanged), + disconnect(ui.doubleSpinBoxBiasX, static_cast(&QDoubleSpinBox::valueChanged), this, &DialogDetail::BiasXChanged); - disconnect(ui.spinBoxBiasY, static_cast(&QSpinBox::valueChanged), + disconnect(ui.doubleSpinBoxBiasY, static_cast(&QDoubleSpinBox::valueChanged), this, &DialogDetail::BiasYChanged); - ui.spinBoxBiasX->setValue(static_cast(qApp->fromPixel(node.getMx()))); - ui.spinBoxBiasY->setValue(static_cast(qApp->fromPixel(node.getMy()))); - connect(ui.spinBoxBiasX, static_cast(&QSpinBox::valueChanged), + ui.doubleSpinBoxBiasX->setValue(qApp->fromPixel(node.getMx())); + ui.doubleSpinBoxBiasY->setValue(qApp->fromPixel(node.getMy())); + connect(ui.doubleSpinBoxBiasX, static_cast(&QDoubleSpinBox::valueChanged), this, &DialogDetail::BiasXChanged); - connect(ui.spinBoxBiasY, static_cast(&QSpinBox::valueChanged), + connect(ui.doubleSpinBoxBiasY, static_cast(&QDoubleSpinBox::valueChanged), this, &DialogDetail::BiasYChanged); } @@ -229,7 +233,7 @@ void DialogDetail::setDetails(const VDetail &value) ui.checkBoxClosed->setChecked(details.getClosed()); ClickedClosed(details.getClosed()); ClickedSeams(details.getSeamAllowance()); - ui.spinBoxSeams->setValue(static_cast(details.getWidth())); + ui.doubleSpinBoxSeams->setValue(details.getWidth()); ui.listWidget->setCurrentRow(0); ui.listWidget->setFocus(Qt::OtherFocusReason); ui.toolButtonDelete->setEnabled(true); @@ -274,7 +278,7 @@ void DialogDetail::ClickedSeams(bool checked) { supplement = checked; ui.checkBoxClosed->setEnabled(checked); - ui.spinBoxSeams->setEnabled(checked); + ui.doubleSpinBoxSeams->setEnabled(checked); } //--------------------------------------------------------------------------------------------------------------------- @@ -300,8 +304,8 @@ void DialogDetail::ObjectChanged(int row) } QListWidgetItem *item = ui.listWidget->item( row ); VNodeDetail node = qvariant_cast(item->data(Qt::UserRole)); - ui.spinBoxBiasX->setValue(static_cast(qApp->fromPixel(node.getMx()))); - ui.spinBoxBiasY->setValue(static_cast(qApp->fromPixel(node.getMy()))); + ui.doubleSpinBoxBiasX->setValue(qApp->fromPixel(node.getMx())); + ui.doubleSpinBoxBiasY->setValue(qApp->fromPixel(node.getMy())); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/dialogs/tools/dialogdetail.ui b/src/app/dialogs/tools/dialogdetail.ui index 9140a148c..959c21672 100644 --- a/src/app/dialogs/tools/dialogdetail.ui +++ b/src/app/dialogs/tools/dialogdetail.ui @@ -41,18 +41,37 @@ + + + 1 + 0 + + Bias X - - - -3000 + + + + 1 + 0 + - 3000 + 900.990000000000009 + + + 0.100000000000000 + + + + + + + cm @@ -64,7 +83,7 @@ - 0 + 1 0 @@ -74,12 +93,25 @@ - - - -3000 + + + + 1 + 0 + - 3000 + 900.990000000000009 + + + 0.100000000000000 + + + + + + + cm @@ -177,7 +209,7 @@ - 0 + 1 0 @@ -190,9 +222,31 @@ - + + + + 1 + 0 + + - 3000 + 900.990000000000009 + + + 0.100000000000000 + + + + + + + + 0 + 0 + + + + cm diff --git a/src/app/geometry/vdetail.cpp b/src/app/geometry/vdetail.cpp index ff0c703ca..6af182008 100644 --- a/src/app/geometry/vdetail.cpp +++ b/src/app/geometry/vdetail.cpp @@ -33,13 +33,13 @@ //--------------------------------------------------------------------------------------------------------------------- VDetail::VDetail() :_id(0), nodes(QVector()), name(QString()), mx(0), my(0), seamAllowance(true), closed(true), - width(10) + width(0) {} //--------------------------------------------------------------------------------------------------------------------- VDetail::VDetail(const QString &name, const QVector &nodes) :_id(0), nodes(QVector()), name(name), mx(0), my(0), seamAllowance(true), closed(true), - width(10) + width(0) { this->nodes = nodes; } @@ -73,7 +73,7 @@ void VDetail::Clear() my = 0; seamAllowance = true; closed = true; - width = 10; + width = 0; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/geometry/vequidistant.cpp b/src/app/geometry/vequidistant.cpp index 2f0be784c..cab6b2223 100644 --- a/src/app/geometry/vequidistant.cpp +++ b/src/app/geometry/vequidistant.cpp @@ -271,6 +271,11 @@ QPainterPath VEquidistant::Equidistant(QVector points, const Equidistan qDebug()<<"Not enough points for building the equidistant.\n"; return ekv; } + if (width <= 0) + { + qDebug()<<"Width <= 0.\n"; + return ekv; + } for (qint32 i = 0; i < points.size(); ++i ) { if (i != points.size()-1)