2012-01-06 16:09:03 +00:00
|
|
|
#include "inputint.h"
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
|
|
|
InputInt::InputInt(QWidget* form, QString label, int* value, int min, int max, int small_step, int large_step):
|
2012-10-01 15:36:41 +00:00
|
|
|
InputDouble(form, label, &_dvalue, (double)min, (double)max, (double)small_step, (double)large_step)
|
2012-01-06 16:09:03 +00:00
|
|
|
{
|
2012-07-04 09:50:06 +00:00
|
|
|
_value = value;
|
2012-10-01 15:36:41 +00:00
|
|
|
_dvalue = (double)(*value);
|
2012-01-06 16:09:03 +00:00
|
|
|
}
|
|
|
|
|
2012-01-08 10:31:01 +00:00
|
|
|
void InputInt::updatePreview()
|
|
|
|
{
|
2012-10-01 15:36:41 +00:00
|
|
|
((QLabel*)_preview)->setText(QString("%1").arg(_dvalue, 0, 'f', 0));
|
2012-01-08 10:31:01 +00:00
|
|
|
}
|
|
|
|
|
2012-01-06 16:09:03 +00:00
|
|
|
void InputInt::applyValue()
|
|
|
|
{
|
2012-10-01 15:36:41 +00:00
|
|
|
*_value = (int)_dvalue;
|
2012-01-06 16:09:03 +00:00
|
|
|
|
2012-10-01 15:36:41 +00:00
|
|
|
InputDouble::applyValue();
|
2012-01-06 16:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void InputInt::revert()
|
|
|
|
{
|
2012-10-01 15:36:41 +00:00
|
|
|
_dvalue = (double)(*_value);
|
2012-01-08 10:31:01 +00:00
|
|
|
|
2012-10-01 15:36:41 +00:00
|
|
|
InputDouble::revert();
|
2012-01-06 16:09:03 +00:00
|
|
|
}
|