[Development] [fix]: Assistant (and others) burning CPU because of #f27d1ccbb24ec2fd4098f2976503478831006cc8 ?
Giuseppe D'Angelo
giuseppe.dangelo at kdab.com
Wed Aug 30 11:31:43 CEST 2017
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.dangelo at kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908
KDAB - Qt, C++ and OpenGL Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20170830/b1fcdfd5/attachment.bin>
More information about the Development
mailing list