本文整理汇总了C++中DataElement::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ DataElement::getType方法的具体用法?C++ DataElement::getType怎么用?C++ DataElement::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataElement
的用法示例。
在下文中一共展示了DataElement::getType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VERIFYNR
void GetDataElement<T>::populateTreeWidgetItem(QTreeWidgetItem* pRoot)
{
VERIFYNR(pRoot != NULL);
QVariant value = pRoot->data(GetSessionItemBase<T>::NameColumn, GetSessionItemBase<T>::SessionItemRole);
void* pValue = value.value<void*>();
DataElement* const pRootElement = reinterpret_cast<DataElement*>(pValue);
const std::vector<DataElement*> elements = Service<ModelServices>()->getElements(pRootElement, std::string());
for (std::vector<DataElement*>::const_iterator iter = elements.begin(); iter != elements.end(); ++iter)
{
DataElement* pChildElement = *iter;
if (pChildElement == NULL)
{
// Disallow NULL elements since that would result in infinite recursion.
continue;
}
std::auto_ptr<QTreeWidgetItem> pChild(new QTreeWidgetItem);
std::string name = pChildElement->getDisplayName();
if (name.empty() == true)
{
name = pChildElement->getName();
}
pChild->setText(GetSessionItemBase<T>::NameColumn, QString::fromStdString(name));
pChild->setData(GetSessionItemBase<T>::NameColumn,
GetSessionItemBase<T>::SessionItemRole, QVariant::fromValue<void*>(pChildElement));
pChild->setText(GetSessionItemBase<T>::TypeColumn, QString::fromStdString(pChildElement->getType()));
populateTreeWidgetItem(pChild.get());
const bool isValid = pChildElement->isKindOf(TypeConverter::toString<T>());
pChild->setFlags(isValid ? Qt::ItemIsEnabled | Qt::ItemIsSelectable : Qt::NoItemFlags);
if (isValid == true || pChild->childCount() > 0)
{
pRoot->addChild(pChild.release());
}
}
}