author | kergoth <kergoth> | 2002-09-15 17:23:20 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-09-15 17:23:20 (UTC) |
commit | 9bd6edd077df796677c9d069200172f930ac1304 (patch) (unidiff) | |
tree | 3b473d4280249b5ade8e5276758cc8f9aa3c2822 /noncore/apps/checkbook/qrestrictedcombo.h | |
parent | 33ec9ead7ce30bf9450b9048506f0bda49ba4791 (diff) | |
download | opie-9bd6edd077df796677c9d069200172f930ac1304.zip opie-9bd6edd077df796677c9d069200172f930ac1304.tar.gz opie-9bd6edd077df796677c9d069200172f930ac1304.tar.bz2 |
Reverting to checkbook in its previous state, hopefully i got everything.
Diffstat (limited to 'noncore/apps/checkbook/qrestrictedcombo.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/qrestrictedcombo.h | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/noncore/apps/checkbook/qrestrictedcombo.h b/noncore/apps/checkbook/qrestrictedcombo.h new file mode 100644 index 0000000..50ea59f --- a/dev/null +++ b/noncore/apps/checkbook/qrestrictedcombo.h | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Definition of QRestrictedCombo | ||
4 | * | ||
5 | * Copyright (C) 1997 Michael Wiedmann, <mw@miwie.in-berlin.de> | ||
6 | * | ||
7 | * Edited 2001 by Nick Betcher <nbetcher@usinternet.com> to work | ||
8 | * with Qt-only. Changed class name from LRestrictedLine to | ||
9 | * QRestrictedCombo in order to accomidate Combo Boxes. | ||
10 | * | ||
11 | * This library is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU Library General Public | ||
13 | * License as published by the Free Software Foundation; either | ||
14 | * version 2 of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This library is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
19 | * Library General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU Library General Public | ||
22 | * License along with this library; if not, write to the Free | ||
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | #ifndef QRESTRICTEDCOMBO_H | ||
28 | #define QRESTRICTEDCOMBO_H | ||
29 | |||
30 | #include <qcombobox.h> | ||
31 | |||
32 | /** | ||
33 | * The QRestrictedCombo widget is a variant of @ref QComboBox which | ||
34 | * accepts only a restricted set of characters as input. | ||
35 | * All other characters will be discarded and the signal @ref #invalidChar() | ||
36 | * will be emitted for each of them. | ||
37 | * | ||
38 | * Valid characters can be passed as a QString to the constructor | ||
39 | * or set afterwards via @ref #setValidChars(). | ||
40 | * The default key bindings of @ref QComboBox are still in effect. | ||
41 | * | ||
42 | * @short A line editor for restricted character sets. | ||
43 | * @author Michael Wiedmann <mw@miwie.in-berlin.de> | ||
44 | * @version 0.0.1 | ||
45 | */ | ||
46 | class QRestrictedCombo : public QComboBox | ||
47 | { | ||
48 | Q_OBJECT | ||
49 | Q_PROPERTY( QString validChars READ validChars WRITE setValidChars ) | ||
50 | |||
51 | public: | ||
52 | |||
53 | /** | ||
54 | * Constructor: This contructor takes three - optional - arguments. | ||
55 | * The first two parameters are simply passed on to @ref QLineEdit. | ||
56 | * @param parent pointer to the parent widget | ||
57 | * @param name pointer to the name of this widget | ||
58 | * @param valid pointer to set of valid characters | ||
59 | */ | ||
60 | QRestrictedCombo( QWidget *parent=0, const char *name=0, | ||
61 | const QString& valid = QString::null); | ||
62 | |||
63 | /** | ||
64 | * Destructs the restricted line editor. | ||
65 | */ | ||
66 | ~QRestrictedCombo(); | ||
67 | |||
68 | /** | ||
69 | * All characters in the string valid are treated as | ||
70 | * acceptable characters. | ||
71 | */ | ||
72 | void setValidChars(const QString& valid); | ||
73 | /** | ||
74 | * @return the string of acceptable characters. | ||
75 | */ | ||
76 | QString validChars() const; | ||
77 | |||
78 | signals: | ||
79 | |||
80 | /** | ||
81 | * Emitted when an invalid character was typed. | ||
82 | */ | ||
83 | voidinvalidChar(int); | ||
84 | |||
85 | protected: | ||
86 | /** | ||
87 | * @reimplemented | ||
88 | */ | ||
89 | voidkeyPressEvent( QKeyEvent *e ); | ||
90 | |||
91 | private: | ||
92 | /// QString of valid characters for this line | ||
93 | QStringqsValidChars; | ||
94 | }; | ||
95 | |||
96 | #endif // QRESTRICTEDCOMBO_H | ||