Signatures: line tool

This commit is contained in:
Jakub Melka
2022-02-13 19:46:09 +01:00
parent c58f11c2e4
commit b61fcff27d
7 changed files with 263 additions and 8 deletions

View File

@@ -24,6 +24,7 @@ namespace pdf
{
class PDFPageContentScene;
class PDFPageContentElementLine;
class PDFPageContentElementRectangle;
class PDFCreatePCElementTool : public PDFWidgetTool
@@ -68,6 +69,39 @@ private:
PDFPageContentElementRectangle* m_element;
};
/// Tool that creates line element.
class PDF4QTLIBSHARED_EXPORT PDFCreatePCElementLineTool : public PDFCreatePCElementTool
{
Q_OBJECT
private:
using BaseClass = PDFCreatePCElementTool;
public:
explicit PDFCreatePCElementLineTool(PDFDrawWidgetProxy* proxy,
PDFPageContentScene* scene,
QAction* action,
bool isHorizontal,
bool isVertical,
QObject* parent);
virtual ~PDFCreatePCElementLineTool() override;
virtual void drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
private:
void clear();
void onPointPicked(pdf::PDFInteger pageIndex, QPointF pagePoint);
PDFPickTool* m_pickTool;
PDFPageContentElementLine* m_element;
std::optional<QPointF> m_startPoint;
};
} // namespace pdf
#endif // PDFPAGECONTENTEDITORTOOLS_H