2012-06-23 21:47:12 +00:00
|
|
|
#include "inputenum.h"
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QComboBox>
|
|
|
|
|
|
|
|
InputEnum::InputEnum(QWidget* form, QString label, int* value, const QStringList& values) : BaseInput(form, label)
|
|
|
|
{
|
|
|
|
_value = value;
|
|
|
|
|
|
|
|
_preview = new QWidget(form);
|
|
|
|
_control = new QComboBox(form);
|
|
|
|
((QComboBox*)_control)->addItems(values);
|
|
|
|
|
|
|
|
connect(_control, SIGNAL(currentIndexChanged(int)), this, SLOT(applyValue()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void InputEnum::applyValue()
|
|
|
|
{
|
|
|
|
*_value = ((QComboBox*)_control)->currentIndex();
|
|
|
|
|
|
|
|
BaseInput::applyValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InputEnum::revert()
|
|
|
|
{
|
2012-07-04 09:50:06 +00:00
|
|
|
if (*_value != ((QComboBox*)_control)->currentIndex())
|
|
|
|
{
|
|
|
|
((QComboBox*)_control)->setCurrentIndex(*_value);
|
|
|
|
}
|
2012-06-23 21:47:12 +00:00
|
|
|
|
|
|
|
BaseInput::revert();
|
|
|
|
}
|