<div style="color:#000; font-size: 14px;font-family: arial;"><div><span style="font-family: "Microsoft Yahei", 微软雅黑, verdana; line-height: 36px; font-size: 12px; background-color: rgb(255, 255, 255);">The slot of QClipboard::dataChanged() was called twice when I copy url in </span><span style="color: rgb(119, 119, 119); font-family: "Open Sans", Arial, "Lucida Grande", sans-serif; line-height: 19.5px; font-size: 12px;">Google Chrome's address bar on Win7 </span><span style="line-height: 23.8px;"> </span><span style="line-height: 23.8px;">32bit</span></div><div><br></div><div><br></div><div><br></div></div><!-- jy5ContentSuffix --><div>在2016年08月26 20时40分, "Zhao Lee"<redstone-cold@163.com>写道:</div><blockquote id="isReplyContent" style="padding-left:1ex; margin: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br><div><div style="color: rgb(0, 0, 0); font-family: arial; font-size: 14px;">As tested With PyQt5.7,Python3.5 on Win7 32bit,</div><div style="color: rgb(0, 0, 0); font-family: arial; font-size: 14px;"><span style="line-height: 1.7;">the slot </span><span style="line-height: 23.8px;">detectClipboardUrl </span><span style="line-height: 1.7;">of QClipboard::dataChanged() was called twice </span><span style="line-height: 23.8px;">In this code</span><span style="line-height: 1.7;">, while I need the slot to be called only once , any solutions ?</span></div><div><br></div><div>import sys</div><div>from PyQt5.QtCore import *</div><div>from PyQt5.QtGui import *</div><div>from PyQt5.QtWidgets import *</div><div><br></div><div><br></div><div>class MainWindow(QTableView):</div><div><br></div><div>    def __init__(self, parent=None):</div><div>        super().__init__(parent)</div><div>        self.clipboard = QApplication.clipboard()</div><div>        self.clipboard.dataChanged.connect(self.detectClipboardUrl)  </div><div><br></div><div>    @pyqtSlot()</div><div>    def detectClipboardUrl(self):</div><div>    <span class="Apple-tab-span" style="white-space:pre">  </span>print('detectClipboardUrl')</div><div>    <span class="Apple-tab-span" style="white-space:pre">    </span>clipboardText = self.clipboard.text()</div><div>    <span class="Apple-tab-span" style="white-space:pre">  </span>print(clipboardText)</div><div><br></div><div><br></div><div>if __name__ == "__main__":</div><div>    app = QApplication(sys.argv)</div><div>    ui = MainWindow()</div><div>    ui.show()</div><div>    sys.exit(app.exec_())</div><div style="color: rgb(0, 0, 0); font-family: arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: arial; font-size: 14px;"><br></div><div style="color: rgb(0, 0, 0); font-family: arial; font-size: 14px;"><br></div></div><br><br><span title="neteasefooter"><p> </p></span></blockquote><br><br><span title="neteasefooter"><div id="netease_mail_footer"><div style="border-top:#CCC 1px solid;padding:10px 5px;font-size:15px;color:#777;line-height:22px">邮箱革命来了!!网易163、126邮箱可以发送3G以上超大文件!</div></div></span>