Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.3.0 Beta2, 6.4.0 FF
-
57614680f7 (qt/qtdeclarative/dev) 2171d542ac (qt/qtdeclarative/6.3) 844bdc7ba4 (qt/qtdeclarative/6.2) 844bdc7ba4 (qt/tqtc-qtdeclarative/6.2) 2171d542ac (qt/tqtc-qtdeclarative/6.3) 57614680f7 (qt/tqtc-qtdeclarative/dev)
Description
In https://codereview.qt-project.org/c/qt/qtwebengine/+/396320 we have
// existing public C++ class for widget applications etc.: no QML API goes here class Q_PDF_EXPORT QPdfDocument : public QObject { Q_OBJECT Q_PROPERTY(int pageCount READ pageCount NOTIFY pageCountChanged FINAL) public: int pageCount() const; ... Q_SIGNALS: void pageCountChanged(int pageCount); } // now we expose a QML wrapper, without subclassing class Q_PDFQUICK_EXPORT QQuickPdfDocument : public QObject, public QQmlParserStatus { Q_OBJECT Q_INTERFACES(QQmlParserStatus) Q_PROPERTY ... (several added ones) QML_NAMED_ELEMENT(PdfDocument) QML_EXTENDED(QPdfDocument) QML_ADDED_IN_VERSION(5, 15) public: ... private: QPdfDocument m_doc; }
So you instantiate PdfDocument in QML, which encapsulates a QPdfDocument instance, and you expect pageCount to act like a normal QML property, which changes after the document gets loaded and it can find out how many pages it has. But it seems to get stuck at 0 (as initialized), from the perspective of some "view" QML that is using it.
The way to reproduce the bug is, with the above mentioned change:
$ cd qtwebengine/tests/manual/quick/pdf $ qml withdoc.qml
At the bottom, it says "page 1 of 0" instead of "page 1 of 3".