Wednesday, August 21, 2013

qml example: Draw text on Canvas

qml example: Draw text on Canvas
qml example: Draw text on Canvas


import QtQuick 2.0

Rectangle {
    width: 360
    height: 360

    Canvas {
        anchors.fill: parent

        onPaint: {
            var ctx = getContext('2d');
            ctx.font="50px";
            ctx.fillText("qteveloper", 50, 150);
            ctx.font="20px";
            ctx.strokeText("qteveloper.blogspot.com", 50, 200);

        }

    }
}