qt - How to use QtQuick tiled canvas? -
i found document here it's ambiguous understand. can give me example of using tiled canvas?
thanks mitch comment know tiled canvas not work (see here).
the bug still appears in qt 5.4.2 shown example:
import qtquick 2.0 rectangle { width: 400 height: 400 flickable { id: flick anchors.fill: parent contentwidth: 400 contentheight: 40000 } canvas { parent: flick anchors.fill: parent contexttype: "2d" canvassize: qt.size(flick.contentwidth, flick.contentheight) canvaswindow: qt.rect(flick.contentx, flick.contenty, flick.width, flick.height) tilesize: qt.size(20, 20) renderstrategy: canvas.cooperative onpaint: { (var y = region.y; y < region.y + region.height; y += tilesize.height) { (var x = region.x; x < region.x + region.width; x += tilesize.width) { context.fillstyle = "black"; context.fillrect(x, y, tilesize.width, tilesize.height); context.fillstyle = "green"; context.fillrect(x + 1, y + 1, tilesize.width - 2, tilesize.height - 2); } } } oncanvaswindowchanged: requestpaint() } }
Comments
Post a Comment