擅长:python、mysql、java
<p>请看这里:<a href="https://wiki.qt.io/PySide_Pitfalls" rel="noreferrer">PySide Pitfalls</a>。</p>
<blockquote>
<p>If a QObject falls out of scope in
Python, it will get deleted. You have
to take care of keeping a reference to
the object:</p>
<ul>
<li>Store it as an attribute of an object you keep around, e.g.
self.window = QMainWindow()</li>
<li>Pass a parent QObject to the object’s constructor, so it gets owned
by the parent</li>
</ul>
</blockquote>