mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Redact tool - basic functionality, create redaction annotations
This commit is contained in:
@ -1015,12 +1015,15 @@ PDFPickTool::PDFPickTool(PDFDrawWidgetProxy* proxy, PDFPickTool::Mode mode, QObj
|
||||
BaseClass(proxy, parent),
|
||||
m_mode(mode),
|
||||
m_pageIndex(-1),
|
||||
m_drawSelectionRectangle(true)
|
||||
m_drawSelectionRectangle(true),
|
||||
m_selectionRectangleColor(Qt::blue)
|
||||
{
|
||||
setCursor((m_mode == Mode::Images) ? Qt::CrossCursor : Qt::BlankCursor);
|
||||
m_snapper.setSnapPointPixelSize(PDFWidgetUtils::scaleDPI_x(proxy->getWidget(), 10));
|
||||
m_snapper.setSnapPointTolerance(m_snapper.getSnapPointPixelSize());
|
||||
|
||||
m_selectionRectangleColor.setAlphaF(0.25);
|
||||
|
||||
connect(proxy, &PDFDrawWidgetProxy::drawSpaceChanged, this, &PDFPickTool::buildSnapData);
|
||||
connect(proxy, &PDFDrawWidgetProxy::pageImageChanged, this, &PDFPickTool::buildSnapData);
|
||||
}
|
||||
@ -1050,18 +1053,14 @@ void PDFPickTool::drawPage(QPainter* painter,
|
||||
QRect selectionRectangle(xMin, yMin, xMax - xMin, yMax - yMin);
|
||||
if (selectionRectangle.isValid())
|
||||
{
|
||||
QColor selectionColor(Qt::blue);
|
||||
selectionColor.setAlphaF(0.25);
|
||||
painter->fillRect(selectionRectangle, selectionColor);
|
||||
painter->fillRect(selectionRectangle, m_selectionRectangleColor);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_mode == Mode::Images && m_snapper.getSnappedImage())
|
||||
{
|
||||
const PDFSnapper::ViewportSnapImage* snappedImage = m_snapper.getSnappedImage();
|
||||
QColor selectionColor(Qt::blue);
|
||||
selectionColor.setAlphaF(0.25);
|
||||
painter->fillPath(snappedImage->viewportPath, selectionColor);
|
||||
painter->fillPath(snappedImage->viewportPath, m_selectionRectangleColor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1225,6 +1224,16 @@ void PDFPickTool::buildSnapData()
|
||||
}
|
||||
}
|
||||
|
||||
QColor PDFPickTool::getSelectionRectangleColor() const
|
||||
{
|
||||
return m_selectionRectangleColor;
|
||||
}
|
||||
|
||||
void PDFPickTool::setSelectionRectangleColor(QColor selectionRectangleColor)
|
||||
{
|
||||
m_selectionRectangleColor = selectionRectangleColor;
|
||||
}
|
||||
|
||||
void PDFPickTool::setDrawSelectionRectangle(bool drawSelectionRectangle)
|
||||
{
|
||||
m_drawSelectionRectangle = drawSelectionRectangle;
|
||||
|
Reference in New Issue
Block a user