Merge pull request #4872 from berberic2/PD_pad_ui_change

PartDesign: Hide the custom direction fields in Pad if no custom direction is used
This commit is contained in:
Yorik van Havre
2021-08-23 14:28:03 +02:00
committed by GitHub
2 changed files with 18 additions and 9 deletions

View File

@@ -104,7 +104,8 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView, QWidget *parent,
// Fill data into dialog elements
ui->lengthEdit->setValue(l);
ui->lengthEdit2->setValue(l2);
ui->groupBoxDirection->setChecked(useCustom);
ui->checkBoxDirection->setChecked(useCustom);
onDirectionToggled(useCustom);
ui->checkBoxAlongDirection->setChecked(alongCustom);
ui->XDirectionEdit->setValue(xs);
ui->YDirectionEdit->setValue(ys);
@@ -158,7 +159,7 @@ TaskPadParameters::TaskPadParameters(ViewProviderPad *PadView, QWidget *parent,
this, SLOT(onLength2Changed(double)));
connect(ui->checkBoxAlongDirection, SIGNAL(toggled(bool)),
this, SLOT(onAlongSketchNormalChanged(bool)));
connect(ui->groupBoxDirection, SIGNAL(toggled(bool)),
connect(ui->checkBoxDirection, SIGNAL(toggled(bool)),
this, SLOT(onDirectionToggled(bool)));
connect(ui->XDirectionEdit, SIGNAL(valueChanged(double)),
this, SLOT(onXDirectionEditChanged(double)));
@@ -331,8 +332,12 @@ void TaskPadParameters::onDirectionToggled(bool on)
pcPad->UseCustomVector.setValue(on);
// dis/enable length direction
ui->checkBoxAlongDirection->setEnabled(on);
if (!on)
if (on) {
ui->groupBoxDirection->show();
} else {
ui->checkBoxAlongDirection->setChecked(!on);
ui->groupBoxDirection->hide();
}
recomputeFeature();
// the calculation of the sketch's normal vector is done in FeaturePad.cpp
// if this vector was used for the recomputation we must fill the direction
@@ -481,7 +486,7 @@ bool TaskPadParameters::getAlongSketchNormal(void) const
bool TaskPadParameters::getCustom(void) const
{
return ui->groupBoxDirection->isChecked();
return ui->checkBoxDirection->isChecked();
}
double TaskPadParameters::getXDirection(void) const

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>280</width>
<height>373</height>
<height>497</height>
</rect>
</property>
<property name="windowTitle">
@@ -51,6 +51,13 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxDirection">
<property name="text">
<string>Use custom direction</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxDirection">
<property name="enabled">
@@ -60,11 +67,8 @@
<string>Use custom vector for pad direction otherwise
the sketch plane's normal vector will be used</string>
</property>
<property name="title">
<string>Use custom direction</string>
</property>
<property name="checkable">
<bool>true</bool>
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">