MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / renderToPixmap

Method renderToPixmap

launcher/ui/instanceview/InstanceView.cpp:777–800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

775}
776
777QPixmap InstanceView::renderToPixmap(const QModelIndexList& indices, QRect* r) const
778{
779 Q_ASSERT(r);
780 auto paintPairs = draggablePaintPairs(indices, r);
781 if (paintPairs.isEmpty()) {
782 return QPixmap();
783 }
784 QPixmap pixmap(r->size());
785 pixmap.fill(Qt::transparent);
786 QPainter painter(&pixmap);
787#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
788 QStyleOptionViewItem option;
789 initViewItemOption(&option);
790#else
791 QStyleOptionViewItem option = viewOptions();
792#endif
793 option.state |= QStyle::State_Selected;
794 for (int j = 0; j < paintPairs.count(); ++j) {
795 option.rect = paintPairs.at(j).first.translated(-r->topLeft());
796 const QModelIndex& current = paintPairs.at(j).second;
797 itemDelegate()->paint(&painter, option, current);
798 }
799 return pixmap;
800}
801
802QList<std::pair<QRect, QModelIndex>> InstanceView::draggablePaintPairs(const QModelIndexList& indices, QRect* r) const
803{

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected