mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-08 06:32:35 +02:00
Partial fix for spinner boxes not using the _step property of SpinnerPreference.
(https://github.com/vircadia/vircadia/issues/117) - In SpinBoxPreference.qml, SpinBox was missing "realStepSize: preference.step". - Had to change FloatPreference::step from float to double, because there is some truncation happening somewhere. For example, a step of 0.01f was acting like 0.00 because (0.01f < 0.01). - Changed FloatPreference::decimals (number of decimal places) from float to uint, because it seemed to make more sense. - Changed the 'User real-world height' spinbox to use a resolution of 1cm (for display and step) rather than 1mm. - Remaining bug: the up & down buttons of the spinbox fail to change the value, at some values, though the mouse wheel always works. Repro: Settings > Controls > User real-world height Hover the mouse over the box and and scroll the mouse wheel down until the value is at 1.15. Click the up button a few times and observe that the number can't be increased. Scroll the mouse wheel forward and observe that the number increases correctly. - Todo: Change all calls to FloatPreference::setStep to pass doubles, if this change to its parameter type is kept.
This commit is contained in:
parent
f1576aba78
commit
3b5eb2d24b
3 changed files with 11 additions and 10 deletions
|
@ -51,6 +51,7 @@ Preference {
|
|||
decimals: preference.decimals
|
||||
minimumValue: preference.min
|
||||
maximumValue: preference.max
|
||||
realStepSize: preference.step
|
||||
width: 100
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
|
|
|
@ -465,8 +465,8 @@ void setupPreferences() {
|
|||
auto preference = new SpinnerPreference(VR_MOVEMENT, "User real-world height (meters)", getter, setter);
|
||||
preference->setMin(1.0f);
|
||||
preference->setMax(2.2f);
|
||||
preference->setDecimals(3);
|
||||
preference->setStep(0.001f);
|
||||
preference->setDecimals(2);
|
||||
preference->setStep(0.01);
|
||||
preferences->addPreference(preference);
|
||||
}
|
||||
|
||||
|
|
|
@ -152,8 +152,8 @@ class FloatPreference : public Preference {
|
|||
Q_PROPERTY(float value READ getValue WRITE setValue NOTIFY valueChanged)
|
||||
Q_PROPERTY(float min READ getMin CONSTANT)
|
||||
Q_PROPERTY(float max READ getMax CONSTANT)
|
||||
Q_PROPERTY(float step READ getStep CONSTANT)
|
||||
Q_PROPERTY(float decimals READ getDecimals CONSTANT)
|
||||
Q_PROPERTY(double step READ getStep CONSTANT)
|
||||
Q_PROPERTY(uint decimals READ getDecimals CONSTANT)
|
||||
|
||||
public:
|
||||
using Getter = std::function<float()>;
|
||||
|
@ -178,11 +178,11 @@ public:
|
|||
float getMax() const { return _max; }
|
||||
void setMax(float max) { _max = max; };
|
||||
|
||||
float getStep() const { return _step; }
|
||||
void setStep(float step) { _step = step; };
|
||||
double getStep() const { return _step; }
|
||||
void setStep(double step) { _step = step; };
|
||||
|
||||
float getDecimals() const { return _decimals; }
|
||||
void setDecimals(float decimals) { _decimals = decimals; };
|
||||
uint getDecimals() const { return _decimals; }
|
||||
void setDecimals(uint decimals) { _decimals = decimals; };
|
||||
|
||||
signals:
|
||||
void valueChanged();
|
||||
|
@ -194,10 +194,10 @@ protected:
|
|||
const Getter _getter;
|
||||
const Setter _setter;
|
||||
|
||||
float _decimals { 0 };
|
||||
uint _decimals { 0 };
|
||||
float _min { 0 };
|
||||
float _max { 1 };
|
||||
float _step { 0.1f };
|
||||
double _step { 0.1 };
|
||||
};
|
||||
|
||||
class IntPreference : public Preference {
|
||||
|
|
Loading…
Reference in a new issue