Repository: FreeCAD/FreeCAD
File: src/Mod/Sketcher/Gui/EditDatumDialog.cpp (C++)

Code before:
            int x = Xmax < Xmin ? (Xmin + Xmax) / 2
                                : std::min(std::max(QCursor::pos().x(), Xmin), Xmax);
            int y = Ymax < Ymin ? (Ymin + Ymax) / 2
                                : std::min(std::max(QCursor::pos().y(), Ymin), Ymax);
            dlg.setGeometry(x, y, dlg.geometry().width(), dlg.geometry().height());
        }

        return dlg.exec();
    }

    return QDialog::Rejected;
}

void EditDatumDialog::typeChanged(bool checked)
{
    if (!ui_ins_datum->rbRadius->isVisible()) {
        return;
    }

    // Updates UI labels based on selection, but does NOT change value yet
    QWidget* dlg = ui_ins_datum->labelEdit->parentWidget();
    while (dlg && !dlg->isWindow()) {
        dlg = dlg->parentWidget();
    }
    if (ui_ins_datum->rbRadius->isChecked()) {
        ui_ins_datum->label->setText(tr("Radius:"));
        if (dlg) {
            dlg->setWindowTitle(tr("Insert Radius"));
        }
    }
    else {
        ui_ins_datum->label->setText(tr("Diameter:"));
        if (dlg) {
            dlg->setWindowTitle(tr("Insert Diameter"));
        }
    }
}

void EditDatumDialog::accepted()
{
    // Check if we need to swap Radius <-> Diameter
    if (Constr->Type == Sketcher::Radius && ui_ins_datum->rbDiameter->isChecked()) {
        Constr->Type = Sketcher::Diameter;
    }
    else if (Constr->Type == Sketcher::Diameter && ui_ins_datum->rbRadius->isChecked()) {
        Constr->Type = Sketcher::Radius;
    }

    Base::Quantity newQuant = ui_ins_datum->labelEdit->value();
    if (Constr->Type == Sketcher::SnellsLaw || Constr->Type == Sketcher::Weight
        || !newQuant.isDimensionless()) {

Review comment (suggestion):
```suggestion
        ui_ins_datum->label->setText(tr("Radius"));
```

Code after:
            int x = Xmax < Xmin ? (Xmin + Xmax) / 2
                                : std::min(std::max(QCursor::pos().x(), Xmin), Xmax);
            int y = Ymax < Ymin ? (Ymin + Ymax) / 2
                                : std::min(std::max(QCursor::pos().y(), Ymin), Ymax);
            dlg.setGeometry(x, y, dlg.geometry().width(), dlg.geometry().height());
        }

        return dlg.exec();
    }

    return QDialog::Rejected;
}

void EditDatumDialog::typeChanged(bool checked)
{
    if (!ui_ins_datum->rbRadius->isVisible()) {
        return;
    }

    // Updates UI labels based on selection, but does NOT change value yet
    QWidget* dlg = ui_ins_datum->labelEdit->parentWidget();
    while (dlg && !dlg->isWindow()) {
        dlg = dlg->parentWidget();
    }
    if (ui_ins_datum->rbRadius->isChecked()) {
        ui_ins_datum->label->setText(tr("Radius"));
        if (dlg) {
            dlg->setWindowTitle(tr("Insert Radius"));
        }
    }
    else {
        ui_ins_datum->label->setText(tr("Diameter"));
        if (dlg) {
            dlg->setWindowTitle(tr("Insert Diameter"));
        }
    }
}

void EditDatumDialog::accepted()
{
    // Check if we need to swap Radius <-> Diameter
    if (Constr->Type == Sketcher::Radius && ui_ins_datum->rbDiameter->isChecked()) {
        Constr->Type = Sketcher::Diameter;
    }
    else if (Constr->Type == Sketcher::Diameter && ui_ins_datum->rbRadius->isChecked()) {
        Constr->Type = Sketcher::Radius;
    }

    Base::Quantity newQuant = ui_ins_datum->labelEdit->value();
    if (Constr->Type == Sketcher::SnellsLaw || Constr->Type == Sketcher::Weight
        || !newQuant.isDimensionless()) {