Hi you have a problem that consumer is slower then producer and you want to ignore some slot calls.
I suspect that this kind of solution would be for you ok for you.
class Consumer ...
{
private:
bool processingImage;
};
void Consumer
::procesImageSlot(QImage newImage
) {
image = newImage; // store data of this call (newest data)
if (processingImage)
return; // ignore this call, slot call is already in progress
processingImage = true; // mark that slot is processed
QApplication::processEvents();
// process remaining slot calls (events) until event queue is empty
processImageNow(image);
processingImage = false; // mark that processing has ended
}
class Consumer ...
{
private:
bool processingImage;
QImage image;
};
void Consumer::procesImageSlot(QImage newImage)
{
image = newImage; // store data of this call (newest data)
if (processingImage)
return; // ignore this call, slot call is already in progress
processingImage = true; // mark that slot is processed
QApplication::processEvents(); // process remaining slot calls (events) until event queue is empty
processImageNow(image);
processingImage = false; // mark that processing has ended
}
To copy to clipboard, switch view to plain text mode
Bookmarks