source: trunk/FACT++/gui/SpinBoxHex.h@ 10686

Last change on this file since 10686 was 10657, checked in by tbretz, 14 years ago
Added or improved documentation.
File size: 866 bytes
Line 
1#ifndef FACT_SpinBoxHex
2#define FACT_SpinBoxHex
3
4#include <QSpinBox>
5
6
7class QRegExpValidator;
8
9class SpinBoxHex : public QSpinBox
10{
11public:
12 SpinBoxHex(QWidget *p=0) : QSpinBox(p)
13 {
14 }
15
16protected:
17 QValidator::State validate(QString &txt, int &/*pos*/) const
18 {
19 bool ok;
20 txt.toInt(&ok, 16);
21
22 return ok ? QValidator::Acceptable : QValidator::Invalid;
23 }
24
25 QString textFromValue(int val) const
26 {
27 return QString::number(val, 16).toLower();
28 }
29
30 int valueFromText(const QString &txt) const
31 {
32 bool ok;
33 return txt.toInt(&ok, 16);
34 }
35};
36
37#endif
38
39// **************************************************************************
40/** @class SpinBoxHex
41
42@brief A QSpinBox which displays the value as hex-value
43
44*/
45// **************************************************************************
Note: See TracBrowser for help on using the repository browser.