paysages : InputInt now honor its small_step value.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@431 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
cc21b63966
commit
4b85289ac7
3 changed files with 10 additions and 42 deletions
1
TODO
1
TODO
|
@ -9,7 +9,6 @@ Technology Preview 2 :
|
|||
- Finalize Preetham's model usage
|
||||
=> Apply model to atmosphere (aerial perspective)
|
||||
=> Find a proper model for night sky (maybe Shirley)
|
||||
- InputInt doesn't honor small_step.
|
||||
- Keep skydome lights in cache for a render.
|
||||
- Add buttons to restore "auto" default values in tabs and dialogs (with several auto presets).
|
||||
- Clouds should keep distance to ground.
|
||||
|
|
|
@ -3,54 +3,27 @@
|
|||
#include <QLabel>
|
||||
|
||||
InputInt::InputInt(QWidget* form, QString label, int* value, int min, int max, int small_step, int large_step):
|
||||
BaseInput(form, label)
|
||||
InputDouble(form, label, &_dvalue, (double)min, (double)max, (double)small_step, (double)large_step)
|
||||
{
|
||||
_value = value;
|
||||
_min = min;
|
||||
_max = max;
|
||||
_small_step = small_step;
|
||||
_large_step = large_step;
|
||||
|
||||
_slider = new QSlider(form);
|
||||
|
||||
_slider->setOrientation(Qt::Horizontal);
|
||||
_slider->setMinimumWidth(150);
|
||||
_slider->setMaximumWidth(400);
|
||||
|
||||
_slider->setMinimum(min);
|
||||
_slider->setMaximum(max);
|
||||
_slider->setValue(*value);
|
||||
|
||||
_slider->setTickInterval(large_step);
|
||||
_slider->setTickPosition(QSlider::TicksBelow);
|
||||
|
||||
connect(_slider, SIGNAL(valueChanged(int)), this, SLOT(applyValue()));
|
||||
|
||||
_preview = new QLabel(form);
|
||||
((QLabel*)_preview)->setAlignment(Qt::AlignCenter);
|
||||
_control = _slider;
|
||||
_dvalue = (double)(*value);
|
||||
}
|
||||
|
||||
void InputInt::updatePreview()
|
||||
{
|
||||
((QLabel*)_preview)->setText(QString("%1").arg(*_value));
|
||||
|
||||
BaseInput::updatePreview();
|
||||
((QLabel*)_preview)->setText(QString("%1").arg(_dvalue, 0, 'f', 0));
|
||||
}
|
||||
|
||||
void InputInt::applyValue()
|
||||
{
|
||||
*_value = (int)_slider->value();
|
||||
*_value = (int)_dvalue;
|
||||
|
||||
BaseInput::applyValue();
|
||||
InputDouble::applyValue();
|
||||
}
|
||||
|
||||
void InputInt::revert()
|
||||
{
|
||||
if (*_value != _slider->value())
|
||||
{
|
||||
_slider->setValue(*_value);
|
||||
}
|
||||
_dvalue = (double)(*_value);
|
||||
|
||||
BaseInput::revert();
|
||||
InputDouble::revert();
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
#include <QWidget>
|
||||
#include <QSlider>
|
||||
#include "baseinput.h"
|
||||
#include "inputdouble.h"
|
||||
|
||||
class InputInt:public BaseInput
|
||||
class InputInt:public InputDouble
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -18,12 +18,8 @@ public slots:
|
|||
virtual void revert();
|
||||
|
||||
private:
|
||||
QSlider* _slider;
|
||||
int* _value;
|
||||
int _min;
|
||||
int _max;
|
||||
int _small_step;
|
||||
int _large_step;
|
||||
double _dvalue;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue