当前位置: 首页>>代码示例>>C++>>正文


C++ CDevice::getActiveEnvironment方法代码示例

本文整理汇总了C++中CDevice::getActiveEnvironment方法的典型用法代码示例。如果您正苦于以下问题:C++ CDevice::getActiveEnvironment方法的具体用法?C++ CDevice::getActiveEnvironment怎么用?C++ CDevice::getActiveEnvironment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDevice的用法示例。


在下文中一共展示了CDevice::getActiveEnvironment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: data

QVariant CEnvironmentDetailsModel::data(const QModelIndex & index, int role) const {
    if (!m_Environment || (!index.isValid()))
        return QVariant();

    if ((role == Qt::DecorationRole) && (index.column() == ENVDET_MOD_STATEMENT)) {
        CDevice * device = qobject_cast<CDevice *>(m_Environment->parent());
        if (m_Environment == device->getActiveEnvironment()) {
            if ((qint8)(m_Environment->getSelectResults()[index.internalId()]))
                return QIcon(UI_ICON_SELECTED);
        }
        return QIcon(UI_ICON_UNSELECTED);
    }

    if (role != Qt::DisplayRole)
        return QVariant();

    switch (index.column()) {
    case ENVDET_MOD_STATEMENT:
        if (m_SelectConfig.filters[index.internalId()].invert)
            switch (m_SelectConfig.filters[index.internalId()].selType) {
            case SelectType::USER:
                return tr("not by user");
            case SelectType::ARP:
                return tr("not by arp");
            case SelectType::ESSID:
                return tr("not by ssid");
            case SelectType::AND_BLOCK:
                return tr("at least one not");
            case SelectType::OR_BLOCK:
                return tr("all not");
            default:
                break;
            }
        else
            switch (m_SelectConfig.filters[index.internalId()].selType) {
            case SelectType::USER:
                return tr("by user");
            case SelectType::ARP:
                return tr("by arp");
            case SelectType::ESSID:
                return tr("by ssid");
            case SelectType::AND_BLOCK:
                return tr("all");
            case SelectType::OR_BLOCK:
                return tr("at least one");
            default:
                break;
            }
    case ENVDET_MOD_VALUE:
        switch (m_SelectConfig.filters[index.internalId()].selType) {
        case SelectType::ARP:
            if (m_SelectConfig.filters[index.internalId()].macAddr.valid())
                return m_SelectConfig.filters[index.internalId()].ipAddr.toString() + ", "+
                       m_SelectConfig.filters[index.internalId()].macAddr.toString();
            else
                return m_SelectConfig.filters[index.internalId()].ipAddr.toString();
        case SelectType::ESSID:
            return m_SelectConfig.filters[index.internalId()].essid;
        default:
            break;
        }
    default:
        break;
    }

    return QVariant();
}
开发者ID:dosnut,项目名称:nut,代码行数:67,代码来源:cenvironmentdetailsmodel.cpp


注:本文中的CDevice::getActiveEnvironment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。