Rendering error reporting dialog

This commit is contained in:
Jakub Melka
2019-02-24 19:42:00 +01:00
parent 60bb835a4e
commit 0666f976b1
11 changed files with 330 additions and 2 deletions

View File

@ -535,10 +535,38 @@ void PDFDrawWidgetProxy::draw(QPainter* painter, QRect rect)
PDFRenderer renderer(m_controller->getDocument());
QList<PDFRenderError> errors = renderer.render(painter, placedRect, item.pageIndex);
if (!errors.empty())
{
emit renderingError(item.pageIndex, errors);
}
}
}
}
std::vector<PDFInteger> PDFDrawWidgetProxy::getPagesIntersectingRect(QRect rect) const
{
std::vector<PDFInteger> pages;
// We assume, that no more, than 32 pages will be displayed in the rectangle
pages.reserve(32);
// Iterate trough pages, place them and test, if they intersects with rectangle
for (const LayoutItem& item : m_layout.items)
{
// The offsets m_horizontalOffset and m_verticalOffset are offsets to the
// topleft point of the block. But block maybe doesn't start at (0, 0),
// so we must also use translation from the block beginning.
QRect placedRect = item.pageRect.translated(m_horizontalOffset - m_layout.blockRect.left(), m_verticalOffset - m_layout.blockRect.top());
if (placedRect.intersects(rect))
{
pages.push_back(item.pageIndex);
}
}
return pages;
}
void PDFDrawWidgetProxy::performOperation(Operation operation)
{
switch (operation)