View Full Version : Understanding QNetworkConfigurationManager
TheIndependentAquarius
21st September 2011, 10:45
QNetworkConfigurationManager manager;
if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequir ed)
{
}
Now, when I looked up the documentation for capabilities(), all I got was this:
Returns the capabilities supported by the current platform.
from: http://doc.qt.nokia.com/stable/qnetworkconfigurationmanager.html#capabilities
That is very vague, "which" capabilities exactly are we talking about here?
Zlatomir
21st September 2011, 10:49
They are described here here (http://doc.qt.nokia.com/stable/qnetworkconfigurationmanager.html#Capability-enum).
TheIndependentAquarius
21st September 2011, 11:15
That was helpful, thanks.
Added after 21 minutes:
and I am getting "16" with std :: cout << manager.capabilities();
which is not listed in that list, what is that supposed to mean?
stampede
21st September 2011, 11:48
It is listed, capabilities are presented in hexadecimal form.
So "16" means 0*(16^0) + 1*(16^1) = 0x10 = 0x00000010 = QNetworkConfigurationManager::ForcedRoaming
You can print hex values with std::cout (if I remember correctly):
std::cout << std::hex << number;
TheIndependentAquarius
21st September 2011, 12:31
It is listed, capabilities are presented in hexadecimal form.
So "16" means 0*(16^0) + 1*(16^1) = 0x10 = 0x00000010 = QNetworkConfigurationManager::ForcedRoaming
Actually I checked the value of 16 in hex through a calculator before posting here, it didn't show 10, I must have used it wrongly, apologies && thanks.
Zlatomir
21st September 2011, 12:47
The int value might not match any of those, because that "flag" value is most likely a combination (not a single value from that list).
So don't convert that to int, just use it like in the example code you gave: if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequir ed) //see the operator there (is bitwise and - is not logical and)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.