Hello and thanks,
I agree, the model should not need to know about the view. I think I might add something in the GUI like:
void DataView::updateView()
{
if (m_displaying) return;
m_displaying = true;
float* data = m_processor->getData();
doTheUpdate(data);
m_displaying = false;
}
void DataView::updateView()
{
if (m_displaying) return;
m_displaying = true;
float* data = m_processor->getData();
doTheUpdate(data);
m_displaying = false;
}
To copy to clipboard, switch view to plain text mode
The updateView() slot should be running in the GUI context as in my case I have used the QueuedConnection. If this is really the case, then the signal-slot mechanism must post the signal into the GUI's event queue which entails that the slot would be processed anyway the next time the GUI has redrawn the View. Having said that, perhaps the previous code is redundant?
What I am after is that the GUI draws the data as often as it can, and with as little delay to the data being available as possible.
I guess in the processor I will use some form of double buffering, such that the getData() method will return a pointer to a data area that is not currently written to. The processor should then manage which area it can write to and which area can be read from. I am not quite sure yet how to do that though.
Regards,
peter
Bookmarks