Help Connecting to a wifi
-
Hello.
I have this code that does a list of Network Connections(ppp0, em1, wlan0) of my machine
@
void MainWindow::ListConnections(){
QList<QNetworkConfiguration> confList = manager->allConfigurations();
int i=0;
for(i;i<confList.count();i++){
ui->listWidget->addItem(new QListWidgetItem(confList.at(i).name()));
}}
@
i want to use one of those returned connections(wlan0), to connect, how can i do that?
Thanks... -
you won't get around using your target OS's api to do that...
There is no Qt to do it if your asking for such a solution. -
Hi,
Are you thinking of something like "that":http://qt-project.org/doc/qt-4.8/qnetworkaccessmanager.html#setConfiguration ?
-
yes but setting the configuration is
@
QNetworkConfigurationManager manager;
networkAccessManager->setConfiguration(manager.defaultConfiguration());@
i need one to be choosen from the list...Thanks...
-
That's just the example to use the default configuration.
So you mean something like:
@QList<QNetworkConfiguration> confList = manager->allConfigurations();
foreach(QNetworkConfiguration configuration, confList){
if (configuration.name() == "wlan0") {
manager->setConfiguration(configuration);
break;
}
}
@?