From 012e764fd18b3947307b034c9d69f04ce95a5d67 Mon Sep 17 00:00:00 2001 From: Hugo Slepicka Date: Tue, 14 Aug 2018 11:49:11 -0700 Subject: [PATCH] FIX: Fix the clipboard copy. It was failing under MacOS and Windows. --- pydm/application.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pydm/application.py b/pydm/application.py index eec9851bb..34581e184 100644 --- a/pydm/application.py +++ b/pydm/application.py @@ -562,9 +562,14 @@ def show_address_tooltip(self, obj, event): # If the address has a protocol, and it is the default protocol, strip it out before putting it on the clipboard. m = re.match('(.+?):/{2,3}(.+?)$', addr) if m is not None and DEFAULT_PROTOCOL is not None and m.group(1) == DEFAULT_PROTOCOL: - QApplication.clipboard().setText(m.group(2), mode=QClipboard.Selection) + copy_text = m.group(2) else: - QApplication.clipboard().setText(addr, mode=QClipboard.Selection) + copy_text = addr + + clipboard = QApplication.clipboard() + clipboard.setText(copy_text) + event = QEvent(QEvent.Clipboard) + self.sendEvent(clipboard, event) def establish_widget_connections(self, widget): """