summaryrefslogtreecommitdiffstats
path: root/src/pdf/qpdfbookmarkmodel.cpp
diff options
context:
space:
mode:
authorTobias Koenig <tobias.koenig@kdab.com>2017-02-21 12:57:20 +0100
committerMichal Klocek <michal.klocek@qt.io>2019-11-25 12:01:39 +0100
commitb63d6a1f6c247164095a995780854b708eded762 (patch)
tree12e5a175a83daca5cb61b7ae7a8dbb7b216e9b8c /src/pdf/qpdfbookmarkmodel.cpp
parent2cf4bb16c66050496cbdd2dcd3aa62c0a339a1f3 (diff)
Make QPdfBookmarkModel usable for QML
Add roleNames() method to provide proper role names when used from within QML. Change-Id: I0ac7e5897edd5f60464c3d99a1eaef85feb56a5e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/pdf/qpdfbookmarkmodel.cpp')
-rw-r--r--src/pdf/qpdfbookmarkmodel.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pdf/qpdfbookmarkmodel.cpp b/src/pdf/qpdfbookmarkmodel.cpp
index a96df50e5..241d9fd05 100644
--- a/src/pdf/qpdfbookmarkmodel.cpp
+++ b/src/pdf/qpdfbookmarkmodel.cpp
@@ -275,6 +275,17 @@ int QPdfBookmarkModel::columnCount(const QModelIndex &parent) const
return 1;
}
+QHash<int, QByteArray> QPdfBookmarkModel::roleNames() const
+{
+ QHash<int, QByteArray> names;
+
+ names[TitleRole] = "title";
+ names[LevelRole] = "level";
+ names[PageNumberRole] = "pageNumber";
+
+ return names;
+}
+
QVariant QPdfBookmarkModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())