cursor.setVisualNavigation(true);
const bool moved = cursor.movePosition(op, mode);
cursor.setVisualNavigation(visualNavigation);
- q->ensureCursorVisible();
bool isNavigationEvent
= e->key() == Qt::Key_Up
if (moved) {
if (cursor.position() != oldCursorPos)
emit q->cursorPositionChanged();
- emit q->microFocusChanged();
+ emit q->cursorRectangleChanged();
} else if (isNavigationEvent && oldSelection.anchor() == cursor.anchor()) {
return false;
}
lastCharFormat = fmt;
emit q->currentCharFormatChanged(fmt);
- emit q->microFocusChanged();
+ emit q->cursorRectangleChanged();
}
void QQuickTextControlPrivate::init(Qt::TextFormat format, const QString &text, QTextDocument *document)
if (!document)
doc->setModified(false);
- q->ensureCursorVisible();
+ emit q->cursorRectangleChanged();
emit q->cursorPositionChanged();
}
emit q->copyAvailable(current);
if (!forceEmitSelectionChanged)
emit q->selectionChanged();
- emit q->microFocusChanged();
+ emit q->cursorRectangleChanged();
}
void QQuickTextControlPrivate::_q_updateCurrentCharFormatAndSelection()
Q_Q(QQuickTextControl);
if (someCursor.isCopyOf(cursor)) {
emit q->cursorPositionChanged();
- emit q->microFocusChanged();
+ emit q->cursorRectangleChanged();
}
}
d->doc->undo(&d->cursor);
if (d->cursor.position() != oldCursorPos)
emit cursorPositionChanged();
- emit microFocusChanged();
- ensureCursorVisible();
+ emit cursorRectangleChanged();
}
void QQuickTextControl::redo()
d->doc->redo(&d->cursor);
if (d->cursor.position() != oldCursorPos)
emit cursorPositionChanged();
- emit microFocusChanged();
- ensureCursorVisible();
+ emit cursorRectangleChanged();
}
QQuickTextControl::QQuickTextControl(QTextDocument *doc, QObject *parent)
d->cursor = cursor;
d->cursorOn = d->hasFocus && (d->interactionFlags & Qt::TextEditable);
d->_q_updateCurrentCharFormatAndSelection();
- ensureCursorVisible();
+ emit cursorRectangleChanged();
d->repaintOldAndNewSelection(oldSelection);
if (posChanged)
emit cursorPositionChanged();
e->accept();
cursorOn = true;
- q->ensureCursorVisible();
+ emit q->cursorRectangleChanged();
updateCurrentCharFormat();
}
}
if (interactionFlags & Qt::TextEditable) {
- q->ensureCursorVisible();
+ emit q->cursorRectangleChanged();
if (cursor.position() != oldCursorPos)
emit q->cursorPositionChanged();
_q_updateCurrentCharFormatAndSelection();
} else {
if (cursor.position() != oldCursorPos) {
emit q->cursorPositionChanged();
- emit q->microFocusChanged();
+ emit q->cursorRectangleChanged();
}
selectionChanged();
}
_q_updateCurrentCharFormatAndSelection();
if (qGuiApp)
qGuiApp->inputPanel()->update(Qt::ImQueryInput);
- } else {
- if (cursor.position() != oldCursorPos) {
- emit q->cursorPositionChanged();
- emit q->microFocusChanged();
- }
+ } else if (cursor.position() != oldCursorPos) {
+ emit q->cursorPositionChanged();
}
selectionChanged(true);
repaintOldAndNewSelection(oldSelection);
if (cursor.position() != oldCursorPos) {
emit q->cursorPositionChanged();
- emit q->microFocusChanged();
+ emit q->cursorRectangleChanged();
}
if (interactionFlags & Qt::LinksAccessibleByMouse) {
int blockStart = a.start + cursor.block().position();
cursor.setPosition(blockStart, QTextCursor::MoveAnchor);
cursor.setPosition(blockStart + a.length, QTextCursor::KeepAnchor);
- q->ensureCursorVisible();
+ emit q->cursorRectangleChanged();
repaintOldAndNewSelection(oldCursor);
forceSelectionChanged = true;
}
if (cursor_d)
cursor_d->setX();
if (oldPreeditCursor != preeditCursor)
- emit q->microFocusChanged();
+ emit q->cursorRectangleChanged();
selectionChanged(forceSelectionChanged);
}
const QTextCursor oldSelection = d->cursor;
const bool moved = d->cursor.movePosition(op, mode);
d->_q_updateCurrentCharFormatAndSelection();
- ensureCursorVisible();
+ emit cursorRectangleChanged();
d->repaintOldAndNewSelection(oldSelection);
if (moved)
emit cursorPositionChanged();
if (hasData)
d->cursor.insertFragment(fragment);
- ensureCursorVisible();
+ emit cursorRectangleChanged();
}
void QQuickTextControlPrivate::activateLinkUnderCursor(QString href)
}
#endif
-void QQuickTextControl::ensureCursorVisible()
-{
- Q_D(QQuickTextControl);
- QRectF crect = d->rectForPosition(d->cursor.position()).adjusted(-5, 0, 5, 0);
- emit visibilityRequest(crect);
- emit microFocusChanged();
-}
-
QPalette QQuickTextControl::palette() const
{
Q_D(const QQuickTextControl);