summaryrefslogtreecommitdiffstats
path: root/src/pdf
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2020-07-15 11:56:00 +0200
committerJüri Valdmann <juri.valdmann@qt.io>2020-08-13 12:33:48 +0200
commit0c0500717e3bb329ceeef764fd6b962af10488cf (patch)
tree5abffa55b82c49f0f59e7779b4509d58d0e063a4 /src/pdf
parent5189f03b0078567f6a0c1fa32780314cb7451102 (diff)
Fix almost all deprecation warnings
Replace QString::fromUtf16({const ushort * -> const char16_t}) QMap::{unite -> insert} Q{Hover,DragEnter,DragMove,Drop}Event::{posF() -> position()} Q{Hover,DragEnter,DragMove,Drop}Event::{pos() -> position().toPoint()} Q{DragEnter,Drop}Event::{mouseButtons -> buttons} Q{DragEnter,Drop}Event::{keyboardModifiers -> modifiers} QMouseEvent::{localPos -> position} QMouseEvent::{windowPos -> scenePosition} QMouseEvent::{screenPos -> globalPosition} These should all be just renames without any change in behavior (save for some floating point conversions). The one remaining issue concerns the deprecation of binary JSON in qtbase, which is recommended to be replaced with CBOR. Change-Id: I8f3b533242fe9a58c08c2b09ff5d0bdbbfa6dd17 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/pdf')
-rw-r--r--src/pdf/qpdfbookmarkmodel.cpp2
-rw-r--r--src/pdf/qpdfdocument.cpp4
-rw-r--r--src/pdf/qpdflinkmodel.cpp3
-rw-r--r--src/pdf/qpdfsearchmodel.cpp3
4 files changed, 7 insertions, 5 deletions
diff --git a/src/pdf/qpdfbookmarkmodel.cpp b/src/pdf/qpdfbookmarkmodel.cpp
index eb4cb8773..b0e8bbecd 100644
--- a/src/pdf/qpdfbookmarkmodel.cpp
+++ b/src/pdf/qpdfbookmarkmodel.cpp
@@ -189,7 +189,7 @@ public:
const int titleLength = int(FPDFBookmark_GetTitle(bookmark, nullptr, 0));
- QList<ushort> titleBuffer(titleLength);
+ QList<char16_t> titleBuffer(titleLength);
FPDFBookmark_GetTitle(bookmark, titleBuffer.data(), quint32(titleBuffer.length()));
const FPDF_DEST dest = FPDFBookmark_GetDest(document, bookmark);
diff --git a/src/pdf/qpdfdocument.cpp b/src/pdf/qpdfdocument.cpp
index 9b83e9b8e..5a8e0a1af 100644
--- a/src/pdf/qpdfdocument.cpp
+++ b/src/pdf/qpdfdocument.cpp
@@ -405,7 +405,7 @@ QString QPdfDocumentPrivate::getText(FPDF_TEXTPAGE textPage, int startIndex, int
// TODO is that enough space in case one unicode character is more than one in utf-16?
int len = FPDFText_GetText(textPage, startIndex, count, buf.data());
Q_ASSERT(len - 1 <= count); // len is number of characters written, including the terminator
- return QString::fromUtf16(buf.constData(), len - 1);
+ return QString::fromUtf16(reinterpret_cast<const char16_t *>(buf.constData()), len - 1);
}
QPointF QPdfDocumentPrivate::getCharPosition(FPDF_TEXTPAGE textPage, double pageHeight, int charIndex)
@@ -606,7 +606,7 @@ QVariant QPdfDocument::metaData(MetaDataField field) const
FPDF_GetMetaText(d->doc, fieldName.constData(), buf.data(), buf.length());
lock.unlock();
- QString text = QString::fromUtf16(buf.data());
+ QString text = QString::fromUtf16(reinterpret_cast<const char16_t *>(buf.data()));
switch (field) {
case Title: // fall through
diff --git a/src/pdf/qpdflinkmodel.cpp b/src/pdf/qpdflinkmodel.cpp
index 2738aa533..5c2596bb9 100644
--- a/src/pdf/qpdflinkmodel.cpp
+++ b/src/pdf/qpdflinkmodel.cpp
@@ -242,7 +242,8 @@ void QPdfLinkModelPrivate::update()
QList<unsigned short> buf(len);
int got = FPDFLink_GetURL(webLinks, i, buf.data(), len);
Q_ASSERT(got == len);
- linkData.url = QString::fromUtf16(buf.data(), got - 1);
+ linkData.url = QString::fromUtf16(
+ reinterpret_cast<const char16_t *>(buf.data()), got - 1);
}
FPDFLink_GetTextRange(webLinks, i, &linkData.textStart, &linkData.textCharCount);
len = FPDFLink_CountRects(webLinks, i);
diff --git a/src/pdf/qpdfsearchmodel.cpp b/src/pdf/qpdfsearchmodel.cpp
index eeb0a18ce..9eb304263 100644
--- a/src/pdf/qpdfsearchmodel.cpp
+++ b/src/pdf/qpdfsearchmodel.cpp
@@ -261,7 +261,8 @@ bool QPdfSearchModelPrivate::doSearch(int page)
QList<ushort> buf(count + 1);
int len = FPDFText_GetText(textPage, startIndex, count, buf.data());
Q_ASSERT(len - 1 <= count); // len is number of characters written, including the terminator
- QString context = QString::fromUtf16(buf.constData(), len - 1);
+ QString context = QString::fromUtf16(
+ reinterpret_cast<const char16_t *>(buf.constData()), len - 1);
context = context.replace(QLatin1Char('\n'), QStringLiteral("\u23CE"));
context = context.remove(QLatin1Char('\r'));
// try to find the search string near the middle of the context if possible