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


C++ Package::filterName方法代码示例

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


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

示例1: data

QVariant PackageModel::data(const QModelIndex &index, int role) const
{
#ifdef PACKAGEMODEL_LOG   	
    qDebug() << Q_FUNC_INFO << index.row() << role;
#endif

    if (!index.isValid() || index.row() >= m_packageList.count())
        return QVariant("");

    // Package *package = m_packageList.at(index.row());
    Package *package = static_cast<Package*>(index.internalPointer());

    QObject *object = static_cast<QObject*>(package);
    if (role == PackageObjectRole)
        return qVariantFromValue(object);

    QSharedPointer <PackageInfo> data =  package->package();
    PackageInfo *updateData = package->updateBasicInfo();
    DetailsInfo *details = package->details();
    DetailsInfo *updateDetails = package->updateDetails();

    if (data.isNull())
        return QVariant("");

    UpdateDetails *updateInfo = package->updateInfo();

    int group = (role & DetailMask);
    switch (group) {
    case DetailsRoleMask:
        QTimer::singleShot(1, package, SLOT(fetchPackageDetails()));
        break;
    case UpdateDetailsRoleMask:
        QTimer::singleShot(1, package, SLOT(fetchUpdateDetails()));
        break;
    case UpdateInfoRoleMask:
        QTimer::singleShot(1, package, SLOT(fetchUpdateInfo()));
        break;
    default:
        break;
    }

    switch (role) {

    case DisplayNameRole:   return package->displayName();
    case FilterNameRole:    return package->filterName();
    case IsMarkedRole:      return QVariant(package->isMarked());

    case IdRole:        return data->id();
    case NameRole:      return PackageKit::Transaction::packageName(data.data()->id());
    case VersionRole:   return PackageKit::Transaction::packageVersion(data.data()->id());
    case ArchRole:      return PackageKit::Transaction::packageArch(data.data()->id());
    case DataRole:      return PackageKit::Transaction::packageData(data.data()->id());
    case SummaryRole:   return data.data()->summary();
    case InfoRole:      return data.data()->info();
    case IconRole:      return PackageKit::Transaction::packageIcon(data.data()->id());

    case IsUpdateAvailableRole:
        return package->isUpdateAvailable();

    case UpdateIdRole:
        return updateData? QVariant(updateData->id()): QVariant("");
    case UpdateNameRole:
        return updateData? QVariant(PackageKit::Transaction::packageName(updateData->id())): QVariant("");
    case UpdateVersionRole:
        return updateData? QVariant(PackageKit::Transaction::packageVersion(updateData->id())): QVariant("");
    case UpdateArchRole:
        return updateData? QVariant(PackageKit::Transaction::packageArch(updateData->id())): QVariant("");
    case UpdateDataRole:
        return updateData? QVariant(PackageKit::Transaction::packageData(updateData->id())): QVariant("");
    case UpdateSummaryRole:
        return updateData? QVariant(updateData->summary()): QVariant("");
    case UpdateInfoRole:
        return updateData? QVariant(updateData->info()): QVariant("");
    case UpdateIconRole:
        return updateData? QVariant(PackageKit::Transaction::packageIcon(updateData->id())): QVariant("");

    case DetailsLicenseRole:
        return details? QVariant(details->license()): QVariant("");
    case DetailsGroupRole:
        return details? QVariant(details->group()): QVariant("");
    case DetailsDescriptionRole:
        return details? QVariant(details->description()): QVariant("");
    case DetailsUrlRole:
        return details? QVariant(details->url()): QVariant("");
    case DetailsSizeRole:
        return details? QVariant(QVariant(details->size())): QVariant("");

    case UpdateDetailsLicenseRole:
        return updateDetails? QVariant(updateDetails->license()): QVariant("");
    case UpdateDetailsGroupRole:
        return updateDetails? QVariant(updateDetails->group()): QVariant("");
    case UpdateDetailsDescriptionRole:
        return updateDetails? QVariant(updateDetails->description()): QVariant("");
    case UpdateDetailsUrlRole:
        return updateDetails? QVariant(updateDetails->url()): QVariant("");
    case UpdateDetailsSizeRole:
        return updateDetails? QVariant(updateDetails->size()): QVariant("");

    case DetailsAvailableRole:
        return package->detailsAvailability();
//.........这里部分代码省略.........
开发者ID:Morpog,项目名称:qmlpackagemanager,代码行数:101,代码来源:packagemodel.cpp


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