本文整理汇总了C++中Items::count方法的典型用法代码示例。如果您正苦于以下问题:C++ Items::count方法的具体用法?C++ Items::count怎么用?C++ Items::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Items
的用法示例。
在下文中一共展示了Items::count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateItemsGui
void CellMLAnnotationViewMetadataEditDetailsWidget::updateItemsGui(const Items &pItems,
const QString &pErrorMsg,
const bool &pLookupTerm)
{
Q_ASSERT(mItemsScrollArea);
// Prevent ourselves from being updated (to avoid any flickering)
setUpdatesEnabled(false);
// Keep track of some information
mItems = pItems;
mErrorMsg = pErrorMsg;
mLookupTerm = pLookupTerm;
// Create a new widget and layout
QWidget *newGridWidget = new QWidget(mItemsScrollArea);
QGridLayout *newGridLayout = new QGridLayout(newGridWidget);
newGridWidget->setLayout(newGridLayout);
// Populate our new layout, but only if there is at least one item
if (pItems.count()) {
// Create labels to act as headers
newGridLayout->addWidget(Core::newLabel(tr("Name"),
1.25, true, false,
Qt::AlignCenter,
newGridWidget),
0, 0);
newGridLayout->addWidget(Core::newLabel(tr("Resource"),
1.25, true, false,
Qt::AlignCenter,
newGridWidget),
0, 1);
newGridLayout->addWidget(Core::newLabel(tr("Id"),
1.25, true, false,
Qt::AlignCenter,
newGridWidget),
0, 2);
// Number of terms
newGridLayout->addWidget(Core::newLabel((pItems.count() == 1)?
tr("(1 term)"):
tr("(%1 terms)").arg(QString::number(pItems.count())),
1.0, false, true,
Qt::AlignCenter,
newGridWidget),
0, 3);
// Add the items
int row = 0;
foreach (const Item &item, pItems) {
// Name
newGridLayout->addWidget(Core::newLabel(item.name,
1.0, false, false,
Qt::AlignCenter,
newGridWidget),
++row, 0);
// Resource
QString itemInformation = item.resource+"|"+item.id;
QLabel *resourceLabel = Core::newLabel("<a href=\""+itemInformation+"\">"+item.resource+"</a>",
1.0, false, false,
Qt::AlignCenter,
newGridWidget);
resourceLabel->setAccessibleDescription("http://identifiers.org/"+item.resource+"/?redirect=true");
resourceLabel->setContextMenuPolicy(Qt::CustomContextMenu);
connect(resourceLabel, SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(showCustomContextMenu(const QPoint &)));
connect(resourceLabel, SIGNAL(linkActivated(const QString &)),
this, SLOT(lookupResource(const QString &)));
newGridLayout->addWidget(resourceLabel, row, 1);
// Id
QLabel *idLabel = Core::newLabel("<a href=\""+itemInformation+"\">"+item.id+"</a>",
1.0, false, false,
Qt::AlignCenter,
newGridWidget);
idLabel->setAccessibleDescription("http://identifiers.org/"+item.resource+"/"+item.id+"/?profile=most_reliable&redirect=true");
idLabel->setContextMenuPolicy(Qt::CustomContextMenu);
connect(idLabel, SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(showCustomContextMenu(const QPoint &)));
connect(idLabel, SIGNAL(linkActivated(const QString &)),
this, SLOT(lookupId(const QString &)));
//.........这里部分代码省略.........