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

QML Canvas rendering bug with Threaded renderStrategy

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P2: Important
    • None
    • 5.0.1

    • Ubuntu 13.04.

      $ qmake --version
      QMake version 3.0
      Using Qt version 5.0.1 in /usr/lib/x86_64-linux-gnu

    Description

      I'm getting strange bugs when rendering to Canvas in Qt 5.0.1. Given this QML file:

      import QtQuick 2.0

      Rectangle {
      width: 500
      height: 500

      Flow {
      id: flow
      Component.onCompleted: {
      // Create a bunch of canvases dynamically and put them in the Flow

      "1/2/3/4".split("/").forEach(function() {
      function finishCreation()

      { canvas.width = 100; canvas.height = 100; var ctx = canvas.getContext("2d"); ctx.fillStyle = Qt.rgba(255, 0,0); ctx.fillRect(0,0,100,100); }

      console.log("creating canvas");
      var canvas = Qt.createQmlObject("import QtQuick 2.0; Canvas

      {renderStrategy: Canvas.Threaded; visible: true}

      ", flow, "canvas"+Math.random());
      canvas.onAvailableChanged.connect(function()

      { if (canvas.available) finishCreation(); }

      );
      });
      }
      }
      }

      (obviously this is a simplified example of what I'm actually trying to do; the above example doesn't need to dynamically create the canvases, but the actual thing I'm doing does, and it needs Threaded rendering to be able to use Canvas.toDataURL)

      I should get 4 red squares. Instead, I get one red square, and which of the four squares renders changes from run to run. (See attached screenshot.) Feedback on Google+ suggests that some other people are getting four red squares as expected, so I think that this is a bug rather than pilot error.

      Attachments

        1. qmlcanvas.png
          7 kB
          Stuart Langridge
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sletta Gunnar Sletta
            stuartlangridge Stuart Langridge
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes