44 #ifndef QT_NO_LINEEDIT 48 #ifndef QT_NO_ACCESSIBILITY 56 #ifndef QT_NO_GRAPHICSVIEW 62 #ifdef QT_GUI_PASSWORD_ECHO_DELAY 63 static const int qt_passwordEchoDelay = QT_GUI_PASSWORD_ECHO_DELAY;
98 #ifdef QT_GUI_PASSWORD_ECHO_DELAY 103 if (cursor > 0 && uc.
unicode() >= 0xdc00 && uc.
unicode() < 0xe000) {
108 str[cursor - 1] = uc;
120 for (
int i = 0; i < (int)str.
length(); ++i) {
121 if ((uc[i] < 0x20 && uc[i] != 0x09)
125 uc[i] =
QChar(0x0020);
140 if (str != orig || forceUpdate)
144 #ifndef QT_NO_CLIPBOARD 190 #endif // !QT_NO_CLIPBOARD 301 qWarning(
"QLineControl::setSelection: Invalid start position");
311 }
else if (length < 0){
413 return QRect(cix-5, 0, w+9, ch);
428 #ifndef QT_NO_VALIDATOR 491 int originalSelectionEnd =
m_selend;
492 bool isGettingInput = !
event->commitString().isEmpty()
494 ||
event->replacementLength() > 0;
496 bool selectionChange =
false;
498 if (isGettingInput) {
513 m_cursor +=
event->replacementStart();
525 cursorPositionChanged =
true;
530 for (
int i = 0; i <
event->attributes().size(); ++i) {
540 selectionChange =
true;
544 cursorPositionChanged =
true;
554 for (
int i = 0; i <
event->attributes().size(); ++i) {
580 if (cursorPositionChanged)
654 int next = cursor + 1;
661 while (end > cursor &&
m_text[end-1].isSpace())
689 #ifndef QT_NO_VALIDATOR 704 if (validateFromState >= 0 && wasValidInput && !
m_validInput) {
760 #ifndef QT_NO_ACCESSIBILITY 805 #ifdef QT_GUI_PASSWORD_ECHO_DELAY 807 if (m_passwordEchoTimer != 0)
809 m_passwordEchoTimer =
startTimer(qt_passwordEchoDelay);
816 for (
int i = 0; i < (int) ms.
length(); ++i) {
826 if (remaining != 0) {
828 for (
int i = 0; i < (int) s.
left(remaining).
length(); ++i)
923 if (maskFields.
isEmpty() || delimiter == 0) {
933 if (delimiter == -1) {
1105 #ifndef QT_NO_VALIDATOR 1153 while (i < m_maxLength) {
1154 if (strIndex < str.
length()) {
1164 s += str[(int)strIndex].toUpper();
1167 s += str[(int)strIndex].toLower();
1170 s += str[(int)strIndex];
1175 int n =
findInMask(i,
true,
true, str[(
int)strIndex]);
1178 s += fill.
mid(i, n-i+1);
1183 n =
findInMask(i,
true,
false, str[(
int)strIndex]);
1185 s += fill.
mid(i, n-i);
1188 s += str[(int)strIndex].toUpper();
1191 s += str[(int)strIndex].toLower();
1194 s += str[(int)strIndex];
1227 for (
int i = pos; i <
end; ++i)
1252 for (
int i = 0; i <
end; ++i)
1272 int step = forward ? 1 : -1;
1276 if (findSeparator) {
1399 #ifndef QT_NO_ACCESSIBILITY 1405 #ifndef QT_NO_COMPLETER 1413 int i = start + dir;
1414 if (dir == 0) dir = 1;
1426 }
while (i != start);
1459 #ifndef QT_KEYPAD_NAVIGATION 1511 #ifdef QT_GUI_PASSWORD_ECHO_DELAY 1512 }
else if (event->
timerId() == m_passwordEchoTimer) {
1514 m_passwordEchoTimer = 0;
1522 #ifdef QT_KEYPAD_NAVIGATION 1523 if (QApplication::keypadNavigationEnabled()) {
1546 #ifndef QT_NO_GRAPHICSVIEW 1567 #ifndef QT_NO_SHORTCUT 1596 switch (ke->
key()) {
1620 switch (ev->
type()) {
1649 #ifndef QT_NO_CLIPBOARD 1673 bool inlineCompletionAccepted =
false;
1675 #ifndef QT_NO_COMPLETER 1684 switch (event->
key()) {
1691 #ifdef QT_KEYPAD_NAVIGATION 1693 if (!QApplication::keypadNavigationEnabled())
1701 switch (event->
key()) {
1705 #ifdef QT_KEYPAD_NAVIGATION 1707 if (!QApplication::keypadNavigationEnabled())
1713 inlineCompletionAccepted =
true;
1720 #endif // QT_NO_COMPLETER 1727 if (inlineCompletionAccepted)
1738 #ifdef QT_KEYPAD_NAVIGATION 1754 bool unknown =
false;
1759 #ifndef QT_NO_SHORTCUT 1771 #ifndef QT_NO_CLIPBOARD 1798 #endif //QT_NO_CLIPBOARD 1812 #if !defined(Q_WS_WIN) || defined(QT_NO_COMPLETER) 1827 #if !defined(Q_WS_WIN) || defined(QT_NO_COMPLETER) 1882 #endif // QT_NO_SHORTCUT 1884 bool handled =
false;
1891 || myModifiers == Qt::ShiftModifier) {
1906 switch (event->
key()) {
1913 #ifndef QT_NO_COMPLETER 1919 #if defined(Q_WS_X11) 1927 #ifndef QT_NO_CLIPBOARD 1939 switch (event->
key()) {
1943 #ifndef QT_NO_COMPLETER 1948 #ifdef QT_KEYPAD_NAVIGATION 1950 if (QApplication::keypadNavigationEnabled() && !event->
isAutoRepeat()
1958 emit editFocusChange(
false);
1983 #ifndef QT_NO_COMPLETER
Mode
This enum type is used to control which part of the system clipboard is used by QClipboard::mimeData(...
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
The QPainter class performs low-level painting on widgets and other paint devices.
void setAdditionalFormats(const QList< FormatRange > &overrides)
Sets the additional formats supported by the text layout to formatList.
CompletionMode
This enum specifies how completions are provided to the user.
void setText(const QString &string)
Sets the layout's text to the given string.
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object's accessibility information.
virtual void timerEvent(QTimerEvent *event)
This event handler can be reimplemented in a subclass to receive timer events for the object...
The QTextLayout::FormatRange structure is used to apply extra formatting information for a specified ...
qreal alphaF() const
Returns the alpha color component of this color.
QChar m_passwordCharacter
The QKeyEvent class describes a key event.
bool isLetter() const
Returns true if the character is a letter (Letter_* categories); otherwise returns false...
The QTextCharFormat class provides formatting information for characters in a QTextDocument.
Qt::CursorMoveStyle cursorMoveStyle() const
int selectionStart() const
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
QString textAfterSelection() const
int digitValue() const
Returns the numeric value of the digit, or -1 if the character is not a digit.
const QChar at(int i) const
Returns the character at the given index position in the string.
void cursorWordForward(bool mark)
void processMouseEvent(QMouseEvent *ev)
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QAbstractItemModel * completionModel() const
Returns the completion model.
bool isNull() const
Returns true if the character is the Unicode character 0x0000 ('\0'); otherwise returns false...
void cursorPositionChanged(int, int)
void cancelPasswordEchoTimer()
QString currentCompletion() const
Returns the current completion string.
Qt::LayoutDirection m_layoutDirection
void setText(const QString &txt)
QString & replace(int i, int len, QChar after)
void setCursorBlinkPeriod(int msec)
int length() const
Returns the number of characters in this string.
virtual void fixup(QString &) const
This function attempts to change input to be valid according to this validator's rules.
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
The QTextLine class represents a line of text inside a QTextLayout.
bool processEvent(QEvent *ev)
void addCommand(const Command &cmd)
Adds the given command to the undo history of the line control.
void drawCursor(QPainter *p, const QPointF &pos, int cursorPosition) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isLowSurrogate() const
Returns true if the QChar is the low part of a utf16 surrogate (ie.
Qt::MouseButton button() const
Returns the mouse button (if any) that caused the event.
QVector< Command > m_history
int nextCursorPosition(int oldPos, CursorMode mode=SkipCharacters) const
Returns the next valid cursor position after oldPos that respects the given cursor mode...
QString stripString(const QString &str) const
Strips blank parts of the input in a QLineControl when an inputMask is set, separators are still incl...
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
bool isValidInput(QChar key, QChar mask) const
void removeSelectedText()
Also adds the appropriate commands into the undo history.
void resetCursorBlinkTimer()
void setFlags(Flags flags)
Sets the flags associated with the option to the given flags.
void emitCursorPositionChanged()
If the current cursor position differs from the last emitted cursor position, emits cursorPositionCha...
int start
Specifies the beginning of the format range within the text layout's text.
void setBackground(const QBrush &brush)
Sets the brush use to paint the document's background to the brush specified.
The QString class provides a Unicode character string.
void setText(const QString &, Mode mode=Clipboard)
Copies text into the clipboard as plain text.
bool isValid() const
Returns true if this character format is valid; otherwise returns false.
void internalSetText(const QString &txt, int pos=-1, bool edited=true)
An internal function for setting the text of the line control.
bool isHighSurrogate() const
Returns true if the QChar is the high part of a utf16 surrogate (ie.
void init(const QString &txt)
Initializes the line control with a starting text value of txt.
The QVector class is a template class that provides a dynamic array.
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
bool isPrint() const
Returns true if the character is a printable character; otherwise returns false.
void internalUndo(int until=-1)
qreal ascent() const
Returns the line's ascent.
CompletionMode completionMode
how the completions are provided to the user
The QChar class provides a 16-bit Unicode character.
QChar * data()
Returns a pointer to the data stored in the QString.
void setPreeditArea(int cursor, const QString &text)
QString preeditAreaText() const
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
QString textBeforeSelection() const
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
int key() const
Returns the code of the key that was pressed or released.
void insert(const QString &)
Inserts the given newText at the current cursor position.
Qt::CaseSensitivity caseSensitivity
the case sensitivity of the matching
void append(const T &t)
Inserts value at the end of the list.
bool setCurrentRow(int row)
Sets the current row to the row specified.
qreal cursorToX(int *cursorPos, Edge edge=Leading) const
Converts the cursor position cursorPos to the corresponding x position inside the line...
QString text() const
Returns the layout's text.
bool hasAcceptableInput() const
#define QT_BEGIN_NAMESPACE
This macro expands to.
void processInputMethodEvent(QInputMethodEvent *event)
static bool isEmpty(const char *str)
bool passwordEchoEditing() const
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
static QClipboard * clipboard()
Returns a pointer to the application global clipboard.
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 rece...
The QTextFormat class provides formatting information for a QTextDocument.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void internalDelete(bool wasBackspace=false)
Also adds the appropriate commands into the undo history.
QList< int > m_transactions
void setSelection(int start, int length)
Sets length characters from the given start position as selected.
void append(const T &t)
Inserts value at the end of the vector.
virtual State validate(QString &, int &) const =0
This virtual function returns Invalid if input is invalid according to this validator's rules...
bool isRedoAvailable() const
Q_CORE_EXPORT void qWarning(const char *,...)
void setCompletionPrefix(const QString &prefix)
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
int currentRow() const
Returns the current row.
void setTextDirection(Qt::LayoutDirection aDirection)
Sets the direction of the text layout defined by the option to the given direction.
int xToPos(int x, QTextLine::CursorPosition=QTextLine::CursorBetweenCharacters) const
Returns the cursor position of the given x pixel value in relation to the displayed text...
QRect cursorRect() const
Returns the bounds of the current cursor, as defined as a between characters cursor.
static int startDragDistance()
void draw(QPainter *p, const QPointF &pos, const QVector< FormatRange > &selections=QVector< FormatRange >(), const QRectF &clip=QRectF()) const
Draws the whole layout on the painter p at the position specified by pos.
bool fixup()
Fixes the current text so that it is valid given any set validators.
QBrush background() const
Returns the brush used to paint the document's background.
Qt::BrushStyle style() const
Returns the brush style.
int nextMaskBlank(int pos)
QPointer< QCompleter > m_completer
Qt::MouseButton button() const
Returns the button that caused the event.
QTextLine lineAt(int i) const
Returns the {i}-th line of text in this text layout.
void qSwap(T &value1, T &value2)
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
Q_GUI_EXPORT QString escape(const QString &plain)
Converts the plain text string plain to a HTML string with HTML metacharacters <, >...
The QMouseEvent class contains parameters that describe a mouse event.
void backspace()
Handles the behavior for the backspace key or function.
QString inputMask() const
bool wrapAround
the completions wrap around when navigating through items
void textEdited(const QString &)
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.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
QPointer< QValidator > m_validator
QString completionPrefix
the completion prefix used to provide completions.
void cursorWordBackward(bool mark)
void moveCursor(int pos, bool mark=false)
Moves the cursor to the given position pos.
QString selectedText() const
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
int compare(const QString &s) const
void _q_clipboardChanged()
The QTimerEvent class contains parameters that describe a timer event.
QString clearString(uint pos, uint len) const
Returns a "cleared" string with only separators and blank chars.
QString text() const
Returns the Unicode text that this key generated.
void copy(QClipboard::Mode mode=QClipboard::Clipboard) const
Copies the currently selected text into the clipboard using the given mode.
bool finishChange(int validateFromState=-1, bool update=false, bool edited=true)
Completes a change to the line control text.
QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
void displayTextChanged(const QString &)
QTextLine createLine()
Returns a new text line to be laid out if there is text to be inserted into the layout; otherwise ret...
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
void setFontUnderline(bool underline)
If underline is true, sets the text format's font to be underlined; otherwise it is displayed non-und...
int prevMaskBlank(int pos)
void setTextOption(const QTextOption &option)
Sets the text option structure that controls the layout process to the given option.
void updateNeeded(const QRect &)
QObject * parent() const
Returns a pointer to the parent object.
MaskInputData * m_maskData
void selectWordAtPos(int)
Sets the selection to cover the word at the given cursor position.
Qt::LayoutDirection layoutDirection() const
The QPoint class defines a point in the plane using integer precision.
Q_DECL_CONSTEXPR const T & qBound(const T &min, const T &val, const T &max)
void complete(const QRect &rect=QRect())
For QCompleter::PopupCompletion and QCompletion::UnfilteredPopupCompletion modes, calling this functi...
The QModelIndex class is used to locate data in a data model.
QString & fill(QChar c, int size=-1)
Sets every character in the string to character ch.
void textChanged(const QString &)
The QRect class defines a rectangle in the plane using integer precision.
bool isAutoRepeat() const
Returns true if this event comes from an auto-repeating key; returns false if it comes from an initia...
QString maskString(uint pos, const QString &str, bool clear=false) const
Applies the inputMask on str starting from position pos in the mask.
The QTextOption class provides a description of general rich text properties.
int completionCount() const
Returns the number of completions for the current prefix.
T qvariant_cast(const QVariant &)
void draw(QPainter *, const QPoint &, const QRect &, int flags=DrawAll)
Draws the display text for the line control using the given painter, clip, and offset.
void updateDisplayText(bool forceUpdate=false)
bool advanceToEnabledItem(int dir)
bool isUndoAvailable() const
void cursorForward(bool mark, int steps)
void setLayoutDirection(Qt::LayoutDirection direction)
QPointF pos() const
Returns the mouse cursor position in item coordinates.
int length
Specifies the numer of characters the format range spans.
void updatePasswordEchoEditing(bool editing)
Sets the password echo editing to editing.
void parseInputMask(const QString &maskFields)
Parses the input mask specified by maskFields to generate the mask data used to handle input masks...
QTextCharFormat format
Specifies the format to apply.
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifiers in use at the time the event was sent.
void setForeground(const QBrush &brush)
Sets the foreground brush to the specified brush.
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
bool hasSelectedText() const
int x() const
Returns the x coordinate of this point.
void endLayout()
Ends the layout process.
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
void del()
Handles the behavior for the delete key or function.
void internalInsert(const QString &s)
Inserts the given string s into the line control.
int previousCursorPosition(int oldPos, CursorMode mode=SkipCharacters) const
Returns the first valid cursor position before oldPos that respects the given cursor mode...
int xToCursor(qreal x, CursorPosition=CursorBetweenCharacters) const
Converts the x-coordinate x, to the nearest matching cursor position, depending on the cursor positio...
The QEvent class is the base class of all event classes.
void setUnderlineStyle(UnderlineStyle style)
Sets the style of underlining the text to style.
Type type() const
Returns the event type.
static int doubleClickInterval()
QString & insert(int i, QChar c)
bool m_passwordEchoEditing
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
void paste(QClipboard::Mode mode=QClipboard::Clipboard)
Inserts the text stored in the application clipboard into the line control.
QString text(Mode mode=Clipboard) const
Returns the clipboard text as plain text, or an empty string if the clipboard does not contain any te...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
qreal height() const
Returns the line's height.
bool isNumber() const
Returns true if the character is a number (Number_* categories, not just 0-9); otherwise returns fals...
Q_DECL_CONSTEXPR int qRound(qreal d)
QAbstractItemView * popup() const
Returns the popup used to display completions.
void beginLayout()
Begins the layout process.
QModelIndex currentIndex() const
Returns the model index of the current completion in the completionModel().
Qt::MouseButtons buttons() const
Returns the combination of mouse buttons that were pressed at the time the event was sent...
bool isLetterOrNumber() const
Returns true if the character is a letter or number (Letter_* or Number_* categories); otherwise retu...
int findInMask(int pos, bool forward, bool findSeparator, QChar searchChar=QChar()) const
void killTimer(int id)
Kills the timer with timer identifier, id.
void processKeyEvent(QKeyEvent *ev)
void clear()
Clears the line control text.