If I connect the same signal with the same slot twice, would this cause a bug? e.g the slot get called twice when the signal is emitted?
Short answer: Your slot would be called twice.
Whether this causes bugs or is the desired behaviour depends on your application of course.
In most cases it is probably not wanted, so to prevent this you can either track your connections, use disconnect first or if you are using at least Qt 4.6 there is a new connection type Qt::UniqueConnection
which prevents duplicate connections automatically and otherwise behaves like Qt::AutoConnection
, see connection types and a blog post about the new unique type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With