diff options
Diffstat (limited to 'src/widget/hexspinbox.cpp')
-rw-r--r-- | src/widget/hexspinbox.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/widget/hexspinbox.cpp b/src/widget/hexspinbox.cpp index e3f25c4c53..68825a2a90 100644 --- a/src/widget/hexspinbox.cpp +++ b/src/widget/hexspinbox.cpp @@ -1,6 +1,4 @@ -#include <qvalidator.h> - -#include "hexspinbox.h" +#include "widget/hexspinbox.h" HexSpinBox::HexSpinBox(QWidget *parent) : QSpinBox(parent) @@ -9,12 +7,12 @@ HexSpinBox::HexSpinBox(QWidget *parent) setRange(0, 255); } -QString HexSpinBox::textFromValue(int value) const +QString HexSpinBox::textFromValue(int value) const { - //Construct a hex string formatted like 0x0f. - return QString("0x") + QString("%1").arg(value, + //Construct a hex string formatted like 0x0f. + return QString("0x") + QString("%1").arg(value, 2, //Field width (makes "F" become "0F") - 16, + 16, QLatin1Char('0')).toUpper(); } @@ -27,6 +25,6 @@ int HexSpinBox::valueFromText(const QString& text) const QValidator::State HexSpinBox::validate ( QString & input, int & pos ) const { const QRegExp regExp("^0(x|X)[0-9A-Fa-f]+"); - QRegExpValidator validator(regExp, NULL); + QRegExpValidator validator(regExp, NULL); return validator.validate(input, pos); } |