[neon/qt/qtbase/Neon/testing] debian: Backport qlineedit_fix_cursor_drawing_issues.diff

Lisandro Damián Nicanor Pérez Meyer null at kde.org
Tue May 18 11:01:28 BST 2021


Git commit b62cf24ee6142145247f89e6ef323e687dad59ba by Lisandro Damián Nicanor Pérez Meyer.
Committed on 04/11/2020 at 14:57.
Pushed by sitter into branch 'Neon/testing'.

Backport qlineedit_fix_cursor_drawing_issues.diff

The patch was prepared by Lu Yaning on
https://salsa.debian.org/qt-kde-team/qt/qtbase/-/merge_requests/17

I simply updated it to master.

M  +4    -0    debian/changelog
A  +41   -0    debian/patches/qlineedit_fix_cursor_drawing_issues.diff
M  +1    -0    debian/patches/series

https://invent.kde.org/neon/qt/qtbase/commit/b62cf24ee6142145247f89e6ef323e687dad59ba

diff --git a/debian/changelog b/debian/changelog
index 587ed1f..6374927 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,9 @@
 qtbase-opensource-src (5.15.1+dfsg-3) UNRELEASED; urgency=medium
 
+  [ Lu Yaning ]
+  * Backport qlineedit_fix_cursor_drawing_issues.diff, fixing stale pixels left
+    behind while entering Chinese on English environments.
+
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Wed, 04 Nov 2020 11:53:04 -0300
 
 qtbase-opensource-src (5.15.1+dfsg-2) unstable; urgency=medium
diff --git a/debian/patches/qlineedit_fix_cursor_drawing_issues.diff b/debian/patches/qlineedit_fix_cursor_drawing_issues.diff
new file mode 100644
index 0000000..d8ce6e5
--- /dev/null
+++ b/debian/patches/qlineedit_fix_cursor_drawing_issues.diff
@@ -0,0 +1,41 @@
+Description: QLineEdit: Fix cursor drawing issues
+ Entering Chinese in some fonts in an English environment causes
+ the cursor drawing coordinates to exceed the updated coordinates,
+ leaving behind stale pixels at the top.
+ .
+ Keep the refresh and draw area calculation methods the same when
+ rendering the contents in QLineEdit::paintEvent, and when
+ calculating the update area in
+ QLineEditPrivate::adjustedControlRect.
+Origin: upstream, https://codereview.qt-project.org/c/qt/qtbase/+/308158
+Last-Update: 2020-07-23
+
+--- a/src/widgets/widgets/qlineedit.cpp
++++ b/src/widgets/widgets/qlineedit.cpp
+@@ -2031,6 +2031,7 @@
+     }
+ 
+     // the y offset is there to keep the baseline constant in case we have script changes in the text.
++    // Needs to be kept in sync with QLineEditPrivate::adjustedControlRect
+     QPoint topLeft = lineRect.topLeft() - QPoint(d->hscroll, d->control->ascent() - fm.ascent());
+ 
+     // draw text, selections and cursors
+diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
+index 6424c14..05b14b1 100644
+--- a/src/widgets/widgets/qlineedit_p.cpp
++++ b/src/widgets/widgets/qlineedit_p.cpp
+@@ -70,12 +70,13 @@
+ const int QLineEditPrivate::verticalMargin(1);
+ const int QLineEditPrivate::horizontalMargin(2);
+ 
++// Needs to be kept in sync with QLineEdit::paintEvent
+ QRect QLineEditPrivate::adjustedControlRect(const QRect &rect) const
+ {
+     QRect widgetRect = !rect.isEmpty() ? rect : q_func()->rect();
+     QRect cr = adjustedContentsRect();
+     int cix = cr.x() - hscroll + horizontalMargin;
+-    return widgetRect.translated(QPoint(cix, vscroll));
++    return widgetRect.translated(QPoint(cix, vscroll - control->ascent() + q_func()->fontMetrics().ascent()));
+ }
+ 
+ int QLineEditPrivate::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const
diff --git a/debian/patches/series b/debian/patches/series
index a30b9b8..2259cba 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,5 +1,6 @@
 # Backported from upstream.
 emit_geometry_changed.diff
+qlineedit_fix_cursor_drawing_issues.diff
 
 # Debian specific.
 gnukfreebsd.diff



More information about the Neon-commits mailing list