VirtualBox

Ignore:
Timestamp:
Aug 23, 2007 6:58:03 PM (17 years ago)
Author:
vboxsync
Message:

FE/Qt: Added QIULongValidator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/QIWidgetValidator.h

    r4071 r4323  
    2020#define __QIWidgetValidator_h__
    2121
     22#include <limits.h>
     23
    2224#include <qobject.h>
     25#include <qvalidator.h>
    2326
    2427class QIWidgetValidator : public QObject
     
    5255};
    5356
     57class QIULongValidator : public QValidator
     58{
     59public:
     60
     61    QIULongValidator (QObject *aParent, const char *aName = 0)
     62        : mBottom (0), mTop (ULONG_MAX)
     63        , QValidator (aParent, aName) {}
     64
     65    QIULongValidator (ulong aMinimum, ulong aMaximum,
     66                      QObject *aParent, const char *aName = 0)
     67        : mBottom (aMinimum), mTop (aMaximum)
     68        , QValidator (aParent, aName) {}
     69
     70    ~QIULongValidator() {}
     71
     72    State validate (QString &aInput, int &aPos) const;
     73    void setBottom (ulong aBottom) { setRange (aBottom, mTop); }
     74    void setTop (ulong aTop) { setRange (mBottom, aTop); }
     75    void setRange (ulong aBottom, ulong aTop) { mBottom = aBottom; mTop = aTop; }
     76    ulong bottom() const { return mBottom; }
     77    ulong top() const { return mTop; }
     78
     79private:
     80
     81    ulong mBottom;
     82    ulong mTop;
     83};
     84
    5485#endif // __QIWidgetValidator_h__
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette