Virtual Slot In Qt
Posted By admin On 28/07/22- virtual protected void QDialog:: keyPressEvent (QKeyEvent.e) Reimplemented from QWidget::keyPressEvent. virtual QSize QDialog:: minimumSizeHint const. Reimplemented from QWidget::minimumSizeHint. virtual slot void QDialog:: open Shows the dialog as a window modal dialog, returning immediately. This function was introduced in Qt 4.5.
- Connecting in Qt 5. There are several ways to connect a signal in Qt 5. Qt 5 continues to support the old string-based syntax for connecting signals and slots defined in a QObject or any class that inherits from QObject (including QWidget).
The QGeoSatelliteInfoSource class is an abstract base class for the distribution of satellite information updates. More...
Header: | #include <QGeoSatelliteInfoSource> |
qmake: | QT += positioning |
Since: | Qt 5.2 |
Inherits: | QObject |
pure virtual slot void QGeoSatelliteInfoSource:: startUpdates Starts emitting updates at regular intervals. The updates will be provided whenever new satellite information becomes available. The home slot sets the text to the very first document displayed. The anchorClicked signal is emitted when the user clicks an anchor. To override the default navigation behavior of the browser, call the setSource function to supply new document text in a slot connected to this signal. This function is a fake virtual slot that you can reimplement in your subclass in order to control how new proxy widgets are created. The default implementation returns a proxy created with the QGraphicsProxyWidget constructor with this proxy widget as the parent.
Public Types
enum | Error { AccessError, ClosedError, NoError, UnknownSourceError } |
Properties
- minimumUpdateInterval : const int
- updateInterval : int
- 1 property inherited from QObject
Public Functions
QGeoSatelliteInfoSource(QObject *parent) | |
virtual | ~QGeoSatelliteInfoSource() |
virtual Error | error() const = 0 |
virtual int | minimumUpdateInterval() const = 0 |
virtual void | setUpdateInterval(int msec) |
QString | sourceName() const |
int | updateInterval() const |
- 31 public functions inherited from QObject
Public Slots
virtual void | requestUpdate(int timeout = 0) = 0 |
virtual void | startUpdates() = 0 |
virtual void | stopUpdates() = 0 |
- 1 public slot inherited from QObject
Signals
void | error(QGeoSatelliteInfoSource::Error satelliteError) |
void | requestTimeout() |
void | satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &satellites) |
void | satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &satellites) |
- 2 signals inherited from QObject
Static Public Members
QStringList | availableSources() |
QGeoSatelliteInfoSource * | createDefaultSource(QObject *parent) |
QGeoSatelliteInfoSource * | createSource(const QString &sourceName, QObject *parent) |
- 10 static public members inherited from QObject
Additional Inherited Members
- 1 public variable inherited from QObject
- 9 protected functions inherited from QObject
- 2 protected variables inherited from QObject
Detailed Description
The QGeoSatelliteInfoSource class is an abstract base class for the distribution of satellite information updates.
The static function QGeoSatelliteInfoSource::createDefaultSource() creates a default satellite data source that is appropriate for the platform, if one is available. Otherwise, available QGeoPositionInfoSourceFactory plugins will be checked for one that has a satellite data source available.
Call startUpdates() and stopUpdates() to start and stop regular updates, or requestUpdate() to request a single update. When an update is available, satellitesInViewUpdated() and/or satellitesInUseUpdated() will be emitted.
If regular satellite updates are required, setUpdateInterval() can be used to specify how often these updates should be emitted. If no interval is specified, updates are simply provided whenever they are available. For example:
To remove an update interval that was previously set, call setUpdateInterval() with a value of 0.
Note that the satellite source may have a minimum value requirement for update intervals, as returned by minimumUpdateInterval().
Member Type Documentation
enum QGeoSatelliteInfoSource::Error
The Error enumeration represents the errors which can occur.
Constant | Value | Description |
---|---|---|
QGeoSatelliteInfoSource::AccessError | 0 | The connection setup to the satellite backend failed because the application lacked the required privileges. |
QGeoSatelliteInfoSource::ClosedError | 1 | The satellite backend closed the connection, which happens for example in case the user is switching location services to off. This object becomes invalid and should be deleted. A new satellite source can be created by calling createDefaultSource() later on. |
QGeoSatelliteInfoSource::NoError | 2 | No error has occurred. |
QGeoSatelliteInfoSource::UnknownSourceError | -1 | An unidentified error occurred. |
Property Documentation
minimumUpdateInterval : const int
This property holds this property holds the minimum time (in milliseconds) required to retrieve a satellite update.
This is the minimum value accepted by setUpdateInterval() and requestUpdate().
Access functions:
updateInterval : int
This property holds this property holds the requested interval in milliseconds between each update.
If the update interval is not set (or is set to 0) the source will provide updates as often as necessary.
If the update interval is set, the source will provide updates at an interval as close to the requested interval as possible. If the requested interval is less than the minimumUpdateInterval(), the minimum interval is used instead.
Changes to the update interval will happen as soon as is practical, however the time the change takes may vary between implementations. Whether or not the elapsed time from the previous interval is counted as part of the new interval is also implementation dependent.
The default value for this property is 0.
Note: Subclass implementations must call the base implementation of setUpdateInterval() so that updateInterval() returns the correct value.
Access functions:
int | updateInterval() const |
virtual void | setUpdateInterval(int msec) |
Member Function Documentation
QGeoSatelliteInfoSource::QGeoSatelliteInfoSource(QObject *parent)
Creates a satellite source with the specified parent.
[virtual]
QGeoSatelliteInfoSource::~QGeoSatelliteInfoSource()
Destroys the satellite source.
[static]
QStringList QGeoSatelliteInfoSource::availableSources()
Returns a list of available source plugins, including the default system backend if one is available.
[static]
QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createDefaultSource(QObject *parent)
Creates and returns a source with the specified parent that reads from the system's default source of satellite update information, or the highest priority available plugin.
Returns 0 if the system has no default satellite source, no valid plugins could be found or the user does not have the permission to access the satellite data.
[static]
QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createSource(const QString &sourceName, QObject *parent)
Creates and returns a source with the given parent, by loading the plugin named sourceName.
Returns 0 if the plugin cannot be found.
[pure virtual]
Error QGeoSatelliteInfoSource::error() const
Returns the last error that occurred.
This signal is not emitted when a requestTimeout() has occurred.
[signal]
void QGeoSatelliteInfoSource::error(QGeoSatelliteInfoSource::ErrorsatelliteError)
This signal is emitted after an error occurred. The satelliteError parameter describes the type of error that occurred.
Note: Signal error is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:
[signal]
void QGeoSatelliteInfoSource::requestTimeout()
Emitted if requestUpdate() was called and the current satellite information could not be retrieved within the specified timeout.
While the triggering of this signal may be considered an error condition, it does not imply the emission of the error()
signal. Only the emission of requestTimeout()
is required to indicate a timeout.
[pure virtual slot]
void QGeoSatelliteInfoSource::requestUpdate(inttimeout = 0)
Attempts to get the current satellite information and emit satellitesInViewUpdated() and satellitesInUseUpdated() with this information. If the current satellite information cannot be found within the given timeout (in milliseconds) or if timeout is less than the value returned by minimumUpdateInterval(), requestTimeout() is emitted.
If the timeout is zero, the timeout defaults to a reasonable timeout period as appropriate for the source.
This does nothing if another update request is in progress. However it can be called even if startUpdates() has already been called and regular updates are in progress.
[signal]
void QGeoSatelliteInfoSource::satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &satellites)
If startUpdates() or requestUpdate() is called, this signal is emitted when an update is available on the number of satellites that are currently in use.
These are the satellites that are used to get a 'fix' - that is, those used to determine the current position.
The satellites parameter holds the satellites currently in use.
[signal]
void QGeoSatelliteInfoSource::satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &satellites)
If startUpdates() or requestUpdate() is called, this signal is emitted when an update is available on the satellites that are currently in view.
The satellites parameter holds the satellites currently in view.
QString QGeoSatelliteInfoSource::sourceName() const
Returns the unique name of the satellite source implementation in use.
This is the same name that can be passed to createSource() in order to create a new instance of a particular satellite source implementation.
[pure virtual slot]
void QGeoSatelliteInfoSource::startUpdates()
Starts emitting updates at regular intervals. The updates will be provided whenever new satellite information becomes available.
If satellite information cannot be retrieved or some other form of timeout has occurred the satellitesInViewUpdated() and satellitesInUseUpdated() signals may be emitted with empty parameter lists.
See also satellitesInViewUpdated() and satellitesInUseUpdated().
[pure virtual slot]
void QGeoSatelliteInfoSource::stopUpdates()
Stops emitting updates at regular intervals.
Home All Classes Main Classes Annotated Grouped Classes Functions |
The QLineEdit widget is a one-line text editor.More...
#include <qlineedit.h>
Inherits QFrame.
Public Members
- QLineEdit ( QWidget * parent, const char * name = 0 )
- QLineEdit ( const QString & contents, QWidget * parent, const char * name = 0 )
- QString text () const
- int maxLength () const
- enum EchoMode { Normal, NoEcho, Password }
- bool isReadOnly () const
- virtual QSize sizeHint () const
- int cursorPosition () const
- bool validateAndSet ( const QString & newText, int newPos, int newMarkAnchor, int newMarkDrag )
- void cursorLeft ( bool mark, int steps = 1 ) (obsolete)
- void cursorRight ( bool mark, int steps = 1 ) (obsolete)
- void cursorBackward ( bool mark, int steps = 1 )
- void cursorWordBackward ( bool mark )
- void del ()
- void end ( bool mark )
- bool edited () const
- QString selectedText () const
- bool isUndoAvailable () const
- bool hasMarkedText () const (obsolete)
- bool dragEnabled () const
Public Slots
- virtual void setText ( const QString & )
- virtual void deselect ()
- virtual void insert ( const QString & newText )
- virtual void undo ()
- virtual void setMaxLength ( int )
- virtual void setEchoMode ( EchoMode )
- virtual void setValidator ( const QValidator * v )
- virtual void setSelection ( int start, int length )
- virtual void setAlignment ( int flag )
- virtual void copy () const
- virtual void setDragEnabled ( bool b )
Signals
- void returnPressed ()
- void selectionChanged ()
Properties
- Alignment alignment - the alignment of the line edit
- int cursorPosition - the current cursor position for this line edit
- QString displayText - the displayed text (read only)
- bool dragEnabled - whether the lineedit starts a drag if the user presses and moves the mouse on some selected text
- bool edited - whether the line edit has been edited
- bool frame - whether the line edit draws itself with a frame
- bool hasMarkedText - whether part of the text has been selected by the user (e.g. by clicking and dragging) (read only)(obsolete)
- bool hasSelectedText - whether there is any text selected (read only)
- QString markedText - the text selected by the user (e.g. by clicking and dragging), or QString::null if no text is selected (read only)(obsolete)
- int maxLength - the maximum permitted length of the text
- bool readOnly - whether the line edit is read only
- bool redoAvailable - whether redo is available (read only)
- QString selectedText - the selected text (read only)
- bool undoAvailable - whether undo is available (read only)
Protected Members
- void repaintArea ( int from, int to ) (obsolete)
Detailed Description
The QLineEdit widget is a one-line text editor.
A line edit allows the user to enter and edit a single line ofplain text with a useful collection of editing functions,including undo and redo, cut and paste, and drag and drop.
By changing the echoMode() of a line edit, it can also be used asa 'write-only' field, for inputs such as passwords.
The length of the field can be constrained to maxLength(), or thevalue can be arbitrarily constrained using a validator().
A related class is QTextEdit which allows multi-line, rich-textediting.
You can change the text with setText() or insert(). The text isretrieved with text(); the displayed text (which may be different,see EchoMode) is retrieved with displayText(). Text can beselected with setSelection() or selectAll(), and the selection canbe cut(), copy()ied and paste()d. The text can be aligned withsetAlignment().
When the text changes the textChanged() signal is emitted; whenthe Return or Enter key is pressed the returnPressed() signal isemitted. Note that if there is a validator set on the line edit,the returnPressed() signal will only be emitted if the validatorreturns Acceptable.
By default, QLineEdits have a frame as specified by the Windowsand Motif style guides; you can turn it off by callingsetFrame(FALSE).
The default key bindings are described below. A right mousebutton menu presents some of the editing commands to the user.
Keypress | Action |
---|---|
Left Arrow | moves the cursor one character to the left. |
Right Arrow | moves the cursor one character to the right. |
Backspace | deletes the character to the left of the cursor. |
Ctrl+Backspace | Delete the word to the left of the cursor |
Delete | Delete the character to the right of the cursor |
Ctrl+Delete | Delete the word to the right of the cursor |
Home | moves the cursor to the beginning of the line. |
End | moves the cursor to the end of the line. |
Delete | deletes the character to the right of the cursor. |
Shift+Left Arrow | moves and selects text one character to the left. |
Shift+Right Arrow | moves and selects text one character to the right. |
Ctrl+A | moves the cursor to the beginning of the line. |
Ctrl+B | moves the cursor one character to the left. |
Ctrl+C | copies the selected text to the clipboard.(Windows also supports Ctrl+Insert for this operation.) |
Ctrl+D | deletes the character to the right of the cursor. |
Ctrl+E | moves the cursor to the end of the line. |
Ctrl+F | moves the cursor one character to the right. |
Ctrl+H | deletes the character to the left of the cursor. |
Ctrl+K | deletes to the end of the line. |
Ctrl+V | pastes the clipboard text into line edit.(Windows also supports Shift+Insert for this operation.) |
Ctrl+X | deletes the selected text and copies it to the clipboard.(Windows also supports Shift+Delete for this operation.) |
Ctrl+Z | undoes the last operation. |
Ctrl+Y | redoes the last undone operation. |
Any other key sequence, that represents a valid character, willcause the character to be inserted into the line.
See also QTextEdit, QLabel, QComboBox, GUI Design Handbook: Field, Entry, and Basic Widgets.
Member Type Documentation
QLineEdit::EchoMode
This enum type describes how a line edit should display itscontents.
- QLineEdit::Normal - display characters as they are entered. This is thedefault.
- QLineEdit::NoEcho - do not display anything. This may be appropriatefor passwords where even the length of thepassword should be kept secret.
- QLineEdit::Password - display asterisks instead of the charactersactually entered.
See also echoMode and echoMode.
Member Function Documentation
QLineEdit::QLineEdit ( QWidget * parent, const char * name = 0 )
Constructs a line edit with no text.The maximum text length is set to 32767 characters.
The parent and name arguments are sent to the QWidget constructor.
See also text and maxLength.
QLineEdit::QLineEdit ( const QString & contents, QWidget * parent, const char * name = 0 )
Constructs a line edit containing the text contents.The cursor position is set to the end of the line and the maximumtext length to 32767 characters.
The parent and name arguments are sent to the QWidgetconstructor.
See also text and maxLength.
QLineEdit::~QLineEdit ()
Destroys the line edit.int QLineEdit::alignment () const
Returns the alignment of the line edit.See the 'alignment' property for details.
void QLineEdit::backspace ()
Deletes the character to the left of the text cursor and moves thecursor one position to the left. If any text has been selected bythe user (e.g. by clicking and dragging), the cursor will be putat the beginning of the selected text and the selected text willbe removed.See also del().
int QLineEdit::characterAt ( int xpos, QChar * chr ) const
Returns the index position of the character which is at xpos(in logical coordinates from the left). If chr is not 0, *chr is populated with the character at this position.void QLineEdit::clear () [virtual slot]
Clears the contents of the editor.The edited property is set to FALSE.Undo/redo history is updated.void QLineEdit::clearValidator () [virtual slot]
This slot is equivalent to setValidator( 0 ).void QLineEdit::copy () const [virtual slot]
Copies the selected text to the clipboard, if there is any, and ifechoMode() is Normal.See also cut() and paste().
QPopupMenu * QLineEdit::createPopupMenu () [virtual protected]
This function is called to create the popup menu which is shownwhen the user clicks on the line edit with the right mouse button.If you want to create a custom popup menu, reimplement thisfunction and return the popup menu you create. The popup menu'sownership is transferred to the caller.void QLineEdit::cursorBackward ( bool mark, int steps = 1 )
Moves the cursor back steps characters. If mark is TRUE eachcharacter moved over is added to the selection; if mark isFALSE the selection is cleared.See also cursorForward().
void QLineEdit::cursorForward ( bool mark, int steps = 1 )
Moves the cursor forward steps characters. If mark is TRUEeach character moved over is added to the selection; if mark isFALSE the selection is cleared.See also cursorBackward().
void QLineEdit::cursorLeft ( bool mark, int steps = 1 )
This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.For compatibilty with older applications only. Use cursorBackward()instead.
See also cursorBackward().
int QLineEdit::cursorPosition () const
Returns the current cursor position for this line edit.See the 'cursorPosition' property for details.
void QLineEdit::cursorRight ( bool mark, int steps = 1 )
This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.Use cursorForward() instead.
See also cursorForward().
void QLineEdit::cursorWordBackward ( bool mark )
Moves the cursor one word backward. If mark is TRUE, the wordis also selected.See also cursorWordForward().
void QLineEdit::cursorWordForward ( bool mark )
Moves the cursor one word forward. If mark is TRUE, the word isalso selected.See also cursorWordBackward().
void QLineEdit::cut () [virtual slot]
Copies the selected text to the clipboard and deletes it, if thereis any, and if echoMode() is Normal.If the current validator disallows deleting the selected text,cut() will copy it but not delete it.
See also copy() and paste().
void QLineEdit::del ()
Deletes the character to the right of the text cursor. If any texthas been selected by the user (e.g. by clicking and dragging), thecursor will be put at the beginning of the selected text and theselected text will be removed.See also backspace().
void QLineEdit::deselect () [virtual slot]
De-selects all text (i.e. removes highlighting) and leaves thecursor at the current position.See also setSelection() and selectAll().
QStringQLineEdit::displayText () const
Returns the displayed text.See the 'displayText' property for details.
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.
EchoModeQLineEdit::echoMode () const
Returns the line edit's echo mode.See the 'echoMode' property for details.
bool QLineEdit::edited () const
Returns TRUE if the line edit has been edited; otherwise returns FALSE.See the 'edited' property for details.
void QLineEdit::end ( bool mark )
Moves the text cursor to the end of the line. If mark is TRUE,text is selected towards the last position; otherwise, anyselected text is unselected if the cursor is moved.See also home().
bool QLineEdit::frame () const
Returns TRUE if the line edit draws itself with a frame; otherwise returns FALSE.See the 'frame' property for details.
bool QLineEdit::getSelection ( int * start, int * end )
This function sets *start to the position in the text wherethe selection starts and *end to the position where theselection ends. Returns TRUE if both start and end are not 0and if there is some selected text; otherwise returns FALSE.See also setSelection().
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.
bool QLineEdit::hasSelectedText () const
Returns TRUE if there is any text selected; otherwise returns FALSE.See the 'hasSelectedText' property for details.
void QLineEdit::home ( bool mark )
Moves the text cursor to the beginning of the line. If mark isTRUE, text is selected towards the first position; otherwise, anyselected text is unselected if the cursor is moved.See also end().
void QLineEdit::insert ( const QString & newText ) [virtual slot]
Removes any selected text, inserts newText, and validates theresult. If it is valid, it sets it as the new contents of the lineedit.bool QLineEdit::isReadOnly () const
Returns TRUE if the line edit is read only; otherwise returns FALSE.See the 'readOnly' property for details.
bool QLineEdit::isRedoAvailable () const
Returns TRUE if redo is available; otherwise returns FALSE.See the 'redoAvailable' property for details.
bool QLineEdit::isUndoAvailable () const
Returns TRUE if undo is available; otherwise returns FALSE.See the 'undoAvailable' property for details.
void QLineEdit::keyPressEvent ( QKeyEvent * e ) [virtual protected]
Converts key press event e into a line edit action.If Return or Enter is pressed and the current text is valid (orcan be made valid by thevalidator), the signal returnPressed() is emitted.
The default key bindings are listed in the detailed description.
Reimplemented from QWidget.
void QLineEdit::lostFocus () [signal]
This signal is emitted when the line edit has lost focus.
See also focus, QWidget::focusInEvent(), and QWidget::focusOutEvent().
QStringQLineEdit::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.
int QLineEdit::maxLength () const
Returns the maximum permitted length of the text.See the 'maxLength' property for details.
QSizeQLineEdit::minimumSizeHint () const [virtual]
Returns a minimum size for the line edit.The width returned is enough for at least one character.
Reimplemented from QWidget.
void QLineEdit::paste () [virtual slot]
Inserts the clipboard's text at the cursor position, deleting anyselected text.If the end result is not acceptable for the current validator,nothing happens.
See also copy() and cut().
void QLineEdit::redo () [virtual slot]
Redoes the last operation.void QLineEdit::repaintArea ( int from, int to ) [protected]
This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.Repaints all characters from from to to. If cursorPos isbetween from and to, ensures that cursorPos is visible.
void QLineEdit::returnPressed () [signal]
This signal is emitted when the Return or Enter key is pressed.Note that if there is a validator set on the line edit, thereturnPressed() signal will only be emitted if the validatorreturns Acceptable.
Example: popup/popup.cpp.
void QLineEdit::selectAll () [virtual slot]
Selects all the text (i.e. highlights it) and moves the cursor tothe end. This is useful when a default value has been insertedbecause if the user types before clicking on the widget, theselected text will be erased.Virtual Slot In Qt Download
See also setSelection() and deselect().
QStringQLineEdit::selectedText () const
Returns the selected text.See the 'selectedText' property for details.
void QLineEdit::selectionChanged () [signal]
This signal is emitted whenever the selection changes.
See also hasSelectedText and selectedText.
void QLineEdit::setAlignment ( int flag ) [virtual slot]
Sets the alignment of the line edit to flag.See the 'alignment' property for details.
void QLineEdit::setCursorPosition ( int ) [virtual slot]
Sets the current cursor position for this line edit.See the 'cursorPosition' property for details.
void QLineEdit::setDragEnabled ( bool b ) [virtual slot]
Sets whether the lineedit starts a drag if the user presses and moves the mouse on some selected text to b.See the 'dragEnabled' property for details.
void QLineEdit::setEchoMode ( EchoMode ) [virtual slot]
Sets the line edit's echo mode.See the 'echoMode' property for details.
void QLineEdit::setEdited ( bool )
Sets whether the line edit has been edited.See the 'edited' property for details.
void QLineEdit::setFrame ( bool ) [virtual slot]
Sets whether the line edit draws itself with a frame.See the 'frame' property for details.
void QLineEdit::setMaxLength ( int ) [virtual slot]
Sets the maximum permitted length of the text.See the 'maxLength' property for details.
void QLineEdit::setReadOnly ( bool ) [virtual slot]
Sets whether the line edit is read only.See the 'readOnly' property for details.
void QLineEdit::setSelection ( int start, int length ) [virtual slot]
Sets the selected area of this line edit to start at position start and be length characters long.See also deselect(), selectAll(), and getSelection().
void QLineEdit::setText ( const QString & ) [virtual slot]
Sets the line edit's text.See the 'text' property for details.
void QLineEdit::setValidator ( const QValidator * v ) [virtual slot]
Sets this line edit to only accept input that the validator, v,will accept. This allows you to place any arbitrary constraints onthe text which may be entered.If v 0, setValidator() removes the current input validator.The initial setting is to have no input validator (i.e. any inputis accepted up to maxLength()).
See also validator() and QValidator.
Examples: lineedits/lineedits.cpp and wizard/wizard.cpp.
QSizeQLineEdit::sizeHint () const [virtual]
Returns a recommended size for the widget.Virtual Slot In Qtc
The width returned, in pixels, is usually enough for about 15 to20 characters.
Example: addressbook/centralwidget.cpp.
QStringQLineEdit::text () const
Returns the line edit's text.See the 'text' property for details.
void QLineEdit::textChanged ( const QString & ) [signal]
This signal is emitted whenever the text changes. The argument isthe new text.
Examples: wizard/wizard.cpp and xform/xform.cpp.
void QLineEdit::undo () [virtual slot]
Undoes the last operation. Deselects any current selection, and updatesthe selection start to the current cursor position.bool QLineEdit::validateAndSet ( const QString & newText, int newPos, int newMarkAnchor, int newMarkDrag )
Validates and perhaps sets this line edit to contain newTextwith the cursor at position newPos, with selected text from newMarkAnchor to newMarkDrag. Returns TRUE if it changes theline edit; otherwise returns FALSE.Linebreaks in newText are converted to spaces, and the text istruncated to maxLength() before its validity is tested.
Repaints and emits textChanged() if appropriate.
const QValidator * QLineEdit::validator () const
Returns a pointer to the current input validator, or 0 if novalidator has been set.See also setValidator().
Example: wizard/wizard.cpp.
Property Documentation
Alignment alignment
This property holds the alignment of the line edit.
Possible Values are Qt::AlignAuto, Qt::AlignLeft, Qt::AlignRight and Qt::AlignHCenter.
Attempting to set the alignment to an illegal flag combinationdoes nothing.
See also Qt::AlignmentFlags.
Set this property's value with setAlignment() and get this property's value with alignment().
int cursorPosition
This property holds the current cursor position for this line edit.
Setting the cursor position causes a repaint when appropriate.
Set this property's value with setCursorPosition() and get this property's value with cursorPosition().
QStringdisplayText
This property holds the displayed text.
If EchoMode is Normal this returns the same as text(); ifEchoMode is Password it returns a string of asterisks thetext().length() characters long, e.g. '******'; if EchoMode isNoEcho returns an empty string, '.
See also echoMode, text, and EchoMode.
Get this property's value with displayText().
bool dragEnabled
This property holds whether the lineedit starts a drag if the user presses and moves the mouse on some selected text.
Set this property's value with setDragEnabled() and get this property's value with dragEnabled().
EchoModeechoMode
This property holds the line edit's echo mode.
The initial setting is Normal, but QLineEdit also supports NoEcho and Password modes.
The widget's display and the ability to copy or drag the text isaffected by this setting.
See also EchoMode and displayText.
Set this property's value with setEchoMode() and get this property's value with echoMode().
bool edited
This property holds whether the line edit has been edited.
The edited flag is never read by QLineEdit; it has a default valueof FALSE and is changed to TRUE whenever the user changes the lineedit's contents.
This is useful for things that need to provide a default value butcannot find the default at once. Just start the line edit withoutthe best default; when the default is known, check the edited()return value and set the line edit's contents if the user has notstarted editing the line edit.
Virtual Slot In Qt Game
Calling setText() resets the edited flag to FALSE.
Set this property's value with setEdited() and get this property's value with edited().
bool frame
This property holds whether the line edit draws itself with a frame.
If enabled (the default) the line edit draws itself inside atwo-pixel frame, otherwise the line edit draws itself without anyframe.
Set this property's value with setFrame() and get this property's value with frame().
bool hasMarkedText
This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.This property holds whether part of the text has been selected by the user (e.g. by clicking and dragging).
Get this property's value with hasMarkedText().
See also selectedText.
bool hasSelectedText
This property holds whether there is any text selected.
hasSelectedText() returns TRUE if some or all of the text has beenselected by the user (e.g. by clicking and dragging); otherwisereturns FALSE.
See also selectedText.
Get this property's value with hasSelectedText().
QStringmarkedText
This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.This property holds the text selected by the user (e.g. by clicking and dragging), or QString::null if no text is selected.
Get this property's value with markedText().
See also hasSelectedText.
int maxLength
This property holds the maximum permitted length of the text.
Virtual Slot In Qts
If the text is too long, it is truncated at the limit.
If truncation occurs any selected text will be unselected, thecursor position is set to 0 and the first part of the string isshown.
Set this property's value with setMaxLength() and get this property's value with maxLength().
bool readOnly
This property holds whether the line edit is read only.
In read-only mode, the user can still copy the text to theclipboard or drag-and-drop the text, but cannot edit it.
QLineEdit does not show a cursor in read-only mode.
See also enabled.
Set this property's value with setReadOnly() and get this property's value with isReadOnly().
bool redoAvailable
This property holds whether redo is available.
Get this property's value with isRedoAvailable().
QStringselectedText
This property holds the selected text.
If there is no selected text this property's value isQString::null.
See also hasSelectedText.
Get this property's value with selectedText().
QStringtext
This property holds the line edit's text.
Setting this property clears the selection, clears the undo/redohistory, moves the cursor to the end of the line and resets theedited property to FALSE. The text is not validated when insertedwith setText().
The text is truncated to maxLength() length.
Set this property's value with setText() and get this property's value with text().
bool undoAvailable
This property holds whether undo is available.
Get this property's value with isUndoAvailable().
This file is part of the Qt toolkit.Copyright © 1995-2003Trolltech. All Rights Reserved.
Copyright © 2003Trolltech | Trademarks |