qt make widget ignore mouse events

C++
theWidget->setAttribute(Qt::WA_TransparentForMouseEvents);
Source

Also in C++: