From df2e0ba8959610cfb9dbcac28b743591f2982aed Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Wed, 18 Dec 2024 21:00:00 +0100 Subject: [PATCH] Gui: Fix crash on qBounds for imperial units --- src/Gui/QuantitySpinBox.cpp | 2 +- src/Gui/TaskCSysDragger.ui | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/Gui/QuantitySpinBox.cpp b/src/Gui/QuantitySpinBox.cpp index 9e8acddaca..1ab6a81e84 100644 --- a/src/Gui/QuantitySpinBox.cpp +++ b/src/Gui/QuantitySpinBox.cpp @@ -449,7 +449,7 @@ void QuantitySpinBox::updateEdit(const QString& text) edit->setText(text); - cursor = qBound(0, cursor, edit->displayText().size() - d->unitStr.size()); + cursor = qBound(0, cursor, qMax(0, edit->displayText().size() - d->unitStr.size())); if (selsize > 0) { edit->setSelection(0, cursor); } diff --git a/src/Gui/TaskCSysDragger.ui b/src/Gui/TaskCSysDragger.ui index a86539f01d..0371c734a7 100644 --- a/src/Gui/TaskCSysDragger.ui +++ b/src/Gui/TaskCSysDragger.ui @@ -126,16 +126,10 @@ - - mm - - - mm - @@ -188,9 +182,6 @@ - - mm - @@ -370,9 +361,6 @@ - - mm - 0.000000000000000