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

Canvas inside rectangle resizes incorrectly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Duplicate
    • Affects Version/s: 5.3.0
    • Fix Version/s: None
    • Labels:
    • Environment:
      Windows 7 using Desktop Qt 5.3.0 MSVC2013 OpenGL 64bit

      Description

      Below is a short example QML which can be run to illustrate the problem.
      The canvas is anchored to the rectangle.
      When running, if you resize the rectangle smaller the canvas follows - ok. If you resize the rectangle larger than the initial size the canvas does not follow but rather stops at the original size. Note the behavior of the border when the rectangle exceeds its original size.
      In 5.2.1 using MSVC2012 and OpenGL this example works normally (canvas always follows rectangle's size).

      import QtQuick 2.0
      
      Rectangle {
          width: 400; height: 400
          Canvas {
              id: canvas
              // canvas size
              anchors.fill: parent
              // handler to override for drawing
              onPaint: {
                  // get context
                  var ctx = getContext("2d")
                  // setup the stroke
                  ctx.lineWidth = 8
                  ctx.strokeStyle = "blue"
                  // setup the fill
                  ctx.fillStyle = "steelblue"
                  // make a rectangle with a border
                  ctx.fillRect(0, 0, canvas.width, canvas.height)
                  ctx.strokeRect(0, 0, canvas.width, canvas.height)
              }
          }
      }
      

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              aalpert Alan Alpert
              Reporter:
              sedroca Andrew Henry Cordes
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes