Text selection painter

This commit is contained in:
Jakub Melka
2020-01-08 19:02:29 +01:00
parent 7f55d11916
commit d3c0e418e7
5 changed files with 271 additions and 2 deletions

View File

@ -622,12 +622,13 @@ void PDFDrawWidgetProxy::draw(QPainter* painter, QRect rect)
const PDFPage* page = m_controller->getDocument()->getCatalog()->getPage(item.pageIndex);
QMatrix matrix = PDFRenderer::createPagePointToDevicePointMatrix(page, placedRect);
compiledPage->draw(painter, page->getCropBox(), matrix, m_features);
PDFTextLayoutGetter layoutGetter = m_textLayoutCompiler->getTextLayoutLazy(item.pageIndex);
// Draw text blocks/text lines, if it is enabled
if (m_features.testFlag(PDFRenderer::DebugTextBlocks))
{
m_textLayoutCompiler->makeTextLayout();
PDFTextLayout layout = m_textLayoutCompiler->getTextLayout(item.pageIndex);
const PDFTextLayout& layout = layoutGetter;
const PDFTextBlocks& textBlocks = layout.getTextBlocks();
painter->save();
@ -650,7 +651,7 @@ void PDFDrawWidgetProxy::draw(QPainter* painter, QRect rect)
if (m_features.testFlag(PDFRenderer::DebugTextLines))
{
m_textLayoutCompiler->makeTextLayout();
PDFTextLayout layout = m_textLayoutCompiler->getTextLayout(item.pageIndex);
const PDFTextLayout& layout = layoutGetter;
const PDFTextBlocks& textBlocks = layout.getTextBlocks();
painter->save();