The closest to a standard API you can get on Linux desktops probably is UPower (http://upower.freedesktop.org/), which is exposed as the D-Bus interface org.freedesktop.UPower. It features a few interesting signals, such as Sleeping() and Resuming(). See the documentation of Qt D-Bus to know how to interface them with your application.
Bookmarks