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

recent QQuickWindow signals such as afterSynchronizing are not available on the Window attached property

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.7.0
    • None

    Description

      A busy indicator can't be simply set visible in Javascript right before starting some operation on the same thread which will keep the CPU busy for a while. For example, changing the sourceSize of an Image which is rendering an SVG (or later, a PDF) would be a good time to show a busy indicator. StackOverflow suggests using the afterSynchronizing signal as a workaround, to put off doing the work until the busy indicator is visible: http://stackoverflow.com/questions/27222247/busyindicator-does-not-show-up

          Image {
               property size newSourceSize
               Window.window.onAfterSynchronizing: sourceSize = newSourceSize
          }
      

      The error message says: ".onAfterSynchronizing" is not available due to component versioning. But it should have been there already.

      The signals are versioned:

          Q_REVISION(2) void openglContextCreated(QOpenGLContext *context);
          void sceneGraphInitialized();
          void sceneGraphInvalidated();
          void beforeSynchronizing();
          Q_REVISION(2) void afterSynchronizing();
          void beforeRendering();
          void afterRendering();
          Q_REVISION(2) void afterAnimating();
          Q_REVISION(2) void sceneGraphAboutToStop();
      
          Q_REVISION(1) void closing(QQuickCloseEvent *close);
          void colorChanged(const QColor &);
          Q_REVISION(1) void activeFocusItemChanged();
          Q_REVISION(2) void sceneGraphError(QQuickWindow::SceneGraphError error, const QString &message);
      

      The actual QQuickWindow is exposed as a property of the Window attached property:

      class Q_AUTOTEST_EXPORT QQuickWindowAttached : public QObject
      {
          Q_OBJECT
      ...
          Q_PROPERTY(QQuickWindow *window READ window NOTIFY windowChanged)
      

      Module versioning looks like this:

      void QQuickWindowModule::defineModule()
      {
          const char uri[] = "QtQuick.Window";
      
          qmlRegisterType<QQuickWindow>(uri, 2, 0, "Window");
          qmlRegisterRevision<QWindow,1>(uri, 2, 1);
          qmlRegisterRevision<QWindow,2>(uri, 2, 2);
          qmlRegisterRevision<QQuickWindow,1>(uri, 2, 1);//Type moved to a subclass, but also has new members
          qmlRegisterRevision<QQuickWindow,2>(uri, 2, 2);
          qmlRegisterType<QQuickWindowQmlImpl>(uri, 2, 1, "Window");
          qmlRegisterType<QQuickWindowQmlImpl,1>(uri, 2, 2, "Window");
          qmlRegisterUncreatableType<QQuickScreen>(uri, 2, 0, "Screen", QStringLiteral("Screen can only be used via the attached property."));
      }
      

      Changing it like this and importing QtQuick.Window 2.3 isn't enough:

      void QQuickWindowModule::defineModule()
      {
          const char uri[] = "QtQuick.Window";
      
          qmlRegisterType<QQuickWindow>(uri, 2, 0, "Window");
          qmlRegisterRevision<QWindow,1>(uri, 2, 1);
          qmlRegisterRevision<QWindow,2>(uri, 2, 2);
          qmlRegisterRevision<QWindow,3>(uri, 2, 3);
          qmlRegisterRevision<QQuickWindow,1>(uri, 2, 1);//Type moved to a subclass, but also has new members
          qmlRegisterRevision<QQuickWindow,2>(uri, 2, 2);
          qmlRegisterType<QQuickWindow,3>(uri, 2, 3, "Window");
          qmlRegisterType<QQuickWindowQmlImpl>(uri, 2, 1, "Window");
          qmlRegisterType<QQuickWindowQmlImpl,1>(uri, 2, 2, "Window");
          qmlRegisterType<QQuickWindowQmlImpl,2>(uri, 2, 3, "Window");
          qmlRegisterUncreatableType<QQuickScreen>(uri, 2, 0, "Screen", QStringLiteral("Screen can only be used via the attached property."));
      }
      

      So, maybe there's a general problem with declaring handlers on signals of an object that an attached property returns, or maybe it's because QQuickWindowQmlImpl wasn't versioned to the same revsion in QtQuick.Window 2.2 as QQuickWindow was, or something else.

      For convenience, maybe we need a suitable signal, or all of them, on the Window attached property itself. But it should have already been possible this way.

      Attachments

        1. onAfterSync.qml
          2 kB
        2. workaround.qml
          2 kB

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              srutledg Shawn Rutledge
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes