diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-04-27 10:03:12 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-04-27 10:03:43 +0200 |
commit | 10e66c6dd0b8a8dd17252d6408c13b689fac6995 (patch) | |
tree | fbdddb33a818b5495b24f3949f7406b0b916e78c /src/pdf/api | |
parent | d0852f90a24673ccc9ef0b93e224ba37b674644d (diff) | |
parent | 75412200db05ddc5ee2b9aea367b580d8b0c438e (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
configure.pri
src/pdf/api/qpdfpagerenderer.h
Change-Id: I7e68277080e29238bbfe8511539ea75b2db89489
Diffstat (limited to 'src/pdf/api')
-rw-r--r-- | src/pdf/api/qpdfbookmarkmodel.h | 4 | ||||
-rw-r--r-- | src/pdf/api/qpdfdestination.h | 5 | ||||
-rw-r--r-- | src/pdf/api/qpdfdocument.h | 3 | ||||
-rw-r--r-- | src/pdf/api/qpdfdocument_p.h | 11 | ||||
-rw-r--r-- | src/pdf/api/qpdfdocumentrenderoptions.h | 51 | ||||
-rw-r--r-- | src/pdf/api/qpdfnamespace.h | 3 | ||||
-rw-r--r-- | src/pdf/api/qpdfpagenavigation.h | 3 | ||||
-rw-r--r-- | src/pdf/api/qpdfpagerenderer.h | 9 | ||||
-rw-r--r-- | src/pdf/api/qpdfsearchmodel.h | 9 | ||||
-rw-r--r-- | src/pdf/api/qpdfsearchresult.h | 11 | ||||
-rw-r--r-- | src/pdf/api/qpdfsearchresult_p.h | 8 | ||||
-rw-r--r-- | src/pdf/api/qpdfselection.h | 14 | ||||
-rw-r--r-- | src/pdf/api/qtpdfglobal.h | 2 |
13 files changed, 70 insertions, 63 deletions
diff --git a/src/pdf/api/qpdfbookmarkmodel.h b/src/pdf/api/qpdfbookmarkmodel.h index 503a29100..8e06a1547 100644 --- a/src/pdf/api/qpdfbookmarkmodel.h +++ b/src/pdf/api/qpdfbookmarkmodel.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtPDF module of the Qt Toolkit. @@ -38,7 +38,7 @@ #define QPDFBOOKMARKMODEL_H #include <QtPdf/qtpdfglobal.h> -#include <QAbstractItemModel> +#include <QtCore/qabstractitemmodel.h> QT_BEGIN_NAMESPACE diff --git a/src/pdf/api/qpdfdestination.h b/src/pdf/api/qpdfdestination.h index 325863226..f9c186ff6 100644 --- a/src/pdf/api/qpdfdestination.h +++ b/src/pdf/api/qpdfdestination.h @@ -56,10 +56,11 @@ class Q_PDF_EXPORT QPdfDestination Q_PROPERTY(qreal zoom READ zoom) public: - QPdfDestination(const QPdfDestination &other); ~QPdfDestination(); + QPdfDestination(const QPdfDestination &other); QPdfDestination &operator=(const QPdfDestination &other); - inline QPdfDestination &operator=(QPdfDestination &&other) noexcept { swap(other); return *this; } + QPdfDestination(QPdfDestination &&other) noexcept; + QPdfDestination &operator=(QPdfDestination &&other) noexcept { swap(other); return *this; } void swap(QPdfDestination &other) noexcept { d.swap(other.d); } bool isValid() const; int page() const; diff --git a/src/pdf/api/qpdfdocument.h b/src/pdf/api/qpdfdocument.h index 290a7b170..f80a7832b 100644 --- a/src/pdf/api/qpdfdocument.h +++ b/src/pdf/api/qpdfdocument.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtPDF module of the Qt Toolkit. @@ -114,6 +114,7 @@ public: QImage render(int page, QSize imageSize, QPdfDocumentRenderOptions options = QPdfDocumentRenderOptions()); Q_INVOKABLE QPdfSelection getSelection(int page, QPointF start, QPointF end); + Q_INVOKABLE QPdfSelection getAllText(int page); Q_SIGNALS: void passwordChanged(); diff --git a/src/pdf/api/qpdfdocument_p.h b/src/pdf/api/qpdfdocument_p.h index 15d8b8259..b69b6f19e 100644 --- a/src/pdf/api/qpdfdocument_p.h +++ b/src/pdf/api/qpdfdocument_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtPDF module of the Qt Toolkit. @@ -53,10 +53,10 @@ #include "third_party/pdfium/public/fpdfview.h" #include "third_party/pdfium/public/fpdf_dataavail.h" -#include <qbuffer.h> -#include <qmutex.h> -#include <qnetworkreply.h> -#include <qpointer.h> +#include <QtCore/qbuffer.h> +#include <QtCore/qmutex.h> +#include <QtCore/qpointer.h> +#include <QtNetwork/qnetworkreply.h> QT_BEGIN_NAMESPACE @@ -105,6 +105,7 @@ public: static int fpdf_GetBlock(void* param, unsigned long position, unsigned char* pBuf, unsigned long size); static void fpdf_AddSegment(struct _FX_DOWNLOADHINTS* pThis, size_t offset, size_t size); void updateLastError(); + QString getText(FPDF_TEXTPAGE textPage, int startIndex, int count); }; QT_END_NAMESPACE diff --git a/src/pdf/api/qpdfdocumentrenderoptions.h b/src/pdf/api/qpdfdocumentrenderoptions.h index 873be0085..cafb4716f 100644 --- a/src/pdf/api/qpdfdocumentrenderoptions.h +++ b/src/pdf/api/qpdfdocumentrenderoptions.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias König <tobias.koenig@kdab.com> +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtPDF module of the Qt Toolkit. @@ -38,56 +39,50 @@ #define QPDFDOCUMENTRENDEROPTIONS_H #include <QtPdf/qpdfnamespace.h> -#include <QtCore/QObject> -#include <QtCore/QRect> +#include <QtCore/qobject.h> +#include <QtCore/qrect.h> QT_BEGIN_NAMESPACE class QPdfDocumentRenderOptions { public: - Q_DECL_CONSTEXPR QPdfDocumentRenderOptions() Q_DECL_NOTHROW : data(0) {} + Q_DECL_CONSTEXPR QPdfDocumentRenderOptions() noexcept : m_renderFlags(0), m_rotation(0), m_reserved(0) {} - Q_DECL_CONSTEXPR QPdf::Rotation rotation() const Q_DECL_NOTHROW { return static_cast<QPdf::Rotation>(bits.rotation); } - Q_DECL_RELAXED_CONSTEXPR void setRotation(QPdf::Rotation _rotation) Q_DECL_NOTHROW { bits.rotation = _rotation; } + Q_DECL_CONSTEXPR QPdf::Rotation rotation() const noexcept { return static_cast<QPdf::Rotation>(m_rotation); } + Q_DECL_RELAXED_CONSTEXPR void setRotation(QPdf::Rotation r) noexcept { m_rotation = r; } - Q_DECL_CONSTEXPR QPdf::RenderFlags renderFlags() const Q_DECL_NOTHROW { return static_cast<QPdf::RenderFlags>(bits.renderFlags); } - Q_DECL_RELAXED_CONSTEXPR void setRenderFlags(QPdf::RenderFlags _renderFlags) Q_DECL_NOTHROW { bits.renderFlags = _renderFlags; } + Q_DECL_CONSTEXPR QPdf::RenderFlags renderFlags() const noexcept { return static_cast<QPdf::RenderFlags>(m_renderFlags); } + Q_DECL_RELAXED_CONSTEXPR void setRenderFlags(QPdf::RenderFlags r) noexcept { m_renderFlags = r; } - Q_DECL_CONSTEXPR QRect scaledClipRect() const Q_DECL_NOTHROW { return m_clipRect; } - Q_DECL_RELAXED_CONSTEXPR void setScaledClipRect(const QRect &r) Q_DECL_NOTHROW { m_clipRect = r; } + Q_DECL_CONSTEXPR QRect scaledClipRect() const noexcept { return m_clipRect; } + Q_DECL_RELAXED_CONSTEXPR void setScaledClipRect(const QRect &r) noexcept { m_clipRect = r; } - Q_DECL_CONSTEXPR QSize scaledSize() const Q_DECL_NOTHROW { return m_scaledSize; } - Q_DECL_RELAXED_CONSTEXPR void setScaledSize(const QSize &s) Q_DECL_NOTHROW { m_scaledSize = s; } + Q_DECL_CONSTEXPR QSize scaledSize() const noexcept { return m_scaledSize; } + Q_DECL_RELAXED_CONSTEXPR void setScaledSize(const QSize &s) noexcept { m_scaledSize = s; } private: - friend Q_DECL_CONSTEXPR inline bool operator==(QPdfDocumentRenderOptions lhs, QPdfDocumentRenderOptions rhs) Q_DECL_NOTHROW; - - - struct Bits { - quint32 renderFlags : 8; - quint32 rotation : 3; - quint32 reserved : 21; - quint32 reserved2 : 32; - }; - - union { - Bits bits; - quint64 data; - }; + friend Q_DECL_CONSTEXPR inline bool operator==(QPdfDocumentRenderOptions lhs, QPdfDocumentRenderOptions rhs) noexcept; QRect m_clipRect; QSize m_scaledSize; + + quint32 m_renderFlags : 8; + quint32 m_rotation : 3; + quint32 m_reserved : 21; + quint32 m_reserved2 = 0; }; Q_DECLARE_TYPEINFO(QPdfDocumentRenderOptions, Q_PRIMITIVE_TYPE); -Q_DECL_CONSTEXPR inline bool operator==(QPdfDocumentRenderOptions lhs, QPdfDocumentRenderOptions rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator==(QPdfDocumentRenderOptions lhs, QPdfDocumentRenderOptions rhs) noexcept { - return lhs.data == rhs.data && lhs.m_clipRect == rhs.m_clipRect && lhs.m_scaledSize == rhs.m_scaledSize; + return lhs.m_clipRect == rhs.m_clipRect && lhs.m_scaledSize == rhs.m_scaledSize && + lhs.m_renderFlags == rhs.m_renderFlags && lhs.m_rotation == rhs.m_rotation && + lhs.m_reserved == rhs.m_reserved && lhs.m_reserved2 == rhs.m_reserved2; // fix -Wunused-private-field } -Q_DECL_CONSTEXPR inline bool operator!=(QPdfDocumentRenderOptions lhs, QPdfDocumentRenderOptions rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator!=(QPdfDocumentRenderOptions lhs, QPdfDocumentRenderOptions rhs) noexcept { return !operator==(lhs, rhs); } diff --git a/src/pdf/api/qpdfnamespace.h b/src/pdf/api/qpdfnamespace.h index c8fd8a580..e76d0abd9 100644 --- a/src/pdf/api/qpdfnamespace.h +++ b/src/pdf/api/qpdfnamespace.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias König <tobias.koenig@kdab.com> +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtPDF module of the Qt Toolkit. @@ -37,7 +38,7 @@ #ifndef QPDFNAMESPACE_H #define QPDFNAMESPACE_H -#include <QObject> +#include <QtCore/qobject.h> QT_BEGIN_NAMESPACE diff --git a/src/pdf/api/qpdfpagenavigation.h b/src/pdf/api/qpdfpagenavigation.h index 8da809646..0f416bf77 100644 --- a/src/pdf/api/qpdfpagenavigation.h +++ b/src/pdf/api/qpdfpagenavigation.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias König <tobias.koenig@kdab.com> +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtPDF module of the Qt Toolkit. @@ -38,7 +39,7 @@ #define QPDFPAGENAVIGATION_H #include <QtPdf/qtpdfglobal.h> -#include <QObject> +#include <QtCore/qobject.h> QT_BEGIN_NAMESPACE diff --git a/src/pdf/api/qpdfpagerenderer.h b/src/pdf/api/qpdfpagerenderer.h index 0f8152cba..bb5505462 100644 --- a/src/pdf/api/qpdfpagerenderer.h +++ b/src/pdf/api/qpdfpagerenderer.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias König <tobias.koenig@kdab.com> +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtPDF module of the Qt Toolkit. @@ -56,15 +57,15 @@ class Q_PDF_EXPORT QPdfPageRenderer : public QObject Q_PROPERTY(RenderMode renderMode READ renderMode WRITE setRenderMode NOTIFY renderModeChanged) public: - enum RenderMode + enum class RenderMode { - MultiThreadedRenderMode, - SingleThreadedRenderMode + MultiThreaded, + SingleThreaded }; Q_ENUM(RenderMode) explicit QPdfPageRenderer(QObject *parent = nullptr); - ~QPdfPageRenderer(); + ~QPdfPageRenderer() override; RenderMode renderMode() const; void setRenderMode(RenderMode mode); diff --git a/src/pdf/api/qpdfsearchmodel.h b/src/pdf/api/qpdfsearchmodel.h index cc91e214a..eb0fb831f 100644 --- a/src/pdf/api/qpdfsearchmodel.h +++ b/src/pdf/api/qpdfsearchmodel.h @@ -37,11 +37,11 @@ #ifndef QPDFSEARCHMODEL_H #define QPDFSEARCHMODEL_H -#include "qtpdfglobal.h" -#include "qpdfdocument.h" -#include "qpdfsearchresult.h" +#include <QtPdf/qtpdfglobal.h> #include <QtCore/qabstractitemmodel.h> +#include <QtPdf/qpdfdocument.h> +#include <QtPdf/qpdfsearchresult.h> QT_BEGIN_NAMESPACE @@ -58,7 +58,8 @@ public: Page = Qt::UserRole, IndexOnPage, Location, - Context, + ContextBefore, + ContextAfter, _Count }; Q_ENUM(Role) diff --git a/src/pdf/api/qpdfsearchresult.h b/src/pdf/api/qpdfsearchresult.h index db7af3dd9..2dfca2dc4 100644 --- a/src/pdf/api/qpdfsearchresult.h +++ b/src/pdf/api/qpdfsearchresult.h @@ -37,11 +37,10 @@ #ifndef QPDFSEARCHRESULT_H #define QPDFSEARCHRESULT_H -#include "qpdfdestination.h" - #include <QtCore/qdebug.h> #include <QtCore/qrect.h> #include <QtCore/qvector.h> +#include <QtPdf/qpdfdestination.h> QT_BEGIN_NAMESPACE @@ -50,18 +49,20 @@ class QPdfSearchResultPrivate; class Q_PDF_EXPORT QPdfSearchResult : public QPdfDestination { Q_GADGET - Q_PROPERTY(QString context READ context) + Q_PROPERTY(QString contextBefore READ contextBefore) + Q_PROPERTY(QString contextAfter READ contextAfter) Q_PROPERTY(QVector<QRectF> rectangles READ rectangles) public: QPdfSearchResult(); ~QPdfSearchResult() {} - QString context() const; + QString contextBefore() const; + QString contextAfter() const; QVector<QRectF> rectangles() const; private: - QPdfSearchResult(int page, QVector<QRectF> rects, QString context); + QPdfSearchResult(int page, QVector<QRectF> rects, QString contextBefore, QString contextAfter); QPdfSearchResult(QPdfSearchResultPrivate *d); friend class QPdfDocument; friend class QPdfSearchModelPrivate; diff --git a/src/pdf/api/qpdfsearchresult_p.h b/src/pdf/api/qpdfsearchresult_p.h index a0f8e4457..615dce4e0 100644 --- a/src/pdf/api/qpdfsearchresult_p.h +++ b/src/pdf/api/qpdfsearchresult_p.h @@ -56,12 +56,14 @@ class QPdfSearchResultPrivate : public QPdfDestinationPrivate { public: QPdfSearchResultPrivate() = default; - QPdfSearchResultPrivate(int page, QVector<QRectF> rects, QString context) : + QPdfSearchResultPrivate(int page, QVector<QRectF> rects, QString contextBefore, QString contextAfter) : QPdfDestinationPrivate(page, rects.first().topLeft(), 0), - context(context), + contextBefore(contextBefore), + contextAfter(contextAfter), rects(rects) {} - QString context; + QString contextBefore; + QString contextAfter; QVector<QRectF> rects; }; diff --git a/src/pdf/api/qpdfselection.h b/src/pdf/api/qpdfselection.h index 900b203cf..5a6a1cddc 100644 --- a/src/pdf/api/qpdfselection.h +++ b/src/pdf/api/qpdfselection.h @@ -38,10 +38,11 @@ #define QPDFSELECTION_H #include <QtPdf/qtpdfglobal.h> -#include <QClipboard> -#include <QExplicitlySharedDataPointer> -#include <QObject> -#include <QPolygonF> + +#include <QtCore/qobject.h> +#include <QtCore/qshareddata.h> +#include <QtGui/qclipboard.h> +#include <QtGui/qpolygon.h> QT_BEGIN_NAMESPACE @@ -55,10 +56,11 @@ class Q_PDF_EXPORT QPdfSelection Q_PROPERTY(QString text READ text) public: - QPdfSelection(const QPdfSelection &other); ~QPdfSelection(); + QPdfSelection(const QPdfSelection &other); QPdfSelection &operator=(const QPdfSelection &other); - inline QPdfSelection &operator=(QPdfSelection &&other) noexcept { swap(other); return *this; } + QPdfSelection(QPdfSelection &&other) noexcept; + QPdfSelection &operator=(QPdfSelection &&other) noexcept { swap(other); return *this; } void swap(QPdfSelection &other) noexcept { d.swap(other.d); } bool isValid() const; QVector<QPolygonF> bounds() const; diff --git a/src/pdf/api/qtpdfglobal.h b/src/pdf/api/qtpdfglobal.h index 34cfc46d9..223ec4bcb 100644 --- a/src/pdf/api/qtpdfglobal.h +++ b/src/pdf/api/qtpdfglobal.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtPDF module of the Qt Toolkit. |