[electrum] add a copy_to_clipboard util function
Summary:
This has three benefits:
- factor some boilerplate code
- reduce the dependency on self.main_window in the address tab
- remove a QtWidgets.app reference that does not work with python6
Test Plan:
Go the the address tab, right click on an address and try the 2 copy actions. Test this also with the env var QT_API=pyqt6
Open a transaction dialog (right click on a tx in the history and click Details), select some text in the input widget, right click and "Copy Selected Text"
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D18344