summaryrefslogtreecommitdiffstats
path: root/src/pdf/qpdfbookmarkmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pdf/qpdfbookmarkmodel.cpp')
-rw-r--r--src/pdf/qpdfbookmarkmodel.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/pdf/qpdfbookmarkmodel.cpp b/src/pdf/qpdfbookmarkmodel.cpp
index 7b984a300..93dbf5d1f 100644
--- a/src/pdf/qpdfbookmarkmodel.cpp
+++ b/src/pdf/qpdfbookmarkmodel.cpp
@@ -50,7 +50,7 @@ public:
int childCount() const
{
- return m_childNodes.count();
+ return m_childNodes.size();
}
int row() const
@@ -172,21 +172,11 @@ struct QPdfBookmarkModelPrivate
const int titleLength = int(FPDFBookmark_GetTitle(bookmark, nullptr, 0));
QList<char16_t> titleBuffer(titleLength);
- FPDFBookmark_GetTitle(bookmark, titleBuffer.data(), quint32(titleBuffer.length()));
+ FPDFBookmark_GetTitle(bookmark, titleBuffer.data(), quint32(titleBuffer.size()));
const FPDF_DEST dest = FPDFBookmark_GetDest(document, bookmark);
const int pageNumber = FPDFDest_GetDestPageIndex(document, dest);
- double pageHeight = 11.69 * 72; // A4 height
- {
- // get actual page height
- const QPdfMutexLocker lock;
- FPDF_PAGE pdfPage = FPDF_LoadPage(document, pageNumber);
- if (pdfPage)
- pageHeight = FPDF_GetPageHeight(pdfPage);
- else
- qCWarning(qLcBM) << "failed to load page" << pageNumber;
- }
-
+ const qreal pageHeight = m_document->pagePointSize(pageNumber).height();
FPDF_BOOL hasX, hasY, hasZoom;
FS_FLOAT x, y, zoom;
bool ok = FPDFDest_GetLocationInPage(dest, &hasX, &hasY, &hasZoom, &x, &y, &zoom);
@@ -270,6 +260,10 @@ QPdfDocument* QPdfBookmarkModel::document() const
return d->m_document;
}
+/*!
+ \property QPdfBookmarkModel::document
+ \brief the PDF document in which bookmarks are to be found.
+*/
void QPdfBookmarkModel::setDocument(QPdfDocument *document)
{
if (d->m_document == document)