2011-05-01 121 views
0

我正在爲使用Qt諾基亞SDK的Symbian S60手機開發應用程序,該應用程序在我看到的每個視圖中發送請求並從Web服務接收響應。Qt:如何在整個應用程序中使用訪問點?

問題在於它總是要求用戶選擇一個接入點。

所以我想要的是當應用程序啓動時選擇一個訪問點,並在整個應用程序中使用它。

所以,我發現這個例子:http://wiki.forum.nokia.com/index.php/How_to_set_default_access_point_using_Qt_Mobility_APIs

,但我得到以下錯誤:

undefined reference to 'QtMobility::QNetworkConfigurationManager::QNetworkConfigurationManager(QObject*)

我也越來越這些錯誤的從其他類從QMobillity,如:

undefined reference to 'QtMobility::QNetworkSession::open()

.pro文件:

CONFIG += mobility 
MOBILITY += bearer 

標題:

#include <qmobilityglobal.h> 
#include <QtNetwork> 
#include <QNetworkSession> 
#include <QNetworkConfigurationManager> 

QTM_USE_NAMESPACE; 

CPP文件:

 QNetworkConfigurationManager manager; 
     const bool selectIap = (manager.capabilities()& QNetworkConfigurationManager::CanStartAndStopInterfaces); 
     QNetworkConfiguration defaultIap = manager.defaultConfiguration(); 

     if(!defaultIap.isValid() && (!selectIap && defaultIap.state() != QNetworkConfiguration::Active)) 
     { 
      qDebug() << "Network access point NOT found"; 

      // let the user know that there is no access point available 
      msgBox->setText(tr("Error")); 
      msgBox->setInformativeText(tr("No default access point available")); 
      msgBox->setStandardButtons(QMessageBox::Ok); 
      msgBox->setDefaultButton(QMessageBox::Ok); 
      msgBox->topLevelWidget(); 
      msgBox->exec(); 
     } 
     else 
     { 
      qDebug() << "Network access point found and chosen"; 
     } 

     session = new QNetworkSession(defaultIap,this); 
     session->open(); 

任何人有什麼可能是錯誤的想法?

回答

1

你有沒有試過把這個添加到.PRO文件中?

CONFIG += network 
相關問題