Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to get event when desktop comes back from sleep mode and LAN disconnect event
I have an sip based application and the front end is in QT. I need to handle event when my desktop comes back after sleep mode and LAN disconnect events. Can you please help me how to handle these event. I couldn't find any Qt class which provide me these api's.
Can somebody help me in this?
Which OS are you targeting? Those are OS specific events(there is no sleep/wake up on some), so there's no unified way to check it.
You can implement the "nativeEvent":http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#nativeEvent method and try fishing for those events there.
On Windows for example you should get "WM_POWERBROADCAST":http://msdn.microsoft.com/en-us/library/Aa373247 message when the system wakes up.
I am developing application for windows desktop. Basically i need to check network disconnect in my application and one condition is sleep mode. I checked WM_POWERBROADCAST event and it works fine but for LAN disconnect it send USB disconnect message(WM_DEVICECHANGE). Can you help me what should i do for lan disconnect.
I tried using QNetworkConfigurationManager's signal onlineStateChanged ( bool isOnline ) but somehow it doesnt work properly.
If i do wlan disconnect then my network switch to LAN and if i disable LAN also then sometimes it detect that netowrk goes offline but not always. Can you suggest what should i do for this problem
I don't know a way to get notified via event or something like that, but you might try to check periodically (with a sparse QTimer for example) for the network availability.
Here's an example (in the comments) how to do that with INetworkManager interface: "INetworkListManager interface":http://msdn.microsoft.com/en-us/library/windows/desktop/aa965303.aspx