void runLayoutLoop(InLoop inLoop) { if (isHeaderVisible()) { inLoop(headerAttached); inLoop(getHeaderSeparator()); } bool prevItem = false; for (int i=0; i<list.size(); ++i) { auto attached = list[i]; if (qFuzzyCompare(attached->thickness(), 0.0)) continue; if (prevItem) { // prev is item if (attached->isQmlItem()) { if (attached->asItem()->isVisible()) { inLoop(&separator); // add sep inLoop(attached); // and item } } else// attachee is separator inLoop(attached); // add sep } else { // prev is separator if (attached->isQmlItem()) { if (attached->asItem()->isVisible()) inLoop(attached); // add item } // skip separator } prevItem = attached->isQmlItem(); } if (isFooterVisible()) { inLoop(getFooterSeparator()); inLoop(footerAttached); } }
QQuickItem *ItemListItem::itemAt(int index) const { if (index == HeaderItem) return headerItem(); if (index == FooterItem) return footerItem(); auto attached = d->list.value(index); return attached && attached->isQmlItem() ? attached->asItem() : nullptr; }
int Thing::getStackpos() { if(m_position.x == 65535 && asItem()) // is inside a container return 0; else if(const TilePtr& tile = getTile()) return tile->getThingStackpos(asThing()); else { logTraceError("got a thing with invalid stackpos"); return -1; } }
bool canInteract() const { return !m_separator && asItem()->isEnabled(); }