On C++ lamdas and QTimer. What does this warning mean, and how to get rid of it?

Viewed 970

This question is marked as a duplicate of another question that concerns qt's connect-method. But since my code does not call connect my question cannot be a duplicate. Maybe the answers to the two questions are related somehow, but the two questions are not similar.

I am programming in C++ using Qt Creator on a Mac (clang compiler).

As is displayed in the screenshot above, the following line of code:

QTimer::singleShot(100.0, [this](){ this->timeout();});

yields the warning:

Pass a context object as 2nd singleShot parameter [clazy-connect-3arg-lambda]

What does this warning mean and how to get rid it?

enter image description here

1 Answers

this post explain about the concept of context in Qt. In your case i believe passing this as context will solve your problem.

Related