本文整理汇总了C++中Package::displayName方法的典型用法代码示例。如果您正苦于以下问题:C++ Package::displayName方法的具体用法?C++ Package::displayName怎么用?C++ Package::displayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::displayName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDisplayName
QString PackageModel::getDisplayName(int row) const
{
#ifdef PACKAGEMODEL_LOG
qDebug() << Q_FUNC_INFO << row << m_packageList.count();
#endif
if (m_packageList.count() <= row || row < 0) {
return QString("");
}
Package *package = m_packageList.at(row);
return package->displayName();
}
示例2: 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();
//.........这里部分代码省略.........