我有一个简单的PyQt4应用程序(请参阅下面的代码),它揭示了下一个问题:如果我从QLineEdit中选择文本并将其复制到剪贴板,那么我只能在我的应用程序运行时将其粘贴到另一个应用程序.似乎在退出时PyQt应用程序清除了剪贴板,因此我无法在应用程序关闭后粘贴文本.
我该怎么做才能避免这个问题?
PyQt 4.4.3 @ Python 2.5 @ Windows XP.此效果也在PyQt 4.5+和Linux上得到证实.
import sys
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
edit = QtGui.QLineEdit()
edit.setText('foo bar')
edit.show()
app.exec_()
Run Code Online (Sandbox Code Playgroud)