slot of QClipboard::dataChanged() was called twice

  • The slot detectClipboardUrl of QClipboard::dataChanged() was called twice sometimes when I copy url in Google Chrome's address bar in this code, tested with PyQt5.7,Python3.5 on Win7 32bit, also on Linux Mint 18, while I need the slot to be called only once , is this a bug ? any solutions ?

    import sys
    from PyQt5.QtCore import *
    from PyQt5.QtGui import *
    from PyQt5.QtWidgets import *
    class MainWindow(QTableView):
        def __init__(self, parent=None):
            self.clipboard = QApplication.clipboard()
        def detectClipboardUrl(self):
            clipboardText = self.clipboard.text()
    if __name__ == "__main__":
        app = QApplication(sys.argv)
        ui = MainWindow()

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.