Reputation: 4411
I have the same question with this but in Qt.
How to paste clipboard content to arbitrary locations ***** (simulate CTRL+V) in Qt?
***** paste the clipboard outside of your Qt application without pressing CTRL+V
Upvotes: 3
Views: 1791
Reputation: 78548
I'm pretty sure you're gonna have to resort to platform specifics for this.
First, you will somehow have to get the id/handle of the previously active application. In Windows, this can be done with GetWindow()
, as outlined here. IN EWMH window managers, you can use the _NET_CLIENT_LIST_STACKING property.
Second, you'll have to ask that window to perform a paste action. Again, in Windows, SendMessage(window, WM_PASTE, 0, 0)
(docs for [SendMessage] and WM_PASTE). I'm actually not sure how you would accomplish this in X11.
There are problaby about 70 000 cases where the above approach won't work, but perhaps it can get you started?
Upvotes: 1
Reputation: 1
You need to use the QClipboard class.
But I'm not sure to understand the question. What does "arbitrary location" means? Do you want to paste the clipboard outside of your Qt application? (I don't think that X11 and ICCCM and EWMH enables that).
Upvotes: 1