Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

QtQuick 2.0 Canvas Context2D clipping region doesn't resize beyond original window size

$
0
0
I ran into a problem with the clipping region in a Canvas not resizing properly. In the included simple example, if you size the app window up beyond twice its original width and/or height, you can see that the green rectangle is no longer clipped by the blue rectangle, but by a smaller region. It’s as if the clip region can’t grow beyond the original app window size. I’m new to Qt/QML, but I don’t think I’m doing anything wrong here. In fact, I tried this in an HTML doc in Chrome, and it doesn’t exhibit the problem. This is a roadblock for my development right now… Thanks for looking. import QtQuick 2.0   Canvas {     id: canvas     width: 200; height: 200;       onPaint: {         var c = canvas.getContext('2d')         c.clearRect( 0, 0, width, height )         // save stuff (clipping path in particular)         c.save()         // draw blue rectangle         c.beginPath();         c.fillStyle = "blue"; c.rect( 0, 0, width*.5, height*.5 ); c.fill()         // set blue rectangle as clipping path         c.clip();         // draw green rectangle         c.fillStyle = "green"; c.fillRect( 20, 20, width*.7, height*.7 );         // restore stuff (clipping path)         c.restore()     } }

Viewing all articles
Browse latest Browse all 4972

Trending Articles