Details
-
Bug
-
Resolution: Duplicate
-
P1: Critical
-
None
-
5.4.0 Beta
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); } } }