Qt 4.8
|
The QLineEdit widget is a one-line text editor. More...
#include <qlineedit.h>
Public Types | |
enum | EchoMode { Normal, NoEcho, Password, PasswordEchoOnEdit } |
This enum type describes how a line edit should display its contents. More... | |
Public Types inherited from QWidget | |
enum | RenderFlag { DrawWindowBackground = 0x1, DrawChildren = 0x2, IgnoreMask = 0x4 } |
This enum describes how to render the widget when calling QWidget::render(). More... | |
Public Types inherited from QPaintDevice | |
enum | PaintDeviceMetric { PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM, PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY, PdmPhysicalDpiX, PdmPhysicalDpiY } |
Public Slots | |
void | clear () |
Clears the contents of the line edit. More... | |
void | copy () const |
Copies the selected text to the clipboard, if there is any, and if echoMode() is Normal . More... | |
void | cut () |
Copies the selected text to the clipboard and deletes it, if there is any, and if echoMode() is Normal . More... | |
void | paste () |
Inserts the clipboard's text at the cursor position, deleting any selected text, providing the line edit is not read-only. More... | |
void | redo () |
Redoes the last operation if redo is available. More... | |
void | selectAll () |
Selects all the text (i.e. More... | |
void | setText (const QString &) |
void | undo () |
Undoes the last operation if undo is available. More... | |
Public Slots inherited from QWidget | |
bool | close () |
Closes this widget. More... | |
void | hide () |
Hides the widget. More... | |
void | lower () |
Lowers the widget to the bottom of the parent widget's stack. More... | |
void | raise () |
Raises this widget to the top of the parent widget's stack. More... | |
void | repaint () |
Repaints the widget directly by calling paintEvent() immediately, unless updates are disabled or the widget is hidden. More... | |
void | setDisabled (bool) |
Disables widget input events if disable is true; otherwise enables input events. More... | |
void | setEnabled (bool) |
void | setFocus () |
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the active window. More... | |
void | setHidden (bool hidden) |
Convenience function, equivalent to setVisible(!hidden). More... | |
QT_MOC_COMPAT void | setShown (bool shown) |
Use setVisible(shown) instead. More... | |
void | setStyleSheet (const QString &styleSheet) |
virtual void | setVisible (bool visible) |
void | setWindowModified (bool) |
void | setWindowTitle (const QString &) |
void | show () |
Shows the widget and its child widgets. More... | |
void | showFullScreen () |
Shows the widget in full-screen mode. More... | |
void | showMaximized () |
Shows the widget maximized. More... | |
void | showMinimized () |
Shows the widget minimized, as an icon. More... | |
void | showNormal () |
Restores the widget after it has been maximized or minimized. More... | |
void | update () |
Updates the widget unless updates are disabled or the widget is hidden. More... | |
Public Slots inherited from QObject | |
void | deleteLater () |
Schedules this object for deletion. More... | |
Signals | |
void | cursorPositionChanged (int, int) |
This signal is emitted whenever the cursor moves. More... | |
void | editingFinished () |
This signal is emitted when the Return or Enter key is pressed or the line edit loses focus. More... | |
void | returnPressed () |
This signal is emitted when the Return or Enter key is pressed. More... | |
void | selectionChanged () |
This signal is emitted whenever the selection changes. More... | |
void | textChanged (const QString &) |
This signal is emitted whenever the text changes. More... | |
void | textEdited (const QString &) |
This signal is emitted whenever the text is edited. More... | |
Signals inherited from QWidget | |
void | customContextMenuRequested (const QPoint &pos) |
This signal is emitted when the widget's contextMenuPolicy is Qt::CustomContextMenu, and the user has requested a context menu on the widget. More... | |
Signals inherited from QObject | |
void | destroyed (QObject *=0) |
This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More... | |
Public Functions | |
Qt::Alignment | alignment () const |
void | backspace () |
If no text is selected, deletes the character to the left of the text cursor and moves the cursor one position to the left. More... | |
QCompleter * | completer () const |
Returns the current QCompleter that provides completions. More... | |
QMenu * | createStandardContextMenu () |
This function creates the standard context menu which is shown when the user clicks on the line edit with the right mouse button. More... | |
void | cursorBackward (bool mark, int steps=1) |
Moves the cursor back steps characters. More... | |
void | cursorForward (bool mark, int steps=1) |
Moves the cursor forward steps characters. More... | |
Qt::CursorMoveStyle | cursorMoveStyle () const |
int | cursorPosition () const |
int | cursorPositionAt (const QPoint &pos) |
Returns the cursor position under the point pos. More... | |
void | cursorWordBackward (bool mark) |
Moves the cursor one word backward. More... | |
void | cursorWordForward (bool mark) |
Moves the cursor one word forward. More... | |
void | del () |
If no text is selected, deletes the character to the right of the text cursor. More... | |
void | deselect () |
Deselects any selected text. More... | |
QString | displayText () const |
bool | dragEnabled () const |
EchoMode | echoMode () const |
void | end (bool mark) |
Moves the text cursor to the end of the line unless it is already there. More... | |
bool | event (QEvent *) |
Reimplemented Function More... | |
void | getTextMargins (int *left, int *top, int *right, int *bottom) const |
Returns the widget's text margins for left, top, right, and bottom. More... | |
bool | hasAcceptableInput () const |
bool | hasFrame () const |
bool | hasSelectedText () const |
void | home (bool mark) |
Moves the text cursor to the beginning of the line unless it is already there. More... | |
QString | inputMask () const |
QVariant | inputMethodQuery (Qt::InputMethodQuery) const |
em>Reimplemented Function More... | |
void | insert (const QString &) |
Deletes any selected text, inserts newText, and validates the result. More... | |
bool | isModified () const |
bool | isReadOnly () const |
bool | isRedoAvailable () const |
bool | isUndoAvailable () const |
int | maxLength () const |
QSize | minimumSizeHint () const |
Returns a minimum size for the line edit. More... | |
QString | placeholderText () const |
QLineEdit (QWidget *parent=0) | |
Constructs a line edit with no text. More... | |
QLineEdit (const QString &, QWidget *parent=0) | |
Constructs a line edit containing the text contents. More... | |
QString | selectedText () const |
int | selectionStart () const |
selectionStart() returns the index of the first selected character in the line edit or -1 if no text is selected. More... | |
void | setAlignment (Qt::Alignment flag) |
void | setCompleter (QCompleter *completer) |
Sets this line edit to provide auto completions from the completer, c. More... | |
void | setCursorMoveStyle (Qt::CursorMoveStyle style) |
Sets the movement style for the cursor in the line edit to the given style. More... | |
void | setCursorPosition (int) |
void | setDragEnabled (bool b) |
void | setEchoMode (EchoMode) |
void | setFrame (bool) |
void | setInputMask (const QString &inputMask) |
void | setMaxLength (int) |
void | setModified (bool) |
void | setPlaceholderText (const QString &) |
void | setReadOnly (bool) |
void | setSelection (int, int) |
Selects text from position start and for length characters. More... | |
void | setTextMargins (int left, int top, int right, int bottom) |
Sets the margins around the text inside the frame to have the sizes left, top, right, and bottom. More... | |
void | setTextMargins (const QMargins &margins) |
Sets the margins around the text inside the frame. More... | |
void | setValidator (const QValidator *) |
Sets this line edit to only accept input that the validator, v, will accept. More... | |
QSize | sizeHint () const |
Returns a recommended size for the widget. More... | |
QString | text () const |
QMargins | textMargins () const |
Returns the widget's text margins. More... | |
const QValidator * | validator () const |
Returns a pointer to the current input validator, or 0 if no validator has been set. More... | |
~QLineEdit () | |
Destroys the line edit. More... | |
Public Functions inherited from QWidget | |
bool | acceptDrops () const |
QString | accessibleDescription () const |
QString | accessibleName () const |
QList< QAction * > | actions () const |
Returns the (possibly empty) list of this widget's actions. More... | |
void | activateWindow () |
Sets the top-level widget containing this widget to be the active window. More... | |
void | addAction (QAction *action) |
Appends the action action to this widget's list of actions. More... | |
void | addActions (QList< QAction *> actions) |
Appends the actions actions to this widget's list of actions. More... | |
void | adjustSize () |
Adjusts the size of the widget to fit its contents. More... | |
bool | autoFillBackground () const |
QPalette::ColorRole | backgroundRole () const |
Returns the background role of the widget. More... | |
QSize | baseSize () const |
QWidget * | childAt (int x, int y) const |
Returns the visible child widget at the position ({x}, {y}) in the widget's coordinate system. More... | |
QWidget * | childAt (const QPoint &p) const |
Returns the visible child widget at point p in the widget's own coordinate system. More... | |
QRect | childrenRect () const |
QRegion | childrenRegion () const |
void | clearFocus () |
Takes keyboard input focus from the widget. More... | |
void | clearMask () |
Removes any mask set by setMask(). More... | |
QMargins | contentsMargins () const |
The contentsMargins function returns the widget's contents margins. More... | |
QRect | contentsRect () const |
Returns the area inside the widget's margins. More... | |
Qt::ContextMenuPolicy | contextMenuPolicy () const |
void | createWinId () |
QCursor | cursor () const |
int | devType () const |
WId | effectiveWinId () const |
Returns the effective window system identifier of the widget, i. More... | |
void | ensurePolished () const |
Ensures that the widget has been polished by QStyle (i.e., has a proper font and palette). More... | |
Qt::FocusPolicy | focusPolicy () const |
QWidget * | focusProxy () const |
Returns the focus proxy, or 0 if there is no focus proxy. More... | |
QWidget * | focusWidget () const |
Returns the last child of this widget that setFocus had been called on. More... | |
const QFont & | font () const |
QFontInfo | fontInfo () const |
Returns the font info for the widget's current font. More... | |
QFontMetrics | fontMetrics () const |
Returns the font metrics for the widget's current font. More... | |
QPalette::ColorRole | foregroundRole () const |
Returns the foreground role. More... | |
QRect | frameGeometry () const |
QSize | frameSize () const |
const QRect & | geometry () const |
void | getContentsMargins (int *left, int *top, int *right, int *bottom) const |
Returns the widget's contents margins for left, top, right, and bottom. More... | |
HDC | getDC () const |
Returns the window system handle of the widget, for low-level access. More... | |
void | grabGesture (Qt::GestureType type, Qt::GestureFlags flags=Qt::GestureFlags()) |
Subscribes the widget to a given gesture with specific flags. More... | |
void | grabKeyboard () |
Grabs the keyboard input. More... | |
void | grabMouse () |
Grabs the mouse input. More... | |
void | grabMouse (const QCursor &) |
int | grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut) |
Adds a shortcut to Qt's shortcut system that watches for the given key sequence in the given context. More... | |
QGraphicsEffect * | graphicsEffect () const |
The graphicsEffect function returns a pointer to the widget's graphics effect. More... | |
QGraphicsProxyWidget * | graphicsProxyWidget () const |
Returns the proxy widget for the corresponding embedded widget in a graphics view; otherwise returns 0. More... | |
bool | hasFocus () const |
bool | hasMouseTracking () const |
int | height () const |
virtual int | heightForWidth (int) const |
Returns the preferred height for this widget, given the width w. More... | |
QInputContext * | inputContext () |
This function returns the QInputContext for this widget. More... | |
Qt::InputMethodHints | inputMethodHints () const |
void | insertAction (QAction *before, QAction *action) |
Inserts the action action to this widget's list of actions, before the action before. More... | |
void | insertActions (QAction *before, QList< QAction *> actions) |
Inserts the actions actions to this widget's list of actions, before the action before. More... | |
WId | internalWinId () const |
Returns the window system identifier of the widget, or 0 if the widget is not created yet. More... | |
bool | isActiveWindow () const |
bool | isAncestorOf (const QWidget *child) const |
Returns true if this widget is a parent, (or grandparent and so on to any level), of the given child, and both widgets are within the same window; otherwise returns false. More... | |
bool | isEnabled () const |
bool | isEnabledTo (QWidget *) const |
Returns true if this widget would become enabled if ancestor is enabled; otherwise returns false. More... | |
bool | isEnabledToTLW () const |
This function is deprecated. More... | |
bool | isFullScreen () const |
bool | isHidden () const |
Returns true if the widget is hidden, otherwise returns false. More... | |
bool | isLeftToRight () const |
bool | isMaximized () const |
bool | isMinimized () const |
bool | isModal () const |
bool | isRightToLeft () const |
bool | isTopLevel () const |
Use isWindow() instead. More... | |
bool | isVisible () const |
bool | isVisibleTo (QWidget *) const |
Returns true if this widget would become visible if ancestor is shown; otherwise returns false. More... | |
bool | isWindow () const |
Returns true if the widget is an independent window, otherwise returns false. More... | |
bool | isWindowModified () const |
QLayout * | layout () const |
Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed. More... | |
Qt::LayoutDirection | layoutDirection () const |
QLocale | locale () const |
Qt::HANDLE | macCGHandle () const |
Returns the CoreGraphics handle of the widget. More... | |
Qt::HANDLE | macQDHandle () const |
Returns the QuickDraw handle of the widget. More... | |
QPoint | mapFrom (QWidget *, const QPoint &) const |
Translates the widget coordinate pos from the coordinate system of parent to this widget's coordinate system. More... | |
QPoint | mapFromGlobal (const QPoint &) const |
Translates the global screen coordinate pos to widget coordinates. More... | |
QPoint | mapFromParent (const QPoint &) const |
Translates the parent widget coordinate pos to widget coordinates. More... | |
QPoint | mapTo (QWidget *, const QPoint &) const |
Translates the widget coordinate pos to the coordinate system of parent. More... | |
QPoint | mapToGlobal (const QPoint &) const |
Translates the widget coordinate pos to global screen coordinates. More... | |
QPoint | mapToParent (const QPoint &) const |
Translates the widget coordinate pos to a coordinate in the parent widget. More... | |
QRegion | mask () const |
Returns the mask currently set on a widget. More... | |
int | maximumHeight () const |
QSize | maximumSize () const |
int | maximumWidth () const |
int | minimumHeight () const |
QSize | minimumSize () const |
int | minimumWidth () const |
void | move (int x, int y) |
This corresponds to move(QPoint(x, y)). More... | |
void | move (const QPoint &) |
QWidget * | nativeParentWidget () const |
Returns the native parent for this widget, i. More... | |
QWidget * | nextInFocusChain () const |
Returns the next widget in this widget's focus chain. More... | |
QRect | normalGeometry () const |
void | overrideWindowFlags (Qt::WindowFlags type) |
Sets the window flags for the widget to flags, without telling the window system. More... | |
void | overrideWindowState (Qt::WindowStates state) |
QPaintEngine * | paintEngine () const |
Returns the widget's paint engine. More... | |
const QPalette & | palette () const |
QWidget * | parentWidget () const |
Returns the parent of this widget, or 0 if it does not have any parent widget. More... | |
QPoint | pos () const |
QWidget * | previousInFocusChain () const |
The previousInFocusChain function returns the previous widget in this widget's focus chain. More... | |
QWidget (QWidget *parent=0, Qt::WindowFlags f=0) | |
Constructs a widget which is a child of parent, with widget flags set to f. More... | |
QRect | rect () const |
void | releaseDC (HDC) const |
Releases the HDC hdc acquired by a previous call to getDC(). More... | |
void | releaseKeyboard () |
Releases the keyboard grab. More... | |
void | releaseMouse () |
Releases the mouse grab. More... | |
void | releaseShortcut (int id) |
Removes the shortcut with the given id from Qt's shortcut system. More... | |
void | removeAction (QAction *action) |
Removes the action action from this widget's list of actions. More... | |
void | render (QPaintDevice *target, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren)) |
Renders the sourceRegion of this widget into the target using renderFlags to determine how to render. More... | |
void | render (QPainter *painter, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren)) |
Renders the widget into the painter's QPainter::device(). More... | |
void | repaint (int x, int y, int w, int h) |
This version repaints a rectangle (x, y, w, h) inside the widget. More... | |
void | repaint (const QRect &) |
This version repaints a rectangle rect inside the widget. More... | |
void | repaint (const QRegion &) |
This version repaints a region rgn inside the widget. More... | |
void | resize (int w, int h) |
This corresponds to resize(QSize(w, h)). More... | |
void | resize (const QSize &) |
bool | restoreGeometry (const QByteArray &geometry) |
Restores the geometry and state top-level widgets stored in the byte array geometry. More... | |
QByteArray | saveGeometry () const |
Saves the current geometry and state for top-level widgets. More... | |
void | scroll (int dx, int dy) |
Scrolls the widget including its children dx pixels to the right and dy downward. More... | |
void | scroll (int dx, int dy, const QRect &) |
This version only scrolls r and does not move the children of the widget. More... | |
void | setAcceptDrops (bool on) |
void | setAccessibleDescription (const QString &description) |
void | setAccessibleName (const QString &name) |
void | setAttribute (Qt::WidgetAttribute, bool on=true) |
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute. More... | |
void | setAutoFillBackground (bool enabled) |
void | setBackgroundRole (QPalette::ColorRole) |
Sets the background role of the widget to role. More... | |
void | setBaseSize (const QSize &) |
void | setBaseSize (int basew, int baseh) |
This corresponds to setBaseSize(QSize(basew, baseh)). More... | |
void | setContentsMargins (int left, int top, int right, int bottom) |
Sets the margins around the contents of the widget to have the sizes left, top, right, and bottom. More... | |
void | setContentsMargins (const QMargins &margins) |
The setContentsMargins function sets the margins around the widget's contents. More... | |
void | setContextMenuPolicy (Qt::ContextMenuPolicy policy) |
void | setCursor (const QCursor &) |
void | setFixedHeight (int h) |
Sets both the minimum and maximum heights of the widget to h without changing the widths. More... | |
void | setFixedSize (const QSize &) |
Sets both the minimum and maximum sizes of the widget to s, thereby preventing it from ever growing or shrinking. More... | |
void | setFixedSize (int w, int h) |
Sets the width of the widget to w and the height to h. More... | |
void | setFixedWidth (int w) |
Sets both the minimum and maximum width of the widget to w without changing the heights. More... | |
void | setFocus (Qt::FocusReason reason) |
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the active window. More... | |
void | setFocusPolicy (Qt::FocusPolicy policy) |
void | setFocusProxy (QWidget *) |
Sets the widget's focus proxy to widget w. More... | |
void | setFont (const QFont &) |
Use the single-argument overload instead. More... | |
void | setForegroundRole (QPalette::ColorRole) |
Sets the foreground role of the widget to role. More... | |
void | setGeometry (int x, int y, int w, int h) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This corresponds to setGeometry(QRect(x, y, w, h)). More... | |
void | setGeometry (const QRect &) |
void | setGraphicsEffect (QGraphicsEffect *effect) |
The setGraphicsEffect function is for setting the widget's graphics effect. More... | |
void | setInputContext (QInputContext *) |
This function sets the input context context on this widget. More... | |
void | setInputMethodHints (Qt::InputMethodHints hints) |
void | setLayout (QLayout *) |
Sets the layout manager for this widget to layout. More... | |
void | setLayoutDirection (Qt::LayoutDirection direction) |
void | setLocale (const QLocale &locale) |
void | setMask (const QBitmap &) |
Causes only the pixels of the widget for which bitmap has a corresponding 1 bit to be visible. More... | |
void | setMask (const QRegion &) |
Causes only the parts of the widget which overlap region to be visible. More... | |
void | setMaximumHeight (int maxh) |
void | setMaximumSize (const QSize &) |
void | setMaximumSize (int maxw, int maxh) |
This function corresponds to setMaximumSize(QSize(maxw, maxh)). More... | |
void | setMaximumWidth (int maxw) |
void | setMinimumHeight (int minh) |
void | setMinimumSize (const QSize &) |
void | setMinimumSize (int minw, int minh) |
This function corresponds to setMinimumSize(QSize(minw, minh)). More... | |
void | setMinimumWidth (int minw) |
void | setMouseTracking (bool enable) |
void | setPalette (const QPalette &) |
Use the single-argument overload instead. More... | |
void | setParent (QWidget *parent) |
Sets the parent of the widget to parent, and resets the window flags. More... | |
void | setParent (QWidget *parent, Qt::WindowFlags f) |
This function also takes widget flags, f as an argument. More... | |
void | setShortcutAutoRepeat (int id, bool enable=true) |
If enable is true, auto repeat of the shortcut with the given id is enabled; otherwise it is disabled. More... | |
void | setShortcutEnabled (int id, bool enable=true) |
If enable is true, the shortcut with the given id is enabled; otherwise the shortcut is disabled. More... | |
void | setSizeIncrement (const QSize &) |
void | setSizeIncrement (int w, int h) |
Sets the x (width) size increment to w and the y (height) size increment to h. More... | |
void | setSizePolicy (QSizePolicy) |
void | setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical) |
Sets the size policy of the widget to horizontal and vertical, with standard stretch and no height-for-width. More... | |
void | setStatusTip (const QString &) |
void | setStyle (QStyle *) |
Sets the widget's GUI style to style. More... | |
void | setToolTip (const QString &) |
void | setUpdatesEnabled (bool enable) |
void | setupUi (QWidget *widget) |
Sets up the user interface for the specified widget. More... | |
void | setWhatsThis (const QString &) |
void | setWindowFilePath (const QString &filePath) |
void | setWindowFlags (Qt::WindowFlags type) |
void | setWindowIcon (const QIcon &icon) |
void | setWindowIconText (const QString &) |
void | setWindowModality (Qt::WindowModality windowModality) |
void | setWindowOpacity (qreal level) |
void | setWindowRole (const QString &) |
Sets the window's role to role. More... | |
void | setWindowState (Qt::WindowStates state) |
Sets the window state to windowState. More... | |
void | setWindowSurface (QWindowSurface *surface) |
Sets the window surface to be the surface specified. More... | |
QSize | size () const |
QSize | sizeIncrement () const |
QSizePolicy | sizePolicy () const |
void | stackUnder (QWidget *) |
Places the widget under w in the parent widget's stack. More... | |
QString | statusTip () const |
QStyle * | style () const |
QString | styleSheet () const |
bool | testAttribute (Qt::WidgetAttribute) const |
Returns true if attribute attribute is set on this widget; otherwise returns false. More... | |
QString | toolTip () const |
QWidget * | topLevelWidget () const |
bool | underMouse () const |
Returns true if the widget is under the mouse cursor; otherwise returns false. More... | |
void | ungrabGesture (Qt::GestureType type) |
Unsubscribes the widget from a given gesture type. More... | |
void | unsetCursor () |
void | unsetLayoutDirection () |
void | unsetLocale () |
void | update (int x, int y, int w, int h) |
This version updates a rectangle (x, y, w, h) inside the widget. More... | |
void | update (const QRect &) |
This version updates a rectangle rect inside the widget. More... | |
void | update (const QRegion &) |
This version repaints a region rgn inside the widget. More... | |
void | updateGeometry () |
Notifies the layout system that this widget has changed and may need to change geometry. More... | |
bool | updatesEnabled () const |
QRegion | visibleRegion () const |
Returns the unobscured region where paint events can occur. More... | |
QString | whatsThis () const |
int | width () const |
QWidget * | window () const |
Returns the window for this widget, i.e. More... | |
QString | windowFilePath () const |
Qt::WindowFlags | windowFlags () const |
Window flags are a combination of a type (e. More... | |
QIcon | windowIcon () const |
QString | windowIconText () const |
Qt::WindowModality | windowModality () const |
qreal | windowOpacity () const |
QString | windowRole () const |
Returns the window's role, or an empty string. More... | |
Qt::WindowStates | windowState () const |
Returns the current window state. More... | |
QWindowSurface * | windowSurface () const |
Returns the QWindowSurface this widget will be drawn into. More... | |
QString | windowTitle () const |
Qt::WindowType | windowType () const |
Returns the window type of this widget. More... | |
WId | winId () const |
Returns the window system identifier of the widget. More... | |
int | x () const |
const QX11Info & | x11Info () const |
Returns information about the configuration of the X display used to display the widget. More... | |
Qt::HANDLE | x11PictureHandle () const |
Returns the X11 Picture handle of the widget for XRender support. More... | |
int | y () const |
~QWidget () | |
Destroys the widget. More... | |
Public Functions inherited from QObject | |
bool | blockSignals (bool b) |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More... | |
const QObjectList & | children () const |
Returns a list of child objects. More... | |
bool | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0) |
bool | disconnect (const QObject *receiver, const char *member=0) |
void | dumpObjectInfo () |
Dumps information about signal connections, etc. More... | |
void | dumpObjectTree () |
Dumps a tree of children to the debug output. More... | |
QList< QByteArray > | dynamicPropertyNames () const |
Returns the names of all properties that were dynamically added to the object using setProperty(). More... | |
virtual bool | eventFilter (QObject *, QEvent *) |
Filters events if this object has been installed as an event filter for the watched object. More... | |
template<typename T > | |
T | findChild (const QString &aName=QString()) const |
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More... | |
template<typename T > | |
QList< T > | findChildren (const QString &aName=QString()) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More... | |
template<typename T > | |
QList< T > | findChildren (const QRegExp &re) const |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More... | |
void | installEventFilter (QObject *) |
Installs an event filter filterObj on this object. More... | |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false. More... | |
void | killTimer (int id) |
Kills the timer with timer identifier, id. More... | |
virtual const QMetaObject * | metaObject () const |
Returns a pointer to the meta-object of this object. More... | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. More... | |
QString | objectName () const |
QObject * | parent () const |
Returns a pointer to the parent object. More... | |
QVariant | property (const char *name) const |
Returns the value of the object's name property. More... | |
Q_INVOKABLE | QObject (QObject *parent=0) |
Constructs an object with parent object parent. More... | |
void | removeEventFilter (QObject *) |
Removes an event filter object obj from this object. More... | |
void | setObjectName (const QString &name) |
void | setParent (QObject *) |
Makes the object a child of parent. More... | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. More... | |
void | setUserData (uint id, QObjectUserData *data) |
bool | signalsBlocked () const |
Returns true if signals are blocked; otherwise returns false. More... | |
int | startTimer (int interval) |
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More... | |
QThread * | thread () const |
Returns the thread in which the object lives. More... | |
QObjectUserData * | userData (uint id) const |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. More... | |
Public Functions inherited from QPaintDevice | |
int | colorCount () const |
int | depth () const |
int | height () const |
int | heightMM () const |
int | logicalDpiX () const |
int | logicalDpiY () const |
QT_DEPRECATED int | numColors () const |
bool | paintingActive () const |
int | physicalDpiX () const |
int | physicalDpiY () const |
int | width () const |
int | widthMM () const |
virtual | ~QPaintDevice () |
Protected Functions | |
void | changeEvent (QEvent *) |
Reimplemented Function More... | |
void | contextMenuEvent (QContextMenuEvent *) |
Shows the standard context menu created with createStandardContextMenu(). More... | |
QRect | cursorRect () const |
Returns a rectangle that includes the lineedit cursor. More... | |
void | dragEnterEvent (QDragEnterEvent *) |
em>Reimplemented Function More... | |
void | dragLeaveEvent (QDragLeaveEvent *e) |
em>Reimplemented Function More... | |
void | dragMoveEvent (QDragMoveEvent *e) |
em>Reimplemented Function More... | |
void | dropEvent (QDropEvent *) |
This event handler is called when the drag is dropped on this widget. More... | |
void | focusInEvent (QFocusEvent *) |
em>Reimplemented Function More... | |
void | focusOutEvent (QFocusEvent *) |
em>Reimplemented Function More... | |
void | initStyleOption (QStyleOptionFrame *option) const |
Initialize option with the values from this QLineEdit. More... | |
void | inputMethodEvent (QInputMethodEvent *) |
Reimplemented Function More... | |
void | keyPressEvent (QKeyEvent *) |
Converts the given key press event into a line edit action. More... | |
void | mouseDoubleClickEvent (QMouseEvent *) |
Reimplemented Function More... | |
void | mouseMoveEvent (QMouseEvent *) |
Reimplemented Function More... | |
void | mousePressEvent (QMouseEvent *) |
Reimplemented Function More... | |
void | mouseReleaseEvent (QMouseEvent *) |
Reimplemented Function More... | |
void | paintEvent (QPaintEvent *) |
em>Reimplemented Function More... | |
Protected Functions inherited from QWidget | |
virtual void | actionEvent (QActionEvent *) |
This event handler is called with the given event whenever the widget's actions are changed. More... | |
virtual void | closeEvent (QCloseEvent *) |
This event handler is called with the given event when Qt receives a window close request for a top-level widget from the window system. More... | |
void | create (WId=0, bool initializeWindow=true, bool destroyOldWindow=true) |
Creates a new widget window if window is 0, otherwise sets the widget's window to window. More... | |
void | destroy (bool destroyWindow=true, bool destroySubWindows=true) |
Frees up window system resources. More... | |
virtual void | enabledChange (bool) |
virtual void | enterEvent (QEvent *) |
This event handler can be reimplemented in a subclass to receive widget enter events which are passed in the event parameter. More... | |
bool | focusNextChild () |
Finds a new widget to give the keyboard focus to, as appropriate for Tab, and returns true if it can find a new widget, or false if it can't. More... | |
virtual bool | focusNextPrevChild (bool next) |
Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget, or false if it can't. More... | |
bool | focusPreviousChild () |
Finds a new widget to give the keyboard focus to, as appropriate for Shift+Tab, and returns true if it can find a new widget, or false if it can't. More... | |
virtual void | fontChange (const QFont &) |
virtual void | hideEvent (QHideEvent *) |
This event handler can be reimplemented in a subclass to receive widget hide events. More... | |
virtual void | keyReleaseEvent (QKeyEvent *) |
This event handler, for event event, can be reimplemented in a subclass to receive key release events for the widget. More... | |
virtual void | languageChange () |
virtual void | leaveEvent (QEvent *) |
This event handler can be reimplemented in a subclass to receive widget leave events which are passed in the event parameter. More... | |
virtual bool | macEvent (EventHandlerCallRef, EventRef) |
This special event handler can be reimplemented in a subclass to receive native Macintosh events. More... | |
int | metric (PaintDeviceMetric) const |
Internal implementation of the virtual QPaintDevice::metric() function. More... | |
virtual void | moveEvent (QMoveEvent *) |
This event handler can be reimplemented in a subclass to receive widget move events which are passed in the event parameter. More... | |
virtual void | paletteChange (const QPalette &) |
QWidget (QWidgetPrivate &d, QWidget *parent, Qt::WindowFlags f) | |
virtual bool | qwsEvent (QWSEvent *) |
This special event handler can be reimplemented in a subclass to receive native Qt for Embedded Linux events which are passed in the event parameter. More... | |
void | resetInputContext () |
This function can be called on the widget that currently has focus to reset the input method operating on it. More... | |
virtual void | resizeEvent (QResizeEvent *) |
This event handler can be reimplemented in a subclass to receive widget resize events which are passed in the event parameter. More... | |
virtual void | showEvent (QShowEvent *) |
This event handler can be reimplemented in a subclass to receive widget show events which are passed in the event parameter. More... | |
virtual void | styleChange (QStyle &) |
virtual void | tabletEvent (QTabletEvent *) |
This event handler, for event event, can be reimplemented in a subclass to receive tablet events for the widget. More... | |
virtual void | wheelEvent (QWheelEvent *) |
This event handler, for event event, can be reimplemented in a subclass to receive wheel events for the widget. More... | |
virtual void | windowActivationChange (bool) |
virtual bool | winEvent (MSG *message, long *result) |
This special event handler can be reimplemented in a subclass to receive native Windows events which are passed in the message parameter. More... | |
virtual bool | x11Event (XEvent *) |
This special event handler can be reimplemented in a subclass to receive native X11 events passed in the event parameter. More... | |
Protected Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *) |
This event handler can be reimplemented in a subclass to receive child events. More... | |
virtual void | connectNotify (const char *signal) |
This virtual function is called when something has been connected to signal in this object. More... | |
virtual void | customEvent (QEvent *) |
This event handler can be reimplemented in a subclass to receive custom events. More... | |
virtual void | disconnectNotify (const char *signal) |
This virtual function is called when something has been disconnected from signal in this object. More... | |
QObject (QObjectPrivate &dd, QObject *parent=0) | |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. More... | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More... | |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *) |
This event handler can be reimplemented in a subclass to receive timer events for the object. More... | |
Protected Functions inherited from QPaintDevice | |
QPaintDevice () | |
Properties | |
bool | acceptableInput |
whether the input satisfies the inputMask and the validator. More... | |
Qt::Alignment | alignment |
the alignment of the line edit More... | |
Qt::CursorMoveStyle | cursorMoveStyle |
the movement style of cursor in this line edit More... | |
int | cursorPosition |
the current cursor position for this line edit More... | |
QString | displayText |
the displayed text More... | |
bool | dragEnabled |
whether the lineedit starts a drag if the user presses and moves the mouse on some selected text More... | |
EchoMode | echoMode |
the line edit's echo mode More... | |
bool | frame |
whether the line edit draws itself with a frame More... | |
bool | hasSelectedText |
whether there is any text selected More... | |
QString | inputMask |
The validation input mask. More... | |
int | maxLength |
the maximum permitted length of the text More... | |
bool | modified |
whether the line edit's contents has been modified by the user More... | |
QString | placeholderText |
the line edit's placeholder text More... | |
bool | readOnly |
whether the line edit is read only. More... | |
bool | redoAvailable |
whether redo is available More... | |
QString | selectedText |
the selected text More... | |
QString | text |
the line edit's text More... | |
bool | undoAvailable |
whether undo is available More... | |
Friends | |
class | QAbstractSpinBox |
class | QAccessibleLineEdit |
Additional Inherited Members | |
Static Public Functions inherited from QWidget | |
static QWidget * | find (WId) |
Returns a pointer to the widget with window identifer/handle id. More... | |
static QWidget * | keyboardGrabber () |
Returns the widget that is currently grabbing the keyboard input. More... | |
static QWidget * | mouseGrabber () |
Returns the widget that is currently grabbing the mouse input. More... | |
static void | setTabOrder (QWidget *, QWidget *) |
Puts the second widget after the first widget in the focus order. More... | |
Static Public Functions inherited from QObject | |
static bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More... | |
static bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
Disconnects signal in object sender from method in object receiver. More... | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static uint | registerUserData () |
static QString | tr (const char *sourceText, const char *comment=0, int n=-1) |
static QString | trUtf8 (const char *sourceText, const char *comment=0, int n=-1) |
Static Public Functions inherited from QPaintDevice | |
static QWSDisplay * | qwsDisplay () |
Static Public Variables inherited from QObject | |
static const QMetaObject | staticMetaObject |
This variable stores the meta-object for the class. More... | |
Protected Slots inherited from QWidget | |
void | updateMicroFocus () |
Updates the widget's micro focus. More... | |
Protected Variables inherited from QObject | |
QScopedPointer< QObjectData > | d_ptr |
Protected Variables inherited from QPaintDevice | |
ushort | painters |
Static Protected Variables inherited from QObject | |
static const QMetaObject | staticQtMetaObject |
Related Functions inherited from QWidget | |
QWidgetList | |
WId | |
Platform dependent window identifier. More... | |
Related Functions inherited from QObject | |
T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QRegExp ®Exp)() |
T * | qobject_cast (QObject *object) |
QObjectList | |
void * | qt_find_obj_child (QObject *parent, const char *type, const QString &name) |
Returns a pointer to the object named name that inherits type and with a given parent. More... | |
Related Functions inherited from QPaintDevice | |
const Q_GUI_EXPORT QX11Info * | qt_x11Info (const QPaintDevice *pd) |
Returns the QX11Info structure for the pd paint device. More... | |
The QLineEdit widget is a one-line text editor.
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.
By changing the echoMode() of a line edit, it can also be used as a "write-only" field, for inputs such as passwords.
The length of the text can be constrained to maxLength(). The text can be arbitrarily constrained using a validator() or an inputMask(), or both. When switching between a validator and an input mask on the same line edit, it is best to clear the validator or input mask to prevent undefined behavior.
A related class is QTextEdit which allows multi-line, rich text editing.
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().
When the text changes the textChanged() signal is emitted; when the text changes other than by calling setText() the textEdited() signal is emitted; when the cursor is moved the cursorPositionChanged() signal is emitted; and when the Return or Enter key is pressed the returnPressed() signal is emitted.
When editing is finished, either because the line edit lost focus or Return/Enter is pressed the editingFinished() signal is emitted.
Note that if there is a validator set on the line edit, the returnPressed()/editingFinished() signals will only be emitted if the validator returns QValidator::Acceptable.
By default, QLineEdits have a frame as specified by the Windows and Motif style guides; you can turn it off by calling setFrame(false).
The default key bindings are described below. The line edit also provides a context menu (usually invoked by a right mouse click) that presents some of these editing options.
Keypress | Action |
Left Arrow | Moves the cursor one character to the left. |
Shift+Left Arrow | Moves and selects text one character to the left. |
Right Arrow | Moves the cursor one character to the right. |
Shift+Right Arrow | Moves and selects text one character to the right. |
Home | Moves the cursor to the beginning of the line. |
End | Moves the cursor to the end of the line. |
Backspace | Deletes the character to the left of the cursor. |
Ctrl+Backspace | Deletes the word to the left of the cursor. |
Delete | Deletes the character to the right of the cursor. |
Ctrl+Delete | Deletes the word to the right of the cursor. |
Ctrl+A | Select all. |
Ctrl+C | Copies the selected text to the clipboard. |
Ctrl+Insert | Copies the selected text to the clipboard. |
Ctrl+K | Deletes to the end of the line. |
Ctrl+V | Pastes the clipboard text into line edit. |
Shift+Insert | Pastes the clipboard text into line edit. |
Ctrl+X | Deletes the selected text and copies it to the clipboard. |
Shift+Delete | Deletes the selected text and copies it to the clipboard. |
Ctrl+Z | Undoes the last operation. |
Ctrl+Y | Redoes the last undone operation. |
Any other key sequence that represents a valid character, will cause the character to be inserted into the line edit.
A line edit shown in the Macintosh Style Widget Gallery{Macintosh widget style}. | |
A line edit shown in the Windows XP Style Widget Gallery{Windows XP widget style}. | |
A line edit shown in the Plastique Style Widget Gallery{Plastique widget style}. |
Definition at line 66 of file qlineedit.h.
enum QLineEdit::EchoMode |
This enum type describes how a line edit should display its contents.
Enumerator | |
---|---|
Normal | |
NoEcho | |
Password | |
PasswordEchoOnEdit |
Definition at line 113 of file qlineedit.h.
|
explicit |
Constructs a line edit with no text.
The maximum text length is set to 32767 characters.
The parent argument is sent to the QWidget constructor.
Definition at line 280 of file qlineedit.cpp.
Referenced by QLineEdit().
Constructs a line edit containing the text contents.
The cursor position is set to the end of the line and the maximum text length to 32767 characters.
The parent and argument is sent to the QWidget constructor.
Definition at line 298 of file qlineedit.cpp.
QLineEdit::~QLineEdit | ( | ) |
Qt::Alignment QLineEdit::alignment | ( | ) | const |
Referenced by cursorPositionAt(), and setAlignment().
void QLineEdit::backspace | ( | ) |
If no text is selected, deletes the character to the left of the text cursor and moves the cursor one position to the left.
If any text is selected, the cursor is moved to the beginning of the selected text and the selected text is deleted.
Definition at line 896 of file qlineedit.cpp.
|
protectedvirtual |
Reimplemented Function
Reimplemented from QWidget.
Definition at line 2299 of file qlineedit.cpp.
Referenced by QExpandingLineEdit::changeEvent().
|
slot |
Clears the contents of the line edit.
Definition at line 1443 of file qlineedit.cpp.
Referenced by QFileDialogPrivate::_q_enterDirectory(), inputMethodEvent(), and QScriptNewBreakpointWidget::onOkClicked().
QCompleter * QLineEdit::completer | ( | ) | const |
Returns the current QCompleter that provides completions.
Definition at line 686 of file qlineedit.cpp.
Referenced by QComboBoxPrivate::matchFlags().
|
protectedvirtual |
Shows the standard context menu created with createStandardContextMenu().
If you do not want the line edit to have a context menu, you can set its contextMenuPolicy to Qt::NoContextMenu. If you want to customize the context menu, reimplement this function. If you want to extend the standard context menu, reimplement this function, call createStandardContextMenu() and extend the menu returned.
The event parameter is used to obtain the position where the mouse cursor was when the event was generated.
Reimplemented from QWidget.
Definition at line 2205 of file qlineedit.cpp.
|
slot |
Copies the selected text to the clipboard, if there is any, and if echoMode() is Normal .
Definition at line 1541 of file qlineedit.cpp.
Referenced by createStandardContextMenu(), and cut().
QMenu * QLineEdit::createStandardContextMenu | ( | ) |
This function creates the standard context menu which is shown when the user clicks on the line edit with the right mouse button.
It is called from the default contextMenuEvent() handler. The popup menu's ownership is transferred to the caller.
Definition at line 2223 of file qlineedit.cpp.
Referenced by contextMenuEvent().
void QLineEdit::cursorBackward | ( | bool | mark, |
int | steps = 1 |
||
) |
Moves the cursor back steps characters.
If mark is true each character moved over is added to the selection; if mark is false the selection is cleared.
Definition at line 857 of file qlineedit.cpp.
void QLineEdit::cursorForward | ( | bool | mark, |
int | steps = 1 |
||
) |
Moves the cursor forward steps characters.
If mark is true each character moved over is added to the selection; if mark is false the selection is cleared.
Definition at line 843 of file qlineedit.cpp.
Referenced by cursorBackward().
Qt::CursorMoveStyle QLineEdit::cursorMoveStyle | ( | ) | const |
Referenced by setDragEnabled().
int QLineEdit::cursorPosition | ( | ) | const |
Referenced by minimumSizeHint().
int QLineEdit::cursorPositionAt | ( | const QPoint & | pos | ) |
Returns the cursor position under the point pos.
Definition at line 768 of file qlineedit.cpp.
Referenced by QAccessibleLineEdit::offsetAtPoint().
|
signal |
This signal is emitted whenever the cursor moves.
The previous position is given by old, and the new position by new.
|
protected |
Returns a rectangle that includes the lineedit cursor.
Definition at line 1825 of file qlineedit.cpp.
void QLineEdit::cursorWordBackward | ( | bool | mark | ) |
Moves the cursor one word backward.
If mark is true, the word is also selected.
Definition at line 881 of file qlineedit.cpp.
void QLineEdit::cursorWordForward | ( | bool | mark | ) |
Moves the cursor one word forward.
If mark is true, the word is also selected.
Definition at line 868 of file qlineedit.cpp.
|
slot |
Copies the selected text to the clipboard and deletes it, if there is any, and if echoMode() is Normal .
If the current validator disallows deleting the selected text, cut() will copy without deleting.
Definition at line 1525 of file qlineedit.cpp.
Referenced by createStandardContextMenu().
void QLineEdit::del | ( | ) |
If no text is selected, deletes the character to the right of the text cursor.
If any text is selected, the cursor is moved to the beginning of the selected text and the selected text is deleted.
Definition at line 910 of file qlineedit.cpp.
Referenced by cut().
void QLineEdit::deselect | ( | ) |
Deselects any selected text.
Definition at line 1417 of file qlineedit.cpp.
Referenced by QComboBoxPrivate::_q_returnPressed(), dropEvent(), focusOutEvent(), mouseReleaseEvent(), and QAccessibleLineEdit::removeSelection().
QString QLineEdit::displayText | ( | ) | const |
Referenced by QExpandingLineEdit::resizeToContents(), and setPlaceholderText().
bool QLineEdit::dragEnabled | ( | ) | const |
Referenced by isRedoAvailable().
|
protectedvirtual |
em>Reimplemented Function
Reimplemented from QWidget.
Definition at line 2135 of file qlineedit.cpp.
|
protectedvirtual |
em>Reimplemented Function
Reimplemented from QWidget.
Definition at line 2141 of file qlineedit.cpp.
|
protectedvirtual |
em>Reimplemented Function
Reimplemented from QWidget.
Definition at line 2123 of file qlineedit.cpp.
Referenced by dragEnterEvent().
|
protectedvirtual |
This event handler is called when the drag is dropped on this widget.
The event is passed in the event parameter.
See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application.
Reimplemented from QWidget.
Definition at line 2151 of file qlineedit.cpp.
EchoMode QLineEdit::echoMode | ( | ) | const |
Referenced by inputMethodEvent(), and setFrame().
|
signal |
This signal is emitted when the Return or Enter key is pressed or the line edit loses focus.
Note that if there is a validator() or inputMask() set on the line edit and enter/return is pressed, the editingFinished() signal will only be emitted if the input follows the inputMask() and the validator() returns QValidator::Acceptable.
Referenced by event(), and focusOutEvent().
void QLineEdit::end | ( | bool | mark | ) |
Moves the text cursor to the end of the line unless it is already there.
If mark is true, text is selected towards the last position; otherwise, any selected text is unselected if the cursor is moved.
Definition at line 940 of file qlineedit.cpp.
Referenced by QComboBoxPrivate::_q_returnPressed(), event(), and selectionStart().
|
virtual |
Reimplemented Function
Reimplemented from QWidget.
Definition at line 1568 of file qlineedit.cpp.
|
protectedvirtual |
em>Reimplemented Function
Reimplemented from QWidget.
Definition at line 1900 of file qlineedit.cpp.
|
protectedvirtual |
em>Reimplemented Function
Reimplemented from QWidget.
Definition at line 1949 of file qlineedit.cpp.
void QLineEdit::getTextMargins | ( | int * | left, |
int * | top, | ||
int * | right, | ||
int * | bottom | ||
) | const |
Returns the widget's text margins for left, top, right, and bottom.
Definition at line 1290 of file qlineedit.cpp.
Referenced by QAccessibleLineEdit::characterRect(), and QExpandingLineEdit::updateMinimumWidth().
bool QLineEdit::hasAcceptableInput | ( | ) | const |
Definition at line 1246 of file qlineedit.cpp.
Referenced by cursorPositionAt(), focusOutEvent(), and QScriptNewBreakpointWidget::onTextChanged().
bool QLineEdit::hasFrame | ( | ) | const |
Definition at line 507 of file qlineedit.cpp.
bool QLineEdit::hasSelectedText | ( | ) | const |
Referenced by cut(), event(), focusInEvent(), and setModified().
void QLineEdit::home | ( | bool | mark | ) |
Moves the text cursor to the beginning of the line unless it is already there.
If mark is true, text is selected towards the first position; otherwise, any selected text is unselected if the cursor is moved.
Definition at line 925 of file qlineedit.cpp.
|
protected |
Initialize option with the values from this QLineEdit.
This method is useful for subclasses when they need a QStyleOptionFrame or QStyleOptionFrameV2, but don't want to fill in all the information themselves. This function will check the version of the QStyleOptionFrame and fill in the additional values for a QStyleOptionFrameV2.
Definition at line 104 of file qlineedit.cpp.
Referenced by changeEvent(), event(), focusInEvent(), minimumSizeHint(), paintEvent(), setSelection(), sizeHint(), and QExpandingLineEdit::updateMinimumWidth().
QString QLineEdit::inputMask | ( | ) | const |
Referenced by QLineEdit(), and textMargins().
|
protectedvirtual |
Reimplemented Function
em>Reimplemented Function
Reimplemented from QWidget.
Definition at line 1833 of file qlineedit.cpp.
|
virtual |
em>Reimplemented Function
Reimplemented from QWidget.
Definition at line 1869 of file qlineedit.cpp.
void QLineEdit::insert | ( | const QString & | newText | ) |
Deletes any selected text, inserts newText, and validates the result.
If it is valid, it sets it as the new contents of the line edit.
Definition at line 1431 of file qlineedit.cpp.
Referenced by dropEvent(), and mouseReleaseEvent().
bool QLineEdit::isModified | ( | ) | const |
Definition at line 968 of file qlineedit.cpp.
Referenced by QPrintDialogPrivate::_q_okClicked(), QPrintDialogPrivate::_q_printerOrFileSelected(), and selectionStart().
bool QLineEdit::isReadOnly | ( | ) | const |
Definition at line 1493 of file qlineedit.cpp.
Referenced by createStandardContextMenu(), keyPressEvent(), mouseReleaseEvent(), and QAccessibleLineEdit::state().
bool QLineEdit::isRedoAvailable | ( | ) | const |
Definition at line 1156 of file qlineedit.cpp.
bool QLineEdit::isUndoAvailable | ( | ) | const |
Definition at line 1137 of file qlineedit.cpp.
|
protectedvirtual |
Converts the given key press event into a line edit action.
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.
The default key bindings are listed in the class's detailed description.
Reimplemented from QWidget.
Definition at line 1764 of file qlineedit.cpp.
Referenced by QFileDialogLineEdit::keyPressEvent().
int QLineEdit::maxLength | ( | ) | const |
Referenced by inputMethodQuery(), and setPlaceholderText().
|
virtual |
Returns a minimum size for the line edit.
The width returned is enough for at least one character.
Reimplemented from QWidget.
Definition at line 725 of file qlineedit.cpp.
|
protectedvirtual |
Reimplemented Function
Reimplemented from QWidget.
Definition at line 1715 of file qlineedit.cpp.
|
protectedvirtual |
Reimplemented Function
Reimplemented from QWidget.
Definition at line 1662 of file qlineedit.cpp.
|
protectedvirtual |
Reimplemented Function
Reimplemented from QWidget.
Definition at line 1625 of file qlineedit.cpp.
|
protectedvirtual |
Reimplemented Function
Reimplemented from QWidget.
Definition at line 1683 of file qlineedit.cpp.
|
protectedvirtual |
em>Reimplemented Function
Reimplemented from QWidget.
Definition at line 1994 of file qlineedit.cpp.
|
slot |
Inserts the clipboard's text at the cursor position, deleting any selected text, providing the line edit is not read-only.
If the end result would not be acceptable to the current validator, nothing happens.
Definition at line 1558 of file qlineedit.cpp.
Referenced by createStandardContextMenu().
QString QLineEdit::placeholderText | ( | ) | const |
Referenced by setPlaceholderText(), and setText().
|
slot |
Redoes the last operation if redo is available.
Definition at line 1467 of file qlineedit.cpp.
Referenced by createStandardContextMenu().
|
signal |
This signal is emitted when the Return or Enter key is pressed.
Note that if there is a validator() or inputMask() set on the line edit, the returnPressed() signal will only be emitted if the input follows the inputMask() and the validator() returns QValidator::Acceptable.
|
slot |
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 deleted.
Definition at line 1405 of file qlineedit.cpp.
Referenced by QComboBoxPrivate::_q_itemSelected(), QPrintDialogPrivate::_q_printerOrFileSelected(), createStandardContextMenu(), focusInEvent(), mousePressEvent(), and QDateTimeEditPrivate::setSelected().
QString QLineEdit::selectedText | ( | ) | const |
Referenced by inputMethodQuery(), selectionStart(), and setModified().
|
signal |
This signal is emitted whenever the selection changes.
int QLineEdit::selectionStart | ( | ) | const |
selectionStart() returns the index of the first selected character in the line edit or -1 if no text is selected.
Definition at line 1039 of file qlineedit.cpp.
Referenced by QDateTimeEditPrivate::_q_editorCursorPositionChanged(), QAbstractSpinBoxPrivate::_q_editorCursorPositionChanged(), and QAccessibleLineEdit::selection().
void QLineEdit::setAlignment | ( | Qt::Alignment | flag | ) |
Definition at line 827 of file qlineedit.cpp.
void QLineEdit::setCompleter | ( | QCompleter * | c | ) |
Sets this line edit to provide auto completions from the completer, c.
The completion mode is set using QCompleter::setCompletionMode().
To use a QCompleter with a QValidator or QLineEdit::inputMask, you need to ensure that the model provided to QCompleter contains valid entries. You can use the QSortFilterProxyModel to ensure that the QCompleter's model contains only valid entries.
If c == 0, setCompleter() removes the current completer, effectively disabling auto completion.
Definition at line 654 of file qlineedit.cpp.
Referenced by QScriptNewBreakpointWidget::setCompleter().
void QLineEdit::setCursorMoveStyle | ( | Qt::CursorMoveStyle | style | ) |
Sets the movement style for the cursor in the line edit to the given style.
Definition at line 1228 of file qlineedit.cpp.
void QLineEdit::setCursorPosition | ( | int | pos | ) |
Definition at line 758 of file qlineedit.cpp.
Referenced by QDateTimeEditPrivate::_q_editorCursorPositionChanged(), QAbstractSpinBoxPrivate::_q_editorCursorPositionChanged(), QPrintDialogPrivate::_q_printerOrFileSelected(), QDateTimeEditPrivate::clearSection(), QAbstractSpinBoxPrivate::interpret(), QAccessibleLineEdit::scrollToSubstring(), QAccessibleLineEdit::setCursorPosition(), QDateTimeEditPrivate::updateEdit(), and QAbstractSpinBoxPrivate::updateEdit().
void QLineEdit::setDragEnabled | ( | bool | b | ) |
Definition at line 1179 of file qlineedit.cpp.
void QLineEdit::setEchoMode | ( | EchoMode | mode | ) |
Definition at line 575 of file qlineedit.cpp.
void QLineEdit::setFrame | ( | bool | enable | ) |
Definition at line 514 of file qlineedit.cpp.
Referenced by QDefaultItemEditorFactory::createEditor().
void QLineEdit::setInputMask | ( | const QString & | inputMask | ) |
Definition at line 1390 of file qlineedit.cpp.
void QLineEdit::setMaxLength | ( | int | maxLength | ) |
Definition at line 491 of file qlineedit.cpp.
void QLineEdit::setModified | ( | bool | modified | ) |
Definition at line 974 of file qlineedit.cpp.
Referenced by QPrintDialogPrivate::_q_printerOrFileSelected(), selectionStart(), and QPrintDialogPrivate::setPrinter().
void QLineEdit::setPlaceholderText | ( | const QString & | placeholderText | ) |
Definition at line 430 of file qlineedit.cpp.
void QLineEdit::setReadOnly | ( | bool | enable | ) |
Definition at line 1499 of file qlineedit.cpp.
void QLineEdit::setSelection | ( | int | start, |
int | length | ||
) |
Selects text from position start and for length characters.
Negative lengths are allowed.
Definition at line 1106 of file qlineedit.cpp.
Referenced by QAbstractSpinBoxPrivate::_q_editorCursorPositionChanged(), cursorPositionAt(), dropEvent(), QDateTimeEditPrivate::setSelected(), QAccessibleLineEdit::setSelection(), QDateTimeEditPrivate::updateEdit(), and QAbstractSpinBoxPrivate::updateEdit().
|
slot |
Definition at line 401 of file qlineedit.cpp.
Referenced by QComboBoxPrivate::_q_dataChanged(), QFileDialogPrivate::_q_enterDirectory(), QFileDialogPrivate::_q_fileRenamed(), QComboBoxPrivate::_q_itemSelected(), QComboBoxPrivate::_q_modelReset(), QPrintDialogPrivate::_q_printerOrFileSelected(), QComboBoxPrivate::_q_rowsRemoved(), QFileDialogPrivate::_q_selectionChanged(), QFileDialogPrivate::_q_useNameFilter(), QDateTimeEditPrivate::clearSection(), cursorPositionAt(), focusInEvent(), setCompleter(), QComboBoxPrivate::setCurrentIndex(), QInputDialogPrivate::setInputWidget(), QComboBox::setLineEdit(), QPrintDialogPrivate::setPrinter(), QAccessibleLineEdit::setText(), QDateTimeEditPrivate::updateEdit(), and QAbstractSpinBoxPrivate::updateEdit().
void QLineEdit::setTextMargins | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom | ||
) |
Sets the margins around the text inside the frame to have the sizes left, top, right, and bottom.
See also getTextMargins().
Definition at line 1259 of file qlineedit.cpp.
Referenced by setTextMargins().
void QLineEdit::setTextMargins | ( | const QMargins & | margins | ) |
Sets the margins around the text inside the frame.
See also textMargins().
Definition at line 1279 of file qlineedit.cpp.
void QLineEdit::setValidator | ( | const QValidator * | v | ) |
Sets this line edit to only accept input that the validator, v, will accept.
This allows you to place any arbitrary constraints on the 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 input is accepted up to maxLength()).
Definition at line 627 of file qlineedit.cpp.
Referenced by QAbstractSpinBoxPrivate::init(), and QScriptNewBreakpointWidget::QScriptNewBreakpointWidget().
|
virtual |
Returns a recommended size for the widget.
The width returned, in pixels, is usually enough for about 15 to 20 characters.
Reimplemented from QWidget.
Definition at line 701 of file qlineedit.cpp.
QString QLineEdit::text | ( | ) | const |
Referenced by cursorPositionAt(), inputMethodQuery(), mouseReleaseEvent(), and ~QLineEdit().
|
signal |
This signal is emitted whenever the text changes.
The text argument is the new text.
Unlike textEdited(), this signal is also emitted when the text is changed programmatically, for example, by calling setText().
Referenced by QExpandingLineEdit::QExpandingLineEdit().
|
signal |
This signal is emitted whenever the text is edited.
The text argument is the new text.
Unlike textChanged(), this signal is not emitted when the text is changed programmatically, for example, by calling setText().
QMargins QLineEdit::textMargins | ( | ) | const |
Returns the widget's text margins.
Definition at line 1312 of file qlineedit.cpp.
|
slot |
Undoes the last operation if undo is available.
Deselects any current selection, and updates the selection start to the current cursor position.
Definition at line 1456 of file qlineedit.cpp.
Referenced by createStandardContextMenu().
const QValidator * QLineEdit::validator | ( | ) | const |
Returns a pointer to the current input validator, or 0 if no validator has been set.
Definition at line 609 of file qlineedit.cpp.
|
friend |
Definition at line 275 of file qlineedit.h.
|
friend |
Definition at line 276 of file qlineedit.h.
|
private |
whether the input satisfies the inputMask and the validator.
By default, this property is true.
Definition at line 86 of file qlineedit.h.
|
private |
the alignment of the line edit
Both horizontal and vertical alignment is allowed here, Qt::AlignJustify will map to Qt::AlignLeft.
By default, this property contains a combination of Qt::AlignLeft and Qt::AlignVCenter.
Definition at line 78 of file qlineedit.h.
|
private |
the movement style of cursor in this line edit
Returns the movement style for the cursor in the line edit.
When this property is set to Qt::VisualMoveStyle, the line edit will use visual movement style. Pressing the left arrow key will always cause the cursor to move left, regardless of the text's writing direction. The same behavior applies to right arrow key.
When the property is Qt::LogicalMoveStyle (the default), within a LTR text block, increase cursor position when pressing left arrow key, decrease cursor position when pressing the right arrow key. If the text block is right to left, the opposite behavior applies.
Definition at line 88 of file qlineedit.h.
|
private |
the current cursor position for this line edit
Setting the cursor position causes a repaint when appropriate.
By default, this property contains a value of 0.
Definition at line 77 of file qlineedit.h.
Referenced by QAbstractSpinBoxPrivate::_q_editorTextChanged(), QDateTimeEditPrivate::clearSection(), QScriptDebuggerLocalsWidgetPrivate::complete(), QDateTimeEditPrivate::cursorPosition(), QAccessibleLineEdit::cursorPosition(), QDateTimeEditPrivate::interpret(), QAbstractSpinBoxPrivate::interpret(), QDateTimeEditPrivate::stepBy(), QDateTimeEditPrivate::updateCache(), and QAbstractSpinBoxPrivate::updateEdit().
|
private |
the displayed text
If echoMode is Normal this returns the same as text(); if EchoMode is Password or PasswordEchoOnEdit it returns a string of asterisks text().length() characters long, e.g. "******"; if EchoMode is NoEcho returns an empty string, "".
By default, this property contains an empty string.
Definition at line 76 of file qlineedit.h.
Referenced by QAbstractSpinBoxPrivate::interpret(), QAbstractSpinBox::setButtonSymbols(), and QAbstractSpinBoxPrivate::updateEdit().
|
private |
whether the lineedit starts a drag if the user presses and moves the mouse on some selected text
Dragging is disabled by default.
Definition at line 82 of file qlineedit.h.
|
private |
the line edit's echo mode
The echo mode determines how the text entered in the line edit is displayed (or echoed) to the user.
The most common setting is Normal , in which the text entered by the user is displayed verbatim, but QLineEdit also supports modes that allow the entered text to be suppressed or obscured: these include NoEcho , Password and PasswordEchoOnEdit .
The widget's display and the ability to copy or drag the text is affected by this setting.
By default, this property is set to Normal .
Definition at line 75 of file qlineedit.h.
Referenced by QAccessibleLineEdit::state().
|
private |
whether the line edit draws itself with a frame
Use hasFrame() instead.
If enabled (the default) the line edit draws itself inside a frame, otherwise the line edit draws itself without any frame.
Definition at line 74 of file qlineedit.h.
|
private |
whether there is any text selected
hasSelectedText() returns true if some or all of the text has been selected by the user; otherwise returns false.
By default, this property is false.
Definition at line 80 of file qlineedit.h.
Referenced by QDateTimeEditPrivate::_q_editorCursorPositionChanged(), QAbstractSpinBoxPrivate::_q_editorCursorPositionChanged(), QAccessibleLineEdit::selectionCount(), and QAccessibleLineEdit::state().
|
private |
The validation input mask.
If no mask is set, inputMask() returns an empty string.
Sets the QLineEdit's validation mask. Validators can be used instead of, or in conjunction with masks; see setValidator().
Unset the mask and return to normal QLineEdit operation by passing an empty string ("") or just calling setInputMask() with no arguments.
The table below shows the characters that can be used in an input mask. A space character, the default character for a blank, is needed for cases where a character is permitted but not required.
Character | Meaning |
A | ASCII alphabetic character required. A-Z, a-z. |
a | ASCII alphabetic character permitted but not required. |
N | ASCII alphanumeric character required. A-Z, a-z, 0-9. |
n | ASCII alphanumeric character permitted but not required. |
X | Any character required. |
x | Any character permitted but not required. |
9 | ASCII digit required. 0-9. |
0 | ASCII digit permitted but not required. |
D | ASCII digit required. 1-9. |
d | ASCII digit permitted but not required (1-9). |
# | ASCII digit or plus/minus sign permitted but not required. |
H | Hexadecimal character required. A-F, a-f, 0-9. |
h | Hexadecimal character permitted but not required. |
B | Binary character required. 0-1. |
b | Binary character permitted but not required. |
> | All following alphabetic characters are uppercased. |
< | All following alphabetic characters are lowercased. |
! | Switch off case conversion. |
\ | Use \ to escape the special characters listed above to use them as separators. |
The mask consists of a string of mask characters and separators, optionally followed by a semicolon and the character used for blanks. The blank characters are always removed from the text after editing.
Examples:
Mask | Notes |
000.000.000.000 ;_ | IP address; blanks are _ . |
HH:HH:HH:HH:HH:HH ;_ | MAC address |
0000-00-00 | ISO Date; blanks are space |
>AAAAA-AAAAA-AAAAA-AAAAA-AAAAA ;# | License number; blanks are - and all (alphabetic) characters are converted to uppercase. |
To get range control (e.g., for an IP address) use masks together with validators.
Definition at line 71 of file qlineedit.h.
|
private |
the maximum permitted length of the text
If the text is too long, it is truncated at the limit.
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.
If the line edit has an input mask, the mask defines the maximum string length.
By default, this property contains a value of 32767.
Definition at line 73 of file qlineedit.h.
|
private |
whether the line edit's contents has been modified by the user
The modified 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.
This is useful for things that need to provide a default value but do not start out knowing what the default should be (perhaps it depends on other fields on the form). Start the line edit without the best default, and when the default is known, if modified() returns false (the user hasn't entered any text), insert the default value.
Calling setText() resets the modified flag to false.
Definition at line 79 of file qlineedit.h.
|
private |
the line edit's placeholder text
Setting this property makes the line edit display a grayed-out placeholder text as long as the text() is empty and the widget doesn't have focus.
By default, this property contains an empty string.
Definition at line 87 of file qlineedit.h.
|
private |
whether the line edit is read only.
In read-only mode, the user can still copy the text to the clipboard, or drag and drop the text (if echoMode() is Normal ), but cannot edit it.
QLineEdit does not show a cursor in read-only mode.
By default, this property is false.
Definition at line 83 of file qlineedit.h.
|
private |
whether redo is available
Redo becomes available once the user has performed one or more undo operations on text in the line edit.
By default, this property is false.
Definition at line 85 of file qlineedit.h.
|
private |
the selected text
If there is no selected text this property's value is an empty string.
By default, this property contains an empty string.
Definition at line 81 of file qlineedit.h.
Referenced by QDateTimeEditPrivate::_q_editorCursorPositionChanged(), QAbstractSpinBoxPrivate::_q_editorCursorPositionChanged(), QAccessibleLineEdit::selection(), QDateTimeEditPrivate::updateEdit(), and QAbstractSpinBoxPrivate::updateEdit().
|
private |
the line edit's text
Setting this property clears the selection, clears the undo/redo history, moves the cursor to the end of the line and resets the modified property to false. The text is not validated when inserted with setText().
The text is truncated to maxLength() length.
By default, this property contains an empty string.
Definition at line 72 of file qlineedit.h.
Referenced by QComboBoxPrivate::_q_editingFinished(), QAbstractSpinBoxPrivate::_q_editorCursorPositionChanged(), QScriptDebuggerCodeFinderWidgetPrivate::_q_next(), QPrintDialogPrivate::_q_okClicked(), QScriptDebuggerCodeFinderWidgetPrivate::_q_previous(), QPrintDialogPrivate::_q_printerOrFileSelected(), QComboBoxPrivate::_q_returnPressed(), QScriptDebuggerCodeFinderWidgetPrivate::_q_updateButtons(), QFileDialogPrivate::_q_updateOkButton(), QFileDialogPrivate::_q_useNameFilter(), QAccessibleLineEdit::characterCount(), QDateTimeEditPrivate::clearSection(), QScriptDebuggerLocalsWidgetPrivate::complete(), QDateTimeEditPrivate::displayText(), QScriptDebuggerLocalsItemDelegate::eventFilter(), QScriptNewBreakpointWidget::onOkClicked(), QComboBoxPrivate::setCurrentIndex(), QPrintDialogPrivate::setPrinter(), QAccessibleLineEdit::text(), QAccessibleComboBox::text(), QFileDialogPrivate::typedFiles(), and QAbstractSpinBoxPrivate::updateEdit().
|
private |
whether undo is available
Undo becomes available once the user has modified the text in the line edit.
By default, this property is false.
Definition at line 84 of file qlineedit.h.