指を使って画面に描画する方法はありますか
学校の課題として何かを描くようなBlackberry-10アプリケーションを作成しています
指を使って画面に描画する方法はありますか
学校の課題として何かを描くようなBlackberry-10アプリケーションを作成しています
Qt Quick 2.0 を利用できる場合はCanvas
、QML でオブジェクトを使用できます。onPressed
次のサンプルは、 /onPositionChanged
イベントが発生するたびに赤い線を描画する方法を示しています。
import QtQuick 2.0
Rectangle {
property int startX;
property int startY;
property int finishX;
property int finishY;
Canvas {
anchors.fill: parent
onPaint: {
var ctx = getContext("2d");
ctx.fillStyle = "black";
ctx.fillRect(0, 0, width, height);
ctx.strokeStyle = "red";
ctx.lineWidth = 1;
ctx.beginPath();
ctx.moveTo(startX, startY);
ctx.lineTo(finishX, finishY);
ctx.stroke();
ctx.closePath();
}
MouseArea {
anchors.fill: parent
onPressed: {
startX = mouseX;
startY = mouseY;
}
onPositionChanged: {
finishX = mouseX;
finishY = mouseY;
parent.requestPaint();
}
}
}
}
申し訳ありませんが、私が質問を理解できなかったので、BB10 を使用する予定です。
SDK ドキュメントからこの解決策を試してください。