本文整理汇总了C++中ProjectTreeItem::getNewItemPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectTreeItem::getNewItemPosition方法的具体用法?C++ ProjectTreeItem::getNewItemPosition怎么用?C++ ProjectTreeItem::getNewItemPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectTreeItem
的用法示例。
在下文中一共展示了ProjectTreeItem::getNewItemPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shaderCreated
/**
* @brief ProjectManagerTreeModel::shaderCreated Call this method when new shader was created.
* @param name Name of the new shader.
*/
void ProjectManagerTreeModel::shaderCreated(QString name)
{
ProjectTreeItem* item;
MetaProject* p = static_cast<MetaProject*>(sender());
QStringList treePath;
treePath << p->getName();
if(p->getFragmentRelativePaths().contains(name))
treePath << FRAG;
else
treePath << VERT;
//treePath += name.split(QDir::separator());
treePath += name.split('/');
item = root->findLastCreatedFromStart(treePath);
//int row = item->getRowCount();
//QStringList offset = item->getNewPart(name.split(QDir::separator()));
QStringList offset = item->getNewPart(name.split('/'));
int row = 0;
insertData = name;
insertType = ProjectTreeItem::SHADER; // insert new shader
temp = item;
if(offset.size() == 1)
{
row = item->getNewItemPosition(offset.first(),ProjectTreeItem::SHADER);
}
else if(offset.size() == 0)
{
row = item->getNewItemPosition("",ProjectTreeItem::DIRECTORY);
}
else
{
row = item->getNewItemPosition(offset.first(),ProjectTreeItem::DIRECTORY);
}
QModelIndex index = createIndex(item->getRow(),0,item);
insertRows(row, 1, index);
emit dataChanged(index,index);
}