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

Method renderToPixmap

launcher/ui/instanceview/InstanceView.cpp:794–819  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

792}
793
794QPixmap InstanceView::renderToPixmap(const QModelIndexList &indices, QRect *r) const
795{
796 Q_ASSERT(r);
797 auto paintPairs = draggablePaintPairs(indices, r);
798 if (paintPairs.isEmpty())
799 {
800 return QPixmap();
801 }
802 QPixmap pixmap(r->size());
803 pixmap.fill(Qt::transparent);
804 QPainter painter(&pixmap);
805#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
806 QStyleOptionViewItem option;
807 initViewItemOption(&option);
808#else
809 QStyleOptionViewItem option = viewOptions();
810#endif
811 option.state |= QStyle::State_Selected;
812 for (int j = 0; j < paintPairs.count(); ++j)
813 {
814 option.rect = paintPairs.at(j).first.translated(-r->topLeft());
815 const QModelIndex &current = paintPairs.at(j).second;
816 itemDelegate()->paint(&painter, option, current);
817 }
818 return pixmap;
819}
820
821QList<std::pair<QRect, QModelIndex>> InstanceView::draggablePaintPairs(const QModelIndexList &indices, QRect *r) const
822{

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