Skip to content

Commit

Permalink
[TD] make LeaderLine dialog show changes immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
donovaly authored and WandererFan committed Mar 22, 2020
1 parent 1d8df25 commit 47fda41
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/Mod/TechDraw/Gui/TaskLeaderLine.cpp
Expand Up @@ -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) {
Expand All @@ -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<QColor>(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();
}


Expand Down
8 changes: 8 additions & 0 deletions src/Mod/TechDraw/Gui/TaskLeaderLine.h
Expand Up @@ -89,6 +89,7 @@ public Q_SLOTS:
void saveButtons(QPushButton* btnOK,
QPushButton* btnCancel);
void enableTaskButtons(bool b);
void recomputeFeature();


protected Q_SLOTS:
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 47fda41

Please sign in to comment.