本文整理汇总了C++中ModItem::getClassRestr方法的典型用法代码示例。如果您正苦于以下问题:C++ ModItem::getClassRestr方法的具体用法?C++ ModItem::getClassRestr怎么用?C++ ModItem::getClassRestr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModItem
的用法示例。
在下文中一共展示了ModItem::getClassRestr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: index
QModelIndex ModItemsTree::index(int row, int column, const QModelIndex &parent)
const
{
if(!_enabled)
return QModelIndex();
if(!hasIndex(row,column,parent))
return QModelIndex();
ModItem *parentComponent;
if (!parent.isValid())
parentComponent = _rootElement;
else
parentComponent = static_cast<ModItem*>(parent.internalPointer());
// looking in children
if(row>parentComponent->childCount())
return QModelIndex();
ModItem *childElement = parentComponent->child(row);
if (!childElement)
return QModelIndex();
if(!_showComponents&&(childElement->getClassRestr()==Modelica::COMPONENT))
return QModelIndex();
else
return createIndex(row, column, childElement);
}
示例2: hasChildren
bool ModItemsTree::hasChildren ( const QModelIndex & parent ) const
{
bool hasChildren;
bool triedToFind;
if(!_enabled)
return false;
ModItem *parentElement;
if (parent.column() > 0)
return false;
if (!parent.isValid())
parentElement = rootElement();
else
parentElement = static_cast<ModItem*>(parent.internalPointer());
if(parentElement->childrenReaden())
{
if(_showComponents)
return (parentElement->childCount()>0);
else
return (parentElement->childCount()-parentElement->compChildCount()>0);
}
else
{
triedToFind = true;
hasChildren = false;
QStringList children = _moomc->getClassNames(parentElement->name());
children.removeAll(QString());
if(!children.isEmpty())
hasChildren = true;
else if(parentElement->getClassRestr()==Modelica::MODEL)
{
if(!_showComponents)
{
hasChildren = false;
triedToFind = false;
}
else
{
// look if has component children
QStringList compNames;
QStringList compClasses;
_moomc->getContainedComponents(parentElement->getModClassName(),compNames,compClasses,true);
hasChildren = (!compNames.isEmpty());
}
}
if(triedToFind && !hasChildren)
parentElement->setChildrenReaden(true); // avoid re-reading
return hasChildren;
}
}