Ok, the only thing I can do for now for you is to provide you the tests I did this morning with the
qxBlogModelView sample project.
So I attach to this topic the
qxBlogModelView.zip file which contains my tests.
You can unzip it and replace this sample project in the
./test/ directory of QxOrm package.
I added to this sample project a third screen to show how to display relationship values.
The interesting part for you is :
- the
./qt/rcc/documents/main_relationship.qml QML file ;
- the way this component is loaded :
- Code: Select all
void test_qml_view_with_relationship()
{
#if (QT_VERSION >= 0x050000)
qx::IxModel * pModel = new model_view::blog_model();
pModel->qxFetchAll(QStringList() << "*");
QQuickView qmlView;
QString sQmlFile = "qrc:/documents/main_relationship.qml";
qmlView.rootContext()->setContextProperty("myModel", pModel);
qmlView.setSource(QUrl(sQmlFile));
qmlView.show();
qApp->exec();
#endif // (QT_VERSION >= 0x050000)
}
EDIT : in a previous answer, you wrote :
- Code: Select all
qx::IxModel *pModel = new qx::QxModelService<customer_main_record, services::customer_main_record_services>;
pModel->qxFetchAll_();
engine.rootContext()->setContextProperty("customersModel", pModel);
This is wrong !
instead of
qx::QxModelService<customer_main_record, services::customer_main_record_services>, you must use the class generated by QxEntityEditor !
It could explain why the Q_INVOKABLE function are not available in QML, because this is the wrong C++ type !
It should be something like this :
- Code: Select all
qx::IxModel *pModel = new customer_main_record_model();
pModel->qxFetchAll_();
engine.rootContext()->setContextProperty("customersModel", pModel);