本文整理汇总了C++中parsertreeitem::Ptr::icon方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::icon方法的具体用法?C++ Ptr::icon怎么用?C++ Ptr::icon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parsertreeitem::Ptr
的用法示例。
在下文中一共展示了Ptr::icon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertTo
void ParserTreeItem::convertTo(QStandardItem *item) const
{
if (!item)
return;
QMap<SymbolInformation, ParserTreeItem::Ptr> map;
// convert to map - to sort it
CitSymbolInformations curHash = d->symbolInformations.constBegin();
CitSymbolInformations endHash = d->symbolInformations.constEnd();
while (curHash != endHash) {
map.insert(curHash.key(), curHash.value());
++curHash;
}
typedef QMap<SymbolInformation, ParserTreeItem::Ptr>::const_iterator MapCitSymbolInformations;
// add to item
MapCitSymbolInformations cur = map.constBegin();
MapCitSymbolInformations end = map.constEnd();
while (cur != end) {
const SymbolInformation &inf = cur.key();
ParserTreeItem::Ptr ptr = cur.value();
QStandardItem *add = new QStandardItem();
Utils::setSymbolInformationToItem(inf, add);
if (!ptr.isNull()) {
// icon
add->setIcon(ptr->icon());
// draggable
if (!ptr->symbolLocations().isEmpty())
add->setFlags(add->flags() | Qt::ItemIsDragEnabled);
// locations
add->setData(Utils::locationsToRole(ptr->symbolLocations()),
Constants::SymbolLocationsRole);
}
item->appendRow(add);
++cur;
}
}
示例2: convertTo
void ParserTreeItem::convertTo(QStandardItem *item, bool recursive) const
{
if (!item)
return;
QMap<SymbolInformation, ParserTreeItem::Ptr> map;
// convert to map - to sort it
QHash<SymbolInformation, ParserTreeItem::Ptr>::const_iterator curHash =
d->symbolInformations.constBegin();
QHash<SymbolInformation, ParserTreeItem::Ptr>::const_iterator endHash =
d->symbolInformations.constEnd();
while(curHash != endHash) {
map.insert(curHash.key(), curHash.value());
++curHash;
}
// add to item
QMap<SymbolInformation, ParserTreeItem::Ptr>::const_iterator cur = map.constBegin();
QMap<SymbolInformation, ParserTreeItem::Ptr>::const_iterator end = map.constEnd();
while(cur != end) {
const SymbolInformation &inf = cur.key();
ParserTreeItem::Ptr ptr = cur.value();
QStandardItem *add = new QStandardItem();
Utils::setSymbolInformationToItem(inf, add);
if (!ptr.isNull()) {
// icon
add->setIcon(ptr->icon());
// locations
add->setData(Utils::locationsToRole(ptr->symbolLocations()),
Constants::SymbolLocationsRole);
if (recursive)
cur.value()->convertTo(add, false);
}
item->appendRow(add);
++cur;
}
}