Base: Quantity: use isDimensionless whenever feasible

Quantity is often queried for Unit just to see if it has a dimension.
Ask Quantity directly using isDimensionless() method and modify that
method not to care about Quantity value validity; no user was ever
asking for value validity.
This commit is contained in:
Ladislav Michl
2025-04-10 17:43:41 +02:00
parent f486b7c84b
commit 913c30429c
10 changed files with 31 additions and 58 deletions

View File

@@ -201,8 +201,8 @@ int EditDatumDialog::exec(bool atCursor)
void EditDatumDialog::accepted()
{
Base::Quantity newQuant = ui_ins_datum->labelEdit->value();
if (newQuant.isQuantity() || (Constr->Type == Sketcher::SnellsLaw && newQuant.isDimensionless())
|| (Constr->Type == Sketcher::Weight && newQuant.isDimensionless())) {
if (Constr->Type == Sketcher::SnellsLaw || Constr->Type == Sketcher::Weight
|| !newQuant.isDimensionless()) {
// save the value for the history
ui_ins_datum->labelEdit->pushToHistory();