Qt/QML qmlRegisterType vs. setContextProperty (difference)

后端 未结 2 1278
被撕碎了的回忆
被撕碎了的回忆 2020-12-14 12:11

In Qt/QML application (this code usually resides in main.cpp of QtCreator project), what is the difference between following ways of exposing C++ class to QML:<

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-14 12:56

    In the first one you are declaring a C++ type available for instantiation in QML, in the second you are declaring a global variable "uePeopleModel" of the same type.

提交回复
热议问题