8#include <private/qqmlglobal_p.h>
9#include <private/qv4scopedvalue_p.h>
11#include <QtCore/qcoreapplication.h>
12#include <QtCore/qmimedata.h>
13#include <QtQml/qqmlinfo.h>
14#include <QtGui/qevent.h>
15#include <QTextBoundaryFinder>
17#include <QtQuick/qsgsimplerectnode.h>
19#include <QtGui/qstylehints.h>
20#include <QtGui/qinputmethod.h>
21#include <QtCore/qmath.h>
23#if QT_CONFIG(accessibility)
28#include <QtGui/private/qtextengine_p.h>
29#include <QtGui/private/qinputcontrol_p.h>
83 updateCursorRectangle();
106 QString res =
d->m_maskData ?
d->stripString(content) : content;
114 invalidateFontCaches();
126 d->internalSetText(
s, -1,
false);
150 return d->renderType;
181 return d->m_text.size();
394 return d->sourceFont;
400 if (
d->sourceFont ==
font)
403 d->sourceFont =
font;
406 if (
d->font.pointSizeF() != -1) {
409 d->font.setPointSizeF(
size/2.0);
411 if (oldFont !=
d->font) {
413 updateCursorRectangle();
437 d->textLayoutDirty =
true;
454 return d->selectionColor;
460 if (
d->selectionColor ==
color)
463 d->selectionColor =
color;
464 if (
d->hasSelectedText()) {
465 d->textLayoutDirty =
true;
480 return d->selectedTextColor;
486 if (
d->selectedTextColor ==
color)
489 d->selectedTextColor =
color;
490 if (
d->hasSelectedText()) {
491 d->textLayoutDirty =
true;
543 bool forceAlign =
d->hAlignImplicit &&
d->effectiveLayoutMirror;
544 d->hAlignImplicit =
false;
547 updateCursorRectangle();
554 d->hAlignImplicit =
true;
557 updateCursorRectangle();
565 if (!
d->hAlignImplicit &&
d->effectiveLayoutMirror) {
577 return effectiveAlignment;
587 if (oldEffectiveHAlign !=
q->effectiveHAlign())
588 emit q->effectiveHorizontalAlignmentChanged();
603 while (!character->
isNull()) {
660 updateCursorRectangle();
661 d->updateBaselineOffset();
694 if (
mode ==
d->wrapMode)
698 updateCursorRectangle();
705 if (
q->isComponentComplete()) {
707 q->updateCursorRectangle();
708 emit q->effectiveHorizontalAlignmentChanged();
725 return d->m_readOnly;
731 if (
d->m_readOnly == ro)
735 setFlag(QQuickItem::ItemAcceptsInputMethod, !ro);
738 d->setCursorPosition(
d->end());
743 d->emitUndoRedoChanged();
764 return d->m_maxLength;
770 if (
d->m_maxLength == ml ||
d->m_maskData)
774 d->internalSetText(
d->m_text, -1,
false);
808 return d->cursorVisible;
814 if (
d->cursorVisible == on)
816 d->cursorVisible = on;
820 d->updateCursorBlinking();
871 c +=
d->m_preeditCursor;
875 QTextLine l =
d->m_textLayout.lineForTextPosition(
c);
881 if (
d->overwriteMode) {
904 return d->lastSelectionStart;
920 return d->lastSelectionEnd;
938 if (
start < 0 || end < 0 || start >
d->m_text.size() ||
end >
d->m_text.size())
961 return d->selectedText();
973 return d->focusOnPress;
979 if (
d->focusOnPress ==
b)
997 return d->autoScroll;
1003 if (
d->autoScroll ==
b)
1008 updateCursorRectangle();
1012#if QT_CONFIG(validator)
1037QValidator* QQuickTextInput::validator()
const
1040 return d->m_validator;
1046 if (
d->m_validator ==
v)
1049 if (
d->m_validator) {
1057 if (
d->m_validator) {
1066 emit validatorChanged();
1069void QQuickTextInput::q_validatorChanged()
1093 a += m_preeditCursor;
1107void QQuickTextInputPrivate::checkIsValid()
1111 ValidatorState
state = hasAcceptableInput(
m_text);
1114 if (
state != AcceptableInput) {
1117 emit q->acceptableInputChanged();
1121 emit q->acceptableInputChanged();
1137 return d->inputMask();
1143 QString canonicalInputMask = im;
1146 if (
d->inputMask() == canonicalInputMask)
1149 d->setInputMask(im);
1165 return d->m_acceptableInput;
1198Qt::InputMethodHints QQuickTextInputPrivate::effectiveInputMethodHints()
const
1200 Qt::InputMethodHints hints = inputMethodHints;
1204 hints &=
~Qt::ImhHiddenText;
1234 d->cancelPasswordEchoTimer();
1235 d->m_echoMode = echo;
1236 d->m_passwordEchoEditing =
false;
1240 d->updateDisplayText();
1241 updateCursorRectangle();
1247 d->m_text.reserve(30);
1295 return d->inputMethodHints;
1306 if (hints ==
d->inputMethodHints)
1309 d->inputMethodHints = hints;
1331 return d->cursorComponent;
1340void QQuickTextInput::createCursor()
1343 d->cursorPending =
true;
1362 else if (
pos >
d->m_cursor)
1363 pos +=
d->preeditAreaText().size();
1371 if (
d->overwriteMode) {
1417 x =
arg->toNumber();
1419 if (++i < args->
length()) {
1421 y =
arg->toNumber();
1424 if (++i < args->
length()) {
1430 const int cursor =
d->m_cursor;
1433 const int preeditLength =
d->preeditAreaText().size();
1435 ?
pos - preeditLength
1453 if (
y < (
line.rect().bottom() + nextLine.
y()) / 2)
1478 return d->overwriteMode;
1484 if (
d->overwriteMode == overwrite)
1486 d->overwriteMode = overwrite;
1507 d->processKeyEvent(ev);
1517 const bool wasComposing =
d->hasImState;
1518 d->processInputMethodEvent(ev);
1520 QQuickImplicitSizeItem::inputMethodEvent(ev);
1522 if (wasComposing !=
d->hasImState)
1538 event->setAccepted(
true);
1539 if (!
d->hasPendingTripleClick()) {
1540 d->tripleClickStartPoint =
event->position();
1541 d->tripleClickTimer.start();
1544 if (
d->sendMouseEventToInputContext(
event))
1554 d->pressPos =
event->position();
1556 if (
d->sendMouseEventToInputContext(
event))
1560 if (
d->selectByMouse &&
1563 ||
d->selectByTouchDrag
1567 d->selectPressed =
true;
1568 QPointF distanceVector =
d->pressPos -
d->tripleClickStartPoint;
1569 if (
d->hasPendingTripleClick()
1571 event->setAccepted(
true);
1583 if (
d->focusOnPress && !
qGuiApp->styleHints()->setFocusOnTouchRelease())
1586 event->setAccepted(
true);
1594 && !
d->selectByTouchDrag
1599 if (
d->selectPressed) {
1604 if (
d->composeMode()) {
1606 int startPos =
d->positionAt(
d->pressPos);
1607 int currentPos =
d->positionAt(
event->position());
1608 if (startPos != currentPos)
1609 d->setSelection(startPos, currentPos - startPos);
1615 event->setAccepted(
true);
1624 if (
d->sendMouseEventToInputContext(
event))
1626 if (
d->selectPressed) {
1627 d->selectPressed =
false;
1631#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
1632 ||
d->selectByTouchDrag
1636#if QT_CONFIG(clipboard)
1650 if (!isMouse && !
d->hasSelectedText())
1651 d->moveCursor(
d->positionAt(
event->position()),
false);
1653 if (
d->focusOnPress &&
qGuiApp->styleHints()->setFocusOnTouchRelease())
1656 if (!
event->isAccepted())
1663 if (composeMode()) {
1665 int mousePos = tmp_cursor -
m_cursor;
1683 d->selectPressed =
false;
1689#if QT_CONFIG(shortcut)
1692 if (
d->m_readOnly) {
1724 switch (ke->
key()) {
1746 const QRectF &oldGeometry)
1750 if (newGeometry.
width() != oldGeometry.
width())
1753 d->updateBaselineOffset();
1754 updateCursorRectangle();
1763 const qreal width = qMax<qreal>(0,
q->width() -
q->leftPadding() -
q->rightPadding());
1765 qreal widthUsed = 0;
1768 const qreal cursorWidth = cix >= 0 ? cix :
width - cix;
1773 if (widthUsed <=
width) {
1793 if (preeditLength > 0) {
1802 if (previousScroll !=
hscroll)
1826 const qreal height = qMax<qreal>(0,
q->height() -
q->topPadding() -
q->bottomPadding());
1856 if (preeditLength > 0) {
1866 if (previousScroll !=
vscroll)
1870void QQuickTextInput::triggerPreprocess()
1881 invalidateFontCaches();
1884void QQuickTextInput::invalidateFontCaches()
1888 if (
d->m_textLayout.engine() !=
nullptr)
1889 d->m_textLayout.engine()->resetFontEngineCache();
1900 qGuiApp->inputMethod()->show();
1920 if (node ==
nullptr)
1924 const bool showCursor = !
isReadOnly() &&
d->cursorItem ==
nullptr &&
d->cursorVisible &&
d->m_blinkStatus;
1926 if (!
d->textLayoutDirty && oldNode !=
nullptr) {
1937 if (
d->autoScroll &&
d->m_textLayout.lineCount() > 0) {
1945 if (!
d->m_textLayout.text().isEmpty()
1947 || !
d->m_textLayout.preeditAreaText().isEmpty()
1952 d->selectionColor,
d->selectedTextColor,
1953 d->selectionStart(),
1954 d->selectionEnd() - 1);
1961 d->textLayoutDirty =
false;
1964 invalidateFontCaches();
1977 if (!
d->extra.isAllocated()
1978 ||
d->extra->enterKeyAttached ==
nullptr
1982 while (
next &&
next !=
this && !
next->activeFocusOnTab())
1983 next =
next->nextItemInFocusChain();
1985 const auto nextYPos =
next->mapToGlobal(
QPoint(0, 0)).
y();
1986 const auto currentYPos = this->mapToGlobal(
QPoint(0, 0)).y();
1987 if (currentYPos < nextYPos)
2005 return QVariant((
int)
d->effectiveInputMethodHints());
2009 return d->anchorRectangle();
2029 if (
d->selectionStart() ==
d->selectionEnd())
2031 else if (
d->selectionStart() ==
d->m_cursor)
2044 return QVariant(
d->m_text.left(
d->m_cursor));
2048 return QQuickItem::inputMethodQuery(
property);
2084 qmlWarning(
this) <<
"isRightToLeft(start, end) called with the end property being smaller than the start.";
2091#if QT_CONFIG(clipboard)
2101void QQuickTextInput::cut()
2119void QQuickTextInput::copy()
2130void QQuickTextInput::paste()
2149 if (!
d->m_readOnly) {
2152 d->finishChange(-1,
true);
2165 if (!
d->m_readOnly) {
2182 if (
d->m_passwordMaskDelay > 0)
2183 d->m_passwordEchoTimer.start(
d->m_passwordMaskDelay,
this);
2185 if (position < 0 || position >
d->m_text.size())
2188 const int priorState =
d->m_undoState;
2192 if (
d->hasSelectedText()) {
2196 if (
d->m_maskData) {
2197 insertText =
d->maskString(
position, insertText);
2198 for (
int i = 0;
i < insertText.
size(); ++
i) {
2206 d->m_textDirty =
true;
2207 if (position < d->m_selend &&
position + insertText.
size() >
d->m_selstart)
2208 d->m_selDirty =
true;
2210 int remaining =
d->m_maxLength -
d->m_text.size();
2211 if (remaining != 0) {
2212 insertText = insertText.
left(remaining);
2214 for (
int i = 0;
i < insertText.
size(); ++
i)
2218 d->m_cursor += insertText.
size();
2220 d->m_selstart += insertText.
size();
2222 d->m_selend += insertText.
size();
2223 d->m_textDirty =
true;
2224 if (
position >=
d->m_selstart && position <= d->m_selend)
2225 d->m_selDirty =
true;
2231 d->finishChange(priorState);
2233 if (
d->lastSelectionStart !=
d->lastSelectionEnd) {
2234 if (
d->m_selstart !=
d->lastSelectionStart) {
2235 d->lastSelectionStart =
d->m_selstart;
2238 if (
d->m_selend !=
d->lastSelectionEnd) {
2239 d->lastSelectionEnd =
d->m_selend;
2263 if (start < d->m_selend &&
end >
d->m_selstart)
2264 d->m_selDirty =
true;
2266 const int priorState =
d->m_undoState;
2271 if (start <= d->m_cursor &&
d->m_cursor <
end) {
2274 for (
int i =
d->m_cursor;
i >=
start; --
i) {
2278 for (
int i =
end - 1;
i >
d->m_cursor; --
i) {
2288 if (
d->m_maskData) {
2299 if (
d->m_selstart >
start)
2301 if (
d->m_selend >=
end)
2307 d->m_textDirty =
true;
2308 d->finishChange(priorState);
2310 if (
d->lastSelectionStart !=
d->lastSelectionEnd) {
2311 if (
d->m_selstart !=
d->lastSelectionStart) {
2312 d->lastSelectionStart =
d->m_selstart;
2315 if (
d->m_selend !=
d->lastSelectionEnd) {
2316 d->lastSelectionEnd =
d->m_selend;
2331 d->selectWordAtPos(
d->m_cursor);
2348 return QString(
d->m_passwordCharacter);
2358 d->updateDisplayText();
2373 return d->m_passwordMaskDelay;
2379 if (
d->m_passwordMaskDelay != delay) {
2380 d->m_passwordMaskDelay = delay;
2381 emit passwordMaskDelayChanged(delay);
2409 return d->m_textLayout.text().insert(
d->m_textLayout.preeditAreaPosition(),
d->m_textLayout.preeditAreaText());
2427 return d->m_textLayout.preeditAreaText();
2451 return d->selectByMouse;
2457 if (
d->selectByMouse != on) {
2458 d->selectByMouse = on;
2477 return d->mouseSelectionMode;
2483 if (
d->mouseSelectionMode !=
mode) {
2484 d->mouseSelectionMode =
mode;
2499 return d->persistentSelection;
2505 if (
d->persistentSelection == on)
2507 d->persistentSelection = on;
2520#if QT_CONFIG(clipboard)
2522 if (!
d->canPasteValid) {
2572 return d->contentSize.width();
2586 return d->contentSize.height();
2636 d->moveCursor(
pos,
true);
2637 }
else if (
pos !=
d->m_cursor) {
2638 const int cursor =
d->m_cursor;
2640 if (!
d->hasSelectedText())
2641 anchor =
d->m_cursor;
2642 else if (
d->selectionStart() ==
d->m_cursor)
2643 anchor =
d->selectionEnd();
2645 anchor =
d->selectionStart();
2652 const QTextBoundaryFinder::BoundaryReasons reasons = finder.
boundaryReasons();
2664 d->setSelection(anchor,
cursor - anchor);
2670 const QTextBoundaryFinder::BoundaryReasons reasons = finder.
boundaryReasons();
2682 d->setSelection(anchor,
cursor - anchor);
2690 d->handleFocusEvent(
event);
2697 bool focus =
event->gotFocus();
2699 q->setCursorVisible(
focus);
2703 q->q_updateAlignment();
2706 qGuiApp->inputMethod()->show();
2708 q,
SLOT(q_updateAlignment()));
2721 if (hasAcceptableInput(
m_text) == AcceptableInput ||
fixup())
2722 emit q->editingFinished();
2726 q,
SLOT(q_updateAlignment()));
2734 d->handleFocusEvent(
event);
2756 return d->hasImState;
2766 , explicitTopPadding(
false)
2767 , explicitLeftPadding(
false)
2768 , explicitRightPadding(
false)
2769 , explicitBottomPadding(
false)
2770 , implicitResize(true)
2777#if QT_CONFIG(clipboard)
2785 q->setFlag(QQuickItem::ItemAcceptsInputMethod);
2788#if QT_CONFIG(clipboard)
2797 if (!qmlDisableDistanceField()) {
2815void QQuickTextInput::updateCursorRectangle(
bool scroll)
2818 if (!isComponentComplete())
2822 d->updateHorizontalScroll();
2823 d->updateVerticalScroll();
2828 emit cursorRectangleChanged();
2829 if (
d->cursorItem) {
2831 d->cursorItem->setPosition(
r.topLeft());
2832 d->cursorItem->setHeight(
r.height());
2839void QQuickTextInput::selectionChanged()
2842 d->textLayoutDirty =
true;
2846 emit selectedTextChanged();
2848 if (
d->lastSelectionStart !=
d->selectionStart()) {
2849 d->lastSelectionStart =
d->selectionStart();
2850 if (
d->lastSelectionStart == -1)
2851 d->lastSelectionStart =
d->m_cursor;
2852 emit selectionStartChanged();
2854 if (
d->lastSelectionEnd !=
d->selectionEnd()) {
2855 d->lastSelectionEnd =
d->selectionEnd();
2856 if (
d->lastSelectionEnd == -1)
2857 d->lastSelectionEnd =
d->m_cursor;
2858 emit selectionEndChanged();
2866 int cursorWidth =
d->cursorItem ? 0 : 1;
2869 if (!
d->autoScroll ||
d->contentSize.width() <
width())
2873 QRectF r(-
hscroll, -
d->vscroll,
d->contentSize.width(),
d->contentSize.height());
2874 r.setRight(
r.right() + cursorWidth);
2882 int cursorWidth =
d->cursorItem ?
d->cursorItem->width() : 1;
2886 r.setRight(
r.right() + cursorWidth);
2890void QQuickTextInput::q_canPasteChanged()
2893 bool old =
d->canPaste;
2894#if QT_CONFIG(clipboard)
2898 d->canPaste =
false;
2901 bool changed =
d->canPaste != old || !
d->canPasteValid;
2902 d->canPasteValid =
true;
2904 emit canPasteChanged();
2908void QQuickTextInput::q_updateAlignment()
2911 if (
d->determineHorizontalAlignment()) {
2913 updateCursorRectangle();
2923void QQuickTextInputPrivate::updateDisplayText(
bool forceUpdate)
2964 emit q_func()->displayTextChanged();
2977 option.setAlignment(Qt::Alignment(
q->effectiveHAlign()));
2986 line.setLineWidth(INT_MAX);
2987 const qreal theImplicitWidth =
qCeil(
line.naturalTextWidth()) +
q->leftPadding() +
q->rightPadding();
2990 return theImplicitWidth;
2998 d->requireImplicitWidth =
true;
3000 if (
q->isComponentComplete())
3009 qreal oldPadding =
q->topPadding();
3016 q->updateCursorRectangle();
3017 emit q->topPaddingChanged();
3024 qreal oldPadding =
q->leftPadding();
3031 q->updateCursorRectangle();
3032 emit q->leftPaddingChanged();
3039 qreal oldPadding =
q->rightPadding();
3046 q->updateCursorRectangle();
3047 emit q->rightPaddingChanged();
3054 qreal oldPadding =
q->bottomPadding();
3057 extra.value().explicitBottomPadding = !
reset;
3061 q->updateCursorRectangle();
3062 emit q->bottomPaddingChanged();
3068 return !
extra.isAllocated() ||
extra->implicitResize;
3074 extra.value().implicitResize =
false;
3075 else if (
extra.isAllocated())
3076 extra->implicitResize =
true;
3083 if (!
q->isComponentComplete())
3090 option.setAlignment(Qt::Alignment(
q->effectiveHAlign()));
3091 if (!qmlDisableDistanceField())
3101 line.setLineWidth(INT_MAX);
3105 q->setImplicitWidth(
qCeil(
line.naturalTextWidth()) +
q->leftPadding() +
q->rightPadding());
3114 line.setLineWidth(lineWidth);
3121 }
while (
line.isValid());
3138 q->setImplicitSize(
width +
q->leftPadding() +
q->rightPadding(),
height +
q->topPadding() +
q->bottomPadding());
3140 q->setImplicitHeight(
height +
q->topPadding() +
q->bottomPadding());
3146 emit q->contentSizeChanged();
3158 if (!
q->isComponentComplete())
3162 if (
q->heightValid()) {
3165 yoff = surplusHeight;
3167 yoff = surplusHeight/2;
3169 q->setBaselineOffset(fm.
ascent() + yoff +
q->topPadding());
3172#if QT_CONFIG(clipboard)
3215void QQuickTextInputPrivate::commitPreedit()
3231void QQuickTextInputPrivate::cancelPreedit()
3257 if (separateSelection()) {
3258 removeSelectedText();
3269 internalDelete(
true);
3273 internalDelete(
true);
3275 finishChange(priorState);
3290 if (separateSelection()) {
3291 removeSelectedText();
3297 finishChange(priorState);
3310 if (separateSelection())
3311 removeSelectedText();
3312 internalInsert(newText);
3313 finishChange(priorState);
3324 separateSelection();
3327 removeSelectedText();
3329 finishChange(priorState,
false,
false);
3348 qWarning(
"QQuickTextInputPrivate::setSelection: Invalid start position");
3370 emitCursorPositionChanged();
3373 emit q->selectionChanged();
3374 emitCursorPositionChanged();
3393 updateDisplayText();
3405#if QT_CONFIG(validator)
3409 m_validator->fixup(textCopy);
3412 internalSetText(textCopy, cursorCopy);
3454 emit q->selectionChanged();
3456 emitCursorPositionChanged();
3458 q->updateInputMethod();
3473 int priorState = -1;
3474 bool isGettingInput = !
event->commitString().isEmpty()
3475 ||
event->preeditString() != preeditAreaText()
3476 ||
event->replacementLength() > 0;
3477 bool cursorPositionChanged =
false;
3478 bool selectionChange =
false;
3479 m_preeditDirty =
event->preeditString() != preeditAreaText();
3481 if (isGettingInput) {
3484 separateSelection();
3490 removeSelectedText();
3494 if (
event->replacementStart() <= 0)
3495 c +=
event->commitString().size() -
qMin(-
event->replacementStart(),
event->replacementLength());
3497 int cursorInsertPos =
m_cursor +
event->replacementStart();
3498 if (cursorInsertPos < 0)
3499 cursorInsertPos = 0;
3502 if (
event->replacementLength()) {
3506 removeSelectedText();
3510 if (!
event->commitString().isEmpty()) {
3511 internalInsert(
event->commitString());
3512 cursorPositionChanged =
true;
3517 for (
int i = 0;
i <
event->attributes().
size(); ++
i) {
3524 if (!cursorPositionChanged)
3532 selectionChange =
true;
3537 cursorPositionChanged =
true;
3543 emit q->preeditTextChanged();
3544 if (!
event->preeditString().isEmpty() && m_undoPreeditState == -1)
3546 m_undoPreeditState = priorState;
3548 const int oldPreeditCursor = m_preeditCursor;
3549 m_preeditCursor =
event->preeditString().size();
3550 hasImState = !
event->preeditString().isEmpty();
3553 for (
int i = 0;
i <
event->attributes().
size(); ++
i) {
3557 m_preeditCursor =
a.start;
3565 o.length =
a.length;
3573 updateDisplayText(
true);
3574 if (cursorPositionChanged && emitCursorPositionChanged())
3576 else if (m_preeditCursor != oldPreeditCursor || isGettingInput)
3577 q->updateCursorRectangle();
3580 finishChange(priorState);
3584 if (selectionChange) {
3585 emit q->selectionChanged();
3591 if (
event->preeditString().isEmpty())
3592 m_undoPreeditState = -1;
3630bool QQuickTextInputPrivate::finishChange(
int validateFromState,
bool update,
bool edited)
3638 bool alignmentChanged =
false;
3647#if QT_CONFIG(validator)
3651 textCopy = maskString(0,
m_text,
true);
3659 if (
m_text != textCopy) {
3660 internalSetText(textCopy, cursorCopy);
3673 if (m_undoPreeditState >= 0 && (m_undoPreeditState < validateFromState || validateFromState < 0))
3674 validateFromState = m_undoPreeditState;
3676 if (validateFromState >= 0 && wasValidInput && !
m_validInput) {
3679 internalUndo(validateFromState);
3690 m_preeditDirty =
false;
3694 emit q->textEdited();
3695 emit q->textChanged();
3698 updateDisplayText(alignmentChanged);
3701 emit q->acceptableInputChanged();
3704 if (m_preeditDirty) {
3705 m_preeditDirty =
false;
3707 alignmentChanged =
true;
3715 emit q->selectionChanged();
3720 if (inputMethodAttributesChanged)
3721 q->updateInputMethod();
3723 emitUndoRedoChanged();
3725 if (!emitCursorPositionChanged() && (alignmentChanged ||
textChanged))
3726 q->updateCursorRectangle();
3736void QQuickTextInputPrivate::internalSetText(
const QString &
txt,
int pos,
bool edited)
3749 m_undoPreeditState = -1;
3754 bool changed = finishChange(-1,
true, edited);
3755#if !QT_CONFIG(accessibility)
3759 if (changed && QAccessible::isActive()) {
3760 if (
QObject *acc = QQuickAccessibleAttached::findAccessible(
q, QAccessible::EditableText)) {
3761 QAccessibleTextUpdateEvent ev(acc, 0, oldText,
m_text);
3762 QAccessible::updateAccessibility(&ev);
3775void QQuickTextInputPrivate::addCommand(
const Command &cmd)
3797void QQuickTextInputPrivate::internalInsert(
const QString &
s)
3807 for (
int i = 0;
i < ms.
size(); ++
i) {
3817 if (remaining != 0) {
3820 for (
auto e : remainingStr)
3838void QQuickTextInputPrivate::internalDelete(
bool wasBackspace)
3864void QQuickTextInputPrivate::removeSelectedText()
3902bool QQuickTextInputPrivate::separateSelection()
3919void QQuickTextInputPrivate::parseInputMask(
const QString &maskFields)
3922 if (maskFields.
isEmpty() || delimiter == 0) {
3931 if (delimiter == -1) {
3978 switch (
c.unicode()) {
4023 switch (
mask.unicode()) {
4033 if (
key.isLetterOrNumber())
4057 if (
key.isNumber() &&
key.digitValue() > 0)
4098QQuickTextInputPrivate::ValidatorState QQuickTextInputPrivate::hasAcceptableInput(
const QString &
str)
const
4100#if QT_CONFIG(validator)
4106 return ValidatorState(
state);
4111 return AcceptableInput;
4114 return InvalidInput;
4119 return InvalidInput;
4122 return InvalidInput;
4125 return AcceptableInput;
4169 int n = findInMask(
i,
true,
true,
str[strIndex]);
4177 n = findInMask(
i,
true,
false,
str[strIndex]);
4240 for (
int i = 0;
i <
end; ++
i) {
4254int QQuickTextInputPrivate::findInMask(
int pos,
bool forward,
bool findSeparator,
QChar searchChar)
const
4260 int step = forward ? 1 : -1;
4264 if (findSeparator) {
4271 else if (isValidInput(searchChar,
m_maskData[
i].maskChar))
4280void QQuickTextInputPrivate::internalUndo(
int until)
4313 if (
next.type != cmd.type
4324void QQuickTextInputPrivate::internalRedo()
4358 if (
next.type != cmd.type
4369void QQuickTextInputPrivate::emitUndoRedoChanged()
4372 const bool previousUndo =
canUndo;
4373 const bool previousRedo =
canRedo;
4379 emit q->canUndoChanged();
4381 emit q->canRedoChanged();
4390bool QQuickTextInputPrivate::emitCursorPositionChanged()
4396 q->updateCursorRectangle();
4397 emit q->cursorPositionChanged();
4402 emit q->selectionStartChanged();
4406 emit q->selectionEndChanged();
4410#if QT_CONFIG(accessibility)
4411 if (QAccessible::isActive()) {
4412 if (
QObject *acc = QQuickAccessibleAttached::findAccessible(
q, QAccessible::EditableText)) {
4413 QAccessibleTextCursorEvent ev(acc,
m_cursor);
4414 QAccessible::updateAccessibility(&ev);
4463 if (
event->timerId() ==
d->m_blinkTimer) {
4464 d->m_blinkStatus = !
d->m_blinkStatus;
4468 }
else if (
event->timerId() ==
d->m_passwordEchoTimer.timerId()) {
4469 d->m_passwordEchoTimer.stop();
4470 d->updateDisplayText();
4471 updateCursorRectangle();
4480 if (hasAcceptableInput(
m_text) == AcceptableInput ||
fixup()) {
4488 emit q->editingFinished();
4503 && !
event->text().isEmpty()
4515#if QT_CONFIG(shortcut)
4521#if QT_CONFIG(shortcut)
4531#if QT_CONFIG(clipboard)
4616 deleteStartOfWord();
4620#if QT_CONFIG(clipboard)
4628 bool handled =
false;
4630 switch (
event->key()) {
4633 deleteStartOfWord();
4640 switch (
event->key()) {
4664 && !(
m_cursor == q_func()->text().size())) {
4686void QQuickTextInputPrivate::deleteStartOfWord()
4693 removeSelectedText();
4694 finishChange(priorState);
4703void QQuickTextInputPrivate::deleteEndOfWord()
4712 removeSelectedText();
4713 finishChange(priorState);
4722void QQuickTextInputPrivate::deleteEndOfLine()
4729 removeSelectedText();
4730 finishChange(priorState);
4742void QQuickTextInput::ensureVisible(
int position)
4746 updateCursorRectangle(
false);
4760void QQuickTextInput::clear()
4793 return d->padding();
4802 d->extra.value().padding =
padding;
4804 updateCursorRectangle();
4805 emit paddingChanged();
4806 if (!
d->extra.isAllocated() || !
d->extra->explicitTopPadding)
4807 emit topPaddingChanged();
4808 if (!
d->extra.isAllocated() || !
d->extra->explicitLeftPadding)
4809 emit leftPaddingChanged();
4810 if (!
d->extra.isAllocated() || !
d->extra->explicitRightPadding)
4811 emit rightPaddingChanged();
4812 if (!
d->extra.isAllocated() || !
d->extra->explicitBottomPadding)
4813 emit bottomPaddingChanged();
4824 if (
d->extra.isAllocated() &&
d->extra->explicitTopPadding)
4825 return d->extra->topPadding;
4826 return d->padding();
4838 d->setTopPadding(0,
true);
4844 if (
d->extra.isAllocated() &&
d->extra->explicitLeftPadding)
4845 return d->extra->leftPadding;
4846 return d->padding();
4858 d->setLeftPadding(0,
true);
4864 if (
d->extra.isAllocated() &&
d->extra->explicitRightPadding)
4865 return d->extra->rightPadding;
4866 return d->padding();
4878 d->setRightPadding(0,
true);
4884 if (
d->extra.isAllocated() &&
d->extra->explicitBottomPadding)
4885 return d->extra->bottomPadding;
4886 return d->padding();
4898 d->setBottomPadding(0,
true);
4901#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
4902void QQuickTextInput::setOldSelectionDefault()
4905 d->selectByMouse =
false;
4906 d->selectByTouchDrag =
true;
4907 qCDebug(lcQuickTextInput,
"pre-6.4 behavior chosen: selectByMouse defaults false; if enabled, touchscreen acts like a mouse");
4914 setOldSelectionDefault();
4920#include "moc_qquicktextinput_p.cpp"
void start(int msec, QObject *obj)
\obsolete Use chrono overload instead.
bool isActive() const noexcept
Returns true if the timer is running and has not been stopped; otherwise returns false.
@ ObjectReplacementCharacter
Direction direction() const noexcept
Returns the character's direction.
constexpr char16_t unicode() const noexcept
Returns the numeric Unicode value of the QChar.
constexpr bool isNull() const noexcept
Returns true if the character is the Unicode character 0x0000 ('\0'); otherwise returns false.
The QClipboard class provides access to the window system clipboard.
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
The QColor class provides colors based on RGB, HSV or CMYK values.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
Type type() const
Returns the event type.
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
The QFocusEvent class contains event parameters for widget focus events.
\reentrant \inmodule QtGui
qreal ascent() const
Returns the ascent of the font.
\reentrant \inmodule QtGui
int horizontalAdvance(const QString &, int len=-1) const
Returns the horizontal advance in pixels of the first len characters of text.
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
qsizetype length() const noexcept
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
bool hasText() const
Returns true if the object can return plain text (MIME type text/plain); otherwise returns false.
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
virtual bool event(QEvent *event)
This virtual function receives events to an object and should return true if the event e was recogniz...
\inmodule QtCore\reentrant
constexpr qreal manhattanLength() const
bool isNull() const noexcept
Returns true if both the x and y coordinates are set to 0.0 (ignoring the sign); otherwise returns fa...
\inmodule QtCore\reentrant
The QQmlComponent class encapsulates a QML component definition.
virtual void componentComplete()=0
Invoked after the root component that caused this instantiation has completed construction.
static bool isEventFromMouseOrTouchpad(const QPointerEvent *ev)
QQuickAnchorLine top() const
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
virtual void focusOutEvent(QFocusEvent *)
This event handler can be reimplemented in a subclass to receive focus-out events for an item.
virtual void mouseReleaseEvent(QMouseEvent *event)
This event handler can be reimplemented in a subclass to receive mouse release events for an item.
Flags flags() const
Returns the item flags for this item.
virtual void mouseDoubleClickEvent(QMouseEvent *event)
This event handler can be reimplemented in a subclass to receive mouse double-click events for an ite...
void setFlag(Flag flag, bool enabled=true)
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disable...
virtual void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
virtual void keyPressEvent(QKeyEvent *event)
This event handler can be reimplemented in a subclass to receive key press events for an item.
qreal x
\qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item...
qreal y
Defines the item's y position relative to its parent.
bool hasActiveFocus() const
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
void setKeepMouseGrab(bool)
Sets whether the mouse input should remain exclusively with this item.
Q_INVOKABLE void forceActiveFocus()
\qmlmethod point QtQuick::Item::mapToItem(Item item, real x, real y) \qmlmethod point QtQuick::Item::...
virtual QRectF clipRect() const
Returns the rectangular area within this item that is currently visible in \l viewportItem(),...
virtual void focusInEvent(QFocusEvent *)
This event handler can be reimplemented in a subclass to receive focus-in events for an item.
void update()
Schedules a call to updatePaintNode() for this item.
void polish()
Schedules a polish event for this item.
virtual void mouseMoveEvent(QMouseEvent *event)
This event handler can be reimplemented in a subclass to receive mouse move events for an item.
void updatePasswordEchoEditing(bool editing)
qreal getImplicitWidth() const override
void cancelPasswordEchoTimer()
void setLeftPadding(qreal value, bool reset=false)
bool isImplicitResizeEnabled() const
void setSelection(int start, int length)
void setImplicitResizeEnabled(bool enabled)
qreal calculateImplicitWidthForText(const QString &text) const
void updateCursorBlinking()
QQuickTextInput::WrapMode wrapMode
Qt::LayoutDirection layoutDirection() const
int selectionStart() const
void cursorWordBackward(bool mark)
QChar m_passwordCharacter
void mirrorChange() override
Qt::LayoutDirection textDirection() const
void setLayoutDirection(Qt::LayoutDirection direction)
void setRightPadding(qreal value, bool reset=false)
Qt::CursorMoveStyle cursorMoveStyle() const
void updateHorizontalScroll()
void selectWordAtPos(int)
QBasicTimer m_passwordEchoTimer
QQuickTextInput::VAlignment vAlign
bool m_passwordEchoEditing
bool isRedoAvailable() const
bool isUndoAvailable() const
QRectF anchorRectangle() const
void moveCursor(int pos, bool mark=false)
void setTopPadding(qreal value, bool reset=false)
bool hasSelectedText() const
std::unique_ptr< MaskInputData[]> m_maskData
int prevMaskBlank(int pos)
QLazilyAllocated< ExtraData > extra
QQuickTextInput::HAlignment hAlign
bool determineHorizontalAlignment()
void updateBaselineOffset()
QQuickTextInputPrivate::updateBaselineOffset.
QVector< Command > m_history
void cursorForward(bool mark, int steps)
bool sendMouseEventToInputContext(QMouseEvent *event)
QString selectedText() const
void setBottomPadding(qreal value, bool reset=false)
Qt::LayoutDirection m_layoutDirection
void setBlinkingCursorEnabled(bool enable)
void processKeyEvent(QKeyEvent *ev)
void ensureVisible(int position, int preeditCursor=0, int preeditLength=0)
QInputControl * m_inputControl
QQuickTextInput::RenderType renderType
bool setHAlign(QQuickTextInput::HAlignment, bool forceAlign=false)
int positionAt(qreal x, qreal y, QTextLine::CursorPosition position) const
void insert(const QString &)
void cursorWordForward(bool mark)
QList< int > m_transactions
QQuickTextInput::EchoMode m_echoMode
int nextMaskBlank(int pos)
bool requireImplicitWidth
void updateVerticalScroll()
void handleFocusEvent(QFocusEvent *event)
QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override
Called on the render thread when it is time to sync the state of the item with the scene graph.
QRectF boundingRect() const override
Returns the extents of the item in its own coordinate system: a rectangle from {0,...
bool event(QEvent *e) override
\reimp
void inputMethodComposingChanged()
void passwordCharacterChanged()
void redo()
\qmlmethod QtQuick::TextInput::redo()
void setMaxLength(int ml)
void undo()
\qmlmethod QtQuick::TextInput::undo()
VAlignment vAlign() const
void keyPressEvent(QKeyEvent *ev) override
This event handler can be reimplemented in a subclass to receive key press events for an item.
void selectAll()
\qmlmethod QtQuick::TextInput::selectAll()
void setBottomPadding(qreal padding)
QString preeditText
\qmlproperty string QtQuick::TextInput::preeditText \readonly
void activeFocusOnPressChanged(bool activeFocusOnPress)
void setRenderType(RenderType renderType)
void updatePolish() override
This function should perform any layout as required for this item.
void selectionColorChanged()
void setOverwriteMode(bool overwrite)
Q_INVOKABLE void moveCursorSelection(int pos)
QRectF clipRect() const override
Returns the rectangular area within this item that is currently visible in \l viewportItem(),...
void setPasswordMaskDelay(int delay)
void mouseReleaseEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse release events for an item.
void setRightPadding(qreal padding)
Qt::InputMethodHints inputMethodHints
void setFocusOnPress(bool)
void setWrapMode(WrapMode w)
void fontChanged(const QFont &font)
Q_INVOKABLE void positionAt(QQmlV4Function *args) const
\qmlmethod int QtQuick::TextInput::positionAt(real x, real y, CursorPosition position)
void resetBottomPadding()
void setPersistentSelection(bool persist)
QQuickTextInput(QQuickItem *parent=nullptr)
\qmltype TextInput \instantiates QQuickTextInput \inqmlmodule QtQuick\inherits Item
void setPasswordCharacter(const QString &str)
void focusOutEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-out events for an item.
void setHAlign(HAlignment align)
void readOnlyChanged(bool isReadOnly)
void echoModeChanged(QQuickTextInput::EchoMode echoMode)
void setSelectByMouse(bool)
void setEchoMode(EchoMode echo)
bool focusOnPress() const
\qmlproperty bool QtQuick::TextInput::activeFocusOnPress
int maxLength() const
\qmlproperty int QtQuick::TextInput::maximumLength The maximum permitted length of the text in the Te...
void cursorVisibleChanged(bool isCursorVisible)
void verticalAlignmentChanged(QQuickTextInput::VAlignment alignment)
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
void inputMethodHintsChanged()
void mouseSelectionModeChanged(QQuickTextInput::SelectionMode mode)
void setText(const QString &)
void focusInEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-in events for an item.
void overwriteModeChanged(bool overwriteMode)
void setVAlign(VAlignment align)
bool isReadOnly() const
\qmlproperty bool QtQuick::TextInput::readOnly
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
void setInputMask(const QString &im)
QString passwordCharacter
void setSelectedTextColor(const QColor &c)
void selectedTextColorChanged()
void setSelectionColor(const QColor &c)
Q_INVOKABLE QString getText(int start, int end) const
\qmlmethod string QtQuick::TextInput::getText(int start, int end)
bool hasAcceptableInput() const
\qmlproperty bool QtQuick::TextInput::acceptableInput \readonly
void mousePressEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse press events for an item.
void setColor(const QColor &c)
void insert(int position, const QString &text)
\qmlmethod QtQuick::TextInput::insert(int position, string text)
void autoScrollChanged(bool autoScroll)
void setCursorPosition(int cp)
HAlignment effectiveHAlign() const
void mouseUngrabEvent() override
This event handler can be reimplemented in a subclass to be notified when a mouse ungrab event has oc...
void mouseDoubleClickEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse double-click events for an ite...
void setPadding(qreal padding)
void selectByMouseChanged(bool selectByMouse)
void mouseMoveEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse move events for an item.
void select(int start, int end)
\qmlmethod QtQuick::TextInput::select(int start, int end)
void invalidate() override
bool isCursorVisible() const
\qmlproperty bool QtQuick::TextInput::cursorVisible Set to true when the TextInput shows a cursor.
HAlignment hAlign() const
\qmlproperty enumeration QtQuick::TextInput::effectiveHorizontalAlignment \readonly
bool isRightToLeft(int start, int end)
\qmlmethod QtQuick::TextInput::isRightToLeft(int start, int end)
void setLeftPadding(qreal padding)
void setMouseSelectionMode(SelectionMode mode)
void selectWord()
\qmlmethod QtQuick::TextInput::selectWord()
void inputMaskChanged(const QString &inputMask)
void timerEvent(QTimerEvent *event) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
void setCursorDelegate(QQmlComponent *)
void maximumLengthChanged(int maximumLength)
void remove(int start, int end)
\qmlmethod QtQuick::TextInput::remove(int start, int end)
void resetPasswordMaskDelay()
SelectionMode mouseSelectionMode
void persistentSelectionChanged()
bool isInputMethodComposing() const
\qmlproperty bool QtQuick::TextInput::inputMethodComposing \readonly
void selectionEndChanged()
void setTopPadding(qreal padding)
Q_INVOKABLE QRectF positionToRectangle(int pos) const
\qmlmethod rect QtQuick::TextInput::positionToRectangle(int pos)
void setCursorVisible(bool on)
void selectionStartChanged()
void deselect()
\qmlmethod QtQuick::TextInput::deselect()
QQmlComponent * cursorDelegate
void setFont(const QFont &font)
void setInputMethodHints(Qt::InputMethodHints hints)
void setUseNativeRenderer(bool on)
void setCursor(const QRectF &rect, const QColor &color)
void addTextLayout(const QPointF &position, QTextLayout *textLayout, const QColor &color=QColor(), QQuickText::TextStyle style=QQuickText::Normal, const QColor &styleColor=QColor(), const QColor &anchorColor=QColor(), const QColor &selectionColor=QColor(), const QColor &selectedTextColor=QColor(), int selectionStart=-1, int selectionEnd=-1, int lineStart=0, int lineCount=-1)
static qreal alignedX(qreal textWidth, qreal itemWidth, int alignment)
static void createCursor(Private *d)
static qreal alignedY(qreal textHeight, qreal itemHeight, int alignment)
static void setCursorDelegate(Private *d, QQmlComponent *delegate)
\inmodule QtCore\reentrant
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr qreal top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
constexpr qreal height() const noexcept
Returns the height.
constexpr QStringView left(qsizetype n) const noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
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...
const QChar * constData() const
Returns a pointer to the data stored in the QString.
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.
QString & insert(qsizetype i, QChar c)
QString toLower() const &
QChar * data()
Returns a pointer to the data stored in the QString.
QString & append(QChar c)
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
bool isRightToLeft() const
Returns true if the string is read right to left.
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 &
int startDragDistance
the distance, in pixels, that the mouse must be moved with a button held down before a drag and drop ...
void cursorFlashTimeChanged(int cursorFlashTime)
int cursorFlashTime
the text cursor's flash (blink) time in milliseconds.
BoundaryReasons boundaryReasons() const
Returns the reasons for the boundary finder to have chosen the current position as a boundary.
void setPosition(qsizetype position)
Sets the current position of the QTextBoundaryFinder to position.
qsizetype toNextBoundary()
Moves the QTextBoundaryFinder to the next boundary position and returns that position.
qsizetype toPreviousBoundary()
Moves the QTextBoundaryFinder to the previous boundary position and returns that position.
qsizetype position() const
Returns the current position of the QTextBoundaryFinder.
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 lineForTextPosition(int pos) const
Returns the line that contains the cursor position specified by pos.
void setFont(const QFont &f)
Sets the layout's font to the given font.
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 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.
int lineCount() const
Returns the number of lines in this text layout.
int preeditAreaPosition() const
Returns the position of the area in the text layout that will be processed before editing occurs.
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 endLayout()
Ends the layout process.
QString preeditAreaText() const
Returns the text that is inserted in the layout before editing occurs.
void setPreeditArea(int position, const QString &text)
Sets the position and text of the area in the layout that is processed before editing occurs.
QRectF rect() const
Returns the line's bounding rectangle.
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,...
qreal naturalTextWidth() const
Returns the width of the line that is occupied by text.
qreal y() const
Returns the line's y position.
CursorPosition
\value CursorBetweenCharacters \value CursorOnCharacter
@ CursorBetweenCharacters
bool isValid() const
Returns true if this text line is valid; otherwise returns false.
void setTextDirection(Qt::LayoutDirection aDirection)
Sets the direction of the text layout defined by the option to the given direction.
void setUseDesignMetrics(bool b)
If enable is true then the layout will use design metrics; otherwise it will use the metrics of the p...
WrapMode
This enum describes how text is wrapped in a document.
The QValidator class provides validation of input text.
State
This enum type defines the states in which a validated string can exist.
void textChanged(const QString &newText)
Combined button and popup list for selecting options.
@ ActiveWindowFocusReason
static jboolean copy(JNIEnv *, jobject)
static jboolean paste(JNIEnv *, jobject)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
int qRound(qfloat16 d) noexcept
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
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)
constexpr T qAbs(const T &t)
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLdouble GLdouble GLdouble GLdouble q
#define qmlobject_disconnect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
Disconnect Signal of Sender from Method of Receiver.
#define qmlobject_connect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
Connect Signal of Sender to Method of Receiver.
#define DEFINE_BOOL_CONFIG_OPTION(name, var)
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
void forceUpdate(QQuickItem *item)
static const struct ImageFormatTab unknown[]
QLatin1StringView QLatin1String
#define QT_CONFIG(feature)
#define QT_VERSION_CHECK(major, minor, patch)
static QString escape(const QString &input)
myObject disconnect()
[26]
\inmodule QtCore \reentrant
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent