6#include <android/log.h>
14#include "private/qhighdpiscaling_p.h"
16#include <QTextBoundaryFinder>
17#include <QTextCharFormat>
18#include <QtCore/QJniEnvironment>
19#include <QtCore/QJniObject>
26#include <qpa/qplatformwindow.h>
39 m_context->beginBatchEdit();
44 m_context->endBatchEdit();
73 if (!protector.acquire())
83 qCDebug(lcQpaInputMethods) <<
"@@@ BEGINBATCH";
84 jboolean
res = JNI_FALSE;
94 qCDebug(lcQpaInputMethods) <<
"@@@ ENDBATCH";
96 jboolean
res = JNI_FALSE;
102static jboolean
commitText(JNIEnv *env, jobject , jstring
text, jint newCursorPosition)
108 const jchar *jstr = env->GetStringChars(
text, &isCopy);
110 env->ReleaseStringChars(
text, jstr);
112 qCDebug(lcQpaInputMethods) <<
"@@@ COMMIT" <<
str << newCursorPosition;
113 jboolean
res = JNI_FALSE;
123 qCDebug(lcQpaInputMethods) <<
"@@@ DELETE" << leftLength << rightLength;
124 jboolean
res = JNI_FALSE;
134 qCDebug(lcQpaInputMethods) <<
"@@@ FINISH";
135 jboolean
res = JNI_FALSE;
158 qCDebug(lcQpaInputMethods) <<
"@@@ GETEX" << hintMaxChars << hintMaxLines <<
QString::fromLatin1(
"0x") +
QString::number(
flags,16) << extractedText.text <<
"partOff:" << extractedText.partialStartOffset << extractedText.partialEndOffset <<
"sel:" << extractedText.selectionStart << extractedText.selectionEnd <<
"offset:" << extractedText.startOffset;
166 env->SetObjectField(
object,
168 env->NewString(
reinterpret_cast<const jchar *
>(extractedText.text.constData()),
169 jsize(extractedText.text.length())));
181 qCDebug(lcQpaInputMethods) <<
"@@@ GETSEL" <<
text;
215 const jchar *jstr = env->GetStringChars(
text, &isCopy);
217 env->ReleaseStringChars(
text, jstr);
219 qCDebug(lcQpaInputMethods) <<
"@@@ SET" <<
str << newCursorPosition;
220 jboolean
res = JNI_FALSE;
231 jboolean
res = JNI_FALSE;
243 jboolean
res = JNI_FALSE;
254 qCDebug(lcQpaInputMethods) <<
"@@@ SELALL";
255 jboolean
res = JNI_FALSE;
260static jboolean
cut(JNIEnv *, jobject )
265 qCDebug(lcQpaInputMethods) <<
"@@@";
266 jboolean
res = JNI_FALSE;
271static jboolean
copy(JNIEnv *, jobject )
276 qCDebug(lcQpaInputMethods) <<
"@@@";
277 jboolean
res = JNI_FALSE;
287 qCDebug(lcQpaInputMethods) <<
"@@@";
288 jboolean
res = JNI_FALSE;
293static jboolean
paste(JNIEnv *, jobject )
298 qCDebug(lcQpaInputMethods) <<
"@@@ PASTE";
299 jboolean
res = JNI_FALSE;
309 qCDebug(lcQpaInputMethods) <<
"@@@ UPDATECURSORPOS";
331 {
"commitText",
"(Ljava/lang/String;I)Z", (
void *)
commitText},
335 {
"getExtractedText",
"(III)Lorg/qtproject/qt/android/QtExtractedText;", (
void *)
getExtractedText},
343 {
"cut",
"()Z", (
void *)
cut},
344 {
"copy",
"()Z", (
void *)
copy},
345 {
"copyURL",
"()Z", (
void *)
copyURL},
346 {
"paste",
"()Z", (
void *)
paste},
356 return QRect(
window->mapToGlobal(windowRect.topLeft()), windowRect.size());
361 , m_composingTextStart(-1)
362 , m_composingCursor(-1)
363 , m_handleMode(Hidden)
364 , m_batchEditNestingLevel(0)
366 , m_fullScreenMode(
false)
371 qCritical() <<
"Native registration unable to find class '"
378 qCritical() <<
"RegisterNatives failed for '"
386 qCritical() <<
"Native registration unable to find class '"
401 qCritical(
"Can't find field partialEndOffset");
407 qCritical(
"Can't find field partialStartOffset");
413 qCritical(
"Can't find field selectionEnd");
419 qCritical(
"Can't find field selectionStart");
425 qCritical(
"Can't find field startOffset");
434 qRegisterMetaType<QInputMethodEvent *>(
"QInputMethodEvent*");
435 qRegisterMetaType<QInputMethodQueryEvent *>(
"QInputMethodQueryEvent*");
443 auto im =
qGuiApp->inputMethod();
444 if (!im->inputItemClipRectangle().contains(im->anchorRectangle()) ||
445 !im->inputItemClipRectangle().contains(im->cursorRectangle())) {
446 m_handleMode = Hidden;
447 updateSelectionHandles();
492 focusObjectStopComposing();
494 m_batchEditNestingLevel = 0;
497 QSharedPointer<QInputMethodQueryEvent>
query = focusObjectInputMethodQuery(
Qt::ImEnabled);
508 focusObjectStopComposing();
513 QSharedPointer<QInputMethodQueryEvent>
query = focusObjectInputMethodQuery();
514 if (!
query.isNull() && m_batchEditNestingLevel == 0) {
516 const int composeLength = m_composingText.
length();
519 if (m_composingText.
isEmpty() != (m_composingTextStart == -1))
520 qWarning() <<
"Input method out of sync" << m_composingText << m_composingTextStart;
522 int realSelectionStart = cursorPos;
523 int realSelectionEnd = cursorPos;
527 if (cpos != anchor) {
528 if (!m_composingText.
isEmpty()) {
529 qWarning(
"Selecting text while preediting may give unpredictable results.");
530 focusObjectStopComposing();
533 realSelectionStart = blockPos + cpos;
534 realSelectionEnd = blockPos + anchor;
537 if (focusObjectIsComposing())
538 realSelectionStart = realSelectionEnd = m_composingCursor;
541 if (realSelectionStart > realSelectionEnd)
542 std::swap(realSelectionStart, realSelectionEnd);
545 m_composingTextStart, m_composingTextStart + composeLength);
549bool QAndroidInputContext::isImhNoTextHandlesSet()
551 QSharedPointer<QInputMethodQueryEvent>
query = focusObjectInputMethodQuery();
559 if (m_fullScreenMode) {
564 if (noHandles || !m_focusObject)
567 if (isImhNoTextHandlesSet()) {
572 auto im =
qGuiApp->inputMethod();
582 bool readOnly = readOnlyVariant.toBool();
585 if (!readOnly && ((m_handleMode & 0xff) ==
Hidden)) {
590 if ( cpos == anchor && (!readOnlyVariant.isValid() || readOnly)) {
595 if (cpos == anchor || im->anchorRectangle().isNull()) {
597 QPoint cursorPointGlobal = qPlatformWindow->mapToGlobal(
598 QPoint(curRect.x() + (curRect.width() / 2), curRect.y() + curRect.height()));
599 QPoint cursorPoint(curRect.center().x(), curRect.bottom());
604 if (cursorPointGlobal != cursorPoint) {
605 x = cursorPointGlobal.x();
606 y = cursorPointGlobal.y();
616 m_hideCursorHandleTimer.
start();
625 std::swap(leftRect, rightRect);
629 QPoint leftPoint(qPlatformWindow->mapToGlobal(leftRect.bottomLeft().toPoint()));
630 QPoint rightPoint(qPlatformWindow->mapToGlobal(rightRect.bottomRight().toPoint()));
633 if (platformIntegration) {
644 QPoint editPoint(qPlatformWindow->mapToGlobal(leftRect.united(rightRect).topLeft().toPoint()));
650 m_hideCursorHandleTimer.
stop();
661 if (m_batchEditNestingLevel != 0) {
662 qWarning() <<
"QAndroidInputContext::handleLocationChanged returned";
676 std::swap(leftRect, rightRect);
679 if (handleId == 2 && point.
y() > rightRect.center().y()) {
680 point.
setY(rightRect.center().y());
681 }
else if (handleId == 3 && point.
y() < leftRect.center().y()) {
682 point.
setY(leftRect.center().y());
686 auto object = m_focusObject->
parent();
693 object =
object->parent();
707 int newAnchor = anchor;
708 if (newAnchor > newCpos)
709 std::swap(newAnchor, newCpos);
713 newAnchor = handlePos;
714 }
else if (handleId == 2) {
715 newAnchor = handlePos;
716 }
else if (handleId == 3) {
725 if ((handleId == 2 || handleId == 3) && newCpos <= newAnchor) {
729 const int oldSelectionStartPos =
qMin(cpos, anchor);
733 finder.toPreviousBoundary();
734 newAnchor = finder.position() + oldSelectionStartPos;
737 finder.toNextBoundary();
738 newCpos = finder.position() + oldSelectionStartPos;
743 if (!focusObjectIsComposing() && newCpos == cpos && newAnchor == anchor)
751 if (focusObjectIsComposing() && handleId == 1) {
755 const int blockPos = absoluteCpos - cpos;
757 if (blockPos + newCpos == m_composingCursor)
761 BatchEditLock batchEditLock(
this);
763 focusObjectStopComposing();
765 QList<QInputMethodEvent::Attribute> attributes;
767 if (newCpos != newAnchor)
780 m_hideCursorHandleTimer.
stop();
782 if (focusObjectIsComposing()) {
785 const int touchPosition = curBlockPos
787 if (touchPosition != m_composingCursor)
788 focusObjectStopComposing();
794 const QPoint cursorGlobalPoint =
window->mapToGlobal(
QPoint(curRect.x(), curRect.y()));
796 const QRect windowGlobalRect =
QRect(
window->mapToGlobal(windowRect.topLeft()), windowRect.size());
798 if (windowGlobalRect.contains(cursorGlobalPoint.x(), cursorGlobalPoint.y()))
810 BatchEditLock batchEditLock(
this);
812 focusObjectStopComposing();
822 for (
const auto &
ch : after) {
823 if (!
ch.isLetterOrNumber())
828 for (
auto itch = before.
rbegin(); itch != after.rend(); ++itch) {
829 if (!itch->isLetterOrNumber())
833 if (
cursor == anchor || cursor < 0 || cursor - anchor > 500) {
838 QList<QInputMethodEvent::Attribute> imAttributes;
864 m_hideCursorHandleTimer.
start();
870 QSharedPointer<QInputMethodQueryEvent>
query = focusObjectInputMethodQuery(queries);
873#warning TODO extract the needed data from query
878#warning TODO Handle at least QInputMethod::ContextMenu action
902 QSharedPointer<QInputMethodQueryEvent>
query = focusObjectInputMethodQuery();
906 if (!
qGuiApp->focusWindow()->handle())
910 m_updateCursorPosConnection = {};
912 if (
qGuiApp->focusObject()->metaObject()->indexOfSignal(
"cursorPositionChanged(int,int)") >= 0)
914 else if (
qGuiApp->focusObject()->metaObject()->indexOfSignal(
"cursorPositionChanged()") >= 0)
951 return m_composingText.
length();
956 m_composingText.
clear();
957 m_composingTextStart = -1;
958 m_composingCursor = -1;
959 m_extractedText.
clear();
965 if (
object != m_focusObject) {
966 focusObjectStopComposing();
975 ++m_batchEditNestingLevel;
981 if (--m_batchEditNestingLevel == 0) {
982 focusObjectStartComposing();
994 BatchEditLock batchEditLock(
this);
1000 BatchEditLock batchEditLock(
this);
1002 focusObjectStopComposing();
1004 QSharedPointer<QInputMethodQueryEvent>
query = focusObjectInputMethodQuery();
1008 if (leftLength < 0) {
1009 rightLength += -leftLength;
1028 ?
qMin(initialCursorPos, initialAnchorPos)
1029 :
qMin(
qMin(initialCursorPos, initialAnchorPos), m_composingTextStart);
1031 const int rightBegin =
1033 ?
qMax(initialCursorPos, initialAnchorPos)
1034 :
qMax(
qMax(initialCursorPos, initialAnchorPos),
1035 m_composingTextStart + m_composingText.
length());
1037 int textBeforeCursorLen;
1038 int textAfterCursorLen;
1046 textBeforeCursorLen = initialCursorPos - initialBlockPos;
1047 textAfterCursorLen =
1051 leftLength =
qMin(
qMax(0, textBeforeCursorLen - (initialCursorPos - leftEnd)), leftLength);
1052 rightLength =
qMin(
qMax(0, textAfterCursorLen - (rightBegin - initialCursorPos)), rightLength);
1054 if (leftLength == 0 && rightLength == 0)
1057 if (leftEnd == rightBegin) {
1060 event.setCommitString({}, -leftLength, leftLength + rightLength);
1063 if (initialCursorPos != initialAnchorPos) {
1071 int currentCursorPos = initialCursorPos;
1073 if (rightLength > 0) {
1075 event.setCommitString({}, rightBegin - currentCursorPos, rightLength);
1078 currentCursorPos = rightBegin;
1081 if (leftLength > 0) {
1082 const int leftBegin = leftEnd - leftLength;
1085 event.setCommitString({}, leftBegin - currentCursorPos, leftLength);
1088 currentCursorPos = leftBegin;
1090 if (!m_composingText.
isEmpty())
1091 m_composingTextStart -= leftLength;
1095 if (currentCursorPos != initialCursorPos - leftLength
1096 || initialCursorPos != initialAnchorPos) {
1103 initialAnchorPos - initialCursorPos },
1117 BatchEditLock batchEditLock(
this);
1119 if (!focusObjectStopComposing())
1129 BatchEditLock batchEditLock(
this);
1130 if (!focusObjectStopComposing())
1142 return m_fullScreenMode;
1145bool QAndroidInputContext::focusObjectIsComposing()
const
1147 return m_composingCursor != -1;
1150void QAndroidInputContext::focusObjectStartComposing()
1152 if (focusObjectIsComposing() || m_composingText.
isEmpty())
1156 if (m_composingText.
contains(u
'\n'))
1159 QSharedPointer<QInputMethodQueryEvent>
query = focusObjectInputMethodQuery();
1167 if (absoluteCursorPos < m_composingTextStart
1168 || absoluteCursorPos > m_composingTextStart + m_composingText.
length())
1171 m_composingCursor = absoluteCursorPos;
1181 event.setCommitString({}, m_composingTextStart - absoluteCursorPos, m_composingText.
length());
1186bool QAndroidInputContext::focusObjectStopComposing()
1188 if (!focusObjectIsComposing())
1191 QSharedPointer<QInputMethodQueryEvent>
query = focusObjectInputMethodQuery();
1196 const int localCursorPos = m_composingCursor - blockPos;
1198 m_composingCursor = -1;
1202 QList<QInputMethodEvent::Attribute> attributes;
1204 event.setCommitString(m_composingText);
1205 sendInputMethodEvent(&
event);
1209 QList<QInputMethodEvent::Attribute> attributes;
1213 sendInputMethodEvent(&
event);
1222 QSharedPointer<QInputMethodQueryEvent>
query = focusObjectInputMethodQuery();
1229 bool atWordBoundary =
1231 && (!focusObjectIsComposing() || m_composingCursor == m_composingTextStart);
1233 if (!atWordBoundary) {
1235 surroundingText.
truncate(localPos);
1236 if (focusObjectIsComposing())
1237 surroundingText +=
QStringView{m_composingText}.
left(m_composingCursor - m_composingTextStart);
1240 finder.setPosition(surroundingText.
length());
1241 if (finder.isAtBoundary())
1242 atWordBoundary = finder.isAtBoundary();
1245 res |= CAP_MODE_SENTENCES;
1248 res |= CAP_MODE_CHARACTERS;
1261 QSharedPointer<QInputMethodQueryEvent>
query = focusObjectInputMethodQuery(
1264 return m_extractedText;
1277 if (focusObjectIsComposing()) {
1278 m_extractedText.
text =
1279 textBeforeCursor.
toString() + m_composingText + textAfterCursor.
toString();
1289 if (focusObjectIsComposing())
1290 m_extractedText.
text.
insert(cursorPos - blockPos, m_composingText);
1295 if (focusObjectIsComposing()) {
1308 return m_extractedText;
1313 QSharedPointer<QInputMethodQueryEvent>
query = focusObjectInputMethodQuery();
1328 if (reportedTextAfter.isValid()) {
1329 text = reportedTextAfter.toString();
1332 QSharedPointer<QInputMethodQueryEvent>
query =
1340 if (focusObjectIsComposing()) {
1342 const int cursorPosInsidePreedit = m_composingCursor - m_composingTextStart;
1346 QSharedPointer<QInputMethodQueryEvent>
query =
1351 if (anchorPos > cursorPos)
1368 if (reportedTextBefore.isValid()) {
1369 text = reportedTextBefore.toString();
1372 QSharedPointer<QInputMethodQueryEvent>
query =
1380 if (focusObjectIsComposing()) {
1382 const int cursorPosInsidePreedit = m_composingCursor - m_composingTextStart;
1386 QSharedPointer<QInputMethodQueryEvent>
query =
1391 if (anchorPos < cursorPos)
1413 QSharedPointer<QInputMethodQueryEvent>
query = focusObjectInputMethodQuery();
1417 BatchEditLock batchEditLock(
this);
1422 auto setCursorPosition = [=]() {
1430 if (!m_composingText.
isEmpty() && absoluteCursorPos != absoluteAnchorPos) {
1431 setCursorPosition();
1432 absoluteAnchorPos = absoluteCursorPos;
1438 setCursorPosition();
1444 const int effectiveAbsoluteCursorPos =
qMin(absoluteCursorPos, absoluteAnchorPos);
1445 if (m_composingTextStart == -1)
1446 m_composingTextStart = effectiveAbsoluteCursorPos;
1448 const int oldComposingTextLen = m_composingText.
length();
1449 m_composingText =
text;
1451 const int newAbsoluteCursorPos =
1452 newCursorPosition <= 0
1453 ? m_composingTextStart + newCursorPosition
1454 : m_composingTextStart + m_composingText.
length() + newCursorPosition - 1;
1456 const bool focusObjectWasComposing = focusObjectIsComposing();
1460 && newAbsoluteCursorPos >= m_composingTextStart
1461 && newAbsoluteCursorPos <= m_composingTextStart + m_composingText.
length())
1462 m_composingCursor = newAbsoluteCursorPos;
1464 m_composingCursor = -1;
1466 if (focusObjectIsComposing()) {
1475 if (oldComposingTextLen > 0 && !focusObjectWasComposing) {
1476 event.setCommitString({}, m_composingTextStart - effectiveAbsoluteCursorPos,
1477 oldComposingTextLen);
1479 if (m_composingText.
isEmpty())
1486 if (focusObjectWasComposing) {
1487 event.setCommitString(m_composingText);
1489 event.setCommitString(m_composingText,
1490 m_composingTextStart - effectiveAbsoluteCursorPos,
1491 oldComposingTextLen);
1493 if (m_composingText.
isEmpty())
1499 if (!focusObjectIsComposing() && newCursorPosition != 1) {
1524 BatchEditLock batchEditLock(
this);
1533 QSharedPointer<QInputMethodQueryEvent>
query = focusObjectInputMethodQuery();
1545 if (start < textOffset || end > textOffset +
text.
length()) {
1550 const int additionalSuffixLen = after.
length() - (
text.
length() - cursorPos);
1552 if (additionalSuffixLen > 0)
1556 if (
start < textOffset) {
1558 before.
chop(cursorPos);
1562 textOffset -= before.
length();
1566 if (start < textOffset || end - textOffset >
text.
length()) {
1567 qCDebug(lcQpaInputMethods) <<
"Warning: setComposingRegion: failed to retrieve text from composing region";
1574 m_composingTextStart =
start;
1581 QSharedPointer<QInputMethodQueryEvent>
query = focusObjectInputMethodQuery();
1585 BatchEditLock batchEditLock(
this);
1588 int localCursorPos =
start - blockPosition;
1590 if (focusObjectIsComposing() &&
start ==
end &&
start >= m_composingTextStart
1591 &&
start <= m_composingTextStart + m_composingText.
length()) {
1595 int pos = localCursorPos - localOldPos;
1596 QList<QInputMethodEvent::Attribute> attributes;
1606 m_composingCursor =
start;
1612 focusObjectStopComposing();
1613 QList<QInputMethodEvent::Attribute> attributes;
1625 BatchEditLock batchEditLock(
this);
1627 focusObjectStopComposing();
1635 BatchEditLock batchEditLock(
this);
1648 BatchEditLock batchEditLock(
this);
1650 focusObjectStopComposing();
1664 BatchEditLock batchEditLock(
this);
1676 for (
int i = 0;
i < sequence.
count(); ++
i) {
1689QSharedPointer<QInputMethodQueryEvent> QAndroidInputContext::focusObjectInputMethodQuery(Qt::InputMethodQueries queries) {
1699 return QSharedPointer<QInputMethodQueryEvent>(
ret);
static JNINativeMethod methods[]
jboolean beginBatchEdit()
jboolean setSelection(jint start, jint end)
void touchDown(int x, int y)
void safeCall(const std::function< void()> &func, Qt::ConnectionType conType=Qt::BlockingQueuedConnection)
void longPress(int x, int y)
jboolean finishComposingText()
jint getCursorCapsMode(jint reqModes)
QString getSelectedText(jint flags)
bool isAnimating() const override
This function can be reimplemented to return true whenever input method is animating shown or hidden.
void hideSelectionHandles()
QString getTextAfterCursor(jint length, jint flags)
void reportFullscreenMode(jboolean enabled)
QRectF keyboardRect() const override
This function can be reimplemented to return virtual keyboard rectangle in currently active window co...
void reset() override
Method to be called when input method needs to be reset.
jboolean setComposingText(const QString &text, jint newCursorPosition)
void hideInputPanel() override
Request to hide input panel.
void setFocusObject(QObject *object) override
This virtual method gets called to notify updated focus to object.
jboolean commitText(const QString &text, jint newCursorPosition)
jboolean setComposingRegion(jint start, jint end)
static QAndroidInputContext * androidInputContext()
void updateSelectionHandles()
void update(Qt::InputMethodQueries queries) override
Notification on editor updates.
QString getTextBeforeCursor(jint length, jint flags)
void sendShortcut(const QKeySequence &)
void invokeAction(QInputMethod::Action action, int cursorPosition) override
Called when the word currently being composed in the input item is tapped by the user.
void updateCursorPosition()
jboolean deleteSurroundingText(jint leftLength, jint rightLength)
void handleLocationChanged(int handleId, int x, int y)
void showInputPanel() override
Request to show input panel.
const ExtractedText & getExtractedText(jint hintMaxChars, jint hintMaxLines, jint flags)
bool isInputPanelVisible() const override
Returns input panel visibility status.
jboolean fullscreenMode()
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static Qt::ApplicationState applicationState()
static QWindow * focusWindow()
Returns the QWindow that receives events tied to focus, such as key events.
static QInputMethod * inputMethod()
returns the input method.
The QKeyEvent class describes a key event.
The QKeySequence class encapsulates a key sequence as used by shortcuts.
int count() const
Returns the number of keys in the key sequence.
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
QVariant property(const char *name) const
Returns the value of the object's name property.
The QPlatformInputContext class abstracts the input method dependent data and composing state.
static QRectF anchorRectangle()
QPlatformInputContext::anchorRectangle.
static void setSelectionOnFocusObject(const QPointF &anchorPos, const QPointF &cursorPos)
QPlatformInputContext::setSelectionOnFocusObject.
static QVariant queryFocusObject(Qt::InputMethodQuery query, QPointF position)
QPlatformInputContext::queryFocusObject.
static QRectF inputItemClipRectangle()
QPlatformInputContext::inputItemClipRectangle.
static QRectF cursorRectangle()
QPlatformInputContext::cursorRectangle.
static QRectF inputItemRectangle()
QPlatformInputContext::inputItemRectangle.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr void setY(int y) noexcept
Sets the y coordinate of this point to the given y coordinate.
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
constexpr QStringView right(qsizetype n) const noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString left(qsizetype n) const &
void chop(qsizetype n)
Removes n characters from the end of the string.
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void truncate(qsizetype pos)
Truncates the string at the given position index.
QString mid(qsizetype position, qsizetype n=-1) const &
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
void clear()
Clears the contents of the string and makes it null.
const QChar * constData() const
Returns a pointer to the data stored in the QString.
QString right(qsizetype n) const &
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QString & insert(qsizetype i, QChar c)
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString & remove(qsizetype i, qsizetype len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
reverse_iterator rbegin()
qsizetype length() const noexcept
Returns the number of characters in this string.
BatchEditLock(const BatchEditLock &)=delete
BatchEditLock(QAndroidInputContext *context)
BatchEditLock & operator=(const BatchEditLock &)=delete
void setFontUnderline(bool underline)
If underline is true, sets the text format's font to be underlined; otherwise it is displayed non-und...
static QThread * currentThread()
void setSingleShot(bool singleShot)
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
void setInterval(int msec)
void stop()
Stops the timer.
void timeout(QPrivateSignal)
This signal is emitted when the timer times out.
void setTimerType(Qt::TimerType atype)
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
T fromNativePixels(const T &value, const C *context)
Combined button and popup list for selecting options.
QAndroidPlatformIntegration * androidPlatformIntegration()
@ BlockingQueuedConnection
static int getBlockPosition(const QSharedPointer< QInputMethodQueryEvent > &query)
static char const *const QtExtractedTextClassName
static jboolean cut(JNIEnv *, jobject)
static jint getCursorCapsMode(JNIEnv *, jobject, jint reqModes)
static QAndroidInputContext * m_androidInputContext
static jboolean fullscreenMode(JNIEnv *, jobject)
static JNINativeMethod methods[]
static QRect screenInputItemRectangle()
static jboolean finishComposingText(JNIEnv *, jobject)
static jobject getExtractedText(JNIEnv *env, jobject, int hintMaxChars, int hintMaxLines, jint flags)
static char const *const QtNativeInputConnectionClassName
static jfieldID m_partialStartOffsetFieldID
static jboolean copy(JNIEnv *, jobject)
static jstring getTextBeforeCursor(JNIEnv *env, jobject, jint length, jint flags)
static jfieldID m_selectionEndFieldID
static jboolean copyURL(JNIEnv *, jobject)
static jmethodID m_classConstructorMethodID
static jfieldID m_startOffsetFieldID
static void runOnQtThread(const std::function< void()> &func)
static jboolean commitText(JNIEnv *env, jobject, jstring text, jint newCursorPosition)
static jfieldID m_partialEndOffsetFieldID
static jboolean paste(JNIEnv *, jobject)
static jboolean beginBatchEdit(JNIEnv *, jobject)
static jstring getSelectedText(JNIEnv *env, jobject, jint flags)
static jboolean setComposingRegion(JNIEnv *, jobject, jint start, jint end)
static jfieldID m_textFieldID
static jboolean deleteSurroundingText(JNIEnv *, jobject, jint leftLength, jint rightLength)
static jboolean setComposingText(JNIEnv *env, jobject, jstring text, jint newCursorPosition)
static jboolean updateCursorPosition(JNIEnv *, jobject)
static int m_selectHandleWidth
static jstring getTextAfterCursor(JNIEnv *env, jobject, jint length, jint flags)
static int getAbsoluteCursorPosition(const QSharedPointer< QInputMethodQueryEvent > &query)
static void reportFullscreenMode(JNIEnv *, jobject, jboolean enabled)
static jboolean endBatchEdit(JNIEnv *, jobject)
static jclass m_extractedTextClass
static jfieldID m_selectionStartFieldID
static jboolean setSelection(JNIEnv *, jobject, jint start, jint end)
static jboolean selectAll(JNIEnv *, jobject)
#define qCDebug(category,...)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
#define Q_ARG(Type, data)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLint GLint GLint GLint GLint x
[0]
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei const GLuint GLboolean enabled
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
QT_BEGIN_NAMESPACE constexpr void qSwap(T &value1, T &value2) noexcept(std::is_nothrow_swappable_v< T >)
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
myObject disconnect()
[26]