2009-04-03 19:30:25 +00:00
|
|
|
/*
|
2023-01-01 17:05:57 +01:00
|
|
|
Copyright 2006-2023 The QElectroTech Team
|
2009-04-03 19:30:25 +00:00
|
|
|
This file is part of QElectroTech.
|
2020-09-18 23:05:42 +02:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2020-09-18 23:05:42 +02:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2020-09-18 23:05:42 +02:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef QET_REGEXP_VALIDATOR_H
|
|
|
|
#define QET_REGEXP_VALIDATOR_H
|
2020-09-18 23:05:42 +02:00
|
|
|
#include <QRegularExpressionValidator>
|
2009-04-03 19:30:25 +00:00
|
|
|
/**
|
2020-09-18 23:05:42 +02:00
|
|
|
This class acts like a QRegularExpressionValidator
|
|
|
|
except it emits a signal when the input validation fails.
|
2009-04-03 19:30:25 +00:00
|
|
|
*/
|
2020-09-18 23:05:42 +02:00
|
|
|
class QETRegExpValidator : public QRegularExpressionValidator {
|
2009-04-03 19:30:25 +00:00
|
|
|
Q_OBJECT
|
2020-09-18 23:05:42 +02:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// constructors, destructor
|
2009-04-03 19:30:25 +00:00
|
|
|
public:
|
|
|
|
QETRegExpValidator(QObject *);
|
2020-09-18 23:05:42 +02:00
|
|
|
QETRegExpValidator(const QRegularExpression &, QObject *);
|
2017-08-05 02:10:01 +00:00
|
|
|
~QETRegExpValidator() override;
|
2009-04-03 19:30:25 +00:00
|
|
|
private:
|
|
|
|
QETRegExpValidator(const QETRegExpValidator &);
|
2020-09-18 23:05:42 +02:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods
|
2009-04-03 19:30:25 +00:00
|
|
|
public:
|
2017-08-05 02:10:01 +00:00
|
|
|
QValidator::State validate(QString &, int &) const override;
|
2020-09-18 23:05:42 +02:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
signals:
|
|
|
|
void validationFailed() const;
|
|
|
|
};
|
|
|
|
#endif
|