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

Qt 5.3.0 regerssion -- Resizing canvas causes issues with painting

    XMLWordPrintable

    Details

    • Commits:
      f45fe58ad2aa741c90b756643da75f1a6bc2fdf6

      Description

      After shape is drawn on canvas, resizing the canvas makes shape to be cut at size of the canvas when it was created. See qml example below (red cross is being not correctly displaying – cutted).

      I have also attached screenshots demonstrating correctly displaying canvas in 5.2.1 and bug from 5.3 (described above).

      import QtQuick 2.2
      
      Item {
          width: 360
          height: width
      
          SequentialAnimation {
              running: true
              loops: Animation.Infinite
              NumberAnimation { target: innerItem; property: "width"; from: 50; to: 300; duration: 1500; easing: Easing.OutQuad}
              NumberAnimation { target: innerItem; property: "width"; from: 300; to: 0; duration: 1800; easing: Easing.OutQuad}
              NumberAnimation { target: innerItem; property: "width"; from: 0; to: 50; duration: 300; easing: Easing.OutQuad}
          }
      
          Rectangle {
              id: innerItem
      
              width: 50
              height: width
              anchors.centerIn: parent
              border.color: "purple"
              border.width: 2
              color: "lightsteelblue"
      
              Canvas {
                  id: canvas
                  anchors.fill: parent
      
                  onPaint: {
                      var ctx = canvas.getContext("2d")
                      ctx.lineWidth = 10
                      ctx.strokeStyle = "red"
                      ctx.clearRect(0, 0, width, height)
                      ctx.beginPath()
                      ctx.moveTo(0, 0)
                      ctx.lineTo(width, height)
                      ctx.moveTo(0, height)
                      ctx.lineTo(width, 0)
                      ctx.stroke()
                  }
              }
          }
      }
      

        Attachments

        1. 5.2.1_ok.png
          5.2.1_ok.png
          2 kB
        2. 5.3.0_bug.png
          5.3.0_bug.png
          1 kB
        3. bug.qml
          1 kB
        4. CanvasTest.qml
          0.9 kB

          Issue Links

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

            Activity

              People

              Assignee:
              ulherman Ulf Hermann
              Reporter:
              pawelp Paweł Pietraszko
              Votes:
              7 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes