QtCreator does not provide code hints for objects registered using setContextProperty in C++. Please refer to the image.
-
wrote on 26 Apr 2023, 02:21 last edited by
As shown in the figure above, I have a QQmlApplicationEngine type variable "m_engine" in HMIApplication. I registered a C++ instance with setContextProperty in QML. This way, the registered type will have code prompts in QtCreator.
However, if I pass the "m_engine" variable in HMIApplication to a member variable "Transfer" in HMIApplication through a pointer, and then register a C++ instance with setContextProperty in QML in the "Transfer" class, there will be no code prompts in QtCreator as shown in the figure. Can you explain why this is happening? Or can you tell me how to have code prompts for instances registered with setContextProperty in QtCreator?
1/1