Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions
threading strategy question
VStevenP last edited by
Now I would like to move the MIDI I/O operations to another thread(s), because in my application, the graphical knob updates can become slow when MIDI traffic is high and when there is a lot of pre-post MIDI processing to do.
What is the best approach? I've read the QThread documentation, but it is not quite obvious which strategy I should use. I'm trying to think it through.
I suppose I need a class that inherits from QAbstractListModel, which I can expose to QML via the root context, to provide data values to my on-screen graphical knobs. I guess this class should be instatiated in main() and root context set there. It is in the main thread.
Then this class would have its model populated from the MIDI I/O results. Maybe I would have a "MIDI In" Worker object and also a "MIDI Out" Worker object, and each one would have its own Controller class with its own QThread.
Finally, the object of my class which is derived from AbstractListModel model would need to interact with the Worker objects for MIDI In and Out via signals/slots.
Is this approach reasonable?
You are trying to create the MIDI objects in separate thread & trying to push the data using the signal/slot to model. This approach can be taken.