6#if QT_CONFIG(itemviews)
10#include <private/qguiapplication_p.h>
11#if QT_CONFIG(completer)
12#include <private/qcompleter_p.h>
14#include <qpa/qplatformtheme.h>
16#if QT_CONFIG(accessibility)
21#include "private/qapplication_p.h"
22#if QT_CONFIG(graphicsview)
37int QWidgetLineControl::redoTextLayout()
const
54void QWidgetLineControl::updateDisplayText(
bool forceUpdate)
65 if (m_passwordEchoTimer != 0 && m_cursor > 0 && m_cursor <= m_text.
size()) {
86 if ((uc[
i].unicode() < 0x20 && uc[
i].unicode() != 0x09)
99 m_ascent = redoTextLayout();
105#ifndef QT_NO_CLIPBOARD
160 updateDisplayText(
true);
176 int priorState = m_undoState;
178 removeSelectedText();
179 }
else if (m_cursor) {
183 QChar uc = m_text.
at(m_cursor);
187 uc = m_text.
at(m_cursor - 1);
189 internalDelete(
true);
193 internalDelete(
true);
195 finishChange(priorState);
209 int priorState = m_undoState;
211 removeSelectedText();
217 finishChange(priorState);
229 int priorState = m_undoState;
230 removeSelectedText();
231 internalInsert(newText);
232 finishChange(priorState);
242 int priorState = m_undoState;
244 m_selend = m_text.
size();
245 removeSelectedText();
247 finishChange(priorState,
false,
false);
260 finishChange(-1,
true);
262 cancelPasswordEchoTimer();
280 qWarning(
"QWidgetLineControl::setSelection: Invalid start position");
285 if (
start == m_selstart &&
start +
length == m_selend && m_cursor == m_selend)
291 if (
start == m_selend &&
start +
length == m_selstart && m_cursor == m_selstart)
295 m_cursor = m_selstart;
296 }
else if (m_selstart != m_selend) {
302 emitCursorPositionChanged();
306 emitCursorPositionChanged();
309void QWidgetLineControl::_q_deleteSelected()
314 int priorState = m_undoState;
316 removeSelectedText();
318 finishChange(priorState);
326void QWidgetLineControl::init(
const QString &
txt)
331 m_cursor = m_text.
size();
354 cancelPasswordEchoTimer();
355 m_passwordEchoEditing = editing;
379 if (m_preeditCursor != -1)
380 pos += m_preeditCursor;
382 int w = m_cursorWidth;
385 return QRect(cix - 5, 0,
w + 9,
ch);
408 return rectForPos(m_cursor == m_selstart ? m_selend : m_selstart);
420#ifndef QT_NO_VALIDATOR
423 int cursorCopy = m_cursor;
424 m_validator->
fixup(textCopy);
426 if (textCopy != m_text || cursorCopy != m_cursor)
427 internalSetText(textCopy, cursorCopy,
false);
445 if (
pos != m_cursor) {
452 if (m_selend > m_selstart && m_cursor == m_selstart)
454 else if (m_selend > m_selstart && m_cursor == m_selend)
458 m_selstart =
qMin(anchor,
pos);
465 if (mark || m_selDirty) {
469 emitCursorPositionChanged();
481 bool isGettingInput = !
event->commitString().isEmpty()
483 ||
event->replacementLength() > 0;
485 bool selectionChange =
false;
487 if (isGettingInput) {
489 priorState = m_undoState;
493 m_selend = m_text.
size();
495 removeSelectedText();
499 if (
event->replacementStart() <= 0)
500 c +=
event->commitString().size() -
qMin(-
event->replacementStart(),
event->replacementLength());
502 m_cursor +=
event->replacementStart();
507 if (
event->replacementLength()) {
508 m_selstart = m_cursor;
509 m_selend = m_selstart +
event->replacementLength();
510 removeSelectedText();
512 if (!
event->commitString().isEmpty()) {
513 internalInsert(
event->commitString());
519 for (
int i = 0;
i <
event->attributes().
size(); ++
i) {
522 m_cursor =
qBound(0,
a.start +
a.length, m_text.
size());
526 if (m_selend < m_selstart) {
527 qSwap(m_selstart, m_selend);
529 selectionChange =
true;
531 if (m_selstart != m_selend)
532 selectionChange =
true;
533 m_selstart = m_selend = 0;
540 switch (m_echoMode) {
545 QString preeditString =
event->preeditString();
546 preeditString.
fill(m_passwordCharacter);
555 const int oldPreeditCursor = m_preeditCursor;
556 m_preeditCursor =
event->preeditString().size();
557 m_hideCursor =
false;
560 for (
int i = 0;
i <
event->attributes().
size(); ++
i) {
563 m_preeditCursor =
a.start;
564 m_hideCursor = !
a.length;
569 o.start =
a.start + m_cursor;
577 updateDisplayText(
true);
579 emitCursorPositionChanged();
580 else if (m_preeditCursor != oldPreeditCursor)
584 finishChange(priorState);
610 if (m_selstart < m_selend) {
611 o.start = m_selstart;
612 o.length = m_selend - m_selstart;
632 if (m_preeditCursor != -1)
633 cursor += m_preeditCursor;
634 if (!m_hideCursor && m_blinkStatus)
672bool QWidgetLineControl::finishChange(
int validateFromState,
bool update,
bool edited)
678 bool wasValidInput = m_validInput;
680#ifndef QT_NO_VALIDATOR
683 int cursorCopy = m_cursor;
686 if (m_text != textCopy) {
687 internalSetText(textCopy, cursorCopy, edited);
690 m_cursor = cursorCopy;
696 if (validateFromState >= 0 && wasValidInput && !m_validInput) {
697 if (m_transactions.
size())
699 internalUndo(validateFromState);
700 m_history.erase(m_history.begin() + m_undoState, m_history.end());
701 if (m_modifiedState > m_undoState)
702 m_modifiedState = -1;
720 if (m_cursor == m_lastCursorPos)
722 emitCursorPositionChanged();
731void QWidgetLineControl::internalSetText(
const QString &
txt,
int pos,
bool edited)
733 cancelPasswordEchoTimer();
738 m_text = maskString(0,
txt,
true);
739 m_text += clearString(m_text.
size(), m_maxLength - m_text.
size());
740 if (edited && oldText == m_text)
743 m_text =
txt.isEmpty() ?
txt :
txt.left(m_maxLength);
746 m_modifiedState = m_undoState = 0;
747 m_cursor = (pos < 0 || pos > m_text.
size()) ? m_text.
size() :
pos;
748 m_textDirty = (oldText != m_text);
749 const bool changed = finishChange(-1,
true, edited);
751#if QT_CONFIG(accessibility)
755 event.setCursorPosition(m_cursor);
756 QAccessible::updateAccessibility(&
event);
757 }
else if (
txt.isEmpty()) {
759 event.setCursorPosition(m_cursor);
760 QAccessible::updateAccessibility(&
event);
763 event.setCursorPosition(m_cursor);
764 QAccessible::updateAccessibility(&
event);
779void QWidgetLineControl::addCommand(
const Command &cmd)
781 m_history.erase(m_history.begin() + m_undoState, m_history.end());
783 if (m_separator && m_undoState && m_history[m_undoState - 1].
type != Separator)
784 m_history.push_back(Command(Separator, m_cursor, u
'\0', m_selstart, m_selend));
787 m_history.push_back(cmd);
788 m_undoState = int(m_history.size());
801void QWidgetLineControl::internalInsert(
const QString &
s)
804 if (m_passwordEchoTimer != 0)
806 int delay = m_passwordMaskDelay;
807#ifdef QT_BUILD_INTERNAL
808 if (m_passwordMaskDelayOverride >= 0)
809 delay = m_passwordMaskDelayOverride;
816 addCommand(Command(SetSelection, m_cursor, u
'\0', m_selstart, m_selend));
818 QString ms = maskString(m_cursor,
s);
821#if QT_CONFIG(accessibility)
823 QAccessible::updateAccessibility(&insertEvent);
825 for (
int i = 0;
i < (int) ms.
size(); ++
i) {
826 addCommand (Command(DeleteSelection, m_cursor +
i, m_text.
at(m_cursor +
i), -1, -1));
827 addCommand(Command(Insert, m_cursor +
i, ms.
at(
i), -1, -1));
830 m_cursor += ms.
size();
833#if QT_CONFIG(accessibility)
835 QAccessible::updateAccessibility(&
event);
838 int remaining = m_maxLength - m_text.
size();
839 if (remaining != 0) {
840#if QT_CONFIG(accessibility)
842 QAccessible::updateAccessibility(&insertEvent);
844 m_text.
insert(m_cursor,
s.left(remaining));
845 for (
int i = 0;
i < (int)
s.left(remaining).size(); ++
i)
846 addCommand(Command(Insert, m_cursor++,
s.at(
i), -1, -1));
849 if (
s.size() > remaining)
865void QWidgetLineControl::internalDelete(
bool wasBackspace)
867 if (m_cursor < (
int) m_text.
size()) {
868 cancelPasswordEchoTimer();
870 addCommand(Command(SetSelection, m_cursor, u
'\0', m_selstart, m_selend));
871 addCommand(Command((
CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)),
872 m_cursor, m_text.
at(m_cursor), -1, -1));
873#if QT_CONFIG(accessibility)
875 QAccessible::updateAccessibility(&
event);
878 m_text.
replace(m_cursor, 1, clearString(m_cursor, 1));
879 addCommand(Command(Insert, m_cursor, m_text.
at(m_cursor), -1, -1));
881 m_text.
remove(m_cursor, 1);
896void QWidgetLineControl::removeSelectedText()
898 if (m_selstart < m_selend && m_selend <= (
int) m_text.
size()) {
899 cancelPasswordEchoTimer();
902 addCommand(Command(SetSelection, m_cursor, u
'\0', m_selstart, m_selend));
903 if (m_selstart <= m_cursor && m_cursor < m_selend) {
906 for (
i = m_cursor;
i >= m_selstart; --
i)
907 addCommand (Command(DeleteSelection,
i, m_text.
at(
i), -1, 1));
908 for (
i = m_selend - 1;
i > m_cursor; --
i)
909 addCommand (Command(DeleteSelection,
i - m_cursor + m_selstart - 1, m_text.
at(
i), -1, -1));
911 for (
i = m_selend-1;
i >= m_selstart; --
i)
912 addCommand (Command(RemoveSelection,
i, m_text.
at(
i), -1, -1));
914#if QT_CONFIG(accessibility)
916 QAccessible::updateAccessibility(&
event);
919 m_text.
replace(m_selstart, m_selend - m_selstart, clearString(m_selstart, m_selend - m_selstart));
920 for (
int i = 0;
i < m_selend - m_selstart; ++
i)
921 addCommand(Command(Insert, m_selstart +
i, m_text.
at(m_selstart +
i), -1, -1));
923 m_text.
remove(m_selstart, m_selend - m_selstart);
925 if (m_cursor > m_selstart)
926 m_cursor -=
qMin(m_cursor, m_selend) - m_selstart;
938void QWidgetLineControl::parseInputMask(
const QString &maskFields)
941 if (maskFields.
isEmpty() || delimiter == 0) {
945 internalSetText(
QString(), -1,
false);
950 if (delimiter == -1) {
952 m_inputMask = maskFields;
954 m_inputMask = maskFields.
left(delimiter);
955 m_blank = (delimiter + 1 < maskFields.
size()) ? maskFields[delimiter + 1] : u
' ';
960 bool escaped =
false;
961 for (
int i=0;
i<m_inputMask.
size();
i++) {
962 const auto c = m_inputMask.
at(
i);
974 if (
c != u
'\\' &&
c != u
'!' &&
c != u
'<' &&
c != u
'>' &&
975 c != u
'{' &&
c != u
'}' &&
c != u
'[' &&
c != u
']')
979 m_maskData = std::make_unique<MaskInputData[]>(m_maxLength);
981 MaskInputData::Casemode
m = MaskInputData::NoCaseMode;
985 for (
int i = 0;
i < m_inputMask.
size();
i++) {
986 const auto c = m_inputMask.
at(
i);
989 m_maskData[
index].maskChar =
c;
990 m_maskData[
index].separator =
s;
991 m_maskData[
index].caseMode =
m;
994 }
else if (
c == u
'<') {
995 m = MaskInputData::Lower;
996 }
else if (
c == u
'>') {
997 m = MaskInputData::Upper;
998 }
else if (
c == u
'!') {
999 m = MaskInputData::NoCaseMode;
1000 }
else if (
c != u
'{' &&
c != u
'}' &&
c != u
'[' &&
c != u
']') {
1001 switch (
c.unicode()) {
1028 m_maskData[
index].maskChar =
c;
1029 m_maskData[
index].separator =
s;
1030 m_maskData[
index].caseMode =
m;
1035 internalSetText(m_text, -1,
false);
1046 switch (
mask.unicode()) {
1052 if (
key.isLetter() ||
key == m_blank)
1056 if (
key.isLetterOrNumber())
1060 if (
key.isLetterOrNumber() ||
key == m_blank)
1064 if (
key.isPrint() &&
key != m_blank)
1068 if (
key.isPrint() ||
key == m_blank)
1076 if (
key.isNumber() ||
key == m_blank)
1080 if (
key.isNumber() &&
key.digitValue() > 0)
1084 if ((
key.isNumber() &&
key.digitValue() > 0) ||
key == m_blank)
1088 if (
key.isNumber() ||
key == u
'+' ||
key == u
'-' ||
key == m_blank)
1092 if (
key == u
'0' ||
key == u
'1')
1096 if (
key == u
'0' ||
key == u
'1' ||
key == m_blank)
1100 if (
key.isNumber() || (
key >= u
'a' &&
key <= u
'f') || (
key >= u
'A' &&
key <= u
'F'))
1104 if (
key.isNumber() || (
key >= u
'a' &&
key <= u
'f') || (
key >= u
'A' &&
key <= u
'F') ||
key == m_blank)
1123#ifndef QT_NO_VALIDATOR
1125 int cursorCopy = m_cursor;
1126 if (m_validator && m_validator->
validate(textCopy, cursorCopy)
1134 if (
str.
size() != m_maxLength)
1137 for (
int i=0;
i < m_maxLength; ++
i) {
1138 if (m_maskData[
i].separator) {
1139 if (
str.
at(
i) != m_maskData[
i].maskChar)
1142 if (!isValidInput(
str.
at(
i), m_maskData[
i].maskChar))
1159 if (
pos >= m_maxLength)
1163 fill =
clear ? clearString(0, m_maxLength) : m_text;
1168 while (
i < m_maxLength) {
1170 if (m_maskData[
i].separator) {
1171 s += m_maskData[
i].maskChar;
1172 if (
str[strIndex] == m_maskData[
i].maskChar)
1176 if (isValidInput(
str[strIndex], m_maskData[
i].maskChar)) {
1177 switch (m_maskData[
i].caseMode) {
1178 case MaskInputData::Upper:
1181 case MaskInputData::Lower:
1190 int n = findInMask(
i,
true,
true,
str[strIndex]);
1192 if (
str.
size() != 1 ||
i == 0 || (
i > 0 && (!m_maskData[
i-1].separator || m_maskData[
i-1].maskChar !=
str[strIndex]))) {
1198 n = findInMask(
i,
true,
false,
str[strIndex]);
1201 switch (m_maskData[
n].caseMode) {
1202 case MaskInputData::Upper:
1205 case MaskInputData::Lower:
1232QString QWidgetLineControl::clearString(
int pos,
int len)
const
1234 if (
pos >= m_maxLength)
1240 if (m_maskData[
i].separator)
1241 s += m_maskData[
i].maskChar;
1261 for (
int i = 0;
i <
end; ++
i)
1262 if (m_maskData[
i].separator)
1263 s += m_maskData[
i].maskChar;
1265 if (
str[
i] != m_blank)
1275int QWidgetLineControl::findInMask(
int pos,
bool forward,
bool findSeparator,
QChar searchChar)
const
1277 if (
pos >= m_maxLength ||
pos < 0)
1280 int end = forward ? m_maxLength : -1;
1281 int step = forward ? 1 : -1;
1285 if (findSeparator) {
1286 if (m_maskData[
i].separator && m_maskData[
i].maskChar == searchChar)
1289 if (!m_maskData[
i].separator) {
1292 else if (isValidInput(searchChar, m_maskData[
i].maskChar))
1301void QWidgetLineControl::internalUndo(
int until)
1305 cancelPasswordEchoTimer();
1308 while (m_undoState && m_undoState > until) {
1309 Command& cmd = m_history[--m_undoState];
1312 m_text.
remove(cmd.pos, 1);
1316 m_selstart = cmd.selStart;
1317 m_selend = cmd.selEnd;
1321 case RemoveSelection:
1322 m_text.
insert(cmd.pos, cmd.uc);
1323 m_cursor = cmd.pos + 1;
1326 case DeleteSelection:
1327 m_text.
insert(cmd.pos, cmd.uc);
1333 if (until < 0 && m_undoState) {
1334 Command&
next = m_history[m_undoState-1];
1335 if (
next.type != cmd.type &&
next.type < RemoveSelection
1336 && (cmd.type < RemoveSelection ||
next.type == Separator))
1341 emitCursorPositionChanged();
1344void QWidgetLineControl::internalRedo()
1349 while (m_undoState < (
int)m_history.size()) {
1350 Command& cmd = m_history[m_undoState++];
1353 m_text.
insert(cmd.pos, cmd.uc);
1354 m_cursor = cmd.pos + 1;
1357 m_selstart = cmd.selStart;
1358 m_selend = cmd.selEnd;
1363 case RemoveSelection:
1364 case DeleteSelection:
1365 m_text.
remove(cmd.pos, 1);
1366 m_selstart = cmd.selStart;
1367 m_selend = cmd.selEnd;
1371 m_selstart = cmd.selStart;
1372 m_selend = cmd.selEnd;
1376 if (m_undoState < (
int)m_history.size()) {
1377 Command&
next = m_history[m_undoState];
1378 if (
next.type != cmd.type && cmd.type < RemoveSelection &&
next.type != Separator
1379 && (
next.type < RemoveSelection || cmd.type == Separator))
1384 emitCursorPositionChanged();
1393void QWidgetLineControl::emitCursorPositionChanged()
1395 if (m_cursor != m_lastCursorPos) {
1396 const int oldLast = m_lastCursorPos;
1397 m_lastCursorPos = m_cursor;
1399#if QT_CONFIG(accessibility)
1403 QAccessible::updateAccessibility(&
event);
1409#if QT_CONFIG(completer)
1412bool QWidgetLineControl::advanceToEnabledItem(
int dir)
1436void QWidgetLineControl::complete(
int key)
1460 if (!advanceToEnabledItem(
n))
1463#ifndef QT_KEYPAD_NAVIGATION
1479 if (m_readOnly ==
enable)
1488 if (m_blinkEnabled ==
enable)
1508 if (m_blinkEnabled && !m_readOnly) {
1521 if (!m_blinkEnabled || m_blinkTimer == 0)
1533 if (
event->timerId() == m_blinkTimer) {
1534 m_blinkStatus = !m_blinkStatus;
1536 }
else if (
event->timerId() == m_deleteAllTimer) {
1538 m_deleteAllTimer = 0;
1540 }
else if (
event->timerId() == m_tripleClickTimer) {
1542 m_tripleClickTimer = 0;
1543 }
else if (
event->timerId() == m_passwordEchoTimer) {
1545 m_passwordEchoTimer = 0;
1546 updateDisplayText();
1550#ifndef QT_NO_SHORTCUT
1583 switch (ke->
key()) {
1607 bool inlineCompletionAccepted =
false;
1609#if QT_CONFIG(completer)
1615 && popup && popup->isVisible()) {
1618 switch (
event->key()) {
1626 switch (
event->key()) {
1630#ifdef QT_KEYPAD_NAVIGATION
1632 if (!QApplicationPrivate::keypadNavigationEnabled())
1639 inlineCompletionAccepted =
true;
1655 inputMethod->
hide();
1660 if (inlineCompletionAccepted)
1670 && !
event->text().isEmpty()
1671#ifdef QT_KEYPAD_NAVIGATION
1688#if QT_CONFIG(shortcut)
1694#ifndef QT_NO_SHORTCUT
1706#ifndef QT_NO_CLIPBOARD
1748#if !QT_CONFIG(completer)
1749 const bool inlineCompletion =
false;
1755 || inlineCompletion)) {
1765#if !QT_CONFIG(completer)
1766 const bool inlineCompletion =
false;
1772 || inlineCompletion)) {
1825#ifndef QT_NO_CLIPBOARD
1833 bool handled =
false;
1836 Qt::KeyboardModifiers myModifiers = (
event->modifiers() &
~Qt::KeypadModifier);
1854 switch (
event->key()) {
1861#if QT_CONFIG(completer)
1864 complete(
event->key());
1872 switch (
event->key()) {
1876#if QT_CONFIG(completer)
1881#ifdef QT_KEYPAD_NAVIGATION
1883 if (QApplicationPrivate::keypadNavigationEnabled() && !
event->isAutoRepeat()
1891 emit editFocusChange(
false);
1892 }
else if (!m_deleteAllTimer) {
1916#if QT_CONFIG(completer)
1917 complete(
event->key());
1926#ifndef QT_NO_CLIPBOARD
1938 return !m_readOnly && m_undoState
1939 && (m_echoMode ==
QLineEdit::Normal || m_history[m_undoState - 1].type == QWidgetLineControl::Insert);
1947 && m_undoState < int(m_history.size());
1952#include "moc_qwidgetlinecontrol_p.cpp"
virtual Q_INVOKABLE Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
constexpr bool isLowSurrogate() const noexcept
Returns true if the QChar is the low part of a UTF16 surrogate (for example if its code point is in r...
constexpr bool isNull() const noexcept
Returns true if the character is the Unicode character 0x0000 ('\0'); otherwise returns false.
constexpr bool isHighSurrogate() const noexcept
Returns true if the QChar is the high part of a UTF16 surrogate (for example if its code point is in ...
void setText(const QString &, Mode mode=Clipboard)
Copies text into the clipboard as plain text.
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...
Mode
\keyword clipboard mode
QAbstractItemView * popup
static QCompleterPrivate * get(QCompleter *o)
int completionCount() const
Returns the number of completions for the current prefix.
CompletionMode
This enum specifies how completions are provided to the user.
@ UnfilteredPopupCompletion
bool wrapAround
the completions wrap around when navigating through items
QString completionPrefix
the completion prefix used to provide completions.
bool setCurrentRow(int row)
Sets the current row to the row specified.
Qt::CaseSensitivity caseSensitivity
the case sensitivity of the matching
void complete(const QRect &rect=QRect())
For QCompleter::PopupCompletion and QCompletion::UnfilteredPopupCompletion modes, calling this functi...
QModelIndex currentIndex() const
Returns the model index of the current completion in the completionModel().
QString currentCompletion() const
Returns the current completion string.
CompletionMode completionMode
how the completions are provided to the user
void setCompletionPrefix(const QString &prefix)
QAbstractItemModel * completionModel() const
Returns the completion model.
int currentRow() const
Returns the current row.
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
static QPlatformTheme * platformTheme()
static QClipboard * clipboard()
Returns the object for interacting with the clipboard.
static QStyleHints * styleHints()
Returns the application's style hints.
static QInputMethod * inputMethod()
returns the input method.
The QKeyEvent class describes a key event.
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.
qsizetype size() const noexcept
void append(parameter_type t)
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 mi...
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void killTimer(int id)
Kills the timer with timer identifier, id.
The QPainter class performs low-level painting on widgets and other paint devices.
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString & fill(QChar c, qsizetype size=-1)
Sets every character in the string to character ch.
QString & replace(qsizetype i, qsizetype len, QChar after)
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
qsizetype size() const
Returns the number of characters in this string.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QString & insert(qsizetype i, QChar c)
QString toLower() const &
QChar * data()
Returns a pointer to the data stored in the QString.
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString & remove(qsizetype i, qsizetype len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
QString toUpper() const &
void cursorFlashTimeChanged(int cursorFlashTime)
int cursorFlashTime
the text cursor's flash (blink) time in milliseconds.
QTextCharFormat toCharFormat() const
Returns this format as a character format.
const QTextOption & textOption() const
Returns the current text option used to control the layout process.
QTextLine createLine()
Returns a new text line to be laid out if there is text to be inserted into the layout; otherwise ret...
void beginLayout()
Begins the layout process.
void setCacheEnabled(bool enable)
Enables caching of the complete layout information if enable is true; otherwise disables layout cachi...
void setFormats(const QList< FormatRange > &overrides)
void setText(const QString &string)
Sets the layout's text to the given string.
QString text() const
Returns the layout's text.
int previousCursorPosition(int oldPos, CursorMode mode=SkipCharacters) const
Returns the first valid cursor position before oldPos that respects the given cursor mode.
QTextLine lineAt(int i) const
Returns the {i}-th line of text in this text layout.
int nextCursorPosition(int oldPos, CursorMode mode=SkipCharacters) const
Returns the next valid cursor position after oldPos that respects the given cursor mode.
void setTextOption(const QTextOption &option)
Sets the text option structure that controls the layout process to the given option.
void draw(QPainter *p, const QPointF &pos, const QList< FormatRange > &selections=QList< FormatRange >(), const QRectF &clip=QRectF()) const
Draws the whole layout on the painter p at the position specified by pos.
void endLayout()
Ends the layout process.
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...
qreal height() const
Returns the line's height.
qreal cursorToX(int *cursorPos, Edge edge=Leading) const
Converts the cursor position cursorPos to the corresponding x position inside the line,...
CursorPosition
\value CursorBetweenCharacters \value CursorOnCharacter
qreal ascent() const
Returns the line's ascent.
int xToCursor(qreal x, CursorPosition=CursorBetweenCharacters) const
Converts the x-coordinate x, to the nearest matching cursor position, depending on the cursor positio...
void setTextDirection(Qt::LayoutDirection aDirection)
Sets the direction of the text layout defined by the option to the given direction.
virtual void fixup(QString &) const
This function attempts to change input to be valid according to this validator's rules.
virtual State validate(QString &, int &) const =0
This virtual function returns \l Invalid if input is invalid according to this validator's rules,...
Combined button and popup list for selecting options.
int qRound(qfloat16 d) noexcept
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
void forceUpdate(QQuickItem *item)
static const struct ImageFormatTab unknown[]
static QString escape(const QString &input)
myObject disconnect()
[26]