Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QWidgetLineControl Class Reference

#include <qwidgetlinecontrol_p.h>

+ Inheritance diagram for QWidgetLineControl:
+ Collaboration diagram for QWidgetLineControl:

Public Types

enum  DrawFlags { DrawText = 0x01 , DrawSelections = 0x02 , DrawCursor = 0x04 , DrawAll = DrawText | DrawSelections | DrawCursor }
 
- Public Types inherited from QInputControl
enum  Type { LineEdit , TextEdit }
 

Signals

void cursorPositionChanged (int, int)
 
void selectionChanged ()
 
void displayTextChanged (const QString &)
 
void textChanged (const QString &)
 
void textEdited (const QString &)
 
void resetInputContext ()
 
void updateMicroFocus ()
 
void accepted ()
 
void editingFinished ()
 
void updateNeeded (const QRect &)
 
void inputRejected ()
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 

Public Member Functions

 QWidgetLineControl (const QString &txt=QString())
 
 ~QWidgetLineControl ()
 
void setAccessibleObject (QObject *object)
 
QObjectaccessibleObject ()
 
int nextMaskBlank (int pos)
 
int prevMaskBlank (int pos)
 
bool isUndoAvailable () const
 
bool isRedoAvailable () const
 
void clearUndo ()
 
bool isModified () const
 
void setModified (bool modified)
 
bool allSelected () const
 
bool hasSelectedText () const
 
int width () const
 
int height () const
 
int ascent () const
 
qreal naturalTextWidth () const
 
void setSelection (int start, int length)
 
QString selectedText () const
 
QString textBeforeSelection () const
 
QString textAfterSelection () const
 
int selectionStart () const
 
int selectionEnd () const
 
bool inSelection (int x) const
 
void removeSelection ()
 
int start () const
 
int end () const
 
void copy (QClipboard::Mode mode=QClipboard::Clipboard) const
 
void paste (QClipboard::Mode mode=QClipboard::Clipboard)
 
int cursor () const
 
int preeditCursor () const
 
int cursorWidth () const
 
void setCursorWidth (int value)
 
Qt::CursorMoveStyle cursorMoveStyle () const
 
void setCursorMoveStyle (Qt::CursorMoveStyle style)
 
void moveCursor (int pos, bool mark=false)
 
void cursorForward (bool mark, int steps)
 
void cursorWordForward (bool mark)
 
void cursorWordBackward (bool mark)
 
void home (bool mark)
 
void end (bool mark)
 
int xToPos (int x, QTextLine::CursorPosition=QTextLine::CursorBetweenCharacters) const
 
QRect rectForPos (int pos) const
 
QRect cursorRect () const
 
QRect anchorRect () const
 
qreal cursorToX (int cursor) const
 
qreal cursorToX () const
 
bool isReadOnly () const
 
void setReadOnly (bool enable)
 
QString text () const
 
void setText (const QString &txt)
 
void commitPreedit ()
 
QString displayText () const
 
QString surroundingText () const
 
void backspace ()
 
void del ()
 
void deselect ()
 
void selectAll ()
 
void insert (const QString &)
 
void clear ()
 
void undo ()
 
void redo ()
 
void selectWordAtPos (int)
 
uint echoMode () const
 
void setEchoMode (uint mode)
 
int maxLength () const
 
void setMaxLength (int maxLength)
 
const QValidatorvalidator () const
 
void setValidator (const QValidator *v)
 
int cursorPosition () const
 
void setCursorPosition (int pos)
 
bool hasAcceptableInput () const
 
bool fixup ()
 
QString inputMask () const
 
void setInputMask (const QString &mask)
 
bool composeMode () const
 
void setPreeditArea (int cursor, const QString &text)
 
QString preeditAreaText () const
 
void updatePasswordEchoEditing (bool editing)
 
bool passwordEchoEditing () const
 
QChar passwordCharacter () const
 
void setPasswordCharacter (QChar character)
 
int passwordMaskDelay () const
 
void setPasswordMaskDelay (int delay)
 
Qt::LayoutDirection layoutDirection () const
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setFont (const QFont &font)
 
void processInputMethodEvent (QInputMethodEvent *event)
 
void processKeyEvent (QKeyEvent *ev)
 
void setBlinkingCursorEnabled (bool enable)
 
void updateCursorBlinking ()
 
void resetCursorBlinkTimer ()
 
bool cursorBlinkStatus () const
 
QString cancelText () const
 
void setCancelText (const QString &text)
 
const QPalettepalette () const
 
void setPalette (const QPalette &p)
 
void draw (QPainter *, const QPoint &, const QRect &, int flags=DrawAll)
 
void processShortcutOverrideEvent (QKeyEvent *ke)
 
QTextLayouttextLayout () const
 
- Public Member Functions inherited from QInputControl
 QInputControl (Type type, QObject *parent=nullptr)
 
bool isAcceptableInput (const QKeyEvent *event) const
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
virtual bool event (QEvent *event)
 This virtual function receives events to an object and should return true if the event e was recognized and processed.
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
void killTimer (Qt::TimerId id)
 
template<typename T >
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) 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.
 
template<typename T >
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
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.
 

Protected Member Functions

virtual void timerEvent (QTimerEvent *event) override
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
- Protected Member Functions inherited from QInputControl
 QInputControl (Type type, QObjectPrivate &dd, QObject *parent=nullptr)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 

Friends

class QLineEdit
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 
- Static Public Member Functions inherited from QInputControl
static bool isCommonTextEditShortcut (const QKeyEvent *ke)
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Detailed Description

Definition at line 50 of file qwidgetlinecontrol_p.h.

Member Enumeration Documentation

◆ DrawFlags

Enumerator
DrawText 
DrawSelections 
DrawCursor 
DrawAll 

Definition at line 355 of file qwidgetlinecontrol_p.h.

Constructor & Destructor Documentation

◆ QWidgetLineControl()

QWidgetLineControl::QWidgetLineControl ( const QString & txt = QString())
inline

Definition at line 55 of file qwidgetlinecontrol_p.h.

References init(), and txt.

+ Here is the call graph for this function:

◆ ~QWidgetLineControl()

QWidgetLineControl::~QWidgetLineControl ( )
inline

Definition at line 75 of file qwidgetlinecontrol_p.h.

References QString::fill(), and QLineEdit::Normal.

+ Here is the call graph for this function:

Member Function Documentation

◆ accepted

void QWidgetLineControl::accepted ( )
signal

Referenced by processKeyEvent().

+ Here is the caller graph for this function:

◆ accessibleObject()

QObject * QWidgetLineControl::accessibleObject ( )
inline

Definition at line 90 of file qwidgetlinecontrol_p.h.

◆ allSelected()

bool QWidgetLineControl::allSelected ( ) const
inline

Definition at line 118 of file qwidgetlinecontrol_p.h.

References QString::isEmpty(), and QString::size().

+ Here is the call graph for this function:

◆ anchorRect()

QRect QWidgetLineControl::anchorRect ( ) const

Returns the bounds of the current anchor

Definition at line 404 of file qwidgetlinecontrol.cpp.

References cursorRect(), hasSelectedText(), and rectForPos().

+ Here is the call graph for this function:

◆ ascent()

int QWidgetLineControl::ascent ( ) const
inline

Definition at line 123 of file qwidgetlinecontrol_p.h.

Referenced by QLineEditPrivate::adjustedControlRect().

+ Here is the caller graph for this function:

◆ backspace()

void QWidgetLineControl::backspace ( )

Handles the behavior for the backspace key or function. Removes the current selection if there is a selection, otherwise removes the character prior to the cursor position.

See also
del()

Definition at line 174 of file qwidgetlinecontrol.cpp.

References QString::at(), hasSelectedText(), and prevMaskBlank().

Referenced by processKeyEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelText()

QString QWidgetLineControl::cancelText ( ) const
inline

Definition at line 349 of file qwidgetlinecontrol_p.h.

◆ clear()

void QWidgetLineControl::clear ( )

Clears the line control text.

Definition at line 240 of file qwidgetlinecontrol.cpp.

References QString::size().

Referenced by processKeyEvent(), timerEvent(), and undo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearUndo()

void QWidgetLineControl::clearUndo ( )
inline

Definition at line 113 of file qwidgetlinecontrol_p.h.

◆ commitPreedit()

void QWidgetLineControl::commitPreedit ( )

Definition at line 147 of file qwidgetlinecontrol.cpp.

References QTextLayout::clearFormats(), composeMode(), QGuiApplication::inputMethod(), and setPreeditArea().

Referenced by moveCursor(), and setSelection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ composeMode()

bool QWidgetLineControl::composeMode ( ) const
inline

Definition at line 306 of file qwidgetlinecontrol_p.h.

Referenced by commitPreedit(), and QLineEditPrivate::sendMouseEventToInputContext().

+ Here is the caller graph for this function:

◆ copy()

void QWidgetLineControl::copy ( QClipboard::Mode mode = QClipboard::Clipboard) const

Copies the currently selected text into the clipboard using the given mode.

Note
If the echo mode is set to a mode other than Normal then copy will not work. This is to prevent using copy as a method of bypassing password features of the line control.

Definition at line 116 of file qwidgetlinecontrol.cpp.

References QGuiApplication::clipboard(), QLineEdit::Normal, and selectedText().

Referenced by processKeyEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cursor()

int QWidgetLineControl::cursor ( ) const
inline

Definition at line 160 of file qwidgetlinecontrol_p.h.

Referenced by draw(), processKeyEvent(), selectWordAtPos(), and QLineEditPrivate::sendMouseEventToInputContext().

+ Here is the caller graph for this function:

◆ cursorBlinkStatus()

bool QWidgetLineControl::cursorBlinkStatus ( ) const
inline

Definition at line 347 of file qwidgetlinecontrol_p.h.

◆ cursorForward()

void QWidgetLineControl::cursorForward ( bool mark,
int steps )
inline

Definition at line 170 of file qwidgetlinecontrol_p.h.

References Qt::VisualMoveStyle.

Referenced by processKeyEvent().

+ Here is the caller graph for this function:

◆ cursorMoveStyle()

Qt::CursorMoveStyle QWidgetLineControl::cursorMoveStyle ( ) const
inline

Definition at line 166 of file qwidgetlinecontrol_p.h.

Referenced by processKeyEvent().

+ Here is the caller graph for this function:

◆ cursorPosition()

int QWidgetLineControl::cursorPosition ( ) const
inline

Definition at line 279 of file qwidgetlinecontrol_p.h.

Referenced by QLineEditPrivate::selectionChanged().

+ Here is the caller graph for this function:

◆ cursorPositionChanged

void QWidgetLineControl::cursorPositionChanged ( int ,
int  )
signal

Referenced by QLineEditPrivate::init(), and processInputMethodEvent().

+ Here is the caller graph for this function:

◆ cursorRect()

QRect QWidgetLineControl::cursorRect ( ) const

Returns the bounds of the current cursor, as defined as a between characters cursor.

Definition at line 394 of file qwidgetlinecontrol.cpp.

References rectForPos().

Referenced by anchorRect(), QLineEditPrivate::cursorRect(), timerEvent(), and updateCursorBlinking().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cursorToX() [1/2]

qreal QWidgetLineControl::cursorToX ( ) const
inline

Definition at line 197 of file qwidgetlinecontrol_p.h.

References cursor.

◆ cursorToX() [2/2]

qreal QWidgetLineControl::cursorToX ( int cursor) const
inline

Definition at line 196 of file qwidgetlinecontrol_p.h.

References cursor.

◆ cursorWidth()

int QWidgetLineControl::cursorWidth ( ) const
inline

Definition at line 163 of file qwidgetlinecontrol_p.h.

◆ cursorWordBackward()

void QWidgetLineControl::cursorWordBackward ( bool mark)
inline

Definition at line 186 of file qwidgetlinecontrol_p.h.

References QTextLayout::SkipWords.

Referenced by processKeyEvent().

+ Here is the caller graph for this function:

◆ cursorWordForward()

void QWidgetLineControl::cursorWordForward ( bool mark)
inline

Definition at line 185 of file qwidgetlinecontrol_p.h.

References QTextLayout::SkipWords.

Referenced by processKeyEvent().

+ Here is the caller graph for this function:

◆ del()

void QWidgetLineControl::del ( )

Handles the behavior for the delete key or function. Removes the current selection if there is a selection, otherwise removes the character after the cursor position.

See also
del()

Definition at line 207 of file qwidgetlinecontrol.cpp.

References hasSelectedText(), QTextLayout::nextCursorPosition(), and textLayout().

Referenced by processKeyEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deselect()

void QWidgetLineControl::deselect ( )
inline

Definition at line 233 of file qwidgetlinecontrol_p.h.

Referenced by QLineEditPrivate::handleWindowActivate().

+ Here is the caller graph for this function:

◆ displayText()

QString QWidgetLineControl::displayText ( ) const
inline

Definition at line 224 of file qwidgetlinecontrol_p.h.

◆ displayTextChanged

void QWidgetLineControl::displayTextChanged ( const QString & )
signal

Referenced by QLineEditPrivate::init().

+ Here is the caller graph for this function:

◆ draw()

void QWidgetLineControl::draw ( QPainter * painter,
const QPoint & offset,
const QRect & clip,
int flags = DrawAll )

Draws the display text for the line control using the given painter, clip, and offset. Which aspects of the display text are drawn is specified by the given flags.

If the flags contain DrawSelections, then the selection or input mask backgrounds and foregrounds will be applied before drawing the text.

If the flags contain DrawCursor a cursor of the current cursorWidth() will be drawn after drawing the text.

The display text will only be drawn if the flags contain DrawText

Definition at line 605 of file qwidgetlinecontrol.cpp.

References QPalette::brush(), cursor(), QTextLayout::draw(), QTextLayout::drawCursor(), DrawCursor, DrawSelections, DrawText, QPalette::Highlight, QPalette::HighlightedText, o, painter, QPalette::Text, textLayout(), and QPalette::Window.

+ Here is the call graph for this function:

◆ echoMode()

uint QWidgetLineControl::echoMode ( ) const
inline

Definition at line 242 of file qwidgetlinecontrol_p.h.

Referenced by processInputMethodEvent(), and processKeyEvent().

+ Here is the caller graph for this function:

◆ editingFinished

void QWidgetLineControl::editingFinished ( )
signal

Referenced by QLineEditPrivate::init(), and processKeyEvent().

+ Here is the caller graph for this function:

◆ end() [1/2]

int QWidgetLineControl::end ( ) const
inline

Definition at line 153 of file qwidgetlinecontrol_p.h.

References QString::size().

Referenced by processKeyEvent(), and selectWordAtPos().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end() [2/2]

void QWidgetLineControl::end ( bool mark)
inline

Definition at line 189 of file qwidgetlinecontrol_p.h.

References QString::size().

+ Here is the call graph for this function:

◆ fixup()

bool QWidgetLineControl::fixup ( )

Fixes the current text so that it is valid given any set validators.

Returns true if the text was changed. Otherwise returns false.

Definition at line 418 of file qwidgetlinecontrol.cpp.

References QValidator::Acceptable, QValidator::fixup(), and QValidator::validate().

Referenced by processKeyEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasAcceptableInput()

bool QWidgetLineControl::hasAcceptableInput ( ) const
inline

Definition at line 282 of file qwidgetlinecontrol_p.h.

References hasAcceptableInput().

Referenced by hasAcceptableInput(), and processKeyEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasSelectedText()

bool QWidgetLineControl::hasSelectedText ( ) const
inline

Definition at line 119 of file qwidgetlinecontrol_p.h.

References QString::isEmpty().

Referenced by anchorRect(), backspace(), del(), QLineEditPrivate::handleWindowActivate(), paste(), processKeyEvent(), and QLineEditPrivate::selectionChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ height()

int QWidgetLineControl::height ( ) const
inline

Definition at line 122 of file qwidgetlinecontrol_p.h.

References qRound().

+ Here is the call graph for this function:

◆ home()

void QWidgetLineControl::home ( bool mark)
inline

Definition at line 188 of file qwidgetlinecontrol_p.h.

Referenced by processKeyEvent().

+ Here is the caller graph for this function:

◆ inputMask()

QString QWidgetLineControl::inputMask ( ) const
inline

Definition at line 285 of file qwidgetlinecontrol_p.h.

Referenced by QLineEditPrivate::setCursorVisible(), timerEvent(), and updateCursorBlinking().

+ Here is the caller graph for this function:

◆ inputRejected

void QWidgetLineControl::inputRejected ( )
signal

Referenced by QLineEditPrivate::init().

+ Here is the caller graph for this function:

◆ inSelection()

bool QWidgetLineControl::inSelection ( int x) const
inline

Definition at line 137 of file qwidgetlinecontrol_p.h.

References QTextLine::CursorOnCharacter, and pos.

Referenced by QLineEditPrivate::inSelection().

+ Here is the caller graph for this function:

◆ insert()

void QWidgetLineControl::insert ( const QString & newText)

Inserts the given newText at the current cursor position. If there is any selected text it is removed prior to insertion of the new text.

Definition at line 227 of file qwidgetlinecontrol.cpp.

Referenced by paste(), and processKeyEvent().

+ Here is the caller graph for this function:

◆ isModified()

bool QWidgetLineControl::isModified ( ) const
inline

Definition at line 115 of file qwidgetlinecontrol_p.h.

◆ isReadOnly()

bool QWidgetLineControl::isReadOnly ( ) const
inline

Definition at line 205 of file qwidgetlinecontrol_p.h.

Referenced by processKeyEvent(), processShortcutOverrideEvent(), and QLineEditPrivate::shouldEnableInputMethod().

+ Here is the caller graph for this function:

◆ isRedoAvailable()

bool QWidgetLineControl::isRedoAvailable ( ) const

Definition at line 1948 of file qwidgetlinecontrol.cpp.

References QLineEdit::Normal.

◆ isUndoAvailable()

bool QWidgetLineControl::isUndoAvailable ( ) const

Definition at line 1940 of file qwidgetlinecontrol.cpp.

References QLineEdit::Normal.

◆ layoutDirection()

Qt::LayoutDirection QWidgetLineControl::layoutDirection ( ) const
inline

Definition at line 325 of file qwidgetlinecontrol_p.h.

References QString::isEmpty(), QString::isRightToLeft(), Qt::LayoutDirectionAuto, Qt::LeftToRight, and Qt::RightToLeft.

Referenced by processKeyEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maxLength()

int QWidgetLineControl::maxLength ( ) const
inline

Definition at line 258 of file qwidgetlinecontrol_p.h.

◆ moveCursor()

void QWidgetLineControl::moveCursor ( int pos,
bool mark = false )

Moves the cursor to the given position pos. If mark is true will adjust the currently selected text.

Definition at line 441 of file qwidgetlinecontrol.cpp.

References commitPreedit(), emit, nextMaskBlank(), pos, prevMaskBlank(), qMax(), qMin(), and selectionChanged().

Referenced by processKeyEvent(), and selectWordAtPos().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ naturalTextWidth()

qreal QWidgetLineControl::naturalTextWidth ( ) const
inline

Definition at line 124 of file qwidgetlinecontrol_p.h.

◆ nextMaskBlank()

int QWidgetLineControl::nextMaskBlank ( int pos)
inline

Definition at line 97 of file qwidgetlinecontrol_p.h.

References pos.

Referenced by moveCursor().

+ Here is the caller graph for this function:

◆ palette()

const QPalette & QWidgetLineControl::palette ( ) const
inline

Definition at line 352 of file qwidgetlinecontrol_p.h.

◆ passwordCharacter()

QChar QWidgetLineControl::passwordCharacter ( ) const
inline

Definition at line 319 of file qwidgetlinecontrol_p.h.

◆ passwordEchoEditing()

bool QWidgetLineControl::passwordEchoEditing ( ) const
inline

Definition at line 313 of file qwidgetlinecontrol_p.h.

Referenced by processInputMethodEvent(), and processKeyEvent().

+ Here is the caller graph for this function:

◆ passwordMaskDelay()

int QWidgetLineControl::passwordMaskDelay ( ) const
inline

Definition at line 322 of file qwidgetlinecontrol_p.h.

◆ paste()

void QWidgetLineControl::paste ( QClipboard::Mode clipboardMode = QClipboard::Clipboard)

Inserts the text stored in the application clipboard into the line control.

See also
insert()

Definition at line 132 of file qwidgetlinecontrol.cpp.

References QGuiApplication::clipboard(), hasSelectedText(), insert(), and QString::isEmpty().

Referenced by processKeyEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ preeditAreaText()

QString QWidgetLineControl::preeditAreaText ( ) const
inline

Definition at line 310 of file qwidgetlinecontrol_p.h.

Referenced by processInputMethodEvent(), QLineEditPrivate::selectionChanged(), QLineEditPrivate::sendMouseEventToInputContext(), and QLineEditPrivate::shouldShowPlaceholderText().

+ Here is the caller graph for this function:

◆ preeditCursor()

int QWidgetLineControl::preeditCursor ( ) const
inline

Definition at line 161 of file qwidgetlinecontrol_p.h.

◆ prevMaskBlank()

int QWidgetLineControl::prevMaskBlank ( int pos)
inline

Definition at line 104 of file qwidgetlinecontrol_p.h.

References pos.

Referenced by backspace(), and moveCursor().

+ Here is the caller graph for this function:

◆ processInputMethodEvent()

void QWidgetLineControl::processInputMethodEvent ( QInputMethodEvent * event)

Applies the given input method event event to the text of the line control

Definition at line 478 of file qwidgetlinecontrol.cpp.

References QInputMethodEvent::Cursor, cursorPositionChanged(), echoMode(), emit, QString::fill(), i, QLineEdit::NoEcho, o, QLineEdit::Password, passwordEchoEditing(), QLineEdit::PasswordEchoOnEdit, preeditAreaText(), qBound(), qMax(), qMin(), qSwap(), QInputMethodEvent::Selection, selectionChanged(), QTextLayout::setFormats(), setPreeditArea(), QString::size(), QInputMethodEvent::TextFormat, QTextFormat::toCharFormat(), updateMicroFocus(), and updatePasswordEchoEditing().

+ Here is the call graph for this function:

◆ processKeyEvent()

void QWidgetLineControl::processKeyEvent ( QKeyEvent * ev)

Definition at line 1605 of file qwidgetlinecontrol.cpp.

References accepted(), Qt::AltModifier, backspace(), clear(), QClipboard::Clipboard, QGuiApplication::clipboard(), QInputMethod::commit(), QCompleter::completionMode, QCompleter::completionPrefix, Qt::ControlModifier, QKeySequence::Copy, copy(), Qt::CTRL, QCompleter::currentCompletion(), cursor(), cursorForward(), cursorMoveStyle(), cursorWordBackward(), cursorWordForward(), QKeySequence::Cut, del(), QKeySequence::Delete, QKeySequence::DeleteCompleteLine, QKeySequence::DeleteEndOfLine, QKeySequence::DeleteEndOfWord, QKeySequence::DeleteStartOfWord, echoMode(), editingFinished(), emit, end(), fixup(), QCompleterPrivate::get(), hasAcceptableInput(), hasSelectedText(), QInputMethod::hide(), home(), Qt::ImhMultiLine, QCompleter::InlineCompletion, QGuiApplication::inputMethod(), QWidget::inputMethodHints, insert(), QInputControl::isAcceptableInput(), QString::isEmpty(), isReadOnly(), Qt::Key_Back, Qt::Key_Backspace, Qt::Key_Direction_L, Qt::Key_Direction_R, Qt::Key_Down, Qt::Key_Enter, Qt::Key_Escape, Qt::Key_F4, Qt::Key_Insert, Qt::Key_Return, Qt::Key_Select, Qt::Key_Up, layoutDirection(), Qt::LeftToRight, lineEdit, QPlatformTheme::MacKeyboardScheme, moveCursor(), QKeySequence::MoveToEndOfBlock, QKeySequence::MoveToEndOfLine, QKeySequence::MoveToNextChar, QKeySequence::MoveToNextWord, QKeySequence::MoveToPreviousChar, QKeySequence::MoveToPreviousWord, QKeySequence::MoveToStartOfBlock, QKeySequence::MoveToStartOfLine, Qt::NoModifier, QLineEdit::Normal, QObject::parent(), passwordEchoEditing(), QLineEdit::PasswordEchoOnEdit, QKeySequence::Paste, paste(), QCompleter::PopupCompletion, qobject_cast< QWidget * >(), QKeySequence::Redo, redo(), Qt::RightToLeft, QKeySequence::SelectAll, selectAll(), QKeySequence::SelectEndOfBlock, QKeySequence::SelectEndOfLine, QClipboard::Selection, selectionEnd(), selectionStart(), QKeySequence::SelectNextChar, QKeySequence::SelectNextWord, QKeySequence::SelectPreviousChar, QKeySequence::SelectPreviousWord, QKeySequence::SelectStartOfBlock, QKeySequence::SelectStartOfLine, setLayoutDirection(), setSelection(), setText(), Qt::SHIFT, Qt::ShiftModifier, QObject::startTimer(), text(), textAfterSelection(), QKeySequence::Undo, undo(), QCompleter::UnfilteredPopupCompletion, unknown, updatePasswordEchoEditing(), Qt::VisualMoveStyle, QPlatformTheme::WindowsKeyboardScheme, and QPlatformTheme::X11KeyboardScheme.

+ Here is the call graph for this function:

◆ processShortcutOverrideEvent()

◆ rectForPos()

QRect QWidgetLineControl::rectForPos ( int pos) const

Returns the bounds of the given text position.

Definition at line 376 of file qwidgetlinecontrol.cpp.

References ch, QTextLine::cursorToX(), QTextLine::height(), QTextLayout::lineAt(), pos, qRound(), and textLayout().

Referenced by anchorRect(), and cursorRect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redo()

void QWidgetLineControl::redo ( )
inline

Definition at line 239 of file qwidgetlinecontrol_p.h.

Referenced by processKeyEvent().

+ Here is the caller graph for this function:

◆ removeSelection()

void QWidgetLineControl::removeSelection ( )
inline

Definition at line 145 of file qwidgetlinecontrol_p.h.

◆ resetCursorBlinkTimer()

void QWidgetLineControl::resetCursorBlinkTimer ( )

Definition at line 1519 of file qwidgetlinecontrol.cpp.

References QObject::killTimer(), QObject::startTimer(), and QGuiApplication::styleHints().

+ Here is the call graph for this function:

◆ resetInputContext

void QWidgetLineControl::resetInputContext ( )
signal

◆ selectAll()

void QWidgetLineControl::selectAll ( )
inline

Definition at line 234 of file qwidgetlinecontrol_p.h.

References QString::size().

Referenced by processKeyEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selectedText()

QString QWidgetLineControl::selectedText ( ) const
inline

Definition at line 128 of file qwidgetlinecontrol_p.h.

References QString::mid().

Referenced by copy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selectionChanged

void QWidgetLineControl::selectionChanged ( )
signal

Referenced by QLineEditPrivate::init(), moveCursor(), processInputMethodEvent(), and setSelection().

+ Here is the caller graph for this function:

◆ selectionEnd()

int QWidgetLineControl::selectionEnd ( ) const
inline

Definition at line 133 of file qwidgetlinecontrol_p.h.

Referenced by processKeyEvent(), and QLineEditPrivate::selectionChanged().

+ Here is the caller graph for this function:

◆ selectionStart()

int QWidgetLineControl::selectionStart ( ) const
inline

Definition at line 132 of file qwidgetlinecontrol_p.h.

Referenced by processKeyEvent(), and QLineEditPrivate::selectionChanged().

+ Here is the caller graph for this function:

◆ selectWordAtPos()

void QWidgetLineControl::selectWordAtPos ( int cursor)

Sets the selection to cover the word at the given cursor position. The word boundaries are defined by the behavior of QTextLayout::SkipWords cursor mode.

Definition at line 646 of file qwidgetlinecontrol.cpp.

References cursor(), end(), moveCursor(), next, QTextLayout::nextCursorPosition(), QTextLayout::previousCursorPosition(), QTextLayout::SkipWords, and textLayout().

+ Here is the call graph for this function:

◆ setAccessibleObject()

void QWidgetLineControl::setAccessibleObject ( QObject * object)
inline

Definition at line 84 of file qwidgetlinecontrol_p.h.

References Q_ASSERT.

◆ setBlinkingCursorEnabled()

void QWidgetLineControl::setBlinkingCursorEnabled ( bool enable)

Definition at line 1486 of file qwidgetlinecontrol.cpp.

References QObject::connect(), QStyleHints::cursorFlashTimeChanged(), disconnect(), QGuiApplication::styleHints(), and updateCursorBlinking().

+ Here is the call graph for this function:

◆ setCancelText()

void QWidgetLineControl::setCancelText ( const QString & text)
inline

Definition at line 350 of file qwidgetlinecontrol_p.h.

References text.

◆ setCursorMoveStyle()

void QWidgetLineControl::setCursorMoveStyle ( Qt::CursorMoveStyle style)
inline

Definition at line 167 of file qwidgetlinecontrol_p.h.

◆ setCursorPosition()

void QWidgetLineControl::setCursorPosition ( int pos)
inline

Definition at line 280 of file qwidgetlinecontrol_p.h.

References pos, qMax(), and QString::size().

+ Here is the call graph for this function:

◆ setCursorWidth()

void QWidgetLineControl::setCursorWidth ( int value)
inline

Definition at line 164 of file qwidgetlinecontrol_p.h.

◆ setEchoMode()

void QWidgetLineControl::setEchoMode ( uint mode)
inline

Definition at line 243 of file qwidgetlinecontrol_p.h.

References QLineEdit::Normal, and QString::reserve().

+ Here is the call graph for this function:

◆ setFont()

void QWidgetLineControl::setFont ( const QFont & font)
inline

Definition at line 338 of file qwidgetlinecontrol_p.h.

References font.

Referenced by QLineEditPrivate::init().

+ Here is the caller graph for this function:

◆ setInputMask()

void QWidgetLineControl::setInputMask ( const QString & mask)
inline

Definition at line 297 of file qwidgetlinecontrol_p.h.

◆ setLayoutDirection()

void QWidgetLineControl::setLayoutDirection ( Qt::LayoutDirection direction)
inline

Definition at line 330 of file qwidgetlinecontrol_p.h.

References direction.

Referenced by processKeyEvent().

+ Here is the caller graph for this function:

◆ setMaxLength()

void QWidgetLineControl::setMaxLength ( int maxLength)
inline

Definition at line 259 of file qwidgetlinecontrol_p.h.

References setText().

+ Here is the call graph for this function:

◆ setModified()

void QWidgetLineControl::setModified ( bool modified)
inline

Definition at line 116 of file qwidgetlinecontrol_p.h.

◆ setPalette()

void QWidgetLineControl::setPalette ( const QPalette & p)
inline

Definition at line 353 of file qwidgetlinecontrol_p.h.

◆ setPasswordCharacter()

void QWidgetLineControl::setPasswordCharacter ( QChar character)
inline

Definition at line 320 of file qwidgetlinecontrol_p.h.

Referenced by QLineEditPrivate::init().

+ Here is the caller graph for this function:

◆ setPasswordMaskDelay()

void QWidgetLineControl::setPasswordMaskDelay ( int delay)
inline

Definition at line 323 of file qwidgetlinecontrol_p.h.

Referenced by QLineEditPrivate::init().

+ Here is the caller graph for this function:

◆ setPreeditArea()

void QWidgetLineControl::setPreeditArea ( int cursor,
const QString & text )
inline

Definition at line 307 of file qwidgetlinecontrol_p.h.

References cursor, and text.

Referenced by commitPreedit(), and processInputMethodEvent().

+ Here is the caller graph for this function:

◆ setReadOnly()

void QWidgetLineControl::setReadOnly ( bool enable)

Definition at line 1477 of file qwidgetlinecontrol.cpp.

References updateCursorBlinking().

+ Here is the call graph for this function:

◆ setSelection()

void QWidgetLineControl::setSelection ( int start,
int length )

Sets length characters from the given start position as selected. The given start position must be within the current text for the line control. If length characters cannot be selected, then the selection will extend to the end of the current text.

Definition at line 275 of file qwidgetlinecontrol.cpp.

References commitPreedit(), emit, Q_UNLIKELY, qMax(), qMin(), qWarning, selectionChanged(), QString::size(), and start().

Referenced by processKeyEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setText()

void QWidgetLineControl::setText ( const QString & txt)
inline

Definition at line 214 of file qwidgetlinecontrol_p.h.

References QGuiApplication::inputMethod(), and txt.

Referenced by processKeyEvent(), and QLineEditPrivate::setText().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValidator()

void QWidgetLineControl::setValidator ( const QValidator * v)
inline

Definition at line 269 of file qwidgetlinecontrol_p.h.

◆ start()

int QWidgetLineControl::start ( ) const
inline

Definition at line 152 of file qwidgetlinecontrol_p.h.

Referenced by setSelection().

+ Here is the caller graph for this function:

◆ surroundingText()

QString QWidgetLineControl::surroundingText ( ) const
inline

Definition at line 226 of file qwidgetlinecontrol_p.h.

References QString::fromLatin1(), and QString::isNull().

+ Here is the call graph for this function:

◆ text()

QString QWidgetLineControl::text ( ) const
inline

Definition at line 208 of file qwidgetlinecontrol_p.h.

References QString::fromLatin1().

Referenced by processKeyEvent(), QLineEditPrivate::shouldShowPlaceholderText(), QLineEditPrivate::textAfterCursor(), and QLineEditPrivate::textBeforeCursor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ textAfterSelection()

QString QWidgetLineControl::textAfterSelection ( ) const
inline

Definition at line 130 of file qwidgetlinecontrol_p.h.

References QString::mid().

Referenced by processKeyEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ textBeforeSelection()

QString QWidgetLineControl::textBeforeSelection ( ) const
inline

Definition at line 129 of file qwidgetlinecontrol_p.h.

References QString::left().

+ Here is the call graph for this function:

◆ textChanged

void QWidgetLineControl::textChanged ( const QString & )
signal

Referenced by QLineEditPrivate::init().

+ Here is the caller graph for this function:

◆ textEdited

void QWidgetLineControl::textEdited ( const QString & )
signal

Referenced by QLineEditPrivate::init().

+ Here is the caller graph for this function:

◆ textLayout()

QTextLayout * QWidgetLineControl::textLayout ( ) const
inline

Definition at line 367 of file qwidgetlinecontrol_p.h.

Referenced by del(), draw(), rectForPos(), selectWordAtPos(), and xToPos().

+ Here is the caller graph for this function:

◆ timerEvent()

void QWidgetLineControl::timerEvent ( QTimerEvent * event)
overrideprotectedvirtual

This event handler can be reimplemented in a subclass to receive timer events for the object.

QChronoTimer provides higher-level interfaces to the timer functionality, and also more general information about timers. The timer event is passed in the event parameter.

See also
startTimer(), killTimer(), event()

Reimplemented from QObject.

Definition at line 1531 of file qwidgetlinecontrol.cpp.

References clear(), cursorRect(), emit, inputMask(), QObject::killTimer(), and updateNeeded().

+ Here is the call graph for this function:

◆ undo()

void QWidgetLineControl::undo ( )

Undoes the previous operation.

Definition at line 255 of file qwidgetlinecontrol.cpp.

References clear(), and QLineEdit::Normal.

Referenced by processKeyEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateCursorBlinking()

void QWidgetLineControl::updateCursorBlinking ( )

Definition at line 1501 of file qwidgetlinecontrol.cpp.

References cursorRect(), emit, inputMask(), QObject::killTimer(), QObject::startTimer(), QGuiApplication::styleHints(), and updateNeeded().

Referenced by setBlinkingCursorEnabled(), and setReadOnly().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateMicroFocus

void QWidgetLineControl::updateMicroFocus ( )
signal

Referenced by QLineEditPrivate::init(), processInputMethodEvent(), QAbstractSpinBox::setLineEdit(), and QComboBox::setLineEdit().

+ Here is the caller graph for this function:

◆ updateNeeded

void QWidgetLineControl::updateNeeded ( const QRect & )
signal

Referenced by QLineEditPrivate::init(), timerEvent(), and updateCursorBlinking().

+ Here is the caller graph for this function:

◆ updatePasswordEchoEditing()

void QWidgetLineControl::updatePasswordEchoEditing ( bool editing)

Sets the password echo editing to editing. If password echo editing is true, then the text of the password is displayed even if the echo mode is set to QLineEdit::PasswordEchoOnEdit. Password echoing editing does not affect other echo modes.

Definition at line 352 of file qwidgetlinecontrol.cpp.

Referenced by processInputMethodEvent(), processKeyEvent(), and QLineEditPrivate::updatePasswordEchoEditing().

+ Here is the caller graph for this function:

◆ validator()

const QValidator * QWidgetLineControl::validator ( ) const
inline

Definition at line 268 of file qwidgetlinecontrol_p.h.

◆ width()

int QWidgetLineControl::width ( ) const
inline

Definition at line 121 of file qwidgetlinecontrol_p.h.

References qRound().

+ Here is the call graph for this function:

◆ xToPos()

int QWidgetLineControl::xToPos ( int x,
QTextLine::CursorPosition betweenOrOn = QTextLine::CursorBetweenCharacters ) const

Returns the cursor position of the given x pixel value in relation to the displayed text. The given betweenOrOn specified what kind of cursor position is requested.

Definition at line 366 of file qwidgetlinecontrol.cpp.

References QTextLayout::lineAt(), textLayout(), and QTextLine::xToCursor().

Referenced by QLineEditPrivate::xToPos().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ QLineEdit

friend class QLineEdit
friend

Definition at line 520 of file qwidgetlinecontrol_p.h.


The documentation for this class was generated from the following files: