How do I get phone info in QT? (carrier, device model, device manufacturer)

送分小仙女□ 提交于 2019-12-25 01:52:41

问题


I've found something like below on the net

//Get S60 version and display it on label
switch (QSysInfo::s60Version ())
{
    case QSysInfo::SV_S60_3_1: return "S60 version: S60 3.1";
    case QSysInfo::SV_S60_3_2: return "S60 version: S60 3.2";
    case QSysInfo::SV_S60_5_0: return "S60 version: S60 5.0";
    case QSysInfo::SV_S60_Unknown: return "S60 version: S60 Unknown";
    default:
    break;
}

//Get OS version and display it on label
switch (QSysInfo::symbianVersion ())
{
    case QSysInfo::QSysInfo::SV_9_2: return "Symbian OS version: 9.2";
    case QSysInfo::SV_9_3: return "Symbian OS version: 9.3";
    case QSysInfo::SV_9_4: return "Symbian OS version: 9.4";
    case QSysInfo::SV_Unknown: return "Symbian OS version: Unknown";
    default:
    break;
}

BUT this doesn't compile as the QSysInfo class doesn't have s60Version method nor the symbian Version - I only get windowsVersion...


回答1:


Ok, found it - for everybody that needs that stuff:

QString carrierName = QSystemNetworkInfo::networkName(QSystemNetworkInfo::GsmMode);

QtMobility::QSystemDeviceInfo* d = new QtMobility::QSystemDeviceInfo(this);
QString imei = d->imei();
QString manufacturer = d->manufacturer();
QString model = d->model();
delete d;

QtMobility::QSystemInfo* s = new QtMobility::QSystemInfo(this);
QString osVer = s->version(QSystemInfo::Os);
delete s;

hope this helps someone :) cheers!



来源:https://stackoverflow.com/questions/4125314/how-do-i-get-phone-info-in-qt-carrier-device-model-device-manufacturer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!