From ba641cb1847c5d22958430a554a3389accc7256b Mon Sep 17 00:00:00 2001 From: Tianyu Chen Date: Fri, 1 Mar 2024 10:17:37 +0800 Subject: [PATCH] Import TextField-Only-enable-paste-action-if-clipboard-has-text.patch https://codereview.qt-project.org/c/qt/qtdeclarative/+/535176 --- debian/changelog | 8 +++++ ...e-paste-action-if-clipboard-has-text.patch | 35 +++++++++++++++++++ debian/patches/series | 3 ++ 3 files changed, 46 insertions(+) create mode 100644 debian/patches/TextField-Only-enable-paste-action-if-clipboard-has-text.patch diff --git a/debian/changelog b/debian/changelog index b46659a28..5efd5d0c9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Fri, 01 Mar 2024 10:16:35 +0800 + qt6-declarative (6.6.1+dfsg-1deepin3) unstable; urgency=medium * Import patch from upstream: diff --git a/debian/patches/TextField-Only-enable-paste-action-if-clipboard-has-text.patch b/debian/patches/TextField-Only-enable-paste-action-if-clipboard-has-text.patch new file mode 100644 index 000000000..9c0c6c442 --- /dev/null +++ b/debian/patches/TextField-Only-enable-paste-action-if-clipboard-has-text.patch @@ -0,0 +1,35 @@ +From 580715fe586e49cf3fc85bb1c1d114d8e02ae625 Mon Sep 17 00:00:00 2001 +From: Wang Fei +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ø +--- + 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(d)->canPaste = !d->m_readOnly && mimeData->hasText(); ++ const_cast(d)->canPaste = !d->m_readOnly && mimeData->hasText() && !mimeData->text().isEmpty(); + const_cast(d)->canPasteValid = true; + } + return d->canPaste; +-- +2.16.3 + diff --git a/debian/patches/series b/debian/patches/series index af3f454c2..a9c2a8420 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -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