File indexing completed on 2024-04-21 05:51:37

0001 /*
0002  *  SPDX-FileCopyrightText: 2002-2003 Jesper K. Pedersen <blackie@kde.org>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-only
0005  **/
0006 
0007 #ifndef __limitedcharlineedit
0008 #define __limitedcharlineedit
0009 
0010 #include <QLineEdit>
0011 
0012 /**
0013    QLineEdit which only accepts a prespecified number of character.
0014    @internal
0015 */
0016 class LimitedCharLineEdit : public QLineEdit
0017 {
0018 public:
0019     enum Mode { NORMAL = 0, HEX = 1, OCT = 2 };
0020 
0021     LimitedCharLineEdit(Mode mode, QWidget *parent, const QString &name = QString());
0022 
0023 protected:
0024     void keyPressEvent(QKeyEvent *) override;
0025 
0026 private:
0027     int _count;
0028 };
0029 
0030 #endif