【问题标题】:Qt: How to use an accesspoint throughout the application?Qt:如何在整个应用程序中使用接入点?
【发布时间】:2011-10-22 15:28:42
【问题描述】:

我正在使用 Qt Nokia SDK 为 Symbian S60 手机开发一个应用程序,它在我拥有的每个视图中发送请求并接收来自网络服务的响应。

问题在于它总是要求用户选择一个接入点。

所以我想要的是在应用程序启动时选择一个接入点,并在整个应用程序中使用它。

所以我找到了这个例子:http://wiki.forum.nokia.com/index.php/How_to_set_default_access_point_using_Qt_Mobility_APIs

但我收到以下错误:

对 'QtMobility::QNetworkConfigurationManager::QNetworkConfigurationManager(QObject*) 的未定义引用

我还从 QMobillity 的其他类中获得了更多这些错误,例如:

对 '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();

有人知道可能出了什么问题吗?

【问题讨论】:

    标签: qt nokia qt-mobility access-point


    【解决方案1】:

    您是否尝试将其添加到 .PRO 文件中?

    CONFIG += network 
    

    【讨论】:

      猜你喜欢
      • 2013-02-05
      • 1970-01-01
      • 1970-01-01
      • 2017-08-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-20
      相关资源
      最近更新 更多