Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save redstoneleo/2ac9ca8037e1621c2f49b264573d03fc to your computer and use it in GitHub Desktop.
Save redstoneleo/2ac9ca8037e1621c2f49b264573d03fc 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)
QTimer.singleShot(400, lambda:setattr(self.clipboard, 'lastClipboardUrl', None))#the interval of successive call of this slot is less than 400ms, after 400ms this line would allow you copy the same Text again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment