Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save redstoneleo/38af77c69d91205f88f7c66b7892b18f to your computer and use it in GitHub Desktop.
Save redstoneleo/38af77c69d91205f88f7c66b7892b18f to your computer and use it in GitHub Desktop.
#I write the slot of QClipboard::dataChanged() as this to avoid the bug,
@pyqtSlot()
def detectClipboardUrl(self):
clipboardText = self.clipboard.text()
if getattr(self.clipboard, 'lastClipboardUrl', None) != clipboardText:
url = clipboardText
setattr(self.clipboard, 'lastClipboardUrl', url)
#会造成不能连续复制同样的url
self.on_autodownloadEnable_triggered() # 立即断开 Clipboard的信号联系,# 为了防止chrome造成signal call twice的bug
QTimer.singleShot(400, self.on_autodownloadEnable_triggered) # #会造成400ms内无法连续复制的url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment