File indexing completed on 2024-04-28 05:50:09
0001 /* 0002 * SPDX-License-Identifier: GPL-3.0-or-later 0003 * SPDX-FileCopyrightText: 2019-2020 Johan Ouwerkerk <jm.ouwerkerk@gmail.com> 0004 */ 0005 0006 #ifndef COUNTER_VALIDATOR_H 0007 #define COUNTER_VALIDATOR_H 0008 0009 #include <QLocale> 0010 #include <QString> 0011 #include <QValidator> 0012 0013 #include <optional> 0014 0015 namespace validators 0016 { 0017 std::optional<qulonglong> parseUnsignedInteger(const QString &input, const QLocale &locale = QLocale::system()); 0018 0019 class UnsignedLongValidator: public QValidator 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit UnsignedLongValidator(QObject *parent = nullptr); 0024 QValidator::State validate(QString &input, int &pos) const override; 0025 void fixup(QString &input) const override; 0026 }; 0027 } 0028 0029 #endif