1 | /* -*- C++ -*- |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 1997 Tim D. Gilman <tdgilman@best.org> |
4 | SPDX-FileCopyrightText: 1998-2001 Mirko Boehm <mirko@kde.org> |
5 | SPDX-FileCopyrightText: 2007 John Layt <john@layt.net> |
6 | |
7 | SPDX-License-Identifier: LGPL-2.0-or-later |
8 | */ |
9 | |
10 | #ifndef KDATEVALIDATOR_H |
11 | #define KDATEVALIDATOR_H |
12 | |
13 | #include <kguiaddons_export.h> |
14 | |
15 | #include <QValidator> |
16 | |
17 | #include <memory> |
18 | |
19 | class KDateValidatorPrivate; |
20 | |
21 | /** |
22 | * @class KDateValidator kdatevalidator.h KDateValidator |
23 | * |
24 | * Validates user-entered dates. |
25 | */ |
26 | class KGUIADDONS_EXPORT KDateValidator : public QValidator |
27 | { |
28 | Q_OBJECT |
29 | public: |
30 | explicit KDateValidator(QObject *parent = nullptr); |
31 | ~KDateValidator() override; |
32 | |
33 | public: |
34 | State validate(QString &text, int &e) const override; |
35 | void fixup(QString &input) const override; |
36 | State date(const QString &text, QDate &date) const; |
37 | |
38 | private: |
39 | std::unique_ptr<KDateValidatorPrivate> const d; |
40 | }; |
41 | |
42 | #endif // KDATEVALIDATOR_H |
43 | |