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

QGraphicsView (or timer) do not update in wasm

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.11.1
    • QPA, Widgets: GraphicsView
    • None
    • WebAssembly
    • 1c0f0d3072c0944f95bbc15b7e5d3c1629978a6b

    Description

      Given the following code :

      #include <QApplication>
      #include <QGraphicsScene>
      #include <QGraphicsView>
      #include <QTimer>
      #include <QGraphicsItem>
      #include <QGraphicsRectItem>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          QGraphicsScene scene;
          QGraphicsView v{&scene};
      
          auto col = QColor::fromHslF(0.2, 0.6, 0.6, 1.);
          auto it = scene.addRect(QRectF(100, 200, 200, 100), col, col.lighter());
          it->setTransformOriginPoint(it->boundingRect().center());
      
          QTimer t;
          t.setInterval(8);
          t.connect(&t, &QTimer::timeout,
                    [&] {
              it->setRotation(it->rotation() + 0.1);
          });
          t.start();
          v.showFullScreen();
      
          return a.exec();
      }
      
      

      Behaviour on desktop : the rectangle rotates.

      Behaviour on WASM : the rectangle only rotates when the window is resized.

      I tried to call v.update(); manually in the timer callback, but this did not change anything.

      Attachments

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

        Activity

          People

            lpotter Lorn Potter
            jcelerier Jean-Michaël Celerier
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes