QClipboard duplicate image
-
I have code in my application to copy the content of a widget called picture to the clipboard.
QClipboard* clipboard = QGuiApplication::clipboard(); QPixmap pix{ picture->grab() }; clipboard->setPixmap(pix);which works fine. When that code is called the content of the widget is added to the system clipboard.
The oddness happens when the the application is closed: A duplicate of the last copy is added to the system clipboard.
FWIW this is using Qt 6.8.0 MSVC2022 on Windows 11
-
Does this still happen if you call QClipboard::clear() before exiting?
Edit. Perhaps only clear it if is yours.
if (clipboard->ownsClipboard()) clipboard->clear(); -
How do you know that there is a second image added? Does it also happen with a small reproducer? A simple main() adding an image to the clipboard?