[TD] refurbish LineDecorDlg

- 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
This commit is contained in:
donovaly
2020-03-22 15:22:40 +01:00
committed by WandererFan
parent a564c468f0
commit 147c78d9e9
2 changed files with 182 additions and 215 deletions

View File

@@ -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();
}
@@ -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);
}
@@ -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)