diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-02-18 21:42:35 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-02-20 09:48:59 +0100 |
commit | f467edc97e66727be7fa3747913e4e01672d4b71 (patch) | |
tree | d55afd400b398585006bbdf092230b053a3358da /src/pdf/quick/qquickpdfdocument_p.h | |
parent | 1acd9ad2bfa1c54f19fa8a71fb41e8a90233f76b (diff) |
PdfMultiPageView: use TableView; horz. scroll; control page position
TableView is missing some features compared to ListView; so finding out
where we currently are (which row) and programmatic positioning on a
specific y coordinate of a specific row require some workarounds for now,
including helpers in PdfDocument.
TableView also assumes (and sporadically enforces) that all cells in a
column have the same width. So we need a placeholder Item for each page.
This also helps with rotation: the placeholder is now as wide as the
window or the image, whichever is wider, and the "paper" is centered
within; thus there's always room to rotate it.
There's still some problem with setting contentY in goToPage() after
the page has been zoomed to a size larger than the window: the values
look correct, but it scrolls too far.
But on the plus side, horizontal scrolling works. So now we attempt to
control the horizontal position too: NavigationStack tracks it, and can
go back to a previous position; and links can in theory jump to specific
positions and zoom levels, scrolling horizontally such that a specific x
coordinate is visible.
Includes minor UI tweaks to make it look better on iOS.
Change-Id: I643d8ef48ef815aeb49cae77dcb84c3682563d56
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/pdf/quick/qquickpdfdocument_p.h')
-rw-r--r-- | src/pdf/quick/qquickpdfdocument_p.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pdf/quick/qquickpdfdocument_p.h b/src/pdf/quick/qquickpdfdocument_p.h index 9817b5eef..cefa4f756 100644 --- a/src/pdf/quick/qquickpdfdocument_p.h +++ b/src/pdf/quick/qquickpdfdocument_p.h @@ -62,6 +62,8 @@ class QQuickPdfDocument : public QObject, public QQmlParserStatus Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(int pageCount READ pageCount NOTIFY pageCountChanged FINAL) + Q_PROPERTY(qreal maxPageWidth READ maxPageWidth NOTIFY metaDataChanged) + Q_PROPERTY(qreal maxPageHeight READ maxPageHeight NOTIFY metaDataChanged) Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged FINAL) Q_PROPERTY(QPdfDocument::Status status READ status NOTIFY statusChanged FINAL) Q_PROPERTY(QString error READ error NOTIFY statusChanged FINAL) @@ -102,6 +104,9 @@ public: QDateTime modificationDate() { return m_doc.metaData(QPdfDocument::ModificationDate).toDateTime(); } Q_INVOKABLE QSizeF pagePointSize(int page) const; + qreal maxPageWidth() const; + qreal maxPageHeight() const; + Q_INVOKABLE qreal heightSumBeforePage(int page, qreal spacing = 0, int facingPages = 1) const; Q_SIGNALS: void sourceChanged(); @@ -113,10 +118,12 @@ Q_SIGNALS: private: QPdfDocument &document() { return m_doc; } + void updateMaxPageSize(); private: QUrl m_source; QPdfDocument m_doc; + QSizeF m_maxPageWidthHeight; friend class QQuickPdfLinkModel; friend class QQuickPdfSearchModel; |