From 12db0b8df4240722802485b2b0fa7f521e80c852 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Fri, 6 Sep 2019 19:59:48 -0400 Subject: [PATCH] [TD]Fix Tracker stays active on Cancel --- src/Mod/TechDraw/Gui/TaskCosVertex.cpp | 27 ++++++---- src/Mod/TechDraw/Gui/TaskCosVertex.ui | 71 +++++++++++++++++--------- 2 files changed, 64 insertions(+), 34 deletions(-) diff --git a/src/Mod/TechDraw/Gui/TaskCosVertex.cpp b/src/Mod/TechDraw/Gui/TaskCosVertex.cpp index 01ed5d86b6..e32778e586 100644 --- a/src/Mod/TechDraw/Gui/TaskCosVertex.cpp +++ b/src/Mod/TechDraw/Gui/TaskCosVertex.cpp @@ -30,6 +30,8 @@ #include #include +#include +#include #include #include @@ -130,9 +132,13 @@ void TaskCosVertex::setUiPrimary() } ui->pbTracker->setText(QString::fromUtf8("Point Picker")); ui->pbTracker->setEnabled(true); - ui->qsbX->setEnabled(true); - ui->qsbY->setEnabled(true); - ui->qsbZ->setEnabled(false); + 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); } void TaskCosVertex::updateUi(void) @@ -140,9 +146,9 @@ void TaskCosVertex::updateUi(void) double x = m_savePoint.x(); double y = - m_savePoint.y(); double z = 0.0; - ui->qsbX->setValue(x); - ui->qsbY->setValue(y); - ui->qsbZ->setValue(z); + ui->dsbX->setValue(x); + ui->dsbY->setValue(y); + ui->dsbZ->setValue(z); } void TaskCosVertex::addCosVertex(QPointF qPos) @@ -300,9 +306,9 @@ bool TaskCosVertex::accept() if (pointFromTracker) { addCosVertex(m_savePoint); } else { - double x = ui->qsbX->rawValue(); - double y = ui->qsbY->rawValue(); -// double z = ui->qsbZ->rawValue(); + double x = ui->dsbX->value(); + double y = ui->dsbY->value(); +// double z = ui->dsbZ->value(); QPointF uiPoint(x,-y); addCosVertex(uiPoint); } @@ -320,10 +326,11 @@ bool TaskCosVertex::reject() Gui::Document* doc = Gui::Application::Instance->getDocument(m_basePage->getDocument()); if (!doc) return false; + removeTracker(); + m_trackerMode = QGTracker::TrackerMode::None; if (m_mdi != nullptr) { m_mdi->setContextMenuPolicy(m_saveContextPolicy); } - m_trackerMode = QGTracker::TrackerMode::None; //make sure any dangling objects are cleaned up Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().recompute()"); diff --git a/src/Mod/TechDraw/Gui/TaskCosVertex.ui b/src/Mod/TechDraw/Gui/TaskCosVertex.ui index 0c7efcae63..9e01e5674f 100644 --- a/src/Mod/TechDraw/Gui/TaskCosVertex.ui +++ b/src/Mod/TechDraw/Gui/TaskCosVertex.ui @@ -38,6 +38,18 @@ 0 + + + 300 + 300 + + + + + 300 + 300 + + QFrame::Box @@ -127,13 +139,6 @@ - - - - - - - @@ -147,13 +152,6 @@ - - - - - - - @@ -168,10 +166,42 @@ + + + + 4 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + 4 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + - - - + + + 4 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 @@ -197,13 +227,6 @@ - - - Gui::QuantitySpinBox - QWidget -
Gui/QuantitySpinBox.h
-
-