<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Thanks for your answer. After reading some other sources and qt
documentations the solution was simplier. I use QApplication.exit()
not QApplication.quit()<br>
<br>
<br>
<div class="moz-cite-prefix">Am 22.03.22 um 13:47 schrieb Zhao Lee:<br>
</div>
<blockquote type="cite"
cite="mid:649cf32e.6ef0.17fb1ab6c1b.Coremail.redstone-cold@163.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div
style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial">
<div style="margin: 0;"><a class="moz-txt-link-freetext" href="https://stackoverflow.com/questions/39191394/slot-of-qclipboarddatachanged-was-called-twice">https://stackoverflow.com/questions/39191394/slot-of-qclipboarddatachanged-was-called-twice</a></div>
<div style="margin: 0;">hope it helps.</div>
<p style="margin: 0;"><br>
</p>
<p style="margin: 0;"><br>
</p>
<p style="margin: 0;"><br>
</p>
<p style="margin: 0;"><br>
</p>
<p style="margin: 0;"><br>
</p>
<pre>
At 2022-03-22 19:02:05, "Gottfried Müller" <a class="moz-txt-link-rfc2396E" href="mailto:gottfried.mueller@gmx.de"><gottfried.mueller@gmx.de></a> wrote:
>Hello,
>
>the follwing example shows a different behaviour in pyqt5 and pyqt6. I
>did not found the reason. In pyqt5 after pressing the exit menu the
>function "confirmClose" is called once, in pyqt6 twice. Closing the
>application window does not show this effect. I wonder I am using
>QApplication.quit but I did not find it in the Qt documentations and I
>get no error. Substitute QApplication.quit with sys.exit has the same
>different effect.
>I am using manjaro pyt6.2.3, pyqt5.15.6, qt 6.2.3, qt.5.13
>
>import sys
>from PyQt6.QtWidgets import QApplication, QWidget, QPushButton, QMenu,
>QVBoxLayout
>
>class ApplWindow(QWidget):
> def __init__(self, parent=None):
> super().__init__(parent=parent)
> btn = QPushButton("Appl menu", parent=self)
> menu = QMenu(parent=self)
> exitProg = menu.addAction("Exit program")
> exitProg.triggered.connect(self.confirmClose)
> btn.setMenu(menu)
> layout = QVBoxLayout()
> layout.addWidget(btn)
> self.setLayout(layout)
>
> def closeEvent(self, event):
> self.confirmClose()
> event.ignore()
>
> def confirmClose(self):
> print("close confirmed")
> QApplication.quit()
>
>def main():
> appl = QApplication(sys.argv)
> applWindow = ApplWindow()
> applWindow.show()
> return appl.exec()
>
>
>if __name__ == "__main__":
> main()
</pre>
</div>
<br>
<br>
<span title="neteasefooter">
<p> </p>
</span></blockquote>
<br>
</body>
</html>