How to connect to a wifi with qt


Good afternoon, can someone help me? I need to make an application in c ++ using QT. It has to look for wireless connections and connect to a specific one. I hope you can help me

asked by Raudel 26.10.2016 в 18:10

1 answer


If you use version 5.6 (I can not tell if previous versions have it), you have at your disposal the B2QtWifi library that allows you to access WIFI features of the device.

So, for example, you could list the available wifis in a QListView with a code such that (taken from the Qt website):

auto m_wifiManager = QWifiManager::instance();

Connect to the selected Wi-Fi:

QModelIndex index = m_listView->currentIndex();
QWifiConfiguration config;
if (index.isValid()) {
    QString ssid = qvariant_cast<QString>(;
    config.setPassphrase(/* clave para la wifi */);

For more information, I recommend consulting the documentation in its original source:


answered by 26.10.2016 в 22:49