On Thursday, 8 August 2013 19:32:13 CEST, Thomas Lübking wrote:
If you want to "skip the event loop" you should ask to "skip the event loop" and not hope "QTimer will skip the event loop" Notice that aside the pointless QTimer dependency, the default timer in Qt5 will be the coarse one, ie. if Qt keeps that client code fix up, QTimer::singleShot(0,.) does actually not do what it suggests.
Qt5's QTimer contains a special case for QTimer::singleShot(0) (I suspect a lot of stuff would break if it was removed).
Yes, it's a very popular abuse, doesn't change it's an abuse.
I started using QTimer::singleShot(0) many years ago because that's what the documentation mentioned ("As a special case, a QTimer with a timeout of 0 will time out as soon as all the events in the window system's event queue have been processed."). My eyes are nowadays used to this syntax and do not consider it an abuse, but that could very well be just a result of many ears of exposure.
I'd like to improve my Qt-fu, so I'm curious -- why do you consider this an abuse? If it's indeed an abuse, the QTimer's docs shall be changed so that it at least *talks* about QObject::invokeMethod and possibly recommend this over QTimer.
Cheers, Jan -- Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/