本文整理汇总了C++中ProjectTreeItem::getChild方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectTreeItem::getChild方法的具体用法?C++ ProjectTreeItem::getChild怎么用?C++ ProjectTreeItem::getChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectTreeItem
的用法示例。
在下文中一共展示了ProjectTreeItem::getChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: index
/**
* @brief ProjectManagerTreeModel::index Get index of item on row and column with given parent.
* @param row Row number.
* @param column Column number.
* @param parent Parent of item we want to get.
* @return Index of our item.
*/
QModelIndex ProjectManagerTreeModel::index(int row, int column, const QModelIndex &parent) const
{
if(!hasIndex(row, column, parent))
return QModelIndex();
ProjectTreeItem* pItem;
if(!parent.isValid())
pItem = root;
else
pItem = static_cast<ProjectTreeItem*>(parent.internalPointer());
ProjectTreeItem* cItem = pItem->getChild(row);
if(cItem)
return createIndex(row,column, cItem);
else
return QModelIndex();
}
示例2: removeRows
/**
* @brief ProjectManagerTreeModel::removeRows Remove rows from this model.
* @param row Row number where we start removing items.
* @param count How many items we want to remove.
* @param parent Parent of items we want to remove.
* @return True if we removed items, false otherwise.
*/
bool ProjectManagerTreeModel::removeRows(int row, int count, const QModelIndex &parent)
{
beginRemoveRows(parent, row, row+count);
if(insertType == ProjectTreeItem::PROJECT)
{
ProjectTreeItem* item = root->getChild(row);
delete item;
}
else if(insertType == ProjectTreeItem::SHADER)
{
ProjectTreeItem* parentItem = static_cast<ProjectTreeItem*>(parent.internalPointer());
ProjectTreeItem* item = parentItem->getChild(row);
delete item;
}
endRemoveRows();
return true;
}