diff options
Diffstat (limited to 'docs/checks/README-const-signal-or-slot.md')
-rw-r--r-- | docs/checks/README-const-signal-or-slot.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/checks/README-const-signal-or-slot.md b/docs/checks/README-const-signal-or-slot.md new file mode 100644 index 00000000..21020a39 --- /dev/null +++ b/docs/checks/README-const-signal-or-slot.md @@ -0,0 +1,19 @@ +# const-signal-or-slot + +Warns when a signal or non-void slot is const. + +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 + +For exposing methods to QML prefer either Q_PROPERTY or Q_INVOKABLE. |