CanvasGraphicsItem
is a floating drawable
component that is connected to its parent Canvas
. Every CanvasGraphicsItem
can have only
one parent at a time. Parent must be set before any other operation
is done with the item.
When created, the CanvasGraphicsItem
is not
visible and must be set visible with setVisible()
.
The CanvasGraphicsItem
has the same drawing
capabilities as Canvas
. The paint()
method is declared abstract, and so the application must provide
an implementation in its subclass. The whole CanvasGraphicsItem
is transparent, so every other item on Canvas
(TextEditor
and CanvasGraphicsItem
) and everything painted on Canvas
can be seen. Graphics
does not support transparency, so everything
drawn by it is opaque. To draw something with different level of transparency,
the application must use DirectGraphics
instead.
CanvasGraphicsItem
can be used for drawing
moving transparent and opaque objects multiple times, or for scroll
bars, frames, buttons and so on. The main use case of the CanvasGraphicsItem
is drawing content on top of the editor,
such as pop ups, option lists and mouse pointers.