Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 8

Qt-interest Archive, March 2002
Basic help with QCanvas


Message 1 in thread

Hi, sorry for the stupid question, but I can't figure out how to draw on
a QCanvas. I have created a QCanvas, a QCanvasView, and a QCanvasLine.
All I can see is the blank canvas. I have tried setting the endpoints of
the line using QCanvasLine.setPoints() and setting the Y position of the
line using QCanvasLine.setY(), but the line never appears. What am I
missing?

And what is the coordinate system for a canvas? All other widgets use
the standard 1 pixel = 1 unit, origin in upper left corner, x positive
to the right and y positive down. In the documentation they start taking
about floating point coordinates and I don't know what the relationship
is.

Thanks

Sean Marble
AMET, Inc.
sean_m@ametinc.com


Message 2 in thread

On Thu, 21 Mar 2002, Sean Marble wrote:

> Hi, sorry for the stupid question, but I can't figure out how to draw on
> a QCanvas. I have created a QCanvas, a QCanvasView, and a QCanvasLine.
> All I can see is the blank canvas. I have tried setting the endpoints of
> the line using QCanvasLine.setPoints() and setting the Y position of the
> line using QCanvasLine.setY(), but the line never appears. What am I
> missing?

Did you call show() on the line item ? Read the respective note in the
documentation.

> And what is the coordinate system for a canvas? All other widgets use
> the standard 1 pixel = 1 unit, origin in upper left corner, x positive
> to the right and y positive down. In the documentation they start taking
> about floating point coordinates and I don't know what the relationship
> is.

Still the same orientation of the coordinate system. Just that the
coordinates have a higher precision.

Harri.


Message 3 in thread

Hehe.  I think you just need to call show() on your QCanvasItem.. and
possibly even update() on your canvas to commit change operations.

-Calin

On Thu, 21 Mar 2002, Sean Marble wrote:

> Hi, sorry for the stupid question, but I can't figure out how to draw on
> a QCanvas. I have created a QCanvas, a QCanvasView, and a QCanvasLine.
> All I can see is the blank canvas. I have tried setting the endpoints of
> the line using QCanvasLine.setPoints() and setting the Y position of the
> line using QCanvasLine.setY(), but the line never appears. What am I
> missing?
>
> And what is the coordinate system for a canvas? All other widgets use
> the standard 1 pixel = 1 unit, origin in upper left corner, x positive
> to the right and y positive down. In the documentation they start taking
> about floating point coordinates and I don't know what the relationship
> is.
>
> Thanks
>
> Sean Marble
> AMET, Inc.
> sean_m@ametinc.com
>
> --
> List archive and information: http://qt-interest.trolltech.com
>