MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / geometryRect

Method geometryRect

launcher/ui/instanceview/InstanceView.cpp:727–761  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

725}
726
727QRect InstanceView::geometryRect(const QModelIndex &index) const
728{
729 const_cast<InstanceView*>(this)->executeDelayedItemsLayout();
730
731 if (!index.isValid() || isIndexHidden(index) || index.column() > 0)
732 {
733 return QRect();
734 }
735
736 int row = index.row();
737 if(geometryCache.contains(row))
738 {
739 return *geometryCache[row];
740 }
741
742 const VisualGroup *cat = category(index);
743 QPair<int, int> pos = cat->positionOf(index);
744 int x = pos.first;
745 // int y = pos.second;
746
747
748#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
749 QStyleOptionViewItem option;
750 initViewItemOption(&option);
751#else
752 QStyleOptionViewItem option = viewOptions();
753#endif
754
755 QRect out;
756 out.setTop(cat->verticalPosition() + cat->headerHeight() + 5 + cat->rowTopOf(index));
757 out.setLeft(m_spacing + x * (itemWidth() + m_spacing));
758 out.setSize(itemDelegate()->sizeHint(option, index));
759 geometryCache.insert(row, new QRect(out));
760 return out;
761}
762
763QModelIndex InstanceView::indexAt(const QPoint &point) const
764{

Callers

nothing calls this directly

Calls 8

positionOfMethod · 0.80
verticalPositionMethod · 0.80
headerHeightMethod · 0.80
rowTopOfMethod · 0.80
insertMethod · 0.80
isValidMethod · 0.45
containsMethod · 0.45
sizeHintMethod · 0.45

Tested by

no test coverage detected