From 47fda412bbf742c010a0c2d6aaa5420efca3fd09 Mon Sep 17 00:00:00 2001 From: donovaly Date: Sun, 22 Mar 2020 03:46:52 +0100 Subject: [PATCH] [TD] make LeaderLine dialog show changes immediately --- src/Mod/TechDraw/Gui/TaskLeaderLine.cpp | 45 +++++++++++++++++++++++++ src/Mod/TechDraw/Gui/TaskLeaderLine.h | 8 +++++ 2 files changed, 53 insertions(+) diff --git a/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp b/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp index b9164b389642..9aea6e31021c 100644 --- a/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp +++ b/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp @@ -297,8 +297,10 @@ void TaskLeaderLine::setUiEdit() DrawGuiUtil::loadArrowBox(ui->cboxStartSym); ui->cboxStartSym->setCurrentIndex(m_lineFeat->StartSymbol.getValue()); + connect(ui->cboxStartSym, SIGNAL(currentIndexChanged(int)), this, SLOT(onStartSymbolChanged())); DrawGuiUtil::loadArrowBox(ui->cboxEndSym); ui->cboxEndSym->setCurrentIndex(m_lineFeat->EndSymbol.getValue()); + connect(ui->cboxEndSym, SIGNAL(currentIndexChanged(int)), this, SLOT(onEndSymbolChanged())); ui->pbTracker->setText(QString::fromUtf8("Edit points")); if (m_haveMdi) { @@ -315,6 +317,49 @@ void TaskLeaderLine::setUiEdit() ui->dsbWeight->setValue(m_lineVP->LineWidth.getValue()); ui->cboxStyle->setCurrentIndex(m_lineVP->LineStyle.getValue()); } + connect(ui->cpLineColor, SIGNAL(changed()), this, SLOT(onColorChanged())); + ui->dsbWeight->setMinimum(0); + connect(ui->dsbWeight, SIGNAL(valueChanged(double)), this, SLOT(onLineWidthChanged())); + connect(ui->cboxStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(onLineStyleChanged())); +} + +void TaskLeaderLine::recomputeFeature() +{ + App::DocumentObject* objVP = m_lineVP->getObject(); + assert(objVP); + objVP->getDocument()->recomputeFeature(objVP); +} + +void TaskLeaderLine::onStartSymbolChanged() +{ + m_lineFeat->StartSymbol.setValue(ui->cboxStartSym->currentIndex()); + recomputeFeature(); +} + +void TaskLeaderLine::onEndSymbolChanged() +{ + m_lineFeat->EndSymbol.setValue(ui->cboxEndSym->currentIndex()); + recomputeFeature(); +} + +void TaskLeaderLine::onColorChanged() +{ + App::Color ac; + ac.setValue(ui->cpLineColor->color()); + m_lineVP->Color.setValue(ac); + recomputeFeature(); +} + +void TaskLeaderLine::onLineWidthChanged() +{ + m_lineVP->LineWidth.setValue(ui->dsbWeight->rawValue()); + recomputeFeature(); +} + +void TaskLeaderLine::onLineStyleChanged() +{ + m_lineVP->LineStyle.setValue(ui->cboxStyle->currentIndex()); + recomputeFeature(); } diff --git a/src/Mod/TechDraw/Gui/TaskLeaderLine.h b/src/Mod/TechDraw/Gui/TaskLeaderLine.h index 991ff0b0fab0..3341d1def75a 100644 --- a/src/Mod/TechDraw/Gui/TaskLeaderLine.h +++ b/src/Mod/TechDraw/Gui/TaskLeaderLine.h @@ -89,6 +89,7 @@ public Q_SLOTS: void saveButtons(QPushButton* btnOK, QPushButton* btnCancel); void enableTaskButtons(bool b); + void recomputeFeature(); protected Q_SLOTS: @@ -121,6 +122,13 @@ protected Q_SLOTS: void saveState(void); void restoreState(void); +private Q_SLOTS: + void onStartSymbolChanged(); + void onEndSymbolChanged(); + void onColorChanged(); + void onLineWidthChanged(); + void onLineStyleChanged(); + private: Ui_TaskLeaderLine * ui; bool blockUpdate;