[Qt-interest] having Qt-based application notified on system standby/hibernate events

Konstantin Tokarev annulen at yandex.ru
Wed Feb 23 18:12:32 CET 2011



23.02.2011, 19:01, "Crni Gorac" <cgorac at gmail.com>:
> On Wed, Feb 23, 2011 at 1:19 AM, Tony Rietwyk
> <tony.rietwyk at rightsoft.com.au>; wrote:
>
>>  Hi Crni,
>>
>>  Have a look at QCoreApplication::winEventFilter and
>>  QApplication::macEventFilter.  Log the messages received during system
>>  shutdown and then analyze the log to see which messages to act on.
>
> Thanks for the suggestion.  Indeed, on Windows I was able to get
> notifications through catching WM_POWERBROADCAST message in
> winEventFilter() override.  On Mac, I think also I found how to
> register for notifications in native code:
>    http://developer.apple.com/library/mac/#qa/qa2004/qa1340.html
> I'm using Cocoa-based Qt build, thus Listing 1 from the above link
> applies.  So it seems rather simple in Objective C, and I know gcc
> make it possible to use Objective C code alongside with C++ code.
> However, I have no clue on how to actually register my QObject derived
> class as "observer" (in Cocoa lingo) for these notifcations.  So - any
> suggestions or pointers on how to connect Objective C notifications
> and Qt event loop?

Create Obj-C observer and call your Qt code from it

-- 
Regards,
Konstantin



More information about the Qt-interest-old mailing list