diff options
author | ZackaryWelch <welch.zackary@gmail.com> | 2018-03-20 12:07:54 -0400 |
---|---|---|
committer | ZackaryWelch <welch.zackary@gmail.com> | 2018-03-20 12:07:54 -0400 |
commit | 54dfdb0971ecb0fd97dc4aed55b86338a8e31371 (patch) | |
tree | 133cb42100a399990e34441541a7276cd9aee0cb /src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp | |
parent | Moved rotation to the Backend. Fixed memory issues in MuPDF but caused other ... (diff) | |
download | lumina-54dfdb0971ecb0fd97dc4aed55b86338a8e31371.tar.gz lumina-54dfdb0971ecb0fd97dc4aed55b86338a8e31371.tar.bz2 lumina-54dfdb0971ecb0fd97dc4aed55b86338a8e31371.zip |
Fixed highlighting on rotated pages and replaced tabs with spaces
Diffstat (limited to 'src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp')
-rw-r--r-- | src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp b/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp index 128d95fb..7c0fd323 100644 --- a/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp +++ b/src-qt5/desktop-utils/lumina-pdf/PrintWidget.cpp @@ -129,15 +129,20 @@ void PrintWidget::highlightText(TextData *text) { //Creates a rectangle around the text if the text has not already been highlighted if(!text->highlighted()) { double pageHeight = pages.at(text->page()-1)->boundingRect().height(); + int degrees = BACKEND->rotatedDegrees(); + //Shows the text's location on a non-rotated page QRectF rect = text->loc(); - if(BACKEND->rotatedDegrees() != 0) { + //Rotates the rectangle by the page's center and gets the right calculation for text's new location + if(degrees != 0) { QSize center = BACKEND->imageHash(text->page()-1).size()/2; - //Rotates the rectangle by the page's center - //Currently broken when degrees are 90 or 270 + + if(degrees == 90 or degrees == 270) + center.transpose(); + double cx = center.width(), cy = center.height(); rect.adjust(-cx, -cy, -cx, -cy); - QMatrix matrix; - matrix.rotate(BACKEND->rotatedDegrees()); + QMatrix matrix; + matrix.rotate(BACKEND->rotatedDegrees()); rect = matrix.mapRect(rect); if(BACKEND->rotatedDegrees() == 180) rect.adjust(cx, cy, cx, cy); @@ -146,6 +151,7 @@ void PrintWidget::highlightText(TextData *text) { } //Moves the rectangle onto the right page rect.moveTop(rect.y() + pageHeight*(text->page()-1)); + //Transparent yellow for the highlight box QBrush highlightFill(QColor(255, 255, 177, 100)); QPen highlightOutline(QColor(255, 255, 100, 125)); scene->addRect(rect, highlightOutline, highlightFill); |