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

Regression: Canvas doesn't paint at all when given sizes involving certain bindings

    XMLWordPrintable

Details

    Description

      The following code drew a red box with Qt 5.3:

      import QtQuick 2.0
      
      Item {
          // Workaround:
      //    width: 160
      //    height: 160
          
          onWidthChanged: print("root width=", width)
          onHeightChanged: print("root height=", height)
      
          Canvas {
              id: canvas
              width: Math.min(parent.width, parent.height)
              height: width
              // Another workaround:
      //        height: Math.min(parent.width, parent.height)
              anchors.centerIn: parent
      
              onPaint: {
                  print("canvas width=", width)
                  print("canvas height=", height)
      
                  var ctx = canvas.getContext("2d");
                  ctx.reset();
      
                  ctx.fillStyle = "red";
                  ctx.fillRect(0, 0, 100, 100);
              }
          }
      }
      

      Attachments

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

        Activity

          People

            aalpert Alan Alpert
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes