1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722
|
'\" t
.TH QLineEdit 3qt "18 March 2002" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QLineEdit \- One-line text editor
.SH SYNOPSIS
\fC#include <qlineedit.h>\fR
.PP
Inherits QFrame.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQLineEdit\fR ( QWidget * parent, const char * name = 0 )"
.br
.ti -1c
.BI "\fBQLineEdit\fR ( const QString & contents, QWidget * parent, const char * name = 0 )"
.br
.ti -1c
.BI "\fB~QLineEdit\fR ()"
.br
.ti -1c
.BI "QString \fBtext\fR () const"
.br
.ti -1c
.BI "QString \fBdisplayText\fR () const"
.br
.ti -1c
.BI "int \fBmaxLength\fR () const"
.br
.ti -1c
.BI "bool \fBframe\fR () const"
.br
.ti -1c
.BI "enum \fBEchoMode\fR { Normal, NoEcho, Password }"
.br
.ti -1c
.BI "EchoMode \fBechoMode\fR () const"
.br
.ti -1c
.BI "bool \fBisReadOnly\fR () const"
.br
.ti -1c
.BI "const QValidator * \fBvalidator\fR () const"
.br
.ti -1c
.BI "virtual QSize \fBsizeHint\fR () const"
.br
.ti -1c
.BI "virtual QSize \fBminimumSizeHint\fR () const"
.br
.ti -1c
.BI "int \fBcursorPosition\fR () const"
.br
.ti -1c
.BI "bool \fBvalidateAndSet\fR ( const QString & newText, int newPos, int newMarkAnchor, int newMarkDrag )"
.br
.ti -1c
.BI "int \fBalignment\fR () const"
.br
.ti -1c
.BI "void cursorLeft ( bool mark, int steps = 1 ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "void cursorRight ( bool mark, int steps = 1 ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "void \fBcursorForward\fR ( bool mark, int steps = 1 )"
.br
.ti -1c
.BI "void \fBcursorBackward\fR ( bool mark, int steps = 1 )"
.br
.ti -1c
.BI "void \fBcursorWordForward\fR ( bool mark )"
.br
.ti -1c
.BI "void \fBcursorWordBackward\fR ( bool mark )"
.br
.ti -1c
.BI "void \fBbackspace\fR ()"
.br
.ti -1c
.BI "void \fBdel\fR ()"
.br
.ti -1c
.BI "void \fBhome\fR ( bool mark )"
.br
.ti -1c
.BI "void \fBend\fR ( bool mark )"
.br
.ti -1c
.BI "void \fBsetEdited\fR ( bool )"
.br
.ti -1c
.BI "bool \fBedited\fR () const"
.br
.ti -1c
.BI "bool \fBhasSelectedText\fR () const"
.br
.ti -1c
.BI "QString \fBselectedText\fR () const"
.br
.ti -1c
.BI "bool \fBgetSelection\fR ( int * start, int * end )"
.br
.ti -1c
.BI "bool \fBisUndoAvailable\fR () const"
.br
.ti -1c
.BI "bool \fBisRedoAvailable\fR () const"
.br
.ti -1c
.BI "bool hasMarkedText () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "QString markedText () const \fI(obsolete)\fR"
.br
.ti -1c
.BI "void \fBsetPasswordChar\fR ( QChar c )"
.br
.ti -1c
.BI "QChar \fBpasswordChar\fR () const"
.br
.ti -1c
.BI "bool \fBdragEnabled\fR () const"
.br
.ti -1c
.BI "int \fBcharacterAt\fR ( int xpos, QChar * chr ) const"
.br
.in -1c
.SS "Public Slots"
.in +1c
.ti -1c
.BI "virtual void \fBsetText\fR ( const QString & )"
.br
.ti -1c
.BI "virtual void \fBselectAll\fR ()"
.br
.ti -1c
.BI "virtual void \fBdeselect\fR ()"
.br
.ti -1c
.BI "virtual void \fBclearValidator\fR ()"
.br
.ti -1c
.BI "virtual void \fBinsert\fR ( const QString & newText )"
.br
.ti -1c
.BI "virtual void \fBclear\fR ()"
.br
.ti -1c
.BI "virtual void \fBundo\fR ()"
.br
.ti -1c
.BI "virtual void \fBredo\fR ()"
.br
.ti -1c
.BI "virtual void \fBsetMaxLength\fR ( int )"
.br
.ti -1c
.BI "virtual void \fBsetFrame\fR ( bool )"
.br
.ti -1c
.BI "virtual void \fBsetEchoMode\fR ( EchoMode )"
.br
.ti -1c
.BI "virtual void \fBsetReadOnly\fR ( bool )"
.br
.ti -1c
.BI "virtual void \fBsetValidator\fR ( const QValidator * v )"
.br
.ti -1c
.BI "virtual void \fBsetSelection\fR ( int start, int length )"
.br
.ti -1c
.BI "virtual void \fBsetCursorPosition\fR ( int )"
.br
.ti -1c
.BI "virtual void \fBsetAlignment\fR ( int flag )"
.br
.ti -1c
.BI "virtual void \fBcut\fR ()"
.br
.ti -1c
.BI "virtual void \fBcopy\fR () const"
.br
.ti -1c
.BI "virtual void \fBpaste\fR ()"
.br
.ti -1c
.BI "virtual void \fBsetDragEnabled\fR ( bool b )"
.br
.in -1c
.SS "Signals"
.in +1c
.ti -1c
.BI "void \fBtextChanged\fR ( const QString & )"
.br
.ti -1c
.BI "void \fBreturnPressed\fR ()"
.br
.ti -1c
.BI "void \fBselectionChanged\fR ()"
.br
.in -1c
.SS "Properties"
.in +1c
.ti -1c
.BI "Alignment \fBalignment\fR - the alignment of the line edit"
.br
.ti -1c
.BI "int \fBcursorPosition\fR - the current cursor position for this line edit"
.br
.ti -1c
.BI "QString \fBdisplayText\fR - the text that is displayed \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "bool \fBdragEnabled\fR - whether the lineedit starts a drag if the user presses and moves the mouse on some selected text"
.br
.ti -1c
.BI "EchoMode \fBechoMode\fR - the echo mode of the line edit"
.br
.ti -1c
.BI "bool \fBedited\fR - the edited flag of the line edit"
.br
.ti -1c
.BI "bool \fBframe\fR - whether the line edit draws itself with a frame"
.br
.ti -1c
.BI "bool hasMarkedText - whether part of the text has been selected by the user (e.g. by clicking and " "dragging" ") \fI(read " "only" ")\fR \fI(obsolete)\fR"
.br
.ti -1c
.BI "bool \fBhasSelectedText\fR - whether there is any text selected \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "QString markedText - the text selected by the user (e.g. by clicking and " "dragging" "), or QString::null if no text is selected \fI(read " "only" ")\fR \fI(obsolete)\fR"
.br
.ti -1c
.BI "int \fBmaxLength\fR - the maximum permitted length of the text in the editor"
.br
.ti -1c
.BI "bool \fBreadOnly\fR - whether the line edit is read only"
.br
.ti -1c
.BI "bool \fBredoAvailable\fR - whether redo is available \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "QString \fBselectedText\fR - any text selected by the user or QString::null \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "QString \fBtext\fR - the text in the line"
.br
.ti -1c
.BI "bool \fBundoAvailable\fR - whether undo is available \fI(read " "only" ")\fR"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "virtual void \fBkeyPressEvent\fR ( QKeyEvent * e )"
.br
.ti -1c
.BI "void repaintArea ( int from, int to ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "virtual QPopupMenu * \fBcreatePopupMenu\fR ()"
.br
.in -1c
.SH DESCRIPTION
The QLineEdit widget is a one-line text editor.
.PP
A line edit allows the user to enter and edit a single line of plain text with a useful collection of editing functions, including undo and redo, cut and paste, and drag and drop.
.PP
By changing the echoMode() of a line edit, it can also be used as a" write-only" field, for inputs such as passwords.
.PP
The length of the field can be constrained to maxLength(), or the value can be arbitrarily constrained by setting a validator().
.PP
A closely related class is QTextEdit which allows multi-line, rich-text editing.
.PP
You can change the text with setText() or insert(). The text is retrieved with text(); the displayed text (which may be different, see EchoMode) is retrieved with displayText(). Text can be selected with setSelection() or selectAll(), and the selection can be cut(), copy()ied and paste()d. The text can be aligned with setAlignment().
.PP
When the text changes the textChanged() signal is emitted; when the Return or Enter key is pressed the returnPressed() signal is emitted.
.PP
By default, QLineEdits have a frame as specified by the Windows and Motif style guides; you can turn it off by calling setFrame(FALSE).
.PP
The default key bindings are described below. A right mouse button menu presents some of the editing commands to the user.
.TP
\fILeft\fR Arrow - moves the cursor one character to the left.
.TP
\fIRight\fR Arrow - moves the cursor one character to the right.
.TP
\fIBackspace\fR - deletes the character to the left of the cursor.
.TP
\fIHome\fR - moves the cursor to the beginning of the line.
.TP
\fIEnd\fR - moves the cursor to the end of the line.
.TP
\fIDelete\fR - deletes the character to the right of the cursor.
.TP
\fIShift+Left\fR Arrow - moves and selects text one character to the left.
.TP
\fIShift+Right\fR Arrow - moves and selects text one character to the right.
.TP
\fICtrl+A\fR - moves the cursor to the beginning of the line.
.TP
\fICtrl+B\fR - moves the cursor one character to the left.
.TP
\fICtrl+C\fR - copies the selected text to the clipboard. (Windows also supports Ctrl+Insert for this operation.)
.TP
\fICtrl+D\fR - deletes the character to the right of the cursor.
.TP
\fICtrl+E\fR - moves the cursor to the end of the line.
.TP
\fICtrl+F\fR - moves the cursor one character to the right.
.TP
\fICtrl+H\fR - deletes the character to the left of the cursor.
.TP
\fICtrl+K\fR - deletes to the end of the line.
.TP
\fICtrl+V\fR - pastes the clipboard text into line edit. (Windows also supports Shift+Insert for this operation.)
.TP
\fICtrl+X\fR - deletes the selected text and copies it to the clipboard. (Windows also supports Shift+Delete for this operation.)
.TP
\fICtrl+Z\fR - undoes the last operation.
.TP
\fICtrl+Y\fR - redoes the last undone operation.
.PP
Any other key sequence, that represents a valid character, will cause the character to be inserted into the line.
.PP
.ce 1
.B "[Image Omitted]"
.PP
.ce 1
.B "[Image Omitted]"
.PP
See also QTextEdit, QLabel, QComboBox, GUI Design Handbook: Field, Entry and Basic Widgets.
.SS "Member Type Documentation"
.SH "QLineEdit::EchoMode"
This enum type describes how a line edit should display its contents. The defined values are:
.TP
\fCQLineEdit::Normal\fR - display characters as they are entered. This is the default.
.TP
\fCQLineEdit::NoEcho\fR - do not display anything. This may be appropriate for passwords where even the length of the password should be kept secret.
.TP
\fCQLineEdit::Password\fR - display asterisks instead of the characters actually entered.
.PP
See also echoMode and echoMode.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QLineEdit::QLineEdit ( QWidget * parent, const char * name = 0 )"
Constructs a line edit with no text.
.PP
The maximum text length is set to 32767 characters.
.PP
The \fIparent\fR and \fIname\fR arguments are sent to the QWidget constructor.
.PP
See also text and maxLength.
.SH "QLineEdit::QLineEdit ( const QString & contents, QWidget * parent, const char * name = 0 )"
Constructs a line edit containing the text \fIcontents\fR.
.PP
The cursor position is set to the end of the line and the maximum text length to 32767 characters.
.PP
The \fIparent\fR and \fIname\fR arguments are sent to the QWidget constructor.
.PP
See also text and maxLength.
.SH "QLineEdit::~QLineEdit ()"
Destroys the line edit.
.SH "int QLineEdit::alignment () const"
Returns the alignment of the line edit. See the "alignment" property for details.
.SH "void QLineEdit::backspace ()"
Deletes the character to the left of the text cursor and moves the cursor one position to the left. If any text has been selected by the user (e.g. by clicking and dragging), the cursor will be put at the beginning of the selected text and the selected text will be removed.
.PP
See also del().
.SH "int QLineEdit::characterAt ( int xpos, QChar * chr ) const"
Returns the index position of the character which is at \fIxpos\fR (in logical coordinates from the left). If \fIchr\fR is not 0, \fC*<em>chr</em>\fR is populated with the character at this position.
.SH "void QLineEdit::clear ()\fC [virtual slot]\fR"
Clears the contents of the editor. This is equivalent to setText("").
.SH "void QLineEdit::clearValidator ()\fC [virtual slot]\fR"
This slot is equivalent to setValidator( 0 ).
.SH "void QLineEdit::copy () const\fC [virtual slot]\fR"
Copies the selected text to the clipboard, if there is any, and if echoMode() is Normal.
.PP
See also cut() and paste().
.SH "QPopupMenu * QLineEdit::createPopupMenu ()\fC [virtual protected]\fR"
This function is called to create the popup menu which is shown when the user clicks on the lineedit with the right mouse button. If you want to create a custom popup menu, reimplement this function and return the popup menu you create. The popup menu's ownership is transferred to the caller.
.SH "void QLineEdit::cursorBackward ( bool mark, int steps = 1 )"
Moves the cursor back \fIsteps\fR characters. If \fImark\fR is TRUE each character moved over is added to the selection; if \fImark\fR is FALSE the selection is cleared.
.PP
See also cursorForward().
.SH "void QLineEdit::cursorForward ( bool mark, int steps = 1 )"
Moves the cursor forward \fIsteps\fR characters. If \fImark\fR is TRUE each character moved over is added to the selection; if \fImark\fR is FALSE the selection is cleared.
.PP
See also cursorBackward().
.SH "void QLineEdit::cursorLeft ( bool mark, int steps = 1 )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
For compatibilty with older applications only. Use cursorBackward() instead.
.PP
See also cursorBackward().
.SH "int QLineEdit::cursorPosition () const"
Returns the current cursor position for this line edit. See the "cursorPosition" property for details.
.SH "void QLineEdit::cursorRight ( bool mark, int steps = 1 )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Use cursorForward() instead.
.PP
See also cursorForward().
.SH "void QLineEdit::cursorWordBackward ( bool mark )"
Moves the cursor one word backward. If \fImark\fR is TRUE, the word is also selected.
.PP
See also cursorWordForward().
.SH "void QLineEdit::cursorWordForward ( bool mark )"
Moves the cursor one word forward. If \fImark\fR is TRUE, the word is also selected.
.PP
See also cursorWordBackward().
.SH "void QLineEdit::cut ()\fC [virtual slot]\fR"
Copies the selected text to the clipboard and deletes it, if there is any, and if echoMode() is Normal.
.PP
If the current validator disallows deleting the selected text, cut() will copy it but not delete it.
.PP
See also copy() and paste().
.SH "void QLineEdit::del ()"
Deletes the character on the right side of the text cursor. If any text has been selected by the user (e.g. by clicking and dragging), the cursor will be put at the beginning of the selected text and the selected text will be removed.
.PP
See also backspace().
.SH "void QLineEdit::deselect ()\fC [virtual slot]\fR"
De-selects all text (i.e. removes highlighting) and leaves the cursor at the current position.
.PP
See also setSelection() and selectAll().
.SH "QString QLineEdit::displayText () const"
Returns the text that is displayed. See the "displayText" property for details.
.SH "bool QLineEdit::dragEnabled () const"
Returns TRUE if the lineedit starts a drag if the user presses and moves the mouse on some selected text; otherwise returns FALSE. See the "dragEnabled" property for details.
.SH "EchoMode QLineEdit::echoMode () const"
Returns the echo mode of the line edit. See the "echoMode" property for details.
.SH "bool QLineEdit::edited () const"
Returns the edited flag of the line edit. See the "edited" property for details.
.SH "void QLineEdit::end ( bool mark )"
Moves the text cursor to the end of the line. If \fImark\fR is TRUE, text is selected towards the last position; otherwise, any selected text is unselected if the cursor is moved.
.PP
See also home().
.SH "bool QLineEdit::frame () const"
Returns TRUE if the line edit draws itself with a frame; otherwise returns FALSE. See the "frame" property for details.
.SH "bool QLineEdit::getSelection ( int * start, int * end )"
This function sets \fC*<em>start</em>\fR to the position in the text where the selection starts and \fC*<em>end</em>\fR to the position where the selection ends. Returns TRUE if \fIstart\fR and \fIend\fR are not null and if there is some selected text; otherwise returns FALSE.
.PP
See also setSelection().
.SH "bool QLineEdit::hasMarkedText () const"
Returns TRUE if part of the text has been selected by the user (e.g. by clicking and dragging); otherwise returns FALSE. See the "hasMarkedText" property for details.
.SH "bool QLineEdit::hasSelectedText () const"
Returns TRUE if there is any text selected; otherwise returns FALSE. See the "hasSelectedText" property for details.
.SH "void QLineEdit::home ( bool mark )"
Moves the text cursor to the beginning of the line. If \fImark\fR is TRUE, text is selected towards the first position; otherwise, any selected text is unselected if the cursor is moved.
.PP
See also end().
.SH "void QLineEdit::insert ( const QString & newText )\fC [virtual slot]\fR"
Removes any selected text, inserts \fInewText\fR, and validates the result. If it is valid, it sets it as the new contents of the line edit.
.SH "bool QLineEdit::isReadOnly () const"
Returns TRUE if the line edit is read only; otherwise returns FALSE. See the "readOnly" property for details.
.SH "bool QLineEdit::isRedoAvailable () const"
Returns TRUE if redo is available; otherwise returns FALSE. See the "redoAvailable" property for details.
.SH "bool QLineEdit::isUndoAvailable () const"
Returns TRUE if undo is available; otherwise returns FALSE. See the "undoAvailable" property for details.
.SH "void QLineEdit::keyPressEvent ( QKeyEvent * e )\fC [virtual protected]\fR"
Converts key press event \fIe\fR into a line edit action.
.PP
If Return or Enter is pressed and the current text is valid (or can be made valid by the validator), the signal returnPressed is emitted.
.PP
The default key bindings are listed in the detailed description.
.PP
Reimplemented from QWidget.
.SH "QString QLineEdit::markedText () const"
Returns the text selected by the user (e.g. by clicking and dragging), or QString::null if no text is selected. See the "markedText" property for details.
.SH "int QLineEdit::maxLength () const"
Returns the maximum permitted length of the text in the editor. See the "maxLength" property for details.
.SH "QSize QLineEdit::minimumSizeHint () const\fC [virtual]\fR"
Returns a minimum size for the line edit.
.PP
The width returned is enough for at least one character.
.PP
Reimplemented from QWidget.
.SH "QChar QLineEdit::passwordChar () const"
Returns the password character.
.PP
See also setPasswordChar().
.SH "void QLineEdit::paste ()\fC [virtual slot]\fR"
Inserts the clipboard's text at the cursor position, deleting any selected text.
.PP
If the end result is not acceptable for the current validator, nothing happens.
.PP
See also copy() and cut().
.SH "void QLineEdit::redo ()\fC [virtual slot]\fR"
Redoes the last operation
.SH "void QLineEdit::repaintArea ( int from, int to )\fC [protected]\fR"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Repaints all characters from \fIfrom\fR to \fIto\fR. If cursorPos is between from and to, ensures that cursorPos is visible.
.SH "void QLineEdit::returnPressed ()\fC [signal]\fR"
This signal is emitted when the Return or Enter key is pressed.
.PP
Example: popup/popup.cpp.
.SH "void QLineEdit::selectAll ()\fC [virtual slot]\fR"
Selects all the text (i.e. highlights it) and moves the cursor to the end. This is useful when a default value has been inserted because if the user types before clicking on the widget, the selected text will be erased.
.PP
See also setSelection() and deselect().
.SH "QString QLineEdit::selectedText () const"
Returns any text selected by the user or QString::null. See the "selectedText" property for details.
.SH "void QLineEdit::selectionChanged ()\fC [signal]\fR"
This signal is emitted whenever the selection changes.
.PP
See also hasSelectedText and selectedText.
.SH "void QLineEdit::setAlignment ( int flag )\fC [virtual slot]\fR"
Sets the alignment of the line edit to \fIflag\fR. See the "alignment" property for details.
.SH "void QLineEdit::setCursorPosition ( int )\fC [virtual slot]\fR"
Sets the current cursor position for this line edit. See the "cursorPosition" property for details.
.SH "void QLineEdit::setDragEnabled ( bool b )\fC [virtual slot]\fR"
Sets whether the lineedit starts a drag if the user presses and moves the mouse on some selected text to \fIb\fR. See the "dragEnabled" property for details.
.SH "void QLineEdit::setEchoMode ( EchoMode )\fC [virtual slot]\fR"
Sets the echo mode of the line edit. See the "echoMode" property for details.
.SH "void QLineEdit::setEdited ( bool )"
Sets the edited flag of the line edit. See the "edited" property for details.
.SH "void QLineEdit::setFrame ( bool )\fC [virtual slot]\fR"
Sets whether the line edit draws itself with a frame. See the "frame" property for details.
.SH "void QLineEdit::setMaxLength ( int )\fC [virtual slot]\fR"
Sets the maximum permitted length of the text in the editor. See the "maxLength" property for details.
.SH "void QLineEdit::setPasswordChar ( QChar c )"
Sets the password character to \fIc\fR.
.PP
See also passwordChar().
.SH "void QLineEdit::setReadOnly ( bool )\fC [virtual slot]\fR"
Sets whether the line edit is read only. See the "readOnly" property for details.
.SH "void QLineEdit::setSelection ( int start, int length )\fC [virtual slot]\fR"
Sets the selected area of this line edit to start at position \fIstart\fR and be \fIlength\fR characters long.
.PP
See also deselect(), selectAll() and getSelection().
.SH "void QLineEdit::setText ( const QString & )\fC [virtual slot]\fR"
Sets the text in the line. See the "text" property for details.
.SH "void QLineEdit::setValidator ( const QValidator * v )\fC [virtual slot]\fR"
Sets this line edit to accept input only as accepted by the validator, \fIv\fR, allowing arbitrary constraints on the text which may be entered.
.PP
If \fIv\fR == 0, setValidator() removes the current input validator. The initial setting is to have no input validator (i.e. any input is accepted up to maxLength()).
.PP
See also validator() and QValidator.
.PP
Examples:
.)l lineedits/lineedits.cpp and wizard/wizard.cpp.
.SH "QSize QLineEdit::sizeHint () const\fC [virtual]\fR"
Returns a recommended size for the widget.
.PP
The width returned, in pixels, is usually enough for about 15 to 20 characters.
.PP
Example: addressbook/centralwidget.cpp.
.SH "QString QLineEdit::text () const"
Returns the text in the line. See the "text" property for details.
.SH "void QLineEdit::textChanged ( const QString & )\fC [signal]\fR"
This signal is emitted whenever the text changes. The argument is the new text.
.PP
Examples:
.)l wizard/wizard.cpp and xform/xform.cpp.
.SH "void QLineEdit::undo ()\fC [virtual slot]\fR"
Undoes the last operation
.SH "bool QLineEdit::validateAndSet ( const QString & newText, int newPos, int newMarkAnchor, int newMarkDrag )"
Validates and perhaps sets this line edit to contain \fInewText\fR with the cursor at position \fInewPos\fR, with selected text from \fInewMarkAnchor\fR to \fInewMarkDrag\fR. Returns TRUE if it changes the line edit; otherwise returns FALSE.
.PP
Linebreaks in \fInewText\fR are converted to spaces, and the text is truncated to maxLength() before its validity is tested.
.PP
Repaints and emits textChanged() if appropriate.
.SH "const QValidator * QLineEdit::validator () const"
Returns a pointer to the current input validator, or 0 if no validator has been set.
.PP
See also setValidator().
.PP
Example: wizard/wizard.cpp.
.SS "Property Documentation"
.SH "Alignment alignment"
This property holds the alignment of the line edit.
.PP
Possible Values are Qt::AlignAuto, Qt::AlignLeft, Qt::AlignRight and Qt::AlignHCenter.
.PP
Attempting to set the alignment to an illegal flag combination does nothing.
.PP
See also Qt::AlignmentFlags.
.PP
Set this property's value with setAlignment() and get this property's value with alignment().
.SH "int cursorPosition"
This property holds the current cursor position for this line edit.
.PP
Setting the cursor position causes a repaint when appropriate.
.PP
Set this property's value with setCursorPosition() and get this property's value with cursorPosition().
.SH "QString displayText"
This property holds the text that is displayed.
.PP
If EchoMode is Normal this returns the same as text(); if EchoMode is Password it returns a string of asterisks the text().length() characters long, e.g. "******"; if EchoMode is NoEcho returns an empty string, "".
.PP
See also echoMode, text and EchoMode.
.PP
Get this property's value with displayText().
.SH "bool dragEnabled"
This property holds whether the lineedit starts a drag if the user presses and moves the mouse on some selected text.
.PP
Set this property's value with setDragEnabled() and get this property's value with dragEnabled().
.SH "EchoMode echoMode"
This property holds the echo mode of the line edit.
.PP
The initial setting is Normal, but QLineEdit also supports NoEcho and Password modes.
.PP
The widget's display and the ability to copy or drag the text is affected by this setting.
.PP
See also EchoMode and displayText.
.PP
Set this property's value with setEchoMode() and get this property's value with echoMode().
.SH "bool edited"
This property holds the edited flag of the line edit.
.PP
The edited flag is never read by QLineEdit; it has a default value of FALSE and is changed to TRUE whenever the user changes the line edit's contents.
.PP
This is useful for things that need to provide a default value but cannot find the default at once. Just start the line edit without the best default; when the default is known, check the edited() return value and set the line edit's contents if the user has not started editing the line edit.
.PP
Calling setText() resets the edited flag to FALSE.
.PP
Set this property's value with setEdited() and get this property's value with edited().
.SH "bool frame"
This property holds whether the line edit draws itself with a frame.
.PP
If enabled (the default) the line edit draws itself inside a two-pixel frame, otherwise the line edit draws itself without any frame.
.PP
Set this property's value with setFrame() and get this property's value with frame().
.SH "bool hasMarkedText"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
This property holds whether part of the text has been selected by the user (e.g. by clicking and dragging).
.PP
Get this property's value with hasMarkedText().
.PP
See also selectedText.
.SH "bool hasSelectedText"
This property holds whether there is any text selected.
.PP
hasSelectedText() returns TRUE if some or all of the text has been selected by the user (e.g. by clicking and dragging); otherwise returns FALSE.
.PP
See also selectedText.
.PP
Get this property's value with hasSelectedText().
.SH "QString markedText"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
This property holds the text selected by the user (e.g. by clicking and dragging), or QString::null if no text is selected.
.PP
Get this property's value with markedText().
.PP
See also hasSelectedText.
.SH "int maxLength"
This property holds the maximum permitted length of the text in the editor.
.PP
If the text is too long, it is truncated at the limit.
.PP
If truncation occurs any selected text will be unselected, the cursor position is set to 0 and the first part of the string is shown.
.PP
Set this property's value with setMaxLength() and get this property's value with maxLength().
.SH "bool readOnly"
This property holds whether the line edit is read only.
.PP
In read-only mode, the user can still copy the text to the clipboard or drag-and-drop the text, but cannot edit it.
.PP
QLineEdit does not show a cursor in read-only mode.
.PP
See also enabled.
.PP
Set this property's value with setReadOnly() and get this property's value with isReadOnly().
.SH "bool redoAvailable"
This property holds whether redo is available.
.PP
Get this property's value with isRedoAvailable().
.SH "QString selectedText"
This property holds any text selected by the user or QString::null.
.PP
Get this property's value with selectedText().
.PP
See also hasSelectedText.
.SH "QString text"
This property holds the text in the line.
.PP
Setting this property clears the selection, moves the cursor to the end of the line and resets the edited property to FALSE.
.PP
The text is truncated to maxLength() length.
.PP
Set this property's value with setText() and get this property's value with text().
.SH "bool undoAvailable"
This property holds whether undo is available.
.PP
Get this property's value with isUndoAvailable().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qlineedit.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2001 Trolltech AS, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (qlineedit.3qt) and the Qt
version (3.0.3).
|