MCPcopy Create free account
hub / github.com/MultiMC/Launcher / renderToPixmap

Method renderToPixmap

launcher/ui/instanceview/InstanceView.cpp:751–771  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

749}
750
751QPixmap InstanceView::renderToPixmap(const QModelIndexList &indices, QRect *r) const
752{
753 Q_ASSERT(r);
754 auto paintPairs = draggablePaintPairs(indices, r);
755 if (paintPairs.isEmpty())
756 {
757 return QPixmap();
758 }
759 QPixmap pixmap(r->size());
760 pixmap.fill(Qt::transparent);
761 QPainter painter(&pixmap);
762 QStyleOptionViewItem option = viewOptions();
763 option.state |= QStyle::State_Selected;
764 for (int j = 0; j < paintPairs.count(); ++j)
765 {
766 option.rect = paintPairs.at(j).first.translated(-r->topLeft());
767 const QModelIndex &current = paintPairs.at(j).second;
768 itemDelegate()->paint(&painter, option, current);
769 }
770 return pixmap;
771}
772
773QList<QPair<QRect, QModelIndex>> InstanceView::draggablePaintPairs(const QModelIndexList &indices, QRect *r) const
774{

Callers

nothing calls this directly

Calls 6

isEmptyMethod · 0.80
fillMethod · 0.80
sizeMethod · 0.45
countMethod · 0.45
atMethod · 0.45
paintMethod · 0.45

Tested by

no test coverage detected