| 749 | } |
| 750 | |
| 751 | QPixmap 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 ¤t = paintPairs.at(j).second; |
| 768 | itemDelegate()->paint(&painter, option, current); |
| 769 | } |
| 770 | return pixmap; |
| 771 | } |
| 772 | |
| 773 | QList<QPair<QRect, QModelIndex>> InstanceView::draggablePaintPairs(const QModelIndexList &indices, QRect *r) const |
| 774 | { |