Now i got another question. I tried using QNetworkConfigurationManager.
If connection situation changes program succesfully sends a signal. The signal is onlineStateChanged(bool)
If i use QNetworkConfigurationManager::isOnline() function inside a constructor. It fails. Maybe a bug?
Here is my code inside constructor :
networkConfigurationManager = new QNetworkConfigurationManager(this);
// If there is network connection, close the program
if(networkConfigurationManager->isOnline() == true)
{
this->close();
}