blob: 21020a397af712329d232d5cd9d220ee3a8e3619 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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.
|