Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是代码
QWebView* webView=new QWebView(this); webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); webView->load(QUrl(newsUrl));
任何情况下删除后,都会有一些内存无法删除
如果您使用 this 在构造函数中设置对象父级
( QWebView* webView=new QWebView(this); )
那么你不应该直接调用 delete 当你作为父级提供的类将被销毁时,内存将被释放
如果你想使用 delete,那么只需像这样构造对象:
QWebView* webView=new QWebView();