diff options
| author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2025-10-12 23:00:20 +0300 |
|---|---|---|
| committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2025-10-12 23:00:20 +0300 |
| commit | 4826f86e274f1b29bd769e6790824f9e62a40f62 (patch) | |
| tree | c2cc4bb09ca91951a2641e33c3b0a65deb0af877 /src/quick/items/qquicktextinput.cpp | |
| parent | 0f0972d542d9869c2dcfaf9c963d42ff32766460 (diff) | |
| parent | 844f9b9b376838bcb44324984876f8bf99d85d38 (diff) | |
Merge tag 'v6.5.7-lts-lgpl' into 6.56.5
Qt 6.5.7-lts-lgpl release
Diffstat (limited to 'src/quick/items/qquicktextinput.cpp')
| -rw-r--r-- | src/quick/items/qquicktextinput.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index e4b7e4197b..08713eb026 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -1568,6 +1568,8 @@ void QQuickTextInput::mousePressEvent(QMouseEvent *event) if (d->sendMouseEventToInputContext(event)) return; + d->hadSelectionOnMousePress = d->hasSelectedText(); + const bool isMouse = QQuickDeliveryAgentPrivate::isEventFromMouseOrTouchpad(event); if (d->selectByMouse && (isMouse @@ -1663,8 +1665,13 @@ void QQuickTextInput::mouseReleaseEvent(QMouseEvent *event) // On a touchscreen or with a stylus, set cursor position and focus on release, not on press; // if Flickable steals the grab in the meantime, the cursor won't move. // Check d->hasSelectedText() to keep touch-and-hold word selection working. - if (!isMouse && !d->hasSelectedText()) + // But if text was selected already on press, deselect it on release. + if (!isMouse && (!d->hasSelectedText() || d->hadSelectionOnMousePress)) d->moveCursor(d->positionAt(event->position()), false); + // On Android, after doing a long-press to start selection, we see a release event, + // even though there was no press event. So reset hadSelectionOnMousePress to avoid + // it getting stuck in true state. + d->hadSelectionOnMousePress = false; if (d->focusOnPress && qGuiApp->styleHints()->setFocusOnTouchRelease()) ensureActiveFocus(Qt::MouseFocusReason); @@ -1778,7 +1785,7 @@ void QQuickTextInput::itemChange(ItemChange change, const ItemChangeData &value) Q_UNUSED(value); switch (change) { case ItemDevicePixelRatioHasChanged: - if (d->renderType == NativeRendering) { + if (d->containsUnscalableGlyphs) { // Native rendering optimizes for a given pixel grid, so its results must not be scaled. // Text layout code respects the current device pixel ratio automatically, we only need // to rerun layout after the ratio changed. @@ -1997,6 +2004,8 @@ QSGNode *QQuickTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData d->textLayoutDirty = false; } + d->containsUnscalableGlyphs = node->containsUnscalableGlyphs(); + invalidateFontCaches(); return node; |
