diff options
author | Jonathan Liu <net147@gmail.com> | 2013-10-24 21:39:52 +1100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-10-30 13:39:09 +0000 |
commit | f8a96534ffd24f624f8d7550553c9c642cb45e27 (patch) | |
tree | 36db62671f3da70e63bec8d2b84afa97242cec16 /meta/recipes-qt/qt4/qt4-4.8.5/0025-Fix-misaligned-selection-region-with-text-when-cente.patch | |
parent | 2342fdc7b44d805c6d088c2f50a5dab829da8ceb (diff) | |
download | poky-f8a96534ffd24f624f8d7550553c9c642cb45e27.tar.gz |
qt4: add upstream QTBUG-34218/QTBUG-34234 misaligned selection patch
(From OE-Core rev: 3af8f2e0697a9523d3b505ba4c48eca35f6de3a9)
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-qt/qt4/qt4-4.8.5/0025-Fix-misaligned-selection-region-with-text-when-cente.patch')
-rw-r--r-- | meta/recipes-qt/qt4/qt4-4.8.5/0025-Fix-misaligned-selection-region-with-text-when-cente.patch | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/meta/recipes-qt/qt4/qt4-4.8.5/0025-Fix-misaligned-selection-region-with-text-when-cente.patch b/meta/recipes-qt/qt4/qt4-4.8.5/0025-Fix-misaligned-selection-region-with-text-when-cente.patch new file mode 100644 index 0000000000..964bcf8efb --- /dev/null +++ b/meta/recipes-qt/qt4/qt4-4.8.5/0025-Fix-misaligned-selection-region-with-text-when-cente.patch | |||
@@ -0,0 +1,75 @@ | |||
1 | From c368cbad3a505d44894ff150dc25c74d0174ca15 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,68935] | ||
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 | (cherry picked from qtbase/5d8a882c11201a29475c5ea71cfb76c9de6573f5) | ||
20 | --- | ||
21 | src/gui/text/qtextlayout.cpp | 19 ++++++++++++++----- | ||
22 | 1 file changed, 14 insertions(+), 5 deletions(-) | ||
23 | |||
24 | diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp | ||
25 | index 3d340cb..8d652ea 100644 | ||
26 | --- a/src/gui/text/qtextlayout.cpp | ||
27 | +++ b/src/gui/text/qtextlayout.cpp | ||
28 | @@ -44,6 +44,7 @@ | ||
29 | |||
30 | #include <qfont.h> | ||
31 | #include <qapplication.h> | ||
32 | +#include <qmath.h> | ||
33 | #include <qpainter.h> | ||
34 | #include <qvarlengtharray.h> | ||
35 | #include <qtextformat.h> | ||
36 | @@ -979,15 +980,23 @@ static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPo | ||
37 | continue; | ||
38 | } | ||
39 | |||
40 | - if (lastSelectionWidth > 0) | ||
41 | - region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight)); | ||
42 | + if (lastSelectionWidth > 0) { | ||
43 | + QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight); | ||
44 | + rect.moveLeft(qFloor(rect.left())); | ||
45 | + rect.moveTop(qFloor(rect.top())); | ||
46 | + region->addRect(rect); | ||
47 | + } | ||
48 | |||
49 | lastSelectionX = selectionX; | ||
50 | lastSelectionWidth = selectionWidth; | ||
51 | } | ||
52 | } | ||
53 | - if (lastSelectionWidth > 0) | ||
54 | - region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight)); | ||
55 | + if (lastSelectionWidth > 0) { | ||
56 | + QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight); | ||
57 | + rect.moveLeft(qFloor(rect.left())); | ||
58 | + rect.moveTop(qFloor(rect.top())); | ||
59 | + region->addRect(rect); | ||
60 | + } | ||
61 | } | ||
62 | |||
63 | static inline QRectF clipIfValid(const QRectF &rect, const QRectF &clip) | ||
64 | @@ -2081,7 +2090,7 @@ static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const Q | ||
65 | |||
66 | QBrush bg = chf.background(); | ||
67 | if (bg.style() != Qt::NoBrush && !chf.property(SuppressBackground).toBool()) | ||
68 | - p->fillRect(r, bg); | ||
69 | + p->fillRect(QRectF(qFloor(r.x()), qFloor(r.y()), r.width(), r.height()), bg); | ||
70 | if (c.style() != Qt::NoBrush) { | ||
71 | p->setPen(QPen(c, 0)); | ||
72 | } | ||
73 | -- | ||
74 | 1.8.4 | ||
75 | |||