Results 1 to 6 of 6

Thread: Understanding QNetworkConfigurationManager

  1. #1
    Join Date
    Apr 2011
    Posts
    231
    Thanks
    141
    Thanked 6 Times in 5 Posts

    Default Understanding QNetworkConfigurationManager

    Qt Code:
    1. QNetworkConfigurationManager manager;
    2.  
    3. if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired)
    4. {
    5. }
    To copy to clipboard, switch view to plain text mode 

    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/qnetw...l#capabilities

    That is very vague, "which" capabilities exactly are we talking about here?

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Understanding QNetworkConfigurationManager

    They are described here here.

  3. The following user says thank you to Zlatomir for this useful post:

    TheIndependentAquarius (21st September 2011)

  4. #3
    Join Date
    Apr 2011
    Posts
    231
    Thanks
    141
    Thanked 6 Times in 5 Posts

    Default Re: Understanding QNetworkConfigurationManager

    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?
    Last edited by TheIndependentAquarius; 21st September 2011 at 11:15.

  5. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Understanding QNetworkConfigurationManager

    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):
    Qt Code:
    1. std::cout << std::hex << number;
    To copy to clipboard, switch view to plain text mode 

  6. The following user says thank you to stampede for this useful post:

    TheIndependentAquarius (21st September 2011)

  7. #5
    Join Date
    Apr 2011
    Posts
    231
    Thanks
    141
    Thanked 6 Times in 5 Posts

    Default Re: Understanding QNetworkConfigurationManager

    Quote Originally Posted by stampede View Post
    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.

  8. #6
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Understanding QNetworkConfigurationManager

    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)

Similar Threads

  1. QUdpSocket understanding
    By ale301168 in forum Qt Programming
    Replies: 4
    Last Post: 7th July 2011, 07:33
  2. Replies: 0
    Last Post: 17th June 2011, 09:01
  3. Replies: 1
    Last Post: 17th February 2011, 21:53
  4. QNetworkConfigurationManager problem after qt build
    By Le_B in forum Installation and Deployment
    Replies: 10
    Last Post: 10th November 2010, 11:30
  5. Understanding RGB888
    By scarleton in forum Qt Programming
    Replies: 6
    Last Post: 29th August 2010, 20:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.