aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextnodeengine_p.h
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2014-10-08 12:30:27 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2014-10-09 11:47:56 +0200
commite89e9825cc47a02a195f41fb44a8d09e0ec1a84d (patch)
tree55701022712b4d8e23c928ee72554067e2a22ac7 /src/quick/items/qquicktextnodeengine_p.h
parentbc15441453527d055b77a4eee04308b651c4ca03 (diff)
Fix missing glyphs in selection
Change 198009db79a85d3cab7fe3a6432635d36123a2d6 revealed a bug in the new selection algorithm which would occur sometimes when a given run of text spanned several script items. Since we are checking the glyph runs for overlaps in the actual text, we need to report the exact characters spanned by the glyph run. We use the new enabler for this in QGlyphRunPrivate. Added a new test case which is an error case we did not yet cover, which is when there is only a single script item, but several font engines are used to produce it (fallback fonts). Change-Id: Ie4c3e79ad98a033d5c75fd67ada4ae83df33435b Task-number: QTBUG-41808 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/quick/items/qquicktextnodeengine_p.h')
-rw-r--r--src/quick/items/qquicktextnodeengine_p.h14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/quick/items/qquicktextnodeengine_p.h b/src/quick/items/qquicktextnodeengine_p.h
index 142375b5a3..f0d52683c6 100644
--- a/src/quick/items/qquicktextnodeengine_p.h
+++ b/src/quick/items/qquicktextnodeengine_p.h
@@ -75,12 +75,7 @@ public:
BinaryTreeNode(const QGlyphRun &g, SelectionState selState, const QRectF &brect,
const QQuickTextNode::Decorations &decs, const QColor &c, const QColor &bc,
- const QPointF &pos, qreal a, int rangeStart, int rangeEnd)
- : glyphRun(g), boundingRect(brect), selectionState(selState), clipNode(0), decorations(decs)
- , color(c), backgroundColor(bc), position(pos), ascent(a), leftChildIndex(-1), rightChildIndex(-1)
- {
- ranges.append(qMakePair(rangeStart, rangeEnd));
- }
+ const QPointF &pos, qreal a);
QGlyphRun glyphRun;
QRectF boundingRect;
@@ -102,8 +97,7 @@ public:
{ insert(binaryTree, BinaryTreeNode(rect, image, selectionState, ascent)); }
static void insert(QVarLengthArray<BinaryTreeNode, 16> *binaryTree, const QGlyphRun &glyphRun, SelectionState selectionState,
- QQuickTextNode::Decorations decorations, const QColor &textColor, const QColor &backgroundColor, const QPointF &position,
- int rangeStart, int rangeEnd);
+ QQuickTextNode::Decorations decorations, const QColor &textColor, const QColor &backgroundColor, const QPointF &position);
static void insert(QVarLengthArray<BinaryTreeNode, 16> *binaryTree, const BinaryTreeNode &binaryTreeNode);
static void inOrder(const QVarLengthArray<BinaryTreeNode, 16> &binaryTree, QVarLengthArray<int> *sortedIndexes, int currentIndex = 0);
};
@@ -138,8 +132,8 @@ public:
SelectionState selectionState,
QTextDocument *textDocument, int pos,
QTextFrameFormat::Position layoutPosition = QTextFrameFormat::InFlow);
- void addSelectedGlyphs(const QGlyphRun &glyphRun, int rangeStart, int rangeEnd);
- void addUnselectedGlyphs(const QGlyphRun &glyphRun, int rangeStart, int rangeEnd);
+ void addSelectedGlyphs(const QGlyphRun &glyphRun);
+ void addUnselectedGlyphs(const QGlyphRun &glyphRun);
void addGlyphsInRange(int rangeStart, int rangeEnd,
const QColor &color, const QColor &backgroundColor,
int selectionStart, int selectionEnd);