PD: hole fix head custom values checkbox not appearing

This commit is contained in:
Alfredo Monclus
2025-05-23 18:12:13 -06:00
parent 555dfc6ccb
commit 91d2b25dfd

View File

@@ -123,10 +123,7 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare
ui->HoleCutType->setCurrentIndex(pcHole->HoleCutType.getValue());
ui->HoleCutCustomValues->setChecked(pcHole->HoleCutCustomValues.getValue());
ui->HoleCutCustomValues->setHidden(
pcHole->HoleCutType.getValue() < 5
|| pcHole->HoleCutCustomValues.isReadOnly()
);
ui->HoleCutCustomValues->setHidden(pcHole->HoleCutType.getValue() < 4);
// HoleCutDiameter must not be smaller or equal than the Diameter
updateHoleCutLimits(pcHole);
ui->HoleCutDiameter->setValue(pcHole->HoleCutDiameter.getValue());
@@ -385,25 +382,19 @@ void TaskHoleParameters::holeCutTypeChanged(int index)
recomputeFeature();
// apply the result to the widgets
ui->HoleCutCustomValues->setHidden(hole->HoleCutCustomValues.isReadOnly());
ui->HoleCutCustomValues->setChecked(hole->HoleCutCustomValues.getValue());
// HoleCutCustomValues is only enabled for screw definitions
// we must do this after recomputeFeature() because this gives us the info if
// the type is a countersink and thus if HoleCutCountersinkAngle can be enabled
std::string HoleCutTypeString = hole->HoleCutType.getValueAsString();
if (
HoleCutTypeString == "None"
|| HoleCutTypeString == "Counterbore"
|| HoleCutTypeString == "Countersink"
|| HoleCutTypeString == "Counterdrill"
) {
ui->HoleCutCustomValues->setVisible(false);
if (hole->HoleCutType.getValue() < 4) {
ui->HoleCutCustomValues->setHidden(true);
}
else { // screw definition
// we can have the case that we have no normed values
// in this case HoleCutCustomValues is read-only AND true
ui->HoleCutCustomValues->setHidden(false);
bool isCustom = ui->HoleCutCustomValues->isChecked();
ui->HoleCutDiameter->setEnabled(isCustom);
ui->HoleCutDepth->setEnabled(isCustom);