Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-101155

qml binding to a QML_EXTENDED property doesn't update when changed signal emitted

    XMLWordPrintable

Details

    • 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".

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ulherman Ulf Hermann
            srutledg Shawn Rutledge
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes