21.02.2020, 16:18, "Ville Voutilainen" <ville.voutilai...@gmail.com>: > On Fri, 21 Feb 2020 at 14:58, Sérgio Martins <sergio.mart...@kdab.com> wrote: >> > Why do I need to know that it's a signal being emitted? How is that >> > "vital information"? I could just as well >> > invoke any other callback, but I find myself not exactly yearning for >> > being able to write >> > callback somethingHappened(); >> >> Signals have different semantics than regular functions. > > In what way? > >> If I'm reading the body of makePlane() I can ignore the signal >> emissions, as they aren't important for how a plane is made, they just >> inform whoever is listening. > > That doesn't seem to be correct in general. Some signals absolutely > must be emitted > for clients to work correctly. > >> And I'd argue that the emitter shouldn't even know who or how many slots >> are connected to the signal, might even be zero, it shouldn't matter. > > ..and? What does that have to do with whether you do or do you emit?
E.g. it's possible to check if there are any listeners on the signal, and make a shortcut in code if there aren't any. I've seen such code somewhere in qtwidgets -- Regards, Konstantin _______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development