4#ifndef QQUICKTEXTINPUT_P_P_H
5#define QQUICKTEXTINPUT_P_P_H
12#include <QtQml/qqml.h>
13#include <QtCore/qelapsedtimer.h>
14#include <QtCore/qpointer.h>
15#include <QtCore/qbasictimer.h>
16#include <QtGui/qclipboard.h>
17#include <QtGui/qguiapplication.h>
18#include <QtGui/qpalette.h>
19#include <QtGui/qtextlayout.h>
20#include <QtGui/qstylehints.h>
21#include <private/qlazilyallocated_p.h>
23#include "qplatformdefs.h"
72 , selectionColor(
QRgb(0xFF000080))
73 , selectedTextColor(
QRgb(0xFFFFFFFF))
77 , m_undoPreeditState(-1)
79 , m_blinkEnabled(
false)
87 , inputMethodHints(
Qt::ImhNone)
94 , updateType(UpdatePaintNode)
96 , m_layoutDirection(
Qt::LayoutDirectionAuto)
97 , m_passwordCharacter(
QGuiApplication::styleHints()->passwordMaskCharacter())
98 , m_passwordMaskDelay(
QGuiApplication::styleHints()->passwordMaskDelay())
100 , cursorVisible(
false)
101 , cursorPending(
false)
103 , selectByMouse(true)
105 , canPasteValid(
false)
108 , hAlignImplicit(true)
109 , selectPressed(
false)
110 , textLayoutDirty(true)
111 , persistentSelection(
false)
121 , m_acceptableInput(1)
123 , m_passwordEchoEditing(
false)
125 , requireImplicitWidth(
false)
126 , overwriteMode(
false)
128 , selectByTouchDrag(
false)
145 void ensureVisible(
int position,
int preeditCursor = 0,
int preeditLength = 0);
146 void updateHorizontalScroll();
147 void updateVerticalScroll();
148 bool determineHorizontalAlignment();
153 Qt::InputMethodHints effectiveInputMethodHints()
const;
165 enum CommandType { Separator, Insert, Remove, Delete, RemoveSelection, DeleteSelection, SetSelection };
171 int pos, selStart, selEnd;
176 DrawSelections = 0x02,
178 DrawAll = DrawText | DrawSelections | DrawCursor
187#if QT_CONFIG(validator)
219 int m_undoPreeditState;
236 Qt::InputMethodHints inputMethodHints;
269 bool m_preeditDirty : 1;
279#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
280 bool selectByTouchDrag:1;
291 updateCursorBlinking();
296 int c = findInMask(
pos,
true,
false);
297 m_separator |= (
c !=
pos);
298 return (
c != -1 ?
c : m_maxLength);
303 int c = findInMask(
pos,
false,
false);
304 m_separator |= (
c !=
pos);
305 return (
c != -1 ?
c : 0);
314 m_undoPreeditState = -1;
330 QRectF anchorRectangle()
const;
339 int priorState = m_undoState;
340 removeSelectedText();
341 finishChange(priorState);
349#if QT_CONFIG(clipboard)
355 void commitPreedit();
356 void cancelPreedit();
362 void moveCursor(
int pos,
bool mark =
false);
370 }
else if (steps < 0) {
381 void home(
bool mark) { moveCursor(0, mark); }
382 void end(
bool mark) { moveCursor(q_func()->
text().
size(), mark); }
386 void deselect() { internalDeselect(); finishChange(); }
387 void selectAll() { m_selstart = m_selend = m_cursor = 0; moveCursor(m_text.
size(),
true); }
391 void selectWordAtPos(
int);
400 parseInputMask(
mask);
402 moveCursor(nextMaskBlank(0));
412 void updatePasswordEchoEditing(
bool editing);
415 m_passwordEchoTimer.
stop();
433 void setBlinkingCursorEnabled(
bool enable);
434 void updateCursorBlinking();
437 void updateBaselineOffset();
448 bool isImplicitResizeEnabled()
const;
449 void setImplicitResizeEnabled(
bool enabled);
452 void removeSelectedText();
453 void internalSetText(
const QString &
txt,
int pos = -1,
bool edited =
true);
456 void internalInsert(
const QString &
s);
457 void internalDelete(
bool wasBackspace =
false);
458 void internalRemove(
int pos);
460 inline void internalDeselect()
462 m_selDirty |= (m_selend > m_selstart);
463 m_selstart = m_selend = 0;
466 void internalUndo(
int until = -1);
468 void emitUndoRedoChanged();
470 bool emitCursorPositionChanged();
472 bool finishChange(
int validateFromState = -1,
bool update =
false,
bool edited =
true);
474 void addCommand(
const Command& cmd);
476 inline void separate() { m_separator =
true; }
478 bool separateSelection();
479 void deleteStartOfWord();
480 void deleteEndOfWord();
481 void deleteEndOfLine();
483 enum ValidatorState {
484#if QT_CONFIG(validator)
496 void parseInputMask(
const QString &maskFields);
498 ValidatorState hasAcceptableInput(
const QString &
text)
const;
503 int findInMask(
int pos,
bool forward,
bool findSeparator,
QChar searchChar =
QChar())
const;
void stop()
Stops the timer.
Mode
\keyword clipboard mode
The QColor class provides colors based on RGB, HSV or CMYK values.
bool hasExpired(qint64 timeout) const noexcept
Returns true if this QElapsedTimer has already expired by timeout milliseconds (that is,...
The QFocusEvent class contains event parameters for widget focus events.
static QStyleHints * styleHints()
Returns the application's style hints.
The QKeyEvent class describes a key event.
qsizetype size() const noexcept
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
void init(QQuickItem *parent)
virtual void mirrorChange()
virtual qreal getImplicitWidth() const
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
void setInputMask(const QString &mask)
QQuickTextInput::SelectionMode mouseSelectionMode
void cancelPasswordEchoTimer()
void setCursorPosition(int pos)
void startCreatingCursor()
QString inputMask() const
void setNativeCursorEnabled(bool)
QQuickTextInput::WrapMode wrapMode
QString textBeforeSelection() const
int selectionStart() const
void cursorWordBackward(bool mark)
QChar m_passwordCharacter
void setCursorMoveStyle(Qt::CursorMoveStyle style)
void setLayoutDirection(Qt::LayoutDirection direction)
static QQuickTextInputPrivate * get(QQuickTextInput *t)
Qt::CursorMoveStyle cursorMoveStyle() const
QBasicTimer m_passwordEchoTimer
QQuickTextInput::VAlignment vAlign
bool hasPendingTripleClick() const
bool m_passwordEchoEditing
bool isRedoAvailable() const
bool isUndoAvailable() const
bool hasSelectedText() const
std::unique_ptr< MaskInputData[]> m_maskData
int prevMaskBlank(int pos)
QQuickTextNode * textNode
QLazilyAllocated< ExtraData > extra
QQuickTextInput::HAlignment hAlign
QElapsedTimer tripleClickTimer
QVector< Command > m_history
int positionAt(const QPointF &point, QTextLine::CursorPosition position=QTextLine::CursorBetweenCharacters) const
void cursorForward(bool mark, int steps)
QString selectedText() const
QPointF tripleClickStartPoint
Qt::LayoutDirection m_layoutDirection
QInputControl * m_inputControl
QQuickTextInput::RenderType renderType
void cursorWordForward(bool mark)
QList< int > m_transactions
QPointer< QQmlComponent > cursorComponent
~QQuickTextInputPrivate()
QQuickTextInput::EchoMode m_echoMode
int nextMaskBlank(int pos)
bool requireImplicitWidth
QString textAfterSelection() const
\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.
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.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
int rightCursorPosition(int oldPos) const
Returns the cursor position to the right of oldPos, next to it.
int previousCursorPosition(int oldPos, CursorMode mode=SkipCharacters) const
Returns the first valid cursor position before oldPos that respects the given cursor mode.
int nextCursorPosition(int oldPos, CursorMode mode=SkipCharacters) const
Returns the next valid cursor position after oldPos that respects the given cursor mode.
Qt::CursorMoveStyle cursorMoveStyle() const
The cursor movement style of this QTextLayout.
QString preeditAreaText() const
Returns the text that is inserted in the layout before editing occurs.
void setCursorMoveStyle(Qt::CursorMoveStyle style)
Sets the visual cursor movement style to the given style.
int leftCursorPosition(int oldPos) const
Returns the cursor position to the left of oldPos, next to it.
CursorPosition
\value CursorBetweenCharacters \value CursorOnCharacter
@ CursorBetweenCharacters
cache insert(employee->id(), employee)
Combined button and popup list for selecting options.
static jboolean copy(JNIEnv *, jobject)
static jboolean paste(JNIEnv *, jobject)
static jboolean setSelection(JNIEnv *, jobject, jint start, jint end)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr const T & qMax(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static qreal positionAt(const QQuickRangeSlider *slider, QQuickItem *handle, const QPointF &point)
void forceUpdate(QQuickItem *item)
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
#define QT_CONFIG(feature)
#define QT_VERSION_CHECK(major, minor, patch)
if(qFloatDistance(a, b)<(1<< 7))
[0]
\inmodule QtCore \reentrant
Command(CommandType t, int p, QChar c, int ss, int se)