Skip to content

Commit

Permalink
[TD] refurbish LineDecorDlg
Browse files Browse the repository at this point in the history
- also set a better step size
- also apply the changes in the DLG immediately

see: https://forum.freecadweb.org/viewtopic.php?f=35&t=44362&p=379377#p379377
  • Loading branch information
donovaly authored and WandererFan committed Mar 23, 2020
1 parent 779ebb7 commit bf4e6b6
Show file tree
Hide file tree
Showing 2 changed files with 182 additions and 215 deletions.
21 changes: 13 additions & 8 deletions src/Mod/TechDraw/Gui/TaskLineDecor.cpp
Expand Up @@ -69,10 +69,10 @@ TaskLineDecor::TaskLineDecor(TechDraw::DrawViewPart* partFeat,
getDefaults();
ui->setupUi(this);

connect(ui->cb_Style, SIGNAL(currentIndexChanged( int )), this, SLOT(onStyleChanged(void)));
connect(ui->cc_Color, SIGNAL(changed( )), this, SLOT(onColorChanged(void)));
connect(ui->dsb_Weight, SIGNAL(valueChanged( double )), this, SLOT(onWeightChanged( void )));
connect(ui->cb_Visible, SIGNAL(currentIndexChanged( int )), this, SLOT(onVisibleChanged( void )));
connect(ui->cb_Style, SIGNAL(currentIndexChanged(int)), this, SLOT(onStyleChanged(void)));
connect(ui->cc_Color, SIGNAL(changed()), this, SLOT(onColorChanged(void)));
connect(ui->dsb_Weight, SIGNAL(valueChanged(double)), this, SLOT(onWeightChanged(void)));
connect(ui->cb_Visible, SIGNAL(currentIndexChanged(int)), this, SLOT(onVisibleChanged(void)));

initUi();
}
Expand Down Expand Up @@ -101,6 +101,7 @@ void TaskLineDecor::initUi()
ui->cb_Style->setCurrentIndex(m_style - 1); //combobox does not have 0:NoLine choice
ui->cc_Color->setColor(m_color.asValue<QColor>());
ui->dsb_Weight->setValue(m_weight);
ui->dsb_Weight->setSingleStep(0.1);
ui->cb_Visible->setCurrentIndex(m_visible);
}

Expand Down Expand Up @@ -157,25 +158,29 @@ void TaskLineDecor::getDefaults(void)
void TaskLineDecor::onStyleChanged(void)
{
m_style = ui->cb_Style->currentIndex() + 1;
//livePreview();
applyDecorations();
m_partFeat->requestPaint();
}

void TaskLineDecor::onColorChanged(void)
{
m_color.setValue<QColor>(ui->cc_Color->color());
//livePreview();
applyDecorations();
m_partFeat->requestPaint();
}

void TaskLineDecor::onWeightChanged(void)
{
m_weight = ui->dsb_Weight->value();
//livePreview();
applyDecorations();
m_partFeat->requestPaint();
}

void TaskLineDecor::onVisibleChanged(void)
{
m_visible = ui->cb_Visible->currentIndex();
//livePreview();
applyDecorations();
m_partFeat->requestPaint();
}

void TaskLineDecor::applyDecorations(void)
Expand Down

0 comments on commit bf4e6b6

Please sign in to comment.