Gui: [skip ci] fix bug when keyboard tracking for QuantitySpinBox is disabled and value is changed by mouse wheel or the spin buttons
This commit is contained in:
@@ -629,6 +629,11 @@ void QuantitySpinBox::finishFormulaDialog()
|
||||
}
|
||||
|
||||
void QuantitySpinBox::handlePendingEmit()
|
||||
{
|
||||
updateFromCache(true);
|
||||
}
|
||||
|
||||
void QuantitySpinBox::updateFromCache(bool notify)
|
||||
{
|
||||
Q_D(QuantitySpinBox);
|
||||
if (d->pendingEmit) {
|
||||
@@ -639,9 +644,11 @@ void QuantitySpinBox::handlePendingEmit()
|
||||
d->quantity = res;
|
||||
|
||||
// signaling
|
||||
d->pendingEmit = false;
|
||||
valueChanged(res);
|
||||
valueChanged(res.getValue());
|
||||
if (notify) {
|
||||
d->pendingEmit = false;
|
||||
valueChanged(res);
|
||||
valueChanged(res.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -791,8 +798,7 @@ QAbstractSpinBox::StepEnabled QuantitySpinBox::stepEnabled() const
|
||||
void QuantitySpinBox::stepBy(int steps)
|
||||
{
|
||||
Q_D(QuantitySpinBox);
|
||||
|
||||
handlePendingEmit();
|
||||
updateFromCache(false);
|
||||
|
||||
double step = d->singleStep * steps;
|
||||
double val = d->unitValue + step;
|
||||
@@ -802,6 +808,7 @@ void QuantitySpinBox::stepBy(int steps)
|
||||
val = d->minimum;
|
||||
|
||||
lineEdit()->setText(QString::fromUtf8("%L1 %2").arg(val).arg(d->unitStr));
|
||||
updateFromCache(true);
|
||||
update();
|
||||
selectNumber();
|
||||
}
|
||||
|
||||
@@ -159,6 +159,7 @@ protected:
|
||||
|
||||
private:
|
||||
void updateText(const Base::Quantity&);
|
||||
void updateFromCache(bool);
|
||||
QString getUserString(const Base::Quantity& val, double& factor, QString& unitString) const;
|
||||
QString getUserString(const Base::Quantity& val) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user