How to mix QML view part with a Qt model code.
-
Hi, Im looking for some information of how can I make a program using QML as view code and the other code (model) with normal Qt code.
Well, I saw this articles "Integrating QML ...":http://qt-project.org/doc/qt-4.8/qml-integration.html and "Using QML":http://qt-project.org/doc/qt-4.8/qtbinding.html but I think I need some examples or more information about ...
Any help, will be grateful.
Charlie Hdz, Wiwiped
-
Hi,
For Qt5 see "this":http://doc.qt.io/qt-5/qtquick-modelviewsdata-cppmodels.html and for Qt4, "this":http://qt-project.org/doc/qt-4.8/qdeclarativemodels.html.
-
If you are looking for another example, you can take a look at "the QxModelView module of QxOrm library":http://www.qxorm.com/doxygen/html/group___qx_model_view.html : this is an implementation of the QAbstractItemModel Qt class and allows to display in QML views (and Qt Widgets too) all classes/properties registered into QxOrm context.
The source code is available in the QxOrm package.
There is a FAQ here : http://www.qxorm.com/qxorm_en/faq.html#faq_300
And there is a sample project in the ./test/qxBlogModelView/ directory of QxOrm package.And with QxEntityEditor, you can also generate the source code for nested models to manage relationships between entities (1-n, n-1, n-n, 1-1).