File indexing completed on 2024-05-12 05:07:58

0001 /*
0002     SPDX-FileCopyrightText: 2001-2002 Michael Edwardes <mte@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2002-2017 Thomas Baumgart <tbaumgart@kde.org>
0004     SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef KMYMONEYMONEYVALIDATOR_H
0009 #define KMYMONEYMONEYVALIDATOR_H
0010 
0011 // ----------------------------------------------------------------------------
0012 // QT Includes
0013 
0014 #include <QDoubleValidator>
0015 
0016 // ----------------------------------------------------------------------------
0017 // KDE Includes
0018 
0019 // ----------------------------------------------------------------------------
0020 // Project Includes
0021 
0022 #include "kmm_widgets_export.h"
0023 
0024 /**
0025   * This class is derived from KDoubleValidator and uses
0026   * the monetary symbols instead of the numeric symbols.
0027   * Also, it always accepts localized input.
0028   *
0029   * @author Thomas Baumgart
0030   */
0031 class KMyMoneyMoneyValidator : public QDoubleValidator
0032 {
0033     Q_OBJECT
0034     Q_DISABLE_COPY(KMyMoneyMoneyValidator)
0035 
0036 public:
0037     /**
0038       * Construct a locale-aware KDoubleValidator with default range
0039       * (whatever QDoubleValidator uses for that) and parent @p
0040       * parent
0041       */
0042     explicit KMyMoneyMoneyValidator(QObject * parent);
0043     /**
0044       * Construct a locale-aware KDoubleValidator for range [@p bottom,@p
0045       * top] and a precision of @p digits after the decimal
0046       * point.
0047       */
0048     explicit KMyMoneyMoneyValidator(double bottom, double top, int decimals,
0049                                     QObject * parent);
0050     /**
0051       * Destructs the validator.
0052       */
0053     ~KMyMoneyMoneyValidator();
0054 
0055     /** Overloaded for internal reasons. The API is not affected. */
0056     QValidator::State validate(QString & input, int & pos) const override;
0057 };
0058 
0059 #endif