I am trying to capture a QDeclarativeItem into a QPixmap to drag it interactively:
Qt Code:
{ QObject* obj; boundingRect().size().toSize()); QStyleOptionGraphicsItem option; qobject_cast<QGraphicsItem*>(obj)->paint(&painter, &option); drag->setPixmap(draggedPixmap); }To copy to clipboard, switch view to plain text mode
The problem is, that not all children of the QDeclarativeItem will paint into the QPixmap (say, text won't show up in the QPixmap, but Rectangles will). Calling paint on the Text QDeclarativeItem directly produces garbage. Should I be capturing into a QImage?
Added after 36 minutes:
The answer: call GraphicsView::render()!
Bookmarks