Welcome!

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

Reply
Developer
Posts: 91
Registered: ‎09-25-2012
My Device: bb10 alpha
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 :

http://qt-project.org/doc/qt-4.8/declarative-tutorials-extending-chapter1-basics.html 

 

 

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

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