diff options
author | Albert Astals Cid <albert.astals.cid@kdab.com> | 2021-04-13 16:06:48 +0200 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2021-04-20 11:20:46 +0200 |
commit | e43a3d9cff01c7d2b6374b3aa340882528da9c85 (patch) | |
tree | c04d905a4ad00fa1b735303320d62e78c28e0ff9 | |
parent | d672fbe5c1f22c69e30824d7cb896e6b8fb560eb (diff) |
qt: Allow to pass the border width when signing
-rw-r--r-- | qt5/src/poppler-pdf-converter.cc | 13 | ||||
-rw-r--r-- | qt5/src/poppler-qt5.h | 14 | ||||
-rw-r--r-- | qt6/src/poppler-pdf-converter.cc | 13 | ||||
-rw-r--r-- | qt6/src/poppler-qt6.h | 14 |
4 files changed, 50 insertions, 4 deletions
diff --git a/qt5/src/poppler-pdf-converter.cc b/qt5/src/poppler-pdf-converter.cc index 32910725..d1355764 100644 --- a/qt5/src/poppler-pdf-converter.cc +++ b/qt5/src/poppler-pdf-converter.cc @@ -176,7 +176,7 @@ bool PDFConverter::sign(const NewSignatureData &data) destPage->addAnnot(signatureAnnot); std::unique_ptr<AnnotBorder> border(new AnnotBorderArray()); - border->setWidth(1.5); + border->setWidth(data.borderWidth()); signatureAnnot->setBorder(std::move(border)); FormWidgetSignature *fws = dynamic_cast<FormWidgetSignature *>(formWidget); @@ -211,6 +211,7 @@ struct PDFConverter::NewSignatureData::NewSignatureDataPrivate double fontSize = 10.0; QColor fontColor = Qt::red; QColor borderColor = Qt::red; + double borderWidth = 1.5; QColor backgroundColor = QColor(240, 240, 240); QString partialName = QUuid::createUuid().toString(); @@ -308,6 +309,16 @@ QColor PDFConverter::NewSignatureData::backgroundColor() const return d->backgroundColor; } +double PDFConverter::NewSignatureData::borderWidth() const +{ + return d->borderWidth; +} + +void PDFConverter::NewSignatureData::setBorderWidth(double width) +{ + d->borderWidth = width; +} + void PDFConverter::NewSignatureData::setBackgroundColor(const QColor &color) { d->backgroundColor = color; diff --git a/qt5/src/poppler-qt5.h b/qt5/src/poppler-qt5.h index 2d879f78..70d2566a 100644 --- a/qt5/src/poppler-qt5.h +++ b/qt5/src/poppler-qt5.h @@ -25,6 +25,7 @@ * Copyright (C) 2020 Katarina Behrens <Katarina.Behrens@cib.de> * Copyright (C) 2020 Thorsten Behrens <Thorsten.Behrens@CIB.de> * Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by Technische Universität Dresden + * Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2137,7 +2138,8 @@ public: * - rect for the signature annotation * - text that will be shown inside the rect * - font size and color - * - border and background color + * - border width and color + * - background color * \since 21.01 */ class POPPLER_QT5_EXPORT NewSignatureData @@ -2182,6 +2184,16 @@ public: void setBorderColor(const QColor &color); /** + * border width in points + * + * Default: 1.5 + * + * \since 21.05 + */ + double borderWidth() const; + void setBorderWidth(double width); + + /** * Default: QColor(240, 240, 240) */ QColor backgroundColor() const; diff --git a/qt6/src/poppler-pdf-converter.cc b/qt6/src/poppler-pdf-converter.cc index 3783e9ed..62e6d535 100644 --- a/qt6/src/poppler-pdf-converter.cc +++ b/qt6/src/poppler-pdf-converter.cc @@ -176,7 +176,7 @@ bool PDFConverter::sign(const NewSignatureData &data) destPage->addAnnot(signatureAnnot); std::unique_ptr<AnnotBorder> border(new AnnotBorderArray()); - border->setWidth(1.5); + border->setWidth(data.borderWidth()); signatureAnnot->setBorder(std::move(border)); FormWidgetSignature *fws = dynamic_cast<FormWidgetSignature *>(formWidget); @@ -211,6 +211,7 @@ struct PDFConverter::NewSignatureData::NewSignatureDataPrivate double fontSize = 10.0; QColor fontColor = Qt::red; QColor borderColor = Qt::red; + double borderWidth = 1.5; QColor backgroundColor = QColor(240, 240, 240); QString partialName = QUuid::createUuid().toString(); @@ -308,6 +309,16 @@ QColor PDFConverter::NewSignatureData::backgroundColor() const return d->backgroundColor; } +double PDFConverter::NewSignatureData::borderWidth() const +{ + return d->borderWidth; +} + +void PDFConverter::NewSignatureData::setBorderWidth(double width) +{ + d->borderWidth = width; +} + void PDFConverter::NewSignatureData::setBackgroundColor(const QColor &color) { d->backgroundColor = color; diff --git a/qt6/src/poppler-qt6.h b/qt6/src/poppler-qt6.h index 5e34dcce..5d38fbdd 100644 --- a/qt6/src/poppler-qt6.h +++ b/qt6/src/poppler-qt6.h @@ -25,6 +25,7 @@ * Copyright (C) 2020 Katarina Behrens <Katarina.Behrens@cib.de> * Copyright (C) 2020 Thorsten Behrens <Thorsten.Behrens@CIB.de> * Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by Technische Universität Dresden + * Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1955,7 +1956,8 @@ public: * - rect for the signature annotation * - text that will be shown inside the rect * - font size and color - * - border and background color + * - border width and color + * - background color * \since 21.01 */ class POPPLER_QT6_EXPORT NewSignatureData @@ -2000,6 +2002,16 @@ public: void setBorderColor(const QColor &color); /** + * border width in points + * + * Default: 1.5 + * + * \since 21.05 + */ + double borderWidth() const; + void setBorderWidth(double width); + + /** * Default: QColor(240, 240, 240) */ QColor backgroundColor() const; |