Nominate our 2022 Qt Champions!

Behaviour of a c++ model update from a different thread from which the QML QtQuick2 engine is running



  • The scenario has following components:

    • C++ QAbstractItemModel derived model class created in main thread
    • QML QtQuick2 Engine instantiated in main thread
    • Worker boost::thread spawned from main thread upon user interaction

    The relations between these components:

    • The C++ model is exposed through a Q_PROPERTY of a type registered with qmlRegisterSingletonType<>() to the QML Engine.
    • The worker thread updates the model through a method that invokes "emit data_changed(...)"

    The question: in which thread does the callback of the "emit data_changed(...)" happen?

    Note

    A key element in this question is that the started thread is not qt aware.

    This question is also posted here


Log in to reply