File indexing completed on 2024-05-05 17:42:43

0001 /*
0002     SPDX-FileCopyrightText: 2009 Andrey Batyiev <batyiev@gmail.com>
0003     SPDX-FileCopyrightText: 2015 Jan Grulich <jgrulich@redhat.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #ifndef PLASMA_NM_LIST_VALIDATOR_H
0009 #define PLASMA_NM_LIST_VALIDATOR_H
0010 
0011 #include <QValidator>
0012 
0013 /**
0014  * This class validates each string item with a validator.
0015  * String items are separated by comma.
0016  * The validator should be set with setInnerValidator(..) method.
0017  * Please note, space characters are allowed only after comma characters.
0018  */
0019 class ListValidator : public QValidator
0020 {
0021     Q_OBJECT
0022 public:
0023     explicit ListValidator(QObject *parent);
0024     ~ListValidator() override;
0025 
0026     State validate(QString &text, int &pos) const override;
0027     void setInnerValidator(QValidator *validator);
0028 
0029 private:
0030     QValidator *inner = nullptr;
0031 };
0032 
0033 #endif // PLASMA_NM_LIST_VALIDATOR_H