Den 08-08-2014 14:03, Till Oliver Knoll skrev: > Am 08.08.2014 um 12:15 schrieb Giuseppe D'Angelo <giuseppe.dang...@kdab.com>: > >> Il 08/08/2014 10:51, Bo Thorsen ha scritto: >>> The order of the slots execution is undefined. You can not rely on it. >> >> Generally speaking it *is* defined: slot activation follows the order of the >> connect() statements (*). > > But, but...! > > >> >> ... >> >> (*) It has been finalized, by documenting it, around Qt 4.6. I guess simply >> too many people were relying on that behaviour > > I was just about to complain ;) Didn't realise that this behaviour > has been made "official" now :)
Yep, it says so on the internet (http://qt-project.org/doc/qt-5/signalsandslots.html) so it must be true :) > It might be okay if you have a /single/ class connecting to a given > signal "in a well-defined order". But as soon as slots of multiple > classes are to be connected to a given signal "in a well-defined > order" such a design would probably be doomed to fail rather sooner > than later, IMHO. As long as your application is single threaded, then the order is perfectly well defined. If you think of connections as implementations of the visitor pattern with one visitor object in a list of signals, then it's not hard to do this. Emitting a signal and the connected slot calls are exactly the same as calling any C++ function, so the order is easy. The most surprising thing to me is that it took until 4.6 before this was documented, since there doesn't seem to be any good reason not to implement connects as a list and call these one after the other. Bo. -- Viking Software Qt and C++ developers for hire http://www.vikingsoft.eu _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest