[Qt-qml] (newbie) how can I use my C++ widget in QML?

Raymond de Vries reedev at xs4all.nl
Wed Oct 6 12:12:55 CEST 2010


  Hi Eduardo!

On 10/6/2010 11:25 AM, Eduardo Fleury wrote:
> Hi there!
>
> On Wed, Oct 6, 2010 at 6:01 AM, Raymond de Vries <reedev at xs4all.nl 
> <mailto:reedev at xs4all.nl>> wrote:
>
>     I have been creating applications with the C++ API and have some
>     custom
>     widgets, e.g. for OpenGL rendering. Now I would like to use these
>     widgets in my QML based UI application.
>
>
> Which kind of widgets are these? QGraphicsWidgets? QWidgets?
>
> QML scene is a QGraphicsItem scene, so you are able to add 
> QGraphicsWidgets to it. I'm not much into that but my understanding is 
> that you must ensure your widgets have a default constructor (there's 
> no way to give constructors parameters within QML) and then you must 
> register your class (qmlRegisterType) so it is visible in QML.
That's interesting info. These are not derived from QGraphicsWidget 
since I used to add these to the QGraphicsScene with addWidget().

Would there be an example somewhere? It is also interesting to know how 
I can add these widgets to Creator, I assume with a dll.
>
> There must be something about that in the docs, check for qmlRegisterType.
I am already trying to add DropShadow etc to my QML application and I 
need qmlRegisterType for that too, so it seems. No idea yet how to use that.

regards
Raymond

>
> -- 
> Eduardo M. Fleury
> OpenBossa - INdT
> http://eduardofleury.com/
> http://www.openbossa.org/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20101006/eedf2c47/attachment.html 


More information about the Qt-qml mailing list