bool selectFile (const File& target) { if (file == target) { setSelected (true, true); return true; } if (target.isAChildOf (file)) { setOpen (true); for (int maxRetries = 500; --maxRetries > 0;) { for (int i = 0; i < getNumSubItems(); ++i) if (FileListTreeItem* f = dynamic_cast <FileListTreeItem*> (getSubItem (i))) if (f->selectFile (target)) return true; // if we've just opened and the contents are still loading, wait for it.. if (subContentsList != nullptr && subContentsList->isStillLoading()) { Thread::sleep (10); rebuildItemsFromContentList(); } else { break; } } } return false; }
QModelIndex InspectorModel::index(int row, int column, const QModelIndex& index) const { auto subItem = getSubItem(index); if (subItem) { return createIndex(row, column, subItem); } return QModelIndex(); // invalid }
void GroupTreeViewItem::checkFileStatus() { for (int i = 0; i < getNumSubItems(); ++i) { ProjectTreeViewBase* p = dynamic_cast <ProjectTreeViewBase*> (getSubItem(i)); if (p != nullptr) p->checkFileStatus(); } }
//============================================================================== ProjectTreeViewBase* ProjectTreeViewBase::findTreeViewItem (const Project::Item& itemToFind) { if (item == itemToFind) return this; const bool wasOpen = isOpen(); setOpen (true); for (int i = getNumSubItems(); --i >= 0;) { if (ProjectTreeViewBase* pg = dynamic_cast <ProjectTreeViewBase*> (getSubItem(i))) if (ProjectTreeViewBase* found = pg->findTreeViewItem (itemToFind)) return found; } setOpen (wasOpen); return nullptr; }
const Ogre::UTFString & MultiList::getItem(size_t _index) { return getSubItem(0, _index); }
int InspectorModel::rowCount(const QModelIndex& index) const { auto subItem = getSubItem(index); return subItem ? subItem->getChildCount() : 0; }