Skip to content

Commit

Permalink
PartDesign Pad UI-fix
Browse files Browse the repository at this point in the history
hide the custom direction fields if no custom direction is used, to
unclutter the UI.
  • Loading branch information
berberic2 committed Jul 27, 2021
1 parent bea371f commit a5cce96
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
13 changes: 9 additions & 4 deletions src/Mod/PartDesign/Gui/TaskPadParameters.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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)));
Expand Down Expand Up @@ -323,8 +324,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
Expand Down Expand Up @@ -473,7 +478,7 @@ bool TaskPadParameters::getAlongSketchNormal(void) const

bool TaskPadParameters::getCustom(void) const
{
return ui->groupBoxDirection->isChecked();
return ui->checkBoxDirection->isChecked();
}

double TaskPadParameters::getXDirection(void) const
Expand Down
14 changes: 9 additions & 5 deletions src/Mod/PartDesign/Gui/TaskPadParameters.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>280</width>
<height>373</height>
<height>497</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -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">
Expand All @@ -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">
Expand Down

0 comments on commit a5cce96

Please sign in to comment.