summaryrefslogtreecommitdiffstats
path: root/src/pdfquick/qquickpdfbookmarkmodel.cpp
blob: 81f8547ae73f1ebe1e03d418832d3b7b7d3be227 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include "qquickpdfbookmarkmodel_p.h"
#include <QLoggingCategory>

QT_BEGIN_NAMESPACE

/*!
    \qmltype PdfBookmarkModel
//!    \instantiates QQuickPdfBookmarkModel
    \inqmlmodule QtQuick.Pdf
    \ingroup pdf
    \brief A tree of links (anchors) within a PDF document, such as the table of contents.
    \since 6.4

    A PDF document can contain a hierarchy of link destinations, usually
    representing the table of contents, to be shown in a sidebar in a PDF
    viewer, so that the user can quickly jump to those locations in the
    document. This QAbstractItemModel holds the information in a form
    suitable for display with TreeView, ListView, QTreeView or QListView.
*/

QQuickPdfBookmarkModel::QQuickPdfBookmarkModel(QObject *parent)
    : QPdfBookmarkModel(parent)
{
}

/*!
    \internal
*/
QQuickPdfBookmarkModel::~QQuickPdfBookmarkModel() = default;

/*!
    \qmlproperty PdfDocument PdfBookmarkModel::document

    This property holds the PDF document in which bookmarks are to be found.
*/
QQuickPdfDocument *QQuickPdfBookmarkModel::document() const
{
    return m_quickDocument;
}

void QQuickPdfBookmarkModel::setDocument(QQuickPdfDocument *document)
{
    if (document == m_quickDocument)
        return;
    m_quickDocument = document;
    QPdfBookmarkModel::setDocument(document->document());
    emit documentChanged();
}

QT_END_NAMESPACE

#include "moc_qquickpdfbookmarkmodel_p.cpp"