[neon/qt/qtbase/Neon/release] debian: Backport upstream patch to fix QTextFormat::FullWidthSelection for RTL layouts.

Dmitry Shachnev null at kde.org
Thu May 5 10:59:25 BST 2022


Git commit 4caa350d0e9f6ec9ba128c457b20f37953ab68aa by Dmitry Shachnev.
Committed on 15/08/2021 at 18:19.
Pushed by jriddell into branch 'Neon/release'.

Backport upstream patch to fix QTextFormat::FullWidthSelection for RTL layouts.

M  +2    -0    debian/changelog
A  +33   -0    debian/patches/full_width_selection_rtl.diff
M  +1    -0    debian/patches/series

https://invent.kde.org/neon/qt/qtbase/commit/4caa350d0e9f6ec9ba128c457b20f37953ab68aa

diff --git a/debian/changelog b/debian/changelog
index 8b48433..043a3df 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,8 @@ qtbase-opensource-src (5.15.2+dfsg-10) UNRELEASED; urgency=medium
     with Fusion style (closes: #991255).
   * Backport upstream patch to remove MySQL version checks, which led to
     wrong conclusions with MariaDB Connector ≥ 3.2.
+  * Backport upstream patch to fix QTextFormat::FullWidthSelection for
+    right-to-left text layouts.
 
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Tue, 10 Aug 2021 14:22:02 +0300
 
diff --git a/debian/patches/full_width_selection_rtl.diff b/debian/patches/full_width_selection_rtl.diff
new file mode 100644
index 0000000..99e042c
--- /dev/null
+++ b/debian/patches/full_width_selection_rtl.diff
@@ -0,0 +1,33 @@
+Description: fix QTextFormat::FullWidthSelection for right-to-left text layouts
+ Using the QTextFormat::FullWidthSelection property to select a line
+ would previously not take into account right-to-left text layouts.
+ .
+ With this patch, the whole line should now be drawn correctly for both
+ left-to-right, and right-to-left layouts.
+Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=a7894855f2f59028
+Last-Update: 2021-08-15
+
+--- a/src/gui/text/qtextlayout.cpp
++++ b/src/gui/text/qtextlayout.cpp
+@@ -1169,10 +1169,17 @@ void QTextLayout::draw(QPainter *p, cons
+                 QRectF fullLineRect(tl.rect());
+                 fullLineRect.translate(position);
+                 fullLineRect.setRight(QFIXED_MAX);
+-                if (!selectionEndInLine)
+-                    region.addRect(clipIfValid(QRectF(lineRect.topRight(), fullLineRect.bottomRight()), clip));
+-                if (!selectionStartInLine)
+-                    region.addRect(clipIfValid(QRectF(fullLineRect.topLeft(), lineRect.bottomLeft()), clip));
++
++                const bool rightToLeft = d->isRightToLeft();
++
++                if (!selectionEndInLine) {
++                    region.addRect(clipIfValid(rightToLeft ? QRectF(fullLineRect.topLeft(), lineRect.bottomLeft())
++                                                           : QRectF(lineRect.topRight(), fullLineRect.bottomRight()), clip));
++                }
++                if (!selectionStartInLine) {
++                    region.addRect(clipIfValid(rightToLeft ? QRectF(lineRect.topRight(), fullLineRect.bottomRight())
++                                                           : QRectF(fullLineRect.topLeft(), lineRect.bottomLeft()), clip));
++                }
+             } else if (!selectionEndInLine
+                 && isLastLineInBlock
+                 &&!(d->option.flags() & QTextOption::ShowLineAndParagraphSeparators)) {
diff --git a/debian/patches/series b/debian/patches/series
index 1956da4..0dbb5a0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,6 +9,7 @@ fix-misplacement-of-placeholder-text-in-QLineEdit.diff
 fix-placement-of-placeholder-text-in-QLineEdits-with-action-icons.diff
 fusion_checkable_qpushbutton.diff
 mysql_remove_version_checks.diff
+full_width_selection_rtl.diff
 
 # Debian specific.
 gnukfreebsd.diff



More information about the Neon-commits mailing list