File indexing completed on 2024-04-28 07:42:51
0001 /* -*- C++ -*- 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 1997 Tim D. Gilman <tdgilman@best.org> 0004 SPDX-FileCopyrightText: 1998-2001 Mirko Boehm <mirko@kde.org> 0005 SPDX-FileCopyrightText: 2007 John Layt <john@layt.net> 0006 0007 SPDX-License-Identifier: LGPL-2.0-or-later 0008 */ 0009 0010 #ifndef KDATEVALIDATOR_H 0011 #define KDATEVALIDATOR_H 0012 0013 #include <kguiaddons_export.h> 0014 0015 #include <QValidator> 0016 0017 #include <memory> 0018 0019 class KDateValidatorPrivate; 0020 0021 /** 0022 * @class KDateValidator kdatevalidator.h KDateValidator 0023 * 0024 * Validates user-entered dates. 0025 */ 0026 class KGUIADDONS_EXPORT KDateValidator : public QValidator 0027 { 0028 Q_OBJECT 0029 public: 0030 explicit KDateValidator(QObject *parent = nullptr); 0031 ~KDateValidator() override; 0032 0033 public: 0034 State validate(QString &text, int &e) const override; 0035 void fixup(QString &input) const override; 0036 State date(const QString &text, QDate &date) const; 0037 0038 private: 0039 std::unique_ptr<KDateValidatorPrivate> const d; 0040 }; 0041 0042 #endif // KDATEVALIDATOR_H