Woah! That worked!
In my code the QPixmap frame is a member variable. So it is not falling out of scope. The QImage however, as a stack variable, is falling out of scope. So I guess we have to proceed from the supposition that a reference to the image was being held.
Reviewing the documentation I see that the overload:
QPixmap QPixmap::fromImage(QImage &&image, Qt::ImageConversionFlags flags = Qt::AutoColor)
To copy to clipboard, switch view to plain text mode
says "...without copying if possible." I guess that actually applies to both overloads.
I suppose the lesson learned is to look for detach()? If I see it I need to be mindful of the possibility that there may be lingering references if I don't call it?
Anyway, thanks again. I can move forward with my project.
Bookmarks