Skip to content

Commit

Permalink
Import TextField-Only-enable-paste-action-if-clipboard-has-text.patch
Browse files Browse the repository at this point in the history
  • Loading branch information
UTsweetyfish committed Mar 1, 2024
1 parent 6c56b37 commit 0235748
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
8 changes: 8 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
qt6-declarative (6.6.1+dfsg-1deepin4) unstable; urgency=medium

* Import patch from upstream:
- TextField-Only-enable-paste-action-if-clipboard-has-text.patch
https://codereview.qt-project.org/c/qt/qtdeclarative/+/535176

-- Tianyu Chen <[email protected]> Fri, 01 Mar 2024 10:16:35 +0800

qt6-declarative (6.6.1+dfsg-1deepin3) unstable; urgency=medium

* Import patch from upstream:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 580715fe586e49cf3fc85bb1c1d114d8e02ae625 Mon Sep 17 00:00:00 2001
From: Wang Fei <[email protected]>
Date: Mon, 29 Jan 2024 13:43:17 +0800
Subject: [PATCH] TextField: Only enable paste action if clipboard has text
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

Regardless of whether the content of the system clipboard is empty,
Paste Action was always enabled. Add a condition in canPaste that
the clipboard has text, similar to what we do in Qt Widgets.

Fixes: QTBUG-121594
Change-Id: I4b897c5ccea40229c4b8fc7d1d0da20540ed5ae1
Reviewed-by: Tor Arne Vestbø <[email protected]>
---
src/quick/items/qquicktextinput.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 746942591b9..0acb4b38dc0 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -2587,7 +2587,7 @@ bool QQuickTextInput::canPaste() const
Q_D(const QQuickTextInput);
if (!d->canPasteValid) {
if (const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData())
- const_cast<QQuickTextInputPrivate *>(d)->canPaste = !d->m_readOnly && mimeData->hasText();
+ const_cast<QQuickTextInputPrivate *>(d)->canPaste = !d->m_readOnly && mimeData->hasText() && !mimeData->text().isEmpty();
const_cast<QQuickTextInputPrivate *>(d)->canPasteValid = true;
}
return d->canPaste;
--
2.16.3

3 changes: 3 additions & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ deepin-0001-Add-the-reset-function-for-properties-of-QQuickPalet.patch
deepin-0002-Rename-accent-color-in-QPalette.patch
deepin-0003-Palette-Remove-redundant-code.patch
deepin-0004-Fix-corrupt-rendering-when-toggling-rendernode-based-items.patch

# https://codereview.qt-project.org/c/qt/qtdeclarative/+/535176
deepin-0005-TextField-Only-enable-paste-action-if-clipboard-has-text.patch

0 comments on commit 0235748

Please sign in to comment.