interfaceFromName() expects interface name returned by QNetworkInterface::name() (ie "{D6637618-7E2B-466B-B02B-C35A1FA9118F}") not QNetworkInterface::humanReadableName().
So, if you want to find interface by human readable name you have to loop through the interfaces and find it yourself.
In the end it's only few lines of code:
Qt Code:
for( int i = 0; i < it.size(); ++i ) { if( it.at( i ).humanReadableName() == "Local Area Connection" ) { qDebug() << it.at( i ).hardwareAddress(); break; } }To copy to clipboard, switch view to plain text mode
Bookmarks