Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Avantages of subclassing Events over defining new Signals and slots
aureshinite last edited by
Is there any advantage of using custom events over using custom signals and slots. I usually go for the signal and slots, because I took this habit from the beginning of my Qt experience. Is there any advantage in code style, performance ,architecture design (or anything else) of using custom events over signals and slots?? When does sub-classing events more appropriate than creating signals and slots?
QMartin last edited by
I think there are no advantages or disadvantages. Each one has its own purpose.
This is from Qt4 programming book:
bq. Copyright (c) 2006 by Jasmin Blanchette and Mark Summerfield. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/).
"...Qt widgets emit signals when something significant occurs. Events become useful when we write our own custom widgets or when we want to modify the behaviour of existing Qt widgets." Chapter 7, page 163.
Hope this answers your question.