unfortunately the text detection is not 100 % accurate
You are not touching “Highlight with Comment”-style texts, which is probably good. (And would fit in another commit anyway.)
There was a discussion about this in D10797, and in T8533 in more general, but this patch is probably fine.
(T8533 is why I thought the annotations would have been y-ordered.)
- You use auto some times. I think that’s only good if the type doesn’t matter or is too long to write it twice on the same line. NormalizedPoint and HighlightAnnotation::Quad will make it more readable.
- You use braces for switch cases. Didn’t see that before. For consistency with the rest of Okular: remove them?
- Bonus: If you create new functions or types, or modify functions you understand, could you write documentation for them?
I’m also wondering whether the Annotation specific members of GuiUtils shouldn’t be members of Annotation.
Didn’t know HighlightAnnotation::Quad, will add that to my documentation todo list. Probably important for Bug 334297.
If you use TextPage::textArea( textSelction ), you will get something like (using above source lines as example...):
xtSelection(leftTop, rightDown);// TODO this does not seem
if only seem was highlighted, right?
Did you try to make a RegularAreaRect from all NormalizedRect from leftTop and rightDown of each Quad, and pass that to text()?
QString::simplified() is more predictable.
Move 5 lines up, so code stays uniform.