[TD] make GeomHatch dialog show changes immediately

also change SpineEdit step to better values
This commit is contained in:
donovaly
2020-03-22 04:29:58 +01:00
committed by WandererFan
parent baf6dc50e7
commit 4fadf793a7
2 changed files with 42 additions and 0 deletions

View File

@@ -77,6 +77,7 @@ void TaskGeomHatch::initUi()
ui->fcFile->setFileName(QString::fromUtf8(m_file.data(), m_file.size()));
std::vector<std::string> names = PATLineSpec::getPatternList(m_file);
QStringList qsNames = listToQ(names);
ui->cbName->addItems(qsNames);
int nameIndex = ui->cbName->findText(QString::fromUtf8(m_name.data(),m_name.size()));
if (nameIndex > -1) {
@@ -84,9 +85,16 @@ void TaskGeomHatch::initUi()
} else {
Base::Console().Warning("Warning - Pattern name *%s* not found in current PAT File\n", m_name.c_str());
}
connect(ui->cbName, SIGNAL(currentIndexChanged(int)), this, SLOT(onNameChanged()));
ui->sbScale->setValue(m_scale);
ui->sbScale->setSingleStep(0.1);
connect(ui->sbScale, SIGNAL(valueChanged(double)), this, SLOT(onScaleChanged()));
ui->sbWeight->setValue(m_weight);
ui->sbWeight->setSingleStep(0.1);
connect(ui->sbWeight, SIGNAL(valueChanged(double)), this, SLOT(onLineWeightChanged()));
ui->ccColor->setColor(m_color.asValue<QColor>());
connect(ui->ccColor, SIGNAL(changed()), this, SLOT(onColorChanged()));
}
//move values from screen to DocObjs
@@ -134,6 +142,34 @@ bool TaskGeomHatch::accept()
return true;
}
void TaskGeomHatch::onNameChanged()
{
QString cText = ui->cbName->currentText();
m_name = cText.toUtf8().constData();
m_hatch->NamePattern.setValue(m_name);
m_source->getDocument()->recompute();
}
void TaskGeomHatch::onScaleChanged()
{
m_hatch->ScalePattern.setValue(ui->sbScale->value());
m_source->getDocument()->recompute();
}
void TaskGeomHatch::onLineWeightChanged()
{
m_Vp->WeightPattern.setValue(ui->sbWeight->value());
m_source->getDocument()->recompute();
}
void TaskGeomHatch::onColorChanged()
{
App::Color ac;
ac.setValue<QColor>(ui->ccColor->color());
m_Vp->ColorPattern.setValue(ac);
m_source->getDocument()->recompute();
}
bool TaskGeomHatch::reject()
{
if (getCreateMode()) {

View File

@@ -69,6 +69,12 @@ protected:
void getParameters();
QStringList listToQ(std::vector<std::string> in);
private Q_SLOTS:
void onNameChanged();
void onScaleChanged();
void onLineWeightChanged();
void onColorChanged();
private:
Ui_TaskGeomHatch * ui;
TechDraw::DrawGeomHatch* m_hatch;