Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 91
Registered: ‎09-25-2012
My Device: bb10 alpha
My Carrier: free
Accepted Solution

paintEvent for custom QML element

From Qt, it was easy to custom a QML element by reimplement the paintEvent() and use a QPainter. 

Is there a way from Cascade to custom a QML element ? For example, create PieChart Element as the document show above :




a lover of Qt
Posts: 24
Registered: ‎09-10-2012
My Device: Blackberry Dev Alpha
My Carrier: -

Re: paintEvent for custom QML element

Cascades does all its rendering in a seperate thread and does not expose any API for custom rendering/painting.


There are two workarounds for this:

  1. Using the ForeignWindow class, it is possible to embed a window in the Cascades scene. Therefore you could create your own window and paint your window in any way you like - OpenGL or using QPainter on a QImage, with the QImage being backed by the actual window buffer.
  2. Paint to a QImage and use that as a source for a PaintDefinition inside an ImageView