source: trunk/include/qlineedit.h@ 138

Last change on this file since 138 was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 7.4 KB
Line 
1/**********************************************************************
2** $Id: qlineedit.h 2 2005-11-16 15:49:26Z dmik $
3**
4** Definition of QLineEdit widget class
5**
6** Created : 941011
7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9**
10** This file is part of the widgets module of the Qt GUI Toolkit.
11**
12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file.
15**
16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software.
24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37
38#ifndef QLINEEDIT_H
39#define QLINEEDIT_H
40
41struct QLineEditPrivate;
42
43class QValidator;
44class QPopupMenu;
45
46#ifndef QT_H
47#include "qframe.h"
48#include "qstring.h"
49#endif // QT_H
50
51#ifndef QT_NO_LINEEDIT
52
53class QTextParagraph;
54class QTextCursor;
55
56class Q_EXPORT QLineEdit : public QFrame
57{
58 Q_OBJECT
59 Q_ENUMS( EchoMode )
60 Q_PROPERTY( QString text READ text WRITE setText )
61 Q_PROPERTY( int maxLength READ maxLength WRITE setMaxLength )
62 Q_PROPERTY( bool frame READ frame WRITE setFrame )
63 Q_PROPERTY( EchoMode echoMode READ echoMode WRITE setEchoMode )
64 Q_PROPERTY( QString displayText READ displayText )
65 Q_PROPERTY( int cursorPosition READ cursorPosition WRITE setCursorPosition )
66 Q_PROPERTY( Alignment alignment READ alignment WRITE setAlignment )
67 Q_PROPERTY( bool edited READ edited WRITE setEdited DESIGNABLE false )
68 Q_PROPERTY( bool modified READ isModified )
69 Q_PROPERTY( bool hasMarkedText READ hasMarkedText DESIGNABLE false )
70 Q_PROPERTY( bool hasSelectedText READ hasSelectedText )
71 Q_PROPERTY( QString markedText READ markedText DESIGNABLE false )
72 Q_PROPERTY( QString selectedText READ selectedText )
73 Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled )
74 Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
75 Q_PROPERTY( bool undoAvailable READ isUndoAvailable )
76 Q_PROPERTY( bool redoAvailable READ isRedoAvailable )
77 Q_PROPERTY( QString inputMask READ inputMask WRITE setInputMask )
78 Q_PROPERTY( bool acceptableInput READ hasAcceptableInput )
79
80public:
81 QLineEdit( QWidget* parent, const char* name=0 );
82 QLineEdit( const QString &, QWidget* parent, const char* name=0 );
83 QLineEdit( const QString &, const QString &, QWidget* parent, const char* name=0 );
84 ~QLineEdit();
85
86 QString text() const;
87
88 QString displayText() const;
89
90 int maxLength() const;
91
92 bool frame() const;
93
94 enum EchoMode { Normal, NoEcho, Password };
95 EchoMode echoMode() const;
96
97 bool isReadOnly() const;
98
99 const QValidator * validator() const;
100
101 QSize sizeHint() const;
102 QSize minimumSizeHint() const;
103
104 int cursorPosition() const;
105 bool validateAndSet( const QString &, int, int, int ); // obsolete
106
107 int alignment() const;
108
109#ifndef QT_NO_COMPAT
110 void cursorLeft( bool mark, int steps = 1 ) { cursorForward( mark, -steps ); }
111 void cursorRight( bool mark, int steps = 1 ) { cursorForward( mark, steps ); }
112#endif
113 void cursorForward( bool mark, int steps = 1 );
114 void cursorBackward( bool mark, int steps = 1 );
115 void cursorWordForward( bool mark );
116 void cursorWordBackward( bool mark );
117 void backspace();
118 void del();
119 void home( bool mark );
120 void end( bool mark );
121
122 bool isModified() const;
123 void clearModified();
124
125 bool edited() const; // obsolete, use isModified()
126 void setEdited( bool ); // obsolete, use clearModified()
127
128 bool hasSelectedText() const;
129 QString selectedText() const;
130 int selectionStart() const;
131
132 bool isUndoAvailable() const;
133 bool isRedoAvailable() const;
134
135#ifndef QT_NO_COMPAT
136 bool hasMarkedText() const { return hasSelectedText(); }
137 QString markedText() const { return selectedText(); }
138#endif
139
140 bool dragEnabled() const;
141
142 QString inputMask() const;
143 void setInputMask( const QString &inputMask );
144 bool hasAcceptableInput() const;
145
146public slots:
147 virtual void setText( const QString &);
148 virtual void selectAll();
149 virtual void deselect();
150 virtual void clearValidator();
151 virtual void insert( const QString &);
152 virtual void clear();
153 virtual void undo();
154 virtual void redo();
155 virtual void setMaxLength( int );
156 virtual void setFrame( bool );
157 virtual void setEchoMode( EchoMode );
158 virtual void setReadOnly( bool );
159 virtual void setValidator( const QValidator * );
160 virtual void setFont( const QFont & );
161 virtual void setPalette( const QPalette & );
162 virtual void setSelection( int, int );
163 virtual void setCursorPosition( int );
164 virtual void setAlignment( int flag );
165#ifndef QT_NO_CLIPBOARD
166 virtual void cut();
167 virtual void copy() const;
168 virtual void paste();
169#endif
170 virtual void setDragEnabled( bool b );
171
172signals:
173 void textChanged( const QString &);
174 void returnPressed();
175 void lostFocus();
176 void selectionChanged();
177
178protected:
179 bool event( QEvent * );
180 void mousePressEvent( QMouseEvent * );
181 void mouseMoveEvent( QMouseEvent * );
182 void mouseReleaseEvent( QMouseEvent * );
183 void mouseDoubleClickEvent( QMouseEvent * );
184 void keyPressEvent( QKeyEvent * );
185 void imStartEvent( QIMEvent * );
186 void imComposeEvent( QIMEvent * );
187 void imEndEvent( QIMEvent * );
188 void focusInEvent( QFocusEvent * );
189 void focusOutEvent( QFocusEvent * );
190 void resizeEvent( QResizeEvent * );
191 void drawContents( QPainter * );
192#ifndef QT_NO_DRAGANDDROP
193 void dragEnterEvent( QDragEnterEvent * );
194 void dragMoveEvent( QDragMoveEvent *e );
195 void dragLeaveEvent( QDragLeaveEvent *e );
196 void dropEvent( QDropEvent * );
197#endif
198 void contextMenuEvent( QContextMenuEvent * );
199 virtual QPopupMenu *createPopupMenu();
200 void windowActivationChange( bool );
201#ifndef QT_NO_COMPAT
202 void repaintArea( int, int ) { update(); }
203#endif
204
205private slots:
206 void clipboardChanged();
207
208public:
209 void setPasswordChar( QChar c ); // internal obsolete
210 QChar passwordChar() const; // obsolete internal
211 int characterAt( int, QChar* ) const; // obsolete
212 bool getSelection( int *, int * ); // obsolete
213
214private:
215 friend struct QLineEditPrivate;
216 QLineEditPrivate * d;
217
218private: // Disabled copy constructor and operator=
219#if defined(Q_DISABLE_COPY)
220 QLineEdit( const QLineEdit & );
221 QLineEdit &operator=( const QLineEdit & );
222#endif
223};
224
225
226#endif // QT_NO_LINEEDIT
227
228#endif // QLINEEDIT_H
Note: See TracBrowser for help on using the repository browser.