Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.0.0
-
None
-
21c1cfb8674c0af9f52ef57c4fbd47f0bc78546f
Description
Hi,
This link:
http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-pathcurve.html
contains this example:
—
import QtQuick 2.0
Canvas {
width: 400; height: 200
Path {
id: myPath
startX: 0; startY: 100
PathCurve { x: 75; y: 75 }
PathCurve { x: 200; y: 150 }
PathCurve { x: 325; y: 25 }
PathCurve { x: 400; y: 100 }
}
onPaint: {
context.strokeStyle = Qt.rgba(.4,.6,.8);
context.path = myPath;
context.stroke();
}
}
—
Which is... flawed!
This is the working version:
—
import QtQuick 2.0 Canvas { id: canvas width: 400; height: 200 Path { id: myPath startX: 0; startY: 100 PathCurve { x: 75; y: 75 } PathCurve { x: 200; y: 150 } PathCurve { x: 325; y: 25 } PathCurve { x: 400; y: 100 } } onPaint: { var ctx = canvas.getContext('2d'); ctx.strokeStyle = Qt.rgba(.4,.6,.8); ctx.path = myPath; ctx.stroke(); } }
—
Note: please do test out examples if you put them in the documentation. It's "kinda" annoying when i try an example and get run errors...
Cheers,
Mark
Attachments
For Gerrit Dashboard: QTBUG-29114 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
44829,1 | PathCurve documentation: fix non-working example snippet | stable | qt/qtdeclarative | Status: MERGED | +2 | 0 |