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
smime.p7s
Description: Firma crittografica S/MIME
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development