From 2cac4898d7d62276fbbaaef5b4cecb9bfdd29a33 Mon Sep 17 00:00:00 2001 From: donovaly Date: Sat, 28 Mar 2020 03:48:53 +0100 Subject: [PATCH] [TD] sanitize TaskCosVertex - add missing unit (therefore switch to Gui::QuantitySpinBox) - remove unused and confusing z-parameter --- src/Mod/TechDraw/Gui/TaskCosVertex.cpp | 13 +- src/Mod/TechDraw/Gui/TaskCosVertex.ui | 337 +++++++++++-------------- 2 files changed, 158 insertions(+), 192 deletions(-) diff --git a/src/Mod/TechDraw/Gui/TaskCosVertex.cpp b/src/Mod/TechDraw/Gui/TaskCosVertex.cpp index bd802d99f6..09a7f548ff 100644 --- a/src/Mod/TechDraw/Gui/TaskCosVertex.cpp +++ b/src/Mod/TechDraw/Gui/TaskCosVertex.cpp @@ -134,21 +134,19 @@ void TaskCosVertex::setUiPrimary() ui->pbTracker->setEnabled(true); ui->dsbX->setEnabled(true); ui->dsbY->setEnabled(true); - ui->dsbZ->setEnabled(false); int decimals = Base::UnitsApi::getDecimals(); ui->dsbX->setDecimals(decimals); ui->dsbY->setDecimals(decimals); - ui->dsbZ->setDecimals(decimals); + ui->dsbX->setUnit(Base::Unit::Length); + ui->dsbY->setUnit(Base::Unit::Length); } void TaskCosVertex::updateUi(void) { double x = m_savePoint.x(); double y = - m_savePoint.y(); - double z = 0.0; ui->dsbX->setValue(x); ui->dsbY->setValue(y); - ui->dsbZ->setValue(z); } void TaskCosVertex::addCosVertex(QPointF qPos) @@ -297,8 +295,6 @@ void TaskCosVertex::enableTaskButtons(bool b) //****************************************************************************** bool TaskCosVertex::accept() { -// Base::Console().Message("TCV::accept()\n"); - Gui::Document* doc = Gui::Application::Instance->getDocument(m_basePage->getDocument()); if (!doc) return false; @@ -306,9 +302,8 @@ bool TaskCosVertex::accept() if (pointFromTracker) { addCosVertex(m_savePoint); } else { - double x = ui->dsbX->value(); - double y = ui->dsbY->value(); -// double z = ui->dsbZ->value(); + double x = ui->dsbX->value().getValue(); + double y = ui->dsbY->value().getValue(); QPointF uiPoint(x,-y); addCosVertex(uiPoint); } diff --git a/src/Mod/TechDraw/Gui/TaskCosVertex.ui b/src/Mod/TechDraw/Gui/TaskCosVertex.ui index 595fd26d27..c1518ebbec 100644 --- a/src/Mod/TechDraw/Gui/TaskCosVertex.ui +++ b/src/Mod/TechDraw/Gui/TaskCosVertex.ui @@ -6,8 +6,8 @@ 0 0 - 409 - 405 + 400 + 200 @@ -31,202 +31,173 @@ - - - - 0 - 0 - + + + + + false + + + false + + + Qt::NoFocus + + + false + + + + + + + Base View + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Point Picker + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Horizontal - - - 300 - 300 - + + + + + + Position from the view center - - - 300 - 300 - + + Position - - QFrame::Box - - - QFrame::Raised - - + - - - - - - - false - - - false - - - Qt::NoFocus - - - false - - - - - - - Base View - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Point Picker - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Horizontal + + + + + X - - - - - - X - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Z - - - - - - - Y - - - - - - - 4 - - - -2147483647.000000000000000 - - - 2147483647.000000000000000 - - - - - - - 4 - - - -2147483647.000000000000000 - - - 2147483647.000000000000000 - - - - - - - 4 - - - -2147483647.000000000000000 - - - 2147483647.000000000000000 - - - - + + + + Qt::Horizontal + + + + 28 + 20 + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + 4 + + + + + + + Y + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + 4 + + - - - - Qt::Vertical - - - - 20 - 40 - - - - + + + + Qt::Vertical + + + + 17 + 24 + + + + + + + Gui::QuantitySpinBox + QWidget +
Gui/QuantitySpinBox.h
+
+