CSwordVerseKey indexToVerseKey(const QModelIndex &index) const { Q_ASSERT(indexDepth(index) == 2); const List *l = indexList(index); QMutexLocker locker(&BtMiniSwordMutex); CSwordVerseKey key(l->_module); key.setIntros(true); key.setIndex(l->_hasScope ? l->_scopeMap[index.row()] : index.row() + l->_firstEntry); return key; }
/** List for index. */ List * indexList(const QModelIndex &index) const { if(indexDepth(index) == 1) return &_lists[index.internalId()]; else { List *l = reinterpret_cast<List*>(index.internalId()); #ifdef QT_DEBUG for(int i = 0; i < _lists.size(); ++i) if(&_lists[i] == l) break; else if(i == _lists.size() - 1) Q_ASSERT(false); #endif return l; } }
rcoord TileGrid::phys2virt_r(icoord phys) const noexcept { return rcoord{static_cast<double>(phys.x * tileDim.x), static_cast<double>(phys.y * tileDim.y), indexDepth(phys.z)}; }
vicoord TileGrid::phys2virt_vi(icoord phys) const noexcept { return vicoord{phys.x, phys.y, indexDepth(phys.z)}; }