c++ - QML control and business layers -


i using qml first time , having hard time code organised between control , business layers.

in down earth way, events supposed sent c++ control layer (a c++ class called mycontroller inherits qobject). mycontroller supposed know business layer (say c++ class called mybusiness) , call relevant methods.

my mybusiness complex aggregation of lower level classes put in main.cpp.

previously using qtwidget , able create mybusiness via complex aggregation mentioned above, create mycontroller , provide mybusiness mycontroller job.

now because of qml's way of working, mycontroller exposed qml (via qml registration) , mycontroller q_invokable functions called qml , should in turn call mybusiness functions.

but mycontroller created in qml no longer able let mycontroller know mybusiness.

what best practise in case?

i that:

import qtquick 2.5  item {     mycontroller {         business: businessobj     }      mybusiness {         id: businessobj     } } 

in mycontroller.h:

class mycontroller {     q_object     q_property(mybusiness* business member m_business);     ...     mybusiness *m_business; 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -