On Tue, 22 Nov 2011 22:55:39 ext Sandro Andrade wrote:
> Just to make it clearer:
> 
> From docs:
> "You may want to mix QML and C++ for a number of reasons. For example:
> ...
> To write your own QML elements (whether for your applications, or for
> distribution to others)"
> 
> iirc, we have two approaches for creating new QML elements: as QML
> documents and as QObject-based C++ classes:
> I'm wondering about the criteria to choose the most suitable approach:
> 
> - With C++ classes you have virtually unlimited functionality but you
> cannot build upon already
> existing QML elements (eg. dynamic elements creation) without linking
> to private headers.
> - With QML documents you have others QML elements at your disposal but
> functionality is
> restrict to what you can do with javascript.
> 
> Is that right ?

There is a third option - hybrid elements. For example:

MyItem.qml
import QtQuick 2.0
import CustomModule 0.1
Flickable{
        MyCppMadeItem{
                magic: parent.contextX
        }
}

So you can create C++ items which can bind to and interact with QML items in 
QML. This lifts the majority of your restrictions, but still simplifies QML 
element creation (because it only has a public QML API to worry about).

-- 
Alan Alpert
Senior Engineer
Nokia, Qt Development Frameworks
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to