libyui-qt
Loading...
Searching...
No Matches
YQInputField.h
1/*
2 Copyright (C) 2000-2012 Novell, Inc
3 This library is free software; you can redistribute it and/or modify
4 it under the terms of the GNU Lesser General Public License as
5 published by the Free Software Foundation; either version 2.1 of the
6 License, or (at your option) version 3.0 of the License. This library
7 is distributed in the hope that it will be useful, but WITHOUT ANY
8 WARRANTY; without even the implied warranty of MERCHANTABILITY or
9 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10 License for more details. You should have received a copy of the GNU
11 Lesser General Public License along with this library; if not, write
12 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13 Floor, Boston, MA 02110-1301 USA
14*/
15
16
17/*-/
18
19 File: YQInputField.h
20
21 Author: Stefan Hundhammer <shundhammer@suse.de>
22
23/-*/
24
25
26#ifndef YQInputField_h
27#define YQInputField_h
28
29#include <QFrame>
30#include <qlineedit.h>
31
32#include <yui/YInputField.h>
33
34class QString;
36class YQWidgetCaption;
37class YQRawLineEdit;
38
39using std::string;
40
41
42class YQInputField : public QFrame, public YInputField
43{
44 Q_OBJECT
45
46public:
50 YQInputField( YWidget * parent,
51 const std::string & label,
52 bool passwordMode = false );
53
60 virtual std::string value();
61
68 virtual void setValue( const std::string & text );
69
75 virtual void setLabel( const std::string & label );
76
83 virtual void setValidChars( const std::string & validChars );
84
90 virtual void setInputMaxLength( int numberOfChars );
91
95 bool isValidText( const QString & text ) const;
96
102 virtual void setEnabled( bool enabled );
103
109 virtual int preferredWidth();
110
116 virtual int preferredHeight();
117
123 virtual void setSize( int newWidth, int newHeight );
124
130 virtual bool setKeyboardFocus();
131
132
133protected slots:
138 void changed( const QString & );
139
145
150
151
152protected:
153
154 YQWidgetCaption * _caption;
155 YQRawLineEdit * _qt_lineEdit;
156 QY2CharValidator * _validator;
157 bool _shrinkable;
158 bool _displayingCapsLockWarning;
159};
160
161
166class YQRawLineEdit: public QLineEdit
167{
168 Q_OBJECT
169
170public:
171
175 YQRawLineEdit( QWidget * parent )
176 : QLineEdit( parent )
177 , _capsLockActive( false )
178 {}
179
183 virtual ~YQRawLineEdit() {};
184
189 bool isCapsLockActive() const { return _capsLockActive; }
190
191
192signals:
193 void capsLockActivated();
194 void capsLockDeactivated();
195
196protected:
197
198#if 0
199 // FIXME: This doesn't work anymore since Qt 5.x; there is no more QWidget::x11Event().
200 // We need to find a replacement for CapsLock detection.
201
208 bool x11Event( XEvent * event ) ;
209#endif
210
211private:
212
213 bool _capsLockActive;
214};
215
216#endif // YQInputField_h
Definition QY2CharValidator.h:35
Definition YQInputField.h:43
void changed(const QString &)
Definition YQInputField.cc:204
virtual void setEnabled(bool enabled)
Definition YQInputField.cc:111
virtual bool setKeyboardFocus()
Definition YQInputField.cc:195
virtual void setValue(const std::string &text)
Definition YQInputField.cc:95
virtual int preferredWidth()
Definition YQInputField.cc:119
virtual void setSize(int newWidth, int newHeight)
Definition YQInputField.cc:136
YQInputField(YWidget *parent, const std::string &label, bool passwordMode=false)
Definition YQInputField.cc:47
virtual void setLabel(const std::string &label)
Definition YQInputField.cc:142
virtual std::string value()
Definition YQInputField.cc:89
bool isValidText(const QString &text) const
Definition YQInputField.cc:149
virtual void setValidChars(const std::string &validChars)
Definition YQInputField.cc:161
void clearCapsLockWarning()
Definition YQInputField.cc:235
virtual void setInputMaxLength(int numberOfChars)
Definition YQInputField.cc:189
void displayCapsLockWarning()
Definition YQInputField.cc:211
virtual int preferredHeight()
Definition YQInputField.cc:130
Definition YQInputField.h:167
bool isCapsLockActive() const
Definition YQInputField.h:189
virtual ~YQRawLineEdit()
Definition YQInputField.h:183
YQRawLineEdit(QWidget *parent)
Definition YQInputField.h:175
Definition YQWidgetCaption.h:39