Qt-ConstSignalOrSlot¶
Warns when a signal or non-void slot is const
Required inputs: IR
This aims to prevent unintentionally marking a getter as slot, or connecting to the wrong method.
For signals it's more of a minor issue. Prevents you from emitting signals from const methods, as these methods shouldn't change state, and a signal implies state was changed. Helps minimizing having global state (which is the only state you can change from a const method).
Warns for the following cases:
- non-void const method marked as slot
- const method marked as signal
- connecting to a method which isn't marked as slot, is const and returns non-void
This rule is based on clazy rule const-signal-or-slot
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
const_signal |
Signal should not be const. |
None |
False |
getter_slot |
Getter possibly mismarked as a slot. |
None |
False |
possible_getter_in_connect |
Method argument in connect is not a slot but possibly a getter. |
None |
False |
Options¶
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
level¶
level : int = 1