cant find QLocaleData
Unsolved
General and Desktop
-
I'm overloading the QValidator class and don't know where to find QLocaleData definition (according to qt source file it's there). <QLocale> or any other #include file i could think of doesn't have it .
I need it for this line to work:qlonglong entered = QLocaleData::bytearrayToLongLong(buff.constData(), 10, &ok);
-
this is as far as i got to override QIntValidator, Still don't know what to do with QLocaleData::
hpp:
#ifndef TEST_H #define TEST_H #include <QValidator> class test : public QIntValidator { Q_OBJECT using QIntValidator::QIntValidator; public: virtual State validate(QString &, int &) const override; test(); private: int b; int t; }; #endif // TEST_H
cpp:
#include "test.h" test::test() { } QValidator::State test::validate(QString & input, int &) const { bool ok; QByteArray buff; qlonglong entered = QLocaleData::bytearrayToLongLong(buff.constData(), 10, &ok); if (entered >= b && entered <= t) { locale().toInt(input, &ok); return ok ? Acceptable : Invalid; } }
-
@nullbuil7
you'll finde the struct in the private part of qt source files:
qlocale_p.hThose can and will change without notice so use it on your own caution
-
Why not simply calling the base implementation and doing the check afterwards?
Apart from this you're missing a return value.