> Today, that QObject::schedule is achieved by (ab)using QTimer::singleShot(0, func).
There have been interesting discussions on StackOverflow about this : https://stackoverflow.com/questions/21646467/how-to-execute-a-functor-or-a-lambda-in-a-given-thread-in-qt-gcd-style https://stackoverflow.com/questions/24142450/qtimersingleshot-and-qmetamethodinvoke Best Jean-Michaël ------- Jean-Michaël Celerier http://www.jcelerier.name On Wed, Aug 30, 2017 at 11:31 AM, Giuseppe D'Angelo < giuseppe.dang...@kdab.com> wrote: > Il 30/08/2017 11:28, Morten Sørvig ha scritto: > >> There is also the option of creating new API that better covers the use >> case of >> running a pice of code once when control returns to the event loop. In >> use this >> could look something like this: >> >> QCocoaMenu::scheduleUpdate() >> { >> if (m_updateScheduled) >> return; >> m_updateScheduled = true; >> >> this->QObject::schedule([&m_updateScheduled, m_nativeMenu](){ >> m_updateScheduled = false; >> [m_nativeMenu update]; >> }); >> } >> > > Today, that QObject::schedule is achieved by (ab)using > QTimer::singleShot(0, func). I'd encourage a better named API. > > My 2 c, > -- > Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer > KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908 > KDAB - Qt, C++ and OpenGL Experts > > > _______________________________________________ > Development mailing list > Development@qt-project.org > http://lists.qt-project.org/mailman/listinfo/development > >
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development