KDb

KDbLongLongValidator.h
1/* This file is part of the KDE project
2 Copyright (C) 2006-2016 Jarosław Staniek <staniek@kde.org>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KDB_TOOLS_LLONGVALIDATOR_H
21#define KDB_TOOLS_LLONGVALIDATOR_H
22
23#include "kdb_export.h"
24
25#include <QValidator>
26
27//! @short A validator for longlong data type.
28/*!
29 This can be used by QLineEdit or subclass to provide validated
30 text entry. Can be provided with a base value (default is 10), to allow
31 the proper entry of hexadecimal, octal, or any other base numeric data.
32
33 Based on KIntValidator code by Glen Parker <glenebob@nwlink.com>
34*/
35class KDB_EXPORT KDbLongLongValidator : public QValidator
36{
37 Q_OBJECT
38public:
39 explicit KDbLongLongValidator(QWidget * parent, int base = 10);
40 KDbLongLongValidator(qint64 bottom, qint64 top, QWidget * parent, int base = 10);
41 ~KDbLongLongValidator() override;
42
43 //! Validates the text, and returns the result. Does not modify the parameters.
44 State validate(QString &, int &) const override;
45
46 //! Fixes the text if possible, providing a valid string. The parameter may be modified.
47 void fixup(QString &) const override;
48
49 //! Sets the minimum and maximum values allowed.
50 virtual void setRange(qint64 bottom, qint64 top);
51
52 //! Sets the numeric base value.
53 virtual void setBase(int base);
54
55 //! @return the current minimum value allowed
56 virtual qint64 bottom() const;
57
58 //! @return the current maximum value allowed
59 virtual qint64 top() const;
60
61 //! @return the current numeric base
62 virtual int base() const;
63
64private:
65 class Private;
66 Private * const d;
67 Q_DISABLE_COPY(KDbLongLongValidator)
68};
69
70#endif
A validator for longlong data type.
virtual void fixup(QString &input) const const
virtual State validate(QString &input, int &pos) const const=0
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:59 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.