diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-03-30 18:38:03 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-04-06 22:37:55 +0200 |
commit | 303c25e79ab12d5d48523aa890f2091e98d3b560 (patch) | |
tree | c98408c22ccb2b5312dc967131362ae7885c587e /src/pdf/doc/snippets | |
parent | 299c67a91561a1b53646cbdbdfd4b86494d71ec8 (diff) | |
download | qtwebengine-303c25e79ab12d5d48523aa890f2091e98d3b560.tar.gz |
Expose PdfBookmarkModel to QML; use with TreeView in manual test
- TreeViewDelegate uses Qt::DisplayRole by default, so we need it to map
to the text we want to display, in the roleNames() hash. But asking
explicitly for the TitleRole is OK too (as before).
- In QML, the document property must be a QQuickPdfDocument, whereas in
C++ QPdfDocument is used directly; so we shadow the document property
for QML. Therefore QML_EXTENDED(QPdfBookmarkModel) does not work: we
need real inheritance to get real property shadowing.
- Added tests/manual/quick/pdf/bookmarks.qml with a TreeView
- Clicking the TreeViewDelegate expands the subtree if there is one; but
it also goes to the destination in the PDF, whether there is a subtree
or not. But this can be fixed in TreeViewDelegate.
- Added tests/manual/quick/pdf/bookmarks-list.qml to test the case with
structureMode: PdfBookmarkModel.ListMode (using ListView)
test.pdf is uninteresting for this purpose: there is only one bookmark;
but you can run these tests with an optional argument like this:
qml bookmarks.qml -style Material -- ~/path/to/some.pdf
qml bookmarks-list.qml -- ~/path/to/some.pdf
Change-Id: I65d12a3d9b8ef0f0fa2bc99003430324fd759dcb
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/pdf/doc/snippets')
0 files changed, 0 insertions, 0 deletions