Files
edgetx-gx12/companion/src/shared/hexspinbox.cpp
T
Kyle Manna da8160f1ff permissions: Remove execute bit from src files
* Remove the execute permission on all c, cpp, and header files.
* These files will never need to be executed.
2014-11-19 09:52:44 -08:00

28 lines
514 B
C++

#include "hexspinbox.h"
HexSpinBox::HexSpinBox(QWidget *parent):
QSpinBox(parent)
{
validator = new QRegExpValidator(QRegExp("[0-9A-Fa-f]{1,8}"), this);
}
QValidator::State HexSpinBox::validate(QString &text, int &pos) const
{
return validator->validate(text, pos);
}
int HexSpinBox::valueFromText(const QString &text) const
{
return text.toInt(0, 16);
}
QString HexSpinBox::textFromValue(int value) const
{
QString text;
text.sprintf("%04X", value);
return text;
}