本文整理汇总了C++中ProjectTreeItem::getRow方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectTreeItem::getRow方法的具体用法?C++ ProjectTreeItem::getRow怎么用?C++ ProjectTreeItem::getRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectTreeItem
的用法示例。
在下文中一共展示了ProjectTreeItem::getRow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shaderRemoved
/**
* @brief ProjectManagerTreeModel::shaderRemoved Call this method when shader was removed.
* @param name Name of the removed shader.
*/
void ProjectManagerTreeModel::shaderRemoved(QString name, MetaShader::SHADERTYPE type)
{
ProjectTreeItem* item;
MetaProject* proj = dynamic_cast<MetaProject*>(sender());
if(proj == NULL)
return;
//convert path to -> projectName '/' path
QString projName = proj->getName();
name.insert(0,projName + '/');
if(type == MetaShader::FRAGMENT)
//item = root->findLastCreated(name.split(QDir::separator()),ProjectTreeItem::FRAGMENT);
item = root->findLastCreated(name.split('/'),ProjectTreeItem::FRAGMENT);
else
//item = root->findLastCreated(name.split(QDir::separator()),ProjectTreeItem::VERTEX);
item = root->findLastCreated(name.split('/'),ProjectTreeItem::VERTEX);
ProjectTreeItem* candidate = item->getRemoveCandidate();
int row = candidate->getRow();
insertData = name;
insertType = ProjectTreeItem::SHADER;
QModelIndex index = createIndex(candidate->getParent()->getRow(), 0, candidate->getParent());
removeRows(row,1,index);
emit dataChanged(index,index);
}
示例2: parent
/**
* @brief ProjectManagerTreeModel::parent Get parent of item with index.
* @param child Child where we want get parent item.
* @return Parent of given child.
*/
QModelIndex ProjectManagerTreeModel::parent(const QModelIndex &child) const
{
if(!child.isValid())
return QModelIndex();
ProjectTreeItem* cItem = static_cast<ProjectTreeItem*>(child.internalPointer());
ProjectTreeItem* pItem = cItem->getParent();
if(pItem == root)
return QModelIndex();
return createIndex(pItem->getRow(), 0, pItem);
}
示例3: 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);
}