Qt-OldStyleConnect

Warns when using old style connects SIGNAL/SLOT, which is slower than using pointer to member syntax

Required inputs: IR

Finds usages of old style connects. Connecting with old style syntax (SIGNAL/SLOT) is much slower than using pointer to member syntax (PMF).

Here is however a non-exhaustive list of caveats you should be aware of:

  • You can not disconnect with new-syntax if the connect was made with old-syntax (and vice-versa)
  • You can not disconnect from a static slot with new-syntax (although connecting works)
  • Difference in behaviour when calling slots of partially destroyed objects (https://codereview.qt-project.org/#/c/83800)

Although this check does not have false-positives it is a level2 check, that is because some connects are tricky to convert to PMF syntax and might introduce bugs if you do not know what you are doing.

Possible Messages

Key

Text

Severity

Disabled

old_style_connect

Old style connect (SIGNAL/SLOT) is being used.

None

False

Options

ignore_private_slots

ignore_private_slots : bool = True

Do not report old style connects given via any Q_PRIVATE_SLOT.
 

level

level : int = 0

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