diff options
Diffstat (limited to 'recipes-qt/qt5/qtbase-git/0027-Fix-misaligned-selection-region-with-text-when-cente.patch')
-rw-r--r-- | recipes-qt/qt5/qtbase-git/0027-Fix-misaligned-selection-region-with-text-when-cente.patch | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/recipes-qt/qt5/qtbase-git/0027-Fix-misaligned-selection-region-with-text-when-cente.patch b/recipes-qt/qt5/qtbase-git/0027-Fix-misaligned-selection-region-with-text-when-cente.patch deleted file mode 100644 index d5e082ea..00000000 --- a/recipes-qt/qt5/qtbase-git/0027-Fix-misaligned-selection-region-with-text-when-cente.patch +++ /dev/null | |||
@@ -1,74 +0,0 @@ | |||
1 | From 5d8a882c11201a29475c5ea71cfb76c9de6573f5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jonathan Liu <net147@gmail.com> | ||
3 | Date: Wed, 23 Oct 2013 00:28:17 +1100 | ||
4 | Subject: [PATCH] Fix misaligned selection region with text when centered | ||
5 | |||
6 | If the text is centered, the x/y position in the selection QRectF may | ||
7 | be a multiple of 0.5 which is rounded up. This rounding causes | ||
8 | misalignment of the selection region with the text. | ||
9 | |||
10 | The alignment is fixed by using qFloor on the x and y components. | ||
11 | |||
12 | Upstream-Status: Accepted [https://codereview.qt-project.org/#change,68842] | ||
13 | Signed-off-by: Jonathan Liu <net147@gmail.com> | ||
14 | |||
15 | Task-number: QTBUG-34218 | ||
16 | Task-number: QTBUG-34234 | ||
17 | Change-Id: I4f2fadeb38602f62a93773c6e5faecf03b28069f | ||
18 | Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> | ||
19 | --- | ||
20 | src/gui/text/qtextlayout.cpp | 19 ++++++++++++++----- | ||
21 | 1 file changed, 14 insertions(+), 5 deletions(-) | ||
22 | |||
23 | diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp | ||
24 | index 54d337e..66341e1 100644 | ||
25 | --- a/src/gui/text/qtextlayout.cpp | ||
26 | +++ b/src/gui/text/qtextlayout.cpp | ||
27 | @@ -44,6 +44,7 @@ | ||
28 | |||
29 | #include <qthread.h> | ||
30 | #include <qfont.h> | ||
31 | +#include <qmath.h> | ||
32 | #include <qpainter.h> | ||
33 | #include <qvarlengtharray.h> | ||
34 | #include <qtextformat.h> | ||
35 | @@ -946,15 +947,23 @@ static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPo | ||
36 | continue; | ||
37 | } | ||
38 | |||
39 | - if (lastSelectionWidth > 0) | ||
40 | - region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight)); | ||
41 | + if (lastSelectionWidth > 0) { | ||
42 | + QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight); | ||
43 | + rect.moveLeft(qFloor(rect.left())); | ||
44 | + rect.moveTop(qFloor(rect.top())); | ||
45 | + region->addRect(rect); | ||
46 | + } | ||
47 | |||
48 | lastSelectionX = selectionX; | ||
49 | lastSelectionWidth = selectionWidth; | ||
50 | } | ||
51 | } | ||
52 | - if (lastSelectionWidth > 0) | ||
53 | - region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight)); | ||
54 | + if (lastSelectionWidth > 0) { | ||
55 | + QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight); | ||
56 | + rect.moveLeft(qFloor(rect.left())); | ||
57 | + rect.moveTop(qFloor(rect.top())); | ||
58 | + region->addRect(rect); | ||
59 | + } | ||
60 | } | ||
61 | |||
62 | static inline QRectF clipIfValid(const QRectF &rect, const QRectF &clip) | ||
63 | @@ -2077,7 +2086,7 @@ static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const Q | ||
64 | |||
65 | QBrush bg = chf.background(); | ||
66 | if (bg.style() != Qt::NoBrush && !chf.property(SuppressBackground).toBool()) | ||
67 | - p->fillRect(r, bg); | ||
68 | + p->fillRect(QRectF(qFloor(r.x()), qFloor(r.y()), r.width(), r.height()), bg); | ||
69 | if (c.style() != Qt::NoBrush) { | ||
70 | p->setPen(QPen(c, 0)); | ||
71 | } | ||
72 | -- | ||
73 | 1.8.4 | ||
74 | |||