Qt-InstallEventFilter

Warns on potential misuse of QObject::installEventFilter()

Required inputs: IR

Warns on potential misuse of QObject::installEventFilter(). To install an event filter you should call monitoredObject->installEventFilter(this), but sometimes you'll write installEventFilter(filterObject) by mistake, which compiles fine.

In rare cases you might actually want to install the event filter on this, in which case this is a false-positive.

This rule is based on clazy rule install-event-filter

Possible Messages

Key

Text

Severity

Disabled

install_filter

“this” should usually be the filter object, not the monitored one.

None

False

missing_event_filter

The class of “this” should override QObject::eventFilter.

None

False

Options

level

level : int = 1

Importance level of the rule as given for clazy. 0 is most desirable, higher values fall off in quality.