[Android-development] Look of widgets on Android
A. Savelov
s_savelov at mail.ru
Mon Dec 29 08:59:12 CET 2014
You understood me right: I wanted to clip off left 200 pixels. In general, I'm seeking for approach in Qml similar to QScrollArea in widgets, where I can dynamically form and draw part of the scene which is updated (in widgets I could get rect for update from QPaintEvent). The main criterion is effectiveness.
Mon, 29 Dec 2014 07:43:41 +0000 от Rutledge Shawn <Shawn.Rutledge at theqtcompany.com>:
>
>On 26 Dec 2014, at 13:53, A. Savelov < s_savelov at mail.ru > wrote:
>
>> Hello!
>>
>> It seems that canvasWindow doesn't change its position or I'm doing smth wrong.
>> This is my qml code, whick draws line from (0,0) position instead of (200,0)
>>
>> import QtQuick 2.4
>> import QtQuick.Window 2.2
>>
>> Window {
>> visible: true
>>
>> Canvas {
>> id: canvas
>> canvasSize: "1000x1000"
>> tileSize: "100x100"
>> canvasWindow: Qt.rect(200,0,300,300);
>>
>> onPaint: {
>> var ctx = getContext("2d");
>> ctx.save();
>>
>> ctx.strokeStyle = "red";
>> ctx.lineWidth = 20;
>>
>> // ![0]
>> ctx.beginPath();
>> ctx.moveTo(0,0);
>> ctx.lineTo(1000,1000);
>> ctx.closePath();
>> ctx.stroke();
>> // ![0]
>>
>> ctx.restore();
>> }
>> }
>> }
>
>That is not specific to Android. It doesn’t seem like correct behavior to me; not sure. You expected it to clip off the left 200 pixels, right? But it’s the same on desktop platforms. Setting clip: true doesn’t make a difference. All the autotests in qtdeclarative/tests/auto/quick/qquickcanvasitem are passing though, and some of them are testing canvasWindow.
>
>If you wanted to offset it, you can of course set the x and y since it’s an Item.
Best regards, A.Savelov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20141229/c66dc72b/attachment.html>
More information about the Android-development
mailing list