擅长:python、mysql、java
<p>经过一番寻找和头发拉扯,我找到了解决办法。我将所有页面设置为中心小部件来显示它们,当阅读<a href="https://doc.qt.io/qt-4.8/qmainwindow.html" rel="noreferrer">QMainWindow documentation</a>时,我发现我的小部件基本上被qt删除,如前所述:</p>
<blockquote>
<p>Note: QMainWindow takes ownership of
the widget pointer and deletes it at
the appropriate time.</p>
</blockquote>
<p>因此,要开发多页应用程序,请查看<a href="https://doc.qt.io/qt-4.8/qstackedwidget.html" rel="noreferrer">QStackedWidget</a>。</p>